Skip to content

Commit 2d0cd7f

Browse files
committed
add packaging version validation to release flow
1 parent 0ab0f5b commit 2d0cd7f

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

justfile

+9-4
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,15 @@ validate_version VERSION:
212212
import re
213213
import tomllib
214214
import django_enum
215-
version = re.match(r"v?(\d+[.]\d+[.]\w+)", "{{ VERSION }}").groups()[0]
216-
assert version == tomllib.load(open('pyproject.toml', 'rb'))['project']['version']
217-
assert version == django_enum.__version__
218-
print(version)
215+
from packaging.version import Version
216+
raw_version = "{{ VERSION }}".lstrip("v")
217+
version_obj = Version(raw_version)
218+
# the version should be normalized
219+
assert str(version_obj) == raw_version
220+
# make sure all places the version appears agree
221+
assert raw_version == tomllib.load(open('pyproject.toml', 'rb'))['project']['version']
222+
assert raw_version == django_enum.__version__
223+
print(raw_version)
219224

220225
# issue a relase for the given semver string (e.g. 2.1.0)
221226
release VERSION:

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ packages = ["src/django_enum"]
6060

6161

6262
[project.optional-dependencies]
63-
properties = ["enum-properties>=2.0.0"]
63+
properties = ["enum-properties>=2.2.0"]
6464
filters = ["django-filter>=21"]
6565
rest = ["djangorestframework>=3.9,<4.0"]
6666

@@ -86,6 +86,7 @@ dev = [
8686
"matplotlib>=3.9.4",
8787
"mypy>=1.15.0",
8888
"numpy>=2.0.2",
89+
"packaging>=24.2",
8990
"pre-commit>=4.1.0",
9091
"pytest>=8.3.4",
9192
"pytest-cov>=6.0.0",

uv.lock

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)