{"id":852,"library":"databricks-labs-blueprint","title":"Databricks Labs Blueprint","description":"Databricks Labs Blueprint is a Python library that provides common building blocks and utilities for Databricks Labs projects. It offers Python-native pathlib-like interfaces for Databricks Workspace paths, tools for trivial terminal user interfaces (TUI), and utilities for managing application and installation state. The current version is 0.12.0, with a regular release cadence, typically monthly or bi-monthly, reflecting active development and maintenance. [1, 3]","status":"active","version":"0.12.0","language":"python","source_language":"en","source_url":"https://github.com/databrickslabs/blueprint","tags":["Databricks","Databricks Labs","workspace","pathlib","CLI","TUI","SDK","utility"],"install":[{"cmd":"pip install databricks-labs-blueprint","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for interacting with the Databricks Workspace (e.g., WorkspaceClient, WorkspacePath operations).","package":"databricks-sdk","optional":false}],"imports":[{"note":"Provides pathlib-like interface for Databricks Workspace paths.","symbol":"WorkspacePath","correct":"from databricks.labs.blueprint.paths import WorkspacePath"},{"note":"Offers utilities for interactive terminal user interfaces (TUI).","symbol":"Prompts","correct":"from databricks.labs.blueprint.tui import Prompts"},{"note":"Used for managing wheel installations and dependencies.","symbol":"ProductInfo","correct":"from databricks.labs.blueprint.wheels import ProductInfo"}],"quickstart":{"code":"import os\nfrom databricks.sdk import WorkspaceClient\nfrom databricks.labs.blueprint.paths import WorkspacePath\n\n# Ensure DATABRICKS_HOST and DATABRICKS_TOKEN environment variables are set,\n# or a Databricks CLI profile is configured.\n# For local testing, you might run:\n# export DATABRICKS_HOST='https://<your-databricks-instance>.cloud.databricks.com'\n# export DATABRICKS_TOKEN='dapi...'\n\nif not os.environ.get('DATABRICKS_HOST') or not os.environ.get('DATABRICKS_TOKEN'):\n    print(\"Please set DATABRICKS_HOST and DATABRICKS_TOKEN environment variables or configure Databricks CLI.\")\n    # In a real quickstart, you might exit or raise an error here.\n    # For demonstration, we'll use placeholder values that will likely fail.\n    ws = WorkspaceClient(host=os.environ.get('DATABRICKS_HOST', 'https://example.cloud.databricks.com'), \n                         token=os.environ.get('DATABRICKS_TOKEN', 'dapi-fake-token'))\nelse:\n    ws = WorkspaceClient()\n\nprint(f\"Initialized WorkspaceClient for host: {ws.host}\")\n\ntry:\n    user_name = ws.current_user.me().user_name\n    print(f\"Current user: {user_name}\")\n\n    # Example: Working with user home folders\n    folder_name = 'blueprint-test-folder'\n    wsp = WorkspacePath(ws, f\"~/{{folder_name}}/sub/dir\")\n\n    # Expand the user path and create the directory\n    with_user = wsp.expanduser()\n    print(f\"Expanded path: {with_user}\")\n    with_user.mkdir()\n    print(f\"Directory '{with_user}' created.\")\n\n    # Verify existence\n    assert with_user.is_dir()\n    print(f\"Directory '{with_user}' exists.\")\n\n    # Clean up (recursive rmdir)\n    with_user.parent.parent.rmdir(recursive=True)\n    assert not with_user.parent.parent.exists()\n    print(f\"Directory '{with_user.parent.parent}' and its contents removed.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure your Databricks environment is correctly configured (host, token, permissions).\")\n","lang":"python","description":"This quickstart demonstrates how to initialize a `WorkspaceClient` and use `WorkspacePath` to create and manage directories within your Databricks workspace. It expands a relative path to the user's home directory, creates the specified folder structure, verifies its existence, and then cleans it up. Ensure your Databricks SDK authentication (environment variables or CLI profile) is configured before running. [1]"},"warnings":[{"fix":"Review code that reads JSON configuration files, especially if it expects integer values from floating-point inputs. Handle `SerdeError` for explicit type conversions.","message":"In `v0.11.3`, the unmarshalling of JSON floating-point values was fixed. Previously, JSON floats might have been silently truncated to integers. The updated functionality now raises a `SerdeError` when precision would be lost during conversion from float to integer. [release notes]","severity":"breaking","affected_versions":"<0.11.3"},{"fix":"Refactor data classes to use more specific type annotations instead of `Any` or `object` to avoid deprecation warnings and ensure type safety.","message":"Starting with `v0.11.0`, using `Any` and `object` as type annotations on data classes for marshalling is deprecated and will issue a `DeprecationWarning`. [release notes]","severity":"deprecated","affected_versions":">=0.11.0"},{"fix":"Upgrade to `v0.9.3` or newer. If upgrading is not immediately possible, carefully review any custom logic that modifies or saves Databricks SDK configuration objects to ensure they are handled correctly.","message":"In versions prior to `v0.9.3`, there was an issue where `databricks-sdk` config objects could be unintentionally overridden when creating installation config files. This could lead to unexpected behavior or incorrect workspace configurations. [release notes]","severity":"gotcha","affected_versions":"<0.9.3"},{"fix":"Ensure your Python environment is version 3.10 or higher before installing `databricks-labs-blueprint`. Upgrade your Python interpreter or use a compatible virtual environment.","message":"The `databricks-labs-blueprint` library requires Python 3.10 or newer. Installing it on Python versions older than 3.10 will result in an `ERROR: No matching distribution found`.","severity":"gotcha","affected_versions":">0.0.1"}],"env_vars":null,"last_verified":"2026-05-12T20:23:30.016Z","next_check":"2026-06-27T00:00:00.000Z","problems":[{"fix":"Install the package using pip: `pip install databricks-labs-blueprint`","cause":"The 'databricks-labs-blueprint' package, which provides the 'blueprint' module, is not installed or not available in the current Python environment.","error":"ModuleNotFoundError: No module named 'blueprint'"},{"fix":"Import 'WorkspacePath' from its correct submodule: `from blueprint.path import WorkspacePath`","cause":"The 'WorkspacePath' class is located within the 'blueprint.path' submodule, not directly under the top-level 'blueprint' package.","error":"ImportError: cannot import name 'WorkspacePath' from 'blueprint'"},{"fix":"Use an alternative method to create an empty file, such as `workspace_path.write_text('')`.","cause":"The 'WorkspacePath' class provides a pathlib-like interface but does not implement all methods available in 'pathlib.Path', such as 'touch()'.","error":"AttributeError: 'WorkspacePath' object has no attribute 'touch'"},{"fix":"Run the code within a Databricks notebook or job environment, or mock 'dbutils' for local testing if appropriate.","cause":"The Databricks-specific functionalities, like 'WorkspacePath', rely on the 'dbutils' object, which is only available within a Databricks notebook or job environment. This error occurs when the code is run outside Databricks.","error":"RuntimeError: dbutils is not available."}],"ecosystem":"pypi","meta_description":null,"install_score":85,"install_tag":"verified","quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.12.0","cli_name":"","install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","installed_version":"0.12.0","pypi_latest":"0.12.0","is_stale":false,"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":3.62,"mem_mb":41.9,"disk_size":"55.0M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":3.76,"mem_mb":40.2,"disk_size":"53.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4.8,"import_time_s":2.51,"mem_mb":40.9,"disk_size":"56M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":2.42,"mem_mb":39.2,"disk_size":"54M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":6.44,"mem_mb":47.6,"disk_size":"60.9M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":6.81,"mem_mb":45.8,"disk_size":"59.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4.3,"import_time_s":5.21,"mem_mb":46.8,"disk_size":"62M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":4.84,"mem_mb":44.9,"disk_size":"60M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":5.38,"mem_mb":48,"disk_size":"52.2M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":5.88,"mem_mb":46.1,"disk_size":"50.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.9,"import_time_s":5.46,"mem_mb":47.2,"disk_size":"53M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":5.57,"mem_mb":45.3,"disk_size":"51M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":5.26,"mem_mb":49.7,"disk_size":"52.0M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":5.29,"mem_mb":47.8,"disk_size":"50.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4,"import_time_s":4.83,"mem_mb":48.9,"disk_size":"53M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":4.98,"mem_mb":46.9,"disk_size":"51M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"databricks-labs-blueprint","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"databricks-labs-blueprint","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":null,"tag_description":null,"results":[{"runtime":"python:3.10-alpine","exit_code":-1},{"runtime":"python:3.10-slim","exit_code":-1},{"runtime":"python:3.11-alpine","exit_code":-1},{"runtime":"python:3.11-slim","exit_code":-1},{"runtime":"python:3.12-alpine","exit_code":-1},{"runtime":"python:3.12-slim","exit_code":-1},{"runtime":"python:3.13-alpine","exit_code":-1},{"runtime":"python:3.13-slim","exit_code":-1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}