Skip to content

Commit b556512

Browse files
author
Marc-André Rivet
committed
- bump dash version
- bump dash-renderer version - loosen version requirements - fix formatting for Husky (?!)
1 parent 7961611 commit b556512

File tree

8 files changed

+90
-70
lines changed

8 files changed

+90
-70
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [UNRELEASED]
5+
## [1.12.0] - 2020-05-05
66
### Added
77
- [#1228](https://github.com/plotly/dash/pull/1228) Adds control over firing callbacks on page (or layout chunk) load. Individual callbacks can have their initial calls disabled in their definition `@app.callback(..., prevent_initial_call=True)` and similar for `app.clientside_callback`. The app-wide default can also be changed with `app=Dash(prevent_initial_callbacks=True)`, then individual callbacks may disable this behavior.
88
- [#1201](https://github.com/plotly/dash/pull/1201) New attribute `app.validation_layout` allows you to create a multi-page app without `suppress_callback_exceptions=True` or layout function tricks. Set this to a component layout containing the superset of all IDs on all pages in your app.

dash-renderer/package-lock.json

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-renderer",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "render dash components in react",
55
"main": "dash_renderer/dash_renderer.min.js",
66
"scripts": {

dash/development/_r_components_generation.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,9 @@ def generate_rpkg(
573573
"pkg_help_description", pkg_data.get("description", "")
574574
)
575575
if rpkg_data.get("pkg_copyright"):
576-
package_copyright = "\nCopyright: {}".format(rpkg_data.get(
577-
"pkg_copyright", ""))
576+
package_copyright = "\nCopyright: {}".format(
577+
rpkg_data.get("pkg_copyright", "")
578+
)
578579
else:
579580
# fall back to using description in package.json, if present
580581
package_title = pkg_data.get("description", "")
@@ -636,13 +637,12 @@ def generate_rpkg(
636637

637638
if rpkg_data is not None:
638639
if rpkg_data.get("pkg_authors"):
639-
package_rauthors = '\nAuthors@R: {}'.format(rpkg_data.get(
640-
"pkg_authors", ""))
640+
package_rauthors = "\nAuthors@R: {}".format(
641+
rpkg_data.get("pkg_authors", "")
642+
)
641643
else:
642644
package_rauthors = '\nAuthors@R: person("{}", "{}", role = c("aut", "cre"), email = "{}")'.format(
643-
package_author_fn,
644-
package_author_ln,
645-
package_author_email
645+
package_author_fn, package_author_ln, package_author_email
646646
)
647647

648648
if not (os.path.isfile("LICENSE") or os.path.isfile("LICENSE.txt")):

dash/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.11.0"
1+
__version__ = "1.12.0"

requires-install.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Flask>=1.0.2
22
flask-compress
33
plotly
4-
dash_renderer==1.4.0
5-
dash-core-components==1.9.1
4+
dash_renderer>=1.4.0
5+
dash-core-components>=1.9.1
66
dash-html-components==1.0.3
7-
dash-table==4.6.2
7+
dash-table>=4.6.2
88
future

tests/integration/callbacks/test_missing_outputs.py

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22

33
import dash_html_components as html
4+
45
# import dash_core_components as dcc
56
import dash
67
from dash.dependencies import Input, Output, ALL, MATCH
@@ -14,12 +15,14 @@
1415
def test_cbmo001_all_output(with_simple, dash_duo):
1516
app = dash.Dash(__name__)
1617

17-
app.layout = html.Div(children=[
18-
html.Button("items", id="items"),
19-
html.Button("values", id="values"),
20-
html.Div(id="content"),
21-
html.Div("Output init", id="output"),
22-
])
18+
app.layout = html.Div(
19+
children=[
20+
html.Button("items", id="items"),
21+
html.Button("values", id="values"),
22+
html.Div(id="content"),
23+
html.Div("Output init", id="output"),
24+
]
25+
)
2326

2427
@app.callback(Output("content", "children"), [Input("items", "n_clicks")])
2528
def content(n1):
@@ -28,9 +31,10 @@ def content(n1):
2831
# these two variants have identical results, but the internal behavior
2932
# is different when you combine the callbacks.
3033
if with_simple:
34+
3135
@app.callback(
3236
[Output({"i": ALL}, "children"), Output("output", "children")],
33-
[Input("values", "n_clicks"), Input({"i": ALL}, "id")]
37+
[Input("values", "n_clicks"), Input({"i": ALL}, "id")],
3438
)
3539
def content_and_output(n2, content_ids):
3640
# this variant *does* get called with empty ALL, because of the
@@ -42,6 +46,7 @@ def content_and_output(n2, content_ids):
4246
return content, sum(content)
4347

4448
else:
49+
4550
@app.callback(Output({"i": ALL}, "children"), [Input("values", "n_clicks")])
4651
def content_inner(n2):
4752
# this variant does NOT get called with empty ALL
@@ -71,7 +76,7 @@ def out2(contents):
7176
["#values", "4\n4\n4", "12"],
7277
["#items", "", "0"],
7378
["#values", "", "0"],
74-
["#items", "5", "5"]
79+
["#items", "5", "5"],
7580
]
7681
for selector, content, output in actions:
7782
dash_duo.find_element(selector).click()
@@ -85,32 +90,43 @@ def out2(contents):
8590
def test_cbmo002_all_and_match_output(with_simple, dash_duo):
8691
app = dash.Dash(__name__)
8792

88-
app.layout = html.Div(children=[
89-
html.Button("items", id="items"),
90-
html.Button("values", id="values"),
91-
html.Div(id="content"),
92-
])
93+
app.layout = html.Div(
94+
children=[
95+
html.Button("items", id="items"),
96+
html.Button("values", id="values"),
97+
html.Div(id="content"),
98+
]
99+
)
93100

94101
@app.callback(Output("content", "children"), [Input("items", "n_clicks")])
95102
def content(n1):
96103
return [
97-
html.Div([
98-
html.Div(
99-
[html.Div(id={"i": i, "j": j}) for i in range(((n1 or 0) + j) % 4)],
100-
className="content{}".format(j)
101-
),
102-
html.Div(id={"j": j}, className="output{}".format(j)),
103-
html.Hr(),
104-
])
104+
html.Div(
105+
[
106+
html.Div(
107+
[
108+
html.Div(id={"i": i, "j": j})
109+
for i in range(((n1 or 0) + j) % 4)
110+
],
111+
className="content{}".format(j),
112+
),
113+
html.Div(id={"j": j}, className="output{}".format(j)),
114+
html.Hr(),
115+
]
116+
)
105117
for j in range(4)
106118
]
107119

108120
# these two variants have identical results, but the internal behavior
109121
# is different when you combine the callbacks.
110122
if with_simple:
123+
111124
@app.callback(
112-
[Output({"i": ALL, "j": MATCH}, "children"), Output({"j": MATCH}, "children")],
113-
[Input("values", "n_clicks"), Input({"i": ALL, "j": MATCH}, "id")]
125+
[
126+
Output({"i": ALL, "j": MATCH}, "children"),
127+
Output({"j": MATCH}, "children"),
128+
],
129+
[Input("values", "n_clicks"), Input({"i": ALL, "j": MATCH}, "id")],
114130
)
115131
def content_and_output(n2, content_ids):
116132
# this variant *does* get called with empty ALL, because of the
@@ -122,9 +138,9 @@ def content_and_output(n2, content_ids):
122138
return content, sum(content)
123139

124140
else:
141+
125142
@app.callback(
126-
Output({"i": ALL, "j": MATCH}, "children"),
127-
[Input("values", "n_clicks")]
143+
Output({"i": ALL, "j": MATCH}, "children"), [Input("values", "n_clicks")]
128144
)
129145
def content_inner(n2):
130146
# this variant does NOT get called with empty ALL
@@ -137,7 +153,7 @@ def content_inner(n2):
137153

138154
@app.callback(
139155
Output({"j": MATCH}, "children"),
140-
[Input({"i": ALL, "j": MATCH}, "children")]
156+
[Input({"i": ALL, "j": MATCH}, "children")],
141157
)
142158
def out2(contents):
143159
return sum(contents)
@@ -157,7 +173,7 @@ def out2(contents):
157173
["#values", [["4\n4\n4", "12"], ["", "0"], ["4", "4"], ["4\n4", "8"]]],
158174
["#items", [["", "0"], ["4", "4"], ["4\n4", "8"], ["4\n4\n4", "12"]]],
159175
["#values", [["", "0"], ["5", "5"], ["5\n5", "10"], ["5\n5\n5", "15"]]],
160-
["#items", [["5", "5"], ["5\n5", "10"], ["5\n5\n5", "15"], ["", "0"]]]
176+
["#items", [["5", "5"], ["5\n5", "10"], ["5\n5\n5", "15"], ["", "0"]]],
161177
]
162178
for selector, output_spec in actions:
163179
dash_duo.find_element(selector).click()
@@ -171,19 +187,21 @@ def out2(contents):
171187
def test_cbmo003_multi_all(dash_duo):
172188
app = dash.Dash(__name__)
173189

174-
app.layout = html.Div(children=[
175-
html.Button("items", id="items"),
176-
html.Button("values", id="values"),
177-
html.Div(id="content1"),
178-
html.Hr(),
179-
html.Div(id="content2"),
180-
html.Hr(),
181-
html.Div("Output init", id="output"),
182-
])
190+
app.layout = html.Div(
191+
children=[
192+
html.Button("items", id="items"),
193+
html.Button("values", id="values"),
194+
html.Div(id="content1"),
195+
html.Hr(),
196+
html.Div(id="content2"),
197+
html.Hr(),
198+
html.Div("Output init", id="output"),
199+
]
200+
)
183201

184202
@app.callback(
185203
[Output("content1", "children"), Output("content2", "children")],
186-
[Input("items", "n_clicks")]
204+
[Input("items", "n_clicks")],
187205
)
188206
def content(n1):
189207
c1 = [html.Div(id={"i": i}) for i in range(((n1 or 0) + 2) % 4)]
@@ -192,7 +210,7 @@ def content(n1):
192210

193211
@app.callback(
194212
[Output({"i": ALL}, "children"), Output({"j": ALL}, "children")],
195-
[Input("values", "n_clicks")]
213+
[Input("values", "n_clicks")],
196214
)
197215
def content_inner(n2):
198216
# this variant does NOT get called with empty ALL
@@ -206,7 +224,7 @@ def content_inner(n2):
206224

207225
@app.callback(
208226
Output("output", "children"),
209-
[Input({"i": ALL}, "children"), Input({"j": ALL}, "children")]
227+
[Input({"i": ALL}, "children"), Input({"j": ALL}, "children")],
210228
)
211229
def out2(ci, cj):
212230
return sum(ci) + sum(cj)
@@ -232,7 +250,7 @@ def out2(ci, cj):
232250
# all empty! we'll see an error logged if the callback was fired
233251
["#items", "", "", "0"],
234252
["#values", "", "", "0"],
235-
["#items", "7", "9", "16"]
253+
["#items", "7", "9", "16"],
236254
]
237255
for selector, content1, content2, output in actions:
238256
dash_duo.find_element(selector).click()

tests/integration/callbacks/test_multiple_callbacks.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -270,29 +270,32 @@ def test_cbmt007_early_preventupdate_inputs_above_below(dash_duo):
270270

271271
@app.callback(Output("content", "children"), [Input("content", "style")])
272272
def content(_):
273-
return html.Div([
274-
html.Div(42, id="above-in"),
275-
html.Div(id="above-dummy"),
276-
html.Hr(),
277-
html.Div(0, id='above-out'),
278-
html.Div(0, id='below-out'),
279-
html.Hr(),
280-
html.Div(id="below-dummy"),
281-
html.Div(44, id="below-in"),
282-
])
273+
return html.Div(
274+
[
275+
html.Div(42, id="above-in"),
276+
html.Div(id="above-dummy"),
277+
html.Hr(),
278+
html.Div(0, id="above-out"),
279+
html.Div(0, id="below-out"),
280+
html.Hr(),
281+
html.Div(id="below-dummy"),
282+
html.Div(44, id="below-in"),
283+
]
284+
)
283285

284286
# Create 4 callbacks - 2 above, 2 below.
285-
for pos in ('above', 'below'):
287+
for pos in ("above", "below"):
288+
286289
@app.callback(
287290
Output("{}-dummy".format(pos), "children"),
288-
[Input("{}-dummy".format(pos), "style")]
291+
[Input("{}-dummy".format(pos), "style")],
289292
)
290293
def dummy(_):
291294
raise PreventUpdate
292295

293296
@app.callback(
294-
Output('{}-out'.format(pos), 'children'),
295-
[Input('{}-in'.format(pos), 'children')]
297+
Output("{}-out".format(pos), "children"),
298+
[Input("{}-in".format(pos), "children")],
296299
)
297300
def out(v):
298301
return v

0 commit comments

Comments
 (0)