Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYTHON-4976 Replace hatch with uv as our python environment and workfow tool #2068

Merged
merged 45 commits into from
Jan 22, 2025

Conversation

blink1073
Copy link
Member

@blink1073 blink1073 commented Jan 21, 2025

Adopting uv allows us to use dependency groups, a fantastic feature added by PEP-735.

Full run: https://spruce.mongodb.com/version/6790291613c55d000759cb7d/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

@blink1073 blink1073 requested a review from NoahStapp January 21, 2025 12:05
@@ -460,15 +460,6 @@ buildvariants:
test_encryption: "true"
test_encryption_pyopenssl: "true"
PYTHON_BINARY: /opt/python/3.12/bin/python3
- name: encryption-rhel8-pypy3.9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this variant with PyPy3.10 instead?

@@ -925,7 +907,7 @@ buildvariants:
SSL: ssl
TOPOLOGY: server
VERSION: latest
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we split the PyPy3.9 deprecation out into a separate PR? It would be cleaner to separate that from switching to uv.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: #2070

@@ -8,17 +8,22 @@ export AZUREKMS_VMNAME=${AZUREKMS_VMNAME}
export AZUREKMS_PRIVATEKEYPATH=/tmp/testazurekms_privatekey
export LIBMONGOCRYPT_URL=https://s3.amazonaws.com/mciuploads/libmongocrypt/debian11/master/latest/libmongocrypt.tar.gz
SKIP_SERVERS=1 bash $HERE/setup-encryption.sh
tar czf /tmp/mongo-python-driver.tgz .
# Set up the remote files to test.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes related to the uv conversion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -10,11 +10,16 @@ export GCPKMS_ZONE=${GCPKMS_ZONE}
export GCPKMS_INSTANCENAME=${GCPKMS_INSTANCENAME}
export LIBMONGOCRYPT_URL=https://s3.amazonaws.com/mciuploads/libmongocrypt/debian11/master/latest/libmongocrypt.tar.gz
SKIP_SERVERS=1 bash $HERE/setup-encryption.sh
tar czf /tmp/mongo-python-driver.tgz .
GCPKMS_SRC=/tmp/mongo-python-driver.tgz GCPKMS_DST=$GCPKMS_INSTANCENAME: $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/copy-file.sh
# Set up the remote files to test.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as above.

@@ -3,4 +3,4 @@
set -eu
file="$PROJECT_DIRECTORY/.evergreen/install-dependencies.sh"
# Don't use ${file} syntax here because evergreen treats it as an empty expansion.
[ -f "$file" ] && bash "$file" || echo "$file not available, skipping"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an intended change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, to avoid masking an error if the script failed to run. It is known to exist.

echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" >$MONGO_ORCHESTRATION_HOME/orchestration.config

popd

# # Copy PyMongo's test certificates over driver-evergreen-tools'
# cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended commenting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, removing

"mypy==1.14.1",
"pyright==1.1.391",
"typing_extensions"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a test group here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already an extra. I'll remove the typing group since we already have the extra.

Copy link
Contributor

@NoahStapp NoahStapp Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually typing was not already an extra, not should we make it one. There isn't a way to have dependency groups depend on extras, so we're stuck with the weird incantation stored in the justfile.

@blink1073
Copy link
Member Author

Toggling CI

@blink1073 blink1073 closed this Jan 21, 2025
@blink1073 blink1073 reopened this Jan 21, 2025
@blink1073 blink1073 requested a review from NoahStapp January 22, 2025 02:42
test *args:
{{hatch_bin}} run test:test {{args}}
test *args="-v --durations=5 --maxfail=10":
{{uv_run}} --extra test pytest {{args}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there isn't a test extra, is this --extra test option correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a test extra already. Ideally we'd convert it to a group but that would be a breaking change.

@blink1073 blink1073 requested a review from NoahStapp January 22, 2025 14:16
@blink1073 blink1073 merged commit cfe7784 into mongodb:master Jan 22, 2025
56 of 72 checks passed
@blink1073 blink1073 deleted the PYTHON-4976 branch January 22, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants