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.0.tar.gz (101.4 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.0-py3-none-any.whl (185.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qtasks-1.7.0.tar.gz
  • Upload date:
  • Size: 101.4 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.0.tar.gz
Algorithm Hash digest
SHA256 d99e89fac35f4f7da3301d7b16431ae962061206a5576d871d11aa0f0a39a52b
MD5 7cdcb186989db2ab1e4ff5e26cee5b35
BLAKE2b-256 bb02b5eae7e001950e8baba2d3daedcda994c4897db17bce67ebd45939f4272c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qtasks-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 185.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d89bf75859ed447d0c27f544ce616ab0219757bfd90ecd6014f7b34096de9e00
MD5 d3b9a8fa653467af232cc2acfc05a57d
BLAKE2b-256 861993caa0d045ca74e47ffa37f263c892230e4fde0f599ced5b35500dc23770

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