jupyterlite / demo

JupyterLite demo deployed to GitHub Pages 🚀
https://jupyterlite.github.io/demo
356 stars 192 forks source link

From myBinder to the use of the GitHub pages: from IPython Kernel to Pyodide #118

Open eliselavy opened 1 year ago

eliselavy commented 1 year ago

Due to the "500 Internal Server Error" of myBinder the last weeks, i look at how to make available the notebooks via GitHub pages with the support of Jupyterlite.

Problem

I notice some problems with the existing notebooks i have:

Many people load their datas like: Loading the EDH dataset from the zenodo url

import requests
url = "https://zenodo.org/record/4888168/files/EDH_text_cleaned_2021-01-21.json"  
r = requests.get(url)
json = r.json()
EDH = pd.DataFrame.from_dict(json)

I see i should look at pyodide.http.FetchResponse

df = pd.read_csv("https://raw.githubusercontent.com/jdh-observer/jdh001-JJszM3GwAYDs/main/namelesscrowd/cooc-multitudo-tac_hyperbase.csv")
df

URLError: <urlopen error unknown url type: https>

By using the Jupyterlite demo template

../jupyterlite-demo/blob/main/.github/workflows/deploy.yml

    uses: actions/setup-python@v4
        with:
          python-version: '3.10'

https://docs.python.org/3/library/ssl.html

This module does not work or is not available on WebAssembly platforms wasm32-emscripten and wasm32-wasi.

Advices

jtpio commented 1 year ago

Thanks @eliselavy for opening this issue :+1:

use of request library

You'll need to use pyodide_http to patch requests: https://jupyterlite.readthedocs.io/en/latest/howto/content/python.html#fetching-remote-content

Although there might be an issue currently: https://github.com/koenvo/pyodide-http/issues/33

use of ssl

Normally it should handle HTTPS fine.

or should i look at this https://github.com/jupyterlite/repo2jupyterlite to migrate already written notebook?

Indeed there is ongoing work to make repo2jupyterlite behave similarly to repo2docker / Binder in terms of functionalities and UX. Some issues that will likely help with this in the short term:

The idea would be to provide a https://lite.binder.org and hopefully remove some load on Binder.

jtpio commented 1 year ago

Do you have already theses feedbacks of migration of existing notebook for Jupyterlite?

Unfortunately it usually depends on a few parameters such as the types of packages, workloads, data size. But for many use cases running Python in the browser will be enough.