Metadata-Version: 2.4
Name: entroq
Version: 0.14.0
Summary: Python client for the EntroQ task queue.
Author-email: Chris Monson <shiblon@gmail.com>
Project-URL: Homepage, https://github.com/shiblon/entroq
Project-URL: Repository, https://github.com/shiblon/entroq
Project-URL: Bug Tracker, https://github.com/shiblon/entroq/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Dynamic: license-file

# EntroQ (Python client)

Python client for [EntroQ](https://github.com/shiblon/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 HTTP/Connect client and a small worker framework.
Run one of the Go services (`eqpg serve`, `eqmem serve`, `eqredis serve`, or
`eqsqlite serve`) and connect with `EntroQJSON`.

## Install

```sh
pip install entroq
```

## Quick start

A worker claims tasks from one or more queues and dispatches them to a handler:

```python
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.

## Documentation

See the [main repository](https://github.com/shiblon/entroq) for the concepts
(tasks, claims, the atomic `Modify`, the doc store, and the `/gc=` naming
convention) and the server/backends the Go side provides.
