Skip to content

Commit 193d129

Browse files
authored
Merge pull request #229 from plotly/dev
Release 1.4.0
2 parents 96aac85 + 462b215 commit 193d129

15 files changed

+105
-69
lines changed

.circleci/config.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33
orbs:
44
percy: percy/[email protected]
5-
browser-tools: circleci/browser-tools@1.2.4
5+
browser-tools: circleci/browser-tools@1.4.3
66

77
jobs:
88

@@ -36,13 +36,14 @@ jobs:
3636
- run:
3737
name: ⚙️ Integration tests
3838
command: |
39-
julia --project -e 'import Pkg; Pkg.instantiate(); Pkg.update();'
4039
python -m venv venv
4140
. venv/bin/activate
4241
pip install --upgrade pip wheel
4342
git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main
4443
cd dash-main && pip install -e .[ci,dev,testing] --progress-bar off && cd ..
45-
pytest --headless --nopercyfinalize --junitxml=test-reports/dashjl.xml --percy-assets=test/assets/ test/integration/
44+
cd test/integration
45+
julia --project -e 'import Pkg; Pkg.develop(path="../../"); Pkg.instantiate(); Pkg.update();'
46+
pytest --headless --nopercyfinalize --junitxml=../../test-reports/dashjl.xml --percy-assets=../assets/ .
4647
- store_artifacts:
4748
path: test-reports
4849
- store_test_results:

CONTRIBUTING.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ cd Dash.jl
4141
git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main
4242
python3 -m venv venv
4343
pip install --upgrade pip wheel
44-
cd dash-main && pip install -e .[ci,dev,testing] && cd ..dash
45-
pytest --headless --nopercyfinalize --percy-assets=test/assets/ test/integration/
44+
cd dash-main && pip install -e .[ci,dev,testing] && cd ..
45+
cd test/integration
46+
julia --project -e 'import Pkg; Pkg.develop(path="../../"); Pkg.instantiate(); Pkg.update();'
47+
pytest --headless --nopercyfinalize --percy-assets=../assets/ .
4648
```
4749

4850
Alternatively, one can run the integration tests using the same Docker
@@ -76,7 +78,7 @@ releasing.
7678
### step 1
7779

7880
Make sure the [unit tests][jltest] and [CircleCI integration tests][circlecI]
79-
are passing.
81+
are passing off the `dev` branch.
8082

8183
### step 2
8284

@@ -89,7 +91,10 @@ For consistency, name the PR: "Release X.Y.Z"
8991
Bump the `version` field in the `Project.toml` (following [semver][semver]) and then
9092

9193
```sh
94+
git checkout dev
95+
git pull origin dev
9296
git commit -m "X.Y.Z"
97+
git push
9398
```
9499

95100
**N.B.** use `X.Y.Z` not `vX.Y.Z` in the commit message, the leading `v` is
@@ -131,8 +136,8 @@ git push --tags
131136
Go the [release page][releases] and create a new release,
132137
name it "Version X.Y.Z" for consistency and fill out sections:
133138

134-
- _What's Changed_, which should include items for all the PRs merged since the last release
135-
- _New Contributor_, which should include mention of all the first-time contributors
139+
- (usually) _Added_, _Changed_, _Fixed_ while including links to the PRs merged since the last release
140+
- _New Contributor_, which should include mentions for all the first-time contributors
136141

137142
finally, place a [GitHub compare link][compare] between the last release and X.Y.Z
138143
e.g. this [one][ex-diff].

Project.toml

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Dash"
22
uuid = "1b08a953-4be3-4667-9a23-3db579824955"
33
authors = ["Chris Parmer <[email protected]>", "Alexandr Romanenko <[email protected]>"]
4-
version = "1.3.0"
4+
version = "1.4.0"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -16,8 +16,6 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1616
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
1717
MD5 = "6ac74813-4b46-53a4-afec-0b5dc9d7885c"
1818
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
19-
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
20-
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
2119
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
2220
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2321
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
@@ -26,7 +24,7 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
2624
[compat]
2725
Aqua = "0.6"
2826
CodecZlib = "0.6, 0.7"
29-
DashBase = "0.2"
27+
DashBase = "1"
3028
DashCoreComponents = "2.0.0"
3129
DashHtmlComponents = "2.0.0"
3230
DashTable = "5.0.0"
@@ -35,8 +33,6 @@ HTTP = "1"
3533
JSON = "0.21"
3634
JSON3 = "1.9"
3735
MD5 = "0.2"
38-
PlotlyBase = "0.8.5, 0.8.6"
39-
Requires = "1.3"
4036
YAML = "0.4.7"
4137
julia = "1.6"
4238

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Built on top of Plotly.js, React and HTTP.jl, [Dash](https://plotly.com/dash/) t
1111

1212
Just getting started? Check out the [Dash for Julia User Guide](https://dash.plotly.com/julia)! If you can't find documentation there, then check out the unofficial [contributed examples](https://github.com/plotly/Dash.jl/issues/50) or check out source code from [demo applications](https://dash.gallery) in Python and then reference the Julia syntax style.
1313

14+
## Other resources
15+
16+
* <https://community.plotly.com/c/plotly-r-matlab-julia-net/julia/23>
17+
* <https://discourse.julialang.org/tag/dash>
18+
1419
## Project Status
1520

1621
Julia components can be generated in tandem with Python and R components. Interested in getting involved with the project? Sponsorship is a great way to accelerate the progress of open source projects like this one; please feel free to [reach out to us](https://plotly.com/consulting-and-oem/)!

build/README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ cd Dash.jl
5151
git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main
5252
5353
# start `dashjl-tests`
54+
# [on 1st session]
5455
docker run -t -d --name dashjl-tests -v .:/home/circleci/project etpinard/dashjl-tests:<x.y.z>
56+
# [otherwise]
57+
docker start dashjl-tests
5558

5659
# ssh into it as root (some python deps need that unfortunately)
5760
docker exec -u 0 -it dashjl-tests bash
@@ -74,11 +77,14 @@ chmod +x ./install-chromedriver.sh
7477
ORB_PARAM_DRIVER_INSTALL_DIR=/usr/local/bin/ ./install-chromedriver.sh
7578

7679
# [on 1st session] instantiate julia deps
77-
cd /home/circleci/project/
78-
julia --project -e 'import Pkg; Pkg.instantiate()'
80+
cd /home/circleci/project/test/integration
81+
julia --project -e 'import Pkg; Pkg.develop(path="../../"); Pkg.instantiate()'
82+
83+
# [optionally] if you want to use an unreleased version of DashBase
84+
julia --project -e 'import Pkg; Pkg.add(name="DashBase", rev="master")'
7985

8086
# update julia deps then run integration tests
81-
cd /home/circleci/project/
87+
cd /home/circleci/project/test/integration
8288
julia --project -e 'import Pkg; Pkg.update()'
83-
pytest --headless --nopercyfinalize --percy-assets=test/assets/ test/integration/
89+
pytest --headless --nopercyfinalize --percy-assets=../assets/ .
8490
```

src/Dash.jl

-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using DashBase
33
import HTTP, JSON3, CodecZlib, MD5
44
using Sockets
55
using Pkg.Artifacts
6-
using Requires
76

87
const ROOT_PATH = realpath(joinpath(@__DIR__, ".."))
98
#const RESOURCE_PATH = realpath(joinpath(ROOT_PATH, "resources"))
@@ -28,7 +27,6 @@ include("handlers.jl")
2827
include("server.jl")
2928
include("init.jl")
3029
include("components_utils/_components_utils.jl")
31-
include("plotly_base.jl")
3230

3331
@doc """
3432
module Dash
@@ -108,7 +106,6 @@ const _metadata = load_all_metadata()
108106
function __init__()
109107
setup_renderer_resources()
110108
setup_dash_resources()
111-
@require PlotlyJS="f0f68f2c-4968-5e81-91da-67840de0976a" include("plotly_js.jl")
112109
end
113110

114111

src/app/dashapp.jl

-22
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,6 @@ mutable struct DashApp
4040

4141
end
4242

43-
const VecChildTypes = Union{NTuple{N, DashBase.Component} where {N}, Vector{<:DashBase.Component}}
44-
45-
function Base.getindex(component::DashBase.Component, id::AbstractString)
46-
component.id == id && return component
47-
hasproperty(component, :children) || return nothing
48-
cc = component.children
49-
return if cc isa Union{VecChildTypes, DashBase.Component}
50-
cc[id]
51-
elseif cc isa AbstractVector
52-
identity.(filter(x->hasproperty(x, :id), cc))[id]
53-
else
54-
nothing
55-
end
56-
end
57-
function Base.getindex(children::VecChildTypes, id::AbstractString)
58-
for element in children
59-
element.id == id && return element
60-
el = element[id]
61-
el !== nothing && return el
62-
end
63-
end
64-
6543
#only name, index_string and layout are available to set
6644
function Base.setproperty!(app::DashApp, property::Symbol, value)
6745
property == :index_string && return set_index_string!(app, value)

src/plotly_base.jl

-8
This file was deleted.

src/plotly_js.jl

-8
This file was deleted.

test/integration/Project.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[deps]
2+
Dash = "1b08a953-4be3-4667-9a23-3db579824955"
3+
DashBase = "03207cf0-e2b3-4b91-9ca8-690cf0fb507e"
4+
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
5+
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
6+
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
7+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

test/integration/base/jl_plotly_graph/jlpg001_plotly_graph.jl

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Dash
22
using PlotlyBase
3+
34
app = dash()
45
app.layout = html_div() do
56
dcc_graph(id = "graph",

test/integration/base/jl_plotly_graph/jlpg002_plotlyjs_graph.jl

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Dash
22
using PlotlyJS
3+
34
app = dash()
45
app.layout = html_div() do
56
dcc_graph(id = "graph",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Dash
2+
using Plots
3+
plotly()
4+
5+
app = dash()
6+
app.layout = html_div() do
7+
dcc_graph(id = "graph", figure = plot((1:10, 1:10))),
8+
html_button("draw", id = "draw"),
9+
html_div("", id = "status")
10+
end
11+
12+
callback!(app,
13+
Output("graph", "figure"),
14+
Output("status", "children"),
15+
Input("draw", "n_clicks")) do nclicks
16+
return if isnothing(nclicks)
17+
no_update(), "first"
18+
else
19+
plot([(1:10, 1:10), (1:10, 1:2:20)]), "second"
20+
end
21+
end
22+
23+
run_server(app)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Dash
2+
using Plots
3+
plotlyjs()
4+
5+
app = dash()
6+
app.layout = html_div() do
7+
dcc_graph(id = "graph", figure = plot((1:10, 1:10))),
8+
html_button("draw", id = "draw"),
9+
html_div("", id = "status")
10+
end
11+
12+
callback!(app,
13+
Output("graph", "figure"),
14+
Output("status", "children"),
15+
Input("draw", "n_clicks")) do nclicks
16+
return if isnothing(nclicks)
17+
no_update(), "first"
18+
else
19+
plot([(1:10, 1:10), (1:10, 1:2:20)]), "second"
20+
end
21+
end
22+
23+
run_server(app)
+19-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
import pathlib
22
import os.path
33
import logging
4+
45
logger = logging.getLogger(__name__)
56

67
curr_path = pathlib.Path(__file__).parent.absolute()
78
def jl_test_file_path(filename):
89
return os.path.join(curr_path, "jl_plotly_graph", filename)
910

11+
def _run_test(dashjl, filename, percy_snapshot_prefix):
12+
fp = jl_test_file_path(filename)
13+
name = f"{percy_snapshot_prefix} figure callback"
1014

11-
12-
13-
def test_jlpg001_plotly_graph(dashjl):
14-
fp = jl_test_file_path("jlpg001_plotly_graph.jl")
1515
dashjl.start_server(fp)
16-
dashjl.wait_for_element_by_css_selector(
17-
"#graph", timeout=20
18-
)
16+
dashjl.wait_for_element_by_css_selector("#graph", timeout=20)
1917

2018
dashjl.wait_for_text_to_equal("#status", "first", timeout=10)
21-
22-
dashjl.percy_snapshot(name="PlotlyBase figure layout")
19+
dashjl.percy_snapshot(name=f"{percy_snapshot_prefix} figure layout")
2320

2421
dashjl.find_element("#draw").click()
2522
dashjl.wait_for_text_to_equal("#status", "second", timeout=10)
23+
dashjl.percy_snapshot(name=name)
24+
25+
26+
def test_jlpg001_plotly_graph(dashjl):
27+
_run_test(dashjl, "jlpg001_plotly_graph.jl", "PlotlyBase")
28+
29+
def test_jlpg002_plotlyjs_graph(dashjl):
30+
_run_test(dashjl, "jlpg002_plotlyjs_graph.jl", "PlotlyJS")
31+
32+
def test_jlpg003_plots_plotly_graph(dashjl):
33+
_run_test(dashjl, "jlpg003_plots_plotly_graph.jl", "Plots plotly")
2634

27-
dashjl.percy_snapshot(name="PlotlyBase figure callback")
35+
def test_jlpg004_plots_plotlyjs_graph(dashjl):
36+
_run_test(dashjl, "jlpg004_plots_plotlyjs_graph.jl", "Plots plotlyjs")

0 commit comments

Comments
 (0)