Skip to content

Commit

Permalink
Merge pull request #303 from openego/feature/auto_sphinx_api
Browse files Browse the repository at this point in the history
Adding sphinx autoapi
  • Loading branch information
birgits committed Mar 24, 2023
2 parents e04a4d8 + 038faaf commit d85968d
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 328 deletions.
17 changes: 0 additions & 17 deletions doc/api.rst

This file was deleted.

66 changes: 0 additions & 66 deletions doc/api/edisgo.flex_opt.rst

This file was deleted.

42 changes: 0 additions & 42 deletions doc/api/edisgo.io.rst

This file was deleted.

58 changes: 0 additions & 58 deletions doc/api/edisgo.network.rst

This file was deleted.

44 changes: 0 additions & 44 deletions doc/api/edisgo.opf.rst

This file was deleted.

82 changes: 0 additions & 82 deletions doc/api/edisgo.tools.rst

This file was deleted.

5 changes: 0 additions & 5 deletions doc/api/edisgo_class.rst

This file was deleted.

30 changes: 30 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"autoapi.extension",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
Expand All @@ -55,7 +56,36 @@
"sphinx.ext.napoleon", # enable Napoleon Sphinx v>1.3
"sphinx.ext.extlinks", # enables external links with a key
"sphinx_autodoc_typehints",
"sphinx.ext.inheritance_diagram",
]
# Autoapi settings
autoapi_type = "python"
autoapi_dirs = ["../edisgo"]
autoapi_options = [
"members",
"undoc-members",
"show-inheritance",
"show-inheritance-diagram",
"show-module-summary",
"special-members",
]
# Files to ignore when building api documentation
autoapi_ignore = [
"*/flex_opt/curtailment.py",
"*/flex_opt/storage_positioning.py",
"*/opf/*",
]


def skip_autoapi_parts(app, what, name, obj, skip, options):
if obj.type == "data":
skip = True
return skip


def setup(sphinx):
sphinx.connect("autoapi-skip-member", skip_autoapi_parts)


# Napoleon settings
napoleon_google_docstring = True
Expand Down
15 changes: 4 additions & 11 deletions doc/dev_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,15 @@ Code standards
Documentation
-------------

Build the docs locally by first setting up the sphinx environment with (executed
from top-level folder)
You can build the docs locally as follows (executed from top-level eDisGo directory):

.. code-block:: bash
sphinx-apidoc -f -o doc/api edisgo
sphinx-build -E -a -b html ./doc/ <outputdir>
And then you build the html docs on your computer with
To manually check if external links in the documentation work, you can run the following command (internal links are not checked by this):

.. code-block:: bash
sphinx-build -E -a doc/ doc/_html
sphinx-build ./doc/ -b linkcheck -d _build/doctrees _build/html
To manually check if external links in the documentation work, change into the doc
repository and run the following command (internal links are not checked by this):

.. code-block:: bash
sphinx-build . -b linkcheck -d _build/doctrees _build/html

0 comments on commit d85968d

Please sign in to comment.