通过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一起安装。您可以使用以下命令中的yarn
或npm
来替代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的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 66980cbd7bcea527d6bbe71e34d974a680f21fd30a526f95d83007b2d283e161 |
|
MD5 | 6fce98fdad506d16d60e31e565665082 |
|
BLAKE2b-256 | fe9079ff1c46a8fca195bd8272c4a34715d38dbf41471f42bd99f2242e0814a7 |
jupyterlab_remote_contents-0.1.1-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b5265678849a0e39ae0a78cc3b9b2cf7a440ee5ec60a51c905021202d7526ec2 |
|
MD5 | e375c2297db34cfba24af99136009340 |
|
BLAKE2b-256 | a05a9923952787084ae376fccc310dc1a6b00af04934435840646c3e9c5c7e1f |