@jupyterlite / @jupyterlite/kernel / BaseKernel
Class: abstract BaseKernel#
Defined in: packages/services/lib/kernel/base.d.ts:7
A base kernel class handling basic kernel messaging.
Implements#
Constructors#
Constructor#
new BaseKernel(
options):BaseKernel
Defined in: packages/services/lib/kernel/base.d.ts:13
Construct a new BaseKernel.
Parameters#
options#
The instantiation options for a BaseKernel.
Returns#
BaseKernel
Accessors#
disposed#
Get Signature#
get disposed():
ISignal<this,void>
Defined in: packages/services/lib/kernel/base.d.ts:25
A signal emitted when the kernel is disposed.
Returns#
ISignal<this, void>
A signal emitted when the object is disposed.
Implementation of#
executionCount#
Get Signature#
get executionCount():
number
Defined in: packages/services/lib/kernel/base.d.ts:41
The current execution count
Returns#
number
id#
Get Signature#
get id():
string
Defined in: packages/services/lib/kernel/base.d.ts:29
Get the kernel id
Returns#
string
The id of the server-side kernel.
Implementation of#
isDisposed#
Get Signature#
get isDisposed():
boolean
Defined in: packages/services/lib/kernel/base.d.ts:21
Return whether the kernel is disposed.
Returns#
boolean
Test whether the object has been disposed.
Notes#
This property is always safe to access.
Implementation of#
location#
Get Signature#
get location():
string
Defined in: packages/services/lib/kernel/base.d.ts:37
The location in the virtual filesystem from which the kernel was started.
Returns#
string
The location in the virtual filesystem from which the kernel was started.
Implementation of#
name#
Get Signature#
get name():
string
Defined in: packages/services/lib/kernel/base.d.ts:33
Get the name of the kernel
Returns#
string
The name of the server-side kernel.
Implementation of#
parent#
Get Signature#
get parent():
undefined|IMessage<MessageType>
Defined in: packages/services/lib/kernel/base.d.ts:49
Get the last parent message (mimic ipykernel’s get_parent)
Returns#
undefined | IMessage<MessageType>
parentHeader#
Get Signature#
get parentHeader():
undefined|IHeader<MessageType>
Defined in: packages/services/lib/kernel/base.d.ts:45
Get the last parent header
Returns#
undefined | IHeader<MessageType>
ready#
Get Signature#
get ready():
Promise<void>
Defined in: packages/services/lib/kernel/base.d.ts:17
A promise that is fulfilled when the kernel is ready.
Returns#
Promise<void>
A promise that is fulfilled when the kernel is ready.
Implementation of#
Methods#
clearOutput()#
protectedclearOutput(content,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:174
Send a clear_output message to the client.
Parameters#
content#
The clear_output content.
wait#
boolean
parentHeader?#
IHeader<MessageType>
The parent header.
Returns#
void
commClose()#
abstractcommClose(msg):Promise<void>
Defined in: packages/services/lib/kernel/base.d.ts:125
Send an comm_close message.
Parameters#
msg#
ICommCloseMsg
Returns#
Promise<void>
commInfoRequest()#
abstractcommInfoRequest(content):Promise<ReplyContent<ICommInfoReply>>
Defined in: packages/services/lib/kernel/base.d.ts:101
Handle a comm_info_request message.
Parameters#
content#
The content of the request.
target_name?#
string
The comm target name to filter returned comms
Returns#
Promise<ReplyContent<ICommInfoReply>>
A promise that resolves with the response message.
commMsg()#
abstractcommMsg(msg):Promise<void>
Defined in: packages/services/lib/kernel/base.d.ts:119
Send an comm_msg message.
Parameters#
msg#
ICommMsgMsg
The comm_msg message.
Returns#
Promise<void>
commOpen()#
abstractcommOpen(msg):Promise<void>
Defined in: packages/services/lib/kernel/base.d.ts:113
Send an comm_open message.
Parameters#
msg#
ICommOpenMsg
The comm_open message.
Returns#
Promise<void>
completeRequest()#
abstractcompleteRequest(content):Promise<ReplyContent<ICompleteReply>>
Defined in: packages/services/lib/kernel/base.d.ts:77
Handle a complete_request message.
Parameters#
content#
The content of the request.
code#
string
cursor_pos#
number
Returns#
Promise<ReplyContent<ICompleteReply>>
displayData()#
protecteddisplayData(content,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:139
Send a display_data message to the client.
Parameters#
content#
The display_data content.
data#
IMimeBundle
metadata#
PartialJSONObject
transient?#
{ display_id: string; }
transient.display_id?#
string
parentHeader?#
IHeader<MessageType>
The parent header.
Returns#
void
dispose()#
dispose():
void
Defined in: packages/services/lib/kernel/base.d.ts:53
Dispose the kernel.
Returns#
void
Implementation of#
executeRequest()#
abstractexecuteRequest(content):Promise<ReplyContent<IExecuteReply> &IExecuteCount>
Defined in: packages/services/lib/kernel/base.d.ts:71
Handle an execute_request message.
Parameters#
content#
The content of the execute_request kernel message
allow_stdin?#
boolean
Whether to allow stdin requests.
The default is true.
code#
string
The code to execute.
silent?#
boolean
Whether to execute the code as quietly as possible.
The default is false.
stop_on_error?#
boolean
Whether to the abort execution queue on an error.
The default is false.
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.
user_expressions?#
JSONObject
A mapping of names to expressions to be evaluated in the kernel’s interactive namespace.
Returns#
Promise<ReplyContent<IExecuteReply> & IExecuteCount>
handleComm()#
protectedhandleComm(type,content,metadata,buffers,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:180
Send a comm message to the client.
Parameters#
type#
"comm_close" | "comm_msg" | "comm_open"
content#
comm_id#
string
data#
JSONObject
metadata#
JSONObject
buffers#
undefined | (ArrayBuffer | ArrayBufferView)[]
parentHeader?#
IHeader<MessageType>
Returns#
void
handleMessage()#
handleMessage(
msg):Promise<void>
Defined in: packages/services/lib/kernel/base.d.ts:59
Handle an incoming message from the client.
Parameters#
msg#
IMessage
The message to handle
Returns#
Promise<void>
Implementation of#
inputReply()#
abstractinputReply(content):void
Defined in: packages/services/lib/kernel/base.d.ts:107
Send an input_reply message.
Parameters#
content#
ReplyContent<IInputReply>
The content of the reply.
Returns#
void
inputRequest()#
protectedinputRequest(content,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:146
Send a input_request message to the client.
Parameters#
content#
The input_request content.
password#
boolean
Whether the request is for a password. If so, the frontend shouldn’t echo input.
prompt#
string
The text to show at the prompt.
parentHeader?#
IHeader<MessageType>
The parent header.
Returns#
void
inspectRequest()#
abstractinspectRequest(content):Promise<ReplyContent<IInspectReply>>
Defined in: packages/services/lib/kernel/base.d.ts:85
Handle an inspect_request message.
Parameters#
content#
The content of the request.
code#
string
cursor_pos#
number
detail_level#
0 | 1
Returns#
Promise<ReplyContent<IInspectReply>>
A promise that resolves with the response message.
isCompleteRequest()#
abstractisCompleteRequest(content):Promise<ReplyContent<IIsCompleteReplyIncomplete|IIsCompleteReplyOther>>
Defined in: packages/services/lib/kernel/base.d.ts:93
Handle an is_complete_request message.
Parameters#
content#
The content of the request.
code#
string
Returns#
Promise<ReplyContent<IIsCompleteReplyIncomplete | IIsCompleteReplyOther>>
A promise that resolves with the response message.
kernelInfoRequest()#
abstractkernelInfoRequest():Promise<ReplyContent<IInfoReply>>
Defined in: packages/services/lib/kernel/base.d.ts:65
Handle a kernel_info_request message.
Returns#
Promise<ReplyContent<IInfoReply>>
A promise that resolves with the kernel info.
publishExecuteError()#
protectedpublishExecuteError(content,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:160
Send an error message to the client.
Parameters#
content#
The error content.
ename#
string
evalue#
string
traceback#
string[]
parentHeader?#
IHeader<MessageType>
The parent header.
Returns#
void
publishExecuteResult()#
protectedpublishExecuteResult(content,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:153
Send an execute_result message.
Parameters#
content#
The execute result content.
data#
IMimeBundle
execution_count#
ExecutionCount
metadata#
PartialJSONObject
transient?#
{ display_id: string; }
transient.display_id?#
string
parentHeader?#
IHeader<MessageType>
The parent header.
Returns#
void
stream()#
protectedstream(content,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:132
Stream an event from the kernel
Parameters#
content#
The stream content.
name#
"stdout" | "stderr"
text#
string
parentHeader?#
IHeader<MessageType>
The parent header.
Returns#
void
updateDisplayData()#
protectedupdateDisplayData(content,parentHeader?):void
Defined in: packages/services/lib/kernel/base.d.ts:167
Send a update_display_data message to the client.
Parameters#
content#
object & object
The update_display_data content.
parentHeader?#
IHeader<MessageType>
The parent header.
Returns#
void