There's also Cython.
I would guess also that HPy would replace the includes of `Python.h` that pybind11 et al make in order to bind to CPython, and so existing extensions should be easier to port?
PyO3 is bindings to the C API, so if you're using PyO3 you're still using the C API even if you're not actually writing C.
Re:HPy – A better C API for Python
by rich_sasha on Sunday October 06, 2024 @06:08AM
(#41756087)
Yeah, sure, I mean, how many people write C to write an end-user Python module. There's stuff that genuinely wraps C libraries or predates higher level language wrappers, like numpy or matplotlib, but how many new modules are actually themselves written in C?
The point is that’s not relevant, the issue is the API / ABI of the modules, its requirements, and its limitations, not the langage in which the modules are written.
for C++ 11+, pybind11 > Boost.Python
for C++ 17+, nanobind > pybind11 (both created by the same developer)
">" meaning generally better, as described at https://nanobind.readthedocs.io/en/latest/why.html
Re:HPy – A better C API for Python
by physicsguy on Sunday October 06, 2024 @06:43AM
(#41756213)
Quite a lot, for things like simulation code
Less so for general programming.
How many new extensions are written in C these days? I was under the impression it's mostly things like Boost Python, pybind or PyO3.