From 1988c067a118fa71bdbf4cf9888b1e99855a5fc6 Mon Sep 17 00:00:00 2001
From: Ian Bell <ian.bell@nist.gov>
Date: Thu, 7 Jul 2022 15:45:28 -0400
Subject: [PATCH] Autogenerate the API documentation

---
 doc/source/conf.py   | 9 +++++++--
 doc/source/index.rst | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/source/conf.py b/doc/source/conf.py
index f504fcf..5d54db8 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -28,20 +28,25 @@ import teqp
 release = teqp.__version__
 
 # -- Exeucute all notebooks --------------------------------------------------
-subprocess.check_output(f'jupyter nbconvert --version', shell=True)
+# subprocess.check_output(f'jupyter nbconvert --version', shell=True)
 for path, dirs, files in os.walk('.'):
     for file in files:
         if file.endswith('.ipynb') and '.ipynb_checkpoints' not in path:
             subprocess.check_output(f'jupyter nbconvert  --to notebook --output {file} --execute {file}', shell=True, cwd=path)
             # --ExecutePreprocessor.allow_errors=True      (this allows you to allow errors globally, but a raises-exception cell tag is better)
 
+### -- Auto-generate API documentation -----------------------------------------
+here = os.path.dirname(__file__)
+subprocess.check_output(f'sphinx-apidoc -e -f -o source/api {os.path.dirname(teqp.__file__)}', shell=True, cwd=here)
+
 # -- General configuration ---------------------------------------------------
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
 extensions = [
-'nbsphinx'
+'nbsphinx',
+'sphinx.ext.autodoc'
 ]
 
 # Add any paths that contain templates here, relative to this directory.
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 9cbb358..110e259 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -9,6 +9,7 @@ Welcome to teqp's documentation!
    models/index
    derivs/index
    algorithms/index
+   api
 
 Indices and tables
 ==================
-- 
GitLab