Skip to content

Commit bea1ec7

Browse files
committed
feat(dev): use nanobind as python package instead of git submodule
Note that the `execute_process` call technically isn't necessary when running in skbuild, since it already sets up CMake search paths accordingly, but it probably still doesn't hurt to have.
1 parent 8d7c46d commit bea1ec7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "libdave"]
22
path = libdave
33
url = https://github.com/shiftinv/libdave.git
4-
[submodule "nanobind"]
5-
path = nanobind
6-
url = https://github.com/wjakob/nanobind

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ find_package(
4949
REQUIRED COMPONENTS Interpreter Development.Module
5050
OPTIONAL_COMPONENTS Development.SABIModule
5151
)
52-
add_subdirectory(nanobind)
52+
53+
# Find (and load) nanobind, see https://nanobind.readthedocs.io/en/latest/building.html#finding-nanobind
54+
execute_process(
55+
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
56+
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT)
57+
find_package(nanobind CONFIG REQUIRED)
5358

5459
nanobind_add_module(_dave_impl STABLE_ABI src/dave.cpp)
5560

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ dev = [
1818
]
1919
# note: these should match `build-system.requires`
2020
build = [
21-
# FIXME: actually use nanobind python package instead of git submodule
22-
"nanobind>=2.9.2",
21+
"nanobind~=2.9.2",
2322
"scikit-build-core>=0.11.0"
2423
]
2524
nox = [
@@ -35,7 +34,7 @@ typing = [
3534
]
3635

3736
[build-system]
38-
requires = ["nanobind>=2.9.2", "scikit-build-core>=0.11.0"]
37+
requires = ["nanobind~=2.9.2", "scikit-build-core>=0.11.0"]
3938
build-backend = "scikit_build_core.build"
4039

4140
[tool.poe.tasks]
@@ -54,7 +53,6 @@ include = [
5453
line-length = 100
5554
extend-exclude = [
5655
"libdave/",
57-
"nanobind/",
5856
]
5957

6058
[tool.ruff.lint]

0 commit comments

Comments
 (0)