Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Discontinue support for chandra_cmd_states #68

Merged
merged 1 commit into from
Dec 6, 2023
Merged

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Dec 5, 2023

Description

This addresses one action in sot/kadi#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]:                                                                                                                                                      

Copy link
Contributor

@javierggt javierggt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs workflow will fail, so we will need to make it and commit it by hand.

message_error = (
"\n"
"To temporarily continue using this package set the environment variable\n"
"SKA_ALLOW_DISCONTINUED_PACKAGES=1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Picking nits, I think that's SKA_ALLOW_DISCONTINUED_PACKAGES='1'. but I'm good!

@jeanconn
Copy link
Contributor

jeanconn commented Dec 6, 2023

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

@jeanconn
Copy link
Contributor

jeanconn commented Dec 6, 2023

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

Copy link
Contributor

@jeanconn jeanconn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporarily changing back my review status

@taldcroft
Copy link
Member Author

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.

@taldcroft taldcroft merged commit efd4c94 into master Dec 6, 2023
@taldcroft taldcroft deleted the discontinue-package branch December 6, 2023 21:02
@javierggt javierggt mentioned this pull request Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants