File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,7 @@ description = "An example minimal project that compiles bindings using nanobind
9
9
readme = " README.md"
10
10
requires-python = " >=3.12"
11
11
authors = [
12
- { name = " M. Amin Safavi" ,
13
- email = " safavi.m.amin@gmail.com" }
12
+ { name = " M. Amin Safavi" , email = " safavi.m.amin@gmail.com" }
14
13
]
15
14
classifiers = [
16
15
" License :: OSI Approved :: MIT License"
Original file line number Diff line number Diff line change 1
- #include < pybind11/pybind11 .h>
1
+ #include < nanobind/nanobind .h>
2
2
#include < drake/systems/framework/leaf_system.h>
3
3
4
- namespace py = pybind11;
4
+ namespace nb = nanobind;
5
+ using namespace nb ::literals;
5
6
6
7
using drake::systems::BasicVector;
7
8
using drake::systems::Context;
@@ -30,14 +31,14 @@ class SimpleAdder : public LeafSystem<T> {
30
31
const T add_{};
31
32
};
32
33
33
- PYBIND11_MODULE (custom_system, m) {
34
+ NB_MODULE (custom_system, m) {
34
35
m.doc () = " Example module interfacing with pydrake and Drake C++" ;
35
36
36
- py::module::import (" pydrake.systems.framework" );
37
+ nb::module_::import_ (" pydrake.systems.framework" );
37
38
38
39
using T = double ;
39
40
40
- py ::class_<SimpleAdder<T>, LeafSystem<T>>(m, " SimpleAdder" )
41
- .def (py ::init<T>(), py ::arg (" add" ));
41
+ nb ::class_<SimpleAdder<T>, LeafSystem<T>>(m, " SimpleAdder" )
42
+ .def (nb ::init<T>(), nb ::arg (" add" ));
42
43
}
43
44
} // namespace drake_extension
You can’t perform that action at this time.
0 commit comments