##// END OF EJS Templates
gh-pages includes pdf...
MinRK -
Show More
@@ -1,110 +1,110 b''
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
10 10 # Internal variables.
11 11 PAPEROPT_a4 = -D latex_paper_size=a4
12 12 PAPEROPT_letter = -D latex_paper_size=letter
13 13 ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
14 14
15 15 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck api
16 16
17 17 default: html
18 18
19 19 help:
20 20 @echo "Please use \`make <target>' where <target> is one of"
21 21 @echo " html to make standalone HTML files"
22 22 @echo " pickle to make pickle files (usable by e.g. sphinx-web)"
23 23 @echo " htmlhelp to make HTML files and a HTML help project"
24 24 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
25 25 @echo " changes to make an overview over all changed/added/deprecated items"
26 26 @echo " linkcheck to check all external links for integrity"
27 27 @echo
28 28 @echo "Compound utility targets:"
29 29 @echo "pdf latex and then runs the PDF generation"
30 30 @echo "all html and pdf"
31 31 @echo "dist all, and then puts the results in dist/"
32 32 @echo "gitwash-update update git workflow from source repo"
33 33
34 34 clean:
35 35 -rm -rf build/* dist/* $(SRCDIR)/api/generated
36 36
37 37 pdf: latex
38 38 cd build/latex && make all-pdf
39 39
40 40 all: html pdf
41 41
42 42 dist: all
43 43 mkdir -p dist
44 44 rm -rf dist/*
45 45 ln build/latex/ipython.pdf dist/
46 46 cp -al build/html dist/
47 47 @echo "Build finished. Final docs are in dist/"
48 48
49 49 html: api
50 50 mkdir -p build/html build/doctrees
51 51 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
52 52 @echo
53 53 @echo "Build finished. The HTML pages are in build/html."
54 54
55 55 api: source/api/generated/gen.txt
56 56
57 57 source/api/generated/gen.txt:
58 58 python autogen_api.py
59 59 @echo "Build API docs finished."
60 60
61 61 pickle:
62 62 mkdir -p build/pickle build/doctrees
63 63 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
64 64 @echo
65 65 @echo "Build finished; now you can process the pickle files or run"
66 66 @echo " sphinx-web build/pickle"
67 67 @echo "to start the sphinx-web server."
68 68
69 69 web: pickle
70 70
71 71 htmlhelp:
72 72 mkdir -p build/htmlhelp build/doctrees
73 73 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
74 74 @echo
75 75 @echo "Build finished; now you can run HTML Help Workshop with the" \
76 76 ".hhp project file in build/htmlhelp."
77 77
78 78 latex: api
79 79 mkdir -p build/latex build/doctrees
80 80 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
81 81 @echo
82 82 @echo "Build finished; the LaTeX files are in build/latex."
83 83 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
84 84 "run these through (pdf)latex."
85 85
86 86 changes:
87 87 mkdir -p build/changes build/doctrees
88 88 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
89 89 @echo
90 90 @echo "The overview file is in build/changes."
91 91
92 92 linkcheck:
93 93 mkdir -p build/linkcheck build/doctrees
94 94 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
95 95 @echo
96 96 @echo "Link check complete; look for any errors in the above output " \
97 97 "or in build/linkcheck/output.txt."
98 98
99 99 gitwash-update:
100 100 python ../tools/gitwash_dumper.py source/development ipython
101 101 cd source/development/gitwash && rename 's/.rst/.txt/' *.rst
102 102
103 103 nightly: dist
104 104 rsync -avH --delete dist/ ipython:www/doc/nightly
105 105
106 gh-pages: html
106 gh-pages: html pdf
107 107 python gh-pages.py
108 108
109 gh-pages-current: html
110 python gh-pages.py current
109 gh-pages-current: html pdf
110 python gh-pages.py current "Current Development Version"
@@ -1,143 +1,158 b''
1 1 #!/usr/bin/env python
2 2 """Script to commit the doc build outputs into the github-pages repo.
3 3
4 4 Use:
5 5
6 6 gh-pages.py [tag]
7 7
8 8 If no tag is given, the current output of 'git describe' is used. If given,
9 9 that is how the resulting directory will be named.
10 10
11 11 In practice, you should use either actual clean tags from a current build or
12 12 something like 'current' as a stable URL for the most current version of the """
13 13
14 14 #-----------------------------------------------------------------------------
15 15 # Imports
16 16 #-----------------------------------------------------------------------------
17 17 import os
18 18 import re
19 19 import shutil
20 20 import sys
21 21 from os import chdir as cd
22 22 from os.path import join as pjoin
23 23
24 24 from subprocess import Popen, PIPE, CalledProcessError, check_call
25 25
26 26 #-----------------------------------------------------------------------------
27 27 # Globals
28 28 #-----------------------------------------------------------------------------
29 29
30 30 pages_dir = 'gh-pages'
31 31 html_dir = 'build/html'
32 pdf_dir = 'build/latex'
32 33 pages_repo = 'git@github.com:ipython/ipython-doc.git'
33 34
34 35 #-----------------------------------------------------------------------------
35 36 # Functions
36 37 #-----------------------------------------------------------------------------
37 38 def sh(cmd):
38 39 """Execute command in a subshell, return status code."""
39 40 return check_call(cmd, shell=True)
40 41
41 42
42 43 def sh2(cmd):
43 44 """Execute command in a subshell, return stdout.
44 45
45 46 Stderr is unbuffered from the subshell.x"""
46 47 p = Popen(cmd, stdout=PIPE, shell=True)
47 48 out = p.communicate()[0]
48 49 retcode = p.returncode
49 50 if retcode:
50 51 raise CalledProcessError(retcode, cmd)
51 52 else:
52 53 return out.rstrip()
53 54
54 55
55 56 def sh3(cmd):
56 57 """Execute command in a subshell, return stdout, stderr
57 58
58 59 If anything appears in stderr, print it out to sys.stderr"""
59 60 p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
60 61 out, err = p.communicate()
61 62 retcode = p.returncode
62 63 if retcode:
63 64 raise CalledProcessError(retcode, cmd)
64 65 else:
65 66 return out.rstrip(), err.rstrip()
66 67
67 68
68 69 def init_repo(path):
69 70 """clone the gh-pages repo if we haven't already."""
70 71 sh("git clone %s %s"%(pages_repo, path))
71 72 here = os.getcwd()
72 73 cd(path)
73 74 sh('git checkout gh-pages')
74 75 cd(here)
75 76
76 77
77 def render_htmlindex(fname, tag):
78 rel = '<li> Release: <a href="{t}/index.html">{t}</a>'.format(t=tag)
78 def render_htmlindex(fname, tag, desc=None):
79 if desc is None:
80 desc = tag
81
82 rel = '<li>{d}: <a href="{t}/index.html">HTML</a> and <a href="{t}/ipython.pdf">PDF</a>'.format(t=tag,d=desc)
79 83 rep = re.compile('<!-- RELEASE -->')
80 84 out = []
81 85 with file(fname) as f:
82 for line in f:
86 contents = f.read()
87 lines = contents.splitlines()
88 if rel in contents:
89 out = lines
90 else:
91 for line in lines:
83 92 out.append(line)
84 93 if rep.search(line):
85 94 out.append(rep.sub(rel, line))
86 return ''.join(out)
95 return '\n'.join(out)+'\n'
87 96
88 97
89 def new_htmlindex(fname, tag):
90 new_page = render_htmlindex(fname, tag)
98 def new_htmlindex(fname, tag, desc=None):
99 new_page = render_htmlindex(fname, tag, desc)
91 100 os.rename(fname, fname+'~')
92 101 with file(fname, 'w') as f:
93 102 f.write(new_page)
94 103
95 104
96 105 #-----------------------------------------------------------------------------
97 106 # Script starts
98 107 #-----------------------------------------------------------------------------
99 108 if __name__ == '__main__':
100 109 # The tag can be given as a positional argument
101 110 try:
102 111 tag = sys.argv[1]
103 112 except IndexError:
104 113 tag = sh2('git describe')
105
114
115 try:
116 desc = sys.argv[2]
117 except IndexError:
118 desc="Release (%s)"%tag
119
106 120 startdir = os.getcwd()
107 121 if not os.path.exists(pages_dir):
108 122 init_repo(pages_dir)
109 123
110 124 dest = pjoin(pages_dir, tag)
111 125
112 126 # don't `make html` here, because gh-pages already depends on html in Makefile
113 127 # sh('make html')
114 128
115 129 # This is pretty unforgiving: we unconditionally nuke the destination
116 130 # directory, and then copy the html tree in there
117 131 shutil.rmtree(dest, ignore_errors=True)
118 132 shutil.copytree(html_dir, dest)
133 shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf'))
119 134
120 135 try:
121 136 cd(pages_dir)
122 137 sh('git checkout gh-pages')
123 138 status = sh2('git status | head -1')
124 139 branch = re.match('\# On branch (.*)$', status).group(1)
125 140 if branch != 'gh-pages':
126 141 e = 'On %r, git branch is %r, MUST be "gh-pages"' % (pages_dir,
127 142 branch)
128 143 raise RuntimeError(e)
129 144
130 145 sh('git add %s' % tag)
131 new_htmlindex('index.html', tag)
146 new_htmlindex('index.html', tag, desc)
132 147 sh('git add index.html')
133 148 sh('git commit -m"Created new doc release, named: %s"' % tag)
134 149 print
135 150 print 'Most recent 3 commits:'
136 151 sys.stdout.flush()
137 152 sh('git --no-pager log --oneline HEAD~3..')
138 153 finally:
139 154 cd(startdir)
140 155
141 156 print
142 157 print 'Now verify the build in: %r' % dest
143 158 print "If everything looks good, 'git push'"
1 NO CONTENT: file renamed from docs/source/interactive/figs/colors.dark.png to docs/source/interactive/figs/colors_dark.png
@@ -1,219 +1,219 b''
1 1 .. _qtconsole:
2 2
3 3 =========================
4 4 IPython as a QtGUI widget
5 5 =========================
6 6
7 7 We now have a version of IPython, using the new two-process :ref:`ZeroMQ Kernel <ipythonzmq>`,
8 8 running in a PyQt_ GUI.
9 9
10 10 Overview
11 11 ========
12 12
13 13 The Qt frontend has hand-coded emacs-style bindings for text navigation. This is not yet
14 14 configurable.
15 15
16 16 .. seealso::
17 17
18 18 `The original IPython-Qt project description. <ipython_qt>`_
19 19
20 20 ``%loadpy``
21 21 ===========
22 22
23 23 The ``%loadpy`` magic has been added, just for the GUI frontend. It takes any python
24 24 script (must end in '.py'), and pastes its contents as your next input, so you can edit it
25 25 before executing. The script may be on your machine, but you can also specify a url, and
26 26 it will download the script from the web. This is particularly useful for playing with
27 27 examples from documentation, such as matplotlib.
28 28
29 29 .. sourcecode:: ipython
30 30
31 31 In [6]: %loadpy
32 32 http://matplotlib.sourceforge.net/plot_directive/mpl_examples/mplot3d/contour3d_demo.py
33 33
34 34 In [7]: from mpl_toolkits.mplot3d import axes3d
35 35 ...: import matplotlib.pyplot as plt
36 36 ...:
37 37 ...: fig = plt.figure()
38 38 ...: ax = fig.add_subplot(111, projection='3d')
39 39 ...: X, Y, Z = axes3d.get_test_data(0.05)
40 40 ...: cset = ax.contour(X, Y, Z)
41 41 ...: ax.clabel(cset, fontsize=9, inline=1)
42 42 ...:
43 43 ...: plt.show()
44 44
45 45 Pylab
46 46 =====
47 47
48 48 One of the most exciting features of the new console is embedded matplotlib figures. You
49 49 can use any standard matplotlib GUI backend (Except native MacOSX) to draw the figures,
50 50 and since there is now a two-process model, there is no longer a conflict between user
51 51 input and the drawing eventloop.
52 52
53 53 .. image:: figs/besselj.png
54 54 :width: 519px
55 55
56 56 .. pastefig:
57 57
58 58 :func:`pastefig`
59 59 ****************
60 60
61 61 An additional function, :func:`pastefig`, will be added to the global namespace if you
62 62 specify the ``--pylab`` argument. This takes the active figures in matplotlib, and embeds
63 63 them in your document. This is especially useful for saving_ your work.
64 64
65 65 .. _inline:
66 66
67 67 ``--pylab inline``
68 68 ******************
69 69
70 70 If you want to have all of your figures embedded in your session, instead of calling
71 71 :func:`pastefig`, you can specify ``--pylab inline``, and each time you make a plot, it
72 72 will show up in your document, as if you had called :func:`pastefig`.
73 73
74 74
75 75 .. _saving:
76 76
77 77 Saving and Printing
78 78 ===================
79 79
80 80 IPythonQt has the ability to save your current session, as either HTML or XHTML. If you
81 81 have been using `pastefig <pastefig>`_ or inline_ pylab, your figures will be PNG
82 82 in HTML, or inlined as SVG in XHTML. PNG images have the option to be either in an
83 83 external folder, as in many browsers' "Webpage, Complete" option, or inlined as well, for
84 84 a larger, but more portable file.
85 85
86 86 The widget also exposes the ability to print directly, via the default print shortcut or
87 87 context menu.
88 88
89 89
90 90 .. Note::
91 91
92 92 Saving is only available to richtext Qt widgets, so make sure you start ipqt with the
93 93 ``--rich`` flag, or with ``--pylab``, which always uses a richtext widget.
94 94
95 95
96 96 See these examples of :download:`png/html<figs/jn.html>` and :download:`svg/xhtml
97 97 <figs/jn.xhtml>` output. Note that syntax highlighting does not survive export. This is a known
98 98 issue, and is being investigated.
99 99
100 100 Colors and Highlighting
101 101 =======================
102 102
103 103 Terminal IPython has always had some coloring, but never syntax highlighting. There are a
104 104 few simple color choices, specified by the ``--colors`` flag or ``%colors`` magic:
105 105
106 106 * LightBG for light backgrounds
107 107 * Linux for dark backgrounds
108 108 * NoColor for a simple colorless terminal
109 109
110 110 The Qt widget has full support for the ``--colors`` flag, but adds new, more intuitive
111 111 aliases for the colors (the old names still work): dark=Linux, light=LightBG, bw=NoColor.
112 112
113 113 The Qt widget, however, has full syntax highlighting as you type, handled by the
114 114 `pygments`_ library. The ``--style`` argument exposes access to any style by name that can
115 115 be found by pygments, and there are several already installed. The ``--colors`` argument,
116 116 if unspecified, will be guessed based on the chosen style. Similarly, there are default
117 117 styles associated with each ``--colors`` option.
118 118
119 119
120 120 Screenshot of ``ipython-qtconsole --colors dark``, which uses the 'monokai' theme by
121 121 default:
122 122
123 .. image:: figs/colors.dark.png
123 .. image:: figs/colors_dark.png
124 124 :width: 627px
125 125
126 126 .. Note::
127 127
128 128 Calling ``ipython-qtconsole -h`` will show all the style names that pygments can find
129 129 on your system.
130 130
131 131 You can also pass the filename of a custom CSS stylesheet, if you want to do your own
132 132 coloring, via the ``--stylesheet`` argument. The default LightBG stylesheet:
133 133
134 134 .. sourcecode:: css
135 135
136 136 QPlainTextEdit, QTextEdit { background-color: white;
137 137 color: black ;
138 138 selection-background-color: #ccc}
139 139 .error { color: red; }
140 140 .in-prompt { color: navy; }
141 141 .in-prompt-number { font-weight: bold; }
142 142 .out-prompt { color: darkred; }
143 143 .out-prompt-number { font-weight: bold; }
144 144
145 145 Process Management
146 146 ==================
147 147
148 148 With the two-process ZMQ model, the frontend does not block input during execution. This
149 149 means that actions can be taken by the frontend while the Kernel is executing, or even
150 150 after it crashes. The most basic such command is via 'Ctrl-.', which restarts the kernel.
151 151 This can be done in the middle of a blocking execution. The frontend can also know, via a
152 152 heartbeat mechanism, that the kernel has died. This means that the frontend can safely
153 153 restart the kernel.
154 154
155 155 Multiple Consoles
156 156 *****************
157 157
158 158 Since the Kernel listens on the network, multiple frontends can connect to it. These
159 159 do not have to all be qt frontends - any IPython frontend can connect and run code.
160 160 When you start ipython-qtconsole, there will be an output line, like::
161 161
162 162 To connect another client to this kernel, use:
163 163 -e --xreq 62109 --sub 62110 --rep 62111 --hb 62112
164 164
165 165 Other frontends can connect to your kernel, and share in the execution. This is great for
166 166 collaboration. The `-e` flag is for 'external'. Starting other consoles with that flag
167 167 will not try to start their own, but rather connect to yours. Ultimately, you will not
168 168 have to specify each port individually, but for now this copy-paste method is best.
169 169
170 170 By default (for security reasons), the kernel only listens on localhost, so you can only
171 171 connect multiple frontends to the kernel from your local machine. You can specify to
172 172 listen on an external interface by specifying the ``--ip`` argument::
173 173
174 174 $> ipython-qtconsole --ip 192.168.1.123
175 175
176 176 If you specify the ip as 0.0.0.0, that refers to all interfaces, so any computer that can
177 177 see yours can connect to the kernel.
178 178
179 179 .. warning::
180 180
181 181 Since the ZMQ code currently has no security, listening on an external-facing IP
182 182 is dangerous. You are giving any computer that can see you on the network the ability
183 183 to issue arbitrary shell commands as you on your machine. Be very careful with this.
184 184
185 185
186 186 Stopping Kernels and Consoles
187 187 *****************************
188 188
189 189 Since there can be many consoles per kernel, the shutdown mechanism and dialog are
190 190 probably more complicated than you are used to. Since you don't always want to shutdown a
191 191 kernel when you close a window, you are given the option to just close the console window
192 192 or also close the Kernel and *all other windows*. Note that this only refers to all other
193 193 *local* windows, as remote Consoles are not allowed to shutdown the kernel, and shutdowns
194 194 do not close Remote consoles (to allow for saving, etc.).
195 195
196 196 Rules:
197 197
198 198 * Restarting the kernel automatically clears all *local* Consoles, and prompts remote
199 199 Consoles about the reset.
200 200 * Shutdown closes all *local* Consoles, and notifies remotes that
201 201 the Kernel has been shutdown.
202 202 * Remote Consoles may not restart or shutdown the kernel.
203 203
204 204
205 205 Regressions
206 206 ===========
207 207
208 208 There are some features, where the qt console lags behind the Terminal frontend. We hope
209 209 to have these fixed by 0.11 release.
210 210
211 211 * Configuration: The Qt frontend and ZMQ kernel are not yet hooked up to the IPython
212 212 configuration system
213 213 * History Persistence: Currently the history of a GUI session does
214 214 not persist between sessions.
215 215 * !cmd input: Due to our use of pexpect, we cannot pass input to subprocesses launched
216 216 using the '!' escape. (this will not be fixed).
217 217
218 218 .. [PyQt] PyQt4 http://www.riverbankcomputing.co.uk/software/pyqt/download
219 219 .. [pygments] Pygments http://pygments.org/
General Comments 0
You need to be logged in to leave comments. Login now