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

Change algorithms from pending deprecation to deprecated #9883

Merged

Conversation

Eric-Arellano
Copy link
Collaborator

@Eric-Arellano Eric-Arellano commented Mar 30, 2023

Summary

Supersedes #9532.

Details and comments

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

@Eric-Arellano
Copy link
Collaborator Author

WIP because I want to see what test changes from #9532 are necessary.

Feel free to start reviewing the prod changes though!

@@ -181,7 +183,7 @@ def __init__(
self._quantum_instance = None
if quantum_instance is not None:
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=PendingDeprecationWarning)
warnings.simplefilter("ignore")
Copy link
Member

Choose a reason for hiding this comment

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

I see this was there before but I don't think we should do this. I do not believe the error message from the setter will be seen under normal usage, only something that is directly called like when calling the init here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it will be rendered because we indeed are calling the setter. I don't see much downside to these 2 lines, but there's a big upside in being confident they won't see a "double warning". The @deprecate_arg here is all we want them to see.

But I'll add back the category argument.

Copy link
Member

Choose a reason for hiding this comment

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

I am pretty sure that nowadays they will not - it used to be Terra has some config set that all deprecations were shown. And if you configure things to see deprecations elsewhere we will have swallowed this. With the amount deprecation around opflow I cannot believe this is the only time internally we are calling/using deprecated code. It should be easy enough to check whether you see this or not. Create a Grover with a plain Backend.

@Eric-Arellano Eric-Arellano changed the title [wip] Change algorithms from pending deprecation to deprecated Change algorithms from pending deprecation to deprecated Mar 31, 2023
@Eric-Arellano Eric-Arellano marked this pull request as ready for review March 31, 2023 19:02
@Eric-Arellano Eric-Arellano requested review from a team and ElePT as code owners March 31, 2023 19:02
@coveralls
Copy link

coveralls commented Mar 31, 2023

Pull Request Test Coverage Report for Build 4699944194

  • 30 of 30 (100.0%) changed or added relevant lines in 16 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.05%) to 85.798%

Files with Coverage Reduction New Missed Lines %
qiskit/extensions/quantum_initializer/squ.py 2 80.0%
crates/qasm2/src/lex.rs 3 91.14%
crates/accelerate/src/sabre_swap/layer.rs 4 97.32%
Totals Coverage Status
Change from base Build 4699523725: 0.05%
Covered Lines: 70455
Relevant Lines: 82117

💛 - Coveralls

@Eric-Arellano Eric-Arellano added this to the 0.24.0 milestone Apr 10, 2023
@woodsp-ibm woodsp-ibm added the mod: algorithms Related to the Algorithms module label Apr 13, 2023
Copy link
Member

@woodsp-ibm woodsp-ibm left a comment

Choose a reason for hiding this comment

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

@Eric-Arellano Now that the algorithm migration guide is done I think we should be able to finalize/merge this. It needs a conflict sorting and I left a couple of comments as well. Otherwise it all seems good to go right? Thanks again for doing this for us!

Copy link
Member

@woodsp-ibm woodsp-ibm left a comment

Choose a reason for hiding this comment

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

LGTM thx again!

@woodsp-ibm
Copy link
Member

I will make a minor comment about the text though. Here is what comes out in the VQE class when you look at its docs. We talked about having refs in here instead so its not that. But when I read the first part The class xxxxx.. it almost sounds like some other class especially at the moment with that long ref there - I wonder whether This class xxxxx... would work out better for the docs here so it more seems to refer to what you are currently reading and would be ok in the error message too.

image

@Eric-Arellano
Copy link
Collaborator Author

I think I like this class when it's in the docs. But "This class" maybe reads weird during a runtime warning?

FYI, if I recall correctly, I switched to the full module name because I encountered some deprecated function names that were the same function name but in different modules. I wanted to remove all ambiguity.

@woodsp-ibm
Copy link
Member

But "This class" maybe reads weird during a runtime warning?

Yes, that's kinda why I said work out better for the docs. Its a tradeoff given the duality of usage. Since the runtime message is coming from the class itself I though it would be kinda ok that it has this class - it does name itself too. It just seemed weirder in the docs to me where you kinda have to realize that "The class..." is what you are reading and not some other its referring to. The long ref in there at present did not help in that regard for me. Anyway its pretty minor. Its nice to have the notice coming out in the docs and something that is easily tweaked in the decorator right. Maybe its just me - can see what others think going forwards too.

@Eric-Arellano
Copy link
Collaborator Author

Its nice to have the notice coming out in the docs and something that is easily tweaked in the decorator right.

Yes, very easy to change at any time.

@Eric-Arellano Eric-Arellano added this pull request to the merge queue Apr 14, 2023
Merged via the queue into Qiskit:main with commit 3ebef17 Apr 14, 2023
@Eric-Arellano Eric-Arellano deleted the deprecations-algorithms-pending branch April 14, 2023 23:18
giacomoRanieri pushed a commit to giacomoRanieri/qiskit-terra that referenced this pull request Apr 16, 2023
* Change algorithms from pending deprecation to deprecated

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>

* Review feedback & fix fmt

* Try to fix the tests

* Another round of test fixes

* Last round of test fixes?

* Actual last test fix!

* Use HTTPS

* Refer to migration guide in deprecation changelog

---------

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this pull request May 22, 2023
* Change algorithms from pending deprecation to deprecated

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>

* Review feedback & fix fmt

* Try to fix the tests

* Another round of test fixes

* Last round of test fixes?

* Actual last test fix!

* Use HTTPS

* Refer to migration guide in deprecation changelog

---------

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* Change algorithms from pending deprecation to deprecated

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>

* Review feedback & fix fmt

* Try to fix the tests

* Another round of test fixes

* Last round of test fixes?

* Actual last test fix!

* Use HTTPS

* Refer to migration guide in deprecation changelog

---------

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
…it#9883)

* Change algorithms from pending deprecation to deprecated

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>

* Review feedback & fix fmt

* Try to fix the tests

* Another round of test fixes

* Last round of test fixes?

* Actual last test fix!

* Use HTTPS

* Refer to migration guide in deprecation changelog

---------

Co-authored-by: Manoel Marques <manoelmrqs@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: algorithms Related to the Algorithms module priority: high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants