Sphinx Autodoc and NumpyDoc
Asked Answered
B

1

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?

Brucite answered 2/12, 2013 at 17:59 Comment(0)
P
3

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

Parados answered 29/12, 2013 at 18:35 Comment(1)
This didn't work for me. Same issue exists after deleting it and rerunning. Any other ideas?Psaltery

© 2022 - 2024 — McMap. All rights reserved.