#1138602 dh-python: get minimum Python version from requires-python in pyproject.toml

#1138602#5
Date:
2026-06-01 03:01:57 UTC
From:
To:
Hey.

It would be nice if dh-python could automatically get the minimum
required Python version from the requires-python field in
pyproject.toml (if that is used for building) and use it for versioned
 Depends:.

I know there's X-Python3-Version and also DEBPYTHON3_SUPPORTED and
DEBPYTHON3_DEFAULT (but TBH I don't know the difference between them
and which one should be used - the documentation is very sparse on
that).

Thanks,
Philippe.

#1138602#10
Date:
2026-06-01 05:09:29 UTC
From:
To:
Hi Philippe

 > It would be nice if dh-python could automatically get the minimum
 > required Python version from the requires-python field in
 > pyproject.toml (if that is used for building) and use it for versioned
 > Depends:.

If a versioned dependency on Python is needed, it usually needs to be in
place before building the package (it would often result in FTBFS with
the incompatible Python version) - it therefore needs to be in the
Build-Depends, not the Depends field.

(As a general rule, we also want to avoid such dependencies as much as
possible because they make Python interpreter transitions harder.)

regards
Stuart

#1138602#15
Date:
2026-06-01 12:12:31 UTC
From:
To:
Hey Stuart.

May I ask why this is the case? I mean is the actual Python code
executed during the build?
In my case, the Python code I'm packaging is simply using some newer
language features, so I wanted a way that people that potentially
build and/or install the package see early hat it won't work with
their stone-aged Python interpreter. ;-)

Thanks,
Philippe