Skip to content
This repository

export multiarray_api to numpy.core.multiarray #2997

Open
stevengj opened this Issue · 3 comments

2 participants

Steven G. Johnson Charles Harris
Steven G. Johnson

As recently discussed on the mailing list, NumPy's API is unnecessarily tricky to link from a non-C language because the numpy.core.multiarray._ARRAY_API lookup table of API pointers (PyArray_API in C) has a meaning that can only be determined by parsing the __multiarray_api.h header file.

A simple improvement would be to export an _ARRAY_API_NAMES variable (or similar) as well in Python, a simple list of strings corresponding to the symbols (PyArray_GetNDArrayCVersion etc.) pointed to by the ARRAY_API/PyArray_API array. This should hopefully be a straightforward modification to generate_numpy_api.py and related files. Or even just export the variables in the numpy/core/code_generators/numpy_api.py file.

Charles Harris
Owner

@mwiebe I also suggest dynd as something you might want to take a look at.

Steven G. Johnson

Using a C++ library like DynD misses the point here: I am calling NumPy from a language that is not C or C++, without using C or C++ glue code. In order to use DynD I would need C++ glue code, whereas I want to do it purely from a high-level language (Julia, in my case). Currently that requires one to parse the .h file manually and to use undocumented NumPy internals.

Charles Harris
Owner

We can do this. @stevengj Patches welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.