Skip to content

Replace black with ruff for formatting and import sorting#129

Merged
nerdoc merged 2 commits into
masterfrom
claude/replace-black-with-ruff
Jun 14, 2026
Merged

Replace black with ruff for formatting and import sorting#129
nerdoc merged 2 commits into
masterfrom
claude/replace-black-with-ruff

Conversation

@nerdoc

@nerdoc nerdoc commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

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 (that PR was outdated/conflicting and has been closed).

Changes

  • pyproject.toml: drop the black dev dependency and [tool.black];
    add ruff with [tool.ruff] (target-version = "py310") and
    [tool.ruff.lint] select = ["I"] (import sorting).
  • uv.lock: regenerated (black + transitive deps removed, ruff added).
  • CI (.github/workflows/check_format.yml): now runs
    ruff format --check . and ruff check . instead of black --check.
  • Makefile: new format and check-format convenience targets.
  • Docs: README.md (Code formatting) and CONTRIBUTING.md now reference
    ruff instead of black.
  • Applied ruff format + import sorting across the codebase.
  • Removed an unused import black in the directory-url dev script.

Scope note

ruff check is intentionally limited to import sorting for now. Ruff
additionally flags pre-existing issues (13× F401 unused imports, 10× F841
unused variables) which are not addressed here to keep this a focused
tooling swap. The F rule set can be enabled in a follow-up.

Verification

  • make check-format passes (56 files formatted, all checks pass).
  • uv run ruff works (locked 0.15.17).
  • Full test suite: 147 passed.

https://claude.ai/code/session_01Q4NSyGd8CMCjjCH9gQCsvG


Generated by Claude Code

claude added 2 commits June 14, 2026 07:47
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.
@nerdoc nerdoc merged commit 1d3841f into master Jun 14, 2026
10 checks passed
@nerdoc nerdoc deleted the claude/replace-black-with-ruff branch June 14, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants