Open source Jupyter client in Golang

I have an application written in Golang, which would want to talk to an iPython kernel.
Now, I know we need something which implements Jupyter protocol. So, the obvious answer is creating a Jupyter Client library which would implement the Jupyter protocol.

Now, my question is this:
Is there any open source Jupyter client library written in Golang which is maintained by the community?

I’m aware of a Jupyter client reference library written in python. Would it be a good choice to integrate that in my use case? Or should I pivot towards creating my own Jupyter Client library in Golang as the Jupyter Protocol is not that difficult to implement?

gophernotes? From line 328 of kernel_test.go here:

“JupyterClient holds references to the 2 sockets it uses to communicate with the kernel.”

“In the sections below I demonstrate simple HTTP client call in Golang with Golang code executed directly in the Jupyter Notebook.” - from Golang to Jupyter: Golang with Jupyter NotebooksGolang to Jupyter - IMTI - Craig Johnston

GoNB, A Modern Go Kernel for Jupyter Notebooks?’s jupyter - “Package jupyter implements a jupyter kernel for Neugram.”

Thank you for your response.
I already went through these resources that you linked. The problem is that they are using Go Kernel as well. I want to use iPython Kernel.

I’m just new to this and could possibly be missing out on something obvious. Any right direction would be helpful. :slight_smile:

Bumping this up to get help from community. Pls refer to my last comment.

Author of GoNB here.

I’m not sure what you are trying to accomplish, but you won’t be able to talk directly the Jupyter Protocol if you are running a program from within the iPython kernel – not without some non-portable hacking.

When the kernel (Python, Go or other) is executed it is passed the ports to connect to the various channels (using a transport layer called ZeroMQ).

I documented the several protocols that are going on in Check out the diagram in the middle of the page, it may give you an overall picture.

Let me know if you have any specific questions.


Maybe I was not very clear in the beginning, apologies for that. Let me try to keep my problem concise.

I am writing a Go based application which would want to call functions of a Go based library which I’d like to think would be a Jupyter Client library written in Golang. This Jupyter Client library would talk to a IPython based Kernel via ZeroMQ as per Jupyter Protocol.

Now, my question is: Is there any open source Jupyter Client library written in Golang which implements the Jupyter Protocol to talk to an IPython kernel.

GoNB and other such solutions are Go based Jupyter Client library but with Go kernel.

this link Jupyter kernels · jupyter/jupyter Wiki · GitHub has a list of kernels, It has GO based kernels as well. Hope this helps

Apologies for my previous repeated email – the interface made it look like a new question.

Not that I know of. But that sounds odd: the iPython kernel talks to the python code running (the ipython) and to JupyterServer, which in turns talk to the jupyter app (?) that runs in the browser.

The iPython Kernel only manages JupyterServer requests and running of the ipython code itself.

My question to you is: Do you want to talk to the iPython Kernel (A) , or to the python interpreter (B) that it runs ?

(A) I’m no expert in iPython Kernel. But I’m curious to hear what you are trying to achieve. One hint would be to join the ZeroMQ channels – you can find the ports by looking at the configuration file that JupyterLab creates when running the kernel. Look at GoNB code on how to talk ZeroMQ.

(B) You could talk to the python program directly: just create a socket, named pipe, a file the python code monitors for changes, or any other usual protocol ? (and then no need of ZeroMQ)

I hope this helps.

1 Like

Hey @Rahul_Yadav I understand what you’re asking. I’ve also been looking at different client libraries that implement the Jupyter protocol - not a Golang Jupyter Kernel. AFAIK, I haven’t found a golang implementation out in the wild. However, I’ve found a fairly simple and straight-forward implementation written in Rust.

The library isn’t actively maintained, but most of the functionality should be complete. The code is also very readable, so it shouldn’t be that hard to port it to Go.

I hope this helps.

1 Like

Thank you @Jan_Pfeifer for your response.

I wanted to use B.

Thank you @Mohamed_Shatry, this is the kind of implementation I was looking for, for Golang, but this is good enough start. I guess I’ll implement my own.