-
Notifications
You must be signed in to change notification settings - Fork 36
Add VenvUv support and alwaysUseUv setting to control UV usage for virtual environments #940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
6a5aad4
Initial plan
Copilot 5084351
Add VenvUv support and alwaysUseUv setting
Copilot cbaf95e
Add unit tests for shouldUseUv function
Copilot 7398ade
Improve LogOutputChannel mock completeness in tests
Copilot 39345db
updates
eleanorjboyd 56a9cad
updates
eleanorjboyd 20c6c09
uv tracking logic
eleanorjboyd 11bfc6e
updates to instructions
eleanorjboyd 3a8220b
fix tests
eleanorjboyd e7083cf
fix tests
eleanorjboyd ea1bca3
update with learnings
eleanorjboyd 0d6d5ae
Merge branch 'main' into copilot/add-toggle-for-uv-venvs
eleanorjboyd a081af8
reset uv cache
eleanorjboyd 964528a
another
eleanorjboyd 3e63004
inspect vs
eleanorjboyd 6eb134d
ugh
eleanorjboyd f5bf7b1
part 10
eleanorjboyd d4c047b
this
eleanorjboyd 07385a4
help mock
eleanorjboyd 66f599b
fix mock
eleanorjboyd e7f6995
update mocking
eleanorjboyd 6837713
whatever
eleanorjboyd 6989f40
switch to child process mock
eleanorjboyd 74a408b
update learning
eleanorjboyd bbb6a07
Merge branch 'main' into copilot/add-toggle-for-uv-venvs
eleanorjboyd b71a68e
update from comments
eleanorjboyd ebaa3b4
switch to `uv` from `venvuv`
eleanorjboyd d16766f
Merge branch 'main' into copilot/add-toggle-for-uv-venvs
eleanorjboyd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { ENVS_EXTENSION_ID } from '../../common/constants'; | ||
| import { getWorkspacePersistentState } from '../../common/persistentState'; | ||
|
|
||
| /** | ||
| * Persistent storage key for UV-managed virtual environments. | ||
| * | ||
| * This key is used to store a list of environment paths that were created or identified | ||
| * as UV-managed virtual environments. The stored paths correspond to the | ||
| * PythonEnvironmentInfo.environmentPath.fsPath values. | ||
| */ | ||
| export const UV_ENVS_KEY = `${ENVS_EXTENSION_ID}:uv:UV_ENVIRONMENTS`; | ||
|
|
||
| /** | ||
| * @returns Array of environment paths (PythonEnvironmentInfo.environmentPath.fsPath values) | ||
| * that are known to be UV-managed virtual environments | ||
| */ | ||
| export async function getUvEnvironments(): Promise<string[]> { | ||
| const state = await getWorkspacePersistentState(); | ||
| return (await state.get(UV_ENVS_KEY)) ?? []; | ||
| } | ||
|
|
||
| /** | ||
| * @param environmentPath The environment path (should be PythonEnvironmentInfo.environmentPath.fsPath) | ||
| * to mark as UV-managed. Duplicates are automatically ignored. | ||
| */ | ||
| export async function addUvEnvironment(environmentPath: string): Promise<void> { | ||
| const state = await getWorkspacePersistentState(); | ||
| const uvEnvs = await getUvEnvironments(); | ||
| if (!uvEnvs.includes(environmentPath)) { | ||
| uvEnvs.push(environmentPath); | ||
| await state.set(UV_ENVS_KEY, uvEnvs); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @param environmentPath The environment path (PythonEnvironmentInfo.environmentPath.fsPath) | ||
| * to remove from UV tracking. No-op if path not found. | ||
| */ | ||
| export async function removeUvEnvironment(environmentPath: string): Promise<void> { | ||
| const state = await getWorkspacePersistentState(); | ||
| const uvEnvs = await getUvEnvironments(); | ||
| const filtered = uvEnvs.filter((path) => path !== environmentPath); | ||
| await state.set(UV_ENVS_KEY, filtered); | ||
| } | ||
|
|
||
| /** | ||
| * Clears all UV-managed environment paths from the tracking list. | ||
| */ | ||
| export async function clearUvEnvironments(): Promise<void> { | ||
| const state = await getWorkspacePersistentState(); | ||
| await state.set(UV_ENVS_KEY, []); | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.