• Adam Rogowiec's avatar
    [Py] (Partially) automatic generation of python API doc (#973) · 11ec6449
    Adam Rogowiec authored
    * First version of nGraph Python API documentation pages.
    
    * Remove use of (`) apostrophes since they generate Sphinx warnings.
    
    * Fix submodule rendering in Sphinx PythonAPI docs
    
    * Add updated index and conf py files
    
    * Updated version of Python API doc.
    
    * Better description for the autosummary
    
    * FIX: Disable autogeneration of summary files in documentation.
    
    * Remove redundant file containing duplicate information.
    
    * Remove unused Sphinx extensions.
    
    * (Partially) automatic generation of python API doc.
    
    - Detailed documentation is generated automatically
    - Summaries are generated automatically for all files except runtime.py
      which is parsed incorrectly.
    - No additional steps required. Only run `make html`. Under the hood there
      is lunched script which generates all required files to some temporary
      directory under `/tmp/sphinx_auto_py_doc/` and copied to docs directory
      afterwards.
    - Remove `autosummary_generate` from in configuration file since we use
      custom script which performs this step.
    
    * Review update.
    
    * Automatically generated stub files for doc.
    
    - Added just few empty lines which has been removed during recent merge.
    11ec6449
generate_python_api_doc.sh 911 Bytes
#!/usr/bin/env bash

###############################################################################
# 
# This script generates stub files for automatically generated documentation
# of the nGraph Python API.
# 
###############################################################################

# paths relative to this file location
NGRAPH_REPO=../..
DOC_DIR=${NGRAPH_REPO}/doc
TMP_DIR=/tmp/sphinx_auto_py_doc
EXCLUDE_DIRS="${NGRAPH_REPO}/python/ngraph/impl*
              ${NGRAPH_REPO}/python/ngraph/utils*"
CURRENT_DIR=.

cd ${NGRAPH_REPO}/python/ngraph
PYTHONPATH=. sphinx-autogen -t ${DOC_DIR}/sphinx/source/_templates/ -o ${TMP_DIR} \
                             ${DOC_DIR}/sphinx/source/python_api/structure.rst
sphinx-apidoc -f -M -d 1 -T -o ${TMP_DIR} ${CURRENT_DIR} ${EXCLUDE_DIRS}

rm ${TMP_DIR}/ngraph.runtime.rst
cp ${TMP_DIR}/* ${DOC_DIR}/sphinx/source/python_api/_autosummary/

rm -rf ${TMP_DIR}