| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This folder builds a JupyterLite site that runs a few aima notebooks entirely in the browser via Pyodide — no server, no local install. It is the first concrete step of the "Python web companion" discussed in issue #1072.
When deployed, it lives next to the API docs on GitHub Pages:
Pyodide ships scientific-Python wheels (numpy, scipy, matplotlib, networkx, pandas, …), so the lightweight parts of aima work in the browser. The heavy native dependencies in requirements.txt — TensorFlow/Keras, OpenCV (cv2), cvxopt, qpsolvers — are not available in Pyodide, so notebooks that need them (deep learning, parts of perception, LP-based game theory) cannot run here. The aima wheel is therefore installed with deps=False and the demo notebooks are restricted to modules that import only Pyodide-provided packages.
The companion ships a notebook per Pyodide-compatible module:
content/Welcome.ipynb shows the one-cell install pattern used by every notebook.
Most modules need only numpy; aima.logic/aima.planning need networkx, aima.csp/aima.planning need sortedcontainers (both pure-Python and shipped with Pyodide — preloaded for the kernel in jupyter-lite.json). game_theory.ipynb additionally piplite.install("scipy")s for its linear-program solver.
A few modules stay out of the companion because they need native wheels Pyodide does not provide: deep_learning (TensorFlow/Keras), perception (OpenCV), and the SVM path in learning (cvxopt/qpsolvers).
To make the importable modules load cleanly in the browser, two optional dependencies are now imported lazily rather than at module top level: the ipythonblocks GUI dependency in aima.agents (so logic/csp/planning/... import without it) and qpsolvers in aima.learning (needed only by SVM). The example datasets learning builds at import time are also guarded so the module imports when the aima-data files are absent.
cd lite
./build.sh # builds the aima wheel + runs `jupyter lite build`
python -m http.server -d _output 8000 # then open http://localhost:8000build.sh installs the build toolchain from requirements-lite.txt, builds an aima wheel from the repo root, and bundles it into the JupyterLite site so the notebooks can piplite.install("aima", deps=False) offline.
build.sh proves the static site builds; verify_browser.py proves every notebook actually runs in Pyodide. It serves _output, loads real Pyodide in headless Chromium, installs the freshly-built wheel and executes each notebook's real code cells:
pip install playwright nbformat
python -m playwright install chromium
cd lite && ./build.sh && python verify_browser.pyIt exits non-zero if any notebook errors. All 15 notebooks currently pass.
This is a proof of concept (issue #1072 stays open until it is a complete companion). In-browser execution of all 15 notebooks has been verified with verify_browser.py (headless Chromium + real Pyodide + the deployed wheel). Remaining ideas:
| Back | FazBrowse Home | New Git URL |