Some updates to Dash change how existing features work, and you will need to update your apps for them to continue to function correctly.
Below is an outline of what updates you’ll need to make to your apps, along with a short overview of new functionality you’ll find in Dash 2.0.
If you are currently naming arguments to
state=, you need to either also use
input for the input arguments, or remove
As of version 2.0, Dash no longer supports Python 2.
Dash 2.0 includes a simpler way to import Dash as well as its dependencies and components.
If you update your apps to use Dash 2.0, we recommend you use this simpler import statement and replace references to
dash_table in your app imports.
import dash_html_components as html import dash_core_components as dcc import dash_table
from dash import Dash, callback, html, dcc, dash_table, Input, Output, State, MATCH, ALL
In the above example,
dash_table are imported along with
The changes that allow simpler import of
dash_table also impact installs of these components. If you have these referenced in any
requirements.txt files, you should update them.
As you update your apps, you may also want to consider trying out some of Dash 2.0’s new features.
If you are currently using Dash 1.x and experiencing server timeouts with callbacks that run for a long time, you can use long callbacks to solve this issue. Long callbacks run callback logic in a separate process, meaning the app is still available while the callback runs. See the Long Callbacks chapter for more details.
In Dash 1.x callback arguments are positional, meaning arguments are passed to the callback function in the same order as they are in the callback decorator. Flexible callbacks
allow for either positional or keyword arguments. See the Flexible Callback Signatures chapter for more details.
@dash.callback is an alternative to using
@app.callback in your apps. It is useful when building reusable components using pattern-matching callbacks and All-in-One components. To import and use it:
import dash @dash.callback(...)
@dash.clientside_callback can be used as an alternative to
import dash @dash.clientside_callback(...)
Both can also be imported by importing from
dash like this:
from dash import clientside_callback, callback
And then used like this:
prevent_initial_callbacks via app = dash.Dash(__name__, prevent_initial_callbacks=True)is not supported. It defaults to
False. This is still configurable on a per-callback level.
@dash.callbackwon’t work in projects with multiple app declarations.
dcc.Locationmulti-page app solution).
Dash 2.0 adds opt-in support for
orjson. If the
orjson library is installed, Dash will use it to serialize data to JSON, improving callback performance. See “Data Serialization” in the Performance chapter for more information.