最近在从Jupyter Notebook向Jupyter Lab转,倍感舒适。 Lab和Notebook是一家人,前者算后者的升级加强版。 Lab相比较Notebook最大的优势在于它的用户界面集成强,适合多文档协助工作。 而且Lab是可拓展的,插件丰富,非常像vs code,但又完美地继承了Notebook的所有优点。
image.png
之前写过Lab的介绍文档,这次再来聊聊Lab里那些好用到爆炸的插件神器 | JupyterLab,极其强大的下一代notebook!
在Lab中安装插件并不需要pip,直接在界面侧栏就可以搜索插件。
当然在此之前,你需要设置显示插件栏,因为默认插件栏不显示。
image.png
默认无插件栏
点击菜单栏Settings下拉框中的Advanced Settings Editor选项,会出现一个设置页面。
image.png
设置
接着,点击Extension Manager,并且在右边的空白框里填上{‘enabled’:true},并且按右上角的保存按钮。
image.png
设置显示插件栏
最后,你会看到Lab右边会出现插件栏的按钮,我已经安装过一些插件。 你可以在搜索栏搜索想要的插件,并直接安装。
image.png

下面就来介绍15款非常nice的Jupyter Lab插件

1. github

安装这个插件后,JupyterLab左侧会出现一个github栏按钮,你可以在里面搜索github项目,并且打开项目里面的文件,如果是notebook文件,能够直接运行代码。 这个插件非常适合在Lab上学习github项目,方便高效。
https://github.com/jupyterlab/jupyterlab-github
image.png

2. toc

这是一个Lab的目录插件,安装后就能很方便地在Lab上展示notebook或者markdown的目录。 目录可以滚动,并且能展示或隐藏子目录。
https://github.com/jupyterlab/jupyterlab-toc
Jupyter Lab插件 - 图7

3. LaTeX

支持在线编辑并预览LaTeX文档。
https://github.com/jupyterlab/jupyterlab-latex
image.png

4. HTML

该插件允许你在Jupyter Lab内部呈现HTML文件,这在打开例如d3可视化效果时非常有用。
https://github.com/mflevine/jupyterlab_html
Jupyter Lab插件 - 图9

5. plotly

该插件可以在Lab中展示plotly可视化效果。
https://github.com/jupyterlab/jupyter-renderers
Jupyter Lab插件 - 图10

6. bokeh

该插件可以在Lab中展示bokeh可视化效果。
https://github.com/bokeh/jupyter_bokeh
Jupyter Lab插件 - 图11

7. matplotlib

该插件可以在Lab中启用matplotlib可视化交互功能。
https://github.com/matplotlib/jupyter-matplotlib
Jupyter Lab插件 - 图12

8. drawio

该插件可以在Lab中启用drawio绘图工具,drawio是一款非常棒的流程图工具。
https://github.com/QuantStack/jupyterlab-drawio
image.png

9. sql

该插件可以在Lab中连接数据库,并进行sql查询和修改操作。
https://github.com/pbugnion/jupyterlab-sql
Jupyter Lab插件 - 图14

10. variableinspector

该插件可以在Lab中展示代码中的变量及其属性,类似RStudio中的变量检查器。你可以一边撸代码,一边看有哪些变量。
https://github.com/lckr/jupyterlab-variableInspector
Jupyter Lab插件 - 图15

11. dash

该插件可以在Lab中展示plotly dash交互式面板。
https://awesomeopensource.com/project/plotly/jupyterlab-dash
Jupyter Lab插件 - 图16

12. gather

在Lab中清理代码,恢复丢失的代码以及比较代码版本的工具。
https://github.com/microsoft/gather
Jupyter Lab插件 - 图17

13. go to Definition

该插件用于在Lab笔记本和文件编辑器中跳转到变量或函数的定义。
https://github.com/krassowski/jupyterlab-go-to-definition
Jupyter Lab插件 - 图18

14. lsp

该插件用于自动补全、参数建议、函数文档查询、跳转定义等。
https://github.com/krassowski/jupyterlab-lsp
image.png
image.png
image.png
image.png

15. spreadsheet

该插件用于在Lab上显示excel表格,只读模式。
https://github.com/quigleyj97/jupyterlab-spreadsheet
image.png

小结

Jupyter Lab还有很多强大的拓展插件,这里也没办法一一列举。
感兴趣的去github找找,提供一个项目供参考。
https://github.com/mauhai/awesome-jupyterlab 还有最近发现了一个宝藏:
A gallery of interesting Jupyter Notebooks 这是一个notebook项目集合,涵盖了天文地理哲学医疗教育等等学科,大大小小几百个项目,当然都是英文的。
Jupyter Lab插件 - 图24

安装部署教程:https://blog.csdn.net/abc13526222160/article/details/108628640