From d7101e3811c1865dd0ae6d9981d38a06d0267d6f Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Fri, 18 Jul 2025 15:52:02 -0500 Subject: [PATCH] Rename 'function_data' to 'data' This was desired shortly after the first release containing `function_data`, but we held the change back at the time to wait for SDK v4 to make a technically breaking change. See also: #1092 --- .../20250718_155001_sirosen_rename_function_data.rst | 5 +++++ src/globus_sdk/services/compute/client.py | 9 +++------ .../services/compute/v2/test_register_function.py | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 changelog.d/20250718_155001_sirosen_rename_function_data.rst diff --git a/changelog.d/20250718_155001_sirosen_rename_function_data.rst b/changelog.d/20250718_155001_sirosen_rename_function_data.rst new file mode 100644 index 000000000..775e95e64 --- /dev/null +++ b/changelog.d/20250718_155001_sirosen_rename_function_data.rst @@ -0,0 +1,5 @@ +Breaking Changes +---------------- + +- The ``function_data`` argument to ``ComputeClientV2.register_function`` has + been renamed to ``data`` to be consistent with other usages. (:pr:`NUMBER`) diff --git a/src/globus_sdk/services/compute/client.py b/src/globus_sdk/services/compute/client.py index a54ef28d9..2287f07b6 100644 --- a/src/globus_sdk/services/compute/client.py +++ b/src/globus_sdk/services/compute/client.py @@ -149,13 +149,10 @@ def lock_endpoint(self, endpoint_id: uuid.UUID | str) -> GlobusHTTPResponse: """ # noqa: E501 return self.post(f"/v2/endpoints/{endpoint_id}/lock") - def register_function( - self, - function_data: dict[str, t.Any], - ) -> GlobusHTTPResponse: + def register_function(self, data: dict[str, t.Any]) -> GlobusHTTPResponse: """Register a new function. - :param function_data: A function registration document. + :param data: A function registration document. .. tab-set:: @@ -165,7 +162,7 @@ def register_function( :service: compute :ref: Functions/operation/register_function_v2_functions_post """ # noqa: E501 - return self.post("/v2/functions", data=function_data) + return self.post("/v2/functions", data=data) def get_function(self, function_id: uuid.UUID | str) -> GlobusHTTPResponse: """Get information about a registered function. diff --git a/tests/functional/services/compute/v2/test_register_function.py b/tests/functional/services/compute/v2/test_register_function.py index 7a93bd598..55390bf6a 100644 --- a/tests/functional/services/compute/v2/test_register_function.py +++ b/tests/functional/services/compute/v2/test_register_function.py @@ -8,6 +8,6 @@ def test_register_function(compute_client_v2: globus_sdk.ComputeClientV2): "function_name": meta["function_name"], "function_code": meta["function_code"], } - res = compute_client_v2.register_function(function_data=registration_doc) + res = compute_client_v2.register_function(data=registration_doc) assert res.http_status == 200 assert res.data["function_uuid"] == meta["function_id"]