From f943273f242c1c1c2ab1bef426d29f91b792cec8 Mon Sep 17 00:00:00 2001
From: Jonathan Foster <jonathan.bruce.foster@gmail.com>
Date: Wed, 29 Nov 2023 10:50:00 -0500
Subject: [PATCH] Add all viewers to the registry

---
 glue_jupyter/bqplot/histogram/__init__.py  |  4 ++++
 glue_jupyter/bqplot/image/__init__.py      |  4 ++++
 glue_jupyter/bqplot/profile/__init__.py    |  4 ++++
 glue_jupyter/bqplot/scatter/__init__.py    |  4 ++++
 glue_jupyter/ipyvolume/__init__.py         |  4 ++++
 glue_jupyter/ipyvolume/scatter/__init__.py |  4 ++++
 glue_jupyter/ipyvolume/scatter/viewer.py   |  3 +++
 glue_jupyter/table/__init__.py             |  4 ++++
 setup.cfg                                  | 10 ++++++++++
 9 files changed, 41 insertions(+)

diff --git a/glue_jupyter/bqplot/histogram/__init__.py b/glue_jupyter/bqplot/histogram/__init__.py
index f2efc8a1..e7fe8837 100644
--- a/glue_jupyter/bqplot/histogram/__init__.py
+++ b/glue_jupyter/bqplot/histogram/__init__.py
@@ -1,2 +1,6 @@
 from .layer_artist import *  # noqa
 from .viewer import *  # noqa
+
+
+def setup():
+    from viewer import BqplotHistogramView # noqa
diff --git a/glue_jupyter/bqplot/image/__init__.py b/glue_jupyter/bqplot/image/__init__.py
index f2efc8a1..6b08bddc 100644
--- a/glue_jupyter/bqplot/image/__init__.py
+++ b/glue_jupyter/bqplot/image/__init__.py
@@ -1,2 +1,6 @@
 from .layer_artist import *  # noqa
 from .viewer import *  # noqa
+
+
+def setup():
+    from viewer import BqplotImageView # noqa
diff --git a/glue_jupyter/bqplot/profile/__init__.py b/glue_jupyter/bqplot/profile/__init__.py
index f2efc8a1..ee6eb472 100644
--- a/glue_jupyter/bqplot/profile/__init__.py
+++ b/glue_jupyter/bqplot/profile/__init__.py
@@ -1,2 +1,6 @@
 from .layer_artist import *  # noqa
 from .viewer import *  # noqa
+
+
+def setup():
+    from viewer import BqplotProfileView # noqa
diff --git a/glue_jupyter/bqplot/scatter/__init__.py b/glue_jupyter/bqplot/scatter/__init__.py
index f2efc8a1..fb952e01 100644
--- a/glue_jupyter/bqplot/scatter/__init__.py
+++ b/glue_jupyter/bqplot/scatter/__init__.py
@@ -1,2 +1,6 @@
 from .layer_artist import *  # noqa
 from .viewer import *  # noqa
+
+
+def setup():
+    from viewer import BqplotScatterView # noqa
diff --git a/glue_jupyter/ipyvolume/__init__.py b/glue_jupyter/ipyvolume/__init__.py
index db578fb0..7a711d06 100644
--- a/glue_jupyter/ipyvolume/__init__.py
+++ b/glue_jupyter/ipyvolume/__init__.py
@@ -1,2 +1,6 @@
 from .volume.viewer import IpyvolumeVolumeView  # noqa
 from .scatter.viewer import IpyvolumeScatterView  # noqa
+
+
+def setup():
+    from viewer import IpyvolumeVolumeView  # noqa
diff --git a/glue_jupyter/ipyvolume/scatter/__init__.py b/glue_jupyter/ipyvolume/scatter/__init__.py
index 39dd5964..11304dab 100644
--- a/glue_jupyter/ipyvolume/scatter/__init__.py
+++ b/glue_jupyter/ipyvolume/scatter/__init__.py
@@ -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
diff --git a/glue_jupyter/ipyvolume/scatter/viewer.py b/glue_jupyter/ipyvolume/scatter/viewer.py
index e82f3e72..81a61563 100644
--- a/glue_jupyter/ipyvolume/scatter/viewer.py
+++ b/glue_jupyter/ipyvolume/scatter/viewer.py
@@ -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
@@ -7,6 +9,7 @@
 __all__ = ['IpyvolumeScatterView']
 
 
+@viewer_registry("scatter3d")
 class IpyvolumeScatterView(IpyvolumeBaseView):
 
     allow_duplicate_data = False
diff --git a/glue_jupyter/table/__init__.py b/glue_jupyter/table/__init__.py
index 53136ac4..7e675fc0 100644
--- a/glue_jupyter/table/__init__.py
+++ b/glue_jupyter/table/__init__.py
@@ -1 +1,5 @@
 from .viewer import TableViewer  # noqa
+
+
+def setup():
+    from viewer import TableViewer  # noqa
diff --git a/setup.cfg b/setup.cfg
index 321657b1..0e3a7a72 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -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
+    table = glue_jupyter.table:setup
+    scatter3d = glue_jupyter.ipyvolume.scatter:setup
+    volume = glue_jupyter.ipyvolume.volume:setup
+
 [options.extras_require]
 test =
     pytest