From cb0d3ef25080d72cb493dbce36f541339cd68bef Mon Sep 17 00:00:00 2001 From: Alberto Mengali Date: Mon, 21 Oct 2024 10:19:11 +0200 Subject: [PATCH 1/7] format --- src/preprocess.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/preprocess.jl b/src/preprocess.jl index 433463e..a35c0cc 100644 --- a/src/preprocess.jl +++ b/src/preprocess.jl @@ -9,7 +9,7 @@ struct AttrName{S} AttrName(s::Symbol) = new{s}(s) end # This is used to handle args... which in case only one element is passed is not iterable -Base.iterate(n::AttrName, state = 1) = state > 1 ? nothing : (n, state + 1) +Base.iterate(n::AttrName, state=1) = state > 1 ? nothing : (n, state + 1) #= This function is basically `_json_lower` from PlotlyBase, but we do it directly @@ -92,10 +92,9 @@ _process_with_names(A::AbstractArray{<:Union{Number,AbstractVector{<:Number}},N} end # Dict ans HasFields -_process_with_names(d::Dict, fl::Val, @nospecialize(args::Vararg{AttrName})) = - Dict{Any,Any}(k => _process_with_names(v, fl, args...) for (k, v) in pairs(d)) -_process_with_names(d::Dict{Symbol}, fl::Val, @nospecialize(args::Vararg{AttrName})) = +function _process_with_names(d::Dict{Symbol}, fl::Val, @nospecialize(args::Vararg{AttrName})) Dict{Symbol,Any}(k => _process_with_names(v, fl, AttrName(k), args...) for (k, v) in pairs(d)) +end # We have a separate one because it seems to reduce allocations _process_with_names(a::PlotlyBase.HasFields, fl::Val, @nospecialize(args::AttrName)) = _process_with_names(a.fields, fl, args...) From dcebd9039683029d85a4b6298f525fe3866331a0 Mon Sep 17 00:00:00 2001 From: Alberto Mengali Date: Mon, 21 Oct 2024 10:19:52 +0200 Subject: [PATCH 2/7] handle plotly properties inside Dict{Any} --- src/preprocess.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/preprocess.jl b/src/preprocess.jl index a35c0cc..0420552 100644 --- a/src/preprocess.jl +++ b/src/preprocess.jl @@ -92,6 +92,13 @@ _process_with_names(A::AbstractArray{<:Union{Number,AbstractVector{<:Number}},N} end # Dict ans HasFields +function _process_with_names(d::Dict, fl::Val, @nospecialize(args::Vararg{AttrName})) + Dict{Any,Any}(k => if k isa Symbol + _process_with_names(v, fl, AttrName(k), args...) + else + _process_with_names(v, fl, args...) + end for (k, v) in pairs(d)) +end function _process_with_names(d::Dict{Symbol}, fl::Val, @nospecialize(args::Vararg{AttrName})) Dict{Symbol,Any}(k => _process_with_names(v, fl, AttrName(k), args...) for (k, v) in pairs(d)) end @@ -122,7 +129,7 @@ end _preprocess(x) = PlotlyBase.JSON.lower(x) # Default _preprocess(x::TimeType) = sprint(print, x) # For handling datetimes -_preprocess(s::Union{AbstractString, Symbol}) = String(s) +_preprocess(s::Union{AbstractString,Symbol}) = String(s) _preprocess(x::Union{Nothing,Missing}) = x _preprocess(x::Symbol) = string(x) From b3fba676af8e4dcaa98f18c2069781ea128103db Mon Sep 17 00:00:00 2001 From: Alberto Mengali Date: Mon, 21 Oct 2024 10:19:58 +0200 Subject: [PATCH 3/7] add a test --- test/preprocess.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/preprocess.jl diff --git a/test/preprocess.jl b/test/preprocess.jl new file mode 100644 index 0000000..e00c4db --- /dev/null +++ b/test/preprocess.jl @@ -0,0 +1,12 @@ +@testitem "Preprocess" begin + using PlutoPlotly: _process_with_names, AttrName + l = Layout(; + title_text = "asd", + title_x = 0.5 + ) + d = _process_with_names(l, Val(true), AttrName(:layout)) + @test d[:title] isa Dict + tit = d[:title] + @test haskey(tit, :text) && tit[:text] == "asd" + @test haskey(tit, :x) && tit[:x] == 0.5 +end \ No newline at end of file From c43348f49378fda9dcf358fb46c805d8b78b0986 Mon Sep 17 00:00:00 2001 From: Alberto Mengali Date: Mon, 21 Oct 2024 10:25:18 +0200 Subject: [PATCH 4/7] update CI to test 1.9 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 420c60e..70aa800 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,8 +18,8 @@ jobs: fail-fast: false matrix: version: + - '1.9' - '1' - - 'pre' os: - ubuntu-latest - macOS-latest From 4474d4920db825413b708ea7579135ad158c2b6b Mon Sep 17 00:00:00 2001 From: Alberto Mengali Date: Mon, 21 Oct 2024 10:30:55 +0200 Subject: [PATCH 5/7] add comment --- src/preprocess.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/preprocess.jl b/src/preprocess.jl index 0420552..7938d90 100644 --- a/src/preprocess.jl +++ b/src/preprocess.jl @@ -94,6 +94,8 @@ _process_with_names(A::AbstractArray{<:Union{Number,AbstractVector{<:Number}},N} # Dict ans HasFields function _process_with_names(d::Dict, fl::Val, @nospecialize(args::Vararg{AttrName})) Dict{Any,Any}(k => if k isa Symbol + # We have this branch as we might have plotly properties here and we assume + # they are if the dict key is a symbol. _process_with_names(v, fl, AttrName(k), args...) else _process_with_names(v, fl, args...) From c7ee95ed7bc343250f8cb9ea358be08ee029126b Mon Sep 17 00:00:00 2001 From: Alberto Mengali Date: Mon, 21 Oct 2024 10:31:01 +0200 Subject: [PATCH 6/7] update notebooks --- notebooks/basic_tests.jl | 6 +- notebooks/make_subplots_tests.jl | 145 +++++++++++++++++++------------ 2 files changed, 93 insertions(+), 58 deletions(-) diff --git a/notebooks/basic_tests.jl b/notebooks/basic_tests.jl index 23a1b9a..b30708b 100644 --- a/notebooks/basic_tests.jl +++ b/notebooks/basic_tests.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.19.45 +# v0.20.0 #> custom_attrs = ["hide-enabled"] @@ -528,7 +528,7 @@ PlutoUI = "~0.7.58" PLUTO_MANIFEST_TOML_CONTENTS = """ # This file is machine-generated - editing it directly is not advised -julia_version = "1.11.0-rc2" +julia_version = "1.11.1" manifest_format = "2.0" project_hash = "1d4bd470bedf2e3cf5cbe6ed53d40e09965977f9" @@ -833,7 +833,7 @@ version = "1.2.13+1" [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.10.1+0" +version = "5.11.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] diff --git a/notebooks/make_subplots_tests.jl b/notebooks/make_subplots_tests.jl index 9e3aa63..158c4b9 100644 --- a/notebooks/make_subplots_tests.jl +++ b/notebooks/make_subplots_tests.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.19.29 +# v0.20.0 #> custom_attrs = ["hide-enabled"] @@ -190,40 +190,49 @@ PlutoUI = "~0.7.52" PLUTO_MANIFEST_TOML_CONTENTS = """ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.0-beta2" +julia_version = "1.11.1" manifest_format = "2.0" -project_hash = "f50c3104111b5d594359e3dd1628a076c5fe269d" +project_hash = "783a712e7e33acbda630018c7e39842b9b0c76ad" [[deps.AbstractPlutoDingetjes]] deps = ["Pkg"] -git-tree-sha1 = "91bd53c39b9cbfb5ef4b015e8b582d344532bd0a" +git-tree-sha1 = "6e1d2a35f2f90a4bc7c2ed98079b2ba09c35b83a" uuid = "6e696c72-6542-2067-7265-42206c756150" -version = "1.2.0" +version = "1.3.2" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.1" +version = "1.1.2" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +version = "1.11.0" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +version = "1.11.0" [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] -git-tree-sha1 = "eb7f0f8307f71fac7c606984ea5fb2817275d6e4" +git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d" uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" -version = "0.11.4" +version = "0.11.5" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.1.1+0" [[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +version = "1.11.0" + +[[deps.DocStringExtensions]] +deps = ["LibGit2"] +git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" +uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" +version = "0.9.3" [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] @@ -232,34 +241,36 @@ version = "1.6.0" [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +version = "1.11.0" [[deps.FixedPointNumbers]] deps = ["Statistics"] -git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc" +git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" -version = "0.8.4" +version = "0.8.5" [[deps.Hyperscript]] deps = ["Test"] -git-tree-sha1 = "8d511d5b81240fc8e6802386302675bdf47737b9" +git-tree-sha1 = "179267cfa5e712760cd43dcae385d7ea90cc25a4" uuid = "47d2ed2b-36de-50cf-bf87-49c2cf4b8b91" -version = "0.0.4" +version = "0.0.5" [[deps.HypertextLiteral]] deps = ["Tricks"] -git-tree-sha1 = "c47c5fa4c5308f27ccaac35504858d8914e102f9" +git-tree-sha1 = "7134810b1afce04bbc1045ca1985fbe81ce17653" uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" -version = "0.9.4" +version = "0.9.5" [[deps.IOCapture]] deps = ["Logging", "Random"] -git-tree-sha1 = "d75853a0bdbfb1ac815478bacd89cd27b550ace6" +git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770" uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" -version = "0.2.3" +version = "0.2.5" [[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +version = "1.11.0" [[deps.JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] @@ -275,11 +286,17 @@ version = "0.6.4" [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.0.1+1" +version = "8.6.0+0" [[deps.LibGit2]] -deps = ["Base64", "NetworkOptions", "Printf", "SHA"] +deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +version = "1.11.0" + +[[deps.LibGit2_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] +uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" +version = "1.7.2+0" [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] @@ -288,13 +305,16 @@ version = "1.11.0+1" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +version = "1.11.0" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +version = "1.11.0" [[deps.MIMEs]] git-tree-sha1 = "65f28ad4b594aebe22157d6fac869786a255b7eb" @@ -303,25 +323,27 @@ version = "0.1.4" [[deps.MacroTools]] deps = ["Markdown", "Random"] -git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48" +git-tree-sha1 = "2fa9ee3e63fd3a4f7a9a4f4744a52f4856de82df" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -version = "0.5.11" +version = "0.5.13" [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +version = "1.11.0" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.6+0" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" +version = "1.11.0" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2023.12.12" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -330,18 +352,22 @@ version = "1.2.0" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.27+1" [[deps.Parsers]] deps = ["Dates", "PrecompileTools", "UUIDs"] -git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851" +git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.7.2" +version = "2.8.1" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.10.0" +version = "1.11.0" +weakdeps = ["REPL"] + + [deps.Pkg.extensions] + REPLExt = "REPL" [[deps.PlutoDevMacros]] deps = ["HypertextLiteral", "InteractiveUtils", "MacroTools", "Markdown", "Pkg", "Random", "TOML"] @@ -350,40 +376,43 @@ uuid = "a0499f29-c39b-4c5c-807c-88074221b949" version = "0.5.8" [[deps.PlutoExtras]] -deps = ["AbstractPlutoDingetjes", "HypertextLiteral", "InteractiveUtils", "Markdown", "PlutoDevMacros", "PlutoUI", "REPL", "Reexport"] -git-tree-sha1 = "beedecb30d8ed0874773d5641f5ce5ee2bfeeded" +deps = ["AbstractPlutoDingetjes", "DocStringExtensions", "HypertextLiteral", "InteractiveUtils", "Markdown", "PlutoUI", "REPL", "Random"] +git-tree-sha1 = "681f89bdd5c1da76b31a524af798efb5eb332ee9" uuid = "ed5d0301-4775-4676-b788-cf71e66ff8ed" -version = "0.7.10" +version = "0.7.13" [[deps.PlutoUI]] deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"] -git-tree-sha1 = "e47cd150dbe0443c3a3651bc5b9cbd5576ab75b7" +git-tree-sha1 = "eba4810d5e6a01f612b948c9fa94f905b49087b0" uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8" -version = "0.7.52" +version = "0.7.60" [[deps.PrecompileTools]] deps = ["Preferences"] -git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f" +git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -version = "1.2.0" +version = "1.2.1" [[deps.Preferences]] deps = ["TOML"] -git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e" +git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.4.1" +version = "1.4.3" [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" +version = "1.11.0" [[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" +version = "1.11.0" [[deps.Random]] deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +version = "1.11.0" [[deps.Reexport]] git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" @@ -396,24 +425,27 @@ version = "0.7.0" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +version = "1.11.0" [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[deps.SparseArrays]] -deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] -uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" +version = "1.11.0" [[deps.Statistics]] -deps = ["LinearAlgebra", "SparseArrays"] +deps = ["LinearAlgebra"] +git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0" uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.9.0" +version = "1.11.1" + + [deps.Statistics.extensions] + SparseArraysExt = ["SparseArrays"] + + [deps.Statistics.weakdeps] + SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -[[deps.SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] -uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.0+1" +[[deps.StyledStrings]] +uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" +version = "1.11.0" [[deps.TOML]] deps = ["Dates"] @@ -428,23 +460,26 @@ version = "1.10.0" [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +version = "1.11.0" [[deps.Tricks]] -git-tree-sha1 = "aadb748be58b492045b4f56166b5188aa63ce549" +git-tree-sha1 = "7822b97e99a1672bfb1b49b668a6d46d58d8cbcb" uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" -version = "0.1.7" +version = "0.1.9" [[deps.URIs]] -git-tree-sha1 = "b7a5e99f24892b6824a954199a45e9ffcc1c70f0" +git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b" uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" -version = "1.5.0" +version = "1.5.1" [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +version = "1.11.0" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" [[deps.Zlib_jll]] deps = ["Libdl"] @@ -454,12 +489,12 @@ version = "1.2.13+1" [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.11.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.59.0+0" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] From 27e6c79183e846323ce7fa3883a36beb62982528 Mon Sep 17 00:00:00 2001 From: Alberto Mengali Date: Mon, 21 Oct 2024 10:44:08 +0200 Subject: [PATCH 7/7] dev --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 23338fa..d8e6e7b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PlutoPlotly" uuid = "8e989ff0-3d88-8e9f-f020-2b208a939ff0" authors = ["Alberto Mengali "] -version = "0.6.0" +version = "0.6.1-DEV" [deps] AbstractPlutoDingetjes = "6e696c72-6542-2067-7265-42206c756150"