From f825c917077e5e6a60503b019f446702c9dd25ab 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 f0cac00cb7c0..047a8cb267b1 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -100,10 +100,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, @@ -325,8 +323,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