JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
44.97k stars 5.42k forks source link

REPLExt for Pkg no longer loads when loading a custom Pkg #54941

Open KristofferC opened 1 week ago

KristofferC commented 1 week ago

On master:

~/JuliaPkgs/Pkg.jl
❯ julia +nightly --project -q

julia> VERSION
v"1.12.0-DEV.784"

julia> using Pkg
[ Info: Precompiling Pkg [44cfe95a-1eb2-52ea-b672-e2afdf69b78f] (cache misses: for different buildid (2), mismatched flags (2))

julia> pkg_ext = Base.PkgId(Base.uuid5(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "REPLExt"), "REPLExt")
REPLExt [e5eb5ef1-03cf-53a7-ae1d-5a66b08e832b]

julia> haskey(Base.loaded_modules, pkg_ext)
false

On 1.11.0-beta2:

julia> using Pkg

julia> pkg_ext = Base.PkgId(Base.uuid5(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "REPLExt"), "REPLExt")
REPLExt [e5eb5ef1-03cf-53a7-ae1d-5a66b08e832b]

julia> haskey(Base.loaded_modules, pkg_ext)
true
kimikage commented 1 week ago

I do not think this seems to be an issue with a custom Pkg. (cf. #54906)

vtjnash commented 1 week ago

We might want to consider injecting REPL (and dependencies) into the visible running state (aka into explicit_loaded_modules, or remove that and use loaded_modules directly again instead), but that also has quite a number of other undesirable implications, which is why we don't do that anymore. The process now make a clean distinction between using a REPL and having REPL loaded, so if you want Pkg+REPL+REPLExt, then you need to make it explicit that you want using Pkg, REPL, and not just assume you can access the REPL as a side-effect of having loaded Pkg.