Metadata-Version: 2.4
Name: chasquimq
Version: 1.0.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Distributed Computing
Requires-Dist: msgpack>=1.0
Requires-Dist: redis>=5.0,<7
Requires-Dist: maturin>=1.7,<2.0 ; extra == 'dev'
Requires-Dist: pytest>=8 ; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23 ; extra == 'dev'
Provides-Extra: dev
Summary: The fastest open-source message broker for Redis.
Keywords: redis,queue,job-queue,message-broker,messagepack,streams,pyo3
Author-email: Jorge Rios <j29.rios@gmail.com>
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/jotarios/chasquimq
Project-URL: Issues, https://github.com/jotarios/chasquimq/issues
Project-URL: Repository, https://github.com/jotarios/chasquimq

# chasquimq (Python)

Python bindings for [ChasquiMQ](https://github.com/jotarios/chasquimq) — the fastest open-source message broker for Redis. The Rust engine pulls jobs; Python `asyncio` handlers process them.

> **Status:** Phase 4, slice A4 (high-level shim). Public API is pre-1.0 and may change.

## Layout

- `src-rs/` — PyO3 Rust bindings, compiled as the `chasquimq._native` extension module.
- `src/chasquimq/` — Python shim (the `src layout`); re-exports the native classes (`Producer` / `Consumer` / `Scheduler`) and the high-level surface (`Queue` / `Worker` / `Job` / `QueueEvents`) from one flat namespace.
- `tests/` — pytest harness.

## Build

```bash
cd chasquimq-py
maturin develop          # editable install into the active venv
pytest tests/            # smoke + integration tests (needs Redis 8.6+)
maturin build --release  # wheels under target/wheels/
```

## Quickstart

```python
import asyncio

from chasquimq import Queue, Worker, Job, RepeatPattern


async def send_email(job: Job) -> None:
    print(f"sending {job.data}")


async def main() -> None:
    queue = Queue("emails")

    # Enqueue a one-shot job.
    await queue.add("send-email", {"to": "ada@example.com"})

    # Enqueue a recurring job (fires every 60s on this worker process).
    await queue.add(
        "daily-digest",
        {"who": "all"},
        repeat=RepeatPattern.every(60_000),
    )

    # `concurrency` defaults to 100; tune it to your handler's I/O profile.
    worker = Worker("emails", send_email)
    try:
        await worker.run()
    finally:
        await worker.close()
        await queue.close()


asyncio.run(main())
```

## Power-user surface

Native engine handles are re-exported from the same top-level package — no
private `_native` import needed:

```python
from chasquimq import Producer, Consumer, Scheduler
```

The high-level `Job` dataclass wins the unqualified `Job` name; if you need
the native value type, import it explicitly:

```python
from chasquimq._native import Job as NativeJob
```

## See also

- [Main repo README](https://github.com/jotarios/chasquimq#readme)
- [Phase 4 design doc](../docs/phase4-pyo3-design.md)

## License

MIT — see [LICENSE](https://github.com/jotarios/chasquimq/blob/main/LICENSE) at the workspace root.

