# What's your workflow to develop packages with complex dependencies?

**URL:** <https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246>\
**Category:** General Usage\
**Tags:** package, plotting, environment\
**Created:** [March 21, 2025, 11:04pm UTC](https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246 "2025-03-21T23:04:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![benc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benc/32/46974_2.png) [@benc](https://discourse.julialang.org/u/benc)\
**Post date:** [March 21, 2025, 11:04pm UTC](https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246/1 "2025-03-21T23:04:46Z")

</div>

Hi all,

I developed quite a few small packages with self-contained functionality, but inevitably during development I need complex dependencies (eg. Plots.jl) for functionality not required by the package itself, but required for e.g. illustrating usage, debugging, prototyping etc.

Unfortunately (and this is not a comment agains Plots) packages such as Plots have complex dependencies that (for me) can occassionally break in interesting, non-trivial ways. I also like to keep my source packages clean so the corresponding CI/CD/Container images are equally sparse.

Which brings me to my question, what is your workflow for this kind of scenario? Do you keep the complex dependencies in your base/main environment (but this can clash), or do you keep it all in the package with optional flags?  
Or is there a middle way by stacking environments?

Any tips or suggestions are very welcome,

Ben

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [March 21, 2025, 11:42pm UTC](https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246/2 "2025-03-21T23:42:11Z")

</div>

For me in the REPL it’s temp environments + autoinstall in 99% of cases.  
Basically, do `using SomePackage`, and Julia suggests to install it for you. Press `[o]` and it’s installed into a temp env.  
Unfortunately, not out of the box – requires adding a line to your `startup.jl`. See [add "t" option for autoinstall into a temp env by aplavin · Pull Request #3867 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/pull/3867).

Aside from REPL, and especially for plots, notebooks are very convenient. There, all extra deps are managed automatically: Pluto adds packages automatically when you do `using SomePackage`.

---

<div class="post-metadata">

**Author:** ![danielwe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielwe/32/35657_2.png) [@danielwe](https://discourse.julialang.org/u/danielwe)\
**Post date:** [March 21, 2025, 11:54pm UTC](https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246/3 "2025-03-21T23:54:27Z")

</div>

For one-off debugging et cetera, a temp environment that `dev`s my package:

```julia-repl
(@v1.10) pkg> activate --temp
  Activating new project at `/var/folders/57/1z4jgn5133lbbbrnnt4vf_zw0000gn/T/jl_IoTzyY`

(jl_IoTzyY) pkg> add Plots
   Resolving package versions...
[...]

(jl_IoTzyY) pkg> dev path/to/MyPackage

julia> # do stuff with Plots and MyPackage

```

For more persistent needs, the same, but rather than a temp environment, I create a regular env in a subfolder like `path/to/MyPackage/scripts`. If you make sure to use the relative path, `dev ..`, this solution is portable and allows you to copy the project around, push to github, et cetera, without breaking the `scripts` environment.

Or, as @aplavin said, a Pluto.jl notebook somewhere like `path/to/MyPackage/notebooks`, where the first cell looks something like

```julia
begin
    import Pkg
    Pkg.dev(path="..")
    Pkg.add(["Plots"])
end

```

---

<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:** [March 22, 2025, 1:24am UTC](https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246/4 "2025-03-22T01:24:30Z")

</div>

I would add it as test dependency:

```julia
[extras]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Plots = "23c2ee80-7a9e-4350-b264-8e670f12517c"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Plots", "BenchmarkTools", "LaTeXStrings"]

```

If you have “TestEnv” in your global environment you can then do

```julia
using TestEnv; TestEnv.activate()

```

and Plots is available.

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 22, 2025, 1:45pm UTC](https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246/5 "2025-03-22T13:45:39Z")

</div>

> [@benc](#):
>
> Or is there a middle way by stacking environments?

For exactly this use case I use shared / stacked environments, with ShareAdd.jl package (disclosure: I’m the author) to simplify their usage and management.

---

<div class="post-metadata">

**Author:** ![benc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benc/32/46974_2.png) [@benc](https://discourse.julialang.org/u/benc)\
**Post date:** [March 23, 2025, 12:51am UTC](https://discourse.julialang.org/t/whats-your-workflow-to-develop-packages-with-complex-dependencies/127246/6 "2025-03-23T00:51:03Z")

</div>

I think this is spot on for my needs @Eben60, will take a deeper look. @ufechner7 @danielwe @aplavin appreciate your suggestions as well!
