diff --git a/.evergreen/scripts/configure-env.sh b/.evergreen/scripts/configure-env.sh index 5e36125838..360706a944 100755 --- a/.evergreen/scripts/configure-env.sh +++ b/.evergreen/scripts/configure-env.sh @@ -39,7 +39,7 @@ fi # Add the latest MongoDB toolchain bin dir to PATH if it exists, so that hosts # with an old system Python (e.g. RHEL8's 3.6) still get a modern interpreter # for tool installs like `uv tool install rust-just`. It goes after -# PYMONGO_BIN_DIR so the pinned uv (installed there by setup-uv.py) takes +# PYMONGO_BIN_DIR so the pinned uv (installed there by setup_uv.py) takes # precedence over the toolchain's uv. if [ "Windows_NT" = "${OS:-}" ]; then _toolchain_bin="/cygdrive/c/Python/Current/Scripts" diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 93b62ce6b6..5c69b8875e 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -30,7 +30,7 @@ if [ "Windows_NT" = "${OS:-}" ]; then else export PYMONGO_BIN_DIR_POSIX="$PYMONGO_BIN_DIR" fi -# UV_TOOL_BIN_DIR is uv's name for the same dir (setup-uv.py reads both). +# UV_TOOL_BIN_DIR is uv's name for the same dir (setup_uv.py reads both). # UV_TOOL_DIR is left to ensure_uv.sh. export UV_TOOL_BIN_DIR="${UV_TOOL_BIN_DIR:-$PYMONGO_BIN_DIR}" @@ -43,12 +43,12 @@ case ":$PATH:" in esac # Compute the setup script path once (native Windows path on cygwin). -_uv_setup_script="$HERE/setup-uv.py" +_uv_setup_script="$HERE/setup_uv.py" if [ "Windows_NT" = "${OS:-}" ]; then _uv_setup_script="$(cygpath -m "$_uv_setup_script")" fi -# Skip setup when the pinned uv is already installed: `setup-uv.py --check` +# Skip setup when the pinned uv is already installed: `setup_uv.py --check` # compares the uv on PATH with the required-version pin, without side effects. # A full `uv sync` here would download Python and install/build dependencies # just to make this decision, and would run before setup-uv-python.sh sets @@ -79,7 +79,7 @@ if [ "$_need_setup" = "1" ]; then # and no required-version check is triggered. python3 "$_uv_setup_script" - # Re-source env.sh so the values setup-uv.py wrote are available. + # Re-source env.sh so the values setup_uv.py wrote are available. if [ -f $HERE/env.sh ]; then . $HERE/env.sh fi diff --git a/.evergreen/scripts/resync-all-specs.sh b/.evergreen/scripts/resync-all-specs.sh index 11dd2e65ba..51d365cb88 100755 --- a/.evergreen/scripts/resync-all-specs.sh +++ b/.evergreen/scripts/resync-all-specs.sh @@ -32,14 +32,14 @@ PR_DESC="spec_sync.txt" if ! [ -n "${CI:-}" ] then # we're running locally - python3 ./.evergreen/scripts/resync-all-specs.py + python3 ./.evergreen/scripts/resync_all_specs.py else # Use the newest mongodbtoolchain python; the default python3 may be too old. PY=$(ls -1d /opt/mongodbtoolchain/v*/bin/python3 2>/dev/null | sort -V | tail -1) [ -n "$PY" ] || PY=python3 [ "$("$PY" -c 'import sys; print(sys.version_info >= (3, 7))' 2>/dev/null)" = True ] \ - || { echo "Error: $PY is not Python 3.7+, which resync-all-specs.py requires." >&2; exit 1; } - "$PY" ./.evergreen/scripts/resync-all-specs.py --filename "$PR_DESC" + || { echo "Error: $PY is not Python 3.7+, which resync_all_specs.py requires." >&2; exit 1; } + "$PY" ./.evergreen/scripts/resync_all_specs.py --filename "$PR_DESC" if [[ -f $PR_DESC ]]; then # changes were made -> call scrypt to create PR for us .evergreen/scripts/create-spec-pr.sh "$PR_DESC" diff --git a/.evergreen/scripts/resync-all-specs.py b/.evergreen/scripts/resync_all_specs.py similarity index 100% rename from .evergreen/scripts/resync-all-specs.py rename to .evergreen/scripts/resync_all_specs.py diff --git a/.evergreen/scripts/setup-uv.py b/.evergreen/scripts/setup_uv.py similarity index 98% rename from .evergreen/scripts/setup-uv.py rename to .evergreen/scripts/setup_uv.py index f26b8b180c..a3f5f9dc20 100755 --- a/.evergreen/scripts/setup-uv.py +++ b/.evergreen/scripts/setup_uv.py @@ -1,13 +1,15 @@ #!/usr/bin/env python3 """Bootstrap the pinned uv/just for the test environment. -install-dependencies.sh probes with `setup-uv.py --check`, sources ensure-uv.sh +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. This runs under the host's system python3, which may be older than our minimum supported version. """ +from __future__ import annotations + import os import re import shlex diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6bf693bdef..9e0e058c94 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -587,10 +587,10 @@ git diff HEAD~1 path/to/file >> .evergreen/spec-patch/PYTHON-1234.patch ``` #### Running Locally -Both `resync-all-specs.sh` and `resync-all-specs.py` can be run locally (and won't generate a PR). +Both `resync-all-specs.sh` and `resync_all_specs.py` can be run locally (and won't generate a PR). ```bash ./.evergreen/scripts/resync-all-specs.sh -python3 ./.evergreen/scripts/resync-all-specs.py +python3 ./.evergreen/scripts/resync_all_specs.py ``` ## Making a Release diff --git a/pyproject.toml b/pyproject.toml index 871939af25..3a61cb4aec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -251,7 +251,6 @@ ignore = [ "INT", # flake8-gettext "ISC", # flake8-implicit-str-concat "FLY", # flynt - "N", # pep8-naming ] unfixable = [ "RUF100", # Unused noqa @@ -266,7 +265,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"] +".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", "DTZ002", "LOG"]