How can I use an unregistered package without breaking Pluto’s package management system?
I read about the custom local registry, but I do not want to go that route.
How can I use an unregistered package without breaking Pluto’s package management system?
I read about the custom local registry, but I do not want to go that route.
Pluto.activate_notebook_environment("notebook-file.jl")
in a REPL will activate the environment from that notebook and then you should be able to just add
stuff in the normal way with ]
. 🎁 Package management · fonsp/Pluto.jl Wiki · GitHub section at the bottom has some details.
Edit: I misread that, if you want an unregistered package you need to use a Pkg
cell for that:
begin
import Pkg
Pkg.activate(mktempdir())
Pkg.add(...)
end
and install the unregistered ones in there.
But doesn’t this break Pluto’s package management system?
You can ]add
unregistered packages, can’t you?
A somewhat hacky solution is to redefine a Pluto function:
function Pluto.use_plutopkg(topology::Pluto.NotebookTopology)
!any(values(topology.nodes)) do node
Symbol("Pkg.activate") ∈ node.references ||
Symbol("Pkg.API.activate") ∈ node.references ||
Symbol("quickactivate") ∈ node.references ||
Symbol("@quickactivate") ∈ node.references
end
end
before calling Pluto.run()
. Then you can use Pkg.develop
and Pkg.add
in notebooks without disabling the Pluto package manager.
Has been working fine for me since the introduction of this feature in Pluto.