Hi,

I feel strange. It seems your module strongly depends on numpy.
I don't know about cython so much. So I can't say how to resolve it.
I feel mocking is not good for your case.

Thanks,
Takeshi KOMIYA

2018-02-26 5:06 GMT+09:00  <[email protected]>:
> 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?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to