-
-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add msgpack_type
method Expr and related
#2653
Conversation
Try this Pull Request!Open Julia and type: julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/disberd/Pluto.jl", rev="msgpack_expr")
julia> using Pluto |
Can you add a test? (I'm just curious how it gets serialized 😅) |
@pankgeorg serialization is just a Dict: julia> MsgPack.pack(:(LOL = [1, "string", :symbol])) |> MsgPack.unpack
Dict{Any, Any} with 2 entries:
"head" => "="
"args" => Any["LOL", Dict{Any, Any}("head"=>"vect", "args"=>Any[0x01, "string", Dict{Any, Any}("value"=>"symbol")])] The problem is in de-serialization. It is not straightforward to reconstruct the original Expr like this. But I am thinking, isnt' MsgPack just used to send data to the front-end? Since the test in Pluto.jl/test/Configuration.jl Lines 128 to 133 in 27b23a4
Adding a |
I think the msgpack serialization happens here when sending server config to the client: Pluto.jl/src/webserver/Dynamic.jl Line 397 in 871517c
Maybe it is simpler to send the config option as a string or simply drop it from the config when sending the config to the client instead of a serialized Expr? |
I agree with Paul! Actually I think the config |
@rikhuijzer is using it in PlutoStaticHTML, without client connections it works: But a string would also make it clear that you cannot embed arbitrary code with packages not loaded on the notebook like: workspace_custom_startup_expr = quote
MyPackage.do_something() # <- will not de-serialize on the notebook process
end |
A string is also necessary when using a TOML config like in PSS: https://github.com/JuliaPluto/PlutoSliderServer.jl#2-plutodeploymenttoml Lemme see if I can do some hack with overloading |
@Pangoraw No worries about breaking PlutoStaticHTML 😄 . As long as another option remains for handling the situation then it's fine. PlutoStaticHTML is pinned to an exact Pluto version so is very robust to breaking changes. |
This PR should fix #2652