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

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.1
File Size Uploaded
litestar_rs-0.1.1.tar.gz 164.5 kB Details

Built distribution (wheel)

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

Total release size: 214.1 kB

Release files / litestar_rs-0.1.1.tar.gz

Download URL litestar_rs-0.1.1.tar.gz
Size 164.5 kB
Tags Source
SHA-256 checksum
How to use checksums
55fddb7f65eb7efbca14a325da2062eee7875e2a2c46387abdd35d870bad1b39
BLAKE2b-256 checksum
How to use checksums
f4c037a3489a6151ae60d1f68fb891da1afb6ff0e1676713bb7296a411afabc1
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.1-py3-none-any.whl

Download URL litestar_rs-0.1.1-py3-none-any.whl
Size 49.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48b2d93d60323d0794256bb7cec916c1c4dd19ec281fec203afd2e8e33bd726e
BLAKE2b-256 checksum
How to use checksums
50da4d9e94c2187e3365999a73048a55106874efe1b9d43b739e7cc95606da50
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

This release

0.1.1 This release

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