Skip to content

NEP 15: Merging multiarray and umath - #10704

Merged
njsmith merged 4 commits into
numpy:masterfrom
njsmith:nep-0015-merge-multiarray-umath
Jun 29, 2018
Merged

njsmith merged 4 commits into
numpy:masterfrom
njsmith:nep-0015-merge-multiarray-umath

Conversation

@njsmith

@njsmith njsmith commented Mar 8, 2018

Copy link
Copy Markdown
Member

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

@njsmith

njsmith commented Mar 8, 2018

Copy link
Copy Markdown
Member Author

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

charris commented Mar 9, 2018

Copy link
Copy Markdown
Member

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

eric-wieser commented Mar 19, 2018 •

Copy link
Copy Markdown
Member

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

mdboom commented Mar 21, 2018

Copy link
Copy Markdown
Contributor

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

@eric-wieser

Copy link
Copy Markdown
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

pv commented Mar 21, 2018 via email

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

mattip commented Apr 15, 2018

Copy link
Copy Markdown
Member

#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
Copy Markdown
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
Copy Markdown
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

mattip commented Jun 25, 2018

Copy link
Copy Markdown
Member

@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