File: conf.py

package info (click to toggle)
slidge 0.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,516 kB
  • sloc: python: 20,548; xml: 518; sh: 57; javascript: 27; makefile: 14
file content (122 lines) | stat: -rw-r--r-- 3,898 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
from enum import Enum, IntEnum
from pathlib import Path

from slixmpp import ComponentXMPP

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

# sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath('..'))
# sys.path.insert(0, os.path.abspath('../..'))


# -- Project information -----------------------------------------------------

project = "Slidge"
copyright = "2025, the slidge contributors"
author = "Nicolas Cedilnik"


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

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    "sphinx.ext.autosectionlabel",
    "sphinx.ext.autodoc",
    "sphinx.ext.intersphinx",
    "sphinx.ext.extlinks",
    # "sphinx.ext.viewcode",  # crashes build unfortunately
    "sphinx.ext.autodoc.typehints",
    "sphinxarg.ext",
    "autoapi.extension",
    "slidge_sphinx_extensions.config_obj",
]

autodoc_typehints = "description"

# Incldude __init__ docstrings
# autoclass_content = "class"
# autoapi_python_class_content = "class"

autoapi_type = "python"
autoapi_dirs = ["../../slidge", "../../superduper"]
autoapi_add_toctree_entry = False
autoapi_keep_files = False
autoapi_root = "dev/api"
autoapi_ignore = ["*xep_*", "slidge/core/*"]
autoapi_options = [
    "members",
    "show-module-summary",
    "inherited-members",
    "imported-members",
    # these on-by-default parameters are disabled
    # "undoc-members",
    # "private-members",
    # "show-inheritance",
    # "special-members",
]


def skip_stuff(app, what, name, obj, skip, options):
    # Hide some stuff from the docs
    if name.endswith(".Register"):
        skip = True
    elif name.endswith("user_store"):
        skip = True
    elif any(name.endswith("Gateway." + x) for x in dir(ComponentXMPP)):
        skip = True
    elif any(
        name.endswith("MucType." + x)
        or name.endswith("CommandAccess." + x)
        or name.endswith("RegistrationType." + x)
        for x in dir(int) + dir(Enum) + dir(IntEnum) + ["name", "value"]
    ):
        skip = True
    return skip


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


# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

intersphinx_mapping = {
    "python": ("/usr/share/doc/python3-doc/html", "/usr/share/doc/python3-doc/html/objects.inv"),
    "slixmpp": ("/usr/share/doc/python-slixmpp-doc/html", "/usr/share/doc/python-slixmpp-doc/html/objects.inv"),
}

extlinks = {"xep": ("https://xmpp.org/extensions/xep-%s.html", "XEP-%s")}
html_theme = "furo"
html_theme_options = {
    "source_edit_link": "https://codeberg.org/slidge/slidge/_edit/main/docs/source/{filename}",
    "source_view_link": "https://codeberg.org/slidge/slidge/src/branch/main/docs/source/{filename}",
    "footer_icons": [
        {
            "name": "Codeberg",
            "url": "https://codeberg.org/slidge/slidge",
            "html": Path("codeberg.svg").read_text(),
        },
    ],
}