Inspired by a recent bug in pycharm, caused by bad version parsing that went undetected until matplotlib, for the first time in 20 years, published a non-pre-release version with a postfix (3.9.1.post1 on Aug 7th).
What it does
Checks for the presence of tuple(map(int, obj.__version__.split("."))) and equivalent variants thereof.
Why this is bad
This breaks if the package uses a postfix that is not convertible to integer, such as matplotlib==3.9.1.post1.
Use instead
Version string should be parsed using the PEP440 specification.
Inspired by a recent bug in pycharm, caused by bad version parsing that went undetected until
matplotlib, for the first time in 20 years, published a non-pre-release version with a postfix (3.9.1.post1on Aug 7th).What it does
Checks for the presence of
tuple(map(int, obj.__version__.split(".")))and equivalent variants thereof.Why this is bad
This breaks if the package uses a postfix that is not convertible to integer, such as
matplotlib==3.9.1.post1.Use instead
Version string should be parsed using the PEP440 specification.
packagingprovides the packaging.version utility.