py-pgqrs
pgqrs is a postgres-native, library-only durable execution engine.
Python bindings for the Rust core. Built for Postgres. Also supports SQLite and Turso.
What is Durable Execution?
A durable execution engine ensures workflows resume from application crashes or pauses. Each step executes exactly once. State persists in the database. Processes resume from the last completed step.
Key Properties
- Postgres-native: Leverages SKIP LOCKED, ACID transactions
- Library-only: Runs in-process with your application
- Multi-backend: Postgres (production), SQLite/Turso (testing, CLI, embedded)
- Type-safe: Rust core with idiomatic Python bindings
- Transaction-safe: Exactly-once step execution within database transactions
Installation
pip install pgqrs
For local development:
make requirements
Backend Support
py-pgqrs supports all three backends. Choose the right one for your use case:
# PostgreSQL (production)
store = await pgqrs.connect("postgresql://user:pass@localhost:5432/db")
# SQLite (embedded, testing)
store = await pgqrs.connect("sqlite:///path/to/database.db")
# Turso (SQLite-compatible, embedded)
store = await pgqrs.connect("turso:///path/to/database.db")
Usage
Producer + Consumer
import asyncio
import pgqrs
async def main():
store = await pgqrs.connect("postgresql://localhost/mydb")
admin = pgqrs.admin(store)
await admin.install()
await store.queue("tasks")
producer = await store.producer("tasks")
msg_id = await producer.enqueue({"task": "process_image", "url": "..."})
print(f"Enqueued job {msg_id}")
consumer = await store.consumer("tasks")
messages = await consumer.dequeue(batch_size=1)
for msg in messages:
print(f"Processing {msg.id}: {msg.payload}")
await consumer.archive(msg.id)
asyncio.run(main())
Durable Workflow (Python)
import asyncio
import pgqrs
async def main():
store = await pgqrs.connect("postgresql://localhost/mydb")
admin = pgqrs.admin(store)
await admin.install()
await pgqrs.workflow().name("archive_files").store(store).create()
consumer = await pgqrs.consumer("worker-1", 8080, "archive_files").create(store)
await pgqrs.workflow() \
.name("archive_files") \
.store(store) \
.trigger({"path": "/tmp/report.csv"}) \
.execute()
messages = await consumer.dequeue(batch_size=1)
msg = messages[0]
run = await pgqrs.run().message(msg).store(store).execute()
step = await run.acquire_step("list_files", current_time=run.current_time)
if step.status == "EXECUTE":
await step.guard.success([msg.payload["path"]])
step = await run.acquire_step("create_archive", current_time=run.current_time)
if step.status == "EXECUTE":
await step.guard.success(f"{msg.payload['path']}.zip")
await run.complete({"archive": f"{msg.payload['path']}.zip"})
await consumer.archive(msg.id)
asyncio.run(main())
Testing
make test-py PGQRS_TEST_BACKEND=postgres
Documentation
- Full Documentation - Complete guides and API reference
- Docs Home - Master documentation source
- Python Examples - Python test suite with examples
- API Reference - Consumer/producer API details
Metadata
Release files for pgqrs 0.15.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pgqrs-0.15.3.tar.gz | 204.0 kB | With provenance | Details for pgqrs-0.15.3.tar.gz |
Built distributions (wheels)
Total release size: 27.7 MB
Release files / pgqrs-0.15.3.tar.gz
| Download URL | pgqrs-0.15.3.tar.gz |
|---|---|
| Size | 204.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f53f5c12be523d10348678efcbce5ae8f7b1c8990e1c89a2a63b3725861e262d
|
|
BLAKE2b-256 checksum How to use checksums |
fee55de7b66e49b54376f26c417b648d406dd1d1888666a67498ae7e133a9d14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logRelease files / pgqrs-0.15.3-cp38-abi3-win_amd64.whl
| Download URL | pgqrs-0.15.3-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
92d073b872dda74198ec625a02f2fb3d12a7ecbebb156b7bd59aac12743900af
|
|
BLAKE2b-256 checksum How to use checksums |
cf424b5ee756807302737cc76eeac1fedc869adcd221e79d834f831945f05a72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logRelease files / pgqrs-0.15.3-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | pgqrs-0.15.3-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
114905bf1d5c522d7ff20a19dd9c08c934bf0ca5a060f09cb6a45e5f72ff67ed
|
|
BLAKE2b-256 checksum How to use checksums |
753fc0038bb0170f6ba8921354c59cd42aad369e86d2a33aa8e3ceed74731253
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logRelease files / pgqrs-0.15.3-cp38-abi3-musllinux_1_2_aarch64.whl
| Download URL | pgqrs-0.15.3-cp38-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.8 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b04af1a5f3f178d0dc9c4567f4fcf5b4fb39fb93824266607a5c407aa4e3c6b6
|
|
BLAKE2b-256 checksum How to use checksums |
37e2e9ae24ae11730d8b6b3bdc3bb08162eb61c936d1ae8fa94ac8ca070119af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logRelease files / pgqrs-0.15.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pgqrs-0.15.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a435e9a69538cfaf628157dbd18187e4d9ce074f8fa8adafd73046c2a8969c2e
|
|
BLAKE2b-256 checksum How to use checksums |
b21be7d2994372da2bbe636e295d28fc8330616dcef5a2e5cacd87664daf68f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logRelease files / pgqrs-0.15.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pgqrs-0.15.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
bb4e3b1deb11a67dd0099731abe168bc9bd4d6fc4c2fd0c5a45b1e65a44b8e9b
|
|
BLAKE2b-256 checksum How to use checksums |
afb26702b4d73fd22d09b01e0980d23825798241a6351e773d2238021609e3da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logRelease files / pgqrs-0.15.3-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | pgqrs-0.15.3-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
af0acac952c6d796191175192155cf6df5a7c86e96bd87dc44101f32f0e30262
|
|
BLAKE2b-256 checksum How to use checksums |
c8deae7fd08beda7226271f944a12e530d97f9a3e212ae97448ceeb5df34ed09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logRelease files / pgqrs-0.15.3-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | pgqrs-0.15.3-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
47fc21c254cf0bb78e8147130044847ec0d697656287ea479151e8ed2e037c8f
|
|
BLAKE2b-256 checksum How to use checksums |
20820d202d096ab605ac334039c06a000e0318b6babe2bf3a41ee5b5e26fa247
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 11, 2026.
Transparency logSecurity for pgqrs 0.15.3
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 8 files in this release have been uploaded with provenance metadata.
Attestation for pgqrs-0.15.3.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 Apr 11, 2026.
Transparency logA 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.