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], the automatic
version detection may not work out-of-box because of the lack of
.git directory during packaging. There are several possible solutions:

[1] https://backend.pdm-project.org/metadata/#dynamic-project-version

* * *

1. If you are building the package using dh-python (>= 6.20240603):

The dynamic version support is provided out-of-the-box using Debian's
upstream version string, $(DEB_VERSION_UPSTREAM). You do not need to
do anything.

* * *

2. If you are using an older dh-python to build the package:

Please consider using environment variable in debian/rules file
to pass the version string instead:

```makefile
include /usr/share/dpkg/pkg-info.mk
export PDM_BUILD_SCM_VERSION = $(DEB_VERSION_UPSTREAM)
```

This will work when $(DEB_VERSION_UPSTREAM) is a reasonable value (e.g.,
using X.Y.Z format). Packages with repacked version string may need
more sophisticated handling.

 -- Boyuan Yang <byang@debian.org>  Fri, 01 Nov 2024 00:45:40 -0400
