Variable interpolation in pkg command

Hi !
Do you know if it is possible to use variable interpolation in pkg command to feed pkg with a list of packages ? (see example below)
Thanks !

using Pkg

pkg"activate ."
pkg" instantiate"
pkg" status"

pck = ["Combinatorics", "DataFrames", "CSV"]
for p in pck
    cmd = " add $p"
    pkg"$cmd"
end

Probably not since it’s a macro, but you have the standard function interface to pkg as well. Pkg.add

@baggepinnen thank you !
The working example is

using Pkg

pkg" activate ."
pkg" instantiate"
pkg" status"

pck = ["Combinatorics", "DataFrames", "CSV"]

for p in pck
    Pkg.add(p)
end
1 Like