EntroQ (Python client)
Python client for EntroQ, a fault-tolerant,
competing-consumer task queue with exactly-once semantics and an atomic
Modify operation over tasks and a companion key/value doc store.
This package provides an async client and a small worker framework. It speaks to EntroQ two ways:
-
EntroQJSON— talks to a Go EntroQ server over its HTTP/Connect API. Use this when a server is already running (eqpg serve,eqmem serve,eqredis serve, oreqsqlite serve). -
EntroQ(inentroq.experimental.pg) — talks directly to PostgreSQL, no Go server in the path. It uses the same stored procedures the Goeqpgbackend does, and bundles the canonical schema so a pip-only environment can initialize a database without a Go toolchain. Requires thepgextra.Experimental. Anything under
entroq.experimentalhas no stability guarantee and may change or be removed in any release, including patches. The stable, supported path isEntroQJSONagainst a Go server. Pin an exact version if you depend on the direct client.
Install
pip install entroq # client + worker (JSON/HTTP)
pip install "entroq[pg]" # adds the direct-PostgreSQL backend (psycopg 3)
Quick start
A worker claims tasks from one or more queues and dispatches them to a handler:
import asyncio
from entroq import EntroQWorker, Modification
from entroq.json import EntroQJSON
@EntroQWorker.handler
async def process(task, docs):
# ... do the work ...
return Modification(Modification.deleting(task)) # ack by deleting
async def main():
async with EntroQJSON("http://localhost:8080") as eq:
await EntroQWorker(eq, "my-queue").run(process)
asyncio.run(main())
The default HTTP client has no transport deadline. Cancel the calling asyncio
task directly, wrap it in asyncio.timeout(), or pass timeout_s to claim()
when a bounded wait is required. The client exposes its configured
httpx.AsyncClient as eq.http; pass http_client= to supply a customized
caller-owned client and timeout policy. Injected clients are not closed by
eq.aclose().
Transport failures raise TransportError, preserving the original exception
and indicating whether the request is known to be safe to retry.
Talking straight to PostgreSQL instead of a server (experimental, see above):
from entroq.experimental.pg import EntroQ
async with EntroQ("host=localhost dbname=entroq user=entroq password=secret") as eq:
...
A worker backed by the direct-PostgreSQL client also carries EntroQ's built-in,
always-on garbage collection for /gc=-marked queues on the backend's behalf; a
worker talking to a Go server does not, since the server collects for itself.
Set worker_gc_enabled=False on the direct client when another process owns
garbage collection. Ordinary direct-PostgreSQL operations share eq.pool; a
blocking LISTEN claim retains one dedicated connection until it returns or is
canceled.
Documentation
See the main repository for the concepts
(tasks, claims, the atomic Modify, the doc store, and the /gc= naming
convention) and the server/backends the Go side provides.
Metadata
Release files for entroq 0.13.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| entroq-0.13.1.tar.gz | 55.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| entroq-0.13.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 98.5 kB
Release files / entroq-0.13.1.tar.gz
| Download URL | entroq-0.13.1.tar.gz |
|---|---|
| Size | 55.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28c8bd33be719cd98195d89b78775f0d46b1e5ed065950ab8fb1926c2b9e71b7
|
|
BLAKE2b-256 checksum How to use checksums |
8c2d35b04bab9dd3f140c45a9f9873a05be9a467e884cdbc021a3652dcde2929
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / entroq-0.13.1-py3-none-any.whl
| Download URL | entroq-0.13.1-py3-none-any.whl |
|---|---|
| Size | 43.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f58be4221c3a0f230c7960aa4d36a58a799d46facd3c833ddb044d57dd14283
|
|
BLAKE2b-256 checksum How to use checksums |
725004c3472260ba99e566b15f6177359d07f5e46ccf21d000c12d8dd4bffa5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|