From 3c5668992b6e5c170a8eda056cb256b491182bc7 Mon Sep 17 00:00:00 2001 From: raphaelauv Date: Fri, 7 Aug 2026 22:40:20 +0200 Subject: [PATCH] documentation - more explicit comment on airflow syntax --- airflow-core/docs/index.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/airflow-core/docs/index.rst b/airflow-core/docs/index.rst index 879ccb50e0871..5cd48cb91833a 100644 --- a/airflow-core/docs/index.rst +++ b/airflow-core/docs/index.rst @@ -60,16 +60,21 @@ Let's look at a code snippet that defines a simple Dag: from airflow.providers.standard.operators.bash import BashOperator # A Dag represents a workflow, a collection of tasks - with DAG(dag_id="demo", start_date=datetime(2022, 1, 1), schedule="0 0 * * *") as dag: - # Tasks are represented as operators + with DAG(dag_id="demo", start_date=datetime(2022, 1, 1), schedule="0 0 * * *"): + # Tasks are defined by instantiating operators hello = BashOperator(task_id="hello", bash_command="echo hello") - @task() + # Equivalent of BashOperator using the Airflow Taskflow syntax + @task.bash def airflow(): - print("airflow") + return "echo airflow" + + @task + def world(): + print("world") # Set dependencies between tasks - hello >> airflow() + hello >> airflow() >> world() Here you see: