Skip to content

Commit 66935c0

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver
2 parents 24d39e4 + 2d301e2 commit 66935c0

File tree

198 files changed

+9390
-20105
lines changed

Some content is hidden

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

198 files changed

+9390
-20105
lines changed

.evergreen/config.yml

Lines changed: 70 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,19 @@ functions:
5858
5959
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
6060
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
61-
export UPLOAD_BUCKET="${project}"
6261
6362
cat <<EOT > expansion.yml
6463
CURRENT_VERSION: "$CURRENT_VERSION"
6564
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
6665
MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME"
6766
MONGODB_BINARIES: "$MONGODB_BINARIES"
68-
UPLOAD_BUCKET: "$UPLOAD_BUCKET"
6967
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
7068
PREPARE_SHELL: |
7169
set -o errexit
7270
export SKIP_LEGACY_SHELL=1
7371
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
7472
export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
7573
export MONGODB_BINARIES="$MONGODB_BINARIES"
76-
export UPLOAD_BUCKET="$UPLOAD_BUCKET"
7774
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
7875
7976
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
@@ -103,30 +100,35 @@ functions:
103100
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config
104101
105102
"upload coverage" :
103+
- command: ec2.assume_role
104+
params:
105+
role_arn: ${assume_role_arn}
106106
- command: s3.put
107107
params:
108-
aws_key: ${aws_key}
109-
aws_secret: ${aws_secret}
108+
aws_key: ${AWS_ACCESS_KEY_ID}
109+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
110+
aws_session_token: ${AWS_SESSION_TOKEN}
110111
local_file: src/.coverage
111112
optional: true
112113
# Upload the coverage report for all tasks in a single build to the same directory.
113-
remote_file: ${UPLOAD_BUCKET}/coverage/${revision}/${version_id}/coverage/coverage.${build_variant}.${task_name}
114-
bucket: mciuploads
114+
remote_file: coverage/${revision}/${version_id}/coverage/coverage.${build_variant}.${task_name}
115+
bucket: ${bucket_name}
115116
permissions: public-read
116117
content_type: text/html
117118
display_name: "Raw Coverage Report"
118119

119120
"download and merge coverage" :
121+
- command: ec2.assume_role
122+
params:
123+
role_arn: ${assume_role_arn}
120124
- command: shell.exec
121125
params:
122126
silent: true
123127
working_dir: "src"
128+
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
124129
script: |
125-
export AWS_ACCESS_KEY_ID=${aws_key}
126-
export AWS_SECRET_ACCESS_KEY=${aws_secret}
127-
128130
# Download all the task coverage files.
129-
aws s3 cp --recursive s3://mciuploads/${UPLOAD_BUCKET}/coverage/${revision}/${version_id}/coverage/ coverage/
131+
aws s3 cp --recursive s3://${bucket_name}/coverage/${revision}/${version_id}/coverage/ coverage/
130132
- command: shell.exec
131133
params:
132134
working_dir: "src"
@@ -138,24 +140,27 @@ functions:
138140
params:
139141
silent: true
140142
working_dir: "src"
143+
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
141144
script: |
142-
export AWS_ACCESS_KEY_ID=${aws_key}
143-
export AWS_SECRET_ACCESS_KEY=${aws_secret}
144-
aws s3 cp htmlcov/ s3://mciuploads/${UPLOAD_BUCKET}/coverage/${revision}/${version_id}/htmlcov/ --recursive --acl public-read --region us-east-1
145+
aws s3 cp htmlcov/ s3://${bucket_name}/coverage/${revision}/${version_id}/htmlcov/ --recursive --acl public-read --region us-east-1
145146
# Attach the index.html with s3.put so it shows up in the Evergreen UI.
146147
- command: s3.put
147148
params:
148-
aws_key: ${aws_key}
149-
aws_secret: ${aws_secret}
149+
aws_key: ${AWS_ACCESS_KEY_ID}
150+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
151+
aws_session_token: ${AWS_SESSION_TOKEN}
150152
local_file: src/htmlcov/index.html
151-
remote_file: ${UPLOAD_BUCKET}/coverage/${revision}/${version_id}/htmlcov/index.html
152-
bucket: mciuploads
153+
remote_file: coverage/${revision}/${version_id}/htmlcov/index.html
154+
bucket: ${bucket_name}
153155
permissions: public-read
154156
content_type: text/html
155157
display_name: "Coverage Report HTML"
156158

157159

158160
"upload mo artifacts":
161+
- command: ec2.assume_role
162+
params:
163+
role_arn: ${assume_role_arn}
159164
- command: shell.exec
160165
params:
161166
script: |
@@ -174,37 +179,43 @@ functions:
174179
- "./**.mdmp" # Windows: minidumps
175180
- command: s3.put
176181
params:
177-
aws_key: ${aws_key}
178-
aws_secret: ${aws_secret}
182+
aws_key: ${AWS_ACCESS_KEY_ID}
183+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
184+
aws_session_token: ${AWS_SESSION_TOKEN}
179185
local_file: mongo-coredumps.tgz
180-
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/coredumps/${task_id}-${execution}-mongodb-coredumps.tar.gz
181-
bucket: mciuploads
186+
remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/coredumps/${task_id}-${execution}-mongodb-coredumps.tar.gz
187+
bucket: ${bucket_name}
182188
permissions: public-read
183189
content_type: ${content_type|application/gzip}
184190
display_name: Core Dumps - Execution
185191
optional: true
186192
- command: s3.put
187193
params:
188-
aws_key: ${aws_key}
189-
aws_secret: ${aws_secret}
194+
aws_key: ${AWS_ACCESS_KEY_ID}
195+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
196+
aws_session_token: ${AWS_SESSION_TOKEN}
190197
local_file: mongodb-logs.tar.gz
191-
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tar.gz
192-
bucket: mciuploads
198+
remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tar.gz
199+
bucket: ${bucket_name}
193200
permissions: public-read
194201
content_type: ${content_type|application/x-gzip}
195202
display_name: "mongodb-logs.tar.gz"
196203
- command: s3.put
197204
params:
198-
aws_key: ${aws_key}
199-
aws_secret: ${aws_secret}
205+
aws_key: ${AWS_ACCESS_KEY_ID}
206+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
207+
aws_session_token: ${AWS_SESSION_TOKEN}
200208
local_file: drivers-tools/.evergreen/orchestration/server.log
201-
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-orchestration.log
202-
bucket: mciuploads
209+
remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-orchestration.log
210+
bucket: ${bucket_name}
203211
permissions: public-read
204212
content_type: ${content_type|text/plain}
205213
display_name: "orchestration.log"
206214

207215
"upload working dir":
216+
- command: ec2.assume_role
217+
params:
218+
role_arn: ${assume_role_arn}
208219
- command: archive.targz_pack
209220
params:
210221
target: "working-dir.tar.gz"
@@ -213,11 +224,12 @@ functions:
213224
- "./**"
214225
- command: s3.put
215226
params:
216-
aws_key: ${aws_key}
217-
aws_secret: ${aws_secret}
227+
aws_key: ${AWS_ACCESS_KEY_ID}
228+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
229+
aws_session_token: ${AWS_SESSION_TOKEN}
218230
local_file: working-dir.tar.gz
219-
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/artifacts/${task_id}-${execution}-working-dir.tar.gz
220-
bucket: mciuploads
231+
remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/artifacts/${task_id}-${execution}-working-dir.tar.gz
232+
bucket: ${bucket_name}
221233
permissions: public-read
222234
content_type: ${content_type|application/x-gzip}
223235
display_name: "working-dir.tar.gz"
@@ -232,11 +244,12 @@ functions:
232244
- "*.lock"
233245
- command: s3.put
234246
params:
235-
aws_key: ${aws_key}
236-
aws_secret: ${aws_secret}
247+
aws_key: ${AWS_ACCESS_KEY_ID}
248+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
249+
aws_session_token: ${AWS_SESSION_TOKEN}
237250
local_file: drivers-dir.tar.gz
238-
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/artifacts/${task_id}-${execution}-drivers-dir.tar.gz
239-
bucket: mciuploads
251+
remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/artifacts/${task_id}-${execution}-drivers-dir.tar.gz
252+
bucket: ${bucket_name}
240253
permissions: public-read
241254
content_type: ${content_type|application/x-gzip}
242255
display_name: "drivers-dir.tar.gz"
@@ -785,6 +798,9 @@ functions:
785798
VERSION=${VERSION} ENSURE_UNIVERSAL2=${ENSURE_UNIVERSAL2} .evergreen/release.sh
786799
787800
"upload release":
801+
- command: ec2.assume_role
802+
params:
803+
role_arn: ${assume_role_arn}
788804
- command: archive.targz_pack
789805
params:
790806
target: "release-files.tgz"
@@ -793,25 +809,27 @@ functions:
793809
- "*"
794810
- command: s3.put
795811
params:
796-
aws_key: ${aws_key}
797-
aws_secret: ${aws_secret}
812+
aws_key: ${AWS_ACCESS_KEY_ID}
813+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
814+
aws_session_token: ${AWS_SESSION_TOKEN}
798815
local_file: release-files.tgz
799-
remote_file: ${UPLOAD_BUCKET}/release/${revision}/${task_id}-${execution}-release-files.tar.gz
800-
bucket: mciuploads
816+
remote_file: release/${revision}/${task_id}-${execution}-release-files.tar.gz
817+
bucket: ${bucket_name}
801818
permissions: public-read
802819
content_type: ${content_type|application/gzip}
803820
display_name: Release files
804821

805822
"download and merge releases":
823+
- command: ec2.assume_role
824+
params:
825+
role_arn: ${assume_role_arn}
806826
- command: shell.exec
807827
params:
808828
silent: true
829+
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
809830
script: |
810-
export AWS_ACCESS_KEY_ID=${aws_key}
811-
export AWS_SECRET_ACCESS_KEY=${aws_secret}
812-
813831
# Download all the task coverage files.
814-
aws s3 cp --recursive s3://mciuploads/${UPLOAD_BUCKET}/release/${revision}/ release/
832+
aws s3 cp --recursive s3://${bucket_name}/release/${revision}/ release/
815833
- command: shell.exec
816834
params:
817835
shell: "bash"
@@ -845,11 +863,12 @@ functions:
845863
- "*"
846864
- command: s3.put
847865
params:
848-
aws_key: ${aws_key}
849-
aws_secret: ${aws_secret}
866+
aws_key: ${AWS_ACCESS_KEY_ID}
867+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
868+
aws_session_token: ${AWS_SESSION_TOKEN}
850869
local_file: release-files-all.tgz
851-
remote_file: ${UPLOAD_BUCKET}/release-all/${revision}/${task_id}-${execution}-release-files-all.tar.gz
852-
bucket: mciuploads
870+
remote_file: release-all/${revision}/${task_id}-${execution}-release-files-all.tar.gz
871+
bucket: ${bucket_name}
853872
permissions: public-read
854873
content_type: ${content_type|application/gzip}
855874
display_name: Release files all
@@ -2108,7 +2127,7 @@ tasks:
21082127
script: |
21092128
${PREPARE_SHELL}
21102129
export PYTHON_BINARY=/opt/mongodbtoolchain/v4/bin/python3
2111-
export LIBMONGOCRYPT_URL=https://s3.amazonaws.com/mciuploads/libmongocrypt/debian10/master/latest/libmongocrypt.tar.gz
2130+
export LIBMONGOCRYPT_URL=https://s3.amazonaws.com/${bucket_name}/libmongocrypt/debian10/master/latest/libmongocrypt.tar.gz
21122131
SUCCESS=false TEST_FLE_GCP_AUTO=1 ./.evergreen/tox.sh -m test-eg
21132132
21142133
- name: testazurekms-task

.evergreen/run-tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ if [ -z "$GREEN_FRAMEWORK" ]; then
258258
# Use --capture=tee-sys so pytest prints test output inline:
259259
# https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html
260260
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_ARGS
261+
if [ -z "$TEST_ARGS" ]; then # TODO: remove this in PYTHON-4528
262+
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 test/synchronous/ $TEST_ARGS
263+
fi
264+
python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 test/asynchronous/ $TEST_ARGS
261265
else
262266
python green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS
263267
fi

.github/workflows/codeql.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ jobs:
2626
# required for all workflows
2727
security-events: write
2828

29-
# required to fetch internal or private CodeQL packs
30-
packages: read
31-
3229
strategy:
3330
fail-fast: false
3431
matrix:

.github/workflows/dist.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
workflow_dispatch:
1111
pull_request:
1212
workflow_call:
13+
inputs:
14+
ref:
15+
required: true
16+
type: string
1317

1418
concurrency:
1519
group: dist-${{ github.ref }}
@@ -44,6 +48,7 @@ jobs:
4448
uses: actions/checkout@v4
4549
with:
4650
fetch-depth: 0
51+
ref: ${{ inputs.ref }}
4752

4853
- uses: actions/setup-python@v5
4954
with:
@@ -99,6 +104,7 @@ jobs:
99104
- uses: actions/checkout@v4
100105
with:
101106
fetch-depth: 0
107+
ref: ${{ inputs.ref }}
102108

103109
- uses: actions/setup-python@v5
104110
with:

.github/workflows/release-python.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
PRODUCT_NAME: PyMongo
2020
# Changes per branch
2121
SILK_ASSET_GROUP: mongodb-python-driver
22-
EVERGREEN_PROJECT: mongodb-python-driver
22+
EVERGREEN_PROJECT: mongo-python-driver
2323

2424
defaults:
2525
run:
@@ -32,6 +32,8 @@ jobs:
3232
permissions:
3333
id-token: write
3434
contents: write
35+
outputs:
36+
version: ${{ steps.pre-publish.outputs.version }}
3537
steps:
3638
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v2
3739
with:
@@ -44,19 +46,24 @@ jobs:
4446
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
4547
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
4648
- uses: mongodb-labs/drivers-github-tools/python/pre-publish@v2
49+
id: pre-publish
4750
with:
4851
version: ${{ inputs.version }}
4952
dry_run: ${{ inputs.dry_run }}
5053

5154
build-dist:
5255
needs: [pre-publish]
5356
uses: ./.github/workflows/dist.yml
57+
with:
58+
ref: ${{ needs.pre-publish.outputs.version }}
5459

5560
static-scan:
5661
needs: [pre-publish]
5762
uses: ./.github/workflows/codeql.yml
63+
permissions:
64+
security-events: write
5865
with:
59-
ref: ${{ github.ref }}
66+
ref: ${{ needs.pre-publish.outputs.version }}
6067

6168
publish:
6269
needs: [build-dist, static-scan]

.github/workflows/test-python.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ jobs:
7171
- name: Run tests
7272
run: |
7373
tox -m test
74+
- name: Run async tests
75+
run: |
76+
tox -m test-async
7477
7578
doctest:
7679
runs-on: ubuntu-latest
@@ -203,3 +206,5 @@ jobs:
203206
which python
204207
pip install -e ".[test]"
205208
pytest -v
209+
pytest -v test/synchronous/
210+
pytest -v test/asynchronous/

README.md

Lines changed: 1 addition & 1 deletion
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, and 7.0.
17+
PyMongo supports MongoDB 3.6, 4.0, 4.2, 4.4, 5.0, 6.0, 7.0, and 8.0.
1818

1919
## Support / Feedback
2020

0 commit comments

Comments
 (0)