Skip to main content

A drop-in replacement for the Temporal Python SDK, backed by DBOS Transact (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.3.0.tar.gz (611.0 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.3.0-py3-none-any.whl (190.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dbosify-0.3.0.tar.gz
Algorithm Hash digest
SHA256 355ce23359176edaf3f8ae3d6eff8cb644c4c8508cd9126fe2f1d8e9a4b71bb5
MD5 255d61c66a2ba7770d5e81fab4b1cfc3
BLAKE2b-256 3b82a5650a8fba23d58454fd057140a53580c235c4cac8798d2c3b416a649dad

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbosify-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: dbosify-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 190.5 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 047046d6dfbd4b2b42ec87bd8e8db67160c0dabc066901ac26a8d06f231963a6
MD5 2b5bd692e9f107a6676b15fa54c4dff9
BLAKE2b-256 9ef685a80c6153a9d853a037aa9764c5689077d98bbb4336fc0517eab02c585d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbosify-0.3.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