Dash in Jupyter - more seamless jupyter notebook integration
See original GitHub issueThis answer in forum provides this function to do this using iframe:
from IPython import display
def show_app(app, # type: dash.Dash
port=9999,
width=700,
height=350,
offline=True,
style=True,
**dash_flask_kwargs):
"""
Run the application inside a Jupyter notebook and show an iframe with it
:param app:
:param port:
:param width:
:param height:
:param offline:
:return:
"""
url = 'http://localhost:%d' % port
iframe = '<iframe src="{url}" width={width} height={height}></iframe>'.format(url=url,
width=width,
height=height)
display.display_html(iframe, raw=True)
if offline:
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
if style:
external_css = ["https://fonts.googleapis.com/css?family=Raleway:400,300,600",
"https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css",
"http://getbootstrap.com/dist/css/bootstrap.min.css", ]
for css in external_css:
app.css.append_css({"external_url": css})
external_js = ["https://code.jquery.com/jquery-3.2.1.min.js",
"https://cdn.rawgit.com/plotly/dash-app-stylesheets/a3401de132a6d0b652ba11548736b1d1e80aa10d/dash-goldman-sachs-report-js.js",
"http://getbootstrap.com/dist/js/bootstrap.min.js"]
for js in external_js:
app.scripts.append_script({"external_url": js})
return app.run_server(debug=False, # needs to be false in Jupyter
port=port,
**dash_flask_kwargs)
This question on Stack Overflow provides further evidence of interest in this feature. So, I’m posting this here both as feature request and as a reference. Feel free to close this issue if you are already aware of this.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:19 (5 by maintainers)
Top Results From Across the Web
Using Dash in Jupyter and Workspaces
JupyterDash is a library that makes it easy to build Dash apps from Jupyter environments. In this chapter, we demonstrate using JupyterDash in...
Read more >Setting up Plotly Dash in JupyterLab & Jupyter Notebook
In this tutorial you'll learn to set up Jupyter Lab and Jupyter Notebook to run your Plotly Dash Apps, using PC or Mac....
Read more >Problems Running Dash In Jupyter Notebook - ADocLib
By integrating the Plotly Dash frontend with the Databricks backend we are offering a seamless process to transform AI and ML models into...
Read more >Interactive Jupyter Dashboards > JupyterLab JupyterHub ...
Galyleo is the first Jupyter-native, open-source solution for Jupyter dashboards and analytics. You can run it in the cloud with zero laptop resources....
Read more >It would be awesome if we could integrate Jupyter Notebooks ...
... Jupyter Notebooks with Kibana (more seamlessly, like a dashboard) ... Eland is proof that Elastic understands the value in integration ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re experimenting with a lightweight JupyterLab extension that:
run_server
call from blocking the kernel. It detects when the app has changed and then restarts the dash app.One of the nice things about developing in Jupyter is that the data pre-processing steps are sort of “cached” in the initial cells. So, you can preserve a single cell for your
app.layout
and iterate pretty quickly.We’ll keep this thread updated with our progress
We have open sourced this extension in this repo: https://github.com/plotly/jupyterlab-dash 🎉