Repository navigation
Trim PyMongo 4.18 wheel size for the Agent - #25548
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
evalya-impact-summaryevalya impact analysis |
Co-authored-by: Cursor <cursoragent@cursor.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1da46a230
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "/pymongo/asynchronous/", | ||
| "/gridfs/", |
There was a problem hiding this comment.
Preserve PyMongo's public async and GridFS modules
When a third-party or custom Agent check uses gridfs or pymongo.AsyncMongoClient, these exclusions turn the shipped pymongo==4.18.2 wheel into an incomplete distribution and make those documented imports fail. Declaring PyMongo as a dependency does not reliably repair this because package installers see the same version as already installed; the repo-wide absence of built-in call sites cannot establish that external checks do not use these public APIs. Avoid deleting these modules from the shared wheel.
Useful? React with 👍 / 👎.
Validation ReportAll 21 validations passed. Show details
|
781c213
into
zhengda.lu/mongodb-9-support
What does this PR do?
Reduces the installed size of PyMongo 4.18.2 in the Agent from 3.47 MiB to about 1.9 MiB on linux x86_64, slightly below the 1.77 MiB of PyMongo 4.8.0 plus the new SRV public suffix list. This PR targets #25517.
_cmessageand_cbsonwith DWARF debug info (about 0.7 MiB on x86_64 and 1 MiB on aarch64); building with ourLDFLAGS=-Wl,--strip-debugremoves it. This is how 4.8.0 was already built, since it had no cp313 wheel on PyPI.pymongo/asynchronous/andgridfs/from the packaged wheel (about 0.9 MiB on every platform), along with the three lines that importpymongo.asynchronouseagerly. No integration usesAsyncMongoClientor GridFS, and the sync client does not depend on either package.Motivation
The PyMongo upgrade in #25517 increases the Agent's on-disk size enough to fail the static quality gates. Most of the increase comes from upstream shipping both a sync and an async copy of the client since 4.9, and from unstripped extensions in the PyPI wheels.
Validated by running the builder's
clean_wheelon the 4.18.2 wheel and by exercising the trimmed, stripped install against MongoDB 8.0 on linux/amd64: connect, insert, count, index creation,explain,$currentOp,$indexStats,collStats, andlistDatabases, with the C extensions loaded and themongodb+srvresolver importable. Dependency resolution needs to rerun on this branch to rebuild the wheels and update the lockfiles.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged