Feat: Add workflow delete API to workflows client (#1970)

* feat: add workflow delete api to workflows client

* feat: add delete methods to workflows + runnables

* chore: docs gen
This commit is contained in:
Matt Kaye
2025-07-09 16:20:21 -04:00
committed by GitHub
parent 2cfb345dcf
commit 63004ec9ab
7 changed files with 104 additions and 3 deletions

View File

@@ -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

View File

@@ -59,3 +59,5 @@
- aio_list_runs
- create_filter
- aio_create_filter
- delete
- aio_delete

View File

@@ -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)

View File

@@ -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]):
"""

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "hatchet-sdk"
version = "1.14.3"
version = "1.14.4"
description = ""
authors = ["Alexander Belanger <alexander@hatchet.run>"]
readme = "README.md"