Skip to content

Build Configuration#

pdm uses the PEP 517 to build the package. It acts as a build frontend that calls the build backend to build the package.

A build backend is what drives the build system to build source distributions and wheels from arbitrary source trees.

If you run pdm init, PDM will let you choose the build backend to use. Unlike other package managers, PDM does not force you to use a specific build backend. You can choose the one you like. Here is a list of build backends and corresponding configurations initially supported by PDM:

pyproject.toml configuration:

1
2
3
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

📖 Read the docs

pyproject.toml configuration:

1
2
3
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

📖 Read the docs

pyproject.toml configuration:

1
2
3
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

📖 Read the docs

pyproject.toml configuration:

1
2
3
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

📖 Read the docs

pyproject.toml configuration:

1
2
3
[build-system]
requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"

📖 Read the docs

Apart from the above mentioned backends, you can also use any other backend that supports PEP 621, however, poetry-core is not supported because it does not support reading PEP 621 metadata.

Info

If you are using a custom build backend that is not in the above list, PDM will handle the relative paths as PDM-style(${PROJECT_ROOT} variable).