A cookiecutter template that is aimed for all kinds of python project. It's straight-forward and easy to use. You can create a brand new python project by executing one command.
- Black Code style formatting
- flake8 Linter.
- Docker-compose & Dockerfile.
- PyPackage release (Semantic version release)
- CircleCi CI/CD.
- Extra support for Cookiecutter replay
It does not necessairly to follow this structure. Feel free to fork this project and create a project of your own accord 💖
{{ cookiecutter.project_slug }}
├── src # source folder
├── main.py # python script
├── Dockerfile
├── pytest.ini
└── requirements.txt
├── .template # cookiecutter replay dir
├── cookiecutter-python.json # cookiecutter-replay
└── cookiecutter-config.yml # user config
├── .circleci
├── config.yml
├── docs
├── AUTHORS.md
├── .gitignore
├── .pre-commit-config.yaml
├── CHANGELOG.md
├── docker-compose.yml
├── LICENSE
├── pyproject.toml
├── README.md
├── setup.cfg
└── setup.py
Please follow the documentation to install the package.
$cookiecutter https://github.com/LeisureTech/cookiecutter-python
Follow the terminal and set up parameters accordingly.
You're all set!
cd {{cookiecutter.project_slug}}/src
docker build --tag python-project .
docker run python-project
Cookiecutter replay is tricky. To make it easier, we keep the replay file in the template so we don't need to worry about the default replay parameters have been overwritten. It comes in handy for the situation where multiple projects were generated from the same template.
To perform a replay, the first thing you need to do is to edit the cookiecutter-config.yml
file from the /.template
folder according to your situation:
default_context:
full_name: "Leisure Mojo"
email: "leisuremojotech@gmail.com"
github_username: "leisuremojo"
cookiecutters_dir: "~/.cookiecutters/"
replay_dir: "~/cookiecutter_python_example/.template" # set a relative/absolute path
Next, run the following command:
cookiecutter --replay --config-file {{cookiecutter.project_slug}}/.template/cookiecutter-config.yml -f gh:LeisureTech/cookiecutter-python
Before replaying, you better backup CHANGELOG.md
and update the {{cookiecutter.version}}
from .template/cookiecutter-python.json
to the current version of your project. This is due to the fact that replaying overwirtes those files, so by this way your git logs will not be contaminated.