Skip to content

Commit

Permalink
Release v0.4.2 (#75)
Browse files Browse the repository at this point in the history
* Fixed edge cases when loading typing.Dict, typing.List and
typing.ClassVar
([#74](#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.
* `MockPrompts.extend()` now returns a copy
([#72](#72)). In the
latest release, the `extend()` method in the `MockPrompts` class of the
`tui.py` module has been enhanced. Previously, `extend()` would modify
the original `MockPrompts` object, which could lead to issues when
reusing the same object in multiple places within the same test, as its
state would be altered each time `extend()` was called. This has been
addressed by updating the `extend()` method to return a copy of the
`MockPrompts` object with the updated patterns and answers, instead of
modifying the original object. This change ensures that the original
`MockPrompts` object can be securely reused in multiple test scenarios
without unintended side effects, preserving the integrity of the
original state. Furthermore, additional tests have been incorporated to
verify the correct behavior of both the new and original prompts.
  • Loading branch information
nfx authored Mar 15, 2024
1 parent bf42713 commit 942c52e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Version changelog

## 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.
* `MockPrompts.extend()` now returns a copy ([#72](https://github.com/databrickslabs/blueprint/issues/72)). In the latest release, the `extend()` method in the `MockPrompts` class of the `tui.py` module has been enhanced. Previously, `extend()` would modify the original `MockPrompts` object, which could lead to issues when reusing the same object in multiple places within the same test, as its state would be altered each time `extend()` was called. This has been addressed by updating the `extend()` method to return a copy of the `MockPrompts` object with the updated patterns and answers, instead of modifying the original object. This change ensures that the original `MockPrompts` object can be securely reused in multiple test scenarios without unintended side effects, preserving the integrity of the original state. Furthermore, additional tests have been incorporated to verify the correct behavior of both the new and original prompts.


## 0.4.1

* Fixed `MockInstallation` to emulate workspace-global setup ([#69](https://github.com/databrickslabs/blueprint/issues/69)). In this release, the `MockInstallation` class in the `installation` module has been updated to better replicate a workspace-global setup, enhancing testing and development accuracy. The `is_global` method now utilizes the `product` method instead of `_product`, and a new instance variable `_is_global` with a default value of `True` is introduced in the `__init__` method. Moreover, a new `product` method is included, which consistently returns the string "mock". These enhancements resolve issue [#69](https://github.com/databrickslabs/blueprint/issues/69), "Fixed `MockInstallation` to emulate workspace-global setup", ensuring the `MockInstallation` instance behaves as a global installation, facilitating precise and reliable testing and development for our software engineering team.
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.1"
__version__ = "0.4.2"

0 comments on commit 942c52e

Please sign in to comment.