PDM Build Backend

2.4.8 · active · verified Wed Apr 08

pdm-backend is the PEP 517 compliant build backend utilized by PDM, a modern Python package manager. It supports the latest packaging standards for building source distributions (sdist) and wheels, including dynamic versioning from SCM, flexible metadata definition in pyproject.toml, and handling of various project layouts. The current version is 2.4.8, with a regular release cadence to incorporate new features and bug fixes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure `pdm-backend` in a `pyproject.toml` file for a simple Python package. It defines basic project metadata and specifies `pdm-backend` as the build backend. After setting up the `pyproject.toml` and a minimal package structure, you can build your project's wheel and sdist using the `pdm build` command or the standard `python -m build` tool.

# my_project/pyproject.toml
[project]
name = "my-package"
version = "0.1.0"
dynamic = ["dependencies", "optional-dependencies"]
description = "A minimal example package"
requires-python = ">=3.9"
license = { text = "MIT" }
authors = [
    { name = "Your Name", email = "your@example.com" }
]

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

# my_project/src/my_package/__init__.py
__version__ = "0.1.0"

# To build the package (run from my_project directory):
# 1. Ensure PDM is installed: pip install pdm
# 2. Run the build command:
#    pdm build
# Or using the standard 'build' tool:
#    pip install build
#    python -m build

view raw JSON →