8000 GitHub - siamak-amo/gonb: GoNB, a Go Notebook Kernel for Jupyter
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

siamak-amo/gonb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoNB - A Go Notebook Kernel for Jupyter

Go Dev Go Report Card Binder

To quick start, see the very simple tutorial!

Go is a compiled language, but with very fast compilation, that allows one to use it in a REPL (Read-Eval-Print-Loop) fashion, by inserting a "Compile" step in the middle of the loop -- so it's a Read-Compile-Run-Print-Loop -- while still feeling very interactive.

GoNB leverages that compilation speed to implement a full-featured (at least it's getting there) Jupyter notebook kernel.

It already includes many goodies: contextual help and auto-complete (with gopls), compilation error context (by mousing over), bash command execution, images, html, etc. See the tutorial.

It's still experimental. This is very fresh from the oven, and likely there are many nuanced (or not so nuanced) situations where it may not work as expected. Reports of issues and even better fixes are very welcome.

There is also a live version in Google's Colab that one can interact with (make a copy first) -- if link doesn't work (Google Drive sharing publicly is odd), download it from github and upload it to Google's Colab.

Installation

The tutorial explains, but in short:

$ go install github.com/janpfeifer/gonb@latest
$ go install golang.org/x/tools/cmd/goimports@latest
$ go install golang.org/x/tools/gopls@latest
$ gonb --install

And then (re-)start Jupyter.

Rich display: HTML, Images, SVG, Videos, manipulating javascript, etc.

GoNB opens a named pipe (set in environment variable GONB_PIPE) that a program can use to directly display any type of HTML content.

For the most cases, one can simply import github.com/janpfeifer/gonb/gonbui: the library offers and convenient API to everything available. Examples of use in the tutorial.

If implementing some new mime type (or some other form of interaction), see kernel/display.go for the protocol details.

TODOs

Many! Contributions are welcome. Some from the top of my head:

  • Mac and Windows:
    • Installation.
    • Named-pipe implementation in kernel/pipeexec.go.
  • Tracking of lines on generated Go files back to cell, so reported errors are easy to follow. In the meantime the errors can be moused over and will display the lines surrounding them.
  • Controllable (per package or file) logging.
  • Library to easily store/retrieve calculated content. When doing data analysis so one doesn't need to re-generate some result at a next cell execution. Something like func Save[T any](id string, fn func() (T, error)) T, error that calls fn, and if successful, saves the result before returning it. And the accompanying func Load[T any](id string) T, error and func LoadOrRun[T any](id string, fn func() (T, error)) T, error which will load the result if available or run fn to regenerate it (and then save it).

Implementation

The Jupyter kernel started from gophernotes implementation, but was heavily modified. Also, the execution loop and mechanisms are completely different and new.

About

GoNB, a Go Notebook Kernel for Jupyter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.8%
  • Shell 0.2%
0