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.1.tar.gz (10.7 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.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bd_utils-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 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.1.tar.gz
Algorithm Hash digest
SHA256 090bebb7d03345680efb0265339246e2e54f98439da07eaaf90fe831e9f8063f
MD5 2fc9afcb4ac5eeffb3919565a4119a87
BLAKE2b-256 e0ba6f9758d062534e21ec73f443c90c8ade3d01fcb2dca2e438ae2c07a0b970

See more details on using hashes here.

Provenance

The following attestation bundles were made for bd_utils-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: bd_utils-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3048a8b146ccbdb3e94a133ab2e456e18598de27f355e1805f958daa2784f36
MD5 0bed068cb0e79824bb64440e241db7c2
BLAKE2b-256 9d344e5a377c3d433fdd3db13c752abe7874b5e63361292dafac9568868f7abb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bd_utils-0.1.1-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