A modern distributed task queue for Python, built with asyncio and Redis.
- Async-first design with asyncio
- Priority queues with Redis sorted sets
- Automatic task retry on failure
- Concurrent task processing
- Simple decorator-based API
- Python 3.12+
- Redis (via Docker or local installation)
# Clone the repository
git clone https://github.com/mohammed-ysn/taskflow.git
cd taskflow
# Install with UV
uv pip install -e .docker-compose up -d- Define tasks:
from taskflow.core.task import task
@task(name="add")
def add(x: int, y: int) -> int:
return x + y- Submit tasks:
from taskflow.broker.redis_broker import RedisBroker
broker = RedisBroker()
await broker.connect()
await broker.send_task("add", task_id="task-1", args=(5, 3), kwargs={})- Start a worker:
uv run taskflow worker --queues default --concurrency 5Run the included example:
# Start Redis
docker-compose up -d
# Submit example tasks
uv run python -m examples.submit_tasks
# In another terminal, start worker
uv run python -m examples.worker_with_tasks# Install dev dependencies
uv pip install -e ".[dev]"
# Run linting
make lint
# Install pre-commit hooks
pre-commit install