Skip to content

Commit 3abfea9

Browse files
committed
core component integrations
1 parent 387cab3 commit 3abfea9

File tree

9 files changed

+44
-39
lines changed

9 files changed

+44
-39
lines changed

Artifacts.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[dash_resources]
2-
git-tree-sha1 = "5221819aa12c212904a1922411cf8bbc9b787901"
2+
git-tree-sha1 = "c857e355d2c21dfc458fb315371431dda2506109"
33

44
[[dash_resources.download]]
5-
sha256 = "0f129069bed005e92a8061c4a3b71ba0aedf54911e01103b3261d586995836a6"
6-
url = "https://github.com/waralex/DashCoreResources/releases/download/v1.20.0+0/DashCoreResources.v1.20.0.tar.gz"
5+
sha256 = "4ff3910a8ff1f5420784397cfc6ad80341bbe03f1010eab38dcb9b8ce2423310"
6+
url = "https://github.com/waralex/DashCoreResources/releases/download/v2.0.0+0/DashCoreResources.v2.0.0.tar.gz"

Project.toml

Lines changed: 1 addition & 1 deletion
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 = "0.1.6"
4+
version = "1.0.0"
55

66
[deps]
77
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"

gen_resources/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
77
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
88
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
99
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
10+
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
1011
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
1112
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
1213
ghr_jll = "07c12ed4-43bc-5495-8a2a-d5838ef8d533"

gen_resources/Sources.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
repo = "waralex/DashCoreResources"
33
[dash]
44
url = "https://github.com/plotly/dash.git"
5-
tag = "v1.20.0"
5+
tag = "v2.0.0"
66
[dash_renderer]
77
module = "dash_renderer"
88
resources_path = "."
99
[components]
1010
[components.dash_html_components]
11-
module = "dash_html_components"
11+
module = "dash.html"
1212
prefix = "html"
13-
resources_path = "."
13+
resources_path = ".."
1414
metadata_file = "metadata.json"
1515
[components.dash_core_components]
16-
module = "dash_core_components"
16+
module = "dash.dcc"
1717
prefix = "dcc"
18-
resources_path = "."
18+
resources_path = ".."
1919
metadata_file = "metadata.json"
2020
[components.dash_table]
21-
module = "dash_table"
21+
module = "dash.dash_table"
2222
prefix = "dash"
23-
resources_path = "."
23+
resources_path = ".."
2424
metadata_file = "metadata.json"

gen_resources/generator/dash.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ function install_dash(url, tag)
2222
Conda.pip("install", "./")
2323
end
2424
dashmodule = pyimport("dash")
25+
println(dashmodule)
2526
return dashmodule.__version__
2627
end
2728

2829
dash_version() = VersionNumber(pyimport("dash").__version__)
30+
dash_module_dir() = dirname(pyimport("dash").__file__)
2931

3032
function convert_deps_part(relative, external)
3133
result = Dict{Symbol, String}[]
@@ -108,6 +110,8 @@ end
108110
function copy_files(resource_dir, files, dest_dir)
109111
for f in files
110112
full_path = joinpath(resource_dir, f)
113+
path_dir = dirname(f)
114+
mkpath(joinpath(dest_dir, path_dir))
111115
if isfile(full_path)
112116
cp(full_path, joinpath(dest_dir, f); force = true)
113117
else
@@ -125,10 +129,18 @@ function renderer_resources(module_name)
125129
:deps => convert_resources(m._js_dist, hasproperty(m, :_css_dist) ? m._css_dist : [])
126130
)
127131
files = vcat(deps_files(m._js_dist_dependencies[1]), resources_files(m._js_dist))
128-
129132
return (dirname(m.__file__), meta, files)
130133
end
131134

135+
function fill_components_deps!(deps::OrderedDict, files::Vector, module_name)
136+
m = pyimport(module_name)
137+
js_dist = hasproperty(m, :_js_dist) ? m._js_dist : []
138+
css_dist = hasproperty(m, :_css_dist) ? m._css_dist : []
139+
_process_dist_part!.(Ref(deps), js_dist, :js)
140+
_process_dist_part!.(Ref(deps), css_dist, :css)
141+
append!(files, vcat(resources_files(js_dist), resources_files(css_dist)))
142+
end
143+
132144
function components_module_resources(module_name; name, prefix, metadata_file)
133145
m = pyimport(module_name)
134146
moduledir = dirname(m.__file__)
@@ -137,16 +149,12 @@ function components_module_resources(module_name; name, prefix, metadata_file)
137149
error("meta file $(metadata_file) don't exists for module $(name)")
138150
end
139151
components = process_components_meta(metafile)
140-
js_dist = hasproperty(m, :_js_dist) ? m._js_dist : []
141-
css_dist = hasproperty(m, :_css_dist) ? m._css_dist : []
142152
meta = OrderedDict(
143153
:version => m.__version__,
144154
:name => name,
145-
:deps => convert_resources(js_dist, css_dist),
146155
:prefix => prefix,
147156
:components => components
148157
)
149-
files = vcat(resources_files(js_dist), resources_files(css_dist))
150158

151-
return (dirname(m.__file__), meta, files)
159+
return meta
152160
end

gen_resources/generator/deploy.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,20 @@ function fill_deploy_resources(sources, deploy_dir, info)
5656
:build => info.build,
5757
:embedded_components => Symbol.(collect(keys(sources["components"])))
5858
)
59+
60+
dash_deps = OrderedDict{Symbol, Any}()
61+
dash_deps_files = Vector{String}()
62+
63+
for (name, props) in sources["components"]
64+
fill_components_deps!(dash_deps, dash_deps_files, props["module"])
65+
end
66+
dash_meta[:deps] = collect(values(dash_deps))
67+
5968
YAML.write_file("dash.yaml", dash_meta)
6069

70+
mkdir("dash_deps")
71+
copy_files(dash_module_dir(), dash_deps_files, "dash_deps")
72+
6173
@info "creating dash-renderer meta..."
6274
module_src, meta, files = renderer_resources(
6375
sources["dash_renderer"]["module"]
@@ -78,24 +90,13 @@ function fill_deploy_resources(sources, deploy_dir, info)
7890
@info "processing components modules..."
7991
for (name, props) in sources["components"]
8092
@info "processing $name meta..."
81-
(module_src, meta, files) = components_module_resources(
93+
meta = components_module_resources(
8294
props["module"];
8395
name = name,
8496
prefix = props["prefix"],
8597
metadata_file = props["metadata_file"],
8698
)
8799
YAML.write_file("$(name).yaml", meta)
88-
89-
resources_path = realpath(
90-
joinpath(
91-
module_src,
92-
get(props, "resources_path", ".")
93-
)
94-
)
95-
@info "copying $name files..."
96-
deps_dir = name * "_deps"
97-
mkdir(deps_dir)
98-
copy_files(resources_path, files, deps_dir)
99100
end
100101
end
101102
end

gen_resources/generator/generator.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include("components.jl")
55
include("deploy.jl")
66

77
const HELP = """
8-
Usage: build_tarballs.jl [--deploy] [--help]
8+
Usage: generate.jl [--deploy] [--help]
99
1010
Options:
1111

src/Dash.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ end
103103
const _metadata = load_all_metadata()
104104
function __init__()
105105
setup_renderer_resources()
106-
setup_embeded_components_resources()
106+
setup_dash_resources()
107107
end
108108

109109

src/init/resources.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ function load_all_metadata()
6666
)
6767
end
6868

69-
function setup_module_resources(name, meta)
70-
path = deps_path(name)
69+
function setup_dash_resources()
70+
meta = _metadata.dash
71+
path = deps_path("dash")
7172
version = meta["version"]
7273
for dep in meta["deps"]
7374
DashBase.register_package(
@@ -78,10 +79,4 @@ function setup_module_resources(name, meta)
7879
)
7980
)
8081
end
81-
end
82-
function setup_embeded_components_resources()
83-
dash_meta = _metadata.dash
84-
for c in dash_meta["embedded_components"]
85-
setup_module_resources(c, _metadata.embedded_components[Symbol(c)])
86-
end
8782
end

0 commit comments

Comments
 (0)