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

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded PyPymanylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.8+Windows x86-64

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

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

pgqrs-0.12.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.12.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.12.0-cp38-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

pgqrs-0.12.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.12.0.tar.gz.

File metadata

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

File hashes

Hashes for pgqrs-0.12.0.tar.gz
Algorithm Hash digest
SHA256 f6c35cd75a8ab6e13017534d4aef8cff2796839c37111eabc4b667634754315f
MD5 b35832f9174a1c074d40d93b7301147b
BLAKE2b-256 c92896cee4d271cd71622788dd2c30baf63b7f855ed4539233ff3059a3d7b249

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9a27a078a943dd40d702c1fe5ae9d962fed59a1cb484e03797a109e9951074e5
MD5 31f860c9001a99abe46a6ab5dfc600c5
BLAKE2b-256 30d009d5a60e55c90027e966856b9f7e55d679befe935dbcefd8715c427969d4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8424d09ec2d32749dc274f50c4392bd331a51cfb99fcf0335cd77ce3f1a141fb
MD5 7d38f1f199ff45fc3eef6fcc4896f2a6
BLAKE2b-256 b3c05dd17f8d78905b6c1304df4484d8df49db02d8248f13761ca7d817aa2e09

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 547dad00b0e4a69de7c1045daa893fd342ecf6befcf72c64d827b36050d9dab7
MD5 a30d61a451bde509f322788955f640cf
BLAKE2b-256 6d6010ad39977821b7a4145d056a0da76529a6cd6f064d182243996d3947cbc9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e5b274e8ba6e4b1091e5c808b5e90f8abdb25746119c02e15543124065ef1243
MD5 3ee4a93b93e620db41c7c76793deddcd
BLAKE2b-256 d6a9cd14f20d3e499a7b47e705e738da89b373288d4a50f3ca175a830b555c4e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pgqrs-0.12.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.12.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ea297572bab6047862a5f52b042aac301e99235fae4a686f8ab4dc71d8fa9bb9
MD5 d44034328691063d8d63999463b6a01f
BLAKE2b-256 cf9b305309299bdc2bb920128d23f2cfd4cd645561e899aac330b3d5714c569a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8a5fa20ce0b69d3f251e5bf827b99900bc19b91bb04ded84d865290dc1013b0b
MD5 cbf16b30cfbcc1ab8728ad67646f8529
BLAKE2b-256 328afdc292bc157d1cfa137a70351e68ca2772e8835c0c638e4d65c0b462b269

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 31ff785114f4f0a470319b573ba3e76596addb6f6143e1e27dea4a43db033db3
MD5 1bd0da9636966faab7905561b78d30aa
BLAKE2b-256 3ee470a4671e9801e490febe719292985618be56b83c43270456ff58bc236716

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8170720cd66c7cccfdb9d120212d8865031d8aebb9054996942c0b977632012e
MD5 e05cb9215659035dbbf0ed4fc57bf830
BLAKE2b-256 31db59e38d57c3e74471fbbe991c48101adc0a6d8d16d8f38cca8bd74fe46f79

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 59c1539a2e91f2202cc0444333b87a5c54529a35e6d59aa97f9acf42c597cea5
MD5 950dabd2d2b2c56bd289a2cd85bc3f74
BLAKE2b-256 91c2c20351b536e5f38c59219d71ef296565b3e9a78c08bb004e3352addba45c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 821ce1c10c4f43c57f79f951874e523b2f3cbfb0bdea38e3d632ff350161434c
MD5 0af19810e06ee16ed176066cf9ce6639
BLAKE2b-256 767a1bcf3112ff1f205dbd891f5a63f796ac0a715e9810d28d5f4c4cfe5cc882

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pgqrs-0.12.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9f934e62423bf88a25c50b3cb427371745205b44cc99744c85776e195ad728ba
MD5 139d5dc10261d7419b6f8c023e653140
BLAKE2b-256 a810fa3ba8581ca567b62aa5d3445b8a1b21cacecb600caf6752824d86f2e9c0

See more details on using hashes here.

Provenance

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