Closed
Description
xref gh-14778
This is an issue I noticed following the series of tickets on the random c-api usability. Quoting from the docs on Cython API:
Typed versions of many of the Generator and BitGenerator methods as well as the classes themselves can be accessed directly from Cython via
cimport numpy.random
I could verify cimport-ing BitGenerator in Cython, but on the Generator defined in numpy/random/_generator.pyx
, it seems that it is not exposed which could be nice if we declare it in random/__init__.pxd
.
Reproducing code example:
%%cython
from numpy.random cimport BitGenerator
from numpy.random cimport Generator
Error message:
Error compiling Cython file:
------------------------------------------------------------
...
from numpy.random cimport BitGenerator
from numpy.random cimport Generator
^
------------------------------------------------------------
/tmp/.ipython/cython/_cython_magic_31304ad03a3c08886c6fdc45ff9df750.pyx:2:0: 'numpy/random/Generator.pxd' not found
Numpy/Python version information:
1.18.1 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 15:01:53)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]