Skip to content

Conversation

@zcbenz
Copy link
Collaborator

@zcbenz zcbenz commented Dec 23, 2025

This is mostly a build isolation v.s. ccache thing: with build isolation the python packages (i.e. nanobind) and cmake build dir would be put under different temporary dirs, and ccache would not able to cache files using nanobind because the they are including headers from a temporary dir. That's why we use --no-build-isolation to fix cache misses, and also why we always have cache misses when using uv because it always builds things in temporary dir.

There are also other benefits:

  • We don't have to hard-code nanobind==2.10.2 in a lot of places.
  • Stubs generation would be part of cmake build rather than a separate command.
  • Simpler CI setup after we remove --no-build-isolation.

CMakeLists.txt Outdated
option(MLX_BUILD_GGUF "Include support for GGUF format" ON)
option(MLX_BUILD_SAFETENSORS "Include support for safetensors format" ON)
option(MLX_BUILD_BLAS_FROM_SOURCE "Build OpenBLAS from source code" OFF)
option(MLX_BUILD_STUBS "Build stub files for python bindings" ON)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might rename that MLX_BUILD_PYTHON_STUBS just to make it a little more clear it's specific to Python.

Also we could just always build the stubs.. since it defaults to on seems unlikely anyone will ever turn it off.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building stubs requires the binary to be runnable, so for arm64 build on CI we have to disable stubs.

Copy link
Member

@awni awni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great change. I left a minor comment. Feel free to merge when ready!

@zcbenz zcbenz merged commit 26dfe4f into ml-explore:main Dec 24, 2025
15 checks passed
@zcbenz zcbenz deleted the vendor-nanobind branch December 24, 2025 01:23
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.

2 participants