You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adopt ruff format and drop black. Same output (ruff format is intentionally byte-compatible with black), one tool, faster CI.
Why
The existing setup uses black + (via my earlier idea ticket) potentially ruff for lint. That means CI pulls two formatters, runs two passes, and contributors install both.
ruff format (stable since 0.1) is:
Byte-compatible with black for the formatter rules already in use here
~30× faster on a clean cache (matters less for this repo's size, but the import-sort + format combined pass is noticeable)
Backed by the same project that's already going to be invoked for lint, so configuration lives in one [tool.ruff] block in pyproject.toml
Migration sketch
pip install ruff (already a dev dep if the lint idea lands)
ruff format src/ tests/ and confirm zero diff vs black
Replace black invocations in Makefile and CI with ruff format and ruff format --check
Drop black from [project.optional-dependencies].dev
Update CONTRIBUTING.md
Open questions
Does the existing pyproject.toml set any non-default black config (line length etc.) that we'd need to mirror in [tool.ruff.format]?
Anyone strongly attached to black for non-CI workflows (editor integration etc.)?
Happy to put up the PR if maintainers are receptive.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR
Adopt
ruff formatand dropblack. Same output (ruff format is intentionally byte-compatible with black), one tool, faster CI.Why
The existing setup uses black + (via my earlier idea ticket) potentially ruff for lint. That means CI pulls two formatters, runs two passes, and contributors install both.
ruff format(stable since 0.1) is:[tool.ruff]block inpyproject.tomlMigration sketch
pip install ruff(already a dev dep if the lint idea lands)ruff format src/ tests/and confirm zero diff vsblackblackinvocations inMakefileand CI withruff formatandruff format --checkblackfrom[project.optional-dependencies].devOpen questions
pyproject.tomlset any non-defaultblackconfig (line length etc.) that we'd need to mirror in[tool.ruff.format]?Happy to put up the PR if maintainers are receptive.
Beta Was this translation helpful? Give feedback.
All reactions