23

despite reading this tutorial, this question and the numpy docstring standard, I'm unable to get sphinx autodoc to play nicely with numpy docstrings.

In my conf.py I have:

extensions = ['sphinx.ext.autodoc', 'numpydoc']

and in my doc file I have:

 .. automodule:: python_file

 .. autoclass:: PythonClass
   :members:

where python_file.py has:

class PythonClass(object):
    def do_stuff(x):
        """
        This does good stuff.

        Here are the details about the good stuff it does.

        Parameters
        ----------
        x : int
            An integer which has amazing things done to it

        Returns
        -------
        y : int
            Some other thing
        """
        return x + 1

When I run make html I get ERROR: Unknown directive type "autosummary". When I add autosummary to my extensions thus:

extensions = ['sphinx.ext.autodoc', 'numpydoc', 'sphinx.ext.autosummary']

I get:

WARNING: toctree references unknown document u'docs/python_file.PythonClass.do_stuff'

As recommended by this question, I add numpydoc_show_class_members = False to my conf.py.

Now I can run make html without errors, but the Parameters and Returns sections are not interpreted as being numpydoc sections.

Is there a way out of this mess?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
LondonRob
  • 73,083
  • 37
  • 144
  • 201

1 Answers1

3

Try removing the whole previous html output. Then regenerate the docs.

Maciek D.
  • 2,754
  • 1
  • 20
  • 17
  • 2
    This didn't work for me. Same issue exists after deleting it and rerunning. Any other ideas? – Brian Oct 27 '16 at 23:36