This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 61a181fd59 Remove deprecated ``TaskMixin`` class (#41394)
61a181fd59 is described below
commit 61a181fd59d788d291ac47a2f45ebd96f6b2e403
Author: Kaxil Naik <[email protected]>
AuthorDate: Mon Aug 12 03:31:15 2024 +0100
Remove deprecated ``TaskMixin`` class (#41394)
The ``airflow.models.taskMixin.TaskMixin`` class has been removed. It was
previously
deprecated in favor of the ``airflow.models.taskMixin.DependencyMixin``
class.
---
airflow/models/taskmixin.py | 21 ++-------------------
airflow/models/xcom_arg.py | 8 ++++----
airflow/utils/task_group.py | 4 ++--
newsfragments/41394.significant.rst | 6 ++++++
4 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/airflow/models/taskmixin.py b/airflow/models/taskmixin.py
index e1520d23da..05768ff36f 100644
--- a/airflow/models/taskmixin.py
+++ b/airflow/models/taskmixin.py
@@ -16,11 +16,10 @@
# under the License.
from __future__ import annotations
-import warnings
from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING, Any, Iterable, Sequence
-from airflow.exceptions import AirflowException, RemovedInAirflow3Warning
+from airflow.exceptions import AirflowException
from airflow.utils.types import NOTSET
if TYPE_CHECKING:
@@ -89,7 +88,7 @@ class DependencyMixin:
self, other: DependencyMixin, upstream: bool = True, edge_modifier:
EdgeModifier | None = None
) -> None:
"""
- Update relationship information about another TaskMixin. Default is
no-op.
+ Update relationship information about another DependencyMixin. Default
is no-op.
Override if necessary.
"""
@@ -128,22 +127,6 @@ class DependencyMixin:
yield from cls._iter_references(o)
-class TaskMixin(DependencyMixin):
- """
- Mixin to provide task-related things.
-
- :meta private:
- """
-
- def __init_subclass__(cls) -> None:
- warnings.warn(
- f"TaskMixin has been renamed to DependencyMixin, please update
{cls.__name__}",
- category=RemovedInAirflow3Warning,
- stacklevel=2,
- )
- return super().__init_subclass__()
-
-
class DAGNode(DependencyMixin, metaclass=ABCMeta):
"""
A base class for a node in the graph of a workflow.
diff --git a/airflow/models/xcom_arg.py b/airflow/models/xcom_arg.py
index 590327eaa9..83ff4f25c6 100644
--- a/airflow/models/xcom_arg.py
+++ b/airflow/models/xcom_arg.py
@@ -135,12 +135,12 @@ class XComArg(ResolveMixin, DependencyMixin):
@property
def roots(self) -> list[DAGNode]:
- """Required by TaskMixin."""
+ """Required by DependencyMixin."""
return [op for op, _ in self.iter_references()]
@property
def leaves(self) -> list[DAGNode]:
- """Required by TaskMixin."""
+ """Required by DependencyMixin."""
return [op for op, _ in self.iter_references()]
def set_upstream(
@@ -148,7 +148,7 @@ class XComArg(ResolveMixin, DependencyMixin):
task_or_task_list: DependencyMixin | Sequence[DependencyMixin],
edge_modifier: EdgeModifier | None = None,
):
- """Proxy to underlying operator set_upstream method. Required by
TaskMixin."""
+ """Proxy to underlying operator set_upstream method. Required by
DependencyMixin."""
for operator, _ in self.iter_references():
operator.set_upstream(task_or_task_list, edge_modifier)
@@ -157,7 +157,7 @@ class XComArg(ResolveMixin, DependencyMixin):
task_or_task_list: DependencyMixin | Sequence[DependencyMixin],
edge_modifier: EdgeModifier | None = None,
):
- """Proxy to underlying operator set_downstream method. Required by
TaskMixin."""
+ """Proxy to underlying operator set_downstream method. Required by
DependencyMixin."""
for operator, _ in self.iter_references():
operator.set_downstream(task_or_task_list, edge_modifier)
diff --git a/airflow/utils/task_group.py b/airflow/utils/task_group.py
index d1dd9822be..f3d46ea6ea 100644
--- a/airflow/utils/task_group.py
+++ b/airflow/utils/task_group.py
@@ -369,12 +369,12 @@ class TaskGroup(DAGNode):
@property
def roots(self) -> list[BaseOperator]:
- """Required by TaskMixin."""
+ """Required by DependencyMixin."""
return list(self.get_roots())
@property
def leaves(self) -> list[BaseOperator]:
- """Required by TaskMixin."""
+ """Required by DependencyMixin."""
return list(self.get_leaves())
def get_roots(self) -> Generator[BaseOperator, None, None]:
diff --git a/newsfragments/41394.significant.rst
b/newsfragments/41394.significant.rst
new file mode 100644
index 0000000000..d973efb81d
--- /dev/null
+++ b/newsfragments/41394.significant.rst
@@ -0,0 +1,6 @@
+**Breaking Change**
+
+The ``airflow.models.taskMixin.TaskMixin`` class has been removed. It was
previously
+deprecated in favor of the ``airflow.models.taskMixin.DependencyMixin`` class.
+If your code relies on ``TaskMixin``, please update it to use
``DependencyMixin`` instead
+to ensure compatibility with Airflow 3.0 and beyond.