Repository navigation
Conversation
The `pymongo<4.4.1` constraint was added in the 2024 upgrade from 3.x to 4.4.0 (#35179) to freeze the driver at the version that had been tested. It did not record a known incompatibility with later 4.x releases, and nothing in the pymongo changelog between 4.4 and 4.19 removes an API this codebase uses: https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst Drop the constraint from the hand-maintained `[tool.edx_lint]` uv_constraints lists in the root project and the structures_pruning script, regenerate the derived `constraint-dependencies`, and re-lock with `make upgrade-package package=pymongo`. Only pymongo moves; no other locked package changes. Operational note: pymongo 4.11 dropped MongoDB 3.6, 4.14 dropped 4.0 and 4.18 dropped 4.2, so the driver now requires MongoDB 4.4+. CI and Tutor already run MongoDB 7. Closes #35265 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pymongo 4.9 added a ResourceWarning when a MongoClient is garbage collected without being closed, and these tests were the only ones in the modulestore and contentstore suites that triggered it under `-Wd` after the upgrade to 4.19.0. Register the close as a cleanup so the warnings tracker stays quiet. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the
pymongo<4.4.1constraint and re-locks, which takes pymongo from 4.4.0 to 4.19.0. Nothing else in the lock moves.The pin came from the 3.x to 4.4.0 upgrade in #35179. It froze the driver at the version that had been tested and did not record an incompatibility with anything newer. I went through the pymongo changelog from 4.4 to 4.19 and none of the removals touch APIs we use: https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst. The one operational change is that pymongo 4.18 dropped MongoDB 4.2, so the driver now needs MongoDB 4.4+. CI and Tutor already run MongoDB 7.
Verified locally against mongo:7 with Python 3.12: the xmodule modulestore, contentstore and split_modulestore_django tests under lms settings, the Studio contentstore, asset and import/export tests under cms settings, and the structures_pruning tests including the normally-skipped
TestSplitMongoBackendclass.Not in this PR: three call sites still use APIs that pymongo 4.0 removed, so they have been broken since 4.4.0 and this change does not affect them.
Collection.removeis called inxmodule/contentstore/mongo.pyfrom_drop_databaseand fromremove_redundant_content_for_courses, which backs thecleanup_assetsmanagement command.common/djangoapps/track/backends/mongodb.pycallsensure_indexandinsert(manipulate=False). Their tests are either skipped or mock the client, which is why CI did not catch them. I'll handle those separately.Closes #35265