Skip to content

WASM: JupyterLite environment config and browser smoke suite - #938

Open
kp992 wants to merge 9 commits into
QuantEcon:mainfrom
kp992:wasm-phase0-smoke-suite
Open

WASM: JupyterLite environment config and browser smoke suite#938
kp992 wants to merge 9 commits into
QuantEcon:mainfrom
kp992:wasm-phase0-smoke-suite

Conversation

@kp992

@kp992 kp992 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Part of #928 and #925 Phase 0.

Adds under ci/wasm/:

Plus a native CI gate (ci_wasm_smoke.yml) that runs the suite against this repo's source on every PR, and testpaths = quantecon in pytest.ini so bare pytest keeps 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.

@coveralls

coveralls commented Aug 15, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 90.78%. remained the same — kp992:wasm-phase0-smoke-suite into QuantEcon:main

@mmcky mmcky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

  1. ci_np2.yml runs bare pytest from the repo root and now fails collecting ci/wasm/test_jupyterlite.py — needs testpaths = quantecon in pytest.ini.
  2. The Emscripten job hung at the Playwright browser install for the full 6-hour job limit — drop --with-deps and add timeout-minutes: to both jobs.
  3. --timeout=660 needs pytest-timeout, which isn't installed.
  4. 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.

Comment thread .github/workflows/ci_wasm_smoke.yml Outdated
Comment thread .github/workflows/ci_wasm_smoke.yml Outdated
Comment thread .github/workflows/ci_wasm_smoke.yml Outdated
Comment thread .github/workflows/ci_wasm_smoke.yml Outdated
Comment thread ci/wasm/environment.yml
Comment thread ci/wasm/environment.yml Outdated
Comment thread ci/wasm/test_jupyterlite.py
Comment thread ci/wasm/test_jupyterlite.py Outdated
Comment thread ci/wasm/test_jupyterlite.py Outdated
Comment thread ci/wasm/test_jupyterlite.py Outdated
mmcky and others added 4 commits August 19, 2026 10:11
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>
@mmcky

mmcky commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

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!):

  • a18c110testpaths = quantecon in pytest.ini, which un-breaks the numba-rc workflow's bare pytest (it was dying collecting test_jupyterlite.py without playwright). Bare pytest collects exactly what it did before this PR; pytest ci/wasm/smoke_test.py still works.
  • 3baf546 — the Emscripten/JupyterLite job is split out to a follow-up PR under WASM: add a WebAssembly/JupyterLite smoke-test job to CI #933: it tests the released conda-forge package rather than this PR's source, and its first run hung at the Playwright browser install for the full 6-hour limit, so it needs its own red/green iteration without holding this PR hostage. The job — with the review fixes folded in — is parked in WASM: add a WebAssembly/JupyterLite smoke-test job to CI #933 ready to pick up. The native gate stays on every PR and now has timeout-minutes: 30.
  • 564dc8dtest_jupyterlite.py stays here, reworked to be sentinel-driven: each cell is wrapped in try/finally printing a unique token and _run waits for that token in the output area. This removes the kernel-status selector, the stale-idle race, and the traceback-prone substring assertions in one stroke, and switches to insert_text so multi-line cells aren't mangled by the console's run-on-Enter binding.
  • 1e0c598 — dropped the unused pytest from the kernel env and softened the smoke_test docstring (in-kernel pytest execution is WASM: add a WebAssembly/JupyterLite smoke-test job to CI #933 wiring).

PR body updated to "Part of #928" since the results table there can only be filled after the first successful WASM run.

@kp992

kp992 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

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.

@mmcky

mmcky commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Thanks @kp992 for the quick turnaround! Nothing further to apply on top of a18c110…1e0c598 — CI is fully green (the numba-rc tests job is back to passing, and the native smoke gate runs in about a minute), so this is ready to merge once I refresh my review.

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

mmcky commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@oyamad are you happy for us to work through the WASM work package and make staged updates. I have documented the plan in #941 re: interaction with releases. I have gated checks to make sure any merges don't hold up any release milestones.

@oyamad

oyamad commented Aug 19, 2026

Copy link
Copy Markdown
Member

@mmcky Yes; now the blocker is not LAPACK, but the jitted generator issue (#927 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants