Use error subcodes to differentiate import errors#14740
Merged
hauntsaninja merged 3 commits intopython:masterfrom Aug 10, 2023
Merged
Use error subcodes to differentiate import errors#14740hauntsaninja merged 3 commits intopython:masterfrom
hauntsaninja merged 3 commits intopython:masterfrom
Conversation
Resolves python#9789 Users could use `--disable-error-code=import-untyped` to only ignore errors about libraries not having stubs, but continue to get errors about e.g. typos in an import name. The sub error code mechanism is new. Note that users will now get a different error code depending on whether or not a package is installed, and may not know that they can use the parent error code to ignore the issue regardless. I think this is okay, in general type checking results can change if you run them in two different environments.
This comment has been minimized.
This comment has been minimized.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: |
Collaborator
97littleleaf11
left a comment
There was a problem hiding this comment.
Any test case for import-untyped?
Contributor
|
Tangentially related, this makes me notice extracting only import errors is a good way to look for missing type dependencies in mypy_primer. |
hauntsaninja
added a commit
that referenced
this pull request
Aug 10, 2023
See #14740 My PR was pretty old and predates the nice check to ensure error codes are documented.
This was referenced Aug 13, 2023
This was referenced Aug 31, 2023
hauntsaninja
added a commit
that referenced
this pull request
Sep 2, 2023
JukkaL
pushed a commit
that referenced
this pull request
Oct 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #9789
Users could use
--disable-error-code=import-untypedto only ignore errors about libraries not having stubs, but continue to get errors about e.g. typos in an import name.The error subcode mechanism is new from #14570. Note that users will now get a different error code depending on whether or not a package is installed, and may not know that they can use the parent error code to ignore the issue regardless. I think this is okay, in general type checking results can change if you run them in two different environments. Note also that with
--warn-unused-ignore/--strictmypy will complain about not having the most specific error code