Python package management: historical chaos
Before Poetry the Python tool stack was fragmented: setup.py (imperative), requirements.txt (no transitive resolution), separate virtualenv, pipenv with performance issues. No modern standard equivalent to Cargo (Rust), npm (JS), bundler (Ruby).
Poetry, created by Sébastien Eustace in 2018, unifies everything. Version 1.0 is released on 12 December 2019. MIT licence.
What it provides
- pyproject.toml as single project file (PEP 518/621)
- Lock file (
poetry.lock) deterministic, versioned - Modern resolver with SAT solver
- Virtual env auto-managed
- Build & publish to PyPI with
poetry build && poetry publish - Dependency groups (dev, test, docs) separate
[tool.poetry]
name = "myapp"
version = "0.1.0"
[tool.poetry.dependencies]
python = "^3.7"
django = "^2.2"
requests = "^2.22"
[tool.poetry.dev-dependencies]
pytest = "^5.2"
Adoption
Poetry is establishing itself as a choice for new Python projects, especially libraries and web applications. It shares the space with pipenv, an alternative to pip + virtualenv on which Poetry attempts a more solid approach.
References: Poetry 1.0 (12 December 2019). Sébastien Eustace. MIT licence. pyproject.toml (PEP 518, 621). SAT solver resolver.
