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 static type check with mypy #2195

Merged
merged 9 commits into from
May 11, 2020
Merged

Add static type check with mypy #2195

merged 9 commits into from
May 11, 2020

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented May 8, 2020

For now mypy is configured to ignore every sub-package of torchvision. This restriction should be lifted PR by PR.

@fmassa This also fixes one remaining syntax error not covered by #1696 as well as some errors that were missed in #2034. I've included them here to have clean CI build, but I can split them off in separate PRs if you want.

flake8 .
flake8 --config=setup.cfg .
Copy link
Collaborator Author

@pmeier pmeier May 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without setting this explicitly flake8 seems to ignore the config altogether. For an example see

https://circleci.com/gh/pytorch/vision/135718?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

setup.cfg specifies to ignore F821, but it still errors with it.

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks a lot Philip!

@@ -9,5 +9,5 @@ max-line-length = 120

[flake8]
max-line-length = 120
ignore = F401,E402,F403,W503,W504
ignore = F401,E402,F403,W503,W504,F821
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, in the future we might want to remove this F821 and instead fix the annotations

@fmassa fmassa merged commit a81d99b into pytorch:master May 11, 2020
@fmassa fmassa mentioned this pull request May 18, 2020
@pmeier pmeier deleted the mypy branch July 30, 2020 17:11
@pmeier pmeier mentioned this pull request Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants