From 623ffce026dacd44a30217565f0d60a29287dce3 Mon Sep 17 00:00:00 2001 From: rich7420 Date: Wed, 22 Oct 2025 22:51:49 +0800 Subject: [PATCH 1/2] Migrate remaining providers to common.compat compatibility layer --- providers/cloudant/pyproject.toml | 8 ++++++++ .../src/airflow/providers/cloudant/hooks/cloudant.py | 2 +- .../src/airflow/providers/cloudant/version_compat.py | 6 ------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/providers/cloudant/pyproject.toml b/providers/cloudant/pyproject.toml index 6911729ab59f4..d2f56c6bb50b2 100644 --- a/providers/cloudant/pyproject.toml +++ b/providers/cloudant/pyproject.toml @@ -61,11 +61,19 @@ dependencies = [ "ibmcloudant>=0.10.0", ] +# The optional dependencies should be modified in place in the generated file +# Any change in the dependencies is preserved when the file is regenerated +[project.optional-dependencies] +"common.compat" = [ + "apache-airflow-providers-common-compat>=1.7.4", # + TODO: bump to next version +] + [dependency-groups] 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/cloudant/src/airflow/providers/cloudant/hooks/cloudant.py b/providers/cloudant/src/airflow/providers/cloudant/hooks/cloudant.py index 1101abe9b1b33..f0c32119a690e 100644 --- a/providers/cloudant/src/airflow/providers/cloudant/hooks/cloudant.py +++ b/providers/cloudant/src/airflow/providers/cloudant/hooks/cloudant.py @@ -24,7 +24,7 @@ from ibmcloudant import CloudantV1, CouchDbSessionAuthenticator from airflow.exceptions import AirflowException -from airflow.providers.cloudant.version_compat import BaseHook +from airflow.providers.common.compat.sdk import BaseHook if TYPE_CHECKING: from airflow.models import Connection diff --git a/providers/cloudant/src/airflow/providers/cloudant/version_compat.py b/providers/cloudant/src/airflow/providers/cloudant/version_compat.py index 465da77d0d9cb..a4fae50317e81 100644 --- a/providers/cloudant/src/airflow/providers/cloudant/version_compat.py +++ b/providers/cloudant/src/airflow/providers/cloudant/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 f307150a3557279e58a8a5435c464e228e214f04 Mon Sep 17 00:00:00 2001 From: rich7420 <101171023+rich7420@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:48:50 +0800 Subject: [PATCH 2/2] Remove optional dependencies from pyproject.toml Removed optional dependencies section from pyproject.toml --- providers/cloudant/pyproject.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/providers/cloudant/pyproject.toml b/providers/cloudant/pyproject.toml index d2f56c6bb50b2..95920a4d68629 100644 --- a/providers/cloudant/pyproject.toml +++ b/providers/cloudant/pyproject.toml @@ -58,14 +58,8 @@ 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", - "ibmcloudant>=0.10.0", -] - -# The optional dependencies should be modified in place in the generated file -# Any change in the dependencies is preserved when the file is regenerated -[project.optional-dependencies] -"common.compat" = [ "apache-airflow-providers-common-compat>=1.7.4", # + TODO: bump to next version + "ibmcloudant>=0.10.0", ] [dependency-groups]