Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
720bede
temp
edvilme Jul 1, 2026
d9f2cf2
Implement three-level class-based package manager command architecture
edvilme Jul 5, 2026
d08b7bd
Integrate command classes with pipPackageManager - Phase 1: Pip/UV
edvilme Jul 5, 2026
f3bd8f9
Remove unused executor pattern and old pip management code
edvilme Jul 5, 2026
5e5c45d
Implement conda install/uninstall commands and remove managePackages …
edvilme Jul 5, 2026
7179cf0
Refactor pipPackageManager to use command classes for all operations
edvilme Jul 5, 2026
2a80488
Complete conda integration with List, Version, and AvailableVersions …
edvilme Jul 5, 2026
5569d50
Integrate Poetry command classes into poetryPackageManager
edvilme Jul 5, 2026
cf49062
Add documentation comments to Poetry command classes with parsed comm…
edvilme Jul 5, 2026
76a598f
Move JSDoc comments from interfaces to command classes
edvilme Jul 5, 2026
1890ef3
Add documentation comments to all command classes across all package …
edvilme Jul 5, 2026
83d6bc6
Refactor utils to use command classes directly instead of helper func…
edvilme Jul 5, 2026
1c0fe0e
Expose base command classes to public API
edvilme Jul 5, 2026
790fef6
Remove CommandType and CommandSettings from command classes
edvilme Jul 5, 2026
a0bc056
Add timeout and config properties to base command classes
edvilme Jul 5, 2026
e5d22c6
Centralize ephemeral arguments to base command classes
edvilme Jul 5, 2026
1edb7dd
Make execute methods conform to ephemeral argument interfaces
edvilme Jul 5, 2026
4b9e8d2
Lint
edvilme Jul 5, 2026
7521fcc
Rename ephemeralArgs to executeArgs for clarity
edvilme Jul 5, 2026
279fcd0
Rename commandSettings.ts to packageManagerCommand.ts and remove unus…
edvilme Jul 5, 2026
5db7455
Move timeout default to PackageManagerCommand base class
edvilme Jul 5, 2026
4264f04
Centralize configuration loading to PackageManagerCommand base class
edvilme Jul 5, 2026
42f9347
Centralize CommandConstructorOptions at method level for install/unin…
edvilme Jul 5, 2026
8246246
Refactor package manager command execution args and cancellation toke…
edvilme Jul 5, 2026
0858f85
runPython: Do not return error
edvilme Jul 5, 2026
15ab7f3
Remove unnecessary params
edvilme Jul 5, 2026
4e2eefb
Extract showProgress
edvilme Jul 5, 2026
0157a2a
Remove unused method
edvilme Jul 5, 2026
cae697f
Use uv directly for builtin commands
edvilme Jul 21, 2026
d577bcc
Refactor base commands to use static config sections
edvilme Jul 21, 2026
34a1c29
Lint
edvilme Jul 21, 2026
493bc79
Lint
edvilme Jul 21, 2026
52cda03
Move runPoetry to poetryUtils to avoid circular dependencies
edvilme Jul 21, 2026
42e1dde
Conda/getPackageAvailableVersions sort
edvilme Jul 21, 2026
39984bd
Potential fix for pull request finding
edvilme Jul 21, 2026
14afd71
Honow cwd on poetry show
edvilme Jul 21, 2026
b2fe44b
Address PR review comments for package manager command refactor
edvilme Jul 22, 2026
cebca53
Remove package manager command class exports from public api.ts
edvilme Jul 22, 2026
3851bdd
Refactor
edvilme Jul 22, 2026
cbdbc91
Remove SETTINGS_ARCHITECTURE.md
edvilme Jul 22, 2026
8b0dd64
Merge branch 'main' into package-manager-command-refactor
edvilme Jul 22, 2026
ada417f
Remove unused file
edvilme Jul 22, 2026
349101c
Address PR Comments
edvilme Jul 22, 2026
9b2683e
Restore optional settings property
edvilme Jul 23, 2026
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
6 changes: 4 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 150 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,156 @@
"description": "%python-envs.packageWatchers.description%",
"default": true,
"scope": "machine"
},
"python-envs.packageManager.installCommandArgs": {
"type": "object",
"markdownDescription": "%python-envs.packageManager.installCommandArgs.description%",
"scope": "machine",
"properties": {
"verboseOutput": {
"type": "boolean",
"description": "%python-envs.packageManager.installCommandArgs.verboseOutput.description%",
"default": false
},
"retryOnFailure": {
"type": "boolean",
"description": "%python-envs.packageManager.installCommandArgs.retryOnFailure.description%",
"default": true
},
"maxRetries": {
"type": "integer",
"description": "%python-envs.packageManager.maxRetries.description%",
"default": 1,
"minimum": 0,
"maximum": 3
}
},
"additionalProperties": false
},
"python-envs.packageManager.uninstallCommandArgs": {
"type": "object",
"markdownDescription": "%python-envs.packageManager.uninstallCommandArgs.description%",
"scope": "machine",
"properties": {
"verboseOutput": {
"type": "boolean",
"description": "%python-envs.packageManager.uninstallCommandArgs.verboseOutput.description%",
"default": false
},
"retryOnFailure": {
"type": "boolean",
"description": "%python-envs.packageManager.uninstallCommandArgs.retryOnFailure.description%",
"default": true
},
"maxRetries": {
"type": "integer",
"description": "%python-envs.packageManager.maxRetries.description%",
"default": 1,
"minimum": 0,
"maximum": 3
}
},
"additionalProperties": false
},
"python-envs.packageManager.listCommandArgs": {
"type": "object",
"markdownDescription": "%python-envs.packageManager.listCommandArgs.description%",
"scope": "machine",
"properties": {
"verboseOutput": {
"type": "boolean",
"description": "%python-envs.packageManager.listCommandArgs.verboseOutput.description%",
"default": false
},
"retryOnFailure": {
"type": "boolean",
"description": "%python-envs.packageManager.listCommandArgs.retryOnFailure.description%",
"default": true
},
"maxRetries": {
"type": "integer",
"description": "%python-envs.packageManager.maxRetries.description%",
"default": 1,
"minimum": 0,
"maximum": 3
}
},
"additionalProperties": false
},
"python-envs.packageManager.versionCommandArgs": {
"type": "object",
"markdownDescription": "%python-envs.packageManager.versionCommandArgs.description%",
"scope": "machine",
"properties": {
"verboseOutput": {
"type": "boolean",
"description": "%python-envs.packageManager.versionCommandArgs.verboseOutput.description%",
"default": false
},
"retryOnFailure": {
"type": "boolean",
"description": "%python-envs.packageManager.versionCommandArgs.retryOnFailure.description%",
"default": true
},
"maxRetries": {
"type": "integer",
"description": "%python-envs.packageManager.maxRetries.description%",
"default": 1,
"minimum": 0,
"maximum": 3
}
},
"additionalProperties": false
},
"python-envs.packageManager.availableVersionsCommandArgs": {
"type": "object",
"markdownDescription": "%python-envs.packageManager.availableVersionsCommandArgs.description%",
"scope": "machine",
"properties": {
"verboseOutput": {
"type": "boolean",
"description": "%python-envs.packageManager.availableVersionsCommandArgs.verboseOutput.description%",
"default": false
},
"retryOnFailure": {
"type": "boolean",
"description": "%python-envs.packageManager.availableVersionsCommandArgs.retryOnFailure.description%",
"default": true
},
"maxRetries": {
"type": "integer",
"description": "%python-envs.packageManager.maxRetries.description%",
"default": 1,
"minimum": 0,
"maximum": 3
}
},
"additionalProperties": false
},
"python-envs.packageManager.listDirectNamesCommandArgs": {
"type": "object",
"markdownDescription": "%python-envs.packageManager.listDirectNamesCommandArgs.description%",
"scope": "machine",
"properties": {
"verboseOutput": {
"type": "boolean",
"description": "%python-envs.packageManager.listDirectNamesCommandArgs.verboseOutput.description%",
"default": false
},
"retryOnFailure": {
"type": "boolean",
"description": "%python-envs.packageManager.listDirectNamesCommandArgs.retryOnFailure.description%",
"default": true
},
"maxRetries": {
"type": "integer",
"description": "%python-envs.packageManager.maxRetries.description%",
"default": 1,
"minimum": 0,
"maximum": 3
}
},
"additionalProperties": false
}
}
},
Expand Down
21 changes: 20 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,24 @@
"python-envs.runPetInTerminal.title": "Run Python Environment Tool (PET) in Terminal...",
"python-envs.managePackageVersion.title": "Manage Package Version",
"python-envs.alwaysUseUv.description": "When set to true, uv will be used to manage all virtual environments if available. When set to false, uv will only manage virtual environments explicitly created by uv.",
"python-envs.packageWatchers.description": "When enabled, file system watchers monitor site-packages for install/uninstall changes and automatically refresh the package list. Disable this if you experience performance issues in large workspaces."
"python-envs.packageWatchers.description": "When enabled, file system watchers monitor site-packages for install/uninstall changes and automatically refresh the package list. Disable this if you experience performance issues in large workspaces.",
"python-envs.packageManager.installCommandArgs.description": "Arguments and settings for the install command (pip/uv install).",
"python-envs.packageManager.uninstallCommandArgs.description": "Arguments and settings for the uninstall command (pip/uv uninstall).",
"python-envs.packageManager.listCommandArgs.description": "Arguments and settings for the list command (pip/uv list).",
"python-envs.packageManager.versionCommandArgs.description": "Arguments and settings for the version command (pip/uv --version).",
"python-envs.packageManager.availableVersionsCommandArgs.description": "Arguments and settings for the availableVersions command (pip index versions).",
"python-envs.packageManager.listDirectNamesCommandArgs.description": "Arguments and settings for the listDirectNames command (pip list --not-required).",
"python-envs.packageManager.maxRetries.description": "Maximum number of retry attempts (0-3).",
"python-envs.packageManager.installCommandArgs.verboseOutput.description": "Display full output from the install command.",
"python-envs.packageManager.installCommandArgs.retryOnFailure.description": "Retry the install command once on failure.",
"python-envs.packageManager.uninstallCommandArgs.verboseOutput.description": "Display full output from the uninstall command.",
"python-envs.packageManager.uninstallCommandArgs.retryOnFailure.description": "Retry the uninstall command once on failure.",
"python-envs.packageManager.listCommandArgs.verboseOutput.description": "Display full output from the list command.",
"python-envs.packageManager.listCommandArgs.retryOnFailure.description": "Retry the list command once on failure.",
"python-envs.packageManager.versionCommandArgs.verboseOutput.description": "Display full output from the version command.",
"python-envs.packageManager.versionCommandArgs.retryOnFailure.description": "Retry the version command once on failure.",
"python-envs.packageManager.availableVersionsCommandArgs.verboseOutput.description": "Display full output from the availableVersions command.",
"python-envs.packageManager.availableVersionsCommandArgs.retryOnFailure.description": "Retry the availableVersions command once on failure.",
"python-envs.packageManager.listDirectNamesCommandArgs.verboseOutput.description": "Display full output from the listDirectNames command.",
"python-envs.packageManager.listDirectNamesCommandArgs.retryOnFailure.description": "Retry the listDirectNames command once on failure."
}
22 changes: 22 additions & 0 deletions src/managers/base/commands/availableVersions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { BaseExecuteArgs, PackageManagerCommand } from './packageManagerCommand';

/**
* Arguments for available versions command execution (change per execution).
*/
export interface AvailableVersionsExecuteArgs extends BaseExecuteArgs {
packageName: string;
pythonVersion: string;
includePrerelease?: boolean;
}

/**
* Template class for availableVersions commands.
* Subclasses implement concrete package-manager-specific logic.
*/
export abstract class AvailableVersionsCommand extends PackageManagerCommand {
protected static readonly configSection = 'availableVersionsCommandArgs';

protected abstract buildCommand(executeArgs: AvailableVersionsExecuteArgs): string[];

abstract execute(executeArgs: AvailableVersionsExecuteArgs): Promise<string[]>;
}
7 changes: 7 additions & 0 deletions src/managers/base/commands/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export { AvailableVersionsCommand, type AvailableVersionsExecuteArgs } from './availableVersions';
export { InstallCommand, type InstallExecuteArgs } from './install';
export { ListCommand } from './list';
export { ListDirectNamesCommand } from './listDirectNames';
export { BaseExecuteArgs, CommandConstructorOptions, PackageManagerCommand } from './packageManagerCommand';
export { UninstallCommand, type UninstallExecuteArgs } from './uninstall';
export { VersionCommand } from './version';
21 changes: 21 additions & 0 deletions src/managers/base/commands/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { BaseExecuteArgs, PackageManagerCommand } from './packageManagerCommand';

/**
* Arguments for install command execution (change per execution).
*/
export interface InstallExecuteArgs extends BaseExecuteArgs {
packages: { packageName: string; version?: string }[];
upgrade?: boolean;
}

/**
* Template class for install commands.
* Subclasses implement concrete package-manager-specific logic.
*/
export abstract class InstallCommand extends PackageManagerCommand {
protected static readonly configSection = 'installCommandArgs';

protected abstract buildCommand(executeArgs: InstallExecuteArgs): string[];

abstract execute(executeArgs: InstallExecuteArgs): Promise<void>;
}
12 changes: 12 additions & 0 deletions src/managers/base/commands/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { PackageInfo } from '../../../api';
import { BaseExecuteArgs, PackageManagerCommand } from './packageManagerCommand';

/**
* Template class for list commands.
* Subclasses implement concrete package-manager-specific logic.
*/
export abstract class ListCommand extends PackageManagerCommand {
protected static readonly configSection = 'listCommandArgs';

abstract execute(executeArgs?: BaseExecuteArgs): Promise<PackageInfo[]>;
}
11 changes: 11 additions & 0 deletions src/managers/base/commands/listDirectNames.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { BaseExecuteArgs, PackageManagerCommand } from './packageManagerCommand';

/**
* Template class for listDirectNames commands.
* Subclasses implement concrete package-manager-specific logic.
*/
export abstract class ListDirectNamesCommand extends PackageManagerCommand {
protected static readonly configSection = 'listDirectNamesCommandArgs';

abstract execute(executeArgs?: BaseExecuteArgs): Promise<string[]>;
}
77 changes: 77 additions & 0 deletions src/managers/base/commands/packageManagerCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { CancellationToken, l10n, LogOutputChannel, ProgressLocation, window, WorkspaceConfiguration } from 'vscode';
import { getConfiguration } from '../../../common/workspace.apis';

/**
* Base interface for all command execute arguments.
* Provides optional cancellation token that all commands can use.
*/
export interface BaseExecuteArgs {
cancellationToken?: CancellationToken;
showProgress?: boolean;
}

/**
* Constructor options shared by all package manager commands.
*/
export interface CommandConstructorOptions {
pythonExecutable: string;
configSection?: string;
log?: LogOutputChannel;
}

/**
* Base class for all package manager commands.
* Provides common properties and minimal interface for subclasses.
*/
export abstract class PackageManagerCommand {
protected static readonly configSection?: string;

protected pythonExecutable: string;
protected log?: LogOutputChannel;
protected timeout: number = 300000;
protected config?: WorkspaceConfiguration;

constructor(options: CommandConstructorOptions) {
this.pythonExecutable = options.pythonExecutable;
this.log = options.log;
const configSection = options.configSection ?? (this.constructor as typeof PackageManagerCommand).configSection;
this.config = configSection ? getConfiguration(`python-envs.packageManager.${configSection}`) : undefined;
}

/**
* Executes this command and optionally wraps execution with a progress indicator.
*/
public executeWithProgress<T = unknown, A extends BaseExecuteArgs = BaseExecuteArgs>(
executeArgs?: A,
title?: string,
): Promise<T> {
if (!executeArgs?.showProgress) {
return this.execute(executeArgs) as Promise<T>;
}

return Promise.resolve(
window.withProgress(
{
location: ProgressLocation.Notification,
title: title ?? l10n.t('Running package manager command'),
cancellable: true,
},
Comment thread
Copilot marked this conversation as resolved.
(_progress, token) =>
this.execute({
...executeArgs,
cancellationToken: executeArgs.cancellationToken ?? token,
}) as Promise<T>,
),
);
}

/**
* Subclasses implement command execution.
*/
abstract execute(executeArgs?: BaseExecuteArgs): Promise<unknown>;

/**
* Subclasses implement to build the command arguments.
*/
protected abstract buildCommand(executeArgs: BaseExecuteArgs): string[];
}
20 changes: 20 additions & 0 deletions src/managers/base/commands/uninstall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { BaseExecuteArgs, PackageManagerCommand } from './packageManagerCommand';

/**
* Arguments for uninstall command execution (change per execution).
*/
export interface UninstallExecuteArgs extends BaseExecuteArgs {
packages: { packageName: string; version?: string }[];
}

/**
* Template class for uninstall commands.
* Subclasses implement concrete package-manager-specific logic.
*/
export abstract class UninstallCommand extends PackageManagerCommand {
protected static readonly configSection = 'uninstallCommandArgs';

protected abstract buildCommand(executeArgs: UninstallExecuteArgs): string[];

abstract execute(executeArgs: UninstallExecuteArgs): Promise<void>;
}
12 changes: 12 additions & 0 deletions src/managers/base/commands/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Pep440Version } from '@renovatebot/pep440';
import { BaseExecuteArgs, PackageManagerCommand } from './packageManagerCommand';

/**
* Template class for version commands.
* Subclasses implement concrete package-manager-specific logic.
*/
export abstract class VersionCommand extends PackageManagerCommand {
protected static readonly configSection = 'versionCommandArgs';

abstract execute(executeArgs?: BaseExecuteArgs): Promise<Pep440Version | undefined>;
}
Loading
Loading