When a user activates a different environment in an existing session, packages already loaded from the previous environment can silently disagree with what the new environment specifies. The next using of a transitive dep often triggers a surprising round of precompilation (or, worse, the user keeps using a stale version without realizing it). The current messaging around this is scattered and reactive. This issue is to track ideas for making it clearer and more proactive.
Existing / proposed related work
When a user activates a different environment in an existing session, packages already loaded from the previous environment can silently disagree with what the new environment specifies. The next
usingof a transitive dep often triggers a surprising round of precompilation (or, worse, the user keeps using a stale version without realizing it). The current messaging around this is scattered and reactive. This issue is to track ideas for making it clearer and more proactive.Existing / proposed related work
status: highlight when deps have different loaded versions #4109 Annotates
Pkg.statusoutput with[loaded: vX]when the loaded version differs from the manifest. Only visible if the user runsstatus.activate: warn if different versions are loaded #4679 Emits a single warning at activate time, listing each loaded dep that disagrees with the new manifest (version mismatch) or is loaded from a different path. Catches the problem at the moment the user can still react (re-launch, choose a different env) before the precompile cascade.
WIP: Reland "Warn if an already loaded package is attempted to be loaded from a different path" julia#52798 (WIP reland of 44329 / 52778 / 52788 / 52789) Hooks
Base.requireto warn at load time usingpkgorigins[uuidkey].pathvslocate_package(uuidkey). Complementary: catches mismatches that arise from any source (REPL--project, manualLOAD_PATHedits, dev workflows) regardless of whetherPkg.activatewas used. Has been merged and reverted; treehash check is still a TODO there.Prefer adding already loaded dep versions #4507 Different angle entirely: bias the resolver toward the versions already in the session so
Pkg.add/ instantiate is less likely to create a mismatch in the first place.Prompt the user on a manifest version mismatch #3775 Earlier attempt to interactively prompt on activate; closed without merge. Useful prior discussion of UX trade-offs (warn vs prompt vs error).
instantiate: add
update_on_mismatchkwarg to fall back toupdateon a stale manifest #4678 Adjacent: letsinstantiateautomaticallyupdatewhen the manifest is stale relative to the project, reducing one class of "why is this recompiling?" surprises.