cimport
is for C/C++ APIs (functions, structs, classes) and reads from .pxd
files, which are the Cython counterpart to C/C++ headers. If you don't have a .pxd
for the foo
library at compile-time, you cannot cimport
from it. Python extension modules (.pyd
on Windows, .so
on Linux) typically don't have C APIs at all: they only contain externally visible symbols that allow the Python module importer to recognize their contents as a Python module.
Also, if you want to get a Python class (even one implemented as an extension type) from a module, you need to import
it. I don't think a cdef class
is allowed to inherit from such a class, though.