diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c54745b47..d3935bc970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.5.2] - 2023-12-05 +### Fixed +- The built-in `hash` function was mistakenly stored on `WorkflowDefinitionUpsert` instances after `__init__` and has been removed. + ## [7.5.1] - 2023-12-01 ### Changed - Raise an exception if `ClientConfig:base_url` is set to `None` or an empty string @@ -32,8 +36,7 @@ Changes are grouped as follows ## [7.4.1] - 2023-11-28 ### Fixed -- Error in logic when creating a `Transformation`. This is causing when calling `client.transformations.update`. - This is now fixed. +- Error in validation logic when creating a `Transformation` caused many calls to `client.transformations.update` to fail. ## [7.4.0] - 2023-11-27 ### Changed diff --git a/cognite/client/_version.py b/cognite/client/_version.py index 91746e1307..1787025460 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "7.5.1" +__version__ = "7.5.2" __api_subversion__ = "V20220125" diff --git a/cognite/client/data_classes/workflows.py b/cognite/client/data_classes/workflows.py index d44ee69e74..f4332e0b9c 100644 --- a/cognite/client/data_classes/workflows.py +++ b/cognite/client/data_classes/workflows.py @@ -466,8 +466,8 @@ def load(cls, data: dict[str, Any]) -> FunctionTaskOutput: def dump(self, camel_case: bool = True) -> dict[str, Any]: return { - ("callId" if camel_case else "call_id"): self.call_id, - ("functionId" if camel_case else "function_id"): self.function_id, + "callId" if camel_case else "call_id": self.call_id, + "functionId" if camel_case else "function_id": self.function_id, "response": self.response, } @@ -629,7 +629,6 @@ def __init__( tasks: list[WorkflowTask], description: str | None, ) -> None: - self.hash = hash self.tasks = tasks self.description = description diff --git a/pyproject.toml b/pyproject.toml index 4bfa5e4182..249781f1c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.5.1" +version = "7.5.2" description = "Cognite Python SDK" readme = "README.md" documentation = "https://cognite-sdk-python.readthedocs-hosted.com" diff --git a/tests/tests_integration/test_api/test_workflows.py b/tests/tests_integration/test_api/test_workflows.py index a922d64fe7..0f1993e9fd 100644 --- a/tests/tests_integration/test_api/test_workflows.py +++ b/tests/tests_integration/test_api/test_workflows.py @@ -248,7 +248,7 @@ def test_upsert_delete(self, cognite_client: CogniteClient) -> None: assert created_version.workflow_external_id == version.workflow_external_id assert created_version.workflow_definition.description == version.workflow_definition.description - assert created_version.workflow_definition.hash is not None + assert isinstance(created_version.workflow_definition.hash_, str) finally: if created_version is not None: cognite_client.workflows.versions.delete( diff --git a/tests/tests_unit/test_data_classes/test_workflows.py b/tests/tests_unit/test_data_classes/test_workflows.py index 76223e8609..c3c976cd39 100644 --- a/tests/tests_unit/test_data_classes/test_workflows.py +++ b/tests/tests_unit/test_data_classes/test_workflows.py @@ -11,6 +11,9 @@ FunctionTaskOutput, FunctionTaskParameters, TransformationTaskOutput, + TransformationTaskParameters, + WorkflowDefinition, + WorkflowDefinitionUpsert, WorkflowExecutionDetailed, WorkflowIds, WorkflowTask, @@ -19,6 +22,15 @@ ) +class TestWorkFlowDefinitions: + def test_upsert_variant_doesnt_accept_hash(self): + task = WorkflowTask(external_id="foo", parameters=TransformationTaskParameters(external_id="something")) + WorkflowDefinition(tasks=[task], description="desc", hash_="very-random") + + with pytest.raises(TypeError, match="unexpected keyword argument 'hash_'$"): + WorkflowDefinitionUpsert(tasks=[task], description="desc", hash_="very-random") + + class TestWorkflowTaskOutput: @pytest.mark.parametrize( ["output", "expected"],