-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
cpp_param: Add ability to map C++ template paramters to Python to enable simple templating. #7732
cpp_param: Add ability to map C++ template paramters to Python to enable simple templating. #7732
Conversation
8c27f67
to
e26eee0
Compare
+@jadecastro for feature review, please. (This paves the way towards ease of scalar-type converting in Python, and also handling Review status: 0 of 10 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
2e3478a
to
74d934b
Compare
Checkpoint. @EricCousineau-TRI , could you check the CI failure? Also, I have the following test failure when I tested it on my mac:
Reviewed 7 of 12 files at r1. bindings/pydrake/util/BUILD.bazel, line 9 at r1 (raw file):
BTW, not used. Comments from Reviewable |
Checkpoint. Reviewed 8 of 12 files at r1. bindings/pydrake/util/cpp_types_py.cc, line 8 at r1 (raw file):
BTW, bindings/pydrake/util/cpp_types_pybind.h, line 20 at r1 (raw file):
Please document this function. bindings/pydrake/util/test/cpp_types_test.cc, line 44 at r1 (raw file):
BTW, I don't see anything against inline function argument sizes in the style guide, but is it reasonable to move this massive raw string into a python file that's called using Comments from Reviewable |
a824957
to
6e664a8
Compare
After my changes, I've tested on @drake-jenkins-bot mac-highsierra-clang-bazel-experimental please. Review status: 6 of 12 files reviewed at latest revision, 4 unresolved discussions. bindings/pydrake/util/BUILD.bazel, line 9 at r1 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. bindings/pydrake/util/cpp_types_pybind.h, line 20 at r1 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. bindings/pydrake/util/cpp_types_py.cc, line 8 at r1 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. (Removed module.) bindings/pydrake/util/test/cpp_types_test.cc, line 44 at r1 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. Created Comments from Reviewable |
6e664a8
to
5928e0c
Compare
@drake-jenkins-bot mac-highsierra-clang-bazel-experimental please. |
Sorry for the delay, first pass complete. Reviewed 7 of 8 files at r2. bindings/pydrake/util/test/cpp_types_pybind_test.cc, line 9 at r2 (raw file):
BTW, Unused? bindings/pydrake/util/test/cpp_types_pybind_test.cc, line 34 at r2 (raw file):
I assume it's beyond the scope to test the actual content of the Python and C++ data structures (i.e. testing the bindings/pydrake/util/test/cpp_types_pybind_test.cc, line 41 at r2 (raw file):
BTW, is the test for bindings/pydrake/util/test/cpp_types_test.py, line 26 at r2 (raw file):
I'm concerned that the checks below are incapable of distinguishing the return of Comments from Reviewable |
Reviewed 1 of 8 files at r2. Comments from Reviewable |
First pass completed. Reviewed 1 of 12 files at r1, 8 of 8 files at r2. bindings/pydrake/util/cpp_types_pybind.cc, line 19 at r2 (raw file):
BTW, we're passing bindings/pydrake/util/cpp_types_pybind.h, line 14 at r2 (raw file):
Please consider moving this line inside of bindings/pydrake/util/type_pack.h, line 86 at r2 (raw file):
Could you provide more information/documentation for this? (also need bindings/pydrake/util/type_pack.h, line 158 at r2 (raw file):
BTW, there is a missing backtick at the end of this line. bindings/pydrake/util/type_pack.h, line 167 at r2 (raw file):
FYI, there are no tests calling this function with four arguments. tools/skylark/py_env_runner.py, line 8 at r2 (raw file):
BTW, I think this comment can be removed now? Comments from Reviewable |
3c2bca5
to
6f43f42
Compare
Review status: 5 of 12 files reviewed at latest revision, 10 unresolved discussions. bindings/pydrake/util/cpp_types_pybind.cc, line 19 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
I do it because that's what I've seen in bindings/pydrake/util/cpp_types_pybind.h, line 14 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
I prefer to keep this in the global scope, because I actually do want it to be part of the public API. Since we are using Additionally, these modules are only intended for consumption in Python bindings. bindings/pydrake/util/type_pack.h, line 86 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. Illustrated with analogous cases here: bindings/pydrake/util/type_pack.h, line 158 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. Thanks! bindings/pydrake/util/type_pack.h, line 167 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. Removed argument. Thanks! bindings/pydrake/util/test/cpp_types_pybind_test.cc, line 9 at r2 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
bindings/pydrake/util/test/cpp_types_pybind_test.cc, line 34 at r2 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. bindings/pydrake/util/test/cpp_types_pybind_test.cc, line 41 at r2 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. bindings/pydrake/util/test/cpp_types_test.py, line 26 at r2 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
That's the scope of this test - checking that pure Python types are pass-through, and that aliased types are appropriately mapped. No C++ types are registered, because that would causes this module to depend on the downstream module tools/skylark/py_env_runner.py, line 8 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Er, I'd prefer to keep this. It feels very hacky, and makes debugging a pain... If there's a better solution, I'd love to use it. Comments from Reviewable |
6f43f42
to
416b825
Compare
Reviewed 1 of 7 files at r3. bindings/pydrake/util/cpp_types_pybind.h, line 14 at r2 (raw file): Previously, EricCousineau-TRI wrote…
I think it's still not a good idea to keep this line here. How about moving it inside of bindings/pydrake/util/type_pack.h, line 86 at r2 (raw file): Previously, EricCousineau-TRI wrote…
Thanks! Comments from Reviewable |
416b825
to
cf1d35d
Compare
Review status: 6 of 12 files reviewed at latest revision, 2 unresolved discussions. bindings/pydrake/util/cpp_types_pybind.h, line 14 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. Moved inside of Comments from Reviewable |
Reviewed 7 of 7 files at r3. bindings/pydrake/util/test/cpp_types_test.py, line 26 at r2 (raw file): Previously, EricCousineau-TRI wrote…
I see, this makes sense to me. Thanks for clarifying. I see now that only Comments from Reviewable |
cf1d35d
to
1e80e9a
Compare
1e80e9a
to
1ad7691
Compare
Applied rename. Review status: 6 of 12 files reviewed at latest revision, all discussions resolved. bindings/pydrake/util/test/cpp_param_test.py, line 26 at r2 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Welcome! (And sorry that it was a little hard to follow). Comments from Reviewable |
ef31089
to
4cf21d7
Compare
Reviewed 10 of 11 files at r4, 3 of 3 files at r5. bindings/pydrake/util/cpp_param.py, line 15 at r5 (raw file):
BTW, there's no default in this definition? bindings/pydrake/util/cpp_param_pybind.h, line 48 at r5 (raw file):
BTW, I believe it throws if not registered in bindings/pydrake/util/test/cpp_param_test.py, line 26 at r2 (raw file): Previously, EricCousineau-TRI wrote…
I like this much better actually, and as an added bonus we eliminate that default Boolean argument :) Comments from Reviewable |
4cf21d7
to
5fa812b
Compare
…ble simple templating.
5fa812b
to
3c379c8
Compare
Review status: 10 of 12 files reviewed at latest revision, 2 unresolved discussions. bindings/pydrake/util/cpp_param.py, line 15 at r5 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. bindings/pydrake/util/cpp_param_pybind.h, line 48 at r5 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. D'oh, thanks for catching that! Comments from Reviewable |
Reviewed 1 of 11 files at r4, 1 of 2 files at r6. Comments from Reviewable |
Reviewed 2 of 12 files at r3, 7 of 11 files at r4, 2 of 3 files at r5, 2 of 2 files at r6. Comments from Reviewable |
This relates #7660: template classes and methods in pybind11.
This adds
cpp_types
, to be consumed by something likecpp_template
. More context in #7682:This change is