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
Codecov Report
Attention: Patch coverage is 90.27027% with 18 lines in your changes missing coverage. Please review.
Project coverage is 80.11%. Comparing base (
f17893b) to head (7f8c3c2). Report is 6 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #827 +/- ##
===========================================
+ Coverage 80.02% 80.11% +0.09%
===========================================
Files 98 98
Lines 12004 12115 +111
===========================================
+ Hits 9606 9706 +100
- Misses 2398 2409 +11
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.