Skip to content

Commit 00161d6

Browse files
committed
Merge branch 'master' into bold
2 parents d38b078 + 21a194e commit 00161d6

File tree

5 files changed

+35
-22
lines changed

5 files changed

+35
-22
lines changed

README.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
numpydoc -- Numpy's Sphinx extensions
1212
=====================================
1313

14-
Numpy's documentation uses several custom extensions to Sphinx. These
15-
are shipped in this ``numpydoc`` package, in case you want to make use
16-
of them in third-party projects.
14+
This package provides the ``numpydoc`` Sphinx extension for handling
15+
docstrings formatted according to the `NumPy documentation format
16+
<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`__.
17+
The extension also adds the code description directives
18+
``np:function``, ``np-c:function``, etc.
1719

18-
The ``numpydoc`` extension provides support for the Numpy docstring format in
19-
Sphinx, and adds the code description directives ``np:function``,
20-
``np-c:function``, etc. that support the Numpy docstring syntax.
20+
For usage information, please refer to the `documentation
21+
<https://numpydoc.readthedocs.io/>`_.
2122

22-
See `numpydoc docstring guide <https://numpydoc.readthedocs.io/en/latest/format.html>`_
23-
for how to write docs that use this extension, and the `user guide <https://numpydoc.readthedocs.io>`_
24-
25-
Numpydoc inserts a hook into Sphinx's autodoc that converts docstrings
26-
following the Numpy/Scipy format to a form palatable to Sphinx.
23+
The `numpydoc docstring guide
24+
<https://numpydoc.readthedocs.io/en/latest/format.html>`_ explains how
25+
to write docs formatted for this extension, and the `user guide
26+
<https://numpydoc.readthedocs.io>`_ explains how to use it with Sphinx.

doc/install.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ The extension is available from:
99
* `numpydoc on GitHub <https://github.com/numpy/numpydoc/>`_
1010

1111
'numpydoc' should be added to the ``extensions`` option in your Sphinx
12-
``conf.py``.
13-
12+
``conf.py``. (Note that `sphinx.ext.autosummary` will automatically be loaded
13+
as well.)
1414

1515
Sphinx config options
1616
=====================
@@ -38,7 +38,7 @@ numpydoc_citation_re : str
3838
should be mangled to avoid conflicts due to
3939
duplication across the documentation. Defaults
4040
to ``[\w-]+``.
41-
numpydoc_use_blockqutoes : bool
41+
numpydoc_use_blockquotes : bool
4242
Until version 0.8, parameter definitions were shown as blockquotes, rather
4343
than in a definition list. If your styling requires blockquotes, switch
4444
this config option to True. This option will be removed in version 0.10.

numpydoc/docscrape_sphinx.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ def _str_returns(self, name='Returns'):
8080
param_type)])
8181
else:
8282
out += self._str_indent([untyped_fmt % param.strip()])
83-
if desc:
84-
if self.use_blockquotes:
85-
out += ['']
86-
out += self._str_indent(desc, 8)
83+
if desc and self.use_blockquotes:
84+
out += ['']
85+
elif not desc:
86+
desc = ['..']
87+
out += self._str_indent(desc, 8)
8788
out += ['']
8889
return out
8990

numpydoc/numpydoc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def setup(app, get_doc_object_=get_doc_object):
151151
app.add_domain(NumpyPythonDomain)
152152
app.add_domain(NumpyCDomain)
153153

154+
app.setup_extension('sphinx.ext.autosummary')
155+
154156
metadata = {'version': __version__,
155157
'parallel_read_safe': True}
156158
return metadata

numpydoc/tests/test_docscrape.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@
5656
-------
5757
out : ndarray
5858
The drawn samples, arranged according to `shape`. If the
59-
shape given is (m,n,...), then the shape of `out` is is
59+
shape given is (m,n,...), then the shape of `out` is
6060
(m,n,...,N).
6161
6262
In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
6363
value drawn from the distribution.
6464
list of str
6565
This is not a real return value. It exists to test
6666
anonymous return values.
67+
no_description
6768
6869
Other Parameters
6970
----------------
@@ -184,7 +185,7 @@ def test_other_parameters():
184185

185186

186187
def test_returns():
187-
assert_equal(len(doc['Returns']), 2)
188+
assert_equal(len(doc['Returns']), 3)
188189
arg, arg_type, desc = doc['Returns'][0]
189190
assert_equal(arg, 'out')
190191
assert_equal(arg_type, 'ndarray')
@@ -197,6 +198,11 @@ def test_returns():
197198
assert desc[0].startswith('This is not a real')
198199
assert desc[-1].endswith('anonymous return values.')
199200

201+
arg, arg_type, desc = doc['Returns'][2]
202+
assert_equal(arg, 'no_description')
203+
assert_equal(arg_type, '')
204+
assert not ''.join(desc).strip()
205+
200206

201207
def test_yields():
202208
section = doc_yields['Yields']
@@ -365,14 +371,15 @@ def test_str():
365371
-------
366372
out : ndarray
367373
The drawn samples, arranged according to `shape`. If the
368-
shape given is (m,n,...), then the shape of `out` is is
374+
shape given is (m,n,...), then the shape of `out` is
369375
(m,n,...,N).
370376
371377
In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
372378
value drawn from the distribution.
373379
list of str
374380
This is not a real return value. It exists to test
375381
anonymous return values.
382+
no_description
376383
377384
Other Parameters
378385
----------------
@@ -496,7 +503,7 @@ def test_sphinx_str():
496503
497504
**out** : ndarray
498505
The drawn samples, arranged according to `shape`. If the
499-
shape given is (m,n,...), then the shape of `out` is is
506+
shape given is (m,n,...), then the shape of `out` is
500507
(m,n,...,N).
501508
502509
In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
@@ -506,6 +513,9 @@ def test_sphinx_str():
506513
This is not a real return value. It exists to test
507514
anonymous return values.
508515
516+
no_description
517+
..
518+
509519
:Other Parameters:
510520
511521
**spam** : parrot

0 commit comments

Comments
 (0)