jupyterlite/demo

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

eliselavy opened this issue · 2 comments

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:

  • use of request library

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

  • use of SSL
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

  • Guidelines to develop notebook for the Pyodide kernel?
  • Do you have already theses feedbacks of migration of existing notebook for Jupyterlite?
  • or should i look at this https://github.com/jupyterlite/repo2jupyterlite to migrate already written notebook?
jtpio commented

Thanks @eliselavy for opening this issue 👍

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: koenvo/pyodide-http#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

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.