diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-24 14:57:46 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-26 21:37:10 +0200 |
commit | 870060605e3955114766a979de1afadbea4dc603 (patch) | |
tree | 87c6a0e3656ad0eb3758f2b14cfceadde689188b /semantic_version | |
parent | 5c1abbef4d86bcd1ec68cf5deb90b559faf25502 (diff) | |
download | semantic-version-870060605e3955114766a979de1afadbea4dc603.tar.gz |
Deprecate support for 'partial' versions.rba/pre-2.8
Their comparison semantics were ill-defined, and mostly an
implementation detail for the old, 'native' specs.
Diffstat (limited to 'semantic_version')
-rw-r--r-- | semantic_version/base.py | 6 | ||||
-rw-r--r-- | semantic_version/django_fields.py | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/semantic_version/base.py b/semantic_version/base.py index 0e036ae..fb8205c 100644 --- a/semantic_version/base.py +++ b/semantic_version/base.py @@ -91,6 +91,12 @@ class Version: prerelease=None, build=None, partial=False): + if partial: + warnings.warn( + "Partial versions will be removed in 3.0; use SimpleSpec('1.x.x') instead.", + DeprecationWarning, + stacklevel=2, + ) has_text = version_string is not None has_parts = not (major is minor is patch is prerelease is build is None) if not has_text ^ has_parts: diff --git a/semantic_version/django_fields.py b/semantic_version/django_fields.py index 1af5bf5..db7e606 100644 --- a/semantic_version/django_fields.py +++ b/semantic_version/django_fields.py @@ -2,6 +2,7 @@ # Copyright (c) The python-semanticversion project # This code is distributed under the two-clause BSD License. +import warnings from django.db import models from django.utils.translation import ugettext_lazy as _ @@ -46,6 +47,12 @@ class VersionField(SemVerField): def __init__(self, *args, **kwargs): self.partial = kwargs.pop('partial', False) + if self.partial: + warnings.warn( + "Use of `partial=True` will be removed in 3.0.", + DeprecationWarning, + stacklevel=2, + ) self.coerce = kwargs.pop('coerce', False) super().__init__(*args, **kwargs) |