8000 Add mypy to reviewdog workflow · matplotlib/matplotlib@d17af32 · GitHub
[go: up one dir, main page]

Skip to content

Commit d17af32

Browse files
committed
Add mypy to reviewdog workflow
add numpy to mypy and explicitly use pyproject.toml for config update reviewdog filter Add explicit inline excludes Add deps to mypy run remove numpy from mypy, add python-dateutil Add default dependencies to mypy deps mypy requirements fix python version requirement psutil stubs plus sphinx install Add ignore missing imports (cycler and a handful of others do not _yet_ have released type hints) add follow imports skip to mypy ci remove explicit extra excludes in mypy ci, rely on config Add back pipe mypy ci follow imports silent mypy ci Add comment about ignore missing imports in mypy ci
1 parent b74e182 commit d17af32

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

.github/workflows/reviewdog.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,40 @@ jobs:
3838
flake8 --docstring-convention=all | \
3939
reviewdog -f=pep8 -name=flake8 \
4040
-tee -reporter=github-check -filter-mode nofilter
41+
mypy:
42+
name: mypy
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v3
46+
47+
- name: Set up Python 3
48+
uses: actions/setup-python@v4
49+
with:
50+
python-version: 3.8
51+
52+
- name: Install mypy
53+
run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt
54+
55+
- name: Set up reviewdog
56+
run: |
57+
mkdir -p "$HOME/bin"
58+
curl -sfL \
59+
https://github.com/reviewdog/reviewdog/raw/master/install.sh | \
60+
sh -s -- -b "$HOME/bin"
61+
echo "$HOME/bin" >> $GITHUB_PATH
62+
63+
- name: Run mypy
64+
env:
65+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
set -o pipefail
68+
# the ignore missing imports can be removed when typed cycler is released and used
69+
mypy --config pyproject.toml lib/matplotlib \
70+
--ignore-missing-imports \
71+
--follow-imports silent | \
72+
reviewdog -f=mypy -name=mypy \
73+
-tee -reporter=github-check -filter-mode nofilter
74+
4175
4276
eslint:
4377
name: eslint

requirements/testing/mypy.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Extra pip requirements for the GitHub Actions flake8 build
2+
3+
mypy
4+
5+
# Extra stubs distributed separately from the main pypi package
6+
pandas-stubs
7+
types-pillow
8+
types-python-dateutil
9+
types-psutil
10+
11+
sphinx
12+
13+
# Default requirements, included here because mpl itself does not
14+
# need to be installed for mypy to run, but deps are needed
15+
# and pip has no --deps-only install command
16+
contourpy>=1.0.1
17+
cycler>=0.10
18+
fonttools>=4.22.0
19+
kiwisolver>=1.0.1
20+
numpy>=1.19
21+
packaging>=20.0
22+
pillow>=6.2.0
23+
pyparsing>=2.3.1
24+
python-dateutil>=2.7
25+
setuptools_scm>=7
26+
27+
importlib-resources>=3.2.0 ; python_version < "3.10"

0 commit comments

Comments
 (0)
0