-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add flag to ignore 'Skipping analyzing ...' #9789
Comments
Reasonable request, although I'm wary of adding more knobs to mypy's import following... I think in practice people don't even understand the existing ones very well and they're a common source of confusion. I'd also phrase it as |
I think the distinction I see is that "untyped-imports" is not _really_
something most users can/will fix, but "missing-imports" almost certainly
means something is broken that the user needs to fix. I would advocate for
removing `--ignore-missing-imports`, but the docs vaguely allude to errors
in import finding that can't be fixed otherwise.
…On Wed, Dec 9, 2020 at 6:34 PM Shantanu ***@***.***> wrote:
Reasonable request, although I'm wary of adding more knobs to mypy's
import following... I think in practice people don't even understand the
existing ones very well and they're a common source of confusion. I'd also
phrase it as --ignore-untyped-imports.
Note that of those three errors, you won't run into one of them since
typeshed is virtually complete wrt stdlib right now. In fact, I recently
removed documentation of that error in #9675
<#9675>.
Finally, I'd personally contend with the assertion that it's closer to a
warning than an error :-) All three of them have the same potential effect:
causing a lot of your code to go unchecked.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9789 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAROG6EQYHNROHOGH57OYI3SUACSBANCNFSM4UUDJHXA>
.
|
I'd counter that this is an excellent feature request. Here's why: Often what mypy calls "errors" of "missing stubs" involve a 3rd party external library that the user is merely importing to extend their own code. It boils down to how much the user trusts these 3rd party libraries. For instance, I've gotten the Now I will concede that other 3rd party libraries that are not as well tested as the two above could very well cause a lot of your code to go unchecked, and therefore it would be reasonable for mypy to throw an error if those libraries are missing stubs. So in summary, Also I agree with @mfarrugi, as most users will probably not bother fixing "untyped-imports" from a 3rd party library that they are likely not familiar with aside from how to call functions to use within their code. |
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.
Resolves #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 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` / `--strict` mypy will complain about not having the most specific error code
On mypy master, you can use |
Pitch
Currently
--ignore-missing-imports
silences all 3 different errors listed in missing-imports, but missing-type-hints-for-third-party-library is closer to a warning than an error.The current solution is to list the packages to ignore in a configuration file, which is particularly onerous when there are many packages being built and type-checked.
Feature
Add a flag (eg.
--ignore-untyped-imports
) that either ignores this error, or downgrades it to a warning:Alternatively:
--ignore-missing-imports
, as that is nearly always a misconfiguration of mypyImplementation
https://github.com/python/mypy/blob/master/mypy/build.py#L2410-L2411 and other references to
options.ignore_missing_imports
would need to be changed.The text was updated successfully, but these errors were encountered: