Skip to content

Commit 54fd7b6

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver
2 parents 725dbc2 + c136684 commit 54fd7b6

File tree

86 files changed

+1736
-1566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1736
-1566
lines changed

.evergreen/config.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,10 +2081,10 @@ axes:
20812081
batchtime: 10080 # 7 days
20822082
- id: rhel8
20832083
display_name: "RHEL 8.x"
2084-
run_on: rhel87-small
2084+
run_on: rhel8.8-small
20852085
batchtime: 10080 # 7 days
2086-
- id: rhel92-fips
2087-
display_name: "RHEL 9.2 FIPS"
2086+
- id: rhel9-fips
2087+
display_name: "RHEL 9 FIPS"
20882088
run_on: rhel92-fips
20892089
batchtime: 10080 # 7 days
20902090
- id: ubuntu-22.04
@@ -2095,24 +2095,24 @@ axes:
20952095
display_name: "Ubuntu 20.04"
20962096
run_on: ubuntu2004-small
20972097
batchtime: 10080 # 7 days
2098-
- id: rhel83-zseries
2099-
display_name: "RHEL 8.3 (zSeries)"
2100-
run_on: rhel83-zseries-small
2098+
- id: rhel8-zseries
2099+
display_name: "RHEL 8 (zSeries)"
2100+
run_on: rhel8-zseries-small
21012101
batchtime: 10080 # 7 days
21022102
variables:
21032103
SKIP_HATCH: true
2104-
- id: rhel81-power8
2105-
display_name: "RHEL 8.1 (POWER8)"
2106-
run_on: rhel81-power8-small
2104+
- id: rhel8-power8
2105+
display_name: "RHEL 8 (POWER8)"
2106+
run_on: rhel8-power-small
21072107
batchtime: 10080 # 7 days
21082108
variables:
21092109
SKIP_HATCH: true
2110-
- id: rhel82-arm64
2111-
display_name: "RHEL 8.2 (ARM64)"
2110+
- id: rhel8-arm64
2111+
display_name: "RHEL 8 (ARM64)"
21122112
run_on: rhel82-arm64-small
21132113
batchtime: 10080 # 7 days
21142114
variables:
2115-
- id: windows-64-vsMulti-small
2115+
- id: windows
21162116
display_name: "Windows 64"
21172117
run_on: windows-64-vsMulti-small
21182118
batchtime: 10080 # 7 days
@@ -2470,7 +2470,7 @@ buildvariants:
24702470
- matrix_name: "tests-fips"
24712471
matrix_spec:
24722472
platform:
2473-
- rhel92-fips
2473+
- rhel9-fips
24742474
auth: "auth"
24752475
ssl: "ssl"
24762476
display_name: "${platform} ${auth} ${ssl}"
@@ -2547,9 +2547,9 @@ buildvariants:
25472547
- matrix_name: "test-different-cpu-architectures"
25482548
matrix_spec:
25492549
platform:
2550-
- rhel83-zseries # Added in 5.0.8 (SERVER-44074)
2551-
- rhel81-power8 # Added in 4.2.7 (SERVER-44072)
2552-
- rhel82-arm64 # Added in 4.4.2 (SERVER-48282)
2550+
- rhel8-zseries # Added in 5.0.8 (SERVER-44074)
2551+
- rhel8-power8 # Added in 4.2.7 (SERVER-44072)
2552+
- rhel8-arm64 # Added in 4.4.2 (SERVER-48282)
25532553
auth-ssl: "*"
25542554
display_name: "${platform} ${auth-ssl}"
25552555
tasks:
@@ -2606,7 +2606,7 @@ buildvariants:
26062606

26072607
- matrix_name: "tests-pyopenssl-windows"
26082608
matrix_spec:
2609-
platform: windows-64-vsMulti-small
2609+
platform: windows
26102610
python-version-windows: "*"
26112611
auth: "auth"
26122612
ssl: "ssl"
@@ -2698,15 +2698,15 @@ buildvariants:
26982698

26992699
- matrix_name: "tests-windows-python-version"
27002700
matrix_spec:
2701-
platform: windows-64-vsMulti-small
2701+
platform: windows
27022702
python-version-windows: "*"
27032703
auth-ssl: "*"
27042704
display_name: "${platform} ${python-version-windows} ${auth-ssl}"
27052705
tasks: *all-server-versions
27062706

27072707
- matrix_name: "tests-windows-python-version-32-bit"
27082708
matrix_spec:
2709-
platform: windows-64-vsMulti-small
2709+
platform: windows
27102710
python-version-windows-32: "*"
27112711
auth-ssl: "*"
27122712
display_name: "${platform} ${python-version-windows-32} ${auth-ssl}"
@@ -2724,7 +2724,7 @@ buildvariants:
27242724

27252725
- matrix_name: "tests-windows-encryption"
27262726
matrix_spec:
2727-
platform: windows-64-vsMulti-small
2727+
platform: windows
27282728
python-version-windows: "*"
27292729
auth-ssl: "*"
27302730
encryption: "*"
@@ -2733,7 +2733,7 @@ buildvariants:
27332733
rules:
27342734
- if:
27352735
encryption: ["encryption", "encryption_crypt_shared"]
2736-
platform: windows-64-vsMulti-small
2736+
platform: windows
27372737
python-version-windows: "*"
27382738
auth-ssl: "*"
27392739
then:
@@ -2795,7 +2795,7 @@ buildvariants:
27952795

27962796
- matrix_name: "tests-windows-enterprise-auth"
27972797
matrix_spec:
2798-
platform: windows-64-vsMulti-small
2798+
platform: windows
27992799
python-version-windows: "*"
28002800
auth: "auth"
28012801
display_name: "Enterprise ${auth} ${platform} ${python-version-windows}"
@@ -2907,7 +2907,7 @@ buildvariants:
29072907

29082908
- matrix_name: "ocsp-test-windows"
29092909
matrix_spec:
2910-
platform: windows-64-vsMulti-small
2910+
platform: windows
29112911
python-version-windows: ["3.8", "3.10"]
29122912
mongodb-version: ["4.4", "5.0", "6.0", "7.0", "8.0", "latest"]
29132913
auth: "noauth"
@@ -2932,7 +2932,7 @@ buildvariants:
29322932

29332933
- matrix_name: "oidc-auth-test"
29342934
matrix_spec:
2935-
platform: [ rhel8, macos, windows-64-vsMulti-small ]
2935+
platform: [ rhel8, macos, windows ]
29362936
display_name: "OIDC Auth ${platform}"
29372937
tasks:
29382938
- name: testoidc_task_group
@@ -2981,7 +2981,7 @@ buildvariants:
29812981

29822982
- matrix_name: "aws-auth-test-windows"
29832983
matrix_spec:
2984-
platform: [windows-64-vsMulti-small]
2984+
platform: [windows]
29852985
python-version-windows: "*"
29862986
display_name: "MONGODB-AWS Auth ${platform} ${python-version-windows}"
29872987
tasks:

CONTRIBUTING.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,10 @@ hatch run lint:build-manual
163163

164164
## Documentation
165165

166-
To contribute to the [API
167-
documentation](https://pymongo.readthedocs.io/en/stable/) just make your
168-
changes to the inline documentation of the appropriate [source
169-
code](https://github.com/mongodb/mongo-python-driver) or [rst
170-
file](https://github.com/mongodb/mongo-python-driver/tree/master/doc) in
171-
a branch and submit a [pull
172-
request](https://help.github.com/articles/using-pull-requests). You
166+
To contribute to the [API documentation](https://pymongo.readthedocs.io/en/stable/) just make your
167+
changes to the inline documentation of the appropriate [source code](https://github.com/mongodb/mongo-python-driver) or
168+
[rst file](https://github.com/mongodb/mongo-python-driver/tree/master/doc) in
169+
a branch and submit a [pull request](https://help.github.com/articles/using-pull-requests). You
173170
might also use the GitHub
174171
[Edit](https://github.com/blog/844-forking-with-the-edit-button) button.
175172

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![PyPI Version](https://img.shields.io/pypi/v/pymongo)](https://pypi.org/project/pymongo)
44
[![Python Versions](https://img.shields.io/pypi/pyversions/pymongo)](https://pypi.org/project/pymongo)
55
[![Monthly Downloads](https://static.pepy.tech/badge/pymongo/month)](https://pepy.tech/project/pymongo)
6-
[![Documentation Status](https://readthedocs.org/projects/pymongo/badge/?version=stable)](http://pymongo.readthedocs.io/en/stable/?badge=stable)
6+
[![API Documentation Status](https://readthedocs.org/projects/pymongo/badge/?version=stable)](http://pymongo.readthedocs.io/en/stable/api?badge=stable)
77

88
## About
99

bson/_cbsonmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static PyObject* datetime_from_millis(long long millis) {
306306
if (evalue) {
307307
PyObject* err_msg = PyObject_Str(evalue);
308308
if (err_msg) {
309-
PyObject* appendage = PyUnicode_FromString(" (Consider Using CodecOptions(datetime_conversion=DATETIME_AUTO) or MongoClient(datetime_conversion='DATETIME_AUTO')). See: https://pymongo.readthedocs.io/en/stable/examples/datetimes.html#handling-out-of-range-datetimes");
309+
PyObject* appendage = PyUnicode_FromString(" (Consider Using CodecOptions(datetime_conversion=DATETIME_AUTO) or MongoClient(datetime_conversion='DATETIME_AUTO')). See: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#handling-out-of-range-datetimes");
310310
if (appendage) {
311311
PyObject* msg = PyUnicode_Concat(err_msg, appendage);
312312
if (msg) {

bson/datetime_ms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
_DATETIME_ERROR_SUGGESTION = (
3232
"(Consider Using CodecOptions(datetime_conversion=DATETIME_AUTO)"
3333
" or MongoClient(datetime_conversion='DATETIME_AUTO'))."
34-
" See: https://pymongo.readthedocs.io/en/stable/examples/datetimes.html#handling-out-of-range-datetimes"
34+
" See: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#handling-out-of-range-datetimes"
3535
)
3636

3737

doc/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ Unavoidable breaking changes
9393
- Since we are now using ``hatch`` as our build backend, we no longer have a usable ``setup.py`` file
9494
and require installation using ``pip``. Attempts to invoke the ``setup.py`` file will raise an exception.
9595
Additionally, ``pip`` >= 21.3 is now required for editable installs.
96+
- We no longer support the ``srv`` extra, since ``dnspython`` is included as a dependency in PyMongo 4.7+.
97+
Instead of ``pip install pymongo[srv]``, use ``pip install pymongo``.
98+
- We no longer support the ``tls`` extra, which was only valid for Python 2.
99+
Instead of ``pip install pymongo[tls]``, use ``pip install pymongo``.
96100

97101
Issues Resolved
98102
...............

doc/index.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
PyMongo |release| Documentation
22
===============================
33

4+
.. note:: The PyMongo documentation has been migrated to the
5+
`MongoDB Documentation site <https://www.mongodb.com/docs/languages/python/pymongo-driver/current>`_.
6+
As of PyMongo 4.10, the ReadTheDocs site will contain the detailed changelog and API docs, while the
7+
rest of the documentation will only appear on the MongoDB Documentation site.
8+
49
Overview
510
--------
611
**PyMongo** is a Python distribution containing tools for working with
@@ -95,8 +100,6 @@ pull request.
95100
Changes
96101
-------
97102
See the :doc:`changelog` for a full list of changes to PyMongo.
98-
For older versions of the documentation please see the
99-
`archive list <http://api.mongodb.org/python/>`_.
100103

101104
About This Documentation
102105
------------------------

pymongo/asynchronous/command_cursor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
)
3030

3131
from bson import CodecOptions, _convert_raw_document_lists_to_streams
32+
from pymongo import _csot
3233
from pymongo.asynchronous.cursor import _ConnectionManager
3334
from pymongo.cursor_shared import _CURSOR_CLOSED_ERRORS
3435
from pymongo.errors import ConnectionFailure, InvalidOperation, OperationFailure
@@ -77,6 +78,7 @@ def __init__(
7778
self._address = address
7879
self._batch_size = batch_size
7980
self._max_await_time_ms = max_await_time_ms
81+
self._timeout = self._collection.database.client.options.timeout
8082
self._session = session
8183
self._explicit_session = explicit_session
8284
self._killed = self._id == 0
@@ -385,6 +387,7 @@ async def __aenter__(self) -> AsyncCommandCursor[_DocumentType]:
385387
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
386388
await self.close()
387389

390+
@_csot.apply
388391
async def to_list(self, length: Optional[int] = None) -> list[_DocumentType]:
389392
"""Converts the contents of this cursor to a list more efficiently than ``[doc async for doc in cursor]``.
390393

pymongo/asynchronous/cursor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from bson import RE_TYPE, _convert_raw_document_lists_to_streams
3737
from bson.code import Code
3838
from bson.son import SON
39-
from pymongo import helpers_shared
39+
from pymongo import _csot, helpers_shared
4040
from pymongo.asynchronous.helpers import anext
4141
from pymongo.collation import validate_collation_or_none
4242
from pymongo.common import (
@@ -196,6 +196,7 @@ def __init__(
196196
self._explain = False
197197
self._comment = comment
198198
self._max_time_ms = max_time_ms
199+
self._timeout = self._collection.database.client.options.timeout
199200
self._max_await_time_ms: Optional[int] = None
200201
self._max: Optional[Union[dict[Any, Any], _Sort]] = max
201202
self._min: Optional[Union[dict[Any, Any], _Sort]] = min
@@ -1290,6 +1291,7 @@ async def __aenter__(self) -> AsyncCursor[_DocumentType]:
12901291
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
12911292
await self.close()
12921293

1294+
@_csot.apply
12931295
async def to_list(self, length: Optional[int] = None) -> list[_DocumentType]:
12941296
"""Converts the contents of this cursor to a list more efficiently than ``[doc async for doc in cursor]``.
12951297

pymongo/asynchronous/mongo_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,6 @@ def __del__(self) -> None:
11931193
),
11941194
ResourceWarning,
11951195
stacklevel=2,
1196-
source=self,
11971196
)
11981197
except AttributeError:
11991198
pass

0 commit comments

Comments
 (0)