# PEP 517 build backend


Configure `build-backend = "fastws.build_backend"` in `pyproject.toml` to share `maturin`’s wheel and sdist hooks while letting `uv` install editable metadata without rebuilding Rust extensions (`prepare_metadata_for_build_editable`, `build_sdist`, and `get_requires_for_build_*` re-export `maturin`’s hooks).

## build_wheel

``` python
def build_wheel(
    wheel_directory:str | pathlib._local.Path, # Directory where the wheel is written
    config_settings:dict=None, # PEP 517 config settings forwarded to `maturin`
    metadata_directory:str | pathlib._local.Path=None, # Pre-built `.dist-info` directory, if available
)->str: # Built wheel filename
```

*Stage opted-in Cargo binaries when `[tool.fastws].native-binaries` is enabled, then build a wheel with `maturin`.*

## build_editable

``` python
def build_editable(
    wheel_directory:str | pathlib._local.Path, # Directory where the editable wheel is written
    config_settings:dict=None, # PEP 660 config settings; setting `metadata-only` skips Rust compilation
    metadata_directory:str | pathlib._local.Path=None, # Pre-built `.dist-info` directory, if available
)->str: # Built editable wheel filename
```

*Build a metadata-only editable wheel when `config_settings` sets `metadata-only`, or stage binaries and delegate to `maturin` otherwise.*

## prepare_metadata_for_build_wheel

``` python
def prepare_metadata_for_build_wheel(
    metadata_directory:str | pathlib._local.Path, # Directory where `.dist-info` metadata is written
    config_settings:dict=None, # PEP 517 config settings forwarded to `maturin`
)->str: # Name of the created `.dist-info` directory
```

*Ensure `tool.maturin.data` exists if configured, then delegate metadata preparation to `maturin`.*
