build
build is a Python packaging and build frontend. It reads project settings from pyproject.toml, invokes a PEP 517 compilant build backend, and creates wheel files and source distributions.
Installation and Setup
Install build from Python Package Index (PyPI):
Shell
$ python -m pip install build
Key Features
- Acts as a PEP 517 build frontend, working with any compliant backend.
- Builds in isolated environments by default and installs only declared build requirements.
- Provides a minimal, backend-agnostic interface centered on
python -m buildand thepyproject-buildscript. - Generates both sdists and wheels and writes them to
dist/by default. - Supports passing backend configuration with
-C/--config-settingor--config-jsonto customize builds without backend-specific commands.
Usage
Set the build backend:
TOML
pyproject.toml
[build-system]
requires = ["setuptools >= 77.0.3"]
build-backend = "setuptools.build_meta"
# ...
Build both a sdist and a wheel:
Shell
$ python -m build
Build only a wheel:
Shell
$ python -m build --wheel
Build only a source distribution:
Shell
$ python -m build --sdist