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
1 change: 1 addition & 0 deletions providers/docker/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"docker>=7.1.0",
"python-dotenv>=0.21.0",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@
if TYPE_CHECKING:
from typing import Literal

from airflow.providers.common.compat.sdk import Context
from airflow.sdk.bases.decorator import TaskDecorator

if AIRFLOW_V_3_0_PLUS:
from airflow.sdk.definitions.context import Context
else:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context

Serializer = Literal["pickle", "dill", "cloudpickle"]

try:
Expand Down
4 changes: 2 additions & 2 deletions providers/docker/src/airflow/providers/docker/hooks/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
from docker.errors import APIError, DockerException

from airflow.exceptions import AirflowException, AirflowNotFoundException
from airflow.providers.docker.version_compat import BaseHook
from airflow.providers.common.compat.sdk import BaseHook

if TYPE_CHECKING:
from airflow.models import Connection
from airflow.providers.common.compat.sdk import Connection


class DockerHook(BaseHook):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from docker import APIClient
from docker.types import DeviceRequest

from airflow.sdk.definitions.context import Context
from airflow.providers.common.compat.sdk import Context
from airflow.sdk.types import Logger


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@
from airflow.utils.strings import get_random_string

if TYPE_CHECKING:
try:
from airflow.sdk.definitions.context import Context
except ImportError:
# TODO: Remove once provider drops support for Airflow 2
from airflow.utils.context import Context
from airflow.providers.common.compat.sdk import Context


class DockerSwarmOperator(DockerOperator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]:
# This is needed for DecoratedOperator compatibility
if AIRFLOW_V_3_1_PLUS:
from airflow.sdk import (
BaseHook,
BaseOperator,
)
else:
from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
from airflow.models import BaseOperator

__all__ = [
"AIRFLOW_V_3_0_PLUS",
"AIRFLOW_V_3_1_PLUS",
"BaseHook",
"BaseOperator",
]