Search This Blog

generate Python API DOC using Sphinx

  1. Install Sphinx
  2. Run sphinx-quickstart to generate the doc source
    cd /path/to/my-python-project
    mkdir doc
    cd doc
    sphinx-quickstart
    
            autodoc: automatically insert docstrings from modules: Y
    
  3. edit conf.py, uncomment and modify the following lines(assume python modules are in ../src/):
    import os
    import sys
    sys.path.insert(0, os.path.abspath('../src'))
    
    
    
  4. Run sphinx-apidoc to generate reST files for specified modules (in ../src/):
    sphinx-apidoc -o . ../src
    
  5. Generate html api doc:
    make html
    

No comments:

Post a Comment