Skip to content

Commit 42f4503

Browse files
authored
PYTHON-4372 & PYTHON-4378 Deprecate Python 3.7 and Update supported PyPy Versions to 3.9 and 3.10 (mongodb#1630)
1 parent 3ff1e84 commit 42f4503

17 files changed

+64
-74
lines changed

.evergreen/build-manylinux-internal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mv dist/* validdist || true
1111

1212
# Compile wheels
1313
for PYTHON in /opt/python/*/bin/python; do
14-
if [[ ! $PYTHON =~ (cp37|cp38|cp39|cp310|cp311|cp312) ]]; then
14+
if [[ ! $PYTHON =~ (cp38|cp39|cp310|cp311|cp312) ]]; then
1515
continue
1616
fi
1717
# https://github.com/pypa/manylinux/issues/49

.evergreen/build-manylinux.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ ls dist
3939

4040
# Check for any unexpected files.
4141
unexpected=$(find dist \! \( -iname dist -or \
42-
-iname '*cp37*' -or \
4342
-iname '*cp38*' -or \
4443
-iname '*cp39*' -or \
4544
-iname '*cp310*' -or \

.evergreen/build-windows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ rm -rf validdist
88
mkdir -p validdist
99
mv dist/* validdist || true
1010

11-
for VERSION in 37 38 39 310 311 312; do
11+
for VERSION in 38 39 310 311 312; do
1212
_pythons=("C:/Python/Python${VERSION}/python.exe" \
1313
"C:/Python/32/Python${VERSION}/python.exe")
1414
for PYTHON in "${_pythons[@]}"; do

.evergreen/combine-coverage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ if [ -z "$PYTHON_BINARY" ]; then
1313
fi
1414

1515
createvirtualenv "$PYTHON_BINARY" covenv
16-
# coverage 7.3 dropped support for Python 3.7, keep in sync with run-tests.sh
16+
# Keep in sync with run-tests.sh
1717
# coverage >=5 is needed for relative_files=true.
18-
pip install -q "coverage>=5,<7.3"
18+
pip install -q "coverage>=5,<=7.5"
1919

2020
pip list
2121
ls -la coverage/

.evergreen/config.yml

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,8 @@ functions:
834834
done
835835
# Build source distribution.
836836
cd src/
837-
/opt/python/3.7/bin/python3 -m pip install build
838-
/opt/python/3.7/bin/python3 -m build --sdist .
837+
/opt/python/3.8/bin/python3 -m pip install build
838+
/opt/python/3.8/bin/python3 -m build --sdist .
839839
cp dist/* ../releases
840840
- command: archive.targz_pack
841841
params:
@@ -1127,7 +1127,7 @@ tasks:
11271127
commands:
11281128
- func: "build release"
11291129
vars:
1130-
VERSION: "3.7"
1130+
VERSION: "3.8"
11311131
- func: "upload release"
11321132

11331133
- name: "release-windows"
@@ -2375,10 +2375,6 @@ axes:
23752375
values:
23762376
# Note: always display platform with python-version to avoid ambiguous display names.
23772377
# Linux
2378-
- id: "3.7"
2379-
display_name: "Python 3.7"
2380-
variables:
2381-
PYTHON_BINARY: "/opt/python/3.7/bin/python3"
23822378
- id: "3.8"
23832379
display_name: "Python 3.8"
23842380
variables:
@@ -2399,10 +2395,10 @@ axes:
23992395
display_name: "Python 3.12"
24002396
variables:
24012397
PYTHON_BINARY: "/opt/python/3.12/bin/python3"
2402-
- id: "pypy3.8"
2403-
display_name: "PyPy 3.8"
2398+
- id: "pypy3.9"
2399+
display_name: "PyPy 3.9"
24042400
variables:
2405-
PYTHON_BINARY: "/opt/python/pypy3.8/bin/pypy3"
2401+
PYTHON_BINARY: "/opt/python/pypy3.9/bin/pypy3"
24062402
- id: "pypy3.10"
24072403
display_name: "PyPy 3.10"
24082404
variables:
@@ -2411,10 +2407,6 @@ axes:
24112407
- id: python-version-windows
24122408
display_name: "Python"
24132409
values:
2414-
- id: "3.7"
2415-
display_name: "Python 3.7"
2416-
variables:
2417-
PYTHON_BINARY: "C:/python/Python37/python.exe"
24182410
- id: "3.8"
24192411
display_name: "Python 3.8"
24202412
variables:
@@ -2439,10 +2431,6 @@ axes:
24392431
- id: python-version-windows-32
24402432
display_name: "Python"
24412433
values:
2442-
- id: "3.7"
2443-
display_name: "32-bit Python 3.7"
2444-
variables:
2445-
PYTHON_BINARY: "C:/python/32/Python37/python.exe"
24462434
- id: "3.8"
24472435
display_name: "32-bit Python 3.8"
24482436
variables:
@@ -2730,10 +2718,10 @@ buildvariants:
27302718
auth: "*"
27312719
ssl: "ssl"
27322720
pyopenssl: "*"
2733-
# Only test "noauth" with Python 3.7.
2721+
# Only test "noauth" with Python 3.8.
27342722
exclude_spec:
27352723
platform: rhel8
2736-
python-version: ["3.8", "3.9", "3.10", "pypy3.8", "pypy3.10"]
2724+
python-version: ["3.9", "3.10", "pypy3.9", "pypy3.10"]
27372725
auth: "noauth"
27382726
ssl: "ssl"
27392727
pyopenssl: "*"
@@ -2794,7 +2782,7 @@ buildvariants:
27942782
exclude_spec:
27952783
# These interpreters are always tested without extensions.
27962784
- platform: rhel8
2797-
python-version: ["pypy3.8", "pypy3.10"]
2785+
python-version: ["pypy3.9", "pypy3.10"]
27982786
c-extensions: "*"
27992787
auth-ssl: "*"
28002788
coverage: "*"
@@ -2810,7 +2798,7 @@ buildvariants:
28102798
exclude_spec:
28112799
# These interpreters are always tested without extensions.
28122800
- platform: rhel8
2813-
python-version: ["pypy3.8", "pypy3.10"]
2801+
python-version: ["pypy3.9", "pypy3.10"]
28142802
c-extensions: "with-c-extensions"
28152803
compression: "*"
28162804
display_name: "${compression} ${c-extensions} ${python-version} ${platform}"
@@ -2839,7 +2827,7 @@ buildvariants:
28392827
exclude_spec:
28402828
# Don't test green frameworks on these Python versions.
28412829
- platform: rhel8
2842-
python-version: ["pypy3.8", "pypy3.10"]
2830+
python-version: ["pypy3.9", "pypy3.10"]
28432831
green-framework: "*"
28442832
auth-ssl: "*"
28452833
display_name: "${green-framework} ${python-version} ${platform} ${auth-ssl}"
@@ -2865,7 +2853,7 @@ buildvariants:
28652853
matrix_spec:
28662854
platform: rhel7
28672855
# Python 3.10+ requires OpenSSL 1.1.1+
2868-
python-version: ["3.7", "3.8", "3.9", "pypy3.8", "pypy3.10"]
2856+
python-version: ["3.8", "3.9", "pypy3.9", "pypy3.10"]
28692857
auth-ssl: "*"
28702858
display_name: "OpenSSL 1.0.2 ${python-version} ${platform} ${auth-ssl}"
28712859
tasks:
@@ -2888,12 +2876,12 @@ buildvariants:
28882876
then:
28892877
add_tasks: *encryption-server-versions
28902878

2891-
# Storage engine tests on RHEL 8.4 (x86_64) with Python 3.7.
2879+
# Storage engine tests on RHEL 8.4 (x86_64) with Python 3.8.
28922880
- matrix_name: "tests-storage-engines"
28932881
matrix_spec:
28942882
platform: rhel8
28952883
storage-engine: "*"
2896-
python-version: 3.7
2884+
python-version: 3.8
28972885
display_name: "Storage ${storage-engine} ${python-version} ${platform}"
28982886
rules:
28992887
- if:
@@ -2923,12 +2911,12 @@ buildvariants:
29232911
- "test-3.6-standalone"
29242912
- "test-3.6-replica_set"
29252913

2926-
# enableTestCommands=0 tests on RHEL 8.4 (x86_64) with Python 3.7.
2914+
# enableTestCommands=0 tests on RHEL 8.4 (x86_64) with Python 3.8.
29272915
- matrix_name: "test-disableTestCommands"
29282916
matrix_spec:
29292917
platform: rhel8
29302918
disableTestCommands: "*"
2931-
python-version: "3.7"
2919+
python-version: "3.8"
29322920
display_name: "Disable test commands ${python-version} ${platform}"
29332921
tasks:
29342922
- ".latest"
@@ -2962,7 +2950,7 @@ buildvariants:
29622950
- matrix_name: "tests-mod-wsgi"
29632951
matrix_spec:
29642952
platform: ubuntu-22.04
2965-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2953+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
29662954
mod-wsgi-version: "*"
29672955
display_name: "${mod-wsgi-version} ${python-version} ${platform}"
29682956
tasks:
@@ -2974,7 +2962,7 @@ buildvariants:
29742962
- matrix_name: "mockupdb-tests"
29752963
matrix_spec:
29762964
platform: rhel8
2977-
python-version: 3.7
2965+
python-version: 3.8
29782966
display_name: "MockupDB Tests"
29792967
tasks:
29802968
- name: "mockupdb"
@@ -3022,7 +3010,7 @@ buildvariants:
30223010
- matrix_name: "serverless_proxy"
30233011
matrix_spec:
30243012
platform: rhel8
3025-
python-version: ["3.7", "3.10"]
3013+
python-version: ["3.8", "3.10"]
30263014
auth-ssl: auth-ssl
30273015
serverless: "proxy"
30283016
display_name: "${serverless} ${python-version} ${platform}"
@@ -3032,7 +3020,7 @@ buildvariants:
30323020
- matrix_name: "data-lake-spec-tests"
30333021
matrix_spec:
30343022
platform: ubuntu-22.04
3035-
python-version: ["3.7", "3.10"]
3023+
python-version: ["3.8", "3.10"]
30363024
auth: "auth"
30373025
c-extensions: "*"
30383026
display_name: "Atlas Data Lake ${python-version} ${c-extensions}"
@@ -3042,7 +3030,7 @@ buildvariants:
30423030
- matrix_name: "stable-api-tests"
30433031
matrix_spec:
30443032
platform: rhel8
3045-
python-version: ["3.7", "3.10"]
3033+
python-version: ["3.8", "3.10"]
30463034
auth: "auth"
30473035
versionedApi: "*"
30483036
display_name: "Versioned API ${versionedApi} ${python-version}"
@@ -3055,7 +3043,7 @@ buildvariants:
30553043
- matrix_name: "ocsp-test"
30563044
matrix_spec:
30573045
platform: rhel8
3058-
python-version: ["3.7", "3.10", "pypy3.8", "pypy3.10"]
3046+
python-version: ["3.8", "3.10", "pypy3.9", "pypy3.10"]
30593047
mongodb-version: ["4.4", "5.0", "6.0", "7.0", "8.0", "latest"]
30603048
auth: "noauth"
30613049
ssl: "ssl"
@@ -3067,7 +3055,7 @@ buildvariants:
30673055
- matrix_name: "ocsp-test-windows"
30683056
matrix_spec:
30693057
platform: windows-64-vsMulti-small
3070-
python-version-windows: ["3.7", "3.10"]
3058+
python-version-windows: ["3.8", "3.10"]
30713059
mongodb-version: ["4.4", "5.0", "6.0", "7.0", "8.0", "latest"]
30723060
auth: "noauth"
30733061
ssl: "ssl"

.evergreen/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ python -c 'import sys; print(sys.version)'
247247
# Only cover CPython. PyPy reports suspiciously low coverage.
248248
PYTHON_IMPL=$($PYTHON -c "import platform; print(platform.python_implementation())")
249249
if [ -n "$COVERAGE" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
250-
# coverage 7.3 dropped support for Python 3.7, keep in sync with combine-coverage.sh.
250+
# Keep in sync with combine-coverage.sh.
251251
# coverage >=5 is needed for relative_files=true.
252-
python -m pip install pytest-cov "coverage>=5,<7.3"
252+
python -m pip install pytest-cov "coverage>=5,<=7.5"
253253
TEST_ARGS="$TEST_ARGS --cov"
254254
fi
255255

.evergreen/utils.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -o xtrace
44

55
find_python3() {
66
PYTHON=""
7-
# Add a fallback system python3 if it is available and Python 3.7+.
8-
if is_python_37 "$(command -v python3)"; then
7+
# Add a fallback system python3 if it is available and Python 3.8+.
8+
if is_python_38 "$(command -v python3)"; then
99
PYTHON="$(command -v python3)"
1010
fi
1111
# Find a suitable toolchain version, if available.
@@ -14,23 +14,23 @@ find_python3() {
1414
if [ -d "/Library/Frameworks/Python.Framework/Versions/3.10" ]; then
1515
PYTHON="/Library/Frameworks/Python.Framework/Versions/3.10/bin/python3"
1616
# macos 10.14
17-
elif [ -d "/Library/Frameworks/Python.Framework/Versions/3.7" ]; then
18-
PYTHON="/Library/Frameworks/Python.Framework/Versions/3.7/bin/python3"
17+
elif [ -d "/Library/Frameworks/Python.Framework/Versions/3.8" ]; then
18+
PYTHON="/Library/Frameworks/Python.Framework/Versions/3.8/bin/python3"
1919
fi
2020
elif [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
21-
PYTHON="C:/python/Python37/python.exe"
21+
PYTHON="C:/python/Python38/python.exe"
2222
else
23-
# Prefer our own toolchain, fall back to mongodb toolchain if it has Python 3.7+.
24-
if [ -f "/opt/python/3.7/bin/python3" ]; then
25-
PYTHON="/opt/python/3.7/bin/python3"
26-
elif is_python_37 "$(command -v /opt/mongodbtoolchain/v4/bin/python3)"; then
23+
# Prefer our own toolchain, fall back to mongodb toolchain if it has Python 3.8+.
24+
if [ -f "/opt/python/3.8/bin/python3" ]; then
25+
PYTHON="/opt/python/3.8/bin/python3"
26+
elif is_python_38 "$(command -v /opt/mongodbtoolchain/v4/bin/python3)"; then
2727
PYTHON="/opt/mongodbtoolchain/v4/bin/python3"
28-
elif is_python_37 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then
28+
elif is_python_38 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then
2929
PYTHON="/opt/mongodbtoolchain/v3/bin/python3"
3030
fi
3131
fi
3232
if [ -z "$PYTHON" ]; then
33-
echo "Cannot test without python3.7+ installed!"
33+
echo "Cannot test without python3.8+ installed!"
3434
exit 1
3535
fi
3636
echo "$PYTHON"
@@ -96,15 +96,15 @@ testinstall () {
9696
fi
9797
}
9898

99-
# Function that returns success if the provided Python binary is version 3.7 or later
99+
# Function that returns success if the provided Python binary is version 3.8 or later
100100
# Usage:
101-
# is_python_37 /path/to/python
101+
# is_python_38 /path/to/python
102102
# * param1: Python binary
103-
is_python_37() {
103+
is_python_38() {
104104
if [ -z "$1" ]; then
105105
return 1
106-
elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 7))"; then
107-
# runs when sys.version_info[:2] >= (3, 7)
106+
elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 8))"; then
107+
# runs when sys.version_info[:2] >= (3, 8)
108108
return 0
109109
else
110110
return 1

.github/workflows/release-python.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,12 @@ jobs:
7373
env:
7474
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
7575
CIBW_MANYLINUX_I686_IMAGE: manylinux1
76-
CIBW_BUILD: "cp37-${{ matrix.buildplat[1] }} cp38-${{ matrix.buildplat[1] }} cp39-${{ matrix.buildplat[1] }}"
76+
CIBW_BUILD: "cp38-${{ matrix.buildplat[1] }} cp39-${{ matrix.buildplat[1] }}"
7777
run: python -m cibuildwheel --output-dir wheelhouse
7878

7979
- name: Assert all versions in wheelhouse
8080
if: ${{ ! startsWith(matrix.buildplat[1], 'macos') }}
8181
run: |
82-
ls wheelhouse/*cp37*.whl
8382
ls wheelhouse/*cp38*.whl
8483
ls wheelhouse/*cp39*.whl
8584
ls wheelhouse/*cp310*.whl
@@ -103,7 +102,7 @@ jobs:
103102
- uses: actions/setup-python@v5
104103
with:
105104
# Build sdist on lowest supported Python
106-
python-version: '3.7'
105+
python-version: '3.8'
107106

108107
- name: Build SDist
109108
run: |

.github/workflows/test-python.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
matrix:
5555
os: [ubuntu-20.04]
56-
python-version: ["3.7", "3.11", "pypy-3.8"]
56+
python-version: ["3.8", "3.11", "pypy-3.9"]
5757
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
5858
steps:
5959
- uses: actions/checkout@v4
@@ -137,7 +137,7 @@ jobs:
137137
runs-on: ubuntu-latest
138138
strategy:
139139
matrix:
140-
python: ["3.7", "3.11"]
140+
python: ["3.8", "3.11"]
141141
steps:
142142
- uses: actions/checkout@v4
143143
- uses: actions/setup-python@v5
@@ -162,7 +162,7 @@ jobs:
162162
cache: 'pip'
163163
cache-dependency-path: 'pyproject.toml'
164164
# Build sdist on lowest supported Python
165-
python-version: '3.7'
165+
python-version: '3.8'
166166
- name: Build SDist
167167
shell: bash
168168
run: |
@@ -194,7 +194,7 @@ jobs:
194194
cache: 'pip'
195195
cache-dependency-path: 'sdist/test/pyproject.toml'
196196
# Test sdist on lowest supported Python
197-
python-version: '3.7'
197+
python-version: '3.8'
198198
- name: Start MongoDB
199199
uses: supercharge/[email protected]
200200
- name: Run Test

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ be of interest or that has already been addressed.
1616

1717
## Supported Interpreters
1818

19-
PyMongo supports CPython 3.7+ and PyPy3.8+. Language features not
19+
PyMongo supports CPython 3.8+ and PyPy3.9+. Language features not
2020
supported by all interpreters can not be used.
2121

2222
## Style Guide

0 commit comments

Comments
 (0)