Skip to content

Conversation

@sleepyStick
Copy link
Contributor

@sleepyStick sleepyStick commented Jun 30, 2025

  • Added a function _make_options_case_sensitive that takes in uri options _CaseInsensitiveDictionary and returns it in proper case sensitive plain dict form. Any keys in the original _CaseInsensitiveDictionary that aren't in the set of properly cased option names are put into the plain dict as is.
  • unified tests convert options back to _CaseInsensitiveDictionary for key comparison reasons.
  • parse_uri now returns "options" as a plain dict:
>>> from pymongo.uri_parser import parse_uri
>>> options = parse_uri("mongodb://localhost/?retryWrites=true&retryreads=true")["options"]
>>> options
{'retryWrites': True, 'retryReads': True}
>>> type(options)
<class 'dict'>

@sleepyStick sleepyStick marked this pull request as ready for review July 2, 2025 16:18
@sleepyStick sleepyStick requested a review from a team as a code owner July 2, 2025 16:18
@sleepyStick sleepyStick requested a review from aclark4life July 2, 2025 16:18
Copy link
Contributor

@aclark4life aclark4life left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@sleepyStick sleepyStick merged commit 947fbe3 into mongodb:master Jul 2, 2025
78 of 80 checks passed
Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

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

Please add a changelog entry and a ..versionchanged to parse_uri to describe the breaking change. Also, do we have a test that verifies options is returned as a dict and not a custom class?

@aclark4life
Copy link
Contributor

@ShaneHarvey @sleepyStick Sorry I missed that!

@sleepyStick
Copy link
Contributor Author

Please add a changelog entry and a ..versionchanged to parse_uri to describe the breaking change. Also, do we have a test that verifies options is returned as a dict and not a custom class?

Going to make a follow up PR for these changes!

cjwatson added a commit to cjwatson/celery that referenced this pull request Oct 27, 2025
mongodb/mongo-python-driver#2413 caused some
test regressions here.  This isn't currently a problem for the upstream
test suite since it pins pymongo==4.10.1 via kombu, but we're running
into it in Debian where we've already upgraded pymongo for other
reasons.  kombu already tried to upgrade pymongo but had to revert due
to these test regressions (see celery/kombu#2384
and celery#9938).

One of the test fixes (relating to `mongodb_backend_settings`)
illustrates an incompatibility where I couldn't figure out a reasonable
way to avoid passing it through to Celery users, so I added a note to
the documentation about it.  It may also be worth including a brief
mention of it in the release notes.  Using the canonical case for the
option in question should work with both old and new versions of
pymongo.
cjwatson added a commit to cjwatson/celery that referenced this pull request Oct 27, 2025
mongodb/mongo-python-driver#2413 caused some
test regressions here.  This isn't currently a problem for the upstream
test suite since it pins pymongo==4.10.1 via kombu, but we're running
into it in Debian where we've already upgraded pymongo for other
reasons.  kombu already tried to upgrade pymongo but had to revert due
to these test regressions (see celery/kombu#2384
and celery#9938).

One of the test fixes (relating to `mongodb_backend_settings`)
illustrates an incompatibility where I couldn't figure out a reasonable
way to avoid passing it through to Celery users, so I added a note to
the documentation about it.  It may also be worth including a brief
mention of it in the release notes.  Using the canonical case for the
option in question should work with both old and new versions of
pymongo.
Nusnus pushed a commit to cjwatson/celery that referenced this pull request Oct 27, 2025
mongodb/mongo-python-driver#2413 caused some
test regressions here.  This isn't currently a problem for the upstream
test suite since it pins pymongo==4.10.1 via kombu, but we're running
into it in Debian where we've already upgraded pymongo for other
reasons.  kombu already tried to upgrade pymongo but had to revert due
to these test regressions (see celery/kombu#2384
and celery#9938).

One of the test fixes (relating to `mongodb_backend_settings`)
illustrates an incompatibility where I couldn't figure out a reasonable
way to avoid passing it through to Celery users, so I added a note to
the documentation about it.  It may also be worth including a brief
mention of it in the release notes.  Using the canonical case for the
option in question should work with both old and new versions of
pymongo.
cjwatson added a commit to cjwatson/celery that referenced this pull request Oct 27, 2025
mongodb/mongo-python-driver#2413 caused some
test regressions here.  This isn't currently a problem for the upstream
test suite since it pins pymongo==4.10.1 via kombu, but we're running
into it in Debian where we've already upgraded pymongo for other
reasons.  kombu already tried to upgrade pymongo but had to revert due
to these test regressions (see celery/kombu#2384
and celery#9938).

One of the test fixes (relating to `mongodb_backend_settings`)
illustrates an incompatibility where I couldn't figure out a reasonable
way to avoid passing it through to Celery users, so I added a note to
the documentation about it.  It may also be worth including a brief
mention of it in the release notes.  Using the canonical case for the
option in question should work with both old and new versions of
pymongo.
auvipy added a commit to celery/celery that referenced this pull request Oct 28, 2025
mongodb/mongo-python-driver#2413 caused some
test regressions here.  This isn't currently a problem for the upstream
test suite since it pins pymongo==4.10.1 via kombu, but we're running
into it in Debian where we've already upgraded pymongo for other
reasons.  kombu already tried to upgrade pymongo but had to revert due
to these test regressions (see celery/kombu#2384
and #9938).

One of the test fixes (relating to `mongodb_backend_settings`)
illustrates an incompatibility where I couldn't figure out a reasonable
way to avoid passing it through to Celery users, so I added a note to
the documentation about it.  It may also be worth including a brief
mention of it in the release notes.  Using the canonical case for the
option in question should work with both old and new versions of
pymongo.

Co-authored-by: Asif Saif Uddin {"Auvi":"অভি"} <auvipy@gmail.com>
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.

3 participants