Sphinx
Sphinx is widely used to generate python document. Here is a brief tutorial to generate your own doc
Installation
brew install sphinx-doc
        
0. Source Code Layout
  • Source Code
  • # get source code 
    git clone https://github.com/lin-chen-Langley/prime
    		

    1. Quick Start
    Inside "Prime" folder, sphinx-quickstart doc
    2. Generate rst files
    sphinx-apidoc -o doc ./src inside "Prime" folder, generate a rst file for each py file or each package under "src" folder, and save them to "doc" folder

    3. Configuration
    1. edit conf.py in "doc" folder, define where to search the source code
    import os
    import sys
    sys.path.insert(0, os.path.abspath('../src'))
    
    2. edit theme, built-in themes
    html_theme = 'classic'
    
    3. edit extensions
    extensions = ['sphinx.ext.autodoc']
    
    4. Add display content
    edit index.rst in "doc" folder, add rst files for the modules and packages that will be shown in index.html, use reStructuredText to edit the file, rst files are initial documentation files
    .. toctree:: 
         :maxdepth: 2
         :caption: Contents:
         :glob: 
    ---Blank Line--- 
    .. use three spaces instead of a tab
         modules.rst
    
    5. Organize display content
    edit modules.rst, change the title from "src" to "packages"
    5. Generate documentaion
    make html in "doc" folder, save the generated html doc to _build
    Add logo

    1. edit conf.py in "doc" folder
    # The name of an image file (relative to this directory) to place at the top
    # of the sidebar.
    html_logo = 'img/prime.jepg'
    			
    2. make html, in "doc" folder
    Generate pdf doc
  • Mac OS
  • Ubuntu
  • Reference
  • Sphinx Themes
  • Sphinx Autodoc Tutorial for Dummies
  • Sphinx Docs, Logo and Updated Docstrings
  • Brandon’s Sphinx Tutorial