Skip to content

Commit 0aa8ce0

Browse files
committed
[TOP] level4 except argmax/min, correct split (apache#9)
* [TOP] level4 except argmax/min, correct split * [DOCS] Add doc generator for top
1 parent 5f67794 commit 0aa8ce0

File tree

21 files changed

+1129
-63
lines changed

21 files changed

+1129
-63
lines changed

nnvm/docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
doxygen
2+
_build

nnvm/docs/Makefile

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
PAPER =
8+
BUILDDIR = _build
9+
10+
# User-friendly check for sphinx-build
11+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13+
endif
14+
15+
# Internal variables.
16+
PAPEROPT_a4 = -D latex_paper_size=a4
17+
PAPEROPT_letter = -D latex_paper_size=letter
18+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
19+
# the i18n builder cannot share the environment and doctrees with the others
20+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21+
22+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
23+
24+
help:
25+
@echo "Please use \`make <target>' where <target> is one of"
26+
@echo " html to make standalone HTML files"
27+
@echo " dirhtml to make HTML files named index.html in directories"
28+
@echo " singlehtml to make a single large HTML file"
29+
@echo " pickle to make pickle files"
30+
@echo " json to make JSON files"
31+
@echo " htmlhelp to make HTML files and a HTML help project"
32+
@echo " qthelp to make HTML files and a qthelp project"
33+
@echo " applehelp to make an Apple Help Book"
34+
@echo " devhelp to make HTML files and a Devhelp project"
35+
@echo " epub to make an epub"
36+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
38+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
39+
@echo " text to make text files"
40+
@echo " man to make manual pages"
41+
@echo " texinfo to make Texinfo files"
42+
@echo " info to make Texinfo files and run them through makeinfo"
43+
@echo " gettext to make PO message catalogs"
44+
@echo " changes to make an overview of all changed/added/deprecated items"
45+
@echo " xml to make Docutils-native XML files"
46+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
47+
@echo " linkcheck to check all external links for integrity"
48+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
49+
@echo " coverage to run coverage check of the documentation (if enabled)"
50+
51+
clean:
52+
rm -rf $(BUILDDIR)/*
53+
rm -rf gen_modules
54+
55+
html:
56+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
57+
@echo
58+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
59+
60+
dirhtml:
61+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
62+
@echo
63+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
64+
65+
singlehtml:
66+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
67+
@echo
68+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
69+
70+
pickle:
71+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
72+
@echo
73+
@echo "Build finished; now you can process the pickle files."
74+
75+
json:
76+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
77+
@echo
78+
@echo "Build finished; now you can process the JSON files."
79+
80+
htmlhelp:
81+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
82+
@echo
83+
@echo "Build finished; now you can run HTML Help Workshop with the" \
84+
".hhp project file in $(BUILDDIR)/htmlhelp."
85+
86+
qthelp:
87+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
88+
@echo
89+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
90+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
91+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/rabit.qhcp"
92+
@echo "To view the help file:"
93+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/rabit.qhc"
94+
95+
applehelp:
96+
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
97+
@echo
98+
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
99+
@echo "N.B. You won't be able to view it unless you put it in" \
100+
"~/Library/Documentation/Help or install it in your application" \
101+
"bundle."
102+
103+
devhelp:
104+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
105+
@echo
106+
@echo "Build finished."
107+
@echo "To view the help file:"
108+
@echo "# mkdir -p $$HOME/.local/share/devhelp/rabit"
109+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/rabit"
110+
@echo "# devhelp"
111+
112+
epub:
113+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
114+
@echo
115+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
116+
117+
latex:
118+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
119+
@echo
120+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
121+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
122+
"(use \`make latexpdf' here to do that automatically)."
123+
124+
latexpdf:
125+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
126+
@echo "Running LaTeX files through pdflatex..."
127+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
128+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
129+
130+
latexpdfja:
131+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
132+
@echo "Running LaTeX files through platex and dvipdfmx..."
133+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
134+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
135+
136+
text:
137+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
138+
@echo
139+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
140+
141+
man:
142+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
143+
@echo
144+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
145+
146+
texinfo:
147+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
148+
@echo
149+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
150+
@echo "Run \`make' in that directory to run these through makeinfo" \
151+
"(use \`make info' here to do that automatically)."
152+
153+
info:
154+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
155+
@echo "Running Texinfo files through makeinfo..."
156+
make -C $(BUILDDIR)/texinfo info
157+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
158+
159+
gettext:
160+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
161+
@echo
162+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
163+
164+
changes:
165+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
166+
@echo
167+
@echo "The overview file is in $(BUILDDIR)/changes."
168+
169+
linkcheck:
170+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
171+
@echo
172+
@echo "Link check complete; look for any errors in the above output " \
173+
"or in $(BUILDDIR)/linkcheck/output.txt."
174+
175+
doctest:
176+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
177+
@echo "Testing of doctests in the sources finished, look at the " \
178+
"results in $(BUILDDIR)/doctest/output.txt."
179+
180+
coverage:
181+
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
182+
@echo "Testing of coverage in the sources finished, look at the " \
183+
"results in $(BUILDDIR)/coverage/python.txt."
184+
185+
xml:
186+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
187+
@echo
188+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
189+
190+
pseudoxml:
191+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
192+
@echo
193+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

nnvm/docs/conf.py

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# documentation build configuration file, created by
4+
# sphinx-quickstart on Thu Jul 23 19:40:08 2015.
5+
#
6+
# This file is execfile()d with the current directory set to its
7+
# containing dir.
8+
#
9+
# Note that not all possible configuration values are present in this
10+
# autogenerated file.
11+
#
12+
# All configuration values have a default; values that are commented out
13+
# serve to show the default.
14+
import sys
15+
import os, subprocess
16+
import shlex
17+
import recommonmark
18+
from recommonmark.parser import CommonMarkParser
19+
from recommonmark.transform import AutoStructify
20+
21+
# If extensions (or modules to document with autodoc) are in another directory,
22+
# add these directories to sys.path here. If the directory is relative to the
23+
# documentation root, use os.path.abspath to make it absolute, like shown here.
24+
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
25+
sys.path.insert(0, os.path.join(curr_path, '../python/'))
26+
27+
# -- General configuration ------------------------------------------------
28+
29+
# General information about the project.
30+
project = u'nnvm'
31+
author = u'%s developers' % project
32+
copyright = u'2017, %s' % author
33+
github_doc_root = 'https://github.com/dmlc/nnvm/tree/master/docs/'
34+
35+
# add markdown parser
36+
CommonMarkParser.github_doc_root = github_doc_root
37+
source_parsers = {
38+
'.md': CommonMarkParser
39+
}
40+
os.environ['NNVM_BUILD_DOC'] = '1'
41+
# Version information.
42+
import nnvm
43+
version = nnvm.__version__
44+
release = nnvm.__version__
45+
46+
# Add any Sphinx extension module names here, as strings. They can be
47+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones
48+
extensions = [
49+
'sphinx.ext.autodoc',
50+
'sphinx.ext.autosummary',
51+
'sphinx.ext.intersphinx',
52+
'sphinx.ext.napoleon',
53+
'sphinx.ext.mathjax'
54+
]
55+
56+
# Add any paths that contain templates here, relative to this directory.
57+
templates_path = ['_templates']
58+
59+
# The suffix(es) of source filenames.
60+
# You can specify multiple suffix as a list of string:
61+
# source_suffix = ['.rst', '.md']
62+
source_suffix = ['.rst', '.md']
63+
64+
# The encoding of source files.
65+
#source_encoding = 'utf-8-sig'
66+
67+
# generate autosummary even if no references
68+
autosummary_generate = True
69+
70+
# The master toctree document.
71+
master_doc = 'index'
72+
73+
# The language for content autogenerated by Sphinx. Refer to documentation
74+
# for a list of supported languages.
75+
#
76+
# This is also used if you do content translation via gettext catalogs.
77+
# Usually you set "language" from the command line for these cases.
78+
language = None
79+
80+
# There are two options for replacing |today|: either, you set today to some
81+
# non-false value, then it is used:
82+
#today = ''
83+
# Else, today_fmt is used as the format for a strftime call.
84+
#today_fmt = '%B %d, %Y'
85+
86+
# List of patterns, relative to source directory, that match files and
87+
# directories to ignore when looking for source files.
88+
exclude_patterns = ['_build']
89+
90+
# The reST default role (used for this markup: `text`) to use for all
91+
# documents.
92+
#default_role = None
93+
94+
# If true, '()' will be appended to :func: etc. cross-reference text.
95+
#add_function_parentheses = True
96+
97+
# If true, the current module name will be prepended to all description
98+
# unit titles (such as .. function::).
99+
#add_module_names = True
100+
101+
# If true, sectionauthor and moduleauthor directives will be shown in the
102+
# output. They are ignored by default.
103+
#show_authors = False
104+
105+
# The name of the Pygments (syntax highlighting) style to use.
106+
pygments_style = 'sphinx'
107+
108+
# A list of ignored prefixes for module index sorting.
109+
#modindex_common_prefix = []
110+
111+
# If true, keep warnings as "system message" paragraphs in the built documents.
112+
#keep_warnings = False
113+
114+
# If true, `todo` and `todoList` produce output, else they produce nothing.
115+
todo_include_todos = False
116+
117+
# -- Options for HTML output ----------------------------------------------
118+
119+
# The theme is set by the make target
120+
html_theme = os.environ.get('NNVM_THEME', 'rtd')
121+
122+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
123+
# only import rtd theme and set it if want to build docs locally
124+
if not on_rtd and html_theme == 'rtd':
125+
import sphinx_rtd_theme
126+
html_theme = 'sphinx_rtd_theme'
127+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
128+
129+
# Add any paths that contain custom static files (such as style sheets) here,
130+
# relative to this directory. They are copied after the builtin static files,
131+
# so a file named "default.css" will overwrite the builtin "default.css".
132+
html_static_path = ['_static']
133+
134+
# Output file base name for HTML help builder.
135+
htmlhelp_basename = project + 'doc'
136+
137+
# -- Options for LaTeX output ---------------------------------------------
138+
latex_elements = {
139+
}
140+
141+
# Grouping the document tree into LaTeX files. List of tuples
142+
# (source start file, target name, title,
143+
# author, documentclass [howto, manual, or own class]).
144+
latex_documents = [
145+
(master_doc, '%s.tex' % project, project,
146+
author, 'manual'),
147+
]
148+
149+
# hook for doxygen
150+
def run_doxygen(folder):
151+
"""Run the doxygen make command in the designated folder."""
152+
try:
153+
#retcode = subprocess.call("cd %s; make doc" % folder, shell=True)
154+
retcode = subprocess.call("rm -rf _build/html/doxygen", shell=True)
155+
retcode = subprocess.call("mkdir -p _build/html", shell=True)
156+
retcode = subprocess.call("cp -rf doxygen/html _build/html/doxygen", shell=True)
157+
if retcode < 0:
158+
sys.stderr.write("doxygen terminated by signal %s" % (-retcode))
159+
except OSError as e:
160+
sys.stderr.write("doxygen execution failed: %s" % e)
161+
162+
intersphinx_mapping = {
163+
'python': ('https://docs.python.org/{.major}'.format(sys.version_info), None),
164+
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
165+
'scipy': ('http://docs.scipy.org/doc/scipy/reference', None),
166+
'matplotlib': ('http://matplotlib.org/', None),
167+
}
168+
169+
170+
def generate_doxygen_xml(app):
171+
"""Run the doxygen make commands if we're on the ReadTheDocs server"""
172+
run_doxygen('..')
173+
174+
def setup(app):
175+
# Add hook for building doxygen xml when needed
176+
# no c++ API for now
177+
app.connect("builder-inited", generate_doxygen_xml)
178+
app.add_config_value('recommonmark_config', {
179+
'url_resolver': lambda url: github_doc_root + url,
180+
'auto_doc_ref': True
181+
}, True)
182+
app.add_transform(AutoStructify)

nnvm/docs/index.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
NNVM Documentation
2+
==================
3+
Welcome to NNVM documentation.
4+
5+
6+
Contents
7+
--------
8+
9+
.. toctree::
10+
:maxdepth: 1
11+
12+
top

0 commit comments

Comments
 (0)