-
Notifications
You must be signed in to change notification settings - Fork 209
localenv: write [tool.databricks.environment] version on serverless setup-local #6256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
223d3a0
localenv: write [tool.databricks.environment] version on serverless s…
rugpanov 4759a48
localenv: drop changelog fragment (setup-local not yet released)
rugpanov f61bb7a
localenv: test setup-local environment merge on pre-feature managed f…
rugpanov 3f5940e
localenv: address setup-local environment-version review feedback
rugpanov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
|
|
||
| >>> [CLI] environments setup-local --cluster-name my-cluster --dry-run | ||
| warning: [tool.databricks.environment] environment_version "5" is left from a serverless target but the current target is a cluster; it is not updated | ||
| Plan: [TEST_TMP_DIR]/pyproject.toml | ||
| changed region: tool.uv.constraint-dependencies | ||
| Check complete. No files were modified. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # An existing project set up for serverless carries [tool.databricks.environment]. | ||
| # Re-running against a cluster target leaves it untouched but warns it is stale. | ||
| cat > pyproject.toml <<'PY' | ||
| [project] | ||
| name = "demo" | ||
| requires-python = ">=3.11" | ||
|
|
||
| [dependency-groups] | ||
| dev = ["databricks-connect~=15.4.0"] | ||
|
|
||
| [tool.databricks.environment] | ||
| environment_version = "5" | ||
| PY | ||
|
|
||
| trace $CLI environments setup-local --cluster-name my-cluster --dry-run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| 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" | ||
|
|
||
| # A cluster target does not manage [tool.databricks.environment], so a leftover | ||
| # serverless environment_version is reported as stale. | ||
| [[Server]] | ||
| Pattern = "GET /api/2.1/clusters/list" | ||
| Response.Body = ''' | ||
| { | ||
| "clusters": [ | ||
| {"cluster_id": "cid-123", "cluster_name": "my-cluster", "spark_version": "15.4.x-scala2.12"} | ||
| ] | ||
| } | ||
| ''' | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /dbr/15.4.x-scala2.12/pyproject.toml" | ||
| Response.Body = ''' | ||
| [project] | ||
| requires-python = ">=3.11" | ||
|
|
||
| [dependency-groups] | ||
| dev = ["databricks-connect~=15.4.0"] | ||
|
|
||
| [tool.uv] | ||
| constraint-dependencies = ["pyarrow<19"] | ||
| ''' | ||
|
|
||
| [[Repls]] | ||
| Old = 'uv uv \S+(?: \([^)]+\))?' | ||
| New = 'uv [UV_VERSION]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we using a TOML library to do this merging rather than hand-rolling regexes?
Not a blocker since it seems the rest of this file does the same. This is the first of the merging code I'm reviewing so I'm curious why this approach was taken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The merge preserves the user's file byte-for-byte outside the small managed regions — comments, key ordering, and whitespace all survive. A TOML library round-trip (decode → re-encode) reformats the whole document, drops comments, and reorders keys, which isn't acceptable for a user-owned
pyproject.tomlwe only partially manage. So it's deliberately line-based with targeted edits, and it refuses to merge (rather than risk corruption) on shapes it can't safely edit line-wise — e.g. multi-line strings (errMultilineString).