Poetry
Dependency management, virtual environments and publishing behind one command.
What it is
Poetry is a Python dependency management and packaging tool that simplifies the process of managing project dependencies, building packages, and publishing them. It ensures deterministic installs and isolated environments.
Poetry provides commands to create new projects, add or remove dependencies, build and publish packages, and manage virtual environments automatically. It uses a `pyproject.toml` file to track project metadata and dependencies.
- Licence
- MIT
- Best known for
- Making Python packaging coherent before the standards caught up
When to use it
The question documentation cannot answer for you — because it cannot recommend something else.
Reach for it when
- Publishing a library to PyPI, where its build and version handling shine
- You want a lockfile and reproducible installs without assembling the tooling yourself
Look elsewhere when
- You want maximum speed and standards-plain configuration — uv has largely taken this ground
- The project is a single script with two dependencies
Installation
pip install poetryGetting started
The smallest useful thing you can do with it, and what each part means.
poetry new my-projectpoetry add requestspoetry installAdvanced usage
Where the library earns its place over a simpler alternative.
poetry remove requestspoetry run python script.pypoetry publish --buildpoetry show --treeErrors and fixes
The failures you are most likely to hit, and what actually resolves them.
- PackageNotFoundError
- Verify the package name and check PyPI availability before adding it.
- CommandNotFoundError
- Ensure Poetry is installed correctly and is available in your system PATH.
- VersionConflict
- Resolve conflicting dependency versions manually or use `poetry update`.
Best practices
- Use `poetry.lock` to ensure deterministic installs across different environments.
- Keep development dependencies separate from production dependencies using `--dev` flag.
- Regularly update dependencies using `poetry update` to maintain security and compatibility.
- Use `poetry check` to verify the integrity of your `pyproject.toml` file.
- Leverage virtual environments managed by Poetry instead of system-wide installations.
Alternatives
Comparable options, and the reason you would pick one over the other.
uv
Dramatically faster, speaks standard pyproject.toml; the emerging default
Background
Why it exists, and what it was reacting to.
Poetry was created by Sébastien Eustace in 2018 to provide a modern alternative to pip and setuptools for Python projects. It emphasizes simplicity, reproducibility, and a standardized approach to dependency management, making Python project setups more predictable and reliable.
