Skip to content

Support flake8-typing-as-t #4034

@edgarrmondragon

Description

@edgarrmondragon

PyPI: https://pypi.org/project/flake8-typing-as-t/

This is a flake8 plugin which ensures that imports from the typing library must be written using import typing as t.

  • TYT01: Bare import typing usage
  • TYT02: import typing as X where X is not literal t
  • TYT03: from typing import X usage

TYT01 and TYT02 could be covered by ICN001 if the following config is added:

[tool.ruff.flake8-import-conventions.extend-aliases]
"typing" = "t"

but TYT03 is still valuable to have.

Another option is to extend flake-import-conventions to flag cases like

from pandas import DataFrame  # Use `import as pd` and `pd.DataFrame` instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions