From c207caa1050d9c7621bc377652a8943b34f8fa6c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 15 May 2024 17:16:06 -0500 Subject: [PATCH] MOTOR-1316 Drop Support for Python 3.7 (#279) --- .evergreen/config.yml | 30 +++------ .github/workflows/test-python.yml | 4 +- CONTRIBUTING.md | 2 +- README.md | 4 +- doc/changelog.rst | 5 ++ doc/developer-guide.rst | 2 +- doc/installation.rst | 2 +- doc/requirements.rst | 107 ++++++++---------------------- pyproject.toml | 8 +-- test/test_environment.py | 8 +-- 10 files changed, 54 insertions(+), 118 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 9c40d317..636cc673 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -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" @@ -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" @@ -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" @@ -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" @@ -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: @@ -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" @@ -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" diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 7a6d397b..5cceac82 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -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: @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4a13a776..ae8ea041 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/README.md b/README.md index f3014c98..7def8243 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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`. diff --git a/doc/changelog.rst b/doc/changelog.rst index 743dfd32..f399093e 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -3,6 +3,11 @@ Changelog .. currentmodule:: motor.motor_tornado +Motor 3.5.0 +----------- + +- Drop support for Python 3.7. + Motor 3.4.0 ----------- diff --git a/doc/developer-guide.rst b/doc/developer-guide.rst index 438479f2..d4a045f1 100644 --- a/doc/developer-guide.rst +++ b/doc/developer-guide.rst @@ -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. diff --git a/doc/installation.rst b/doc/installation.rst index 185e0624..ceb75bb5 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -20,7 +20,7 @@ asyncio. It requires: * Unix (including macOS) or Windows. * PyMongo_ >=4.1,<5 -* Python 3.7+ +* Python 3.8+ Optional dependencies: diff --git a/doc/requirements.rst b/doc/requirements.rst index 42f3c62d..89fc9d37 100644 --- a/doc/requirements.rst +++ b/doc/requirements.rst @@ -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. @@ -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+ | @@ -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. @@ -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 | +---------------+-----+-----+-----+-----+-----+ @@ -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. @@ -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 | +=====================+=====+=====+=====+=====+=====+=====+=====+ @@ -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 ------------- diff --git a/pyproject.toml b/pyproject.toml index 568e3072..e851f9d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" }, ] @@ -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", @@ -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 @@ -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" @@ -94,7 +92,7 @@ filterwarnings = [ ] [tool.ruff] -target-version = "py37" +target-version = "py38" line-length = 100 [tool.ruff.lint] diff --git a/test/test_environment.py b/test/test_environment.py index 7127a1dc..9bdbd1c7 100644 --- a/test/test_environment.py +++ b/test/test_environment.py @@ -20,7 +20,6 @@ import sys 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 @@ -51,12 +50,7 @@ except ImportError: 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