Skip to content

Commit

Permalink
Release v0.6.3 (#111)
Browse files Browse the repository at this point in the history
* fixed `Command.get_argument_type` bug with `UnionType`
([#110](#110)). In
this release, the `Command.get_argument_type` method has been updated to
include special handling for `UnionType`, resolving a bug that caused
the function to crash when encountering this type. The method now
returns the string representation of the annotation if the argument is a
`UnionType`, providing more accurate and reliable results. To facilitate
this, modifications were made using the `types` module. Additionally,
the `foo` function has a new optional argument `optional_arg` of type
`str`, with a default value of `None`. This argument is passed to the
`some` function in the assertion. The `Prompts` type has been added to
the `foo` function signature, and an assertion has been added to verify
if `prompts` is an instance of `Prompts`. Lastly, the default value of
the `address` argument has been changed from an empty string to
"default", and the same changes have been applied to the
`test_injects_prompts` test function.
  • Loading branch information
nfx authored May 30, 2024
1 parent 8300dd7 commit 5d65c32
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.6.3

* fixed `Command.get_argument_type` bug with `UnionType` ([#110](https://github.com/databrickslabs/blueprint/issues/110)). In this release, the `Command.get_argument_type` method has been updated to include special handling for `UnionType`, resolving a bug that caused the function to crash when encountering this type. The method now returns the string representation of the annotation if the argument is a `UnionType`, providing more accurate and reliable results. To facilitate this, modifications were made using the `types` module. Additionally, the `foo` function has a new optional argument `optional_arg` of type `str`, with a default value of `None`. This argument is passed to the `some` function in the assertion. The `Prompts` type has been added to the `foo` function signature, and an assertion has been added to verify if `prompts` is an instance of `Prompts`. Lastly, the default value of the `address` argument has been changed from an empty string to "default", and the same changes have been applied to the `test_injects_prompts` test function.


## 0.6.2

* Applied type casting & remove empty kwarg for Command ([#108](https://github.com/databrickslabs/blueprint/issues/108)). A new method, `get_argument_type`, has been added to the `Command` class in the `cli.py` file to determine the type of a given argument name based on the function's signature. The `_route` method has been updated to remove any empty keyword arguments from the `kwargs` dictionary, and apply type casting based on the argument type using the `get_argument_type` method. This ensures that the `kwargs` passed into `App.command` are correctly typed and eliminates any empty keyword arguments, which were previously passed as empty strings. In the test file for the command-line interface, the `foo` command's keyword arguments have been updated to include `age` (int), `salary` (float), `is_customer` (bool), and `address` (str) types, with the `name` argument remaining and a default value for `address`. The `test_commands` and `test_injects_prompts` functions have been updated accordingly. These changes aim to improve the input validation and type safety of the `App.command` method.
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.6.2"
__version__ = "0.6.3"

0 comments on commit 5d65c32

Please sign in to comment.