Add your description here
Project description
A lightweight, Async-first task queue built on Redis.
Installation
pip install ltq
# or
uv add ltq
Quick Start
import asyncio
import ltq
worker = ltq.Worker(url="redis://localhost:6379")
@worker.task()
async def send_email(to: str, subject: str, body: str) -> None:
# your async code here
pass
async def main():
# Enqueue a task
await send_email.send("user@example.com", "Hello", "World")
# Or enqueue in bulk
messages = [
send_email.message("a@example.com", "Hi", "A"),
send_email.message("b@example.com", "Hi", "B"),
]
await send_email.send_bulk(messages)
asyncio.run(main())
Each task gets its own queue by default. To share a queue between tasks, pass queue_name:
@worker.task(queue_name="emails")
async def send_email(...): ...
@worker.task(queue_name="emails")
async def send_newsletter(...): ...
Running Workers
# Run a worker
ltq myapp:worker
# With options
ltq myapp:worker --concurrency 100 --log-level DEBUG
Middleware
Add middleware to handle cross-cutting concerns:
from ltq.middleware import Retry, RateLimit, Timeout
worker = ltq.Worker(
url="redis://localhost:6379",
middlewares=[
Retry(max_retries=3, min_delay=1.0),
RateLimit(requests_per_second=10),
Timeout(timeout=30.0),
],
)
Built-in: Retry, RateLimit, Timeout, Sentry (requires ltq[sentry])
Custom middleware:
from ltq.middleware import Middleware, Handler
from ltq.message import Message
class Logger(Middleware):
async def handle(self, message: Message, next_handler: Handler):
print(f"Processing {message.task}")
result = await next_handler(message)
print(f"Completed {message.task}")
return result
Project details
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 ltq-0.1.2.tar.gz.
File metadata
- Download URL: ltq-0.1.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d71997c6641a7bf431b2668e6986f3020e109c349d56330e1e1addae7a854ed9
|
|
| MD5 |
b5ffac14766720ffb3e9c857f50f9bad
|
|
| BLAKE2b-256 |
7916024ae31c40301b8beb3125c3a83acc6a32b4698e92f08df7e465c99da732
|
Provenance
The following attestation bundles were made for ltq-0.1.2.tar.gz:
Publisher:
publish.yml on tclesius/ltq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ltq-0.1.2.tar.gz -
Subject digest:
d71997c6641a7bf431b2668e6986f3020e109c349d56330e1e1addae7a854ed9 - Sigstore transparency entry: 854691857
- Sigstore integration time:
-
Permalink:
tclesius/ltq@901ec87884b3f48a6e70ab2f35d121512cad756e -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/tclesius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@901ec87884b3f48a6e70ab2f35d121512cad756e -
Trigger Event:
release
-
Statement type:
File details
Details for the file ltq-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ltq-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfbb6d368f6b764f261b4129c09208eb5e5160910de503e01a55fb59ececefdb
|
|
| MD5 |
f86827531be3193f1c8d10a0a982cf03
|
|
| BLAKE2b-256 |
d249f76257b2335ba747336bb102badbc892b6240a205db53528ca556a093289
|
Provenance
The following attestation bundles were made for ltq-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on tclesius/ltq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ltq-0.1.2-py3-none-any.whl -
Subject digest:
dfbb6d368f6b764f261b4129c09208eb5e5160910de503e01a55fb59ececefdb - Sigstore transparency entry: 854691867
- Sigstore integration time:
-
Permalink:
tclesius/ltq@901ec87884b3f48a6e70ab2f35d121512cad756e -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/tclesius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@901ec87884b3f48a6e70ab2f35d121512cad756e -
Trigger Event:
release
-
Statement type: