How do I update an environment in Julia?

danielsoutar
Tue, 31 Jan 2023 17:08:38 +0000
General Usage

Hi, a colleague of mine and I were arguing about environments in Julia in a project we have.

Let’s say we have a standard project:

$ ls
Project.toml ... Manifest.toml ... src test ...

I might have some version restrictions in the Project.toml, so I might amend them. For example:

- SomePackage = "^0.7.1"
+ SomePackage = "=0.8.0"

What would I need to do to ensure the environment reflects this change? Does it need to be a clean build? And what constitutes a clean build?

My understanding (obviously correct me if I’m wrong) is that you would do this in Pkg. You might instantiate in the current environment. Alternatively a ‘clean build’ would mean deleting the Manifest and regenerating it via activate .; instantiate in Pkg. The latter could be important for ensuring that the update to SomePackage propagates to all other packages.

My colleague says that in order to have a clean build, you need to remove the entire .julia directory in the home directory. This seems extreme to me, but maybe this is occasionally necessary.

I am somewhat conflicted because I suspect there may be cases where doing each of these makes sense. Can someone explain with reference to other factors such as:

Whether a particular package might install an external C library or require one

Multiple versions of the same package

Package version requirements

A ‘library’ versus an ‘app’ (i.e. the latter is not a precompiled package/library but rather a script that acts as a consumer of Julia packages)

Any combination of the above

Any clarification greatly appreciated!

3 posts - 3 participants