Skip to main content

dicabrio-durable-sdk

Dependency-free Python 3.10+ SDK for the Durable execution engine.

pip install dicabrio-durable-sdk

Define a function

from durable import DurableFunction, NonRetriableError


def onboarding(event, step):
    def load_user():
        user_id = event.get("data", {}).get("id")
        if not user_id:
            raise NonRetriableError("user id required", code="USER_ID_REQUIRED")
        return {"id": user_id}

    user = step.run("load-user", load_user)
    step.sleep("cooldown", "3s")
    return {"user": user}


functions = [
    DurableFunction(
        id="onboarding-python",
        trigger={"event": "user.created"},
        retries=2,
        handler=onboarding,
    )
]

Local callback and discovery

The SDK includes dependency-free WSGI and ASGI adapters. A WSGI app on port 3000 is enough for the default durable dev discovery:

import os
from durable import wsgi

application = wsgi(
    functions,
    signing_key=os.environ["DURABLE_APP_KEY"],
    app_id=os.environ.get("DURABLE_APP_ID", "app_python_dev"),
    app_name="python-app",
    dev=True,
)

Run it with your WSGI server at /api/durable, or start the stdlib example:

DURABLE_APP_KEY=$(openssl rand -hex 24) DURABLE_DEV=1 \
  PYTHONPATH=src python3 example/app.py

dev=True discloses the local signing key to the discovery request and must never be enabled in production. The example therefore requires explicit DURABLE_DEV=1. For ASGI, use application = asgi(functions, ...); synchronous workflow handlers execute in a worker thread so the event loop is not blocked.

Point Durable elsewhere when the app does not run on port 3000:

DURABLE_DEV_APP_URL=http://localhost:8000/api/durable npx @dicabrio/durable

Client

import os
from durable import Client, provision_app

credentials = provision_app(
    base_url="https://app.durable.dicabrio.com",
    name="python-app",
    app_url="https://python-app.example/api/durable",
    environment="prod",
    admin_token=os.environ["DURABLE_ADMIN_TOKEN"],
)

client = Client(
    "https://app.durable.dicabrio.com",
    credentials["id"],
    credentials["key"],
)
client.sync(functions)
receipt = client.send("user.created", {"id": "u1"}, event_id="user:u1")

Production provisioning is preferably done in the dashboard. The callback URL is stored on the workspace; it is not sent by sync().

Available client operations: sync, send, send_many, search_runs, get_run, cancel_run, rerun, rerun_from_step, list_failures, retry_failure, and get_version_status. Ambiguous event and rerun failures expose their original IDs through EventSendError, BulkEventSendError, and RunActionError so application-level retries remain idempotent.

Available steps: run, threaded composite parallel, sleep, wait_for_event, and transactional send_event. Function options include versions, enable/retire state, retries, callback timeout, failure handlers, concurrency, priority, throttle, rate limit, debounce, and batch.

A callback may execute again when its response is lost. Keep steps bounded and use idempotency keys for external side effects.

Metadata

Release files for dicabrio-durable-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dicabrio-durable-sdk 0.1.0
File Size Uploaded Provenance Actions
dicabrio_durable_sdk-0.1.0.tar.gz 14.4 kB Without provenance Details for dicabrio_durable_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dicabrio-durable-sdk 0.1.0
File Interpreter ABI Platform Actions
dicabrio_durable_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for dicabrio_durable_sdk-0.1.0-py3-none-any.whl

Total release size: 27.7 kB

Release files / dicabrio_durable_sdk-0.1.0.tar.gz

Download URL dicabrio_durable_sdk-0.1.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ba0b223cdacd3325aacd6e302b8403d1f276791c036697e1afaf48ed6dfeb6c9
BLAKE2b-256 checksum
How to use checksums
fc2738a8a3aac3ea3c06ad7d7fa5149422188954b33391d474a9571e9777ce50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / dicabrio_durable_sdk-0.1.0-py3-none-any.whl

Download URL dicabrio_durable_sdk-0.1.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce6247558ce1eedee11d43465247e232ed124a5e230767f9fa9d0dbdad137826
BLAKE2b-256 checksum
How to use checksums
cab5b2a370e05b71eae3777af449ae6568fd8e337334db4dca26ff8e21be693f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for dicabrio-durable-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page