cron-pydantic

Typed, YAML-friendly models for cron schedules, jobs, and crontab files.

Build Status codecov License PyPI

from cron_pydantic import CronConfiguration

config = CronConfiguration.model_validate(
    {
        "environment": {"PATH": "/usr/local/bin:/usr/bin"},
        "job": {
            "backup": {
                "schedule": "0 2 * * *",
                "command": "/opt/jobs/backup",
            }
        },
    }
)

print(config.to_cron())

cron-pydantic validates five-field and special schedules, renders user and system crontabs, parses existing crontab text, and loads YAML. File output is explicit; the package never installs or replaces a host crontab.

Documentation

Published documentation is available at airflow-laminar.github.io/cron-pydantic.

Ecosystem

Note

This library was generated using copier from the Base Python Project Template repository.