From 6a1efa27b382c323b351026039be094d74a0237c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 13 Aug 2026 10:41:43 -0500 Subject: [PATCH 1/3] PYTHON-5980 Reinstate exclude-newer uv config PR #2977 removed the per-run set-uv-exclude-newer action, which was correct once uv.lock is committed, but it also dropped the exclude-newer setting from pyproject.toml entirely. That setting still matters for uv lock itself, including the new weekly uv-lock-update.yml job, so restore it and regenerate the lock file. --- pyproject.toml | 2 ++ uv.lock | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 346df2f427..c612a89d29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,8 @@ Source = "https://github.com/mongodb/mongo-python-driver" Tracker = "https://jira.mongodb.org/projects/PYTHON/issues" [tool.uv] +# Wait 7 days before resolving newly published package versions. +exclude-newer = "7 days" # boto3 dropped Python 3.9 support in 1.43, so the universal lock forks at # 3.10. Without a floor the pre-3.10 fork back-solves to boto3 1.7.84 (2018), # whose vendored six and invalid escape sequences break test collection. No diff --git a/uv.lock b/uv.lock index 059eadd7b7..c24f82559b 100644 --- a/uv.lock +++ b/uv.lock @@ -8,6 +8,10 @@ resolution-markers = [ "python_full_version <= '3.9'", ] +[options] +exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values. +exclude-newer-span = "P7D" + [manifest] constraints = [{ name = "boto3", specifier = ">=1.34" }] From 8be3d31d17622ffff310040a4856a59d0170c3dc Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 13 Aug 2026 11:13:20 -0500 Subject: [PATCH 2/3] PYTHON-5980 Ensure uv >= 0.10 in install-dependencies.sh Evergreen hosts can have an older uv already on PATH, which doesn't support the relative exclude-newer value in pyproject.toml and fails to parse it. Check the installed version and force a fresh install into PYMONGO_BIN_DIR (which already takes precedence on PATH) when it's missing or too old. --- .evergreen/scripts/install-dependencies.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 8df2af79ca..2a8a8edce8 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -15,8 +15,17 @@ if [ -z "${PYMONGO_BIN_DIR:-}" ]; then PYMONGO_BIN_DIR="$HOME/.local/bin" fi -# Ensure uv is installed. -if ! command -v uv &>/dev/null; then +# Ensure uv >= 0.10 is installed (older versions don't support pyproject.toml +# settings we rely on, e.g. relative `exclude-newer` values). +MIN_UV_VERSION="0.10.0" + +uv_version_ok() { + command -v uv &>/dev/null || return 1 + _current="$(uv --version | cut -d' ' -f2)" + [ "$(printf '%s\n%s\n' "$MIN_UV_VERSION" "$_current" | sort -V | head -n1)" = "$MIN_UV_VERSION" ] +} + +if ! uv_version_ok; then _BIN_DIR=$PYMONGO_BIN_DIR mkdir -p ${_BIN_DIR} echo "Installing uv..." @@ -26,6 +35,10 @@ if ! command -v uv &>/dev/null; then fi export PATH="$PYMONGO_BIN_DIR:$PATH" echo "Installing uv... done." + if ! uv_version_ok; then + echo "Installed uv $(uv --version) but >= $MIN_UV_VERSION is required." >&2 + exit 1 + fi fi # Ensure just is installed. From 36b274551eed10416d670e1fb275688725cdb5ed Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 13 Aug 2026 12:37:53 -0500 Subject: [PATCH 3/3] PYTHON-5980 Use a portable version comparison in install-dependencies.sh sort -V is a GNU extension not guaranteed on macOS's stock sort, and Evergreen runs macOS variants through this script. Compare the major/minor/patch components directly in bash instead. --- .evergreen/scripts/install-dependencies.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 2a8a8edce8..a575f0e799 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -22,7 +22,13 @@ MIN_UV_VERSION="0.10.0" uv_version_ok() { command -v uv &>/dev/null || return 1 _current="$(uv --version | cut -d' ' -f2)" - [ "$(printf '%s\n%s\n' "$MIN_UV_VERSION" "$_current" | sort -V | head -n1)" = "$MIN_UV_VERSION" ] + IFS='.' read -r _min_major _min_minor _min_patch <<< "$MIN_UV_VERSION" + IFS='.' read -r _cur_major _cur_minor _cur_patch <<< "$_current" + [ "${_cur_major:-0}" -gt "${_min_major:-0}" ] && return 0 + [ "${_cur_major:-0}" -lt "${_min_major:-0}" ] && return 1 + [ "${_cur_minor:-0}" -gt "${_min_minor:-0}" ] && return 0 + [ "${_cur_minor:-0}" -lt "${_min_minor:-0}" ] && return 1 + [ "${_cur_patch:-0}" -ge "${_min_patch:-0}" ] } if ! uv_version_ok; then