npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fermumen/databricks-execute

v2.15.2

Published

CLI to sync and execute a local file on Databricks (mirrors VS Code extension runFile behavior).

Readme

databricks-execute

Runs a local Python file on a Databricks cluster, mimicking the Databricks VS Code extension “Upload and Run File” flow:

  1. databricks bundle sync (uploads bundle assets)
  2. Executes the file on the configured cluster via the Command Execution API
  3. Parses remote stack traces and rewrites /Workspace/... paths back to local paths

For notebooks (.ipynb or “Databricks notebook source” files like example.py), it runs them as a workflow (Jobs API notebook task) to match the VS Code “Run File as Workflow” behavior.

Install / build (repo-local)

node .yarn/releases/yarn-3.2.1.cjs install
node .yarn/releases/yarn-3.2.1.cjs workspace @fermumen/databricks-execute build

Build a standalone binary with Bun

If you want a single executable instead of a Node.js script, install Bun and run:

node .yarn/releases/yarn-3.2.1.cjs workspace @fermumen/databricks-execute build:binary

This builds packages/databricks-execute/dist/databricks-execute for the local platform. You can also target a different platform, for example:

node .yarn/releases/yarn-3.2.1.cjs workspace @fermumen/databricks-execute build:binary --target bun-linux-x64

For older Linux x64 CPUs without AVX2 support, use Bun's baseline target instead:

node .yarn/releases/yarn-3.2.1.cjs workspace @fermumen/databricks-execute build:binary --target bun-linux-x64-baseline

The compiled binary is standalone with respect to Node.js/npm, but it still requires the Databricks CLI (databricks) on your PATH at runtime. The binary build uses Bun's production-oriented compile flags (--minify --sourcemap --bytecode) and disables Bun's automatic .env / bunfig.toml loading so runtime behavior stays closer to the Node.js CLI.

Install the command

From npm (one-line install)

npm install -g @fermumen/databricks-execute@latest

Then run:

databricks-execute path/to/local/file.py -- arg1 arg2

Upgrade to latest:

npm install -g @fermumen/databricks-execute@latest

Local (recommended for this repo)

This exposes databricks-execute on your PATH via node_modules/.bin:

node .yarn/releases/yarn-3.2.1.cjs workspace @fermumen/databricks-execute add -D file:packages/databricks-execute

Then run it with:

node .yarn/releases/yarn-3.2.1.cjs databricks-execute path/to/local/file.py -- arg1 arg2

Global

Install the local build from this repo root:

npm install -g ./packages/databricks-execute

Usage

databricks-execute path/to/local/file.py -- arg1 arg2

This CLI shells out to the Databricks CLI (databricks), so make sure it’s installed and on your PATH.

Notebook mode

If the input file is:

  • an .ipynb, or
  • a *.py/*.sql/*.scala/*.r file whose first line is Databricks notebook source

then databricks-execute runs it as a workflow notebook task instead of using the Command Execution API.

Example:

databricks-execute path/to/notebook.py --target dev --widget greeting=hello --widget name=databricks

Notes:

  • Positional args (-- arg1 arg2) and --env KEY=VALUE are only supported in Command Execution mode (plain .py files).
  • --keep-context leaves a newly created Command Execution context alive and prints its id; pass that id back with --context-id <id> to reuse interpreter state across plain .py runs.
  • Repeat --widget KEY=VALUE to populate notebook widget / base_parameters values for notebook runs.
  • Notebook output is printed by extracting text stdout/stderr (and tracebacks) from the exported run. For rich outputs (tables/plots/HTML), open the run URL in a browser.
  • Long-running executions are supported. The CLI waits for completion and prints periodic heartbeat status lines while the run is active.
  • In plain .py mode (Command Execution API), client-side wait timeout is set to 240 hours.
  • In notebook workflow mode (Jobs API), one-off run timeout is explicitly set to 0 (no timeout).

All configuration is read from databricks.yml (via databricks bundle validate): workspace.host, workspace file path, and cluster_id.

If the configured cluster is stopped, it is started automatically. Pass --no-start-cluster to disable this.

Reusing a Python execution context

For REPL-like plain .py workflows, create and keep a context alive:

databricks-execute path/to/snippet.py --target dev --keep-context

That prints an Execution context ID: ... line. Reuse it on later runs:

databricks-execute path/to/next-snippet.py --target dev --context-id <id>

These flags are only supported for plain .py files, not notebooks.

Quick start with init

To create or update a databricks.yml with a target for databricks-execute:

databricks-execute init --host https://adb-123.azuredatabricks.net --cluster 0123-456789-abcde123

This creates a databricks.yml in the current directory with a dbexec target. If a databricks.yml already exists, it adds the target to it.

Options: --host <url>, --cluster <id>, --target <name> (default: dbexec), --name <bundle-name> (default: directory name). If flags are omitted, you will be prompted interactively.

Authentication

Authentication is resolved from the Databricks CLI auth chain. Preferred flows:

  1. PAT token in ~/.databrickscfg — run databricks auth login --host <url> to set up.
  2. Azure CLI — if using Azure AD, the Databricks CLI delegates to az login.
  3. DATABRICKS_TOKEN env var — for CI/CD or scripted usage.
  4. --token flag — explicit override.

The CLI runs databricks auth env --host <host> to resolve the token at runtime. No tokens are stored in databricks.yml.

Configuration priority

  1. CLI flags (--host, --token, --cluster, --target)
  2. Environment variables (DATABRICKS_HOST, DATABRICKS_TOKEN, DATABRICKS_BUNDLE_TARGET)
  3. Bundle validate output (workspace.host, bundle.compute_id / cluster_id)
  4. Databricks CLI auth chain (for token resolution)

Run databricks-execute --help for the full set of options.