diff options
Diffstat (limited to 'doc/index.rst')
-rw-r--r-- | doc/index.rst | 65 |
1 files changed, 55 insertions, 10 deletions
diff --git a/doc/index.rst b/doc/index.rst index fc8ba9d..dceb265 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -6,7 +6,7 @@ python-semanticversion ====================== -This small python library provides a few tools to handle `SemVer <http://semver.org>`_ in Python. +This small python library provides a few tools to handle `SemVer`_ in Python. The first release (1.0.0) should handle the 2.0.0-rc1 version of the SemVer scheme. @@ -15,6 +15,15 @@ The first release (1.0.0) should handle the 2.0.0-rc1 version of the SemVer sche Getting started =============== +Intall the package from `PyPI`_, using pip:: + + pip install python-semanticversion + + +Import it in your code:: + + import semantic_version + .. currentmodule:: semantic_version This module provides two classes to handle semantic versions: @@ -22,6 +31,8 @@ This module provides two classes to handle semantic versions: - :class:`Version` represents a version number (``0.1.1-alpha+build.2012-05-15``) - :class:`Spec` represents a requirement specification (``>=0.1.1``) +Versions +-------- Defining a :class:`Version` is quite simple:: @@ -67,23 +78,57 @@ Obviously, :class:`Versions <Version>` can be compared:: >>> semantic_version.Version('0.1.1') <= semantic_version.Version('0.1.1-alpha') False -Links -===== -- Package on `PyPI <http://pypi.python.org/>`_: http://pypi.python.org/semantic_version/ -- Doc on `ReadTheDocs <http://readthedocs.org/>`_: http://readthedocs.org/docs/python-semanticversion/ -- Source on `GitHub <http://github.com/>`_: http://github.com/rbarrois/python-semanticversion/ -- Build on `Travis CI <http://travis-ci.org/>`_: http://travis-ci.org/rbarrois/python-semanticversion/ -- Semantic Version specification: http://semver.org/ +Requirement specification +------------------------- + +The :class:`Spec` object describes a range of accepted versions:: + + >>> s = Spec('>=0.1.1') # At least 0.1.1 + >>> s.match(Version('0.1.1')) + True + >>> s.match(Version('0.1.1-alpha1')) + False -Contents: +It is also possible to define 'approximate' version specifications:: + + >>> s = Spec('~0.1') # Matches 0.1.* + >>> s.match(Version('0.1.0-alpha1')) + True + >>> s.match(Version('0.1.9999999999+build99')) + True + >>> s.match(Version('0.2.0')) + False + +Simpler test syntax is also available using the ``in`` keyword:: + + >>> s = Spec('~0.1.1') + >>> Version('0.1.1-alpha1') in s + True + >>> Version('0.1.2') in s + False + + +Contents +======== .. toctree:: :maxdepth: 2 - django reference + django + +Links +===== + +- Package on `PyPI`_: http://pypi.python.org/semantic_version/ +- Doc on `ReadTheDocs <http://readthedocs.org/>`_: http://readthedocs.org/docs/python-semanticversion/ +- Source on `GitHub <http://github.com/>`_: http://github.com/rbarrois/python-semanticversion/ +- Build on `Travis CI <http://travis-ci.org/>`_: http://travis-ci.org/rbarrois/python-semanticversion/ +- Semantic Version specification: `SemVer`_ +.. _SemVer: http://semver.org/ +.. _PyPI: http://pypi.python.org/ Indices and tables |