-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support for PEP 695 #5062
Comments
I will take ownership of this work. |
\cc @zanieb who's working on this :) |
Progress on the Rust Python parser can be tracked at RustPython/Parser#82 |
This was referenced Jul 17, 2023
zanieb
added a commit
that referenced
this issue
Jul 18, 2023
This was referenced Jul 18, 2023
zanieb
added a commit
that referenced
this issue
Jul 18, 2023
zanieb
added a commit
that referenced
this issue
Jul 18, 2023
evanrittenhouse
pushed a commit
to evanrittenhouse/ruff
that referenced
this issue
Jul 19, 2023
evanrittenhouse
pushed a commit
to evanrittenhouse/ruff
that referenced
this issue
Jul 19, 2023
evanrittenhouse
pushed a commit
to evanrittenhouse/ruff
that referenced
this issue
Jul 19, 2023
evanrittenhouse
pushed a commit
to evanrittenhouse/ruff
that referenced
this issue
Jul 19, 2023
konstin
pushed a commit
that referenced
this issue
Jul 19, 2023
konstin
pushed a commit
that referenced
this issue
Jul 19, 2023
konstin
pushed a commit
that referenced
this issue
Jul 19, 2023
zanieb
added a commit
that referenced
this issue
Jul 19, 2023
zanieb
added a commit
that referenced
this issue
Jul 25, 2023
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> Part of #5062 Requires astral-sh/RustPython-Parser#32 Adds visitation of type alias statements and type parameters in class and function definitions. Duplicates tests for `PreorderVisitor` into `Visitor` with new snapshots. Testing required node implementations for the `TypeParam` enum, which is a chunk of the diff and the reason we need `Ranged` implementations in astral-sh/RustPython-Parser#32. ## Test Plan <!-- How was it tested? --> Adds unit tests with snapshots.
This was referenced Jul 26, 2023
zanieb
added a commit
that referenced
this issue
Jul 28, 2023
Requires astral-sh/RustPython-Parser#42 Related PyCQA/pyflakes#778 [PEP-695](https://peps.python.org/pep-0695) Part of #5062 <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> Adds a scope for type parameters, a type parameter binding kind, and checker visitation of type parameters in type alias statements, function definitions, and class definitions. A few changes were necessary to ensure correctness following the insertion of a new scope between function and class scopes and their parent. ## Test Plan <!-- How was it tested? --> Undefined name snapshots. Unused type parameter rule will be added as follow-up.
zanieb
added a commit
that referenced
this issue
Aug 2, 2023
zanieb
added a commit
that referenced
this issue
Aug 3, 2023
Adds rule to convert type aliases defined with annotations i.e. `x: TypeAlias = int` to the new PEP-695 syntax e.g. `type x = int`. Does not support using new generic syntax for type variables, will be addressed in a follow-up. Added as part of pyupgrade — ~the code 100 as chosen to avoid collision with real pyupgrade codes~. Part of #4617 Builds on #5062
Additional resource; may be useful for refinements to scoping https://jellezijlstra.github.io/pep695 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
PEP 695 adds new syntax for type parameters and generics. A few examples:
There are a few pieces of work involved in this:
type
soft keyword).This will be Ruff's first time undergoing a significant grammar and syntax change (apart from adding structural pattern matching), so it's a great opportunity to set the project's standards for keeping up with Python's evolution.
Specifically, the final Python 3.12 release is expected on 2023-10-02. We should aim to support PEP 695 by that date at the latest.
The text was updated successfully, but these errors were encountered: