Skip to main content

PostgreSQL-backed job queue with Rust and Python bindings

Project description

py-pgqrs

Python bindings for pgqrs, a high-performance multi-backend queue (PostgreSQL, SQLite, Turso).

Installation

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

pip install .

Or for development:

maturin develop

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

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.13.0.tar.gz (209.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.13.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.8+Windows x86-64

pgqrs-0.13.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.13.0-cp38-abi3-musllinux_1_2_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

pgqrs-0.13.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.13.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.13.0-cp38-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

pgqrs-0.13.0-cp38-abi3-macosx_10_12_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pgqrs-0.13.0.tar.gz
  • Upload date:
  • Size: 209.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.13.0.tar.gz
Algorithm Hash digest
SHA256 1048a4d2793efc1184081c1fb5065dede17e442990b912f452237bd1b8464e69
MD5 596386fd9470551f5191bd5fb2c5778c
BLAKE2b-256 8ed1e245945d88a082c37a6799c44f77084e656a350c1278999bc95b6ceaae5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 93fc90a734c68605c1e22c8bca4d8f739212d3ec5ea911a7b7a8e1059faf3fe0
MD5 be9615a6518891cf470106b0400ff2b3
BLAKE2b-256 e9def5df145e0d2485bb6e85b08b4d35142b9013178972ee93ca3fbd7a54b7fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cb94da40507a0b009f2995b03d60b7f27b95ea0d84f306cb897f0b91641a2f5d
MD5 e40a4d0d12641edf87122c1225368cf7
BLAKE2b-256 b4f4c0b9a658d4e36e5b6ef89234eb7f45a212ad4d85a9cb236ee9b68fb461b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5f576d0374faf1d502c1c9fd3c5ce78f911f1ec58a51a63fc5d07f81cf7048c3
MD5 14a4cefabb2ef2e915b32f9fea2c4b28
BLAKE2b-256 2bcd3498f9728635934bf3619c507b4bb78ce94726ac9dfa96ba144b82a77f8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f27e73d56e0e146de48fc2ca77cf889b18b965aa1ff2d0be5b87c4e8bdc597dd
MD5 0e5fcb6e8b272396d508d846376585fb
BLAKE2b-256 4982a548f08f699b5324a70427a66f21c12e74ba9939708a54eb2f8cf8aeff55

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: pgqrs-0.13.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.13.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 41fbed0dafacc9128d60c31a2516b311c05248193780d5eeed28d9ab7f66d45f
MD5 9285894aa3f9fbf139f4317c8fd611f5
BLAKE2b-256 c7a11d4291c01e2d9431347976e3f802a6506232e655dbbc0e7c99d10bf2ff19

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5f33b025d3056fa76ab4aa3054417d28a9998057bd5bb3538e411da1070abb53
MD5 aa53dc23f53b8eae0294e0885c67435a
BLAKE2b-256 561daa47fbccac2993e7c28ab071f663bb4de49e2fb1f932229ea3f035fa0317

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 15551bcd161a16e31a1e08a16b653c6877ca3fb8b865a20cb226423c7a6646d7
MD5 b686df999caf66664208e799dba63cf4
BLAKE2b-256 3d88dc273cfa4f8321564f6afcae3726cedba8a3af9a2ce04f8e0c747fe66416

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 183051aa4aee11e93d034ed88901129def945107a65a540911bca955ba186079
MD5 5dee4baae19cdef813da4757a531ff79
BLAKE2b-256 4e98677f704dfd83997df7a3ac12313696927aa2428d12493ef7c15ca1a329fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9609a5f2a6401fe5b048a2c580af307f5ac36914dec2fafb0734181496a62036
MD5 b50da616610e61c831bad2e3c135e90b
BLAKE2b-256 e2bfaf166949198a6530d50753b76a95947995863a67458b62125db0bdfff018

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bd9fcf0aefba566f7d25624793a1d465cbe3de6b424a269070baf11f908f06b
MD5 ca91a2ebd98aa683b3fbd2bce57c0163
BLAKE2b-256 b725d6dcfbfb450dd8cae371287e1423b7803c18a7f67232dcc92212d783c690

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgqrs-0.13.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.13.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pgqrs-0.13.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 18815df7a0a15bc6aafefde8aa522648d5b6f5e7737e6b1f746ad6780ca8af22
MD5 12d576f6a0eef3f519359e8152104a9a
BLAKE2b-256 16e48b33fbbc6979a62f4894935b9a44a947c406c0bd9c7000339e9102c072fc

See more details on using hashes here.

Provenance

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