-
Notifications
You must be signed in to change notification settings - Fork 110
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
Revise loaded in -E/-e for -i not updating definitions #202
Comments
Seems to work on the master branch for me. |
I still see the issue with both Julia 1.0.3 and 1.2.0-DEV.74 on the Revise master. I'll see if I can put together a script + env to reliably reproduce this. |
I've put together a restricted environment and an exact list of commands that should reproduce the issue. Since it is dependent on the REPL loop, I couldn't really make it a single script, but at least the Julia commands can be just pasted into the REPL all at once: https://gist.github.com/mortenpi/c944f5affbff54b1ddb13a7c14945f02#file-mwe-txt Just to note that I am running this on Linux, as it may make a difference. |
Thanks for the reproducer. I must have been fooled by the fact that I launch Revise from my startup file. So, the problem is that with julia> Revise.steal_repl_backend(Base.active_repl_backend) It's possible that one could |
I think I ran into this when I was working on some functions and I needed to restart Julia over and over again (I was probably updating type definitions). So I wanted to But not being able to do that is a pretty minor inconvenience, so I think just documenting the workaround is fine if there is no good way to fix it at the moment. Would it be possible to make Revise print a warning if it is loaded in this way? |
I got hit with this again, but this time I figured out that I can just use the same solution as the docs recommend for
Would there be any way to detect and warn if Revise is not loaded properly? It could also be useful when someone naively puts just |
The concern with issuing a warning is that it would be intrusive for people who launch Revise in their startup.jl file but occasionally run a script with |
It should not be a problem if you follow the recommended way though? The |
Yes, good point. I'd be willing to give this a try. Would you do me a favor, though? Make this change $ git diff
diff --git a/src/Revise.jl b/src/Revise.jl
index 49f670b..4d0841d 100644
--- a/src/Revise.jl
+++ b/src/Revise.jl
@@ -1034,6 +1034,8 @@ function __init__()
steal_repl_backend(Base.active_repl_backend::REPL.REPLBackend)
elseif isdefined(Main, :IJulia)
Main.IJulia.push_preexecute_hook(revise)
+ else
+ @warn "Revise may not be appropriately configured, see documentation"
end
if isdefined(Main, :Atom)
setup_atom(getfield(Main, :Atom)::Module) and play with it a little while? If it doesn't cause you any problems then I could go with it. |
Hmm, this particular error will pop up when you just start Would it be possible to have the |
Check out the call to |
Hmm, I indeed didn't look at the code that closely. However, if I understand correctly, I am more or less just thinking out loud here at the moment. I am currently running Revise with the following change: diff --git a/src/Revise.jl b/src/Revise.jl
index 49f670b..8aee247 100644
--- a/src/Revise.jl
+++ b/src/Revise.jl
@@ -1034,6 +1034,10 @@ function __init__()
steal_repl_backend(Base.active_repl_backend::REPL.REPLBackend)
elseif isdefined(Main, :IJulia)
Main.IJulia.push_preexecute_hook(revise)
+ else
+ @info "Setting up @async task to steal backend" # debug
+ @async Revise.wait_steal_repl_backend()
end
if isdefined(Main, :Atom)
setup_atom(getfield(Main, :Atom)::Module) and nothing in the
as far as I can tell. It also seems to allow you to just have |
Just as a data point, I ran into the same issue just now, trying to run a script to set things up before interactive use. |
If you don't discover any negatives to this, I'd welcome a PR. |
I've tried putting this into a makefile: atreplinit() do repl
@eval using Revise
@async Revise.wait_steal_repl_backend()
# some setup
@eval using MyModule
end As long as no recompilation is required upon starting, this works just fine, but otherwise I get the following error:
I guess that's to be expected, given the timeout behavior in I guess an option could be to let the |
What if we couple the suggestion in #202 (comment) with a check of |
I don't really know!-) Maybe? How would you use the check? Wait until it becomes true, or something? Or is it perhaps true from the beginning, as long as Julia knows it's "heading toward" a REPL (just not quite there yet)? |
Discussion may move to #349 |
When loading a Julia script as follows:
julia -i -e 'using Revise; includet("script.jl")'
Revise will not update the function definitions etc. afterwards. The original version of the script gets loaded without issues though.
Tested with Revise master (dd6e970) on Julia 1.0.0 and the normal Revise workflow (
using Revise; includet("script.jl")
in the REPL) works without problems.Edit: just a bit more debugging:
also fails (i.e. not updating), so it seems to be a problem with loading Revise in the -E/-e option.
The text was updated successfully, but these errors were encountered: