gopherlab

command module
v0.0.0-...-a41ec92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2018 License: MIT Imports: 15 Imported by: 0

README

Archived: gopherlab is obsoleted by gophernotes

Please use the original project

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

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Yet another Go REPL that works nicely.
Yet another Go REPL that works nicely.
gocode
Package gocode is an interface to github.com/nsf/gocode.
Package gocode is an interface to github.com/nsf/gocode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL