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. Core features implemented: workflows, activities, schedules, signals, queries, updates, timers, child workflows, continue-as-new, side effects, and version markers. Full language-neutral protocol support for cross-PHP/Python orchestration.

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: Avro payloads by default, with JSON decode compatibility for existing history

Documentation

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

Requirements

Compatibility

SDK version 0.2.x is compatible with Durable Workflow server 0.x prerelease images and the Server 2.x protocol line.

The worker automatically checks server version at startup and raises a clear error if incompatible.

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


Release history Release notifications | RSS feed

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.2.0.tar.gz (42.0 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.2.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: durable_workflow-0.2.0.tar.gz
  • Upload date:
  • Size: 42.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 540cc0b3a99d7f73d7176d5a7eff0727f869b9e52889d00b87de74c42046af42
MD5 a97f3d6114d749fbfe3ae9308c93ef61
BLAKE2b-256 b1b33bfd7ba25fcb25c833e8345323a5163583ec900101a40a098499fa2ca0d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for durable_workflow-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e20c010b9e4a2aa6c580c56de71df4fd79818acc1cb165b89cf1f1e3dc4a9381
MD5 14e912af1efbc2b1fef82ed46f6fb82a
BLAKE2b-256 7d6cd25dacefc852f707e77c4ffc6d0368d126701791c06585807155ceafe02d

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