Skip to main content

AsyncTasQ: A modern, async-first, type-safe task queue Python package inspired by Laravel. Runs on uvloop for maximum performance. Native FastAPI integration. Switch between multiple queue backends (Redis, PostgreSQL, MySQL, RabbitMQ, AWS SQS) with one config line. Automatic, smart ORM serialization (SQLAlchemy, Django, Tortoise) using msgpack reduces payloads by 90%+.

Project description

AsyncTasQ

Tests Coverage Python Version PyPI Version License: MIT

A modern, async-first, type-safe task queue for Python. Built with asyncio, featuring 5 queue backends (Redis, PostgreSQL, MySQL, RabbitMQ, AWS SQS), automatic ORM serialization, and enterprise-grade reliability.

Table of Contents

Quick Start

# Install with your preferred driver
uv add "asynctasq[redis]"

# Configure environment
asynctasq publish  # Generate .env.example template
cp .env.example .env  # Edit with your settings

Define and dispatch tasks:

from asynctasq import init, run, task

init()  # Loads from .env

@task
async def send_email(to: str, subject: str):
    print(f"Sending to {to}: {subject}")
    return f"Email sent to {to}"

# Dispatch tasks
async def main():
    task_id = await send_email(to="user@example.com", subject="Welcome!").dispatch()
    print(f"Task dispatched: {task_id}")

if __name__ == "__main__":
    run(main())

Run workers:

uv run asynctasq worker --queues default

See the full Quick Start guide for complete examples with Redis setup, class-based tasks, and configuration chaining.

Documentation

Examples:

Why AsyncTasQ?

True async-first architecture – Built with asyncio from the ground up, not retrofitted onto sync foundations like Celery/RQ. Four execution modes (async I/O, sync I/O, async CPU, sync CPU) for optimal performance.

Intelligent serialization – Automatic ORM model handling (SQLAlchemy, Django, Tortoise) with msgpack encoding reduces payloads by 90%+. Pass models directly as task arguments.

Enterprise reliability – ACID guarantees (PostgreSQL/MySQL), dead-letter queues, crash recovery via visibility timeouts, graceful shutdown, and real-time event streaming.

Zero vendor lock-in – 5 production backends (Redis, PostgreSQL, MySQL, RabbitMQ, AWS SQS) with identical API. Switch drivers with one config line.

Developer experience – Type-safe with Generic[T], elegant Laravel-inspired API, method chaining, beautiful Rich-formatted output, and first-class FastAPI integration.

Key Features

  • Async-first with native asyncio throughout
  • 5 queue backends: Redis, PostgreSQL, MySQL, RabbitMQ, AWS SQS
  • Type-safe with full Generic[T] support
  • 4 execution modes: async I/O, sync I/O (threads), CPU-bound (processes)
  • ORM integration: Auto-serialization for SQLAlchemy, Django, Tortoise
  • msgpack serialization: 2-3x faster than JSON
  • ACID guarantees (PostgreSQL/MySQL)
  • Dead-letter queues for failed task inspection
  • Environment & .env file support
  • FastAPI integration with lifecycle management
  • Real-time event streaming via Redis Pub/Sub
  • Beautiful console output with Rich formatting
  • Graceful shutdown with signal handlers
  • Configurable retries with custom logic hooks

Comparison with Alternatives

AsyncTasQ differentiates itself with true async-first architecture, ORM auto-serialization, 5 production backends (Redis, PostgreSQL, MySQL, RabbitMQ, SQS), ACID guarantees, and dead-letter queues.

Feature AsyncTasQ Celery ARQ Dramatiq RQ Huey
Async ✅ Native ❌ No ✅ Yes ⚠️ Limited ❌ No ⚠️ Limited
Type Safety ✅ Generic[T] ⚠️ External ✅ Yes ✅ Yes ✅ Yes ⚠️ Limited
Backends 5 3 1 2 1 4
ORM Auto-serialization ✅ Yes ❌ No ❌ No ❌ No ❌ No ❌ No
ACID ✅ Yes ❌ No ❌ No ❌ No ❌ No ❌ No
DLQ ✅ Built-in ⚠️ Manual ❌ No ✅ Yes ❌ No ❌ No
FastAPI ✅ Native ⚠️ Manual ⚠️ Manual ⚠️ Manual ⚠️ Manual ⚠️ Manual

Choose AsyncTasQ for: Modern async apps (FastAPI, aiohttp), type-safe codebases, automatic ORM handling, enterprise ACID requirements, multi-backend flexibility.

Choose alternatives for: Mature ecosystems with many plugins (Celery), cron scheduling (Huey, ARQ), simple sync applications (RQ), or existing large codebases.

Contributing

See CONTRIBUTING.md for setup and development workflow:

just init        # One-line setup with deps and hooks
just docker-up   # Start Redis, PostgreSQL, MySQL, RabbitMQ, LocalStack
just test        # Run all tests (or just test-unit / just test-integration)
just ci          # Full CI suite locally

Roadmap

  • SQLite & Oracle drivers
  • Task chaining & workflows
  • Rate limiting & task priority
  • Scheduled/cron tasks

License & Support

MIT License – see LICENSE.

Links: RepositoryIssuesDiscussions

Built with ❤️ by Adam Refaey

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

asynctasq-1.6.0.tar.gz (120.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asynctasq-1.6.0-py3-none-any.whl (159.4 kB view details)

Uploaded Python 3

File details

Details for the file asynctasq-1.6.0.tar.gz.

File metadata

  • Download URL: asynctasq-1.6.0.tar.gz
  • Upload date:
  • Size: 120.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asynctasq-1.6.0.tar.gz
Algorithm Hash digest
SHA256 f00c807c57dc179990d66f93fae50cf40eefd67b235be26f358cfd5d57f2ea20
MD5 2814da8af1ed03479c1e72080cd33036
BLAKE2b-256 d8a060c3bfef89198e7c0393e9feb84d5a6cc5ed7858325430a6b7a4df6b3afb

See more details on using hashes here.

File details

Details for the file asynctasq-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: asynctasq-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 159.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asynctasq-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16b0aca3d8a6ee2f12f3f6bf1aedcf847a3c3bda43a300782e32d15927bc009e
MD5 bb4e860b3d7b44c342309163594390c8
BLAKE2b-256 679dabd8ba4688993d319ddcd7cfe4d0a5e86b50bf741f07e87c8deb4fb06fae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page