Make disallow-any-unimported
flag invertible by soceanainn · Pull Request #18030 · python/mypy (original) (raw)
That said, I'm obligated to disclaim that global --follow-imports=skip is evil. It's the most commonly misused mypy config I see. If someone random is reading this, you usually want --disable-error-code import-untyped or maybe --ignore-missing-imports
Absolutely agree 👍 We have follow_imports = 'normal'
and disallow_any_unimported = true
enabled (with follow_imports = 'silent'
and disallow_any_unimported = False
set for specific modules for special cases where that couldn't be avoided / suppressed).
The aim here is to support special cases where it may make sense to do partial type checking of a single modified file locally in a very large project (by using --follow-imports=skip
and --allow-any-unimported
), and to delay full/proper type checking to a pre-commit/pre-push git hook or CI step (or both).
Use of these flags should always be an exception when manually running mypy, and not part of your standard configuration.