diff --git a/.readthedocs.yml b/.readthedocs.yml index d00b9d0cca..499411eaa3 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -10,4 +10,5 @@ build: - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install -r doc/requirements.txt apt_packages: - inkscape -formats: all +formats: + - pdf diff --git a/doc/conf.py b/doc/conf.py index 7fc24822eb..704ad45479 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -32,36 +32,8 @@ copyright = "2017-%d, DeepModeling" % date.today().year author = "DeepModeling" - -def run_apidoc(_): - import sys - - 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, "..") - main( - [ - "-M", - "--tocfile", - "api_py", - "-H", - "Python API", - "-o", - os.path.join(cur_dir, "api_py"), - module, - "source/*", - "--force", - ] - ) - - -def setup(app): - # Add hook for building doxygen xml when needed - app.connect("builder-inited", run_apidoc) +autoapi_dirs = ["../deepmd"] +autoapi_add_toctree_entry = False # -- General configuration --------------------------------------------------- @@ -94,6 +66,7 @@ def setup(app): "exhale", "sphinxcontrib.bibtex", "sphinx_design", + "autoapi.extension", ] # breathe_domain_by_extension = { diff --git a/doc/index.rst b/doc/index.rst index 7bff8d3957..fcce1e37e7 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -69,7 +69,7 @@ DeePMD-kit is a package written in Python/C++, designed to minimize the effort r development/type-embedding development/coding-conventions development/cicd - api_py/api_py + Python API api_op API_CC/api_cc api_c/api_c diff --git a/doc/requirements.txt b/doc/requirements.txt index b011900147..c8a8e2d868 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,4 +1,4 @@ .[docs,cpu,torch] -exhale @ https://github.com/svenevs/exhale/archive/2759a394268307b88f5440487ae0920ee4ebf81e.zip # https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/309 docutils!=0.18.*,!=0.19.* +sphinx>=7 diff --git a/pyproject.toml b/pyproject.toml index 2eb4c2f3c9..edbc5e0b19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,12 +79,11 @@ test = [ docs = [ "sphinx>=3.1.1", "sphinx_rtd_theme>=1.0.0rc1", - "sphinx_markdown_tables", "myst-nb>=1.0.0rc0", "myst-parser>=0.19.2", "sphinx-design", "breathe", - "exhale", + "exhale>=0.3.7", "numpydoc", "ase", "deepmodeling-sphinx>=0.1.0", @@ -92,6 +91,7 @@ docs = [ "sphinx-argparse", "pygments-lammps", "sphinxcontrib-bibtex", + "sphinx-autoapi>=3.0.0", ] lmp = [ "lammps~=2023.8.2.3.0",