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

Implement TYP001 from flake8-typing-imports #2302

Open
charliermarsh opened this issue Jan 28, 2023 · 1 comment
Open

Implement TYP001 from flake8-typing-imports #2302

charliermarsh opened this issue Jan 28, 2023 · 1 comment
Labels
rule Implementing or modifying a lint rule

Comments

@charliermarsh
Copy link
Member

charliermarsh commented Jan 28, 2023

This rule detects whether you've imported something from typing that's incompatible with your supported Python version.

See: #2096.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jan 28, 2023
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pytest that referenced this issue Feb 2, 2024
…e, to ruff

ruff is faster and handle everything we had prior.

isort configuration done based on the indication from
astral-sh/ruff#4670, previousely based on
reorder-python-import (pytest-dev#11896)

flake8-docstrings was a wrapper around pydocstyle (now archived) that
explicitly asks to use ruff in PyCQA/pydocstyle#658.

flake8-typing-import is useful mainly for project that support python 3.7
and the one useful check will be implemented in astral-sh/ruff#2302

We need to keep blacken-doc because ruff does not handle detection
of python code inside .md and .rst. The direct link to the repo is
now used to avoid a redirection.

Manual fixes:
- Lines that became too long
- % formatting that was not done automatically
- type: ignore that were moved around
- noqa of hard to fix issues (UP031 generally)
- fmt: off and fmt: on that is not really identical
  between black and ruff
- autofix re-order in pre-commit from faster to slower

Co-authored-by: Ran Benita <ran@unusedvar.com>
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pytest that referenced this issue Feb 2, 2024
…e, to ruff

ruff is faster and handle everything we had prior.

isort configuration done based on the indication from
astral-sh/ruff#4670, previousely based on
reorder-python-import (pytest-dev#11896)

flake8-docstrings was a wrapper around pydocstyle (now archived) that
explicitly asks to use ruff in PyCQA/pydocstyle#658.

flake8-typing-import is useful mainly for project that support python 3.7
and the one useful check will be implemented in astral-sh/ruff#2302

We need to keep blacken-doc because ruff does not handle detection
of python code inside .md and .rst. The direct link to the repo is
now used to avoid a redirection.

Manual fixes:
- Lines that became too long
- % formatting that was not done automatically
- type: ignore that were moved around
- noqa of hard to fix issues (UP031 generally)
- fmt: off and fmt: on that is not really identical
  between black and ruff
- autofix re-order in pre-commit from faster to slower

Co-authored-by: Ran Benita <ran@unusedvar.com>
Pierre-Sassoulas added a commit to pytest-dev/pytest that referenced this issue Feb 2, 2024
…e, to ruff (#11911)

ruff is faster and handle everything we had prior.

isort configuration done based on the indication from
astral-sh/ruff#4670, previousely based on
reorder-python-import (#11896)

flake8-docstrings was a wrapper around pydocstyle (now archived) that
explicitly asks to use ruff in PyCQA/pydocstyle#658.

flake8-typing-import is useful mainly for project that support python 3.7
and the one useful check will be implemented in astral-sh/ruff#2302

We need to keep blacken-doc because ruff does not handle detection
of python code inside .md and .rst. The direct link to the repo is
now used to avoid a redirection.

Manual fixes:
- Lines that became too long
- % formatting that was not done automatically
- type: ignore that were moved around
- noqa of hard to fix issues (UP031 generally)
- fmt: off and fmt: on that is not really identical
  between black and ruff
- autofix re-order in pre-commit from faster to slower

Co-authored-by: Ran Benita <ran@unusedvar.com>
@DanielYang59
Copy link

DanielYang59 commented May 15, 2024

+1. We do need a ruff rule as mentioned in #6650 that detects and guards TYPE_CHECKING only import :) Which also hopefully could improve runtime performance by not importing unnecessary packages.

Thanks a lot for your work!

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
Development

No branches or pull requests

2 participants