Repository: scikit-image/scikit-image

Issue:
Consider deprecating `viewer` and `skivi`
It looks like [Napari](https://github.com/napari/napari) is shaping up nicely, so it may be time to consider deprecating our image viewer, and potentially our viewer widgets.

It looks like there are tens of thousands of imports of the viewer module, though, so it would be good to provide some kind of backward compatibility route, if at all possible.

https://github.com/search?p=3&q=from+skimage+import+viewer&type=Code
https://github.com/search?q=import+skimage.viewer&type=Code


Discussion:
Given the high usage, I would say that we should deprecate it only once we can replicate the functionality in that module in napari, and then point users to a specific doc page in napari for migrating. That's probably about a week's work, but it's unlikely to happen before october at the earliest. See https://github.com/napari/napari/issues/301
What about moving `skimage.viewer` to `scikit-image-contrib`?
@rfezzani I think we should move it to `scikit-image/skimage-viewer`.
Could we consider using [namspace packaging](https://packaging.python.org/guides/packaging-namespace-packages/) for this purpose?
I would like to revive this discussion. 1 year later, it seems that napari is more mature. @rfezzani Do you still advocate for keeping/maintaning this code somewhere?
Thank you @sciunto for reviving this! I am still in strong favor of removing as much package dependencies as possible:
Deprecating `skivi` and the `skimage.io` submodule allows to remove the dependency to `imageio`, `pillow`, `tifffile` and `matplotlib`!
Good! I think we have other places where we depend on matplotlib, but I agree for the other lib. We might raise the question to maintain an API around imageio or not, but this out of the scope of this issue.

Resolving patch:
diff --git a/skimage/scripts/skivi.py b/skimage/scripts/skivi.py
--- a/skimage/scripts/skivi.py
+++ b/skimage/scripts/skivi.py
@@ -4,6 +4,12 @@
 def main():
     import skimage.io as io
     import sys
+    from warnings import warn
+
+    warn('`skivi.py` script is deprecated and will be removed in 0.20. '
+         'For alternatives, refer to '
+         'https://scikit-image.org/docs/stable/user_guide/visualization.html',
+         FutureWarning, stacklevel=2)
 
     if len(sys.argv) != 2:
         print("Usage: skivi <image-file>")
diff --git a/skimage/viewer/viewers/core.py b/skimage/viewer/viewers/core.py
--- a/skimage/viewer/viewers/core.py
+++ b/skimage/viewer/viewers/core.py
@@ -13,6 +13,7 @@
 from ..utils.canvas import BlitManager, EventManager
 from ..plugins.base import Plugin
 
+from warnings import warn
 
 __all__ = ['ImageViewer', 'CollectionViewer']
 
@@ -89,6 +90,12 @@ class ImageViewer(QtWidgets.QMainWindow):
     original_image_changed = Signal(np.ndarray)
 
     def __init__(self, image, useblit=True):
+
+        warn('`viewer` is deprecated and will be removed in 0.20. '
+             'For alternatives, refer to '
+             'https://scikit-image.org/docs/stable/user_guide/visualization.html',
+             FutureWarning, stacklevel=2)
+
         # Start main loop
         init_qtapp()
         super(ImageViewer, self).__init__()
@@ -347,6 +354,11 @@ class CollectionViewer(ImageViewer):
     """
 
     def __init__(self, image_collection, update_on='move', **kwargs):
+        warn('`CollectionViewer` is deprecated and will be removed in 0.20. '
+             'For alternatives, refer to '
+             'https://scikit-image.org/docs/stable/user_guide/visualization.html',
+             FutureWarning, stacklevel=2)
+
         self.image_collection = image_collection
         self.index = 0
         self.num_images = len(self.image_collection)


Test patch: