Git Product home page Git Product logo

revise.jl's Introduction

Revise.jl

CI codecov.io

Revise.jl allows you to modify code and use the changes without restarting Julia. With Revise, you can be in the middle of a session and then update packages, switch git branches, and/or edit the source code in the editor of your choice; any changes will typically be incorporated into the very next command you issue from the REPL. This can save you the overhead of restarting Julia, loading packages, and waiting for code to JIT-compile.

See the documentation:

In particular, most users will probably want to alter their .julia/config/startup.jl file to run Revise automatically, as described in the Configuration section of the documentation.

Credits

Revise became possible because of Jameson Nash's fix of Julia issue 265. Julia for VSCode and Juno are IDEs that offer an editor-based mechanism for achieving a subset of Revise's aims.

Major releases

  • Both the current 3.x and 2.x release cycles use JuliaInterpreter to step through your module-defining code.
  • The 1.x release cycle does not use JuliaInterpreter, but does integrate with Pkg.jl. Try this if the more recent releases give you trouble. (But please report the problems first!)
  • For Julia 0.6 see this branch. However, you really shouldn't be using Julia 0.6 anymore!

See the NEWS for additional information.

revise.jl's People

Contributors

aviatesk avatar c42f avatar cormullion avatar cstjean avatar dependabot[bot] avatar ffevotte avatar fredrikekre avatar garrison avatar ianbutterworth avatar iblislin avatar johnnychen94 avatar josepereiro avatar juliatagbot avatar kristofferc avatar lilithhafner avatar m-wells avatar maleadt avatar mkitti avatar mlhetland avatar mortenpi avatar nathanrboyer avatar oxinabox avatar pfitzseb avatar rapus95 avatar simeonschaub avatar t-bltg avatar timholy avatar tkelman avatar tkf avatar xgdgsc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

revise.jl's Issues

UV Error when attempting to watch (too) many files

Revise.jl is loaded in my .juliarc.jl, then:

              _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0 (2017-06-19 13:05 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-apple-darwin13.4.0

julia> using GSL

ERROR (unhandled task failure): start_watching (File Monitor): too many open files (EMFILE)
Stacktrace:
 [1] uv_error at ./libuv.jl:68 [inlined]
 [2] start_watching(::FileMonitor) at ./poll.jl:350
 [3] wait(::FileMonitor) at ./poll.jl:428
 [4] watch_file(::String, ::Int64) at ./poll.jl:507
 [5] revise_file_queued(::String) at /Users/spowell/.julia/v0.6/Revise/src/Revise.jl:412
 [6] (::Revise.##1#2)() at ./event.jl:73

The error repeats 50+ times.

If the number of watched files cannot be increased, or if this would be undesirable, perhaps an easy way to manage the problem would be to have a whitelist of modules for which tracking is not required?

Revise changed my life...

...and made my code awesome. I cried tears of joy while removing tens of lines of code from Genie that used to manage file reloads. It's awesome (and should be part of Base)! ๐Ÿ‘

Revising modules on multiple workers/processes

Hi, and thank you for Revise.jl.

Really there are two issues here.

The thing I really want is to have mypkg Revised on all of the Julia workers as well. That doesn't happen with either of my below scenarios. I have tried @everywhere using mypkg and @everywhere using Revise but no dice. This makes for a long restart process. Any suggestions on how to achieve this multi-process revise?

As far as process 1 is concerned, it appears that Revise will not update a local module when Julia is started with -p procs. Interestingly Revise will notice updates when procs were added with addprocs().

Successful operation:

  • Start julia
  • run using mypkg
  • run f() from mypkg and get baseline output
  • edit source code to mypkg - add an info("test1")
  • run f() from mypkg and see the new info line test1
  • run addprocs(2) to add two worker processes
  • edit source code to mypkg - add an info("test2")
  • run f() from mypkg and see the new info line test2

Error replication:

  • Start julia -p 2
  • run using mypkg
  • run f() from mypkg and get baseline output
  • edit source code to mypkg - add an info("test1")
  • run f() from mypkg and fail to see the new info line test1

My Julia versioninfo, running on latest Arch:

Julia Version 0.6.2
Commit d386e40 (2017-12-13 18:08 UTC)
Platform Info:
	OS: Linux (x86_64-pc-linux-gnu)
	CPU: AMD Opteron(TM) Processor 6276
	WORD_SIZE: 64
	BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Bulldozer)
	LAPACK: libopenblas
	LIBM: libm
	LLVM: libLLVM-3.9.1 (ORCJIT, bdver1)

Sometimes "no space left on device (ENOSPC)" error

Sometimes I get:

julia> using Revise

julia> using WriteVTK

ERROR (unhandled task failure): start_watching (File Monitor): no space left on device (ENOSPC)
Stacktrace:
 [1] uv_error at ./libuv.jl:68 [inlined]
 [2] start_watching(::FileMonitor) at ./poll.jl:350
 [3] wait(::FileMonitor) at ./poll.jl:428
 [4] watch_file(::String, ::Int64) at ./poll.jl:507
 [5] revise_file_queued(::String) at /home/kristoffer/.julia/v0.6/Revise/src/Revise.jl:430
 [6] (::Revise.##1#2)() at ./event.jl:73
ERROR (unhandled task failure): start_watching (File Monitor): no space left on device (ENOSPC)
Stacktrace:
 [1] uv_error at ./libuv.jl:68 [inlined]
 [2] start_watching(::FileMonitor) at ./poll.jl:350
 [3] wait(::FileMonitor) at ./poll.jl:428
 [4] watch_file(::String, ::Int64) at ./poll.jl:507
 [5] revise_file_queued(::String) at /home/kristoffer/.julia/v0.6/Revise/src/Revise.jl:430
 [6] (::Revise.##1#2)() at ./event.jl:73
ERROR (unhandled task failure): start_watching (File Monitor): no space left on device (ENOSPC)
Stacktrace:
 [1] uv_error at ./libuv.jl:68 [inlined]
 [2] start_watching(::FileMonitor) at ./poll.jl:350
 [3] wait(::FileMonitor) at ./poll.jl:428
 [4] watch_file(::String, ::Int64) at ./poll.jl:507
 [5] revise_file_queued(::String) at /home/kristoffer/.julia/v0.6/Revise/src/Revise.jl:430
 [6] (::Revise.##1#2)() at ./event.jl:73
ERROR (unhandled task failure): start_watching (File Monitor): no space left on device (ENOSPC)
Stacktrace:
 [1] uv_error at ./libuv.jl:68 [inlined]
 [2] start_watching(::FileMonitor) at ./poll.jl:350
 [3] wait(::FileMonitor) at ./poll.jl:428
 [4] watch_file(::String, ::Int64) at ./poll.jl:507
 [5] revise_file_queued(::String) at /home/kristoffer/.julia/v0.6/Revise/src/Revise.jl:430
 [6] (::Revise.##1#2)() at ./event.jl:73
julia> 

Option to turn it off

Sometime it would be nice to be able to turn Revise off on the fly. For instance if I want to compare one branch vs another. Or I want to run the code again before the changes take effect to then compare to after.

Just a suggestion, feel free to close as won't-fix.

Can't find `sysimg.jl` with out-of-tree builds of julia 0.6

using Revise fails when running Julia from an out-of-tree build with the following error:

julia> using Revise
INFO: Precompiling module Revise.
ERROR: LoadError: SystemError: realpath: No such file or directory
Stacktrace:
 [1] #systemerror#44 at ./error.jl:64 [inlined]
 [2] systemerror(::Symbol, ::Bool) at ./error.jl:64
 [3] realpath(::String) at ./path.jl:311
 [4] include_from_node1(::String) at ./loading.jl:576
 [5] include(::String) at ./sysimg.jl:14
 [6] anonymous at ./<missing>:2
while loading /home/tkluck/.julia/v0.6/Revise/src/Revise.jl, in expression starting on line 669
ERROR: Failed to precompile Revise to /home/tkluck/.julia/lib/v0.6/Revise.ji.
Stacktrace:
 [1] compilecache(::String) at ./loading.jl:710
 [2] _require(::Symbol) at ./loading.jl:497
 [3] require(::Symbol) at ./loading.jl:405

The error is coming from this line:

const sysimg_path =  # where `baremodule Base` is defined
    realpath(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", "base", "sysimg.jl"))

since there is no file sysimg.jl at that place. Adding a symlink as follows

~/src/julia/build-stable/base$ ln -s ../../base/sysimg.jl

solves the issue.

For reproducing such an out-of-tree build, one can use (in julia's top-level source directory):

$ make O=build-out-of-tree configure
$ make -C build-out-of-tree

I'm not comfortable speculating about whether this should be solved in Revise.jl or in the out-of-tree build scripts, but I'm happy to provide a patch given a few pointers. In any case, we could mitigate the issue in Revise by ignoring this error and not tracking Base in this case.

MethodError: no method matching parse_expr(..., ::LimeNumberNode, ...)

This happen when the source file has a begin ... end block, here is the error message:

julia> Revise.track(Test)
ERROR: MethodError: no method matching parse_expr!(::Dict{Module,Revise.ExprsSigs}, ::LineNumberNode, ::Symbol, ::Module)
Closest candidates are:
  parse_expr!(::Dict{Module,Revise.ExprsSigs}, ::Expr, ::Symbol, ::Module) at /home/atma/.julia/dev/Revise/src/parsing.jl:111
Stacktrace:
[...]

I found an apparent easy fix, but am not familiar enough with the codebase to be confident in it: replace the first lines of parse_expr by:

  if ex.head == :block
        for a in ex.args
            if !(a isa Expr) # or `a isa LineNumber` to be more conservative, but fails again with e.g. `begin 1 end` 
                continue
            end
            parse_expr!(md, a, file, mod)
        end
        return md
    end

I could open a PR, but would need some guidance for how to write a test.

Revise error due to `@nospecialize`

WARNING: failure to delete signature Revise.RelocatableExpr(:call, Any[:stmt_effect_free, Revise.RelocatableExpr(:macrocall, Any[Symbol("@nospecialize"), :(#= /Users/kfischer/Projects/julia-doublecheck/usr/share/julia/base/compiler/ssair/queries.jl:1 =#), :stmt], Any), Revise.RelocatableExpr(:(::), Any[:src, :IRCode], Any), Revise.RelocatableExpr(:(::), Any[:mod, :Module], Any)], Any) in module NotInferenceDontLookHere

The corresponding signature is:

function stmt_effect_free(@nospecialize(stmt), src, mod::Module)
    isa(stmt, Union{PiNode, PhiNode}) && return true
    isa(stmt, Union{ReturnNode, GotoNode, GotoIfNot}) && return false
    return effect_free(stmt, src, mod, true)
end

redefining struct

Since structs cannot be redefined, attempting to do so currently gives a failure to evaluate changes warning.

I wonder if this can be worked around by triggering a reload of the entire module in this case.

"Multiple paths detected" error on JuliaBox

Attempts to use Revise.jl on JuliaBox result in the "Multiple paths detected" error when a package appears in both the preinstalled packages directory and the custom packages directory.

The error can be reproduced in the old or new JuliaBox implementation, and occurs both inside notebooks and when running Julia in the terminal.

The problem appears to be due to the fact that a package exists in both the directory containing the preinstalled packages and the user installed packages.

The following example illustrates the multiple paths issue.

julia> using Revise

julia> using StaticArrays

ERROR (unhandled task failure): Multiple paths detected: String["/mnt/juliabox/.julia/lib/v0.6/StaticArrays.ji", "/home/jrun/.julia/lib/v0.6/StaticArrays.ji"]
Stacktrace:
 [1] parse_pkg_files(::Symbol) at /////////mnt/juliabox/.julia/v0.6/Revise/src/Revise.jl:299
 [2] watch_package_impl at /////////mnt/juliabox/.julia/v0.6/Revise/src/Revise.jl:573 [inlined]
 [3] (::Revise.##9#10{Symbol})() at ./event.jl:73
julia>

In my case, the StaticArrays package was installed as a dependency when I installed the AstroLib package. It was installed to the following directory...

/mnt/juliabox/.julia/v0.6

However, the same package is also present as a JuliaBox preinstalled package in the following directory...

/home/jrun/.julia/v0.6

It would be nice if Revise could be used within the JuliaBox environment.

Russ

Idea to run `Revise.track()` automatically on an entire project

Hi

I think it would be ideal if we could do Revise.track(filename) and this would also Revise.track() on all the import's, using's

One could do the following:
A file contains a list of all the file paths relevant to the project at hand
Revise goes through each, notes module name per file path
Revise goes through each, tries track on the file path
If track fails, find import and using statements, try tracking these first given the file (file path and module name) -> this uses a recursive function
Else move to next file path

Basically creating a tree

Don't forget to error if circle found (and tree cannot be built)

This way, one defines, in any order, the list of files used by a project, runs a Revise command once and everything is loaded and tracked

(I hope this is the correct place to write this)

Tracking Base

I'm tentatively migrating my tracing code to reuse the Revise.jl infrastructure, and so far so good, but I'm not sure how/if the track(Base) code works:

julia> using Revise

julia> empty!(Revise.new_files)
0-element Array{String,1}

julia> mainfile = joinpath(dirname(dirname(JULIA_HOME)), "base", "sysimg.jl")
"/Applications/Julia-0.6.app/Contents/Resources/base/sysimg.jl"

julia> Revise.parse_source(mainfile, Main, dirname(mainfile))
WARNING: omitting /Applications/Julia-0.6.app/Contents/Resources/base/sysimg.jl from revision tracking

julia> Revise.new_files
0-element Array{String,1}

julia> collect(keys(Revise.file2modules))
1-element Array{String,1}:
 "/Users/cedric/.julia/v0.6/Revise/src/Revise.jl"

Does it require building Julia from source? On OSX.

Anonymous functions

Revise currently doesn't handle anonymous functions changing, e.g.

module TestPrint
f = ()->println("Hello")
end

Changing the printed string will not revise properly. This makes some sense, because it's not necessarily clear how updates to the text affect anonymous functions. However, I think one could do a fairly decent job by performing an AST diff and if the anonymous functions appears in the same place in the AST as a previous anonymous function, update the code accordingly.

Building on top of Revise.jl

The fact that using Revise immediately turns it on is neat from a UX perspective, but doesn't it preclude building any other package on top of Revise? Eg. if I'm interested in Revise.parse_source, in my package X,

module X
using Revise: parse_source
...
end

I will accidentally trigger auto-revision behaviour for anyone importing X. Is there a way around that?

Packages with fancy `include` mechanisms

Followup to #10 (comment). Both DataFrames.jl and Plots.jl include files through complicated mechanisms. Plots.jl might be a challenge to handle reliably.

I wondered when this would come up. One option is to put a @require Revise, or a isdefined(Main, :Revise) in the init file, and then having DataFrames add the files "manually" with Revise.track(DataFrames, filename).

Revise.jl is already hooking into using to detect that a package is loaded. Is there a way to do the same with include?

problem with how file names are resolved

I'm getting errors on nightly whenever I have Revise loaded and try to load something innocuous like StatsBase. As far as I can tell it's because Revise is trying to load files from the current working directory:

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.2158 (2017-10-16 06:42 UTC)
 _/ |\__'_|_|_|\__'_|  |  master/eae7104bf (fork: 74 commits, 16 days)
|__/                   |  x86_64-pc-linux-gnu

julia> using Revise

julia> using StatsBase

ERROR (unhandled task failure): could not open file /home/dave/Downloads/julia-eae7104bf9/arraymacros.jl
Stacktrace:
 [1] include_relative(::Module, ::String) at ./loading.jl:533
 [2] include at ./sysimg.jl:14 [inlined]
 [3] include(::String) at /home/dave/.julia/v0.7/Compat/src/Compat.jl:3
 [4] eval(::Module, ::Expr) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:3
 [5] parse_module!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:525
 [6] parse_expr!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:458
 [7] parse_source!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::String, ::Symbol, ::Int64, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:404
 [8] parse_source!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::String, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:366
 [9] parse_source(::String, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:340
 [10] parse_pkg_files(::Symbol) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:304
 [11] watch_package_impl(::Symbol) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:571
 [12] (::getfield(Revise, Symbol("##9#10")){Symbol})() at ./event.jl:96
ERROR (unhandled task failure): could not open file /home/dave/Downloads/julia-eae7104bf9/bessel.jl
Stacktrace:
 [1] include_relative(::Module, ::String) at ./loading.jl:533
 [2] include at ./sysimg.jl:14 [inlined]
 [3] include(::String) at /home/dave/.julia/v0.7/SpecialFunctions/src/SpecialFunctions.jl:3
 [4] eval(::Module, ::Expr) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:3
 [5] parse_module!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:525
 [6] parse_expr!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:458
 [7] parse_source!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::String, ::Symbol, ::Int64, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:404
 [8] parse_source!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::String, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:366
 [9] parse_source(::String, ::Module, ::String) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:340
 [10] parse_pkg_files(::Symbol) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:304
 [11] watch_package_impl(::Symbol) at /home/dave/.julia/v0.7/Revise/src/Revise.jl:571
 [12] (::getfield(Revise, Symbol("##9#10")){Symbol})() at ./event.jl:96

(omitting some deprecation warnings)

WARNING: Could not load Revise

WARNING: Could not load Revise: InitError(:Revise, UndefVarError(:register_root_module)).

.juliarc.jl:

using OhMyREPL
using TerminalExtensions
atreplinit() do REPL
    @schedule begin
        sleep(0.1)
        try
            @eval using Revise
        catch err
            warn("Could not load Revise: $err.")
        end
    end
end

Is there a fix for this?

Behaviour of watch_file on FreeBSD is different

Revise.jl/src/Revise.jl

Lines 188 to 200 in 5754f39

function watch_files_via_dir(dirname)
watch_file(dirname) # this will block until there is a modification
latestfiles = String[]
wf = watched_files[dirname]
for file in wf.trackedfiles
path = joinpath(dirname, file)
if mtime(path) + 1 >= floor(wf.timestamp) # OSX rounds mtime up, see #22
push!(latestfiles, path)
end
end
updatetime!(wf)
latestfiles
end

On FreeBSD modifying a existed file which located at dir will not being caught by watch_dir(dir).

Revising stdlibs

On latest master I'm currently getting

ERROR: MethodError: no method matching getindex(::Revise.RelocatableExpr, ::Int64)
Stacktrace:
 [1] eval_revised!(::Revise.FMMaps, ::Module, ::Revise.FMMaps, ::Revise.FMMaps) at /Users/andreasnoack/.julia/packages/Revise/eTozG/src/Revise.jl:177
 [2] eval_revised(::OrderedCollections.OrderedDict{Module,Revise.FMMaps}, ::OrderedCollections.OrderedDict{Module,Revise.FMMaps}) at /Users/andreasnoack/.julia/packages/Revise/eTozG/src/Revise.jl:152
 [3] revise_file_now(::String) at /Users/andreasnoack/.julia/packages/Revise/eTozG/src/Revise.jl:345
 [4] revise(::REPL.REPLBackend) at /Users/andreasnoack/.julia/packages/Revise/eTozG/src/Revise.jl:398
 [5] macro expansion at /Users/andreasnoack/.julia/packages/Revise/eTozG/src/Revise.jl:652 [inlined]
 [6] (::getfield(Revise, Symbol("##41#43")){REPL.REPLBackend})() at ./task.jl:262

when trying to revise stdlibs. It seems to only happen when there is something to revise.

Automatic call to revise() in Juno?

Currently Revise works for me in the REPL
but not in Juno . It works! , at-least calling revise() does, but its not automatic.

julia Version 0.6.0
Commit 903644385b (2017-06-19 13:05 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake)

problem with UUID-qualified syntax in Requires.jl

Requires.jl in v0.7 uses UUIDs to resolve ambiguities, but Revise.jl has a problem with parsing that. I made an MWE package, the error message is

julia> using TestRequire

ERROR (unhandled task failure): type LineNumberNode has no field head
Stacktrace:
 [1] getproperty at ./sysimg.jl:18 [inlined]
 [2] is_linenumber(::LineNumberNode) at /home/tamas/.julia/packages/Revise/UMMk/src/delete_method.jl:68
 [3] is_trivial_block_wrapper(::Revise.RelocatableExpr) at /home/tamas/.julia/packages/Revise/UMMk/src/delete_method.jl:60
 [4] get_signature(::Revise.RelocatableExpr) at /home/tamas/.julia/packages/Revise/UMMk/src/delete_method.jl:10
 [5] parse_expr!(::Dict{Module,Revise.ExprsSigs}, ::Expr, ::Symbol, ::Module) at /home/tamas/.julia/packages/Revise/UMMk/src/parsing.jl:137
 [6] parse_source!(::Dict{Module,Revise.ExprsSigs}, ::Expr, ::Symbol, ::Module) at /home/tamas/.julia/packages/Revise/UMMk/src/parsing.jl:92
 [7] parse_module!(::Dict{Module,Revise.ExprsSigs}, ::Expr, ::Symbol, ::Module) at /home/tamas/.julia/packages/Revise/UMMk/src/parsing.jl:164
 [8] parse_expr!(::Dict{Module,Revise.ExprsSigs}, ::Expr, ::Symbol, ::Module) at /home/tamas/.julia/packages/Revise/UMMk/src/parsing.jl:121
 [9] parse_source!(::Dict{Module,Revise.ExprsSigs}, ::String, ::Symbol, ::Int64, ::Module) at /home/tamas/.julia/packages/Revise/UMMk/src/parsing.jl:70
 [10] parse_source!(::Dict{Module,Revise.ExprsSigs}, ::String, ::Module) at /home/tamas/.julia/packages/Revise/UMMk/src/parsing.jl:31
 [11] parse_source at /home/tamas/.julia/packages/Revise/UMMk/src/parsing.jl:14 [inlined]
 [12] parse_pkg_files(::Base.PkgId) at /home/tamas/.julia/packages/Revise/UMMk/src/pkgs.jl:55
 [13] _watch_package(::Base.PkgId) at /home/tamas/.julia/packages/Revise/UMMk/src/pkgs.jl:120
 [14] (::getfield(Revise, Symbol("##7#8")){Base.PkgId})() at ./task.jl:257
(v0.7) pkg> status
    Status `~/.julia/environments/v0.7/Project.toml`
  [dce04be8] ArgCheck v0.6.0
  [6e4b80f9] BenchmarkTools v0.3.1
  [34da2185] Compat v0.68.0
  [a93c6f00] DataFrames v0.11.6
  [1914dd2f] MacroTools v0.4.1
  [3defccca] MyPkg v0.1.0 [`~/src/julia-local-packages/MyPkg`]
  [8314cec4] PGFPlotsX v0.2.1+ [`~/src/julia-local-packages/PGFPlotsX`]
  [149e707d] PkgDev v0.2.1
  [ae029012] Requires v0.5.0
  [295af30f] Revise v0.4.1
  [4c63d2b9] StatsFuns v0.6.0

Error with module docstring

MWE, Julia 0.6:

""" Ahoy """
module FormulaBase  # in FormulaBase.jl

include("matching.jl")   # matching.jl can contain anything (even empty file)
blag() = 10000

end # module
julia> using Revise

julia> using FormulaBase

julia> FormulaBase.blag()
1000

#### change the blag return value

julia> FormulaBase.blag()
WARNING: replacing module FormulaBase
WARNING: failure to evaluate changes in Main
Core.@doc " Hey " module FormulaBase # /Users/cedric/Programa/RL/FormulaBase.jl, line 2: # /Users/cedric/Programa/RL/FormulaBase.jl, line 5:
    include("matching.jl") # /Users/cedric/Programa/RL/FormulaBase.jl, line 8:
    blag() = begin  # /Users/cedric/Programa/RL/FormulaBase.jl, line 8:
            10000
        end
    end
ERROR: UndefVarError: blag not defined

Unrelated question: how do you manage to keep the file info correct in the stack traces? In my own package, I can get the line number right, but the stack trace shows foo(::Int64) at ./none:5. Is it add_filename!?

"Multiple paths detected" error on JuliaPro

With a fresh installation of JuliaPro 0.6.1.1 on Ubuntu 16.04.3:

julia> Pkg.add("Revise")
INFO: Cloning cache of Revise from https://github.com/timholy/Revise.jl.git
INFO: Installing Revise v0.1.0
INFO: Package database updated
INFO: METADATA is out-of-date โ€” you may not have the latest version of Revise
INFO: Use `Pkg.update()` to get the latest versions of your packages

julia> using Revise
INFO: Recompiling stale cache file /home/yuval/.juliapro-0.6.1.1/lib/v0.6/Revise.ji for module Revise.
 
julia> using Compat

ERROR (unhandled task failure): Multiple paths detected: String["/home/yuval/.juliapro-0.6.1.1/lib/v0.6/Compat.ji", "/home/yuval/juliapro/JuliaPro-0.6.1.1/JuliaPro/pkgs-0.6.1.1/lib/v0.6/Compat.ji"]
Stacktrace:
 [1] parse_pkg_files(::Symbol) at /home/yuval/juliapro/JuliaPro-0.6.1.1/JuliaPro/pkgs-0.6.1.1/v0.6/Revise/src/Revise.jl:297
 [2] watch_package_impl at /home/yuval/juliapro/JuliaPro-0.6.1.1/JuliaPro/pkgs-0.6.1.1/v0.6/Revise/src/Revise.jl:571 [inlined]
 [3] (::Revise.##9#10{Symbol})() at ./event.jl:73

This seems to happen on importing or using any built-in package after using Revise.
The behavior is the same after running Pkg.update() (which updates Revise to version 0.1.1) and restarting Julia.

Error when using Revise with DataFrames

I consistently get this error when trying to use Revise with DataFrames on Julia 0.6.

julia> using Revise

julia> using DataFrames
INFO: Recompiling stale cache file /home/milan/.julia/lib/v0.6/DataFrames.ji for module DataFrames.

# EDIT file src/dataframerow/utils.jl

julia> 1
Revise is currently tracking the following files: String["/home/milan/.julia/StatsBase/src/misc.jl", "/home/milan/.julia/CategoricalArrays/src/CategoricalArrays.jl", "/home/milan/.julia/StatsBase/src/hist.jl", "/home/milan/.julia/StatsBase/src/weights.jl", "/home/milan/.julia/SpecialFunctions/src/SpecialFunctions.jl", "/home/milan/.julia/StatsBase/src/common.jl", "/home/milan/.julia/Revise/src/Revise.jl", "/home/milan/.julia/WeakRefStrings/src/WeakRefStrings.jl", "/home/milan/.julia/SpecialFunctions/src/deprecated.jl", "/home/milan/.julia/StatsBase/src/deprecates.jl", "/home/milan/.julia/StatsBase/src/cov.jl", "/home/milan/.julia/StatsBase/src/robust.jl", "/home/milan/.julia/CategoricalArrays/src/pool.jl", "/home/milan/.julia/SortingAlgorithms/src/SortingAlgorithms.jl", "/home/milan/.julia/CategoricalArrays/src/deprecated.jl", "/home/milan/.julia/DataFrames/src/DataFrames.jl", "/home/milan/.julia/CategoricalArrays/src/recode.jl", "/home/milan/.julia/StatsBase/src/moments.jl", "/home/milan/.julia/StatsBase/src/counts.jl", "/home/milan/.julia/StatsBase/src/sampling.jl", "/home/milan/.julia/DataStreams/src/DataStreams.jl", "/home/milan/.julia/StatsBase/src/ranking.jl", "/home/milan/.julia/StatsBase/src/deviation.jl", "/home/milan/.julia/SpecialFunctions/src/bessel.jl", "/home/milan/.julia/CategoricalArrays/src/array.jl", "/home/milan/.julia/CategoricalArrays/src/nullablearray.jl", "/home/milan/.julia/StatsBase/src/rankcorr.jl", "/home/milan/.julia/SpecialFunctions/src/erf.jl", "/home/milan/.julia/CategoricalArrays/src/subarray.jl", "/home/milan/.julia/StatsBase/src/signalcorr.jl", "/home/milan/.julia/StatsBase/src/toeplitzsolvers.jl", "/home/milan/.julia/Nulls/src/Nulls.jl", "/home/milan/.julia/CategoricalArrays/src/typedefs.jl", "/home/milan/.julia/SpecialFunctions/src/gamma.jl", "/home/milan/.julia/StatsBase/src/statmodels.jl", "/home/milan/.julia/Reexport/src/Reexport.jl", "/home/milan/.julia/StatsBase/src/StatsBase.jl", "/home/milan/.julia/CategoricalArrays/src/value.jl", "/home/milan/.julia/StatsBase/src/scalarstats.jl", "/home/milan/.julia/StatsBase/src/empirical.jl", "/home/milan/.julia/CategoricalArrays/src/extras.jl", "/home/milan/.julia/CategoricalArrays/src/buildfields.jl"]
ERROR (unhandled task failure): /home/milan/.julia/DataFrames/src/dataframerow/utils.jl is not currently being tracked.
Stacktrace:
 [1] revise_file_now(::String) at /home/milan/.julia/Revise/src/Revise.jl:609
 [2] revise() at /home/milan/.julia/Revise/src/Revise.jl:633
 [3] macro expansion at /home/milan/.julia/Revise/src/Revise.jl:772 [inlined]
 [4] (::Revise.##17#18{Base.REPL.REPLBackend})() at ./event.jl:73

Revise not picking up what module changes comes from

Let's say i have two julia packages:

  • Julz โ€” a framework that does stuff like loads files
  • Tokamak.jl โ€”ย a package that uses the Julz framework

I recently added the ability to use revise in Julz // see: djsegal/Julz.jl@34a1302


However, when changing files in Tokamak.jl,

  • I get a notice that Revise knows it was changed (this is good!)
  • but Revise thinks the function is in the Main module (this is bad!)

This is shown below (see the WARNING: replacing docs... line)

julia> Tokamak.Q_E()
9.381818181818183

julia> # edit Q_E function

julia> Tokamak.Q_E()
WARNING: replacing docs for 'Q_E :: Tuple{}' in module 'Main'.
9.381818181818183

Example not working with vim

Somehow I cannot get the example to work. This is on a fresh julia 0.6 installation:

julia> using Revise

julia> using Example

julia> Example.f()
ERROR: UndefVarError: f not defined
# now define f in Example.jl
julia> WARNING: /home/bla/.julia/v0.6/Example/src/Example.jl changed in ways that Revise cannot track. You will likely have to restart your Julia session.
julia> 

julia> Example.f()
ERROR: UndefVarError: f not defined

julia> versioninfo()
Pkg.Julia Version 0.6.0
Commit 9036443 (2017-06-19 13:05 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)

julia> Pkg.status()
2 required packages:
 - Example                       0.4.1              526e34fd (dirty)
 - Revise                        0.0.1

I have the feeling I am missing something.

handling stale functions

When changing a source file, sometimes you change the signature of functions. Revise defines the new functions, but the old functions still pollute the run-time. Many times, the source still includes calls to the old function signature (because nobody remembers to change all calls), so they silently run. Having just encountered such a potential pitfall, I'm putting it out here.

In any case, if functions from a Module / file could be identified in the run-time, then all functions from a "revised" file about to be run, can be redefined to indicate them being stale. And then the redefinitions would overwrite them again.

This problem doesn't necessarily have a simple solution, or one which should be under Revise.jl.

UndefVarError: async_steal_repl_backend not defined

Hi

I just downloaded julia 0.7 (v"0.7.0-beta2.0") and added Revise to the .julia/config/startup.jl as described here: https://timholy.github.io/Revise.jl/latest/config.html

However, I get the error that Revise.async_steal_repl_backend is not defined

If I instead do:
@async Revise.steal_repl_backend()
Revise just does not work

At times, I was getting an error that Revise could not be loaded during startup of julia (as a warning), but that warning has disappeared, though I do not know why

EDIT: In Pkg, using st, I see: [295af30f] Revise v0.5.4

Not sure it's working...

I'm making some changes to a function within VS Code and saving. The first couple of times, Revise appears to catch the change. If I revert the change (either using ^Z or manually changing things back, like deleting a line) and save the file, Revise sometimes fails to catch the change, even after a manual revise().

Generated functions and world age

Generated functions only use the functions as they were in the world age where they were defined.

Some operations that should not be attempted include:
Calling any function that is defined after the body of the generated function.

This means:

module Tmp
f() = 3
@generated g() = f()
end
julia> using Revise, Tmp

julia> Tmp.f()
3

julia> Tmp.g()
3

# Change f
julia> Tmp.f()
WARNING: Method definition f() in module Tmp at /Users/cedric/Programa/RL/Tmp.jl:2 overwritten at /Users/cedric/Programa/RL/Tmp.jl:2.
4

julia> Tmp.g()
3

Furthermore, because the rexes are stored in an unordered set, I believe that changing both Tmp.f and Tmp.g (to g() = f()+0, say) would have a 50% chance of returning 3 or 4. Same with macros.

Changes to macros are ignored

I've been poking at Revise and found an issue with macros, that you're probably already aware of:

module B
macro some_val()
    4   # change here
end

f() = @some_val()   # f() doesn't get updated
end

Double revision upon single file save (0.7)

I have a directory with the following two files:

# test.jl
function __main__()
    println("revise is...")
end
# watch.jl
ENV["JULIA_REVISE"] = "manual"
using Revise, FileWatching

file = joinpath(@__DIR__, "test.jl")

include(file)
Revise.track(file)

__main__()

while true
    event = watch_file(file)
    if event.changed
        revise()
        println("file changed; re-evaluating __main__.")
        @eval __main__()
    end
end

The idea is to support re-running a computation whenever a script or its dependencies have changed.

I notice the following behavior when I run Julia from the terminal, wait for the script to start listening for changes, and then update test.jl to print "revise is... magic", then save the file:

$ julia watch.jl
revise is...
file changed; re-evaluating __main__.
revise is...
file changed; re-evaluating __main__.
revise is... magic

For some reason, revise is... is printed twice: the second copy is printed immediately once I save the file, with the magic version following it about a second after.

Julia version info:

julia> versioninfo()
Julia Version 0.7.0-DEV.3476
Commit 625923f993 (2018-01-19 15:54 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin16.7.0)
  CPU: Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)
Environment:
  JULIA_EDITOR = subl

I'm going to pull the latest master now to see if the issue goes away. Update: Same issue on today's master:

Julia Version 0.7.0-DEV.3704
Commit f37d8d7a60 (2018-02-03 03:17 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin16.7.0)
  CPU: Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)
Environment:
  JULIA_EDITOR = subl

Tracking an empty file

I'll see if I can reproduce when I get a chance, but leaving this for reference...

I had a utils.jl file that loads some data. using MyPackage was broken because of some error in loading data, so I commented out everything in "utils.jl" but left the `Revise.track("utils.jl"), i.e. I was tracking an empty file. It complained that "utils.jl" does not exist and when I uncomment the content, it still says "utils.jl" does not exist.

I'm probably doing something silly, but I can't seem to get it to see this file again.

Error when testing Interpolations.jl with Revise.jl loaded

When running the Interpolations.jl tests without Revise.jl loaded, it works but spews a lot of deprications:

...v0.6/Interpolations/test(fbot/deps)  >> julia --startup-file=no                                                                                                                                                 
               _                                                                                                                                                                                                   
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0 (2017-06-19 13:05 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  x86_64-pc-linux-gnu

julia> include("runtests.jl")                                                                                                                                                                                      
WARNING: @functorize is deprecated as functor objects are no longer supported in julia                                                                                                                             
Stacktrace:                                                                                                                                                                                                        
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:70                                                                                                                                                             
 [2] macro expansion at /home/mauro/.julia/v0.6/Compat/src/deprecated.jl:4 [inlined]                                                                                                                               
 [3] _promote_mul(::Type, ::DataType) at /home/mauro/.julia/v0.6/Interpolations/src/b-splines/indexing.jl:87                                                                                                       
...

With Revise.jl it errors:

...v0.6/Interpolations/test(fbot/deps)  >> julia --startup-file=no                                                                                                                                                 
               _                                                                                                                                                                                                   
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0 (2017-06-19 13:05 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  x86_64-pc-linux-gnu

julia> using Revise                                                                                                                                                                                                
                                                                                                                                                                                                                   
julia> include("runtests.jl")                                                                                                                                                                                      
WARNING: WARNING: Error During Test                                                                                                                    
julia> using Revise                                  

julia> include("runtests.jl")                        
WARNING: WARNING: Error During Test                  
  Test threw an exception of type ErrorException     
  Expression: isnan(@inferred(getindex(etpf, -2.5))) 
  task switch not allowed from inside staged nor pure functions                                           
  Stacktrace:                                        
   [1] try_yieldto(::Base.##296#297{Task}, ::Task) at ./event.jl:180                                      
   [2] wait() at ./event.jl:234                      
   [3] uv_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:811                                    
   [4] unsafe_write(::Base.TTY, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:832                                
   [5] print at ./strings/io.jl:122 [inlined]        
   [6] #with_output_color#509(::Bool, ::Function, ::Function, ::Symbol, ::Base.TTY, ::String, ::Vararg{String,N} where N) at ./util.jl:404                [7] (::Base.#kw##with_output_color)(::Array{Any,1}, ::Base.#with_output_color, ::Function, ::Symbol, ::Base.TTY, ::String, ::Vararg{String,N} where N) at ./<missing>:0
   [8] #print_with_color#510(::Bool, ::Function, ::Symbol, ::Base.TTY, ::String, ::Vararg{String,N} where N) at ./util.jl:417                             [9] (::Base.#kw##print_with_color)(::Array{Any,1}, ::Base.#print_with_color, ::Symbol, ::Base.TTY, ::String, ::Vararg{String,N} where N) at ./<missing>:0
   [10] #warn#520(::String, ::Bool, ::Tuple{StackFrame,String,Int64}, ::Array{Ptr{Void},1}, ::String, ::Int64, ::Function, ::Base.TTY, ::String, ::Vararg{String,N} where N) at ./util.jl:563
   [11] (::Base.#kw##warn)(::Array{Any,1}, ::Base.#warn, ::Base.TTY, ::String) at ./<missing>:0           
   [12] #warn#521(::Array{Any,1}, ::Function, ::String, ::Vararg{String,N} where N) at ./util.jl:585      
   [13] (::Base.#kw##warn)(::Array{Any,1}, ::Base.#warn, ::String) at ./<missing>:0                       
   [14] _depwarn(::String, ::Base.JLOptions, ::Array{Ptr{Void},1}, ::StackFrame) at ./deprecated.jl:79    
   [15] depwarn(::String, ::Symbol) at ./deprecated.jl:71                                                 
   [16] macro expansion at ~/.julia/v0.6/Compat/src/deprecated.jl:4 [inlined]                   
   [17] _promote_mul(::Type, ::DataType) at ~/.julia/v0.6/Interpolations/src/b-splines/indexing.jl:87                                        
   [18] mapfoldl_impl(::Base.#identity, ::Interpolations.#_promote_mul, ::Type{T} where T, ::Tuple{DataType}, ::Int64) at ./reduce.jl:43                  [19] getindex_return_type(::Type{Interpolations.BSplineInterpolation{Float64,1,Array{Float64,1},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,0}}, ::Tuple{DataType}) at ~/.julia/v0.6/Interpolations/src/b-splines/indexing.jl:90
   [20] getindex_impl(::Type{Interpolations.FilledExtrapolation{Float64,1,Interpolations.BSplineInterpolation{Float64,1,Array{Float64,1},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,0},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,Float64}}, ::Tuple{DataType}) at ~/.julia/v0.6/Interpolations/src/extrapolation/filled.jl:23
   [21] getindex(...) at ~/.julia/v0.6/Interpolations/src/extrapolation/filled.jl:38            
   [22] include_from_node1(::String) at ./loading.jl:569                                                  
   [23] include(::String) at ./sysimg.jl:14          
   [24] include_from_node1(::String) at ./loading.jl:569                                                  
   [25] include(::String) at ./sysimg.jl:14          
   [26] eval(::Module, ::Any) at ./boot.jl:235       
   [27] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66                                   
   [28] macro expansion at ~/.julia/v0.6/Revise/src/Revise.jl:644 [inlined]                     
   [29] (::Revise.##11#12{Base.REPL.REPLBackend})() at ./event.jl:73                                      
ERROR: LoadError: LoadError: There was an error during testing                                            
while loading ~/.julia/v0.6/Interpolations/test/extrapolation/runtests.jl, in expression starting on line 24                                 
while loading ~/.julia/v0.6/Interpolations/test/runtests.jl, in expression starting on line 8   

Tracking stdlib packages (eg Test)

I was hacking yesterday on Test and I tried Revise, but it didn't seem to pick up changes.
It might have something to do with the fact that Test etc still go into the sysimage, but are not longer part of Base?

Revise when editing/running on two different systems

Hello,

Revise is not working for me; I managed to track it down. It is because I edit my files on one system (call it system A) and Julia is running on another (call it system B; some hpc systems do not have a decent editor :) ).

I confirmed that if you watch_file(file) on system A, and touch file on system B, the change is not detected on System A (watch_file is still blocking).

I have also found out that poll_file can get around that problem by polling every t seconds. However, it turns out that poll_file only works for files, when watch_file works for directories too. Looked at the code and it watches the directory. I can implement recursive polling on a directory, but not sure if it leads to a bottleneck.

Is there a clean way to get around this or fix it? I appreciate any help :)

Not sure if this qualifies as an issue, but thought it is good to leave it here if someone encounters the same issue (it will probably be lost on discourse).

Thanks for a great package anyway!

Corner case with Pkg.rm

Probably not worth to spend time on this, but thought to report it anyways.

julia> using Revise
INFO: Precompiling module Revise.

julia> Pkg.rm("Revise")
INFO: Removing Revise (unregistered)
ERROR: SystemError (with Revise): rmdir: Directory not empty
Stacktrace:
 [1] #systemerror#44 at .\error.jl:64 [inlined]
 [2] (::Base.#kw##systemerror)WARNING: (C:\Users\Mus\.julia\v0.6\Revise\src\Revise.jl is not an existing file, Revise is not watching::
Array{Any,1}, ::Base.#systemerror, ::Symbol, ::Bool) at .\<missing>:0
 [3] #rm#7(::Bool, ::Bool, ::Function, ::String) at .\file.jl:163
 [4] (::Base.Filesystem.#kw##rm)(::Array{Any,1}, ::Base.Filesystem.#rm, ::String) at .\<missing>:0
 [5] rename(::String, ::String) at .\file.jl:511
 [6] remove(::String) at .\pkg\write.jl:61
 [7] rm(::String) at .\pkg\entry.jl:84
 [8] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#rm,Tuple{String}})() at .\pkg\dir.jl:36
 [9] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#rm,Tuple{String}}, ::String) at .\file.jl:59
 [10] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N} where N) at .\pkg\dir.jl:36
 [11] rm(::String) at .\pkg\pkg.jl:108

REPL auto mode not working

Can't get automatic revise() calls from the REPL to work.

The following is a M(not)WE:

test_revise.jl

using Revise

include("./test_module.jl")
using ReviseTestModule

Revise.track(ReviseTestModule, joinpath(dirname(Base.source_path()),"test_module.jl"))

test_module.jl

module ReviseTestModule
export testfunc
testfunc(x) = x^2 + 1
end

And the REPL session (with version info embedded)

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1257 (2017-08-06 00:04 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit ae17198720* (37 days old master)
|__/                   |  x86_64-linux-gnu

julia> include("test_revise.jl")

julia> testfunc(0)
1
####### changing test_module.jl here to have `testfunc(x) = x^2 + 2`
julia> testfunc(0)    ## should recompile and return 2
1

The Package tests run fine. But, admittedly, it is hard to automatically test an interactive REPL. And as evolutionary bugology dictates this is where bugs will hide. Seems steal_repl_backend() is running alright, but there is both Base.active_repl and Base.active_repl_backend which left me confused. Anybody else seeing this? Is it reproducing? Which versions are afflicted?

Cannot update module on Julia master

I am not sure if I am using Revise.jl correctly...

julia> using Revise

julia> using Example

julia> Example.f()
ERROR: UndefVarError: f not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:14
 [2] top-level scope

julia> # Add line `f() = pi` in ~/.julia/v0.7/Example/src/Example.jl

julia> revise()
WARNING: Base.Void is deprecated, use Nothing instead.
  likely near no file:0
WARNING: Base.Void is deprecated, use Nothing instead.
  likely near no file:0
WARNING: Base.Void is deprecated, use Nothing instead.
  likely near no file:0
WARNING: Base.Void is deprecated, use Nothing instead.
  likely near no file:0

julia> Example.f()
ERROR: UndefVarError: f not defined
Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./sysimg.jl:14
 [2] top-level scope

julia> versioninfo()
Julia Version 0.7.0-DEV.3183
Commit 4b74a7416 (2017-12-25 07:17 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake)
Environment:
  JULIA_REVISE = manual

julia> Pkg.status("Revise")
 - Revise                        0.2.0+             master

Bad line numbering in included files

# DummyMod.jl
module DummyMod
include("incl.jl")
end

# In incl.jl:

0
0
1
2
3
4
5
6
7
8


function foo(x)
    return x+5
end

foo(y::Int) = y-51

At the REPL:

julia> using Revise, DummyMod

julia> methods(DummyMod.foo)
# 2 methods for generic function "foo":
foo(y::Int64) in DummyMod at /Users/cedric/Programa/RL/notebooks/incl.jl:17
foo(x) in DummyMod at /Users/cedric/Programa/RL/notebooks/incl.jl:14

# modify the code

julia> methods(DummyMod.foo)
# 2 methods for generic function "foo":
foo(y::Int64) in DummyMod at /Users/cedric/Programa/RL/notebooks/incl.jl:2
foo(x) in DummyMod at /Users/cedric/Programa/RL/notebooks/incl.jl:4

Adding a new submodule causes UndefVarError

Initial test.jl:

module Test
end
julia> using Revise 
julia> using Test

Then change test.jl to:

module Test

module Sub
end

end

Back in the REPL,

julia> 1
ERROR (unhandled task failure): UndefVarError: Sub not defined
Stacktrace:
 [1] parse_module!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:428
 [2] parse_expr!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:379
 [3] parse_source!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:362
 [4] parse_module!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:430
 [5] parse_expr!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::Expr, ::Symbol, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:379
 [6] parse_source!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::String, ::Symbol, ::Int64, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:350
 [7] parse_source!(::Dict{Module,DataStructures.OrderedSet{Revise.RelocatableExpr}}, ::String, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:328
 [8] parse_source(::String, ::Module, ::Void) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:308
 [9] revise_file_now(::String) at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:496
 [10] revise() at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:517
 [11] macro expansion at /Users/malmaud/.julia/v0.6/Revise/src/Revise.jl:643 [inlined]
 [12] (::Revise.##11#12{Base.REPL.REPLBackend})() at ./event.jl:73

revise delete for kwargs?

On Revise v0.5.4, I ran into this:

โ”Œ Error: failure to delete signature :(_dump_function_linfo_native(linfo::Core.MethodInstance, world::UInt, wrapper::Bool, syntax::Symbol=:att)) in module InteractiveUtils
โ”” @ Revise ~/.julia/packages/Revise/iORQ/src/Revise.jl:141
ArgumentError: expected :(::) expression, got ex.head = kwโ”Œ Error: failure to delete signature :(_dump_function_linfo_llvm(linfo::Core.MethodInstance, world::UInt, wrapper::Bool, strip_ir_metadata::Bool, dump_module::Bool, optimize::Bool=true, params::CodegenParams=CodegenParams())) in module InteractiveUtils

Error precompiling Revise

julia VERSION is v"0.6.2"

Wanted to try Revise instead of continuing to use my own
But get this following error

Can anyone help please?
Thanks

`
using Revise

INFO: Precompiling module Revise.
WARNING: Module Compat with uuid 809291431185465 is missing from the cache.
This may mean module Compat does not support precompilation but is imported by a module that does.
ERROR: LoadError:
Declaring precompile(false) is not allowed in files that are being precompiled.
Stacktrace:
[1]
_require(::Symbol) at ./loading.jl:455
[2] require(::Symbol) at ./loading.jl:405
[3] _include_from_serialized(::String) at ./loading.jl:157
[4] _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:200
[5] _require_search_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:236
[6] _require(::Symbol) at ./loading.jl:441
[7] require(::Symbol) at ./loading.jl:405
[8] include_from_node1(::String) at ./loading.jl:576
[9] include(::String) at ./sysimg.jl:14
[10] anonymous at ./:2
while loading /Users/imran/.julia/v0.6/Revise/src/Revise.jl, in expression starting on line 7`

Occasional segfault

I've been using this heavily. Mostly working great - but occasionally it will segfault upon loading the new code. Doesn't happen often enough for me to have tried to track it down yet, but I figured I'd report it here for general awareness.

Callbacks for changes [feature suggestion]

It would be useful to allow registering callbacks so that other parts of the app would be notified of changes. This would allow the reuse of Revise's functionality for other features, without the need to set up extra file watchers.

Line numbers

One longstanding issue is the fact that if you load a package, and then add some code at line 100, code for later (unmodified) functions will show up in backtraces with the wrong line numbers. Aside from re-evaluating the entire module (#41), I'm not sure there's a good solution, but I've wondered a bit about whether there could be some extra layer of indirection to look up "living" line numbers. Since this is of relevance for debuggers too, CCing @Keno to see if he has any ideas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.