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