最近在从Jupyter Notebook向Jupyter Lab转,倍感舒适。
Lab和Notebook是一家人,前者算后者的升级加强版。
Lab相比较Notebook最大的优势在于它的用户界面集成强,适合多文档协助工作。
而且Lab是可拓展的,插件丰富,非常像vs code,但又完美地继承了Notebook的所有优点。
![](https://img.haomeiwen.com/i13723999/5abe62182906e379.png)
之前写过Lab的介绍文档,这次再来聊聊Lab里那些好用到爆炸的插件。
神器 | JupyterLab,极其强大的下一代notebook!
在Lab中安装插件并不需要pip,直接在界面侧栏就可以搜索你需要的插件。
当然在此之前,你需要设置显示插件栏,因为默认插件栏不显示。
![](https://img.haomeiwen.com/i13723999/1471e31271e2f7f2.png)
点击菜单栏Settings
下拉框中的Advanced Settings Editor
选项,会出现一个设置页面。
![](https://img.haomeiwen.com/i13723999/d03f4d3492502b15.png)
接着,点击Extension Manager
,并且在右边的空白框里填上{'enabled':true}
,并且按右上角的保存按钮。
![](https://img.haomeiwen.com/i13723999/aeb231525bc2dc8e.png)
最后,你会看到Lab右边会出现插件栏的按钮,我已经安装过一些插件。
你可以在搜索栏搜索想要的插件,并直接安装。
![](https://img.haomeiwen.com/i13723999/952a7e7e4523bd97.png)
下面就来介绍15款非常nice的Jupyter Lab插件
1. github
安装这个插件后,JupyterLab左侧会出现一个github栏按钮,你可以在里面搜索github项目,并且打开项目里面的文件,如果是notebook文件,能够直接运行代码。
这个插件非常适合在Lab上学习github项目,方便高效。
https://github.com/jupyterlab/jupyterlab-github
![](https://img.haomeiwen.com/i13723999/6ea60d8307af7b2c.png)
2. toc
这是一个Lab的目录插件,安装后就能很方便地在Lab上展示notebook或者markdown的目录。
目录可以滚动,并且能展示或隐藏子目录。
https://github.com/jupyterlab/jupyterlab-toc
![](https://img.haomeiwen.com/i13723999/7e0464815739e521.gif)
3. LaTeX
支持在线编辑并预览LaTeX文档。
https://github.com/jupyterlab/jupyterlab-latex
![](https://img.haomeiwen.com/i13723999/5a5c37086116f7cc.png)
4. HTML
该插件允许你在Jupyter Lab内部呈现HTML文件,这在打开例如d3可视化效果时非常有用。
https://github.com/mflevine/jupyterlab_html
![](https://img.haomeiwen.com/i13723999/4bc7c8e908ba8a1c.gif)
5. plotly
该插件可以在Lab中展示plotly可视化效果。
https://github.com/jupyterlab/jupyter-renderers
![](https://img.haomeiwen.com/i13723999/5b0a3bb6464655b3.gif)
6. bokeh
该插件可以在Lab中展示bokeh可视化效果。
https://github.com/bokeh/jupyter_bokeh
![](https://img.haomeiwen.com/i13723999/4125b74ce07ff3ce.gif)
7. matplotlib
该插件可以在Lab中启用matplotlib可视化交互功能。
https://github.com/matplotlib/jupyter-matplotlib
![](https://img.haomeiwen.com/i13723999/65be65aa3ce74645.gif)
8. drawio
该插件可以在Lab中启用drawio绘图工具,drawio是一款非常棒的流程图工具。
https://github.com/QuantStack/jupyterlab-drawio
![](https://img.haomeiwen.com/i13723999/16c8cf30196183ae.png)
9. sql
该插件可以在Lab中连接数据库,并进行sql查询和修改操作。
https://github.com/pbugnion/jupyterlab-sql
![](https://img.haomeiwen.com/i13723999/48c5737be146fea8.gif)
10. variableinspector
该插件可以在Lab中展示代码中的变量及其属性,类似RStudio中的变量检查器。你可以一边撸代码,一边看有哪些变量。
https://github.com/lckr/jupyterlab-variableInspector
![](https://img.haomeiwen.com/i13723999/d5dfb7a83456d107.gif)
11. dash
该插件可以在Lab中展示plotly dash交互式面板。
https://awesomeopensource.com/project/plotly/jupyterlab-dash
![](https://img.haomeiwen.com/i13723999/cae99cc680584e1f.gif)
12. gather
在Lab中清理代码,恢复丢失的代码以及比较代码版本的工具。
https://github.com/microsoft/gather
![](https://img.haomeiwen.com/i13723999/217fe9adc74dc172.gif)
13. go to Definition
该插件用于在Lab笔记本和文件编辑器中跳转到变量或函数的定义。
https://github.com/krassowski/jupyterlab-go-to-definition
![](https://img.haomeiwen.com/i13723999/8cb08be5c854917d.gif)
14. lsp
该插件用于自动补全、参数建议、函数文档查询、跳转定义等。
https://github.com/krassowski/jupyterlab-lsp
![](https://img.haomeiwen.com/i13723999/2268a75b0b02f2d7.png)
![](https://img.haomeiwen.com/i13723999/fbf155292691fd1c.png)
![](https://img.haomeiwen.com/i13723999/4b811503dd2ab602.png)
![](https://img.haomeiwen.com/i13723999/5f2c7a079e04f2b8.png)
15. spreadsheet
该插件用于在Lab上显示excel表格,只读模式。
https://github.com/quigleyj97/jupyterlab-spreadsheet
![](https://img.haomeiwen.com/i13723999/9fd61761d87d5309.png)
小结
Jupyter Lab还有很多强大的拓展插件,这里也没办法一一列举。感兴趣的去github找找,提供一个项目供参考。
https://github.com/mauhai/awesome-jupyterlab
还有最近发现了一个宝藏:
A gallery of interesting Jupyter Notebooks
这是一个notebook项目集合,涵盖了天文地理哲学医疗教育等等学科,大大小小几百个项目,当然都是英文的。
关注公众号:pydatas,在后台回复:notebook
,可获得项目链接。
网友评论