# Separate "Dev" packages in Project.toml

**URL:** <https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143>\
**Category:** General Usage\
**Created:** [June 18, 2021, 1:18pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143 "2021-06-18T13:18:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbu](https://avatars.discourse-cdn.com/v4/letter/j/a8b319/32.png) [@jbu](https://discourse.julialang.org/u/jbu)\
**Post date:** [June 18, 2021, 1:18pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/1 "2021-06-18T13:18:30Z")

</div>

When creating a package, I often use dependencies that are purely for development and have nothing to do with my package’s functionality (e.g. [Revise.jl](https://timholy.github.io/Revise.jl/stable/), [Debugger.jl](https://github.com/JuliaDebug/Debugger.jl), [Infiltrator.jl](https://github.com/JuliaDebug/Infiltrator.jl). If I ever wanted to share my package, these unnecessary packages would be shared too unless I manually deleted them from the Project.toml.

[Pipenv](https://pipenv-fork.readthedocs.io/en/latest/basics.html#pipenv-install) (for Python) makes a distinction between “dev” dependencies only needed for development (`[dev-packages]` in the Pipfile), and strictly necessary dependencies needed for running the project code (`[packages]`). A user can run `pipenv install` to install only the packages needed for running the code and ignore the “dev” packages. If they want to install the dev packages too, they can use `pipenv install --dev`.

I couldn’t find any similar functionality in the documentation for Pkg.jl. Can Pkg also distinguish between development and strictly necessary packages when installing a project environment?

---

<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:** [June 18, 2021, 1:26pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/2 "2021-06-18T13:26:07Z")

</div>

This is a good question.

My current approach is to have Infiltrator in my `1.6` project.toml, then inside my module code use `Main.@infiltrate`.

---

<div class="post-metadata">

**Author:** ![jlperla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlperla/32/34332_2.png) [@jlperla](https://discourse.julialang.org/u/jlperla)\
**Post date:** [June 18, 2021, 1:36pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/3 "2021-06-18T13:36:11Z")

</div>

Can all of that stuff go in `test` dependencies? Having the separate project and manifest for those seems to make sense and presumably you are doing development by editing/creating tests anyways?

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [June 18, 2021, 1:49pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/4 "2021-06-18T13:49:25Z")

</div>

Environments in Julia are nested, when working on a project you usually have access to both - package’s dependencies and dependencies in the enclosing environment (e.g. `@v1.6`):

```julia
(YourPackage) pkg> st
# prints dependencies of YourPackage

(YourPackage) pkg> activate. # switch to the default environment
  Activating environment at `~/.julia/environments/v1.6/Project.toml`

(@v1.6) pkg> add Revise
# adding Revise to the enclosing environment

(@v1.6) pkg> activate . # switch back to the environment in the current directory 
  Activating environment at `...`

julia> using Revise
... 

```

---

<div class="post-metadata">

**Author:** ![alejandromerchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alejandromerchan/32/10500_2.png) [@alejandromerchan](https://discourse.julialang.org/u/alejandromerchan)\
**Post date:** [June 18, 2021, 6:56pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/5 "2021-06-18T18:56:41Z")

</div>

The way most people deal with this is to have all those `dev` packages, as you call them, installed in your Main environment (`(@1.6)`, for example) and then create a new environment for your package (`(@MyPkg)`) . With this setup you have access to `Revise` and `Debugger`, and any other package you need to work on your package, but they are not part of the `Project.toml` file of your package.

---

<div class="post-metadata">

**Author:** ![sairus7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sairus7/32/10816_2.png) [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Post date:** [June 18, 2021, 8:41pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/6 "2021-06-18T20:41:01Z")

</div>

So, technically, there are two separate `@MyPkg` environments, one in `environments` folder and the other in `dev/MyPkg` folder? Is there a workflow description for this thing?

---

<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:** [June 18, 2021, 10:25pm UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/7 "2021-06-18T22:25:38Z")

</div>

It’s documented in the Pkg.jl docs introduction [here](https://pkgdocs.julialang.org/v1/). Basically, when you start the REPL with `julia --project`, you have access to your `1.6` environment as well as your `MyPackage` `project.toml`.

This issue is about how stuff _inside_ `MyPackage` can’t see the `1.6` `project.toml`

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [June 19, 2021, 5:16am UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/8 "2021-06-19T05:16:34Z")

</div>

But no. There are not two MyPkg environments. People above this post have been referring to the Main environment (`@v1.6` for example) and your package’s environment `@MyPkg`. The packages that are installed in the main environment are accessible from all julia sessions no matter what other environment you have active.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [June 21, 2021, 10:55am UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/9 "2021-06-21T10:55:36Z")

</div>

2 posts were split to a new topic: [Simultaneous development of private packages?](https://discourse.julialang.org/t/simultaneous-development-of-private-packages/63289)

---

<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:** [June 21, 2021, 8:14am UTC](https://discourse.julialang.org/t/separate-dev-packages-in-project-toml/63143/11 "2021-06-21T08:14:50Z")

</div>

You can build your own custom stack pretty easily (as briefly mentioned above). For example, if you keep dev tools installed in `devtools/Project.toml` as follows:

```bash
$ tree .
.
|-- devtools
| |-- Manifest.toml
| `-- Project.toml # Debugger, BenchmarkTools, ...
|-- Manifest.toml
|-- Project.toml # Regular dependencies
`-- src
    `-- MyProject.jl

```

Then you can set up the Julia load path to first look in `Project.toml` and then `devtools/Project.toml` (and then in stdlib):

```bash
$ export JULIA_LOAD_PATH="${PWD}:${PWD}/devtools:@stdlib"

```

To handle this automatically I recommend using [direnv](https://direnv.net/). I wrote a [blog post](https://fredrikekre.se/posts/direnv-with-julia/) about direnv and Julia which has some more examples of this (and other nice things you can do with direnv together with Julia).
