Releases: rkohl/python-versioning
Releases · rkohl/python-versioning
v1.1.0
Added
-
Version.increment(part: str)— Bump a version component in place. The incremented version is appended to the tracked list and becomes the current version. Accepts one of four exported constants:Constant Behaviour MAJORIncrements major, resets minor and patch to 0, clears pre-release and buildMINORIncrements minor, resets patch to 0, clears pre-release and buildPATCHIncrements patch, clears pre-release and build BUILDIncrements build metadata; defaults to +b1if none is set. Preserves pre-release.Build increment rules:
- No build set →
+b1 - Last identifier ends in digits (e.g.
b3,build.5) → trailing number is incremented - Last identifier is a plain integer → incremented directly
- Last identifier has no trailing digits →
.1is appended
- No build set →
Changed
-
latestproperty now returns astrinstead of aVersionobject, consistent with how version strings are handled throughout the API. -
versionsproperty now returns all tracked versions sorted highest first (descending), making it easier to iterate from newest to oldest. -
add()method now updates the current version when the newly added version is higher than the current one.
Internals
- Replaced the hand-rolled
_Comparablemixin withfunctools.total_ordering, reducing boilerplate and delegating operator derivation to the standard library. - Merged
_checkand_set_versioninto a single_parsemethod, removing a layer of indirection. - Simplified
_Seq.__lt__by removing runtimeassertstatements and tightening the loop logic. __str__uses an f-string for themajor.minor.patchsegment instead of joining a list.__eq__compares a single tuple on each side instead of three separate conditions.