Skip to content

Commit 932450a

Browse files
PaliCfacebook-github-bot
authored andcommitted
Preliminary sphinx docs (#217)
Summary: Here we provide the beginnings of our sphinx documentation. Here we provide 1. We split up the ReadMe into the setup documentation / installation and the example 2. Created a tutorials section which includes the quickstart/example in the ReadMe.md and the text for the hello world example. 3. Uses exhale to generate the basic C++ documentation (we still need to add comments for it to be actual documentation). In order to test download/setup [sphinx](https://www.sphinx-doc.org/en/master/usage/quickstart.html) and [exhale](https://exhale.readthedocs.io/en/1.x/) and run `make html` Pull Request resolved: #217 Reviewed By: anirbanr-fb-r2p Differential Revision: D40535253 Pulled By: PaliC fbshipit-source-id: fa7349dbabb84df6eff0778c80b80993a1056ca8
1 parent 85a5a5e commit 932450a

22 files changed

+975
-144
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
multipy/runtime/example/generated/
88
examples/**/*.pt
99
*.egg-info
10+
.DS_Store
11+
**/.DS_Store/**
12+
docs/source/api/
13+
docs/src/

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = multipy
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/requirements.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sphinx==5.0.1
2+
-e git+http://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
3+
sphinx-gallery<=0.7.0
4+
sphinxcontrib.katex
5+
matplotlib
6+
papermill
7+
jinja2<=3.0.3
8+
exhale

docs/source/Doxyfile

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
################################################################################
2+
# Primary project setup. #
3+
################################################################################
4+
PROJECT_NAME = "MultiPy"
5+
# Parent directory of where Doxygen should output files. Cannot be for example
6+
# `../build/doxygen` because if `../build` does not exist Doxygen will error.
7+
OUTPUT_DIRECTORY = ../build
8+
# XML output stored in ${OUTPUT_DIRECTORY}/${XML_OUTPUT}. Must agree
9+
# with what is specified to `breathe_projects` in `conf.py`.
10+
XML_OUTPUT = xml
11+
# HTML output stored in ${OUTPUT_DIRECTORY}/${HTML_OUTPUT}.
12+
# NOTE: it can be useful to have Doxygen generate HTML to verify what sphinx is
13+
# creating, or to generate HTML documentation to check a docstring you are
14+
# writing without needing to wait for Sphinx.
15+
#
16+
# # Must run from this directory (see relative paths below...)
17+
# $ cd /path/to/pytorch/docs/cpp/source
18+
#
19+
# # Send configs in this file plus `GENERATE_HTML=YES` to doxygen on stdin
20+
# $ (cat Doxyfile; echo 'GENERATE_HTML = YES') | doxygen -
21+
#
22+
# # View the doxygen results.
23+
# $ open ../build/doxygen_html/index.html
24+
#
25+
# This sends everything in this file plus `GENERATE_HTML = YES` to doxygen
26+
# on stdin. Without needing to edit this `Doxyfile` directly.
27+
HTML_OUTPUT = doxygen_html
28+
# Strip the path prefix. *MUST* agree with `exhale_args` in conf.py.
29+
# {repo_root}/docs/cpp/source/../../.. -> {repo_root}
30+
STRIP_FROM_PATH = ../../..
31+
# What folders / files Doxygen should process.
32+
INPUT = ../../multipy/runtime/deploy.h \
33+
../../multipy/runtime/interpreter/plugin_registry.h \
34+
../../multipy/runtime/interpreter/interpreter_impl.h \
35+
../../multipy/runtime/environment.h \
36+
../../multipy/runtime/path_environment.h \
37+
../../multipy/runtime/noop_environment.h \
38+
# Don't include .cpp files!
39+
FILE_PATTERNS = *.h
40+
# If you need this to be YES, exhale will probably break.
41+
CREATE_SUBDIRS = NO
42+
# So that Doxygen does not trim paths, which affects the file hierarchy
43+
FULL_PATH_NAMES = YES
44+
# Nested folders will be ignored without this.
45+
RECURSIVE = YES
46+
# Increase the max node size for our large files
47+
DOT_GRAPH_MAX_NODES = 100
48+
################################################################################
49+
# Output formats for Doxygen to create. #
50+
################################################################################
51+
# Set to YES if you are debugging or want to compare.
52+
GENERATE_HTML = NO
53+
# Unless you want it...
54+
GENERATE_LATEX = NO
55+
# Both breathe and exhale need the xml.
56+
GENERATE_XML = YES
57+
# Set to NO if you do not want the Doxygen program listing included.
58+
# NOTE: setting to NO may result in unrecovered file relationships
59+
# (which file defined which compound)
60+
XML_PROGRAMLISTING = YES
61+
################################################################################
62+
# Doxygen preprocessor / parser control. #
63+
################################################################################
64+
ENABLE_PREPROCESSING = YES
65+
MACRO_EXPANSION = YES
66+
EXPAND_ONLY_PREDEF = NO
67+
SKIP_FUNCTION_MACROS = NO
68+
# Extra defs for to help with building the _right_ version of the docs
69+
PREDEFINED = DOXYGEN_DOCUMENTATION_BUILD
70+
PREDEFINED += DOXYGEN_SHOULD_SKIP_THIS
71+
# Symbol expansion to follow for #include statements (not input)
72+
SEARCH_INCLUDES = YES
73+
# INCLUDE_PATH = ../.. \
74+
# ../../torch/csrc/api/include \
75+
################################################################################
76+
# Compound extraction control. #
77+
################################################################################
78+
EXTRACT_ALL = YES
79+
EXTRACT_PACKAGE = YES
80+
EXTRACT_STATIC = YES
81+
CASE_SENSE_NAMES = NO
82+
EXCLUDE_SYMBOLS = caffe2::* cereal* DL* TH* cudnn* std::* *Impl* *InterpreterObj* *PickledObject
83+
################################################################################
84+
# Docstring control / customization. #
85+
################################################################################
86+
# First line of /** comment */ treated as \brief
87+
JAVADOC_AUTOBRIEF = YES
88+
# Allow for rst directives and advanced functions e.g. grid tables
89+
# Example:
90+
# /**
91+
# * \rst
92+
# * .. code-block:: cpp
93+
# *
94+
# * int main() {
95+
# * return 0;
96+
# * }
97+
# *
98+
# * \endrst
99+
# */
100+
# NOTE:
101+
# 1. \rst and \endrst must be on their own line.
102+
# 2. leading-asterisk required.
103+
ALIASES = "rst=\verbatim embed:rst:leading-asterisk"
104+
ALIASES += "endrst=\endverbatim"
105+
################################################################################
106+
# Warning suppression. #
107+
################################################################################
108+
QUIET = YES
109+
WARN_IF_UNDOCUMENTED = NO

0 commit comments

Comments
 (0)