feat: add WORKON_HOME and XDG_DATA_HOME support for pipenv (Fixes #1185)#1249
Merged
karthiknadig merged 1 commit intomicrosoft:mainfrom Feb 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for WORKON_HOME and XDG_DATA_HOME environment variables when discovering pipenv virtualenv directories. The implementation adds a new utility function that mirrors the logic from the PET (Python Environment Tools) server to ensure consistent environment discovery across platforms.
Changes:
- Added
getPipenvVirtualenvDirs()function to centralize pipenv virtualenv directory discovery logic - Added comprehensive unit tests covering all environment variable scenarios, priority ordering, and cross-platform behavior
- Added verbose logging for debugging pipenv discovery issues
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/managers/pipenv/pipenvUtils.ts |
Adds getPipenvVirtualenvDirs() function that checks WORKON_HOME, XDG_DATA_HOME, and platform-specific default paths in priority order |
src/test/managers/pipenv/pipenvUtils.getPipenvVirtualenvDirs.unit.test.ts |
Comprehensive unit tests (8 test cases) covering environment variable scenarios, deduplication, tilde expansion, and cross-platform behavior |
roblourens
approved these changes
Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds support for
WORKON_HOMEandXDG_DATA_HOMEenvironment variables when discovering pipenv virtualenv directories.Changes
getPipenvVirtualenvDirs()function topipenvUtils.tsthat returns directories where pipenv virtualenvs may be storedDiscovery Priority
The function checks these locations in priority order:
WORKON_HOME(if set and exists) - commonly shared with virtualenvwrapperXDG_DATA_HOME/virtualenvs(if XDG_DATA_HOME is set and path exists)~/.local/share/virtualenvs(Linux/macOS default)~/.virtualenvs(Windows default)Testing
fs.existsSynccannot be stubbed)Fixes #1185