用于JupyterLab Heroku扩展的服务器扩展
项目描述
jupyterlab-heroku
JupyterLab扩展,用于管理和部署应用程序到Heroku。
此扩展可实现一键部署voila仪表板。
要求
创建Heroku账户
如果您已有Heroku账户,可以跳到下一节.
您可以通过以下说明创建新的Heroku账户: https://signup.heroku.com/
安装heroku客户端
您需要在您的计算机上安装heroku
客户端才能部署应用程序。要设置它: https://devcenter.heroku.com/articles/getting-started-with-python#set-up
设置完成后,使用以下命令测试安装:
$ heroku --version
heroku/7.26.2 linux-x64 node-v11.14.0
登录Heroku
登录Heroku有多种方式
heroku login
将打开新的浏览器标签,使用电子邮件和密码登录- 创建一个
~/.netrc
文件,包含API令牌(有关更多详细信息,请参阅文档) - 设置环境变量
HEROKU_API_KEY
为了测试认证:heroku apps
其他依赖项
此扩展还需要
- JupyterLab 1.0
git
安装
pip install jupyterlab-heroku
jupyter serverextension enable --sys-prefix --py jupyterlab_heroku
jupyter labextension install jupyterlab-heroku
由于Heroku使用git
来部署应用程序,因此还建议安装JupyterLab的jupyterlab-git
扩展
pip install jupyterlab-git
jupyter serverextension enable --sys-prefix --py jupyterlab_git
jupyter labextension install @jupyterlab/git
贡献
安装
# Clone the repo to your local environment
# Move to jupyterlab-heroku directory
# Create a new conda environment
conda create -n jupyterlab-heroku -c conda-forge jupyterlab nodejs
# Install the server extension
python -m pip install -e .
jupyter serverextension enable --sys-prefix --py jupyterlab_heroku
# 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
卸载
jupyter labextension uninstall jupyterlab-heroku
替代方案
要使用命令行将Voila应用程序部署到Heroku: https://github.com/martinRenou/voila_heroku