跳转到主要内容

通过Jupyter服务器访问远程文件

项目描述

jupyterlab-remote-contents

使用Jupyter内容API浏览远程文件。这是JupyterLab的默认设置,但不是JupyterLite,它使用浏览器的本地存储。此扩展允许访问由Jupyter服务器提供的远程文件。

要求

  • JupyterLab >= 4.0

安装

要安装此扩展,请执行

pip install jupyterlab-remote-contents

卸载

要删除此扩展,请执行

pip uninstall jupyterlab-remote-contents

使用方法

由于远程内容是从不同于客户端的来源获取的,您可能会遇到CORS问题。提供远程内容API的Jupyter服务器必须支持客户端的来源。

例如,如果您使用以下命令启动JupyterLab

jupyter lab --ServerApp.ip='127.0.0.1' --ServerApp.port=8888

那么您必须将 --ServerApp.allow_origin='http://127.0.0.1:8888' 传递给提供内容API的Jupyter服务器

jupyter server --ServerApp.ip='127.0.0.1' --ServerApp.port=8000 --ServerApp.allow_origin='http://127.0.0.1:8888'

在JupyterLab中,点击左侧面板上的列表图标“远程内容(未连接)”,然后点击文件夹图标“连接到Jupyter服务器”。您应该会提示输入Jupyter服务器URL。输入例如 "http://127.0.0.1:8000/?token=87b..."(如果您有token,不要忘记它)。如果您将鼠标悬停在左侧面板上的图标上,现在您应该看到类似 "远程内容在 http://127.0.0.1:8000/"(而不是“未连接”)的内容。

贡献

开发安装

注意:您需要NodeJS来构建扩展包。

《jlpm》命令是JupyterLab中安装的yarn的固定版本,与JupyterLab一起安装。您可以使用以下命令中的yarnnpm来替代jlpm

# Clone the repo to your local environment
# Change directory to the jupyterlab-remote-contents 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-remote-contents

在开发模式下,您还需要删除由jupyter labextension develop命令创建的符号链接。要找到其位置,您可以运行jupyter labextension list以确定labextensions文件夹的位置。然后您可以在该文件夹中删除名为jupyterlab-remote-contents的符号链接。

打包扩展

请参阅RELEASE

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

jupyterlab_remote_contents-0.1.1.tar.gz (52.3 MB 查看哈希值)

上传时间

构建分布

jupyterlab_remote_contents-0.1.1-py3-none-any.whl (30.6 kB 查看哈希值)

上传时间 Python 3

由以下支持