diff --git a/docs/_templates/autosummary/base.rst b/docs/_templates/autosummary/base.rst deleted file mode 100644 index 01a0408..0000000 --- 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 f89a05d..0000000 --- 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__', '__eq__', '__lt__', '__le__', '__gt__', '__ge__', '__repr__', '__str__'] %} - {%- 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 528f222..0000000 --- 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 04f2406..b8400b9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,3 @@ -import os -import shutil - import audeer @@ -21,16 +18,14 @@ '.DS_Store', 'api-src', ] -templates_path = ['_templates'] pygments_style = None extensions = [ - 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', # support for Google-style docstrings - 'sphinx.ext.autosummary', 'sphinx_autodoc_typehints', 'sphinx_copybutton', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', + 'sphinx_apipages', ] intersphinx_mapping = { 'python': ('https://docs.python.org/3/', None), @@ -44,10 +39,16 @@ autodoc_default_options = { 'undoc-members': False, } - -# Disable auto-generation of TOC entries in the API -# https://github.com/sphinx-doc/sphinx/issues/6316 -toc_object_entries = False +apipages_hidden_methods = [ + '__call__', + '__eq__', + '__lt__', + '__le__', + '__gt__', + '__ge__', + '__repr__', + '__str__', +] # HTML -------------------------------------------------------------------- @@ -61,15 +62,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 a929f44..d3d48ed 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,5 @@ sphinx >=3.0.0 +sphinx-apipages >=0.1.2 sphinx-audeering-theme >=1.1.4 sphinx_autodoc_typehints sphinx-copybutton