Make comparing version strings super simple.
If you want codes using your package to be able to verify its version as easily as:
# user_code.py
import my_package
assert my_package.__version__ >= "1.1"Just customize your package as follows:
# my_package/__init__.py
import verstr
__version__ = verstr.verstr("1.2.4")or if you are using a tool such as setuptools_scm to generate a _version.py submodule:
# my_package/__init__.py
import verstr
try:
from . import _version
__version__ = verstr.verstr(_version.version)
except ImportError:
__version__ = NoneInstall verstr with pip
pip install verstrYou are welcome to help the project, see how.