Because of some custom logging I would like to get the version number from a wheel file.
I could of course just parse the filename, but my guess is there would be a better way to do this.
whl file can be extracted using unzip or by right clicking on the file and extracting using the Extract Here graphical interface in Ubuntu/Debian systems. After extracting, one can inspect the source code of . py files and the contents of metadata files which will be located in library-name-with-version.
Store version string for use during install You could make a version.py in your package with a __version__ line, then read it from setup.py using execfile('mypackage/version.py') , so that it sets __version__ in the setup.py namespace.
A Python . whl file is essentially a ZIP ( . zip ) archive with a specially crafted filename that tells installers what Python versions and platforms the wheel will support. A wheel is a type of built distribution.
You can also use pkginfo e.g.
from pkginfo import Wheel
w = Wheel(r'C:\path\to\package.whl')
print(w.version)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With