From 89f9e8e44606bc46b7f7e540c285930e03ac95a7 Mon Sep 17 00:00:00 2001 From: Antti Kaihola <13725+akaihola@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:56:12 +0200 Subject: [PATCH] ci: use packaging.version.Version in test-future.yml --- .github/workflows/test-future.yml | 6 +++--- setup.cfg | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-future.yml b/.github/workflows/test-future.yml index 4d63b1cf6..90bcd4376 100644 --- a/.github/workflows/test-future.yml +++ b/.github/workflows/test-future.yml @@ -40,10 +40,10 @@ jobs: import json import os import urllib.request - from distutils.version import LooseVersion - from importlib.metadata import version from textwrap import dedent + from packaging.version import Version + for linenum, line in enumerate(open("setup.cfg"), 1): constraint = line.strip() if constraint.startswith("black>="): @@ -57,7 +57,7 @@ jobs: 'https://pypi.org/pypi/black/json' ).read().decode() latest_version = max( - LooseVersion(s) + Version(s) for s in json.loads(response)['releases'].keys() ) diff --git a/setup.cfg b/setup.cfg index afd8cd0a5..2f1c3ccef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,6 +67,7 @@ test = flynt>=0.76 isort>=5.0.1 mypy>=0.990 + packaging pathspec # to test `gen_python_files` in `test_black_diff.py` pydocstyle pygments