sphinx-build emits a ton of errors that need to be polished out:
https://readthedocs.org/projects/xray/builds/ -> latest -> open last step
Options for the long term:
I am honestly not excited by either of the above. Alternative suggestions are welcome.
Is there a sphinx or restructured text linter that we can run? e.g. https://github.com/PyCQA/doc8
Do these matter?
Do we know of examples of bad outcomes (e.g. hard-to-read docs)?
Yes. For example
http://xarray.pydata.org/en/stable/generated/xarray.Dataset.integrate.html#xarray.Dataset.integrate
The sphinx log states:
/home/docs/checkouts/readthedocs.org/user_builds/xray/conda/latest/lib/python3.7/site-packages/xarray-0.14.0+37.g96cc2bc6-py3.7.egg/xarray/core/dataset.py:docstring of xarray.Dataset.integrate:12: WARNING: Unexpected indentation.
What I just now noticed is that several docstrings may be imported from numpy - which complicates everything.
The sphinx log states:
/home/docs/checkouts/readthedocs.org/user_builds/xray/conda/latest/lib/python3.7/site-packages/xarray-0.14.0+37.g96cc2bc6-py3.7.egg/xarray/core/dataset.py:docstring of xarray.Dataset.integrate:12: WARNING: Unexpected indentation.
That's a good case...
I ran https://github.com/myint/docformatter on our code docformatter --in-place -r --wrap-summaries=88 .; results here
But it doesn't solve many of our issues, which are around the sphinx docstrings
Happy to do a PR, but worry it's more churn than help?
Is there a sphinx or restructured text linter that we can run? e.g. https://github.com/PyCQA/doc8
Looks reasonable; though this is a checker rather than fixer
most of the nitpicky errors are raised because numpydoc tries to link to parameter types. We can define aliases and ignore terms like instance or words like of, see
for an example. We can also ignore nitpicky warnings using nitpick_ignore, but the normal warnings can't be selectively ignored (suppress_warnings ignores warning categories).
looks like I was wrong, numpydoc does not have much to do with this. The real culprit is napoleon: see sphinx-doc/sphinx#6861
this is not yet fully fixed, we still need to silence the nitpick warnings. That is blocked by the napoleon bug, though.
@keewis I'm guessing we're still stuck on this because of the Napoleon bug?
Your efforts to quash the previous warnings are laudable, and would be great if we can add tests to ensure they don't creep back in...
Every time I see activity on this... I feel like it's all my fault. Feel free to undo whatever is needed.
most warnings are due to the bug, yes. The others are broken references to accessor methods like Dataset.plot.scatter (see #3625). Last time I checked we did not have new warnings unrelated to the bug, but my grep regexp might have missed a few lines.
We could do something to make sure we don't introduce more warnings, though: the nitpicky mode allows ignoring warnings using nitpick_ignore, so we might be able to ignore every nitpicky warning related to docstrings / napoleon. We still would need to fix or bypass #3625 first, though.
I've been working on a type preprocessor for napoleon (sphinx-doc/sphinx#7690) which is pretty close (to be included in sphinx v3.2.0). Hopefully that will silence all those warnings and also fix most of the broken type links.
Edit: the PR has been merged, so now we only have to wait until the next release of sphinx. That feature is pretty strict about the format of the type spec, so I'll create a PR to update our docstrings.