-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add entry points for viewer registry #411
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, i was missing this in glue-solara!
def setup(): | ||
from viewer import BqplotHistogramView # noqa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed, since * is already imported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think I got confused because I forgot that you have to manually rerun pip install to rebuild the entry points when I was developing this. And yes, this means we can simplify glue-solara to just build a list of viewers from the registry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to define entry points but some comments below on implementation.
|
||
|
||
def setup(): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the setup
function should actually be adding the viewer to the registry (rather than using the decorator) - @CyclingNinja is working on improvements to load_plugins
that means that users will be able to opt-in to specific plugins, so we need the viewer to not be added if the entry point is not called.
histogram = glue_jupyter.bqplot.histogram:setup | ||
image = glue_jupyter.bqplot.image:setup | ||
profile = glue_jupyter.bqplot.profile:setup | ||
scatter = glue_jupyter.bqplot.scatter:setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These plugin names might conflict with the ones from glue-core - the entry point names should be unique across the glue ecosystem.
@@ -7,6 +9,7 @@ | |||
__all__ = ['IpyvolumeScatterView'] | |||
|
|||
|
|||
@viewer_registry("scatter3d") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The registration of the viewer should be done in setup
as mentioned above.
Populate viewer registry for all viewers
Description
This uses entry points to register all the viewers for glue-jupyter into viewer_registry. This addresses #388 and makes all viewers accessible through the
new_data_viewer()
command in glue-jupyter. I think this should be compatible with #402, because the viewer registry won't double-populate the same viewers. I have addedIpyvolumeScatterView
asscatter3d
.Adding an entry point for glue-wwt will be a separate PR in that repository.
Not 100% about the names here. 'image' is a convenient name for calling in code, but is less descriptive than something like '2d image'. This is particularly relevant for 'scatter' (unqualified) versus 'scatter3d'.