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.
In preparation for making a few more contributions to #165, I first wanted to propose a framework for linting and auto-formatting the codebase.
I'm proposing
ruff
, based on it being a drop-in replacement for all of the standard linting tools you might use, e.g. Flake8, Black, isort, pydocstyle, etc. as well as being significantly faster to run.Note that in this PR, I only enable formatting. I do so for two reasons:
ruff
is an agreeable linting and formatting tool before putting in too much timeIf this approach is amenable, I will follow up with a second PR to enable
ruff
's linting.Note that formatting and linting can be performed via a
docker compose
command, but will also be run automatically if you're developing the project in VSCode. As a general principle, the CI check that is added to Github Actions runs via the samedocker compose
command that is run locally to ensure there isn't drift in environment or configuration between local development and CI.Reviewing
This PR is quite large, but the majority of changes are auto-generated, so should be reviewed by commit. Note that this will create a bunch of merge conflicts if you have any in-flight changes you'd like to merge soon. If that's the case, I can hold off on merging this until afterward those changes land. It's easier for me to rebase and re-generate the last commit (where the actual code formatting happens), than for someone else to deal with merge conflicts 😄
ruff
. As part of adding theruff
dependency, this commit made the following related changes:requirements-test.txt
file to be able to add additional packages for testing/linting without increasing the surface area of what is bundled into the production imageruff format ...
. These changes are formatting only and have no semantic meaning. The code before and after should generate the same AST[0]This CI build run on my fork shows that the new format check is currently passing.
[0] Technically
ruff
can modify the AST, but in a trivial way.