跳转到主要内容

从JupyterLab内部提交ballet模块

项目描述

Github Actions Status PyPI Shield npm version

ballet-submit-labextension

从JupyterLab内部提交ballet模块

此扩展由一个名为 ballet-submit-labextension 的Python包组成,用于服务器扩展,以及一个同名(ballet-submit-labextension)的NPM包,用于前端扩展。

需求

  • JupyterLab >= 2.0

安装

可以使用 pip 完全安装,它安装服务器和前端扩展。前端扩展只能使用 jupyter labextension install 安装,但如果没有相应的服务器扩展,则无法正常工作。

pip install ballet-submit-labextension
jupyter lab build

注意:您需要NodeJS来安装此扩展;如果找不到,安装过程将报错。

使用GitHub进行身份验证

此扩展提供了在JupyterLab内部使用GitHub进行身份验证的实验室体验。当您打开笔记本时,应在笔记本工具栏的右侧看到GitHub图标。该图标最初应为灰色,表示您尚未进行身份验证。单击图标打开登录窗口,在该窗口中您可以输入您的GitHub用户名和密码。这些信息将被扩展程序交换为OAuth令牌,并将代表您提出对上游Ballet项目的更改(如果您尝试提交功能)。

或者,您可以直接使用以下配置方法提供个人访问令牌。

配置

扩展程序与Jupyter [Lab] 本身的配置系统相同。您可以使用命令行参数或通过配置文件配置扩展程序,就像配置Jupyter Notebook或Jupyter Lab一样。

所有配置选项

以下配置选项可用

$ python -c 'from ballet_submit_labextension.app import print_help;print_help()'

BalletApp options
-----------------
--BalletApp.access_token_timeout=<Int>
    Default: 60
    timeout to receive access token from server via polling
--BalletApp.ballet_yml_path=<Unicode>
    Default: ''
    path to ballet.yml file of Ballet project (if Lab is not run from project
    directory)
--BalletApp.debug=<Bool>
    Default: False
    enable debug mode (no changes made on GitHub), will read from $BALLET_DEBUG
    if present
--BalletApp.github_token=<Unicode>
    Default: ''
    github access token, will read from $GITHUB_TOKEN if present
--BalletApp.oauth_gateway_url=<Unicode>
    Default: 'https://github-oauth-gateway.herokuapp.com/'
    url to github-oauth-gateway server

命令行参数

使用命令行参数调用Jupyter Lab,为ballet扩展提供配置,例如

jupyter lab --BalletApp.debug=True

配置文件

  1. 确定您的jupyter配置文件路径(如果不存在,您可能需要创建它)

    touch "$(jupyter --config-dir)/jupyter_notebook_config.py"
    
  2. 将所需的配置追加到文件末尾,例如

    c.BalletApp.debug = True
    

故障排除

如果您看到前端扩展但无法正常工作,请检查服务器扩展是否已启用

jupyter serverextension list

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

jupyter labextension list

如果已安装,请尝试

jupyter lab clean
jupyter lab build

贡献

开发安装

jlpm命令是JupyterLab附带的yarn版本,与JupyterLab一起安装。您可以使用下面的yarnnpm代替jlpm

# Clone the repo to your local environment
# Move to ballet-submit-labextension directory
# Install server extension
pip install -e .
# Register server extension
jupyter serverextension enable --py ballet-submit-labextension
# Install dependencies
jlpm
# Build Typescript source
jlpm build
# Link your development version of the extension with JupyterLab
jupyter labextension link .

# Rebuild Typescript source after making changes
jlpm build
# Rebuild JupyterLab after making any changes
jupyter lab build

您可以通过监视源目录,以监视模式运行JupyterLab,以监视扩展源的变化,并自动重新构建扩展和应用。

# Watch the source directory in another terminal tab
jlpm watch
# Run jupyterlab in watch mode in one terminal tab
jupyter lab --watch

卸载

pip uninstall ballet-submit-labextension
jupyter labextension uninstall ballet-submit-labextension

发布流程

bumpversion <part>
make release

项目详情


下载文件

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

源分布

ballet-submit-labextension-0.7.2.tar.gz (24.7 kB 查看哈希)

上传时间

构建分布

ballet_submit_labextension-0.7.2-py3-none-any.whl (18.6 kB 查看哈希)

上传时间 Python 3

支持者

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