Skip to content

Commit 25a3f4e

Browse files
authored
PT Sphinx Theme Test (#600)
1 parent 53141ca commit 25a3f4e

File tree

3 files changed

+95
-5
lines changed

3 files changed

+95
-5
lines changed

docs/_static/helion_logo.png

1.4 MB
Loading

docs/conf.py

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from typing import Callable
1010
from typing import Protocol
1111

12+
import pytorch_sphinx_theme2 # pyright: ignore[reportMissingImports]
13+
1214
# -- Path setup --------------------------------------------------------------
1315

1416

@@ -22,7 +24,7 @@ def connect(self, event: str, callback: Callable[..., None]) -> None:
2224

2325
# If extensions (or modules to document with autodoc) are in another directory,
2426
# add these directories to sys.path here.
25-
sys.path.insert(0, os.path.abspath(".."))
27+
sys.path.insert(0, os.path.abspath("."))
2628

2729
# -- Project information -----------------------------------------------------
2830

@@ -39,6 +41,11 @@ def connect(self, event: str, callback: Callable[..., None]) -> None:
3941
"myst_parser",
4042
"sphinx_autodoc_typehints",
4143
"sphinx_gallery.gen_gallery",
44+
"sphinx_design",
45+
"sphinx_sitemap",
46+
"sphinxcontrib.mermaid",
47+
"pytorch_sphinx_theme2",
48+
"sphinxext.opengraph",
4249
]
4350

4451
# MyST parser configuration
@@ -81,7 +88,83 @@ def connect(self, event: str, callback: Callable[..., None]) -> None:
8188

8289
# -- Options for HTML output -------------------------------------------------
8390

84-
html_theme = "sphinx_rtd_theme"
91+
html_theme = "pytorch_sphinx_theme2"
92+
html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()]
93+
94+
html_theme_options = {
95+
"navigation_with_keys": False,
96+
"analytics_id": "GTM-T8XT4PS",
97+
"show_lf_header": False,
98+
"show_lf_footer": False,
99+
"logo": {
100+
"text": "",
101+
"image_light": "_static/helion_logo.png",
102+
"image_dark": "_static/helion_logo.png",
103+
},
104+
"icon_links": [
105+
{
106+
"name": "X",
107+
"url": "https://x.com/PyTorch",
108+
"icon": "fa-brands fa-x-twitter",
109+
},
110+
{
111+
"name": "GitHub",
112+
"url": "https://github.com/pytorch/helion",
113+
"icon": "fa-brands fa-github",
114+
},
115+
{
116+
"name": "Discourse",
117+
"url": "https://dev-discuss.pytorch.org/",
118+
"icon": "fa-brands fa-discourse",
119+
},
120+
{
121+
"name": "PyPi",
122+
"url": "https://pypi.org/project/helion",
123+
"icon": "fa-brands fa-python",
124+
},
125+
],
126+
"use_edit_page_button": True,
127+
"navbar_center": "navbar-nav",
128+
}
129+
130+
theme_variables = pytorch_sphinx_theme2.get_theme_variables()
131+
templates_path = [
132+
"_templates",
133+
os.path.join(os.path.dirname(pytorch_sphinx_theme2.__file__), "templates"),
134+
]
135+
136+
html_context = {
137+
"theme_variables": theme_variables,
138+
"display_github": True,
139+
"github_url": "https://github.com",
140+
"github_user": "pytorch",
141+
"github_repo": "helion",
142+
"feedback_url": "https://github.com/pytorch/helion",
143+
"github_version": "main",
144+
"doc_path": "docs/",
145+
"library_links": [
146+
{
147+
"name": "Helion",
148+
"url": "https://pytorch.github.io/helion/",
149+
"current": True,
150+
},
151+
{
152+
"name": "torch.compiler",
153+
"url": "https://pytorch.org/docs/stable/torch.compiler.html",
154+
},
155+
{
156+
"name": "PyTorch",
157+
"url": "https://pytorch.org/docs/stable/",
158+
},
159+
{
160+
"name": "Triton",
161+
"url": "https://triton-lang.org/main/",
162+
},
163+
],
164+
"community_links": theme_variables.get("community_links", []),
165+
"language_bindings_links": html_theme_options.get("language_bindings_links", []),
166+
}
167+
85168
html_static_path = ["_static"]
86169

87170
# Output directory for HTML files

pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,20 @@ dev = [
2929
"pre-commit"
3030
]
3131
docs = [
32-
"sphinx",
32+
"sphinx==7.2.6",
33+
"pytorch_sphinx_theme2 @ git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2",
34+
"sphinxcontrib.katex==0.9.10",
35+
"docutils==0.18.1,<0.21",
36+
"sphinx-design==0.6.1",
37+
"sphinxcontrib-mermaid==1.0.0",
3338
"myst-parser",
34-
"sphinx-rtd-theme",
39+
"sphinx-gallery==0.14.0",
40+
"sphinx-sitemap==2.7.1",
3541
"sphinx-autodoc-typehints",
3642
"linkify-it-py",
3743
"sphinx-autobuild",
38-
"sphinx-gallery"
44+
"sphinxext-opengraph",
45+
"pillow",
3946
]
4047

4148
[project.urls]

0 commit comments

Comments
 (0)