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.3

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.3
File Size Uploaded
litestar_rs-0.1.3.tar.gz 169.4 kB Details

Built distribution (wheel)

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

Total release size: 220.0 kB

Release files / litestar_rs-0.1.3.tar.gz

Download URL litestar_rs-0.1.3.tar.gz
Size 169.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b1398630a765b1cad2079d9a8c1349a4a788d9eaef153593e727fd77534fc49c
BLAKE2b-256 checksum
How to use checksums
2c42b1efe06bbf2277a2dfe89ffa399421e4a5766c179e62a425e6fc9ada58bf
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.3-py3-none-any.whl

Download URL litestar_rs-0.1.3-py3-none-any.whl
Size 50.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
511477624294c44c2344480560c06d2ff5460046d522c571d3b15f9d797919d9
BLAKE2b-256 checksum
How to use checksums
645d6132d316b87274272f0f01a4a4507b21c9364a947be2e6be415bfb0ba8d5
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

This release

0.1.3 This release

2 release files

0.1.2

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