Releases: databrickslabs/blueprint
Releases · databrickslabs/blueprint
v0.4.0
- Added commands with interactive prompts (#66). This commit introduces a new feature in the Databricks Labs project to support interactive prompts in the command-line interface (CLI) for enhanced user interactivity. The
Prompts
argument, imported fromdatabricks.labs.blueprint.tui
, is now integrated into the@app.command
decorator, enabling the creation of commands with user interaction like confirmation prompts. An example of this is theme
command, which confirms whether the user wants to proceed before displaying the current username. The commit also refactored the code to make it more efficient and maintainable, removing redundancy in creating client instances. TheAccountClient
andWorkspaceClient
instances can now be provided automatically with the product name and version. These changes improve the CLI by making it more interactive, user-friendly, and adaptable to various use cases while also optimizing the codebase for better efficiency and maintainability. - Added more code documentation (#64). This release introduces new features and updates to various files in the open-source library. The
cli.py
file in thesrc/databricks/labs/blueprint
directory has been updated with a new decorator,command
, which registers a function as a command. Theentrypoint.py
file in thedatabricks.labs.blueprint
module now includes a module-level docstring describing its purpose, as well as documentation for the various standard libraries it imports. TheInstallation
class in theinstallers.py
file has new methods for handling files, such asload
,load_or_default
,upload
,load_local
, andfiles
. Theinstallers.py
file also includes a newInstallationState
dataclass, which is used to track installations. Thelimiter.py
file now includes code documentation for theRateLimiter
class and therate_limited
decorator, which are used to limit the rate of requests. Thelogger.py
file includes a newNiceFormatter
class, which provides a nicer format for logging messages with colors and bold text if the console supports it. Theparallel.py
file has been updated with new methods for running tasks in parallel and returning results and errors. TheTUI.py
file has been documented, and includes imports for logging, regular expressions, and collections abstract base class. Lastly, theupgrades.py
file has been updated with additional code documentation and new methods for loading and applying upgrade scripts. Overall, these changes improve the functionality, maintainability, and usability of the open-source library. - Fixed init-project command (#65). In this release, the
init-project
command has been improved with several bug fixes and new functionalities. A new import statement for thesys
module has been added, and adocs
directory is now included in the copied directories and files during initialization. Theinit_project
function has been updated to open files using the default system encoding, ensuring proper reading and writing of file contents. Therelative_paths
function in theentrypoint.py
file now returns absolute paths if the common path is the root directory, addressing issue #41. Additionally, several test functions have been added totests/unit/test_entrypoint.py
, enhancing the reliability and robustness of theinit-project
command by providing comprehensive tests for supporting functions. Overall, these changes significantly improve the functionality and reliability of theinit-project
command, ensuring a more consistent and accurate project initialization process. - Using
ProductInfo
with integration tests (#63). In this update, theProductInfo
class has been enhanced with a new class methodfor_testing(klass)
to facilitate effective integration testing. This method generates a newProductInfo
object with a randomproduct_name
, enabling the creation of distinct installation directories for each test execution. Prior to this change, conflicts and issues could arise when multiple test executions shared the same integration test folder. With the introduction of this new method, developers can now ensure that their integration tests run with unique product names and separate installation directories, enhancing testing isolation and accuracy. This update is demonstrated in the provided code snippet and includes a new test case to confirm the generation of unique product names. Furthermore, a pre-existing test case has been modified to provide a more specific error message related to theSingleSourceVersionError
. This enhancement aims to improve the integration testing capabilities of the codebase and is designed to be easily adopted by other software engineers utilizing this project.
Contributors: @nfx
v0.3.1
- Fixed the order of marshal to handle Dataclass with as_dict before other types to avoid SerdeError (#60). In this release, we have addressed an issue that caused a SerdeError during the installation.save operation with a Dataclass object. The error was due to the order of evaluation in the _marshal_dataclass method. The order has been updated to evaluate the
as_dict
method first if it exists in the Dataclass, which resolves the SerdeError. To ensure the correctness of the fix, we have added a new test_data_class function that tests the save and load functionality with a Dataclass object. The test defines a Policy Dataclass with anas_dict
method that returns a dictionary representation of the object and checks if the file is written correctly and if the loaded object matches the original object. This change has been thoroughly unit tested to ensure that it works as expected.
Contributors: @HariGS-DB
v0.3.0
- Added automated upgrade framework (#50). This update introduces an automated upgrade framework for managing and applying upgrades to the product, with a new
upgrades.py
file that includes aProductInfo
class having methods for version handling, wheel building, and exception handling. The test code organization has been improved, and new test cases, functions, and a directory structure for fixtures and unit tests have been added for the upgrades functionality. Thetest_wheels.py
file now checks the version of the Databricks SDK and handles cases where the version marker is missing or does not contain the__version__
variable. Additionally, a newApplication State Migrations
section has been added to the README, explaining the process of seamless upgrades from version X to version Z through version Y, addressing the need for configuration or database state migrations as the application evolves. Users can apply these upgrades by following an idiomatic usage pattern involving several classes and functions. Furthermore, improvements have been made to the_trim_leading_whitespace
function in thecommands.py
file of thedatabricks.labs.blueprint
module, ensuring accurate and consistent removal of leading whitespace for each line in the command string, leading to better overall functionality and maintainability. - Added brute-forcing
SerdeError
withas_dict()
andfrom_dict()
(#58). This commit introduces a brute-forcing approach for handlingSerdeError
usingas_dict()
andfrom_dict()
methods in an open-source library. The newSomePolicy
class demonstrates the usage of these methods for manual serialization and deserialization of custom classes. Theas_dict()
method returns a dictionary representation of the class instance, and thefrom_dict()
method, decorated with@classmethod
, creates a new instance from the provided dictionary. Additionally, the GitHub Actions workflow for acceptance tests has been updated to include theready_for_review
event type, ensuring that tests run not only for opened and synchronized pull requests but also when marked as "ready for review." These changes provide developers with more control over the deserialization process and facilitate debugging in cases where default deserialization fails, but should be used judiciously to avoid brittle code. - Fixed nightly integration tests run as service principals (#52). In this release, we have enhanced the compatibility of our codebase with service principals, particularly in the context of nightly integration tests. The
Installation
class in thedatabricks.labs.blueprint.installation
module has been refactored, deprecating thecurrent
method and introducing two new methods:assume_global
andassume_user_home
. These methods enable users to install and manageblueprint
as either a global or user-specific installation. Additionally, theexisting
method has been updated to work with the newInstallation
methods. In the test suite, thetest_installation.py
file has been updated to correctly detect global and user-specific installations when running as a service principal. These changes improve the testability and functionality of our software, ensuring seamless operation with service principals during nightly integration tests. - Made
test_existing_installations_are_detected
more resilient (#51). In this release, we have added a new test functiontest_existing_installations_are_detected
that checks if existing installations are correctly detected and retries the test for up to 15 seconds if they are not. This improves the reliability of the test by making it more resilient to potential intermittent failures. We have also added an import fromdatabricks.sdk.retries
namedretried
which is used to retry the test function in case of anAssertionError
. Additionally, the test functiontest_existing
has been renamed totest_existing_installations_are_detected
and thexfail
marker has been removed. We have also renamed the test functiontest_dataclass
totest_loading_dataclass_from_installation
for better clarity. This change will help ensure that the library is correctly detecting existing installations and improve the overall quality of the codebase.
Contributors: @nfx