Debian Codegraph @

docs/conf.py

raw
1 #!/usr/bin/env python3
2 #
3 # aiosmtplib documentation build configuration file, created by
4 # sphinx-quickstart on Wed Dec 7 11:17:39 2016.
5 #
6 # This file is execfile()d with the current directory set to its
7 # containing dir.
8 #
9 # Note that not all possible configuration values are present in this
10 # autogenerated file.
11 #
12 # All configuration values have a default; values that are commented out
13 # serve to show the default.
14
15 # If extensions (or modules to document with autodoc) are in another directory,
16 # add these directories to sys.path here. If the directory is relative to the
17 # documentation root, use os.path.abspath to make it absolute, like shown here.
18
19 import datetime
20 import pathlib
21 import re
22
23
24 VERSION_REGEX = r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]'
25
26
27 # -- General configuration ------------------------------------------------
28
29 # If your documentation needs a minimal Sphinx version, state it here.
30 #
31 # needs_sphinx = '1.0'
32
33 # Add any Sphinx extension module names here, as strings. They can be
34 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35 # ones.
36 extensions = [
37 "sphinx.ext.autodoc",
38 "sphinx.ext.doctest",
39 "sphinx.ext.todo",
40 "sphinx.ext.coverage",
41 "sphinx.ext.viewcode",
42 "sphinx.ext.intersphinx",
43 "sphinx_autodoc_typehints",
44 "sphinx_copybutton",
45 ]
46
47 # Add any paths that contain templates here, relative to this directory.
48 templates_path = ["_templates"]
49
50 # The suffix(es) of source filenames.
51 # You can specify multiple suffix as a list of string:
52 #
53 # source_suffix = ['.rst', '.md']
54 source_suffix = ".rst"
55
56 # The master toctree document.
57 master_doc = "index"
58
59 # General information about the project.
60 project = "aiosmtplib"
61 author = "Cole Maclean"
62 year = datetime.date.today().year
63 copyright = f"{year}, {author}"
64
65 # The version info for the project you're documenting, acts as replacement for
66 # |version| and |release|, also used in various other places throughout the
67 # built documents.
68
69 init = pathlib.Path("../src/aiosmtplib/__init__.py")
70 version_match = re.search(VERSION_REGEX, init.read_text("utf8"), re.MULTILINE)
71 if not version_match:
72 raise RuntimeError("Cannot find version information")
73
74 # The short X.Y version.
75 version = version_match.group(1)
76
77 # The full version, including alpha/beta/rc tags.
78 release = version
79
80 # The language for content autogenerated by Sphinx. Refer to documentation
81 # for a list of supported languages.
82 #
83 # This is also used if you do content translation via gettext catalogs.
84 # Usually you set "language" from the command line for these cases.
85 language = "en"
86
87 # List of patterns, relative to source directory, that match files and
88 # directories to ignore when looking for source files.
89 # This patterns also effect to html_static_path and html_extra_path
90 exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
91
92 # The name of the Pygments (syntax highlighting) style to use.
93 pygments_style = "sphinx"
94
95 # If true, `todo` and `todoList` produce output, else they produce nothing.
96 todo_include_todos = True
97
98
99 # -- Options for HTML output ----------------------------------------------
100
101 # The theme to use for HTML and HTML Help pages. See the documentation for
102 # a list of builtin themes.
103 #
104 html_theme = "furo"
105
106 # Theme options are theme-specific and customize the look and feel of a theme
107 # further. For a list of options available for each theme, see the
108 # documentation.
109 #
110 html_theme_options = {
111 "navigation_with_keys": True,
112 }
113
114 # Add any paths that contain custom static files (such as style sheets) here,
115 # relative to this directory. They are copied after the builtin static files,
116 # so a file named "default.css" will overwrite the builtin "default.css".
117 html_static_path: list[str] = []
118
119
120 # -- Options for HTMLHelp output ------------------------------------------
121
122 # Output file base name for HTML help builder.
123 htmlhelp_basename = "aiosmtplibdoc"
124
125
126 # -- Options for LaTeX output ---------------------------------------------
127
128 latex_elements: dict[str, str] = {
129 # The paper size ('letterpaper' or 'a4paper').
130 #
131 # 'papersize': 'letterpaper',
132 # The font size ('10pt', '11pt' or '12pt').
133 #
134 # 'pointsize': '10pt',
135 # Additional stuff for the LaTeX preamble.
136 #
137 # 'preamble': '',
138 # Latex figure (float) alignment
139 #
140 # 'figure_align': 'htbp',
141 }
142
143 # Grouping the document tree into LaTeX files. List of tuples
144 # (source start file, target name, title,
145 # author, documentclass [howto, manual, or own class]).
146 latex_documents = [
147 (master_doc, "aiosmtplib.tex", "aiosmtplib Documentation", "Cole Maclean", "manual")
148 ]
149
150
151 # -- Options for manual page output ---------------------------------------
152
153 # One entry per manual page. List of tuples
154 # (source start file, name, description, authors, manual section).
155 man_pages = [(master_doc, "aiosmtplib", "aiosmtplib Documentation", [author], 1)]
156
157
158 # -- Options for Texinfo output -------------------------------------------
159
160 # Grouping the document tree into Texinfo files. List of tuples
161 # (source start file, target name, title, author,
162 # dir menu entry, description, category)
163 texinfo_documents = [
164 (
165 master_doc,
166 "aiosmtplib",
167 "aiosmtplib Documentation",
168 author,
169 "aiosmtplib",
170 "asyncio SMTP client",
171 "Miscellaneous",
172 )
173 ]
174
175 intersphinx_mapping = {"python": ("https://docs.python.org/3.10", None)}
176
177 html_sidebars = {}
178
179 nitpick_ignore = [
180 ("py:class", "asyncio.exceptions.TimeoutError"),
181 ("py:class", "socket.socket"),
182 ]
183
184 doctest_global_setup = """
185 import asyncio
186 import logging
187
188 from aiosmtpd.controller import Controller
189
190
191 aiosmtpd_logger = logging.getLogger("mail.log")
192 aiosmtpd_logger.setLevel(logging.ERROR)
193
194 controller = Controller(object(), hostname="127.0.0.1", port=1025)
195 controller.start()
196 """
197
198 doctest_global_cleanup = """
199 controller.stop()
200 """