mitmath/computational-thinking

Preinstall packages for offline access

JamieJQuinn opened this issue · 0 comments

Not strictly an issue; I just thought this may be useful to others. Also not an expert in Julia so if there's an easier way to do this please do correct the script.

I wanted to access the notebooks offline but due to Pluto installing packages per notebook, each notebook must be instantiated while having internet access. This script does that for every notebook in the notebooks directory in the Spring21 branch:

using Glob
import Pluto
import Pkg

function main()
  dirs = glob("./week*/*.jl")
  for jl_file in dirs
    println(jl_file)
    Pluto.activate_notebook_environment(jl_file)
    Pkg.instantiate()
  end
end

main()