-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
tox: add mypy toxenv #6446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tox: add mypy toxenv #6446
Conversation
Does pre-commit add its own configurations?
This will be nice to have, IIUC, this currently only includes the non-testing dependencies. But the mypy run also includes |
.pre-commit-config.yaml
Outdated
args: [--py3-plus] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v0.740 | ||
rev: v0.740 # NOTE: keep this in sync with setup.py. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for anyone doing the merge from features, note that features is already at v0.761
.
setup.py
Outdated
] | ||
], | ||
"mypy": [ | ||
"mypy==v0.740", # keep this in sync with .pre-commit-config.yaml. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the advantage of adding an extra over specifying a deps
in [testenv:mypy]
tox?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If e.g. pre-commit could also use the extra, the version could be changed just there.
Given requirements.txt, tox.ini etc I often find it more sane to have this in a more central place like setup.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, makes sense.
I fear though that people will see it and start doing pytest[mypy]
due to a misconception. There are probably tools which parse the extras and show them to the user. So WDYT about changing the name to mypy-internal
or _mypy
or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. What about checkqa-mypy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's clear enough I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, amended.
I thought it would have additional args, but does not have them. So the only diff is with the deps. Added the testing extra also. |
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).
This is different from what pre-commit (in "linting") runs in that it
uses our config (alone), and stubs from 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).
Currently it triggers a false positive though anyway
(more-itertools/more-itertools#374).