Show More
The requested changes are too big and content was truncated. Show full diff
@@ -1,586 +1,586 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | #***************************************************************************** |
|
2 | #***************************************************************************** | |
3 | # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu> |
|
3 | # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu> | |
4 | # |
|
4 | # | |
5 | # Distributed under the terms of the BSD License. The full license is in |
|
5 | # Distributed under the terms of the BSD License. The full license is in | |
6 | # the file COPYING, distributed as part of this software. |
|
6 | # the file COPYING, distributed as part of this software. | |
7 | #***************************************************************************** |
|
7 | #***************************************************************************** | |
8 |
|
8 | |||
9 |
# $Id: usage.py |
|
9 | # $Id: usage.py 926 2005-12-01 18:14:21Z fperez $ | |
10 |
|
10 | |||
11 | from IPython import Release |
|
11 | from IPython import Release | |
12 | __author__ = '%s <%s>' % Release.authors['Fernando'] |
|
12 | __author__ = '%s <%s>' % Release.authors['Fernando'] | |
13 | __license__ = Release.license |
|
13 | __license__ = Release.license | |
14 | __version__ = Release.version |
|
14 | __version__ = Release.version | |
15 |
|
15 | |||
16 | __doc__ = """ |
|
16 | __doc__ = """ | |
17 | IPython -- An enhanced Interactive Python |
|
17 | IPython -- An enhanced Interactive Python | |
18 | ========================================= |
|
18 | ========================================= | |
19 |
|
19 | |||
20 | A Python shell with automatic history (input and output), dynamic object |
|
20 | A Python shell with automatic history (input and output), dynamic object | |
21 | introspection, easier configuration, command completion, access to the system |
|
21 | introspection, easier configuration, command completion, access to the system | |
22 | shell and more. |
|
22 | shell and more. | |
23 |
|
23 | |||
24 | IPython can also be embedded in running programs. See EMBEDDING below. |
|
24 | IPython can also be embedded in running programs. See EMBEDDING below. | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | USAGE |
|
27 | USAGE | |
28 | ipython [options] files |
|
28 | ipython [options] files | |
29 |
|
29 | |||
30 | If invoked with no options, it executes all the files listed in |
|
30 | If invoked with no options, it executes all the files listed in | |
31 | sequence and drops you into the interpreter while still acknowledging |
|
31 | sequence and drops you into the interpreter while still acknowledging | |
32 | any options you may have set in your ipythonrc file. This behavior is |
|
32 | any options you may have set in your ipythonrc file. This behavior is | |
33 | different from standard Python, which when called as python -i will |
|
33 | different from standard Python, which when called as python -i will | |
34 | only execute one file and will ignore your configuration setup. |
|
34 | only execute one file and will ignore your configuration setup. | |
35 |
|
35 | |||
36 | Please note that some of the configuration options are not available at |
|
36 | Please note that some of the configuration options are not available at | |
37 | the command line, simply because they are not practical here. Look into |
|
37 | the command line, simply because they are not practical here. Look into | |
38 | your ipythonrc configuration file for details on those. This file |
|
38 | your ipythonrc configuration file for details on those. This file | |
39 | typically installed in the $HOME/.ipython directory. |
|
39 | typically installed in the $HOME/.ipython directory. | |
40 |
|
40 | |||
41 | For Windows users, $HOME resolves to C:\\Documents and |
|
41 | For Windows users, $HOME resolves to C:\\Documents and | |
42 | Settings\\YourUserName in most instances, and _ipython is used instead |
|
42 | Settings\\YourUserName in most instances, and _ipython is used instead | |
43 | of .ipython, since some Win32 programs have problems with dotted names |
|
43 | of .ipython, since some Win32 programs have problems with dotted names | |
44 | in directories. |
|
44 | in directories. | |
45 |
|
45 | |||
46 | In the rest of this text, we will refer to this directory as |
|
46 | In the rest of this text, we will refer to this directory as | |
47 | IPYTHONDIR. |
|
47 | IPYTHONDIR. | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | SPECIAL THREADING OPTIONS |
|
50 | SPECIAL THREADING OPTIONS | |
51 | The following special options are ONLY valid at the beginning of the |
|
51 | The following special options are ONLY valid at the beginning of the | |
52 | command line, and not later. This is because they control the initial- |
|
52 | command line, and not later. This is because they control the initial- | |
53 | ization of ipython itself, before the normal option-handling mechanism |
|
53 | ization of ipython itself, before the normal option-handling mechanism | |
54 | is active. |
|
54 | is active. | |
55 |
|
55 | |||
56 | -gthread, -qthread, -wthread, -pylab |
|
56 | -gthread, -qthread, -wthread, -pylab | |
57 |
|
57 | |||
58 | Only ONE of these can be given, and it can only be given as the |
|
58 | Only ONE of these can be given, and it can only be given as the | |
59 | first option passed to IPython (it will have no effect in any |
|
59 | first option passed to IPython (it will have no effect in any | |
60 | other position). They provide threading support for the GTK, QT |
|
60 | other position). They provide threading support for the GTK, QT | |
61 | and WXWidgets toolkits, and for the matplotlib library. |
|
61 | and WXWidgets toolkits, and for the matplotlib library. | |
62 |
|
62 | |||
63 | With any of the first three options, IPython starts running a |
|
63 | With any of the first three options, IPython starts running a | |
64 | separate thread for the graphical toolkit's operation, so that |
|
64 | separate thread for the graphical toolkit's operation, so that | |
65 | you can open and control graphical elements from within an |
|
65 | you can open and control graphical elements from within an | |
66 | IPython command line, without blocking. All three provide |
|
66 | IPython command line, without blocking. All three provide | |
67 | essentially the same functionality, respectively for GTK, QT and |
|
67 | essentially the same functionality, respectively for GTK, QT and | |
68 | WXWidgets (via their Python interfaces). |
|
68 | WXWidgets (via their Python interfaces). | |
69 |
|
69 | |||
70 | If -pylab is given, IPython loads special support for the mat- |
|
70 | If -pylab is given, IPython loads special support for the mat- | |
71 | plotlib library (http://matplotlib.sourceforge.net), allowing |
|
71 | plotlib library (http://matplotlib.sourceforge.net), allowing | |
72 | interactive usage of any of its backends as defined in the |
|
72 | interactive usage of any of its backends as defined in the | |
73 | user's .matplotlibrc file. It automatically activates GTK, QT |
|
73 | user's .matplotlibrc file. It automatically activates GTK, QT | |
74 | or WX threading for IPyhton if the choice of matplotlib backend |
|
74 | or WX threading for IPyhton if the choice of matplotlib backend | |
75 | requires it. It also modifies the %run command to correctly |
|
75 | requires it. It also modifies the %run command to correctly | |
76 | execute (without blocking) any matplotlib-based script which |
|
76 | execute (without blocking) any matplotlib-based script which | |
77 | calls show() at the end. |
|
77 | calls show() at the end. | |
78 |
|
78 | |||
79 | -tk The -g/q/wthread options, and -pylab (if matplotlib is |
|
79 | -tk The -g/q/wthread options, and -pylab (if matplotlib is | |
80 | configured to use GTK, QT or WX), will normally block Tk |
|
80 | configured to use GTK, QT or WX), will normally block Tk | |
81 | graphical interfaces. This means that when GTK, QT or WX |
|
81 | graphical interfaces. This means that when GTK, QT or WX | |
82 | threading is active, any attempt to open a Tk GUI will result in |
|
82 | threading is active, any attempt to open a Tk GUI will result in | |
83 | a dead window, and possibly cause the Python interpreter to |
|
83 | a dead window, and possibly cause the Python interpreter to | |
84 | crash. An extra option, -tk, is available to address this |
|
84 | crash. An extra option, -tk, is available to address this | |
85 | issue. It can ONLY be given as a SECOND option after any of the |
|
85 | issue. It can ONLY be given as a SECOND option after any of the | |
86 | above (-gthread, -qthread, -wthread or -pylab). |
|
86 | above (-gthread, -qthread, -wthread or -pylab). | |
87 |
|
87 | |||
88 | If -tk is given, IPython will try to coordinate Tk threading |
|
88 | If -tk is given, IPython will try to coordinate Tk threading | |
89 | with GTK, QT or WX. This is however potentially unreliable, and |
|
89 | with GTK, QT or WX. This is however potentially unreliable, and | |
90 | you will have to test on your platform and Python configuration |
|
90 | you will have to test on your platform and Python configuration | |
91 | to determine whether it works for you. Debian users have |
|
91 | to determine whether it works for you. Debian users have | |
92 | reported success, apparently due to the fact that Debian builds |
|
92 | reported success, apparently due to the fact that Debian builds | |
93 | all of Tcl, Tk, Tkinter and Python with pthreads support. Under |
|
93 | all of Tcl, Tk, Tkinter and Python with pthreads support. Under | |
94 | other Linux environments (such as Fedora Core 2/3), this option |
|
94 | other Linux environments (such as Fedora Core 2/3), this option | |
95 | has caused random crashes and lockups of the Python interpreter. |
|
95 | has caused random crashes and lockups of the Python interpreter. | |
96 | Under other operating systems (Mac OSX and Windows), you'll need |
|
96 | Under other operating systems (Mac OSX and Windows), you'll need | |
97 | to try it to find out, since currently no user reports are |
|
97 | to try it to find out, since currently no user reports are | |
98 | available. |
|
98 | available. | |
99 |
|
99 | |||
100 | There is unfortunately no way for IPython to determine at run- |
|
100 | There is unfortunately no way for IPython to determine at run- | |
101 | time whether -tk will work reliably or not, so you will need to |
|
101 | time whether -tk will work reliably or not, so you will need to | |
102 | do some experiments before relying on it for regular work. |
|
102 | do some experiments before relying on it for regular work. | |
103 |
|
103 | |||
104 | A WARNING ABOUT SIGNALS AND THREADS |
|
104 | A WARNING ABOUT SIGNALS AND THREADS | |
105 |
|
105 | |||
106 | When any of the thread systems (GTK, QT or WX) are active, either |
|
106 | When any of the thread systems (GTK, QT or WX) are active, either | |
107 | directly or via -pylab with a threaded backend, it is impossible to |
|
107 | directly or via -pylab with a threaded backend, it is impossible to | |
108 | interrupt long-running Python code via Ctrl-C. IPython can not pass |
|
108 | interrupt long-running Python code via Ctrl-C. IPython can not pass | |
109 | the KeyboardInterrupt exception (or the underlying SIGINT) across |
|
109 | the KeyboardInterrupt exception (or the underlying SIGINT) across | |
110 | threads, so any long-running process started from IPython will run to |
|
110 | threads, so any long-running process started from IPython will run to | |
111 | completion, or will have to be killed via an external (OS-based) |
|
111 | completion, or will have to be killed via an external (OS-based) | |
112 | mechanism. |
|
112 | mechanism. | |
113 |
|
113 | |||
114 | To the best of my knowledge, this limitation is imposed by the Python |
|
114 | To the best of my knowledge, this limitation is imposed by the Python | |
115 | interpreter itself, and it comes from the difficulty of writing |
|
115 | interpreter itself, and it comes from the difficulty of writing | |
116 | portable signal/threaded code. If any user is an expert on this topic |
|
116 | portable signal/threaded code. If any user is an expert on this topic | |
117 | and can suggest a better solution, I would love to hear about it. In |
|
117 | and can suggest a better solution, I would love to hear about it. In | |
118 | the IPython sources, look at the Shell.py module, and in particular at |
|
118 | the IPython sources, look at the Shell.py module, and in particular at | |
119 | the runcode() method. |
|
119 | the runcode() method. | |
120 |
|
120 | |||
121 | REGULAR OPTIONS |
|
121 | REGULAR OPTIONS | |
122 | After the above threading options have been given, regular options can |
|
122 | After the above threading options have been given, regular options can | |
123 | follow in any order. All options can be abbreviated to their shortest |
|
123 | follow in any order. All options can be abbreviated to their shortest | |
124 | non-ambiguous form and are case-sensitive. One or two dashes can be |
|
124 | non-ambiguous form and are case-sensitive. One or two dashes can be | |
125 | used. Some options have an alternate short form, indicated after a |. |
|
125 | used. Some options have an alternate short form, indicated after a |. | |
126 |
|
126 | |||
127 | Most options can also be set from your ipythonrc configuration file. |
|
127 | Most options can also be set from your ipythonrc configuration file. | |
128 | See the provided examples for assistance. Options given on the comman- |
|
128 | See the provided examples for assistance. Options given on the comman- | |
129 | dline override the values set in the ipythonrc file. |
|
129 | dline override the values set in the ipythonrc file. | |
130 |
|
130 | |||
131 |
All options with a |
|
131 | All options with a [no] prepended can be specified in negated form | |
132 | tion instead of -option) to turn the feature off. |
|
132 | (using -nooption instead of -option) to turn the feature off. | |
133 |
|
133 | |||
134 | -h, --help |
|
134 | -h, --help | |
135 | Show summary of options. |
|
135 | Show summary of options. | |
136 |
|
136 | |||
137 | -pylab This can only be given as the first option passed to IPython (it |
|
137 | -pylab This can only be given as the first option passed to IPython (it | |
138 | will have no effect in any other position). It adds special sup- |
|
138 | will have no effect in any other position). It adds special sup- | |
139 | port for the matplotlib library (http://matplotlib.source- |
|
139 | port for the matplotlib library (http://matplotlib.source- | |
140 | forge.net), allowing interactive usage of any of its backends as |
|
140 | forge.net), allowing interactive usage of any of its backends as | |
141 | defined in the userβs .matplotlibrc file. It automatically |
|
141 | defined in the userβs .matplotlibrc file. It automatically | |
142 | activates GTK or WX threading for IPyhton if the choice of mat- |
|
142 | activates GTK or WX threading for IPyhton if the choice of mat- | |
143 | plotlib backend requires it. It also modifies the @run command |
|
143 | plotlib backend requires it. It also modifies the @run command | |
144 | to correctly execute (without blocking) any matplotlib-based |
|
144 | to correctly execute (without blocking) any matplotlib-based | |
145 | script which calls show() at the end. |
|
145 | script which calls show() at the end. | |
146 |
|
146 | |||
147 |
- |
|
147 | -[no]autocall | |
148 | Make IPython automatically call any callable object even if you |
|
148 | Make IPython automatically call any callable object even if you | |
149 | didnβt type explicit parentheses. For example, βstr 43β becomes |
|
149 | didnβt type explicit parentheses. For example, βstr 43β becomes | |
150 | βstr(43)β automatically. |
|
150 | βstr(43)β automatically. | |
151 |
|
151 | |||
152 |
- |
|
152 | -[no]autoindent | |
153 | Turn automatic indentation on/off. |
|
153 | Turn automatic indentation on/off. | |
154 |
|
154 | |||
155 |
- |
|
155 | -[no]automagic | |
156 | Make magic commands automatic (without needing their first char- |
|
156 | Make magic commands automatic (without needing their first char- | |
157 | acter to be @). Type @magic at the IPython prompt for more |
|
157 | acter to be @). Type @magic at the IPython prompt for more | |
158 | information. |
|
158 | information. | |
159 |
|
159 | |||
160 |
- |
|
160 | -[no]autoparens | |
161 | Make IPython automatically call any callable object even if you |
|
161 | Make IPython automatically call any callable object even if you | |
162 | didnβt type explicit parentheses. For example, βstr 43β becomes |
|
162 | didnβt type explicit parentheses. For example, βstr 43β becomes | |
163 | βstr(43)β automatically. |
|
163 | βstr(43)β automatically. | |
164 |
|
164 | |||
165 |
- |
|
165 | -[no]banner | |
166 | Print the intial information banner (default on). |
|
166 | Print the intial information banner (default on). | |
167 |
|
167 | |||
168 | -c <command> |
|
168 | -c <command> | |
169 | Execute the given command string, and set sys.argv to [βcβ]. |
|
169 | Execute the given command string, and set sys.argv to [βcβ]. | |
170 | This is similar to the -c option in the normal Python inter- |
|
170 | This is similar to the -c option in the normal Python inter- | |
171 | preter. |
|
171 | preter. | |
172 |
|
172 | |||
173 | -cache_size|cs <n> |
|
173 | -cache_size|cs <n> | |
174 | Size of the output cache (maximum number of entries to hold in |
|
174 | Size of the output cache (maximum number of entries to hold in | |
175 | memory). The default is 1000, you can change it permanently in |
|
175 | memory). The default is 1000, you can change it permanently in | |
176 | your config file. Setting it to 0 completely disables the |
|
176 | your config file. Setting it to 0 completely disables the | |
177 | caching system, and the minimum value accepted is 20 (if you |
|
177 | caching system, and the minimum value accepted is 20 (if you | |
178 | provide a value less than 20, it is reset to 0 and a warning is |
|
178 | provide a value less than 20, it is reset to 0 and a warning is | |
179 | issued). This limit is defined because otherwise youβll spend |
|
179 | issued). This limit is defined because otherwise youβll spend | |
180 | more time re-flushing a too small cache than working. |
|
180 | more time re-flushing a too small cache than working. | |
181 |
|
181 | |||
182 | -classic|cl |
|
182 | -classic|cl | |
183 | Gives IPython a similar feel to the classic Python prompt. |
|
183 | Gives IPython a similar feel to the classic Python prompt. | |
184 |
|
184 | |||
185 | -colors <scheme> |
|
185 | -colors <scheme> | |
186 | Color scheme for prompts and exception reporting. Currently |
|
186 | Color scheme for prompts and exception reporting. Currently | |
187 | implemented: NoColor, Linux, and LightBG. |
|
187 | implemented: NoColor, Linux, and LightBG. | |
188 |
|
188 | |||
189 |
- |
|
189 | -[no]color_info | |
190 | IPython can display information about objects via a set of func- |
|
190 | IPython can display information about objects via a set of func- | |
191 | tions, and optionally can use colors for this, syntax highlight- |
|
191 | tions, and optionally can use colors for this, syntax highlight- | |
192 | ing source code and various other elements. However, because |
|
192 | ing source code and various other elements. However, because | |
193 | this information is passed through a pager (like βlessβ) and |
|
193 | this information is passed through a pager (like βlessβ) and | |
194 | many pagers get confused with color codes, this option is off by |
|
194 | many pagers get confused with color codes, this option is off by | |
195 | default. You can test it and turn it on permanently in your |
|
195 | default. You can test it and turn it on permanently in your | |
196 | ipythonrc file if it works for you. As a reference, the βlessβ |
|
196 | ipythonrc file if it works for you. As a reference, the βlessβ | |
197 | pager supplied with Mandrake 8.2 works ok, but that in RedHat |
|
197 | pager supplied with Mandrake 8.2 works ok, but that in RedHat | |
198 | 7.2 doesnβt. |
|
198 | 7.2 doesnβt. | |
199 |
|
199 | |||
200 | Test it and turn it on permanently if it works with your system. |
|
200 | Test it and turn it on permanently if it works with your system. | |
201 | The magic function @color_info allows you to toggle this inter- |
|
201 | The magic function @color_info allows you to toggle this inter- | |
202 | actively for testing. |
|
202 | actively for testing. | |
203 |
|
203 | |||
204 |
- |
|
204 | -[no]confirm_exit | |
205 | Set to confirm when you try to exit IPython with an EOF (Con- |
|
205 | Set to confirm when you try to exit IPython with an EOF (Con- | |
206 | trol-D in Unix, Control-Z/Enter in Windows). Note that using the |
|
206 | trol-D in Unix, Control-Z/Enter in Windows). Note that using the | |
207 | magic functions @Exit or @Quit you can force a direct exit, |
|
207 | magic functions @Exit or @Quit you can force a direct exit, | |
208 | bypassing any confirmation. |
|
208 | bypassing any confirmation. | |
209 |
|
209 | |||
210 |
- |
|
210 | -[no]debug | |
211 | Show information about the loading process. Very useful to pin |
|
211 | Show information about the loading process. Very useful to pin | |
212 | down problems with your configuration files or to get details |
|
212 | down problems with your configuration files or to get details | |
213 | about session restores. |
|
213 | about session restores. | |
214 |
|
214 | |||
215 |
- |
|
215 | -[no]deep_reload | |
216 | IPython can use the deep_reload module which reloads changes in |
|
216 | IPython can use the deep_reload module which reloads changes in | |
217 | modules recursively (it replaces the reload() function, so you |
|
217 | modules recursively (it replaces the reload() function, so you | |
218 | donβt need to change anything to use it). deep_reload() forces a |
|
218 | donβt need to change anything to use it). deep_reload() forces a | |
219 | full reload of modules whose code may have changed, which the |
|
219 | full reload of modules whose code may have changed, which the | |
220 | default reload() function does not. |
|
220 | default reload() function does not. | |
221 |
|
221 | |||
222 | When deep_reload is off, IPython will use the normal reload(), |
|
222 | When deep_reload is off, IPython will use the normal reload(), | |
223 | but deep_reload will still be available as dreload(). This fea- |
|
223 | but deep_reload will still be available as dreload(). This fea- | |
224 | ture is off by default [which means that you have both normal |
|
224 | ture is off by default [which means that you have both normal | |
225 | reload() and dreload()]. |
|
225 | reload() and dreload()]. | |
226 |
|
226 | |||
227 | -editor <name> |
|
227 | -editor <name> | |
228 | Which editor to use with the @edit command. By default, IPython |
|
228 | Which editor to use with the @edit command. By default, IPython | |
229 | will honor your EDITOR environment variable (if not set, vi is |
|
229 | will honor your EDITOR environment variable (if not set, vi is | |
230 | the Unix default and notepad the Windows one). Since this editor |
|
230 | the Unix default and notepad the Windows one). Since this editor | |
231 | is invoked on the fly by IPython and is meant for editing small |
|
231 | is invoked on the fly by IPython and is meant for editing small | |
232 | code snippets, you may want to use a small, lightweight editor |
|
232 | code snippets, you may want to use a small, lightweight editor | |
233 | here (in case your default EDITOR is something like Emacs). |
|
233 | here (in case your default EDITOR is something like Emacs). | |
234 |
|
234 | |||
235 | -ipythondir <name> |
|
235 | -ipythondir <name> | |
236 | The name of your IPython configuration directory IPYTHONDIR. |
|
236 | The name of your IPython configuration directory IPYTHONDIR. | |
237 | This can also be specified through the environment variable |
|
237 | This can also be specified through the environment variable | |
238 | IPYTHONDIR. |
|
238 | IPYTHONDIR. | |
239 |
|
239 | |||
240 | -log|l Generate a log file of all input. The file is named ipython.log |
|
240 | -log|l Generate a log file of all input. The file is named ipython.log | |
241 | in your current directory (which prevents logs from multiple |
|
241 | in your current directory (which prevents logs from multiple | |
242 | IPython sessions from trampling each other). You can use this to |
|
242 | IPython sessions from trampling each other). You can use this to | |
243 | later restore a session by loading your logfile as a file to be |
|
243 | later restore a session by loading your logfile as a file to be | |
244 | executed with option -logplay (see below). |
|
244 | executed with option -logplay (see below). | |
245 |
|
245 | |||
246 | -logfile|lf |
|
246 | -logfile|lf | |
247 | Specifu the name of your logfile. |
|
247 | Specifu the name of your logfile. | |
248 |
|
248 | |||
249 | -logplay|lp |
|
249 | -logplay|lp | |
250 | Replay a previous log. For restoring a session as close as pos- |
|
250 | Replay a previous log. For restoring a session as close as pos- | |
251 | sible to the state you left it in, use this option (donβt just |
|
251 | sible to the state you left it in, use this option (donβt just | |
252 | run the logfile). With -logplay, IPython will try to reconstruct |
|
252 | run the logfile). With -logplay, IPython will try to reconstruct | |
253 | the previous working environment in full, not just execute the |
|
253 | the previous working environment in full, not just execute the | |
254 | commands in the logfile. |
|
254 | commands in the logfile. | |
255 | When a session is restored, logging is automatically turned on |
|
255 | When a session is restored, logging is automatically turned on | |
256 | again with the name of the logfile it was invoked with (it is |
|
256 | again with the name of the logfile it was invoked with (it is | |
257 | read from the log header). So once youβve turned logging on for |
|
257 | read from the log header). So once youβve turned logging on for | |
258 | a session, you can quit IPython and reload it as many times as |
|
258 | a session, you can quit IPython and reload it as many times as | |
259 | you want and it will continue to log its history and restore |
|
259 | you want and it will continue to log its history and restore | |
260 | from the beginning every time. |
|
260 | from the beginning every time. | |
261 |
|
261 | |||
262 | Caveats: there are limitations in this option. The history vari- |
|
262 | Caveats: there are limitations in this option. The history vari- | |
263 | ables _i*,_* and _dh donβt get restored properly. In the future |
|
263 | ables _i*,_* and _dh donβt get restored properly. In the future | |
264 | we will try to implement full session saving by writing and |
|
264 | we will try to implement full session saving by writing and | |
265 | retrieving a failed because of inherent limitations of Pythonβs |
|
265 | retrieving a failed because of inherent limitations of Pythonβs | |
266 | Pickle module, so this may have to wait. |
|
266 | Pickle module, so this may have to wait. | |
267 |
|
267 | |||
268 |
- |
|
268 | -[no]messages | |
269 | Print messages which IPython collects about its startup process |
|
269 | Print messages which IPython collects about its startup process | |
270 | (default on). |
|
270 | (default on). | |
271 |
|
271 | |||
272 |
- |
|
272 | -[no]pdb | |
273 | Automatically call the pdb debugger after every uncaught excep- |
|
273 | Automatically call the pdb debugger after every uncaught excep- | |
274 | tion. If you are used to debugging using pdb, this puts you |
|
274 | tion. If you are used to debugging using pdb, this puts you | |
275 | automatically inside of it after any call (either in IPython or |
|
275 | automatically inside of it after any call (either in IPython or | |
276 | in code called by it) which triggers an exception which goes |
|
276 | in code called by it) which triggers an exception which goes | |
277 | uncaught. |
|
277 | uncaught. | |
278 |
|
278 | |||
279 |
- |
|
279 | -[no]pprint | |
280 | IPython can optionally use the pprint (pretty printer) module |
|
280 | IPython can optionally use the pprint (pretty printer) module | |
281 | for displaying results. pprint tends to give a nicer display of |
|
281 | for displaying results. pprint tends to give a nicer display of | |
282 | nested data structures. If you like it, you can turn it on per- |
|
282 | nested data structures. If you like it, you can turn it on per- | |
283 | manently in your config file (default off). |
|
283 | manently in your config file (default off). | |
284 |
|
284 | |||
285 | -profile|p <name> |
|
285 | -profile|p <name> | |
286 | Assume that your config file is ipythonrc-<name> (looks in cur- |
|
286 | Assume that your config file is ipythonrc-<name> (looks in cur- | |
287 | rent dir first, then in IPYTHONDIR). This is a quick way to keep |
|
287 | rent dir first, then in IPYTHONDIR). This is a quick way to keep | |
288 | and load multiple config files for different tasks, especially |
|
288 | and load multiple config files for different tasks, especially | |
289 | if you use the include option of config files. You can keep a |
|
289 | if you use the include option of config files. You can keep a | |
290 | basic IPYTHONDIR/ipythonrc file and then have other βprofilesβ |
|
290 | basic IPYTHONDIR/ipythonrc file and then have other βprofilesβ | |
291 | which include this one and load extra things for particular |
|
291 | which include this one and load extra things for particular | |
292 | tasks. For example: |
|
292 | tasks. For example: | |
293 |
|
293 | |||
294 | 1) $HOME/.ipython/ipythonrc : load basic things you always want. |
|
294 | 1) $HOME/.ipython/ipythonrc : load basic things you always want. | |
295 | 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math- |
|
295 | 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math- | |
296 | related modules. |
|
296 | related modules. | |
297 | 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and |
|
297 | 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and | |
298 | plotting modules. |
|
298 | plotting modules. | |
299 |
|
299 | |||
300 | Since it is possible to create an endless loop by having circu- |
|
300 | Since it is possible to create an endless loop by having circu- | |
301 | lar file inclusions, IPython will stop if it reaches 15 recur- |
|
301 | lar file inclusions, IPython will stop if it reaches 15 recur- | |
302 | sive inclusions. |
|
302 | sive inclusions. | |
303 |
|
303 | |||
304 | -prompt_in1|pi1 <string> |
|
304 | -prompt_in1|pi1 <string> | |
305 | Specify the string used for input prompts. Note that if you are |
|
305 | Specify the string used for input prompts. Note that if you are | |
306 | using numbered prompts, the number is represented with a β\#β in |
|
306 | using numbered prompts, the number is represented with a β\#β in | |
307 | the string. Donβt forget to quote strings with spaces embedded |
|
307 | the string. Donβt forget to quote strings with spaces embedded | |
308 | in them. Default: βIn [\#]:β. |
|
308 | in them. Default: βIn [\#]:β. | |
309 |
|
309 | |||
310 | Most bash-like escapes can be used to customize IPythonβs |
|
310 | Most bash-like escapes can be used to customize IPythonβs | |
311 | prompts, as well as a few additional ones which are IPython-spe- |
|
311 | prompts, as well as a few additional ones which are IPython-spe- | |
312 | cific. All valid prompt escapes are described in detail in the |
|
312 | cific. All valid prompt escapes are described in detail in the | |
313 | Customization section of the IPython HTML/PDF manual. |
|
313 | Customization section of the IPython HTML/PDF manual. | |
314 |
|
314 | |||
315 | -prompt_in2|pi2 <string> |
|
315 | -prompt_in2|pi2 <string> | |
316 | Similar to the previous option, but used for the continuation |
|
316 | Similar to the previous option, but used for the continuation | |
317 | prompts. The special sequence β\Dβ is similar to β\#β, but with |
|
317 | prompts. The special sequence β\Dβ is similar to β\#β, but with | |
318 | all digits replaced dots (so you can have your continuation |
|
318 | all digits replaced dots (so you can have your continuation | |
319 | prompt aligned with your input prompt). Default: β .\D.:β |
|
319 | prompt aligned with your input prompt). Default: β .\D.:β | |
320 | (note three spaces at the start for alignment with βIn [\#]β). |
|
320 | (note three spaces at the start for alignment with βIn [\#]β). | |
321 |
|
321 | |||
322 | -prompt_out|po <string> |
|
322 | -prompt_out|po <string> | |
323 | String used for output prompts, also uses numbers like |
|
323 | String used for output prompts, also uses numbers like | |
324 | prompt_in1. Default: βOut[\#]:β. |
|
324 | prompt_in1. Default: βOut[\#]:β. | |
325 |
|
325 | |||
326 | -quick Start in bare bones mode (no config file loaded). |
|
326 | -quick Start in bare bones mode (no config file loaded). | |
327 |
|
327 | |||
328 | -rcfile <name> |
|
328 | -rcfile <name> | |
329 | Name of your IPython resource configuration file. normally |
|
329 | Name of your IPython resource configuration file. normally | |
330 | IPython loads ipythonrc (from current directory) or |
|
330 | IPython loads ipythonrc (from current directory) or | |
331 | IPYTHONDIR/ipythonrc. If the loading of your config file fails, |
|
331 | IPYTHONDIR/ipythonrc. If the loading of your config file fails, | |
332 | IPython starts with a bare bones configuration (no modules |
|
332 | IPython starts with a bare bones configuration (no modules | |
333 | loaded at all). |
|
333 | loaded at all). | |
334 |
|
334 | |||
335 |
- |
|
335 | -[no]readline | |
336 | Use the readline library, which is needed to support name com- |
|
336 | Use the readline library, which is needed to support name com- | |
337 | pletion and command history, among other things. It is enabled |
|
337 | pletion and command history, among other things. It is enabled | |
338 | by default, but may cause problems for users of X/Emacs in |
|
338 | by default, but may cause problems for users of X/Emacs in | |
339 | Python comint or shell buffers. |
|
339 | Python comint or shell buffers. | |
340 |
|
340 | |||
341 | Note that emacs βetermβ buffers (opened with M-x term) support |
|
341 | Note that emacs βetermβ buffers (opened with M-x term) support | |
342 | IPythonβs readline and syntax coloring fine, only βemacsβ (M-x |
|
342 | IPythonβs readline and syntax coloring fine, only βemacsβ (M-x | |
343 | shell and C-c !) buffers do not. |
|
343 | shell and C-c !) buffers do not. | |
344 |
|
344 | |||
345 | -screen_length|sl <n> |
|
345 | -screen_length|sl <n> | |
346 | Number of lines of your screen. This is used to control print- |
|
346 | Number of lines of your screen. This is used to control print- | |
347 | ing of very long strings. Strings longer than this number of |
|
347 | ing of very long strings. Strings longer than this number of | |
348 | lines will be sent through a pager instead of directly printed. |
|
348 | lines will be sent through a pager instead of directly printed. | |
349 |
|
349 | |||
350 | The default value for this is 0, which means IPython will auto- |
|
350 | The default value for this is 0, which means IPython will auto- | |
351 | detect your screen size every time it needs to print certain |
|
351 | detect your screen size every time it needs to print certain | |
352 | potentially long strings (this doesnβt change the behavior of |
|
352 | potentially long strings (this doesnβt change the behavior of | |
353 | the βprintβ keyword, itβs only triggered internally). If for |
|
353 | the βprintβ keyword, itβs only triggered internally). If for | |
354 | some reason this isnβt working well (it needs curses support), |
|
354 | some reason this isnβt working well (it needs curses support), | |
355 | specify it yourself. Otherwise donβt change the default. |
|
355 | specify it yourself. Otherwise donβt change the default. | |
356 |
|
356 | |||
357 | -separate_in|si <string> |
|
357 | -separate_in|si <string> | |
358 | Separator before input prompts. Default β0. |
|
358 | Separator before input prompts. Default β0. | |
359 |
|
359 | |||
360 | -separate_out|so <string> |
|
360 | -separate_out|so <string> | |
361 | Separator before output prompts. Default: 0 (nothing). |
|
361 | Separator before output prompts. Default: 0 (nothing). | |
362 |
|
362 | |||
363 | -separate_out2|so2 <string> |
|
363 | -separate_out2|so2 <string> | |
364 | Separator after output prompts. Default: 0 (nothing). |
|
364 | Separator after output prompts. Default: 0 (nothing). | |
365 |
|
365 | |||
366 | -nosep Shorthand for β-separate_in 0 -separate_out 0 -separate_out2 0β. |
|
366 | -nosep Shorthand for β-separate_in 0 -separate_out 0 -separate_out2 0β. | |
367 | Simply removes all input/output separators. |
|
367 | Simply removes all input/output separators. | |
368 |
|
368 | |||
369 | -upgrade |
|
369 | -upgrade | |
370 | Allows you to upgrade your IPYTHONDIR configuration when you |
|
370 | Allows you to upgrade your IPYTHONDIR configuration when you | |
371 | install a new version of IPython. Since new versions may |
|
371 | install a new version of IPython. Since new versions may | |
372 | include new command lines options or example files, this copies |
|
372 | include new command lines options or example files, this copies | |
373 | updated ipythonrc-type files. However, it backs up (with a .old |
|
373 | updated ipythonrc-type files. However, it backs up (with a .old | |
374 | extension) all files which it overwrites so that you can merge |
|
374 | extension) all files which it overwrites so that you can merge | |
375 | back any custimizations you might have in your personal files. |
|
375 | back any custimizations you might have in your personal files. | |
376 |
|
376 | |||
377 | -Version |
|
377 | -Version | |
378 | Print version information and exit. |
|
378 | Print version information and exit. | |
379 |
|
379 | |||
380 | -xmode <modename> |
|
380 | -xmode <modename> | |
381 | Mode for exception reporting. The valid modes are Plain, Con- |
|
381 | Mode for exception reporting. The valid modes are Plain, Con- | |
382 | text, and Verbose. |
|
382 | text, and Verbose. | |
383 |
|
383 | |||
384 | - Plain: similar to pythonβs normal traceback printing. |
|
384 | - Plain: similar to pythonβs normal traceback printing. | |
385 |
|
385 | |||
386 | - Context: prints 5 lines of context source code around each |
|
386 | - Context: prints 5 lines of context source code around each | |
387 | line in the traceback. |
|
387 | line in the traceback. | |
388 |
|
388 | |||
389 | - Verbose: similar to Context, but additionally prints the vari- |
|
389 | - Verbose: similar to Context, but additionally prints the vari- | |
390 | ables currently visible where the exception happened (shortening |
|
390 | ables currently visible where the exception happened (shortening | |
391 | their strings if too long). This can potentially be very slow, |
|
391 | their strings if too long). This can potentially be very slow, | |
392 | if you happen to have a huge data structure whose string repre- |
|
392 | if you happen to have a huge data structure whose string repre- | |
393 | sentation is complex to compute. Your computer may appear to |
|
393 | sentation is complex to compute. Your computer may appear to | |
394 | freeze for a while with cpu usage at 100%. If this occurs, you |
|
394 | freeze for a while with cpu usage at 100%. If this occurs, you | |
395 | can cancel the traceback with Ctrl-C (maybe hitting it more than |
|
395 | can cancel the traceback with Ctrl-C (maybe hitting it more than | |
396 | once). |
|
396 | once). | |
397 |
|
397 | |||
398 |
|
398 | |||
399 | EMBEDDING |
|
399 | EMBEDDING | |
400 | It is possible to start an IPython instance inside your own Python pro- |
|
400 | It is possible to start an IPython instance inside your own Python pro- | |
401 | grams. In the documentation example files there are some illustrations |
|
401 | grams. In the documentation example files there are some illustrations | |
402 | on how to do this. |
|
402 | on how to do this. | |
403 |
|
403 | |||
404 | This feature allows you to evalutate dynamically the state of your |
|
404 | This feature allows you to evalutate dynamically the state of your | |
405 | code, operate with your variables, analyze them, etc. Note however |
|
405 | code, operate with your variables, analyze them, etc. Note however | |
406 | that any changes you make to values while in the shell do NOT propagate |
|
406 | that any changes you make to values while in the shell do NOT propagate | |
407 | back to the running code, so it is safe to modify your values because |
|
407 | back to the running code, so it is safe to modify your values because | |
408 | you wonβt break your code in bizarre ways by doing so. |
|
408 | you wonβt break your code in bizarre ways by doing so. | |
409 | """ |
|
409 | """ | |
410 |
|
410 | |||
411 | cmd_line_usage = __doc__ |
|
411 | cmd_line_usage = __doc__ | |
412 |
|
412 | |||
413 | #--------------------------------------------------------------------------- |
|
413 | #--------------------------------------------------------------------------- | |
414 | interactive_usage = """ |
|
414 | interactive_usage = """ | |
415 | IPython -- An enhanced Interactive Python |
|
415 | IPython -- An enhanced Interactive Python | |
416 | ========================================= |
|
416 | ========================================= | |
417 |
|
417 | |||
418 | IPython offers a combination of convenient shell features, special commands |
|
418 | IPython offers a combination of convenient shell features, special commands | |
419 | and a history mechanism for both input (command history) and output (results |
|
419 | and a history mechanism for both input (command history) and output (results | |
420 | caching, similar to Mathematica). It is intended to be a fully compatible |
|
420 | caching, similar to Mathematica). It is intended to be a fully compatible | |
421 | replacement for the standard Python interpreter, while offering vastly |
|
421 | replacement for the standard Python interpreter, while offering vastly | |
422 | improved functionality and flexibility. |
|
422 | improved functionality and flexibility. | |
423 |
|
423 | |||
424 | At your system command line, type 'ipython -help' to see the command line |
|
424 | At your system command line, type 'ipython -help' to see the command line | |
425 | options available. This document only describes interactive features. |
|
425 | options available. This document only describes interactive features. | |
426 |
|
426 | |||
427 | Warning: IPython relies on the existence of a global variable called __IP which |
|
427 | Warning: IPython relies on the existence of a global variable called __IP which | |
428 | controls the shell itself. If you redefine __IP to anything, bizarre behavior |
|
428 | controls the shell itself. If you redefine __IP to anything, bizarre behavior | |
429 | will quickly occur. |
|
429 | will quickly occur. | |
430 |
|
430 | |||
431 | MAIN FEATURES |
|
431 | MAIN FEATURES | |
432 |
|
432 | |||
433 | * Access to the standard Python help. As of Python 2.1, a help system is |
|
433 | * Access to the standard Python help. As of Python 2.1, a help system is | |
434 | available with access to object docstrings and the Python manuals. Simply |
|
434 | available with access to object docstrings and the Python manuals. Simply | |
435 | type 'help' (no quotes) to access it. |
|
435 | type 'help' (no quotes) to access it. | |
436 |
|
436 | |||
437 | * Magic commands: type %magic for information on the magic subsystem. |
|
437 | * Magic commands: type %magic for information on the magic subsystem. | |
438 |
|
438 | |||
439 | * System command aliases, via the %alias command or the ipythonrc config file. |
|
439 | * System command aliases, via the %alias command or the ipythonrc config file. | |
440 |
|
440 | |||
441 | * Dynamic object information: |
|
441 | * Dynamic object information: | |
442 |
|
442 | |||
443 | Typing ?word or word? prints detailed information about an object. If |
|
443 | Typing ?word or word? prints detailed information about an object. If | |
444 | certain strings in the object are too long (docstrings, code, etc.) they get |
|
444 | certain strings in the object are too long (docstrings, code, etc.) they get | |
445 | snipped in the center for brevity. |
|
445 | snipped in the center for brevity. | |
446 |
|
446 | |||
447 | Typing ??word or word?? gives access to the full information without |
|
447 | Typing ??word or word?? gives access to the full information without | |
448 | snipping long strings. Long strings are sent to the screen through the less |
|
448 | snipping long strings. Long strings are sent to the screen through the less | |
449 | pager if longer than the screen, printed otherwise. |
|
449 | pager if longer than the screen, printed otherwise. | |
450 |
|
450 | |||
451 | The ?/?? system gives access to the full source code for any object (if |
|
451 | The ?/?? system gives access to the full source code for any object (if | |
452 | available), shows function prototypes and other useful information. |
|
452 | available), shows function prototypes and other useful information. | |
453 |
|
453 | |||
454 | If you just want to see an object's docstring, type '%pdoc object' (without |
|
454 | If you just want to see an object's docstring, type '%pdoc object' (without | |
455 | quotes, and without % if you have automagic on). |
|
455 | quotes, and without % if you have automagic on). | |
456 |
|
456 | |||
457 | Both %pdoc and ?/?? give you access to documentation even on things which are |
|
457 | Both %pdoc and ?/?? give you access to documentation even on things which are | |
458 | not explicitely defined. Try for example typing {}.get? or after import os, |
|
458 | not explicitely defined. Try for example typing {}.get? or after import os, | |
459 | type os.path.abspath??. The magic functions %pdef, %source and %file operate |
|
459 | type os.path.abspath??. The magic functions %pdef, %source and %file operate | |
460 | similarly. |
|
460 | similarly. | |
461 |
|
461 | |||
462 | * Completion in the local namespace, by typing TAB at the prompt. |
|
462 | * Completion in the local namespace, by typing TAB at the prompt. | |
463 |
|
463 | |||
464 | At any time, hitting tab will complete any available python commands or |
|
464 | At any time, hitting tab will complete any available python commands or | |
465 | variable names, and show you a list of the possible completions if there's |
|
465 | variable names, and show you a list of the possible completions if there's | |
466 | no unambiguous one. It will also complete filenames in the current directory. |
|
466 | no unambiguous one. It will also complete filenames in the current directory. | |
467 |
|
467 | |||
468 | This feature requires the readline and rlcomplete modules, so it won't work |
|
468 | This feature requires the readline and rlcomplete modules, so it won't work | |
469 | if your Python lacks readline support (such as under Windows). |
|
469 | if your Python lacks readline support (such as under Windows). | |
470 |
|
470 | |||
471 | * Search previous command history in two ways (also requires readline): |
|
471 | * Search previous command history in two ways (also requires readline): | |
472 |
|
472 | |||
473 | - Start typing, and then use Ctrl-p (previous,up) and Ctrl-n (next,down) to |
|
473 | - Start typing, and then use Ctrl-p (previous,up) and Ctrl-n (next,down) to | |
474 | search through only the history items that match what you've typed so |
|
474 | search through only the history items that match what you've typed so | |
475 | far. If you use Ctrl-p/Ctrl-n at a blank prompt, they just behave like |
|
475 | far. If you use Ctrl-p/Ctrl-n at a blank prompt, they just behave like | |
476 | normal arrow keys. |
|
476 | normal arrow keys. | |
477 |
|
477 | |||
478 | - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches |
|
478 | - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches | |
479 | your history for lines that match what you've typed so far, completing as |
|
479 | your history for lines that match what you've typed so far, completing as | |
480 | much as it can. |
|
480 | much as it can. | |
481 |
|
481 | |||
482 | * Persistent command history across sessions (readline required). |
|
482 | * Persistent command history across sessions (readline required). | |
483 |
|
483 | |||
484 | * Logging of input with the ability to save and restore a working session. |
|
484 | * Logging of input with the ability to save and restore a working session. | |
485 |
|
485 | |||
486 | * System escape with !. Typing !ls will run 'ls' in the current directory. |
|
486 | * System escape with !. Typing !ls will run 'ls' in the current directory. | |
487 |
|
487 | |||
488 | * The reload command does a 'deep' reload of a module: changes made to the |
|
488 | * The reload command does a 'deep' reload of a module: changes made to the | |
489 | module since you imported will actually be available without having to exit. |
|
489 | module since you imported will actually be available without having to exit. | |
490 |
|
490 | |||
491 | * Verbose and colored exception traceback printouts. See the magic xmode and |
|
491 | * Verbose and colored exception traceback printouts. See the magic xmode and | |
492 | xcolor functions for details (just type %magic). |
|
492 | xcolor functions for details (just type %magic). | |
493 |
|
493 | |||
494 | * Input caching system: |
|
494 | * Input caching system: | |
495 |
|
495 | |||
496 | IPython offers numbered prompts (In/Out) with input and output caching. All |
|
496 | IPython offers numbered prompts (In/Out) with input and output caching. All | |
497 | input is saved and can be retrieved as variables (besides the usual arrow |
|
497 | input is saved and can be retrieved as variables (besides the usual arrow | |
498 | key recall). |
|
498 | key recall). | |
499 |
|
499 | |||
500 | The following GLOBAL variables always exist (so don't overwrite them!): |
|
500 | The following GLOBAL variables always exist (so don't overwrite them!): | |
501 | _i: stores previous input. |
|
501 | _i: stores previous input. | |
502 | _ii: next previous. |
|
502 | _ii: next previous. | |
503 | _iii: next-next previous. |
|
503 | _iii: next-next previous. | |
504 | _ih : a list of all input _ih[n] is the input from line n. |
|
504 | _ih : a list of all input _ih[n] is the input from line n. | |
505 |
|
505 | |||
506 | Additionally, global variables named _i<n> are dynamically created (<n> |
|
506 | Additionally, global variables named _i<n> are dynamically created (<n> | |
507 | being the prompt counter), such that _i<n> == _ih[<n>] |
|
507 | being the prompt counter), such that _i<n> == _ih[<n>] | |
508 |
|
508 | |||
509 | For example, what you typed at prompt 14 is available as _i14 and _ih[14]. |
|
509 | For example, what you typed at prompt 14 is available as _i14 and _ih[14]. | |
510 |
|
510 | |||
511 | You can create macros which contain multiple input lines from this history, |
|
511 | You can create macros which contain multiple input lines from this history, | |
512 | for later re-execution, with the %macro function. |
|
512 | for later re-execution, with the %macro function. | |
513 |
|
513 | |||
514 | The history function %hist allows you to see any part of your input history |
|
514 | The history function %hist allows you to see any part of your input history | |
515 | by printing a range of the _i variables. Note that inputs which contain |
|
515 | by printing a range of the _i variables. Note that inputs which contain | |
516 | magic functions (%) appear in the history with a prepended comment. This is |
|
516 | magic functions (%) appear in the history with a prepended comment. This is | |
517 | because they aren't really valid Python code, so you can't exec them. |
|
517 | because they aren't really valid Python code, so you can't exec them. | |
518 |
|
518 | |||
519 | * Output caching system: |
|
519 | * Output caching system: | |
520 |
|
520 | |||
521 | For output that is returned from actions, a system similar to the input |
|
521 | For output that is returned from actions, a system similar to the input | |
522 | cache exists but using _ instead of _i. Only actions that produce a result |
|
522 | cache exists but using _ instead of _i. Only actions that produce a result | |
523 | (NOT assignments, for example) are cached. If you are familiar with |
|
523 | (NOT assignments, for example) are cached. If you are familiar with | |
524 | Mathematica, IPython's _ variables behave exactly like Mathematica's % |
|
524 | Mathematica, IPython's _ variables behave exactly like Mathematica's % | |
525 | variables. |
|
525 | variables. | |
526 |
|
526 | |||
527 | The following GLOBAL variables always exist (so don't overwrite them!): |
|
527 | The following GLOBAL variables always exist (so don't overwrite them!): | |
528 | _ (one underscore): previous output. |
|
528 | _ (one underscore): previous output. | |
529 | __ (two underscores): next previous. |
|
529 | __ (two underscores): next previous. | |
530 | ___ (three underscores): next-next previous. |
|
530 | ___ (three underscores): next-next previous. | |
531 |
|
531 | |||
532 | Global variables named _<n> are dynamically created (<n> being the prompt |
|
532 | Global variables named _<n> are dynamically created (<n> being the prompt | |
533 | counter), such that the result of output <n> is always available as _<n>. |
|
533 | counter), such that the result of output <n> is always available as _<n>. | |
534 |
|
534 | |||
535 | Finally, a global dictionary named _oh exists with entries for all lines |
|
535 | Finally, a global dictionary named _oh exists with entries for all lines | |
536 | which generated output. |
|
536 | which generated output. | |
537 |
|
537 | |||
538 | * Directory history: |
|
538 | * Directory history: | |
539 |
|
539 | |||
540 | Your history of visited directories is kept in the global list _dh, and the |
|
540 | Your history of visited directories is kept in the global list _dh, and the | |
541 | magic %cd command can be used to go to any entry in that list. |
|
541 | magic %cd command can be used to go to any entry in that list. | |
542 |
|
542 | |||
543 | * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython) |
|
543 | * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython) | |
544 |
|
544 | |||
545 | 1. Auto-parentheses |
|
545 | 1. Auto-parentheses | |
546 | Callable objects (i.e. functions, methods, etc) can be invoked like |
|
546 | Callable objects (i.e. functions, methods, etc) can be invoked like | |
547 | this (notice the commas between the arguments): |
|
547 | this (notice the commas between the arguments): | |
548 | >>> callable_ob arg1, arg2, arg3 |
|
548 | >>> callable_ob arg1, arg2, arg3 | |
549 | and the input will be translated to this: |
|
549 | and the input will be translated to this: | |
550 | --> callable_ob(arg1, arg2, arg3) |
|
550 | --> callable_ob(arg1, arg2, arg3) | |
551 | You can force auto-parentheses by using '/' as the first character |
|
551 | You can force auto-parentheses by using '/' as the first character | |
552 | of a line. For example: |
|
552 | of a line. For example: | |
553 | >>> /globals # becomes 'globals()' |
|
553 | >>> /globals # becomes 'globals()' | |
554 | Note that the '/' MUST be the first character on the line! This |
|
554 | Note that the '/' MUST be the first character on the line! This | |
555 | won't work: |
|
555 | won't work: | |
556 | >>> print /globals # syntax error |
|
556 | >>> print /globals # syntax error | |
557 |
|
557 | |||
558 | In most cases the automatic algorithm should work, so you should |
|
558 | In most cases the automatic algorithm should work, so you should | |
559 | rarely need to explicitly invoke /. One notable exception is if you |
|
559 | rarely need to explicitly invoke /. One notable exception is if you | |
560 | are trying to call a function with a list of tuples as arguments (the |
|
560 | are trying to call a function with a list of tuples as arguments (the | |
561 | parenthesis will confuse IPython): |
|
561 | parenthesis will confuse IPython): | |
562 | In [1]: zip (1,2,3),(4,5,6) # won't work |
|
562 | In [1]: zip (1,2,3),(4,5,6) # won't work | |
563 | but this will work: |
|
563 | but this will work: | |
564 | In [2]: /zip (1,2,3),(4,5,6) |
|
564 | In [2]: /zip (1,2,3),(4,5,6) | |
565 | ------> zip ((1,2,3),(4,5,6)) |
|
565 | ------> zip ((1,2,3),(4,5,6)) | |
566 | Out[2]= [(1, 4), (2, 5), (3, 6)] |
|
566 | Out[2]= [(1, 4), (2, 5), (3, 6)] | |
567 |
|
567 | |||
568 | IPython tells you that it has altered your command line by |
|
568 | IPython tells you that it has altered your command line by | |
569 | displaying the new command line preceded by -->. e.g.: |
|
569 | displaying the new command line preceded by -->. e.g.: | |
570 | In [18]: callable list |
|
570 | In [18]: callable list | |
571 | -------> callable (list) |
|
571 | -------> callable (list) | |
572 |
|
572 | |||
573 | 2. Auto-Quoting |
|
573 | 2. Auto-Quoting | |
574 | You can force auto-quoting of a function's arguments by using ',' as |
|
574 | You can force auto-quoting of a function's arguments by using ',' as | |
575 | the first character of a line. For example: |
|
575 | the first character of a line. For example: | |
576 | >>> ,my_function /home/me # becomes my_function("/home/me") |
|
576 | >>> ,my_function /home/me # becomes my_function("/home/me") | |
577 |
|
577 | |||
578 | If you use ';' instead, the whole argument is quoted as a single |
|
578 | If you use ';' instead, the whole argument is quoted as a single | |
579 | string (while ',' splits on whitespace): |
|
579 | string (while ',' splits on whitespace): | |
580 | >>> ,my_function a b c # becomes my_function("a","b","c") |
|
580 | >>> ,my_function a b c # becomes my_function("a","b","c") | |
581 | >>> ;my_function a b c # becomes my_function("a b c") |
|
581 | >>> ;my_function a b c # becomes my_function("a b c") | |
582 |
|
582 | |||
583 | Note that the ',' MUST be the first character on the line! This |
|
583 | Note that the ',' MUST be the first character on the line! This | |
584 | won't work: |
|
584 | won't work: | |
585 | >>> x = ,my_function /home/me # syntax error |
|
585 | >>> x = ,my_function /home/me # syntax error | |
586 | """ |
|
586 | """ |
@@ -1,392 +1,392 b'' | |||||
1 | .\" Hey, EMACS: -*- nroff -*- |
|
1 | .\" Hey, EMACS: -*- nroff -*- | |
2 | .\" First parameter, NAME, should be all caps |
|
2 | .\" First parameter, NAME, should be all caps | |
3 | .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection |
|
3 | .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection | |
4 | .\" other parameters are allowed: see man(7), man(1) |
|
4 | .\" other parameters are allowed: see man(7), man(1) | |
5 | .TH IPYTHON 1 "November 30, 2004" |
|
5 | .TH IPYTHON 1 "November 30, 2004" | |
6 | .\" Please adjust this date whenever revising the manpage. |
|
6 | .\" Please adjust this date whenever revising the manpage. | |
7 | .\" |
|
7 | .\" | |
8 | .\" Some roff macros, for reference: |
|
8 | .\" Some roff macros, for reference: | |
9 | .\" .nh disable hyphenation |
|
9 | .\" .nh disable hyphenation | |
10 | .\" .hy enable hyphenation |
|
10 | .\" .hy enable hyphenation | |
11 | .\" .ad l left justify |
|
11 | .\" .ad l left justify | |
12 | .\" .ad b justify to both left and right margins |
|
12 | .\" .ad b justify to both left and right margins | |
13 | .\" .nf disable filling |
|
13 | .\" .nf disable filling | |
14 | .\" .fi enable filling |
|
14 | .\" .fi enable filling | |
15 | .\" .br insert line break |
|
15 | .\" .br insert line break | |
16 | .\" .sp <n> insert n+1 empty lines |
|
16 | .\" .sp <n> insert n+1 empty lines | |
17 | .\" for manpage-specific macros, see man(7) and groff_man(7) |
|
17 | .\" for manpage-specific macros, see man(7) and groff_man(7) | |
18 | .\" .SH section heading |
|
18 | .\" .SH section heading | |
19 | .\" .SS secondary section heading |
|
19 | .\" .SS secondary section heading | |
20 | .\" |
|
20 | .\" | |
21 | .\" |
|
21 | .\" | |
22 | .\" To preview this page as plain text: nroff -man ipython.1 |
|
22 | .\" To preview this page as plain text: nroff -man ipython.1 | |
23 | .\" |
|
23 | .\" | |
24 | .SH NAME |
|
24 | .SH NAME | |
25 | ipython \- An Enhanced Interactive Python |
|
25 | ipython \- An Enhanced Interactive Python | |
26 | .SH SYNOPSIS |
|
26 | .SH SYNOPSIS | |
27 | .B ipython |
|
27 | .B ipython | |
28 | .RI [ options ] " files" ... |
|
28 | .RI [ options ] " files" ... | |
29 | .SH DESCRIPTION |
|
29 | .SH DESCRIPTION | |
30 | An interactive Python shell with automatic history (input and output), |
|
30 | An interactive Python shell with automatic history (input and output), | |
31 | dynamic object introspection, easier configuration, command |
|
31 | dynamic object introspection, easier configuration, command | |
32 | completion, access to the system shell, integration with numerical and |
|
32 | completion, access to the system shell, integration with numerical and | |
33 | scientific computing tools, and more. |
|
33 | scientific computing tools, and more. | |
34 | .SH SPECIAL THREADING OPTIONS |
|
34 | .SH SPECIAL THREADING OPTIONS | |
35 | The following special options are ONLY valid at the beginning of the command |
|
35 | The following special options are ONLY valid at the beginning of the command | |
36 | line, and not later. This is because they control the initialization of |
|
36 | line, and not later. This is because they control the initialization of | |
37 | ipython itself, before the normal option-handling mechanism is active. |
|
37 | ipython itself, before the normal option-handling mechanism is active. | |
38 | .TP |
|
38 | .TP | |
39 | .B \-gthread, \-qthread, \-wthread, \-pylab |
|
39 | .B \-gthread, \-qthread, \-wthread, \-pylab | |
40 | Only ONE of these can be given, and it can only be given as the first option |
|
40 | Only ONE of these can be given, and it can only be given as the first option | |
41 | passed to IPython (it will have no effect in any other position). They |
|
41 | passed to IPython (it will have no effect in any other position). They | |
42 | provide threading support for the GTK, QT and WXWidgets toolkits, and for the |
|
42 | provide threading support for the GTK, QT and WXWidgets toolkits, and for the | |
43 | matplotlib library. |
|
43 | matplotlib library. | |
44 | .br |
|
44 | .br | |
45 | .sp 1 |
|
45 | .sp 1 | |
46 | With any of the first three options, IPython starts running a separate thread |
|
46 | With any of the first three options, IPython starts running a separate thread | |
47 | for the graphical toolkit's operation, so that you can open and control |
|
47 | for the graphical toolkit's operation, so that you can open and control | |
48 | graphical elements from within an IPython command line, without blocking. All |
|
48 | graphical elements from within an IPython command line, without blocking. All | |
49 | three provide essentially the same functionality, respectively for GTK, QT and |
|
49 | three provide essentially the same functionality, respectively for GTK, QT and | |
50 | WXWidgets (via their Python interfaces). |
|
50 | WXWidgets (via their Python interfaces). | |
51 | .br |
|
51 | .br | |
52 | .sp 1 |
|
52 | .sp 1 | |
53 | If \-pylab is given, IPython loads special support for the matplotlib library |
|
53 | If \-pylab is given, IPython loads special support for the matplotlib library | |
54 | (http://matplotlib.sourceforge.net), allowing interactive usage of any of its |
|
54 | (http://matplotlib.sourceforge.net), allowing interactive usage of any of its | |
55 | backends as defined in the user's .matplotlibrc file. It automatically |
|
55 | backends as defined in the user's .matplotlibrc file. It automatically | |
56 | activates GTK, QT or WX threading for IPyhton if the choice of matplotlib |
|
56 | activates GTK, QT or WX threading for IPyhton if the choice of matplotlib | |
57 | backend requires it. It also modifies the %run command to correctly execute |
|
57 | backend requires it. It also modifies the %run command to correctly execute | |
58 | (without blocking) any matplotlib-based script which calls show() at the end. |
|
58 | (without blocking) any matplotlib-based script which calls show() at the end. | |
59 | .TP |
|
59 | .TP | |
60 | .B \-tk |
|
60 | .B \-tk | |
61 | The \-g/q/wthread options, and \-pylab (if matplotlib is configured to use |
|
61 | The \-g/q/wthread options, and \-pylab (if matplotlib is configured to use | |
62 | GTK, QT or WX), will normally block Tk graphical interfaces. This means that |
|
62 | GTK, QT or WX), will normally block Tk graphical interfaces. This means that | |
63 | when GTK, QT or WX threading is active, any attempt to open a Tk GUI will |
|
63 | when GTK, QT or WX threading is active, any attempt to open a Tk GUI will | |
64 | result in a dead window, and possibly cause the Python interpreter to crash. |
|
64 | result in a dead window, and possibly cause the Python interpreter to crash. | |
65 | An extra option, \-tk, is available to address this issue. It can ONLY be |
|
65 | An extra option, \-tk, is available to address this issue. It can ONLY be | |
66 | given as a SECOND option after any of the above (\-gthread, \-qthread, |
|
66 | given as a SECOND option after any of the above (\-gthread, \-qthread, | |
67 | \-wthread or \-pylab). |
|
67 | \-wthread or \-pylab). | |
68 | .br |
|
68 | .br | |
69 | .sp 1 |
|
69 | .sp 1 | |
70 | If \-tk is given, IPython will try to coordinate Tk threading with GTK, QT or |
|
70 | If \-tk is given, IPython will try to coordinate Tk threading with GTK, QT or | |
71 | WX. This is however potentially unreliable, and you will have to test on your |
|
71 | WX. This is however potentially unreliable, and you will have to test on your | |
72 | platform and Python configuration to determine whether it works for you. |
|
72 | platform and Python configuration to determine whether it works for you. | |
73 | Debian users have reported success, apparently due to the fact that Debian |
|
73 | Debian users have reported success, apparently due to the fact that Debian | |
74 | builds all of Tcl, Tk, Tkinter and Python with pthreads support. Under other |
|
74 | builds all of Tcl, Tk, Tkinter and Python with pthreads support. Under other | |
75 | Linux environments (such as Fedora Core 2), this option has caused random |
|
75 | Linux environments (such as Fedora Core 2), this option has caused random | |
76 | crashes and lockups of the Python interpreter. Under other operating systems |
|
76 | crashes and lockups of the Python interpreter. Under other operating systems | |
77 | (Mac OSX and Windows), you'll need to try it to find out, since currently no |
|
77 | (Mac OSX and Windows), you'll need to try it to find out, since currently no | |
78 | user reports are available. |
|
78 | user reports are available. | |
79 | .br |
|
79 | .br | |
80 | .sp 1 |
|
80 | .sp 1 | |
81 | There is unfortunately no way for IPython to determine at runtime whether \-tk |
|
81 | There is unfortunately no way for IPython to determine at runtime whether \-tk | |
82 | will work reliably or not, so you will need to do some experiments before |
|
82 | will work reliably or not, so you will need to do some experiments before | |
83 | relying on it for regular work. |
|
83 | relying on it for regular work. | |
84 | . |
|
84 | . | |
85 | .SS A WARNING ABOUT SIGNALS AND THREADS |
|
85 | .SS A WARNING ABOUT SIGNALS AND THREADS | |
86 | When any of the thread systems (GTK, QT or WX) are active, either directly or |
|
86 | When any of the thread systems (GTK, QT or WX) are active, either directly or | |
87 | via \-pylab with a threaded backend, it is impossible to interrupt |
|
87 | via \-pylab with a threaded backend, it is impossible to interrupt | |
88 | long-running Python code via Ctrl\-C. IPython can not pass the |
|
88 | long-running Python code via Ctrl\-C. IPython can not pass the | |
89 | KeyboardInterrupt exception (or the underlying SIGINT) across threads, so any |
|
89 | KeyboardInterrupt exception (or the underlying SIGINT) across threads, so any | |
90 | long-running process started from IPython will run to completion, or will have |
|
90 | long-running process started from IPython will run to completion, or will have | |
91 | to be killed via an external (OS-based) mechanism. |
|
91 | to be killed via an external (OS-based) mechanism. | |
92 | .br |
|
92 | .br | |
93 | .sp 1 |
|
93 | .sp 1 | |
94 | To the best of my knowledge, this limitation is imposed by the Python |
|
94 | To the best of my knowledge, this limitation is imposed by the Python | |
95 | interpreter itself, and it comes from the difficulty of writing portable |
|
95 | interpreter itself, and it comes from the difficulty of writing portable | |
96 | signal/threaded code. If any user is an expert on this topic and can suggest |
|
96 | signal/threaded code. If any user is an expert on this topic and can suggest | |
97 | a better solution, I would love to hear about it. In the IPython sources, |
|
97 | a better solution, I would love to hear about it. In the IPython sources, | |
98 | look at the Shell.py module, and in particular at the runcode() method. |
|
98 | look at the Shell.py module, and in particular at the runcode() method. | |
99 | . |
|
99 | . | |
100 | .SH REGULAR OPTIONS |
|
100 | .SH REGULAR OPTIONS | |
101 | After the above threading options have been given, regular options can follow |
|
101 | After the above threading options have been given, regular options can follow | |
102 | in any order. All options can be abbreviated to their shortest non-ambiguous |
|
102 | in any order. All options can be abbreviated to their shortest non-ambiguous | |
103 | form and are case-sensitive. One or two dashes can be used. Some options |
|
103 | form and are case-sensitive. One or two dashes can be used. Some options | |
104 | have an alternate short form, indicated after a |. |
|
104 | have an alternate short form, indicated after a |. | |
105 | .br |
|
105 | .br | |
106 | .sp 1 |
|
106 | .sp 1 | |
107 | Most options can also be set from your ipythonrc configuration file. |
|
107 | Most options can also be set from your ipythonrc configuration file. | |
108 | See the provided examples for assistance. Options given on the |
|
108 | See the provided examples for assistance. Options given on the | |
109 | commandline override the values set in the ipythonrc file. |
|
109 | commandline override the values set in the ipythonrc file. | |
110 | .br |
|
110 | .br | |
111 | .sp 1 |
|
111 | .sp 1 | |
112 |
All options with a |
|
112 | All options with a [no] prepended can be specified in negated form | |
113 | (\-nooption instead of \-option) to turn the feature off. |
|
113 | (\-nooption instead of \-option) to turn the feature off. | |
114 | .TP |
|
114 | .TP | |
115 | .B \-h, \-\-help |
|
115 | .B \-h, \-\-help | |
116 | Show summary of options. |
|
116 | Show summary of options. | |
117 | .TP |
|
117 | .TP | |
118 |
.B \- |
|
118 | .B \-[no]autocall | |
119 | Make IPython automatically call any callable object even if you didn't type |
|
119 | Make IPython automatically call any callable object even if you didn't type | |
120 | explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically. |
|
120 | explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically. | |
121 | .TP |
|
121 | .TP | |
122 |
.B \- |
|
122 | .B \-[no]autoindent | |
123 | Turn automatic indentation on/off. |
|
123 | Turn automatic indentation on/off. | |
124 | .TP |
|
124 | .TP | |
125 |
.B \- |
|
125 | .B \-[no]automagic | |
126 | Make magic commands automatic (without needing their first character |
|
126 | Make magic commands automatic (without needing their first character | |
127 | to be @). Type @magic at the IPython prompt for more information. |
|
127 | to be @). Type @magic at the IPython prompt for more information. | |
128 | .TP |
|
128 | .TP | |
129 |
.B \- |
|
129 | .B \-[no]autoparens | |
130 | Make IPython automatically call any callable object even if you didn't |
|
130 | Make IPython automatically call any callable object even if you didn't | |
131 | type explicit parentheses. For example, 'str 43' becomes 'str(43)' |
|
131 | type explicit parentheses. For example, 'str 43' becomes 'str(43)' | |
132 | automatically. |
|
132 | automatically. | |
133 | .TP |
|
133 | .TP | |
134 |
.B \- |
|
134 | .B \-[no]banner | |
135 | Print the intial information banner (default on). |
|
135 | Print the intial information banner (default on). | |
136 | .TP |
|
136 | .TP | |
137 | .B \-c <command> |
|
137 | .B \-c <command> | |
138 | Execute the given command string, and set sys.argv to ['c']. This is similar |
|
138 | Execute the given command string, and set sys.argv to ['c']. This is similar | |
139 | to the \-c option in the normal Python interpreter. |
|
139 | to the \-c option in the normal Python interpreter. | |
140 | .TP |
|
140 | .TP | |
141 | .B \-cache_size|cs <n> |
|
141 | .B \-cache_size|cs <n> | |
142 | Size of the output cache (maximum number of entries to hold in |
|
142 | Size of the output cache (maximum number of entries to hold in | |
143 | memory). The default is 1000, you can change it permanently in your |
|
143 | memory). The default is 1000, you can change it permanently in your | |
144 | config file. Setting it to 0 completely disables the caching system, |
|
144 | config file. Setting it to 0 completely disables the caching system, | |
145 | and the minimum value accepted is 20 (if you provide a value less than |
|
145 | and the minimum value accepted is 20 (if you provide a value less than | |
146 | 20, it is reset to 0 and a warning is issued). This limit is defined |
|
146 | 20, it is reset to 0 and a warning is issued). This limit is defined | |
147 | because otherwise you'll spend more time re-flushing a too small cache |
|
147 | because otherwise you'll spend more time re-flushing a too small cache | |
148 | than working. |
|
148 | than working. | |
149 | .TP |
|
149 | .TP | |
150 | .B \-classic|cl |
|
150 | .B \-classic|cl | |
151 | Gives IPython a similar feel to the classic Python prompt. |
|
151 | Gives IPython a similar feel to the classic Python prompt. | |
152 | .TP |
|
152 | .TP | |
153 | .B \-colors <scheme> |
|
153 | .B \-colors <scheme> | |
154 | Color scheme for prompts and exception reporting. Currently |
|
154 | Color scheme for prompts and exception reporting. Currently | |
155 | implemented: NoColor, Linux, and LightBG. |
|
155 | implemented: NoColor, Linux, and LightBG. | |
156 | .TP |
|
156 | .TP | |
157 |
.B \- |
|
157 | .B \-[no]color_info | |
158 | IPython can display information about objects via a set of functions, |
|
158 | IPython can display information about objects via a set of functions, | |
159 | and optionally can use colors for this, syntax highlighting source |
|
159 | and optionally can use colors for this, syntax highlighting source | |
160 | code and various other elements. However, because this information is |
|
160 | code and various other elements. However, because this information is | |
161 | passed through a pager (like 'less') and many pagers get confused with |
|
161 | passed through a pager (like 'less') and many pagers get confused with | |
162 | color codes, this option is off by default. You can test it and turn |
|
162 | color codes, this option is off by default. You can test it and turn | |
163 | it on permanently in your ipythonrc file if it works for you. As a |
|
163 | it on permanently in your ipythonrc file if it works for you. As a | |
164 | reference, the 'less' pager supplied with Mandrake 8.2 works ok, but |
|
164 | reference, the 'less' pager supplied with Mandrake 8.2 works ok, but | |
165 | that in RedHat 7.2 doesn't. |
|
165 | that in RedHat 7.2 doesn't. | |
166 | .br |
|
166 | .br | |
167 | .sp 1 |
|
167 | .sp 1 | |
168 | Test it and turn it on permanently if it works with your system. The |
|
168 | Test it and turn it on permanently if it works with your system. The | |
169 | magic function @color_info allows you to toggle this interactively for |
|
169 | magic function @color_info allows you to toggle this interactively for | |
170 | testing. |
|
170 | testing. | |
171 | .TP |
|
171 | .TP | |
172 |
.B \- |
|
172 | .B \-[no]confirm_exit | |
173 | Set to confirm when you try to exit IPython with an EOF (Control-D in |
|
173 | Set to confirm when you try to exit IPython with an EOF (Control-D in | |
174 | Unix, Control-Z/Enter in Windows). Note that using the magic functions |
|
174 | Unix, Control-Z/Enter in Windows). Note that using the magic functions | |
175 | @Exit or @Quit you can force a direct exit, bypassing any |
|
175 | @Exit or @Quit you can force a direct exit, bypassing any | |
176 | confirmation. |
|
176 | confirmation. | |
177 | .TP |
|
177 | .TP | |
178 |
.B \- |
|
178 | .B \-[no]debug | |
179 | Show information about the loading process. Very useful to pin down |
|
179 | Show information about the loading process. Very useful to pin down | |
180 | problems with your configuration files or to get details about session |
|
180 | problems with your configuration files or to get details about session | |
181 | restores. |
|
181 | restores. | |
182 | .TP |
|
182 | .TP | |
183 |
.B \- |
|
183 | .B \-[no]deep_reload | |
184 | IPython can use the deep_reload module which reloads changes in |
|
184 | IPython can use the deep_reload module which reloads changes in | |
185 | modules recursively (it replaces the reload() function, so you don't |
|
185 | modules recursively (it replaces the reload() function, so you don't | |
186 | need to change anything to use it). deep_reload() forces a full reload |
|
186 | need to change anything to use it). deep_reload() forces a full reload | |
187 | of modules whose code may have changed, which the default reload() |
|
187 | of modules whose code may have changed, which the default reload() | |
188 | function does not. |
|
188 | function does not. | |
189 | .br |
|
189 | .br | |
190 | .sp 1 |
|
190 | .sp 1 | |
191 | When deep_reload is off, IPython will use the normal reload(), but |
|
191 | When deep_reload is off, IPython will use the normal reload(), but | |
192 | deep_reload will still be available as dreload(). This feature is off |
|
192 | deep_reload will still be available as dreload(). This feature is off | |
193 | by default [which means that you have both normal reload() and |
|
193 | by default [which means that you have both normal reload() and | |
194 | dreload()]. |
|
194 | dreload()]. | |
195 | .TP |
|
195 | .TP | |
196 | .B \-editor <name> |
|
196 | .B \-editor <name> | |
197 | Which editor to use with the @edit command. By default, IPython will |
|
197 | Which editor to use with the @edit command. By default, IPython will | |
198 | honor your EDITOR environment variable (if not set, vi is the Unix |
|
198 | honor your EDITOR environment variable (if not set, vi is the Unix | |
199 | default and notepad the Windows one). Since this editor is invoked on |
|
199 | default and notepad the Windows one). Since this editor is invoked on | |
200 | the fly by IPython and is meant for editing small code snippets, you |
|
200 | the fly by IPython and is meant for editing small code snippets, you | |
201 | may want to use a small, lightweight editor here (in case your default |
|
201 | may want to use a small, lightweight editor here (in case your default | |
202 | EDITOR is something like Emacs). |
|
202 | EDITOR is something like Emacs). | |
203 | .TP |
|
203 | .TP | |
204 | .B \-ipythondir <name> |
|
204 | .B \-ipythondir <name> | |
205 | The name of your IPython configuration directory IPYTHONDIR. This can |
|
205 | The name of your IPython configuration directory IPYTHONDIR. This can | |
206 | also be specified through the environment variable IPYTHONDIR. |
|
206 | also be specified through the environment variable IPYTHONDIR. | |
207 | .TP |
|
207 | .TP | |
208 | .B \-log|l |
|
208 | .B \-log|l | |
209 | Generate a log file of all input. The file is named ipython.log in |
|
209 | Generate a log file of all input. The file is named ipython.log in | |
210 | your current directory (which prevents logs from multiple IPython |
|
210 | your current directory (which prevents logs from multiple IPython | |
211 | sessions from trampling each other). You can use this to later restore |
|
211 | sessions from trampling each other). You can use this to later restore | |
212 | a session by loading your logfile as a file to be executed with option |
|
212 | a session by loading your logfile as a file to be executed with option | |
213 | -logplay (see below). |
|
213 | -logplay (see below). | |
214 | .TP |
|
214 | .TP | |
215 | .B \-logfile|lf |
|
215 | .B \-logfile|lf | |
216 | Specifu the name of your logfile. |
|
216 | Specifu the name of your logfile. | |
217 | .TP |
|
217 | .TP | |
218 | .B \-logplay|lp |
|
218 | .B \-logplay|lp | |
219 | Replay a previous log. For restoring a session as close as possible to |
|
219 | Replay a previous log. For restoring a session as close as possible to | |
220 | the state you left it in, use this option (don't just run the |
|
220 | the state you left it in, use this option (don't just run the | |
221 | logfile). With \-logplay, IPython will try to reconstruct the previous |
|
221 | logfile). With \-logplay, IPython will try to reconstruct the previous | |
222 | working environment in full, not just execute the commands in the |
|
222 | working environment in full, not just execute the commands in the | |
223 | logfile. |
|
223 | logfile. | |
224 | .br |
|
224 | .br | |
225 | .sh 1 |
|
225 | .sh 1 | |
226 | When a session is restored, logging is automatically turned on again |
|
226 | When a session is restored, logging is automatically turned on again | |
227 | with the name of the logfile it was invoked with (it is read from the |
|
227 | with the name of the logfile it was invoked with (it is read from the | |
228 | log header). So once you've turned logging on for a session, you can |
|
228 | log header). So once you've turned logging on for a session, you can | |
229 | quit IPython and reload it as many times as you want and it will |
|
229 | quit IPython and reload it as many times as you want and it will | |
230 | continue to log its history and restore from the beginning every time. |
|
230 | continue to log its history and restore from the beginning every time. | |
231 | .br |
|
231 | .br | |
232 | .sp 1 |
|
232 | .sp 1 | |
233 | Caveats: there are limitations in this option. The history variables |
|
233 | Caveats: there are limitations in this option. The history variables | |
234 | _i*,_* and _dh don't get restored properly. In the future we will try |
|
234 | _i*,_* and _dh don't get restored properly. In the future we will try | |
235 | to implement full session saving by writing and retrieving a |
|
235 | to implement full session saving by writing and retrieving a | |
236 | 'snapshot' of the memory state of IPython. But our first attempts |
|
236 | 'snapshot' of the memory state of IPython. But our first attempts | |
237 | failed because of inherent limitations of Python's Pickle module, so |
|
237 | failed because of inherent limitations of Python's Pickle module, so | |
238 | this may have to wait. |
|
238 | this may have to wait. | |
239 | .TP |
|
239 | .TP | |
240 |
.B \- |
|
240 | .B \-[no]messages | |
241 | Print messages which IPython collects about its startup process |
|
241 | Print messages which IPython collects about its startup process | |
242 | (default on). |
|
242 | (default on). | |
243 | .TP |
|
243 | .TP | |
244 |
.B \- |
|
244 | .B \-[no]pdb | |
245 | Automatically call the pdb debugger after every uncaught exception. If |
|
245 | Automatically call the pdb debugger after every uncaught exception. If | |
246 | you are used to debugging using pdb, this puts you automatically |
|
246 | you are used to debugging using pdb, this puts you automatically | |
247 | inside of it after any call (either in IPython or in code called by |
|
247 | inside of it after any call (either in IPython or in code called by | |
248 | it) which triggers an exception which goes uncaught. |
|
248 | it) which triggers an exception which goes uncaught. | |
249 | .TP |
|
249 | .TP | |
250 |
.B \- |
|
250 | .B \-[no]pprint | |
251 | IPython can optionally use the pprint (pretty printer) module for |
|
251 | IPython can optionally use the pprint (pretty printer) module for | |
252 | displaying results. pprint tends to give a nicer display of nested |
|
252 | displaying results. pprint tends to give a nicer display of nested | |
253 | data structures. If you like it, you can turn it on permanently in |
|
253 | data structures. If you like it, you can turn it on permanently in | |
254 | your config file (default off). |
|
254 | your config file (default off). | |
255 | .TP |
|
255 | .TP | |
256 | .B \-profile|p <name> |
|
256 | .B \-profile|p <name> | |
257 | Assume that your config file is ipythonrc-<name> (looks in current dir |
|
257 | Assume that your config file is ipythonrc-<name> (looks in current dir | |
258 | first, then in IPYTHONDIR). This is a quick way to keep and load |
|
258 | first, then in IPYTHONDIR). This is a quick way to keep and load | |
259 | multiple config files for different tasks, especially if you use the |
|
259 | multiple config files for different tasks, especially if you use the | |
260 | include option of config files. You can keep a basic |
|
260 | include option of config files. You can keep a basic | |
261 | IPYTHONDIR/ipythonrc file and then have other 'profiles' which include |
|
261 | IPYTHONDIR/ipythonrc file and then have other 'profiles' which include | |
262 | this one and load extra things for particular tasks. For example: |
|
262 | this one and load extra things for particular tasks. For example: | |
263 | .br |
|
263 | .br | |
264 | .sp 1 |
|
264 | .sp 1 | |
265 | 1) $HOME/.ipython/ipythonrc : load basic things you always want. |
|
265 | 1) $HOME/.ipython/ipythonrc : load basic things you always want. | |
266 | .br |
|
266 | .br | |
267 | 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-related |
|
267 | 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-related | |
268 | modules. |
|
268 | modules. | |
269 | .br |
|
269 | .br | |
270 | 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and |
|
270 | 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and | |
271 | plotting modules. |
|
271 | plotting modules. | |
272 | .br |
|
272 | .br | |
273 | .sp 1 |
|
273 | .sp 1 | |
274 | Since it is possible to create an endless loop by having circular file |
|
274 | Since it is possible to create an endless loop by having circular file | |
275 | inclusions, IPython will stop if it reaches 15 recursive inclusions. |
|
275 | inclusions, IPython will stop if it reaches 15 recursive inclusions. | |
276 | .TP |
|
276 | .TP | |
277 | .B \-prompt_in1|pi1 <string> |
|
277 | .B \-prompt_in1|pi1 <string> | |
278 | Specify the string used for input prompts. Note that if you are using |
|
278 | Specify the string used for input prompts. Note that if you are using | |
279 | numbered prompts, the number is represented with a '\\#' in the |
|
279 | numbered prompts, the number is represented with a '\\#' in the | |
280 | string. Don't forget to quote strings with spaces embedded in |
|
280 | string. Don't forget to quote strings with spaces embedded in | |
281 | them. Default: 'In [\\#]:'. |
|
281 | them. Default: 'In [\\#]:'. | |
282 | .br |
|
282 | .br | |
283 | .sp 1 |
|
283 | .sp 1 | |
284 | Most bash-like escapes can be used to customize IPython's prompts, as well as |
|
284 | Most bash-like escapes can be used to customize IPython's prompts, as well as | |
285 | a few additional ones which are IPython-specific. All valid prompt escapes |
|
285 | a few additional ones which are IPython-specific. All valid prompt escapes | |
286 | are described in detail in the Customization section of the IPython HTML/PDF |
|
286 | are described in detail in the Customization section of the IPython HTML/PDF | |
287 | manual. |
|
287 | manual. | |
288 | .TP |
|
288 | .TP | |
289 | .B \-prompt_in2|pi2 <string> |
|
289 | .B \-prompt_in2|pi2 <string> | |
290 | Similar to the previous option, but used for the continuation prompts. The |
|
290 | Similar to the previous option, but used for the continuation prompts. The | |
291 | special sequence '\\D' is similar to '\\#', but with all digits replaced dots |
|
291 | special sequence '\\D' is similar to '\\#', but with all digits replaced dots | |
292 | (so you can have your continuation prompt aligned with your input |
|
292 | (so you can have your continuation prompt aligned with your input | |
293 | prompt). Default: ' .\\D.:' (note three spaces at the start for alignment |
|
293 | prompt). Default: ' .\\D.:' (note three spaces at the start for alignment | |
294 | with 'In [\\#]'). |
|
294 | with 'In [\\#]'). | |
295 | .TP |
|
295 | .TP | |
296 | .B \-prompt_out|po <string> |
|
296 | .B \-prompt_out|po <string> | |
297 | String used for output prompts, also uses numbers like prompt_in1. |
|
297 | String used for output prompts, also uses numbers like prompt_in1. | |
298 | Default: 'Out[\\#]:'. |
|
298 | Default: 'Out[\\#]:'. | |
299 | .TP |
|
299 | .TP | |
300 | .B \-quick |
|
300 | .B \-quick | |
301 | Start in bare bones mode (no config file loaded). |
|
301 | Start in bare bones mode (no config file loaded). | |
302 | .TP |
|
302 | .TP | |
303 | .B \-rcfile <name> |
|
303 | .B \-rcfile <name> | |
304 | Name of your IPython resource configuration file. normally IPython |
|
304 | Name of your IPython resource configuration file. normally IPython | |
305 | loads ipythonrc (from current directory) or IPYTHONDIR/ipythonrc. If |
|
305 | loads ipythonrc (from current directory) or IPYTHONDIR/ipythonrc. If | |
306 | the loading of your config file fails, IPython starts with a bare |
|
306 | the loading of your config file fails, IPython starts with a bare | |
307 | bones configuration (no modules loaded at all). |
|
307 | bones configuration (no modules loaded at all). | |
308 | .TP |
|
308 | .TP | |
309 |
.B \- |
|
309 | .B \-[no]readline | |
310 | Use the readline library, which is needed to support name completion |
|
310 | Use the readline library, which is needed to support name completion | |
311 | and command history, among other things. It is enabled by default, but |
|
311 | and command history, among other things. It is enabled by default, but | |
312 | may cause problems for users of X/Emacs in Python comint or shell |
|
312 | may cause problems for users of X/Emacs in Python comint or shell | |
313 | buffers. |
|
313 | buffers. | |
314 | .br |
|
314 | .br | |
315 | .sp 1 |
|
315 | .sp 1 | |
316 | Note that emacs 'eterm' buffers (opened with M-x term) support |
|
316 | Note that emacs 'eterm' buffers (opened with M-x term) support | |
317 | IPython's readline and syntax coloring fine, only 'emacs' (M-x shell |
|
317 | IPython's readline and syntax coloring fine, only 'emacs' (M-x shell | |
318 | and C-c !) buffers do not. |
|
318 | and C-c !) buffers do not. | |
319 | .TP |
|
319 | .TP | |
320 | .B \-screen_length|sl <n> |
|
320 | .B \-screen_length|sl <n> | |
321 | Number of lines of your screen. This is used to control printing of |
|
321 | Number of lines of your screen. This is used to control printing of | |
322 | very long strings. Strings longer than this number of lines will be |
|
322 | very long strings. Strings longer than this number of lines will be | |
323 | sent through a pager instead of directly printed. |
|
323 | sent through a pager instead of directly printed. | |
324 | .br |
|
324 | .br | |
325 | .sp 1 |
|
325 | .sp 1 | |
326 | The default value for this is 0, which means IPython will auto-detect |
|
326 | The default value for this is 0, which means IPython will auto-detect | |
327 | your screen size every time it needs to print certain potentially long |
|
327 | your screen size every time it needs to print certain potentially long | |
328 | strings (this doesn't change the behavior of the 'print' keyword, it's |
|
328 | strings (this doesn't change the behavior of the 'print' keyword, it's | |
329 | only triggered internally). If for some reason this isn't working well |
|
329 | only triggered internally). If for some reason this isn't working well | |
330 | (it needs curses support), specify it yourself. Otherwise don't change |
|
330 | (it needs curses support), specify it yourself. Otherwise don't change | |
331 | the default. |
|
331 | the default. | |
332 | .TP |
|
332 | .TP | |
333 | .B \-separate_in|si <string> |
|
333 | .B \-separate_in|si <string> | |
334 | Separator before input prompts. Default '\n'. |
|
334 | Separator before input prompts. Default '\n'. | |
335 | .TP |
|
335 | .TP | |
336 | .B \-separate_out|so <string> |
|
336 | .B \-separate_out|so <string> | |
337 | Separator before output prompts. Default: 0 (nothing). |
|
337 | Separator before output prompts. Default: 0 (nothing). | |
338 | .TP |
|
338 | .TP | |
339 | .B \-separate_out2|so2 <string> |
|
339 | .B \-separate_out2|so2 <string> | |
340 | Separator after output prompts. Default: 0 (nothing). |
|
340 | Separator after output prompts. Default: 0 (nothing). | |
341 | .TP |
|
341 | .TP | |
342 | .B \-nosep |
|
342 | .B \-nosep | |
343 | Shorthand for '\-separate_in 0 \-separate_out 0 \-separate_out2 0'. |
|
343 | Shorthand for '\-separate_in 0 \-separate_out 0 \-separate_out2 0'. | |
344 | Simply removes all input/output separators. |
|
344 | Simply removes all input/output separators. | |
345 | .TP |
|
345 | .TP | |
346 | .B \-upgrade |
|
346 | .B \-upgrade | |
347 | Allows you to upgrade your IPYTHONDIR configuration when you install a |
|
347 | Allows you to upgrade your IPYTHONDIR configuration when you install a | |
348 | new version of IPython. Since new versions may include new command |
|
348 | new version of IPython. Since new versions may include new command | |
349 | lines options or example files, this copies updated ipythonrc-type |
|
349 | lines options or example files, this copies updated ipythonrc-type | |
350 | files. However, it backs up (with a .old extension) all files which |
|
350 | files. However, it backs up (with a .old extension) all files which | |
351 | it overwrites so that you can merge back any custimizations you might |
|
351 | it overwrites so that you can merge back any custimizations you might | |
352 | have in your personal files. |
|
352 | have in your personal files. | |
353 | .TP |
|
353 | .TP | |
354 | .B \-Version |
|
354 | .B \-Version | |
355 | Print version information and exit. |
|
355 | Print version information and exit. | |
356 | .TP |
|
356 | .TP | |
357 | .B \-xmode <modename> |
|
357 | .B \-xmode <modename> | |
358 | Mode for exception reporting. The valid modes are Plain, Context, and |
|
358 | Mode for exception reporting. The valid modes are Plain, Context, and | |
359 | Verbose. |
|
359 | Verbose. | |
360 | .br |
|
360 | .br | |
361 | .sp 1 |
|
361 | .sp 1 | |
362 | \- Plain: similar to python's normal traceback printing. |
|
362 | \- Plain: similar to python's normal traceback printing. | |
363 | .br |
|
363 | .br | |
364 | .sp 1 |
|
364 | .sp 1 | |
365 | \- Context: prints 5 lines of context source code around each line in the |
|
365 | \- Context: prints 5 lines of context source code around each line in the | |
366 | traceback. |
|
366 | traceback. | |
367 | .br |
|
367 | .br | |
368 | .sp 1 |
|
368 | .sp 1 | |
369 | \- Verbose: similar to Context, but additionally prints the variables |
|
369 | \- Verbose: similar to Context, but additionally prints the variables | |
370 | currently visible where the exception happened (shortening their strings if |
|
370 | currently visible where the exception happened (shortening their strings if | |
371 | too long). This can potentially be very slow, if you happen to have a huge |
|
371 | too long). This can potentially be very slow, if you happen to have a huge | |
372 | data structure whose string representation is complex to compute. Your |
|
372 | data structure whose string representation is complex to compute. Your | |
373 | computer may appear to freeze for a while with cpu usage at 100%. If this |
|
373 | computer may appear to freeze for a while with cpu usage at 100%. If this | |
374 | occurs, you can cancel the traceback with Ctrl-C (maybe hitting it more than |
|
374 | occurs, you can cancel the traceback with Ctrl-C (maybe hitting it more than | |
375 | once). |
|
375 | once). | |
376 | . |
|
376 | . | |
377 | .SH EMBEDDING |
|
377 | .SH EMBEDDING | |
378 | It is possible to start an IPython instance inside your own Python |
|
378 | It is possible to start an IPython instance inside your own Python | |
379 | programs. In the documentation example files there are some |
|
379 | programs. In the documentation example files there are some | |
380 | illustrations on how to do this. |
|
380 | illustrations on how to do this. | |
381 | .br |
|
381 | .br | |
382 | .sp 1 |
|
382 | .sp 1 | |
383 | This feature allows you to evalutate dynamically the state of your |
|
383 | This feature allows you to evalutate dynamically the state of your | |
384 | code, operate with your variables, analyze them, etc. Note however |
|
384 | code, operate with your variables, analyze them, etc. Note however | |
385 | that any changes you make to values while in the shell do NOT |
|
385 | that any changes you make to values while in the shell do NOT | |
386 | propagate back to the running code, so it is safe to modify your |
|
386 | propagate back to the running code, so it is safe to modify your | |
387 | values because you won't break your code in bizarre ways by doing so. |
|
387 | values because you won't break your code in bizarre ways by doing so. | |
388 | .SH AUTHOR |
|
388 | .SH AUTHOR | |
389 | IPython was written by Fernando Perez <fperez@colorado.edu>, based on earlier |
|
389 | IPython was written by Fernando Perez <fperez@colorado.edu>, based on earlier | |
390 | code by Janko Hauser <jh@comunit.de> and Nathaniel Gray |
|
390 | code by Janko Hauser <jh@comunit.de> and Nathaniel Gray | |
391 | <n8gray@caltech.edu>. This manual page was written by Jack Moffitt |
|
391 | <n8gray@caltech.edu>. This manual page was written by Jack Moffitt | |
392 | <jack@xiph.org>, for the Debian project (but may be used by others). |
|
392 | <jack@xiph.org>, for the Debian project (but may be used by others). |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
@@ -1,146 +1,149 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # -*- coding: utf-8 -*- |
|
2 | # -*- coding: utf-8 -*- | |
3 | """Setup script for IPython. |
|
3 | """Setup script for IPython. | |
4 |
|
4 | |||
5 | Under Posix environments it works like a typical setup.py script. |
|
5 | Under Posix environments it works like a typical setup.py script. | |
6 | Under Windows, the command sdist is not supported, since IPython |
|
6 | Under Windows, the command sdist is not supported, since IPython | |
7 | requires utilities, which are not available under Windows.""" |
|
7 | requires utilities, which are not available under Windows.""" | |
8 |
|
8 | |||
9 | #***************************************************************************** |
|
9 | #***************************************************************************** | |
10 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> |
|
10 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> | |
11 | # |
|
11 | # | |
12 | # Distributed under the terms of the BSD License. The full license is in |
|
12 | # Distributed under the terms of the BSD License. The full license is in | |
13 | # the file COPYING, distributed as part of this software. |
|
13 | # the file COPYING, distributed as part of this software. | |
14 | #***************************************************************************** |
|
14 | #***************************************************************************** | |
15 |
|
15 | |||
16 | import sys, os |
|
16 | import sys, os | |
17 | from glob import glob |
|
17 | from glob import glob | |
18 | from setupext import install_data_ext |
|
18 | from setupext import install_data_ext | |
19 | isfile = os.path.isfile |
|
19 | isfile = os.path.isfile | |
20 |
|
20 | |||
21 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
21 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly | |
22 | # update it when the contents of directories change. |
|
22 | # update it when the contents of directories change. | |
23 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
23 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') | |
24 |
|
24 | |||
25 | if os.name == 'posix': |
|
25 | if os.name == 'posix': | |
26 | os_name = 'posix' |
|
26 | os_name = 'posix' | |
27 | elif os.name in ['nt','dos']: |
|
27 | elif os.name in ['nt','dos']: | |
28 | os_name = 'windows' |
|
28 | os_name = 'windows' | |
29 | else: |
|
29 | else: | |
30 | print 'Unsupported operating system:',os.name |
|
30 | print 'Unsupported operating system:',os.name | |
31 | sys.exit(1) |
|
31 | sys.exit(1) | |
32 |
|
32 | |||
33 | # Under Windows, 'sdist' is not supported, since it requires lyxport (and |
|
33 | # Under Windows, 'sdist' is not supported, since it requires lyxport (and | |
34 | # hence lyx,perl,latex,pdflatex,latex2html,sh,...) |
|
34 | # hence lyx,perl,latex,pdflatex,latex2html,sh,...) | |
35 | if os_name == 'windows' and sys.argv[1] == 'sdist': |
|
35 | if os_name == 'windows' and sys.argv[1] == 'sdist': | |
36 | print 'The sdist command is not available under Windows. Exiting.' |
|
36 | print 'The sdist command is not available under Windows. Exiting.' | |
37 | sys.exit(1) |
|
37 | sys.exit(1) | |
38 |
|
38 | |||
39 | from distutils.core import setup |
|
39 | from distutils.core import setup | |
40 |
|
40 | |||
41 | # update the manuals when building a source dist |
|
41 | # update the manuals when building a source dist | |
42 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
42 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
43 | from IPython.genutils import target_update |
|
43 | from IPython.genutils import target_update | |
44 | # list of things to be updated. Each entry is a triplet of args for |
|
44 | # list of things to be updated. Each entry is a triplet of args for | |
45 | # target_update() |
|
45 | # target_update() | |
46 | to_update = [('doc/magic.tex', |
|
46 | to_update = [('doc/magic.tex', | |
47 | ['IPython/Magic.py'], |
|
47 | ['IPython/Magic.py'], | |
48 | "cd doc && ./update_magic.sh" ), |
|
48 | "cd doc && ./update_magic.sh" ), | |
49 |
|
49 | |||
50 | ('doc/manual.lyx', |
|
50 | ('doc/manual.lyx', | |
51 | ['IPython/Release.py','doc/manual_base.lyx'], |
|
51 | ['IPython/Release.py','doc/manual_base.lyx'], | |
52 | "cd doc && ./update_version.sh" ), |
|
52 | "cd doc && ./update_version.sh" ), | |
53 |
|
53 | |||
54 | ('doc/manual/manual.html', |
|
54 | ('doc/manual/manual.html', | |
55 | ['doc/manual.lyx', |
|
55 | ['doc/manual.lyx', | |
56 | 'doc/magic.tex', |
|
56 | 'doc/magic.tex', | |
57 | 'doc/examples/example-gnuplot.py', |
|
57 | 'doc/examples/example-gnuplot.py', | |
58 | 'doc/examples/example-magic.py', |
|
58 | 'doc/examples/example-magic.py', | |
59 | 'doc/examples/example-embed.py', |
|
59 | 'doc/examples/example-embed.py', | |
60 | 'doc/examples/example-embed-short.py', |
|
60 | 'doc/examples/example-embed-short.py', | |
61 | 'IPython/UserConfig/ipythonrc', |
|
61 | 'IPython/UserConfig/ipythonrc', | |
62 | ], |
|
62 | ], | |
63 | "cd doc && " |
|
63 | "cd doc && " | |
64 | "lyxport -tt --leave --pdf " |
|
64 | "lyxport -tt --leave --pdf " | |
65 | "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), |
|
65 | "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), | |
66 |
|
66 | |||
67 | ('doc/new_design.pdf', |
|
67 | ('doc/new_design.pdf', | |
68 | ['doc/new_design.lyx'], |
|
68 | ['doc/new_design.lyx'], | |
69 | "cd doc && lyxport -tt --pdf new_design.lyx"), |
|
69 | "cd doc && lyxport -tt --pdf new_design.lyx"), | |
70 |
|
70 | |||
71 | ('doc/ipython.1.gz', |
|
71 | ('doc/ipython.1.gz', | |
72 | ['doc/ipython.1'], |
|
72 | ['doc/ipython.1'], | |
73 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), |
|
73 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), | |
74 |
|
74 | |||
75 | ('doc/pycolor.1.gz', |
|
75 | ('doc/pycolor.1.gz', | |
76 | ['doc/pycolor.1'], |
|
76 | ['doc/pycolor.1'], | |
77 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), |
|
77 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), | |
78 | ] |
|
78 | ] | |
79 | for target in to_update: |
|
79 | for target in to_update: | |
80 | target_update(*target) |
|
80 | target_update(*target) | |
81 |
|
81 | |||
82 | # Release.py contains version, authors, license, url, keywords, etc. |
|
82 | # Release.py contains version, authors, license, url, keywords, etc. | |
83 | execfile(os.path.join('IPython','Release.py')) |
|
83 | execfile(os.path.join('IPython','Release.py')) | |
84 |
|
84 | |||
85 | # A little utility we'll need below, since glob() does NOT allow you to do |
|
85 | # A little utility we'll need below, since glob() does NOT allow you to do | |
86 | # exclusion on multiple endings! |
|
86 | # exclusion on multiple endings! | |
87 | def file_doesnt_endwith(test,endings): |
|
87 | def file_doesnt_endwith(test,endings): | |
88 | """Return true if test is a file and its name does NOT end with any |
|
88 | """Return true if test is a file and its name does NOT end with any | |
89 | of the strings listed in endings.""" |
|
89 | of the strings listed in endings.""" | |
90 | if not isfile(test): |
|
90 | if not isfile(test): | |
91 | return False |
|
91 | return False | |
92 | for e in endings: |
|
92 | for e in endings: | |
93 | if test.endswith(e): |
|
93 | if test.endswith(e): | |
94 | return False |
|
94 | return False | |
95 | return True |
|
95 | return True | |
96 |
|
96 | |||
97 | # I can't find how to make distutils create a nested dir. structure, so |
|
97 | # I can't find how to make distutils create a nested dir. structure, so | |
98 | # in the meantime do it manually. Butt ugly. |
|
98 | # in the meantime do it manually. Butt ugly. | |
|
99 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain | |||
|
100 | # information on how to do this more cleanly once python 2.4 can be assumed. | |||
|
101 | # Thanks to Noel for the tip. | |||
99 | docdirbase = 'share/doc/ipython-%s' % version |
|
102 | docdirbase = 'share/doc/ipython-%s' % version | |
100 | manpagebase = 'share/man/man1' |
|
103 | manpagebase = 'share/man/man1' | |
101 |
|
104 | |||
102 | # We only need to exclude from this things NOT already excluded in the |
|
105 | # We only need to exclude from this things NOT already excluded in the | |
103 | # MANIFEST.in file. |
|
106 | # MANIFEST.in file. | |
104 | exclude = ('.sh','.1.gz') |
|
107 | exclude = ('.sh','.1.gz') | |
105 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) |
|
108 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) | |
106 |
|
109 | |||
107 | examfiles = filter(isfile, glob('doc/examples/*.py')) |
|
110 | examfiles = filter(isfile, glob('doc/examples/*.py')) | |
108 | manfiles = filter(isfile, glob('doc/manual/*.html')) + \ |
|
111 | manfiles = filter(isfile, glob('doc/manual/*.html')) + \ | |
109 | filter(isfile, glob('doc/manual/*.css')) + \ |
|
112 | filter(isfile, glob('doc/manual/*.css')) + \ | |
110 | filter(isfile, glob('doc/manual/*.png')) |
|
113 | filter(isfile, glob('doc/manual/*.png')) | |
111 | manpages = filter(isfile, glob('doc/*.1.gz')) |
|
114 | manpages = filter(isfile, glob('doc/*.1.gz')) | |
112 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) |
|
115 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) | |
113 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor']) |
|
116 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor']) | |
114 |
|
117 | |||
115 | # Script to be run by the windows binary installer after the default setup |
|
118 | # Script to be run by the windows binary installer after the default setup | |
116 | # routine, to add shortcuts and similar windows-only things. Windows |
|
119 | # routine, to add shortcuts and similar windows-only things. Windows | |
117 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
120 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils | |
118 | # doesn't find them. |
|
121 | # doesn't find them. | |
119 | if 'bdist_wininst' in sys.argv: |
|
122 | if 'bdist_wininst' in sys.argv: | |
120 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
123 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): | |
121 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." |
|
124 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." | |
122 | sys.exit(1) |
|
125 | sys.exit(1) | |
123 | scriptfiles.append('scripts/ipython_win_post_install.py') |
|
126 | scriptfiles.append('scripts/ipython_win_post_install.py') | |
124 |
|
127 | |||
125 | # Call the setup() routine which does most of the work |
|
128 | # Call the setup() routine which does most of the work | |
126 | setup(name = name, |
|
129 | setup(name = name, | |
127 | version = version, |
|
130 | version = version, | |
128 | description = description, |
|
131 | description = description, | |
129 | long_description = long_description, |
|
132 | long_description = long_description, | |
130 | author = authors['Fernando'][0], |
|
133 | author = authors['Fernando'][0], | |
131 | author_email = authors['Fernando'][1], |
|
134 | author_email = authors['Fernando'][1], | |
132 | url = url, |
|
135 | url = url, | |
133 | license = license, |
|
136 | license = license, | |
134 | platforms = platforms, |
|
137 | platforms = platforms, | |
135 | keywords = keywords, |
|
138 | keywords = keywords, | |
136 | packages = ['IPython', 'IPython.Extensions'], |
|
139 | packages = ['IPython', 'IPython.Extensions'], | |
137 | scripts = scriptfiles, |
|
140 | scripts = scriptfiles, | |
138 | cmdclass = {'install_data': install_data_ext}, |
|
141 | cmdclass = {'install_data': install_data_ext}, | |
139 | data_files = [('data', docdirbase, docfiles), |
|
142 | data_files = [('data', docdirbase, docfiles), | |
140 | ('data', os.path.join(docdirbase, 'examples'), |
|
143 | ('data', os.path.join(docdirbase, 'examples'), | |
141 | examfiles), |
|
144 | examfiles), | |
142 | ('data', os.path.join(docdirbase, 'manual'), |
|
145 | ('data', os.path.join(docdirbase, 'manual'), | |
143 | manfiles), |
|
146 | manfiles), | |
144 | ('data', manpagebase, manpages), |
|
147 | ('data', manpagebase, manpages), | |
145 | ('lib', 'IPython/UserConfig', cfgfiles)] |
|
148 | ('lib', 'IPython/UserConfig', cfgfiles)] | |
146 | ) |
|
149 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now