Class: BaseKernel

kernel.BaseKernel

A base kernel class handling basic kernel messaging.

Hierarchy

Implements

Constructors

constructor

new BaseKernel(options)

Construct a new BaseKernel.

Parameters

Name

Type

Description

options

IOptions

The instantiation options for a BaseKernel.

Defined in

packages/kernel/lib/kernel.d.ts:7

Properties

_busy

Private _busy: any

Send a ‘busy’ status message.

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:188


_complete

Private _complete: any

Handle an complete_request message

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:218


_disposed

Private _disposed: any

Defined in

packages/kernel/lib/kernel.d.ts:236


_execute

Private _execute: any

Handle an execute_request message.

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:212


_executeInput

Private _executeInput: any

Send an execute_input message.

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:206


_executionCount

Private _executionCount: any

Defined in

packages/kernel/lib/kernel.d.ts:234


_history

Private _history: any

Defined in

packages/kernel/lib/kernel.d.ts:233


_historyRequest

Private _historyRequest: any

Handle a history_request message

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:200


_id

Private _id: any

Defined in

packages/kernel/lib/kernel.d.ts:231


_idle

Private _idle: any

Send an ‘idle’ status message.

param The parent message

Defined in

packages/kernel/lib/kernel.d.ts:182


_inspect

Private _inspect: any

Handle an inspect_request message

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:224


_isCompleteRequest

Private _isCompleteRequest: any

Handle an is_complete_request message

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:230


_isDisposed

Private _isDisposed: any

Defined in

packages/kernel/lib/kernel.d.ts:235


_kernelInfo

Private _kernelInfo: any

Handle a kernel_info_request message

param The parent message.

Defined in

packages/kernel/lib/kernel.d.ts:194


_name

Private _name: any

Defined in

packages/kernel/lib/kernel.d.ts:232


_parent

Private _parent: any

Defined in

packages/kernel/lib/kernel.d.ts:239


_parentHeader

Private _parentHeader: any

Defined in

packages/kernel/lib/kernel.d.ts:238


_sendMessage

Private _sendMessage: any

Defined in

packages/kernel/lib/kernel.d.ts:237

Accessors

disposed

get disposed(): ISignal<this, void>

A signal emitted when the kernel is disposed.

Returns

ISignal<this, void>

Implementation of

IKernel.disposed

Defined in

packages/kernel/lib/kernel.d.ts:25


executionCount

get executionCount(): number

The current execution count

Returns

number

Defined in

packages/kernel/lib/kernel.d.ts:37


id

get id(): string

Get the kernel id

Returns

string

Implementation of

IKernel.id

Defined in

packages/kernel/lib/kernel.d.ts:29


isDisposed

get isDisposed(): boolean

Return whether the kernel is disposed.

Returns

boolean

Implementation of

IKernel.isDisposed

Defined in

packages/kernel/lib/kernel.d.ts:21


name

get name(): string

Get the name of the kernel

Returns

string

Implementation of

IKernel.name

Defined in

packages/kernel/lib/kernel.d.ts:33


parent

get parent(): undefined | IMessage<MessageType>

Get the last parent message (mimick ipykernel’s get_parent)

Returns

undefined | IMessage<MessageType>

Defined in

packages/kernel/lib/kernel.d.ts:45


parentHeader

get parentHeader(): undefined | IHeader<MessageType>

Get the last parent header

Returns

undefined | IHeader<MessageType>

Defined in

packages/kernel/lib/kernel.d.ts:41


ready

get ready(): Promise<void>

A promise that is fulfilled when the kernel is ready.

Returns

Promise<void>

Implementation of

IKernel.ready

Defined in

packages/kernel/lib/kernel.d.ts:17

Methods

clearOutput

Protected clearOutput(content, parentHeader?): void

Send a clear_output message to the client.

Parameters

Name

Type

Description

content

Object

The clear_output content.

content.wait

boolean

-

parentHeader?

IHeader<MessageType>

The parent header.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:170


commClose

Abstract commClose(msg): Promise<void>

Send an comm_close message.

Parameters

Name

Type

msg

ICommCloseMsg<"iopub" | "shell">

Returns

Promise<void>

Defined in

packages/kernel/lib/kernel.d.ts:121


commInfoRequest

Abstract commInfoRequest(content): Promise<ReplyContent<ICommInfoReply>>

Handle a comm_info_request message.

Parameters

Name

Type

Description

content

Object

The content of the request.

content.target_name?

string

The comm target name to filter returned comms

Returns

Promise<ReplyContent<ICommInfoReply>>

A promise that resolves with the response message.

Defined in

packages/kernel/lib/kernel.d.ts:97


commMsg

Abstract commMsg(msg): Promise<void>

Send an comm_msg message.

Parameters

Name

Type

Description

msg

ICommMsgMsg<"iopub" | "shell">

The comm_msg message.

Returns

Promise<void>

Defined in

packages/kernel/lib/kernel.d.ts:115


commOpen

Abstract commOpen(msg): Promise<void>

Send an comm_open message.

Parameters

Name

Type

Description

msg

ICommOpenMsg<"iopub" | "shell">

The comm_open message.

Returns

Promise<void>

Defined in

packages/kernel/lib/kernel.d.ts:109


completeRequest

Abstract completeRequest(content): Promise<ReplyContent<ICompleteReply>>

Handle a complete_request message.

Parameters

Name

Type

Description

content

Object

The content of the request.

content.code

string

-

content.cursor_pos

number

-

Returns

Promise<ReplyContent<ICompleteReply>>

Defined in

packages/kernel/lib/kernel.d.ts:73


displayData

Protected displayData(content, parentHeader?): void

Send a display_data message to the client.

Parameters

Name

Type

Description

content

Object

The display_data content.

content.data

IMimeBundle

-

content.metadata

PartialJSONObject

-

content.transient?

Object

-

content.transient.display_id?

string

-

parentHeader?

IHeader<MessageType>

The parent header.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:135


dispose

dispose(): void

Dispose the kernel.

Returns

void

Implementation of

IKernel.dispose

Defined in

packages/kernel/lib/kernel.d.ts:49


executeRequest

Abstract executeRequest(content): Promise<IReplyErrorContent & IExecuteCount & IReplyAbortContent & IExecuteCount & IExecuteReply & IExecuteCount>

Handle an execute_request message.

Parameters

Name

Type

Description

content

Object

The content of the execute_request kernel message

content.allow_stdin?

boolean

Whether to allow stdin requests. The default is true.

content.code

string

The code to execute.

content.silent?

boolean

Whether to execute the code as quietly as possible. The default is false.

content.stop_on_error?

boolean

Whether to the abort execution queue on an error. The default is false.

content.store_history?

boolean

Whether to store history of the execution. The default true if silent is False. It is forced to false if silent is true.

content.user_expressions?

JSONObject

A mapping of names to expressions to be evaluated in the kernel’s interactive namespace.

Returns

Promise<IReplyErrorContent & IExecuteCount & IReplyAbortContent & IExecuteCount & IExecuteReply & IExecuteCount>

Defined in

packages/kernel/lib/kernel.d.ts:67


handleComm

Protected handleComm(type, content, metadata, buffers, parentHeader?): void

Send a comm message to the client.

Parameters

Name

Type

type

"comm_close" | "comm_msg" | "comm_open"

content

Object

content.comm_id

string

content.data

JSONObject

metadata

JSONObject

buffers

undefined | (ArrayBuffer | ArrayBufferView)[]

parentHeader?

IHeader<MessageType>

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:176


handleMessage

handleMessage(msg): Promise<void>

Handle an incoming message from the client.

Parameters

Name

Type

Description

msg

IMessage<MessageType>

The message to handle

Returns

Promise<void>

Implementation of

IKernel.handleMessage

Defined in

packages/kernel/lib/kernel.d.ts:55


inputReply

Abstract inputReply(content): void

Send an input_reply message.

Parameters

Name

Type

Description

content

ReplyContent<IInputReply>

The content of the reply.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:103


inputRequest

Protected inputRequest(content, parentHeader?): void

Send a input_request message to the client.

Parameters

Name

Type

Description

content

Object

The input_request content.

content.password

boolean

Whether the request is for a password. If so, the frontend shouldn’t echo input.

content.prompt

string

The text to show at the prompt.

parentHeader?

IHeader<MessageType>

The parent header.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:142


inspectRequest

Abstract inspectRequest(content): Promise<ReplyContent<IInspectReply>>

Handle an inspect_request message.

Parameters

Name

Type

Description

content

Object

The content of the request.

content.code

string

-

content.cursor_pos

number

-

content.detail_level

0 | 1

-

Returns

Promise<ReplyContent<IInspectReply>>

A promise that resolves with the response message.

Defined in

packages/kernel/lib/kernel.d.ts:81


isCompleteRequest

Abstract isCompleteRequest(content): Promise<ReplyContent<IIsCompleteReplyIncomplete | IIsCompleteReplyOther>>

Handle an is_complete_request message.

Parameters

Name

Type

Description

content

Object

The content of the request.

content.code

string

-

Returns

Promise<ReplyContent<IIsCompleteReplyIncomplete | IIsCompleteReplyOther>>

A promise that resolves with the response message.

Defined in

packages/kernel/lib/kernel.d.ts:89


kernelInfoRequest

Abstract kernelInfoRequest(): Promise<ReplyContent<IInfoReply>>

Handle a kernel_info_request message.

Returns

Promise<ReplyContent<IInfoReply>>

A promise that resolves with the kernel info.

Defined in

packages/kernel/lib/kernel.d.ts:61


publishExecuteError

Protected publishExecuteError(content, parentHeader?): void

Send an error message to the client.

Parameters

Name

Type

Description

content

Object

The error content.

content.ename

string

-

content.evalue

string

-

content.traceback

string[]

-

parentHeader?

IHeader<MessageType>

The parent header.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:156


publishExecuteResult

Protected publishExecuteResult(content, parentHeader?): void

Send an execute_result message.

Parameters

Name

Type

Description

content

Object

The execut result content.

content.data

IMimeBundle

-

content.execution_count

ExecutionCount

-

content.metadata

PartialJSONObject

-

content.transient?

Object

-

content.transient.display_id?

string

-

parentHeader?

IHeader<MessageType>

The parent header.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:149


stream

Protected stream(content, parentHeader?): void

Stream an event from the kernel

Parameters

Name

Type

Description

content

Object

The stream content.

content.name

"stdout" | "stderr"

-

content.text

string

-

parentHeader?

IHeader<MessageType>

The parent header.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:128


updateDisplayData

Protected updateDisplayData(content, parentHeader?): void

Send a update_display_data message to the client.

Parameters

Name

Type

Description

content

{ data: IMimeBundle ; metadata: PartialJSONObject ; transient?: { display_id?: string } } & { transient: { display_id: string } }

The update_display_data content.

parentHeader?

IHeader<MessageType>

The parent header.

Returns

void

Defined in

packages/kernel/lib/kernel.d.ts:163