From ed21a181721eb3644f3106f82be6a5f7c611d2d8 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 29 Jan 2025 13:27:07 -0600 Subject: [PATCH 01/20] PYTHON-5047 Fix dry run logic in releases again (#2092) (cherry picked from commit b4e32a1d8388fe5bf731c0c866b8bb96bbf19870) --- .github/workflows/release-python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index bcf37d1a22..0801d12f59 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -23,7 +23,7 @@ env: SILK_ASSET_GROUP: mongodb-python-driver EVERGREEN_PROJECT: mongo-python-driver # Constant - DRY_RUN: ${{ inputs.dry_run == 'true' }} + DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'true' }} FOLLOWING_VERSION: ${{ inputs.following_version || '' }} VERSION: ${{ inputs.version || '10.10.10.10' }} From d0301307a0f6b8a771c5b927e583630104dc59ab Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Wed, 29 Jan 2025 15:35:00 -0500 Subject: [PATCH 02/20] PYTHON-5112 - Fix just install (#2095) (cherry picked from commit 1784e2c4b9c7e5efbed1796e81e37fa49f8845f0) --- .evergreen/scripts/setup-dev-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index ae4b44c626..b56897961e 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -30,8 +30,8 @@ if [ ! -d $BIN_DIR ]; then fi export UV_PYTHON=${PYTHON_BINARY} echo "export UV_PYTHON=$UV_PYTHON" >> $HERE/env.sh + echo "Using python $UV_PYTHON" fi -echo "Using python $UV_PYTHON" uv sync --frozen uv run --frozen --with pip pip install -e . echo "Setting up python environment... done." From f1a8af160d21d0fe3c88c782e5219fd621344395 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 29 Jan 2025 17:46:36 -0600 Subject: [PATCH 03/20] PYTHON-5047 Fix dry run logic in releases yet again (#2098) (cherry picked from commit 34ae214e33e922e3478388517a2b37aa4fd64dba) --- .github/workflows/release-python.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 0801d12f59..45157bfc2b 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -23,7 +23,9 @@ env: SILK_ASSET_GROUP: mongodb-python-driver EVERGREEN_PROJECT: mongo-python-driver # Constant - DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'true' }} + # inputs will be empty on a scheduled run. so, we only set dry_run + # to 'false' when the input is set to 'false'. + DRY_RUN: ${{ ! contains(inputs.dry_run, 'false') }} FOLLOWING_VERSION: ${{ inputs.following_version || '' }} VERSION: ${{ inputs.version || '10.10.10.10' }} From 3c9a248bba442cbdd0999807d6582cb1aef11df1 Mon Sep 17 00:00:00 2001 From: Jib Date: Fri, 31 Jan 2025 15:16:17 -0500 Subject: [PATCH 04/20] Update ReadTheDocs to include django-mongodb-backend (#2084) (cherry picked from commit 3b5788906ddeb326c0407f7b490aadde0f88c2ee) --- doc/tools.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/tools.rst b/doc/tools.rst index 6dd0df8a4d..7ec3ddb443 100644 --- a/doc/tools.rst +++ b/doc/tools.rst @@ -67,6 +67,14 @@ uMongo mongomock. The source `is available on GitHub `_ +Django MongoDB Backend + `Django MongoDB Backend `_ is a + database backend library specifically made for Django. The integration takes + advantage of MongoDB's unique document model capabilities, which align + naturally with Django's philosophy of simplified data modeling and + reduced development complexity. The source is available + `on GitHub `_. + No longer maintained """""""""""""""""""" From e15b820f719571ad7182e762ccd2ee183daa491a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 6 Feb 2025 13:31:55 -0600 Subject: [PATCH 05/20] PYTHON-5058 Restore alternate architecture builds (#2133) (cherry picked from commit 041edbecba28b793e194479688a750e23c9317c2) --- .github/workflows/dist.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 5100c70d43..3dee8f581c 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -35,10 +35,9 @@ jobs: # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 buildplat: - [ubuntu-20.04, "manylinux_x86_64", "cp3*-manylinux_x86_64"] - - [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_aarch64", "cp3*-manylinux_aarch64"] + - [ubuntu-20.04, "manylinux_ppc64le", "cp3*-manylinux_ppc64le"] + - [ubuntu-20.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"] @@ -63,6 +62,10 @@ jobs: if: runner.os == 'Linux' uses: docker/setup-qemu-action@v3 with: + # setup-qemu-action by default uses `tonistiigi/binfmt:latest` image, + # which is out of date. This causes seg faults during build. + # Here we manually fix the version. + image: tonistiigi/binfmt:qemu-v8.1.5 platforms: all - name: Install cibuildwheel From c83f34c826d23c15905d77337d2356d297bc404e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 6 Feb 2025 13:59:26 -0600 Subject: [PATCH 06/20] PYTHON-5047 Do not run nightly release check on forks (#2134) (cherry picked from commit a641337b5c98087884c0197628c772ced0f59965) --- .github/workflows/release-python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 45157bfc2b..d8c900e77b 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -37,6 +37,7 @@ jobs: pre-publish: environment: release runs-on: ubuntu-latest + if: github.repository_owner == 'mongodb' || github.event_name == 'workflow_dispatch' permissions: id-token: write contents: write From 4a6aae8f4364d87a0ea2b10c7745a0000ea83513 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 10 Feb 2025 13:41:26 -0600 Subject: [PATCH 07/20] PYTHON-5125 Prep for 4.11.1 release (#2137) --- .github/workflows/release-python.yml | 4 ++-- doc/changelog.rst | 7 ++++++- sbom.json | 21 +++++++++++---------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index d8c900e77b..a6810854ff 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -20,8 +20,8 @@ env: # Changes per repo PRODUCT_NAME: PyMongo # Changes per branch - SILK_ASSET_GROUP: mongodb-python-driver - EVERGREEN_PROJECT: mongo-python-driver + SILK_ASSET_GROUP: mongodb-python-driver-4.11 + EVERGREEN_PROJECT: mongo-python-driver-release # Constant # inputs will be empty on a scheduled run. so, we only set dry_run # to 'false' when the input is set to 'false'. diff --git a/doc/changelog.rst b/doc/changelog.rst index 1f3efb8ad0..a1bda74944 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,7 +1,12 @@ Changelog ========= -Changes in Version 4.11.0 (YYYY/MM/DD) +Changes in Version 4.11.1 (2025/MM/DD) +-------------------------------------- + +- Fixed support for prebuilt ``ppc64le`` and ``s390x`` wheels. + +Changes in Version 4.11.0 (2025/01/28) -------------------------------------- .. warning:: PyMongo 4.11 drops support for Python 3.8 and PyPy 3.9: Python 3.9+ or PyPy 3.10+ is now required. diff --git a/sbom.json b/sbom.json index 56e27f5361..560e282a64 100644 --- a/sbom.json +++ b/sbom.json @@ -1,11 +1,12 @@ { - "metadata": { - "timestamp": "2024-05-02T17:36:12.698229+00:00" - }, - "components": [], - "serialNumber": "urn:uuid:9876a8a6-060e-486f-b128-910aecf0fe7b", - "version": 1, - "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", - "bomFormat": "CycloneDX", - "specVersion": "1.5" - } \ No newline at end of file + "metadata": { + "timestamp": "2025-02-06T23:38:31.503894+00:00" + }, + "components": [], + "serialNumber": "urn:uuid:04738005-86f1-4d21-866f-ce4560f03f00", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.5", + "vulnerabilities": [] +} From d175edff9f1160e9259e7a8872c168a4fe445399 Mon Sep 17 00:00:00 2001 From: "mongodb-dbx-release-bot[bot]" <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 19:42:27 +0000 Subject: [PATCH 08/20] BUMP 4.11.1 Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> --- pymongo/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/_version.py b/pymongo/_version.py index 22972c5ce4..7b72ca9aa6 100644 --- a/pymongo/_version.py +++ b/pymongo/_version.py @@ -18,7 +18,7 @@ import re from typing import List, Tuple, Union -__version__ = "4.11" +__version__ = "4.11.1" def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]: From 736aa56be173ce3de81e1cf660f0dc8aaef4b34c Mon Sep 17 00:00:00 2001 From: "mongodb-dbx-release-bot[bot]" <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 20:01:47 +0000 Subject: [PATCH 09/20] BUMP 4.11.2.dev0 Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> --- pymongo/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/_version.py b/pymongo/_version.py index 7b72ca9aa6..27294eed13 100644 --- a/pymongo/_version.py +++ b/pymongo/_version.py @@ -18,7 +18,7 @@ import re from typing import List, Tuple, Union -__version__ = "4.11.1" +__version__ = "4.11.2.dev0" def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]: From 315f3cd1b20e2b37a5424279999d5bbfb13652a2 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Mon, 3 Mar 2025 11:30:12 -0800 Subject: [PATCH 10/20] PYTHON-5166 Allow Database.command to run bulkWrite commands (#2164) [v4.11] (#2172) --- doc/changelog.rst | 16 +++++++++++++++- pymongo/message.py | 2 +- test/asynchronous/test_database.py | 15 +++++++++++++++ test/test_database.py | 15 +++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index a1bda74944..66f3efca88 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,7 +1,21 @@ Changelog ========= -Changes in Version 4.11.1 (2025/MM/DD) +Changes in Version 4.11.2 (YYYY/MM/DD) +-------------------------------------- + +Version 4.11.2 is a bug fix release. + +- Fixed a bug where :meth:`~pymongo.database.Database.command` would fail when attempting to run the bulkWrite command. + +Issues Resolved +............... + +See the `PyMongo 4.11.2 release notes in JIRA`_ for the list of resolved issues in this release. + +.. _PyMongo 4.11.2 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=42506 + +Changes in Version 4.11.1 (2025/02/10) -------------------------------------- - Fixed support for prebuilt ``ppc64le`` and ``s390x`` wheels. diff --git a/pymongo/message.py b/pymongo/message.py index 10c9edb5cd..8e2fd6f990 100644 --- a/pymongo/message.py +++ b/pymongo/message.py @@ -105,7 +105,7 @@ "insert": "documents", "update": "updates", "delete": "deletes", - "bulkWrite": "bulkWrite", + "bulkWrite": "ops", } _UNICODE_REPLACE_CODEC_OPTIONS: CodecOptions[Mapping[str, Any]] = CodecOptions( diff --git a/test/asynchronous/test_database.py b/test/asynchronous/test_database.py index 55a8cc3ab2..2bbf763ab3 100644 --- a/test/asynchronous/test_database.py +++ b/test/asynchronous/test_database.py @@ -430,6 +430,21 @@ async def test_command_with_regex(self): for doc in result["cursor"]["firstBatch"]: self.assertTrue(isinstance(doc["r"], Regex)) + async def test_command_bulkWrite(self): + # Ensure bulk write commands can be run directly via db.command(). + if async_client_context.version.at_least(8, 0): + await self.client.admin.command( + { + "bulkWrite": 1, + "nsInfo": [{"ns": self.db.test.full_name}], + "ops": [{"insert": 0, "document": {}}], + } + ) + await self.db.command({"insert": "test", "documents": [{}]}) + await self.db.command({"update": "test", "updates": [{"q": {}, "u": {"$set": {"x": 1}}}]}) + await self.db.command({"delete": "test", "deletes": [{"q": {}, "limit": 1}]}) + await self.db.test.drop() + async def test_cursor_command(self): db = self.client.pymongo_test await db.test.drop() diff --git a/test/test_database.py b/test/test_database.py index aad9089bd8..48cca921b1 100644 --- a/test/test_database.py +++ b/test/test_database.py @@ -425,6 +425,21 @@ def test_command_with_regex(self): for doc in result["cursor"]["firstBatch"]: self.assertTrue(isinstance(doc["r"], Regex)) + def test_command_bulkWrite(self): + # Ensure bulk write commands can be run directly via db.command(). + if client_context.version.at_least(8, 0): + self.client.admin.command( + { + "bulkWrite": 1, + "nsInfo": [{"ns": self.db.test.full_name}], + "ops": [{"insert": 0, "document": {}}], + } + ) + self.db.command({"insert": "test", "documents": [{}]}) + self.db.command({"update": "test", "updates": [{"q": {}, "u": {"$set": {"x": 1}}}]}) + self.db.command({"delete": "test", "deletes": [{"q": {}, "limit": 1}]}) + self.db.test.drop() + def test_cursor_command(self): db = self.client.pymongo_test db.test.drop() From 0fa3475835e8bde80a8fa282e1fd690dce84f60e Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Mon, 3 Mar 2025 12:27:35 -0800 Subject: [PATCH 11/20] PYTHON-5155 Use dochub link for fork warning (#2173) [v4.11] (#2174) --- doc/changelog.rst | 3 +-- pymongo/asynchronous/topology.py | 4 +--- pymongo/synchronous/topology.py | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 66f3efca88..cf5d5e8ff7 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -199,7 +199,7 @@ PyMongo 4.9 brings a number of improvements including: unction-as-a-service (FaaS) like AWS Lambda, Google Cloud Functions, and Microsoft Azure Functions. On some FaaS systems, there is a ``fork()`` operation at function startup. By delaying the connection to the first operation, we avoid a deadlock. See - `Is PyMongo Fork-Safe`_ for more information. + :ref:`pymongo-fork-safe` for more information. Issues Resolved @@ -208,7 +208,6 @@ Issues Resolved See the `PyMongo 4.9 release notes in JIRA`_ for the list of resolved issues in this release. -.. _Is PyMongo Fork-Safe : https://www.mongodb.com/docs/languages/python/pymongo-driver/current/faq/#is-pymongo-fork-safe- .. _PyMongo 4.9 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=39940 diff --git a/pymongo/asynchronous/topology.py b/pymongo/asynchronous/topology.py index 6d67710a7e..07671c9a70 100644 --- a/pymongo/asynchronous/topology.py +++ b/pymongo/asynchronous/topology.py @@ -232,9 +232,7 @@ async def open(self) -> None: warnings.warn( # type: ignore[call-overload] # noqa: B028 "AsyncMongoClient opened before fork. May not be entirely fork-safe, " "proceed with caution. See PyMongo's documentation for details: " - "https://www.mongodb.com/docs/languages/" - "python/pymongo-driver/current/faq/" - "#is-pymongo-fork-safe-", + "https://dochub.mongodb.org/core/pymongo-fork-deadlock", **kwargs, ) async with self._lock: diff --git a/pymongo/synchronous/topology.py b/pymongo/synchronous/topology.py index b03269ae43..861712f02a 100644 --- a/pymongo/synchronous/topology.py +++ b/pymongo/synchronous/topology.py @@ -232,9 +232,7 @@ def open(self) -> None: warnings.warn( # type: ignore[call-overload] # noqa: B028 "MongoClient opened before fork. May not be entirely fork-safe, " "proceed with caution. See PyMongo's documentation for details: " - "https://www.mongodb.com/docs/languages/" - "python/pymongo-driver/current/faq/" - "#is-pymongo-fork-safe-", + "https://dochub.mongodb.org/core/pymongo-fork-deadlock", **kwargs, ) with self._lock: From c17011ae7ff7faec7daa25e29693611851b4d4a1 Mon Sep 17 00:00:00 2001 From: "mongodb-dbx-release-bot[bot]" <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 21:14:04 +0000 Subject: [PATCH 12/20] BUMP 4.11.1 Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> --- pymongo/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/_version.py b/pymongo/_version.py index 27294eed13..7b72ca9aa6 100644 --- a/pymongo/_version.py +++ b/pymongo/_version.py @@ -18,7 +18,7 @@ import re from typing import List, Tuple, Union -__version__ = "4.11.2.dev0" +__version__ = "4.11.1" def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]: From c27fa509fd9617f30d61c8d0964e1907e10517a4 Mon Sep 17 00:00:00 2001 From: "mongodb-dbx-release-bot[bot]" <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 21:16:35 +0000 Subject: [PATCH 13/20] BUMP 4.11.2 Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> --- pymongo/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/_version.py b/pymongo/_version.py index 7b72ca9aa6..93b9fdacd3 100644 --- a/pymongo/_version.py +++ b/pymongo/_version.py @@ -18,7 +18,7 @@ import re from typing import List, Tuple, Union -__version__ = "4.11.1" +__version__ = "4.11.2" def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]: From ca0ed96eca11b5dbd1118b50efaed6f3dd6eef1d Mon Sep 17 00:00:00 2001 From: "mongodb-dbx-release-bot[bot]" <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 21:35:28 +0000 Subject: [PATCH 14/20] BUMP 4.11.3.dev0 Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> --- pymongo/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/_version.py b/pymongo/_version.py index 93b9fdacd3..44bdf30657 100644 --- a/pymongo/_version.py +++ b/pymongo/_version.py @@ -18,7 +18,7 @@ import re from typing import List, Tuple, Union -__version__ = "4.11.2" +__version__ = "4.11.3.dev0" def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]: From 112e29b30f4824f43adc3b898463ceec29e008fb Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 5 Mar 2025 17:08:12 -0600 Subject: [PATCH 15/20] PYTHON-5131 [v4.11] Migrate off of Ubuntu 20.04 GitHub Actions Runners (#2182) --- .github/workflows/dist.yml | 10 +++++----- .github/workflows/test-python.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 3dee8f581c..81f86721ef 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -34,11 +34,11 @@ jobs: # Github Actions doesn't support pairing matrix values together, let's improvise # 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-20.04, "manylinux_i686", "cp3*-manylinux_i686"] + - [ubuntu-latest, "manylinux_x86_64", "cp3*-manylinux_x86_64"] + - [ubuntu-latest, "manylinux_aarch64", "cp3*-manylinux_aarch64"] + - [ubuntu-latest, "manylinux_ppc64le", "cp3*-manylinux_ppc64le"] + - [ubuntu-latest, "manylinux_s390x", "cp3*-manylinux_s390x"] + - [ubuntu-latest, "manylinux_i686", "cp3*-manylinux_i686"] - [windows-2019, "win_amd6", "cp3*-win_amd64"] - [windows-2019, "win32", "cp3*-win32"] - [macos-14, "macos", "cp*-macosx_*"] diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 3760e308a5..807fa7f0c8 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -54,7 +54,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-latest] python-version: ["3.9", "pypy-3.10", "3.13", "3.13t"] name: CPython ${{ matrix.python-version }}-${{ matrix.os }} steps: From dc73514cbaa9766c46f9ac717285fb08080587d1 Mon Sep 17 00:00:00 2001 From: "mongodb-drivers-pr-bot[bot]" <147046816+mongodb-drivers-pr-bot[bot]@users.noreply.github.com> Date: Wed, 12 Mar 2025 12:21:42 -0700 Subject: [PATCH 16/20] PYTHON-5202 WaitQueueTimeoutError should not clear the pool (#2192) [v4.11] (#2196) Co-authored-by: Shane Harvey --- pymongo/asynchronous/topology.py | 3 +++ pymongo/synchronous/topology.py | 3 +++ test/asynchronous/test_client.py | 13 +++++++++++-- test/test_client.py | 13 +++++++++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/pymongo/asynchronous/topology.py b/pymongo/asynchronous/topology.py index 07671c9a70..bee26dca7d 100644 --- a/pymongo/asynchronous/topology.py +++ b/pymongo/asynchronous/topology.py @@ -40,6 +40,7 @@ OperationFailure, PyMongoError, ServerSelectionTimeoutError, + WaitQueueTimeoutError, WriteError, ) from pymongo.hello import Hello @@ -877,6 +878,8 @@ async def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None # Clear the pool. await server.reset(service_id) elif isinstance(error, ConnectionFailure): + if isinstance(error, WaitQueueTimeoutError): + return # "Client MUST replace the server's description with type Unknown # ... MUST NOT request an immediate check of the server." if not self._settings.load_balanced: diff --git a/pymongo/synchronous/topology.py b/pymongo/synchronous/topology.py index 861712f02a..d13b8c57d2 100644 --- a/pymongo/synchronous/topology.py +++ b/pymongo/synchronous/topology.py @@ -36,6 +36,7 @@ OperationFailure, PyMongoError, ServerSelectionTimeoutError, + WaitQueueTimeoutError, WriteError, ) from pymongo.hello import Hello @@ -875,6 +876,8 @@ def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None: # Clear the pool. server.reset(service_id) elif isinstance(error, ConnectionFailure): + if isinstance(error, WaitQueueTimeoutError): + return # "Client MUST replace the server's description with type Unknown # ... MUST NOT request an immediate check of the server." if not self._settings.load_balanced: diff --git a/test/asynchronous/test_client.py b/test/asynchronous/test_client.py index 744a170be2..bbad6f491f 100644 --- a/test/asynchronous/test_client.py +++ b/test/asynchronous/test_client.py @@ -111,6 +111,7 @@ NetworkTimeout, OperationFailure, ServerSelectionTimeoutError, + WaitQueueTimeoutError, WriteConcernError, ) from pymongo.monitoring import ServerHeartbeatListener, ServerHeartbeatStartedEvent @@ -1311,8 +1312,16 @@ async def test_server_selection_timeout(self): self.assertAlmostEqual(30, client.options.server_selection_timeout) async def test_waitQueueTimeoutMS(self): - client = await self.async_rs_or_single_client(waitQueueTimeoutMS=2000) - self.assertEqual((await async_get_pool(client)).opts.wait_queue_timeout, 2) + listener = CMAPListener() + client = await self.async_rs_or_single_client( + waitQueueTimeoutMS=10, maxPoolSize=1, event_listeners=[listener] + ) + pool = await async_get_pool(client) + self.assertEqual(pool.opts.wait_queue_timeout, 0.01) + async with pool.checkout(): + with self.assertRaises(WaitQueueTimeoutError): + await client.test.command("ping") + self.assertFalse(listener.events_by_type(monitoring.PoolClearedEvent)) async def test_socketKeepAlive(self): pool = await async_get_pool(self.client) diff --git a/test/test_client.py b/test/test_client.py index 2a33077f5f..dd0b1b5916 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -100,6 +100,7 @@ NetworkTimeout, OperationFailure, ServerSelectionTimeoutError, + WaitQueueTimeoutError, WriteConcernError, ) from pymongo.monitoring import ServerHeartbeatListener, ServerHeartbeatStartedEvent @@ -1270,8 +1271,16 @@ def test_server_selection_timeout(self): self.assertAlmostEqual(30, client.options.server_selection_timeout) def test_waitQueueTimeoutMS(self): - client = self.rs_or_single_client(waitQueueTimeoutMS=2000) - self.assertEqual((get_pool(client)).opts.wait_queue_timeout, 2) + listener = CMAPListener() + client = self.rs_or_single_client( + waitQueueTimeoutMS=10, maxPoolSize=1, event_listeners=[listener] + ) + pool = get_pool(client) + self.assertEqual(pool.opts.wait_queue_timeout, 0.01) + with pool.checkout(): + with self.assertRaises(WaitQueueTimeoutError): + client.test.command("ping") + self.assertFalse(listener.events_by_type(monitoring.PoolClearedEvent)) def test_socketKeepAlive(self): pool = get_pool(self.client) From c2bf5e455d6a50457d697713ebd79382b33a8d04 Mon Sep 17 00:00:00 2001 From: "mongodb-drivers-pr-bot[bot]" <147046816+mongodb-drivers-pr-bot[bot]@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:34:35 -0700 Subject: [PATCH 17/20] PYTHON-5198 Fix test_03_invalid_keyid (#2195) [v4.11] (#2198) Co-authored-by: Shane Harvey --- test/asynchronous/test_encryption.py | 3 ++- test/test_encryption.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_encryption.py b/test/asynchronous/test_encryption.py index 2b22bd8b76..776eaf0d36 100644 --- a/test/asynchronous/test_encryption.py +++ b/test/asynchronous/test_encryption.py @@ -2982,9 +2982,10 @@ async def test_02_no_fields(self): ) async def test_03_invalid_keyid(self): + # checkAuthForCreateCollection can be removed when SERVER-102101 is fixed. with self.assertRaisesRegex( EncryptedCollectionError, - "create.encryptedFields.fields.keyId' is the wrong type 'bool', expected type 'binData", + "(create|checkAuthForCreateCollection).encryptedFields.fields.keyId' is the wrong type 'bool', expected type 'binData", ): await self.client_encryption.create_encrypted_collection( database=self.db, diff --git a/test/test_encryption.py b/test/test_encryption.py index 9224310144..e1424686b1 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -2964,9 +2964,10 @@ def test_02_no_fields(self): ) def test_03_invalid_keyid(self): + # checkAuthForCreateCollection can be removed when SERVER-102101 is fixed. with self.assertRaisesRegex( EncryptedCollectionError, - "create.encryptedFields.fields.keyId' is the wrong type 'bool', expected type 'binData", + "(create|checkAuthForCreateCollection).encryptedFields.fields.keyId' is the wrong type 'bool', expected type 'binData", ): self.client_encryption.create_encrypted_collection( database=self.db, From d15d5e7445fe466d397ad5f1d09ae70ad0bb5874 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 18 Mar 2025 07:27:43 -0500 Subject: [PATCH 18/20] Prepare for 4.11.3 release (#2208) --- doc/changelog.rst | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index cf5d5e8ff7..2e326adbf4 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,7 +1,22 @@ Changelog ========= -Changes in Version 4.11.2 (YYYY/MM/DD) +Changes in Version 4.11.3 (2025/03/17) +-------------------------------------- + +Version 4.11.3 is a bug fix release. + +- Fixed a bug where a ``WaitQueueTimeoutError`` would cause the connection pool to be cleared. + +Issues Resolved +............... + +See the `PyMongo 4.11.3 release notes in JIRA`_ for the list of resolved issues in this release. + +.. _PyMongo 4.11.3 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=42695 + + +Changes in Version 4.11.2 (2025/03/03) -------------------------------------- Version 4.11.2 is a bug fix release. From 82407a56c0c9c695243db7b53d04412443e51892 Mon Sep 17 00:00:00 2001 From: "mongodb-dbx-release-bot[bot]" <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 12:28:59 +0000 Subject: [PATCH 19/20] BUMP 4.11.3 Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> --- pymongo/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/_version.py b/pymongo/_version.py index 44bdf30657..9b4f07496c 100644 --- a/pymongo/_version.py +++ b/pymongo/_version.py @@ -18,7 +18,7 @@ import re from typing import List, Tuple, Union -__version__ = "4.11.3.dev0" +__version__ = "4.11.3" def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]: From 0450126a10dec123beeab43507ac920129e26eae Mon Sep 17 00:00:00 2001 From: "mongodb-dbx-release-bot[bot]" <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 12:47:42 +0000 Subject: [PATCH 20/20] BUMP 4.11.4.dev0 Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> --- pymongo/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymongo/_version.py b/pymongo/_version.py index 9b4f07496c..491ffbe623 100644 --- a/pymongo/_version.py +++ b/pymongo/_version.py @@ -18,7 +18,7 @@ import re from typing import List, Tuple, Union -__version__ = "4.11.3" +__version__ = "4.11.4.dev0" def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]: