Free "dev"-ed packages

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.

1 Like

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.

Seems like a fine workflow.

]rm Pkg1
# or
]add Pkg1

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.

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

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)

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.

1 Like