From a5cc0fb509b2c515ae73c85f9a4d426a3f9100e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Sun, 18 Aug 2019 17:41:33 +0200 Subject: Allow Version(major=1, ...). Eases the creation of version objects from existing versions. We still validate the type and structure of each component. --- README.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'README.rst') diff --git a/README.rst b/README.rst index 682a8c7..ac42f72 100644 --- a/README.rst +++ b/README.rst @@ -149,6 +149,22 @@ It is also possible to check whether a given string is a proper semantic version False +Finally, one may create a :class:`Version` with named components instead: + +.. code-block:: pycon + + >>> semantic_version.Version(major=0, minor=1, patch=2) + Version('0.1.2') + +In that case, ``major``, ``minor`` and ``patch`` are mandatory, and must be integers. +``prerelease`` and ``patch``, if provided, must be tuples of strings: + +.. code-block:: pycon + + >>> semantic_version.Version(major=0, minor=1, patch=2, prerelease=('alpha', '2')) + Version('0.1.2-alpha.2') + + Requirement specification ------------------------- -- cgit v1.2.1