Skip to content

uv: continue Python installation after bootstrapping uv - #1872

Draft
Eleanor Boyd (eleanorjboyd) wants to merge 1 commit into
microsoft:mainfrom
eleanorjboyd:agents/fix-uv-bootstrap-path
Draft

Eleanor Boyd (eleanorjboyd) wants to merge 1 commit into
microsoft:mainfrom
eleanorjboyd:agents/fix-uv-bootstrap-path

Conversation

@eleanorjboyd

Copy link
Copy Markdown
Member

Fixes #1871.

Problem

When uv's install directory is not already on the extension host's PATH, the official installer can succeed but the subsequent bare uv --version lookup still fails. Python installation then stops at uvNotOnPath.

Updating shell startup files does not update the already-running extension host's environment. Resetting the availability cache alone cannot fix this.

Changes

  • Retain the installed uv executable for the current extension-host session, honoring the standalone installer's explicit, legacy, unmanaged, XDG, and default destinations.
  • Use that executable consistently for availability checks, Python installation, installed/available Python version listing, and subsequent shared uv operations.
  • Preserve the executable across availability-cache resets and prevent an older in-flight check from overwriting a newly reset cache.
  • Leave process PATH and the integrated terminal's PATH unchanged.
  • Add 23 regression cases covering the complete bootstrap handoff, failures, inline-script version lookup, cache behavior, and Windows/POSIX destination naming. Update the uv behavior documentation.

Validation

  • npm run compile-tests
  • npm run compile
  • npm run unittest -- --grep 'uvPythonInstaller|Helpers|Pip and UV command parsing|InlineScriptEnvManager' — 518 passing
  • ESLint on all four changed TypeScript files
  • git diff --check

Real installation checks on macOS arm64

Used isolated VS Code development hosts, real consent dialogs/tasks, uv 0.12.21, and real Python 3.11.15 installations. All fixture home paths included spaces.

Case Before With this change
Fresh uv installation; destination absent from extension-host PATH uv task succeeds, then uvNotOnPath; no Python installation uv and Python tasks succeed; returned Python executes
Fresh installation; destination already on PATH Succeeds Succeeds
New host reusing installed uv with explicitly corrected PATH Succeeds Succeeds

In the fixed missing-PATH case, bare uv --version still returns ENOENT, while the extension successfully installs and locates Python using the absolute executable path. This confirms the fix does not depend on PATH mutation.

Reviewer notes

  • Native Windows integration was not run; Windows destination/naming behavior has unit coverage.
  • The real-host harness directly invokes the compiled production installer modules and exercises real VS Code tasks/UI. It does not exercise automatic no-Python detection or the bundled extension's full activation path.
  • Related open PR uv: install uv before listing Python versions #1834 changes the Global-create prerequisite flow in the same installer file. This PR preserves installUv's boolean return contract; the two changes address different steps of the workflow.

Keep the standalone installer's uv path for verification, Python installation and listing, and subsequent uv operations without changing the extension host PATH. Add bootstrap, destination, and cache regression coverage for microsoft#1871.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Python installation stops after successful uv bootstrap

1 participant