From 913860334ecdf0160514b9c2723fac3024391f3e Mon Sep 17 00:00:00 2001 From: Bernie Hackett Date: Wed, 3 Feb 2021 13:55:59 -0800 Subject: [PATCH] PYTHON-2386 Drop support for Python 3.5 --- .evergreen/build-mac.sh | 2 +- .evergreen/build-manylinux-internal.sh | 2 +- .evergreen/build-manylinux.sh | 1 - .evergreen/build-windows.sh | 2 +- .evergreen/config.yml | 49 +++++++++----------------- .evergreen/utils.sh | 10 +----- .travis.yml | 2 -- CONTRIBUTING.rst | 2 +- README.rst | 2 +- doc/faq.rst | 2 +- doc/installation.rst | 4 +-- doc/python3.rst | 2 +- pymongo/ssl_context.py | 3 -- setup.py | 7 ++-- test/test_encryption.py | 5 --- 15 files changed, 29 insertions(+), 66 deletions(-) diff --git a/.evergreen/build-mac.sh b/.evergreen/build-mac.sh index fd6d571ef..f8f40e263 100755 --- a/.evergreen/build-mac.sh +++ b/.evergreen/build-mac.sh @@ -8,7 +8,7 @@ rm -rf validdist mkdir -p validdist mv dist/* validdist || true -for VERSION in 3.5 3.6 3.7 3.8 3.9; do +for VERSION in 3.6 3.7 3.8 3.9; do PYTHON=/Library/Frameworks/Python.framework/Versions/$VERSION/bin/python3 rm -rf build diff --git a/.evergreen/build-manylinux-internal.sh b/.evergreen/build-manylinux-internal.sh index dda1089f0..2a1f16948 100755 --- a/.evergreen/build-manylinux-internal.sh +++ b/.evergreen/build-manylinux-internal.sh @@ -11,7 +11,7 @@ mv dist/* validdist || true # Compile wheels for PYTHON in /opt/python/*/bin/python; do - if [[ ! $PYTHON =~ (cp35|cp36|cp37|cp38|cp39) ]]; then + if [[ ! $PYTHON =~ (cp36|cp37|cp38|cp39) ]]; then continue fi # https://github.com/pypa/manylinux/issues/49 diff --git a/.evergreen/build-manylinux.sh b/.evergreen/build-manylinux.sh index aa81a87a0..a100a6fc8 100755 --- a/.evergreen/build-manylinux.sh +++ b/.evergreen/build-manylinux.sh @@ -19,7 +19,6 @@ ls dist # Check for any unexpected files. unexpected=$(find dist \! \( -iname dist -or \ - -iname '*cp35*' -or \ -iname '*cp36*' -or \ -iname '*cp37*' -or \ -iname '*cp38*' -or \ diff --git a/.evergreen/build-windows.sh b/.evergreen/build-windows.sh index ca1c198ba..f44cff18a 100755 --- a/.evergreen/build-windows.sh +++ b/.evergreen/build-windows.sh @@ -8,7 +8,7 @@ rm -rf validdist mkdir -p validdist mv dist/* validdist || true -for VERSION in 35 36 37 38 39; do +for VERSION in 36 37 38 39; do _pythons=(C:/Python/Python${VERSION}/python.exe \ C:/Python/32/Python${VERSION}/python.exe) for PYTHON in "${_pythons[@]}"; do diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 2dcc66bcd..23445d75e 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1762,11 +1762,6 @@ axes: values: # Note: always display platform with python-version to avoid ambiguous display names. # Linux - - id: "3.5" - display_name: "Python 3.5" - batchtime: 10080 # 7 days - variables: - PYTHON_BINARY: "/opt/python/3.5/bin/python3" - id: "3.6" display_name: "Python 3.6" variables: @@ -1783,10 +1778,6 @@ axes: display_name: "Python 3.9" variables: PYTHON_BINARY: "/opt/python/3.9/bin/python3" - - id: "pypy3.5" - display_name: "PyPy 3.5" - variables: - PYTHON_BINARY: "/opt/python/pypy3.5/bin/pypy3" - id: "pypy3.6" display_name: "PyPy 3.6" variables: @@ -1799,10 +1790,6 @@ axes: - id: python-version-windows display_name: "Python" values: - - id: "3.5" - display_name: "Python 3.5" - variables: - PYTHON_BINARY: "C:/python/Python35/python.exe" - id: "3.6" display_name: "Python 3.6" variables: @@ -1823,10 +1810,6 @@ axes: - id: python-version-windows-32 display_name: "Python" values: - - id: "3.5" - display_name: "32-bit Python 3.5" - variables: - PYTHON_BINARY: "C:/python/32/Python35/python.exe" - id: "3.6" display_name: "32-bit Python 3.6" variables: @@ -2116,7 +2099,7 @@ buildvariants: matrix_spec: platform: rhel62 # RHEL 6.2 does not support Python 3.7.x and later. - python-version: &rhel62-pythons ["3.5", "3.6", "pypy3.5", "pypy3.6"] + python-version: &rhel62-pythons ["3.6", "pypy3.6"] auth: "*" ssl: "*" coverage: "*" @@ -2132,14 +2115,14 @@ buildvariants: - matrix_name: "tests-pyopenssl" matrix_spec: platform: ubuntu-16.04 - python-version: ["3.5", "3.6", "3.7", "3.8", "3.9"] + python-version: ["3.6", "3.7", "3.8", "3.9"] auth: "*" ssl: "ssl" pyopenssl: "*" # Only test "noauth" with Python 3.7. exclude_spec: platform: ubuntu-16.04 - python-version: ["3.5", "3.6", "3.8", "3.9"] + python-version: ["3.6", "3.8", "3.9"] auth: "noauth" ssl: "ssl" pyopenssl: "*" @@ -2152,7 +2135,7 @@ buildvariants: - matrix_name: "tests-pyopenssl-pypy" matrix_spec: platform: debian92 - python-version: ["pypy3.5", "pypy3.6"] + python-version: ["pypy3.6"] auth: "auth" ssl: "ssl" pyopenssl: "*" @@ -2187,7 +2170,7 @@ buildvariants: matrix_spec: platform: rhel62 # RHEL 6.2 does not support Python 3.7.x and later. - python-version: ["3.5", "3.6"] + python-version: ["3.6"] auth-ssl: noauth-nossl # TODO: dependency error for 'coverage-report' task: # dependency tests-python-version-rhel62-test-encryption_.../test-2.6-standalone is not present in the project config @@ -2199,7 +2182,7 @@ buildvariants: - matrix_name: "tests-pypy-debian-test-encryption" matrix_spec: platform: debian92 - python-version: ["pypy3.5", "pypy3.6"] + python-version: ["pypy3.6"] auth-ssl: noauth-nossl encryption: "*" display_name: "Encryption ${python-version} ${platform} ${auth-ssl}" @@ -2215,7 +2198,7 @@ buildvariants: exclude_spec: # These interpreters are always tested without extensions. - platform: rhel62 - python-version: ["pypy3.5", "pypy3.6"] + python-version: ["pypy3.6"] c-extensions: "*" auth-ssl: "*" coverage: "*" @@ -2242,13 +2225,13 @@ buildvariants: matrix_spec: # Ubuntu 16.04 images have libsnappy-dev installed, and provides OpenSSL 1.0.2 for testing Python 3.7 platform: ubuntu-16.04 - python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "pypy3.5", "pypy3.6"] + python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3.6"] c-extensions: "*" compression: "*" exclude_spec: # These interpreters are always tested without extensions. - platform: ubuntu-16.04 - python-version: ["pypy3.5", "pypy3.6"] + python-version: ["pypy3.6"] c-extensions: "with-c-extensions" compression: "*" # PYTHON-2365 Some tests fail with CPython 3.8+ and python-snappy @@ -2281,7 +2264,7 @@ buildvariants: exclude_spec: # Don't test green frameworks on these Python versions. - platform: rhel62 - python-version: ["pypy3.5", "pypy3.6"] + python-version: ["pypy3.6"] green-framework: "*" auth-ssl: "*" display_name: "${green-framework} ${python-version} ${platform} ${auth-ssl}" @@ -2420,7 +2403,7 @@ buildvariants: matrix_spec: platform: rhel62 # The toolchain doesn't currently include mod-wsgi - # built for CPython 3.5 or 3.8, mod-wsgi doesn't yet + # built for CPython 3.8, mod-wsgi doesn't yet # claim to support 3.9. Python 3.7+ won't build on rhel6 # and we need to do some work to migrate mod-wsgi testing # to a different OS. For now we're stuck just testing with @@ -2443,7 +2426,7 @@ buildvariants: - matrix_name: "tests-doctests" matrix_spec: platform: rhel62 - python-version: ["3.5"] + python-version: ["3.6"] display_name: "Doctests ${python-version} ${platform}" tasks: - name: "doctests" @@ -2485,7 +2468,7 @@ buildvariants: - matrix_name: "data-lake-spec-tests" matrix_spec: platform: ubuntu-16.04 - python-version: ["3.5", "3.9"] + python-version: ["3.6", "3.9"] auth: "auth" c-extensions: "*" display_name: "Atlas Data Lake ${python-version} ${c-extensions}" @@ -2507,7 +2490,7 @@ buildvariants: - matrix_name: "ocsp-test" matrix_spec: platform: ubuntu-16.04 - python-version: ["3.5", "3.8", "3.9"] + python-version: ["3.6", "3.9"] mongodb-version: ["4.4", "latest"] auth: "noauth" ssl: "ssl" @@ -2519,7 +2502,7 @@ buildvariants: - matrix_name: "ocsp-test-pypy" matrix_spec: platform: debian92 - python-version: ["pypy3.5", "pypy3.6"] + python-version: ["pypy3.6"] mongodb-version: ["4.4", "latest"] auth: "noauth" ssl: "ssl" @@ -2531,7 +2514,7 @@ buildvariants: - matrix_name: "ocsp-test-windows" matrix_spec: platform: windows-64-vsMulti-small - python-version-windows: ["3.5", "3.9"] + python-version-windows: ["3.6", "3.9"] mongodb-version: ["4.4", "latest"] auth: "noauth" ssl: "ssl" diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index 0d741fb59..d6b9ebecc 100755 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -22,15 +22,7 @@ createvirtualenv () { else . $VENVPATH/bin/activate fi - # Upgrade to the latest versions of pip setuptools wheel so that - # pip can always download the latest cryptography+cffi wheels. - PYTHON_VERSION=$(python -c 'import sys;print("%s.%s" % sys.version_info[:2])') - if [[ $PYTHON_VERSION == "3.5" ]]; then - # pip 21 will drop support for 3.5. - python -m pip install --upgrade 'pip<21' - else - python -m pip install --upgrade pip - fi + python -m pip install --upgrade pip python -m pip install --upgrade setuptools wheel } diff --git a/.travis.yml b/.travis.yml index b13397eac..5f5499235 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,9 @@ language: python python: - - 3.5 - 3.6 - 3.7 - 3.8 - - pypy3.5 services: - mongodb diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b9a9856e3..cf451172a 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -19,7 +19,7 @@ that might not be of interest or that has already been addressed. Supported Interpreters ---------------------- -PyMongo supports CPython 3.5+ and PyPy3.5+. Language +PyMongo supports CPython 3.6+ and PyPy3.6+. Language features not supported by all interpreters can not be used. Style Guide diff --git a/README.rst b/README.rst index 05008492c..5b25e69f1 100644 --- a/README.rst +++ b/README.rst @@ -89,7 +89,7 @@ is incompatible with PyMongo. Dependencies ============ -PyMongo supports CPython 3.5+ and PyPy3.5+. +PyMongo supports CPython 3.6+ and PyPy3.6+. Optional dependencies: diff --git a/doc/faq.rst b/doc/faq.rst index 5efb38079..c6e959b61 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -134,7 +134,7 @@ they are returned to the pool. Does PyMongo support Python 3? ------------------------------ -PyMongo supports CPython 3.5+ and PyPy3.5+. See the :doc:`python3` for details. +PyMongo supports CPython 3.6+ and PyPy3.6+. See the :doc:`python3` for details. Does PyMongo support asynchronous frameworks like Gevent, asyncio, Tornado, or Twisted? --------------------------------------------------------------------------------------- diff --git a/doc/installation.rst b/doc/installation.rst index aa17087b7..72e478cfc 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -28,7 +28,7 @@ To upgrade using pip:: Dependencies ------------ -PyMongo supports CPython 3.5+ and PyPy3.5+. +PyMongo supports CPython 3.6+ and PyPy3.6+. Optional dependencies: @@ -133,7 +133,7 @@ See `http://bugs.python.org/issue11623 `_ for a more detailed explanation. **Lion (10.7) and newer** - PyMongo's C extensions can be built against -versions of Python 3.5+ downloaded from python.org. In all cases Xcode must be +versions of Python 3.6+ downloaded from python.org. In all cases Xcode must be installed with 'UNIX Development Support'. **Xcode 5.1**: Starting with version 5.1 the version of clang that ships with diff --git a/doc/python3.rst b/doc/python3.rst index ce45ee499..e001c55c8 100644 --- a/doc/python3.rst +++ b/doc/python3.rst @@ -6,7 +6,7 @@ Python 3 FAQ What Python 3 versions are supported? ------------------------------------- -PyMongo supports CPython 3.5+ and PyPy3.5+. +PyMongo supports CPython 3.6+ and PyPy3.6+. Are there any PyMongo behavior changes with Python 3? ----------------------------------------------------- diff --git a/pymongo/ssl_context.py b/pymongo/ssl_context.py index 5bcbc5d9c..2f35676f8 100644 --- a/pymongo/ssl_context.py +++ b/pymongo/ssl_context.py @@ -38,7 +38,4 @@ if hasattr(_ssl, "VERIFY_CRL_CHECK_LEAF"): # making it the obvious version to start using SSLConext.check_hostname. # Python 3.6 might have been a good version, but it suffers # from https://bugs.python.org/issue32185. -# We'll use our bundled match_hostname for older Python -# versions, which also supports IP address matching -# with Python < 3.5. CHECK_HOSTNAME_SAFE = _sys.version_info[:2] >= (3, 7) diff --git a/setup.py b/setup.py index 6ff561a09..89abad91c 100755 --- a/setup.py +++ b/setup.py @@ -5,8 +5,8 @@ import sys import warnings -if sys.version_info[:2] < (3, 5): - raise RuntimeError("Python version >= 3.5 required.") +if sys.version_info[:2] < (3, 6): + raise RuntimeError("Python version >= 3.6 required.") # Hack to silence atexit traceback in some Python versions @@ -327,7 +327,7 @@ setup( keywords=["mongo", "mongodb", "pymongo", "gridfs", "bson"], install_requires=[], license="Apache License, Version 2.0", - python_requires=">=3.5", + python_requires=">=3.6", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -337,7 +337,6 @@ setup( "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", diff --git a/test/test_encryption.py b/test/test_encryption.py index 90da8b3dc..938628e8c 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -504,11 +504,6 @@ class TestSpec(SpecRunner): desc = test['description'].lower() if 'type=symbol' in desc: self.skipTest('PyMongo does not support the symbol type') - if desc == 'explain a find with deterministic encryption': - # PyPy and Python 3.6+ have ordered dict. - if sys.version_info[:2] < (3, 6) and 'PyPy' not in sys.version: - self.skipTest( - 'explain test does not work without ordered dict') def setup_scenario(self, scenario_def): """Override a test's setup."""