Merge branch 'master' of github.com:mongodb/mongo-python-driver

This commit is contained in:
Steven Silvester 2025-05-01 06:43:49 -05:00
commit e9744f2050
No known key found for this signature in database
GPG Key ID: B1BF5EC3A8B32F91
12 changed files with 46 additions and 36 deletions

View File

@ -96,7 +96,7 @@ EOT
_bin_path=""
if [ "Windows_NT" == "${OS:-}" ]; then
_bin_path="/cygdrive/c/Python/Current/Scripts"
elif [ "$(uname -s)" != "Darwin" ]; then
elif [ "$(uname -s)" == "Darwin" ]; then
_bin_path="/Library/Frameworks/Python.Framework/Versions/Current/bin"
else
_bin_path="/opt/python/Current/bin"
@ -106,6 +106,7 @@ if [ -d "${_bin_path}" ]; then
if [ "Windows_NT" == "${OS:-}" ]; then
_suffix=".exe"
fi
echo "Symlinking binaries from toolchain"
mkdir -p $PYMONGO_BIN_DIR
ln -s ${_bin_path}/just${_suffix} $PYMONGO_BIN_DIR/just${_suffix}
ln -s ${_bin_path}/uv${_suffix} $PYMONGO_BIN_DIR/uv${_suffix}

View File

@ -10,9 +10,6 @@ if [ -f $HERE/env.sh ]; then
. $HERE/env.sh
fi
_BIN_DIR=${PYMONGO_BIN_DIR:-$HOME/.local/bin}
export PATH="$PATH:${_BIN_DIR}"
# Helper function to pip install a dependency using a temporary python env.
function _pip_install() {
_HERE=$(dirname ${BASH_SOURCE:-$0})
@ -28,23 +25,27 @@ function _pip_install() {
if [ "Windows_NT" = "${OS:-}" ]; then
_suffix=".exe"
fi
ln -s "$(which $2)" $_BIN_DIR/${2}${_suffix}
ln -s "$(which $2)" $PYMONGO_BIN_DIR/${2}${_suffix}
# uv also comes with a uvx binary.
if [ $2 == "uv" ]; then
ln -s "$(which uvx)" $_BIN_DIR/uvx${_suffix}
ln -s "$(which uvx)" $PYMONGO_BIN_DIR/uvx${_suffix}
fi
echo "Installed to ${_BIN_DIR}"
echo "Installed to ${PYMONGO_BIN_DIR}"
echo "Installing $2 using pip... done."
}
# Ensure just is installed.
if ! command -v just >/dev/null 2>&1; then
if ! command -v just &>/dev/null; then
# On most systems we can install directly.
_TARGET=""
if [ "Windows_NT" = "${OS:-}" ]; then
_TARGET="--target x86_64-pc-windows-msvc"
fi
if [ -z "${PYMONGO_BIN_DIR:-}" ]; then
echo "Please install just!"
exit 1
fi
_BIN_DIR=$PYMONGO_BIN_DIR
echo "Installing just..."
mkdir -p "$_BIN_DIR" 2>/dev/null || true
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- $_TARGET --to "$_BIN_DIR" || {
@ -53,8 +54,13 @@ if ! command -v just >/dev/null 2>&1; then
echo "Installing just... done."
fi
# Install uv.
if ! command -v uv >/dev/null 2>&1; then
# Ensure uv is installed.
if ! command -v uv &>/dev/null; then
if [ -z "${PYMONGO_BIN_DIR:-}" ]; then
echo "Please install uv!"
exit 1
fi
_BIN_DIR=$PYMONGO_BIN_DIR
echo "Installing uv..."
# On most systems we can install directly.
curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="$_BIN_DIR" INSTALLER_NO_MODIFY_PATH=1 sh || {

View File

@ -46,7 +46,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
@ -63,6 +63,6 @@ jobs:
pip install -e .
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3
with:
category: "/language:${{matrix.language}}"

View File

@ -60,7 +60,7 @@ jobs:
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
with:
# setup-qemu-action by default uses `tonistiigi/binfmt:latest` image,
# which is out of date. This causes seg faults during build.

View File

@ -81,14 +81,14 @@ jobs:
name: all-dist-${{ github.run_id }}
path: dist/
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
attestations: ${{ env.DRY_RUN }}
- name: Publish package distributions to PyPI
if: startsWith(env.DRY_RUN, 'false')
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1
post-publish:
needs: [publish]

View File

@ -23,9 +23,9 @@ jobs:
with:
persist-credentials: false
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
python-version: "3.9"
@ -63,16 +63,16 @@ jobs:
with:
persist-credentials: false
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: just install
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.12.0
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
with:
mongodb-version: 6.0
- name: Run tests
@ -86,14 +86,14 @@ jobs:
with:
persist-credentials: false
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
python-version: "3.9"
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.12.0
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
with:
mongodb-version: '8.0.0-rc4'
- name: Install dependencies
@ -111,12 +111,12 @@ jobs:
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
python-version: "3.9"
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install dependencies
run: just install
- name: Build docs
@ -130,12 +130,12 @@ jobs:
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
python-version: "3.9"
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install dependencies
run: just install
- name: Build docs
@ -152,12 +152,12 @@ jobs:
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
python-version: "${{matrix.python}}"
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Install dependencies
run: |
just install
@ -211,7 +211,7 @@ jobs:
# Test sdist on lowest supported Python
python-version: '3.9'
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.12.0
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
- name: Run connect test from sdist
shell: bash
run: |

View File

@ -18,7 +18,7 @@ jobs:
with:
persist-credentials: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # v1
- name: Get zizmor
run: cargo install zizmor
- name: Run zizmor 🌈
@ -26,7 +26,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3
with:
sarif_file: results.sarif
category: zizmor

View File

@ -2,7 +2,7 @@ Changelog
=========
Changes in Version 4.12.1 (XXXX/XX/XX)
Changes in Version 4.12.1 (2025/04/29)
--------------------------------------
Version 4.12.1 is a bug fix release.

View File

@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "pymongo"
dynamic = ["version", "dependencies", "optional-dependencies"]
description = "Python driver for MongoDB <http://www.mongodb.org>"
description = "PyMongo - the Official MongoDB Python driver"
readme = "README.md"
license = {file="LICENSE"}
requires-python = ">=3.9"

View File

@ -20,6 +20,7 @@ import sys
import time
from test.utils_shared import FunctionCallRecorder
from typing import Any
from unittest import skipIf
sys.path[0:0] = [""]
@ -91,6 +92,7 @@ class SrvPollingKnobs:
self.disable()
@skipIf(not _IS_SYNC and sys.platform == "win32", "PYTHON-5342 known issue on Windows")
class TestSrvPolling(AsyncPyMongoTestCase):
BASE_SRV_RESPONSE = [
("localhost.test.build.10gen.cc", 27017),

View File

@ -20,6 +20,7 @@ import sys
import time
from test.utils_shared import FunctionCallRecorder
from typing import Any
from unittest import skipIf
sys.path[0:0] = [""]
@ -91,6 +92,7 @@ class SrvPollingKnobs:
self.disable()
@skipIf(not _IS_SYNC and sys.platform == "win32", "PYTHON-5342 known issue on Windows")
class TestSrvPolling(PyMongoTestCase):
BASE_SRV_RESPONSE = [
("localhost.test.build.10gen.cc", 27017),

1
uv.lock generated
View File

@ -998,7 +998,6 @@ sdist = { url = "https://files.pythonhosted.org/packages/07/e9/ae44ea7d7605df9e5
[[package]]
name = "pymongo"
version = "4.13.0.dev0"
source = { editable = "." }
dependencies = [
{ name = "dnspython" },