-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-missing-imports not working for modularized typeshed types #10283
Comments
Digging into it a bit more this seems to be intentional: Lines 2446 to 2452 in e46aa6d
However even putting the more specific, non-global ignore in config (eg [mypy-redis.*] ignore_missing_imports = True ) fails to suppress the error as long as the global --ignore-missing-imports /[mypy] ignore_missing_imports = True is set.
Given the comment, I wonder if the "fix" here is to look for a more specific ignore and honor that if it exists? Is that even feasible? Either way it would be great to inform users that the |
I think that if we have |
…on missing stubs
…d stubs This makes `ignore_missing_imports` special by making it work a bit differently, depending on whether it's set globally or per module. The new behavior is less surprising. This makes it possible to ignore arbitrary missing third-party stub packages, even those which used to have bundled stubs. Fixes #10283.
It has to be specified as a per-module option, if the library used to have bundled stubs. This way mypy won't silently start ignoring these missing stubs. This makes `ignore_missing_imports` special by making it work a bit differently, depending on whether it's set globally or per module. The new behavior is less surprising. This makes it possible to ignore arbitrary missing third-party stub packages, even those which used to have bundled stubs. Fixes #10283.
…0582) It has to be specified as a per-module option, if the library used to have bundled stubs. This way mypy won't silently start ignoring these missing stubs. This makes ignore_missing_imports special by making it work a bit differently, depending on whether it's set globally or per module. The new behavior is less surprising. This makes it possible to ignore arbitrary missing third-party stub packages, even those which used to have bundled stubs. Fixes #10283. Originally implemented by @TheCleric in #10283. This is somewhat simpler alternative implementation which is easier to reason about and may perform better in some cases of very large configs.
…0582) It has to be specified as a per-module option, if the library used to have bundled stubs. This way mypy won't silently start ignoring these missing stubs. This makes ignore_missing_imports special by making it work a bit differently, depending on whether it's set globally or per module. The new behavior is less surprising. This makes it possible to ignore arbitrary missing third-party stub packages, even those which used to have bundled stubs. Fixes #10283. Originally implemented by @TheCleric in #10283. This is somewhat simpler alternative implementation which is easier to reason about and may perform better in some cases of very large configs.
Bug Report
Mypy does not respect the
--ignore-missing-imports
flag/ignore_missing_imports = True
config for types that are now modularized out of typeshed (eg thelegacy_bundled_packages
).I don't think this is a typeshed bug, but let me know if you disagree and I can make an issue there instead.
To Reproduce
Given the following file:
I always get the following output:
It doesn't matter whether
--ignore-missing-imports
is included or whethertypes-redis
is installed, it will always give me exactly that output.Note that a line like
from foo_asdf import bar
is correctly ignored by the--ignore-missing-imports
flag and types that are defined bytypes-redis
(likeredis.StrictRedis
) will work correctly (with or without the flag) when that package is installed.Your Environment
mypy 0.820+dev.e46aa6df6126cf47bea97bf9f94d7cba093d0103
(latestmaster
at time of filing)--ignore-missing-imports
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: