There are a few changes required to support Python 3.10:
The test/utils.py module is importing a few types that moved from the collections module to the collections.abc module back in Python 3.3. Those types no longer exist in collections. This problem only affects a small subset of our test suite. The driver itself is fine.
As of Python 3.10 distutils is deprecated, to be removed in Python 3.12. Our setup.py imports a host of features from distutils that will have to be replaced.
https://docs.python.org/3.10/whatsnew/3.10.html#distutils
https://www.python.org/dev/peps/pep-0632/
https://www.python.org/dev/peps/pep-0632/#migration-advice
https://setuptools.readthedocs.io/en/latest/deprecated/distutils-legacy.html
from distutils.cmd import Command from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsOptionError from distutils.errors import DistutilsPlatformError, DistutilsExecError from distutils.core import Extension
Can be replaced by:
from setuptools import Command from setuptools.command.build_ext import build_ext from setuptools.extension import Extension
Note that setuptools doesn't expose the the exception types from distutils.errors or provide a replacement. We'll just catch Exception instead. Catching the explicit distutils exceptions happened way back in the early histlry of PyMongo, but doesn't seem strictly necessary.
Finally, we need to add Python 3.10 to the test matrix.
- is related to
-
PYTHON-2974 Add Support for Python 3.10 to All Libraries
- Development Complete
-
PYTHON-2778 Test OCSP with Python 3.10
- Closed
-
PYTHON-2923 Add Python 3.10 to release tasks
- Closed