##// END OF EJS Templates
Small manual update, I thought I'd already committed this.
jdh2358 -
Show More
@@ -1,10495 +1,10507 b''
1 #LyX 1.4.3 created this file. For more info see http://www.lyx.org/
1 #LyX 1.4.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 245
2 \lyxformat 245
3 \begin_document
3 \begin_document
4 \begin_header
4 \begin_header
5 \textclass article
5 \textclass article
6 \begin_preamble
6 \begin_preamble
7 %\usepackage{ae,aecompl}
7 %\usepackage{ae,aecompl}
8 \usepackage{color}
8 \usepackage{color}
9
9
10 % A few colors to replace the defaults for certain link types
10 % A few colors to replace the defaults for certain link types
11 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
11 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
12 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
12 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
13 \definecolor{darkred}{rgb}{.52,0.08,0.01}
13 \definecolor{darkred}{rgb}{.52,0.08,0.01}
14 \definecolor{darkgreen}{rgb}{.12,.54,.11}
14 \definecolor{darkgreen}{rgb}{.12,.54,.11}
15
15
16 % Use and configure listings package for nicely formatted code
16 % Use and configure listings package for nicely formatted code
17 \usepackage{listings}
17 \usepackage{listings}
18 \lstset{
18 \lstset{
19 language=Python,
19 language=Python,
20 basicstyle=\small\ttfamily,
20 basicstyle=\small\ttfamily,
21 commentstyle=\ttfamily\color{blue},
21 commentstyle=\ttfamily\color{blue},
22 stringstyle=\ttfamily\color{darkorange},
22 stringstyle=\ttfamily\color{darkorange},
23 showstringspaces=false,
23 showstringspaces=false,
24 breaklines=true,
24 breaklines=true,
25 postbreak = \space\dots
25 postbreak = \space\dots
26 }
26 }
27
27
28 \usepackage[%pdftex, % needed for pdflatex
28 \usepackage[%pdftex, % needed for pdflatex
29 breaklinks=true, % so long urls are correctly broken across lines
29 breaklinks=true, % so long urls are correctly broken across lines
30 colorlinks=true,
30 colorlinks=true,
31 urlcolor=blue,
31 urlcolor=blue,
32 linkcolor=darkred,
32 linkcolor=darkred,
33 citecolor=darkgreen,
33 citecolor=darkgreen,
34 ]{hyperref}
34 ]{hyperref}
35
35
36 \usepackage{html}
36 \usepackage{html}
37
37
38 % This helps prevent overly long lines that stretch beyond the margins
38 % This helps prevent overly long lines that stretch beyond the margins
39 \sloppy
39 \sloppy
40
40
41 % Define a \codelist command which either uses listings for latex, or
41 % Define a \codelist command which either uses listings for latex, or
42 % plain verbatim for html (since latex2html doesn't understand the
42 % plain verbatim for html (since latex2html doesn't understand the
43 % listings package).
43 % listings package).
44 \usepackage{verbatim}
44 \usepackage{verbatim}
45 \newcommand{\codelist}[1] {
45 \newcommand{\codelist}[1] {
46 \latex{\lstinputlisting{#1}}
46 \latex{\lstinputlisting{#1}}
47 \html{\verbatiminput{#1}}
47 \html{\verbatiminput{#1}}
48 }
48 }
49 \end_preamble
49 \end_preamble
50 \language english
50 \language english
51 \inputencoding latin1
51 \inputencoding latin1
52 \fontscheme palatino
52 \fontscheme palatino
53 \graphics default
53 \graphics default
54 \paperfontsize 11
54 \paperfontsize 11
55 \spacing single
55 \spacing single
56 \papersize default
56 \papersize default
57 \use_geometry true
57 \use_geometry true
58 \use_amsmath 1
58 \use_amsmath 1
59 \cite_engine basic
59 \cite_engine basic
60 \use_bibtopic false
60 \use_bibtopic false
61 \paperorientation portrait
61 \paperorientation portrait
62 \leftmargin 1in
62 \leftmargin 1in
63 \topmargin 1in
63 \topmargin 1in
64 \rightmargin 1in
64 \rightmargin 1in
65 \bottommargin 1in
65 \bottommargin 1in
66 \secnumdepth 3
66 \secnumdepth 3
67 \tocdepth 3
67 \tocdepth 3
68 \paragraph_separation skip
68 \paragraph_separation skip
69 \defskip medskip
69 \defskip medskip
70 \quotes_language english
70 \quotes_language english
71 \papercolumns 1
71 \papercolumns 1
72 \papersides 2
72 \papersides 2
73 \paperpagestyle fancy
73 \paperpagestyle fancy
74 \tracking_changes false
74 \tracking_changes false
75 \output_changes true
75 \output_changes true
76 \end_header
76 \end_header
77
77
78 \begin_body
78 \begin_body
79
79
80 \begin_layout Title
80 \begin_layout Title
81 IPython
81 IPython
82 \newline
82 \newline
83
83
84 \size larger
84 \size larger
85 An enhanced Interactive Python
85 An enhanced Interactive Python
86 \size large
86 \size large
87
87
88 \newline
88 \newline
89 User Manual, v.
89 User Manual, v.
90 __version__
90 __version__
91 \end_layout
91 \end_layout
92
92
93 \begin_layout Author
93 \begin_layout Author
94 Fernando PοΏ½rez
94 Fernando PοΏ½rez
95 \begin_inset Foot
95 \begin_inset Foot
96 status collapsed
96 status collapsed
97
97
98 \begin_layout Standard
98 \begin_layout Standard
99
99
100 \size scriptsize
100 \size scriptsize
101 Department of Applied Mathematics, University of Colorado at Boulder.
101 Department of Applied Mathematics, University of Colorado at Boulder.
102
102
103 \family typewriter
103 \family typewriter
104 <Fernando.Perez@colorado.edu>
104 <Fernando.Perez@colorado.edu>
105 \end_layout
105 \end_layout
106
106
107 \end_inset
107 \end_inset
108
108
109
109
110 \end_layout
110 \end_layout
111
111
112 \begin_layout Standard
112 \begin_layout Standard
113 \begin_inset ERT
113 \begin_inset ERT
114 status collapsed
114 status collapsed
115
115
116 \begin_layout Standard
116 \begin_layout Standard
117
117
118
118
119 \backslash
119 \backslash
120 latex{
120 latex{
121 \end_layout
121 \end_layout
122
122
123 \end_inset
123 \end_inset
124
124
125
125
126 \begin_inset LatexCommand \tableofcontents{}
126 \begin_inset LatexCommand \tableofcontents{}
127
127
128 \end_inset
128 \end_inset
129
129
130
130
131 \begin_inset ERT
131 \begin_inset ERT
132 status collapsed
132 status collapsed
133
133
134 \begin_layout Standard
134 \begin_layout Standard
135
135
136 }
136 }
137 \end_layout
137 \end_layout
138
138
139 \end_inset
139 \end_inset
140
140
141
141
142 \end_layout
142 \end_layout
143
143
144 \begin_layout Standard
144 \begin_layout Standard
145 \begin_inset ERT
145 \begin_inset ERT
146 status open
146 status open
147
147
148 \begin_layout Standard
148 \begin_layout Standard
149
149
150
150
151 \backslash
151 \backslash
152 html{
152 html{
153 \backslash
153 \backslash
154 bodytext{bgcolor=#ffffff}}
154 bodytext{bgcolor=#ffffff}}
155 \end_layout
155 \end_layout
156
156
157 \end_inset
157 \end_inset
158
158
159
159
160 \end_layout
160 \end_layout
161
161
162 \begin_layout Standard
162 \begin_layout Standard
163
163
164 \newpage
164 \newpage
165
165
166 \end_layout
166 \end_layout
167
167
168 \begin_layout Section
168 \begin_layout Section
169 Overview
169 Overview
170 \end_layout
170 \end_layout
171
171
172 \begin_layout Standard
172 \begin_layout Standard
173 One of Python's most useful features is its interactive interpreter.
173 One of Python's most useful features is its interactive interpreter.
174 This system allows very fast testing of ideas without the overhead of creating
174 This system allows very fast testing of ideas without the overhead of creating
175 test files as is typical in most programming languages.
175 test files as is typical in most programming languages.
176 However, the interpreter supplied with the standard Python distribution
176 However, the interpreter supplied with the standard Python distribution
177 is somewhat limited for extended interactive use.
177 is somewhat limited for extended interactive use.
178 \end_layout
178 \end_layout
179
179
180 \begin_layout Standard
180 \begin_layout Standard
181 IPython is a free software project (released under the BSD license) which
181 IPython is a free software project (released under the BSD license) which
182 tries to:
182 tries to:
183 \end_layout
183 \end_layout
184
184
185 \begin_layout Enumerate
185 \begin_layout Enumerate
186 Provide an interactive shell superior to Python's default.
186 Provide an interactive shell superior to Python's default.
187 IPython has many features for object introspection, system shell access,
187 IPython has many features for object introspection, system shell access,
188 and its own special command system for adding functionality when working
188 and its own special command system for adding functionality when working
189 interactively.
189 interactively.
190 It tries to be a very efficient environment both for Python code development
190 It tries to be a very efficient environment both for Python code development
191 and for exploration of problems using Python objects (in situations like
191 and for exploration of problems using Python objects (in situations like
192 data analysis).
192 data analysis).
193 \end_layout
193 \end_layout
194
194
195 \begin_layout Enumerate
195 \begin_layout Enumerate
196 Serve as an embeddable, ready to use interpreter for your own programs.
196 Serve as an embeddable, ready to use interpreter for your own programs.
197 IPython can be started with a single call from inside another program,
197 IPython can be started with a single call from inside another program,
198 providing access to the current namespace.
198 providing access to the current namespace.
199 This can be very useful both for debugging purposes and for situations
199 This can be very useful both for debugging purposes and for situations
200 where a blend of batch-processing and interactive exploration are needed.
200 where a blend of batch-processing and interactive exploration are needed.
201 \end_layout
201 \end_layout
202
202
203 \begin_layout Enumerate
203 \begin_layout Enumerate
204 Offer a flexible framework which can be used as the base environment for
204 Offer a flexible framework which can be used as the base environment for
205 other systems with Python as the underlying language.
205 other systems with Python as the underlying language.
206 Specifically scientific environments like Mathematica, IDL and Matlab inspired
206 Specifically scientific environments like Mathematica, IDL and Matlab inspired
207 its design, but similar ideas can be useful in many fields.
207 its design, but similar ideas can be useful in many fields.
208 \end_layout
208 \end_layout
209
209
210 \begin_layout Enumerate
210 \begin_layout Enumerate
211 Allow interactive testing of threaded graphical toolkits.
211 Allow interactive testing of threaded graphical toolkits.
212 IPython has support for interactive, non-blocking control of GTK, Qt and
212 IPython has support for interactive, non-blocking control of GTK, Qt and
213 WX applications via special threading flags.
213 WX applications via special threading flags.
214 The normal Python shell can only do this for Tkinter applications.
214 The normal Python shell can only do this for Tkinter applications.
215 \end_layout
215 \end_layout
216
216
217 \begin_layout Subsection
217 \begin_layout Subsection
218 Main features
218 Main features
219 \end_layout
219 \end_layout
220
220
221 \begin_layout Itemize
221 \begin_layout Itemize
222 Dynamic object introspection.
222 Dynamic object introspection.
223 One can access docstrings, function definition prototypes, source code,
223 One can access docstrings, function definition prototypes, source code,
224 source files and other details of any object accessible to the interpreter
224 source files and other details of any object accessible to the interpreter
225 with a single keystroke (`
225 with a single keystroke (`
226 \family typewriter
226 \family typewriter
227 ?
227 ?
228 \family default
228 \family default
229 ', and using `
229 ', and using `
230 \family typewriter
230 \family typewriter
231 ??
231 ??
232 \family default
232 \family default
233 ' provides additional detail).
233 ' provides additional detail).
234 \end_layout
234 \end_layout
235
235
236 \begin_layout Itemize
236 \begin_layout Itemize
237 Searching through modules and namespaces with `
237 Searching through modules and namespaces with `
238 \family typewriter
238 \family typewriter
239 *
239 *
240 \family default
240 \family default
241 ' wildcards, both when using the `
241 ' wildcards, both when using the `
242 \family typewriter
242 \family typewriter
243 ?
243 ?
244 \family default
244 \family default
245 ' system and via the
245 ' system and via the
246 \family typewriter
246 \family typewriter
247 %psearch
247 %psearch
248 \family default
248 \family default
249 command.
249 command.
250 \end_layout
250 \end_layout
251
251
252 \begin_layout Itemize
252 \begin_layout Itemize
253 Completion in the local namespace, by typing TAB at the prompt.
253 Completion in the local namespace, by typing TAB at the prompt.
254 This works for keywords, methods, variables and files in the current directory.
254 This works for keywords, methods, variables and files in the current directory.
255 This is supported via the readline library, and full access to configuring
255 This is supported via the readline library, and full access to configuring
256 readline's behavior is provided.
256 readline's behavior is provided.
257 \end_layout
257 \end_layout
258
258
259 \begin_layout Itemize
259 \begin_layout Itemize
260 Numbered input/output prompts with command history (persistent across sessions
260 Numbered input/output prompts with command history (persistent across sessions
261 and tied to each profile), full searching in this history and caching of
261 and tied to each profile), full searching in this history and caching of
262 all input and output.
262 all input and output.
263 \end_layout
263 \end_layout
264
264
265 \begin_layout Itemize
265 \begin_layout Itemize
266 User-extensible `magic' commands.
266 User-extensible `magic' commands.
267 A set of commands prefixed with
267 A set of commands prefixed with
268 \family typewriter
268 \family typewriter
269 %
269 %
270 \family default
270 \family default
271 is available for controlling IPython itself and provides directory control,
271 is available for controlling IPython itself and provides directory control,
272 namespace information and many aliases to common system shell commands.
272 namespace information and many aliases to common system shell commands.
273 \end_layout
273 \end_layout
274
274
275 \begin_layout Itemize
275 \begin_layout Itemize
276 Alias facility for defining your own system aliases.
276 Alias facility for defining your own system aliases.
277 \end_layout
277 \end_layout
278
278
279 \begin_layout Itemize
279 \begin_layout Itemize
280 Complete system shell access.
280 Complete system shell access.
281 Lines starting with ! are passed directly to the system shell, and using
281 Lines starting with ! are passed directly to the system shell, and using
282 !! captures shell output into python variables for further use.
282 !! captures shell output into python variables for further use.
283 \end_layout
283 \end_layout
284
284
285 \begin_layout Itemize
285 \begin_layout Itemize
286 Background execution of Python commands in a separate thread.
286 Background execution of Python commands in a separate thread.
287 IPython has an internal job manager called
287 IPython has an internal job manager called
288 \family typewriter
288 \family typewriter
289 jobs
289 jobs
290 \family default
290 \family default
291 , and a conveninence backgrounding magic function called
291 , and a conveninence backgrounding magic function called
292 \family typewriter
292 \family typewriter
293 %bg
293 %bg
294 \family default
294 \family default
295 .
295 .
296 \end_layout
296 \end_layout
297
297
298 \begin_layout Itemize
298 \begin_layout Itemize
299 The ability to expand python variables when calling the system shell.
299 The ability to expand python variables when calling the system shell.
300 In a shell command, any python variable prefixed with
300 In a shell command, any python variable prefixed with
301 \family typewriter
301 \family typewriter
302 $
302 $
303 \family default
303 \family default
304 is expanded.
304 is expanded.
305 A double
305 A double
306 \family typewriter
306 \family typewriter
307 $$
307 $$
308 \family default
308 \family default
309 allows passing a literal
309 allows passing a literal
310 \family typewriter
310 \family typewriter
311 $
311 $
312 \family default
312 \family default
313 to the shell (for access to shell and environment variables like
313 to the shell (for access to shell and environment variables like
314 \family typewriter
314 \family typewriter
315 $PATH
315 $PATH
316 \family default
316 \family default
317 ).
317 ).
318 \end_layout
318 \end_layout
319
319
320 \begin_layout Itemize
320 \begin_layout Itemize
321 Filesystem navigation, via a magic
321 Filesystem navigation, via a magic
322 \family typewriter
322 \family typewriter
323 %cd
323 %cd
324 \family default
324 \family default
325 command, along with a persistent bookmark system (using
325 command, along with a persistent bookmark system (using
326 \family typewriter
326 \family typewriter
327 %bookmark
327 %bookmark
328 \family default
328 \family default
329 ) for fast access to frequently visited directories.
329 ) for fast access to frequently visited directories.
330 \end_layout
330 \end_layout
331
331
332 \begin_layout Itemize
332 \begin_layout Itemize
333 A lightweight persistence framework via the
333 A lightweight persistence framework via the
334 \family typewriter
334 \family typewriter
335 %store
335 %store
336 \family default
336 \family default
337 command, which allows you to save arbitrary Python variables.
337 command, which allows you to save arbitrary Python variables.
338 These get restored automatically when your session restarts.
338 These get restored automatically when your session restarts.
339 \end_layout
339 \end_layout
340
340
341 \begin_layout Itemize
341 \begin_layout Itemize
342 Automatic indentation (optional) of code as you type (through the readline
342 Automatic indentation (optional) of code as you type (through the readline
343 library).
343 library).
344 \end_layout
344 \end_layout
345
345
346 \begin_layout Itemize
346 \begin_layout Itemize
347 Macro system for quickly re-executing multiple lines of previous input with
347 Macro system for quickly re-executing multiple lines of previous input with
348 a single name.
348 a single name.
349 Macros can be stored persistently via
349 Macros can be stored persistently via
350 \family typewriter
350 \family typewriter
351 %store
351 %store
352 \family default
352 \family default
353 and edited via
353 and edited via
354 \family typewriter
354 \family typewriter
355 %edit
355 %edit
356 \family default
356 \family default
357 .
357 .
358
358
359 \end_layout
359 \end_layout
360
360
361 \begin_layout Itemize
361 \begin_layout Itemize
362 Session logging (you can then later use these logs as code in your programs).
362 Session logging (you can then later use these logs as code in your programs).
363 Logs can optionally timestamp all input, and also store session output
363 Logs can optionally timestamp all input, and also store session output
364 (marked as comments, so the log remains valid Python source code).
364 (marked as comments, so the log remains valid Python source code).
365 \end_layout
365 \end_layout
366
366
367 \begin_layout Itemize
367 \begin_layout Itemize
368 Session restoring: logs can be replayed to restore a previous session to
368 Session restoring: logs can be replayed to restore a previous session to
369 the state where you left it.
369 the state where you left it.
370 \end_layout
370 \end_layout
371
371
372 \begin_layout Itemize
372 \begin_layout Itemize
373 Verbose and colored exception traceback printouts.
373 Verbose and colored exception traceback printouts.
374 Easier to parse visually, and in verbose mode they produce a lot of useful
374 Easier to parse visually, and in verbose mode they produce a lot of useful
375 debugging information (basically a terminal version of the cgitb module).
375 debugging information (basically a terminal version of the cgitb module).
376 \end_layout
376 \end_layout
377
377
378 \begin_layout Itemize
378 \begin_layout Itemize
379 Auto-parentheses: callable objects can be executed without parentheses:
379 Auto-parentheses: callable objects can be executed without parentheses:
380
380
381 \family typewriter
381 \family typewriter
382 `sin 3'
382 `sin 3'
383 \family default
383 \family default
384 is automatically converted to
384 is automatically converted to
385 \family typewriter
385 \family typewriter
386 `sin(3)
386 `sin(3)
387 \family default
387 \family default
388 '.
388 '.
389 \end_layout
389 \end_layout
390
390
391 \begin_layout Itemize
391 \begin_layout Itemize
392 Auto-quoting: using `
392 Auto-quoting: using `
393 \family typewriter
393 \family typewriter
394 ,
394 ,
395 \family default
395 \family default
396 ' or `
396 ' or `
397 \family typewriter
397 \family typewriter
398 ;
398 ;
399 \family default
399 \family default
400 ' as the first character forces auto-quoting of the rest of the line:
400 ' as the first character forces auto-quoting of the rest of the line:
401 \family typewriter
401 \family typewriter
402 `,my_function a\InsetSpace ~
402 `,my_function a\InsetSpace ~
403 b'
403 b'
404 \family default
404 \family default
405 becomes automatically
405 becomes automatically
406 \family typewriter
406 \family typewriter
407 `my_function("a","b")'
407 `my_function("a","b")'
408 \family default
408 \family default
409 , while
409 , while
410 \family typewriter
410 \family typewriter
411 `;my_function a\InsetSpace ~
411 `;my_function a\InsetSpace ~
412 b'
412 b'
413 \family default
413 \family default
414 becomes
414 becomes
415 \family typewriter
415 \family typewriter
416 `my_function("a b")'
416 `my_function("a b")'
417 \family default
417 \family default
418 .
418 .
419 \end_layout
419 \end_layout
420
420
421 \begin_layout Itemize
421 \begin_layout Itemize
422 Extensible input syntax.
422 Extensible input syntax.
423 You can define filters that pre-process user input to simplify input in
423 You can define filters that pre-process user input to simplify input in
424 special situations.
424 special situations.
425 This allows for example pasting multi-line code fragments which start with
425 This allows for example pasting multi-line code fragments which start with
426
426
427 \family typewriter
427 \family typewriter
428 `>>>'
428 `>>>'
429 \family default
429 \family default
430 or
430 or
431 \family typewriter
431 \family typewriter
432 `...'
432 `...'
433 \family default
433 \family default
434 such as those from other python sessions or the standard Python documentation.
434 such as those from other python sessions or the standard Python documentation.
435 \end_layout
435 \end_layout
436
436
437 \begin_layout Itemize
437 \begin_layout Itemize
438 Flexible configuration system.
438 Flexible configuration system.
439 It uses a configuration file which allows permanent setting of all command-line
439 It uses a configuration file which allows permanent setting of all command-line
440 options, module loading, code and file execution.
440 options, module loading, code and file execution.
441 The system allows recursive file inclusion, so you can have a base file
441 The system allows recursive file inclusion, so you can have a base file
442 with defaults and layers which load other customizations for particular
442 with defaults and layers which load other customizations for particular
443 projects.
443 projects.
444 \end_layout
444 \end_layout
445
445
446 \begin_layout Itemize
446 \begin_layout Itemize
447 Embeddable.
447 Embeddable.
448 You can call IPython as a python shell inside your own python programs.
448 You can call IPython as a python shell inside your own python programs.
449 This can be used both for debugging code or for providing interactive abilities
449 This can be used both for debugging code or for providing interactive abilities
450 to your programs with knowledge about the local namespaces (very useful
450 to your programs with knowledge about the local namespaces (very useful
451 in debugging and data analysis situations).
451 in debugging and data analysis situations).
452 \end_layout
452 \end_layout
453
453
454 \begin_layout Itemize
454 \begin_layout Itemize
455 Easy debugger access.
455 Easy debugger access.
456 You can set IPython to call up an enhanced version of the Python debugger
456 You can set IPython to call up an enhanced version of the Python debugger
457 (
457 (
458 \family typewriter
458 \family typewriter
459 pdb
459 pdb
460 \family default
460 \family default
461 ) every time there is an uncaught exception.
461 ) every time there is an uncaught exception.
462 This drops you inside the code which triggered the exception with all the
462 This drops you inside the code which triggered the exception with all the
463 data live and it is possible to navigate the stack to rapidly isolate the
463 data live and it is possible to navigate the stack to rapidly isolate the
464 source of a bug.
464 source of a bug.
465 The
465 The
466 \family typewriter
466 \family typewriter
467 %run
467 %run
468 \family default
468 \family default
469 magic command --with the
469 magic command --with the
470 \family typewriter
470 \family typewriter
471 -d
471 -d
472 \family default
472 \family default
473 option-- can run any script under
473 option-- can run any script under
474 \family typewriter
474 \family typewriter
475 pdb
475 pdb
476 \family default
476 \family default
477 's control, automatically setting initial breakpoints for you.
477 's control, automatically setting initial breakpoints for you.
478 This version of
478 This version of
479 \family typewriter
479 \family typewriter
480 pdb
480 pdb
481 \family default
481 \family default
482 has IPython-specific improvements, including tab-completion and traceback
482 has IPython-specific improvements, including tab-completion and traceback
483 coloring support.
483 coloring support.
484 \end_layout
484 \end_layout
485
485
486 \begin_layout Itemize
486 \begin_layout Itemize
487 Profiler support.
487 Profiler support.
488 You can run single statements (similar to
488 You can run single statements (similar to
489 \family typewriter
489 \family typewriter
490 profile.run()
490 profile.run()
491 \family default
491 \family default
492 ) or complete programs under the profiler's control.
492 ) or complete programs under the profiler's control.
493 While this is possible with standard
493 While this is possible with standard
494 \family typewriter
494 \family typewriter
495 cProfile
495 cProfile
496 \family default
496 \family default
497 or
497 or
498 \family typewriter
498 \family typewriter
499 profile
499 profile
500 \family default
500 \family default
501 modules, IPython wraps this functionality with magic commands (see
501 modules, IPython wraps this functionality with magic commands (see
502 \family typewriter
502 \family typewriter
503 `%prun'
503 `%prun'
504 \family default
504 \family default
505 and
505 and
506 \family typewriter
506 \family typewriter
507 `%run -p
507 `%run -p
508 \family default
508 \family default
509 ') convenient for rapid interactive work.
509 ') convenient for rapid interactive work.
510 \end_layout
510 \end_layout
511
511
512 \begin_layout Subsection
512 \begin_layout Subsection
513 Portability and Python requirements
513 Portability and Python requirements
514 \end_layout
514 \end_layout
515
515
516 \begin_layout Standard
516 \begin_layout Standard
517
517
518 \series bold
518 \series bold
519 Python requirements:
519 Python requirements:
520 \series default
520 \series default
521 IPython requires with Python version 2.3 or newer.
521 IPython requires with Python version 2.3 or newer.
522 If you are still using Python 2.2 and can not upgrade, the last version
522 If you are still using Python 2.2 and can not upgrade, the last version
523 of IPython which worked with Python 2.2 was 0.6.15, so you will have to use
523 of IPython which worked with Python 2.2 was 0.6.15, so you will have to use
524 that.
524 that.
525 \end_layout
525 \end_layout
526
526
527 \begin_layout Standard
527 \begin_layout Standard
528 IPython is developed under
528 IPython is developed under
529 \series bold
529 \series bold
530 Linux
530 Linux
531 \series default
531 \series default
532 , but it should work in any reasonable Unix-type system (tested OK under
532 , but it should work in any reasonable Unix-type system (tested OK under
533 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
533 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
534 \end_layout
534 \end_layout
535
535
536 \begin_layout Standard
536 \begin_layout Standard
537
537
538 \series bold
538 \series bold
539 Mac OS X
539 Mac OS X
540 \series default
540 \series default
541 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
541 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
542 Livermore for the information).
542 Livermore for the information).
543 Thanks to Andrea Riciputi, Fink support is available.
543 Thanks to Andrea Riciputi, Fink support is available.
544 \end_layout
544 \end_layout
545
545
546 \begin_layout Standard
546 \begin_layout Standard
547
547
548 \series bold
548 \series bold
549 CygWin
549 CygWin
550 \series default
550 \series default
551 : it works mostly OK, though some users have reported problems with prompt
551 : it works mostly OK, though some users have reported problems with prompt
552 coloring.
552 coloring.
553 No satisfactory solution to this has been found so far, you may want to
553 No satisfactory solution to this has been found so far, you may want to
554 disable colors permanently in the
554 disable colors permanently in the
555 \family typewriter
555 \family typewriter
556 ipythonrc
556 ipythonrc
557 \family default
557 \family default
558 configuration file if you experience problems.
558 configuration file if you experience problems.
559 If you have proper color support under cygwin, please post to the IPython
559 If you have proper color support under cygwin, please post to the IPython
560 mailing list so this issue can be resolved for all users.
560 mailing list so this issue can be resolved for all users.
561 \end_layout
561 \end_layout
562
562
563 \begin_layout Standard
563 \begin_layout Standard
564
564
565 \series bold
565 \series bold
566 Windows
566 Windows
567 \series default
567 \series default
568 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
568 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
569 Section\InsetSpace ~
569 Section\InsetSpace ~
570
570
571 \begin_inset LatexCommand \ref{sub:Under-Windows}
571 \begin_inset LatexCommand \ref{sub:Under-Windows}
572
572
573 \end_inset
573 \end_inset
574
574
575 describes installation details for Windows, including some additional tools
575 describes installation details for Windows, including some additional tools
576 needed on this platform.
576 needed on this platform.
577 \end_layout
577 \end_layout
578
578
579 \begin_layout Standard
579 \begin_layout Standard
580 Windows 9x support is present, and has been reported to work fine (at least
580 Windows 9x support is present, and has been reported to work fine (at least
581 on WinME).
581 on WinME).
582 \end_layout
582 \end_layout
583
583
584 \begin_layout Standard
584 \begin_layout Standard
585 Note, that I have very little access to and experience with Windows development.
585 Note, that I have very little access to and experience with Windows development.
586 However, an excellent group of Win32 users (led by Ville Vainio), consistently
586 However, an excellent group of Win32 users (led by Ville Vainio), consistently
587 contribute bugfixes and platform-specific enhancements, so they more than
587 contribute bugfixes and platform-specific enhancements, so they more than
588 make up for my deficiencies on that front.
588 make up for my deficiencies on that front.
589 In fact, Win32 users report using IPython as a system shell (see Sec.\InsetSpace ~
589 In fact, Win32 users report using IPython as a system shell (see Sec.\InsetSpace ~
590
590
591 \begin_inset LatexCommand \ref{sec:IPython-as-shell}
591 \begin_inset LatexCommand \ref{sec:IPython-as-shell}
592
592
593 \end_inset
593 \end_inset
594
594
595 for details), as it offers a level of control and features which the default
595 for details), as it offers a level of control and features which the default
596
596
597 \family typewriter
597 \family typewriter
598 cmd.exe
598 cmd.exe
599 \family default
599 \family default
600 doesn't provide.
600 doesn't provide.
601 \end_layout
601 \end_layout
602
602
603 \begin_layout Subsection
603 \begin_layout Subsection
604 Location
604 Location
605 \end_layout
605 \end_layout
606
606
607 \begin_layout Standard
607 \begin_layout Standard
608 IPython is generously hosted at
608 IPython is generously hosted at
609 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
609 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
610
610
611 \end_inset
611 \end_inset
612
612
613 by the Enthought, Inc and the SciPy project.
613 by the Enthought, Inc and the SciPy project.
614 This site offers downloads, subversion access, mailing lists and a bug
614 This site offers downloads, subversion access, mailing lists and a bug
615 tracking system.
615 tracking system.
616 I am very grateful to Enthought (
616 I am very grateful to Enthought (
617 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
617 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
618
618
619 \end_inset
619 \end_inset
620
620
621 ) and all of the SciPy team for their contribution.
621 ) and all of the SciPy team for their contribution.
622 \end_layout
622 \end_layout
623
623
624 \begin_layout Section
624 \begin_layout Section
625 \begin_inset LatexCommand \label{sec:install}
625 \begin_inset LatexCommand \label{sec:install}
626
626
627 \end_inset
627 \end_inset
628
628
629 Installation
629 Installation
630 \end_layout
630 \end_layout
631
631
632 \begin_layout Subsection
632 \begin_layout Subsection
633 Instant instructions
633 Instant instructions
634 \end_layout
634 \end_layout
635
635
636 \begin_layout Standard
636 \begin_layout Standard
637 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
637 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
638 download, then install with
638 download, then install with
639 \family typewriter
639 \family typewriter
640 `python setup.py install'
640 `python setup.py install'
641 \family default
641 \family default
642 .
642 .
643 Under Windows, double-click on the provided
643 Under Windows, double-click on the provided
644 \family typewriter
644 \family typewriter
645 .exe
645 .exe
646 \family default
646 \family default
647 binary installer.
647 binary installer.
648 \end_layout
648 \end_layout
649
649
650 \begin_layout Standard
650 \begin_layout Standard
651 Then, take a look at Sections
651 Then, take a look at Sections
652 \begin_inset LatexCommand \ref{sec:good_config}
652 \begin_inset LatexCommand \ref{sec:good_config}
653
653
654 \end_inset
654 \end_inset
655
655
656 for configuring things optimally and
656 for configuring things optimally and
657 \begin_inset LatexCommand \ref{sec:quick_tips}
657 \begin_inset LatexCommand \ref{sec:quick_tips}
658
658
659 \end_inset
659 \end_inset
660
660
661 for quick tips on efficient use of IPython.
661 for quick tips on efficient use of IPython.
662 You can later refer to the rest of the manual for all the gory details.
662 You can later refer to the rest of the manual for all the gory details.
663 \end_layout
663 \end_layout
664
664
665 \begin_layout Standard
665 \begin_layout Standard
666 See the notes in sec.
666 See the notes in sec.
667
667
668 \begin_inset LatexCommand \ref{sec:upgrade}
668 \begin_inset LatexCommand \ref{sec:upgrade}
669
669
670 \end_inset
670 \end_inset
671
671
672 for upgrading IPython versions.
672 for upgrading IPython versions.
673 \end_layout
673 \end_layout
674
674
675 \begin_layout Subsection
675 \begin_layout Subsection
676 Detailed Unix instructions (Linux, Mac OS X, etc.)
676 Detailed Unix instructions (Linux, Mac OS X, etc.)
677 \end_layout
677 \end_layout
678
678
679 \begin_layout Standard
679 \begin_layout Standard
680 For RPM based systems, simply install the supplied package in the usual
680 For RPM based systems, simply install the supplied package in the usual
681 manner.
681 manner.
682 If you download the tar archive, the process is:
682 If you download the tar archive, the process is:
683 \end_layout
683 \end_layout
684
684
685 \begin_layout Enumerate
685 \begin_layout Enumerate
686 Unzip/untar the
686 Unzip/untar the
687 \family typewriter
687 \family typewriter
688 ipython-XXX.tar.gz
688 ipython-XXX.tar.gz
689 \family default
689 \family default
690 file wherever you want (
690 file wherever you want (
691 \family typewriter
691 \family typewriter
692 XXX
692 XXX
693 \family default
693 \family default
694 is the version number).
694 is the version number).
695 It will make a directory called
695 It will make a directory called
696 \family typewriter
696 \family typewriter
697 ipython-XXX.
697 ipython-XXX.
698
698
699 \family default
699 \family default
700 Change into that directory where you will find the files
700 Change into that directory where you will find the files
701 \family typewriter
701 \family typewriter
702 README
702 README
703 \family default
703 \family default
704 and
704 and
705 \family typewriter
705 \family typewriter
706 setup.py
706 setup.py
707 \family default
707 \family default
708 .
708 .
709
709
710 \family typewriter
710 \family typewriter
711 O
711 O
712 \family default
712 \family default
713 nce you've completed the installation, you can safely remove this directory.
713 nce you've completed the installation, you can safely remove this directory.
714
714
715 \end_layout
715 \end_layout
716
716
717 \begin_layout Enumerate
717 \begin_layout Enumerate
718 If you are installing over a previous installation of version 0.2.0 or earlier,
718 If you are installing over a previous installation of version 0.2.0 or earlier,
719 first remove your
719 first remove your
720 \family typewriter
720 \family typewriter
721 $HOME/.ipython
721 $HOME/.ipython
722 \family default
722 \family default
723 directory, since the configuration file format has changed somewhat (the
723 directory, since the configuration file format has changed somewhat (the
724 '=' were removed from all option specifications).
724 '=' were removed from all option specifications).
725 Or you can call ipython with the
725 Or you can call ipython with the
726 \family typewriter
726 \family typewriter
727 -upgrade
727 -upgrade
728 \family default
728 \family default
729 option and it will do this automatically for you.
729 option and it will do this automatically for you.
730 \end_layout
730 \end_layout
731
731
732 \begin_layout Enumerate
732 \begin_layout Enumerate
733 IPython uses distutils, so you can install it by simply typing at the system
733 IPython uses distutils, so you can install it by simply typing at the system
734 prompt (don't type the
734 prompt (don't type the
735 \family typewriter
735 \family typewriter
736 $
736 $
737 \family default
737 \family default
738 )
738 )
739 \newline
739 \newline
740
740
741 \family typewriter
741 \family typewriter
742 $ python setup.py install
742 $ python setup.py install
743 \family default
743 \family default
744
744
745 \newline
745 \newline
746 Note that this assumes you have root access to your machine.
746 Note that this assumes you have root access to your machine.
747 If you don't have root access or don't want IPython to go in the default
747 If you don't have root access or don't want IPython to go in the default
748 python directories, you'll need to use the
748 python directories, you'll need to use the
749 \begin_inset ERT
749 \begin_inset ERT
750 status collapsed
750 status collapsed
751
751
752 \begin_layout Standard
752 \begin_layout Standard
753
753
754
754
755 \backslash
755 \backslash
756 verb|--home|
756 verb|--home|
757 \end_layout
757 \end_layout
758
758
759 \end_inset
759 \end_inset
760
760
761 option (or
761 option (or
762 \begin_inset ERT
762 \begin_inset ERT
763 status collapsed
763 status collapsed
764
764
765 \begin_layout Standard
765 \begin_layout Standard
766
766
767
767
768 \backslash
768 \backslash
769 verb|--prefix|
769 verb|--prefix|
770 \end_layout
770 \end_layout
771
771
772 \end_inset
772 \end_inset
773
773
774 ).
774 ).
775 For example:
775 For example:
776 \newline
776 \newline
777
777
778 \begin_inset ERT
778 \begin_inset ERT
779 status collapsed
779 status collapsed
780
780
781 \begin_layout Standard
781 \begin_layout Standard
782
782
783
783
784 \backslash
784 \backslash
785 verb|$ python setup.py install --home $HOME/local|
785 verb|$ python setup.py install --home $HOME/local|
786 \end_layout
786 \end_layout
787
787
788 \end_inset
788 \end_inset
789
789
790
790
791 \newline
791 \newline
792 will install IPython into
792 will install IPython into
793 \family typewriter
793 \family typewriter
794 $HOME/local
794 $HOME/local
795 \family default
795 \family default
796 and its subdirectories (creating them if necessary).
796 and its subdirectories (creating them if necessary).
797 \newline
797 \newline
798 You can type
798 You can type
799 \newline
799 \newline
800
800
801 \begin_inset ERT
801 \begin_inset ERT
802 status collapsed
802 status collapsed
803
803
804 \begin_layout Standard
804 \begin_layout Standard
805
805
806
806
807 \backslash
807 \backslash
808 verb|$ python setup.py --help|
808 verb|$ python setup.py --help|
809 \end_layout
809 \end_layout
810
810
811 \end_inset
811 \end_inset
812
812
813
813
814 \newline
814 \newline
815 for more details.
815 for more details.
816 \newline
816 \newline
817 Note that if you change the default location for
817 Note that if you change the default location for
818 \begin_inset ERT
818 \begin_inset ERT
819 status collapsed
819 status collapsed
820
820
821 \begin_layout Standard
821 \begin_layout Standard
822
822
823
823
824 \backslash
824 \backslash
825 verb|--home|
825 verb|--home|
826 \end_layout
826 \end_layout
827
827
828 \end_inset
828 \end_inset
829
829
830 at installation, IPython may end up installed at a location which is not
830 at installation, IPython may end up installed at a location which is not
831 part of your
831 part of your
832 \family typewriter
832 \family typewriter
833 $PYTHONPATH
833 $PYTHONPATH
834 \family default
834 \family default
835 environment variable.
835 environment variable.
836 In this case, you'll need to configure this variable to include the actual
836 In this case, you'll need to configure this variable to include the actual
837 directory where the
837 directory where the
838 \family typewriter
838 \family typewriter
839 IPython/
839 IPython/
840 \family default
840 \family default
841 directory ended (typically the value you give to
841 directory ended (typically the value you give to
842 \begin_inset ERT
842 \begin_inset ERT
843 status collapsed
843 status collapsed
844
844
845 \begin_layout Standard
845 \begin_layout Standard
846
846
847
847
848 \backslash
848 \backslash
849 verb|--home|
849 verb|--home|
850 \end_layout
850 \end_layout
851
851
852 \end_inset
852 \end_inset
853
853
854 plus
854 plus
855 \family typewriter
855 \family typewriter
856 /lib/python
856 /lib/python
857 \family default
857 \family default
858 ).
858 ).
859 \end_layout
859 \end_layout
860
860
861 \begin_layout Subsubsection
861 \begin_layout Subsubsection
862 Mac OSX information
862 Mac OSX information
863 \end_layout
863 \end_layout
864
864
865 \begin_layout Standard
865 \begin_layout Standard
866 Under OSX, there is a choice you need to make.
866 Under OSX, there is a choice you need to make.
867 Apple ships its own build of Python, which lives in the core OSX filesystem
867 Apple ships its own build of Python, which lives in the core OSX filesystem
868 hierarchy.
868 hierarchy.
869 You can also manually install a separate Python, either purely by hand
869 You can also manually install a separate Python, either purely by hand
870 (typically in
870 (typically in
871 \family typewriter
871 \family typewriter
872 /usr/local
872 /usr/local
873 \family default
873 \family default
874 ) or by using Fink, which puts everything under
874 ) or by using Fink, which puts everything under
875 \family typewriter
875 \family typewriter
876 /sw
876 /sw
877 \family default
877 \family default
878 .
878 .
879 Which route to follow is a matter of personal preference, as I've seen
879 Which route to follow is a matter of personal preference, as I've seen
880 users who favor each of the approaches.
880 users who favor each of the approaches.
881 Here I will simply list the known installation issues under OSX, along
881 Here I will simply list the known installation issues under OSX, along
882 with their solutions.
882 with their solutions.
883 \end_layout
883 \end_layout
884
884
885 \begin_layout Standard
885 \begin_layout Standard
886 This page:
886 This page:
887 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
887 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
888
888
889 \end_inset
889 \end_inset
890
890
891 contains information on this topic, with additional details on how to make
891 contains information on this topic, with additional details on how to make
892 IPython and matplotlib play nicely under OSX.
892 IPython and matplotlib play nicely under OSX.
893 \end_layout
893 \end_layout
894
894
895 \begin_layout Subsubsection*
895 \begin_layout Subsubsection*
896 GUI problems
896 GUI problems
897 \end_layout
897 \end_layout
898
898
899 \begin_layout Standard
899 \begin_layout Standard
900 The following instructions apply to an install of IPython under OSX from
900 The following instructions apply to an install of IPython under OSX from
901 unpacking the
901 unpacking the
902 \family typewriter
902 \family typewriter
903 .tar.gz
903 .tar.gz
904 \family default
904 \family default
905 distribution and installing it for the default Python interpreter shipped
905 distribution and installing it for the default Python interpreter shipped
906 by Apple.
906 by Apple.
907 If you are using a fink install, fink will take care of these details for
907 If you are using a fink install, fink will take care of these details for
908 you, by installing IPython against fink's Python.
908 you, by installing IPython against fink's Python.
909 \end_layout
909 \end_layout
910
910
911 \begin_layout Standard
911 \begin_layout Standard
912 IPython offers various forms of support for interacting with graphical applicati
912 IPython offers various forms of support for interacting with graphical applicati
913 ons from the command line, from simple Tk apps (which are in principle always
913 ons from the command line, from simple Tk apps (which are in principle always
914 supported by Python) to interactive control of WX, Qt and GTK apps.
914 supported by Python) to interactive control of WX, Qt and GTK apps.
915 Under OSX, however, this requires that ipython is installed by calling
915 Under OSX, however, this requires that ipython is installed by calling
916 the special
916 the special
917 \family typewriter
917 \family typewriter
918 pythonw
918 pythonw
919 \family default
919 \family default
920 script at installation time, which takes care of coordinating things with
920 script at installation time, which takes care of coordinating things with
921 Apple's graphical environment.
921 Apple's graphical environment.
922 \end_layout
922 \end_layout
923
923
924 \begin_layout Standard
924 \begin_layout Standard
925 So when installing under OSX, it is best to use the following command:
925 So when installing under OSX, it is best to use the following command:
926 \family typewriter
926 \family typewriter
927
927
928 \newline
928 \newline
929
929
930 \family default
930 \family default
931
931
932 \begin_inset ERT
932 \begin_inset ERT
933 status collapsed
933 status collapsed
934
934
935 \begin_layout Standard
935 \begin_layout Standard
936
936
937
937
938 \backslash
938 \backslash
939 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
939 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
940 \end_layout
940 \end_layout
941
941
942 \end_inset
942 \end_inset
943
943
944
944
945 \newline
945 \newline
946 or
946 or
947 \newline
947 \newline
948
948
949 \begin_inset ERT
949 \begin_inset ERT
950 status collapsed
950 status collapsed
951
951
952 \begin_layout Standard
952 \begin_layout Standard
953
953
954
954
955 \backslash
955 \backslash
956 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
956 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
957 \end_layout
957 \end_layout
958
958
959 \end_inset
959 \end_inset
960
960
961
961
962 \newline
962 \newline
963 depending on where you like to keep hand-installed executables.
963 depending on where you like to keep hand-installed executables.
964 \end_layout
964 \end_layout
965
965
966 \begin_layout Standard
966 \begin_layout Standard
967 The resulting script will have an appropriate shebang line (the first line
967 The resulting script will have an appropriate shebang line (the first line
968 in the script whic begins with
968 in the script whic begins with
969 \family typewriter
969 \family typewriter
970 #!...
970 #!...
971 \family default
971 \family default
972 ) such that the ipython interpreter can interact with the OS X GUI.
972 ) such that the ipython interpreter can interact with the OS X GUI.
973 If the installed version does not work and has a shebang line that points
973 If the installed version does not work and has a shebang line that points
974 to, for example, just
974 to, for example, just
975 \family typewriter
975 \family typewriter
976 /usr/bin/python
976 /usr/bin/python
977 \family default
977 \family default
978 , then you might have a stale, cached version in your
978 , then you might have a stale, cached version in your
979 \family typewriter
979 \family typewriter
980 build/scripts-<python-version>
980 build/scripts-<python-version>
981 \family default
981 \family default
982 directory.
982 directory.
983 Delete that directory and rerun the
983 Delete that directory and rerun the
984 \family typewriter
984 \family typewriter
985 setup.py
985 setup.py
986 \family default
986 \family default
987 .
987 .
988
988
989 \end_layout
989 \end_layout
990
990
991 \begin_layout Standard
991 \begin_layout Standard
992 It is also a good idea to use the special flag
992 It is also a good idea to use the special flag
993 \begin_inset ERT
993 \begin_inset ERT
994 status collapsed
994 status collapsed
995
995
996 \begin_layout Standard
996 \begin_layout Standard
997
997
998
998
999 \backslash
999 \backslash
1000 verb|--install-scripts|
1000 verb|--install-scripts|
1001 \end_layout
1001 \end_layout
1002
1002
1003 \end_inset
1003 \end_inset
1004
1004
1005 as indicated above, to ensure that the ipython scripts end up in a location
1005 as indicated above, to ensure that the ipython scripts end up in a location
1006 which is part of your
1006 which is part of your
1007 \family typewriter
1007 \family typewriter
1008 $PATH
1008 $PATH
1009 \family default
1009 \family default
1010 .
1010 .
1011 Otherwise Apple's Python will put the scripts in an internal directory
1011 Otherwise Apple's Python will put the scripts in an internal directory
1012 not available by default at the command line (if you use
1012 not available by default at the command line (if you use
1013 \family typewriter
1013 \family typewriter
1014 /usr/local/bin
1014 /usr/local/bin
1015 \family default
1015 \family default
1016 , you need to make sure this is in your
1016 , you need to make sure this is in your
1017 \family typewriter
1017 \family typewriter
1018 $PATH
1018 $PATH
1019 \family default
1019 \family default
1020 , which may not be true by default).
1020 , which may not be true by default).
1021 \end_layout
1021 \end_layout
1022
1022
1023 \begin_layout Subsubsection*
1023 \begin_layout Subsubsection*
1024 Readline problems
1024 Readline problems
1025 \end_layout
1025 \end_layout
1026
1026
1027 \begin_layout Standard
1027 \begin_layout Standard
1028 By default, the Python version shipped by Apple does
1028 By default, the Python version shipped by Apple does
1029 \emph on
1029 \emph on
1030 not
1030 not
1031 \emph default
1031 \emph default
1032 include the readline library, so central to IPython's behavior.
1032 include the readline library, so central to IPython's behavior.
1033 If you install IPython against Apple's Python, you will not have arrow
1033 If you install IPython against Apple's Python, you will not have arrow
1034 keys, tab completion, etc.
1034 keys, tab completion, etc.
1035 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
1035 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
1036 \newline
1036 \newline
1037
1037
1038 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
1038 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
1039
1039
1040 \end_inset
1040 \end_inset
1041
1041
1042
1042
1043 \end_layout
1043 \end_layout
1044
1044
1045 \begin_layout Standard
1045 \begin_layout Standard
1046 If you are using OSX 10.4 (Tiger), after installing this package you need
1046 If you are using OSX 10.4 (Tiger), after installing this package you need
1047 to either:
1047 to either:
1048 \end_layout
1048 \end_layout
1049
1049
1050 \begin_layout Enumerate
1050 \begin_layout Enumerate
1051 move
1051 move
1052 \family typewriter
1052 \family typewriter
1053 readline.so
1053 readline.so
1054 \family default
1054 \family default
1055 from
1055 from
1056 \family typewriter
1056 \family typewriter
1057 /Library/Python/2.3
1057 /Library/Python/2.3
1058 \family default
1058 \family default
1059 to
1059 to
1060 \family typewriter
1060 \family typewriter
1061 /Library/Python/2.3/site-packages
1061 /Library/Python/2.3/site-packages
1062 \family default
1062 \family default
1063 , or
1063 , or
1064 \end_layout
1064 \end_layout
1065
1065
1066 \begin_layout Enumerate
1066 \begin_layout Enumerate
1067 install
1067 install
1068 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
1068 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
1069
1069
1070 \end_inset
1070 \end_inset
1071
1071
1072
1072
1073 \end_layout
1073 \end_layout
1074
1074
1075 \begin_layout Standard
1075 \begin_layout Standard
1076 Users installing against Fink's Python or a properly hand-built one should
1076 Users installing against Fink's Python or a properly hand-built one should
1077 not have this problem.
1077 not have this problem.
1078 \end_layout
1078 \end_layout
1079
1079
1080 \begin_layout Subsubsection*
1080 \begin_layout Subsubsection*
1081 DarwinPorts
1081 DarwinPorts
1082 \end_layout
1082 \end_layout
1083
1083
1084 \begin_layout Standard
1084 \begin_layout Standard
1085 I report here a message from an OSX user, who suggests an alternative means
1085 I report here a message from an OSX user, who suggests an alternative means
1086 of using IPython under this operating system with good results.
1086 of using IPython under this operating system with good results.
1087 Please let me know of any updates that may be useful for this section.
1087 Please let me know of any updates that may be useful for this section.
1088 His message is reproduced verbatim below:
1088 His message is reproduced verbatim below:
1089 \end_layout
1089 \end_layout
1090
1090
1091 \begin_layout Quote
1091 \begin_layout Quote
1092 From: Markus Banfi
1092 From: Markus Banfi
1093 \family typewriter
1093 \family typewriter
1094 <markus.banfi-AT-mospheira.net>
1094 <markus.banfi-AT-mospheira.net>
1095 \end_layout
1095 \end_layout
1096
1096
1097 \begin_layout Quote
1097 \begin_layout Quote
1098 As a MacOS X (10.4.2) user I prefer to install software using DawinPorts instead
1098 As a MacOS X (10.4.2) user I prefer to install software using DawinPorts instead
1099 of Fink.
1099 of Fink.
1100 I had no problems installing ipython with DarwinPorts.
1100 I had no problems installing ipython with DarwinPorts.
1101 It's just:
1101 It's just:
1102 \end_layout
1102 \end_layout
1103
1103
1104 \begin_layout Quote
1104 \begin_layout Quote
1105
1105
1106 \family typewriter
1106 \family typewriter
1107 sudo port install py-ipython
1107 sudo port install py-ipython
1108 \end_layout
1108 \end_layout
1109
1109
1110 \begin_layout Quote
1110 \begin_layout Quote
1111 It automatically resolved all dependencies (python24, readline, py-readline).
1111 It automatically resolved all dependencies (python24, readline, py-readline).
1112 So far I did not encounter any problems with the DarwinPorts port of ipython.
1112 So far I did not encounter any problems with the DarwinPorts port of ipython.
1113
1113
1114 \end_layout
1114 \end_layout
1115
1115
1116 \begin_layout Subsection
1116 \begin_layout Subsection
1117 \begin_inset LatexCommand \label{sub:Under-Windows}
1117 \begin_inset LatexCommand \label{sub:Under-Windows}
1118
1118
1119 \end_inset
1119 \end_inset
1120
1120
1121 Windows instructions
1121 Windows instructions
1122 \end_layout
1122 \end_layout
1123
1123
1124 \begin_layout Standard
1124 \begin_layout Standard
1125 Some of IPython's very useful features are:
1125 Some of IPython's very useful features are:
1126 \end_layout
1126 \end_layout
1127
1127
1128 \begin_layout Itemize
1128 \begin_layout Itemize
1129 Integrated readline support (Tab-based file, object and attribute completion,
1129 Integrated readline support (Tab-based file, object and attribute completion,
1130 input history across sessions, editable command line, etc.)
1130 input history across sessions, editable command line, etc.)
1131 \end_layout
1131 \end_layout
1132
1132
1133 \begin_layout Itemize
1133 \begin_layout Itemize
1134 Coloring of prompts, code and tracebacks.
1134 Coloring of prompts, code and tracebacks.
1135 \end_layout
1135 \end_layout
1136
1136
1137 \begin_layout Standard
1137 \begin_layout Standard
1138 These, by default, are only available under Unix-like operating systems.
1138 These, by default, are only available under Unix-like operating systems.
1139 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
1139 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
1140 from them.
1140 from them.
1141 His readline library originally implemented both GNU readline functionality
1141 His readline library originally implemented both GNU readline functionality
1142 and color support, so that IPython under Windows XP/2k can be as friendly
1142 and color support, so that IPython under Windows XP/2k can be as friendly
1143 and powerful as under Unix-like environments.
1143 and powerful as under Unix-like environments.
1144
1144
1145 \end_layout
1145 \end_layout
1146
1146
1147 \begin_layout Standard
1147 \begin_layout Standard
1148 This library, now named
1148 This library, now named
1149 \family typewriter
1149 \family typewriter
1150 PyReadline
1150 PyReadline
1151 \family default
1151 \family default
1152 , has been absorbed by the IPython team (JοΏ½rgen Stenarson, in particular),
1152 , has been absorbed by the IPython team (JοΏ½rgen Stenarson, in particular),
1153 and it continues to be developed with new features, as well as being distribute
1153 and it continues to be developed with new features, as well as being distribute
1154 d directly from the IPython site.
1154 d directly from the IPython site.
1155 \end_layout
1155 \end_layout
1156
1156
1157 \begin_layout Standard
1157 \begin_layout Standard
1158 The
1158 The
1159 \family typewriter
1159 \family typewriter
1160 PyReadline
1160 PyReadline
1161 \family default
1161 \family default
1162 extension requires
1162 extension requires
1163 \family typewriter
1163 \family typewriter
1164 CTypes
1164 CTypes
1165 \family default
1165 \family default
1166 and the windows IPython installer needs
1166 and the windows IPython installer needs
1167 \family typewriter
1167 \family typewriter
1168 PyWin32
1168 PyWin32
1169 \family default
1169 \family default
1170 , so in all you need:
1170 , so in all you need:
1171 \end_layout
1171 \end_layout
1172
1172
1173 \begin_layout Enumerate
1173 \begin_layout Enumerate
1174
1174
1175 \family typewriter
1175 \family typewriter
1176 PyWin32
1176 PyWin32
1177 \family default
1177 \family default
1178 from
1178 from
1179 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/pywin32}
1179 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/pywin32}
1180
1180
1181 \end_inset
1181 \end_inset
1182
1182
1183 .
1183 .
1184 \end_layout
1184 \end_layout
1185
1185
1186 \begin_layout Enumerate
1186 \begin_layout Enumerate
1187
1187
1188 \family typewriter
1188 \family typewriter
1189 PyReadline
1189 PyReadline
1190 \family default
1190 \family default
1191 for Windows from
1191 for Windows from
1192 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org/moin/PyReadline/Intro}
1192 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org/moin/PyReadline/Intro}
1193
1193
1194 \end_inset
1194 \end_inset
1195
1195
1196 .
1196 .
1197 That page contains further details on using and configuring the system
1197 That page contains further details on using and configuring the system
1198 to your liking.
1198 to your liking.
1199 \end_layout
1199 \end_layout
1200
1200
1201 \begin_layout Enumerate
1201 \begin_layout Enumerate
1202 Finally,
1202 Finally,
1203 \emph on
1203 \emph on
1204 only
1204 only
1205 \emph default
1205 \emph default
1206 if you are using Python 2.3 or 2.4, you need
1206 if you are using Python 2.3 or 2.4, you need
1207 \family typewriter
1207 \family typewriter
1208 CTypes
1208 CTypes
1209 \family default
1209 \family default
1210 from
1210 from
1211 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1211 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1212
1212
1213 \end_inset
1213 \end_inset
1214
1214
1215 (you
1215 (you
1216 \emph on
1216 \emph on
1217 must
1217 must
1218 \emph default
1218 \emph default
1219 use version 0.9.1 or newer).
1219 use version 0.9.1 or newer).
1220 This package is included in Python 2.5, so you don't need to manually get
1220 This package is included in Python 2.5, so you don't need to manually get
1221 it if your Python version is 2.5 or newer.
1221 it if your Python version is 2.5 or newer.
1222 \end_layout
1222 \end_layout
1223
1223
1224 \begin_layout Standard
1224 \begin_layout Standard
1225
1225
1226 \series bold
1226 \series bold
1227 Warning about a broken readline-like library:
1227 Warning about a broken readline-like library:
1228 \series default
1228 \series default
1229 several users have reported problems stemming from using the pseudo-readline
1229 several users have reported problems stemming from using the pseudo-readline
1230 library at
1230 library at
1231 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
1231 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
1232
1232
1233 \end_inset
1233 \end_inset
1234
1234
1235 .
1235 .
1236 This is a broken library which, while called readline, only implements
1236 This is a broken library which, while called readline, only implements
1237 an incomplete subset of the readline API.
1237 an incomplete subset of the readline API.
1238 Since it is still called readline, it fools IPython's detection mechanisms
1238 Since it is still called readline, it fools IPython's detection mechanisms
1239 and causes unpredictable crashes later.
1239 and causes unpredictable crashes later.
1240 If you wish to use IPython under Windows, you must NOT use this library,
1240 If you wish to use IPython under Windows, you must NOT use this library,
1241 which for all purposes is (at least as of version 1.6) terminally broken.
1241 which for all purposes is (at least as of version 1.6) terminally broken.
1242 \end_layout
1242 \end_layout
1243
1243
1244 \begin_layout Subsubsection
1244 \begin_layout Subsubsection
1245 Installation procedure
1245 Installation procedure
1246 \end_layout
1246 \end_layout
1247
1247
1248 \begin_layout Standard
1248 \begin_layout Standard
1249 Once you have the above installed, from the IPython download directory grab
1249 Once you have the above installed, from the IPython download directory grab
1250 the
1250 the
1251 \family typewriter
1251 \family typewriter
1252 ipython-XXX.win32.exe
1252 ipython-XXX.win32.exe
1253 \family default
1253 \family default
1254 file, where
1254 file, where
1255 \family typewriter
1255 \family typewriter
1256 XXX
1256 XXX
1257 \family default
1257 \family default
1258 represents the version number.
1258 represents the version number.
1259 This is a regular windows executable installer, which you can simply double-cli
1259 This is a regular windows executable installer, which you can simply double-cli
1260 ck to install.
1260 ck to install.
1261 It will add an entry for IPython to your Start Menu, as well as registering
1261 It will add an entry for IPython to your Start Menu, as well as registering
1262 IPython in the Windows list of applications, so you can later uninstall
1262 IPython in the Windows list of applications, so you can later uninstall
1263 it from the Control Panel.
1263 it from the Control Panel.
1264
1264
1265 \end_layout
1265 \end_layout
1266
1266
1267 \begin_layout Standard
1267 \begin_layout Standard
1268 IPython tries to install the configuration information in a directory named
1268 IPython tries to install the configuration information in a directory named
1269
1269
1270 \family typewriter
1270 \family typewriter
1271 .ipython
1271 .ipython
1272 \family default
1272 \family default
1273 (
1273 (
1274 \family typewriter
1274 \family typewriter
1275 _ipython
1275 _ipython
1276 \family default
1276 \family default
1277 under Windows) located in your `home' directory.
1277 under Windows) located in your `home' directory.
1278 IPython sets this directory by looking for a
1278 IPython sets this directory by looking for a
1279 \family typewriter
1279 \family typewriter
1280 HOME
1280 HOME
1281 \family default
1281 \family default
1282 environment variable; if such a variable does not exist, it uses
1282 environment variable; if such a variable does not exist, it uses
1283 \family typewriter
1283 \family typewriter
1284 HOMEDRIVE
1284 HOMEDRIVE
1285 \backslash
1285 \backslash
1286 HOMEPATH
1286 HOMEPATH
1287 \family default
1287 \family default
1288 (these are always defined by Windows).
1288 (these are always defined by Windows).
1289 This typically gives something like
1289 This typically gives something like
1290 \family typewriter
1290 \family typewriter
1291 C:
1291 C:
1292 \backslash
1292 \backslash
1293 Documents and Settings
1293 Documents and Settings
1294 \backslash
1294 \backslash
1295 YourUserName
1295 YourUserName
1296 \family default
1296 \family default
1297 , but your local details may vary.
1297 , but your local details may vary.
1298 In this directory you will find all the files that configure IPython's
1298 In this directory you will find all the files that configure IPython's
1299 defaults, and you can put there your profiles and extensions.
1299 defaults, and you can put there your profiles and extensions.
1300 This directory is automatically added by IPython to
1300 This directory is automatically added by IPython to
1301 \family typewriter
1301 \family typewriter
1302 sys.path
1302 sys.path
1303 \family default
1303 \family default
1304 , so anything you place there can be found by
1304 , so anything you place there can be found by
1305 \family typewriter
1305 \family typewriter
1306 import
1306 import
1307 \family default
1307 \family default
1308 statements.
1308 statements.
1309 \end_layout
1309 \end_layout
1310
1310
1311 \begin_layout Paragraph
1311 \begin_layout Paragraph
1312 Upgrading
1312 Upgrading
1313 \end_layout
1313 \end_layout
1314
1314
1315 \begin_layout Standard
1315 \begin_layout Standard
1316 For an IPython upgrade, you should first uninstall the previous version.
1316 For an IPython upgrade, you should first uninstall the previous version.
1317 This will ensure that all files and directories (such as the documentation)
1317 This will ensure that all files and directories (such as the documentation)
1318 which carry embedded version strings in their names are properly removed.
1318 which carry embedded version strings in their names are properly removed.
1319 \end_layout
1319 \end_layout
1320
1320
1321 \begin_layout Paragraph
1321 \begin_layout Paragraph
1322 Manual installation under Win32
1322 Manual installation under Win32
1323 \end_layout
1323 \end_layout
1324
1324
1325 \begin_layout Standard
1325 \begin_layout Standard
1326 In case the automatic installer does not work for some reason, you can download
1326 In case the automatic installer does not work for some reason, you can download
1327 the
1327 the
1328 \family typewriter
1328 \family typewriter
1329 ipython-XXX.tar.gz
1329 ipython-XXX.tar.gz
1330 \family default
1330 \family default
1331 file, which contains the full IPython source distribution (the popular
1331 file, which contains the full IPython source distribution (the popular
1332 WinZip can read
1332 WinZip can read
1333 \family typewriter
1333 \family typewriter
1334 .tar.gz
1334 .tar.gz
1335 \family default
1335 \family default
1336 files).
1336 files).
1337 After uncompressing the archive, you can install it at a command terminal
1337 After uncompressing the archive, you can install it at a command terminal
1338 just like any other Python module, by using
1338 just like any other Python module, by using
1339 \family typewriter
1339 \family typewriter
1340 `python setup.py install'
1340 `python setup.py install'
1341 \family default
1341 \family default
1342 .
1342 .
1343
1343
1344 \end_layout
1344 \end_layout
1345
1345
1346 \begin_layout Standard
1346 \begin_layout Standard
1347 After the installation, run the supplied
1347 After the installation, run the supplied
1348 \family typewriter
1348 \family typewriter
1349 win32_manual_post_install.py
1349 win32_manual_post_install.py
1350 \family default
1350 \family default
1351 script, which creates the necessary Start Menu shortcuts for you.
1351 script, which creates the necessary Start Menu shortcuts for you.
1352 \end_layout
1352 \end_layout
1353
1353
1354 \begin_layout Subsection
1354 \begin_layout Subsection
1355 \begin_inset LatexCommand \label{sec:upgrade}
1355 \begin_inset LatexCommand \label{sec:upgrade}
1356
1356
1357 \end_inset
1357 \end_inset
1358
1358
1359 Upgrading from a previous version
1359 Upgrading from a previous version
1360 \end_layout
1360 \end_layout
1361
1361
1362 \begin_layout Standard
1362 \begin_layout Standard
1363 If you are upgrading from a previous version of IPython, after doing the
1363 If you are upgrading from a previous version of IPython, after doing the
1364 routine installation described above, you should call IPython with the
1364 routine installation described above, you should call IPython with the
1365
1365
1366 \family typewriter
1366 \family typewriter
1367 -upgrade
1367 -upgrade
1368 \family default
1368 \family default
1369 option the first time you run your new copy.
1369 option the first time you run your new copy.
1370 This will automatically update your configuration directory while preserving
1370 This will automatically update your configuration directory while preserving
1371 copies of your old files.
1371 copies of your old files.
1372 You can then later merge back any personal customizations you may have
1372 You can then later merge back any personal customizations you may have
1373 made into the new files.
1373 made into the new files.
1374 It is a good idea to do this as there may be new options available in the
1374 It is a good idea to do this as there may be new options available in the
1375 new configuration files which you will not have.
1375 new configuration files which you will not have.
1376 \end_layout
1376 \end_layout
1377
1377
1378 \begin_layout Standard
1378 \begin_layout Standard
1379 Under Windows, if you don't know how to call python scripts with arguments
1379 Under Windows, if you don't know how to call python scripts with arguments
1380 from a command line, simply delete the old config directory and IPython
1380 from a command line, simply delete the old config directory and IPython
1381 will make a new one.
1381 will make a new one.
1382 Win2k and WinXP users will find it in
1382 Win2k and WinXP users will find it in
1383 \family typewriter
1383 \family typewriter
1384 C:
1384 C:
1385 \backslash
1385 \backslash
1386 Documents and Settings
1386 Documents and Settings
1387 \backslash
1387 \backslash
1388 YourUserName
1388 YourUserName
1389 \backslash
1389 \backslash
1390 _ipython
1390 _ipython
1391 \family default
1391 \family default
1392 , and Win 9x users under
1392 , and Win 9x users under
1393 \family typewriter
1393 \family typewriter
1394 C:
1394 C:
1395 \backslash
1395 \backslash
1396 Program Files
1396 Program Files
1397 \backslash
1397 \backslash
1398 IPython
1398 IPython
1399 \backslash
1399 \backslash
1400 _ipython.
1400 _ipython.
1401 \end_layout
1401 \end_layout
1402
1402
1403 \begin_layout Section
1403 \begin_layout Section
1404 \begin_inset LatexCommand \label{sec:good_config}
1404 \begin_inset LatexCommand \label{sec:good_config}
1405
1405
1406 \end_inset
1406 \end_inset
1407
1407
1408
1408
1409 \begin_inset OptArg
1409 \begin_inset OptArg
1410 status collapsed
1410 status collapsed
1411
1411
1412 \begin_layout Standard
1412 \begin_layout Standard
1413 Initial configuration
1413 Initial configuration
1414 \begin_inset ERT
1414 \begin_inset ERT
1415 status collapsed
1415 status collapsed
1416
1416
1417 \begin_layout Standard
1417 \begin_layout Standard
1418
1418
1419
1419
1420 \backslash
1420 \backslash
1421 ldots
1421 ldots
1422 \end_layout
1422 \end_layout
1423
1423
1424 \end_inset
1424 \end_inset
1425
1425
1426
1426
1427 \end_layout
1427 \end_layout
1428
1428
1429 \end_inset
1429 \end_inset
1430
1430
1431 Initial configuration of your environment
1431 Initial configuration of your environment
1432 \end_layout
1432 \end_layout
1433
1433
1434 \begin_layout Standard
1434 \begin_layout Standard
1435 This section will help you set various things in your environment for your
1435 This section will help you set various things in your environment for your
1436 IPython sessions to be as efficient as possible.
1436 IPython sessions to be as efficient as possible.
1437 All of IPython's configuration information, along with several example
1437 All of IPython's configuration information, along with several example
1438 files, is stored in a directory named by default
1438 files, is stored in a directory named by default
1439 \family typewriter
1439 \family typewriter
1440 $HOME/.ipython
1440 $HOME/.ipython
1441 \family default
1441 \family default
1442 .
1442 .
1443 You can change this by defining the environment variable
1443 You can change this by defining the environment variable
1444 \family typewriter
1444 \family typewriter
1445 IPYTHONDIR
1445 IPYTHONDIR
1446 \family default
1446 \family default
1447 , or at runtime with the command line option
1447 , or at runtime with the command line option
1448 \family typewriter
1448 \family typewriter
1449 -ipythondir
1449 -ipythondir
1450 \family default
1450 \family default
1451 .
1451 .
1452 \end_layout
1452 \end_layout
1453
1453
1454 \begin_layout Standard
1454 \begin_layout Standard
1455 If all goes well, the first time you run IPython it should automatically
1455 If all goes well, the first time you run IPython it should automatically
1456 create a user copy of the config directory for you, based on its builtin
1456 create a user copy of the config directory for you, based on its builtin
1457 defaults.
1457 defaults.
1458 You can look at the files it creates to learn more about configuring the
1458 You can look at the files it creates to learn more about configuring the
1459 system.
1459 system.
1460 The main file you will modify to configure IPython's behavior is called
1460 The main file you will modify to configure IPython's behavior is called
1461
1461
1462 \family typewriter
1462 \family typewriter
1463 ipythonrc
1463 ipythonrc
1464 \family default
1464 \family default
1465 (with a
1465 (with a
1466 \family typewriter
1466 \family typewriter
1467 .ini
1467 .ini
1468 \family default
1468 \family default
1469 extension under Windows), included for reference in Sec.
1469 extension under Windows), included for reference in Sec.
1470
1470
1471 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1471 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1472
1472
1473 \end_inset
1473 \end_inset
1474
1474
1475 .
1475 .
1476 This file is very commented and has many variables you can change to suit
1476 This file is very commented and has many variables you can change to suit
1477 your taste, you can find more details in Sec.
1477 your taste, you can find more details in Sec.
1478
1478
1479 \begin_inset LatexCommand \ref{sec:customization}
1479 \begin_inset LatexCommand \ref{sec:customization}
1480
1480
1481 \end_inset
1481 \end_inset
1482
1482
1483 .
1483 .
1484 Here we discuss the basic things you will want to make sure things are
1484 Here we discuss the basic things you will want to make sure things are
1485 working properly from the beginning.
1485 working properly from the beginning.
1486 \end_layout
1486 \end_layout
1487
1487
1488 \begin_layout Subsection
1488 \begin_layout Subsection
1489 \begin_inset LatexCommand \label{sec:help-access}
1489 \begin_inset LatexCommand \label{sec:help-access}
1490
1490
1491 \end_inset
1491 \end_inset
1492
1492
1493 Access to the Python help system
1493 Access to the Python help system
1494 \end_layout
1494 \end_layout
1495
1495
1496 \begin_layout Standard
1496 \begin_layout Standard
1497 This is true for Python in general (not just for IPython): you should have
1497 This is true for Python in general (not just for IPython): you should have
1498 an environment variable called
1498 an environment variable called
1499 \family typewriter
1499 \family typewriter
1500 PYTHONDOCS
1500 PYTHONDOCS
1501 \family default
1501 \family default
1502 pointing to the directory where your HTML Python documentation lives.
1502 pointing to the directory where your HTML Python documentation lives.
1503 In my system it's
1503 In my system it's
1504 \family typewriter
1504 \family typewriter
1505 /usr/share/doc/python-docs-2.3.4/html
1505 /usr/share/doc/python-docs-2.3.4/html
1506 \family default
1506 \family default
1507 , check your local details or ask your systems administrator.
1507 , check your local details or ask your systems administrator.
1508
1508
1509 \end_layout
1509 \end_layout
1510
1510
1511 \begin_layout Standard
1511 \begin_layout Standard
1512 This is the directory which holds the HTML version of the Python manuals.
1512 This is the directory which holds the HTML version of the Python manuals.
1513 Unfortunately it seems that different Linux distributions package these
1513 Unfortunately it seems that different Linux distributions package these
1514 files differently, so you may have to look around a bit.
1514 files differently, so you may have to look around a bit.
1515 Below I show the contents of this directory on my system for reference:
1515 Below I show the contents of this directory on my system for reference:
1516 \end_layout
1516 \end_layout
1517
1517
1518 \begin_layout Standard
1518 \begin_layout Standard
1519
1519
1520 \family typewriter
1520 \family typewriter
1521 [html]> ls
1521 [html]> ls
1522 \newline
1522 \newline
1523 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat
1523 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat
1524 tut/ about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1524 tut/ about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1525 \end_layout
1525 \end_layout
1526
1526
1527 \begin_layout Standard
1527 \begin_layout Standard
1528 You should really make sure this variable is correctly set so that Python's
1528 You should really make sure this variable is correctly set so that Python's
1529 pydoc-based help system works.
1529 pydoc-based help system works.
1530 It is a powerful and convenient system with full access to the Python manuals
1530 It is a powerful and convenient system with full access to the Python manuals
1531 and all modules accessible to you.
1531 and all modules accessible to you.
1532 \end_layout
1532 \end_layout
1533
1533
1534 \begin_layout Standard
1534 \begin_layout Standard
1535 Under Windows it seems that pydoc finds the documentation automatically,
1535 Under Windows it seems that pydoc finds the documentation automatically,
1536 so no extra setup appears necessary.
1536 so no extra setup appears necessary.
1537 \end_layout
1537 \end_layout
1538
1538
1539 \begin_layout Subsection
1539 \begin_layout Subsection
1540 Editor
1540 Editor
1541 \end_layout
1541 \end_layout
1542
1542
1543 \begin_layout Standard
1543 \begin_layout Standard
1544 The
1544 The
1545 \family typewriter
1545 \family typewriter
1546 %edit
1546 %edit
1547 \family default
1547 \family default
1548 command (and its alias
1548 command (and its alias
1549 \family typewriter
1549 \family typewriter
1550 %ed
1550 %ed
1551 \family default
1551 \family default
1552 ) will invoke the editor set in your environment as
1552 ) will invoke the editor set in your environment as
1553 \family typewriter
1553 \family typewriter
1554 EDITOR
1554 EDITOR
1555 \family default
1555 \family default
1556 .
1556 .
1557 If this variable is not set, it will default to
1557 If this variable is not set, it will default to
1558 \family typewriter
1558 \family typewriter
1559 vi
1559 vi
1560 \family default
1560 \family default
1561 under Linux/Unix and to
1561 under Linux/Unix and to
1562 \family typewriter
1562 \family typewriter
1563 notepad
1563 notepad
1564 \family default
1564 \family default
1565 under Windows.
1565 under Windows.
1566 You may want to set this variable properly and to a lightweight editor
1566 You may want to set this variable properly and to a lightweight editor
1567 which doesn't take too long to start (that is, something other than a new
1567 which doesn't take too long to start (that is, something other than a new
1568 instance of
1568 instance of
1569 \family typewriter
1569 \family typewriter
1570 Emacs
1570 Emacs
1571 \family default
1571 \family default
1572 ).
1572 ).
1573 This way you can edit multi-line code quickly and with the power of a real
1573 This way you can edit multi-line code quickly and with the power of a real
1574 editor right inside IPython.
1574 editor right inside IPython.
1575
1575
1576 \end_layout
1576 \end_layout
1577
1577
1578 \begin_layout Standard
1578 \begin_layout Standard
1579 If you are a dedicated
1579 If you are a dedicated
1580 \family typewriter
1580 \family typewriter
1581 Emacs
1581 Emacs
1582 \family default
1582 \family default
1583 user, you should set up the
1583 user, you should set up the
1584 \family typewriter
1584 \family typewriter
1585 Emacs
1585 Emacs
1586 \family default
1586 \family default
1587 server so that new requests are handled by the original process.
1587 server so that new requests are handled by the original process.
1588 This means that almost no time is spent in handling the request (assuming
1588 This means that almost no time is spent in handling the request (assuming
1589 an
1589 an
1590 \family typewriter
1590 \family typewriter
1591 Emacs
1591 Emacs
1592 \family default
1592 \family default
1593 process is already running).
1593 process is already running).
1594 For this to work, you need to set your
1594 For this to work, you need to set your
1595 \family typewriter
1595 \family typewriter
1596 EDITOR
1596 EDITOR
1597 \family default
1597 \family default
1598 environment variable to
1598 environment variable to
1599 \family typewriter
1599 \family typewriter
1600 'emacsclient'
1600 'emacsclient'
1601 \family default
1601 \family default
1602 .
1602 .
1603
1603
1604 \family typewriter
1604 \family typewriter
1605
1605
1606 \family default
1606 \family default
1607 The code below, supplied by Francois Pinard, can then be used in your
1607 The code below, supplied by Francois Pinard, can then be used in your
1608 \family typewriter
1608 \family typewriter
1609 .emacs
1609 .emacs
1610 \family default
1610 \family default
1611 file to enable the server:
1611 file to enable the server:
1612 \end_layout
1612 \end_layout
1613
1613
1614 \begin_layout Standard
1614 \begin_layout Standard
1615
1615
1616 \family typewriter
1616 \family typewriter
1617 (defvar server-buffer-clients)
1617 (defvar server-buffer-clients)
1618 \newline
1618 \newline
1619 (when (and (fboundp 'server-start) (string-equal
1619 (when (and (fboundp 'server-start) (string-equal
1620 (getenv "TERM") 'xterm))
1620 (getenv "TERM") 'xterm))
1621 \newline
1621 \newline
1622
1622
1623 \begin_inset ERT
1623 \begin_inset ERT
1624 status collapsed
1624 status collapsed
1625
1625
1626 \begin_layout Standard
1626 \begin_layout Standard
1627
1627
1628
1628
1629 \backslash
1629 \backslash
1630 hspace*{0mm}
1630 hspace*{0mm}
1631 \end_layout
1631 \end_layout
1632
1632
1633 \end_inset
1633 \end_inset
1634
1634
1635 \InsetSpace ~
1635 \InsetSpace ~
1636 \InsetSpace ~
1636 \InsetSpace ~
1637 (server-start)
1637 (server-start)
1638 \newline
1638 \newline
1639
1639
1640 \begin_inset ERT
1640 \begin_inset ERT
1641 status collapsed
1641 status collapsed
1642
1642
1643 \begin_layout Standard
1643 \begin_layout Standard
1644
1644
1645
1645
1646 \backslash
1646 \backslash
1647 hspace*{0mm}
1647 hspace*{0mm}
1648 \end_layout
1648 \end_layout
1649
1649
1650 \end_inset
1650 \end_inset
1651
1651
1652 \InsetSpace ~
1652 \InsetSpace ~
1653 \InsetSpace ~
1653 \InsetSpace ~
1654 (defun fp-kill-server-with-buffer-routine ()
1654 (defun fp-kill-server-with-buffer-routine ()
1655 \newline
1655 \newline
1656
1656
1657 \begin_inset ERT
1657 \begin_inset ERT
1658 status collapsed
1658 status collapsed
1659
1659
1660 \begin_layout Standard
1660 \begin_layout Standard
1661
1661
1662
1662
1663 \backslash
1663 \backslash
1664 hspace*{0mm}
1664 hspace*{0mm}
1665 \end_layout
1665 \end_layout
1666
1666
1667 \end_inset
1667 \end_inset
1668
1668
1669 \InsetSpace ~
1669 \InsetSpace ~
1670 \InsetSpace ~
1670 \InsetSpace ~
1671 \InsetSpace ~
1671 \InsetSpace ~
1672 \InsetSpace ~
1672 \InsetSpace ~
1673 (and server-buffer-clients (server-done)))
1673 (and server-buffer-clients (server-done)))
1674 \newline
1674 \newline
1675
1675
1676 \begin_inset ERT
1676 \begin_inset ERT
1677 status collapsed
1677 status collapsed
1678
1678
1679 \begin_layout Standard
1679 \begin_layout Standard
1680
1680
1681
1681
1682 \backslash
1682 \backslash
1683 hspace*{0mm}
1683 hspace*{0mm}
1684 \end_layout
1684 \end_layout
1685
1685
1686 \end_inset
1686 \end_inset
1687
1687
1688 \InsetSpace ~
1688 \InsetSpace ~
1689 \InsetSpace ~
1689 \InsetSpace ~
1690 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1690 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1691 \end_layout
1691 \end_layout
1692
1692
1693 \begin_layout Standard
1693 \begin_layout Standard
1694 You can also set the value of this editor via the commmand-line option '-
1694 You can also set the value of this editor via the commmand-line option '-
1695 \family typewriter
1695 \family typewriter
1696 editor'
1696 editor'
1697 \family default
1697 \family default
1698 or in your
1698 or in your
1699 \family typewriter
1699 \family typewriter
1700 ipythonrc
1700 ipythonrc
1701 \family default
1701 \family default
1702 file.
1702 file.
1703 This is useful if you wish to use specifically for IPython an editor different
1703 This is useful if you wish to use specifically for IPython an editor different
1704 from your typical default (and for Windows users who tend to use fewer
1704 from your typical default (and for Windows users who tend to use fewer
1705 environment variables).
1705 environment variables).
1706 \end_layout
1706 \end_layout
1707
1707
1708 \begin_layout Subsection
1708 \begin_layout Subsection
1709 Color
1709 Color
1710 \end_layout
1710 \end_layout
1711
1711
1712 \begin_layout Standard
1712 \begin_layout Standard
1713 The default IPython configuration has most bells and whistles turned on
1713 The default IPython configuration has most bells and whistles turned on
1714 (they're pretty safe).
1714 (they're pretty safe).
1715 But there's one that
1715 But there's one that
1716 \emph on
1716 \emph on
1717 may
1717 may
1718 \emph default
1718 \emph default
1719 cause problems on some systems: the use of color on screen for displaying
1719 cause problems on some systems: the use of color on screen for displaying
1720 information.
1720 information.
1721 This is very useful, since IPython can show prompts and exception tracebacks
1721 This is very useful, since IPython can show prompts and exception tracebacks
1722 with various colors, display syntax-highlighted source code, and in general
1722 with various colors, display syntax-highlighted source code, and in general
1723 make it easier to visually parse information.
1723 make it easier to visually parse information.
1724 \end_layout
1724 \end_layout
1725
1725
1726 \begin_layout Standard
1726 \begin_layout Standard
1727 The following terminals seem to handle the color sequences fine:
1727 The following terminals seem to handle the color sequences fine:
1728 \end_layout
1728 \end_layout
1729
1729
1730 \begin_layout Itemize
1730 \begin_layout Itemize
1731 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1731 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1732 \end_layout
1732 \end_layout
1733
1733
1734 \begin_layout Itemize
1734 \begin_layout Itemize
1735 CDE terminal (tested under Solaris).
1735 CDE terminal (tested under Solaris).
1736 This one boldfaces light colors.
1736 This one boldfaces light colors.
1737 \end_layout
1737 \end_layout
1738
1738
1739 \begin_layout Itemize
1739 \begin_layout Itemize
1740 (X)Emacs buffers.
1740 (X)Emacs buffers.
1741 See sec.
1741 See sec.
1742 \begin_inset LatexCommand \ref{sec:emacs}
1742 \begin_inset LatexCommand \ref{sec:emacs}
1743
1743
1744 \end_inset
1744 \end_inset
1745
1745
1746 for more details on using IPython with (X)Emacs.
1746 for more details on using IPython with (X)Emacs.
1747 \end_layout
1747 \end_layout
1748
1748
1749 \begin_layout Itemize
1749 \begin_layout Itemize
1750 A Windows (XP/2k) command prompt
1750 A Windows (XP/2k) command prompt
1751 \emph on
1751 \emph on
1752 with Gary Bishop's support extensions
1752 with Gary Bishop's support extensions
1753 \emph default
1753 \emph default
1754 .
1754 .
1755 Gary's extensions are discussed in Sec.\InsetSpace ~
1755 Gary's extensions are discussed in Sec.\InsetSpace ~
1756
1756
1757 \begin_inset LatexCommand \ref{sub:Under-Windows}
1757 \begin_inset LatexCommand \ref{sub:Under-Windows}
1758
1758
1759 \end_inset
1759 \end_inset
1760
1760
1761 .
1761 .
1762 \end_layout
1762 \end_layout
1763
1763
1764 \begin_layout Itemize
1764 \begin_layout Itemize
1765 A Windows (XP/2k) CygWin shell.
1765 A Windows (XP/2k) CygWin shell.
1766 Although some users have reported problems; it is not clear whether there
1766 Although some users have reported problems; it is not clear whether there
1767 is an issue for everyone or only under specific configurations.
1767 is an issue for everyone or only under specific configurations.
1768 If you have full color support under cygwin, please post to the IPython
1768 If you have full color support under cygwin, please post to the IPython
1769 mailing list so this issue can be resolved for all users.
1769 mailing list so this issue can be resolved for all users.
1770 \end_layout
1770 \end_layout
1771
1771
1772 \begin_layout Standard
1772 \begin_layout Standard
1773 These have shown problems:
1773 These have shown problems:
1774 \end_layout
1774 \end_layout
1775
1775
1776 \begin_layout Itemize
1776 \begin_layout Itemize
1777 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1777 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1778 or ssh.
1778 or ssh.
1779 \end_layout
1779 \end_layout
1780
1780
1781 \begin_layout Itemize
1781 \begin_layout Itemize
1782 Windows native command prompt in WinXP/2k,
1782 Windows native command prompt in WinXP/2k,
1783 \emph on
1783 \emph on
1784 without
1784 without
1785 \emph default
1785 \emph default
1786 Gary Bishop's extensions.
1786 Gary Bishop's extensions.
1787 Once Gary's readline library is installed, the normal WinXP/2k command
1787 Once Gary's readline library is installed, the normal WinXP/2k command
1788 prompt works perfectly.
1788 prompt works perfectly.
1789 \end_layout
1789 \end_layout
1790
1790
1791 \begin_layout Standard
1791 \begin_layout Standard
1792 Currently the following color schemes are available:
1792 Currently the following color schemes are available:
1793 \end_layout
1793 \end_layout
1794
1794
1795 \begin_layout Itemize
1795 \begin_layout Itemize
1796
1796
1797 \family typewriter
1797 \family typewriter
1798 NoColor
1798 NoColor
1799 \family default
1799 \family default
1800 : uses no color escapes at all (all escapes are empty
1800 : uses no color escapes at all (all escapes are empty
1801 \begin_inset Quotes eld
1801 \begin_inset Quotes eld
1802 \end_inset
1802 \end_inset
1803
1803
1804
1804
1805 \begin_inset Quotes eld
1805 \begin_inset Quotes eld
1806 \end_inset
1806 \end_inset
1807
1807
1808 strings).
1808 strings).
1809 This 'scheme' is thus fully safe to use in any terminal.
1809 This 'scheme' is thus fully safe to use in any terminal.
1810 \end_layout
1810 \end_layout
1811
1811
1812 \begin_layout Itemize
1812 \begin_layout Itemize
1813
1813
1814 \family typewriter
1814 \family typewriter
1815 Linux
1815 Linux
1816 \family default
1816 \family default
1817 : works well in Linux console type environments: dark background with light
1817 : works well in Linux console type environments: dark background with light
1818 fonts.
1818 fonts.
1819 It uses bright colors for information, so it is difficult to read if you
1819 It uses bright colors for information, so it is difficult to read if you
1820 have a light colored background.
1820 have a light colored background.
1821 \end_layout
1821 \end_layout
1822
1822
1823 \begin_layout Itemize
1823 \begin_layout Itemize
1824
1824
1825 \family typewriter
1825 \family typewriter
1826 LightBG
1826 LightBG
1827 \family default
1827 \family default
1828 : the basic colors are similar to those in the
1828 : the basic colors are similar to those in the
1829 \family typewriter
1829 \family typewriter
1830 Linux
1830 Linux
1831 \family default
1831 \family default
1832 scheme but darker.
1832 scheme but darker.
1833 It is easy to read in terminals with light backgrounds.
1833 It is easy to read in terminals with light backgrounds.
1834 \end_layout
1834 \end_layout
1835
1835
1836 \begin_layout Standard
1836 \begin_layout Standard
1837 IPython uses colors for two main groups of things: prompts and tracebacks
1837 IPython uses colors for two main groups of things: prompts and tracebacks
1838 which are directly printed to the terminal, and the object introspection
1838 which are directly printed to the terminal, and the object introspection
1839 system which passes large sets of data through a pager.
1839 system which passes large sets of data through a pager.
1840 \end_layout
1840 \end_layout
1841
1841
1842 \begin_layout Subsubsection
1842 \begin_layout Subsubsection
1843 Input/Output prompts and exception tracebacks
1843 Input/Output prompts and exception tracebacks
1844 \end_layout
1844 \end_layout
1845
1845
1846 \begin_layout Standard
1846 \begin_layout Standard
1847 You can test whether the colored prompts and tracebacks work on your system
1847 You can test whether the colored prompts and tracebacks work on your system
1848 interactively by typing
1848 interactively by typing
1849 \family typewriter
1849 \family typewriter
1850 '%colors Linux'
1850 '%colors Linux'
1851 \family default
1851 \family default
1852 at the prompt (use '
1852 at the prompt (use '
1853 \family typewriter
1853 \family typewriter
1854 %colors LightBG'
1854 %colors LightBG'
1855 \family default
1855 \family default
1856 if your terminal has a light background).
1856 if your terminal has a light background).
1857 If the input prompt shows garbage like:
1857 If the input prompt shows garbage like:
1858 \newline
1858 \newline
1859
1859
1860 \family typewriter
1860 \family typewriter
1861 [0;32mIn [[1;32m1[0;32m]: [0;00m
1861 [0;32mIn [[1;32m1[0;32m]: [0;00m
1862 \family default
1862 \family default
1863
1863
1864 \newline
1864 \newline
1865 instead of (in color) something like:
1865 instead of (in color) something like:
1866 \newline
1866 \newline
1867
1867
1868 \family typewriter
1868 \family typewriter
1869 In [1]:
1869 In [1]:
1870 \family default
1870 \family default
1871
1871
1872 \newline
1872 \newline
1873 this means that your terminal doesn't properly handle color escape sequences.
1873 this means that your terminal doesn't properly handle color escape sequences.
1874 You can go to a 'no color' mode by typing '
1874 You can go to a 'no color' mode by typing '
1875 \family typewriter
1875 \family typewriter
1876 %colors NoColor
1876 %colors NoColor
1877 \family default
1877 \family default
1878 '.
1878 '.
1879
1879
1880 \end_layout
1880 \end_layout
1881
1881
1882 \begin_layout Standard
1882 \begin_layout Standard
1883 You can try using a different terminal emulator program (Emacs users, see
1883 You can try using a different terminal emulator program (Emacs users, see
1884 below).
1884 below).
1885 To permanently set your color preferences, edit the file
1885 To permanently set your color preferences, edit the file
1886 \family typewriter
1886 \family typewriter
1887 $HOME/.ipython/ipythonrc
1887 $HOME/.ipython/ipythonrc
1888 \family default
1888 \family default
1889 and set the
1889 and set the
1890 \family typewriter
1890 \family typewriter
1891 colors
1891 colors
1892 \family default
1892 \family default
1893 option to the desired value.
1893 option to the desired value.
1894 \end_layout
1894 \end_layout
1895
1895
1896 \begin_layout Subsubsection
1896 \begin_layout Subsubsection
1897 Object details (types, docstrings, source code, etc.)
1897 Object details (types, docstrings, source code, etc.)
1898 \end_layout
1898 \end_layout
1899
1899
1900 \begin_layout Standard
1900 \begin_layout Standard
1901 IPython has a set of special functions for studying the objects you are
1901 IPython has a set of special functions for studying the objects you are
1902 working with, discussed in detail in Sec.
1902 working with, discussed in detail in Sec.
1903
1903
1904 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1904 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1905
1905
1906 \end_inset
1906 \end_inset
1907
1907
1908 .
1908 .
1909 But this system relies on passing information which is longer than your
1909 But this system relies on passing information which is longer than your
1910 screen through a data pager, such as the common Unix
1910 screen through a data pager, such as the common Unix
1911 \family typewriter
1911 \family typewriter
1912 less
1912 less
1913 \family default
1913 \family default
1914 and
1914 and
1915 \family typewriter
1915 \family typewriter
1916 more
1916 more
1917 \family default
1917 \family default
1918 programs.
1918 programs.
1919 In order to be able to see this information in color, your pager needs
1919 In order to be able to see this information in color, your pager needs
1920 to be properly configured.
1920 to be properly configured.
1921 I strongly recommend using
1921 I strongly recommend using
1922 \family typewriter
1922 \family typewriter
1923 less
1923 less
1924 \family default
1924 \family default
1925 instead of
1925 instead of
1926 \family typewriter
1926 \family typewriter
1927 more
1927 more
1928 \family default
1928 \family default
1929 , as it seems that
1929 , as it seems that
1930 \family typewriter
1930 \family typewriter
1931 more
1931 more
1932 \family default
1932 \family default
1933 simply can not understand colored text correctly.
1933 simply can not understand colored text correctly.
1934 \end_layout
1934 \end_layout
1935
1935
1936 \begin_layout Standard
1936 \begin_layout Standard
1937 In order to configure
1937 In order to configure
1938 \family typewriter
1938 \family typewriter
1939 less
1939 less
1940 \family default
1940 \family default
1941 as your default pager, do the following:
1941 as your default pager, do the following:
1942 \end_layout
1942 \end_layout
1943
1943
1944 \begin_layout Enumerate
1944 \begin_layout Enumerate
1945 Set the environment
1945 Set the environment
1946 \family typewriter
1946 \family typewriter
1947 PAGER
1947 PAGER
1948 \family default
1948 \family default
1949 variable to
1949 variable to
1950 \family typewriter
1950 \family typewriter
1951 less
1951 less
1952 \family default
1952 \family default
1953 .
1953 .
1954 \end_layout
1954 \end_layout
1955
1955
1956 \begin_layout Enumerate
1956 \begin_layout Enumerate
1957 Set the environment
1957 Set the environment
1958 \family typewriter
1958 \family typewriter
1959 LESS
1959 LESS
1960 \family default
1960 \family default
1961 variable to
1961 variable to
1962 \family typewriter
1962 \family typewriter
1963 -r
1963 -r
1964 \family default
1964 \family default
1965 (plus any other options you always want to pass to
1965 (plus any other options you always want to pass to
1966 \family typewriter
1966 \family typewriter
1967 less
1967 less
1968 \family default
1968 \family default
1969 by default).
1969 by default).
1970 This tells
1970 This tells
1971 \family typewriter
1971 \family typewriter
1972 less
1972 less
1973 \family default
1973 \family default
1974 to properly interpret control sequences, which is how color information
1974 to properly interpret control sequences, which is how color information
1975 is given to your terminal.
1975 is given to your terminal.
1976 \end_layout
1976 \end_layout
1977
1977
1978 \begin_layout Standard
1978 \begin_layout Standard
1979 For the
1979 For the
1980 \family typewriter
1980 \family typewriter
1981 csh
1981 csh
1982 \family default
1982 \family default
1983 or
1983 or
1984 \family typewriter
1984 \family typewriter
1985 tcsh
1985 tcsh
1986 \family default
1986 \family default
1987 shells, add to your
1987 shells, add to your
1988 \family typewriter
1988 \family typewriter
1989 ~/.cshrc
1989 ~/.cshrc
1990 \family default
1990 \family default
1991 file the lines:
1991 file the lines:
1992 \end_layout
1992 \end_layout
1993
1993
1994 \begin_layout Standard
1994 \begin_layout Standard
1995
1995
1996 \family typewriter
1996 \family typewriter
1997 setenv PAGER less
1997 setenv PAGER less
1998 \newline
1998 \newline
1999 setenv LESS -r
1999 setenv LESS -r
2000 \end_layout
2000 \end_layout
2001
2001
2002 \begin_layout Standard
2002 \begin_layout Standard
2003 There is similar syntax for other Unix shells, look at your system documentation
2003 There is similar syntax for other Unix shells, look at your system documentation
2004 for details.
2004 for details.
2005 \end_layout
2005 \end_layout
2006
2006
2007 \begin_layout Standard
2007 \begin_layout Standard
2008 If you are on a system which lacks proper data pagers (such as Windows),
2008 If you are on a system which lacks proper data pagers (such as Windows),
2009 IPython will use a very limited builtin pager.
2009 IPython will use a very limited builtin pager.
2010 \end_layout
2010 \end_layout
2011
2011
2012 \begin_layout Subsection
2012 \begin_layout Subsection
2013 \begin_inset LatexCommand \label{sec:emacs}
2013 \begin_inset LatexCommand \label{sec:emacs}
2014
2014
2015 \end_inset
2015 \end_inset
2016
2016
2017 (X)Emacs configuration
2017 (X)Emacs configuration
2018 \end_layout
2018 \end_layout
2019
2019
2020 \begin_layout Standard
2020 \begin_layout Standard
2021 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
2021 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
2022 (X)Emacs and IPython get along very well.
2022 (X)Emacs and IPython get along very well.
2023
2023
2024 \end_layout
2024 \end_layout
2025
2025
2026 \begin_layout Standard
2026 \begin_layout Standard
2027
2027
2028 \series bold
2028 \series bold
2029 Important note:
2029 Important note:
2030 \series default
2030 \series default
2031 You will need to use a recent enough version of
2031 You will need to use a recent enough version of
2032 \family typewriter
2032 \family typewriter
2033 python-mode.el
2033 python-mode.el
2034 \family default
2034 \family default
2035 , along with the file
2035 , along with the file
2036 \family typewriter
2036 \family typewriter
2037 ipython.el
2037 ipython.el
2038 \family default
2038 \family default
2039 .
2039 .
2040 You can check that the version you have of
2040 You can check that the version you have of
2041 \family typewriter
2041 \family typewriter
2042 python-mode.el
2042 python-mode.el
2043 \family default
2043 \family default
2044 is new enough by either looking at the revision number in the file itself,
2044 is new enough by either looking at the revision number in the file itself,
2045 or asking for it in (X)Emacs via
2045 or asking for it in (X)Emacs via
2046 \family typewriter
2046 \family typewriter
2047 M-x py-version
2047 M-x py-version
2048 \family default
2048 \family default
2049 .
2049 .
2050 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
2050 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
2051 \end_layout
2051 \end_layout
2052
2052
2053 \begin_layout Standard
2053 \begin_layout Standard
2054 The file
2054 The file
2055 \family typewriter
2055 \family typewriter
2056 ipython.el
2056 ipython.el
2057 \family default
2057 \family default
2058 is included with the IPython distribution, in the documentation directory
2058 is included with the IPython distribution, in the documentation directory
2059 (where this manual resides in PDF and HTML formats).
2059 (where this manual resides in PDF and HTML formats).
2060 \end_layout
2060 \end_layout
2061
2061
2062 \begin_layout Standard
2062 \begin_layout Standard
2063 Once you put these files in your Emacs path, all you need in your
2063 Once you put these files in your Emacs path, all you need in your
2064 \family typewriter
2064 \family typewriter
2065 .emacs
2065 .emacs
2066 \family default
2066 \family default
2067 file is:
2067 file is:
2068 \end_layout
2068 \end_layout
2069
2069
2070 \begin_layout LyX-Code
2070 \begin_layout LyX-Code
2071 (require 'ipython)
2071 (require 'ipython)
2072 \end_layout
2072 \end_layout
2073
2073
2074 \begin_layout Standard
2074 \begin_layout Standard
2075 This should give you full support for executing code snippets via IPython,
2075 This should give you full support for executing code snippets via IPython,
2076 opening IPython as your Python shell via
2076 opening IPython as your Python shell via
2077 \family typewriter
2077 \family typewriter
2078 C-c\InsetSpace ~
2078 C-c\InsetSpace ~
2079 !
2079 !
2080 \family default
2080 \family default
2081 , etc.
2081 , etc.
2082
2082
2083 \end_layout
2083 \end_layout
2084
2084
2085 \begin_layout Standard
2085 \begin_layout Standard
2086 If you happen to get garbage instead of colored prompts as described in
2086 If you happen to get garbage instead of colored prompts as described in
2087 the previous section, you may need to set also in your
2087 the previous section, you may need to set also in your
2088 \family typewriter
2088 \family typewriter
2089 .emacs
2089 .emacs
2090 \family default
2090 \family default
2091 file:
2091 file:
2092 \end_layout
2092 \end_layout
2093
2093
2094 \begin_layout LyX-Code
2094 \begin_layout LyX-Code
2095 (setq ansi-color-for-comint-mode t)
2095 (setq ansi-color-for-comint-mode t)
2096 \end_layout
2096 \end_layout
2097
2097
2098 \begin_layout Subsubsection*
2098 \begin_layout Subsubsection*
2099 Notes
2099 Notes
2100 \end_layout
2100 \end_layout
2101
2101
2102 \begin_layout Itemize
2102 \begin_layout Itemize
2103 There is one caveat you should be aware of: you must start the IPython shell
2103 There is one caveat you should be aware of: you must start the IPython shell
2104
2104
2105 \emph on
2105 \emph on
2106 before
2106 before
2107 \emph default
2107 \emph default
2108 attempting to execute any code regions via
2108 attempting to execute any code regions via
2109 \family typewriter
2109 \family typewriter
2110 C-c\InsetSpace ~
2110 C-c\InsetSpace ~
2111 |
2111 |
2112 \family default
2112 \family default
2113 .
2113 .
2114 Simply type
2114 Simply type
2115 \family typewriter
2115 \family typewriter
2116 C-c\InsetSpace ~
2116 C-c\InsetSpace ~
2117 !
2117 !
2118 \family default
2118 \family default
2119 to start IPython before passing any code regions to the interpreter, and
2119 to start IPython before passing any code regions to the interpreter, and
2120 you shouldn't experience any problems.
2120 you shouldn't experience any problems.
2121 \newline
2121 \newline
2122 This is due to a bug in Python itself,
2122 This is due to a bug in Python itself,
2123 which has been fixed for Python 2.3, but exists as of Python 2.2.2 (reported
2123 which has been fixed for Python 2.3, but exists as of Python 2.2.2 (reported
2124 as SF bug [ 737947 ]).
2124 as SF bug [ 737947 ]).
2125 \end_layout
2125 \end_layout
2126
2126
2127 \begin_layout Itemize
2127 \begin_layout Itemize
2128 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
2128 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
2129 ts should be directed to him through the IPython mailing lists.
2129 ts should be directed to him through the IPython mailing lists.
2130
2130
2131 \end_layout
2131 \end_layout
2132
2132
2133 \begin_layout Itemize
2133 \begin_layout Itemize
2134 This code is still somewhat experimental so it's a bit rough around the
2134 This code is still somewhat experimental so it's a bit rough around the
2135 edges (although in practice, it works quite well).
2135 edges (although in practice, it works quite well).
2136 \end_layout
2136 \end_layout
2137
2137
2138 \begin_layout Itemize
2138 \begin_layout Itemize
2139 Be aware that if you customize
2139 Be aware that if you customize
2140 \family typewriter
2140 \family typewriter
2141 py-python-command
2141 py-python-command
2142 \family default
2142 \family default
2143 previously, this value will override what
2143 previously, this value will override what
2144 \family typewriter
2144 \family typewriter
2145 ipython.el
2145 ipython.el
2146 \family default
2146 \family default
2147 does (because loading the customization variables comes later).
2147 does (because loading the customization variables comes later).
2148 \end_layout
2148 \end_layout
2149
2149
2150 \begin_layout Section
2150 \begin_layout Section
2151 \begin_inset LatexCommand \label{sec:quick_tips}
2151 \begin_inset LatexCommand \label{sec:quick_tips}
2152
2152
2153 \end_inset
2153 \end_inset
2154
2154
2155 Quick tips
2155 Quick tips
2156 \end_layout
2156 \end_layout
2157
2157
2158 \begin_layout Standard
2158 \begin_layout Standard
2159 IPython can be used as an improved replacement for the Python prompt, and
2159 IPython can be used as an improved replacement for the Python prompt, and
2160 for that you don't really need to read any more of this manual.
2160 for that you don't really need to read any more of this manual.
2161 But in this section we'll try to summarize a few tips on how to make the
2161 But in this section we'll try to summarize a few tips on how to make the
2162 most effective use of it for everyday Python development, highlighting
2162 most effective use of it for everyday Python development, highlighting
2163 things you might miss in the rest of the manual (which is getting long).
2163 things you might miss in the rest of the manual (which is getting long).
2164 We'll give references to parts in the manual which provide more detail
2164 We'll give references to parts in the manual which provide more detail
2165 when appropriate.
2165 when appropriate.
2166 \end_layout
2166 \end_layout
2167
2167
2168 \begin_layout Standard
2168 \begin_layout Standard
2169 The following article by Jeremy Jones provides an introductory tutorial
2169 The following article by Jeremy Jones provides an introductory tutorial
2170 about IPython:
2170 about IPython:
2171 \newline
2171 \newline
2172
2172
2173 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
2173 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
2174
2174
2175 \end_inset
2175 \end_inset
2176
2176
2177
2177
2178 \end_layout
2178 \end_layout
2179
2179
2180 \begin_layout Itemize
2180 \begin_layout Itemize
2181 The TAB key.
2181 The TAB key.
2182 TAB-completion, especially for attributes, is a convenient way to explore
2182 TAB-completion, especially for attributes, is a convenient way to explore
2183 the structure of any object you're dealing with.
2183 the structure of any object you're dealing with.
2184 Simply type
2184 Simply type
2185 \family typewriter
2185 \family typewriter
2186 object_name.<TAB>
2186 object_name.<TAB>
2187 \family default
2187 \family default
2188 and a list of the object's attributes will be printed (see sec.
2188 and a list of the object's attributes will be printed (see sec.
2189
2189
2190 \begin_inset LatexCommand \ref{sec:readline}
2190 \begin_inset LatexCommand \ref{sec:readline}
2191
2191
2192 \end_inset
2192 \end_inset
2193
2193
2194 for more).
2194 for more).
2195 Tab completion also works on file and directory names, which combined with
2195 Tab completion also works on file and directory names, which combined with
2196 IPython's alias system allows you to do from within IPython many of the
2196 IPython's alias system allows you to do from within IPython many of the
2197 things you normally would need the system shell for.
2197 things you normally would need the system shell for.
2198
2198
2199 \end_layout
2199 \end_layout
2200
2200
2201 \begin_layout Itemize
2201 \begin_layout Itemize
2202 Explore your objects.
2202 Explore your objects.
2203 Typing
2203 Typing
2204 \family typewriter
2204 \family typewriter
2205 object_name?
2205 object_name?
2206 \family default
2206 \family default
2207 will print all sorts of details about any object, including docstrings,
2207 will print all sorts of details about any object, including docstrings,
2208 function definition lines (for call arguments) and constructor details
2208 function definition lines (for call arguments) and constructor details
2209 for classes.
2209 for classes.
2210 The magic commands
2210 The magic commands
2211 \family typewriter
2211 \family typewriter
2212 %pdoc
2212 %pdoc
2213 \family default
2213 \family default
2214 ,
2214 ,
2215 \family typewriter
2215 \family typewriter
2216 %pdef
2216 %pdef
2217 \family default
2217 \family default
2218 ,
2218 ,
2219 \family typewriter
2219 \family typewriter
2220 %psource
2220 %psource
2221 \family default
2221 \family default
2222 and
2222 and
2223 \family typewriter
2223 \family typewriter
2224 %pfile
2224 %pfile
2225 \family default
2225 \family default
2226 will respectively print the docstring, function definition line, full source
2226 will respectively print the docstring, function definition line, full source
2227 code and the complete file for any object (when they can be found).
2227 code and the complete file for any object (when they can be found).
2228 If automagic is on (it is by default), you don't need to type the '
2228 If automagic is on (it is by default), you don't need to type the '
2229 \family typewriter
2229 \family typewriter
2230 %
2230 %
2231 \family default
2231 \family default
2232 ' explicitly.
2232 ' explicitly.
2233 See sec.
2233 See sec.
2234
2234
2235 \begin_inset LatexCommand \ref{sec:dyn-object-info}
2235 \begin_inset LatexCommand \ref{sec:dyn-object-info}
2236
2236
2237 \end_inset
2237 \end_inset
2238
2238
2239 for more.
2239 for more.
2240 \end_layout
2240 \end_layout
2241
2241
2242 \begin_layout Itemize
2242 \begin_layout Itemize
2243 The
2243 The
2244 \family typewriter
2244 \family typewriter
2245 %run
2245 %run
2246 \family default
2246 \family default
2247 magic command allows you to run any python script and load all of its data
2247 magic command allows you to run any python script and load all of its data
2248 directly into the interactive namespace.
2248 directly into the interactive namespace.
2249 Since the file is re-read from disk each time, changes you make to it are
2249 Since the file is re-read from disk each time, changes you make to it are
2250 reflected immediately (in contrast to the behavior of
2250 reflected immediately (in contrast to the behavior of
2251 \family typewriter
2251 \family typewriter
2252 import
2252 import
2253 \family default
2253 \family default
2254 ).
2254 ).
2255 I rarely use
2255 I rarely use
2256 \family typewriter
2256 \family typewriter
2257 import
2257 import
2258 \family default
2258 \family default
2259 for code I am testing, relying on
2259 for code I am testing, relying on
2260 \family typewriter
2260 \family typewriter
2261 %run
2261 %run
2262 \family default
2262 \family default
2263 instead.
2263 instead.
2264 See sec.
2264 See sec.
2265
2265
2266 \begin_inset LatexCommand \ref{sec:magic}
2266 \begin_inset LatexCommand \ref{sec:magic}
2267
2267
2268 \end_inset
2268 \end_inset
2269
2269
2270 for more on this and other magic commands, or type the name of any magic
2270 for more on this and other magic commands, or type the name of any magic
2271 command and ? to get details on it.
2271 command and ? to get details on it.
2272 See also sec.
2272 See also sec.
2273
2273
2274 \begin_inset LatexCommand \ref{sec:dreload}
2274 \begin_inset LatexCommand \ref{sec:dreload}
2275
2275
2276 \end_inset
2276 \end_inset
2277
2277
2278 for a recursive reload command.
2278 for a recursive reload command.
2279 \newline
2279 \newline
2280
2280
2281 \family typewriter
2281 \family typewriter
2282 %run
2282 %run
2283 \family default
2283 \family default
2284 also has special flags for timing the execution of your scripts (
2284 also has special flags for timing the execution of your scripts (
2285 \family typewriter
2285 \family typewriter
2286 -t
2286 -t
2287 \family default
2287 \family default
2288 ) and for executing them under the control of either Python's
2288 ) and for executing them under the control of either Python's
2289 \family typewriter
2289 \family typewriter
2290 pdb
2290 pdb
2291 \family default
2291 \family default
2292 debugger (
2292 debugger (
2293 \family typewriter
2293 \family typewriter
2294 -d
2294 -d
2295 \family default
2295 \family default
2296 ) or profiler (
2296 ) or profiler (
2297 \family typewriter
2297 \family typewriter
2298 -p
2298 -p
2299 \family default
2299 \family default
2300 ).
2300 ).
2301 With all of these,
2301 With all of these,
2302 \family typewriter
2302 \family typewriter
2303 %run
2303 %run
2304 \family default
2304 \family default
2305 can be used as the main tool for efficient interactive development of code
2305 can be used as the main tool for efficient interactive development of code
2306 which you write in your editor of choice.
2306 which you write in your editor of choice.
2307 \end_layout
2307 \end_layout
2308
2308
2309 \begin_layout Itemize
2309 \begin_layout Itemize
2310 Use the Python debugger,
2310 Use the Python debugger,
2311 \family typewriter
2311 \family typewriter
2312 pdb
2312 pdb
2313 \family default
2313 \family default
2314
2314
2315 \begin_inset Foot
2315 \begin_inset Foot
2316 status collapsed
2316 status collapsed
2317
2317
2318 \begin_layout Standard
2318 \begin_layout Standard
2319 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2319 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2320 to IPython's improved debugger and profiler support.
2320 to IPython's improved debugger and profiler support.
2321 \end_layout
2321 \end_layout
2322
2322
2323 \end_inset
2323 \end_inset
2324
2324
2325 .
2325 .
2326 The
2326 The
2327 \family typewriter
2327 \family typewriter
2328 %pdb
2328 %pdb
2329 \family default
2329 \family default
2330 command allows you to toggle on and off the automatic invocation of an
2330 command allows you to toggle on and off the automatic invocation of an
2331 IPython-enhanced
2331 IPython-enhanced
2332 \family typewriter
2332 \family typewriter
2333 pdb
2333 pdb
2334 \family default
2334 \family default
2335 debugger (with coloring, tab completion and more) at any uncaught exception.
2335 debugger (with coloring, tab completion and more) at any uncaught exception.
2336 The advantage of this is that
2336 The advantage of this is that
2337 \family typewriter
2337 \family typewriter
2338 pdb
2338 pdb
2339 \family default
2339 \family default
2340 starts
2340 starts
2341 \emph on
2341 \emph on
2342 inside
2342 inside
2343 \emph default
2343 \emph default
2344 the function where the exception occurred, with all data still available.
2344 the function where the exception occurred, with all data still available.
2345 You can print variables, see code, execute statements and even walk up
2345 You can print variables, see code, execute statements and even walk up
2346 and down the call stack to track down the true source of the problem (which
2346 and down the call stack to track down the true source of the problem (which
2347 often is many layers in the stack above where the exception gets triggered).
2347 often is many layers in the stack above where the exception gets triggered).
2348 \newline
2348 \newline
2349 Runn
2349 Runn
2350 ing programs with
2350 ing programs with
2351 \family typewriter
2351 \family typewriter
2352 %run
2352 %run
2353 \family default
2353 \family default
2354 and pdb active can be an efficient to develop and debug code, in many cases
2354 and pdb active can be an efficient to develop and debug code, in many cases
2355 eliminating the need for
2355 eliminating the need for
2356 \family typewriter
2356 \family typewriter
2357 print
2357 print
2358 \family default
2358 \family default
2359 statements or external debugging tools.
2359 statements or external debugging tools.
2360 I often simply put a
2360 I often simply put a
2361 \family typewriter
2361 \family typewriter
2362 1/0
2362 1/0
2363 \family default
2363 \family default
2364 in a place where I want to take a look so that pdb gets called, quickly
2364 in a place where I want to take a look so that pdb gets called, quickly
2365 view whatever variables I need to or test various pieces of code and then
2365 view whatever variables I need to or test various pieces of code and then
2366 remove the
2366 remove the
2367 \family typewriter
2367 \family typewriter
2368 1/0
2368 1/0
2369 \family default
2369 \family default
2370 .
2370 .
2371 \newline
2371 \newline
2372 Note also that `
2372 Note also that `
2373 \family typewriter
2373 \family typewriter
2374 %run -d
2374 %run -d
2375 \family default
2375 \family default
2376 ' activates
2376 ' activates
2377 \family typewriter
2377 \family typewriter
2378 pdb
2378 pdb
2379 \family default
2379 \family default
2380 and automatically sets initial breakpoints for you to step through your
2380 and automatically sets initial breakpoints for you to step through your
2381 code, watch variables, etc.
2381 code, watch variables, etc.
2382 See Sec.\InsetSpace ~
2382 See Sec.\InsetSpace ~
2383
2383
2384 \begin_inset LatexCommand \ref{sec:cache_output}
2384 \begin_inset LatexCommand \ref{sec:cache_output}
2385
2385
2386 \end_inset
2386 \end_inset
2387
2387
2388 for details.
2388 for details.
2389 \end_layout
2389 \end_layout
2390
2390
2391 \begin_layout Itemize
2391 \begin_layout Itemize
2392 Use the output cache.
2392 Use the output cache.
2393 All output results are automatically stored in a global dictionary named
2393 All output results are automatically stored in a global dictionary named
2394
2394
2395 \family typewriter
2395 \family typewriter
2396 Out
2396 Out
2397 \family default
2397 \family default
2398 and variables named
2398 and variables named
2399 \family typewriter
2399 \family typewriter
2400 _1
2400 _1
2401 \family default
2401 \family default
2402 ,
2402 ,
2403 \family typewriter
2403 \family typewriter
2404 _2
2404 _2
2405 \family default
2405 \family default
2406 , etc.
2406 , etc.
2407 alias them.
2407 alias them.
2408 For example, the result of input line 4 is available either as
2408 For example, the result of input line 4 is available either as
2409 \family typewriter
2409 \family typewriter
2410 Out[4]
2410 Out[4]
2411 \family default
2411 \family default
2412 or as
2412 or as
2413 \family typewriter
2413 \family typewriter
2414 _4
2414 _4
2415 \family default
2415 \family default
2416 .
2416 .
2417 Additionally, three variables named
2417 Additionally, three variables named
2418 \family typewriter
2418 \family typewriter
2419 _
2419 _
2420 \family default
2420 \family default
2421 ,
2421 ,
2422 \family typewriter
2422 \family typewriter
2423 __
2423 __
2424 \family default
2424 \family default
2425 and
2425 and
2426 \family typewriter
2426 \family typewriter
2427 ___
2427 ___
2428 \family default
2428 \family default
2429 are always kept updated with the for the last three results.
2429 are always kept updated with the for the last three results.
2430 This allows you to recall any previous result and further use it for new
2430 This allows you to recall any previous result and further use it for new
2431 calculations.
2431 calculations.
2432 See Sec.\InsetSpace ~
2432 See Sec.\InsetSpace ~
2433
2433
2434 \begin_inset LatexCommand \ref{sec:cache_output}
2434 \begin_inset LatexCommand \ref{sec:cache_output}
2435
2435
2436 \end_inset
2436 \end_inset
2437
2437
2438 for more.
2438 for more.
2439 \end_layout
2439 \end_layout
2440
2440
2441 \begin_layout Itemize
2441 \begin_layout Itemize
2442 Put a '
2442 Put a '
2443 \family typewriter
2443 \family typewriter
2444 ;
2444 ;
2445 \family default
2445 \family default
2446 ' at the end of a line to supress the printing of output.
2446 ' at the end of a line to supress the printing of output.
2447 This is useful when doing calculations which generate long output you are
2447 This is useful when doing calculations which generate long output you are
2448 not interested in seeing.
2448 not interested in seeing.
2449 The
2449 The
2450 \family typewriter
2450 \family typewriter
2451 _*
2451 _*
2452 \family default
2452 \family default
2453 variables and the
2453 variables and the
2454 \family typewriter
2454 \family typewriter
2455 Out[]
2455 Out[]
2456 \family default
2456 \family default
2457 list do get updated with the contents of the output, even if it is not
2457 list do get updated with the contents of the output, even if it is not
2458 printed.
2458 printed.
2459 You can thus still access the generated results this way for further processing.
2459 You can thus still access the generated results this way for further processing.
2460 \end_layout
2460 \end_layout
2461
2461
2462 \begin_layout Itemize
2462 \begin_layout Itemize
2463 A similar system exists for caching input.
2463 A similar system exists for caching input.
2464 All input is stored in a global list called
2464 All input is stored in a global list called
2465 \family typewriter
2465 \family typewriter
2466 In
2466 In
2467 \family default
2467 \family default
2468 , so you can re-execute lines 22 through 28 plus line 34 by typing
2468 , so you can re-execute lines 22 through 28 plus line 34 by typing
2469 \family typewriter
2469 \family typewriter
2470 'exec In[22:29]+In[34]'
2470 'exec In[22:29]+In[34]'
2471 \family default
2471 \family default
2472 (using Python slicing notation).
2472 (using Python slicing notation).
2473 If you need to execute the same set of lines often, you can assign them
2473 If you need to execute the same set of lines often, you can assign them
2474 to a macro with the
2474 to a macro with the
2475 \family typewriter
2475 \family typewriter
2476 %macro
2476 %macro
2477 \family default
2477 \family default
2478
2478
2479 \family typewriter
2479 \family typewriter
2480 function.
2480 function.
2481
2481
2482 \family default
2482 \family default
2483 See sec.
2483 See sec.
2484
2484
2485 \begin_inset LatexCommand \ref{sec:cache_input}
2485 \begin_inset LatexCommand \ref{sec:cache_input}
2486
2486
2487 \end_inset
2487 \end_inset
2488
2488
2489 for more.
2489 for more.
2490 \end_layout
2490 \end_layout
2491
2491
2492 \begin_layout Itemize
2492 \begin_layout Itemize
2493 Use your input history.
2493 Use your input history.
2494 The
2494 The
2495 \family typewriter
2495 \family typewriter
2496 %hist
2496 %hist
2497 \family default
2497 \family default
2498 command can show you all previous input, without line numbers if desired
2498 command can show you all previous input, without line numbers if desired
2499 (option
2499 (option
2500 \family typewriter
2500 \family typewriter
2501 -n
2501 -n
2502 \family default
2502 \family default
2503 ) so you can directly copy and paste code either back in IPython or in a
2503 ) so you can directly copy and paste code either back in IPython or in a
2504 text editor.
2504 text editor.
2505 You can also save all your history by turning on logging via
2505 You can also save all your history by turning on logging via
2506 \family typewriter
2506 \family typewriter
2507 %logstart
2507 %logstart
2508 \family default
2508 \family default
2509 ; these logs can later be either reloaded as IPython sessions or used as
2509 ; these logs can later be either reloaded as IPython sessions or used as
2510 code for your programs.
2510 code for your programs.
2511 \end_layout
2511 \end_layout
2512
2512
2513 \begin_layout Itemize
2513 \begin_layout Itemize
2514 Define your own system aliases.
2514 Define your own system aliases.
2515 Even though IPython gives you access to your system shell via the
2515 Even though IPython gives you access to your system shell via the
2516 \family typewriter
2516 \family typewriter
2517 !
2517 !
2518 \family default
2518 \family default
2519 prefix, it is convenient to have aliases to the system commands you use
2519 prefix, it is convenient to have aliases to the system commands you use
2520 most often.
2520 most often.
2521 This allows you to work seamlessly from inside IPython with the same commands
2521 This allows you to work seamlessly from inside IPython with the same commands
2522 you are used to in your system shell.
2522 you are used to in your system shell.
2523 \newline
2523 \newline
2524 IPython comes with some pre-defined
2524 IPython comes with some pre-defined
2525 aliases and a complete system for changing directories, both via a stack
2525 aliases and a complete system for changing directories, both via a stack
2526 (see
2526 (see
2527 \family typewriter
2527 \family typewriter
2528 %pushd
2528 %pushd
2529 \family default
2529 \family default
2530 ,
2530 ,
2531 \family typewriter
2531 \family typewriter
2532 %popd
2532 %popd
2533 \family default
2533 \family default
2534 and
2534 and
2535 \family typewriter
2535 \family typewriter
2536 %dhist
2536 %dhist
2537 \family default
2537 \family default
2538 ) and via direct
2538 ) and via direct
2539 \family typewriter
2539 \family typewriter
2540 %cd
2540 %cd
2541 \family default
2541 \family default
2542 .
2542 .
2543 The latter keeps a history of visited directories and allows you to go
2543 The latter keeps a history of visited directories and allows you to go
2544 to any previously visited one.
2544 to any previously visited one.
2545 \end_layout
2545 \end_layout
2546
2546
2547 \begin_layout Itemize
2547 \begin_layout Itemize
2548 Use Python to manipulate the results of system commands.
2548 Use Python to manipulate the results of system commands.
2549 The `
2549 The `
2550 \family typewriter
2550 \family typewriter
2551 !!
2551 !!
2552 \family default
2552 \family default
2553 ' special syntax, and the
2553 ' special syntax, and the
2554 \family typewriter
2554 \family typewriter
2555 %sc
2555 %sc
2556 \family default
2556 \family default
2557 and
2557 and
2558 \family typewriter
2558 \family typewriter
2559 %sx
2559 %sx
2560 \family default
2560 \family default
2561 magic commands allow you to capture system output into Python variables.
2561 magic commands allow you to capture system output into Python variables.
2562 \end_layout
2562 \end_layout
2563
2563
2564 \begin_layout Itemize
2564 \begin_layout Itemize
2565 Expand python variables when calling the shell (either via
2565 Expand python variables when calling the shell (either via
2566 \family typewriter
2566 \family typewriter
2567 `!'
2567 `!'
2568 \family default
2568 \family default
2569 and
2569 and
2570 \family typewriter
2570 \family typewriter
2571 `!!'
2571 `!!'
2572 \family default
2572 \family default
2573 or via aliases) by prepending a
2573 or via aliases) by prepending a
2574 \family typewriter
2574 \family typewriter
2575 $
2575 $
2576 \family default
2576 \family default
2577 in front of them.
2577 in front of them.
2578 You can also expand complete python expressions.
2578 You can also expand complete python expressions.
2579 See sec.\InsetSpace ~
2579 See sec.\InsetSpace ~
2580
2580
2581 \begin_inset LatexCommand \ref{sub:System-shell-access}
2581 \begin_inset LatexCommand \ref{sub:System-shell-access}
2582
2582
2583 \end_inset
2583 \end_inset
2584
2584
2585 for more.
2585 for more.
2586 \end_layout
2586 \end_layout
2587
2587
2588 \begin_layout Itemize
2588 \begin_layout Itemize
2589 Use profiles to maintain different configurations (modules to load, function
2589 Use profiles to maintain different configurations (modules to load, function
2590 definitions, option settings) for particular tasks.
2590 definitions, option settings) for particular tasks.
2591 You can then have customized versions of IPython for specific purposes.
2591 You can then have customized versions of IPython for specific purposes.
2592 See sec.\InsetSpace ~
2592 See sec.\InsetSpace ~
2593
2593
2594 \begin_inset LatexCommand \ref{sec:profiles}
2594 \begin_inset LatexCommand \ref{sec:profiles}
2595
2595
2596 \end_inset
2596 \end_inset
2597
2597
2598 for more.
2598 for more.
2599 \end_layout
2599 \end_layout
2600
2600
2601 \begin_layout Itemize
2601 \begin_layout Itemize
2602 Embed IPython in your programs.
2602 Embed IPython in your programs.
2603 A few lines of code are enough to load a complete IPython inside your own
2603 A few lines of code are enough to load a complete IPython inside your own
2604 programs, giving you the ability to work with your data interactively after
2604 programs, giving you the ability to work with your data interactively after
2605 automatic processing has been completed.
2605 automatic processing has been completed.
2606 See sec.\InsetSpace ~
2606 See sec.\InsetSpace ~
2607
2607
2608 \begin_inset LatexCommand \ref{sec:embed}
2608 \begin_inset LatexCommand \ref{sec:embed}
2609
2609
2610 \end_inset
2610 \end_inset
2611
2611
2612 for more.
2612 for more.
2613 \end_layout
2613 \end_layout
2614
2614
2615 \begin_layout Itemize
2615 \begin_layout Itemize
2616 Use the Python profiler.
2616 Use the Python profiler.
2617 When dealing with performance issues, the
2617 When dealing with performance issues, the
2618 \family typewriter
2618 \family typewriter
2619 %run
2619 %run
2620 \family default
2620 \family default
2621 command with a
2621 command with a
2622 \family typewriter
2622 \family typewriter
2623 -p
2623 -p
2624 \family default
2624 \family default
2625 option allows you to run complete programs under the control of the Python
2625 option allows you to run complete programs under the control of the Python
2626 profiler.
2626 profiler.
2627 The
2627 The
2628 \family typewriter
2628 \family typewriter
2629 %prun
2629 %prun
2630 \family default
2630 \family default
2631 command does a similar job for single Python expressions (like function
2631 command does a similar job for single Python expressions (like function
2632 calls).
2632 calls).
2633 \end_layout
2633 \end_layout
2634
2634
2635 \begin_layout Itemize
2635 \begin_layout Itemize
2636 Use the IPython.demo.Demo class to load any Python script as an interactive
2636 Use the IPython.demo.Demo class to load any Python script as an interactive
2637 demo.
2637 demo.
2638 With a minimal amount of simple markup, you can control the execution of
2638 With a minimal amount of simple markup, you can control the execution of
2639 the script, stopping as needed.
2639 the script, stopping as needed.
2640 See sec.\InsetSpace ~
2640 See sec.\InsetSpace ~
2641
2641
2642 \begin_inset LatexCommand \ref{sec:interactive-demos}
2642 \begin_inset LatexCommand \ref{sec:interactive-demos}
2643
2643
2644 \end_inset
2644 \end_inset
2645
2645
2646 for more.
2646 for more.
2647 \end_layout
2647 \end_layout
2648
2648
2649 \begin_layout Subsection
2649 \begin_layout Subsection
2650 Source code handling tips
2650 Source code handling tips
2651 \end_layout
2651 \end_layout
2652
2652
2653 \begin_layout Standard
2653 \begin_layout Standard
2654 IPython is a line-oriented program, without full control of the terminal.
2654 IPython is a line-oriented program, without full control of the terminal.
2655 Therefore, it doesn't support true multiline editing.
2655 Therefore, it doesn't support true multiline editing.
2656 However, it has a number of useful tools to help you in dealing effectively
2656 However, it has a number of useful tools to help you in dealing effectively
2657 with more complex editing.
2657 with more complex editing.
2658 \end_layout
2658 \end_layout
2659
2659
2660 \begin_layout Standard
2660 \begin_layout Standard
2661 The
2661 The
2662 \family typewriter
2662 \family typewriter
2663 %edit
2663 %edit
2664 \family default
2664 \family default
2665 command gives a reasonable approximation of multiline editing, by invoking
2665 command gives a reasonable approximation of multiline editing, by invoking
2666 your favorite editor on the spot.
2666 your favorite editor on the spot.
2667 IPython will execute the code you type in there as if it were typed interactive
2667 IPython will execute the code you type in there as if it were typed interactive
2668 ly.
2668 ly.
2669 Type
2669 Type
2670 \family typewriter
2670 \family typewriter
2671 %edit?
2671 %edit?
2672 \family default
2672 \family default
2673 for the full details on the edit command.
2673 for the full details on the edit command.
2674 \end_layout
2674 \end_layout
2675
2675
2676 \begin_layout Standard
2676 \begin_layout Standard
2677 If you have typed various commands during a session, which you'd like to
2677 If you have typed various commands during a session, which you'd like to
2678 reuse, IPython provides you with a number of tools.
2678 reuse, IPython provides you with a number of tools.
2679 Start by using
2679 Start by using
2680 \family typewriter
2680 \family typewriter
2681 %hist
2681 %hist
2682 \family default
2682 \family default
2683 to see your input history, so you can see the line numbers of all input.
2683 to see your input history, so you can see the line numbers of all input.
2684 Let us say that you'd like to reuse lines 10 through 20, plus lines 24
2684 Let us say that you'd like to reuse lines 10 through 20, plus lines 24
2685 and 28.
2685 and 28.
2686 All the commands below can operate on these with the syntax
2686 All the commands below can operate on these with the syntax
2687 \end_layout
2687 \end_layout
2688
2688
2689 \begin_layout LyX-Code
2689 \begin_layout LyX-Code
2690 %command 10-20 24 28
2690 %command 10-20 24 28
2691 \end_layout
2691 \end_layout
2692
2692
2693 \begin_layout Standard
2693 \begin_layout Standard
2694 where the command given can be:
2694 where the command given can be:
2695 \end_layout
2695 \end_layout
2696
2696
2697 \begin_layout Itemize
2697 \begin_layout Itemize
2698
2698
2699 \family typewriter
2699 \family typewriter
2700 %macro <macroname>
2700 %macro <macroname>
2701 \family default
2701 \family default
2702 : this stores the lines into a variable which, when called at the prompt,
2702 : this stores the lines into a variable which, when called at the prompt,
2703 re-executes the input.
2703 re-executes the input.
2704 Macros can be edited later using
2704 Macros can be edited later using
2705 \family typewriter
2705 \family typewriter
2706 `%edit macroname
2706 `%edit macroname
2707 \family default
2707 \family default
2708 ', and they can be stored persistently across sessions with `
2708 ', and they can be stored persistently across sessions with `
2709 \family typewriter
2709 \family typewriter
2710 %store macroname
2710 %store macroname
2711 \family default
2711 \family default
2712 ' (the storage system is per-profile).
2712 ' (the storage system is per-profile).
2713 The combination of quick macros, persistent storage and editing, allows
2713 The combination of quick macros, persistent storage and editing, allows
2714 you to easily refine quick-and-dirty interactive input into permanent utilities
2714 you to easily refine quick-and-dirty interactive input into permanent utilities
2715 , always available both in IPython and as files for general reuse.
2715 , always available both in IPython and as files for general reuse.
2716 \end_layout
2716 \end_layout
2717
2717
2718 \begin_layout Itemize
2718 \begin_layout Itemize
2719
2719
2720 \family typewriter
2720 \family typewriter
2721 %edit
2721 %edit
2722 \family default
2722 \family default
2723 : this will open a text editor with those lines pre-loaded for further modificat
2723 : this will open a text editor with those lines pre-loaded for further modificat
2724 ion.
2724 ion.
2725 It will then execute the resulting file's contents as if you had typed
2725 It will then execute the resulting file's contents as if you had typed
2726 it at the prompt.
2726 it at the prompt.
2727 \end_layout
2727 \end_layout
2728
2728
2729 \begin_layout Itemize
2729 \begin_layout Itemize
2730
2730
2731 \family typewriter
2731 \family typewriter
2732 %save <filename>
2732 %save <filename>
2733 \family default
2733 \family default
2734 : this saves the lines directly to a named file on disk.
2734 : this saves the lines directly to a named file on disk.
2735 \end_layout
2735 \end_layout
2736
2736
2737 \begin_layout Standard
2737 \begin_layout Standard
2738 While
2738 While
2739 \family typewriter
2739 \family typewriter
2740 %macro
2740 %macro
2741 \family default
2741 \family default
2742 saves input lines into memory for interactive re-execution, sometimes you'd
2742 saves input lines into memory for interactive re-execution, sometimes you'd
2743 like to save your input directly to a file.
2743 like to save your input directly to a file.
2744 The
2744 The
2745 \family typewriter
2745 \family typewriter
2746 %save
2746 %save
2747 \family default
2747 \family default
2748 magic does this: its input sytnax is the same as
2748 magic does this: its input sytnax is the same as
2749 \family typewriter
2749 \family typewriter
2750 %macro
2750 %macro
2751 \family default
2751 \family default
2752 , but it saves your input directly to a Python file.
2752 , but it saves your input directly to a Python file.
2753 Note that the
2753 Note that the
2754 \family typewriter
2754 \family typewriter
2755 %logstart
2755 %logstart
2756 \family default
2756 \family default
2757 command also saves input, but it logs
2757 command also saves input, but it logs
2758 \emph on
2758 \emph on
2759 all
2759 all
2760 \emph default
2760 \emph default
2761 input to disk (though you can temporarily suspend it and reactivate it
2761 input to disk (though you can temporarily suspend it and reactivate it
2762 with
2762 with
2763 \family typewriter
2763 \family typewriter
2764 %logoff/%logon
2764 %logoff/%logon
2765 \family default
2765 \family default
2766 );
2766 );
2767 \family typewriter
2767 \family typewriter
2768 %save
2768 %save
2769 \family default
2769 \family default
2770 allows you to select which lines of input you need to save.
2770 allows you to select which lines of input you need to save.
2771 \end_layout
2771 \end_layout
2772
2772
2773 \begin_layout Subsubsection*
2773 \begin_layout Subsubsection*
2774 Lightweight 'version control'
2774 Lightweight 'version control'
2775 \end_layout
2775 \end_layout
2776
2776
2777 \begin_layout Standard
2777 \begin_layout Standard
2778 When you call
2778 When you call
2779 \family typewriter
2779 \family typewriter
2780 %edit
2780 %edit
2781 \family default
2781 \family default
2782 with no arguments, IPython opens an empty editor with a temporary file,
2782 with no arguments, IPython opens an empty editor with a temporary file,
2783 and it returns the contents of your editing session as a string variable.
2783 and it returns the contents of your editing session as a string variable.
2784 Thanks to IPython's output caching mechanism, this is automatically stored:
2784 Thanks to IPython's output caching mechanism, this is automatically stored:
2785 \end_layout
2785 \end_layout
2786
2786
2787 \begin_layout LyX-Code
2787 \begin_layout LyX-Code
2788 In [1]: %edit
2788 In [1]: %edit
2789 \end_layout
2789 \end_layout
2790
2790
2791 \begin_layout LyX-Code
2791 \begin_layout LyX-Code
2792 IPython will make a temporary file named: /tmp/ipython_edit_yR-HCN.py
2792 IPython will make a temporary file named: /tmp/ipython_edit_yR-HCN.py
2793 \end_layout
2793 \end_layout
2794
2794
2795 \begin_layout LyX-Code
2795 \begin_layout LyX-Code
2796 Editing...
2796 Editing...
2797 done.
2797 done.
2798 Executing edited code...
2798 Executing edited code...
2799 \end_layout
2799 \end_layout
2800
2800
2801 \begin_layout LyX-Code
2801 \begin_layout LyX-Code
2802 hello - this is a temporary file
2802 hello - this is a temporary file
2803 \end_layout
2803 \end_layout
2804
2804
2805 \begin_layout LyX-Code
2805 \begin_layout LyX-Code
2806 Out[1]: "print 'hello - this is a temporary file'
2806 Out[1]: "print 'hello - this is a temporary file'
2807 \backslash
2807 \backslash
2808 n"
2808 n"
2809 \end_layout
2809 \end_layout
2810
2810
2811 \begin_layout Standard
2811 \begin_layout Standard
2812 Now, if you call
2812 Now, if you call
2813 \family typewriter
2813 \family typewriter
2814 `%edit -p'
2814 `%edit -p'
2815 \family default
2815 \family default
2816 , IPython tries to open an editor with the same data as the last time you
2816 , IPython tries to open an editor with the same data as the last time you
2817 used
2817 used
2818 \family typewriter
2818 \family typewriter
2819 %edit
2819 %edit
2820 \family default
2820 \family default
2821 .
2821 .
2822 So if you haven't used
2822 So if you haven't used
2823 \family typewriter
2823 \family typewriter
2824 %edit
2824 %edit
2825 \family default
2825 \family default
2826 in the meantime, this same contents will reopen; however, it will be done
2826 in the meantime, this same contents will reopen; however, it will be done
2827 in a
2827 in a
2828 \emph on
2828 \emph on
2829 new file
2829 new file
2830 \emph default
2830 \emph default
2831 .
2831 .
2832 This means that if you make changes and you later want to find an old version,
2832 This means that if you make changes and you later want to find an old version,
2833 you can always retrieve it by using its output number, via
2833 you can always retrieve it by using its output number, via
2834 \family typewriter
2834 \family typewriter
2835 `%edit _NN'
2835 `%edit _NN'
2836 \family default
2836 \family default
2837 , where
2837 , where
2838 \family typewriter
2838 \family typewriter
2839 NN
2839 NN
2840 \family default
2840 \family default
2841 is the number of the output prompt.
2841 is the number of the output prompt.
2842 \end_layout
2842 \end_layout
2843
2843
2844 \begin_layout Standard
2844 \begin_layout Standard
2845 Continuing with the example above, this should illustrate this idea:
2845 Continuing with the example above, this should illustrate this idea:
2846 \end_layout
2846 \end_layout
2847
2847
2848 \begin_layout LyX-Code
2848 \begin_layout LyX-Code
2849 In [2]: edit -p
2849 In [2]: edit -p
2850 \end_layout
2850 \end_layout
2851
2851
2852 \begin_layout LyX-Code
2852 \begin_layout LyX-Code
2853 IPython will make a temporary file named: /tmp/ipython_edit_nA09Qk.py
2853 IPython will make a temporary file named: /tmp/ipython_edit_nA09Qk.py
2854 \end_layout
2854 \end_layout
2855
2855
2856 \begin_layout LyX-Code
2856 \begin_layout LyX-Code
2857 Editing...
2857 Editing...
2858 done.
2858 done.
2859 Executing edited code...
2859 Executing edited code...
2860 \end_layout
2860 \end_layout
2861
2861
2862 \begin_layout LyX-Code
2862 \begin_layout LyX-Code
2863 hello - now I made some changes
2863 hello - now I made some changes
2864 \end_layout
2864 \end_layout
2865
2865
2866 \begin_layout LyX-Code
2866 \begin_layout LyX-Code
2867 Out[2]: "print 'hello - now I made some changes'
2867 Out[2]: "print 'hello - now I made some changes'
2868 \backslash
2868 \backslash
2869 n"
2869 n"
2870 \end_layout
2870 \end_layout
2871
2871
2872 \begin_layout LyX-Code
2872 \begin_layout LyX-Code
2873 In [3]: edit _1
2873 In [3]: edit _1
2874 \end_layout
2874 \end_layout
2875
2875
2876 \begin_layout LyX-Code
2876 \begin_layout LyX-Code
2877 IPython will make a temporary file named: /tmp/ipython_edit_gy6-zD.py
2877 IPython will make a temporary file named: /tmp/ipython_edit_gy6-zD.py
2878 \end_layout
2878 \end_layout
2879
2879
2880 \begin_layout LyX-Code
2880 \begin_layout LyX-Code
2881 Editing...
2881 Editing...
2882 done.
2882 done.
2883 Executing edited code...
2883 Executing edited code...
2884 \end_layout
2884 \end_layout
2885
2885
2886 \begin_layout LyX-Code
2886 \begin_layout LyX-Code
2887 hello - this is a temporary file
2887 hello - this is a temporary file
2888 \end_layout
2888 \end_layout
2889
2889
2890 \begin_layout LyX-Code
2890 \begin_layout LyX-Code
2891 IPython version control at work :)
2891 IPython version control at work :)
2892 \end_layout
2892 \end_layout
2893
2893
2894 \begin_layout LyX-Code
2894 \begin_layout LyX-Code
2895 Out[3]: "print 'hello - this is a temporary file'
2895 Out[3]: "print 'hello - this is a temporary file'
2896 \backslash
2896 \backslash
2897 nprint 'IPython version control at work :)'
2897 nprint 'IPython version control at work :)'
2898 \backslash
2898 \backslash
2899 n"
2899 n"
2900 \end_layout
2900 \end_layout
2901
2901
2902 \begin_layout Standard
2902 \begin_layout Standard
2903 This section was written after a contribution by Alexander Belchenko on
2903 This section was written after a contribution by Alexander Belchenko on
2904 the IPython user list.
2904 the IPython user list.
2905 \end_layout
2905 \end_layout
2906
2906
2907 \begin_layout LyX-Code
2907 \begin_layout LyX-Code
2908
2908
2909 \end_layout
2909 \end_layout
2910
2910
2911 \begin_layout Subsection
2911 \begin_layout Subsection
2912 Effective logging
2912 Effective logging
2913 \end_layout
2913 \end_layout
2914
2914
2915 \begin_layout Standard
2915 \begin_layout Standard
2916 A very useful suggestion sent in by Robert Kern follows:
2916 A very useful suggestion sent in by Robert Kern follows:
2917 \end_layout
2917 \end_layout
2918
2918
2919 \begin_layout Standard
2919 \begin_layout Standard
2920 I recently happened on a nifty way to keep tidy per-project log files.
2920 I recently happened on a nifty way to keep tidy per-project log files.
2921 I made a profile for my project (which is called "parkfield").
2921 I made a profile for my project (which is called "parkfield").
2922 \end_layout
2922 \end_layout
2923
2923
2924 \begin_layout LyX-Code
2924 \begin_layout LyX-Code
2925 include ipythonrc
2925 include ipythonrc
2926 \end_layout
2926 \end_layout
2927
2927
2928 \begin_layout LyX-Code
2928 \begin_layout LyX-Code
2929 # cancel earlier logfile invocation:
2929 # cancel earlier logfile invocation:
2930 \end_layout
2930 \end_layout
2931
2931
2932 \begin_layout LyX-Code
2932 \begin_layout LyX-Code
2933 logfile ''
2933 logfile ''
2934 \end_layout
2934 \end_layout
2935
2935
2936 \begin_layout LyX-Code
2936 \begin_layout LyX-Code
2937 execute import time
2937 execute import time
2938 \end_layout
2938 \end_layout
2939
2939
2940 \begin_layout LyX-Code
2940 \begin_layout LyX-Code
2941 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
2941 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
2942 \end_layout
2942 \end_layout
2943
2943
2944 \begin_layout LyX-Code
2944 \begin_layout LyX-Code
2945 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
2945 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
2946 \end_layout
2946 \end_layout
2947
2947
2948 \begin_layout Standard
2948 \begin_layout Standard
2949 I also added a shell alias for convenience:
2949 I also added a shell alias for convenience:
2950 \end_layout
2950 \end_layout
2951
2951
2952 \begin_layout LyX-Code
2952 \begin_layout LyX-Code
2953 alias parkfield="ipython -pylab -profile parkfield"
2953 alias parkfield="ipython -pylab -profile parkfield"
2954 \end_layout
2954 \end_layout
2955
2955
2956 \begin_layout Standard
2956 \begin_layout Standard
2957 Now I have a nice little directory with everything I ever type in, organized
2957 Now I have a nice little directory with everything I ever type in, organized
2958 by project and date.
2958 by project and date.
2959 \end_layout
2959 \end_layout
2960
2960
2961 \begin_layout Standard
2961 \begin_layout Standard
2962
2962
2963 \series bold
2963 \series bold
2964 Contribute your own:
2964 Contribute your own:
2965 \series default
2965 \series default
2966 If you have your own favorite tip on using IPython efficiently for a certain
2966 If you have your own favorite tip on using IPython efficiently for a certain
2967 task (especially things which can't be done in the normal Python interpreter),
2967 task (especially things which can't be done in the normal Python interpreter),
2968 don't hesitate to send it!
2968 don't hesitate to send it!
2969 \end_layout
2969 \end_layout
2970
2970
2971 \begin_layout Section
2971 \begin_layout Section
2972 Command-line use
2972 Command-line use
2973 \end_layout
2973 \end_layout
2974
2974
2975 \begin_layout Standard
2975 \begin_layout Standard
2976 You start IPython with the command:
2976 You start IPython with the command:
2977 \end_layout
2977 \end_layout
2978
2978
2979 \begin_layout Standard
2979 \begin_layout Standard
2980
2980
2981 \family typewriter
2981 \family typewriter
2982 $ ipython [options] files
2982 $ ipython [options] files
2983 \end_layout
2983 \end_layout
2984
2984
2985 \begin_layout Standard
2985 \begin_layout Standard
2986 If invoked with no options, it executes all the files listed in sequence
2986 If invoked with no options, it executes all the files listed in sequence
2987 and drops you into the interpreter while still acknowledging any options
2987 and drops you into the interpreter while still acknowledging any options
2988 you may have set in your ipythonrc file.
2988 you may have set in your ipythonrc file.
2989 This behavior is different from standard Python, which when called as
2989 This behavior is different from standard Python, which when called as
2990 \family typewriter
2990 \family typewriter
2991 python -i
2991 python -i
2992 \family default
2992 \family default
2993 will only execute one file and ignore your configuration setup.
2993 will only execute one file and ignore your configuration setup.
2994 \end_layout
2994 \end_layout
2995
2995
2996 \begin_layout Standard
2996 \begin_layout Standard
2997 Please note that some of the configuration options are not available at
2997 Please note that some of the configuration options are not available at
2998 the command line, simply because they are not practical here.
2998 the command line, simply because they are not practical here.
2999 Look into your ipythonrc configuration file for details on those.
2999 Look into your ipythonrc configuration file for details on those.
3000 This file typically installed in the
3000 This file typically installed in the
3001 \family typewriter
3001 \family typewriter
3002 $HOME/.ipython
3002 $HOME/.ipython
3003 \family default
3003 \family default
3004 directory.
3004 directory.
3005 For Windows users,
3005 For Windows users,
3006 \family typewriter
3006 \family typewriter
3007 $HOME
3007 $HOME
3008 \family default
3008 \family default
3009 resolves to
3009 resolves to
3010 \family typewriter
3010 \family typewriter
3011 C:
3011 C:
3012 \backslash
3012 \backslash
3013
3013
3014 \backslash
3014 \backslash
3015 Documents and Settings
3015 Documents and Settings
3016 \backslash
3016 \backslash
3017
3017
3018 \backslash
3018 \backslash
3019 YourUserName
3019 YourUserName
3020 \family default
3020 \family default
3021 in most instances.
3021 in most instances.
3022 In the rest of this text, we will refer to this directory as
3022 In the rest of this text, we will refer to this directory as
3023 \family typewriter
3023 \family typewriter
3024 IPYTHONDIR
3024 IPYTHONDIR
3025 \family default
3025 \family default
3026 .
3026 .
3027 \end_layout
3027 \end_layout
3028
3028
3029 \begin_layout Subsection
3029 \begin_layout Subsection
3030 \begin_inset LatexCommand \label{sec:threading-opts}
3030 \begin_inset LatexCommand \label{sec:threading-opts}
3031
3031
3032 \end_inset
3032 \end_inset
3033
3033
3034 Special Threading Options
3034 Special Threading Options
3035 \end_layout
3035 \end_layout
3036
3036
3037 \begin_layout Standard
3037 \begin_layout Standard
3038 The following special options are ONLY valid at the beginning of the command
3038 The following special options are ONLY valid at the beginning of the command
3039 line, and not later.
3039 line, and not later.
3040 This is because they control the initial- ization of ipython itself, before
3040 This is because they control the initial- ization of ipython itself, before
3041 the normal option-handling mechanism is active.
3041 the normal option-handling mechanism is active.
3042 \end_layout
3042 \end_layout
3043
3043
3044 \begin_layout List
3044 \begin_layout List
3045 \labelwidthstring 00.00.0000
3045 \labelwidthstring 00.00.0000
3046
3046
3047 \family typewriter
3047 \family typewriter
3048 \series bold
3048 \series bold
3049 -gthread,\InsetSpace ~
3049 -gthread,\InsetSpace ~
3050 -qthread,\InsetSpace ~
3050 -qthread,\InsetSpace ~
3051 -q4thread,\InsetSpace ~
3051 -q4thread,\InsetSpace ~
3052 -wthread,\InsetSpace ~
3052 -wthread,\InsetSpace ~
3053 -pylab:
3053 -pylab:
3054 \family default
3054 \family default
3055 \series default
3055 \series default
3056 Only
3056 Only
3057 \emph on
3057 \emph on
3058 one
3058 one
3059 \emph default
3059 \emph default
3060 of these can be given, and it can only be given as the first option passed
3060 of these can be given, and it can only be given as the first option passed
3061 to IPython (it will have no effect in any other position).
3061 to IPython (it will have no effect in any other position).
3062 They provide threading support for the GTK, Qt (versions 3 and 4) and WXPython
3062 They provide threading support for the GTK, Qt (versions 3 and 4) and WXPython
3063 toolkits, and for the matplotlib library.
3063 toolkits, and for the matplotlib library.
3064 \end_layout
3064 \end_layout
3065
3065
3066 \begin_layout List
3066 \begin_layout List
3067 \labelwidthstring 00.00.0000
3067 \labelwidthstring 00.00.0000
3068 \InsetSpace ~
3068 \InsetSpace ~
3069 With any of the first four options, IPython starts running a separate thread
3069 With any of the first four options, IPython starts running a separate thread
3070 for the graphical toolkit's operation, so that you can open and control
3070 for the graphical toolkit's operation, so that you can open and control
3071 graphical elements from within an IPython command line, without blocking.
3071 graphical elements from within an IPython command line, without blocking.
3072 All four provide essentially the same functionality, respectively for GTK,
3072 All four provide essentially the same functionality, respectively for GTK,
3073 Qt3, Qt4 and WXWidgets (via their Python interfaces).
3073 Qt3, Qt4 and WXWidgets (via their Python interfaces).
3074 \end_layout
3074 \end_layout
3075
3075
3076 \begin_layout List
3076 \begin_layout List
3077 \labelwidthstring 00.00.0000
3077 \labelwidthstring 00.00.0000
3078 \InsetSpace ~
3078 \InsetSpace ~
3079 Note that with
3079 Note that with
3080 \family typewriter
3080 \family typewriter
3081 -wthread
3081 -wthread
3082 \family default
3082 \family default
3083 , you can additionally use the -wxversion option to request a specific version
3083 , you can additionally use the -wxversion option to request a specific version
3084 of wx to be used.
3084 of wx to be used.
3085 This requires that you have the
3085 This requires that you have the
3086 \family typewriter
3086 \family typewriter
3087 wxversion
3087 wxversion
3088 \family default
3088 \family default
3089 Python module installed, which is part of recent wxPython distributions.
3089 Python module installed, which is part of recent wxPython distributions.
3090 \end_layout
3090 \end_layout
3091
3091
3092 \begin_layout List
3092 \begin_layout List
3093 \labelwidthstring 00.00.0000
3093 \labelwidthstring 00.00.0000
3094 \InsetSpace ~
3094 \InsetSpace ~
3095 If
3095 If
3096 \family typewriter
3096 \family typewriter
3097 -pylab
3097 -pylab
3098 \family default
3098 \family default
3099 is given, IPython loads special support for the mat plotlib library (
3099 is given, IPython loads special support for the mat plotlib library (
3100 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
3100 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
3101
3101
3102 \end_inset
3102 \end_inset
3103
3103
3104 ), allowing interactive usage of any of its backends as defined in the user's
3104 ), allowing interactive usage of any of its backends as defined in the user's
3105
3105
3106 \family typewriter
3106 \family typewriter
3107 ~/.matplotlib/matplotlibrc
3107 ~/.matplotlib/matplotlibrc
3108 \family default
3108 \family default
3109 file.
3109 file.
3110 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
3110 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
3111 of matplotlib backend requires it.
3111 of matplotlib backend requires it.
3112 It also modifies the
3112 It also modifies the
3113 \family typewriter
3113 \family typewriter
3114 %run
3114 %run
3115 \family default
3115 \family default
3116 command to correctly execute (without blocking) any matplotlib-based script
3116 command to correctly execute (without blocking) any matplotlib-based script
3117 which calls
3117 which calls
3118 \family typewriter
3118 \family typewriter
3119 show()
3119 show()
3120 \family default
3120 \family default
3121 at the end.
3121 at the end.
3122
3122
3123 \end_layout
3123 \end_layout
3124
3124
3125 \begin_layout List
3125 \begin_layout List
3126 \labelwidthstring 00.00.0000
3126 \labelwidthstring 00.00.0000
3127
3127
3128 \family typewriter
3128 \family typewriter
3129 \series bold
3129 \series bold
3130 -tk
3130 -tk
3131 \family default
3131 \family default
3132 \series default
3132 \series default
3133 The
3133 The
3134 \family typewriter
3134 \family typewriter
3135 -g/q/q4/wthread
3135 -g/q/q4/wthread
3136 \family default
3136 \family default
3137 options, and
3137 options, and
3138 \family typewriter
3138 \family typewriter
3139 -pylab
3139 -pylab
3140 \family default
3140 \family default
3141 (if matplotlib is configured to use GTK, Qt3, Qt4 or WX), will normally
3141 (if matplotlib is configured to use GTK, Qt3, Qt4 or WX), will normally
3142 block Tk graphical interfaces.
3142 block Tk graphical interfaces.
3143 This means that when either GTK, Qt or WX threading is active, any attempt
3143 This means that when either GTK, Qt or WX threading is active, any attempt
3144 to open a Tk GUI will result in a dead window, and possibly cause the Python
3144 to open a Tk GUI will result in a dead window, and possibly cause the Python
3145 interpreter to crash.
3145 interpreter to crash.
3146 An extra option,
3146 An extra option,
3147 \family typewriter
3147 \family typewriter
3148 -tk
3148 -tk
3149 \family default
3149 \family default
3150 , is available to address this issue.
3150 , is available to address this issue.
3151 It can
3151 It can
3152 \emph on
3152 \emph on
3153 only
3153 only
3154 \emph default
3154 \emph default
3155 be given as a
3155 be given as a
3156 \emph on
3156 \emph on
3157 second
3157 second
3158 \emph default
3158 \emph default
3159 option after any of the above (
3159 option after any of the above (
3160 \family typewriter
3160 \family typewriter
3161 -gthread
3161 -gthread
3162 \family default
3162 \family default
3163 ,
3163 ,
3164 \family typewriter
3164 \family typewriter
3165 -wthread
3165 -wthread
3166 \family default
3166 \family default
3167 or
3167 or
3168 \family typewriter
3168 \family typewriter
3169 -pylab
3169 -pylab
3170 \family default
3170 \family default
3171 ).
3171 ).
3172 \end_layout
3172 \end_layout
3173
3173
3174 \begin_layout List
3174 \begin_layout List
3175 \labelwidthstring 00.00.0000
3175 \labelwidthstring 00.00.0000
3176 \InsetSpace ~
3176 \InsetSpace ~
3177 If
3177 If
3178 \family typewriter
3178 \family typewriter
3179 -tk
3179 -tk
3180 \family default
3180 \family default
3181 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
3181 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
3182 This is however potentially unreliable, and you will have to test on your
3182 This is however potentially unreliable, and you will have to test on your
3183 platform and Python configuration to determine whether it works for you.
3183 platform and Python configuration to determine whether it works for you.
3184 Debian users have reported success, apparently due to the fact that Debian
3184 Debian users have reported success, apparently due to the fact that Debian
3185 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
3185 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
3186 Under other Linux environments (such as Fedora Core 2/3), this option has
3186 Under other Linux environments (such as Fedora Core 2/3), this option has
3187 caused random crashes and lockups of the Python interpreter.
3187 caused random crashes and lockups of the Python interpreter.
3188 Under other operating systems (Mac OSX and Windows), you'll need to try
3188 Under other operating systems (Mac OSX and Windows), you'll need to try
3189 it to find out, since currently no user reports are available.
3189 it to find out, since currently no user reports are available.
3190 \end_layout
3190 \end_layout
3191
3191
3192 \begin_layout List
3192 \begin_layout List
3193 \labelwidthstring 00.00.0000
3193 \labelwidthstring 00.00.0000
3194 \InsetSpace ~
3194 \InsetSpace ~
3195 There is unfortunately no way for IPython to determine at run time whether
3195 There is unfortunately no way for IPython to determine at run time whether
3196
3196
3197 \family typewriter
3197 \family typewriter
3198 -tk
3198 -tk
3199 \family default
3199 \family default
3200 will work reliably or not, so you will need to do some experiments before
3200 will work reliably or not, so you will need to do some experiments before
3201 relying on it for regular work.
3201 relying on it for regular work.
3202
3202
3203 \end_layout
3203 \end_layout
3204
3204
3205 \begin_layout Subsection
3205 \begin_layout Subsection
3206 \begin_inset LatexCommand \label{sec:cmd-line-opts}
3206 \begin_inset LatexCommand \label{sec:cmd-line-opts}
3207
3207
3208 \end_inset
3208 \end_inset
3209
3209
3210 Regular Options
3210 Regular Options
3211 \end_layout
3211 \end_layout
3212
3212
3213 \begin_layout Standard
3213 \begin_layout Standard
3214 After the above threading options have been given, regular options can follow
3214 After the above threading options have been given, regular options can follow
3215 in any order.
3215 in any order.
3216 All options can be abbreviated to their shortest non-ambiguous form and
3216 All options can be abbreviated to their shortest non-ambiguous form and
3217 are case-sensitive.
3217 are case-sensitive.
3218 One or two dashes can be used.
3218 One or two dashes can be used.
3219 Some options have an alternate short form, indicated after a
3219 Some options have an alternate short form, indicated after a
3220 \family typewriter
3220 \family typewriter
3221 |
3221 |
3222 \family default
3222 \family default
3223 .
3223 .
3224 \end_layout
3224 \end_layout
3225
3225
3226 \begin_layout Standard
3226 \begin_layout Standard
3227 Most options can also be set from your ipythonrc configuration file.
3227 Most options can also be set from your ipythonrc configuration file.
3228 See the provided example for more details on what the options do.
3228 See the provided example for more details on what the options do.
3229 Options given at the command line override the values set in the ipythonrc
3229 Options given at the command line override the values set in the ipythonrc
3230 file.
3230 file.
3231 \end_layout
3231 \end_layout
3232
3232
3233 \begin_layout Standard
3233 \begin_layout Standard
3234 All options with a
3234 All options with a
3235 \family typewriter
3235 \family typewriter
3236 [no]
3236 [no]
3237 \family default
3237 \family default
3238 prepended can be specified in negated form (
3238 prepended can be specified in negated form (
3239 \family typewriter
3239 \family typewriter
3240 -nooption
3240 -nooption
3241 \family default
3241 \family default
3242 instead of
3242 instead of
3243 \family typewriter
3243 \family typewriter
3244 -option
3244 -option
3245 \family default
3245 \family default
3246 ) to turn the feature off.
3246 ) to turn the feature off.
3247 \end_layout
3247 \end_layout
3248
3248
3249 \begin_layout List
3249 \begin_layout List
3250 \labelwidthstring 00.00.0000
3250 \labelwidthstring 00.00.0000
3251
3251
3252 \family typewriter
3252 \family typewriter
3253 \series bold
3253 \series bold
3254 -help
3254 -help
3255 \family default
3255 \family default
3256 \series default
3256 \series default
3257 : print a help message and exit.
3257 : print a help message and exit.
3258 \end_layout
3258 \end_layout
3259
3259
3260 \begin_layout List
3260 \begin_layout List
3261 \labelwidthstring 00.00.0000
3261 \labelwidthstring 00.00.0000
3262
3262
3263 \family typewriter
3263 \family typewriter
3264 \series bold
3264 \series bold
3265 -pylab:
3265 -pylab:
3266 \family default
3266 \family default
3267 \series default
3267 \series default
3268 this can
3268 this can
3269 \emph on
3269 \emph on
3270 only
3270 only
3271 \emph default
3271 \emph default
3272 be given as the
3272 be given as the
3273 \emph on
3273 \emph on
3274 first
3274 first
3275 \emph default
3275 \emph default
3276 option passed to IPython (it will have no effect in any other position).
3276 option passed to IPython (it will have no effect in any other position).
3277 It adds special support for the matplotlib library (
3277 It adds special support for the matplotlib library (
3278 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
3278 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
3279
3279
3280 \end_inset
3280 \end_inset
3281
3281
3282 ), allowing interactive usage of any of its backends as defined in the user's
3282 ), allowing interactive usage of any of its backends as defined in the user's
3283
3283
3284 \family typewriter
3284 \family typewriter
3285 .matplotlibrc
3285 .matplotlibrc
3286 \family default
3286 \family default
3287 file.
3287 file.
3288 It automatically activates GTK or WX threading for IPyhton if the choice
3288 It automatically activates GTK or WX threading for IPyhton if the choice
3289 of matplotlib backend requires it.
3289 of matplotlib backend requires it.
3290 It also modifies the
3290 It also modifies the
3291 \family typewriter
3291 \family typewriter
3292 %run
3292 %run
3293 \family default
3293 \family default
3294 command to correctly execute (without blocking) any matplotlib-based script
3294 command to correctly execute (without blocking) any matplotlib-based script
3295 which calls
3295 which calls
3296 \family typewriter
3296 \family typewriter
3297 show()
3297 show()
3298 \family default
3298 \family default
3299 at the end.
3299 at the end.
3300 See Sec.\InsetSpace ~
3300 See Sec.\InsetSpace ~
3301
3301
3302 \begin_inset LatexCommand \ref{sec:matplotlib-support}
3302 \begin_inset LatexCommand \ref{sec:matplotlib-support}
3303
3303
3304 \end_inset
3304 \end_inset
3305
3305
3306 for more details.
3306 for more details.
3307 \end_layout
3307 \end_layout
3308
3308
3309 \begin_layout List
3309 \begin_layout List
3310 \labelwidthstring 00.00.0000
3310 \labelwidthstring 00.00.0000
3311
3311
3312 \family typewriter
3312 \family typewriter
3313 \series bold
3313 \series bold
3314 -autocall <val>:
3314 -autocall <val>:
3315 \family default
3315 \family default
3316 \series default
3316 \series default
3317 Make IPython automatically call any callable object even if you didn't
3317 Make IPython automatically call any callable object even if you didn't
3318 type explicit parentheses.
3318 type explicit parentheses.
3319 For example, `str 43' becomes `str(43)' automatically.
3319 For example, `str 43' becomes `str(43)' automatically.
3320 The value can be `0' to disable the feature, `1' for
3320 The value can be `0' to disable the feature, `1' for
3321 \emph on
3321 \emph on
3322 smart
3322 smart
3323 \emph default
3323 \emph default
3324 autocall, where it is not applied if there are no more arguments on the
3324 autocall, where it is not applied if there are no more arguments on the
3325 line, and `2' for
3325 line, and `2' for
3326 \emph on
3326 \emph on
3327 full
3327 full
3328 \emph default
3328 \emph default
3329 autocall, where all callable objects are automatically called (even if
3329 autocall, where all callable objects are automatically called (even if
3330 no arguments are present).
3330 no arguments are present).
3331 The default is `1'.
3331 The default is `1'.
3332 \end_layout
3332 \end_layout
3333
3333
3334 \begin_layout List
3334 \begin_layout List
3335 \labelwidthstring 00.00.0000
3335 \labelwidthstring 00.00.0000
3336
3336
3337 \family typewriter
3337 \family typewriter
3338 \series bold
3338 \series bold
3339 -[no]autoindent:
3339 -[no]autoindent:
3340 \family default
3340 \family default
3341 \series default
3341 \series default
3342 Turn automatic indentation on/off.
3342 Turn automatic indentation on/off.
3343 \end_layout
3343 \end_layout
3344
3344
3345 \begin_layout List
3345 \begin_layout List
3346 \labelwidthstring 00.00.0000
3346 \labelwidthstring 00.00.0000
3347
3347
3348 \family typewriter
3348 \family typewriter
3349 \series bold
3349 \series bold
3350 -[no]automagic
3350 -[no]automagic
3351 \series default
3351 \series default
3352 :
3352 :
3353 \family default
3353 \family default
3354 make magic commands automatic (without needing their first character to
3354 make magic commands automatic (without needing their first character to
3355 be
3355 be
3356 \family typewriter
3356 \family typewriter
3357 %
3357 %
3358 \family default
3358 \family default
3359 ).
3359 ).
3360 Type
3360 Type
3361 \family typewriter
3361 \family typewriter
3362 %magic
3362 %magic
3363 \family default
3363 \family default
3364 at the IPython prompt for more information.
3364 at the IPython prompt for more information.
3365 \end_layout
3365 \end_layout
3366
3366
3367 \begin_layout List
3367 \begin_layout List
3368 \labelwidthstring 00.00.0000
3368 \labelwidthstring 00.00.0000
3369
3369
3370 \family typewriter
3370 \family typewriter
3371 \series bold
3371 \series bold
3372 -[no]autoedit_syntax:
3372 -[no]autoedit_syntax:
3373 \family default
3373 \family default
3374 \series default
3374 \series default
3375 When a syntax error occurs after editing a file, automatically open the
3375 When a syntax error occurs after editing a file, automatically open the
3376 file to the trouble causing line for convenient fixing.
3376 file to the trouble causing line for convenient fixing.
3377
3377
3378 \end_layout
3378 \end_layout
3379
3379
3380 \begin_layout List
3380 \begin_layout List
3381 \labelwidthstring 00.00.0000
3381 \labelwidthstring 00.00.0000
3382
3382
3383 \family typewriter
3383 \family typewriter
3384 \series bold
3384 \series bold
3385 -[no]banner
3385 -[no]banner
3386 \series default
3386 \series default
3387 :
3387 :
3388 \family default
3388 \family default
3389 Print the initial information banner (default on).
3389 Print the initial information banner (default on).
3390 \end_layout
3390 \end_layout
3391
3391
3392 \begin_layout List
3392 \begin_layout List
3393 \labelwidthstring 00.00.0000
3393 \labelwidthstring 00.00.0000
3394
3394
3395 \family typewriter
3395 \family typewriter
3396 \series bold
3396 \series bold
3397 -c\InsetSpace ~
3397 -c\InsetSpace ~
3398 <command>:
3398 <command>:
3399 \family default
3399 \family default
3400 \series default
3400 \series default
3401 execute the given command string, and set sys.argv to
3401 execute the given command string, and set sys.argv to
3402 \family typewriter
3402 \family typewriter
3403 ['c']
3403 ['c']
3404 \family default
3404 \family default
3405 .
3405 .
3406 This is similar to the
3406 This is similar to the
3407 \family typewriter
3407 \family typewriter
3408 -c
3408 -c
3409 \family default
3409 \family default
3410 option in the normal Python interpreter.
3410 option in the normal Python interpreter.
3411
3411
3412 \end_layout
3412 \end_layout
3413
3413
3414 \begin_layout List
3414 \begin_layout List
3415 \labelwidthstring 00.00.0000
3415 \labelwidthstring 00.00.0000
3416
3416
3417 \family typewriter
3417 \family typewriter
3418 \series bold
3418 \series bold
3419 -cache_size|cs\InsetSpace ~
3419 -cache_size|cs\InsetSpace ~
3420 <n>
3420 <n>
3421 \series default
3421 \series default
3422 :
3422 :
3423 \family default
3423 \family default
3424 size of the output cache (maximum number of entries to hold in memory).
3424 size of the output cache (maximum number of entries to hold in memory).
3425 The default is 1000, you can change it permanently in your config file.
3425 The default is 1000, you can change it permanently in your config file.
3426 Setting it to 0 completely disables the caching system, and the minimum
3426 Setting it to 0 completely disables the caching system, and the minimum
3427 value accepted is 20 (if you provide a value less than 20, it is reset
3427 value accepted is 20 (if you provide a value less than 20, it is reset
3428 to 0 and a warning is issued) This limit is defined because otherwise you'll
3428 to 0 and a warning is issued) This limit is defined because otherwise you'll
3429 spend more time re-flushing a too small cache than working.
3429 spend more time re-flushing a too small cache than working.
3430 \end_layout
3430 \end_layout
3431
3431
3432 \begin_layout List
3432 \begin_layout List
3433 \labelwidthstring 00.00.0000
3433 \labelwidthstring 00.00.0000
3434
3434
3435 \family typewriter
3435 \family typewriter
3436 \series bold
3436 \series bold
3437 -classic|cl
3437 -classic|cl
3438 \series default
3438 \series default
3439 :
3439 :
3440 \family default
3440 \family default
3441 Gives IPython a similar feel to the classic Python prompt.
3441 Gives IPython a similar feel to the classic Python prompt.
3442 \end_layout
3442 \end_layout
3443
3443
3444 \begin_layout List
3444 \begin_layout List
3445 \labelwidthstring 00.00.0000
3445 \labelwidthstring 00.00.0000
3446
3446
3447 \family typewriter
3447 \family typewriter
3448 \series bold
3448 \series bold
3449 -colors\InsetSpace ~
3449 -colors\InsetSpace ~
3450 <scheme>:
3450 <scheme>:
3451 \family default
3451 \family default
3452 \series default
3452 \series default
3453 Color scheme for prompts and exception reporting.
3453 Color scheme for prompts and exception reporting.
3454 Currently implemented: NoColor, Linux and LightBG.
3454 Currently implemented: NoColor, Linux and LightBG.
3455 \end_layout
3455 \end_layout
3456
3456
3457 \begin_layout List
3457 \begin_layout List
3458 \labelwidthstring 00.00.0000
3458 \labelwidthstring 00.00.0000
3459
3459
3460 \family typewriter
3460 \family typewriter
3461 \series bold
3461 \series bold
3462 -[no]color_info:
3462 -[no]color_info:
3463 \family default
3463 \family default
3464 \series default
3464 \series default
3465 IPython can display information about objects via a set of functions, and
3465 IPython can display information about objects via a set of functions, and
3466 optionally can use colors for this, syntax highlighting source code and
3466 optionally can use colors for this, syntax highlighting source code and
3467 various other elements.
3467 various other elements.
3468 However, because this information is passed through a pager (like 'less')
3468 However, because this information is passed through a pager (like 'less')
3469 and many pagers get confused with color codes, this option is off by default.
3469 and many pagers get confused with color codes, this option is off by default.
3470 You can test it and turn it on permanently in your ipythonrc file if it
3470 You can test it and turn it on permanently in your ipythonrc file if it
3471 works for you.
3471 works for you.
3472 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
3472 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
3473 that in RedHat 7.2 doesn't.
3473 that in RedHat 7.2 doesn't.
3474 \end_layout
3474 \end_layout
3475
3475
3476 \begin_layout List
3476 \begin_layout List
3477 \labelwidthstring 00.00.0000
3477 \labelwidthstring 00.00.0000
3478 \InsetSpace ~
3478 \InsetSpace ~
3479 Test it and turn it on permanently if it works with your system.
3479 Test it and turn it on permanently if it works with your system.
3480 The magic function
3480 The magic function
3481 \family typewriter
3481 \family typewriter
3482 %color_info
3482 %color_info
3483 \family default
3483 \family default
3484 allows you to toggle this interactively for testing.
3484 allows you to toggle this interactively for testing.
3485 \end_layout
3485 \end_layout
3486
3486
3487 \begin_layout List
3487 \begin_layout List
3488 \labelwidthstring 00.00.0000
3488 \labelwidthstring 00.00.0000
3489
3489
3490 \family typewriter
3490 \family typewriter
3491 \series bold
3491 \series bold
3492 -[no]debug
3492 -[no]debug
3493 \family default
3493 \family default
3494 \series default
3494 \series default
3495 : Show information about the loading process.
3495 : Show information about the loading process.
3496 Very useful to pin down problems with your configuration files or to get
3496 Very useful to pin down problems with your configuration files or to get
3497 details about session restores.
3497 details about session restores.
3498 \end_layout
3498 \end_layout
3499
3499
3500 \begin_layout List
3500 \begin_layout List
3501 \labelwidthstring 00.00.0000
3501 \labelwidthstring 00.00.0000
3502
3502
3503 \family typewriter
3503 \family typewriter
3504 \series bold
3504 \series bold
3505 -[no]deep_reload
3505 -[no]deep_reload
3506 \series default
3506 \series default
3507 :
3507 :
3508 \family default
3508 \family default
3509 IPython can use the
3509 IPython can use the
3510 \family typewriter
3510 \family typewriter
3511 deep_reload
3511 deep_reload
3512 \family default
3512 \family default
3513 module which reloads changes in modules recursively (it replaces the
3513 module which reloads changes in modules recursively (it replaces the
3514 \family typewriter
3514 \family typewriter
3515 reload()
3515 reload()
3516 \family default
3516 \family default
3517 function, so you don't need to change anything to use it).
3517 function, so you don't need to change anything to use it).
3518
3518
3519 \family typewriter
3519 \family typewriter
3520 deep_reload()
3520 deep_reload()
3521 \family default
3521 \family default
3522 forces a full reload of modules whose code may have changed, which the
3522 forces a full reload of modules whose code may have changed, which the
3523 default
3523 default
3524 \family typewriter
3524 \family typewriter
3525 reload()
3525 reload()
3526 \family default
3526 \family default
3527 function does not.
3527 function does not.
3528 \end_layout
3528 \end_layout
3529
3529
3530 \begin_layout List
3530 \begin_layout List
3531 \labelwidthstring 00.00.0000
3531 \labelwidthstring 00.00.0000
3532 \InsetSpace ~
3532 \InsetSpace ~
3533 When deep_reload is off, IPython will use the normal
3533 When deep_reload is off, IPython will use the normal
3534 \family typewriter
3534 \family typewriter
3535 reload()
3535 reload()
3536 \family default
3536 \family default
3537 , but deep_reload will still be available as
3537 , but deep_reload will still be available as
3538 \family typewriter
3538 \family typewriter
3539 dreload()
3539 dreload()
3540 \family default
3540 \family default
3541 .
3541 .
3542 This feature is off by default [which means that you have both normal
3542 This feature is off by default [which means that you have both normal
3543 \family typewriter
3543 \family typewriter
3544 reload()
3544 reload()
3545 \family default
3545 \family default
3546 and
3546 and
3547 \family typewriter
3547 \family typewriter
3548 dreload()
3548 dreload()
3549 \family default
3549 \family default
3550 ].
3550 ].
3551 \end_layout
3551 \end_layout
3552
3552
3553 \begin_layout List
3553 \begin_layout List
3554 \labelwidthstring 00.00.0000
3554 \labelwidthstring 00.00.0000
3555
3555
3556 \family typewriter
3556 \family typewriter
3557 \series bold
3557 \series bold
3558 -editor\InsetSpace ~
3558 -editor\InsetSpace ~
3559 <name>
3559 <name>
3560 \family default
3560 \family default
3561 \series default
3561 \series default
3562 : Which editor to use with the
3562 : Which editor to use with the
3563 \family typewriter
3563 \family typewriter
3564 %edit
3564 %edit
3565 \family default
3565 \family default
3566 command.
3566 command.
3567 By default, IPython will honor your
3567 By default, IPython will honor your
3568 \family typewriter
3568 \family typewriter
3569 EDITOR
3569 EDITOR
3570 \family default
3570 \family default
3571 environment variable (if not set, vi is the Unix default and notepad the
3571 environment variable (if not set, vi is the Unix default and notepad the
3572 Windows one).
3572 Windows one).
3573 Since this editor is invoked on the fly by IPython and is meant for editing
3573 Since this editor is invoked on the fly by IPython and is meant for editing
3574 small code snippets, you may want to use a small, lightweight editor here
3574 small code snippets, you may want to use a small, lightweight editor here
3575 (in case your default
3575 (in case your default
3576 \family typewriter
3576 \family typewriter
3577 EDITOR
3577 EDITOR
3578 \family default
3578 \family default
3579 is something like Emacs).
3579 is something like Emacs).
3580 \end_layout
3580 \end_layout
3581
3581
3582 \begin_layout List
3582 \begin_layout List
3583 \labelwidthstring 00.00.0000
3583 \labelwidthstring 00.00.0000
3584
3584
3585 \family typewriter
3585 \family typewriter
3586 \series bold
3586 \series bold
3587 -ipythondir\InsetSpace ~
3587 -ipythondir\InsetSpace ~
3588 <name>
3588 <name>
3589 \series default
3589 \series default
3590 :
3590 :
3591 \family default
3591 \family default
3592 name of your IPython configuration directory
3592 name of your IPython configuration directory
3593 \family typewriter
3593 \family typewriter
3594 IPYTHONDIR
3594 IPYTHONDIR
3595 \family default
3595 \family default
3596 .
3596 .
3597 This can also be specified through the environment variable
3597 This can also be specified through the environment variable
3598 \family typewriter
3598 \family typewriter
3599 IPYTHONDIR
3599 IPYTHONDIR
3600 \family default
3600 \family default
3601 .
3601 .
3602 \end_layout
3602 \end_layout
3603
3603
3604 \begin_layout List
3604 \begin_layout List
3605 \labelwidthstring 00.00.0000
3605 \labelwidthstring 00.00.0000
3606
3606
3607 \family typewriter
3607 \family typewriter
3608 \series bold
3608 \series bold
3609 -log|l
3609 -log|l
3610 \family default
3610 \family default
3611 \series default
3611 \series default
3612 : generate a log file of all input.
3612 : generate a log file of all input.
3613 The file is named
3613 The file is named
3614 \family typewriter
3614 \family typewriter
3615 ipython_log.py
3615 ipython_log.py
3616 \family default
3616 \family default
3617 in your current directory (which prevents logs from multiple IPython sessions
3617 in your current directory (which prevents logs from multiple IPython sessions
3618 from trampling each other).
3618 from trampling each other).
3619 You can use this to later restore a session by loading your logfile as
3619 You can use this to later restore a session by loading your logfile as
3620 a file to be executed with option
3620 a file to be executed with option
3621 \family typewriter
3621 \family typewriter
3622 -logplay
3622 -logplay
3623 \family default
3623 \family default
3624 (see below).
3624 (see below).
3625 \end_layout
3625 \end_layout
3626
3626
3627 \begin_layout List
3627 \begin_layout List
3628 \labelwidthstring 00.00.0000
3628 \labelwidthstring 00.00.0000
3629
3629
3630 \family typewriter
3630 \family typewriter
3631 \series bold
3631 \series bold
3632 -logfile|lf\InsetSpace ~
3632 -logfile|lf\InsetSpace ~
3633 <name>
3633 <name>
3634 \series default
3634 \series default
3635 :
3635 :
3636 \family default
3636 \family default
3637 specify the name of your logfile.
3637 specify the name of your logfile.
3638 \end_layout
3638 \end_layout
3639
3639
3640 \begin_layout List
3640 \begin_layout List
3641 \labelwidthstring 00.00.0000
3641 \labelwidthstring 00.00.0000
3642
3642
3643 \family typewriter
3643 \family typewriter
3644 \series bold
3644 \series bold
3645 -logplay|lp\InsetSpace ~
3645 -logplay|lp\InsetSpace ~
3646 <name>
3646 <name>
3647 \series default
3647 \series default
3648 :
3648 :
3649 \family default
3649 \family default
3650 you can replay a previous log.
3650 you can replay a previous log.
3651 For restoring a session as close as possible to the state you left it in,
3651 For restoring a session as close as possible to the state you left it in,
3652 use this option (don't just run the logfile).
3652 use this option (don't just run the logfile).
3653 With
3653 With
3654 \family typewriter
3654 \family typewriter
3655 -logplay
3655 -logplay
3656 \family default
3656 \family default
3657 , IPython will try to reconstruct the previous working environment in full,
3657 , IPython will try to reconstruct the previous working environment in full,
3658 not just execute the commands in the logfile.
3658 not just execute the commands in the logfile.
3659 \end_layout
3659 \end_layout
3660
3660
3661 \begin_layout List
3661 \begin_layout List
3662 \labelwidthstring 00.00.0000
3662 \labelwidthstring 00.00.0000
3663 \InsetSpace ~
3663 \InsetSpace ~
3664 When a session is restored, logging is automatically turned on again with
3664 When a session is restored, logging is automatically turned on again with
3665 the name of the logfile it was invoked with (it is read from the log header).
3665 the name of the logfile it was invoked with (it is read from the log header).
3666 So once you've turned logging on for a session, you can quit IPython and
3666 So once you've turned logging on for a session, you can quit IPython and
3667 reload it as many times as you want and it will continue to log its history
3667 reload it as many times as you want and it will continue to log its history
3668 and restore from the beginning every time.
3668 and restore from the beginning every time.
3669 \end_layout
3669 \end_layout
3670
3670
3671 \begin_layout List
3671 \begin_layout List
3672 \labelwidthstring 00.00.0000
3672 \labelwidthstring 00.00.0000
3673 \InsetSpace ~
3673 \InsetSpace ~
3674 Caveats: there are limitations in this option.
3674 Caveats: there are limitations in this option.
3675 The history variables
3675 The history variables
3676 \family typewriter
3676 \family typewriter
3677 _i*
3677 _i*
3678 \family default
3678 \family default
3679 ,
3679 ,
3680 \family typewriter
3680 \family typewriter
3681 _*
3681 _*
3682 \family default
3682 \family default
3683 and
3683 and
3684 \family typewriter
3684 \family typewriter
3685 _dh
3685 _dh
3686 \family default
3686 \family default
3687 don't get restored properly.
3687 don't get restored properly.
3688 In the future we will try to implement full session saving by writing and
3688 In the future we will try to implement full session saving by writing and
3689 retrieving a 'snapshot' of the memory state of IPython.
3689 retrieving a 'snapshot' of the memory state of IPython.
3690 But our first attempts failed because of inherent limitations of Python's
3690 But our first attempts failed because of inherent limitations of Python's
3691 Pickle module, so this may have to wait.
3691 Pickle module, so this may have to wait.
3692 \end_layout
3692 \end_layout
3693
3693
3694 \begin_layout List
3694 \begin_layout List
3695 \labelwidthstring 00.00.0000
3695 \labelwidthstring 00.00.0000
3696
3696
3697 \family typewriter
3697 \family typewriter
3698 \series bold
3698 \series bold
3699 -[no]messages
3699 -[no]messages
3700 \series default
3700 \series default
3701 :
3701 :
3702 \family default
3702 \family default
3703 Print messages which IPython collects about its startup process (default
3703 Print messages which IPython collects about its startup process (default
3704 on).
3704 on).
3705 \end_layout
3705 \end_layout
3706
3706
3707 \begin_layout List
3707 \begin_layout List
3708 \labelwidthstring 00.00.0000
3708 \labelwidthstring 00.00.0000
3709
3709
3710 \family typewriter
3710 \family typewriter
3711 \series bold
3711 \series bold
3712 -[no]pdb
3712 -[no]pdb
3713 \family default
3713 \family default
3714 \series default
3714 \series default
3715 : Automatically call the pdb debugger after every uncaught exception.
3715 : Automatically call the pdb debugger after every uncaught exception.
3716 If you are used to debugging using pdb, this puts you automatically inside
3716 If you are used to debugging using pdb, this puts you automatically inside
3717 of it after any call (either in IPython or in code called by it) which
3717 of it after any call (either in IPython or in code called by it) which
3718 triggers an exception which goes uncaught.
3718 triggers an exception which goes uncaught.
3719 \end_layout
3719 \end_layout
3720
3720
3721 \begin_layout List
3721 \begin_layout List
3722 \labelwidthstring 00.00.0000
3722 \labelwidthstring 00.00.0000
3723
3723
3724 \family typewriter
3724 \family typewriter
3725 \series bold
3725 \series bold
3726 -[no]pprint
3726 -[no]pprint
3727 \series default
3727 \series default
3728 :
3728 :
3729 \family default
3729 \family default
3730 ipython can optionally use the pprint (pretty printer) module for displaying
3730 ipython can optionally use the pprint (pretty printer) module for displaying
3731 results.
3731 results.
3732 pprint tends to give a nicer display of nested data structures.
3732 pprint tends to give a nicer display of nested data structures.
3733 If you like it, you can turn it on permanently in your config file (default
3733 If you like it, you can turn it on permanently in your config file (default
3734 off).
3734 off).
3735 \end_layout
3735 \end_layout
3736
3736
3737 \begin_layout List
3737 \begin_layout List
3738 \labelwidthstring 00.00.0000
3738 \labelwidthstring 00.00.0000
3739
3739
3740 \family typewriter
3740 \family typewriter
3741 \series bold
3741 \series bold
3742 -profile|p <name>
3742 -profile|p <name>
3743 \series default
3743 \series default
3744 :
3744 :
3745 \family default
3745 \family default
3746 assume that your config file is
3746 assume that your config file is
3747 \family typewriter
3747 \family typewriter
3748 ipythonrc-<name>
3748 ipythonrc-<name>
3749 \family default
3749 \family default
3750 (looks in current dir first, then in
3750 (looks in current dir first, then in
3751 \family typewriter
3751 \family typewriter
3752 IPYTHONDIR
3752 IPYTHONDIR
3753 \family default
3753 \family default
3754 ).
3754 ).
3755 This is a quick way to keep and load multiple config files for different
3755 This is a quick way to keep and load multiple config files for different
3756 tasks, especially if you use the include option of config files.
3756 tasks, especially if you use the include option of config files.
3757 You can keep a basic
3757 You can keep a basic
3758 \family typewriter
3758 \family typewriter
3759 IPYTHONDIR/ipythonrc
3759 IPYTHONDIR/ipythonrc
3760 \family default
3760 \family default
3761 file and then have other 'profiles' which include this one and load extra
3761 file and then have other 'profiles' which include this one and load extra
3762 things for particular tasks.
3762 things for particular tasks.
3763 For example:
3763 For example:
3764 \end_layout
3764 \end_layout
3765
3765
3766 \begin_layout List
3766 \begin_layout List
3767 \labelwidthstring 00.00.0000
3767 \labelwidthstring 00.00.0000
3768
3768
3769 \family typewriter
3769 \family typewriter
3770 \InsetSpace ~
3770 \InsetSpace ~
3771
3771
3772 \family default
3772 \family default
3773 1.
3773 1.
3774
3774
3775 \family typewriter
3775 \family typewriter
3776 $HOME/.ipython/ipythonrc
3776 $HOME/.ipython/ipythonrc
3777 \family default
3777 \family default
3778 : load basic things you always want.
3778 : load basic things you always want.
3779 \end_layout
3779 \end_layout
3780
3780
3781 \begin_layout List
3781 \begin_layout List
3782 \labelwidthstring 00.00.0000
3782 \labelwidthstring 00.00.0000
3783
3783
3784 \family typewriter
3784 \family typewriter
3785 \InsetSpace ~
3785 \InsetSpace ~
3786
3786
3787 \family default
3787 \family default
3788 2.
3788 2.
3789
3789
3790 \family typewriter
3790 \family typewriter
3791 $HOME/.ipython/ipythonrc-math
3791 $HOME/.ipython/ipythonrc-math
3792 \family default
3792 \family default
3793 : load (1) and basic math-related modules.
3793 : load (1) and basic math-related modules.
3794
3794
3795 \end_layout
3795 \end_layout
3796
3796
3797 \begin_layout List
3797 \begin_layout List
3798 \labelwidthstring 00.00.0000
3798 \labelwidthstring 00.00.0000
3799
3799
3800 \family typewriter
3800 \family typewriter
3801 \InsetSpace ~
3801 \InsetSpace ~
3802
3802
3803 \family default
3803 \family default
3804 3.
3804 3.
3805
3805
3806 \family typewriter
3806 \family typewriter
3807 $HOME/.ipython/ipythonrc-numeric
3807 $HOME/.ipython/ipythonrc-numeric
3808 \family default
3808 \family default
3809 : load (1) and Numeric and plotting modules.
3809 : load (1) and Numeric and plotting modules.
3810 \end_layout
3810 \end_layout
3811
3811
3812 \begin_layout List
3812 \begin_layout List
3813 \labelwidthstring 00.00.0000
3813 \labelwidthstring 00.00.0000
3814 \InsetSpace ~
3814 \InsetSpace ~
3815 Since it is possible to create an endless loop by having circular file
3815 Since it is possible to create an endless loop by having circular file
3816 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3816 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3817 \end_layout
3817 \end_layout
3818
3818
3819 \begin_layout List
3819 \begin_layout List
3820 \labelwidthstring 00.00.0000
3820 \labelwidthstring 00.00.0000
3821
3821
3822 \family typewriter
3822 \family typewriter
3823 \series bold
3823 \series bold
3824 -prompt_in1|pi1\InsetSpace ~
3824 -prompt_in1|pi1\InsetSpace ~
3825 <string>:
3825 <string>:
3826 \family default
3826 \family default
3827 \series default
3827 \series default
3828 Specify the string used for input prompts.
3828 Specify the string used for input prompts.
3829 Note that if you are using numbered prompts, the number is represented
3829 Note that if you are using numbered prompts, the number is represented
3830 with a '
3830 with a '
3831 \backslash
3831 \backslash
3832 #' in the string.
3832 #' in the string.
3833 Don't forget to quote strings with spaces embedded in them.
3833 Don't forget to quote strings with spaces embedded in them.
3834 Default: '
3834 Default: '
3835 \family typewriter
3835 \family typewriter
3836 In\InsetSpace ~
3836 In\InsetSpace ~
3837 [
3837 [
3838 \backslash
3838 \backslash
3839 #]:
3839 #]:
3840 \family default
3840 \family default
3841 '.
3841 '.
3842 Sec.\InsetSpace ~
3842 Sec.\InsetSpace ~
3843
3843
3844 \begin_inset LatexCommand \ref{sec:prompts}
3844 \begin_inset LatexCommand \ref{sec:prompts}
3845
3845
3846 \end_inset
3846 \end_inset
3847
3847
3848 discusses in detail all the available escapes to customize your prompts.
3848 discusses in detail all the available escapes to customize your prompts.
3849 \end_layout
3849 \end_layout
3850
3850
3851 \begin_layout List
3851 \begin_layout List
3852 \labelwidthstring 00.00.0000
3852 \labelwidthstring 00.00.0000
3853
3853
3854 \family typewriter
3854 \family typewriter
3855 \series bold
3855 \series bold
3856 -prompt_in2|pi2\InsetSpace ~
3856 -prompt_in2|pi2\InsetSpace ~
3857 <string>:
3857 <string>:
3858 \family default
3858 \family default
3859 \series default
3859 \series default
3860 Similar to the previous option, but used for the continuation prompts.
3860 Similar to the previous option, but used for the continuation prompts.
3861 The special sequence '
3861 The special sequence '
3862 \family typewriter
3862 \family typewriter
3863
3863
3864 \backslash
3864 \backslash
3865 D
3865 D
3866 \family default
3866 \family default
3867 ' is similar to '
3867 ' is similar to '
3868 \family typewriter
3868 \family typewriter
3869
3869
3870 \backslash
3870 \backslash
3871 #
3871 #
3872 \family default
3872 \family default
3873 ', but with all digits replaced dots (so you can have your continuation
3873 ', but with all digits replaced dots (so you can have your continuation
3874 prompt aligned with your input prompt).
3874 prompt aligned with your input prompt).
3875 Default: '
3875 Default: '
3876 \family typewriter
3876 \family typewriter
3877 \InsetSpace ~
3877 \InsetSpace ~
3878 \InsetSpace ~
3878 \InsetSpace ~
3879 \InsetSpace ~
3879 \InsetSpace ~
3880 .
3880 .
3881 \backslash
3881 \backslash
3882 D.:
3882 D.:
3883 \family default
3883 \family default
3884 ' (note three spaces at the start for alignment with '
3884 ' (note three spaces at the start for alignment with '
3885 \family typewriter
3885 \family typewriter
3886 In\InsetSpace ~
3886 In\InsetSpace ~
3887 [
3887 [
3888 \backslash
3888 \backslash
3889 #]
3889 #]
3890 \family default
3890 \family default
3891 ').
3891 ').
3892 \end_layout
3892 \end_layout
3893
3893
3894 \begin_layout List
3894 \begin_layout List
3895 \labelwidthstring 00.00.0000
3895 \labelwidthstring 00.00.0000
3896
3896
3897 \family typewriter
3897 \family typewriter
3898 \series bold
3898 \series bold
3899 -prompt_out|po\InsetSpace ~
3899 -prompt_out|po\InsetSpace ~
3900 <string>:
3900 <string>:
3901 \family default
3901 \family default
3902 \series default
3902 \series default
3903 String used for output prompts, also uses numbers like
3903 String used for output prompts, also uses numbers like
3904 \family typewriter
3904 \family typewriter
3905 prompt_in1
3905 prompt_in1
3906 \family default
3906 \family default
3907 .
3907 .
3908 Default: '
3908 Default: '
3909 \family typewriter
3909 \family typewriter
3910 Out[
3910 Out[
3911 \backslash
3911 \backslash
3912 #]:
3912 #]:
3913 \family default
3913 \family default
3914 '
3914 '
3915 \end_layout
3915 \end_layout
3916
3916
3917 \begin_layout List
3917 \begin_layout List
3918 \labelwidthstring 00.00.0000
3918 \labelwidthstring 00.00.0000
3919
3919
3920 \family typewriter
3920 \family typewriter
3921 \series bold
3921 \series bold
3922 -quick
3922 -quick
3923 \family default
3923 \family default
3924 \series default
3924 \series default
3925 : start in bare bones mode (no config file loaded).
3925 : start in bare bones mode (no config file loaded).
3926 \end_layout
3926 \end_layout
3927
3927
3928 \begin_layout List
3928 \begin_layout List
3929 \labelwidthstring 00.00.0000
3929 \labelwidthstring 00.00.0000
3930
3930
3931 \family typewriter
3931 \family typewriter
3932 \series bold
3932 \series bold
3933 -rcfile\InsetSpace ~
3933 -rcfile\InsetSpace ~
3934 <name>
3934 <name>
3935 \series default
3935 \series default
3936 :
3936 :
3937 \family default
3937 \family default
3938 name of your IPython resource configuration file.
3938 name of your IPython resource configuration file.
3939 Normally IPython loads ipythonrc (from current directory) or
3939 Normally IPython loads ipythonrc (from current directory) or
3940 \family typewriter
3940 \family typewriter
3941 IPYTHONDIR/ipythonrc
3941 IPYTHONDIR/ipythonrc
3942 \family default
3942 \family default
3943 .
3943 .
3944 \end_layout
3944 \end_layout
3945
3945
3946 \begin_layout List
3946 \begin_layout List
3947 \labelwidthstring 00.00.0000
3947 \labelwidthstring 00.00.0000
3948 \InsetSpace ~
3948 \InsetSpace ~
3949 If the loading of your config file fails, IPython starts with a bare bones
3949 If the loading of your config file fails, IPython starts with a bare bones
3950 configuration (no modules loaded at all).
3950 configuration (no modules loaded at all).
3951 \end_layout
3951 \end_layout
3952
3952
3953 \begin_layout List
3953 \begin_layout List
3954 \labelwidthstring 00.00.0000
3954 \labelwidthstring 00.00.0000
3955
3955
3956 \family typewriter
3956 \family typewriter
3957 \series bold
3957 \series bold
3958 -[no]readline
3958 -[no]readline
3959 \family default
3959 \family default
3960 \series default
3960 \series default
3961 : use the readline library, which is needed to support name completion and
3961 : use the readline library, which is needed to support name completion and
3962 command history, among other things.
3962 command history, among other things.
3963 It is enabled by default, but may cause problems for users of X/Emacs in
3963 It is enabled by default, but may cause problems for users of X/Emacs in
3964 Python comint or shell buffers.
3964 Python comint or shell buffers.
3965 \end_layout
3965 \end_layout
3966
3966
3967 \begin_layout List
3967 \begin_layout List
3968 \labelwidthstring 00.00.0000
3968 \labelwidthstring 00.00.0000
3969 \InsetSpace ~
3969 \InsetSpace ~
3970 Note that X/Emacs 'eterm' buffers (opened with
3970 Note that X/Emacs 'eterm' buffers (opened with
3971 \family typewriter
3971 \family typewriter
3972 M-x\InsetSpace ~
3972 M-x\InsetSpace ~
3973 term
3973 term
3974 \family default
3974 \family default
3975 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3975 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3976 \family typewriter
3976 \family typewriter
3977 M-x\InsetSpace ~
3977 M-x\InsetSpace ~
3978 shell
3978 shell
3979 \family default
3979 \family default
3980 and
3980 and
3981 \family typewriter
3981 \family typewriter
3982 C-c\InsetSpace ~
3982 C-c\InsetSpace ~
3983 !
3983 !
3984 \family default
3984 \family default
3985 ) buffers do not.
3985 ) buffers do not.
3986 \end_layout
3986 \end_layout
3987
3987
3988 \begin_layout List
3988 \begin_layout List
3989 \labelwidthstring 00.00.0000
3989 \labelwidthstring 00.00.0000
3990
3990
3991 \family typewriter
3991 \family typewriter
3992 \series bold
3992 \series bold
3993 -screen_length|sl\InsetSpace ~
3993 -screen_length|sl\InsetSpace ~
3994 <n>
3994 <n>
3995 \series default
3995 \series default
3996 :
3996 :
3997 \family default
3997 \family default
3998 number of lines of your screen.
3998 number of lines of your screen.
3999 This is used to control printing of very long strings.
3999 This is used to control printing of very long strings.
4000 Strings longer than this number of lines will be sent through a pager instead
4000 Strings longer than this number of lines will be sent through a pager instead
4001 of directly printed.
4001 of directly printed.
4002 \end_layout
4002 \end_layout
4003
4003
4004 \begin_layout List
4004 \begin_layout List
4005 \labelwidthstring 00.00.0000
4005 \labelwidthstring 00.00.0000
4006 \InsetSpace ~
4006 \InsetSpace ~
4007 The default value for this is 0, which means IPython will auto-detect your
4007 The default value for this is 0, which means IPython will auto-detect your
4008 screen size every time it needs to print certain potentially long strings
4008 screen size every time it needs to print certain potentially long strings
4009 (this doesn't change the behavior of the 'print' keyword, it's only triggered
4009 (this doesn't change the behavior of the 'print' keyword, it's only triggered
4010 internally).
4010 internally).
4011 If for some reason this isn't working well (it needs curses support), specify
4011 If for some reason this isn't working well (it needs curses support), specify
4012 it yourself.
4012 it yourself.
4013 Otherwise don't change the default.
4013 Otherwise don't change the default.
4014 \end_layout
4014 \end_layout
4015
4015
4016 \begin_layout List
4016 \begin_layout List
4017 \labelwidthstring 00.00.0000
4017 \labelwidthstring 00.00.0000
4018
4018
4019 \family typewriter
4019 \family typewriter
4020 \series bold
4020 \series bold
4021 -separate_in|si\InsetSpace ~
4021 -separate_in|si\InsetSpace ~
4022 <string>
4022 <string>
4023 \series default
4023 \series default
4024 :
4024 :
4025 \family default
4025 \family default
4026 separator before input prompts.
4026 separator before input prompts.
4027 Default: '
4027 Default: '
4028 \family typewriter
4028 \family typewriter
4029
4029
4030 \backslash
4030 \backslash
4031 n
4031 n
4032 \family default
4032 \family default
4033 '
4033 '
4034 \end_layout
4034 \end_layout
4035
4035
4036 \begin_layout List
4036 \begin_layout List
4037 \labelwidthstring 00.00.0000
4037 \labelwidthstring 00.00.0000
4038
4038
4039 \family typewriter
4039 \family typewriter
4040 \series bold
4040 \series bold
4041 -separate_out|so\InsetSpace ~
4041 -separate_out|so\InsetSpace ~
4042 <string>
4042 <string>
4043 \family default
4043 \family default
4044 \series default
4044 \series default
4045 : separator before output prompts.
4045 : separator before output prompts.
4046 Default: nothing.
4046 Default: nothing.
4047 \end_layout
4047 \end_layout
4048
4048
4049 \begin_layout List
4049 \begin_layout List
4050 \labelwidthstring 00.00.0000
4050 \labelwidthstring 00.00.0000
4051
4051
4052 \family typewriter
4052 \family typewriter
4053 \series bold
4053 \series bold
4054 -separate_out2|so2\InsetSpace ~
4054 -separate_out2|so2\InsetSpace ~
4055 <string>
4055 <string>
4056 \series default
4056 \series default
4057 :
4057 :
4058 \family default
4058 \family default
4059 separator after output prompts.
4059 separator after output prompts.
4060 Default: nothing.
4060 Default: nothing.
4061 \end_layout
4061 \end_layout
4062
4062
4063 \begin_layout List
4063 \begin_layout List
4064 \labelwidthstring 00.00.0000
4064 \labelwidthstring 00.00.0000
4065 \InsetSpace ~
4065 \InsetSpace ~
4066 For these three options, use the value 0 to specify no separator.
4066 For these three options, use the value 0 to specify no separator.
4067 \end_layout
4067 \end_layout
4068
4068
4069 \begin_layout List
4069 \begin_layout List
4070 \labelwidthstring 00.00.0000
4070 \labelwidthstring 00.00.0000
4071
4071
4072 \family typewriter
4072 \family typewriter
4073 \series bold
4073 \series bold
4074 -nosep
4074 -nosep
4075 \series default
4075 \series default
4076 :
4076 :
4077 \family default
4077 \family default
4078 shorthand for
4078 shorthand for
4079 \family typewriter
4079 \family typewriter
4080 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
4080 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
4081 \family default
4081 \family default
4082 .
4082 .
4083 Simply removes all input/output separators.
4083 Simply removes all input/output separators.
4084 \end_layout
4084 \end_layout
4085
4085
4086 \begin_layout List
4086 \begin_layout List
4087 \labelwidthstring 00.00.0000
4087 \labelwidthstring 00.00.0000
4088
4088
4089 \family typewriter
4089 \family typewriter
4090 \series bold
4090 \series bold
4091 -upgrade
4091 -upgrade
4092 \family default
4092 \family default
4093 \series default
4093 \series default
4094 : allows you to upgrade your
4094 : allows you to upgrade your
4095 \family typewriter
4095 \family typewriter
4096 IPYTHONDIR
4096 IPYTHONDIR
4097 \family default
4097 \family default
4098 configuration when you install a new version of IPython.
4098 configuration when you install a new version of IPython.
4099 Since new versions may include new command line options or example files,
4099 Since new versions may include new command line options or example files,
4100 this copies updated ipythonrc-type files.
4100 this copies updated ipythonrc-type files.
4101 However, it backs up (with a
4101 However, it backs up (with a
4102 \family typewriter
4102 \family typewriter
4103 .old
4103 .old
4104 \family default
4104 \family default
4105 extension) all files which it overwrites so that you can merge back any
4105 extension) all files which it overwrites so that you can merge back any
4106 customizations you might have in your personal files.
4106 customizations you might have in your personal files.
4107 \end_layout
4107 \end_layout
4108
4108
4109 \begin_layout List
4109 \begin_layout List
4110 \labelwidthstring 00.00.0000
4110 \labelwidthstring 00.00.0000
4111
4111
4112 \family typewriter
4112 \family typewriter
4113 \series bold
4113 \series bold
4114 -Version
4114 -Version
4115 \series default
4115 \series default
4116 :
4116 :
4117 \family default
4117 \family default
4118 print version information and exit.
4118 print version information and exit.
4119 \end_layout
4119 \end_layout
4120
4120
4121 \begin_layout List
4121 \begin_layout List
4122 \labelwidthstring 00.00.0000
4122 \labelwidthstring 00.00.0000
4123
4123
4124 \family typewriter
4124 \family typewriter
4125 \series bold
4125 \series bold
4126 -wxversion\InsetSpace ~
4126 -wxversion\InsetSpace ~
4127 <string>:
4127 <string>:
4128 \family default
4128 \family default
4129 \series default
4129 \series default
4130 Select a specific version of wxPython (used in conjunction with
4130 Select a specific version of wxPython (used in conjunction with
4131 \family typewriter
4131 \family typewriter
4132 -wthread
4132 -wthread
4133 \family default
4133 \family default
4134 ).
4134 ).
4135 Requires the wxversion module, part of recent wxPython distributions
4135 Requires the wxversion module, part of recent wxPython distributions
4136 \end_layout
4136 \end_layout
4137
4137
4138 \begin_layout List
4138 \begin_layout List
4139 \labelwidthstring 00.00.0000
4139 \labelwidthstring 00.00.0000
4140
4140
4141 \family typewriter
4141 \family typewriter
4142 \series bold
4142 \series bold
4143 -xmode\InsetSpace ~
4143 -xmode\InsetSpace ~
4144 <modename>
4144 <modename>
4145 \series default
4145 \series default
4146 :
4146 :
4147 \family default
4147 \family default
4148 Mode for exception reporting.
4148 Mode for exception reporting.
4149 \end_layout
4149 \end_layout
4150
4150
4151 \begin_layout List
4151 \begin_layout List
4152 \labelwidthstring 00.00.0000
4152 \labelwidthstring 00.00.0000
4153 \InsetSpace ~
4153 \InsetSpace ~
4154 Valid modes: Plain, Context and Verbose.
4154 Valid modes: Plain, Context and Verbose.
4155 \end_layout
4155 \end_layout
4156
4156
4157 \begin_layout List
4157 \begin_layout List
4158 \labelwidthstring 00.00.0000
4158 \labelwidthstring 00.00.0000
4159 \InsetSpace ~
4159 \InsetSpace ~
4160 Plain: similar to python's normal traceback printing.
4160 Plain: similar to python's normal traceback printing.
4161 \end_layout
4161 \end_layout
4162
4162
4163 \begin_layout List
4163 \begin_layout List
4164 \labelwidthstring 00.00.0000
4164 \labelwidthstring 00.00.0000
4165 \InsetSpace ~
4165 \InsetSpace ~
4166 Context: prints 5 lines of context source code around each line in the
4166 Context: prints 5 lines of context source code around each line in the
4167 traceback.
4167 traceback.
4168 \end_layout
4168 \end_layout
4169
4169
4170 \begin_layout List
4170 \begin_layout List
4171 \labelwidthstring 00.00.0000
4171 \labelwidthstring 00.00.0000
4172 \InsetSpace ~
4172 \InsetSpace ~
4173 Verbose: similar to Context, but additionally prints the variables currently
4173 Verbose: similar to Context, but additionally prints the variables currently
4174 visible where the exception happened (shortening their strings if too long).
4174 visible where the exception happened (shortening their strings if too long).
4175 This can potentially be very slow, if you happen to have a huge data structure
4175 This can potentially be very slow, if you happen to have a huge data structure
4176 whose string representation is complex to compute.
4176 whose string representation is complex to compute.
4177 Your computer may appear to freeze for a while with cpu usage at 100%.
4177 Your computer may appear to freeze for a while with cpu usage at 100%.
4178 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
4178 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
4179 it more than once).
4179 it more than once).
4180 \end_layout
4180 \end_layout
4181
4181
4182 \begin_layout Section
4182 \begin_layout Section
4183 Interactive use
4183 Interactive use
4184 \end_layout
4184 \end_layout
4185
4185
4186 \begin_layout Standard
4186 \begin_layout Standard
4187
4187
4188 \series bold
4188 \series bold
4189 Warning
4189 Warning
4190 \series default
4190 \series default
4191 : IPython relies on the existence of a global variable called
4191 : IPython relies on the existence of a global variable called
4192 \family typewriter
4192 \family typewriter
4193 __IP
4193 __IP
4194 \family default
4194 \family default
4195 which controls the shell itself.
4195 which controls the shell itself.
4196 If you redefine
4196 If you redefine
4197 \family typewriter
4197 \family typewriter
4198 __IP
4198 __IP
4199 \family default
4199 \family default
4200 to anything, bizarre behavior will quickly occur.
4200 to anything, bizarre behavior will quickly occur.
4201 \end_layout
4201 \end_layout
4202
4202
4203 \begin_layout Standard
4203 \begin_layout Standard
4204 Other than the above warning, IPython is meant to work as a drop-in replacement
4204 Other than the above warning, IPython is meant to work as a drop-in replacement
4205 for the standard interactive interpreter.
4205 for the standard interactive interpreter.
4206 As such, any code which is valid python should execute normally under IPython
4206 As such, any code which is valid python should execute normally under IPython
4207 (cases where this is not true should be reported as bugs).
4207 (cases where this is not true should be reported as bugs).
4208 It does, however, offer many features which are not available at a standard
4208 It does, however, offer many features which are not available at a standard
4209 python prompt.
4209 python prompt.
4210 What follows is a list of these.
4210 What follows is a list of these.
4211 \end_layout
4211 \end_layout
4212
4212
4213 \begin_layout Subsection
4213 \begin_layout Subsection
4214 Caution for Windows users
4214 Caution for Windows users
4215 \end_layout
4215 \end_layout
4216
4216
4217 \begin_layout Standard
4217 \begin_layout Standard
4218 Windows, unfortunately, uses the `
4218 Windows, unfortunately, uses the `
4219 \family typewriter
4219 \family typewriter
4220
4220
4221 \backslash
4221 \backslash
4222
4222
4223 \family default
4223 \family default
4224 ' character as a path separator.
4224 ' character as a path separator.
4225 This is a terrible choice, because `
4225 This is a terrible choice, because `
4226 \family typewriter
4226 \family typewriter
4227
4227
4228 \backslash
4228 \backslash
4229
4229
4230 \family default
4230 \family default
4231 ' also represents the escape character in most modern programming languages,
4231 ' also represents the escape character in most modern programming languages,
4232 including Python.
4232 including Python.
4233 For this reason, issuing many of the commands discussed below (especially
4233 For this reason, issuing many of the commands discussed below (especially
4234 magics which affect the filesystem) with `
4234 magics which affect the filesystem) with `
4235 \family typewriter
4235 \family typewriter
4236
4236
4237 \backslash
4237 \backslash
4238
4238
4239 \family default
4239 \family default
4240 ' in them will cause strange errors.
4240 ' in them will cause strange errors.
4241 \end_layout
4241 \end_layout
4242
4242
4243 \begin_layout Standard
4243 \begin_layout Standard
4244 A partial solution is to use instead the `
4244 A partial solution is to use instead the `
4245 \family typewriter
4245 \family typewriter
4246 /
4246 /
4247 \family default
4247 \family default
4248 ' character as a path separator, which Windows recognizes in
4248 ' character as a path separator, which Windows recognizes in
4249 \emph on
4249 \emph on
4250 most
4250 most
4251 \emph default
4251 \emph default
4252 situations.
4252 situations.
4253 However, in Windows commands `
4253 However, in Windows commands `
4254 \family typewriter
4254 \family typewriter
4255 /
4255 /
4256 \family default
4256 \family default
4257 ' flags options, so you can not use it for the root directory.
4257 ' flags options, so you can not use it for the root directory.
4258 This means that paths beginning at the root must be typed in a contrived
4258 This means that paths beginning at the root must be typed in a contrived
4259 manner like:
4259 manner like:
4260 \newline
4260 \newline
4261
4261
4262 \family typewriter
4262 \family typewriter
4263 %copy
4263 %copy
4264 \backslash
4264 \backslash
4265 opt/foo/bar.txt
4265 opt/foo/bar.txt
4266 \backslash
4266 \backslash
4267 tmp
4267 tmp
4268 \end_layout
4268 \end_layout
4269
4269
4270 \begin_layout Standard
4270 \begin_layout Standard
4271 There is no sensible thing IPython can do to truly work around this flaw
4271 There is no sensible thing IPython can do to truly work around this flaw
4272 in Windows
4272 in Windows
4273 \begin_inset Foot
4273 \begin_inset Foot
4274 status collapsed
4274 status collapsed
4275
4275
4276 \begin_layout Standard
4276 \begin_layout Standard
4277 If anyone comes up with a
4277 If anyone comes up with a
4278 \emph on
4278 \emph on
4279 clean
4279 clean
4280 \emph default
4280 \emph default
4281 solution which works consistently and does not negatively impact other
4281 solution which works consistently and does not negatively impact other
4282 platforms at all, I'll gladly accept a patch.
4282 platforms at all, I'll gladly accept a patch.
4283 \end_layout
4283 \end_layout
4284
4284
4285 \end_inset
4285 \end_inset
4286
4286
4287 .
4287 .
4288 \end_layout
4288 \end_layout
4289
4289
4290 \begin_layout Subsection
4290 \begin_layout Subsection
4291 \begin_inset LatexCommand \label{sec:magic}
4291 \begin_inset LatexCommand \label{sec:magic}
4292
4292
4293 \end_inset
4293 \end_inset
4294
4294
4295 Magic command system
4295 Magic command system
4296 \end_layout
4296 \end_layout
4297
4297
4298 \begin_layout Standard
4298 \begin_layout Standard
4299 IPython will treat any line whose first character is a
4299 IPython will treat any line whose first character is a
4300 \family typewriter
4300 \family typewriter
4301 %
4301 %
4302 \family default
4302 \family default
4303 as a special call to a 'magic' function.
4303 as a special call to a 'magic' function.
4304 These allow you to control the behavior of IPython itself, plus a lot of
4304 These allow you to control the behavior of IPython itself, plus a lot of
4305 system-type features.
4305 system-type features.
4306 They are all prefixed with a
4306 They are all prefixed with a
4307 \family typewriter
4307 \family typewriter
4308 %
4308 %
4309 \family default
4309 \family default
4310 character, but parameters are given without parentheses or quotes.
4310 character, but parameters are given without parentheses or quotes.
4311 \end_layout
4311 \end_layout
4312
4312
4313 \begin_layout Standard
4313 \begin_layout Standard
4314 Example: typing
4314 Example: typing
4315 \family typewriter
4315 \family typewriter
4316 '%cd mydir'
4316 '%cd mydir'
4317 \family default
4317 \family default
4318 (without the quotes) changes you working directory to
4318 (without the quotes) changes you working directory to
4319 \family typewriter
4319 \family typewriter
4320 'mydir'
4320 'mydir'
4321 \family default
4321 \family default
4322 , if it exists.
4322 , if it exists.
4323 \end_layout
4323 \end_layout
4324
4324
4325 \begin_layout Standard
4325 \begin_layout Standard
4326 If you have 'automagic' enabled (in your
4326 If you have 'automagic' enabled (in your
4327 \family typewriter
4327 \family typewriter
4328 ipythonrc
4328 ipythonrc
4329 \family default
4329 \family default
4330 file, via the command line option
4330 file, via the command line option
4331 \family typewriter
4331 \family typewriter
4332 -automagic
4332 -automagic
4333 \family default
4333 \family default
4334 or with the
4334 or with the
4335 \family typewriter
4335 \family typewriter
4336 %automagic
4336 %automagic
4337 \family default
4337 \family default
4338 function), you don't need to type in the
4338 function), you don't need to type in the
4339 \family typewriter
4339 \family typewriter
4340 %
4340 %
4341 \family default
4341 \family default
4342 explicitly.
4342 explicitly.
4343 IPython will scan its internal list of magic functions and call one if
4343 IPython will scan its internal list of magic functions and call one if
4344 it exists.
4344 it exists.
4345 With automagic on you can then just type '
4345 With automagic on you can then just type '
4346 \family typewriter
4346 \family typewriter
4347 cd mydir
4347 cd mydir
4348 \family default
4348 \family default
4349 ' to go to directory '
4349 ' to go to directory '
4350 \family typewriter
4350 \family typewriter
4351 mydir
4351 mydir
4352 \family default
4352 \family default
4353 '.
4353 '.
4354 The automagic system has the lowest possible precedence in name searches,
4354 The automagic system has the lowest possible precedence in name searches,
4355 so defining an identifier with the same name as an existing magic function
4355 so defining an identifier with the same name as an existing magic function
4356 will shadow it for automagic use.
4356 will shadow it for automagic use.
4357 You can still access the shadowed magic function by explicitly using the
4357 You can still access the shadowed magic function by explicitly using the
4358
4358
4359 \family typewriter
4359 \family typewriter
4360 %
4360 %
4361 \family default
4361 \family default
4362 character at the beginning of the line.
4362 character at the beginning of the line.
4363 \end_layout
4363 \end_layout
4364
4364
4365 \begin_layout Standard
4365 \begin_layout Standard
4366 An example (with automagic on) should clarify all this:
4366 An example (with automagic on) should clarify all this:
4367 \end_layout
4367 \end_layout
4368
4368
4369 \begin_layout LyX-Code
4369 \begin_layout LyX-Code
4370 In [1]: cd ipython # %cd is called by automagic
4370 In [1]: cd ipython # %cd is called by automagic
4371 \end_layout
4371 \end_layout
4372
4372
4373 \begin_layout LyX-Code
4373 \begin_layout LyX-Code
4374 /home/fperez/ipython
4374 /home/fperez/ipython
4375 \end_layout
4375 \end_layout
4376
4376
4377 \begin_layout LyX-Code
4377 \begin_layout LyX-Code
4378 In [2]: cd=1 # now cd is just a variable
4378 In [2]: cd=1 # now cd is just a variable
4379 \end_layout
4379 \end_layout
4380
4380
4381 \begin_layout LyX-Code
4381 \begin_layout LyX-Code
4382 In [3]: cd ..
4382 In [3]: cd ..
4383 # and doesn't work as a function anymore
4383 # and doesn't work as a function anymore
4384 \end_layout
4384 \end_layout
4385
4385
4386 \begin_layout LyX-Code
4386 \begin_layout LyX-Code
4387 ------------------------------------------------------------
4387 ------------------------------------------------------------
4388 \end_layout
4388 \end_layout
4389
4389
4390 \begin_layout LyX-Code
4390 \begin_layout LyX-Code
4391 File "<console>", line 1
4391 File "<console>", line 1
4392 \end_layout
4392 \end_layout
4393
4393
4394 \begin_layout LyX-Code
4394 \begin_layout LyX-Code
4395 cd ..
4395 cd ..
4396 \end_layout
4396 \end_layout
4397
4397
4398 \begin_layout LyX-Code
4398 \begin_layout LyX-Code
4399 ^
4399 ^
4400 \end_layout
4400 \end_layout
4401
4401
4402 \begin_layout LyX-Code
4402 \begin_layout LyX-Code
4403 SyntaxError: invalid syntax
4403 SyntaxError: invalid syntax
4404 \end_layout
4404 \end_layout
4405
4405
4406 \begin_layout LyX-Code
4406 \begin_layout LyX-Code
4407
4407
4408 \end_layout
4408 \end_layout
4409
4409
4410 \begin_layout LyX-Code
4410 \begin_layout LyX-Code
4411 In [4]: %cd ..
4411 In [4]: %cd ..
4412 # but %cd always works
4412 # but %cd always works
4413 \end_layout
4413 \end_layout
4414
4414
4415 \begin_layout LyX-Code
4415 \begin_layout LyX-Code
4416 /home/fperez
4416 /home/fperez
4417 \end_layout
4417 \end_layout
4418
4418
4419 \begin_layout LyX-Code
4419 \begin_layout LyX-Code
4420 In [5]: del cd # if you remove the cd variable
4420 In [5]: del cd # if you remove the cd variable
4421 \end_layout
4421 \end_layout
4422
4422
4423 \begin_layout LyX-Code
4423 \begin_layout LyX-Code
4424 In [6]: cd ipython # automagic can work again
4424 In [6]: cd ipython # automagic can work again
4425 \end_layout
4425 \end_layout
4426
4426
4427 \begin_layout LyX-Code
4427 \begin_layout LyX-Code
4428 /home/fperez/ipython
4428 /home/fperez/ipython
4429 \end_layout
4429 \end_layout
4430
4430
4431 \begin_layout Standard
4431 \begin_layout Standard
4432 You can define your own magic functions to extend the system.
4432 You can define your own magic functions to extend the system.
4433 The following example defines a new magic command,
4433 The following example defines a new magic command,
4434 \family typewriter
4434 \family typewriter
4435 %impall
4435 %impall
4436 \family default
4436 \family default
4437 :
4437 :
4438 \end_layout
4438 \end_layout
4439
4439
4440 \begin_layout LyX-Code
4440 \begin_layout LyX-Code
4441 import IPython.ipapi
4441 import IPython.ipapi
4442 \end_layout
4442 \end_layout
4443
4443
4444 \begin_layout LyX-Code
4444 \begin_layout LyX-Code
4445 ip = IPython.ipapi.get()
4445 ip = IPython.ipapi.get()
4446 \end_layout
4446 \end_layout
4447
4447
4448 \begin_layout LyX-Code
4448 \begin_layout LyX-Code
4449
4449
4450 \end_layout
4450 \end_layout
4451
4451
4452 \begin_layout LyX-Code
4452 \begin_layout LyX-Code
4453 def doimp(self, arg):
4453 def doimp(self, arg):
4454 \end_layout
4454 \end_layout
4455
4455
4456 \begin_layout LyX-Code
4456 \begin_layout LyX-Code
4457 ip = self.api
4457 ip = self.api
4458 \end_layout
4458 \end_layout
4459
4459
4460 \begin_layout LyX-Code
4460 \begin_layout LyX-Code
4461 ip.ex("import %s; reload(%s); from %s import *" % (
4461 ip.ex("import %s; reload(%s); from %s import *" % (
4462 \end_layout
4462 \end_layout
4463
4463
4464 \begin_layout LyX-Code
4464 \begin_layout LyX-Code
4465 arg,arg,arg)
4465 arg,arg,arg)
4466 \end_layout
4466 \end_layout
4467
4467
4468 \begin_layout LyX-Code
4468 \begin_layout LyX-Code
4469 )
4469 )
4470 \end_layout
4470 \end_layout
4471
4471
4472 \begin_layout LyX-Code
4472 \begin_layout LyX-Code
4473 ip.expose_magic('impall', doimp)
4473 ip.expose_magic('impall', doimp)
4474 \end_layout
4474 \end_layout
4475
4475
4476 \begin_layout Standard
4476 \begin_layout Standard
4477 You can also define your own aliased names for magic functions.
4477 You can also define your own aliased names for magic functions.
4478 In your
4478 In your
4479 \family typewriter
4479 \family typewriter
4480 ipythonrc
4480 ipythonrc
4481 \family default
4481 \family default
4482 file, placing a line like:
4482 file, placing a line like:
4483 \end_layout
4483 \end_layout
4484
4484
4485 \begin_layout Standard
4485 \begin_layout Standard
4486
4486
4487 \family typewriter
4487 \family typewriter
4488 execute __IP.magic_cl = __IP.magic_clear
4488 execute __IP.magic_cl = __IP.magic_clear
4489 \end_layout
4489 \end_layout
4490
4490
4491 \begin_layout Standard
4491 \begin_layout Standard
4492 will define
4492 will define
4493 \family typewriter
4493 \family typewriter
4494 %cl
4494 %cl
4495 \family default
4495 \family default
4496 as a new name for
4496 as a new name for
4497 \family typewriter
4497 \family typewriter
4498 %clear
4498 %clear
4499 \family default
4499 \family default
4500 .
4500 .
4501 \end_layout
4501 \end_layout
4502
4502
4503 \begin_layout Standard
4503 \begin_layout Standard
4504 Type
4504 Type
4505 \family typewriter
4505 \family typewriter
4506 %magic
4506 %magic
4507 \family default
4507 \family default
4508 for more information, including a list of all available magic functions
4508 for more information, including a list of all available magic functions
4509 at any time and their docstrings.
4509 at any time and their docstrings.
4510 You can also type
4510 You can also type
4511 \family typewriter
4511 \family typewriter
4512 %magic_function_name?
4512 %magic_function_name?
4513 \family default
4513 \family default
4514 (see sec.
4514 (see sec.
4515
4515
4516 \begin_inset LatexCommand \ref{sec:dyn-object-info}
4516 \begin_inset LatexCommand \ref{sec:dyn-object-info}
4517
4517
4518 \end_inset
4518 \end_inset
4519
4519
4520 for information on the
4520 for information on the
4521 \family typewriter
4521 \family typewriter
4522 '?'
4522 '?'
4523 \family default
4523 \family default
4524 system) to get information about any particular magic function you are
4524 system) to get information about any particular magic function you are
4525 interested in.
4525 interested in.
4526 \end_layout
4526 \end_layout
4527
4527
4528 \begin_layout Subsubsection
4528 \begin_layout Subsubsection
4529 Magic commands
4529 Magic commands
4530 \end_layout
4530 \end_layout
4531
4531
4532 \begin_layout Standard
4532 \begin_layout Standard
4533 The rest of this section is automatically generated for each release from
4533 The rest of this section is automatically generated for each release from
4534 the docstrings in the IPython code.
4534 the docstrings in the IPython code.
4535 Therefore the formatting is somewhat minimal, but this method has the advantage
4535 Therefore the formatting is somewhat minimal, but this method has the advantage
4536 of having information always in sync with the code.
4536 of having information always in sync with the code.
4537 \end_layout
4537 \end_layout
4538
4538
4539 \begin_layout Standard
4539 \begin_layout Standard
4540 A list of all the magic commands available in IPython's
4540 A list of all the magic commands available in IPython's
4541 \emph on
4541 \emph on
4542 default
4542 default
4543 \emph default
4543 \emph default
4544 installation follows.
4544 installation follows.
4545 This is similar to what you'll see by simply typing
4545 This is similar to what you'll see by simply typing
4546 \family typewriter
4546 \family typewriter
4547 %magic
4547 %magic
4548 \family default
4548 \family default
4549 at the prompt, but that will also give you information about magic commands
4549 at the prompt, but that will also give you information about magic commands
4550 you may have added as part of your personal customizations.
4550 you may have added as part of your personal customizations.
4551 \end_layout
4551 \end_layout
4552
4552
4553 \begin_layout Standard
4553 \begin_layout Standard
4554 \begin_inset Include \input{magic.tex}
4554 \begin_inset Include \input{magic.tex}
4555 preview false
4555 preview false
4556
4556
4557 \end_inset
4557 \end_inset
4558
4558
4559
4559
4560 \end_layout
4560 \end_layout
4561
4561
4562 \begin_layout Subsection
4562 \begin_layout Subsection
4563 Access to the standard Python help
4563 Access to the standard Python help
4564 \end_layout
4564 \end_layout
4565
4565
4566 \begin_layout Standard
4566 \begin_layout Standard
4567 As of Python 2.1, a help system is available with access to object docstrings
4567 As of Python 2.1, a help system is available with access to object docstrings
4568 and the Python manuals.
4568 and the Python manuals.
4569 Simply type
4569 Simply type
4570 \family typewriter
4570 \family typewriter
4571 'help'
4571 'help'
4572 \family default
4572 \family default
4573 (no quotes) to access it.
4573 (no quotes) to access it.
4574 You can also type
4574 You can also type
4575 \family typewriter
4575 \family typewriter
4576 help(object)
4576 help(object)
4577 \family default
4577 \family default
4578 to obtain information about a given object, and
4578 to obtain information about a given object, and
4579 \family typewriter
4579 \family typewriter
4580 help('keyword')
4580 help('keyword')
4581 \family default
4581 \family default
4582 for information on a keyword.
4582 for information on a keyword.
4583 As noted in sec.
4583 As noted in sec.
4584
4584
4585 \begin_inset LatexCommand \ref{sec:help-access}
4585 \begin_inset LatexCommand \ref{sec:help-access}
4586
4586
4587 \end_inset
4587 \end_inset
4588
4588
4589 , you need to properly configure your environment variable
4589 , you need to properly configure your environment variable
4590 \family typewriter
4590 \family typewriter
4591 PYTHONDOCS
4591 PYTHONDOCS
4592 \family default
4592 \family default
4593 for this feature to work correctly.
4593 for this feature to work correctly.
4594 \end_layout
4594 \end_layout
4595
4595
4596 \begin_layout Subsection
4596 \begin_layout Subsection
4597 \begin_inset LatexCommand \label{sec:dyn-object-info}
4597 \begin_inset LatexCommand \label{sec:dyn-object-info}
4598
4598
4599 \end_inset
4599 \end_inset
4600
4600
4601 Dynamic object information
4601 Dynamic object information
4602 \end_layout
4602 \end_layout
4603
4603
4604 \begin_layout Standard
4604 \begin_layout Standard
4605 Typing
4605 Typing
4606 \family typewriter
4606 \family typewriter
4607 ?word
4607 ?word
4608 \family default
4608 \family default
4609 or
4609 or
4610 \family typewriter
4610 \family typewriter
4611 word?
4611 word?
4612 \family default
4612 \family default
4613 prints detailed information about an object.
4613 prints detailed information about an object.
4614 If certain strings in the object are too long (docstrings, code, etc.) they
4614 If certain strings in the object are too long (docstrings, code, etc.) they
4615 get snipped in the center for brevity.
4615 get snipped in the center for brevity.
4616 This system gives access variable types and values, full source code for
4616 This system gives access variable types and values, full source code for
4617 any object (if available), function prototypes and other useful information.
4617 any object (if available), function prototypes and other useful information.
4618 \end_layout
4618 \end_layout
4619
4619
4620 \begin_layout Standard
4620 \begin_layout Standard
4621 Typing
4621 Typing
4622 \family typewriter
4622 \family typewriter
4623 ??word
4623 ??word
4624 \family default
4624 \family default
4625 or
4625 or
4626 \family typewriter
4626 \family typewriter
4627 word??
4627 word??
4628 \family default
4628 \family default
4629 gives access to the full information without snipping long strings.
4629 gives access to the full information without snipping long strings.
4630 Long strings are sent to the screen through the
4630 Long strings are sent to the screen through the
4631 \family typewriter
4631 \family typewriter
4632 less
4632 less
4633 \family default
4633 \family default
4634 pager if longer than the screen and printed otherwise.
4634 pager if longer than the screen and printed otherwise.
4635 On systems lacking the
4635 On systems lacking the
4636 \family typewriter
4636 \family typewriter
4637 less
4637 less
4638 \family default
4638 \family default
4639 command, IPython uses a very basic internal pager.
4639 command, IPython uses a very basic internal pager.
4640 \end_layout
4640 \end_layout
4641
4641
4642 \begin_layout Standard
4642 \begin_layout Standard
4643 The following magic functions are particularly useful for gathering information
4643 The following magic functions are particularly useful for gathering information
4644 about your working environment.
4644 about your working environment.
4645 You can get more details by typing
4645 You can get more details by typing
4646 \family typewriter
4646 \family typewriter
4647 %magic
4647 %magic
4648 \family default
4648 \family default
4649 or querying them individually (use
4649 or querying them individually (use
4650 \family typewriter
4650 \family typewriter
4651 %function_name?
4651 %function_name?
4652 \family default
4652 \family default
4653 with or without the
4653 with or without the
4654 \family typewriter
4654 \family typewriter
4655 %
4655 %
4656 \family default
4656 \family default
4657 ), this is just a summary:
4657 ), this is just a summary:
4658 \end_layout
4658 \end_layout
4659
4659
4660 \begin_layout List
4660 \begin_layout List
4661 \labelwidthstring 00.00.0000
4661 \labelwidthstring 00.00.0000
4662
4662
4663 \family typewriter
4663 \family typewriter
4664 \series bold
4664 \series bold
4665 %pdoc\InsetSpace ~
4665 %pdoc\InsetSpace ~
4666 <object>
4666 <object>
4667 \family default
4667 \family default
4668 \series default
4668 \series default
4669 : Print (or run through a pager if too long) the docstring for an object.
4669 : Print (or run through a pager if too long) the docstring for an object.
4670 If the given object is a class, it will print both the class and the constructo
4670 If the given object is a class, it will print both the class and the constructo
4671 r docstrings.
4671 r docstrings.
4672 \end_layout
4672 \end_layout
4673
4673
4674 \begin_layout List
4674 \begin_layout List
4675 \labelwidthstring 00.00.0000
4675 \labelwidthstring 00.00.0000
4676
4676
4677 \family typewriter
4677 \family typewriter
4678 \series bold
4678 \series bold
4679 %pdef\InsetSpace ~
4679 %pdef\InsetSpace ~
4680 <object>
4680 <object>
4681 \family default
4681 \family default
4682 \series default
4682 \series default
4683 : Print the definition header for any callable object.
4683 : Print the definition header for any callable object.
4684 If the object is a class, print the constructor information.
4684 If the object is a class, print the constructor information.
4685 \end_layout
4685 \end_layout
4686
4686
4687 \begin_layout List
4687 \begin_layout List
4688 \labelwidthstring 00.00.0000
4688 \labelwidthstring 00.00.0000
4689
4689
4690 \family typewriter
4690 \family typewriter
4691 \series bold
4691 \series bold
4692 %psource\InsetSpace ~
4692 %psource\InsetSpace ~
4693 <object>
4693 <object>
4694 \family default
4694 \family default
4695 \series default
4695 \series default
4696 : Print (or run through a pager if too long) the source code for an object.
4696 : Print (or run through a pager if too long) the source code for an object.
4697 \end_layout
4697 \end_layout
4698
4698
4699 \begin_layout List
4699 \begin_layout List
4700 \labelwidthstring 00.00.0000
4700 \labelwidthstring 00.00.0000
4701
4701
4702 \family typewriter
4702 \family typewriter
4703 \series bold
4703 \series bold
4704 %pfile\InsetSpace ~
4704 %pfile\InsetSpace ~
4705 <object>
4705 <object>
4706 \family default
4706 \family default
4707 \series default
4707 \series default
4708 : Show the entire source file where an object was defined via a pager, opening
4708 : Show the entire source file where an object was defined via a pager, opening
4709 it at the line where the object definition begins.
4709 it at the line where the object definition begins.
4710 \end_layout
4710 \end_layout
4711
4711
4712 \begin_layout List
4712 \begin_layout List
4713 \labelwidthstring 00.00.0000
4713 \labelwidthstring 00.00.0000
4714
4714
4715 \family typewriter
4715 \family typewriter
4716 \series bold
4716 \series bold
4717 %who/%whos
4717 %who/%whos
4718 \family default
4718 \family default
4719 \series default
4719 \series default
4720 : These functions give information about identifiers you have defined interactiv
4720 : These functions give information about identifiers you have defined interactiv
4721 ely (not things you loaded or defined in your configuration files).
4721 ely (not things you loaded or defined in your configuration files).
4722
4722
4723 \family typewriter
4723 \family typewriter
4724 %who
4724 %who
4725 \family default
4725 \family default
4726 just prints a list of identifiers and
4726 just prints a list of identifiers and
4727 \family typewriter
4727 \family typewriter
4728 %whos
4728 %whos
4729 \family default
4729 \family default
4730 prints a table with some basic details about each identifier.
4730 prints a table with some basic details about each identifier.
4731 \end_layout
4731 \end_layout
4732
4732
4733 \begin_layout Standard
4733 \begin_layout Standard
4734 Note that the dynamic object information functions (
4734 Note that the dynamic object information functions (
4735 \family typewriter
4735 \family typewriter
4736 ?/??, %pdoc, %pfile, %pdef, %psource
4736 ?/??, %pdoc, %pfile, %pdef, %psource
4737 \family default
4737 \family default
4738 ) give you access to documentation even on things which are not really defined
4738 ) give you access to documentation even on things which are not really defined
4739 as separate identifiers.
4739 as separate identifiers.
4740 Try for example typing
4740 Try for example typing
4741 \family typewriter
4741 \family typewriter
4742 {}.get?
4742 {}.get?
4743 \family default
4743 \family default
4744 or after doing
4744 or after doing
4745 \family typewriter
4745 \family typewriter
4746 import os
4746 import os
4747 \family default
4747 \family default
4748 , type
4748 , type
4749 \family typewriter
4749 \family typewriter
4750 os.path.abspath??
4750 os.path.abspath??
4751 \family default
4751 \family default
4752 .
4752 .
4753 \end_layout
4753 \end_layout
4754
4754
4755 \begin_layout Subsection
4755 \begin_layout Subsection
4756 \begin_inset LatexCommand \label{sec:readline}
4756 \begin_inset LatexCommand \label{sec:readline}
4757
4757
4758 \end_inset
4758 \end_inset
4759
4759
4760 Readline-based features
4760 Readline-based features
4761 \end_layout
4761 \end_layout
4762
4762
4763 \begin_layout Standard
4763 \begin_layout Standard
4764 These features require the GNU readline library, so they won't work if your
4764 These features require the GNU readline library, so they won't work if your
4765 Python installation lacks readline support.
4765 Python installation lacks readline support.
4766 We will first describe the default behavior IPython uses, and then how
4766 We will first describe the default behavior IPython uses, and then how
4767 to change it to suit your preferences.
4767 to change it to suit your preferences.
4768 \end_layout
4768 \end_layout
4769
4769
4770 \begin_layout Subsubsection
4770 \begin_layout Subsubsection
4771 Command line completion
4771 Command line completion
4772 \end_layout
4772 \end_layout
4773
4773
4774 \begin_layout Standard
4774 \begin_layout Standard
4775 At any time, hitting TAB will complete any available python commands or
4775 At any time, hitting TAB will complete any available python commands or
4776 variable names, and show you a list of the possible completions if there's
4776 variable names, and show you a list of the possible completions if there's
4777 no unambiguous one.
4777 no unambiguous one.
4778 It will also complete filenames in the current directory if no python names
4778 It will also complete filenames in the current directory if no python names
4779 match what you've typed so far.
4779 match what you've typed so far.
4780 \end_layout
4780 \end_layout
4781
4781
4782 \begin_layout Subsubsection
4782 \begin_layout Subsubsection
4783 Search command history
4783 Search command history
4784 \end_layout
4784 \end_layout
4785
4785
4786 \begin_layout Standard
4786 \begin_layout Standard
4787 IPython provides two ways for searching through previous input and thus
4787 IPython provides two ways for searching through previous input and thus
4788 reduce the need for repetitive typing:
4788 reduce the need for repetitive typing:
4789 \end_layout
4789 \end_layout
4790
4790
4791 \begin_layout Enumerate
4791 \begin_layout Enumerate
4792 Start typing, and then use
4792 Start typing, and then use
4793 \family typewriter
4793 \family typewriter
4794 Ctrl-p
4794 Ctrl-p
4795 \family default
4795 \family default
4796 (previous,up) and
4796 (previous,up) and
4797 \family typewriter
4797 \family typewriter
4798 Ctrl-n
4798 Ctrl-n
4799 \family default
4799 \family default
4800 (next,down) to search through only the history items that match what you've
4800 (next,down) to search through only the history items that match what you've
4801 typed so far.
4801 typed so far.
4802 If you use
4802 If you use
4803 \family typewriter
4803 \family typewriter
4804 Ctrl-p/Ctrl-n
4804 Ctrl-p/Ctrl-n
4805 \family default
4805 \family default
4806 at a blank prompt, they just behave like normal arrow keys.
4806 at a blank prompt, they just behave like normal arrow keys.
4807 \end_layout
4807 \end_layout
4808
4808
4809 \begin_layout Enumerate
4809 \begin_layout Enumerate
4810 Hit
4810 Hit
4811 \family typewriter
4811 \family typewriter
4812 Ctrl-r
4812 Ctrl-r
4813 \family default
4813 \family default
4814 : opens a search prompt.
4814 : opens a search prompt.
4815 Begin typing and the system searches your history for lines that contain
4815 Begin typing and the system searches your history for lines that contain
4816 what you've typed so far, completing as much as it can.
4816 what you've typed so far, completing as much as it can.
4817 \end_layout
4817 \end_layout
4818
4818
4819 \begin_layout Subsubsection
4819 \begin_layout Subsubsection
4820 Persistent command history across sessions
4820 Persistent command history across sessions
4821 \end_layout
4821 \end_layout
4822
4822
4823 \begin_layout Standard
4823 \begin_layout Standard
4824 IPython will save your input history when it leaves and reload it next time
4824 IPython will save your input history when it leaves and reload it next time
4825 you restart it.
4825 you restart it.
4826 By default, the history file is named
4826 By default, the history file is named
4827 \family typewriter
4827 \family typewriter
4828 $IPYTHONDIR/history
4828 $IPYTHONDIR/history
4829 \family default
4829 \family default
4830 , but if you've loaded a named profile, '
4830 , but if you've loaded a named profile, '
4831 \family typewriter
4831 \family typewriter
4832 -PROFILE_NAME
4832 -PROFILE_NAME
4833 \family default
4833 \family default
4834 ' is appended to the name.
4834 ' is appended to the name.
4835 This allows you to keep separate histories related to various tasks: commands
4835 This allows you to keep separate histories related to various tasks: commands
4836 related to numerical work will not be clobbered by a system shell history,
4836 related to numerical work will not be clobbered by a system shell history,
4837 for example.
4837 for example.
4838 \end_layout
4838 \end_layout
4839
4839
4840 \begin_layout Subsubsection
4840 \begin_layout Subsubsection
4841 Autoindent
4841 Autoindent
4842 \end_layout
4842 \end_layout
4843
4843
4844 \begin_layout Standard
4844 \begin_layout Standard
4845 IPython can recognize lines ending in ':' and indent the next line, while
4845 IPython can recognize lines ending in ':' and indent the next line, while
4846 also un-indenting automatically after 'raise' or 'return'.
4846 also un-indenting automatically after 'raise' or 'return'.
4847
4847
4848 \end_layout
4848 \end_layout
4849
4849
4850 \begin_layout Standard
4850 \begin_layout Standard
4851 This feature uses the readline library, so it will honor your
4851 This feature uses the readline library, so it will honor your
4852 \family typewriter
4852 \family typewriter
4853 ~/.inputrc
4853 ~/.inputrc
4854 \family default
4854 \family default
4855 configuration (or whatever file your
4855 configuration (or whatever file your
4856 \family typewriter
4856 \family typewriter
4857 INPUTRC
4857 INPUTRC
4858 \family default
4858 \family default
4859 variable points to).
4859 variable points to).
4860 Adding the following lines to your
4860 Adding the following lines to your
4861 \family typewriter
4861 \family typewriter
4862 .inputrc
4862 .inputrc
4863 \family default
4863 \family default
4864 file can make indenting/unindenting more convenient (
4864 file can make indenting/unindenting more convenient (
4865 \family typewriter
4865 \family typewriter
4866 M-i
4866 M-i
4867 \family default
4867 \family default
4868 indents,
4868 indents,
4869 \family typewriter
4869 \family typewriter
4870 M-u
4870 M-u
4871 \family default
4871 \family default
4872 unindents):
4872 unindents):
4873 \end_layout
4873 \end_layout
4874
4874
4875 \begin_layout Standard
4875 \begin_layout Standard
4876
4876
4877 \family typewriter
4877 \family typewriter
4878 $if Python
4878 $if Python
4879 \newline
4879 \newline
4880 "
4880 "
4881 \backslash
4881 \backslash
4882 M-i": "\InsetSpace ~
4882 M-i": "\InsetSpace ~
4883 \InsetSpace ~
4883 \InsetSpace ~
4884 \InsetSpace ~
4884 \InsetSpace ~
4885 \InsetSpace ~
4885 \InsetSpace ~
4886 "
4886 "
4887 \newline
4887 \newline
4888 "
4888 "
4889 \backslash
4889 \backslash
4890 M-u": "
4890 M-u": "
4891 \backslash
4891 \backslash
4892 d
4892 d
4893 \backslash
4893 \backslash
4894 d
4894 d
4895 \backslash
4895 \backslash
4896 d
4896 d
4897 \backslash
4897 \backslash
4898 d"
4898 d"
4899 \newline
4899 \newline
4900 $endif
4900 $endif
4901 \end_layout
4901 \end_layout
4902
4902
4903 \begin_layout Standard
4903 \begin_layout Standard
4904 Note that there are 4 spaces between the quote marks after
4904 Note that there are 4 spaces between the quote marks after
4905 \family typewriter
4905 \family typewriter
4906 "M-i"
4906 "M-i"
4907 \family default
4907 \family default
4908 above.
4908 above.
4909 \end_layout
4909 \end_layout
4910
4910
4911 \begin_layout Standard
4911 \begin_layout Standard
4912
4912
4913 \series bold
4913 \series bold
4914 Warning:
4914 Warning:
4915 \series default
4915 \series default
4916 this feature is ON by default, but it can cause problems with the pasting
4916 this feature is ON by default, but it can cause problems with the pasting
4917 of multi-line indented code (the pasted code gets re-indented on each line).
4917 of multi-line indented code (the pasted code gets re-indented on each line).
4918 A magic function
4918 A magic function
4919 \family typewriter
4919 \family typewriter
4920 %autoindent
4920 %autoindent
4921 \family default
4921 \family default
4922 allows you to toggle it on/off at runtime.
4922 allows you to toggle it on/off at runtime.
4923 You can also disable it permanently on in your
4923 You can also disable it permanently on in your
4924 \family typewriter
4924 \family typewriter
4925 ipythonrc
4925 ipythonrc
4926 \family default
4926 \family default
4927 file (set
4927 file (set
4928 \family typewriter
4928 \family typewriter
4929 autoindent 0
4929 autoindent 0
4930 \family default
4930 \family default
4931 ).
4931 ).
4932 \end_layout
4932 \end_layout
4933
4933
4934 \begin_layout Subsubsection
4934 \begin_layout Subsubsection
4935 Customizing readline behavior
4935 Customizing readline behavior
4936 \end_layout
4936 \end_layout
4937
4937
4938 \begin_layout Standard
4938 \begin_layout Standard
4939 All these features are based on the GNU readline library, which has an extremely
4939 All these features are based on the GNU readline library, which has an extremely
4940 customizable interface.
4940 customizable interface.
4941 Normally, readline is configured via a file which defines the behavior
4941 Normally, readline is configured via a file which defines the behavior
4942 of the library; the details of the syntax for this can be found in the
4942 of the library; the details of the syntax for this can be found in the
4943 readline documentation available with your system or on the Internet.
4943 readline documentation available with your system or on the Internet.
4944 IPython doesn't read this file (if it exists) directly, but it does support
4944 IPython doesn't read this file (if it exists) directly, but it does support
4945 passing to readline valid options via a simple interface.
4945 passing to readline valid options via a simple interface.
4946 In brief, you can customize readline by setting the following options in
4946 In brief, you can customize readline by setting the following options in
4947 your
4947 your
4948 \family typewriter
4948 \family typewriter
4949 ipythonrc
4949 ipythonrc
4950 \family default
4950 \family default
4951 configuration file (note that these options can
4951 configuration file (note that these options can
4952 \emph on
4952 \emph on
4953 not
4953 not
4954 \emph default
4954 \emph default
4955 be specified at the command line):
4955 be specified at the command line):
4956 \end_layout
4956 \end_layout
4957
4957
4958 \begin_layout List
4958 \begin_layout List
4959 \labelwidthstring 00.00.0000
4959 \labelwidthstring 00.00.0000
4960
4960
4961 \family typewriter
4961 \family typewriter
4962 \series bold
4962 \series bold
4963 readline_parse_and_bind:
4963 readline_parse_and_bind:
4964 \family default
4964 \family default
4965 \series default
4965 \series default
4966 this option can appear as many times as you want, each time defining a
4966 this option can appear as many times as you want, each time defining a
4967 string to be executed via a
4967 string to be executed via a
4968 \family typewriter
4968 \family typewriter
4969 readline.parse_and_bind()
4969 readline.parse_and_bind()
4970 \family default
4970 \family default
4971 command.
4971 command.
4972 The syntax for valid commands of this kind can be found by reading the
4972 The syntax for valid commands of this kind can be found by reading the
4973 documentation for the GNU readline library, as these commands are of the
4973 documentation for the GNU readline library, as these commands are of the
4974 kind which readline accepts in its configuration file.
4974 kind which readline accepts in its configuration file.
4975 \end_layout
4975 \end_layout
4976
4976
4977 \begin_layout List
4977 \begin_layout List
4978 \labelwidthstring 00.00.0000
4978 \labelwidthstring 00.00.0000
4979
4979
4980 \family typewriter
4980 \family typewriter
4981 \series bold
4981 \series bold
4982 readline_remove_delims:
4982 readline_remove_delims:
4983 \family default
4983 \family default
4984 \series default
4984 \series default
4985 a string of characters to be removed from the default word-delimiters list
4985 a string of characters to be removed from the default word-delimiters list
4986 used by readline, so that completions may be performed on strings which
4986 used by readline, so that completions may be performed on strings which
4987 contain them.
4987 contain them.
4988 Do not change the default value unless you know what you're doing.
4988 Do not change the default value unless you know what you're doing.
4989 \end_layout
4989 \end_layout
4990
4990
4991 \begin_layout List
4991 \begin_layout List
4992 \labelwidthstring 00.00.0000
4992 \labelwidthstring 00.00.0000
4993
4993
4994 \family typewriter
4994 \family typewriter
4995 \series bold
4995 \series bold
4996 readline_omit__names
4996 readline_omit__names
4997 \family default
4997 \family default
4998 \series default
4998 \series default
4999 : when tab-completion is enabled, hitting
4999 : when tab-completion is enabled, hitting
5000 \family typewriter
5000 \family typewriter
5001 <tab>
5001 <tab>
5002 \family default
5002 \family default
5003 after a '
5003 after a '
5004 \family typewriter
5004 \family typewriter
5005 .
5005 .
5006 \family default
5006 \family default
5007 ' in a name will complete all attributes of an object, including all the
5007 ' in a name will complete all attributes of an object, including all the
5008 special methods whose names include double underscores (like
5008 special methods whose names include double underscores (like
5009 \family typewriter
5009 \family typewriter
5010 __getitem__
5010 __getitem__
5011 \family default
5011 \family default
5012 or
5012 or
5013 \family typewriter
5013 \family typewriter
5014 __class__
5014 __class__
5015 \family default
5015 \family default
5016 ).
5016 ).
5017 If you'd rather not see these names by default, you can set this option
5017 If you'd rather not see these names by default, you can set this option
5018 to 1.
5018 to 1.
5019 Note that even when this option is set, you can still see those names by
5019 Note that even when this option is set, you can still see those names by
5020 explicitly typing a
5020 explicitly typing a
5021 \family typewriter
5021 \family typewriter
5022 _
5022 _
5023 \family default
5023 \family default
5024 after the period and hitting
5024 after the period and hitting
5025 \family typewriter
5025 \family typewriter
5026 <tab>
5026 <tab>
5027 \family default
5027 \family default
5028 : '
5028 : '
5029 \family typewriter
5029 \family typewriter
5030 name._<tab>
5030 name._<tab>
5031 \family default
5031 \family default
5032 ' will always complete attribute names starting with '
5032 ' will always complete attribute names starting with '
5033 \family typewriter
5033 \family typewriter
5034 _
5034 _
5035 \family default
5035 \family default
5036 '.
5036 '.
5037 \end_layout
5037 \end_layout
5038
5038
5039 \begin_layout List
5039 \begin_layout List
5040 \labelwidthstring 00.00.0000
5040 \labelwidthstring 00.00.0000
5041 \InsetSpace ~
5041 \InsetSpace ~
5042 This option is off by default so that new users see all attributes of any
5042 This option is off by default so that new users see all attributes of any
5043 objects they are dealing with.
5043 objects they are dealing with.
5044 \end_layout
5044 \end_layout
5045
5045
5046 \begin_layout Standard
5046 \begin_layout Standard
5047 You will find the default values along with a corresponding detailed explanation
5047 You will find the default values along with a corresponding detailed explanation
5048 in your
5048 in your
5049 \family typewriter
5049 \family typewriter
5050 ipythonrc
5050 ipythonrc
5051 \family default
5051 \family default
5052 file.
5052 file.
5053 \end_layout
5053 \end_layout
5054
5054
5055 \begin_layout Subsection
5055 \begin_layout Subsection
5056 Session logging and restoring
5056 Session logging and restoring
5057 \end_layout
5057 \end_layout
5058
5058
5059 \begin_layout Standard
5059 \begin_layout Standard
5060 You can log all input from a session either by starting IPython with the
5060 You can log all input from a session either by starting IPython with the
5061 command line switches
5061 command line switches
5062 \family typewriter
5062 \family typewriter
5063 -log
5063 -log
5064 \family default
5064 \family default
5065 or
5065 or
5066 \family typewriter
5066 \family typewriter
5067 -logfile
5067 -logfile
5068 \family default
5068 \family default
5069 (see sec.
5069 (see sec.
5070
5070
5071 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5071 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5072
5072
5073 \end_inset
5073 \end_inset
5074
5074
5075 )or by activating the logging at any moment with the magic function
5075 )or by activating the logging at any moment with the magic function
5076 \family typewriter
5076 \family typewriter
5077 %logstart
5077 %logstart
5078 \family default
5078 \family default
5079 .
5079 .
5080
5080
5081 \end_layout
5081 \end_layout
5082
5082
5083 \begin_layout Standard
5083 \begin_layout Standard
5084 Log files can later be reloaded with the
5084 Log files can later be reloaded with the
5085 \family typewriter
5085 \family typewriter
5086 -logplay
5086 -logplay
5087 \family default
5087 \family default
5088 option and IPython will attempt to 'replay' the log by executing all the
5088 option and IPython will attempt to 'replay' the log by executing all the
5089 lines in it, thus restoring the state of a previous session.
5089 lines in it, thus restoring the state of a previous session.
5090 This feature is not quite perfect, but can still be useful in many cases.
5090 This feature is not quite perfect, but can still be useful in many cases.
5091 \end_layout
5091 \end_layout
5092
5092
5093 \begin_layout Standard
5093 \begin_layout Standard
5094 The log files can also be used as a way to have a permanent record of any
5094 The log files can also be used as a way to have a permanent record of any
5095 code you wrote while experimenting.
5095 code you wrote while experimenting.
5096 Log files are regular text files which you can later open in your favorite
5096 Log files are regular text files which you can later open in your favorite
5097 text editor to extract code or to 'clean them up' before using them to
5097 text editor to extract code or to 'clean them up' before using them to
5098 replay a session.
5098 replay a session.
5099 \end_layout
5099 \end_layout
5100
5100
5101 \begin_layout Standard
5101 \begin_layout Standard
5102 The
5102 The
5103 \family typewriter
5103 \family typewriter
5104 %logstart
5104 %logstart
5105 \family default
5105 \family default
5106 function for activating logging in mid-session is used as follows:
5106 function for activating logging in mid-session is used as follows:
5107 \end_layout
5107 \end_layout
5108
5108
5109 \begin_layout Standard
5109 \begin_layout Standard
5110
5110
5111 \family typewriter
5111 \family typewriter
5112 %logstart [log_name [log_mode]]
5112 %logstart [log_name [log_mode]]
5113 \end_layout
5113 \end_layout
5114
5114
5115 \begin_layout Standard
5115 \begin_layout Standard
5116 If no name is given, it defaults to a file named
5116 If no name is given, it defaults to a file named
5117 \family typewriter
5117 \family typewriter
5118 'log'
5118 'log'
5119 \family default
5119 \family default
5120 in your IPYTHONDIR directory, in
5120 in your IPYTHONDIR directory, in
5121 \family typewriter
5121 \family typewriter
5122 'rotate'
5122 'rotate'
5123 \family default
5123 \family default
5124 mode (see below).
5124 mode (see below).
5125 \end_layout
5125 \end_layout
5126
5126
5127 \begin_layout Standard
5127 \begin_layout Standard
5128 '
5128 '
5129 \family typewriter
5129 \family typewriter
5130 %logstart name
5130 %logstart name
5131 \family default
5131 \family default
5132 ' saves to file
5132 ' saves to file
5133 \family typewriter
5133 \family typewriter
5134 'name'
5134 'name'
5135 \family default
5135 \family default
5136 in
5136 in
5137 \family typewriter
5137 \family typewriter
5138 'backup'
5138 'backup'
5139 \family default
5139 \family default
5140 mode.
5140 mode.
5141 It saves your history up to that point and then continues logging.
5141 It saves your history up to that point and then continues logging.
5142 \end_layout
5142 \end_layout
5143
5143
5144 \begin_layout Standard
5144 \begin_layout Standard
5145
5145
5146 \family typewriter
5146 \family typewriter
5147 %logstart
5147 %logstart
5148 \family default
5148 \family default
5149 takes a second optional parameter: logging mode.
5149 takes a second optional parameter: logging mode.
5150 This can be one of (note that the modes are given unquoted):
5150 This can be one of (note that the modes are given unquoted):
5151 \end_layout
5151 \end_layout
5152
5152
5153 \begin_layout List
5153 \begin_layout List
5154 \labelwidthstring 00.00.0000
5154 \labelwidthstring 00.00.0000
5155
5155
5156 \family typewriter
5156 \family typewriter
5157 over
5157 over
5158 \family default
5158 \family default
5159 : overwrite existing
5159 : overwrite existing
5160 \family typewriter
5160 \family typewriter
5161 log_name
5161 log_name
5162 \family default
5162 \family default
5163 .
5163 .
5164 \end_layout
5164 \end_layout
5165
5165
5166 \begin_layout List
5166 \begin_layout List
5167 \labelwidthstring 00.00.0000
5167 \labelwidthstring 00.00.0000
5168
5168
5169 \family typewriter
5169 \family typewriter
5170 backup
5170 backup
5171 \family default
5171 \family default
5172 : rename (if exists) to
5172 : rename (if exists) to
5173 \family typewriter
5173 \family typewriter
5174 log_name~
5174 log_name~
5175 \family default
5175 \family default
5176 and start
5176 and start
5177 \family typewriter
5177 \family typewriter
5178 log_name
5178 log_name
5179 \family default
5179 \family default
5180 .
5180 .
5181 \end_layout
5181 \end_layout
5182
5182
5183 \begin_layout List
5183 \begin_layout List
5184 \labelwidthstring 00.00.0000
5184 \labelwidthstring 00.00.0000
5185
5185
5186 \family typewriter
5186 \family typewriter
5187 append
5187 append
5188 \family default
5188 \family default
5189 : well, that says it.
5189 : well, that says it.
5190 \end_layout
5190 \end_layout
5191
5191
5192 \begin_layout List
5192 \begin_layout List
5193 \labelwidthstring 00.00.0000
5193 \labelwidthstring 00.00.0000
5194
5194
5195 \family typewriter
5195 \family typewriter
5196 rotate
5196 rotate
5197 \family default
5197 \family default
5198 : create rotating logs
5198 : create rotating logs
5199 \family typewriter
5199 \family typewriter
5200 log_name
5200 log_name
5201 \family default
5201 \family default
5202 .
5202 .
5203 \family typewriter
5203 \family typewriter
5204 1~
5204 1~
5205 \family default
5205 \family default
5206 ,
5206 ,
5207 \family typewriter
5207 \family typewriter
5208 log_name.2~
5208 log_name.2~
5209 \family default
5209 \family default
5210 , etc.
5210 , etc.
5211 \end_layout
5211 \end_layout
5212
5212
5213 \begin_layout Standard
5213 \begin_layout Standard
5214 The
5214 The
5215 \family typewriter
5215 \family typewriter
5216 %logoff
5216 %logoff
5217 \family default
5217 \family default
5218 and
5218 and
5219 \family typewriter
5219 \family typewriter
5220 %logon
5220 %logon
5221 \family default
5221 \family default
5222 functions allow you to temporarily stop and resume logging to a file which
5222 functions allow you to temporarily stop and resume logging to a file which
5223 had previously been started with
5223 had previously been started with
5224 \family typewriter
5224 \family typewriter
5225 %logstart
5225 %logstart
5226 \family default
5226 \family default
5227 .
5227 .
5228 They will fail (with an explanation) if you try to use them before logging
5228 They will fail (with an explanation) if you try to use them before logging
5229 has been started.
5229 has been started.
5230 \end_layout
5230 \end_layout
5231
5231
5232 \begin_layout Subsection
5232 \begin_layout Subsection
5233 \begin_inset LatexCommand \label{sub:System-shell-access}
5233 \begin_inset LatexCommand \label{sub:System-shell-access}
5234
5234
5235 \end_inset
5235 \end_inset
5236
5236
5237 System shell access
5237 System shell access
5238 \end_layout
5238 \end_layout
5239
5239
5240 \begin_layout Standard
5240 \begin_layout Standard
5241 Any input line beginning with a
5241 Any input line beginning with a
5242 \family typewriter
5242 \family typewriter
5243 !
5243 !
5244 \family default
5244 \family default
5245 character is passed verbatim (minus the
5245 character is passed verbatim (minus the
5246 \family typewriter
5246 \family typewriter
5247 !
5247 !
5248 \family default
5248 \family default
5249 , of course) to the underlying operating system.
5249 , of course) to the underlying operating system.
5250 For example, typing
5250 For example, typing
5251 \family typewriter
5251 \family typewriter
5252 !ls
5252 !ls
5253 \family default
5253 \family default
5254 will run
5254 will run
5255 \family typewriter
5255 \family typewriter
5256 'ls'
5256 'ls'
5257 \family default
5257 \family default
5258 in the current directory.
5258 in the current directory.
5259 \end_layout
5259 \end_layout
5260
5260
5261 \begin_layout Subsubsection
5261 \begin_layout Subsubsection
5262 Manual capture of command output
5262 Manual capture of command output
5263 \end_layout
5263 \end_layout
5264
5264
5265 \begin_layout Standard
5265 \begin_layout Standard
5266 If the input line begins with
5266 If the input line begins with
5267 \emph on
5267 \emph on
5268 two
5268 two
5269 \emph default
5269 \emph default
5270 exclamation marks,
5270 exclamation marks,
5271 \family typewriter
5271 \family typewriter
5272 !!
5272 !!
5273 \family default
5273 \family default
5274 , the command is executed but its output is captured and returned as a python
5274 , the command is executed but its output is captured and returned as a python
5275 list, split on newlines.
5275 list, split on newlines.
5276 Any output sent by the subprocess to standard error is printed separately,
5276 Any output sent by the subprocess to standard error is printed separately,
5277 so that the resulting list only captures standard output.
5277 so that the resulting list only captures standard output.
5278 The
5278 The
5279 \family typewriter
5279 \family typewriter
5280 !!
5280 !!
5281 \family default
5281 \family default
5282 syntax is a shorthand for the
5282 syntax is a shorthand for the
5283 \family typewriter
5283 \family typewriter
5284 %sx
5284 %sx
5285 \family default
5285 \family default
5286 magic command.
5286 magic command.
5287 \end_layout
5287 \end_layout
5288
5288
5289 \begin_layout Standard
5289 \begin_layout Standard
5290 Finally, the
5290 Finally, the
5291 \family typewriter
5291 \family typewriter
5292 %sc
5292 %sc
5293 \family default
5293 \family default
5294 magic (short for `shell capture') is similar to
5294 magic (short for `shell capture') is similar to
5295 \family typewriter
5295 \family typewriter
5296 %sx
5296 %sx
5297 \family default
5297 \family default
5298 , but allowing more fine-grained control of the capture details, and storing
5298 , but allowing more fine-grained control of the capture details, and storing
5299 the result directly into a named variable.
5299 the result directly into a named variable.
5300 \end_layout
5300 \end_layout
5301
5301
5302 \begin_layout Standard
5302 \begin_layout Standard
5303 See Sec.\InsetSpace ~
5303 See Sec.\InsetSpace ~
5304
5304
5305 \begin_inset LatexCommand \ref{sec:magic}
5305 \begin_inset LatexCommand \ref{sec:magic}
5306
5306
5307 \end_inset
5307 \end_inset
5308
5308
5309 for details on the magics
5309 for details on the magics
5310 \family typewriter
5310 \family typewriter
5311 %sc
5311 %sc
5312 \family default
5312 \family default
5313 and
5313 and
5314 \family typewriter
5314 \family typewriter
5315 %sx
5315 %sx
5316 \family default
5316 \family default
5317 , or use IPython's own help (
5317 , or use IPython's own help (
5318 \family typewriter
5318 \family typewriter
5319 sc?
5319 sc?
5320 \family default
5320 \family default
5321 and
5321 and
5322 \family typewriter
5322 \family typewriter
5323 sx?
5323 sx?
5324 \family default
5324 \family default
5325 ) for further details.
5325 ) for further details.
5326 \end_layout
5326 \end_layout
5327
5327
5328 \begin_layout Standard
5328 \begin_layout Standard
5329 IPython also allows you to expand the value of python variables when making
5329 IPython also allows you to expand the value of python variables when making
5330 system calls.
5330 system calls.
5331 Any python variable or expression which you prepend with
5331 Any python variable or expression which you prepend with
5332 \family typewriter
5332 \family typewriter
5333 $
5333 $
5334 \family default
5334 \family default
5335 will get expanded before the system call is made.
5335 will get expanded before the system call is made.
5336
5336
5337 \end_layout
5337 \end_layout
5338
5338
5339 \begin_layout Standard
5339 \begin_layout Standard
5340
5340
5341 \family typewriter
5341 \family typewriter
5342 In [1]: pyvar='Hello world'
5342 In [1]: pyvar='Hello world'
5343 \newline
5343 \newline
5344 In [2]: !echo "A python variable: $pyvar"
5344 In [2]: !echo "A python variable: $pyvar"
5345 \newline
5345 \newline
5346 A python
5346 A python
5347 variable: Hello world
5347 variable: Hello world
5348 \end_layout
5348 \end_layout
5349
5349
5350 \begin_layout Standard
5350 \begin_layout Standard
5351 If you want the shell to actually see a literal
5351 If you want the shell to actually see a literal
5352 \family typewriter
5352 \family typewriter
5353 $
5353 $
5354 \family default
5354 \family default
5355 , you need to type it twice:
5355 , you need to type it twice:
5356 \end_layout
5356 \end_layout
5357
5357
5358 \begin_layout Standard
5358 \begin_layout Standard
5359
5359
5360 \family typewriter
5360 \family typewriter
5361 In [3]: !echo "A system variable: $$HOME"
5361 In [3]: !echo "A system variable: $$HOME"
5362 \newline
5362 \newline
5363 A system variable: /home/fperez
5363 A system variable: /home/fperez
5364 \end_layout
5364 \end_layout
5365
5365
5366 \begin_layout Standard
5366 \begin_layout Standard
5367 You can pass arbitrary expressions, though you'll need to delimit them with
5367 You can pass arbitrary expressions, though you'll need to delimit them with
5368
5368
5369 \family typewriter
5369 \family typewriter
5370 {}
5370 {}
5371 \family default
5371 \family default
5372 if there is ambiguity as to the extent of the expression:
5372 if there is ambiguity as to the extent of the expression:
5373 \end_layout
5373 \end_layout
5374
5374
5375 \begin_layout Standard
5375 \begin_layout Standard
5376
5376
5377 \family typewriter
5377 \family typewriter
5378 In [5]: x=10
5378 In [5]: x=10
5379 \newline
5379 \newline
5380 In [6]: y=20
5380 In [6]: y=20
5381 \newline
5381 \newline
5382 In [13]: !echo $x+y
5382 In [13]: !echo $x+y
5383 \newline
5383 \newline
5384 10+y
5384 10+y
5385 \newline
5385 \newline
5386 In [7]: !echo ${x+y}
5386 In [7]: !echo ${x+y}
5387 \newline
5387 \newline
5388 30
5388 30
5389
5389
5390 \end_layout
5390 \end_layout
5391
5391
5392 \begin_layout Standard
5392 \begin_layout Standard
5393 Even object attributes can be expanded:
5393 Even object attributes can be expanded:
5394 \end_layout
5394 \end_layout
5395
5395
5396 \begin_layout Standard
5396 \begin_layout Standard
5397
5397
5398 \family typewriter
5398 \family typewriter
5399 In [12]: !echo $sys.argv
5399 In [12]: !echo $sys.argv
5400 \newline
5400 \newline
5401 [/home/fperez/usr/bin/ipython]
5401 [/home/fperez/usr/bin/ipython]
5402 \end_layout
5402 \end_layout
5403
5403
5404 \begin_layout Subsection
5404 \begin_layout Subsection
5405 System command aliases
5405 System command aliases
5406 \end_layout
5406 \end_layout
5407
5407
5408 \begin_layout Standard
5408 \begin_layout Standard
5409 The
5409 The
5410 \family typewriter
5410 \family typewriter
5411 %alias
5411 %alias
5412 \family default
5412 \family default
5413 magic function and the
5413 magic function and the
5414 \family typewriter
5414 \family typewriter
5415 alias
5415 alias
5416 \family default
5416 \family default
5417 option in the
5417 option in the
5418 \family typewriter
5418 \family typewriter
5419 ipythonrc
5419 ipythonrc
5420 \family default
5420 \family default
5421 configuration file allow you to define magic functions which are in fact
5421 configuration file allow you to define magic functions which are in fact
5422 system shell commands.
5422 system shell commands.
5423 These aliases can have parameters.
5423 These aliases can have parameters.
5424
5424
5425 \end_layout
5425 \end_layout
5426
5426
5427 \begin_layout Standard
5427 \begin_layout Standard
5428 '
5428 '
5429 \family typewriter
5429 \family typewriter
5430 %alias alias_name cmd
5430 %alias alias_name cmd
5431 \family default
5431 \family default
5432 ' defines '
5432 ' defines '
5433 \family typewriter
5433 \family typewriter
5434 alias_name
5434 alias_name
5435 \family default
5435 \family default
5436 ' as an alias for '
5436 ' as an alias for '
5437 \family typewriter
5437 \family typewriter
5438 cmd
5438 cmd
5439 \family default
5439 \family default
5440 '
5440 '
5441 \end_layout
5441 \end_layout
5442
5442
5443 \begin_layout Standard
5443 \begin_layout Standard
5444 Then, typing '
5444 Then, typing '
5445 \family typewriter
5445 \family typewriter
5446 %alias_name params
5446 %alias_name params
5447 \family default
5447 \family default
5448 ' will execute the system command '
5448 ' will execute the system command '
5449 \family typewriter
5449 \family typewriter
5450 cmd params
5450 cmd params
5451 \family default
5451 \family default
5452 ' (from your underlying operating system).
5452 ' (from your underlying operating system).
5453
5453
5454 \end_layout
5454 \end_layout
5455
5455
5456 \begin_layout Standard
5456 \begin_layout Standard
5457 You can also define aliases with parameters using
5457 You can also define aliases with parameters using
5458 \family typewriter
5458 \family typewriter
5459 %s
5459 %s
5460 \family default
5460 \family default
5461 specifiers (one per parameter).
5461 specifiers (one per parameter).
5462 The following example defines the
5462 The following example defines the
5463 \family typewriter
5463 \family typewriter
5464 %parts
5464 %parts
5465 \family default
5465 \family default
5466 function as an alias to the command '
5466 function as an alias to the command '
5467 \family typewriter
5467 \family typewriter
5468 echo first %s second %s
5468 echo first %s second %s
5469 \family default
5469 \family default
5470 ' where each
5470 ' where each
5471 \family typewriter
5471 \family typewriter
5472 %s
5472 %s
5473 \family default
5473 \family default
5474 will be replaced by a positional parameter to the call to
5474 will be replaced by a positional parameter to the call to
5475 \family typewriter
5475 \family typewriter
5476 %parts:
5476 %parts:
5477 \end_layout
5477 \end_layout
5478
5478
5479 \begin_layout Standard
5479 \begin_layout Standard
5480
5480
5481 \family typewriter
5481 \family typewriter
5482 In [1]: alias parts echo first %s second %s
5482 In [1]: alias parts echo first %s second %s
5483 \newline
5483 \newline
5484 In [2]: %parts A B
5484 In [2]: %parts A B
5485 \newline
5485 \newline
5486 first A second
5486 first A second
5487 B
5487 B
5488 \newline
5488 \newline
5489 In [3]: %parts A
5489 In [3]: %parts A
5490 \newline
5490 \newline
5491 Incorrect number of arguments: 2 expected.
5491 Incorrect number of arguments: 2 expected.
5492
5492
5493 \newline
5493 \newline
5494 parts is an alias to: 'echo first %s second %s'
5494 parts is an alias to: 'echo first %s second %s'
5495 \end_layout
5495 \end_layout
5496
5496
5497 \begin_layout Standard
5497 \begin_layout Standard
5498 If called with no parameters,
5498 If called with no parameters,
5499 \family typewriter
5499 \family typewriter
5500 %alias
5500 %alias
5501 \family default
5501 \family default
5502 prints the table of currently defined aliases.
5502 prints the table of currently defined aliases.
5503 \end_layout
5503 \end_layout
5504
5504
5505 \begin_layout Standard
5505 \begin_layout Standard
5506 The
5506 The
5507 \family typewriter
5507 \family typewriter
5508 %rehash/rehashx
5508 %rehash/rehashx
5509 \family default
5509 \family default
5510 magics allow you to load your entire
5510 magics allow you to load your entire
5511 \family typewriter
5511 \family typewriter
5512 $PATH
5512 $PATH
5513 \family default
5513 \family default
5514 as ipython aliases.
5514 as ipython aliases.
5515 See their respective docstrings (or sec.\InsetSpace ~
5515 See their respective docstrings (or sec.\InsetSpace ~
5516
5516
5517 \begin_inset LatexCommand \ref{sec:magic}
5517 \begin_inset LatexCommand \ref{sec:magic}
5518
5518
5519 \end_inset
5519 \end_inset
5520
5520
5521 for further details).
5521 for further details).
5522 \end_layout
5522 \end_layout
5523
5523
5524 \begin_layout Subsection
5524 \begin_layout Subsection
5525 \begin_inset LatexCommand \label{sec:dreload}
5525 \begin_inset LatexCommand \label{sec:dreload}
5526
5526
5527 \end_inset
5527 \end_inset
5528
5528
5529 Recursive reload
5529 Recursive reload
5530 \end_layout
5530 \end_layout
5531
5531
5532 \begin_layout Standard
5532 \begin_layout Standard
5533 The
5533 The
5534 \family typewriter
5534 \family typewriter
5535 dreload
5535 dreload
5536 \family default
5536 \family default
5537 function does a recursive reload of a module: changes made to the module
5537 function does a recursive reload of a module: changes made to the module
5538 since you imported will actually be available without having to exit.
5538 since you imported will actually be available without having to exit.
5539 \end_layout
5539 \end_layout
5540
5540
5541 \begin_layout Subsection
5541 \begin_layout Subsection
5542 Verbose and colored exception traceback printouts
5542 Verbose and colored exception traceback printouts
5543 \end_layout
5543 \end_layout
5544
5544
5545 \begin_layout Standard
5545 \begin_layout Standard
5546 IPython provides the option to see very detailed exception tracebacks, which
5546 IPython provides the option to see very detailed exception tracebacks, which
5547 can be especially useful when debugging large programs.
5547 can be especially useful when debugging large programs.
5548 You can run any Python file with the
5548 You can run any Python file with the
5549 \family typewriter
5549 \family typewriter
5550 %run
5550 %run
5551 \family default
5551 \family default
5552 function to benefit from these detailed tracebacks.
5552 function to benefit from these detailed tracebacks.
5553 Furthermore, both normal and verbose tracebacks can be colored (if your
5553 Furthermore, both normal and verbose tracebacks can be colored (if your
5554 terminal supports it) which makes them much easier to parse visually.
5554 terminal supports it) which makes them much easier to parse visually.
5555 \end_layout
5555 \end_layout
5556
5556
5557 \begin_layout Standard
5557 \begin_layout Standard
5558 See the magic
5558 See the magic
5559 \family typewriter
5559 \family typewriter
5560 xmode
5560 xmode
5561 \family default
5561 \family default
5562 and
5562 and
5563 \family typewriter
5563 \family typewriter
5564 colors
5564 colors
5565 \family default
5565 \family default
5566 functions for details (just type
5566 functions for details (just type
5567 \family typewriter
5567 \family typewriter
5568 %magic
5568 %magic
5569 \family default
5569 \family default
5570 ).
5570 ).
5571 \end_layout
5571 \end_layout
5572
5572
5573 \begin_layout Standard
5573 \begin_layout Standard
5574 These features are basically a terminal version of Ka-Ping Yee's
5574 These features are basically a terminal version of Ka-Ping Yee's
5575 \family typewriter
5575 \family typewriter
5576 cgitb
5576 cgitb
5577 \family default
5577 \family default
5578 module, now part of the standard Python library.
5578 module, now part of the standard Python library.
5579 \end_layout
5579 \end_layout
5580
5580
5581 \begin_layout Subsection
5581 \begin_layout Subsection
5582 \begin_inset LatexCommand \label{sec:cache_input}
5582 \begin_inset LatexCommand \label{sec:cache_input}
5583
5583
5584 \end_inset
5584 \end_inset
5585
5585
5586 Input caching system
5586 Input caching system
5587 \end_layout
5587 \end_layout
5588
5588
5589 \begin_layout Standard
5589 \begin_layout Standard
5590 IPython offers numbered prompts (In/Out) with input and output caching.
5590 IPython offers numbered prompts (In/Out) with input and output caching.
5591 All input is saved and can be retrieved as variables (besides the usual
5591 All input is saved and can be retrieved as variables (besides the usual
5592 arrow key recall).
5592 arrow key recall).
5593 \end_layout
5593 \end_layout
5594
5594
5595 \begin_layout Standard
5595 \begin_layout Standard
5596 The following GLOBAL variables always exist (so don't overwrite them!):
5596 The following GLOBAL variables always exist (so don't overwrite them!):
5597
5597
5598 \family typewriter
5598 \family typewriter
5599 _i
5599 _i
5600 \family default
5600 \family default
5601 : stores previous input.
5601 : stores previous input.
5602
5602
5603 \family typewriter
5603 \family typewriter
5604 _ii
5604 _ii
5605 \family default
5605 \family default
5606 : next previous.
5606 : next previous.
5607
5607
5608 \family typewriter
5608 \family typewriter
5609 _iii
5609 _iii
5610 \family default
5610 \family default
5611 : next-next previous.
5611 : next-next previous.
5612
5612
5613 \family typewriter
5613 \family typewriter
5614 _ih
5614 _ih
5615 \family default
5615 \family default
5616 : a list of all input
5616 : a list of all input
5617 \family typewriter
5617 \family typewriter
5618 _ih[n]
5618 _ih[n]
5619 \family default
5619 \family default
5620 is the input from line
5620 is the input from line
5621 \family typewriter
5621 \family typewriter
5622 n
5622 n
5623 \family default
5623 \family default
5624 and this list is aliased to the global variable
5624 and this list is aliased to the global variable
5625 \family typewriter
5625 \family typewriter
5626 In
5626 In
5627 \family default
5627 \family default
5628 .
5628 .
5629 If you overwrite
5629 If you overwrite
5630 \family typewriter
5630 \family typewriter
5631 In
5631 In
5632 \family default
5632 \family default
5633 with a variable of your own, you can remake the assignment to the internal
5633 with a variable of your own, you can remake the assignment to the internal
5634 list with a simple
5634 list with a simple
5635 \family typewriter
5635 \family typewriter
5636 'In=_ih'
5636 'In=_ih'
5637 \family default
5637 \family default
5638 .
5638 .
5639 \end_layout
5639 \end_layout
5640
5640
5641 \begin_layout Standard
5641 \begin_layout Standard
5642 Additionally, global variables named
5642 Additionally, global variables named
5643 \family typewriter
5643 \family typewriter
5644 _i<n>
5644 _i<n>
5645 \family default
5645 \family default
5646 are dynamically created (
5646 are dynamically created (
5647 \family typewriter
5647 \family typewriter
5648 <n>
5648 <n>
5649 \family default
5649 \family default
5650 being the prompt counter), such that
5650 being the prompt counter), such that
5651 \newline
5651 \newline
5652
5652
5653 \family typewriter
5653 \family typewriter
5654 _i<n> == _ih[<n>] == In[<n>].
5654 _i<n> == _ih[<n>] == In[<n>].
5655 \end_layout
5655 \end_layout
5656
5656
5657 \begin_layout Standard
5657 \begin_layout Standard
5658 For example, what you typed at prompt 14 is available as
5658 For example, what you typed at prompt 14 is available as
5659 \family typewriter
5659 \family typewriter
5660 _i14,
5660 _i14,
5661 \family default
5661 \family default
5662
5662
5663 \family typewriter
5663 \family typewriter
5664 _ih[14]
5664 _ih[14]
5665 \family default
5665 \family default
5666 and
5666 and
5667 \family typewriter
5667 \family typewriter
5668 In[14]
5668 In[14]
5669 \family default
5669 \family default
5670 .
5670 .
5671 \end_layout
5671 \end_layout
5672
5672
5673 \begin_layout Standard
5673 \begin_layout Standard
5674 This allows you to easily cut and paste multi line interactive prompts by
5674 This allows you to easily cut and paste multi line interactive prompts by
5675 printing them out: they print like a clean string, without prompt characters.
5675 printing them out: they print like a clean string, without prompt characters.
5676 You can also manipulate them like regular variables (they are strings),
5676 You can also manipulate them like regular variables (they are strings),
5677 modify or exec them (typing
5677 modify or exec them (typing
5678 \family typewriter
5678 \family typewriter
5679 'exec _i9'
5679 'exec _i9'
5680 \family default
5680 \family default
5681 will re-execute the contents of input prompt 9, '
5681 will re-execute the contents of input prompt 9, '
5682 \family typewriter
5682 \family typewriter
5683 exec In[9:14]+In[18]
5683 exec In[9:14]+In[18]
5684 \family default
5684 \family default
5685 ' will re-execute lines 9 through 13 and line 18).
5685 ' will re-execute lines 9 through 13 and line 18).
5686 \end_layout
5686 \end_layout
5687
5687
5688 \begin_layout Standard
5688 \begin_layout Standard
5689 You can also re-execute multiple lines of input easily by using the magic
5689 You can also re-execute multiple lines of input easily by using the magic
5690
5690
5691 \family typewriter
5691 \family typewriter
5692 %macro
5692 %macro
5693 \family default
5693 \family default
5694 function (which automates the process and allows re-execution without having
5694 function (which automates the process and allows re-execution without having
5695 to type '
5695 to type '
5696 \family typewriter
5696 \family typewriter
5697 exec
5697 exec
5698 \family default
5698 \family default
5699 ' every time).
5699 ' every time).
5700 The macro system also allows you to re-execute previous lines which include
5700 The macro system also allows you to re-execute previous lines which include
5701 magic function calls (which require special processing).
5701 magic function calls (which require special processing).
5702 Type
5702 Type
5703 \family typewriter
5703 \family typewriter
5704 %macro?
5704 %macro?
5705 \family default
5705 \family default
5706 or see sec.
5706 or see sec.
5707
5707
5708 \begin_inset LatexCommand \ref{sec:magic}
5708 \begin_inset LatexCommand \ref{sec:magic}
5709
5709
5710 \end_inset
5710 \end_inset
5711
5711
5712 for more details on the macro system.
5712 for more details on the macro system.
5713 \end_layout
5713 \end_layout
5714
5714
5715 \begin_layout Standard
5715 \begin_layout Standard
5716 A history function
5716 A history function
5717 \family typewriter
5717 \family typewriter
5718 %hist
5718 %hist
5719 \family default
5719 \family default
5720 allows you to see any part of your input history by printing a range of
5720 allows you to see any part of your input history by printing a range of
5721 the
5721 the
5722 \family typewriter
5722 \family typewriter
5723 _i
5723 _i
5724 \family default
5724 \family default
5725 variables.
5725 variables.
5726 \end_layout
5726 \end_layout
5727
5727
5728 \begin_layout Subsection
5728 \begin_layout Subsection
5729 \begin_inset LatexCommand \label{sec:cache_output}
5729 \begin_inset LatexCommand \label{sec:cache_output}
5730
5730
5731 \end_inset
5731 \end_inset
5732
5732
5733 Output caching system
5733 Output caching system
5734 \end_layout
5734 \end_layout
5735
5735
5736 \begin_layout Standard
5736 \begin_layout Standard
5737 For output that is returned from actions, a system similar to the input
5737 For output that is returned from actions, a system similar to the input
5738 cache exists but using
5738 cache exists but using
5739 \family typewriter
5739 \family typewriter
5740 _
5740 _
5741 \family default
5741 \family default
5742 instead of
5742 instead of
5743 \family typewriter
5743 \family typewriter
5744 _i
5744 _i
5745 \family default
5745 \family default
5746 .
5746 .
5747 Only actions that produce a result (NOT assignments, for example) are cached.
5747 Only actions that produce a result (NOT assignments, for example) are cached.
5748 If you are familiar with Mathematica, IPython's
5748 If you are familiar with Mathematica, IPython's
5749 \family typewriter
5749 \family typewriter
5750 _
5750 _
5751 \family default
5751 \family default
5752 variables behave exactly like Mathematica's
5752 variables behave exactly like Mathematica's
5753 \family typewriter
5753 \family typewriter
5754 %
5754 %
5755 \family default
5755 \family default
5756 variables.
5756 variables.
5757 \end_layout
5757 \end_layout
5758
5758
5759 \begin_layout Standard
5759 \begin_layout Standard
5760 The following GLOBAL variables always exist (so don't overwrite them!):
5760 The following GLOBAL variables always exist (so don't overwrite them!):
5761
5761
5762 \end_layout
5762 \end_layout
5763
5763
5764 \begin_layout List
5764 \begin_layout List
5765 \labelwidthstring 00.00.0000
5765 \labelwidthstring 00.00.0000
5766
5766
5767 \family typewriter
5767 \family typewriter
5768 \series bold
5768 \series bold
5769 _
5769 _
5770 \family default
5770 \family default
5771 \series default
5771 \series default
5772 (a
5772 (a
5773 \emph on
5773 \emph on
5774 single
5774 single
5775 \emph default
5775 \emph default
5776 underscore) : stores previous output, like Python's default interpreter.
5776 underscore) : stores previous output, like Python's default interpreter.
5777 \end_layout
5777 \end_layout
5778
5778
5779 \begin_layout List
5779 \begin_layout List
5780 \labelwidthstring 00.00.0000
5780 \labelwidthstring 00.00.0000
5781
5781
5782 \family typewriter
5782 \family typewriter
5783 \series bold
5783 \series bold
5784 __
5784 __
5785 \family default
5785 \family default
5786 \series default
5786 \series default
5787 (two underscores): next previous.
5787 (two underscores): next previous.
5788 \end_layout
5788 \end_layout
5789
5789
5790 \begin_layout List
5790 \begin_layout List
5791 \labelwidthstring 00.00.0000
5791 \labelwidthstring 00.00.0000
5792
5792
5793 \family typewriter
5793 \family typewriter
5794 \series bold
5794 \series bold
5795 ___
5795 ___
5796 \family default
5796 \family default
5797 \series default
5797 \series default
5798 (three underscores): next-next previous.
5798 (three underscores): next-next previous.
5799 \end_layout
5799 \end_layout
5800
5800
5801 \begin_layout Standard
5801 \begin_layout Standard
5802 Additionally, global variables named
5802 Additionally, global variables named
5803 \family typewriter
5803 \family typewriter
5804 _<n>
5804 _<n>
5805 \family default
5805 \family default
5806 are dynamically created (
5806 are dynamically created (
5807 \family typewriter
5807 \family typewriter
5808 <n>
5808 <n>
5809 \family default
5809 \family default
5810 being the prompt counter), such that the result of output
5810 being the prompt counter), such that the result of output
5811 \family typewriter
5811 \family typewriter
5812 <n>
5812 <n>
5813 \family default
5813 \family default
5814 is always available as
5814 is always available as
5815 \family typewriter
5815 \family typewriter
5816 _<n>
5816 _<n>
5817 \family default
5817 \family default
5818 (don't use the angle brackets, just the number, e.g.
5818 (don't use the angle brackets, just the number, e.g.
5819
5819
5820 \family typewriter
5820 \family typewriter
5821 _21
5821 _21
5822 \family default
5822 \family default
5823 ).
5823 ).
5824 \end_layout
5824 \end_layout
5825
5825
5826 \begin_layout Standard
5826 \begin_layout Standard
5827 These global variables are all stored in a global dictionary (not a list,
5827 These global variables are all stored in a global dictionary (not a list,
5828 since it only has entries for lines which returned a result) available
5828 since it only has entries for lines which returned a result) available
5829 under the names
5829 under the names
5830 \family typewriter
5830 \family typewriter
5831 _oh
5831 _oh
5832 \family default
5832 \family default
5833 and
5833 and
5834 \family typewriter
5834 \family typewriter
5835 Out
5835 Out
5836 \family default
5836 \family default
5837 (similar to
5837 (similar to
5838 \family typewriter
5838 \family typewriter
5839 _ih
5839 _ih
5840 \family default
5840 \family default
5841 and
5841 and
5842 \family typewriter
5842 \family typewriter
5843 In
5843 In
5844 \family default
5844 \family default
5845 ).
5845 ).
5846 So the output from line 12 can be obtained as
5846 So the output from line 12 can be obtained as
5847 \family typewriter
5847 \family typewriter
5848 _12
5848 _12
5849 \family default
5849 \family default
5850 ,
5850 ,
5851 \family typewriter
5851 \family typewriter
5852 Out[12]
5852 Out[12]
5853 \family default
5853 \family default
5854 or
5854 or
5855 \family typewriter
5855 \family typewriter
5856 _oh[12]
5856 _oh[12]
5857 \family default
5857 \family default
5858 .
5858 .
5859 If you accidentally overwrite the
5859 If you accidentally overwrite the
5860 \family typewriter
5860 \family typewriter
5861 Out
5861 Out
5862 \family default
5862 \family default
5863 variable you can recover it by typing
5863 variable you can recover it by typing
5864 \family typewriter
5864 \family typewriter
5865 'Out=_oh
5865 'Out=_oh
5866 \family default
5866 \family default
5867 ' at the prompt.
5867 ' at the prompt.
5868 \end_layout
5868 \end_layout
5869
5869
5870 \begin_layout Standard
5870 \begin_layout Standard
5871 This system obviously can potentially put heavy memory demands on your system,
5871 This system obviously can potentially put heavy memory demands on your system,
5872 since it prevents Python's garbage collector from removing any previously
5872 since it prevents Python's garbage collector from removing any previously
5873 computed results.
5873 computed results.
5874 You can control how many results are kept in memory with the option (at
5874 You can control how many results are kept in memory with the option (at
5875 the command line or in your
5875 the command line or in your
5876 \family typewriter
5876 \family typewriter
5877 ipythonrc
5877 ipythonrc
5878 \family default
5878 \family default
5879 file)
5879 file)
5880 \family typewriter
5880 \family typewriter
5881 cache_size
5881 cache_size
5882 \family default
5882 \family default
5883 .
5883 .
5884 If you set it to 0, the whole system is completely disabled and the prompts
5884 If you set it to 0, the whole system is completely disabled and the prompts
5885 revert to the classic
5885 revert to the classic
5886 \family typewriter
5886 \family typewriter
5887 '>>>'
5887 '>>>'
5888 \family default
5888 \family default
5889 of normal Python.
5889 of normal Python.
5890 \end_layout
5890 \end_layout
5891
5891
5892 \begin_layout Subsection
5892 \begin_layout Subsection
5893 Directory history
5893 Directory history
5894 \end_layout
5894 \end_layout
5895
5895
5896 \begin_layout Standard
5896 \begin_layout Standard
5897 Your history of visited directories is kept in the global list
5897 Your history of visited directories is kept in the global list
5898 \family typewriter
5898 \family typewriter
5899 _dh
5899 _dh
5900 \family default
5900 \family default
5901 , and the magic
5901 , and the magic
5902 \family typewriter
5902 \family typewriter
5903 %cd
5903 %cd
5904 \family default
5904 \family default
5905 command can be used to go to any entry in that list.
5905 command can be used to go to any entry in that list.
5906 The
5906 The
5907 \family typewriter
5907 \family typewriter
5908 %dhist
5908 %dhist
5909 \family default
5909 \family default
5910 command allows you to view this history.
5910 command allows you to view this history.
5911 \end_layout
5911 \end_layout
5912
5912
5913 \begin_layout Subsection
5913 \begin_layout Subsection
5914 Automatic parentheses and quotes
5914 Automatic parentheses and quotes
5915 \end_layout
5915 \end_layout
5916
5916
5917 \begin_layout Standard
5917 \begin_layout Standard
5918 These features were adapted from Nathan Gray's LazyPython.
5918 These features were adapted from Nathan Gray's LazyPython.
5919 They are meant to allow less typing for common situations.
5919 They are meant to allow less typing for common situations.
5920 \end_layout
5920 \end_layout
5921
5921
5922 \begin_layout Subsubsection
5922 \begin_layout Subsubsection
5923 Automatic parentheses
5923 Automatic parentheses
5924 \end_layout
5924 \end_layout
5925
5925
5926 \begin_layout Standard
5926 \begin_layout Standard
5927 Callable objects (i.e.
5927 Callable objects (i.e.
5928 functions, methods, etc) can be invoked like this (notice the commas between
5928 functions, methods, etc) can be invoked like this (notice the commas between
5929 the arguments):
5929 the arguments):
5930 \end_layout
5930 \end_layout
5931
5931
5932 \begin_layout Standard
5932 \begin_layout Standard
5933
5933
5934 \family typewriter
5934 \family typewriter
5935 >>> callable_ob arg1, arg2, arg3
5935 >>> callable_ob arg1, arg2, arg3
5936 \end_layout
5936 \end_layout
5937
5937
5938 \begin_layout Standard
5938 \begin_layout Standard
5939 and the input will be translated to this:
5939 and the input will be translated to this:
5940 \end_layout
5940 \end_layout
5941
5941
5942 \begin_layout Standard
5942 \begin_layout Standard
5943
5943
5944 \family typewriter
5944 \family typewriter
5945 --> callable_ob(arg1, arg2, arg3)
5945 --> callable_ob(arg1, arg2, arg3)
5946 \end_layout
5946 \end_layout
5947
5947
5948 \begin_layout Standard
5948 \begin_layout Standard
5949 You can force automatic parentheses by using '/' as the first character
5949 You can force automatic parentheses by using '/' as the first character
5950 of a line.
5950 of a line.
5951 For example:
5951 For example:
5952 \end_layout
5952 \end_layout
5953
5953
5954 \begin_layout Standard
5954 \begin_layout Standard
5955
5955
5956 \family typewriter
5956 \family typewriter
5957 >>> /globals # becomes 'globals()'
5957 >>> /globals # becomes 'globals()'
5958 \end_layout
5958 \end_layout
5959
5959
5960 \begin_layout Standard
5960 \begin_layout Standard
5961 Note that the '/' MUST be the first character on the line! This won't work:
5961 Note that the '/' MUST be the first character on the line! This won't work:
5962
5962
5963 \end_layout
5963 \end_layout
5964
5964
5965 \begin_layout Standard
5965 \begin_layout Standard
5966
5966
5967 \family typewriter
5967 \family typewriter
5968 >>> print /globals # syntax error
5968 >>> print /globals # syntax error
5969 \end_layout
5969 \end_layout
5970
5970
5971 \begin_layout Standard
5971 \begin_layout Standard
5972 In most cases the automatic algorithm should work, so you should rarely
5972 In most cases the automatic algorithm should work, so you should rarely
5973 need to explicitly invoke /.
5973 need to explicitly invoke /.
5974 One notable exception is if you are trying to call a function with a list
5974 One notable exception is if you are trying to call a function with a list
5975 of tuples as arguments (the parenthesis will confuse IPython):
5975 of tuples as arguments (the parenthesis will confuse IPython):
5976 \end_layout
5976 \end_layout
5977
5977
5978 \begin_layout Standard
5978 \begin_layout Standard
5979
5979
5980 \family typewriter
5980 \family typewriter
5981 In [1]: zip (1,2,3),(4,5,6) # won't work
5981 In [1]: zip (1,2,3),(4,5,6) # won't work
5982 \end_layout
5982 \end_layout
5983
5983
5984 \begin_layout Standard
5984 \begin_layout Standard
5985 but this will work:
5985 but this will work:
5986 \end_layout
5986 \end_layout
5987
5987
5988 \begin_layout Standard
5988 \begin_layout Standard
5989
5989
5990 \family typewriter
5990 \family typewriter
5991 In [2]: /zip (1,2,3),(4,5,6)
5991 In [2]: /zip (1,2,3),(4,5,6)
5992 \newline
5992 \newline
5993 ------> zip ((1,2,3),(4,5,6))
5993 ------> zip ((1,2,3),(4,5,6))
5994 \newline
5994 \newline
5995 Out[2]= [(1, 4),
5995 Out[2]= [(1, 4),
5996 (2, 5), (3, 6)]
5996 (2, 5), (3, 6)]
5997 \end_layout
5997 \end_layout
5998
5998
5999 \begin_layout Standard
5999 \begin_layout Standard
6000 IPython tells you that it has altered your command line by displaying the
6000 IPython tells you that it has altered your command line by displaying the
6001 new command line preceded by
6001 new command line preceded by
6002 \family typewriter
6002 \family typewriter
6003 -->
6003 -->
6004 \family default
6004 \family default
6005 .
6005 .
6006 e.g.:
6006 e.g.:
6007 \end_layout
6007 \end_layout
6008
6008
6009 \begin_layout Standard
6009 \begin_layout Standard
6010
6010
6011 \family typewriter
6011 \family typewriter
6012 In [18]: callable list
6012 In [18]: callable list
6013 \newline
6013 \newline
6014 -------> callable (list)
6014 -------> callable (list)
6015 \end_layout
6015 \end_layout
6016
6016
6017 \begin_layout Subsubsection
6017 \begin_layout Subsubsection
6018 Automatic quoting
6018 Automatic quoting
6019 \end_layout
6019 \end_layout
6020
6020
6021 \begin_layout Standard
6021 \begin_layout Standard
6022 You can force automatic quoting of a function's arguments by using
6022 You can force automatic quoting of a function's arguments by using
6023 \family typewriter
6023 \family typewriter
6024 `,'
6024 `,'
6025 \family default
6025 \family default
6026 or
6026 or
6027 \family typewriter
6027 \family typewriter
6028 `;'
6028 `;'
6029 \family default
6029 \family default
6030 as the first character of a line.
6030 as the first character of a line.
6031 For example:
6031 For example:
6032 \end_layout
6032 \end_layout
6033
6033
6034 \begin_layout Standard
6034 \begin_layout Standard
6035
6035
6036 \family typewriter
6036 \family typewriter
6037 >>> ,my_function /home/me # becomes my_function("/home/me")
6037 >>> ,my_function /home/me # becomes my_function("/home/me")
6038 \end_layout
6038 \end_layout
6039
6039
6040 \begin_layout Standard
6040 \begin_layout Standard
6041 If you use
6041 If you use
6042 \family typewriter
6042 \family typewriter
6043 `;'
6043 `;'
6044 \family default
6044 \family default
6045 instead, the whole argument is quoted as a single string (while
6045 instead, the whole argument is quoted as a single string (while
6046 \family typewriter
6046 \family typewriter
6047 `,'
6047 `,'
6048 \family default
6048 \family default
6049 splits on whitespace):
6049 splits on whitespace):
6050 \end_layout
6050 \end_layout
6051
6051
6052 \begin_layout Standard
6052 \begin_layout Standard
6053
6053
6054 \family typewriter
6054 \family typewriter
6055 >>> ,my_function a b c # becomes my_function("a","b","c")
6055 >>> ,my_function a b c # becomes my_function("a","b","c")
6056 \end_layout
6056 \end_layout
6057
6057
6058 \begin_layout Standard
6058 \begin_layout Standard
6059
6059
6060 \family typewriter
6060 \family typewriter
6061 >>> ;my_function a b c # becomes my_function("a b c")
6061 >>> ;my_function a b c # becomes my_function("a b c")
6062 \end_layout
6062 \end_layout
6063
6063
6064 \begin_layout Standard
6064 \begin_layout Standard
6065 Note that the `
6065 Note that the `
6066 \family typewriter
6066 \family typewriter
6067 ,
6067 ,
6068 \family default
6068 \family default
6069 ' or `
6069 ' or `
6070 \family typewriter
6070 \family typewriter
6071 ;
6071 ;
6072 \family default
6072 \family default
6073 ' MUST be the first character on the line! This won't work:
6073 ' MUST be the first character on the line! This won't work:
6074 \end_layout
6074 \end_layout
6075
6075
6076 \begin_layout Standard
6076 \begin_layout Standard
6077
6077
6078 \family typewriter
6078 \family typewriter
6079 >>> x = ,my_function /home/me # syntax error
6079 >>> x = ,my_function /home/me # syntax error
6080 \end_layout
6080 \end_layout
6081
6081
6082 \begin_layout Section
6082 \begin_layout Section
6083 \begin_inset LatexCommand \label{sec:customization}
6083 \begin_inset LatexCommand \label{sec:customization}
6084
6084
6085 \end_inset
6085 \end_inset
6086
6086
6087 Customization
6087 Customization
6088 \end_layout
6088 \end_layout
6089
6089
6090 \begin_layout Standard
6090 \begin_layout Standard
6091 As we've already mentioned, IPython reads a configuration file which can
6091 As we've already mentioned, IPython reads a configuration file which can
6092 be specified at the command line (
6092 be specified at the command line (
6093 \family typewriter
6093 \family typewriter
6094 -rcfile
6094 -rcfile
6095 \family default
6095 \family default
6096 ) or which by default is assumed to be called
6096 ) or which by default is assumed to be called
6097 \family typewriter
6097 \family typewriter
6098 ipythonrc
6098 ipythonrc
6099 \family default
6099 \family default
6100 .
6100 .
6101 Such a file is looked for in the current directory where IPython is started
6101 Such a file is looked for in the current directory where IPython is started
6102 and then in your
6102 and then in your
6103 \family typewriter
6103 \family typewriter
6104 IPYTHONDIR
6104 IPYTHONDIR
6105 \family default
6105 \family default
6106 , which allows you to have local configuration files for specific projects.
6106 , which allows you to have local configuration files for specific projects.
6107 In this section we will call these types of configuration files simply
6107 In this section we will call these types of configuration files simply
6108 rcfiles (short for resource configuration file).
6108 rcfiles (short for resource configuration file).
6109 \end_layout
6109 \end_layout
6110
6110
6111 \begin_layout Standard
6111 \begin_layout Standard
6112 The syntax of an rcfile is one of key-value pairs separated by whitespace,
6112 The syntax of an rcfile is one of key-value pairs separated by whitespace,
6113 one per line.
6113 one per line.
6114 Lines beginning with a
6114 Lines beginning with a
6115 \family typewriter
6115 \family typewriter
6116 #
6116 #
6117 \family default
6117 \family default
6118 are ignored as comments, but comments can
6118 are ignored as comments, but comments can
6119 \series bold
6119 \series bold
6120 not
6120 not
6121 \series default
6121 \series default
6122 be put on lines with data (the parser is fairly primitive).
6122 be put on lines with data (the parser is fairly primitive).
6123 Note that these are not python files, and this is deliberate, because it
6123 Note that these are not python files, and this is deliberate, because it
6124 allows us to do some things which would be quite tricky to implement if
6124 allows us to do some things which would be quite tricky to implement if
6125 they were normal python files.
6125 they were normal python files.
6126 \end_layout
6126 \end_layout
6127
6127
6128 \begin_layout Standard
6128 \begin_layout Standard
6129 First, an rcfile can contain permanent default values for almost all command
6129 First, an rcfile can contain permanent default values for almost all command
6130 line options (except things like
6130 line options (except things like
6131 \family typewriter
6131 \family typewriter
6132 -help
6132 -help
6133 \family default
6133 \family default
6134 or
6134 or
6135 \family typewriter
6135 \family typewriter
6136 -Version
6136 -Version
6137 \family default
6137 \family default
6138 ).
6138 ).
6139 Sec\InsetSpace ~
6139 Sec\InsetSpace ~
6140
6140
6141 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
6141 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
6142
6142
6143 \end_inset
6143 \end_inset
6144
6144
6145 contains a description of all command-line options.
6145 contains a description of all command-line options.
6146 However, values you explicitly specify at the command line override the
6146 However, values you explicitly specify at the command line override the
6147 values defined in the rcfile.
6147 values defined in the rcfile.
6148 \end_layout
6148 \end_layout
6149
6149
6150 \begin_layout Standard
6150 \begin_layout Standard
6151 Besides command line option values, the rcfile can specify values for certain
6151 Besides command line option values, the rcfile can specify values for certain
6152 extra special options which are not available at the command line.
6152 extra special options which are not available at the command line.
6153 These options are briefly described below.
6153 These options are briefly described below.
6154
6154
6155 \end_layout
6155 \end_layout
6156
6156
6157 \begin_layout Standard
6157 \begin_layout Standard
6158 Each of these options may appear as many times as you need it in the file.
6158 Each of these options may appear as many times as you need it in the file.
6159 \end_layout
6159 \end_layout
6160
6160
6161 \begin_layout List
6161 \begin_layout List
6162 \labelwidthstring 00.00.0000
6162 \labelwidthstring 00.00.0000
6163
6163
6164 \family typewriter
6164 \family typewriter
6165 \series bold
6165 \series bold
6166 include\InsetSpace ~
6166 include\InsetSpace ~
6167 <file1>\InsetSpace ~
6167 <file1>\InsetSpace ~
6168 <file2>\InsetSpace ~
6168 <file2>\InsetSpace ~
6169 ...
6169 ...
6170 \family default
6170 \family default
6171 \series default
6171 \series default
6172 : you can name
6172 : you can name
6173 \emph on
6173 \emph on
6174 other
6174 other
6175 \emph default
6175 \emph default
6176 rcfiles you want to recursively load up to 15 levels (don't use the
6176 rcfiles you want to recursively load up to 15 levels (don't use the
6177 \family typewriter
6177 \family typewriter
6178 <>
6178 <>
6179 \family default
6179 \family default
6180 brackets in your names!).
6180 brackets in your names!).
6181 This feature allows you to define a 'base' rcfile with general options
6181 This feature allows you to define a 'base' rcfile with general options
6182 and special-purpose files which can be loaded only when needed with particular
6182 and special-purpose files which can be loaded only when needed with particular
6183 configuration options.
6183 configuration options.
6184 To make this more convenient, IPython accepts the
6184 To make this more convenient, IPython accepts the
6185 \family typewriter
6185 \family typewriter
6186 -profile <name>
6186 -profile <name>
6187 \family default
6187 \family default
6188 option (abbreviates to
6188 option (abbreviates to
6189 \family typewriter
6189 \family typewriter
6190 -p <name
6190 -p <name
6191 \family default
6191 \family default
6192 >)
6192 >)
6193 \family typewriter
6193 \family typewriter
6194 which
6194 which
6195 \family default
6195 \family default
6196 tells it to look for an rcfile named
6196 tells it to look for an rcfile named
6197 \family typewriter
6197 \family typewriter
6198 ipythonrc-<name>
6198 ipythonrc-<name>
6199 \family default
6199 \family default
6200 .
6200 .
6201
6201
6202 \end_layout
6202 \end_layout
6203
6203
6204 \begin_layout List
6204 \begin_layout List
6205 \labelwidthstring 00.00.0000
6205 \labelwidthstring 00.00.0000
6206
6206
6207 \family typewriter
6207 \family typewriter
6208 \series bold
6208 \series bold
6209 import_mod\InsetSpace ~
6209 import_mod\InsetSpace ~
6210 <mod1>\InsetSpace ~
6210 <mod1>\InsetSpace ~
6211 <mod2>\InsetSpace ~
6211 <mod2>\InsetSpace ~
6212 ...
6212 ...
6213 \family default
6213 \family default
6214 \series default
6214 \series default
6215 : import modules with '
6215 : import modules with '
6216 \family typewriter
6216 \family typewriter
6217 import
6217 import
6218 \family default
6218 \family default
6219
6219
6220 \family typewriter
6220 \family typewriter
6221 <mod1>,<mod2>,...
6221 <mod1>,<mod2>,...
6222 \family default
6222 \family default
6223 '
6223 '
6224 \end_layout
6224 \end_layout
6225
6225
6226 \begin_layout List
6226 \begin_layout List
6227 \labelwidthstring 00.00.0000
6227 \labelwidthstring 00.00.0000
6228
6228
6229 \family typewriter
6229 \family typewriter
6230 \series bold
6230 \series bold
6231 import_some\InsetSpace ~
6231 import_some\InsetSpace ~
6232 <mod>\InsetSpace ~
6232 <mod>\InsetSpace ~
6233 <f1>\InsetSpace ~
6233 <f1>\InsetSpace ~
6234 <f2>\InsetSpace ~
6234 <f2>\InsetSpace ~
6235 ...
6235 ...
6236 \family default
6236 \family default
6237 \series default
6237 \series default
6238 : import functions with '
6238 : import functions with '
6239 \family typewriter
6239 \family typewriter
6240 from <mod> import
6240 from <mod> import
6241 \family default
6241 \family default
6242
6242
6243 \family typewriter
6243 \family typewriter
6244 <f1>,<f2>,...
6244 <f1>,<f2>,...
6245 \family default
6245 \family default
6246 '
6246 '
6247 \end_layout
6247 \end_layout
6248
6248
6249 \begin_layout List
6249 \begin_layout List
6250 \labelwidthstring 00.00.0000
6250 \labelwidthstring 00.00.0000
6251
6251
6252 \family typewriter
6252 \family typewriter
6253 \series bold
6253 \series bold
6254 import_all\InsetSpace ~
6254 import_all\InsetSpace ~
6255 <mod1>\InsetSpace ~
6255 <mod1>\InsetSpace ~
6256 <mod2>\InsetSpace ~
6256 <mod2>\InsetSpace ~
6257 ...
6257 ...
6258 \family default
6258 \family default
6259 \series default
6259 \series default
6260 : for each module listed import functions with '
6260 : for each module listed import functions with '
6261 \family typewriter
6261 \family typewriter
6262 from <mod> import *
6262 from <mod> import *
6263 \family default
6263 \family default
6264 '
6264 '
6265 \end_layout
6265 \end_layout
6266
6266
6267 \begin_layout List
6267 \begin_layout List
6268 \labelwidthstring 00.00.0000
6268 \labelwidthstring 00.00.0000
6269
6269
6270 \family typewriter
6270 \family typewriter
6271 \series bold
6271 \series bold
6272 execute\InsetSpace ~
6272 execute\InsetSpace ~
6273 <python\InsetSpace ~
6273 <python\InsetSpace ~
6274 code>
6274 code>
6275 \family default
6275 \family default
6276 \series default
6276 \series default
6277 : give any single-line python code to be executed.
6277 : give any single-line python code to be executed.
6278 \end_layout
6278 \end_layout
6279
6279
6280 \begin_layout List
6280 \begin_layout List
6281 \labelwidthstring 00.00.0000
6281 \labelwidthstring 00.00.0000
6282
6282
6283 \family typewriter
6283 \family typewriter
6284 \series bold
6284 \series bold
6285 execfile\InsetSpace ~
6285 execfile\InsetSpace ~
6286 <filename>
6286 <filename>
6287 \family default
6287 \family default
6288 \series default
6288 \series default
6289 : execute the python file given with an '
6289 : execute the python file given with an '
6290 \family typewriter
6290 \family typewriter
6291 execfile(filename)
6291 execfile(filename)
6292 \family default
6292 \family default
6293 ' command.
6293 ' command.
6294 Username expansion is performed on the given names.
6294 Username expansion is performed on the given names.
6295 So if you need any amount of extra fancy customization that won't fit in
6295 So if you need any amount of extra fancy customization that won't fit in
6296 any of the above 'canned' options, you can just put it in a separate python
6296 any of the above 'canned' options, you can just put it in a separate python
6297 file and execute it.
6297 file and execute it.
6298 \end_layout
6298 \end_layout
6299
6299
6300 \begin_layout List
6300 \begin_layout List
6301 \labelwidthstring 00.00.0000
6301 \labelwidthstring 00.00.0000
6302
6302
6303 \family typewriter
6303 \family typewriter
6304 \series bold
6304 \series bold
6305 alias\InsetSpace ~
6305 alias\InsetSpace ~
6306 <alias_def>
6306 <alias_def>
6307 \family default
6307 \family default
6308 \series default
6308 \series default
6309 : this is equivalent to calling '
6309 : this is equivalent to calling '
6310 \family typewriter
6310 \family typewriter
6311 %alias\InsetSpace ~
6311 %alias\InsetSpace ~
6312 <alias_def>
6312 <alias_def>
6313 \family default
6313 \family default
6314 ' at the IPython command line.
6314 ' at the IPython command line.
6315 This way, from within IPython you can do common system tasks without having
6315 This way, from within IPython you can do common system tasks without having
6316 to exit it or use the
6316 to exit it or use the
6317 \family typewriter
6317 \family typewriter
6318 !
6318 !
6319 \family default
6319 \family default
6320 escape.
6320 escape.
6321 IPython isn't meant to be a shell replacement, but it is often very useful
6321 IPython isn't meant to be a shell replacement, but it is often very useful
6322 to be able to do things with files while testing code.
6322 to be able to do things with files while testing code.
6323 This gives you the flexibility to have within IPython any aliases you may
6323 This gives you the flexibility to have within IPython any aliases you may
6324 be used to under your normal system shell.
6324 be used to under your normal system shell.
6325 \end_layout
6325 \end_layout
6326
6326
6327 \begin_layout Subsection
6327 \begin_layout Subsection
6328 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
6328 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
6329
6329
6330 \end_inset
6330 \end_inset
6331
6331
6332 Sample
6332 Sample
6333 \family typewriter
6333 \family typewriter
6334 ipythonrc
6334 ipythonrc
6335 \family default
6335 \family default
6336 file
6336 file
6337 \end_layout
6337 \end_layout
6338
6338
6339 \begin_layout Standard
6339 \begin_layout Standard
6340 The default rcfile, called
6340 The default rcfile, called
6341 \family typewriter
6341 \family typewriter
6342 ipythonrc
6342 ipythonrc
6343 \family default
6343 \family default
6344 and supplied in your
6344 and supplied in your
6345 \family typewriter
6345 \family typewriter
6346 IPYTHONDIR
6346 IPYTHONDIR
6347 \family default
6347 \family default
6348 directory contains lots of comments on all of these options.
6348 directory contains lots of comments on all of these options.
6349 We reproduce it here for reference:
6349 We reproduce it here for reference:
6350 \end_layout
6350 \end_layout
6351
6351
6352 \begin_layout Standard
6352 \begin_layout Standard
6353 \begin_inset ERT
6353 \begin_inset ERT
6354 status open
6354 status open
6355
6355
6356 \begin_layout Standard
6356 \begin_layout Standard
6357
6357
6358
6358
6359 \backslash
6359 \backslash
6360 codelist{../IPython/UserConfig/ipythonrc}
6360 codelist{../IPython/UserConfig/ipythonrc}
6361 \end_layout
6361 \end_layout
6362
6362
6363 \end_inset
6363 \end_inset
6364
6364
6365
6365
6366 \end_layout
6366 \end_layout
6367
6367
6368 \begin_layout Subsection
6368 \begin_layout Subsection
6369 \begin_inset LatexCommand \label{sec:prompts}
6369 \begin_inset LatexCommand \label{sec:prompts}
6370
6370
6371 \end_inset
6371 \end_inset
6372
6372
6373 Fine-tuning your prompt
6373 Fine-tuning your prompt
6374 \end_layout
6374 \end_layout
6375
6375
6376 \begin_layout Standard
6376 \begin_layout Standard
6377 IPython's prompts can be customized using a syntax similar to that of the
6377 IPython's prompts can be customized using a syntax similar to that of the
6378
6378
6379 \family typewriter
6379 \family typewriter
6380 bash
6380 bash
6381 \family default
6381 \family default
6382 shell.
6382 shell.
6383 Many of
6383 Many of
6384 \family typewriter
6384 \family typewriter
6385 bash
6385 bash
6386 \family default
6386 \family default
6387 's escapes are supported, as well as a few additional ones.
6387 's escapes are supported, as well as a few additional ones.
6388 We list them below:
6388 We list them below:
6389 \end_layout
6389 \end_layout
6390
6390
6391 \begin_layout Description
6391 \begin_layout Description
6392
6392
6393 \backslash
6393 \backslash
6394 # the prompt/history count number.
6394 # the prompt/history count number.
6395 This escape is automatically wrapped in the coloring codes for the currently
6395 This escape is automatically wrapped in the coloring codes for the currently
6396 active color scheme.
6396 active color scheme.
6397 \end_layout
6397 \end_layout
6398
6398
6399 \begin_layout Description
6399 \begin_layout Description
6400
6400
6401 \backslash
6401 \backslash
6402 N the 'naked' prompt/history count number: this is just the number itself,
6402 N the 'naked' prompt/history count number: this is just the number itself,
6403 without any coloring applied to it.
6403 without any coloring applied to it.
6404 This lets you produce numbered prompts with your own colors.
6404 This lets you produce numbered prompts with your own colors.
6405 \end_layout
6405 \end_layout
6406
6406
6407 \begin_layout Description
6407 \begin_layout Description
6408
6408
6409 \backslash
6409 \backslash
6410 D the prompt/history count, with the actual digits replaced by dots.
6410 D the prompt/history count, with the actual digits replaced by dots.
6411 Used mainly in continuation prompts (prompt_in2)
6411 Used mainly in continuation prompts (prompt_in2)
6412 \end_layout
6412 \end_layout
6413
6413
6414 \begin_layout Description
6414 \begin_layout Description
6415
6415
6416 \backslash
6416 \backslash
6417 w the current working directory
6417 w the current working directory
6418 \end_layout
6418 \end_layout
6419
6419
6420 \begin_layout Description
6420 \begin_layout Description
6421
6421
6422 \backslash
6422 \backslash
6423 W the basename of current working directory
6423 W the basename of current working directory
6424 \end_layout
6424 \end_layout
6425
6425
6426 \begin_layout Description
6426 \begin_layout Description
6427
6427
6428 \backslash
6428 \backslash
6429 X
6429 X
6430 \emph on
6430 \emph on
6431 n
6431 n
6432 \emph default
6432 \emph default
6433 where
6433 where
6434 \begin_inset Formula $n=0\ldots5.$
6434 \begin_inset Formula $n=0\ldots5.$
6435 \end_inset
6435 \end_inset
6436
6436
6437 The current working directory, with
6437 The current working directory, with
6438 \family typewriter
6438 \family typewriter
6439 $HOME
6439 $HOME
6440 \family default
6440 \family default
6441 replaced by
6441 replaced by
6442 \family typewriter
6442 \family typewriter
6443 ~
6443 ~
6444 \family default
6444 \family default
6445 , and filtered out to contain only
6445 , and filtered out to contain only
6446 \begin_inset Formula $n$
6446 \begin_inset Formula $n$
6447 \end_inset
6447 \end_inset
6448
6448
6449 path elements
6449 path elements
6450 \end_layout
6450 \end_layout
6451
6451
6452 \begin_layout Description
6452 \begin_layout Description
6453
6453
6454 \backslash
6454 \backslash
6455 Y
6455 Y
6456 \emph on
6456 \emph on
6457 n
6457 n
6458 \emph default
6458 \emph default
6459 Similar to
6459 Similar to
6460 \backslash
6460 \backslash
6461 X
6461 X
6462 \emph on
6462 \emph on
6463 n
6463 n
6464 \emph default
6464 \emph default
6465 , but with the
6465 , but with the
6466 \begin_inset Formula $n+1$
6466 \begin_inset Formula $n+1$
6467 \end_inset
6467 \end_inset
6468
6468
6469 element included if it is
6469 element included if it is
6470 \family typewriter
6470 \family typewriter
6471 ~
6471 ~
6472 \family default
6472 \family default
6473 (this is similar to the behavior of the %c
6473 (this is similar to the behavior of the %c
6474 \emph on
6474 \emph on
6475 n
6475 n
6476 \emph default
6476 \emph default
6477 escapes in
6477 escapes in
6478 \family typewriter
6478 \family typewriter
6479 tcsh
6479 tcsh
6480 \family default
6480 \family default
6481 )
6481 )
6482 \end_layout
6482 \end_layout
6483
6483
6484 \begin_layout Description
6484 \begin_layout Description
6485
6485
6486 \backslash
6486 \backslash
6487 u the username of the current user
6487 u the username of the current user
6488 \end_layout
6488 \end_layout
6489
6489
6490 \begin_layout Description
6490 \begin_layout Description
6491
6491
6492 \backslash
6492 \backslash
6493 $ if the effective UID is 0, a #, otherwise a $
6493 $ if the effective UID is 0, a #, otherwise a $
6494 \end_layout
6494 \end_layout
6495
6495
6496 \begin_layout Description
6496 \begin_layout Description
6497
6497
6498 \backslash
6498 \backslash
6499 h the hostname up to the first `.'
6499 h the hostname up to the first `.'
6500 \end_layout
6500 \end_layout
6501
6501
6502 \begin_layout Description
6502 \begin_layout Description
6503
6503
6504 \backslash
6504 \backslash
6505 H the hostname
6505 H the hostname
6506 \end_layout
6506 \end_layout
6507
6507
6508 \begin_layout Description
6508 \begin_layout Description
6509
6509
6510 \backslash
6510 \backslash
6511 n a newline
6511 n a newline
6512 \end_layout
6512 \end_layout
6513
6513
6514 \begin_layout Description
6514 \begin_layout Description
6515
6515
6516 \backslash
6516 \backslash
6517 r a carriage return
6517 r a carriage return
6518 \end_layout
6518 \end_layout
6519
6519
6520 \begin_layout Description
6520 \begin_layout Description
6521
6521
6522 \backslash
6522 \backslash
6523 v IPython version string
6523 v IPython version string
6524 \end_layout
6524 \end_layout
6525
6525
6526 \begin_layout Standard
6526 \begin_layout Standard
6527 In addition to these, ANSI color escapes can be insterted into the prompts,
6527 In addition to these, ANSI color escapes can be insterted into the prompts,
6528 as
6528 as
6529 \family typewriter
6529 \family typewriter
6530
6530
6531 \backslash
6531 \backslash
6532 C_
6532 C_
6533 \emph on
6533 \emph on
6534 ColorName
6534 ColorName
6535 \family default
6535 \family default
6536 \emph default
6536 \emph default
6537 .
6537 .
6538 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
6538 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
6539 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
6539 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
6540 Normal, Purple, Red, White, Yellow.
6540 Normal, Purple, Red, White, Yellow.
6541 \end_layout
6541 \end_layout
6542
6542
6543 \begin_layout Standard
6543 \begin_layout Standard
6544 Finally, IPython supports the evaluation of arbitrary expressions in your
6544 Finally, IPython supports the evaluation of arbitrary expressions in your
6545 prompt string.
6545 prompt string.
6546 The prompt strings are evaluated through the syntax of PEP 215, but basically
6546 The prompt strings are evaluated through the syntax of PEP 215, but basically
6547 you can use
6547 you can use
6548 \family typewriter
6548 \family typewriter
6549 $x.y
6549 $x.y
6550 \family default
6550 \family default
6551 to expand the value of
6551 to expand the value of
6552 \family typewriter
6552 \family typewriter
6553 x.y
6553 x.y
6554 \family default
6554 \family default
6555 , and for more complicated expressions you can use braces:
6555 , and for more complicated expressions you can use braces:
6556 \family typewriter
6556 \family typewriter
6557 ${foo()+x}
6557 ${foo()+x}
6558 \family default
6558 \family default
6559 will call function
6559 will call function
6560 \family typewriter
6560 \family typewriter
6561 foo
6561 foo
6562 \family default
6562 \family default
6563 and add to it the value of
6563 and add to it the value of
6564 \family typewriter
6564 \family typewriter
6565 x
6565 x
6566 \family default
6566 \family default
6567 , before putting the result into your prompt.
6567 , before putting the result into your prompt.
6568 For example, using
6568 For example, using
6569 \newline
6569 \newline
6570
6570
6571 \family typewriter
6571 \family typewriter
6572 prompt_in1 '${commands.getoutput("uptime")}
6572 prompt_in1 '${commands.getoutput("uptime")}
6573 \backslash
6573 \backslash
6574 nIn [
6574 nIn [
6575 \backslash
6575 \backslash
6576 #]: '
6576 #]: '
6577 \newline
6577 \newline
6578
6578
6579 \family default
6579 \family default
6580 will print the result of the uptime command on each prompt (assuming the
6580 will print the result of the uptime command on each prompt (assuming the
6581
6581
6582 \family typewriter
6582 \family typewriter
6583 commands
6583 commands
6584 \family default
6584 \family default
6585 module has been imported in your
6585 module has been imported in your
6586 \family typewriter
6586 \family typewriter
6587 ipythonrc
6587 ipythonrc
6588 \family default
6588 \family default
6589 file).
6589 file).
6590 \end_layout
6590 \end_layout
6591
6591
6592 \begin_layout Subsubsection
6592 \begin_layout Subsubsection
6593 Prompt examples
6593 Prompt examples
6594 \end_layout
6594 \end_layout
6595
6595
6596 \begin_layout Standard
6596 \begin_layout Standard
6597 The following options in an ipythonrc file will give you IPython's default
6597 The following options in an ipythonrc file will give you IPython's default
6598 prompts:
6598 prompts:
6599 \end_layout
6599 \end_layout
6600
6600
6601 \begin_layout Standard
6601 \begin_layout Standard
6602
6602
6603 \family typewriter
6603 \family typewriter
6604 prompt_in1 'In [
6604 prompt_in1 'In [
6605 \backslash
6605 \backslash
6606 #]:'
6606 #]:'
6607 \newline
6607 \newline
6608 prompt_in2 '\InsetSpace ~
6608 prompt_in2 '\InsetSpace ~
6609 \InsetSpace ~
6609 \InsetSpace ~
6610 \InsetSpace ~
6610 \InsetSpace ~
6611 .
6611 .
6612 \backslash
6612 \backslash
6613 D.:'
6613 D.:'
6614 \newline
6614 \newline
6615 prompt_out 'Out[
6615 prompt_out 'Out[
6616 \backslash
6616 \backslash
6617 #]:'
6617 #]:'
6618 \end_layout
6618 \end_layout
6619
6619
6620 \begin_layout Standard
6620 \begin_layout Standard
6621 which look like this:
6621 which look like this:
6622 \end_layout
6622 \end_layout
6623
6623
6624 \begin_layout Standard
6624 \begin_layout Standard
6625
6625
6626 \family typewriter
6626 \family typewriter
6627 In [1]: 1+2
6627 In [1]: 1+2
6628 \newline
6628 \newline
6629 Out[1]: 3
6629 Out[1]: 3
6630 \end_layout
6630 \end_layout
6631
6631
6632 \begin_layout Standard
6632 \begin_layout Standard
6633
6633
6634 \family typewriter
6634 \family typewriter
6635 In [2]: for i in (1,2,3):
6635 In [2]: for i in (1,2,3):
6636 \newline
6636 \newline
6637
6637
6638 \begin_inset ERT
6638 \begin_inset ERT
6639 status collapsed
6639 status collapsed
6640
6640
6641 \begin_layout Standard
6641 \begin_layout Standard
6642
6642
6643
6643
6644 \backslash
6644 \backslash
6645 hspace*{0mm}
6645 hspace*{0mm}
6646 \end_layout
6646 \end_layout
6647
6647
6648 \end_inset
6648 \end_inset
6649
6649
6650 \InsetSpace ~
6650 \InsetSpace ~
6651 \InsetSpace ~
6651 \InsetSpace ~
6652 \InsetSpace ~
6652 \InsetSpace ~
6653 ...: \InsetSpace ~
6653 ...: \InsetSpace ~
6654 \InsetSpace ~
6654 \InsetSpace ~
6655 \InsetSpace ~
6655 \InsetSpace ~
6656 \InsetSpace ~
6656 \InsetSpace ~
6657 print i,
6657 print i,
6658 \newline
6658 \newline
6659
6659
6660 \begin_inset ERT
6660 \begin_inset ERT
6661 status collapsed
6661 status collapsed
6662
6662
6663 \begin_layout Standard
6663 \begin_layout Standard
6664
6664
6665
6665
6666 \backslash
6666 \backslash
6667 hspace*{0mm}
6667 hspace*{0mm}
6668 \end_layout
6668 \end_layout
6669
6669
6670 \end_inset
6670 \end_inset
6671
6671
6672 \InsetSpace ~
6672 \InsetSpace ~
6673 \InsetSpace ~
6673 \InsetSpace ~
6674 \InsetSpace ~
6674 \InsetSpace ~
6675 ...:
6675 ...:
6676 \newline
6676 \newline
6677 1 2 3
6677 1 2 3
6678 \end_layout
6678 \end_layout
6679
6679
6680 \begin_layout Standard
6680 \begin_layout Standard
6681 These will give you a very colorful prompt with path information:
6681 These will give you a very colorful prompt with path information:
6682 \end_layout
6682 \end_layout
6683
6683
6684 \begin_layout Standard
6684 \begin_layout Standard
6685
6685
6686 \family typewriter
6686 \family typewriter
6687 #prompt_in1 '
6687 #prompt_in1 '
6688 \backslash
6688 \backslash
6689 C_Red
6689 C_Red
6690 \backslash
6690 \backslash
6691 u
6691 u
6692 \backslash
6692 \backslash
6693 C_Blue[
6693 C_Blue[
6694 \backslash
6694 \backslash
6695 C_Cyan
6695 C_Cyan
6696 \backslash
6696 \backslash
6697 Y1
6697 Y1
6698 \backslash
6698 \backslash
6699 C_Blue]
6699 C_Blue]
6700 \backslash
6700 \backslash
6701 C_LightGreen
6701 C_LightGreen
6702 \backslash
6702 \backslash
6703 #>'
6703 #>'
6704 \newline
6704 \newline
6705 prompt_in2 ' ..
6705 prompt_in2 ' ..
6706 \backslash
6706 \backslash
6707 D>'
6707 D>'
6708 \newline
6708 \newline
6709 prompt_out '<
6709 prompt_out '<
6710 \backslash
6710 \backslash
6711 #>'
6711 #>'
6712 \end_layout
6712 \end_layout
6713
6713
6714 \begin_layout Standard
6714 \begin_layout Standard
6715 which look like this:
6715 which look like this:
6716 \end_layout
6716 \end_layout
6717
6717
6718 \begin_layout Standard
6718 \begin_layout Standard
6719
6719
6720 \family typewriter
6720 \family typewriter
6721 \color red
6721 \color red
6722 fperez
6722 fperez
6723 \color blue
6723 \color blue
6724 [
6724 [
6725 \color cyan
6725 \color cyan
6726 ~/ipython
6726 ~/ipython
6727 \color blue
6727 \color blue
6728 ]
6728 ]
6729 \color green
6729 \color green
6730 1>
6730 1>
6731 \color none
6731 \color none
6732 1+2
6732 1+2
6733 \newline
6733 \newline
6734
6734
6735 \begin_inset ERT
6735 \begin_inset ERT
6736 status collapsed
6736 status collapsed
6737
6737
6738 \begin_layout Standard
6738 \begin_layout Standard
6739
6739
6740
6740
6741 \backslash
6741 \backslash
6742 hspace*{0mm}
6742 hspace*{0mm}
6743 \end_layout
6743 \end_layout
6744
6744
6745 \end_inset
6745 \end_inset
6746
6746
6747 \InsetSpace ~
6747 \InsetSpace ~
6748 \InsetSpace ~
6748 \InsetSpace ~
6749 \InsetSpace ~
6749 \InsetSpace ~
6750 \InsetSpace ~
6750 \InsetSpace ~
6751 \InsetSpace ~
6751 \InsetSpace ~
6752 \InsetSpace ~
6752 \InsetSpace ~
6753 \InsetSpace ~
6753 \InsetSpace ~
6754 \InsetSpace ~
6754 \InsetSpace ~
6755 \InsetSpace ~
6755 \InsetSpace ~
6756 \InsetSpace ~
6756 \InsetSpace ~
6757 \InsetSpace ~
6757 \InsetSpace ~
6758 \InsetSpace ~
6758 \InsetSpace ~
6759 \InsetSpace ~
6759 \InsetSpace ~
6760 \InsetSpace ~
6760 \InsetSpace ~
6761 \InsetSpace ~
6761 \InsetSpace ~
6762 \InsetSpace ~
6762 \InsetSpace ~
6763
6763
6764 \color red
6764 \color red
6765 <1>
6765 <1>
6766 \color none
6766 \color none
6767 3
6767 3
6768 \newline
6768 \newline
6769
6769
6770 \color red
6770 \color red
6771 fperez
6771 fperez
6772 \color blue
6772 \color blue
6773 [
6773 [
6774 \color cyan
6774 \color cyan
6775 ~/ipython
6775 ~/ipython
6776 \color blue
6776 \color blue
6777 ]
6777 ]
6778 \color green
6778 \color green
6779 2>
6779 2>
6780 \color none
6780 \color none
6781 for i in (1,2,3):
6781 for i in (1,2,3):
6782 \newline
6782 \newline
6783
6783
6784 \begin_inset ERT
6784 \begin_inset ERT
6785 status collapsed
6785 status collapsed
6786
6786
6787 \begin_layout Standard
6787 \begin_layout Standard
6788
6788
6789
6789
6790 \backslash
6790 \backslash
6791 hspace*{0mm}
6791 hspace*{0mm}
6792 \end_layout
6792 \end_layout
6793
6793
6794 \end_inset
6794 \end_inset
6795
6795
6796 \InsetSpace ~
6796 \InsetSpace ~
6797 \InsetSpace ~
6797 \InsetSpace ~
6798 \InsetSpace ~
6798 \InsetSpace ~
6799 \InsetSpace ~
6799 \InsetSpace ~
6800 \InsetSpace ~
6800 \InsetSpace ~
6801 \InsetSpace ~
6801 \InsetSpace ~
6802 \InsetSpace ~
6802 \InsetSpace ~
6803 \InsetSpace ~
6803 \InsetSpace ~
6804 \InsetSpace ~
6804 \InsetSpace ~
6805 \InsetSpace ~
6805 \InsetSpace ~
6806 \InsetSpace ~
6806 \InsetSpace ~
6807 \InsetSpace ~
6807 \InsetSpace ~
6808 \InsetSpace ~
6808 \InsetSpace ~
6809 \InsetSpace ~
6809 \InsetSpace ~
6810 \InsetSpace ~
6810 \InsetSpace ~
6811
6811
6812 \color green
6812 \color green
6813 ...>
6813 ...>
6814 \color none
6814 \color none
6815 \InsetSpace ~
6815 \InsetSpace ~
6816 \InsetSpace ~
6816 \InsetSpace ~
6817 \InsetSpace ~
6817 \InsetSpace ~
6818 \InsetSpace ~
6818 \InsetSpace ~
6819 print i,
6819 print i,
6820 \newline
6820 \newline
6821
6821
6822 \begin_inset ERT
6822 \begin_inset ERT
6823 status collapsed
6823 status collapsed
6824
6824
6825 \begin_layout Standard
6825 \begin_layout Standard
6826
6826
6827
6827
6828 \backslash
6828 \backslash
6829 hspace*{0mm}
6829 hspace*{0mm}
6830 \end_layout
6830 \end_layout
6831
6831
6832 \end_inset
6832 \end_inset
6833
6833
6834 \InsetSpace ~
6834 \InsetSpace ~
6835 \InsetSpace ~
6835 \InsetSpace ~
6836 \InsetSpace ~
6836 \InsetSpace ~
6837 \InsetSpace ~
6837 \InsetSpace ~
6838 \InsetSpace ~
6838 \InsetSpace ~
6839 \InsetSpace ~
6839 \InsetSpace ~
6840 \InsetSpace ~
6840 \InsetSpace ~
6841 \InsetSpace ~
6841 \InsetSpace ~
6842 \InsetSpace ~
6842 \InsetSpace ~
6843 \InsetSpace ~
6843 \InsetSpace ~
6844 \InsetSpace ~
6844 \InsetSpace ~
6845 \InsetSpace ~
6845 \InsetSpace ~
6846 \InsetSpace ~
6846 \InsetSpace ~
6847 \InsetSpace ~
6847 \InsetSpace ~
6848 \InsetSpace ~
6848 \InsetSpace ~
6849
6849
6850 \color green
6850 \color green
6851 ...>
6851 ...>
6852 \color none
6852 \color none
6853
6853
6854 \newline
6854 \newline
6855 1 2 3
6855 1 2 3
6856 \end_layout
6856 \end_layout
6857
6857
6858 \begin_layout Standard
6858 \begin_layout Standard
6859 The following shows the usage of dynamic expression evaluation:
6859 The following shows the usage of dynamic expression evaluation:
6860 \end_layout
6860 \end_layout
6861
6861
6862 \begin_layout Subsection
6862 \begin_layout Subsection
6863 \begin_inset LatexCommand \label{sec:profiles}
6863 \begin_inset LatexCommand \label{sec:profiles}
6864
6864
6865 \end_inset
6865 \end_inset
6866
6866
6867 IPython profiles
6867 IPython profiles
6868 \end_layout
6868 \end_layout
6869
6869
6870 \begin_layout Standard
6870 \begin_layout Standard
6871 As we already mentioned, IPython supports the
6871 As we already mentioned, IPython supports the
6872 \family typewriter
6872 \family typewriter
6873 -profile
6873 -profile
6874 \family default
6874 \family default
6875 command-line option (see sec.
6875 command-line option (see sec.
6876
6876
6877 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
6877 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
6878
6878
6879 \end_inset
6879 \end_inset
6880
6880
6881 ).
6881 ).
6882 A profile is nothing more than a particular configuration file like your
6882 A profile is nothing more than a particular configuration file like your
6883 basic
6883 basic
6884 \family typewriter
6884 \family typewriter
6885 ipythonrc
6885 ipythonrc
6886 \family default
6886 \family default
6887 one, but with particular customizations for a specific purpose.
6887 one, but with particular customizations for a specific purpose.
6888 When you start IPython with '
6888 When you start IPython with '
6889 \family typewriter
6889 \family typewriter
6890 ipython -profile <name>
6890 ipython -profile <name>
6891 \family default
6891 \family default
6892 ', it assumes that in your
6892 ', it assumes that in your
6893 \family typewriter
6893 \family typewriter
6894 IPYTHONDIR
6894 IPYTHONDIR
6895 \family default
6895 \family default
6896 there is a file called
6896 there is a file called
6897 \family typewriter
6897 \family typewriter
6898 ipythonrc-<name>
6898 ipythonrc-<name>
6899 \family default
6899 \family default
6900 , and loads it instead of the normal
6900 , and loads it instead of the normal
6901 \family typewriter
6901 \family typewriter
6902 ipythonrc
6902 ipythonrc
6903 \family default
6903 \family default
6904 .
6904 .
6905 \end_layout
6905 \end_layout
6906
6906
6907 \begin_layout Standard
6907 \begin_layout Standard
6908 This system allows you to maintain multiple configurations which load modules,
6908 This system allows you to maintain multiple configurations which load modules,
6909 set options, define functions, etc.
6909 set options, define functions, etc.
6910 suitable for different tasks and activate them in a very simple manner.
6910 suitable for different tasks and activate them in a very simple manner.
6911 In order to avoid having to repeat all of your basic options (common things
6911 In order to avoid having to repeat all of your basic options (common things
6912 that don't change such as your color preferences, for example), any profile
6912 that don't change such as your color preferences, for example), any profile
6913 can include another configuration file.
6913 can include another configuration file.
6914 The most common way to use profiles is then to have each one include your
6914 The most common way to use profiles is then to have each one include your
6915 basic
6915 basic
6916 \family typewriter
6916 \family typewriter
6917 ipythonrc
6917 ipythonrc
6918 \family default
6918 \family default
6919 file as a starting point, and then add further customizations.
6919 file as a starting point, and then add further customizations.
6920 \end_layout
6920 \end_layout
6921
6921
6922 \begin_layout Standard
6922 \begin_layout Standard
6923 In sections
6923 In sections
6924 \begin_inset LatexCommand \ref{sec:syntax-extensions}
6924 \begin_inset LatexCommand \ref{sec:syntax-extensions}
6925
6925
6926 \end_inset
6926 \end_inset
6927
6927
6928 and
6928 and
6929 \begin_inset LatexCommand \ref{sec:Gnuplot}
6929 \begin_inset LatexCommand \ref{sec:Gnuplot}
6930
6930
6931 \end_inset
6931 \end_inset
6932
6932
6933 we discuss some particular profiles which come as part of the standard
6933 we discuss some particular profiles which come as part of the standard
6934 IPython distribution.
6934 IPython distribution.
6935 You may also look in your
6935 You may also look in your
6936 \family typewriter
6936 \family typewriter
6937 IPYTHONDIR
6937 IPYTHONDIR
6938 \family default
6938 \family default
6939 directory, any file whose name begins with
6939 directory, any file whose name begins with
6940 \family typewriter
6940 \family typewriter
6941 ipythonrc-
6941 ipythonrc-
6942 \family default
6942 \family default
6943 is a profile.
6943 is a profile.
6944 You can use those as examples for further customizations to suit your own
6944 You can use those as examples for further customizations to suit your own
6945 needs.
6945 needs.
6946 \end_layout
6946 \end_layout
6947
6947
6948 \begin_layout Section
6948 \begin_layout Section
6949 \begin_inset OptArg
6949 \begin_inset OptArg
6950 status open
6950 status open
6951
6951
6952 \begin_layout Standard
6952 \begin_layout Standard
6953 IPython as default...
6953 IPython as default...
6954 \end_layout
6954 \end_layout
6955
6955
6956 \end_inset
6956 \end_inset
6957
6957
6958 IPython as your default Python environment
6958 IPython as your default Python environment
6959 \end_layout
6959 \end_layout
6960
6960
6961 \begin_layout Standard
6961 \begin_layout Standard
6962 Python honors the environment variable
6962 Python honors the environment variable
6963 \family typewriter
6963 \family typewriter
6964 PYTHONSTARTUP
6964 PYTHONSTARTUP
6965 \family default
6965 \family default
6966 and will execute at startup the file referenced by this variable.
6966 and will execute at startup the file referenced by this variable.
6967 If you put at the end of this file the following two lines of code:
6967 If you put at the end of this file the following two lines of code:
6968 \end_layout
6968 \end_layout
6969
6969
6970 \begin_layout Standard
6970 \begin_layout Standard
6971
6971
6972 \family typewriter
6972 \family typewriter
6973 import IPython
6973 import IPython
6974 \newline
6974 \newline
6975 IPython.Shell.IPShell().mainloop(sys_exit=1)
6975 IPython.Shell.IPShell().mainloop(sys_exit=1)
6976 \end_layout
6976 \end_layout
6977
6977
6978 \begin_layout Standard
6978 \begin_layout Standard
6979 then IPython will be your working environment anytime you start Python.
6979 then IPython will be your working environment anytime you start Python.
6980 The
6980 The
6981 \family typewriter
6981 \family typewriter
6982 sys_exit=1
6982 sys_exit=1
6983 \family default
6983 \family default
6984 is needed to have IPython issue a call to
6984 is needed to have IPython issue a call to
6985 \family typewriter
6985 \family typewriter
6986 sys.exit()
6986 sys.exit()
6987 \family default
6987 \family default
6988 when it finishes, otherwise you'll be back at the normal Python '
6988 when it finishes, otherwise you'll be back at the normal Python '
6989 \family typewriter
6989 \family typewriter
6990 >>>
6990 >>>
6991 \family default
6991 \family default
6992 ' prompt
6992 ' prompt
6993 \begin_inset Foot
6993 \begin_inset Foot
6994 status collapsed
6994 status collapsed
6995
6995
6996 \begin_layout Standard
6996 \begin_layout Standard
6997 Based on an idea by Holger Krekel.
6997 Based on an idea by Holger Krekel.
6998 \end_layout
6998 \end_layout
6999
6999
7000 \end_inset
7000 \end_inset
7001
7001
7002 .
7002 .
7003 \end_layout
7003 \end_layout
7004
7004
7005 \begin_layout Standard
7005 \begin_layout Standard
7006 This is probably useful to developers who manage multiple Python versions
7006 This is probably useful to developers who manage multiple Python versions
7007 and don't want to have correspondingly multiple IPython versions.
7007 and don't want to have correspondingly multiple IPython versions.
7008 Note that in this mode, there is no way to pass IPython any command-line
7008 Note that in this mode, there is no way to pass IPython any command-line
7009 options, as those are trapped first by Python itself.
7009 options, as those are trapped first by Python itself.
7010 \end_layout
7010 \end_layout
7011
7011
7012 \begin_layout Section
7012 \begin_layout Section
7013 \begin_inset LatexCommand \label{sec:embed}
7013 \begin_inset LatexCommand \label{sec:embed}
7014
7014
7015 \end_inset
7015 \end_inset
7016
7016
7017 Embedding IPython
7017 Embedding IPython
7018 \end_layout
7018 \end_layout
7019
7019
7020 \begin_layout Standard
7020 \begin_layout Standard
7021 It is possible to start an IPython instance
7021 It is possible to start an IPython instance
7022 \emph on
7022 \emph on
7023 inside
7023 inside
7024 \emph default
7024 \emph default
7025 your own Python programs.
7025 your own Python programs.
7026 This allows you to evaluate dynamically the state of your code, operate
7026 This allows you to evaluate dynamically the state of your code, operate
7027 with your variables, analyze them, etc.
7027 with your variables, analyze them, etc.
7028 Note however that any changes you make to values while in the shell do
7028 Note however that any changes you make to values while in the shell do
7029
7029
7030 \emph on
7030 \emph on
7031 not
7031 not
7032 \emph default
7032 \emph default
7033 propagate back to the running code, so it is safe to modify your values
7033 propagate back to the running code, so it is safe to modify your values
7034 because you won't break your code in bizarre ways by doing so.
7034 because you won't break your code in bizarre ways by doing so.
7035 \end_layout
7035 \end_layout
7036
7036
7037 \begin_layout Standard
7037 \begin_layout Standard
7038 This feature allows you to easily have a fully functional python environment
7038 This feature allows you to easily have a fully functional python environment
7039 for doing object introspection anywhere in your code with a simple function
7039 for doing object introspection anywhere in your code with a simple function
7040 call.
7040 call.
7041 In some cases a simple print statement is enough, but if you need to do
7041 In some cases a simple print statement is enough, but if you need to do
7042 more detailed analysis of a code fragment this feature can be very valuable.
7042 more detailed analysis of a code fragment this feature can be very valuable.
7043 \end_layout
7043 \end_layout
7044
7044
7045 \begin_layout Standard
7045 \begin_layout Standard
7046 It can also be useful in scientific computing situations where it is common
7046 It can also be useful in scientific computing situations where it is common
7047 to need to do some automatic, computationally intensive part and then stop
7047 to need to do some automatic, computationally intensive part and then stop
7048 to look at data, plots, etc
7048 to look at data, plots, etc
7049 \begin_inset Foot
7049 \begin_inset Foot
7050 status collapsed
7050 status collapsed
7051
7051
7052 \begin_layout Standard
7052 \begin_layout Standard
7053 This functionality was inspired by IDL's combination of the
7053 This functionality was inspired by IDL's combination of the
7054 \family typewriter
7054 \family typewriter
7055 stop
7055 stop
7056 \family default
7056 \family default
7057 keyword and the
7057 keyword and the
7058 \family typewriter
7058 \family typewriter
7059 .continue
7059 .continue
7060 \family default
7060 \family default
7061 executive command, which I have found very useful in the past, and by a
7061 executive command, which I have found very useful in the past, and by a
7062 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
7062 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
7063 06/01 concerning similar uses of pyrepl.
7063 06/01 concerning similar uses of pyrepl.
7064 \end_layout
7064 \end_layout
7065
7065
7066 \end_inset
7066 \end_inset
7067
7067
7068 .
7068 .
7069 Opening an IPython instance will give you full access to your data and
7069 Opening an IPython instance will give you full access to your data and
7070 functions, and you can resume program execution once you are done with
7070 functions, and you can resume program execution once you are done with
7071 the interactive part (perhaps to stop again later, as many times as needed).
7071 the interactive part (perhaps to stop again later, as many times as needed).
7072 \end_layout
7072 \end_layout
7073
7073
7074 \begin_layout Standard
7074 \begin_layout Standard
7075 The following code snippet is the bare minimum you need to include in your
7075 The following code snippet is the bare minimum you need to include in your
7076 Python programs for this to work (detailed examples follow later):
7076 Python programs for this to work (detailed examples follow later):
7077 \end_layout
7077 \end_layout
7078
7078
7079 \begin_layout LyX-Code
7079 \begin_layout LyX-Code
7080 from IPython.Shell import IPShellEmbed
7080 from IPython.Shell import IPShellEmbed
7081 \end_layout
7081 \end_layout
7082
7082
7083 \begin_layout LyX-Code
7083 \begin_layout LyX-Code
7084 ipshell = IPShellEmbed()
7084 ipshell = IPShellEmbed()
7085 \end_layout
7085 \end_layout
7086
7086
7087 \begin_layout LyX-Code
7087 \begin_layout LyX-Code
7088 ipshell() # this call anywhere in your program will start IPython
7088 ipshell() # this call anywhere in your program will start IPython
7089 \end_layout
7089 \end_layout
7090
7090
7091 \begin_layout Standard
7091 \begin_layout Standard
7092 You can run embedded instances even in code which is itself being run at
7092 You can run embedded instances even in code which is itself being run at
7093 the IPython interactive prompt with '
7093 the IPython interactive prompt with '
7094 \family typewriter
7094 \family typewriter
7095 %run\InsetSpace ~
7095 %run\InsetSpace ~
7096 <filename>
7096 <filename>
7097 \family default
7097 \family default
7098 '.
7098 '.
7099 Since it's easy to get lost as to where you are (in your top-level IPython
7099 Since it's easy to get lost as to where you are (in your top-level IPython
7100 or in your embedded one), it's a good idea in such cases to set the in/out
7100 or in your embedded one), it's a good idea in such cases to set the in/out
7101 prompts to something different for the embedded instances.
7101 prompts to something different for the embedded instances.
7102 The code examples below illustrate this.
7102 The code examples below illustrate this.
7103 \end_layout
7103 \end_layout
7104
7104
7105 \begin_layout Standard
7105 \begin_layout Standard
7106 You can also have multiple IPython instances in your program and open them
7106 You can also have multiple IPython instances in your program and open them
7107 separately, for example with different options for data presentation.
7107 separately, for example with different options for data presentation.
7108 If you close and open the same instance multiple times, its prompt counters
7108 If you close and open the same instance multiple times, its prompt counters
7109 simply continue from each execution to the next.
7109 simply continue from each execution to the next.
7110 \end_layout
7110 \end_layout
7111
7111
7112 \begin_layout Standard
7112 \begin_layout Standard
7113 Please look at the docstrings in the
7113 Please look at the docstrings in the
7114 \family typewriter
7114 \family typewriter
7115 Shell.py
7115 Shell.py
7116 \family default
7116 \family default
7117 module for more details on the use of this system.
7117 module for more details on the use of this system.
7118 \end_layout
7118 \end_layout
7119
7119
7120 \begin_layout Standard
7120 \begin_layout Standard
7121 The following sample file illustrating how to use the embedding functionality
7121 The following sample file illustrating how to use the embedding functionality
7122 is provided in the examples directory as
7122 is provided in the examples directory as
7123 \family typewriter
7123 \family typewriter
7124 example-embed.py
7124 example-embed.py
7125 \family default
7125 \family default
7126 .
7126 .
7127 It should be fairly self-explanatory:
7127 It should be fairly self-explanatory:
7128 \end_layout
7128 \end_layout
7129
7129
7130 \begin_layout Standard
7130 \begin_layout Standard
7131 \begin_inset ERT
7131 \begin_inset ERT
7132 status open
7132 status open
7133
7133
7134 \begin_layout Standard
7134 \begin_layout Standard
7135
7135
7136
7136
7137 \backslash
7137 \backslash
7138 codelist{examples/example-embed.py}
7138 codelist{examples/example-embed.py}
7139 \end_layout
7139 \end_layout
7140
7140
7141 \end_inset
7141 \end_inset
7142
7142
7143
7143
7144 \end_layout
7144 \end_layout
7145
7145
7146 \begin_layout Standard
7146 \begin_layout Standard
7147 Once you understand how the system functions, you can use the following
7147 Once you understand how the system functions, you can use the following
7148 code fragments in your programs which are ready for cut and paste:
7148 code fragments in your programs which are ready for cut and paste:
7149 \end_layout
7149 \end_layout
7150
7150
7151 \begin_layout Standard
7151 \begin_layout Standard
7152 \begin_inset ERT
7152 \begin_inset ERT
7153 status open
7153 status open
7154
7154
7155 \begin_layout Standard
7155 \begin_layout Standard
7156
7156
7157
7157
7158 \backslash
7158 \backslash
7159 codelist{examples/example-embed-short.py}
7159 codelist{examples/example-embed-short.py}
7160 \end_layout
7160 \end_layout
7161
7161
7162 \end_inset
7162 \end_inset
7163
7163
7164
7164
7165 \end_layout
7165 \end_layout
7166
7166
7167 \begin_layout Section
7167 \begin_layout Section
7168 \begin_inset LatexCommand \label{sec:using-pdb}
7168 \begin_inset LatexCommand \label{sec:using-pdb}
7169
7169
7170 \end_inset
7170 \end_inset
7171
7171
7172 Using the Python debugger (
7172 Using the Python debugger (
7173 \family typewriter
7173 \family typewriter
7174 pdb
7174 pdb
7175 \family default
7175 \family default
7176 )
7176 )
7177 \end_layout
7177 \end_layout
7178
7178
7179 \begin_layout Subsection
7179 \begin_layout Subsection
7180 Running entire programs via
7180 Running entire programs via
7181 \family typewriter
7181 \family typewriter
7182 pdb
7182 pdb
7183 \end_layout
7183 \end_layout
7184
7184
7185 \begin_layout Standard
7185 \begin_layout Standard
7186
7186
7187 \family typewriter
7187 \family typewriter
7188 pdb
7188 pdb
7189 \family default
7189 \family default
7190 , the Python debugger, is a powerful interactive debugger which allows you
7190 , the Python debugger, is a powerful interactive debugger which allows you
7191 to step through code, set breakpoints, watch variables, etc.
7191 to step through code, set breakpoints, watch variables, etc.
7192 IPython makes it very easy to start any script under the control of
7192 IPython makes it very easy to start any script under the control of
7193 \family typewriter
7193 \family typewriter
7194 pdb
7194 pdb
7195 \family default
7195 \family default
7196 , regardless of whether you have wrapped it into a
7196 , regardless of whether you have wrapped it into a
7197 \family typewriter
7197 \family typewriter
7198 `main()'
7198 `main()'
7199 \family default
7199 \family default
7200 function or not.
7200 function or not.
7201 For this, simply type
7201 For this, simply type
7202 \family typewriter
7202 \family typewriter
7203 `%run -d myscript'
7203 `%run -d myscript'
7204 \family default
7204 \family default
7205 at an IPython prompt.
7205 at an IPython prompt.
7206 See the
7206 See the
7207 \family typewriter
7207 \family typewriter
7208 %run
7208 %run
7209 \family default
7209 \family default
7210 command's documentation (via
7210 command's documentation (via
7211 \family typewriter
7211 \family typewriter
7212 `%run?'
7212 `%run?'
7213 \family default
7213 \family default
7214 or in Sec.\InsetSpace ~
7214 or in Sec.\InsetSpace ~
7215
7215
7216 \begin_inset LatexCommand \ref{sec:magic}
7216 \begin_inset LatexCommand \ref{sec:magic}
7217
7217
7218 \end_inset
7218 \end_inset
7219
7219
7220 ) for more details, including how to control where
7220 ) for more details, including how to control where
7221 \family typewriter
7221 \family typewriter
7222 pdb
7222 pdb
7223 \family default
7223 \family default
7224 will stop execution first.
7224 will stop execution first.
7225 \end_layout
7225 \end_layout
7226
7226
7227 \begin_layout Standard
7227 \begin_layout Standard
7228 For more information on the use of the
7228 For more information on the use of the
7229 \family typewriter
7229 \family typewriter
7230 pdb
7230 pdb
7231 \family default
7231 \family default
7232 debugger, read the included
7232 debugger, read the included
7233 \family typewriter
7233 \family typewriter
7234 pdb.doc
7234 pdb.doc
7235 \family default
7235 \family default
7236 file (part of the standard Python distribution).
7236 file (part of the standard Python distribution).
7237 On a stock Linux system it is located at
7237 On a stock Linux system it is located at
7238 \family typewriter
7238 \family typewriter
7239 /usr/lib/python2.3/pdb.doc
7239 /usr/lib/python2.3/pdb.doc
7240 \family default
7240 \family default
7241 , but the easiest way to read it is by using the
7241 , but the easiest way to read it is by using the
7242 \family typewriter
7242 \family typewriter
7243 help()
7243 help()
7244 \family default
7244 \family default
7245 function of the
7245 function of the
7246 \family typewriter
7246 \family typewriter
7247 pdb
7247 pdb
7248 \family default
7248 \family default
7249 module as follows (in an IPython prompt):
7249 module as follows (in an IPython prompt):
7250 \end_layout
7250 \end_layout
7251
7251
7252 \begin_layout Standard
7252 \begin_layout Standard
7253
7253
7254 \family typewriter
7254 \family typewriter
7255 In [1]: import pdb
7255 In [1]: import pdb
7256 \newline
7256 \newline
7257 In [2]: pdb.help()
7257 In [2]: pdb.help()
7258 \end_layout
7258 \end_layout
7259
7259
7260 \begin_layout Standard
7260 \begin_layout Standard
7261 This will load the
7261 This will load the
7262 \family typewriter
7262 \family typewriter
7263 pdb.doc
7263 pdb.doc
7264 \family default
7264 \family default
7265 document in a file viewer for you automatically.
7265 document in a file viewer for you automatically.
7266 \end_layout
7266 \end_layout
7267
7267
7268 \begin_layout Subsection
7268 \begin_layout Subsection
7269 Automatic invocation of
7269 Automatic invocation of
7270 \family typewriter
7270 \family typewriter
7271 pdb
7271 pdb
7272 \family default
7272 \family default
7273 on exceptions
7273 on exceptions
7274 \end_layout
7274 \end_layout
7275
7275
7276 \begin_layout Standard
7276 \begin_layout Standard
7277 IPython, if started with the
7277 IPython, if started with the
7278 \family typewriter
7278 \family typewriter
7279 -pdb
7279 -pdb
7280 \family default
7280 \family default
7281 option (or if the option is set in your rc file) can call the Python
7281 option (or if the option is set in your rc file) can call the Python
7282 \family typewriter
7282 \family typewriter
7283 pdb
7283 pdb
7284 \family default
7284 \family default
7285 debugger every time your code triggers an uncaught exception
7285 debugger every time your code triggers an uncaught exception
7286 \begin_inset Foot
7286 \begin_inset Foot
7287 status collapsed
7287 status collapsed
7288
7288
7289 \begin_layout Standard
7289 \begin_layout Standard
7290 Many thanks to Christopher Hart for the request which prompted adding this
7290 Many thanks to Christopher Hart for the request which prompted adding this
7291 feature to IPython.
7291 feature to IPython.
7292 \end_layout
7292 \end_layout
7293
7293
7294 \end_inset
7294 \end_inset
7295
7295
7296 .
7296 .
7297 This feature can also be toggled at any time with the
7297 This feature can also be toggled at any time with the
7298 \family typewriter
7298 \family typewriter
7299 %pdb
7299 %pdb
7300 \family default
7300 \family default
7301 magic command.
7301 magic command.
7302 This can be extremely useful in order to find the origin of subtle bugs,
7302 This can be extremely useful in order to find the origin of subtle bugs,
7303 because
7303 because
7304 \family typewriter
7304 \family typewriter
7305 pdb
7305 pdb
7306 \family default
7306 \family default
7307 opens up at the point in your code which triggered the exception, and while
7307 opens up at the point in your code which triggered the exception, and while
7308 your program is at this point `dead', all the data is still available and
7308 your program is at this point `dead', all the data is still available and
7309 you can walk up and down the stack frame and understand the origin of the
7309 you can walk up and down the stack frame and understand the origin of the
7310 problem.
7310 problem.
7311 \end_layout
7311 \end_layout
7312
7312
7313 \begin_layout Standard
7313 \begin_layout Standard
7314 Furthermore, you can use these debugging facilities both with the embedded
7314 Furthermore, you can use these debugging facilities both with the embedded
7315 IPython mode and without IPython at all.
7315 IPython mode and without IPython at all.
7316 For an embedded shell (see sec.
7316 For an embedded shell (see sec.
7317
7317
7318 \begin_inset LatexCommand \ref{sec:embed}
7318 \begin_inset LatexCommand \ref{sec:embed}
7319
7319
7320 \end_inset
7320 \end_inset
7321
7321
7322 ), simply call the constructor with
7322 ), simply call the constructor with
7323 \family typewriter
7323 \family typewriter
7324 `-pdb'
7324 `-pdb'
7325 \family default
7325 \family default
7326 in the argument string and automatically
7326 in the argument string and automatically
7327 \family typewriter
7327 \family typewriter
7328 pdb
7328 pdb
7329 \family default
7329 \family default
7330 will be called if an uncaught exception is triggered by your code.
7330 will be called if an uncaught exception is triggered by your code.
7331
7331
7332 \end_layout
7332 \end_layout
7333
7333
7334 \begin_layout Standard
7334 \begin_layout Standard
7335 For stand-alone use of the feature in your programs which do not use IPython
7335 For stand-alone use of the feature in your programs which do not use IPython
7336 at all, put the following lines toward the top of your `main' routine:
7336 at all, put the following lines toward the top of your `main' routine:
7337 \end_layout
7337 \end_layout
7338
7338
7339 \begin_layout Standard
7339 \begin_layout Standard
7340 \align left
7340 \align left
7341
7341
7342 \family typewriter
7342 \family typewriter
7343 import sys,IPython.ultraTB
7343 import sys,IPython.ultraTB
7344 \newline
7344 \newline
7345 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbos
7345 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbos
7346 e', color_scheme=`Linux', call_pdb=1)
7346 e', color_scheme=`Linux', call_pdb=1)
7347 \end_layout
7347 \end_layout
7348
7348
7349 \begin_layout Standard
7349 \begin_layout Standard
7350 The
7350 The
7351 \family typewriter
7351 \family typewriter
7352 mode
7352 mode
7353 \family default
7353 \family default
7354 keyword can be either
7354 keyword can be either
7355 \family typewriter
7355 \family typewriter
7356 `Verbose'
7356 `Verbose'
7357 \family default
7357 \family default
7358 or
7358 or
7359 \family typewriter
7359 \family typewriter
7360 `Plain'
7360 `Plain'
7361 \family default
7361 \family default
7362 , giving either very detailed or normal tracebacks respectively.
7362 , giving either very detailed or normal tracebacks respectively.
7363 The
7363 The
7364 \family typewriter
7364 \family typewriter
7365 color_scheme
7365 color_scheme
7366 \family default
7366 \family default
7367 keyword can be one of
7367 keyword can be one of
7368 \family typewriter
7368 \family typewriter
7369 `NoColor'
7369 `NoColor'
7370 \family default
7370 \family default
7371 ,
7371 ,
7372 \family typewriter
7372 \family typewriter
7373 `Linux'
7373 `Linux'
7374 \family default
7374 \family default
7375 (default) or
7375 (default) or
7376 \family typewriter
7376 \family typewriter
7377 `LightBG'
7377 `LightBG'
7378 \family default
7378 \family default
7379 .
7379 .
7380 These are the same options which can be set in IPython with
7380 These are the same options which can be set in IPython with
7381 \family typewriter
7381 \family typewriter
7382 -colors
7382 -colors
7383 \family default
7383 \family default
7384 and
7384 and
7385 \family typewriter
7385 \family typewriter
7386 -xmode
7386 -xmode
7387 \family default
7387 \family default
7388 .
7388 .
7389 \end_layout
7389 \end_layout
7390
7390
7391 \begin_layout Standard
7391 \begin_layout Standard
7392 This will give any of your programs detailed, colored tracebacks with automatic
7392 This will give any of your programs detailed, colored tracebacks with automatic
7393 invocation of
7393 invocation of
7394 \family typewriter
7394 \family typewriter
7395 pdb
7395 pdb
7396 \family default
7396 \family default
7397 .
7397 .
7398 \end_layout
7398 \end_layout
7399
7399
7400 \begin_layout Section
7400 \begin_layout Section
7401 \begin_inset LatexCommand \label{sec:syntax-extensions}
7401 \begin_inset LatexCommand \label{sec:syntax-extensions}
7402
7402
7403 \end_inset
7403 \end_inset
7404
7404
7405 Extensions for syntax processing
7405 Extensions for syntax processing
7406 \end_layout
7406 \end_layout
7407
7407
7408 \begin_layout Standard
7408 \begin_layout Standard
7409 This isn't for the faint of heart, because the potential for breaking things
7409 This isn't for the faint of heart, because the potential for breaking things
7410 is quite high.
7410 is quite high.
7411 But it can be a very powerful and useful feature.
7411 But it can be a very powerful and useful feature.
7412 In a nutshell, you can redefine the way IPython processes the user input
7412 In a nutshell, you can redefine the way IPython processes the user input
7413 line to accept new, special extensions to the syntax without needing to
7413 line to accept new, special extensions to the syntax without needing to
7414 change any of IPython's own code.
7414 change any of IPython's own code.
7415 \end_layout
7415 \end_layout
7416
7416
7417 \begin_layout Standard
7417 \begin_layout Standard
7418 In the
7418 In the
7419 \family typewriter
7419 \family typewriter
7420 IPython/Extensions
7420 IPython/Extensions
7421 \family default
7421 \family default
7422 directory you will find some examples supplied, which we will briefly describe
7422 directory you will find some examples supplied, which we will briefly describe
7423 now.
7423 now.
7424 These can be used `as is' (and both provide very useful functionality),
7424 These can be used `as is' (and both provide very useful functionality),
7425 or you can use them as a starting point for writing your own extensions.
7425 or you can use them as a starting point for writing your own extensions.
7426 \end_layout
7426 \end_layout
7427
7427
7428 \begin_layout Subsection
7428 \begin_layout Subsection
7429 Pasting of code starting with
7429 Pasting of code starting with
7430 \family typewriter
7430 \family typewriter
7431 `>>>
7431 `>>>
7432 \family default
7432 \family default
7433 ' or
7433 ' or
7434 \family typewriter
7434 \family typewriter
7435 `...
7435 `...
7436
7436
7437 \family default
7437 \family default
7438 '
7438 '
7439 \end_layout
7439 \end_layout
7440
7440
7441 \begin_layout Standard
7441 \begin_layout Standard
7442 In the python tutorial it is common to find code examples which have been
7442 In the python tutorial it is common to find code examples which have been
7443 taken from real python sessions.
7443 taken from real python sessions.
7444 The problem with those is that all the lines begin with either
7444 The problem with those is that all the lines begin with either
7445 \family typewriter
7445 \family typewriter
7446 `>>>
7446 `>>>
7447 \family default
7447 \family default
7448 ' or
7448 ' or
7449 \family typewriter
7449 \family typewriter
7450 `...
7450 `...
7451
7451
7452 \family default
7452 \family default
7453 ', which makes it impossible to paste them all at once.
7453 ', which makes it impossible to paste them all at once.
7454 One must instead do a line by line manual copying, carefully removing the
7454 One must instead do a line by line manual copying, carefully removing the
7455 leading extraneous characters.
7455 leading extraneous characters.
7456 \end_layout
7456 \end_layout
7457
7457
7458 \begin_layout Standard
7458 \begin_layout Standard
7459 This extension identifies those starting characters and removes them from
7459 This extension identifies those starting characters and removes them from
7460 the input automatically, so that one can paste multi-line examples directly
7460 the input automatically, so that one can paste multi-line examples directly
7461 into IPython, saving a lot of time.
7461 into IPython, saving a lot of time.
7462 Please look at the file
7462 Please look at the file
7463 \family typewriter
7463 \family typewriter
7464 InterpreterPasteInput.py
7464 InterpreterPasteInput.py
7465 \family default
7465 \family default
7466 in the
7466 in the
7467 \family typewriter
7467 \family typewriter
7468 IPython/Extensions
7468 IPython/Extensions
7469 \family default
7469 \family default
7470 directory for details on how this is done.
7470 directory for details on how this is done.
7471 \end_layout
7471 \end_layout
7472
7472
7473 \begin_layout Standard
7473 \begin_layout Standard
7474 IPython comes with a special profile enabling this feature, called
7474 IPython comes with a special profile enabling this feature, called
7475 \family typewriter
7475 \family typewriter
7476 tutorial
7476 tutorial
7477 \family default
7477 \family default
7478 \emph on
7478 \emph on
7479 .
7479 .
7480
7480
7481 \emph default
7481 \emph default
7482 Simply start IPython via
7482 Simply start IPython via
7483 \family typewriter
7483 \family typewriter
7484 `ipython\InsetSpace ~
7484 `ipython\InsetSpace ~
7485 -p\InsetSpace ~
7485 -p\InsetSpace ~
7486 tutorial'
7486 tutorial'
7487 \family default
7487 \family default
7488 and the feature will be available.
7488 and the feature will be available.
7489 In a normal IPython session you can activate the feature by importing the
7489 In a normal IPython session you can activate the feature by importing the
7490 corresponding module with:
7490 corresponding module with:
7491 \newline
7491 \newline
7492
7492
7493 \family typewriter
7493 \family typewriter
7494 In [1]: import IPython.Extensions.InterpreterPasteInput
7494 In [1]: import IPython.Extensions.InterpreterPasteInput
7495 \end_layout
7495 \end_layout
7496
7496
7497 \begin_layout Standard
7497 \begin_layout Standard
7498 The following is a 'screenshot' of how things work when this extension is
7498 The following is a 'screenshot' of how things work when this extension is
7499 on, copying an example from the standard tutorial:
7499 on, copying an example from the standard tutorial:
7500 \end_layout
7500 \end_layout
7501
7501
7502 \begin_layout Standard
7502 \begin_layout Standard
7503
7503
7504 \family typewriter
7504 \family typewriter
7505 IPython profile: tutorial
7505 IPython profile: tutorial
7506 \newline
7506 \newline
7507 \InsetSpace ~
7507 \InsetSpace ~
7508
7508
7509 \newline
7509 \newline
7510 *** Pasting of code with ">>>" or "..." has been enabled.
7510 *** Pasting of code with ">>>" or "..." has been enabled.
7511 \newline
7511 \newline
7512 \InsetSpace ~
7512 \InsetSpace ~
7513
7513
7514 \newline
7514 \newline
7515 In
7515 In
7516 [1]: >>> def fib2(n): # return Fibonacci series up to n
7516 [1]: >>> def fib2(n): # return Fibonacci series up to n
7517 \newline
7517 \newline
7518
7518
7519 \begin_inset ERT
7519 \begin_inset ERT
7520 status collapsed
7520 status collapsed
7521
7521
7522 \begin_layout Standard
7522 \begin_layout Standard
7523
7523
7524
7524
7525 \backslash
7525 \backslash
7526 hspace*{0mm}
7526 hspace*{0mm}
7527 \end_layout
7527 \end_layout
7528
7528
7529 \end_inset
7529 \end_inset
7530
7530
7531 \InsetSpace ~
7531 \InsetSpace ~
7532 \InsetSpace ~
7532 \InsetSpace ~
7533 ...: ...\InsetSpace ~
7533 ...: ...\InsetSpace ~
7534 \InsetSpace ~
7534 \InsetSpace ~
7535 \InsetSpace ~
7535 \InsetSpace ~
7536 \InsetSpace ~
7536 \InsetSpace ~
7537 """Return a list containing the Fibonacci series up to n."""
7537 """Return a list containing the Fibonacci series up to n."""
7538 \newline
7538 \newline
7539
7539
7540 \begin_inset ERT
7540 \begin_inset ERT
7541 status collapsed
7541 status collapsed
7542
7542
7543 \begin_layout Standard
7543 \begin_layout Standard
7544
7544
7545
7545
7546 \backslash
7546 \backslash
7547 hspace*{0mm}
7547 hspace*{0mm}
7548 \end_layout
7548 \end_layout
7549
7549
7550 \end_inset
7550 \end_inset
7551
7551
7552 \InsetSpace ~
7552 \InsetSpace ~
7553 \InsetSpace ~
7553 \InsetSpace ~
7554 ...: ...\InsetSpace ~
7554 ...: ...\InsetSpace ~
7555 \InsetSpace ~
7555 \InsetSpace ~
7556 \InsetSpace ~
7556 \InsetSpace ~
7557 \InsetSpace ~
7557 \InsetSpace ~
7558 result = []
7558 result = []
7559 \newline
7559 \newline
7560
7560
7561 \begin_inset ERT
7561 \begin_inset ERT
7562 status collapsed
7562 status collapsed
7563
7563
7564 \begin_layout Standard
7564 \begin_layout Standard
7565
7565
7566
7566
7567 \backslash
7567 \backslash
7568 hspace*{0mm}
7568 hspace*{0mm}
7569 \end_layout
7569 \end_layout
7570
7570
7571 \end_inset
7571 \end_inset
7572
7572
7573 \InsetSpace ~
7573 \InsetSpace ~
7574 \InsetSpace ~
7574 \InsetSpace ~
7575 ...: ...\InsetSpace ~
7575 ...: ...\InsetSpace ~
7576 \InsetSpace ~
7576 \InsetSpace ~
7577 \InsetSpace ~
7577 \InsetSpace ~
7578 \InsetSpace ~
7578 \InsetSpace ~
7579 a, b = 0, 1
7579 a, b = 0, 1
7580 \newline
7580 \newline
7581
7581
7582 \begin_inset ERT
7582 \begin_inset ERT
7583 status collapsed
7583 status collapsed
7584
7584
7585 \begin_layout Standard
7585 \begin_layout Standard
7586
7586
7587
7587
7588 \backslash
7588 \backslash
7589 hspace*{0mm}
7589 hspace*{0mm}
7590 \end_layout
7590 \end_layout
7591
7591
7592 \end_inset
7592 \end_inset
7593
7593
7594 \InsetSpace ~
7594 \InsetSpace ~
7595 \InsetSpace ~
7595 \InsetSpace ~
7596 ...: ...\InsetSpace ~
7596 ...: ...\InsetSpace ~
7597 \InsetSpace ~
7597 \InsetSpace ~
7598 \InsetSpace ~
7598 \InsetSpace ~
7599 \InsetSpace ~
7599 \InsetSpace ~
7600 while b < n:
7600 while b < n:
7601 \newline
7601 \newline
7602
7602
7603 \begin_inset ERT
7603 \begin_inset ERT
7604 status collapsed
7604 status collapsed
7605
7605
7606 \begin_layout Standard
7606 \begin_layout Standard
7607
7607
7608
7608
7609 \backslash
7609 \backslash
7610 hspace*{0mm}
7610 hspace*{0mm}
7611 \end_layout
7611 \end_layout
7612
7612
7613 \end_inset
7613 \end_inset
7614
7614
7615 \InsetSpace ~
7615 \InsetSpace ~
7616 \InsetSpace ~
7616 \InsetSpace ~
7617 ...: ...\InsetSpace ~
7617 ...: ...\InsetSpace ~
7618 \InsetSpace ~
7618 \InsetSpace ~
7619 \InsetSpace ~
7619 \InsetSpace ~
7620 \InsetSpace ~
7620 \InsetSpace ~
7621 \InsetSpace ~
7621 \InsetSpace ~
7622 \InsetSpace ~
7622 \InsetSpace ~
7623 \InsetSpace ~
7623 \InsetSpace ~
7624 \InsetSpace ~
7624 \InsetSpace ~
7625 result.append(b)\InsetSpace ~
7625 result.append(b)\InsetSpace ~
7626 \InsetSpace ~
7626 \InsetSpace ~
7627 \InsetSpace ~
7627 \InsetSpace ~
7628 # see below
7628 # see below
7629 \newline
7629 \newline
7630
7630
7631 \begin_inset ERT
7631 \begin_inset ERT
7632 status collapsed
7632 status collapsed
7633
7633
7634 \begin_layout Standard
7634 \begin_layout Standard
7635
7635
7636
7636
7637 \backslash
7637 \backslash
7638 hspace*{0mm}
7638 hspace*{0mm}
7639 \end_layout
7639 \end_layout
7640
7640
7641 \end_inset
7641 \end_inset
7642
7642
7643 \InsetSpace ~
7643 \InsetSpace ~
7644 \InsetSpace ~
7644 \InsetSpace ~
7645 ...: ...\InsetSpace ~
7645 ...: ...\InsetSpace ~
7646 \InsetSpace ~
7646 \InsetSpace ~
7647 \InsetSpace ~
7647 \InsetSpace ~
7648 \InsetSpace ~
7648 \InsetSpace ~
7649 \InsetSpace ~
7649 \InsetSpace ~
7650 \InsetSpace ~
7650 \InsetSpace ~
7651 \InsetSpace ~
7651 \InsetSpace ~
7652 \InsetSpace ~
7652 \InsetSpace ~
7653 a, b = b, a+b
7653 a, b = b, a+b
7654 \newline
7654 \newline
7655
7655
7656 \begin_inset ERT
7656 \begin_inset ERT
7657 status collapsed
7657 status collapsed
7658
7658
7659 \begin_layout Standard
7659 \begin_layout Standard
7660
7660
7661
7661
7662 \backslash
7662 \backslash
7663 hspace*{0mm}
7663 hspace*{0mm}
7664 \end_layout
7664 \end_layout
7665
7665
7666 \end_inset
7666 \end_inset
7667
7667
7668 \InsetSpace ~
7668 \InsetSpace ~
7669 \InsetSpace ~
7669 \InsetSpace ~
7670 ...: ...\InsetSpace ~
7670 ...: ...\InsetSpace ~
7671 \InsetSpace ~
7671 \InsetSpace ~
7672 \InsetSpace ~
7672 \InsetSpace ~
7673 \InsetSpace ~
7673 \InsetSpace ~
7674 return result
7674 return result
7675 \newline
7675 \newline
7676
7676
7677 \begin_inset ERT
7677 \begin_inset ERT
7678 status collapsed
7678 status collapsed
7679
7679
7680 \begin_layout Standard
7680 \begin_layout Standard
7681
7681
7682
7682
7683 \backslash
7683 \backslash
7684 hspace*{0mm}
7684 hspace*{0mm}
7685 \end_layout
7685 \end_layout
7686
7686
7687 \end_inset
7687 \end_inset
7688
7688
7689 \InsetSpace ~
7689 \InsetSpace ~
7690 \InsetSpace ~
7690 \InsetSpace ~
7691 ...:
7691 ...:
7692 \newline
7692 \newline
7693 \InsetSpace ~
7693 \InsetSpace ~
7694
7694
7695 \newline
7695 \newline
7696 In [2]: fib2(10)
7696 In [2]: fib2(10)
7697 \newline
7697 \newline
7698 Out[2]: [1, 1, 2, 3, 5, 8]
7698 Out[2]: [1, 1, 2, 3, 5, 8]
7699 \end_layout
7699 \end_layout
7700
7700
7701 \begin_layout Standard
7701 \begin_layout Standard
7702 Note that as currently written, this extension does
7702 Note that as currently written, this extension does
7703 \emph on
7703 \emph on
7704 not
7704 not
7705 \emph default
7705 \emph default
7706 recognize IPython's prompts for pasting.
7706 recognize IPython's prompts for pasting.
7707 Those are more complicated, since the user can change them very easily,
7707 Those are more complicated, since the user can change them very easily,
7708 they involve numbers and can vary in length.
7708 they involve numbers and can vary in length.
7709 One could however extract all the relevant information from the IPython
7709 One could however extract all the relevant information from the IPython
7710 instance and build an appropriate regular expression.
7710 instance and build an appropriate regular expression.
7711 This is left as an exercise for the reader.
7711 This is left as an exercise for the reader.
7712 \end_layout
7712 \end_layout
7713
7713
7714 \begin_layout Subsection
7714 \begin_layout Subsection
7715 Input of physical quantities with units
7715 Input of physical quantities with units
7716 \end_layout
7716 \end_layout
7717
7717
7718 \begin_layout Standard
7718 \begin_layout Standard
7719 The module
7719 The module
7720 \family typewriter
7720 \family typewriter
7721 PhysicalQInput
7721 PhysicalQInput
7722 \family default
7722 \family default
7723 allows a simplified form of input for physical quantities with units.
7723 allows a simplified form of input for physical quantities with units.
7724 This file is meant to be used in conjunction with the
7724 This file is meant to be used in conjunction with the
7725 \family typewriter
7725 \family typewriter
7726 PhysicalQInteractive
7726 PhysicalQInteractive
7727 \family default
7727 \family default
7728 module (in the same directory) and
7728 module (in the same directory) and
7729 \family typewriter
7729 \family typewriter
7730 Physics.PhysicalQuantities
7730 Physics.PhysicalQuantities
7731 \family default
7731 \family default
7732 from Konrad Hinsen's ScientificPython (
7732 from Konrad Hinsen's ScientificPython (
7733 \begin_inset LatexCommand \htmlurl{http://dirac.cnrs-orleans.fr/ScientificPython/}
7733 \begin_inset LatexCommand \htmlurl{http://dirac.cnrs-orleans.fr/ScientificPython/}
7734
7734
7735 \end_inset
7735 \end_inset
7736
7736
7737 ).
7737 ).
7738 \end_layout
7738 \end_layout
7739
7739
7740 \begin_layout Standard
7740 \begin_layout Standard
7741 The
7741 The
7742 \family typewriter
7742 \family typewriter
7743 Physics.PhysicalQuantities
7743 Physics.PhysicalQuantities
7744 \family default
7744 \family default
7745 module defines
7745 module defines
7746 \family typewriter
7746 \family typewriter
7747 PhysicalQuantity
7747 PhysicalQuantity
7748 \family default
7748 \family default
7749 objects, but these must be declared as instances of a class.
7749 objects, but these must be declared as instances of a class.
7750 For example, to define
7750 For example, to define
7751 \family typewriter
7751 \family typewriter
7752 v
7752 v
7753 \family default
7753 \family default
7754 as a velocity of 3\InsetSpace ~
7754 as a velocity of 3\InsetSpace ~
7755 m/s, normally you would write:
7755 m/s, normally you would write:
7756 \family typewriter
7756 \family typewriter
7757
7757
7758 \newline
7758 \newline
7759 In [1]: v = PhysicalQuantity(3,'m/s')
7759 In [1]: v = PhysicalQuantity(3,'m/s')
7760 \end_layout
7760 \end_layout
7761
7761
7762 \begin_layout Standard
7762 \begin_layout Standard
7763 Using the
7763 Using the
7764 \family typewriter
7764 \family typewriter
7765 PhysicalQ_Input
7765 PhysicalQ_Input
7766 \family default
7766 \family default
7767 extension this can be input instead as:
7767 extension this can be input instead as:
7768 \family typewriter
7768 \family typewriter
7769
7769
7770 \newline
7770 \newline
7771 In [1]: v = 3 m/s
7771 In [1]: v = 3 m/s
7772 \family default
7772 \family default
7773
7773
7774 \newline
7774 \newline
7775 which is much more convenient for interactive use (even though it is blatantly
7775 which is much more convenient for interactive use (even though it is blatantly
7776 invalid Python syntax).
7776 invalid Python syntax).
7777 \end_layout
7777 \end_layout
7778
7778
7779 \begin_layout Standard
7779 \begin_layout Standard
7780 The
7780 The
7781 \family typewriter
7781 \family typewriter
7782 physics
7782 physics
7783 \family default
7783 \family default
7784 profile supplied with IPython (enabled via
7784 profile supplied with IPython (enabled via
7785 \family typewriter
7785 \family typewriter
7786 'ipython -p physics'
7786 'ipython -p physics'
7787 \family default
7787 \family default
7788 ) uses these extensions, which you can also activate with:
7788 ) uses these extensions, which you can also activate with:
7789 \end_layout
7789 \end_layout
7790
7790
7791 \begin_layout Standard
7791 \begin_layout Standard
7792
7792
7793 \family typewriter
7793 \family typewriter
7794 from math import * # math MUST be imported BEFORE PhysicalQInteractive
7794 from math import * # math MUST be imported BEFORE PhysicalQInteractive
7795 \newline
7795 \newline
7796 from
7796 from
7797 IPython.Extensions.PhysicalQInteractive import *
7797 IPython.Extensions.PhysicalQInteractive import *
7798 \newline
7798 \newline
7799 import IPython.Extensions.PhysicalQ
7799 import IPython.Extensions.PhysicalQ
7800 Input
7800 Input
7801 \end_layout
7801 \end_layout
7802
7802
7803 \begin_layout Section
7803 \begin_layout Section
7804 \begin_inset LatexCommand \label{sec:IPython-as-shell}
7804 \begin_inset LatexCommand \label{sec:IPython-as-shell}
7805
7805
7806 \end_inset
7806 \end_inset
7807
7807
7808 IPython as a system shell
7808 IPython as a system shell
7809 \end_layout
7809 \end_layout
7810
7810
7811 \begin_layout Standard
7811 \begin_layout Standard
7812 IPython ships with a special profile called
7812 IPython ships with a special profile called
7813 \family typewriter
7813 \family typewriter
7814 pysh
7814 pysh
7815 \family default
7815 \family default
7816 , which you can activate at the command line as
7816 , which you can activate at the command line as
7817 \family typewriter
7817 \family typewriter
7818 `ipython -p pysh'
7818 `ipython -p pysh'
7819 \family default
7819 \family default
7820 .
7820 .
7821 This loads
7821 This loads
7822 \family typewriter
7822 \family typewriter
7823 InterpreterExec
7823 InterpreterExec
7824 \family default
7824 \family default
7825 , along with some additional facilities and a prompt customized for filesystem
7825 , along with some additional facilities and a prompt customized for filesystem
7826 navigation.
7826 navigation.
7827 \end_layout
7827 \end_layout
7828
7828
7829 \begin_layout Standard
7829 \begin_layout Standard
7830 Note that this does
7830 Note that this does
7831 \emph on
7831 \emph on
7832 not
7832 not
7833 \emph default
7833 \emph default
7834 make IPython a full-fledged system shell.
7834 make IPython a full-fledged system shell.
7835 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
7835 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
7836 you'll suspend pysh itself, not the process you just started.
7836 you'll suspend pysh itself, not the process you just started.
7837
7837
7838 \end_layout
7838 \end_layout
7839
7839
7840 \begin_layout Standard
7840 \begin_layout Standard
7841 What the shell profile allows you to do is to use the convenient and powerful
7841 What the shell profile allows you to do is to use the convenient and powerful
7842 syntax of Python to do quick scripting at the command line.
7842 syntax of Python to do quick scripting at the command line.
7843 Below we describe some of its features.
7843 Below we describe some of its features.
7844 \end_layout
7844 \end_layout
7845
7845
7846 \begin_layout Subsection
7846 \begin_layout Subsection
7847 Aliases
7847 Aliases
7848 \end_layout
7848 \end_layout
7849
7849
7850 \begin_layout Standard
7850 \begin_layout Standard
7851 All of your
7851 All of your
7852 \family typewriter
7852 \family typewriter
7853 $PATH
7853 $PATH
7854 \family default
7854 \family default
7855 has been loaded as IPython aliases, so you should be able to type any normal
7855 has been loaded as IPython aliases, so you should be able to type any normal
7856 system command and have it executed.
7856 system command and have it executed.
7857 See
7857 See
7858 \family typewriter
7858 \family typewriter
7859 %alias?
7859 %alias?
7860 \family default
7860 \family default
7861 and
7861 and
7862 \family typewriter
7862 \family typewriter
7863 %unalias?
7863 %unalias?
7864 \family default
7864 \family default
7865 for details on the alias facilities.
7865 for details on the alias facilities.
7866 See also
7866 See also
7867 \family typewriter
7867 \family typewriter
7868 %rehash?
7868 %rehash?
7869 \family default
7869 \family default
7870 and
7870 and
7871 \family typewriter
7871 \family typewriter
7872 %rehashx?
7872 %rehashx?
7873 \family default
7873 \family default
7874 for details on the mechanism used to load
7874 for details on the mechanism used to load
7875 \family typewriter
7875 \family typewriter
7876 $PATH
7876 $PATH
7877 \family default
7877 \family default
7878 .
7878 .
7879 \end_layout
7879 \end_layout
7880
7880
7881 \begin_layout Subsection
7881 \begin_layout Subsection
7882 Special syntax
7882 Special syntax
7883 \end_layout
7883 \end_layout
7884
7884
7885 \begin_layout Standard
7885 \begin_layout Standard
7886 Any lines which begin with
7886 Any lines which begin with
7887 \family typewriter
7887 \family typewriter
7888 `~'
7888 `~'
7889 \family default
7889 \family default
7890 ,
7890 ,
7891 \family typewriter
7891 \family typewriter
7892 `/'
7892 `/'
7893 \family default
7893 \family default
7894 and
7894 and
7895 \family typewriter
7895 \family typewriter
7896 `.'
7896 `.'
7897 \family default
7897 \family default
7898 will be executed as shell commands instead of as Python code.
7898 will be executed as shell commands instead of as Python code.
7899 The special escapes below are also recognized.
7899 The special escapes below are also recognized.
7900
7900
7901 \family typewriter
7901 \family typewriter
7902 !cmd
7902 !cmd
7903 \family default
7903 \family default
7904 is valid in single or multi-line input, all others are only valid in single-lin
7904 is valid in single or multi-line input, all others are only valid in single-lin
7905 e input:
7905 e input:
7906 \end_layout
7906 \end_layout
7907
7907
7908 \begin_layout Description
7908 \begin_layout Description
7909
7909
7910 \family typewriter
7910 \family typewriter
7911 !cmd
7911 !cmd
7912 \family default
7912 \family default
7913 pass `cmd' directly to the shell
7913 pass `cmd' directly to the shell
7914 \end_layout
7914 \end_layout
7915
7915
7916 \begin_layout Description
7916 \begin_layout Description
7917
7917
7918 \family typewriter
7918 \family typewriter
7919 !!cmd
7919 !!cmd
7920 \family default
7920 \family default
7921 execute `cmd' and return output as a list (split on `
7921 execute `cmd' and return output as a list (split on `
7922 \backslash
7922 \backslash
7923 n')
7923 n')
7924 \end_layout
7924 \end_layout
7925
7925
7926 \begin_layout Description
7926 \begin_layout Description
7927
7927
7928 \family typewriter
7928 \family typewriter
7929 $var=cmd
7929 $var=cmd
7930 \family default
7930 \family default
7931 capture output of cmd into var, as a string
7931 capture output of cmd into var, as a string
7932 \end_layout
7932 \end_layout
7933
7933
7934 \begin_layout Description
7934 \begin_layout Description
7935
7935
7936 \family typewriter
7936 \family typewriter
7937 $$var=cmd
7937 $$var=cmd
7938 \family default
7938 \family default
7939 capture output of cmd into var, as a list (split on `
7939 capture output of cmd into var, as a list (split on `
7940 \backslash
7940 \backslash
7941 n')
7941 n')
7942 \end_layout
7942 \end_layout
7943
7943
7944 \begin_layout Standard
7944 \begin_layout Standard
7945 The
7945 The
7946 \family typewriter
7946 \family typewriter
7947 $
7947 $
7948 \family default
7948 \family default
7949 /
7949 /
7950 \family typewriter
7950 \family typewriter
7951 $$
7951 $$
7952 \family default
7952 \family default
7953 syntaxes make Python variables from system output, which you can later
7953 syntaxes make Python variables from system output, which you can later
7954 use for further scripting.
7954 use for further scripting.
7955 The converse is also possible: when executing an alias or calling to the
7955 The converse is also possible: when executing an alias or calling to the
7956 system via
7956 system via
7957 \family typewriter
7957 \family typewriter
7958 !
7958 !
7959 \family default
7959 \family default
7960 /
7960 /
7961 \family typewriter
7961 \family typewriter
7962 !!
7962 !!
7963 \family default
7963 \family default
7964 , you can expand any python variable or expression by prepending it with
7964 , you can expand any python variable or expression by prepending it with
7965
7965
7966 \family typewriter
7966 \family typewriter
7967 $
7967 $
7968 \family default
7968 \family default
7969 .
7969 .
7970 Full details of the allowed syntax can be found in Python's PEP 215.
7970 Full details of the allowed syntax can be found in Python's PEP 215.
7971 \end_layout
7971 \end_layout
7972
7972
7973 \begin_layout Standard
7973 \begin_layout Standard
7974 A few brief examples will illustrate these (note that the indentation below
7974 A few brief examples will illustrate these (note that the indentation below
7975 may be incorrectly displayed):
7975 may be incorrectly displayed):
7976 \end_layout
7976 \end_layout
7977
7977
7978 \begin_layout Standard
7978 \begin_layout Standard
7979
7979
7980 \family typewriter
7980 \family typewriter
7981 fperez[~/test]|3> !ls *s.py
7981 fperez[~/test]|3> !ls *s.py
7982 \newline
7982 \newline
7983 scopes.py strings.py
7983 scopes.py strings.py
7984 \end_layout
7984 \end_layout
7985
7985
7986 \begin_layout Standard
7986 \begin_layout Standard
7987 ls is an internal alias, so there's no need to use
7987 ls is an internal alias, so there's no need to use
7988 \family typewriter
7988 \family typewriter
7989 !
7989 !
7990 \family default
7990 \family default
7991 :
7991 :
7992 \end_layout
7992 \end_layout
7993
7993
7994 \begin_layout Standard
7994 \begin_layout Standard
7995
7995
7996 \family typewriter
7996 \family typewriter
7997 fperez[~/test]|4> ls *s.py
7997 fperez[~/test]|4> ls *s.py
7998 \newline
7998 \newline
7999 scopes.py* strings.py
7999 scopes.py* strings.py
8000 \end_layout
8000 \end_layout
8001
8001
8002 \begin_layout Standard
8002 \begin_layout Standard
8003 !!ls will return the output into a Python variable:
8003 !!ls will return the output into a Python variable:
8004 \end_layout
8004 \end_layout
8005
8005
8006 \begin_layout Standard
8006 \begin_layout Standard
8007
8007
8008 \family typewriter
8008 \family typewriter
8009 fperez[~/test]|5> !!ls *s.py
8009 fperez[~/test]|5> !!ls *s.py
8010 \newline
8010 \newline
8011
8011
8012 \begin_inset ERT
8012 \begin_inset ERT
8013 status collapsed
8013 status collapsed
8014
8014
8015 \begin_layout Standard
8015 \begin_layout Standard
8016
8016
8017
8017
8018 \backslash
8018 \backslash
8019 hspace*{0mm}
8019 hspace*{0mm}
8020 \end_layout
8020 \end_layout
8021
8021
8022 \end_inset
8022 \end_inset
8023
8023
8024 \InsetSpace ~
8024 \InsetSpace ~
8025 \InsetSpace ~
8025 \InsetSpace ~
8026 \InsetSpace ~
8026 \InsetSpace ~
8027 \InsetSpace ~
8027 \InsetSpace ~
8028 \InsetSpace ~
8028 \InsetSpace ~
8029 \InsetSpace ~
8029 \InsetSpace ~
8030 \InsetSpace ~
8030 \InsetSpace ~
8031 \InsetSpace ~
8031 \InsetSpace ~
8032 \InsetSpace ~
8032 \InsetSpace ~
8033 \InsetSpace ~
8033 \InsetSpace ~
8034 \InsetSpace ~
8034 \InsetSpace ~
8035 \InsetSpace ~
8035 \InsetSpace ~
8036 \InsetSpace ~
8036 \InsetSpace ~
8037 \InsetSpace ~
8037 \InsetSpace ~
8038 <5> ['scopes.py', 'strings.py']
8038 <5> ['scopes.py', 'strings.py']
8039 \newline
8039 \newline
8040 fperez[~/test]|6> print _5
8040 fperez[~/test]|6> print _5
8041 \newline
8041 \newline
8042 ['scopes.py', 'strings.py
8042 ['scopes.py', 'strings.py
8043 ']
8043 ']
8044 \end_layout
8044 \end_layout
8045
8045
8046 \begin_layout Standard
8046 \begin_layout Standard
8047
8047
8048 \family typewriter
8048 \family typewriter
8049 $
8049 $
8050 \family default
8050 \family default
8051 and
8051 and
8052 \family typewriter
8052 \family typewriter
8053 $$
8053 $$
8054 \family default
8054 \family default
8055 allow direct capture to named variables:
8055 allow direct capture to named variables:
8056 \end_layout
8056 \end_layout
8057
8057
8058 \begin_layout Standard
8058 \begin_layout Standard
8059
8059
8060 \family typewriter
8060 \family typewriter
8061 fperez[~/test]|7> $astr = ls *s.py
8061 fperez[~/test]|7> $astr = ls *s.py
8062 \newline
8062 \newline
8063 fperez[~/test]|8> astr
8063 fperez[~/test]|8> astr
8064 \newline
8064 \newline
8065
8065
8066 \begin_inset ERT
8066 \begin_inset ERT
8067 status collapsed
8067 status collapsed
8068
8068
8069 \begin_layout Standard
8069 \begin_layout Standard
8070
8070
8071
8071
8072 \backslash
8072 \backslash
8073 hspace*{0mm}
8073 hspace*{0mm}
8074 \end_layout
8074 \end_layout
8075
8075
8076 \end_inset
8076 \end_inset
8077
8077
8078 \InsetSpace ~
8078 \InsetSpace ~
8079 \InsetSpace ~
8079 \InsetSpace ~
8080 \InsetSpace ~
8080 \InsetSpace ~
8081 \InsetSpace ~
8081 \InsetSpace ~
8082 \InsetSpace ~
8082 \InsetSpace ~
8083 \InsetSpace ~
8083 \InsetSpace ~
8084 \InsetSpace ~
8084 \InsetSpace ~
8085 \InsetSpace ~
8085 \InsetSpace ~
8086 \InsetSpace ~
8086 \InsetSpace ~
8087 \InsetSpace ~
8087 \InsetSpace ~
8088 \InsetSpace ~
8088 \InsetSpace ~
8089 \InsetSpace ~
8089 \InsetSpace ~
8090 \InsetSpace ~
8090 \InsetSpace ~
8091 \InsetSpace ~
8091 \InsetSpace ~
8092 <8> 'scopes.py
8092 <8> 'scopes.py
8093 \backslash
8093 \backslash
8094 nstrings.py'
8094 nstrings.py'
8095 \end_layout
8095 \end_layout
8096
8096
8097 \begin_layout Standard
8097 \begin_layout Standard
8098
8098
8099 \family typewriter
8099 \family typewriter
8100 fperez[~/test]|9> $$alist = ls *s.py
8100 fperez[~/test]|9> $$alist = ls *s.py
8101 \newline
8101 \newline
8102 fperez[~/test]|10> alist
8102 fperez[~/test]|10> alist
8103 \newline
8103 \newline
8104
8104
8105 \begin_inset ERT
8105 \begin_inset ERT
8106 status collapsed
8106 status collapsed
8107
8107
8108 \begin_layout Standard
8108 \begin_layout Standard
8109
8109
8110
8110
8111 \backslash
8111 \backslash
8112 hspace*{0mm}
8112 hspace*{0mm}
8113 \end_layout
8113 \end_layout
8114
8114
8115 \end_inset
8115 \end_inset
8116
8116
8117 \InsetSpace ~
8117 \InsetSpace ~
8118 \InsetSpace ~
8118 \InsetSpace ~
8119 \InsetSpace ~
8119 \InsetSpace ~
8120 \InsetSpace ~
8120 \InsetSpace ~
8121 \InsetSpace ~
8121 \InsetSpace ~
8122 \InsetSpace ~
8122 \InsetSpace ~
8123 \InsetSpace ~
8123 \InsetSpace ~
8124 \InsetSpace ~
8124 \InsetSpace ~
8125 \InsetSpace ~
8125 \InsetSpace ~
8126 \InsetSpace ~
8126 \InsetSpace ~
8127 \InsetSpace ~
8127 \InsetSpace ~
8128 \InsetSpace ~
8128 \InsetSpace ~
8129 \InsetSpace ~
8129 \InsetSpace ~
8130 \InsetSpace ~
8130 \InsetSpace ~
8131 <10> ['scopes.py', 'strings.py']
8131 <10> ['scopes.py', 'strings.py']
8132 \end_layout
8132 \end_layout
8133
8133
8134 \begin_layout Standard
8134 \begin_layout Standard
8135 alist is now a normal python list you can loop over.
8135 alist is now a normal python list you can loop over.
8136 Using
8136 Using
8137 \family typewriter
8137 \family typewriter
8138 $
8138 $
8139 \family default
8139 \family default
8140 will expand back the python values when alias calls are made:
8140 will expand back the python values when alias calls are made:
8141 \end_layout
8141 \end_layout
8142
8142
8143 \begin_layout Standard
8143 \begin_layout Standard
8144
8144
8145 \family typewriter
8145 \family typewriter
8146 fperez[~/test]|11> for f in alist:
8146 fperez[~/test]|11> for f in alist:
8147 \newline
8147 \newline
8148
8148
8149 \begin_inset ERT
8149 \begin_inset ERT
8150 status collapsed
8150 status collapsed
8151
8151
8152 \begin_layout Standard
8152 \begin_layout Standard
8153
8153
8154
8154
8155 \backslash
8155 \backslash
8156 hspace*{0mm}
8156 hspace*{0mm}
8157 \end_layout
8157 \end_layout
8158
8158
8159 \end_inset
8159 \end_inset
8160
8160
8161 \InsetSpace ~
8161 \InsetSpace ~
8162 \InsetSpace ~
8162 \InsetSpace ~
8163 \InsetSpace ~
8163 \InsetSpace ~
8164 \InsetSpace ~
8164 \InsetSpace ~
8165 \InsetSpace ~
8165 \InsetSpace ~
8166 \InsetSpace ~
8166 \InsetSpace ~
8167 \InsetSpace ~
8167 \InsetSpace ~
8168 \InsetSpace ~
8168 \InsetSpace ~
8169 \InsetSpace ~
8169 \InsetSpace ~
8170 \InsetSpace ~
8170 \InsetSpace ~
8171 \InsetSpace ~
8171 \InsetSpace ~
8172 \InsetSpace ~
8172 \InsetSpace ~
8173 \InsetSpace ~
8173 \InsetSpace ~
8174 \InsetSpace ~
8174 \InsetSpace ~
8175 |..> \InsetSpace ~
8175 |..> \InsetSpace ~
8176 \InsetSpace ~
8176 \InsetSpace ~
8177 \InsetSpace ~
8177 \InsetSpace ~
8178 \InsetSpace ~
8178 \InsetSpace ~
8179 print 'file',f,
8179 print 'file',f,
8180 \newline
8180 \newline
8181
8181
8182 \begin_inset ERT
8182 \begin_inset ERT
8183 status collapsed
8183 status collapsed
8184
8184
8185 \begin_layout Standard
8185 \begin_layout Standard
8186
8186
8187
8187
8188 \backslash
8188 \backslash
8189 hspace*{0mm}
8189 hspace*{0mm}
8190 \end_layout
8190 \end_layout
8191
8191
8192 \end_inset
8192 \end_inset
8193
8193
8194 \InsetSpace ~
8194 \InsetSpace ~
8195 \InsetSpace ~
8195 \InsetSpace ~
8196 \InsetSpace ~
8196 \InsetSpace ~
8197 \InsetSpace ~
8197 \InsetSpace ~
8198 \InsetSpace ~
8198 \InsetSpace ~
8199 \InsetSpace ~
8199 \InsetSpace ~
8200 \InsetSpace ~
8200 \InsetSpace ~
8201 \InsetSpace ~
8201 \InsetSpace ~
8202 \InsetSpace ~
8202 \InsetSpace ~
8203 \InsetSpace ~
8203 \InsetSpace ~
8204 \InsetSpace ~
8204 \InsetSpace ~
8205 \InsetSpace ~
8205 \InsetSpace ~
8206 \InsetSpace ~
8206 \InsetSpace ~
8207 \InsetSpace ~
8207 \InsetSpace ~
8208 |..> \InsetSpace ~
8208 |..> \InsetSpace ~
8209 \InsetSpace ~
8209 \InsetSpace ~
8210 \InsetSpace ~
8210 \InsetSpace ~
8211 \InsetSpace ~
8211 \InsetSpace ~
8212 wc -l $f
8212 wc -l $f
8213 \newline
8213 \newline
8214
8214
8215 \begin_inset ERT
8215 \begin_inset ERT
8216 status collapsed
8216 status collapsed
8217
8217
8218 \begin_layout Standard
8218 \begin_layout Standard
8219
8219
8220
8220
8221 \backslash
8221 \backslash
8222 hspace*{0mm}
8222 hspace*{0mm}
8223 \end_layout
8223 \end_layout
8224
8224
8225 \end_inset
8225 \end_inset
8226
8226
8227 \InsetSpace ~
8227 \InsetSpace ~
8228 \InsetSpace ~
8228 \InsetSpace ~
8229 \InsetSpace ~
8229 \InsetSpace ~
8230 \InsetSpace ~
8230 \InsetSpace ~
8231 \InsetSpace ~
8231 \InsetSpace ~
8232 \InsetSpace ~
8232 \InsetSpace ~
8233 \InsetSpace ~
8233 \InsetSpace ~
8234 \InsetSpace ~
8234 \InsetSpace ~
8235 \InsetSpace ~
8235 \InsetSpace ~
8236 \InsetSpace ~
8236 \InsetSpace ~
8237 \InsetSpace ~
8237 \InsetSpace ~
8238 \InsetSpace ~
8238 \InsetSpace ~
8239 \InsetSpace ~
8239 \InsetSpace ~
8240 \InsetSpace ~
8240 \InsetSpace ~
8241 |..>
8241 |..>
8242 \newline
8242 \newline
8243 file scopes.py 13 scopes.py
8243 file scopes.py 13 scopes.py
8244 \newline
8244 \newline
8245 file strings.py 4 strings.py
8245 file strings.py 4 strings.py
8246 \end_layout
8246 \end_layout
8247
8247
8248 \begin_layout Standard
8248 \begin_layout Standard
8249 Note that you may need to protect your variables with braces if you want
8249 Note that you may need to protect your variables with braces if you want
8250 to append strings to their names.
8250 to append strings to their names.
8251 To copy all files in alist to
8251 To copy all files in alist to
8252 \family typewriter
8252 \family typewriter
8253 .bak
8253 .bak
8254 \family default
8254 \family default
8255 extensions, you must use:
8255 extensions, you must use:
8256 \end_layout
8256 \end_layout
8257
8257
8258 \begin_layout Standard
8258 \begin_layout Standard
8259
8259
8260 \family typewriter
8260 \family typewriter
8261 fperez[~/test]|12> for f in alist:
8261 fperez[~/test]|12> for f in alist:
8262 \newline
8262 \newline
8263
8263
8264 \begin_inset ERT
8264 \begin_inset ERT
8265 status collapsed
8265 status collapsed
8266
8266
8267 \begin_layout Standard
8267 \begin_layout Standard
8268
8268
8269
8269
8270 \backslash
8270 \backslash
8271 hspace*{0mm}
8271 hspace*{0mm}
8272 \end_layout
8272 \end_layout
8273
8273
8274 \end_inset
8274 \end_inset
8275
8275
8276 \InsetSpace ~
8276 \InsetSpace ~
8277 \InsetSpace ~
8277 \InsetSpace ~
8278 \InsetSpace ~
8278 \InsetSpace ~
8279 \InsetSpace ~
8279 \InsetSpace ~
8280 \InsetSpace ~
8280 \InsetSpace ~
8281 \InsetSpace ~
8281 \InsetSpace ~
8282 \InsetSpace ~
8282 \InsetSpace ~
8283 \InsetSpace ~
8283 \InsetSpace ~
8284 \InsetSpace ~
8284 \InsetSpace ~
8285 \InsetSpace ~
8285 \InsetSpace ~
8286 \InsetSpace ~
8286 \InsetSpace ~
8287 \InsetSpace ~
8287 \InsetSpace ~
8288 \InsetSpace ~
8288 \InsetSpace ~
8289 \InsetSpace ~
8289 \InsetSpace ~
8290 |..> \InsetSpace ~
8290 |..> \InsetSpace ~
8291 \InsetSpace ~
8291 \InsetSpace ~
8292 \InsetSpace ~
8292 \InsetSpace ~
8293 \InsetSpace ~
8293 \InsetSpace ~
8294 cp $f ${f}.bak
8294 cp $f ${f}.bak
8295 \end_layout
8295 \end_layout
8296
8296
8297 \begin_layout Standard
8297 \begin_layout Standard
8298 If you try using
8298 If you try using
8299 \family typewriter
8299 \family typewriter
8300 $f.bak
8300 $f.bak
8301 \family default
8301 \family default
8302 , you'll get an AttributeError exception saying that your string object
8302 , you'll get an AttributeError exception saying that your string object
8303 doesn't have a
8303 doesn't have a
8304 \family typewriter
8304 \family typewriter
8305 .bak
8305 .bak
8306 \family default
8306 \family default
8307 attribute.
8307 attribute.
8308 This is because the
8308 This is because the
8309 \family typewriter
8309 \family typewriter
8310 $
8310 $
8311 \family default
8311 \family default
8312 expansion mechanism allows you to expand full Python expressions:
8312 expansion mechanism allows you to expand full Python expressions:
8313 \end_layout
8313 \end_layout
8314
8314
8315 \begin_layout Standard
8315 \begin_layout Standard
8316
8316
8317 \family typewriter
8317 \family typewriter
8318 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
8318 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
8319 \newline
8319 \newline
8320 sys.platform is: linux2
8320 sys.platform is: linux2
8321 \end_layout
8321 \end_layout
8322
8322
8323 \begin_layout Standard
8323 \begin_layout Standard
8324 IPython's input history handling is still active, which allows you to rerun
8324 IPython's input history handling is still active, which allows you to rerun
8325 a single block of multi-line input by simply using exec:
8325 a single block of multi-line input by simply using exec:
8326 \newline
8326 \newline
8327
8327
8328 \family typewriter
8328 \family typewriter
8329 fperez[~/test]|14> $$alist = ls *.eps
8329 fperez[~/test]|14> $$alist = ls *.eps
8330 \newline
8330 \newline
8331 fperez[~/test]|15> exec _i11
8331 fperez[~/test]|15> exec _i11
8332 \newline
8332 \newline
8333 file image2.eps
8333 file image2.eps
8334 921 image2.eps
8334 921 image2.eps
8335 \newline
8335 \newline
8336 file image.eps 921 image.eps
8336 file image.eps 921 image.eps
8337 \end_layout
8337 \end_layout
8338
8338
8339 \begin_layout Standard
8339 \begin_layout Standard
8340 While these are new special-case syntaxes, they are designed to allow very
8340 While these are new special-case syntaxes, they are designed to allow very
8341 efficient use of the shell with minimal typing.
8341 efficient use of the shell with minimal typing.
8342 At an interactive shell prompt, conciseness of expression wins over readability.
8342 At an interactive shell prompt, conciseness of expression wins over readability.
8343 \end_layout
8343 \end_layout
8344
8344
8345 \begin_layout Subsection
8345 \begin_layout Subsection
8346 Useful functions and modules
8346 Useful functions and modules
8347 \end_layout
8347 \end_layout
8348
8348
8349 \begin_layout Standard
8349 \begin_layout Standard
8350 The os, sys and shutil modules from the Python standard library are automaticall
8350 The os, sys and shutil modules from the Python standard library are automaticall
8351 y loaded.
8351 y loaded.
8352 Some additional functions, useful for shell usage, are listed below.
8352 Some additional functions, useful for shell usage, are listed below.
8353 You can request more help about them with `
8353 You can request more help about them with `
8354 \family typewriter
8354 \family typewriter
8355 ?
8355 ?
8356 \family default
8356 \family default
8357 '.
8357 '.
8358 \end_layout
8358 \end_layout
8359
8359
8360 \begin_layout Description
8360 \begin_layout Description
8361
8361
8362 \family typewriter
8362 \family typewriter
8363 shell
8363 shell
8364 \family default
8364 \family default
8365 - execute a command in the underlying system shell
8365 - execute a command in the underlying system shell
8366 \end_layout
8366 \end_layout
8367
8367
8368 \begin_layout Description
8368 \begin_layout Description
8369
8369
8370 \family typewriter
8370 \family typewriter
8371 system
8371 system
8372 \family default
8372 \family default
8373 - like
8373 - like
8374 \family typewriter
8374 \family typewriter
8375 shell()
8375 shell()
8376 \family default
8376 \family default
8377 , but return the exit status of the command
8377 , but return the exit status of the command
8378 \end_layout
8378 \end_layout
8379
8379
8380 \begin_layout Description
8380 \begin_layout Description
8381
8381
8382 \family typewriter
8382 \family typewriter
8383 sout
8383 sout
8384 \family default
8384 \family default
8385 - capture the output of a command as a string
8385 - capture the output of a command as a string
8386 \end_layout
8386 \end_layout
8387
8387
8388 \begin_layout Description
8388 \begin_layout Description
8389
8389
8390 \family typewriter
8390 \family typewriter
8391 lout
8391 lout
8392 \family default
8392 \family default
8393 - capture the output of a command as a list (split on `
8393 - capture the output of a command as a list (split on `
8394 \backslash
8394 \backslash
8395 n')
8395 n')
8396 \end_layout
8396 \end_layout
8397
8397
8398 \begin_layout Description
8398 \begin_layout Description
8399
8399
8400 \family typewriter
8400 \family typewriter
8401 getoutputerror
8401 getoutputerror
8402 \family default
8402 \family default
8403 - capture (output,error) of a shell commandss
8403 - capture (output,error) of a shell commandss
8404 \end_layout
8404 \end_layout
8405
8405
8406 \begin_layout Standard
8406 \begin_layout Standard
8407
8407
8408 \family typewriter
8408 \family typewriter
8409 sout
8409 sout
8410 \family default
8410 \family default
8411 /
8411 /
8412 \family typewriter
8412 \family typewriter
8413 lout
8413 lout
8414 \family default
8414 \family default
8415 are the functional equivalents of
8415 are the functional equivalents of
8416 \family typewriter
8416 \family typewriter
8417 $
8417 $
8418 \family default
8418 \family default
8419 /
8419 /
8420 \family typewriter
8420 \family typewriter
8421 $$
8421 $$
8422 \family default
8422 \family default
8423 .
8423 .
8424 They are provided to allow you to capture system output in the middle of
8424 They are provided to allow you to capture system output in the middle of
8425 true python code, function definitions, etc (where
8425 true python code, function definitions, etc (where
8426 \family typewriter
8426 \family typewriter
8427 $
8427 $
8428 \family default
8428 \family default
8429 and
8429 and
8430 \family typewriter
8430 \family typewriter
8431 $$
8431 $$
8432 \family default
8432 \family default
8433 are invalid).
8433 are invalid).
8434 \end_layout
8434 \end_layout
8435
8435
8436 \begin_layout Subsection
8436 \begin_layout Subsection
8437 Directory management
8437 Directory management
8438 \end_layout
8438 \end_layout
8439
8439
8440 \begin_layout Standard
8440 \begin_layout Standard
8441 Since each command passed by pysh to the underlying system is executed in
8441 Since each command passed by pysh to the underlying system is executed in
8442 a subshell which exits immediately, you can NOT use !cd to navigate the
8442 a subshell which exits immediately, you can NOT use !cd to navigate the
8443 filesystem.
8443 filesystem.
8444 \end_layout
8444 \end_layout
8445
8445
8446 \begin_layout Standard
8446 \begin_layout Standard
8447 Pysh provides its own builtin
8447 Pysh provides its own builtin
8448 \family typewriter
8448 \family typewriter
8449 `%cd
8449 `%cd
8450 \family default
8450 \family default
8451 ' magic command to move in the filesystem (the
8451 ' magic command to move in the filesystem (the
8452 \family typewriter
8452 \family typewriter
8453 %
8453 %
8454 \family default
8454 \family default
8455 is not required with automagic on).
8455 is not required with automagic on).
8456 It also maintains a list of visited directories (use
8456 It also maintains a list of visited directories (use
8457 \family typewriter
8457 \family typewriter
8458 %dhist
8458 %dhist
8459 \family default
8459 \family default
8460 to see it) and allows direct switching to any of them.
8460 to see it) and allows direct switching to any of them.
8461 Type
8461 Type
8462 \family typewriter
8462 \family typewriter
8463 `cd?
8463 `cd?
8464 \family default
8464 \family default
8465 ' for more details.
8465 ' for more details.
8466 \end_layout
8466 \end_layout
8467
8467
8468 \begin_layout Standard
8468 \begin_layout Standard
8469
8469
8470 \family typewriter
8470 \family typewriter
8471 %pushd
8471 %pushd
8472 \family default
8472 \family default
8473 ,
8473 ,
8474 \family typewriter
8474 \family typewriter
8475 %popd
8475 %popd
8476 \family default
8476 \family default
8477 and
8477 and
8478 \family typewriter
8478 \family typewriter
8479 %dirs
8479 %dirs
8480 \family default
8480 \family default
8481 are provided for directory stack handling.
8481 are provided for directory stack handling.
8482 \end_layout
8482 \end_layout
8483
8483
8484 \begin_layout Subsection
8484 \begin_layout Subsection
8485 Prompt customization
8485 Prompt customization
8486 \end_layout
8486 \end_layout
8487
8487
8488 \begin_layout Standard
8488 \begin_layout Standard
8489 The supplied
8489 The supplied
8490 \family typewriter
8490 \family typewriter
8491 ipythonrc-pysh
8491 ipythonrc-pysh
8492 \family default
8492 \family default
8493 profile comes with an example of a very colored and detailed prompt, mainly
8493 profile comes with an example of a very colored and detailed prompt, mainly
8494 to serve as an illustration.
8494 to serve as an illustration.
8495 The valid escape sequences, besides color names, are:
8495 The valid escape sequences, besides color names, are:
8496 \end_layout
8496 \end_layout
8497
8497
8498 \begin_layout Description
8498 \begin_layout Description
8499
8499
8500 \backslash
8500 \backslash
8501 # - Prompt number.
8501 # - Prompt number, wrapped in the color escapes for the input prompt (determined
8502 by the current color scheme).
8503 \end_layout
8504
8505 \begin_layout Description
8506
8507 \backslash
8508 N - Just the prompt counter number,
8509 \emph on
8510 without
8511 \emph default
8512 any coloring wrappers.
8513 You can thus customize the actual prompt colors manually.
8502 \end_layout
8514 \end_layout
8503
8515
8504 \begin_layout Description
8516 \begin_layout Description
8505
8517
8506 \backslash
8518 \backslash
8507 D - Dots, as many as there are digits in
8519 D - Dots, as many as there are digits in
8508 \backslash
8520 \backslash
8509 # (so they align).
8521 # (so they align).
8510 \end_layout
8522 \end_layout
8511
8523
8512 \begin_layout Description
8524 \begin_layout Description
8513
8525
8514 \backslash
8526 \backslash
8515 w - Current working directory (cwd).
8527 w - Current working directory (cwd).
8516 \end_layout
8528 \end_layout
8517
8529
8518 \begin_layout Description
8530 \begin_layout Description
8519
8531
8520 \backslash
8532 \backslash
8521 W - Basename of current working directory.
8533 W - Basename of current working directory.
8522 \end_layout
8534 \end_layout
8523
8535
8524 \begin_layout Description
8536 \begin_layout Description
8525
8537
8526 \backslash
8538 \backslash
8527 X
8539 X
8528 \emph on
8540 \emph on
8529 N
8541 N
8530 \emph default
8542 \emph default
8531 - Where
8543 - Where
8532 \emph on
8544 \emph on
8533 N
8545 N
8534 \emph default
8546 \emph default
8535 =0..5.
8547 =0..5.
8536 N terms of the cwd, with $HOME written as ~.
8548 N terms of the cwd, with $HOME written as ~.
8537 \end_layout
8549 \end_layout
8538
8550
8539 \begin_layout Description
8551 \begin_layout Description
8540
8552
8541 \backslash
8553 \backslash
8542 Y
8554 Y
8543 \emph on
8555 \emph on
8544 N
8556 N
8545 \emph default
8557 \emph default
8546 - Where
8558 - Where
8547 \emph on
8559 \emph on
8548 N
8560 N
8549 \emph default
8561 \emph default
8550 =0..5.
8562 =0..5.
8551 Like X
8563 Like X
8552 \emph on
8564 \emph on
8553 N
8565 N
8554 \emph default
8566 \emph default
8555 , but if ~ is term
8567 , but if ~ is term
8556 \emph on
8568 \emph on
8557 N
8569 N
8558 \emph default
8570 \emph default
8559 +1 it's also shown.
8571 +1 it's also shown.
8560 \end_layout
8572 \end_layout
8561
8573
8562 \begin_layout Description
8574 \begin_layout Description
8563
8575
8564 \backslash
8576 \backslash
8565 u - Username.
8577 u - Username.
8566 \end_layout
8578 \end_layout
8567
8579
8568 \begin_layout Description
8580 \begin_layout Description
8569
8581
8570 \backslash
8582 \backslash
8571 H - Full hostname.
8583 H - Full hostname.
8572 \end_layout
8584 \end_layout
8573
8585
8574 \begin_layout Description
8586 \begin_layout Description
8575
8587
8576 \backslash
8588 \backslash
8577 h - Hostname up to first '.'
8589 h - Hostname up to first '.'
8578 \end_layout
8590 \end_layout
8579
8591
8580 \begin_layout Description
8592 \begin_layout Description
8581
8593
8582 \backslash
8594 \backslash
8583 $ - Root symbol ($ or #).
8595 $ - Root symbol ($ or #).
8584
8596
8585 \end_layout
8597 \end_layout
8586
8598
8587 \begin_layout Description
8599 \begin_layout Description
8588
8600
8589 \backslash
8601 \backslash
8590 t - Current time, in H:M:S format.
8602 t - Current time, in H:M:S format.
8591 \end_layout
8603 \end_layout
8592
8604
8593 \begin_layout Description
8605 \begin_layout Description
8594
8606
8595 \backslash
8607 \backslash
8596 v - IPython release version.
8608 v - IPython release version.
8597
8609
8598 \end_layout
8610 \end_layout
8599
8611
8600 \begin_layout Description
8612 \begin_layout Description
8601
8613
8602 \backslash
8614 \backslash
8603 n - Newline.
8615 n - Newline.
8604
8616
8605 \end_layout
8617 \end_layout
8606
8618
8607 \begin_layout Description
8619 \begin_layout Description
8608
8620
8609 \backslash
8621 \backslash
8610 r - Carriage return.
8622 r - Carriage return.
8611
8623
8612 \end_layout
8624 \end_layout
8613
8625
8614 \begin_layout Description
8626 \begin_layout Description
8615
8627
8616 \backslash
8628 \backslash
8617
8629
8618 \backslash
8630 \backslash
8619 - An explicitly escaped '
8631 - An explicitly escaped '
8620 \backslash
8632 \backslash
8621 '.
8633 '.
8622 \end_layout
8634 \end_layout
8623
8635
8624 \begin_layout Standard
8636 \begin_layout Standard
8625 You can configure your prompt colors using any ANSI color escape.
8637 You can configure your prompt colors using any ANSI color escape.
8626 Each color escape sets the color for any subsequent text, until another
8638 Each color escape sets the color for any subsequent text, until another
8627 escape comes in and changes things.
8639 escape comes in and changes things.
8628 The valid color escapes are:
8640 The valid color escapes are:
8629 \end_layout
8641 \end_layout
8630
8642
8631 \begin_layout Description
8643 \begin_layout Description
8632
8644
8633 \backslash
8645 \backslash
8634 C_Black
8646 C_Black
8635 \end_layout
8647 \end_layout
8636
8648
8637 \begin_layout Description
8649 \begin_layout Description
8638
8650
8639 \backslash
8651 \backslash
8640 C_Blue
8652 C_Blue
8641 \end_layout
8653 \end_layout
8642
8654
8643 \begin_layout Description
8655 \begin_layout Description
8644
8656
8645 \backslash
8657 \backslash
8646 C_Brown
8658 C_Brown
8647 \end_layout
8659 \end_layout
8648
8660
8649 \begin_layout Description
8661 \begin_layout Description
8650
8662
8651 \backslash
8663 \backslash
8652 C_Cyan
8664 C_Cyan
8653 \end_layout
8665 \end_layout
8654
8666
8655 \begin_layout Description
8667 \begin_layout Description
8656
8668
8657 \backslash
8669 \backslash
8658 C_DarkGray
8670 C_DarkGray
8659 \end_layout
8671 \end_layout
8660
8672
8661 \begin_layout Description
8673 \begin_layout Description
8662
8674
8663 \backslash
8675 \backslash
8664 C_Green
8676 C_Green
8665 \end_layout
8677 \end_layout
8666
8678
8667 \begin_layout Description
8679 \begin_layout Description
8668
8680
8669 \backslash
8681 \backslash
8670 C_LightBlue
8682 C_LightBlue
8671 \end_layout
8683 \end_layout
8672
8684
8673 \begin_layout Description
8685 \begin_layout Description
8674
8686
8675 \backslash
8687 \backslash
8676 C_LightCyan
8688 C_LightCyan
8677 \end_layout
8689 \end_layout
8678
8690
8679 \begin_layout Description
8691 \begin_layout Description
8680
8692
8681 \backslash
8693 \backslash
8682 C_LightGray
8694 C_LightGray
8683 \end_layout
8695 \end_layout
8684
8696
8685 \begin_layout Description
8697 \begin_layout Description
8686
8698
8687 \backslash
8699 \backslash
8688 C_LightGreen
8700 C_LightGreen
8689 \end_layout
8701 \end_layout
8690
8702
8691 \begin_layout Description
8703 \begin_layout Description
8692
8704
8693 \backslash
8705 \backslash
8694 C_LightPurple
8706 C_LightPurple
8695 \end_layout
8707 \end_layout
8696
8708
8697 \begin_layout Description
8709 \begin_layout Description
8698
8710
8699 \backslash
8711 \backslash
8700 C_LightRed
8712 C_LightRed
8701 \end_layout
8713 \end_layout
8702
8714
8703 \begin_layout Description
8715 \begin_layout Description
8704
8716
8705 \backslash
8717 \backslash
8706 C_Purple
8718 C_Purple
8707 \end_layout
8719 \end_layout
8708
8720
8709 \begin_layout Description
8721 \begin_layout Description
8710
8722
8711 \backslash
8723 \backslash
8712 C_Red
8724 C_Red
8713 \end_layout
8725 \end_layout
8714
8726
8715 \begin_layout Description
8727 \begin_layout Description
8716
8728
8717 \backslash
8729 \backslash
8718 C_White
8730 C_White
8719 \end_layout
8731 \end_layout
8720
8732
8721 \begin_layout Description
8733 \begin_layout Description
8722
8734
8723 \backslash
8735 \backslash
8724 C_Yellow
8736 C_Yellow
8725 \end_layout
8737 \end_layout
8726
8738
8727 \begin_layout Description
8739 \begin_layout Description
8728
8740
8729 \backslash
8741 \backslash
8730 C_Normal Stop coloring, defaults to your terminal settings.
8742 C_Normal Stop coloring, defaults to your terminal settings.
8731 \end_layout
8743 \end_layout
8732
8744
8733 \begin_layout Section
8745 \begin_layout Section
8734 \begin_inset LatexCommand \label{sec:Threading-support}
8746 \begin_inset LatexCommand \label{sec:Threading-support}
8735
8747
8736 \end_inset
8748 \end_inset
8737
8749
8738 Threading support
8750 Threading support
8739 \end_layout
8751 \end_layout
8740
8752
8741 \begin_layout Standard
8753 \begin_layout Standard
8742
8754
8743 \series bold
8755 \series bold
8744 WARNING:
8756 WARNING:
8745 \series default
8757 \series default
8746 The threading support is still somewhat experimental, and it has only seen
8758 The threading support is still somewhat experimental, and it has only seen
8747 reasonable testing under Linux.
8759 reasonable testing under Linux.
8748 Threaded code is particularly tricky to debug, and it tends to show extremely
8760 Threaded code is particularly tricky to debug, and it tends to show extremely
8749 platform-dependent behavior.
8761 platform-dependent behavior.
8750 Since I only have access to Linux machines, I will have to rely on user's
8762 Since I only have access to Linux machines, I will have to rely on user's
8751 experiences and assistance for this area of IPython to improve under other
8763 experiences and assistance for this area of IPython to improve under other
8752 platforms.
8764 platforms.
8753 \end_layout
8765 \end_layout
8754
8766
8755 \begin_layout Standard
8767 \begin_layout Standard
8756 IPython, via the
8768 IPython, via the
8757 \family typewriter
8769 \family typewriter
8758 -gthread
8770 -gthread
8759 \family default
8771 \family default
8760 ,
8772 ,
8761 \family typewriter
8773 \family typewriter
8762 -qthread
8774 -qthread
8763 \family default
8775 \family default
8764 and
8776 and
8765 \family typewriter
8777 \family typewriter
8766 -wthread
8778 -wthread
8767 \family default
8779 \family default
8768 options (described in Sec.\InsetSpace ~
8780 options (described in Sec.\InsetSpace ~
8769
8781
8770 \begin_inset LatexCommand \ref{sec:threading-opts}
8782 \begin_inset LatexCommand \ref{sec:threading-opts}
8771
8783
8772 \end_inset
8784 \end_inset
8773
8785
8774 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
8786 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
8775 respectively.
8787 respectively.
8776 These GUI toolkits need to control the python main loop of execution, so
8788 These GUI toolkits need to control the python main loop of execution, so
8777 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
8789 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
8778 will immediately freeze the shell.
8790 will immediately freeze the shell.
8779
8791
8780 \end_layout
8792 \end_layout
8781
8793
8782 \begin_layout Standard
8794 \begin_layout Standard
8783 IPython, with one of these options (you can only use one at a time), separates
8795 IPython, with one of these options (you can only use one at a time), separates
8784 the graphical loop and IPython's code execution run into different threads.
8796 the graphical loop and IPython's code execution run into different threads.
8785 This allows you to test interactively (with
8797 This allows you to test interactively (with
8786 \family typewriter
8798 \family typewriter
8787 %run
8799 %run
8788 \family default
8800 \family default
8789 , for example) your GUI code without blocking.
8801 , for example) your GUI code without blocking.
8790 \end_layout
8802 \end_layout
8791
8803
8792 \begin_layout Standard
8804 \begin_layout Standard
8793 A nice mini-tutorial on using IPython along with the Qt Designer application
8805 A nice mini-tutorial on using IPython along with the Qt Designer application
8794 is available at the SciPy wiki:
8806 is available at the SciPy wiki:
8795 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer}
8807 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer}
8796
8808
8797 \end_inset
8809 \end_inset
8798
8810
8799 .
8811 .
8800 \end_layout
8812 \end_layout
8801
8813
8802 \begin_layout Subsection
8814 \begin_layout Subsection
8803 Tk issues
8815 Tk issues
8804 \end_layout
8816 \end_layout
8805
8817
8806 \begin_layout Standard
8818 \begin_layout Standard
8807 As indicated in Sec.\InsetSpace ~
8819 As indicated in Sec.\InsetSpace ~
8808
8820
8809 \begin_inset LatexCommand \ref{sec:threading-opts}
8821 \begin_inset LatexCommand \ref{sec:threading-opts}
8810
8822
8811 \end_inset
8823 \end_inset
8812
8824
8813 , a special
8825 , a special
8814 \family typewriter
8826 \family typewriter
8815 -tk
8827 -tk
8816 \family default
8828 \family default
8817 option is provided to try and allow Tk graphical applications to coexist
8829 option is provided to try and allow Tk graphical applications to coexist
8818 interactively with WX, Qt or GTK ones.
8830 interactively with WX, Qt or GTK ones.
8819 Whether this works at all, however, is very platform and configuration
8831 Whether this works at all, however, is very platform and configuration
8820 dependent.
8832 dependent.
8821 Please experiment with simple test cases before committing to using this
8833 Please experiment with simple test cases before committing to using this
8822 combination of Tk and GTK/Qt/WX threading in a production environment.
8834 combination of Tk and GTK/Qt/WX threading in a production environment.
8823 \end_layout
8835 \end_layout
8824
8836
8825 \begin_layout Subsection
8837 \begin_layout Subsection
8826 Signals and Threads
8838 Signals and Threads
8827 \end_layout
8839 \end_layout
8828
8840
8829 \begin_layout Standard
8841 \begin_layout Standard
8830 When any of the thread systems (GTK, Qt or WX) are active, either directly
8842 When any of the thread systems (GTK, Qt or WX) are active, either directly
8831 or via
8843 or via
8832 \family typewriter
8844 \family typewriter
8833 -pylab
8845 -pylab
8834 \family default
8846 \family default
8835 with a threaded backend, it is impossible to interrupt long-running Python
8847 with a threaded backend, it is impossible to interrupt long-running Python
8836 code via
8848 code via
8837 \family typewriter
8849 \family typewriter
8838 Ctrl-C
8850 Ctrl-C
8839 \family default
8851 \family default
8840 .
8852 .
8841 IPython can not pass the KeyboardInterrupt exception (or the underlying
8853 IPython can not pass the KeyboardInterrupt exception (or the underlying
8842
8854
8843 \family typewriter
8855 \family typewriter
8844 SIGINT
8856 SIGINT
8845 \family default
8857 \family default
8846 ) across threads, so any long-running process started from IPython will
8858 ) across threads, so any long-running process started from IPython will
8847 run to completion, or will have to be killed via an external (OS-based)
8859 run to completion, or will have to be killed via an external (OS-based)
8848 mechanism.
8860 mechanism.
8849 \end_layout
8861 \end_layout
8850
8862
8851 \begin_layout Standard
8863 \begin_layout Standard
8852 To the best of my knowledge, this limitation is imposed by the Python interprete
8864 To the best of my knowledge, this limitation is imposed by the Python interprete
8853 r itself, and it comes from the difficulty of writing portable signal/threaded
8865 r itself, and it comes from the difficulty of writing portable signal/threaded
8854 code.
8866 code.
8855 If any user is an expert on this topic and can suggest a better solution,
8867 If any user is an expert on this topic and can suggest a better solution,
8856 I would love to hear about it.
8868 I would love to hear about it.
8857 In the IPython sources, look at the
8869 In the IPython sources, look at the
8858 \family typewriter
8870 \family typewriter
8859 Shell.py
8871 Shell.py
8860 \family default
8872 \family default
8861 module, and in particular at the
8873 module, and in particular at the
8862 \family typewriter
8874 \family typewriter
8863 runcode()
8875 runcode()
8864 \family default
8876 \family default
8865 method.
8877 method.
8866
8878
8867 \end_layout
8879 \end_layout
8868
8880
8869 \begin_layout Subsection
8881 \begin_layout Subsection
8870 I/O pitfalls
8882 I/O pitfalls
8871 \end_layout
8883 \end_layout
8872
8884
8873 \begin_layout Standard
8885 \begin_layout Standard
8874 Be mindful that the Python interpreter switches between threads every
8886 Be mindful that the Python interpreter switches between threads every
8875 \begin_inset Formula $N$
8887 \begin_inset Formula $N$
8876 \end_inset
8888 \end_inset
8877
8889
8878 bytecodes, where the default value as of Python\InsetSpace ~
8890 bytecodes, where the default value as of Python\InsetSpace ~
8879 2.3 is
8891 2.3 is
8880 \begin_inset Formula $N=100.$
8892 \begin_inset Formula $N=100.$
8881 \end_inset
8893 \end_inset
8882
8894
8883 This value can be read by using the
8895 This value can be read by using the
8884 \family typewriter
8896 \family typewriter
8885 sys.getcheckinterval()
8897 sys.getcheckinterval()
8886 \family default
8898 \family default
8887 function, and it can be reset via
8899 function, and it can be reset via
8888 \family typewriter
8900 \family typewriter
8889 sys.setcheckinterval(
8901 sys.setcheckinterval(
8890 \emph on
8902 \emph on
8891 N
8903 N
8892 \emph default
8904 \emph default
8893 )
8905 )
8894 \family default
8906 \family default
8895 .
8907 .
8896 This switching of threads can cause subtly confusing effects if one of
8908 This switching of threads can cause subtly confusing effects if one of
8897 your threads is doing file I/O.
8909 your threads is doing file I/O.
8898 In text mode, most systems only flush file buffers when they encounter
8910 In text mode, most systems only flush file buffers when they encounter
8899 a
8911 a
8900 \family typewriter
8912 \family typewriter
8901 `
8913 `
8902 \backslash
8914 \backslash
8903 n'
8915 n'
8904 \family default
8916 \family default
8905 .
8917 .
8906 An instruction as simple as
8918 An instruction as simple as
8907 \family typewriter
8919 \family typewriter
8908
8920
8909 \newline
8921 \newline
8910 \InsetSpace ~
8922 \InsetSpace ~
8911 \InsetSpace ~
8923 \InsetSpace ~
8912 print >> filehandle,
8924 print >> filehandle,
8913 \begin_inset Quotes eld
8925 \begin_inset Quotes eld
8914 \end_inset
8926 \end_inset
8915
8927
8916 hello world
8928 hello world
8917 \begin_inset Quotes erd
8929 \begin_inset Quotes erd
8918 \end_inset
8930 \end_inset
8919
8931
8920
8932
8921 \family default
8933 \family default
8922
8934
8923 \newline
8935 \newline
8924 actually consists of several bytecodes, so it is possible that the newline
8936 actually consists of several bytecodes, so it is possible that the newline
8925 does not reach your file before the next thread switch.
8937 does not reach your file before the next thread switch.
8926 Similarly, if you are writing to a file in binary mode, the file won't
8938 Similarly, if you are writing to a file in binary mode, the file won't
8927 be flushed until the buffer fills, and your other thread may see apparently
8939 be flushed until the buffer fills, and your other thread may see apparently
8928 truncated files.
8940 truncated files.
8929
8941
8930 \end_layout
8942 \end_layout
8931
8943
8932 \begin_layout Standard
8944 \begin_layout Standard
8933 For this reason, if you are using IPython's thread support and have (for
8945 For this reason, if you are using IPython's thread support and have (for
8934 example) a GUI application which will read data generated by files written
8946 example) a GUI application which will read data generated by files written
8935 to from the IPython thread, the safest approach is to open all of your
8947 to from the IPython thread, the safest approach is to open all of your
8936 files in unbuffered mode (the third argument to the
8948 files in unbuffered mode (the third argument to the
8937 \family typewriter
8949 \family typewriter
8938 file/open
8950 file/open
8939 \family default
8951 \family default
8940 function is the buffering value):
8952 function is the buffering value):
8941 \newline
8953 \newline
8942
8954
8943 \family typewriter
8955 \family typewriter
8944 \InsetSpace ~
8956 \InsetSpace ~
8945 \InsetSpace ~
8957 \InsetSpace ~
8946 filehandle = open(filename,mode,0)
8958 filehandle = open(filename,mode,0)
8947 \end_layout
8959 \end_layout
8948
8960
8949 \begin_layout Standard
8961 \begin_layout Standard
8950 This is obviously a brute force way of avoiding race conditions with the
8962 This is obviously a brute force way of avoiding race conditions with the
8951 file buffering.
8963 file buffering.
8952 If you want to do it cleanly, and you have a resource which is being shared
8964 If you want to do it cleanly, and you have a resource which is being shared
8953 by the interactive IPython loop and your GUI thread, you should really
8965 by the interactive IPython loop and your GUI thread, you should really
8954 handle it with thread locking and syncrhonization properties.
8966 handle it with thread locking and syncrhonization properties.
8955 The Python documentation discusses these.
8967 The Python documentation discusses these.
8956 \end_layout
8968 \end_layout
8957
8969
8958 \begin_layout Section
8970 \begin_layout Section
8959 \begin_inset LatexCommand \label{sec:interactive-demos}
8971 \begin_inset LatexCommand \label{sec:interactive-demos}
8960
8972
8961 \end_inset
8973 \end_inset
8962
8974
8963 Interactive demos with IPython
8975 Interactive demos with IPython
8964 \end_layout
8976 \end_layout
8965
8977
8966 \begin_layout Standard
8978 \begin_layout Standard
8967 IPython ships with a basic system for running scripts interactively in sections,
8979 IPython ships with a basic system for running scripts interactively in sections,
8968 useful when presenting code to audiences.
8980 useful when presenting code to audiences.
8969 A few tags embedded in comments (so that the script remains valid Python
8981 A few tags embedded in comments (so that the script remains valid Python
8970 code) divide a file into separate blocks, and the demo can be run one block
8982 code) divide a file into separate blocks, and the demo can be run one block
8971 at a time, with IPython printing (with syntax highlighting) the block before
8983 at a time, with IPython printing (with syntax highlighting) the block before
8972 executing it, and returning to the interactive prompt after each block.
8984 executing it, and returning to the interactive prompt after each block.
8973 The interactive namespace is updated after each block is run with the contents
8985 The interactive namespace is updated after each block is run with the contents
8974 of the demo's namespace.
8986 of the demo's namespace.
8975 \end_layout
8987 \end_layout
8976
8988
8977 \begin_layout Standard
8989 \begin_layout Standard
8978 This allows you to show a piece of code, run it and then execute interactively
8990 This allows you to show a piece of code, run it and then execute interactively
8979 commands based on the variables just created.
8991 commands based on the variables just created.
8980 Once you want to continue, you simply execute the next block of the demo.
8992 Once you want to continue, you simply execute the next block of the demo.
8981 The following listing shows the markup necessary for dividing a script
8993 The following listing shows the markup necessary for dividing a script
8982 into sections for execution as a demo.
8994 into sections for execution as a demo.
8983 \end_layout
8995 \end_layout
8984
8996
8985 \begin_layout Standard
8997 \begin_layout Standard
8986 \begin_inset ERT
8998 \begin_inset ERT
8987 status open
8999 status open
8988
9000
8989 \begin_layout Standard
9001 \begin_layout Standard
8990
9002
8991
9003
8992 \backslash
9004 \backslash
8993 codelist{examples/example-demo.py}
9005 codelist{examples/example-demo.py}
8994 \end_layout
9006 \end_layout
8995
9007
8996 \end_inset
9008 \end_inset
8997
9009
8998
9010
8999 \end_layout
9011 \end_layout
9000
9012
9001 \begin_layout Standard
9013 \begin_layout Standard
9002 In order to run a file as a demo, you must first make a
9014 In order to run a file as a demo, you must first make a
9003 \family typewriter
9015 \family typewriter
9004 Demo
9016 Demo
9005 \family default
9017 \family default
9006 object out of it.
9018 object out of it.
9007 If the file is named
9019 If the file is named
9008 \family typewriter
9020 \family typewriter
9009 myscript.py
9021 myscript.py
9010 \family default
9022 \family default
9011 , the following code will make a demo:
9023 , the following code will make a demo:
9012 \end_layout
9024 \end_layout
9013
9025
9014 \begin_layout LyX-Code
9026 \begin_layout LyX-Code
9015 from IPython.demo import Demo
9027 from IPython.demo import Demo
9016 \end_layout
9028 \end_layout
9017
9029
9018 \begin_layout LyX-Code
9030 \begin_layout LyX-Code
9019 mydemo = Demo('myscript.py')
9031 mydemo = Demo('myscript.py')
9020 \end_layout
9032 \end_layout
9021
9033
9022 \begin_layout Standard
9034 \begin_layout Standard
9023 This creates the
9035 This creates the
9024 \family typewriter
9036 \family typewriter
9025 mydemo
9037 mydemo
9026 \family default
9038 \family default
9027 object, whose blocks you run one at a time by simply calling the object
9039 object, whose blocks you run one at a time by simply calling the object
9028 with no arguments.
9040 with no arguments.
9029 If you have autocall active in IPython (the default), all you need to do
9041 If you have autocall active in IPython (the default), all you need to do
9030 is type
9042 is type
9031 \end_layout
9043 \end_layout
9032
9044
9033 \begin_layout LyX-Code
9045 \begin_layout LyX-Code
9034 mydemo
9046 mydemo
9035 \end_layout
9047 \end_layout
9036
9048
9037 \begin_layout Standard
9049 \begin_layout Standard
9038 and IPython will call it, executing each block.
9050 and IPython will call it, executing each block.
9039 Demo objects can be restarted, you can move forward or back skipping blocks,
9051 Demo objects can be restarted, you can move forward or back skipping blocks,
9040 re-execute the last block, etc.
9052 re-execute the last block, etc.
9041 Simply use the Tab key on a demo object to see its methods, and call
9053 Simply use the Tab key on a demo object to see its methods, and call
9042 \family typewriter
9054 \family typewriter
9043 `?'
9055 `?'
9044 \family default
9056 \family default
9045 on them to see their docstrings for more usage details.
9057 on them to see their docstrings for more usage details.
9046 In addition, the
9058 In addition, the
9047 \family typewriter
9059 \family typewriter
9048 demo
9060 demo
9049 \family default
9061 \family default
9050 module itself contains a comprehensive docstring, which you can access
9062 module itself contains a comprehensive docstring, which you can access
9051 via
9063 via
9052 \end_layout
9064 \end_layout
9053
9065
9054 \begin_layout LyX-Code
9066 \begin_layout LyX-Code
9055 from IPython import demo
9067 from IPython import demo
9056 \end_layout
9068 \end_layout
9057
9069
9058 \begin_layout LyX-Code
9070 \begin_layout LyX-Code
9059 demo?
9071 demo?
9060 \end_layout
9072 \end_layout
9061
9073
9062 \begin_layout Standard
9074 \begin_layout Standard
9063
9075
9064 \series bold
9076 \series bold
9065 Limitations:
9077 Limitations:
9066 \series default
9078 \series default
9067 It is important to note that these demos are limited to fairly simple uses.
9079 It is important to note that these demos are limited to fairly simple uses.
9068 In particular, you can
9080 In particular, you can
9069 \emph on
9081 \emph on
9070 not
9082 not
9071 \emph default
9083 \emph default
9072 put division marks in indented code (loops, if statements, function definitions
9084 put division marks in indented code (loops, if statements, function definitions
9073 , etc.) Supporting something like this would basically require tracking the
9085 , etc.) Supporting something like this would basically require tracking the
9074 internal execution state of the Python interpreter, so only top-level divisions
9086 internal execution state of the Python interpreter, so only top-level divisions
9075 are allowed.
9087 are allowed.
9076 If you want to be able to open an IPython instance at an arbitrary point
9088 If you want to be able to open an IPython instance at an arbitrary point
9077 in a program, you can use IPython's embedding facilities, described in
9089 in a program, you can use IPython's embedding facilities, described in
9078 detail in Sec\SpecialChar \@.
9090 detail in Sec\SpecialChar \@.
9079 \InsetSpace ~
9091 \InsetSpace ~
9080
9092
9081 \begin_inset LatexCommand \ref{sec:embed}
9093 \begin_inset LatexCommand \ref{sec:embed}
9082
9094
9083 \end_inset
9095 \end_inset
9084
9096
9085 .
9097 .
9086 \end_layout
9098 \end_layout
9087
9099
9088 \begin_layout Section
9100 \begin_layout Section
9089 \begin_inset LatexCommand \label{sec:matplotlib-support}
9101 \begin_inset LatexCommand \label{sec:matplotlib-support}
9090
9102
9091 \end_inset
9103 \end_inset
9092
9104
9093 Plotting with
9105 Plotting with
9094 \family typewriter
9106 \family typewriter
9095 matplotlib
9107 matplotlib
9096 \family default
9108 \family default
9097
9109
9098 \end_layout
9110 \end_layout
9099
9111
9100 \begin_layout Standard
9112 \begin_layout Standard
9101 The matplotlib library (
9113 The matplotlib library (
9102 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
9114 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
9103
9115
9104 \end_inset
9116 \end_inset
9105
9117
9106 ) provides high quality 2D plotting for Python.
9118 ) provides high quality 2D plotting for Python.
9107 Matplotlib can produce plots on screen using a variety of GUI toolkits,
9119 Matplotlib can produce plots on screen using a variety of GUI toolkits,
9108 including Tk, GTK and WXPython.
9120 including Tk, GTK and WXPython.
9109 It also provides a number of commands useful for scientific computing,
9121 It also provides a number of commands useful for scientific computing,
9110 all with a syntax compatible with that of the popular Matlab program.
9122 all with a syntax compatible with that of the popular Matlab program.
9111 \end_layout
9123 \end_layout
9112
9124
9113 \begin_layout Standard
9125 \begin_layout Standard
9114 IPython accepts the special option
9126 IPython accepts the special option
9115 \family typewriter
9127 \family typewriter
9116 -pylab
9128 -pylab
9117 \family default
9129 \family default
9118 (Sec.\InsetSpace ~
9130 (Sec.\InsetSpace ~
9119
9131
9120 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
9132 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
9121
9133
9122 \end_inset
9134 \end_inset
9123
9135
9124 ).
9136 ).
9125 This configures it to support matplotlib, honoring the settings in the
9137 This configures it to support matplotlib, honoring the settings in the
9126
9138
9127 \family typewriter
9139 \family typewriter
9128 .matplotlibrc
9140 .matplotlibrc
9129 \family default
9141 \family default
9130 file.
9142 file.
9131 IPython will detect the user's choice of matplotlib GUI backend, and automatica
9143 IPython will detect the user's choice of matplotlib GUI backend, and automatica
9132 lly select the proper threading model to prevent blocking.
9144 lly select the proper threading model to prevent blocking.
9133 It also sets matplotlib in interactive mode and modifies
9145 It also sets matplotlib in interactive mode and modifies
9134 \family typewriter
9146 \family typewriter
9135 %run
9147 %run
9136 \family default
9148 \family default
9137 slightly, so that any matplotlib-based script can be executed using
9149 slightly, so that any matplotlib-based script can be executed using
9138 \family typewriter
9150 \family typewriter
9139 %run
9151 %run
9140 \family default
9152 \family default
9141 and the final
9153 and the final
9142 \family typewriter
9154 \family typewriter
9143 show()
9155 show()
9144 \family default
9156 \family default
9145 command does not block the interactive shell.
9157 command does not block the interactive shell.
9146 \end_layout
9158 \end_layout
9147
9159
9148 \begin_layout Standard
9160 \begin_layout Standard
9149 The
9161 The
9150 \family typewriter
9162 \family typewriter
9151 -pylab
9163 -pylab
9152 \family default
9164 \family default
9153 option must be given first in order for IPython to configure its threading
9165 option must be given first in order for IPython to configure its threading
9154 mode.
9166 mode.
9155 However, you can still issue other options afterwards.
9167 However, you can still issue other options afterwards.
9156 This allows you to have a matplotlib-based environment customized with
9168 This allows you to have a matplotlib-based environment customized with
9157 additional modules using the standard IPython profile mechanism (Sec.\InsetSpace ~
9169 additional modules using the standard IPython profile mechanism (Sec.\InsetSpace ~
9158
9170
9159 \begin_inset LatexCommand \ref{sec:profiles}
9171 \begin_inset LatexCommand \ref{sec:profiles}
9160
9172
9161 \end_inset
9173 \end_inset
9162
9174
9163 ): ``
9175 ): ``
9164 \family typewriter
9176 \family typewriter
9165 ipython -pylab -p myprofile
9177 ipython -pylab -p myprofile
9166 \family default
9178 \family default
9167 '' will load the profile defined in
9179 '' will load the profile defined in
9168 \family typewriter
9180 \family typewriter
9169 ipythonrc-myprofile
9181 ipythonrc-myprofile
9170 \family default
9182 \family default
9171 after configuring matplotlib.
9183 after configuring matplotlib.
9172 \end_layout
9184 \end_layout
9173
9185
9174 \begin_layout Section
9186 \begin_layout Section
9175 \begin_inset LatexCommand \label{sec:Gnuplot}
9187 \begin_inset LatexCommand \label{sec:Gnuplot}
9176
9188
9177 \end_inset
9189 \end_inset
9178
9190
9179 Plotting with
9191 Plotting with
9180 \family typewriter
9192 \family typewriter
9181 Gnuplot
9193 Gnuplot
9182 \end_layout
9194 \end_layout
9183
9195
9184 \begin_layout Standard
9196 \begin_layout Standard
9185 Through the magic extension system described in sec.
9197 Through the magic extension system described in sec.
9186
9198
9187 \begin_inset LatexCommand \ref{sec:magic}
9199 \begin_inset LatexCommand \ref{sec:magic}
9188
9200
9189 \end_inset
9201 \end_inset
9190
9202
9191 , IPython incorporates a mechanism for conveniently interfacing with the
9203 , IPython incorporates a mechanism for conveniently interfacing with the
9192 Gnuplot system (
9204 Gnuplot system (
9193 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
9205 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
9194
9206
9195 \end_inset
9207 \end_inset
9196
9208
9197 ).
9209 ).
9198 Gnuplot is a very complete 2D and 3D plotting package available for many
9210 Gnuplot is a very complete 2D and 3D plotting package available for many
9199 operating systems and commonly included in modern Linux distributions.
9211 operating systems and commonly included in modern Linux distributions.
9200
9212
9201 \end_layout
9213 \end_layout
9202
9214
9203 \begin_layout Standard
9215 \begin_layout Standard
9204 Besides having Gnuplot installed, this functionality requires the
9216 Besides having Gnuplot installed, this functionality requires the
9205 \family typewriter
9217 \family typewriter
9206 Gnuplot.py
9218 Gnuplot.py
9207 \family default
9219 \family default
9208 module for interfacing python with Gnuplot.
9220 module for interfacing python with Gnuplot.
9209 It can be downloaded from:
9221 It can be downloaded from:
9210 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
9222 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
9211
9223
9212 \end_inset
9224 \end_inset
9213
9225
9214 .
9226 .
9215 \end_layout
9227 \end_layout
9216
9228
9217 \begin_layout Subsection
9229 \begin_layout Subsection
9218 Proper Gnuplot configuration
9230 Proper Gnuplot configuration
9219 \end_layout
9231 \end_layout
9220
9232
9221 \begin_layout Standard
9233 \begin_layout Standard
9222 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
9234 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
9223 However, as of
9235 However, as of
9224 \family typewriter
9236 \family typewriter
9225 Gnuplot.py
9237 Gnuplot.py
9226 \family default
9238 \family default
9227 version 1.7, a new option was added to communicate between Python and Gnuplot
9239 version 1.7, a new option was added to communicate between Python and Gnuplot
9228 via FIFOs (pipes).
9240 via FIFOs (pipes).
9229 This mechanism, while fast, also breaks the mouse system.
9241 This mechanism, while fast, also breaks the mouse system.
9230 You must therefore set the variable
9242 You must therefore set the variable
9231 \family typewriter
9243 \family typewriter
9232 prefer_fifo_data
9244 prefer_fifo_data
9233 \family default
9245 \family default
9234 to
9246 to
9235 \family typewriter
9247 \family typewriter
9236 0
9248 0
9237 \family default
9249 \family default
9238 in file
9250 in file
9239 \family typewriter
9251 \family typewriter
9240 gp_unix.py
9252 gp_unix.py
9241 \family default
9253 \family default
9242 if you wish to keep the interactive mouse and keyboard features working
9254 if you wish to keep the interactive mouse and keyboard features working
9243 properly (
9255 properly (
9244 \family typewriter
9256 \family typewriter
9245 prefer_inline_data
9257 prefer_inline_data
9246 \family default
9258 \family default
9247 also must be
9259 also must be
9248 \family typewriter
9260 \family typewriter
9249 0
9261 0
9250 \family default
9262 \family default
9251 , but this is the default so unless you've changed it manually you should
9263 , but this is the default so unless you've changed it manually you should
9252 be fine).
9264 be fine).
9253 \end_layout
9265 \end_layout
9254
9266
9255 \begin_layout Standard
9267 \begin_layout Standard
9256 'Out of the box', Gnuplot is configured with a rather poor set of size,
9268 'Out of the box', Gnuplot is configured with a rather poor set of size,
9257 color and linewidth choices which make the graphs fairly hard to read on
9269 color and linewidth choices which make the graphs fairly hard to read on
9258 modern high-resolution displays (although they work fine on old 640x480
9270 modern high-resolution displays (although they work fine on old 640x480
9259 ones).
9271 ones).
9260 Below is a section of my
9272 Below is a section of my
9261 \family typewriter
9273 \family typewriter
9262 .Xdefaults
9274 .Xdefaults
9263 \family default
9275 \family default
9264 file which I use for having a more convenient Gnuplot setup.
9276 file which I use for having a more convenient Gnuplot setup.
9265 Remember to load it by running
9277 Remember to load it by running
9266 \family typewriter
9278 \family typewriter
9267 `xrdb .Xdefaults`
9279 `xrdb .Xdefaults`
9268 \family default
9280 \family default
9269 :
9281 :
9270 \end_layout
9282 \end_layout
9271
9283
9272 \begin_layout Standard
9284 \begin_layout Standard
9273
9285
9274 \family typewriter
9286 \family typewriter
9275 !******************************************************************
9287 !******************************************************************
9276 \newline
9288 \newline
9277 ! gnuplot
9289 ! gnuplot
9278 options
9290 options
9279 \newline
9291 \newline
9280 ! modify this for a convenient window size
9292 ! modify this for a convenient window size
9281 \newline
9293 \newline
9282 gnuplot*geometry: 780x580
9294 gnuplot*geometry: 780x580
9283 \end_layout
9295 \end_layout
9284
9296
9285 \begin_layout Standard
9297 \begin_layout Standard
9286
9298
9287 \family typewriter
9299 \family typewriter
9288 ! on-screen font (not for PostScript)
9300 ! on-screen font (not for PostScript)
9289 \newline
9301 \newline
9290 gnuplot*font: -misc-fixed-bold-r-normal--15
9302 gnuplot*font: -misc-fixed-bold-r-normal--15
9291 -120-100-100-c-90-iso8859-1
9303 -120-100-100-c-90-iso8859-1
9292 \end_layout
9304 \end_layout
9293
9305
9294 \begin_layout Standard
9306 \begin_layout Standard
9295
9307
9296 \family typewriter
9308 \family typewriter
9297 ! color options
9309 ! color options
9298 \newline
9310 \newline
9299 gnuplot*background: black
9311 gnuplot*background: black
9300 \newline
9312 \newline
9301 gnuplot*textColor: white
9313 gnuplot*textColor: white
9302 \newline
9314 \newline
9303 gnuplot*borderCo
9315 gnuplot*borderCo
9304 lor: white
9316 lor: white
9305 \newline
9317 \newline
9306 gnuplot*axisColor: white
9318 gnuplot*axisColor: white
9307 \newline
9319 \newline
9308 gnuplot*line1Color: red
9320 gnuplot*line1Color: red
9309 \newline
9321 \newline
9310 gnuplot*line2Color:
9322 gnuplot*line2Color:
9311 green
9323 green
9312 \newline
9324 \newline
9313 gnuplot*line3Color: blue
9325 gnuplot*line3Color: blue
9314 \newline
9326 \newline
9315 gnuplot*line4Color: magenta
9327 gnuplot*line4Color: magenta
9316 \newline
9328 \newline
9317 gnuplot*line5Color:
9329 gnuplot*line5Color:
9318 cyan
9330 cyan
9319 \newline
9331 \newline
9320 gnuplot*line6Color: sienna
9332 gnuplot*line6Color: sienna
9321 \newline
9333 \newline
9322 gnuplot*line7Color: orange
9334 gnuplot*line7Color: orange
9323 \newline
9335 \newline
9324 gnuplot*line8Color:
9336 gnuplot*line8Color:
9325 coral
9337 coral
9326 \end_layout
9338 \end_layout
9327
9339
9328 \begin_layout Standard
9340 \begin_layout Standard
9329
9341
9330 \family typewriter
9342 \family typewriter
9331 ! multiplicative factor for point styles
9343 ! multiplicative factor for point styles
9332 \newline
9344 \newline
9333 gnuplot*pointsize: 2
9345 gnuplot*pointsize: 2
9334 \end_layout
9346 \end_layout
9335
9347
9336 \begin_layout Standard
9348 \begin_layout Standard
9337
9349
9338 \family typewriter
9350 \family typewriter
9339 ! line width options (in pixels)
9351 ! line width options (in pixels)
9340 \newline
9352 \newline
9341 gnuplot*borderWidth: 2
9353 gnuplot*borderWidth: 2
9342 \newline
9354 \newline
9343 gnuplot*axisWidth:
9355 gnuplot*axisWidth:
9344 2
9356 2
9345 \newline
9357 \newline
9346 gnuplot*line1Width: 2
9358 gnuplot*line1Width: 2
9347 \newline
9359 \newline
9348 gnuplot*line2Width: 2
9360 gnuplot*line2Width: 2
9349 \newline
9361 \newline
9350 gnuplot*line3Width: 2
9362 gnuplot*line3Width: 2
9351 \newline
9363 \newline
9352 gnuplot*line4Wi
9364 gnuplot*line4Wi
9353 dth: 2
9365 dth: 2
9354 \newline
9366 \newline
9355 gnuplot*line5Width: 2
9367 gnuplot*line5Width: 2
9356 \newline
9368 \newline
9357 gnuplot*line6Width: 2
9369 gnuplot*line6Width: 2
9358 \newline
9370 \newline
9359 gnuplot*line7Width: 2
9371 gnuplot*line7Width: 2
9360 \newline
9372 \newline
9361 gnuplot*lin
9373 gnuplot*lin
9362 e8Width: 2
9374 e8Width: 2
9363 \end_layout
9375 \end_layout
9364
9376
9365 \begin_layout Subsection
9377 \begin_layout Subsection
9366 The
9378 The
9367 \family typewriter
9379 \family typewriter
9368 IPython.GnuplotRuntime
9380 IPython.GnuplotRuntime
9369 \family default
9381 \family default
9370 module
9382 module
9371 \end_layout
9383 \end_layout
9372
9384
9373 \begin_layout Standard
9385 \begin_layout Standard
9374 IPython includes a module called
9386 IPython includes a module called
9375 \family typewriter
9387 \family typewriter
9376 Gnuplot2.py
9388 Gnuplot2.py
9377 \family default
9389 \family default
9378 which extends and improves the default
9390 which extends and improves the default
9379 \family typewriter
9391 \family typewriter
9380 Gnuplot
9392 Gnuplot
9381 \family default
9393 \family default
9382 .
9394 .
9383 \family typewriter
9395 \family typewriter
9384 py
9396 py
9385 \family default
9397 \family default
9386 (which it still relies upon).
9398 (which it still relies upon).
9387 For example, the new
9399 For example, the new
9388 \family typewriter
9400 \family typewriter
9389 plot
9401 plot
9390 \family default
9402 \family default
9391 function adds several improvements to the original making it more convenient
9403 function adds several improvements to the original making it more convenient
9392 for interactive use, and
9404 for interactive use, and
9393 \family typewriter
9405 \family typewriter
9394 hardcopy
9406 hardcopy
9395 \family default
9407 \family default
9396 fixes a bug in the original which under some circumstances blocks the creation
9408 fixes a bug in the original which under some circumstances blocks the creation
9397 of PostScript output.
9409 of PostScript output.
9398 \end_layout
9410 \end_layout
9399
9411
9400 \begin_layout Standard
9412 \begin_layout Standard
9401 For scripting use,
9413 For scripting use,
9402 \family typewriter
9414 \family typewriter
9403 GnuplotRuntime.py
9415 GnuplotRuntime.py
9404 \family default
9416 \family default
9405 is provided, which wraps
9417 is provided, which wraps
9406 \family typewriter
9418 \family typewriter
9407 Gnuplot2.py
9419 Gnuplot2.py
9408 \family default
9420 \family default
9409 and creates a series of global aliases.
9421 and creates a series of global aliases.
9410 These make it easy to control Gnuplot plotting jobs through the Python
9422 These make it easy to control Gnuplot plotting jobs through the Python
9411 language.
9423 language.
9412 \end_layout
9424 \end_layout
9413
9425
9414 \begin_layout Standard
9426 \begin_layout Standard
9415 Below is some example code which illustrates how to configure Gnuplot inside
9427 Below is some example code which illustrates how to configure Gnuplot inside
9416 your own programs but have it available for further interactive use through
9428 your own programs but have it available for further interactive use through
9417 an embedded IPython instance.
9429 an embedded IPython instance.
9418 Simply run this file at a system prompt.
9430 Simply run this file at a system prompt.
9419 This file is provided as
9431 This file is provided as
9420 \family typewriter
9432 \family typewriter
9421 example-gnuplot.py
9433 example-gnuplot.py
9422 \family default
9434 \family default
9423 in the examples directory:
9435 in the examples directory:
9424 \end_layout
9436 \end_layout
9425
9437
9426 \begin_layout Standard
9438 \begin_layout Standard
9427 \begin_inset ERT
9439 \begin_inset ERT
9428 status open
9440 status open
9429
9441
9430 \begin_layout Standard
9442 \begin_layout Standard
9431
9443
9432
9444
9433 \backslash
9445 \backslash
9434 codelist{examples/example-gnuplot.py}
9446 codelist{examples/example-gnuplot.py}
9435 \end_layout
9447 \end_layout
9436
9448
9437 \end_inset
9449 \end_inset
9438
9450
9439
9451
9440 \end_layout
9452 \end_layout
9441
9453
9442 \begin_layout Subsection
9454 \begin_layout Subsection
9443 The
9455 The
9444 \family typewriter
9456 \family typewriter
9445 numeric
9457 numeric
9446 \family default
9458 \family default
9447 profile: a scientific computing environment
9459 profile: a scientific computing environment
9448 \end_layout
9460 \end_layout
9449
9461
9450 \begin_layout Standard
9462 \begin_layout Standard
9451 The
9463 The
9452 \family typewriter
9464 \family typewriter
9453 numeric
9465 numeric
9454 \family default
9466 \family default
9455 IPython profile, which you can activate with
9467 IPython profile, which you can activate with
9456 \family typewriter
9468 \family typewriter
9457 `ipython -p numeric
9469 `ipython -p numeric
9458 \family default
9470 \family default
9459 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
9471 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
9460 other useful things for numerical computing), contained in the
9472 other useful things for numerical computing), contained in the
9461 \family typewriter
9473 \family typewriter
9462 IPython.GnuplotInteractive
9474 IPython.GnuplotInteractive
9463 \family default
9475 \family default
9464 module.
9476 module.
9465 This will create the globals
9477 This will create the globals
9466 \family typewriter
9478 \family typewriter
9467 Gnuplot
9479 Gnuplot
9468 \family default
9480 \family default
9469 (an alias to the improved Gnuplot2 module),
9481 (an alias to the improved Gnuplot2 module),
9470 \family typewriter
9482 \family typewriter
9471 gp
9483 gp
9472 \family default
9484 \family default
9473 (a Gnuplot active instance), the new magic commands
9485 (a Gnuplot active instance), the new magic commands
9474 \family typewriter
9486 \family typewriter
9475 %gpc
9487 %gpc
9476 \family default
9488 \family default
9477 and
9489 and
9478 \family typewriter
9490 \family typewriter
9479 %gp_set_instance
9491 %gp_set_instance
9480 \family default
9492 \family default
9481 and several other convenient globals.
9493 and several other convenient globals.
9482 Type
9494 Type
9483 \family typewriter
9495 \family typewriter
9484 gphelp()
9496 gphelp()
9485 \family default
9497 \family default
9486 for further details.
9498 for further details.
9487 \end_layout
9499 \end_layout
9488
9500
9489 \begin_layout Standard
9501 \begin_layout Standard
9490 This should turn IPython into a convenient environment for numerical computing,
9502 This should turn IPython into a convenient environment for numerical computing,
9491 with all the functions in the NumPy library and the Gnuplot facilities
9503 with all the functions in the NumPy library and the Gnuplot facilities
9492 for plotting.
9504 for plotting.
9493 Further improvements can be obtained by loading the SciPy libraries for
9505 Further improvements can be obtained by loading the SciPy libraries for
9494 scientific computing, available at
9506 scientific computing, available at
9495 \begin_inset LatexCommand \htmlurl{http://scipy.org}
9507 \begin_inset LatexCommand \htmlurl{http://scipy.org}
9496
9508
9497 \end_inset
9509 \end_inset
9498
9510
9499 .
9511 .
9500 \end_layout
9512 \end_layout
9501
9513
9502 \begin_layout Standard
9514 \begin_layout Standard
9503 If you are in the middle of a working session with numerical objects and
9515 If you are in the middle of a working session with numerical objects and
9504 need to plot them but you didn't start the
9516 need to plot them but you didn't start the
9505 \family typewriter
9517 \family typewriter
9506 numeric
9518 numeric
9507 \family default
9519 \family default
9508 profile, you can load these extensions at any time by typing
9520 profile, you can load these extensions at any time by typing
9509 \newline
9521 \newline
9510
9522
9511 \family typewriter
9523 \family typewriter
9512 from IPython.GnuplotInteractive import *
9524 from IPython.GnuplotInteractive import *
9513 \newline
9525 \newline
9514
9526
9515 \family default
9527 \family default
9516 at the IPython prompt.
9528 at the IPython prompt.
9517 This will allow you to keep your objects intact and start using Gnuplot
9529 This will allow you to keep your objects intact and start using Gnuplot
9518 to view them.
9530 to view them.
9519 \end_layout
9531 \end_layout
9520
9532
9521 \begin_layout Section
9533 \begin_layout Section
9522 Reporting bugs
9534 Reporting bugs
9523 \end_layout
9535 \end_layout
9524
9536
9525 \begin_layout Subsection*
9537 \begin_layout Subsection*
9526 Automatic crash reports
9538 Automatic crash reports
9527 \end_layout
9539 \end_layout
9528
9540
9529 \begin_layout Standard
9541 \begin_layout Standard
9530 Ideally, IPython itself shouldn't crash.
9542 Ideally, IPython itself shouldn't crash.
9531 It will catch exceptions produced by you, but bugs in its internals will
9543 It will catch exceptions produced by you, but bugs in its internals will
9532 still crash it.
9544 still crash it.
9533 \end_layout
9545 \end_layout
9534
9546
9535 \begin_layout Standard
9547 \begin_layout Standard
9536 In such a situation, IPython will leave a file named
9548 In such a situation, IPython will leave a file named
9537 \family typewriter
9549 \family typewriter
9538 IPython_crash_report.txt
9550 IPython_crash_report.txt
9539 \family default
9551 \family default
9540 in your IPYTHONDIR directory (that way if crashes happen several times
9552 in your IPYTHONDIR directory (that way if crashes happen several times
9541 it won't litter many directories, the post-mortem file is always located
9553 it won't litter many directories, the post-mortem file is always located
9542 in the same place and new occurrences just overwrite the previous one).
9554 in the same place and new occurrences just overwrite the previous one).
9543 If you can mail this file to the developers (see sec.
9555 If you can mail this file to the developers (see sec.
9544
9556
9545 \begin_inset LatexCommand \ref{sec:credits}
9557 \begin_inset LatexCommand \ref{sec:credits}
9546
9558
9547 \end_inset
9559 \end_inset
9548
9560
9549 for names and addresses), it will help us
9561 for names and addresses), it will help us
9550 \emph on
9562 \emph on
9551 a lot
9563 a lot
9552 \emph default
9564 \emph default
9553 in understanding the cause of the problem and fixing it sooner.
9565 in understanding the cause of the problem and fixing it sooner.
9554 \end_layout
9566 \end_layout
9555
9567
9556 \begin_layout Subsection*
9568 \begin_layout Subsection*
9557 The bug tracker
9569 The bug tracker
9558 \end_layout
9570 \end_layout
9559
9571
9560 \begin_layout Standard
9572 \begin_layout Standard
9561 IPython also has an online bug-tracker, located at
9573 IPython also has an online bug-tracker, located at
9562 \begin_inset LatexCommand \htmlurl{http://projects.scipy.org/ipython/ipython/report/1}
9574 \begin_inset LatexCommand \htmlurl{http://projects.scipy.org/ipython/ipython/report/1}
9563
9575
9564 \end_inset
9576 \end_inset
9565
9577
9566 .
9578 .
9567 In addition to mailing the developers, it would be a good idea to file
9579 In addition to mailing the developers, it would be a good idea to file
9568 a bug report here.
9580 a bug report here.
9569 This will ensure that the issue is properly followed to conclusion.
9581 This will ensure that the issue is properly followed to conclusion.
9570 To report new bugs you will have to register first.
9582 To report new bugs you will have to register first.
9571 \end_layout
9583 \end_layout
9572
9584
9573 \begin_layout Standard
9585 \begin_layout Standard
9574 You can also use this bug tracker to file feature requests.
9586 You can also use this bug tracker to file feature requests.
9575 \end_layout
9587 \end_layout
9576
9588
9577 \begin_layout Section
9589 \begin_layout Section
9578 Brief history
9590 Brief history
9579 \end_layout
9591 \end_layout
9580
9592
9581 \begin_layout Subsection
9593 \begin_layout Subsection
9582 Origins
9594 Origins
9583 \end_layout
9595 \end_layout
9584
9596
9585 \begin_layout Standard
9597 \begin_layout Standard
9586 The current IPython system grew out of the following three projects:
9598 The current IPython system grew out of the following three projects:
9587 \end_layout
9599 \end_layout
9588
9600
9589 \begin_layout List
9601 \begin_layout List
9590 \labelwidthstring 00.00.0000
9602 \labelwidthstring 00.00.0000
9591 ipython by Fernando P
9603 ipython by Fernando P
9592 \begin_inset ERT
9604 \begin_inset ERT
9593 status collapsed
9605 status collapsed
9594
9606
9595 \begin_layout Standard
9607 \begin_layout Standard
9596
9608
9597
9609
9598 \backslash
9610 \backslash
9599 '{e}
9611 '{e}
9600 \end_layout
9612 \end_layout
9601
9613
9602 \end_inset
9614 \end_inset
9603
9615
9604 rez.
9616 rez.
9605 I was working on adding Mathematica-type prompts and a flexible configuration
9617 I was working on adding Mathematica-type prompts and a flexible configuration
9606 system (something better than
9618 system (something better than
9607 \family typewriter
9619 \family typewriter
9608 $PYTHONSTARTUP
9620 $PYTHONSTARTUP
9609 \family default
9621 \family default
9610 ) to the standard Python interactive interpreter.
9622 ) to the standard Python interactive interpreter.
9611 \end_layout
9623 \end_layout
9612
9624
9613 \begin_layout List
9625 \begin_layout List
9614 \labelwidthstring 00.00.0000
9626 \labelwidthstring 00.00.0000
9615 IPP by Janko Hauser.
9627 IPP by Janko Hauser.
9616 Very well organized, great usability.
9628 Very well organized, great usability.
9617 Had an old help system.
9629 Had an old help system.
9618 IPP was used as the `container' code into which I added the functionality
9630 IPP was used as the `container' code into which I added the functionality
9619 from ipython and LazyPython.
9631 from ipython and LazyPython.
9620 \end_layout
9632 \end_layout
9621
9633
9622 \begin_layout List
9634 \begin_layout List
9623 \labelwidthstring 00.00.0000
9635 \labelwidthstring 00.00.0000
9624 LazyPython by Nathan Gray.
9636 LazyPython by Nathan Gray.
9625 Simple but
9637 Simple but
9626 \emph on
9638 \emph on
9627 very
9639 very
9628 \emph default
9640 \emph default
9629 powerful.
9641 powerful.
9630 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
9642 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
9631 were all taken from here.
9643 were all taken from here.
9632 \end_layout
9644 \end_layout
9633
9645
9634 \begin_layout Standard
9646 \begin_layout Standard
9635 When I found out (see sec.
9647 When I found out (see sec.
9636
9648
9637 \begin_inset LatexCommand \ref{figgins}
9649 \begin_inset LatexCommand \ref{figgins}
9638
9650
9639 \end_inset
9651 \end_inset
9640
9652
9641 ) about IPP and LazyPython I tried to join all three into a unified system.
9653 ) about IPP and LazyPython I tried to join all three into a unified system.
9642 I thought this could provide a very nice working environment, both for
9654 I thought this could provide a very nice working environment, both for
9643 regular programming and scientific computing: shell-like features, IDL/Matlab
9655 regular programming and scientific computing: shell-like features, IDL/Matlab
9644 numerics, Mathematica-type prompt history and great object introspection
9656 numerics, Mathematica-type prompt history and great object introspection
9645 and help facilities.
9657 and help facilities.
9646 I think it worked reasonably well, though it was a lot more work than I
9658 I think it worked reasonably well, though it was a lot more work than I
9647 had initially planned.
9659 had initially planned.
9648 \end_layout
9660 \end_layout
9649
9661
9650 \begin_layout Subsection
9662 \begin_layout Subsection
9651 Current status
9663 Current status
9652 \end_layout
9664 \end_layout
9653
9665
9654 \begin_layout Standard
9666 \begin_layout Standard
9655 The above listed features work, and quite well for the most part.
9667 The above listed features work, and quite well for the most part.
9656 But until a major internal restructuring is done (see below), only bug
9668 But until a major internal restructuring is done (see below), only bug
9657 fixing will be done, no other features will be added (unless very minor
9669 fixing will be done, no other features will be added (unless very minor
9658 and well localized in the cleaner parts of the code).
9670 and well localized in the cleaner parts of the code).
9659 \end_layout
9671 \end_layout
9660
9672
9661 \begin_layout Standard
9673 \begin_layout Standard
9662 IPython consists of some 18000 lines of pure python code, of which roughly
9674 IPython consists of some 18000 lines of pure python code, of which roughly
9663 two thirds is reasonably clean.
9675 two thirds is reasonably clean.
9664 The rest is, messy code which needs a massive restructuring before any
9676 The rest is, messy code which needs a massive restructuring before any
9665 further major work is done.
9677 further major work is done.
9666 Even the messy code is fairly well documented though, and most of the problems
9678 Even the messy code is fairly well documented though, and most of the problems
9667 in the (non-existent) class design are well pointed to by a PyChecker run.
9679 in the (non-existent) class design are well pointed to by a PyChecker run.
9668 So the rewriting work isn't that bad, it will just be time-consuming.
9680 So the rewriting work isn't that bad, it will just be time-consuming.
9669 \end_layout
9681 \end_layout
9670
9682
9671 \begin_layout Subsection
9683 \begin_layout Subsection
9672 Future
9684 Future
9673 \end_layout
9685 \end_layout
9674
9686
9675 \begin_layout Standard
9687 \begin_layout Standard
9676 See the separate
9688 See the separate
9677 \family typewriter
9689 \family typewriter
9678 new_design
9690 new_design
9679 \family default
9691 \family default
9680 document for details.
9692 document for details.
9681 Ultimately, I would like to see IPython become part of the standard Python
9693 Ultimately, I would like to see IPython become part of the standard Python
9682 distribution as a `big brother with batteries' to the standard Python interacti
9694 distribution as a `big brother with batteries' to the standard Python interacti
9683 ve interpreter.
9695 ve interpreter.
9684 But that will never happen with the current state of the code, so all contribut
9696 But that will never happen with the current state of the code, so all contribut
9685 ions are welcome.
9697 ions are welcome.
9686 \end_layout
9698 \end_layout
9687
9699
9688 \begin_layout Section
9700 \begin_layout Section
9689 License
9701 License
9690 \end_layout
9702 \end_layout
9691
9703
9692 \begin_layout Standard
9704 \begin_layout Standard
9693 IPython is released under the terms of the BSD license, whose general form
9705 IPython is released under the terms of the BSD license, whose general form
9694 can be found at:
9706 can be found at:
9695 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
9707 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
9696
9708
9697 \end_inset
9709 \end_inset
9698
9710
9699 .
9711 .
9700 The full text of the IPython license is reproduced below:
9712 The full text of the IPython license is reproduced below:
9701 \end_layout
9713 \end_layout
9702
9714
9703 \begin_layout Quote
9715 \begin_layout Quote
9704
9716
9705 \family typewriter
9717 \family typewriter
9706 \size small
9718 \size small
9707 IPython is released under a BSD-type license.
9719 IPython is released under a BSD-type license.
9708 \end_layout
9720 \end_layout
9709
9721
9710 \begin_layout Quote
9722 \begin_layout Quote
9711
9723
9712 \family typewriter
9724 \family typewriter
9713 \size small
9725 \size small
9714 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
9726 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
9715 \end_layout
9727 \end_layout
9716
9728
9717 \begin_layout Quote
9729 \begin_layout Quote
9718
9730
9719 \family typewriter
9731 \family typewriter
9720 \size small
9732 \size small
9721 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
9733 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
9722 \newline
9734 \newline
9723 Nathaniel Gray <n8gray@ca
9735 Nathaniel Gray <n8gray@ca
9724 ltech.edu>.
9736 ltech.edu>.
9725 \end_layout
9737 \end_layout
9726
9738
9727 \begin_layout Quote
9739 \begin_layout Quote
9728
9740
9729 \family typewriter
9741 \family typewriter
9730 \size small
9742 \size small
9731 All rights reserved.
9743 All rights reserved.
9732 \end_layout
9744 \end_layout
9733
9745
9734 \begin_layout Quote
9746 \begin_layout Quote
9735
9747
9736 \family typewriter
9748 \family typewriter
9737 \size small
9749 \size small
9738 Redistribution and use in source and binary forms, with or without modification,
9750 Redistribution and use in source and binary forms, with or without modification,
9739 are permitted provided that the following conditions are met:
9751 are permitted provided that the following conditions are met:
9740 \end_layout
9752 \end_layout
9741
9753
9742 \begin_layout Quote
9754 \begin_layout Quote
9743
9755
9744 \family typewriter
9756 \family typewriter
9745 \size small
9757 \size small
9746 a.
9758 a.
9747 Redistributions of source code must retain the above copyright notice,
9759 Redistributions of source code must retain the above copyright notice,
9748 this list of conditions and the following disclaimer.
9760 this list of conditions and the following disclaimer.
9749 \end_layout
9761 \end_layout
9750
9762
9751 \begin_layout Quote
9763 \begin_layout Quote
9752
9764
9753 \family typewriter
9765 \family typewriter
9754 \size small
9766 \size small
9755 b.
9767 b.
9756 Redistributions in binary form must reproduce the above copyright notice,
9768 Redistributions in binary form must reproduce the above copyright notice,
9757 this list of conditions and the following disclaimer in the documentation
9769 this list of conditions and the following disclaimer in the documentation
9758 and/or other materials provided with the distribution.
9770 and/or other materials provided with the distribution.
9759 \end_layout
9771 \end_layout
9760
9772
9761 \begin_layout Quote
9773 \begin_layout Quote
9762
9774
9763 \family typewriter
9775 \family typewriter
9764 \size small
9776 \size small
9765 c.
9777 c.
9766 Neither the name of the copyright holders nor the names of any contributors
9778 Neither the name of the copyright holders nor the names of any contributors
9767 to this software may be used to endorse or promote products derived from
9779 to this software may be used to endorse or promote products derived from
9768 this software without specific prior written permission.
9780 this software without specific prior written permission.
9769 \end_layout
9781 \end_layout
9770
9782
9771 \begin_layout Quote
9783 \begin_layout Quote
9772
9784
9773 \family typewriter
9785 \family typewriter
9774 \size small
9786 \size small
9775 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
9787 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
9776 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
9788 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
9777 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
9789 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
9778 PURPOSE ARE DISCLAIMED.
9790 PURPOSE ARE DISCLAIMED.
9779 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
9791 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
9780 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
9792 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
9781 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
9793 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
9782 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9794 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9783 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9795 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9784 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
9796 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
9785 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9797 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9786
9798
9787 \end_layout
9799 \end_layout
9788
9800
9789 \begin_layout Standard
9801 \begin_layout Standard
9790 Individual authors are the holders of the copyright for their code and are
9802 Individual authors are the holders of the copyright for their code and are
9791 listed in each file.
9803 listed in each file.
9792 \end_layout
9804 \end_layout
9793
9805
9794 \begin_layout Standard
9806 \begin_layout Standard
9795 Some files (
9807 Some files (
9796 \family typewriter
9808 \family typewriter
9797 DPyGetOpt.py
9809 DPyGetOpt.py
9798 \family default
9810 \family default
9799 , for example) may be licensed under different conditions.
9811 , for example) may be licensed under different conditions.
9800 Ultimately each file indicates clearly the conditions under which its author/au
9812 Ultimately each file indicates clearly the conditions under which its author/au
9801 thors have decided to publish the code.
9813 thors have decided to publish the code.
9802 \end_layout
9814 \end_layout
9803
9815
9804 \begin_layout Standard
9816 \begin_layout Standard
9805 Versions of IPython up to and including 0.6.3 were released under the GNU
9817 Versions of IPython up to and including 0.6.3 were released under the GNU
9806 Lesser General Public License (LGPL), available at
9818 Lesser General Public License (LGPL), available at
9807 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
9819 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
9808
9820
9809 \end_inset
9821 \end_inset
9810
9822
9811 .
9823 .
9812 \end_layout
9824 \end_layout
9813
9825
9814 \begin_layout Section
9826 \begin_layout Section
9815 \begin_inset LatexCommand \label{sec:credits}
9827 \begin_inset LatexCommand \label{sec:credits}
9816
9828
9817 \end_inset
9829 \end_inset
9818
9830
9819 Credits
9831 Credits
9820 \end_layout
9832 \end_layout
9821
9833
9822 \begin_layout Standard
9834 \begin_layout Standard
9823 IPython is mainly developed by Fernando P
9835 IPython is mainly developed by Fernando P
9824 \begin_inset ERT
9836 \begin_inset ERT
9825 status collapsed
9837 status collapsed
9826
9838
9827 \begin_layout Standard
9839 \begin_layout Standard
9828
9840
9829
9841
9830 \backslash
9842 \backslash
9831 '{e}
9843 '{e}
9832 \end_layout
9844 \end_layout
9833
9845
9834 \end_inset
9846 \end_inset
9835
9847
9836 rez
9848 rez
9837 \family typewriter
9849 \family typewriter
9838 <Fernando.Perez@colorado.edu>
9850 <Fernando.Perez@colorado.edu>
9839 \family default
9851 \family default
9840 , but the project was born from mixing in Fernando's code with the IPP project
9852 , but the project was born from mixing in Fernando's code with the IPP project
9841 by Janko Hauser
9853 by Janko Hauser
9842 \family typewriter
9854 \family typewriter
9843 <jhauser-AT-zscout.de>
9855 <jhauser-AT-zscout.de>
9844 \family default
9856 \family default
9845 and LazyPython by Nathan Gray
9857 and LazyPython by Nathan Gray
9846 \family typewriter
9858 \family typewriter
9847 <n8gray-AT-caltech.edu>
9859 <n8gray-AT-caltech.edu>
9848 \family default
9860 \family default
9849 .
9861 .
9850 For all IPython-related requests, please contact Fernando.
9862 For all IPython-related requests, please contact Fernando.
9851
9863
9852 \end_layout
9864 \end_layout
9853
9865
9854 \begin_layout Standard
9866 \begin_layout Standard
9855 As of early 2006, the following developers have joined the core team:
9867 As of early 2006, the following developers have joined the core team:
9856 \end_layout
9868 \end_layout
9857
9869
9858 \begin_layout List
9870 \begin_layout List
9859 \labelwidthstring 00.00.0000
9871 \labelwidthstring 00.00.0000
9860 Robert\InsetSpace ~
9872 Robert\InsetSpace ~
9861 Kern
9873 Kern
9862 \family typewriter
9874 \family typewriter
9863 <rkern-AT-enthought.com>
9875 <rkern-AT-enthought.com>
9864 \family default
9876 \family default
9865 : co-mentored the 2005 Google Summer of Code project to develop python interacti
9877 : co-mentored the 2005 Google Summer of Code project to develop python interacti
9866 ve notebooks (XML documents) and graphical interface.
9878 ve notebooks (XML documents) and graphical interface.
9867 This project was awarded to the students Tzanko Matev
9879 This project was awarded to the students Tzanko Matev
9868 \family typewriter
9880 \family typewriter
9869 <tsanko-AT-gmail.com>
9881 <tsanko-AT-gmail.com>
9870 \family default
9882 \family default
9871 and Toni Alatalo
9883 and Toni Alatalo
9872 \family typewriter
9884 \family typewriter
9873 <antont-AT-an.org>
9885 <antont-AT-an.org>
9874 \end_layout
9886 \end_layout
9875
9887
9876 \begin_layout List
9888 \begin_layout List
9877 \labelwidthstring 00.00.0000
9889 \labelwidthstring 00.00.0000
9878 Brian\InsetSpace ~
9890 Brian\InsetSpace ~
9879 Granger
9891 Granger
9880 \family typewriter
9892 \family typewriter
9881 <bgranger-AT-scu.edu>
9893 <bgranger-AT-scu.edu>
9882 \family default
9894 \family default
9883 : extending IPython to allow support for interactive parallel computing.
9895 : extending IPython to allow support for interactive parallel computing.
9884 \end_layout
9896 \end_layout
9885
9897
9886 \begin_layout List
9898 \begin_layout List
9887 \labelwidthstring 00.00.0000
9899 \labelwidthstring 00.00.0000
9888 Ville\InsetSpace ~
9900 Ville\InsetSpace ~
9889 Vainio
9901 Vainio
9890 \family typewriter
9902 \family typewriter
9891 <vivainio-AT-gmail.com>
9903 <vivainio-AT-gmail.com>
9892 \family default
9904 \family default
9893 : Ville is the new maintainer for the main trunk of IPython after version
9905 : Ville is the new maintainer for the main trunk of IPython after version
9894 0.7.1.
9906 0.7.1.
9895 \end_layout
9907 \end_layout
9896
9908
9897 \begin_layout Standard
9909 \begin_layout Standard
9898 User or development help should be requested via the IPython mailing lists:
9910 User or development help should be requested via the IPython mailing lists:
9899 \end_layout
9911 \end_layout
9900
9912
9901 \begin_layout Description
9913 \begin_layout Description
9902 User\InsetSpace ~
9914 User\InsetSpace ~
9903 list:
9915 list:
9904 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
9916 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
9905
9917
9906 \end_inset
9918 \end_inset
9907
9919
9908
9920
9909 \end_layout
9921 \end_layout
9910
9922
9911 \begin_layout Description
9923 \begin_layout Description
9912 Developer's\InsetSpace ~
9924 Developer's\InsetSpace ~
9913 list:
9925 list:
9914 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
9926 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
9915
9927
9916 \end_inset
9928 \end_inset
9917
9929
9918
9930
9919 \end_layout
9931 \end_layout
9920
9932
9921 \begin_layout Standard
9933 \begin_layout Standard
9922 The IPython project is also very grateful to
9934 The IPython project is also very grateful to
9923 \begin_inset Foot
9935 \begin_inset Foot
9924 status collapsed
9936 status collapsed
9925
9937
9926 \begin_layout Standard
9938 \begin_layout Standard
9927 I've mangled email addresses to reduce spam, since the IPython manuals can
9939 I've mangled email addresses to reduce spam, since the IPython manuals can
9928 be accessed online.
9940 be accessed online.
9929 \end_layout
9941 \end_layout
9930
9942
9931 \end_inset
9943 \end_inset
9932
9944
9933 :
9945 :
9934 \end_layout
9946 \end_layout
9935
9947
9936 \begin_layout Standard
9948 \begin_layout Standard
9937 Bill Bumgarner
9949 Bill Bumgarner
9938 \family typewriter
9950 \family typewriter
9939 <bbum-AT-friday.com>
9951 <bbum-AT-friday.com>
9940 \family default
9952 \family default
9941 : for providing the DPyGetOpt module which gives very powerful and convenient
9953 : for providing the DPyGetOpt module which gives very powerful and convenient
9942 handling of command-line options (light years ahead of what Python 2.1.1's
9954 handling of command-line options (light years ahead of what Python 2.1.1's
9943 getopt module does).
9955 getopt module does).
9944 \end_layout
9956 \end_layout
9945
9957
9946 \begin_layout Standard
9958 \begin_layout Standard
9947 Ka-Ping Yee
9959 Ka-Ping Yee
9948 \family typewriter
9960 \family typewriter
9949 <ping-AT-lfw.org>
9961 <ping-AT-lfw.org>
9950 \family default
9962 \family default
9951 : for providing the Itpl module for convenient and powerful string interpolation
9963 : for providing the Itpl module for convenient and powerful string interpolation
9952 with a much nicer syntax than formatting through the '%' operator.
9964 with a much nicer syntax than formatting through the '%' operator.
9953 \end_layout
9965 \end_layout
9954
9966
9955 \begin_layout Standard
9967 \begin_layout Standard
9956 Arnd Baecker
9968 Arnd Baecker
9957 \family typewriter
9969 \family typewriter
9958 <baecker-AT-physik.tu-dresden.de>
9970 <baecker-AT-physik.tu-dresden.de>
9959 \family default
9971 \family default
9960 : for his many very useful suggestions and comments, and lots of help with
9972 : for his many very useful suggestions and comments, and lots of help with
9961 testing and documentation checking.
9973 testing and documentation checking.
9962 Many of IPython's newer features are a result of discussions with him (bugs
9974 Many of IPython's newer features are a result of discussions with him (bugs
9963 are still my fault, not his).
9975 are still my fault, not his).
9964 \end_layout
9976 \end_layout
9965
9977
9966 \begin_layout Standard
9978 \begin_layout Standard
9967 Obviously Guido van\InsetSpace ~
9979 Obviously Guido van\InsetSpace ~
9968 Rossum and the whole Python development team, that goes
9980 Rossum and the whole Python development team, that goes
9969 without saying.
9981 without saying.
9970 \end_layout
9982 \end_layout
9971
9983
9972 \begin_layout Standard
9984 \begin_layout Standard
9973 IPython's website is generously hosted at
9985 IPython's website is generously hosted at
9974 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
9986 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
9975
9987
9976 \end_inset
9988 \end_inset
9977
9989
9978 by Enthought (
9990 by Enthought (
9979 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
9991 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
9980
9992
9981 \end_inset
9993 \end_inset
9982
9994
9983 ).
9995 ).
9984 I am very grateful to them and all of the SciPy team for their contribution.
9996 I am very grateful to them and all of the SciPy team for their contribution.
9985 \end_layout
9997 \end_layout
9986
9998
9987 \begin_layout Standard
9999 \begin_layout Standard
9988 \begin_inset LatexCommand \label{figgins}
10000 \begin_inset LatexCommand \label{figgins}
9989
10001
9990 \end_inset
10002 \end_inset
9991
10003
9992 Fernando would also like to thank Stephen Figgins
10004 Fernando would also like to thank Stephen Figgins
9993 \family typewriter
10005 \family typewriter
9994 <fig-AT-monitor.net>
10006 <fig-AT-monitor.net>
9995 \family default
10007 \family default
9996 , an O'Reilly Python editor.
10008 , an O'Reilly Python editor.
9997 His Oct/11/2001 article about IPP and LazyPython, was what got this project
10009 His Oct/11/2001 article about IPP and LazyPython, was what got this project
9998 started.
10010 started.
9999 You can read it at:
10011 You can read it at:
10000 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
10012 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
10001
10013
10002 \end_inset
10014 \end_inset
10003
10015
10004 .
10016 .
10005 \end_layout
10017 \end_layout
10006
10018
10007 \begin_layout Standard
10019 \begin_layout Standard
10008 And last but not least, all the kind IPython users who have emailed new
10020 And last but not least, all the kind IPython users who have emailed new
10009 code, bug reports, fixes, comments and ideas.
10021 code, bug reports, fixes, comments and ideas.
10010 A brief list follows, please let me know if I have ommitted your name by
10022 A brief list follows, please let me know if I have ommitted your name by
10011 accident:
10023 accident:
10012 \end_layout
10024 \end_layout
10013
10025
10014 \begin_layout List
10026 \begin_layout List
10015 \labelwidthstring 00.00.0000
10027 \labelwidthstring 00.00.0000
10016 Jack\InsetSpace ~
10028 Jack\InsetSpace ~
10017 Moffit
10029 Moffit
10018 \family typewriter
10030 \family typewriter
10019 <jack-AT-xiph.org>
10031 <jack-AT-xiph.org>
10020 \family default
10032 \family default
10021 Bug fixes, including the infamous color problem.
10033 Bug fixes, including the infamous color problem.
10022 This bug alone caused many lost hours and frustration, many thanks to him
10034 This bug alone caused many lost hours and frustration, many thanks to him
10023 for the fix.
10035 for the fix.
10024 I've always been a fan of Ogg & friends, now I have one more reason to
10036 I've always been a fan of Ogg & friends, now I have one more reason to
10025 like these folks.
10037 like these folks.
10026 \newline
10038 \newline
10027 Jack is also contributing with Debian packaging and many
10039 Jack is also contributing with Debian packaging and many
10028 other things.
10040 other things.
10029 \end_layout
10041 \end_layout
10030
10042
10031 \begin_layout List
10043 \begin_layout List
10032 \labelwidthstring 00.00.0000
10044 \labelwidthstring 00.00.0000
10033 Alexander\InsetSpace ~
10045 Alexander\InsetSpace ~
10034 Schmolck
10046 Schmolck
10035 \family typewriter
10047 \family typewriter
10036 <a.schmolck-AT-gmx.net>
10048 <a.schmolck-AT-gmx.net>
10037 \family default
10049 \family default
10038 Emacs work, bug reports, bug fixes, ideas, lots more.
10050 Emacs work, bug reports, bug fixes, ideas, lots more.
10039 The ipython.el mode for (X)Emacs is Alex's code, providing full support
10051 The ipython.el mode for (X)Emacs is Alex's code, providing full support
10040 for IPython under (X)Emacs.
10052 for IPython under (X)Emacs.
10041 \end_layout
10053 \end_layout
10042
10054
10043 \begin_layout List
10055 \begin_layout List
10044 \labelwidthstring 00.00.0000
10056 \labelwidthstring 00.00.0000
10045 Andrea\InsetSpace ~
10057 Andrea\InsetSpace ~
10046 Riciputi
10058 Riciputi
10047 \family typewriter
10059 \family typewriter
10048 <andrea.riciputi-AT-libero.it>
10060 <andrea.riciputi-AT-libero.it>
10049 \family default
10061 \family default
10050 Mac OSX information, Fink package management.
10062 Mac OSX information, Fink package management.
10051 \end_layout
10063 \end_layout
10052
10064
10053 \begin_layout List
10065 \begin_layout List
10054 \labelwidthstring 00.00.0000
10066 \labelwidthstring 00.00.0000
10055 Gary\InsetSpace ~
10067 Gary\InsetSpace ~
10056 Bishop
10068 Bishop
10057 \family typewriter
10069 \family typewriter
10058 <gb-AT-cs.unc.edu>
10070 <gb-AT-cs.unc.edu>
10059 \family default
10071 \family default
10060 Bug reports, and patches to work around the exception handling idiosyncracies
10072 Bug reports, and patches to work around the exception handling idiosyncracies
10061 of WxPython.
10073 of WxPython.
10062 Readline and color support for Windows.
10074 Readline and color support for Windows.
10063 \end_layout
10075 \end_layout
10064
10076
10065 \begin_layout List
10077 \begin_layout List
10066 \labelwidthstring 00.00.0000
10078 \labelwidthstring 00.00.0000
10067 Jeffrey\InsetSpace ~
10079 Jeffrey\InsetSpace ~
10068 Collins
10080 Collins
10069 \family typewriter
10081 \family typewriter
10070 <Jeff.Collins-AT-vexcel.com>
10082 <Jeff.Collins-AT-vexcel.com>
10071 \family default
10083 \family default
10072 Bug reports.
10084 Bug reports.
10073 Much improved readline support, including fixes for Python 2.3.
10085 Much improved readline support, including fixes for Python 2.3.
10074 \end_layout
10086 \end_layout
10075
10087
10076 \begin_layout List
10088 \begin_layout List
10077 \labelwidthstring 00.00.0000
10089 \labelwidthstring 00.00.0000
10078 Dryice\InsetSpace ~
10090 Dryice\InsetSpace ~
10079 Liu
10091 Liu
10080 \family typewriter
10092 \family typewriter
10081 <dryice-AT-liu.com.cn>
10093 <dryice-AT-liu.com.cn>
10082 \family default
10094 \family default
10083 FreeBSD port.
10095 FreeBSD port.
10084 \end_layout
10096 \end_layout
10085
10097
10086 \begin_layout List
10098 \begin_layout List
10087 \labelwidthstring 00.00.0000
10099 \labelwidthstring 00.00.0000
10088 Mike\InsetSpace ~
10100 Mike\InsetSpace ~
10089 Heeter
10101 Heeter
10090 \family typewriter
10102 \family typewriter
10091 <korora-AT-SDF.LONESTAR.ORG>
10103 <korora-AT-SDF.LONESTAR.ORG>
10092 \end_layout
10104 \end_layout
10093
10105
10094 \begin_layout List
10106 \begin_layout List
10095 \labelwidthstring 00.00.0000
10107 \labelwidthstring 00.00.0000
10096 Christopher\InsetSpace ~
10108 Christopher\InsetSpace ~
10097 Hart
10109 Hart
10098 \family typewriter
10110 \family typewriter
10099 <hart-AT-caltech.edu>
10111 <hart-AT-caltech.edu>
10100 \family default
10112 \family default
10101 PDB integration.
10113 PDB integration.
10102 \end_layout
10114 \end_layout
10103
10115
10104 \begin_layout List
10116 \begin_layout List
10105 \labelwidthstring 00.00.0000
10117 \labelwidthstring 00.00.0000
10106 Milan\InsetSpace ~
10118 Milan\InsetSpace ~
10107 Zamazal
10119 Zamazal
10108 \family typewriter
10120 \family typewriter
10109 <pdm-AT-zamazal.org>
10121 <pdm-AT-zamazal.org>
10110 \family default
10122 \family default
10111 Emacs info.
10123 Emacs info.
10112 \end_layout
10124 \end_layout
10113
10125
10114 \begin_layout List
10126 \begin_layout List
10115 \labelwidthstring 00.00.0000
10127 \labelwidthstring 00.00.0000
10116 Philip\InsetSpace ~
10128 Philip\InsetSpace ~
10117 Hisley
10129 Hisley
10118 \family typewriter
10130 \family typewriter
10119 <compsys-AT-starpower.net>
10131 <compsys-AT-starpower.net>
10120 \end_layout
10132 \end_layout
10121
10133
10122 \begin_layout List
10134 \begin_layout List
10123 \labelwidthstring 00.00.0000
10135 \labelwidthstring 00.00.0000
10124 Holger\InsetSpace ~
10136 Holger\InsetSpace ~
10125 Krekel
10137 Krekel
10126 \family typewriter
10138 \family typewriter
10127 <pyth-AT-devel.trillke.net>
10139 <pyth-AT-devel.trillke.net>
10128 \family default
10140 \family default
10129 Tab completion, lots more.
10141 Tab completion, lots more.
10130 \end_layout
10142 \end_layout
10131
10143
10132 \begin_layout List
10144 \begin_layout List
10133 \labelwidthstring 00.00.0000
10145 \labelwidthstring 00.00.0000
10134 Robin\InsetSpace ~
10146 Robin\InsetSpace ~
10135 Siebler
10147 Siebler
10136 \family typewriter
10148 \family typewriter
10137 <robinsiebler-AT-starband.net>
10149 <robinsiebler-AT-starband.net>
10138 \end_layout
10150 \end_layout
10139
10151
10140 \begin_layout List
10152 \begin_layout List
10141 \labelwidthstring 00.00.0000
10153 \labelwidthstring 00.00.0000
10142 Ralf\InsetSpace ~
10154 Ralf\InsetSpace ~
10143 Ahlbrink
10155 Ahlbrink
10144 \family typewriter
10156 \family typewriter
10145 <ralf_ahlbrink-AT-web.de>
10157 <ralf_ahlbrink-AT-web.de>
10146 \end_layout
10158 \end_layout
10147
10159
10148 \begin_layout List
10160 \begin_layout List
10149 \labelwidthstring 00.00.0000
10161 \labelwidthstring 00.00.0000
10150 Thorsten\InsetSpace ~
10162 Thorsten\InsetSpace ~
10151 Kampe
10163 Kampe
10152 \family typewriter
10164 \family typewriter
10153 <thorsten-AT-thorstenkampe.de>
10165 <thorsten-AT-thorstenkampe.de>
10154 \end_layout
10166 \end_layout
10155
10167
10156 \begin_layout List
10168 \begin_layout List
10157 \labelwidthstring 00.00.0000
10169 \labelwidthstring 00.00.0000
10158 Fredrik\InsetSpace ~
10170 Fredrik\InsetSpace ~
10159 Kant
10171 Kant
10160 \family typewriter
10172 \family typewriter
10161 <fredrik.kant-AT-front.com>
10173 <fredrik.kant-AT-front.com>
10162 \family default
10174 \family default
10163 Windows setup.
10175 Windows setup.
10164 \end_layout
10176 \end_layout
10165
10177
10166 \begin_layout List
10178 \begin_layout List
10167 \labelwidthstring 00.00.0000
10179 \labelwidthstring 00.00.0000
10168 Syver\InsetSpace ~
10180 Syver\InsetSpace ~
10169 Enstad
10181 Enstad
10170 \family typewriter
10182 \family typewriter
10171 <syver-en-AT-online.no>
10183 <syver-en-AT-online.no>
10172 \family default
10184 \family default
10173 Windows setup.
10185 Windows setup.
10174 \end_layout
10186 \end_layout
10175
10187
10176 \begin_layout List
10188 \begin_layout List
10177 \labelwidthstring 00.00.0000
10189 \labelwidthstring 00.00.0000
10178 Richard
10190 Richard
10179 \family typewriter
10191 \family typewriter
10180 <rxe-AT-renre-europe.com>
10192 <rxe-AT-renre-europe.com>
10181 \family default
10193 \family default
10182 Global embedding.
10194 Global embedding.
10183 \end_layout
10195 \end_layout
10184
10196
10185 \begin_layout List
10197 \begin_layout List
10186 \labelwidthstring 00.00.0000
10198 \labelwidthstring 00.00.0000
10187 Hayden\InsetSpace ~
10199 Hayden\InsetSpace ~
10188 Callow
10200 Callow
10189 \family typewriter
10201 \family typewriter
10190 <h.callow-AT-elec.canterbury.ac.nz>
10202 <h.callow-AT-elec.canterbury.ac.nz>
10191 \family default
10203 \family default
10192 Gnuplot.py 1.6 compatibility.
10204 Gnuplot.py 1.6 compatibility.
10193 \end_layout
10205 \end_layout
10194
10206
10195 \begin_layout List
10207 \begin_layout List
10196 \labelwidthstring 00.00.0000
10208 \labelwidthstring 00.00.0000
10197 Leonardo\InsetSpace ~
10209 Leonardo\InsetSpace ~
10198 Santagada
10210 Santagada
10199 \family typewriter
10211 \family typewriter
10200 <retype-AT-terra.com.br>
10212 <retype-AT-terra.com.br>
10201 \family default
10213 \family default
10202 Fixes for Windows installation.
10214 Fixes for Windows installation.
10203 \end_layout
10215 \end_layout
10204
10216
10205 \begin_layout List
10217 \begin_layout List
10206 \labelwidthstring 00.00.0000
10218 \labelwidthstring 00.00.0000
10207 Christopher\InsetSpace ~
10219 Christopher\InsetSpace ~
10208 Armstrong
10220 Armstrong
10209 \family typewriter
10221 \family typewriter
10210 <radix-AT-twistedmatrix.com>
10222 <radix-AT-twistedmatrix.com>
10211 \family default
10223 \family default
10212 Bugfixes.
10224 Bugfixes.
10213 \end_layout
10225 \end_layout
10214
10226
10215 \begin_layout List
10227 \begin_layout List
10216 \labelwidthstring 00.00.0000
10228 \labelwidthstring 00.00.0000
10217 Francois\InsetSpace ~
10229 Francois\InsetSpace ~
10218 Pinard
10230 Pinard
10219 \family typewriter
10231 \family typewriter
10220 <pinard-AT-iro.umontreal.ca>
10232 <pinard-AT-iro.umontreal.ca>
10221 \family default
10233 \family default
10222 Code and documentation fixes.
10234 Code and documentation fixes.
10223 \end_layout
10235 \end_layout
10224
10236
10225 \begin_layout List
10237 \begin_layout List
10226 \labelwidthstring 00.00.0000
10238 \labelwidthstring 00.00.0000
10227 Cory\InsetSpace ~
10239 Cory\InsetSpace ~
10228 Dodt
10240 Dodt
10229 \family typewriter
10241 \family typewriter
10230 <cdodt-AT-fcoe.k12.ca.us>
10242 <cdodt-AT-fcoe.k12.ca.us>
10231 \family default
10243 \family default
10232 Bug reports and Windows ideas.
10244 Bug reports and Windows ideas.
10233 Patches for Windows installer.
10245 Patches for Windows installer.
10234 \end_layout
10246 \end_layout
10235
10247
10236 \begin_layout List
10248 \begin_layout List
10237 \labelwidthstring 00.00.0000
10249 \labelwidthstring 00.00.0000
10238 Olivier\InsetSpace ~
10250 Olivier\InsetSpace ~
10239 Aubert
10251 Aubert
10240 \family typewriter
10252 \family typewriter
10241 <oaubert-AT-bat710.univ-lyon1.fr>
10253 <oaubert-AT-bat710.univ-lyon1.fr>
10242 \family default
10254 \family default
10243 New magics.
10255 New magics.
10244 \end_layout
10256 \end_layout
10245
10257
10246 \begin_layout List
10258 \begin_layout List
10247 \labelwidthstring 00.00.0000
10259 \labelwidthstring 00.00.0000
10248 King\InsetSpace ~
10260 King\InsetSpace ~
10249 C.\InsetSpace ~
10261 C.\InsetSpace ~
10250 Shu
10262 Shu
10251 \family typewriter
10263 \family typewriter
10252 <kingshu-AT-myrealbox.com>
10264 <kingshu-AT-myrealbox.com>
10253 \family default
10265 \family default
10254 Autoindent patch.
10266 Autoindent patch.
10255 \end_layout
10267 \end_layout
10256
10268
10257 \begin_layout List
10269 \begin_layout List
10258 \labelwidthstring 00.00.0000
10270 \labelwidthstring 00.00.0000
10259 Chris\InsetSpace ~
10271 Chris\InsetSpace ~
10260 Drexler
10272 Drexler
10261 \family typewriter
10273 \family typewriter
10262 <chris-AT-ac-drexler.de>
10274 <chris-AT-ac-drexler.de>
10263 \family default
10275 \family default
10264 Readline packages for Win32/CygWin.
10276 Readline packages for Win32/CygWin.
10265 \end_layout
10277 \end_layout
10266
10278
10267 \begin_layout List
10279 \begin_layout List
10268 \labelwidthstring 00.00.0000
10280 \labelwidthstring 00.00.0000
10269 Gustavo\InsetSpace ~
10281 Gustavo\InsetSpace ~
10270 Cordova\InsetSpace ~
10282 Cordova\InsetSpace ~
10271 Avila
10283 Avila
10272 \family typewriter
10284 \family typewriter
10273 <gcordova-AT-sismex.com>
10285 <gcordova-AT-sismex.com>
10274 \family default
10286 \family default
10275 EvalDict code for nice, lightweight string interpolation.
10287 EvalDict code for nice, lightweight string interpolation.
10276 \end_layout
10288 \end_layout
10277
10289
10278 \begin_layout List
10290 \begin_layout List
10279 \labelwidthstring 00.00.0000
10291 \labelwidthstring 00.00.0000
10280 Kasper\InsetSpace ~
10292 Kasper\InsetSpace ~
10281 Souren
10293 Souren
10282 \family typewriter
10294 \family typewriter
10283 <Kasper.Souren-AT-ircam.fr>
10295 <Kasper.Souren-AT-ircam.fr>
10284 \family default
10296 \family default
10285 Bug reports, ideas.
10297 Bug reports, ideas.
10286 \end_layout
10298 \end_layout
10287
10299
10288 \begin_layout List
10300 \begin_layout List
10289 \labelwidthstring 00.00.0000
10301 \labelwidthstring 00.00.0000
10290 Gever\InsetSpace ~
10302 Gever\InsetSpace ~
10291 Tulley
10303 Tulley
10292 \family typewriter
10304 \family typewriter
10293 <gever-AT-helium.com>
10305 <gever-AT-helium.com>
10294 \family default
10306 \family default
10295 Code contributions.
10307 Code contributions.
10296 \end_layout
10308 \end_layout
10297
10309
10298 \begin_layout List
10310 \begin_layout List
10299 \labelwidthstring 00.00.0000
10311 \labelwidthstring 00.00.0000
10300 Ralf\InsetSpace ~
10312 Ralf\InsetSpace ~
10301 Schmitt
10313 Schmitt
10302 \family typewriter
10314 \family typewriter
10303 <ralf-AT-brainbot.com>
10315 <ralf-AT-brainbot.com>
10304 \family default
10316 \family default
10305 Bug reports & fixes.
10317 Bug reports & fixes.
10306 \end_layout
10318 \end_layout
10307
10319
10308 \begin_layout List
10320 \begin_layout List
10309 \labelwidthstring 00.00.0000
10321 \labelwidthstring 00.00.0000
10310 Oliver\InsetSpace ~
10322 Oliver\InsetSpace ~
10311 Sander
10323 Sander
10312 \family typewriter
10324 \family typewriter
10313 <osander-AT-gmx.de>
10325 <osander-AT-gmx.de>
10314 \family default
10326 \family default
10315 Bug reports.
10327 Bug reports.
10316 \end_layout
10328 \end_layout
10317
10329
10318 \begin_layout List
10330 \begin_layout List
10319 \labelwidthstring 00.00.0000
10331 \labelwidthstring 00.00.0000
10320 Rod\InsetSpace ~
10332 Rod\InsetSpace ~
10321 Holland
10333 Holland
10322 \family typewriter
10334 \family typewriter
10323 <rhh-AT-structurelabs.com>
10335 <rhh-AT-structurelabs.com>
10324 \family default
10336 \family default
10325 Bug reports and fixes to logging module.
10337 Bug reports and fixes to logging module.
10326 \end_layout
10338 \end_layout
10327
10339
10328 \begin_layout List
10340 \begin_layout List
10329 \labelwidthstring 00.00.0000
10341 \labelwidthstring 00.00.0000
10330 Daniel\InsetSpace ~
10342 Daniel\InsetSpace ~
10331 'Dang'\InsetSpace ~
10343 'Dang'\InsetSpace ~
10332 Griffith
10344 Griffith
10333 \family typewriter
10345 \family typewriter
10334 <pythondev-dang-AT-lazytwinacres.net>
10346 <pythondev-dang-AT-lazytwinacres.net>
10335 \family default
10347 \family default
10336 Fixes, enhancement suggestions for system shell use.
10348 Fixes, enhancement suggestions for system shell use.
10337 \end_layout
10349 \end_layout
10338
10350
10339 \begin_layout List
10351 \begin_layout List
10340 \labelwidthstring 00.00.0000
10352 \labelwidthstring 00.00.0000
10341 Viktor\InsetSpace ~
10353 Viktor\InsetSpace ~
10342 Ransmayr
10354 Ransmayr
10343 \family typewriter
10355 \family typewriter
10344 <viktor.ransmayr-AT-t-online.de>
10356 <viktor.ransmayr-AT-t-online.de>
10345 \family default
10357 \family default
10346 Tests and reports on Windows installation issues.
10358 Tests and reports on Windows installation issues.
10347 Contributed a true Windows binary installer.
10359 Contributed a true Windows binary installer.
10348 \end_layout
10360 \end_layout
10349
10361
10350 \begin_layout List
10362 \begin_layout List
10351 \labelwidthstring 00.00.0000
10363 \labelwidthstring 00.00.0000
10352 Mike\InsetSpace ~
10364 Mike\InsetSpace ~
10353 Salib
10365 Salib
10354 \family typewriter
10366 \family typewriter
10355 <msalib-AT-mit.edu>
10367 <msalib-AT-mit.edu>
10356 \family default
10368 \family default
10357 Help fixing a subtle bug related to traceback printing.
10369 Help fixing a subtle bug related to traceback printing.
10358 \end_layout
10370 \end_layout
10359
10371
10360 \begin_layout List
10372 \begin_layout List
10361 \labelwidthstring 00.00.0000
10373 \labelwidthstring 00.00.0000
10362 W.J.\InsetSpace ~
10374 W.J.\InsetSpace ~
10363 van\InsetSpace ~
10375 van\InsetSpace ~
10364 der\InsetSpace ~
10376 der\InsetSpace ~
10365 Laan
10377 Laan
10366 \family typewriter
10378 \family typewriter
10367 <gnufnork-AT-hetdigitalegat.nl>
10379 <gnufnork-AT-hetdigitalegat.nl>
10368 \family default
10380 \family default
10369 Bash-like prompt specials.
10381 Bash-like prompt specials.
10370 \end_layout
10382 \end_layout
10371
10383
10372 \begin_layout List
10384 \begin_layout List
10373 \labelwidthstring 00.00.0000
10385 \labelwidthstring 00.00.0000
10374 Antoon\InsetSpace ~
10386 Antoon\InsetSpace ~
10375 Pardon
10387 Pardon
10376 \family typewriter
10388 \family typewriter
10377 <Antoon.Pardon-AT-rece.vub.ac.be>
10389 <Antoon.Pardon-AT-rece.vub.ac.be>
10378 \family default
10390 \family default
10379 Critical fix for the multithreaded IPython.
10391 Critical fix for the multithreaded IPython.
10380 \end_layout
10392 \end_layout
10381
10393
10382 \begin_layout List
10394 \begin_layout List
10383 \labelwidthstring 00.00.0000
10395 \labelwidthstring 00.00.0000
10384 John\InsetSpace ~
10396 John\InsetSpace ~
10385 Hunter
10397 Hunter
10386 \family typewriter
10398 \family typewriter
10387 <jdhunter-AT-nitace.bsd.uchicago.edu>
10399 <jdhunter-AT-nitace.bsd.uchicago.edu>
10388 \family default
10400 \family default
10389 Matplotlib author, helped with all the development of support for matplotlib
10401 Matplotlib author, helped with all the development of support for matplotlib
10390 in IPyhton, including making necessary changes to matplotlib itself.
10402 in IPyhton, including making necessary changes to matplotlib itself.
10391 \end_layout
10403 \end_layout
10392
10404
10393 \begin_layout List
10405 \begin_layout List
10394 \labelwidthstring 00.00.0000
10406 \labelwidthstring 00.00.0000
10395 Matthew\InsetSpace ~
10407 Matthew\InsetSpace ~
10396 Arnison
10408 Arnison
10397 \family typewriter
10409 \family typewriter
10398 <maffew-AT-cat.org.au>
10410 <maffew-AT-cat.org.au>
10399 \family default
10411 \family default
10400 Bug reports, `
10412 Bug reports, `
10401 \family typewriter
10413 \family typewriter
10402 %run -d
10414 %run -d
10403 \family default
10415 \family default
10404 ' idea.
10416 ' idea.
10405 \end_layout
10417 \end_layout
10406
10418
10407 \begin_layout List
10419 \begin_layout List
10408 \labelwidthstring 00.00.0000
10420 \labelwidthstring 00.00.0000
10409 Prabhu\InsetSpace ~
10421 Prabhu\InsetSpace ~
10410 Ramachandran
10422 Ramachandran
10411 \family typewriter
10423 \family typewriter
10412 <prabhu_r-AT-users.sourceforge.net>
10424 <prabhu_r-AT-users.sourceforge.net>
10413 \family default
10425 \family default
10414 Help with (X)Emacs support, threading patches, ideas...
10426 Help with (X)Emacs support, threading patches, ideas...
10415 \end_layout
10427 \end_layout
10416
10428
10417 \begin_layout List
10429 \begin_layout List
10418 \labelwidthstring 00.00.0000
10430 \labelwidthstring 00.00.0000
10419 Norbert\InsetSpace ~
10431 Norbert\InsetSpace ~
10420 Tretkowski
10432 Tretkowski
10421 \family typewriter
10433 \family typewriter
10422 <tretkowski-AT-inittab.de>
10434 <tretkowski-AT-inittab.de>
10423 \family default
10435 \family default
10424 help with Debian packaging and distribution.
10436 help with Debian packaging and distribution.
10425 \end_layout
10437 \end_layout
10426
10438
10427 \begin_layout List
10439 \begin_layout List
10428 \labelwidthstring 00.00.0000
10440 \labelwidthstring 00.00.0000
10429 George\InsetSpace ~
10441 George\InsetSpace ~
10430 Sakkis <
10442 Sakkis <
10431 \family typewriter
10443 \family typewriter
10432 gsakkis-AT-eden.rutgers.edu>
10444 gsakkis-AT-eden.rutgers.edu>
10433 \family default
10445 \family default
10434 New matcher for tab-completing named arguments of user-defined functions.
10446 New matcher for tab-completing named arguments of user-defined functions.
10435 \end_layout
10447 \end_layout
10436
10448
10437 \begin_layout List
10449 \begin_layout List
10438 \labelwidthstring 00.00.0000
10450 \labelwidthstring 00.00.0000
10439 JοΏ½rgen\InsetSpace ~
10451 JοΏ½rgen\InsetSpace ~
10440 Stenarson
10452 Stenarson
10441 \family typewriter
10453 \family typewriter
10442 <jorgen.stenarson-AT-bostream.nu>
10454 <jorgen.stenarson-AT-bostream.nu>
10443 \family default
10455 \family default
10444 Wildcard support implementation for searching namespaces.
10456 Wildcard support implementation for searching namespaces.
10445 \end_layout
10457 \end_layout
10446
10458
10447 \begin_layout List
10459 \begin_layout List
10448 \labelwidthstring 00.00.0000
10460 \labelwidthstring 00.00.0000
10449 Vivian\InsetSpace ~
10461 Vivian\InsetSpace ~
10450 De\InsetSpace ~
10462 De\InsetSpace ~
10451 Smedt
10463 Smedt
10452 \family typewriter
10464 \family typewriter
10453 <vivian-AT-vdesmedt.com>
10465 <vivian-AT-vdesmedt.com>
10454 \family default
10466 \family default
10455 Debugger enhancements, so that when pdb is activated from within IPython,
10467 Debugger enhancements, so that when pdb is activated from within IPython,
10456 coloring, tab completion and other features continue to work seamlessly.
10468 coloring, tab completion and other features continue to work seamlessly.
10457 \end_layout
10469 \end_layout
10458
10470
10459 \begin_layout List
10471 \begin_layout List
10460 \labelwidthstring 00.00.0000
10472 \labelwidthstring 00.00.0000
10461 Scott\InsetSpace ~
10473 Scott\InsetSpace ~
10462 Tsai
10474 Tsai
10463 \family typewriter
10475 \family typewriter
10464 <scottt958-AT-yahoo.com.tw>
10476 <scottt958-AT-yahoo.com.tw>
10465 \family default
10477 \family default
10466 Support for automatic editor invocation on syntax errors (see
10478 Support for automatic editor invocation on syntax errors (see
10467 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython/issue36}
10479 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython/issue36}
10468
10480
10469 \end_inset
10481 \end_inset
10470
10482
10471 ).
10483 ).
10472 \end_layout
10484 \end_layout
10473
10485
10474 \begin_layout List
10486 \begin_layout List
10475 \labelwidthstring 00.00.0000
10487 \labelwidthstring 00.00.0000
10476 Alexander\InsetSpace ~
10488 Alexander\InsetSpace ~
10477 Belchenko
10489 Belchenko
10478 \family typewriter
10490 \family typewriter
10479 <bialix-AT-ukr.net>
10491 <bialix-AT-ukr.net>
10480 \family default
10492 \family default
10481 Improvements for win32 paging system.
10493 Improvements for win32 paging system.
10482 \end_layout
10494 \end_layout
10483
10495
10484 \begin_layout List
10496 \begin_layout List
10485 \labelwidthstring 00.00.0000
10497 \labelwidthstring 00.00.0000
10486 Will\InsetSpace ~
10498 Will\InsetSpace ~
10487 Maier
10499 Maier
10488 \family typewriter
10500 \family typewriter
10489 <willmaier-AT-ml1.net>
10501 <willmaier-AT-ml1.net>
10490 \family default
10502 \family default
10491 Official OpenBSD port.
10503 Official OpenBSD port.
10492 \end_layout
10504 \end_layout
10493
10505
10494 \end_body
10506 \end_body
10495 \end_document
10507 \end_document
General Comments 0
You need to be logged in to leave comments. Login now