可以通过
Extension Tutorial — JupyterLab 3.4.0a0 documentation
此链接进入官网查看教程 的拓展教程
1.安装jupyterlab 一般建议是通过虚拟环境来装 2.安装完成后可以通过命令创建虚拟环境
conda create -n jupyterlab-ext --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=3 cookiecutter nodejs jupyter-packaging git
3.现在激活新环境,以便您运行的所有其他命令都可以在该环境之外运行。
conda activate jupyterlab-ext
4.接下来使用 cookiecutter 为您的扩展创建一个新项目。这将在当前目录中为您的扩展创建一个新文件夹。
cookiecutter https://github.com/jupyterlab/extension-cookiecutter-ts
Select kind: 1 - frontend 2 - server 3 - theme Choose from 1, 2, 3 [1]: 2 author_name []: Your Name author_email []: your@name.org labextension_name [myextension]: jupyterlab_apod python_name [myextension]: jupyterlab_apod project_short_description [A JupyterLab extension.]: Show a random NASA Astronomy Picture of the Day in a JupyterLab panel has_settings [n]: n has_binder [n]: y repository [https://github.com/github_username/myextension]: https://github.com/github_username/jupyterlab_apod
进入项目文件 cd jupyterlab_apod
构建并安装用于开发的扩展¶
您的新扩展项目中有足够的代码可以看到它在您的 JupyterLab 中运行。运行以下命令安装初始项目依赖项并将扩展安装到 JupyterLab 环境中。
pip install -ve .
上面的命令将扩展的前端部分复制到 JupyterLab 中。每次进行更改时,我们都可以再次运行此命令以将更改复制到 JupyterLab。更好的是,我们可以使用该命令创建从 JupyterLab 到源目录的符号链接。这意味着我们的更改会自动在 JupyterLab 中可用:pip install``develop
jupyter labextension develop --overwrite .
此处需要注意的是如果你的一个虚拟环境中拉取了多个项目,想要更换jupyterlab与项目的链接,需要进入待更换项目根目录下执行
jupyter labextension develop --overwrite .
.5选择server 带有服务器的
需要注意的是 server默认是启动不了的 我们想要使用就得打包
在项目文件下使用命令编译
pip install build
在通过以下命令打包
python -m build
安装所打的包,默认在dist文件下
pip install dist/×××.whl
再次编译运行就可以客户端访问服务端了,需要注意的是每一次更改服务端代码都需要重新打包安装
卸载已安装的包通过命令
pip uninstall ××××
最后:jupyterlab是一个支持更改gui外壳的软件,如
我在jupyterlab创建另一个侧边栏选项,打开b站的链接,当然也可以是别的,不止是左右侧边栏,主菜单等都是支持重构的,但是我在jupyterlab的官网没有找到侧边栏重构代码demo所以就自己谢了一个有这个需求的可以联系我交流,附上效果图