Skip to content

chore: migrate from flake8/isort/black/pyupgrade to ruff#38

Open
henryiii wants to merge 4 commits into
pypa:mainfrom
henryiii:henryiii/chore/ruff
Open

chore: migrate from flake8/isort/black/pyupgrade to ruff#38
henryiii wants to merge 4 commits into
pypa:mainfrom
henryiii:henryiii/chore/ruff

Conversation

@henryiii
Copy link
Copy Markdown
Contributor

@henryiii henryiii commented May 26, 2026

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

  • Remove .flake8 config file
  • Replace [tool.isort] with [tool.ruff] config in pyproject.toml
  • Map flake8 plugin rules to ruff select categories: B (bugbear), C4 (comprehensions), I (isort), TCH (typing-as-t)
  • Ignore E203 for ruff-format compat (previously extend-ignore)
  • Fix known-first-party from stale "mddj" to "dependency_groups"

Assisted-by: OpenCode:glm-5.1


📚 Documentation preview 📚: https://dependency-groups--38.org.readthedocs.build/en/38/

henryiii added 3 commits May 26, 2026 00:27
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>
@henryiii henryiii changed the title chore: migrate from flake8/isort/black to ruff chore: migrate from flake8/isort/black/pyupgrade to ruff May 26, 2026
Comment thread pyproject.toml
show-fixes = true

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "B", "C4", "I", "TCH", "UP"]
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.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see that. We can run flake8 just on a single prefix (I'm doing that for flake8-lazy in places).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread pyproject.toml

[tool.isort]
profile = "black"
known_first_party = ["mddj"]
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.

🤦 That's slightly embarrassing. Clearly copy-pasta from mddj! Glad to see it fixed here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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>
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