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

Bump PyO3 and rust-numpy to 0.23.x #13577

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mtreinish
Copy link
Member

Summary

This commit bumps the version of pyo3 and rust-numpy used by qiskit to the latest release 0.23. The largest change by volume of code is the deprecation of all the *_bound() methods. These are just warnings but they would be fatal to our CI so it needs to be updated. The larger functional change that required updating the code is the change in the traits around converting to Python objects. This actually found a bug in the target where we were not returning a proper instruction type for standard gates. This also opens up the opportunity to update our hashbrown version to 0.15.x, but we can't do that until the next rustworkx-core release.

Details and comments

This commit bumps the version of pyo3 and rust-numpy used by qiskit to
the latest release 0.23. The largest change by volume of code is the
deprecation of all the `*_bound()` methods. These are just warnings but
they would be fatal to our CI so it needs to be updated. THe larger
functional change that required updating the code is the change in the
traits around converting to Python objects. This actually found a bug in
the target where we were not returning a proper instruction type for
standard gates. This also opens up the opportunity to update our
hashbrown version to 0.15.x, but we can't do that until the next
rustworkx-core release.
@mtreinish mtreinish added Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository labels Dec 18, 2024
@mtreinish mtreinish added this to the 2.0.0 milestone Dec 18, 2024
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core
  • @levbishop

@kevinhartman kevinhartman self-assigned this Dec 18, 2024
Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! I've done just one quick pass for now, and will unassign myself since I'm unlikely to have another look before I'm out on vacation.

.get_bound(py)
.call1((array.to_object(py), py.None(), false))?;
let unitary_gate = UNITARY_GATE.get_bound(py).call1((
<pyo3::Bound<'_, PyArray<Complex<f64>, ndarray::Dim<[usize; 2]>>> as Clone>::clone(&array).into_pyobject(py)?,
Copy link
Contributor

Choose a reason for hiding this comment

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

👀

Comment on lines +179 to +181
.into_pyobject(py)?
.into_any()
.unbind())
Copy link
Contributor

Choose a reason for hiding this comment

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


impl<'py> IntoPyObject<'py> for &NormalOperation {
type Target = PyAny;
type Output = Bound<'py, Self::Target>;
Copy link
Contributor

Choose a reason for hiding this comment

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

From the migration guide, should this be a Borrowed instead?

https://pyo3.rs/v0.23.3/migration.html#intopyobject-manual-implementation

}
}
}
//impl<'py> IntoPyObject<'py> for Param {
Copy link
Contributor

Choose a reason for hiding this comment

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

👀

@kevinhartman kevinhartman removed their assignment Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants