Skip to content
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

Replace black with ruff in tidy #133821

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Dec 3, 2024

ruff can both lint and format Python code (in fact, it should be a mostly drop-in replacement for black in terms of formatting), so it's not needed to use black anymore. This PR removes black and replaces it with ruff, to get rid of one Python dependency, and also to make Python formatting faster (although that's a small thing).

If we decide to merge this, we'll need to "reformat the world" - ruff is not perfectly compatible with black, and it also looks like black was actually ignoring some files before. I tried it locally (./x test tidy --extra-checks=py:fmt --bless) and it also reformatted some code in subtrees (e.g. clippy or rustc_codegen_gcc) - I'm not sure how to handle that.

@rustbot
Copy link
Collaborator

rustbot commented Dec 3, 2024

r? @onur-ozkan

rustbot has assigned @onur-ozkan.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 3, 2024
@jieyouxu jieyouxu added A-python Area: python, like bootstrap/CI scripts or linters/formatters, etc. A-testsuite Area: The testsuite used to check the correctness of rustc and removed A-testsuite Area: The testsuite used to check the correctness of rustc labels Dec 3, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Dec 3, 2024

I think trimming the python deps (and also making py fmt slightly faster) is nice, will let Onur assess if the improvement is worth the churn of reformatting

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we decide to merge this, we'll need to "reformat the world"

I liked the changes in this PR, how much change do you mean with "world"? Can you make a draft PR to show that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-python Area: python, like bootstrap/CI scripts or linters/formatters, etc. A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants