Skip to content

Commit c2a64d4

Browse files
authored
Docs build (#227)
cd into docs/ and run `make html` and view the html in build/html
1 parent fb6f150 commit c2a64d4

File tree

14 files changed

+714
-0
lines changed

14 files changed

+714
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ t.py
99
.vscode/
1010
ccache.sh
1111
*.ipynb
12+
docs/build
13+
docs/src
14+
docs/source/generated
15+
.DS_Store

docs/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
package-lock.json
3+
package.json
4+
yarn.lock

docs/Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS ?= -j auto -WT --keep-going
6+
SPHINXBUILD ?= sphinx-build
7+
SPHINXPROJ ?= functorch
8+
SOURCEDIR ?= source
9+
BUILDDIR ?= build
10+
PYCMD ?= python
11+
12+
# Put it first so that "make" without argument is like "make help".
13+
help:
14+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
15+
16+
docset: html
17+
doc2dash --name $(SPHINXPROJ) --icon $(SOURCEDIR)/_static/img/pytorch-logo-flame.png --enable-js --online-redirect-url https://pytorch.org/docs/ --force $(BUILDDIR)/html/
18+
19+
# Manually fix because Zeal doesn't deal well with `icon.png`-only at 2x resolution.
20+
cp $(SPHINXPROJ).docset/icon.png $(SPHINXPROJ).docset/[email protected]
21+
convert $(SPHINXPROJ).docset/[email protected] -resize 16x16 $(SPHINXPROJ).docset/icon.png
22+
23+
html-stable:
24+
# stable differs from `make html` in two ways:
25+
# 1) The stable logo is used instead of the unstable logo
26+
# 2) There will not be a link to the stable docs.
27+
# See conf.py for more details.
28+
RELEASE=1 make html
29+
30+
.PHONY: help Makefile docset
31+
32+
# Catch-all target: route all unknown targets to Sphinx using the new
33+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
34+
%: Makefile
35+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
36+
37+
clean:
38+
@echo "Removing everything under 'build' and 'source/generated'.."
39+
@rm -rf $(BUILDDIR)/html/ $(BUILDDIR)/doctrees $(SOURCEDIR)/generated

docs/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sphinx==3.5.4
2+
docutils==0.16
3+
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
4+
-e git://github.com/readthedocs/sphinx_rtd_theme.git#egg=sphinx_rtd_theme
5+
sphinxcontrib.katex
6+
sphinx_copybutton
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/* Copy buttons */
2+
button.copybtn {
3+
position: absolute;
4+
display: flex;
5+
top: .3em;
6+
right: .5em;
7+
width: 1.7em;
8+
height: 1.7em;
9+
opacity: 1;
10+
transition: opacity 0.3s, border .3s, background-color .3s;
11+
user-select: none;
12+
padding: 0;
13+
border: none;
14+
outline: none;
15+
border-radius: 0.4em;
16+
border: #e1e1e1 1px solid;
17+
background-color: rgb(245, 245, 245);
18+
}
19+
20+
button.copybtn.success {
21+
border-color: #22863a;
22+
}
23+
24+
button.copybtn img {
25+
width: 100%;
26+
padding: .2em;
27+
}
28+
29+
div.highlight {
30+
position: relative;
31+
}
32+
33+
.highlight button.copybtn {
34+
opacity: 1;
35+
}
36+
37+
.highlight button.copybtn:hover {
38+
background-color: rgb(235, 235, 235);
39+
}
40+
41+
.highlight button.copybtn:active {
42+
background-color: rgb(187, 187, 187);
43+
}
44+
45+
/**
46+
* A minimal CSS-only tooltip copied from:
47+
* https://codepen.io/mildrenben/pen/rVBrpK
48+
*
49+
* To use, write HTML like the following:
50+
*
51+
* <p class="o-tooltip--left" data-tooltip="Hey">Short</p>
52+
*/
53+
.o-tooltip--left {
54+
position: relative;
55+
}
56+
57+
.o-tooltip--left:after {
58+
opacity: 1;
59+
visibility: visible;
60+
position: absolute;
61+
content: attr(data-tooltip);
62+
padding: .2em;
63+
font-size: .8em;
64+
left: -.2em;
65+
background: grey;
66+
color: white;
67+
white-space: nowrap;
68+
z-index: 2;
69+
border-radius: 2px;
70+
transform: translateX(-102%) translateY(0);
71+
transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
72+
}
73+
74+
.o-tooltip--left:hover:after {
75+
display: block;
76+
opacity: 1;
77+
visibility: visible;
78+
transform: translateX(-100%) translateY(0);
79+
transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
80+
transition-delay: .5s;
81+
}

docs/source/_static/css/jit.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.codeblock-height-limiter {
2+
max-height: 500px;
3+
overflow: scroll;
4+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
body {
2+
font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;
3+
}
4+
5+
/* Default header fonts are ugly */
6+
h1, h2, .rst-content .toctree-wrapper p.caption, h3, h4, h5, h6, legend, p.caption {
7+
font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;
8+
}
9+
10+
/* Use white for docs background */
11+
.wy-side-nav-search {
12+
background-color: #fff;
13+
}
14+
15+
.wy-nav-content-wrap, .wy-menu li.current > a {
16+
background-color: #fff;
17+
}
18+
19+
@media screen and (min-width: 1400px) {
20+
.wy-nav-content-wrap {
21+
background-color: rgba(0, 0, 0, 0.0470588);
22+
}
23+
24+
.wy-nav-content {
25+
background-color: #fff;
26+
}
27+
}
28+
29+
/* Fixes for mobile */
30+
.wy-nav-top {
31+
background-color: #fff;
32+
background-image: url('../img/pytorch-logo-dark.svg');
33+
background-repeat: no-repeat;
34+
background-position: center;
35+
padding: 0;
36+
margin: 0.4045em 0.809em;
37+
color: #333;
38+
}
39+
40+
.wy-nav-top > a {
41+
display: none;
42+
}
43+
44+
@media screen and (max-width: 768px) {
45+
.wy-side-nav-search>a img.logo {
46+
height: 60px;
47+
}
48+
}
49+
50+
/* This is needed to ensure that logo above search scales properly */
51+
.wy-side-nav-search a {
52+
display: block;
53+
}
54+
55+
/* This ensures that multiple constructors will remain in separate lines. */
56+
.rst-content dl:not(.docutils) dt {
57+
display: table;
58+
}
59+
60+
/* Use our red for literals (it's very similar to the original color) */
61+
.rst-content tt.literal, .rst-content tt.literal, .rst-content code.literal {
62+
color: #F05732;
63+
}
64+
65+
.rst-content tt.xref, a .rst-content tt, .rst-content tt.xref,
66+
.rst-content code.xref, a .rst-content tt, a .rst-content code {
67+
color: #404040;
68+
}
69+
70+
/* Change link colors (except for the menu) */
71+
72+
a {
73+
color: #F05732;
74+
}
75+
76+
a:hover {
77+
color: #F05732;
78+
}
79+
80+
81+
a:visited {
82+
color: #D44D2C;
83+
}
84+
85+
.wy-menu a {
86+
color: #b3b3b3;
87+
}
88+
89+
.wy-menu a:hover {
90+
color: #b3b3b3;
91+
}
92+
93+
/* Default footer text is quite big */
94+
footer {
95+
font-size: 80%;
96+
}
97+
98+
footer .rst-footer-buttons {
99+
font-size: 125%; /* revert footer settings - 1/80% = 125% */
100+
}
101+
102+
footer p {
103+
font-size: 100%;
104+
}
105+
106+
/* For hidden headers that appear in TOC tree */
107+
/* see http://stackoverflow.com/a/32363545/3343043 */
108+
.rst-content .hidden-section {
109+
display: none;
110+
}
111+
112+
nav .hidden-section {
113+
display: inherit;
114+
}
115+
116+
.wy-side-nav-search>div.version {
117+
color: #000;
118+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. role:: hidden
2+
:class: hidden-section
3+
.. currentmodule:: {{ module }}
4+
5+
6+
{{ name | underline}}
7+
8+
.. autoclass:: {{ name }}
9+
:inherited-members:
10+
:members:
11+
12+
.. autogenerated from source/_templates/autosummary/class.rst
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. role:: hidden
2+
:class: hidden-section
3+
.. currentmodule:: {{ module }}
4+
5+
6+
{{ name | underline}}
7+
8+
.. autoclass:: {{ name }}
9+
:members:
10+
11+
12+
..
13+
autogenerated from source/_templates/classtemplate.rst
14+
note it does not have :inherited-members:

docs/source/_templates/layout.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{% extends "!layout.html" %}
2+
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html" />
3+
4+
{% block extrahead %}
5+
{% if release == "master" %}
6+
<!--
7+
Search engines should not index the master version of documentation.
8+
Stable documentation are built without release == 'master'.
9+
-->
10+
<meta name="robots" content="noindex">
11+
{% endif %}
12+
{% endblock %}
13+
14+
{% block menu %}
15+
{{ super() }}
16+
{% endblock %}
17+
18+
{% block sidebartitle %}
19+
{% include "searchbox.html" %}
20+
{% endblock %}
21+
22+
23+
{% block footer %}
24+
{{ super() }}
25+
<script script type="text/javascript">
26+
var collapsedSections = ['Notes', 'Language Bindings', 'Libraries', 'Community'];
27+
</script>
28+
29+
<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/795629140/?label=txkmCPmdtosBENSssfsC&amp;guid=ON&amp;script=0"/>
30+
{% endblock %}

0 commit comments

Comments
 (0)