Skip to content

MAINT: Python API cleanup nitpicks #24959

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 1 commit into from
Oct 20, 2023

Conversation

mtsokol
Copy link
Member

@mtsokol mtsokol commented Oct 19, 2023

This PR contains last cleanup changes for #23999.
Currently it consists of:

  • numpy.core import sort,
  • making np.lib.arrayterator private,
  • new definition of np.lib.__all__.

Copy link
Member

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

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

Overall looks good, just one comment about np.lib.emath.

from ._version import *
from .introspect import *
from numpy._core._multiarray_umath import add_docstring, tracemalloc_domain
from numpy._core.function_base import add_newdoc

__all__ = ['emath']
Copy link
Member

Choose a reason for hiding this comment

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

Searching on github I don't find any usages of np.lib.emath. Still, It's been here for a long time and we're still publicly exposing np.emath, so it would be nice to generate a nicer AttributeError with a migration in the __getattr__ for the module.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! I added a proper error message for np.lib.emath.

@mtsokol mtsokol force-pushed the python-api-cleanup-nitpicks branch from 7112699 to 9df0469 Compare October 20, 2023 08:50
@mtsokol mtsokol force-pushed the python-api-cleanup-nitpicks branch from 9df0469 to 4c0bc26 Compare October 20, 2023 08:54
@rgommers rgommers added this to the 2.0.0 release milestone Oct 20, 2023
@ngoldbaum
Copy link
Member

Thanks @mtsokol!

@ngoldbaum ngoldbaum merged commit d034f16 into numpy:main Oct 20, 2023
@mtsokol mtsokol deleted the python-api-cleanup-nitpicks branch October 20, 2023 14:03
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.

3 participants