# How do I edit and test code changes in a package

**URL:** <https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [January 11, 2024, 1:33pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686 "2024-01-11T13:33:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fenrir\_Sivar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fenrir_sivar/32/206138_2.png) [@Fenrir\_Sivar](https://discourse.julialang.org/u/Fenrir_Sivar)\
**Post date:** [January 11, 2024, 1:33pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/1 "2024-01-11T13:33:35Z")

</div>

I’m new to Julia and inherited a package from a work member (the only one with Julia experience around, left the company)  
I know how to install the package from my git repo, but I have no clue how to make my local changes available in the Julia notebook I’m using. Is there a tutorial how and what to do during the package development itself, before pushing the code changes to the git repo again?

---

<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 11, 2024, 2:01pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/2 "2024-01-11T14:01:43Z")

</div>

Take a look at this section from the manual: [Workflow Tips · The Julia Language](https://docs.julialang.org/en/v1/manual/workflow-tips/#Revise-based-workflows)

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [January 11, 2024, 2:06pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/3 "2024-01-11T14:06:11Z")

</div>

I’m sure there’s good tutorials around but basically what you want to do is:

1. In package mode, `dev` the package `]dev https://github.com/user/MyPackage.jl`
2. Add `Revise` to your default environment
3. In your notebook (jupyter I assume?) activate a local or temporary environment (`]activate .` or `]activate --temp`) and `dev MyPackage`
4. Then do `using Revise, MyPackage` to load the development version of your package and have changes tracked by Revise

Now you can edit the source code of `MyPackage`, which will be stored in `.../.julia/dev/MyPackage` in your favourite editor and when saving the source code, changes will be reflected live in your notebook.

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [January 11, 2024, 6:07pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/4 "2024-01-11T18:07:18Z")

</div>

Could you please elaborate on why it is necessary to `dev` the package twice?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [January 11, 2024, 7:10pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/5 "2024-01-11T19:10:16Z")

</div>

The first `dev` is to download the package to your local dev folder, the second is to make sure you are actually using the `dev` version of the package (whereas `add` would try to add the release version from a registry).

This is a bit made up tbh, I can’t point you to official docs on this!

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [January 11, 2024, 7:35pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/6 "2024-01-11T19:35:41Z")

</div>

I’m thinking that only the second one is actually necessary, but using the full package URL as in your first call.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [January 11, 2024, 7:57pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/7 "2024-01-11T19:57:17Z")

</div>

That’s probably right, I guess it doesn’t matter where you do the `dev` call as that will always look in the dev folder irrespective of environment.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 11, 2024, 8:31pm UTC](https://discourse.julialang.org/t/how-do-i-edit-and-test-code-changes-in-a-package/108686/8 "2024-01-11T20:31:01Z")

</div>

I just modified an example in the Revise.jl documentation that includes a very specific demonstration.

> **[Limitations · Revise.jl](https://timholy.github.io/Revise.jl/dev/limitations/)**
>
> Documentation for Revise.jl.

In the example, I used `write` where you might use an editor to modify your package.
