InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

Investigate migration from SWIG to nanobind

Open
#4,123 1 comment 0 reactions 0 assignees View on GitHub
type:Enhancement
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

### Description

Investigate migration from SWIG for Native Python to [nanobind](https://github.com/wjakob/nanobind).

From its documentation:

> More concretely, benchmarks show up to ~4× faster compile time, ~5× smaller binaries, and ~10× lower runtime overheads compared to pybind11. nanobind also outperforms Cython in important metrics (3-12× binary size reduction, 1.6-4× compilation time reduction, similar runtime performance).

Compile time, binary size, and runtime overhead are all very important issues for ITK. And, SWIG, the current wrapper, is likely worse than pybind11 and Cython already in these regards.

Also, nanobind has good support for scikit-build and Python 3 stable ABI -- we will be able to easily support as many platforms as possible while only needing to create 1 wheel per platform versus individual wheels per Python version.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.