Sphinx can generate API documents that can be found based on Python annotations, and simply record the next steps
1 : Install pip install-u Sphinx
2: Execute Sphinx-apidoc-f-O./doc under the directory where the. py file is required to generate the document./domain/model/the new Doc directory under the current directory, the folder for the API documentation is in this directory./domain/model/ Represents the directory where the API documentation needs to be generated.
3: Go to Doc directory to modify the conf.py file set code path to Sys.path.insert (0, Os.path.abspath (' ... /domain ')). Save.
4: Execute make HTML in doc directory to generate HTML file
5: On the SMB server, open the/doc/_build/html index.html file to view the document
format of the function document:
Example:/trunk/server/domain/model/customer/customer.py file Def find_by_like (CLS, input, limit=10) function
you need to indicate what the function is doing. The function's formal parameters and the meaning of the return value.
the function line parameter and function return value are written in the following format: (the document generation will be correct only if written in the following format)
" "
function Function Description
#注意空一行
: Return: Returns a fuzzy Lookup: attr: ' Customer ' object list
the number of queries is controlled by the ' limit ' =10
:p Aram Input: For filling in query conditions
#注意空一行
" "
Generate API documentation for Python projects with Sphinx