Loading repository data…
Loading repository data…
arturoeanton / repository
Go-Notebook is inspired by Jupyter Project (link) in order to document Golang code.

Go-Notebook is an app that was developed using go-echo-live-view framework, developed also by us.
GitHub repository is here.
For this project we using https://github.com/cosmos72/gomacro too
Go-Notebook is inspired by Jupyter Project (link) in order to document Golang code.
You can add code and text depends your needs.
Shift+Enter).[n], [*] while running), Run all, Clear output per cell or for the whole notebook, move/insert/duplicate cells from the hover toolbar, and collapsible outputs.ShowPlot(p) works out of the box for gonum plots (host-side via reflection, no gonum dependency in the binary).Export button or /export/<name>).go-notebook run <name> -p key=value -o report.html executes every cell and writes the HTML report — schedule it with cron for automated reporting.Vars button): live view of the interpreter's variables with name, type and value, refreshed after every cell run.bindings/):
ShowGrid(df) renders a live, server-side grid with sorting, filtering and pagination — only the visible page travels to the browser.ReadSQL(driver, dsn, query) returns a go-pandas DataFrame and SQLExec runs statements, with sqlite (no cgo) and postgres drivers compiled into the binary.BarChart, LineChart, AreaChart, ScatterChart, Histogram, PieChart — no plotting engine to compile.default.gonote): ShowDF(df) renders a DataFrame as an HTML table, ShowHTML(s) renders raw HTML, ColF/ColS pull DataFrame columns as slices.gonum notebook (pick it from the toolbar) demos gonum/plot: its first run downloads and compiles the package on the fly, which can take a minute or two.Authentication is off by default (open mode, for local use). Enable it by creating users:
go run . user add ana # prompts for a password
go run . user list
go run . user del ana
With at least one user in users.json, the server requires signing in and
gives each user their own workspace (workspaces/<user>/), seeded with
the default notebook on first login. Passwords are stored as bcrypt hashes
and sessions use HMAC-signed cookies. users.json and workspaces/ are
gitignored.
Notebook cells run arbitrary Go code with the server's privileges — that is the point of the tool, and also the reason to be careful:
localhost:1323 by default. To expose it use
-p 0.0.0.0:1323, enable authentication, and put it behind TLS.Go 1.25.5 or newer.
git clone https://github.com/arturoeanton/go-notebook.git
cd go-notebook
go run .
⇨ http server started on [::]:1323
The image is published on Docker Hub as
arturoeanton/go-notebook
with the tags latest and v2 (current stable). Inside the container the
server listens on 0.0.0.0:1323 and runs as a non-root user.
docker pull arturoeanton/go-notebook:v2
docker run --rm -p 1323:1323 arturoeanton/go-notebook:v2
Run it in the background instead:
docker run -d --name gonote -p 1323:1323 arturoeanton/go-notebook:v2
docker logs -f gonote # follow the logs
docker stop gonote # stop it
docker build . -t arturoeanton/go-notebook:v2 -t arturoeanton/go-notebook:latest
docker push arturoeanton/go-notebook:v2
docker push arturoeanton/go-notebook:latest
docker run --rm -p 1323:1323 --volume ./notebooks:/app/notebooks --volume ./snippet:/app/snippet arturoeanton/go-notebook:v2
podman run --rm -p 1323:1323 --volume ./notebooks:/app/notebooks:Z --volume ./snippet:/app/snippet:Z arturoeanton/go-notebook:v2
The files in bindings/ are generated with the gomacro CLI (mode _3) and
registered at startup through imports.Packages.Merge. To update them after
bumping a library version:
go install github.com/cosmos72/gomacro@latest
echo 'import _3 "github.com/arturoeanton/go-pandas"' | GODEBUG=gotypesalias=0 gomacro
then copy the generated file from $GOPATH/src/github.com/cosmos72/gomacro/imports/thirdparty/
into bindings/, changing the package clause to bindings.
The default notebook, with markdown cells, Go code with syntax highlighting and Jupyter-style execution counters:

Native SVG charts, in dark mode:

The interactive server-side data grid (ShowGrid), with sorting, filtering
and pagination:

This project is still in progress, we are working in the following features.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.