# Docs-specific dependencies - should I use a separate environment?

**URL:** <https://discourse.julialang.org/t/docs-specific-dependencies-should-i-use-a-separate-environment/75159>\
**Category:** New to Julia\
**Tags:** package, documentation\
**Created:** [January 25, 2022, 9:26am UTC](https://discourse.julialang.org/t/docs-specific-dependencies-should-i-use-a-separate-environment/75159 "2022-01-25T09:26:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pat-alt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pat-alt/32/34264_2.png) [@pat-alt](https://discourse.julialang.org/u/pat-alt)\
**Post date:** [January 25, 2022, 9:26am UTC](https://discourse.julialang.org/t/docs-specific-dependencies-should-i-use-a-separate-environment/75159/1 "2022-01-25T09:26:31Z")

</div>

I’ve been working on my first [package](https://github.com/pat-alt/AlgorithmicRecourse.jl) for counterfactual explanations and algorithmic recourse in Julia. To create tutorials as part of the [documentation](https://www.paltmeyer.com/AlgorithmicRecourse.jl/dev/) I have been using packages that are _not_ dependencies of the package itself. For example, I show [here](https://www.paltmeyer.com/AlgorithmicRecourse.jl/dev/tutorials/models/#Custom-models) how to use my package to create counterfactual explanations for [Flux.jl](https://fluxml.ai/Flux.jl/stable/) models, but Flux is not a dependency of my package.

Now here’s what I’m hoping to get some advice on:

- If I add these packages to my package environment, they will by default be added as deps to the Project.toml, if I’m not mistaken.
- To avoid this I have set up a separate environment in `docs/src/tutorials` which uses the dev version of my repo as a dependency along with any other packages (like Flux) I need for the tutorials.

This approach works, but is at times a bit fiddly. When working on the package itself I use its own environment. Whenever I work on tutorials in docs I need to remember to

1. Push any potential changes in my dev branch to remote.
2. Update the environment in `docs/src/tutorials` to incorporate those changes like so:

```nohighlight
(@v1.6) pkg> activate .
  Activating environment at `AlgorithmicRecourse.jl/docs/src/tutorials/Project.toml`

(tutorials) pkg> update AlgorithmicRecourse

```

I imagine there’s a better way to go about this?

Appreciate this is a bit of a convoluted topic so hopefully I’ve been clear enough. For reference: I’m working in VS code and using Jupyter+nbconvert to create the tutorials.

Any thoughts/comments would be much appreciated!

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [January 25, 2022, 9:34am UTC](https://discourse.julialang.org/t/docs-specific-dependencies-should-i-use-a-separate-environment/75159/2 "2022-01-25T09:34:05Z")

</div>

> Should I use a separate environment?

[Yes](https://discourse.julialang.org/t/psa-use-a-project-for-building-your-docs/14974).

> [@pat-alt](#):
>
> Whenever I work on tutorials in docs I need to remember to
> 
> 1. Push any potential changes in my dev branch to remote.
> 2. Update the environment in `docs/src/tutorials` to incorporate those changes like so:

No, you can “install” your package into the doc environment by using a relative path. It will look something like this: [fredrikekre/Literate.jl/docs/Manifest.toml#L389](https://github.com/fredrikekre/Literate.jl/blob/7c4bfc27f0038eb261dd78af70ac927799490175/docs/Manifest.toml#L389).

---

<div class="post-metadata">

**Author:** ![pat-alt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pat-alt/32/34264_2.png) [@pat-alt](https://discourse.julialang.org/u/pat-alt)\
**Post date:** [January 25, 2022, 9:56am UTC](https://discourse.julialang.org/t/docs-specific-dependencies-should-i-use-a-separate-environment/75159/3 "2022-01-25T09:56:28Z")

</div>

Thanks for the quick response, Fredrik. I’m guessing that by ‘install’ you mean adding a the local folder to the environment as suggested [here](https://discourse.julialang.org/t/adding-a-local-package-using-the-pkg-manager-how-to-add-the-path/39138)? If so, I had actually previously done it that way since it avoids having to push to remote. But if for some reason the local folder structure changes, then this causes trouble.

Edit: Also I saw your Literate.jl package which seems to be addressing these kinds of problems, so nice to see for future reference.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [January 25, 2022, 10:01am UTC](https://discourse.julialang.org/t/docs-specific-dependencies-should-i-use-a-separate-environment/75159/4 "2022-01-25T10:01:25Z")

</div>

> [@pat-alt](#):
>
> I’m guessing that by ‘install’ you mean adding a the local folder to the environment as suggested [here](https://discourse.julialang.org/t/adding-a-local-package-using-the-pkg-manager-how-to-add-the-path/39138)?

Yes, `pkg> dev relative/path/to/package`.

> [@pat-alt](#):
>
> But if for some reason the local folder structure changes, then this causes trouble.

Sure, but how often do you need to change the structure?

---

<div class="post-metadata">

**Author:** ![pat-alt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pat-alt/32/34264_2.png) [@pat-alt](https://discourse.julialang.org/u/pat-alt)\
**Post date:** [January 25, 2022, 10:08am UTC](https://discourse.julialang.org/t/docs-specific-dependencies-should-i-use-a-separate-environment/75159/5 "2022-01-25T10:08:44Z")

</div>

Yup, fair point! Thanks again, much appreciate the quick response.
