Repository navigation
vimPluginsUpdater: rewrite to use nupd - #380691
PerchunPak wants to merge 3 commits into
Conversation
|
Now update of all plugins is faster than my git status! Also, please don't merge any new plugins until this is merged |
51984bc to
1287ee2
Compare
1287ee2 to
3dffe72
Compare
|
Weird, eval works for me |
|
|
||
| ``` | ||
| nix-shell -p vimPluginsUpdater --run vim-plugins-updater -i vim-plugin-names -o generated.nix --no-commit | ||
| nix-shell -p vimPluginsUpdater --run 'vim-plugins-updater update "https://github.com/folke/lazy.nvim"' |
There was a problem hiding this comment.
Does this no longer support by plugin name? Seems more appropriate than having to enter an entire url everytime
ie:
vim-plugins-updater update lazy-nvim
There was a problem hiding this comment.
It uses the same system as add command. I plan to remove https://github.com/ that is required for every plugin in the near future
There was a problem hiding this comment.
Hmm... alright :S Not a fun regression, but we rarely do individual updates anyways, I suppose.
Do you plan to leave a single commit for this ? |
This comment was marked as outdated.
This comment was marked as outdated.
fe7934a to
f7d2070
Compare
khaneliman
left a comment
There was a problem hiding this comment.
Just quick glance things before diving into python.
| # Note that this updater does not support anything but GitHub, because we want | ||
| # to support metadata fetching and it is problematic to do automatically for all | ||
| # platforms. If you want to package a non-GitHub plugin - place it to non-generated folder |
There was a problem hiding this comment.
I'd like for this not not be the case long-term.
There was a problem hiding this comment.
Is this a regression when compared with the current update script?
There was a problem hiding this comment.
Yeah, I believe @PerchunPak had a previous PR for pulling out the non github plugins into non-generated in anticipation for this update. #376366 It was only a handful of plugins so we just moved them out, for now. But, for a long-term solution... we should be flexible with the sources, eventually.
There was a problem hiding this comment.
It's frustrating that we can't lean on more generic package update tooling, such as https://github.com/NixOS/nixpkgs/tree/master/pkgs/common-updater and https://github.com/Mic92/nix-update
There was a problem hiding this comment.
Yeah.. I really wanted to shift towards nix-update... Artturin had started on something Mic92/nix-update#202 to previously help with updating packages not adhering to the standard derivation style.
There was a problem hiding this comment.
I agree that losing support for non-GitHub plugins is controversial, but it is a trade-off that is worth making. I added this information to "features we lose" in the PR description, but also duplicated it here
There is only 26 non-GitHub Vim plugins in nixpkgs, and adding support for every possible Git hosting platform is too big a maintenance burden. Remember that this rewrite also fetches all metadata for the plugin. It is much easier and better to package those plugins in
non-generatedand update it usingnix-update. It's either we lose metadata info for non-GitHub plugins or just package them manually
There was a problem hiding this comment.
This seems reasonable. However if that's the direction we want to go in, I'd like to see an effort towards:
- renaming
generated.jsonto indicate it only relates to GitHub packages - updating packaging documentation to cover adding/maintaining non-github packages
- adding an update-script wrapper that runs all vimPlugins update scripts, including this one
None of these feel like things that need to be done in this PR, especially not the wrapper script.
But this PR could pivot from "TODO no GitHub support for now" to "this script only handles GitHub, other sources should define per-package update scripts".
There was a problem hiding this comment.
updating packaging documentation to cover adding/maintaining non-github packages
adding an update-script wrapper that runs all vimPlugins update scripts, including this one
@r-ryantm handles those updates. Also, such a script would probably be avoided as there is a bunch of Rust plugins in non-generated that are costly to build.
But this PR could pivot from "TODO no GitHub support for now" to "this script only handles GitHub, other sources should define per-package update scripts".
Could you send a link where I have that TODO comment? I could not find it
4c5a067 to
3bb988d
Compare
|
Applied some straightforward review suggestions, thanks for the fast reviews! Will work on slicing this into separate PRs now |
3bb988d to
c32ed73
Compare
|
See (Sorry, still haven't reviewed the python, yet... just cursory stuff since it's end of my work day and my eyes are getting tired.) "NotebookNavigator-nvim": {
"description": "A neovim plugin to navigate and execute code cells",
"homepage": null,
"info": {
"alias": null,
"branch": null,
"repo": {
"name": "NotebookNavigator.nvim",
"owner": "GCBallesteros"
}
},
"license": null,
"nurl_result": {
"args": {
"hash": "sha256-+FLHJ1tfIplXhO/6kajdcDBTIsNYN9kCOR9IdhXL6d4=",
"owner": "GCBallesteros",
"repo": "NotebookNavigator.nvim",
"rev": "20cb6f72939194e32eb3060578b445e5f2e7ae8b"
},
"fetcher": "fetchFromGitHub"
},
"version": "0-unstable-2024-05-23"
}, "NrrwRgn": {
"description": "A Narrow Region Plugin for vim (like Emacs Narrow Region)",
"homepage": "http://www.vim.org/scripts/script.php?script_id=3075",
"info": {
"alias": null,
"branch": null,
"repo": {
"name": "NrrwRgn",
"owner": "chrisbra"
}
},
"license": null,
"nurl_result": {
"args": {
"hash": "sha256-ULlstztsQxzDicj1OWexNWwwhcomaUJ4MagK5hb2nFU=",
"owner": "chrisbra",
"repo": "NrrwRgn",
"rev": "e027db9d94f94947153cd7b5ac9abd04371ab2b0"
},
"fetcher": "fetchFromGitHub"
},
"version": "0-unstable-2022-02-13"
}, |
|
Hey, any suggestions on this PR? Blockers? |
|
|
Done! |
|
Hello everyone, I just cleaned up the description; it now lists clearer pros and cons. Also, I implemented updating plugins by their ID ( And if you think the PR is massive, do note that without replacing auto-generated files, it is +295 -243 lines |
I run it very often and it never takes that long, but optimizations are appreciated. Don't think it requires an out of tree solution for that.
I did like the cli interface and progress last time I remember running this version.
Extra metadata is always nice. But, I felt like the desire for a few extra pieces of information from github made decisions to do shortcuts (ie cut other providers instead of just deal with missing information on some plugins)
This doesn't ring true to me when it's an out of tree solution that is depended on, imo. I've already been playing around recently with updating/fixing the existing script and doing it in smaller reviewable chunks.
This is something I still would like to address too. I feel like one of the biggest misses is not respecting plugins that use releases/versioning to signal they are ready for distribution.
This is actually a worry for me and not seen as a positive. In tree will be more susceptible to surprising changes from a dependency instead of being in control of itself entirely.
This still seems like a quick fix and doesn't need to be lost.
Thank you for adding that, i much prefer using the name instead of remember where a plugin came from (since it shouldn't matter to the caller of the script)
I view this is a thing we should probably revert, and address the limitation of, in any proposed updater. At the time, I just wanted to not make you feel like you were wasting time and keep things merging to keep morale up. But, over time it feels like it goes against the entire purpose of the
Auto committing is very convenient and not sure why you would hate that... when I run all my various ecosystem updaters in nixpkgs I want it all committed with proper commit conventions and descriptions, ready to push.
For something I run very often for adding, updating single and batch plugins for both I echo #481439 (comment) in that it doesn't feel like a clear "win" to migrate to an out of tree source controlled by a single person. That's been one of my biggest mental hurdles to this when the other, simpler, option of just bringing the changes in tree, from the library that started as "easier to develop out of tree". |
I agree with @khaneliman comments. Starting to rely on an external library maintained by a single person looks like switching to a far less robust solution. |
|
Note: the Eval/compare failure is due to the same issue as #481734 (comment). It will stick around until all merge conflicts are resolved. Once the conflicts are resolved, the job should succeed without further changes. |


This rewrites the Vim plugins updater to use nixpkgs-updaters-library
Command to run:
nix-build -A vimPluginsUpdater && ./result/bin/vim-plugins-updater --helpThe script without diff
Old implementation problems
The
nixpkgs-plugin-updateis used for sharing some updater logic between the Vim plugins updater, Luarocks updater, and Kakoune plugins updater. It was designed as a simple 100-line script: load a CSV table, fetch the last commit and its hash, and write it togenerated.nix. But as time passed, the number of Vim plugins in nixpkgs grew into the thousands. As a result, the script is extremely slow, and the spaghetti mess makes adding any new features practically impossible.Thus, someone improved it, added parallelization, and some other features, probably. As a result, we now have Frankenstein. To avoid the same thing, the library is designed with extensibility in mind and learns from mistakes made in
nixpkgs-plugin-update.Here is a list of some major issues with
nixpkgs-plugin-update. It is impossible to fix them without a complete rewrite.PluginandPluginDesc: the second class contains info that we got from the input file, the first contains already fetched information. You cannot getPluginDescfromPluginand vice versa without making network calls or assuming some values are the same (they may be different because of redirects).nix-prefetch-git,git ls-remote --tags, straight up fetch for .gitmodules, undocumented XML GitHub API, GraphQL GitHub API. Yes, undocumented and probably deprecated XML API.Feature comparison
We get:
--helpcommand and see what I am talking about){tag}-unstable-{date})We lose:
vim-plugins-updater update && nvim-treesitter-updater update. Alternatively, we can just introducewriteShellScriptwith the alias.Referencing the plugin by its name. It was possible because nixpkgs-plugin-update's function for parsing the CLI argument had access to the output file. Right now, I do not want to give the current function that access and want to keep it very simple.Added this in vimPlugins.nixpkgs-updaters-library: 3.0.0 -> 3.1.1 #481733non-generatedand update them usingnix-update. It's either we lose metadata info for non-GitHub plugins or just package them manuallygit commitcommands (committing it from nix devshell sets author to an empty string, so I don't really see the reason to execute it automatically). But what to print when the user updates multiple plugins?Design decisions
The updater script has to implement only a few classes; the rest is handled by the library.
VimEntryInfo: information about a plugin that is read directly from CSV (includes GitHub URL, branch, and alias)VimEntry: already prefetched information (infoattribute links back toEntryInfoinstance of this plugin, hash, commit, etc)VimMiniEntry: minified information that is stored in the result file. If we don't minify anything, the output file is multiple times largerVimImpl: implements some general methods likeget_all_entriesDividing plugin information to
EntryInfoandEntrywas inspired by nixpkgs-plugin-update'sPluginDescandPlugin, the rest just logically followed. The classes are namedEntry*instead ofPlugin*because the library tries to be agnostic to what the user fetches. Entry can be a git repo or even a GNOME plugin.Add a 👍 reaction to pull requests you find important.