Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .nextchanges/cli/setup-local-orthogonal-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added orthogonal `--no-constraints`, `--no-dbconnect`, and `--no-provision` flags to `databricks environments setup-local`. The flags compose: `--no-constraints` skips writing the remote Python-version and dependency pins, `--no-dbconnect` skips the databricks-connect dependency, and `--no-provision` writes the project files but stops before creating the virtual environment. Phases that a flag opts out of report a new `skipped` status in `--output json`.
1 change: 1 addition & 0 deletions .nextchanges/cli/setup-local-provision-conflict.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`databricks environments setup-local` now reports a distinct `E_PROVISION_CONFLICT` error code in `--output json` when `uv sync` fails and the merge phase detected a version conflict between the project's dependencies and the pins written for the target environment (the same conflict surfaced as a `W_USER_CONSTRAINT_CONFLICT` warning). Other sync failures continue to report `E_PROVISION`.
3 changes: 3 additions & 0 deletions acceptance/localenv/help/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Flags:
--dry-run compute the plan without writing files or provisioning
-h, --help help for setup-local
--job-task string job task to use as the compute target, as <job-id>.<task-key> (the task key is required)
--no-constraints skip writing the remote Python version and dependency constraints
--no-dbconnect skip adding the databricks-connect dependency
--no-provision write the project files but skip creating the virtual environment (no uv sync, Python download, or validation)
--serverless-version string serverless version to use as the compute target (e.g. 5)

Global Flags:
Expand Down
2 changes: 2 additions & 0 deletions acceptance/localenv/no-constraints/out.test.toml

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

60 changes: 60 additions & 0 deletions acceptance/localenv/no-constraints/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

>>> [CLI] environments setup-local --serverless-version 4 --no-constraints --dry-run --output json
{
"schemaVersion": 1,
"command": "environments setup-local",
"ok": true,
"mode": "default",
"dryRun": true,
"compute": {
"source": "serverless",
"serverlessVersion": "v4",
"envKey": "serverless/serverless-v4"
},
"resolved": {
"pythonVersion": "3.12",
"dbconnectVersion": "17.2.0",
"artifactSource": "network"
},
"greenfield": false,
"plan": {
"wouldWrite": "[TEST_TMP_DIR]/pyproject.toml",
"wouldBackup": "[TEST_TMP_DIR]/pyproject.toml.bak",
"wouldInstallPython": "3.12",
"diff": "--- pyproject.toml\n+++ pyproject.toml.new\n@@ -3,4 +3,7 @@\n requires-python = \"\u003e=3.10\"\n \n [dependency-groups]\n-dev = [\"databricks-connect~=16.0\"]\n+dev = [\"databricks-connect~=17.2.0\"]\n+\n+[tool.databricks.environment]\n+environment_version = \"4\"\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": [
{
"code": "W_DBCONNECT_PIN_OVERRIDDEN",
"message": "databricks-connect \"databricks-connect~=16.0\" is replaced by the environment's \"databricks-connect~=17.2.0\""
}
],
"error": null,
"durationMs": [DURATION_MS]
}
15 changes: 15 additions & 0 deletions acceptance/localenv/no-constraints/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# --no-constraints leaves the remote Python version and dependency pins
# unmanaged: the plan writes neither requires-python nor the [tool.uv] constraint
# block, and the user's existing requires-python is left untouched. The
# databricks-connect dependency (orthogonal to --no-constraints) is still managed.
# The JSON plan shows the diff.
cat > pyproject.toml <<'PY'
[project]
name = "demo"
requires-python = ">=3.10"

[dependency-groups]
dev = ["databricks-connect~=16.0"]
PY

trace $CLI environments setup-local --serverless-version 4 --no-constraints --dry-run --output json
23 changes: 23 additions & 0 deletions acceptance/localenv/no-constraints/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]

# The script writes pyproject.toml as the merge input; --dry-run leaves it unchanged.
Ignore = ["pyproject.toml"]

Env.DATABRICKS_LOCALENV_CONSTRAINT_SOURCE_URL_TEST_OVERRIDE = "$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"]
'''

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

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

59 changes: 59 additions & 0 deletions acceptance/localenv/no-dbconnect/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

>>> [CLI] environments setup-local --serverless-version 4 --no-dbconnect --dry-run --output json
{
"schemaVersion": 1,
"command": "environments setup-local",
"ok": true,
"mode": "constraints-only",
"dryRun": true,
"compute": {
"source": "serverless",
"serverlessVersion": "v4",
"envKey": "serverless/serverless-v4"
},
"resolved": {
"pythonVersion": "3.12",
"artifactSource": "network"
},
"greenfield": false,
"plan": {
"wouldWrite": "[TEST_TMP_DIR]/pyproject.toml",
"wouldBackup": "[TEST_TMP_DIR]/pyproject.toml.bak",
"wouldInstallPython": "3.12",
"diff": "--- pyproject.toml\n+++ pyproject.toml.new\n@@ -1,7 +1,17 @@\n [project]\n name = \"demo\"\n-requires-python = \"\u003e=3.10\"\n+requires-python = \"\u003e=3.12\"\n dependencies = [\"databricks-connect==15.1.*\"]\n \n [dependency-groups]\n dev = [\"databricks-connect~=16.0\"]\n+\n+[tool.databricks.environment]\n+environment_version = \"4\"\n+\n+# managed by databricks environments setup-local — do not edit\n+[tool.uv]\n+constraint-dependencies = [\n+ \"pyarrow\u003c19\",\n+]\n+# end managed by databricks environments setup-local\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": [
{
"code": "W_REQUIRES_PYTHON_OVERRIDDEN",
"message": "requires-python \"\u003e=3.10\" is replaced by the environment's \"\u003e=3.12\""
}
],
"error": null,
"durationMs": [DURATION_MS]
}
15 changes: 15 additions & 0 deletions acceptance/localenv/no-dbconnect/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# --no-dbconnect is the orthogonal spelling of --constraints-only: it omits the
# databricks-connect dependency (mode "constraints-only") while still managing
# requires-python and the [tool.uv] constraints. Existing databricks-connect
# requirements the user already had are left untouched.
cat > pyproject.toml <<'PY'
[project]
name = "demo"
requires-python = ">=3.10"
dependencies = ["databricks-connect==15.1.*"]

[dependency-groups]
dev = ["databricks-connect~=16.0"]
PY

trace $CLI environments setup-local --serverless-version 4 --no-dbconnect --dry-run --output json
23 changes: 23 additions & 0 deletions acceptance/localenv/no-dbconnect/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]

# The script writes pyproject.toml as the merge input; --dry-run leaves it unchanged.
Ignore = ["pyproject.toml"]

Env.DATABRICKS_LOCALENV_CONSTRAINT_SOURCE_URL_TEST_OVERRIDE = "$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"]
'''

[[Repls]]
Old = 'uv uv \S+(?: \([^)]+\))?'
New = 'uv [UV_VERSION]'
2 changes: 2 additions & 0 deletions acceptance/localenv/no-provision-dry-run/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/localenv/no-provision-dry-run/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

>>> [CLI] environments setup-local --serverless-version 4 --no-provision --dry-run --output json
{
"schemaVersion": 1,
"command": "environments setup-local",
"ok": true,
"mode": "default",
"dryRun": true,
"compute": {
"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",
"diff": "--- pyproject.toml\n+++ pyproject.toml\n@@ -1 +1,20 @@\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+[tool.databricks.environment]\n+environment_version = \"4\"\n+\n+# managed by databricks environments setup-local — do not edit\n+[tool.uv]\n+constraint-dependencies = [\n+ \"pyarrow\u003c19\",\n+ \"pandas\u003c3\",\n+]\n+# end managed by databricks environments setup-local\n"
},
"phases": [
{
"phase": "preflight",
"status": "ok"
},
{
"phase": "resolve",
"status": "ok"
},
{
"phase": "fetch",
"status": "ok"
},
{
"phase": "merge",
"status": "ok"
},
{
"phase": "provision",
"status": "skipped"
},
{
"phase": "validate",
"status": "skipped"
}
],
"warnings": [],
"error": null,
"durationMs": [DURATION_MS]
}
4 changes: 4 additions & 0 deletions acceptance/localenv/no-provision-dry-run/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# --dry-run --no-provision: nothing is provisioned (as with any dry run), but the
# plan reflects the real run's intent, so provision and validate report "skipped"
# rather than the "ok" a plain dry run reports.
trace $CLI environments setup-local --serverless-version 4 --no-provision --dry-run --output json
20 changes: 20 additions & 0 deletions acceptance/localenv/no-provision-dry-run/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]

Env.DATABRICKS_LOCALENV_CONSTRAINT_SOURCE_URL_TEST_OVERRIDE = "$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]'
2 changes: 2 additions & 0 deletions acceptance/localenv/no-provision-text/out.test.toml

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

10 changes: 10 additions & 0 deletions acceptance/localenv/no-provision-text/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

>>> [CLI] environments setup-local --serverless-version 4 --no-provision
✔ Project files written (provisioning skipped)

Compute target serverless 4
Python 3.12
databricks-connect 17.2.0
pyproject.toml created

No virtual environment was created (--no-provision). Re-run without --no-provision to create it.
3 changes: 3 additions & 0 deletions acceptance/localenv/no-provision-text/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Text-mode --no-provision: the files are written but no virtual environment is
# created, so the summary must not claim a venv or print activation hints for one.
trace $CLI environments setup-local --serverless-version 4 --no-provision
24 changes: 24 additions & 0 deletions acceptance/localenv/no-provision-text/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]

# A real --no-provision run creates pyproject.toml through the merge phase; the
# assertion is the JSON output, so ignore the written file.
Ignore = ["pyproject.toml"]

Env.DATABRICKS_LOCALENV_CONSTRAINT_SOURCE_URL_TEST_OVERRIDE = "$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]'
2 changes: 2 additions & 0 deletions acceptance/localenv/no-provision/out.test.toml

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

49 changes: 49 additions & 0 deletions acceptance/localenv/no-provision/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

>>> [CLI] environments setup-local --serverless-version 4 --no-provision --output json
{
"schemaVersion": 1,
"command": "environments setup-local",
"ok": true,
"mode": "default",
"dryRun": false,
"compute": {
"source": "serverless",
"serverlessVersion": "v4",
"envKey": "serverless/serverless-v4"
},
"resolved": {
"pythonVersion": "3.12",
"dbconnectVersion": "17.2.0",
"artifactSource": "network"
},
"greenfield": true,
"phases": [
{
"phase": "preflight",
"status": "ok"
},
{
"phase": "resolve",
"status": "ok"
},
{
"phase": "fetch",
"status": "ok"
},
{
"phase": "merge",
"status": "ok"
},
{
"phase": "provision",
"status": "skipped"
},
{
"phase": "validate",
"status": "skipped"
}
],
"warnings": [],
"error": null,
"durationMs": [DURATION_MS]
}
Loading
Loading