Nanobind transition - #24749
Conversation
Add a pybind11::callable alias and switch everywhere to use it.
The prior spelling of constructors was ambiguous for nanobind.
jwnimmer-tri
left a comment
There was a problem hiding this comment.
We are down to only 1770 lines remaining!
@jwnimmer-tri reviewed 11 files and all commit messages, made 2 comments, and resolved 1 discussion.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers, labeled "do not merge", commits need curation (https://drake.mit.edu/reviewable.html#curated-commits), missing label for release notes (waiting on rpoyner-tri).
bindings/pydrake/pydrake_pybind.h line 451 at r5 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Working
It's likely that PYDRAKE_OVERRIDE doesn't work at all. All of the remaining instances on this branch are in dead code. The non-dead uses of this all had to be ported to work around the NVI snafu.
Most likely, we should revert this polyfill (or else reimplement it to work correctly.)
Done. Replaced with polyfill.
nanobind type casters cannot provide exception details
jwnimmer-tri
left a comment
There was a problem hiding this comment.
@jwnimmer-tri partially reviewed 20 files and all commit messages, and made 1 comment.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers, labeled "do not merge", commits need curation (https://drake.mit.edu/reviewable.html#curated-commits), missing label for release notes.
bindings/pydrake/common/sorted_pair_pybind.h line 61 at r24 (raw file):
return false; } return true;
Working
This isn't actually setting the value? Maybe we're missing some tests.
rpoyner-tri
left a comment
There was a problem hiding this comment.
@rpoyner-tri made 1 comment.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers, labeled "do not merge", commits need curation (https://drake.mit.edu/reviewable.html#curated-commits), missing label for release notes (waiting on jwnimmer-tri).
bindings/pydrake/common/sorted_pair_pybind.h line 61 at r24 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Working
This isn't actually setting the value? Maybe we're missing some tests.
IIRC, the "value" is squirreled away in InnerCaster values as a side-effect of their invocations, and then reconstructed by the Value operator. Are you seeing a symptom?
jwnimmer-tri
left a comment
There was a problem hiding this comment.
@jwnimmer-tri made 1 comment.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers, labeled "do not merge", commits need curation (https://drake.mit.edu/reviewable.html#curated-commits), missing label for release notes.
bindings/pydrake/common/sorted_pair_pybind.h line 61 at r24 (raw file):
Previously, rpoyner-tri (Rick Poyner (rico)) wrote…
IIRC, the "value" is squirreled away in InnerCaster values as a side-effect of their invocations, and then reconstructed by the Value operator. Are you seeing a symptom?
No symptoms, just spotted while reading the code.
I see the logic now, down below. If it remains this way, I'll need to add a comment here so the next reader isn't also confused.
Still, I might try porting to use the NB_TYPE_CASTER macro so that it's more similar to other casters.
rpoyner-tri
left a comment
There was a problem hiding this comment.
@rpoyner-tri made 1 comment.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers, labeled "do not merge", commits need curation (https://drake.mit.edu/reviewable.html#curated-commits), missing label for release notes (waiting on jwnimmer-tri).
bindings/pydrake/common/sorted_pair_pybind.h line 61 at r24 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
No symptoms, just spotted while reading the code.
I see the logic now, down below. If it remains this way, I'll need to add a comment here so the next reader isn't also confused.
Still, I might try porting to use the
NB_TYPE_CASTERmacro so that it's more similar to other casters.
I believe this structure resulted from following the nanobind doc advice to use https://github.com/wjakob/nanobind/blob/master/include/nanobind/stl/pair.h as an example.
…anobind-transition
This is a review refresh from work done in #24513 towards #21572.
This change is