AsyncTasQ
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
- Installation – Installation instructions
- Configuration – Complete configuration guide
- Environment Variables – .env file support and configuration
- Task Definitions – Function-based and class-based tasks
- Queue Drivers – Redis, PostgreSQL, MySQL, RabbitMQ, AWS SQS
- Running Workers – CLI and programmatic workers
- Monitoring – Event streaming and queue statistics
- ORM Integrations – SQLAlchemy, Django, Tortoise
- Framework Integrations – FastAPI integration
- CLI Reference – Command reference
- Best Practices – Production guidelines
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 and IDE support, 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 type hints and IDE 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 | ✅ Full type hints and IDE support | ⚠️ 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: Repository • Issues • Discussions
Built with ❤️ by Adam Refaey
Metadata
Release files for asynctasq 1.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asynctasq-1.7.0.tar.gz | 120.8 kB | Without provenance | Details for asynctasq-1.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asynctasq-1.7.0-py3-none-any.whl | Python 3 | none | any | Details for asynctasq-1.7.0-py3-none-any.whl |
Total release size: 280.0 kB
Release files / asynctasq-1.7.0.tar.gz
| Download URL | asynctasq-1.7.0.tar.gz |
|---|---|
| Size | 120.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7daf4b31e7c7bd952014181a10dbbb56631cb81fceecb5326967cb31a99dc93e
|
|
BLAKE2b-256 checksum How to use checksums |
ebf816cc2d2b8d7c8410e88ed82e3880c08b19381bebf76d171f6f23f9089607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / asynctasq-1.7.0-py3-none-any.whl
| Download URL | asynctasq-1.7.0-py3-none-any.whl |
|---|---|
| Size | 159.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1cc5b391b974c3c5262a93a6b72eee66f129c5df627ca7b8105693d914ac225
|
|
BLAKE2b-256 checksum How to use checksums |
425461c12f288c9b160aad4eee02ffe8faa81ef8e3bd08ed8b11b1d68df46adf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for asynctasq 1.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.