Add pre-commit config, formatting with black, linting with ruff #2503
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.
This closes #2291 and fixes the broken lint check in CI (#2291 (comment)) by replacing it with pre-commit. This will be a lot to review but hopefully it helps give a sense of the scale of changes. Timing-wise I'm not sure if there are any existing PRs you'd rather merge first (I have two open that would need to be rebased, haha).
Configuration is almost entirely in
pyproject.toml
, with a bit in.pre-commit-config.yaml
. The main exclusion isvispy/gloo/gl
, which I believe is all/mostly generated code. I tried to comment the configs to explain how values, but of course I'm open to changes on that as well. I played with line-length a bit to pick a sane-ish value and settled on 100 for black, with ruff errors at 110. Pulling it down to 88 (black's default) or 79 created over 1000 more errors I think. So, a lot more but maybe a drop in the bucket compared to the changes already here.Finally, this adds a
.git-blame-ignore-revs
file so the one massive commit would be skipped by default in "blame" view on GitHub.