Poetry

Poetry is a packaging and dependency manager for Python that uses pyproject.toml to define project metadata and dependencies, provides a lock file for repeatable installs, and can build and publish distributions.

Installation and Setup

Poetry requires Python 3.9 or newer and runs on Linux, macOS, and Windows. Here’s how to install it:

Windows PowerShell
PS> (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
Shell
$ curl -sSL https://install.python-poetry.org | python3 -

Verfy the installation:

Shell
$ poetry --version
Poetry (version 2.2.0)

Key Features

  • Supports pyproject.toml configuration for metadata and dependencies, with a PEP 517 build backend via poetry-core.
  • Implements reproducible installs using a poetry.lock file that records exact versions.
  • Integrates environment management to creates or detects virtual environments and supports poetry run to invoke tools.
  • Provides publishing workflows to build wheels and sdists and to publish to PyPI or private indexes.
  • Supports plugins to customize functionality.

Usage

Create a new project or configure an existing one:

Shell
$ poetry new project_name

$ cd existing_project
$ poetry init

Add and install dependencies:

Shell
$ poetry add requests
$ poetry install

Run tools inside the managed environment:

Shell
$ poetry run pytest

Update locked dependencies:

Shell
$ poetry update

Build and publish a distribution to PyPI:

Shell
$ poetry build
$ poetry publish

These commands operate on pyproject.toml and poetry.lock to manage packages and produce wheel and sdist artifacts.

Tutorial

Dependency Management With Python Poetry

Learn how Python Poetry will help you start new projects, maintain existing ones, and master dependency management.

intermediate best-practices devops tools

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Nov. 28, 2025