• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdatabase

databricks-setup-local

プラグイン
databricks
ソース
GitHub で見る ↗
説明

Databricks Connectやクラスター、サーバーレスコンピュート、`--job-task`、またはバンドルターゲット向けに、`databricks environments setup-local`を使ってローカル環境のPython仮想環境(開発時に使う分離した実行環境)を管理・設定・診断します。 次のような場合に使用: - ユーザーが新たにセットアップしたい、または既存の設定を修正したい場合 - setup-localコマンドが失敗した場合

原文を表示

Previews, provisions, or diagnoses a uv-managed local Python .venv with `databricks environments setup-local`. Use when the user wants to set up or fix one for Databricks Connect, cluster or serverless compute, `--job-task`, or a bundle target, or when setup-local fails.

ユースケース
  • ローカル環境のPython仮想環境を新規セットアップするとき
  • 既存の環境設定を修正したいとき
  • setup-localコマンドが失敗したとき
  • 環境の状態を診断したいとき
本文(日本語訳)

Databricks セットアップ - ローカル環境構築

最初に必須: CLI(コマンドラインツール)、認証、プロフィール選択には databricks-core を使用してください。デフォルトプロフィールは絶対に使わないでください。既存の環境の場合は databricks-execution-compute を使用してください。

作業の流れ

1. CLI と認証を確認する

CLI のバージョンは 1.12.0 以上である必要があります。バージョン比較は正確に行ってください(1.9.0 は 1.12.0 より古く、単純な文字列比較では間違った判定になります)。以下のチェックを最初に実行し、失敗した場合は進まないでください:

# サブシェルでチェックを実行(失敗時に終了コードを返す)
(
  # 標準出力のみを読み込む(アップグレード通知は標準エラーに出力)
  if ! raw="$(databricks version 2>/dev/null)"; then
    echo "STOP: databricks CLI が見つからないか実行に失敗しました。databricks-core でインストール/アップグレードしてください"
    exit 1
  fi
  have="$(printf '%s\n' "$raw" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -n1 | tr -d v)"
  [ -n "$have" ] || have="$(printf '%s\n' "$raw" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n1)"
  if [ -z "$have" ]; then
    echo "STOP: 'databricks version' からバージョン番号を読み取れません。databricks-core でアップグレードしてください"
    exit 1
  fi
  case "$raw" in
    *-dev*)
      echo "注意: 開発版ビルド $have です。最小バージョンの確認ができません。このビルドが setup-local に対応しているか確認してください"
      ;;
    *)
      if [ "$(printf '%s\n%s\n' "1.12.0" "$have" | sort -V | head -n1)" != "1.12.0" ]; then
        echo "STOP: databricks CLI $have は v1.12.0 より古いため、setup-local は実行できません。databricks-core でアップグレードしてください"
        exit 1
      fi
      ;;
  esac
)

チェックが成功してから、選択したプロフィールで認証を行ってください:

databricks auth describe --profile <PROFILE>

最新の安定版 CLI を推奨します。オンライン確認は不要です。チェックが失敗した場合(CLI が古い、見つからない、バージョンが読み取れない)、または setup-local がヘルプに表示されない、不明なコマンドと報告される、ドキュメント化されたフラグが拒否される場合は中止してください。「注意: 開発版ビルド」と表示された場合は、最小バージョンが確認できないため、続行前にユーザーに確認してください。databricks-core で承認を得たうえでアップグレードし、確認してください。setup-local を手動で再作成しないでください。

すべてのワークスペース操作に選択したプロフィールを使用してください。他のパッケージマネージャーに切り替える場合は承認を得てください。

2. プロジェクトディレクトリを確認する

pyproject.toml、.venv、uv.lock を含む(または含む予定の)ルートディレクトリを確認してください。複数のルートの可能性がある場合は確認してください。プレビューと実行に使用します。新規プロジェクトか uv(Pythonパッケージマネージャー)で管理されている必要がありますが、プレビュー時に書き込み権限は不要です。

3. 実行対象を 1 つ選択する

以下のいずれか 1 つを選んでください:

  • クラスター: --cluster-id <ID> または --cluster-name <NAME> を使用します。不明な場合は、選択したプロフィールでクラスターを一覧表示し、確認してください。例を参照してください。
  • サーバーレス: --serverless-version <N> を使用します。バージョン一覧を取得するコマンドはありません。未指定の場合は確認してください。
  • ジョブタスク: --job-task <JOB_ID>.<TASK_KEY> を使用します。タスクが不明な場合は、databricks jobs get <JOB_ID> --profile <PROFILE> --output json を実行し、タスクキーを表示して確認してください。
  • バンドル: databricks.yml を含むプロジェクト。databricks-dabs でそのルートと選択されたターゲットを確認してください。そのターゲットが対応するクラシックまたはサーバーレスコンピューティングを解決する場合のみ、コンピューティングフラグを省略できます。その他の場合は確認してください。名前付きターゲットの場合は --target <BUNDLE_TARGET> を追加してください。

コンピューティングフラグを組み合わせないでください。対象が決まらない場合はユーザーに確認してください。

4. プレビュー実行

ドライラン(試行)を先に行います。何も書き込みやインストールは行いません:

databricks environments setup-local --profile <PROFILE> <TARGET_ARGS> --dry-run --output json

バンドルの場合、<TARGET_ARGS> は空白または --target <BUNDLE_TARGET> です。通常モードがデフォルトです。ユーザーが明示的にこのコマンドで databricks-connect を管理したくない場合のみ --constraints-only を使用してください。JSON 出力と例を参照してください。

5. 承認を得て実行する

実行前に、ディレクトリが書き込み可能か確認し、uv --version を実行してください。uv をインストールする前に確認してください。DATABRICKS_LOCALENV_AUTO_INSTALL_UV=1 を黙って設定したり、リモートインストーラーを実行したりしないでください。

ターゲット、バージョン、警告、plan.diff、ディレクトリを表示してください。実行により以下の処理が行われる可能性があることを説明してください:

  • pyproject.toml をバックアップして書き直す
  • Python と依存パッケージをインストールする
  • .venv と uv.lock を更新する

バンドルで --serverless-version N を使用する場合は、以下で説明する実行後のジョブ YAML 同期についても開示し、両方の変更を承認に含めてください。

ユーザーがプロビジョニングをリクエストするか、指定されたディレクトリの計画を承認した後でのみ実行してください。ディレクトリ、プロフィール、ターゲット、モードを保持してください。

プレビュー後にディレクトリ、プロフィール、ターゲット、モード、またはプロジェクトファイルが変わった場合は、--dry-run を再実行し、新しい計画を表示して、改めて承認を得てください。解決されたPython、databricks-connect、管理下の制約を信頼できる情報として扱い、推測版に置き換えないでください。ユーザー所有の依存パッケージの競合は別途、承認を得て対応してください。

6. 結果を処理する

  • ok: true: バンドルで --serverless-version N を使用する場合は、YAML ソース内の既存のすべてのジョブの environments[].spec.environment_version を "N" に更新してから、バンドルを検証してください。存在しない場合は報告し、新たに作成しないでください。クラスターおよびジョブタスクターゲットではこの処理をスキップしてください。ターゲット、バージョン、警告、venvPath を報告してください。uv run <cmd> を推奨するか、venvPath からプラットフォーム固有のインタープリター(Pythonの実行環境)を導出してください。
  • ok: false: トラブルシューティングを参照してください。ファイルを変更する診断実行や外部への報告を行う前に確認してください。
  • JSON が出力されない: ファイル変更前の CLI、認証、ディレクトリ、またはキャッシュのエラーについて標準エラー出力を確認してください。
原文(English)を表示

Databricks Setup-Local

REQUIRED FIRST: Use databricks-core for CLI, authentication, and profile selection. Never use a default profile. For an existing environment, use databricks-execution-compute.

Workflow

1. Check CLI and authentication

The CLI must be >= v1.12.0. Compare deterministically -- never eyeball the version (1.9.0 is older than 1.12.0, and a lexical string compare gets this wrong). Run this gate first and do not proceed if it exits non-zero:

# Subshell so a failed gate reports non-zero without closing a persistent shell.
(
  # Read stdout only -- upgrade nags on stderr carry their own semver and would win the parse.
  if ! raw="$(databricks version 2>/dev/null)"; then
    echo "STOP: databricks CLI is missing or failed to run -- install or upgrade it via databricks-core first"
    exit 1
  fi
  have="$(printf '%s\n' "$raw" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -n1 | tr -d v)"
  [ -n "$have" ] || have="$(printf '%s\n' "$raw" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n1)"
  if [ -z "$have" ]; then
    echo "STOP: could not read a version from 'databricks version' -- upgrade via databricks-core first"
    exit 1
  fi
  case "$raw" in
    *-dev*)
      echo "NOTE: dev build $have -- the floor cannot be checked; ask the user to confirm this build has setup-local"
      ;;
    *)
      if [ "$(printf '%s\n%s\n' "1.12.0" "$have" | sort -V | head -n1)" != "1.12.0" ]; then
        echo "STOP: databricks CLI $have is older than v1.12.0 -- do not run setup-local; upgrade via databricks-core first"
        exit 1
      fi
      ;;
  esac
)

Only after the gate passes, authenticate with the selected profile:

databricks auth describe --profile <PROFILE>

Prefer the latest stable CLI; no online lookup is required. If the gate exits non-zero (older than v1.12.0, missing CLI, or no readable version), or setup-local is absent from help, reports unknown command, or rejects a documented flag, stop. If it prints NOTE: dev build, the floor is unverifiable -- confirm with the user before continuing. Use databricks-core to upgrade with approval and verify; never recreate setup-local manually.

Use the selected profile for every workspace command. Do not convert another package manager without approval.

2. Confirm the project directory

Confirm the root containing (or intended to contain) pyproject.toml, .venv, and uv.lock; ask if multiple roots are plausible. Use it for preview and apply. It must be greenfield or uv-managed, but need not be writable for preview.

3. Select one target

Choose exactly one branch:

  • Cluster: use --cluster-id <ID> or --cluster-name <NAME>. If unknown, list clusters with the selected profile and ask; see examples.
  • Serverless: use --serverless-version <N>. No version-list command exists; ask if unspecified.
  • Job task: use --job-task <JOB_ID>.<TASK_KEY>. If the task is unknown, run databricks jobs get <JOB_ID> --profile <PROFILE> --output json, present task keys, and ask.
  • Bundle: a project with databricks.yml. Use databricks-dabs to inspect its root and selected target. Omit compute flags only when that target resolves supported classic or serverless compute; otherwise ask. Add --target <BUNDLE_TARGET> for a named target.

Never combine compute flags. If no branch resolves, ask the user.

4. Preview

Dry-run first; it writes and installs nothing:

databricks environments setup-local --profile <PROFILE> <TARGET_ARGS> --dry-run --output json

For bundles, <TARGET_ARGS> is empty or --target <BUNDLE_TARGET>. Default to normal mode. Use --constraints-only only when the user explicitly does not want this command managing databricks-connect. See JSON output and examples.

5. Obtain approval and apply

Before apply, verify the directory is writable and run uv --version. Ask before installing uv; never silently set DATABRICKS_LOCALENV_AUTO_INSTALL_UV=1 or run a remote installer.

Show the target, versions, warnings, plan.diff, and directory. Explain that apply may:

  • back up and rewrite pyproject.toml;
  • install Python and dependencies;
  • update .venv and uv.lock.

For --serverless-version N in a bundle, also disclose the post-apply job YAML synchronization described below so approval covers both mutations.

Apply only after the user requested provisioning or approves that plan for the named directory. Preserve the directory, profile, target, and mode.

If the directory, profile, target, mode, or project files change after preview, rerun --dry-run, show the new plan, and obtain approval again. Treat its resolved Python, databricks-connect, and managed constraints as authoritative; do not substitute guessed versions. Reconcile user-owned dependency conflicts separately, with approval.

6. Handle the result

  • ok: true: for --serverless-version N in a bundle, update every existing job environments[].spec.environment_version in its YAML sources to "N", then validate the bundle. Report if none exist; do not invent one. Skip this for cluster and job-task targets. Report target, versions, warnings, and venvPath; prefer uv run <cmd> or derive the platform-specific interpreter from venvPath.
  • ok: false: use troubleshooting. Ask before diagnostic runs that mutate files and before filing an external issue.
  • No JSON: inspect stderr for a pre-pipeline CLI, authentication, directory, or cache error.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。