How to instantiate a project in a safe way?

I am using these scripts for now:

#!/bin/bash

if [[ $(basename $(pwd)) == "bin" ]]; then
    cd ..
fi

export JULIA_PKG_SERVER_REGISTRY_PREFERENCE=eager
julia --project -e 'include("bin/install.jl")'

And install.jl looks like this:

using Pkg

try
    Pkg.instantiate()
catch
    try
        Pkg.resolve()
    catch
        Pkg.update()
    end
end

The problem these scripts are supposed to solve are:

  1. after a new collegue checked out our project, it is not instantiated
  2. if you try to instantiate it, that might fail, it might be needed to call resolve
  3. resolve might fail, you might need to update

Is there a better way?

Have you considered DrWatson.jl?

I found that quite useful (not just for the @quickactivate but also for its other features :wink: )

1 Like

Interesting, but looks a bit too feature rich for this problem (to me).