Source

distutils.version /

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

``verlib`` provides a version managment system.

The pseudo-format supported is::

    N.N[.N]+[abc]N[.N]+[.(dev|post)N+|(devNpostN)]

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

RationalVersion
===============

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)
    '1.0'

Or compared with others::

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

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)
    '1.0'

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

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

suggest_rational_version
========================

XXX explain here suggest_rational_version