# Can revise track local folder?

**URL:** <https://discourse.julialang.org/t/can-revise-track-local-folder/93495>\
**Category:** New to Julia\
**Created:** [January 25, 2023, 10:11am UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495 "2023-01-25T10:11:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [January 25, 2023, 10:11am UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/1 "2023-01-25T10:11:42Z")

</div>

I have some project `myproject`, and I want to use some local package `test`,  
so I orgnize my files like this:

```julia
myproject
├── Manifest.toml
├── Project.toml
└── src
    ├── myproject.jl
    └── test
        ├── Project.toml
        └── src
            └── test.jl

```

Then, in `myproject` folder, I do  
`]activate .` and `]dev ./src/test` so that I can use `test` in `myproject`.

So far, it works fine, but when I want to use revise to keep track of my modification to `test.jl`, it fails. I ran

```julia
using Revise
using test
test.greet()

```

and get the correct result. But changing code inside `test.jl` doesn’t change the output result.

I have tried `]dev Example` as introduced in the homepage of Revise, and it works fine. It seem that `Revise` only keep track of packages that are in the dev folder.

Is there a way to make `Revise` also keep track of my `test.jl`?

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [January 25, 2023, 10:24am UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/2 "2023-01-25T10:24:27Z")

</div>

> [@baizhan](#):
>
> Then, in `myproject` folder, I do  
> `]activate .` and `]dev /src/test` so that I can use `test` in `myproject`.

I guess you mean `]dev ./src/test`, the dot is important as it says relative to the current directory, otherwise `/src/test` would point to a directory at the root of your file system.

Anyways, I think this should just work.  
In fact, when working on `Makie.jl`, which is a monorepo that constains the different backends as packages directly, I always do it like that, e.g.

```julia
git clone git@github.com:MakieOrg/Makie.jl.git
cd Makie.jl
julia --project
julia>]dev . # dev the cloned directory, avoids creating a copy in .julia/dev
julia>]dev ./GLMakie ./CairoMakie # etc, dev the backends (packages)

```

The only thing different here is that you have your `test` project contained within the `src/` folder which is not the case with the `Makie` setup.  
Maybe try moving it one level up and see if that works?

---

<div class="post-metadata">

**Author:** ![jmair](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmair/32/35117_2.png) [@jmair](https://discourse.julialang.org/u/jmair)\
**Post date:** [January 25, 2023, 10:38am UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/3 "2023-01-25T10:38:20Z")

</div>

You can also do `Revise.track(test)` after importing/using.

---

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [January 25, 2023, 1:24pm UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/4 "2023-01-25T13:24:11Z")

</div>

Thank you!  
But it seems that neither `Revise.track(test)` or `Revise.track(pathof(test))` works.

---

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [January 25, 2023, 1:33pm UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/5 "2023-01-25T13:33:29Z")

</div>

Thank you, you are right that it should be `./src/test` and that I made a typo.

I have tried moving the package a level up, and the source tree now looks like:

```julia
myproject
├── Manifest.toml
├── Project.toml
└── src
│ └── myproject.jl
test
├── Manifest.toml
├── Project.toml
└── src
     └── test.jl

```

However, the `Revise` still cannot track the change in `test.jl`.

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [January 25, 2023, 2:48pm UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/6 "2023-01-25T14:48:08Z")

</div>

I think you moved the `test` folder up too far, `src, test` should be on the same level, it should be

```plaintext
myproject
├── Manifest.toml
├── Project.toml
└── src
│ └── myproject.jl
└── test
    ├── Manifest.toml
    ├── Project.toml
    └── src
        └── test.jl

```

---

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [January 26, 2023, 9:09am UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/7 "2023-01-26T09:09:45Z")

</div>

Thank you for your suggestion, but the `Revise` still doesn’t track the change in this case.

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [January 26, 2023, 10:13am UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/8 "2023-01-26T10:13:17Z")

</div>

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
# 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

```plaintext
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

```julia
(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
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.

---

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [January 26, 2023, 1:35pm UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/9 "2023-01-26T13:35:02Z")

</div>

Thank you again for your detailed instruction.  
Unfortunately, after doing exactly as you say, the `Revise` still cannot work properly.

However, I realize that this might be a problem of my WSL environment.  
After trying in windows, `Revise` works fine.

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [January 26, 2023, 1:49pm UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/10 "2023-01-26T13:49:03Z")

</div>

> Unfortunately, after doing exactly as you say, the `Revise` still cannot work properly.
> 
> However, I realize that this might be a problem of my WSL environment.

Perhaps related (did not read the whole conversation in that issue): [`JULIA_REVISE_POLL=1` needed on WSL2 · Issue #514 · timholy/Revise.jl · GitHub](https://github.com/timholy/Revise.jl/issues/514)

---

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [January 27, 2023, 1:36am UTC](https://discourse.julialang.org/t/can-revise-track-local-folder/93495/11 "2023-01-27T01:36:00Z")

</div>

`export JULIA_REVISE_POLL=1` in WSL solves my problem.  
Thank you again.
