diff --git a/Project.toml b/Project.toml index 995839b0..b99cdf35 100644 --- a/Project.toml +++ b/Project.toml @@ -27,4 +27,4 @@ JSON = "0.18,0.19,0.20,0.21,1" MbedTLS = "0.5,0.6,0.7,1" SoftGlobalScope = "1" ZMQ = "1.3" -julia = "1.6" +julia = "1.10" diff --git a/src/IJulia.jl b/src/IJulia.jl index 4d5a4469..58553f18 100644 --- a/src/IJulia.jl +++ b/src/IJulia.jl @@ -36,7 +36,7 @@ export notebook, jupyterlab, installkernel using ZMQ, JSON, SoftGlobalScope import Base.invokelatest import Dates -using Dates: now +using Dates: now, format, UTC, ISODateTimeFormat import Random using Base64: Base64EncodePipe import REPL @@ -285,7 +285,7 @@ function clear_output(wait=false) # flush pending stdio flush_all() empty!(displayqueue) # discard pending display requests - send_ipython(publish[], msg_reply(execute_msg::Msg, "clear_output", + send_ipython(publish[], msg_pub(execute_msg::Msg, "clear_output", Dict("wait" => wait))) stdio_bytes[] = 0 # reset output throttling end diff --git a/src/comm_manager.jl b/src/comm_manager.jl index 17319b71..0d37f862 100644 --- a/src/comm_manager.jl +++ b/src/comm_manager.jl @@ -59,7 +59,7 @@ function comm_info_request(sock, msg) end content = Dict(:comms => _comms) - send_ipython(IJulia.publish[], + send_ipython(sock, msg_reply(msg, "comm_info_reply", content)) end diff --git a/src/display.jl b/src/display.jl index 2659b576..2fdbd4bf 100644 --- a/src/display.jl +++ b/src/display.jl @@ -48,6 +48,7 @@ register_jsonmime(x::AbstractVector{<:MIME}) = push!(ijulia_jsonmime_types, Vect # return a String=>Any dictionary to attach as metadata # in Jupyter display_data and pyout messages metadata(x) = Dict() +transient(x) = Dict() """ Generate the preferred MIME representation of x. diff --git a/src/handlers.jl b/src/handlers.jl index 52630953..dc658b91 100644 --- a/src/handlers.jl +++ b/src/handlers.jl @@ -154,11 +154,11 @@ function complete_request(socket, msg) end function kernel_info_request(socket, msg) - send_ipython(requests[], + send_ipython(socket, msg_reply(msg, "kernel_info_reply", - Dict("protocol_version" => "5.0", + Dict("protocol_version" => "5.4", "implementation" => "ijulia", - # TODO: "implementation_version" => IJulia version string from Pkg + "implementation_version" => pkgversion(@__MODULE__), "language_info" => Dict("name" => "julia", "version" => @@ -274,7 +274,7 @@ end function interrupt_request(socket, msg) @async Base.throwto(requests_task[], InterruptException()) - send_ipython(requests[], msg_reply(msg, "interrupt_reply", Dict())) + send_ipython(socket, msg_reply(msg, "interrupt_reply", Dict())) end function unknown_request(socket, msg) diff --git a/src/inline.jl b/src/inline.jl index 2ef69587..339d05ad 100644 --- a/src/inline.jl +++ b/src/inline.jl @@ -62,6 +62,7 @@ for mime in ipy_mime msg_pub(execute_msg, "display_data", Dict( "metadata" => metadata(x), # optional + "transient" => transient(x), # optional "data" => Dict($mime => limitstringmime(MIME($mime), x))))) end displayable(d::InlineDisplay, ::MIME{Symbol($mime)}) = true @@ -87,6 +88,7 @@ function display(d::InlineDisplay, M::MIME, x) send_ipython(publish[], msg_pub(execute_msg, "display_data", Dict("metadata" => metadata(x), # optional + "transient" => transient(x), # optional "data" => d))) end @@ -98,6 +100,7 @@ function display(d::InlineDisplay, x) send_ipython(publish[], msg_pub(execute_msg, "display_data", Dict("metadata" => metadata(x), # optional + "transient" => transient(x), # optional "data" => display_dict(x)))) end diff --git a/src/msg.jl b/src/msg.jl index 74012b81..c34a107a 100644 --- a/src/msg.jl +++ b/src/msg.jl @@ -18,9 +18,9 @@ end msg_header(m::Msg, msg_type::String) = Dict("msg_id" => uuid4(), "username" => m.header["username"], "session" => m.header["session"], - "date" => now(), + "date" => format(now(UTC), ISODateTimeFormat)*"Z", "msg_type" => msg_type, - "version" => "5.3") + "version" => "5.4") # PUB/broadcast messages use the msg_type as the ident, except for # stream messages which use the stream name (e.g. "stdout"). @@ -32,7 +32,7 @@ msg_pub(m::Msg, msg_type, content, metadata=Dict{String,Any}()) = msg_header(m, msg_type), content, m.header, metadata) msg_reply(m::Msg, msg_type, content, metadata=Dict{String,Any}()) = - Msg(m.idents, msg_header(m, msg_type), content, m.header, metadata) + Msg(m.idents, msg_header(m, msg_type), merge(Dict("status" => "ok"), content), m.header, metadata) function show(io::IO, msg::Msg) print(io, "IPython Msg [ idents ")