-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove Python 2 compatibility SON methods #2548
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
base: master
Are you sure you want to change the base?
Conversation
The encryption failure is because you're missing c0e0554. Can you please pull from |
Merge commits are fine, we squash on merge. |
Since this is a breaking API change, we can't merge this until we plan a pymongo 5.0 release. What's the motivation here? These methods don't add any maintenance burden so I'm inclined to keep them so that we don't break applications. |
Python 3.0 [removed `dict.has_key()`](https://docs.python.org/3/whatsnew/3.0.html#views-and-iterators-instead-of-lists:~:text=Removed%2E%20dict%2Ehas%5Fkey%28%29) and [the `dict.iter*()` methods](https://docs.python.org/3/whatsnew/3.0.html#views-and-iterators-instead-of-lists:~:text=Also%2C%20the%20dict%2Eiterkeys%28%29%2C%20dict%2Eiteritems%28%29%20and%20dict%2Eitervalues%28%29%20methods%20are%20no%20longer%20supported). fcedc51 removed `SON.iteritems()` to align with its removal in Python 3. This commit cleans up by removing the remaining compatibility methods: `has_key()`, `iterkeys()`, and `itervalues()`.
41139ea
to
f105dce
Compare
Hi @ShaneHarvey I emailed @blink1073 , @NoahStapp and @aclark4life as maintainers because I saw they had recent commits, but missed you. I'm working on optimizing my client Rippling's MongoDB-based Django codebase, which uses a private fork of mongoengine, which is backed by pymongo. This change in particular was a kind of warmup. I would like to make I thought on the way, we could clear out these compatibility methods. I totally understand if you want to make that a major version bump, in which case I can work on making |
We previously considered making SON inherit from dict but we rejected that approach because the risk of breaking user applications is too high. Instead users are expected to switch from SON to dict themselves. Perhaps we should update mongoengine to replace SON with dict instead? That would have a smaller "blast radius". |
We aren't planning on doing a 5.0 release anytime soon so I don't think it's worthwhile to work on this at this time. Next steps would be to consider changing mongoengine to replace SON with dict (MongoEngine/mongoengine#2898), updating our SON docs to discourage new applications from using it, and maybe opening a new ticket to track revisiting SON->dict change in our next major release. |
Also if it's possible to optimize SON without any breaking changes that could be worthwhile. |
Python 3.0 removed
dict.has_key()
and thedict.iter*()
methods.fcedc51 removed
SON.iteritems()
to align with its removal in Python 3. This commit cleans up by removing the remaining compatibility methods:has_key()
,iterkeys()
, anditervalues()
.