Validate on real Airflow¶
Static rules cannot see values that only exist at render or run time, such as Jinja-injected schedules or
DAG(**config). Validation closes that gap: dagshift loads your DAG folder with Airflow's own DagBag, in a
Python environment that has the target Airflow installed, and reports import errors and deprecation warnings
in the Problems panel.
1. Create an environment with the target Airflow¶
Use the constraints file that matches the Airflow and Python versions:
Airflow does not run natively on Windows. Create the environment in WSL and set
dagshift.validate.airflowPython to its interpreter, or open the project in WSL with the
WSL extension and use the Linux path.
Add any providers your DAGs import (for example apache-airflow-providers-google) to the same environment.
2. Point dagshift at it¶
Run dagshift: Validate DAGs on Target Airflow.... The first time, it asks for the Python interpreter and the DAG folder. They are saved in:
| Setting | Example |
|---|---|
dagshift.validate.airflowPython |
~/.venvs/airflow3/bin/python |
dagshift.validate.dagFolder |
dags |
dagshift.validate.pythonPath |
["."], extra import roots for your DAG files |
Validate the upgraded copy if you wrote one, or the workspace after editing in place.
DAG factories that render at build time¶
If your DAG files are generated by a script, set dagshift.validate.renderCommand, for example:
It runs in a temporary copy of the DAG folder's parent, never in your workspace, and validation then loads the rendered output.
Validation runs your DAG files
Loading DAGs executes their top-level code, as Airflow does. In Restricted Mode validation is disabled and workspace-level interpreter settings are ignored.
Airflow 3.0
On Airflow 3.0, validation parses in-process, so top-level airflow.sdk.Variable.get calls fail there
even though a real DAG processor handles them. The report says so.