Releases: databrickslabs/blueprint
Releases · databrickslabs/blueprint
v0.9.1
- Bump actions/checkout from 4.1.7 to 4.2.0 (#149). In this pull request, the
actions/checkoutdependency is upgraded from version 4.1.7 to 4.2.0 in theacceptance.ymlanddownstreams.ymlworkflow files. The new version provides additional Ref and Commit outputs, as well as updated dependencies, which aim to improve the functionality and security of the checkout process. TheRefoutput is a string representing the reference that was checked out, and theCommitoutput is the SHA-1 hash of the checked-out commit. Dependency updates include bumping thebracespackage from 3.0.2 to 3.0.3 and updating the minor-npm-dependencies group across one directory with four updates. These changes contribute to a more reliable and efficient checkout process and enhance the overall functionality and maintainability of the Action. Software engineers are recommended to review the changes and ensure they do not introduce conflicts with their current setup before adopting the new version. - Bump actions/checkout from 4.2.0 to 4.2.1 (#152). In this update, the version of the
actions/checkoutGitHub Action is bumped from 4.2.0 to 4.2.1 in a project's GitHub workflow files. This new version includes a modification to check out otherrefs/*by commit if provided, falling back to the ref. This change enhances the flexibility of thecheckoutaction in handling different types of references, which could be useful for users working with multiple branches or references in their workflows. The update also adds a workflow file for publishing releases to an immutable action package. This release was contributed by the new project collaborator, @orhantoy, who made the change in pull request 1924. - Bump databrickslabs/sandbox from acceptance/v0.3.0 to 0.3.1 (#155). In this update, the dependency for
databrickslabs/sandboxhas been bumped from versionacceptance/v0.3.0to0.3.1. This change includes bug fixes, upgrades to go-git libraries, and dependency updates. Thegolang.org/x/cryptolibrary was specifically bumped from version0.16.0to0.17.0in both/go-libsand/runtime-packages. Additionally, thecac167bcommit expanded acceptance test logs and introduced experimental OIDC refresh token rotation. The acceptance test job in the workflow was also updated to use the new version ofdatabrickslabs/sandbox. Ignore conditions were added for previous versions ofdatabrickslabs/sandboxin this release. The README was also modified, and install instructions were added to the changelog. - Catch all errors when checking Databricks path, notably BadRequest ones (#156). This commit introduces improvements to the error handling of the
existsmethod in thepaths.pyfile when checking Databricks path. Previously, onlyNotFounderrors were caught, but nowBadRequesterrors are also handled, addressing issue #2882. Theexistsmethod has been updated to catch and manageDatabricksErrorexceptions, which now encompassBadRequesterrors, ensuring comprehensive error handling for Databricks path-related operations. Additionally, the_cached_file_infoand_cached_object_infoattributes are now initialized when aDatabricksErrorexception occurs, returningFalseaccordingly. This enhancement maintains consistency and accuracy in theexistsmethod while broadening the range of errors captured, resulting in a more robust and reliable codebase with enhanced error reporting for users. - Normalize databricks paths as part of resolving them (#157). In this release, the
resolvemethod in thepaths.pyfile of the databricks/labs/blueprint project has been enhanced to handle parent directory references ("..") consistently with Python's built-inPathobject. Previously,Path("/a/b/../c").resolve()would returnPath("/a/b/c"), while Databricks paths were not behaving consistently. This modification introduces a new_normalize()method, which processes the path parts and ensures that ".." segments are handled correctly. The commit also includes a new test function, 'test_resolve_is_consistent', which checks the consistent resolution of Databricks paths with various input formats, such as relative paths, ".." or "." components, and absolute paths. This change ensures that the resolved path will be normalized according to the expected behavior, regardless of the input format, contributing to the resolution of issue #2882. By normalizing Databricks paths in the same fashion as Python's built-inPathobject, the code should become more robust and predictable, providing a more reliable and predictable experience for software engineers utilizing the project. - Updated databrickslabs/sandbox requirement to acceptance/v0.3.0 (#153). In this pull request, the
databrickslabs/sandboxpackage requirement in the downstreams GitHub Actions workflow is updated to version 0.3.0, which is the latest version available. This package provides a sandbox environment for development and testing, and the new version includes bug fixes and dependency updates that may enhance its reliability and performance. Dependabot has been used to ensure a smooth update process, with any conflicts being resolved automatically. However, it is recommended to review the changelog and test the updated version before merging this pull request to ensure compatibility and functionality in your specific use case. Additionally, Dependabot commands are available to manage ignore conditions for this dependency.
Dependency updates:
- Bump actions/checkout from 4.1.7 to 4.2.0 (#149).
- Bump actions/checkout from 4.2.0 to 4.2.1 (#152).
- Updated databrickslabs/sandbox requirement to acceptance/v0.3.0 (#153).
- Bump databrickslabs/sandbox from acceptance/v0.3.0 to 0.3.1 (#155).
Contributors: @dependabot[bot], @ericvergnaud
v0.9.0
- Added Databricks CLI version as part of routed command telemetry (#147). A new environment variable, "DATABRICKS_CLI_VERSION", has been introduced in the Databricks CLI version for routed command telemetry. This variable is incorporated into the
with_user_agent_extramethod, which adds it to the user agent for outgoing requests, thereby enhancing detailed tracking and version identification in telemetry data. Thewith_user_agent_extramethod is invoked twice, with theblueprintprefix and the version variable, followed by thecliprefix and the DATABRICKS_CLI_VERSION environment variable, ensuring that both the blueprint and CLI versions are transmitted in the user agent for all requests.
Contributors: @nfx
v0.8.3
- add missing stat() methods to DBFSPath and WorkspacePath (#144). The
stat()method has been added to bothDBFSPathandWorkspacePathclasses, addressing issues #142 and #143. This method, which adheres to the Posix standard, returns file status in theos.stat_resultformat, providing access to various metadata attributes such as file size, last modification time, and creation time. By incorporating this method, developers can now obtain essential file information for Databricks File System (DBFS) and Databricks Workspace paths when working with these classes. The change includes a new test case forstat()in thetest_paths.pyfile to ensure the correctness of the method for both classes.
Contributors: @ericvergnaud
v0.8.2
- Make hatch a prerequisite (#137). In version 1.9.4, hatch has become a prerequisite for installation in the GitHub workflow for the project's main branch, due to occasional failures in
pip install hatchthat depend on the local environment. This change, which includes defining the hatch version as an environment variable and adding a new step for installing hatch with a specific version, aims to enhance the reliability of the build and testing process by eliminating potential installation issues with hatch. Users should install hatch manually before executing the Makefile, as the linepip install hatchhas been removed from the Makefile. This change aligns with the approach taken for ucx, and users are expected to understand the requirement to install prerequisites before executing the Makefile. To contribute to this project, please install hatch usingpip install hatch, clone the GitHub repository, and runmake devto start the development environment and install necessary dependencies. - support files with unicode BOM (#138). The recent change to the open-source library introduces support for handling files with a Unicode Byte Order Mark (BOM) during file upload and download operations in Databricks Workspace. This new functionality, added to the
WorkspacePathclass, allows for easier reading of text from files with the addition of aread_textmethod. When downloading a file, if it starts with a BOM, it will be detected and used for decoding, regardless of the preferred encoding based on the system's locale. The change includes a new test function that verifies the accurate encoding and decoding of files with different types of BOM using the appropriate encoding. Despite the inability to test Databrick notebooks with a BOM due to the Databricks platform modifying the uploaded data, this change enhances support for handling files with various encodings and BOM, improving compatibility with a broader range of file formats, and ensuring more accurate handling of files with BOM.
Contributors: @ericvergnaud
v0.8.1
- Fixed py3.10 compatibility for
_partsin pathlike (#135). The recent update to our open-source library addresses the compatibility issue with Python 3.10 in the_partsproperty of a certain type. Prior to this change, there was also a_cpartsproperty that returned the same value as_parts, which has been removed and replaced with a direct reference to_parts. The_partsproperty can now be accessed via reverse equality comparison, and this change has been implemented in thejoinpathand__truediv__methods as well. This enhancement improves the library's compatibility with Python 3.10 and beyond, ensuring continued functionality and stability for software engineers working with the latest Python versions.
Contributors: @nfx
v0.8.0
- Added
DBFSPathasos.PathLikeimplementation (#131). The open-source library has been updated with a new classDBFSPath, an implementation ofos.PathLikefor Databricks File System (DBFS) paths. This new class extends the existingWorkspacePathsupport and provides pathlib-like functionality for DBFS paths, including methods for creating directories, renaming and deleting files and directories, and reading and writing files. The addition ofDBFSPathincludes type-hinting for improved code linting and is integrated in the test suite with new and updated tests for path-like objects. The behavior of theexistsandunlinkmethods have been updated forWorkspacePathto improve performance and raise appropriate errors. - Fixed
.as_uri()and.absolute()implementations forWorkspacePath(#127). In this release, theWorkspacePathclass in thepaths.pymodule has been updated with several improvements to the.as_uri()and.absolute()methods. These methods now utilize PathLib internals, providing better cross-version compatibility. The.as_uri()method now uses an f-string for concatenation and returns the UTF-8 encoded string representation of theWorkspacePathobject via a new__bytes__()dunder method. Additionally, the.absolute()method has been implemented for the trivial (no-op) case and now supports returning the absolute path of files or directories in Databricks Workspace. Furthermore, theglob()andrglob()methods have been enhanced to support case-sensitive pattern matching based on a newcase_sensitiveparameter. To ensure the integrity of these changes, two new test cases,test_as_uri()andtest_absolute(), have been added, thoroughly testing the functionality of these methods. - Fixed
WorkspacePathsupport for python 3.11 (#121). TheWorkspacePathclass in our open-source library has been updated to improve compatibility with Python 3.11. The.expanduser()and.glob()methods have been modified to address internal changes in Python 3.11. Theis_dir()andis_file()methods now include afollow_symlinksparameter, although it is not currently used. A new method,_scandir(), has been added for compatibility with Python 3.11. Theexpanduser()method has also been updated to expand~(but not~user) constructs. Additionally, a new methodis_notebook()has been introduced to check if the path points to a notebook in Databricks Workspace. These changes aim to ensure that the library functions smoothly with the latest version of Python and provides additional functionality for users working with Databricks Workspace. - Properly verify versions of python (#118). In this release, we have made significant updates to the pyproject.toml file to enhance project dependency and development environment management. We have added several new packages to the
dependenciessection to expand the library's functionality and compatibility. Additionally, we have removed thepythonfield, as it is no longer necessary. We have also updated thepathfield to specify the location of the virtual environment, which can improve integration with popular development tools such as Visual Studio Code and PyCharm. These changes are intended to streamline the development process and make it easier to manage dependencies and set up the development environment. - Type annotations on path-related unit tests (#128). In this open-source library update, type annotations have been added to path-related unit tests to enhance code clarity and maintainability. The tests encompass various scenarios, including verifying if a path exists, creating, removing, and checking directories, and testing file attributes such as distinguishing directories, notebooks, and regular files. The additions also cover functionality for opening and manipulating files in different modes like read binary, write binary, read text, and write text. Furthermore, tests for checking file permissions, handling errors, and globbing (pattern-based file path matching) have been incorporated. The tests interact with a WorkspaceClient mock object, simulating file system interactions. This enhancement bolsters the library's reliability and assists developers in creating robust, well-documented code when working with file system paths.
- Updated
WorkspacePathto support Python 3.12 (#122). In this release, theWorkspacePathimplementation has been updated to ensure compatibility with Python 3.12, in addition to Python 3.10 and 3.11. The class was modified to replace most of the internal implementation and add extensive tests for public interfaces, ensuring that the superclass implementations are not used unless they are known to be safe. This change is in response to the significant changes in the superclass implementations between Python 3.11 and 3.12, which were found to be incompatible with each other. TheWorkspacePathclass now includes several new methods and tests to ensure that it functions seamlessly with different versions of Python. These changes include testing for initialization, equality, hash, comparison, path components, and various path manipulations. This update enhances the library's adaptability and ensures it functions correctly with different versions of Python. Classifiers have also been updated to include support for Python 3.12. WorkspacePathfixes for the.resolve()implementation (#129). The.resolve()method forWorkspacePathhas been updated to improve its handling of relative paths and thestrictargument. Previously, relative paths were not properly validated and would be returned as-is. Now, relative paths will cause the method to fail. Thestrictargument is now checked, and if set toTrueand the path does not exist, aFileNotFoundErrorwill be raised. The method.absolute()is used to obtain the absolute path of the file or directory in Databricks Workspace and is used in the implementation of.resolve(). A new test,test_resolve(), has been added to verify these changes, covering scenarios where the path is absolute, the path exists, the path does not exist, and the path is relative. In the case of relative paths, aNotImplementedErroris raised, as.resolve()is not supported for them.WorkspacePath: Fix the .rename() and .replace() implementations to return the target path (#130). The.rename()and.replace()methods of theWorkspacePathclass have been updated to return the target path as part of the public API, with.rename()no longer accepting theoverwritekeyword argument and always failing if the target path already exists. A new private method,._rename(), has been added to include theoverwriteargument and is used by both.rename()and.replace(). This update is a preparatory step for factoring out common code to support DBFS paths. The tests have been updated accordingly, combining and adding functions to test the new and updated methods. The.unlink()method's behavior remains unchanged. Please note that the exact error raised when.rename()fails due to an existing target path is yet to be defined.
Dependency updates:
- Bump sigstore/gh-action-sigstore-python from 2.1.1 to 3.0.0 (#133).
Contributors: @asnare, @nfx, @dependabot[bot]
v0.7.0
- Added
databricks.labs.blueprint.paths.WorkspacePathaspathlib.Pathequivalent (#115). This commit introduces thedatabricks.labs.blueprint.paths.WorkspacePathlibrary, providing Python-nativepathlib.Path-like interfaces to simplify working with Databricks Workspace paths. The library includesWorkspacePathandWorkspacePathDuringTestclasses offering advanced functionality for handling user home folders, relative file paths, browser URLs, and file manipulation methods such asread/write_text(),read/write_bytes(), andglob(). This addition brings enhanced, Pythonic ways to interact with Databricks Workspace paths, including creating and moving files, managing directories, and generating browser-accessible URIs. Additionally, the commit includes updates to existing methods and introduces new fixtures for creating notebooks, accompanied by extensive unit tests to ensure reliability and functionality. - Added propagation of
blueprintversion intoUser-Agentheader when it is used as library (#114). A new feature has been introduced in the library that allows for the propagation of theblueprintversion and the name of the command line interface (CLI) command used in theUser-Agentheader when the library is utilized as a library. This feature includes the addition of two new pairs ofOtherInfo:blueprint/X.Y.Zto indicate that the request is made using theblueprintlibrary andcmd/<name>to store the name of the CLI command used for making the request. The implementation involves using thewith_user_agent_extrafunction fromdatabricks.sdk.configto set the user agent consistently with the Databricks CLI. Several changes have been made to the test file fortest_useragent.pyto include a new test case,test_user_agent_is_propagated, which checks if theblueprintversion and the name of the command are correctly propagated to theUser-Agentheader. A context managerhttp_fixture_serverhas been added that creates an HTTP server with a custom handler, which extracts theblueprintversion and the command name from theUser-Agentheader and stores them in theuser_agentdictionary. The test case calls thefoocommand with a mockedWorkspaceClientinstance and sets theDATABRICKS_HOSTandDATABRICKS_TOKENenvironment variables to test the propagation of theblueprintversion and the command name in theUser-Agentheader. The test case then asserts that theblueprintversion and the name of the command are present and correctly set in theuser_agentdictionary. - Bump actions/checkout from 4.1.6 to 4.1.7 (#112). In this release, the version of the "actions/checkout" action used in the
Checkout Codestep of the acceptance workflow has been updated from 4.1.6 to 4.1.7. This update may include bug fixes, performance improvements, and new features, although specific changes are not mentioned in the commit message. TheUnshallowstep remains unchanged, continuing to fetch and clean up the repository's history. This update ensures that the latest enhancements from the "actions/checkout" action are utilized, aiming to improve the reliability and performance of the code checkout process in the GitHub Actions workflow. Software engineers should be aware of this update and its potential impact on their workflows.
Dependency updates:
- Bump actions/checkout from 4.1.6 to 4.1.7 (#112).
Contributors: @nfx, @dependabot[bot]
v0.6.3
- fixed
Command.get_argument_typebug withUnionType(#110). In this release, theCommand.get_argument_typemethod has been updated to include special handling forUnionType, 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 aUnionType, providing more accurate and reliable results. To facilitate this, modifications were made using thetypesmodule. Additionally, thefoofunction has a new optional argumentoptional_argof typestr, with a default value ofNone. This argument is passed to thesomefunction in the assertion. ThePromptstype has been added to thefoofunction signature, and an assertion has been added to verify ifpromptsis an instance ofPrompts. Lastly, the default value of theaddressargument has been changed from an empty string to "default", and the same changes have been applied to thetest_injects_promptstest function.
Contributors: @nkvuong
v0.6.2
- Applied type casting & remove empty kwarg for Command (#108). A new method,
get_argument_type, has been added to theCommandclass in thecli.pyfile to determine the type of a given argument name based on the function's signature. The_routemethod has been updated to remove any empty keyword arguments from thekwargsdictionary, and apply type casting based on the argument type using theget_argument_typemethod. This ensures that thekwargspassed intoApp.commandare correctly typed and eliminates any empty keyword arguments, which were previously passed as empty strings. In the test file for the command-line interface, thefoocommand's keyword arguments have been updated to includeage(int),salary(float),is_customer(bool), andaddress(str) types, with thenameargument remaining and a default value foraddress. Thetest_commandsandtest_injects_promptsfunctions have been updated accordingly. These changes aim to improve the input validation and type safety of theApp.commandmethod.
Contributors: @nkvuong
v0.6.1
- Made
ProductInfo.versionacached_propertyto avoid failure when comparing wheel uploads in development (#105). In this release, theapplymethod of a class has been updated to sort upgrade scripts in semantic versioning order before applying them, addressing potential issues with version comparison during development. The implementation ofProductInfo.versionhas been refactored to acached_propertycalled_version, which calculates and caches the project version, addressing a failure during wheel upload comparisons in development. TheWheelsclass constructor has also been updated to include explicit keyword-only arguments, and a deprecation warning has been added. These changes aim to improve the reliability and predictability of the upgrade process and the library as a whole.
Dependency updates:
- Bump actions/checkout from 4.1.5 to 4.1.6 (#106).
Contributors: @dependabot[bot], @nkvuong