[Numpy-discussion] how to get data out of an object array in pyrex?

Pearu Peterson pearu at scipy.org
Tue Feb 7 03:55:05 EST 2006

On Mon, 6 Feb 2006, Andrew Straw wrote:

> I've significantly updated the page at 
> http://scipy.org/Wiki/Cookbook/Pyrex_and_NumPy

FYI, numpy.distutils now supports building pyrex extension modules. See 
numpy/distutils/tests/pyrex_ext/ for a working example. In case of 
Cookbook/Pyrex_and_NumPy, the corresponding setup.py file is:

#!/usr/bin/env python
def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
     config = Configuration('mypackage',parent_package,top_path)

     config.add_extension('pyrex_and_numpy', sources = ['test.pyx'],
                          depends = ['c_python.pxd','c_numpy.pxd'])
     return config

if __name__ == "__main__":
     from numpy.distutils.core import setup

And to build the package inplace, use

   python setup.py build_src build_ext --inplace


More information about the NumPy-Discussion mailing list