Skip to content

Commit

Permalink
MOTOR-1423 Restore compatibility with latest pymongo (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Jan 29, 2025
1 parent 1433773 commit 932bb73
Show file tree
Hide file tree
Showing 19 changed files with 200 additions and 157 deletions.
66 changes: 21 additions & 45 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,33 +346,6 @@ tasks:
# Test tasks {{{

- name: "test-3.6-standalone"
tags: ["3.6", "standalone"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "3.6"
TOPOLOGY: "server"
- func: "run tox"

- name: "test-3.6-replica_set"
tags: ["3.6", "replica_set"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "3.6"
TOPOLOGY: "replica_set"
- func: "run tox"

- name: "test-3.6-sharded_cluster"
tags: ["3.6", "sharded_cluster"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "3.6"
TOPOLOGY: "sharded_cluster"
- func: "run tox"

- name: "test-4.0-standalone"
tags: ["4.0", "standalone"]
commands:
Expand Down Expand Up @@ -684,10 +657,6 @@ axes:
variables:
TOX_ENV: "test"
PYTHON_BINARY: "/opt/python/pypy3.9/bin/python3"
- id: "test-py38"
variables:
TOX_ENV: "test"
PYTHON_BINARY: "/opt/python/3.8/bin/python3"
- id: "test-py39"
variables:
TOX_ENV: "test"
Expand All @@ -708,14 +677,26 @@ axes:
variables:
TOX_ENV: "test"
PYTHON_BINARY: "/opt/python/3.13/bin/python3"
- id: "test-pymongo-4.9"
variables:
TOX_ENV: "test-pymongo-4.9"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "test-pymongo-4.10"
variables:
TOX_ENV: "test-pymongo-4.10"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "test-pymongo-4.11"
variables:
TOX_ENV: "test-pymongo-4.11"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "test-pymongo-latest"
variables:
TOX_ENV: "test-pymongo-latest"
PYTHON_BINARY: "/opt/python/3.8/bin/python3"
- id: "synchro-py38"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "synchro-py39"
variables:
TOX_ENV: "synchro"
PYTHON_BINARY: "/opt/python/3.8/bin/python3"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "synchro-py312"
variables:
TOX_ENV: "synchro"
Expand All @@ -729,22 +710,18 @@ axes:
TOX_ENV: "test"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"

# Test Python 3.8 only on Mac.
# Test Python 3.9 only on Mac.
- id: tox-env-osx
display_name: "Tox Env OSX"
values:
- id: "test"
variables:
TOX_ENV: "test"
PYTHON_BINARY: "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3"
PYTHON_BINARY: "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3"

- id: tox-env-win
display_name: "Tox Env Windows"
values:
- id: "test-py38"
variables:
TOX_ENV: "test"
PYTHON_BINARY: "c:/python/Python39/python.exe"
- id: "test-py39"
variables:
TOX_ENV: "test"
Expand Down Expand Up @@ -791,7 +768,7 @@ buildvariants:
# TODO: synchro needs PyMongo's updated SSL test certs,
# which may require Motor test suite changes.
- os: "*"
tox-env: ["synchro-py38", "synchro-py312"]
tox-env: ["synchro-py39", "synchro-py312"]
ssl: "ssl"
tasks:
- ".rapid"
Expand All @@ -803,7 +780,6 @@ buildvariants:
- ".4.4"
- ".4.2"
- ".4.0"
- ".3.6"

- matrix_name: "test-rhel7"
display_name: "${os}-${tox-env-rhel7}-${ssl}"
Expand Down Expand Up @@ -852,7 +828,7 @@ buildvariants:

- matrix_name: "enterprise-auth"
display_name: "Enterprise Auth-${tox-env}"
matrix_spec: {"tox-env": ["synchro-py38", "synchro-py312"], ssl: "ssl"}
matrix_spec: {"tox-env": ["synchro-py39", "synchro-py312"], ssl: "ssl"}
run_on:
- "rhel84-small"
tasks:
Expand All @@ -864,7 +840,7 @@ buildvariants:
- "rhel84-small"
expansions:
TOX_ENV: "docs"
PYTHON_BINARY: "/opt/python/3.8/bin/python3"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
tasks:
- name: "docs"

Expand All @@ -874,7 +850,7 @@ buildvariants:
- "rhel84-small"
expansions:
TOX_ENV: "doctest"
PYTHON_BINARY: "/opt/python/3.8/bin/python3"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
tasks:
- name: "doctest"

Expand Down
19 changes: 7 additions & 12 deletions .evergreen/run-tox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,12 @@ createvirtualenv () {
}


if $PYTHON_BINARY -m tox --version; then
run_tox() {
$PYTHON_BINARY -m tox -m $TOX_ENV "$@"
}
else # No toolchain present, set up virtualenv before installing tox
createvirtualenv "$PYTHON_BINARY" toxenv
trap "deactivate; rm -rf toxenv" EXIT HUP
python -m pip install tox
run_tox() {
python -m tox -m $TOX_ENV "$@"
}
fi
# Set up a virtualenv and install tox.
createvirtualenv "$PYTHON_BINARY" toxenv
trap "deactivate; rm -rf toxenv" EXIT HUP
python -m pip install tox
run_tox() {
python -m tox -m $TOX_ENV "$@"
}

run_tox "${@:1}"
8 changes: 4 additions & 4 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ["3.8", "3.12", "3.13"]
python-version: ["3.9", "3.12", "3.13"]
fail-fast: false
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install Python dependencies
Expand All @@ -71,7 +71,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install Python dependencies
Expand All @@ -96,7 +96,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install Python dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ doc/_build/
xunit-results
xunit-synchro-results
.eggs
toxenv
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Python version on your path, and run:
tox -m test
```

The doctests pass with Python 3.8+ and a MongoDB 5.0 instance running on
The doctests pass with Python 3.9+ and a MongoDB 5.0 instance running on
port 27017:

```bash
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Motor works in all the environments officially supported by Tornado or
by asyncio. It requires:

- Unix (including macOS) or Windows.
- [PyMongo](http://pypi.python.org/pypi/pymongo/) >=4.1,<5
- Python 3.8+
- [PyMongo](http://pypi.python.org/pypi/pymongo/) >=4.9,<5
- Python 3.9+

Optional dependencies:

Expand Down Expand Up @@ -185,7 +185,7 @@ ReadTheDocs](https://motor.readthedocs.io/en/stable/examples/index.html).
Motor's documentation is on
[ReadTheDocs](https://motor.readthedocs.io/en/stable/).

Build the documentation with Python 3.8+. Install
Build the documentation with Python 3.9+. Install
[sphinx](http://sphinx.pocoo.org/), [Tornado](http://tornadoweb.org/),
and [aiohttp](https://github.com/aio-libs/aiohttp), and do
`cd doc; make html`.
Expand Down
12 changes: 9 additions & 3 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ Changelog

.. currentmodule:: motor.motor_tornado

Motor 3.7.0
-----------
- Add support for PyMongo 4.10.
- Drop support for Python 3.8.
- Drop support for MongoDB 3.6.


Motor 3.6.1
-----------
- Add return type to to_list method in stub file.
Expand Down Expand Up @@ -735,7 +742,7 @@ Motor 1.0
Motor now depends on PyMongo 3.3 and later. The move from PyMongo 2 to 3 brings
a large number of API changes, read the `the PyMongo 3 changelog`_ carefully.

.. _the PyMongo 3 changelog: https://pymongo.readthedocs.io/en/stable/changelog.html#changes-in-version-3-0
.. _the PyMongo 3 changelog: https://pymongo.readthedocs.io/en/4.0/changelog.html#changes-in-version-3-0

:class:`MotorReplicaSetClient` is removed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1271,8 +1278,7 @@ therefore inheriting
`PyMongo 2.7.2's bug fixes <https://jira.mongodb.org/browse/PYTHON/fixforversion/14005>`_
and
`PyMongo 2.8's bug fixes <https://jira.mongodb.org/browse/PYTHON/fixforversion/14223>`_
and `features
<https://pymongo.readthedocs.io/en/stable/changelog.html#changes-in-version-2-8>`_.
and features.

Fixes `a connection-pool timeout when waitQueueMultipleMS is set
<https://jira.mongodb.org/browse/MOTOR-62>`_ and `two bugs in replica set
Expand Down
4 changes: 2 additions & 2 deletions doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Motor works in all the environments officially supported by Tornado or by
asyncio. It requires:

* Unix (including macOS) or Windows.
* PyMongo_ >=4.1,<5
* Python 3.8+
* PyMongo_ >=4.9,<5
* Python 3.9+

Optional dependencies:

Expand Down
Loading

0 comments on commit 932bb73

Please sign in to comment.