Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
721201c
Add design spec for databricks dbconnect init/sync
rugpanov Jun 19, 2026
d8af92e
Add implementation plan for databricks dbconnect init/sync
rugpanov Jun 19, 2026
c09feab
Add dbconnect command namespace scaffold
rugpanov Jun 19, 2026
de14243
Fix dbconnect help acceptance golden
rugpanov Jun 22, 2026
0432c08
Add dbconnect result types and error codes
rugpanov Jun 22, 2026
f1b8e0d
Address review: remove noise comments and Mode.String default
rugpanov Jun 22, 2026
ae85104
Add dbconnect envKey mapping and python-version parsing
rugpanov Jun 22, 2026
15d9713
Address review: simplify envKey normalization, hoist regex
rugpanov Jun 22, 2026
4521498
Add dbconnect constraint fetch with offline cache
rugpanov Jun 22, 2026
5d4ec32
Add surgical formatting-preserving pyproject.toml merge
rugpanov Jun 22, 2026
e6fa3fd
Fix tool.uv merge to preserve user-authored keys
rugpanov Jun 22, 2026
97acf6f
Detect multi-line owned-only [tool.uv] to avoid stray empty table
rugpanov Jun 22, 2026
33819dd
Add dbconnect target resolution with three-state messaging
rugpanov Jun 22, 2026
69fb2df
gofmt dbconnect target.go field alignment
rugpanov Jun 22, 2026
dabfb90
gofmt dbconnect result.go field alignment
rugpanov Jun 22, 2026
167927e
Add PackageManager interface and uv implementation
rugpanov Jun 22, 2026
3670f5f
Make uv venv python path cross-platform; explain --no-project
rugpanov Jun 22, 2026
6146e13
Add dbconnect pipeline orchestrating all phases
rugpanov Jun 22, 2026
df91b04
Fix: use correct error code for python version parse failure in pipeline
rugpanov Jun 22, 2026
43f425b
Fix: append PhaseResult on python-version parse failure in pipeline f…
rugpanov Jun 22, 2026
c989b5a
Fix: add success PhaseResult for parse-python-version in fetch phase
rugpanov Jun 22, 2026
6406a72
Fail validation when databricks-connect major version is unparseable
rugpanov Jun 22, 2026
6a634af
Wire dbconnect Cobra layer: flags, compute adapter, rendering
rugpanov Jun 22, 2026
4960b7a
gofmt dbconnect output.go
rugpanov Jun 22, 2026
c2fe7f2
Fix dbconnect JSON error schema, uv version probe, nil-result rendering
rugpanov Jun 22, 2026
e82ea57
Add dbconnect acceptance tests
rugpanov Jun 22, 2026
4d0f7a0
Fix acceptance tests to use musterr for required-failure commands
rugpanov Jun 22, 2026
d2306eb
Fix lint findings in dbconnect packages
rugpanov Jun 22, 2026
bc71d9d
Add dbconnect changelog entry; fix constraint repo URL comment
rugpanov Jun 22, 2026
220b225
Fix dbconnect JSON-mode exit code; populate spark_version; drop unuse…
rugpanov Jun 22, 2026
af6d542
Bridge pip.conf index-url to UV_INDEX_URL and surface uv stderr in er…
rugpanov Jun 22, 2026
1fd0abd
Add diagnostic logging and a failure hint for remote troubleshooting
rugpanov Jun 22, 2026
ef16653
Remove superpowers design/plan docs from PR
rugpanov Jun 23, 2026
d787bcb
Reconcile dbconnect with the VPEX CLI spec: single sync command, E_* …
rugpanov Jul 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Notable Changes

### CLI
* Add `databricks dbconnect sync` to provision a local Python environment (Python version, `databricks-connect` pin, and dependency constraints) matched to the selected Databricks compute target. A project with no `pyproject.toml` is initialized from scratch; an existing one is merged in place. Supports `--cluster`/`--serverless`/`--job` target selection, `--constraints-only` (skip `databricks-connect`), `--check` (dry run), and `--output json` for the VS Code extension.

### Bundles

Expand Down
3 changes: 3 additions & 0 deletions acceptance/dbconnect/constraints-only/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions acceptance/dbconnect/constraints-only/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

>>> [CLI] dbconnect sync --serverless v4 --constraints-only --check --output json
{
"schemaVersion": 1,
"command": "dbconnect sync",
"ok": true,
"mode": "constraints-only",
"dryRun": true,
"target": {
"source": "serverless",
"serverlessVersion": "v4",
"envKey": "serverless/serverless-v4"
},
"resolved": {
"pythonVersion": "3.12",
"artifactSource": "network"
},
"greenfield": true,
"plan": {
"wouldWrite": "[TEST_TMP_DIR]/pyproject.toml",
"wouldInstallPython": "3.12",
"diff": "--- pyproject.toml\n+++ pyproject.toml\n@@ -1 +1,15 @@\n+[project]\n+name = \"001\"\n+version = \"0.0.0\"\n+requires-python = \"\u003e=3.12\"\n+\n+[dependency-groups]\n+dev = []\n+\n+# managed by databricks dbconnect — do not edit\n+[tool.uv]\n+constraint-dependencies = [\n+ \"pyarrow\u003c19\",\n+ \"pandas\u003c3\",\n+]\n+# end managed by databricks dbconnect\n"
},
"phases": [
{
"phase": "preflight",
"status": "ok"
},
{
"phase": "resolve",
"status": "ok"
},
{
"phase": "fetch",
"status": "ok"
},
{
"phase": "merge",
"status": "ok"
},
{
"phase": "provision",
"status": "ok"
},
{
"phase": "validate",
"status": "ok"
}
],
"warnings": [],
"error": null,
"durationMs": 0
}
1 change: 1 addition & 0 deletions acceptance/dbconnect/constraints-only/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trace $CLI dbconnect sync --serverless v4 --constraints-only --check --output json
21 changes: 21 additions & 0 deletions acceptance/dbconnect/constraints-only/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []

[Env]
DATABRICKS_DBCONNECT_CONSTRAINT_SOURCE = "$DATABRICKS_HOST"

[[Server]]
Pattern = "GET /serverless/serverless-v4/pyproject.toml"
Response.Body = '''
[project]
requires-python = ">=3.12"

[dependency-groups]
dev = ["databricks-connect~=17.2.0"]

[tool.uv]
constraint-dependencies = ["pyarrow<19", "pandas<3"]
'''

[[Repls]]
Old = 'uv uv \S+(?: \([^)]+\))?'
New = 'uv [UV_VERSION]'
3 changes: 3 additions & 0 deletions acceptance/dbconnect/env-unsupported/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions acceptance/dbconnect/env-unsupported/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
preflight ok uv [UV_VERSION]
resolve ok source=cluster envKey=dbr/15.4.x-scala2.12
fetch error no published environment for "dbr/15.4.x-scala2.12". If this is a new runtime, try the latest LTS target (e.g. --serverless v4 or a supported --cluster DBR): GET [DATABRICKS_URL]/dbr/15.4.x-scala2.12/pyproject.toml: environment key not found
merge pending
provision pending
validate pending
For more detail, re-run with --debug, or --output json to share a structured report.
Error: no published environment for "dbr/15.4.x-scala2.12". If this is a new runtime, try the latest LTS target (e.g. --serverless v4 or a supported --cluster DBR): GET [DATABRICKS_URL]/dbr/15.4.x-scala2.12/pyproject.toml: environment key not found
1 change: 1 addition & 0 deletions acceptance/dbconnect/env-unsupported/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
musterr $CLI dbconnect sync --cluster test-cluster-id --check
22 changes: 22 additions & 0 deletions acceptance/dbconnect/env-unsupported/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []

[Env]
DATABRICKS_DBCONNECT_CONSTRAINT_SOURCE = "$DATABRICKS_HOST"

[[Server]]
Pattern = "GET /api/2.1/clusters/get"
Response.Body = '''
{
"cluster_id": "test-cluster-id",
"spark_version": "15.4.x-scala2.12"
}
'''

[[Server]]
Pattern = "GET /dbr/15.4.x-scala2.12/pyproject.toml"
Response.StatusCode = 404
Response.Body = '{"message": "Not found"}'

[[Repls]]
Old = 'uv uv \S+(?: \([^)]+\))?'
New = 'uv [UV_VERSION]'
3 changes: 3 additions & 0 deletions acceptance/dbconnect/flag-conflict/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions acceptance/dbconnect/flag-conflict/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: if any flags in the group [cluster serverless job] are set none of the others can be; [cluster serverless] were all set
1 change: 1 addition & 0 deletions acceptance/dbconnect/flag-conflict/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
musterr $CLI dbconnect sync --cluster abc --serverless v4
1 change: 1 addition & 0 deletions acceptance/dbconnect/flag-conflict/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []
3 changes: 3 additions & 0 deletions acceptance/dbconnect/help/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions acceptance/dbconnect/help/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Set up a local Python environment matched to your Databricks compute target.

Derives the Python version, databricks-connect version, and dependency
constraints from the selected compute (cluster, serverless, or job) so that
local resolution matches the Databricks runtime.

Usage:
databricks dbconnect [command]

Available Commands:
sync Provision a local Python environment matched to a Databricks compute target

Flags:
-h, --help help for dbconnect

Global Flags:
--debug enable debug logging
-o, --output type output type: text or json (default text)
-p, --profile string ~/.databrickscfg profile
-t, --target string bundle target to use (if applicable)

Use "databricks dbconnect [command] --help" for more information about a command.
Provision (or update) a local Python environment matched to a Databricks compute target.

Resolves the target to an environment key, fetches the pinned Python version,
databricks-connect version, and dependency constraints published for that key,
then provisions a matched .venv with uv. A project with no pyproject.toml is
initialized from scratch; an existing pyproject.toml is merged in place (its
env-owned sections are refreshed, user-owned content is preserved).

Usage:
databricks dbconnect sync [flags]

Flags:
--check compute the plan without writing files or provisioning
--cluster string cluster ID to use as the compute target
--constraints-only apply the Python version and constraints without adding the databricks-connect dependency
-h, --help help for sync
--job string job ID to use as the compute target
--serverless string serverless version to use as the compute target (e.g. v4)

Global Flags:
--debug enable debug logging
-o, --output type output type: text or json (default text)
-p, --profile string ~/.databrickscfg profile
-t, --target string bundle target to use (if applicable)
2 changes: 2 additions & 0 deletions acceptance/dbconnect/help/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$CLI dbconnect --help
$CLI dbconnect sync --help
1 change: 1 addition & 0 deletions acceptance/dbconnect/help/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []
3 changes: 3 additions & 0 deletions acceptance/dbconnect/json-error/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions acceptance/dbconnect/json-error/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"schemaVersion": 1,
"command": "dbconnect sync",
"ok": false,
"mode": "default",
"dryRun": false,
"greenfield": false,
"phases": [
{
"phase": "preflight",
"status": "ok"
},
{
"phase": "resolve",
"status": "error"
},
{
"phase": "fetch",
"status": "pending"
},
{
"phase": "merge",
"status": "pending"
},
{
"phase": "provision",
"status": "pending"
},
{
"phase": "validate",
"status": "pending"
}
],
"warnings": [],
"error": {
"code": "E_NO_TARGET",
"failurePhase": "resolve",
"message": "No compute target is selected. Select a cluster or serverless target, or pass --cluster / --serverless / --job",
"diskMutated": false
},
"durationMs": 0
}
1 change: 1 addition & 0 deletions acceptance/dbconnect/json-error/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
musterr $CLI dbconnect sync --output json
5 changes: 5 additions & 0 deletions acceptance/dbconnect/json-error/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []

[[Repls]]
Old = 'uv uv \S+(?: \([^)]+\))?'
New = 'uv [UV_VERSION]'
3 changes: 3 additions & 0 deletions acceptance/dbconnect/manager-unsupported/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: demo
dependencies:
- python=3.10
3 changes: 3 additions & 0 deletions acceptance/dbconnect/manager-unsupported/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions acceptance/dbconnect/manager-unsupported/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
preflight error detected a conda project; automated setup for conda is not yet available (P1). Use a uv project (add a pyproject.toml with a [tool.uv] table, or run `uv init`) to provision automatically
resolve pending
fetch pending
merge pending
provision pending
validate pending
For more detail, re-run with --debug, or --output json to share a structured report.
Error: detected a conda project; automated setup for conda is not yet available (P1). Use a uv project (add a pyproject.toml with a [tool.uv] table, or run `uv init`) to provision automatically
1 change: 1 addition & 0 deletions acceptance/dbconnect/manager-unsupported/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
musterr $CLI dbconnect sync --serverless v4 --check
5 changes: 5 additions & 0 deletions acceptance/dbconnect/manager-unsupported/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []

[[Repls]]
Old = 'uv uv \S+(?: \([^)]+\))?'
New = 'uv [UV_VERSION]'
3 changes: 3 additions & 0 deletions acceptance/dbconnect/no-target/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions acceptance/dbconnect/no-target/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
preflight ok uv [UV_VERSION]
resolve error No compute target is selected. Select a cluster or serverless target, or pass --cluster / --serverless / --job
fetch pending
merge pending
provision pending
validate pending
For more detail, re-run with --debug, or --output json to share a structured report.
Error: No compute target is selected. Select a cluster or serverless target, or pass --cluster / --serverless / --job
1 change: 1 addition & 0 deletions acceptance/dbconnect/no-target/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
musterr $CLI dbconnect sync
5 changes: 5 additions & 0 deletions acceptance/dbconnect/no-target/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []

[[Repls]]
Old = 'uv uv \S+(?: \([^)]+\))?'
New = 'uv [UV_VERSION]'
3 changes: 3 additions & 0 deletions acceptance/dbconnect/serverless-check/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions acceptance/dbconnect/serverless-check/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

>>> [CLI] dbconnect sync --serverless v4 --check
preflight ok uv [UV_VERSION]
resolve ok source=serverless envKey=serverless/serverless-v4
fetch ok source=[DATABRICKS_URL]/serverless/serverless-v4/pyproject.toml fromCache=false
merge ok
provision ok
validate ok
Plan: [TEST_TMP_DIR]/pyproject.toml
changed region: requires-python
changed region: tool.uv.constraint-dependencies
changed region: databricks-connect
Check complete. No files were modified.
1 change: 1 addition & 0 deletions acceptance/dbconnect/serverless-check/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trace $CLI dbconnect sync --serverless v4 --check
21 changes: 21 additions & 0 deletions acceptance/dbconnect/serverless-check/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = []

[Env]
DATABRICKS_DBCONNECT_CONSTRAINT_SOURCE = "$DATABRICKS_HOST"

[[Server]]
Pattern = "GET /serverless/serverless-v4/pyproject.toml"
Response.Body = '''
[project]
requires-python = ">=3.12"

[dependency-groups]
dev = ["databricks-connect~=17.2.0"]

[tool.uv]
constraint-dependencies = ["pyarrow<19", "pandas<3"]
'''

[[Repls]]
Old = 'uv uv \S+(?: \([^)]+\))?'
New = 'uv [UV_VERSION]'
3 changes: 3 additions & 0 deletions acceptance/dbconnect/serverless-json/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions acceptance/dbconnect/serverless-json/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

>>> [CLI] dbconnect sync --serverless v4 --check --output json
{
"schemaVersion": 1,
"command": "dbconnect sync",
"ok": true,
"mode": "default",
"dryRun": true,
"target": {
"source": "serverless",
"serverlessVersion": "v4",
"envKey": "serverless/serverless-v4"
},
"resolved": {
"pythonVersion": "3.12",
"dbconnectVersion": "17.2.0",
"artifactSource": "network"
},
"greenfield": true,
"plan": {
"wouldWrite": "[TEST_TMP_DIR]/pyproject.toml",
"wouldInstallPython": "3.12",
"diff": "--- pyproject.toml\n+++ pyproject.toml\n@@ -1 +1,17 @@\n+[project]\n+name = \"001\"\n+version = \"0.0.0\"\n+requires-python = \"\u003e=3.12\"\n+\n+[dependency-groups]\n+dev = [\n+ \"databricks-connect~=17.2.0\",\n+]\n+\n+# managed by databricks dbconnect — do not edit\n+[tool.uv]\n+constraint-dependencies = [\n+ \"pyarrow\u003c19\",\n+ \"pandas\u003c3\",\n+]\n+# end managed by databricks dbconnect\n"
},
"phases": [
{
"phase": "preflight",
"status": "ok"
},
{
"phase": "resolve",
"status": "ok"
},
{
"phase": "fetch",
"status": "ok"
},
{
"phase": "merge",
"status": "ok"
},
{
"phase": "provision",
"status": "ok"
},
{
"phase": "validate",
"status": "ok"
}
],
"warnings": [],
"error": null,
"durationMs": 0
}
1 change: 1 addition & 0 deletions acceptance/dbconnect/serverless-json/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trace $CLI dbconnect sync --serverless v4 --check --output json
Loading
Loading