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

Directly expose serialization function #449

Open
mtreinish opened this issue Aug 24, 2023 · 1 comment
Open

Directly expose serialization function #449

mtreinish opened this issue Aug 24, 2023 · 1 comment

Comments

@mtreinish
Copy link
Contributor

mtreinish commented Aug 24, 2023

It would be really nice if the serialization functions used internally by the pickle support were exposed as direct functions. Basically I have a use case where I'd like to serialize the raw parameter expressions without using pickle. I can implement this currently by doing something like:

import symengine
from symengine.lib.symengine_wrapper import load_basic

input_expression = symengine.Symbol('x') * 2
data = input_expression.__reduce__()[1][0]
loaded_expression = load_basic(data)

But it feels weird to use explicitly internal functions and dunders like this to get the serialization like this. It would be great if there were public functions exposed to do this.

I'd be glad to contribute this if it's something that people agree with.

@isuruf
Copy link
Member

isuruf commented Aug 24, 2023

Sure. A corresponding save_basic makes sense.

mtreinish added a commit to mtreinish/symengine.py that referenced this issue Sep 5, 2023
This commit adds a standalone serialization function to the symengine
wrapper module. Previously there was a load_basic() function that could
be used for directly deserializing the payload without going through
pickle, but no corresponding function for serialization. A new function
save_basic() is added here to perform this function which will enable
users to directly roundtrip symengine objects through binary
serialization.

Fixes symengine#449
mtreinish added a commit to mtreinish/symengine.py that referenced this issue Sep 5, 2023
This commit adds a standalone serialization function to the symengine
wrapper module. Previously there was a load_basic() function that could
be used for directly deserializing the payload without going through
pickle, but no corresponding function for serialization. A new function
save_basic() is added here to perform this function which will enable
users to directly roundtrip symengine objects through binary
serialization.

Fixes symengine#449
mtreinish added a commit to mtreinish/symengine.py that referenced this issue Sep 5, 2023
This commit adds a standalone serialization function to the symengine
wrapper module. Previously there was a load_basic() function that could
be used for directly deserializing the payload without going through
pickle, but no corresponding function for serialization. A new function
save_basic() is added here to perform this function which will enable
users to directly roundtrip symengine objects through binary
serialization.

Fixes symengine#449
mtreinish added a commit to mtreinish/symengine.py that referenced this issue Sep 5, 2023
This commit adds a standalone serialization function to the symengine
wrapper module. Previously there was a load_basic() function that could
be used for directly deserializing the payload without going through
pickle, but no corresponding function for serialization. A new function
save_basic() is added here to perform this function which will enable
users to directly roundtrip symengine objects through binary
serialization.

Fixes symengine#449
mtreinish added a commit to mtreinish/symengine.py that referenced this issue Sep 5, 2023
This commit adds a standalone serialization function to the symengine
wrapper module. Previously there was a load_basic() function that could
be used for directly deserializing the payload without going through
pickle, but no corresponding function for serialization. A new function
save_basic() is added here to perform this function which will enable
users to directly roundtrip symengine objects through binary
serialization.

Fixes symengine#449
mtreinish added a commit to mtreinish/symengine.py that referenced this issue Sep 5, 2023
This commit adds a standalone serialization function to the symengine
wrapper module. Previously there was a load_basic() function that could
be used for directly deserializing the payload without going through
pickle, but no corresponding function for serialization. A new function
save_basic() is added here to perform this function which will enable
users to directly roundtrip symengine objects through binary
serialization.

Fixes symengine#449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants