-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add qpy deprecation warning class #11260
Conversation
Pull Request Test Coverage Report for Build 7274445496
💛 - Coveralls |
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.
Don't forget to add a documentation line for the new warning in the QPY API docs (you can use autoexception
, because Python makes tons of sense).
Do you plan on having this limited to |
One or more of the the following people are requested to review this:
|
What other types of warnings are you thinking about @TsafrirA? This seemed to be an issue particularly for |
I am planning to replace the deprecation warning with a user warning once the process of #11257 is completed. That shouldn't be a problem? |
You can replace |
I didn't explain myself well. Once we remove the support which is deprecated in #11257, pulses loaded from old QPY files will be altered. I was planning of issuing a user warning at that point to alert the user to the change. Do we then need a similar mechanism for a user warning? |
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 looks sensible to me (except for why Python calls warnings exceptions), thanks!
Summary
This PR proposes a new
QPYLoadingDeprecatedFeatureWarning
class inspired in numpy's VisibleDeprecationWarning with the purpose of ensuring that deprecation messages reach the user even if they are raised from variable points in the call stack. The intended use case are qpy loading functions that can be called recursively (hence the name).Details and comments
The original issue was found during the review of #11257
Note: I have tested that the warning is visible using the example from #11257. I dumped a schedule with a complex amplitude using
qpy v.5
(qiskit-terra 0.21
) and tried loading it with the latest qpy version. The warning wouldn't surface with the usualDeprecationWarning
class but it did withQPYLoadingDeprecatedFeatureWarning
: