From c39a04093eeddad238bf852fede3ff6a95156beb Mon Sep 17 00:00:00 2001 From: tannevaled Date: Thu, 22 Oct 2026 19:26:44 +0200 Subject: [PATCH] A Ruby cell in the hero notebook The notebook at the top of the page now ends with a ruby cell: it fits a normal distribution to the Go cells' draws through go-scikit/ruby's Stats, on go-notebook v0.3.0 (example/go.mod), and CI runs it like the Go cells. The Ruby cell prints its fit rounded to four places, so that the committed output does not depend on the architecture's fused multiply-adds. The hero, the trust line, Get started and the go-notebook card say that cells can be Go or Ruby; go-scikit/ruby joins the repositories, and the ci check names docs, roadmap and ruby too. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 +- example/first.md | 8 ++++++++ example/go.mod | 9 +++++---- example/go.sum | 10 ++++++++++ example/output.txt | 2 ++ hugo.toml | 9 +++++++-- layouts/index.html | 7 ++++--- 7 files changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 358040c..791c7ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: grep -qE "https://github.com/$org[\">]" public/index.html \ || { echo "::error::https://github.com/$org is not on the page"; rc=1; } done - for repo in go-scikit.github.io brand .github; do + for repo in go-scikit.github.io brand .github docs roadmap ruby; do grep -qF "go-scikit/$repo" public/index.html \ || { echo "::error::go-scikit/$repo is not on the page"; rc=1; } done diff --git a/example/first.md b/example/first.md index b471046..bdfde49 100644 --- a/example/first.md +++ b/example/first.md @@ -18,3 +18,11 @@ x, _ := stats.Normal{Loc: 10, Scale: 2}.Rvs(rng, 1000) ```go stats.Percentiles(x, []float64{25, 50, 75}, nil) ``` + +The same draws in Ruby, through +the go-scikit bindings. + +```ruby +fit = Stats::Normal.fit(x) +format("loc %.4f, scale %.4f", fit.loc, fit.scale) +``` diff --git a/example/go.mod b/example/go.mod index e0ed44e..6c98551 100644 --- a/example/go.mod +++ b/example/go.mod @@ -8,19 +8,20 @@ require ( ) require ( - github.com/go-notebook/notebook v0.2.0 // indirect + github.com/go-notebook/notebook v0.3.0 // indirect github.com/go-numerics/optimize v0.1.0 // indirect github.com/go-numerics/special v0.1.0 // indirect github.com/go-opentype/opentype v0.13.0 // indirect github.com/go-regexp/engine v0.1.3 // indirect github.com/go-rouge/rouge v0.4.0 // indirect + github.com/go-ruby-parser/parser v0.13.1 // indirect github.com/go-ruby-regexp/regexp v0.0.0-20260927145504-6cbb63926eb2 // indirect github.com/go-tex/math v0.50.0 // indirect github.com/yuin/goldmark v1.8.6 // indirect - golang.org/x/mod v0.41.0 // indirect - golang.org/x/sync v0.23.0 // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/sync v0.24.0 // indirect golang.org/x/sys v0.49.0 // indirect - golang.org/x/tools v0.51.0 // indirect + golang.org/x/tools v0.52.0 // indirect ) tool github.com/go-notebook/notebook/cmd/notebook diff --git a/example/go.sum b/example/go.sum index 35742f4..4bf0061 100644 --- a/example/go.sum +++ b/example/go.sum @@ -2,6 +2,8 @@ github.com/go-ndarray/ndarray v0.12.0 h1:4xfl9ZQo1m0UXopo06KypELg1wUYgQb5kdKaJPZ github.com/go-ndarray/ndarray v0.12.0/go.mod h1:ZcgNCBVLXt1FxeZjQWI5Z+k0SSWAT0/wR8slfat/gRA= github.com/go-notebook/notebook v0.2.0 h1:W3z9TbBCyqsHaRcEpa2csMw5UDe8JsgOu6Hwd/R1T6M= github.com/go-notebook/notebook v0.2.0/go.mod h1:cqXgByviyVH6wBixaCPPnHfJkPP1c3jh2JAAfaz2Zf8= +github.com/go-notebook/notebook v0.3.0 h1:DdIynF6MDCiUXbZzImIhUemNvnNdP6QEMsPX821AzZM= +github.com/go-notebook/notebook v0.3.0/go.mod h1:wLXtnHz8JMuXRN0LL2flSQVbBR8H8701Yom1ViAsiKI= github.com/go-numerics/optimize v0.1.0 h1:SOA+QxTuIjeZSAsd5Dyj433lItnOKWyprCbHQoLxg/c= github.com/go-numerics/optimize v0.1.0/go.mod h1:ieZ+/EsbBw/EfHl4W8JryPyCBB8n5a8xKk6lu/xh7zk= github.com/go-numerics/special v0.1.0 h1:HcsebTwcNuAhFBP8RuOirO9XVmWJSrxARiOVkyeCfUk= @@ -12,6 +14,8 @@ github.com/go-regexp/engine v0.1.3 h1:0U5DrrBEYjNX/f0yFESpQDWmJOtXmmZqluNAUBXjfx github.com/go-regexp/engine v0.1.3/go.mod h1:8rju5lq5OkskQh9+m+FjBP6965giMPUdIOdrvFrbqn4= github.com/go-rouge/rouge v0.4.0 h1:f/5EVTEwiEnBOeyAtkV8r5KopdIRAsRoA7Kzi/cyh2Y= github.com/go-rouge/rouge v0.4.0/go.mod h1:V4Xlyl1EDqEfrzloW9y6X0xpv/WvCvTiOWNIcByw2Y8= +github.com/go-ruby-parser/parser v0.13.1 h1:gq7QVT7KdRp7nZt1UHsa73YDo77qrD8kGdQY/GVEA6g= +github.com/go-ruby-parser/parser v0.13.1/go.mod h1:Se+ZvnD/4Vm0RRe1U5kZi0GmPSvSczJJXdZLiB0PlJY= github.com/go-ruby-regexp/regexp v0.0.0-20260927145504-6cbb63926eb2 h1:pNvJf0zgzg0rTEq1fToFa5fnzK13nIble80caTmdG3g= github.com/go-ruby-regexp/regexp v0.0.0-20260927145504-6cbb63926eb2/go.mod h1:I3i2r1AXulgMBt/KiWBcxjnoNsB09ZFKkj2Vb5Mhzuw= github.com/go-statistics/stats v0.1.0 h1:m8/5lxOZEcbWp51T6evG3Yx0ZzMlOO2wIEZa8uBGryA= @@ -24,9 +28,15 @@ github.com/yuin/goldmark v1.8.6 h1:d0VcaP1sx9GkFVkoW+KtggpGi2KZ965i14b0+bDQST4= github.com/yuin/goldmark v1.8.6/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= diff --git a/example/output.txt b/example/output.txt index dfeb45a..cdd6de9 100644 --- a/example/output.txt +++ b/example/output.txt @@ -2,3 +2,5 @@ ── cell 1 (line 14) ── cell 2 (line 19) [8.607374170843807 10.012355742798341 11.179773490450081] +── cell 3 (line 26) + "loc 9.9422, scale 1.9774" diff --git a/hugo.toml b/hugo.toml index 7d07852..aa637e0 100644 --- a/hugo.toml +++ b/hugo.toml @@ -97,10 +97,10 @@ disableKinds = ['taxonomy', 'term', 'rss', 'sitemap', '404'] layer = 2 short = "compiled, reactive notebooks" lib = "notebook" - state = "notebook v0.2.0" + state = "notebook v0.3.0" live = true brand = true - blurb = "A notebook is a Markdown file whose go blocks are cells. The kernel compiles it into a real Go program, orders the cells by what they use, and runs only what changed, keeping values across runs." + blurb = "A notebook is a Markdown file whose go and ruby blocks are cells. The kernel compiles it into a real Go program, orders the cells of both languages by what they use, and runs only what changed, keeping values across runs. Ruby cells run on go-embedded-ruby, with the go-scikit bindings." [[params.orgs]] name = "go-bignum" layer = 1 @@ -278,6 +278,11 @@ disableKinds = ['taxonomy', 'term', 'rss', 'sitemap', '404'] kind = "docs" href = "https://github.com/go-scikit/docs" blurb = "The documentation site (Hugo and Hextra), served at go-scikit.github.io/docs: the member organisations with their landing and docs links, and the status of the parity-plan packages." +[[params.repos]] + name = "ruby" + kind = "bindings" + href = "https://github.com/go-scikit/ruby" + blurb = "Ruby bindings to the stack, for go-embedded-ruby (v0.1.0): Stats, Special, Optimize, Integrate, DataFrame and Plot, each compared with the Go call it wraps, and the runner of a notebook's ruby cells." [[params.repos]] name = "roadmap" kind = "plan" diff --git a/layouts/index.html b/layouts/index.html index 60a3302..3b9710b 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -31,12 +31,12 @@

Science in Go,
{{/* The sheet's .accent paints with --grad, base to deep: on a dark page this logo's dark slate stops would vanish. --accent and --accent-deep are the same two in light and the bright stop in dark. */}}all the way down.

-

go-scikit is the umbrella over {{ len $orgs }} organisations that together cover what a Python notebook reaches for in NumPy, SciPy, pandas and matplotlib: arrays, FFTs, numerical methods, statistics, labelled tables, figures and notebooks, and, on the way to parity with MATLAB and Mathematica, sparse matrices, interpolation, signal processing and arbitrary precision. Pure Go, CGO=0, and each library measured against its reference, with the documents that say where it is slower or less accurate.

+

go-scikit is the umbrella over {{ len $orgs }} organisations that together cover what a Python notebook reaches for in NumPy, SciPy, pandas and matplotlib: arrays, FFTs, numerical methods, statistics, labelled tables, figures and notebooks, and, on the way to parity with MATLAB and Mathematica, sparse matrices, interpolation, signal processing and arbitrary precision. Pure Go, CGO=0, and each library measured against its reference, with the documents that say where it is slower or less accurate. A notebook's cells can be Go or Ruby, one cell reading what the other computed.

-
{{ len $orgs }} organisationsCGO=0 everywhereBSD-3-Clause
+
{{ len $orgs }} organisationsGo and Ruby cellsCGO=0 everywhereBSD-3-Clause
first.md
@@ -114,7 +114,7 @@

Parity with MATLAB and Mathematica, in four waves.

Get started

A first notebook, in four commands.

-

A notebook is a Markdown file; its go blocks are the cells. Put the notebook from the top of this page in first.md, in a module that requires the libraries it imports, and run it. It prints the quartiles of a thousand normal draws from seed 42: the draws SciPy's norm.rvs(10, 2, size=1000, random_state=np.random.default_rng(42)) makes.

+

A notebook is a Markdown file; its go and ruby blocks are the cells. Put the notebook from the top of this page in first.md, in a module that requires the libraries its Go cells import, and run it. It prints the quartiles of a thousand normal draws from seed 42 (the draws SciPy's norm.rvs(10, 2, size=1000, random_state=np.random.default_rng(42)) makes), then fits a normal distribution to the same draws in Ruby.

shell
$ go install github.com/go-notebook/notebook/cmd/notebook@latest
@@ -126,6 +126,7 @@ 

A first notebook, in four commands.

# notebook serve first.md the same, live in the browser, editable

Run it again and every cell is kept: a cell whose code and inputs did not change is not run again, across runs. The go-notebook documentation gives the cell rules; to try the arrays and the transforms without installing anything, the go-ndarray and go-fft playgrounds run them compiled to WebAssembly in the browser, and the go-statistics and go-numerics playgrounds run whole notebooks there: edit the cells, run them, see the figures.

+

A ruby cell runs on go-embedded-ruby, a Ruby written in Go, so the notebook stays one Go program with no Ruby to install. It sees the values the Go cells above it defined (here x, a Go []float64), and the Go cells below it see what it defines; the kernel orders and re-runs cells of both languages by what they use. From Ruby, the stack is reached through go-scikit/ruby, which the kernel adds by itself: Stats, Special, Optimize, Integrate, DataFrame and Plot call the same Go functions, with the same answers. The Ruby cells page gives the rules, and the -timeout and -memory limits that stop a runaway cell.