From da8bc8dd7411cc39d9aafed323bf725c73c68458 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Wed, 11 Sep 2024 14:27:03 -0400 Subject: [PATCH 1/3] Deprecate ginga_plugins. --- CHANGES.rst | 5 +++++ sbpy/ginga_plugins/CometaryEnhancements.py | 10 ++++++++++ sbpy/ginga_plugins/__init__.py | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0742c6345..b6135b0bc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,11 @@ sbpy.names to be implemented by the MPC in anticipation of higher asteroid discovery rates in the LSST survey era [#406] +API Changes +----------- +- Deprecated `sbpy.ginga_plugins` in favor of using `sbpy-ginga` at + https://github.com/NASA-Planetary-Science/sbpy-ginga + 0.5.0 (2024-08-28) ================== diff --git a/sbpy/ginga_plugins/CometaryEnhancements.py b/sbpy/ginga_plugins/CometaryEnhancements.py index 85e8f92aa..8b33c6ac1 100644 --- a/sbpy/ginga_plugins/CometaryEnhancements.py +++ b/sbpy/ginga_plugins/CometaryEnhancements.py @@ -8,6 +8,7 @@ from warnings import warn from sbpy.exceptions import OptionalPackageUnavailable +from astropy.utils.decorators import deprecated try: from ginga.GingaPlugin import LocalPlugin @@ -30,6 +31,7 @@ class LocalPlugin: from sbpy.imageanalysis import CometaryEnhancement +@deprecated("0.6", alternative="sbpy_ginga.cometary_enhancements.CometaryEnhancements") class CometaryEnhancements(LocalPlugin): """Ginga plugin for on-the-fly cometary image enhancements.""" @@ -130,6 +132,14 @@ def build_gui(self, container): vbox.add_widget(tabw) + # Add a deprecation warning + hbox = Widgets.HBox() + text_area = Widgets.TextArea() + text_area.append_text("This tool is from the deprecated sbpy.ginga_plugins module. " + "Use the sbpy-ginga module instead.") + hbox.add_widget(text_area) + vbox.add_widget(hbox) + # scroll bars will allow lots of content to be accessed top.add_widget(sw, stretch=1) diff --git a/sbpy/ginga_plugins/__init__.py b/sbpy/ginga_plugins/__init__.py index dbfa20f96..010123a17 100644 --- a/sbpy/ginga_plugins/__init__.py +++ b/sbpy/ginga_plugins/__init__.py @@ -2,7 +2,7 @@ import os from warnings import warn -from astropy.utils.exceptions import AstropyWarning +from astropy.utils.exceptions import AstropyWarning, AstropyDeprecationWarning try: from ginga.misc.Bunch import Bunch @@ -13,6 +13,12 @@ Bunch = None +warn( + "sbpy.ginga_plugins is deprecated. Use the `sbpy_ginga` module instead.", + AstropyDeprecationWarning, + stacklevel=2, +) + # path to these plugins p_path = os.path.split(__file__)[0] From d0bc4368e12c3ad4f491e01d99edb0eb9049bce1 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Wed, 11 Sep 2024 14:32:06 -0400 Subject: [PATCH 2/3] Add PR number. --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index b6135b0bc..c63d00740 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,7 +14,7 @@ sbpy.names API Changes ----------- - Deprecated `sbpy.ginga_plugins` in favor of using `sbpy-ginga` at - https://github.com/NASA-Planetary-Science/sbpy-ginga + https://github.com/NASA-Planetary-Science/sbpy-ginga [#413] 0.5.0 (2024-08-28) From 7434e75aa98ad6e004694eb2c53c1699179489a4 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Wed, 11 Sep 2024 14:33:38 -0400 Subject: [PATCH 3/3] Re-wrap text --- sbpy/ginga_plugins/CometaryEnhancements.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbpy/ginga_plugins/CometaryEnhancements.py b/sbpy/ginga_plugins/CometaryEnhancements.py index 8b33c6ac1..8d85122fe 100644 --- a/sbpy/ginga_plugins/CometaryEnhancements.py +++ b/sbpy/ginga_plugins/CometaryEnhancements.py @@ -135,8 +135,8 @@ def build_gui(self, container): # Add a deprecation warning hbox = Widgets.HBox() text_area = Widgets.TextArea() - text_area.append_text("This tool is from the deprecated sbpy.ginga_plugins module. " - "Use the sbpy-ginga module instead.") + text_area.append_text("This tool is from the deprecated sbpy.ginga_plugins " + "module. Use the sbpy-ginga module instead.") hbox.add_widget(text_area) vbox.add_widget(hbox)