From 58a378bc8a2b0a12fe9b2b436e42d570eb1fa2fd Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Thu, 23 May 2024 10:59:47 -0600 Subject: [PATCH 1/6] Depcreate ana functions --- sunpy/io/ana.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sunpy/io/ana.py b/sunpy/io/ana.py index f467162105..6ed1b9b88a 100644 --- a/sunpy/io/ana.py +++ b/sunpy/io/ana.py @@ -13,6 +13,7 @@ import os from sunpy.io._header import FileHeader +from sunpy.util.decorators import deprecated from sunpy.util.io import HDPair try: @@ -24,11 +25,10 @@ "C extension for ANA is missing. For more details see: " "https://docs.sunpy.org/en/stable/installation.html#installing-without-conda" ) - - __all__ = ['read', 'get_header', 'write'] +@deprecated("6.0", message="The ANA reader is un-maintained and will be removed in the future.") def read(filename, debug=False, **kwargs): """ Loads an ANA file and returns the data and a header in a list of (data, @@ -62,6 +62,7 @@ def read(filename, debug=False, **kwargs): return [HDPair(data['data'], FileHeader(data['header']))] +@deprecated("6.0", message="The ANA reader is un-maintained and will be removed in the future.") def get_header(filename, debug=False): """ Loads an ANA file and only return the header consisting of the dimensions, @@ -91,6 +92,7 @@ def get_header(filename, debug=False): return [FileHeader(data['header'])] +@deprecated("6.0", message="The ANA writer is un-maintained and will be removed in the future.") def write(filename, data, comments=False, compress=True, debug=False): """ Saves a 2D `numpy.array` as an ANA file and returns the bytes written or From f9293fa737153ff4e61830370e52a6d7353d702c Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Thu, 23 May 2024 11:18:46 -0600 Subject: [PATCH 2/6] Handle ana tests --- sunpy/io/tests/test_ana.py | 2 ++ sunpy/io/tests/test_filetools.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/sunpy/io/tests/test_ana.py b/sunpy/io/tests/test_ana.py index 24929404cf..3de822db74 100644 --- a/sunpy/io/tests/test_ana.py +++ b/sunpy/io/tests/test_ana.py @@ -7,6 +7,8 @@ from sunpy.io import ana from sunpy.tests.helpers import skip_ana +pytestmark = pytest.mark.filterwarnings("ignore::sunpy.util.exceptions.SunpyDeprecationWarning") + img_size = (456, 345) img_src = np.arange(np.prod(img_size)) img_src.shape = img_size diff --git a/sunpy/io/tests/test_filetools.py b/sunpy/io/tests/test_filetools.py index 702dfb59cf..95b4f0c570 100644 --- a/sunpy/io/tests/test_filetools.py +++ b/sunpy/io/tests/test_filetools.py @@ -90,6 +90,7 @@ def test_read_file_header_fits(): @skip_ana +@pytest.mark.filterwarnings("ignore::sunpy.util.exceptions.SunpyDeprecationWarning") def test_read_file_ana(): # Aim is to verify that we can read a ANA file hdulist = read_file(get_test_filepath("test_ana.fz")) @@ -101,6 +102,7 @@ def test_read_file_ana(): @skip_ana +@pytest.mark.filterwarnings("ignore::sunpy.util.exceptions.SunpyDeprecationWarning") def test_read_file_header_ana(): # Aim is to verify that we can read a header from a ANA file hdulist = read_file_header(get_test_filepath("test_ana.fz")) @@ -110,6 +112,7 @@ def test_read_file_header_ana(): @skip_ana +@pytest.mark.filterwarnings("ignore::sunpy.util.exceptions.SunpyDeprecationWarning") def test_write_file_ana(tmpdir): # Aim is to verify that we can write a ANA file and read back correctly ana_header, ana_data = read_file(get_test_filepath("test_ana.fz"))[0][::-1] From c89cd48eb106219d37eae1400106a3d7615937e8 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Thu, 23 May 2024 11:22:03 -0600 Subject: [PATCH 3/6] changelog --- changelog/7642.breaking.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog/7642.breaking.rst diff --git a/changelog/7642.breaking.rst b/changelog/7642.breaking.rst new file mode 100644 index 0000000000..08ae4fa2a6 --- /dev/null +++ b/changelog/7642.breaking.rst @@ -0,0 +1,2 @@ +The ANA C code within sunpy has been unmaintained for a long time, and is not compatible with modern versions of numpy or GCC. +It has been now been deprecated and will be removed in sunpy 6.1.0. From 013a19827a2f01b9cd20db1c16a60ce3b4f46766 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Sat, 25 May 2024 20:32:47 -0700 Subject: [PATCH 4/6] Update changelog/7642.breaking.rst Co-authored-by: Will Barnes --- changelog/7642.breaking.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/changelog/7642.breaking.rst b/changelog/7642.breaking.rst index 08ae4fa2a6..7e8950c90e 100644 --- a/changelog/7642.breaking.rst +++ b/changelog/7642.breaking.rst @@ -1,2 +1 @@ -The ANA C code within sunpy has been unmaintained for a long time, and is not compatible with modern versions of numpy or GCC. -It has been now been deprecated and will be removed in sunpy 6.1.0. +The ANA C code now been deprecated and will be removed in sunpy 6.1.0. From 8ef4c48789dc1d9d905ea9c60e884e93738a516d Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Sat, 25 May 2024 20:35:02 -0700 Subject: [PATCH 5/6] link to functions --- changelog/7642.breaking.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/7642.breaking.rst b/changelog/7642.breaking.rst index 7e8950c90e..e352ebde3d 100644 --- a/changelog/7642.breaking.rst +++ b/changelog/7642.breaking.rst @@ -1 +1 @@ -The ANA C code now been deprecated and will be removed in sunpy 6.1.0. +The ANA C code now been deprecated (`sunpy.io.ana.read`, `sunpy.io.ana.get_header`, `sunpy.io.ana.write`) and will be removed in sunpy 6.1.0. From b2128d3a24075bca4489ca2540f2313f4dbcec1d Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Sun, 26 May 2024 09:44:20 -0700 Subject: [PATCH 6/6] Update message --- sunpy/io/ana.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sunpy/io/ana.py b/sunpy/io/ana.py index 6ed1b9b88a..e666ff40df 100644 --- a/sunpy/io/ana.py +++ b/sunpy/io/ana.py @@ -28,7 +28,7 @@ __all__ = ['read', 'get_header', 'write'] -@deprecated("6.0", message="The ANA reader is un-maintained and will be removed in the future.") +@deprecated(since="6.0", message="The ANA reader is un-maintained and will be removed in the future. Please contact sunpy if you are using this.", alternative="https://github.com/ITA-Solar/helita has a ANA reader and writer.") def read(filename, debug=False, **kwargs): """ Loads an ANA file and returns the data and a header in a list of (data, @@ -62,7 +62,7 @@ def read(filename, debug=False, **kwargs): return [HDPair(data['data'], FileHeader(data['header']))] -@deprecated("6.0", message="The ANA reader is un-maintained and will be removed in the future.") +@deprecated(since="6.0", message="The ANA reader is un-maintained and will be removed in the future. Please contact sunpy if you are using this.", alternative="https://github.com/ITA-Solar/helita has a ANA reader and writer.") def get_header(filename, debug=False): """ Loads an ANA file and only return the header consisting of the dimensions, @@ -92,7 +92,7 @@ def get_header(filename, debug=False): return [FileHeader(data['header'])] -@deprecated("6.0", message="The ANA writer is un-maintained and will be removed in the future.") +@deprecated(since="6.0", message="The ANA reader is un-maintained and will be removed in the future. Please contact sunpy if you are using this.", alternative="https://github.com/ITA-Solar/helita has a ANA reader and writer.") def write(filename, data, comments=False, compress=True, debug=False): """ Saves a 2D `numpy.array` as an ANA file and returns the bytes written or