Difference between sphinxcontrib.napoleon and numpy.numpydoc [closed]

冷暖自知 提交于 2019-12-20 21:59:20

问题


I am writing documentation for a Python project using Numpy-style docstrings.

numpydoc and napoleon are two Sphinx extensions that parse Numpy-style docstrings to generate documentation. The first one is used for the Numpy project itself, the second is shipped with Sphinx.

What are the pros and cons of using one extension over the other?


回答1:


The resulting format of each a bit different, and the default behavior of napoleon links to known datatypes in the python documentation, and it is slightly more condensed (numpydoc displays a bit like how it appears in the docstring). Below are examples of each, both using the default sphinx theme.

An issue in astropy's issue tracker that states napolean is a hard dependency for IPython, and they have since migrated from numpydoc to napolean.

They mention it has stricter syntax requirements, but I haven't tested either too much to comment on that.


napoleon



numpydoc




来源:https://stackoverflow.com/questions/36715801/difference-between-sphinxcontrib-napoleon-and-numpy-numpydoc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!