-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
mypy tests: Allow per distribution strictness options #1526
Comments
Good idea. |
I agree :) There are a lot of errors (little over 5000). Not sure if the effort to fix all of them so we can enable the flag is worth it. |
Considering only the $ cut -d/ -f1 < out | sort | uniq -c
77 stdlib
895 third_party so enabling this just for the stdlib initially might make addressing them more tractable? (Full breakdown by module at https://gist.github.com/OddBloke/dbd78409dcd53bdbb6b3b8571bd29720) |
I'm interested in tackling at least the stdlib side of this. Would it be better to do this as individual, more well thought-out PRs for each module, or one much larger commit that only does relatively general types |
In general, smaller PRs are easier to review, but too many PRs can also become cumbersome. It might be best to have one PR per package if a package has a few changes needed and a few PRs for packages that only have few changes. |
Note |
I am not sure we should enable either. I prefer to have unannotated types over using |
I agree on both points! (Although it's reasonable to aspire to turning this on as a lint for stdlib one day, since we're close to completion and hopefully the stdlib isn't changing too drastically). My point with the above was just that |
Good point about stdlib. |
Once we've migrated to modular typeshed, it should be easy to add support for specifying stricness options for each distribution separately in the metadata file. This wouldn't directly help with the stdlib, since stdlib would be distributed as a single entity. |
I renamed this ticket to what I believe the consensus of the discussion is. Please revert if you don't agree. |
As requested by #1526. This addition takes mypy configuration from each distribution metadata file and constructs a single mypy.ini to run with. It assumes there is no mypy.ini but in case we ever need one, it would be simple to add these on top of an existing configuration file. Might be relevant for #2852 As the issue did not really specify how the configuration would look, I added the following: - You may add a mypy-tests section to the metadata file. It looks like this: [mypy-tests] [mypy-tests.yaml] module_name = "yaml" [mypy-tests.yaml.values] disallow_incomplete_defs = true disallow_untyped_defs = true - module_name can be of the form "a.*" like in mypy.ini. - You can add several module sections for complex distributions with several modules. - I added the '--warn-incomplete-stub' option since it is made specifically for typeshed runs. See docs.
I've removed the "deferred" label as this could now be implemented. |
Fixed in #5169 |
We should try turning on the
--disallow-incomplete-defs
flag from python/mypy#3744. This can catch issues where we forget type annotations for some function arguments in a stub.The text was updated successfully, but these errors were encountered: