From dc182310dabff470dbbfc7da3c09eb6a4e08dfed Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 24 Jan 2025 07:47:14 -0600 Subject: [PATCH 1/3] PYTHON-5047 Avoid updating the uv lock unintentionally (#2076) --- .evergreen/run-tests.sh | 8 ++++---- .evergreen/scripts/setup-dev-env.sh | 6 +++--- justfile | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index d64795505..fbe310ad1 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -37,7 +37,7 @@ export PIP_QUIET=1 # Quiet by default export PIP_PREFER_BINARY=1 # Prefer binary dists by default set +x -PYTHON_IMPL=$(uv run python -c "import platform; print(platform.python_implementation())") +PYTHON_IMPL=$(uv run --frozen python -c "import platform; print(platform.python_implementation())") # Try to source local Drivers Secrets if [ -f ./secrets-export.sh ]; then @@ -49,11 +49,11 @@ fi # Start compiling the args we'll pass to uv. # Run in an isolated environment so as not to pollute the base venv. -UV_ARGS=("--isolated --extra test") +UV_ARGS=("--isolated --frozen --extra test") # Ensure C extensions if applicable. if [ -z "${NO_EXT:-}" ] && [ "$PYTHON_IMPL" = "CPython" ]; then - uv run tools/fail_if_no_c.py + uv run --frozen tools/fail_if_no_c.py fi if [ "$AUTH" != "noauth" ]; then @@ -239,7 +239,7 @@ if [ -n "$PERF_TEST" ]; then fi echo "Running $AUTH tests over $SSL with python $(uv python find)" -uv run python -c 'import sys; print(sys.version)' +uv run --frozen python -c 'import sys; print(sys.version)' # Run the tests, and store the results in Evergreen compatible XUnit XML diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index 3f8d0c429..ae4b44c62 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -32,11 +32,11 @@ if [ ! -d $BIN_DIR ]; then echo "export UV_PYTHON=$UV_PYTHON" >> $HERE/env.sh fi echo "Using python $UV_PYTHON" -uv sync -uv run --with pip pip install -e . +uv sync --frozen +uv run --frozen --with pip pip install -e . echo "Setting up python environment... done." # Ensure there is a pre-commit hook if there is a git checkout. if [ -d .git ] && [ ! -f .git/hooks/pre-commit ]; then - uv run pre-commit install + uv run --frozen pre-commit install fi diff --git a/justfile b/justfile index 6bcfe0c79..8a076038a 100644 --- a/justfile +++ b/justfile @@ -4,7 +4,7 @@ set dotenv-load set dotenv-filename := "./.evergreen/scripts/env.sh" # Commonly used command segments. -uv_run := "uv run --isolated " +uv_run := "uv run --isolated --frozen " typing_run := uv_run + "--group typing --extra aws --extra encryption --extra ocsp --extra snappy --extra test --extra zstd" docs_run := uv_run + "--extra docs" doc_build := "./doc/_build" From a3208df5c94620228b015ac79cd1548582c65ab1 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Fri, 24 Jan 2025 14:30:07 -0800 Subject: [PATCH 2/3] PYTHON-5059 Update default maxMessageSizeBytes and maxWriteBatchSize (#2078) --- pymongo/common.py | 4 ++-- pymongo/hello.py | 2 +- test/test_server_description.py | 13 ++++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pymongo/common.py b/pymongo/common.py index 5661de011..b442da6a3 100644 --- a/pymongo/common.py +++ b/pymongo/common.py @@ -60,10 +60,10 @@ ORDERED_TYPES: Sequence[Type] = (SON, OrderedDict) # Defaults until we connect to a server and get updated limits. MAX_BSON_SIZE = 16 * (1024**2) -MAX_MESSAGE_SIZE: int = 2 * MAX_BSON_SIZE +MAX_MESSAGE_SIZE = 48 * 1000 * 1000 MIN_WIRE_VERSION = 0 MAX_WIRE_VERSION = 0 -MAX_WRITE_BATCH_SIZE = 1000 +MAX_WRITE_BATCH_SIZE = 100000 # What this version of PyMongo supports. MIN_SUPPORTED_SERVER_VERSION = "4.0" diff --git a/pymongo/hello.py b/pymongo/hello.py index 62bb79980..c30b825e1 100644 --- a/pymongo/hello.py +++ b/pymongo/hello.py @@ -133,7 +133,7 @@ class Hello(Generic[_DocumentType]): @property def max_message_size(self) -> int: - return self._doc.get("maxMessageSizeBytes", 2 * self.max_bson_size) + return self._doc.get("maxMessageSizeBytes", common.MAX_MESSAGE_SIZE) @property def max_write_batch_size(self) -> int: diff --git a/test/test_server_description.py b/test/test_server_description.py index fe7a5f711..e8c0098cb 100644 --- a/test/test_server_description.py +++ b/test/test_server_description.py @@ -23,6 +23,7 @@ from test import unittest from bson.int64 import Int64 from bson.objectid import ObjectId +from pymongo import common from pymongo.hello import Hello, HelloCompat from pymongo.server_description import ServerDescription from pymongo.server_type import SERVER_TYPE @@ -132,11 +133,13 @@ class TestServerDescription(unittest.TestCase): self.assertEqual(4, s.min_wire_version) self.assertEqual(25, s.max_wire_version) - def test_default_max_message_size(self): - s = parse_hello_response({"ok": 1, HelloCompat.LEGACY_CMD: True, "maxBsonObjectSize": 2}) - - # Twice max_bson_size. - self.assertEqual(4, s.max_message_size) + def test_defaults(self): + s = parse_hello_response({"ok": 1, HelloCompat.LEGACY_CMD: True}) + self.assertEqual(common.MAX_BSON_SIZE, s.max_bson_size) + self.assertEqual(common.MAX_MESSAGE_SIZE, s.max_message_size) + self.assertEqual(common.MIN_WIRE_VERSION, s.min_wire_version) + self.assertEqual(common.MAX_WIRE_VERSION, s.max_wire_version) + self.assertEqual(common.MAX_WRITE_BATCH_SIZE, s.max_write_batch_size) def test_standalone(self): s = parse_hello_response({"ok": 1, HelloCompat.LEGACY_CMD: True}) From 9082a4be23622458ee350c3171bc754cdf1db89a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 24 Jan 2025 17:14:20 -0600 Subject: [PATCH 3/3] PYTHON-5058 Build linux aarch64 wheel using native runner and omit ppc64le and s390x wheels (#2077) --- .github/workflows/dist.yml | 7 ++++--- doc/changelog.rst | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index a4c5a8279..5100c70d4 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -35,9 +35,10 @@ jobs: # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 buildplat: - [ubuntu-20.04, "manylinux_x86_64", "cp3*-manylinux_x86_64"] - - [ubuntu-20.04, "manylinux_aarch64", "cp3*-manylinux_aarch64"] - - [ubuntu-20.04, "manylinux_ppc64le", "cp3*-manylinux_ppc64le"] - - [ubuntu-20.04, "manylinux_s390x", "cp3*-manylinux_s390x"] + - [ubuntu-24.04-arm, "manylinux_aarch64", "cp3*-manylinux_aarch64"] + # Disabled pending PYTHON-5058 + # - [ubuntu-24.04, "manylinux_ppc64le", "cp3*-manylinux_ppc64le"] + # - [ubuntu-24.04, "manylinux_s390x", "cp3*-manylinux_s390x"] - [ubuntu-20.04, "manylinux_i686", "cp3*-manylinux_i686"] - [windows-2019, "win_amd6", "cp3*-win_amd64"] - [windows-2019, "win32", "cp3*-win32"] diff --git a/doc/changelog.rst b/doc/changelog.rst index 4942d85de..1f3efb8ad 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -11,6 +11,7 @@ Changes in Version 4.11.0 (YYYY/MM/DD) A future minor release of PyMongo will raise the minimum supported MongoDB Server version from 4.0 to 4.2. This is in accordance with [MongoDB Software Lifecycle Schedules](https://www.mongodb.com/legal/support-policy/lifecycles). **Support for MongoDB Server 4.0 will be dropped in a future release!** +.. warning:: This version does not include wheels for ``ppc64le`` or ``s390x`` architectures, see `PYTHON-5058`_ for more information. PyMongo 4.11 brings a number of changes including: @@ -49,6 +50,7 @@ in this release. .. _PyMongo 4.11 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=40784 .. _PYTHON-5027: https://jira.mongodb.org/browse/PYTHON-5027 .. _PYTHON-5024: https://jira.mongodb.org/browse/PYTHON-5024 +.. _PYTHON-5058: https://jira.mongodb.org/browse/PYTHON-5058 Changes in Version 4.10.1 (2024/10/01) --------------------------------------