-
Notifications
You must be signed in to change notification settings - Fork 111
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
Remove simplejson
in favor of using json
#7035
Remove simplejson
in favor of using json
#7035
Conversation
This commit removes `simplejson` dependency in favor of the built-in `json`-module. Encoding is now a property of the streams and not the encoder.
This commit removes a call to `json_loads()`, which has been removed during deprecation and moving of core-metadata code to `datalad-deprecated`.
This commit fixes the test that verifies the command group names. It basically adapts the verified command group names to the changes from 8decbdc
Codecov ReportBase: 75.23% // Head: 76.00% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #7035 +/- ##
==========================================
+ Coverage 75.23% 76.00% +0.76%
==========================================
Files 357 357
Lines 59213 59291 +78
Branches 6615 6615
==========================================
+ Hits 44551 45063 +512
+ Misses 14646 14212 -434
Partials 16 16
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Is there comment in commit where we started to use simplejson - was there some specific reason or it was so long ago that there were no built in json? |
Yes, there are two: The first
I think at least since python 3.6, utf-8 encoded JSON should be properly handled by the built-in json-module The secondIn
I am not sure if the comment is still true/valid. |
# simply mirrored for now | ||
from simplejson import loads as json_loads | ||
from simplejson import JSONDecodeError | ||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To minimize impact and possibly avoid some part of this PR diff I would have:
import json | |
import json | |
from json import JSONDecodeError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would not be sufficient. There would need to be replacements for jsonload
, jsondump
, json_loads
too.
I personally think a clean cut is better than yet another intermediate import target to preserve forever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thx!
My memory also confirms that the reason for simplejson
was UTF handling with PY2. No longer a necessity.
# simply mirrored for now | ||
from simplejson import loads as json_loads | ||
from simplejson import JSONDecodeError | ||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would not be sufficient. There would need to be replacements for jsonload
, jsondump
, json_loads
too.
I personally think a clean cut is better than yet another intermediate import target to preserve forever.
Code Climate has analyzed commit 5f247b9 and detected 0 issues on this pull request. View more on Code Climate. |
PR released in |
Fixes issue #7034
This PR removes
simplejson
in favor of the "builtin"json
-module.Remark: this changes are also contained in PR #7014
In addition this PR fixes the test
datalad.cli.tests.test_main.test_help_np
, by adapting the group names used in the test to the group names of the command groups.Changelog
🪓 Deprecations and removals
simplejson
withjson
and removesimplejson