-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Finish setting the right __module__ for NumPy's public API #12271
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
Comments
shoyer
added a commit
to shoyer/numpy
that referenced
this issue
Nov 14, 2018
Fixes numpyGH-12271 Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to ``'numpy'``, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed. I also identified a handful of functions for which I had accidentally not setup dispatch for with ``__array_function__`` before, because they were listed under "ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in trusting code comments :).
liwt31
pushed a commit
to liwt31/numpy
that referenced
this issue
Nov 19, 2018
Fixes numpyGH-12271 Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to ``'numpy'``, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed. I also identified a handful of functions for which I had accidentally not setup dispatch for with ``__array_function__`` before, because they were listed under "ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in trusting code comments :).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A nice bonus of #12251 is that we now set
__module__
on functions decorated witharray_function_dispatch
to NumPy's preferred public API.This means that IPython (but not Python's built-in
repr()
now displays a better summary for NumPy fucntions:<function 'numpy.sum'>
vs the current<function 'numpy.core.fromnumeric.sum'>
.This is s a nice subtle way to encourage people not to dive into NumPy's internals.
It would be nice to finish this for the rest of NumPy's public API. Here's a little function I wrote to do these checks:
and the current output for
check_module(numpy)
(with the changes from #12270 included):The text was updated successfully, but these errors were encountered: