-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathconf.py
221 lines (200 loc) · 7.81 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# -- Project information -----------------------------------------------------
import os
from urllib.request import urlopen
from pathlib import Path
project = "AISystem & AIInfra (AI系统原理)"
# copyright = "2024"
# author = "ZOMI"
language = "cn" # For testing language translations
master_doc = "index"
# -- 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 = [
"ablog",
"myst_nb",
"numpydoc",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx_copybutton",
"sphinx_design",
"sphinx_examples",
"sphinx_tabs.tabs",
"sphinx_thebe",
"sphinx_togglebutton",
"sphinxcontrib.bibtex",
"sphinxext.opengraph",
# For the kitchen sink
"sphinx.ext.todo",
]
# 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 = ["_build", "Thumbs.db", ".DS_Store"]
intersphinx_mapping = {
"python": ("https://docs.python.org/3.8", None),
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
"pst": ("https://pydata-sphinx-theme.readthedocs.io/en/latest/", None),
}
nitpick_ignore = [
("py:class", "docutils.nodes.document"),
("py:class", "docutils.parsers.rst.directives.body.Sidebar"),
]
suppress_warnings = ["myst.domains", "ref.ref"]
numfig = True
myst_enable_extensions = [
"dollarmath",
"amsmath",
"deflist",
# "html_admonition",
# "html_image",
"colon_fence",
# "smartquotes",
# "replacements",
# "linkify",
# "substitution",
]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_book_theme"
html_logo = "_static/logo-wide.svg"
html_title = "AI System"
html_copy_source = True
html_favicon = "_static/logo-square.svg"
html_last_updated_fmt = ""
# html_sidebars = {
# "reference/blog/*": [
# "navbar-logo.html",
# "search-field.html",
# "ablog/postcard.html",
# "ablog/recentposts.html",
# "ablog/tagcloud.html",
# "ablog/categories.html",
# "ablog/archives.html",
# "sbt-sidebar-nav.html",
# ]
# }
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = ["custom.css"]
nb_execution_mode = "cache"
thebe_config = {
"repository_url": "https://github.com/binder-examples/jupyter-stacks-datascience",
"repository_branch": "master",
}
html_theme_options = {
"path_to_docs": "docs",
"repository_url": "https://github.com/executablebooks/sphinx-book-theme",
"repository_branch": "master",
"launch_buttons": {
"binderhub_url": "https://mybinder.org",
"colab_url": "https://colab.research.google.com/",
"deepnote_url": "https://deepnote.com/",
"notebook_interface": "jupyterlab",
"thebe": True,
# "jupyterhub_url": "https://datahub.berkeley.edu", # For testing
},
"use_edit_page_button": True,
"use_source_button": True,
"use_issues_button": True,
# "use_repository_button": True,
"use_download_button": True,
"use_sidenotes": True,
"show_toc_level": 3,
"logo": {
"image_dark": "_static/logo-wide-dark.svg",
# "text": html_title, # Uncomment to try text with logo
},
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/chenzomi12/AISystem",
"icon": "fa-brands fa-github",
}, {
"name": "Youtube",
"url": "https://www.youtube.com/@ZOMI666",
"icon": "fa-brands fa-youtube"
}, {
"name": "Blibili",
"url": "https://space.bilibili.com/517221395",
"icon": "fa-brands fa-bilibili",
}
],
# For testing
# "use_fullscreen_button": False,
# "home_page_in_toc": True,
# "extra_footer": "<a href='https://google.com'>Test</a>", # DEPRECATED KEY
# "show_navbar_depth": 2,
# Testing layout areas
# "navbar_start": ["test.html"],
# "navbar_center": ["test.html"],
# "navbar_end": ["test.html"],
# "navbar_persistent": ["test.html"],
# "footer_start": ["test.html"],
# "footer_end": ["test.html"]
}
# sphinxext.opengraph
ogp_social_cards = {
"image": "_static/logo-square.png",
}
# -- ABlog config -------------------------------------------------
blog_path = "reference/blog"
blog_post_pattern = "reference/blog/*.md"
blog_baseurl = "https://sphinx-book-theme.readthedocs.io"
fontawesome_included = True
post_auto_image = 1
post_auto_excerpt = 2
nb_execution_show_tb = "READTHEDOCS" in os.environ
bibtex_bibfiles = ["references.bib"]
# To test that style looks good with common bibtex config
bibtex_reference_style = "author_year"
bibtex_default_style = "plain"
numpydoc_show_class_members = False # for automodule:: urllib.parse stub file issue
linkcheck_ignore = [
"http://someurl/release", # This is a fake link
"https://doi.org", # These don't resolve properly and cause SSL issues
]
# -- Download latest theme elements page from PyData -----------------------------
# path_pydata_content = "https://raw.githubusercontent.com/pydata/pydata-sphinx-theme/main/docs/user_guide/theme-elements.md" # noqa
# path_content_file = Path(__file__).parent / "content/pydata-content-blocks.md"
# if not path_content_file.exists():
# with urlopen(path_pydata_content) as resp:
# # Read in the content page file, then update the title and add context
# content = resp.read().decode().split("\n")
# ix_title = content.index("# Theme-specific elements")
# content[ix_title] = "# PyData Theme Elements"
# content.insert(
# ix_title + 1,
# "\nThis is a collection of content blocks with special support from this theme's parent theme, [the PyData Sphinx Theme](https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/theme-elements.html)\n", # noqa
# ) # noqa
# content = "\n".join(content)
# # Replace a relative link in the pydata docs w/ the respective one here
# content = content.replace("../examples/pydata.ipynb", "notebooks.md")
# # Write to disk in a location that will be ignored by git
# path_content_file.write_text(content)
def setup(app):
# -- To demonstrate ReadTheDocs switcher -------------------------------------
# This links a few JS and CSS files that mimic the environment that RTD uses
# so that we can test RTD-like behavior. We don't need to run it on RTD and we
# don't wanted it loaded in GitHub Actions because it messes up the lighthouse
# results.
if not os.environ.get("READTHEDOCS") and not os.environ.get("GITHUB_ACTIONS"):
app.add_css_file(
"https://assets.readthedocs.org/static/css/readthedocs-doc-embed.css"
)
app.add_css_file("https://assets.readthedocs.org/static/css/badge_only.css")
# Create the dummy data file so we can link it
# ref: https://github.com/readthedocs/readthedocs.org/blob/bc3e147770e5740314a8e8c33fec5d111c850498/readthedocs/core/static-src/core/js/doc-embed/footer.js # noqa: E501
app.add_js_file("rtd-data.js")
app.add_js_file(
"https://assets.readthedocs.org/static/javascript/readthedocs-doc-embed.js",
priority=501,
)