Skip to main content

Unhinged

Absurd is Armin Ronacher's durable execution engine for Postgres. Unhinged is the same engine on SQLite. No server, no dependencies, one file on disk.

from unhinged import Unhinged

app = Unhinged("app.db", queue_name="orders")

@app.register_task("fulfil-order")
def fulfil_order(params, ctx):
    payment = ctx.step("charge", lambda: charge_card(params["card"], params["amount"]))
    ctx.sleep_for("cooldown", 60)
    shipment = ctx.await_event(f"shipped:{params['order_id']}", timeout=86400)
    return {"payment": payment, "tracking": shipment["tracking"]}

app.spawn("fulfil-order", {"order_id": 42, "card": "tok_1", "amount": 1999})
app.start_worker(concurrency=4)

Steps run once. If the worker crashes, sleeps, or waits for an event, the next run skips the steps that already finished.

How it works

Same tables as Absurd, same procedure names. The stored procedures are Python methods on Engine, each one a BEGIN IMMEDIATE transaction. Workers poll. Several worker processes can share one file; examples/chaos.py runs eight of them and kills one at random every hundred milliseconds, and the test suite checks that every task still completes, no run was ever executed by two processes, and a step only re-ran when its lease had been reclaimed.

Every commit is fsynced, which survives a crash. On macOS that is not the same as surviving a power cut; pass fullfsync=True for that, and expect it to be slow. docs/durability.md has the whole story, including what to do when the disk dies.

Run it

uv venv && uv pip install -e '.[dev]'
pytest
python examples/crash_demo.py
python examples/bench.py     # calibrates the disk first; see BENCHMARKS.md

examples/release/ is a release checklist that survives Ctrl-C and waits for approval. examples/pipeline/ is a resumable batch job. examples/agent/ is an agent loop where every model call is a step. python -m unhinged is the CLI. Pydantic AI agents run durably on it through unhinged.pydantic_ai.UnhingedDurability; see docs/pydantic-ai.md.

What's not here

Partitioned queues, pg_cron, and Absurd's SDK hooks. Nothing deletes old tasks unless you call app.cleanup() or pass maintenance_interval to start_worker.

License

Apache-2.0, same as Absurd.

Metadata

Release files for unhinged 0.2.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 unhinged 0.2.0
File Size Uploaded Provenance
unhinged-0.2.0.tar.gz 76.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for unhinged 0.2.0
File Interpreter ABI Platform
unhinged-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 114.5 kB

Release files / unhinged-0.2.0.tar.gz

Download URL unhinged-0.2.0.tar.gz
Size 76.9 kB
Tags Source
SHA-256 checksum
How to use checksums
25e10d5e307c288eb4c25118fe3f71f0792400461625e41e1321ee3125b757e8
BLAKE2b-256 checksum
How to use checksums
b0cb2e5045972a7b26298aa5fc0cadf459499edc5e2d873aa9401e7bbb7939f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / unhinged-0.2.0-py3-none-any.whl

Download URL unhinged-0.2.0-py3-none-any.whl
Size 37.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e6bc42ea73bc29ac73b573166b999e7050522d74eb3e3657f0e0d86abad9d41
BLAKE2b-256 checksum
How to use checksums
a30b916ace680341252d8e6cba6b37e6416351df4cd964930d88ba2bc8e98265
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for unhinged 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for unhinged-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

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.2.0 This release

2 release files Full 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