fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.91k stars 284 forks source link

Precompilation problem on 1.11 with complete_remote_package #2810

Closed j-fu closed 3 months ago

j-fu commented 4 months ago

See https://gist.github.com/j-fu/1fd2a044636cf0a2737b999db043cc22 Pluto doesn't precompile on nightly, seen this in nightly ci for mac,linux, windows.

May be a problem with Julia, though.

balenamiaa commented 4 months ago

I think this is because complete_remote_package is defined in an package extension of REPL now. It's used in _registered_package_completions. Replacing Pkg.REPLMode with REPLExt where

using REPL
const REPLExt = Base.get_extension(Pkg, :REPLExt)

fixes it for me, but this seems like a hack.

j-fu commented 4 months ago

Yes, this indeed seems like a hack. Did some research: in 1.10, complete_remote_package is in the REPLMode submodule, and not exported. Formally, then it is not part of the public API.

Not sure if it make sense to code a work-around in Pluto now.

IMHO in 1.11 this could be made part of public API using the new public keyword. According to the logic of extensions, once it is public, Pkg.jl somwehre needs to declare

public function complete_remote_package end

Then the extension would extend this function once REPL is loaded. IMHO this would warrant an issue or a PR with Pkg.jl .

j-fu commented 4 months ago

const REPLExt = Base.get_extension(Pkg, :REPLExt)

Well, I just tried this out, the error as described in the gist persists. The error occurs when calling RegistryInstances.reachable_registries() during precompilation:

https://github.com/fonsp/Pluto.jl/blob/9f9ab2e1e858e978bcfe53f9ab2c28f2e547dfd9/src/packages/PkgCompat.jl#L170

I can call RegistryInstances.reachable_registries() from the REPL without problems. So there seems to be more to the picture, and we have at least two problems: