Skip to content

Releases: rkohl/python-versioning

v1.1.0

07 Jun 10:07

Choose a tag to compare

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
    MAJOR Increments major, resets minor and patch to 0, clears pre-release and build
    MINOR Increments minor, resets patch to 0, clears pre-release and build
    PATCH Increments patch, clears pre-release and build
    BUILD Increments build metadata; defaults to +b1 if 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 → .1 is appended

Changed

  • latest property now returns a str instead of a Version object, consistent with how version strings are handled throughout the API.

  • versions property 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 _Comparable mixin with functools.total_ordering, reducing boilerplate and delegating operator derivation to the standard library.
  • Merged _check and _set_version into a single _parse method, removing a layer of indirection.
  • Simplified _Seq.__lt__ by removing runtime assert statements and tightening the loop logic.
  • __str__ uses an f-string for the major.minor.patch segment instead of joining a list.
  • __eq__ compares a single tuple on each side instead of three separate conditions.

v1.0.0

18 Mar 09:27
b0fea00

Choose a tag to compare

initial release