Skip to content
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

Merged
merged 12 commits into from Dec 29, 2023

Conversation

namurphy
Copy link
Member

@namurphy namurphy commented Dec 29, 2023

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.

@github-actions github-actions bot added testing CI Related to continuous integration GitHub Actions A continuous integration platform for automating tests and other tasks (see .github/ directory) packaging Related to packaging or distribution labels Dec 29, 2023
@namurphy namurphy changed the title Mypy tox GitHub actions Add a tox environment for running mypy Dec 29, 2023
Comment on lines -85 to -97
# 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
Copy link
Member Author

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
Copy link
Member Author

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.

Copy link

codecov bot commented Dec 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (38b2361) 96.92% compared to head (1042cc2) 96.92%.

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.
📢 Have feedback on the report? Share it here.

@namurphy namurphy marked this pull request as ready for review December 29, 2023 23:36
@namurphy namurphy requested a review from a team as a code owner December 29, 2023 23:36
@namurphy namurphy requested review from ejohnson-96 and removed request for a team December 29, 2023 23:36
@namurphy namurphy merged commit 5c43594 into PlasmaPy:main Dec 29, 2023
17 checks passed
@namurphy namurphy deleted the mypy-tox-github-actions branch December 29, 2023 23:36
@namurphy namurphy removed the request for review from ejohnson-96 December 29, 2023 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Related to continuous integration GitHub Actions A continuous integration platform for automating tests and other tasks (see .github/ directory) packaging Related to packaging or distribution static type checking testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant