Plugin parameters
See original GitHub issueš Feature
As raised in zulip and elswhere, we need a mechanism to pass arbitrary parameters to plugins (beyond those declared in the hook specification). Currently, napari_plugin_engine
(like pluggy
) does not allow calling hooks with arbitrary kwargs (itās not an error, but they are not passed on) ⦠but we can probably come up with an acceptable way to open that up. The main things to decide are
-
what sort of API do we want to support on the napari side? Currently, calling
viewer.open(**kwargs)
passes all additional**kwargs
to the respectiveadd_*
method. So weād need to either add aplugin_kwargs={}
argument (probably better), or do some clever separation of of kwargs (probably worse). I also think it would be reasonable to only acceptplugin_kwargs
when also providing a specificplugin
. -
havenāt thought about the hook calling side as much, but the lines where kwargs not specified in the hook specification are stripped are right here⦠so thatās a place to start.
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (15 by maintainers)
I guess itās the ācriticalā part thatās a bit open to interpretation š ⦠The gui is of course super important, and I definitely agree that we should be cognizant of how any particular new design might ultimately play with the GUI (and i wouldnāt want to shoot ourselves in the foot with a built-in incompatibility) ⦠I just didnāt see gui-only use as the primary goal.
I just want to correct the history a little bit here⦠At least from my perspective, napari was first and foremost a viewer for the scientific Python ecosystem. Making that ecosystem accessible to non-coders ā that came at least a tick later. And I want to emphasise that although it is now a primary goal of napari, I donāt want it to come at the cost of napari becoming bloated or inflexible as a Python library.
Edit: Upon further reflection I think I spoke too quickly re the history. (It was a pedantic correction and an incorrect pedantic correction is just terrible, so I feel compelled to, ahem, correct it. š) Probably Loic and I did discuss that our then-hypothetical-and-unnamed Python viewer could be used as a front-end for skimage and beyond ā not having one has been a source of frustration for me because I canāt get biologists to use my stuff without first going through weeks of Python training! Also, @tlambert03 you might recall that when I first asked you to join napari it was because you wrote to me asking whether it was a good idea to make a GUI to make Python processing accessible for non-Python users, and I said it was such a good idea we were already working on it! š
I guess my response above came from the fact that de facto, napari has become insanely useful and popular as a scientific Python viewer, and we should work hard to preserve that utility and popularity even as we expand its use to the non-programmer, GUI-only side.
/edit
In particular in this discussion, I lean slightly in favour of being more permissive than restrictive initially. We are in alpha and I think the current batch of people building on napari would be happier to have us provide more facilities sooner and let them experiment, even if at first it means a bit more pedalling to keep up with our API, rather than to wait for us to design āthe perfect systemā and then realise it canāt quite do what they want anyway.