emacs-jupyter/jupyter

Julia and Revise.jl make Kernel unresponsive

Open

#210 opened on Dec 31, 2019

 (3 comments) (0 reactions) (0 assignees)Emacs Lisp (106 forks)auto 404
help wanted

Repository metrics

Stars
 (1,028 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hey there! Great work and its been a pleasure using it :)

When running a Julia kernel together with the Revise.jl package the kernel gets unresponsive upon the first hook from revise.

Revise detects changes in functions from a module and injects them into the running Julia session.

To use Revise.jl I added two startup files with the following content:

~/.julia/config/startup.jl

atreplinit() do repl
    try
        @eval using Pkg
        haskey(Pkg.installed(), "Revise") || @eval Pkg.add("Revise")
    catch
    end
    try
        @eval using Revise
        @async Revise.wait_steal_repl_backend()
    catch
    end
end

and

~/.julia/config/startup_ijulia.jl

try
    @eval using Revise
catch
end

With this setup, running julia or jupyter console --kernel julia-1.3 results in correctly reloading Julia sessions.

To test the setup, I generated a new package from the Julia package REPL.

using Pkg

Pkg.generate("TestPackage")

This generates a directory TestPackage which contains a simple TestPackage.jl file.

We start a session in the directory and evaluate the following snippet:

using Pkg

Pkg.activate(".")

using TestPackage

TestPackage.greet()

We can then go and add a function to the TestPackage.jl file.

function f()
    π
end

And Revise.jl will inject that code into the running session, and we can use it.

TestPackage.f()

Using the kernel from emacs-jupyter results in a busy kernel as soon as we save the source file.

Any ideas why that might happen?

emacs-jupyter 20191019.1519

julia version 1.3.0

jupyter core     : 4.6.1
jupyter-notebook : 6.0.1
qtconsole        : 4.3.1
ipython          : 7.9.0
ipykernel        : 5.1.3
jupyter client   : 5.3.4
jupyter lab      : not installed
nbconvert        : 5.6.1
ipywidgets       : 7.4.0
nbformat         : 4.4.0
traitlets        : 4.3.3

Cheers

Contributor guide