JupyterLab 扩展,用于通过URL参数打开文件
项目描述
jupyterlab-open-url-parameter
JupyterLab 扩展,用于通过URL参数打开文件。
需求
- JupyterLab >= 4.0
安装
要安装扩展,请运行以下命令
pip install jupyterlab-open-url-parameter
使用方法
该扩展将打开通过URL参数传递的文件。URL参数是 fromURL
。可以通过 fromURL
参数传递多个文件。文件将按传递的顺序打开。
例如,如果您想打开一个笔记本和一个csv文件
- https://raw.githubusercontent.com/jupyterlab/jupyterlab-demo/master/notebooks/Lorenz.ipynb
- https://raw.githubusercontent.com/jupyterlab/jupyterlab-demo/master/data/iris.csv
您可以将以下内容追加到 JupyterLab 实例的 URL 中:?fromURL=https://raw.githubusercontent.com/jupyterlab/jupyterlab-demo/master/notebooks/Lorenz.ipynb&fromURL=https://raw.githubusercontent.com/jupyterlab/jupyterlab-demo/master/data/iris.csv
当 JupyterLab 在本地运行时,将得到以下 URL
https://user-images.githubusercontent.com/591645/230422671-c12761e9-9b9f-4d23-ab66-344568c6b0a5.mp4
ℹ️ 此扩展使用 JupyterLab 默认提供的 filebrowser:open-url
命令。
在 JupyterLite 中使用扩展
此扩展也可以在 JupyterLite 中使用。查看文档了解如何将扩展添加到 JupyterLite 的更多信息。
https://user-images.githubusercontent.com/591645/230426591-04b5155d-3297-4401-b979-d86561188c17.mp4
卸载
要删除扩展,请运行以下命令
pip uninstall jupyterlab-open-url-parameter
贡献
开发安装
注意:您需要 NodeJS 来构建扩展包。
jlpm
命令是 JupyterLab 预装版本的 yarn,与 JupyterLab 一起安装。您可以使用 yarn
或 npm
代替下面的 jlpm
。
# Clone the repo to your local environment
# Change directory to the jupyterlab_open_url_parameter directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build
您可以在不同的终端中同时监视源目录并运行 JupyterLab,以监视扩展源的变化并自动重新构建扩展。
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
在运行监视命令的情况下,每次保存的更改都将立即在本地构建并可供您正在运行的 JupyterLab 使用。刷新 JupyterLab 以在浏览器中加载更改(您可能需要等待几秒钟以重新构建扩展)。
默认情况下,jlpm build
命令为此扩展生成源映射,以便更容易使用浏览器开发工具进行调试。要为 JupyterLab 核心扩展也生成源映射,可以运行以下命令
jupyter lab build --minimize=False
开发卸载
pip uninstall jupyterlab-open-url-parameter
在开发模式下,您还需要删除由 jupyter labextension develop
命令创建的符号链接。要找到其位置,您可以运行 jupyter labextension list
以确定 labextensions
文件夹的位置。然后您可以在该文件夹中删除名为 jupyterlab-open-url-parameter
的符号链接。
打包扩展
参见 RELEASE
项目详情
jupyterlab_open_url_parameter-0.3.0.tar.gz 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 30d85150a7dd2189f2807dd6c978746ecb3adcca11757c9130def129e77778af |
|
MD5 | ba8332178efe90f5790d3061c79da5a1 |
|
BLAKE2b-256 | 908a6865607a6d18f63bf58c09db267e3c8b9c924ffcb4b18c79a5b19c1bded8 |
哈希值 for jupyterlab_open_url_parameter-0.3.0-py3-none-any.whl
算法 | 散列摘要 | |
---|---|---|
SHA256 | 5c294da40f269e03e0fb4b6febad511e241f1619a1d294af3922129c64398344 |
|
MD5 | 6283135a98a22774bd55502a913e277d |
|
BLAKE2b-256 | 2e87fc3746f88e9c5fca8312683551b2415540629602dd25d236c69b48be722e |