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.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 litestar-rs 0.1.0
File Size Uploaded
litestar_rs-0.1.0.tar.gz 164.1 kB Details

Built distribution (wheel)

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

Total release size: 213.6 kB

Release files / litestar_rs-0.1.0.tar.gz

Download URL litestar_rs-0.1.0.tar.gz
Size 164.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bb7d4bc63c47dd1ab51b05f59ca086a724a656b59160c913316e2af22a0eaabc
BLAKE2b-256 checksum
How to use checksums
83bf242f8e7d7ffe499b9f80356deb49001727413600e709a8ce0b4025946462
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.0-py3-none-any.whl

Download URL litestar_rs-0.1.0-py3-none-any.whl
Size 49.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42945dbb2988f3df85f5d36ee665b03aef10877e2122995b06018653bdd8d012
BLAKE2b-256 checksum
How to use checksums
4d4eab5f4e40116ae1e3db5048cae10727aa580aec1a8359b37ac7f5da1b6d30
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

0.1.2

2 release files

0.1.1

2 release files

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