Skip to content

Using the jupyterlab services API

Rich Chiodo edited this page Aug 3, 2022 · 17 revisions

This page describes how the Jupyter extension uses the @jupyterlab/services npm module to connect and control Jupyter kernels.

What is it and why do we need it?

Jupyter kernels are processes that handle a set of messages called the Jupyter Messaging Protocol (or JMP for short).

In this diagram below, those messages are sent over the 0MQ portion.

We (the Jupyter Extension) need to send these messages to and from a Jupyter kernel.

The Jupyter org has provided the @jupyterlab/services npm module to help us do just that.

This npm module:

The npm module essentially handles all communication to and from a kernel so that javascript can treat the kernel like a local object.

image

Raw ZMQ

We started with the @jupyterlab/services because the first version of the Jupyter extension always talked to a notebook server, either by us starting one or the user providing one.

There were frequent issues with that and we switched to a more direct approach.

The direct (or raw as it's called elsewhere) doesn't talk to a notebook server. Instead it talks directly to the kernels over zmq:

This means

Futures and what they mean

Deserializing/Serializing

Differences with raw

Widgets

Clone this wiki locally