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

Rules pertaining to PEP 695 #12542

Open
Goldziher opened this issue Jul 27, 2024 · 3 comments
Open

Rules pertaining to PEP 695 #12542

Goldziher opened this issue Jul 27, 2024 · 3 comments
Labels
rule Implementing or modifying a lint rule

Comments

@Goldziher
Copy link

MyPy released support for PEP 695 generics: python/mypy#15238

It would be awesome to do any of the following:

  1. get linting errors for code that uses older style generics (TypeVar, ParamSpec etc.) for Python 3.12+
  2. get linting errors for code that uses newer style generics and should be backward compatible with lower Python versions
  3. automagically upgrade older style generics to use the new syntax

I see that for point 3 there is an open related issue. This issue is about the underlying rust implementation for point 3, but does not cover points 1 and 2.

@charliermarsh
Copy link
Member

We have some support for this already in https://docs.astral.sh/ruff/rules/non-pep695-type-alias/. I believe that rule does (1) and (3)?

@Goldziher
Copy link
Author

We have some support for this already in https://docs.astral.sh/ruff/rules/non-pep695-type-alias/. I believe that rule does (1) and (3)?

I don't think so. I might be wrong but it seems to me like this rule is concerned with the TypeAlias type.

I am talking about the new generics style: https://peps.python.org/pep-0695/#summary-examples

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jul 27, 2024
@charliermarsh
Copy link
Member

Thanks, you're right, that's my mistake. We may want to fold this into #4617, and just flesh out that issue a bit more.

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