Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions providers/cncf/kubernetes/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ requires-python = ">=3.10"
dependencies = [
"aiofiles>=23.2.0",
"apache-airflow>=2.10.0",
"apache-airflow-providers-common-compat>=1.7.4", # + TODO: bump to next version
"asgiref>=3.5.2",
"cryptography>=41.0.0",
# The Kubernetes API is known to introduce problems when upgraded to a MAJOR version. Airflow Core
Expand All @@ -79,6 +80,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)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from airflow.providers.cncf.kubernetes.python_kubernetes_script import (
write_python_script,
)
from airflow.providers.cncf.kubernetes.version_compat import (
from airflow.providers.common.compat.sdk import (
DecoratedOperator,
TaskDecorator,
task_decorator_factory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from typing import TYPE_CHECKING

from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator
from airflow.providers.cncf.kubernetes.version_compat import (
from airflow.providers.common.compat.sdk import (
DecoratedOperator,
TaskDecorator,
context_merge,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
container_is_completed,
container_is_running,
)
from airflow.providers.cncf.kubernetes.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook
from airflow.utils import yaml

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
PodNotFoundException,
PodPhase,
)
from airflow.providers.cncf.kubernetes.version_compat import AIRFLOW_V_3_1_PLUS, XCOM_RETURN_KEY
from airflow.providers.cncf.kubernetes.version_compat import AIRFLOW_V_3_1_PLUS
from airflow.providers.common.compat.sdk import XCOM_RETURN_KEY

if AIRFLOW_V_3_1_PLUS:
from airflow.sdk import BaseOperator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@

from airflow.exceptions import AirflowException
from airflow.providers.cncf.kubernetes.hooks.kubernetes import KubernetesHook
from airflow.providers.cncf.kubernetes.version_compat import AIRFLOW_V_3_0_PLUS

if AIRFLOW_V_3_0_PLUS:
from airflow.sdk import BaseSensorOperator
else:
from airflow.sensors.base import BaseSensorOperator # type: ignore[no-redef]
from airflow.providers.common.compat.sdk import BaseSensorOperator

if TYPE_CHECKING:
from airflow.utils.context import Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,4 @@ 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 = get_base_airflow_version_tuple() >= (3, 1, 0)

if AIRFLOW_V_3_1_PLUS:
from airflow.models.xcom import XCOM_RETURN_KEY
from airflow.sdk import BaseHook
from airflow.sdk.definitions.context import context_merge
else:
from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
from airflow.utils.context import context_merge # type: ignore[attr-defined, no-redef]
from airflow.utils.xcom import XCOM_RETURN_KEY # type: ignore[no-redef]

if AIRFLOW_V_3_0_PLUS:
from airflow.sdk.bases.decorator import DecoratedOperator, TaskDecorator, task_decorator_factory
else:
from airflow.decorators.base import ( # type: ignore[no-redef]
DecoratedOperator,
TaskDecorator,
task_decorator_factory,
)

# BaseOperator and BaseSensorOperator removed from version_compat to avoid circular imports
# Import them directly in files that need them instead

__all__ = [
"AIRFLOW_V_3_0_PLUS",
"AIRFLOW_V_3_1_PLUS",
"BaseHook",
"DecoratedOperator",
"TaskDecorator",
"task_decorator_factory",
"XCOM_RETURN_KEY",
"context_merge",
]
__all__ = ["AIRFLOW_V_3_0_PLUS", "AIRFLOW_V_3_1_PLUS"]