(no title)
bippingchip | 2 years ago
Having used swig to create Python bindings for C++ code over 10 years ago, what’s the recommended way to do this in 2023? There’s still swig, there’s Cython, pybind11 and a few others. I do know swig and how complicated it can get with footguns abound when things grow more complex.
Is Cython the way to go? How does it hold up to the alternatives? Google search gives many articles on the topic, but many typical SEO optimized low-value, and those that do show a bit of depth, focus on the basic mechanics, not really on things hold up for larger projects…
gjulianm|2 years ago
bippingchip|2 years ago
gyrovagueGeist|2 years ago
If you just want the ability to provide a Python interface to a C/Cpp library PyBind11 will get you there in fewer LoC than Cython. Nanobind is an even lighter weight option.
I’ve heard Swig is a pain to use.
bippingchip|2 years ago
dagw|2 years ago
bippingchip|2 years ago
plonk|2 years ago
From the user POV, the best bindings I’ve seen were wrappers with a Python API that calls C++ using Cython.