Understanding Pkg - add a temporary development module

A recent workshop (on MLJ) began with the following instructions for adding a module for the workshop:

ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0
using Pkg
Pkg.activate(temp=true)
Pkg.develop(url="https://github.com/ablaom/HelloJulia.jl")
Pkg.activate(joinpath(Pkg.devdir(), "HelloJulia"))
Pkg.instantiate()
ENV["JULIA_PKG_PRECOMPILE_AUTO"]=1

using HelloJulia

Please clarify a couple of points:

  1. Do the two ENV commands prevent precompilation of the module’s dependencies, meaning that the necessary dependencies would be compiled as needed, saving time on startup?
  2. As for the double activate commands, is the first command used to “dump” temporary downloaded files and build artifacts in a /tmp directory whereas the second command makes the built module accessible for the using command?
    As for the second activate command, what is the purpose of the devdir()? I don’t see anything there

Lastly, if this sequence of commands is the recommended way to develop/debug a downloaded module, shouldn’t it be added as a command (or option) to Pkg?

1 - yes. 2 - the first activate just activates a temp directory, so that the HelloJulia package doesn’t get added to the user’s global environment. Then HelloJulia is added via the develop command, which means it gets installed in the dev directory rather than the packages directory where packages which are added in the normal way get stored.

1 Like

I’d say this is not the way one would usually develop someone else’s package. Instead, the more direct approach would be to follow the Pkg docs (git clone / activate / instantiate).
Perhaps the tutorial tried to stay away from git.

1 Like