question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please add --install_requires & --setup_requires or similar option (like --requires but for "install_requires" and "setup_requires"))

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jaracocommented, Dec 9, 2018

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:

>>> import importlib_metadata
>>> requires_text = importlib_metadata.read_text('mypkg', 'requires.txt')

Does that help at all?

0reactions
ghostcommented, Mar 8, 2019

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 a pip call for downloading)

So I’ll close this ticket here since this is not really a setuptools issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency conflict between 'setup_requires' and ...
I came across an error when trying to install and test my package. The error was caused by conflicting versions of transitive dependencies ......
Read more >
Dependencies Management in Setuptools
There are three types of dependency styles offered by setuptools: 1) build system requirement, 2) required dependency and 3) optional dependency. Each ...
Read more >
A Practical Guide to Using Setup.py - GoDataDriven
The key to setting up your project is the setup.py file. ... but that is far from ideal: it would require different actions...
Read more >
python setup.py install_requires - You.com | The AI Search ...
install_requires should include non-standard library requirements, and constraints on their versions (as needed). For example, this would declare minimal ...
Read more >
How to Package Python dependencies with PIP setuptools
Just like pip is the standard package manager for Python, ... You can modify install_requires by adding in platform-specific and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found