Cookiecutter Modern PyPackage
Cookiecutter template for a modern Python package.
GitHub repo: https://github.com/mario-bermonti/cookiecutter-modern-pypackage.git
Documentation: https://cookiecutter-modern-python-package.readthedocs.io
Free software: MIT license
Features
Dependency tracking using Poetry
Testing setup with Pytest
Github Actions ready for Continuous Integration testing
Docstring linting provided by Darglint using the Numpy Python Style Guide
Static type checking by Mypy
Checks dependencies for known security vulnerabilities with Safety
Git hooks managed by pre-commit.
All development tasks (lint, format, test, etc) wrapped up in a python CLI by invoke
Multiple Python environments testing provided by Nox
Documentation provided by Sphinx ready for generation with, for example, Read the Docs
Command line interface using Click (optional)
Automated dependency updates with Dependabot
Coverage reports on Codecov
Automated releases to PyPI (optional)
Quickstart
Install the latest Cookiecutter if you haven’t installed it yet (this requires Cookiecutter 1.4.0 or higher):
pip install -U cookiecutter
Generate a Python package project:
cookiecutter gh:mario-bermonti/cookiecutter-modern-pypackage
Then:
Create a repo and put it there.
Install the dev requirements into a virtualenv. (
poetry install
)Install pre-commit hooks. (
poetry run inv install-hooks
)Configure Codecov repository settings. (Codecov App,
CODECOV_TOKEN
)Add the repo to your Read the Docs account + turn on the Read the Docs service hook.
Configure PyPI token. (
PYPI_TOKEN
)Release your package by pushing a new tag.
For more details, see the tutorial.
Contributing to this project
All contributions are welcome!
Will find a detailed description of all the ways you can contribute to cookiecutter-modern-pypackage in the contributing guide.
This is a beginner-friendly project so don’t hesitate to ask any questions or get in touch with the project’s maintainers.
Please review the project’s code of conduct before making any contributions.
Credits
This cookiecutter is a fork of fedejaure’s awesome python package template. It uses most of fedejaure’s code and configuration, but it has been adapted so it is easier to use by scientists who have limited technical background in programming.
Please do checkout fedejaure’s template as it is great and may even be better suited for your needs.
This template is also influenced by these awesome projects:
audreyr/cookiecutter-pypackage: Cookiecutter template for a Python package.
briggySmalls/cookiecutter-pypackage: A fork from audreyr/cookiecutter-pypackage using Poetry for package management, with linting, formatting and more.
hypermodern-python: Hypermodern Python article series.
TezRomacH/python-package-template: Your next Python package needs a bleeding-edge project structure.