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

Replace removed itemset method #72

Merged

Conversation

johnwparent
Copy link

@johnwparent johnwparent commented Jul 3, 2024

Numpy 2.0 removes the itemset Python method from
the API
Switch to setting array values via direct array
interface for pybind11::object types

Mutable array access is unchecked for dimension
boundaries

Note: I tested this locally against Drake's bindings test suite, there were a few errors that seemed unrelated, so this approach may not be complete if those errors turn out to be related.

Note: I will be out for the upcoming holiday and the following day, so if edits are required prior to my return, please ping both myself and @BetsyMcPhail (thanks Betsy for offering to take this for a couple days)

Fixes RobotLocomotion/drake#21577

Description

Suggested changelog entry:


This change is Reviewable

Numpy 2.0 removes the itemset Python method from
the API
Switch to setting array values via direct array
interface for pybind11::object types

Mutable array access is unchecked for dimension
boundaries

Signed-off-by: John Parent <john.parent@kitware.com>
@johnwparent
Copy link
Author

cc @BetsyMcPhail
cc @jwnimmer-tri
(I can't assign reviewers)

@jwnimmer-tri
Copy link

The important test is to open a pull request in https://github.com/RobotLocomotion/drake/pulls that bumps Drake's git sha pin of pybind11 to point to this pull request, and run all of CI variations there.

@johnwparent
Copy link
Author

The important test is to open a pull request in https://github.com/RobotLocomotion/drake/pulls that bumps Drake's git sha pin of pybind11 to point to this pull request, and run all of CI variations there.

I assume that's essentially the same change I had to make locally, change the repository, commit, and sha?

@jwnimmer-tri
Copy link

Since this is a pull request against the RobotLocomotion repository, you don't need to change the repository. Only the commit and sha256.

@johnwparent
Copy link
Author

🤦‍♂️ Good point. PR made.

@jwnimmer-tri
Copy link

+@EricCousineau-TRI do you have time for a feature review pass on this one, please?

There are still some failures on the Drake PR, but they do not appear to be related to this PR -- rather just problems with numpy 2.x overall.

Copy link
Collaborator

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

:lgtm:

As a follow-up, we should add NumPy >= 2 testing
Note that upstream (https://github.com/pybind/pybind11/blob/master/.github/workflows/ci.yml) does test NumPy >= 2, but does it on platforms that we disabled.

I can try to do that as follow-up

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @johnwparent)

@EricCousineau-TRI EricCousineau-TRI merged commit f1213df into RobotLocomotion:drake Jul 8, 2024
30 checks passed
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.

NumPy 2.0 support (AttributeError: "itemset")
3 participants