litestar-saq
Installation
SKILL.md
litestar-saq
litestar-saq is the first-party plugin that integrates SAQ (Simple Async Queue) with Litestar. It provides:
SAQPlugin— registers queues, workers, lifespan management, and DI forTaskQueuesSAQConfig/QueueConfig— declarative plugin, queue, worker, broker, shutdown, polling, and OpenTelemetry configurationlitestar workers run— CLI to start worker processes, optionally filtered by queue- Optional web UI mounted under the Litestar app
- DI injection of
TaskQueuesinto route handlers for ergonomic enqueueing
Code Style Rules
- Use PEP 604 unions:
T | None, neverOptional[T] - Consumer Litestar app modules MAY use
from __future__ import annotations— canonical Litestar apps do. - Async all I/O — task bodies and enqueue calls are
async def. - First positional arg of every task is
ctx: dict(the SAQ context dict). - Task params after
*are keyword-only. - Use
NamedDependency[TaskQueues]for handler injection.TaskQueuesis registered under thetask_queuesdependency key, and Litestar 2.24 deprecates implicit DI.