A Streamlit-based job scheduler with one-time and cron scheduling support
Project description
Streamlit Job Scheduler
A simple and interactive Streamlit-based UI to configure and manage scheduled jobs — either one-time or cron-based.
Features
- One-time scheduling (date + time + minute)
- Cron scheduling with flexible frequency (daily, weekly, monthly, etc.)
- Multi-hour and multi-day support in a single cron expression
- Human-readable cron descriptions
- Pytest unit tests
Quick start
Install (editable during development) and run the Streamlit app:
pip install -e .
streamlit run -m streamlit_job_scheduler/ui.py
Or run directly (development):
python -m streamlit_job_scheduler/ui.py
🧩 Usage
pip install streamlit-job-scheduler
Programmatic usage
Primary UI entry is streamlit_job_scheduler.ui.job_scheduler. Signature:
-
job_scheduler(callback_func, config: SchedulerConfig = None) -> ScheduleInfo | None
-
callback_func: optional callable that will be invoked with astreamlit_job_scheduler.models.ScheduleInfowhen the user finalizes a schedule. -
config: optionalstreamlit_job_scheduler.models.SchedulerConfigto control initial UI state, title, pre-filled cron (parsed bystreamlit_job_scheduler.scheduler.parse_cron_to_preconfig), and display options.
Example (use inside a Streamlit session):
from streamlit_job_scheduler.ui import job_scheduler
from streamlit_job_scheduler.models import SchedulerConfig
from streamlit_job_scheduler.enums import ScheduleType
config = SchedulerConfig(schedule_type=ScheduleType.CRONJOB, schedule="*/10 * * * *")
job = job_scheduler(None, config=config) # returns a ScheduleInfo when not using a callback
Returned object is a streamlit_job_scheduler.models.ScheduleInfo with .schedule_type and .schedule attributes.
Cron helpers
-
generate_cron_expr(frequency, ...) — build a cron expression for frequencies like "Every X minutes", "Hourly", "Daily", "Weekly", "Monthly", or "Custom". See implementation: streamlit_job_scheduler/scheduler.py and symbol:
streamlit_job_scheduler.scheduler.generate_cron_expr -
describe_cron(expr) — turn a standard 5-field cron into a human-friendly description. See:
streamlit_job_scheduler.scheduler.describe_cron -
parse_cron_to_preconfig(cron_expr) — parse a cron expression into a dict suitable for pre-filling the UI. See:
streamlit_job_scheduler.scheduler.parse_cron_to_preconfig
Example:
from streamlit_job_scheduler.scheduler import generate_cron_expr, describe_cron
expr = generate_cron_expr("Daily", hours=[9,17], minutes=[0,30])
print(expr) # -> "0,30 9,17 * * *"
print(describe_cron(expr)) # human readable description
Tests
Pytest tests cover scheduler logic and a smoke UI test harness.
Run tests:
pytest -q
Tests to review:
Development notes & gotchas
- The package requires Streamlit (see setup.cfg and pyproject.toml).
- The UI function is designed to be run inside a Streamlit app — running it outside Streamlit will not render widgets.
- The UI function signature is
job_scheduler(callback_func, config=None). When using programmatically prefer passing the config as the second positional argument or as a keyword (config=...) so the function can detect the callback and config correctly. See implementation:streamlit_job_scheduler.ui.job_scheduler - Cron parsing expects standard 5-field cron expressions (minute hour day month weekday). See:
streamlit_job_scheduler.scheduler.is_valid_cron
Contributing
- Modify code in
streamlit_job_scheduler/and add tests instreamlit_job_scheduler/tests/. - Run tests with
pytest. - Keep examples and README in sync with code in:
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 streamlit_job_scheduler-0.0.1.tar.gz.
File metadata
- Download URL: streamlit_job_scheduler-0.0.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a476a564c67f7059d78aee2b746c01f4a3d761f8a130cf4f89d384c7069dcb1
|
|
| MD5 |
14b7770df562038c5ca38c85650f0138
|
|
| BLAKE2b-256 |
b046a45fc26827c5563afd8c1fa85c7e33ea32f4f2e45f9f514a1bcf94e0a56d
|
File details
Details for the file streamlit_job_scheduler-0.0.1-py3-none-any.whl.
File metadata
- Download URL: streamlit_job_scheduler-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0ddf7616faeb76be82932186daf5f485c61b6b34bd61e62041d27371c055d08
|
|
| MD5 |
4bc567e8938cd5de96b43eddfe2cafd7
|
|
| BLAKE2b-256 |
f247906f0b855eda66d096b4d25d7e28c0a7c73694520b9024bf8df5273292a7
|