Skip to content

Commit

Permalink
add autoapi (#19)
Browse files Browse the repository at this point in the history
* add autoapi

* add sphinx.ext.autodoc to extension

* add extensions
  • Loading branch information
njzjz authored Aug 11, 2022
1 parent d1d6723 commit 944666f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,26 @@
extensions = [
'deepmodeling_sphinx',
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
'numpydoc',
]
html_theme = 'sphinx_rtd_theme'

def run_apidoc(_):
from sphinx.ext.apidoc import main
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
cur_dir = os.path.abspath(os.path.dirname(__file__))
module = os.path.join(cur_dir, "..", "deepmodeling_sphinx")
main(['-M', '--tocfile', 'api_py', '-H', 'API', '-o', os.path.join(cur_dir, "api_py"), module, '--force'])

def setup(app):
app.connect('builder-inited', run_apidoc)

intersphinx_mapping = {
"python": ("https://docs.python.org/", None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Others
.. toctree::
:titlesonly:

api_py/api_py
credits

------------------
Expand Down
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sphinx_rtd_theme
.
myst_parser
docutils >=0.17
docutils >=0.17
numpydoc

0 comments on commit 944666f

Please sign in to comment.