自定义 PyCharm docstring 存根(例如,用于 google docstring 或 numpydoc 格式)

PyCharm 2.7(或 PyCharm 3)支持自定义 docstring 和 doctest 存根吗?如果是这样,那么如何编写这种特定类型的自定义扩展呢?

我目前的项目已经使用 GooglePython 样式指南(http://google-styleguide.googlecode.com/svn/trunk/pyguide.html)进行了标准化。我喜欢 PyCharm 的 docstring 支持,但是目前它只支持两种格式: epytext 和 restructureText。我想,并且愿意自己写,一个 PyCharm 插件,创建一个文档评论存根格式的谷歌或 Numpydoc 风格(https://pypi.python.org/pypi/sphinxcontrib-napoleon/)。这里特别重要的是将 PyCharm 具有的类型推断能力与其他两种文档类型结合起来。

21217 次浏览

As CrazyCoder mentions, its a ticket. Right now, you can only use EpyType and reStructuredText.

With PyCharm 5.0 we finally got to select Google and NumPy Style Python Docstrings templates.

It is also mentioned in the whatsnew section for PyCharm 5.0.

How to change the Docstring Format:

File --> Settings --> Tools --> Python Integrated Tools

There you can choose from the available Docstrings formats:

Plain, Epytext, reStructuredText, NumPy, Google

As pointed out by jstol: for Mac users, this is under

PyCharm -> Preferences -> Tools -> Python Integrated Tools.

Just to be make @Nras answer explicit, as of PyCharm 5.0:

File > Settings > Tools > Python Integrated Tools > Docstrings > Google