Handling Debian Python packages with pdm-backend backend -------------------------------------------------------- If you are preparing Python packages that use pdm-backend as build backend as well as its Dynamic Version feature [1] with `source = "scm"`, the automatic version detection may not work out-of-box because of the lack of .git directory during packaging. pdm-backend then takes the version from the environment variable PDM_BUILD_SCM_VERSION instead. [1] https://backend.pdm-project.org/metadata/#dynamic-project-version * * * 1. Automatic handling by dh-python When the package is built with pybuild and one of the Build-Depends* fields lists python3-pdm-backend, pybuild sets PDM_BUILD_SCM_VERSION to the version in debian/changelog with the epoch and the Debian revision removed and the first "~" replaced by "-". You do not need to do anything. Repack suffixes are kept: 1.2.3+dfsg-1 gives the Python version "1.2.3+dfsg". pybuild does not override a value that is already set. * * * 2. Setting the version yourself If the upstream version contains a repack suffix, or the package does not Build-Depend on python3-pdm-backend directly, set the variable in debian/rules, for example: ```makefile include /usr/share/dpkg/pkg-info.mk export PDM_BUILD_SCM_VERSION = $(DEB_VERSION_UPSTREAM:%+dfsg=%) ``` The variable applies to every pdm-backend build in that environment, including projects that the test suite builds. If such tests expect a version read from git, set it for dh_auto_build only, as the debian/rules of pdm-backend itself does. The "file" and "call" version sources do not use this variable. -- Boyuan Yang Wed, 07 Oct 2026 13:14:11 -0400