Calling Cython

I had some thoughts about wrapping SpaCy,

SpaCy is a python library for NLP.
Its 90% Cython, rather than actually being python.
So I have a bunch of .so compiled shared objects.

I am wondering if I can ccall into functions in those .sos rather than PyCalling into the package.
And if so, if it would give a performance advantage.

There is a spacy c++ wrapper, which from a quick glance wraps PyObjects. So I suspect they don’t provide a non-CPython/c-ext API (I haven’t heard of Cython projects which do so). While you could call exports from the .so objects directly, doing so would replicate PyCall with no particular advantage.

If it provides C-API (which IIRC is possiblle for cython) then yes. If there’s no C-API then no.

1 Like