Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kp992 opened this issue Aug 17, 2024 · 3 comments
Open

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

kp992 opened this issue Aug 17, 2024 · 3 comments

Comments

@kp992
Copy link

kp992 commented Aug 17, 2024

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.

@mmcky
Copy link

mmcky commented Aug 21, 2024

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.

@kp992
Copy link
Author

kp992 commented Dec 8, 2024

@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.

@kp992
Copy link
Author

kp992 commented Dec 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants