-
Notifications
You must be signed in to change notification settings - Fork 594
[DOC] Set up Sphinx doc build #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
on: [push] | ||
|
||
jobs: | ||
build_docs_job: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.9] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Dependencies | ||
run: | | ||
echo `python3 --version` | ||
sudo apt-get install -y python-setuptools | ||
sudo apt-get install -y python3-sphinx | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install setuptools | ||
id: build | ||
- name: Build the docset | ||
run: | | ||
cd docs/ | ||
pip install -r requirements.txt | ||
make html | ||
- name: Get output time | ||
run: echo "The time was ${{ steps.build.outputs.time }}" | ||
- name: Upload docs preview | ||
uses: seemethere/upload-artifact-s3@v5 | ||
if: ${{ github.event_name == 'pull_request' }} | ||
with: | ||
retention-days: 14 | ||
s3-bucket: doc-previews | ||
if-no-files-found: error | ||
path: docs | ||
s3-prefix: pytorch/executorch/${{ github.event.pull_request.number }} | ||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
with: | ||
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages # The branch the action should deploy to. | ||
FOLDER: build/html # The folder the action should deploy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/source/tutorials | ||
/build | ||
/sphinxbuild_py | ||
/sphinxbuild_cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = -WT --keep-going | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = ExecuTorch | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
|
||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
#html: | ||
# $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sphinx==5.0.0 | ||
sphinx-gallery | ||
matplotlib | ||
# PyTorch Theme | ||
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme | ||
myst-parser | ||
sphinx_design |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* sphinx-design styles for cards/tabs | ||
*/ | ||
:root { | ||
--sd-color-info: #ee4c2c; | ||
--sd-color-primary: #6c6c6d; | ||
--sd-color-primary-highlight: #f3f4f7; | ||
--sd-color-card-border-hover: #ee4c2c; | ||
--sd-color-card-border: #f3f4f7; | ||
--sd-color-card-background: #fff; | ||
--sd-color-card-text: inherit; | ||
--sd-color-card-header: transparent; | ||
--sd-color-card-footer: transparent; | ||
--sd-color-tabs-label-active: #ee4c2c; | ||
--sd-color-tabs-label-hover: #ee4c2c; | ||
--sd-color-tabs-label-inactive: #6c6c6d; | ||
--sd-color-tabs-underline-active: #ee4c2c; | ||
--sd-color-tabs-underline-hover: #fabdbd; | ||
--sd-color-tabs-underline-inactive: transparent; | ||
--sd-color-tabs-overline: rgb(222, 222, 222); | ||
--sd-color-tabs-underline: rgb(222, 222, 222); | ||
} | ||
|
||
.sd-text-info { | ||
color: #ee4c2c; | ||
} | ||
|
||
.sd-card-img-top { | ||
background: #ee4c2c; | ||
height: 5px !important; | ||
} | ||
|
||
.sd-card { | ||
position: relative; | ||
background-color: #fff; | ||
opacity: 1.0; | ||
border-radius: 0px; | ||
width: 30%; | ||
border: none; | ||
padding-bottom: 0px; | ||
} | ||
|
||
|
||
.sd-card-img:hover { | ||
opacity: 1.0; | ||
background-color: #f3f4f7; | ||
} | ||
|
||
|
||
.sd-card:after { | ||
display: block; | ||
opacity: 1; | ||
content: ''; | ||
border-bottom: solid 1px #ee4c2c; | ||
background-color: #fff; | ||
transform: scaleX(0); | ||
transition: transform .250s ease-in-out; | ||
transform-origin: 0% 50%; | ||
} | ||
|
||
.sd-card:hover { | ||
background-color: #fff; | ||
opacity: 1; | ||
border-top: 1px solid #f3f4f7; | ||
border-left: 1px solid #f3f4f7; | ||
border-right: 1px solid #f3f4f7; | ||
} | ||
|
||
.sd-card:hover:after { | ||
transform: scaleX(1); | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{% extends "!layout.html" %} | ||
|
||
{% block sidebartitle %} | ||
{% include "searchbox.html" %} | ||
{% endblock %} | ||
|
||
{%- block content %} | ||
{% if 'tutorials' in pagename %} | ||
|
||
<div class="pytorch-call-to-action-links"> | ||
<div id="tutorial-type">{{ pagename }}</div> | ||
|
||
<div id="google-colab-link"> | ||
<img class="call-to-action-img" src="{{ pathto('_static/images/pytorch-colab.svg', 1) }}"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These URLs refer to Though I see that |
||
<div class="call-to-action-desktop-view">Run in Google Colab</div> | ||
<div class="call-to-action-mobile-view">Colab</div> | ||
</div> | ||
<div id="download-notebook-link"> | ||
<img class="call-to-action-notebook-img" src="{{ pathto('_static/images/pytorch-download.svg', 1) }}"/> | ||
<div class="call-to-action-desktop-view">Download Notebook</div> | ||
<div class="call-to-action-mobile-view">Notebook</div> | ||
</div> | ||
<div id="github-view-link"> | ||
<img class="call-to-action-img" src="{{ pathto('_static/images/pytorch-github.svg', 1) }}"/> | ||
<div class="call-to-action-desktop-view">View on GitHub</div> | ||
<div class="call-to-action-mobile-view">GitHub</div> | ||
</div> | ||
</div> | ||
|
||
{% endif %} | ||
{{ super() }} | ||
|
||
{% endblock %} | ||
|
||
{% block footer %} | ||
{{ super() }} | ||
<script script type="text/javascript"> | ||
var collapsedSections = ['Introduction', 'Getting Started', 'Exporting to ExecuTorch', 'Intermediate Representation (IR) Specification','Compiler Entry Points', 'Runtime', 'Quantization', 'Kernel Library', 'SDK', 'Tutorials'] | ||
</script> | ||
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Custom Compiler Passeis | ||
|
||
TBA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Delegate and Partitioner | ||
|
||
TBA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Kernel Fusion Pass | ||
|
||
TBA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Memory Planning | ||
|
||
TBA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# Configuration file for the Sphinx documentation builder. | ||
# Created by isphinx-quickstart on Tue Jul 19 14:58:12 2022. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
import os | ||
import sys | ||
|
||
import pytorch_sphinx_theme | ||
|
||
sys.path.insert(0, os.path.abspath(".")) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "ExecuTorch" | ||
copyright = "2023, ExecuTorch" | ||
author = "ExecuTorch Contributors" | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
|
||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath("../../")) | ||
|
||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.autosectionlabel", | ||
"sphinx.ext.autosummary", | ||
"sphinx.ext.coverage", | ||
"sphinx.ext.doctest", | ||
"sphinx.ext.napoleon", | ||
"sphinx.ext.todo", | ||
"sphinx.ext.viewcode", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.coverage", | ||
"myst_parser", | ||
"sphinx_design", | ||
"sphinx_gallery.gen_gallery" | ||
] | ||
|
||
from sphinx.ext.coverage import CoverageBuilder | ||
|
||
templates_path = ['_templates'] | ||
|
||
myst_enable_extensions = [ | ||
"colon_fence", | ||
] | ||
|
||
sphinx_gallery_conf = { | ||
'examples_dirs': ['tutorials_source'], | ||
'gallery_dirs': ['tutorials'], | ||
'filename_pattern': '/tutorials/', | ||
'promote_jupyter_magic': True, | ||
'backreferences_dir': None, | ||
'first_notebook_cell': ("%matplotlib inline"), | ||
} | ||
|
||
source_suffix = ['.rst', '.md'] | ||
|
||
autodoc_typehints = "none" | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
# templates_path = ["../_templates"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "pytorch_sphinx_theme" | ||
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()] | ||
|
||
# Theme options are theme-specific and customize the look and feel of a theme | ||
# further. For a list of options available for each theme, see the | ||
# documentation. | ||
# | ||
html_theme_options = { | ||
"pytorch_project": "executorch", | ||
"display_version": True, | ||
"logo_only": True, | ||
'collapse_navigation': False, | ||
'sticky_navigation': False, | ||
'navigation_depth': 4, | ||
'includehidden': True, | ||
'titles_only': False, | ||
} | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ["_static"] | ||
|
||
html_css_files = ['css/custom.css'] | ||
html_js_files = ['js/custom.js'] | ||
|
||
# Example configuration for intersphinx: refer to the Python standard library. | ||
intersphinx_mapping = { | ||
"python": ("https://docs.python.org/", None), | ||
"numpy": ("https://docs.scipy.org/doc/numpy/", None), | ||
"torch": ("https://pytorch.org/docs/stable/", None), | ||
} | ||
|
||
# Custom directives defintions to create cards on main TorchServe page | ||
|
||
from custom_directives import ( | ||
CustomCardEnd, | ||
CustomCardItem, | ||
CustomCardStart, | ||
SupportedDevices, | ||
SupportedProperties, | ||
) | ||
from docutils.parsers import rst | ||
|
||
# Register custom directives | ||
|
||
|
||
rst.directives.register_directive("devices", SupportedDevices) | ||
rst.directives.register_directive("properties", SupportedProperties) | ||
rst.directives.register_directive("customcardstart", CustomCardStart) | ||
rst.directives.register_directive("customcarditem", CustomCardItem) | ||
rst.directives.register_directive("customcardend", CustomCardEnd) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The executorch repo currently has a checked-in directory named
build
, so we can't ignore it here, and we can't usebuild
as the place for temporary artifacts. Would it be possible to use a name likedocs-out
? Maybe even putsphinxbuild_{py,cpp}
under that top-level output directory to keep things cleaner at the root?