Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flake8-typing-as-t #4034

Closed
edgarrmondragon opened this issue Apr 20, 2023 · 2 comments · Fixed by #4040
Closed

Support flake8-typing-as-t #4034

edgarrmondragon opened this issue Apr 20, 2023 · 2 comments · Fixed by #4040
Labels
rule Implementing or modifying a lint rule

Comments

@edgarrmondragon
Copy link
Contributor

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
@charliermarsh
Copy link
Member

My vote would be to find a way to enable this within the import conventions plugin since it's so closely related.

@edgarrmondragon
Copy link
Contributor Author

I've gone for a new ICN003 rule that bans from ... import ... for any configured modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
2 participants