Skip to content

Commit 13cec95

Browse files
committed
Port docs to new theme
1 parent 103f714 commit 13cec95

File tree

8 files changed

+153
-90
lines changed

8 files changed

+153
-90
lines changed

docs/requirements.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
sphinx-gallery>0.11
2-
sphinx==5.0.0
3-
sphinx_design
1+
sphinx-gallery==0.11.1
2+
sphinx==5.3.0
3+
sphinx-design==0.4.0
44
sphinx_copybutton
55
sphinx-tabs
6+
sphinxcontrib.katex==0.8.6
7+
sphinxext-opengraph==0.9.1
8+
docutils==0.16
9+
sphinxcontrib-mermaid==1.0.0
10+
sphinx-sitemap==2.7.1
611
matplotlib
712
torchvision
813
ipython
914
fsspec
1015
aiohttp
11-
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
16+
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2

docs/source/api_ref.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
API Ref
3+
=======
4+
5+
.. _torchcodec:
6+
7+
torchcodec
8+
----------
9+
10+
.. currentmodule:: torchcodec
11+
12+
13+
.. autosummary::
14+
:toctree: generated/
15+
:nosignatures:
16+
:template: dataclass.rst
17+
18+
Frame
19+
FrameBatch
20+
AudioSamples
21+
22+
23+
.. _decoders:
24+
25+
torchcodec.decoders
26+
-------------------
27+
28+
.. currentmodule:: torchcodec.decoders
29+
30+
31+
For a video decoder tutorial, see: :ref:`sphx_glr_generated_examples_basic_example.py`.
32+
For an audio decoder tutorial, see: :ref:`sphx_glr_generated_examples_audio_decoding.py`.
33+
34+
35+
.. autosummary::
36+
:toctree: generated/
37+
:nosignatures:
38+
:template: class.rst
39+
40+
VideoDecoder
41+
AudioDecoder
42+
43+
44+
.. autosummary::
45+
:toctree: generated/
46+
:nosignatures:
47+
:template: dataclass.rst
48+
49+
VideoStreamMetadata
50+
AudioStreamMetadata
51+
52+
.. _samplers:
53+
54+
torchcodec.samplers
55+
-------------------
56+
57+
58+
.. currentmodule:: torchcodec.samplers
59+
60+
For a tutorial, see: :ref:`sphx_glr_generated_examples_sampling.py`.
61+
62+
.. autosummary::
63+
:toctree: generated/
64+
:nosignatures:
65+
:template: function.rst
66+
67+
clips_at_regular_indices
68+
clips_at_random_indices
69+
clips_at_regular_timestamps
70+
clips_at_random_timestamps

docs/source/api_ref_decoders.rst

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/source/api_ref_samplers.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/source/api_ref_torchcodec.rst

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import os
3030
import sys
3131

32-
import pytorch_sphinx_theme
32+
import pytorch_sphinx_theme2
3333
import torchcodec
3434

3535
sys.path.append(os.path.abspath("."))
@@ -55,6 +55,10 @@
5555
"sphinx_tabs.tabs",
5656
"sphinx_design",
5757
"sphinx_copybutton",
58+
"sphinx_sitemap",
59+
"sphinxcontrib.mermaid",
60+
"pytorch_sphinx_theme2",
61+
"sphinxext.opengraph",
5862
]
5963

6064

@@ -121,15 +125,13 @@ def __call__(self, filename):
121125
napoleon_google_docstring = True
122126

123127

124-
# Add any paths that contain templates here, relative to this directory.
125-
templates_path = ["_templates"]
126-
127128
# The suffix(es) of source filenames.
128129
# You can specify multiple suffix as a list of string:
129130
#
130131
source_suffix = [".rst"]
131132

132133
html_title = f"TorchCodec {torchcodec.__version__} Documentation"
134+
html_baseurl = "https://github.com/pytorch/torchcodec"
133135

134136
# The master toctree document.
135137
master_doc = "index"
@@ -162,22 +164,70 @@ def __call__(self, filename):
162164
# The theme to use for HTML and HTML Help pages. See the documentation for
163165
# a list of builtin themes.
164166
#
165-
html_theme = "pytorch_sphinx_theme"
166-
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
167+
html_theme = "pytorch_sphinx_theme2"
168+
html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()]
169+
170+
ogp_site_url = "http://pytorch.org/<your-sub-site>"
171+
ogp_image = "https://pytorch.org/assets/images/social-share.jpg"
172+
167173

168174
# Theme options are theme-specific and customize the look and feel of a theme
169175
# further. For a list of options available for each theme, see the
170176
# documentation.
171177
#
172178
html_theme_options = {
173-
"collapse_navigation": False,
174-
"display_version": True,
175-
"logo_only": True,
176-
"pytorch_project": "docs",
177-
"navigation_with_keys": True,
179+
"navigation_with_keys": False,
178180
"analytics_id": "GTM-T8XT4PS",
181+
"logo": {
182+
"text": "",
183+
},
184+
"icon_links": [
185+
{
186+
"name": "X",
187+
"url": "https://x.com/PyTorch",
188+
"icon": "fa-brands fa-x-twitter",
189+
},
190+
{
191+
"name": "GitHub",
192+
"url": "https://github.com/pytorch/torchcodec",
193+
"icon": "fa-brands fa-github",
194+
},
195+
{
196+
"name": "Discourse",
197+
"url": "https://dev-discuss.pytorch.org/",
198+
"icon": "fa-brands fa-discourse",
199+
},
200+
{
201+
"name": "PyPi",
202+
"url": "https://pypi.org/project/torchcodec",
203+
"icon": "fa-brands fa-python",
204+
},
205+
],
206+
"use_edit_page_button": True,
207+
"navbar_center": "navbar-nav",
208+
}
209+
theme_variables = pytorch_sphinx_theme2.get_theme_variables()
210+
211+
templates_path = [
212+
"_templates",
213+
os.path.join(os.path.dirname(pytorch_sphinx_theme2.__file__), "templates"),
214+
]
215+
216+
html_context = {
217+
"theme_variables": theme_variables,
218+
"display_github": True,
219+
"github_url": "https://github.com",
220+
"github_user": "pytorch",
221+
"github_repo": "<your-repo>",
222+
"feedback_url": "https://github.com/pytorch/<path-to-your-repo>",
223+
"github_version": "main",
224+
"doc_path": "docs/source",
225+
"library_links": theme_variables.get("library_links", []),
226+
"community_links": theme_variables.get("community_links", []),
227+
"language_bindings_links": html_theme_options.get("language_bindings_links", []),
179228
}
180229

230+
181231
html_logo = "_static/img/pytorch-logo-dark.svg"
182232

183233
html_css_files = ["css/custom_torchcodec.css"]

docs/source/index.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,16 @@ We achieve these capabilities through:
6969

7070
.. toctree::
7171
:maxdepth: 1
72-
:caption: TorchCodec documentation
72+
:caption: Installation
7373
:hidden:
7474

75-
Home <self>
76-
glossary
75+
Installation <https://github.com/pytorch/torchcodec?tab=readme-ov-file#installing-torchcodec>
7776

7877
.. toctree::
7978
:maxdepth: 1
80-
:caption: Examples and tutorials
79+
:caption: Tutorials
8180
:hidden:
8281

83-
Installation instructions <https://github.com/pytorch/torchcodec?tab=readme-ov-file#installing-torchcodec>
8482
generated_examples/index
8583

8684

@@ -90,6 +88,11 @@ We achieve these capabilities through:
9088
:caption: API Reference
9189
:hidden:
9290

93-
api_ref_torchcodec
94-
api_ref_decoders
95-
api_ref_samplers
91+
api_ref
92+
93+
.. toctree::
94+
:maxdepth: 1
95+
:caption: Glossary
96+
:hidden:
97+
98+
glossary

examples/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.. _gallery:
22

3-
Interactive examples
4-
====================
3+
Tutorials
4+
=========

0 commit comments

Comments
 (0)