Skip to main content

Databricks dbutils-compatible adapter for local and Databricks runtimes.

Project description

bd-utils

bd-utils provides a dbutils-like interface that works in both Databricks and local environments.

Goals

  • Use native Databricks dbutils when running on Databricks.
  • Use a predictable local implementation for tests and local scripts.
  • Keep unsupported APIs explicit with actionable errors.

API compatibility target

bdutils mirrors the Databricks module layout:

  • credentials, data, fs, jobs.taskValues, library, meta, notebook, preview, secrets, widgets, api

Locally, commonly used commands are implemented (widgets, secrets, fs, jobs.taskValues, notebook.exit); unsupported commands are present and raise NotImplementedError.

Quick start

import bdutils
value = bdutils.widgets.get("country")

Alternative (useful in tests when you need explicit config):

from bdutils import get_dbutils
dbutils = get_dbutils(force_adapter="local")
print(dbutils.fs.help("ls"))

Run tests

make test

This runs:

PYTHONPATH=src python -m pytest -q tests

Local widget lookup order

  1. Values set with widgets.text(...) in-process
  2. Environment variable DBX_WIDGET_<NAME_UPPER_SNAKE>

Local secret mapping

dbutils.secrets.get(scope, key) maps to environment variable:

DBX_SECRET__<SCOPE>__<KEY>

Notes

  • dbfs:/... paths are mapped to ~/.bd-utils/dbfs/... by default.
  • Unsupported methods raise NotImplementedError.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bd_utils-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bd_utils-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file bd_utils-0.1.0.tar.gz.

File metadata

  • Download URL: bd_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bd_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ab8e8ebda7351f1cb8db101924e1e814e41735a0217bc6817a5ba1c398ec8ea
MD5 075f809c414336ef68a81f2bae7152d0
BLAKE2b-256 d4f03a361d32b7dd0ec6945fb0a133d7ed843d5bf2484818c9ac55b6d26ddbf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bd_utils-0.1.0.tar.gz:

Publisher: pypi-publish.yml on josefondrej/bd-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bd_utils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bd_utils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bd_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 378fc01ac6a99f08ffba605a2a115c5f6a90281c60c6e260220c48a4989730dc
MD5 58d77622d105a959c8ed8adb572bd0c9
BLAKE2b-256 1c361c0ea48b5dae7992350677e926f65ce378dec6b9571a9bc6882170e0ca38

See more details on using hashes here.

Provenance

The following attestation bundles were made for bd_utils-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on josefondrej/bd-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page