且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

替换python docstrings

更新时间:2023-12-05 20:00:58

Pyment 是一种可以转换Python文本字符串并创建丢失的骨架的工具。它可以管理 Google Epydoc (javadoc样式), Numpydoc reStructuredText (reST,Sphinx默认)docstring格式。

Pyment is a tool that can convert Python docstrings and create missing ones skeletons. It can manage Google, Epydoc (javadoc style), Numpydoc, reStructuredText (reST, Sphinx default) docstring formats.

它接受单个文件或文件夹(也浏览子文件夹)。对于每个文件,它将识别每个docstring格式并将其转换为所需的格式。最后,将生成一个补丁以应用于该文件。

It accepts a single file or a folder (exploring also sub-folders). For each file, it will recognize each docstring format and convert it to the desired one. At the end, a patch will be generated to apply to the file.


  • 安装Pyment

  • install Pyment

键入以下内容(可以使用virtualenv)

Type the following (you can use a virtualenv):

$ git clone https://github.com/dadadel/pyment.git
$ cd pyment
$ python setup.py install




  • 从Epydoc转换为Sphinx

    • convert from Epydoc to Sphinx
    • 您可以将项目转换为Sphinx格式(reST),这是默认的输出格式:

      You can convert your project to Sphinx format (reST), which is the default output format, by doing:

$ pyment /my/folder/project