| 158 | * If the executable is not defined in kernelSpec json, & it is a Python kernel, then we'll use the provided python interpreter. |
| 159 | */ |
| 160 | export class LocalKernelSpecConnectionMetadata { |
| 161 | public readonly kernelModel?: undefined; |
| 162 | public readonly kind = 'startUsingLocalKernelSpec'; |
| 163 | public readonly id: string; |
| 164 | public readonly kernelSpec: Readonly<IJupyterKernelSpec>; |
| 165 | public readonly interpreter?: Readonly<PythonEnvironment>; |
| 166 | private constructor(options: { |
| 167 | kernelSpec: IJupyterKernelSpec; |
| 168 | /** |
| 169 | * Indicates the interpreter that may be used to start the kernel. |
| 170 | * If possible to start a kernel without this Python interpreter, then this Python interpreter will be used for intellisense & the like. |
| 171 | * This interpreter could also be the interpreter associated with the kernel spec that we are supposed to start. |
| 172 | */ |
| 173 | interpreter?: PythonEnvironment; |
| 174 | id: string; |
| 175 | }) { |
| 176 | this.kernelSpec = options.kernelSpec; |
| 177 | this.interpreter = options.interpreter; |
| 178 | this.id = options.id; |
| 179 | sendKernelTelemetry(this); |
| 180 | } |
| 181 | public static create(options: { |
| 182 | kernelSpec: IJupyterKernelSpec; |
| 183 | /** |
| 184 | * Indicates the interpreter that may be used to start the kernel. |
| 185 | * If possible to start a kernel without this Python interpreter, then this Python interpreter will be used for intellisense & the like. |
| 186 | * This interpreter could also be the interpreter associated with the kernel spec that we are supposed to start. |
| 187 | */ |
| 188 | interpreter?: PythonEnvironment; |
| 189 | id: string; |
| 190 | }) { |
| 191 | return new LocalKernelSpecConnectionMetadata(options); |
| 192 | } |
| 193 | public getHashId() { |
| 194 | return getConnectionIdHash(this); |
| 195 | } |
| 196 | public toJSON() { |
| 197 | return { |
| 198 | id: this.id, |
| 199 | kernelSpec: this.kernelSpec, |
| 200 | interpreter: serializePythonEnvironment(this.interpreter), |
| 201 | kind: this.kind |
| 202 | }; |
| 203 | } |
| 204 | public static fromJSON(options: Record<string, unknown> | LocalKernelSpecConnectionMetadata) { |
| 205 | return BaseKernelConnectionMetadata.fromJSON(options) as LocalKernelSpecConnectionMetadata; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Connection metadata for Remote Kernels started using kernelspec (JSON). |
nothing calls this directly
no outgoing calls
no test coverage detected