Automatic package update in startup.jl

Thanks to stacked environments, I only have two packages in my global environment: Revise.jl and EmacsVterm.jl.

I am wondering if there is a way to keep them automatically updated without (significant) user intervention. I could put a

import Pkg
Pkg.update()

in my startup.jl, but that would add a significant delay to every time I start up Julia.

Is there a simple way to

  1. check if I am online (other than the standard tricks, eg calling nslookup with a short timeout)

  2. query last time an environment was updated?

Would

import Pkg
if isinteractive()
    Threads.@spawn Pkg.update()
end

In the startup.jl work for you?
It would try to update in the background every time you spawn an interactive process.

1 Like