~ubuntu-branches/ubuntu/raring/ipython/raring

« back to all changes in this revision

Viewing changes to docs/dist/html/config/initial_config.html

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2011-11-22 23:40:57 UTC
  • mfrom: (6.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20111122234057-ta86ocdahnhwmnd8
Tags: 0.11-2
* upload to unstable
* add patch fix-version-checks-for-pyzmq-2.1.10.patch
* fix debianize-error-messages.patch to reraise unknown exceptions
* suggest python-zmq for ipython package
* use dh_sphinxdoc
  - bump sphinx dependency to >= 1.0.7+dfsg-1~, replace libjs-jquery
    dependency with ${sphinxdoc:Depends} and drop ipython-doc.links
* remove empty directory from ipython
* link duplicate images in ipython-doc
* remove obsolete Conflicts and Replaces

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
 
 
6
 
 
7
 
<html xmlns="http://www.w3.org/1999/xhtml">
8
 
  <head>
9
 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
 
    
11
 
    <title>Initial configuration of your environment &mdash; IPython 0.10.2 documentation</title>
12
 
    
13
 
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
14
 
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
15
 
    
16
 
    <script type="text/javascript">
17
 
      var DOCUMENTATION_OPTIONS = {
18
 
        URL_ROOT:    '../',
19
 
        VERSION:     '0.10.2',
20
 
        COLLAPSE_INDEX: false,
21
 
        FILE_SUFFIX: '.html',
22
 
        HAS_SOURCE:  true
23
 
      };
24
 
    </script>
25
 
    <script type="text/javascript" src="../_static/jquery.js"></script>
26
 
    <script type="text/javascript" src="../_static/underscore.js"></script>
27
 
    <script type="text/javascript" src="../_static/doctools.js"></script>
28
 
    <link rel="top" title="IPython 0.10.2 documentation" href="../index.html" />
29
 
    <link rel="up" title="Configuration and customization" href="index.html" />
30
 
    <link rel="next" title="Customization of IPython" href="customization.html" />
31
 
    <link rel="prev" title="Configuration and customization" href="index.html" /> 
32
 
  </head>
33
 
  <body>
34
 
    <div class="related">
35
 
      <h3>Navigation</h3>
36
 
      <ul>
37
 
        <li class="right" style="margin-right: 10px">
38
 
          <a href="../genindex.html" title="General Index"
39
 
             accesskey="I">index</a></li>
40
 
        <li class="right" >
41
 
          <a href="../py-modindex.html" title="Python Module Index"
42
 
             >modules</a> |</li>
43
 
        <li class="right" >
44
 
          <a href="customization.html" title="Customization of IPython"
45
 
             accesskey="N">next</a> |</li>
46
 
        <li class="right" >
47
 
          <a href="index.html" title="Configuration and customization"
48
 
             accesskey="P">previous</a> |</li>
49
 
        <li><a href="../index.html">IPython 0.10.2 documentation</a> &raquo;</li>
50
 
          <li><a href="index.html" accesskey="U">Configuration and customization</a> &raquo;</li> 
51
 
      </ul>
52
 
    </div>  
53
 
 
54
 
    <div class="document">
55
 
      <div class="documentwrapper">
56
 
        <div class="bodywrapper">
57
 
          <div class="body">
58
 
            
59
 
  <div class="section" id="initial-configuration-of-your-environment">
60
 
<span id="initial-config"></span><h1>Initial configuration of your environment<a class="headerlink" href="#initial-configuration-of-your-environment" title="Permalink to this headline">¶</a></h1>
61
 
<p>This section will help you set various things in your environment for
62
 
your IPython sessions to be as efficient as possible. All of IPython&#8217;s
63
 
configuration information, along with several example files, is stored
64
 
in a directory named by default $HOME/.ipython. You can change this by
65
 
defining the environment variable IPYTHONDIR, or at runtime with the
66
 
command line option -ipythondir.</p>
67
 
<p>If all goes well, the first time you run IPython it should automatically create
68
 
a user copy of the config directory for you, based on its builtin defaults. You
69
 
can look at the files it creates to learn more about configuring the
70
 
system. The main file you will modify to configure IPython&#8217;s behavior is called
71
 
ipythonrc (with a .ini extension under Windows), included for reference
72
 
<a class="reference internal" href="customization.html#ipythonrc"><em>here</em></a>. This file is very commented and has many variables you
73
 
can change to suit your taste, you can find more details <a class="reference internal" href="customization.html#customization"><em>here</em></a>. Here we discuss the basic things you will want to make sure
74
 
things are working properly from the beginning.</p>
75
 
<div class="section" id="access-to-the-python-help-system">
76
 
<span id="accessing-help"></span><h2>Access to the Python help system<a class="headerlink" href="#access-to-the-python-help-system" title="Permalink to this headline">¶</a></h2>
77
 
<p>This is true for Python in general (not just for IPython): you should have an
78
 
environment variable called PYTHONDOCS pointing to the directory where your
79
 
HTML Python documentation lives. In my system it&#8217;s
80
 
<tt class="file docutils literal"><span class="pre">/usr/share/doc/python-doc/html</span></tt>, check your local details or ask your
81
 
systems administrator.</p>
82
 
<p>This is the directory which holds the HTML version of the Python
83
 
manuals. Unfortunately it seems that different Linux distributions
84
 
package these files differently, so you may have to look around a bit.
85
 
Below I show the contents of this directory on my system for reference:</p>
86
 
<div class="highlight-python"><pre>[html]&gt; ls
87
 
about.html  dist/  icons/      lib/           python2.5.devhelp.gz  whatsnew/
88
 
acks.html   doc/   index.html  mac/           ref/
89
 
api/        ext/   inst/       modindex.html  tut/</pre>
90
 
</div>
91
 
<p>You should really make sure this variable is correctly set so that
92
 
Python&#8217;s pydoc-based help system works. It is a powerful and convenient
93
 
system with full access to the Python manuals and all modules accessible
94
 
to you.</p>
95
 
<p>Under Windows it seems that pydoc finds the documentation automatically,
96
 
so no extra setup appears necessary.</p>
97
 
</div>
98
 
<div class="section" id="editor">
99
 
<h2>Editor<a class="headerlink" href="#editor" title="Permalink to this headline">¶</a></h2>
100
 
<p>The %edit command (and its alias %ed) will invoke the editor set in your
101
 
environment as EDITOR. If this variable is not set, it will default to
102
 
vi under Linux/Unix and to notepad under Windows. You may want to set
103
 
this variable properly and to a lightweight editor which doesn&#8217;t take
104
 
too long to start (that is, something other than a new instance of
105
 
Emacs). This way you can edit multi-line code quickly and with the power
106
 
of a real editor right inside IPython.</p>
107
 
<p>If you are a dedicated Emacs user, you should set up the Emacs server so
108
 
that new requests are handled by the original process. This means that
109
 
almost no time is spent in handling the request (assuming an Emacs
110
 
process is already running). For this to work, you need to set your
111
 
EDITOR environment variable to &#8216;emacsclient&#8217;. The code below, supplied
112
 
by Francois Pinard, can then be used in your .emacs file to enable the
113
 
server:</p>
114
 
<div class="highlight-python"><pre>(defvar server-buffer-clients)
115
 
(when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
116
 
  (server-start)
117
 
  (defun fp-kill-server-with-buffer-routine ()
118
 
    (and server-buffer-clients (server-done)))
119
 
  (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))</pre>
120
 
</div>
121
 
<p>You can also set the value of this editor via the commmand-line option
122
 
&#8216;-editor&#8217; or in your ipythonrc file. This is useful if you wish to use
123
 
specifically for IPython an editor different from your typical default
124
 
(and for Windows users who tend to use fewer environment variables).</p>
125
 
</div>
126
 
<div class="section" id="color">
127
 
<h2>Color<a class="headerlink" href="#color" title="Permalink to this headline">¶</a></h2>
128
 
<p>The default IPython configuration has most bells and whistles turned on
129
 
(they&#8217;re pretty safe). But there&#8217;s one that may cause problems on some
130
 
systems: the use of color on screen for displaying information. This is
131
 
very useful, since IPython can show prompts and exception tracebacks
132
 
with various colors, display syntax-highlighted source code, and in
133
 
general make it easier to visually parse information.</p>
134
 
<p>The following terminals seem to handle the color sequences fine:</p>
135
 
<blockquote>
136
 
<div><ul class="simple">
137
 
<li>Linux main text console, KDE Konsole, Gnome Terminal, E-term,
138
 
rxvt, xterm.</li>
139
 
<li>CDE terminal (tested under Solaris). This one boldfaces light colors.</li>
140
 
<li>(X)Emacs buffers. See the <a class="reference internal" href="#emacs">emacs</a> section for more details on
141
 
using IPython with (X)Emacs.</li>
142
 
<li>A Windows (XP/2k) command prompt with <a class="reference external" href="https://code.launchpad.net/pyreadline">pyreadline</a>.</li>
143
 
<li>A Windows (XP/2k) CygWin shell. Although some users have reported
144
 
problems; it is not clear whether there is an issue for everyone
145
 
or only under specific configurations. If you have full color
146
 
support under cygwin, please post to the IPython mailing list so
147
 
this issue can be resolved for all users.</li>
148
 
</ul>
149
 
</div></blockquote>
150
 
<p>These have shown problems:</p>
151
 
<blockquote>
152
 
<div><ul class="simple">
153
 
<li>Windows command prompt in WinXP/2k logged into a Linux machine via
154
 
telnet or ssh.</li>
155
 
<li>Windows native command prompt in WinXP/2k, without Gary Bishop&#8217;s
156
 
extensions. Once Gary&#8217;s readline library is installed, the normal
157
 
WinXP/2k command prompt works perfectly.</li>
158
 
</ul>
159
 
</div></blockquote>
160
 
<p>Currently the following color schemes are available:</p>
161
 
<blockquote>
162
 
<div><ul class="simple">
163
 
<li>NoColor: uses no color escapes at all (all escapes are empty &#8216;&#8217; &#8216;&#8217;
164
 
strings). This &#8216;scheme&#8217; is thus fully safe to use in any terminal.</li>
165
 
<li>Linux: works well in Linux console type environments: dark
166
 
background with light fonts. It uses bright colors for
167
 
information, so it is difficult to read if you have a light
168
 
colored background.</li>
169
 
<li>LightBG: the basic colors are similar to those in the Linux scheme
170
 
but darker. It is easy to read in terminals with light backgrounds.</li>
171
 
</ul>
172
 
</div></blockquote>
173
 
<p>IPython uses colors for two main groups of things: prompts and
174
 
tracebacks which are directly printed to the terminal, and the object
175
 
introspection system which passes large sets of data through a pager.</p>
176
 
</div>
177
 
<div class="section" id="input-output-prompts-and-exception-tracebacks">
178
 
<h2>Input/Output prompts and exception tracebacks<a class="headerlink" href="#input-output-prompts-and-exception-tracebacks" title="Permalink to this headline">¶</a></h2>
179
 
<p>You can test whether the colored prompts and tracebacks work on your
180
 
system interactively by typing &#8216;%colors Linux&#8217; at the prompt (use
181
 
&#8216;%colors LightBG&#8217; if your terminal has a light background). If the input
182
 
prompt shows garbage like:</p>
183
 
<div class="highlight-python"><pre>[0;32mIn [[1;32m1[0;32m]: [0;00m</pre>
184
 
</div>
185
 
<p>instead of (in color) something like:</p>
186
 
<div class="highlight-python"><pre>In [1]:</pre>
187
 
</div>
188
 
<p>this means that your terminal doesn&#8217;t properly handle color escape
189
 
sequences. You can go to a &#8216;no color&#8217; mode by typing &#8216;%colors NoColor&#8217;.</p>
190
 
<p>You can try using a different terminal emulator program (Emacs users,
191
 
see below). To permanently set your color preferences, edit the file
192
 
$HOME/.ipython/ipythonrc and set the colors option to the desired value.</p>
193
 
</div>
194
 
<div class="section" id="object-details-types-docstrings-source-code-etc">
195
 
<h2>Object details (types, docstrings, source code, etc.)<a class="headerlink" href="#object-details-types-docstrings-source-code-etc" title="Permalink to this headline">¶</a></h2>
196
 
<p>IPython has a set of special functions for studying the objects you are working
197
 
with, discussed in detail <a class="reference internal" href="../interactive/reference.html#dynamic-object-info"><em>here</em></a>. But this system
198
 
relies on passing information which is longer than your screen through a data
199
 
pager, such as the common Unix less and more programs. In order to be able to
200
 
see this information in color, your pager needs to be properly configured. I
201
 
strongly recommend using less instead of more, as it seems that more simply can
202
 
not understand colored text correctly.</p>
203
 
<p>In order to configure less as your default pager, do the following:</p>
204
 
<blockquote>
205
 
<div><ol class="arabic simple">
206
 
<li>Set the environment PAGER variable to less.</li>
207
 
<li>Set the environment LESS variable to -r (plus any other options
208
 
you always want to pass to less by default). This tells less to
209
 
properly interpret control sequences, which is how color
210
 
information is given to your terminal.</li>
211
 
</ol>
212
 
</div></blockquote>
213
 
<p>For the bash shell, add to your ~/.bashrc file the lines:</p>
214
 
<div class="highlight-python"><pre>export PAGER=less
215
 
export LESS=-r</pre>
216
 
</div>
217
 
<p>For the csh or tcsh shells, add to your ~/.cshrc file the lines:</p>
218
 
<div class="highlight-python"><pre>setenv PAGER less
219
 
setenv LESS -r</pre>
220
 
</div>
221
 
<p>There is similar syntax for other Unix shells, look at your system
222
 
documentation for details.</p>
223
 
<p>If you are on a system which lacks proper data pagers (such as Windows),
224
 
IPython will use a very limited builtin pager.</p>
225
 
</div>
226
 
<div class="section" id="x-emacs-configuration">
227
 
<span id="emacs"></span><h2>(X)Emacs configuration<a class="headerlink" href="#x-emacs-configuration" title="Permalink to this headline">¶</a></h2>
228
 
<p>Thanks to the work of Alexander Schmolck and Prabhu Ramachandran,
229
 
currently (X)Emacs and IPython get along very well.</p>
230
 
<p>Important note: You will need to use a recent enough version of
231
 
python-mode.el, along with the file ipython.el. You can check that the
232
 
version you have of python-mode.el is new enough by either looking at
233
 
the revision number in the file itself, or asking for it in (X)Emacs via
234
 
M-x py-version. Versions 4.68 and newer contain the necessary fixes for
235
 
proper IPython support.</p>
236
 
<p>The file ipython.el is included with the IPython distribution, in the
237
 
documentation directory (where this manual resides in PDF and HTML
238
 
formats).</p>
239
 
<p>Once you put these files in your Emacs path, all you need in your .emacs
240
 
file is:</p>
241
 
<div class="highlight-python"><pre>(require 'ipython)</pre>
242
 
</div>
243
 
<p>This should give you full support for executing code snippets via
244
 
IPython, opening IPython as your Python shell via <tt class="docutils literal"><span class="pre">C-c</span> <span class="pre">!</span></tt>, etc.</p>
245
 
<p>You can customize the arguments passed to the IPython instance at startup by
246
 
setting the <tt class="docutils literal"><span class="pre">py-python-command-args</span></tt> variable.  For example, to start always
247
 
in <tt class="docutils literal"><span class="pre">pylab</span></tt> mode with hardcoded light-background colors, you can use:</p>
248
 
<div class="highlight-python"><pre>(setq py-python-command-args '("-pylab" "-colors" "LightBG"))</pre>
249
 
</div>
250
 
<p>If you happen to get garbage instead of colored prompts as described in
251
 
the previous section, you may need to set also in your .emacs file:</p>
252
 
<div class="highlight-python"><pre>(setq ansi-color-for-comint-mode t)</pre>
253
 
</div>
254
 
<p>Notes:</p>
255
 
<blockquote>
256
 
<div><ul class="simple">
257
 
<li>There is one caveat you should be aware of: you must start the
258
 
IPython shell before attempting to execute any code regions via
259
 
<tt class="docutils literal"><span class="pre">C-c</span> <span class="pre">|</span></tt>. Simply type C-c ! to start IPython before passing any code
260
 
regions to the interpreter, and you shouldn&#8217;t experience any
261
 
problems.
262
 
This is due to a bug in Python itself, which has been fixed for
263
 
Python 2.3, but exists as of Python 2.2.2 (reported as SF bug [
264
 
737947 ]).</li>
265
 
<li>The (X)Emacs support is maintained by Alexander Schmolck, so all
266
 
comments/requests should be directed to him through the IPython
267
 
mailing lists.</li>
268
 
<li>This code is still somewhat experimental so it&#8217;s a bit rough
269
 
around the edges (although in practice, it works quite well).</li>
270
 
<li>Be aware that if you customize py-python-command previously, this
271
 
value will override what ipython.el does (because loading the
272
 
customization variables comes later).</li>
273
 
</ul>
274
 
</div></blockquote>
275
 
</div>
276
 
</div>
277
 
 
278
 
 
279
 
          </div>
280
 
        </div>
281
 
      </div>
282
 
      <div class="sphinxsidebar">
283
 
        <div class="sphinxsidebarwrapper">
284
 
  <h3><a href="../index.html">Table Of Contents</a></h3>
285
 
  <ul>
286
 
<li><a class="reference internal" href="#">Initial configuration of your environment</a><ul>
287
 
<li><a class="reference internal" href="#access-to-the-python-help-system">Access to the Python help system</a></li>
288
 
<li><a class="reference internal" href="#editor">Editor</a></li>
289
 
<li><a class="reference internal" href="#color">Color</a></li>
290
 
<li><a class="reference internal" href="#input-output-prompts-and-exception-tracebacks">Input/Output prompts and exception tracebacks</a></li>
291
 
<li><a class="reference internal" href="#object-details-types-docstrings-source-code-etc">Object details (types, docstrings, source code, etc.)</a></li>
292
 
<li><a class="reference internal" href="#x-emacs-configuration">(X)Emacs configuration</a></li>
293
 
</ul>
294
 
</li>
295
 
</ul>
296
 
 
297
 
  <h4>Previous topic</h4>
298
 
  <p class="topless"><a href="index.html"
299
 
                        title="previous chapter">Configuration and customization</a></p>
300
 
  <h4>Next topic</h4>
301
 
  <p class="topless"><a href="customization.html"
302
 
                        title="next chapter">Customization of IPython</a></p>
303
 
  <h3>This Page</h3>
304
 
  <ul class="this-page-menu">
305
 
    <li><a href="../_sources/config/initial_config.txt"
306
 
           rel="nofollow">Show Source</a></li>
307
 
  </ul>
308
 
<div id="searchbox" style="display: none">
309
 
  <h3>Quick search</h3>
310
 
    <form class="search" action="../search.html" method="get">
311
 
      <input type="text" name="q" size="18" />
312
 
      <input type="submit" value="Go" />
313
 
      <input type="hidden" name="check_keywords" value="yes" />
314
 
      <input type="hidden" name="area" value="default" />
315
 
    </form>
316
 
    <p class="searchtip" style="font-size: 90%">
317
 
    Enter search terms or a module, class or function name.
318
 
    </p>
319
 
</div>
320
 
<script type="text/javascript">$('#searchbox').show(0);</script>
321
 
        </div>
322
 
      </div>
323
 
      <div class="clearer"></div>
324
 
    </div>
325
 
    <div class="related">
326
 
      <h3>Navigation</h3>
327
 
      <ul>
328
 
        <li class="right" style="margin-right: 10px">
329
 
          <a href="../genindex.html" title="General Index"
330
 
             >index</a></li>
331
 
        <li class="right" >
332
 
          <a href="../py-modindex.html" title="Python Module Index"
333
 
             >modules</a> |</li>
334
 
        <li class="right" >
335
 
          <a href="customization.html" title="Customization of IPython"
336
 
             >next</a> |</li>
337
 
        <li class="right" >
338
 
          <a href="index.html" title="Configuration and customization"
339
 
             >previous</a> |</li>
340
 
        <li><a href="../index.html">IPython 0.10.2 documentation</a> &raquo;</li>
341
 
          <li><a href="index.html" >Configuration and customization</a> &raquo;</li> 
342
 
      </ul>
343
 
    </div>
344
 
    <div class="footer">
345
 
        &copy; Copyright 2008, The IPython Development Team.
346
 
      Last updated on Apr 09, 2011.
347
 
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1pre.
348
 
    </div>
349
 
  </body>
350
 
</html>
 
 
b'\\ No newline at end of file'