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

@henryiii henryiii commented May 26, 2026

Copy link
Copy Markdown
Contributor

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
Comment thread pyproject.toml
Assisted-by: OpenCode:glm-5.1

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

@sirosen sirosen left a comment

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.

I just realized that this is still open! I thought we merged it during PyCon US, whoops! 😓

I noted a couple of very minor tweaks we should make before merging, related to flake8. However, I'm approving to signal that if those are good to apply, you should feel free to merge afterwards. 🙂

It also highlighted for me that we don't have CI setup for pre-commit. I thought I had configured pre-commit.ci, but it didn't run on this, so maybe I'm mistaken. I'll file an issue for that.

Comment thread .flake8
[flake8]
exclude = .git,.tox,__pycache__,.eggs,dist,.venv*
max-line-length = 88
extend-ignore = W503,W504,E203

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.

Because flake8 left and came back, we need to restore this file. Otherwise, flake8 fails.

Comment thread .pre-commit-config.yaml
rev: 5.13.2
hooks:
- id: isort
additional_dependencies: [flake8-typing-as-t]

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.

Assuming you have no objection, let's restore the previous pin!

Suggested change
additional_dependencies: [flake8-typing-as-t]
additional_dependencies: ['flake8-typing-as-t==1.0.0']

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