Skip to content

Pin ruff and black versions across tooling - #144

Open
dumitrugutu wants to merge 4 commits into
chore/drop-python-3.9from
chore/pin-ruff-black
Open

dumitrugutu wants to merge 4 commits into
chore/drop-python-3.9from
chore/pin-ruff-black

Conversation

@dumitrugutu

@dumitrugutu dumitrugutu commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Pin ruff==0.16.8 and black==26.5.1 in every SDK's dev extras and in the pre-commit hooks, so local runs, pre-commit and CI use the same versions.
  • Add a check-tools Makefile guard that fails format-* and lint-* when the installed ruff or black differs from the pin.
  • Reformat the repo once with the pinned versions and fix the SIM115 finding in the multi_chan example.
  • Add a Pre-commit workflow that runs all hooks on every PR and push to main (skipping the local-only pytest-check hook), so the checks don't depend on each developer's local setup.

Local runs, pre-commit and CI were using different ruff and black
versions (pre-commit: ruff 0.1.9 / black 23.12.1; CI and dev extras:
unpinned latest; developer machines: anything on PATH), so formatting
and lint results disagreed depending on where they were run.

- Pin ruff==0.16.8 and black==26.5.1 in every SDK's dev extras
- Use the same versions for the pre-commit hooks (ruff-pre-commit now
  from astral-sh)
- Add a check-tools Makefile guard that fails format-*/lint-* with a
  clear message when the installed ruff or black differs from the pin
- Reformat the repo once with the pinned versions (formatting only)
- Fix the SIM115 finding in the multi_chan example by using ExitStack
Pre-commit hooks only run for developers who have run
`pre-commit install`, so nothing stopped unformatted or unlinted code
from being merged. Add a Pre-commit workflow that runs every hook on
all files for pushes to main and for pull requests, so the checks no
longer depend on each developer's local setup.

The local-only pytest-check hook is skipped because tests already run
in the Test and Build workflow.

Also commit the fixes the hooks apply to existing files (trailing
whitespace in two READMEs, import order in a requirements.txt) so the
job passes on its first run.
@dumitrugutu
dumitrugutu changed the base branch from main to chore/drop-python-3.9 November 5, 2026 16:39
@dumitrugutu
dumitrugutu added this pull request to stack #145 November 5, 2026 16:42

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant