QuantEcon / QuantEcon/QuantEcon.py

WASM: Host a WASM testbed site under the QuantEcon org

Open
#950 2 comments 0 reactions 1 assignee View on GitHub

@mmcky is already working on this.

Since Sep 7, 2026.

enhancement infrastructure
Dominant language
Python
Stars
2.4k
Forks
2.3k
Avg merge
3d 3h
Merged PRs (30d)
3

Description

Proposal: host a WASM testbed site under the QuantEcon org

Motivation

Work on #925 has surfaced two bugs in the emscripten-forge Numba build (the jitted-generator hang, #927; and a crash when saving to the persistent cache), with diagnoses, reproducers, and in one case a monkeypatch-verified fix. We should have our own place to try candidate fixes in a real browser kernel and to check that the affected quantecon functions work, both for these two issues and for whatever comes next in the campaign.

Upstream CI (fork + PR) can build a patched package and run the recipe's own tests in wasm, but only as part of a PR, and it cannot run the end-to-end check with quantecon on the xeus-python/JupyterLite stack that #925 targets. A C-level fix such as the generator alias cannot be tested by monkeypatching a live kernel at all; it needs a rebuilt package running in the browser.

Proposal

A small repo (e.g. QuantEcon/wasm-testbed) publishing a JupyterLite site to GitHub Pages whose environment can include locally patched packages. The result is our own counterpart of https://notebook.link/@anutosh491/numba-ecosystem — a URL that opens an xeus-python notebook in the browser with the smoke notebooks preloaded, nothing to install — except that we choose what goes into the environment, and every deployment corresponds to a commit.

  1. A fork of emscripten-forge/recipes with a branch per candidate fix to recipes_emscripten/numba; build numba for emscripten-wasm32 either locally (pixi run build-emscripten-wasm32-pkg) or via a draft PR on the fork (CI uploads the built .conda as an artifact).
  2. A GitHub Actions workflow that indexes the patched .conda into a static conda channel with rattler-index, builds the site with jupyterlite-xeus from an environment.yml listing that channel first, then emscripten-forge and conda-forge, and deploys to Pages. Swapping the package under test is a one-line change.
  3. Smoke notebooks shipped with the site: the environment-check cell, the per-issue MWEs (currently the five-line generator MWE and the persistent-cache MWE), and the quantecon checks (support_enumeration / vertex_enumeration on small games with known equilibria; simplex_grid under a warm cache), extended as new issues appear.
  4. Results go into #928's table. If we open upstream PRs, the browser evidence comes from here.
Implementation notes
  • Make the patched package win the solve. Listing the custom channel first is not enough: at equal version the solver prefers the higher build number, and the stock package is build 1. Bump build: number in the patched recipe (or pin the build in environment.yml); otherwise the site silently uses stock numba.
  • The channel is only needed at build time. The browser never contacts a channel; jupyter lite build bakes the packages into the site. So a local directory in the CI workspace suffices (channels: - ./channel, with emscripten-wasm32/ and noarch/ subdirs indexed by rattler-index fs channel/). If the xeus build's solver turns out not to accept local paths, the fallback is a quantecon channel on prefix.dev (rattler-build upload prefix), the mechanism emscripten-forge itself uses.
  • Commit the .conda into the repo (channel/emscripten-wasm32/, a few MB) rather than fetching CI artifacts, which expire and need tokens across repos.
  • Prove the patched build is in use. The environment-check cell should print the numba build string, and the ctypes symbol check from #927 (numba_make_generator resolves only under the patch) is the definitive marker.
Notes
  • Patched packages must be built from the recipe so they carry the channel's pins (llvmlite ==0.49.0, numpy 2.4.*); mixing them with stock emscripten-forge packages is then safe.
  • Once a fix lands upstream, the corresponding package is dropped from the channel; with an empty custom channel the site is just the #928 deployment.
  • Nothing runs server-side: the site is static files on Pages.
  • The site's notebooks/?path=smoke_test.ipynb URL deep-links straight into the smoke notebook; that is the link to cite next to results in #928.

Refs: #925, #927, #928

🤖 Generated with Claude Code (Claude Fable 5.1)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.