跳转到主要内容

JupyterLab的Nebari定制。

项目描述

jupyterlab_nebari_mode

Github Actions Status Binder

JupyterLab的Nebari定制。

插件

  • jupyterlab-nebari-mode:logo: 替换 @jupyterlab/application-extension:logo,添加可点击的Nebari标志:
  • jupyterlab-nebari-mode:commands 添加以下命令
    • nebari:open-proxy 用于打开代理进程,例如VSCode;此命令可以用于添加菜单项,例如
      {
        "command": "nebari:open-proxy",
        "rank": 1,
        "args": {
          "name": "vscode"
        }
      }
      
    • nebari:run-first-enabled 执行第一个可用和启用的命令;它与内置的 apputils:run-first-enabled 命令不同,因为它接受表示命令的对象列表,允许自定义 labeliconClasscaptionusageclassName 属性。用于菜单定制的示例用法是添加一个标签为 在文件编辑器中导入numpy 的菜单项,当用户打开文件编辑器时,以及当用户打开笔记本时添加一个标签为 在笔记本中导入numpy 的菜单项
      {
        "command": "nebari:run-first-enabled",
        "rank": 1,
        "args": {
          "commands": [
            {
              "id": "fileeditor:replace-selection",
              "label": "Import numpy in File Editor",
              "args": { "text": "import numpy as np" }
            },
            {
              "id": "notebook:replace-selection",
              "label": "Import numpy in Notebook",
              "args": { "text": "import numpy as np" }
            }
          ]
        }
      }
      

需求

  • JupyterLab >= 4.0.0

安装

要安装扩展,执行

pip install jupyterlab_nebari_mode

卸载

要删除扩展,执行

pip uninstall jupyterlab_nebari_mode

贡献

开发安装

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

《jlpm》命令是 JupyterLab 集成安装的yarn版本,它是 JupyterLab 的固定版本。您可以使用下面的《yarn》或《npm》代替《jlpm》。

# Clone the repo to your local environment
# Change directory to the jupyterlab_nebari_mode 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_nebari_mode

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

测试扩展

前端测试

此扩展使用Jest进行 JavaScript 代码测试。

要执行它们,请执行

jlpm
jlpm test

集成测试

此扩展使用Playwright进行集成测试(即用户级测试)。更准确地说,JupyterLab 辅助工具Galata用于处理在 JupyterLab 中测试扩展。

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

打包扩展

请参阅RELEASE

项目详情


下载文件

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

源分布

jupyterlab_nebari_mode-0.3.0.tar.gz (194.6 kB 查看哈希)

上传时间

构建分布

jupyterlab_nebari_mode-0.3.0-py3-none-any.whl (18.5 kB 查看哈希)

上传时间 Python 3

支持者

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