Replace black with ruff for formatting and import sorting#129
Merged
Conversation
Switches the project's code style tooling from black to ruff, which handles both code formatting (`ruff format`, black-compatible) and import sorting (`ruff check` with the isort "I" rules) in a single, faster tool. This also realises the intent of the stale isort PR (#90) against the current codebase. Changes: - pyproject.toml: drop black dev dependency and [tool.black]; add ruff with [tool.ruff] (target py310) and [tool.ruff.lint] select = ["I"]. - CI: check_format workflow now runs `ruff format --check` and `ruff check` instead of `black --check`. - Makefile: add `format` and `check-format` convenience targets. - README / CONTRIBUTING: document ruff instead of black. - Apply `ruff format` and import sorting across the codebase. - Remove an unused `import black` in the directory-url dev script.
…k-with-ruff # Conflicts: # uv.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switches the project's code-style tooling from black to ruff, which
handles both code formatting (
ruff format, black-compatible) and importsorting (
ruff checkwith the isortIrules) in a single, faster tool.This also realises the intent of the stale isort PR #90 against the current
codebase (that PR was outdated/conflicting and has been closed).
Changes
pyproject.toml: drop theblackdev dependency and[tool.black];add
ruffwith[tool.ruff](target-version = "py310") and[tool.ruff.lint] select = ["I"](import sorting).uv.lock: regenerated (black + transitive deps removed, ruff added)..github/workflows/check_format.yml): now runsruff format --check .andruff check .instead ofblack --check.Makefile: newformatandcheck-formatconvenience targets.README.md(Code formatting) andCONTRIBUTING.mdnow referenceruff instead of black.
ruff format+ import sorting across the codebase.import blackin the directory-url dev script.Scope note
ruff checkis intentionally limited to import sorting for now. Ruffadditionally flags pre-existing issues (13×
F401unused imports, 10×F841unused variables) which are not addressed here to keep this a focused
tooling swap. The
Frule set can be enabled in a follow-up.Verification
make check-formatpasses (56 files formatted, all checks pass).uv run ruffworks (locked 0.15.17).https://claude.ai/code/session_01Q4NSyGd8CMCjjCH9gQCsvG
Generated by Claude Code