Litestar Queues
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. The default in-memory queue and in-app worker are ideal for this first run.
Production boundary
Choose where tasks are stored separately from where they run. The default memory backend stores tasks in one Python process. If the web app and worker run in separate processes, 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. Cloud Run runs tasks; it does not store them.
Next steps
- Start here
- Understand the model
- Follow a how-to guide
- Choose backends
- Run an example
- Browse the API reference
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file litestar_queues-0.4.0.tar.gz.
File metadata
- Download URL: litestar_queues-0.4.0.tar.gz
- Upload date:
- Size: 746.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8587d75e38e796f5c8285546c56fb61563dff138e0df314220e4b33a7c6461cc
|
|
| MD5 |
f56f6af7080d5d23c2cbc5683d03217a
|
|
| BLAKE2b-256 |
281c7d90cf2f9937568814f0a5587d93e66cc8aca697095582a0167472de6399
|
Provenance
The following attestation bundles were made for litestar_queues-0.4.0.tar.gz:
Publisher:
publish.yml on cofin/litestar-queues
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_queues-0.4.0.tar.gz -
Subject digest:
8587d75e38e796f5c8285546c56fb61563dff138e0df314220e4b33a7c6461cc - Sigstore transparency entry: 2212206374
- Sigstore integration time:
-
Permalink:
cofin/litestar-queues@b83fa4ed5f5f8fe57a68b2b8bc7e99ed305409e7 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/cofin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b83fa4ed5f5f8fe57a68b2b8bc7e99ed305409e7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file litestar_queues-0.4.0-py3-none-any.whl.
File metadata
- Download URL: litestar_queues-0.4.0-py3-none-any.whl
- Upload date:
- Size: 201.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c985aa082028fdf2f22619270f70e6cc7f892e7686ac1023173dc54a5d67e48
|
|
| MD5 |
9c6960ae634e05d9aca62c2b76464bf6
|
|
| BLAKE2b-256 |
f4d9a420b7336736b4bf1edbfa40272137331ccb7b5a8b7705c96f85744e99fd
|
Provenance
The following attestation bundles were made for litestar_queues-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on cofin/litestar-queues
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_queues-0.4.0-py3-none-any.whl -
Subject digest:
0c985aa082028fdf2f22619270f70e6cc7f892e7686ac1023173dc54a5d67e48 - Sigstore transparency entry: 2212206392
- Sigstore integration time:
-
Permalink:
cofin/litestar-queues@b83fa4ed5f5f8fe57a68b2b8bc7e99ed305409e7 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/cofin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b83fa4ed5f5f8fe57a68b2b8bc7e99ed305409e7 -
Trigger Event:
release
-
Statement type: