Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kidoz
Copy link
Contributor

@kidoz kidoz commented Apr 13, 2025

Description

Fixed problem with import uri_parser use pymongo 4.12.0.
Tested on pymongo 4.11.3 and 4.12.0

After update from pymongo 4.11.3 to 4.12.0 catch error:
Unrecoverable error: "AttributeError(\"module 'pymongo' has no attribute 'uri_parser'\")"

Environment:
python = 3.13.3
celery = 5.5.1
pymongo = 4.12.0

Poetry dependencies

In pymongo 4.12.0 done refactoring in pymongo/uri_parser.py and current usage like pymongo.uri_parser.parse_uri no longer possible.

Change diff:
mongodb/mongo-python-driver@eea8a37#diff-94ba1ecd40164fbb00e68b591c84061cce84aecb227ab3ed247f00d888f289b0

@codecov
Copy link

codecov bot commented Apr 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.68%. Comparing base (2aebae5) to head (752f709).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9665   +/-   ##
=======================================
  Coverage   78.68%   78.68%           
=======================================
  Files         153      153           
  Lines       19312    19313    +1     
  Branches     2214     2214           
=======================================
+ Hits        15195    15197    +2     
  Misses       3817     3817           
+ Partials      300      299    -1     
Flag Coverage Δ
unittests 78.66% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nusnus Nusnus self-requested a review April 13, 2025 22:40
@kidoz kidoz changed the title Add support pymongo 3.12 Add support pymongo 4.12 Apr 14, 2025
@kidoz kidoz force-pushed the bugfix/pymongo-4.12-support branch from 324bfb7 to ee27d0f Compare April 14, 2025 11:55
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

Can you please pin your dependencies with exact version of celery? the latest version should drop python 3.8 support if I am not wrong. we should wait before moving with this.

@kidoz
Copy link
Contributor Author

kidoz commented Apr 16, 2025

Can you please pin your dependencies with exact version of celery? the latest version should drop python 3.8 support if I am not wrong. we should wait before moving with this.

Add Poetry dependencies

Copy link
Member

@Nusnus Nusnus left a comment

Choose a reason for hiding this comment

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

@auvipy

the latest version should drop python 3.8 support if I am not wrong. we should wait before moving with this.

This change appears to fix a semantic issue. Why should we wait with it?

@Nusnus Nusnus force-pushed the bugfix/pymongo-4.12-support branch from ee27d0f to f32957b Compare April 18, 2025 01:01
@auvipy
Copy link
Member

auvipy commented Apr 24, 2025

@auvipy

the latest version should drop python 3.8 support if I am not wrong. we should wait before moving with this.

This change appears to fix a semantic issue. Why should we wait with it?

because it is relevant only when we upgrade to pymongo 4.12

After update from pymongo 4.11.3 to 4.12.0 catch error:
Unrecoverable error: "AttributeError("module 'pymongo' has no attribute 'uri_parser'")"

@Nusnus Nusnus force-pushed the bugfix/pymongo-4.12-support branch from 232b980 to 7bbddd1 Compare May 31, 2025 16:42
@Nusnus Nusnus marked this pull request as draft July 9, 2025 18:42
@auvipy auvipy added this to the 5.7.0 milestone Aug 10, 2025
@auvipy auvipy requested a review from Copilot October 9, 2025 06:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a compatibility issue with pymongo 4.12.0 by adjusting how the uri_parser module is imported. In pymongo 4.12.0, the uri_parser is no longer accessible as a submodule of the main pymongo package due to internal refactoring.

  • Updates import strategy to directly import uri_parser from pymongo
  • Changes usage from pymongo.uri_parser.parse_uri() to uri_parser.parse_uri()

@auvipy auvipy modified the milestones: 5.7.0, 5.6.0 Oct 9, 2025
@auvipy auvipy requested a review from Copilot October 9, 2025 18:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@auvipy auvipy marked this pull request as ready for review October 9, 2025 18:32
@auvipy auvipy modified the milestones: 5.6.0, 5.7.0 Oct 12, 2025
@auvipy auvipy merged commit 0a45509 into celery:main Oct 28, 2025
107 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants