##// END OF EJS Templates
Merge branch 'doc-config-options' into docs-refresh...
Thomas Kluyver -
r13498:36514bb6 merge
parent child Browse files
Show More
@@ -0,0 +1,74
1 from IPython.utils.text import indent, wrap_paragraphs
2
3 from IPython.terminal.ipapp import TerminalIPythonApp
4 from IPython.kernel.zmq.kernelapp import IPKernelApp
5 from IPython.html.notebookapp import NotebookApp
6 from IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp
7
8 def document_config_options(classes):
9 lines = []
10 for cls in classes:
11 classname = cls.__name__
12 for k, trait in sorted(cls.class_traits(config=True).items()):
13 ttype = trait.__class__.__name__
14
15 termline = classname + '.' + trait.name
16
17 # Choices or type
18 if 'Enum' in ttype:
19 # include Enum choices
20 termline += ' : ' + '|'.join(repr(x) for x in trait.values)
21 else:
22 termline += ' : ' + ttype
23 lines.append(termline)
24
25 # Default value
26 try:
27 dv = trait.get_default_value()
28 dvr = repr(dv)
29 except Exception:
30 dvr = dv = None # ignore defaults we can't construct
31 if (dv is not None) and (dvr is not None):
32 if len(dvr) > 64:
33 dvr = dvr[:61]+'...'
34 # Double up backslashes, so they get to the rendered docs
35 dvr = dvr.replace('\\n', '\\\\n')
36 lines.append(' Default: ' + dvr)
37 lines.append('')
38
39 help = trait.get_metadata('help')
40 if help is not None:
41 help = '\n'.join(wrap_paragraphs(help, 76))
42 lines.append(indent(help, 4))
43 else:
44 lines.append(' No description')
45
46 lines.append('')
47 return '\n'.join(lines)
48
49 kernel_classes = IPKernelApp().classes
50
51 def write_doc(filename, title, classes, preamble=None):
52 configdoc = document_config_options(classes)
53 with open('source/config/options/%s.rst' % filename, 'w') as f:
54 f.write(title + '\n')
55 f.write(('=' * len(title)) + '\n')
56 f.write('\n')
57 if preamble is not None:
58 f.write(preamble + '\n\n')
59 f.write(configdoc)
60
61 if __name__ == '__main__':
62 write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp().classes)
63 write_doc('kernel', 'IPython kernel options', kernel_classes,
64 preamble="These options can be used in :file:`ipython_notebook_config.py` "
65 "or in :file:`ipython_qtconsole_config.py`")
66 nbclasses = set(NotebookApp().classes) - set(kernel_classes)
67 write_doc('notebook', 'IPython notebook options', nbclasses,
68 preamble="Any of the :doc:`kernel` can also be used.")
69 qtclasses = set(IPythonQtConsoleApp().classes) - set(kernel_classes)
70 write_doc('qtconsole', 'IPython Qt console options', qtclasses,
71 preamble="Any of the :doc:`kernel` can also be used.")
72
73 with open('source/config/options/generated', 'w'):
74 pass No newline at end of file
@@ -0,0 +1,10
1 ===============
2 IPython options
3 ===============
4
5 .. toctree::
6
7 terminal
8 kernel
9 notebook
10 qtconsole
@@ -1,16 +1,17
1 1 MANIFEST
2 2 build
3 3 dist
4 4 _build
5 5 docs/man/*.gz
6 6 docs/source/api/generated
7 docs/source/config/options
7 8 docs/gh-pages
8 9 IPython/html/notebook/static/mathjax
9 10 *.py[co]
10 11 __pycache__
11 12 build
12 13 *.egg-info
13 14 *~
14 15 *.bak
15 16 .ipynb_checkpoints
16 17 .tox
@@ -1,144 +1,151
1 1 # Makefile for Sphinx documentation
2 2 #
3 3
4 4 # You can set these variables from the command line.
5 5 SPHINXOPTS =
6 6 SPHINXBUILD = sphinx-build
7 7 PAPER =
8 8 SRCDIR = source
9 9 BUILDDIR = build
10 10
11 11 # Internal variables.
12 12 PAPEROPT_a4 = -D latex_paper_size=a4
13 13 PAPEROPT_letter = -D latex_paper_size=letter
14 14 ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
15 15
16 16 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck api
17 17
18 18 default: html
19 19
20 20 help:
21 21 @echo "Please use \`make <target>' where <target> is one of"
22 22 @echo " html standalone HTML files"
23 23 @echo " html_noapi same as above, without the time consuming API docs"
24 24 @echo " pickle pickle files (usable by e.g. sphinx-web)"
25 25 @echo " htmlhelp HTML files and a HTML help project"
26 26 @echo " latex LaTeX files, you can set PAPER=a4 or PAPER=letter"
27 27 @echo " texinfo Texinfo files"
28 28 @echo " info Texinfo files and run them through makeinfo"
29 29 @echo " changes an overview over all changed/added/deprecated items"
30 30 @echo " linkcheck check all external links for integrity (takes a long time)"
31 31 @echo
32 32 @echo "Compound utility targets:"
33 33 @echo "pdf latex and then runs the PDF generation"
34 34 @echo "all html and pdf"
35 35 @echo "dist all, and then puts the results in dist/"
36 36 @echo "gitwash-update update git workflow from source repo"
37 37
38 38 clean_api:
39 39 -rm -rf $(SRCDIR)/api/generated
40 40
41 41 clean: clean_api
42 42 -rm -rf build/* dist/*
43 -rm -rf $(SRCDIR)/config/options/generated
43 44
44 45 pdf: latex
45 46 cd build/latex && make all-pdf
46 47
47 48 all: html pdf
48 49
49 50 # For final distribution, only build HTML (our pdf is now so large as to be
50 51 # unusable, takes forever to build and just bloats the downloads). We leave
51 52 # them hardlinked at the top-level so users find them easily, though the
52 53 # original build/html dir is left in-place (useful to reload builds while
53 54 # testing).
54 55 dist: html
55 56 rm -rf html
56 57 cp -al build/html .
57 58 @echo "Build finished. Final docs are in html/"
58 59
59 html: api
60 html_noapi: clean_api
60 html: api autoconfig
61 html_noapi: clean_api autoconfig
61 62
62 63 html html_noapi:
63 64 mkdir -p build/html build/doctrees
64 65 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
65 66 @echo
66 67 @echo "Build finished. The HTML pages are in build/html."
67 68
69 autoconfig: source/config/options/generated
70
71 source/config/options/generated:
72 python autogen_config.py
73 @echo "Created docs for config options"
74
68 75 api: source/api/generated/gen.txt
69 76
70 77 source/api/generated/gen.txt:
71 78 python autogen_api.py
72 79 @echo "Build API docs finished."
73 80
74 81 pickle:
75 82 mkdir -p build/pickle build/doctrees
76 83 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
77 84 @echo
78 85 @echo "Build finished; now you can process the pickle files or run"
79 86 @echo " sphinx-web build/pickle"
80 87 @echo "to start the sphinx-web server."
81 88
82 89 web: pickle
83 90
84 91 htmlhelp:
85 92 mkdir -p build/htmlhelp build/doctrees
86 93 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
87 94 @echo
88 95 @echo "Build finished; now you can run HTML Help Workshop with the" \
89 96 ".hhp project file in build/htmlhelp."
90 97
91 98 qthelp:
92 99 mkdir -p build/qthelp
93 100 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
94 101 @echo
95 102 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
96 103 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
97 104 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IPython.qhcp"
98 105 @echo "To view the help file:"
99 106 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IPython.qhc"
100 107
101 latex: api
108 latex: api autoconfig
102 109 mkdir -p build/latex build/doctrees
103 110 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
104 111 @echo
105 112 @echo "Build finished; the LaTeX files are in build/latex."
106 113 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
107 114 "run these through (pdf)latex."
108 115
109 116 changes:
110 117 mkdir -p build/changes build/doctrees
111 118 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
112 119 @echo
113 120 @echo "The overview file is in build/changes."
114 121
115 122 linkcheck:
116 123 mkdir -p build/linkcheck build/doctrees
117 124 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
118 125 @echo
119 126 @echo "Link check complete; look for any errors in the above output " \
120 127 "or in build/linkcheck/output.rst."
121 128
122 129 gitwash-update:
123 130 python ../tools/gitwash_dumper.py source/development ipython
124 131
125 132 nightly: dist
126 133 rsync -avH --delete dist/ ipython:www/doc/nightly
127 134
128 135 gh-pages: clean html
129 136 python gh-pages.py
130 137
131 138 texinfo:
132 139 mkdir -p $(BUILDDIR)/texinfo
133 140 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
134 141 @echo
135 142 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
136 143 @echo "Run \`make' in that directory to run these through makeinfo" \
137 144 "(use \`make info' here to do that automatically)."
138 145
139 146 info:
140 147 mkdir -p $(BUILDDIR)/texinfo
141 148 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
142 149 @echo "Running Texinfo files through makeinfo..."
143 150 make -C $(BUILDDIR)/texinfo info
144 151 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
@@ -1,14 +1,15
1 1 .. _config_index:
2 2
3 3 ===============================
4 4 Configuration and customization
5 5 ===============================
6 6
7 7 .. toctree::
8 8 :maxdepth: 2
9 9
10 10 intro
11 options/index
11 12 extensions/index
12 13 integrating
13 14 inputtransforms
14 15 details
General Comments 0
You need to be logged in to leave comments. Login now