Skip to content

Commit 75685c0

Browse files
authored
PYTHON-3235 Drop support for Python 3.6 (#939)
1 parent 502effe commit 75685c0

23 files changed

+86
-116
lines changed

.evergreen/build-mac.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 3.6 3.7 3.8 3.9 3.10; do
11+
for VERSION in 3.7 3.8 3.9 3.10; do
1212
PYTHON=/Library/Frameworks/Python.framework/Versions/$VERSION/bin/python3
1313
rm -rf build
1414

.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 =~ (cp36|cp37|cp38|cp39|cp310) ]]; then
14+
if [[ ! $PYTHON =~ (cp37|cp38|cp39|cp310) ]]; 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
@@ -34,7 +34,6 @@ ls dist
3434

3535
# Check for any unexpected files.
3636
unexpected=$(find dist \! \( -iname dist -or \
37-
-iname '*cp36*' -or \
3837
-iname '*cp37*' -or \
3938
-iname '*cp38*' -or \
4039
-iname '*cp39*' -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 36 37 38 39 310; do
11+
for VERSION in 37 38 39 310; do
1212
_pythons=("C:/Python/Python${VERSION}/python.exe" \
1313
"C:/Python/32/Python${VERSION}/python.exe")
1414
for PYTHON in "${_pythons[@]}"; do

.evergreen/config.yml

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ functions:
135135
# Coverage combine merges (and removes) all the coverage files and
136136
# generates a new .coverage file in the current directory.
137137
ls -la coverage/
138-
/opt/python/3.6/bin/python3 -m coverage combine coverage/coverage.*
139-
/opt/python/3.6/bin/python3 -m coverage html -d htmlcov
138+
/opt/python/3.7/bin/python3 -m coverage combine coverage/coverage.*
139+
/opt/python/3.7/bin/python3 -m coverage html -d htmlcov
140140
# Upload the resulting html coverage report.
141141
- command: shell.exec
142142
params:
@@ -932,7 +932,7 @@ functions:
932932
done
933933
# Build source distribution.
934934
cd src/
935-
/opt/python/3.6/bin/python3 setup.py sdist
935+
/opt/python/3.7/bin/python3 setup.py sdist
936936
cp dist/* ../releases
937937
- command: archive.targz_pack
938938
params:
@@ -1324,7 +1324,7 @@ tasks:
13241324
commands:
13251325
- func: "run tests"
13261326
vars:
1327-
PYTHON_BINARY: /opt/python/3.6/bin/python3
1327+
PYTHON_BINARY: /opt/python/3.7/bin/python3
13281328

13291329
- name: "atlas-connect"
13301330
tags: ["atlas-connect"]
@@ -1945,10 +1945,6 @@ axes:
19451945
values:
19461946
# Note: always display platform with python-version to avoid ambiguous display names.
19471947
# Linux
1948-
- id: "3.6"
1949-
display_name: "Python 3.6"
1950-
variables:
1951-
PYTHON_BINARY: "/opt/python/3.6/bin/python3"
19521948
- id: "3.7"
19531949
display_name: "Python 3.7"
19541950
variables:
@@ -1965,10 +1961,6 @@ axes:
19651961
display_name: "Python 3.10"
19661962
variables:
19671963
PYTHON_BINARY: "/opt/python/3.10/bin/python3"
1968-
- id: "pypy3.6"
1969-
display_name: "PyPy 3.6"
1970-
variables:
1971-
PYTHON_BINARY: "/opt/python/pypy3.6/bin/pypy3"
19721964
- id: "pypy3.7"
19731965
display_name: "PyPy 3.7"
19741966
variables:
@@ -1977,6 +1969,10 @@ axes:
19771969
display_name: "PyPy 3.8"
19781970
variables:
19791971
PYTHON_BINARY: "/opt/python/pypy3.8/bin/pypy3"
1972+
1973+
- id: python-version-mac
1974+
display_name: "Python"
1975+
values:
19801976
- id: "system-python3"
19811977
display_name: "Python3"
19821978
variables:
@@ -1985,10 +1981,6 @@ axes:
19851981
- id: python-version-windows
19861982
display_name: "Python"
19871983
values:
1988-
- id: "3.6"
1989-
display_name: "Python 3.6"
1990-
variables:
1991-
PYTHON_BINARY: "C:/python/Python36/python.exe"
19921984
- id: "3.7"
19931985
display_name: "Python 3.7"
19941986
variables:
@@ -2009,10 +2001,6 @@ axes:
20092001
- id: python-version-windows-32
20102002
display_name: "Python"
20112003
values:
2012-
- id: "3.6"
2013-
display_name: "32-bit Python 3.6"
2014-
variables:
2015-
PYTHON_BINARY: "C:/python/32/Python36/python.exe"
20162004
- id: "3.7"
20172005
display_name: "32-bit Python 3.7"
20182006
variables:
@@ -2281,7 +2269,7 @@ buildvariants:
22812269
# Only test "noauth" with Python 3.7.
22822270
exclude_spec:
22832271
platform: ubuntu-18.04
2284-
python-version: ["3.6", "3.8", "3.9", "3.10", "pypy3.6", "pypy3.7", "pypy3.8"]
2272+
python-version: ["3.8", "3.9", "3.10", "pypy3.7", "pypy3.8"]
22852273
auth: "noauth"
22862274
ssl: "ssl"
22872275
pyopenssl: "*"
@@ -2334,7 +2322,7 @@ buildvariants:
23342322
exclude_spec:
23352323
# These interpreters are always tested without extensions.
23362324
- platform: ubuntu-18.04
2337-
python-version: ["pypy3.6", "pypy3.7", "pypy3.8"]
2325+
python-version: ["pypy3.7", "pypy3.8"]
23382326
c-extensions: "*"
23392327
auth-ssl: "*"
23402328
coverage: "*"
@@ -2350,7 +2338,7 @@ buildvariants:
23502338
exclude_spec:
23512339
# These interpreters are always tested without extensions.
23522340
- platform: ubuntu-18.04
2353-
python-version: ["pypy3.6", "pypy3.7", "pypy3.8"]
2341+
python-version: ["pypy3.7", "pypy3.8"]
23542342
c-extensions: "with-c-extensions"
23552343
compression: "*"
23562344
display_name: "${compression} ${c-extensions} ${python-version} ${platform}"
@@ -2379,7 +2367,7 @@ buildvariants:
23792367
exclude_spec:
23802368
# Don't test green frameworks on these Python versions.
23812369
- platform: ubuntu-18.04
2382-
python-version: ["pypy3.6", "pypy3.7", "pypy3.8", "system-python3"]
2370+
python-version: ["pypy3.7", "pypy3.8"]
23832371
green-framework: "*"
23842372
auth-ssl: "*"
23852373
display_name: "${green-framework} ${python-version} ${platform} ${auth-ssl}"
@@ -2405,7 +2393,7 @@ buildvariants:
24052393
matrix_spec:
24062394
platform: awslinux
24072395
# Python 3.10+ requires OpenSSL 1.1.1+
2408-
python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3.6", "pypy3.7", "pypy3.8"]
2396+
python-version: ["3.7", "3.8", "3.9", "pypy3.7", "pypy3.8"]
24092397
auth-ssl: "*"
24102398
display_name: "OpenSSL 1.0.2 ${python-version} ${platform} ${auth-ssl}"
24112399
tasks:
@@ -2420,12 +2408,12 @@ buildvariants:
24202408
display_name: "Encryption ${platform} ${python-version-windows} ${auth-ssl}"
24212409
tasks: *encryption-server-versions
24222410

2423-
# Storage engine tests on Ubuntu 18.04 (x86_64) with Python 3.6.
2411+
# Storage engine tests on Ubuntu 18.04 (x86_64) with Python 3.7.
24242412
- matrix_name: "tests-storage-engines"
24252413
matrix_spec:
24262414
platform: ubuntu-18.04
24272415
storage-engine: "*"
2428-
python-version: 3.6
2416+
python-version: 3.7
24292417
display_name: "Storage ${storage-engine} ${python-version} ${platform}"
24302418
rules:
24312419
- if:
@@ -2452,12 +2440,12 @@ buildvariants:
24522440
- "test-3.6-standalone"
24532441
- "test-3.6-replica_set"
24542442

2455-
# enableTestCommands=0 tests on Ubuntu18 (x86_64) with Python 3.6.
2443+
# enableTestCommands=0 tests on Ubuntu18 (x86_64) with Python 3.7.
24562444
- matrix_name: "test-disableTestCommands"
24572445
matrix_spec:
24582446
platform: ubuntu-18.04
24592447
disableTestCommands: "*"
2460-
python-version: "3.6"
2448+
python-version: "3.7"
24612449
display_name: "Disable test commands ${python-version} ${platform}"
24622450
tasks:
24632451
- ".latest"
@@ -2483,7 +2471,7 @@ buildvariants:
24832471
- matrix_name: "tests-mod-wsgi"
24842472
matrix_spec:
24852473
platform: ubuntu-18.04
2486-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
2474+
python-version: ["3.7", "3.8", "3.9", "3.10"]
24872475
mod-wsgi-version: "*"
24882476
exclude_spec:
24892477
# mod-wsgi 3.5 won't build against CPython 3.8+
@@ -2498,7 +2486,7 @@ buildvariants:
24982486
- matrix_name: "mockupdb-tests"
24992487
matrix_spec:
25002488
platform: ubuntu-18.04
2501-
python-version: 3.6
2489+
python-version: 3.7
25022490
display_name: "MockupDB Tests"
25032491
tasks:
25042492
- name: "mockupdb"
@@ -2543,19 +2531,14 @@ buildvariants:
25432531
python-version: "*"
25442532
auth-ssl: auth-ssl
25452533
serverless: "*"
2546-
exclude_spec:
2547-
- platform: ubuntu-18.04
2548-
python-version: ["system-python3"]
2549-
auth-ssl: auth-ssl
2550-
serverless: "*"
25512534
display_name: "Serverless ${python-version} ${platform}"
25522535
tasks:
25532536
- "serverless_task_group"
25542537

25552538
- matrix_name: "data-lake-spec-tests"
25562539
matrix_spec:
25572540
platform: ubuntu-18.04
2558-
python-version: ["3.6", "3.10"]
2541+
python-version: ["3.7", "3.10"]
25592542
auth: "auth"
25602543
c-extensions: "*"
25612544
display_name: "Atlas Data Lake ${python-version} ${c-extensions}"
@@ -2565,7 +2548,7 @@ buildvariants:
25652548
- matrix_name: "stable-api-tests"
25662549
matrix_spec:
25672550
platform: ubuntu-18.04
2568-
python-version: ["3.6", "3.10"]
2551+
python-version: ["3.7", "3.10"]
25692552
auth: "auth"
25702553
versionedApi: "*"
25712554
display_name: "Versioned API ${versionedApi} ${python-version}"
@@ -2580,7 +2563,7 @@ buildvariants:
25802563
# OCSP stapling is not supported on Ubuntu 18.04.
25812564
# See https://jira.mongodb.org/browse/SERVER-51364.
25822565
platform: ubuntu-20.04
2583-
python-version: ["3.6", "3.10", "pypy3.6", "pypy3.8"]
2566+
python-version: ["3.7", "3.10", "pypy3.7", "pypy3.8"]
25842567
mongodb-version: ["4.4", "5.0", "latest"]
25852568
auth: "noauth"
25862569
ssl: "ssl"
@@ -2592,7 +2575,7 @@ buildvariants:
25922575
- matrix_name: "ocsp-test-windows"
25932576
matrix_spec:
25942577
platform: windows-64-vsMulti-small
2595-
python-version-windows: ["3.6", "3.10"]
2578+
python-version-windows: ["3.7", "3.10"]
25962579
mongodb-version: ["4.4", "5.0", "latest"]
25972580
auth: "noauth"
25982581
ssl: "ssl"
@@ -2616,14 +2599,24 @@ buildvariants:
26162599

26172600
- matrix_name: "aws-auth-test"
26182601
matrix_spec:
2619-
platform: [ubuntu-18.04, macos-1014]
2620-
python-version: ["system-python3"]
2602+
platform: [ubuntu-18.04]
2603+
python-version: ["3.7"]
26212604
display_name: "MONGODB-AWS Auth ${platform} ${python-version}"
26222605
tasks:
26232606
- name: "aws-auth-test-4.4"
26242607
- name: "aws-auth-test-5.0"
26252608
- name: "aws-auth-test-latest"
26262609

2610+
- matrix_name: "aws-auth-test-mac"
2611+
matrix_spec:
2612+
platform: [macos-1014]
2613+
python-version-mac: ["system-python3"]
2614+
display_name: "MONGODB-AWS Auth ${platform} ${python-version-mac}"
2615+
tasks:
2616+
- name: "aws-auth-test-4.4"
2617+
- name: "aws-auth-test-5.0"
2618+
- name: "aws-auth-test-latest"
2619+
26272620
- matrix_name: "aws-auth-test-windows"
26282621
matrix_spec:
26292622
platform: [windows-64-vsMulti-small]

.evergreen/run-mongodb-aws-ecs-test.sh

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,18 @@ fi
2020
# Now we can safely enable xtrace
2121
set -o xtrace
2222

23-
if command -v virtualenv ; then
24-
VIRTUALENV=$(command -v virtualenv)
25-
else
26-
if ! python3 -m pip --version ; then
27-
echo "Installing pip..."
28-
apt-get update
29-
apt install python3-pip -y
30-
fi
31-
echo "Installing virtualenv..."
32-
python3 -m pip install --user virtualenv
33-
VIRTUALENV='python3 -m virtualenv'
34-
fi
23+
# Install python3.7 with pip.
24+
apt-get update
25+
apt install python3.7 python3-pip -y
3526

3627
authtest () {
3728
echo "Running MONGODB-AWS ECS authentication tests with $PYTHON"
3829
$PYTHON --version
39-
40-
$VIRTUALENV -p $PYTHON --never-download venvaws
41-
. venvaws/bin/activate
42-
30+
$PYTHON -m pip install --upgrade wheel setuptools pip
4331
cd src
44-
python -m pip install '.[aws]'
45-
python test/auth_aws/test_auth_aws.py
32+
$PYTHON -m pip install '.[aws]'
33+
$PYTHON test/auth_aws/test_auth_aws.py
4634
cd -
47-
deactivate
48-
rm -rf venvaws
4935
}
5036

51-
PYTHON=$(command -v python3) authtest
37+
PYTHON="python3.7" authtest

.evergreen/run-tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ fi
6666

6767
if [ -z "$PYTHON_BINARY" ]; then
6868
# Use Python 3 from the server toolchain to test on ARM, POWER or zSeries if a
69-
# system python3 doesn't exist or exists but is older than 3.6.
70-
if is_python_36 "$(command -v python3)"; then
69+
# system python3 doesn't exist or exists but is older than 3.7.
70+
if is_python_37 "$(command -v python3)"; then
7171
PYTHON=$(command -v python3)
72-
elif is_python_36 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then
72+
elif is_python_37 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then
7373
PYTHON=$(command -v /opt/mongodbtoolchain/v3/bin/python3)
7474
else
75-
echo "Cannot test without python3.6+ installed!"
75+
echo "Cannot test without python3.7+ installed!"
7676
fi
7777
elif [ "$COMPRESSORS" = "snappy" ]; then
7878
createvirtualenv $PYTHON_BINARY snappytest

.evergreen/utils.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ testinstall () {
5959
fi
6060
}
6161

62-
# Function that returns success if the provided Python binary is version 3.6 or later
62+
# Function that returns success if the provided Python binary is version 3.7 or later
6363
# Usage:
64-
# is_python_36 /path/to/python
64+
# is_python_37 /path/to/python
6565
# * param1: Python binary
66-
is_python_36() {
66+
is_python_37() {
6767
if [ -z "$1" ]; then
6868
return 1
69-
elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 6))"; then
70-
# runs when sys.version_info[:2] >= (3, 6)
69+
elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 7))"; then
70+
# runs when sys.version_info[:2] >= (3, 7)
7171
return 0
7272
else
7373
return 1

.github/workflows/test-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
os: [ubuntu-20.04]
26-
python-version: ["3.6", "3.10", "pypy-3.8"]
26+
python-version: ["3.7", "3.10", "pypy-3.8"]
2727
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
2828
steps:
2929
- uses: actions/checkout@v2

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ that might not be of interest or that has already been addressed.
1919
Supported Interpreters
2020
----------------------
2121

22-
PyMongo supports CPython 3.6+ and PyPy3.6+. Language
22+
PyMongo supports CPython 3.7+ and PyPy3.7+. Language
2323
features not supported by all interpreters can not be used.
2424

2525
Style Guide

0 commit comments

Comments
 (0)