Skip to content

Replace black and flake8 with ruff - #17

Merged
wsdewitt merged 1 commit into
mainfrom
ruff
Oct 18, 2026
Merged

wsdewitt merged 1 commit into
mainfrom
ruff

Conversation

@wsdewitt

Copy link
Copy Markdown
Collaborator

Summary

  • ruff format replaces black, including for the notebooks, and ruff check replaces flake8.
  • ruff runs the same checks as the old flake8 config: pycodestyle (E, W) and pyflakes (F), with an 88-character line limit.
  • ruff skips gitignored paths, so .hatch and .vscode are excluded automatically. .conda isn't gitignored, so it's excluded explicitly, as it was for flake8.
  • docformatter and pyright stay, because ruff doesn't reflow docstrings or check types.
  • .flake8 is deleted, and its settings move to [tool.ruff] in pyproject.toml.

Code changes

ruff format agrees with black everywhere except one assert in bdms/tree.py, which it wraps differently. ruff check finds nothing.

Not included

With no select setting, ruff 0.17's default rules are broader than flake8's, and they report 27 findings on this code. Most are style, such as import order. Two are worth knowing about: InhomogeneousProcess uses mutable dict defaults for quad_kwargs and root_kwargs, so all instances share the same dicts. Nothing in BDMS modifies them. Any of these rules can be turned on later by adding them to select.

Testing

In a fresh clone with Python 3.14, I ran hatch env create and then each hatch script. hatch run lint passes, hatch run format changes nothing, and hatch run tests passes, covering unit tests, doctests, and both notebooks. hatch run docs builds with only the three warnings that were already there. I also checked that a lint error inside .conda/ isn't reported.

🤖 Generated with Claude Code

ruff format replaces black (including notebooks), and ruff check
replaces flake8, configured with the same checks (pycodestyle and
pyflakes, 88-character lines). docformatter and pyright are unchanged.

The only code change is how ruff formats one assert statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wsdewitt
wsdewitt merged commit d937ac1 into main Oct 18, 2026
5 checks passed
@wsdewitt
wsdewitt deleted the ruff branch October 18, 2026 03:26
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.

1 participant