mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Warn that annotations could be if TYPE_CHECKING

Open jonfitt opened this issue 4 years ago • 1 comments

Would it be possible to get mypy to list all imports that are only used for annotations that are not in an if TYPE_CHECKING check?

It would be very useful to cleanup imports and head off potential circular import issues coming from annotation imports.

jonfitt avatar Sep 17 '21 16:09 jonfitt

FWIW, this feature is currently provided by ruff's TCH rules / flake8-type-checking

brianschubert avatar Oct 11 '24 15:10 brianschubert