Revise package does not seem to work for me

Hi there
I have just tried to install Revise and the usage example given in Home · Revise.jl does not seem to work as expected. I was wondering if someone could point out what I am doing wrong?

The full list of what I am doing is given below, but basically I install Revise, install Example, type “using Revise”, “using Example” and call the function in Example to print “hello, world” to the screen. Then I modify the code in Example.jl so that the message begins with “hi” instead of “hello”, call the function again, but still get the same result. So Revise doesn’t seem to have realised that I have modified the file.

Have I missed some step in installing or using Revise?

many thanks for any help.

(@v1.4) pkg> add Revise
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Resolving package versions...
   Updating `~/.julia/environments/v1.4/Project.toml`
  [295af30f] + Revise v2.7.3
   Updating `~/.julia/environments/v1.4/Manifest.toml`
  [da1fd8a2] + CodeTracking v0.5.11
  [aa1ae85d] + JuliaInterpreter v0.7.24
  [6f1432cf] + LoweredCodeUtils v0.4.6
  [bac558e1] + OrderedCollections v1.3.0
  [295af30f] + Revise v2.7.3
  [7b1f6079] + FileWatching 

(@v1.4) pkg> dev Example
    Cloning git-repo `https://github.com/JuliaLang/Example.jl.git`
  Resolving package versions...
   Updating `~/.julia/environments/v1.4/Project.toml`
  [7876af07] + Example v0.5.4 [`~/.julia/dev/Example`]
   Updating `~/.julia/environments/v1.4/Manifest.toml`
  [7876af07] + Example v0.5.4 [`~/.julia/dev/Example`]

(@v1.4) pkg> ^C

julia> using Revise

julia> using Example
[ Info: Precompiling Example [7876af07-990d-54b4-ab0e-23690620f79a]

julia> hello("world")
"Hello, world"

julia> hello("world")
"Hello, world"

julia> 

Sometimes I have the problem that Revise does not keep up with the updates I do in the code, so I made an habit always call revise(); method_I_just_changed(), can you check if this works for you?

Sorry to ask but often I forget it… did you save the file after you modified ?

thank you for the suggestion, but this unfortunately does not work.

very definitely saved! (and when I exit Julia, restart it and call the function again I get the expected message “hi, world”)

Looking with interest at this, I too seem to experience this kind of issue. I haven’t had a chance to really debug it.

If I type “test Revise” in the pkg Repl mode I find that 5 tests failed. Is this normal or expected? Maybe version 2.7.3 of Revise is not fully compatible with version 1.4.2 of Julia?

Test Summary:                             | Pass  Fail  Broken  Total
Revise                                    |  639     5       1    645
  PkgData                                 |    1                    1
  Package contents                        |    1                    1
  LineSkipping                            |    8                    8
  Equality and hashing                    |    5                    5
  Parse errors                            |    4                    4
  Signature extraction                    |    4                    4
  Comparison and line numbering           |   73     2       1     76
  Display                                 |    7                    7
  File paths                              |  209                  209
  Base & stdlib file paths                |    4     1              5
  Recursive types (issue #417)            |    1                    1
  Cross-module extension                  |    6                    6
  @__FILE__                               |    2                    2
  Module docstring                        |    6                    6
  Changing docstring                      |    3                    3
  Undef in docstrings                     |   72                   72
  Macro docstrings (issue #309)           |    4                    4
  Changing @inline annotations            |   16                   16
  Revising macros                         |    7                    7
  More arg-modifying macros               |    4                    4
  Line numbers                            |    5                    5
  Line numbers in backtraces and warnings |    4     2              6
  New submodules                          |    3                    3
  Timing (issue #341)                     |    3                    3
  Method deletion                         |   60                   60
  revise_file_now                         |    4                    4
  Evaled toplevel                         |    4                    4
  Revision errors                         |   37                   37
  Retry on InterruptException             |   17                   17
  get_def                                 |    7                    7
  Pkg exclusion                           |    3                    3
  Manual track                            |   20                   20
  Auto-track user scripts                 |    4                    4
  Distributed                             |   15                   15
  Git                                     |    2                    2
  Recipes                                 |   11                   11
  CodeTracking #48                        |    1                    1
  Methods at REPL                         |                     No tests
  baremodule                              |    2                    2
ERROR: LoadError: Some tests did not pass: 639 passed, 5 failed, 0 errored, 1 broken.
in expression starting at /tcenas/home/anderson/.julia/packages/Revise/BqeJF/test/runtests.jl:78
ERROR: Package Revise errored during testing

I am using version 2.7.3 of Revise and 1.4.2 of Julia, and my output is considerably different:

    Testing Revise
Status `/tmp/jl_LpfS90/Manifest.toml`
  [aafaddc9] CatIndices v0.2.1
  [da1fd8a2] CodeTracking v0.5.11
  [dc8bdbbb] CustomUnitRanges v1.0.0
  [340492b5] EndpointRanges v0.2.0
  [97e2ac4a] EponymTuples v0.2.2
  [7876af07] Example v0.5.3
  [9b13fd28] IndirectArrays v0.5.1
  [aa1ae85d] JuliaInterpreter v0.7.24
  [6f1432cf] LoweredCodeUtils v0.4.6
  [dbb5928d] MappedArrays v0.2.2
  [6fe1bfb0] OffsetArrays v1.1.2
  [bac558e1] OrderedCollections v1.3.0
  [ae029012] Requires v1.0.1
  [295af30f] Revise v2.7.3
  [d5f540fe] RoundingIntegers v0.2.0
  [2a0f44e3] Base64 
  [ade2ca70] Dates 
  [8ba89e20] Distributed 
  [7b1f6079] FileWatching 
  [b77e0a4c] InteractiveUtils 
  [76f85450] LibGit2 
  [8f399da3] Libdl 
  [56ddb016] Logging 
  [d6f4376e] Markdown 
  [44cfe95a] Pkg 
  [de0858da] Printf 
  [3fa0cd96] REPL 
  [9a3f8284] Random 
  [ea8e919c] SHA 
  [9e88b42a] Serialization 
  [6462fe0b] Sockets 
  [8dfed614] Test 
  [cf7118a7] UUIDs 
  [4ec0a83e] Unicode 
Skipping Base.active_repl
Skipping Base.active_repl_backend
Revise is currently tracking the following files in ReviseFileNow [top-level]: ["src/ReviseFileNow.jl"]
[ Info: tracking Base
┌ Warning: skipping git tests because Revise is not under development
└ @ Main ~/.julia/packages/Revise/BqeJF/test/runtests.jl:2383
extra
[ Info: tracking Pkg
┌ Warning: skipping Core.Compiler tests due to lack of git repo
└ @ Main ~/.julia/packages/Revise/BqeJF/test/runtests.jl:2491
┌ Warning: REPL tests skipped
└ @ Main ~/.julia/packages/Revise/BqeJF/test/runtests.jl:2534
Test Summary: | Pass  Broken  Total
Revise        |  644       1    645
Test Summary: | Pass  Total
Utilities     |    3      3
 Generating  project A2D:
    A2D/Project.toml
    A2D/src/A2D.jl
Path `/tmp/jl_MNrVKM/A2D` exists and looks like the correct package. Using existing path.
  Resolving package versions...
    Cloning default registries into `/tmp/jl_MNrVKM`
   Updating `/tmp/jl_MNrVKM/environments/v1.4/Project.toml`
  [155aef8e] + A2D v0.1.0 [`/tmp/jl_MNrVKM/A2D`]
   Updating `/tmp/jl_MNrVKM/environments/v1.4/Manifest.toml`
  [155aef8e] + A2D v0.1.0 [`/tmp/jl_MNrVKM/A2D`]
Path `/tmp/jl_MNrVKM/dev/A2D` exists and looks like the correct package. Using existing path.
  Resolving package versions...
    Cloning default registries into `/tmp/jl_MNrVKM`
   Updating `/tmp/jl_MNrVKM/environments/v1.4/Project.toml`
  [155aef8e] ~ A2D v0.1.0 [`/tmp/jl_MNrVKM/A2D`] ⇒ v0.1.0 [`/tmp/jl_MNrVKM/dev/A2D`]
   Updating `/tmp/jl_MNrVKM/environments/v1.4/Manifest.toml`
  [155aef8e] ~ A2D v0.1.0 [`/tmp/jl_MNrVKM/A2D`] ⇒ v0.1.0 [`/tmp/jl_MNrVKM/dev/A2D`]
Path `/tmp/jl_MNrVKM/A2D` exists and looks like the correct package. Using existing path.
  Resolving package versions...
    Cloning default registries into `/tmp/jl_MNrVKM`
   Updating `/tmp/jl_MNrVKM/environments/v1.4/Project.toml`
  [155aef8e] ~ A2D v0.1.0 [`/tmp/jl_MNrVKM/dev/A2D`] ⇒ v0.1.0 [`/tmp/jl_MNrVKM/A2D`]
   Updating `/tmp/jl_MNrVKM/environments/v1.4/Manifest.toml`
  [155aef8e] ~ A2D v0.1.0 [`/tmp/jl_MNrVKM/dev/A2D`] ⇒ v0.1.0 [`/tmp/jl_MNrVKM/A2D`]
Test Summary:      | Pass  Total
Switching free/dev |  125    125
 Generating  project DepPkg371:
    DepPkg371/Project.toml
    DepPkg371/src/DepPkg371.jl
[ Info: A warning about not having OrderedCollection in dependencies is expected
┌ Warning: Package DepPkg371 does not have OrderedCollections in its dependencies:
│ - If you have DepPkg371 checked out for development and have
│   added OrderedCollections as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with DepPkg371
└ Loading OrderedCollections into DepPkg371 from project dependency, future warnings for DepPkg371 are suppressed.
Test Summary:                    | Pass  Total
Broken dependencies (issue #371) |    2      2
Test Summary:                          | Pass  Total
Non-jl include_dependency (issue #388) |    4      4
┌ Warning: /tmp/3dp4sGMhsb/DeletedFile/src/g.jl no longer exists, deleting all methods
└ @ Revise ~/.julia/packages/Revise/BqeJF/src/Revise.jl:713
Test Summary:           | Pass  Total
New files & Requires.jl |   34     34
Test Summary: | Pass  Total
entr          |   16     16
Test Summary:     | Pass  Total
entr with modules |    1      1
Test Summary:       | Pass  Total
entr with all files |    4      4
Test Summary: | Pass  Total
callbacks     |    4      4
beginning cleanup
Test Summary: | Pass  Total
Cleanup       |    1      1
Test Summary: | Pass  Total
Backedges     |    9      9
beginning signatures tests
 27.415769 seconds (56.22 M allocations: 1.935 GiB, 2.36% gc time)
Test Summary:   | Pass  Total
Base signatures |    2      2
    Testing Revise tests passed 

Now that is interesting. I wonder why the test results are different when we are both using the same versions?
The 5 tests that fail for me are detailed below, but looking at the runtests.jl file unfortunately didn’t bring any enlightenment as to what the failures actually are or how significant they are, or what caused them.

Comparison and line numbering: Test Failed at /tcenas/home/anderson/.julia/packages/Revise/BqeJF/test/runtests.jl:332
Comparison and line numbering: Test Failed at /tcenas/home/anderson/.julia/packages/Revise/BqeJF/test/runtests.jl:340
Base & stdlib file paths: Test Failed at /tcenas/home/anderson/.julia/packages/Revise/BqeJF/test/runtests.jl:745
Line numbers in backtraces and warnings: Test Failed at /tcenas/home/anderson/.julia/packages/Revise/BqeJF/test/runtests.jl:1336
Line numbers in backtraces and warnings: Test Failed at /tcenas/home/anderson/.julia/packages/Revise/BqeJF/test/runtests.jl:1360

I give up on Revise and put this function into my code:

function restart()
   atexit() do
       run(`$(Base.julia_cmd())`)
   end
   exit()
end

then I just call the function and julia automatically exits and restarts then when I run my Julia program again it picks up any changes that have been made to modules.

Not elegant, but the best solution I can find.

( the ‘restart’ function originally by fredrikekre, thanks!)