-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
DOC: fix remaining doc files for refguide_check #15720
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
The external_loop prevent the iterations to go over items, which is not the intended effect in the document.
This is likely a temporary measure to enable continuous integration testing of the docs.
This is likely a temporary measure to enable continuous integration testing of the docs.
Fix whitespace issues. Fix formatting for current NumPy version.
Rather than skipping the f2py tests we could theoretically try to execute them:
but this does not work. The doctests are executed in a temporary directory, and have no access to the |
I noticed as well. Running |
I am OK with skipping all the f2py compilation doctests for now then. |
@@ -28,7 +28,7 @@ using the standard Python iterator interface. | |||
>>> for x in np.nditer(a): | |||
... print(x, end=' ') | |||
... | |||
0 1 2 3 4 5 | |||
0 1 2 3 4 5 |
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.
extra space at the end of the line
Other than some extra spaces at the end of lines, this looks good to me. |
Hi @mattip thank you for the feedback. There might be an issue with the end-of-line marker on github. I did put the extra spaces. Did you check with a local copy? |
We don't really like extra spaces on the end of lines and refguide-check does not require them, so it would be better to remove them. |
I used pytest to check the spacing of all tests, and the end-of-line space was required here. If we do move to pytest ultimately, those will be required. Let me know if I should remove them despite this perspective. |
Isn't there a way to skip all the f2py doctests using the SKIPLIST in refguide-check? Also - please remove the spaces at the end of the lines. |
I agree, a bit of context:
This (skiplist) is how it also works in SciPy, and it's nicer because
Rationale: someone else's editor will strip these spaces again. We should just fix the printing behavior if needed (it doesn't really seem needed now). |
changes done, I tested locally and wait for the CI checks. Some SKIP remain in arrays.nditer.rst as a small part of that file only relies on a compiled extension. Some examples there also use timeit which is not valid outside of IPython/jupyter |
@mattip I have addressed the review items. |
tools/refguide_check.py
Outdated
@@ -119,6 +119,8 @@ | |||
'doc/release', | |||
'doc/source/release', | |||
'c-info.ufunc-tutorial.rst', | |||
'c-info.python-as-glue.rst', | |||
'getting-started.rst', |
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 got scared for a second, until I realized that gettting-started.rst
is not the general beginner guide, rather the one inside the f2py
directory. Could you rename the file to f2py.getting-started.rst
or something that would prevent a future conflict with a getting-started.rst
file for another task?
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.
Sure. Here, as a contributor I hesitated to rename a file.
100 loops, best of 3: 11.8 ms per loop | ||
|
||
>>> np.all(sum_squares_cy(a, axis=-1) == np.sum(a*a, axis=-1)) | ||
>>> np.all(sum_squares_cy(a, axis=-1) == np.sum(a*a, axis=-1)) # doctest: +SKIP |
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.
All these skips are annoying. Would it work to
- split the file in two, move all the cython code to
arrays.nditer.cython.rst
- add
arrays.nditer.cython.rst
to the skiplist - use an
.. include:: arrays.nditer.cython.rst
so that sphinx will render the documents as before - add
.. for doctests
comments just before the include and at the top of the new file to explain why this was done
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.
Tentative update pushed
Place the Cython-dependent section in separate file. Ignore the new file from the doctests with an RST_SKIPLIST entry in refguide_check.py
Looks good now thanks. At some point we should refactor the redundant parts of |
Thanks @pdebuyl |
Related to #14970
Fix remaining files for refguide_check.
Notes:
With this PR,
python tools/refguide_check.py --rst
outputsand the sphinx build proceeds without warning (apart from a minor data clipping warning for imshow).
After merging, the NumPy project should consider testing via pytest and suitable plugins, including astropy's pytest-doctestplus, see #15703 (comment) and migrating the doc accordingly.
I test pytest on the files I edited and most errors stemmed from whitespace issues or specific usages (matplotlib functions return a repr for the figure object, those are not included in the current docs).