File: conf.py

package info (click to toggle)
todoman 4.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 588 kB
  • sloc: python: 4,682; makefile: 167; sh: 1
file content (85 lines) | stat: -rw-r--r-- 2,348 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
# noqa: INP001
from __future__ import annotations

from collections.abc import Iterator

import todoman
from todoman.configuration import CONFIG_SPEC
from todoman.configuration import NO_DEFAULT

# -- Generate confspec.rst ----------------------------------------------


def confspec_rst() -> Iterator[str]:
    """Generator that returns lines for the confspec doc page."""

    for name, type_, default, description, _validation in sorted(CONFIG_SPEC):
        if default == NO_DEFAULT:
            formatted_default = "None, this field is mandatory."
        elif isinstance(default, str):
            formatted_default = f'``"{default}"``'
        else:
            formatted_default = f"``{default}``"

        yield f"\n.. _main-{name}:"
        yield f"\n\n.. object:: {name}\n"
        yield "    " + "\n    ".join(line for line in description.splitlines())
        yield "\n\n"

        if isinstance(type_, tuple):
            yield f"      :type: {type_[0].__name__}"
        else:
            yield f"      :type: {type_.__name__}"

        yield f"\n      :default: {formatted_default}\n"


with open("confspec.tmp", "w") as file_:
    file_.writelines(confspec_rst())

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

extensions = [
    "sphinx_click.ext",
    "sphinx.ext.autodoc",
    "sphinx.ext.todo",
    "sphinx.ext.viewcode",
    "sphinx_rtd_theme",
]

source_suffix = ".rst"

master_doc = "index"

project = "Todoman"
copyright = "2015-2023, Hugo Osvaldo Barrera"
author = "Hugo Osvaldo Barrera <hugo@whynothugo.nl>, et al"

# The short X.Y version.
version = todoman.__version__
# The full version, including alpha/beta/rc tags.
release = todoman.__version__

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

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

html_theme = "sphinx_rtd_theme"

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (
        "man",
        "todoman",
        "a simple, standards-based, cli todo manager",
        [author],
        1,
    )
]