Announcing: a Golang kernel for Jupyter notebooks!

alt tag

For the past 48 hours I have been participating in the Gopher Gala hackathon. I'm a little tired now, but I had to share my project and get the word out. I have created a first release of a Golang kernel for Jupyter (aka ipython) notebooks (see the Github repo here)! That's right Go lovers, you can now create, in the browser, and share documents that contain live Go code, equations, visualizations and explanatory text. It's time we programmed in Go interactively and let all those data scientists out there experience the joys of concurrency, channels, etc.

The project is call gophernotes. It is based on a REPL called gore and on a, no longer maintained and self-described as limited, ipython kernel call iGo. Here it is in action:

alt tag

And here are some example notebooks:

Installation/Usage

You can install gophernotes along with your current installation of Jupyter (e.g., an installation of Anaconda), or you can get going right away with a docker image.

Local Installation/Usage:

Make sure jupyter notebook and libzmq-dev are installed. See here for more details on installing jupyter. Next, install goimports if you haven't already:

go get golang.org/x/tools/cmd/goimports

Get the kernel:

go get github.com/gophergala2016/gophernotes

Create a directory for the new kernel config:

mkdir -p ~/.ipython/kernels/gophernotes

Copy the kernel config into the .ipython directory:

cp -r $GOPATH/src/github.com/gophergala2016/gophernotes/kernel/* ~/.ipython/kernels/gophernotes

Start the jupyter notebook:

jupyter notebook

Then, select Golang from the New drop down menu, and have fun!

Possible Issues: Depending on your environment, you may need to manually change the path to the gophernotes executable in kernel/kernel.json before copying it to ~/.ipython/kernels/gophernotes. You can put the full path to the gophernotes executable here, and you shouldn't have any further issues.

Docker Installation/Usage:

Pull down and run the latest image:

docker pull dwhitena/gophernotes:latest
docker run --name gophernotes --net host -d dwhitena/gophernotes:latest

Point your browser to localhost:8888, select Golang from the New drop down menu, and have fun! It's that easy. Note, in both of these scenarios, you are still able to create python notebooks, text files, run the ipython shell, etc.

Enjoy!

comments powered by Disqus