Repository navigation
Pin ruff and black versions across tooling - #144
Open
dumitrugutu wants to merge 4 commits into
Open
dumitrugutu wants to merge 4 commits into
dumitrugutu wants to merge 4 commits into
Conversation
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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ruff==0.16.8andblack==26.5.1in every SDK's dev extras and in the pre-commit hooks, so local runs, pre-commit and CI use the same versions.check-toolsMakefile guard that failsformat-*andlint-*when the installed ruff or black differs from the pin.SIM115finding in themulti_chanexample.Pre-commitworkflow that runs all hooks on every PR and push tomain(skipping the local-onlypytest-checkhook), so the checks don't depend on each developer's local setup.