Documentation ¶
Overview ¶
Package igo implements the machinery necessary to run a Go kernel for IPython. It should be installed with an "igo" command to launch the kernel.
Index ¶
- Variables
- func HandleExecuteRequest(receipt MsgReceipt)
- func HandleShellMsg(receipt MsgReceipt)
- func HandleShutdownRequest(receipt MsgReceipt)
- func RunCode(text string) (val interface{}, err error)
- func RunKernel(connection_file string, logwriter io.Writer)
- func SendKernelInfo(receipt MsgReceipt)
- func SetupExecutionEnvironment()
- type ComposedMsg
- type ConnectionInfo
- type ErrMsg
- type InvalidSignatureError
- type KernelInfo
- type KernelStatus
- type MsgHeader
- type MsgReceipt
- type OutputMsg
- type ShutdownReply
- type SocketGroup
Constants ¶
This section is empty.
Variables ¶
var ExecCounter int = 0
ExecCounter is incremented each time we run user code.
var World *eval.World
World holds the user namespace for the REPL.
Functions ¶
func HandleExecuteRequest ¶
func HandleExecuteRequest(receipt MsgReceipt)
HandleExecuteRequest runs code from an execute_request method, and sends the various reply messages.
func HandleShellMsg ¶
func HandleShellMsg(receipt MsgReceipt)
HandleShellMsg responds to a message on the shell ROUTER socket.
func HandleShutdownRequest ¶
func HandleShutdownRequest(receipt MsgReceipt)
func RunKernel ¶
RunKernel is the main entry point to start the kernel. This is what is called by the igo executable.
func SendKernelInfo ¶
func SendKernelInfo(receipt MsgReceipt)
SendKernelInfo sends a kernel_info_reply message.
func SetupExecutionEnvironment ¶
func SetupExecutionEnvironment()
Types ¶
type ComposedMsg ¶
type ComposedMsg struct { Header MsgHeader Parent_header MsgHeader Metadata map[string]interface{} Content interface{} }
ComposedMsg represents an entire message in a high-level structure.
func NewMsg ¶
func NewMsg(msg_type string, parent ComposedMsg) (msg ComposedMsg)
NewMsg creates a new ComposedMsg to respond to a parent message. This includes setting up its headers.
func WireMsgToComposedMsg ¶
func WireMsgToComposedMsg(msgparts [][]byte, signkey []byte) (msg ComposedMsg, identities [][]byte, err error)
WireMsgToComposedMsg translates a multipart ZMQ messages received from a socket into a ComposedMsg struct and a slice of return identities. This includes verifying the message signature.
func (ComposedMsg) ToWireMsg ¶
func (msg ComposedMsg) ToWireMsg(signkey []byte) (msgparts [][]byte)
ToWireMsg translates a ComposedMsg into a multipart ZMQ message ready to send, and signs it. This does not add the return identities or the delimiter.
type ConnectionInfo ¶
type ConnectionInfo struct { Signature_scheme string Transport string Stdin_port int Control_port int IOPub_port int HB_port int Shell_port int Key string IP string }
ConnectionInfo stores the contents of the kernel connection file created by IPython.
type InvalidSignatureError ¶
type InvalidSignatureError struct{}
InvalidSignatureError is returned when the signature on a received message does not validate.
func (*InvalidSignatureError) Error ¶
func (e *InvalidSignatureError) Error() string
type KernelInfo ¶
type KernelInfo struct { Protocol_version []int `json:"protocol_version"` Language string `json:"language"` }
KernelInfo holds information about the igo kernel, for kernel_info_reply messages.
type KernelStatus ¶
type KernelStatus struct {
ExecutionState string `json:"execution_state"`
}
KernelStatus holds a kernel state, for status broadcast messages.
type MsgReceipt ¶
type MsgReceipt struct { Msg ComposedMsg Identities [][]byte Sockets SocketGroup }
MsgReceipt represents a received message, its return identities, and the sockets for communication.
func (*MsgReceipt) SendResponse ¶
func (receipt *MsgReceipt) SendResponse(socket *zmq.Socket, msg ComposedMsg)
SendResponse sends a message back to return identites of the received message.
type OutputMsg ¶
type OutputMsg struct { Execcount int `json:"execution_count"` Data map[string]string `json:"data"` Metadata map[string]interface{} `json:"metadata"` }
OutputMsg holds the data for a pyout message.
type ShutdownReply ¶
type ShutdownReply struct {
Restart bool `json:"restart"`
}
type SocketGroup ¶
type SocketGroup struct { Shell_socket *zmq.Socket Control_socket *zmq.Socket Stdin_socket *zmq.Socket IOPub_socket *zmq.Socket Key []byte }
SocketGroup holds the sockets the kernel needs to communicate with the kernel, and the key for message signing.
func PrepareSockets ¶
func PrepareSockets(conn_info ConnectionInfo) (sg SocketGroup)
PrepareSockets sets up the ZMQ sockets through which the kernel will communicate.