##// 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 MANIFEST
1 MANIFEST
2 build
2 build
3 dist
3 dist
4 _build
4 _build
5 docs/man/*.gz
5 docs/man/*.gz
6 docs/source/api/generated
6 docs/source/api/generated
7 docs/source/config/options
7 docs/gh-pages
8 docs/gh-pages
8 IPython/html/notebook/static/mathjax
9 IPython/html/notebook/static/mathjax
9 *.py[co]
10 *.py[co]
10 __pycache__
11 __pycache__
11 build
12 build
12 *.egg-info
13 *.egg-info
13 *~
14 *~
14 *.bak
15 *.bak
15 .ipynb_checkpoints
16 .ipynb_checkpoints
16 .tox
17 .tox
@@ -1,144 +1,151
1 # Makefile for Sphinx documentation
1 # Makefile for Sphinx documentation
2 #
2 #
3
3
4 # You can set these variables from the command line.
4 # You can set these variables from the command line.
5 SPHINXOPTS =
5 SPHINXOPTS =
6 SPHINXBUILD = sphinx-build
6 SPHINXBUILD = sphinx-build
7 PAPER =
7 PAPER =
8 SRCDIR = source
8 SRCDIR = source
9 BUILDDIR = build
9 BUILDDIR = build
10
10
11 # Internal variables.
11 # Internal variables.
12 PAPEROPT_a4 = -D latex_paper_size=a4
12 PAPEROPT_a4 = -D latex_paper_size=a4
13 PAPEROPT_letter = -D latex_paper_size=letter
13 PAPEROPT_letter = -D latex_paper_size=letter
14 ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
14 ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
15
15
16 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck api
16 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck api
17
17
18 default: html
18 default: html
19
19
20 help:
20 help:
21 @echo "Please use \`make <target>' where <target> is one of"
21 @echo "Please use \`make <target>' where <target> is one of"
22 @echo " html standalone HTML files"
22 @echo " html standalone HTML files"
23 @echo " html_noapi same as above, without the time consuming API docs"
23 @echo " html_noapi same as above, without the time consuming API docs"
24 @echo " pickle pickle files (usable by e.g. sphinx-web)"
24 @echo " pickle pickle files (usable by e.g. sphinx-web)"
25 @echo " htmlhelp HTML files and a HTML help project"
25 @echo " htmlhelp HTML files and a HTML help project"
26 @echo " latex LaTeX files, you can set PAPER=a4 or PAPER=letter"
26 @echo " latex LaTeX files, you can set PAPER=a4 or PAPER=letter"
27 @echo " texinfo Texinfo files"
27 @echo " texinfo Texinfo files"
28 @echo " info Texinfo files and run them through makeinfo"
28 @echo " info Texinfo files and run them through makeinfo"
29 @echo " changes an overview over all changed/added/deprecated items"
29 @echo " changes an overview over all changed/added/deprecated items"
30 @echo " linkcheck check all external links for integrity (takes a long time)"
30 @echo " linkcheck check all external links for integrity (takes a long time)"
31 @echo
31 @echo
32 @echo "Compound utility targets:"
32 @echo "Compound utility targets:"
33 @echo "pdf latex and then runs the PDF generation"
33 @echo "pdf latex and then runs the PDF generation"
34 @echo "all html and pdf"
34 @echo "all html and pdf"
35 @echo "dist all, and then puts the results in dist/"
35 @echo "dist all, and then puts the results in dist/"
36 @echo "gitwash-update update git workflow from source repo"
36 @echo "gitwash-update update git workflow from source repo"
37
37
38 clean_api:
38 clean_api:
39 -rm -rf $(SRCDIR)/api/generated
39 -rm -rf $(SRCDIR)/api/generated
40
40
41 clean: clean_api
41 clean: clean_api
42 -rm -rf build/* dist/*
42 -rm -rf build/* dist/*
43 -rm -rf $(SRCDIR)/config/options/generated
43
44
44 pdf: latex
45 pdf: latex
45 cd build/latex && make all-pdf
46 cd build/latex && make all-pdf
46
47
47 all: html pdf
48 all: html pdf
48
49
49 # For final distribution, only build HTML (our pdf is now so large as to be
50 # For final distribution, only build HTML (our pdf is now so large as to be
50 # unusable, takes forever to build and just bloats the downloads). We leave
51 # unusable, takes forever to build and just bloats the downloads). We leave
51 # them hardlinked at the top-level so users find them easily, though the
52 # them hardlinked at the top-level so users find them easily, though the
52 # original build/html dir is left in-place (useful to reload builds while
53 # original build/html dir is left in-place (useful to reload builds while
53 # testing).
54 # testing).
54 dist: html
55 dist: html
55 rm -rf html
56 rm -rf html
56 cp -al build/html .
57 cp -al build/html .
57 @echo "Build finished. Final docs are in html/"
58 @echo "Build finished. Final docs are in html/"
58
59
59 html: api
60 html: api autoconfig
60 html_noapi: clean_api
61 html_noapi: clean_api autoconfig
61
62
62 html html_noapi:
63 html html_noapi:
63 mkdir -p build/html build/doctrees
64 mkdir -p build/html build/doctrees
64 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
65 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
65 @echo
66 @echo
66 @echo "Build finished. The HTML pages are in build/html."
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 api: source/api/generated/gen.txt
75 api: source/api/generated/gen.txt
69
76
70 source/api/generated/gen.txt:
77 source/api/generated/gen.txt:
71 python autogen_api.py
78 python autogen_api.py
72 @echo "Build API docs finished."
79 @echo "Build API docs finished."
73
80
74 pickle:
81 pickle:
75 mkdir -p build/pickle build/doctrees
82 mkdir -p build/pickle build/doctrees
76 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
83 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
77 @echo
84 @echo
78 @echo "Build finished; now you can process the pickle files or run"
85 @echo "Build finished; now you can process the pickle files or run"
79 @echo " sphinx-web build/pickle"
86 @echo " sphinx-web build/pickle"
80 @echo "to start the sphinx-web server."
87 @echo "to start the sphinx-web server."
81
88
82 web: pickle
89 web: pickle
83
90
84 htmlhelp:
91 htmlhelp:
85 mkdir -p build/htmlhelp build/doctrees
92 mkdir -p build/htmlhelp build/doctrees
86 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
93 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
87 @echo
94 @echo
88 @echo "Build finished; now you can run HTML Help Workshop with the" \
95 @echo "Build finished; now you can run HTML Help Workshop with the" \
89 ".hhp project file in build/htmlhelp."
96 ".hhp project file in build/htmlhelp."
90
97
91 qthelp:
98 qthelp:
92 mkdir -p build/qthelp
99 mkdir -p build/qthelp
93 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
100 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
94 @echo
101 @echo
95 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
102 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
96 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
103 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
97 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IPython.qhcp"
104 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IPython.qhcp"
98 @echo "To view the help file:"
105 @echo "To view the help file:"
99 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IPython.qhc"
106 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IPython.qhc"
100
107
101 latex: api
108 latex: api autoconfig
102 mkdir -p build/latex build/doctrees
109 mkdir -p build/latex build/doctrees
103 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
110 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
104 @echo
111 @echo
105 @echo "Build finished; the LaTeX files are in build/latex."
112 @echo "Build finished; the LaTeX files are in build/latex."
106 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
113 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
107 "run these through (pdf)latex."
114 "run these through (pdf)latex."
108
115
109 changes:
116 changes:
110 mkdir -p build/changes build/doctrees
117 mkdir -p build/changes build/doctrees
111 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
118 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
112 @echo
119 @echo
113 @echo "The overview file is in build/changes."
120 @echo "The overview file is in build/changes."
114
121
115 linkcheck:
122 linkcheck:
116 mkdir -p build/linkcheck build/doctrees
123 mkdir -p build/linkcheck build/doctrees
117 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
124 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
118 @echo
125 @echo
119 @echo "Link check complete; look for any errors in the above output " \
126 @echo "Link check complete; look for any errors in the above output " \
120 "or in build/linkcheck/output.rst."
127 "or in build/linkcheck/output.rst."
121
128
122 gitwash-update:
129 gitwash-update:
123 python ../tools/gitwash_dumper.py source/development ipython
130 python ../tools/gitwash_dumper.py source/development ipython
124
131
125 nightly: dist
132 nightly: dist
126 rsync -avH --delete dist/ ipython:www/doc/nightly
133 rsync -avH --delete dist/ ipython:www/doc/nightly
127
134
128 gh-pages: clean html
135 gh-pages: clean html
129 python gh-pages.py
136 python gh-pages.py
130
137
131 texinfo:
138 texinfo:
132 mkdir -p $(BUILDDIR)/texinfo
139 mkdir -p $(BUILDDIR)/texinfo
133 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
140 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
134 @echo
141 @echo
135 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
142 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
136 @echo "Run \`make' in that directory to run these through makeinfo" \
143 @echo "Run \`make' in that directory to run these through makeinfo" \
137 "(use \`make info' here to do that automatically)."
144 "(use \`make info' here to do that automatically)."
138
145
139 info:
146 info:
140 mkdir -p $(BUILDDIR)/texinfo
147 mkdir -p $(BUILDDIR)/texinfo
141 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
148 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
142 @echo "Running Texinfo files through makeinfo..."
149 @echo "Running Texinfo files through makeinfo..."
143 make -C $(BUILDDIR)/texinfo info
150 make -C $(BUILDDIR)/texinfo info
144 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
151 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
@@ -1,14 +1,15
1 .. _config_index:
1 .. _config_index:
2
2
3 ===============================
3 ===============================
4 Configuration and customization
4 Configuration and customization
5 ===============================
5 ===============================
6
6
7 .. toctree::
7 .. toctree::
8 :maxdepth: 2
8 :maxdepth: 2
9
9
10 intro
10 intro
11 options/index
11 extensions/index
12 extensions/index
12 integrating
13 integrating
13 inputtransforms
14 inputtransforms
14 details
15 details
General Comments 0
You need to be logged in to leave comments. Login now