feat(python-setup): resolve serverless version from pyproject.toml - #2130
Conversation
*Why* The environments team is introducing a `[tool.databricks.environment]` table in `pyproject.toml` that carries the serverless `environment_version`, written by the CLI during a serverless setup-local run. Because it is an explicit user declaration, it is a more reliable signal for the serverless version picker than the existing heuristics (bundle YAML, notebook metadata, workspace default), and lets the chosen value round-trip. *What* - Add a new `pyproject` scoring source, weighted above every current signal, so an explicit declaration becomes the recommended default while still flowing through the picker (no silent auto-selection). - New `pyprojectServerlessVersion.ts`: a pure, comment-aware line scan that reads `environment_version` from the canonical `[tool.databricks.environment]` table (no TOML dependency, matching the repo's existing pyproject handling), plus a thin I/O reader over the project-root file. - Wire the source into the observation collector as an independently guarded branch, and label it "pyproject.toml" in the picker. Purely additive: no behaviour change when there is no `pyproject.toml` or no `[tool.databricks.environment]` table. *Verification* - `yarn test:unit` — 858 passing, 0 failing (11 new pyproject tests + 3 extended scoring/observations/picker tests). - `prettier -c` and `eslint` clean on all changed files. Co-authored-by: Isaac
|
🤖 Integration tests triggered for |
*Why* Review feedback: the resolver docstrings still enumerated the evidence sources without the new pyproject.toml one, and the pyproject line scanner's string-context blind spots were only partly documented. *What* - Name pyproject.toml alongside the other sources in serverlessVersionResolver docstrings. - Extend the pyprojectServerlessVersion doc-comment to state the accepted line-scan limitations (multi-line strings, array-continuation lines), matching the sibling packageManagerDetection scanners. Comment-only; no behaviour change. *Verification* - prettier -c and eslint clean on both files. Co-authored-by: Isaac
|
🤖 Integration tests ❌ 1 of 37 test jobs failed for |
|
Integration Tests failure is an unrelated flake — not caused by this PR. Only a single Windows e2e shard failed; all Linux shards and the rest of the Windows matrix passed. The failing suite is Bundle Init ( This is a WebDriver/webview websocket flake (1006 = abnormal closure) in the test harness, not a product failure. This PR only touches the serverless-version resolution utilities under Re-triggering the e2e job. |
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Why
The environments team is introducing a
[tool.databricks.environment]table inpyproject.tomlthat carries the serverlessenvironment_version:The CLI writes this section during a serverless
setup-localrun. Because it is an explicit user declaration, it is a more reliable signal for the serverless version picker than the current heuristics (bundle YAML, notebook metadata, workspace default), and it lets the chosen value round-trip.What
pyprojectscoring source, weighted above every current signal (200 vs bundle's 100), so an explicit declaration becomes the recommended default — while still flowing through the picker, so there is no silent auto-selection.pyprojectServerlessVersion.ts: a pure, comment-aware line scan that readsenvironment_versionfrom the canonical[tool.databricks.environment]table (no TOML dependency — matching the repo's existingpyproject.tomlhandling inpackageManagerDetection.ts), plus a thin I/O reader over the project-root file.collectServerlessVersionObservationsas an independently guarded branch, and label itpyproject.tomlin the picker's provenance.Purely additive: no behaviour change when there is no
pyproject.tomlor no[tool.databricks.environment]table. Extends the earlier serverless version resolution work (#2052 / #2053).Scope note
The scan handles the canonical block form the paired CLI work writes; exotic TOML spellings (dotted-key / inline-table) are intentionally not parsed. A value outside the supported range is dropped like any other source (the CLI would reject it too).
Verification
yarn test:unit— 858 passing, 0 failing (11 newpyprojectcollector tests + 3 extended scoring/observations/picker tests).prettier -candeslintclean on all changed files.This pull request and its description were written by Isaac.