Skip to content
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

What problem does this solve? #42

Open
justinmk opened this issue Jul 3, 2023 · 12 comments
Open

What problem does this solve? #42

justinmk opened this issue Jul 3, 2023 · 12 comments

Comments

@justinmk
Copy link
Member

justinmk commented Jul 3, 2023

What problem does a "packspec" solve?

The problem needs to be worth solving. #41 proposes to limit the scope to:

  1. Defining a dependency tree, in a distributed/federated mannger (no central package registry), using only URLs and versions.
    • Enables plugin managers to install plugin dependencies without explicit instruction by the end-user.
    • Enables package "aggregators" (example) to partially discover plugins by walking the dependency tree, which reduces maintenance and increases quality of the list.
  2. (TBD) Defining ecosystem-defined hooks for pre-install, post-install etc.

Anything else? Is this problem worth solving? Does #41 solve it?

Elevator pitch

packspec (or whatever "wild west half-baked dependencies declaration format") is merely a high-leverage, ultra-low-effort way to start formally connecting the existing web of vim/nvim dependencies. It doesn't preclude a LuaRocks or other centralized solution later, it simply formalizes what already exists.

@clason
Copy link
Member

clason commented Jul 3, 2023

  1. Explicitly stating "engine" compatibility (Vim 8.2+, Neovim 0.9+) as a stronger contract than a too-easily-overlooked line in a README (and possibly as a replacement for a bunch of homegrown has('foo') and executable('bar') boilerplate).

@justinmk
Copy link
Member Author

Via https://twitter.com/oilsforunix/status/1680957458431213569 :

I have been lightly working on almost exactly this, many notes on https://oilshell.zulipchat.com (please join). Working name is "Silo" for dumb artifacts; "medo"/meadow for git-versioned trees. It's a "meta" package manager because it invokes containerized apt, pip, etc.

... No format yet, right now it's shell scripts making the on-disk format, dealing with root/non-root issues. It's focused on data too big for git as well.

... say you want to build something like a VSCode remote server image for neovim, and add say a whole Pandas stack - more coarse-grained composition. It can invoke any packager manager including a neovim one, but also pip etc.

This oilshell effort sounds more like a "package manager-manager" (like how cmake is a "build script generator").

@sarmong

This comment has been minimized.

@justinmk

This comment has been minimized.

@sarmong

This comment has been minimized.

@justinmk
Copy link
Member Author

i.e. not dependencies of a plugin, but dependencies of a user's configuration.

Yes. Users can specify their plugins in a local pkg.json.

whether it should play a role of lazy-lock.json

Lockfile is tracked in #47

users would have to specify ...
1. Directory to install

This is defined by the plugin manager. Intentionally not part of the spec, because it's target-dependent. Do you see a problem with that?

2. Branch to track.

I believe any git ref can be expressed in the version, though this is basically the one thing blocking this project: I need to decide whether we should deviate from NPM's version spec (which is pretty nasty).

I think probably the answer is "yes, deviate".

3. Local version (I see that version field can use file://, however I don't understand the point of it. Rather, the key of the dependency should allow file://, which is now "Only support commit-id, tags, and HEAD"

That might be something inherited from NPM. May need to revisit (see above).

4. Install to start or opt

I think the conclusion by the vim/nvim ecosystem is "neither" or "doesn't matter". It's out of scope for packspac. Nvim/Vim plugin managers need to manage 'runtimepath' (and maybe 'packpath').

5. Hooks (Post-install hook #23)

NPM has a spec around this. scripts, pre*, post*.

6. Probably some other properties of plugin_spec implemented by current package manages?

Part of the work of packspec is to leave target-dependent decisions up to the target. The goal here is, narrowly, to allow dependencies + versions to be specified; everything beyond that is out of scope.

@sarmong
Copy link

sarmong commented Feb 17, 2025

I am asking all of this because I see flaws in all current plugin managers, as they don't have easy access to all plugin specs from the start.

  • Lazy - has access to all plugin specs on load, but takes control over user's config entirely, which is a big downside for me
  • Mini.deps - benefit that user can have flat config with no magic and take control over plugin loading with .use. However, since the plugin manager doesn't know about all plugins ahead, this causes plugins to install synchronously one by one.
  • Pckr (and mini.deps can be used like this too) - have all plugin definitions in one place separate from their configs. Downside - it is lua code, so it cannot be modified programmatically.

I am currently exploring a solution wherein user can call Install command, which will write plugin spec to json file and then gives control to loading of the plugin back to the user (for opt).

So, in my opinion, this may fix my dissatisfaction with current plugin managers - no magic, flat config, programmatically writable spec file and asynchronous installs.

Not sure if the issues I touched upon even matter to anyone, but I came to explore packspec to see if my solution can be made in a standardized manner, to not create another snapshot/dependencies/lockfile specification used only by me.

@Shougo
Copy link

Shougo commented Feb 18, 2025

I am asking all of this because I see flaws in all current plugin managers, as they don't have easy access to all plugin specs from the start.

It means you need spec repository like Emacs MELPA?
https://melpa.org/

Certainly, having a central repository would be convenient for users to search and install plugins, but there are several issues:

  • Who will register and update the plugins?
  • Who will set up and maintain the repository?

Note: In the case of MELPA, the approval process seems to be manual.

@sarmong
Copy link

sarmong commented Feb 18, 2025

No, I didn't mean central repository, although this seems like an interesting idea.

I meant json file in user's config that holds user-defined plugin spec (commit/tag, branch, dir, hooks, opt/start, etc.).
Basically the same thing that current plugin managers' plugin specs hold, just in a centralized json file over lua files in users' configs. Benefit is that it is programmatically writable and plugin managers can see full specs from the start.

@teto
Copy link
Member

teto commented Feb 18, 2025

Not to hijack the thread but there is IMO a pretty successful POC based on rockspecs (the format used by luarocks) with luarocks.org holding probably > 400 neovim plugins (https://github.com/nvim-neorocks/nurr uploads 350 by itself). With https://github.com/nvim-neorocks/rocks.nvim you can Rocks install <PLUGIN> and it magically installs dependencies. This is also used in nixpkgs to automatically deduce dependencies.

My petpeeve and my main frustration with the plugin ecosystem now is that all plugins mandate some sort of setup when there shouldn't be any ! Many plugins require empty require'freaking-plugin'.setup() calls to even work ! So I've got this wonderful UI where I can install/remove at will plugins but it's of no use since afterwards I've got to add some silly configuration. One of neovim goal was is to make vim more approachable and work out of the box and this trend is counter to that.

So packspecs might do more but a lot could be accomplished first by the usage of vim builtins (autoload and so on).

@Shougo

This comment has been minimized.

@teto
Copy link
Member

teto commented Feb 19, 2025

Just to make things clear, I dont contest that some plugins require configuration but 80% could happily work without a config out of the box.

If plugins were to work automatically upon installation, there is a risk that users wouldn't be able to tell which plugins are active just by looking at the configuration files.

If you dont use the plugin, dont install it ?! or install it in packpath's opt/.
Also my beef with setup is that it's a require"plugin".setup() so once you uninstalled the plugin it triggers an error. Much better is to have the config in vim.g.MYPLUGIN_config. While I am less active on the main neovim repo, I test out lots of plugins for packaging purposes/help and having to constantly add/remove setup lines is irritating. https://github.com/nvim-neorocks/rocks-config.nvim/ alleviates this a bit but I can't always use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants