Skip to content

Implement AIP-85 YAML importer based on the parser - #74586

Merged
vatsrahul1001 merged 25 commits into
apache:mainfrom
astronomer:yaml-importer
Oct 13, 2026
Merged

vatsrahul1001 merged 25 commits into
apache:mainfrom
astronomer:yaml-importer

Conversation

@uranusjr

@uranusjr uranusjr commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Implements the AIP-85 YAML/JSON DAG importer on top of the parser from #74084. A .yaml/.yml file carrying a $schema marker is discovered, parsed into the validated DagDocument model, and built into a real DAG with operators.

This adds the $f marker to the shared format surface (models, schema.json, parser tests), not just the importer. It's the explicit FileTemplate half of AIP-80's file-vs-string split. Flagging it here since it's broader than the importer itself.

Links to AIPs:

  • AIP-85: the YAML format and value grammar: uses: (ready-made operator) / run: (code task), with:, needs:, and the $x/$t/$f/$const markers.
  • AIP-80 (explicit templating): literal by default; a field renders only when the author marks it ($t/$x). The importer realizes this per operator instance: it restricts template_fields to exactly the marked fields and empties template_ext, so nothing renders or file-loads by inference. A marker on a field the operator doesn't template is a build error. $f is an explicit file read (AIP-80's FileTemplate); $t wrapping $f is a template file (read, then render).
  • AIP-108 (stub arg-binding): run: tasks build the native @task.stub _StubOperator. The importer feeds it a callable whose ordered parameters are the run-argument names, so core serialization emits the handler arg-binding spec the lang-SDK runtime validates against.

Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/importer.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/importer.py
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/importer.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/importer.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py Outdated
Comment thread task-sdk/tests/task_sdk/importers/yaml_importer/test_importer.py Outdated
Comment thread task-sdk/tests/task_sdk/importers/yaml_importer/test_importer.py
Comment thread task-sdk/tests/task_sdk/importers/yaml_importer/test_importer.py
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/models.py
@uranusjr
uranusjr requested review from ashb and kaxil October 12, 2026 15:52
@uranusjr uranusjr added this to the Airflow 3.4.0 milestone Oct 12, 2026
@uranusjr uranusjr self-assigned this Oct 12, 2026
@uranusjr uranusjr added the AIP-85: Dag Importer https://cwiki.apache.org/confluence/spaces/AIRFLOW/pages/315494137/AIP-85+DAG+importer label Oct 12, 2026
Comment thread task-sdk/tests/task_sdk/importers/yaml_importer/test_importer.py Outdated
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py Outdated
Comment thread task-sdk/tests/task_sdk/importers/yaml_importer/test_importer.py
Comment thread task-sdk/src/airflow/sdk/importers/yaml_importer/builder.py
Comment thread task-sdk/src/airflow/sdk/importers/zip_importer.py Outdated
@vatsrahul1001
vatsrahul1001 merged commit 7256820 into apache:main Oct 13, 2026
246 of 247 checks passed
@vatsrahul1001
vatsrahul1001 deleted the yaml-importer branch October 13, 2026 05:59
pierrejeambrun added a commit to astronomer/airflow that referenced this pull request Oct 13, 2026
The AIP-85 YAML importer (apache#74586) stores its Dag source with language
"yaml", but the Code tab's Monaco setup only registers the Python,
TypeScript, Java and Go grammars, so YAML Dags rendered as plain text.
Register Monaco's YAML grammar the same way as the others.
pierrejeambrun added a commit that referenced this pull request Oct 13, 2026
The AIP-85 YAML importer (#74586) stores its Dag source with language
"yaml", but the Code tab's Monaco setup only registers the Python,
TypeScript, Java and Go grammars, so YAML Dags rendered as plain text.
Register Monaco's YAML grammar the same way as the others.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIP-85: Dag Importer https://cwiki.apache.org/confluence/spaces/AIRFLOW/pages/315494137/AIP-85+DAG+importer area:task-sdk

Projects

Development

Successfully merging this pull request may close these issues.

4 participants