Lightweight persistent job scheduler for Python
Project description
whenly
Lightweight persistent job scheduler for Python — SQLite-backed, minimal dependencies.
from whenly import Scheduler
s = Scheduler()
@s.every(5, "minutes")
def sync_data():
...
@s.cron("0 9 * * MON")
def weekly_report():
...
s.start() # background thread
Features
- SQLite persistence — jobs survive restarts
- Cron expressions via croniter
- Interval scheduling — every N seconds/minutes/hours
- One-off delayed jobs — run once after a delay
- Decorator or programmatic API
- Thread-safe background runner
- CLI for basic management
- Zero external dependencies (except croniter for cron support)
Install
pip install whenly
Quick Start
from whenly import Scheduler
s = Scheduler()
# Interval jobs
@s.every(30, "seconds")
def poll_api():
print("Polling...")
# Cron jobs
@s.cron("0 */2 * * *")
def cleanup():
print("Running cleanup...")
# One-off delayed job
@s.later(10, "minutes")
def send_notification():
print("Hello!")
# Or pass a function directly
s.later(30, "seconds", func=poll_api)
# Start the scheduler (non-blocking)
s.start()
# Or run blocking
# s.run()
Programmatic API
s.add(poll_api, every="60s")
s.add(cleanup, cron="0 3 * * *")
s.disable("poll")
s.enable("poll")
s.run_now("poll_api")
print(s.jobs)
CLI
whenly list
whenly run
License
MIT
Part of the thecliffhanger open source suite.
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
whenly-0.5.0.tar.gz
(25.1 kB
view details)
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
whenly-0.5.0-py3-none-any.whl
(12.0 kB
view details)
File details
Details for the file whenly-0.5.0.tar.gz.
File metadata
- Download URL: whenly-0.5.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf85edfa3b4c9b8ca5dc4233253a38bb98093c7158ba90d1a3f03cd206b3f93e
|
|
| MD5 |
a9c25a430fb94663e9cff7b05cb28bcd
|
|
| BLAKE2b-256 |
bd2a231d1a04fdcc42a3c822d9a8e4654246f2d87deeeedfd0ee6c3347cd325f
|
File details
Details for the file whenly-0.5.0-py3-none-any.whl.
File metadata
- Download URL: whenly-0.5.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02e12575a682e051e3b3ef01f563cf33316aadbfa42ed52f5b6bac3df90a2bf5
|
|
| MD5 |
27ec27216fb8f733446b2dfc5b9825c6
|
|
| BLAKE2b-256 |
0d6d386aeabd7b84b7af0d664f707288700b32a8a6b8ea41f50bc0dc0b4c0b2f
|