-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Ignore mypy's missing import warning for requests #4011
Conversation
LGTM! Thanks for the fix @datumbox A quick question: Any specific reasons for ignoring the type check instead of installing the stubs? |
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.
I'm with @AnirudhDagar here: installing the stubs would make the mypy
check more reliable. mypy
is not a necessary evil that needs to be silenced whenever it turns up something. We opted to use it to catch bugs that are not covered by our tests.
I'm curious, in the PRs that were making the code mypy compliant, did you catch actual bugs? |
@pmeier @AnirudhDagar The master is currently failing and when this happens it's high priority to fix it. This PR is not about improving the code, it's about restoring the CI in green state. In situations like this, please avoid blocking such PRs unless you see a bug being introduced and opt for making any suggested improvements on subsequent PRs. |
It has been a while, but I'm fairly certain that the answer was no. IMO that is a testament to good reviews. While developing, I often find myself in a position where |
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.
Let's get this merged to get CI green. We can always send a follow-up PR adding it to the stubs.
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.
Stamping, but even though I hate mypy, I agree with @pmeier on this one: it wouldn't hurt much to spend a bit more time to fix the root of the issue.
@datumbox The fix for this is exactly the same number of lines: add vision/.circleci/config.yml.in Line 207 in ea6be12
|
@datumbox did not mean to question or block you. Sorry for that. It is definitely important to get a master to green in such a case. |
Thanks @pmeier for the feedback
And to good tests I think
Interesting. My own experience was that whatever mypy was flagging was forcing me to re-write the code into something that either doesn't make sense, or is less readable ^^
I disagree with the test part from that talk because it's talking about input validation checks: we can't rely on types for that, because this would assume that our users also use mypy. For libraries such as torchvision, type annotation brings nothing to the table when it comes to input validation of user-facing utilities. |
@pmeier I understand that the fix you have in mind might be trivial in this specific case but changes like this still need time to be tested. IMO restoring the CI in green state when it's a false positive is high priority and buys us time to do any further due diligence on improving the code and resolving the root cause. By restoring the CI, it will unblock contributors such as @AnirudhDagar who currently get the wrong signal. Happy to review a PR that addresses the issue and improve the codebase. |
Reviewed By: fmassa Differential Revision: D29097713 fbshipit-source-id: 861f48451c5e1bf38a05f233f6475803d49b3d85
Fixes #4009