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

Function pythonEnvToJupyterEnv

src/platform/api/pythonApi.ts:68–89  ·  view source on GitHub ↗
(env: Environment)

Source from the content-addressed store, hash-verified

66 }
67}
68export function pythonEnvToJupyterEnv(env: Environment): PythonEnvironment | undefined {
69 let uri: Uri;
70 let id = env.id;
71 if (!env.executable.uri) {
72 if (getEnvironmentType(env) === EnvironmentType.Conda) {
73 uri =
74 getOSType() === OSType.Windows
75 ? Uri.joinPath(env.environment?.folderUri || Uri.file(env.path), 'python.exe')
76 : Uri.joinPath(env.environment?.folderUri || Uri.file(env.path), 'bin', 'python');
77 } else {
78 logger.warn(`Python environment ${getDisplayPath(env.id)} excluded as Uri is undefined`);
79 return;
80 }
81 } else {
82 uri = env.executable.uri;
83 }
84
85 return {
86 id,
87 uri
88 };
89}
90
91export function serializePythonEnvironment(
92 jupyterVersion: PythonEnvironment | undefined

Callers 1

buildDummyEnvironmentMethod · 0.90

Calls 6

getEnvironmentTypeFunction · 0.90
getOSTypeFunction · 0.90
getDisplayPathFunction · 0.90
joinPathMethod · 0.65
warnMethod · 0.65
fileMethod · 0.45

Tested by

no test coverage detected