-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Considering Ruff over Black #11734
Considering Ruff over Black #11734
Conversation
exclude = [ | ||
# Exclude protobuf files because they have long line lengths | ||
# Ideally, we could configure Ruff to allow longer line lengths | ||
# for just these files, by adding a ruff.toml config file at their root. | ||
"**_pb2.pyi", | ||
] |
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.
Ruff is so fast and fixers are already run on these files as part of the generator scripts, I feel like this isn't even necessary.
I just kept if for now to have an apples-to-apples comparison.
Exciting to see this! Note we added the formatter to our versioning policy and it should be quite stable! |
This comment has been minimized.
This comment has been minimized.
I don't see much advantage in this change, though as a maintainer of Black I might be biased. I don't think formatting speed is a bottleneck for us. |
This comment has been minimized.
This comment has been minimized.
For the moment, I also prefer to keep black for formatting.
|
Having to manually move type comments around isn't a good sign. Black basically just totally leaves those alone. Also note that ruff formatter currently relies on Black for its style. Black has historically collaborated with typeshed to determine Black's pyi style, so there's sort of a healthy collaboration / feedback loop there. I don't think there's much advantage here. |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Thanks everyone for your feedback and additional context. I had an inkling about a sentiment towards keeping black, but I couldn't be sure without trying or asking. I'll close this PR, but if you have any other opinion you'd like to share, feel free to do so here. |
This PR explores using Ruff format in place of Black.
The main advantages are:
Eventually scripts could also be simplified as Ruff would be run using a single command astral-sh/ruff#8232
Disadvantages:
type
comments may be undesirable to some Mypy (type) directives no longer relevant after running isort check astral-sh/ruff#10516