kyungjunleeme commented on code in PR #53856: URL: https://github.com/apache/airflow/pull/53856#discussion_r2238709589
########## providers/amazon/src/airflow/providers/amazon/aws/executors/batch/batch_executor.py: ########## @@ -37,8 +37,8 @@ ) from airflow.providers.amazon.aws.hooks.batch_client import BatchClientHook from airflow.providers.amazon.version_compat import AIRFLOW_V_3_0_PLUS +from airflow.sdk import timezone Review Comment: I'm not sure. I have changed code because mypy pre-commit hook. ``` try: from airflow.sdk import timezone except ImportError: from airflow.utils import timezone ``` I think compatibility between Airflow 2 and 3 should be handled consistently in version_compat.py. For example, it already contains version-based imports like: ```python from airflow.version import version as AIRFLOW_VERSION # Version checks from packaging.version import parse as parse_version AIRFLOW_V_3_0_PLUS = parse_version(AIRFLOW_VERSION) >= parse_version("3.0.0") AIRFLOW_V_3_1_PLUS = parse_version(AIRFLOW_VERSION) >= parse_version("3.1.0") # Conditional imports based on version if AIRFLOW_V_3_1_PLUS: from airflow.sdk import BaseHook, BaseOperator else: from airflow.hooks.base import BaseHook from airflow.models.baseoperator import BaseOperator # type: ignore[no-redef] if AIRFLOW_V_3_0_PLUS: from airflow.sdk import BaseOperatorLink from airflow.sdk.bases.sensor import BaseSensorOperator, PokeReturnValue from airflow.sdk import timezone else: from airflow.models.baseoperatorlink import BaseOperatorLink # type: ignore[no-redef] from airflow.sensors.base import BaseSensorOperator, PokeReturnValue # type: ignore[no-redef] from airflow.utils import timezone # type: ignore[attr-defined] __all__ = [ "AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS", "BaseHook", "BaseOperator", "BaseOperatorLink", "BaseSensorOperator", "PokeReturnValue", "timezone", ] ``` This change might be outside the scope of the current PR, and I'm not entirely sure what the best way to handle it would be. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org