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):
$ 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:
pyproject.toml
[build-system]
requires = ["setuptools >= 77.0.3"]
build-backend = "setuptools.build_meta"
# ...
Build both a sdist and a wheel:
$ python -m build
Build only a wheel:
$ python -m build --wheel
Build only a source distribution:
$ python -m build --sdist
Related Resources
Tutorial
How to Publish an Open-Source Python Package to PyPI
In this step-by-step tutorial, you’ll learn how to create a Python package for your project and how to publish it to PyPI, the Python Package Repository. Quickly get up to speed on everything from naming your package to configuring it using setup.cfg.
For additional information on related topics, take a look at the following resources:
By Leodanis Pozo Ramos • Updated Dec. 17, 2025