An opinionated https://github.com/cookiecutter/cookiecutter for modern Python projects
🐍 Modern Python project Cookiecutter template
Each time you start a new Python project, you shouldn’t start from scratch.
Ideally, you’d start with a standard project structure and set of tools and
integrations to help facilitate writing quality Python code.
This modern Python Cookiecutter
template is the tool that will help you do just that.
poetry
to manage dependenciesstructlog
for loggingmypy
for static typingpytest
, hypothesis
, mutmut
for testing
pytest-cov
for coverage reportspytest-mock
for mockspytest-xdist
for distributed testingpytest-randomly
to randomly order teststox
for testing automation
sphinx
for docsmyst-parser
for markdown docspdb++
for debuggingkonch
for shell configuration w/ ipython
supportpre-commit
hooks with various hooks (mypy / black / ruff
/ deptry
)dockerfile
for development, testing, and productiondunamai
for versioningJustfile
(run just
)dependabot
github-actions
with ci (leveraging tox
), publish to pypi workflows w/ release-drafter
integration
codecov
integration for code coveragepublish
workflow (to test.pypi.org / pypi.org) w/ release-drafter
integration
auto approve / merge
workflowwith these additional workflows:
direnv
.envrc (with pyenv layout)Install Cookiecutter
poetry add cookiecutter
# pip install cookiecutter
# pipenv install cookiecutter
Optional: Install Cruft
poetry add cruft
# pip install cruft
# pipenv install cruft
cookiecutter gh:ryankanno/cookiecutter-py
Note: If you want to use the auto approve / merge Dependabot workflow, make
sure to create tags major
, minor
, patch
so that Dependabot can tag its
PRs. The workflow won’t merge anything with a major
tag.
cruft create https://github.com/ryankanno/cookiecutter-py/
Coming soon to a README near you!
To build the container:
DOCKER_BUILDKIT=1 docker build .
To run the container (if you’ve installed the defaults):
docker run <image_id or tag> python -m surf.surf
If you enable the PyPi workflow, versioning will happen via dunamai
within the Github pipeline.
If instead, you prefer to version your package, please do it via poetry version $(dunamai from any)
as recommended in their documentation.
See the open issues for a list of proposed features (and known issues).
Contributions are very much appreciated.
git checkout -b feature/new-cookiecutter-feature
)git commit -m 'Added a new feature'
)git push origin feature/new-cookiecutter-feature
)Distributed under the MIT License. See LICENSE
for more information.
Ryan Kanno - @ryankanno
Project Link: https://github.com/ryankanno/cookiecutter-py