On Fri, 2 Sep 2016 02:16:35 -0700
Nathaniel Smith
Depending on how minimal and universal you want to keep things, I use the ctypes approach quite often, i.e. treat your numpy inputs an outputs as arrays of doubles etc using the ndpointer(...) syntax. I find it works well if you have a small number of well-defined functions (not too many options) which are numerically very heavy. With this approach I usually wrap each method in python to check the inputs for contiguity, pass in the sizes etc. and allocate the numpy array for the result.
FWIW, the broader Python community seems to have largely deprecated ctypes in favor of cffi.
I'm not sure about "largely deprecated". For sure, that's the notion spreaded by a number of people. Regards Antoine.