Data Science: JupyterLite runs on WebAssembly and does not require a backend

Data Science: JupyterLite runs on WebAssembly and does not require a backend

The Project Jupyter team has released JupyterLite, a distribution of JupyterLab that runs independently in the browser. The basis for executing Python code is Pyodide, which in turn is based on WebAssembly. In addition to Python, other kernels for other programming languages ​​can be connected.

Obviously the idea has existed for some time: The post in the Jupyter blog describes the project as a reboot of numerous attempts to create a static Jupyter distribution. JupyterLite runs completely independently in the browser and does not need a connection to a Python Jupyter server. Since it uses numerous JupyterLab plug-ins and components, the team can easily add additions and improvements to JupyterLite. The scope of delivery includes the formerly called JupyterLab Classic Interface RetroLab.

JupyterLite comes with Pyolite as the Python kernel, which in turn is based on the Python stack Pyodide. Mozilla first presented the latter two years ago and converted it into an independent project in the spring of this year. It offers a Python interpreter for CPython 3.8 and works naturally with numerous Python libraries such as NumPy, Pandas, SciPy and Matplotlib. Under the hood is pyodide on WebAssembly.

The interpreter provides a conversion of objects between JavaScript and Python types. Mozilla originally published Iodide, a tool based on Jupyter Notebooks, which essentially relies on Pyodide. However, the developers discontinued the tool in autumn 2020.

On ReadTheDocs JupyterLite can be tried out as an independent application in the browser.

(Image: Jupiter)

The Python kernel Pyolite used in JupyterLite is based on Pyodide and is integrated as a web worker. In this way, complex calculations are outsourced to a background thread so as not to block the web application. Pyolite also uses the command line interpreter IPython for auto-completion, among other things.

JupyterLite comes with some visualization libraries like Altair and Plotly, which create graphics and plots interactively. Many Jupyter widgets – both from Jupyter and from third-party providers – can also be used. The custom messages system used for this communicates directly with the Pyolite kernel instead of the usual Jupyter backend.

Data scientists can use visualization libraries like Plotly in JupyterLite.

(Image: Jupiter)

To integrate its own extensions, JupyterLite relies on the extension system introduced in Jupyter 3.0 at the beginning of the year. Many JupyterLab extensions should also be able to be used in the static variant in this way.

Basically, JupyterLite has a modular structure and relies on a plug-in approach. This allows developers to exchange individual modules or add plug-ins for special requirements. You can also exchange the kernel and, for example, switch to the Set the Basthon kernelwhich is implemented as a web worker in the UI thread. Long-term calculations can potentially block the surface, but Basthon offers direct access to the DOM (Document Object Model) of the application from Python.

Even if the Pyolite kernel is implemented in Python, kernels can be used for other programming languages. At the start, JupyterLite brings a JavaScript and a p5 kernel With. There is currently no information about Julia and R. Together with Python, the two are programming languages one of three reasons for the name Jupyter.

The plug-in system allows individual components to be exchanged or supplemented.

(Image: Jupiter)

More details about JupyterLite can be found on the Jupyter blog remove. The article offers, among other things, information on installation. On GitHub can also be found an interactive demo that can be used directly in the browser.


(rme)

Article Source