Skip to content

Replace black, isort, and tox with ruff#453

Open
sandhose wants to merge 3 commits intoquenting/modern-tooling/uvfrom
quenting/modern-tooling/ruff
Open

Replace black, isort, and tox with ruff#453
sandhose wants to merge 3 commits intoquenting/modern-tooling/uvfrom
quenting/modern-tooling/ruff

Conversation

@sandhose
Copy link
Copy Markdown
Member

@sandhose sandhose commented Apr 2, 2026

Summary

  • Replace black (formatter) and isort (import sorter) with ruff format and ruff check --select I
  • Delete tox.ini — CI now calls ruff and mypy directly via uv run
  • Update scripts-dev/lint.sh for ruff
  • Run ruff formatting and import sorting across the codebase
  • Use known-local-folder for tests so they sort after first-party (sygnal) in their own section, matching the old isort custom TESTS section

Notes

Test plan

  • uv run ruff check sygnal/ tests/ stubs passes
  • uv run ruff format --check sygnal/ tests/ stubs passes
  • CI green

Part 2 of 7 in the repository modernisation series. Builds on #452.

@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from 5d9cf7f to 9164fd6 Compare April 2, 2026 12:36
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from a7c093c to 1bb8aa4 Compare April 2, 2026 12:36
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from 9164fd6 to 9168f4e Compare April 2, 2026 16:53
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch 2 times, most recently from 5f86b8d to 6a1be12 Compare April 2, 2026 17:29
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch 2 times, most recently from 0983991 to a04555f Compare April 2, 2026 17:39
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from 65d3fa2 to cb6f287 Compare April 2, 2026 17:58
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch 2 times, most recently from d73e118 to 6e4032f Compare April 2, 2026 22:18
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from cb6f287 to 78aadaa Compare April 2, 2026 22:18
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from 6e4032f to a4b18b8 Compare April 2, 2026 22:38
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch 2 times, most recently from f96764e to e1c6876 Compare April 2, 2026 22:48
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch 2 times, most recently from 13a55b4 to 7d9a084 Compare April 3, 2026 10:21
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch 2 times, most recently from 8713ae8 to 06655a7 Compare April 3, 2026 10:22
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from 5c5a561 to 99dc5cd Compare April 3, 2026 12:06
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch 2 times, most recently from 9037622 to 8da7963 Compare April 3, 2026 12:11
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from 99dc5cd to 2aa588c Compare April 3, 2026 12:11
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from 8da7963 to ea0f3c9 Compare April 3, 2026 13:24
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch 2 times, most recently from b63d6d9 to a094f02 Compare April 3, 2026 13:28
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from ea0f3c9 to 9d22a3d Compare April 3, 2026 13:28
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from a094f02 to a0ed884 Compare April 3, 2026 13:33
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch 2 times, most recently from 1b905ff to 4a2c52e Compare April 3, 2026 13:40
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from a0ed884 to 2ca957a Compare April 3, 2026 13:40
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from 4a2c52e to 5b6b2c5 Compare April 3, 2026 13:49
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch 2 times, most recently from 9823327 to ea1433a Compare April 3, 2026 14:00
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from 5b6b2c5 to 2e5242f Compare April 3, 2026 14:00
@sandhose sandhose mentioned this pull request Apr 3, 2026
3 tasks
@sandhose sandhose force-pushed the quenting/modern-tooling/uv branch from ea1433a to 585d548 Compare April 3, 2026 14:20
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from 2e5242f to 59748b5 Compare April 3, 2026 14:21
sandhose added 3 commits April 3, 2026 16:29
Remove black, isort, and tox from dev dependencies. Upgrade ruff from
0.0.291 to >=0.11 and configure it as both linter and formatter with
isort integration. Update CI pipeline to call ruff/mypy directly
instead of through tox. Update lint.sh accordingly.
@sandhose sandhose force-pushed the quenting/modern-tooling/ruff branch from 59748b5 to 184a6e9 Compare April 3, 2026 14:30
@sandhose sandhose marked this pull request as ready for review April 3, 2026 14:47
@sandhose sandhose requested a review from a team as a code owner April 3, 2026 14:47
Copy link
Copy Markdown
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm otherwise

- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v5
- run: uv run tox -e check_types
- run: uv run mypy sygnal/ tests/ stubs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add the mypy config such that just running uv run mypy will check everything? This is also handy for manual use, so seems good to centralise

If ruff has an equivalent, that would also be good

]
ignore = [
"E501", # https://beta.ruff.rs/docs/rules/line-too-long/. Black enforces this for us.
"E501", # line too long (handled by formatter)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment now feels a bit weird, since ruff is both the linter and the formatter. Does this ignore rule even make sense now that's the case? It'd be strange if ruff conflicted with itself, right?

"coverage~=5.5",
"ruff==0.0.291",
"isort~=5.10",
"ruff>=0.11",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other deps are == pinned

I guess this might still be fine because we have a lockfile now, but in that case wondering what the right convention is

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