Skip to content

Commit 9231617

Browse files
authored
Move to nanobind v2 (#1316)
1 parent 32668a7 commit 9231617

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
setuptools>=42
22
cmake>=3.24
3-
mlx>=0.9.0
4-
nanobind@git+https://github.com/wjakob/nanobind.git@2f04eac452a6d9142dedb957701bdb20125561e4
3+
mlx>=0.16.2
4+
nanobind==2.0

python/src/array.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void init_array(nb::module_& m) {
126126
m.attr("float32") = nb::cast(float32);
127127
m.attr("bfloat16") = nb::cast(bfloat16);
128128
m.attr("complex64") = nb::cast(complex64);
129-
nb::class_<Dtype::Category>(
129+
nb::enum_<Dtype::Category>(
130130
m,
131131
"DtypeCategory",
132132
R"pbdoc(
@@ -165,16 +165,16 @@ void init_array(nb::module_& m) {
165165
* :ref:`complex64 <data_types>`
166166
167167
See also :func:`~mlx.core.issubdtype`.
168-
)pbdoc");
169-
m.attr("complexfloating") = nb::cast(complexfloating);
170-
m.attr("floating") = nb::cast(floating);
171-
m.attr("inexact") = nb::cast(inexact);
172-
m.attr("signedinteger") = nb::cast(signedinteger);
173-
m.attr("unsignedinteger") = nb::cast(unsignedinteger);
174-
m.attr("integer") = nb::cast(integer);
175-
m.attr("number") = nb::cast(number);
176-
m.attr("generic") = nb::cast(generic);
177-
168+
)pbdoc")
169+
.value("complexfloating", complexfloating)
170+
.value("floating", floating)
171+
.value("inexact", inexact)
172+
.value("signedinteger", signedinteger)
173+
.value("unsignedinteger", unsignedinteger)
174+
.value("integer", integer)
175+
.value("number", number)
176+
.value("generic", generic)
177+
.export_values();
178178
nb::class_<ArrayAt>(
179179
m,
180180
"_ArrayAt",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def run(self) -> None:
176176
include_package_data=True,
177177
extras_require={
178178
"dev": [
179-
"nanobind@git+https://github.com/wjakob/nanobind.git@2f04eac452a6d9142dedb957701bdb20125561e4",
179+
"nanobind==2.0",
180180
"numpy",
181181
"pre-commit",
182182
"setuptools>=42",

0 commit comments

Comments
 (0)