8000 Merge pull request #26954 from story645/mypy-precommit · adescoeudres/matplotlib@6061057 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 6061057

Browse files
authored
Merge pull request matplotlib#26954 from story645/mypy-precommit
add a mypy pre-commit hook
2 parents 9bc8c53 + 9923ef9 commit 6061057

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ repos:
2626
- id: no-commit-to-branch #default is master and main
2727
- id: trailing-whitespace
2828
exclude_types: [svg]
29+
- repo: https://github.com/pre-commit/mirrors-mypy
30+
rev: v1.1.1
31+
hooks:
32+
- id: mypy
33+
additional_dependencies: [
34+
pandas-stubs,
35+
types-pillow,
36+
types-python-dateutil,
37+
types-psutil,
38+
types-docutils,
39+
types-PyYAML]
40+
args: [
41+
"--config-file=pyproject.toml",
42+
"lib/matplotlib"
43+
]
44+
files: lib/matplotlib #only run when files in lib/matplotlib are changed
45+
pass_filenames: false
2946
- repo: https://github.com/pycqa/flake8
3047
rev: 6.0.0
3148
hooks:

pyproject.toml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,25 @@ convention = "numpy"
207207
"galleries/users_explain/text/text_props.py" = ["E501"]
208208

209209
[tool.mypy]
210+
ignore_missing_imports = true
211+
enable_incomplete_feature = [
212+
"Unpack",
213+
]
210214
exclude = [
215+
#stubtest
211216
".*/matplotlib/(sphinxext|backends|testing/jpl_units)",
212-
".*/mpl_toolkits",
217+
#mypy precommit
218+
"galleries/",
219+
"doc/",
220+
"lib/matplotlib/backends/",
221+
"lib/matplotlib/sphinxext",
222+
"lib/matplotlib/testing/jpl_units",
223+
"lib/mpl_toolkits/",
224+
#removing tests causes errors in backends
225+
"lib/matplotlib/tests/",
213226
# tinypages is used for testing the sphinx ext,
214227
# stubtest will import and run, opening a figure if not excluded
215-
".*/tinypages",
216-
]
217-
enable_incomplete_feature = [
218-
"Unpack",
228+
".*/tinypages"
219229
]
220230

221231
[tool.rstcheck]

0 commit comments

Comments
 (0)
0