Task Queues

Libraries for working with task queues.

Two questions pick a Python task queue: is your app async, and what's your broker? Taskiq is for asyncio. Celery takes RabbitMQ or Redis, RQ Redis, Huey SQLite.

How to choose:

  • An asyncio app, like FastAPI: Taskiq
  • A batteries-included queue on RabbitMQ, Redis, or Amazon SQS, or tasks sent from non-Python code: Celery
  • The simplest job queue, on Redis or Valkey: RQ
  • No broker server to run, with the queue in SQLite or the Postgres you already have: Huey
  • A production backend for Django's task framework: Huey
  • Retries with backoff and acks after processing by default, on RabbitMQ or Redis: Dramatiq

Listed in editorial order. Click a column header to re-sort the whole list.

Press / to search. Tags open their category. Click a row for details.

Search and filter

Results

Row number Tags
An asynchronous task queue/job queue based on distributed message passing.
celery/github.com/celery/celery /29,091 stars /
Simple job queues for Python.
rq/github.com/rq/rq /10,698 stars /
A fast and reliable background task processing library for Python 3.
Bogdanp/github.com/Bogdanp/dramatiq /5,335 stars /
A little task queue with multi-process, multi-thread, or greenlet workers.
coleifer/github.com/coleifer/huey /6,057 stars /
Distributed task queue with native asyncio support and pluggable brokers.

Task Queues guide

Taskiq's docs call it an asyncio Celery implementation: you mark tasks with @broker.task and send them with await task.kiq(). Since sending is async only, its docs point fully synchronous projects to Celery or Dramatiq. For production, its docs highly recommend taskiq-aio-pika or taskiq-nats as the broker and taskiq-redis as the result backend. In a FastAPI app, taskiq-fastapi connects the broker to your app.

Celery is a task queue with batteries included: celery beat runs periodic tasks, and Django support comes out of the box. It runs on RabbitMQ, Redis, or Amazon SQS. Its docs call RabbitMQ an excellent choice for production and warn that Redis is more likely to lose data on a sudden shutdown or power failure. Its protocol has clients in other languages, so non-Python code can send tasks too. Celery doesn't support Windows, though.

RQ is a simple job queue on Redis or Valkey, built for a low barrier to entry. Any Python function call can go on a queue, and there are no queues, exchanges, or routing rules to set up first. Jobs are pickled, so RQ is Python-only. Put job functions in a module the worker can import, not in __main__, and run workers on the same source code as your app. Start workers with rq worker --with-scheduler to run jobs you schedule with enqueue_in or enqueue_at.

Huey is a lightweight alternative with zero dependencies, and its queue can live in Redis, Postgres, SQLite, files, or memory. Its docs match the storage to your workload: Redis for busy workloads, SQLite for moderate ones without a separate server, and Postgres when your app already runs it. Recurring tasks come built in with the periodic_task() decorator. For Django, Huey has its own integration, and it provides a production backend for Django's task framework.

Dramatiq aims for sane defaults for most SaaS workloads on RabbitMQ or Redis. Mark a function with @dramatiq.actor and enqueue it with .send(), passing only JSON-encodable arguments. When an actor raises, Dramatiq retries it with exponential backoff. It acknowledges a message only after processing it, while Celery by default does so just before running the task. For cron-style jobs, pair it with a separate scheduler. Dramatiq is licensed under the LGPL.

Make tasks safe to run twice: after a worker failure, the same message can arrive again. Pass a task the ID of a database row rather than the object, and re-fetch it when the task runs, since old data leads to race conditions. In Django, enqueue a task only after the transaction commits, with Celery's delay_on_commit() or Huey's on_commit_task(). With celery beat, Huey, or Taskiq, run only one scheduler for periodic tasks, or you'll get duplicate tasks. In production, run workers under a process manager.

Know a project that belongs here?

Tell us what it does and why it stands out.