From 0e70acab79c6ee6cb646c0b08278eaecb5b070f6 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 12 Jan 2020 20:12:35 +0100 Subject: [PATCH] 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 (https://github.com/erikrose/more-itertools/pull/374). --- .pre-commit-config.yaml | 2 +- setup.py | 5 ++++- tox.ini | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 67b10c6af..978cfcde8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: - id: pyupgrade args: [--py3-plus] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.761 + rev: v0.761 # NOTE: keep this in sync with setup.py. hooks: - id: mypy files: ^(src/|testing/) diff --git a/setup.py b/setup.py index d7f3d7dbf..892b55aed 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,10 @@ def main(): "nose", "requests", "xmlschema", - ] + ], + "checkqa-mypy": [ + "mypy==v0.761", # keep this in sync with .pre-commit-config.yaml. + ], }, install_requires=INSTALL_REQUIRES, ) diff --git a/tox.ini b/tox.ini index bc0646d12..9c50c329c 100644 --- a/tox.ini +++ b/tox.ini @@ -55,6 +55,10 @@ basepython = python3 deps = pre-commit>=1.11.0 commands = pre-commit run --all-files --show-diff-on-failure {posargs:} +[testenv:mypy] +extras = checkqa-mypy, testing +commands = mypy {posargs:src testing} + [testenv:docs] basepython = python3 usedevelop = True