Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display note for deprecated irdb modes #251

Merged
merged 1 commit into from
Jul 14, 2023
Merged

Conversation

oczoske
Copy link
Collaborator

@oczoske oczoske commented Jul 14, 2023

UserCommands.set_modes() displays a deprecation note if the parameter deprecate is set in the irdb mode definition.
UserCommands.list_modes() adds "(deprecated)" to the description of such modes.

@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.01 ⚠️

Comparison is base (a0e08a8) 80.86% compared to head (e9a61dd) 80.85%.

Additional details and impacted files
@@              Coverage Diff               @@
##           dev_master     #251      +/-   ##
==============================================
- Coverage       80.86%   80.85%   -0.01%     
==============================================
  Files             143      143              
  Lines           14658    14662       +4     
==============================================
+ Hits            11853    11855       +2     
- Misses           2805     2807       +2     
Impacted Files Coverage Δ
scopesim/commands/user_commands.py 87.50% <50.00%> (-1.02%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@teutoburg teutoburg left a comment

Choose a reason for hiding this comment

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

The few tests that still fail now are AFAIK all related to GitHub API timeouts. Can be ignored.

Copy link
Collaborator

@hugobuddel hugobuddel left a comment

Choose a reason for hiding this comment

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

Good! I'll go ahead and merge.

Some ideas to formalize this further, but we can do that later, if necessary:

Actively use DeprecationWarning, because that is, I think, the Pythonic way to remind users of deprecation.

warnings.warn(f"Mode {mode} is deprecated.", category=DeprecationWarning)

For the users we could add two pieces of information:

  • How to move away from the deprecation, e.g. "You probably want to use mode XYZ instead".
  • A plan for when the deprecated mode will be removed. But we probably won't know that, because of our uncertain plans for the wheels.

@hugobuddel hugobuddel merged commit f03211c into dev_master Jul 14, 2023
16 of 19 checks passed
@oczoske
Copy link
Collaborator Author

oczoske commented Jul 14, 2023

Note that this (set_modes, actually) reads a full deprecation message from the irdb (see irdb/MICADO/default.yaml), which ideally explains why the mode is deprecated and what to use instead. The current formulation and formatting is not perfect but hopefully good enough. The category looks like a good extension, though.

@teutoburg teutoburg deleted the oc/deprecated_modes branch February 1, 2024 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants