这是一个JupyterLab扩展,用于将Plotly Dash应用程序渲染为JupyterLab中的单独窗口 🎉
Github项目链接:
https://github.com/plotly/jupyterlab-dash
注意:此扩展目前不支持Windows或Python 2
JupyterLab
jupyterlab-dash库需要Python包和JupyterLab扩展。
首先,使用pip安装Python包:
pip install jupyterlab-dash==0.1.0a2
或者用conda安装(但不是两个都用)。
conda install -c plotly jupyterlab-dash=0.1.0a2
然后安装JupyterLab 扩展:
$ jupyter labextension install jupyterlab-dash@0.1.0-alpha.2
如果您想安装jupyterlab-dash进行开发,请使用以下命令:
git clone https://github.com/plotly/jupyterlab-dash
cd jupyterlab-dash
# Install Python package
pip install -e .
# Install Javascript dependencies
npm install # or yarn
# Build JupyterLab extension
npm run build # or yarn build
jupyter labextension link .
要重构JupyterLab扩展:
npm run build
jupyter lab build
当源文件更改时,自动重构JupyterLab扩展:
# In one terminal tab, watch the jupyterlab-dash directory
$ npm run watch # or yarn watch
# In another terminal tab, run jupyterlab with the watch flag
$ jupyter lab --watch
import jupyterlab_dash
import dash
import dash_html_components as html
viewer = jupyterlab_dash.AppViewer()
app = dash.Dash(__name__)
app.layout = html.Div('Hello World')
viewer.show(app)
点击阅读原文,查看本文更多内容