Skip to main content

Litestar Queues

PyPI Python License CI Docs

Litestar Queues lets a Litestar application persist work, run it in a worker, and inspect the result. Use it for work that should outlive the request that started it: sending email, importing files, refreshing reports, or calling a slow service.

Quickstart

Install the package:

pip install litestar-queues

Create app.py:

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

from litestar_queues import QueueConfig, QueuePlugin, QueueService, task


@task("accounts.sync", queue="accounts", timeout=30)
async def sync_account(account_id: str) -> dict[str, str]:
    return {"account_id": account_id, "status": "synced"}


@post("/accounts/{account_id:str}/sync")
async def create_sync_job(account_id: str, queue_service: NamedDependency[QueueService]) -> dict[str, str]:
    result = await queue_service.enqueue(sync_account, account_id)
    return {"task_id": str(result.id), "status": result.status or "pending"}


app = Litestar(route_handlers=[create_sync_job], plugins=[QueuePlugin(config=QueueConfig())])

Run the application:

LITESTAR_APP=app:app litestar run --reload

Enqueue a task:

curl -X POST http://127.0.0.1:8000/accounts/acct-123/sync

The response contains a task ID and an initial status. QueueConfig() starts one fresh queue-worker child for this litestar run invocation and shares a private temporary SQLite file with it. No queue socket or port is exposed, and the temporary queue is removed on normal shutdown; it is not durable across server restarts.

Production boundary

Choose where tasks are stored separately from where they run. For durable deployments use a shared backend such as SQLSpec, Advanced Alchemy, Redis, or Valkey. Use standalone workers when the web app and task workers must scale separately. The process-local memory backend remains useful for inline tests or an explicitly single-ASGI-process worker. Cloud Run runs tasks; it does not store them.

Next steps

Litestar Queues supports Python 3.10 through 3.14 and is licensed under MIT.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

litestar_queues-0.11.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litestar_queues-0.11.0-py3-none-any.whl (402.4 kB view details)

Uploaded Python 3

File details

Details for the file litestar_queues-0.11.0.tar.gz.

File metadata

  • Download URL: litestar_queues-0.11.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for litestar_queues-0.11.0.tar.gz
Algorithm Hash digest
SHA256 a2b88e1df95ee8526806b181f840883c4d7f6af6185d05b5f2e21cc24b299cf2
MD5 45401d432daf666695355d1a867d55ac
BLAKE2b-256 de2ef59415bfeb5b4ec87f2329acc85e3ca73b3751395b7d87d0bfe2ce7772e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_queues-0.11.0.tar.gz:

Publisher: publish.yml on cofin/litestar-queues

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file litestar_queues-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for litestar_queues-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f45417c7200862d7b282ecc6506d919d77619c628a4ee0d74635f36e45e117a
MD5 acb1e0cfa6661bfb26d96b449de677df
BLAKE2b-256 0a1191a3a3cad3ab61b89805b7acf95e3e760ddaeffc219fc0dd84e16af28bf9

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_queues-0.11.0-py3-none-any.whl:

Publisher: publish.yml on cofin/litestar-queues

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 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