Skip to content

[Plan/Idea] Supporting WASM based introductory series #143

Open

Description

@kp992

The plan of the project is to enable WASM/JupyterLite support for each of the lectures in https://github.com/QuantEcon/lecture-python-intro.

Success metric

Our main aim and success metric of this project is to maximize the number of WASM backed lectures from lecture-python-intro.

Support

In order to ease the development and track the lectures, I have the following idea.

  1. A python script that can sync and find out lectures from lecture-python-intro which are not compatible with WASM.
  2. A test script will be written for lecture-python-intro CI which will help us when a lecture is successfully made WASM compatible in lecture-python-intro, we mark that lecture has completed in lecture-python-intro and will be included in the testing script. So whenever a new change is introduced in lecture-python-intro series, we ensure that we don't break the WASM compatibility.
  3. A batch update python script which will fetch the lectures from lecture-python-intro series and convert all possible lectures to WASM and update the repository project.lecture-wasm. This script can be ran on weekly basis to pick up changes from the last week and make them live on project.lecture-wasm.

Execution

  1. We will run the first script and pull out the list of lectures and assign it to the RAs. Once the RA has completed the task we mark the lecture as completed, and we include it into the testing scope (script 2).
  2. We will run the third script on weekly basis to make the project changes live on WASM website.

Probable blockers and tackling strategy

There may be a few lectures where we use quantecon or numba. In such lectures, we need to investigate three possibilities:

  1. If there are small changes that doesn't affect the performance by a great margin then modify the existing lecture.
  2. If there are changes that affect the performance by considerable margin then copy and re-write the lecture for wasm series only and keep the existing lecture unchanged. This way we cover the content but compromise performance just for WASM.
  3. If there is no way we can support the WASM backend, mark the lecture as blocked - with documentation of why it is blocked. This will help us find lectures in future to recall and re-visit them if the blocker is fixed. For example, some lecture is using JAX and there is method which is not available in pure python, we are blocked.

@mmcky, @jstac - Please review the plan and please feel free to suggest any changes.

Thank you.

Activity

  1. mmcky commented on Aug 21, 2024

    @mmcky
    Contributor

    thanks so much @kp992 this is looking great. I will review it in detail tomorrow. Thanks for putting this together, it is a big help.

  2. kp992 commented on Dec 8, 2024

    @kp992
    Author

    @mmcky, Upon doing some research and going through the docs of sphinx-thebe, I found this: https://github.com/TeachBooks/template which is similar to our goal. We want to build quantecon notebooks using jupyter-book and build it with sphinx-thebe. Internally, we will use WASM pyodide kernel which is available via use_thebe_lite.

    This is how our notebooks will be rendered https://teachbooks.io/manual/features/live_code.html. And the users will use Live code button to start and run the notebook backed by pyodide.

    Please correct me know if I misunderstood anything.

  3. kp992 commented on Dec 15, 2024

    @kp992
    Author

    Hi @mmcky, I have built a small demo using thebe and uses WASM backend. See the demo cobweb lecture here: https://kp992.github.io/intro-wasm-demo/main/cobweb.html -- Click on Live code button beside github button to launch the server.

    If this is looking great, I can look into adding more lectures and working on fixing the theme (-- using quantecon book theme).

  4. mmcky commented on Feb 11, 2025

    @mmcky
    Contributor

    This project is underway

    The main issues we are facing include fetching data using web api's from a pydiode kernel and slow run times.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions