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

Add orjson options in JSONStore #791

Merged
merged 5 commits into from
May 29, 2023
Merged

Conversation

gpetretto
Copy link
Contributor

orjson, used for serialization in JSONStore, supports different options for serialization. This PR adds the possibility to pass down the option and default keywords for serialization, that allow to tune orjson's serialization behaviour.
In my case, I need to serialize the output of an atomate calculation and it contains FloatWithUnit, which is subclass of float and as such is not handled by orjson (ijl/orjson#114).

I have also fixed the close method of the GridFSStore, that was raising an exception.

Contributor Checklist

  • I have run the tests locally and they passed.
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

@gpetretto
Copy link
Contributor Author

I needed to bump orjson version, since the options were not available in the older version.

I have also noted that the fix in the GridFSStore should solve #733

@codecov
Copy link

codecov bot commented May 29, 2023

Codecov Report

Patch coverage: 88.88% and project coverage change: +0.07 🎉

Comparison is base (99e03db) 88.56% compared to head (4fa1424) 88.63%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #791      +/-   ##
==========================================
+ Coverage   88.56%   88.63%   +0.07%     
==========================================
  Files          43       43              
  Lines        3323     3326       +3     
==========================================
+ Hits         2943     2948       +5     
+ Misses        380      378       -2     
Impacted Files Coverage Δ
src/maggma/stores/gridfs.py 94.14% <80.00%> (+1.10%) ⬆️
src/maggma/stores/mongolike.py 88.25% <100.00%> (+0.06%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@munrojm
Copy link
Member

munrojm commented May 29, 2023

Looks great! Thank you for this as well.

@munrojm munrojm merged commit 359ffb2 into materialsproject:main May 29, 2023
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.

2 participants