Skip to main content

Python SDK for the Durable Workflow server (language-neutral HTTP protocol)

Project description

durable-workflow (Python SDK)

A Python SDK for the Durable Workflow server. Speaks the server's language-neutral HTTP/JSON worker protocol — no PHP runtime required.

Status: Alpha. Supports starting workflows, registering workers, polling workflow + activity tasks, schedules, signals, and completing workflows. Queries, updates, timers, and child workflows are planned.

Install

pip install durable-workflow

Or for development:

pip install -e '.[dev]'

Quickstart

from durable_workflow import Client, Worker, workflow, activity

@activity.defn(name="greet")
def greet(name: str) -> str:
    return f"hello, {name}"

@workflow.defn(name="greeter")
class GreeterWorkflow:
    def run(self, ctx, name):
        result = yield ctx.schedule_activity("greet", [name])
        return result

async def main():
    client = Client("http://server:8080", token="dev-token-123", namespace="default")
    worker = Worker(
        client,
        task_queue="python-workers",
        workflows=[GreeterWorkflow],
        activities=[greet],
    )
    handle = await client.start_workflow(
        workflow_type="greeter",
        workflow_id="greet-1",
        task_queue="python-workers",
        input=["world"],
    )
    await worker.run_until(workflow_id="greet-1")
    result = await client.get_result(handle)
    print(result)  # "hello, world"

Features

  • Async-first: Built on httpx and asyncio
  • Type-safe: Full type hints, passes mypy --strict
  • Polyglot: Works alongside PHP workers on the same task queue
  • HTTP/JSON protocol: No gRPC, no protobuf dependencies
  • Codec envelopes: Proper {codec: "json", blob: "..."} serialization for cross-language workflows

Documentation

Full documentation is available at durable-workflow.github.io/docs/2.0/sdks/python/:

Requirements

Development

# Install dev dependencies
pip install -e '.[dev]'

# Run tests
pytest

# Run integration tests (requires Docker)
pytest -m integration

# Type check
mypy src/durable_workflow/

# Lint
ruff check src/ tests/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

durable_workflow-0.1.0.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

durable_workflow-0.1.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file durable_workflow-0.1.0.tar.gz.

File metadata

  • Download URL: durable_workflow-0.1.0.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for durable_workflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 09787229cda1fde2b47ea45ebd7dc6462ed4b591cbb05ccb1242d95b46fa7280
MD5 d849a9260f70ba018ea7b7b1930b088f
BLAKE2b-256 465a3bb86061c5215cbd0f48f2c31e6d02ad45c17e6474ecf8436630298bbc69

See more details on using hashes here.

File details

Details for the file durable_workflow-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for durable_workflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efbaf7b966c0cf1820cf63c0b6728ce10bc3d561d7b73aab38d6d694dec2d9ba
MD5 20456f75cf0c029f9214051b40a8fdea
BLAKE2b-256 f31747492d8617408c949e1a4f83a94687c9e9dd705f0ffae372e7eefc8e9b7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page