summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2022-05-26 15:28:23 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2022-05-26 15:34:45 +0200
commit57c78e7307792879dce33734c11e7774383b9d36 (patch)
treecef730ce8d6f5af904b0a4ad261cc937ea78e69d /docs
parent7dcc42d2a828adbbeb6f8a23cdca40a3c61782bc (diff)
downloadsemantic-version-57c78e7307792879dce33734c11e7774383b9d36.tar.gz
Guarantee a stable ordering with build metadata
Sorting any permutation of Version objects should always yield the same result, even if those hold some build metadata. To that end, the "precedence_key" is now used exclusively for sorting; direct comparisons between Version objects still ignores the "build" metadata, using a different precedence key. For performance improvements, both precedence keys are cached. Closes: #132
Diffstat (limited to 'docs')
-rw-r--r--docs/reference.rst11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/reference.rst b/docs/reference.rst
index 6d1101b..b2946d9 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -130,7 +130,16 @@ Representing a version (the Version class)
The actual value of the attribute is considered an implementation detail; the only
guarantee is that ordering versions by their precedence_key will comply with semver precedence rules.
- Note that the :attr:`~Version.build` isn't included in the precedence_key computatin.
+
+ .. warning::
+
+ .. versionchanged:: 2.10.0
+
+ The :attr:`~Version.build` is included in the precedence_key computation, but
+ only for ordering stability.
+ The only guarantee is that, for a given release of python-semanticversion, two versions'
+ :attr:`~Version.precedence_key` will always compare in the same direction if they include
+ build metadata; that ordering is an implementation detail and shouldn't be relied upon.
.. attribute:: partial