Skip to content

Commit

Permalink
MOTOR-1316 Drop Support for Python 3.7 (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed May 15, 2024
1 parent 6ee75e0 commit c207caa
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 118 deletions.
30 changes: 9 additions & 21 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -809,18 +809,10 @@ axes:
- id: tox-env
display_name: "Tox Env RHEL8"
values:
- id: "test-pypy38"
- id: "test-pypy39"
variables:
TOX_ENV: "test"
PYTHON_BINARY: "/opt/python/pypy3.8/bin/python3"
- id: "test-py37"
variables:
TOX_ENV: "test"
PYTHON_BINARY: "/opt/python/3.7/bin/python3"
- id: "test-py37"
variables:
TOX_ENV: "test"
PYTHON_BINARY: "/opt/python/3.7/bin/python3"
PYTHON_BINARY: "/opt/python/pypy3.9/bin/python3"
- id: "test-py38"
variables:
TOX_ENV: "test"
Expand All @@ -844,11 +836,11 @@ axes:
- id: "test-pymongo-latest"
variables:
TOX_ENV: "test-pymongo-latest"
PYTHON_BINARY: "/opt/python/3.7/bin/python3"
- id: "synchro-py37"
PYTHON_BINARY: "/opt/python/3.8/bin/python3"
- id: "synchro-py38"
variables:
TOX_ENV: "synchro"
PYTHON_BINARY: "/opt/python/3.7/bin/python3"
PYTHON_BINARY: "/opt/python/3.8/bin/python3"
- id: "synchro-py312"
variables:
TOX_ENV: "synchro"
Expand All @@ -874,10 +866,6 @@ axes:
- id: tox-env-win
display_name: "Tox Env Windows"
values:
- id: "test-py37"
variables:
TOX_ENV: "test"
PYTHON_BINARY: "c:/python/Python37/python.exe"
- id: "test-py38"
variables:
TOX_ENV: "test"
Expand Down Expand Up @@ -928,7 +916,7 @@ buildvariants:
# TODO: synchro needs PyMongo's updated SSL test certs,
# which may require Motor test suite changes.
- os: "*"
tox-env: ["synchro-py37", "synchro-py312"]
tox-env: ["synchro-py38", "synchro-py312"]
ssl: "ssl"
tasks:
- ".rapid"
Expand Down Expand Up @@ -986,7 +974,7 @@ buildvariants:

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

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

Expand Down
4 changes: 2 additions & 2 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.7", "3.12"]
python-version: ["3.8", "3.12"]
fail-fast: false
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.8
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install Python dependencies
Expand Down
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.7+ and a MongoDB 5.0 instance running on
The doctests pass with Python 3.8+ and a MongoDB 5.0 instance running on
port 27017:

```bash
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ by asyncio. It requires:

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

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.7+. Install
Build the documentation with Python 3.8+. 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
5 changes: 5 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Changelog

.. currentmodule:: motor.motor_tornado

Motor 3.5.0
-----------

- Drop support for Python 3.7.

Motor 3.4.0
-----------

Expand Down
2 changes: 1 addition & 1 deletion doc/developer-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ synchronous and Motor is async; how can Motor pass PyMongo's tests?
Synchro is a hacky little module that re-synchronizes all Motor methods using
the Tornado IOLoop's ``run_sync`` method. ``synchrotest.py`` overrides the Python
interpreter's import machinery to allow Synchro to masquerade as PyMongo, and
runs PyMongo's test suite against it. Use ``tox -e synchro37`` to check out
runs PyMongo's test suite against it. Use ``tox -e synchro`` to check out
PyMongo's test suite and run it with Synchro.
2 changes: 1 addition & 1 deletion doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ asyncio. It requires:

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

Optional dependencies:

Expand Down
107 changes: 29 additions & 78 deletions doc/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Requirements

The current version of Motor requires:

* CPython 3.7 and later.
* CPython 3.8 and later.
* PyMongo_ 4.5 and later.

Motor can integrate with either Tornado or asyncio.
Expand All @@ -27,24 +27,6 @@ Motor and PyMongo
+-------------------+-----------------+
| Motor Version | PyMongo Version |
+===================+=================+
| 1.0 | 3.3+ |
+-------------------+-----------------+
| 1.1 | 3.4+ |
+-------------------+-----------------+
| 1.2 | 3.6+ |
+-------------------+-----------------+
| 1.3 | 3.6+ |
+-------------------+-----------------+
| 2.0 | 3.7+ |
+-------------------+-----------------+
| 2.1 | 3.10+ |
+-------------------+-----------------+
| 2.2 | 3.11+ |
+-------------------+-----------------+
| 2.3 | 3.11+ |
+-------------------+-----------------+
| 2.4 | 3.11+ |
+-------------------+-----------------+
| 2.5 | 3.12+ |
+-------------------+-----------------+
| 3.0 | 4.1+ |
Expand All @@ -55,43 +37,29 @@ Motor and PyMongo
+-------------------+-----------------+
| 3.3 | 4.5+ |
+-------------------+-----------------+
| 3.4 | 4.6+ |
+-------------------+-----------------+

Motor and MongoDB
`````````````````

+---------------------------------------------------------------------------------------------------+
| MongoDB Version |
+=====================+=====+=====+=====+=====+=====+=====+=====+=====+=====+=====+=====+=====+=====+
| | 2.2 | 2.4 | 2.6 | 3.0 | 3.2 | 3.4 | 3.6 | 4.0 | 4.2 | 4.4 | 5.0 | 6.0 | 7.0 |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| Motor Version | 1.0 | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 1.1 | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 1.2 |**N**|**N**| Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 1.3 |**N**|**N**| Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 2.0 |**N**|**N**|**N**| Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 2.1 |**N**|**N**|**N**| Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 2.2 |**N**|**N**|**N**| Y | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 2.3 |**N**|**N**|**N**| Y | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 2.4 |**N**|**N**|**N**| Y | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 2.5 |**N**|**N**|**N**| Y | Y | Y | Y | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.0 |**N**|**N**|**N**|**N**|**N**|**N**| Y | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.1 |**N**|**N**|**N**|**N**|**N**|**N**| Y | Y | Y | Y | Y | Y |**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.2 |**N**|**N**|**N**|**N**|**N**|**N**| Y | Y | Y | Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.3 |**N**|**N**|**N**|**N**|**N**|**N**| Y | Y | Y | Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
+---------------------------------------------------------------+
| MongoDB Version |
+=====================+=====+=====+=====+=====+=====+=====+=====+
| | 3.6 | 4.0 | 4.2 | 4.4 | 5.0 | 6.0 | 7.0 |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| Motor Version | 2.5 | Y | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.0 | Y | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.1 | Y | Y | Y | Y | Y | Y |**N**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.2 | Y | Y | Y | Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.3 | Y | Y | Y | Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.4 | Y | Y | Y | Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+

There is no relationship between PyMongo and MongoDB version numbers, although
the numbers happen to be close or equal in recent releases of PyMongo and MongoDB.
Expand All @@ -110,23 +78,7 @@ known to be incompatible, or have not been tested together.
+---------------------------------------------+
| Tornado Version |
+=====================+=====+=====+=====+=====+
| | 3.x | 4.x | 5.x | 6.x |
+---------------+-----+-----+-----+-----+-----+
| Motor Version | 1.0 | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+
| | 1.1 | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+
| | 1.2 |**N**| Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+
| | 1.3 |**N**| Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-----+
| | 2.0 |**N**| Y | Y |**N**|
+---------------+-----+-----+-----+-----+-----+
| | 2.1 |**N**| Y | Y | Y |
+---------------+-----+-----+-----+-----+-----+
| | 2.2 |**N**|**N**| Y | Y |
+---------------+-----+-----+-----+-----+-----+
| | 2.3 |**N**|**N**| Y | Y |
| Motor Version | 2.5 |**N**|**N**| Y | Y |
+---------------+-----+-----+-----+-----+-----+
| | 3.0 |**N**|**N**|**N**| Y |
+---------------+-----+-----+-----+-----+-----+
Expand All @@ -136,19 +88,12 @@ known to be incompatible, or have not been tested together.
+---------------+-----+-----+-----+-----+-----+
| | 3.3 |**N**|**N**|**N**| Y |
+---------------+-----+-----+-----+-----+-----+
| | 3.4 |**N**|**N**|**N**| Y |
+---------------+-----+-----+-----+-----+-----+

Motor and Python
````````````````

Motor 1.2 dropped support for the short-lived version of
the "async for" protocol implemented in Python 3.5.0 and 3.5.1. Motor continues
to work with "async for" loops in Python 3.5.2 and later.

Motor 1.2.5 and 1.3.1 add compatibility with Python 3.7, but at the cost of
dropping Python 3.4.3 and older.

Motor 2.2 dropped support for Pythons older than 3.5.2.

Motor 2.5 deprecated support for Python 3.5.

Motor 3.0 dropped support for Pythons older than 3.7.
Expand All @@ -157,6 +102,8 @@ Motor 3.1.1 added support for Python 3.11.

Motor 3.3 added support for Python 3.12.

Motor 3.5 dropped support for Python 3.7.

+---------------------------------------------------------------+
| Python Version |
+=====================+=====+=====+=====+=====+=====+=====+=====+
Expand Down Expand Up @@ -190,6 +137,10 @@ Motor 3.3 added support for Python 3.12.
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.3 |**N**| Y | Y | Y | Y | Y |**Y**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.4 |**N**| Y | Y | Y | Y | Y |**Y**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.5 |**N**|**N**| Y | Y | Y | Y |**Y**|
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+

Not Supported
-------------
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version", "dependencies", "optional-dependencies"]
description = "Non-blocking MongoDB driver for Tornado or asyncio"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.7"
requires-python = ">=3.8"
authors = [
{ name = "A. Jesse Jiryu Davis", email = "jesse@mongodb.com" },
]
Expand All @@ -33,7 +33,6 @@ classifiers = [
"Typing :: Typed",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
Expand All @@ -56,7 +55,7 @@ version = {attr = "motor._version.version"}
include = ["motor"]

[tool.mypy]
python_version = "3.7"
python_version = "3.8"
strict = true
pretty = true
show_error_context = true
Expand All @@ -65,7 +64,6 @@ warn_redundant_casts = true
warn_unreachable = true
disable_error_code = ["type-arg"]
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
exclude = ["aiohttp"] # Remove when drop support for 3.7

[tool.pytest.ini_options]
minversion = "7"
Expand Down Expand Up @@ -94,7 +92,7 @@ filterwarnings = [
]

[tool.ruff]
target-version = "py37"
target-version = "py38"
line-length = 100

[tool.ruff.lint]
Expand Down
8 changes: 1 addition & 7 deletions test/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from functools import wraps
from test.utils import create_user
from test.version import Version
from typing import TYPE_CHECKING
from unittest import SkipTest

import pymongo.errors
Expand Down Expand Up @@ -51,12 +50,7 @@

HAVE_AIOHTTP = True
try:
# Remove when we drop support for 3.7
if TYPE_CHECKING:
HAVE_AIOHTTP = False
aiohttp = None
else:
import aiohttp
import aiohttp
except ImportError:
HAVE_AIOHTTP = False
aiohttp = None
Expand Down

0 comments on commit c207caa

Please sign in to comment.