Skip to content

Migrate code formatting from black + isort to ruff - #232

Merged
bdraco merged 1 commit into
masterfrom
migrate-formatting-to-ruff
May 17, 2026
Merged

bdraco merged 1 commit into
masterfrom
migrate-formatting-to-ruff

Conversation

@bdraco

@bdraco bdraco commented May 17, 2026

Copy link
Copy Markdown
Member

What do these changes do?

Drop the standalone black and isort pre-commit hooks and use ruff for both formatting and import sorting. Adds a [tool.ruff.lint] block in pyproject.toml selecting the I rule (with known-first-party = ["propcache"] so the existing pytest / propcache two-section import layout is preserved) and replaces the two old hooks with ruff-check (run with --fix --exit-non-zero-on-fix --show-fixes so import-sorting fixes apply on commit) and ruff-format. The orphan [isort] block in setup.cfg is removed.

ruff format applied four small reformats across tests/test_benchmarks.py and tests/test_cached_property.py: stray blank lines after class headers were removed. ruff check --select I produced no diffs against the existing import order, so the isort half of the swap is a no-op on imports.

Are there changes in behavior for the user?

No, contributor tooling only.

Related issue number

N/A

Checklist

  • I think the code is well written
  • Unit tests for the changes exist: N/A (tooling-only change; ran pre-commit run --all-files and ruff check / ruff format --check against the reformatted tree)
  • Documentation reflects the changes: N/A (no user-visible API change)
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt: N/A (no such file in this repo)
  • Add a new news fragment into the CHANGES/ folder (CHANGES/232.contrib.rst)

Drafted with Claude Code (Opus 4.7); reviewed by @bdraco.

Agent run details (optional, for reviewers)

Verified:

$ ruff check src/ tests/ docs/ packaging/
All checks passed!
$ ruff format --check src/ tests/ docs/ packaging/
19 files already formatted
$ pre-commit run --all-files
all hooks Passed (actionlint-docker skipped: Docker daemon not running locally)
$ make doc-spelling
2 pre-existing misspellings only ("subdirectory" in CHANGES/207.contrib.rst, "postfix" in CHANGES.rst); the new CHANGES/232.contrib.rst fragment is clean.

@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label May 17, 2026
@bdraco
bdraco marked this pull request as ready for review May 17, 2026 18:07
@bdraco
bdraco enabled auto-merge (squash) May 17, 2026 18:07
@codspeed

codspeed Bot commented May 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 4 untouched benchmarks


Comparing migrate-formatting-to-ruff (ad95a39) with master (af0ba34)

Open in CodSpeed

@bdraco
bdraco disabled auto-merge May 17, 2026 18:31
@bdraco
bdraco merged commit bdf25f6 into master May 17, 2026
48 checks passed
@bdraco
bdraco deleted the migrate-formatting-to-ruff branch May 17, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant