JupyterLite: unpin the Pyodide kernel (Safari 27 has JSPI), add the unsuitable-browser message, adopt spatialmath-python 1.1.19

オープン
#941 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@petercorke がすでに取り組んでいます。

2026年11月16日 から。

評価

この issue はまだ評価されていません。

説明

bdsim fixed this in https://github.com/petercorke/bdsim/pull/259 (merged 2026-11-16). The three toolboxes should converge on one JupyterLite and CI setup, so this lays out what bdsim found, what it changed, and what is left to do here. See also the notebook smoke-test timeout in https://github.com/petercorke/bdsim/issues/262 if this repo runs notebooks in one pytest test with --timeout.

What broke

After 1.5.0, the bdsim notebooks failed in Safari 27.2: a notebook hung at sim.run, import control failed, and the kernel indicator just spun. Chrome and Firefox were fine. The cause was the pin jupyterlite-pyodide-kernel==0.6.1 (Pyodide 0.27.6). We pinned it because Safari had no WebAssembly JSPI and newer Pyodide needs it. Safari 27 has JSPI (typeof WebAssembly.Suspending is "function"), and the old Pyodide now hangs on it. A kernel 0.8.7 build ran fine on the same Safari 27.2 (normal and private windows), and the old deployed site hung in a private window, so it is the pin and not stale browser state.

Browsers with JSPI: Chrome and Edge, Firefox 153 or later (enabled by default in 153, Firefox 159 tested), Waterfox 6.7.x (it moved to Gecko ESR 153), and Safari 27 or later. Without it: Safari 26 and earlier, Firefox before 153, Waterfox 6.6. So the comment in the workflow, "Safari has none as of 2026-08; Firefox only behind a flag", is now wrong, and so is "revisit this pin across RTB/MVTB/bdsim together" (it is time).

The browser check

A browser without JSPI does not fail with a message: the kernel hangs or never starts and the page shows a spinner. bdsim now adds a script to each built JupyterLite page that shows a banner when WebAssembly.Suspending is missing, naming the browsers that work. It runs on the page, before the kernel, so it works even if the kernel cannot start. Tested on Safari 26, where the banner appears.

  • docs/lite/jspi-check.js is the banner script.
  • docs/lite/inject_jspi_check.py adds it to each built page (lab, notebooks, tree, repl, consoles, edit) and fails the build if it finds no pages.
  • one CI step in docs.yml, after jupyter lite build, and tests/test_lite_jspi_check.py.

A kernel that crashes at startup never reaches a notebook cell, so a check in the shared bootstrap cell alone would not be enough. The page-level check is the primary one.

spatialmath-python 1.1.19

bdsim now requires spatialmath-python>=1.1.19. What it changes for the toolboxes:

  • pre-commit is no longer a runtime dependency (rai-opensource/spatialmath-python#250). That was the reason for JL_NO_DEPS and the deps=False install in the JupyterLite bootstrap.
  • It includes spatialmath.base.environment() and isnotebook(), which know Colab and JupyterLite (#271), so each toolbox can drop its own copy of that check.

For RTB

  • .github/workflows/docs.yml pins jupyterlite-pyodide-kernel==0.6.1, and pyproject.toml has spatialmath-python>=1.1.18. Bump that to >=1.1.19, which closes the cause of #742 and may leave #579 and the deps=False workaround redundant (check).
  • RTB is different from bdsim and MVTB here: it has a compiled extension. The workflow fetches a cp312 wasm wheel to match Pyodide 0.27.6, so the pin also holds the ABI. Kernel 0.8.7 bundles Pyodide 314.0.6 (PYODIDE_VERSION in jupyterlite_pyodide_kernel/constants.py). The new numbering appears to encode Python 3.14, which I have not verified. If so the cp312 wheel will not load, and the wasm wheel has to be rebuilt for the new ABI, or the pure-Python fallback (#627) used. This is the real work for RTB, and it decides whether to unpin to the latest kernel or to an intermediate one.
  • #631 (a dual-build dispatcher for JSPI-capable and legacy browsers) may no longer be needed: with Safari 27 and Firefox 153 the remaining legacy browsers are old, and the banner tells them so. Decide whether to close it.
  • Add the browser check. The existing "Check JupyterLite in a real browser" step can run a notebook against the new kernel before this deploys.
  • Replace the local sys.platform == "emscripten" check with spatialmath.base.isnotebook() if one is still there.

Convergence

Suggested: put the kernel pin policy (a floor, >=0.8.7, with a comment saying why), jspi-check.js, inject_jspi_check.py and the CI step in rvc-ecosystem, synced into each repo the way the notebook bootstrap cell is, so the three do not drift. bdsim has the working copy to start from.

主要言語
C++
スター
3.6k
フォーク
652
平均マージ
1日 23時間
マージ済み PR(30日)
92

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

petercorke/robotics-toolbox-python のほかの issue

petercorke/robotics-toolbox-python の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。