-
Notifications
You must be signed in to change notification settings - Fork 605
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
Remove black formatter to use only ruff #1783
Conversation
The documentation is not available anymore as the PR was closed or merged. |
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.
Great, thank you! Would be great to align with transformers/accelerate/diffusers/others
cc @charliermarsh, you might be interested :)
Thanks @LysandreJik for the review :) And immensely grateful @charliermarsh for the amazing work on Ruff ❤️ |
Amazing, thanks @Wauplin and @LysandreJik! So cool to see :) |
# Format with black | ||
code = black.format_file_contents(code, fast=False, mode=black.FileMode(line_length=119)) | ||
|
||
# Format with ruff | ||
with tempfile.TemporaryDirectory() as tmpdir: | ||
filepath = Path(tmpdir) / "__init__.py" |
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.
The call to ruff
without arguments will not format but check.
See #27144 where we heavily rely on the formatting of the # Copied from
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.
Good catch!
Fixed this in #1824.
Following https://astral.sh/blog/the-ruff-formatter, I suggest we remove
black
formatter completely. It was already not very used anyway. Made a few changes so that current code is formatted the same with bothblack
andruff
to reduce inconveniences for existing contributors.N°1 argument IMO is speed. N°2 is that it's convenient to have everything handled by the same tool.