Skip to content

Modernize tooling: replace black with ruff format#2

Merged
heymumford merged 3 commits intomainfrom
feature/modernize-tooling
Mar 16, 2026
Merged

Modernize tooling: replace black with ruff format#2
heymumford merged 3 commits intomainfrom
feature/modernize-tooling

Conversation

@heymumford
Copy link
Owner

@heymumford heymumford commented Mar 16, 2026

Summary

  • Replace black with ruff format in pyproject.toml, justfile, CI workflow, and README
  • Bump minimum Python from 3.10 to 3.12 across all config (pyproject.toml, mypy, CI matrix)
  • Add ruff format --check step to CI workflow
  • Update ruff line-length from 88 to 120
  • Remove [tool.black] section, add [tool.ruff.format] with double-quote style

Test plan

  • CI passes on feature branch (ruff check, ruff format --check, mypy, pytest)
  • just format runs ruff format (not black)
  • uv sync resolves without black in dev dependencies

Summary by Sourcery

Modernize Python tooling by adopting ruff as the formatter, increasing the supported Python version, and aligning configs, CI, and docs with the new setup.

New Features:

  • Use ruff as the project code formatter in place of black, including a dedicated ruff format configuration section.
  • Add a dedicated CI step to run ruff format --check for formatting validation.

Enhancements:

  • Increase the minimum supported Python version to 3.12 across project, type-checker, and CI matrix.
  • Extend ruff's configured line length from 88 to 120 characters.
  • Update justfile commands and README documentation to reflect ruff-based formatting and the new Python version.

Build:

  • Remove black from development dependencies in pyproject configuration.

CI:

  • Adjust the CI Python version matrix to test on Python 3.12 and 3.13 instead of 3.10–3.12.

High-level PR Summary

This PR modernizes the project's tooling by replacing black with ruff format for code formatting and bumps the minimum Python version from 3.10 to 3.12. The changes update all configuration files, CI workflows, and documentation to reflect the new formatting tool, increase the line length from 88 to 120 characters, and add a format check step to the CI pipeline. The black dependency is removed from dev dependencies and replaced with ruff format configuration.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 pyproject.toml
2 justfile
3 .github/workflows/ci.yml
4 README.md

Need help? Join our Discord

Replace black with ruff format across pyproject.toml, justfile, CI,
and README. Bump minimum Python to 3.12. Set line-length to 120.
Add ruff format --check step to CI workflow.
Copilot AI review requested due to automatic review settings March 16, 2026 04:14
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 16, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces Black with Ruff’s formatter, raises the minimum supported Python version to 3.12 across tooling, and updates local/CI commands and documentation to match the new formatting and version policy.

Flow diagram for updated just commands and tooling

flowchart TD
  Dev[Developer] -->|runs| Justfile[just commands]

  subgraph Env[Python environment]
    MinPy[Python >= 3.12]
    uv[uv]
    ruff[ruff]
    mypy[mypy]
  end

  Justfile -->|just lint| LintCmd[uv run ruff check .]
  Justfile -->|just format| FormatCmd[uv run ruff format .]
  Justfile -->|just typecheck| TypeCmd[uv run mypy src]
  Justfile -->|just check| CheckCmd[lint + typecheck + test]

  LintCmd --> uv
  FormatCmd --> uv
  TypeCmd --> uv

  uv --> ruff
  uv --> mypy

  Dev -->|reads| README[README tooling docs]
  README -->|mentions| RuffFmt[ruff used for linting and formatting]
  README -->|mentions| PyPolicy[Python 3.12+ compatibility]
Loading

File-Level Changes

Change Details Files
Switch code formatting from Black to Ruff format in tooling and docs.
  • Remove Black from dev dependency group and rely on Ruff only
  • Replace Black formatting command with ruff format in justfile format recipe
  • Update README task descriptions to say formatting is done via Ruff, not Black
  • Clarify that Ruff is used for both linting and formatting in README
pyproject.toml
justfile
README.md
Update Ruff configuration to support formatting and adjust style.
  • Increase Ruff line-length from 88 to 120
  • Add [tool.ruff.format] section configuring double-quote style
  • Remove obsolete [tool.black] configuration block
pyproject.toml
Raise supported Python version baseline and CI matrix.
  • Bump requires-python from ">=3.10" to ">=3.12" in project metadata
  • Update mypy python_version to 3.12
  • Adjust CI matrix to test on 3.12 and 3.13 instead of 3.10–3.12
  • Mention Python 3.12+ compatibility in README
pyproject.toml
.github/workflows/ci.yml
README.md
Tighten CI to enforce formatting via Ruff.
  • Add dedicated ruff format --check . step after linting in CI workflow
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the project's development environment by consolidating linting and formatting under Ruff, eliminating the need for Black. It also aligns the project with a more recent Python version, ensuring compatibility with modern language features and libraries. These changes aim to simplify the tooling setup and improve code consistency.

Highlights

  • Tooling Modernization: Replaced Black with Ruff for code formatting across the project, including configuration files, build scripts, and documentation.
  • Python Version Bump: Increased the minimum required Python version from 3.10 to 3.12, updating pyproject.toml and mypy configurations accordingly.
  • Formatting Configuration: Updated Ruff's line length from 88 to 120 characters and configured Ruff's formatter to use double quotes.
  • CI Integration: The PR description indicates that a ruff format --check step will be added to the CI workflow, although the CI workflow file itself is not included in the provided patches.
Changelog
  • README.md
    • Updated the description for the just format command to reflect the switch to Ruff.
    • Modified the tooling description to state that Ruff handles both linting and formatting.
    • Updated the minimum Python compatibility version from 3.10+ to 3.12+.
  • justfile
    • Changed the format recipe to execute uv run ruff format . instead of uv run black ..
  • pyproject.toml
    • Updated the requires-python field from >=3.10 to >=3.12.
    • Removed black from the dev dependency group.
    • Increased [tool.ruff] line-length from 88 to 120.
    • Removed the entire [tool.black] configuration section.
    • Added a new [tool.ruff.format] section with quote-style = "double".
    • Updated [tool.mypy] python_version from 3.10 to 3.12.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider updating the just check target to include the new ruff format --check step so that the aggregate local check command more closely mirrors what CI enforces.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider updating the `just check` target to include the new `ruff format --check` step so that the aggregate local `check` command more closely mirrors what CI enforces.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modernizes the project's tooling by replacing black with ruff for formatting and updating the minimum Python version to 3.12. The changes in pyproject.toml, justfile, and README.md are consistent with these goals. However, the pull request description and test plan both mention significant changes to the CI workflow, such as adding a ruff format --check step and updating the Python version matrix. The CI workflow file containing these changes appears to be missing from this pull request. Please include it to ensure the CI pipeline is updated as intended and can properly validate the new project standards.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the project template’s Python/tooling configuration to standardize on Ruff for both linting and formatting, while raising the supported Python baseline.

Changes:

  • Replace Black with ruff format in developer commands and configuration.
  • Raise minimum supported Python to 3.12 and update CI to test newer Python versions.
  • Add a dedicated ruff format --check step in CI and adjust formatting settings (line length, quote style).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
pyproject.toml Bumps requires-python, removes Black from dev deps, configures Ruff formatting and updated line length, updates mypy target version.
justfile Switches just format from Black to ruff format.
README.md Updates documented tooling and Python compatibility to match Ruff + Python 3.12+.
.github/workflows/ci.yml Updates Python matrix and adds ruff format --check in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 28 to +35
[tool.ruff]
line-length = 88
line-length = 120

[tool.ruff.lint]
select = ["E", "F", "W", "I"]

[tool.black]
line-length = 88
target-version = ["py310"]
[tool.ruff.format]
quote-style = "double"
Comment on lines +32 to 35
- **ruff** for linting and formatting, **mypy** for type checking
- **hatchling** build backend
- Python 3.10+ compatibility
- Python 3.12+ compatibility

Comment on lines 23 to +27
- name: Lint
run: uv run ruff check .

- name: Format check
run: uv run ruff format --check .

[dependency-groups]
dev = ["pytest", "ruff", "black", "mypy"]
dev = ["pytest", "ruff", "mypy"]
Update .python-version from 3.10 to 3.12 to match requires-python.
Fix ruff I001 import ordering in tests/conftest.py.
Add ruff target-version = py312 to align lint rules with requires-python.
Add format-check target to justfile so local `just check` mirrors CI.
Use uv sync --frozen in CI to catch lockfile drift.
Regenerate uv.lock to remove black.
@heymumford heymumford merged commit 7908cb0 into main Mar 16, 2026
3 checks passed
@heymumford heymumford deleted the feature/modernize-tooling branch March 16, 2026 04:20
Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on f5a0e89..f9e5fdf

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (4)

.github/workflows/ci.yml
README.md
justfile
pyproject.toml

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