Quiv: threadpool-backed scheduler for Python applications
Project description
quiv is a lightweight background task scheduler for Python applications.
It is designed to work especially well with FastAPI apps that need predictable, in-process background task orchestration.
Supports Python 3.10 through 3.14.
It provides:
- threadpool-backed execution
- support for sync and async task handlers
- cooperative cancellation (
_stop_event) - progress callbacks routed to your main async loop (
_progress_hook) - persistent task/job state via SQLModel + SQLite
When to use quiv
Use quiv when you need in-process background scheduling for app-level jobs,
for example:
- polling APIs every N seconds
- periodic cleanup tasks
- one-shot delayed jobs
- progress-aware long-running workloads
Install
uv add quiv
# or
pip install quiv
Quick start
from contextlib import asynccontextmanager
from fastapi import FastAPI
from quiv import Quiv
scheduler = Quiv(timezone="UTC")
def ping(_progress_hook=None):
for i in range(30):
# do some work
if _progress_hook:
_progress_hook(message="ping", progress=i, total=30)
async def on_progress(**payload):
# Replace with websocket broadcast, logging, metrics, etc.
print("progress", payload)
@asynccontextmanager
async def lifespan(app: FastAPI):
# Startup
scheduler.start()
yield
# Shutdown
scheduler.shutdown()
app = FastAPI(lifespan=lifespan)
@app.post("/start-heartbeat")
def start_heartbeat():
scheduler.add_task(
task_name="heartbeat",
func=ping,
interval=30,
progress_callback=on_progress,
)
return {"message": "Heartbeat started successfully!"}
Documentation
Full documentation is available at nandyalu.github.io/quiv.
- Getting Started
- Bigger Applications
- API Reference
- Architecture
- Progress Callbacks
- Cancellation
- Exceptions
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quiv-0.3.2.tar.gz.
File metadata
- Download URL: quiv-0.3.2.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80bc4e4db35ae6c613cc9af7c7e14f7f7783fb8ea94540903ceeee8928c58e71
|
|
| MD5 |
50a794ba53823cd30bc3b55fb1da083e
|
|
| BLAKE2b-256 |
04219a9909f3e993029bd9d26bd88db1bf2492c01620cd3e7089f5c5ca1721df
|
File details
Details for the file quiv-0.3.2-py3-none-any.whl.
File metadata
- Download URL: quiv-0.3.2-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9d846f65f843763674ca5ed658da966682b2ce0d651d8bad5995741193878ba
|
|
| MD5 |
be16a43b94ee0c0b97fd01aff1a07420
|
|
| BLAKE2b-256 |
f11600ad105e032d6d9757f675426a15834c7035120d823b6e30c214537dbfe6
|