Skip to content

Use allow_unknown_parameters in SparseLabelOp.assign_parameters#1023

Merged
mrossinek merged 8 commits into
qiskit-community:mainfrom
kevinsung:allow-unknown-parameters
Jan 20, 2023
Merged

Use allow_unknown_parameters in SparseLabelOp.assign_parameters#1023
mrossinek merged 8 commits into
qiskit-community:mainfrom
kevinsung:allow-unknown-parameters

Conversation

@kevinsung
Copy link
Copy Markdown
Contributor

Summary

Fixes #1010

Details and comments

@kevinsung kevinsung force-pushed the allow-unknown-parameters branch from 1a9adde to 36f56c1 Compare January 11, 2023 14:37
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 11, 2023

Pull Request Test Coverage Report for Build 3967567123

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 85.901%

Totals Coverage Status
Change from base Build 3960912582: 0.01%
Covered Lines: 17602
Relevant Lines: 20491

💛 - Coveralls

mrossinek
mrossinek previously approved these changes Jan 12, 2023
Copy link
Copy Markdown
Member

@mrossinek mrossinek left a comment

Choose a reason for hiding this comment

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

In general I think this is good to go. I am just not sure about some "meta-details".
What I mean by that is that this refactors the change done by the bugfix PR #1008. That PR was backported to stable (but not released yet).

  • Does that mean we can simply merge this as is without a release note?
  • Should we backport this, too?

Pinging @woodsp-ibm and @manoelmarques for input on this

@mrossinek
Copy link
Copy Markdown
Member

Actually, this now uses an unreleased feature of Qiskit Terra so we canNOT backport it as such. I am a bit surprised that the CI did not catch this... @manoelmarques are we still testing against Qiskit Terra installed from source even though our requirements file currently only uses 0.22.*?

@mrossinek mrossinek dismissed their stale review January 12, 2023 07:55

See comment above

@woodsp-ibm
Copy link
Copy Markdown
Member

If the change uses/depends on new features from an as yet unreleased version then the requirements.txt needs to get updated too by this PR, if it does not already reflect the version dependence it requires.

@kevinsung
Copy link
Copy Markdown
Contributor Author

If the change uses/depends on new features from an as yet unreleased version then the requirements.txt needs to get updated too by this PR, if it does not already reflect the version dependence it requires.

Yes, I can do that. But I think Max is asking why this PR passed the CI even though I did not update requirements.txt, considering that it does use an unreleased feature in Terra.

@mrossinek
Copy link
Copy Markdown
Member

Yes, I can do that. But I think Max is asking why this PR passed the CI even though I did not update requirements.txt, considering that it does use an unreleased feature in Terra.

I am indeed wondering that. Can you, thus, please ensure the following:

  • update requirements.txt
  • ensure there is a test which actually triggers this case

@kevinsung
Copy link
Copy Markdown
Contributor Author

The test for this change was added in the previous PR, #1008.

Do you want me to update requirements.txt now, or do you want to wait to fix the CI issue so this PR can be used to test that the CI is working properly?

@mrossinek
Copy link
Copy Markdown
Member

The test for this change was added in the previous PR, #1008.

The test there does not seem to be actually doing this though. It constructs an operator which will have two parameters, a and b, and then assigns a value to a. If I understand this change correctly, the method is supposed to work correctly even if one were to provide a parameter called for example c, which is unknown to the operator.

Do you want me to update requirements.txt now, or do you want to wait to fix the CI issue so this PR can be used to test that the CI is working properly?

If my reasoning above is correct, the CI is working fine and this case is not covered correctly by the unittests.

@kevinsung
Copy link
Copy Markdown
Contributor Author

The test there does not seem to be actually doing this though. It constructs an operator which will have two parameters, a and b, and then assigns a value to a.

The test there was actually testing this behavior because it causes the ParameterExpression containing only b to be passed an assignment dictionary only containing a. Nevertheless, I've added another test on your suggestion that is perhaps more explicit.

@mrossinek
Copy link
Copy Markdown
Member

Alright, then all that is missing is the update of the requirements.txt file. Please do that here, too

@kevinsung
Copy link
Copy Markdown
Contributor Author

Do you want me to update requirements.txt now, or do you want to wait to fix the CI issue so this PR can be used to test that the CI is working properly?

@mrossinek
Copy link
Copy Markdown
Member

As explicitly said: please update it now.

We are continuing to test Qiskit Nature against Qiskit Terra main to catch potential breakage early. This is an intentional choice of the application developers team to do this for the packages within the Qiskit organization. Thus, CI is indeed working as intended.

The reason I originally expected this to fail would have been the neko tests, but this simply does not catch this particular change which is not an issue we can fix here (nor wait to be fixed).

@kevinsung
Copy link
Copy Markdown
Contributor Author

What's the correct way to update requirements.txt? I tried the following, neither of which worked:

  • qiskit-terra>=0.23.*
  • git+https://github.com/Qiskit/qiskit-terra@main#egg=qiskit-terra

@manoelmarques
Copy link
Copy Markdown
Contributor

manoelmarques commented Jan 17, 2023

Currently it is qiskit-terra>=0.22.* so it should just bump to qiskit-terra>=0.23.*
I saw your CI and the failure was on Neko. This is very unfortunate since the idea behind this Neko thing is to test against Terra from Pypi.
I have no control over Neko since it was created by Terra. For Neko to work, since Pypi Terra 0.23 is not yet released, you cannot bump it until there is a 0.23 (0.23rc1) version in Pypi which should be this week

ERROR: Could not find a version that satisfies the requirement qiskit-terra>=0.23.* (from qiskit-nature) (from versions: 0.7.0, 0.7.1, 0.7.2, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.13.0, 0.14.0, 0.14.1, 0.14.2, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.16.4, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.21.0rc1, 0.21.0, 0.21.1, 0.21.2, 0.22.0rc1, 0.22.0, 0.22.1, 0.22.2, 0.22.3, 0.22.4)
ERROR: No matching distribution found for qiskit-terra>=0.23.*

Comment thread requirements.txt Outdated
Co-authored-by: Max Rossmannek <max.rossmannek@uzh.ch>
@mrossinek mrossinek merged commit 29b5214 into qiskit-community:main Jan 20, 2023
@kevinsung kevinsung deleted the allow-unknown-parameters branch January 20, 2023 17:14
Anthony-Gandon pushed a commit to Anthony-Gandon/qiskit-nature that referenced this pull request May 25, 2023
…it-community#1023)

* use allow_unknown_parameters in SparseLabelOp.assign_parameters

* add test

* make the copyright checker happy

* update requirements.txt to qiskit-terra 0.23

* update requirements.txt to github qiskit-terra

* change requirements.txt to qiskit-terra 0.23 again

Co-authored-by: Max Rossmannek <max.rossmannek@uzh.ch>

Co-authored-by: Max Rossmannek <max.rossmannek@uzh.ch>
Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com>
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.

Use allow_unknown_parameters option in SparseLabelOp.assign_parameters

5 participants