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

Add entry points for viewer registry #411

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions glue_jupyter/bqplot/histogram/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from .layer_artist import * # noqa
from .viewer import * # noqa


def setup():
from viewer import BqplotHistogramView # noqa
Copy link
Collaborator

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

Copy link
Member Author

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.

4 changes: 4 additions & 0 deletions glue_jupyter/bqplot/image/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from .layer_artist import * # noqa
from .viewer import * # noqa


def setup():
from viewer import BqplotImageView # noqa
4 changes: 4 additions & 0 deletions glue_jupyter/bqplot/profile/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from .layer_artist import * # noqa
from .viewer import * # noqa


def setup():
from viewer import BqplotProfileView # noqa
4 changes: 4 additions & 0 deletions glue_jupyter/bqplot/scatter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from .layer_artist import * # noqa
from .viewer import * # noqa


def setup():
from viewer import BqplotScatterView # noqa
4 changes: 4 additions & 0 deletions glue_jupyter/ipyvolume/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from .volume.viewer import IpyvolumeVolumeView # noqa
from .scatter.viewer import IpyvolumeScatterView # noqa


def setup():
from viewer import IpyvolumeVolumeView # noqa
4 changes: 4 additions & 0 deletions glue_jupyter/ipyvolume/scatter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from .layer_artist import * # noqa
from .layer_style_widget import * # noqa
from .viewer import * # noqa


def setup():
from viewer import IpyvolumeScatterView # noqa
3 changes: 3 additions & 0 deletions glue_jupyter/ipyvolume/scatter/viewer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from glue_jupyter.common.state3d import Scatter3DViewerState
from glue_jupyter.registries import viewer_registry

from .layer_artist import IpyvolumeScatterLayerArtist
from .layer_style_widget import Scatter3DLayerStateWidget
from ..common.viewer_options_widget import Viewer3DStateWidget
Expand All @@ -7,6 +9,7 @@
__all__ = ['IpyvolumeScatterView']


@viewer_registry("scatter3d")
Copy link
Member

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.

class IpyvolumeScatterView(IpyvolumeBaseView):

allow_duplicate_data = False
Expand Down
4 changes: 4 additions & 0 deletions glue_jupyter/table/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from .viewer import TableViewer # noqa


def setup():
from viewer import TableViewer # noqa
10 changes: 10 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ install_requires =
bqplot-gl
scikit-image

[options.entry_points]
glue.plugins =
histogram = glue_jupyter.bqplot.histogram:setup
image = glue_jupyter.bqplot.image:setup
profile = glue_jupyter.bqplot.profile:setup
scatter = glue_jupyter.bqplot.scatter:setup
Copy link
Member

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.

table = glue_jupyter.table:setup
scatter3d = glue_jupyter.ipyvolume.scatter:setup
volume = glue_jupyter.ipyvolume.volume:setup

[options.extras_require]
test =
pytest
Expand Down
Loading