Skip to content

Instantly share code, notes, and snippets.

@Qalthos
Last active December 21, 2015 11:19
Show Gist options
  • Save Qalthos/6298374 to your computer and use it in GitHub Desktop.
Save Qalthos/6298374 to your computer and use it in GitHub Desktop.
Get detailed dependency information from site packages.
from __future__ import print_function
from pprint import pprint as print
import pip
def get_all_package_dependencies():
"""Return dictionary of installed packages to list of package dependencies."""
return {
dist.key: [(r.key, r.specs) for r in dist.requires()]
for dist in pip.get_installed_distributions()
}
print(get_all_package_dependencies())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment