Repository navigation
fix(python-setup): select the shared uv workspace venv for a workspace member - #2253
Conversation
|
🤖 Integration tests running for |
|
🤖 Integration tests running for |
|
🤖 Integration tests ❌ failed for |
9752a1c to
a1c4bd1
Compare
|
🤖 Integration tests ✅ passed for |
|
🤖 Integration tests ✅ passed for |
|
A review turned up three low-severity items — all nice-to-haves, none blocking. Noting them here in case they're worth a follow-up. 1. Constraint-conflict recovery doesn't restore the workspace-root
|
…e member *Why*: * In a monorepo with one uv workspace and one bundle per member, setup-local provisions the shared venv at the workspace root and reports `venvPath` relative to the member folder, for example `../../.venv` (#2157). * The extension passed `venvPath` to the Python extension without resolving it against the project folder, and it read the venv name from a path relative to the extension host's working folder. *What*: * Resolve `venvPath` to an absolute folder before adopting it and reading its name. A value that climbs counts from the symlink-resolved project folder on Unix, as the CLI does; `.venv` stays under the folder as opened; an absolute value stays as is. * Parse `uvWorkspaceRoot` and `uvWorkspaceBackupPath`. The success summary names the shared venv and the root pyproject.toml for a member, with Windows separators on Windows. * Count `W_UV_WORKSPACE_CONSTRAINTS_REPLACED` in the setup-result warning histogram. Co-authored-by: Isaac <no-reply@databricks.com>
…he warning list Co-authored-by: Isaac <no-reply@databricks.com>
…fore adoption A realpath failure on the project folder (renamed or deleted during the CLI run) is a filesystem state, not an extension defect. Show a plain error without "Report this problem" and record reportOffered: false. Co-authored-by: Isaac <no-reply@databricks.com>
e169b07 to
d377b62
Compare
|
Thanks for the review!
|
|
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. |
|
🤖 Integration tests ❌ failed for |
…nflict (#2254) **Stack** (merge in this order): 1. #2253 fix(python-setup): select the shared uv workspace venv for a workspace member (merged) 2. #2254 fix(python-setup): recover a uv workspace member from a constraint conflict ([see diff](main...uv-workspace-shared-venv-2)) **<- this PR** ## Changes For a uv workspace member, `setup-local` writes the constraint pins into the root `pyproject.toml` and shares one venv at the root. The conflict recovery and the adoption gauge assumed one `pyproject.toml` and one `.venv` in the project folder. - **Retry DB Connect setup:** the retry also restores the root `pyproject.toml` from `uvWorkspaceBackupPath`. Without this, the retry with `--no-constraints` keeps the conflicting root pins and fails again. - The retry checks every backup before it restores the first one. - The extension trusts `uvWorkspaceRoot` only when it contains the project folder, as opened or symlink-resolved, because the restore writes there. - A member with no root backup gets no retry, because the root pins stay. - A later setup run inside the restored folder (the workspace root for a member, else the project) makes an older retry stale, because that run can rewrite the same files. A stale click tells the user to run the setup again. - **Open pyproject.toml** opens the root file for a member, because it holds the pins. - **Adoption gauge:** the saved setup state records the project folder and the absolute venv folder. The gauge checks that venv folder. It skips a reading while the state belongs to another bundle in the same workspace folder. State saved by older versions keeps the old behavior. ## Tests - New unit tests cover the root restore, the check before the restore, a root-only backup, a member without a root backup, an untrusted root, a symlinked project folder, stale retries after a member run, after a root project run, and through a symlink, a live retry after an unrelated run, a backup that cannot be read, the "Open" target, the saved state, and the gauge. - Full unit suite: 1420 passing, 0 failing. `yarn run test:lint` reports 0 errors. ## Known limitations - The stale-retry check works within one session. A run that starts outside the restored folder, for example a member opened through a symlink that points outside the workspace root, does not make the retry stale. - After a retry restores the member file, a failed copy of the root file can still leave the two files out of step. The check before the restore makes this rare. - Members share one venv, so a sync for member B can remove packages that only member A needs. Member A still shows as ready in this session. - Drift detection still reads the single setup state and does not use the new project folder. This pull request and its description were written by Isaac. --------- Co-authored-by: Isaac <no-reply@databricks.com>
## packages/databricks-vscode ## (2026-10-22) - fix(bundle): find sub-projects without blocking the extension host (#2249) ([5ebf39f](5ebf39f)) - fix(network): let VS Code handle proxies and certificates for SDK calls (#2266) ([589041a](589041a)) - fix(python-setup): recover a uv workspace member from a constraint conflict (#2254) ([7752f5d](7752f5d)) - fix(python-setup): select the shared uv workspace venv for a workspace member (#2253) ([faa6f58](faa6f58)) - Expose the bundle Configuration view and Bundle Resource Explorer in Databricks Remote SSH mode (#2236) ([375dd8d](375dd8d)) - Update Databricks CLI to v1.22.1 (#2270) ([bc837b5](bc837b5)) ## packages/databricks-vscode-types ## (2026-10-22) Co-authored-by: releasebot <noreply@github.com>
Stack (merge in this order):
Changes
In a monorepo with one uv workspace and one bundle per member, the Python environment setup selects the wrong interpreter (#2157). The Databricks CLI now supports uv workspace members in
databricks environments setup-local(databricks/cli#7018, databricks/cli#7026). For a member, the CLI provisions one shared venv at the workspace root. It reportsvenvPathrelative to the member folder, for example../../.venv, and it addsuvWorkspaceRootanduvWorkspaceBackupPath.venvPathto an absolute folder. It uses this folder to select the interpreter and to read the venv name frompyvenv.cfg.../../.venv) counts from the symlink-resolved project folder on Unix, as the CLI does..venvstays under the project folder as opened.UV_PROJECT_ENVIRONMENT) stays as it is.pyvenv.cfgrelative to the working folder of the extension host, so the venv name did not show in the summary. These fixes also apply to a standalone project.uvWorkspaceRootanduvWorkspaceBackupPath.pyproject.toml. The venv folder uses Windows separators on Windows.W_UV_WORKSPACE_CONSTRAINTS_REPLACED.Tests
.venvunder the opened folder, an absolutevenvPath, the venv name, the result fields, the summary text on Linux and Windows, and the warning count.yarn run test:lintreports 0 errors.Known limitations
venvPathis always.venv, and this PR changes only the two standalone fixes above.This pull request and its description were written by Isaac.