I'm trying to get the version number of a specific few modules that I use. Something that I can store in a variable.
It provides a __version__ attribute. It provides the standard metadata version. Therefore it will be detected by pkg_resources or other tools that parse the package metadata (EGG-INFO and/or PKG-INFO, PEP 0345).
Use pkg_resources(part of setuptools). Anything installed from PyPI at least has a version number. No extra package/module is needed.
>>> import pkg_resources >>> pkg_resources.get_distribution("simplegist").version '0.3.2'
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