From 97673827ee4478b48c82e467c41eb0d1a4f585a2 Mon Sep 17 00:00:00 2001 From: Jens Scheffler Date: Fri, 24 Oct 2025 00:07:21 +0200 Subject: [PATCH 1/3] Extract prek hooks for Common.Compat provider --- .pre-commit-config.yaml | 6 ---- .../common/compat/.pre-commit-config.yaml | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 providers/common/compat/.pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f579404b65ea..050409dd723d8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -465,12 +465,6 @@ repos: entry: ./scripts/ci/prek/check_airflow_imports.py --pattern '^openlineage\.client\.(facet|run)' --message "You should import from `airflow.providers.common.compat.openlineage.facet` instead." - - id: check-common-compat-sdk-imports-in-sync - name: Check common.compat sdk TYPE_CHECKING matches runtime maps - language: python - files: ^providers/common/compat/src/airflow/providers/common/compat/sdk\.py$ - pass_filenames: false - entry: ./scripts/ci/prek/check_common_compat_lazy_imports.py - id: check-airflow-providers-bug-report-template name: Sort airflow-bug-report provider list language: python diff --git a/providers/common/compat/.pre-commit-config.yaml b/providers/common/compat/.pre-commit-config.yaml new file mode 100644 index 0000000000000..645e1f64a4d09 --- /dev/null +++ b/providers/common/compat/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +--- +default_stages: [pre-commit, pre-push] +minimum_prek_version: '0.0.28' +repos: + - repo: local + hooks: + - id: check-common-compat-sdk-imports-in-sync + name: Check common.compat sdk TYPE_CHECKING matches runtime maps + language: python + files: ^providers/common/compat/src/airflow/providers/common/compat/sdk\.py$ + pass_filenames: false + entry: ../../scripts/ci/prek/check_common_compat_lazy_imports.py From 41dcdeca1ff2e5870debfbfcd413126a6792ce52 Mon Sep 17 00:00:00 2001 From: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> Date: Fri, 24 Oct 2025 00:18:43 +0200 Subject: [PATCH 2/3] Apply suggestion from @jscheffl --- providers/common/compat/.pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/common/compat/.pre-commit-config.yaml b/providers/common/compat/.pre-commit-config.yaml index 645e1f64a4d09..308ef70f38121 100644 --- a/providers/common/compat/.pre-commit-config.yaml +++ b/providers/common/compat/.pre-commit-config.yaml @@ -23,6 +23,6 @@ repos: - id: check-common-compat-sdk-imports-in-sync name: Check common.compat sdk TYPE_CHECKING matches runtime maps language: python - files: ^providers/common/compat/src/airflow/providers/common/compat/sdk\.py$ + files: ^src/airflow/providers/common/compat/sdk\.py$ pass_filenames: false entry: ../../scripts/ci/prek/check_common_compat_lazy_imports.py From 77f3dfa1cd268384be56cbdd703ea78436c7ff15 Mon Sep 17 00:00:00 2001 From: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> Date: Fri, 24 Oct 2025 07:47:26 +0200 Subject: [PATCH 3/3] Update providers/common/compat/.pre-commit-config.yaml Co-authored-by: Kaxil Naik --- providers/common/compat/.pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/common/compat/.pre-commit-config.yaml b/providers/common/compat/.pre-commit-config.yaml index 308ef70f38121..d9c7a9f588847 100644 --- a/providers/common/compat/.pre-commit-config.yaml +++ b/providers/common/compat/.pre-commit-config.yaml @@ -25,4 +25,4 @@ repos: language: python files: ^src/airflow/providers/common/compat/sdk\.py$ pass_filenames: false - entry: ../../scripts/ci/prek/check_common_compat_lazy_imports.py + entry: ../../../scripts/ci/prek/check_common_compat_lazy_imports.py