List dependencies of Python wheel file
As previously mentioned, .whl
files are just ZIP archives. You can just open them and poke around in the METADATA
file.
There is a tool, however, that can make this manual process a bit easier. You can use pkginfo, which can be installed with pip.
CLI usage:
$ pip install pkginfo
$ pkginfo -f requires_dist psutil-5.4.5-cp27-none-win32.whl
requires_dist: ["enum34; extra == 'enum'"]
API usage:
>>> import pkginfo
>>> wheel_fname = "psutil-5.4.5-cp27-none-win32.whl"
>>> metadata = pkginfo.get_metadata(wheel_fname)
>>> metadata.requires_dist
[u"enum34 ; extra == 'enum'"]
You can install the wheel file in a separate virtual environment and then look which all other packages are installed.
Use pip freeze
command to see all installed packages.
I just tried to unzip (not gunzip) a wheel package I had lying around. The packagename-version.dist-info/METADATA
file contains a list of Requires-Dist:
entries that contain the compiled requirements from setup.py
.