Parse cron expressions, compute their next run times, and explain them in plain English — a dependency-free Python library and CLI, plus a web schedule explorer.
from cronparse import CronExpression
cron = CronExpression.parse("0 9 * * 1-5")
cron.describe()
# "At 09:00, on Monday, Tuesday, Wednesday, Thursday, Friday"
cron.next_runs(3, after=datetime(2026, 1, 2, 10, 0))
# [2026-01-05 09:00, 2026-01-06 09:00, 2026-01-07 09:00] (skips the weekend)$ cronparse "*/15 * * * *" -n 3
Every 15 minutes, every day
2026-11-04 10:15 (Wednesday)
2026-11-04 10:30 (Wednesday)
2026-11-04 10:45 (Wednesday)The same engine in the browser. Type an expression and see it explained — a plain-English description, a field-by-field breakdown, the next and previous runs, and a heatmap of when it fires over the next week. A small saved-jobs "crontab" (SQLite) keeps named schedules and shows their combined next runs.
pip install "cronparse[web]"
cronparse serve # http://localhost:8000GET /api/explain?expr=0 9 * * 1-5 returns the same description, fields and next runs as JSON, so the
explorer is also an API. Run it with Docker:
docker build -t cronparse . && docker run -p 8000:8000 -v "$PWD/data:/data" cronparseEveryone has stared at a line like */15 2-6 * * 1-5 and had to decode it by hand, or guessed when a
job will next fire. cronparse answers both questions: it turns the expression into the set of times it
matches, computes the upcoming runs, and describes the schedule in words. It is small and has no
dependencies, and the parsing — the interesting part — is covered by tests.
Standard 5-field cron: minute hour day-of-month month day-of-week, with
- wildcards
*, - single values and lists:
1,15,30, - ranges:
1-5, - steps:
*/15,10-30/5,50/5(from 50 to the max), - names:
JAN–DECandSUN–SAT(and7for Sunday), - the standard day-of-month OR day-of-week rule: when both are restricted, a day matches if either does.
from datetime import datetime
from cronparse import CronExpression, CronError
cron = CronExpression.parse("30 2 * * *") # 02:30 every day
cron.matches(datetime(2026, 3, 2, 2, 30)) # True
cron.next_run(datetime(2026, 3, 2, 3, 0)) # 2026-03-03 02:30
cron.next_runs(5) # the next five runs from now
for run in cron.iter_runs(): # an endless iterator of run times
...Parsing errors raise CronError (a ValueError), and an impossible schedule such as 0 0 30 2 *
(the 30th of February) raises CronError from next_run rather than looping forever.
cronparse "<expression>" [-n COUNT]Prints the description and the next COUNT runs (default 5). Exit code 2 on a bad expression.
Each field is parsed into the exact set of integers it allows, under that field's bounds (minute
0–59, day-of-week 0–6, and so on), expanding lists, ranges, steps and names. Matching a time is
then a set-membership check per field, with the day-of-month/day-of-week OR rule applied. next_run
walks forward minute by minute from the given time until a match, capped at five years so an
impossible schedule fails fast instead of hanging.
pip install -e ".[dev]"
pytestForty tests covering field parsing (wildcards, lists, ranges, steps, names, the Sunday 7 alias, and
rejected input), matching and next_run (the strictly-after rule, weekday schedules, the
day-of-month OR day-of-week semantics, and the impossible-schedule guard), the descriptions, and the
CLI — plus the explorer's schedule helpers (field views, upcoming runs, relative times, the bounded
heatmap), the job store, and the FastAPI app via TestClient (explaining valid/invalid expressions,
the JSON API, and saving/deleting jobs). CI runs on Python 3.10 through 3.13.
src/cronparse
├── fields.py parse one field into its set of values
├── expression.py CronExpression: match, next_run, previous_run, describe
├── cli.py the command-line entry point (+ `serve`)
├── schedule.py explorer helpers: field views, upcoming, heatmap ([web])
├── store.py SQLite store for saved jobs ([web])
├── web.py FastAPI schedule explorer + JSON API ([web])
└── templates/ the explorer's HTML (inline-styled, no asset pipeline)
tests/ pytest suite
- Seconds (6-field) and
@hourly/@dailyshorthands. - Timezone-aware scheduling.
- Comparing two expressions side by side in the explorer.
MIT
