IPython Documentation
[Pages:122]IPython Documentation
Release 0.8.3 Fernando Perez (and contributors)
May 31, 2008
CONTENTS
1 Indices and tables
3
2 Introduction
5
3 Overview
7
3.1 Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Portability and Python requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 Installation
11
4.1 Instant instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2 Mac OSX information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3 GUI problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.4 Readline problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.5 DarwinPorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.6 Windows instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.7 Installation procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.8 Upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.9 Manual installation under Win32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.10 Upgrading from a previous version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5 Initial configuration of your environment
15
5.1 Access to the Python help system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.2 Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3 Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.4 Input/Output prompts and exception tracebacks . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.5 Object details (types, docstrings, source code, etc.) . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.6 (X)Emacs configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6 Quick tips
19
6.1 Source code handling tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2 Lightweight `version control' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.3 Effective logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7 Command-line use
23
7.1 Special Threading Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.2 Regular Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8 Interactive use
29
8.1 Caution for Windows users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.2 Magic command system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.3 Magic commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
8.4 Access to the standard Python help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
8.5 Dynamic object information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
i
8.6 Readline-based features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 8.7 Session logging and restoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.8 System shell access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.9 Manual capture of command output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.10 System command aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 8.11 Recursive reload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 8.12 Verbose and colored exception traceback printouts . . . . . . . . . . . . . . . . . . . . . . . . . 60 8.13 Input caching system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 8.14 Output caching system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 8.15 Directory history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 8.16 Automatic parentheses and quotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 8.17 Automatic parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 8.18 Automatic quoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
9 Customization
63
9.1 The ipythonrc approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
9.2 Sample ipythonrc file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
9.3 ipy_user_conf.py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
9.4 Fine-tuning your prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9.5 IPython profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
10 IPython as your default Python environment
79
11 Embedding IPython
81
12 Using the Python debugger (pdb)
85
12.1 Running entire programs via pdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
12.2 Automatic invocation of pdb on exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
13 Extensions for syntax processing
87
13.1 Pasting of code starting with `>>> ` or `... ` . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
13.2 Input of physical quantities with units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
14 IPython as a system shell - the `Sh' profile
89
14.1 Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
14.2 Directory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
14.3 Enabled extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
14.4 Prompt customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
15 String lists
93
15.1 Real world example: remove all files outside version control . . . . . . . . . . . . . . . . . . . . 94
15.2 The .s, .n, .p properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
16 Threading support
97
16.1 Tk issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
16.2 I/O pitfalls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
17 Interactive demos with IPython
99
18 Plotting with matplotlib
101
19 IPython Extension Api
103
19.1 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
19.2 Getting a handle to the api . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
19.3 Changing options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
19.4 Executing statements in IPython namespace with `ex' and `ev' . . . . . . . . . . . . . . . . . . . 104
19.5 Accessing the IPython namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
19.6 Defining new magic commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
19.7 Calling magic functions and system commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
19.8 Launching IPython instance from normal python code . . . . . . . . . . . . . . . . . . . . . . . 105
ii
19.9 Accessing unexposed functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
20 Provided extensions
107
21 Reporting bugs
109
21.1 Automatic crash reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
21.2 The bug tracker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
22 Brief history
111
22.1 Origins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
22.2 Current status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
22.3 Future . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
23 License
113
24 Credits
115
iii
iv
Contents:
IPython Documentation, Release 0.8.3
Contents
1
2
? Index ? Module Index ? Search Page
CHAPTER
ONE
Indices and tables
3
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.