Skip to content
This repository has been archived by the owner on Feb 19, 2018. It is now read-only.
/ gopherlab Public archive
forked from gopherdata/gophernotes

It's time to use Go in notebooks. Archived inactive fork from the original gophernotes project, supporting message spec v5 (JupyterLab)

License

Notifications You must be signed in to change notification settings

fabian-z/gopherlab

 
 

Repository files navigation

Archived: gopherlab is obsoleted by gophernotes

The purpose of this fork was to add Jupyter v5 protocol and JupyterLab support to Go notebooks. Since then the original project has seen significant work (including v5 protocol support) and is now being actively maintained. Therefore, all users of this fork are encouraged to switch their usage to gophernotes. Please also direct all further contributions there.


gopherlab - Go in Jupyter Notebooks

CI status Code quality report

gopherlab is a Go kernel for Jupyter notebooks, also supporting the still alpha JupyterLab. This allows for using Go in an interactive context, directly in the browser, making it ideal for educational uses and data science. Use gopherlab to create and share documents that contain live Go code, equations, visualizations and explanatory text. These notebooks can then be shared with others via e-mail, GitHub, etc.

The original gophernotes project came out of the Gopher Gala 2016 and was inspired by a self-described as limited ipython kernel called iGo. The REPL backend of both gophernotes and gopherlab is provided by gore.

Screenshots/Examples

Simple interactive use:

Screenshot

Example Notebooks (download and run them locally, follow the links to view in GitHub):

Installation

Local, Linux

  • Dependencies:

    • Go (Tested with Go 1.5 and 1.6)
    • Jupyter (see here for more details on installing jupyter)
    • ZeroMQ (4.x, if you need another version please file an issue)
  • Create a workspace and setup your GOPATH, see https://golang.org/doc/code.html#GOPATH

  • go get github.com/fabian-z/gopherlab
    
  • Create a directory for the new kernel config:

    mkdir -p ~/.local/share/jupyter/kernels/gopherlab
    
  • Copy the kernel config into the jupyter directory:

    cp -r $GOPATH/src/github.com/fabian-z/gopherlab/kernel/* ~/.local/share/jupyter/kernels/gopherlab/
    

    Note, depending on which version of jupyter you are using and if you are using Anaconda, you may need to copy to ~/.ipython rather than ~/.local/share.

  • Copy the gopherlab kernel to your kernels directory and add the correct path in kernel.json:

  cp -a $GOPATH/bin/gopherlab ~/.local/share/jupyter/kernels/gopherlab/
  
  sed -i "s#/go/bin/gopherlab#$HOME/.local/share/jupyter/kernels/gopherlab/gopherlab#g" $HOME/.local/share/jupyter/kernels/gopherlab/kernel.json

Local, OSX

  • Dependencies:

    • Go (Tested with Go 1.8)
    • Jupyter and ZeroMQ
      • port install py36-jupyter py36-readline
  • Create a workspace and setup your GOPATH, see https://golang.org/doc/code.html#GOPATH

  • go get github.com/fabian-z/gopherlab
    
  • Create a directory for the new kernel config:

    mkdir -p ~/Library/Jupyter/kernels/gopherlab
    
  • Copy the kernel config into the jupyter directory:

    cp $GOPATH/src/github.com/fabian-z/gopherlab/kernel/* ~/Library/Jupyter/kernels/gopherlab/
    
  • Fix path in kernel.json:

    sed -i.bak "s#/go/bin/gopherlab#$GOPATH/bin/gopherlab#g" ~/Library/Jupyter/kernels/gopherlab/kernel.json
    

Getting Started

  • If you completed the install above start the jupyter notebook:

    jupyter notebook
    
  • Alternatively, start the JupyterLab Alpha

jupyter lab
  • Select Go (gopherlab) from the New drop down menu.

  • Have Fun!

Troubleshooting

gopherlab not found

  • You will need to change the path to the gopherlab executable in kernel/kernel.json. Above docs provide a sed command for this purpose. You should put the full path to the gopherlab executable here, and shouldn't have any further issues.

Custom Commands

Some of the custom commands from the gore REPL have carried over to gopherlab. Note, in particular, the syntax for importing packages:

:import <package path>  Import package
:print                  Show current source (currently prints to the terminal where the notebook server is running)
:write [<filename>]     Write out current source to file
:help                   List commands

Output support for these command is currently under construction, e.g. :print already works.

Licenses

Original gophernotes was created by Daniel Whitenack. gopherlab was forked by Fabian Zaremba, in order to add new features, support new message spec (JupyterLab) and update several core components. Both projects are licensed under an MIT-style License.

About

It's time to use Go in notebooks. Archived inactive fork from the original gophernotes project, supporting message spec v5 (JupyterLab)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%