| 21 | * This kernel connects to a Jupyter server started by deepnote-toolkit. |
| 22 | */ |
| 23 | export class DeepnoteKernelConnectionMetadata { |
| 24 | public readonly kernelModel?: undefined; |
| 25 | public readonly kind = 'startUsingDeepnoteKernel' as const; |
| 26 | public readonly id: string; |
| 27 | public readonly kernelSpec: IJupyterKernelSpec; |
| 28 | public readonly baseUrl: string; |
| 29 | public readonly projectFilePath?: string; |
| 30 | public readonly interpreter?: PythonEnvironment; |
| 31 | public readonly serverProviderHandle: JupyterServerProviderHandle; |
| 32 | public readonly serverInfo?: DeepnoteServerInfo; // Store server info for connection |
| 33 | public readonly environmentName?: string; // Name of the Deepnote environment for display purposes |
| 34 | public readonly projectName?: string; // Name of the project for display purposes |
| 35 | public readonly notebookName?: string; // Name of the notebook for display purposes |
| 36 | |
| 37 | private constructor(options: { |
| 38 | interpreter?: PythonEnvironment; |
| 39 | kernelSpec: IJupyterKernelSpec; |
| 40 | baseUrl: string; |
| 41 | id: string; |
| 42 | projectFilePath?: string; |
| 43 | serverProviderHandle: JupyterServerProviderHandle; |
| 44 | serverInfo?: DeepnoteServerInfo; |
| 45 | environmentName?: string; |
| 46 | projectName?: string; |
| 47 | notebookName?: string; |
| 48 | }) { |
| 49 | this.interpreter = options.interpreter; |
| 50 | this.kernelSpec = options.kernelSpec; |
| 51 | this.baseUrl = options.baseUrl; |
| 52 | this.id = options.id; |
| 53 | this.projectFilePath = options.projectFilePath; |
| 54 | this.serverProviderHandle = options.serverProviderHandle; |
| 55 | this.serverInfo = options.serverInfo; |
| 56 | this.environmentName = options.environmentName; |
| 57 | this.projectName = options.projectName; |
| 58 | this.notebookName = options.notebookName; |
| 59 | } |
| 60 | |
| 61 | public static create(options: { |
| 62 | interpreter?: PythonEnvironment; |
| 63 | kernelSpec: IJupyterKernelSpec; |
| 64 | baseUrl: string; |
| 65 | id: string; |
| 66 | projectFilePath?: string; |
| 67 | serverProviderHandle: JupyterServerProviderHandle; |
| 68 | serverInfo?: DeepnoteServerInfo; |
| 69 | environmentName?: string; |
| 70 | projectName?: string; |
| 71 | notebookName?: string; |
| 72 | }) { |
| 73 | return new DeepnoteKernelConnectionMetadata(options); |
| 74 | } |
| 75 | |
| 76 | public getHashId() { |
| 77 | return getTelemetrySafeHashedString(this.id); |
| 78 | } |
| 79 | |
| 80 | public toJSON() { |
nothing calls this directly
no outgoing calls
no test coverage detected