I have a project called VCLR
, and am trying to get Revise.jl to work, but it seems like it doesn’t do anything at all.
I have a folder structure like this:
VCLR
├── data
│ └── ... data files ...
├── Project.toml
├── README.md
├── src
│ └── VCLR.jl
│ └── ... lots of other files ...
With Project.toml
name = "VCLR"
uuid = "87991b44-5e96-4a8e-9f69-41755a642646"
authors = ["Alice Ryhl <alice@ryhl.io>"]
version = "0.1.0"
[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
With my current directory in the top-level VCLR
folder, I open the julia
repl, and have the following interaction:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.5.3 (2020-11-09)
_/ |\__'_|_|_|\__'_| |
|__/ |
julia> using Revise
(@v1.5) pkg> activate .
Activating environment at `~/src/VCLR/Project.toml`
julia> import VCLR
[ Info: Precompiling VCLR [87991b44-5e96-4a8e-9f69-41755a642646]
Academic license - for non-commercial use only - expires 2021-03-05
julia> VCLR.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
[1] top-level scope at REPL[4]:1
[2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
Now I follow the documentation for Revise.jl (link), which (I think) says that changes are immediately loaded when I save the file. I add a function to VCLR.jl
.
module VCLR
... previous contents ...
function foo()
println("Hi!")
end
end
However it doesn’t work.
julia> VCLR.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
[1] top-level scope at REPL[4]:1
[2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
I also try to import it again:
julia> import VCLR
julia> VCLR.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
[1] top-level scope at REPL[6]:1
[2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
Of course, restarting the repl makes it work:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.5.3 (2020-11-09)
_/ |\__'_|_|_|\__'_| |
|__/ |
(@v1.5) pkg> activate .
Activating environment at `~/src/VCLR/Project.toml`
julia> import VCLR
[ Info: Precompiling VCLR [87991b44-5e96-4a8e-9f69-41755a642646]
Academic license - for non-commercial use only - expires 2021-03-05
julia> VCLR.foo()
Hi!
How can I incrementally develop my project without waiting an ungodly amount of time for every change while the REPL restarts?
Note that I am currently trying toa apply the advice from this thread. Before those changes, I had a setup that worked perfectly fine, since calling include("include.jl")
from the REPL had no issues with reloading everything. However, unless it makes my development many times slower, I’d like to do it the right way.
Note: I did try to run ] dev VCLR
in the pkg terminal like in the linked docs, but it emits an error about my package not being in the public package repository, which it indeed is not.