-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Update the deprecation decorator towards SemVer #11296
base: main
Are you sure you want to change the base?
Conversation
One or more of the the following people are requested to review this:
|
qiskit/utils/deprecation.py
Outdated
@@ -27,7 +27,7 @@ def deprecate_func( | |||
additional_msg: str | None = None, | |||
pending: bool = False, | |||
package_name: str = "qiskit", | |||
removal_timeline: str = "no earlier than 3 months after the release date", | |||
removal_timeline: str = "in the next major release", |
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.
This works fine, but we should have sufficient info to compute the next major version from the since
field. We could set this to None
and then do something like:
if removal_timeline is None:
removal_major = int(since.split(",")[0]) + 1
removal_timeline = f"in the next major release {removal_major}"
Or if you're worried about deprecated features passing a major version boundary (e.g. we deprecate something in 1.0 and don't remove it until 3.0) we can replace since with the package's __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.
good one! Done in cd47576
However, replacing since
with __version__
might be tricky. If a features was deprecated in 1.1.0
, we want to keep that since
after the release of 1.2.0
. Or am I missing something?
--------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Pull Request Test Coverage Report for Build 7716377393Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
@Mergifyio backport stable/0.46 |
🟠 Waiting for conditions to match
|
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.
As weird as this is to ask for on a deprecation decorator, I think this needs a release note as this is a public documented function and we're adding a new option and changing the default behavior. It will need a feature release note and an upgrade note as existing users who don't set removal_timeline
will get different messages after upgrading qiskit.
Given that rc1 is supposed to go out today, I'm going to defer this to 1.1. We'll have to rework this PR to not be a breaking api change for 1.1, but I think that's manageable. |
The current
deprecate
decorators extend the docstring with the following:I suggest the following to be aligned with Qiskit/documentation#366