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?) |
|
dhruvmanila
left a comment
There was a problem hiding this comment.
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
MichaReiser
left a comment
There was a problem hiding this comment.
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 |
|
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: