# build: Python Package Build Frontend

build is a [PEP 517-compliant](https://pydevtools.com/handbook/explanation/what-is-pep-517.md) Python package builder developed by the [Python Packaging Authority (PyPA)](https://pydevtools.com/handbook/explanation/what-is-pypa.md). It provides a standardized interface for building Python packages using any compliant [build backend](https://pydevtools.com/handbook/explanation/what-is-a-build-backend.md), serving as a simple frontend tool that executes the build process defined by backends like [setuptools](https://pydevtools.com/handbook/reference/setuptools.md), [flit](https://pydevtools.com/handbook/reference/flit.md), or [hatchling](https://pydevtools.com/handbook/reference/hatch.md).


## Core Functionality

### Build Operations
- Source Distributions: Creates [sdist](https://pydevtools.com/handbook/reference/sdist.md) packages containing source code
- Binary Distributions: Builds [wheel packages](https://pydevtools.com/handbook/reference/wheel.md) for direct installation
- Backend Compatibility: Works with any [PEP 517-compatible](https://pydevtools.com/handbook/explanation/what-is-pep-517.md) build backend
- Isolated Builds: Manages build dependencies in separate environments
- Cross-Platform Support: Functions consistently across operating systems

### Command Interface
```bash
# Build both wheel and sdist
python -m build

# Build only a wheel
python -m build --wheel

# Build only a source distribution
python -m build --sdist

# Build in a specified directory
python -m build /path/to/project

# Build with specific Python interpreter
python -m build --python-executable /path/to/python
```

## Technical Design

build operates using a straightforward process flow:

1. Identifies the build backend from the project's [pyproject.toml](https://pydevtools.com/handbook/reference/pyproject.toml.md)
2. Creates an isolated environment for build dependencies
3. Installs the specified build requirements
4. Invokes the backend's build hooks defined in [PEP 517](https://pydevtools.com/handbook/explanation/what-is-pep-517.md)
5. Places built distributions in the `dist/` directory

## Configuration

build requires minimal configuration, as it delegates most settings to the build backend:

```toml
# Required pyproject.toml configuration
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
```

## Pros

- Standard Compliance: Fully implements [PEP 517/518](https://pydevtools.com/handbook/explanation/what-is-pep-517.md) specifications
- Tool Agnostic: Works with any compliant build backend
- Simple Interface: Minimal learning curve for basic usage
- Official PyPA Tool: Maintained by the Python Packaging Authority
- Isolation: Prevents contamination from the development environment

## Cons

- Limited Features: Focused solely on building, not installing or publishing
- Requires Configuration: Needs a properly configured [pyproject.toml](https://pydevtools.com/handbook/reference/pyproject.toml.md)
- No Direct Publishing: Requires additional tools (like [twine](https://pydevtools.com/handbook/reference/twine.md)) for [PyPI](https://pydevtools.com/handbook/explanation/what-is-pypi.md) uploads
- Minimal Interface: Lacks advanced customization options

## Learn More

- [build Documentation](https://pypa-build.readthedocs.io/)
- [PEP 517 - Build System Interface](https://peps.python.org/pep-0517/)
- [Python Packaging User Guide](https://packaging.python.org/)
- [PyPA GitHub Repository](https://github.com/pypa/build)
