From 563c217b5c0d7107a5c6964fc590120e4769f959 Mon Sep 17 00:00:00 2001 From: rich7420 Date: Wed, 22 Oct 2025 23:46:41 +0800 Subject: [PATCH 1/2] Migrate remaining providers to common.compat compatibility layer --- providers/singularity/pyproject.toml | 6 ++++++ .../providers/singularity/operators/singularity.py | 4 ++-- .../src/airflow/providers/singularity/version_compat.py | 9 +-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/providers/singularity/pyproject.toml b/providers/singularity/pyproject.toml index d818114e2aa91..78088715346af 100644 --- a/providers/singularity/pyproject.toml +++ b/providers/singularity/pyproject.toml @@ -61,11 +61,17 @@ dependencies = [ "spython>=0.0.56", ] +[project.optional-dependencies] +"common.compat" = [ + "apache-airflow-providers-common-compat>=1.7.4", # + TODO: bump to next version +] + [dependency-groups] 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) ] diff --git a/providers/singularity/src/airflow/providers/singularity/operators/singularity.py b/providers/singularity/src/airflow/providers/singularity/operators/singularity.py index b527e61a5bd21..fcb71b5cf1b09 100644 --- a/providers/singularity/src/airflow/providers/singularity/operators/singularity.py +++ b/providers/singularity/src/airflow/providers/singularity/operators/singularity.py @@ -26,10 +26,10 @@ from spython.main import Client from airflow.exceptions import AirflowException -from airflow.providers.singularity.version_compat import BaseOperator +from airflow.providers.common.compat.sdk import BaseOperator if TYPE_CHECKING: - from airflow.providers.singularity.version_compat import Context + from airflow.providers.common.compat.sdk import Context class SingularityOperator(BaseOperator): diff --git a/providers/singularity/src/airflow/providers/singularity/version_compat.py b/providers/singularity/src/airflow/providers/singularity/version_compat.py index 2b5c813d224b5..fe5ec311885a7 100644 --- a/providers/singularity/src/airflow/providers/singularity/version_compat.py +++ b/providers/singularity/src/airflow/providers/singularity/version_compat.py @@ -29,11 +29,4 @@ def get_base_airflow_version_tuple() -> tuple[int, int, int]: AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0) -if AIRFLOW_V_3_0_PLUS: - from airflow.sdk import BaseOperator - from airflow.sdk.definitions.context import Context -else: - from airflow.models import BaseOperator - from airflow.utils.context import Context - -__all__ = ["AIRFLOW_V_3_0_PLUS", "BaseOperator", "Context"] +__all__ = ["AIRFLOW_V_3_0_PLUS"] From e544816fd7eb97bb795cd6d98f26d301ffa8a809 Mon Sep 17 00:00:00 2001 From: rich7420 Date: Thu, 23 Oct 2025 00:51:01 +0800 Subject: [PATCH 2/2] remove extra modification --- providers/singularity/pyproject.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/providers/singularity/pyproject.toml b/providers/singularity/pyproject.toml index 78088715346af..d1be1dc5c1d2b 100644 --- a/providers/singularity/pyproject.toml +++ b/providers/singularity/pyproject.toml @@ -58,12 +58,8 @@ 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", - "spython>=0.0.56", -] - -[project.optional-dependencies] -"common.compat" = [ "apache-airflow-providers-common-compat>=1.7.4", # + TODO: bump to next version + "spython>=0.0.56", ] [dependency-groups]