Skip to main content

PostgreSQL-backed job queue with Rust and Python bindings

Project description

py-pgqrs

Python bindings for pgqrs, a high-performance Postgres-backed queue.

Installation

py-pgqrs can be installed using pip (requires Rust toolchain installed):

pip install .

Or for development:

maturin develop

Usage

Producer

import pgqrs
import asyncio

async def produce():
    dsn = "postgres://user:pass@localhost:5432/db"
    producer = pgqrs.Producer(dsn, "my_queue", "producer-host", 1234)

    msg_id = await producer.enqueue({"task": "process_image", "url": "..."})
    print(f"Enqueued job {msg_id}")

asyncio.run(produce())

Consumer

import pgqrs
import asyncio

async def consume():
    dsn = "postgres://user:pass@localhost:5432/db"
    consumer = pgqrs.Consumer(dsn, "my_queue", "consumer-host", 5678)

    messages = await consumer.dequeue()
    for msg in messages:
        print(f"Processing {msg.id}: {msg.payload}")
        # Process...
        await consumer.archive(msg.id)

asyncio.run(consume())

Administration

import pgqrs
import asyncio

async def admin_tasks():
    dsn = "postgres://user:pass@localhost:5432/db"
    admin = pgqrs.Admin(dsn)

    # Setup
    await admin.install()
    await admin.create_queue("my_queue")

    # Monitoring
    queues = await admin.get_queues()
    print(f"Queue Count: {await queues.count()}")

asyncio.run(admin_tasks())

Testing

Tests use pytest and testcontainers to run against a real Postgres instance.

pip install pytest pytest-asyncio testcontainers psycopg[binary]
pytest

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

pgqrs-0.5.0.tar.gz (163.0 kB view details)

Uploaded Source

Built Distributions

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

pgqrs-0.5.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pgqrs-0.5.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pgqrs-0.5.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pgqrs-0.5.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

pgqrs-0.5.0-cp38-abi3-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.8+Windows x86-64

pgqrs-0.5.0-cp38-abi3-musllinux_1_2_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

pgqrs-0.5.0-cp38-abi3-musllinux_1_2_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

pgqrs-0.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

pgqrs-0.5.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

pgqrs-0.5.0-cp38-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

pgqrs-0.5.0-cp38-abi3-macosx_10_12_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file pgqrs-0.5.0.tar.gz.

File metadata

  • Download URL: pgqrs-0.5.0.tar.gz
  • Upload date:
  • Size: 163.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pgqrs-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9fc99e11de2b6f403c63e1699285a2b5d01ee45d07afc5ea0cc39370714bad96
MD5 704a202490a1025000bac0a36c6f151f
BLAKE2b-256 df3b6f43a0ae7adc121898ecbeba44b3ed600fe9850c40857923d84f58f03df5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0.tar.gz:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3ba4207dbee1aacf25fa0941936991935cad32e6be046b145836e3053c439234
MD5 147ce43dcdf8991e93813185304d8a9c
BLAKE2b-256 779329b3bf15b32160aa120aec599e3d9d3b9e29ac91ff1e840f351050f08865

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 01be541c8eb46370c608215d634f094405fb3759b8307eb2d94a0fd2ebb89240
MD5 289dee74b92f9c08ab53d3a292672d01
BLAKE2b-256 312e7ae5f8d424d9159a3127b28ac147da640247d79fab844d2222e4f25050e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 74ab864cb9a8253f109b1238727f425d3f6474234411f67515b1781b6e4502db
MD5 b25d086556311ab1c7d126390dd9e749
BLAKE2b-256 0bb0a2047cb690ce0ba556eef58de2cd137057bee3f73ebcf7de44fda84e3c46

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f9fa184be378b3d494fd8002cc8d33e65c2593208ae8d777e10cb723e3558bc3
MD5 e0074d79396f32bcb887c3c8001ff1ec
BLAKE2b-256 ebb7d80a9820c5534fc7eec57804f65619cad5e03e593b1fcdd1312c71ec55b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: pgqrs-0.5.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pgqrs-0.5.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f0a5ba5f81bba13c4e8cbbb51349f2847b6432da6cc8f335dcf44a326f70eb0c
MD5 91eb96a2dc48716c237fdceb20943722
BLAKE2b-256 3310dcaa2cff884f073eb104565934ca7e974958f5e943bcdb152873aa90248f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 eee301ef13a8a00b56992f0f880e1121e615df706249f0d9e28b452cca54a58f
MD5 c27ffe0528869a89e3963ffd4bc5e5a9
BLAKE2b-256 b67845dae1d71270fb7c9250535233c4e6dc362f7390006d16cf79ca47054650

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-cp38-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d4d23597f5fac149dc854613513ca4bd616983ea3e9bcf4766077b741b19415e
MD5 8e4d51d9cc0a2206ae797ebd6bd1ed63
BLAKE2b-256 bd20e90d71bd995203b740256a5882b5ec51adb0b75717abf6c866949423878c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-cp38-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4e6c866ddbcd1b6922b28db1d6786b4e50d832460f2c72076e3e9b2d5c86844
MD5 0897a83a0cc6148d9b1485c07e1b7307
BLAKE2b-256 0297db4f891be15936857bec376de9a3f753842e79e74b044fa2303c51c556ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7d226336b9acd0755179051739b0eed648240d65923b304753f85fa485b5bd82
MD5 779640f40dd933e107f014e447663a8c
BLAKE2b-256 90ad697571556e4af7a4adaa04aa35f12affc169badf35927da75d4432c4643d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: pgqrs-0.5.0-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pgqrs-0.5.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b2b27dac3b236f2d039e7824093767dbc459c5be45fafbdad33523c0c6ef916
MD5 d8b86e31deb3ab5474ef3c71dfba0316
BLAKE2b-256 db3a24175a766ae9e736af9b125432a4551a4a179654249a7c907bb766b639a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on vrajat/pgqrs

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

File details

Details for the file pgqrs-0.5.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pgqrs-0.5.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 144f0e1ad7d07268a395123b06d703ffe9c06afa98228d36a4c429eb95587218
MD5 0b8f71347492903bc3332f73b291eeb6
BLAKE2b-256 e68ba64c3ea5bdc232ad44e7ca7d5a925e7403c97aa84e58d003071a29ff01e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.5.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on vrajat/pgqrs

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