I would like to analyze the dependency tree of Python packages. How can I obtain this data?
Things I already know
setup.py
sometimes contains a requires
field that lists package dependenciesThings that I don't know
requires
field but pip/easy_install
still manage to download the correct packages. What am I missing? For example the popular library for statistical computing, pandas
, doesn't list requires
but still manages to install numpy
, pytz
, etc.... Is there a better way to automatically collect the full list of dependencies?You should be looking at the install_requires
field instead, see New and changed setup
keywords.
requires
is deemed too vague a field to rely on for dependency installation. In addition, there are setup_requires
and test_requires
fields for dependencies required for setup.py
and for running tests.
Certainly, the dependency graph has been analyzed before; from this blog article by Olivier Girardot comes this fantastic image:
The image is linked to the interactive version of the graph.