-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependencies format #19
Comments
Let's not assume that
That's still the case despite what is proposed here. Implementations have (and should) have a lot of freedom in what they decide to do. If we find any form of fragmentation starts to form, then we improve (and tighten) the spec. We shouldn't over-speculate. And tbh, this point is a little hyperbole, packer.nvim and paq-nvim are currently the only package managers (I know of) that will be reasonably able to support this spec.
Being registered on https://luarocks.org/. Rocks don't need a URL as it is a centralized source. We've already agreed on the structure These are just my opinions though. Feel free to push back. |
The point I was making is conflicts between the package names and special dependencies. If packages are kept separate from everything else that should fix the problem. So just as an example, some implementation adds We have no idea what will happen, like maybe someone will one day fork neovim and add some stuff to it that plugins might like to check. If we can future-proof the specification against things like that and make it solid, why shouldn't we? |
Other stuff aside, you do raise an important point about conflicting package names. Since packspec aims to support a decentralized model, we need to be able to handle conflicting names. With current systems, plugins are discriminated using the github project name, which can't conflict, so it hasn't been a problem. However since packspec has a Not really sure how we handle this, but I think we definitely need to. |
About that, I think the |
Actually wait one second, you said rocks don't need URL? So it's going to be based on what key it has? How is that supposed to work, if there is a URL it's a package for sure, but if not then check if it happens to be in the luarocks repository? If so then I don't like this idea. If anything, it should probably have a |
Maybe keep rocks out of |
Anything is fine by me, as long as there is no ambiguity in what the dependency is actually supposed to be. It can be a |
I've been thinking a bit about the dependencies and the names colliding. I think an alternative is to think of the url of the dependency as the actual unique ID. And the name provided to be like what dns is to ip addresses (if that makes sense? : 😊) And then implementations can support something like git rewriting rules:
|
Hmm that might work. Something like |
Can we summarize the options and come to a decision?
dependencies = {}
dependencies.neovim = { version = ">= 0.6.1" }
dependencies.pack = {
gitsigns = { version = "> 0.3", source = "https://github.com/lewis6991/gitsigns.nvim.git" },
}
dependencies.rock = {
foo = { ... },
}
-- maybe even move external_dependencies here
dependencies.external = {
git = { version = ">= 1.6.0" },
}
dependencies = {
gitsigns = { version = "> 0.3", source = "https://github.com/lewis6991/gitsigns.nvim.git" , type="git"},
foo = { type = "luarocks" },
}
external_dependencies = {
neovim = { version = ">= 0.7" }
}
dependencies = {
gitsigns = { version = "> 0.3", source = "git://github.com/lewis6991/gitsigns.nvim.git"},
foo = { source = "luarocks://foo"},
}
external_dependencies = {
neovim = { version = ">= 0.7" }
} Let's separate out the neovim API version validation question, and where to store the neovim dependency itself. I don't think in practice name collisions will be an issue, the name as it stands does not matter, it's mostly organization of the source keys. I think it would look much worse if the dependency table keys were the source URIs. |
I've thought about this some and here's my rough idea.
E.g. dependencies = {
['lewis6991/gitsigns.nvim'] = { version = "> 0.3"}
} canonicalizes too dependencies = {
['lewis6991/gitsigns.nvim'] = {
package = 'gitsigns.nvim',
version = "> 0.3",
source = "https://github.com/lewis6991/gitsigns.nvim.git" ,
type = "git"
},
} However, this would still be valid: dependencies = {
my_gitsigns_dep = {
package = 'gitsigns.nvim',
version = "> 0.3",
source = "https://github.com/lewis6991/gitsigns.nvim.git" ,
type = "git"
},
my_gitsigns_dep2 = {
package = 'gitsigns.nvim',
version = "> 0.3",
source = "https://github.com/lewis6991/gitsigns.nvim.git" ,
type = "git"
},
my_gitsigns_dep3 = {
package = 'gitsigns.nvim',
version = "> 0.3",
source = "https://github.com/lewis6991/gitsigns.nvim.git" ,
type = "git"
},
} Note: having duplicate deps like this isn't actually possible in Neovim currently, but that shouldn't concern the spec. We just need to have some format to allow it. This allows us to avoid conflicts in the unlikely case they happen, since the dependency key name isn't strictly the package name. We may also want to enumerate |
Is it worth having a type field if we are already distinguishing source by URI prefix? Or should we remove the URI prefixes? |
I think the URL is redundant if there's a given type field, but URL on its own is enough. For most cases we should aim to build the URL from package+type+namespace. This is at least true for GitHub but other source types will be different. |
What is the purpose of |
I don't think |
The match against the deps package name in package.lua/json. Without it, both fields are pointless.
I think what you're really saying is that |
So the package manager should assert that dependency name matches the actual package name, do I understand it correctly? Is it really necessary though? Or could it be used for package repositories in the future?
Isn't that what the URI scheme is for? |
Okay, sorry, I can see the point now. In my opinion dependencies should always have the full URI. |
If they should always have the full URI, then dependencies only needs to be a list of URI's. However, I disagree with this and users should be able to specify dependencies in a more abstract way, this will allow implementations more freedom in how they handle certain sources. E.g. for git do you use |
That's how I imagined it, that it's essentially just a list of URIs with some metadata, just like most vim plugin managers work. For git I figured you'd just use the |
I don't think the spec should have any impact on where the manger puts things. Don't think you're implicitly suggesting that though.
I agree with this. I like this method to define the neovim requirement dependencies = {}
dependencies.neovim = { version = ">= 0.6.1" } I prefer this version as
Personally I would promote the key up out of the deps list as I see it as a runtime requirement, not a dependency to "be managed in relation to the plugin", but if you have separate dependencies.external = {
git = { version = ">= 1.6.0" },
} What is the proviso for a tool that has no version, or no semver version? dependencies.external = {
-- true -> just must be present?
git = true
git = { version = "any" }, -- 🤮
-- placeholder for `git` exists and don't check otherwise?
-- valid constraint but the manager can take liberty to
-- shortcut it to a presence check?
git = { version = ">= 0.0.0" },
}
I'd really prefer to not see this. Specs are written a few times and (programatically) read often, I don't think it hurts too much to define urls explicitly and I don't think it does the collective us any favours by tying a schema explicitly to a single forge. You could define some namespace shortcut format as say, |
The way I see it there are a couple problems with the current
dependencies
format.First, special dependencies like
neovim
. I assume the implementation is supposed to just have special handling for keys likeneovim
. However, what if a new dependency type like this is introduced in the future?neovim_api
for plugins using RPC,treesitter
for treesitter version,lua
for interpreter version,vim
for vanilla vim etc. Sure, you can just bump the spec version when adding something, but what if an implementation wants to add something custom on top of that, that we can't predict? This could potentially result in conflicts with what plugins have declared as dependencies inpackspec.lua
.Second, luarocks. I'm not familiar with how it works yet, but how do you detect what is supposed to be a rock? Do you have to clone the repository, check what's inside, and if it's a rock then delete the repository and run
luarocks install <rock>
? That kinda complicates it.In my opinion it should be required to somehow specify the type. Either by the
type
field (but that would make the entire thing kinda verbose) or by grouping them in tables, like this:cc @wbthomason
The text was updated successfully, but these errors were encountered: