conf.py 4.18 KB
Newer Older
1
2
import os
import sys
3
from datetime import datetime
4
5
6

sys.path.insert(0, os.path.abspath("../.."))

Lianmin Zheng's avatar
Lianmin Zheng committed
7
version_file = "../python/sglang/version.py"
8
9
10
11
12
with open(version_file, "r") as f:
    exec(compile(f.read(), version_file, "exec"))
__version__ = locals()["__version__"]

project = "SGLang"
13
copyright = f"2023-{datetime.now().year}, SGLang"
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
author = "SGLang Team"

version = __version__
release = __version__

extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.autosummary",
    "sphinx.ext.napoleon",
    "sphinx.ext.viewcode",
    "sphinx.ext.autosectionlabel",
    "sphinx.ext.intersphinx",
    "sphinx_tabs.tabs",
    "myst_parser",
    "sphinx_copybutton",
    "sphinxcontrib.mermaid",
Chayenne's avatar
Chayenne committed
30
31
    "nbsphinx",
    "sphinx.ext.mathjax",
32
33
]

Chayenne's avatar
Chayenne committed
34
nbsphinx_allow_errors = True
Chayenne's avatar
Chayenne committed
35
nbsphinx_execute = "never"
Chayenne's avatar
Chayenne committed
36

37
autosectionlabel_prefix_document = True
Chayenne's avatar
Chayenne committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
nbsphinx_allow_directives = True


myst_enable_extensions = [
    "dollarmath",
    "amsmath",
    "deflist",
    "colon_fence",
    "html_image",
    "linkify",
    "substitution",
]

myst_heading_anchors = 3

Chayenne's avatar
Chayenne committed
53
nbsphinx_kernel_name = "python3"
Chayenne's avatar
Chayenne committed
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
nbsphinx_execute_arguments = [
    "--InlineBackend.figure_formats={'svg', 'pdf'}",
    "--InlineBackend.rc={'figure.dpi': 96}",
]


nb_render_priority = {
    "html": (
        "application/vnd.jupyter.widget-view+json",
        "application/javascript",
        "text/html",
        "image/svg+xml",
        "image/png",
        "image/jpeg",
        "text/markdown",
        "text/latex",
        "text/plain",
    )
}

myst_enable_extensions = [
    "dollarmath",
    "amsmath",
    "deflist",
    "colon_fence",
    "html_image",
    "linkify",
    "substitution",
]

myst_heading_anchors = 3
myst_ref_domains = ["std", "py"]
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

templates_path = ["_templates"]

source_suffix = {
    ".rst": "restructuredtext",
    ".md": "markdown",
}

master_doc = "index"

language = "en"

exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

pygments_style = "sphinx"

html_theme = "sphinx_book_theme"
html_logo = "_static/image/logo.png"
104
html_favicon = "_static/image/logo.ico"
105
106
107
108
109
html_title = project
html_copy_source = True
html_last_updated_fmt = ""

html_theme_options = {
Chayenne's avatar
Chayenne committed
110
    "repository_url": "https://github.com/sgl-project/sgl-project.github.io",
111
112
113
114
115
116
117
118
119
120
121
122
123
    "repository_branch": "main",
    "show_navbar_depth": 3,
    "max_navbar_depth": 4,
    "collapse_navbar": True,
    "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": 2,
}

Chayenne's avatar
Chayenne committed
124
125
126
127
128
129
130
131
html_context = {
    "display_github": True,
    "github_user": "sgl-project",
    "github_repo": "sgl-project.github.io",
    "github_version": "main",
    "conf_py_path": "/docs/",
}

132
html_static_path = ["_static"]
133
134
html_css_files = ["css/custom_log.css"]

Chayenne's avatar
Chayenne committed
135

136
def setup(app):
Chayenne's avatar
Chayenne committed
137
138
    app.add_css_file("css/custom_log.css")

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

myst_enable_extensions = [
    "dollarmath",
    "amsmath",
    "deflist",
    "colon_fence",
]
myst_heading_anchors = 5

htmlhelp_basename = "sglangdoc"

latex_elements = {}

latex_documents = [
    (master_doc, "sglang.tex", "sglang Documentation", "SGLang Team", "manual"),
]

man_pages = [(master_doc, "sglang", "sglang Documentation", [author], 1)]

texinfo_documents = [
    (
        master_doc,
        "sglang",
        "sglang Documentation",
        author,
        "sglang",
        "One line description of project.",
        "Miscellaneous",
    ),
]

epub_title = project

epub_exclude_files = ["search.html"]

copybutton_prompt_text = r">>> |\.\.\. "
copybutton_prompt_is_regexp = True

autodoc_preserve_defaults = True
navigation_with_keys = False

autodoc_mock_imports = [
    "torch",
    "transformers",
    "triton",
]

intersphinx_mapping = {
    "python": ("https://docs.python.org/3.12", None),
    "typing_extensions": ("https://typing-extensions.readthedocs.io/en/latest", None),
    "pillow": ("https://pillow.readthedocs.io/en/stable", None),
    "numpy": ("https://numpy.org/doc/stable", None),
    "torch": ("https://pytorch.org/docs/stable", None),
}
Chayenne's avatar
Chayenne committed
193
194

html_theme = "sphinx_book_theme"
195
196
197
198
199
200
201
202
203
204


nbsphinx_prolog = """
.. raw:: html

    <style>
        .output_area.stderr, .output_area.stdout {
            color: #d3d3d3 !important; /* light gray */
        }
    </style>
205
"""