chore: migrate from flake8/isort/black/pyupgrade to ruff#38
Open
henryiii wants to merge 4 commits into
Open
Conversation
Replace flake8 (with bugbear, comprehensions, typing-as-t plugins), isort, and black pre-commit hooks with ruff lint and format hooks. - Remove .flake8 config file - Replace [tool.isort] with [tool.ruff] config in pyproject.toml - Map flake8 plugin rules to ruff select categories (B, C4, I, TCH) - Ignore E203 for black/ruff-format compat - Fix known-first-party from stale 'mddj' to 'dependency_groups' Assisted-by: OpenCode:glm-5
Remove pyupgrade pre-commit hook in favor of ruff's UP (pyupgrade) rule category. Set target-version = "py39" to match the previous --py39-plus behavior. Assisted-by: OpenCode:glm-5
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
sirosen
reviewed
May 26, 2026
| show-fixes = true | ||
|
|
||
| [tool.ruff.lint] | ||
| select = ["E4", "E7", "E9", "F", "B", "C4", "I", "TCH", "UP"] |
Contributor
There was a problem hiding this comment.
Is TCH right? I don't see it documented.
I think flake8-typing-as-t is too small to be picked up and cloned by ruff.
I'm not sure what to do about that. I guess I could make it runnable as a module, with a __main__.py which runs it as a non-flake8 AST checker?
Contributor
Author
There was a problem hiding this comment.
Ah, I see that. We can run flake8 just on a single prefix (I'm doing that for flake8-lazy in places).
|
|
||
| [tool.isort] | ||
| profile = "black" | ||
| known_first_party = ["mddj"] |
Contributor
There was a problem hiding this comment.
🤦 That's slightly embarrassing. Clearly copy-pasta from mddj! Glad to see it fixed here.
Contributor
Author
There was a problem hiding this comment.
I was wondering, didn't see why dependency-groups would have started out named "mddj". ;P
Assisted-by: OpenCode:glm-5.1 Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step, minimal old-tools -> ruff conversion, without adding/changing anything. See #8. I can now run pre-commit locally again. pyupgrade was broken before for me.
Also did pyupgrade, and some hand updates/cleanup (newer ruff follows newer black, this was using black 24, only one small change though).
🤖 Human guided, AI assisted PR (using this skill). AI text below. 🤖
Summary
Replace flake8 (with bugbear, comprehensions, typing-as-t plugins), isort, and black pre-commit hooks with ruff lint and format hooks.
Changes
.flake8config file[tool.isort]with[tool.ruff]config inpyproject.tomlselectcategories:B(bugbear),C4(comprehensions),I(isort),TCH(typing-as-t)E203for ruff-format compat (previouslyextend-ignore)known-first-partyfrom stale"mddj"to"dependency_groups"Assisted-by: OpenCode:glm-5.1
📚 Documentation preview 📚: https://dependency-groups--38.org.readthedocs.build/en/38/