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

Support pymongo 4 #60

Merged
merged 3 commits into from
Aug 1, 2024
Merged

Support pymongo 4 #60

merged 3 commits into from
Aug 1, 2024

Conversation

dill0wn
Copy link
Collaborator

@dill0wn dill0wn commented Jun 26, 2024

This was motivated by this issue #48 requesting pymongo v4 support. This PR lays the groundwork for the upgrade to pymongo4, but it stops short of actually bumping the package.

I followed pymongo's migration guide to see what was removed or deprecated then updated everything relevant in Ming. pymongo has backported many of their API changes to pymongo3 therefore I think this work should be representative.

That said, I'm sure more issues will crop up once we actually update to pymongo4, but that can be a separate chunk of work.

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

Attention: Patch coverage is 95.59165% with 19 lines in your changes missing coverage. Please review.

Project coverage is 91.10%. Comparing base (637a033) to head (7e42e85).
Report is 8 commits behind head on master.

Files Patch % Lines
ming/session.py 80.48% 8 Missing ⚠️
ming/mim.py 94.50% 5 Missing ⚠️
ming/odm/odmsession.py 54.54% 5 Missing ⚠️
ming/odm/mapper.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #60      +/-   ##
==========================================
+ Coverage   90.19%   91.10%   +0.90%     
==========================================
  Files          43       43              
  Lines        6724     6702      -22     
==========================================
+ Hits         6065     6106      +41     
+ Misses        659      596      -63     
Flag Coverage Δ
tests-3.10 91.29% <95.59%> (+0.91%) ⬆️
tests-3.11 91.29% <95.59%> (+0.91%) ⬆️
tests-3.12 91.29% <95.59%> (?)
tests-3.7 ?
tests-3.8 91.10% <95.59%> (+0.90%) ⬆️
tests-3.9 91.10% <95.59%> (+0.90%) ⬆️
tests-pypy3.9 91.23% <95.59%> (+0.90%) ⬆️

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.

Copy link
Collaborator

@brondsem brondsem left a comment

Choose a reason for hiding this comment

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

Wow what a great amount of work. It seems real good. I've posted some specific feedback, and then lets also do additional testing before we merge and release. E.g. testing with codebases that use Ming, and with pymongo actually upgraded to v4

docs/src/ming_odm_tutorial.py Outdated Show resolved Hide resolved
ming/mim.py Outdated Show resolved Hide resolved
ming/metadata.py Show resolved Hide resolved
ming/mim.py Outdated Show resolved Hide resolved
ming/odm/mapper.py Outdated Show resolved Hide resolved
ming/session.py Outdated Show resolved Hide resolved
ming/tests/test_mim.py Outdated Show resolved Hide resolved
ming/mim.py Show resolved Hide resolved
ming/mim.py Outdated Show resolved Hide resolved
@dill0wn dill0wn force-pushed the dw/pymongo4-prep branch 3 times, most recently from 801c5be to d2bf051 Compare July 9, 2024 21:46
@brondsem
Copy link
Collaborator

All the code changes look good. Lets continue to test with more codebases and maybe pymongo 4 itself, before merging.

@@ -193,16 +193,16 @@ class _ClassManager(Generic[M]):
def remove(self, spec_or_id: Union[MongoFilter, ObjectId] = None, **kwargs) -> ChangeResult: ...
def count(self) -> int: ...
def update_partial(self, filter: MongoFilter, fields: dict, **kwargs) -> ChangeResult: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

ChangeResult is an alias for dict (above). This should be updated to pymongo UpdateResult and DeleteResult

@brondsem brondsem changed the title Prepare for pymongo 4 upgrade Support pymongo 4 Aug 1, 2024
@brondsem brondsem merged commit 2965fdf into TurboGears:master Aug 1, 2024
14 checks passed
@brondsem brondsem mentioned this pull request Aug 1, 2024
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