Skip to main content

cauli (Python client)

Python client for cauli, a Rust background worker runtime for Python task queues. Define tasks in Python, enqueue from any web framework, execute on the Rust worker.

Install

pip install cauli               # Python >= 3.10 (deps: redis>=5, msgspec)

That also installs the cauli-worker binary, but only where its wheels exist: Linux (glibc) on x86_64 or aarch64, CPython 3.10 through 3.14. Anywhere else, a macOS laptop, Windows, PyPy, a CPython newer than the release matrix, the worker requirement is dropped rather than failing the install: the client still lands and enqueueing still works, there is simply no cauli-worker to run. Two targets fail the install instead, because no marker can describe them: musl (Alpine) and the free threaded build. For those, and for enqueue only web dynos that never run a worker, see PROTOCOL.md section 13.4.

Define an app and tasks (myproj/tasks.py)

from cauli import Cauli

app = Cauli(redis_url="redis://localhost:6379/0", default_queue="default")

@app.task()
async def send_email(to: str) -> str:
    ...                      # io task: runs on the worker's asyncio loop
    return "sent"

@app.task(kind="cpu", timeout=120, soft_timeout=60, max_retries=5)
def crunch(n: int) -> int:   # cpu task: runs in a child Python process
    return sum(i * i for i in range(n))

Enqueue from Django, FastAPI, or Flask

from myproj.tasks import send_email

r = send_email.delay("a@b.com")
r = send_email.apply_async(args=("a@b.com",), countdown=30, queue="emails",
                           idempotency_key="welcome:a@b.com")
r.status()           # "pending" | "success" | "failure" | "duplicate" | "expired"
r.get(timeout=10)    # value on success; raises TaskFailedError / TimeoutError

Tasks stay directly callable for tests: crunch(10) runs inline, no broker needed.

Run the worker (Rust binary)

cauli-worker -A myproj.tasks:app -c 50 -Q default,emails

The URL falls back to env CAULI_REDIS_URL, then redis://localhost:6379/0. See PROTOCOL.md in the repo root for the full wire contract.

Metadata

Release files for cauli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cauli 0.1.0
File Size Uploaded
cauli-0.1.0.tar.gz 138.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cauli 0.1.0
File Interpreter ABI Platform
cauli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 223.5 kB

Release files / cauli-0.1.0.tar.gz

Download URL cauli-0.1.0.tar.gz
Size 138.1 kB
Tags Source
SHA-256 checksum
How to use checksums
030bac5a857b90ef0932a8df41d59d9539459bca7574d705adfd2b5d1e240d36
BLAKE2b-256 checksum
How to use checksums
81e60d68ecb4680bfa2efafb716eba6616d019ebf04d06ff4c88b05b33826385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / cauli-0.1.0-py3-none-any.whl

Download URL cauli-0.1.0-py3-none-any.whl
Size 85.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a7dd749a8bdd980632cb74f8e4866ad3a36036091b29e243994177169f5a151
BLAKE2b-256 checksum
How to use checksums
fc2859a4103c180ece33beec25844bc3c1b8878ad1229165fcf27ebe82873564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page