From 73b1efc09c9e77fa7beb6106927ec918e24cddeb Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Wed, 10 Jan 2024 16:24:14 +0100 Subject: [PATCH] DOC: use sphinx-apipages extension (#163) --- docs/_templates/autosummary/base.rst | 5 ----- docs/_templates/autosummary/class.rst | 19 ------------------- docs/_templates/autosummary/function.rst | 5 ----- docs/conf.py | 22 +--------------------- docs/requirements.txt | 1 + 5 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 docs/_templates/autosummary/base.rst delete mode 100644 docs/_templates/autosummary/class.rst delete mode 100644 docs/_templates/autosummary/function.rst diff --git a/docs/_templates/autosummary/base.rst b/docs/_templates/autosummary/base.rst deleted file mode 100644 index 01a0408f..00000000 --- a/docs/_templates/autosummary/base.rst +++ /dev/null @@ -1,5 +0,0 @@ -{{ name | escape | underline}} - -.. currentmodule:: {{ module }} - -.. auto{{ objtype }}:: {{ fullname }} diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst deleted file mode 100644 index 85d580f4..00000000 --- a/docs/_templates/autosummary/class.rst +++ /dev/null @@ -1,19 +0,0 @@ -{{ objname | escape | underline}} - -.. currentmodule:: {{ module }} - -.. autoclass:: {{ objname }} - -{% block methods %} -{%- for item in (all_methods + attributes)|sort %} - {%- if not item.startswith('_') or item in ['__call__'] %} - {%- if item in all_methods %} -{{ (item + '()') | escape | underline(line='-') }} -.. automethod:: {{ name }}.{{ item }} - {%- elif item in attributes %} -{{ item | escape | underline(line='-') }} -.. autoattribute:: {{ name }}.{{ item }} - {%- endif %} - {% endif %} -{%- endfor %} -{% endblock %} diff --git a/docs/_templates/autosummary/function.rst b/docs/_templates/autosummary/function.rst deleted file mode 100644 index 528f2227..00000000 --- a/docs/_templates/autosummary/function.rst +++ /dev/null @@ -1,5 +0,0 @@ -{{ (name + '()') | escape | underline}} - -.. currentmodule:: {{ module }} - -.. auto{{ objtype }}:: {{ fullname }} diff --git a/docs/conf.py b/docs/conf.py index b58e813b..a3b0effb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,4 @@ from datetime import date -import os -import shutil import toml @@ -30,17 +28,15 @@ 'Thumbs.db', '.DS_Store', ] -templates_path = ['_templates'] pygments_style = None extensions = [ 'jupyter_sphinx', - 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', - 'sphinx.ext.autosummary', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', 'sphinx_autodoc_typehints', 'sphinx_copybutton', + 'sphinx_apipages', ] napoleon_use_ivar = True # List of class attributes @@ -59,10 +55,6 @@ 'pandas', ] -# Disable auto-generation of TOC entries in the API -# https://github.com/sphinx-doc/sphinx/issues/6316 -toc_object_entries = False - # HTML -------------------------------------------------------------------- html_theme = 'sphinx_audeering_theme' @@ -75,15 +67,3 @@ 'display_github': True, } html_title = title - - -# Copy API (sub-)module RST files to docs/api/ folder --------------------- -audeer.rmdir('api') -audeer.mkdir('api') -api_src_files = audeer.list_file_names('api-src') -api_dst_files = [ - audeer.path('api', os.path.basename(src_file)) - for src_file in api_src_files -] -for src_file, dst_file in zip(api_src_files, api_dst_files): - shutil.copyfile(src_file, dst_file) diff --git a/docs/requirements.txt b/docs/requirements.txt index 8a67d9fb..3fe7fffd 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,7 @@ ipykernel jupyter-sphinx sphinx +sphinx-apipages sphinx-audeering-theme >=1.2.1 sphinx-autodoc-typehints sphinx-copybutton