# How should I use Revise.jl (and other developer tools) to develop a package?

**URL:** <https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344>\
**Category:** General Usage\
**Tags:** question, package, development\
**Created:** [July 8, 2023, 5:23am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344 "2023-07-08T05:23:45Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![cadojo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cadojo/32/25328_2.png) [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Post date:** [July 8, 2023, 5:23am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/1 "2023-07-08T05:23:45Z")

</div>

When I create a new package, I often want `BenchmarkTools`, `Revise`, and other dependencies that are accessible within my package’s environment, but won’t be added as dependencies for users. I’ve tried playing around with `[extras]`, but I have not been able to replicate this usage.

How are folks using `Revise` when developing a package? Are you adding `Revise` as a dependency, then removing it before you commit?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 8, 2023, 5:59am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/2 "2023-07-08T05:59:38Z")

</div>

Did you try putting it in the global environment?

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [July 8, 2023, 6:03am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/3 "2023-07-08T06:03:23Z")

</div>

I work in a global (or my own separate) environment when developing a package and have things like `Revise.jl`in said environment. In that environment I also have the package I develop in development mode and then everything works smoothly, without the need of having Revise or any other tools you use in the dependencies of the package you develop.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 6:19am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/4 "2023-07-08T06:19:35Z")

</div>

My habit is to put Revise.jl and friends in the global environment `@v1.9`. Then I activate the project environment `MyPackage/Project.toml` (in the folder where I cloned the package). I rely on [environment stacks](https://docs.julialang.org/en/v1/manual/code-loading/#Environment-stacks) which automatically make packages available from `@v1.9` in the project environment.

@kellertuer could you explain what additional benefits your option brings? I’m curious to learn if there is a better path

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [July 8, 2023, 7:36am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/5 "2023-07-08T07:36:36Z")

</div>

It seems our difference might be that you activate the projects environment while I put it in development mode?

My option has the (original) advantage that just `using MyPackage` in the environment where `MyPackage` is in development mode loads the source from said folder (instead of somewhere from `.julia/...`. Maybe one advantage is that this way I see the package “from the outside”, i.e. if you think of having a package `B` that the package uses internally but my global environment does not, then I know whether this works for the user later?  
I am not 100% sure, this is mainly how I learned this stuff.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 8:00am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/6 "2023-07-08T08:00:06Z")

</div>

Activating the project environment of the package clone actually does the same thing vis-à-vis loading the source. TBH `pkg> dev` has always been mysterious to me, so I remain wary of incantations beyond my mortal understanding

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [July 8, 2023, 8:19am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/7 "2023-07-08T08:19:00Z")

</div>

Then they might be more similar then I thought.

I think a main difference then is, that

- In development mode I am in a different environment than the internal project one
- a package stays in development mode, that is restarting Julia and having 2-3 packages in development mode, keeps them in that mode.

The main thing that dev mode does is really just loading the source from the folder you cloned and not from the copy in the `.Julia/` folder.

I am not sure whether 2-3 packages in dev mode is that easy with just activating environments?  
For me that is a use case when I for example change something in `ManifoldsBase.jl`, `Manifolds.jl` and want to adapt `Manopt.jl` as well – or at least check what effect these changes have. Then all 3 have changes that should be taken into account, when `using` them.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 8:21am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/8 "2023-07-08T08:21:03Z")

</div>

OK the multi-package development workflow seems to be a use case where your method scales better. With mine I would need to resort to temporary dev-ing ManifoldsBase into the Manopt environment

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [July 8, 2023, 8:26am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/9 "2023-07-08T08:26:48Z")

</div>

Sure, if you have a main one that is possible.

In my setup, this is a bit complicated, since `Manifold` is not a dependency of `Manopt` and vice versa, so I would have to change dependencies for a while for that.  
Then I would not be sure how that interacts with the fact that `Manifolds` is a weak dependency of `Manopt`.

So – for single packages I think both variants are the same – besides that dev mode stays after Julia restarts and you have to reactivate your env. For multiple packages, this might be different.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [July 8, 2023, 11:17am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/10 "2023-07-08T11:17:35Z")

</div>

The `dev` workflow is indeed needed when you have multiple dependent packages you want to develop or if you want to run tests on some package while working on a dependency.

For the single package scenario I find it easiest to

- Change directory to wherever I have the package (which I want to do anyway for git operations).
- Start with `julia --project` to activate the package. Should I need to restart Julia it’s only an arrow up + enter to get back to the activated project.

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [July 8, 2023, 12:27pm UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/11 "2023-07-08T12:27:44Z")

</div>

@gdalle and @kellertuer, in your experience, which approach is best for having a nice test writing experience?

My workflow derives mainly from setting things up using `PkgTemplates`. However, one side effect of this is that VS Code with Julia support does not provide intellisense/auto-completion for the package I am writing the tests for.

Do you have a suggestion for a better experience when writing tests? (if you think I am not on topic, I can create a new one).

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [July 8, 2023, 12:51pm UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/12 "2023-07-08T12:51:12Z")

</div>

I think I set my packages up without the `PkgTemplates` (or it is just really long ago),  
but in my mode with the development mode, sure you have autocomplete for all content of the package you develop, also when writing the tests.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 7:18pm UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/13 "2023-07-08T19:18:55Z")

</div>

Thanks to your comment I discovered that my IntelliSense doesn’t work the way I expected, so I’m afraid I’ll have to understand that before I answer ^^

> [@For which packages does VSCode autocomplete work?](https://discourse.julialang.org/t/vscode-autocomplete-failing-for-non-core-packages/101360):
>
> I recently discovered that autocomplete (and more generally IntelliSense) works for some people, and that makes me very frustrated rofl For me it only works with Base and Core, not even standard library stuff like LinearAlgebra. EDIT: see [this reply](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/4) for the real question. I’m on macOS Ventura with the latest version of Julia and VSCode. I did wait until IntelliSense finished loading. Related GitHub issues: [Autocomplete for non-built-in packages? · Issue #1885 · julia-vscode/julia-vscode ·…](https://github.com/julia-vscode/julia-vscode/issues/1885)

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [July 8, 2023, 7:49pm UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/14 "2023-07-08T19:49:11Z")

</div>

I would also want to get to the level of proficiency and short-term memory where the Intellisense breaks and I don’t even realize 🙂

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 7:50pm UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/15 "2023-07-08T19:50:45Z")

</div>

I think it’s worse than that, I think I’ve never used IntelliSense because it’s always been broken for me ^^

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [July 8, 2023, 8:02pm UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/16 "2023-07-08T20:02:03Z")

</div>

Maybe I should try to drop the intellisense altogether for a while - it would be like altitude training for endurance, but in Julia context.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 8:50pm UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/17 "2023-07-08T20:50:44Z")

</div>

> [@algunion](#):
>
> VS Code with Julia support does not provide intellisense/auto-completion for the package I am writing the tests for.

I concur with your diagnosis @algunion, see my investigation here:

> [@For which packages does VSCode autocomplete work?](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/4):
>
> Let’s say I’m developing a package called MyPackage and I have activated its Project.toml. It has one dependency called MyDependency, and one test depency called MyTestDependency. After some exploration, it seems that IntelliSense… works for MyDependency if either one of the following conditions is satisfied there is a using MyDependency statement at the top of my file my file is in src/ and included in the module MyPackage (which also contains the using MyDependency statement) never works…

I think if @kellertuer is correct I will switch to `pkg> dev`-ing the package I develop in a shared environment. However I discovered that this has issues too:

> [@Cannot \`pkg\> dev .\` a package with extensions inside a shared environment?](https://discourse.julialang.org/t/cannot-pkg-dev-a-package-with-extensions-inside-a-shared-environment/101363):
>
> Following a [recent discussion on dev environments](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/13), I tried this new workflow of using a shared environment. But when I used pkg\> dev . on a locally downloaded package with extensions (aka weakdeps, introduced in Julia 1.9), this failed spectacularly. See here for a reproducible example with a lightweight package of mine called HiddenMarkovModels.jl: [https://asciinema.org/a/595665](https://asciinema.org/a/595665) The error is the following one (HMMBase.jl is a weakdep of HiddenMarkovModels.jl): ERROR: `HiddenMarkovModels=8…

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [July 9, 2023, 6:43am UTC](https://discourse.julialang.org/t/how-should-i-use-revise-jl-and-other-developer-tools-to-develop-a-package/101344/18 "2023-07-09T06:43:11Z")

</div>

For the development mode, as far as I remember, I do not get autocomplete just because a file is in the project folder, but as soon as it is (directly or transitively) included in the main `MyProject.jl` file, but I have not yet looked into this when using extensions.
