Skip to main content

litestar-rs

PyPI version Python versions License CI Checked with mypy

Distributed task queue on Redis Streams for Litestar — typed tasks, real dependency injection, retries, scheduling and cron, through Litestar's native plugin protocol.

📖 Documentation

Features

  • Tasks are ordinary functions: arguments are serialised, dependencies injected
  • Retries with backoff, a delivery ceiling, and a dead letter queue that keeps the payload, the traceback and the attempt history
  • Delayed jobs and cron with no scheduler process, correct across DST
  • Priority queues with a bounded starvation window, and shards for fairness
  • Broker mode: consume streams somebody else writes, in the same worker
  • Optional results, a deduplication gate, and trace context carried into the task
  • Health endpoint served identically by the web process and the worker
  • Eager mode, assert_enqueued and a real-worker fixture for your own tests

Installation

uv add litestar-rs

Redis 7 or newer. Standalone, Sentinel and Cluster are all covered by the test suite.

Quick start

from uuid import UUID

from litestar import Litestar, post
from litestar.di import Provide

from litestar_rs.plugin import QueueConfig, QueuePlugin, TaskRegistry

tasks = TaskRegistry()


@tasks.task
async def reindex(doc_id: UUID, session: AsyncSession) -> None:
    ...


@post("/documents")
async def create(doc_id: UUID) -> str:
    await reindex.enqueue(doc_id=doc_id)
    return "queued"


app = Litestar(
    route_handlers=[create],
    dependencies={"session": Provide(session)},
    plugins=[QueuePlugin(QueueConfig(registry=tasks, redis_url="redis://localhost"))],
)

doc_id travels in the payload and session is injected in the worker, from the application's own dependency graph. There is no context dictionary.

Workers

A worker is the same application, started differently:

litestar workers run --queue high --concurrency 20 --health-port 8081

Anything that can be settled at startup is — a task registered twice, an argument with no annotation, a dependency the application does not provide, a cycle, a provider only a request could satisfy — rather than on the first job in production.

Delivery guarantee

At-least-once. A worker that completed its side effect and died before XACK will be reclaimed and the work repeated. No amount of protocol work removes that; only an idempotent handler does. A dedup key is provided for the cases where that is not naturally true.

Documentation

Tasks, scheduling, retries, priorities, broker mode, results, testing and operations are covered in the full documentation. The rules the library is built to are in Design and invariants. Runnable examples are included.

Development

make install   # dependencies and git hooks
make check     # lint, types, import contracts, unit tests
make test-int  # integration suite, needs Docker

License

MIT

Metadata

Release files for litestar-rs 0.1.2

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

Source distribution (sdist)

Source distribution for litestar-rs 0.1.2
File Size Uploaded
litestar_rs-0.1.2.tar.gz 167.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for litestar-rs 0.1.2
File Interpreter ABI Platform
litestar_rs-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 217.5 kB

Release files / litestar_rs-0.1.2.tar.gz

Download URL litestar_rs-0.1.2.tar.gz
Size 167.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fd27ebd0b7d1b0ee8d71d6f8ab53dc2aacebbdcb43a2676ce77480207c430c53
BLAKE2b-256 checksum
How to use checksums
f287d0c59a72c15600b6ad6284ff34f39cae2c54573109ae71cb0b3af6195362
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / litestar_rs-0.1.2-py3-none-any.whl

Download URL litestar_rs-0.1.2-py3-none-any.whl
Size 50.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4f64fb1ee067283d7b13a52de3dd27129e750e71a54aef4d00ea0c6d4a78d08
BLAKE2b-256 checksum
How to use checksums
b006f17467e7fe6ef1dc5b3846e6ec7b819a2ac578294ca7f188e2c28d0789a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

2 release files

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

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