Skip to content

Adds ruff and mypy linting and type checking#120

Open
Mbeaulne wants to merge 1 commit intomasterfrom
02-24-adds_ruff_and_mypy_linting_and_type_checking
Open

Adds ruff and mypy linting and type checking#120
Mbeaulne wants to merge 1 commit intomasterfrom
02-24-adds_ruff_and_mypy_linting_and_type_checking

Conversation

@Mbeaulne
Copy link
Collaborator

@Mbeaulne Mbeaulne commented Feb 25, 2026

Summary

  • Replace Black with Ruff for linting and formatting.

Why Ruff over Black?

Ruff is a single tool that replaces Black (formatting), flake8 (linting), isort (import sorting), and pyupgrade (syntax modernization) -- all in one. It's written in Rust and runs 10-100x faster than the tools it replaces. Rather than maintaining separate configs and dependencies for each tool, Ruff handles everything through a single [tool.ruff] section in pyproject.toml.

To test this tool run the following command (note: all linting fixes are in the PR above):

uv run ruff check --fix . && uv run ruff format .

Copy link
Collaborator Author

Mbeaulne commented Feb 25, 2026

@Mbeaulne Mbeaulne marked this pull request as ready for review February 25, 2026 01:41
@Mbeaulne Mbeaulne requested a review from Ark-kun as a code owner February 25, 2026 01:41
Copy link
Collaborator

For the uv.lock changes, it might be worth researching why this was needed. image.png

I am not sure if it's a NOOP change but it seems like the type of thing where one developer's environment will want to write the UV file using one version of this, and another developer will use a different version, causing constant (and longer than necessary) changes to the file.

Copy link
Collaborator

Perhaps ☝️ will lead to a much shorter change to the uv.lock if we can eliminate whatever decided to do that change

Copy link
Collaborator

Would you mind putting together some instructions for how developers should set up their editor to use ruff instead of black?

Right now, if I right click a document and select "Format Document" my understanding is that it formats the document using Black. I also have the cursor extension "Black Formatter" installed and assume after this myself and others would be recommended to uninstall it. That just leaves me wondering what other steps we would need to take to fully adopt ruff in our editor in place of black.

@Ark-kun
Copy link
Contributor

Ark-kun commented Feb 25, 2026

Right now, if I right click a document and select "Format Document" my understanding is that it formats the document using Black. I also have the cursor extension "Black Formatter" installed

yes. We're using Black for backend code formatting.

@Mbeaulne Mbeaulne force-pushed the 02-24-adds_ruff_and_mypy_linting_and_type_checking branch from cd632fd to 6431a39 Compare February 25, 2026 13:10
Copy link
Collaborator Author

I propose moving from Black to Ruff for both linting and formatting. Ruff's formatter is Black-compatible (same output, just ~100x faster), and gives you linting + formatting from a single tool.

Steps

  1. Uninstall the "Black Formatter" extension
  2. Install the Ruff extension (by Astral)
  3. Update your settings — add the following to your Cursor/VS Code settings (Cmd+Shift+P → "Preferences: Open Settings (JSON)"):

"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true
}

@Mbeaulne Mbeaulne force-pushed the 02-24-adds_ruff_and_mypy_linting_and_type_checking branch from 6431a39 to dec4dc7 Compare February 25, 2026 18:34
@Mbeaulne Mbeaulne force-pushed the 02-24-adds_ruff_and_mypy_linting_and_type_checking branch from dec4dc7 to 3163fa5 Compare February 25, 2026 18:52
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.

3 participants