Skip to content

Poetry: Python Packaging and Dependency Manager

Poetry is a Python packaging and dependency management tool that handles dependency installation, virtual environment management, package building, and publishing. It reads project configuration from pyproject.toml.

Choose Poetry for an existing workflow

Poetry fits teams that already have an established Poetry workflow and need integrated dependency management, virtual environment handling, and package publishing. Its lockfile and dependency group features suit application projects that require reproducible builds.

For new projects, uv provides faster dependency resolution and a broader feature set. For existing Poetry projects, see How to migrate from Poetry to uv.

Manage dependencies and projects

Resolve and lock dependencies

  • Handles package installation and removal
  • Resolves dependencies with version constraints
  • Creates and updates lockfiles for reproducible installations
  • Manages virtual environments automatically
  • Supports standard dependency groups for development and testing

Configure and publish projects

  • Initializes new Python projects with poetry new
  • Configures projects via pyproject.toml
  • Supports PEP 621 project metadata under the standard [project] table
  • Handles package building and publishing
  • Manages project plugins and versions

Delay newly released dependencies

solver.min-release-age excludes recently published versions from resolution. A version is considered only when all of its known distribution files are at least the configured number of days old, which gives the community time to detect and yank a compromised release before it enters the lockfile. The setting lives under [solver] in poetry.toml:

[solver]
min-release-age = 7
min-release-age-exclude = "internal-lib,other-package"
min-release-age-exclude-source = "private-repo"

min-release-age-exclude takes a comma-separated list of package names to evaluate without the age filter; min-release-age-exclude-source exempts every package from named indexes. The equivalent CLI command is poetry config --local solver.min-release-age 7, and the equivalent environment variable is POETRY_SOLVER_MIN_RELEASE_AGE (an integer number of days). The feature mirrors uv’s exclude-newer cooldown.

Configure standard metadata and Poetry settings

Projects can be configured through standard PEP 621 metadata:

[project]
name = "example"
version = "0.1.0"
description = "Project description"
requires-python = ">=3.10"
dependencies = [
    "requests>=2.32"
]

Poetry-specific settings can coexist with standard metadata:

[tool.poetry]
packages = [{include = "example"}]
requires-poetry = ">=2.0"

[tool.poetry.requires-plugins]
poetry-plugin-export = ">=1.9"

Account for limitations

  • Slower dependency resolution than newer tools like uv
  • Some non-standard dependency specification features
  • Export functionality lives in poetry-plugin-export, which must be installed separately

Compare related tools

  • uv: Faster package manager with integrated Python and venv management
  • pip: Python’s default package installer
  • PDM: Python package manager with a standalone build backend and lockfile support
  • Hatch: Packaging tool with dependency management and build backends
Last updated on