Table of Contents
This is a flake8
plugin which ensures that imports from the typing
library must be written using import typing as t
.
pip install flake8-typing-as-t
TYT01
: Bareimport typing
usageTYT02
:import typing as X
whereX
is not literalt
TYT03
:from typing import X
usage
A common pattern for compatibility is to do a sys.version_info
-guarded
dispatch over typing_extensions
. e.g.
if sys.version_info < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal
flake8-typing-as-t
allows for this usage by checking if the import is inside
of a test on sys.version_info
against a tuple.
flake8-typing-as-t
is distributed under the terms of the MIT license.
- Initial production release
- Internal refactoring for improved performance
- Add support for
sys.version_info
dispatch
- Initial release