A CookieCutter template to help start new Python projects the right way.
Generating and running projects using this template require cookiecutter
and pyenv
to be available in your system
interpreter. These can be installed from PyPI and Homebrew respectively.
# Install pre-requisites:
brew update
brew install pyenv
python3 -m pip install cookiecutter
# Create new project from this template:
cookiecutter https://github.com/epikulski/pycookiecutter
- Python version management with pyenv.
- Provision virtual environment with venv.
- Manage and pin dependencies with pip-tools.
- Configures a local dev install of the library under development in editable mode.
- Support for absolute imports throughout the project, including the test suite.
- Adds a console script for the library's default entrypoint.
- Includes a Makefile with run configurations for linting, testing, building, and publishing to PyPI (or Artifactory).
Templated projects contain two files for tracking python dependencies: requirements.in
and requirements.dev.in
.
These are used by pip-compile to generate requirements.txt
and
requirements.dev.txt
, which should not be edited directly.
The dev
suffix corresponds to dependencies that are only relevant for local development. The development requirements
file is constrained by the production requirements file, to avoid impossible combinations of packages.
This package is a template based on my personal preference for setting up local dev environments for Python library
development. After testing poetry
and other tools, I've found that using Makefiles with setuptools
to be the most
simple and reliable for reproducibly creating a local dev environment from scratch.