# Free "dev"-ed packages

**URL:** <https://discourse.julialang.org/t/free-dev-ed-packages/41806>\
**Category:** General Usage\
**Created:** [June 21, 2020, 7:05am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806 "2020-06-21T07:05:45Z")\
**Posts on this page:** 7\
**Page:** 1

<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:** [June 21, 2020, 7:05am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806/1 "2020-06-21T07:05:45Z")

</div>

Suppose I work on several projects that are located in `~/A/`, `~/B/`, `~/C/`, where each folder is a julia environment and has a `Project.toml`. There are several my packages that are used by all these projects, and the packages are registered in a local registry - so I just `add` them to each project.

Sometimes when working on `~/A/` I need to add or edit something in package `PackageD`. In such case I do `develop --local PackageD` and can conveniently edit this package and test how it works with `~/A/`. After everything works, I commit & push updated `PackageA`, register its update in my registry, and do `free PackageD`.

However, the folder `~/A/dev/PackageD` remains there with all its content, even though as I understand it’s not used at all anymore. This is where I get confused, as `help free` says:

> If the package is checked out (see help develop) then this command makes the package no longer being checked out.

I assumed that `dev`-ed package directories get removed when I do `free` - but it’s not the case. Could you please explain what’s the reasoning for keeping `~/A/dev/PackageD` after `free`?  
After some time I got many folders in `~/{A,B,C}/dev/*` that are no longer used - is there a way to actually find the unused ones and remove them?  
Also, I would be interested to hear if my workflow here is not optimal/not expected.

---

<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, 2020, 9:26am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806/2 "2020-06-21T09:26:34Z")

</div>

> [@aplavin](#):
>
> I assumed that `dev` -ed package directories get removed when I do `free` - but it’s not the case. Could you please explain what’s the reasoning for keeping `~/A/dev/PackageD` after `free` ?

Pkg is not in the business of deleting code on your computer so thats why. What you get in the `dev` folder is regular git repos that Pkg does not manage, and thus Pkg doesn’t know if it is safe to delete.

> [@aplavin](#):
>
> Also, I would be interested to hear if my workflow here is not optimal/not expected.

Seems like a fine workflow.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [June 21, 2020, 10:12am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806/3 "2020-06-21T10:12:16Z")

</div>

```julia
]rm Pkg1
# or
]add Pkg1

```

---

<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:** [June 21, 2020, 10:18am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806/4 "2020-06-21T10:18:59Z")

</div>

> [@fredrikekre](#):
>
> Pkg is not in the business of deleting code on your computer so thats why. What you get in the `dev` folder is regular git repos that Pkg does not manage, and thus Pkg doesn’t know if it is safe to delete.

But this leads to many folders in `~/{A,B,C}/dev/*` not used by anything. And the only way to find packages that are actually `dev`-ed currently in any of the projects is to manually `activate` each project, run `]status` and see if there are pointers to `.../dev/...`.

Doesn’t it also contradict to the `free` help saying

> If the package is checked out (see help develop) then this command makes the package no longer being checked out.

? As I understand, after `free` the package remains checked out from git at the very same place as before `free`.

---

<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:** [June 21, 2020, 10:19am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806/5 "2020-06-21T10:19:56Z")

</div>

> [@xiaodai](#):
>
> ```julia
> ]rm Pkg1
> # or
> ]add Pkg1
> 
> ```

I don’t see how `add` and `rm` are relevant here. Can you expand on that?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 21, 2020, 11:15am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806/6 "2020-06-21T11:15:41Z")

</div>

> [@aplavin](#):
>
> But this leads to many folders in `~/{A,B,C}/dev/*` not used by anything.

Possibly, yes. An alternative workflow is to

1. just `dev` (without `--local`) a package, and if you need a change, make it in the original directory,

2. `add#somebranch` if you use this package in alternative projects and just want to make a change for one of them (ie work in a branch)

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [June 21, 2020, 11:32am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806/7 "2020-06-21T11:32:13Z")

</div>

> [@aplavin](#):
>
> But this leads to many folders in `~/{A,B,C}/dev/*` not used by anything

The package manager does not know that. With `]free` you say the package manager: “don’t use the `dev`-ed version anymore _in this environment_, but choose the highest registered version that is compatible with the rest of packages.” This does not mean that the `dev`-ed version won’t be used in another environment.

And even if it is not used in any environment, you may want to keep the copy in `dev` to continue editing the package. Deleting it automatically would be far more damaging than helpful in the majority of cases.

EDIT: I had overlooked that you said you are using `dev --local`. In that case, it makes more sense to think that you won’t need the `dev`-ed version after `free`-ing it. But it is not by any means the only possibility. So it is still safer to keep it.
