-
Notifications
You must be signed in to change notification settings - Fork 70
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 plain msgpack serialization #267
Conversation
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.
may want to look at the below if haven't already:
- https://github.com/MolSSI/QCElemental/blob/master/qcelemental/models/molecule.py#L983
- https://github.com/MolSSI/QCElemental/blob/master/qcelemental/tests/test_molecule.py#L209 (those
to_file
look likedtype=dtype
needed) - https://github.com/MolSSI/QCElemental/blob/master/qcelemental/tests/test_molecule.py#L240
- https://github.com/MolSSI/QCElemental/blob/master/qcelemental/util/__init__.py#L28
Added to the init file and fixed the test. I guess I didn't need to fix the test, since For the to/from file, I removed the |
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.
how're these for a sol'n? I'm trying to avoid changing current behavior.
if you date the v0.21 release in changelog, I won't have to make an extra PR
Co-authored-by: Lori A. Burns <[email protected]>
elif dtype == "msgpack-ext": | ||
with open(filename, "rb") as infile_bytes: | ||
data = deserialize(infile_bytes.read(), encoding="msgpack-ext") | ||
dtype = "dict" |
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.
since for reading json=json-ext and msgpack=msgpack-ext, aren't only 2 if's needed?
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.
Yes, although we should make it explicit. Ie, for json, use json-ext
and for msgpack
, use msgpack-ext
(with comment that the -ext
are backwards compatible)
Description
Adds ability to serialize to plain msgpack format.
The current
msgpack-ext
encoding serializes numpy arrays as numpy arrays, which is not portable (that is, deserializing would require python and qcelemental). This adds a plainmsgpack
encoding that converts numpy arrays to lists, as is done with the existingjson
encoding.Changelog description
Adds plain msgpack serialization
Status