I have some trouble to document my Cython (python 2.7) module with Sphinx (1.7).
I set the Cython directive embedsignature
to True, and I also mock numpy
in my conf.py file. However, if I run sphinx-build -b html source build
I get the following TypeError:
WARNING: autodoc: failed to import module u'isolver'; the following exception was raised:
Traceback (most recent call last):
File "C:\Users\xxx\Anaconda2\lib\site-packages\sphinx\ext\autodoc\importer.py", line 140, in import_module
__import__(modname)
File "c:\users\xxx\dropbox\github\isolver\isolver\__init__.py", line 1, in <module>
import core
File "c:\users\xxx\dropbox\github\isolver\isolver\core\__init__.py", line 1, in <module>
import c_trf
File "__init__.pxd", line 155, in init isolver.core.c_trf
TypeError: numpy.dtype is not a type object
The weird thing is I do not have a *.pxd file and line 155 in c_trf.pyx
file is empty.
Perhaps the secret of this error lies in the way how I declared the numpy data types?
cimport numpy as np
import numpy as np
DTYPE_int = np.int64
ctypedef np.int64_t DTYPE_int_t
DTYPE_float = np.float64
ctypedef np.float64_t DTYPE_float_t
Or maybe the declarations of some functions with cdef np.ndarray fun(x):...
are wrong?