-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow plugins to report their own version and store it in the registry #12883
Conversation
``` > plugin list | select name version is_running pid ╭───┬────────────────┬─────────┬────────────┬─────╮ │ # │ name │ version │ is_running │ pid │ ├───┼────────────────┼─────────┼────────────┼─────┤ │ 0 │ example │ 0.93.1 │ false │ │ │ 1 │ gstat │ 0.93.1 │ false │ │ │ 2 │ inc │ 0.93.1 │ false │ │ │ 3 │ python_example │ 0.1.0 │ false │ │ ╰───┴────────────────┴─────────┴────────────┴─────╯ ```
I think it's a great idea to have plugin metadata for version and other potential stuff but I'm on the fence about making it optional. If someone wants to rely on it and it's optional, it makes it not as helpful because people can opt-out. |
I can design the rust API to make it required then, e.g. with a |
I could be wrong, but I think that sounds better. |
I think this does that, then. The |
@fdncred I'm up for giving this a try for this release if you don't mind. It's nothing big and scary but does create a small breaking change for plugin developers. |
ok, here's to breaking everyone's plugins again. 🍺 |
After changing a bunch of plugins, shouldn't this just default to fn version(&self) -> String {
env!("CARGO_PKG_VERSION").into()
} and not be a breaking change. If people want a different version, they could override it. |
I wish we could, but the |
boo! |
Description
This allows plugins to report their version (and potentially other metadata in the future). The version is shown in
plugin list
and inversion
.The metadata is stored in the registry file, and reflects whatever was retrieved on
plugin add
, not necessarily the running binary. This can help you to diagnose if there's some kind of mismatch with what you expect. We could potentially use this functionality to show a warning or error if a plugin being run does not have the same version as what was in the cache file, suggestingplugin add
be run again, but I haven't done that at this point.It is optional, and it requires the plugin author to make some code changes if they want to provide it, since I can't automatically determine the version of the calling crate or anything tricky like that to do it.
Example:
cc @maxim-uvarov (he asked for it)
User-Facing Changes
plugin list
gets aversion
columnversion
shows plugin versions when availablefn version()
to theirimpl Plugin
Tests + Formatting
Tested the low level stuff and also the
plugin list
column.After Submitting
Metadata
call & response)fn version()
should be easy)