Lightweight background task scheduler — no Celery needed
Project description
cronify
Lightweight background task scheduler for Python — no Celery needed
Install
pip install cronify
Usage
from cronify import Scheduler
scheduler = Scheduler()
@scheduler.every(minutes=5)
async def cleanup_expired_tokens():
await db.execute("DELETE FROM tokens WHERE expires_at < now()")
@scheduler.every(hours=1, run_immediately=True)
async def sync_exchange_rates():
rates = await fetch_rates()
await cache.set("rates", rates)
# Start in your FastAPI app:
@app.on_event("startup")
async def startup():
await scheduler.start()
Features
@scheduler.every(seconds=30)— decorator syntax- Async and sync functions supported
- Error resilient — one failing job doesn't stop others
- No Redis, no Celery, no external broker
- Pure asyncio — works everywhere Python runs
run_immediately=Truefor instant first execution- Zero dependencies
API
scheduler.every(seconds=30) # every 30 seconds
scheduler.every(minutes=5) # every 5 minutes
scheduler.every(hours=1) # every hour
scheduler.every(hours=1, minutes=30) # every 1.5 hours
scheduler.every(seconds=10, run_immediately=True) # run now, then every 10s
await scheduler.start() # start all jobs
await scheduler.stop() # cancel all jobs
scheduler.jobs # list registered jobs
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 cronify_scheduler-0.1.0.tar.gz.
File metadata
- Download URL: cronify_scheduler-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb2ef33fe4f84439927d59aa03d24fbf49542c656ffcaaecd029996f1fd792b9
|
|
| MD5 |
f67ae5bba30125f8902f7be8da866172
|
|
| BLAKE2b-256 |
3634f662765fbfd2bf98f9760228c785c22e47b038583cdc609c567c21dd9728
|
File details
Details for the file cronify_scheduler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cronify_scheduler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5527737b237b1c6756a3625136bd207a157c79ceeef6dbb0c35999963a34840d
|
|
| MD5 |
4047353cbe94b7f9a968383c62db0998
|
|
| BLAKE2b-256 |
d4c1dd5d78b68e81f4cbaab344e66922a80072dcd07d8214c2cb3b6cf6e036bd
|