RocketPy
RocketPy copied to clipboard
ENH: Discretized and No-Pickle Encoding Options
Pull request type
- [X] Code changes (bugfix, features)
Checklist
- [X] Tests for the changes have been added (if needed)
- [X] Docs have been reviewed and added / updated
- [X] Lint (
black rocketpy/ tests/) has passed locally - [X] All tests (
pytest tests -m slow --runslow) have passed locally - [X]
CHANGELOG.mdhas been updated
Current behavior
The standard RocketPyEncoder currently does not support custom options for users/clients that may have the following needs:
- Discrete encoding: as documented, this is useful to have the
callabledefinedFunctionswritten out in a human readable format. Of course, this has the drawback that the originalcallablecannot be exactly reproduced on decoding; - No-Pickle encoding: as it is common on I/O libraries/functions (e.g. NumPy save) having a toggle for pickling is beneficial for allowing the user/client having better control of security and output size (pickled objects might get large). This specially useful if there is no interest in decoding the result.
New behavior
The added options discretize and pickle_callables (I am considering change the name to allow_pickle for consistency with other libraries) work as described above. The biggest challenge of the PR (which required a bit of hard coding) was setting discretization bounds for some of RocketPy callable Functions.
Breaking change
- [ ] Yes
- [X] No