Hi everyone
TL;DR
Propose to explicitly specify the registry where a package is located in the Project.toml
and, by extension, have it appear in the Manifest.toml
.
The default registry would be General
and would not need to be explicitly recorded.
Longer Version
The more I learn about Pkg
and it’s design, the more I like it. It’s beautiful
I’ve spent the last couple days looking through the code to try to implement an idea I’ve had for some time and recently raised again here
https://github.com/JuliaComputing/Registrator.jl/issues/23
leading to this POC PR
https://github.com/JuliaLang/Pkg.jl/pull/1064
The idea is similar to npm scoping, i.e. I want to be able to explicity specify the registry when I add a package, e.g.
pkg> add @MyRegistry/MyPackage
or
julia> Pkg.add("MyRegistry","MyPackage")
My first thought (before I knew anything about how Pkg
worked) was to have the ability to register registries in a registry (say that 5 times fast!) and the @
would provide a way to specify explicitly which registry contains the desired package. Then there could be some kind of “forwarding” among registries.
I still think it is a good idea to be able to register registries with a registry, but not for the purpose of forwarding add
requests. Rather, now I see how one registry may have an indirect dependency on another registry.
For example, I just created a registry for JuliaFinance. I am still experimenting so there is only one package, Currencies.jl
in the registry, but this package is also registered in the General
registry. I am consdering to de-register Currencies.jl
from the General
registry and just use JuliaFinance
registry instead (unless peers convince me otherwise, which is certainly possible ) .
Now, let’s say AnotherPackage.jl
is registered with the General
registry, but AnotherPackage.jl
has a dependency on Currencies.jl
from the JuliaFinance
registry.
As long as the user has previously manually added
pkg> registry add https://github.com/JuliaFinance/JuliaFinance
everything should work, but if Julia cannot find the JuliaFinance
registry, it will fail to find Currencies.jl
.
So what I am thinking is to elevate registries to be first-class citizens on par with packages.
So if AnotherPackage.jl
in the General
registry has a dependency on Currencies.jl
from the JuliaFinance
registry, then AnotherPackage.jl
implicitly has a dependency on the JuliaFinance
registry as well. I think we should make that implicit dependency explicit in the Project.toml
and, by extension, in the Manifest.toml
.
If everything can be found in the default General
registry, there is no change to either Project.toml
or Manifest.toml
.
One thing I like about this proposal A LOT is that it diminishes the importance of General
registry and every person and every organization can have their own registry. A registry just becomes analogous to “scopes” in npm, but in a decentralized manner. People should not be shy about creating registries any more than packages.
The way things are set up currently, as I understand it, there is an implicit centralized assumption that there should be a “root”, but I don’t see it that way. Pkg
was designed well enough from the beginning that, with some work, it can become a truly decentralized package manager.
I’m happy to put some elbow grease into this, but it is not a small amount of work so wanted to share my thoughts before diving in.
Edit: I previously linked to an unrelated issue by mistake. Deleted.
Any thoughts?