ramonvermeulen commented on PR #46911:
URL: https://github.com/apache/airflow/pull/46911#issuecomment-2834076600

   > > Weirdly tests fail and seem to hit these airflow 3 >= lines while being 
ran with 2.9.3 and 2.10.5?:
   > > 
https://github.com/apache/airflow/pull/46911/files#diff-27b491eef8e08f51786d7adcf1c491dbf6d6229cb5cdf91a499c8c11f73cfff1R30
   > 
   > Not weirdly - airflow.sdk does not existi in Airflow 2 and the test import 
it - so it fail, there needs to be compatibility code in the test to run also 
in Airflow 2.
   
   Isn't that where this if/else is for?:
   
   ```
   if AIRFLOW_V_3_0_PLUS:
       from airflow.sdk.execution_time.xcom import XCom
   else:
       from airflow.models.xcom import XCom  # type: ignore[no-redef]
   ```
   
   e.g. within an Airflow 3 >= runtime `AIRFLOW_V_3_0_PLUS` evaluates as 
`False` so the `from airflow.sdk.execution_time.xcom import XCom` import 
statement gets skipped? Just like how `if typing.TYPE_CHECKING:` works, at 
runtime it doesn't get importend since it always evaluates `False` but helps 
for IDE typing support.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to