airflow-jalali-cron
A custom Apache Airflow timetable that schedules DAGs
with an ordinary cron expression whose day-of-month and month fields are read on the
Jalali (Persian / Solar Hijri) calendar, in the Asia/Tehran timezone. The default
(JalaliCron()) runs at the start of every Jalali month.
Distributing the timetable as an installable package is the approach recommended by Airflow: it gives the timetable class one stable import path that is available to every Airflow component (scheduler, webserver/API server, workers, triggerer, DAG processor), and that same path is what gets serialized into the DAG — which avoids the "timetable not registered / cannot import" errors you hit when loading it straight from the plugins folder.
Installation
Install it into the same Python environment as Airflow (every node that parses or runs DAGs):
pip install airflow-jalali-cron
That single install does two things:
- Makes
JalaliCronimportable in your DAG files. - Auto-registers the plugin with Airflow via the
airflow.pluginsentry point — so you do not need to copy anything into$AIRFLOW_HOME/plugins.
Usage
from datetime import datetime
from airflow import DAG
from airflow.operators.empty import EmptyOperator
from airflow_jalali_cron import JalaliCron
with DAG(
dag_id="jalali_monthly_report",
start_date=datetime(2024, 3, 20), # ~ start of a Jalali year
timetable=JalaliCron("0 9 1 * *"), # 09:00 on the 1st of each Jalali month
catchup=False,
tags=["jalali"],
):
EmptyOperator(task_id="run_monthly_job")
After installing, confirm Airflow sees the plugin:
airflow plugins
You should see jalali_cron_plugin listed with JalaliCron under its
timetables.
Schedule syntax
JalaliCron(cron, *, timezone="Asia/Tehran", clamp_overflow_days=True)
The cron is a standard 5-field expression — minute hour day-of-month month day-of-week — supporting *, lists (,), ranges (-) and steps (*/n, a-b/n).
What's special:
- day-of-month and month are interpreted on the Jalali calendar (month 1 = Farvardin … 12 = Esfand).
- minute / hour are plain
Asia/Tehranwall-clock time. - day-of-week uses the Iranian week (same numbering as
jdatetime):0=Saturday (shanbe),1=Sunday,2=Monday,3=Tuesday,4=Wednesday,5=Thursday,6=Friday (jome).
| Goal | cron |
|---|---|
| Start of every Jalali month (default) | 0 0 1 * * |
| 09:30 on the 5th of each month | 30 9 5 * * |
| Every other month (Farvardin, Khordad, …) | 0 0 1 */2 * |
| Every third month (Farvardin, Tir, Mehr, Dey) | 0 0 1 */3 * |
| Noon every Friday | 0 12 * * 6 |
| Last day of every month | 0 0 31 * * |
clamp_overflow_days (default True): a day-of-month larger than a month's length
is clamped to the last day — the effective day is min(day, month_length). So
0 0 31 * * fires on the 31st in months 1–6, the 30th in months 7–11, and the 29th/30th
in Esfand. Set it to False for standard cron behavior, where an out-of-range day simply
never fires in shorter months.
How it works
- Semantics are interval-based, matching Airflow's
CronDataIntervalTimetable: each run covers[this firing, next firing)and is triggered at the end of that interval. - All times are computed in
Asia/Tehran(configurable viatimezone). - With
catchup=False, the timetable fast-forwards to the current interval instead of backfilling every period sincestart_date. - When both day-of-month and day-of-week are restricted, a day matches if either does (the standard Vixie-cron rule).
Compatibility
- Airflow: 2.4+
- Python: 3.9–3.12 (matching Airflow 2.x support)
Development
python -m venv .venv && source .venv/bin/activate
pip install build twine
python -m build # creates dist/*.whl and dist/*.tar.gz
twine check dist/*
License
Metadata
Release files for airflow-jalali-cron 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| airflow_jalali_cron-0.1.0.tar.gz | 10.0 kB | With provenance | Details for airflow_jalali_cron-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| airflow_jalali_cron-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for airflow_jalali_cron-0.1.0-py3-none-any.whl |
Total release size: 19.6 kB
Release files / airflow_jalali_cron-0.1.0.tar.gz
| Download URL | airflow_jalali_cron-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b64b4caf1dac2da8940472bf61b9c0b469dace03843a2ded7d3f9c340400bb3
|
|
BLAKE2b-256 checksum How to use checksums |
aaa52f9215622d343d9a34a0f0359d515c4ee70a11f2097cd2a87ea5be6110b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logRelease files / airflow_jalali_cron-0.1.0-py3-none-any.whl
| Download URL | airflow_jalali_cron-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d755d49c2a7c2741f6a4b0a204430a0fe781b7e172ee02e3a92bbe0f6720c5a
|
|
BLAKE2b-256 checksum How to use checksums |
5d9fe7ee2fd41abc8ede7d8540debcf9d27620d826daf57bdc1d97a09f922e6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logSecurity for airflow-jalali-cron 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for airflow_jalali_cron-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.