Rock It 《ML》JupyterLab 【丙】延伸其柄

本來談了 Markdown 格子後,應該接著講 Code Cell ,說些 Python 語言學習之事。鑑於 JupyterLab 將是下個世代使用者界面,過去 Jupyter 筆記本可用的『功能擴張』,不知還能不能用乎?故而先行驗證,此處且就談談作者『延伸其柄』之點點滴滴也!

舉例來說『互動小功具』 ipywidgets 如何安裝耶?

sudo jupyter labextension install @jupyter-widgets/jupyterlab-manager

Installing the JupyterLab Extension

To install the JupyterLab extension you also need to run the command below in a terminal which requires that you have nodejs installed.

jupyter labextension install @jupyter-widgets/jupyterlab-manager

This command defaults to installing the latest version of the ipywidgets JupyterLab extension. Depending on the version of JupyterLab you have installed, you may need to install an older version.

Note: A clean reinstall of the JupyterLab extension can be done by first running the jupyter lab clean command which will remove the staging and static directories from the lab directory. The location of the lab directory can be queried by executing the command jupyter lab path in your terminal.

※ 註︰

/ipywidgets

Interactive Widgets for the Jupyter Notebook https://ipywidgets.readthedocs.io

ipywidgets: Interactive HTML Widgets

Version Build Status Documentation Status Join the chat at https://gitter.im/ipython/ipywidgets Binder

ipywidgets are interactive HTML widgets for Jupyter notebooks and the IPython kernel.

Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data.

Learning becomes an immersive, plus fun, experience. Researchers can easily see how changing inputs to a model impact the results. We hope you will add ipywidgets to your notebooks, and we’re here to help you get started.

Core Interactive Widgets

A demonstration notebook provides an overview of the core interactive widgets, including:

  • sliders
  • progress bars
  • text boxes
  • toggle buttons and checkboxes
  • display areas
  • and more

Jupyter Interactive Widgets as a Framework

Besides the widgets already provided with the library, the framework can be extended with custom widget libraries.

A template project is available in the form of a cookie cutter here.

This project is meant to help custom widget authors get started with the packaging and the distribution of Jupyter interactive widgets.

It produces a project for a Jupyter interactive widget library following the current best practices for using interactive widgets. An implementation for a placeholder “Hello World” widget is provided.

Popular widget libraries such as bqplot, pythreejs and ipyleaflet

follow exactly the same template and directory structure. They can serve as more advanced examples of usage of the Jupyter widget infrastructure.

For detailed information, please refer to the ipywidgets documentation.

More advanced examples

Examples of custom widget libraries built upon ipywidgets are

  • bqplot a 2d data visualization library enabling custom user interactions.
  • pythreejs a Jupyter – Three.js wrapper, bringing Three.js to the notebook.
  • ipyleaflet a leaflet widget for Jupyter.
……

Using Interact

The interact function (ipywidgets.interact) automatically creates user interface (UI) controls for exploring code and data interactively. It is the easiest way to get started using IPython’s widgets.

………

 

也藉此發現、知道哪理去找那些『擴張』軟件的哩!

jupyterlab-extension

 

不過玩玩測測增增減減之後

rock64@rock64:~$ jupyter labextension list
JupyterLab v0.35.4
Known labextensions:
   app dir: /usr/local/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v0.38.1  enabled  OK
        @jupyterlab/geojson-extension v0.18.1  enabled  OK
        @jupyterlab/toc v0.6.0  enabled  OK
        jupyterlab-drawio v0.5.0  enabled  OK

 

總覺沒有一個 GUI 的『Extension Manager』怪怪的??

其實 JupyterLab 之 【Settings】‧【 Advanced Settings Editors】裡有一個『未啟動』的陽春型管理者呦!!

 

 

 

只是目前搜尋『所有…』,非得用 空白鍵的勒☺