Skip to content

Offer a one-click "Install uv" action when uv is missing - #2162

Merged
rugpanov merged 5 commits into
mainfrom
fix/uv-install-action
Sep 1, 2026
Merged

Offer a one-click "Install uv" action when uv is missing#2162
rugpanov merged 5 commits into
mainfrom
fix/uv-install-action

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Why

When environments setup-local fails with E_UV_MISSING, the failure popup offered a single Install uv button that only opened uv's docs page — the label promised an install but delivered documentation. Users had to leave the editor, read the guide, pick the right installer for their OS, and run it by hand.

What

The E_UV_MISSING popup now shows two remediation buttons:

  • Install uv — runs uv's official installer in a VS Code terminal for the current platform:

    • macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh
    • Windows: irm https://astral.sh/uv/install.ps1 | iex (via PowerShell; cmd shells out to it)

    A short banner explains the step and points the user back at Set up Python environment; the terminal stays open so the installer's own step-by-step output remains readable.

  • Installation guide — opens the docs page (the previous behavior), for users who prefer to install uv themselves.

Implementation

  • New pure uvInstall.ts builds the per-shell command line from the shared shellUtils helpers, so the curl/irm split and the ;/& separator are correct across macOS, Linux and Windows.
  • New databricks.environment.installUv command runs it in a terminal, mirroring the existing az login terminal pattern (AzureCliCheck).
  • showError now takes an ordered list of remediation actions instead of one; getPythonSetupErrorActions returns two for E_UV_MISSING and one (or none) for every other code. The docs link is single-sourced from the existing per-code action.

Verification

  • New unit tests: uvInstall command per shell dialect; getPythonSetupErrorActions two-button / one-button / empty cases; wiring renders both buttons in order and dispatches the command-action.
  • yarn build (typecheck) clean; full unit suite 1029 passing; test:lint clean.

This pull request and its description were written by Isaac.

*Why*

When `environments setup-local` fails with E_UV_MISSING, the failure
popup offered a single "Install uv" button that only opened uv's docs
page — the label promised an install but delivered documentation. Users
had to leave the editor, read the guide, pick the right installer for
their OS, and run it by hand.

*What*

The E_UV_MISSING popup now shows two remediation buttons:

- **Install uv** — runs uv's official installer in a VS Code terminal
  for the current platform (`curl -LsSf https://astral.sh/uv/install.sh
  | sh` on macOS/Linux; `irm https://astral.sh/uv/install.ps1 | iex` via
  PowerShell on Windows). A short banner explains the step and points the
  user back at "Set up Python environment"; the terminal stays open so
  the installer's own output remains readable.
- **Installation guide** — opens the docs page (the previous behavior),
  for users who prefer to install uv themselves.

New `uvInstall.ts` builds the per-shell command line from the shared
`shellUtils` helpers (so the curl/irm split and `;`/`&` separator are
correct across macOS, Linux and Windows). A new
`databricks.environment.installUv` command runs it in a terminal,
mirroring the `az login` pattern. `showError` now takes an ordered list
of remediation actions instead of one; `getPythonSetupErrorActions`
returns two for E_UV_MISSING and one (or none) for every other code.

*Verification*

- New unit tests: `uvInstall` command per shell dialect;
  `getPythonSetupErrorActions` two-button/one-button/empty cases; wiring
  renders both buttons in order and dispatches the command-action.
- `yarn build` (typecheck) clean; full unit suite 1029 passing;
  `test:lint` clean.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:10 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:10 — with GitHub Actions Active
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for 6651a135 — ⏳ running.
View run

*Why*

Review found a Windows correctness bug: uvInstallTerminalCommand chose
the installer OS from the terminal's shell *dialect*. On Windows with a
Git Bash / WSL default profile (posix syntax), it ran the POSIX
`install.sh`, landing a Linux/WSL uv that the Windows extension host's
setup-local cannot see.

*What*

Select the installer OS from `process.platform`; keep command-line
syntax (separator, echo) from the shell dialect — two independent axes.
On Windows we reach the Windows installer via `powershell.exe`
(`.exe` so WSL interop resolves it) from cmd and posix shells alike, and
`irm | iex` directly inside PowerShell. Also trimmed the install-command
comment in extension.ts per the code-conventions review.

*Verification*

- New unit test covers the Windows + POSIX-dialect (Git Bash/WSL) case;
  existing per-dialect tests updated to pass the host platform.
- `yarn build` clean; full unit suite 1030 passing; `test:lint` clean.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:18 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:18 — with GitHub Actions Active
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for 91cb8e89 — ⏳ running.
View run

*Why*

Code review flagged two things on the "Install uv" action: running a
remote install script deserves an explicit heads-up, and the Windows
path relied on powershell.exe being reachable from a WSL/Git Bash
default profile (interop can be disabled), which could strand the
Windows uv.

*What*

- Show a modal confirmation before running the installer, naming the
  source (astral.sh) and stating that its script executes locally. The
  terminal only opens if the user confirms.
- Pin the install terminal to powershell.exe on Windows via a new pure
  uvInstallTerminalSpec, so the install no longer depends on the default
  profile's Windows interop; macOS/Linux keep the default POSIX profile.

*Verification*

- New unit tests for uvInstallTerminalSpec (Windows pins PowerShell +
  irm|iex; macOS/Linux default profile + curl install.sh).
- yarn build clean; full unit suite 1032 passing; test:lint clean.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:30 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:31 — with GitHub Actions Active
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for ae0883ff — ⏳ running.
View run

*Why*

Review noted that a pwsh default terminal profile on macOS/Linux is a
supported configuration, but the install command was hardcoded to POSIX
syntax there — so the printf banner lines would not parse in PowerShell.

*What*

uvInstallTerminalSpec now takes the resolved shell dialect (default
currentShellKind) and uses it for the command syntax on macOS/Linux, so
a pwsh profile gets PowerShell syntax (Write-Host, not printf) while
still curling the POSIX installer (uv is a *nix build there). Windows is
unchanged (pinned to powershell.exe).

*Verification*

- New unit tests: pwsh-on-macOS/Linux at both the command and spec level;
  existing POSIX cases pass the dialect explicitly.
- yarn build clean; full unit suite 1034 passing; test:lint clean.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:39 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:40 — with GitHub Actions Active
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for bcbaba29 — ⏳ running.
View run

*Why*

Review repeatedly noted the "Install uv" command handler's gate logic
(confirm, then open the terminal) lived untested in activate().

*What*

Move the gate into runUvInstall(deps) in uvInstall.ts, with confirm /
openTerminal seams; extension.ts wires them to the modal and
window.createTerminal. Unit tests now cover both branches: confirm opens
one terminal, dismiss opens none.

*Verification*

- New runUvInstall unit tests (confirm → opens; dismiss → nothing).
- yarn build clean; full unit suite 1036 passing; test:lint clean.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:45 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 31, 2026 13:45 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/vscode

Inputs:

  • PR number: 2162
  • Commit SHA: f6e84538549c93637eddffe198dc9c4db0b4301e

Checks will be approved automatically on success.

@rugpanov

rugpanov commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ✅ all 41 test jobs passed for f6e84538.
View run

@rugpanov
rugpanov marked this pull request as ready for review August 31, 2026 14:46
@rugpanov
rugpanov merged commit 9f6f125 into main Sep 1, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants