Generate API documentation for Python projects with Sphinx

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.