Files
hatchet/sdks/python
Matt Kaye 77f81476bd [Docs, Python] Expand Cancellation + Conditional Workflow Docs, Fix cancellation in Python (#1471)
* feat: expand conditional docs

* feat: initial cancellation work + fixing some broken links

* feat: docs on cancellation

* python: fix cancellation

* python: cruft

* chore: version

* feat: python example

* fix: TS cancellation examples

* fix: lint

* feat: go example

* feat: half-baked ts conditional logic workflow

* feat: add ts example conditional workflow

* feat: go example

* feat: go example

* fix: cancellation test

* fix: thanks, copilot!

* Update frontend/docs/pages/home/conditional-workflows.mdx

Co-authored-by: Gabe Ruttner <gabriel.ruttner@gmail.com>

* fix: lint

* chore: lint

* fix: longer sleep

---------

Co-authored-by: Gabe Ruttner <gabriel.ruttner@gmail.com>
2025-04-02 19:51:51 -04:00
..
2025-03-11 14:57:13 -04:00
2025-03-11 14:57:13 -04:00
2025-03-25 15:45:07 -07:00
2025-03-27 21:06:56 -04:00
2025-03-11 14:57:13 -04:00

Hatchet Python SDK

PyPI version Documentation License: MIT

This is the official Python SDK for Hatchet, a distributed, fault-tolerant task queue. The SDK allows you to easily integrate Hatchet's task scheduling and workflow orchestration capabilities into your Python applications.

Installation

Install the SDK using pip:

pip install hatchet-sdk

Or using poetry:

poetry add hatchet-sdk

Quick Start

Here's a simple example of how to use the Hatchet Python SDK:

from hatchet_sdk import Context, EmptyModel, Hatchet

hatchet = Hatchet(debug=True)


@hatchet.task(name="SimpleWorkflow")
def step1(input: EmptyModel, ctx: Context) -> None:
    print("executed step1")


def main() -> None:
    worker = hatchet.worker("test-worker", slots=1, workflows=[step1])
    worker.start()

if __name__ == "__main__":
    main()

Features

  • 🔄 Workflow Orchestration: Define complex workflows with dependencies and parallel execution
  • 🔁 Automatic Retries: Configure retry policies for handling transient failures
  • 📊 Observability: Track workflow progress and monitor execution metrics
  • Scheduling: Schedule workflows to run at specific times or on a recurring basis
  • 🔄 Event-Driven: Trigger workflows based on events in your system

Documentation

For detailed documentation, examples, and best practices, visit:

Contributing

We welcome contributions! Please check out our contributing guidelines and join our Discord community for discussions and support.

License

This SDK is released under the MIT License. See LICENSE for details.