Skip to content

Commit

Permalink
Release v0.4.3 (#77)
Browse files Browse the repository at this point in the history
* Fixed marshalling & unmarshalling edge cases
([#76](#76)). The
serialization and deserialization methods in the code have been updated
to improve handling of edge cases during marshalling and unmarshalling
of data. When encountering certain edge cases, the `_marshal_list`
method will now return an empty list instead of None, and both the
`_unmarshal` and `_unmarshal_dict` methods will return None as is if the
input is None. Additionally, the `_unmarshal` method has been updated to
call `_unmarshal_generic` instead of checking if the type reference is a
dictionary or list when it is a generic alias. The `_unmarshal_generic`
method has also been updated to handle cases where the input is None. A
new test case, `test_load_empty_data_class()`, has been added to the
`tests/unit/test_installation.py` file to verify this behavior, ensuring
that the correct behavior is maintained when encountering these edge
cases during the marshalling and unmarshalling processes. These changes
increase the reliability of the serialization and deserialization
processes.
  • Loading branch information
nfx authored Mar 15, 2024
1 parent 76b778a commit d2ed60f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Version changelog

## 0.4.3

* Fixed marshalling & unmarshalling edge cases ([#76](https://github.com/databrickslabs/blueprint/issues/76)). The serialization and deserialization methods in the code have been updated to improve handling of edge cases during marshalling and unmarshalling of data. When encountering certain edge cases, the `_marshal_list` method will now return an empty list instead of None, and both the `_unmarshal` and `_unmarshal_dict` methods will return None as is if the input is None. Additionally, the `_unmarshal` method has been updated to call `_unmarshal_generic` instead of checking if the type reference is a dictionary or list when it is a generic alias. The `_unmarshal_generic` method has also been updated to handle cases where the input is None. A new test case, `test_load_empty_data_class()`, has been added to the `tests/unit/test_installation.py` file to verify this behavior, ensuring that the correct behavior is maintained when encountering these edge cases during the marshalling and unmarshalling processes. These changes increase the reliability of the serialization and deserialization processes.


## 0.4.2

* Fixed edge cases when loading typing.Dict, typing.List and typing.ClassVar ([#74](https://github.com/databrickslabs/blueprint/issues/74)). In this release, we have implemented changes to improve the handling of edge cases related to the Python `typing.Dict`, `typing.List`, and `typing.ClassVar` during serialization and deserialization of dataclasses and generic types. Specifically, we have modified the `_marshal` and `_unmarshal` functions to check for the `__origin__` attribute to determine whether the type is a `ClassVar` and skip it if it is. The `_marshal_dataclass` and `_unmarshal_dataclass` functions now check for the `__dataclass_fields__` attribute to ensure that only dataclass fields are marshaled and unmarshaled. We have also added a new unit test for loading a complex data class using the `MockInstallation` class, which contains various attributes such as a string, a nested dictionary, a list of `Policy` objects, and a dictionary mapping string keys to `Policy` objects. This test case checks that the installation object correctly serializes and deserializes the `ComplexClass` instance to and from JSON format according to the specified attribute types, including handling of the `typing.Dict`, `typing.List`, and `typing.ClassVar` types. These changes improve the reliability and robustness of our library in handling complex data types defined in the `typing` module.
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/labs/blueprint/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.2"
__version__ = "0.4.3"

0 comments on commit d2ed60f

Please sign in to comment.