From 3736e1916c115da1dd069c6eacc15e2b52bb6cf1 Mon Sep 17 00:00:00 2001 From: rich7420 Date: Thu, 23 Oct 2025 13:54:14 +0800 Subject: [PATCH 1/2] Migrate remaining providers to common.compat compatibility layer --- providers/openfaas/pyproject.toml | 2 ++ .../src/airflow/providers/openfaas/hooks/openfaas.py | 2 +- .../src/airflow/providers/openfaas/version_compat.py | 6 ------ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/providers/openfaas/pyproject.toml b/providers/openfaas/pyproject.toml index a28facd555430..893e4b5802205 100644 --- a/providers/openfaas/pyproject.toml +++ b/providers/openfaas/pyproject.toml @@ -58,6 +58,7 @@ requires-python = ">=3.10" # After you modify the dependencies, and rebuild your Breeze CI image with ``breeze ci-image build`` dependencies = [ "apache-airflow>=2.10.0", + "apache-airflow-providers-common-compat>=1.8.0", # + TODO: bump to next version ] [dependency-groups] @@ -65,6 +66,7 @@ dev = [ "apache-airflow", "apache-airflow-task-sdk", "apache-airflow-devel-common", + "apache-airflow-providers-common-compat", # Additional devel dependencies (do not remove this line and add extra development dependencies) ] diff --git a/providers/openfaas/src/airflow/providers/openfaas/hooks/openfaas.py b/providers/openfaas/src/airflow/providers/openfaas/hooks/openfaas.py index 24e87b2ba83b6..ed40770c70ac5 100644 --- a/providers/openfaas/src/airflow/providers/openfaas/hooks/openfaas.py +++ b/providers/openfaas/src/airflow/providers/openfaas/hooks/openfaas.py @@ -22,7 +22,7 @@ import requests from airflow.exceptions import AirflowException -from airflow.providers.openfaas.version_compat import BaseHook +from airflow.providers.common.compat.sdk import BaseHook OK_STATUS_CODE = 202 diff --git a/providers/openfaas/src/airflow/providers/openfaas/version_compat.py b/providers/openfaas/src/airflow/providers/openfaas/version_compat.py index 465da77d0d9cb..a4fae50317e81 100644 --- a/providers/openfaas/src/airflow/providers/openfaas/version_compat.py +++ b/providers/openfaas/src/airflow/providers/openfaas/version_compat.py @@ -35,13 +35,7 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]: AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0) AIRFLOW_V_3_1_PLUS: bool = get_base_airflow_version_tuple() >= (3, 1, 0) -if AIRFLOW_V_3_1_PLUS: - from airflow.sdk import BaseHook -else: - from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef] - __all__ = [ "AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS", - "BaseHook", ] From e8993fa08bc4a08b8295375886d84dfea99c4422 Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Thu, 23 Oct 2025 16:25:16 +0100 Subject: [PATCH 2/2] Apply suggestion from @kaxil --- providers/openfaas/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/openfaas/pyproject.toml b/providers/openfaas/pyproject.toml index 893e4b5802205..736ed93ad063d 100644 --- a/providers/openfaas/pyproject.toml +++ b/providers/openfaas/pyproject.toml @@ -58,7 +58,7 @@ requires-python = ">=3.10" # After you modify the dependencies, and rebuild your Breeze CI image with ``breeze ci-image build`` dependencies = [ "apache-airflow>=2.10.0", - "apache-airflow-providers-common-compat>=1.8.0", # + TODO: bump to next version + "apache-airflow-providers-common-compat>=1.8.0", ] [dependency-groups]