Importing an existing package without re-precompiling

Often, I need functionality of a low-level package, say ChainRulesCore.jl, which is already included by other packages and thus in the Manifest.toml, but not yet in the Project.toml.
Therefore I ]add ChainRulesCore, however this triggers a re-precompile of many of my existing packages, which takes minutes and completely breaks my workflow. This is especially annoying if it happens for multiple packages in a row. Is there are way to “add” an already installed package without triggering a mass re-precompile? I already looked at the ]add --preserve flag, however none of the options seemed to help…

You can do using Package.Dependency, e.g.

julia> using StaticArrays

julia> using StaticArrays.StaticArraysCore

julia> StaticArraysCore.Size(rand(3,3))
Size(StaticArraysCore.Dynamic(), StaticArraysCore.Dynamic())

This is not safe, since package dependencies are internal to the package and can be removed completely without counting as a breaking change (unless they’re part of the package’s documented API). But if you’re just going for something quick and dirty, it’ll do.


Thanks! Yes, something quick and dirty will often do during rapid development.
It is good to have the option, and then fix the dependency once you’re sure that is actually what you need.

Pkg.offline(true) might also work.