PostgreSQL-backed job queue with Rust and Python bindings
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pgqrs-0.15.3.tar.gz.
File metadata
- Download URL: pgqrs-0.15.3.tar.gz
- Upload date:
- Size: 204.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f53f5c12be523d10348678efcbce5ae8f7b1c8990e1c89a2a63b3725861e262d
|
|
| MD5 |
c1b28dd8d96ba9682827ca658a54ac49
|
|
| BLAKE2b-256 |
fee55de7b66e49b54376f26c417b648d406dd1d1888666a67498ae7e133a9d14
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3.tar.gz:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3.tar.gz -
Subject digest:
f53f5c12be523d10348678efcbce5ae8f7b1c8990e1c89a2a63b3725861e262d - Sigstore transparency entry: 1279682475
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgqrs-0.15.3-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: pgqrs-0.15.3-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92d073b872dda74198ec625a02f2fb3d12a7ecbebb156b7bd59aac12743900af
|
|
| MD5 |
b87e5fe2a8b2504d39418b9e5db57dcc
|
|
| BLAKE2b-256 |
cf424b5ee756807302737cc76eeac1fedc869adcd221e79d834f831945f05a72
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3-cp38-abi3-win_amd64.whl:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3-cp38-abi3-win_amd64.whl -
Subject digest:
92d073b872dda74198ec625a02f2fb3d12a7ecbebb156b7bd59aac12743900af - Sigstore transparency entry: 1279682727
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgqrs-0.15.3-cp38-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pgqrs-0.15.3-cp38-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
114905bf1d5c522d7ff20a19dd9c08c934bf0ca5a060f09cb6a45e5f72ff67ed
|
|
| MD5 |
24e9e6de560250dfaf6f851238f4e361
|
|
| BLAKE2b-256 |
753fc0038bb0170f6ba8921354c59cd42aad369e86d2a33aa8e3ceed74731253
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3-cp38-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3-cp38-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
114905bf1d5c522d7ff20a19dd9c08c934bf0ca5a060f09cb6a45e5f72ff67ed - Sigstore transparency entry: 1279682581
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgqrs-0.15.3-cp38-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: pgqrs-0.15.3-cp38-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04af1a5f3f178d0dc9c4567f4fcf5b4fb39fb93824266607a5c407aa4e3c6b6
|
|
| MD5 |
f0b0cad9be32c7b7781b718e139324e1
|
|
| BLAKE2b-256 |
37e2e9ae24ae11730d8b6b3bdc3bb08162eb61c936d1ae8fa94ac8ca070119af
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3-cp38-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3-cp38-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
b04af1a5f3f178d0dc9c4567f4fcf5b4fb39fb93824266607a5c407aa4e3c6b6 - Sigstore transparency entry: 1279682619
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgqrs-0.15.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pgqrs-0.15.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a435e9a69538cfaf628157dbd18187e4d9ce074f8fa8adafd73046c2a8969c2e
|
|
| MD5 |
94f98b6988ed3b5cca2a07299e7456f2
|
|
| BLAKE2b-256 |
b21be7d2994372da2bbe636e295d28fc8330616dcef5a2e5cacd87664daf68f1
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
a435e9a69538cfaf628157dbd18187e4d9ce074f8fa8adafd73046c2a8969c2e - Sigstore transparency entry: 1279682658
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgqrs-0.15.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pgqrs-0.15.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb4e3b1deb11a67dd0099731abe168bc9bd4d6fc4c2fd0c5a45b1e65a44b8e9b
|
|
| MD5 |
4ef8aa763b39d369d8f80759dbdfe2f7
|
|
| BLAKE2b-256 |
afb26702b4d73fd22d09b01e0980d23825798241a6351e773d2238021609e3da
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
bb4e3b1deb11a67dd0099731abe168bc9bd4d6fc4c2fd0c5a45b1e65a44b8e9b - Sigstore transparency entry: 1279682507
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgqrs-0.15.3-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pgqrs-0.15.3-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af0acac952c6d796191175192155cf6df5a7c86e96bd87dc44101f32f0e30262
|
|
| MD5 |
e17fa7940a4c3e4a60bff1637b883774
|
|
| BLAKE2b-256 |
c8deae7fd08beda7226271f944a12e530d97f9a3e212ae97448ceeb5df34ed09
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
af0acac952c6d796191175192155cf6df5a7c86e96bd87dc44101f32f0e30262 - Sigstore transparency entry: 1279682545
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgqrs-0.15.3-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pgqrs-0.15.3-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47fc21c254cf0bb78e8147130044847ec0d697656287ea479151e8ed2e037c8f
|
|
| MD5 |
0f01492ecc3deb1223893a82431dcd2e
|
|
| BLAKE2b-256 |
20820d202d096ab605ac334039c06a000e0318b6babe2bf3a41ee5b5e26fa247
|
Provenance
The following attestation bundles were made for pgqrs-0.15.3-cp38-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on vrajat/pgqrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgqrs-0.15.3-cp38-abi3-macosx_10_12_x86_64.whl -
Subject digest:
47fc21c254cf0bb78e8147130044847ec0d697656287ea479151e8ed2e037c8f - Sigstore transparency entry: 1279682691
- Sigstore integration time:
-
Permalink:
vrajat/pgqrs@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Branch / Tag:
refs/tags/v0.15.3 - Owner: https://github.com/vrajat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5443635134238daeedcb6d1e17bbb9584b1511b2 -
Trigger Event:
push
-
Statement type: