diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7723c7a7708e1..09690edc5db6c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -197,15 +197,6 @@ repos: additional_dependencies: ['pyyaml'] pass_filenames: false require_serial: true - - id: update-build-dependencies - name: Update build-dependencies to latest (manual) - entry: ./scripts/ci/pre_commit/update_build_dependencies.py - stages: ['manual'] - language: python - files: ^.pre-commit-config.yaml$|^scripts/ci/pre_commit/update_build_dependencies.py$ - pass_filenames: false - require_serial: true - additional_dependencies: ['rich>=12.4.4'] - id: update-installers name: Update installers to latest (manual) entry: ./scripts/ci/pre_commit/update_installers.py diff --git a/contributing-docs/08_static_code_checks.rst b/contributing-docs/08_static_code_checks.rst index 0775c83ef0621..abfb737890460 100644 --- a/contributing-docs/08_static_code_checks.rst +++ b/contributing-docs/08_static_code_checks.rst @@ -360,8 +360,6 @@ require Breeze Docker image to be built locally. +-----------------------------------------------------------+--------------------------------------------------------+---------+ | update-breeze-readme-config-hash | Update Breeze README.md with config files hash | | +-----------------------------------------------------------+--------------------------------------------------------+---------+ -| update-build-dependencies | Update build-dependencies to latest (manual) | | -+-----------------------------------------------------------+--------------------------------------------------------+---------+ | update-chart-dependencies | Update chart dependencies to latest (manual) | | +-----------------------------------------------------------+--------------------------------------------------------+---------+ | update-common-sql-api-stubs | Check and update common.sql API stubs | | diff --git a/dev/breeze/doc/images/output_static-checks.svg b/dev/breeze/doc/images/output_static-checks.svg index 9b18f11105286..a2422824dd981 100644 --- a/dev/breeze/doc/images/output_static-checks.svg +++ b/dev/breeze/doc/images/output_static-checks.svg @@ -368,11 +368,11 @@ | replace-bad-characters | rst-backticks | ruff | ruff-format | shellcheck |      trailing-whitespace | ts-compile-format-lint-ui | ts-compile-format-lint-www |    update-black-version | update-breeze-cmd-output |                                 -update-breeze-readme-config-hash | update-build-dependencies |                    -update-chart-dependencies | update-common-sql-api-stubs | update-er-diagram |     -update-extras | update-in-the-wild-to-be-sorted |                                 -update-inlined-dockerfile-scripts | update-installed-providers-to-be-sorted |     -update-installers | update-local-yml-file | update-migration-references |         +update-breeze-readme-config-hash | update-chart-dependencies |                    +update-common-sql-api-stubs | update-er-diagram | update-extras |                 +update-in-the-wild-to-be-sorted | update-inlined-dockerfile-scripts |             +update-installed-providers-to-be-sorted | update-installers |                     +update-local-yml-file | update-migration-references |                             update-openapi-spec-tags-to-be-sorted | update-providers-dependencies |           update-providers-init-py | update-reproducible-source-date-epoch |                update-spelling-wordlist-to-be-sorted | update-supported-versions |               diff --git a/dev/breeze/doc/images/output_static-checks.txt b/dev/breeze/doc/images/output_static-checks.txt index b1b1e4240851e..a685635825ff4 100644 --- a/dev/breeze/doc/images/output_static-checks.txt +++ b/dev/breeze/doc/images/output_static-checks.txt @@ -1 +1 @@ -008d474dccfab2873f4d67935b5be81c +1e545fdd89efbdd78a883519b6d93ce2 diff --git a/dev/breeze/src/airflow_breeze/pre_commit_ids.py b/dev/breeze/src/airflow_breeze/pre_commit_ids.py index a3b1ba37266e5..a4495df607ecd 100644 --- a/dev/breeze/src/airflow_breeze/pre_commit_ids.py +++ b/dev/breeze/src/airflow_breeze/pre_commit_ids.py @@ -134,7 +134,6 @@ "update-black-version", "update-breeze-cmd-output", "update-breeze-readme-config-hash", - "update-build-dependencies", "update-chart-dependencies", "update-common-sql-api-stubs", "update-er-diagram", diff --git a/scripts/ci/pre_commit/update_build_dependencies.py b/scripts/ci/pre_commit/update_build_dependencies.py deleted file mode 100755 index 8d5cc1a67c741..0000000000000 --- a/scripts/ci/pre_commit/update_build_dependencies.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# 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. -from __future__ import annotations - -import os -import re -import shutil -import subprocess -import sys -import tempfile -from pathlib import Path - -COMMON_PRECOMMIT_PATH = Path(__file__).parent.resolve() -sys.path.insert(0, COMMON_PRECOMMIT_PATH.as_posix()) # make sure common_precommit_utils is imported -from common_precommit_utils import console - -AIRFLOW_SOURCES = Path(__file__).parents[3].resolve() -PYPROJECT_TOML_FILE = AIRFLOW_SOURCES / "pyproject.toml" - -HATCHLING_MATCH = re.compile(r"hatchling==[0-9.]*") - -FILES_TO_REPLACE_HATCHLING_IN = [ - AIRFLOW_SOURCES / ".pre-commit-config.yaml", - AIRFLOW_SOURCES / "clients" / "python" / "pyproject.toml", - AIRFLOW_SOURCES / "docker_tests" / "requirements.txt", -] - -files_changed = False - - -if __name__ == "__main__": - python38_bin = shutil.which("python3.9") - if not python38_bin: - print("Python 3.9 is required to run this script.") - sys.exit(1) - temp_dir = Path(tempfile.mkdtemp()) - hatchling_spec = "" - try: - subprocess.check_call([python38_bin, "-m", "venv", temp_dir.as_posix()]) - venv_python = temp_dir / "bin" / "python" - subprocess.check_call([venv_python, "-m", "pip", "install", "gitpython", "hatchling"]) - frozen_deps = subprocess.check_output([venv_python, "-m", "pip", "freeze"], text=True) - deps = [dep for dep in sorted(frozen_deps.splitlines()) if not dep.startswith("pip==")] - pyproject_toml_content = PYPROJECT_TOML_FILE.read_text() - result = [] - skipping = False - for line in pyproject_toml_content.splitlines(): - if not skipping: - result.append(line) - if line == "requires = [": - skipping = True - for dep in deps: - # Tomli is only needed for Python < 3.11, otherwise stdlib tomllib is used - if dep.startswith("tomli=="): - dep = dep + "; python_version < '3.11'" - result.append(f' "{dep}",') - if dep.startswith("hatchling=="): - hatchling_spec = dep - if skipping and line == "]": - skipping = False - result.append(line) - result.append("") - new_pyproject_toml_file_content = "\n".join(result) - if new_pyproject_toml_file_content != pyproject_toml_content: - if os.environ.get("SKIP_TROVE_CLASSIFIERS_ONLY", "false").lower() == "true": - diff = set(new_pyproject_toml_file_content.splitlines()) - ( - set(pyproject_toml_content.splitlines()) - ) - if len(diff) == 1 and "trove-classifiers" in next(iter(diff)): - console.print("\n[yellow]Trove classifiers were changed. Please update them manually.\n") - console.print( - "\n[blue]Please run:[/blue]\n\n" - "pre-commit run --hook-stage manual update-build-dependencies --all-files\n" - ) - console.print("\n[blue]Then commit the resulting files.\n") - sys.exit(0) - files_changed = True - PYPROJECT_TOML_FILE.write_text(new_pyproject_toml_file_content) - for file_to_replace_hatchling in FILES_TO_REPLACE_HATCHLING_IN: - old_file_content = file_to_replace_hatchling.read_text() - new_file_content = HATCHLING_MATCH.sub(hatchling_spec, old_file_content, re.MULTILINE) - if new_file_content != old_file_content: - files_changed = True - file_to_replace_hatchling.write_text(new_file_content) - finally: - shutil.rmtree(temp_dir) - - if files_changed: - console.print("\n[red]Build dependencies have changed. Please update them manually.\n") - console.print( - "\n[blue]Please run:[/blue]\n\n" - "pre-commit run --hook-stage manual update-build-dependencies --all-files\n" - ) - console.print("\n[blue]Then commit the resulting files.\n") - sys.exit(1)