Skip to content

Commit 6f15ed5

Browse files
committed
Add new theme
1 parent 67667ef commit 6f15ed5

File tree

2 files changed

+90
-5
lines changed

2 files changed

+90
-5
lines changed

.ci/docker/requirements.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# --extra-index-url https://download.pytorch.org/whl/cu117/index.html # Use this to run/publish tutorials against the latest binaries during the RC stage. Comment out after the release. Each release verify the correct cuda version.
22
# Refer to ./jenkins/build.sh for tutorial build instructions
33

4-
sphinx==5.0.0
4+
sphinx==5.3.0
55
sphinx-gallery==0.11.1
66
sphinx_design
77
docutils==0.16
@@ -40,12 +40,11 @@ onnxscript>=0.2.2
4040
onnxruntime
4141
evaluate
4242
accelerate>=0.20.1
43-
43+
sphinxcontrib-mermaid==1.0.0
4444
importlib-metadata==6.8.0
4545

4646
# PyTorch Theme
47-
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
48-
47+
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2
4948
ipython
5049

5150
sphinxcontrib.katex

conf.py

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
import sys
3232
sys.path.insert(0, os.path.abspath('.'))
3333
sys.path.insert(0, os.path.abspath('./.jenkins'))
34-
import pytorch_sphinx_theme
34+
import pytorch_sphinx_theme2
35+
36+
html_theme = "pytorch_sphinx_theme2"
37+
html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()]
3538
import torch
3639
import numpy
3740
import gc
@@ -84,6 +87,14 @@
8487
'sphinx_gallery.gen_gallery',
8588
'sphinx_design',
8689
'sphinx_sitemap'
90+
'sphinxcontrib.mermaid',
91+
'myst_parser'
92+
]
93+
94+
myst_enable_extensions = [
95+
"colon_fence",
96+
"deflist",
97+
"html_image",
8798
]
8899

89100
intersphinx_mapping = {
@@ -136,6 +147,81 @@ def reset_seeds(gallery_conf, fname):
136147
]
137148
sitemap_url_scheme = "{link}"
138149

150+
html_theme_options = {
151+
"navigation_with_keys": False,
152+
"analytics_id": "GTM-T8XT4PS",
153+
"pytorch_project": "tutorials",
154+
"logo": {
155+
"text": "Home",
156+
},
157+
"language_bindings_links": [
158+
{
159+
"url": "https://pytorch.org/docs/stable/cpp_index.html",
160+
"name": "C++",
161+
},
162+
{
163+
"url": "https://pytorch.org/javadoc/",
164+
"name": "Javadoc",
165+
},
166+
{
167+
"url": "https://github.com/pytorch/multipy",
168+
"name": "torch.multiply",
169+
},
170+
],
171+
"external_links": [
172+
{
173+
"name": "Tutorials",
174+
"url": "https://pytorch.org/tutorials/",
175+
},
176+
],
177+
"icon_links": [
178+
{
179+
"name": "X",
180+
"url": "https://x.com/PyTorch",
181+
"icon": "fa-brands fa-x-twitter",
182+
},
183+
{
184+
"name": "GitHub",
185+
"url": "https://github.com/pytorch/pytorch",
186+
"icon": "fa-brands fa-github",
187+
},
188+
{
189+
"name": "Discourse",
190+
"url": "https://dev-discuss.pytorch.org/",
191+
"icon": "fa-brands fa-discourse",
192+
},
193+
{
194+
"name": "PyPi",
195+
"url": "https://pypi.org/project/torch/",
196+
"icon": "fa-brands fa-python",
197+
},
198+
],
199+
"use_edit_page_button": True,
200+
"logo": {
201+
"text": "Home",
202+
},
203+
}
204+
205+
theme_variables = pytorch_sphinx_theme2.get_theme_variables()
206+
207+
html_context = {
208+
"theme_variables": theme_variables,
209+
"display_github": True,
210+
"github_url": "https://github.com",
211+
"github_user": "pytorch",
212+
"github_repo": "pytorch",
213+
"feedback_url": "https://github.com/pytorch/tutorials",
214+
"github_version": "main",
215+
"doc_path": "docs/source",
216+
"library_links": theme_variables.get("library_links", []),
217+
"icon_links": theme_variables.get("icon_links", []),
218+
"community_links": theme_variables.get("community_links", []),
219+
"pytorch_project": "docs",
220+
"language_bindings_links": html_theme_options.get("language_bindings_links", []),
221+
}
222+
223+
224+
139225
if os.getenv('GALLERY_PATTERN'):
140226
# GALLERY_PATTERN is to be used when you want to work on a single
141227
# tutorial. Previously this was fed into filename_pattern, but

0 commit comments

Comments
 (0)