Skip to content

Commit

Permalink
Disable uv upgrade checks temporarily (#37996)
Browse files Browse the repository at this point in the history
Until astral-sh/uv#2302 is solved we should
disable UV upgrade check as 0.1.16 version of `uv` does not
properly validate our pyproject.toml with Draft PEP-0639 extension
(licence-files).

GitOrigin-RevId: 66f28f2fc9622813ce8e70fd2c341d73e880c90c
  • Loading branch information
potiuk authored and Cloud Composer Team committed Sep 20, 2024
1 parent 31cda25 commit 86dbead
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ jobs:
--hook-stage manual
update-installers
if: always()
env:
UPGRADE_UV: "false"
- name: "Run automated upgrade for chart dependencies"
run: >
pre-commit run
Expand Down
13 changes: 11 additions & 2 deletions scripts/ci/pre_commit/pre_commit_update_installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# under the License.
from __future__ import annotations

import os
import re
import sys
from pathlib import Path
Expand Down Expand Up @@ -46,6 +47,13 @@ def get_latest_pypi_version(package_name: str) -> str:
UV_PATTERN = re.compile(r"AIRFLOW_UV_VERSION=[0-9.]+")
UV_GREATER_PATTERN = re.compile(r'"uv>=[0-9]+[0-9.]+"')

# For now we temporarily disable upgrading uv in the pre-commit hook because the latest version (0.1.16)
# is not compatible with our pyproject.toml using Draft https://peps.python.org/pep-0639/
# licence-files key (which hatchling backend already supports nicely)
# We will re-enable it once the problem is addressed:
# Issue: https://github.com/astral-sh/uv/issues/2302
UPGRADE_UV: bool = os.environ.get("UPGRADE_UV", "true").lower() == "true"

if __name__ == "__main__":
pip_version = get_latest_pypi_version("pip")
console.print(f"[bright_blue]Latest pip version: {pip_version}")
Expand All @@ -58,8 +66,9 @@ def get_latest_pypi_version(package_name: str) -> str:
file_content = file.read_text()
new_content = file_content
new_content = re.sub(PIP_PATTERN, f"AIRFLOW_PIP_VERSION={pip_version}", new_content, re.MULTILINE)
new_content = re.sub(UV_PATTERN, f"AIRFLOW_UV_VERSION={uv_version}", new_content, re.MULTILINE)
new_content = re.sub(UV_GREATER_PATTERN, f'"uv>={uv_version}"', new_content, re.MULTILINE)
if UPGRADE_UV:
new_content = re.sub(UV_PATTERN, f"AIRFLOW_UV_VERSION={uv_version}", new_content, re.MULTILINE)
new_content = re.sub(UV_GREATER_PATTERN, f'"uv>={uv_version}"', new_content, re.MULTILINE)
if new_content != file_content:
file.write_text(new_content)
console.print(f"[bright_blue]Updated {file}")
Expand Down

0 comments on commit 86dbead

Please sign in to comment.