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.2.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.2-py3-none-any.whl (180.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qtasks-1.7.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8473775f9a889f7b8d579e499725b2d6d9063ea381fcc0afbac075897e2f132b
MD5 60e669dcd08e5296dfbd5526982af550
BLAKE2b-256 5b8c623e660caf3d4d7423ea0e628e5ca3b8eb5b6c2c7650043ef9149902cc41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qtasks-1.7.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd77c72f23c5477b7042181b3bbbb71dcfbf2cf692752e3f540ac49aa956dc6d
MD5 1b01613bfe3913ffa73b1b0321e50aa8
BLAKE2b-256 1e37f7601e0f4ab35d587cffd260ae0126edb7cc6962317fbd0343079233cddf

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