-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kernel architecture review and polish #10832
Comments
We have polished and narrowed down the API we expose to the core and 3rd party extensions. The core currently only needs to use In August, we would look into what we can do to improve Draft interface we discussed offline: interface KernelManager {
registerKernelProvider(provider: KernelProvider)
}
interface KernelProvider {
kernelInfos: KernelConnectionMetadata[];
onDidChangeKernelInfo: Event<void>;
getKernelOrKernelFactory(metadata: KernelConnectionMetadata)
} |
Here's my proposal (from my private project) // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { Kernel, ServerConnection } from '@jupyterlab/services';
import { Disposable, Uri } from 'vscode';
export interface KernelSpec {
readonly language?: string;
readonly env?: NodeJS.ProcessEnv;
readonly metadata?: Record<string, unknown>;
readonly argv: string[];
readonly interrupt_mode?: 'message' | 'signal';
}
type BaseKernelConnectionInfo = {
id: string;
/**
* Languages supported by the kernel.
* First language in the list is considered to be the default & primary language of the kernel.
* Cannot be empty.
*/
languages: string[];
label: string;
description?: string;
detail?: string;
/**
* Connections with this same value will be grouped together.
*/
group: string;
/**
* Sort order for connections.
*/
sort: string;
};
export type KernelSpecConnectionInfo = BaseKernelConnectionInfo & {
resolve: (resource: Uri | undefined) => Promise<KernelSpec>;
};
export type KernelFactoryConnectionInfo = BaseKernelConnectionInfo & {
create(resource: Uri | undefined, settingsFactory: SettingsFactory): Promise<Kernel.IKernelConnection>;
};
export interface SettingsFactory {
makeSettings(options?: Partial<ServerConnection.ISettings>): ServerConnection.ISettings;
}
export const KernelRegistry = Symbol('KernelRegistry');
export interface KernelRegistry {
registerKernel(connection: KernelSpecConnectionInfo | KernelFactoryConnectionInfo): Disposable;
} I don't think we need Note: The above API is structured with the intent of exposing them for 3rd party. |
The only task left is simplying kernel finder, which is now tracked separately in #11153. |
Closing this issue for now, as we have other issues to track this work |
This issue covers the architecture review and polish @DonJayamanne and I are working on. The main goals of this task are
src/kernels
are being used by the core system (notebooks
,interactive-window
etc) and 3rd party extensions. There will be restriction and clear separation between internal and external use of the kernel interfaces.src/kernels
component. The kernel component will stay minimal and limited responsibilities without worrying about business logics of how kernels are being used (i.e., how to read variables, how to install dependencies into the kernels, etc)Here is a list of tasks we will tackle:
IKernel
withNotebookDocument
, it's 1-to-1 mapping.Uri
instead ofNotebookDocument
NotebookController
to be createdIKernel
StartupCode
can be registered from IW and Debugging other than embedding the logic intoIKernel
@multiInject(ITracebackFormatter)
kernels
at all.KernelFinder
andKernelProvider
Kernel Finder workflow #11153Tasks
The text was updated successfully, but these errors were encountered: