Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion analysis/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["uv_build>=0.10.2,<0.11.0"]
build-backend = "uv_build"

[tool.uv.build-backend]
module-root = ""
module-root = ".."

[project]
name = "analysis"
Expand Down
6 changes: 4 additions & 2 deletions src/managers/builtin/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ export async function runUV(
cwd?: string,
log?: LogOutputChannel,
token?: CancellationToken,
timeout?: number,
): Promise<string> {
log?.info(`Running: uv ${args.join(' ')}`);
return new Promise<string>((resolve, reject) => {
const proc = spawnProcess('uv', args, { cwd: cwd });
const proc = spawnProcess('uv', args, { cwd: cwd, timeout });
token?.onCancellationRequested(() => {
proc.kill();
reject(new CancellationError());
Expand Down Expand Up @@ -104,10 +105,11 @@ export async function runPython(
cwd?: string,
log?: LogOutputChannel,
token?: CancellationToken,
timeout?: number,
): Promise<string> {
log?.info(`Running: ${python} ${args.join(' ')}`);
return new Promise<string>((resolve, reject) => {
const proc = spawnProcess(python, args, { cwd: cwd });
const proc = spawnProcess(python, args, { cwd: cwd, timeout });
token?.onCancellationRequested(() => {
proc.kill();
reject(new CancellationError());
Expand Down
19 changes: 17 additions & 2 deletions src/managers/builtin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,29 @@ export async function refreshPythons(
return sortEnvironments(collection);
}

const PIP_LIST_TIMEOUT_MS = 30_000;

async function refreshPipPackagesRaw(environment: PythonEnvironment, log?: LogOutputChannel): Promise<string> {
// Use environmentPath directly for consistency with UV environment tracking
const useUv = await shouldUseUv(log, environment.environmentPath.fsPath);
if (useUv) {
return await runUV(['pip', 'list', '--python', environment.execInfo.run.executable], undefined, log);
return await runUV(
['pip', 'list', '--python', environment.execInfo.run.executable],
undefined,
log,
undefined,
PIP_LIST_TIMEOUT_MS,
);
}
try {
return await runPython(environment.execInfo.run.executable, ['-m', 'pip', 'list'], undefined, log);
return await runPython(
environment.execInfo.run.executable,
['-m', 'pip', 'list'],
undefined,
log,
undefined,
PIP_LIST_TIMEOUT_MS,
);
} catch (ex) {
log?.error('Error running pip list', ex);
log?.info(
Expand Down
Loading