# Trouble with \`dev\` and \`Revise\`

**URL:** <https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818>\
**Category:** New to Julia\
**Created:** [September 16, 2019, 4:23pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818 "2019-09-16T16:23:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 16, 2019, 4:23pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/1 "2019-09-16T16:23:58Z")

</div>

I am trying to get a workflow set up and I am struggling with `Revise` and `dev`ing a package.

I want to `dev` DataFrames so I can contribute to it.

After `] dev DataFrames`, `] status` give me:

```julia
(v1.2) pkg> status
    Status `~/.julia/environments/v1.2/Project.toml`
  [6e4b80f9] BenchmarkTools v0.4.3
  [ad839575] Blink v0.12.0
  [336ed68f] CSV v0.5.11
  [a93c6f00] DataFrames v0.19.3 [`~/.julia/dev/DataFrames`]
  [1313f7d8] DataFramesMeta v0.5.0
  [14b8a8f1] PkgTemplates v0.6.2
  [91a5bcdd] Plots v0.26.2
  [295af30f] Revise v2.1.10
  [1277b4bf] ShiftedArrays v0.5.0
  [40c74d1a] TableView v0.4.0

```

Then I do `using Revise`. When I do `using DataFrames` in the terminal, i get

```julia
julia> using DataFrames
[Info: Recompiling stale cache file /home/peterwd/.julia/compiled/v1.2/DataFrames/AR9oZ.ji for DataFrames [a93c6f00-e57d-5684-b7b6-d8193f3e46c0]

```

This seems wrong, right? It shouldn’t be recompiling from `.julia/compiled`, it should be compiling fresh from `.julia/dev`.

Now I say `edit(DataFrames)` which should tell Revise to track DataFrames and recompile with any changes. But no changes to the code produce any re-compilation.

I am pretty sure this is exactly what I did the last time i got this set up, so it’s a mystery why it’s not working.

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 16, 2019, 4:26pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/2 "2019-09-16T16:26:16Z")

</div>

> [@pdeffebach](#):
>
> This seems wrong, right? It shouldn’t be recompiling from `.julia/compiled` , it should be compiling fresh from `.julia/dev`

`.julia/compiled` is just the place where precompilation files are stored so there is nothing wrong there.

> [@pdeffebach](#):
>
> Now I say `edit(DataFrames)` which should tell Revise to track DataFrames and recompile with any changes. But no changes to the code produce any re-compilation.

Where did you read this? The way you have Revise track a package is by first loading Revise and then the package `using Revise, DataFrames´.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 16, 2019, 4:32pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/3 "2019-09-16T16:32:43Z")

</div>

I loaded `Revise` first.

I was under the impression that “edit(M::Module)” edited “src/$M.jl”. At least, when I used it the editor popped up and opened the correct file.

`edit("src/Module_name.jl")` does indeed work.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 16, 2019, 4:34pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/4 "2019-09-16T16:34:02Z")

</div>

Yeah, sure. You can edit the files however you want.

Did you get the example at [Home · Revise.jl](https://timholy.github.io/Revise.jl/stable/#Usage-example-1) to work?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 16, 2019, 4:50pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/5 "2019-09-16T16:50:59Z")

</div>

Yes, it is all working now, thank you.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 23, 2019, 6:26pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/6 "2019-09-23T18:26:32Z")

</div>

I played around with this again today and I am having trouble once again. Here is an MWE. It will be a mix of what is given in the `Pkg.jl` docs, in particular section 5 on creating anew package [here](https://julialang.github.io/Pkg.jl/v1/creating-packages/#Adding-a-build-step-to-the-package-1) the Workflow tips docs, [here](https://docs.julialang.org/en/v1/manual/workflow-tips/), the PkgTemplates.jl docs [here](https://github.com/invenia/PkgTemplates.jl), and the Revise.jl docs [here](https://timholy.github.io/Revise.jl/stable/).

I have a folder called `Development` that I want to hold all my code, rather than `.julia/dev`. Reading the workflow tips, this is how I start creating the project.

```julia
# Change directories into my development folder
$ cd Documents/Development
# Start julia
$ julia
# Use PkgTemplates
julia> using PkgTemplates
# Check what a default package would look like. 
# note: I want the package directory to not be in .julia/dev
julia> t = Template()
Template:
  → User: pdeffebach
  → Host: github.com
  → License: MIT (pdeffebach <p.deffebach@gmail.com> 2019)
  → Package directory: ~/.julia/dev
  → Minimum Julia version: v1.0
  → SSH remote: No
  → Add packages to main environment: Yes
  → Commit Manifest.toml: No
  → Plugins: None
# Setting dir = "." does what I want. 
julia> t = Template(dir = ".")
Template:
  → User: pdeffebach
  → Host: github.com
  → License: MIT (pdeffebach <p.deffebach@gmail.com> 2019)
  → Package directory: ~/Documents/Development/
  → Minimum Julia version: v1.0
  → SSH remote: No
  → Add packages to main environment: Yes
  → Commit Manifest.toml: No
  → Plugins: None
# Create the packag
julia> generate("HelloWorld", t)
# Get into the newly created directory
shell> cd HelloWorld
/home/peterwd/Documents/Development/HelloWorld
# Load revise to start editing
julia> using Revise
# Use the new HelloWorld package
julia> using HelloWorld
[Info: Precompiling HelloWorld [233cd533-293a-414a-b31a-fd2ca2ae87f6]
julia> HelloWorld.greet()
Hello World!

```

In the docs for Revise [here](https://timholy.github.io/Revise.jl/stable/#What-Revise-can-track-1), it states that Revise can track " any package that you load with `import` or `using`". Given that I just did `using HelloWorld` and it worked, I figured Revise should be able to do it.

```julia
julia> edit("src/HelloWorld.jl")

```

Now I change the output of `HelloWorld.greet()` from `"Hello, World!"` to just `"Hello"`.

```julia
julia> HelloWorld.greet()
Hello World!

```

It didn’t work.

But in the Revise.jl docs [here](https://timholy.github.io/Revise.jl/stable/#Usage-example-1) it has a `dev Example` command in its tutorial. Given that I am creating code for the first time, I need to use develop slightly differently. I use the file-path method of `develop` rather than a html for git or the command for developing a registered package.

```julia
(v1.2) pkg> develop .

```

Editing still doesn’t work so I close out of my julia session and open up a new one.

```julia
# Check that the package exists
  [6e4b80f9] BenchmarkTools v0.4.3
  [ad839575] Blink v0.12.0
  [336ed68f] CSV v0.5.11
  [1313f7d8] DataFramesMeta v0.5.0
  [233cd533] HelloWorld v0.1.0 [`../../../Documents/Development/HelloWorld`]
  [14b8a8f1] PkgTemplates v0.6.2
  [91a5bcdd] Plots v0.26.2
  [d330b81b] PyPlot v2.8.2
  [1fd47b50] QuadGK v2.1.0
  [295af30f] Revise v2.1.10
  [1277b4bf] ShiftedArrays v0.5.0
  [40c74d1a] TableView v0.4.0
# Load Revise
julia> using Revise
# Load HelloWorld
julia> using HelloWorld
# Check that the change I made earlier is in effect, from
# "Hello, World!" to "Hello!"
julia> HelloWorld.greet()
Hello!
# Edit the file again
edit("src/HelloWorld.jl")

```

Once again it opens up the editor and change the file, this time to `"Hello, Peter!"`. The change is not updated.

Finally I will try by updating the `LOAD_PATH` variable. I start a new julia session in the `HelloWorld` directory.

```julia
julia> push!(LOAD_PATH, "~/Documents/Development")
4-element Array{String,1}:
 "@"                      
 "@v#.#"                  
 "@stdlib"                
 "~/Documents/Development"
# Load Revise
julia> using Revise
# Load HelloWorld
julia> using HelloWorld
[Info: Recompiling stale cache file /home/peterwd/.julia/compiled/v1.2/HelloWorld/C0i32.ji for HelloWorld [233cd533-293a-414a-b31a-fd2ca2ae87f6]
# See that the output is what it should be
julia> HelloWorld.greet()
Hello, Peter!
julia> edit("src/HelloWorld.jl")

```

Now I change it back from “Hello, Peter!” to “Hello, World!” once again. It still does not work.

Based on the documentation, these all seem like plausible methods for getting up and running. Finally, I tried not configuring the `Template(dir = ".")` command and instead having it appear in `.julia/dev`. This also did not work.

I don’t think a complete guide of creating a new package from scratch to using Revise on it exists. Hopefully with some modifications the lengthy MWE above can serve as the basis for such a guide.

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 23, 2019, 6:33pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/7 "2019-09-23T18:33:01Z")

</div>

Here is my session:

```julia
julia> t = Template(dir = ".", user="KristofferC")
Template:
  → User: KristofferC
  → Host: github.com
...

julia> generate("HelloWorld", t)
Generating project HelloWorld:
    /home/kc/Documents/JuliaTests/HelloWorld/Project.toml
    /home/kc/Documents/JuliaTests/HelloWorld/src/HelloWorld.jl
[ Info: Initialized Git repo at /home/kc/Documents/JuliaTests/HelloWorld
[ Info: Set remote origin to https://github.com/KristofferC/HelloWorld.jl

(JuliaTests) pkg> st
    Status `~/Documents/JuliaTests/Project.toml`
  [b7e086d2] HelloWorld v0.1.0 [`~/Documents/JuliaTests/HelloWorld`]

julia> using Revise, HelloWorld
[Info: Precompiling HelloWorld [b7e086d2-bfe5-4300-a110-4bbbf57d4dec]

julia> HelloWorld.greet()
Hello World!
julia> edit("HelloWorld/src/HelloWorld.jl") # edited

julia> HelloWorld.greet()
Hello

```

Are you sure you edited the correct file (`HelloWorld/src/HelloWorld.jl`)?

> [@pdeffebach](#):
>
> Finally I will try by updating the `LOAD_PATH` variable. I start a new julia session in the `HelloWorld` directory.

I would almost never touch `LOAD_PATH`.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 23, 2019, 8:06pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/8 "2019-09-23T20:06:53Z")

</div>

I deleted all “HelloWorld” folders and removed the package, tried this above and it did not work.

Revise tests pass. However if I make a typo in the name, say `edit("HelloWorld/src/Helloworld.jl")` then it creates a new file and edits that rather than throwing an error. I think this is odd behavior and might be indicative of Revise not working correctly.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 24, 2019, 7:31pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/9 "2019-09-24T19:31:33Z")

</div>

Should I file a bug? Would it go in Revise, Pkg, or somewhere else? I can re-install Julia in a few days and see if it works after that as well.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 27, 2019, 6:53pm UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/10 "2019-09-27T18:53:02Z")

</div>

I filed an issue with Revise [here](https://github.com/timholy/Revise.jl/issues/368).

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [October 2, 2019, 6:49am UTC](https://discourse.julialang.org/t/trouble-with-dev-and-revise/28818/11 "2019-10-02T06:49:35Z")

</div>

> [@pdeffebach](#):
>
> However if I make a typo in the name, say `edit("HelloWorld/src/Helloworld.jl")` then it creates a new file and edits that rather than throwing an error. I think this is odd behavior and might be indicative of Revise not working correctly.

That’s not a Revise bug, because `edit` is defined in InteractiveUtils.

The behavior you’re finding odd is pretty common. For example, at the linux prompt:

```sh
tim@diva:/tmp$ echo "Hello Peter!" > peter.txt
tim@diva:/tmp$ emacs petr.txt &

```

Neither `emacs` nor `bash` warns you that `petr.txt` doesn’t exist, it just opens a new blank file. Same as Julia’s `edit`.
