3

From this answer, I am able to get the dependencies of a package. However I am looking for a solution that does not require you to download and install the package.

Is this possible?

Edit: I meant getting the package dependencies from PyPI. I want to get the package dependencies from a PyPI package, but my only solution requires me to install the package, which is not what I want. Is it possible to get the package dependencies from PyPI?

sybrg
  • 199
  • 7
  • how would that work? you have the package on an hard-drive? – Je Je Sep 15 '20 at 00:51
  • Whoops! I edited the post- I want the package dependencies from PyPi. – sybrg Sep 15 '20 at 00:55
  • which package are you trying to install? – Je Je Sep 15 '20 at 01:03
  • I'm trying to make a program which will spit out the dependencies of a package (without installing the package), and I'm using flask as a test to get it's dependencies. – sybrg Sep 15 '20 at 01:13
  • I havent tried but seems to be what you want: https://stackoverflow.com/questions/11147667/is-there-a-way-to-list-pip-dependencies-requirements – Je Je Sep 15 '20 at 01:41
  • Well that's useful- but I would like to incorporate it with my python script and I probably want a method that doesn't use pip. But I'll keep it in mind. – sybrg Sep 15 '20 at 01:59
  • 1
    [JSON PyPi API](https://stackoverflow.com/a/41886445/7976758), found in https://stackoverflow.com/search?q=%5Bpypi%5D+API+dependencies. Docs: https://warehouse.pypa.io/api-reference/json/ – phd Sep 15 '20 at 09:30

1 Answers1

2

As far as I know, in many cases PyPI won't be able to deliver reliable info about the dependencies for a distribution. For example, for source distributions the list of dependencies is somewhat dynamic, and the only way to get a definitive static list of dependencies is to build the distribution (run the setup.py). Meaning that in some cases there is no way around downloading and building the distributions locally (with the correct Python interpreter). No need to install them though.


Note:

I believe johnnydep is a tool that does exactly that. But it doesn't answer your question as you are probably looking for a library or an API.

sinoroc
  • 18,409
  • 2
  • 39
  • 70