Skip to main content

Queuefy

Queuefy - Test Coverage License: MIT Python versions

Asynchronous task queue and scheduler for Python, where one task runs on exactly one worker.


🚀 Project

Queuefy is a task queue and a scheduler that are the same thing.

Everything it does reduces to a single row: a run that is due, which exactly one worker claims. An immediate task, an interval, a fixed datetime and a cron expression differ only in when the next run is written, and in nothing else.

That is why there is no separate scheduler process, no broker and no leader election. Start it on ten machines and the nightly report still runs once.

✨ Features

  • Run a task now, off the request that asked for it
  • Run a task every N seconds
  • Run a task once, at a stated date and time
  • Run a task on a cron expression
  • One run on exactly one worker, however many processes, workers and machines
  • Retries with fixed, linear, exponential and jittered policies
  • Timeouts, heartbeats and recovery of what a dead worker was holding
  • Named queues and priorities
  • Lifecycle hooks for auditing, metrics and alerting
  • Pluggable stores: PostgreSQL 14+, MySQL 8.0+, Redis 7+, SQLite and memory
  • Survives a kill: what a dead worker held comes back, and a schedule resumes where it stopped
  • No dependencies in the core
  • 100% branch coverage: one contract against every store, plus multi-worker, multi-machine, everyday, disaster and interrupted-call suites

📦 Install

pip install "queuefy[sqlalchemy]"

Or with Redis:

pip install "queuefy[redis]"

🧭 The four ways to ask for work

What you want How you ask for it
run it now await app.enqueue("send_email", to="a@b.com")
run it every 30 seconds @app.task("poll", every=30)
run it once, at a stated time await app.enqueue_at("report", when)
run it on a cron expression @app.task("nightly", cron="0 4 * * *")

💡 How to use

import asyncio

from sqlalchemy.ext.asyncio import create_async_engine

from queuefy.app import Queuefy
from queuefy.store.sqlalchemy import SqlAlchemyStore
from queuefy.worker import Worker

app = Queuefy(SqlAlchemyStore(create_async_engine("sqlite+aiosqlite:///app.db")))


@app.task("send_email", max_attempts=5, timeout=30)
async def send_email(to: str, subject: str):
    ...


@app.task("nightly_report", cron="0 4 * * *")
async def nightly_report():
    ...


async def main():
    await app.setup()
    await app.enqueue("send_email", to="reader@example.com", subject="Welcome")
    await Worker(app, concurrency=8).run()


asyncio.run(main())

🧱 The words it uses

Three of them, and each means one thing:

Word What it is
Task what you declare: a name, the code, and the policy it runs under
Run one execution of a task, which is the only thing a worker ever claims
Queue a named lane a task belongs to, and a worker serves

📚 Documentation

  • Getting started
  • Tasks — the four kinds, and what a name means
  • Workers — concurrency, leases and many machines
  • Retries and failures — policies, timeouts, permanent errors
  • Hooks — being told about every run
  • Stores — SQLAlchemy, Redis, memory, and writing your own
  • Frameworks — the rule that covers all of them, and what a handler may touch
    • FastAPI — a worker on the lifespan, and a handler that uses the session
    • Django — a management command, the ORM from a handler, and transactions
    • Flask — a worker in its own process, and the application context
  • Contribution — how to help

☕ Buy me a coffee

Support the continuous development of this project.

Buy Me a Coffee at ko-fi.com

📄 License

MIT

Copyright (c) 2026, Paulo Coutinho

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

queuefy-1.0.3.tar.gz (233.9 kB view details)

Uploaded Source

Built Distribution

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

queuefy-1.0.3-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file queuefy-1.0.3.tar.gz.

File metadata

  • Download URL: queuefy-1.0.3.tar.gz
  • Upload date:
  • Size: 233.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for queuefy-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d40b7204057df550ea7ad7c1ac18774918836b063325ee879368c2f031124561
MD5 d4dcc82a8a790a990e538856169cea2b
BLAKE2b-256 883419a713762cd0537fc4d083f3e36b090c5aacfd8cdd48f7f28c1fc2dc5fb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for queuefy-1.0.3.tar.gz:

Publisher: release.yml on paulocoutinhox/queuefy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file queuefy-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: queuefy-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for queuefy-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1b64ec9cf2594ad03b5d70411cd1b6bd73de1579bd988296034c26437767a07b
MD5 0c2cd826320cd5572c869e86e41bafe9
BLAKE2b-256 b852d740374ad4160989ad4fba51c83df50c1eb64563c13e1eed09757e1722b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for queuefy-1.0.3-py3-none-any.whl:

Publisher: release.yml on paulocoutinhox/queuefy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page