Skip to content

Commit 18b29f0

Browse files
authored
Merge branch 'master' into PYTHON-4815
2 parents 7f447c8 + 9ba780c commit 18b29f0

File tree

95 files changed

+4764
-1657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+4764
-1657
lines changed

.evergreen/config.yml

Lines changed: 74 additions & 141 deletions
Large diffs are not rendered by default.

.evergreen/hatch.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@ if [ -n "$SKIP_HATCH" ]; then
1818
run_hatch() {
1919
bash ./.evergreen/run-tests.sh
2020
}
21-
elif $PYTHON_BINARY -m hatch --version; then
22-
run_hatch() {
23-
$PYTHON_BINARY -m hatch run "$@"
24-
}
25-
else # No toolchain hatch present, set up virtualenv before installing hatch
21+
else # Set up virtualenv before installing hatch
2622
# Use a random venv name because the encryption tasks run this script multiple times in the same run.
2723
ENV_NAME=hatchenv-$RANDOM
2824
createvirtualenv "$PYTHON_BINARY" $ENV_NAME
2925
# shellcheck disable=SC2064
3026
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP
3127
python -m pip install -q hatch
28+
29+
# Ensure hatch does not write to user or global locations.
30+
touch hatch_config.toml
31+
HATCH_CONFIG=$(pwd)/hatch_config.toml
32+
export HATCH_CONFIG
33+
hatch config restore
34+
hatch config set dirs.data ".hatch/data"
35+
hatch config set dirs.cache ".hatch/cache"
36+
3237
run_hatch() {
3338
python -m hatch run "$@"
3439
}

.evergreen/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ if [ -z "$GREEN_FRAMEWORK" ]; then
257257
# Use --capture=tee-sys so pytest prints test output inline:
258258
# https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html
259259
if [ -z "$TEST_SUITES" ]; then
260-
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_ARGS
260+
python -m pytest -v --capture=tee-sys --durations=5 $TEST_ARGS
261261
else
262-
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 -m $TEST_SUITES $TEST_ARGS
262+
python -m pytest -v --capture=tee-sys --durations=5 -m $TEST_SUITES $TEST_ARGS
263263
fi
264264
else
265265
python green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS

.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.8+.
8-
if is_python_38 "$(command -v python3)"; then
7+
# Add a fallback system python3 if it is available and Python 3.9+.
8+
if is_python_39 "$(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.8" ]; then
18-
PYTHON="/Library/Frameworks/Python.Framework/Versions/3.8/bin/python3"
17+
elif [ -d "/Library/Frameworks/Python.Framework/Versions/3.9" ]; then
18+
PYTHON="/Library/Frameworks/Python.Framework/Versions/3.9/bin/python3"
1919
fi
2020
elif [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
21-
PYTHON="C:/python/Python38/python.exe"
21+
PYTHON="C:/python/Python39/python.exe"
2222
else
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
23+
# Prefer our own toolchain, fall back to mongodb toolchain if it has Python 3.9+.
24+
if [ -f "/opt/python/3.9/bin/python3" ]; then
25+
PYTHON="/opt/python/3.9/bin/python3"
26+
elif is_python_39 "$(command -v /opt/mongodbtoolchain/v4/bin/python3)"; then
2727
PYTHON="/opt/mongodbtoolchain/v4/bin/python3"
28-
elif is_python_38 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then
28+
elif is_python_39 "$(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.8+ installed!"
33+
echo "Cannot test without python3.9+ 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.8 or later
99+
# Function that returns success if the provided Python binary is version 3.9 or later
100100
# Usage:
101-
# is_python_38 /path/to/python
101+
# is_python_39 /path/to/python
102102
# * param1: Python binary
103-
is_python_38() {
103+
is_python_39() {
104104
if [ -z "$1" ]; then
105105
return 1
106-
elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 8))"; then
107-
# runs when sys.version_info[:2] >= (3, 8)
106+
elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 9))"; then
107+
# runs when sys.version_info[:2] >= (3, 9)
108108
return 0
109109
else
110110
return 1

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/checkout@v4
4040
with:
4141
ref: ${{ inputs.ref }}
42-
- uses: actions/setup-python@v3
42+
- uses: actions/setup-python@v5
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL

.github/workflows/dist.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- uses: actions/setup-python@v5
5454
with:
5555
cache: 'pip'
56-
python-version: 3.8
56+
python-version: 3.9
5757
cache-dependency-path: 'pyproject.toml'
5858
allow-prereleases: true
5959

@@ -67,7 +67,7 @@ jobs:
6767
# Note: the default manylinux is manylinux2014
6868
run: |
6969
python -m pip install -U pip
70-
python -m pip install "cibuildwheel>=2.17,<3"
70+
python -m pip install "cibuildwheel>=2.20,<3"
7171
7272
- name: Build wheels
7373
env:
@@ -79,17 +79,19 @@ jobs:
7979
env:
8080
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
8181
CIBW_MANYLINUX_I686_IMAGE: manylinux1
82-
CIBW_BUILD: "cp38-${{ matrix.buildplat[1] }} cp39-${{ matrix.buildplat[1] }}"
82+
CIBW_BUILD: "cp39-${{ matrix.buildplat[1] }} cp39-${{ matrix.buildplat[1] }}"
8383
run: python -m cibuildwheel --output-dir wheelhouse
8484

8585
- name: Assert all versions in wheelhouse
8686
if: ${{ ! startsWith(matrix.buildplat[1], 'macos') }}
8787
run: |
88-
ls wheelhouse/*cp38*.whl
8988
ls wheelhouse/*cp39*.whl
9089
ls wheelhouse/*cp310*.whl
9190
ls wheelhouse/*cp311*.whl
9291
ls wheelhouse/*cp312*.whl
92+
ls wheelhouse/*cp313*.whl
93+
# Free-threading builds:
94+
ls wheelhouse/*cp313t*.whl
9395
9496
- uses: actions/upload-artifact@v4
9597
with:
@@ -109,7 +111,7 @@ jobs:
109111
- uses: actions/setup-python@v5
110112
with:
111113
# Build sdist on lowest supported Python
112-
python-version: '3.8'
114+
python-version: '3.9'
113115

114116
- name: Build SDist
115117
run: |

.github/workflows/test-python.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-python@v5
2424
with:
25-
python-version: "3.8"
25+
python-version: "3.9"
2626
cache: 'pip'
2727
cache-dependency-path: 'pyproject.toml'
2828
- name: Install Python dependencies
@@ -51,11 +51,18 @@ jobs:
5151
strategy:
5252
matrix:
5353
os: [ubuntu-20.04]
54-
python-version: ["3.8", "pypy-3.9", "3.13"]
54+
python-version: ["3.9", "pypy-3.9", "3.13", "3.13t"]
5555
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
5656
steps:
5757
- uses: actions/checkout@v4
58-
- name: Setup Python
58+
- if: ${{ matrix.python-version == '3.13t' }}
59+
name: Setup free-threaded Python
60+
uses: deadsnakes/[email protected]
61+
with:
62+
python-version: 3.13
63+
nogil: true
64+
- if: ${{ matrix.python-version != '3.13t' }}
65+
name: Setup Python
5966
uses: actions/setup-python@v5
6067
with:
6168
python-version: ${{ matrix.python-version }}
@@ -65,19 +72,27 @@ jobs:
6572
- name: Install dependencies
6673
run: |
6774
pip install -U pip
68-
if [ "${{ matrix.python-version }}" == "3.13" ]; then
75+
if [[ "${{ matrix.python-version }}" == "3.13" ]]; then
6976
pip install --pre cffi setuptools
7077
pip install --no-build-isolation hatch
78+
elif [[ "${{ matrix.python-version }}" == "3.13t" ]]; then
79+
# Hatch can't be installed on 3.13t, use pytest directly.
80+
pip install .
81+
pip install -r requirements/test.txt
7182
else
7283
pip install hatch
7384
fi
7485
- name: Start MongoDB
75-
uses: supercharge/mongodb-github-action@1.10.0
86+
uses: supercharge/mongodb-github-action@1.11.0
7687
with:
7788
mongodb-version: 6.0
7889
- name: Run tests
7990
run: |
80-
hatch run test:test
91+
if [[ "${{ matrix.python-version }}" == "3.13t" ]]; then
92+
pytest -v --durations=5 --maxfail=10
93+
else
94+
hatch run test:test
95+
fi
8196
8297
doctest:
8398
runs-on: ubuntu-latest
@@ -87,14 +102,14 @@ jobs:
87102
- name: Setup Python
88103
uses: actions/setup-python@v5
89104
with:
90-
python-version: "3.8"
105+
python-version: "3.9"
91106
cache: 'pip'
92107
cache-dependency-path: 'pyproject.toml'
93108
- name: Install dependencies
94109
run: |
95110
pip install -U hatch pip
96111
- name: Start MongoDB
97-
uses: supercharge/mongodb-github-action@1.10.0
112+
uses: supercharge/mongodb-github-action@1.11.0
98113
with:
99114
mongodb-version: '8.0.0-rc4'
100115
- name: Run tests
@@ -111,7 +126,7 @@ jobs:
111126
cache: 'pip'
112127
cache-dependency-path: 'pyproject.toml'
113128
# Build docs on lowest supported Python for furo
114-
python-version: '3.8'
129+
python-version: '3.9'
115130
- name: Install dependencies
116131
run: |
117132
pip install -U pip hatch
@@ -129,7 +144,7 @@ jobs:
129144
cache: 'pip'
130145
cache-dependency-path: 'pyproject.toml'
131146
# Build docs on lowest supported Python for furo
132-
python-version: '3.8'
147+
python-version: '3.9'
133148
- name: Install dependencies
134149
run: |
135150
pip install -U pip hatch
@@ -142,7 +157,7 @@ jobs:
142157
runs-on: ubuntu-latest
143158
strategy:
144159
matrix:
145-
python: ["3.8", "3.11"]
160+
python: ["3.9", "3.11"]
146161
steps:
147162
- uses: actions/checkout@v4
148163
- uses: actions/setup-python@v5
@@ -167,7 +182,7 @@ jobs:
167182
cache: 'pip'
168183
cache-dependency-path: 'pyproject.toml'
169184
# Build sdist on lowest supported Python
170-
python-version: '3.8'
185+
python-version: '3.9'
171186
- name: Build SDist
172187
shell: bash
173188
run: |
@@ -199,9 +214,9 @@ jobs:
199214
cache: 'pip'
200215
cache-dependency-path: 'sdist/test/pyproject.toml'
201216
# Test sdist on lowest supported Python
202-
python-version: '3.8'
217+
python-version: '3.9'
203218
- name: Start MongoDB
204-
uses: supercharge/mongodb-github-action@1.10.0
219+
uses: supercharge/mongodb-github-action@1.11.0
205220
- name: Run connect test from sdist
206221
shell: bash
207222
run: |

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.8+ and PyPy3.9+. Language features not
19+
PyMongo supports CPython 3.9+ and PyPy3.9+. Language features not
2020
supported by all interpreters can not be used.
2121

2222
## Style Guide

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ a native Python driver for MongoDB. The `gridfs` package is a
1414
[gridfs](https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst/)
1515
implementation on top of `pymongo`.
1616

17-
PyMongo supports MongoDB 3.6, 4.0, 4.2, 4.4, 5.0, 6.0, 7.0, and 8.0.
17+
PyMongo supports MongoDB 4.0, 4.2, 4.4, 5.0, 6.0, 7.0, and 8.0.
1818

1919
## Support / Feedback
2020

@@ -90,7 +90,7 @@ package that is incompatible with PyMongo.
9090

9191
## Dependencies
9292

93-
PyMongo supports CPython 3.8+ and PyPy3.9+.
93+
PyMongo supports CPython 3.9+ and PyPy3.9+.
9494

9595
Required dependencies:
9696

0 commit comments

Comments
 (0)