Painlessly handle software version information.
smartversion is a library for handling version numbers. It can parse a wide variety of real-world version strings and is fully compatible with Semver 2.0.0. (PEP440 coming soon.)
smartversion is like a combination of LooseVersion from distutils and parse_version from setuptools. It was written to handle various real-world version strings that LooseVersion cannot. smartversion also does age-based comparisons based on a release date and comes with an extremely long-winded test suite.
Above all, smartversion aims to be useful. It's in the category of libraries that abstract lots of messy, real-world cases into a clean interface.
This was originally written to help with network security auditing, because version data is messy and very annoying. But it has applications beyond that, hence the separate library.
- Parses an enormous range of version formats (lots of 'in-the-wild')
- Fully compatible with Semver 2.0.0
- Python 2.7, 3+
- Version objects compare properly (==, !=, <, ...) - ... and obey Semver and (soon) PEP404 comparison rules as appropriate
- No extra-stdlib dependencies to install
- Not only parses version numbers, but handles packages that put annoying shit between the package name and the version number. And gracefully. - If you doubt, read the test suite.
- Wildcards for comparison
- Version age comparison (based on release date)
- Human-friendly age comparison ('2 years, 3 months' / '2y3m')
- Reasonably quick
- Extensive test suite
- Full PEP440 support
- Full unicode support
- i18n
TODO coming soon
To install smartversion:
$ pip install smartversion
Coming soon (:S). For now, refer to this document and the test suite.
- API isn't 100% stable yet (until 1.0.0)
- When parsing real-world version strings, parsed data needs to be more granular if the version string doesn't exactly match Semver or PEP440
- The parser isn't deterministic. That is, it can't tell you whether the string you're parsing matches some grammar, because there is no grammar. Instead the goal is "parse everything that could possibly be parsed as a version and do what you want."
- Age calculation code has no psychic powers. If you want to calculate the age of a software version, you have to supply the release date yourself (sorry).
- No i18n support (for now).