Conversation
1cd6361 to
6fa4772
Compare
Merged
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.
Purpose
I started this earlier and thought it might be useful to finish. The goal is to move the workflow to the
tox.inifile rather than the github.ymlso both local and ci usages will be able to use it. As part of doing that, I addedisortsince 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.iniwhich 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 thestrategyblock in the.yml. This failed ci as expected, so I rantox -e formatwhich callsisort(in a way that is compatible withblack), and is responsible for most of the changes.To use it locally, running
toxwill default to running thepytest-localandformatenvironments, which will in turn run the matching commands. Specifically, it will match the lines starting withpytestandlocal, as well as the formatting ones. Environments (called "testenvs" in tox language) can be invoked specifically, e.g.tox -e checkformattingwould 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.