Skip to content

Commit b06a4fb

Browse files
committed
Add activation command for micromamba
1 parent 5ec7510 commit b06a4fb

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export class CondaActivationCommandProvider implements ITerminalActivationComman
6060

6161
const condaEnv = envInfo.name.length > 0 ? envInfo.name : envInfo.path;
6262

63+
// Directly use the self-contained micromamba executable.
64+
if (await this.condaService.isMicroMamba()) {
65+
return [`micromamba activate ${condaEnv.toCommandArgumentForPythonExt()}`];
66+
}
67+
6368
// New version.
6469
const interpreterPath = await this.condaService.getInterpreterPathForEnvironment(envInfo);
6570
const activatePath = await this.condaService.getActivationScriptFromInterpreter(interpreterPath, envInfo.name);

src/client/interpreter/contracts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface ICondaService {
6262
getCondaFile(forShellExecution?: boolean): Promise<string>;
6363
getCondaInfo(): Promise<CondaInfo | undefined>;
6464
isCondaAvailable(): Promise<boolean>;
65+
isMicroMamba(): Promise<boolean>;
6566
getCondaVersion(): Promise<SemVer | undefined>;
6667
getInterpreterPathForEnvironment(condaEnv: CondaEnvironmentInfo): Promise<string | undefined>;
6768
getCondaFileFromInterpreter(interpreterPath?: string, envName?: string): Promise<string | undefined>;

src/client/pythonEnvironments/common/environmentManagers/condaService.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ export class CondaService implements ICondaService {
8282
.catch(() => (this.isAvailable = false)); // eslint-disable-line no-return-assign
8383
}
8484

85+
/**
86+
* Is the conda executable named "micromamba"?
87+
*/
88+
public async isMicroMamba(): Promise<boolean> {
89+
const file = await this.getCondaFile();
90+
const name = path.basename(file, '.exe');
91+
return name === 'micromamba';
92+
}
93+
8594
/**
8695
* Return the conda version.
8796
*/

0 commit comments

Comments
 (0)