Skip to content

DOC: Generator is documented as part of the random c-api, but is missing #16597

Closed
@madarez

Description

@madarez

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)]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions