Cookiecutter template for a Python package.
The boilerplate Python project that aims to create facility for maintaining of the package easily. It considering tools for building, testing and distribution.
This template provides a basic structure for an idiomatic Python package with a convenient Makefile-facility and additional helpers.
There are a couple of tools for building, packaging, documentation and so on, that must be installed.
- GNU sed (
brew install gnu-sedfor macOS),
- ripgrep (optionally),
- Sphinx (for sphinx-build and sphinx-apidoc).
To check availability of main tools just type
To get help about available Makefile targets type:
Creating the virtual environment
Compile Pip requirements from
requirements.txtusing pip-tools (via Docker):
Create the new virtual environment based on
Install the package into a virtual environment in so-called "development mode":
source .venv/bin/activate make install # ...hard working here... make uninstall deactivate
Testing the package
Pytest is used as a test tool by default.
To run tests type (within a virtual environment):
Building the package from scratch
Create a source distribution (tarball with sources):
make sdist ls -al dist/*.tar.gz
Create a binary (wheel) distribution:
make dist ls -al dist/*.whl
Dealing with containers
Display system-wide information:
Show all images, containers and volumes:
Build the image according to
Run temporary container in an interactive mode:
Remove all unused images, built containers and volumes:
Build an API documentation:
Build the documentation as a standalone HTML files:
make html open doc/_build/html/index.html
Clean the project's directory (precompiled and temporary files):
Clean the project's build output (eggs, distributions, builds):
Delete almost everything (including virtual environment):