Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: reduce warnings when building, and rephrase slightly #13002

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 3 commits into from
Feb 28, 2019

Conversation

mattip
Copy link
Member

@mattip mattip commented Feb 20, 2019

Reduces the number of warnings to around 50, still a WIP to see if I can get it down further. 15.


.. automethod:: numpy.core._internal._ctypes.strides_as
:noindex:
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding :noindex: removed many warnings caused by manually documenting the attributes instead of autosummary documenting them. The pages render the same in html. Search still works, you get this when searching for _ctypes.data vs. this currently.

@@ -5148,7 +5154,7 @@
out : ndarray, None, or tuple of ndarray and None, optional
A location into which the result is stored. If not provided or `None`,
a freshly-allocated array is returned. For consistency with
:ref:`ufunc.__call__`, if given as a keyword, this may be wrapped in a
``ufunc.__call__``, if given as a keyword, this may be wrapped in a
Copy link
Member Author

Choose a reason for hiding this comment

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

ufunc.__call__ has no docstring. Should it?

Copy link
Member

Choose a reason for hiding this comment

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

I think __call__ is always an implementation detail, whatever it does must be described elsewhere (e.g. in the main docstring of the object).

axis : int, optional
The axis in the result array along which the input arrays are stacked.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding these lines quieted a warning "Block quote ends without a blank line; unexpected unindent." but I don't really understand why

Copy link
Member

Choose a reason for hiding this comment

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

yeah that doesn't make a lot of sense; probably a numpydoc or sphinx bug

@charris
Copy link
Member

charris commented Feb 21, 2019

@mattip How did you set the Draft flag, or is that something new from github?

EDIT: Unresolved conversations perhaps?

@seberg
Copy link
Member

seberg commented Feb 21, 2019

@charris it shows up as a choice when you open a PR, not sure since when that exists. Seems like a nice thing, although I cannot see any method of setting it later (and I guess only the person who opened it can unset it).

@mattip
Copy link
Member Author

mattip commented Feb 24, 2019

This brings doc building down to 14 warnings, caused by two problems

  • there are Unexpected section title warnings caused by examples in class attributes being rendered in the class page, causing multiple Examples sections.
  • I would like to leave the duplicate documentation of some of the C-API (DOC: array creation API is defined twice in docs #13013) for another contributor to work on as a starter issue.

/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/__init__.py:docstring of numpy.broadcast:65: WARNING: Unexpected section title.

Examples
--------
/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/__init__.py:docstring of numpy.broadcast:78: WARNING: Unexpected section title.

Examples
--------
/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/__init__.py:docstring of numpy.broadcast:89: WARNING: Unexpected section title.

Examples
--------
/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/__init__.py:docstring of numpy.dtype:117: WARNING: Unexpected section title.

Examples
--------
/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/__init__.py:docstring of numpy.flatiter:59: WARNING: Unexpected section title.

Examples
--------
/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/__init__.py:docstring of numpy.flatiter:72: WARNING: Unexpected section title.

Examples
--------
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:365: WARNING: duplicate C object description of PyArray_FROM_OTF, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:449: WARNING: duplicate C object description of NPY_ARRAY_IN_ARRAY, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:467: WARNING: duplicate C object description of NPY_ARRAY_INOUT_ARRAY, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:490: WARNING: duplicate C object description of NPY_ARRAY_FORCECAST, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:495: WARNING: duplicate C object description of NPY_ARRAY_ENSURECOPY, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:499: WARNING: duplicate C object description of NPY_ARRAY_ENSUREARRAY, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:526: WARNING: duplicate C object description of PyArray_SimpleNew, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst
/home/circleci/repo/doc/source/user/c-info.how-to-extend.rst:538: WARNING: duplicate C object description of PyArray_SimpleNewFromData, other instance in /home/circleci/repo/doc/source/reference/c-api.array.rst

@mattip
Copy link
Member Author

mattip commented Feb 24, 2019

We are still using sphinx 1.7.9 since sphinx 1.8 breaks our template (search stops working) #12044

@mattip
Copy link
Member Author

mattip commented Feb 24, 2019

Why does only macOS fail with Unknown interpreted text role "attr".:: in python runtests.py -g --refguide-check? It is a valid role

Edit: fixed in bad8274

@mattip mattip marked this pull request as ready for review February 24, 2019 08:20
@mattip
Copy link
Member Author

mattip commented Feb 24, 2019

In the broadcast autosummary, nd, ndim, numiter attributes are documented in-place, while sub-pages are generated for index, iters, shape and size. This is strange and causing poor formatting, all the internal sections in nd, ndim, numiter are mangled.

Edit: with that, I would like to get this in before someone commits a PR that will require rebasing

@@ -416,6 +433,12 @@
Universal function. A fast element-wise array operation. Examples include
``add``, ``sin`` and ``logical_or``.

vectorized
Copy link
Member

Choose a reason for hiding this comment

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

nit: vectorization, then use :term:`vectorized<vectorization>` above. Fine to leave to a follow-up

Copy link
Member Author

Choose a reason for hiding this comment

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

adopted, but also expanded the content a bit.

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

One remaining nit, otherwise looks great. Will leave for a second pair of eyes to merge

@mattip
Copy link
Member Author

mattip commented Feb 27, 2019

The last commit drifted into the area of content modification since I needed some headings for a reference. If it is too much I can remove it.

@mattip
Copy link
Member Author

mattip commented Feb 28, 2019

Rebased, squashed most of the commits (except the last two about vectorization, which maybe go too much toward editing new text).

@mattip
Copy link
Member Author

mattip commented Feb 28, 2019

CircleCI now makes devdocs with no WARNINGS (there are a few glitches still, but sphinx-build does not count them).

@rgommers
Copy link
Member

Awesome!

I think we need a change to keep things permanently warning-free right? -WT --keep-going in doc/Makefile and something like -halt-on-error in .circleci/config.yml as SciPy does

https://github.com/scipy/scipy/blob/master/.circleci/config.yml#L41
https://github.com/scipy/scipy/blob/master/doc/Makefile#L110

@mattip
Copy link
Member Author

mattip commented Feb 28, 2019

Yes, I would prefer to do that in a separate PR in case it gets bogged down in the details

@rgommers rgommers merged commit c4a840e into numpy:master Feb 28, 2019
@rgommers
Copy link
Member

LGTM too, merged. Thanks @mattip, and thanks @eric-wieser for reviewing!

This is pretty awesome - for years we've oscillated between 100 and 800 warnings, now we can actually stay at zero.

@rgommers rgommers added this to the 1.17.0 release milestone Feb 28, 2019
to code in whichever paradigm they prefer.
to code in whichever paradigm they prefer. This flexibility has allowed the
NumPy array dialect and NumPy `ndarray` class to become the *de-facto* language
of mulit-dimensional data interchange used in Python.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: mulit

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, will fix in #13063

@mattip mattip deleted the doc-warnings2 branch May 20, 2019 13:44
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