Add UV environment support for package installation in Jupyter extension #16799
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements UV environment support for the Jupyter extension, enabling proper package installation in UV-managed Python environments using
uv pip install
instead of the defaultpip install
.Problem
When users work with UV-managed Python environments, the Jupyter extension would attempt to install packages using the standard
pip install
command, which doesn't work correctly in UV environments. UV requires usinguv pip install <package>
for proper dependency management and virtual environment isolation.Solution
Added comprehensive UV environment support following the existing installer architecture patterns:
Core Changes
Environment Type Detection
UV
toEnvironmentType
enumUV Installer Implementation
UvInstaller
class extendingModuleInstaller
uv pip install
command generation--upgrade
for package upgrades--force-reinstall
for forced reinstallation--upgrade-strategy eager
for dependency updatesService Integration
Command Examples
Architecture Compliance
Testing
Files Changed
src/platform/pythonEnvironments/info/index.ts
- Added UV environment typesrc/platform/interpreter/installer/types.ts
- Added UV installer typesrc/platform/interpreter/helpers.ts
- Enhanced environment detectionsrc/platform/interpreter/installer/uvInstaller.node.ts
- New UV installer implementationsrc/platform/interpreter/installer/pipInstaller.node.ts
- Exclude UV environmentssrc/platform/interpreter/installer/channelManager.node.ts
- UV error handlingsrc/platform/interpreter/serviceRegistry.node.ts
- Service registrationsrc/platform/interpreter/installer/uvInstaller.unit.test.ts
- New unit testsBackward Compatibility
This change is fully backward compatible:
Future Considerations
Fixes #16783
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.