Repository navigation
Fall back when Python environments API is incomplete - #81
Conversation
|
Revalidated this change against current The runtime case remains relevant: current Current-main validation:
The upstream run now has 19 successful checks, including Linux/Windows Python 3.10–3.14, TypeScript, both CodeQL analyses, version checks, and CLA. The only failure is The public head remains the original GitHub-verified commit because GitHub reports the PR as mergeable and the current-main changes do not overlap the patch. Marking this ready for maintainer review. |
There was a problem hiding this comment.
🟢 Approval recommended
The implementation addresses the reported failure with focused, comprehensive tests and no unresolved issues.
Pull request overview
Adds robust fallback behavior when the preferred Python Environments API is unavailable or incomplete.
Changes:
- Validates required API capabilities before caching.
- Falls back to the legacy Python API.
- Treats package-change events as optional with a no-op disposable.
File summaries
| File | Description |
|---|---|
typescript/src/python.ts |
Implements API validation, fallback, and optional package events. |
typescript/tests/python.test.ts |
Tests fallback, caching, and missing optional events. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
sama Pyb (@Pybsama) |
Preserve PR81 history while validating required preferred API capabilities, retaining optional events and extending focused regressions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 85ef72cc-9e26-4bc4-b1c3-55256d9bef91
|
Tested locally with extensions and everything looks great! Thank you very much for picking this up :) |
ef8e0bf
into
microsoft:main
Summary
Context
When the Python Environments integration is disabled, the installed extension can return
undefinedexports without throwing. The shared provider previously cached that result and later failed while subscribing to environment/package events instead of trying its existing legacy fallback.This change belongs in the source-pinned shared runtime consumed by Pylint and the other VS Code Python tool extensions. This repository does not independently release npm/PyPI packages; there is no version bump or release-workflow version synchronization. Dependencies, lockfiles, serialized settings defaults, Python runtime source, and consumer pins are unchanged. Consumer updates remain separate work.
Addresses microsoft/vscode-pylint#856.
Current
main(0425ee5673d3f8f8abb055a424bcb9aa52132eb9) was merged into the original PR history without rebasing or force-pushing. The signed update ise46a48f887bccc67b9322242c5f8ad84cc4e0176.The delta remains focused on
typescript/src/python.tsandtypescript/tests/python.test.ts, plus a necessary two-line update to the existingtypescript/tests/toolExtension.test.tsmock: a healthy preferred API fixture must now includeresolveEnvironment.Validation — 2026-11-18
Using Node 24.17.0, pinned by
.nvmrc, fromtypescript:npm test -- --grep PythonEnvironmentsProvider --reporter dot: 32 passing.npm test -- --grep 'PythonEnvironmentsProvider|activateToolExtension' --reporter dot: 45 passing.npm test -- --reporter dot: 199 passing (includes the test compilation step).npm run build: passed.npm run lint: passed, with two pre-existing unusedeslint-disablewarnings in untouchedsrc/vscodeapi.ts.npx --no-install prettier --check --single-quote --tab-width 4 --print-width 120 src/python.ts tests/python.test.ts: passed, preserving the existing source style.git diff --check: passed.The default
npm run format-checkreports the same 15 source-file warnings as untouched currentmain; unrelated files were not mass-formatted. The activation test file also has pre-existing formatting differences under the explicit style options, verified against untouchedmain; its only changes are the two fixture lines.Python source is unchanged, so no fresh Python environment was created and Python tests were not rerun for this TypeScript-only fix. A real VS Code/Pylint manual smoke test has not been run.