Skip to content

Commit 7b78a72

Browse files
authored
Migrate openfaas provider to common.compat (#57134)
1 parent 23a4d8f commit 7b78a72

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

providers/openfaas/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ requires-python = ">=3.10"
5858
# After you modify the dependencies, and rebuild your Breeze CI image with ``breeze ci-image build``
5959
dependencies = [
6060
"apache-airflow>=2.10.0",
61+
"apache-airflow-providers-common-compat>=1.8.0",
6162
]
6263

6364
[dependency-groups]
6465
dev = [
6566
"apache-airflow",
6667
"apache-airflow-task-sdk",
6768
"apache-airflow-devel-common",
69+
"apache-airflow-providers-common-compat",
6870
# Additional devel dependencies (do not remove this line and add extra development dependencies)
6971
]
7072

providers/openfaas/src/airflow/providers/openfaas/hooks/openfaas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import requests
2323

2424
from airflow.exceptions import AirflowException
25-
from airflow.providers.openfaas.version_compat import BaseHook
25+
from airflow.providers.common.compat.sdk import BaseHook
2626

2727
OK_STATUS_CODE = 202
2828

providers/openfaas/src/airflow/providers/openfaas/version_compat.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
3535
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
3636
AIRFLOW_V_3_1_PLUS: bool = get_base_airflow_version_tuple() >= (3, 1, 0)
3737

38-
if AIRFLOW_V_3_1_PLUS:
39-
from airflow.sdk import BaseHook
40-
else:
41-
from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
42-
4338
__all__ = [
4439
"AIRFLOW_V_3_0_PLUS",
4540
"AIRFLOW_V_3_1_PLUS",
46-
"BaseHook",
4741
]

0 commit comments

Comments
 (0)