Avoiding recompilation with multiple projects?

package-manager

#1

I’ve been using a project based workflow where I have multiple projects that use different versions of the same packages: some use tagged versions, some use global dev versions, and some use local dev versions. This works very well with Atom’s notion of a project: I have my startup script automatically activate the open project.

The issue seems to be that anytime I switch between projects it seems to need to recompile everything. Worse, I get lots of errors like:

┌ Warning: Module Compat with build ID 1247947941331623 is missing from the cache.
│ This may mean Compat [34da2185-b29b-5c13-b0c7-acf172513d20] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947

I was under the impression that Pkg3 could work with multiple versions of the same package and cache the results. Is there something I should change in my workflow to avoid the constant recompilation?


#2

Not an answer to your question - but how do you have Julia activate the open project in Atom?


#3

See also https://github.com/JuliaLang/julia/issues/27418, although that Compat error is probably another issue, see e.g. https://github.com/JuliaLang/Compat.jl/issues/636


#4

Here’s my startup file:

try # avoid bug in building packages
	using LinearAlgebra, Pkg, SparseArrays, SpecialFunctions, Random, Test
	isfile("Project.toml") && Pkg.activate(".") # auto-activate Project in Juno
catch
end

It works because Atom initialises the path to be the package folder.


#5

great tip - thanks!