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.3.tar.gz (98.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.3-py3-none-any.whl (181.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qtasks-1.7.3.tar.gz
  • Upload date:
  • Size: 98.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.3.tar.gz
Algorithm Hash digest
SHA256 8a481752ee301244bac5b7dbdeecae4d258dcfaedb15901157d77d3a2bfcb15f
MD5 4df41de29aaf732358015f8c8a71fede
BLAKE2b-256 d8b63fb157a6b3bf1c1d94e6cffb21bd478eef1facbe2347e469a41e7f33314d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qtasks-1.7.3-py3-none-any.whl
  • Upload date:
  • Size: 181.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7f8490afcb579fb27fe22ae5f0483fbb0933b083c563fe6e498b156a1f0a0734
MD5 3ae8a00183e5084d44512ec5ab80d798
BLAKE2b-256 ae6577e2bf0f285f0e1b07c453943ff64d503aa6d0dc2ca8b5eb2a15d33a5c56

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