36 add save and load methods to serialization manager#51
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the SerializationManager class with file-based model serialization capabilities, introducing save and load methods that support multiple formats (JSON, pickle) with automatic file handling. The implementation includes improved error handling by wrapping converter errors in DeserializationError, comprehensive test coverage for various scenarios, and updated version to 0.1.0-alpha.19.
Key changes:
- Added
saveandloadmethods toSerializationManagerfor direct file I/O operations - Enhanced deserialization error handling with try-catch wrapper for converter errors
- Implemented comprehensive test suite covering both success and error scenarios
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| openmodels/core.py | Added save and load methods with file I/O handling, format detection, and enhanced error wrapping in deserialization |
| test/test_core.py | New comprehensive test suite covering JSON/pickle formats, unsupported formats, serializer errors, invalid data, and I/O failures |
| pyproject.toml | Version bumped from 0.1.0-alpha.18 to 0.1.0-alpha.19 |
| testpypi-badge.json | Version badge updated to 0.1.0a19 |
| README.md | Added documentation section demonstrating the new save/load functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new file-based model serialization and deserialization capabilities to the
SerializationManagerclass, along with robust error handling for file I/O and format support. Additionally, comprehensive tests have been added to validate these new features and edge cases. The version is incremented to reflect these enhancements.Core functionality additions:
saveandloadmethods toSerializationManagerinopenmodels/core.pyfor saving models to and loading models from files in various formats (JSON, pickle), with automatic file extension handling and appropriate file modes.DeserializationErrorfor clearer diagnostics.Testing improvements:
test/test_core.pyto cover saving and loading models in both JSON and pickle formats, handling unsupported formats, serializer errors, invalid data, and file I/O failures.