MOTOR-1054 motor.motor_asyncio is broken for Python 3.11 (#185)

This commit is contained in:
Steven Silvester 2022-10-25 15:45:23 -05:00 committed by GitHub
parent fb8ea5822f
commit 32bcfe713f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 77 additions and 41 deletions

View File

@ -819,6 +819,10 @@ axes:
variables:
TOX_ENV: "tornado6-py39"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "tornado6-py310"
variables:
TOX_ENV: "tornado6-py310"
PYTHON_BINARY: "/opt/python/3.10/bin/python3"
- id: "tornado_git-py37"
variables:
TOX_ENV: "tornado_git-py37"
@ -843,6 +847,10 @@ axes:
variables:
TOX_ENV: "asyncio-py39"
PYTHON_BINARY: "/opt/python/3.9/bin/python3"
- id: "asyncio-py310"
variables:
TOX_ENV: "asyncio-py310"
PYTHON_BINARY: "/opt/python/3.10/bin/python3"
- id: "py3-pymongo-latest"
variables:
TOX_ENV: "py3-pymongo-latest"
@ -855,14 +863,14 @@ axes:
- id: tox-env-ubuntu
display_name: "Tox Env Ubuntu"
values:
- id: "tornado6-py310"
- id: "tornado6-py311"
variables:
TOX_ENV: "tornado6-py310"
PYTHON_BINARY: "/opt/python/3.10/bin/python3"
- id: "asyncio-py310"
TOX_ENV: "tornado6-py311"
PYTHON_BINARY: "/opt/python/3.11/bin/python3"
- id: "asyncio-py311"
variables:
TOX_ENV: "asyncio-py310"
PYTHON_BINARY: "/opt/python/3.10/bin/python3"
TOX_ENV: "asyncio-py311"
PYTHON_BINARY: "/opt/python/3.11/bin/python3"
# Test Python 3.8 only on Mac.
- id: tox-env-osx

View File

@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.10"]
python-version: ["3.7", "3.11"]
fail-fast: false
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:

View File

@ -3,6 +3,13 @@ Changelog
.. currentmodule:: motor.motor_tornado
Motor 3.1.1
-----------
Motor 3.1.1 adds support for Python 3.11 and fixes a bug that caused an
``ImportError`` in Python 3.11.0.
Motor 3.1
---------

View File

@ -84,6 +84,6 @@ See also:
* The `Topology Monitoring`_ Spec
* The `monitoring_example.py`_ example file in the Motor repository
.. _Command Monitoring: https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst
.. _Command Monitoring: https://github.com/mongodb/specifications/blob/master/source/command-logging-and-monitoring/command-logging-and-monitoring.rst
.. _Topology Monitoring: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring-monitoring.rst
.. _monitoring_example.py: https://github.com/mongodb/motor/blob/master/doc/examples/monitoring_example.py

View File

@ -4,7 +4,7 @@ Requirements
The current version of Motor requires:
* CPython 3.7 and later.
* PyMongo_ 4.1 and later.
* PyMongo_ 4.2 and later.
Motor can integrate with either Tornado or asyncio.
@ -49,6 +49,8 @@ Motor and PyMongo
+-------------------+-----------------+
| 3.0 | 4.1+ |
+-------------------+-----------------+
| 3.1 | 4.2+ |
+-------------------+-----------------+
Motor and MongoDB
`````````````````
@ -80,6 +82,8 @@ Motor and MongoDB
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.0 |**N**|**N**|**N**|**N**|**N**|**N**| Y | Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| | 3.1 |**N**|**N**|**N**|**N**|**N**|**N**| 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.
@ -118,6 +122,8 @@ known to be incompatible, or have not been tested together.
+---------------+-----+-----+-----+-----+-----+
| | 3.0 |**N**|**N**|**N**| Y |
+---------------+-----+-----+-----+-----+-----+
| | 3.1 |**N**|**N**|**N**| Y |
+---------------+-----+-----+-----+-----+-----+
Motor and Python
````````````````
@ -135,33 +141,37 @@ Motor 2.5 deprecated support for Python 3.5.
Motor 3.0 dropped support for Pythons older than 3.7.
+-------------------------------------------------------------------------------------+
| Python Version |
+=====================+=====+=====+=====+=======+=======+=====+=====+=====+=====+=====+
| | 2.7 | 3.3 | 3.4 | 3.5.0 | 3.5.2 | 3.6 | 3.7 | 3.8 | 3.9 | 3.10|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| Motor Version | 1.0 | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 1.1 | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 1.2 | Y |**N**| Y |**N** | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 1.3 | Y |**N**| Y |**N** | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 2.0 | Y |**N**| Y |**N** | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 2.1 | Y |**N**| Y |**N** | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 2.2 |**N**|**N**|**N**|**N** | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 2.3 |**N**|**N**|**N**|**N** | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 2.4 |**N**|**N**|**N**|**N** | Y | Y | Y | Y | Y |**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 2.5 |**N**|**N**|**N**|**N** | Y | Y | Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
| | 3.0 |**N**|**N**|**N**|**N** |**N** |**N**| Y | Y | Y | Y |
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+
Motor 3.1.1 added support for Python 3.11.
+-------------------------------------------------------------------------------------------+
| Python Version |
+=====================+=====+=====+=====+=======+=======+=====+=====+=====+=====+=====+=====+
| | 2.7 | 3.3 | 3.4 | 3.5.0 | 3.5.2 | 3.6 | 3.7 | 3.8 | 3.9 | 3.10| 3.11|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| Motor Version | 1.0 | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 1.1 | Y | Y | Y | Y | Y | Y |**N**|**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 1.2 | Y |**N**| Y |**N** | Y | Y | Y |**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 1.3 | Y |**N**| Y |**N** | Y | Y | Y |**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 2.0 | Y |**N**| Y |**N** | Y | Y | Y |**N**|**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 2.1 | Y |**N**| Y |**N** | Y | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 2.2 |**N**|**N**|**N**|**N** | Y | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 2.3 |**N**|**N**|**N**|**N** | Y | Y | Y | Y |**N**|**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 2.4 |**N**|**N**|**N**|**N** | Y | Y | Y | Y | Y |**N**|**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 2.5 |**N**|**N**|**N**|**N** | Y | Y | Y | Y | Y | Y |**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 3.0 |**N**|**N**|**N**|**N** |**N** |**N**| Y | Y | Y | Y |**N**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
| | 3.1 |**N**|**N**|**N**|**N** |**N** |**N**| Y | Y | Y | Y |**Y**|
+---------------+-----+-----+-----+-----+-------+-------+-----+-----+-----+-----+-----+-----+
Not Supported
-------------

View File

@ -24,7 +24,7 @@ import functools
import multiprocessing
import os
import warnings
from asyncio import coroutine, get_event_loop # noqa: F401 - For framework interface.
from asyncio import get_event_loop # noqa: F401 - For framework interface.
from concurrent.futures import ThreadPoolExecutor
try:
@ -32,6 +32,15 @@ try:
except ImportError:
contextvars = None
try:
from asyncio import coroutine
except ImportError:
def coroutine():
raise RuntimeError(
"The coroutine decorator was removed in Python 3.11. Use 'async def' instead"
)
CLASS_PREFIX = "AsyncIO"

View File

@ -23,6 +23,7 @@ Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Operating System :: MacOS :: MacOS X
Operating System :: Unix
Operating System :: Microsoft :: Windows

View File

@ -9,7 +9,7 @@ envlist =
tornado5-{py37},
# Tornado 6 supports Python 3.5+.
tornado6-{pypy37,py37,py38,py39,py310},
tornado6-{pypy37,py37,py38,py39,py310,py311},
# Test Tornado's dev version in a few configurations.
tornado_git-{py37,py38},
@ -21,7 +21,7 @@ envlist =
py3-sphinx-doctest,
# asyncio without Tornado.
asyncio-{py37,py38,py39,py310},
asyncio-{py37,py38,py39,py310,py311},
# Test with the latest PyMongo.
py3-pymongo-latest,
@ -57,6 +57,7 @@ basepython =
py38: {env:PYTHON_BINARY:python3.8}
py39: {env:PYTHON_BINARY:python3.9}
py310: {env:PYTHON_BINARY:python3.10}
py311: {env:PYTHON_BINARY:python3.11}
pypy37: {env:PYTHON_BINARY:pypy3}
# Default Python 3 when we don't care about minor version.
@ -67,7 +68,7 @@ deps =
tornado6: tornado>=6,<7
tornado_git: git+https://github.com/tornadoweb/tornado.git
{py37,py38,py39,py310}: aiohttp
{py37,py38,py39,py310,py311}: aiohttp
sphinx: sphinx
sphinx: aiohttp
@ -138,7 +139,7 @@ commands =
# Map GitHub Actions python-version to environment using tox-github-actions.
python =
3.7: py37
3.10: py310,manifest
3.11: py311,manifest
[flake8]
max-line-length = 100