(pythonEnv: { id: string })
| 63 | } |
| 64 | |
| 65 | export function getPythonEnvironmentName(pythonEnv: { id: string }) { |
| 66 | // Sometimes Python extension doesn't detect conda environments correctly (e.g. conda env create without a name). |
| 67 | // In such cases the envName is empty, but it has a path. |
| 68 | const env = getCachedEnvironment(pythonEnv); |
| 69 | let envName = env?.environment?.name; |
| 70 | if (!envName && env?.environment?.folderUri && getEnvironmentType(pythonEnv) === EnvironmentType.Conda) { |
| 71 | envName = basename(env?.environment?.folderUri); |
| 72 | } |
| 73 | return envName; |
| 74 | } |
| 75 | |
| 76 | const environmentTypes = [ |
| 77 | EnvironmentType.Unknown, |
no test coverage detected