Package: dh-python
Version: 7.20260524
Severity: wishlist

Hey.

It would be nice if dh-python could automatically the optional
dependencies from the project.optional-dependencies section in
pyproject.toml (if that is used for building) and use it for Suggests
and or Recommeds:.

Now the problem is obviously that pyproject.toml doesn't differ
between Suggest/Recommends and so dh_python can't know which of the
two to use.
Maybe one could do the following (for the packages that would result
from that section:
- any dependency that is already explicitly listed in
[Pre-]Depends:/Recommends:/Suggests: is ignored (assuming that the
maintainer wants it exactly where he placed it)
- for the remaining ones one could somehow (e.g. via a dh_python)
option specify which section (primarily Recommends or Suggests, but
perhaps even [Pre-]Depends) should be used (like a default


A possible idea for the long term future might even be, to allow
specifying special comments in pyproject.toml, which could be used by
Debian-friendly upstreams to really encode in pyproject.toml what
dh_python should do with an optional dependency, e.g. something like:

[project.optional-dependencies]
foo = ["requests"]
#dh-python-section-hint=recommends:
bar = ["httpx"]
#dh-python-section-hint=suggests:
baz = ["numpy"]

In the above example, there would be no hint for requests, a
Recommends: hint for httpx, and a Suggest: hint for numpy and all
others that possibly follow (i.e. always up to the next one).

One could even allow for more fine grained overrides, like:
[project.optional-dependencies]
foo = [
          "requests",  #:dh-python-section-hint=suggests
          "httpx",  #:dh-python-section-hint=recommends
          "numpy"  #:dh-python-section-hint=suggests
         ]

of curse one would need to document which exact formats dh_python can parse.

Thanks,
Philippe.

Reply via email to