-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 696 syntax #11120
Conversation
The CI failure looks like a random timeout. (Speculation: Maybe this change triggered too many recompilations and therefore it timed out?) |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that was blazingly fast! Thank you for working on this. It is an impressive PR as it touches all of the major areas of the codebase (AST, parser, linter, and formatter).
I've made some suggestions for consistency and have a few doubts regarding the grammar and the evaluation-order. But, otherwise I think this is pretty much good to go.
crates/ruff_python_formatter/src/type_param/type_param_type_var_tuple.rs
Outdated
Show resolved
Hide resolved
crates/ruff_python_formatter/src/type_param/type_param_type_var.rs
Outdated
Show resolved
Hide resolved
crates/ruff_python_formatter/src/type_param/type_param_param_spec.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow nice! This is excellent.
Would you mind adding a few formatter snapshot tests? For example, you can add them to https://github.com/astral-sh/ruff/blob/0bf0aa28ac05eb4157c8e1932abc91301aaedce7/crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/type_alias.py
Ideally, with a few cases that involve comments and extra long lines.
@MichaReiser thanks, I added a number of tests in 7e053f6. A few comments get moved to the other side of a punctuation mark but that seems fine. It looks like you don't have a similar test case file for type parameter definitions on functions, other than the one in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! Thank you!
Thank you @JelleZijlstra, this is awesome. |
## Summary I believe we're already "Python 3.13-ready"? The main Ruff-impacting change I see in https://docs.python.org/3.13/whatsnew/3.13.html is [PEP 696](https://peps.python.org/pep-0696/) which Jelle added in #11120.
Fixes #11099.
My strategy here was: