forked from colour-science/colour-demosaicing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
203 lines (177 loc) · 5.15 KB
/
conf.py
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
"""
Colour - Demosaicing - Documentation Configuration
==================================================
"""
import re
import colour_demosaicing as package
basename = re.sub(
"_(\\w)", lambda x: x.group(1).upper(), package.__name__.title()
)
# -- General configuration ------------------------------------------------
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinxcontrib.bibtex",
]
intersphinx_mapping = {
"python": ("https://docs.python.org/3.11", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/dev", None),
"scipy": ("https://docs.scipy.org/doc/scipy-1.8.0/", None),
}
autodoc_member_order = "bysource"
autodoc_mock_imports = [
"colour",
"scipy",
"scipy.ndimage.filters",
]
autodoc_typehints = "both"
autodoc_type_aliases = {
"ArrayLike": "ArrayLike",
"DType": "DType",
"DTypeBoolean": "DTypeBoolean",
"DTypeComplex": "DTypeComplex",
"DTypeFloat": "DTypeFloat",
"DTypeInt": "DTypeInt",
"DTypeReal": "DTypeReal",
"Dataclass": "Dataclass",
"NDArrayBoolean": "NDArrayBoolean",
"NDArrayComplex": "NDArrayComplex",
"NDArrayFloat": "NDArrayFloat",
"NDArrayInt": "NDArrayInt",
"NDArrayReal": "NDArrayReal",
"NDArrayStr": "NDArrayStr",
"Real": "Real",
}
autodoc_preserve_defaults = True
autoclass_content = "both"
autosummary_generate = True
bibtex_bibfiles = ["bibliography.bib"]
bibtex_encoding = "utf8"
napoleon_custom_sections = ["Attributes", "Methods"]
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
project = package.__application_name__
copyright = package.__copyright__.replace("Copyright (C)", "") # noqa: A001
version = f"{package.__major_version__}.{package.__minor_version__}"
release = package.__version__
exclude_patterns = ["_build"]
pygments_style = "lovelace"
# -- Options for HTML output ----------------------------------------------
html_theme = "pydata_sphinx_theme"
html_theme_options = {
"show_nav_level": 2,
"icon_links": [
{
"name": "Email",
"url": "mailto:[email protected]",
"icon": "fas fa-envelope",
},
{
"name": "GitHub",
"url": (
f"https://github.com/colour-science/"
f"{package.__name__.replace('_', '-')}"
),
"icon": "fab fa-github",
},
{
"name": "Facebook",
"url": "https://www.facebook.com/python.colour.science",
"icon": "fab fa-facebook",
},
{
"name": "Gitter",
"url": "https://gitter.im/colour-science/colour",
"icon": "fab fa-gitter",
},
{
"name": "Twitter",
"url": "https://twitter.com/colour_science",
"icon": "fab fa-twitter",
},
],
}
html_logo = "_static/Logo_Light_001.svg"
html_static_path = ["_static"]
htmlhelp_basename = f"{basename}Doc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
"papersize": "a4paper",
"pointsize": "10pt",
"preamble": """
\\usepackage{charter}
\\usepackage[defaultsans]{lato}
\\usepackage{inconsolata}
% Ignoring unicode errors.
\\makeatletter
\\def\\UTFviii@defined#1{%
\\ifx#1\\relax
?%
\\else\\expandafter
#1%
\\fi
}
\\makeatother
""",
}
latex_documents = [
(
"index",
f"{basename}.tex",
f"{package.__application_name__} Documentation",
package.__author__,
"manual",
),
]
latex_logo = "_static/Logo_Medium_001.png"
# -- Options for manual page output ---------------------------------------
man_pages = [
(
"index",
basename,
f"{package.__application_name__} Documentation",
[package.__author__],
1,
)
]
# -- Options for Texinfo output -------------------------------------------
texinfo_documents = [
(
"index",
basename,
f"{package.__application_name__} Documentation",
package.__author__,
package.__application_name__,
basename,
"Miscellaneous",
),
]
# -- Options for Epub output ----------------------------------------------
epub_title = package.__application_name__
epub_author = package.__author__
epub_publisher = package.__author__
epub_copyright = package.__copyright__.replace("Copyright (C)", "")
epub_exclude_files = ["search.html"]
def autodoc_process_docstring(
app, what, name, obj, options, lines # noqa: ARG001
):
"""Process the docstrings to remove the *# noqa* *flake8* pragma."""
for i, line in enumerate(lines):
lines[i] = line.replace("# noqa", "")
def setup(app):
"""
Prepare the extension and linking resources that Sphinx uses in the
build process.
"""
app.connect("autodoc-process-docstring", autodoc_process_docstring)