Cookiecutter template for a RR Python application.
Notes:
- Support python3.6+ only
- If you have a library(not a application) you might want to take a look at RRPyLibrary
- Formatting with black
- Import sorting with isort
- Static typing with mypy
- Linting with flake8
- Linting commit message with gitlint
- Git hooks that run all the above with pre-commit
- Managing a recorded version number with versioneer
- Generate changelog from git commit message with gitchanglog
- Managing dev task with invoke
- Testing with pytest
- Protect python codebase with Cython
- Bundles application with Pyinstaller
- Continuous Integration with gitlab-ci (optional)
# Install pipx if cookiecutter are not installed
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# Use cookiecutter to create project from this template
pipx run cookiecutter gh:HuangKaiHuan/cookiecutter-rrpyapplication
# cd to the project root
cd existing_folder
# create virtualenv(recommend)
python3 -m venv venv
source venv/bin/activate # for linux
venv/Scripts/activate # for windows
# install dependencies
python -m pip install -U pip
python -m pip install -e .
# auto init the repo by invoke command
inv init-repo
# or you can run command step by step
git init
git add .
git commit -m "chore: First commit"
git tag $your_version
pre-commit install -t pre-commit
pre-commit install -t pre-push
pre-commit install -t commit-msg
# Push to remote repo
create a repo and put it there.
git remote add origin git@$repo_hosting_domain:$repo_username/$project_name.git
git push -u origin master
You should read Conventional Commits before doing a commit.
To run the tests, just run:
inv test
To run all check:
pre-commit run -a
You should read Semantic Versioning 2.0.0 before bumping versions.
inv bumpversion patch
to increase version from 1.0.0 to 1.0.1.inv bumpversion minor
to increase version from 1.0.0 to 1.1.0.inv bumpversion major
to increase version from 1.0.0 to 2.0.0.inv bumpversion auto
to auto increase version.
At the same time, it will auto update the changelog.
inv freeze