From c97edc63d6eff0e3ecfd822fefb595edb866f02f Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Thu, 5 Nov 2026 10:34:36 +0000 Subject: [PATCH 1/2] Say that the JAX cells expect no JAX in the browser. The two cells that contrast Clad with a tracer print "JAX not installed" when the import fails, which every reader of the browser site sees, since no JAX exists on wasm32, and which reads like a broken setup rather than the point being made. Word the fallback as the expected case ("No JAX here, as expected in the browser: ..."), keep the stored outputs in step, and say the same in the prose above the first cell. The CI comparison is unaffected: it checks the executed output against the stored one. --- cppjit/2_transform_it.ipynb | 6 +++--- cppjit/3_fit_it.ipynb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cppjit/2_transform_it.ipynb b/cppjit/2_transform_it.ipynb index a6c0532..128fd59 100644 --- a/cppjit/2_transform_it.ipynb +++ b/cppjit/2_transform_it.ipynb @@ -55,7 +55,7 @@ "source": [ "## Why the tracer cannot do it\n", "\n", - "Try the usual thing. If JAX is installed, `jax.grad` fails on the compiled call: it sees an opaque Python callable, not a traceable computation. (Skip this cell if JAX is not installed.)" + "Try the usual thing. If JAX is installed, `jax.grad` fails on the compiled call: it sees an opaque Python callable, not a traceable computation. (Without JAX, as in the browser, the cell only says so.)" ] }, { @@ -75,7 +75,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "JAX not installed; the point stands: a tracer needs the law rewritten in its own language\n" + "No JAX here, as expected in the browser: a tracer needs the law rewritten in its own language\n" ] } ], @@ -89,7 +89,7 @@ " except Exception as e:\n", " print(\"JAX on the C++ as written:\", type(e).__name__, \"-- the tracer cannot enter a compiled function; it has no graph to differentiate\")\n", "except ImportError:\n", - " print(\"JAX not installed; the point stands: a tracer needs the law rewritten in its own language\")" + " print(\"No JAX here, as expected in the browser: a tracer needs the law rewritten in its own language\")" ] }, { diff --git a/cppjit/3_fit_it.ipynb b/cppjit/3_fit_it.ipynb index b40d3b6..5f11af8 100644 --- a/cppjit/3_fit_it.ipynb +++ b/cppjit/3_fit_it.ipynb @@ -251,7 +251,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "jax / optimistix not installed: skipped\n" + "No JAX or Optimistix here, as expected in the browser: the SciPy fit above is the comparison\n" ] } ], @@ -265,7 +265,7 @@ " sol = optx.minimise(lambda p, a: loss_jax(p), optx.BFGS(rtol=1e-10, atol=1e-12), jnp.asarray(p0), max_steps=200, throw=False)\n", " print(\"JAX/optimistix:\", np.asarray(sol.value), \"in\", int(sol.stats[\"num_steps\"]), \"steps\")\n", "except ImportError:\n", - " print(\"jax / optimistix not installed: skipped\")" + " print(\"No JAX or Optimistix here, as expected in the browser: the SciPy fit above is the comparison\")" ] }, { From 28e553532f9086b78112ab57e3403b2123c2318e Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Thu, 5 Nov 2026 11:38:05 +0000 Subject: [PATCH 2/2] Ship matplotlib's mathtext and monospace fonts. The empack excludes dropped DejaVu Sans Display, DejaVu Sans Mono, STIX and the Computer Modern fonts. matplotlib's default rcParams ask for them, so every figure in notebooks 4 and 5 logged a findfont fallback per missing font. Only the serif family stays out; the lazy matplotlib tarball grows from 4.4 to 5.9 MB. The build notes also record the traffic measured on the public site. --- lite/README-build.md | 6 ++++-- lite/empack_config.yaml | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lite/README-build.md b/lite/README-build.md index 2063801..ee00d9b 100644 --- a/lite/README-build.md +++ b/lite/README-build.md @@ -167,8 +167,10 @@ LTO). `tools/build-wasm-kernel.sh` takes that install through `LLVM_WASM_DIR`, a carries that kernel (the -Oz + LTO build of 2026-11-04, verified twice in the browser on the smoke cells and the five notebooks). `build-kernel.yml` still builds against the conda package: until the LLVM install is published as a cell or release asset it can download, a rerun of that workflow proposes the larger kernel's digest. With the smaller kernel the -wire figures in the table above drop by 8.2 MB (the module's gzip size, 32.5 to 24.3 MB): about 41.6 MB for the first -notebook, 61.6 MB with SciPy and matplotlib loaded; to be re-measured on the public site. +wire figures in the table above drop by about 8 MB. Measured on the public site on 2026-11-05 with an empty cache: 42.0 MB +for the first notebook (28.0 MB of it the kernel), 72.0 MB for notebook 4 when the run is faster than the background +download and SciPy is fetched twice, about 62 MB at reading pace. Shipping matplotlib's mathtext and monospace fonts +(to silence the findfont warnings) adds 1.5 MB to its lazy tarball. The preloaded filesystem (`xcpp.data`) left out what a notebook kernel never includes (the sysroot's SDL, GL, X11 and sanitizer headers, the other architectures' intrinsics in clang's resource directory, `pydoc_data`): 46.5 to 27.5 MB raw, diff --git a/lite/empack_config.yaml b/lite/empack_config.yaml index ef09854..703adc2 100644 --- a/lite/empack_config.yaml +++ b/lite/empack_config.yaml @@ -112,11 +112,10 @@ packages: pattern: share/cmake/** - &id021 pattern: '**/*.pc' + # matplotlib's default mathtext set asks for DejaVu Sans Display, the STIX and the Computer Modern fonts, and the + # monospace family for DejaVu Sans Mono: without them every figure logs a findfont fallback per font. Only the serif + # family stays out (the notebooks never ask for it). - pattern: '**/mpl-data/fonts/ttf/DejaVuSerif*' - - pattern: '**/mpl-data/fonts/ttf/DejaVuSansMono*' - - pattern: '**/mpl-data/fonts/ttf/DejaVuSansDisplay*' - - pattern: '**/mpl-data/fonts/ttf/STIX*' - - pattern: '**/mpl-data/fonts/ttf/cm*.ttf' - pattern: '**/mpl-data/fonts/afm/**' - pattern: '**/mpl-data/fonts/pdfcorefonts/**' - pattern: '**/mpl-data/sample_data/**'