Skip to content

Commit 0b242bd

Browse files
committed
use pip as default manager
1 parent 292c702 commit 0b242bd

3 files changed

Lines changed: 10 additions & 94 deletions

File tree

src/managers/pipenv/main.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { traceInfo } from '../../common/logging';
44
import { getPythonApi } from '../../features/pythonApi';
55
import { NativePythonFinder } from '../common/nativePythonFinder';
66
import { PipenvManager } from './pipenvManager';
7-
import { PipenvPackageManager } from './pipenvPackageManager';
87
import { getPipenv } from './pipenvUtils';
98

109
export async function registerPipenvFeatures(
@@ -18,14 +17,8 @@ export async function registerPipenvFeatures(
1817

1918
if (pipenv) {
2019
const mgr = new PipenvManager(nativeFinder, api);
21-
const packageManager = new PipenvPackageManager(api);
22-
23-
disposables.push(
24-
mgr,
25-
packageManager,
26-
api.registerEnvironmentManager(mgr),
27-
api.registerPackageManager(packageManager)
28-
);
20+
21+
disposables.push(mgr, api.registerEnvironmentManager(mgr));
2922
} else {
3023
traceInfo('Pipenv not found, turning off pipenv features.');
3124
}

src/managers/pipenv/pipenvManager.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,10 @@ export class PipenvManager implements EnvironmentManager {
5252

5353
private _initialized: Deferred<void> | undefined;
5454

55-
constructor(
56-
public readonly nativeFinder: NativePythonFinder,
57-
public readonly api: PythonEnvironmentApi
58-
) {
55+
constructor(public readonly nativeFinder: NativePythonFinder, public readonly api: PythonEnvironmentApi) {
5956
this.name = 'pipenv';
6057
this.displayName = 'Pipenv';
61-
this.preferredPackageManagerId = 'ms-python.python:pipenv';
58+
this.preferredPackageManagerId = 'ms-python.python:pip';
6259
this.tooltip = new MarkdownString(PipenvStrings.pipenvManager, true);
6360
}
6461

@@ -114,9 +111,8 @@ export class PipenvManager implements EnvironmentManager {
114111
}
115112

116113
private findEnvironmentByPath(fsPath: string): PythonEnvironment | undefined {
117-
return this.collection.find((env) =>
118-
env.environmentPath.fsPath === fsPath ||
119-
env.execInfo?.run.executable === fsPath
114+
return this.collection.find(
115+
(env) => env.environmentPath.fsPath === fsPath || env.execInfo?.run.executable === fsPath,
120116
);
121117
}
122118

@@ -139,7 +135,7 @@ export class PipenvManager implements EnvironmentManager {
139135

140136
async refresh(scope: RefreshEnvironmentsScope): Promise<void> {
141137
const hardRefresh = scope === undefined; // hard refresh when scope is undefined
142-
138+
143139
await withProgress(
144140
{
145141
location: ProgressLocation.Window,
@@ -152,7 +148,7 @@ export class PipenvManager implements EnvironmentManager {
152148

153149
// Fire change events for environments that were added or removed
154150
const changes: { environment: PythonEnvironment; kind: EnvironmentChangeKind }[] = [];
155-
151+
156152
// Find removed environments
157153
oldCollection.forEach((oldEnv) => {
158154
if (!this.collection.find((newEnv) => newEnv.envId.id === oldEnv.envId.id)) {
@@ -203,7 +199,7 @@ export class PipenvManager implements EnvironmentManager {
203199
const before = this.globalEnv;
204200
this.globalEnv = environment;
205201
await setPipenvForGlobal(environment?.environmentPath.fsPath);
206-
202+
207203
if (before?.envId.id !== this.globalEnv?.envId.id) {
208204
this._onDidChangeEnvironment.fire({ uri: undefined, old: before, new: this.globalEnv });
209205
}
@@ -223,7 +219,7 @@ export class PipenvManager implements EnvironmentManager {
223219
} else {
224220
this.fsPathToEnv.delete(project.uri.fsPath);
225221
}
226-
222+
227223
await setPipenvForWorkspace(project.uri.fsPath, environment?.environmentPath.fsPath);
228224

229225
if (before?.envId.id !== environment?.envId.id) {

src/managers/pipenv/pipenvPackageManager.ts

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)