Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ jobs:
--baseURL "${{ steps.pages.outputs.base_url }}/"

# The playground: the page, its example notebooks and the WebAssembly
# cores (Go, and Go with Ruby), built here from the
# cores (Go; Go with Ruby, R and Fortran; and that with Julia, with its
# compressed Base image, which the page fetches only when a Julia cell is
# run: cmd/build writes them all into the output directory, so everything
# in ../public/playground is served), built here from the
# go-notebook/playground version that playground/go.mod pins (never a
# committed binary). The build runs every notebook first and fails if a
# cell fails.
Expand Down
6 changes: 3 additions & 3 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ disableKinds = ['taxonomy', 'term', 'rss', 'sitemap', '404']
title = "Go and Ruby cells, and what they printed"
[[params.hero.cards]]
title = "Try it in your browser"
text = "The playground runs notebooks, Go, Ruby and R cells, in WebAssembly in the tab: edit a cell, press Ctrl+Enter, see the result."
text = "The playground runs notebooks, Go, Ruby, R, Fortran and Julia cells, in WebAssembly in the tab: edit a cell, press Ctrl+Enter, see the result."
href = "/playground/"
more = "Open the playground"

Expand All @@ -59,12 +59,12 @@ disableKinds = ['taxonomy', 'term', 'rss', 'sitemap', '404']
name = "notebook"
kind = "kernel · command"
href = "https://github.com/go-notebook/notebook"
blurb = "The kernel, the <code>notebook</code> command (<code>run</code>, <code>html</code>, <code>watch</code>, <code>serve</code>, <code>irb</code>) and the HTML export: <code>format</code> parses the Markdown, <code>analysis</code> builds the dependency graph from the syntax, <code>gen</code> writes the Go program, <code>kernel</code> compiles and drives it through <code>runtime</code> and keeps results and values, <code>export</code> writes the page. <strong>Ruby cells</strong> (<code>```ruby</code>) run on <a href=\"https://github.com/go-embedded-ruby/ruby\">rbgo</a>, a Ruby written in Go, with the <a href=\"https://github.com/go-scikit/ruby\">go-scikit bindings</a> (<code>Stats</code>, <code>Special</code>, <code>Optimize</code>, <code>Integrate</code>, <code>DataFrame</code>, <code>Plot</code>, <code>NDArray</code>), and share their variables with the Go cells. <code>--timeout</code> and <code>--memory</code> stop a runaway cell in either language. <strong><code>notebook irb</code></strong> is the same Ruby as an interactive session, as irb: <code>=&gt; inspect</code> after each input, <code>_</code>, multi-line input decided by rbgo's parser, Tab completion and history in a pure-Go line editor (<a href=\"https://github.com/go-ruby-reline/reline\">go-ruby-reline</a>), each input in a worker that <code>--timeout</code>, <code>--memory</code> or Ctrl-C can stop without losing the prompt, and <code>--save</code> to keep the session as a notebook. <a href=\"/docs/main/irb/\">More →</a> <strong>Julia cells</strong> (<code>```julia</code>) are parsed with <a href=\"https://github.com/go-embedded-julia/julia\">go-embedded-julia</a>'s parser and checked (syntax errors at their line with julia's message, names in the dependency graph under Julia's scope rules), and, since go-notebook v0.18.0, run by its interpreter (v0.17.0, since go-notebook v0.19.0) in one kernel shared by the Julia cells: a global or a function a cell defines is there in the next one, a top-level loop updates a global as in IJulia (55 for a sum of 1 to 10), and a failure, a <code>MethodError</code> included, is julia's own text. The kernel boots from a prebuilt Base image, fetched on the first Julia cell and loaded only if its SHA-256 is the pinned one (cold start about a second). A cell may run 30 s and 50 million statements, within a memory budget of 512 MiB counted as 16 bytes per array element (a floor, not the heap: strings are not counted, and one array may have at most 2^24 elements). Julia variables cross with Go cells in both directions (Int64, Float64, Bool, String, and vectors and matrices of Float64 or Int64; Go <code>int</code> and <code>[]int</code> as Int64): a Julia value of another type stays in Julia and the Go reader is deferred, naming the type, and a Go value Julia cannot take fails the Julia cell. Inputs are measured before any copy (2^24 elements per array, a cell's inputs together within its memory limit, so a cell can hold up to twice its limit). This breaks v0.18.0, where Julia variables were not shared. Known limitations: a Float64 <code>A * x</code> needs BLAS (go-embedded-julia#67), a non-ASCII <code>uppercase</code> needs utf8proc (#65), and <code>Get</code> refuses an n×0 matrix (#76). The playground checks Julia cells and does not run them (<em>Julia cells run in go-notebook, not yet in the browser</em>). <a href=\"/docs/main/julia/\">More →</a> <strong>R cells</strong> (<code>```r</code>) are parsed with <a href=\"https://github.com/go-embedded-r/r\">go-embedded-r</a>'s parser, identical to R 4.6.2 on R's own sources, and checked in the same way: syntax errors at their line in R's words, names in the graph, and a cell that cannot be analysed from its text (<code>&lt;&lt;-</code>, <code>eval</code>, <code>library</code>) depending on every cell above it. They run on go-embedded-r's evaluator in one shared environment (v0.10.0), and since v0.12.0 each cell is bounded: 512 MiB of vectors, 50 million steps, 30 s. The browser playground runs them too (playground v0.15.0), in its second core, with R variables kept apart from the other languages: 512 MiB, 20 million steps, 10 s per cell, and a crash restarts the core with a message on the cell. <a href=\"/docs/main/r/\">More →</a> <strong>Fortran cells</strong> (<code>```fortran</code>) are checked and run with <a href=\"https://github.com/go-embedded-fortran/fortran\">go-embedded-fortran</a> (since go-notebook v0.17.0, go-embedded-fortran v0.17.0: its <code>sema</code> session for the names and errors, its <code>eval.Session</code> for the running; free form, implicit typing off) and highlighted with go-rouge's <code>fortran</code> lexer. The Fortran cells share one session: a cell sees the variables (with the values the earlier cells left), procedures, modules and derived types of the Fortran cells before it. Fortran variables stay in Fortran, as R's do: they are not shared with Go, Ruby, Julia, R or C cells in either direction yet. A cell may make at most 2^32 loop iterations and calls and run 30 s, and a failure is reported at its line and column. The browser playground runs them too (playground v0.16.0), in its second core, with Fortran variables kept apart from the other languages: 200 million steps and 10 s per cell, and an endless <code>do</code> ends with a message and leaves the page usable. <a href=\"/docs/main/fortran/\">More →</a>"
blurb = "The kernel, the <code>notebook</code> command (<code>run</code>, <code>html</code>, <code>watch</code>, <code>serve</code>, <code>irb</code>) and the HTML export: <code>format</code> parses the Markdown, <code>analysis</code> builds the dependency graph from the syntax, <code>gen</code> writes the Go program, <code>kernel</code> compiles and drives it through <code>runtime</code> and keeps results and values, <code>export</code> writes the page. <strong>Ruby cells</strong> (<code>```ruby</code>) run on <a href=\"https://github.com/go-embedded-ruby/ruby\">rbgo</a>, a Ruby written in Go, with the <a href=\"https://github.com/go-scikit/ruby\">go-scikit bindings</a> (<code>Stats</code>, <code>Special</code>, <code>Optimize</code>, <code>Integrate</code>, <code>DataFrame</code>, <code>Plot</code>, <code>NDArray</code>), and share their variables with the Go cells. <code>--timeout</code> and <code>--memory</code> stop a runaway cell in either language. <strong><code>notebook irb</code></strong> is the same Ruby as an interactive session, as irb: <code>=&gt; inspect</code> after each input, <code>_</code>, multi-line input decided by rbgo's parser, Tab completion and history in a pure-Go line editor (<a href=\"https://github.com/go-ruby-reline/reline\">go-ruby-reline</a>), each input in a worker that <code>--timeout</code>, <code>--memory</code> or Ctrl-C can stop without losing the prompt, and <code>--save</code> to keep the session as a notebook. <a href=\"/docs/main/irb/\">More →</a> <strong>Julia cells</strong> (<code>```julia</code>) are parsed with <a href=\"https://github.com/go-embedded-julia/julia\">go-embedded-julia</a>'s parser and checked (syntax errors at their line with julia's message, names in the dependency graph under Julia's scope rules), and, since go-notebook v0.18.0, run by its interpreter (v0.17.0, since go-notebook v0.19.0) in one kernel shared by the Julia cells: a global or a function a cell defines is there in the next one, a top-level loop updates a global as in IJulia (55 for a sum of 1 to 10), and a failure, a <code>MethodError</code> included, is julia's own text. The kernel boots from a prebuilt Base image, fetched on the first Julia cell and loaded only if its SHA-256 is the pinned one (cold start about a second). A cell may run 30 s and 50 million statements, within a memory budget of 512 MiB counted as 16 bytes per array element (a floor, not the heap: strings are not counted, and one array may have at most 2^24 elements). Julia variables cross with Go cells in both directions (Int64, Float64, Bool, String, and vectors and matrices of Float64 or Int64; Go <code>int</code> and <code>[]int</code> as Int64): a Julia value of another type stays in Julia and the Go reader is deferred, naming the type, and a Go value Julia cannot take fails the Julia cell. Inputs are measured before any copy (2^24 elements per array, a cell's inputs together within its memory limit, so a cell can hold up to twice its limit). This breaks v0.18.0, where Julia variables were not shared. Known limitations: a Float64 <code>A * x</code> needs BLAS (go-embedded-julia#67), a non-ASCII <code>uppercase</code> needs utf8proc (#65), and <code>Get</code> refuses an n×0 matrix (#76). The browser playground runs them too (playground v0.18.0), in a third core that the page loads only when a Julia cell is first run (about 28 MB and about 20 s), with Julia variables kept apart from Go's: 512 MiB, 20 million statements and 20 s per cell, and a new worker after each Julia run. <a href=\"/docs/main/julia/\">More →</a> <strong>R cells</strong> (<code>```r</code>) are parsed with <a href=\"https://github.com/go-embedded-r/r\">go-embedded-r</a>'s parser, identical to R 4.6.2 on R's own sources, and checked in the same way: syntax errors at their line in R's words, names in the graph, and a cell that cannot be analysed from its text (<code>&lt;&lt;-</code>, <code>eval</code>, <code>library</code>) depending on every cell above it. They run on go-embedded-r's evaluator in one shared environment (v0.10.0), and since v0.12.0 each cell is bounded: 512 MiB of vectors, 50 million steps, 30 s. The browser playground runs them too (playground v0.15.0), in its second core, with R variables kept apart from the other languages: 512 MiB, 20 million steps, 10 s per cell, and a crash restarts the core with a message on the cell. <a href=\"/docs/main/r/\">More →</a> <strong>Fortran cells</strong> (<code>```fortran</code>) are checked and run with <a href=\"https://github.com/go-embedded-fortran/fortran\">go-embedded-fortran</a> (since go-notebook v0.17.0, go-embedded-fortran v0.17.0: its <code>sema</code> session for the names and errors, its <code>eval.Session</code> for the running; free form, implicit typing off) and highlighted with go-rouge's <code>fortran</code> lexer. The Fortran cells share one session: a cell sees the variables (with the values the earlier cells left), procedures, modules and derived types of the Fortran cells before it. Fortran variables stay in Fortran, as R's do: they are not shared with Go, Ruby, Julia, R or C cells in either direction yet. A cell may make at most 2^32 loop iterations and calls and run 30 s, and a failure is reported at its line and column. The browser playground runs them too (playground v0.16.0), in its second core, with Fortran variables kept apart from the other languages: 200 million steps and 10 s per cell, and an endless <code>do</code> ends with a message and leaves the page usable. <a href=\"/docs/main/fortran/\">More →</a>"
[[params.repos]]
name = "playground"
kind = "wasm · page"
href = "https://github.com/go-notebook/playground"
blurb = "<strong>A notebook in the browser, with no server.</strong> The page shows the prose as text and each code cell as a syntax-highlighting editor in Go Mono at 13 px, with a minimap on its right (a click moves the caret) and line annotations, a gutter marker and an inline panel on Ctrl+Shift+M, saved in the Markdown as a <code>gonb:notes</code> comment (a plain text box if the editor fails to load); Ctrl+Enter runs the whole notebook again in the tab. A Go interpreter (<a href=\"https://github.com/traefik/yaegi\">yaegi</a>) compiled to WebAssembly runs the cells, while the libraries they import — go-statistics, go-numerics, go-ndarray, go-plot — run <em>compiled</em>: only the notebook's own code is interpreted. Each run posts the whole notebook to a Web Worker and gets every cell's results back, one call in and one string out, so a long run neither freezes the page nor costs a call per widget. <strong>Ruby cells</strong> run there too, in <a href=\"https://github.com/go-embedded-ruby/ruby\">rbgo</a> with the go-scikit bindings: the page fetches the Ruby core only when the notebook has a Ruby cell. <strong>R cells</strong> run there too, on <a href=\"https://github.com/go-embedded-r/r\">go-embedded-r</a>, in the second core (about 4.5 MB larger), bounded to 512 MiB, 20 million steps and 10 s. <strong>Julia cells</strong> are parsed and checked there, with their badge saying <em>not runnable yet</em>. Nothing reaches the network or a file system, and every figure goes through an allowlist SVG sanitizer. Deployed as <code>/playground/</code> <a href=\"/playground/\">here</a>, with notebooks about the notebook itself, and on <a href=\"https://go-statistics.github.io/playground/\">go-statistics</a> and <a href=\"https://go-numerics.github.io/playground/\">go-numerics</a>."
blurb = "<strong>A notebook in the browser, with no server.</strong> The page shows the prose as text and each code cell as a syntax-highlighting editor in Go Mono at 13 px, with a minimap on its right (a click moves the caret) and line annotations, a gutter marker and an inline panel on Ctrl+Shift+M, saved in the Markdown as a <code>gonb:notes</code> comment (a plain text box if the editor fails to load); Ctrl+Enter runs the whole notebook again in the tab. A Go interpreter (<a href=\"https://github.com/traefik/yaegi\">yaegi</a>) compiled to WebAssembly runs the cells, while the libraries they import — go-statistics, go-numerics, go-ndarray, go-plot — run <em>compiled</em>: only the notebook's own code is interpreted. Each run posts the whole notebook to a Web Worker and gets every cell's results back, one call in and one string out, so a long run neither freezes the page nor costs a call per widget. <strong>Ruby cells</strong> run there too, in <a href=\"https://github.com/go-embedded-ruby/ruby\">rbgo</a> with the go-scikit bindings: the page fetches the Ruby core only when the notebook has a Ruby cell. <strong>R cells</strong> run there too, on <a href=\"https://github.com/go-embedded-r/r\">go-embedded-r</a>, in the second core (about 4.5 MB larger), bounded to 512 MiB, 20 million steps and 10 s. <strong>Julia cells</strong> run there too, on <a href=\"https://github.com/go-embedded-julia/julia\">go-embedded-julia</a>, in a third core and its Base image that the page fetches only when a Julia cell is run (about 28 MB and about 20 s the first time, shown on the cell), bounded to 512 MiB, 20 million statements and 20 s, with their variables kept apart from Go's. Nothing reaches the network or a file system, and every figure goes through an allowlist SVG sanitizer. Deployed as <code>/playground/</code> <a href=\"/playground/\">here</a>, with notebooks about the notebook itself, and on <a href=\"https://go-statistics.github.io/playground/\">go-statistics</a> and <a href=\"https://go-numerics.github.io/playground/\">go-numerics</a>."
[[params.repos]]
name = "docs"
kind = "site"
Expand Down
10 changes: 6 additions & 4 deletions playground/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/go-notebook/go-notebook.github.io/playground

go 1.27.4

require github.com/go-notebook/playground v0.16.0
require github.com/go-notebook/playground v0.18.0

require (
filippo.io/age v1.3.2 // indirect
Expand Down Expand Up @@ -69,6 +69,7 @@ require (
github.com/fxamacker/cbor/v2 v2.9.4 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.8 // indirect
github.com/go-augeas/augeas v0.0.0-20260830115849-a0db83a6594a // indirect
github.com/go-bignum/bigfloat v0.2.0 // indirect
github.com/go-commonmark/commonmark v0.1.0 // indirect
github.com/go-composites/array v0.0.0-20261015235938-f7161fa2d065 // indirect
github.com/go-composites/bag v0.0.0-20261017234052-8c0542744097 // indirect
Expand All @@ -80,8 +81,8 @@ require (
github.com/go-dataframe/dataframe v0.1.0 // indirect
github.com/go-datetime/dates v0.2.0 // indirect
github.com/go-embedded-c/c v0.2.1 // indirect
github.com/go-embedded-fortran/fortran v0.17.0 // indirect
github.com/go-embedded-julia/julia v0.15.0 // indirect
github.com/go-embedded-fortran/fortran v0.24.1 // indirect
github.com/go-embedded-julia/julia v0.17.0 // indirect
github.com/go-embedded-r/r v0.17.1 // indirect
github.com/go-embedded-r/tre v0.1.3 // indirect
github.com/go-embedded-ruby/ruby v0.8.5 // indirect
Expand All @@ -107,7 +108,7 @@ require (
github.com/go-mustache/mustache v0.1.0 // indirect
github.com/go-ndarray/ndarray v0.40.3 // indirect
github.com/go-nokogiri/nokogiri v0.1.0 // indirect
github.com/go-notebook/notebook v0.18.0 // indirect
github.com/go-notebook/notebook v0.20.0 // indirect
github.com/go-numerics/integrate v0.2.0 // indirect
github.com/go-numerics/optimize v0.3.1 // indirect
github.com/go-numerics/special v0.2.0 // indirect
Expand All @@ -118,6 +119,7 @@ require (
github.com/go-plot/plot v0.1.1 // indirect
github.com/go-puppet/puppet v0.0.0-20260918012035-fc6b0424cdbd // indirect
github.com/go-regexp/engine v0.4.2 // indirect
github.com/go-regexp/pcre2 v0.1.0 // indirect
github.com/go-richdoc/richdoc v0.7.0 // indirect
github.com/go-rouge/rouge v0.9.0 // indirect
github.com/go-ruby-aasm/aasm v0.0.0-20261025185733-ae3deccc721d // indirect
Expand Down
Loading
Loading