I find it hard to develop in Julia

In my humble opinion, Pluto doesn’t need a custom package manager. I’ve been actively avoiding that package manager because it just dumps literal hundreds of lines of package info (the contents of Project.toml and Manifest.toml) straight into the notebook file, thus making it absolutely massive. When I want to share Julia code online, I simply do this at the top of the code:

begin
 import Pkg; Pkg.activate(temp=true)
 Pkg.add([
   (; name="Distributions", version="0.25.123"),
   (; name="PyFormattedStrings", version="0.1.13"),
   # ...and so on...
 ])
 Pkg.status()
end

The Pkg.add call outputs tons of extremely verbose text, but I think there’s a way to redirect it to /dev/null or otherwise silence it. The Pkg.status() call is there to show what’s in Project.toml.

This just works for me: all package information is written out explicitly (package names, exact versions, etc), it uses the built-in Pkg.jl, it’s just regular Julia code. It works fine in Pluto.

Can’t Pluto create a new cell with this block of code automatically? I guess it’s not that simple because Pkg doesn’t support dry runs: Dry run of adding a package.

Just imagining some convenient API like Pkg.try_add that basically does everything Pkg.add does but does not modify the existing environment and instead returns the would-be contents of Project.toml as a vector of Pkg.PackageSpec:

function on_new_input_using_statement(packages::AbstractVector{<:AbstractString})
  package_specs::Vector{Pkg.PackageSpec} = Pkg.try_add(packages)
  for spec in package_specs
    # add the package to the Pkg block in the notebook if it's not already there
  end
end
3 Likes