UNPKG

jupyterlab-emrys

Version:

A computational environment for Jupyter. Powered by Emrys

69 lines (68 loc) 2.19 kB
import { IKernel, ISession } from 'jupyter-js-services'; import { IDocumentContext, IDocumentModel } from './interfaces'; /** * An interface for selecting a new kernel. */ export interface IKernelSelection { /** * The name of the current session. */ name: string; /** * The kernel spec information. */ specs: IKernel.ISpecModels; /** * The current running sessions. */ sessions: ISession.IModel[]; /** * The desired kernel language. */ preferredLanguage: string; /** * The optional existing kernel id. */ kernel?: IKernel.IModel; /** * The host node for the dialog. */ host?: HTMLElement; } /** * Bring up a dialog to select a kernel. */ export declare function selectKernel(options: IKernelSelection): Promise<IKernel.IModel>; /** * Change the kernel on a context. */ export declare function selectKernelForContext(context: IDocumentContext<IDocumentModel>, host?: HTMLElement): Promise<void>; /** * Get the appropriate kernel name. */ export declare function findKernel(kernelName: string, language: string, specs: IKernel.ISpecModels): string; /** * Populate a kernel dropdown list. * * @param node - The host html element. * * @param specs - The available kernel spec information. * * @param running - The list of running session ids. * * @param preferredLanguage - The preferred language for the kernel. * * #### Notes * Populates the list with separated sections: * - Kernels matching the preferred language (display names). * - "None" signifying no kernel. * - The remaining kernels. * - Sessions matching the preferred language (file names). * - The remaining sessions. * If no preferred language is given or no kernels are found using * the preferred language, the default kernel is used in the first * section. Kernels are sorted by display name. Sessions display the * base name of the file with an ellipsis overflow and a tooltip with * the explicit session information. */ export declare function populateKernels(node: HTMLSelectElement, specs: IKernel.ISpecModels, running: ISession.IModel[], preferredLanguage?: string): void;