--- id: cronsim version: "2.7" license: unclear license_treatment: permissive maintenance: aging --- # cronsim — Cron expression parser and evaluator License: permissive · Maintenance: aging · Downloads: 14.7M/mo ## What it is and what it does CronSim is a cron expression parser and evaluator that takes a cron schedule string and a starting datetime, then generates the sequence of datetimes when that schedule would execute. It's designed to match Debian's cron implementation closely, including its handling of Daylight Saving Time transitions and quirky edge cases. The package prioritizes correctness over feature breadth, implementing only the syntax that its primary user (the Healthchecks monitoring service) requires. You instantiate a CronSim object with an expression and a datetime, then iterate forward or backward through matching times using Python's iterator protocol. It supports standard five-field cron syntax plus an optional sixth field for seconds, and several non-standard extensions like "L" for last-day-of-month, "LW" for last-weekday, and "MON#5" for nth-weekday-of-month. Invalid expressions raise CronSimError; expressions with no match within 50 years raise StopIteration. Starting from version 2.4, it includes an explain() method to generate human-readable descriptions of expressions. Use it for: - Calculate upcoming execution times for a cron job to display in a monitoring dashboard or alert system. - Validate cron expressions and provide user-friendly error messages when syntax is invalid. - Iterate backward in time to find when a job last ran, for audit or debugging purposes. - Generate a text description of a cron schedule for documentation or UI display. - Handle DST transitions correctly when scheduling jobs across timezone boundaries. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and evaluates cron expressions to find matching execution times, with support for Debian cron syntax including DST handling, optional seconds field, and advanced features like last-day-of-month and nth-weekday matching. Yes. CronSim is a focused, well-maintained library with zero dependencies, permissive licensing, and no known vulnerabilities. Install it if you need to parse or evaluate cron expressions in Python—particularly if you require Debian cron compatibility or advanced features like last-day-of-month matching. The aging maintenance status is not a concern given the stable, narrow scope of the package. ## Install pip install cronsim uv add cronsim poetry add cronsim ## Installing cronsim Before you install: Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging (297 days since last release), but the package is marked Production/Stable and the repository remains active with recent commits. License in practice: Permissive license (BSD) means you can use, modify, and redistribute the package with minimal restrictions, typical for open-source libraries. Quickstart: from datetime import datetime from cronsim import CronSim it = CronSim("0 0 * 2 MON#5", datetime(2020, 1, 1)) for x in range(0, 5): print(next(it)) Requires Python 3.10 or later. Verify before relying: - Whether the package's DST handling matches your timezone library's behavior in edge cases. - Performance characteristics when iterating over very long time ranges or complex expressions. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 14.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags cron expression parser, cron schedule evaluator, crontab expression matcher, job scheduling time calculator, cron syntax validator, cron-scheduling, time-expression-parsing [View on SkillFed](https://skillfed.io/packages/cronsim) · [View on PyPI](https://pypi.org/project/cronsim/)