However if one is using C++/Rust anyways, then it's a good idea to stay away from Cython.
From afar, Cython seems like a viable solution for Python/C++ interop. But the details get messy: you need to clone the .h headers into .pxd Cython-readable headers; and more advanced template-magic C++ constructs may end up being not directly usable in Cython due to missing features or bugs in the C++ support.
In the end, we ended up with quite a number of layers wrapping each other:
1. actual C++ implementation
2. actual C++ header
3. C++ wrapper implementation, avoiding constructs that Cython doesn't support
4. C++ wrapper header
5. Cython .pxd for step 4
6. Cython .pyx exposing `cdef class`es to Python with a nice Python-style API for the original C++ library.
7. Hand-written .pyi for type checking the remaining Python code, because Cython doesn't have support for auto-generating these yet.
Had we used pybind11 / nanobind instead, we could have stopped at step 3. Cython started easy, but ended up being a major maintenance burden.
claytonjy|2 years ago
ynik|2 years ago
In the end, we ended up with quite a number of layers wrapping each other:
Had we used pybind11 / nanobind instead, we could have stopped at step 3. Cython started easy, but ended up being a major maintenance burden.nurettin|2 years ago
unknown|2 years ago
[deleted]