Skip to main content

Queue Tasks Framework

Project description

QTasks

CI Docs PyPI Downloads Python License

QTasks is a modern task queue framework for Python with a component-based architecture and a focus on extensibility, transparency, and control over task execution. The project is aimed at both small services and complex distributed systems where standard solutions are redundant or inflexible.


Key features

  • Component-based architecture Broker, Worker, Storage, GlobalConfig, Starter — each component is isolated and fully replaceable.

  • Async and Sync tasks Support for asyncio, synchronous functions, and generators.

  • Plugins instead of rigid logic Retry, concurrency, logging, and execution strategies are implemented through plugins.

  • Typed data flow Data transfer between components via schemas (dataclasses).

  • Transparent testing In-memory brokers and storages, component isolation, tests without running workers.

  • CLI-first approach Manage startup and environment through CLI without hidden magic.


When to choose QTasks

  • You need full control over the queue architecture.
  • You need to write your own brokers, workers, and plugins.
  • Predictable behavior and minimalism of the core are important.
  • The project is growing and requires scalability without rewriting the logic.

Installation

Basic installation (Redis by default)

pip install qtasks

Additional brokers

RabbitMQ

pip install qtasks[rabbitmq]

Kafka

pip install qtasks[kafka]

Quick start

from qtasks import QueueTasks

app = QueueTasks()

@app.task(name="echo")
def echo(text: str) -> str:
    return text

@app.task(name="divide")
def divide(a: int, b: int):
    return a / b

if __name__ == "__main__":
    app.run_forever()

Calling tasks:

# echo.add_task("Hello", timeout=50).returning -> "Hello"
# divide.add_task(1, 0, timeout=50).status -> "ERROR"

Generators and streaming tasks

QTasks supports generator tasks without additional wrappers:

async def gen_handler(value: int) -> int:
    return value + 1

@app.task(generate_handler=gen_handler)
async def counter(n: int):
    for _ in range(n):
        n += 1
        yield n

Result of execution:

# await (counter.add_task(5, timeout=50)).returning -> [7, 8, 9, 10, 11]

CLI

Starting the worker:

qtasks -A qtasks_app:app run

Or directly:

python -m qtasks -A qtasks_app:app run

In the future, the CLI will be expanded (inspect, stats, monitoring).


Architecture (briefly)

┌──────────┐          ┌──────────┐
│  Broker  │ ───────▶ │          │
│          │          │          │
└────┬─────┘          │          │
     │                │ Storage  │
     ▼                │          │
┌──────────┐ ───────▶ │          │
│  Worker  │          │          │
│          │          └──────────┘
└──────────┘

Additionally:

  • plugins;
  • routers;
  • background components;
  • WebView (optional).

Documentation

👉 https://docs.qtasks.tech


Project status

  • Active development
  • Stable versions
  • Python 3.8–3.12
  • Open to contributions

License

MIT License

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

qtasks-1.7.1.tar.gz (98.0 kB view details)

Uploaded Source

Built Distribution

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

qtasks-1.7.1-py3-none-any.whl (180.7 kB view details)

Uploaded Python 3

File details

Details for the file qtasks-1.7.1.tar.gz.

File metadata

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

File hashes

Hashes for qtasks-1.7.1.tar.gz
Algorithm Hash digest
SHA256 f7c60703a232d72e940e45517ab0a63db3ab63ee034bcce89ff6e7501e091d0c
MD5 dc71c54207633472123419e5a8ca6b66
BLAKE2b-256 9461c87e67fdd340d68a7f9662da550af14b3e12a913cd6275d1a830f765f40f

See more details on using hashes here.

File details

Details for the file qtasks-1.7.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for qtasks-1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be69d83bc29626f7346b93870cd56c8ab0bab19c4092cd153960089f4e6453bb
MD5 967c136d98b332ee654dbc04147ad986
BLAKE2b-256 defc222e27acc8c9120e6aa80acf6116111a8bb1f5c7d1866e067efd8a073a04

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