-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added pending_warning_type and a version to the message for deprecated #16463
base: main
Are you sure you want to change the base?
Conversation
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
astropy/utils/decorators.py
Outdated
@@ -28,6 +28,19 @@ | |||
_NotFound = object() | |||
|
|||
|
|||
def _get_removal_version(since): | |||
# Work out which version this will be removed in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not check if this is valid for astropy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Brigitta that this is orthogonal to the initial PR goal and should be left out for now.
I also wouldn't recommend attempting to predict the future in deprecation warnings; I've been bitten by it in the past where an important release got blocked by some deprecation that we promised to conclude (remove the functionality), but turned out to be more difficult than we anticipated.
👋 Thank you for your draft pull request! Do you know that you can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, pending the message itself is left unchanged and a changelog is added.
My preference would be to have this backported into a bugfix, so it's available for downstream usage sooner.
astropy/utils/decorators.py
Outdated
@@ -203,7 +224,7 @@ def deprecate( | |||
else: | |||
message = ( | |||
"The {func} {obj_type} is deprecated and may " | |||
"be removed in a future version." | |||
"be removed in a future version (minimum version {removal_version})." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not mix this into this PR as this breaks past behaviour when/if anyone matches with the full message. And I would rather see this feature backported, so more versions can use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fair, I will remove this change.
@@ -36,6 +49,7 @@ def deprecated( | |||
pending=False, | |||
obj_type=None, | |||
warning_type=AstropyDeprecationWarning, | |||
pending_warning_type=AstropyPendingDeprecationWarning, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's too late for existing arguments, but I'd suggest making any new argument in public functions keyword-only (not crucial, but helps with deprecation cycles, which this PR is all about 😄)
pending_warning_type=AstropyPendingDeprecationWarning, | |
*, | |
pending_warning_type=AstropyPendingDeprecationWarning, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
astropy/utils/decorators.py
Outdated
@@ -28,6 +28,19 @@ | |||
_NotFound = object() | |||
|
|||
|
|||
def _get_removal_version(since): | |||
# Work out which version this will be removed in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Brigitta that this is orthogonal to the initial PR goal and should be left out for now.
I also wouldn't recommend attempting to predict the future in deprecation warnings; I've been bitten by it in the past where an important release got blocked by some deprecation that we promised to conclude (remove the functionality), but turned out to be more difficult than we anticipated.
astropy/io/fits/hdu/base.py
Outdated
@@ -1625,7 +1625,7 @@ def _verify(self, option="warn"): | |||
return errs | |||
|
|||
|
|||
@deprecated("v6.0") | |||
@deprecated("6.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orthogonal, but doesn't hurt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was changed due to my adding the version in the message which needs to be able to parse these tags.
Since I will remove that change, I will be undoing this change as well.
But this is technically new API and I don't see the lack of this being blocker of anything downstream, so I prefer not to backport. |
New API for a developer tool, so there isn't really much benefit in holding it back and thus delaying the ability to use it |
Fixes #8190
TODO: