I’m currently preparing a training session, and this process triggers again some questions that I had when initially discovering Julia and which haven’t really disappeared since then.
Here is the current situation: I’m preparing a training session in Julia, where trainees should ideally learn how to develop their own packages. This of course includes managing the dependencies of their own projects/packages (which is a fairly well-documented process). But this also includes using packages such as
ProfileView… which are not strict dependencies of anything; more like useful elements to incorporate in your workflow. I’d like to provide an easy way for all trainees to install these packages beforehand, so that ideally we will not depend too much on available Internet bandwidth on D day.
On my system, I installed all those packages in the default (v1.1) environment. Is that the correct way of doing things? It appears to me that, when a package is activated, you get access to:
- the package itself
- all packages that were
Pkg.added in the environment of the package
- all packages that were
Pkg.added in the default environment
Pkg.test checks that actually using the package (and running its test suite) makes use only of the first 2 categories above, as well as Test-specific dependencies added. By the way, it is not clear to me how these test-specific dependencies should be added: is it possible to avoid by-hand editing of
Project.toml? Another thing which is not clear to me: in which environment does
Pkg.test install test-specific dependencies if they were missing?
I haven’t found any place in the documentation (neither of modules nor of Pkg) where these details are clearly documented. I might very well have missed something; otherwise, I’d be glad to propose PRs to the appropriate documentations.
Back to my current problem: a first option would be to provide a
Project.toml file that my trainees would put in their
~/.julia/environments/v1.1/ folder. But then, if some of the trainees have already installed some packages they rely on, my list will override theirs, potentially causing unpleasant surprises later.
Another option (currently my favorite) consists in providing a simple script which goes like this:
using Pkg # ensure we are in the default (home) environment Pkg.activate() # Install dev tools Pkg.add("Revise") Pkg.add("BenchmarkTools") #...
Question 1: Is the above a good way of doing things ?
Question 2: How can I test this? I.e make sure I did not forget any tools in my list. I currently:
- move the whole
- try and install everything in an empty environment, then check that I can perform everything asked in the training session;
- move my original
Is there a better way of doing this?
PS: Sorry for the long question, and thanks to anyone taking the time and effort to read until here…