diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..8c56dfa --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,29 @@ +API +==== + +.. toctree:: + :maxdepth: 4 + +.. automodule:: tdameritrade + :members: + :undoc-members: + :show-inheritance: + +.. toctree:: + + tdameritrade.auth + +.. automodule:: tdameritrade.client + :members: + :undoc-members: + :show-inheritance: + +.. automodule:: tdameritrade.urls + :members: + :undoc-members: + :show-inheritance: + +.. automodule:: tdameritrade.auth + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/conf.py b/docs/conf.py index 6feb5b7..109a1a4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,10 +17,12 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import sys +import os +import os.path +import subprocess import sphinx_rtd_theme +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # -- General configuration ------------------------------------------------ @@ -32,8 +34,7 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.coverage', - 'sphinx.ext.viewcode'] +extensions = ['sphinx.ext.coverage', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -168,3 +169,23 @@ author, 'tdameritrade', 'One line description of project.', 'Miscellaneous'), ] + + +def run_apidoc(_): + out_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'api')) + mod_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'tdameritrade')) + cmd_path = 'sphinx-apidoc' + if hasattr(sys, 'real_prefix'): # Check to see if we are in a virtualenv + # If we are, assemble the path manually + cmd_path = os.path.abspath(os.path.join(sys.prefix, 'bin', 'sphinx-apidoc')) + subprocess.check_call([cmd_path, + '-E', + '-M', + '-o', + out_dir, + mod_dir, + '--force']) + + +def setup(app): + app.connect('builder-inited', run_apidoc) diff --git a/docs/conf.py.in b/docs/conf.py.in index 9a5c619..c0a50a4 100644 --- a/docs/conf.py.in +++ b/docs/conf.py.in @@ -17,10 +17,12 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import sys +import os +import os.path +import subprocess import sphinx_rtd_theme +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # -- General configuration ------------------------------------------------ @@ -32,8 +34,7 @@ import sphinx_rtd_theme # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.coverage', - 'sphinx.ext.viewcode'] +extensions = ['sphinx.ext.coverage', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -168,3 +169,23 @@ texinfo_documents = [ author, 'tdameritrade', 'One line description of project.', 'Miscellaneous'), ] + + +def run_apidoc(_): + out_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'api')) + mod_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'tdameritrade')) + cmd_path = 'sphinx-apidoc' + if hasattr(sys, 'real_prefix'): # Check to see if we are in a virtualenv + # If we are, assemble the path manually + cmd_path = os.path.abspath(os.path.join(sys.prefix, 'bin', 'sphinx-apidoc')) + subprocess.check_call([cmd_path, + '-E', + '-M', + '-o', + out_dir, + mod_dir, + '--force']) + + +def setup(app): + app.connect('builder-inited', run_apidoc) diff --git a/docs/index.rst b/docs/index.rst index cf83423..630ce64 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,6 +18,7 @@ Python interface to TD Ameritrade Api installation authentication quickstart + api .. |build-status| image:: https://travis-ci.org/timkpaine/tdameritrade.svg?branch=master