Skip to content

⬆️🐍 Adopt nanobind 3 split-mode wheels - #2209

Merged
burgholzer merged 23 commits into
mainfrom
renovate/nanobind-3.x
Aug 23, 2026
Merged

⬆️🐍 Adopt nanobind 3 split-mode wheels#2209
burgholzer merged 23 commits into
mainfrom
renovate/nanobind-3.x

Conversation

@renovate

@renovate renovate Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Description

This PR upgrades MQT Core to nanobind 3 and uses split mode to reduce the release matrix:

  • require Python 3.11 or newer;
  • publish one cp311-abi3 wheel for GIL-enabled CPython 3.11 and newer;
  • publish one cp315-abi3t wheel for free-threaded CPython 3.15 and newer;
  • stop publishing CPython 3.13t and 3.14t wheels;
  • install nanobind-backend as the required runtime backend;
  • require CMake 4.4.1 or newer for Python package builds;
  • use nanobind split mode for every Python binding build;
  • remove one dense allocation and copy from VectorDD.get_vector();
  • protect shared DD, IR, and QDMI state exposed by free-threaded Python.

The branch retains Daniel Haag's original nanobind 3 commits and signed cherry-picks of the Python 3.11 work from #2009.

The QDMI synchronization is isolated in one commit. If #1901 lands first, that commit can be dropped because #1901 removes the legacy driver.

Generated installation and tooling pages come from the MQT templates repository and still need a template-side follow-up.

Validation

  • release build
  • 4,143 CTest cases passed; one contract-defined skip
  • 727 Python tests passed; three expected skips
  • final DD vector and matrix suites: 18 passed
  • QDMI driver suite: 95 passed
  • symbolic concurrency suite: 20 passed
  • final cp311-abi3 and cp315-abi3t wheel builds and clean-environment import/DD ownership smoke tests
  • strict abi3audit for the classic wheel
  • check-wheel-contents for both wheels
  • nanobind's split-mode CPython 3.15t suite: 457 passed, 243 skipped
  • stub generation
  • uvx nox -s lint
  • uv lock --check
  • git diff --check
  • direct split-mode configuration with CMake 3.24 and 4.4
  • final cp311-abi3 wheel build with scikit-build-core selecting CMake 4.4.2
  • resolved cibuildwheel options preserve full Windows AMD64 tests through CPython 3.14 and smoke-test Windows ARM64 and CPython 3.15
  • pre-review hosted CI: 24 of 24 jobs passed across Linux x86-64/ARM64, macOS Intel/ARM64, and Windows x64/ARM64
  • pre-review hosted Slurm integration passed
  • hosted wheel jobs produced the exact cp311-abi3 and cp315-abi3t artifacts and installed nanobind-backend on all release platforms
  • macOS artifact inspection confirmed that ARM modules export only their initializer and Intel modules add only nanobind's four required weak exception RTTI symbols

ThreadSanitizer cannot start on this ARM64 host because its runtime reports FATAL: ThreadSanitizer: unexpected memory mapping. Native concurrency tests and a GIL-disabled CPython 3.15 smoke test cover the new synchronization on this host.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate Bot added dependencies Pull requests that update a dependency file python Anything related to Python code labels Aug 22, 2026
@denialhaag
denialhaag marked this pull request as draft August 22, 2026 12:46
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/qdmi/driver/Driver.cpp 90.0% 10 Missing ⚠️
include/mqt-core/ir/Register.hpp 50.0% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@denialhaag
denialhaag force-pushed the renovate/nanobind-3.x branch from 980260d to 2d5b716 Compare August 22, 2026 12:54
Comment thread UPGRADING.md Outdated
denialhaag and others added 7 commits August 22, 2026 15:57
(cherry picked from commit 9190c61)
Assisted-by: Claude Opus 5 via Claude Code
(cherry picked from commit 9e9ab1a)
Build one cp311-abi3 wheel for GIL-enabled CPython and one cp315-abi3t wheel for free-threaded CPython. Drop Python 3.10 and pre-3.15 free-threading, add the backend runtime dependency, migrate the bindings, and hand dense DD vectors directly to NumPy.

Assisted-by: GPT-5 via Codex
Use thread-local DD scratch state and random engines, atomic implicit-register counters, and a mutex for the process-wide symbolic-variable registry.

Assisted-by: GPT-5 via Codex
Guard device registration, persistent opens, client sessions, and per-device jobs while keeping provider calls and object destruction outside collection locks.

Assisted-by: GPT-5 via Codex
Record the Python floor, split wheel matrix, free-threading hardening, DD export optimization, and attribution-preserving integration in the changelog and ExecPlan.

Assisted-by: GPT-5 via Codex
@burgholzer burgholzer changed the title ⬆️🐍 Update dependency nanobind to v3 ⬆️🐍 Adopt nanobind 3 split-mode wheels Aug 22, 2026
@burgholzer burgholzer added c++ Anything related to C++ code continuous integration Anything related to the CI setup DD Anything related to the DD package fix Fix for something that isn't working major Major version update packaging Anything related to Python packaging QDMI Anything related to QDMI labels Aug 22, 2026
Comment thread pyproject.toml Outdated
Use scoped locks and explicitly discard released ownership pointers as required by the hosted clang-tidy configuration.

Assisted-by: GPT-5 via Codex
Keep nanobind exception RTTI visible in macOS split modules so the runtime backend can catch typed exceptions. Capture transferred DD storage pointers to satisfy the hosted unused-return check.

Assisted-by: GPT-5 via Codex
Use the same LLVM/MLIR 22.1.8 setup as pull-request wheel builds. The release workflow otherwise cannot configure MQT Core on macOS or Windows.

Assisted-by: GPT-5 via Codex
cibuildwheel 4 no longer provides Python 3.13 free-threaded builds and warns that the selector is invalid. Keep only the explicit Python 3.14t exclusion.

Assisted-by: GPT-5 via Codex
scikit-build-core leaves SKBUILD_SOABI empty for Windows stable-ABI wheels. Supply nanobind with the free-threaded interpreter ABI so it selects its abi3t path and emits a frontend tag that matches nanobind-backend.

Assisted-by: GPT-5 via Codex
cibuildwheel invokes test dependency installs through cmd.exe, which treats PEP 440 comparison operators as shell redirections. The regular Windows job runs the full test suite; wheel jobs retain repaired-wheel and backend import coverage.

Assisted-by: GPT-5 via Codex
Keep static MQT, LLVM, and MLIR symbols local while exporting the weak nanobind exception RTTI required by its x86-64 split backend. This restores exception matching without cross-extension symbol interposition.

Assisted-by: GPT-5 via Codex
@burgholzer
burgholzer marked this pull request as ready for review August 22, 2026 18:46

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed all the changes here. This should be pretty close to mergable.

Comment thread README.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread cmake/AddMQTPythonBinding.cmake Outdated
Comment thread cmake/AddMQTPythonBinding.cmake Outdated
Comment thread cmake/AddMQTPythonBinding.cmake Outdated
Comment thread cmake/AddMQTPythonBinding.cmake Outdated
Comment thread cmake/AddMQTPythonBinding.cmake Outdated
Comment thread cmake/AddMQTPythonBinding.cmake
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml
Use the split backend for every Python binding build and declare its runtime dependency unconditionally.

Restore full repaired-wheel tests for CPython 3.11 through 3.14 on Windows x64 with a shell-safe dependency install. Simplify the platform branches and release notes.

Assisted-by: GPT-5 via Codex
@mergify mergify Bot added the conflict label Aug 23, 2026
@mergify mergify Bot removed the conflict label Aug 23, 2026
@mergify mergify Bot added the conflict label Aug 23, 2026
@mergify mergify Bot removed the conflict label Aug 23, 2026

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be ready to go in now! 🙌
Should also help with CI times due to the increased caching. This should imply that the Python tests only build a single instead of three wheels, which should make them much faster.
Same for the CD jobs.

@burgholzer
burgholzer merged commit 3c699b3 into main Aug 23, 2026
30 of 31 checks passed
@burgholzer
burgholzer deleted the renovate/nanobind-3.x branch August 23, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code continuous integration Anything related to the CI setup DD Anything related to the DD package dependencies Pull requests that update a dependency file fix Fix for something that isn't working major Major version update packaging Anything related to Python packaging python Anything related to Python code QDMI Anything related to QDMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants