- Use pre-commit as the lint and formatter runner
- See
.pre-commit-config.yaml
file for hook settings and lint rules - Used both locally and in Github Actions CI
Formatter / Linter hooks:
Install pre-commit and all dev dependencies
pip install requirements-dev.txt
run pre-commit for all files ad-hoc
pre-commit run -a
commit and skip pre-commit action
git commit -m "my commit message" --no-verify
skip CI on push (if you updated docs and want to skip linting and tests for example)
git push -o ci.skip
- Some default Github Actions workflows for linting and release packaging are included.
- Pushes to all branches and merge to master / main triggers linting workflow.
- Pushing tags that start with "v" will kick off release workflow.
- Merge feature branch pull request into main / master
- On local machine, check out main / master
git pull
remote changes- Use Bump2version to bump
version.txt
and create matching "v" release tag. git push
the annotated tag to remote, which kicks off the release CI flow
bump2version command:
bump2version patch --tag-message "fixed some bugs in this release"
- major / minor / patch will update the respective parts of a SEMVER release (Major.Minor.Patch)
- This command is abbreviated, and relies on
.bumpversion.cfg
to define target files, and auto-commit / tag behavior
git push bumped version files and annotated tag
git push --atomic origin master v0.1.0
- After merging pull request and deleting branches, clean up local branches.
- Utility npm package, git-removed-branches to help with this.
install:
npm install -g git-removed-branches
use:
git checkout main
git fetch -p
git removed-branches --prune