This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 10558d8d154 Conditionally import from task sdk (#59254)
10558d8d154 is described below

commit 10558d8d15431e7826be44e7fde930a05eb73bb2
Author: Niko Oliveira <[email protected]>
AuthorDate: Tue Dec 9 11:24:36 2025 -0800

    Conditionally import from task sdk (#59254)
    
    Amazon provider still supports 2.X so we need to try/catch around 3.X
    imports
---
 providers/amazon/tests/system/amazon/aws/example_ssm.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/providers/amazon/tests/system/amazon/aws/example_ssm.py 
b/providers/amazon/tests/system/amazon/aws/example_ssm.py
index 94a8173a1fe..6357747ba82 100644
--- a/providers/amazon/tests/system/amazon/aws/example_ssm.py
+++ b/providers/amazon/tests/system/amazon/aws/example_ssm.py
@@ -26,7 +26,16 @@ import boto3
 from airflow.providers.amazon.aws.operators.ec2 import 
EC2CreateInstanceOperator, EC2TerminateInstanceOperator
 from airflow.providers.amazon.aws.operators.ssm import 
SsmGetCommandInvocationOperator, SsmRunCommandOperator
 from airflow.providers.amazon.aws.sensors.ssm import 
SsmRunCommandCompletedSensor
-from airflow.sdk import DAG, chain, task
+
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
+
+if AIRFLOW_V_3_0_PLUS:
+    from airflow.sdk import DAG, chain, task
+else:
+    # Airflow 2 path
+    from airflow.decorators import task  # type: ignore[attr-defined,no-redef]
+    from airflow.models.baseoperator import chain  # type: 
ignore[attr-defined,no-redef]
+    from airflow.models.dag import DAG  # type: 
ignore[attr-defined,no-redef,assignment]
 
 try:
     from airflow.sdk import TriggerRule

Reply via email to