Skip to content

feanil/pycodestyle to ruff#38076

Merged
feanil merged 8 commits intomasterfrom
feanil/pycodestyle_to_ruff
Mar 4, 2026
Merged

feanil/pycodestyle to ruff#38076
feanil merged 8 commits intomasterfrom
feanil/pycodestyle_to_ruff

Conversation

@feanil
Copy link
Contributor

@feanil feanil commented Mar 3, 2026

  • feat: add ruff and configure it to match current pycodestyle rules
  • chore: regenerate compiled requirements after adding ruff
  • feat: add ruff Makefile target
  • feat: add ruff to quality CI workflow alongside pycodestyle

@feanil feanil marked this pull request as ready for review March 3, 2026 18:21
@feanil feanil requested review from a team and bmtcril March 3, 2026 18:21
"E731", # do not assign a lambda expression
"E741", # ambiguous variable name
"E743", # ambiguous function name
# The rules below were added in pycodestyle 2.9.x but we were pinned to 2.8.x,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

W503 and W504 (line break before/after binary operator) were both ignored in the old setup.cfg pycodestyle config but are absent here. That is intentional: ruff does not implement either rule.

These two rules are mutually contradictory — one requires breaking before the operator, the other after — so PEP 8 guidance on this has gone back and forth over the years. Ruff took the pragmatic approach of not enforcing either one, meaning whatever line-break style the codebase already uses will be accepted as-is.

@feanil feanil requested a review from kdmccormick March 3, 2026 18:28
Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

I'm so happy to see this. Here's some suggestions but feel free to ignore if you're set on exact pycodestyle config parity.

feanil and others added 8 commits March 4, 2026 10:27
Adds ruff to testing requirements and configures it in pyproject.toml
to enforce the same E/W rules that pycodestyle 2.8.x was enforcing.
Two additional rules (E714, E721) that pycodestyle 2.8.x did not enforce
are explicitly ignored for now and can be cleaned up in a follow-up.

Part of the migration from pycodestyle → ruff.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Runs ruff alongside pycodestyle so we can validate parity before
removing pycodestyle in the next commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove pycodestyle from requirements
- Remove pycodestyle version constraint (pinned to <2.9.0 due to a
  false positive E275 bug that is no longer relevant)
- Remove [pycodestyle] config from setup.cfg (config now lives in
  pyproject.toml under [tool.ruff])
- Remove pycodestyle Makefile target
- Remove make pycodestyle from quality CI workflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove unnecessary ignores.

Co-authored-by: Braden MacDonald <braden@opencraft.com>
Most of these ignores are unnecessary as we're passing them now and we
want to check them in the future. E714 only had one fixable violation so
we just fixed it.
* Update the call to `ruff` so that it outputs in a github friendly
manner.

* Remove ruff exclusions that are already covered by .gitignore which
  ruff respects.
Update the requirements to drop pycodestyle and add ruff.
@feanil feanil force-pushed the feanil/pycodestyle_to_ruff branch from f71d17b to 84956c3 Compare March 4, 2026 15:38
@feanil feanil enabled auto-merge (rebase) March 4, 2026 17:15
@feanil feanil disabled auto-merge March 4, 2026 17:15
@feanil feanil enabled auto-merge (squash) March 4, 2026 17:15
@feanil feanil merged commit 467495c into master Mar 4, 2026
68 checks passed
@feanil feanil deleted the feanil/pycodestyle_to_ruff branch March 4, 2026 17:33
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.

4 participants