This is a template repository that you can use to quickly create a python application that can be built, tested, and released as an internal python module.
Support Python 3.9, 3.10, 3.11, 3.12.
Use
- GitHub Actions
- CodeQL is enabled in this repository.
- Dependabot is enabled for auto dependency updates.
- Gitleaks and TruffleHog are enabled in this GitHub Actions workflow for detecting and preventing hardcoded secrets.
- Snyk is enabled for vulnerability scanning and auto pull-request.
- black
- bump2version
- codecov
- flake8
- Mypy
- tox
Create a directory and pull all the files in this template.
mkdir new_repo_name
cd new_repo_name
git init
git pull https://github.com/kyhau/python-repo-template
Linux
virtualenv -p python3.11 env
. env/bin/activate
pip install -e .
Windows
virtualenv -p C:\Python310\python.exe env
env\Scripts\activate
pip install -e .
pip install -r requirements-build.txt
# Autoformat code following most of the rules in PEP 8
black --line-length=99 module/
# Run pytest, codecov, mypy and flake8 with Tox
tox -r
Version-bump your application or module with bump2version
Examples
# e.g. 1.2.3.dev0 -> 1.2.3
bumpversion --allow-dirty --commit --tag release
# e.g. 1.2.3 -> 1.2.4.dev0
bumpversion --commit patch
# e.g. 1.2.3.dev0 -> 2.0.0.dev0
bumpversion --commit major
# e.g. 1.2.3.dev0 -> 1.3.0.dev0
bumpversion --commit minor
# e.g. 1.2.3.dev0 -> 1.2.4.dev0
bumpversion --commit patch
# e.g. 1.2.3.dev0 -> 1.2.3.dev1
bumpversion --commit dev
# e.g. 1.2.3.dev0 -> 1.2.3
bumpversion --dry-run --list release