-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
DOC: Document/ Deprecate functions exposed in "numpy" namespace #13222
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
Conversation
Please remove from your checklist items that already appear in #13214. |
xref #9312 which began documenting |
I have added the warning messages for the function |
@kritisingh1 |
@seberg yeah I was using |
the interesting part will be determining what its docstring should be so we can put a deprecation notice in it. The docstring should be added to
Play with the function a bit, read the C code, and ask here or on the mailing list if you have a hard time coming up with some text |
@@ -2235,13 +2237,18 @@ def ndfromtxt(fname, **kwargs): | |||
|
|||
""" | |||
kwargs['usemask'] = False | |||
warnings.warn( | |||
"np.ndfromtxt is deprecated", | |||
DeprecationWarning, stacklevel=2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a comment above the warning with the date, version, gh-issue format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also recommend a replacement, perhaps `ndfromtxt` is a deprecated alias of `genfromtxt`, prefer the latter
Please update the checklist at the top of the PR with the additional items, and mark off the ones that are modified in the PR |
@mattip I'm figuring out what text to add to the |
Look at the |
You should be running at least the basic tests locally, so you can avoid too much CI churn |
@mattip the tests are failing despite adding the |
You should add a test to
It is hard to tell without seeing your changes. Note |
@@ -1136,7 +1139,6 @@ def safe_eval(source): | |||
""" | |||
# Local import to speed up numpy's import time. | |||
import ast | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can put this deprecation back, but have to replace all use-cases with the ast.literal_eval(source)
call that this does. Maybe the DeprecationWarning should mention to use ast.literal_eval
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seberg , can I try deprecating self_eval
in a different pull request altogether, if that is alright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes of course, but should probably remove the documentation change as well for now then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
numpy/lib/npyio.py
Outdated
@@ -2225,6 +2225,9 @@ def ndfromtxt(fname, **kwargs): | |||
""" | |||
Load ASCII data stored in a file and return it as a single array. | |||
|
|||
.. deprecated:: 1.17 | |||
np.ndfromtxt is deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, mention the replacement here, possibly with a few more words than in the DeprecationWarning
.
`ndfromtxt` is a deprecated alias of `genfromtxt` which overwrites the ``usemask`` argument
with `False` even when explicitly called as ``ndfromtxt(..., usemask=True)``. Use `genfromtxt` instead.
Thanks @kritisingh1 |
Related to #12385
The checklist for future work on this PR is as follows:
Deprecate -
@rgommers Please review and let me know the required changes. Thanks a lot!