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 build and the pyproject-build script.
  • Generates both sdists and wheels and writes them to dist/ by default.
  • Supports passing backend configuration with -C/--config-setting or --config-json to 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

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.

intermediate best-practices tools

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


By Leodanis Pozo Ramos • Updated Dec. 17, 2025