Skip to content

Commit ca59c31

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver
2 parents 7ae185a + 527cbdd commit ca59c31

22 files changed

+127
-97
lines changed

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ jobs:
4242
with:
4343
ref: ${{ inputs.ref }}
4444
persist-credentials: false
45-
- uses: actions/setup-python@v5
45+
- uses: actions/setup-python@v6
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3
49+
uses: github/codeql-action/init@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3
5050
with:
5151
languages: ${{ matrix.language }}
5252
build-mode: ${{ matrix.build-mode }}
@@ -63,6 +63,6 @@ jobs:
6363
pip install -e .
6464
6565
- name: Perform CodeQL Analysis
66-
uses: github/codeql-action/analyze@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3
66+
uses: github/codeql-action/analyze@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3
6767
with:
6868
category: "/language:${{matrix.language}}"

.github/workflows/dist.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
persist-credentials: false
5353
ref: ${{ inputs.ref }}
5454

55-
- uses: actions/setup-python@v5
55+
- uses: actions/setup-python@v6
5656
with:
5757
cache: 'pip'
5858
python-version: 3.11
@@ -115,7 +115,7 @@ jobs:
115115
persist-credentials: false
116116
ref: ${{ inputs.ref }}
117117

118-
- uses: actions/setup-python@v5
118+
- uses: actions/setup-python@v6
119119
with:
120120
# Build sdist on lowest supported Python
121121
python-version: '3.9'
@@ -143,7 +143,7 @@ jobs:
143143
name: Download Wheels
144144
steps:
145145
- name: Download all workflow run artifacts
146-
uses: actions/download-artifact@v4
146+
uses: actions/download-artifact@v5
147147
- name: Flatten directory
148148
working-directory: .
149149
run: |

.github/workflows/release-python.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ jobs:
7676
id-token: write
7777
steps:
7878
- name: Download all the dists
79-
uses: actions/download-artifact@v4
79+
uses: actions/download-artifact@v5
8080
with:
8181
name: all-dist-${{ github.run_id }}
8282
path: dist/
8383
- name: Publish package distributions to TestPyPI
84-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1
84+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
8585
with:
8686
repository-url: https://test.pypi.org/legacy/
8787
skip-existing: true
8888
attestations: ${{ env.DRY_RUN }}
8989
- name: Publish package distributions to PyPI
9090
if: startsWith(env.DRY_RUN, 'false')
91-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1
91+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
9292

9393
post-publish:
9494
needs: [publish]

.github/workflows/test-python.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
persist-credentials: false
2525
- name: Install uv
26-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
26+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
2727
with:
2828
enable-cache: true
2929
python-version: "3.9"
@@ -65,7 +65,7 @@ jobs:
6565
with:
6666
persist-credentials: false
6767
- name: Install uv
68-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
68+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
6969
with:
7070
enable-cache: true
7171
python-version: ${{ matrix.python-version }}
@@ -84,7 +84,7 @@ jobs:
8484
with:
8585
persist-credentials: false
8686
- name: Install uv
87-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
87+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
8888
with:
8989
enable-cache: true
9090
python-version: "3.9"
@@ -109,7 +109,7 @@ jobs:
109109
with:
110110
persist-credentials: false
111111
- name: Install uv
112-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
112+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
113113
with:
114114
enable-cache: true
115115
python-version: "3.9"
@@ -128,7 +128,7 @@ jobs:
128128
with:
129129
persist-credentials: false
130130
- name: Install uv
131-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
131+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
132132
with:
133133
enable-cache: true
134134
python-version: "3.9"
@@ -150,7 +150,7 @@ jobs:
150150
with:
151151
persist-credentials: false
152152
- name: Install uv
153-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
153+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
154154
with:
155155
enable-cache: true
156156
python-version: "${{matrix.python}}"
@@ -170,7 +170,7 @@ jobs:
170170
- uses: actions/checkout@v5
171171
with:
172172
persist-credentials: false
173-
- uses: actions/setup-python@v5
173+
- uses: actions/setup-python@v6
174174
with:
175175
cache: 'pip'
176176
cache-dependency-path: 'pyproject.toml'
@@ -193,7 +193,9 @@ jobs:
193193
timeout-minutes: 20
194194
steps:
195195
- name: Download sdist
196-
uses: actions/download-artifact@v4
196+
uses: actions/download-artifact@v5
197+
with:
198+
path: sdist/
197199
- name: Unpack SDist
198200
shell: bash
199201
run: |
@@ -202,7 +204,7 @@ jobs:
202204
mkdir test
203205
tar --strip-components=1 -zxf *.tar.gz -C ./test
204206
ls test
205-
- uses: actions/setup-python@v5
207+
- uses: actions/setup-python@v6
206208
with:
207209
cache: 'pip'
208210
cache-dependency-path: 'sdist/test/pyproject.toml'
@@ -229,7 +231,7 @@ jobs:
229231
with:
230232
persist-credentials: false
231233
- name: Install uv
232-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
234+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
233235
with:
234236
python-version: '3.9'
235237
- id: setup-mongodb
@@ -255,7 +257,7 @@ jobs:
255257
with:
256258
persist-credentials: false
257259
- name: Install uv
258-
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v5
260+
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v5
259261
with:
260262
python-version: '3.9'
261263
- id: setup-mongodb

bson/binary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class Binary(bytes):
298298

299299
def __new__(
300300
cls: Type[Binary],
301-
data: Union[memoryview, bytes, _mmap, _array[Any]],
301+
data: Union[memoryview, bytes, bytearray, _mmap, _array[Any]],
302302
subtype: int = BINARY_SUBTYPE,
303303
) -> Binary:
304304
if not isinstance(subtype, int):

bson/raw_bson.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@
6060

6161

6262
def _inflate_bson(
63-
bson_bytes: bytes, codec_options: CodecOptions[RawBSONDocument], raw_array: bool = False
63+
bson_bytes: bytes | memoryview,
64+
codec_options: CodecOptions[RawBSONDocument],
65+
raw_array: bool = False,
6466
) -> dict[str, Any]:
6567
"""Inflates the top level fields of a BSON document.
6668
@@ -85,7 +87,9 @@ class RawBSONDocument(Mapping[str, Any]):
8587
__codec_options: CodecOptions[RawBSONDocument]
8688

8789
def __init__(
88-
self, bson_bytes: bytes, codec_options: Optional[CodecOptions[RawBSONDocument]] = None
90+
self,
91+
bson_bytes: bytes | memoryview,
92+
codec_options: Optional[CodecOptions[RawBSONDocument]] = None,
8993
) -> None:
9094
"""Create a new :class:`RawBSONDocument`
9195
@@ -135,7 +139,7 @@ class from the standard library so it can be used like a read-only
135139
_get_object_size(bson_bytes, 0, len(bson_bytes))
136140

137141
@property
138-
def raw(self) -> bytes:
142+
def raw(self) -> bytes | memoryview:
139143
"""The raw BSON bytes composing this document."""
140144
return self.__raw
141145

@@ -153,7 +157,7 @@ def __inflated(self) -> Mapping[str, Any]:
153157

154158
@staticmethod
155159
def _inflate_bson(
156-
bson_bytes: bytes, codec_options: CodecOptions[RawBSONDocument]
160+
bson_bytes: bytes | memoryview, codec_options: CodecOptions[RawBSONDocument]
157161
) -> Mapping[str, Any]:
158162
return _inflate_bson(bson_bytes, codec_options)
159163

@@ -180,7 +184,7 @@ class _RawArrayBSONDocument(RawBSONDocument):
180184

181185
@staticmethod
182186
def _inflate_bson(
183-
bson_bytes: bytes, codec_options: CodecOptions[RawBSONDocument]
187+
bson_bytes: bytes | memoryview, codec_options: CodecOptions[RawBSONDocument]
184188
) -> Mapping[str, Any]:
185189
return _inflate_bson(bson_bytes, codec_options, raw_array=True)
186190

bson/son.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def popitem(self) -> Tuple[_Key, _Value]:
143143
del self[k]
144144
return (k, v)
145145

146-
def update(self, other: Optional[Any] = None, **kwargs: _Value) -> None: # type: ignore[override]
146+
def update(self, other: Optional[Any] = None, **kwargs: _Value) -> None:
147147
# Make progressively weaker assumptions about "other"
148148
if other is None:
149149
pass

bson/typings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
_DocumentOut = Union[MutableMapping[str, Any], "RawBSONDocument"]
2929
_DocumentType = TypeVar("_DocumentType", bound=Mapping[str, Any])
3030
_DocumentTypeArg = TypeVar("_DocumentTypeArg", bound=Mapping[str, Any])
31-
_ReadableBuffer = Union[bytes, memoryview, "mmap", "array"] # type: ignore[type-arg]
31+
_ReadableBuffer = Union[bytes, memoryview, bytearray, "mmap", "array"] # type: ignore[type-arg]

doc/changelog.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Changelog
22
=========
3-
Changes in Version 4.15.0 (XXXX/XX/XX)
3+
4+
Changes in Version 4.15.0 (2025/09/10)
45
--------------------------------------
6+
57
PyMongo 4.15 brings a number of changes including:
68

79
- Added :class:`~pymongo.encryption_options.TextOpts`,
@@ -13,6 +15,7 @@ PyMongo 4.15 brings a number of changes including:
1315
``pymongocrypt>=1.16`` is required for text query support.
1416
- Added :class:`bson.decimal128.DecimalEncoder` and :class:`bson.decimal128.DecimalDecoder`
1517
to support encoding and decoding of BSON Decimal128 values to decimal.Decimal values using the TypeRegistry API.
18+
- Added support for Windows ``arm64`` wheels.
1619

1720
Changes in Version 4.14.1 (2025/08/19)
1821
--------------------------------------

pymongo/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import re
1919
from typing import List, Tuple, Union
2020

21-
__version__ = "4.15.0.dev0"
21+
__version__ = "4.16.0.dev0"
2222

2323

2424
def get_version_tuple(version: str) -> Tuple[Union[int, str], ...]:

0 commit comments

Comments
 (0)