Finding reverse dependencies of a package on PyPI

Viewed 52

I would like to find which packages on PyPI depend on a specific package. This is easy to do on package indexes for other languages. For example:

  • CRAN has "reverse depends" and "reverse imports" sections
  • CPAN has an entire "Reverse dependencies" page

Is this possible on PyPI?

4 Answers

PyPI does not track dependencies in any way. Dependencies are normally resolved by the installer (e.g. pip) dynamically by actually retrieving the packages.

Some third parties do attempt to collect this information, such as libraries.io which provides a "used by" summary. For projects mutually available on GitHub.com, GitHub may also provide information on a project's dependents.

A big difference between PyPI repository packages and, say, CRAN is that packages are not required to explicitly declare their dependencies as package metadata, which would make reverse-lookups trivial. Unfortunately, due to the method/flexibility PyPI packages have in declaring dependencies, this is not possible/practical for PyPI.

This answer suggests that it's not really possible, due to the fact that it's possible to add dependencies dynamically. Any results you would get would be partial.

Related