Accompanying code for the article "Python packaging for developers in a hurry".
The toolset:
- mamba (from the mambaforge distribution) for managing Python environments and installing packages which are only available in conda's repositories
- pip-tools for managing and pinning direct and transitive dependencies for applications (libraries are only loosely-pinned)
- setuptools for packaging the project with a declarative configuration in
setup.cfg
- build and twine for sane and foolproof packaging and publishing of libraries on PyPI
- docker for packaging code and runtime environment of applications
The benefits:
- Effortless and consistent workflow across Linux, Windows and macOS
- Access to a vast catalog of packages that are hard-to-install, available from conda's repositories (
mamba
) - Fast, easy-to-manage, and human-readable generation of pinned application dependencies for reproducible environments (
pip-tools
) - Simple, easy-to-manage declarative configuration for packaging the project (
setuptools
andsetup.cfg
) - Easy to get right, hard to get wrong building of source and wheel distributions for libraries (
build
andtwine
) - Fast-to-build and cache-friendly docker images for applications, with a helpful
dev
stage for usage in CI environments (docker
)
application
: contains a sample project structure for an application (where pinning dependencies, simple builds and isolated environments are key)library
: contains a sample project structure for a library (where maximizing compatibility, and robust and reproducible building of source and wheel distributions are important)
Each folder contains a README.md
that guides you through the (very similar) steps for getting started with them.