Skip to content

Commit 6474e4a

Browse files
authored
Merge pull request #130 from njzjz/master
automatically generator API docs
2 parents a6e64c7 + abe7e60 commit 6474e4a

File tree

4 files changed

+24
-96
lines changed

4 files changed

+24
-96
lines changed

doc/api.rst

Lines changed: 0 additions & 91 deletions
This file was deleted.

doc/conf.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
13-
# import os
14-
# import sys
13+
import os
14+
import sys
15+
from datetime import date
1516
# sys.path.insert(0, os.path.abspath('.'))
1617

1718

1819
# -- Project information -----------------------------------------------------
1920

2021
project = 'DPDispatcher'
21-
copyright = '2020, Deep Modeling'
22+
copyright = '2020-%d, Deep Modeling' % date.today().year
2223
author = 'Deep Modeling'
2324

2425

@@ -30,6 +31,9 @@
3031
extensions = [
3132
'recommonmark',
3233
"sphinx_rtd_theme",
34+
'sphinx.ext.viewcode',
35+
'sphinx.ext.intersphinx',
36+
'numpydoc',
3337
'sphinx.ext.autosummary'
3438
]
3539

@@ -58,3 +62,18 @@
5862
autodoc_default_flags = ['members']
5963
autosummary_generate = True
6064
master_doc = 'index'
65+
66+
def run_apidoc(_):
67+
from sphinx.ext.apidoc import main
68+
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
69+
cur_dir = os.path.abspath(os.path.dirname(__file__))
70+
module = os.path.join(cur_dir, "..", "dpdispatcher")
71+
main(['-M', '--tocfile', 'api', '-H', 'DPDispatcher API', '-o', os.path.join(cur_dir, "api"), module, '--force'])
72+
73+
def setup(app):
74+
app.connect('builder-inited', run_apidoc)
75+
76+
77+
intersphinx_mapping = {
78+
"python": ("https://docs.python.org/", None),
79+
}

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ DPDispatcher will monitor (poke) until these jobs finish and download the result
2020
machine
2121
resources
2222
task
23-
api
23+
api/api
2424

2525

2626
Indices and tables

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
keywords='deep potential generator active learning deepmd-kit',
4141
install_requires=install_requires,
4242
extras_require={
43-
'docs': ['sphinx', 'recommonmark', 'sphinx_rtd_theme'],
43+
'docs': ['sphinx', 'recommonmark', 'sphinx_rtd_theme>=1.0.0rc1', 'numpydoc'],
4444
"cloudserver": ["oss2"],
4545
":python_version<'3.7'": ["typing_extensions"],
4646
},

0 commit comments

Comments
 (0)