WASM: JupyterLite environment config and browser smoke suite - #938
Conversation
mmcky
left a comment
There was a problem hiding this comment.
Nice scoping on the smoke suite — one test per Numba feature class, matching #928's checklist exactly, and the native job mirrors ci.yml's conventions cleanly. All 16 tests passing natively is confirmed by the green native check.
Requesting changes on the CI wiring, which is currently red in three independent ways (details inline):
ci_np2.ymlruns barepytestfrom the repo root and now fails collectingci/wasm/test_jupyterlite.py— needstestpaths = quanteconin pytest.ini.- The Emscripten job hung at the Playwright browser install for the full 6-hour job limit — drop
--with-depsand addtimeout-minutes:to both jobs. --timeout=660needspytest-timeout, which isn't installed.- The wasm job lacks
needs: native, so the fast gate doesn't actually gate.
Also worth noting: since quantecon isn't packaged on emscripten-forge-4x, the wasm job installs the released conda-forge noarch package — it tests the stack, not this repo's source. That's exactly what Phase 0 needs, but it argues for schedule/workflow_dispatch triggers rather than every PR, and it means the Playwright helpers in test_jupyterlite.py have never actually executed — I've flagged a few likely flakes inline.
On scope: the workflow itself is really #933's deliverable, and #928's remaining deliverable is the results table in the issue — which can't be filled in until the wasm job completes once. Two options: split the wasm job into a follow-up PR under #933 and merge the environment + suite + native gate now, or keep it together and switch "Closes #928" to "Part of #928" until the results are recorded. Happy either way.
Bare pytest from the repo root (as run by ci_np2.yml) died collecting ci/wasm/test_jupyterlite.py because playwright is not installed in the test environments. testpaths keeps bare pytest collecting exactly the package tests as before; ci/wasm stays opt-in via an explicit path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The wasm job exercises the released conda-forge package (quantecon is not on emscripten-forge-4x), so it cannot gate PR source and needs its own red/green iteration; it will be developed in a follow-up PR under issue QuantEcon#933 with the review fixes applied (drop --with-deps, add pytest-timeout, needs: native, no _site cache). The native gate stays on every PR and gets timeout-minutes so a hang cannot burn the 6-hour job limit again (the last run's Playwright browser install hung for the full limit). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Each cell is wrapped in try/finally printing a unique token and _run waits for that token in the output area. This removes the fragile kernel-status selector, the stale-idle race (the indicator may not have flipped to busy yet), and the traceback-prone substring assertions -- tests now assert on unique uppercase sentinels. insert_text replaces keyboard.type so multi-line cells are not mangled by the console's run-on-Enter binding and auto-indent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Nothing ships smoke_test.py into the JupyterLite site yet, so pytest in the kernel env and the in-kernel run described by the docstring are deferred to the QuantEcon#933 wiring. The IS_EMSCRIPTEN/xfail branches stay: inert natively, they document the expected Emscripten behaviour. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks @kp992 — really nice scoping on the suite itself: every API call checks out and the native run is green, so all the changes below are CI wiring, not test content. Per the review I've pushed the fixes directly to your branch (hope that's OK!):
PR body updated to "Part of #928" since the results table there can only be filled after the first successful WASM run. |
|
Thanks @mmcky for pushing the fixes. This looks a good start to me. Please feel free to update or merge this. I will move to the next item in the TODO list. |
|
Thanks @kp992 for the quick turnaround! Nothing further to apply on top of a18c110…1e0c598 — CI is fully green (the numba-rc Follow-ups queued after merge: the #933 PR seeds from the runner job parked there, and the first green WASM run supplies the results table for #928. Enjoy the next TODO item! |
|
@mmcky Yes; now the blocker is not LAPACK, but the jitted generator issue (#927 (comment)). |
Part of #928 and #925 Phase 0.
Adds under
ci/wasm/:environment.yml— xeus-python kernel config for a minimal JupyterLite deployment (emscripten-forge + conda-forge channels). Seed for the CI job in WASM: add a WebAssembly/JupyterLite smoke-test job to CI #933.smoke_test.py— pytest suite covering every Numba feature class in the library: lazy@njit, NRT-allocated arrays, parallelguvectorize(cpu fallback), eagerguvectorize,nelder_mead/brent_max/newton,lemke_howson,vertex_enumeration(numba.typed.Dict), barenp.linalg.solvein@njit(isolates the_LAPACKmechanism from WASM: verify _numba_linalg_solve (numba.np.linalg._LAPACK) in the browser; add fallback solver if needed #927),support_enumeration(end-to-end WASM: verify _numba_linalg_solve (numba.np.linalg._LAPACK) in the browser; add fallback solver if needed #927 test),gini_coefficient(markedxfailon Emscripten per WASM: remove @njit(parallel=True) from gini_coefficient via an O(n log n) rewrite #926),simplex_grid(feeds WASM: audit 32-bit intp behaviour on wasm32 (overflow guards, simplex_index wrapping, dtypes) #929), and theobjmodeshim insearchsorted.test_jupyterlite.py— Playwright harness that drives the suite's key items inside a locally-built JupyterLite site. Manual for now; the CI job that builds the site and runs it lands with WASM: add a WebAssembly/JupyterLite smoke-test job to CI #933.Plus a native CI gate (
ci_wasm_smoke.yml) that runs the suite against this repo's source on every PR, andtestpaths = quanteconinpytest.iniso barepytestkeeps collecting only the package tests.All 16 tests pass natively (Python 3.11, Numba 0.61).
Maintainer edit (2026-08-19): scoped per review — the Emscripten/JupyterLite runner job moved out to a follow-up PR under #933 (it exercises the released conda-forge package rather than this PR's source, and needs its own red/green iteration; the salvaged job with review fixes applied is parked in #933). This PR now references #928 as Part-of, since the results table there can only be filled after the first successful WASM run.