Case · Backend · Python

cron-clock: cron explained and next runs

A cron-expression service in Python (FastAPI, standard library and zoneinfo only). It explains an expression in Russian and English, computes the next runs in a given time zone with daylight saving transitions, warns about "dangerous" schedules and compares two expressions. L, W, # and six fields with seconds are supported.

  • Python
  • FastAPI
  • uvicorn
  • zoneinfo
  • hypothesis
  • mypy --strict
  • ruff
  • pip-audit
  • Docker
  • GitHub Actions

01 · How it looks

Screenshots

Screenshot of the project "cron-clock: cron explained and next runs" at 1280 pixels wide
Desktop, 1280 px
Screenshot of the project "cron-clock: cron explained and next runs" on a phone screen, 390 pixels wide
Phone, 390 px

02 · About

What it is and why

A cron-expression service in Python (FastAPI, standard library and zoneinfo only). It explains an expression in Russian and English, computes the next runs in a given time zone with daylight saving transitions, warns about "dangerous" schedules and compares two expressions. L, W, # and six fields with seconds are supported.

Limitations

Weekday numbering follows standard cron (Sunday is 0 or 7), not Quartz; the seventh year field is unsupported.

@reboot is rejected: it has no schedule.

The DST rules are deliberately simple; a real cron (Vixie, systemd timers, Quartz) may behave differently.

The project runs on a small VPS with demo data: no redundancy or backups.

What is inside

  • Next runs across DST: the Europe/Berlin boundaries of 2024-03-31 and 2024-10-27, Lord Howe with its half-hour shift
  • 64 tests; hypothesis with 150 examples per property: a run satisfies the expression, no matching minute is skipped (checked by brute force)
  • Comparing `* * * * * *` against `* * * * *` over 400 days in 0.6 s
  • /api/parse: about 800 requests per second, p95 35 ms; 37 MiB RAM idle

03 · How to run

Run it locally

git clone <repository on request> cron-clock
cd cron-clock
python -m app

04 · Code

The repository is private

The source is in a private repository. Message me on Telegram and I will open access.

Request the code