From 8acc1dd9059d832b11fa88f60c1d77d70f8d0b31 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Mon, 10 Jun 2024 19:45:34 -0400 Subject: [PATCH 1/2] Show show to set .doc() in extension and have that get pulled in properly --- src/nanobind_example/__init__.py | 1 + src/nanobind_example_ext.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/nanobind_example/__init__.py b/src/nanobind_example/__init__.py index 95ecfec..72e7b1a 100644 --- a/src/nanobind_example/__init__.py +++ b/src/nanobind_example/__init__.py @@ -1 +1,2 @@ from .nanobind_example_ext import add +from .nanobind_example_ext import __doc__ diff --git a/src/nanobind_example_ext.cpp b/src/nanobind_example_ext.cpp index 602ee79..6d30dbf 100644 --- a/src/nanobind_example_ext.cpp +++ b/src/nanobind_example_ext.cpp @@ -5,5 +5,6 @@ namespace nb = nanobind; using namespace nb::literals; NB_MODULE(nanobind_example_ext, m) { + m.doc() = "This is a \"hello world\" example with nanobind"; m.def("add", [](int a, int b) { return a + b; }, "a"_a, "b"_a); } From 89b149835fbe16f6000888fd50eb3e8b29bff525 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Wed, 12 Jun 2024 09:50:13 -0400 Subject: [PATCH 2/2] Have both imports on the same line --- src/nanobind_example/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nanobind_example/__init__.py b/src/nanobind_example/__init__.py index 72e7b1a..fe8a74c 100644 --- a/src/nanobind_example/__init__.py +++ b/src/nanobind_example/__init__.py @@ -1,2 +1 @@ -from .nanobind_example_ext import add -from .nanobind_example_ext import __doc__ +from .nanobind_example_ext import add, __doc__