Skip to content

TaskMQ Documentation

PyPI version CI

TaskMQ is a modern, developer-friendly Python task queue and job processing framework for background jobs, automation, and scalable systems.

Features

  • Simple CLI and REST API for job management
  • Decorator-based custom handler registration
  • Pluggable storage backends (SQLite, Redis)
  • Configurable retry policies and job scheduling
  • JWT authentication and Prometheus metrics
  • Full async handler support

Documentation

Guide Description
Quick Start Get up and running in 5 minutes
Usage Guide Detailed CLI and library usage
Writing Handlers Create custom job handlers
API Reference REST API endpoints and authentication
Contributing Development setup and guidelines

Installation

pip install task-mq

# With Redis support
pip install task-mq[redis]

Quick Example

from taskmq.jobs.handlers import register_handler
from taskmq.worker import Worker
from taskmq.storage.sqlite_backend import SQLiteBackend

@register_handler("greet")
def greet_handler(job):
    name = job.payload.get("name", "World")
    return f"Hello, {name}!"

backend = SQLiteBackend()
backend.insert_job('{"name": "TaskMQ"}', handler="greet")

worker = Worker(max_workers=1, backend=backend)
worker.start()

Author: Varun Gupta