Lightweight decorator-based task scheduler for Python, built on APScheduler
Project description
orbi-sched
A lightweight task scheduler for Python, built on APScheduler. Decorate any function with @orbi_task to schedule it — no broker, no worker daemon, no configuration files required.
Installation
pip install orbi-sched
# or with uv
uv add orbi-sched
Requires: Python 3.12+
Quick Start
from orbi_task.scheduler import orbi_task, get_scheduler
# Run once at a specific datetime
@orbi_task(trigger="date", time="2026-04-01 09:00:00")
def send_report():
print("Sending daily report...")
# Run every weekday at 08:30
@orbi_task(trigger="cron", day_of_week="mon-fri", hour=8, minute=30)
def morning_sync():
print("Syncing data...")
# Keep the process alive
import time
while True:
time.sleep(5)
API Reference
@orbi_task
@orbi_task(
trigger: Literal["date", "cron"] = "cron",
*,
time: str | None = None, # "YYYY-MM-DD HH:MM:SS" — date trigger only
day_of_week: str | None = None, # e.g. "mon", "mon-fri", "0,2,4"
hour: int | None = None,
minute: int | None = None,
**kwargs, # passed directly to APScheduler trigger
)
Registers the decorated function as a scheduled job. The function runs in a background thread managed by APScheduler.
| Parameter | Trigger | Description |
|---|---|---|
trigger |
both | "date" for one-shot, "cron" for recurring |
time |
date only |
Exact datetime string to run the job |
day_of_week |
cron |
Days to run (APScheduler cron syntax) |
hour |
cron |
Hour of day (0–23) |
minute |
cron |
Minute of hour (0–59) |
**kwargs |
both | Any additional APScheduler trigger arguments |
The job ID is automatically set to orbi_{function_name}. Re-decorating with the same function name replaces the existing job.
Note: The wrapper returned by the decorator is a no-op. Jobs are registered at decoration time and run in the background scheduler — calling the decorated function directly does nothing.
get_scheduler() -> BackgroundScheduler
Returns the global singleton BackgroundScheduler instance, initializing it on first call. Use this to inspect, pause, or shut down the scheduler:
sched = get_scheduler()
sched.print_jobs() # list all registered jobs
sched.shutdown(wait=True) # graceful shutdown
Defaults set on the scheduler:
misfire_grace_time: 60 seconds — a job that missed its window by less than 60s will still runcoalesce:True— if multiple runs were missed, only one catch-up run firestimezone:Asia/Kolkata(IST)
Execution Logs
The scheduler emits structured console output on every job event:
🔥 Job 'orbi_morning_sync' executed at 2026-04-01 08:30:00+05:30 (next: 2026-04-02 08:30:00+05:30)
💥 Job 'orbi_send_report' ERROR: <exception message>
Graceful Shutdown
import signal, sys
from orbi_task.scheduler import get_scheduler
def shutdown(sig, frame):
get_scheduler().shutdown(wait=True)
sys.exit(0)
signal.signal(signal.SIGINT, shutdown)
signal.signal(signal.SIGTERM, shutdown)
Trigger Examples
# One-shot: run at a specific time
@orbi_task(trigger="date", time="2026-06-15 14:00:00")
def one_time_task(): ...
# Every day at midnight
@orbi_task(trigger="cron", hour=0, minute=0)
def nightly_cleanup(): ...
# Every Monday and Wednesday at 10:15
@orbi_task(trigger="cron", day_of_week="mon,wed", hour=10, minute=15)
def twice_weekly(): ...
Dependencies
| Package | Version |
|---|---|
apscheduler |
>=3.11.2 |
License
MIT — see LICENSE.
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 orbi_sched-0.1.0.tar.gz.
File metadata
- Download URL: orbi_sched-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06306ca689d457daf8c5def1a94562d4af9483d090b4e7d3f4f6fdc2380cdfde
|
|
| MD5 |
3155d45cc4f9a8ecd9cf459a91816109
|
|
| BLAKE2b-256 |
d0da2184227176b3984fcba10ea0a81567d087ffe2086a0405167348d8e854c5
|
File details
Details for the file orbi_sched-0.1.0-py3-none-any.whl.
File metadata
- Download URL: orbi_sched-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4797406ee619466dc8a56b3e6c3e19108dc67fbe916389485e7eaaca1a9ac9c5
|
|
| MD5 |
9aa7e60bc54166b7362843ba66961735
|
|
| BLAKE2b-256 |
dcf529dbfdad4c76961f9a2ef88a56dfa0ecf4c5c3d86f9b2436e1fb0152a9e0
|