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.
Purpose
I started this earlier and thought it might be useful to finish. The goal is to move the workflow to the
tox.ini
file rather than the github.yml
so both local and ci usages will be able to use it. As part of doing that, I addedisort
since it's described in the wiki but we haven't been using it regularly, and this should make it easy.What it does
First define
tox.ini
which allows either checking formatting (and running tests) with no side effects, or actually formatting the code locally before committing changes. Then combine these into the github workflow and delete the obsolete.yml
. The pytest and formatting steps show up as separate checkmarks due to thestrategy
block in the.yml
. This failed ci as expected, so I rantox -e format
which callsisort
(in a way that is compatible withblack
), and is responsible for most of the changes.To use it locally, running
tox
will default to running thepytest-local
andformat
environments, which will in turn run the matching commands. Specifically, it will match the lines starting withpytest
andlocal
, as well as the formatting ones. Environments (called "testenvs" in tox language) can be invoked specifically, e.g.tox -e checkformatting
would validate formatting and output a diff if it fails.Note, this is meant to be totally optional, and running any of these as we do now will still work, the only change is that we would use tox in our ci pipeline.
Time to review
15 min - this isn't super important, I just thought I'd put this out if people are interested.