From 3963c67dd94c2ab23d3cca92646256e71ef3ac1f Mon Sep 17 00:00:00 2001 From: d-w-moore Date: Tue, 25 Nov 2025 00:52:15 -0500 Subject: [PATCH 1/5] [_698] move definition of IRODS_VERSION --- irods/__init__.py | 1 + irods/message/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/irods/__init__.py b/irods/__init__.py index 789e4a11d..83261196a 100644 --- a/irods/__init__.py +++ b/irods/__init__.py @@ -1,6 +1,7 @@ import sys minimum_compatible_python = (3, 6) +maximum_compatible_server_api = (5, 0, 2, 'd') if sys.version_info < minimum_compatible_python: to_dotted_string = lambda version_tuple: ".".join(str(_) for _ in version_tuple) diff --git a/irods/message/__init__.py b/irods/message/__init__.py index 9b8e0ec80..22e50b5d7 100644 --- a/irods/message/__init__.py +++ b/irods/message/__init__.py @@ -181,7 +181,7 @@ def ET(xml_type=(), server_version=None): logger = logging.getLogger(__name__) -IRODS_VERSION = (5, 0, 2, "d") +from .. import maximum_compatible_server_api as IRODS_VERSION UNICODE = str From b2c1e6aa82ffe48232aab5f5a322010598ddf81a Mon Sep 17 00:00:00 2001 From: d-w-moore Date: Thu, 8 Jan 2026 01:14:58 -0500 Subject: [PATCH 2/5] Revert "[_698] move definition of IRODS_VERSION" This reverts commit 3963c67dd94c2ab23d3cca92646256e71ef3ac1f. --- irods/__init__.py | 1 - irods/message/__init__.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/irods/__init__.py b/irods/__init__.py index 83261196a..789e4a11d 100644 --- a/irods/__init__.py +++ b/irods/__init__.py @@ -1,7 +1,6 @@ import sys minimum_compatible_python = (3, 6) -maximum_compatible_server_api = (5, 0, 2, 'd') if sys.version_info < minimum_compatible_python: to_dotted_string = lambda version_tuple: ".".join(str(_) for _ in version_tuple) diff --git a/irods/message/__init__.py b/irods/message/__init__.py index 22e50b5d7..9b8e0ec80 100644 --- a/irods/message/__init__.py +++ b/irods/message/__init__.py @@ -181,7 +181,7 @@ def ET(xml_type=(), server_version=None): logger = logging.getLogger(__name__) -from .. import maximum_compatible_server_api as IRODS_VERSION +IRODS_VERSION = (5, 0, 2, "d") UNICODE = str From dbf5bd841834cbcfbf6a45dc50c396ea5ee9df9d Mon Sep 17 00:00:00 2001 From: d-w-moore Date: Thu, 8 Jan 2026 01:32:51 -0500 Subject: [PATCH 3/5] prefix underline to IRODS_VERSION symbol in irods.message namespace --- irods/helpers/__init__.py | 4 ++-- irods/message/__init__.py | 6 +++--- irods/test/helpers.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/irods/helpers/__init__.py b/irods/helpers/__init__.py index 93823a110..0de7fd2c9 100644 --- a/irods/helpers/__init__.py +++ b/irods/helpers/__init__.py @@ -3,7 +3,7 @@ import sys from irods import env_filename_from_keyword_args import irods.exception as ex -from irods.message import ET, XML_Parser_Type, IRODS_VERSION +from irods.message import ET, XML_Parser_Type, _IRODS_VERSION from irods.path import iRODSPath from irods.session import iRODSSession @@ -56,7 +56,7 @@ def make_session(test_server_version=False, **kwargs): session = iRODSSession(irods_env_file=env_file, **kwargs) if test_server_version: connected_version = _get_server_version_for_test(session, curtail_length=3) - advertised_version = IRODS_VERSION[:3] + advertised_version = _IRODS_VERSION[:3] if connected_version > advertised_version: msg = ( "Connected server is {connected_version}, " diff --git a/irods/message/__init__.py b/irods/message/__init__.py index 9b8e0ec80..89da492b2 100644 --- a/irods/message/__init__.py +++ b/irods/message/__init__.py @@ -181,7 +181,7 @@ def ET(xml_type=(), server_version=None): logger = logging.getLogger(__name__) -IRODS_VERSION = (5, 0, 2, "d") +_IRODS_VERSION = (5, 0, 2, "d") UNICODE = str @@ -473,8 +473,8 @@ def __init__(self, proxy_user, client_user, application_name=""): self.connectCnt = 0 self.proxyUser, self.proxyRcatZone = proxy_user self.clientUser, self.clientRcatZone = client_user - self.relVersion = "rods{}.{}.{}".format(*IRODS_VERSION) - self.apiVersion = "{3}".format(*IRODS_VERSION) + self.relVersion = "rods{}.{}.{}".format(*_IRODS_VERSION) + self.apiVersion = "{3}".format(*_IRODS_VERSION) self.option = application_name irodsProt = IntegerProperty() diff --git a/irods/test/helpers.py b/irods/test/helpers.py index 8b92738fb..4cca53cdb 100644 --- a/irods/test/helpers.py +++ b/irods/test/helpers.py @@ -20,7 +20,7 @@ from irods.helpers import ( home_collection, make_session as _irods_helpers_make_session) -from irods.message import iRODSMessage, IRODS_VERSION +from irods.message import iRODSMessage from irods.password_obfuscation import encode import irods.rule from irods.session import iRODSSession From 1aed89deee8fd73a50c94f8afca0014d884dfaaa Mon Sep 17 00:00:00 2001 From: d-w-moore Date: Thu, 8 Jan 2026 02:14:05 -0500 Subject: [PATCH 4/5] comments to explain _IRODS_VERSION --- irods/helpers/__init__.py | 3 +++ irods/message/__init__.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/irods/helpers/__init__.py b/irods/helpers/__init__.py index 0de7fd2c9..8eb432cb1 100644 --- a/irods/helpers/__init__.py +++ b/irods/helpers/__init__.py @@ -54,6 +54,9 @@ def make_session(test_server_version=False, **kwargs): env_file = env_filename_from_keyword_args(kwargs) session = iRODSSession(irods_env_file=env_file, **kwargs) + # irods.test.helpers version of this function sets test_server_version True by default, so + # that sessions generated for the test methods will abort on connecting with a server that + # is too recent. This is a way to ensure that tests don't fail due to a server mismatch. if test_server_version: connected_version = _get_server_version_for_test(session, curtail_length=3) advertised_version = _IRODS_VERSION[:3] diff --git a/irods/message/__init__.py b/irods/message/__init__.py index 89da492b2..c0f9deb75 100644 --- a/irods/message/__init__.py +++ b/irods/message/__init__.py @@ -181,6 +181,10 @@ def ET(xml_type=(), server_version=None): logger = logging.getLogger(__name__) +# Advertised server version compatibility. More recent servers are not guaranteed to work. +# We avail ourselves of this macro in running tests to abort if the session has connected +# to a server that is too new. + _IRODS_VERSION = (5, 0, 2, "d") UNICODE = str From bb05ba870c0f24305de9d9209341f391ad67ce54 Mon Sep 17 00:00:00 2001 From: d-w-moore Date: Thu, 8 Jan 2026 23:03:31 -0500 Subject: [PATCH 5/5] recreate _IRODS_VERSION as function returning server compatibility tuple --- irods/helpers/__init__.py | 2 +- irods/message/__init__.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/irods/helpers/__init__.py b/irods/helpers/__init__.py index 8eb432cb1..0e8eb8c01 100644 --- a/irods/helpers/__init__.py +++ b/irods/helpers/__init__.py @@ -59,7 +59,7 @@ def make_session(test_server_version=False, **kwargs): # is too recent. This is a way to ensure that tests don't fail due to a server mismatch. if test_server_version: connected_version = _get_server_version_for_test(session, curtail_length=3) - advertised_version = _IRODS_VERSION[:3] + advertised_version = _IRODS_VERSION()[:3] if connected_version > advertised_version: msg = ( "Connected server is {connected_version}, " diff --git a/irods/message/__init__.py b/irods/message/__init__.py index c0f9deb75..29cace85a 100644 --- a/irods/message/__init__.py +++ b/irods/message/__init__.py @@ -185,7 +185,11 @@ def ET(xml_type=(), server_version=None): # We avail ourselves of this macro in running tests to abort if the session has connected # to a server that is too new. -_IRODS_VERSION = (5, 0, 2, "d") +# Deprecated. Not for use external to the library. +IRODS_VERSION = (5, 0, 2, "d") + +def _IRODS_VERSION(): + return IRODS_VERSION UNICODE = str @@ -477,8 +481,8 @@ def __init__(self, proxy_user, client_user, application_name=""): self.connectCnt = 0 self.proxyUser, self.proxyRcatZone = proxy_user self.clientUser, self.clientRcatZone = client_user - self.relVersion = "rods{}.{}.{}".format(*_IRODS_VERSION) - self.apiVersion = "{3}".format(*_IRODS_VERSION) + self.relVersion = "rods{}.{}.{}".format(*_IRODS_VERSION()) + self.apiVersion = "{3}".format(*_IRODS_VERSION()) self.option = application_name irodsProt = IntegerProperty()