Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .evergreen/run-mongodb-aws-ecs-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ apt-get -qq update < /dev/null > /dev/null
apt-get -q install -y build-essential

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
rm -f .evergreen/scripts/test-env.sh || true
Expand Down
2 changes: 2 additions & 0 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ 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 "$@"
Expand Down
7 changes: 0 additions & 7 deletions .evergreen/scripts/configure-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ UV_TOOL_DIR=$PROJECT_DIRECTORY/.local/uv/tools
UV_CACHE_DIR=$PROJECT_DIRECTORY/.local/uv/cache
DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS/.bin"
MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
# GNU date on Linux and Windows, BSD date on macOS.
UV_EXCLUDE_NEWER="$(date -u -d '7 days ago' +%Y-%m-%d 2>/dev/null || date -u -v-7d +%Y-%m-%d)"
if [ -z "$UV_EXCLUDE_NEWER" ]; then
echo "Failed to compute UV_EXCLUDE_NEWER" >&2
exit 1
fi

# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
if [ "${CI:-}" == "true" ]; then
Expand Down Expand Up @@ -72,7 +66,6 @@ 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 UV_EXCLUDE_NEWER="$UV_EXCLUDE_NEWER"
export PYMONGO_BIN_DIR="$PYMONGO_BIN_DIR"
export PATH="$PATH_EXT"
# shellcheck disable=SC2154
Expand Down
10 changes: 6 additions & 4 deletions .evergreen/scripts/kms_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ 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"] = "bash .evergreen/just.sh setup-tests kms azure-remote"
env["AZUREKMS_CMD"] = (
"CI=true UV_NO_LOCK=1 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.")

Expand All @@ -53,7 +55,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"] = "bash ./.evergreen/just.sh setup-tests kms gcp-remote"
env["GCPKMS_CMD"] = "CI=true UV_NO_LOCK=1 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...")

Expand Down Expand Up @@ -128,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}" bash ./.evergreen/just.sh run-tests'
f'KEY_NAME="{key_name}" KEY_VAULT_ENDPOINT="{key_vault_endpoint}" CI=true UV_NO_LOCK=1 bash ./.evergreen/just.sh run-tests'
)
else:
env["GCPKMS_CMD"] = "./.evergreen/just.sh run-tests"
env["GCPKMS_CMD"] = "CI=true UV_NO_LOCK=1 ./.evergreen/just.sh run-tests"
cmd = f"{DIRS[sub_test_name]}/run-command.sh"
run_command(cmd, env=env)

Expand Down
10 changes: 5 additions & 5 deletions .evergreen/scripts/setup-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ fi
# Ensure dependencies are installed.
bash $HERE/install-dependencies.sh

# Add the default install path to the path if needed.
if [ -z "${PYMONGO_BIN_DIR:-}" ]; then
export PATH="$PATH:$HOME/.local/bin"
fi

# Only run the next part if not running on CI.
if [ -z "${CI:-}" ]; then
# Add the default install path to the path if needed.
if [ -z "${PYMONGO_BIN_DIR:-}" ]; then
export PATH="$PATH:$HOME/.local/bin"
fi

# Set up venv, making sure c extensions build unless disabled.
if [ -z "${NO_EXT:-}" ]; then
export PYMONGO_C_EXT_MUST_BUILD=1
Expand Down
3 changes: 3 additions & 0 deletions .evergreen/scripts/setup-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ 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."
3 changes: 0 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ set shell := ["bash", "-c"]

# Don't let `uv` create or read uv.lock.
export UV_NO_LOCK := "1"
# Match CI's resolution window so local installs agree.
# GNU date on Linux and Windows, BSD date on macOS.
export UV_EXCLUDE_NEWER := `date -u -d '7 days ago' +%Y-%m-%d 2>/dev/null || date -u -v-7d +%Y-%m-%d`

# Commonly used command segments.
typing_run := "uv run --group typing --extra aws --extra encryption --with numpy --extra ocsp --extra snappy --extra test --extra zstd"
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Documentation = "https://www.mongodb.com/docs/languages/python/pymongo-driver/cu
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"]
Comment thread
aclark4life marked this conversation as resolved.
# Wait 7 days before resolving newly published package versions.
exclude-newer = "7 days"

[dependency-groups]
dev = []
lint = [
Expand Down
Loading