-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
style: Use ruff format
instead of black .
for improved user experience
#5023
Conversation
…rlisetup/wizard.py
…in rlisetup.wizard
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 changes look again like an improvement and fix of previous imperfections. The reasoning behind switch to Ruff is sound, and switching back to Black would not be that back if needed for any reason. Thanks for pursuing it!
Maybe existing Python PRs should be updated if we think that ruff formatting would be different for them, in order to not have main branch failing |
Closes #4922
As discussed in #4922, I'm implementing the switch from black to ruff format. It is a drop in replacement with some limited known deviations
From ruff's docs: https://docs.astral.sh/ruff/formatter/#philosophy
Like black, ruff format commits to keeping a stable style for a year, and they work together to stay aligned with black choices, if black does it in time.
Black, while faster that it was, is still python, and was becoming slow sometimes, and if used regularly, or even as a save hook on your IDE, is slow.
For example, just before preparing this PR, I compared black 25 and ruff 0.9.4, both without cache, on a performing computer from 2019:
black:
ruff:
The experience is simply unmatched.
As for concerns about immatureness: Black has slow developpement, and this repo started when it was young. Ruff is still new, but rapid development. ruff format has been available since their 0.0.289 release in september 2023 (according to their pre-commit repo), which is found on the 8th page of tags on github: https://github.com/astral-sh/ruff/tags?after=v0.1.3. They announced the availability in october 2023 https://astral.sh/blog/the-ruff-formatter. At their developpement cadence, and from following them since a while (before their formatter existed), I estimate that it equates to more than 3 years maturity. I don't see any fear to go there, its way "simpler" that the rules and fixes we rely on here from ruff itself.
For the differences, its a one-time change, and this PR here contains the deviations that they choose to be better than black, amongst other enabling work and fixes.
Some other nice additions ruff format brings that black doesn't yet:
Upcoming work, after introducing ruff format:
This PR also includes 2 small fixes noted in the black 25 preparatory PR:
libraster.Rast_copy_cats()
invocationOther: