Skip to main content

A drop-in replacement for the Temporal Python SDK, backed by DBOS Transact and Postgres instead of a Temporal server

Project description

DBOSify

DBOSify is a drop-in replacement for Temporal Python that uses Postgres (through DBOS Transact) instead of a Temporal server. This lets you run durable workflows, activities, signals, updates, retries, and recovery without needing any infrastructure except Postgres.

DBOSify architecture: a DBOSify Client and DBOSify Workers coordinate through Postgres, which handles workflow orchestration

To use this library, import dbosify instead of temporalio and connect your workers and clients to a Postgres database:

DBOSify is a drop-in replacement for Temporal Python

Usage

To install:

pip install dbosify

This is a drop-in replacement: simply import dbosify instead of temporalio and connect your clients and workers to a Postgres database instead of a Temporal server. Further documentation here.

import asyncio
import os
from datetime import timedelta

from dbosify import activity, workflow
from dbosify.client import Client
from dbosify.worker import Worker

# Set this to a connection string to your Postgres database
DB_URL = os.environ.get("DBOS_SYSTEM_DATABASE_URL")


@activity.defn
async def compose_greeting(name: str) -> str:
    return f"Hello, {name}!"


@workflow.defn
class GreetingWorkflow:
    @workflow.run
    async def run(self, name: str) -> str:
        return await workflow.execute_activity(
            compose_greeting, name, start_to_close_timeout=timedelta(seconds=10)
        )


async def main() -> None:
    worker = Worker(
        DB_URL,
        task_queue="greetings",
        workflows=[GreetingWorkflow],
        activities=[compose_greeting],
    )
    async with worker:
        async with await Client.connect(DB_URL) as client:
            result = await client.execute_workflow(
                GreetingWorkflow.run, "World", id="greeting-1", task_queue="greetings"
            )
            print(result)  # Hello, World!


if __name__ == "__main__":
    asyncio.run(main())

How It Works

DBOSify runs each Temporal workflow as a Postgres-backed DBOS workflow. A deterministic interpreter runs the workflow (both its main coroutine and its signal, update, and query handlers) on a virtual event loop that only advances when an event arrives. Using DBOS steps and workflow communication primitives, all nondeterministic actions are checkpointed in Postgres before the workflow observes them.

  • Activities and timers become DBOS steps and durable sleeps, each checkpointed on completion.
  • Signals, updates, and cancellations are durable messages delivered through Postgres using LISTEN/NOTIFY.
  • Recovery re-runs the workflow on a new worker: the interpreter replays the same sequence of operations against the recorded checkpoints, so execution resumes where it left off and completes exactly once.
  • Namespaces each map to their own Postgres schema; a Client wraps a DBOS client and a Worker wraps the DBOS runtime.

How It's Tested

As DBOSify is a drop-in replacement for Temporal, its tests cover both correctness and conformance with Temporal using the following strategies:

  • Ports of all relevant Temporal Python unit and integration tests
  • Ports of relevant Temporal Python sample applications, verifying DBOSify is a drop-in replacement
  • New unit and integration tests, with an emphasis on kill-and-recover tests verifying deterministic failure recovery
  • Signature parity tests mechanically asserting the public APIs of these libraries are identical (with documented exceptions)

What This Is Not

  • No wire protocol compatibility. There is no gRPC wire compatibility. Temporal SDKs in other languages cannot connect. This replaces the Temporal server and Python SDK altogether for Python-only applications.
  • No Temporal Web UI, temporal CLI, or tctl. You operate workflows with DBOS's workflow-management APIs and DBOS Conductor instead.

See this documentation for information on architectural differences and feature compatibility.

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

dbosify-0.4.0.tar.gz (614.6 kB view details)

Uploaded Source

Built Distribution

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

dbosify-0.4.0-py3-none-any.whl (191.3 kB view details)

Uploaded Python 3

File details

Details for the file dbosify-0.4.0.tar.gz.

File metadata

  • Download URL: dbosify-0.4.0.tar.gz
  • Upload date:
  • Size: 614.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbosify-0.4.0.tar.gz
Algorithm Hash digest
SHA256 290b0da3a611d58ed79833eccd70c4aa3ae03b74241406d22f10480acae260d7
MD5 24cc6f350021161ec8a3e27053347870
BLAKE2b-256 e24d19a32d6deb81b6d7d541804b5896ebe23bd4d31849f914d4f87ea6b9ec54

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbosify-0.4.0.tar.gz:

Publisher: publish.yml on dbos-inc/dbosify-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbosify-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: dbosify-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 191.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbosify-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59ad4e4ddc9a41eb7b4b0bfff5ed7f9864fd5f5d9a6ee0137d20e2ea713231af
MD5 bc815c2f293a8597b191abb6654310bf
BLAKE2b-256 50e68d782fd5f85625fc94705107da9a161619cfe41404b9a10d3df8dd522924

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbosify-0.4.0-py3-none-any.whl:

Publisher: publish.yml on dbos-inc/dbosify-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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