AwesomeVersion
AwesomeVersion is a Python library designed to parse, compare, and manage various version formats, acting as a universal solution for version string manipulation. It allows making anything a version object and comparing it against a wide range of other version formats. The library is actively maintained with frequent releases, often multiple times a month, providing continuous improvements and new features.
Warnings
- breaking Support for Python 3.8 was officially removed. Projects using AwesomeVersion 25.5.0 or newer must run on Python 3.9 or later.
- breaking The use of positional arguments when creating an `AwesomeVersion` object was deprecated in version 22.8.0 and completely removed in version 24.6.0. Attempting to use positional arguments will now raise an error.
- breaking The `AwesomeVersion.ensure_strategy` method was deprecated and subsequently removed in version 22.6.0. Direct calls to this method will no longer work.
- gotcha When using `find_first_match` without explicitly setting an `ensure_strategy` in the `AwesomeVersion` constructor, the library attempts to auto-detect the version strategy. This implicit behavior can lead to unexpected parsing if the auto-detected strategy doesn't match your expectation, making it a potential footgun for robust version parsing. Warnings regarding this behavior were added in 22.8.0 and clarified in 24.6.0.
Install
-
pip install awesomeversion
Imports
- AwesomeVersion
from awesomeversion import AwesomeVersion
Quickstart
from awesomeversion import AwesomeVersion
# Basic comparison
current = AwesomeVersion("1.2.2")
upstream = AwesomeVersion("1.2.3")
print(f"Is upstream newer than current? {upstream > current}")
# Version with a pre-release tag
version_beta = AwesomeVersion("1.2.3b0")
print(f"Is version_beta a beta release? {version_beta.beta}")
# Check if a version is within a range
range_check = AwesomeVersion("1.5.0").in_range("1.0.0", "2.0.0")
print(f"Is 1.5.0 in range 1.0.0-2.0.0? {range_check}")