gophernotes
is a Go kernel for Jupyter notebooks. Finally, we can have a reliable and maintained way to use Go interactively and code in the browser. Use gophernotes
to create and share documents that contain live Go code, equations, visualizations and explanatory text. These notebooks, with the live Go code, can then be shared with others via email, Dropbox, GitHub and the Jupyter Notebook Viewer. Go forth and do data science, or anything else interesting, with go notebooks!
This project came out of the Gopher Gala 2016. It is based on a REPL called gore and on a, no longer maintained and self-described limited, ipython kernel call iGo.
Example Notebooks (they render quite nice within Github, or use the Jupyter Notebook Viewer):
- Simple Printing and Channels
- Pattern Recognition with Golearn
- Feed Forward, Recurrent Neural Nets
- Time Parsing, Formatting
- Stateful Goroutines
-
Make sure jupyter notebook is installed. See here for more details.
-
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
-
Select
Golang
from theNew
drop down menu. -
Have Fun!
Possible Issues:
- Depending on your environment, you may need to manually change the path to the
gophernotes
executable inkernel/kernel.json
before copying it to~/.ipython/kernels/gophernotes
. You can put the full path to thegophernotes
executable here, and you shouldn't have any further issues.
Some of the custom commands from the gore REPL have carried over to gophernotes
. Note in particular the syntax for importing packages:
:import <package path> Import package
:print Show current source
:write [<filename>] Write out current source to file
:help List commands
Rewrite of some of the gore functionality to process messages from the notebook.Implement more intuitive error handling in the notebook, test the suite of functionality in the Jupyter notebook.Refactor, loggingsExamples, screenshots, installation- Troubleshoot errors, unit testing
- Godep
- Dockerfile?