MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / getPythonCli

Function getPythonCli

src/test/interpreters/index.node.ts:112–138  ·  view source on GitHub ↗
(pythonPath: Uri | undefined)

Source from the content-addressed store, hash-verified

110}
111
112async function getPythonCli(pythonPath: Uri | undefined) {
113 const isConda = await isCondaEnvironment(pythonPath);
114 if (isConda) {
115 try {
116 const available = isCondaAvailable();
117 if (!available) {
118 throw new Error('No conda but using conda interpreter');
119 }
120 const condaInfo = await getCondaEnvironment(pythonPath);
121 const runArgs = ['run'];
122 if (!condaInfo) {
123 throw new Error('No conda info');
124 } else if (condaInfo.name === '') {
125 runArgs.push('-p', condaInfo.path.fsPath);
126 } else {
127 runArgs.push('-n', condaInfo.name);
128 }
129
130 const condaFile = await getCondaFile();
131 return [fileToCommandArgument(condaFile), ...runArgs, 'python'];
132 } catch {
133 // Noop.
134 }
135 logger.error('Using Conda Interpreter, but no conda');
136 }
137 return pythonPath ? [fileToCommandArgument(pythonPath.fsPath)] : [];
138}

Callers 2

getInterpreterInfoFunction · 0.85
getActivatedEnvVariablesFunction · 0.85

Calls 7

isCondaEnvironmentFunction · 0.90
isCondaAvailableFunction · 0.90
getCondaEnvironmentFunction · 0.90
getCondaFileFunction · 0.90
fileToCommandArgumentFunction · 0.90
pushMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected