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

Pyodide notebooks support #3603

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft

Pyodide notebooks support #3603

wants to merge 14 commits into from

Conversation

danyx23
Copy link
Contributor

@danyx23 danyx23 commented May 13, 2024

This PR is only a proof of concept at this stage - it demonstrates using pandas inside pyodide based notebooks on grapher pages - i.e. python and the pandas/numpy stack run entirely in the browser, without any server component. Data is fetched via our file based API just like grapher (the data is fetched again but should be fast due to client side caching).

To play with it, open the staging server at a /grapher/ url and scroll to the bottom.

There are a lot of things that are not ideal about this proof of concept, e.g.:

  • The "library code" that is taken from Lars' recent new pythonic api to access data for grapher charts is copied verbatim into the first cell instead of used from a library
  • The notebook infrastructure we use, starboard, has not been developed further since early 2023 or so. It is thus stuck at pyodide version 0.20. The current version, 0.25, comes with a bunch of nice additions, e.g. transparent support for the requests library
  • If we had access to 0.25 then Lars' pythonic api code could be used verbatim - as is, http requests had to be replaced in the code with pyodide.http.open_url
  • The notebook text is hardcoded in the GrapherPage.tsx file

@owidbot
Copy link
Contributor

owidbot commented May 14, 2024

Quick links (staging server):

Site Admin Wizard

Login: ssh owid@staging-site-wasm-notebooks

SVG tester:

Number of differences (default views): 424 (faf803)
Number of differences (all views): 890 (47426c)

Edited: 2024-05-29 16:05:00 UTC
Execution time: 1.24 seconds

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

Successfully merging this pull request may close these issues.

None yet

2 participants