Day 56 — The littlest Jupyter console

This week I'm planning to build a terminal frontend for Jupyter (in Rust!) so today I started looking into how Jupyter works!

I found this doc which shows how messaging works in Jupyter. When we start a jupyter_console (like IPython), it starts a Python kernel in the "backend".

The kernel exposes some sockets, using which the jupyter_console "frontend" can communicate with the kernel (the "backend"). A single kernel can simultaneously be connected to multiple frontends.

These are the sockets that the kernel exposes:

After that I read through the jupyter_console and jupyter_client codebases to understand how they send messages to the kernel. (zeromq!)

I thought that it might be fun to implement and see what the littlest (read "barely functioning") jupyter_console would look like! And came up with something which has the following limitations (and more that I can't list down right now):

It works (barely)! I want to call it cutypr lol!


  In [1]: import os
  In [2]: print(os.getcwd())
  /home/vinayak/dev

  In [3]:

Now I need to understand how zeromq works; and implement, client.execute(code), client.iopub_channel.msg_ready(), and client.iopub_channel.get_msg() in Rust! And also figure out how to start a Python kernel from Rust.