Skip to content

Commit b01245e

Browse files
0lai0kaxil
andauthored
Migrate dingding provider to common.compat (apache#57076)
* Migrate remaining providers to common.compat compatibility layer in dingding * fix dingding static check * Update providers/dingding/pyproject.toml Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com> * Fix tests --------- Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
1 parent b995c85 commit b01245e

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

providers/apache/druid/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ dependencies = [
6969
"apache.hive" = [
7070
"apache-airflow-providers-apache-hive"
7171
]
72+
"common.compat" = [
73+
"apache-airflow-providers-common-compat"
74+
]
7275

7376
[dependency-groups]
7477
dev = [

providers/dingding/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ 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
"apache-airflow-providers-http",
6263
]
6364

@@ -66,6 +67,7 @@ dev = [
6667
"apache-airflow",
6768
"apache-airflow-task-sdk",
6869
"apache-airflow-devel-common",
70+
"apache-airflow-providers-common-compat",
6971
"apache-airflow-providers-http",
7072
# Additional devel dependencies (do not remove this line and add extra development dependencies)
7173
]

providers/dingding/src/airflow/providers/dingding/operators/dingding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
from collections.abc import Sequence
2121
from typing import TYPE_CHECKING
2222

23+
from airflow.providers.common.compat.sdk import BaseOperator
2324
from airflow.providers.dingding.hooks.dingding import DingdingHook
24-
from airflow.providers.dingding.version_compat import BaseOperator
2525

2626
if TYPE_CHECKING:
27-
from airflow.providers.dingding.version_compat import Context
27+
from airflow.providers.common.compat.sdk import Context
2828

2929

3030
class DingdingOperator(BaseOperator):

providers/dingding/src/airflow/providers/dingding/version_compat.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
2929

3030
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
3131

32-
if AIRFLOW_V_3_0_PLUS:
33-
from airflow.sdk import BaseOperator
34-
from airflow.sdk.definitions.context import Context
35-
else:
36-
from airflow.models import BaseOperator
37-
from airflow.utils.context import Context
38-
3932
__all__ = [
4033
"AIRFLOW_V_3_0_PLUS",
41-
"BaseOperator",
42-
"Context",
4334
]

0 commit comments

Comments
 (0)