Skip to content

Commit

Permalink
docs: render API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wagner-intevation committed Oct 12, 2023
1 parent 977d70c commit 66191be
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
with:
python-version: 3.8

- name: Install Sphinx
run: pip install Sphinx
- name: Install requirements
run: pip install -r docs/requirements.txt

- name: Build docs
run: make -C docs html
Expand Down
28 changes: 27 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))

import sys
import os
import subprocess


sys.path.insert(0, os.path.abspath('../')) # make intelmqmail importable by apidoc


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -25,7 +33,9 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
extensions = [
'sphinx.ext.autodoc'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -253,3 +263,19 @@

# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False

# -- Custom options -------------------------------------------------------

def run_apidoc(_):
subprocess.check_call("sphinx-apidoc --implicit-namespaces -o source ../intelmqmail", shell=True)

# Always document the __init__ methods
# https://stackoverflow.com/a/5599712/2851664
def skip(app, what, name, obj, would_skip, options):
if name == "__init__":
return False
return would_skip

def setup(app):
app.connect("autodoc-skip-member", skip)
app.connect("builder-inited", run_apidoc)
9 changes: 9 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Contents:

For the integration with IntelMQ Webinput CSV, see the documentation `there <https://github.com/Intevation/intelmq-webinput-csv/blob/master/docs/User-Guide.md#user-content-integration-with-mailgen>`_.

Source code documentation
=========================

.. toctree::
:maxdepth: 2

source/modules
source/intelmqmail

Indices and tables
==================

Expand Down

0 comments on commit 66191be

Please sign in to comment.