From a0ab36a6b005dbcb393bd279240597942f7c42e5 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 28 Oct 2026 12:24:57 -0400 Subject: [PATCH] PYTHON-6199 Make setup-uv.py pass on older Python versions --- .evergreen/scripts/setup-uv.py | 8 ++++---- pyproject.toml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.evergreen/scripts/setup-uv.py b/.evergreen/scripts/setup-uv.py index dc7b0964f4..f26b8b180c 100755 --- a/.evergreen/scripts/setup-uv.py +++ b/.evergreen/scripts/setup-uv.py @@ -4,9 +4,9 @@ install-dependencies.sh probes with `setup-uv.py --check`, sources ensure-uv.sh (which finds or installs uv), then runs this script for the rest. Only the standard library is used. -""" -from __future__ import annotations +This runs under the host's system python3, which may be older than our minimum supported version. +""" import os import re @@ -57,7 +57,7 @@ def _install_uv_astral() -> None: curl = shutil.which("curl") sh = shutil.which("sh") proc = subprocess.run( # noqa: S603 - [curl, "-LsSf", ASTRAL_INSTALL_URL], capture_output=True, env=env, check=True + [curl, "-LsSf", ASTRAL_INSTALL_URL], stdout=subprocess.PIPE, env=env, check=True ) subprocess.run([sh], input=proc.stdout, env=env, check=True) # noqa: S603 _add_path(os.environ["UV_TOOL_BIN_DIR"]) @@ -141,7 +141,7 @@ def _pinned_uv_installed() -> bool: if uv_path is None: return False proc = subprocess.run( # noqa: S603 - [uv_path, "--version"], capture_output=True, check=True + [uv_path, "--version"], stdout=subprocess.PIPE, check=True ) # Output looks like "uv 0.12.12 (aarch64-unknown-linux-gnu)". return proc.stdout.decode().split()[1] == pin[len("==") :] diff --git a/pyproject.toml b/pyproject.toml index 2a217a636a..a181d9c69d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -263,6 +263,7 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|dummy.*)$" [tool.ruff.lint.per-file-ignores] "pymongo/__init__.py" = ["E402"] ".evergreen/scripts/*.py" = ["T201"] +".evergreen/scripts/setup-uv.py" = ["I002"] "test/*.py" = ["PT", "E402", "PLW", "SIM", "E741", "PTH", "S", "B904", "E722", "T201", "RET", "ARG", "F405", "B028", "PGH001", "B018", "F403", "RUF015", "E731", "B007", "UP031", "F401", "B023", "F811"]