Dash v2.1.0
Changed
-
#1876 Delays finalizing
Dash.configattributes not used in the constructor untilinit_app(). -
#1869, #1873 Upgrade Plotly.js to v2.8.3. This includes:
- Feature release 2.5.0:
- 3D traces are now compatible with
no-unsafe-evalCSP rules.
- 3D traces are now compatible with
- Feature release 2.6.0:
- Add
smithsubplots andscattersmithtraces, for drawing Smith charts.
- Add
- Feature release 2.7.0:
- Add text data for
histogramtraces. - Fix an interaction between
uirevisionandautorangethat pops up in some cases of mixed clientside / serverside figure generation.
- Add text data for
- Feature release 2.8.0:
- Add horizontal colorbars.
- Add text data on
heatmapand related trace types. - Control legend group title fonts.
- Patch releases 2.5.1, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.8.1, 2.8.2, and 2.8.3 containing bugfixes.
- This PR also upgrades various other dependencies of dash renderer and component suites.
- Feature release 2.5.0:
-
#1745:
Improve ourextras_require: there are now five options here, each with a well-defined role:dash[dev]: for developing and building dash components.dash[testing]: for using thepytestplugins in thedash.testingmoduledash[diskcache]: required if you useDiskcacheLongCallbackManagerdash[celery]: required if you useCeleryLongCallbackManagerdash[ci]: mainly for internal use, these are additional requirements for the Dash CI tests, exposed for other component libraries to use a matching configuration.
Added
-
#1883 in DataTable added
page_currenttopersisted_propsas requested in #1860 -
Dash and Dash Renderer
Input,State, andOutputnow accept components instead of ID strings and Dashcallbackwill auto-generate the component's ID under-the-hood if not supplied. This allows usage like:
my_input = dcc.Input() my_output = html.Div() app.layout = html.Div([my_input, my_output]) @dash.callback(Output(my_output, 'children'), Input(my_input, 'value')) def update(value): return f'You have entered {value}'
Or, if using Python >=3.8 you can use the
:=walrus operator:app.layout = html.Div([ my_input := dcc.Input(), my_output := html.Div() ]) @dash.callback(Output(my_output, 'children'), Input(my_input, 'value')) def update(value): return f'You have entered {value}'
#1894 restricted this feature so auto-generated IDs are not allowed if the app uses
dash_snapshots(a Dash Enterprise package) or if the component usespersistence, as this can create confusing errors. Callback definitions can still reference components in these cases, but those components must have explicit IDs.Dash Core Components
Rearranged Keyword Arguments & Flexible Types
Dropdown,RadioItem, andChecklist- Rearranged Keyword Arguments -
options&valueare now the first two keywords which means they can be supplied as positional arguments without the keyword. Supplying the keywords (options=andvalue=) is still supported. - Flexible Types -
optionscan be supplied in two new forms:- An array of
string|number|boolwherelabelandvalueare equal to the items in the list. - A dictionary where the keys and values set as
valueandlabelrespectively.
- An array of
Before:
dcc.Dropdown( options=[ {'label': 'New York', 'value': 'New York'}, {'label': 'Montreal', 'value': 'Montreal'}, ], value='New York' )
or
dcc.Dropdown( options=[ {'label': 'New York', 'value': 'NYC'}, {'label': 'Montreal', 'value': 'MTL'}, ], value='New York' )
After:
dcc.Dropdown(['New York', 'Montreal'], 'New York')
Or
dcc.Dropdown({'NYC': 'New York', 'MTL': 'Montreal'}, 'New York')
RangeSlider&Slider- Rearranged Keyword Arugments -
min,max, andstepare now the first three keyword arguments which means they can be supplied as positional arguments without the keyword. - Flexible Types
stepwill be calculated implicitly if not given.markswill be auto generated if not given. It will useminandmaxand will respectstepif supplied. Auto generated marks labels are SI unit formatted. Around 5 human-readable marks will be created.- To remove the Slider's marks, set
marks=None.
Before:
dcc.Slider(marks={1: 2, 2: 2, 3: 3})
After:
dcc.Slider(min=1, max=3, step=1)
Or equivalently:
dcc.Slider(1, 3, 1)
Step can also be omitted and the
Sliderwill attempt to create a nice, human readable step with SI units and around 5 marks:dcc.Slider(0, 100)
The SI units and ranges supported in
marksare:µ- micro, 10⁻⁶m- milli, 10⁻³(none) - 10⁰k- kilo, 10³M- mega, 10⁶G- giga, 10⁹T- tera, 10¹²P- peta, 10¹⁵E- exa, 10¹⁸
Ranges below 10µ are not supported by the Slider. This is a bug: #1766
DataTable- Rearranged Keyword Arguments -
dataandcolumnsthe first twokeyword arguments which means they can be supplied as positional arguments without the keyword. - Inferred Properties - If
columnsisn't supplied then it is extracted from the the first row indata
Before:
dash_table.DataTable(data=df.to_dict('records'), columns=[{'name': i, 'id': i} for i in df.columns])
After:
dash_table.DataTable(data=df.to_dict('records'))
New Component Properties
Checklist&RadioItems- A new property
inlineappendsdisplay: inline-blocktolabelStyle.
dcc.Checklist(inline=True)
Fixed
-
#1879 Delete redundancy in pattern-matching callback implementation, specifically when
ALLandMATCHwildcards are used together. This patch was submitted by an anonymous Dash Enterprise customer. Many thanks! -
#1858 Support
mini-css-extract-pluginWebpack plugin with@plotly/webpack-dash-dynamic-importnode package - used by components to support dash async chunks. Updated dependencies of other@plotlynode packages. -
#1836 Fix
__all__in dcc and table for extras: dcc download helpers and table format helpers. This also restores this functionality to the obsolete top-level packagesdash_core_componentsanddash_table. -
#1822 Remove Radium from renderer dependencies, as part of investigating React 17 support.
-
- Clean up our handling of serialization problems, including fixing
orjsonfor Python 3.6 - Added the ability for
dash.testingpercy_snapshotmethods to choose widths to generate.
- Clean up our handling of serialization problems, including fixing
-
#1778 DataTable: Fix React warnings stating
that each child in a list should have a unique "key" prop -
#1895 Support debug=True if native namespace-packages are present