Skip to content

NEP 15: Merging multiarray and umath #10704

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

Merged
merged 4 commits into from
Jun 29, 2018

Conversation

njsmith
Copy link
Member

@njsmith njsmith commented Mar 8, 2018

Note to self: still need to add this to index.rst, but maybe better to
wait until after #10703 is merged.

@njsmith
Copy link
Member Author

njsmith commented Mar 8, 2018

Cycling PR to attempt to fix circleci weirdness.

@njsmith njsmith closed this Mar 8, 2018
@njsmith njsmith reopened this Mar 8, 2018
@njsmith njsmith force-pushed the nep-0015-merge-multiarray-umath branch from f01a609 to 49592ab Compare March 9, 2018 00:03
@charris
Copy link
Member

charris commented Mar 9, 2018

I'd like to just merge this, but then there is no place for discussion. What process is proposed for updating/discussing NEP proposals?

@eric-wieser
Copy link
Member

eric-wieser commented Mar 19, 2018

There's a greater evil than set_numeric_ops, which is "swap out tp_number and hope no one notices that we're not allowed to". This is done by scalarmath after scalartypes has already called PyType_Ready, which causes nb_int not to match __int__, along with every other magic numeric method (#9972).

@mdboom
Copy link
Contributor

mdboom commented Mar 21, 2018

There is a similar dichotomy with linalg.lapack_lite and linalg._umath_linalg, right?

@eric-wieser
Copy link
Member

My understanding there is that lapack_lite is simply a function-by-function substitute for a lapack installation, whereas _umath_linalg is a ufunc-ization of the lapack functions.

@pv
Copy link
Member

pv commented Mar 21, 2018 via email

have internal API that's visible to everything inside the same
extension module, or you can have a public API that everyone can use;
you can't have an API that's visible to multiple extension modules
inside numpy, but not to external users.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an argument against doing this NEP -- but there would be nothing stopping you from having two PyCapsule tables -- one for the public ABI and the other for private. Both would be technically public and some bad actors would use and come to rely on the private, but it would be easier to say 'told you so' to those folks.

``numpy/core/src/private/``, which now contains a bunch of files which
are ``#include``\d twice, once into ``multiarray`` and once into
``umath``. This is pretty gross, and is purely a workaround for these
being separate C extensions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npymath is also included in both extension modules.

@mattip
Copy link
Member

mattip commented Apr 15, 2018

#10703 has been merged, is there anything blocking this from a merge?

but we can make one or both of these modules be tiny shims that simply
re-export the magic API object from where-ever it's actually defined.
(See ``numpy/core/code_generators/generate_{numpy,ufunc}_api.py`` for
details of how these imports work.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a requirement that we still have c-extension modules named numpy.core.{umath, multiarray} or can they be pure python wrappers around the single c-extension module (call it numpy.core._multiarray)? Can't the _ARRAY_APIand _UFUNC_API be exported from the same shared object?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing prevents pure-python wrapper files iiuc.

@mattip
Copy link
Member

mattip commented Jun 25, 2018

@njsmith could you rebase this off master and fix the conflict? It would be good to have this up for the implementation in #10915

@njsmith njsmith force-pushed the nep-0015-merge-multiarray-umath branch from 4c4716e to 3ef1431 Compare June 29, 2018 21:26
@njsmith njsmith merged commit 5b672cb into numpy:master Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants