- Install version 2.17 or newer of the Databricks VS Code extension.
- Authenticate and choose a clear profile name.
- Select serverless or classic compute.
The extension writes the selected profile and compute to the gitignored
.databricks/.databricks.env.
direnv loads the extension-generated Databricks
environment and adds repo-local Unity Gateway tools to PATH.
make direnv # install direnv and its shell hookOpen a new terminal, then run:
direnv allow # approve .envrc
make dev # create the Python 3.12 development environment
make flint # format, lint, and type-check- The VS Code extension authenticates you and selects a workspace and compute.
- The extension writes
.databricks/.databricks.env. - Entering the repository triggers
.envrc. .envrcremoves stale Databricks profile, token, and compute variables.dotenv_if_existsexports the extension file as real environment variables.- Databricks Connect, the SDK, pytest, and Make targets inherit the same extension-selected connection.
Direnv scopes these changes to this repository. When you leave the directory, it restores the parent shell environment.
The exact set depends on the selected compute. Common variables are:
DATABRICKS_AUTH_TYPE: extension authentication method, normallymetadata-service.DATABRICKS_HOST: selected workspace URL.DATABRICKS_METADATA_SERVICE_URL: local extension endpoint that supplies short-lived credentials.DATABRICKS_SERVERLESS_COMPUTE_ID: selected serverless compute.DATABRICKS_CLUSTER_ID: selected classic compute, when applicable.DATABRICKS_WORKSPACE_ID: selected workspace identifier.DATABRICKS_BUNDLE_TARGETandDATABRICKS_PROJECT_ROOT: local project context used by Databricks tooling.SPARK_CONNECT_USER_AGENTandSPARK_CONNECT_PROGRESS_BAR_ENABLED: Databricks Connect client settings.
Do not edit .databricks/.databricks.env; reconnect or select compute in the
extension instead. The file and its local metadata-service URL are gitignored.
Run direnv allow after changing .envrc. When the extension rewrites its env
file, open a new terminal or run:
direnv reloadMake targets use .venv directly; activation is not required.
Open dbrdemo-example.ipynb to run the library
from a local VS Code notebook through Databricks Connect.
Windows users should use WSL2.