-
Notifications
You must be signed in to change notification settings - Fork 337
/
conf.py
145 lines (111 loc) · 4.39 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
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
import sphinx.domains
import sphinx.addnodes
import sphinx.application
# Add path to rez's source.
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'src')))
# Add path to the root of the docs folder to get access to the rez_sphinxext extension.
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import rez.utils._version
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'rez'
copyright = 'Contributors to the rez project'
author = 'Contributors to the rez project'
version = rez.utils._version._rez_version
release = rez.utils._version._rez_version
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"myst_parser",
# Rez custom extension
'rez_sphinxext'
]
templates_path = ['_templates']
nitpick_ignore = [
# TODO: Remove once we unvendor enum.
("py:class", "rez.solver._Common"),
("py:class", "_thread._local"),
("py:class", "rez.utils.platform_._UnixPlatform"),
("py:class", "rez.version._util._Common"),
("py:class", "rez.version._version._Comparable"),
]
nitpick_ignore_regex = [
("py:class", r"rez\.vendor\..*"),
]
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'furo'
html_static_path = ['_static']
html_theme_options = {
'light_logo': 'rez-horizontal-black.svg',
'dark_logo': 'rez-horizontal-white.svg',
'sidebar_hide_name': True,
}
# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]
# -- Options for intersphinx extension ---------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#module-sphinx.ext.intersphinx
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
# -- Options for autodoc extension ------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#module-sphinx.ext.autodoc
# autoclass_content = 'both'
autodoc_class_signature = 'separated'
autodoc_member_order = 'bysource'
autodoc_inherit_docstrings = True
autodoc_default_options = {
"show-inheritance": True,
"undoc-members": True,
"inherited-members": True,
}
# -- Options for extlinks extension -----------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
extlinks = {
'gh-rez': ('https://github.com/AcademySoftwareFoundation/rez/blob/master/%s', '%s'),
}
# -- Options for todo extension ---------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/todo.html
todo_emit_warnings = False
# -- Custom -----------------------------------------------------------------
def handle_ref_warning(
app: sphinx.application.Sphinx,
domain: sphinx.domains.Domain,
node: sphinx.addnodes.pending_xref,
) -> bool | None:
"""
Emitted when a cross-reference to an object cannot be resolved even
after missing-reference. If the event handler can emit warnings for the
missing reference, it should return True. The configuration variables
nitpick_ignore and nitpick_ignore_regex prevent the event from being
emitted for the corresponding nodes.
"""
if domain and domain.name != 'py':
return None
from docutils.utils import get_source_line
source, line = get_source_line(node)
if 'docstring of collections.abc.' in source:
# Silence warnings that come from collections.abc
return True
return False
def setup(app: sphinx.application.Sphinx) -> dict[str, bool | str]:
app.connect('warn-missing-reference', handle_ref_warning)
return {
'parallel_read_safe': True,
'parallel_write_safe': True,
}