Skip to content

Commit 4720192

Browse files
Fix a bug with Quick Create not installing workspace dependencies (#1054)
There are two ways user can do `Quick Create`. 1. When user goes from `Create Virtual Environment -> Quick Create`, the workspace dependencies are installed in the newly created virtual environment. 2. When user goes from `Create Virtual Environment -> venv -> Quick Create`, the workspace dependencies are NOT installed in the newly created virtual environment. This is because the packages are not collected in the code flow. This PR adds that step back. <img width="607" height="133" alt="image" src="https://github.com/user-attachments/assets/a76a14e5-33da-41d8-ab01-993ff471182a" />
1 parent bd4a014 commit 4720192

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/managers/builtin/venvStepBasedFlow.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { EventNames } from '../../common/telemetry/constants';
77
import { sendTelemetryEvent } from '../../common/telemetry/sender';
88
import { showInputBoxWithButtons, showQuickPickWithButtons } from '../../common/window.apis';
99
import { NativePythonFinder } from '../common/nativePythonFinder';
10-
import { getWorkspacePackagesToInstall, PipPackages } from './pipUtils';
10+
import { getProjectInstallable, getWorkspacePackagesToInstall, PipPackages } from './pipUtils';
1111
import { CreateEnvironmentResult, createWithProgress, ensureGlobalEnv } from './venvUtils';
1212

1313
/**
@@ -332,8 +332,17 @@ export async function createStepBasedVenvFlow(
332332
sendTelemetryEvent(EventNames.VENV_CREATION, undefined, { creationType: 'quick' });
333333
// Use the default .venv name for quick create
334334
const quickEnvPath = path.join(venvRoot.fsPath, '.venv');
335+
336+
// Get workspace dependencies to install
337+
const project = api.getPythonProject(venvRoot);
338+
const installables = await getProjectInstallable(api, project ? [project] : undefined);
339+
const allPackages = [];
340+
allPackages.push(...(installables?.flatMap((i) => i.args ?? []) ?? []));
341+
if (options.additionalPackages) {
342+
allPackages.push(...options.additionalPackages);
343+
}
335344
return await createWithProgress(nativeFinder, api, log, manager, state.basePython, venvRoot, quickEnvPath, {
336-
install: options.additionalPackages || [],
345+
install: allPackages,
337346
uninstall: [],
338347
});
339348
}

0 commit comments

Comments
 (0)