From 70d670e274385b0f1d6565bad1dd85fea434c3ed Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 10 Jul 2024 20:21:56 -0400 Subject: [PATCH] Named type for parsed tool versions. --- lib/galaxy/tool_util/version_util.py | 10 ++++++++++ lib/galaxy/tools/__init__.py | 10 ++++------ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 lib/galaxy/tool_util/version_util.py diff --git a/lib/galaxy/tool_util/version_util.py b/lib/galaxy/tool_util/version_util.py new file mode 100644 index 000000000000..644d58297e4f --- /dev/null +++ b/lib/galaxy/tool_util/version_util.py @@ -0,0 +1,10 @@ +from typing import Union + +from packaging.version import Version + +from .version import LegacyVersion + +AnyVersionT = Union[LegacyVersion, Version] + + +__all__ = ["AnyVersionT"] diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index f609d48682bd..687ec7e4860c 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -109,10 +109,8 @@ from galaxy.tool_util.verify.interactor import ToolTestDescription from galaxy.tool_util.verify.parse import parse_tool_test_descriptions from galaxy.tool_util.verify.test_data import TestDataNotFoundError -from galaxy.tool_util.version import ( - LegacyVersion, - parse_version, -) +from galaxy.tool_util.version import parse_version +from galaxy.tool_util.version_util import AnyVersionT from galaxy.tools import expressions from galaxy.tools.actions import ( DefaultToolAction, @@ -341,8 +339,8 @@ class safe_update(NamedTuple): - min_version: Union[LegacyVersion, Version] - current_version: Union[LegacyVersion, Version] + min_version: AnyVersionT + current_version: AnyVersionT # Tool updates that did not change parameters in a way that requires rebuilding workflows