distutils.version /

Filename Size Date modified Message
8 B
1.5 KB
3.7 KB
10.2 KB

``verlib`` provides a version managment system.

The pseudo-format supported is::


XXX explain why it's better than setuptools, from debian/red-hat PoV

XXX explain here in details (no code example)
XXX give tons of examples


The `RationalVersion` class is used to hold a version and to compare it with
others. It takes a string as an argument, that contains the representation of
the version::

    >>> from verlib import RationalVersion
    >>> version = RationalVersion('1.0')

The version can be represented as a string::

    >>> str(version)

Or compared with others::

    >>> RationalVersion('1.0') > RationalVersion('0.9')
    >>> RationalVersion('1.0') < RationalVersion('1.1')

A class method called ``from_parts`` is available if you want to create an
instance by providing the parts that composes the version.

Each part is a tuple and there are three parts:

- the main version part
- the pre-release part
- the `devpost` marker part

Examples ::

    >>> version = RationalVersion.from_parts((1, 0))
    >>> str(version)

    >>> version = RationalVersion.from_parts((1, 0), ('c', 4))
    >>> str(version)

    >>> version = RationalVersion.from_parts((1, 0), ('c', 4), ('dev', 34))
    >>> str(version)


XXX explain here suggest_rational_version