Skip to content

[Build] Pin nanobind below 2.14.0 - #848

Merged
hughperkins merged 3 commits into
mainfrom
hp/pin-nanobind-2.14
Aug 7, 2026
Merged

[Build] Pin nanobind below 2.14.0#848
hughperkins merged 3 commits into
mainfrom
hp/pin-nanobind-2.14

Conversation

@hughperkins

Copy link
Copy Markdown
Collaborator

Summary

main is red on Python 3.11+ for every architecture. A single test fails,
tests/python/test_ast_refactor.py::test_single_compare:

TypeError: write_uint(): incompatible function arguments. The following argument types are supported:
    1. write_uint(self, arg0: collections.abc.Sequence[int], arg1: int, /) -> None

Invoked with types: quadrants._lib.core.quadrants_python.SNodeCxx, tuple, bool

Nothing in this repository changed. Two unpinned dependencies intersected:

  • nanobind 2.14.0, released 2026-08-07: "Implicit conversion to
    integer-typed arguments now requires that the input implement Python's
    __index__ protocol."
    Our requirement was nanobind>=2.0.0, so builds
    picked it up automatically.
  • NumPy >= 2.3 removed __index__ from numpy.bool (deprecated in 2.2).

The test assigns into a field from Python scope with c[i * 6] = a[i] == b[i].
qd.Vector stores its entries as a NumPy array, so the comparison yields
np.False_, and SNodeHostAccessor hands that straight to write_uint:

https://github.com/Genesis-Embodied-AI/quadrants/blob/main/python/quadrants/lang/field.py#L751-L755

Python 3.10 escapes because it caps NumPy at 2.2.6, where the deprecated
__index__ still exists. Confirmed locally:

NumPy operator.index(np.False_)
2.2.6 returns 0, with a DeprecationWarning
2.4.6 raises TypeError: 'numpy.bool' object cannot be interpreted as an integer

This pins nanobind below 2.14.0 in both places that declare it, and marks both
bounds FIXME.

Why a pin rather than a fix

The pin unblocks CI immediately. The real fix is coercing the NumPy scalar at
the call site in lang/field.py, which deserves its own change and its own
test; nanobind considers the old permissive behaviour a bug, so the bound
cannot stay forever. The other half of the nanobind change is latent too:
np.float32 arguments used to be silently truncated and are now rejected, so
there may be more call sites than this one.

Evidence it is the nanobind version and nothing else

#842 passed this
same test on 3.11/3.12/3.13 on Aug 6 with the same NumPy 2.4.6, built against
nanobind 2.13.0. On Aug 7 the same test on the same xdist worker in the
same position fails, built against nanobind 2.14.0. A dry-run resolution of
the new constraint selects 2.13.0.

Test plan

  • CI green on Python 3.11, 3.12 and 3.13 across cpu, metal, vulkan, and the
    manylinux wheels, which is exactly the set that is currently failing.
  • test_ast_refactor.py::test_single_compare passes.

hughperkins and others added 3 commits August 7, 2026 10:54
nanobind 2.14.0, released 2026-08-07, requires that implicit conversion to an
integer-typed argument implement the Python __index__ protocol. numpy.bool no
longer provides it (deprecated in NumPy 2.2, removed in 2.3), so writing a
NumPy bool into an integer field from Python scope now raises TypeError out of
SNodeCxx.write_uint:

    TypeError: write_uint(): incompatible function arguments.
    Invoked with types: SNodeCxx, tuple, bool

The requirement was unbounded, so every build since that release picks it up.
It breaks on Python 3.11+ only, because 3.10 caps NumPy at 2.2.6 where the
deprecated __index__ still exists; the arch is irrelevant, since the failing
write happens in Python scope.

Pin until the conversion is done at the call site instead, and mark both
bounds FIXME so they are not left in place indefinitely.

Co-authored-by: Cursor <cursoragent@cursor.com>
The previous wording read as waiting for the coercion to happen elsewhere.
State the work to do, so whoever picks it up knows the bound comes off as part
of the same change.

Co-authored-by: Cursor <cursoragent@cursor.com>
The neighbouring entries carry no such description, and the FIXME below it is
the only part that is not evident from the requirement itself.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hughperkins
hughperkins merged commit 264d9cf into main Aug 7, 2026
65 checks passed
@hughperkins
hughperkins deleted the hp/pin-nanobind-2.14 branch August 7, 2026 15:59
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant