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
Add a tox environment for running mypy #2431
Conversation
# Some of these packages contain typing information for packages that | ||
# don't themselves contain type hints. We might want to move these from | ||
# the tests section and into the specific mypy environment. | ||
tests = [ | ||
"hypothesis >= 6.35.1", | ||
"pandas-stubs >= 1.5.0.221010", # used by mypy | ||
"pre-commit >= 3.0.0", | ||
"pytest-regressions >= 2.3.1", | ||
"pytest-xdist >= 3.0.2", | ||
"tomli >= 2.0.1", | ||
"tox >= 4.3.1", | ||
"types-requests >= 2.27.1", # used by mypy | ||
"types-tqdm >= 4.66.0.3", # used by 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.
Turns out that the type stub packages can be installed using the --install-types
flag for mypy, so they're not needed here. Using that flag has the advantage that it'll probably get updated with type stub packages as more are created or obsoleted, which means less work for us to do!
tox.ini
Outdated
deps = | ||
mypy >= 1.8.0 | ||
commands = | ||
mypy plasmapy --install-types --non-interactive --show-error-context --show-error-code-links --pretty |
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.
We'll probably want to play with these flags to get the error reporting settings that work best for us.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2431 +/- ##
=======================================
Coverage 96.92% 96.92%
=======================================
Files 104 104
Lines 9128 9128
=======================================
Hits 8847 8847
Misses 281 281 ☔ View full report in Codecov by Sentry. |
This PR adds a tox environment for running the mypy static type checking tool. This tox environment will be added to our suite of continuous integration tests in #2432.
I am separating this PR out and merging it so that I can use this tox environment in other PRs, like #2429.
Related to #268. The motivation for using mypy is discussed in #2424.