-
Notifications
You must be signed in to change notification settings - Fork 2.1k
CondaJSONEncoder: support serialising frozendicts
#15532
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
CondaJSONEncoder: support serialising frozendicts
#15532
Conversation
CodSpeed Performance ReportMerging #15532 will not alter performanceComparing Summary
Footnotes
|
|
I looked around on this and learned that it's not actually necessary to add this our Please see the following links for more information:
Conda currently has a requirement of |
|
Do you have any feedback on my comment? Am I correct in thinking that this pull request isn't necessary? |
|
Oh huh, that comment didn't load in the tab I had this issue open before posting my comment. This changes things! Looking at the change upstream, this monkeypatch seems like a pretty bad idea, Marco-Sulla/python-frozendict@ |
|
This makes me want to stop relying on frozendict btw. |
|
I wonder if https://peps.python.org/pep-0814/ goes anywhere and if there are backports? What about https://adamj.eu/tech/2022/01/05/how-to-make-immutable-dict-in-python/ should we simply roll it ourselves? |
My thoughts exactly! 😬 |
Maybe we should just create a separate issue for this work and not merge this pull request? |
|
@kenodegard, maybe you have some thoughts on this. Couldn't help but notice your name as I was skimming through the release notes in |
|
Thanks for the conversation, y'all! For now, I'll remove this change from #15525 and replace it with a |
|
This PR has been superseded by the change I described in #15525 (comment). Thanks, everyone! |
|
I'm reopening this PR as per @beckermr's suggestion in #15525 (comment). The support that |
|
Hi @beckermr, Thanks for chiming in here and looking into this too. I read your feedback over here and think it's reasonable to include this pull request. Inspecting the type here doesn't have a huge cost and we add additional tests to ensure this expect behavior works. Because of those reasons, I'll go ahead merge this pull request. But, with that being said, I think it's worth it to research what we could do instead of relying on a dependency that monkey patches the standard library. I think we can all agree that that's not a good idea, so I will create an issue specifically for that work. |
Description
The
test_remove_all_jsontest, as follows:conda/tests/cli/test_subcommands.py
Lines 160 to 171 in 053ab56
runs
conda remove --all --json. This command callsconda.common.serialize.json.dumps(). However, since there is no native support forfrozendict, the system falls back to the deprecated monkeypatched JSON encoder rather thanCondaJSONEncoder. This is why running this test as part of the suite generates the following warning:This PR adds support for serialising immutable dictionaries in
CondaJSONEncoder. I have separated this change from #15525 (originally #12771) to reduce its diff.Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?Add / update outdated documentation?