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 all commits
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():
pass
Copy link
Member

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.

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():
pass
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():
pass
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():
pass
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():
pass
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():
pass
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():
pass
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