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

Class PythonKernelConnectionMetadata

src/kernels/types.ts:268–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266 * We will always start this kernel using old Jupyter style (provided we first register this interpreter as a kernel) or raw.
267 */
268export class PythonKernelConnectionMetadata {
269 public readonly kind = 'startUsingPythonInterpreter';
270 public readonly kernelSpec: IJupyterKernelSpec;
271 public readonly interpreter: PythonEnvironment;
272 public readonly id: string;
273 private constructor(options: { kernelSpec: IJupyterKernelSpec; interpreter: PythonEnvironment; id: string }) {
274 this.kernelSpec = options.kernelSpec;
275 this.interpreter = options.interpreter;
276 this.id = options.id;
277 sendKernelTelemetry(this);
278 }
279 public static create(options: { kernelSpec: IJupyterKernelSpec; interpreter: PythonEnvironment; id: string }) {
280 return new PythonKernelConnectionMetadata(options);
281 }
282 public getHashId() {
283 return getConnectionIdHash(this);
284 }
285 public toJSON() {
286 return {
287 id: this.id,
288 kernelSpec: this.kernelSpec,
289 interpreter: serializePythonEnvironment(this.interpreter),
290 kind: this.kind
291 };
292 }
293 public updateInterpreter(interpreter: PythonEnvironment) {
294 Object.assign(this.interpreter, interpreter);
295 }
296 public static fromJSON(options: Record<string, unknown> | PythonKernelConnectionMetadata) {
297 return BaseKernelConnectionMetadata.fromJSON(options) as PythonKernelConnectionMetadata;
298 }
299}
300/**
301 * Readonly to ensure these are immutable, if we need to make changes then create a new one.
302 * This ensure we don't update is somewhere unnecessarily (such updates would be unexpected).

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected