Skip to content

Commit d747223

Browse files
authored
TRTLLM-4875 feat: Add version switcher to doc (NVIDIA#3846)
Signed-off-by: Kaiyu Xie <[email protected]>
1 parent 7ff9fd3 commit d747223

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

docs/source/_static/switcher.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[
2+
{
3+
"preferred": true,
4+
"version": "latest",
5+
"url": "https://nvidia.github.io/TensorRT-LLM/latest"
6+
},
7+
{
8+
"version": "0.20.0rc0",
9+
"url": "https://nvidia.github.io/TensorRT-LLM/0.20.0rc0"
10+
},
11+
{
12+
"version": "0.19.0rc0",
13+
"url": "https://nvidia.github.io/TensorRT-LLM/0.19.0rc0"
14+
},
15+
{
16+
"version": "0.18.2",
17+
"url": "https://nvidia.github.io/TensorRT-LLM/0.18.2"
18+
}
19+
]

docs/source/conf.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# For the full list of built-in configuration values, see the documentation:
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
55

6+
import importlib.util
67
# -- Project information -----------------------------------------------------
78
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
89
import os
@@ -13,11 +14,20 @@
1314

1415
sys.path.insert(0, os.path.abspath('.'))
1516

16-
project = 'tensorrt_llm'
17-
copyright = '2024, NVidia'
17+
project = 'TensorRT-LLM'
18+
copyright = '2025, NVidia'
1819
author = 'NVidia'
1920
branch_name = pygit2.Repository('.').head.shorthand
2021
html_show_sphinx = False
22+
23+
# Get the version from the version.py file
24+
version_path = os.path.abspath(
25+
os.path.join(os.path.dirname(__file__), "../../tensorrt_llm/version.py"))
26+
spec = importlib.util.spec_from_file_location("version_module", version_path)
27+
version_module = importlib.util.module_from_spec(spec)
28+
spec.loader.exec_module(version_module)
29+
version = version_module.__version__
30+
2131
# -- General configuration ---------------------------------------------------
2232
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2333

@@ -76,6 +86,14 @@
7686

7787
html_theme = 'nvidia_sphinx_theme'
7888
html_static_path = ['_static']
89+
html_extra_path = ["./_static/switcher.json"]
90+
html_theme_options = {
91+
"switcher": {
92+
"json_url": "./_static/switcher.json",
93+
"version_match": version,
94+
"check_switcher": True,
95+
},
96+
}
7997

8098
# ------------------------ C++ Doc related --------------------------
8199
# Breathe configuration

0 commit comments

Comments
 (0)