diff --git a/frontend/docs/pages/sdks/python/feature-clients/workflows.mdx b/frontend/docs/pages/sdks/python/feature-clients/workflows.mdx index a0eeabde7..0fbf83d2b 100644 --- a/frontend/docs/pages/sdks/python/feature-clients/workflows.mdx +++ b/frontend/docs/pages/sdks/python/feature-clients/workflows.mdx @@ -10,15 +10,35 @@ Methods: | Name | Description | | ----------------- | --------------------------------------------------------------------------------------------- | +| `aio_delete` | Permanently delete a workflow. | | `aio_get` | Get a workflow by its ID. | | `aio_get_version` | Get a workflow version by the workflow ID and an optional version. | | `aio_list` | List all workflows in the tenant determined by the client config that match optional filters. | +| `delete` | Permanently delete a workflow. | | `get` | Get a workflow by its ID. | | `get_version` | Get a workflow version by the workflow ID and an optional version. | | `list` | List all workflows in the tenant determined by the client config that match optional filters. | ### Functions +#### `aio_delete` + +Permanently delete a workflow. + +**DANGEROUS: This will delete a workflow and all of its data** + +Parameters: + +| Name | Type | Description | Default | +| ------------- | ----- | --------------------------------- | ---------- | +| `workflow_id` | `str` | The ID of the workflow to delete. | _required_ | + +Returns: + +| Type | Description | +| ------ | ----------- | +| `None` | None | + #### `aio_get` Get a workflow by its ID. @@ -70,6 +90,24 @@ Returns: | -------------- | -------------------- | | `WorkflowList` | A list of workflows. | +#### `delete` + +Permanently delete a workflow. + +**DANGEROUS: This will delete a workflow and all of its data** + +Parameters: + +| Name | Type | Description | Default | +| ------------- | ----- | --------------------------------- | ---------- | +| `workflow_id` | `str` | The ID of the workflow to delete. | _required_ | + +Returns: + +| Type | Description | +| ------ | ----------- | +| `None` | None | + #### `get` Get a workflow by its ID. diff --git a/frontend/docs/pages/sdks/python/runnables.mdx b/frontend/docs/pages/sdks/python/runnables.mdx index 84934dcaf..137c6b35f 100644 --- a/frontend/docs/pages/sdks/python/runnables.mdx +++ b/frontend/docs/pages/sdks/python/runnables.mdx @@ -545,6 +545,8 @@ Methods: | `aio_list_runs` | List runs of the workflow. | | `create_filter` | Create a new filter. | | `aio_create_filter` | Create a new filter. | +| `delete` | Permanently delete the workflow. | +| `aio_delete` | Permanently delete the workflow. | ### Functions @@ -869,3 +871,15 @@ Returns: | Type | Description | | ---------- | ------------------- | | `V1Filter` | The created filter. | + +#### `delete` + +Permanently delete the workflow. + +**DANGEROUS: This will delete a workflow and all of its data** + +#### `aio_delete` + +Permanently delete the workflow. + +**DANGEROUS: This will delete a workflow and all of its data** diff --git a/sdks/python/CHANGELOG.md b/sdks/python/CHANGELOG.md index 9076d3644..054727b9b 100644 --- a/sdks/python/CHANGELOG.md +++ b/sdks/python/CHANGELOG.md @@ -5,11 +5,17 @@ All notable changes to Hatchet's Python SDK will be documented in this changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.14.3] - 2025-07-03 +## [1.14.4] - 2025-07-09 ### Added -Adds `remove_null_unicode_character` utility function to remove null unicode characters from data structures. +- Adds `delete` and `aio_delete` methods to the workflows feature client and the corresponding `Workflow` and `Standalone` classes, allowing for deleting workflows and standalone tasks. + +## [1.14.3] - 2025-07-07 + +### Added + +- Adds `remove_null_unicode_character` utility function to remove null unicode characters from data structures. ### Changed diff --git a/sdks/python/docs/runnables.md b/sdks/python/docs/runnables.md index f2cb8c4bc..9d8df1c13 100644 --- a/sdks/python/docs/runnables.md +++ b/sdks/python/docs/runnables.md @@ -59,3 +59,5 @@ - aio_list_runs - create_filter - aio_create_filter + - delete + - aio_delete diff --git a/sdks/python/hatchet_sdk/features/workflows.py b/sdks/python/hatchet_sdk/features/workflows.py index 343500fac..e9348f867 100644 --- a/sdks/python/hatchet_sdk/features/workflows.py +++ b/sdks/python/hatchet_sdk/features/workflows.py @@ -108,3 +108,28 @@ class WorkflowsClient(BaseRestClient): :return: The workflow version. """ return await asyncio.to_thread(self.get_version, workflow_id, version) + + def delete(self, workflow_id: str) -> None: + """ + Permanently delete a workflow. + + **DANGEROUS: This will delete a workflow and all of its data** + + :param workflow_id: The ID of the workflow to delete. + :return: None + """ + + with self.client() as client: + return self._wa(client).workflow_delete(workflow_id) + + async def aio_delete(self, workflow_id: str) -> None: + """ + Permanently delete a workflow. + + **DANGEROUS: This will delete a workflow and all of its data** + + :param workflow_id: The ID of the workflow to delete. + :return: None + """ + + return await asyncio.to_thread(self.delete, workflow_id) diff --git a/sdks/python/hatchet_sdk/runnables/workflow.py b/sdks/python/hatchet_sdk/runnables/workflow.py index 11f5113c3..2e095d179 100644 --- a/sdks/python/hatchet_sdk/runnables/workflow.py +++ b/sdks/python/hatchet_sdk/runnables/workflow.py @@ -509,6 +509,22 @@ class BaseWorkflow(Generic[TWorkflowInput]): priority=priority, ) + def delete(self) -> None: + """ + Permanently delete the workflow. + + **DANGEROUS: This will delete a workflow and all of its data** + """ + self.client.workflows.delete(self.id) + + async def aio_delete(self) -> None: + """ + Permanently delete the workflow. + + **DANGEROUS: This will delete a workflow and all of its data** + """ + await self.client.workflows.aio_delete(self.id) + class Workflow(BaseWorkflow[TWorkflowInput]): """ diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index 80c41ff31..256f63c2e 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hatchet-sdk" -version = "1.14.3" +version = "1.14.4" description = "" authors = ["Alexander Belanger "] readme = "README.md"