This repo contains a GitHub template for a complete Python project with support for:
- using virtual environments
- using separate requirements files for project and dev dependencies
- installing the project as a local editable package to easily import it in any test
file without having to use
sys.path.append()
- efficiently working in Gitpod with a pre-configured
gitpod.yml
file and pre-builds - using black for code formatting
manually and/or via pre-commit and/or with a GitHub
Actions workflow that checks the code formatting at each push and pull-request on the
main
branch. - using GitHub actions workflows to:
- parse the title of each pull request on the
main
branch and extract new version number (v*.*.*
) - check that the
CHANGELOG.md
file has been updated with the new version number - check that the
setup.py
file has been updated with the new version number - create a git tag on
main
once the pull-request is merged
- parse the title of each pull request on the
This is a list of the current features implemented, more will come with time.
-
Click on the
Use this template
button on the GitHub page of this repo to create a new repo. Don't check the "Include all branches" option. Once the repo is created, go in the repo settings and to the Pull requests section to choose this option: -
Once you cloned the repo, you can rename the
python_boilerplate
package in thesetup.py
file and thepython_boilerplate
folder. In PyCharm, you can just rename the first one and it will automatically rename the folder. You can also modify the other fields in thesetup.py
file, delete theimages
folder and the content of theREADME.md
andCHANGELOG.md
files. You can then add your files and start working on your project. -
To install all the dependencies you can use the
setup_workspace.sh
script. It will create a virtual environment, install the project as an editable package and install the regular and dev dependencies, and install black and pre-commit.If you use Gitpod, you don't need to run this script, it is already done for you.