This is a Python project template that anyone can use with basic CI/CD pipeline, issue and PR templates etc.
You can remove the (optional)
directories if you don't need them. (e.g. docker/
, setup.py
, etc.)
python-project-template/
├── .github/ # GA workflows & PR, Issue templates
├── docker/ # (optional) Dockerfile & docker-compose files related to the project.
├── tests/ # Test codes with pytest
├── .gitignore # gitignore file
├── README.md # README file
├── pyproject.toml # (optional) PyPI package configuration file
├── setup.py # (optional) PyPI package setup file
└── requirements.txt # Project dependencies
Basic CI workflow with pytest. It runs tests in the tests/ directory, with master branch commit & PR triggers by default.
Basic CD workflow for DockerHub publishing. You can remove this workflow if you don't need it.
It will build the docker image with files in the docker/ and publish it to the dockerhub. The auto-trigger of the action is disabled by default.
Before using the workflow, you need to set the DOCKER_USERNAME
& DOCKER_PASSWORD
in the repository settings.
And make sure to edit the image-name
in the workflow.
Basic CD workflow for pypi package. You can remove this workflow if you don't need it.
The auto-trigger for this workflow is disabled by default. If enabled, it will build and publish to pypi whenever you make a new "release" in the repository.
Before using the workflow, edit package name to yours in the workflow.
There are some basic templates for the issue & PR. You can edit them or add more to fit your project's needs.
-
Issue Templates:
- bug_report.md : Basic bug report template
- feature_request.md : Feature request template
-
PR Template: pull_request_template.md
The docker/ directory and publish-dockerhub.yml are associated with the Docker CI/CD pipeline. You can remove them if you don't need them.
Before building image, make sure to edit the variable in the docker/Dockerfile:
And edit docker/docker-compose.yaml as well:
The image is built and published automatically by the CI/CD pipeline, but you can also manually build and run the image with the following commands.
- git clone this repository
git clone https://github.com/your-name/your-project-name.git
- Build the image
docker compose -f docker/docker-compose.yaml build
- Run the container
docker compose -f docker/docker-compose.yaml up
The setup.py, pyproject.toml and publish-pypi.yml are associated with the PyPI package CI/CD pipeline. You can remove them if you don't need them.
Make sure to edit dependencies & variables in the pyproject.toml as your project's needs.
Click "Use this template" and "Create a new repository". Then you can start your own project with git clone
.