Making my package enviroment "Evergreen"

You may have noticed that your web-browser is ever-green
If you check your About Firefox today you’ll see you are running FireFox v64.0.2.
Now that version was release on January 9, 2019.
You might be thinking: “But I installed Firefox 6 months ago, and I never updated it?!?”.
This is because webbrowsers install updates in the background.

I want that for my julia enviroments too *.
For a while I was doing in my startup.jl:

using Distributed: Distributed
let
    pkg_worker = Distributed.addprocs(1)[end]
    Distributed.remotecall(pkg_worker) do
        redirect_stdout() # silence everything, only on this worker
        Pkg.update()

        # now remove this worker and say we are done
        remotecall(1) do
            eval(quote
                Distributed.rmprocs($(pkg_worker))
                printstyled("\n Pkg.update() complete \n"; color=:light_black)
            end)
        end
    end
end

But this has some problems. Things seem to go a bit weird.
I think Pkg does not really like it when you have two unrelated julia instances modifying it at the same time.

What is a more elegant and polished way of doing this?

(* lets pretend i want that. What I actually want is probably only to background install changes that are not breaking, according to semver. But one step at a time.)

I somehow don’t think mine does, I use apt full-upgrade manually.

On Linux (and perhaps OS X? I am not sure), I would consider a cron job for

julia -e 'import Pkg; Pkg.update()'

but that said, I don’t think it is a good idea, for the following two reason:

  1. if something breaks silently because of an update, you will only find out the reason indirectly,

  2. I now do most of my work in project environments, some of which I definitely don’t want to upgrade unless I have time dedicated to dealing with the consequences. That’s fine, as they of course will not be updated by the above, but then it is pretty useless.

I knew someone was going to come and say that.
I was speaking in broad strokes.

Part of what i meant by polished was a way to let you know what had happened.
Though that gives me an ideal: use a cron job like you suggest,
and write a log each day, which is printed the first time you start julia.

Part of the “Lets pretent I want this” was that I actually would want to do this, but filtering for which projects I actually want to do this in.

Thinking about this, I would actually like a

hey, your packages are 30+ days behind latest releases, maybe update?

warning each time I pkg> activate (which implicitly includes starting up Julia).

2 Likes