summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2019-08-23 23:24:50 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2019-08-26 21:34:10 +0200
commitc4c6ab0e925d8cfabb68d34a10a783cb854b63a0 (patch)
tree84895b9dd586594c380668875ede00ba4b8a928a /docs
parent5b9174aedaf9843ee5b3b6358461910e328e74d1 (diff)
downloadsemantic-version-c4c6ab0e925d8cfabb68d34a10a783cb854b63a0.tar.gz
Add support for NPM-style version ranges.
The code follows closely the specification available at https://docs.npmjs.com/misc/semver.html. Despite similarities, the matching logic is fully separate from the `native` code, since both might evolve at their own scales.
Diffstat (limited to 'docs')
-rw-r--r--docs/reference.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/reference.rst b/docs/reference.rst
index 8caa30b..feaffcf 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -512,6 +512,22 @@ rules apply:
:rtype: ``(*spec)`` tuple
+.. class:: NpmSpec(spec_string)
+
+ .. versionadded:: 2.8
+
+ A NPM-compliant version matching engine, based on the https://docs.npmjs.com/misc/semver.html specification.
+
+ .. code-block:: pycon
+
+ >>> Version('0.1.2') in NpmSpec('0.1.0-alpha.2 .. 0.2.4')
+ True
+ >>> Version('0.1.2') in NpmSpec('>=0.1.1 <0.1.3 || 2.x')
+ True
+ >>> Version('2.3.4') in NpmSpec('>=0.1.1 <0.1.3 || 2.x')
+ True
+
+
.. class:: SpecItem(spec_string)
.. note:: This class belong to the private python-semanticversion API.