Flake8 plugin enforcing that typing imports are guarded by `if TYPE_CHECKING` to avoid runtime import overhead and circular imports. Current version 1.17.0, requires Python >=3.9. Maintained by asottile, stable release cadence.
pip install flake8-typing-importsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a file with a guarded import and run flake8 with the TYP selector to check typing imports.
Update your flake8 configuration to use the new codes (TYP001, TYP002, etc. are still supported but deprecated). See changelog.
Manually guard imports from modules like `types` if needed.
Ensure all typing imports use `from ... import ...` syntax if guarding.
Upgrade to Python >=3.9.