Skip to content

Commit 0e70aca

Browse files
committed
tox: add mypy toxenv
This is different from what pre-commit (in "linting") runs in that it uses stubs from (test) dependencies. It would make sense to run this on CI additionally (since there is no "pre-commit --skip mypy", and a separate config is not worth it). But currently it triggers a false positive though anyway (more-itertools/more-itertools#374).
1 parent 8eec42f commit 0e70aca

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ repos:
3737
- id: pyupgrade
3838
args: [--py3-plus]
3939
- repo: https://github.com/pre-commit/mirrors-mypy
40-
rev: v0.761
40+
rev: v0.761 # NOTE: keep this in sync with setup.py.
4141
hooks:
4242
- id: mypy
4343
files: ^(src/|testing/)

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ def main():
2929
"nose",
3030
"requests",
3131
"xmlschema",
32-
]
32+
],
33+
"checkqa-mypy": [
34+
"mypy==v0.761", # keep this in sync with .pre-commit-config.yaml.
35+
],
3336
},
3437
install_requires=INSTALL_REQUIRES,
3538
)

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ basepython = python3
5555
deps = pre-commit>=1.11.0
5656
commands = pre-commit run --all-files --show-diff-on-failure {posargs:}
5757

58+
[testenv:mypy]
59+
extras = checkqa-mypy, testing
60+
commands = mypy {posargs:src testing}
61+
5862
[testenv:docs]
5963
basepython = python3
6064
usedevelop = True

0 commit comments

Comments
 (0)