Skip to content

Commit 8ddf142

Browse files
committed
add a mypy pre-commit hook and add more explicit
excludes to mypy toml config
1 parent e3a5cee commit 8ddf142

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ 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: ["--config-file=pyproject.toml",
41+
"lib/matplotlib"]
42+
pass_filenames: false
2943
- repo: https://github.com/pycqa/flake8
3044
rev: 6.0.0
3145
hooks:

pyproject.toml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,26 @@ convention = "numpy"
136136
"galleries/users_explain/text/text_props.py" = ["E501"]
137137

138138
[tool.mypy]
139+
ignore_missing_imports = true
140+
enable_incomplete_feature = [
141+
"Unpack",
142+
]
139143
exclude = [
140144
".*/matplotlib/(sphinxext|backends|testing/jpl_units)",
141145
".*/mpl_toolkits",
142146
# tinypages is used for testing the sphinx ext,
143147
# stubtest will import and run, opening a figure if not excluded
144148
".*/tinypages",
149+
"galleries/",
150+
"doc/",
151+
"lib/matplotlib/backends/",
152+
"lib/matplotlib/sphinxext",
153+
"lib/matplotlib/testing/jpl_units",
154+
"lib/mpl_toolkits/",
155+
"lib/matplotlib/tests/",
156+
145157
]
146-
ignore_missing_imports = true
147-
enable_incomplete_feature = [
148-
"Unpack",
149-
]
158+
150159

151160
[tool.rstcheck]
152161
ignore_directives = [

0 commit comments

Comments
 (0)