Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add api to doc #736

Merged
merged 1 commit into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ dbconfig.json
.idea/*
_build
tests/generator/calypso_test_path
doc/api/
28 changes: 26 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@
"sphinx_rtd_theme",
'myst_parser',
'sphinx.ext.autosummary',
'sphinx.ext.viewcode',
]


# Tell sphinx what the primary language being documented is.
primary_domain = 'cpp'
primary_domain = 'py'

# Tell sphinx what the pygments highlight language should be.
highlight_language = 'cpp'
highlight_language = 'py'

#
myst_heading_anchors = 4
Expand Down Expand Up @@ -81,9 +82,32 @@
autosummary_generate = True
master_doc = 'index'

intersphinx_mapping = {
"python": ("https://docs.python.org/", None),
"dargs": ("https://docs.deepmodeling.com/projects/dargs/en/latest/", None),
"dpdata": ("https://docs.deepmodeling.com/projects/dpdata/en/latest/", None),
"dpdispatcher": ("https://docs.deepmodeling.com/projects/dpdispatcher/en/latest/", None),
"ase": ("https://wiki.fysik.dtu.dk/ase/", None),
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
"pamatgen": ("https://pymatgen.org/", None),
"monty": ("https://guide.materialsvirtuallab.org/monty/", None),
"paramiko": ("https://docs.paramiko.org/en/stable/", None),
"custodian": ("https://cloudcustodian.io/docs/", None),
"GromacsWrapper": ("https://gromacswrapper.readthedocs.io/en/latest/", None),
}


def run_apidoc(_):
from sphinx.ext.apidoc import main
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, "..", "dpgen")
main(['-M', '--tocfile', 'api', '-H', 'DP-GEN API', '-o', os.path.join(cur_dir, "api"), module, '--force'])


def generate_arginfo(app):
subprocess.check_output((sys.executable, "gen_arginfo.py"), universal_newlines=True)

def setup(app):
app.connect('builder-inited', run_apidoc)
app.connect('builder-inited', generate_arginfo)
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ DPGEN's documentation
:caption: Contribution Guild

README.md
api/api

* :ref:`genindex`
* :ref:`modindex`
Expand Down