Skip to content

DOC update C-API docs #26019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
adrinjalali opened this issue Mar 14, 2024 · 2 comments
Open

DOC update C-API docs #26019

adrinjalali opened this issue Mar 14, 2024 · 2 comments

Comments

@adrinjalali
Copy link
Contributor

Do C-API docs need an update? For instance, dev/internals.code-explanations.rst
mentions PyArray_Descr->f, but looking at the implementation in ndarraytypes.h
I don't see an f attribute.

Also, the first "Iteration example" under c-api/iterator.rst uses code which
to me it seems not valid anymore:

    PyArray_NonzeroFunc* nonzero = PyArray_DESCR(self)->f->nonzero;

and if I'm not mistaken, the modern way to do this is:

    PyArray_NonzeroFunc* nonzero = PyDataType_GetArrFuncs(PyArray_DESCR(self))->nonzero;

But I also didn't manage to make g++ happy even after a #include "numpy/npy_2_compat.h", so I'm probably missing something.

I'm not sure where else these instances occur, still trying to wrap my head around
the C-API.

Also, it would be really nice if we could have info on which includes are necessary
for which part of the docs, and maybe some basic minimal examples which can be
compiled on their own. Another nice thing to have would be to have examples to deal
with the actual values stored in the arrays instead of always using functions
attached to PyArray_Descr.

This is all in the context of #26018

@ngoldbaum
Copy link
Member

Yes, the C API docs and docs in general need a major overhaul after all the numpy 2.0 changes. We should really plan a sprint day or something like that to make sure some eyes go over the docs carefully before the final release.

@ngoldbaum
Copy link
Member

Although that said, some of the documentation should probably be rewritten from scratch. All the stuff that talks about numpy.distutils, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants