The uv build back end is now stable
10 months ago
- #build-backend
- #python
- #uv
- The uv build backend is currently the default for uv init, but will replace hatchling in future versions.
- uv supports all PEP 517-compliant build backends and provides its own (uv_build) for better performance and UX.
- The uv build backend is ideal for most Python projects, offering zero-config defaults and tight integration with uv.
- It validates project metadata, prevents common mistakes, and is very fast, but only supports pure Python code.
- To use uv as a build backend, add uv_build to the [build-system] section in pyproject.toml.
- For new projects, use uv init to set up the uv build backend.
- The uv executable includes a bundled build backend, but external frontends like python -m build use the uv_build package.
- Python modules default to src/<package_name>/__init__.py, with name normalization (e.g., Foo-Bar → foo_bar).
- Namespace packages use dots in module-name (e.g., foo.bar) and omit __init__.py in shared namespaces.
- Type stub packages use -stubs suffix (e.g., foo-stubs) and __init__.pyi files.
- File inclusion/exclusion follows anchored patterns for includes and non-anchored for excludes, with defaults like excluding __pycache__.