Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3605b7e

Browse filesBrowse files
committed
add a mypy pre-commit hook and add more explicit
excludes to mypy toml config
1 parent 9cd50a3 commit 3605b7e
Copy full SHA for 3605b7e

File tree

Expand file treeCollapse file tree

2 files changed

+31
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+31
-7
lines changed

‎.pre-commit-config.yaml

Copy file name to clipboardExpand all lines: .pre-commit-config.yaml
+17Lines 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

Copy file name to clipboardExpand all lines: pyproject.toml
+14-7Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,24 @@ convention = "numpy"
207207
"galleries/users_explain/text/text_props.py" = ["E501"]
208208

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

222229
[tool.rstcheck]
223230
ignore_directives = [

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.