Python is incredible, but the packaging story is a pain point even for programmers with years of experience. These docs are worth reading slowly, allowing yourself to follow links and get a sense for what is at your disposal for package and distribution management. The core of this documentation is about how to use pip
, setuptools
, build
, and python -m venv
to great effect. Many of us aren’t as familiar with these basic tools as we should be. We’ve jumped away for abstractions that add layers of insulation between us and these basic tools before really trying in earnest to use them.
I used Poetry for a long time in my open source project aiosql, but after reading this PyPA documentation I switched to the basics. Someone should be able to download my code and run something as simple as pip install .
or pip install -r dev-requirements.txt
to get going. Using poetry
was putting a burden on people who pick up the project and want to collaborate with me. I’m not saying not to use poetry
. I think it has the best user experience and is the smartest of any tool available to the python developer. If your application team, working out of a private repository, has discussed and decided to align on using poetry and everything that comes with it, great. But, read the PyPA packaging guide anyway, because you might learn that the basic tools do what you want, are well supported, and don’t have as bad a UX as you thought.
Highlights
- pip-tools is the minimal layer of extra tooling to pin dependencies for build reproducability that you actually need.
setup.cfg
exists and should be used for as much as possible before you write a single line to asetup.py
.- a good explanation of what
sdist
andwheel
packages are. - Links to a lot of PEPs.
- All the ways to deploy and distribute a Python application, with examples and trade-offs.
Thanks for reading, see you out there in the source code.