跳转到主要内容

一个JupyterLab扩展,用于创建、下载和提取归档文件。

项目描述

jupyter-archive

Extension status Github Actions Status Binder Version PyPI Conda (channel only)

一个Jupyter扩展,用于创建、下载和提取归档文件。

功能

  • 将选定的或当前文件夹作为归档下载。
  • 支持的格式:'zip', 'tar.gz', 'tar.bz2' 和 'tar.xz'。
  • 归档和下载对Jupyter不会造成阻塞。UI仍然可以使用。
  • 归档格式可以在JLab设置中设置。
  • 或者,您可以在文件浏览器菜单中选择格式(格式设置需要设置为 null)。
  • 直接在文件浏览器中解压归档。
  • 笔记本客户端扩展不可用。 欢迎贡献

jupyter-archive in action

配置

服务器扩展有一些配置设置 -- 下面的值是默认值

{
  JupyterArchive: {
    stream_max_buffer_size: 104857600, // The max size of tornado IOStream buffer
    handler_max_buffer_length: 10240, // The max length of chunks in tornado RequestHandler
    archive_download_flush_delay: 100 // The delay in ms at which we send the chunk of data to the client.
  }
}

您还可以使用以下环境变量设置新值

  • JA_IOSTREAM_MAX_BUFFER_SIZE
  • JA_HANDLER_MAX_BUFFER_LENGTH
  • JA_ARCHIVE_DOWNLOAD_FLUSH_DELAY

要求

  • JupyterLab >= 3.0 或 Notebook >= 7.0

对于 JupyterLab 2.x,请查看这里

安装

要安装扩展,请执行

pip install jupyter-archive

或者

conda install -c conda-forge jupyter-archive

卸载

要删除扩展,请执行

pip uninstall jupyter-archive

或者

conda remove jupyter-archive

故障排除

如果您看到了前端扩展,但它没有工作,请检查服务器扩展是否已启用

jupyter server extension list

如果服务器扩展已安装和启用,但您看不到前端扩展,请检查前端扩展是否已安装

jupyter labextension list

贡献

开发安装

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

jlpm 命令是 JupyterLab 随附的 yarn 固定版本。您可以使用 yarnnpm 替代 jlpm

# Clone the repo to your local environment
# Change directory to the jupyter-archive directory
# Install package in development mode
pip install -e ".[test]"
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable jupyter_archive
# 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

许可证

BSD 许可证。请参阅LICENSE

作者

开发卸载

# Server extension must be manually disabled in develop mode
jupyter server extension disable jupyter_archive
pip uninstall jupyter-archive

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

测试扩展

服务器测试

此扩展使用 Pytest 对 Python 代码进行测试。

安装测试依赖项(仅需要安装一次)

pip install -e ".[test]"
# Each time you install the Python package, you need to restore the front-end extension link
jupyter labextension develop . --overwrite

要执行它们,请运行

pytest -vv -r ap --cov jupyter_archive

集成测试

此扩展使用 Playwright 进行集成测试(也称为用户级测试)。更确切地说,JupyterLab 助手 Galata 用于处理在 JupyterLab 中测试扩展。

更多详细信息请参阅 ui-tests 的 README。

打包扩展

请参阅 RELEASE

项目详情


下载文件

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

源分发

jupyter_archive-3.4.0.tar.gz (374.4 kB 查看哈希值)

上传时间

构建分发

jupyter_archive-3.4.0-py3-none-any.whl (28.0 kB 查看哈希值)

上传时间 Python 3

支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面