I’m writing a little PEP-517-compliant build tool, essentially a wrapper around setuptools’ build_meta, that (say) inserts
from rich import print
at the beginning of each .py file in the project. I will need to inject the extra dependency rich when building the wheels. Is there a PEP-517 way to do that?
I could certainly hard-edit *.dist-info/METADATA that comes out of setuptools and insert an extra Requires-Dist line, but perhaps there’s a better way. If I understand correctly, the function get_requires_for_build_wheel is only for build-time dependencies, right?
If I am not mistaken, all the hooks in PEP 517 are for build-time only.
After the package has been turned into a wheel, the installer will (ideally) check the dependencies in the METADATA file.
I am afraid that is the only way the extra dependency would currently work.
(Please also notice that in case of setuptools there is an extra quirk: sdists still use the legacy egg format and store their dependencies in the *.egg-info/requires.txt file, not in PKG-INFO)