Skip to content
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

MAINT: update numpydoc to v1.1.0 #13326

Merged
merged 2 commits into from
Jan 4, 2021
Merged

Conversation

rgommers
Copy link
Member

@rgommers rgommers commented Jan 1, 2021

The main issue was annoying to track down. These are new warnings that showed up due to a change in numpydoc:

/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.clear:: WARNING: py:class reference target not found: None.  Remove all items from D.                                                                                                 
/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.copy:: WARNING: py:class reference target not found: a shallow copy of D                                                                                                              
/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.items:: WARNING: py:class reference target not found: a set-like object providing a view on D's items                                                                                 
/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.keys:: WARNING: py:class reference target not found: a set-like object providing a view on D's keys                                                                                   
/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.pop:: WARNING: py:class reference target not found: v, remove specified key and return the corresponding value.                                                                       
/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.popitem:: WARNING: py:class reference target not found: (k, v), remove and return some (key, value) pair as a                                                                         
/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.update:: WARNING: py:class reference target not found: None.  Update D from dict/iterable E and F.                                                                                    
/home/rgommers/code/scipy/scipy/optimize/__init__.py:docstring of scipy.optimize.OptimizeResult.values:: WARNING: py:class reference target not found: an object providing a view on D's values                                                                                       
/home/rgommers/code/scipy/scipy/sparse/__init__.py:docstring of scipy.sparse.dok_matrix.clear:: WARNING: py:class reference target not found: None.  Remove all items from D.                                                                                                         
/home/rgommers/code/scipy/scipy/sparse/__init__.py:docstring of scipy.sparse.dok_matrix.items:: WARNING: py:class reference target not found: a set-like object providing a view on D's items                                                                                         
/home/rgommers/code/scipy/scipy/sparse/__init__.py:docstring of scipy.sparse.dok_matrix.keys:: WARNING: py:class reference target not found: a set-like object providing a view on D's keys                                                                                           
/home/rgommers/code/scipy/scipy/sparse/__init__.py:docstring of scipy.sparse.dok_matrix.pop:: WARNING: py:class reference target not found: v, remove specified key and return the corresponding value.                                                                               
/home/rgommers/code/scipy/scipy/sparse/__init__.py:docstring of scipy.sparse.dok_matrix.popitem:: WARNING: py:class reference target not found: (k, v), remove and return some (key, value) pair as a                                                                                 
/home/rgommers/code/scipy/scipy/sparse/dok.py:docstring of scipy.sparse.dok.dok_matrix.update:: WARNING: py:class reference target not found: None.  Update D from dict/iterable E and F.                                                                                             
/home/rgommers/code/scipy/scipy/sparse/__init__.py:docstring of scipy.sparse.dok_matrix.values:: WARNING: py:class reference target not found: an object providing a view on D's values

The root cause is that dict methods don't have proper html docs that can be found via intersphinx (see https://bugs.python.org/issue11975). That is fixed by ignoring reference issues for builtins in Sphinx, see sphinx-doc/sphinx#7254.

It's not clear to me if the warnings appearing now is a regression in numpydoc, or a correct fix that made the issue show up. The two candidate changes in numpydoc that touched this behaviour are:

I couldn't upgrade to numpydoc latest master due to another issue, but that's for another time.

@rgommers rgommers added Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org maintenance Items related to regular maintenance tasks labels Jan 1, 2021
@rgommers rgommers requested a review from larsoner January 1, 2021 19:21
@rgommers
Copy link
Member Author

rgommers commented Jan 1, 2021

Here's the change in the page generated for one of those methods:

image

Compare with: http://scipy.github.io/devdocs/generated/scipy.optimize.OptimizeResult.keys.html

EDIT: which is because of:

>>> dict.keys.__doc__
"D.keys() -> a set-like object providing a view on D's keys"

This is with Sphinx 3.4.1

@larsoner
Copy link
Member

larsoner commented Jan 4, 2021

This is the fix I also implemented elsewhere and it has worked well for the ~6 months I've used it, so in this goes. Thanks @rgommers !

@larsoner larsoner merged commit 83a8a27 into scipy:master Jan 4, 2021
@rgommers rgommers deleted the update-numpydoc branch January 4, 2021 13:32
@rgommers rgommers added this to the 1.7.0 milestone Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org maintenance Items related to regular maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants