Skip to content
Latchkey

poetry build: Build Wheel and Sdist

Build distributable artifacts straight from your Poetry project.

poetry build creates a source distribution and a wheel in dist/ using the metadata in pyproject.toml. It is the build step before publishing a Poetry-managed package.

What it does

Builds an sdist (.tar.gz) and a wheel (.whl) from the project. The --format flag restricts output to just one of the two.

Common usage

Terminal
poetry build
poetry build --format wheel
poetry build --format sdist

Common CI error: incomplete project metadata

Building fails if required project fields (name, version) are missing or malformed in pyproject.toml. Fill in the project metadata, then rebuild.

pyproject.toml
# Minimal metadata (PEP 621 style):
[project]
name = "my-package"
version = "0.1.0"
requires-python = ">=3.9"

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →