Подтвердить что ты не робот

Sphinx Autodoc и NumpyDoc

несмотря на чтение этот учебник, этот вопрос и numpy docstring standard, я не могу заставить sphinx autodoc играть хорошо с numpy docstrings.

В моем conf.py у меня есть:

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

и в моем файле doc у меня есть:

 .. automodule:: python_file

 .. autoclass:: PythonClass
   :members:

где python_file.py имеет:

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

Когда я запускаю make html, я получаю ERROR: Unknown directive type "autosummary". Когда я добавляю autosummary к моему extensions, таким образом:

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

Я получаю:

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

Как рекомендовано этот вопрос, я добавляю numpydoc_show_class_members = False к моему conf.py.

Теперь я могу запустить make html без ошибок, но разделы Parameters и Returns не интерпретируются как разделы numpydoc.

Есть ли выход из этого беспорядка?

4b9b3361

Ответ 1

Попробуйте удалить весь предыдущий вывод html. Затем восстановите документы.