Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

API-s don't return "requires_dist" for most packages #622

Closed
aivarannamaa opened this issue Mar 28, 2017 · 3 comments
Closed

API-s don't return "requires_dist" for most packages #622

aivarannamaa opened this issue Mar 28, 2017 · 3 comments

Comments

@aivarannamaa
Copy link

I'm writing a simple pip GUI, which is supposed to show information about packages available at PyPI. Among this information I would like to list the required packages.

While browsing API result of one of my own packages (https://pypi.python.org/pypi/thonny/2.0.7/json) I got the impression that requirements are given under key "dist_requires".

To my surprise, most packages I tried (and which do have dependencies), don't have this key in their API result. Examples:

Same thing with XML-RPC

I inspected setup.py of Sphinx (https://github.com/sphinx-doc/sphinx/blob/master/setup.py) and it uses setuptools and install_requires, just like Thonny (https://bitbucket.org/plas/thonny/src/b9e4c19f02367341827777780834e9eefbdd2265/setup.py?at=master&fileviewer=file-view-default).

I can't see why is requires_dist missing from Sphinx's API output.

@aivarannamaa
Copy link
Author

I now noticed that XML-RPC with ServerProxy('https://pypi.org/pypi') does give dist_requires for Sphinx but it's empty list.

@jamadden
Copy link
Collaborator

jamadden commented Jun 2, 2017

I suspect you'll find that the difference is whether the project uploads binary wheels (and whether they upload the binary wheel first if they upload wheels and sdists). PyPI appears to only extract this extra metadata from a wheel, and only if a wheel is the first artifact uploaded for a release (I haven't checked the code for that, but that's my experience). This is part of the reason why tools like twine upload wheels first.

@di
Copy link
Member

di commented Apr 4, 2018

Regarding the missing field, I'd recommend pointing your pip GUI at pypi.org instead, where the requires_dist field will always be present even if empty (see our migration guide here).

Regarding why the requires_dist field is sometimes empty, I'm closing as this is expected behavior. For more background on why, see https://di.codes/articles/2018/03/05/why-pypi-doesnt-know-dependencies

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants