From 2e8e37e012b42ce9c5f39333a07652395968fdac Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 29 Jul 2026 10:30:00 -0400 Subject: [PATCH 1/3] PYTHON-5862 Cleanup lockless uv usage --- .evergreen/run-mongodb-aws-ecs-test.sh | 12 +++++++----- .evergreen/run-tests.sh | 2 -- .evergreen/scripts/configure-env.sh | 1 - .evergreen/scripts/kms_tester.py | 10 ++++------ .evergreen/scripts/setup-tests.sh | 3 --- .github/workflows/test-python.yml | 3 --- justfile | 3 --- pyproject.toml | 3 --- 8 files changed, 11 insertions(+), 26 deletions(-) diff --git a/.evergreen/run-mongodb-aws-ecs-test.sh b/.evergreen/run-mongodb-aws-ecs-test.sh index 5c047548a4..ab85521c71 100755 --- a/.evergreen/run-mongodb-aws-ecs-test.sh +++ b/.evergreen/run-mongodb-aws-ecs-test.sh @@ -19,17 +19,19 @@ fi # Now we can safely enable xtrace set -o xtrace -# Install a c compiler. +# Install a C compiler (for the C extensions) and git (needed by uv to +# resolve the mockupdb git dependency). apt-get -qq update < /dev/null > /dev/null -apt-get -q install -y build-essential +apt-get -q install -y build-essential git export SET_XTRACE_ON=1 export CI=true -# This container has no git, so uv must never try to resolve the mockupdb -# git dependency; UV_NO_LOCK makes uv ignore any lock file entirely. -export UV_NO_LOCK=1 cd src rm -rf .venv +# Discard the lock file the host's uv runs wrote into src; exclude-newer +# invalidates it in the container anyway, so resolve fresh rather than from +# shipped host state. +rm -f uv.lock rm -f .evergreen/scripts/test-env.sh || true rm -f .evergreen/scripts/env.sh || true bash ./.evergreen/just.sh setup-tests auth_aws ecs-remote diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index fc9d07b6b1..4ec527c941 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -27,8 +27,6 @@ else fi # Start the test runner. -# Never create or read a uv.lock; hosts without git can't resolve mockupdb. -export UV_NO_LOCK=1 echo "Running tests with UV_PYTHON=${UV_PYTHON:-}..." echo "UV_ARGS=${UV_ARGS}" uv run ${UV_ARGS} --reinstall-package pymongo .evergreen/scripts/run_tests.py "$@" diff --git a/.evergreen/scripts/configure-env.sh b/.evergreen/scripts/configure-env.sh index 54ddc4c136..8dc328aab3 100755 --- a/.evergreen/scripts/configure-env.sh +++ b/.evergreen/scripts/configure-env.sh @@ -65,7 +65,6 @@ export CARGO_HOME="$CARGO_HOME" export UV_TOOL_DIR="$UV_TOOL_DIR" export UV_CACHE_DIR="$UV_CACHE_DIR" export UV_TOOL_BIN_DIR="$DRIVERS_TOOLS_BINARIES" -export UV_NO_LOCK=1 export PYMONGO_BIN_DIR="$PYMONGO_BIN_DIR" export PATH="$PATH_EXT" # shellcheck disable=SC2154 diff --git a/.evergreen/scripts/kms_tester.py b/.evergreen/scripts/kms_tester.py index 1c2a39ad39..910df26b89 100644 --- a/.evergreen/scripts/kms_tester.py +++ b/.evergreen/scripts/kms_tester.py @@ -33,9 +33,7 @@ def _setup_azure_vm(base_env: dict[str, str]) -> None: env["AZUREKMS_CMD"] = "sudo apt-get install -y python3-dev build-essential" run_command(f"{azure_dir}/run-command.sh", env=env) - env["AZUREKMS_CMD"] = ( - "CI=true UV_NO_LOCK=1 bash .evergreen/just.sh setup-tests kms azure-remote" - ) + env["AZUREKMS_CMD"] = "CI=true bash .evergreen/just.sh setup-tests kms azure-remote" run_command(f"{azure_dir}/run-command.sh", env=env) LOGGER.info("Setting up Azure VM... done.") @@ -55,7 +53,7 @@ def _setup_gcp_vm(base_env: dict[str, str]) -> None: env["GCPKMS_CMD"] = "sudo apt-get install -y python3-dev build-essential" run_command(f"{gcp_dir}/run-command.sh", env=env) - env["GCPKMS_CMD"] = "CI=true UV_NO_LOCK=1 bash ./.evergreen/just.sh setup-tests kms gcp-remote" + env["GCPKMS_CMD"] = "CI=true bash ./.evergreen/just.sh setup-tests kms gcp-remote" run_command(f"{gcp_dir}/run-command.sh", env=env) LOGGER.info("Setting up GCP VM...") @@ -132,10 +130,10 @@ def test_kms_send_to_remote(sub_test_name: str) -> None: key_name = os.environ["KEY_NAME"] key_vault_endpoint = os.environ["KEY_VAULT_ENDPOINT"] env["AZUREKMS_CMD"] = ( - f'KEY_NAME="{key_name}" KEY_VAULT_ENDPOINT="{key_vault_endpoint}" CI=true UV_NO_LOCK=1 bash ./.evergreen/just.sh run-tests' + f'KEY_NAME="{key_name}" KEY_VAULT_ENDPOINT="{key_vault_endpoint}" CI=true bash ./.evergreen/just.sh run-tests' ) else: - env["GCPKMS_CMD"] = "CI=true UV_NO_LOCK=1 ./.evergreen/just.sh run-tests" + env["GCPKMS_CMD"] = "CI=true ./.evergreen/just.sh run-tests" cmd = f"{DIRS[sub_test_name]}/run-command.sh" run_command(cmd, env=env) diff --git a/.evergreen/scripts/setup-tests.sh b/.evergreen/scripts/setup-tests.sh index 714eee9162..858906a39e 100755 --- a/.evergreen/scripts/setup-tests.sh +++ b/.evergreen/scripts/setup-tests.sh @@ -21,9 +21,6 @@ if [ -f $SCRIPT_DIR/env.sh ]; then source $SCRIPT_DIR/env.sh fi -# Never create or read a uv.lock; hosts without git can't resolve mockupdb. -export UV_NO_LOCK=1 - echo "Setting up tests with args \"$*\"..." uv run ${USE_ACTIVE_VENV:+--active} "$SCRIPT_DIR/setup_tests.py" "$@" echo "Setting up tests with args \"$*\"... done." diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index b288516b68..be31421289 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -17,9 +17,6 @@ defaults: permissions: contents: read -env: - UV_NO_LOCK: "1" - jobs: static: diff --git a/justfile b/justfile index f6f10ca5a9..df678cdbac 100644 --- a/justfile +++ b/justfile @@ -1,9 +1,6 @@ # See https://just.systems/man/en/ for instructions set shell := ["bash", "-c"] -# Don't let `uv` create or read uv.lock. -export UV_NO_LOCK := "1" - # Commonly used command segments. typing_run := "uv run --group typing --extra aws --extra encryption --with numpy --extra ocsp --extra snappy --extra test --extra zstd" docs_run := "uv run --extra docs" diff --git a/pyproject.toml b/pyproject.toml index dc3c098906..571e1a4778 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,9 +47,6 @@ Source = "https://github.com/mongodb/mongo-python-driver" Tracker = "https://jira.mongodb.org/projects/PYTHON/issues" [tool.uv] -# Only sync the (empty) dev group by default; groups like mockupdb require -# an explicit --group flag so hosts without git aren't forced to resolve it. -default-groups = ["dev"] # Wait 7 days before resolving newly published package versions. exclude-newer = "7 days" From 1c4da4918fe8b4a32455d61f724138559dc16cd9 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 29 Jul 2026 11:01:08 -0400 Subject: [PATCH 2/3] Comment cleanup --- .evergreen/run-mongodb-aws-ecs-test.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.evergreen/run-mongodb-aws-ecs-test.sh b/.evergreen/run-mongodb-aws-ecs-test.sh index ab85521c71..07a58a4cb2 100755 --- a/.evergreen/run-mongodb-aws-ecs-test.sh +++ b/.evergreen/run-mongodb-aws-ecs-test.sh @@ -28,9 +28,7 @@ export SET_XTRACE_ON=1 export CI=true cd src rm -rf .venv -# Discard the lock file the host's uv runs wrote into src; exclude-newer -# invalidates it in the container anyway, so resolve fresh rather than from -# shipped host state. +# Discard the lock file the host's uv runs wrote to resolve fresh rm -f uv.lock rm -f .evergreen/scripts/test-env.sh || true rm -f .evergreen/scripts/env.sh || true From 859ac951e6e48fed77084cecd102180072e741c0 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 29 Jul 2026 16:10:12 -0400 Subject: [PATCH 3/3] Cleanup comment --- .evergreen/run-mongodb-aws-ecs-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/run-mongodb-aws-ecs-test.sh b/.evergreen/run-mongodb-aws-ecs-test.sh index 07a58a4cb2..c823ed3c33 100755 --- a/.evergreen/run-mongodb-aws-ecs-test.sh +++ b/.evergreen/run-mongodb-aws-ecs-test.sh @@ -20,7 +20,7 @@ fi set -o xtrace # Install a C compiler (for the C extensions) and git (needed by uv to -# resolve the mockupdb git dependency). +# resolve the mockupdb git dependency) apt-get -qq update < /dev/null > /dev/null apt-get -q install -y build-essential git @@ -28,7 +28,7 @@ export SET_XTRACE_ON=1 export CI=true cd src rm -rf .venv -# Discard the lock file the host's uv runs wrote to resolve fresh +# Discard any lockfile written by the host so we resolve from scratch rm -f uv.lock rm -f .evergreen/scripts/test-env.sh || true rm -f .evergreen/scripts/env.sh || true