From 870060605e3955114766a979de1afadbea4dc603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Sat, 24 Aug 2019 14:57:46 +0200 Subject: Deprecate support for 'partial' versions. Their comparison semantics were ill-defined, and mostly an implementation detail for the old, 'native' specs. --- semantic_version/base.py | 6 ++++++ semantic_version/django_fields.py | 7 +++++++ 2 files changed, 13 insertions(+) (limited to 'semantic_version') 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) -- cgit v1.2.1