Is there a way to get a list of dependencies for a given python package without installing it first?
I can currently get a list of requirements, but it requires installing the packages. For example, I can use pip to show basic requirements info, but it doesn't include version information:
$ pip show pytest
Name: pytest
Version: 3.0.6
...
Requires: colorama, setuptools, py
I've tried a library called pipdeptree
that includes much better output on requirements, but it also requires installation of the packages
$ pipdeptree -p pytest
pytest==3.0.6
- colorama [required: Any, installed: 0.3.7]
- py [required: >=1.4.29, installed: 1.4.32]
- setuptools [required: Any, installed: 34.0.0]
- appdirs [required: >=1.4.0, installed: 1.4.0]
...
Ideally, I would get the level of detail that pipdeptree
provides. Also, being able to produce a requirements.txt
file from a python wheel
or from pypi with pip
would suffice as well.
I'm interested in the dependency constraints for a given package, not the final downloaded packages after resolving the dependency requirements. For example, I don't really care that pip downloaded package-2.3.4
, I would rather know that package>=2.1
was a requirement.