-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Currently mypy users often have to ignore all imports (--ignore-missing-imports) because mypy can't find stubs for a third party library module. Instead, we could provide an option to only ignore specific imports everywhere within a program.
Potential way to support this:
mypy --ignore-imports=sqlalchemy,frobnicator program.py
This would have a few benefits over --ignore-missing-imports:
- It would be possible to have fine-grained control over ignored imports (without using a lot of
# type: ignorecomments). - It would be easy to guard against accidentally adding additional ignored dependencies.
- Users might be more likely to contribute stubs for 3rd party libraries since it would be more obvious where this would be helpful. Once users start using
--ignore-missing-imports, they lose a lot of visibility to which stubs are missing. - Mypy would be able to catch misspelled module names in import statements.
ilinum, OddBloke, Yobmod, musically-ut, kristleifur and 2 more