git: 8050e7d23b02 - main - devel/{,py-}nanobind: update 2.4.0 → 2.12.0
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Mar 2026 20:47:02 UTC
The branch main has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=8050e7d23b02697206550ba60986ca95d3679a74
commit 8050e7d23b02697206550ba60986ca95d3679a74
Author: Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-03-01 18:32:00 +0000
Commit: Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-03-01 20:45:28 +0000
devel/{,py-}nanobind: update 2.4.0 → 2.12.0
---
devel/nanobind/Makefile | 58 ++++++++++++----------
devel/nanobind/distinfo | 6 +--
.../files/patch-cmake_nanobind-config.cmake | 46 -----------------
devel/nanobind/pkg-plist | 5 ++
devel/py-nanobind/Makefile | 13 +++--
devel/py-nanobind/distinfo | 6 +--
science/py-phono3py/files/patch-pyproject.toml | 9 ++++
science/py-phonopy/files/patch-pyproject.toml | 9 ++++
8 files changed, 71 insertions(+), 81 deletions(-)
diff --git a/devel/nanobind/Makefile b/devel/nanobind/Makefile
index 7932cf26c5e8..fffc983c9e56 100644
--- a/devel/nanobind/Makefile
+++ b/devel/nanobind/Makefile
@@ -1,6 +1,6 @@
PORTNAME= nanobind
DISTVERSIONPREFIX= v
-DISTVERSION= 2.4.0
+DISTVERSION= 2.12.0
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
@@ -13,9 +13,16 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= robin-map>0:devel/robin-map
RUN_DEPENDS= robin-map>0:devel/robin-map
-TEST_DEPENDS= gmake:devel/gmake
+TEST_DEPENDS= eigen>0:math/eigen3 \
+ gmake:devel/gmake \
+ pytest:devel/py-pytest@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}jax>0:math/py-jax@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}numpy>0:math/py-numpy@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}typing-extensions>0:devel/py-typing-extensions@${PY_FLAVOR}
+# ${PYTHON_PKGNAMEPREFIX}tensorflow>0:science/py-tensorflow@${PY_FLAVORA} # tensorflow tests crash the python process
-USES= cmake localbase python:test
+USES= cmake:testing localbase python:test
USE_GITHUB= yes
GH_ACCOUNT= wjakob
@@ -26,36 +33,37 @@ CMAKE_OFF= NB_USE_SUBMODULE_DEPS \
NB_TEST_FREE_THREADED \
NB_TEST \
CMAKE_SKIP_INSTALL_RULES
+CMAKE_TESTING_ON= NB_TEST
+CMAKE_TESTING_TARGET= copy-tests
CXXFLAGS+= -I${WRKSRC}/include \
-I${PYTHON_INCLUDEDIR}
+INSTALL_TARGET= install
+
+TEST_WRKSRC= ${BUILD_WRKSRC}/tests
+
NO_ARCH= yes
-do-install:
- # install manually because the default framework-provided install op fails for some reason
- cd ${BUILD_WRKSRC} && \
- ${SETENV} DESTDIR=${STAGEDIR} ${MAKE_CMD} install
- # remove unnecessary files
+post-install:
+ # workaround for https://github.com/wjakob/nanobind/issues/1300
@${RM} \
${STAGEDIR}${PREFIX}/cmake/darwin-ld-cpython.sym \
${STAGEDIR}${PREFIX}/cmake/darwin-ld-pypy.sym \
- ${STAGEDIR}${DATADIR}/__init__.py \
- ${STAGEDIR}${DATADIR}/__main__.py
-
-do-test:
- @cd ${WRKSRC} && \
- ${RM} -r test && \
- ${MKDIR} test && \
- cd test && \
- ${CP} ${FILESDIR}/CMakeLists.txt ${FILESDIR}/my_ext.cpp . && \
- cmake -DCMAKE_PREFIX_PATH="${STAGEDIR}${PREFIX}" . && \
- ${SETENV} CXXFLAGS="${CXXFLAGS} -I${STAGEDIR}${PREFIX}/include" ${GMAKE} -j ${MAKE_JOBS_NUMBER} && \
- if [ `${PYTHON_CMD} -c "import my_ext; print(my_ext.add(1, 2))"` = 3 ]; then \
- ${ECHO} "Test succeeded"; \
- else \
- ${ECHO} "Test failed"; \
- return 1; \
- fi
+ ${STAGEDIR}${PREFIX}/cmake/darwin-python-path.py
+ # correct path to the src directory in cmake file
+ @${REINPLACE_CMD} -e 's|$${NB_DIR}/src/|${DATADIR}/src/|g' \
+ ${STAGEDIR}${PREFIX}/cmake/nanobind-config.cmake
+
+post-test:
+ @cd ${TEST_WRKSRC} && \
+ pytest .
+
+# tests as of 2.12.0:
+# Results (41.59s):
+# 2 failed
+# 1486 passed
+# 19 skipped
+# 2 warnings
# cmake installs files into non-standard locations, see https://github.com/wjakob/nanobind/issues/810
# hostile upstream, do not create bug reports
diff --git a/devel/nanobind/distinfo b/devel/nanobind/distinfo
index 2cd0a61c9090..bebc9ffdbd69 100644
--- a/devel/nanobind/distinfo
+++ b/devel/nanobind/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1733460759
-SHA256 (wjakob-nanobind-v2.4.0_GH0.tar.gz) = bb35deaed7efac5029ed1e33880a415638352f757d49207a8e6013fefb6c49a7
-SIZE (wjakob-nanobind-v2.4.0_GH0.tar.gz) = 890566
+TIMESTAMP = 1772385576
+SHA256 (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 01f1f0cd0398743c18f33d07ae36ad410bd7f4a1e90683b508504de897d6e629
+SIZE (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 940575
diff --git a/devel/nanobind/files/patch-cmake_nanobind-config.cmake b/devel/nanobind/files/patch-cmake_nanobind-config.cmake
deleted file mode 100644
index c3c581c7304b..000000000000
--- a/devel/nanobind/files/patch-cmake_nanobind-config.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
---- cmake/nanobind-config.cmake.orig 2024-12-05 23:06:19 UTC
-+++ cmake/nanobind-config.cmake
-@@ -166,19 +166,19 @@ function (nanobind_build_library TARGET_NAME)
- ${NB_DIR}/include/nanobind/eigen/dense.h
- ${NB_DIR}/include/nanobind/eigen/sparse.h
-
-- ${NB_DIR}/src/buffer.h
-- ${NB_DIR}/src/hash.h
-- ${NB_DIR}/src/nb_internals.h
-- ${NB_DIR}/src/nb_internals.cpp
-- ${NB_DIR}/src/nb_func.cpp
-- ${NB_DIR}/src/nb_type.cpp
-- ${NB_DIR}/src/nb_enum.cpp
-- ${NB_DIR}/src/nb_ndarray.cpp
-- ${NB_DIR}/src/nb_static_property.cpp
-- ${NB_DIR}/src/common.cpp
-- ${NB_DIR}/src/error.cpp
-- ${NB_DIR}/src/trampoline.cpp
-- ${NB_DIR}/src/implicit.cpp
-+ ${NB_DIR}/share/nanobind/src/buffer.h
-+ ${NB_DIR}/share/nanobind/src/hash.h
-+ ${NB_DIR}/share/nanobind/src/nb_internals.h
-+ ${NB_DIR}/share/nanobind/src/nb_internals.cpp
-+ ${NB_DIR}/share/nanobind/src/nb_func.cpp
-+ ${NB_DIR}/share/nanobind/src/nb_type.cpp
-+ ${NB_DIR}/share/nanobind/src/nb_enum.cpp
-+ ${NB_DIR}/share/nanobind/src/nb_ndarray.cpp
-+ ${NB_DIR}/share/nanobind/src/nb_static_property.cpp
-+ ${NB_DIR}/share/nanobind/src/common.cpp
-+ ${NB_DIR}/share/nanobind/src/error.cpp
-+ ${NB_DIR}/share/nanobind/src/trampoline.cpp
-+ ${NB_DIR}/share/nanobind/src/implicit.cpp
- )
-
- if (TARGET_TYPE STREQUAL "SHARED")
-@@ -400,8 +400,8 @@ function (nanobind_add_stub name)
- function (nanobind_add_stub name)
- cmake_parse_arguments(PARSE_ARGV 1 ARG "VERBOSE;INCLUDE_PRIVATE;EXCLUDE_DOCSTRINGS;INSTALL_TIME;EXCLUDE_FROM_ALL" "MODULE;OUTPUT;MARKER_FILE;COMPONENT;PATTERN_FILE" "PYTHON_PATH;DEPENDS")
-
-- if (EXISTS ${NB_DIR}/src/stubgen.py)
-- set(NB_STUBGEN "${NB_DIR}/src/stubgen.py")
-+ if (EXISTS ${NB_DIR}/share/nanobind/stubgen.py)
-+ set(NB_STUBGEN "${NB_DIR}/share/nanobind/stubgen.py")
- elseif (EXISTS ${NB_DIR}/stubgen.py)
- set(NB_STUBGEN "${NB_DIR}/stubgen.py")
- else()
diff --git a/devel/nanobind/pkg-plist b/devel/nanobind/pkg-plist
index db399f3174aa..c64e45ee7db0 100644
--- a/devel/nanobind/pkg-plist
+++ b/devel/nanobind/pkg-plist
@@ -57,13 +57,18 @@ include/nanobind/stl/vector.h
include/nanobind/stl/wstring.h
include/nanobind/trampoline.h
include/nanobind/typing.h
+%%DATADIR%%/__init__.py
+%%DATADIR%%/__main__.py
%%DATADIR%%/src/buffer.h
%%DATADIR%%/src/common.cpp
%%DATADIR%%/src/error.cpp
%%DATADIR%%/src/hash.h
%%DATADIR%%/src/implicit.cpp
+%%DATADIR%%/src/nb_abi.h
%%DATADIR%%/src/nb_combined.cpp
%%DATADIR%%/src/nb_enum.cpp
+%%DATADIR%%/src/nb_ft.cpp
+%%DATADIR%%/src/nb_ft.h
%%DATADIR%%/src/nb_func.cpp
%%DATADIR%%/src/nb_internals.cpp
%%DATADIR%%/src/nb_internals.h
diff --git a/devel/py-nanobind/Makefile b/devel/py-nanobind/Makefile
index fa28fdd1ad01..f2cf8e29c071 100644
--- a/devel/py-nanobind/Makefile
+++ b/devel/py-nanobind/Makefile
@@ -1,6 +1,6 @@
PORTNAME= nanobind
DISTVERSIONPREFIX= v
-DISTVERSION= 2.4.0
+DISTVERSION= 2.12.0
CATEGORIES= devel python
#MASTER_SITES= PYPI # no tarball
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -25,16 +25,21 @@ USE_GITHUB= yes
GH_ACCOUNT= wjakob
GH_TUPLE= Tessil:robin-map:188c455:robin_map/ext/robin_map
-TEST_WRKSRC= ${WRKSRC}/tests
+TEST_WRKSRC= ${BUILD_WRKSRC}/tests
TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
NO_ARCH= yes
pre-test: # build test extensions
@cd ${WRKSRC} && \
- ${SETENV} ${MAKE_ENV} cmake . && \
+ ${SETENV} ${MAKE_ENV} cmake -DPython_EXECUTABLE=${PYTHON_CMD} . && \
${SETENV} ${MAKE_ENV} ${MAKE} -j${MAKE_JOBS_NUMBER}
-# tests fail to compile: Free-threaded extensions require a free-threaded version of Python
+# tests as of 2.12.0:
+# Results (46.91s):
+# 2 failed
+# 1495 passed
+# 19 skipped
+# 2 warnings
.include <bsd.port.mk>
diff --git a/devel/py-nanobind/distinfo b/devel/py-nanobind/distinfo
index aff759921ca3..3a81d3c45e9d 100644
--- a/devel/py-nanobind/distinfo
+++ b/devel/py-nanobind/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1733477888
-SHA256 (wjakob-nanobind-v2.4.0_GH0.tar.gz) = bb35deaed7efac5029ed1e33880a415638352f757d49207a8e6013fefb6c49a7
-SIZE (wjakob-nanobind-v2.4.0_GH0.tar.gz) = 890566
+TIMESTAMP = 1772389974
+SHA256 (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 01f1f0cd0398743c18f33d07ae36ad410bd7f4a1e90683b508504de897d6e629
+SIZE (wjakob-nanobind-v2.12.0_GH0.tar.gz) = 940575
SHA256 (Tessil-robin-map-188c455_GH0.tar.gz) = c3f05ed8933a1f9aa57295c8ad17bd44756cf5cf030a95325c61aa862fa19680
SIZE (Tessil-robin-map-188c455_GH0.tar.gz) = 70577
diff --git a/science/py-phono3py/files/patch-pyproject.toml b/science/py-phono3py/files/patch-pyproject.toml
new file mode 100644
index 000000000000..c651c0fc4530
--- /dev/null
+++ b/science/py-phono3py/files/patch-pyproject.toml
@@ -0,0 +1,9 @@
+--- pyproject.toml.orig 2026-03-01 18:48:34 UTC
++++ pyproject.toml
+@@ -1,5 +1,5 @@
+ [build-system]
+-requires = ["scikit-build-core", "nanobind<2.10.0", "numpy"]
++requires = ["scikit-build-core", "nanobind", "numpy"]
+ build-backend = "scikit_build_core.build"
+
+ [project]
diff --git a/science/py-phonopy/files/patch-pyproject.toml b/science/py-phonopy/files/patch-pyproject.toml
new file mode 100644
index 000000000000..34603697161f
--- /dev/null
+++ b/science/py-phonopy/files/patch-pyproject.toml
@@ -0,0 +1,9 @@
+--- pyproject.toml.orig 2026-03-01 18:46:34 UTC
++++ pyproject.toml
+@@ -1,5 +1,5 @@
+ [build-system]
+-requires = ["scikit-build-core", "nanobind<2.10.0", "numpy"]
++requires = ["scikit-build-core", "nanobind", "numpy"]
+ build-backend = "scikit_build_core.build"
+
+ [project]