There might be something wrong with your environment, or it is a bug in Revise.jl
.
To rule out the first problem, you could do the following test that should definitely work:
Firstly, start Julia with julia --startup-file=no
to avoid loading any code from you startup.jl
config.
Then create a clean environment that only contains Revise.jl
as well as the above project structure:
# julia --startup-file=no
(v1.8) pkg> generate mwe_revise
Generating project mwe_revise:
mwe_revise/Project.toml
mwe_revise/src/mwe_revise.jl
v1.8) pkg> activate mwe_revise/
Activating project at `~/wd/scratch/julia/mwe_revise`
mwe_revise) pkg> add Revise
Updating registry at `~/.julia/registries/General.toml`
Resolving package versions...
Installed CodeTracking ───── v1.2.0
Installed LoweredCodeUtils ─ v2.3.0
Installed JuliaInterpreter ─ v0.9.20
Installed Revise ─────────── v3.5.0
Updating `~/wd/scratch/julia/mwe_revise/Project.toml`
[295af30f] + Revise v3.5.0
Updating `~/wd/scratch/julia/mwe_revise/Manifest.toml`
[da1fd8a2] + CodeTracking v1.2.0
...
Precompiling project...
5 dependencies successfully precompiled in 10 seconds. 5 already precompiled.
(mwe_revise) pkg> generate ./mwe_revise/test
Generating project test:
./mwe_revise/test/Project.toml
./mwe_revise/test/src/test.jl
(mwe_revise) pkg> dev ./mwe_revise/test/
Resolving package versions...
Updating `~/wd/scratch/julia/mwe_revise/Project.toml`
[7d6a91de] + test v0.1.0 `test`
Updating `~/wd/scratch/julia/mwe_revise/Manifest.toml`
[7d6a91de] + test v0.1.0 `test`
You should now have a folder that looks like
mwe_revise
├── Manifest.toml
├── Project.toml
├── src
│ └── mwe_revise.jl
└── test
├── Project.toml
└── src
└── test.jl
3 directories, 5 files
and Pkg.status()
should look like
(mwe_revise) pkg> st
Project mwe_revise v0.1.0
Status `~/wd/scratch/julia/mwe_revise/Project.toml`
[295af30f] Revise v3.5.0
[7d6a91de] test v0.1.0 `test` # note that test is dev'ed!
Continuing with the same REPL session from above, we can now test if Revise.jl
is working properly:
julia> using Revise
julia> using mwe_revise
julia> mwe_revise.greet()
Hello World!
# now go into mwe_revise/src/mwe_revise.jl and change the definition of greet()
julia> mwe_revise.greet()
Hello World from mwe_revise!
julia> using test
[ Info: Precompiling test [7d6a91de-cdc6-445d-a797-fd5862e7d54e]
julia> test.greet()
Hello World!
# now go into mwe_revise/test/src/test.jl and change the definition of greet()
julia> test.greet()
Hello World from test!
If the above does not work for you, then something is wrong with your julia installation and/or global environment. You could then try to backup and delete your ~/.julia
folder and redo the test to see if that helps.
Sidenote: Naming your package test
is not optimal, because the ] test
command tries to run a file called test/runtests.jl
by default. Not sure if that could also be a reason for the conflict, at least it did not in this small test here.