Please add --install_requires & --setup_requires or similar option (like --requires but for "install_requires" and "setup_requires"))
See original GitHub issueI don’t know what --requires
does, but sadly it neither prints the contents “install_requires” nor of “setup_requires”.
There is a suggested workaround to this (StackOverflow) to use “egg_info” and read the requires.txt
generated in there, however, the egg_info can end up in a subdirectory if the pacakge_dir isn’t in the root (for example src/package_name.egg-info
), and the output isn’t friendly for automatic parsing to get that path, so in the end it’s just needlessly complicated as compared to a simple option that just outputs the requirements/dependencies.
Would you possibly be open to adding such an option?
Such an option would be very useful for the rare cases where such meta information could be required. If you’re curious, my specific interest is for python-for-android which repackages Python 3 programs for Android phones, and therefore sometimes needs to know dependencies to install them beforehand in a different, Android-compatible way since upstream doesn’t provide official support (e.g. patches) - so certainly not a normal use case, and I agree this option would probably not be used often, but in the rare cases it is useful it’d be quite nice to have.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
This project is working to limit the dependence on
setup.py (anything)
, mainly because with the introduction of PEP 517 and 518, it’s no longer generally meaningful to rely on invocation of setup.py for package operations.Probably your better bet will be to rely on something like importlib_metadata, which is slated for inclusion in stdlib in Python 3.8 and which is seeking to provide a higher-level interface for any installed projects (including develop-installed).
In that project, there’s an open issue to provide a high-level function for returning the dependencies (and extra dependencies) in a structured form.
In the meantime, you can use
importlib_metadata
to query for the contents of that requires.txt file:Does that help at all?
For what it’s worth, there is now a ticket here: https://github.com/pypa/packaging-problems/issues/247
Also, there’s the related one here: https://github.com/pypa/packaging-problems/issues/224
And I wrote code based on
pep517
to do this, so far not in any independent library but trivial to split out, so if anyone wants it poke me(I didn’t use
importlib_metadata
because it needs packages to be installed in all cases - pep517 doesn’t with its metadata for build wheel hook, it’s based directly on pep517,venv
and apip
call for downloading)So I’ll close this ticket here since this is not really a
setuptools
issue