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 sdistCommon 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
poetry publish: Publish to PyPIHow poetry publish uploads built artifacts to PyPI or a private repository, the --build and --repository flag…
python -m build: Build Wheels and SdistsHow python -m build creates an sdist and wheel in an isolated environment, what it needs in pyproject.toml, a…
poetry install: Install from the LockfileHow poetry install resolves and installs dependencies from poetry.lock, the --no-root and --only flags useful…