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

Function getEnvironmentTypeImpl

src/platform/interpreter/helpers.ts:91–121  ·  view source on GitHub ↗
(env: Environment)

Source from the content-addressed store, hash-verified

89 return env ? getEnvironmentTypeImpl(env) : EnvironmentType.Unknown;
90}
91function getEnvironmentTypeImpl(env: Environment): EnvironmentType {
92 if ((env.environment?.type as KnownEnvironmentTypes) === 'Conda') {
93 return EnvironmentType.Conda;
94 }
95
96 // Map the Python env tool to a Jupyter environment type.
97 const orderOrEnvs: [pythonEnvTool: KnownEnvironmentTools, JupyterEnv: EnvironmentType][] = [
98 ['Conda', EnvironmentType.Conda],
99 ['Pyenv', EnvironmentType.Pyenv],
100 ['Pipenv', EnvironmentType.Pipenv],
101 ['Poetry', EnvironmentType.Poetry],
102 ['VirtualEnvWrapper', EnvironmentType.VirtualEnvWrapper],
103 ['VirtualEnv', EnvironmentType.VirtualEnv],
104 ['Venv', EnvironmentType.Venv]
105 ];
106 for (const [pythonEnvTool, JupyterEnv] of orderOrEnvs) {
107 if (env.tools.includes(pythonEnvTool)) {
108 return JupyterEnv;
109 }
110 }
111 if (env.environment?.type === 'VirtualEnvironment') {
112 return EnvironmentType.VirtualEnv;
113 }
114
115 for (const type of environmentTypes) {
116 if (env.tools.some((tool) => tool.toLowerCase() === type.toLowerCase())) {
117 return type;
118 }
119 }
120 return EnvironmentType.Unknown;
121}
122
123export async function getInterpreterInfo(interpreter?: { id: string }) {
124 if (!interpreter?.id) {

Callers 1

getEnvironmentTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected