Closed mmattel closed 4 months ago
Which PEP recommend this, I don't find it ?
My search of PEP say that we should REMOVE the existing __version__
: https://peps.python.org/pep-0396/#pep-rejection
This PEP say that we should do:
importlib.metadata.version("paho-mqtt")
I am in sorry, you are right, I misunderstood it... 🤦♂️
>>> from importlib.metadata import distribution
>>> dist = distribution('paho-mqtt')
>>> dist.version
'2.0.0'
Feature Description
It would be great to add a
__version__
attribute based on semver which can be queried in the code like:Note: The
__version__
attribute is recommended by Python Enhancement Proposals (PEP) and is commonly implemented across many packages.Additional Information
This would definitely help when upgrading the package when there are breaking changes as one could query the min/max version in the code and behave accordingly.