跳转到主要内容

JupyterLab 扩展,用于通过URL参数打开文件

项目描述

jupyterlab-open-url-parameter

Extension status Github Actions Status JupyterLite Binder

JupyterLab 扩展,用于通过URL参数打开文件。

需求

  • JupyterLab >= 4.0

安装

要安装扩展,请运行以下命令

pip install jupyterlab-open-url-parameter

使用方法

该扩展将打开通过URL参数传递的文件。URL参数是 fromURL。可以通过 fromURL 参数传递多个文件。文件将按传递的顺序打开。

例如,如果您想打开一个笔记本和一个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

http://localhost:8888/lab?fromURL=https://raw.githubusercontent.com/jupyterlab/jupyterlab-demo/master/data/iris.csv&fromURL=https://raw.githubusercontent.com/jupyterlab/jupyterlab-demo/master/notebooks/Lorenz.ipynb

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 一起安装。您可以使用 yarnnpm 代替下面的 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 (85.9 kB 查看散列)

上传

构建分布

jupyterlab_open_url_parameter-0.3.0-py3-none-any.whl (16.8 kB 查看散列)

上传 Python 3