airflow-v2-to-v3
Migrate Apache Airflow 2.x DAGs to Airflow 3.x automatically — validate, transform, and diff your DAGs with a single CLI command. Built for Astronomer (Astro) Airflow users and anyone upgrading from Airflow 2 to Airflow 3.
Why this tool? Ruff's AIR rules flag Airflow 3 compatibility issues but don't auto-fix them.
airflow-v2-to-v3does the actual code transformation — handling 200+ migration rules across imports, parameters, context variables, and more.
Features
- 200+ migration rules covering import moves, parameter renames, class renames, context variable changes, and more
- Validate — scan DAGs for Airflow 3 compatibility issues without modifying files
- Migrate — transform Airflow 2 code to Airflow 3 in-place or to a separate output directory
- Diff — side-by-side diff output (like a GitHub PR) showing exactly what changed
- Reserved keyword detection — flags directories that shadow core Airflow modules (
utils,models, etc.)
Installation
pip install airflow-v2-to-v3
Usage
Validate
Check your DAGs for Airflow 3 compatibility issues:
airflow-v2-to-v3 validate /path/to/dags/
# Output as JSON
airflow-v2-to-v3 validate /path/to/dags/ --format json
# Output as table
airflow-v2-to-v3 validate /path/to/dags/ --format table
Migrate
Transform your DAGs from Airflow 2 to Airflow 3:
# In-place migration
airflow-v2-to-v3 migrate /path/to/dags/
# Migrate to a separate directory
airflow-v2-to-v3 migrate /path/to/dags/ -o /path/to/output/
# Dry run (show what would change without modifying files)
airflow-v2-to-v3 migrate /path/to/dags/ --dry-run
# Save diff report to file
airflow-v2-to-v3 migrate /path/to/dags/ --diff-report /path/to/report.txt
Diff
Preview changes without modifying files:
# Show side-by-side diff in terminal
airflow-v2-to-v3 diff /path/to/dags/
# Save diff report to file
airflow-v2-to-v3 diff /path/to/dags/ -o /path/to/report.txt
What Gets Migrated
| Category | Example |
|---|---|
| Import moves | from airflow.operators.dummy import DummyOperator → from airflow.providers.standard.operators.empty import EmptyOperator |
| SDK moves | from airflow.decorators import dag, task → from airflow.sdk import dag, task |
| Parameter renames | schedule_interval="@daily" → schedule="@daily" |
| Removed parameters | provide_context=True → removed (always provided in Airflow 3) |
| Context variables | context['execution_date'] → context['logical_date'] |
| Class renames | DummyOperator → EmptyOperator |
| Dataset → Asset | from airflow.datasets import Dataset → from airflow.sdk import Asset |
| Trigger rules | TriggerRule.DUMMY → TriggerRule.ALWAYS |
| Removed functions | days_ago(1) → datetime(...) |
Development
# Clone and install in dev mode
git clone https://github.com/rajeshkbathula/airflow-v2-to-v3.git
cd airflow-v2-to-v3
make dev
# Run tests
make test
# Build
make build
# Publish to PyPI
PYPI_TOKEN=your-token make publish
License
Apache 2.0
Metadata
Release files for airflow-v2-to-v3 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 | |
|---|---|---|---|---|
| airflow_v2_to_v3-0.1.0.tar.gz | 20.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| airflow_v2_to_v3-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.1 kB
Release files / airflow_v2_to_v3-0.1.0.tar.gz
| Download URL | airflow_v2_to_v3-0.1.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
edc980d4ca605022762853930893fcb9132a4fe46c39d4d9ce03190b122b0e1b
|
|
BLAKE2b-256 checksum How to use checksums |
15dda0d67c2147cf96e84e35dc8ae25345bc04f55656d438fa517081b7ee63c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / airflow_v2_to_v3-0.1.0-py3-none-any.whl
| Download URL | airflow_v2_to_v3-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b65759da6f253ee023ddb15291f919689931699f34602b9932239a986db522a8
|
|
BLAKE2b-256 checksum How to use checksums |
d7c4cf205b78c569c8a5fb4c6246c2f68ad190c73d8d3da40590b6a61802660e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for airflow-v2-to-v3 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.