sot / chandra_cmd_states

Interface for creation and maintenance of the Chandra commanded states database.
https://sot.github.io/cmd_states
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Discontinue support for chandra_cmd_states #68

Closed taldcroft closed 6 months ago

taldcroft commented 7 months ago

Description

This addresses one action in https://github.com/sot/kadi/issues/230.

Interface impacts

Importing package raises an exception unless SKA_ALLOW_DISCONTINUED_PACKAGES=1.

Testing

Unit tests

No testing required for discontinued package.

Functional tests

Importing package fails without env var

(ska3) ➜  cmd_states git:(master) ✗ ipython
Python 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:27:35) [Clang 14.0.6 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import chandra_cmd_states
/Users/aldcroft/miniconda3/envs/ska3/lib/python3.10/site-packages/Ska/ParseCM/ParseCM.py:8: FutureWarning: ska_parsecm is deprecated, use parse_cm instead
  warnings.warn('ska_parsecm is deprecated, use parse_cm instead', FutureWarning)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[1], line 1
----> 1 import chandra_cmd_states

File ~/git/cmd_states/chandra_cmd_states/__init__.py:23
     21     warnings.warn(message_warn, FutureWarning)
     22 else:
---> 23     raise RuntimeError(message_warn + message_error)
     25 __version__ = ska_helpers.get_version("chandra_cmd_states")
     28 def test(*args, **kwargs):

RuntimeError: 
The chandra_cmd_states package is no longer supported and is replaced
by kadi.commands.states. Please update your code accordingly.

To temporarily continue using this package set the environment variable
SKA_ALLOW_DISCONTINUED_PACKAGES=1

In [2]: import chandra_cmd_states
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[2], line 1
----> 1 import chandra_cmd_states

File ~/git/cmd_states/chandra_cmd_states/__init__.py:23
     21     warnings.warn(message_warn, FutureWarning)
     22 else:
---> 23     raise RuntimeError(message_warn + message_error)
     25 __version__ = ska_helpers.get_version("chandra_cmd_states")
     28 def test(*args, **kwargs):

RuntimeError: 
The chandra_cmd_states package is no longer supported and is replaced
by kadi.commands.states. Please update your code accordingly.

To temporarily continue using this package set the environment variable
SKA_ALLOW_DISCONTINUED_PACKAGES=1

Setting env var allows import with a FutureWarning

In [3]: import os

In [4]: os.environ["SKA_ALLOW_DISCONTINUED_PACKAGES"] = "1"

In [5]: import chandra_cmd_states
/Users/aldcroft/git/cmd_states/chandra_cmd_states/__init__.py:21: FutureWarning: 
The chandra_cmd_states package is no longer supported and is replaced
by kadi.commands.states. Please update your code accordingly.

  warnings.warn(message_warn, FutureWarning)

In [6]: import chandra_cmd_states

In [7]:                                                                                                                                                      
jeanconn commented 6 months ago

Oops, I approved the wrong one. But I'll re-approve this one soon.

jeanconn commented 6 months ago

For this one, looking over code that might still use Chandra.cmd_states - what is the status of pyger and spaceweather repos?

taldcroft commented 6 months ago

Both pyger and spaceweather are not used in any production workflows and can be fixed as needed. I think pyger is no longer maintained or used. Spaceweather is my repo and I'll swap in kadi states as needed.