Show More
@@ -1,725 +1,727 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | IPython -- An enhanced Interactive Python |
|
3 | IPython -- An enhanced Interactive Python | |
4 |
|
4 | |||
5 | Requires Python 2.1 or better. |
|
5 | Requires Python 2.1 or better. | |
6 |
|
6 | |||
7 | This file contains the main make_IPython() starter function. |
|
7 | This file contains the main make_IPython() starter function. | |
8 |
|
8 | |||
9 |
$Id: ipmaker.py |
|
9 | $Id: ipmaker.py 911 2005-10-08 07:59:40Z fperez $""" | |
10 |
|
10 | |||
11 | #***************************************************************************** |
|
11 | #***************************************************************************** | |
12 | # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu> |
|
12 | # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu> | |
13 | # |
|
13 | # | |
14 | # Distributed under the terms of the BSD License. The full license is in |
|
14 | # Distributed under the terms of the BSD License. The full license is in | |
15 | # the file COPYING, distributed as part of this software. |
|
15 | # the file COPYING, distributed as part of this software. | |
16 | #***************************************************************************** |
|
16 | #***************************************************************************** | |
17 |
|
17 | |||
18 | from IPython import Release |
|
18 | from IPython import Release | |
19 | __author__ = '%s <%s>' % Release.authors['Fernando'] |
|
19 | __author__ = '%s <%s>' % Release.authors['Fernando'] | |
20 | __license__ = Release.license |
|
20 | __license__ = Release.license | |
21 | __version__ = Release.version |
|
21 | __version__ = Release.version | |
22 |
|
22 | |||
23 | credits._Printer__data = """ |
|
23 | credits._Printer__data = """ | |
24 | Python: %s |
|
24 | Python: %s | |
25 |
|
25 | |||
26 | IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users. |
|
26 | IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users. | |
27 | See http://ipython.scipy.org for more information.""" \ |
|
27 | See http://ipython.scipy.org for more information.""" \ | |
28 | % credits._Printer__data |
|
28 | % credits._Printer__data | |
29 |
|
29 | |||
30 | copyright._Printer__data += """ |
|
30 | copyright._Printer__data += """ | |
31 |
|
31 | |||
32 | Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray. |
|
32 | Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray. | |
33 | All Rights Reserved.""" |
|
33 | All Rights Reserved.""" | |
34 |
|
34 | |||
35 | #**************************************************************************** |
|
35 | #**************************************************************************** | |
36 | # Required modules |
|
36 | # Required modules | |
37 |
|
37 | |||
38 | # From the standard library |
|
38 | # From the standard library | |
39 | import __main__, __builtin__ |
|
39 | import __main__, __builtin__ | |
40 | import os,sys,types,re |
|
40 | import os,sys,types,re | |
41 | from pprint import pprint,pformat |
|
41 | from pprint import pprint,pformat | |
42 |
|
42 | |||
43 | # Our own |
|
43 | # Our own | |
44 | from IPython import DPyGetOpt |
|
44 | from IPython import DPyGetOpt | |
45 | from IPython.Struct import Struct |
|
45 | from IPython.Struct import Struct | |
46 | from IPython.OutputTrap import OutputTrap |
|
46 | from IPython.OutputTrap import OutputTrap | |
47 | from IPython.ConfigLoader import ConfigLoader |
|
47 | from IPython.ConfigLoader import ConfigLoader | |
48 | from IPython.iplib import InteractiveShell,qw_lol,import_fail_info |
|
48 | from IPython.iplib import InteractiveShell,qw_lol,import_fail_info | |
49 | from IPython.usage import cmd_line_usage,interactive_usage |
|
49 | from IPython.usage import cmd_line_usage,interactive_usage | |
50 | from IPython.Prompts import CachedOutput |
|
50 | from IPython.Prompts import CachedOutput | |
51 | from IPython.genutils import * |
|
51 | from IPython.genutils import * | |
52 |
|
52 | |||
53 | #----------------------------------------------------------------------------- |
|
53 | #----------------------------------------------------------------------------- | |
54 | def make_IPython(argv=None,user_ns=None,debug=1,rc_override=None, |
|
54 | def make_IPython(argv=None,user_ns=None,debug=1,rc_override=None, | |
55 | shell_class=InteractiveShell,embedded=False,**kw): |
|
55 | shell_class=InteractiveShell,embedded=False,**kw): | |
56 | """This is a dump of IPython into a single function. |
|
56 | """This is a dump of IPython into a single function. | |
57 |
|
57 | |||
58 | Later it will have to be broken up in a sensible manner. |
|
58 | Later it will have to be broken up in a sensible manner. | |
59 |
|
59 | |||
60 | Arguments: |
|
60 | Arguments: | |
61 |
|
61 | |||
62 | - argv: a list similar to sys.argv[1:]. It should NOT contain the desired |
|
62 | - argv: a list similar to sys.argv[1:]. It should NOT contain the desired | |
63 | script name, b/c DPyGetOpt strips the first argument only for the real |
|
63 | script name, b/c DPyGetOpt strips the first argument only for the real | |
64 | sys.argv. |
|
64 | sys.argv. | |
65 |
|
65 | |||
66 | - user_ns: a dict to be used as the user's namespace.""" |
|
66 | - user_ns: a dict to be used as the user's namespace.""" | |
67 |
|
67 | |||
68 | #---------------------------------------------------------------------- |
|
68 | #---------------------------------------------------------------------- | |
69 | # Defaults and initialization |
|
69 | # Defaults and initialization | |
70 |
|
70 | |||
71 | # For developer debugging, deactivates crash handler and uses pdb. |
|
71 | # For developer debugging, deactivates crash handler and uses pdb. | |
72 | DEVDEBUG = False |
|
72 | DEVDEBUG = False | |
73 |
|
73 | |||
74 | if argv is None: |
|
74 | if argv is None: | |
75 | argv = sys.argv |
|
75 | argv = sys.argv | |
76 |
|
76 | |||
77 | # __IP is the main global that lives throughout and represents the whole |
|
77 | # __IP is the main global that lives throughout and represents the whole | |
78 | # application. If the user redefines it, all bets are off as to what |
|
78 | # application. If the user redefines it, all bets are off as to what | |
79 | # happens. |
|
79 | # happens. | |
80 |
|
80 | |||
81 | # __IP is the name of he global which the caller will have accessible as |
|
81 | # __IP is the name of he global which the caller will have accessible as | |
82 | # __IP.name. We set its name via the first parameter passed to |
|
82 | # __IP.name. We set its name via the first parameter passed to | |
83 | # InteractiveShell: |
|
83 | # InteractiveShell: | |
84 |
|
84 | |||
85 | IP = shell_class('__IP',user_ns=user_ns,**kw) |
|
85 | IP = shell_class('__IP',user_ns=user_ns,**kw) | |
86 |
|
86 | |||
87 | # Put 'help' in the user namespace |
|
87 | # Put 'help' in the user namespace | |
88 | from site import _Helper |
|
88 | from site import _Helper | |
89 | IP.user_ns['help'] = _Helper() |
|
89 | IP.user_ns['help'] = _Helper() | |
90 |
|
90 | |||
91 | if DEVDEBUG: |
|
91 | if DEVDEBUG: | |
92 | # For developer debugging only (global flag) |
|
92 | # For developer debugging only (global flag) | |
93 | from IPython import ultraTB |
|
93 | from IPython import ultraTB | |
94 | sys.excepthook = ultraTB.VerboseTB(call_pdb=1) |
|
94 | sys.excepthook = ultraTB.VerboseTB(call_pdb=1) | |
95 | else: |
|
95 | else: | |
96 | # IPython itself shouldn't crash. This will produce a detailed |
|
96 | # IPython itself shouldn't crash. This will produce a detailed | |
97 | # post-mortem if it does |
|
97 | # post-mortem if it does | |
98 | from IPython import CrashHandler |
|
98 | from IPython import CrashHandler | |
99 | sys.excepthook = CrashHandler.CrashHandler(IP) |
|
99 | sys.excepthook = CrashHandler.CrashHandler(IP) | |
100 |
|
100 | |||
101 | IP.BANNER_PARTS = ['Python %s\n' |
|
101 | IP.BANNER_PARTS = ['Python %s\n' | |
102 | 'Type "copyright", "credits" or "license" ' |
|
102 | 'Type "copyright", "credits" or "license" ' | |
103 | 'for more information.\n' |
|
103 | 'for more information.\n' | |
104 | % (sys.version.split('\n')[0],), |
|
104 | % (sys.version.split('\n')[0],), | |
105 | "IPython %s -- An enhanced Interactive Python." |
|
105 | "IPython %s -- An enhanced Interactive Python." | |
106 | % (__version__,), |
|
106 | % (__version__,), | |
107 | """? -> Introduction to IPython's features. |
|
107 | """? -> Introduction to IPython's features. | |
108 | %magic -> Information about IPython's 'magic' % functions. |
|
108 | %magic -> Information about IPython's 'magic' % functions. | |
109 | help -> Python's own help system. |
|
109 | help -> Python's own help system. | |
110 | object? -> Details about 'object'. ?object also works, ?? prints more. |
|
110 | object? -> Details about 'object'. ?object also works, ?? prints more. | |
111 | """ ] |
|
111 | """ ] | |
112 |
|
112 | |||
113 | IP.usage = interactive_usage |
|
113 | IP.usage = interactive_usage | |
114 |
|
114 | |||
115 | # Platform-dependent suffix and directory names |
|
115 | # Platform-dependent suffix and directory names. We use _ipython instead | |
|
116 | # of .ipython under win32 b/c there's software that breaks with .named | |||
|
117 | # directories on that platform. | |||
116 | if os.name == 'posix': |
|
118 | if os.name == 'posix': | |
117 | rc_suffix = '' |
|
119 | rc_suffix = '' | |
118 | ipdir_def = '.ipython' |
|
120 | ipdir_def = '.ipython' | |
119 | else: |
|
121 | else: | |
120 | rc_suffix = '.ini' |
|
122 | rc_suffix = '.ini' | |
121 | ipdir_def = '_ipython' |
|
123 | ipdir_def = '_ipython' | |
122 |
|
124 | |||
123 | # default directory for configuration |
|
125 | # default directory for configuration | |
124 | ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR', |
|
126 | ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR', | |
125 | os.path.join(IP.home_dir,ipdir_def))) |
|
127 | os.path.join(IP.home_dir,ipdir_def))) | |
126 |
|
128 | |||
127 | # we need the directory where IPython itself is installed |
|
129 | # we need the directory where IPython itself is installed | |
128 | import IPython |
|
130 | import IPython | |
129 | IPython_dir = os.path.dirname(IPython.__file__) |
|
131 | IPython_dir = os.path.dirname(IPython.__file__) | |
130 | del IPython |
|
132 | del IPython | |
131 |
|
133 | |||
132 | #------------------------------------------------------------------------- |
|
134 | #------------------------------------------------------------------------- | |
133 | # Command line handling |
|
135 | # Command line handling | |
134 |
|
136 | |||
135 | # Valid command line options (uses DPyGetOpt syntax, like Perl's |
|
137 | # Valid command line options (uses DPyGetOpt syntax, like Perl's | |
136 | # GetOpt::Long) |
|
138 | # GetOpt::Long) | |
137 |
|
139 | |||
138 | # Any key not listed here gets deleted even if in the file (like session |
|
140 | # Any key not listed here gets deleted even if in the file (like session | |
139 | # or profile). That's deliberate, to maintain the rc namespace clean. |
|
141 | # or profile). That's deliberate, to maintain the rc namespace clean. | |
140 |
|
142 | |||
141 | # Each set of options appears twice: under _conv only the names are |
|
143 | # Each set of options appears twice: under _conv only the names are | |
142 | # listed, indicating which type they must be converted to when reading the |
|
144 | # listed, indicating which type they must be converted to when reading the | |
143 | # ipythonrc file. And under DPyGetOpt they are listed with the regular |
|
145 | # ipythonrc file. And under DPyGetOpt they are listed with the regular | |
144 | # DPyGetOpt syntax (=s,=i,:f,etc). |
|
146 | # DPyGetOpt syntax (=s,=i,:f,etc). | |
145 |
|
147 | |||
146 | # Make sure there's a space before each end of line (they get auto-joined!) |
|
148 | # Make sure there's a space before each end of line (they get auto-joined!) | |
147 | cmdline_opts = ('autocall! autoindent! automagic! banner! cache_size|cs=i ' |
|
149 | cmdline_opts = ('autocall! autoindent! automagic! banner! cache_size|cs=i ' | |
148 | 'c=s classic|cl color_info! colors=s confirm_exit! ' |
|
150 | 'c=s classic|cl color_info! colors=s confirm_exit! ' | |
149 | 'debug! deep_reload! editor=s log|l messages! nosep pdb! ' |
|
151 | 'debug! deep_reload! editor=s log|l messages! nosep pdb! ' | |
150 | 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s ' |
|
152 | 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s ' | |
151 | 'quick screen_length|sl=i prompts_pad_left=i ' |
|
153 | 'quick screen_length|sl=i prompts_pad_left=i ' | |
152 | 'logfile|lf=s logplay|lp=s profile|p=s ' |
|
154 | 'logfile|lf=s logplay|lp=s profile|p=s ' | |
153 | 'readline! readline_merge_completions! ' |
|
155 | 'readline! readline_merge_completions! ' | |
154 | 'readline_omit__names! ' |
|
156 | 'readline_omit__names! ' | |
155 | 'rcfile=s separate_in|si=s separate_out|so=s ' |
|
157 | 'rcfile=s separate_in|si=s separate_out|so=s ' | |
156 | 'separate_out2|so2=s xmode=s ' |
|
158 | 'separate_out2|so2=s xmode=s ' | |
157 | 'magic_docstrings system_verbose! ' |
|
159 | 'magic_docstrings system_verbose! ' | |
158 | 'multi_line_specials!') |
|
160 | 'multi_line_specials!') | |
159 |
|
161 | |||
160 | # Options that can *only* appear at the cmd line (not in rcfiles). |
|
162 | # Options that can *only* appear at the cmd line (not in rcfiles). | |
161 |
|
163 | |||
162 | # The "ignore" option is a kludge so that Emacs buffers don't crash, since |
|
164 | # The "ignore" option is a kludge so that Emacs buffers don't crash, since | |
163 | # the 'C-c !' command in emacs automatically appends a -i option at the end. |
|
165 | # the 'C-c !' command in emacs automatically appends a -i option at the end. | |
164 | cmdline_only = ('help ignore|i ipythondir=s Version upgrade ' |
|
166 | cmdline_only = ('help ignore|i ipythondir=s Version upgrade ' | |
165 | 'gthread! qthread! wthread! pylab! tk!') |
|
167 | 'gthread! qthread! wthread! pylab! tk!') | |
166 |
|
168 | |||
167 | # Build the actual name list to be used by DPyGetOpt |
|
169 | # Build the actual name list to be used by DPyGetOpt | |
168 | opts_names = qw(cmdline_opts) + qw(cmdline_only) |
|
170 | opts_names = qw(cmdline_opts) + qw(cmdline_only) | |
169 |
|
171 | |||
170 | # Set sensible command line defaults. |
|
172 | # Set sensible command line defaults. | |
171 | # This should have everything from cmdline_opts and cmdline_only |
|
173 | # This should have everything from cmdline_opts and cmdline_only | |
172 | opts_def = Struct(autocall = 1, |
|
174 | opts_def = Struct(autocall = 1, | |
173 | autoindent=0, |
|
175 | autoindent=0, | |
174 | automagic = 1, |
|
176 | automagic = 1, | |
175 | banner = 1, |
|
177 | banner = 1, | |
176 | cache_size = 1000, |
|
178 | cache_size = 1000, | |
177 | c = '', |
|
179 | c = '', | |
178 | classic = 0, |
|
180 | classic = 0, | |
179 | colors = 'NoColor', |
|
181 | colors = 'NoColor', | |
180 | color_info = 0, |
|
182 | color_info = 0, | |
181 | confirm_exit = 1, |
|
183 | confirm_exit = 1, | |
182 | debug = 0, |
|
184 | debug = 0, | |
183 | deep_reload = 0, |
|
185 | deep_reload = 0, | |
184 | editor = '0', |
|
186 | editor = '0', | |
185 | help = 0, |
|
187 | help = 0, | |
186 | ignore = 0, |
|
188 | ignore = 0, | |
187 | ipythondir = ipythondir, |
|
189 | ipythondir = ipythondir, | |
188 | log = 0, |
|
190 | log = 0, | |
189 | logfile = '', |
|
191 | logfile = '', | |
190 | logplay = '', |
|
192 | logplay = '', | |
191 | multi_line_specials = 1, |
|
193 | multi_line_specials = 1, | |
192 | messages = 1, |
|
194 | messages = 1, | |
193 | nosep = 0, |
|
195 | nosep = 0, | |
194 | pdb = 0, |
|
196 | pdb = 0, | |
195 | pprint = 0, |
|
197 | pprint = 0, | |
196 | profile = '', |
|
198 | profile = '', | |
197 | prompt_in1 = 'In [\\#]: ', |
|
199 | prompt_in1 = 'In [\\#]: ', | |
198 | prompt_in2 = ' .\\D.: ', |
|
200 | prompt_in2 = ' .\\D.: ', | |
199 | prompt_out = 'Out[\\#]: ', |
|
201 | prompt_out = 'Out[\\#]: ', | |
200 | prompts_pad_left = 1, |
|
202 | prompts_pad_left = 1, | |
201 | quick = 0, |
|
203 | quick = 0, | |
202 | readline = 1, |
|
204 | readline = 1, | |
203 | readline_merge_completions = 1, |
|
205 | readline_merge_completions = 1, | |
204 | readline_omit__names = 0, |
|
206 | readline_omit__names = 0, | |
205 | rcfile = 'ipythonrc' + rc_suffix, |
|
207 | rcfile = 'ipythonrc' + rc_suffix, | |
206 | screen_length = 0, |
|
208 | screen_length = 0, | |
207 | separate_in = '\n', |
|
209 | separate_in = '\n', | |
208 | separate_out = '\n', |
|
210 | separate_out = '\n', | |
209 | separate_out2 = '', |
|
211 | separate_out2 = '', | |
210 | system_verbose = 0, |
|
212 | system_verbose = 0, | |
211 | gthread = 0, |
|
213 | gthread = 0, | |
212 | qthread = 0, |
|
214 | qthread = 0, | |
213 | wthread = 0, |
|
215 | wthread = 0, | |
214 | pylab = 0, |
|
216 | pylab = 0, | |
215 | tk = 0, |
|
217 | tk = 0, | |
216 | upgrade = 0, |
|
218 | upgrade = 0, | |
217 | Version = 0, |
|
219 | Version = 0, | |
218 | xmode = 'Verbose', |
|
220 | xmode = 'Verbose', | |
219 | magic_docstrings = 0, # undocumented, for doc generation |
|
221 | magic_docstrings = 0, # undocumented, for doc generation | |
220 | ) |
|
222 | ) | |
221 |
|
223 | |||
222 | # Things that will *only* appear in rcfiles (not at the command line). |
|
224 | # Things that will *only* appear in rcfiles (not at the command line). | |
223 | # Make sure there's a space before each end of line (they get auto-joined!) |
|
225 | # Make sure there's a space before each end of line (they get auto-joined!) | |
224 | rcfile_opts = { qwflat: 'include import_mod import_all execfile ', |
|
226 | rcfile_opts = { qwflat: 'include import_mod import_all execfile ', | |
225 | qw_lol: 'import_some ', |
|
227 | qw_lol: 'import_some ', | |
226 | # for things with embedded whitespace: |
|
228 | # for things with embedded whitespace: | |
227 | list_strings:'execute alias readline_parse_and_bind ', |
|
229 | list_strings:'execute alias readline_parse_and_bind ', | |
228 | # Regular strings need no conversion: |
|
230 | # Regular strings need no conversion: | |
229 | None:'readline_remove_delims ', |
|
231 | None:'readline_remove_delims ', | |
230 | } |
|
232 | } | |
231 | # Default values for these |
|
233 | # Default values for these | |
232 | rc_def = Struct(include = [], |
|
234 | rc_def = Struct(include = [], | |
233 | import_mod = [], |
|
235 | import_mod = [], | |
234 | import_all = [], |
|
236 | import_all = [], | |
235 | import_some = [[]], |
|
237 | import_some = [[]], | |
236 | execute = [], |
|
238 | execute = [], | |
237 | execfile = [], |
|
239 | execfile = [], | |
238 | alias = [], |
|
240 | alias = [], | |
239 | readline_parse_and_bind = [], |
|
241 | readline_parse_and_bind = [], | |
240 | readline_remove_delims = '', |
|
242 | readline_remove_delims = '', | |
241 | ) |
|
243 | ) | |
242 |
|
244 | |||
243 | # Build the type conversion dictionary from the above tables: |
|
245 | # Build the type conversion dictionary from the above tables: | |
244 | typeconv = rcfile_opts.copy() |
|
246 | typeconv = rcfile_opts.copy() | |
245 | typeconv.update(optstr2types(cmdline_opts)) |
|
247 | typeconv.update(optstr2types(cmdline_opts)) | |
246 |
|
248 | |||
247 | # FIXME: the None key appears in both, put that back together by hand. Ugly! |
|
249 | # FIXME: the None key appears in both, put that back together by hand. Ugly! | |
248 | typeconv[None] += ' ' + rcfile_opts[None] |
|
250 | typeconv[None] += ' ' + rcfile_opts[None] | |
249 |
|
251 | |||
250 | # Remove quotes at ends of all strings (used to protect spaces) |
|
252 | # Remove quotes at ends of all strings (used to protect spaces) | |
251 | typeconv[unquote_ends] = typeconv[None] |
|
253 | typeconv[unquote_ends] = typeconv[None] | |
252 | del typeconv[None] |
|
254 | del typeconv[None] | |
253 |
|
255 | |||
254 | # Build the list we'll use to make all config decisions with defaults: |
|
256 | # Build the list we'll use to make all config decisions with defaults: | |
255 | opts_all = opts_def.copy() |
|
257 | opts_all = opts_def.copy() | |
256 | opts_all.update(rc_def) |
|
258 | opts_all.update(rc_def) | |
257 |
|
259 | |||
258 | # Build conflict resolver for recursive loading of config files: |
|
260 | # Build conflict resolver for recursive loading of config files: | |
259 | # - preserve means the outermost file maintains the value, it is not |
|
261 | # - preserve means the outermost file maintains the value, it is not | |
260 | # overwritten if an included file has the same key. |
|
262 | # overwritten if an included file has the same key. | |
261 | # - add_flip applies + to the two values, so it better make sense to add |
|
263 | # - add_flip applies + to the two values, so it better make sense to add | |
262 | # those types of keys. But it flips them first so that things loaded |
|
264 | # those types of keys. But it flips them first so that things loaded | |
263 | # deeper in the inclusion chain have lower precedence. |
|
265 | # deeper in the inclusion chain have lower precedence. | |
264 | conflict = {'preserve': ' '.join([ typeconv[int], |
|
266 | conflict = {'preserve': ' '.join([ typeconv[int], | |
265 | typeconv[unquote_ends] ]), |
|
267 | typeconv[unquote_ends] ]), | |
266 | 'add_flip': ' '.join([ typeconv[qwflat], |
|
268 | 'add_flip': ' '.join([ typeconv[qwflat], | |
267 | typeconv[qw_lol], |
|
269 | typeconv[qw_lol], | |
268 | typeconv[list_strings] ]) |
|
270 | typeconv[list_strings] ]) | |
269 | } |
|
271 | } | |
270 |
|
272 | |||
271 | # Now actually process the command line |
|
273 | # Now actually process the command line | |
272 | getopt = DPyGetOpt.DPyGetOpt() |
|
274 | getopt = DPyGetOpt.DPyGetOpt() | |
273 | getopt.setIgnoreCase(0) |
|
275 | getopt.setIgnoreCase(0) | |
274 |
|
276 | |||
275 | getopt.parseConfiguration(opts_names) |
|
277 | getopt.parseConfiguration(opts_names) | |
276 |
|
278 | |||
277 | try: |
|
279 | try: | |
278 | getopt.processArguments(argv) |
|
280 | getopt.processArguments(argv) | |
279 | except: |
|
281 | except: | |
280 | print cmd_line_usage |
|
282 | print cmd_line_usage | |
281 | warn('\nError in Arguments: ' + `sys.exc_value`) |
|
283 | warn('\nError in Arguments: ' + `sys.exc_value`) | |
282 | sys.exit() |
|
284 | sys.exit() | |
283 |
|
285 | |||
284 | # convert the options dict to a struct for much lighter syntax later |
|
286 | # convert the options dict to a struct for much lighter syntax later | |
285 | opts = Struct(getopt.optionValues) |
|
287 | opts = Struct(getopt.optionValues) | |
286 | args = getopt.freeValues |
|
288 | args = getopt.freeValues | |
287 |
|
289 | |||
288 | # this is the struct (which has default values at this point) with which |
|
290 | # this is the struct (which has default values at this point) with which | |
289 | # we make all decisions: |
|
291 | # we make all decisions: | |
290 | opts_all.update(opts) |
|
292 | opts_all.update(opts) | |
291 |
|
293 | |||
292 | # Options that force an immediate exit |
|
294 | # Options that force an immediate exit | |
293 | if opts_all.help: |
|
295 | if opts_all.help: | |
294 | page(cmd_line_usage) |
|
296 | page(cmd_line_usage) | |
295 | sys.exit() |
|
297 | sys.exit() | |
296 |
|
298 | |||
297 | if opts_all.Version: |
|
299 | if opts_all.Version: | |
298 | print __version__ |
|
300 | print __version__ | |
299 | sys.exit() |
|
301 | sys.exit() | |
300 |
|
302 | |||
301 | if opts_all.magic_docstrings: |
|
303 | if opts_all.magic_docstrings: | |
302 | IP.magic_magic('-latex') |
|
304 | IP.magic_magic('-latex') | |
303 | sys.exit() |
|
305 | sys.exit() | |
304 |
|
306 | |||
305 | # Create user config directory if it doesn't exist. This must be done |
|
307 | # Create user config directory if it doesn't exist. This must be done | |
306 | # *after* getting the cmd line options. |
|
308 | # *after* getting the cmd line options. | |
307 | if not os.path.isdir(opts_all.ipythondir): |
|
309 | if not os.path.isdir(opts_all.ipythondir): | |
308 | IP.user_setup(opts_all.ipythondir,rc_suffix,'install') |
|
310 | IP.user_setup(opts_all.ipythondir,rc_suffix,'install') | |
309 |
|
311 | |||
310 | # upgrade user config files while preserving a copy of the originals |
|
312 | # upgrade user config files while preserving a copy of the originals | |
311 | if opts_all.upgrade: |
|
313 | if opts_all.upgrade: | |
312 | IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade') |
|
314 | IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade') | |
313 |
|
315 | |||
314 | # check mutually exclusive options in the *original* command line |
|
316 | # check mutually exclusive options in the *original* command line | |
315 | mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'), |
|
317 | mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'), | |
316 | qw('classic profile'),qw('classic rcfile')]) |
|
318 | qw('classic profile'),qw('classic rcfile')]) | |
317 |
|
319 | |||
318 | # default logfilename used when -log is called. |
|
320 | # default logfilename used when -log is called. | |
319 | IP.LOGDEF = 'ipython.log' |
|
321 | IP.LOGDEF = 'ipython.log' | |
320 |
|
322 | |||
321 | #--------------------------------------------------------------------------- |
|
323 | #--------------------------------------------------------------------------- | |
322 | # Log replay |
|
324 | # Log replay | |
323 |
|
325 | |||
324 | # if -logplay, we need to 'become' the other session. That basically means |
|
326 | # if -logplay, we need to 'become' the other session. That basically means | |
325 | # replacing the current command line environment with that of the old |
|
327 | # replacing the current command line environment with that of the old | |
326 | # session and moving on. |
|
328 | # session and moving on. | |
327 |
|
329 | |||
328 | # this is needed so that later we know we're in session reload mode, as |
|
330 | # this is needed so that later we know we're in session reload mode, as | |
329 | # opts_all will get overwritten: |
|
331 | # opts_all will get overwritten: | |
330 | load_logplay = 0 |
|
332 | load_logplay = 0 | |
331 |
|
333 | |||
332 | if opts_all.logplay: |
|
334 | if opts_all.logplay: | |
333 | load_logplay = opts_all.logplay |
|
335 | load_logplay = opts_all.logplay | |
334 | opts_debug_save = opts_all.debug |
|
336 | opts_debug_save = opts_all.debug | |
335 | try: |
|
337 | try: | |
336 | logplay = open(opts_all.logplay) |
|
338 | logplay = open(opts_all.logplay) | |
337 | except IOError: |
|
339 | except IOError: | |
338 | if opts_all.debug: IP.InteractiveTB() |
|
340 | if opts_all.debug: IP.InteractiveTB() | |
339 | warn('Could not open logplay file '+`opts_all.logplay`) |
|
341 | warn('Could not open logplay file '+`opts_all.logplay`) | |
340 | # restore state as if nothing had happened and move on, but make |
|
342 | # restore state as if nothing had happened and move on, but make | |
341 | # sure that later we don't try to actually load the session file |
|
343 | # sure that later we don't try to actually load the session file | |
342 | logplay = None |
|
344 | logplay = None | |
343 | load_logplay = 0 |
|
345 | load_logplay = 0 | |
344 | del opts_all.logplay |
|
346 | del opts_all.logplay | |
345 | else: |
|
347 | else: | |
346 | try: |
|
348 | try: | |
347 | logplay.readline() |
|
349 | logplay.readline() | |
348 | logplay.readline(); |
|
350 | logplay.readline(); | |
349 | # this reloads that session's command line |
|
351 | # this reloads that session's command line | |
350 | cmd = logplay.readline()[6:] |
|
352 | cmd = logplay.readline()[6:] | |
351 | exec cmd |
|
353 | exec cmd | |
352 | # restore the true debug flag given so that the process of |
|
354 | # restore the true debug flag given so that the process of | |
353 | # session loading itself can be monitored. |
|
355 | # session loading itself can be monitored. | |
354 | opts.debug = opts_debug_save |
|
356 | opts.debug = opts_debug_save | |
355 | # save the logplay flag so later we don't overwrite the log |
|
357 | # save the logplay flag so later we don't overwrite the log | |
356 | opts.logplay = load_logplay |
|
358 | opts.logplay = load_logplay | |
357 | # now we must update our own structure with defaults |
|
359 | # now we must update our own structure with defaults | |
358 | opts_all.update(opts) |
|
360 | opts_all.update(opts) | |
359 | # now load args |
|
361 | # now load args | |
360 | cmd = logplay.readline()[6:] |
|
362 | cmd = logplay.readline()[6:] | |
361 | exec cmd |
|
363 | exec cmd | |
362 | logplay.close() |
|
364 | logplay.close() | |
363 | except: |
|
365 | except: | |
364 | logplay.close() |
|
366 | logplay.close() | |
365 | if opts_all.debug: IP.InteractiveTB() |
|
367 | if opts_all.debug: IP.InteractiveTB() | |
366 | warn("Logplay file lacking full configuration information.\n" |
|
368 | warn("Logplay file lacking full configuration information.\n" | |
367 | "I'll try to read it, but some things may not work.") |
|
369 | "I'll try to read it, but some things may not work.") | |
368 |
|
370 | |||
369 | #------------------------------------------------------------------------- |
|
371 | #------------------------------------------------------------------------- | |
370 | # set up output traps: catch all output from files, being run, modules |
|
372 | # set up output traps: catch all output from files, being run, modules | |
371 | # loaded, etc. Then give it to the user in a clean form at the end. |
|
373 | # loaded, etc. Then give it to the user in a clean form at the end. | |
372 |
|
374 | |||
373 | msg_out = 'Output messages. ' |
|
375 | msg_out = 'Output messages. ' | |
374 | msg_err = 'Error messages. ' |
|
376 | msg_err = 'Error messages. ' | |
375 | msg_sep = '\n' |
|
377 | msg_sep = '\n' | |
376 | msg = Struct(config = OutputTrap('Configuration Loader',msg_out, |
|
378 | msg = Struct(config = OutputTrap('Configuration Loader',msg_out, | |
377 | msg_err,msg_sep,debug, |
|
379 | msg_err,msg_sep,debug, | |
378 | quiet_out=1), |
|
380 | quiet_out=1), | |
379 | user_exec = OutputTrap('User File Execution',msg_out, |
|
381 | user_exec = OutputTrap('User File Execution',msg_out, | |
380 | msg_err,msg_sep,debug), |
|
382 | msg_err,msg_sep,debug), | |
381 | logplay = OutputTrap('Log Loader',msg_out, |
|
383 | logplay = OutputTrap('Log Loader',msg_out, | |
382 | msg_err,msg_sep,debug), |
|
384 | msg_err,msg_sep,debug), | |
383 | summary = '' |
|
385 | summary = '' | |
384 | ) |
|
386 | ) | |
385 |
|
387 | |||
386 | #------------------------------------------------------------------------- |
|
388 | #------------------------------------------------------------------------- | |
387 | # Process user ipythonrc-type configuration files |
|
389 | # Process user ipythonrc-type configuration files | |
388 |
|
390 | |||
389 | # turn on output trapping and log to msg.config |
|
391 | # turn on output trapping and log to msg.config | |
390 | # remember that with debug on, trapping is actually disabled |
|
392 | # remember that with debug on, trapping is actually disabled | |
391 | msg.config.trap_all() |
|
393 | msg.config.trap_all() | |
392 |
|
394 | |||
393 | # look for rcfile in current or default directory |
|
395 | # look for rcfile in current or default directory | |
394 | try: |
|
396 | try: | |
395 | opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir) |
|
397 | opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir) | |
396 | except IOError: |
|
398 | except IOError: | |
397 | if opts_all.debug: IP.InteractiveTB() |
|
399 | if opts_all.debug: IP.InteractiveTB() | |
398 | warn('Configuration file %s not found. Ignoring request.' |
|
400 | warn('Configuration file %s not found. Ignoring request.' | |
399 | % (opts_all.rcfile) ) |
|
401 | % (opts_all.rcfile) ) | |
400 |
|
402 | |||
401 | # 'profiles' are a shorthand notation for config filenames |
|
403 | # 'profiles' are a shorthand notation for config filenames | |
402 | if opts_all.profile: |
|
404 | if opts_all.profile: | |
403 | try: |
|
405 | try: | |
404 | opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile |
|
406 | opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile | |
405 | + rc_suffix, |
|
407 | + rc_suffix, | |
406 | opts_all.ipythondir) |
|
408 | opts_all.ipythondir) | |
407 | except IOError: |
|
409 | except IOError: | |
408 | if opts_all.debug: IP.InteractiveTB() |
|
410 | if opts_all.debug: IP.InteractiveTB() | |
409 | opts.profile = '' # remove profile from options if invalid |
|
411 | opts.profile = '' # remove profile from options if invalid | |
410 | warn('Profile configuration file %s not found. Ignoring request.' |
|
412 | warn('Profile configuration file %s not found. Ignoring request.' | |
411 | % (opts_all.profile) ) |
|
413 | % (opts_all.profile) ) | |
412 |
|
414 | |||
413 | # load the config file |
|
415 | # load the config file | |
414 | rcfiledata = None |
|
416 | rcfiledata = None | |
415 | if opts_all.quick: |
|
417 | if opts_all.quick: | |
416 | print 'Launching IPython in quick mode. No config file read.' |
|
418 | print 'Launching IPython in quick mode. No config file read.' | |
417 | elif opts_all.classic: |
|
419 | elif opts_all.classic: | |
418 | print 'Launching IPython in classic mode. No config file read.' |
|
420 | print 'Launching IPython in classic mode. No config file read.' | |
419 | elif opts_all.rcfile: |
|
421 | elif opts_all.rcfile: | |
420 | try: |
|
422 | try: | |
421 | cfg_loader = ConfigLoader(conflict) |
|
423 | cfg_loader = ConfigLoader(conflict) | |
422 | rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv, |
|
424 | rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv, | |
423 | 'include',opts_all.ipythondir, |
|
425 | 'include',opts_all.ipythondir, | |
424 | purge = 1, |
|
426 | purge = 1, | |
425 | unique = conflict['preserve']) |
|
427 | unique = conflict['preserve']) | |
426 | except: |
|
428 | except: | |
427 | IP.InteractiveTB() |
|
429 | IP.InteractiveTB() | |
428 | warn('Problems loading configuration file '+ |
|
430 | warn('Problems loading configuration file '+ | |
429 | `opts_all.rcfile`+ |
|
431 | `opts_all.rcfile`+ | |
430 | '\nStarting with default -bare bones- configuration.') |
|
432 | '\nStarting with default -bare bones- configuration.') | |
431 | else: |
|
433 | else: | |
432 | warn('No valid configuration file found in either currrent directory\n'+ |
|
434 | warn('No valid configuration file found in either currrent directory\n'+ | |
433 | 'or in the IPython config. directory: '+`opts_all.ipythondir`+ |
|
435 | 'or in the IPython config. directory: '+`opts_all.ipythondir`+ | |
434 | '\nProceeding with internal defaults.') |
|
436 | '\nProceeding with internal defaults.') | |
435 |
|
437 | |||
436 | #------------------------------------------------------------------------ |
|
438 | #------------------------------------------------------------------------ | |
437 | # Set exception handlers in mode requested by user. |
|
439 | # Set exception handlers in mode requested by user. | |
438 | otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode |
|
440 | otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode | |
439 | IP.magic_xmode(opts_all.xmode) |
|
441 | IP.magic_xmode(opts_all.xmode) | |
440 | otrap.release_out() |
|
442 | otrap.release_out() | |
441 |
|
443 | |||
442 | #------------------------------------------------------------------------ |
|
444 | #------------------------------------------------------------------------ | |
443 | # Execute user config |
|
445 | # Execute user config | |
444 |
|
446 | |||
445 | # first, create a valid config structure with the right precedence order: |
|
447 | # first, create a valid config structure with the right precedence order: | |
446 | # defaults < rcfile < command line |
|
448 | # defaults < rcfile < command line | |
447 | IP.rc = rc_def.copy() |
|
449 | IP.rc = rc_def.copy() | |
448 | IP.rc.update(opts_def) |
|
450 | IP.rc.update(opts_def) | |
449 | if rcfiledata: |
|
451 | if rcfiledata: | |
450 | # now we can update |
|
452 | # now we can update | |
451 | IP.rc.update(rcfiledata) |
|
453 | IP.rc.update(rcfiledata) | |
452 | IP.rc.update(opts) |
|
454 | IP.rc.update(opts) | |
453 | IP.rc.update(rc_override) |
|
455 | IP.rc.update(rc_override) | |
454 |
|
456 | |||
455 | # Store the original cmd line for reference: |
|
457 | # Store the original cmd line for reference: | |
456 | IP.rc.opts = opts |
|
458 | IP.rc.opts = opts | |
457 | IP.rc.args = args |
|
459 | IP.rc.args = args | |
458 |
|
460 | |||
459 | # create a *runtime* Struct like rc for holding parameters which may be |
|
461 | # create a *runtime* Struct like rc for holding parameters which may be | |
460 | # created and/or modified by runtime user extensions. |
|
462 | # created and/or modified by runtime user extensions. | |
461 | IP.runtime_rc = Struct() |
|
463 | IP.runtime_rc = Struct() | |
462 |
|
464 | |||
463 | # from this point on, all config should be handled through IP.rc, |
|
465 | # from this point on, all config should be handled through IP.rc, | |
464 | # opts* shouldn't be used anymore. |
|
466 | # opts* shouldn't be used anymore. | |
465 |
|
467 | |||
466 | # add personal .ipython dir to sys.path so that users can put things in |
|
468 | # add personal .ipython dir to sys.path so that users can put things in | |
467 | # there for customization |
|
469 | # there for customization | |
468 | sys.path.append(IP.rc.ipythondir) |
|
470 | sys.path.append(IP.rc.ipythondir) | |
469 | sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran |
|
471 | sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran | |
470 |
|
472 | |||
471 | # update IP.rc with some special things that need manual |
|
473 | # update IP.rc with some special things that need manual | |
472 | # tweaks. Basically options which affect other options. I guess this |
|
474 | # tweaks. Basically options which affect other options. I guess this | |
473 | # should just be written so that options are fully orthogonal and we |
|
475 | # should just be written so that options are fully orthogonal and we | |
474 | # wouldn't worry about this stuff! |
|
476 | # wouldn't worry about this stuff! | |
475 |
|
477 | |||
476 | if IP.rc.classic: |
|
478 | if IP.rc.classic: | |
477 | IP.rc.quick = 1 |
|
479 | IP.rc.quick = 1 | |
478 | IP.rc.cache_size = 0 |
|
480 | IP.rc.cache_size = 0 | |
479 | IP.rc.pprint = 0 |
|
481 | IP.rc.pprint = 0 | |
480 | IP.rc.prompt_in1 = '>>> ' |
|
482 | IP.rc.prompt_in1 = '>>> ' | |
481 | IP.rc.prompt_in2 = '... ' |
|
483 | IP.rc.prompt_in2 = '... ' | |
482 | IP.rc.prompt_out = '' |
|
484 | IP.rc.prompt_out = '' | |
483 | IP.rc.separate_in = IP.rc.separate_out = IP.rc.separate_out2 = '0' |
|
485 | IP.rc.separate_in = IP.rc.separate_out = IP.rc.separate_out2 = '0' | |
484 | IP.rc.colors = 'NoColor' |
|
486 | IP.rc.colors = 'NoColor' | |
485 | IP.rc.xmode = 'Plain' |
|
487 | IP.rc.xmode = 'Plain' | |
486 |
|
488 | |||
487 | # configure readline |
|
489 | # configure readline | |
488 | # Define the history file for saving commands in between sessions |
|
490 | # Define the history file for saving commands in between sessions | |
489 | if IP.rc.profile: |
|
491 | if IP.rc.profile: | |
490 | histfname = 'history-%s' % IP.rc.profile |
|
492 | histfname = 'history-%s' % IP.rc.profile | |
491 | else: |
|
493 | else: | |
492 | histfname = 'history' |
|
494 | histfname = 'history' | |
493 | IP.histfile = os.path.join(opts_all.ipythondir,histfname) |
|
495 | IP.histfile = os.path.join(opts_all.ipythondir,histfname) | |
494 | # Load readline proper |
|
496 | # Load readline proper | |
495 | if IP.rc.readline: |
|
497 | if IP.rc.readline: | |
496 | IP.init_readline() |
|
498 | IP.init_readline() | |
497 |
|
499 | |||
498 | # update exception handlers with rc file status |
|
500 | # update exception handlers with rc file status | |
499 | otrap.trap_out() # I don't want these messages ever. |
|
501 | otrap.trap_out() # I don't want these messages ever. | |
500 | IP.magic_xmode(IP.rc.xmode) |
|
502 | IP.magic_xmode(IP.rc.xmode) | |
501 | otrap.release_out() |
|
503 | otrap.release_out() | |
502 |
|
504 | |||
503 | # activate logging if requested and not reloading a log |
|
505 | # activate logging if requested and not reloading a log | |
504 | if IP.rc.logplay: |
|
506 | if IP.rc.logplay: | |
505 | IP.magic_logstart(IP.rc.logplay + ' append') |
|
507 | IP.magic_logstart(IP.rc.logplay + ' append') | |
506 | elif IP.rc.logfile: |
|
508 | elif IP.rc.logfile: | |
507 | IP.magic_logstart(IP.rc.logfile) |
|
509 | IP.magic_logstart(IP.rc.logfile) | |
508 | elif IP.rc.log: |
|
510 | elif IP.rc.log: | |
509 | IP.magic_logstart() |
|
511 | IP.magic_logstart() | |
510 |
|
512 | |||
511 | # find user editor so that it we don't have to look it up constantly |
|
513 | # find user editor so that it we don't have to look it up constantly | |
512 | if IP.rc.editor.strip()=='0': |
|
514 | if IP.rc.editor.strip()=='0': | |
513 | try: |
|
515 | try: | |
514 | ed = os.environ['EDITOR'] |
|
516 | ed = os.environ['EDITOR'] | |
515 | except KeyError: |
|
517 | except KeyError: | |
516 | if os.name == 'posix': |
|
518 | if os.name == 'posix': | |
517 | ed = 'vi' # the only one guaranteed to be there! |
|
519 | ed = 'vi' # the only one guaranteed to be there! | |
518 | else: |
|
520 | else: | |
519 | ed = 'notepad' # same in Windows! |
|
521 | ed = 'notepad' # same in Windows! | |
520 | IP.rc.editor = ed |
|
522 | IP.rc.editor = ed | |
521 |
|
523 | |||
522 | # Recursive reload |
|
524 | # Recursive reload | |
523 | try: |
|
525 | try: | |
524 | from IPython import deep_reload |
|
526 | from IPython import deep_reload | |
525 | if IP.rc.deep_reload: |
|
527 | if IP.rc.deep_reload: | |
526 | __builtin__.reload = deep_reload.reload |
|
528 | __builtin__.reload = deep_reload.reload | |
527 | else: |
|
529 | else: | |
528 | __builtin__.dreload = deep_reload.reload |
|
530 | __builtin__.dreload = deep_reload.reload | |
529 | del deep_reload |
|
531 | del deep_reload | |
530 | except ImportError: |
|
532 | except ImportError: | |
531 | pass |
|
533 | pass | |
532 |
|
534 | |||
533 | # Save the current state of our namespace so that the interactive shell |
|
535 | # Save the current state of our namespace so that the interactive shell | |
534 | # can later know which variables have been created by us from config files |
|
536 | # can later know which variables have been created by us from config files | |
535 | # and loading. This way, loading a file (in any way) is treated just like |
|
537 | # and loading. This way, loading a file (in any way) is treated just like | |
536 | # defining things on the command line, and %who works as expected. |
|
538 | # defining things on the command line, and %who works as expected. | |
537 |
|
539 | |||
538 | # DON'T do anything that affects the namespace beyond this point! |
|
540 | # DON'T do anything that affects the namespace beyond this point! | |
539 | IP.internal_ns = __main__.__dict__.copy() |
|
541 | IP.internal_ns = __main__.__dict__.copy() | |
540 |
|
542 | |||
541 | #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who |
|
543 | #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who | |
542 |
|
544 | |||
543 | # Now run through the different sections of the users's config |
|
545 | # Now run through the different sections of the users's config | |
544 | if IP.rc.debug: |
|
546 | if IP.rc.debug: | |
545 | print 'Trying to execute the following configuration structure:' |
|
547 | print 'Trying to execute the following configuration structure:' | |
546 | print '(Things listed first are deeper in the inclusion tree and get' |
|
548 | print '(Things listed first are deeper in the inclusion tree and get' | |
547 | print 'loaded first).\n' |
|
549 | print 'loaded first).\n' | |
548 | pprint(IP.rc.__dict__) |
|
550 | pprint(IP.rc.__dict__) | |
549 |
|
551 | |||
550 | for mod in IP.rc.import_mod: |
|
552 | for mod in IP.rc.import_mod: | |
551 | try: |
|
553 | try: | |
552 | exec 'import '+mod in IP.user_ns |
|
554 | exec 'import '+mod in IP.user_ns | |
553 | except : |
|
555 | except : | |
554 | IP.InteractiveTB() |
|
556 | IP.InteractiveTB() | |
555 | import_fail_info(mod) |
|
557 | import_fail_info(mod) | |
556 |
|
558 | |||
557 | for mod_fn in IP.rc.import_some: |
|
559 | for mod_fn in IP.rc.import_some: | |
558 | if mod_fn == []: break |
|
560 | if mod_fn == []: break | |
559 | mod,fn = mod_fn[0],','.join(mod_fn[1:]) |
|
561 | mod,fn = mod_fn[0],','.join(mod_fn[1:]) | |
560 | try: |
|
562 | try: | |
561 | exec 'from '+mod+' import '+fn in IP.user_ns |
|
563 | exec 'from '+mod+' import '+fn in IP.user_ns | |
562 | except : |
|
564 | except : | |
563 | IP.InteractiveTB() |
|
565 | IP.InteractiveTB() | |
564 | import_fail_info(mod,fn) |
|
566 | import_fail_info(mod,fn) | |
565 |
|
567 | |||
566 | for mod in IP.rc.import_all: |
|
568 | for mod in IP.rc.import_all: | |
567 | try: |
|
569 | try: | |
568 | exec 'from '+mod+' import *' in IP.user_ns |
|
570 | exec 'from '+mod+' import *' in IP.user_ns | |
569 | except : |
|
571 | except : | |
570 | IP.InteractiveTB() |
|
572 | IP.InteractiveTB() | |
571 | import_fail_info(mod) |
|
573 | import_fail_info(mod) | |
572 |
|
574 | |||
573 | for code in IP.rc.execute: |
|
575 | for code in IP.rc.execute: | |
574 | try: |
|
576 | try: | |
575 | exec code in IP.user_ns |
|
577 | exec code in IP.user_ns | |
576 | except: |
|
578 | except: | |
577 | IP.InteractiveTB() |
|
579 | IP.InteractiveTB() | |
578 | warn('Failure executing code: ' + `code`) |
|
580 | warn('Failure executing code: ' + `code`) | |
579 |
|
581 | |||
580 | # Execute the files the user wants in ipythonrc |
|
582 | # Execute the files the user wants in ipythonrc | |
581 | for file in IP.rc.execfile: |
|
583 | for file in IP.rc.execfile: | |
582 | try: |
|
584 | try: | |
583 | file = filefind(file,sys.path+[IPython_dir]) |
|
585 | file = filefind(file,sys.path+[IPython_dir]) | |
584 | except IOError: |
|
586 | except IOError: | |
585 | warn(itpl('File $file not found. Skipping it.')) |
|
587 | warn(itpl('File $file not found. Skipping it.')) | |
586 | else: |
|
588 | else: | |
587 | IP.safe_execfile(os.path.expanduser(file),IP.user_ns) |
|
589 | IP.safe_execfile(os.path.expanduser(file),IP.user_ns) | |
588 |
|
590 | |||
589 | # Load user aliases |
|
591 | # Load user aliases | |
590 | for alias in IP.rc.alias: |
|
592 | for alias in IP.rc.alias: | |
591 | IP.magic_alias(alias) |
|
593 | IP.magic_alias(alias) | |
592 |
|
594 | |||
593 | # release stdout and stderr and save config log into a global summary |
|
595 | # release stdout and stderr and save config log into a global summary | |
594 | msg.config.release_all() |
|
596 | msg.config.release_all() | |
595 | if IP.rc.messages: |
|
597 | if IP.rc.messages: | |
596 | msg.summary += msg.config.summary_all() |
|
598 | msg.summary += msg.config.summary_all() | |
597 |
|
599 | |||
598 | #------------------------------------------------------------------------ |
|
600 | #------------------------------------------------------------------------ | |
599 | # Setup interactive session |
|
601 | # Setup interactive session | |
600 |
|
602 | |||
601 | # Now we should be fully configured. We can then execute files or load |
|
603 | # Now we should be fully configured. We can then execute files or load | |
602 | # things only needed for interactive use. Then we'll open the shell. |
|
604 | # things only needed for interactive use. Then we'll open the shell. | |
603 |
|
605 | |||
604 | # Take a snapshot of the user namespace before opening the shell. That way |
|
606 | # Take a snapshot of the user namespace before opening the shell. That way | |
605 | # we'll be able to identify which things were interactively defined and |
|
607 | # we'll be able to identify which things were interactively defined and | |
606 | # which were defined through config files. |
|
608 | # which were defined through config files. | |
607 | IP.user_config_ns = IP.user_ns.copy() |
|
609 | IP.user_config_ns = IP.user_ns.copy() | |
608 |
|
610 | |||
609 | # Force reading a file as if it were a session log. Slower but safer. |
|
611 | # Force reading a file as if it were a session log. Slower but safer. | |
610 | if load_logplay: |
|
612 | if load_logplay: | |
611 | print 'Replaying log...' |
|
613 | print 'Replaying log...' | |
612 | try: |
|
614 | try: | |
613 | if IP.rc.debug: |
|
615 | if IP.rc.debug: | |
614 | logplay_quiet = 0 |
|
616 | logplay_quiet = 0 | |
615 | else: |
|
617 | else: | |
616 | logplay_quiet = 1 |
|
618 | logplay_quiet = 1 | |
617 |
|
619 | |||
618 | msg.logplay.trap_all() |
|
620 | msg.logplay.trap_all() | |
619 | IP.safe_execfile(load_logplay,IP.user_ns, |
|
621 | IP.safe_execfile(load_logplay,IP.user_ns, | |
620 | islog = 1, quiet = logplay_quiet) |
|
622 | islog = 1, quiet = logplay_quiet) | |
621 | msg.logplay.release_all() |
|
623 | msg.logplay.release_all() | |
622 | if IP.rc.messages: |
|
624 | if IP.rc.messages: | |
623 | msg.summary += msg.logplay.summary_all() |
|
625 | msg.summary += msg.logplay.summary_all() | |
624 | except: |
|
626 | except: | |
625 | warn('Problems replaying logfile %s.' % load_logplay) |
|
627 | warn('Problems replaying logfile %s.' % load_logplay) | |
626 | IP.InteractiveTB() |
|
628 | IP.InteractiveTB() | |
627 |
|
629 | |||
628 | # Load remaining files in command line |
|
630 | # Load remaining files in command line | |
629 | msg.user_exec.trap_all() |
|
631 | msg.user_exec.trap_all() | |
630 |
|
632 | |||
631 | # Do NOT execute files named in the command line as scripts to be loaded |
|
633 | # Do NOT execute files named in the command line as scripts to be loaded | |
632 | # by embedded instances. Doing so has the potential for an infinite |
|
634 | # by embedded instances. Doing so has the potential for an infinite | |
633 | # recursion if there are exceptions thrown in the process. |
|
635 | # recursion if there are exceptions thrown in the process. | |
634 |
|
636 | |||
635 | # XXX FIXME: the execution of user files should be moved out to after |
|
637 | # XXX FIXME: the execution of user files should be moved out to after | |
636 | # ipython is fully initialized, just as if they were run via %run at the |
|
638 | # ipython is fully initialized, just as if they were run via %run at the | |
637 | # ipython prompt. This would also give them the benefit of ipython's |
|
639 | # ipython prompt. This would also give them the benefit of ipython's | |
638 | # nice tracebacks. |
|
640 | # nice tracebacks. | |
639 |
|
641 | |||
640 | if not embedded and IP.rc.args: |
|
642 | if not embedded and IP.rc.args: | |
641 | name_save = IP.user_ns['__name__'] |
|
643 | name_save = IP.user_ns['__name__'] | |
642 | IP.user_ns['__name__'] = '__main__' |
|
644 | IP.user_ns['__name__'] = '__main__' | |
643 | try: |
|
645 | try: | |
644 | # Set our own excepthook in case the user code tries to call it |
|
646 | # Set our own excepthook in case the user code tries to call it | |
645 | # directly. This prevents triggering the IPython crash handler. |
|
647 | # directly. This prevents triggering the IPython crash handler. | |
646 | old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook |
|
648 | old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook | |
647 | for run in args: |
|
649 | for run in args: | |
648 | IP.safe_execfile(run,IP.user_ns) |
|
650 | IP.safe_execfile(run,IP.user_ns) | |
649 | finally: |
|
651 | finally: | |
650 | # Reset our crash handler in place |
|
652 | # Reset our crash handler in place | |
651 | sys.excepthook = old_excepthook |
|
653 | sys.excepthook = old_excepthook | |
652 |
|
654 | |||
653 | IP.user_ns['__name__'] = name_save |
|
655 | IP.user_ns['__name__'] = name_save | |
654 |
|
656 | |||
655 | msg.user_exec.release_all() |
|
657 | msg.user_exec.release_all() | |
656 | if IP.rc.messages: |
|
658 | if IP.rc.messages: | |
657 | msg.summary += msg.user_exec.summary_all() |
|
659 | msg.summary += msg.user_exec.summary_all() | |
658 |
|
660 | |||
659 | # since we can't specify a null string on the cmd line, 0 is the equivalent: |
|
661 | # since we can't specify a null string on the cmd line, 0 is the equivalent: | |
660 | if IP.rc.nosep: |
|
662 | if IP.rc.nosep: | |
661 | IP.rc.separate_in = IP.rc.separate_out = IP.rc.separate_out2 = '0' |
|
663 | IP.rc.separate_in = IP.rc.separate_out = IP.rc.separate_out2 = '0' | |
662 | if IP.rc.separate_in == '0': IP.rc.separate_in = '' |
|
664 | if IP.rc.separate_in == '0': IP.rc.separate_in = '' | |
663 | if IP.rc.separate_out == '0': IP.rc.separate_out = '' |
|
665 | if IP.rc.separate_out == '0': IP.rc.separate_out = '' | |
664 | if IP.rc.separate_out2 == '0': IP.rc.separate_out2 = '' |
|
666 | if IP.rc.separate_out2 == '0': IP.rc.separate_out2 = '' | |
665 | IP.rc.separate_in = IP.rc.separate_in.replace('\\n','\n') |
|
667 | IP.rc.separate_in = IP.rc.separate_in.replace('\\n','\n') | |
666 | IP.rc.separate_out = IP.rc.separate_out.replace('\\n','\n') |
|
668 | IP.rc.separate_out = IP.rc.separate_out.replace('\\n','\n') | |
667 | IP.rc.separate_out2 = IP.rc.separate_out2.replace('\\n','\n') |
|
669 | IP.rc.separate_out2 = IP.rc.separate_out2.replace('\\n','\n') | |
668 |
|
670 | |||
669 | # Determine how many lines at the bottom of the screen are needed for |
|
671 | # Determine how many lines at the bottom of the screen are needed for | |
670 | # showing prompts, so we can know wheter long strings are to be printed or |
|
672 | # showing prompts, so we can know wheter long strings are to be printed or | |
671 | # paged: |
|
673 | # paged: | |
672 | num_lines_bot = IP.rc.separate_in.count('\n')+1 |
|
674 | num_lines_bot = IP.rc.separate_in.count('\n')+1 | |
673 | IP.rc.screen_length = IP.rc.screen_length - num_lines_bot |
|
675 | IP.rc.screen_length = IP.rc.screen_length - num_lines_bot | |
674 | # Initialize cache, set in/out prompts and printing system |
|
676 | # Initialize cache, set in/out prompts and printing system | |
675 | IP.outputcache = CachedOutput(IP.rc.cache_size, |
|
677 | IP.outputcache = CachedOutput(IP.rc.cache_size, | |
676 | IP.rc.pprint, |
|
678 | IP.rc.pprint, | |
677 | input_sep = IP.rc.separate_in, |
|
679 | input_sep = IP.rc.separate_in, | |
678 | output_sep = IP.rc.separate_out, |
|
680 | output_sep = IP.rc.separate_out, | |
679 | output_sep2 = IP.rc.separate_out2, |
|
681 | output_sep2 = IP.rc.separate_out2, | |
680 | ps1 = IP.rc.prompt_in1, |
|
682 | ps1 = IP.rc.prompt_in1, | |
681 | ps2 = IP.rc.prompt_in2, |
|
683 | ps2 = IP.rc.prompt_in2, | |
682 | ps_out = IP.rc.prompt_out, |
|
684 | ps_out = IP.rc.prompt_out, | |
683 | user_ns = IP.user_ns, |
|
685 | user_ns = IP.user_ns, | |
684 | input_hist = IP.input_hist, |
|
686 | input_hist = IP.input_hist, | |
685 | pad_left = IP.rc.prompts_pad_left) |
|
687 | pad_left = IP.rc.prompts_pad_left) | |
686 |
|
688 | |||
687 | # Set user colors (don't do it in the constructor above so that it doesn't |
|
689 | # Set user colors (don't do it in the constructor above so that it doesn't | |
688 | # crash if colors option is invalid) |
|
690 | # crash if colors option is invalid) | |
689 | IP.magic_colors(IP.rc.colors) |
|
691 | IP.magic_colors(IP.rc.colors) | |
690 |
|
692 | |||
691 | # user may have over-ridden the default print hook: |
|
693 | # user may have over-ridden the default print hook: | |
692 | try: |
|
694 | try: | |
693 | IP.outputcache.__class__.display = IP.hooks.display |
|
695 | IP.outputcache.__class__.display = IP.hooks.display | |
694 | except AttributeError: |
|
696 | except AttributeError: | |
695 | pass |
|
697 | pass | |
696 |
|
698 | |||
697 | # Set calling of pdb on exceptions |
|
699 | # Set calling of pdb on exceptions | |
698 | IP.InteractiveTB.call_pdb = IP.rc.pdb |
|
700 | IP.InteractiveTB.call_pdb = IP.rc.pdb | |
699 |
|
701 | |||
700 | # I don't like assigning globally to sys, because it means when embedding |
|
702 | # I don't like assigning globally to sys, because it means when embedding | |
701 | # instances, each embedded instance overrides the previous choice. But |
|
703 | # instances, each embedded instance overrides the previous choice. But | |
702 | # sys.displayhook seems to be called internally by exec, so I don't see a |
|
704 | # sys.displayhook seems to be called internally by exec, so I don't see a | |
703 | # way around it. |
|
705 | # way around it. | |
704 | sys.displayhook = IP.outputcache |
|
706 | sys.displayhook = IP.outputcache | |
705 |
|
707 | |||
706 | # we need to know globally if we're caching i/o or not |
|
708 | # we need to know globally if we're caching i/o or not | |
707 | IP.do_full_cache = IP.outputcache.do_full_cache |
|
709 | IP.do_full_cache = IP.outputcache.do_full_cache | |
708 |
|
710 | |||
709 | # configure startup banner |
|
711 | # configure startup banner | |
710 | if IP.rc.c: # regular python doesn't print the banner with -c |
|
712 | if IP.rc.c: # regular python doesn't print the banner with -c | |
711 | IP.rc.banner = 0 |
|
713 | IP.rc.banner = 0 | |
712 | if IP.rc.banner: |
|
714 | if IP.rc.banner: | |
713 | IP.BANNER = '\n'.join(IP.BANNER_PARTS) |
|
715 | IP.BANNER = '\n'.join(IP.BANNER_PARTS) | |
714 | else: |
|
716 | else: | |
715 | IP.BANNER = '' |
|
717 | IP.BANNER = '' | |
716 |
|
718 | |||
717 | if IP.rc.profile: IP.BANNER += '\nIPython profile: '+IP.rc.profile+'\n' |
|
719 | if IP.rc.profile: IP.BANNER += '\nIPython profile: '+IP.rc.profile+'\n' | |
718 |
|
720 | |||
719 | # add message log (possibly empty) |
|
721 | # add message log (possibly empty) | |
720 | IP.BANNER += msg.summary |
|
722 | IP.BANNER += msg.summary | |
721 |
|
723 | |||
722 | IP.post_config_initialization() |
|
724 | IP.post_config_initialization() | |
723 |
|
725 | |||
724 | return IP |
|
726 | return IP | |
725 | #************************ end of file <ipmaker.py> ************************** |
|
727 | #************************ end of file <ipmaker.py> ************************** |
@@ -1,8928 +1,8964 b'' | |||||
1 | #LyX 1.3 created this file. For more info see http://www.lyx.org/ |
|
1 | #LyX 1.3 created this file. For more info see http://www.lyx.org/ | |
2 | \lyxformat 221 |
|
2 | \lyxformat 221 | |
3 | \textclass article |
|
3 | \textclass article | |
4 | \begin_preamble |
|
4 | \begin_preamble | |
5 | %\usepackage{ae,aecompl} |
|
5 | %\usepackage{ae,aecompl} | |
6 | \usepackage{color} |
|
6 | \usepackage{color} | |
7 |
|
7 | |||
8 | % A few colors to replace the defaults for certain link types |
|
8 | % A few colors to replace the defaults for certain link types | |
9 | \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
|
9 | \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} | |
10 | \definecolor{darkorange}{rgb}{.71,0.21,0.01} |
|
10 | \definecolor{darkorange}{rgb}{.71,0.21,0.01} | |
11 | \definecolor{darkred}{rgb}{.52,0.08,0.01} |
|
11 | \definecolor{darkred}{rgb}{.52,0.08,0.01} | |
12 | \definecolor{darkgreen}{rgb}{.12,.54,.11} |
|
12 | \definecolor{darkgreen}{rgb}{.12,.54,.11} | |
13 |
|
13 | |||
14 | % Use and configure listings package for nicely formatted code |
|
14 | % Use and configure listings package for nicely formatted code | |
15 | \usepackage{listings} |
|
15 | \usepackage{listings} | |
16 | \lstset{ |
|
16 | \lstset{ | |
17 | language=Python, |
|
17 | language=Python, | |
18 | basicstyle=\small\ttfamily, |
|
18 | basicstyle=\small\ttfamily, | |
19 | commentstyle=\ttfamily\color{blue}, |
|
19 | commentstyle=\ttfamily\color{blue}, | |
20 | stringstyle=\ttfamily\color{darkorange}, |
|
20 | stringstyle=\ttfamily\color{darkorange}, | |
21 | showstringspaces=false, |
|
21 | showstringspaces=false, | |
22 | breaklines=true, |
|
22 | breaklines=true, | |
23 | postbreak = \space\dots |
|
23 | postbreak = \space\dots | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | \usepackage[%pdftex, % needed for pdflatex |
|
26 | \usepackage[%pdftex, % needed for pdflatex | |
27 | breaklinks=true, % so long urls are correctly broken across lines |
|
27 | breaklinks=true, % so long urls are correctly broken across lines | |
28 | colorlinks=true, |
|
28 | colorlinks=true, | |
29 | urlcolor=blue, |
|
29 | urlcolor=blue, | |
30 | linkcolor=darkred, |
|
30 | linkcolor=darkred, | |
31 | citecolor=darkgreen, |
|
31 | citecolor=darkgreen, | |
32 | ]{hyperref} |
|
32 | ]{hyperref} | |
33 |
|
33 | |||
34 | \usepackage{html} |
|
34 | \usepackage{html} | |
35 |
|
35 | |||
36 | % This helps prevent overly long lines that stretch beyond the margins |
|
36 | % This helps prevent overly long lines that stretch beyond the margins | |
37 | \sloppy |
|
37 | \sloppy | |
|
38 | ||||
|
39 | % Define a \codelist command which either uses listings for latex, or | |||
|
40 | % plain verbatim for html (since latex2html doesn't understand the | |||
|
41 | % listings package). | |||
|
42 | \usepackage{verbatim} | |||
|
43 | \newcommand{\codelist}[1] { | |||
|
44 | \latex{\lstinputlisting{#1}} | |||
|
45 | \html{\verbatiminput{#1}} | |||
|
46 | } | |||
38 | \end_preamble |
|
47 | \end_preamble | |
39 | \language english |
|
48 | \language english | |
40 | \inputencoding latin1 |
|
49 | \inputencoding latin1 | |
41 | \fontscheme palatino |
|
50 | \fontscheme palatino | |
42 | \graphics default |
|
51 | \graphics default | |
43 | \paperfontsize 10 |
|
52 | \paperfontsize 10 | |
44 | \spacing single |
|
53 | \spacing single | |
45 | \papersize Default |
|
54 | \papersize Default | |
46 | \paperpackage a4 |
|
55 | \paperpackage a4 | |
47 | \use_geometry 1 |
|
56 | \use_geometry 1 | |
48 | \use_amsmath 0 |
|
57 | \use_amsmath 0 | |
49 | \use_natbib 0 |
|
58 | \use_natbib 0 | |
50 | \use_numerical_citations 0 |
|
59 | \use_numerical_citations 0 | |
51 | \paperorientation portrait |
|
60 | \paperorientation portrait | |
52 | \leftmargin 1.1in |
|
61 | \leftmargin 1.1in | |
53 | \topmargin 1in |
|
62 | \topmargin 1in | |
54 | \rightmargin 1.1in |
|
63 | \rightmargin 1.1in | |
55 | \bottommargin 1in |
|
64 | \bottommargin 1in | |
56 | \secnumdepth 3 |
|
65 | \secnumdepth 3 | |
57 | \tocdepth 3 |
|
66 | \tocdepth 3 | |
58 | \paragraph_separation skip |
|
67 | \paragraph_separation skip | |
59 | \defskip medskip |
|
68 | \defskip medskip | |
60 | \quotes_language english |
|
69 | \quotes_language english | |
61 | \quotes_times 2 |
|
70 | \quotes_times 2 | |
62 | \papercolumns 1 |
|
71 | \papercolumns 1 | |
63 | \papersides 1 |
|
72 | \papersides 1 | |
64 | \paperpagestyle fancy |
|
73 | \paperpagestyle fancy | |
65 |
|
74 | |||
66 | \layout Title |
|
75 | \layout Title | |
67 |
|
76 | |||
68 | IPython |
|
77 | IPython | |
69 | \newline |
|
78 | \newline | |
70 |
|
79 | |||
71 | \size larger |
|
80 | \size larger | |
72 | An enhanced Interactive Python |
|
81 | An enhanced Interactive Python | |
73 | \size large |
|
82 | \size large | |
74 |
|
83 | |||
75 | \newline |
|
84 | \newline | |
76 | User Manual, v. |
|
85 | User Manual, v. | |
77 | __version__ |
|
86 | __version__ | |
78 | \layout Author |
|
87 | \layout Author | |
79 |
|
88 | |||
80 | Fernando PοΏ½rez |
|
89 | Fernando PοΏ½rez | |
81 | \layout Standard |
|
90 | \layout Standard | |
82 |
|
91 | |||
83 |
|
92 | |||
84 | \begin_inset ERT |
|
93 | \begin_inset ERT | |
85 | status Collapsed |
|
94 | status Collapsed | |
86 |
|
95 | |||
87 | \layout Standard |
|
96 | \layout Standard | |
88 |
|
97 | |||
89 | \backslash |
|
98 | \backslash | |
90 | latex{ |
|
99 | latex{ | |
91 | \end_inset |
|
100 | \end_inset | |
92 |
|
101 | |||
93 |
|
102 | |||
94 | \begin_inset LatexCommand \tableofcontents{} |
|
103 | \begin_inset LatexCommand \tableofcontents{} | |
95 |
|
104 | |||
96 | \end_inset |
|
105 | \end_inset | |
97 |
|
106 | |||
98 |
|
107 | |||
99 | \begin_inset ERT |
|
108 | \begin_inset ERT | |
100 | status Collapsed |
|
109 | status Collapsed | |
101 |
|
110 | |||
102 | \layout Standard |
|
111 | \layout Standard | |
103 | } |
|
112 | } | |
104 | \end_inset |
|
113 | \end_inset | |
105 |
|
114 | |||
106 |
|
115 | |||
107 | \layout Standard |
|
116 | \layout Standard | |
108 |
|
117 | |||
109 |
|
118 | |||
110 | \begin_inset ERT |
|
119 | \begin_inset ERT | |
111 | status Open |
|
120 | status Open | |
112 |
|
121 | |||
113 | \layout Standard |
|
122 | \layout Standard | |
114 |
|
123 | |||
115 | \backslash |
|
124 | \backslash | |
116 | html{ |
|
125 | html{ | |
117 | \backslash |
|
126 | \backslash | |
118 | bodytext{bgcolor=#ffffff}} |
|
127 | bodytext{bgcolor=#ffffff}} | |
119 | \end_inset |
|
128 | \end_inset | |
120 |
|
129 | |||
121 |
|
130 | |||
122 | \layout Section |
|
131 | \layout Section | |
123 | \pagebreak_top |
|
132 | \pagebreak_top | |
124 | Overview |
|
133 | Overview | |
125 | \layout Standard |
|
134 | \layout Standard | |
126 |
|
135 | |||
127 | One of Python's most useful features is its interactive interpreter. |
|
136 | One of Python's most useful features is its interactive interpreter. | |
128 | This system allows very fast testing of ideas without the overhead of creating |
|
137 | This system allows very fast testing of ideas without the overhead of creating | |
129 | test files as is typical in most programming languages. |
|
138 | test files as is typical in most programming languages. | |
130 | However, the interpreter supplied with the standard Python distribution |
|
139 | However, the interpreter supplied with the standard Python distribution | |
131 | is somewhat limited for extended interactive use. |
|
140 | is somewhat limited for extended interactive use. | |
132 | \layout Standard |
|
141 | \layout Standard | |
133 |
|
142 | |||
134 | IPython is a free software project (released under the BSD license) which |
|
143 | IPython is a free software project (released under the BSD license) which | |
135 | tries to: |
|
144 | tries to: | |
136 | \layout Enumerate |
|
145 | \layout Enumerate | |
137 |
|
146 | |||
138 | Provide an interactive shell superior to Python's default. |
|
147 | Provide an interactive shell superior to Python's default. | |
139 | IPython has many features for object introspection, system shell access, |
|
148 | IPython has many features for object introspection, system shell access, | |
140 | and its own special command system for adding functionality when working |
|
149 | and its own special command system for adding functionality when working | |
141 | interactively. |
|
150 | interactively. | |
142 | It tries to be a very efficient environment both for Python code development |
|
151 | It tries to be a very efficient environment both for Python code development | |
143 | and for exploration of problems using Python objects (in situations like |
|
152 | and for exploration of problems using Python objects (in situations like | |
144 | data analysis). |
|
153 | data analysis). | |
145 | \layout Enumerate |
|
154 | \layout Enumerate | |
146 |
|
155 | |||
147 | Serve as an embeddable, ready to use interpreter for your own programs. |
|
156 | Serve as an embeddable, ready to use interpreter for your own programs. | |
148 | IPython can be started with a single call from inside another program, |
|
157 | IPython can be started with a single call from inside another program, | |
149 | providing access to the current namespace. |
|
158 | providing access to the current namespace. | |
150 | This can be very useful both for debugging purposes and for situations |
|
159 | This can be very useful both for debugging purposes and for situations | |
151 | where a blend of batch-processing and interactive exploration are needed. |
|
160 | where a blend of batch-processing and interactive exploration are needed. | |
152 | \layout Enumerate |
|
161 | \layout Enumerate | |
153 |
|
162 | |||
154 | Offer a flexible framework which can be used as the base environment for |
|
163 | Offer a flexible framework which can be used as the base environment for | |
155 | other systems with Python as the underlying language. |
|
164 | other systems with Python as the underlying language. | |
156 | Specifically scientific environments like Mathematica, IDL and Matlab inspired |
|
165 | Specifically scientific environments like Mathematica, IDL and Matlab inspired | |
157 | its design, but similar ideas can be useful in many fields. |
|
166 | its design, but similar ideas can be useful in many fields. | |
158 | \layout Subsection |
|
167 | \layout Subsection | |
159 |
|
168 | |||
160 | Main features |
|
169 | Main features | |
161 | \layout Itemize |
|
170 | \layout Itemize | |
162 |
|
171 | |||
163 | Dynamic object introspection. |
|
172 | Dynamic object introspection. | |
164 | One can access docstrings, function definition prototypes, source code, |
|
173 | One can access docstrings, function definition prototypes, source code, | |
165 | source files and other details of any object accessible to the interpreter |
|
174 | source files and other details of any object accessible to the interpreter | |
166 | with a single keystroke (` |
|
175 | with a single keystroke (` | |
167 | \family typewriter |
|
176 | \family typewriter | |
168 | ? |
|
177 | ? | |
169 | \family default |
|
178 | \family default | |
170 | '). |
|
179 | '). | |
171 | \layout Itemize |
|
180 | \layout Itemize | |
172 |
|
181 | |||
173 | Completion in the local namespace, by typing TAB at the prompt. |
|
182 | Completion in the local namespace, by typing TAB at the prompt. | |
174 | This works for keywords, methods, variables and files in the current directory. |
|
183 | This works for keywords, methods, variables and files in the current directory. | |
175 | This is supported via the readline library, and full access to configuring |
|
184 | This is supported via the readline library, and full access to configuring | |
176 | readline's behavior is provided. |
|
185 | readline's behavior is provided. | |
177 | \layout Itemize |
|
186 | \layout Itemize | |
178 |
|
187 | |||
179 | Numbered input/output prompts with command history (persistent across sessions |
|
188 | Numbered input/output prompts with command history (persistent across sessions | |
180 | and tied to each profile), full searching in this history and caching of |
|
189 | and tied to each profile), full searching in this history and caching of | |
181 | all input and output. |
|
190 | all input and output. | |
182 | \layout Itemize |
|
191 | \layout Itemize | |
183 |
|
192 | |||
184 | User-extensible `magic' commands. |
|
193 | User-extensible `magic' commands. | |
185 | A set of commands prefixed with |
|
194 | A set of commands prefixed with | |
186 | \family typewriter |
|
195 | \family typewriter | |
187 | % |
|
196 | % | |
188 | \family default |
|
197 | \family default | |
189 | is available for controlling IPython itself and provides directory control, |
|
198 | is available for controlling IPython itself and provides directory control, | |
190 | namespace information and many aliases to common system shell commands. |
|
199 | namespace information and many aliases to common system shell commands. | |
191 | \layout Itemize |
|
200 | \layout Itemize | |
192 |
|
201 | |||
193 | Alias facility for defining your own system aliases. |
|
202 | Alias facility for defining your own system aliases. | |
194 | \layout Itemize |
|
203 | \layout Itemize | |
195 |
|
204 | |||
196 | Complete system shell access. |
|
205 | Complete system shell access. | |
197 | Lines starting with ! are passed directly to the system shell, and using |
|
206 | Lines starting with ! are passed directly to the system shell, and using | |
198 | !! captures shell output into python variables for further use. |
|
207 | !! captures shell output into python variables for further use. | |
199 | \layout Itemize |
|
208 | \layout Itemize | |
200 |
|
209 | |||
201 | All calls to the system (via aliases or via !) have their standard output/error |
|
210 | All calls to the system (via aliases or via !) have their standard output/error | |
202 | automatically stored as strings, and also available as lists. |
|
211 | automatically stored as strings, and also available as lists. | |
203 | \layout Itemize |
|
212 | \layout Itemize | |
204 |
|
213 | |||
205 | Background execution of Python commands in a separate thread. |
|
214 | Background execution of Python commands in a separate thread. | |
206 | IPython has an internal job manager called |
|
215 | IPython has an internal job manager called | |
207 | \family typewriter |
|
216 | \family typewriter | |
208 | jobs |
|
217 | jobs | |
209 | \family default |
|
218 | \family default | |
210 | , and a conveninence backgrounding magic function called |
|
219 | , and a conveninence backgrounding magic function called | |
211 | \family typewriter |
|
220 | \family typewriter | |
212 | %bg |
|
221 | %bg | |
213 | \family default |
|
222 | \family default | |
214 | . |
|
223 | . | |
215 | \layout Itemize |
|
224 | \layout Itemize | |
216 |
|
225 | |||
217 | The ability to expand python variables when calling the system shell. |
|
226 | The ability to expand python variables when calling the system shell. | |
218 | In a shell command, any python variable prefixed with |
|
227 | In a shell command, any python variable prefixed with | |
219 | \family typewriter |
|
228 | \family typewriter | |
220 | $ |
|
229 | $ | |
221 | \family default |
|
230 | \family default | |
222 | is expanded. |
|
231 | is expanded. | |
223 | A double |
|
232 | A double | |
224 | \family typewriter |
|
233 | \family typewriter | |
225 | $$ |
|
234 | $$ | |
226 | \family default |
|
235 | \family default | |
227 | allows passing a literal |
|
236 | allows passing a literal | |
228 | \family typewriter |
|
237 | \family typewriter | |
229 | $ |
|
238 | $ | |
230 | \family default |
|
239 | \family default | |
231 | to the shell (for access to shell and environment variables like |
|
240 | to the shell (for access to shell and environment variables like | |
232 | \family typewriter |
|
241 | \family typewriter | |
233 | $PATH |
|
242 | $PATH | |
234 | \family default |
|
243 | \family default | |
235 | ). |
|
244 | ). | |
236 | \layout Itemize |
|
245 | \layout Itemize | |
237 |
|
246 | |||
238 | Filesystem navigation, via a magic |
|
247 | Filesystem navigation, via a magic | |
239 | \family typewriter |
|
248 | \family typewriter | |
240 | %cd |
|
249 | %cd | |
241 | \family default |
|
250 | \family default | |
242 | command, along with a persistent bookmark system (using |
|
251 | command, along with a persistent bookmark system (using | |
243 | \family typewriter |
|
252 | \family typewriter | |
244 | %bookmark |
|
253 | %bookmark | |
245 | \family default |
|
254 | \family default | |
246 | ) for fast access to frequently visited directories. |
|
255 | ) for fast access to frequently visited directories. | |
247 | \layout Itemize |
|
256 | \layout Itemize | |
248 |
|
257 | |||
249 | Automatic indentation (optional) of code as you type (through the readline |
|
258 | Automatic indentation (optional) of code as you type (through the readline | |
250 | library). |
|
259 | library). | |
251 | \layout Itemize |
|
260 | \layout Itemize | |
252 |
|
261 | |||
253 | Macro system for quickly re-executing multiple lines of previous input with |
|
262 | Macro system for quickly re-executing multiple lines of previous input with | |
254 | a single name. |
|
263 | a single name. | |
255 | \layout Itemize |
|
264 | \layout Itemize | |
256 |
|
265 | |||
257 | Session logging (you can then later use these logs as code in your programs). |
|
266 | Session logging (you can then later use these logs as code in your programs). | |
258 | \layout Itemize |
|
267 | \layout Itemize | |
259 |
|
268 | |||
260 | Session restoring: logs can be replayed to restore a previous session to |
|
269 | Session restoring: logs can be replayed to restore a previous session to | |
261 | the state where you left it. |
|
270 | the state where you left it. | |
262 | \layout Itemize |
|
271 | \layout Itemize | |
263 |
|
272 | |||
264 | Verbose and colored exception traceback printouts. |
|
273 | Verbose and colored exception traceback printouts. | |
265 | Easier to parse visually, and in verbose mode they produce a lot of useful |
|
274 | Easier to parse visually, and in verbose mode they produce a lot of useful | |
266 | debugging information (basically a terminal version of the cgitb module). |
|
275 | debugging information (basically a terminal version of the cgitb module). | |
267 | \layout Itemize |
|
276 | \layout Itemize | |
268 |
|
277 | |||
269 | Auto-parentheses: callable objects can be executed without parentheses: |
|
278 | Auto-parentheses: callable objects can be executed without parentheses: | |
270 |
|
279 | |||
271 | \family typewriter |
|
280 | \family typewriter | |
272 | `sin 3' |
|
281 | `sin 3' | |
273 | \family default |
|
282 | \family default | |
274 | is automatically converted to |
|
283 | is automatically converted to | |
275 | \family typewriter |
|
284 | \family typewriter | |
276 | `sin(3) |
|
285 | `sin(3) | |
277 | \family default |
|
286 | \family default | |
278 | '. |
|
287 | '. | |
279 | \layout Itemize |
|
288 | \layout Itemize | |
280 |
|
289 | |||
281 | Auto-quoting: using ` |
|
290 | Auto-quoting: using ` | |
282 | \family typewriter |
|
291 | \family typewriter | |
283 | , |
|
292 | , | |
284 | \family default |
|
293 | \family default | |
285 | ' or ` |
|
294 | ' or ` | |
286 | \family typewriter |
|
295 | \family typewriter | |
287 | ; |
|
296 | ; | |
288 | \family default |
|
297 | \family default | |
289 | ' as the first character forces auto-quoting of the rest of the line: |
|
298 | ' as the first character forces auto-quoting of the rest of the line: | |
290 | \family typewriter |
|
299 | \family typewriter | |
291 | `,my_function a\SpecialChar ~ |
|
300 | `,my_function a\SpecialChar ~ | |
292 | b' |
|
301 | b' | |
293 | \family default |
|
302 | \family default | |
294 | becomes automatically |
|
303 | becomes automatically | |
295 | \family typewriter |
|
304 | \family typewriter | |
296 | `my_function("a","b")' |
|
305 | `my_function("a","b")' | |
297 | \family default |
|
306 | \family default | |
298 | , while |
|
307 | , while | |
299 | \family typewriter |
|
308 | \family typewriter | |
300 | `;my_function a\SpecialChar ~ |
|
309 | `;my_function a\SpecialChar ~ | |
301 | b' |
|
310 | b' | |
302 | \family default |
|
311 | \family default | |
303 | becomes |
|
312 | becomes | |
304 | \family typewriter |
|
313 | \family typewriter | |
305 | `my_function("a b")' |
|
314 | `my_function("a b")' | |
306 | \family default |
|
315 | \family default | |
307 | . |
|
316 | . | |
308 | \layout Itemize |
|
317 | \layout Itemize | |
309 |
|
318 | |||
310 | Extensible input syntax. |
|
319 | Extensible input syntax. | |
311 | You can define filters that pre-process user input to simplify input in |
|
320 | You can define filters that pre-process user input to simplify input in | |
312 | special situations. |
|
321 | special situations. | |
313 | This allows for example pasting multi-line code fragments which start with |
|
322 | This allows for example pasting multi-line code fragments which start with | |
314 |
|
323 | |||
315 | \family typewriter |
|
324 | \family typewriter | |
316 | `>>>' |
|
325 | `>>>' | |
317 | \family default |
|
326 | \family default | |
318 | or |
|
327 | or | |
319 | \family typewriter |
|
328 | \family typewriter | |
320 | `...' |
|
329 | `...' | |
321 | \family default |
|
330 | \family default | |
322 | such as those from other python sessions or the standard Python documentation. |
|
331 | such as those from other python sessions or the standard Python documentation. | |
323 | \layout Itemize |
|
332 | \layout Itemize | |
324 |
|
333 | |||
325 | Flexible configuration system. |
|
334 | Flexible configuration system. | |
326 | It uses a configuration file which allows permanent setting of all command-line |
|
335 | It uses a configuration file which allows permanent setting of all command-line | |
327 | options, module loading, code and file execution. |
|
336 | options, module loading, code and file execution. | |
328 | The system allows recursive file inclusion, so you can have a base file |
|
337 | The system allows recursive file inclusion, so you can have a base file | |
329 | with defaults and layers which load other customizations for particular |
|
338 | with defaults and layers which load other customizations for particular | |
330 | projects. |
|
339 | projects. | |
331 | \layout Itemize |
|
340 | \layout Itemize | |
332 |
|
341 | |||
333 | Embeddable. |
|
342 | Embeddable. | |
334 | You can call IPython as a python shell inside your own python programs. |
|
343 | You can call IPython as a python shell inside your own python programs. | |
335 | This can be used both for debugging code or for providing interactive abilities |
|
344 | This can be used both for debugging code or for providing interactive abilities | |
336 | to your programs with knowledge about the local namespaces (very useful |
|
345 | to your programs with knowledge about the local namespaces (very useful | |
337 | in debugging and data analysis situations). |
|
346 | in debugging and data analysis situations). | |
338 | \layout Itemize |
|
347 | \layout Itemize | |
339 |
|
348 | |||
340 | Easy debugger access. |
|
349 | Easy debugger access. | |
341 | You can set IPython to call up the Python debugger (pdb) every time there |
|
350 | You can set IPython to call up the Python debugger (pdb) every time there | |
342 | is an uncaught exception. |
|
351 | is an uncaught exception. | |
343 | This drops you inside the code which triggered the exception with all the |
|
352 | This drops you inside the code which triggered the exception with all the | |
344 | data live and it is possible to navigate the stack to rapidly isolate the |
|
353 | data live and it is possible to navigate the stack to rapidly isolate the | |
345 | source of a bug. |
|
354 | source of a bug. | |
346 | The |
|
355 | The | |
347 | \family typewriter |
|
356 | \family typewriter | |
348 | %run |
|
357 | %run | |
349 | \family default |
|
358 | \family default | |
350 | magic command --with the |
|
359 | magic command --with the | |
351 | \family typewriter |
|
360 | \family typewriter | |
352 | -d |
|
361 | -d | |
353 | \family default |
|
362 | \family default | |
354 | option-- can run any script under |
|
363 | option-- can run any script under | |
355 | \family typewriter |
|
364 | \family typewriter | |
356 | pdb |
|
365 | pdb | |
357 | \family default |
|
366 | \family default | |
358 | 's control, automatically setting initial breakpoints for you. |
|
367 | 's control, automatically setting initial breakpoints for you. | |
359 | \layout Itemize |
|
368 | \layout Itemize | |
360 |
|
369 | |||
361 | Profiler support. |
|
370 | Profiler support. | |
362 | You can run single statements (similar to |
|
371 | You can run single statements (similar to | |
363 | \family typewriter |
|
372 | \family typewriter | |
364 | profile.run() |
|
373 | profile.run() | |
365 | \family default |
|
374 | \family default | |
366 | ) or complete programs under the profiler's control. |
|
375 | ) or complete programs under the profiler's control. | |
367 | While this is possible with the standard |
|
376 | While this is possible with the standard | |
368 | \family typewriter |
|
377 | \family typewriter | |
369 | profile |
|
378 | profile | |
370 | \family default |
|
379 | \family default | |
371 | module, IPython wraps this functionality with magic commands (see |
|
380 | module, IPython wraps this functionality with magic commands (see | |
372 | \family typewriter |
|
381 | \family typewriter | |
373 | `%prun' |
|
382 | `%prun' | |
374 | \family default |
|
383 | \family default | |
375 | and |
|
384 | and | |
376 | \family typewriter |
|
385 | \family typewriter | |
377 | `%run -p |
|
386 | `%run -p | |
378 | \family default |
|
387 | \family default | |
379 | ') convenient for rapid interactive work. |
|
388 | ') convenient for rapid interactive work. | |
380 | \layout Subsection |
|
389 | \layout Subsection | |
381 |
|
390 | |||
382 | Portability and Python requirements |
|
391 | Portability and Python requirements | |
383 | \layout Standard |
|
392 | \layout Standard | |
384 |
|
393 | |||
385 |
|
394 | |||
386 | \series bold |
|
395 | \series bold | |
387 | Python requirements: |
|
396 | Python requirements: | |
388 | \series default |
|
397 | \series default | |
389 | IPython works with Python version 2.2 or newer. |
|
398 | IPython works with Python version 2.2 or newer. | |
390 | It has been tested with Python 2.4 and no problems have been reported. |
|
399 | It has been tested with Python 2.4 and no problems have been reported. | |
391 | Support for Python 2.1 hasn't been recently tested, since I don't have access |
|
400 | Support for Python 2.1 hasn't been recently tested, since I don't have access | |
392 | to it on any of my systems. |
|
401 | to it on any of my systems. | |
393 | But I suspect there may be some problems with Python 2.1, because some of |
|
402 | But I suspect there may be some problems with Python 2.1, because some of | |
394 | the newer code may use 2.2 features. |
|
403 | the newer code may use 2.2 features. | |
395 | \layout Standard |
|
404 | \layout Standard | |
396 |
|
405 | |||
397 | IPython is developed under |
|
406 | IPython is developed under | |
398 | \series bold |
|
407 | \series bold | |
399 | Linux |
|
408 | Linux | |
400 | \series default |
|
409 | \series default | |
401 | , but it should work in any reasonable Unix-type system (tested OK under |
|
410 | , but it should work in any reasonable Unix-type system (tested OK under | |
402 | Solaris and the *BSD family, for which a port exists thanks to Dryice Liu). |
|
411 | Solaris and the *BSD family, for which a port exists thanks to Dryice Liu). | |
403 | \layout Standard |
|
412 | \layout Standard | |
404 |
|
413 | |||
405 |
|
414 | |||
406 | \series bold |
|
415 | \series bold | |
407 | Mac OS X |
|
416 | Mac OS X | |
408 | \series default |
|
417 | \series default | |
409 | : it works, apparently without any problems (thanks to Jim Boyle at Lawrence |
|
418 | : it works, apparently without any problems (thanks to Jim Boyle at Lawrence | |
410 | Livermore for the information). |
|
419 | Livermore for the information). | |
411 | Thanks to Andrea Riciputi, Fink support is available. |
|
420 | Thanks to Andrea Riciputi, Fink support is available. | |
412 | \layout Standard |
|
421 | \layout Standard | |
413 |
|
422 | |||
414 |
|
423 | |||
415 | \series bold |
|
424 | \series bold | |
416 | CygWin |
|
425 | CygWin | |
417 | \series default |
|
426 | \series default | |
418 | : it works mostly OK, though some users have reported problems with prompt |
|
427 | : it works mostly OK, though some users have reported problems with prompt | |
419 | coloring. |
|
428 | coloring. | |
420 | No satisfactory solution to this has been found so far, you may want to |
|
429 | No satisfactory solution to this has been found so far, you may want to | |
421 | disable colors permanently in the |
|
430 | disable colors permanently in the | |
422 | \family typewriter |
|
431 | \family typewriter | |
423 | ipythonrc |
|
432 | ipythonrc | |
424 | \family default |
|
433 | \family default | |
425 | configuration file if you experience problems. |
|
434 | configuration file if you experience problems. | |
426 | If you have proper color support under cygwin, please post to the IPython |
|
435 | If you have proper color support under cygwin, please post to the IPython | |
427 | mailing list so this issue can be resolved for all users. |
|
436 | mailing list so this issue can be resolved for all users. | |
428 | \layout Standard |
|
437 | \layout Standard | |
429 |
|
438 | |||
430 |
|
439 | |||
431 | \series bold |
|
440 | \series bold | |
432 | Windows |
|
441 | Windows | |
433 | \series default |
|
442 | \series default | |
434 | : it works well under Windows XP/2k, and I suspect NT should behave similarly. |
|
443 | : it works well under Windows XP/2k, and I suspect NT should behave similarly. | |
435 | Section\SpecialChar ~ |
|
444 | Section\SpecialChar ~ | |
436 |
|
445 | |||
437 | \begin_inset LatexCommand \ref{sub:Under-Windows} |
|
446 | \begin_inset LatexCommand \ref{sub:Under-Windows} | |
438 |
|
447 | |||
439 | \end_inset |
|
448 | \end_inset | |
440 |
|
449 | |||
441 | describes installation details for Windows, including some additional tools |
|
450 | describes installation details for Windows, including some additional tools | |
442 | needed on this platform. |
|
451 | needed on this platform. | |
443 | \layout Standard |
|
452 | \layout Standard | |
444 |
|
453 | |||
445 | Windows 9x support is present, and has been reported to work fine (at least |
|
454 | Windows 9x support is present, and has been reported to work fine (at least | |
446 | on WinME). |
|
455 | on WinME). | |
447 | \layout Standard |
|
456 | \layout Standard | |
448 |
|
457 | |||
449 | Please note, however, that I have very little access to and experience with |
|
458 | Please note, however, that I have very little access to and experience with | |
450 | Windows development. |
|
459 | Windows development. | |
451 | For this reason, Windows-specific bugs tend to linger far longer than I |
|
460 | For this reason, Windows-specific bugs tend to linger far longer than I | |
452 | would like, and often I just can't find a satisfactory solution. |
|
461 | would like, and often I just can't find a satisfactory solution. | |
453 | If any Windows user wants to join in with development help, all hands are |
|
462 | If any Windows user wants to join in with development help, all hands are | |
454 | always welcome. |
|
463 | always welcome. | |
455 | \layout Subsection |
|
464 | \layout Subsection | |
456 |
|
465 | |||
457 | Location |
|
466 | Location | |
458 | \layout Standard |
|
467 | \layout Standard | |
459 |
|
468 | |||
460 | IPython is generously hosted at |
|
469 | IPython is generously hosted at | |
461 | \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org} |
|
470 | \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org} | |
462 |
|
471 | |||
463 | \end_inset |
|
472 | \end_inset | |
464 |
|
473 | |||
465 | by the SciPy project. |
|
474 | by the SciPy project. | |
466 | This site offers downloads, subversion access, mailing lists and a bug |
|
475 | This site offers downloads, subversion access, mailing lists and a bug | |
467 | tracking system. |
|
476 | tracking system. | |
468 | I am very grateful to Enthought ( |
|
477 | I am very grateful to Enthought ( | |
469 | \begin_inset LatexCommand \htmlurl{http://www.enthought.com} |
|
478 | \begin_inset LatexCommand \htmlurl{http://www.enthought.com} | |
470 |
|
479 | |||
471 | \end_inset |
|
480 | \end_inset | |
472 |
|
481 | |||
473 | ) and all of the SciPy team for their contribution. |
|
482 | ) and all of the SciPy team for their contribution. | |
474 | \layout Section |
|
483 | \layout Section | |
475 |
|
484 | |||
476 |
|
485 | |||
477 | \begin_inset LatexCommand \label{sec:install} |
|
486 | \begin_inset LatexCommand \label{sec:install} | |
478 |
|
487 | |||
479 | \end_inset |
|
488 | \end_inset | |
480 |
|
489 | |||
481 | Installation |
|
490 | Installation | |
482 | \layout Subsection |
|
491 | \layout Subsection | |
483 |
|
492 | |||
484 | Instant instructions |
|
493 | Instant instructions | |
485 | \layout Standard |
|
494 | \layout Standard | |
486 |
|
495 | |||
487 | If you are of the impatient kind, under Linux/Unix simply untar/unzip the |
|
496 | If you are of the impatient kind, under Linux/Unix simply untar/unzip the | |
488 | download, then install with |
|
497 | download, then install with | |
489 | \family typewriter |
|
498 | \family typewriter | |
490 | `python setup.py install' |
|
499 | `python setup.py install' | |
491 | \family default |
|
500 | \family default | |
492 | . |
|
501 | . | |
493 | Under Windows, double-click on the provided |
|
502 | Under Windows, double-click on the provided | |
494 | \family typewriter |
|
503 | \family typewriter | |
495 | .exe |
|
504 | .exe | |
496 | \family default |
|
505 | \family default | |
497 | binary installer. |
|
506 | binary installer. | |
498 | \layout Standard |
|
507 | \layout Standard | |
499 |
|
508 | |||
500 | Then, take a look at Sections |
|
509 | Then, take a look at Sections | |
501 | \begin_inset LatexCommand \ref{sec:good_config} |
|
510 | \begin_inset LatexCommand \ref{sec:good_config} | |
502 |
|
511 | |||
503 | \end_inset |
|
512 | \end_inset | |
504 |
|
513 | |||
505 | for configuring things optimally and |
|
514 | for configuring things optimally and | |
506 | \begin_inset LatexCommand \ref{sec:quick_tips} |
|
515 | \begin_inset LatexCommand \ref{sec:quick_tips} | |
507 |
|
516 | |||
508 | \end_inset |
|
517 | \end_inset | |
509 |
|
518 | |||
510 | for quick tips on efficient use of IPython. |
|
519 | for quick tips on efficient use of IPython. | |
511 | You can later refer to the rest of the manual for all the gory details. |
|
520 | You can later refer to the rest of the manual for all the gory details. | |
512 | \layout Standard |
|
521 | \layout Standard | |
513 |
|
522 | |||
514 | See the notes in sec. |
|
523 | See the notes in sec. | |
515 |
|
524 | |||
516 | \begin_inset LatexCommand \ref{sec:upgrade} |
|
525 | \begin_inset LatexCommand \ref{sec:upgrade} | |
517 |
|
526 | |||
518 | \end_inset |
|
527 | \end_inset | |
519 |
|
528 | |||
520 | for upgrading IPython versions. |
|
529 | for upgrading IPython versions. | |
521 | \layout Subsection |
|
530 | \layout Subsection | |
522 |
|
531 | |||
523 | Detailed Unix instructions (Linux, Mac OS X, etc.) |
|
532 | Detailed Unix instructions (Linux, Mac OS X, etc.) | |
524 | \layout Standard |
|
533 | \layout Standard | |
525 |
|
534 | |||
526 |
|
||||
527 | \begin_inset ERT |
|
|||
528 | status Open |
|
|||
529 |
|
||||
530 | \layout Standard |
|
|||
531 |
|
||||
532 | \backslash |
|
|||
533 | html{ |
|
|||
534 | \backslash |
|
|||
535 | textbf{A warning to readers of the HTML version of this manual}: all options below are preceded with with TWO dashes and no intervening space between the dashes (e.g. Dash-Dash-home). The default HTML conversion tools mangle these into a single dash.} |
|
|||
536 | \end_inset |
|
|||
537 |
|
||||
538 |
|
||||
539 | \layout Standard |
|
|||
540 |
|
||||
541 | For RPM based systems, simply install the supplied package in the usual |
|
535 | For RPM based systems, simply install the supplied package in the usual | |
542 | manner. |
|
536 | manner. | |
543 | If you download the tar archive, the process is: |
|
537 | If you download the tar archive, the process is: | |
544 | \layout Enumerate |
|
538 | \layout Enumerate | |
545 |
|
539 | |||
546 | Unzip/untar the |
|
540 | Unzip/untar the | |
547 | \family typewriter |
|
541 | \family typewriter | |
548 | ipython-XXX.tar.gz |
|
542 | ipython-XXX.tar.gz | |
549 | \family default |
|
543 | \family default | |
550 | file wherever you want ( |
|
544 | file wherever you want ( | |
551 | \family typewriter |
|
545 | \family typewriter | |
552 | XXX |
|
546 | XXX | |
553 | \family default |
|
547 | \family default | |
554 | is the version number). |
|
548 | is the version number). | |
555 | It will make a directory called |
|
549 | It will make a directory called | |
556 | \family typewriter |
|
550 | \family typewriter | |
557 | ipython-XXX. |
|
551 | ipython-XXX. | |
558 |
|
552 | |||
559 | \family default |
|
553 | \family default | |
560 | Change into that directory where you will find the files |
|
554 | Change into that directory where you will find the files | |
561 | \family typewriter |
|
555 | \family typewriter | |
562 | README |
|
556 | README | |
563 | \family default |
|
557 | \family default | |
564 | and |
|
558 | and | |
565 | \family typewriter |
|
559 | \family typewriter | |
566 | setup.py |
|
560 | setup.py | |
567 | \family default |
|
561 | \family default | |
568 | . |
|
562 | . | |
569 |
|
563 | |||
570 | \family typewriter |
|
564 | \family typewriter | |
571 | O |
|
565 | O | |
572 | \family default |
|
566 | \family default | |
573 | nce you've completed the installation, you can safely remove this directory. |
|
567 | nce you've completed the installation, you can safely remove this directory. | |
574 |
|
568 | |||
575 | \layout Enumerate |
|
569 | \layout Enumerate | |
576 |
|
570 | |||
577 | If you are installing over a previous installation of version 0.2.0 or earlier, |
|
571 | If you are installing over a previous installation of version 0.2.0 or earlier, | |
578 | first remove your |
|
572 | first remove your | |
579 | \family typewriter |
|
573 | \family typewriter | |
580 | $HOME/.ipython |
|
574 | $HOME/.ipython | |
581 | \family default |
|
575 | \family default | |
582 | directory, since the configuration file format has changed somewhat (the |
|
576 | directory, since the configuration file format has changed somewhat (the | |
583 | '=' were removed from all option specifications). |
|
577 | '=' were removed from all option specifications). | |
584 | Or you can call ipython with the |
|
578 | Or you can call ipython with the | |
585 | \family typewriter |
|
579 | \family typewriter | |
586 | -upgrade |
|
580 | -upgrade | |
587 | \family default |
|
581 | \family default | |
588 | option and it will do this automatically for you. |
|
582 | option and it will do this automatically for you. | |
589 | \layout Enumerate |
|
583 | \layout Enumerate | |
590 |
|
584 | |||
591 | IPython uses distutils, so you can install it by simply typing at the system |
|
585 | IPython uses distutils, so you can install it by simply typing at the system | |
592 | prompt (don't type the |
|
586 | prompt (don't type the | |
593 | \family typewriter |
|
587 | \family typewriter | |
594 | $ |
|
588 | $ | |
595 | \family default |
|
589 | \family default | |
596 | ) |
|
590 | ) | |
597 | \newline |
|
591 | \newline | |
598 |
|
592 | |||
599 | \family typewriter |
|
593 | \family typewriter | |
600 | $ python setup.py install |
|
594 | $ python setup.py install | |
601 | \family default |
|
595 | \family default | |
602 |
|
596 | |||
603 | \newline |
|
597 | \newline | |
604 | Note that this assumes you have root access to your machine. |
|
598 | Note that this assumes you have root access to your machine. | |
605 | If you don't have root access or don't want IPython to go in the default |
|
599 | If you don't have root access or don't want IPython to go in the default | |
606 | python directories, you'll need to use the |
|
600 | python directories, you'll need to use the | |
607 | \family typewriter |
|
601 | \begin_inset ERT | |
608 | --home |
|
602 | status Collapsed | |
609 | \family default |
|
603 | ||
|
604 | \layout Standard | |||
|
605 | ||||
|
606 | \backslash | |||
|
607 | verb|--home| | |||
|
608 | \end_inset | |||
|
609 | ||||
610 | option (or |
|
610 | option (or | |
611 | \family typewriter |
|
611 | \begin_inset ERT | |
612 | --prefix |
|
612 | status Collapsed | |
613 | \family default |
|
613 | ||
|
614 | \layout Standard | |||
|
615 | ||||
|
616 | \backslash | |||
|
617 | verb|--prefix| | |||
|
618 | \end_inset | |||
|
619 | ||||
614 | ). |
|
620 | ). | |
615 | For example: |
|
621 | For example: | |
616 | \newline |
|
622 | \newline | |
617 |
|
623 | |||
618 | \family typewriter |
|
624 | \begin_inset ERT | |
619 | $ python setup.py install --home $HOME/local |
|
625 | status Collapsed | |
620 | \family default |
|
|||
621 |
|
||||
622 | \newline |
|
|||
623 | will install |
|
|||
624 | \begin_inset Foot |
|
|||
625 | collapsed true |
|
|||
626 |
|
626 | |||
627 | \layout Standard |
|
627 | \layout Standard | |
628 |
|
628 | |||
629 | If you are reading these instructions in HTML format, please note that the |
|
629 | \backslash | |
630 | option is --home, with |
|
630 | verb|$ python setup.py install --home $HOME/local| | |
631 | \emph on |
|
|||
632 | two |
|
|||
633 | \emph default |
|
|||
634 | dashes. |
|
|||
635 | The automatic HTML conversion program seems to eat up one of the dashes, |
|
|||
636 | unfortunately (it's ok in the PDF version). |
|
|||
637 | \end_inset |
|
631 | \end_inset | |
638 |
|
632 | |||
639 | IPython into |
|
633 | ||
|
634 | \newline | |||
|
635 | will install IPython into | |||
640 | \family typewriter |
|
636 | \family typewriter | |
641 | $HOME/local |
|
637 | $HOME/local | |
642 | \family default |
|
638 | \family default | |
643 | and its subdirectories (creating them if necessary). |
|
639 | and its subdirectories (creating them if necessary). | |
644 | \newline |
|
640 | \newline | |
645 | You can type |
|
641 | You can type | |
646 | \newline |
|
642 | \newline | |
647 |
|
643 | |||
648 | \family typewriter |
|
644 | \begin_inset ERT | |
649 | $ python setup.py --help |
|
645 | status Collapsed | |
650 | \family default |
|
|||
651 |
|
646 | |||
|
647 | \layout Standard | |||
|
648 | ||||
|
649 | \backslash | |||
|
650 | verb|$ python setup.py --help| | |||
|
651 | \end_inset | |||
|
652 | ||||
|
653 | ||||
652 | \newline |
|
654 | \newline | |
653 | for more details. |
|
655 | for more details. | |
654 | \newline |
|
656 | \newline | |
655 | Note that if you change the default location for |
|
657 | Note that if you change the default location for | |
656 | \family typewriter |
|
658 | \begin_inset ERT | |
657 | --home |
|
659 | status Collapsed | |
658 | \family default |
|
660 | ||
|
661 | \layout Standard | |||
|
662 | ||||
|
663 | \backslash | |||
|
664 | verb|--home| | |||
|
665 | \end_inset | |||
|
666 | ||||
659 | at installation, IPython may end up installed at a location which is not |
|
667 | at installation, IPython may end up installed at a location which is not | |
660 | part of your |
|
668 | part of your | |
661 | \family typewriter |
|
669 | \family typewriter | |
662 | $PYTHONPATH |
|
670 | $PYTHONPATH | |
663 | \family default |
|
671 | \family default | |
664 | environment variable. |
|
672 | environment variable. | |
665 | In this case, you'll need to configure this variable to include the actual |
|
673 | In this case, you'll need to configure this variable to include the actual | |
666 | directory where the |
|
674 | directory where the | |
667 | \family typewriter |
|
675 | \family typewriter | |
668 | IPython/ |
|
676 | IPython/ | |
669 | \family default |
|
677 | \family default | |
670 | directory ended (typically the value you give to |
|
678 | directory ended (typically the value you give to | |
671 | \family typewriter |
|
679 | \begin_inset ERT | |
672 | --home |
|
680 | status Collapsed | |
673 | \family default |
|
681 | ||
|
682 | \layout Standard | |||
|
683 | ||||
|
684 | \backslash | |||
|
685 | verb|--home| | |||
|
686 | \end_inset | |||
|
687 | ||||
674 | plus |
|
688 | plus | |
675 | \family typewriter |
|
689 | \family typewriter | |
676 | /lib/python |
|
690 | /lib/python | |
677 | \family default |
|
691 | \family default | |
678 | ). |
|
692 | ). | |
679 | \layout Subsubsection |
|
693 | \layout Subsubsection | |
680 |
|
694 | |||
681 | Mac OSX information |
|
695 | Mac OSX information | |
682 | \layout Standard |
|
696 | \layout Standard | |
683 |
|
697 | |||
684 | Under OSX, there is a choice you need to make. |
|
698 | Under OSX, there is a choice you need to make. | |
685 | Apple ships its own build of Python, which lives in the core OSX filesystem |
|
699 | Apple ships its own build of Python, which lives in the core OSX filesystem | |
686 | hierarchy. |
|
700 | hierarchy. | |
687 | You can also manually install a separate Python, either purely by hand |
|
701 | You can also manually install a separate Python, either purely by hand | |
688 | (typically in |
|
702 | (typically in | |
689 | \family typewriter |
|
703 | \family typewriter | |
690 | /usr/local |
|
704 | /usr/local | |
691 | \family default |
|
705 | \family default | |
692 | ) or by using Fink, which puts everything under |
|
706 | ) or by using Fink, which puts everything under | |
693 | \family typewriter |
|
707 | \family typewriter | |
694 | /sw |
|
708 | /sw | |
695 | \family default |
|
709 | \family default | |
696 | . |
|
710 | . | |
697 | Which route to follow is a matter of personal preference, as I've seen |
|
711 | Which route to follow is a matter of personal preference, as I've seen | |
698 | users who favor each of the approaches. |
|
712 | users who favor each of the approaches. | |
699 | Here I will simply list the known installation issues under OSX, along |
|
713 | Here I will simply list the known installation issues under OSX, along | |
700 | with their solutions. |
|
714 | with their solutions. | |
|
715 | \layout Standard | |||
|
716 | ||||
|
717 | This page: | |||
|
718 | \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html} | |||
|
719 | ||||
|
720 | \end_inset | |||
|
721 | ||||
|
722 | contains information on this topic, with additional details on how to make | |||
|
723 | IPython and matplotlib play nicely under OSX. | |||
701 | \layout Subsubsection* |
|
724 | \layout Subsubsection* | |
702 |
|
725 | |||
703 | GUI problems |
|
726 | GUI problems | |
704 | \layout Standard |
|
727 | \layout Standard | |
705 |
|
728 | |||
706 | The following instructions apply to an install of IPython under OSX from |
|
729 | The following instructions apply to an install of IPython under OSX from | |
707 | unpacking the |
|
730 | unpacking the | |
708 | \family typewriter |
|
731 | \family typewriter | |
709 | .tar.gz |
|
732 | .tar.gz | |
710 | \family default |
|
733 | \family default | |
711 | distribution and installing it for the default Python interpreter shipped |
|
734 | distribution and installing it for the default Python interpreter shipped | |
712 | by Apple. |
|
735 | by Apple. | |
713 | If you are using a fink install, fink will take care of these details for |
|
736 | If you are using a fink install, fink will take care of these details for | |
714 | you, by installing IPython against fink's Python. |
|
737 | you, by installing IPython against fink's Python. | |
715 | \layout Standard |
|
738 | \layout Standard | |
716 |
|
739 | |||
717 | IPython offers various forms of support for interacting with graphical applicati |
|
740 | IPython offers various forms of support for interacting with graphical applicati | |
718 | ons from the command line, from simple Tk apps (which are in principle always |
|
741 | ons from the command line, from simple Tk apps (which are in principle always | |
719 |
supported by Python) to interactive control of WX, Q |
|
742 | supported by Python) to interactive control of WX, Qt and GTK apps. | |
720 | Under OSX, however, this requires that ipython is installed by calling |
|
743 | Under OSX, however, this requires that ipython is installed by calling | |
721 | the special |
|
744 | the special | |
722 | \family typewriter |
|
745 | \family typewriter | |
723 | pythonw |
|
746 | pythonw | |
724 | \family default |
|
747 | \family default | |
725 | script at installation time, which takes care of coordinating things with |
|
748 | script at installation time, which takes care of coordinating things with | |
726 | Apple's graphical environment. |
|
749 | Apple's graphical environment. | |
727 | \layout Standard |
|
750 | \layout Standard | |
728 |
|
751 | |||
729 | So when installing under OSX, it is best to use the following command |
|
752 | So when installing under OSX, it is best to use the following command: | |
|
753 | \family typewriter | |||
|
754 | ||||
|
755 | \newline | |||
|
756 | ||||
|
757 | \family default | |||
|
758 | ||||
730 | \begin_inset ERT |
|
759 | \begin_inset ERT | |
731 | status Collapsed |
|
760 | status Collapsed | |
732 |
|
761 | |||
733 | \layout Standard |
|
762 | \layout Standard | |
734 |
|
763 | |||
735 | \backslash |
|
764 | \backslash | |
736 | html{ |
|
765 | verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin| | |
737 | \backslash |
|
|||
738 | emph{[Again, in the HTML manual, the option is called -~-install=scripts, with TWO dashes and no intervening space between the dashes]}} |
|
|||
739 | \end_inset |
|
766 | \end_inset | |
740 |
|
767 | |||
741 | : |
|
|||
742 | \family typewriter |
|
|||
743 |
|
768 | |||
744 | \newline |
|
769 | \newline | |
745 | \SpecialChar ~ |
|
770 | or | |
746 | \SpecialChar ~ |
|
|||
747 | $ sudo pythonw setup.py install --install-scripts=/usr/local/bin |
|
|||
748 | \family default |
|
|||
749 |
|
||||
750 | \newline |
|
771 | \newline | |
751 | or |
|
|||
752 | \family typewriter |
|
|||
753 |
|
772 | |||
754 | \newline |
|
773 | \begin_inset ERT | |
755 | \SpecialChar ~ |
|
774 | status Open | |
756 | \SpecialChar ~ |
|
|||
757 | $ sudo pythonw setup.py install --install-scripts=/usr/bin |
|
|||
758 | \newline |
|
|||
759 |
|
775 | |||
760 | \family default |
|
776 | \layout Standard | |
|
777 | ||||
|
778 | \backslash | |||
|
779 | verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin| | |||
|
780 | \end_inset | |||
|
781 | ||||
|
782 | ||||
|
783 | \newline | |||
761 | depending on where you like to keep hand-installed executables. |
|
784 | depending on where you like to keep hand-installed executables. | |
762 | \layout Standard |
|
785 | \layout Standard | |
763 |
|
786 | |||
764 | The resulting script will have an appropriate shebang line (the first line |
|
787 | The resulting script will have an appropriate shebang line (the first line | |
765 | in the script whic begins with |
|
788 | in the script whic begins with | |
766 | \family typewriter |
|
789 | \family typewriter | |
767 | #!... |
|
790 | #!... | |
768 | \family default |
|
791 | \family default | |
769 | ) such that the ipython interpreter can interact with the OS X GUI. |
|
792 | ) such that the ipython interpreter can interact with the OS X GUI. | |
770 | If the installed version does not work and has a shebang line that points |
|
793 | If the installed version does not work and has a shebang line that points | |
771 | to, for example, just |
|
794 | to, for example, just | |
772 | \family typewriter |
|
795 | \family typewriter | |
773 | /usr/bin/python |
|
796 | /usr/bin/python | |
774 | \family default |
|
797 | \family default | |
775 | , then you might have a stale, cached version in your |
|
798 | , then you might have a stale, cached version in your | |
776 | \family typewriter |
|
799 | \family typewriter | |
777 | build/scripts-<python-version> |
|
800 | build/scripts-<python-version> | |
778 | \family default |
|
801 | \family default | |
779 | directory. |
|
802 | directory. | |
780 | Delete that directory and rerun the |
|
803 | Delete that directory and rerun the | |
781 | \family typewriter |
|
804 | \family typewriter | |
782 | setup.py |
|
805 | setup.py | |
783 | \family default |
|
806 | \family default | |
784 | . |
|
807 | . | |
785 |
|
808 | |||
786 | \layout Standard |
|
809 | \layout Standard | |
787 |
|
810 | |||
788 | It is also a good idea to use the special flag |
|
811 | It is also a good idea to use the special flag | |
789 | \family typewriter |
|
812 | \begin_inset ERT | |
790 | --install-scripts |
|
813 | status Collapsed | |
791 | \family default |
|
814 | ||
|
815 | \layout Standard | |||
|
816 | ||||
|
817 | \backslash | |||
|
818 | verb|--install-scripts| | |||
|
819 | \end_inset | |||
|
820 | ||||
792 | as indicated above, to ensure that the ipython scripts end up in a location |
|
821 | as indicated above, to ensure that the ipython scripts end up in a location | |
793 | which is part of your |
|
822 | which is part of your | |
794 | \family typewriter |
|
823 | \family typewriter | |
795 | $PATH |
|
824 | $PATH | |
796 | \family default |
|
825 | \family default | |
797 | . |
|
826 | . | |
798 | Otherwise Apple's Python will put the scripts in an internal directory |
|
827 | Otherwise Apple's Python will put the scripts in an internal directory | |
799 | not available by default at the command line (if you use |
|
828 | not available by default at the command line (if you use | |
800 | \family typewriter |
|
829 | \family typewriter | |
801 | /usr/local/bin |
|
830 | /usr/local/bin | |
802 | \family default |
|
831 | \family default | |
803 | , you need to make sure this is in your |
|
832 | , you need to make sure this is in your | |
804 | \family typewriter |
|
833 | \family typewriter | |
805 | $PATH |
|
834 | $PATH | |
806 | \family default |
|
835 | \family default | |
807 | , which may not be true by default). |
|
836 | , which may not be true by default). | |
808 | \layout Subsubsection* |
|
837 | \layout Subsubsection* | |
809 |
|
838 | |||
810 | Readline problems |
|
839 | Readline problems | |
811 | \layout Standard |
|
840 | \layout Standard | |
812 |
|
841 | |||
813 | By default, the Python version shipped by Apple does |
|
842 | By default, the Python version shipped by Apple does | |
814 | \emph on |
|
843 | \emph on | |
815 | not |
|
844 | not | |
816 | \emph default |
|
845 | \emph default | |
817 | include the readline library, so central to IPython's behavior. |
|
846 | include the readline library, so central to IPython's behavior. | |
818 | If you install IPython against Apple's Python, you will not have arrow |
|
847 | If you install IPython against Apple's Python, you will not have arrow | |
819 | keys, tab completion, etc. |
|
848 | keys, tab completion, etc. | |
820 | For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here: |
|
849 | For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here: | |
821 | \newline |
|
850 | \newline | |
822 |
|
851 | |||
823 | \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip} |
|
852 | \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip} | |
824 |
|
853 | |||
825 | \end_inset |
|
854 | \end_inset | |
826 |
|
855 | |||
827 |
|
856 | |||
828 | \layout Standard |
|
857 | \layout Standard | |
829 |
|
858 | |||
830 | If you are using OSX 10.4 (Tiger), after installing this package you need |
|
859 | If you are using OSX 10.4 (Tiger), after installing this package you need | |
831 | to either: |
|
860 | to either: | |
832 | \layout Enumerate |
|
861 | \layout Enumerate | |
833 |
|
862 | |||
834 | move |
|
863 | move | |
835 | \family typewriter |
|
864 | \family typewriter | |
836 | readline.so |
|
865 | readline.so | |
837 | \family default |
|
866 | \family default | |
838 | from |
|
867 | from | |
839 | \family typewriter |
|
868 | \family typewriter | |
840 | /Library/Python/2.3 |
|
869 | /Library/Python/2.3 | |
841 | \family default |
|
870 | \family default | |
842 | to |
|
871 | to | |
843 | \family typewriter |
|
872 | \family typewriter | |
844 | /Library/Python/2.3/site-packages |
|
873 | /Library/Python/2.3/site-packages | |
845 | \family default |
|
874 | \family default | |
846 | , or |
|
875 | , or | |
847 | \layout Enumerate |
|
876 | \layout Enumerate | |
848 |
|
877 | |||
849 | install |
|
878 | install | |
850 | \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip} |
|
879 | \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip} | |
851 |
|
880 | |||
852 | \end_inset |
|
881 | \end_inset | |
853 |
|
882 | |||
854 |
|
883 | |||
855 | \layout Standard |
|
884 | \layout Standard | |
856 |
|
885 | |||
857 | Users installing against Fink's Python or a properly hand-built one should |
|
886 | Users installing against Fink's Python or a properly hand-built one should | |
858 | not have this problem. |
|
887 | not have this problem. | |
859 | \layout Subsection |
|
888 | \layout Subsection | |
860 |
|
889 | |||
861 |
|
890 | |||
862 | \begin_inset LatexCommand \label{sub:Under-Windows} |
|
891 | \begin_inset LatexCommand \label{sub:Under-Windows} | |
863 |
|
892 | |||
864 | \end_inset |
|
893 | \end_inset | |
865 |
|
894 | |||
866 | Windows instructions |
|
895 | Windows instructions | |
867 | \layout Standard |
|
896 | \layout Standard | |
868 |
|
897 | |||
869 | While you can use IPython under Windows with only a stock Python installation, |
|
898 | While you can use IPython under Windows with only a stock Python installation, | |
870 | there is one extension, |
|
899 | there is one extension, | |
871 | \family typewriter |
|
900 | \family typewriter | |
872 | readline |
|
901 | readline | |
873 | \family default |
|
902 | \family default | |
874 | , which will make the whole experience a lot more pleasant. |
|
903 | , which will make the whole experience a lot more pleasant. | |
875 | It is almost a requirement, since IPython will complain in its absence |
|
904 | It is almost a requirement, since IPython will complain in its absence | |
876 | (though it will function). |
|
905 | (though it will function). | |
877 |
|
906 | |||
878 | \layout Standard |
|
907 | \layout Standard | |
879 |
|
908 | |||
880 | The |
|
909 | The | |
881 | \family typewriter |
|
910 | \family typewriter | |
882 | readline |
|
911 | readline | |
883 | \family default |
|
912 | \family default | |
884 | extension needs two other libraries to work, so in all you need: |
|
913 | extension needs two other libraries to work, so in all you need: | |
885 | \layout Enumerate |
|
914 | \layout Enumerate | |
886 |
|
915 | |||
887 |
|
916 | |||
888 | \family typewriter |
|
917 | \family typewriter | |
889 | PyWin32 |
|
918 | PyWin32 | |
890 | \family default |
|
919 | \family default | |
891 | from |
|
920 | from | |
892 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond} |
|
921 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond} | |
893 |
|
922 | |||
894 | \end_inset |
|
923 | \end_inset | |
895 |
|
924 | |||
896 | . |
|
925 | . | |
897 | \layout Enumerate |
|
926 | \layout Enumerate | |
898 |
|
927 | |||
899 |
|
928 | |||
900 | \family typewriter |
|
929 | \family typewriter | |
901 | CTypes |
|
930 | CTypes | |
902 | \family default |
|
931 | \family default | |
903 | from |
|
932 | from | |
904 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes} |
|
933 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes} | |
905 |
|
934 | |||
906 | \end_inset |
|
935 | \end_inset | |
907 |
|
936 | |||
908 | (you |
|
937 | (you | |
909 | \emph on |
|
938 | \emph on | |
910 | must |
|
939 | must | |
911 | \emph default |
|
940 | \emph default | |
912 | use version 0.9.1 or newer). |
|
941 | use version 0.9.1 or newer). | |
913 | \layout Enumerate |
|
942 | \layout Enumerate | |
914 |
|
943 | |||
915 |
|
944 | |||
916 | \family typewriter |
|
945 | \family typewriter | |
917 | Readline |
|
946 | Readline | |
918 | \family default |
|
947 | \family default | |
919 | for Windows from |
|
948 | for Windows from | |
920 | \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools} |
|
949 | \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools} | |
921 |
|
950 | |||
922 | \end_inset |
|
951 | \end_inset | |
923 |
|
952 | |||
924 | . |
|
953 | . | |
925 | \layout Standard |
|
954 | \layout Standard | |
926 |
|
955 | |||
927 |
|
956 | |||
928 | \series bold |
|
957 | \series bold | |
929 | Warning about a broken readline-like library: |
|
958 | Warning about a broken readline-like library: | |
930 | \series default |
|
959 | \series default | |
931 | several users have reported problems stemming from using the pseudo-readline |
|
960 | several users have reported problems stemming from using the pseudo-readline | |
932 | library at |
|
961 | library at | |
933 | \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html} |
|
962 | \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html} | |
934 |
|
963 | |||
935 | \end_inset |
|
964 | \end_inset | |
936 |
|
965 | |||
937 | . |
|
966 | . | |
938 | This is a broken library which, while called readline, only implements |
|
967 | This is a broken library which, while called readline, only implements | |
939 | an incomplete subset of the readline API. |
|
968 | an incomplete subset of the readline API. | |
940 | Since it is still called readline, it fools IPython's detection mechanisms |
|
969 | Since it is still called readline, it fools IPython's detection mechanisms | |
941 | and causes unpredictable crashes later. |
|
970 | and causes unpredictable crashes later. | |
942 | If you wish to use IPython under Windows, you must NOT use this library, |
|
971 | If you wish to use IPython under Windows, you must NOT use this library, | |
943 | which for all purposes is (at least as of version 1.6) terminally broken. |
|
972 | which for all purposes is (at least as of version 1.6) terminally broken. | |
944 | \layout Subsubsection |
|
973 | \layout Subsubsection | |
945 |
|
974 | |||
946 | Gary Bishop's readline and color support for Windows |
|
975 | Gary Bishop's readline and color support for Windows | |
947 | \layout Standard |
|
976 | \layout Standard | |
948 |
|
977 | |||
949 | Some of IPython's very useful features are: |
|
978 | Some of IPython's very useful features are: | |
950 | \layout Itemize |
|
979 | \layout Itemize | |
951 |
|
980 | |||
952 | Integrated readline support (Tab-based file, object and attribute completion, |
|
981 | Integrated readline support (Tab-based file, object and attribute completion, | |
953 | input history across sessions, editable command line, etc.) |
|
982 | input history across sessions, editable command line, etc.) | |
954 | \layout Itemize |
|
983 | \layout Itemize | |
955 |
|
984 | |||
956 | Coloring of prompts, code and tracebacks. |
|
985 | Coloring of prompts, code and tracebacks. | |
957 | \layout Standard |
|
986 | \layout Standard | |
958 |
|
987 | |||
959 | These, by default, are only available under Unix-like operating systems. |
|
988 | These, by default, are only available under Unix-like operating systems. | |
960 | However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit |
|
989 | However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit | |
961 | from them. |
|
990 | from them. | |
962 | His readline library implements both GNU readline functionality and color |
|
991 | His readline library implements both GNU readline functionality and color | |
963 | support, so that IPython under Windows XP/2k can be as friendly and powerful |
|
992 | support, so that IPython under Windows XP/2k can be as friendly and powerful | |
964 | as under Unix-like environments. |
|
993 | as under Unix-like environments. | |
965 | \layout Standard |
|
994 | \layout Standard | |
966 |
|
995 | |||
967 | You can find Gary's tools at |
|
996 | You can find Gary's tools at | |
968 | \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools} |
|
997 | \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools} | |
969 |
|
998 | |||
970 | \end_inset |
|
999 | \end_inset | |
971 |
|
1000 | |||
972 | ; Gary's |
|
1001 | ; Gary's | |
973 | \family typewriter |
|
1002 | \family typewriter | |
974 | readline |
|
1003 | readline | |
975 | \family default |
|
1004 | \family default | |
976 | requires in turn the |
|
1005 | requires in turn the | |
977 | \family typewriter |
|
1006 | \family typewriter | |
978 | ctypes |
|
1007 | ctypes | |
979 | \family default |
|
1008 | \family default | |
980 | library by Thomas Heller, available at |
|
1009 | library by Thomas Heller, available at | |
981 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes} |
|
1010 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes} | |
982 |
|
1011 | |||
983 | \end_inset |
|
1012 | \end_inset | |
984 |
|
1013 | |||
985 | , and Mark Hammond's |
|
1014 | , and Mark Hammond's | |
986 | \family typewriter |
|
1015 | \family typewriter | |
987 | PyWin32 |
|
1016 | PyWin32 | |
988 | \family default |
|
1017 | \family default | |
989 | from |
|
1018 | from | |
990 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond} |
|
1019 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond} | |
991 |
|
1020 | |||
992 | \end_inset |
|
1021 | \end_inset | |
993 |
|
1022 | |||
994 | ( |
|
1023 | ( | |
995 | \family typewriter |
|
1024 | \family typewriter | |
996 | PyWin32 |
|
1025 | PyWin32 | |
997 | \family default |
|
1026 | \family default | |
998 | is great for anything Windows-related anyway, so you might as well get |
|
1027 | is great for anything Windows-related anyway, so you might as well get | |
999 | it). |
|
1028 | it). | |
1000 | \layout Standard |
|
1029 | \layout Standard | |
1001 |
|
1030 | |||
1002 | Under MS\SpecialChar ~ |
|
1031 | Under MS\SpecialChar ~ | |
1003 | Windows, IPython will complain if it can not find this |
|
1032 | Windows, IPython will complain if it can not find this | |
1004 | \family typewriter |
|
1033 | \family typewriter | |
1005 | readline |
|
1034 | readline | |
1006 | \family default |
|
1035 | \family default | |
1007 | library at startup and any time the |
|
1036 | library at startup and any time the | |
1008 | \family typewriter |
|
1037 | \family typewriter | |
1009 | %colors |
|
1038 | %colors | |
1010 | \family default |
|
1039 | \family default | |
1011 | command is issued, so you can consider it to be a quasi-requirement. |
|
1040 | command is issued, so you can consider it to be a quasi-requirement. | |
1012 | \layout Subsubsection |
|
1041 | \layout Subsubsection | |
1013 |
|
1042 | |||
1014 | Installation procedure |
|
1043 | Installation procedure | |
1015 | \layout Standard |
|
1044 | \layout Standard | |
1016 |
|
1045 | |||
1017 | Once you have the above installed, from the IPython download directory grab |
|
1046 | Once you have the above installed, from the IPython download directory grab | |
1018 | the |
|
1047 | the | |
1019 | \family typewriter |
|
1048 | \family typewriter | |
1020 | ipython-XXX.win32.exe |
|
1049 | ipython-XXX.win32.exe | |
1021 | \family default |
|
1050 | \family default | |
1022 | file, where |
|
1051 | file, where | |
1023 | \family typewriter |
|
1052 | \family typewriter | |
1024 | XXX |
|
1053 | XXX | |
1025 | \family default |
|
1054 | \family default | |
1026 | represents the version number. |
|
1055 | represents the version number. | |
1027 | This is a regular windows executable installer, which you can simply double-cli |
|
1056 | This is a regular windows executable installer, which you can simply double-cli | |
1028 | ck to install. |
|
1057 | ck to install. | |
1029 | It will add an entry for IPython to your Start Menu, as well as registering |
|
1058 | It will add an entry for IPython to your Start Menu, as well as registering | |
1030 | IPython in the Windows list of applications, so you can later uninstall |
|
1059 | IPython in the Windows list of applications, so you can later uninstall | |
1031 | it from the Control Panel. |
|
1060 | it from the Control Panel. | |
1032 |
|
1061 | |||
1033 | \layout Standard |
|
1062 | \layout Standard | |
1034 |
|
1063 | |||
1035 | IPython tries to install the configuration information in a directory named |
|
1064 | IPython tries to install the configuration information in a directory named | |
1036 |
|
1065 | |||
1037 | \family typewriter |
|
1066 | \family typewriter | |
1038 | .ipython |
|
1067 | .ipython | |
1039 | \family default |
|
1068 | \family default | |
1040 | ( |
|
1069 | ( | |
1041 | \family typewriter |
|
1070 | \family typewriter | |
1042 | _ipython |
|
1071 | _ipython | |
1043 | \family default |
|
1072 | \family default | |
1044 | under Windows) located in your `home' directory. |
|
1073 | under Windows) located in your `home' directory. | |
1045 | IPython sets this directory by looking for a |
|
1074 | IPython sets this directory by looking for a | |
1046 | \family typewriter |
|
1075 | \family typewriter | |
1047 | HOME |
|
1076 | HOME | |
1048 | \family default |
|
1077 | \family default | |
1049 | environment variable; if such a variable does not exist, it uses |
|
1078 | environment variable; if such a variable does not exist, it uses | |
1050 | \family typewriter |
|
1079 | \family typewriter | |
1051 | HOMEDRIVE |
|
1080 | HOMEDRIVE | |
1052 | \backslash |
|
1081 | \backslash | |
1053 | HOMEPATH |
|
1082 | HOMEPATH | |
1054 | \family default |
|
1083 | \family default | |
1055 | (these are always defined by Windows). |
|
1084 | (these are always defined by Windows). | |
1056 | This typically gives something like |
|
1085 | This typically gives something like | |
1057 | \family typewriter |
|
1086 | \family typewriter | |
1058 | C: |
|
1087 | C: | |
1059 | \backslash |
|
1088 | \backslash | |
1060 | Documents and Settings |
|
1089 | Documents and Settings | |
1061 | \backslash |
|
1090 | \backslash | |
1062 | YourUserName |
|
1091 | YourUserName | |
1063 | \family default |
|
1092 | \family default | |
1064 | , but your local details may vary. |
|
1093 | , but your local details may vary. | |
1065 | In this directory you will find all the files that configure IPython's |
|
1094 | In this directory you will find all the files that configure IPython's | |
1066 | defaults, and you can put there your profiles and extensions. |
|
1095 | defaults, and you can put there your profiles and extensions. | |
1067 | This directory is automatically added by IPython to |
|
1096 | This directory is automatically added by IPython to | |
1068 | \family typewriter |
|
1097 | \family typewriter | |
1069 | sys.path |
|
1098 | sys.path | |
1070 | \family default |
|
1099 | \family default | |
1071 | , so anything you place there can be found by |
|
1100 | , so anything you place there can be found by | |
1072 | \family typewriter |
|
1101 | \family typewriter | |
1073 | import |
|
1102 | import | |
1074 | \family default |
|
1103 | \family default | |
1075 | statements. |
|
1104 | statements. | |
1076 | \layout Paragraph |
|
1105 | \layout Paragraph | |
1077 |
|
1106 | |||
1078 | Upgrading |
|
1107 | Upgrading | |
1079 | \layout Standard |
|
1108 | \layout Standard | |
1080 |
|
1109 | |||
1081 | For an IPython upgrade, you should first uninstall the previous version. |
|
1110 | For an IPython upgrade, you should first uninstall the previous version. | |
1082 | This will ensure that all files and directories (such as the documentation) |
|
1111 | This will ensure that all files and directories (such as the documentation) | |
1083 | which carry embedded version strings in their names are properly removed. |
|
1112 | which carry embedded version strings in their names are properly removed. | |
1084 | \layout Paragraph |
|
1113 | \layout Paragraph | |
1085 |
|
1114 | |||
1086 | Manual installation under Win32 |
|
1115 | Manual installation under Win32 | |
1087 | \layout Standard |
|
1116 | \layout Standard | |
1088 |
|
1117 | |||
1089 | In case the automatic installer does not work for some reason, you can download |
|
1118 | In case the automatic installer does not work for some reason, you can download | |
1090 | the |
|
1119 | the | |
1091 | \family typewriter |
|
1120 | \family typewriter | |
1092 | ipython-XXX.tar.gz |
|
1121 | ipython-XXX.tar.gz | |
1093 | \family default |
|
1122 | \family default | |
1094 | file, which contains the full IPython source distribution (the popular |
|
1123 | file, which contains the full IPython source distribution (the popular | |
1095 | WinZip can read |
|
1124 | WinZip can read | |
1096 | \family typewriter |
|
1125 | \family typewriter | |
1097 | .tar.gz |
|
1126 | .tar.gz | |
1098 | \family default |
|
1127 | \family default | |
1099 | files). |
|
1128 | files). | |
1100 | After uncompressing the archive, you can install it at a command terminal |
|
1129 | After uncompressing the archive, you can install it at a command terminal | |
1101 | just like any other Python module, by using |
|
1130 | just like any other Python module, by using | |
1102 | \family typewriter |
|
1131 | \family typewriter | |
1103 | `python setup.py install' |
|
1132 | `python setup.py install' | |
1104 | \family default |
|
1133 | \family default | |
1105 | . |
|
1134 | . | |
1106 |
|
1135 | |||
1107 | \layout Standard |
|
1136 | \layout Standard | |
1108 |
|
1137 | |||
1109 | After the installation, run the supplied |
|
1138 | After the installation, run the supplied | |
1110 | \family typewriter |
|
1139 | \family typewriter | |
1111 | win32_manual_post_install.py |
|
1140 | win32_manual_post_install.py | |
1112 | \family default |
|
1141 | \family default | |
1113 | script, which creates the necessary Start Menu shortcuts for you. |
|
1142 | script, which creates the necessary Start Menu shortcuts for you. | |
1114 | \layout Subsection |
|
1143 | \layout Subsection | |
1115 |
|
1144 | |||
1116 |
|
1145 | |||
1117 | \begin_inset LatexCommand \label{sec:upgrade} |
|
1146 | \begin_inset LatexCommand \label{sec:upgrade} | |
1118 |
|
1147 | |||
1119 | \end_inset |
|
1148 | \end_inset | |
1120 |
|
1149 | |||
1121 | Upgrading from a previous version |
|
1150 | Upgrading from a previous version | |
1122 | \layout Standard |
|
1151 | \layout Standard | |
1123 |
|
1152 | |||
1124 | If you are upgrading from a previous version of IPython, after doing the |
|
1153 | If you are upgrading from a previous version of IPython, after doing the | |
1125 | routine installation described above, you should call IPython with the |
|
1154 | routine installation described above, you should call IPython with the | |
1126 |
|
1155 | |||
1127 | \family typewriter |
|
1156 | \family typewriter | |
1128 | -upgrade |
|
1157 | -upgrade | |
1129 | \family default |
|
1158 | \family default | |
1130 | option the first time you run your new copy. |
|
1159 | option the first time you run your new copy. | |
1131 | This will automatically update your configuration directory while preserving |
|
1160 | This will automatically update your configuration directory while preserving | |
1132 | copies of your old files. |
|
1161 | copies of your old files. | |
1133 | You can then later merge back any personal customizations you may have |
|
1162 | You can then later merge back any personal customizations you may have | |
1134 | made into the new files. |
|
1163 | made into the new files. | |
1135 | It is a good idea to do this as there may be new options available in the |
|
1164 | It is a good idea to do this as there may be new options available in the | |
1136 | new configuration files which you will not have. |
|
1165 | new configuration files which you will not have. | |
1137 | \layout Standard |
|
1166 | \layout Standard | |
1138 |
|
1167 | |||
1139 | Under Windows, if you don't know how to call python scripts with arguments |
|
1168 | Under Windows, if you don't know how to call python scripts with arguments | |
1140 | from a command line, simply delete the old config directory and IPython |
|
1169 | from a command line, simply delete the old config directory and IPython | |
1141 | will make a new one. |
|
1170 | will make a new one. | |
1142 | Win2k and WinXP users will find it in |
|
1171 | Win2k and WinXP users will find it in | |
1143 | \family typewriter |
|
1172 | \family typewriter | |
1144 | C: |
|
1173 | C: | |
1145 | \backslash |
|
1174 | \backslash | |
1146 | Documents and Settings |
|
1175 | Documents and Settings | |
1147 | \backslash |
|
1176 | \backslash | |
1148 | YourUserName |
|
1177 | YourUserName | |
1149 | \backslash |
|
1178 | \backslash | |
1150 |
|
|
1179 | _ipython | |
1151 | \family default |
|
1180 | \family default | |
1152 | , and Win 9x users under |
|
1181 | , and Win 9x users under | |
1153 | \family typewriter |
|
1182 | \family typewriter | |
1154 | C: |
|
1183 | C: | |
1155 | \backslash |
|
1184 | \backslash | |
1156 | Program Files |
|
1185 | Program Files | |
1157 | \backslash |
|
1186 | \backslash | |
1158 | IPython |
|
1187 | IPython | |
1159 | \backslash |
|
1188 | \backslash | |
1160 |
|
|
1189 | _ipython. | |
1161 | \layout Section |
|
1190 | \layout Section | |
1162 |
|
1191 | |||
1163 |
|
1192 | |||
1164 | \begin_inset LatexCommand \label{sec:good_config} |
|
1193 | \begin_inset LatexCommand \label{sec:good_config} | |
1165 |
|
1194 | |||
1166 | \end_inset |
|
1195 | \end_inset | |
1167 |
|
1196 | |||
1168 |
|
1197 | |||
1169 | \begin_inset OptArg |
|
1198 | \begin_inset OptArg | |
1170 | collapsed true |
|
1199 | collapsed true | |
1171 |
|
1200 | |||
1172 | \layout Standard |
|
1201 | \layout Standard | |
1173 |
|
1202 | |||
1174 | Initial configuration |
|
1203 | Initial configuration | |
1175 | \begin_inset ERT |
|
1204 | \begin_inset ERT | |
1176 | status Collapsed |
|
1205 | status Collapsed | |
1177 |
|
1206 | |||
1178 | \layout Standard |
|
1207 | \layout Standard | |
1179 |
|
1208 | |||
1180 | \backslash |
|
1209 | \backslash | |
1181 | ldots |
|
1210 | ldots | |
1182 | \end_inset |
|
1211 | \end_inset | |
1183 |
|
1212 | |||
1184 |
|
1213 | |||
1185 | \end_inset |
|
1214 | \end_inset | |
1186 |
|
1215 | |||
1187 | Initial configuration of your environment |
|
1216 | Initial configuration of your environment | |
1188 | \layout Standard |
|
1217 | \layout Standard | |
1189 |
|
1218 | |||
1190 | This section will help you set various things in your environment for your |
|
1219 | This section will help you set various things in your environment for your | |
1191 | IPython sessions to be as efficient as possible. |
|
1220 | IPython sessions to be as efficient as possible. | |
1192 | All of IPython's configuration information, along with several example |
|
1221 | All of IPython's configuration information, along with several example | |
1193 | files, is stored in a directory named by default |
|
1222 | files, is stored in a directory named by default | |
1194 | \family typewriter |
|
1223 | \family typewriter | |
1195 | $HOME/.ipython |
|
1224 | $HOME/.ipython | |
1196 | \family default |
|
1225 | \family default | |
1197 | . |
|
1226 | . | |
1198 | You can change this by defining the environment variable |
|
1227 | You can change this by defining the environment variable | |
1199 | \family typewriter |
|
1228 | \family typewriter | |
1200 | IPYTHONDIR |
|
1229 | IPYTHONDIR | |
1201 | \family default |
|
1230 | \family default | |
1202 | , or at runtime with the command line option |
|
1231 | , or at runtime with the command line option | |
1203 | \family typewriter |
|
1232 | \family typewriter | |
1204 | -ipythondir |
|
1233 | -ipythondir | |
1205 | \family default |
|
1234 | \family default | |
1206 | . |
|
1235 | . | |
1207 | \layout Standard |
|
1236 | \layout Standard | |
1208 |
|
1237 | |||
1209 | If all goes well, the first time you run IPython it should automatically |
|
1238 | If all goes well, the first time you run IPython it should automatically | |
1210 | create a user copy of the config directory for you, based on its builtin |
|
1239 | create a user copy of the config directory for you, based on its builtin | |
1211 | defaults. |
|
1240 | defaults. | |
1212 | You can look at the files it creates to learn more about configuring the |
|
1241 | You can look at the files it creates to learn more about configuring the | |
1213 | system. |
|
1242 | system. | |
1214 | The main file you will modify to configure IPython's behavior is called |
|
1243 | The main file you will modify to configure IPython's behavior is called | |
1215 |
|
1244 | |||
1216 | \family typewriter |
|
1245 | \family typewriter | |
1217 | ipythonrc |
|
1246 | ipythonrc | |
1218 | \family default |
|
1247 | \family default | |
1219 | (with a |
|
1248 | (with a | |
1220 | \family typewriter |
|
1249 | \family typewriter | |
1221 | .ini |
|
1250 | .ini | |
1222 | \family default |
|
1251 | \family default | |
1223 | extension under Windows), included for reference in Sec. |
|
1252 | extension under Windows), included for reference in Sec. | |
1224 |
|
1253 | |||
1225 | \begin_inset LatexCommand \ref{sec:ipytonrc-sample} |
|
1254 | \begin_inset LatexCommand \ref{sec:ipytonrc-sample} | |
1226 |
|
1255 | |||
1227 | \end_inset |
|
1256 | \end_inset | |
1228 |
|
1257 | |||
1229 | . |
|
1258 | . | |
1230 | This file is very commented and has many variables you can change to suit |
|
1259 | This file is very commented and has many variables you can change to suit | |
1231 | your taste, you can find more details in Sec. |
|
1260 | your taste, you can find more details in Sec. | |
1232 |
|
1261 | |||
1233 | \begin_inset LatexCommand \ref{sec:customization} |
|
1262 | \begin_inset LatexCommand \ref{sec:customization} | |
1234 |
|
1263 | |||
1235 | \end_inset |
|
1264 | \end_inset | |
1236 |
|
1265 | |||
1237 | . |
|
1266 | . | |
1238 | Here we discuss the basic things you will want to make sure things are |
|
1267 | Here we discuss the basic things you will want to make sure things are | |
1239 | working properly from the beginning. |
|
1268 | working properly from the beginning. | |
1240 | \layout Subsection |
|
1269 | \layout Subsection | |
1241 |
|
1270 | |||
1242 |
|
1271 | |||
1243 | \begin_inset LatexCommand \label{sec:help-access} |
|
1272 | \begin_inset LatexCommand \label{sec:help-access} | |
1244 |
|
1273 | |||
1245 | \end_inset |
|
1274 | \end_inset | |
1246 |
|
1275 | |||
1247 | Access to the Python help system |
|
1276 | Access to the Python help system | |
1248 | \layout Standard |
|
1277 | \layout Standard | |
1249 |
|
1278 | |||
1250 | This is true for Python in general (not just for IPython): you should have |
|
1279 | This is true for Python in general (not just for IPython): you should have | |
1251 | an environment variable called |
|
1280 | an environment variable called | |
1252 | \family typewriter |
|
1281 | \family typewriter | |
1253 | PYTHONDOCS |
|
1282 | PYTHONDOCS | |
1254 | \family default |
|
1283 | \family default | |
1255 | pointing to the directory where your HTML Python documentation lives. |
|
1284 | pointing to the directory where your HTML Python documentation lives. | |
1256 | In my system it's |
|
1285 | In my system it's | |
1257 | \family typewriter |
|
1286 | \family typewriter | |
1258 | /usr/share/doc/python-docs-2.3.4/html |
|
1287 | /usr/share/doc/python-docs-2.3.4/html | |
1259 | \family default |
|
1288 | \family default | |
1260 | , check your local details or ask your systems administrator. |
|
1289 | , check your local details or ask your systems administrator. | |
1261 |
|
1290 | |||
1262 | \layout Standard |
|
1291 | \layout Standard | |
1263 |
|
1292 | |||
1264 | This is the directory which holds the HTML version of the Python manuals. |
|
1293 | This is the directory which holds the HTML version of the Python manuals. | |
1265 | Unfortunately it seems that different Linux distributions package these |
|
1294 | Unfortunately it seems that different Linux distributions package these | |
1266 | files differently, so you may have to look around a bit. |
|
1295 | files differently, so you may have to look around a bit. | |
1267 | Below I show the contents of this directory on my system for reference: |
|
1296 | Below I show the contents of this directory on my system for reference: | |
1268 | \layout Standard |
|
1297 | \layout Standard | |
1269 |
|
1298 | |||
1270 |
|
1299 | |||
1271 | \family typewriter |
|
1300 | \family typewriter | |
1272 | [html]> ls |
|
1301 | [html]> ls | |
1273 | \newline |
|
1302 | \newline | |
1274 | about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/ |
|
1303 | about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/ | |
1275 | about.html api/ doc/ icons/ inst/ mac/ ref/ style.css |
|
1304 | about.html api/ doc/ icons/ inst/ mac/ ref/ style.css | |
1276 | \layout Standard |
|
1305 | \layout Standard | |
1277 |
|
1306 | |||
1278 | You should really make sure this variable is correctly set so that Python's |
|
1307 | You should really make sure this variable is correctly set so that Python's | |
1279 | pydoc-based help system works. |
|
1308 | pydoc-based help system works. | |
1280 | It is a powerful and convenient system with full access to the Python manuals |
|
1309 | It is a powerful and convenient system with full access to the Python manuals | |
1281 | and all modules accessible to you. |
|
1310 | and all modules accessible to you. | |
1282 | \layout Standard |
|
1311 | \layout Standard | |
1283 |
|
1312 | |||
1284 | Under Windows it seems that pydoc finds the documentation automatically, |
|
1313 | Under Windows it seems that pydoc finds the documentation automatically, | |
1285 | so no extra setup appears necessary. |
|
1314 | so no extra setup appears necessary. | |
1286 | \layout Subsection |
|
1315 | \layout Subsection | |
1287 |
|
1316 | |||
1288 | Editor |
|
1317 | Editor | |
1289 | \layout Standard |
|
1318 | \layout Standard | |
1290 |
|
1319 | |||
1291 | The |
|
1320 | The | |
1292 | \family typewriter |
|
1321 | \family typewriter | |
1293 | %edit |
|
1322 | %edit | |
1294 | \family default |
|
1323 | \family default | |
1295 | command (and its alias |
|
1324 | command (and its alias | |
1296 | \family typewriter |
|
1325 | \family typewriter | |
1297 | %ed |
|
1326 | %ed | |
1298 | \family default |
|
1327 | \family default | |
1299 | ) will invoke the editor set in your environment as |
|
1328 | ) will invoke the editor set in your environment as | |
1300 | \family typewriter |
|
1329 | \family typewriter | |
1301 | EDITOR |
|
1330 | EDITOR | |
1302 | \family default |
|
1331 | \family default | |
1303 | . |
|
1332 | . | |
1304 | If this variable is not set, it will default to |
|
1333 | If this variable is not set, it will default to | |
1305 | \family typewriter |
|
1334 | \family typewriter | |
1306 | vi |
|
1335 | vi | |
1307 | \family default |
|
1336 | \family default | |
1308 | under Linux/Unix and to |
|
1337 | under Linux/Unix and to | |
1309 | \family typewriter |
|
1338 | \family typewriter | |
1310 | notepad |
|
1339 | notepad | |
1311 | \family default |
|
1340 | \family default | |
1312 | under Windows. |
|
1341 | under Windows. | |
1313 | You may want to set this variable properly and to a lightweight editor |
|
1342 | You may want to set this variable properly and to a lightweight editor | |
1314 | which doesn't take too long to start (that is, something other than a new |
|
1343 | which doesn't take too long to start (that is, something other than a new | |
1315 | instance of |
|
1344 | instance of | |
1316 | \family typewriter |
|
1345 | \family typewriter | |
1317 | Emacs |
|
1346 | Emacs | |
1318 | \family default |
|
1347 | \family default | |
1319 | ). |
|
1348 | ). | |
1320 | This way you can edit multi-line code quickly and with the power of a real |
|
1349 | This way you can edit multi-line code quickly and with the power of a real | |
1321 | editor right inside IPython. |
|
1350 | editor right inside IPython. | |
1322 |
|
1351 | |||
1323 | \layout Standard |
|
1352 | \layout Standard | |
1324 |
|
1353 | |||
1325 | If you are a dedicated |
|
1354 | If you are a dedicated | |
1326 | \family typewriter |
|
1355 | \family typewriter | |
1327 | Emacs |
|
1356 | Emacs | |
1328 | \family default |
|
1357 | \family default | |
1329 | user, you should set up the |
|
1358 | user, you should set up the | |
1330 | \family typewriter |
|
1359 | \family typewriter | |
1331 | Emacs |
|
1360 | Emacs | |
1332 | \family default |
|
1361 | \family default | |
1333 | server so that new requests are handled by the original process. |
|
1362 | server so that new requests are handled by the original process. | |
1334 | This means that almost no time is spent in handling the request (assuming |
|
1363 | This means that almost no time is spent in handling the request (assuming | |
1335 | an |
|
1364 | an | |
1336 | \family typewriter |
|
1365 | \family typewriter | |
1337 | Emacs |
|
1366 | Emacs | |
1338 | \family default |
|
1367 | \family default | |
1339 | process is already running). |
|
1368 | process is already running). | |
1340 | For this to work, you need to set your |
|
1369 | For this to work, you need to set your | |
1341 | \family typewriter |
|
1370 | \family typewriter | |
1342 | EDITOR |
|
1371 | EDITOR | |
1343 | \family default |
|
1372 | \family default | |
1344 | environment variable to |
|
1373 | environment variable to | |
1345 | \family typewriter |
|
1374 | \family typewriter | |
1346 | 'emacsclient' |
|
1375 | 'emacsclient' | |
1347 | \family default |
|
1376 | \family default | |
1348 | . |
|
1377 | . | |
1349 |
|
1378 | |||
1350 | \family typewriter |
|
1379 | \family typewriter | |
1351 |
|
1380 | |||
1352 | \family default |
|
1381 | \family default | |
1353 | The code below, supplied by Francois Pinard, can then be used in your |
|
1382 | The code below, supplied by Francois Pinard, can then be used in your | |
1354 | \family typewriter |
|
1383 | \family typewriter | |
1355 | .emacs |
|
1384 | .emacs | |
1356 | \family default |
|
1385 | \family default | |
1357 | file to enable the server: |
|
1386 | file to enable the server: | |
1358 | \layout Standard |
|
1387 | \layout Standard | |
1359 |
|
1388 | |||
1360 |
|
1389 | |||
1361 | \family typewriter |
|
1390 | \family typewriter | |
1362 | (defvar server-buffer-clients) |
|
1391 | (defvar server-buffer-clients) | |
1363 | \newline |
|
1392 | \newline | |
1364 | (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm)) |
|
1393 | (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm)) | |
1365 | \newline |
|
1394 | \newline | |
1366 |
|
1395 | |||
1367 | \begin_inset ERT |
|
1396 | \begin_inset ERT | |
1368 | status Collapsed |
|
1397 | status Collapsed | |
1369 |
|
1398 | |||
1370 | \layout Standard |
|
1399 | \layout Standard | |
1371 |
|
1400 | |||
1372 | \backslash |
|
1401 | \backslash | |
1373 | hspace*{0mm} |
|
1402 | hspace*{0mm} | |
1374 | \end_inset |
|
1403 | \end_inset | |
1375 |
|
1404 | |||
1376 | \SpecialChar ~ |
|
1405 | \SpecialChar ~ | |
1377 | \SpecialChar ~ |
|
1406 | \SpecialChar ~ | |
1378 | (server-start) |
|
1407 | (server-start) | |
1379 | \newline |
|
1408 | \newline | |
1380 |
|
1409 | |||
1381 | \begin_inset ERT |
|
1410 | \begin_inset ERT | |
1382 | status Collapsed |
|
1411 | status Collapsed | |
1383 |
|
1412 | |||
1384 | \layout Standard |
|
1413 | \layout Standard | |
1385 |
|
1414 | |||
1386 | \backslash |
|
1415 | \backslash | |
1387 | hspace*{0mm} |
|
1416 | hspace*{0mm} | |
1388 | \end_inset |
|
1417 | \end_inset | |
1389 |
|
1418 | |||
1390 | \SpecialChar ~ |
|
1419 | \SpecialChar ~ | |
1391 | \SpecialChar ~ |
|
1420 | \SpecialChar ~ | |
1392 | (defun fp-kill-server-with-buffer-routine () |
|
1421 | (defun fp-kill-server-with-buffer-routine () | |
1393 | \newline |
|
1422 | \newline | |
1394 |
|
1423 | |||
1395 | \begin_inset ERT |
|
1424 | \begin_inset ERT | |
1396 | status Collapsed |
|
1425 | status Collapsed | |
1397 |
|
1426 | |||
1398 | \layout Standard |
|
1427 | \layout Standard | |
1399 |
|
1428 | |||
1400 | \backslash |
|
1429 | \backslash | |
1401 | hspace*{0mm} |
|
1430 | hspace*{0mm} | |
1402 | \end_inset |
|
1431 | \end_inset | |
1403 |
|
1432 | |||
1404 | \SpecialChar ~ |
|
1433 | \SpecialChar ~ | |
1405 | \SpecialChar ~ |
|
1434 | \SpecialChar ~ | |
1406 | \SpecialChar ~ |
|
1435 | \SpecialChar ~ | |
1407 | \SpecialChar ~ |
|
1436 | \SpecialChar ~ | |
1408 | (and server-buffer-clients (server-done))) |
|
1437 | (and server-buffer-clients (server-done))) | |
1409 | \newline |
|
1438 | \newline | |
1410 |
|
1439 | |||
1411 | \begin_inset ERT |
|
1440 | \begin_inset ERT | |
1412 | status Collapsed |
|
1441 | status Collapsed | |
1413 |
|
1442 | |||
1414 | \layout Standard |
|
1443 | \layout Standard | |
1415 |
|
1444 | |||
1416 | \backslash |
|
1445 | \backslash | |
1417 | hspace*{0mm} |
|
1446 | hspace*{0mm} | |
1418 | \end_inset |
|
1447 | \end_inset | |
1419 |
|
1448 | |||
1420 | \SpecialChar ~ |
|
1449 | \SpecialChar ~ | |
1421 | \SpecialChar ~ |
|
1450 | \SpecialChar ~ | |
1422 | (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine)) |
|
1451 | (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine)) | |
1423 | \layout Standard |
|
1452 | \layout Standard | |
1424 |
|
1453 | |||
1425 | You can also set the value of this editor via the commmand-line option '- |
|
1454 | You can also set the value of this editor via the commmand-line option '- | |
1426 | \family typewriter |
|
1455 | \family typewriter | |
1427 | editor' |
|
1456 | editor' | |
1428 | \family default |
|
1457 | \family default | |
1429 | or in your |
|
1458 | or in your | |
1430 | \family typewriter |
|
1459 | \family typewriter | |
1431 | ipythonrc |
|
1460 | ipythonrc | |
1432 | \family default |
|
1461 | \family default | |
1433 | file. |
|
1462 | file. | |
1434 | This is useful if you wish to use specifically for IPython an editor different |
|
1463 | This is useful if you wish to use specifically for IPython an editor different | |
1435 | from your typical default (and for Windows users who tend to use fewer |
|
1464 | from your typical default (and for Windows users who tend to use fewer | |
1436 | environment variables). |
|
1465 | environment variables). | |
1437 | \layout Subsection |
|
1466 | \layout Subsection | |
1438 |
|
1467 | |||
1439 | Color |
|
1468 | Color | |
1440 | \layout Standard |
|
1469 | \layout Standard | |
1441 |
|
1470 | |||
1442 | The default IPython configuration has most bells and whistles turned on |
|
1471 | The default IPython configuration has most bells and whistles turned on | |
1443 | (they're pretty safe). |
|
1472 | (they're pretty safe). | |
1444 | But there's one that |
|
1473 | But there's one that | |
1445 | \emph on |
|
1474 | \emph on | |
1446 | may |
|
1475 | may | |
1447 | \emph default |
|
1476 | \emph default | |
1448 | cause problems on some systems: the use of color on screen for displaying |
|
1477 | cause problems on some systems: the use of color on screen for displaying | |
1449 | information. |
|
1478 | information. | |
1450 | This is very useful, since IPython can show prompts and exception tracebacks |
|
1479 | This is very useful, since IPython can show prompts and exception tracebacks | |
1451 | with various colors, display syntax-highlighted source code, and in general |
|
1480 | with various colors, display syntax-highlighted source code, and in general | |
1452 | make it easier to visually parse information. |
|
1481 | make it easier to visually parse information. | |
1453 | \layout Standard |
|
1482 | \layout Standard | |
1454 |
|
1483 | |||
1455 | The following terminals seem to handle the color sequences fine: |
|
1484 | The following terminals seem to handle the color sequences fine: | |
1456 | \layout Itemize |
|
1485 | \layout Itemize | |
1457 |
|
1486 | |||
1458 | Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm. |
|
1487 | Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm. | |
1459 | \layout Itemize |
|
1488 | \layout Itemize | |
1460 |
|
1489 | |||
1461 | CDE terminal (tested under Solaris). |
|
1490 | CDE terminal (tested under Solaris). | |
1462 | This one boldfaces light colors. |
|
1491 | This one boldfaces light colors. | |
1463 | \layout Itemize |
|
1492 | \layout Itemize | |
1464 |
|
1493 | |||
1465 | (X)Emacs buffers. |
|
1494 | (X)Emacs buffers. | |
1466 | See sec. |
|
1495 | See sec. | |
1467 | \begin_inset LatexCommand \ref{sec:emacs} |
|
1496 | \begin_inset LatexCommand \ref{sec:emacs} | |
1468 |
|
1497 | |||
1469 | \end_inset |
|
1498 | \end_inset | |
1470 |
|
1499 | |||
1471 | for more details on using IPython with (X)Emacs. |
|
1500 | for more details on using IPython with (X)Emacs. | |
1472 | \layout Itemize |
|
1501 | \layout Itemize | |
1473 |
|
1502 | |||
1474 | A Windows (XP/2k) command prompt |
|
1503 | A Windows (XP/2k) command prompt | |
1475 | \emph on |
|
1504 | \emph on | |
1476 | with Gary Bishop's support extensions |
|
1505 | with Gary Bishop's support extensions | |
1477 | \emph default |
|
1506 | \emph default | |
1478 | . |
|
1507 | . | |
1479 | Gary's extensions are discussed in Sec.\SpecialChar ~ |
|
1508 | Gary's extensions are discussed in Sec.\SpecialChar ~ | |
1480 |
|
1509 | |||
1481 | \begin_inset LatexCommand \ref{sub:Under-Windows} |
|
1510 | \begin_inset LatexCommand \ref{sub:Under-Windows} | |
1482 |
|
1511 | |||
1483 | \end_inset |
|
1512 | \end_inset | |
1484 |
|
1513 | |||
1485 | . |
|
1514 | . | |
1486 | \layout Itemize |
|
1515 | \layout Itemize | |
1487 |
|
1516 | |||
1488 | A Windows (XP/2k) CygWin shell. |
|
1517 | A Windows (XP/2k) CygWin shell. | |
1489 | Although some users have reported problems; it is not clear whether there |
|
1518 | Although some users have reported problems; it is not clear whether there | |
1490 | is an issue for everyone or only under specific configurations. |
|
1519 | is an issue for everyone or only under specific configurations. | |
1491 | If you have full color support under cygwin, please post to the IPython |
|
1520 | If you have full color support under cygwin, please post to the IPython | |
1492 | mailing list so this issue can be resolved for all users. |
|
1521 | mailing list so this issue can be resolved for all users. | |
1493 | \layout Standard |
|
1522 | \layout Standard | |
1494 |
|
1523 | |||
1495 | These have shown problems: |
|
1524 | These have shown problems: | |
1496 | \layout Itemize |
|
1525 | \layout Itemize | |
1497 |
|
1526 | |||
1498 | Windows command prompt in WinXP/2k logged into a Linux machine via telnet |
|
1527 | Windows command prompt in WinXP/2k logged into a Linux machine via telnet | |
1499 | or ssh. |
|
1528 | or ssh. | |
1500 | \layout Itemize |
|
1529 | \layout Itemize | |
1501 |
|
1530 | |||
1502 | Windows native command prompt in WinXP/2k, |
|
1531 | Windows native command prompt in WinXP/2k, | |
1503 | \emph on |
|
1532 | \emph on | |
1504 | without |
|
1533 | without | |
1505 | \emph default |
|
1534 | \emph default | |
1506 | Gary Bishop's extensions. |
|
1535 | Gary Bishop's extensions. | |
1507 | Once Gary's readline library is installed, the normal WinXP/2k command |
|
1536 | Once Gary's readline library is installed, the normal WinXP/2k command | |
1508 | prompt works perfectly. |
|
1537 | prompt works perfectly. | |
1509 | \layout Standard |
|
1538 | \layout Standard | |
1510 |
|
1539 | |||
1511 | Currently the following color schemes are available: |
|
1540 | Currently the following color schemes are available: | |
1512 | \layout Itemize |
|
1541 | \layout Itemize | |
1513 |
|
1542 | |||
1514 |
|
1543 | |||
1515 | \family typewriter |
|
1544 | \family typewriter | |
1516 | NoColor |
|
1545 | NoColor | |
1517 | \family default |
|
1546 | \family default | |
1518 | : uses no color escapes at all (all escapes are empty |
|
1547 | : uses no color escapes at all (all escapes are empty | |
1519 | \begin_inset Quotes eld |
|
1548 | \begin_inset Quotes eld | |
1520 | \end_inset |
|
1549 | \end_inset | |
1521 |
|
1550 | |||
1522 |
|
1551 | |||
1523 | \begin_inset Quotes eld |
|
1552 | \begin_inset Quotes eld | |
1524 | \end_inset |
|
1553 | \end_inset | |
1525 |
|
1554 | |||
1526 | strings). |
|
1555 | strings). | |
1527 | This 'scheme' is thus fully safe to use in any terminal. |
|
1556 | This 'scheme' is thus fully safe to use in any terminal. | |
1528 | \layout Itemize |
|
1557 | \layout Itemize | |
1529 |
|
1558 | |||
1530 |
|
1559 | |||
1531 | \family typewriter |
|
1560 | \family typewriter | |
1532 | Linux |
|
1561 | Linux | |
1533 | \family default |
|
1562 | \family default | |
1534 | : works well in Linux console type environments: dark background with light |
|
1563 | : works well in Linux console type environments: dark background with light | |
1535 | fonts. |
|
1564 | fonts. | |
1536 | It uses bright colors for information, so it is difficult to read if you |
|
1565 | It uses bright colors for information, so it is difficult to read if you | |
1537 | have a light colored background. |
|
1566 | have a light colored background. | |
1538 | \layout Itemize |
|
1567 | \layout Itemize | |
1539 |
|
1568 | |||
1540 |
|
1569 | |||
1541 | \family typewriter |
|
1570 | \family typewriter | |
1542 | LightBG |
|
1571 | LightBG | |
1543 | \family default |
|
1572 | \family default | |
1544 | : the basic colors are similar to those in the |
|
1573 | : the basic colors are similar to those in the | |
1545 | \family typewriter |
|
1574 | \family typewriter | |
1546 | Linux |
|
1575 | Linux | |
1547 | \family default |
|
1576 | \family default | |
1548 | scheme but darker. |
|
1577 | scheme but darker. | |
1549 | It is easy to read in terminals with light backgrounds. |
|
1578 | It is easy to read in terminals with light backgrounds. | |
1550 | \layout Standard |
|
1579 | \layout Standard | |
1551 |
|
1580 | |||
1552 | IPython uses colors for two main groups of things: prompts and tracebacks |
|
1581 | IPython uses colors for two main groups of things: prompts and tracebacks | |
1553 | which are directly printed to the terminal, and the object introspection |
|
1582 | which are directly printed to the terminal, and the object introspection | |
1554 | system which passes large sets of data through a pager. |
|
1583 | system which passes large sets of data through a pager. | |
1555 | \layout Subsubsection |
|
1584 | \layout Subsubsection | |
1556 |
|
1585 | |||
1557 | Input/Output prompts and exception tracebacks |
|
1586 | Input/Output prompts and exception tracebacks | |
1558 | \layout Standard |
|
1587 | \layout Standard | |
1559 |
|
1588 | |||
1560 | You can test whether the colored prompts and tracebacks work on your system |
|
1589 | You can test whether the colored prompts and tracebacks work on your system | |
1561 | interactively by typing |
|
1590 | interactively by typing | |
1562 | \family typewriter |
|
1591 | \family typewriter | |
1563 | '%colors Linux' |
|
1592 | '%colors Linux' | |
1564 | \family default |
|
1593 | \family default | |
1565 | at the prompt (use ' |
|
1594 | at the prompt (use ' | |
1566 | \family typewriter |
|
1595 | \family typewriter | |
1567 | %colors LightBG' |
|
1596 | %colors LightBG' | |
1568 | \family default |
|
1597 | \family default | |
1569 | if your terminal has a light background). |
|
1598 | if your terminal has a light background). | |
1570 | If the input prompt shows garbage like: |
|
1599 | If the input prompt shows garbage like: | |
1571 | \newline |
|
1600 | \newline | |
1572 |
|
1601 | |||
1573 | \family typewriter |
|
1602 | \family typewriter | |
1574 | [0;32mIn [[1;32m1[0;32m]: [0;00m |
|
1603 | [0;32mIn [[1;32m1[0;32m]: [0;00m | |
1575 | \family default |
|
1604 | \family default | |
1576 |
|
1605 | |||
1577 | \newline |
|
1606 | \newline | |
1578 | instead of (in color) something like: |
|
1607 | instead of (in color) something like: | |
1579 | \newline |
|
1608 | \newline | |
1580 |
|
1609 | |||
1581 | \family typewriter |
|
1610 | \family typewriter | |
1582 | In [1]: |
|
1611 | In [1]: | |
1583 | \family default |
|
1612 | \family default | |
1584 |
|
1613 | |||
1585 | \newline |
|
1614 | \newline | |
1586 | this means that your terminal doesn't properly handle color escape sequences. |
|
1615 | this means that your terminal doesn't properly handle color escape sequences. | |
1587 | You can go to a 'no color' mode by typing ' |
|
1616 | You can go to a 'no color' mode by typing ' | |
1588 | \family typewriter |
|
1617 | \family typewriter | |
1589 | %colors NoColor |
|
1618 | %colors NoColor | |
1590 | \family default |
|
1619 | \family default | |
1591 | '. |
|
1620 | '. | |
1592 |
|
1621 | |||
1593 | \layout Standard |
|
1622 | \layout Standard | |
1594 |
|
1623 | |||
1595 | You can try using a different terminal emulator program. |
|
1624 | You can try using a different terminal emulator program. | |
1596 | To permanently set your color preferences, edit the file |
|
1625 | To permanently set your color preferences, edit the file | |
1597 | \family typewriter |
|
1626 | \family typewriter | |
1598 | $HOME/.ipython/ipythonrc |
|
1627 | $HOME/.ipython/ipythonrc | |
1599 | \family default |
|
1628 | \family default | |
1600 | and set the |
|
1629 | and set the | |
1601 | \family typewriter |
|
1630 | \family typewriter | |
1602 | colors |
|
1631 | colors | |
1603 | \family default |
|
1632 | \family default | |
1604 | option to the desired value. |
|
1633 | option to the desired value. | |
1605 | \layout Subsubsection |
|
1634 | \layout Subsubsection | |
1606 |
|
1635 | |||
1607 | Object details (types, docstrings, source code, etc.) |
|
1636 | Object details (types, docstrings, source code, etc.) | |
1608 | \layout Standard |
|
1637 | \layout Standard | |
1609 |
|
1638 | |||
1610 | IPython has a set of special functions for studying the objects you are |
|
1639 | IPython has a set of special functions for studying the objects you are | |
1611 | working with, discussed in detail in Sec. |
|
1640 | working with, discussed in detail in Sec. | |
1612 |
|
1641 | |||
1613 | \begin_inset LatexCommand \ref{sec:dyn-object-info} |
|
1642 | \begin_inset LatexCommand \ref{sec:dyn-object-info} | |
1614 |
|
1643 | |||
1615 | \end_inset |
|
1644 | \end_inset | |
1616 |
|
1645 | |||
1617 | . |
|
1646 | . | |
1618 | But this system relies on passing information which is longer than your |
|
1647 | But this system relies on passing information which is longer than your | |
1619 | screen through a data pager, such as the common Unix |
|
1648 | screen through a data pager, such as the common Unix | |
1620 | \family typewriter |
|
1649 | \family typewriter | |
1621 | less |
|
1650 | less | |
1622 | \family default |
|
1651 | \family default | |
1623 | and |
|
1652 | and | |
1624 | \family typewriter |
|
1653 | \family typewriter | |
1625 | more |
|
1654 | more | |
1626 | \family default |
|
1655 | \family default | |
1627 | programs. |
|
1656 | programs. | |
1628 | In order to be able to see this information in color, your pager needs |
|
1657 | In order to be able to see this information in color, your pager needs | |
1629 | to be properly configured. |
|
1658 | to be properly configured. | |
1630 | I strongly recommend using |
|
1659 | I strongly recommend using | |
1631 | \family typewriter |
|
1660 | \family typewriter | |
1632 | less |
|
1661 | less | |
1633 | \family default |
|
1662 | \family default | |
1634 | instead of |
|
1663 | instead of | |
1635 | \family typewriter |
|
1664 | \family typewriter | |
1636 | more |
|
1665 | more | |
1637 | \family default |
|
1666 | \family default | |
1638 | , as it seems that |
|
1667 | , as it seems that | |
1639 | \family typewriter |
|
1668 | \family typewriter | |
1640 | more |
|
1669 | more | |
1641 | \family default |
|
1670 | \family default | |
1642 | simply can not understand colored text correctly. |
|
1671 | simply can not understand colored text correctly. | |
1643 | \layout Standard |
|
1672 | \layout Standard | |
1644 |
|
1673 | |||
1645 | In order to configure |
|
1674 | In order to configure | |
1646 | \family typewriter |
|
1675 | \family typewriter | |
1647 | less |
|
1676 | less | |
1648 | \family default |
|
1677 | \family default | |
1649 | as your default pager, do the following: |
|
1678 | as your default pager, do the following: | |
1650 | \layout Enumerate |
|
1679 | \layout Enumerate | |
1651 |
|
1680 | |||
1652 | Set the environment |
|
1681 | Set the environment | |
1653 | \family typewriter |
|
1682 | \family typewriter | |
1654 | PAGER |
|
1683 | PAGER | |
1655 | \family default |
|
1684 | \family default | |
1656 | variable to |
|
1685 | variable to | |
1657 | \family typewriter |
|
1686 | \family typewriter | |
1658 | less |
|
1687 | less | |
1659 | \family default |
|
1688 | \family default | |
1660 | . |
|
1689 | . | |
1661 | \layout Enumerate |
|
1690 | \layout Enumerate | |
1662 |
|
1691 | |||
1663 | Set the environment |
|
1692 | Set the environment | |
1664 | \family typewriter |
|
1693 | \family typewriter | |
1665 | LESS |
|
1694 | LESS | |
1666 | \family default |
|
1695 | \family default | |
1667 | variable to |
|
1696 | variable to | |
1668 | \family typewriter |
|
1697 | \family typewriter | |
1669 | -r |
|
1698 | -r | |
1670 | \family default |
|
1699 | \family default | |
1671 | (plus any other options you always want to pass to |
|
1700 | (plus any other options you always want to pass to | |
1672 | \family typewriter |
|
1701 | \family typewriter | |
1673 | less |
|
1702 | less | |
1674 | \family default |
|
1703 | \family default | |
1675 | by default). |
|
1704 | by default). | |
1676 | This tells |
|
1705 | This tells | |
1677 | \family typewriter |
|
1706 | \family typewriter | |
1678 | less |
|
1707 | less | |
1679 | \family default |
|
1708 | \family default | |
1680 | to properly interpret control sequences, which is how color information |
|
1709 | to properly interpret control sequences, which is how color information | |
1681 | is given to your terminal. |
|
1710 | is given to your terminal. | |
1682 | \layout Standard |
|
1711 | \layout Standard | |
1683 |
|
1712 | |||
1684 | For the |
|
1713 | For the | |
1685 | \family typewriter |
|
1714 | \family typewriter | |
1686 | csh |
|
1715 | csh | |
1687 | \family default |
|
1716 | \family default | |
1688 | or |
|
1717 | or | |
1689 | \family typewriter |
|
1718 | \family typewriter | |
1690 | tcsh |
|
1719 | tcsh | |
1691 | \family default |
|
1720 | \family default | |
1692 | shells, add to your |
|
1721 | shells, add to your | |
1693 | \family typewriter |
|
1722 | \family typewriter | |
1694 | ~/.cshrc |
|
1723 | ~/.cshrc | |
1695 | \family default |
|
1724 | \family default | |
1696 | file the lines: |
|
1725 | file the lines: | |
1697 | \layout Standard |
|
1726 | \layout Standard | |
1698 |
|
1727 | |||
1699 |
|
1728 | |||
1700 | \family typewriter |
|
1729 | \family typewriter | |
1701 | setenv PAGER less |
|
1730 | setenv PAGER less | |
1702 | \newline |
|
1731 | \newline | |
1703 | setenv LESS -r |
|
1732 | setenv LESS -r | |
1704 | \layout Standard |
|
1733 | \layout Standard | |
1705 |
|
1734 | |||
1706 | There is similar syntax for other Unix shells, look at your system documentation |
|
1735 | There is similar syntax for other Unix shells, look at your system documentation | |
1707 | for details. |
|
1736 | for details. | |
1708 | \layout Standard |
|
1737 | \layout Standard | |
1709 |
|
1738 | |||
1710 | If you are on a system which lacks proper data pagers (such as Windows), |
|
1739 | If you are on a system which lacks proper data pagers (such as Windows), | |
1711 | IPython will use a very limited builtin pager. |
|
1740 | IPython will use a very limited builtin pager. | |
1712 | \layout Subsection |
|
1741 | \layout Subsection | |
1713 |
|
1742 | |||
1714 |
|
1743 | |||
1715 | \begin_inset LatexCommand \label{sec:emacs} |
|
1744 | \begin_inset LatexCommand \label{sec:emacs} | |
1716 |
|
1745 | |||
1717 | \end_inset |
|
1746 | \end_inset | |
1718 |
|
1747 | |||
1719 | (X)Emacs configuration |
|
1748 | (X)Emacs configuration | |
1720 | \layout Standard |
|
1749 | \layout Standard | |
1721 |
|
1750 | |||
1722 | Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently |
|
1751 | Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently | |
1723 | (X)Emacs and IPython get along very well. |
|
1752 | (X)Emacs and IPython get along very well. | |
1724 |
|
1753 | |||
1725 | \layout Standard |
|
1754 | \layout Standard | |
1726 |
|
1755 | |||
1727 |
|
1756 | |||
1728 | \series bold |
|
1757 | \series bold | |
1729 | Important note: |
|
1758 | Important note: | |
1730 | \series default |
|
1759 | \series default | |
1731 | You will need to use a recent enough version of |
|
1760 | You will need to use a recent enough version of | |
1732 | \family typewriter |
|
1761 | \family typewriter | |
1733 | python-mode.el |
|
1762 | python-mode.el | |
1734 | \family default |
|
1763 | \family default | |
1735 | , along with the file |
|
1764 | , along with the file | |
1736 | \family typewriter |
|
1765 | \family typewriter | |
1737 | ipython.el |
|
1766 | ipython.el | |
1738 | \family default |
|
1767 | \family default | |
1739 | . |
|
1768 | . | |
1740 | You can check that the version you have of |
|
1769 | You can check that the version you have of | |
1741 | \family typewriter |
|
1770 | \family typewriter | |
1742 | python-mode.el |
|
1771 | python-mode.el | |
1743 | \family default |
|
1772 | \family default | |
1744 | is new enough by either looking at the revision number in the file itself, |
|
1773 | is new enough by either looking at the revision number in the file itself, | |
1745 | or asking for it in (X)Emacs via |
|
1774 | or asking for it in (X)Emacs via | |
1746 | \family typewriter |
|
1775 | \family typewriter | |
1747 | M-x py-version |
|
1776 | M-x py-version | |
1748 | \family default |
|
1777 | \family default | |
1749 | . |
|
1778 | . | |
1750 | Versions 4.68 and newer contain the necessary fixes for proper IPython support. |
|
1779 | Versions 4.68 and newer contain the necessary fixes for proper IPython support. | |
1751 | \layout Standard |
|
1780 | \layout Standard | |
1752 |
|
1781 | |||
1753 | The file |
|
1782 | The file | |
1754 | \family typewriter |
|
1783 | \family typewriter | |
1755 | ipython.el |
|
1784 | ipython.el | |
1756 | \family default |
|
1785 | \family default | |
1757 | is included with the IPython distribution, in the documentation directory |
|
1786 | is included with the IPython distribution, in the documentation directory | |
1758 | (where this manual resides in PDF and HTML formats). |
|
1787 | (where this manual resides in PDF and HTML formats). | |
1759 | \layout Standard |
|
1788 | \layout Standard | |
1760 |
|
1789 | |||
1761 | Once you put these files in your Emacs path, all you need in your |
|
1790 | Once you put these files in your Emacs path, all you need in your | |
1762 | \family typewriter |
|
1791 | \family typewriter | |
1763 | .emacs |
|
1792 | .emacs | |
1764 | \family default |
|
1793 | \family default | |
1765 | file is: |
|
1794 | file is: | |
1766 | \layout Standard |
|
1795 | \layout Standard | |
1767 |
|
1796 | |||
1768 |
|
1797 | |||
1769 | \family typewriter |
|
1798 | \family typewriter | |
1770 | (require 'ipython) |
|
1799 | (require 'ipython) | |
1771 | \layout Standard |
|
1800 | \layout Standard | |
1772 |
|
1801 | |||
1773 | This should give you full support for executing code snippets via IPython, |
|
1802 | This should give you full support for executing code snippets via IPython, | |
1774 | opening IPython as your Python shell via |
|
1803 | opening IPython as your Python shell via | |
1775 | \family typewriter |
|
1804 | \family typewriter | |
1776 | C-c\SpecialChar ~ |
|
1805 | C-c\SpecialChar ~ | |
1777 | ! |
|
1806 | ! | |
1778 | \family default |
|
1807 | \family default | |
1779 | , etc. |
|
1808 | , etc. | |
1780 |
|
1809 | |||
1781 | \layout Subsubsection* |
|
1810 | \layout Subsubsection* | |
1782 |
|
1811 | |||
1783 | Notes |
|
1812 | Notes | |
1784 | \layout Itemize |
|
1813 | \layout Itemize | |
1785 |
|
1814 | |||
1786 | There is one caveat you should be aware of: you must start the IPython shell |
|
1815 | There is one caveat you should be aware of: you must start the IPython shell | |
1787 |
|
1816 | |||
1788 | \emph on |
|
1817 | \emph on | |
1789 | before |
|
1818 | before | |
1790 | \emph default |
|
1819 | \emph default | |
1791 | attempting to execute any code regions via |
|
1820 | attempting to execute any code regions via | |
1792 | \family typewriter |
|
1821 | \family typewriter | |
1793 | C-c\SpecialChar ~ |
|
1822 | C-c\SpecialChar ~ | |
1794 | | |
|
1823 | | | |
1795 | \family default |
|
1824 | \family default | |
1796 | . |
|
1825 | . | |
1797 | Simply type |
|
1826 | Simply type | |
1798 | \family typewriter |
|
1827 | \family typewriter | |
1799 | C-c\SpecialChar ~ |
|
1828 | C-c\SpecialChar ~ | |
1800 | ! |
|
1829 | ! | |
1801 | \family default |
|
1830 | \family default | |
1802 | to start IPython before passing any code regions to the interpreter, and |
|
1831 | to start IPython before passing any code regions to the interpreter, and | |
1803 | you shouldn't experience any problems. |
|
1832 | you shouldn't experience any problems. | |
1804 | \newline |
|
1833 | \newline | |
1805 | This is due to a bug in Python itself, which has been fixed for Python 2.3, |
|
1834 | This is due to a bug in Python itself, which has been fixed for Python 2.3, | |
1806 | but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]). |
|
1835 | but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]). | |
1807 | \layout Itemize |
|
1836 | \layout Itemize | |
1808 |
|
1837 | |||
1809 | The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques |
|
1838 | The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques | |
1810 | ts should be directed to him through the IPython mailing lists. |
|
1839 | ts should be directed to him through the IPython mailing lists. | |
1811 |
|
1840 | |||
1812 | \layout Itemize |
|
1841 | \layout Itemize | |
1813 |
|
1842 | |||
1814 | This code is still somewhat experimental so it's a bit rough around the |
|
1843 | This code is still somewhat experimental so it's a bit rough around the | |
1815 | edges (although in practice, it works quite well). |
|
1844 | edges (although in practice, it works quite well). | |
1816 | \layout Itemize |
|
1845 | \layout Itemize | |
1817 |
|
1846 | |||
1818 | Be aware that if you customize |
|
1847 | Be aware that if you customize | |
1819 | \family typewriter |
|
1848 | \family typewriter | |
1820 | py-python-command |
|
1849 | py-python-command | |
1821 | \family default |
|
1850 | \family default | |
1822 | previously, this value will override what |
|
1851 | previously, this value will override what | |
1823 | \family typewriter |
|
1852 | \family typewriter | |
1824 | ipython.el |
|
1853 | ipython.el | |
1825 | \family default |
|
1854 | \family default | |
1826 | does (because loading the customization variables comes later). |
|
1855 | does (because loading the customization variables comes later). | |
1827 | \layout Section |
|
1856 | \layout Section | |
1828 |
|
1857 | |||
1829 |
|
1858 | |||
1830 | \begin_inset LatexCommand \label{sec:quick_tips} |
|
1859 | \begin_inset LatexCommand \label{sec:quick_tips} | |
1831 |
|
1860 | |||
1832 | \end_inset |
|
1861 | \end_inset | |
1833 |
|
1862 | |||
1834 | Quick tips |
|
1863 | Quick tips | |
1835 | \layout Standard |
|
1864 | \layout Standard | |
1836 |
|
1865 | |||
1837 | IPython can be used as an improved replacement for the Python prompt, and |
|
1866 | IPython can be used as an improved replacement for the Python prompt, and | |
1838 | for that you don't really need to read any more of this manual. |
|
1867 | for that you don't really need to read any more of this manual. | |
1839 | But in this section we'll try to summarize a few tips on how to make the |
|
1868 | But in this section we'll try to summarize a few tips on how to make the | |
1840 | most effective use of it for everyday Python development, highlighting |
|
1869 | most effective use of it for everyday Python development, highlighting | |
1841 | things you might miss in the rest of the manual (which is getting long). |
|
1870 | things you might miss in the rest of the manual (which is getting long). | |
1842 | We'll give references to parts in the manual which provide more detail |
|
1871 | We'll give references to parts in the manual which provide more detail | |
1843 | when appropriate. |
|
1872 | when appropriate. | |
1844 | \layout Standard |
|
1873 | \layout Standard | |
1845 |
|
1874 | |||
1846 | The following article by Jeremy Jones provides an introductory tutorial |
|
1875 | The following article by Jeremy Jones provides an introductory tutorial | |
1847 | about IPython: |
|
1876 | about IPython: | |
1848 | \newline |
|
1877 | \newline | |
1849 |
|
1878 | |||
1850 | \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html} |
|
1879 | \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html} | |
1851 |
|
1880 | |||
1852 | \end_inset |
|
1881 | \end_inset | |
1853 |
|
1882 | |||
1854 |
|
1883 | |||
1855 | \layout Itemize |
|
1884 | \layout Itemize | |
1856 |
|
1885 | |||
1857 | The TAB key. |
|
1886 | The TAB key. | |
1858 | TAB-completion, especially for attributes, is a convenient way to explore |
|
1887 | TAB-completion, especially for attributes, is a convenient way to explore | |
1859 | the structure of any object you're dealing with. |
|
1888 | the structure of any object you're dealing with. | |
1860 | Simply type |
|
1889 | Simply type | |
1861 | \family typewriter |
|
1890 | \family typewriter | |
1862 | object_name.<TAB> |
|
1891 | object_name.<TAB> | |
1863 | \family default |
|
1892 | \family default | |
1864 | and a list of the object's attributes will be printed (see sec. |
|
1893 | and a list of the object's attributes will be printed (see sec. | |
1865 |
|
1894 | |||
1866 | \begin_inset LatexCommand \ref{sec:readline} |
|
1895 | \begin_inset LatexCommand \ref{sec:readline} | |
1867 |
|
1896 | |||
1868 | \end_inset |
|
1897 | \end_inset | |
1869 |
|
1898 | |||
1870 | for more). |
|
1899 | for more). | |
1871 | Tab completion also works on file and directory names, which combined with |
|
1900 | Tab completion also works on file and directory names, which combined with | |
1872 | IPython's alias system allows you to do from within IPython many of the |
|
1901 | IPython's alias system allows you to do from within IPython many of the | |
1873 | things you normally would need the system shell for. |
|
1902 | things you normally would need the system shell for. | |
1874 |
|
1903 | |||
1875 | \layout Itemize |
|
1904 | \layout Itemize | |
1876 |
|
1905 | |||
1877 | Explore your objects. |
|
1906 | Explore your objects. | |
1878 | Typing |
|
1907 | Typing | |
1879 | \family typewriter |
|
1908 | \family typewriter | |
1880 | object_name? |
|
1909 | object_name? | |
1881 | \family default |
|
1910 | \family default | |
1882 | will print all sorts of details about any object, including docstrings, |
|
1911 | will print all sorts of details about any object, including docstrings, | |
1883 | function definition lines (for call arguments) and constructor details |
|
1912 | function definition lines (for call arguments) and constructor details | |
1884 | for classes. |
|
1913 | for classes. | |
1885 | The magic commands |
|
1914 | The magic commands | |
1886 | \family typewriter |
|
1915 | \family typewriter | |
1887 | %pdoc |
|
1916 | %pdoc | |
1888 | \family default |
|
1917 | \family default | |
1889 | , |
|
1918 | , | |
1890 | \family typewriter |
|
1919 | \family typewriter | |
1891 | %pdef |
|
1920 | %pdef | |
1892 | \family default |
|
1921 | \family default | |
1893 | , |
|
1922 | , | |
1894 | \family typewriter |
|
1923 | \family typewriter | |
1895 | %psource |
|
1924 | %psource | |
1896 | \family default |
|
1925 | \family default | |
1897 | and |
|
1926 | and | |
1898 | \family typewriter |
|
1927 | \family typewriter | |
1899 | %pfile |
|
1928 | %pfile | |
1900 | \family default |
|
1929 | \family default | |
1901 | will respectively print the docstring, function definition line, full source |
|
1930 | will respectively print the docstring, function definition line, full source | |
1902 | code and the complete file for any object (when they can be found). |
|
1931 | code and the complete file for any object (when they can be found). | |
1903 | If automagic is on (it is by default), you don't need to type the ' |
|
1932 | If automagic is on (it is by default), you don't need to type the ' | |
1904 | \family typewriter |
|
1933 | \family typewriter | |
1905 | % |
|
1934 | % | |
1906 | \family default |
|
1935 | \family default | |
1907 | ' explicitly. |
|
1936 | ' explicitly. | |
1908 | See sec. |
|
1937 | See sec. | |
1909 |
|
1938 | |||
1910 | \begin_inset LatexCommand \ref{sec:dyn-object-info} |
|
1939 | \begin_inset LatexCommand \ref{sec:dyn-object-info} | |
1911 |
|
1940 | |||
1912 | \end_inset |
|
1941 | \end_inset | |
1913 |
|
1942 | |||
1914 | for more. |
|
1943 | for more. | |
1915 | \layout Itemize |
|
1944 | \layout Itemize | |
1916 |
|
1945 | |||
1917 | The |
|
1946 | The | |
1918 | \family typewriter |
|
1947 | \family typewriter | |
1919 | %run |
|
1948 | %run | |
1920 | \family default |
|
1949 | \family default | |
1921 | magic command allows you to run any python script and load all of its data |
|
1950 | magic command allows you to run any python script and load all of its data | |
1922 | directly into the interactive namespace. |
|
1951 | directly into the interactive namespace. | |
1923 | Since the file is re-read from disk each time, changes you make to it are |
|
1952 | Since the file is re-read from disk each time, changes you make to it are | |
1924 | reflected immediately (in contrast to the behavior of |
|
1953 | reflected immediately (in contrast to the behavior of | |
1925 | \family typewriter |
|
1954 | \family typewriter | |
1926 | import |
|
1955 | import | |
1927 | \family default |
|
1956 | \family default | |
1928 | ). |
|
1957 | ). | |
1929 | I rarely use |
|
1958 | I rarely use | |
1930 | \family typewriter |
|
1959 | \family typewriter | |
1931 | import |
|
1960 | import | |
1932 | \family default |
|
1961 | \family default | |
1933 | for code I am testing, relying on |
|
1962 | for code I am testing, relying on | |
1934 | \family typewriter |
|
1963 | \family typewriter | |
1935 | %run |
|
1964 | %run | |
1936 | \family default |
|
1965 | \family default | |
1937 | instead. |
|
1966 | instead. | |
1938 | See sec. |
|
1967 | See sec. | |
1939 |
|
1968 | |||
1940 | \begin_inset LatexCommand \ref{sec:magic} |
|
1969 | \begin_inset LatexCommand \ref{sec:magic} | |
1941 |
|
1970 | |||
1942 | \end_inset |
|
1971 | \end_inset | |
1943 |
|
1972 | |||
1944 | for more on this and other magic commands, or type the name of any magic |
|
1973 | for more on this and other magic commands, or type the name of any magic | |
1945 | command and ? to get details on it. |
|
1974 | command and ? to get details on it. | |
1946 | See also sec. |
|
1975 | See also sec. | |
1947 |
|
1976 | |||
1948 | \begin_inset LatexCommand \ref{sec:dreload} |
|
1977 | \begin_inset LatexCommand \ref{sec:dreload} | |
1949 |
|
1978 | |||
1950 | \end_inset |
|
1979 | \end_inset | |
1951 |
|
1980 | |||
1952 | for a recursive reload command. |
|
1981 | for a recursive reload command. | |
1953 | \newline |
|
1982 | \newline | |
1954 |
|
1983 | |||
1955 | \family typewriter |
|
1984 | \family typewriter | |
1956 | %run |
|
1985 | %run | |
1957 | \family default |
|
1986 | \family default | |
1958 | also has special flags for timing the execution of your scripts ( |
|
1987 | also has special flags for timing the execution of your scripts ( | |
1959 | \family typewriter |
|
1988 | \family typewriter | |
1960 | -t |
|
1989 | -t | |
1961 | \family default |
|
1990 | \family default | |
1962 | ) and for executing them under the control of either Python's |
|
1991 | ) and for executing them under the control of either Python's | |
1963 | \family typewriter |
|
1992 | \family typewriter | |
1964 | pdb |
|
1993 | pdb | |
1965 | \family default |
|
1994 | \family default | |
1966 | debugger ( |
|
1995 | debugger ( | |
1967 | \family typewriter |
|
1996 | \family typewriter | |
1968 | -d |
|
1997 | -d | |
1969 | \family default |
|
1998 | \family default | |
1970 | ) or profiler ( |
|
1999 | ) or profiler ( | |
1971 | \family typewriter |
|
2000 | \family typewriter | |
1972 | -p |
|
2001 | -p | |
1973 | \family default |
|
2002 | \family default | |
1974 | ). |
|
2003 | ). | |
1975 | With all of these, |
|
2004 | With all of these, | |
1976 | \family typewriter |
|
2005 | \family typewriter | |
1977 | %run |
|
2006 | %run | |
1978 | \family default |
|
2007 | \family default | |
1979 | can be used as the main tool for efficient interactive development of code |
|
2008 | can be used as the main tool for efficient interactive development of code | |
1980 | which you write in your editor of choice. |
|
2009 | which you write in your editor of choice. | |
1981 | \layout Itemize |
|
2010 | \layout Itemize | |
1982 |
|
2011 | |||
1983 | Use the Python debugger, |
|
2012 | Use the Python debugger, | |
1984 | \family typewriter |
|
2013 | \family typewriter | |
1985 | pdb |
|
2014 | pdb | |
1986 | \family default |
|
2015 | \family default | |
1987 |
|
2016 | |||
1988 | \begin_inset Foot |
|
2017 | \begin_inset Foot | |
1989 | collapsed true |
|
2018 | collapsed true | |
1990 |
|
2019 | |||
1991 | \layout Standard |
|
2020 | \layout Standard | |
1992 |
|
2021 | |||
1993 | Thanks to Christian Hart and Matthew Arnison for the suggestions leading |
|
2022 | Thanks to Christian Hart and Matthew Arnison for the suggestions leading | |
1994 | to IPython's improved debugger and profiler support. |
|
2023 | to IPython's improved debugger and profiler support. | |
1995 | \end_inset |
|
2024 | \end_inset | |
1996 |
|
2025 | |||
1997 | . |
|
2026 | . | |
1998 | The |
|
2027 | The | |
1999 | \family typewriter |
|
2028 | \family typewriter | |
2000 | %pdb |
|
2029 | %pdb | |
2001 | \family default |
|
2030 | \family default | |
2002 | command allows you to toggle on and off the automatic invocation of the |
|
2031 | command allows you to toggle on and off the automatic invocation of the | |
2003 | pdb debugger at any uncaught exception. |
|
2032 | pdb debugger at any uncaught exception. | |
2004 | The advantage of this is that pdb starts |
|
2033 | The advantage of this is that pdb starts | |
2005 | \emph on |
|
2034 | \emph on | |
2006 | inside |
|
2035 | inside | |
2007 | \emph default |
|
2036 | \emph default | |
2008 | the function where the exception occurred, with all data still available. |
|
2037 | the function where the exception occurred, with all data still available. | |
2009 | You can print variables, see code, execute statements and even walk up |
|
2038 | You can print variables, see code, execute statements and even walk up | |
2010 | and down the call stack to track down the true source of the problem (which |
|
2039 | and down the call stack to track down the true source of the problem (which | |
2011 | often is many layers in the stack above where the exception gets triggered). |
|
2040 | often is many layers in the stack above where the exception gets triggered). | |
2012 | \newline |
|
2041 | \newline | |
2013 | Running programs with |
|
2042 | Running programs with | |
2014 | \family typewriter |
|
2043 | \family typewriter | |
2015 | %run |
|
2044 | %run | |
2016 | \family default |
|
2045 | \family default | |
2017 | and pdb active can be an efficient to develop and debug code, in many cases |
|
2046 | and pdb active can be an efficient to develop and debug code, in many cases | |
2018 | eliminating the need for |
|
2047 | eliminating the need for | |
2019 | \family typewriter |
|
2048 | \family typewriter | |
2020 |
|
2049 | |||
2021 | \family default |
|
2050 | \family default | |
2022 | statements or external debugging tools. |
|
2051 | statements or external debugging tools. | |
2023 | I often simply put a |
|
2052 | I often simply put a | |
2024 | \family typewriter |
|
2053 | \family typewriter | |
2025 | 1/0 |
|
2054 | 1/0 | |
2026 | \family default |
|
2055 | \family default | |
2027 | in a place where I want to take a look so that pdb gets called, quickly |
|
2056 | in a place where I want to take a look so that pdb gets called, quickly | |
2028 | view whatever variables I need to or test various pieces of code and then |
|
2057 | view whatever variables I need to or test various pieces of code and then | |
2029 | remove the |
|
2058 | remove the | |
2030 | \family typewriter |
|
2059 | \family typewriter | |
2031 | 1/0 |
|
2060 | 1/0 | |
2032 | \family default |
|
2061 | \family default | |
2033 | . |
|
2062 | . | |
2034 | \newline |
|
2063 | \newline | |
2035 | Note also that ` |
|
2064 | Note also that ` | |
2036 | \family typewriter |
|
2065 | \family typewriter | |
2037 | %run -d |
|
2066 | %run -d | |
2038 | \family default |
|
2067 | \family default | |
2039 | ' activates |
|
2068 | ' activates | |
2040 | \family typewriter |
|
2069 | \family typewriter | |
2041 | pdb |
|
2070 | pdb | |
2042 | \family default |
|
2071 | \family default | |
2043 | and automatically sets initial breakpoints for you to step through your |
|
2072 | and automatically sets initial breakpoints for you to step through your | |
2044 | code, watch variables, etc. |
|
2073 | code, watch variables, etc. | |
2045 | See Sec.\SpecialChar ~ |
|
2074 | See Sec.\SpecialChar ~ | |
2046 |
|
2075 | |||
2047 | \begin_inset LatexCommand \ref{sec:cache_output} |
|
2076 | \begin_inset LatexCommand \ref{sec:cache_output} | |
2048 |
|
2077 | |||
2049 | \end_inset |
|
2078 | \end_inset | |
2050 |
|
2079 | |||
2051 | for details. |
|
2080 | for details. | |
2052 | \layout Itemize |
|
2081 | \layout Itemize | |
2053 |
|
2082 | |||
2054 | Use the output cache. |
|
2083 | Use the output cache. | |
2055 | All output results are automatically stored in a global dictionary named |
|
2084 | All output results are automatically stored in a global dictionary named | |
2056 |
|
2085 | |||
2057 | \family typewriter |
|
2086 | \family typewriter | |
2058 | Out |
|
2087 | Out | |
2059 | \family default |
|
2088 | \family default | |
2060 | and variables named |
|
2089 | and variables named | |
2061 | \family typewriter |
|
2090 | \family typewriter | |
2062 | _1 |
|
2091 | _1 | |
2063 | \family default |
|
2092 | \family default | |
2064 | , |
|
2093 | , | |
2065 | \family typewriter |
|
2094 | \family typewriter | |
2066 | _2 |
|
2095 | _2 | |
2067 | \family default |
|
2096 | \family default | |
2068 | , etc. |
|
2097 | , etc. | |
2069 | alias them. |
|
2098 | alias them. | |
2070 | For example, the result of input line 4 is available either as |
|
2099 | For example, the result of input line 4 is available either as | |
2071 | \family typewriter |
|
2100 | \family typewriter | |
2072 | Out[4] |
|
2101 | Out[4] | |
2073 | \family default |
|
2102 | \family default | |
2074 | or as |
|
2103 | or as | |
2075 | \family typewriter |
|
2104 | \family typewriter | |
2076 | _4 |
|
2105 | _4 | |
2077 | \family default |
|
2106 | \family default | |
2078 | . |
|
2107 | . | |
2079 | Additionally, three variables named |
|
2108 | Additionally, three variables named | |
2080 | \family typewriter |
|
2109 | \family typewriter | |
2081 | _ |
|
2110 | _ | |
2082 | \family default |
|
2111 | \family default | |
2083 | , |
|
2112 | , | |
2084 | \family typewriter |
|
2113 | \family typewriter | |
2085 | __ |
|
2114 | __ | |
2086 | \family default |
|
2115 | \family default | |
2087 | and |
|
2116 | and | |
2088 | \family typewriter |
|
2117 | \family typewriter | |
2089 | ___ |
|
2118 | ___ | |
2090 | \family default |
|
2119 | \family default | |
2091 | are always kept updated with the for the last three results. |
|
2120 | are always kept updated with the for the last three results. | |
2092 | This allows you to recall any previous result and further use it for new |
|
2121 | This allows you to recall any previous result and further use it for new | |
2093 | calculations. |
|
2122 | calculations. | |
2094 | See Sec.\SpecialChar ~ |
|
2123 | See Sec.\SpecialChar ~ | |
2095 |
|
2124 | |||
2096 | \begin_inset LatexCommand \ref{sec:cache_output} |
|
2125 | \begin_inset LatexCommand \ref{sec:cache_output} | |
2097 |
|
2126 | |||
2098 | \end_inset |
|
2127 | \end_inset | |
2099 |
|
2128 | |||
2100 | for more. |
|
2129 | for more. | |
2101 | \layout Itemize |
|
2130 | \layout Itemize | |
2102 |
|
2131 | |||
2103 | Put a ' |
|
2132 | Put a ' | |
2104 | \family typewriter |
|
2133 | \family typewriter | |
2105 | ; |
|
2134 | ; | |
2106 | \family default |
|
2135 | \family default | |
2107 | ' at the end of a line to supress the printing of output. |
|
2136 | ' at the end of a line to supress the printing of output. | |
2108 | This is useful when doing calculations which generate long output you are |
|
2137 | This is useful when doing calculations which generate long output you are | |
2109 | not interested in seeing. |
|
2138 | not interested in seeing. | |
2110 | The |
|
2139 | The | |
2111 | \family typewriter |
|
2140 | \family typewriter | |
2112 | _* |
|
2141 | _* | |
2113 | \family default |
|
2142 | \family default | |
2114 | variables and the |
|
2143 | variables and the | |
2115 | \family typewriter |
|
2144 | \family typewriter | |
2116 | Out[] |
|
2145 | Out[] | |
2117 | \family default |
|
2146 | \family default | |
2118 | list do get updated with the contents of the output, even if it is not |
|
2147 | list do get updated with the contents of the output, even if it is not | |
2119 | printed. |
|
2148 | printed. | |
2120 | You can thus still access the generated results this way for further processing. |
|
2149 | You can thus still access the generated results this way for further processing. | |
2121 | \layout Itemize |
|
2150 | \layout Itemize | |
2122 |
|
2151 | |||
2123 | A similar system exists for caching input. |
|
2152 | A similar system exists for caching input. | |
2124 | All input is stored in a global list called |
|
2153 | All input is stored in a global list called | |
2125 | \family typewriter |
|
2154 | \family typewriter | |
2126 | In |
|
2155 | In | |
2127 | \family default |
|
2156 | \family default | |
2128 | , so you can re-execute lines 22 through 28 plus line 34 by typing |
|
2157 | , so you can re-execute lines 22 through 28 plus line 34 by typing | |
2129 | \family typewriter |
|
2158 | \family typewriter | |
2130 | 'exec In[22:29]+In[34]' |
|
2159 | 'exec In[22:29]+In[34]' | |
2131 | \family default |
|
2160 | \family default | |
2132 | (using Python slicing notation). |
|
2161 | (using Python slicing notation). | |
2133 | If you need to execute the same set of lines often, you can assign them |
|
2162 | If you need to execute the same set of lines often, you can assign them | |
2134 | to a macro with the |
|
2163 | to a macro with the | |
2135 | \family typewriter |
|
2164 | \family typewriter | |
2136 | %macro |
|
2165 | %macro | |
2137 | \family default |
|
2166 | \family default | |
2138 |
|
2167 | |||
2139 | \family typewriter |
|
2168 | \family typewriter | |
2140 | function. |
|
2169 | function. | |
2141 |
|
2170 | |||
2142 | \family default |
|
2171 | \family default | |
2143 | See sec. |
|
2172 | See sec. | |
2144 |
|
2173 | |||
2145 | \begin_inset LatexCommand \ref{sec:cache_input} |
|
2174 | \begin_inset LatexCommand \ref{sec:cache_input} | |
2146 |
|
2175 | |||
2147 | \end_inset |
|
2176 | \end_inset | |
2148 |
|
2177 | |||
2149 | for more. |
|
2178 | for more. | |
2150 | \layout Itemize |
|
2179 | \layout Itemize | |
2151 |
|
2180 | |||
2152 | Use your input history. |
|
2181 | Use your input history. | |
2153 | The |
|
2182 | The | |
2154 | \family typewriter |
|
2183 | \family typewriter | |
2155 | %hist |
|
2184 | %hist | |
2156 | \family default |
|
2185 | \family default | |
2157 | command can show you all previous input, without line numbers if desired |
|
2186 | command can show you all previous input, without line numbers if desired | |
2158 | (option |
|
2187 | (option | |
2159 | \family typewriter |
|
2188 | \family typewriter | |
2160 | -n |
|
2189 | -n | |
2161 | \family default |
|
2190 | \family default | |
2162 | ) so you can directly copy and paste code either back in IPython or in a |
|
2191 | ) so you can directly copy and paste code either back in IPython or in a | |
2163 | text editor. |
|
2192 | text editor. | |
2164 | You can also save all your history by turning on logging via |
|
2193 | You can also save all your history by turning on logging via | |
2165 | \family typewriter |
|
2194 | \family typewriter | |
2166 | %logstart |
|
2195 | %logstart | |
2167 | \family default |
|
2196 | \family default | |
2168 | ; these logs can later be either reloaded as IPython sessions or used as |
|
2197 | ; these logs can later be either reloaded as IPython sessions or used as | |
2169 | code for your programs. |
|
2198 | code for your programs. | |
2170 | \layout Itemize |
|
2199 | \layout Itemize | |
2171 |
|
2200 | |||
2172 | Define your own macros with |
|
2201 | Define your own macros with | |
2173 | \family typewriter |
|
2202 | \family typewriter | |
2174 | %macro |
|
2203 | %macro | |
2175 | \family default |
|
2204 | \family default | |
2176 | . |
|
2205 | . | |
2177 | This can be useful for automating sequences of expressions when working |
|
2206 | This can be useful for automating sequences of expressions when working | |
2178 | interactively. |
|
2207 | interactively. | |
2179 | \layout Itemize |
|
2208 | \layout Itemize | |
2180 |
|
2209 | |||
2181 | Define your own system aliases. |
|
2210 | Define your own system aliases. | |
2182 | Even though IPython gives you access to your system shell via the |
|
2211 | Even though IPython gives you access to your system shell via the | |
2183 | \family typewriter |
|
2212 | \family typewriter | |
2184 | ! |
|
2213 | ! | |
2185 | \family default |
|
2214 | \family default | |
2186 | prefix, it is convenient to have aliases to the system commands you use |
|
2215 | prefix, it is convenient to have aliases to the system commands you use | |
2187 | most often. |
|
2216 | most often. | |
2188 | This allows you to work seamlessly from inside IPython with the same commands |
|
2217 | This allows you to work seamlessly from inside IPython with the same commands | |
2189 | you are used to in your system shell. |
|
2218 | you are used to in your system shell. | |
2190 | \newline |
|
2219 | \newline | |
2191 | IPython comes with some pre-defined aliases and a complete system for changing |
|
2220 | IPython comes with some pre-defined aliases and a complete system for changing | |
2192 | directories, both via a stack (see |
|
2221 | directories, both via a stack (see | |
2193 | \family typewriter |
|
2222 | \family typewriter | |
2194 | %pushd |
|
2223 | %pushd | |
2195 | \family default |
|
2224 | \family default | |
2196 | , |
|
2225 | , | |
2197 | \family typewriter |
|
2226 | \family typewriter | |
2198 | %popd |
|
2227 | %popd | |
2199 | \family default |
|
2228 | \family default | |
2200 | and |
|
2229 | and | |
2201 | \family typewriter |
|
2230 | \family typewriter | |
2202 | %ds |
|
2231 | %ds | |
2203 | \family default |
|
2232 | \family default | |
2204 | ) and via direct |
|
2233 | ) and via direct | |
2205 | \family typewriter |
|
2234 | \family typewriter | |
2206 | %cd |
|
2235 | %cd | |
2207 | \family default |
|
2236 | \family default | |
2208 | . |
|
2237 | . | |
2209 | The latter keeps a history of visited directories and allows you to go |
|
2238 | The latter keeps a history of visited directories and allows you to go | |
2210 | to any previously visited one. |
|
2239 | to any previously visited one. | |
2211 | \layout Itemize |
|
2240 | \layout Itemize | |
2212 |
|
2241 | |||
2213 | Use Python to manipulate the results of system commands. |
|
2242 | Use Python to manipulate the results of system commands. | |
2214 | The ` |
|
2243 | The ` | |
2215 | \family typewriter |
|
2244 | \family typewriter | |
2216 | !! |
|
2245 | !! | |
2217 | \family default |
|
2246 | \family default | |
2218 | ' special syntax, and the |
|
2247 | ' special syntax, and the | |
2219 | \family typewriter |
|
2248 | \family typewriter | |
2220 | %sc |
|
2249 | %sc | |
2221 | \family default |
|
2250 | \family default | |
2222 | and |
|
2251 | and | |
2223 | \family typewriter |
|
2252 | \family typewriter | |
2224 | %sx |
|
2253 | %sx | |
2225 | \family default |
|
2254 | \family default | |
2226 | magic commands allow you to capture system output into Python variables. |
|
2255 | magic commands allow you to capture system output into Python variables. | |
2227 | \layout Itemize |
|
2256 | \layout Itemize | |
2228 |
|
2257 | |||
2229 | Expand python variables when calling the shell (either via |
|
2258 | Expand python variables when calling the shell (either via | |
2230 | \family typewriter |
|
2259 | \family typewriter | |
2231 | `!' |
|
2260 | `!' | |
2232 | \family default |
|
2261 | \family default | |
2233 | and |
|
2262 | and | |
2234 | \family typewriter |
|
2263 | \family typewriter | |
2235 | `!!' |
|
2264 | `!!' | |
2236 | \family default |
|
2265 | \family default | |
2237 | or via aliases) by prepending a |
|
2266 | or via aliases) by prepending a | |
2238 | \family typewriter |
|
2267 | \family typewriter | |
2239 | $ |
|
2268 | $ | |
2240 | \family default |
|
2269 | \family default | |
2241 | in front of them. |
|
2270 | in front of them. | |
2242 | You can also expand complete python expressions. |
|
2271 | You can also expand complete python expressions. | |
2243 | See sec.\SpecialChar ~ |
|
2272 | See sec.\SpecialChar ~ | |
2244 |
|
2273 | |||
2245 | \begin_inset LatexCommand \ref{sub:System-shell-access} |
|
2274 | \begin_inset LatexCommand \ref{sub:System-shell-access} | |
2246 |
|
2275 | |||
2247 | \end_inset |
|
2276 | \end_inset | |
2248 |
|
2277 | |||
2249 | for more. |
|
2278 | for more. | |
2250 | \layout Itemize |
|
2279 | \layout Itemize | |
2251 |
|
2280 | |||
2252 | Use profiles to maintain different configurations (modules to load, function |
|
2281 | Use profiles to maintain different configurations (modules to load, function | |
2253 | definitions, option settings) for particular tasks. |
|
2282 | definitions, option settings) for particular tasks. | |
2254 | You can then have customized versions of IPython for specific purposes. |
|
2283 | You can then have customized versions of IPython for specific purposes. | |
2255 | See sec.\SpecialChar ~ |
|
2284 | See sec.\SpecialChar ~ | |
2256 |
|
2285 | |||
2257 | \begin_inset LatexCommand \ref{sec:profiles} |
|
2286 | \begin_inset LatexCommand \ref{sec:profiles} | |
2258 |
|
2287 | |||
2259 | \end_inset |
|
2288 | \end_inset | |
2260 |
|
2289 | |||
2261 | for more. |
|
2290 | for more. | |
2262 | \layout Itemize |
|
2291 | \layout Itemize | |
2263 |
|
2292 | |||
2264 | Embed IPython in your programs. |
|
2293 | Embed IPython in your programs. | |
2265 | A few lines of code are enough to load a complete IPython inside your own |
|
2294 | A few lines of code are enough to load a complete IPython inside your own | |
2266 | programs, giving you the ability to work with your data interactively after |
|
2295 | programs, giving you the ability to work with your data interactively after | |
2267 | automatic processing has been completed. |
|
2296 | automatic processing has been completed. | |
2268 | See sec.\SpecialChar ~ |
|
2297 | See sec.\SpecialChar ~ | |
2269 |
|
2298 | |||
2270 | \begin_inset LatexCommand \ref{sec:embed} |
|
2299 | \begin_inset LatexCommand \ref{sec:embed} | |
2271 |
|
2300 | |||
2272 | \end_inset |
|
2301 | \end_inset | |
2273 |
|
2302 | |||
2274 | for more. |
|
2303 | for more. | |
2275 | \layout Itemize |
|
2304 | \layout Itemize | |
2276 |
|
2305 | |||
2277 | Use the Python profiler. |
|
2306 | Use the Python profiler. | |
2278 | When dealing with performance issues, the |
|
2307 | When dealing with performance issues, the | |
2279 | \family typewriter |
|
2308 | \family typewriter | |
2280 | %run |
|
2309 | %run | |
2281 | \family default |
|
2310 | \family default | |
2282 | command with a |
|
2311 | command with a | |
2283 | \family typewriter |
|
2312 | \family typewriter | |
2284 | -p |
|
2313 | -p | |
2285 | \family default |
|
2314 | \family default | |
2286 | option allows you to run complete programs under the control of the Python |
|
2315 | option allows you to run complete programs under the control of the Python | |
2287 | profiler. |
|
2316 | profiler. | |
2288 | The |
|
2317 | The | |
2289 | \family typewriter |
|
2318 | \family typewriter | |
2290 | %prun |
|
2319 | %prun | |
2291 | \family default |
|
2320 | \family default | |
2292 | command does a similar job for single Python expressions (like function |
|
2321 | command does a similar job for single Python expressions (like function | |
2293 | calls). |
|
2322 | calls). | |
2294 | \layout Itemize |
|
2323 | \layout Itemize | |
2295 |
|
2324 | |||
2296 | Use |
|
2325 | Use | |
2297 | \family typewriter |
|
2326 | \family typewriter | |
2298 | %edit |
|
2327 | %edit | |
2299 | \family default |
|
2328 | \family default | |
2300 | to have almost multiline editing. |
|
2329 | to have almost multiline editing. | |
2301 | While IPython doesn't support true multiline editing, this command allows |
|
2330 | While IPython doesn't support true multiline editing, this command allows | |
2302 | you to call an editor on the spot, and IPython will execute the code you |
|
2331 | you to call an editor on the spot, and IPython will execute the code you | |
2303 | type in there as if it were typed interactively. |
|
2332 | type in there as if it were typed interactively. | |
2304 | \layout Itemize |
|
2333 | \layout Itemize | |
2305 |
|
2334 | |||
2306 | Use the IPython.demo.Demo class to load any Python script as an interactive |
|
2335 | Use the IPython.demo.Demo class to load any Python script as an interactive | |
2307 | demo. |
|
2336 | demo. | |
2308 | With a minimal amount of simple markup, you can control the execution of |
|
2337 | With a minimal amount of simple markup, you can control the execution of | |
2309 | the script, stopping as needed. |
|
2338 | the script, stopping as needed. | |
2310 | See sec.\SpecialChar ~ |
|
2339 | See sec.\SpecialChar ~ | |
2311 |
|
2340 | |||
2312 | \begin_inset LatexCommand \ref{sec:interactive-demos} |
|
2341 | \begin_inset LatexCommand \ref{sec:interactive-demos} | |
2313 |
|
2342 | |||
2314 | \end_inset |
|
2343 | \end_inset | |
2315 |
|
2344 | |||
2316 | for more. |
|
2345 | for more. | |
2317 | \layout Standard |
|
2346 | \layout Standard | |
2318 |
|
2347 | |||
2319 | If you have your own favorite tip on using IPython efficiently for a certain |
|
2348 | If you have your own favorite tip on using IPython efficiently for a certain | |
2320 | task (especially things which can't be done in the normal Python interpreter), |
|
2349 | task (especially things which can't be done in the normal Python interpreter), | |
2321 | don't hesitate to send it! |
|
2350 | don't hesitate to send it! | |
2322 | \layout Section |
|
2351 | \layout Section | |
2323 |
|
2352 | |||
2324 | Command-line use |
|
2353 | Command-line use | |
2325 | \layout Standard |
|
2354 | \layout Standard | |
2326 |
|
2355 | |||
2327 | You start IPython with the command: |
|
2356 | You start IPython with the command: | |
2328 | \layout Standard |
|
2357 | \layout Standard | |
2329 |
|
2358 | |||
2330 |
|
2359 | |||
2331 | \family typewriter |
|
2360 | \family typewriter | |
2332 | $ ipython [options] files |
|
2361 | $ ipython [options] files | |
2333 | \layout Standard |
|
2362 | \layout Standard | |
2334 |
|
2363 | |||
2335 | If invoked with no options, it executes all the files listed in sequence |
|
2364 | If invoked with no options, it executes all the files listed in sequence | |
2336 | and drops you into the interpreter while still acknowledging any options |
|
2365 | and drops you into the interpreter while still acknowledging any options | |
2337 | you may have set in your ipythonrc file. |
|
2366 | you may have set in your ipythonrc file. | |
2338 | This behavior is different from standard Python, which when called as |
|
2367 | This behavior is different from standard Python, which when called as | |
2339 | \family typewriter |
|
2368 | \family typewriter | |
2340 | python -i |
|
2369 | python -i | |
2341 | \family default |
|
2370 | \family default | |
2342 | will only execute one file and ignore your configuration setup. |
|
2371 | will only execute one file and ignore your configuration setup. | |
2343 | \layout Standard |
|
2372 | \layout Standard | |
2344 |
|
2373 | |||
2345 | Please note that some of the configuration options are not available at |
|
2374 | Please note that some of the configuration options are not available at | |
2346 | the command line, simply because they are not practical here. |
|
2375 | the command line, simply because they are not practical here. | |
2347 | Look into your ipythonrc configuration file for details on those. |
|
2376 | Look into your ipythonrc configuration file for details on those. | |
2348 | This file typically installed in the |
|
2377 | This file typically installed in the | |
2349 | \family typewriter |
|
2378 | \family typewriter | |
2350 | $HOME/.ipython |
|
2379 | $HOME/.ipython | |
2351 | \family default |
|
2380 | \family default | |
2352 | directory. |
|
2381 | directory. | |
2353 | For Windows users, |
|
2382 | For Windows users, | |
2354 | \family typewriter |
|
2383 | \family typewriter | |
2355 | $HOME |
|
2384 | $HOME | |
2356 | \family default |
|
2385 | \family default | |
2357 | resolves to |
|
2386 | resolves to | |
2358 | \family typewriter |
|
2387 | \family typewriter | |
2359 | C: |
|
2388 | C: | |
2360 | \backslash |
|
2389 | \backslash | |
2361 |
|
2390 | |||
2362 | \backslash |
|
2391 | \backslash | |
2363 | Documents and Settings |
|
2392 | Documents and Settings | |
2364 | \backslash |
|
2393 | \backslash | |
2365 |
|
2394 | |||
2366 | \backslash |
|
2395 | \backslash | |
2367 | YourUserName |
|
2396 | YourUserName | |
2368 | \family default |
|
2397 | \family default | |
2369 | in most instances. |
|
2398 | in most instances. | |
2370 | In the rest of this text, we will refer to this directory as |
|
2399 | In the rest of this text, we will refer to this directory as | |
2371 | \family typewriter |
|
2400 | \family typewriter | |
2372 | IPYTHONDIR |
|
2401 | IPYTHONDIR | |
2373 | \family default |
|
2402 | \family default | |
2374 | . |
|
2403 | . | |
2375 | \layout Subsection |
|
2404 | \layout Subsection | |
2376 |
|
2405 | |||
2377 |
|
2406 | |||
2378 | \begin_inset LatexCommand \label{sec:threading-opts} |
|
2407 | \begin_inset LatexCommand \label{sec:threading-opts} | |
2379 |
|
2408 | |||
2380 | \end_inset |
|
2409 | \end_inset | |
2381 |
|
2410 | |||
2382 | Special Threading Options |
|
2411 | Special Threading Options | |
2383 | \layout Standard |
|
2412 | \layout Standard | |
2384 |
|
2413 | |||
2385 | The following special options are ONLY valid at the beginning of the command |
|
2414 | The following special options are ONLY valid at the beginning of the command | |
2386 | line, and not later. |
|
2415 | line, and not later. | |
2387 | This is because they control the initial- ization of ipython itself, before |
|
2416 | This is because they control the initial- ization of ipython itself, before | |
2388 | the normal option-handling mechanism is active. |
|
2417 | the normal option-handling mechanism is active. | |
2389 | \layout List |
|
2418 | \layout List | |
2390 | \labelwidthstring 00.00.0000 |
|
2419 | \labelwidthstring 00.00.0000 | |
2391 |
|
2420 | |||
2392 |
|
2421 | |||
2393 | \family typewriter |
|
2422 | \family typewriter | |
2394 | \series bold |
|
2423 | \series bold | |
2395 | -gthread,\SpecialChar ~ |
|
2424 | -gthread,\SpecialChar ~ | |
|
2425 | -qthread,\SpecialChar ~ | |||
2396 | -wthread,\SpecialChar ~ |
|
2426 | -wthread,\SpecialChar ~ | |
2397 | -pylab: |
|
2427 | -pylab: | |
2398 | \family default |
|
2428 | \family default | |
2399 | \series default |
|
2429 | \series default | |
2400 | Only |
|
2430 | Only | |
2401 | \emph on |
|
2431 | \emph on | |
2402 | one |
|
2432 | one | |
2403 | \emph default |
|
2433 | \emph default | |
2404 | of these can be given, and it can only be given as the first option passed |
|
2434 | of these can be given, and it can only be given as the first option passed | |
2405 | to IPython (it will have no effect in any other position). |
|
2435 | to IPython (it will have no effect in any other position). | |
2406 |
They provide threading support for the GTK and WXPython toolkits, and |
|
2436 | They provide threading support for the GTK Qt and WXPython toolkits, and | |
2407 | the matplotlib library. |
|
2437 | for the matplotlib library. | |
2408 | \layout List |
|
2438 | \layout List | |
2409 | \labelwidthstring 00.00.0000 |
|
2439 | \labelwidthstring 00.00.0000 | |
2410 |
|
2440 | |||
2411 | \SpecialChar ~ |
|
2441 | \SpecialChar ~ | |
2412 | If |
|
2442 | With any of the first three options, IPython starts running a separate | |
2413 | \family typewriter |
|
2443 | thread for the graphical toolkit's operation, so that you can open and | |
2414 | -gthread |
|
2444 | control graphical elements from within an IPython command line, without | |
2415 | \family default |
|
2445 | blocking. | |
2416 | is given, IPython starts running a separate thread for GTK operation, so |
|
2446 | All three provide essentially the same functionality, respectively for | |
2417 | that pyGTK-based programs can open and control GUIs without blocking IPython. |
|
2447 | GTK, QT and WXWidgets (via their Python interfaces). | |
2418 |
|
||||
2419 | \layout List |
|
|||
2420 | \labelwidthstring 00.00.0000 |
|
|||
2421 |
|
||||
2422 | \SpecialChar ~ |
|
|||
2423 | Similarly, |
|
|||
2424 | \family typewriter |
|
|||
2425 | -wthread |
|
|||
2426 | \family default |
|
|||
2427 | instantiates IPython with threading support for the WXPython toolkit. |
|
|||
2428 | You can control WX application windows from within IPython. |
|
|||
2429 | \layout List |
|
2448 | \layout List | |
2430 | \labelwidthstring 00.00.0000 |
|
2449 | \labelwidthstring 00.00.0000 | |
2431 |
|
2450 | |||
2432 | \SpecialChar ~ |
|
2451 | \SpecialChar ~ | |
2433 | If |
|
2452 | If | |
2434 | \family typewriter |
|
2453 | \family typewriter | |
2435 | -pylab |
|
2454 | -pylab | |
2436 | \family default |
|
2455 | \family default | |
2437 |
is given, IPython loads special support for the mat |
|
2456 | is given, IPython loads special support for the mat plotlib library ( | |
2438 | \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net} |
|
2457 | \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net} | |
2439 |
|
2458 | |||
2440 | \end_inset |
|
2459 | \end_inset | |
2441 |
|
2460 | |||
2442 | ), allowing interactive usage of any of its backends as defined in the user's |
|
2461 | ), allowing interactive usage of any of its backends as defined in the user's | |
2443 | .matplotlibrc file. |
|
2462 | ||
2444 | It automatically activates GTK or WX threading for IPyhton if the choice |
|
2463 | \family typewriter | |
|
2464 | ~/.matplotlib/matplotlibrc | |||
|
2465 | \family default | |||
|
2466 | file. | |||
|
2467 | It automatically activates GTK, Qt or WX threading for IPyhton if the choice | |||
2445 | of matplotlib backend requires it. |
|
2468 | of matplotlib backend requires it. | |
2446 | It also modifies the |
|
2469 | It also modifies the | |
2447 | \family typewriter |
|
2470 | \family typewriter | |
2448 | %run |
|
2471 | %run | |
2449 | \family default |
|
2472 | \family default | |
2450 | command to correctly execute (without blocking) any matplotlib-based script |
|
2473 | command to correctly execute (without blocking) any matplotlib-based script | |
2451 | which calls |
|
2474 | which calls | |
2452 | \family typewriter |
|
2475 | \family typewriter | |
2453 | show() |
|
2476 | show() | |
2454 | \family default |
|
2477 | \family default | |
2455 | at the end. |
|
2478 | at the end. | |
2456 |
|
2479 | |||
2457 | \layout List |
|
2480 | \layout List | |
2458 | \labelwidthstring 00.00.0000 |
|
2481 | \labelwidthstring 00.00.0000 | |
2459 |
|
2482 | |||
2460 |
|
2483 | |||
2461 | \family typewriter |
|
2484 | \family typewriter | |
2462 | \series bold |
|
2485 | \series bold | |
2463 | -tk |
|
2486 | -tk | |
2464 | \family default |
|
2487 | \family default | |
2465 | \series default |
|
2488 | \series default | |
2466 | The |
|
2489 | The | |
2467 | \family typewriter |
|
2490 | \family typewriter | |
2468 | -g/wthread |
|
2491 | -g/q/wthread | |
2469 | \family default |
|
2492 | \family default | |
2470 | options, and |
|
2493 | options, and | |
2471 | \family typewriter |
|
2494 | \family typewriter | |
2472 | -pylab |
|
2495 | -pylab | |
2473 | \family default |
|
2496 | \family default | |
2474 |
(if matplotlib is configured to use |
|
2497 | (if matplotlib is configured to use GTK, Qt or WX), will normally block | |
2475 | graphical interfaces. |
|
2498 | Tk graphical interfaces. | |
2476 | This means that when either GTK or WX threading is active, any attempt |
|
2499 | This means that when either GTK, Qt or WX threading is active, any attempt | |
2477 |
to open a Tk GUI will result in a dead window, and pos |
|
2500 | to open a Tk GUI will result in a dead window, and possibly cause the Python | |
2478 |
|
|
2501 | interpreter to crash. | |
2479 | An extra option, |
|
2502 | An extra option, | |
2480 | \family typewriter |
|
2503 | \family typewriter | |
2481 | -tk |
|
2504 | -tk | |
2482 | \family default |
|
2505 | \family default | |
2483 | , is available to address this issue. |
|
2506 | , is available to address this issue. | |
2484 | It can |
|
2507 | It can | |
2485 | \emph on |
|
2508 | \emph on | |
2486 | only |
|
2509 | only | |
2487 | \emph default |
|
2510 | \emph default | |
2488 | be given as a |
|
2511 | be given as a | |
2489 | \emph on |
|
2512 | \emph on | |
2490 | second |
|
2513 | second | |
2491 | \emph default |
|
2514 | \emph default | |
2492 | option after any of the above ( |
|
2515 | option after any of the above ( | |
2493 | \family typewriter |
|
2516 | \family typewriter | |
2494 | -gthread |
|
2517 | -gthread | |
2495 | \family default |
|
2518 | \family default | |
2496 | , |
|
2519 | , | |
2497 | \family typewriter |
|
2520 | \family typewriter | |
2498 | -wthread |
|
2521 | -wthread | |
2499 | \family default |
|
2522 | \family default | |
2500 | or |
|
2523 | or | |
2501 | \family typewriter |
|
2524 | \family typewriter | |
2502 | -pylab |
|
2525 | -pylab | |
2503 | \family default |
|
2526 | \family default | |
2504 | ). |
|
2527 | ). | |
2505 | \layout List |
|
2528 | \layout List | |
2506 | \labelwidthstring 00.00.0000 |
|
2529 | \labelwidthstring 00.00.0000 | |
2507 |
|
2530 | |||
2508 | \SpecialChar ~ |
|
2531 | \SpecialChar ~ | |
2509 | If |
|
2532 | If | |
2510 | \family typewriter |
|
2533 | \family typewriter | |
2511 | -tk |
|
2534 | -tk | |
2512 | \family default |
|
2535 | \family default | |
2513 |
is given, IPython will try to coordinate Tk threading with |
|
2536 | is given, IPython will try to coordinate Tk threading with GTK, Qt or WX. | |
2514 | This is however potentially unreliable, and you will have to test on your |
|
2537 | This is however potentially unreliable, and you will have to test on your | |
2515 | platform and Python configuration to determine whether it works for you. |
|
2538 | platform and Python configuration to determine whether it works for you. | |
2516 | Debian users have reported success, apparently due to the fact that Debian |
|
2539 | Debian users have reported success, apparently due to the fact that Debian | |
2517 | builds all of Tcl, Tk, Tkinter and Python with pthreads support. |
|
2540 | builds all of Tcl, Tk, Tkinter and Python with pthreads support. | |
2518 | Under other Linux environments (such as Fedora Core 2), this option has |
|
2541 | Under other Linux environments (such as Fedora Core 2/3), this option has | |
2519 | caused random crashes and lockups of the Python interpreter. |
|
2542 | caused random crashes and lockups of the Python interpreter. | |
2520 | Under other operating systems (Mac OSX and Windows), you'll need to try |
|
2543 | Under other operating systems (Mac OSX and Windows), you'll need to try | |
2521 | it to find out, since currently no user reports are available. |
|
2544 | it to find out, since currently no user reports are available. | |
2522 | \layout List |
|
2545 | \layout List | |
2523 | \labelwidthstring 00.00.0000 |
|
2546 | \labelwidthstring 00.00.0000 | |
2524 |
|
2547 | |||
2525 | \SpecialChar ~ |
|
2548 | \SpecialChar ~ | |
2526 | There is unfortunately no way for IPython to determine at run time whether |
|
2549 | There is unfortunately no way for IPython to determine at run time whether | |
2527 |
|
2550 | |||
2528 | \family typewriter |
|
2551 | \family typewriter | |
2529 | -tk |
|
2552 | -tk | |
2530 | \family default |
|
2553 | \family default | |
2531 | will work reliably or not, so you will need to do some experiments before |
|
2554 | will work reliably or not, so you will need to do some experiments before | |
2532 | relying on it for regular work. |
|
2555 | relying on it for regular work. | |
2533 |
|
2556 | |||
2534 | \layout Subsection |
|
2557 | \layout Subsection | |
2535 |
|
2558 | |||
2536 |
|
2559 | |||
2537 | \begin_inset LatexCommand \label{sec:cmd-line-opts} |
|
2560 | \begin_inset LatexCommand \label{sec:cmd-line-opts} | |
2538 |
|
2561 | |||
2539 | \end_inset |
|
2562 | \end_inset | |
2540 |
|
2563 | |||
2541 | Regular Options |
|
2564 | Regular Options | |
2542 | \layout Standard |
|
2565 | \layout Standard | |
2543 |
|
2566 | |||
2544 | After the above threading options have been given, regular options can follow |
|
2567 | After the above threading options have been given, regular options can follow | |
2545 | in any order. |
|
2568 | in any order. | |
2546 | All options can be abbreviated to their shortest non-ambiguous form and |
|
2569 | All options can be abbreviated to their shortest non-ambiguous form and | |
2547 | are case-sensitive. |
|
2570 | are case-sensitive. | |
2548 | One or two dashes can be used. |
|
2571 | One or two dashes can be used. | |
2549 | Some options have an alternate short form, indicated after a |
|
2572 | Some options have an alternate short form, indicated after a | |
2550 | \family typewriter |
|
2573 | \family typewriter | |
2551 | | |
|
2574 | | | |
2552 | \family default |
|
2575 | \family default | |
2553 | . |
|
2576 | . | |
2554 | \layout Standard |
|
2577 | \layout Standard | |
2555 |
|
2578 | |||
2556 | Most options can also be set from your ipythonrc configuration file. |
|
2579 | Most options can also be set from your ipythonrc configuration file. | |
2557 | See the provided example for more details on what the options do. |
|
2580 | See the provided example for more details on what the options do. | |
2558 | Options given at the command line override the values set in the ipythonrc |
|
2581 | Options given at the command line override the values set in the ipythonrc | |
2559 | file. |
|
2582 | file. | |
2560 | \layout Standard |
|
2583 | \layout Standard | |
2561 |
|
2584 | |||
2562 | All options with a |
|
2585 | All options with a | |
2563 | \family typewriter |
|
2586 | \family typewriter | |
2564 | no| |
|
2587 | no| | |
2565 | \family default |
|
2588 | \family default | |
2566 | prepended can be specified in 'no' form ( |
|
2589 | prepended can be specified in 'no' form ( | |
2567 | \family typewriter |
|
2590 | \family typewriter | |
2568 | -nooption |
|
2591 | -nooption | |
2569 | \family default |
|
2592 | \family default | |
2570 | instead of |
|
2593 | instead of | |
2571 | \family typewriter |
|
2594 | \family typewriter | |
2572 | -option |
|
2595 | -option | |
2573 | \family default |
|
2596 | \family default | |
2574 | ) to turn the feature off. |
|
2597 | ) to turn the feature off. | |
2575 | \layout List |
|
2598 | \layout List | |
2576 | \labelwidthstring 00.00.0000 |
|
2599 | \labelwidthstring 00.00.0000 | |
2577 |
|
2600 | |||
2578 |
|
2601 | |||
2579 | \family typewriter |
|
2602 | \family typewriter | |
2580 | \series bold |
|
2603 | \series bold | |
2581 | -help |
|
2604 | -help | |
2582 | \family default |
|
2605 | \family default | |
2583 | \series default |
|
2606 | \series default | |
2584 | : print a help message and exit. |
|
2607 | : print a help message and exit. | |
2585 | \layout List |
|
2608 | \layout List | |
2586 | \labelwidthstring 00.00.0000 |
|
2609 | \labelwidthstring 00.00.0000 | |
2587 |
|
2610 | |||
2588 |
|
2611 | |||
2589 | \family typewriter |
|
2612 | \family typewriter | |
2590 | \series bold |
|
2613 | \series bold | |
2591 | -pylab: |
|
2614 | -pylab: | |
2592 | \family default |
|
2615 | \family default | |
2593 | \series default |
|
2616 | \series default | |
2594 | this can |
|
2617 | this can | |
2595 | \emph on |
|
2618 | \emph on | |
2596 | only |
|
2619 | only | |
2597 | \emph default |
|
2620 | \emph default | |
2598 | be given as the |
|
2621 | be given as the | |
2599 | \emph on |
|
2622 | \emph on | |
2600 | first |
|
2623 | first | |
2601 | \emph default |
|
2624 | \emph default | |
2602 | option passed to IPython (it will have no effect in any other position). |
|
2625 | option passed to IPython (it will have no effect in any other position). | |
2603 | It adds special support for the matplotlib library ( |
|
2626 | It adds special support for the matplotlib library ( | |
2604 | \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net} |
|
2627 | \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net} | |
2605 |
|
2628 | |||
2606 | \end_inset |
|
2629 | \end_inset | |
2607 |
|
2630 | |||
2608 | ), allowing interactive usage of any of its backends as defined in the user's |
|
2631 | ), allowing interactive usage of any of its backends as defined in the user's | |
2609 |
|
2632 | |||
2610 | \family typewriter |
|
2633 | \family typewriter | |
2611 | .matplotlibrc |
|
2634 | .matplotlibrc | |
2612 | \family default |
|
2635 | \family default | |
2613 | file. |
|
2636 | file. | |
2614 | It automatically activates GTK or WX threading for IPyhton if the choice |
|
2637 | It automatically activates GTK or WX threading for IPyhton if the choice | |
2615 | of matplotlib backend requires it. |
|
2638 | of matplotlib backend requires it. | |
2616 | It also modifies the |
|
2639 | It also modifies the | |
2617 | \family typewriter |
|
2640 | \family typewriter | |
2618 | %run |
|
2641 | %run | |
2619 | \family default |
|
2642 | \family default | |
2620 | command to correctly execute (without blocking) any matplotlib-based script |
|
2643 | command to correctly execute (without blocking) any matplotlib-based script | |
2621 | which calls |
|
2644 | which calls | |
2622 | \family typewriter |
|
2645 | \family typewriter | |
2623 | show() |
|
2646 | show() | |
2624 | \family default |
|
2647 | \family default | |
2625 | at the end. |
|
2648 | at the end. | |
2626 | See Sec.\SpecialChar ~ |
|
2649 | See Sec.\SpecialChar ~ | |
2627 |
|
2650 | |||
2628 | \begin_inset LatexCommand \ref{sec:matplotlib-support} |
|
2651 | \begin_inset LatexCommand \ref{sec:matplotlib-support} | |
2629 |
|
2652 | |||
2630 | \end_inset |
|
2653 | \end_inset | |
2631 |
|
2654 | |||
2632 | for more details. |
|
2655 | for more details. | |
2633 | \layout List |
|
2656 | \layout List | |
2634 | \labelwidthstring 00.00.0000 |
|
2657 | \labelwidthstring 00.00.0000 | |
2635 |
|
2658 | |||
2636 |
|
2659 | |||
2637 | \family typewriter |
|
2660 | \family typewriter | |
2638 | \series bold |
|
2661 | \series bold | |
2639 | -no|automagic |
|
2662 | -no|automagic | |
2640 | \series default |
|
2663 | \series default | |
2641 | : |
|
2664 | : | |
2642 | \family default |
|
2665 | \family default | |
2643 | make magic commands automatic (without needing their first character to |
|
2666 | make magic commands automatic (without needing their first character to | |
2644 | be |
|
2667 | be | |
2645 | \family typewriter |
|
2668 | \family typewriter | |
2646 | % |
|
2669 | % | |
2647 | \family default |
|
2670 | \family default | |
2648 | ). |
|
2671 | ). | |
2649 | Type |
|
2672 | Type | |
2650 | \family typewriter |
|
2673 | \family typewriter | |
2651 | %magic |
|
2674 | %magic | |
2652 | \family default |
|
2675 | \family default | |
2653 | at the IPython prompt for more information. |
|
2676 | at the IPython prompt for more information. | |
2654 | \layout List |
|
2677 | \layout List | |
2655 | \labelwidthstring 00.00.0000 |
|
2678 | \labelwidthstring 00.00.0000 | |
2656 |
|
2679 | |||
2657 |
|
2680 | |||
2658 | \family typewriter |
|
2681 | \family typewriter | |
2659 | \series bold |
|
2682 | \series bold | |
2660 | -no|banner |
|
2683 | -no|banner | |
2661 | \series default |
|
2684 | \series default | |
2662 | : |
|
2685 | : | |
2663 | \family default |
|
2686 | \family default | |
2664 | Print the initial information banner (default on). |
|
2687 | Print the initial information banner (default on). | |
2665 | \layout List |
|
2688 | \layout List | |
2666 | \labelwidthstring 00.00.0000 |
|
2689 | \labelwidthstring 00.00.0000 | |
2667 |
|
2690 | |||
2668 |
|
2691 | |||
2669 | \family typewriter |
|
2692 | \family typewriter | |
2670 | \series bold |
|
2693 | \series bold | |
2671 | -c\SpecialChar ~ |
|
2694 | -c\SpecialChar ~ | |
2672 | <command>: |
|
2695 | <command>: | |
2673 | \family default |
|
2696 | \family default | |
2674 | \series default |
|
2697 | \series default | |
2675 | execute the given command string, and set sys.argv to |
|
2698 | execute the given command string, and set sys.argv to | |
2676 | \family typewriter |
|
2699 | \family typewriter | |
2677 | ['c'] |
|
2700 | ['c'] | |
2678 | \family default |
|
2701 | \family default | |
2679 | . |
|
2702 | . | |
2680 | This is similar to the |
|
2703 | This is similar to the | |
2681 | \family typewriter |
|
2704 | \family typewriter | |
2682 | -c |
|
2705 | -c | |
2683 | \family default |
|
2706 | \family default | |
2684 | option in the normal Python interpreter. |
|
2707 | option in the normal Python interpreter. | |
2685 |
|
2708 | |||
2686 | \layout List |
|
2709 | \layout List | |
2687 | \labelwidthstring 00.00.0000 |
|
2710 | \labelwidthstring 00.00.0000 | |
2688 |
|
2711 | |||
2689 |
|
2712 | |||
2690 | \family typewriter |
|
2713 | \family typewriter | |
2691 | \series bold |
|
2714 | \series bold | |
2692 | -cache_size|cs\SpecialChar ~ |
|
2715 | -cache_size|cs\SpecialChar ~ | |
2693 | <n> |
|
2716 | <n> | |
2694 | \series default |
|
2717 | \series default | |
2695 | : |
|
2718 | : | |
2696 | \family default |
|
2719 | \family default | |
2697 | size of the output cache (maximum number of entries to hold in memory). |
|
2720 | size of the output cache (maximum number of entries to hold in memory). | |
2698 | The default is 1000, you can change it permanently in your config file. |
|
2721 | The default is 1000, you can change it permanently in your config file. | |
2699 | Setting it to 0 completely disables the caching system, and the minimum |
|
2722 | Setting it to 0 completely disables the caching system, and the minimum | |
2700 | value accepted is 20 (if you provide a value less than 20, it is reset |
|
2723 | value accepted is 20 (if you provide a value less than 20, it is reset | |
2701 | to 0 and a warning is issued) This limit is defined because otherwise you'll |
|
2724 | to 0 and a warning is issued) This limit is defined because otherwise you'll | |
2702 | spend more time re-flushing a too small cache than working. |
|
2725 | spend more time re-flushing a too small cache than working. | |
2703 | \layout List |
|
2726 | \layout List | |
2704 | \labelwidthstring 00.00.0000 |
|
2727 | \labelwidthstring 00.00.0000 | |
2705 |
|
2728 | |||
2706 |
|
2729 | |||
2707 | \family typewriter |
|
2730 | \family typewriter | |
2708 | \series bold |
|
2731 | \series bold | |
2709 | -classic|cl |
|
2732 | -classic|cl | |
2710 | \series default |
|
2733 | \series default | |
2711 | : |
|
2734 | : | |
2712 | \family default |
|
2735 | \family default | |
2713 | Gives IPython a similar feel to the classic Python prompt. |
|
2736 | Gives IPython a similar feel to the classic Python prompt. | |
2714 | \layout List |
|
2737 | \layout List | |
2715 | \labelwidthstring 00.00.0000 |
|
2738 | \labelwidthstring 00.00.0000 | |
2716 |
|
2739 | |||
2717 |
|
2740 | |||
2718 | \family typewriter |
|
2741 | \family typewriter | |
2719 | \series bold |
|
2742 | \series bold | |
2720 | -colors\SpecialChar ~ |
|
2743 | -colors\SpecialChar ~ | |
2721 | <scheme>: |
|
2744 | <scheme>: | |
2722 | \family default |
|
2745 | \family default | |
2723 | \series default |
|
2746 | \series default | |
2724 | Color scheme for prompts and exception reporting. |
|
2747 | Color scheme for prompts and exception reporting. | |
2725 | Currently implemented: NoColor, Linux and LightBG. |
|
2748 | Currently implemented: NoColor, Linux and LightBG. | |
2726 | \layout List |
|
2749 | \layout List | |
2727 | \labelwidthstring 00.00.0000 |
|
2750 | \labelwidthstring 00.00.0000 | |
2728 |
|
2751 | |||
2729 |
|
2752 | |||
2730 | \family typewriter |
|
2753 | \family typewriter | |
2731 | \series bold |
|
2754 | \series bold | |
2732 | -no|color_info: |
|
2755 | -no|color_info: | |
2733 | \family default |
|
2756 | \family default | |
2734 | \series default |
|
2757 | \series default | |
2735 | IPython can display information about objects via a set of functions, and |
|
2758 | IPython can display information about objects via a set of functions, and | |
2736 | optionally can use colors for this, syntax highlighting source code and |
|
2759 | optionally can use colors for this, syntax highlighting source code and | |
2737 | various other elements. |
|
2760 | various other elements. | |
2738 | However, because this information is passed through a pager (like 'less') |
|
2761 | However, because this information is passed through a pager (like 'less') | |
2739 | and many pagers get confused with color codes, this option is off by default. |
|
2762 | and many pagers get confused with color codes, this option is off by default. | |
2740 | You can test it and turn it on permanently in your ipythonrc file if it |
|
2763 | You can test it and turn it on permanently in your ipythonrc file if it | |
2741 | works for you. |
|
2764 | works for you. | |
2742 | As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but |
|
2765 | As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but | |
2743 | that in RedHat 7.2 doesn't. |
|
2766 | that in RedHat 7.2 doesn't. | |
2744 | \layout List |
|
2767 | \layout List | |
2745 | \labelwidthstring 00.00.0000 |
|
2768 | \labelwidthstring 00.00.0000 | |
2746 |
|
2769 | |||
2747 | \SpecialChar ~ |
|
2770 | \SpecialChar ~ | |
2748 | Test it and turn it on permanently if it works with your system. |
|
2771 | Test it and turn it on permanently if it works with your system. | |
2749 | The magic function |
|
2772 | The magic function | |
2750 | \family typewriter |
|
2773 | \family typewriter | |
2751 | %color_info |
|
2774 | %color_info | |
2752 | \family default |
|
2775 | \family default | |
2753 | allows you to toggle this interactively for testing. |
|
2776 | allows you to toggle this interactively for testing. | |
2754 | \layout List |
|
2777 | \layout List | |
2755 | \labelwidthstring 00.00.0000 |
|
2778 | \labelwidthstring 00.00.0000 | |
2756 |
|
2779 | |||
2757 |
|
2780 | |||
2758 | \family typewriter |
|
2781 | \family typewriter | |
2759 | \series bold |
|
2782 | \series bold | |
2760 | -no|debug |
|
2783 | -no|debug | |
2761 | \family default |
|
2784 | \family default | |
2762 | \series default |
|
2785 | \series default | |
2763 | : Show information about the loading process. |
|
2786 | : Show information about the loading process. | |
2764 | Very useful to pin down problems with your configuration files or to get |
|
2787 | Very useful to pin down problems with your configuration files or to get | |
2765 | details about session restores. |
|
2788 | details about session restores. | |
2766 | \layout List |
|
2789 | \layout List | |
2767 | \labelwidthstring 00.00.0000 |
|
2790 | \labelwidthstring 00.00.0000 | |
2768 |
|
2791 | |||
2769 |
|
2792 | |||
2770 | \family typewriter |
|
2793 | \family typewriter | |
2771 | \series bold |
|
2794 | \series bold | |
2772 | -no|deep_reload |
|
2795 | -no|deep_reload | |
2773 | \series default |
|
2796 | \series default | |
2774 | : |
|
2797 | : | |
2775 | \family default |
|
2798 | \family default | |
2776 | IPython can use the |
|
2799 | IPython can use the | |
2777 | \family typewriter |
|
2800 | \family typewriter | |
2778 | deep_reload |
|
2801 | deep_reload | |
2779 | \family default |
|
2802 | \family default | |
2780 | module which reloads changes in modules recursively (it replaces the |
|
2803 | module which reloads changes in modules recursively (it replaces the | |
2781 | \family typewriter |
|
2804 | \family typewriter | |
2782 | reload() |
|
2805 | reload() | |
2783 | \family default |
|
2806 | \family default | |
2784 | function, so you don't need to change anything to use it). |
|
2807 | function, so you don't need to change anything to use it). | |
2785 |
|
2808 | |||
2786 | \family typewriter |
|
2809 | \family typewriter | |
2787 | deep_reload() |
|
2810 | deep_reload() | |
2788 | \family default |
|
2811 | \family default | |
2789 | forces a full reload of modules whose code may have changed, which the |
|
2812 | forces a full reload of modules whose code may have changed, which the | |
2790 | default |
|
2813 | default | |
2791 | \family typewriter |
|
2814 | \family typewriter | |
2792 | reload() |
|
2815 | reload() | |
2793 | \family default |
|
2816 | \family default | |
2794 | function does not. |
|
2817 | function does not. | |
2795 | \layout List |
|
2818 | \layout List | |
2796 | \labelwidthstring 00.00.0000 |
|
2819 | \labelwidthstring 00.00.0000 | |
2797 |
|
2820 | |||
2798 | \SpecialChar ~ |
|
2821 | \SpecialChar ~ | |
2799 | When deep_reload is off, IPython will use the normal |
|
2822 | When deep_reload is off, IPython will use the normal | |
2800 | \family typewriter |
|
2823 | \family typewriter | |
2801 | reload() |
|
2824 | reload() | |
2802 | \family default |
|
2825 | \family default | |
2803 | , but deep_reload will still be available as |
|
2826 | , but deep_reload will still be available as | |
2804 | \family typewriter |
|
2827 | \family typewriter | |
2805 | dreload() |
|
2828 | dreload() | |
2806 | \family default |
|
2829 | \family default | |
2807 | . |
|
2830 | . | |
2808 | This feature is off by default [which means that you have both normal |
|
2831 | This feature is off by default [which means that you have both normal | |
2809 | \family typewriter |
|
2832 | \family typewriter | |
2810 | reload() |
|
2833 | reload() | |
2811 | \family default |
|
2834 | \family default | |
2812 | and |
|
2835 | and | |
2813 | \family typewriter |
|
2836 | \family typewriter | |
2814 | dreload() |
|
2837 | dreload() | |
2815 | \family default |
|
2838 | \family default | |
2816 | ]. |
|
2839 | ]. | |
2817 | \layout List |
|
2840 | \layout List | |
2818 | \labelwidthstring 00.00.0000 |
|
2841 | \labelwidthstring 00.00.0000 | |
2819 |
|
2842 | |||
2820 |
|
2843 | |||
2821 | \family typewriter |
|
2844 | \family typewriter | |
2822 | \series bold |
|
2845 | \series bold | |
2823 | -editor\SpecialChar ~ |
|
2846 | -editor\SpecialChar ~ | |
2824 | <name> |
|
2847 | <name> | |
2825 | \family default |
|
2848 | \family default | |
2826 | \series default |
|
2849 | \series default | |
2827 | : Which editor to use with the |
|
2850 | : Which editor to use with the | |
2828 | \family typewriter |
|
2851 | \family typewriter | |
2829 | %edit |
|
2852 | %edit | |
2830 | \family default |
|
2853 | \family default | |
2831 | command. |
|
2854 | command. | |
2832 | By default, IPython will honor your |
|
2855 | By default, IPython will honor your | |
2833 | \family typewriter |
|
2856 | \family typewriter | |
2834 | EDITOR |
|
2857 | EDITOR | |
2835 | \family default |
|
2858 | \family default | |
2836 | environment variable (if not set, vi is the Unix default and notepad the |
|
2859 | environment variable (if not set, vi is the Unix default and notepad the | |
2837 | Windows one). |
|
2860 | Windows one). | |
2838 | Since this editor is invoked on the fly by IPython and is meant for editing |
|
2861 | Since this editor is invoked on the fly by IPython and is meant for editing | |
2839 | small code snippets, you may want to use a small, lightweight editor here |
|
2862 | small code snippets, you may want to use a small, lightweight editor here | |
2840 | (in case your default |
|
2863 | (in case your default | |
2841 | \family typewriter |
|
2864 | \family typewriter | |
2842 | EDITOR |
|
2865 | EDITOR | |
2843 | \family default |
|
2866 | \family default | |
2844 | is something like Emacs). |
|
2867 | is something like Emacs). | |
2845 | \layout List |
|
2868 | \layout List | |
2846 | \labelwidthstring 00.00.0000 |
|
2869 | \labelwidthstring 00.00.0000 | |
2847 |
|
2870 | |||
2848 |
|
2871 | |||
2849 | \family typewriter |
|
2872 | \family typewriter | |
2850 | \series bold |
|
2873 | \series bold | |
2851 | -ipythondir\SpecialChar ~ |
|
2874 | -ipythondir\SpecialChar ~ | |
2852 | <name> |
|
2875 | <name> | |
2853 | \series default |
|
2876 | \series default | |
2854 | : |
|
2877 | : | |
2855 | \family default |
|
2878 | \family default | |
2856 | name of your IPython configuration directory |
|
2879 | name of your IPython configuration directory | |
2857 | \family typewriter |
|
2880 | \family typewriter | |
2858 | IPYTHONDIR |
|
2881 | IPYTHONDIR | |
2859 | \family default |
|
2882 | \family default | |
2860 | . |
|
2883 | . | |
2861 | This can also be specified through the environment variable |
|
2884 | This can also be specified through the environment variable | |
2862 | \family typewriter |
|
2885 | \family typewriter | |
2863 | IPYTHONDIR |
|
2886 | IPYTHONDIR | |
2864 | \family default |
|
2887 | \family default | |
2865 | . |
|
2888 | . | |
2866 | \layout List |
|
2889 | \layout List | |
2867 | \labelwidthstring 00.00.0000 |
|
2890 | \labelwidthstring 00.00.0000 | |
2868 |
|
2891 | |||
2869 |
|
2892 | |||
2870 | \family typewriter |
|
2893 | \family typewriter | |
2871 | \series bold |
|
2894 | \series bold | |
2872 | -log|l |
|
2895 | -log|l | |
2873 | \family default |
|
2896 | \family default | |
2874 | \series default |
|
2897 | \series default | |
2875 | : generate a log file of all input. |
|
2898 | : generate a log file of all input. | |
2876 | Defaults to |
|
2899 | Defaults to | |
2877 | \family typewriter |
|
2900 | \family typewriter | |
2878 | $IPYTHONDIR/log |
|
2901 | $IPYTHONDIR/log | |
2879 | \family default |
|
2902 | \family default | |
2880 | . |
|
2903 | . | |
2881 | You can use this to later restore a session by loading your logfile as |
|
2904 | You can use this to later restore a session by loading your logfile as | |
2882 | a file to be executed with option |
|
2905 | a file to be executed with option | |
2883 | \family typewriter |
|
2906 | \family typewriter | |
2884 | -logplay |
|
2907 | -logplay | |
2885 | \family default |
|
2908 | \family default | |
2886 | (see below). |
|
2909 | (see below). | |
2887 | \layout List |
|
2910 | \layout List | |
2888 | \labelwidthstring 00.00.0000 |
|
2911 | \labelwidthstring 00.00.0000 | |
2889 |
|
2912 | |||
2890 |
|
2913 | |||
2891 | \family typewriter |
|
2914 | \family typewriter | |
2892 | \series bold |
|
2915 | \series bold | |
2893 | -logfile|lf\SpecialChar ~ |
|
2916 | -logfile|lf\SpecialChar ~ | |
2894 | <name> |
|
2917 | <name> | |
2895 | \series default |
|
2918 | \series default | |
2896 | : |
|
2919 | : | |
2897 | \family default |
|
2920 | \family default | |
2898 | specify the name of your logfile. |
|
2921 | specify the name of your logfile. | |
2899 | \layout List |
|
2922 | \layout List | |
2900 | \labelwidthstring 00.00.0000 |
|
2923 | \labelwidthstring 00.00.0000 | |
2901 |
|
2924 | |||
2902 |
|
2925 | |||
2903 | \family typewriter |
|
2926 | \family typewriter | |
2904 | \series bold |
|
2927 | \series bold | |
2905 | -logplay|lp\SpecialChar ~ |
|
2928 | -logplay|lp\SpecialChar ~ | |
2906 | <name> |
|
2929 | <name> | |
2907 | \series default |
|
2930 | \series default | |
2908 | : |
|
2931 | : | |
2909 | \family default |
|
2932 | \family default | |
2910 | you can replay a previous log. |
|
2933 | you can replay a previous log. | |
2911 | For restoring a session as close as possible to the state you left it in, |
|
2934 | For restoring a session as close as possible to the state you left it in, | |
2912 | use this option (don't just run the logfile). |
|
2935 | use this option (don't just run the logfile). | |
2913 | With |
|
2936 | With | |
2914 | \family typewriter |
|
2937 | \family typewriter | |
2915 | -logplay |
|
2938 | -logplay | |
2916 | \family default |
|
2939 | \family default | |
2917 | , IPython will try to reconstruct the previous working environment in full, |
|
2940 | , IPython will try to reconstruct the previous working environment in full, | |
2918 | not just execute the commands in the logfile. |
|
2941 | not just execute the commands in the logfile. | |
2919 | \layout List |
|
2942 | \layout List | |
2920 | \labelwidthstring 00.00.0000 |
|
2943 | \labelwidthstring 00.00.0000 | |
2921 |
|
2944 | |||
2922 | \SpecialChar ~ |
|
2945 | \SpecialChar ~ | |
2923 | When a session is restored, logging is automatically turned on again with |
|
2946 | When a session is restored, logging is automatically turned on again with | |
2924 | the name of the logfile it was invoked with (it is read from the log header). |
|
2947 | the name of the logfile it was invoked with (it is read from the log header). | |
2925 | So once you've turned logging on for a session, you can quit IPython and |
|
2948 | So once you've turned logging on for a session, you can quit IPython and | |
2926 | reload it as many times as you want and it will continue to log its history |
|
2949 | reload it as many times as you want and it will continue to log its history | |
2927 | and restore from the beginning every time. |
|
2950 | and restore from the beginning every time. | |
2928 | \layout List |
|
2951 | \layout List | |
2929 | \labelwidthstring 00.00.0000 |
|
2952 | \labelwidthstring 00.00.0000 | |
2930 |
|
2953 | |||
2931 | \SpecialChar ~ |
|
2954 | \SpecialChar ~ | |
2932 | Caveats: there are limitations in this option. |
|
2955 | Caveats: there are limitations in this option. | |
2933 | The history variables |
|
2956 | The history variables | |
2934 | \family typewriter |
|
2957 | \family typewriter | |
2935 | _i* |
|
2958 | _i* | |
2936 | \family default |
|
2959 | \family default | |
2937 | , |
|
2960 | , | |
2938 | \family typewriter |
|
2961 | \family typewriter | |
2939 | _* |
|
2962 | _* | |
2940 | \family default |
|
2963 | \family default | |
2941 | and |
|
2964 | and | |
2942 | \family typewriter |
|
2965 | \family typewriter | |
2943 | _dh |
|
2966 | _dh | |
2944 | \family default |
|
2967 | \family default | |
2945 | don't get restored properly. |
|
2968 | don't get restored properly. | |
2946 | In the future we will try to implement full session saving by writing and |
|
2969 | In the future we will try to implement full session saving by writing and | |
2947 | retrieving a 'snapshot' of the memory state of IPython. |
|
2970 | retrieving a 'snapshot' of the memory state of IPython. | |
2948 | But our first attempts failed because of inherent limitations of Python's |
|
2971 | But our first attempts failed because of inherent limitations of Python's | |
2949 | Pickle module, so this may have to wait. |
|
2972 | Pickle module, so this may have to wait. | |
2950 | \layout List |
|
2973 | \layout List | |
2951 | \labelwidthstring 00.00.0000 |
|
2974 | \labelwidthstring 00.00.0000 | |
2952 |
|
2975 | |||
2953 |
|
2976 | |||
2954 | \family typewriter |
|
2977 | \family typewriter | |
2955 | \series bold |
|
2978 | \series bold | |
2956 | -no|messages |
|
2979 | -no|messages | |
2957 | \series default |
|
2980 | \series default | |
2958 | : |
|
2981 | : | |
2959 | \family default |
|
2982 | \family default | |
2960 | Print messages which IPython collects about its startup process (default |
|
2983 | Print messages which IPython collects about its startup process (default | |
2961 | on). |
|
2984 | on). | |
2962 | \layout List |
|
2985 | \layout List | |
2963 | \labelwidthstring 00.00.0000 |
|
2986 | \labelwidthstring 00.00.0000 | |
2964 |
|
2987 | |||
2965 |
|
2988 | |||
2966 | \family typewriter |
|
2989 | \family typewriter | |
2967 | \series bold |
|
2990 | \series bold | |
2968 | -no|pdb |
|
2991 | -no|pdb | |
2969 | \family default |
|
2992 | \family default | |
2970 | \series default |
|
2993 | \series default | |
2971 | : Automatically call the pdb debugger after every uncaught exception. |
|
2994 | : Automatically call the pdb debugger after every uncaught exception. | |
2972 | If you are used to debugging using pdb, this puts you automatically inside |
|
2995 | If you are used to debugging using pdb, this puts you automatically inside | |
2973 | of it after any call (either in IPython or in code called by it) which |
|
2996 | of it after any call (either in IPython or in code called by it) which | |
2974 | triggers an exception which goes uncaught. |
|
2997 | triggers an exception which goes uncaught. | |
2975 | \layout List |
|
2998 | \layout List | |
2976 | \labelwidthstring 00.00.0000 |
|
2999 | \labelwidthstring 00.00.0000 | |
2977 |
|
3000 | |||
2978 |
|
3001 | |||
2979 | \family typewriter |
|
3002 | \family typewriter | |
2980 | \series bold |
|
3003 | \series bold | |
2981 | -no|pprint |
|
3004 | -no|pprint | |
2982 | \series default |
|
3005 | \series default | |
2983 | : |
|
3006 | : | |
2984 | \family default |
|
3007 | \family default | |
2985 | ipython can optionally use the pprint (pretty printer) module for displaying |
|
3008 | ipython can optionally use the pprint (pretty printer) module for displaying | |
2986 | results. |
|
3009 | results. | |
2987 | pprint tends to give a nicer display of nested data structures. |
|
3010 | pprint tends to give a nicer display of nested data structures. | |
2988 | If you like it, you can turn it on permanently in your config file (default |
|
3011 | If you like it, you can turn it on permanently in your config file (default | |
2989 | off). |
|
3012 | off). | |
2990 | \layout List |
|
3013 | \layout List | |
2991 | \labelwidthstring 00.00.0000 |
|
3014 | \labelwidthstring 00.00.0000 | |
2992 |
|
3015 | |||
2993 |
|
3016 | |||
2994 | \family typewriter |
|
3017 | \family typewriter | |
2995 | \series bold |
|
3018 | \series bold | |
2996 | -profile|p <name> |
|
3019 | -profile|p <name> | |
2997 | \series default |
|
3020 | \series default | |
2998 | : |
|
3021 | : | |
2999 | \family default |
|
3022 | \family default | |
3000 | assume that your config file is |
|
3023 | assume that your config file is | |
3001 | \family typewriter |
|
3024 | \family typewriter | |
3002 | ipythonrc-<name> |
|
3025 | ipythonrc-<name> | |
3003 | \family default |
|
3026 | \family default | |
3004 | (looks in current dir first, then in |
|
3027 | (looks in current dir first, then in | |
3005 | \family typewriter |
|
3028 | \family typewriter | |
3006 | IPYTHONDIR |
|
3029 | IPYTHONDIR | |
3007 | \family default |
|
3030 | \family default | |
3008 | ). |
|
3031 | ). | |
3009 | This is a quick way to keep and load multiple config files for different |
|
3032 | This is a quick way to keep and load multiple config files for different | |
3010 | tasks, especially if you use the include option of config files. |
|
3033 | tasks, especially if you use the include option of config files. | |
3011 | You can keep a basic |
|
3034 | You can keep a basic | |
3012 | \family typewriter |
|
3035 | \family typewriter | |
3013 | IPYTHONDIR/ipythonrc |
|
3036 | IPYTHONDIR/ipythonrc | |
3014 | \family default |
|
3037 | \family default | |
3015 | file and then have other 'profiles' which include this one and load extra |
|
3038 | file and then have other 'profiles' which include this one and load extra | |
3016 | things for particular tasks. |
|
3039 | things for particular tasks. | |
3017 | For example: |
|
3040 | For example: | |
3018 | \layout List |
|
3041 | \layout List | |
3019 | \labelwidthstring 00.00.0000 |
|
3042 | \labelwidthstring 00.00.0000 | |
3020 |
|
3043 | |||
3021 |
|
3044 | |||
3022 | \family typewriter |
|
3045 | \family typewriter | |
3023 | \SpecialChar ~ |
|
3046 | \SpecialChar ~ | |
3024 |
|
3047 | |||
3025 | \family default |
|
3048 | \family default | |
3026 | 1. |
|
3049 | 1. | |
3027 |
|
3050 | |||
3028 | \family typewriter |
|
3051 | \family typewriter | |
3029 | $HOME/.ipython/ipythonrc |
|
3052 | $HOME/.ipython/ipythonrc | |
3030 | \family default |
|
3053 | \family default | |
3031 | : load basic things you always want. |
|
3054 | : load basic things you always want. | |
3032 | \layout List |
|
3055 | \layout List | |
3033 | \labelwidthstring 00.00.0000 |
|
3056 | \labelwidthstring 00.00.0000 | |
3034 |
|
3057 | |||
3035 |
|
3058 | |||
3036 | \family typewriter |
|
3059 | \family typewriter | |
3037 | \SpecialChar ~ |
|
3060 | \SpecialChar ~ | |
3038 |
|
3061 | |||
3039 | \family default |
|
3062 | \family default | |
3040 | 2. |
|
3063 | 2. | |
3041 |
|
3064 | |||
3042 | \family typewriter |
|
3065 | \family typewriter | |
3043 | $HOME/.ipython/ipythonrc-math |
|
3066 | $HOME/.ipython/ipythonrc-math | |
3044 | \family default |
|
3067 | \family default | |
3045 | : load (1) and basic math-related modules. |
|
3068 | : load (1) and basic math-related modules. | |
3046 |
|
3069 | |||
3047 | \layout List |
|
3070 | \layout List | |
3048 | \labelwidthstring 00.00.0000 |
|
3071 | \labelwidthstring 00.00.0000 | |
3049 |
|
3072 | |||
3050 |
|
3073 | |||
3051 | \family typewriter |
|
3074 | \family typewriter | |
3052 | \SpecialChar ~ |
|
3075 | \SpecialChar ~ | |
3053 |
|
3076 | |||
3054 | \family default |
|
3077 | \family default | |
3055 | 3. |
|
3078 | 3. | |
3056 |
|
3079 | |||
3057 | \family typewriter |
|
3080 | \family typewriter | |
3058 | $HOME/.ipython/ipythonrc-numeric |
|
3081 | $HOME/.ipython/ipythonrc-numeric | |
3059 | \family default |
|
3082 | \family default | |
3060 | : load (1) and Numeric and plotting modules. |
|
3083 | : load (1) and Numeric and plotting modules. | |
3061 | \layout List |
|
3084 | \layout List | |
3062 | \labelwidthstring 00.00.0000 |
|
3085 | \labelwidthstring 00.00.0000 | |
3063 |
|
3086 | |||
3064 | \SpecialChar ~ |
|
3087 | \SpecialChar ~ | |
3065 | Since it is possible to create an endless loop by having circular file |
|
3088 | Since it is possible to create an endless loop by having circular file | |
3066 | inclusions, IPython will stop if it reaches 15 recursive inclusions. |
|
3089 | inclusions, IPython will stop if it reaches 15 recursive inclusions. | |
3067 | \layout List |
|
3090 | \layout List | |
3068 | \labelwidthstring 00.00.0000 |
|
3091 | \labelwidthstring 00.00.0000 | |
3069 |
|
3092 | |||
3070 |
|
3093 | |||
3071 | \family typewriter |
|
3094 | \family typewriter | |
3072 | \series bold |
|
3095 | \series bold | |
3073 | -prompt_in1|pi1\SpecialChar ~ |
|
3096 | -prompt_in1|pi1\SpecialChar ~ | |
3074 | <string>: |
|
3097 | <string>: | |
3075 | \family default |
|
3098 | \family default | |
3076 | \series default |
|
3099 | \series default | |
3077 | Specify the string used for input prompts. |
|
3100 | Specify the string used for input prompts. | |
3078 | Note that if you are using numbered prompts, the number is represented |
|
3101 | Note that if you are using numbered prompts, the number is represented | |
3079 | with a ' |
|
3102 | with a ' | |
3080 | \backslash |
|
3103 | \backslash | |
3081 | #' in the string. |
|
3104 | #' in the string. | |
3082 | Don't forget to quote strings with spaces embedded in them. |
|
3105 | Don't forget to quote strings with spaces embedded in them. | |
3083 | Default: ' |
|
3106 | Default: ' | |
3084 | \family typewriter |
|
3107 | \family typewriter | |
3085 | In\SpecialChar ~ |
|
3108 | In\SpecialChar ~ | |
3086 | [ |
|
3109 | [ | |
3087 | \backslash |
|
3110 | \backslash | |
3088 | #]: |
|
3111 | #]: | |
3089 | \family default |
|
3112 | \family default | |
3090 | '. |
|
3113 | '. | |
3091 | Sec.\SpecialChar ~ |
|
3114 | Sec.\SpecialChar ~ | |
3092 |
|
3115 | |||
3093 | \begin_inset LatexCommand \ref{sec:prompts} |
|
3116 | \begin_inset LatexCommand \ref{sec:prompts} | |
3094 |
|
3117 | |||
3095 | \end_inset |
|
3118 | \end_inset | |
3096 |
|
3119 | |||
3097 | discusses in detail all the available escapes to customize your prompts. |
|
3120 | discusses in detail all the available escapes to customize your prompts. | |
3098 | \layout List |
|
3121 | \layout List | |
3099 | \labelwidthstring 00.00.0000 |
|
3122 | \labelwidthstring 00.00.0000 | |
3100 |
|
3123 | |||
3101 |
|
3124 | |||
3102 | \family typewriter |
|
3125 | \family typewriter | |
3103 | \series bold |
|
3126 | \series bold | |
3104 | -prompt_in2|pi2\SpecialChar ~ |
|
3127 | -prompt_in2|pi2\SpecialChar ~ | |
3105 | <string>: |
|
3128 | <string>: | |
3106 | \family default |
|
3129 | \family default | |
3107 | \series default |
|
3130 | \series default | |
3108 | Similar to the previous option, but used for the continuation prompts. |
|
3131 | Similar to the previous option, but used for the continuation prompts. | |
3109 | The special sequence ' |
|
3132 | The special sequence ' | |
3110 | \family typewriter |
|
3133 | \family typewriter | |
3111 |
|
3134 | |||
3112 | \backslash |
|
3135 | \backslash | |
3113 | D |
|
3136 | D | |
3114 | \family default |
|
3137 | \family default | |
3115 | ' is similar to ' |
|
3138 | ' is similar to ' | |
3116 | \family typewriter |
|
3139 | \family typewriter | |
3117 |
|
3140 | |||
3118 | \backslash |
|
3141 | \backslash | |
3119 | # |
|
3142 | # | |
3120 | \family default |
|
3143 | \family default | |
3121 | ', but with all digits replaced dots (so you can have your continuation |
|
3144 | ', but with all digits replaced dots (so you can have your continuation | |
3122 | prompt aligned with your input prompt). |
|
3145 | prompt aligned with your input prompt). | |
3123 | Default: ' |
|
3146 | Default: ' | |
3124 | \family typewriter |
|
3147 | \family typewriter | |
3125 | \SpecialChar ~ |
|
3148 | \SpecialChar ~ | |
3126 | \SpecialChar ~ |
|
3149 | \SpecialChar ~ | |
3127 | \SpecialChar ~ |
|
3150 | \SpecialChar ~ | |
3128 | . |
|
3151 | . | |
3129 | \backslash |
|
3152 | \backslash | |
3130 | D.: |
|
3153 | D.: | |
3131 | \family default |
|
3154 | \family default | |
3132 | ' (note three spaces at the start for alignment with ' |
|
3155 | ' (note three spaces at the start for alignment with ' | |
3133 | \family typewriter |
|
3156 | \family typewriter | |
3134 | In\SpecialChar ~ |
|
3157 | In\SpecialChar ~ | |
3135 | [ |
|
3158 | [ | |
3136 | \backslash |
|
3159 | \backslash | |
3137 | #] |
|
3160 | #] | |
3138 | \family default |
|
3161 | \family default | |
3139 | '). |
|
3162 | '). | |
3140 | \layout List |
|
3163 | \layout List | |
3141 | \labelwidthstring 00.00.0000 |
|
3164 | \labelwidthstring 00.00.0000 | |
3142 |
|
3165 | |||
3143 |
|
3166 | |||
3144 | \family typewriter |
|
3167 | \family typewriter | |
3145 | \series bold |
|
3168 | \series bold | |
3146 | -prompt_out|po\SpecialChar ~ |
|
3169 | -prompt_out|po\SpecialChar ~ | |
3147 | <string>: |
|
3170 | <string>: | |
3148 | \family default |
|
3171 | \family default | |
3149 | \series default |
|
3172 | \series default | |
3150 | String used for output prompts, also uses numbers like |
|
3173 | String used for output prompts, also uses numbers like | |
3151 | \family typewriter |
|
3174 | \family typewriter | |
3152 | prompt_in1 |
|
3175 | prompt_in1 | |
3153 | \family default |
|
3176 | \family default | |
3154 | . |
|
3177 | . | |
3155 | Default: ' |
|
3178 | Default: ' | |
3156 | \family typewriter |
|
3179 | \family typewriter | |
3157 | Out[ |
|
3180 | Out[ | |
3158 | \backslash |
|
3181 | \backslash | |
3159 | #]: |
|
3182 | #]: | |
3160 | \family default |
|
3183 | \family default | |
3161 | ' |
|
3184 | ' | |
3162 | \layout List |
|
3185 | \layout List | |
3163 | \labelwidthstring 00.00.0000 |
|
3186 | \labelwidthstring 00.00.0000 | |
3164 |
|
3187 | |||
3165 |
|
3188 | |||
3166 | \family typewriter |
|
3189 | \family typewriter | |
3167 | \series bold |
|
3190 | \series bold | |
3168 | -quick |
|
3191 | -quick | |
3169 | \family default |
|
3192 | \family default | |
3170 | \series default |
|
3193 | \series default | |
3171 | : start in bare bones mode (no config file loaded). |
|
3194 | : start in bare bones mode (no config file loaded). | |
3172 | \layout List |
|
3195 | \layout List | |
3173 | \labelwidthstring 00.00.0000 |
|
3196 | \labelwidthstring 00.00.0000 | |
3174 |
|
3197 | |||
3175 |
|
3198 | |||
3176 | \family typewriter |
|
3199 | \family typewriter | |
3177 | \series bold |
|
3200 | \series bold | |
3178 | -rcfile\SpecialChar ~ |
|
3201 | -rcfile\SpecialChar ~ | |
3179 | <name> |
|
3202 | <name> | |
3180 | \series default |
|
3203 | \series default | |
3181 | : |
|
3204 | : | |
3182 | \family default |
|
3205 | \family default | |
3183 | name of your IPython resource configuration file. |
|
3206 | name of your IPython resource configuration file. | |
3184 | Normally IPython loads ipythonrc (from current directory) or |
|
3207 | Normally IPython loads ipythonrc (from current directory) or | |
3185 | \family typewriter |
|
3208 | \family typewriter | |
3186 | IPYTHONDIR/ipythonrc |
|
3209 | IPYTHONDIR/ipythonrc | |
3187 | \family default |
|
3210 | \family default | |
3188 | . |
|
3211 | . | |
3189 | \layout List |
|
3212 | \layout List | |
3190 | \labelwidthstring 00.00.0000 |
|
3213 | \labelwidthstring 00.00.0000 | |
3191 |
|
3214 | |||
3192 | \SpecialChar ~ |
|
3215 | \SpecialChar ~ | |
3193 | If the loading of your config file fails, IPython starts with a bare bones |
|
3216 | If the loading of your config file fails, IPython starts with a bare bones | |
3194 | configuration (no modules loaded at all). |
|
3217 | configuration (no modules loaded at all). | |
3195 | \layout List |
|
3218 | \layout List | |
3196 | \labelwidthstring 00.00.0000 |
|
3219 | \labelwidthstring 00.00.0000 | |
3197 |
|
3220 | |||
3198 |
|
3221 | |||
3199 | \family typewriter |
|
3222 | \family typewriter | |
3200 | \series bold |
|
3223 | \series bold | |
3201 | -no|readline |
|
3224 | -no|readline | |
3202 | \family default |
|
3225 | \family default | |
3203 | \series default |
|
3226 | \series default | |
3204 | : use the readline library, which is needed to support name completion and |
|
3227 | : use the readline library, which is needed to support name completion and | |
3205 | command history, among other things. |
|
3228 | command history, among other things. | |
3206 | It is enabled by default, but may cause problems for users of X/Emacs in |
|
3229 | It is enabled by default, but may cause problems for users of X/Emacs in | |
3207 | Python comint or shell buffers. |
|
3230 | Python comint or shell buffers. | |
3208 | \layout List |
|
3231 | \layout List | |
3209 | \labelwidthstring 00.00.0000 |
|
3232 | \labelwidthstring 00.00.0000 | |
3210 |
|
3233 | |||
3211 | \SpecialChar ~ |
|
3234 | \SpecialChar ~ | |
3212 | Note that X/Emacs 'eterm' buffers (opened with |
|
3235 | Note that X/Emacs 'eterm' buffers (opened with | |
3213 | \family typewriter |
|
3236 | \family typewriter | |
3214 | M-x\SpecialChar ~ |
|
3237 | M-x\SpecialChar ~ | |
3215 | term |
|
3238 | term | |
3216 | \family default |
|
3239 | \family default | |
3217 | ) support IPython's readline and syntax coloring fine, only 'emacs' ( |
|
3240 | ) support IPython's readline and syntax coloring fine, only 'emacs' ( | |
3218 | \family typewriter |
|
3241 | \family typewriter | |
3219 | M-x\SpecialChar ~ |
|
3242 | M-x\SpecialChar ~ | |
3220 | shell |
|
3243 | shell | |
3221 | \family default |
|
3244 | \family default | |
3222 | and |
|
3245 | and | |
3223 | \family typewriter |
|
3246 | \family typewriter | |
3224 | C-c\SpecialChar ~ |
|
3247 | C-c\SpecialChar ~ | |
3225 | ! |
|
3248 | ! | |
3226 | \family default |
|
3249 | \family default | |
3227 | ) buffers do not. |
|
3250 | ) buffers do not. | |
3228 | \layout List |
|
3251 | \layout List | |
3229 | \labelwidthstring 00.00.0000 |
|
3252 | \labelwidthstring 00.00.0000 | |
3230 |
|
3253 | |||
3231 |
|
3254 | |||
3232 | \family typewriter |
|
3255 | \family typewriter | |
3233 | \series bold |
|
3256 | \series bold | |
3234 | -screen_length|sl\SpecialChar ~ |
|
3257 | -screen_length|sl\SpecialChar ~ | |
3235 | <n> |
|
3258 | <n> | |
3236 | \series default |
|
3259 | \series default | |
3237 | : |
|
3260 | : | |
3238 | \family default |
|
3261 | \family default | |
3239 | number of lines of your screen. |
|
3262 | number of lines of your screen. | |
3240 | This is used to control printing of very long strings. |
|
3263 | This is used to control printing of very long strings. | |
3241 | Strings longer than this number of lines will be sent through a pager instead |
|
3264 | Strings longer than this number of lines will be sent through a pager instead | |
3242 | of directly printed. |
|
3265 | of directly printed. | |
3243 | \layout List |
|
3266 | \layout List | |
3244 | \labelwidthstring 00.00.0000 |
|
3267 | \labelwidthstring 00.00.0000 | |
3245 |
|
3268 | |||
3246 | \SpecialChar ~ |
|
3269 | \SpecialChar ~ | |
3247 | The default value for this is 0, which means IPython will auto-detect your |
|
3270 | The default value for this is 0, which means IPython will auto-detect your | |
3248 | screen size every time it needs to print certain potentially long strings |
|
3271 | screen size every time it needs to print certain potentially long strings | |
3249 | (this doesn't change the behavior of the 'print' keyword, it's only triggered |
|
3272 | (this doesn't change the behavior of the 'print' keyword, it's only triggered | |
3250 | internally). |
|
3273 | internally). | |
3251 | If for some reason this isn't working well (it needs curses support), specify |
|
3274 | If for some reason this isn't working well (it needs curses support), specify | |
3252 | it yourself. |
|
3275 | it yourself. | |
3253 | Otherwise don't change the default. |
|
3276 | Otherwise don't change the default. | |
3254 | \layout List |
|
3277 | \layout List | |
3255 | \labelwidthstring 00.00.0000 |
|
3278 | \labelwidthstring 00.00.0000 | |
3256 |
|
3279 | |||
3257 |
|
3280 | |||
3258 | \family typewriter |
|
3281 | \family typewriter | |
3259 | \series bold |
|
3282 | \series bold | |
3260 | -separate_in|si\SpecialChar ~ |
|
3283 | -separate_in|si\SpecialChar ~ | |
3261 | <string> |
|
3284 | <string> | |
3262 | \series default |
|
3285 | \series default | |
3263 | : |
|
3286 | : | |
3264 | \family default |
|
3287 | \family default | |
3265 | separator before input prompts. |
|
3288 | separator before input prompts. | |
3266 | Default: ' |
|
3289 | Default: ' | |
3267 | \family typewriter |
|
3290 | \family typewriter | |
3268 |
|
3291 | |||
3269 | \backslash |
|
3292 | \backslash | |
3270 | n |
|
3293 | n | |
3271 | \family default |
|
3294 | \family default | |
3272 | ' |
|
3295 | ' | |
3273 | \layout List |
|
3296 | \layout List | |
3274 | \labelwidthstring 00.00.0000 |
|
3297 | \labelwidthstring 00.00.0000 | |
3275 |
|
3298 | |||
3276 |
|
3299 | |||
3277 | \family typewriter |
|
3300 | \family typewriter | |
3278 | \series bold |
|
3301 | \series bold | |
3279 | -separate_out|so\SpecialChar ~ |
|
3302 | -separate_out|so\SpecialChar ~ | |
3280 | <string> |
|
3303 | <string> | |
3281 | \family default |
|
3304 | \family default | |
3282 | \series default |
|
3305 | \series default | |
3283 | : separator before output prompts. |
|
3306 | : separator before output prompts. | |
3284 | Default: nothing. |
|
3307 | Default: nothing. | |
3285 | \layout List |
|
3308 | \layout List | |
3286 | \labelwidthstring 00.00.0000 |
|
3309 | \labelwidthstring 00.00.0000 | |
3287 |
|
3310 | |||
3288 |
|
3311 | |||
3289 | \family typewriter |
|
3312 | \family typewriter | |
3290 | \series bold |
|
3313 | \series bold | |
3291 | -separate_out2|so2\SpecialChar ~ |
|
3314 | -separate_out2|so2\SpecialChar ~ | |
3292 | <string> |
|
3315 | <string> | |
3293 | \series default |
|
3316 | \series default | |
3294 | : |
|
3317 | : | |
3295 | \family default |
|
3318 | \family default | |
3296 | separator after output prompts. |
|
3319 | separator after output prompts. | |
3297 | Default: nothing. |
|
3320 | Default: nothing. | |
3298 | \layout List |
|
3321 | \layout List | |
3299 | \labelwidthstring 00.00.0000 |
|
3322 | \labelwidthstring 00.00.0000 | |
3300 |
|
3323 | |||
3301 | \SpecialChar ~ |
|
3324 | \SpecialChar ~ | |
3302 | For these three options, use the value 0 to specify no separator. |
|
3325 | For these three options, use the value 0 to specify no separator. | |
3303 | \layout List |
|
3326 | \layout List | |
3304 | \labelwidthstring 00.00.0000 |
|
3327 | \labelwidthstring 00.00.0000 | |
3305 |
|
3328 | |||
3306 |
|
3329 | |||
3307 | \family typewriter |
|
3330 | \family typewriter | |
3308 | \series bold |
|
3331 | \series bold | |
3309 | -nosep |
|
3332 | -nosep | |
3310 | \series default |
|
3333 | \series default | |
3311 | : |
|
3334 | : | |
3312 | \family default |
|
3335 | \family default | |
3313 | shorthand for |
|
3336 | shorthand for | |
3314 | \family typewriter |
|
3337 | \family typewriter | |
3315 | '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0' |
|
3338 | '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0' | |
3316 | \family default |
|
3339 | \family default | |
3317 | . |
|
3340 | . | |
3318 | Simply removes all input/output separators. |
|
3341 | Simply removes all input/output separators. | |
3319 | \layout List |
|
3342 | \layout List | |
3320 | \labelwidthstring 00.00.0000 |
|
3343 | \labelwidthstring 00.00.0000 | |
3321 |
|
3344 | |||
3322 |
|
3345 | |||
3323 | \family typewriter |
|
3346 | \family typewriter | |
3324 | \series bold |
|
3347 | \series bold | |
3325 | -upgrade |
|
3348 | -upgrade | |
3326 | \family default |
|
3349 | \family default | |
3327 | \series default |
|
3350 | \series default | |
3328 | : allows you to upgrade your |
|
3351 | : allows you to upgrade your | |
3329 | \family typewriter |
|
3352 | \family typewriter | |
3330 | IPYTHONDIR |
|
3353 | IPYTHONDIR | |
3331 | \family default |
|
3354 | \family default | |
3332 | configuration when you install a new version of IPython. |
|
3355 | configuration when you install a new version of IPython. | |
3333 | Since new versions may include new command line options or example files, |
|
3356 | Since new versions may include new command line options or example files, | |
3334 | this copies updated ipythonrc-type files. |
|
3357 | this copies updated ipythonrc-type files. | |
3335 | However, it backs up (with a |
|
3358 | However, it backs up (with a | |
3336 | \family typewriter |
|
3359 | \family typewriter | |
3337 | .old |
|
3360 | .old | |
3338 | \family default |
|
3361 | \family default | |
3339 | extension) all files which it overwrites so that you can merge back any |
|
3362 | extension) all files which it overwrites so that you can merge back any | |
3340 | customizations you might have in your personal files. |
|
3363 | customizations you might have in your personal files. | |
3341 | \layout List |
|
3364 | \layout List | |
3342 | \labelwidthstring 00.00.0000 |
|
3365 | \labelwidthstring 00.00.0000 | |
3343 |
|
3366 | |||
3344 |
|
3367 | |||
3345 | \family typewriter |
|
3368 | \family typewriter | |
3346 | \series bold |
|
3369 | \series bold | |
3347 | -Version |
|
3370 | -Version | |
3348 | \series default |
|
3371 | \series default | |
3349 | : |
|
3372 | : | |
3350 | \family default |
|
3373 | \family default | |
3351 | print version information and exit. |
|
3374 | print version information and exit. | |
3352 | \layout List |
|
3375 | \layout List | |
3353 | \labelwidthstring 00.00.0000 |
|
3376 | \labelwidthstring 00.00.0000 | |
3354 |
|
3377 | |||
3355 |
|
3378 | |||
3356 | \family typewriter |
|
3379 | \family typewriter | |
3357 | \series bold |
|
3380 | \series bold | |
3358 | -xmode <modename> |
|
3381 | -xmode <modename> | |
3359 | \series default |
|
3382 | \series default | |
3360 | : |
|
3383 | : | |
3361 | \family default |
|
3384 | \family default | |
3362 | Mode for exception reporting. |
|
3385 | Mode for exception reporting. | |
3363 | \layout List |
|
3386 | \layout List | |
3364 | \labelwidthstring 00.00.0000 |
|
3387 | \labelwidthstring 00.00.0000 | |
3365 |
|
3388 | |||
3366 | \SpecialChar ~ |
|
3389 | \SpecialChar ~ | |
3367 | Valid modes: Plain, Context and Verbose. |
|
3390 | Valid modes: Plain, Context and Verbose. | |
3368 | \layout List |
|
3391 | \layout List | |
3369 | \labelwidthstring 00.00.0000 |
|
3392 | \labelwidthstring 00.00.0000 | |
3370 |
|
3393 | |||
3371 | \SpecialChar ~ |
|
3394 | \SpecialChar ~ | |
3372 | Plain: similar to python's normal traceback printing. |
|
3395 | Plain: similar to python's normal traceback printing. | |
3373 | \layout List |
|
3396 | \layout List | |
3374 | \labelwidthstring 00.00.0000 |
|
3397 | \labelwidthstring 00.00.0000 | |
3375 |
|
3398 | |||
3376 | \SpecialChar ~ |
|
3399 | \SpecialChar ~ | |
3377 | Context: prints 5 lines of context source code around each line in the |
|
3400 | Context: prints 5 lines of context source code around each line in the | |
3378 | traceback. |
|
3401 | traceback. | |
3379 | \layout List |
|
3402 | \layout List | |
3380 | \labelwidthstring 00.00.0000 |
|
3403 | \labelwidthstring 00.00.0000 | |
3381 |
|
3404 | |||
3382 | \SpecialChar ~ |
|
3405 | \SpecialChar ~ | |
3383 | Verbose: similar to Context, but additionally prints the variables currently |
|
3406 | Verbose: similar to Context, but additionally prints the variables currently | |
3384 | visible where the exception happened (shortening their strings if too long). |
|
3407 | visible where the exception happened (shortening their strings if too long). | |
3385 | This can potentially be very slow, if you happen to have a huge data structure |
|
3408 | This can potentially be very slow, if you happen to have a huge data structure | |
3386 | whose string representation is complex to compute. |
|
3409 | whose string representation is complex to compute. | |
3387 | Your computer may appear to freeze for a while with cpu usage at 100%. |
|
3410 | Your computer may appear to freeze for a while with cpu usage at 100%. | |
3388 | If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting |
|
3411 | If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting | |
3389 | it more than once). |
|
3412 | it more than once). | |
3390 | \layout Section |
|
3413 | \layout Section | |
3391 |
|
3414 | |||
3392 | Interactive use |
|
3415 | Interactive use | |
3393 | \layout Standard |
|
3416 | \layout Standard | |
3394 |
|
3417 | |||
3395 |
|
3418 | |||
3396 | \series bold |
|
3419 | \series bold | |
3397 | Warning |
|
3420 | Warning | |
3398 | \series default |
|
3421 | \series default | |
3399 | : IPython relies on the existence of a global variable called |
|
3422 | : IPython relies on the existence of a global variable called | |
3400 | \family typewriter |
|
3423 | \family typewriter | |
3401 | __IP |
|
3424 | __IP | |
3402 | \family default |
|
3425 | \family default | |
3403 | which controls the shell itself. |
|
3426 | which controls the shell itself. | |
3404 | If you redefine |
|
3427 | If you redefine | |
3405 | \family typewriter |
|
3428 | \family typewriter | |
3406 | __IP |
|
3429 | __IP | |
3407 | \family default |
|
3430 | \family default | |
3408 | to anything, bizarre behavior will quickly occur. |
|
3431 | to anything, bizarre behavior will quickly occur. | |
3409 | \layout Standard |
|
3432 | \layout Standard | |
3410 |
|
3433 | |||
3411 | Other than the above warning, IPython is meant to work as a drop-in replacement |
|
3434 | Other than the above warning, IPython is meant to work as a drop-in replacement | |
3412 | for the standard interactive interpreter. |
|
3435 | for the standard interactive interpreter. | |
3413 | As such, any code which is valid python should execute normally under IPython |
|
3436 | As such, any code which is valid python should execute normally under IPython | |
3414 | (cases where this is not true should be reported as bugs). |
|
3437 | (cases where this is not true should be reported as bugs). | |
3415 | It does, however, offer many features which are not available at a standard |
|
3438 | It does, however, offer many features which are not available at a standard | |
3416 | python prompt. |
|
3439 | python prompt. | |
3417 | What follows is a list of these. |
|
3440 | What follows is a list of these. | |
3418 | \layout Subsection |
|
3441 | \layout Subsection | |
3419 |
|
3442 | |||
3420 | Caution for Windows users |
|
3443 | Caution for Windows users | |
3421 | \layout Standard |
|
3444 | \layout Standard | |
3422 |
|
3445 | |||
3423 | Windows, unfortunately, uses the ` |
|
3446 | Windows, unfortunately, uses the ` | |
3424 | \family typewriter |
|
3447 | \family typewriter | |
3425 |
|
3448 | |||
3426 | \backslash |
|
3449 | \backslash | |
3427 |
|
3450 | |||
3428 | \family default |
|
3451 | \family default | |
3429 | ' character as a path separator. |
|
3452 | ' character as a path separator. | |
3430 | This is a terrible choice, because ` |
|
3453 | This is a terrible choice, because ` | |
3431 | \family typewriter |
|
3454 | \family typewriter | |
3432 |
|
3455 | |||
3433 | \backslash |
|
3456 | \backslash | |
3434 |
|
3457 | |||
3435 | \family default |
|
3458 | \family default | |
3436 | ' also represents the escape character in most modern programming languages, |
|
3459 | ' also represents the escape character in most modern programming languages, | |
3437 | including Python. |
|
3460 | including Python. | |
3438 | For this reason, issuing many of the commands discussed below (especially |
|
3461 | For this reason, issuing many of the commands discussed below (especially | |
3439 | magics which affect the filesystem) with ` |
|
3462 | magics which affect the filesystem) with ` | |
3440 | \family typewriter |
|
3463 | \family typewriter | |
3441 |
|
3464 | |||
3442 | \backslash |
|
3465 | \backslash | |
3443 |
|
3466 | |||
3444 | \family default |
|
3467 | \family default | |
3445 | ' in them will cause strange errors. |
|
3468 | ' in them will cause strange errors. | |
3446 | \layout Standard |
|
3469 | \layout Standard | |
3447 |
|
3470 | |||
3448 | A partial solution is to use instead the ` |
|
3471 | A partial solution is to use instead the ` | |
3449 | \family typewriter |
|
3472 | \family typewriter | |
3450 | / |
|
3473 | / | |
3451 | \family default |
|
3474 | \family default | |
3452 | ' character as a path separator, which Windows recognizes in |
|
3475 | ' character as a path separator, which Windows recognizes in | |
3453 | \emph on |
|
3476 | \emph on | |
3454 | most |
|
3477 | most | |
3455 | \emph default |
|
3478 | \emph default | |
3456 | situations. |
|
3479 | situations. | |
3457 | However, in Windows commands ` |
|
3480 | However, in Windows commands ` | |
3458 | \family typewriter |
|
3481 | \family typewriter | |
3459 | / |
|
3482 | / | |
3460 | \family default |
|
3483 | \family default | |
3461 | ' flags options, so you can not use it for the root directory. |
|
3484 | ' flags options, so you can not use it for the root directory. | |
3462 | This means that paths beginning at the root must be typed in a contrived |
|
3485 | This means that paths beginning at the root must be typed in a contrived | |
3463 | manner like: |
|
3486 | manner like: | |
3464 | \newline |
|
3487 | \newline | |
3465 |
|
3488 | |||
3466 | \family typewriter |
|
3489 | \family typewriter | |
3467 | %copy |
|
3490 | %copy | |
3468 | \backslash |
|
3491 | \backslash | |
3469 | opt/foo/bar.txt |
|
3492 | opt/foo/bar.txt | |
3470 | \backslash |
|
3493 | \backslash | |
3471 | tmp |
|
3494 | tmp | |
3472 | \layout Standard |
|
3495 | \layout Standard | |
3473 |
|
3496 | |||
3474 | There is no sensible thing IPython can do to truly work around this flaw |
|
3497 | There is no sensible thing IPython can do to truly work around this flaw | |
3475 | in Windows |
|
3498 | in Windows | |
3476 | \begin_inset Foot |
|
3499 | \begin_inset Foot | |
3477 | collapsed true |
|
3500 | collapsed true | |
3478 |
|
3501 | |||
3479 | \layout Standard |
|
3502 | \layout Standard | |
3480 |
|
3503 | |||
3481 | If anyone comes up with a |
|
3504 | If anyone comes up with a | |
3482 | \emph on |
|
3505 | \emph on | |
3483 | clean |
|
3506 | clean | |
3484 | \emph default |
|
3507 | \emph default | |
3485 | solution which works consistently and does not negatively impact other |
|
3508 | solution which works consistently and does not negatively impact other | |
3486 | platforms at all, I'll gladly accept a patch. |
|
3509 | platforms at all, I'll gladly accept a patch. | |
3487 | \end_inset |
|
3510 | \end_inset | |
3488 |
|
3511 | |||
3489 | . |
|
3512 | . | |
3490 | \layout Subsection |
|
3513 | \layout Subsection | |
3491 |
|
3514 | |||
3492 |
|
3515 | |||
3493 | \begin_inset LatexCommand \label{sec:magic} |
|
3516 | \begin_inset LatexCommand \label{sec:magic} | |
3494 |
|
3517 | |||
3495 | \end_inset |
|
3518 | \end_inset | |
3496 |
|
3519 | |||
3497 | Magic command system |
|
3520 | Magic command system | |
3498 | \layout Standard |
|
3521 | \layout Standard | |
3499 |
|
3522 | |||
3500 | IPython will treat any line whose first character is a |
|
3523 | IPython will treat any line whose first character is a | |
3501 | \family typewriter |
|
3524 | \family typewriter | |
3502 | % |
|
3525 | % | |
3503 | \family default |
|
3526 | \family default | |
3504 | as a special call to a 'magic' function. |
|
3527 | as a special call to a 'magic' function. | |
3505 | These allow you to control the behavior of IPython itself, plus a lot of |
|
3528 | These allow you to control the behavior of IPython itself, plus a lot of | |
3506 | system-type features. |
|
3529 | system-type features. | |
3507 | They are all prefixed with a |
|
3530 | They are all prefixed with a | |
3508 | \family typewriter |
|
3531 | \family typewriter | |
3509 | % |
|
3532 | % | |
3510 | \family default |
|
3533 | \family default | |
3511 | character, but parameters are given without parentheses or quotes. |
|
3534 | character, but parameters are given without parentheses or quotes. | |
3512 | \layout Standard |
|
3535 | \layout Standard | |
3513 |
|
3536 | |||
3514 | Example: typing |
|
3537 | Example: typing | |
3515 | \family typewriter |
|
3538 | \family typewriter | |
3516 | '%cd mydir' |
|
3539 | '%cd mydir' | |
3517 | \family default |
|
3540 | \family default | |
3518 | (without the quotes) changes you working directory to |
|
3541 | (without the quotes) changes you working directory to | |
3519 | \family typewriter |
|
3542 | \family typewriter | |
3520 | 'mydir' |
|
3543 | 'mydir' | |
3521 | \family default |
|
3544 | \family default | |
3522 | , if it exists. |
|
3545 | , if it exists. | |
3523 | \layout Standard |
|
3546 | \layout Standard | |
3524 |
|
3547 | |||
3525 | If you have 'automagic' enabled (in your |
|
3548 | If you have 'automagic' enabled (in your | |
3526 | \family typewriter |
|
3549 | \family typewriter | |
3527 | ipythonrc |
|
3550 | ipythonrc | |
3528 | \family default |
|
3551 | \family default | |
3529 | file, via the command line option |
|
3552 | file, via the command line option | |
3530 | \family typewriter |
|
3553 | \family typewriter | |
3531 | -automagic |
|
3554 | -automagic | |
3532 | \family default |
|
3555 | \family default | |
3533 | or with the |
|
3556 | or with the | |
3534 | \family typewriter |
|
3557 | \family typewriter | |
3535 | %automagic |
|
3558 | %automagic | |
3536 | \family default |
|
3559 | \family default | |
3537 | function), you don't need to type in the |
|
3560 | function), you don't need to type in the | |
3538 | \family typewriter |
|
3561 | \family typewriter | |
3539 | % |
|
3562 | % | |
3540 | \family default |
|
3563 | \family default | |
3541 | explicitly. |
|
3564 | explicitly. | |
3542 | IPython will scan its internal list of magic functions and call one if |
|
3565 | IPython will scan its internal list of magic functions and call one if | |
3543 | it exists. |
|
3566 | it exists. | |
3544 | With automagic on you can then just type ' |
|
3567 | With automagic on you can then just type ' | |
3545 | \family typewriter |
|
3568 | \family typewriter | |
3546 | cd mydir |
|
3569 | cd mydir | |
3547 | \family default |
|
3570 | \family default | |
3548 | ' to go to directory ' |
|
3571 | ' to go to directory ' | |
3549 | \family typewriter |
|
3572 | \family typewriter | |
3550 | mydir |
|
3573 | mydir | |
3551 | \family default |
|
3574 | \family default | |
3552 | '. |
|
3575 | '. | |
3553 | The automagic system has the lowest possible precedence in name searches, |
|
3576 | The automagic system has the lowest possible precedence in name searches, | |
3554 | so defining an identifier with the same name as an existing magic function |
|
3577 | so defining an identifier with the same name as an existing magic function | |
3555 | will shadow it for automagic use. |
|
3578 | will shadow it for automagic use. | |
3556 | You can still access the shadowed magic function by explicitly using the |
|
3579 | You can still access the shadowed magic function by explicitly using the | |
3557 |
|
3580 | |||
3558 | \family typewriter |
|
3581 | \family typewriter | |
3559 | % |
|
3582 | % | |
3560 | \family default |
|
3583 | \family default | |
3561 | character at the beginning of the line. |
|
3584 | character at the beginning of the line. | |
3562 | \layout Standard |
|
3585 | \layout Standard | |
3563 |
|
3586 | |||
3564 | An example (with automagic on) should clarify all this: |
|
3587 | An example (with automagic on) should clarify all this: | |
3565 | \layout LyX-Code |
|
3588 | \layout LyX-Code | |
3566 |
|
3589 | |||
3567 | In [1]: cd ipython # %cd is called by automagic |
|
3590 | In [1]: cd ipython # %cd is called by automagic | |
3568 | \layout LyX-Code |
|
3591 | \layout LyX-Code | |
3569 |
|
3592 | |||
3570 | /home/fperez/ipython |
|
3593 | /home/fperez/ipython | |
3571 | \layout LyX-Code |
|
3594 | \layout LyX-Code | |
3572 |
|
3595 | |||
3573 | In [2]: cd=1 # now cd is just a variable |
|
3596 | In [2]: cd=1 # now cd is just a variable | |
3574 | \layout LyX-Code |
|
3597 | \layout LyX-Code | |
3575 |
|
3598 | |||
3576 | In [3]: cd .. |
|
3599 | In [3]: cd .. | |
3577 | # and doesn't work as a function anymore |
|
3600 | # and doesn't work as a function anymore | |
3578 | \layout LyX-Code |
|
3601 | \layout LyX-Code | |
3579 |
|
3602 | |||
3580 | ------------------------------------------------------------ |
|
3603 | ------------------------------------------------------------ | |
3581 | \layout LyX-Code |
|
3604 | \layout LyX-Code | |
3582 |
|
3605 | |||
3583 | File "<console>", line 1 |
|
3606 | File "<console>", line 1 | |
3584 | \layout LyX-Code |
|
3607 | \layout LyX-Code | |
3585 |
|
3608 | |||
3586 | cd .. |
|
3609 | cd .. | |
3587 | \layout LyX-Code |
|
3610 | \layout LyX-Code | |
3588 |
|
3611 | |||
3589 | ^ |
|
3612 | ^ | |
3590 | \layout LyX-Code |
|
3613 | \layout LyX-Code | |
3591 |
|
3614 | |||
3592 | SyntaxError: invalid syntax |
|
3615 | SyntaxError: invalid syntax | |
3593 | \layout LyX-Code |
|
3616 | \layout LyX-Code | |
3594 |
|
3617 | |||
3595 | \layout LyX-Code |
|
3618 | \layout LyX-Code | |
3596 |
|
3619 | |||
3597 | In [4]: %cd .. |
|
3620 | In [4]: %cd .. | |
3598 | # but %cd always works |
|
3621 | # but %cd always works | |
3599 | \layout LyX-Code |
|
3622 | \layout LyX-Code | |
3600 |
|
3623 | |||
3601 | /home/fperez |
|
3624 | /home/fperez | |
3602 | \layout LyX-Code |
|
3625 | \layout LyX-Code | |
3603 |
|
3626 | |||
3604 | In [5]: del cd # if you remove the cd variable |
|
3627 | In [5]: del cd # if you remove the cd variable | |
3605 | \layout LyX-Code |
|
3628 | \layout LyX-Code | |
3606 |
|
3629 | |||
3607 | In [6]: cd ipython # automagic can work again |
|
3630 | In [6]: cd ipython # automagic can work again | |
3608 | \layout LyX-Code |
|
3631 | \layout LyX-Code | |
3609 |
|
3632 | |||
3610 | /home/fperez/ipython |
|
3633 | /home/fperez/ipython | |
3611 | \layout Standard |
|
3634 | \layout Standard | |
3612 |
|
3635 | |||
3613 | You can define your own magic functions to extend the system. |
|
3636 | You can define your own magic functions to extend the system. | |
3614 | The following is a snippet of code which shows how to do it. |
|
3637 | The following is a snippet of code which shows how to do it. | |
3615 | It is provided as file |
|
3638 | It is provided as file | |
3616 | \family typewriter |
|
3639 | \family typewriter | |
3617 | example-magic.py |
|
3640 | example-magic.py | |
3618 | \family default |
|
3641 | \family default | |
3619 | in the examples directory: |
|
3642 | in the examples directory: | |
3620 | \layout Standard |
|
3643 | \layout Standard | |
3621 |
|
3644 | |||
3622 |
|
3645 | |||
3623 | \begin_inset ERT |
|
3646 | \begin_inset ERT | |
3624 | status Open |
|
3647 | status Open | |
3625 |
|
3648 | |||
3626 | \layout Standard |
|
3649 | \layout Standard | |
3627 |
|
3650 | |||
3628 | \backslash |
|
3651 | \backslash | |
3629 |
|
|
3652 | codelist{examples/example-magic.py} | |
3630 | \end_inset |
|
3653 | \end_inset | |
3631 |
|
3654 | |||
3632 |
|
3655 | |||
3633 | \layout Standard |
|
3656 | \layout Standard | |
3634 |
|
3657 | |||
3635 | You can also define your own aliased names for magic functions. |
|
3658 | You can also define your own aliased names for magic functions. | |
3636 | In your |
|
3659 | In your | |
3637 | \family typewriter |
|
3660 | \family typewriter | |
3638 | ipythonrc |
|
3661 | ipythonrc | |
3639 | \family default |
|
3662 | \family default | |
3640 | file, placing a line like: |
|
3663 | file, placing a line like: | |
3641 | \layout Standard |
|
3664 | \layout Standard | |
3642 |
|
3665 | |||
3643 |
|
3666 | |||
3644 | \family typewriter |
|
3667 | \family typewriter | |
3645 | execute __IP.magic_cl = __IP.magic_clear |
|
3668 | execute __IP.magic_cl = __IP.magic_clear | |
3646 | \layout Standard |
|
3669 | \layout Standard | |
3647 |
|
3670 | |||
3648 | will define |
|
3671 | will define | |
3649 | \family typewriter |
|
3672 | \family typewriter | |
3650 | %cl |
|
3673 | %cl | |
3651 | \family default |
|
3674 | \family default | |
3652 | as a new name for |
|
3675 | as a new name for | |
3653 | \family typewriter |
|
3676 | \family typewriter | |
3654 | %clear |
|
3677 | %clear | |
3655 | \family default |
|
3678 | \family default | |
3656 | . |
|
3679 | . | |
3657 | \layout Standard |
|
3680 | \layout Standard | |
3658 |
|
3681 | |||
3659 | Type |
|
3682 | Type | |
3660 | \family typewriter |
|
3683 | \family typewriter | |
3661 | %magic |
|
3684 | %magic | |
3662 | \family default |
|
3685 | \family default | |
3663 | for more information, including a list of all available magic functions |
|
3686 | for more information, including a list of all available magic functions | |
3664 | at any time and their docstrings. |
|
3687 | at any time and their docstrings. | |
3665 | You can also type |
|
3688 | You can also type | |
3666 | \family typewriter |
|
3689 | \family typewriter | |
3667 | %magic_function_name? |
|
3690 | %magic_function_name? | |
3668 | \family default |
|
3691 | \family default | |
3669 | (see sec. |
|
3692 | (see sec. | |
3670 |
|
3693 | |||
3671 | \begin_inset LatexCommand \ref{sec:dyn-object-info} |
|
3694 | \begin_inset LatexCommand \ref{sec:dyn-object-info} | |
3672 |
|
3695 | |||
3673 | \end_inset |
|
3696 | \end_inset | |
3674 |
|
3697 | |||
3675 | for information on the |
|
3698 | for information on the | |
3676 | \family typewriter |
|
3699 | \family typewriter | |
3677 | '?' |
|
3700 | '?' | |
3678 | \family default |
|
3701 | \family default | |
3679 | system) to get information about any particular magic function you are |
|
3702 | system) to get information about any particular magic function you are | |
3680 | interested in. |
|
3703 | interested in. | |
3681 | \layout Subsubsection |
|
3704 | \layout Subsubsection | |
3682 |
|
3705 | |||
3683 | Magic commands |
|
3706 | Magic commands | |
3684 | \layout Standard |
|
3707 | \layout Standard | |
3685 |
|
3708 | |||
3686 | The rest of this section is automatically generated for each release from |
|
3709 | The rest of this section is automatically generated for each release from | |
3687 | the docstrings in the IPython code. |
|
3710 | the docstrings in the IPython code. | |
3688 | Therefore the formatting is somewhat minimal, but this method has the advantage |
|
3711 | Therefore the formatting is somewhat minimal, but this method has the advantage | |
3689 | of having information always in sync with the code. |
|
3712 | of having information always in sync with the code. | |
3690 | \layout Standard |
|
3713 | \layout Standard | |
3691 |
|
3714 | |||
3692 | A list of all the magic commands available in IPython's |
|
3715 | A list of all the magic commands available in IPython's | |
3693 | \emph on |
|
3716 | \emph on | |
3694 | default |
|
3717 | default | |
3695 | \emph default |
|
3718 | \emph default | |
3696 | installation follows. |
|
3719 | installation follows. | |
3697 | This is similar to what you'll see by simply typing |
|
3720 | This is similar to what you'll see by simply typing | |
3698 | \family typewriter |
|
3721 | \family typewriter | |
3699 | %magic |
|
3722 | %magic | |
3700 | \family default |
|
3723 | \family default | |
3701 | at the prompt, but that will also give you information about magic commands |
|
3724 | at the prompt, but that will also give you information about magic commands | |
3702 | you may have added as part of your personal customizations. |
|
3725 | you may have added as part of your personal customizations. | |
3703 | \layout Standard |
|
3726 | \layout Standard | |
3704 |
|
3727 | |||
3705 |
|
3728 | |||
3706 | \begin_inset Include \input{magic.tex} |
|
3729 | \begin_inset Include \input{magic.tex} | |
3707 | preview false |
|
3730 | preview false | |
3708 |
|
3731 | |||
3709 | \end_inset |
|
3732 | \end_inset | |
3710 |
|
3733 | |||
3711 |
|
3734 | |||
3712 | \layout Subsection |
|
3735 | \layout Subsection | |
3713 |
|
3736 | |||
3714 | Access to the standard Python help |
|
3737 | Access to the standard Python help | |
3715 | \layout Standard |
|
3738 | \layout Standard | |
3716 |
|
3739 | |||
3717 | As of Python 2.1, a help system is available with access to object docstrings |
|
3740 | As of Python 2.1, a help system is available with access to object docstrings | |
3718 | and the Python manuals. |
|
3741 | and the Python manuals. | |
3719 | Simply type |
|
3742 | Simply type | |
3720 | \family typewriter |
|
3743 | \family typewriter | |
3721 | 'help' |
|
3744 | 'help' | |
3722 | \family default |
|
3745 | \family default | |
3723 | (no quotes) to access it. |
|
3746 | (no quotes) to access it. | |
3724 | You can also type |
|
3747 | You can also type | |
3725 | \family typewriter |
|
3748 | \family typewriter | |
3726 | help(object) |
|
3749 | help(object) | |
3727 | \family default |
|
3750 | \family default | |
3728 | to obtain information about a given object, and |
|
3751 | to obtain information about a given object, and | |
3729 | \family typewriter |
|
3752 | \family typewriter | |
3730 | help('keyword') |
|
3753 | help('keyword') | |
3731 | \family default |
|
3754 | \family default | |
3732 | for information on a keyword. |
|
3755 | for information on a keyword. | |
3733 | As noted in sec. |
|
3756 | As noted in sec. | |
3734 |
|
3757 | |||
3735 | \begin_inset LatexCommand \ref{sec:help-access} |
|
3758 | \begin_inset LatexCommand \ref{sec:help-access} | |
3736 |
|
3759 | |||
3737 | \end_inset |
|
3760 | \end_inset | |
3738 |
|
3761 | |||
3739 | , you need to properly configure your environment variable |
|
3762 | , you need to properly configure your environment variable | |
3740 | \family typewriter |
|
3763 | \family typewriter | |
3741 | PYTHONDOCS |
|
3764 | PYTHONDOCS | |
3742 | \family default |
|
3765 | \family default | |
3743 | for this feature to work correctly. |
|
3766 | for this feature to work correctly. | |
3744 | \layout Subsection |
|
3767 | \layout Subsection | |
3745 |
|
3768 | |||
3746 |
|
3769 | |||
3747 | \begin_inset LatexCommand \label{sec:dyn-object-info} |
|
3770 | \begin_inset LatexCommand \label{sec:dyn-object-info} | |
3748 |
|
3771 | |||
3749 | \end_inset |
|
3772 | \end_inset | |
3750 |
|
3773 | |||
3751 | Dynamic object information |
|
3774 | Dynamic object information | |
3752 | \layout Standard |
|
3775 | \layout Standard | |
3753 |
|
3776 | |||
3754 | Typing |
|
3777 | Typing | |
3755 | \family typewriter |
|
3778 | \family typewriter | |
3756 | ?word |
|
3779 | ?word | |
3757 | \family default |
|
3780 | \family default | |
3758 | or |
|
3781 | or | |
3759 | \family typewriter |
|
3782 | \family typewriter | |
3760 | word? |
|
3783 | word? | |
3761 | \family default |
|
3784 | \family default | |
3762 | prints detailed information about an object. |
|
3785 | prints detailed information about an object. | |
3763 | If certain strings in the object are too long (docstrings, code, etc.) they |
|
3786 | If certain strings in the object are too long (docstrings, code, etc.) they | |
3764 | get snipped in the center for brevity. |
|
3787 | get snipped in the center for brevity. | |
3765 | This system gives access variable types and values, full source code for |
|
3788 | This system gives access variable types and values, full source code for | |
3766 | any object (if available), function prototypes and other useful information. |
|
3789 | any object (if available), function prototypes and other useful information. | |
3767 | \layout Standard |
|
3790 | \layout Standard | |
3768 |
|
3791 | |||
3769 | Typing |
|
3792 | Typing | |
3770 | \family typewriter |
|
3793 | \family typewriter | |
3771 | ??word |
|
3794 | ??word | |
3772 | \family default |
|
3795 | \family default | |
3773 | or |
|
3796 | or | |
3774 | \family typewriter |
|
3797 | \family typewriter | |
3775 | word?? |
|
3798 | word?? | |
3776 | \family default |
|
3799 | \family default | |
3777 | gives access to the full information without snipping long strings. |
|
3800 | gives access to the full information without snipping long strings. | |
3778 | Long strings are sent to the screen through the |
|
3801 | Long strings are sent to the screen through the | |
3779 | \family typewriter |
|
3802 | \family typewriter | |
3780 | less |
|
3803 | less | |
3781 | \family default |
|
3804 | \family default | |
3782 | pager if longer than the screen and printed otherwise. |
|
3805 | pager if longer than the screen and printed otherwise. | |
3783 | On systems lacking the |
|
3806 | On systems lacking the | |
3784 | \family typewriter |
|
3807 | \family typewriter | |
3785 | less |
|
3808 | less | |
3786 | \family default |
|
3809 | \family default | |
3787 | command, IPython uses a very basic internal pager. |
|
3810 | command, IPython uses a very basic internal pager. | |
3788 | \layout Standard |
|
3811 | \layout Standard | |
3789 |
|
3812 | |||
3790 | The following magic functions are particularly useful for gathering information |
|
3813 | The following magic functions are particularly useful for gathering information | |
3791 | about your working environment. |
|
3814 | about your working environment. | |
3792 | You can get more details by typing |
|
3815 | You can get more details by typing | |
3793 | \family typewriter |
|
3816 | \family typewriter | |
3794 | %magic |
|
3817 | %magic | |
3795 | \family default |
|
3818 | \family default | |
3796 | or querying them individually (use |
|
3819 | or querying them individually (use | |
3797 | \family typewriter |
|
3820 | \family typewriter | |
3798 | %function_name? |
|
3821 | %function_name? | |
3799 | \family default |
|
3822 | \family default | |
3800 | with or without the |
|
3823 | with or without the | |
3801 | \family typewriter |
|
3824 | \family typewriter | |
3802 | % |
|
3825 | % | |
3803 | \family default |
|
3826 | \family default | |
3804 | ), this is just a summary: |
|
3827 | ), this is just a summary: | |
3805 | \layout List |
|
3828 | \layout List | |
3806 | \labelwidthstring 00.00.0000 |
|
3829 | \labelwidthstring 00.00.0000 | |
3807 |
|
3830 | |||
3808 |
|
3831 | |||
3809 | \family typewriter |
|
3832 | \family typewriter | |
3810 | \series bold |
|
3833 | \series bold | |
3811 | %pdoc\SpecialChar ~ |
|
3834 | %pdoc\SpecialChar ~ | |
3812 | <object> |
|
3835 | <object> | |
3813 | \family default |
|
3836 | \family default | |
3814 | \series default |
|
3837 | \series default | |
3815 | : Print (or run through a pager if too long) the docstring for an object. |
|
3838 | : Print (or run through a pager if too long) the docstring for an object. | |
3816 | If the given object is a class, it will print both the class and the constructo |
|
3839 | If the given object is a class, it will print both the class and the constructo | |
3817 | r docstrings. |
|
3840 | r docstrings. | |
3818 | \layout List |
|
3841 | \layout List | |
3819 | \labelwidthstring 00.00.0000 |
|
3842 | \labelwidthstring 00.00.0000 | |
3820 |
|
3843 | |||
3821 |
|
3844 | |||
3822 | \family typewriter |
|
3845 | \family typewriter | |
3823 | \series bold |
|
3846 | \series bold | |
3824 | %pdef\SpecialChar ~ |
|
3847 | %pdef\SpecialChar ~ | |
3825 | <object> |
|
3848 | <object> | |
3826 | \family default |
|
3849 | \family default | |
3827 | \series default |
|
3850 | \series default | |
3828 | : Print the definition header for any callable object. |
|
3851 | : Print the definition header for any callable object. | |
3829 | If the object is a class, print the constructor information. |
|
3852 | If the object is a class, print the constructor information. | |
3830 | \layout List |
|
3853 | \layout List | |
3831 | \labelwidthstring 00.00.0000 |
|
3854 | \labelwidthstring 00.00.0000 | |
3832 |
|
3855 | |||
3833 |
|
3856 | |||
3834 | \family typewriter |
|
3857 | \family typewriter | |
3835 | \series bold |
|
3858 | \series bold | |
3836 | %psource\SpecialChar ~ |
|
3859 | %psource\SpecialChar ~ | |
3837 | <object> |
|
3860 | <object> | |
3838 | \family default |
|
3861 | \family default | |
3839 | \series default |
|
3862 | \series default | |
3840 | : Print (or run through a pager if too long) the source code for an object. |
|
3863 | : Print (or run through a pager if too long) the source code for an object. | |
3841 | \layout List |
|
3864 | \layout List | |
3842 | \labelwidthstring 00.00.0000 |
|
3865 | \labelwidthstring 00.00.0000 | |
3843 |
|
3866 | |||
3844 |
|
3867 | |||
3845 | \family typewriter |
|
3868 | \family typewriter | |
3846 | \series bold |
|
3869 | \series bold | |
3847 | %pfile\SpecialChar ~ |
|
3870 | %pfile\SpecialChar ~ | |
3848 | <object> |
|
3871 | <object> | |
3849 | \family default |
|
3872 | \family default | |
3850 | \series default |
|
3873 | \series default | |
3851 | : Show the entire source file where an object was defined via a pager, opening |
|
3874 | : Show the entire source file where an object was defined via a pager, opening | |
3852 | it at the line where the object definition begins. |
|
3875 | it at the line where the object definition begins. | |
3853 | \layout List |
|
3876 | \layout List | |
3854 | \labelwidthstring 00.00.0000 |
|
3877 | \labelwidthstring 00.00.0000 | |
3855 |
|
3878 | |||
3856 |
|
3879 | |||
3857 | \family typewriter |
|
3880 | \family typewriter | |
3858 | \series bold |
|
3881 | \series bold | |
3859 | %who/%whos |
|
3882 | %who/%whos | |
3860 | \family default |
|
3883 | \family default | |
3861 | \series default |
|
3884 | \series default | |
3862 | : These functions give information about identifiers you have defined interactiv |
|
3885 | : These functions give information about identifiers you have defined interactiv | |
3863 | ely (not things you loaded or defined in your configuration files). |
|
3886 | ely (not things you loaded or defined in your configuration files). | |
3864 |
|
3887 | |||
3865 | \family typewriter |
|
3888 | \family typewriter | |
3866 | %who |
|
3889 | %who | |
3867 | \family default |
|
3890 | \family default | |
3868 | just prints a list of identifiers and |
|
3891 | just prints a list of identifiers and | |
3869 | \family typewriter |
|
3892 | \family typewriter | |
3870 | %whos |
|
3893 | %whos | |
3871 | \family default |
|
3894 | \family default | |
3872 | prints a table with some basic details about each identifier. |
|
3895 | prints a table with some basic details about each identifier. | |
3873 | \layout Standard |
|
3896 | \layout Standard | |
3874 |
|
3897 | |||
3875 | Note that the dynamic object information functions ( |
|
3898 | Note that the dynamic object information functions ( | |
3876 | \family typewriter |
|
3899 | \family typewriter | |
3877 | ?/??, %pdoc, %pfile, %pdef, %psource |
|
3900 | ?/??, %pdoc, %pfile, %pdef, %psource | |
3878 | \family default |
|
3901 | \family default | |
3879 | ) give you access to documentation even on things which are not really defined |
|
3902 | ) give you access to documentation even on things which are not really defined | |
3880 | as separate identifiers. |
|
3903 | as separate identifiers. | |
3881 | Try for example typing |
|
3904 | Try for example typing | |
3882 | \family typewriter |
|
3905 | \family typewriter | |
3883 | {}.get? |
|
3906 | {}.get? | |
3884 | \family default |
|
3907 | \family default | |
3885 | or after doing |
|
3908 | or after doing | |
3886 | \family typewriter |
|
3909 | \family typewriter | |
3887 | import os |
|
3910 | import os | |
3888 | \family default |
|
3911 | \family default | |
3889 | , type |
|
3912 | , type | |
3890 | \family typewriter |
|
3913 | \family typewriter | |
3891 | os.path.abspath?? |
|
3914 | os.path.abspath?? | |
3892 | \family default |
|
3915 | \family default | |
3893 | . |
|
3916 | . | |
3894 | \layout Subsection |
|
3917 | \layout Subsection | |
3895 |
|
3918 | |||
3896 |
|
3919 | |||
3897 | \begin_inset LatexCommand \label{sec:readline} |
|
3920 | \begin_inset LatexCommand \label{sec:readline} | |
3898 |
|
3921 | |||
3899 | \end_inset |
|
3922 | \end_inset | |
3900 |
|
3923 | |||
3901 | Readline-based features |
|
3924 | Readline-based features | |
3902 | \layout Standard |
|
3925 | \layout Standard | |
3903 |
|
3926 | |||
3904 | These features require the GNU readline library, so they won't work if your |
|
3927 | These features require the GNU readline library, so they won't work if your | |
3905 | Python installation lacks readline support. |
|
3928 | Python installation lacks readline support. | |
3906 | We will first describe the default behavior IPython uses, and then how |
|
3929 | We will first describe the default behavior IPython uses, and then how | |
3907 | to change it to suit your preferences. |
|
3930 | to change it to suit your preferences. | |
3908 | \layout Subsubsection |
|
3931 | \layout Subsubsection | |
3909 |
|
3932 | |||
3910 | Command line completion |
|
3933 | Command line completion | |
3911 | \layout Standard |
|
3934 | \layout Standard | |
3912 |
|
3935 | |||
3913 | At any time, hitting TAB will complete any available python commands or |
|
3936 | At any time, hitting TAB will complete any available python commands or | |
3914 | variable names, and show you a list of the possible completions if there's |
|
3937 | variable names, and show you a list of the possible completions if there's | |
3915 | no unambiguous one. |
|
3938 | no unambiguous one. | |
3916 | It will also complete filenames in the current directory if no python names |
|
3939 | It will also complete filenames in the current directory if no python names | |
3917 | match what you've typed so far. |
|
3940 | match what you've typed so far. | |
3918 | \layout Subsubsection |
|
3941 | \layout Subsubsection | |
3919 |
|
3942 | |||
3920 | Search command history |
|
3943 | Search command history | |
3921 | \layout Standard |
|
3944 | \layout Standard | |
3922 |
|
3945 | |||
3923 | IPython provides two ways for searching through previous input and thus |
|
3946 | IPython provides two ways for searching through previous input and thus | |
3924 | reduce the need for repetitive typing: |
|
3947 | reduce the need for repetitive typing: | |
3925 | \layout Enumerate |
|
3948 | \layout Enumerate | |
3926 |
|
3949 | |||
3927 | Start typing, and then use |
|
3950 | Start typing, and then use | |
3928 | \family typewriter |
|
3951 | \family typewriter | |
3929 | Ctrl-p |
|
3952 | Ctrl-p | |
3930 | \family default |
|
3953 | \family default | |
3931 | (previous,up) and |
|
3954 | (previous,up) and | |
3932 | \family typewriter |
|
3955 | \family typewriter | |
3933 | Ctrl-n |
|
3956 | Ctrl-n | |
3934 | \family default |
|
3957 | \family default | |
3935 | (next,down) to search through only the history items that match what you've |
|
3958 | (next,down) to search through only the history items that match what you've | |
3936 | typed so far. |
|
3959 | typed so far. | |
3937 | If you use |
|
3960 | If you use | |
3938 | \family typewriter |
|
3961 | \family typewriter | |
3939 | Ctrl-p/Ctrl-n |
|
3962 | Ctrl-p/Ctrl-n | |
3940 | \family default |
|
3963 | \family default | |
3941 | at a blank prompt, they just behave like normal arrow keys. |
|
3964 | at a blank prompt, they just behave like normal arrow keys. | |
3942 | \layout Enumerate |
|
3965 | \layout Enumerate | |
3943 |
|
3966 | |||
3944 | Hit |
|
3967 | Hit | |
3945 | \family typewriter |
|
3968 | \family typewriter | |
3946 | Ctrl-r |
|
3969 | Ctrl-r | |
3947 | \family default |
|
3970 | \family default | |
3948 | : opens a search prompt. |
|
3971 | : opens a search prompt. | |
3949 | Begin typing and the system searches your history for lines that contain |
|
3972 | Begin typing and the system searches your history for lines that contain | |
3950 | what you've typed so far, completing as much as it can. |
|
3973 | what you've typed so far, completing as much as it can. | |
3951 | \layout Subsubsection |
|
3974 | \layout Subsubsection | |
3952 |
|
3975 | |||
3953 | Persistent command history across sessions |
|
3976 | Persistent command history across sessions | |
3954 | \layout Standard |
|
3977 | \layout Standard | |
3955 |
|
3978 | |||
3956 | IPython will save your input history when it leaves and reload it next time |
|
3979 | IPython will save your input history when it leaves and reload it next time | |
3957 | you restart it. |
|
3980 | you restart it. | |
3958 | By default, the history file is named |
|
3981 | By default, the history file is named | |
3959 | \family typewriter |
|
3982 | \family typewriter | |
3960 | $IPYTHONDIR/history |
|
3983 | $IPYTHONDIR/history | |
3961 | \family default |
|
3984 | \family default | |
3962 | , but if you've loaded a named profile, ' |
|
3985 | , but if you've loaded a named profile, ' | |
3963 | \family typewriter |
|
3986 | \family typewriter | |
3964 | -PROFILE_NAME |
|
3987 | -PROFILE_NAME | |
3965 | \family default |
|
3988 | \family default | |
3966 | ' is appended to the name. |
|
3989 | ' is appended to the name. | |
3967 | This allows you to keep separate histories related to various tasks: commands |
|
3990 | This allows you to keep separate histories related to various tasks: commands | |
3968 | related to numerical work will not be clobbered by a system shell history, |
|
3991 | related to numerical work will not be clobbered by a system shell history, | |
3969 | for example. |
|
3992 | for example. | |
3970 | \layout Subsubsection |
|
3993 | \layout Subsubsection | |
3971 |
|
3994 | |||
3972 | Autoindent |
|
3995 | Autoindent | |
3973 | \layout Standard |
|
3996 | \layout Standard | |
3974 |
|
3997 | |||
3975 | IPython can recognize lines ending in ':' and indent the next line, while |
|
3998 | IPython can recognize lines ending in ':' and indent the next line, while | |
3976 | also un-indenting automatically after 'raise' or 'return'. |
|
3999 | also un-indenting automatically after 'raise' or 'return'. | |
3977 |
|
4000 | |||
3978 | \layout Standard |
|
4001 | \layout Standard | |
3979 |
|
4002 | |||
3980 | This feature uses the readline library, so it will honor your |
|
4003 | This feature uses the readline library, so it will honor your | |
3981 | \family typewriter |
|
4004 | \family typewriter | |
3982 | ~/.inputrc |
|
4005 | ~/.inputrc | |
3983 | \family default |
|
4006 | \family default | |
3984 | configuration (or whatever file your |
|
4007 | configuration (or whatever file your | |
3985 | \family typewriter |
|
4008 | \family typewriter | |
3986 | INPUTRC |
|
4009 | INPUTRC | |
3987 | \family default |
|
4010 | \family default | |
3988 | variable points to). |
|
4011 | variable points to). | |
3989 | Adding the following lines to your |
|
4012 | Adding the following lines to your | |
3990 | \family typewriter |
|
4013 | \family typewriter | |
3991 | .inputrc |
|
4014 | .inputrc | |
3992 | \family default |
|
4015 | \family default | |
3993 | file can make indenting/unindenting more convenient ( |
|
4016 | file can make indenting/unindenting more convenient ( | |
3994 | \family typewriter |
|
4017 | \family typewriter | |
3995 | M-i |
|
4018 | M-i | |
3996 | \family default |
|
4019 | \family default | |
3997 | indents, |
|
4020 | indents, | |
3998 | \family typewriter |
|
4021 | \family typewriter | |
3999 | M-u |
|
4022 | M-u | |
4000 | \family default |
|
4023 | \family default | |
4001 | unindents): |
|
4024 | unindents): | |
4002 | \layout Standard |
|
4025 | \layout Standard | |
4003 |
|
4026 | |||
4004 |
|
4027 | |||
4005 | \family typewriter |
|
4028 | \family typewriter | |
4006 | $if Python |
|
4029 | $if Python | |
4007 | \newline |
|
4030 | \newline | |
4008 | " |
|
4031 | " | |
4009 | \backslash |
|
4032 | \backslash | |
4010 | M-i": "\SpecialChar ~ |
|
4033 | M-i": "\SpecialChar ~ | |
4011 | \SpecialChar ~ |
|
4034 | \SpecialChar ~ | |
4012 | \SpecialChar ~ |
|
4035 | \SpecialChar ~ | |
4013 | \SpecialChar ~ |
|
4036 | \SpecialChar ~ | |
4014 | " |
|
4037 | " | |
4015 | \newline |
|
4038 | \newline | |
4016 | " |
|
4039 | " | |
4017 | \backslash |
|
4040 | \backslash | |
4018 | M-u": " |
|
4041 | M-u": " | |
4019 | \backslash |
|
4042 | \backslash | |
4020 | d |
|
4043 | d | |
4021 | \backslash |
|
4044 | \backslash | |
4022 | d |
|
4045 | d | |
4023 | \backslash |
|
4046 | \backslash | |
4024 | d |
|
4047 | d | |
4025 | \backslash |
|
4048 | \backslash | |
4026 | d" |
|
4049 | d" | |
4027 | \newline |
|
4050 | \newline | |
4028 | $endif |
|
4051 | $endif | |
4029 | \layout Standard |
|
4052 | \layout Standard | |
4030 |
|
4053 | |||
4031 | Note that there are 4 spaces between the quote marks after |
|
4054 | Note that there are 4 spaces between the quote marks after | |
4032 | \family typewriter |
|
4055 | \family typewriter | |
4033 | "M-i" |
|
4056 | "M-i" | |
4034 | \family default |
|
4057 | \family default | |
4035 | above. |
|
4058 | above. | |
4036 | \layout Standard |
|
4059 | \layout Standard | |
4037 |
|
4060 | |||
4038 |
|
4061 | |||
4039 | \series bold |
|
4062 | \series bold | |
4040 | Warning: |
|
4063 | Warning: | |
4041 | \series default |
|
4064 | \series default | |
4042 | this feature is ON by default, but it can cause problems with the pasting |
|
4065 | this feature is ON by default, but it can cause problems with the pasting | |
4043 | of multi-line indented code (the pasted code gets re-indented on each line). |
|
4066 | of multi-line indented code (the pasted code gets re-indented on each line). | |
4044 | A magic function |
|
4067 | A magic function | |
4045 | \family typewriter |
|
4068 | \family typewriter | |
4046 | %autoindent |
|
4069 | %autoindent | |
4047 | \family default |
|
4070 | \family default | |
4048 | allows you to toggle it on/off at runtime. |
|
4071 | allows you to toggle it on/off at runtime. | |
4049 | You can also disable it permanently on in your |
|
4072 | You can also disable it permanently on in your | |
4050 | \family typewriter |
|
4073 | \family typewriter | |
4051 | ipythonrc |
|
4074 | ipythonrc | |
4052 | \family default |
|
4075 | \family default | |
4053 | file (set |
|
4076 | file (set | |
4054 | \family typewriter |
|
4077 | \family typewriter | |
4055 | autoindent 0 |
|
4078 | autoindent 0 | |
4056 | \family default |
|
4079 | \family default | |
4057 | ). |
|
4080 | ). | |
4058 | \layout Subsubsection |
|
4081 | \layout Subsubsection | |
4059 |
|
4082 | |||
4060 | Customizing readline behavior |
|
4083 | Customizing readline behavior | |
4061 | \layout Standard |
|
4084 | \layout Standard | |
4062 |
|
4085 | |||
4063 | All these features are based on the GNU readline library, which has an extremely |
|
4086 | All these features are based on the GNU readline library, which has an extremely | |
4064 | customizable interface. |
|
4087 | customizable interface. | |
4065 | Normally, readline is configured via a file which defines the behavior |
|
4088 | Normally, readline is configured via a file which defines the behavior | |
4066 | of the library; the details of the syntax for this can be found in the |
|
4089 | of the library; the details of the syntax for this can be found in the | |
4067 | readline documentation available with your system or on the Internet. |
|
4090 | readline documentation available with your system or on the Internet. | |
4068 | IPython doesn't read this file (if it exists) directly, but it does support |
|
4091 | IPython doesn't read this file (if it exists) directly, but it does support | |
4069 | passing to readline valid options via a simple interface. |
|
4092 | passing to readline valid options via a simple interface. | |
4070 | In brief, you can customize readline by setting the following options in |
|
4093 | In brief, you can customize readline by setting the following options in | |
4071 | your |
|
4094 | your | |
4072 | \family typewriter |
|
4095 | \family typewriter | |
4073 | ipythonrc |
|
4096 | ipythonrc | |
4074 | \family default |
|
4097 | \family default | |
4075 | configuration file (note that these options can |
|
4098 | configuration file (note that these options can | |
4076 | \emph on |
|
4099 | \emph on | |
4077 | not |
|
4100 | not | |
4078 | \emph default |
|
4101 | \emph default | |
4079 | be specified at the command line): |
|
4102 | be specified at the command line): | |
4080 | \layout List |
|
4103 | \layout List | |
4081 | \labelwidthstring 00.00.0000 |
|
4104 | \labelwidthstring 00.00.0000 | |
4082 |
|
4105 | |||
4083 |
|
4106 | |||
4084 | \family typewriter |
|
4107 | \family typewriter | |
4085 | \series bold |
|
4108 | \series bold | |
4086 | readline_parse_and_bind: |
|
4109 | readline_parse_and_bind: | |
4087 | \family default |
|
4110 | \family default | |
4088 | \series default |
|
4111 | \series default | |
4089 | this option can appear as many times as you want, each time defining a |
|
4112 | this option can appear as many times as you want, each time defining a | |
4090 | string to be executed via a |
|
4113 | string to be executed via a | |
4091 | \family typewriter |
|
4114 | \family typewriter | |
4092 | readline.parse_and_bind() |
|
4115 | readline.parse_and_bind() | |
4093 | \family default |
|
4116 | \family default | |
4094 | command. |
|
4117 | command. | |
4095 | The syntax for valid commands of this kind can be found by reading the |
|
4118 | The syntax for valid commands of this kind can be found by reading the | |
4096 | documentation for the GNU readline library, as these commands are of the |
|
4119 | documentation for the GNU readline library, as these commands are of the | |
4097 | kind which readline accepts in its configuration file. |
|
4120 | kind which readline accepts in its configuration file. | |
4098 | \layout List |
|
4121 | \layout List | |
4099 | \labelwidthstring 00.00.0000 |
|
4122 | \labelwidthstring 00.00.0000 | |
4100 |
|
4123 | |||
4101 |
|
4124 | |||
4102 | \family typewriter |
|
4125 | \family typewriter | |
4103 | \series bold |
|
4126 | \series bold | |
4104 | readline_remove_delims: |
|
4127 | readline_remove_delims: | |
4105 | \family default |
|
4128 | \family default | |
4106 | \series default |
|
4129 | \series default | |
4107 | a string of characters to be removed from the default word-delimiters list |
|
4130 | a string of characters to be removed from the default word-delimiters list | |
4108 | used by readline, so that completions may be performed on strings which |
|
4131 | used by readline, so that completions may be performed on strings which | |
4109 | contain them. |
|
4132 | contain them. | |
4110 | Do not change the default value unless you know what you're doing. |
|
4133 | Do not change the default value unless you know what you're doing. | |
4111 | \layout List |
|
4134 | \layout List | |
4112 | \labelwidthstring 00.00.0000 |
|
4135 | \labelwidthstring 00.00.0000 | |
4113 |
|
4136 | |||
4114 |
|
4137 | |||
4115 | \family typewriter |
|
4138 | \family typewriter | |
4116 | \series bold |
|
4139 | \series bold | |
4117 | readline_omit__names |
|
4140 | readline_omit__names | |
4118 | \family default |
|
4141 | \family default | |
4119 | \series default |
|
4142 | \series default | |
4120 | : when tab-completion is enabled, hitting |
|
4143 | : when tab-completion is enabled, hitting | |
4121 | \family typewriter |
|
4144 | \family typewriter | |
4122 | <tab> |
|
4145 | <tab> | |
4123 | \family default |
|
4146 | \family default | |
4124 | after a ' |
|
4147 | after a ' | |
4125 | \family typewriter |
|
4148 | \family typewriter | |
4126 | . |
|
4149 | . | |
4127 | \family default |
|
4150 | \family default | |
4128 | ' in a name will complete all attributes of an object, including all the |
|
4151 | ' in a name will complete all attributes of an object, including all the | |
4129 | special methods whose names include double underscores (like |
|
4152 | special methods whose names include double underscores (like | |
4130 | \family typewriter |
|
4153 | \family typewriter | |
4131 | __getitem__ |
|
4154 | __getitem__ | |
4132 | \family default |
|
4155 | \family default | |
4133 | or |
|
4156 | or | |
4134 | \family typewriter |
|
4157 | \family typewriter | |
4135 | __class__ |
|
4158 | __class__ | |
4136 | \family default |
|
4159 | \family default | |
4137 | ). |
|
4160 | ). | |
4138 | If you'd rather not see these names by default, you can set this option |
|
4161 | If you'd rather not see these names by default, you can set this option | |
4139 | to 1. |
|
4162 | to 1. | |
4140 | Note that even when this option is set, you can still see those names by |
|
4163 | Note that even when this option is set, you can still see those names by | |
4141 | explicitly typing a |
|
4164 | explicitly typing a | |
4142 | \family typewriter |
|
4165 | \family typewriter | |
4143 | _ |
|
4166 | _ | |
4144 | \family default |
|
4167 | \family default | |
4145 | after the period and hitting |
|
4168 | after the period and hitting | |
4146 | \family typewriter |
|
4169 | \family typewriter | |
4147 | <tab> |
|
4170 | <tab> | |
4148 | \family default |
|
4171 | \family default | |
4149 | : ' |
|
4172 | : ' | |
4150 | \family typewriter |
|
4173 | \family typewriter | |
4151 | name._<tab> |
|
4174 | name._<tab> | |
4152 | \family default |
|
4175 | \family default | |
4153 | ' will always complete attribute names starting with ' |
|
4176 | ' will always complete attribute names starting with ' | |
4154 | \family typewriter |
|
4177 | \family typewriter | |
4155 | _ |
|
4178 | _ | |
4156 | \family default |
|
4179 | \family default | |
4157 | '. |
|
4180 | '. | |
4158 | \layout List |
|
4181 | \layout List | |
4159 | \labelwidthstring 00.00.0000 |
|
4182 | \labelwidthstring 00.00.0000 | |
4160 |
|
4183 | |||
4161 | \SpecialChar ~ |
|
4184 | \SpecialChar ~ | |
4162 | This option is off by default so that new users see all attributes of any |
|
4185 | This option is off by default so that new users see all attributes of any | |
4163 | objects they are dealing with. |
|
4186 | objects they are dealing with. | |
4164 | \layout Standard |
|
4187 | \layout Standard | |
4165 |
|
4188 | |||
4166 | You will find the default values along with a corresponding detailed explanation |
|
4189 | You will find the default values along with a corresponding detailed explanation | |
4167 | in your |
|
4190 | in your | |
4168 | \family typewriter |
|
4191 | \family typewriter | |
4169 | ipythonrc |
|
4192 | ipythonrc | |
4170 | \family default |
|
4193 | \family default | |
4171 | file. |
|
4194 | file. | |
4172 | \layout Subsection |
|
4195 | \layout Subsection | |
4173 |
|
4196 | |||
4174 | Session logging and restoring |
|
4197 | Session logging and restoring | |
4175 | \layout Standard |
|
4198 | \layout Standard | |
4176 |
|
4199 | |||
4177 | You can log all input from a session either by starting IPython with the |
|
4200 | You can log all input from a session either by starting IPython with the | |
4178 | command line switches |
|
4201 | command line switches | |
4179 | \family typewriter |
|
4202 | \family typewriter | |
4180 | -log |
|
4203 | -log | |
4181 | \family default |
|
4204 | \family default | |
4182 | or |
|
4205 | or | |
4183 | \family typewriter |
|
4206 | \family typewriter | |
4184 | -logfile |
|
4207 | -logfile | |
4185 | \family default |
|
4208 | \family default | |
4186 | (see sec. |
|
4209 | (see sec. | |
4187 |
|
4210 | |||
4188 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} |
|
4211 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} | |
4189 |
|
4212 | |||
4190 | \end_inset |
|
4213 | \end_inset | |
4191 |
|
4214 | |||
4192 | )or by activating the logging at any moment with the magic function |
|
4215 | )or by activating the logging at any moment with the magic function | |
4193 | \family typewriter |
|
4216 | \family typewriter | |
4194 | %logstart |
|
4217 | %logstart | |
4195 | \family default |
|
4218 | \family default | |
4196 | . |
|
4219 | . | |
4197 |
|
4220 | |||
4198 | \layout Standard |
|
4221 | \layout Standard | |
4199 |
|
4222 | |||
4200 | Log files can later be reloaded with the |
|
4223 | Log files can later be reloaded with the | |
4201 | \family typewriter |
|
4224 | \family typewriter | |
4202 | -logplay |
|
4225 | -logplay | |
4203 | \family default |
|
4226 | \family default | |
4204 | option and IPython will attempt to 'replay' the log by executing all the |
|
4227 | option and IPython will attempt to 'replay' the log by executing all the | |
4205 | lines in it, thus restoring the state of a previous session. |
|
4228 | lines in it, thus restoring the state of a previous session. | |
4206 | This feature is not quite perfect, but can still be useful in many cases. |
|
4229 | This feature is not quite perfect, but can still be useful in many cases. | |
4207 | \layout Standard |
|
4230 | \layout Standard | |
4208 |
|
4231 | |||
4209 | The log files can also be used as a way to have a permanent record of any |
|
4232 | The log files can also be used as a way to have a permanent record of any | |
4210 | code you wrote while experimenting. |
|
4233 | code you wrote while experimenting. | |
4211 | Log files are regular text files which you can later open in your favorite |
|
4234 | Log files are regular text files which you can later open in your favorite | |
4212 | text editor to extract code or to 'clean them up' before using them to |
|
4235 | text editor to extract code or to 'clean them up' before using them to | |
4213 | replay a session. |
|
4236 | replay a session. | |
4214 | \layout Standard |
|
4237 | \layout Standard | |
4215 |
|
4238 | |||
4216 | The |
|
4239 | The | |
4217 | \family typewriter |
|
4240 | \family typewriter | |
4218 | %logstart |
|
4241 | %logstart | |
4219 | \family default |
|
4242 | \family default | |
4220 | function for activating logging in mid-session is used as follows: |
|
4243 | function for activating logging in mid-session is used as follows: | |
4221 | \layout Standard |
|
4244 | \layout Standard | |
4222 |
|
4245 | |||
4223 |
|
4246 | |||
4224 | \family typewriter |
|
4247 | \family typewriter | |
4225 | %logstart [log_name [log_mode]] |
|
4248 | %logstart [log_name [log_mode]] | |
4226 | \layout Standard |
|
4249 | \layout Standard | |
4227 |
|
4250 | |||
4228 | If no name is given, it defaults to a file named |
|
4251 | If no name is given, it defaults to a file named | |
4229 | \family typewriter |
|
4252 | \family typewriter | |
4230 | 'log' |
|
4253 | 'log' | |
4231 | \family default |
|
4254 | \family default | |
4232 | in your IPYTHONDIR directory, in |
|
4255 | in your IPYTHONDIR directory, in | |
4233 | \family typewriter |
|
4256 | \family typewriter | |
4234 | 'rotate' |
|
4257 | 'rotate' | |
4235 | \family default |
|
4258 | \family default | |
4236 | mode (see below). |
|
4259 | mode (see below). | |
4237 | \layout Standard |
|
4260 | \layout Standard | |
4238 |
|
4261 | |||
4239 | ' |
|
4262 | ' | |
4240 | \family typewriter |
|
4263 | \family typewriter | |
4241 | %logstart name |
|
4264 | %logstart name | |
4242 | \family default |
|
4265 | \family default | |
4243 | ' saves to file |
|
4266 | ' saves to file | |
4244 | \family typewriter |
|
4267 | \family typewriter | |
4245 | 'name' |
|
4268 | 'name' | |
4246 | \family default |
|
4269 | \family default | |
4247 | in |
|
4270 | in | |
4248 | \family typewriter |
|
4271 | \family typewriter | |
4249 | 'backup' |
|
4272 | 'backup' | |
4250 | \family default |
|
4273 | \family default | |
4251 | mode. |
|
4274 | mode. | |
4252 | It saves your history up to that point and then continues logging. |
|
4275 | It saves your history up to that point and then continues logging. | |
4253 | \layout Standard |
|
4276 | \layout Standard | |
4254 |
|
4277 | |||
4255 |
|
4278 | |||
4256 | \family typewriter |
|
4279 | \family typewriter | |
4257 | %logstart |
|
4280 | %logstart | |
4258 | \family default |
|
4281 | \family default | |
4259 | takes a second optional parameter: logging mode. |
|
4282 | takes a second optional parameter: logging mode. | |
4260 | This can be one of (note that the modes are given unquoted): |
|
4283 | This can be one of (note that the modes are given unquoted): | |
4261 | \layout List |
|
4284 | \layout List | |
4262 | \labelwidthstring 00.00.0000 |
|
4285 | \labelwidthstring 00.00.0000 | |
4263 |
|
4286 | |||
4264 |
|
4287 | |||
4265 | \family typewriter |
|
4288 | \family typewriter | |
4266 | over |
|
4289 | over | |
4267 | \family default |
|
4290 | \family default | |
4268 | : overwrite existing |
|
4291 | : overwrite existing | |
4269 | \family typewriter |
|
4292 | \family typewriter | |
4270 | log_name |
|
4293 | log_name | |
4271 | \family default |
|
4294 | \family default | |
4272 | . |
|
4295 | . | |
4273 | \layout List |
|
4296 | \layout List | |
4274 | \labelwidthstring 00.00.0000 |
|
4297 | \labelwidthstring 00.00.0000 | |
4275 |
|
4298 | |||
4276 |
|
4299 | |||
4277 | \family typewriter |
|
4300 | \family typewriter | |
4278 | backup |
|
4301 | backup | |
4279 | \family default |
|
4302 | \family default | |
4280 | : rename (if exists) to |
|
4303 | : rename (if exists) to | |
4281 | \family typewriter |
|
4304 | \family typewriter | |
4282 | log_name~ |
|
4305 | log_name~ | |
4283 | \family default |
|
4306 | \family default | |
4284 | and start |
|
4307 | and start | |
4285 | \family typewriter |
|
4308 | \family typewriter | |
4286 | log_name |
|
4309 | log_name | |
4287 | \family default |
|
4310 | \family default | |
4288 | . |
|
4311 | . | |
4289 | \layout List |
|
4312 | \layout List | |
4290 | \labelwidthstring 00.00.0000 |
|
4313 | \labelwidthstring 00.00.0000 | |
4291 |
|
4314 | |||
4292 |
|
4315 | |||
4293 | \family typewriter |
|
4316 | \family typewriter | |
4294 | append |
|
4317 | append | |
4295 | \family default |
|
4318 | \family default | |
4296 | : well, that says it. |
|
4319 | : well, that says it. | |
4297 | \layout List |
|
4320 | \layout List | |
4298 | \labelwidthstring 00.00.0000 |
|
4321 | \labelwidthstring 00.00.0000 | |
4299 |
|
4322 | |||
4300 |
|
4323 | |||
4301 | \family typewriter |
|
4324 | \family typewriter | |
4302 | rotate |
|
4325 | rotate | |
4303 | \family default |
|
4326 | \family default | |
4304 | : create rotating logs |
|
4327 | : create rotating logs | |
4305 | \family typewriter |
|
4328 | \family typewriter | |
4306 | log_name |
|
4329 | log_name | |
4307 | \family default |
|
4330 | \family default | |
4308 | . |
|
4331 | . | |
4309 | \family typewriter |
|
4332 | \family typewriter | |
4310 | 1~ |
|
4333 | 1~ | |
4311 | \family default |
|
4334 | \family default | |
4312 | , |
|
4335 | , | |
4313 | \family typewriter |
|
4336 | \family typewriter | |
4314 | log_name.2~ |
|
4337 | log_name.2~ | |
4315 | \family default |
|
4338 | \family default | |
4316 | , etc. |
|
4339 | , etc. | |
4317 | \layout Standard |
|
4340 | \layout Standard | |
4318 |
|
4341 | |||
4319 | The |
|
4342 | The | |
4320 | \family typewriter |
|
4343 | \family typewriter | |
4321 | %logoff |
|
4344 | %logoff | |
4322 | \family default |
|
4345 | \family default | |
4323 | and |
|
4346 | and | |
4324 | \family typewriter |
|
4347 | \family typewriter | |
4325 | %logon |
|
4348 | %logon | |
4326 | \family default |
|
4349 | \family default | |
4327 | functions allow you to temporarily stop and resume logging to a file which |
|
4350 | functions allow you to temporarily stop and resume logging to a file which | |
4328 | had previously been started with |
|
4351 | had previously been started with | |
4329 | \family typewriter |
|
4352 | \family typewriter | |
4330 | %logstart |
|
4353 | %logstart | |
4331 | \family default |
|
4354 | \family default | |
4332 | . |
|
4355 | . | |
4333 | They will fail (with an explanation) if you try to use them before logging |
|
4356 | They will fail (with an explanation) if you try to use them before logging | |
4334 | has been started. |
|
4357 | has been started. | |
4335 | \layout Subsection |
|
4358 | \layout Subsection | |
4336 |
|
4359 | |||
4337 |
|
4360 | |||
4338 | \begin_inset LatexCommand \label{sub:System-shell-access} |
|
4361 | \begin_inset LatexCommand \label{sub:System-shell-access} | |
4339 |
|
4362 | |||
4340 | \end_inset |
|
4363 | \end_inset | |
4341 |
|
4364 | |||
4342 | System shell access |
|
4365 | System shell access | |
4343 | \layout Standard |
|
4366 | \layout Standard | |
4344 |
|
4367 | |||
4345 | Any input line beginning with a |
|
4368 | Any input line beginning with a | |
4346 | \family typewriter |
|
4369 | \family typewriter | |
4347 | ! |
|
4370 | ! | |
4348 | \family default |
|
4371 | \family default | |
4349 | character is passed verbatim (minus the |
|
4372 | character is passed verbatim (minus the | |
4350 | \family typewriter |
|
4373 | \family typewriter | |
4351 | ! |
|
4374 | ! | |
4352 | \family default |
|
4375 | \family default | |
4353 | , of course) to the underlying operating system. |
|
4376 | , of course) to the underlying operating system. | |
4354 | For example, typing |
|
4377 | For example, typing | |
4355 | \family typewriter |
|
4378 | \family typewriter | |
4356 | !ls |
|
4379 | !ls | |
4357 | \family default |
|
4380 | \family default | |
4358 | will run |
|
4381 | will run | |
4359 | \family typewriter |
|
4382 | \family typewriter | |
4360 | 'ls' |
|
4383 | 'ls' | |
4361 | \family default |
|
4384 | \family default | |
4362 | in the current directory. |
|
4385 | in the current directory. | |
4363 | \layout Subsubsection |
|
4386 | \layout Subsubsection | |
4364 |
|
4387 | |||
4365 | Manual capture of command output |
|
4388 | Manual capture of command output | |
4366 | \layout Standard |
|
4389 | \layout Standard | |
4367 |
|
4390 | |||
4368 | If the input line begins with |
|
4391 | If the input line begins with | |
4369 | \emph on |
|
4392 | \emph on | |
4370 | two |
|
4393 | two | |
4371 | \emph default |
|
4394 | \emph default | |
4372 | exclamation marks, |
|
4395 | exclamation marks, | |
4373 | \family typewriter |
|
4396 | \family typewriter | |
4374 | !! |
|
4397 | !! | |
4375 | \family default |
|
4398 | \family default | |
4376 | , the command is executed but its output is captured and returned as a python |
|
4399 | , the command is executed but its output is captured and returned as a python | |
4377 | list, split on newlines. |
|
4400 | list, split on newlines. | |
4378 | Any output sent by the subprocess to standard error is printed separately, |
|
4401 | Any output sent by the subprocess to standard error is printed separately, | |
4379 | so that the resulting list only captures standard output. |
|
4402 | so that the resulting list only captures standard output. | |
4380 | The |
|
4403 | The | |
4381 | \family typewriter |
|
4404 | \family typewriter | |
4382 | !! |
|
4405 | !! | |
4383 | \family default |
|
4406 | \family default | |
4384 | syntax is a shorthand for the |
|
4407 | syntax is a shorthand for the | |
4385 | \family typewriter |
|
4408 | \family typewriter | |
4386 | %sx |
|
4409 | %sx | |
4387 | \family default |
|
4410 | \family default | |
4388 | magic command. |
|
4411 | magic command. | |
4389 | \layout Standard |
|
4412 | \layout Standard | |
4390 |
|
4413 | |||
4391 | Finally, the |
|
4414 | Finally, the | |
4392 | \family typewriter |
|
4415 | \family typewriter | |
4393 | %sc |
|
4416 | %sc | |
4394 | \family default |
|
4417 | \family default | |
4395 | magic (short for `shell capture') is similar to |
|
4418 | magic (short for `shell capture') is similar to | |
4396 | \family typewriter |
|
4419 | \family typewriter | |
4397 | %sx |
|
4420 | %sx | |
4398 | \family default |
|
4421 | \family default | |
4399 | , but allowing more fine-grained control of the capture details, and storing |
|
4422 | , but allowing more fine-grained control of the capture details, and storing | |
4400 | the result directly into a named variable. |
|
4423 | the result directly into a named variable. | |
4401 | \layout Standard |
|
4424 | \layout Standard | |
4402 |
|
4425 | |||
4403 | See Sec.\SpecialChar ~ |
|
4426 | See Sec.\SpecialChar ~ | |
4404 |
|
4427 | |||
4405 | \begin_inset LatexCommand \ref{sec:magic} |
|
4428 | \begin_inset LatexCommand \ref{sec:magic} | |
4406 |
|
4429 | |||
4407 | \end_inset |
|
4430 | \end_inset | |
4408 |
|
4431 | |||
4409 | for details on the magics |
|
4432 | for details on the magics | |
4410 | \family typewriter |
|
4433 | \family typewriter | |
4411 | %sc |
|
4434 | %sc | |
4412 | \family default |
|
4435 | \family default | |
4413 | and |
|
4436 | and | |
4414 | \family typewriter |
|
4437 | \family typewriter | |
4415 | %sx |
|
4438 | %sx | |
4416 | \family default |
|
4439 | \family default | |
4417 | , or use IPython's own help ( |
|
4440 | , or use IPython's own help ( | |
4418 | \family typewriter |
|
4441 | \family typewriter | |
4419 | sc? |
|
4442 | sc? | |
4420 | \family default |
|
4443 | \family default | |
4421 | and |
|
4444 | and | |
4422 | \family typewriter |
|
4445 | \family typewriter | |
4423 | sx? |
|
4446 | sx? | |
4424 | \family default |
|
4447 | \family default | |
4425 | ) for further details. |
|
4448 | ) for further details. | |
4426 | \layout Standard |
|
4449 | \layout Standard | |
4427 |
|
4450 | |||
4428 | IPython also allows you to expand the value of python variables when making |
|
4451 | IPython also allows you to expand the value of python variables when making | |
4429 | system calls. |
|
4452 | system calls. | |
4430 | Any python variable or expression which you prepend with |
|
4453 | Any python variable or expression which you prepend with | |
4431 | \family typewriter |
|
4454 | \family typewriter | |
4432 | $ |
|
4455 | $ | |
4433 | \family default |
|
4456 | \family default | |
4434 | will get expanded before the system call is made. |
|
4457 | will get expanded before the system call is made. | |
4435 |
|
4458 | |||
4436 | \layout Standard |
|
4459 | \layout Standard | |
4437 |
|
4460 | |||
4438 |
|
4461 | |||
4439 | \family typewriter |
|
4462 | \family typewriter | |
4440 | In [1]: pyvar='Hello world' |
|
4463 | In [1]: pyvar='Hello world' | |
4441 | \newline |
|
4464 | \newline | |
4442 | In [2]: !echo "A python variable: $pyvar" |
|
4465 | In [2]: !echo "A python variable: $pyvar" | |
4443 | \newline |
|
4466 | \newline | |
4444 | A python variable: Hello world |
|
4467 | A python variable: Hello world | |
4445 | \layout Standard |
|
4468 | \layout Standard | |
4446 |
|
4469 | |||
4447 | If you want the shell to actually see a literal |
|
4470 | If you want the shell to actually see a literal | |
4448 | \family typewriter |
|
4471 | \family typewriter | |
4449 | $ |
|
4472 | $ | |
4450 | \family default |
|
4473 | \family default | |
4451 | , you need to type it twice: |
|
4474 | , you need to type it twice: | |
4452 | \layout Standard |
|
4475 | \layout Standard | |
4453 |
|
4476 | |||
4454 |
|
4477 | |||
4455 | \family typewriter |
|
4478 | \family typewriter | |
4456 | In [3]: !echo "A system variable: $$HOME" |
|
4479 | In [3]: !echo "A system variable: $$HOME" | |
4457 | \newline |
|
4480 | \newline | |
4458 | A system variable: /home/fperez |
|
4481 | A system variable: /home/fperez | |
4459 | \layout Standard |
|
4482 | \layout Standard | |
4460 |
|
4483 | |||
4461 | You can pass arbitrary expressions, though you'll need to delimit them with |
|
4484 | You can pass arbitrary expressions, though you'll need to delimit them with | |
4462 |
|
4485 | |||
4463 | \family typewriter |
|
4486 | \family typewriter | |
4464 | {} |
|
4487 | {} | |
4465 | \family default |
|
4488 | \family default | |
4466 | if there is ambiguity as to the extent of the expression: |
|
4489 | if there is ambiguity as to the extent of the expression: | |
4467 | \layout Standard |
|
4490 | \layout Standard | |
4468 |
|
4491 | |||
4469 |
|
4492 | |||
4470 | \family typewriter |
|
4493 | \family typewriter | |
4471 | In [5]: x=10 |
|
4494 | In [5]: x=10 | |
4472 | \newline |
|
4495 | \newline | |
4473 | In [6]: y=20 |
|
4496 | In [6]: y=20 | |
4474 | \newline |
|
4497 | \newline | |
4475 | In [13]: !echo $x+y |
|
4498 | In [13]: !echo $x+y | |
4476 | \newline |
|
4499 | \newline | |
4477 | 10+y |
|
4500 | 10+y | |
4478 | \newline |
|
4501 | \newline | |
4479 | In [7]: !echo ${x+y} |
|
4502 | In [7]: !echo ${x+y} | |
4480 | \newline |
|
4503 | \newline | |
4481 | 30 |
|
4504 | 30 | |
4482 | \layout Standard |
|
4505 | \layout Standard | |
4483 |
|
4506 | |||
4484 | Even object attributes can be expanded: |
|
4507 | Even object attributes can be expanded: | |
4485 | \layout Standard |
|
4508 | \layout Standard | |
4486 |
|
4509 | |||
4487 |
|
4510 | |||
4488 | \family typewriter |
|
4511 | \family typewriter | |
4489 | In [12]: !echo $sys.argv |
|
4512 | In [12]: !echo $sys.argv | |
4490 | \newline |
|
4513 | \newline | |
4491 | [/home/fperez/usr/bin/ipython] |
|
4514 | [/home/fperez/usr/bin/ipython] | |
4492 | \layout Subsection |
|
4515 | \layout Subsection | |
4493 |
|
4516 | |||
4494 | System command aliases |
|
4517 | System command aliases | |
4495 | \layout Standard |
|
4518 | \layout Standard | |
4496 |
|
4519 | |||
4497 | The |
|
4520 | The | |
4498 | \family typewriter |
|
4521 | \family typewriter | |
4499 | %alias |
|
4522 | %alias | |
4500 | \family default |
|
4523 | \family default | |
4501 | magic function and the |
|
4524 | magic function and the | |
4502 | \family typewriter |
|
4525 | \family typewriter | |
4503 | alias |
|
4526 | alias | |
4504 | \family default |
|
4527 | \family default | |
4505 | option in the |
|
4528 | option in the | |
4506 | \family typewriter |
|
4529 | \family typewriter | |
4507 | ipythonrc |
|
4530 | ipythonrc | |
4508 | \family default |
|
4531 | \family default | |
4509 | configuration file allow you to define magic functions which are in fact |
|
4532 | configuration file allow you to define magic functions which are in fact | |
4510 | system shell commands. |
|
4533 | system shell commands. | |
4511 | These aliases can have parameters. |
|
4534 | These aliases can have parameters. | |
4512 |
|
4535 | |||
4513 | \layout Standard |
|
4536 | \layout Standard | |
4514 |
|
4537 | |||
4515 | ' |
|
4538 | ' | |
4516 | \family typewriter |
|
4539 | \family typewriter | |
4517 | %alias alias_name cmd |
|
4540 | %alias alias_name cmd | |
4518 | \family default |
|
4541 | \family default | |
4519 | ' defines ' |
|
4542 | ' defines ' | |
4520 | \family typewriter |
|
4543 | \family typewriter | |
4521 | alias_name |
|
4544 | alias_name | |
4522 | \family default |
|
4545 | \family default | |
4523 | ' as an alias for ' |
|
4546 | ' as an alias for ' | |
4524 | \family typewriter |
|
4547 | \family typewriter | |
4525 | cmd |
|
4548 | cmd | |
4526 | \family default |
|
4549 | \family default | |
4527 | ' |
|
4550 | ' | |
4528 | \layout Standard |
|
4551 | \layout Standard | |
4529 |
|
4552 | |||
4530 | Then, typing ' |
|
4553 | Then, typing ' | |
4531 | \family typewriter |
|
4554 | \family typewriter | |
4532 | %alias_name params |
|
4555 | %alias_name params | |
4533 | \family default |
|
4556 | \family default | |
4534 | ' will execute the system command ' |
|
4557 | ' will execute the system command ' | |
4535 | \family typewriter |
|
4558 | \family typewriter | |
4536 | cmd params |
|
4559 | cmd params | |
4537 | \family default |
|
4560 | \family default | |
4538 | ' (from your underlying operating system). |
|
4561 | ' (from your underlying operating system). | |
4539 |
|
4562 | |||
4540 | \layout Standard |
|
4563 | \layout Standard | |
4541 |
|
4564 | |||
4542 | You can also define aliases with parameters using |
|
4565 | You can also define aliases with parameters using | |
4543 | \family typewriter |
|
4566 | \family typewriter | |
4544 | %s |
|
4567 | %s | |
4545 | \family default |
|
4568 | \family default | |
4546 | specifiers (one per parameter). |
|
4569 | specifiers (one per parameter). | |
4547 | The following example defines the |
|
4570 | The following example defines the | |
4548 | \family typewriter |
|
4571 | \family typewriter | |
4549 | %parts |
|
4572 | %parts | |
4550 | \family default |
|
4573 | \family default | |
4551 | function as an alias to the command ' |
|
4574 | function as an alias to the command ' | |
4552 | \family typewriter |
|
4575 | \family typewriter | |
4553 | echo first %s second %s |
|
4576 | echo first %s second %s | |
4554 | \family default |
|
4577 | \family default | |
4555 | ' where each |
|
4578 | ' where each | |
4556 | \family typewriter |
|
4579 | \family typewriter | |
4557 | %s |
|
4580 | %s | |
4558 | \family default |
|
4581 | \family default | |
4559 | will be replaced by a positional parameter to the call to |
|
4582 | will be replaced by a positional parameter to the call to | |
4560 | \family typewriter |
|
4583 | \family typewriter | |
4561 | %parts: |
|
4584 | %parts: | |
4562 | \layout Standard |
|
4585 | \layout Standard | |
4563 |
|
4586 | |||
4564 |
|
4587 | |||
4565 | \family typewriter |
|
4588 | \family typewriter | |
4566 | In [1]: alias parts echo first %s second %s |
|
4589 | In [1]: alias parts echo first %s second %s | |
4567 | \newline |
|
4590 | \newline | |
4568 | In [2]: %parts A B |
|
4591 | In [2]: %parts A B | |
4569 | \newline |
|
4592 | \newline | |
4570 | first A second B |
|
4593 | first A second B | |
4571 | \newline |
|
4594 | \newline | |
4572 | In [3]: %parts A |
|
4595 | In [3]: %parts A | |
4573 | \newline |
|
4596 | \newline | |
4574 | Incorrect number of arguments: 2 expected. |
|
4597 | Incorrect number of arguments: 2 expected. | |
4575 |
|
4598 | |||
4576 | \newline |
|
4599 | \newline | |
4577 | parts is an alias to: 'echo first %s second %s' |
|
4600 | parts is an alias to: 'echo first %s second %s' | |
4578 | \layout Standard |
|
4601 | \layout Standard | |
4579 |
|
4602 | |||
4580 | If called with no parameters, |
|
4603 | If called with no parameters, | |
4581 | \family typewriter |
|
4604 | \family typewriter | |
4582 | %alias |
|
4605 | %alias | |
4583 | \family default |
|
4606 | \family default | |
4584 | prints the table of currently defined aliases. |
|
4607 | prints the table of currently defined aliases. | |
4585 | \layout Standard |
|
4608 | \layout Standard | |
4586 |
|
4609 | |||
4587 | The |
|
4610 | The | |
4588 | \family typewriter |
|
4611 | \family typewriter | |
4589 | %rehash/rehashx |
|
4612 | %rehash/rehashx | |
4590 | \family default |
|
4613 | \family default | |
4591 | magics allow you to load your entire |
|
4614 | magics allow you to load your entire | |
4592 | \family typewriter |
|
4615 | \family typewriter | |
4593 | $PATH |
|
4616 | $PATH | |
4594 | \family default |
|
4617 | \family default | |
4595 | as ipython aliases. |
|
4618 | as ipython aliases. | |
4596 | See their respective docstrings (or sec.\SpecialChar ~ |
|
4619 | See their respective docstrings (or sec.\SpecialChar ~ | |
4597 |
|
4620 | |||
4598 | \begin_inset LatexCommand \ref{sec:magic} |
|
4621 | \begin_inset LatexCommand \ref{sec:magic} | |
4599 |
|
4622 | |||
4600 | \end_inset |
|
4623 | \end_inset | |
4601 |
|
4624 | |||
4602 | for further details). |
|
4625 | for further details). | |
4603 | \layout Subsection |
|
4626 | \layout Subsection | |
4604 |
|
4627 | |||
4605 |
|
4628 | |||
4606 | \begin_inset LatexCommand \label{sec:dreload} |
|
4629 | \begin_inset LatexCommand \label{sec:dreload} | |
4607 |
|
4630 | |||
4608 | \end_inset |
|
4631 | \end_inset | |
4609 |
|
4632 | |||
4610 | Recursive reload |
|
4633 | Recursive reload | |
4611 | \layout Standard |
|
4634 | \layout Standard | |
4612 |
|
4635 | |||
4613 | The |
|
4636 | The | |
4614 | \family typewriter |
|
4637 | \family typewriter | |
4615 | %dreload |
|
4638 | %dreload | |
4616 | \family default |
|
4639 | \family default | |
4617 | command does a recursive reload of a module: changes made to the module |
|
4640 | command does a recursive reload of a module: changes made to the module | |
4618 | since you imported will actually be available without having to exit. |
|
4641 | since you imported will actually be available without having to exit. | |
4619 | \layout Subsection |
|
4642 | \layout Subsection | |
4620 |
|
4643 | |||
4621 | Verbose and colored exception traceback printouts |
|
4644 | Verbose and colored exception traceback printouts | |
4622 | \layout Standard |
|
4645 | \layout Standard | |
4623 |
|
4646 | |||
4624 | IPython provides the option to see very detailed exception tracebacks, which |
|
4647 | IPython provides the option to see very detailed exception tracebacks, which | |
4625 | can be especially useful when debugging large programs. |
|
4648 | can be especially useful when debugging large programs. | |
4626 | You can run any Python file with the |
|
4649 | You can run any Python file with the | |
4627 | \family typewriter |
|
4650 | \family typewriter | |
4628 | %run |
|
4651 | %run | |
4629 | \family default |
|
4652 | \family default | |
4630 | function to benefit from these detailed tracebacks. |
|
4653 | function to benefit from these detailed tracebacks. | |
4631 | Furthermore, both normal and verbose tracebacks can be colored (if your |
|
4654 | Furthermore, both normal and verbose tracebacks can be colored (if your | |
4632 | terminal supports it) which makes them much easier to parse visually. |
|
4655 | terminal supports it) which makes them much easier to parse visually. | |
4633 | \layout Standard |
|
4656 | \layout Standard | |
4634 |
|
4657 | |||
4635 | See the magic |
|
4658 | See the magic | |
4636 | \family typewriter |
|
4659 | \family typewriter | |
4637 | xmode |
|
4660 | xmode | |
4638 | \family default |
|
4661 | \family default | |
4639 | and |
|
4662 | and | |
4640 | \family typewriter |
|
4663 | \family typewriter | |
4641 | colors |
|
4664 | colors | |
4642 | \family default |
|
4665 | \family default | |
4643 | functions for details (just type |
|
4666 | functions for details (just type | |
4644 | \family typewriter |
|
4667 | \family typewriter | |
4645 | %magic |
|
4668 | %magic | |
4646 | \family default |
|
4669 | \family default | |
4647 | ). |
|
4670 | ). | |
4648 | \layout Standard |
|
4671 | \layout Standard | |
4649 |
|
4672 | |||
4650 | These features are basically a terminal version of Ka-Ping Yee's |
|
4673 | These features are basically a terminal version of Ka-Ping Yee's | |
4651 | \family typewriter |
|
4674 | \family typewriter | |
4652 | cgitb |
|
4675 | cgitb | |
4653 | \family default |
|
4676 | \family default | |
4654 | module, now part of the standard Python library. |
|
4677 | module, now part of the standard Python library. | |
4655 | \layout Subsection |
|
4678 | \layout Subsection | |
4656 |
|
4679 | |||
4657 |
|
4680 | |||
4658 | \begin_inset LatexCommand \label{sec:cache_input} |
|
4681 | \begin_inset LatexCommand \label{sec:cache_input} | |
4659 |
|
4682 | |||
4660 | \end_inset |
|
4683 | \end_inset | |
4661 |
|
4684 | |||
4662 | Input caching system |
|
4685 | Input caching system | |
4663 | \layout Standard |
|
4686 | \layout Standard | |
4664 |
|
4687 | |||
4665 | IPython offers numbered prompts (In/Out) with input and output caching. |
|
4688 | IPython offers numbered prompts (In/Out) with input and output caching. | |
4666 | All input is saved and can be retrieved as variables (besides the usual |
|
4689 | All input is saved and can be retrieved as variables (besides the usual | |
4667 | arrow key recall). |
|
4690 | arrow key recall). | |
4668 | \layout Standard |
|
4691 | \layout Standard | |
4669 |
|
4692 | |||
4670 | The following GLOBAL variables always exist (so don't overwrite them!): |
|
4693 | The following GLOBAL variables always exist (so don't overwrite them!): | |
4671 |
|
4694 | |||
4672 | \family typewriter |
|
4695 | \family typewriter | |
4673 | _i |
|
4696 | _i | |
4674 | \family default |
|
4697 | \family default | |
4675 | : stores previous input. |
|
4698 | : stores previous input. | |
4676 |
|
4699 | |||
4677 | \family typewriter |
|
4700 | \family typewriter | |
4678 | _ii |
|
4701 | _ii | |
4679 | \family default |
|
4702 | \family default | |
4680 | : next previous. |
|
4703 | : next previous. | |
4681 |
|
4704 | |||
4682 | \family typewriter |
|
4705 | \family typewriter | |
4683 | _iii |
|
4706 | _iii | |
4684 | \family default |
|
4707 | \family default | |
4685 | : next-next previous. |
|
4708 | : next-next previous. | |
4686 |
|
4709 | |||
4687 | \family typewriter |
|
4710 | \family typewriter | |
4688 | _ih |
|
4711 | _ih | |
4689 | \family default |
|
4712 | \family default | |
4690 | : a list of all input |
|
4713 | : a list of all input | |
4691 | \family typewriter |
|
4714 | \family typewriter | |
4692 | _ih[n] |
|
4715 | _ih[n] | |
4693 | \family default |
|
4716 | \family default | |
4694 | is the input from line |
|
4717 | is the input from line | |
4695 | \family typewriter |
|
4718 | \family typewriter | |
4696 | n |
|
4719 | n | |
4697 | \family default |
|
4720 | \family default | |
4698 | and this list is aliased to the global variable |
|
4721 | and this list is aliased to the global variable | |
4699 | \family typewriter |
|
4722 | \family typewriter | |
4700 | In |
|
4723 | In | |
4701 | \family default |
|
4724 | \family default | |
4702 | . |
|
4725 | . | |
4703 | If you overwrite |
|
4726 | If you overwrite | |
4704 | \family typewriter |
|
4727 | \family typewriter | |
4705 | In |
|
4728 | In | |
4706 | \family default |
|
4729 | \family default | |
4707 | with a variable of your own, you can remake the assignment to the internal |
|
4730 | with a variable of your own, you can remake the assignment to the internal | |
4708 | list with a simple |
|
4731 | list with a simple | |
4709 | \family typewriter |
|
4732 | \family typewriter | |
4710 | 'In=_ih' |
|
4733 | 'In=_ih' | |
4711 | \family default |
|
4734 | \family default | |
4712 | . |
|
4735 | . | |
4713 | \layout Standard |
|
4736 | \layout Standard | |
4714 |
|
4737 | |||
4715 | Additionally, global variables named |
|
4738 | Additionally, global variables named | |
4716 | \family typewriter |
|
4739 | \family typewriter | |
4717 | _i<n> |
|
4740 | _i<n> | |
4718 | \family default |
|
4741 | \family default | |
4719 | are dynamically created ( |
|
4742 | are dynamically created ( | |
4720 | \family typewriter |
|
4743 | \family typewriter | |
4721 | <n> |
|
4744 | <n> | |
4722 | \family default |
|
4745 | \family default | |
4723 | being the prompt counter), such that |
|
4746 | being the prompt counter), such that | |
4724 | \newline |
|
4747 | \newline | |
4725 |
|
4748 | |||
4726 | \family typewriter |
|
4749 | \family typewriter | |
4727 | _i<n> == _ih[<n>] == In[<n>]. |
|
4750 | _i<n> == _ih[<n>] == In[<n>]. | |
4728 | \layout Standard |
|
4751 | \layout Standard | |
4729 |
|
4752 | |||
4730 | For example, what you typed at prompt 14 is available as |
|
4753 | For example, what you typed at prompt 14 is available as | |
4731 | \family typewriter |
|
4754 | \family typewriter | |
4732 | _i14, |
|
4755 | _i14, | |
4733 | \family default |
|
4756 | \family default | |
4734 |
|
4757 | |||
4735 | \family typewriter |
|
4758 | \family typewriter | |
4736 | _ih[14] |
|
4759 | _ih[14] | |
4737 | \family default |
|
4760 | \family default | |
4738 | and |
|
4761 | and | |
4739 | \family typewriter |
|
4762 | \family typewriter | |
4740 | In[14] |
|
4763 | In[14] | |
4741 | \family default |
|
4764 | \family default | |
4742 | . |
|
4765 | . | |
4743 | \layout Standard |
|
4766 | \layout Standard | |
4744 |
|
4767 | |||
4745 | This allows you to easily cut and paste multi line interactive prompts by |
|
4768 | This allows you to easily cut and paste multi line interactive prompts by | |
4746 | printing them out: they print like a clean string, without prompt characters. |
|
4769 | printing them out: they print like a clean string, without prompt characters. | |
4747 | You can also manipulate them like regular variables (they are strings), |
|
4770 | You can also manipulate them like regular variables (they are strings), | |
4748 | modify or exec them (typing |
|
4771 | modify or exec them (typing | |
4749 | \family typewriter |
|
4772 | \family typewriter | |
4750 | 'exec _i9' |
|
4773 | 'exec _i9' | |
4751 | \family default |
|
4774 | \family default | |
4752 | will re-execute the contents of input prompt 9, ' |
|
4775 | will re-execute the contents of input prompt 9, ' | |
4753 | \family typewriter |
|
4776 | \family typewriter | |
4754 | exec In[9:14]+In[18] |
|
4777 | exec In[9:14]+In[18] | |
4755 | \family default |
|
4778 | \family default | |
4756 | ' will re-execute lines 9 through 13 and line 18). |
|
4779 | ' will re-execute lines 9 through 13 and line 18). | |
4757 | \layout Standard |
|
4780 | \layout Standard | |
4758 |
|
4781 | |||
4759 | You can also re-execute multiple lines of input easily by using the magic |
|
4782 | You can also re-execute multiple lines of input easily by using the magic | |
4760 |
|
4783 | |||
4761 | \family typewriter |
|
4784 | \family typewriter | |
4762 | %macro |
|
4785 | %macro | |
4763 | \family default |
|
4786 | \family default | |
4764 | function (which automates the process and allows re-execution without having |
|
4787 | function (which automates the process and allows re-execution without having | |
4765 | to type ' |
|
4788 | to type ' | |
4766 | \family typewriter |
|
4789 | \family typewriter | |
4767 | exec |
|
4790 | exec | |
4768 | \family default |
|
4791 | \family default | |
4769 | ' every time). |
|
4792 | ' every time). | |
4770 | The macro system also allows you to re-execute previous lines which include |
|
4793 | The macro system also allows you to re-execute previous lines which include | |
4771 | magic function calls (which require special processing). |
|
4794 | magic function calls (which require special processing). | |
4772 | Type |
|
4795 | Type | |
4773 | \family typewriter |
|
4796 | \family typewriter | |
4774 | %macro? |
|
4797 | %macro? | |
4775 | \family default |
|
4798 | \family default | |
4776 | or see sec. |
|
4799 | or see sec. | |
4777 |
|
4800 | |||
4778 | \begin_inset LatexCommand \ref{sec:magic} |
|
4801 | \begin_inset LatexCommand \ref{sec:magic} | |
4779 |
|
4802 | |||
4780 | \end_inset |
|
4803 | \end_inset | |
4781 |
|
4804 | |||
4782 | for more details on the macro system. |
|
4805 | for more details on the macro system. | |
4783 | \layout Standard |
|
4806 | \layout Standard | |
4784 |
|
4807 | |||
4785 | A history function |
|
4808 | A history function | |
4786 | \family typewriter |
|
4809 | \family typewriter | |
4787 | %hist |
|
4810 | %hist | |
4788 | \family default |
|
4811 | \family default | |
4789 | allows you to see any part of your input history by printing a range of |
|
4812 | allows you to see any part of your input history by printing a range of | |
4790 | the |
|
4813 | the | |
4791 | \family typewriter |
|
4814 | \family typewriter | |
4792 | _i |
|
4815 | _i | |
4793 | \family default |
|
4816 | \family default | |
4794 | variables. |
|
4817 | variables. | |
4795 | \layout Subsection |
|
4818 | \layout Subsection | |
4796 |
|
4819 | |||
4797 |
|
4820 | |||
4798 | \begin_inset LatexCommand \label{sec:cache_output} |
|
4821 | \begin_inset LatexCommand \label{sec:cache_output} | |
4799 |
|
4822 | |||
4800 | \end_inset |
|
4823 | \end_inset | |
4801 |
|
4824 | |||
4802 | Output caching system |
|
4825 | Output caching system | |
4803 | \layout Standard |
|
4826 | \layout Standard | |
4804 |
|
4827 | |||
4805 | For output that is returned from actions, a system similar to the input |
|
4828 | For output that is returned from actions, a system similar to the input | |
4806 | cache exists but using |
|
4829 | cache exists but using | |
4807 | \family typewriter |
|
4830 | \family typewriter | |
4808 | _ |
|
4831 | _ | |
4809 | \family default |
|
4832 | \family default | |
4810 | instead of |
|
4833 | instead of | |
4811 | \family typewriter |
|
4834 | \family typewriter | |
4812 | _i |
|
4835 | _i | |
4813 | \family default |
|
4836 | \family default | |
4814 | . |
|
4837 | . | |
4815 | Only actions that produce a result (NOT assignments, for example) are cached. |
|
4838 | Only actions that produce a result (NOT assignments, for example) are cached. | |
4816 | If you are familiar with Mathematica, IPython's |
|
4839 | If you are familiar with Mathematica, IPython's | |
4817 | \family typewriter |
|
4840 | \family typewriter | |
4818 | _ |
|
4841 | _ | |
4819 | \family default |
|
4842 | \family default | |
4820 | variables behave exactly like Mathematica's |
|
4843 | variables behave exactly like Mathematica's | |
4821 | \family typewriter |
|
4844 | \family typewriter | |
4822 | % |
|
4845 | % | |
4823 | \family default |
|
4846 | \family default | |
4824 | variables. |
|
4847 | variables. | |
4825 | \layout Standard |
|
4848 | \layout Standard | |
4826 |
|
4849 | |||
4827 | The following GLOBAL variables always exist (so don't overwrite them!): |
|
4850 | The following GLOBAL variables always exist (so don't overwrite them!): | |
4828 |
|
4851 | |||
4829 | \layout List |
|
4852 | \layout List | |
4830 | \labelwidthstring 00.00.0000 |
|
4853 | \labelwidthstring 00.00.0000 | |
4831 |
|
4854 | |||
4832 |
|
4855 | |||
4833 | \family typewriter |
|
4856 | \family typewriter | |
4834 | \series bold |
|
4857 | \series bold | |
4835 | _ |
|
4858 | _ | |
4836 | \family default |
|
4859 | \family default | |
4837 | \series default |
|
4860 | \series default | |
4838 | (a |
|
4861 | (a | |
4839 | \emph on |
|
4862 | \emph on | |
4840 | single |
|
4863 | single | |
4841 | \emph default |
|
4864 | \emph default | |
4842 | underscore) : stores previous output, like Python's default interpreter. |
|
4865 | underscore) : stores previous output, like Python's default interpreter. | |
4843 | \layout List |
|
4866 | \layout List | |
4844 | \labelwidthstring 00.00.0000 |
|
4867 | \labelwidthstring 00.00.0000 | |
4845 |
|
4868 | |||
4846 |
|
4869 | |||
4847 | \family typewriter |
|
4870 | \family typewriter | |
4848 | \series bold |
|
4871 | \series bold | |
4849 | __ |
|
4872 | __ | |
4850 | \family default |
|
4873 | \family default | |
4851 | \series default |
|
4874 | \series default | |
4852 | (two underscores): next previous. |
|
4875 | (two underscores): next previous. | |
4853 | \layout List |
|
4876 | \layout List | |
4854 | \labelwidthstring 00.00.0000 |
|
4877 | \labelwidthstring 00.00.0000 | |
4855 |
|
4878 | |||
4856 |
|
4879 | |||
4857 | \family typewriter |
|
4880 | \family typewriter | |
4858 | \series bold |
|
4881 | \series bold | |
4859 | ___ |
|
4882 | ___ | |
4860 | \family default |
|
4883 | \family default | |
4861 | \series default |
|
4884 | \series default | |
4862 | (three underscores): next-next previous. |
|
4885 | (three underscores): next-next previous. | |
4863 | \layout Standard |
|
4886 | \layout Standard | |
4864 |
|
4887 | |||
4865 | Additionally, global variables named |
|
4888 | Additionally, global variables named | |
4866 | \family typewriter |
|
4889 | \family typewriter | |
4867 | _<n> |
|
4890 | _<n> | |
4868 | \family default |
|
4891 | \family default | |
4869 | are dynamically created ( |
|
4892 | are dynamically created ( | |
4870 | \family typewriter |
|
4893 | \family typewriter | |
4871 | <n> |
|
4894 | <n> | |
4872 | \family default |
|
4895 | \family default | |
4873 | being the prompt counter), such that the result of output |
|
4896 | being the prompt counter), such that the result of output | |
4874 | \family typewriter |
|
4897 | \family typewriter | |
4875 | <n> |
|
4898 | <n> | |
4876 | \family default |
|
4899 | \family default | |
4877 | is always available as |
|
4900 | is always available as | |
4878 | \family typewriter |
|
4901 | \family typewriter | |
4879 | _<n> |
|
4902 | _<n> | |
4880 | \family default |
|
4903 | \family default | |
4881 | (don't use the angle brackets, just the number, e.g. |
|
4904 | (don't use the angle brackets, just the number, e.g. | |
4882 |
|
4905 | |||
4883 | \family typewriter |
|
4906 | \family typewriter | |
4884 | _21 |
|
4907 | _21 | |
4885 | \family default |
|
4908 | \family default | |
4886 | ). |
|
4909 | ). | |
4887 | \layout Standard |
|
4910 | \layout Standard | |
4888 |
|
4911 | |||
4889 | These global variables are all stored in a global dictionary (not a list, |
|
4912 | These global variables are all stored in a global dictionary (not a list, | |
4890 | since it only has entries for lines which returned a result) available |
|
4913 | since it only has entries for lines which returned a result) available | |
4891 | under the names |
|
4914 | under the names | |
4892 | \family typewriter |
|
4915 | \family typewriter | |
4893 | _oh |
|
4916 | _oh | |
4894 | \family default |
|
4917 | \family default | |
4895 | and |
|
4918 | and | |
4896 | \family typewriter |
|
4919 | \family typewriter | |
4897 | Out |
|
4920 | Out | |
4898 | \family default |
|
4921 | \family default | |
4899 | (similar to |
|
4922 | (similar to | |
4900 | \family typewriter |
|
4923 | \family typewriter | |
4901 | _ih |
|
4924 | _ih | |
4902 | \family default |
|
4925 | \family default | |
4903 | and |
|
4926 | and | |
4904 | \family typewriter |
|
4927 | \family typewriter | |
4905 | In |
|
4928 | In | |
4906 | \family default |
|
4929 | \family default | |
4907 | ). |
|
4930 | ). | |
4908 | So the output from line 12 can be obtained as |
|
4931 | So the output from line 12 can be obtained as | |
4909 | \family typewriter |
|
4932 | \family typewriter | |
4910 | _12 |
|
4933 | _12 | |
4911 | \family default |
|
4934 | \family default | |
4912 | , |
|
4935 | , | |
4913 | \family typewriter |
|
4936 | \family typewriter | |
4914 | Out[12] |
|
4937 | Out[12] | |
4915 | \family default |
|
4938 | \family default | |
4916 | or |
|
4939 | or | |
4917 | \family typewriter |
|
4940 | \family typewriter | |
4918 | _oh[12] |
|
4941 | _oh[12] | |
4919 | \family default |
|
4942 | \family default | |
4920 | . |
|
4943 | . | |
4921 | If you accidentally overwrite the |
|
4944 | If you accidentally overwrite the | |
4922 | \family typewriter |
|
4945 | \family typewriter | |
4923 | Out |
|
4946 | Out | |
4924 | \family default |
|
4947 | \family default | |
4925 | variable you can recover it by typing |
|
4948 | variable you can recover it by typing | |
4926 | \family typewriter |
|
4949 | \family typewriter | |
4927 | 'Out=_oh |
|
4950 | 'Out=_oh | |
4928 | \family default |
|
4951 | \family default | |
4929 | ' at the prompt. |
|
4952 | ' at the prompt. | |
4930 | \layout Standard |
|
4953 | \layout Standard | |
4931 |
|
4954 | |||
4932 | This system obviously can potentially put heavy memory demands on your system, |
|
4955 | This system obviously can potentially put heavy memory demands on your system, | |
4933 | since it prevents Python's garbage collector from removing any previously |
|
4956 | since it prevents Python's garbage collector from removing any previously | |
4934 | computed results. |
|
4957 | computed results. | |
4935 | You can control how many results are kept in memory with the option (at |
|
4958 | You can control how many results are kept in memory with the option (at | |
4936 | the command line or in your |
|
4959 | the command line or in your | |
4937 | \family typewriter |
|
4960 | \family typewriter | |
4938 | ipythonrc |
|
4961 | ipythonrc | |
4939 | \family default |
|
4962 | \family default | |
4940 | file) |
|
4963 | file) | |
4941 | \family typewriter |
|
4964 | \family typewriter | |
4942 | cache_size |
|
4965 | cache_size | |
4943 | \family default |
|
4966 | \family default | |
4944 | . |
|
4967 | . | |
4945 | If you set it to 0, the whole system is completely disabled and the prompts |
|
4968 | If you set it to 0, the whole system is completely disabled and the prompts | |
4946 | revert to the classic |
|
4969 | revert to the classic | |
4947 | \family typewriter |
|
4970 | \family typewriter | |
4948 | '>>>' |
|
4971 | '>>>' | |
4949 | \family default |
|
4972 | \family default | |
4950 | of normal Python. |
|
4973 | of normal Python. | |
4951 | \layout Subsection |
|
4974 | \layout Subsection | |
4952 |
|
4975 | |||
4953 | Directory history |
|
4976 | Directory history | |
4954 | \layout Standard |
|
4977 | \layout Standard | |
4955 |
|
4978 | |||
4956 | Your history of visited directories is kept in the global list |
|
4979 | Your history of visited directories is kept in the global list | |
4957 | \family typewriter |
|
4980 | \family typewriter | |
4958 | _dh |
|
4981 | _dh | |
4959 | \family default |
|
4982 | \family default | |
4960 | , and the magic |
|
4983 | , and the magic | |
4961 | \family typewriter |
|
4984 | \family typewriter | |
4962 | %cd |
|
4985 | %cd | |
4963 | \family default |
|
4986 | \family default | |
4964 | command can be used to go to any entry in that list. |
|
4987 | command can be used to go to any entry in that list. | |
4965 | The |
|
4988 | The | |
4966 | \family typewriter |
|
4989 | \family typewriter | |
4967 | %dhist |
|
4990 | %dhist | |
4968 | \family default |
|
4991 | \family default | |
4969 | command allows you to view this history. |
|
4992 | command allows you to view this history. | |
4970 | \layout Subsection |
|
4993 | \layout Subsection | |
4971 |
|
4994 | |||
4972 | Automatic parentheses and quotes |
|
4995 | Automatic parentheses and quotes | |
4973 | \layout Standard |
|
4996 | \layout Standard | |
4974 |
|
4997 | |||
4975 | These features were adapted from Nathan Gray's LazyPython. |
|
4998 | These features were adapted from Nathan Gray's LazyPython. | |
4976 | They are meant to allow less typing for common situations. |
|
4999 | They are meant to allow less typing for common situations. | |
4977 | \layout Subsubsection |
|
5000 | \layout Subsubsection | |
4978 |
|
5001 | |||
4979 | Automatic parentheses |
|
5002 | Automatic parentheses | |
4980 | \layout Standard |
|
5003 | \layout Standard | |
4981 |
|
5004 | |||
4982 | Callable objects (i.e. |
|
5005 | Callable objects (i.e. | |
4983 | functions, methods, etc) can be invoked like this (notice the commas between |
|
5006 | functions, methods, etc) can be invoked like this (notice the commas between | |
4984 | the arguments): |
|
5007 | the arguments): | |
4985 | \layout Standard |
|
5008 | \layout Standard | |
4986 |
|
5009 | |||
4987 |
|
5010 | |||
4988 | \family typewriter |
|
5011 | \family typewriter | |
4989 | >>> callable_ob arg1, arg2, arg3 |
|
5012 | >>> callable_ob arg1, arg2, arg3 | |
4990 | \layout Standard |
|
5013 | \layout Standard | |
4991 |
|
5014 | |||
4992 | and the input will be translated to this: |
|
5015 | and the input will be translated to this: | |
4993 | \layout Standard |
|
5016 | \layout Standard | |
4994 |
|
5017 | |||
4995 |
|
5018 | |||
4996 | \family typewriter |
|
5019 | \family typewriter | |
4997 | --> callable_ob(arg1, arg2, arg3) |
|
5020 | --> callable_ob(arg1, arg2, arg3) | |
4998 | \layout Standard |
|
5021 | \layout Standard | |
4999 |
|
5022 | |||
5000 | You can force automatic parentheses by using '/' as the first character |
|
5023 | You can force automatic parentheses by using '/' as the first character | |
5001 | of a line. |
|
5024 | of a line. | |
5002 | For example: |
|
5025 | For example: | |
5003 | \layout Standard |
|
5026 | \layout Standard | |
5004 |
|
5027 | |||
5005 |
|
5028 | |||
5006 | \family typewriter |
|
5029 | \family typewriter | |
5007 | >>> /globals # becomes 'globals()' |
|
5030 | >>> /globals # becomes 'globals()' | |
5008 | \layout Standard |
|
5031 | \layout Standard | |
5009 |
|
5032 | |||
5010 | Note that the '/' MUST be the first character on the line! This won't work: |
|
5033 | Note that the '/' MUST be the first character on the line! This won't work: | |
5011 |
|
5034 | |||
5012 | \layout Standard |
|
5035 | \layout Standard | |
5013 |
|
5036 | |||
5014 |
|
5037 | |||
5015 | \family typewriter |
|
5038 | \family typewriter | |
5016 | >>> print /globals # syntax error |
|
5039 | >>> print /globals # syntax error | |
5017 | \layout Standard |
|
5040 | \layout Standard | |
5018 |
|
5041 | |||
5019 | In most cases the automatic algorithm should work, so you should rarely |
|
5042 | In most cases the automatic algorithm should work, so you should rarely | |
5020 | need to explicitly invoke /. |
|
5043 | need to explicitly invoke /. | |
5021 | One notable exception is if you are trying to call a function with a list |
|
5044 | One notable exception is if you are trying to call a function with a list | |
5022 | of tuples as arguments (the parenthesis will confuse IPython): |
|
5045 | of tuples as arguments (the parenthesis will confuse IPython): | |
5023 | \layout Standard |
|
5046 | \layout Standard | |
5024 |
|
5047 | |||
5025 |
|
5048 | |||
5026 | \family typewriter |
|
5049 | \family typewriter | |
5027 | In [1]: zip (1,2,3),(4,5,6) # won't work |
|
5050 | In [1]: zip (1,2,3),(4,5,6) # won't work | |
5028 | \layout Standard |
|
5051 | \layout Standard | |
5029 |
|
5052 | |||
5030 | but this will work: |
|
5053 | but this will work: | |
5031 | \layout Standard |
|
5054 | \layout Standard | |
5032 |
|
5055 | |||
5033 |
|
5056 | |||
5034 | \family typewriter |
|
5057 | \family typewriter | |
5035 | In [2]: /zip (1,2,3),(4,5,6) |
|
5058 | In [2]: /zip (1,2,3),(4,5,6) | |
5036 | \newline |
|
5059 | \newline | |
5037 | ------> zip ((1,2,3),(4,5,6)) |
|
5060 | ------> zip ((1,2,3),(4,5,6)) | |
5038 | \newline |
|
5061 | \newline | |
5039 | Out[2]= [(1, 4), (2, 5), (3, 6)] |
|
5062 | Out[2]= [(1, 4), (2, 5), (3, 6)] | |
5040 | \layout Standard |
|
5063 | \layout Standard | |
5041 |
|
5064 | |||
5042 | IPython tells you that it has altered your command line by displaying the |
|
5065 | IPython tells you that it has altered your command line by displaying the | |
5043 | new command line preceded by |
|
5066 | new command line preceded by | |
5044 | \family typewriter |
|
5067 | \family typewriter | |
5045 | --> |
|
5068 | --> | |
5046 | \family default |
|
5069 | \family default | |
5047 | . |
|
5070 | . | |
5048 | e.g.: |
|
5071 | e.g.: | |
5049 | \layout Standard |
|
5072 | \layout Standard | |
5050 |
|
5073 | |||
5051 |
|
5074 | |||
5052 | \family typewriter |
|
5075 | \family typewriter | |
5053 | In [18]: callable list |
|
5076 | In [18]: callable list | |
5054 | \newline |
|
5077 | \newline | |
5055 | -------> callable (list) |
|
5078 | -------> callable (list) | |
5056 | \layout Subsubsection |
|
5079 | \layout Subsubsection | |
5057 |
|
5080 | |||
5058 | Automatic quoting |
|
5081 | Automatic quoting | |
5059 | \layout Standard |
|
5082 | \layout Standard | |
5060 |
|
5083 | |||
5061 | You can force automatic quoting of a function's arguments by using |
|
5084 | You can force automatic quoting of a function's arguments by using | |
5062 | \family typewriter |
|
5085 | \family typewriter | |
5063 | `,' |
|
5086 | `,' | |
5064 | \family default |
|
5087 | \family default | |
5065 | or |
|
5088 | or | |
5066 | \family typewriter |
|
5089 | \family typewriter | |
5067 | `;' |
|
5090 | `;' | |
5068 | \family default |
|
5091 | \family default | |
5069 | as the first character of a line. |
|
5092 | as the first character of a line. | |
5070 | For example: |
|
5093 | For example: | |
5071 | \layout Standard |
|
5094 | \layout Standard | |
5072 |
|
5095 | |||
5073 |
|
5096 | |||
5074 | \family typewriter |
|
5097 | \family typewriter | |
5075 | >>> ,my_function /home/me # becomes my_function("/home/me") |
|
5098 | >>> ,my_function /home/me # becomes my_function("/home/me") | |
5076 | \layout Standard |
|
5099 | \layout Standard | |
5077 |
|
5100 | |||
5078 | If you use |
|
5101 | If you use | |
5079 | \family typewriter |
|
5102 | \family typewriter | |
5080 | `;' |
|
5103 | `;' | |
5081 | \family default |
|
5104 | \family default | |
5082 | instead, the whole argument is quoted as a single string (while |
|
5105 | instead, the whole argument is quoted as a single string (while | |
5083 | \family typewriter |
|
5106 | \family typewriter | |
5084 | `,' |
|
5107 | `,' | |
5085 | \family default |
|
5108 | \family default | |
5086 | splits on whitespace): |
|
5109 | splits on whitespace): | |
5087 | \layout Standard |
|
5110 | \layout Standard | |
5088 |
|
5111 | |||
5089 |
|
5112 | |||
5090 | \family typewriter |
|
5113 | \family typewriter | |
5091 | >>> ,my_function a b c # becomes my_function("a","b","c") |
|
5114 | >>> ,my_function a b c # becomes my_function("a","b","c") | |
5092 | \layout Standard |
|
5115 | \layout Standard | |
5093 |
|
5116 | |||
5094 |
|
5117 | |||
5095 | \family typewriter |
|
5118 | \family typewriter | |
5096 | >>> ;my_function a b c # becomes my_function("a b c") |
|
5119 | >>> ;my_function a b c # becomes my_function("a b c") | |
5097 | \layout Standard |
|
5120 | \layout Standard | |
5098 |
|
5121 | |||
5099 | Note that the ` |
|
5122 | Note that the ` | |
5100 | \family typewriter |
|
5123 | \family typewriter | |
5101 | , |
|
5124 | , | |
5102 | \family default |
|
5125 | \family default | |
5103 | ' or ` |
|
5126 | ' or ` | |
5104 | \family typewriter |
|
5127 | \family typewriter | |
5105 | ; |
|
5128 | ; | |
5106 | \family default |
|
5129 | \family default | |
5107 | ' MUST be the first character on the line! This won't work: |
|
5130 | ' MUST be the first character on the line! This won't work: | |
5108 | \layout Standard |
|
5131 | \layout Standard | |
5109 |
|
5132 | |||
5110 |
|
5133 | |||
5111 | \family typewriter |
|
5134 | \family typewriter | |
5112 | >>> x = ,my_function /home/me # syntax error |
|
5135 | >>> x = ,my_function /home/me # syntax error | |
5113 | \layout Section |
|
5136 | \layout Section | |
5114 |
|
5137 | |||
5115 |
|
5138 | |||
5116 | \begin_inset LatexCommand \label{sec:customization} |
|
5139 | \begin_inset LatexCommand \label{sec:customization} | |
5117 |
|
5140 | |||
5118 | \end_inset |
|
5141 | \end_inset | |
5119 |
|
5142 | |||
5120 | Customization |
|
5143 | Customization | |
5121 | \layout Standard |
|
5144 | \layout Standard | |
5122 |
|
5145 | |||
5123 | As we've already mentioned, IPython reads a configuration file which can |
|
5146 | As we've already mentioned, IPython reads a configuration file which can | |
5124 | be specified at the command line ( |
|
5147 | be specified at the command line ( | |
5125 | \family typewriter |
|
5148 | \family typewriter | |
5126 | -rcfile |
|
5149 | -rcfile | |
5127 | \family default |
|
5150 | \family default | |
5128 | ) or which by default is assumed to be called |
|
5151 | ) or which by default is assumed to be called | |
5129 | \family typewriter |
|
5152 | \family typewriter | |
5130 | ipythonrc |
|
5153 | ipythonrc | |
5131 | \family default |
|
5154 | \family default | |
5132 | . |
|
5155 | . | |
5133 | Such a file is looked for in the current directory where IPython is started |
|
5156 | Such a file is looked for in the current directory where IPython is started | |
5134 | and then in your |
|
5157 | and then in your | |
5135 | \family typewriter |
|
5158 | \family typewriter | |
5136 | IPYTHONDIR |
|
5159 | IPYTHONDIR | |
5137 | \family default |
|
5160 | \family default | |
5138 | , which allows you to have local configuration files for specific projects. |
|
5161 | , which allows you to have local configuration files for specific projects. | |
5139 | In this section we will call these types of configuration files simply |
|
5162 | In this section we will call these types of configuration files simply | |
5140 | rcfiles (short for resource configuration file). |
|
5163 | rcfiles (short for resource configuration file). | |
5141 | \layout Standard |
|
5164 | \layout Standard | |
5142 |
|
5165 | |||
5143 | The syntax of an rcfile is one of key-value pairs separated by whitespace, |
|
5166 | The syntax of an rcfile is one of key-value pairs separated by whitespace, | |
5144 | one per line. |
|
5167 | one per line. | |
5145 | Lines beginning with a |
|
5168 | Lines beginning with a | |
5146 | \family typewriter |
|
5169 | \family typewriter | |
5147 | # |
|
5170 | # | |
5148 | \family default |
|
5171 | \family default | |
5149 | are ignored as comments, but comments can |
|
5172 | are ignored as comments, but comments can | |
5150 | \series bold |
|
5173 | \series bold | |
5151 | not |
|
5174 | not | |
5152 | \series default |
|
5175 | \series default | |
5153 | be put on lines with data (the parser is fairly primitive). |
|
5176 | be put on lines with data (the parser is fairly primitive). | |
5154 | Note that these are not python files, and this is deliberate, because it |
|
5177 | Note that these are not python files, and this is deliberate, because it | |
5155 | allows us to do some things which would be quite tricky to implement if |
|
5178 | allows us to do some things which would be quite tricky to implement if | |
5156 | they were normal python files. |
|
5179 | they were normal python files. | |
5157 | \layout Standard |
|
5180 | \layout Standard | |
5158 |
|
5181 | |||
5159 | First, an rcfile can contain permanent default values for almost all command |
|
5182 | First, an rcfile can contain permanent default values for almost all command | |
5160 | line options (except things like |
|
5183 | line options (except things like | |
5161 | \family typewriter |
|
5184 | \family typewriter | |
5162 | -help |
|
5185 | -help | |
5163 | \family default |
|
5186 | \family default | |
5164 | or |
|
5187 | or | |
5165 | \family typewriter |
|
5188 | \family typewriter | |
5166 | -Version |
|
5189 | -Version | |
5167 | \family default |
|
5190 | \family default | |
5168 | ). |
|
5191 | ). | |
5169 | Sec\SpecialChar ~ |
|
5192 | Sec\SpecialChar ~ | |
5170 |
|
5193 | |||
5171 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} |
|
5194 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} | |
5172 |
|
5195 | |||
5173 | \end_inset |
|
5196 | \end_inset | |
5174 |
|
5197 | |||
5175 | contains a description of all command-line options. |
|
5198 | contains a description of all command-line options. | |
5176 | However, values you explicitly specify at the command line override the |
|
5199 | However, values you explicitly specify at the command line override the | |
5177 | values defined in the rcfile. |
|
5200 | values defined in the rcfile. | |
5178 | \layout Standard |
|
5201 | \layout Standard | |
5179 |
|
5202 | |||
5180 | Besides command line option values, the rcfile can specify values for certain |
|
5203 | Besides command line option values, the rcfile can specify values for certain | |
5181 | extra special options which are not available at the command line. |
|
5204 | extra special options which are not available at the command line. | |
5182 | These options are briefly described below. |
|
5205 | These options are briefly described below. | |
5183 |
|
5206 | |||
5184 | \layout Standard |
|
5207 | \layout Standard | |
5185 |
|
5208 | |||
5186 | Each of these options may appear as many times as you need it in the file. |
|
5209 | Each of these options may appear as many times as you need it in the file. | |
5187 | \layout List |
|
5210 | \layout List | |
5188 | \labelwidthstring 00.00.0000 |
|
5211 | \labelwidthstring 00.00.0000 | |
5189 |
|
5212 | |||
5190 |
|
5213 | |||
5191 | \family typewriter |
|
5214 | \family typewriter | |
5192 | \series bold |
|
5215 | \series bold | |
5193 | include\SpecialChar ~ |
|
5216 | include\SpecialChar ~ | |
5194 | <file1>\SpecialChar ~ |
|
5217 | <file1>\SpecialChar ~ | |
5195 | <file2>\SpecialChar ~ |
|
5218 | <file2>\SpecialChar ~ | |
5196 | ... |
|
5219 | ... | |
5197 | \family default |
|
5220 | \family default | |
5198 | \series default |
|
5221 | \series default | |
5199 | : you can name |
|
5222 | : you can name | |
5200 | \emph on |
|
5223 | \emph on | |
5201 | other |
|
5224 | other | |
5202 | \emph default |
|
5225 | \emph default | |
5203 | rcfiles you want to recursively load up to 15 levels (don't use the |
|
5226 | rcfiles you want to recursively load up to 15 levels (don't use the | |
5204 | \family typewriter |
|
5227 | \family typewriter | |
5205 | <> |
|
5228 | <> | |
5206 | \family default |
|
5229 | \family default | |
5207 | brackets in your names!). |
|
5230 | brackets in your names!). | |
5208 | This feature allows you to define a 'base' rcfile with general options |
|
5231 | This feature allows you to define a 'base' rcfile with general options | |
5209 | and special-purpose files which can be loaded only when needed with particular |
|
5232 | and special-purpose files which can be loaded only when needed with particular | |
5210 | configuration options. |
|
5233 | configuration options. | |
5211 | To make this more convenient, IPython accepts the |
|
5234 | To make this more convenient, IPython accepts the | |
5212 | \family typewriter |
|
5235 | \family typewriter | |
5213 | -profile <name> |
|
5236 | -profile <name> | |
5214 | \family default |
|
5237 | \family default | |
5215 | option (abbreviates to |
|
5238 | option (abbreviates to | |
5216 | \family typewriter |
|
5239 | \family typewriter | |
5217 | -p <name |
|
5240 | -p <name | |
5218 | \family default |
|
5241 | \family default | |
5219 | >) |
|
5242 | >) | |
5220 | \family typewriter |
|
5243 | \family typewriter | |
5221 | which |
|
5244 | which | |
5222 | \family default |
|
5245 | \family default | |
5223 | tells it to look for an rcfile named |
|
5246 | tells it to look for an rcfile named | |
5224 | \family typewriter |
|
5247 | \family typewriter | |
5225 | ipythonrc-<name> |
|
5248 | ipythonrc-<name> | |
5226 | \family default |
|
5249 | \family default | |
5227 | . |
|
5250 | . | |
5228 |
|
5251 | |||
5229 | \layout List |
|
5252 | \layout List | |
5230 | \labelwidthstring 00.00.0000 |
|
5253 | \labelwidthstring 00.00.0000 | |
5231 |
|
5254 | |||
5232 |
|
5255 | |||
5233 | \family typewriter |
|
5256 | \family typewriter | |
5234 | \series bold |
|
5257 | \series bold | |
5235 | import_mod\SpecialChar ~ |
|
5258 | import_mod\SpecialChar ~ | |
5236 | <mod1>\SpecialChar ~ |
|
5259 | <mod1>\SpecialChar ~ | |
5237 | <mod2>\SpecialChar ~ |
|
5260 | <mod2>\SpecialChar ~ | |
5238 | ... |
|
5261 | ... | |
5239 | \family default |
|
5262 | \family default | |
5240 | \series default |
|
5263 | \series default | |
5241 | : import modules with ' |
|
5264 | : import modules with ' | |
5242 | \family typewriter |
|
5265 | \family typewriter | |
5243 | import |
|
5266 | import | |
5244 | \family default |
|
5267 | \family default | |
5245 |
|
5268 | |||
5246 | \family typewriter |
|
5269 | \family typewriter | |
5247 | <mod1>,<mod2>,... |
|
5270 | <mod1>,<mod2>,... | |
5248 | \family default |
|
5271 | \family default | |
5249 | ' |
|
5272 | ' | |
5250 | \layout List |
|
5273 | \layout List | |
5251 | \labelwidthstring 00.00.0000 |
|
5274 | \labelwidthstring 00.00.0000 | |
5252 |
|
5275 | |||
5253 |
|
5276 | |||
5254 | \family typewriter |
|
5277 | \family typewriter | |
5255 | \series bold |
|
5278 | \series bold | |
5256 | import_some\SpecialChar ~ |
|
5279 | import_some\SpecialChar ~ | |
5257 | <mod>\SpecialChar ~ |
|
5280 | <mod>\SpecialChar ~ | |
5258 | <f1>\SpecialChar ~ |
|
5281 | <f1>\SpecialChar ~ | |
5259 | <f2>\SpecialChar ~ |
|
5282 | <f2>\SpecialChar ~ | |
5260 | ... |
|
5283 | ... | |
5261 | \family default |
|
5284 | \family default | |
5262 | \series default |
|
5285 | \series default | |
5263 | : import functions with ' |
|
5286 | : import functions with ' | |
5264 | \family typewriter |
|
5287 | \family typewriter | |
5265 | from <mod> import |
|
5288 | from <mod> import | |
5266 | \family default |
|
5289 | \family default | |
5267 |
|
5290 | |||
5268 | \family typewriter |
|
5291 | \family typewriter | |
5269 | <f1>,<f2>,... |
|
5292 | <f1>,<f2>,... | |
5270 | \family default |
|
5293 | \family default | |
5271 | ' |
|
5294 | ' | |
5272 | \layout List |
|
5295 | \layout List | |
5273 | \labelwidthstring 00.00.0000 |
|
5296 | \labelwidthstring 00.00.0000 | |
5274 |
|
5297 | |||
5275 |
|
5298 | |||
5276 | \family typewriter |
|
5299 | \family typewriter | |
5277 | \series bold |
|
5300 | \series bold | |
5278 | import_all\SpecialChar ~ |
|
5301 | import_all\SpecialChar ~ | |
5279 | <mod1>\SpecialChar ~ |
|
5302 | <mod1>\SpecialChar ~ | |
5280 | <mod2>\SpecialChar ~ |
|
5303 | <mod2>\SpecialChar ~ | |
5281 | ... |
|
5304 | ... | |
5282 | \family default |
|
5305 | \family default | |
5283 | \series default |
|
5306 | \series default | |
5284 | : for each module listed import functions with ' |
|
5307 | : for each module listed import functions with ' | |
5285 | \family typewriter |
|
5308 | \family typewriter | |
5286 | from <mod> import * |
|
5309 | from <mod> import * | |
5287 | \family default |
|
5310 | \family default | |
5288 | ' |
|
5311 | ' | |
5289 | \layout List |
|
5312 | \layout List | |
5290 | \labelwidthstring 00.00.0000 |
|
5313 | \labelwidthstring 00.00.0000 | |
5291 |
|
5314 | |||
5292 |
|
5315 | |||
5293 | \family typewriter |
|
5316 | \family typewriter | |
5294 | \series bold |
|
5317 | \series bold | |
5295 | execute\SpecialChar ~ |
|
5318 | execute\SpecialChar ~ | |
5296 | <python\SpecialChar ~ |
|
5319 | <python\SpecialChar ~ | |
5297 | code> |
|
5320 | code> | |
5298 | \family default |
|
5321 | \family default | |
5299 | \series default |
|
5322 | \series default | |
5300 | : give any single-line python code to be executed. |
|
5323 | : give any single-line python code to be executed. | |
5301 | \layout List |
|
5324 | \layout List | |
5302 | \labelwidthstring 00.00.0000 |
|
5325 | \labelwidthstring 00.00.0000 | |
5303 |
|
5326 | |||
5304 |
|
5327 | |||
5305 | \family typewriter |
|
5328 | \family typewriter | |
5306 | \series bold |
|
5329 | \series bold | |
5307 | execfile\SpecialChar ~ |
|
5330 | execfile\SpecialChar ~ | |
5308 | <filename> |
|
5331 | <filename> | |
5309 | \family default |
|
5332 | \family default | |
5310 | \series default |
|
5333 | \series default | |
5311 | : execute the python file given with an ' |
|
5334 | : execute the python file given with an ' | |
5312 | \family typewriter |
|
5335 | \family typewriter | |
5313 | execfile(filename) |
|
5336 | execfile(filename) | |
5314 | \family default |
|
5337 | \family default | |
5315 | ' command. |
|
5338 | ' command. | |
5316 | Username expansion is performed on the given names. |
|
5339 | Username expansion is performed on the given names. | |
5317 | So if you need any amount of extra fancy customization that won't fit in |
|
5340 | So if you need any amount of extra fancy customization that won't fit in | |
5318 | any of the above 'canned' options, you can just put it in a separate python |
|
5341 | any of the above 'canned' options, you can just put it in a separate python | |
5319 | file and execute it. |
|
5342 | file and execute it. | |
5320 | \layout List |
|
5343 | \layout List | |
5321 | \labelwidthstring 00.00.0000 |
|
5344 | \labelwidthstring 00.00.0000 | |
5322 |
|
5345 | |||
5323 |
|
5346 | |||
5324 | \family typewriter |
|
5347 | \family typewriter | |
5325 | \series bold |
|
5348 | \series bold | |
5326 | alias\SpecialChar ~ |
|
5349 | alias\SpecialChar ~ | |
5327 | <alias_def> |
|
5350 | <alias_def> | |
5328 | \family default |
|
5351 | \family default | |
5329 | \series default |
|
5352 | \series default | |
5330 | : this is equivalent to calling ' |
|
5353 | : this is equivalent to calling ' | |
5331 | \family typewriter |
|
5354 | \family typewriter | |
5332 | %alias\SpecialChar ~ |
|
5355 | %alias\SpecialChar ~ | |
5333 | <alias_def> |
|
5356 | <alias_def> | |
5334 | \family default |
|
5357 | \family default | |
5335 | ' at the IPython command line. |
|
5358 | ' at the IPython command line. | |
5336 | This way, from within IPython you can do common system tasks without having |
|
5359 | This way, from within IPython you can do common system tasks without having | |
5337 | to exit it or use the |
|
5360 | to exit it or use the | |
5338 | \family typewriter |
|
5361 | \family typewriter | |
5339 | ! |
|
5362 | ! | |
5340 | \family default |
|
5363 | \family default | |
5341 | escape. |
|
5364 | escape. | |
5342 | IPython isn't meant to be a shell replacement, but it is often very useful |
|
5365 | IPython isn't meant to be a shell replacement, but it is often very useful | |
5343 | to be able to do things with files while testing code. |
|
5366 | to be able to do things with files while testing code. | |
5344 | This gives you the flexibility to have within IPython any aliases you may |
|
5367 | This gives you the flexibility to have within IPython any aliases you may | |
5345 | be used to under your normal system shell. |
|
5368 | be used to under your normal system shell. | |
5346 | \layout Subsection |
|
5369 | \layout Subsection | |
5347 |
|
5370 | |||
5348 |
|
5371 | |||
5349 | \begin_inset LatexCommand \label{sec:ipytonrc-sample} |
|
5372 | \begin_inset LatexCommand \label{sec:ipytonrc-sample} | |
5350 |
|
5373 | |||
5351 | \end_inset |
|
5374 | \end_inset | |
5352 |
|
5375 | |||
5353 | Sample |
|
5376 | Sample | |
5354 | \family typewriter |
|
5377 | \family typewriter | |
5355 | ipythonrc |
|
5378 | ipythonrc | |
5356 | \family default |
|
5379 | \family default | |
5357 | file |
|
5380 | file | |
5358 | \layout Standard |
|
5381 | \layout Standard | |
5359 |
|
5382 | |||
5360 | The default rcfile, called |
|
5383 | The default rcfile, called | |
5361 | \family typewriter |
|
5384 | \family typewriter | |
5362 | ipythonrc |
|
5385 | ipythonrc | |
5363 | \family default |
|
5386 | \family default | |
5364 | and supplied in your |
|
5387 | and supplied in your | |
5365 | \family typewriter |
|
5388 | \family typewriter | |
5366 | IPYTHONDIR |
|
5389 | IPYTHONDIR | |
5367 | \family default |
|
5390 | \family default | |
5368 | directory contains lots of comments on all of these options. |
|
5391 | directory contains lots of comments on all of these options. | |
5369 | We reproduce it here for reference: |
|
5392 | We reproduce it here for reference: | |
5370 | \layout Standard |
|
5393 | \layout Standard | |
5371 |
|
5394 | |||
5372 |
|
5395 | |||
5373 | \begin_inset ERT |
|
5396 | \begin_inset ERT | |
5374 | status Open |
|
5397 | status Open | |
5375 |
|
5398 | |||
5376 | \layout Standard |
|
5399 | \layout Standard | |
5377 |
|
5400 | |||
5378 | \backslash |
|
5401 | \backslash | |
5379 |
|
|
5402 | codelist{../IPython/UserConfig/ipythonrc} | |
5380 | \end_inset |
|
5403 | \end_inset | |
5381 |
|
5404 | |||
5382 |
|
5405 | |||
5383 | \layout Subsection |
|
5406 | \layout Subsection | |
5384 |
|
5407 | |||
5385 |
|
5408 | |||
5386 | \begin_inset LatexCommand \label{sec:prompts} |
|
5409 | \begin_inset LatexCommand \label{sec:prompts} | |
5387 |
|
5410 | |||
5388 | \end_inset |
|
5411 | \end_inset | |
5389 |
|
5412 | |||
5390 | Fine-tuning your prompt |
|
5413 | Fine-tuning your prompt | |
5391 | \layout Standard |
|
5414 | \layout Standard | |
5392 |
|
5415 | |||
5393 | IPython's prompts can be customized using a syntax similar to that of the |
|
5416 | IPython's prompts can be customized using a syntax similar to that of the | |
5394 |
|
5417 | |||
5395 | \family typewriter |
|
5418 | \family typewriter | |
5396 | bash |
|
5419 | bash | |
5397 | \family default |
|
5420 | \family default | |
5398 | shell. |
|
5421 | shell. | |
5399 | Many of |
|
5422 | Many of | |
5400 | \family typewriter |
|
5423 | \family typewriter | |
5401 | bash |
|
5424 | bash | |
5402 | \family default |
|
5425 | \family default | |
5403 | 's escapes are supported, as well as a few additional ones. |
|
5426 | 's escapes are supported, as well as a few additional ones. | |
5404 | We list them below: |
|
5427 | We list them below: | |
5405 | \layout Description |
|
5428 | \layout Description | |
5406 |
|
5429 | |||
5407 |
|
5430 | |||
5408 | \backslash |
|
5431 | \backslash | |
5409 | # the prompt/history count number |
|
5432 | # the prompt/history count number | |
5410 | \layout Description |
|
5433 | \layout Description | |
5411 |
|
5434 | |||
5412 |
|
5435 | |||
5413 | \backslash |
|
5436 | \backslash | |
5414 | D the prompt/history count, with the actual digits replaced by dots. |
|
5437 | D the prompt/history count, with the actual digits replaced by dots. | |
5415 | Used mainly in continuation prompts (prompt_in2) |
|
5438 | Used mainly in continuation prompts (prompt_in2) | |
5416 | \layout Description |
|
5439 | \layout Description | |
5417 |
|
5440 | |||
5418 |
|
5441 | |||
5419 | \backslash |
|
5442 | \backslash | |
5420 | w the current working directory |
|
5443 | w the current working directory | |
5421 | \layout Description |
|
5444 | \layout Description | |
5422 |
|
5445 | |||
5423 |
|
5446 | |||
5424 | \backslash |
|
5447 | \backslash | |
5425 | W the basename of current working directory |
|
5448 | W the basename of current working directory | |
5426 | \layout Description |
|
5449 | \layout Description | |
5427 |
|
5450 | |||
5428 |
|
5451 | |||
5429 | \backslash |
|
5452 | \backslash | |
5430 | X |
|
5453 | X | |
5431 | \emph on |
|
5454 | \emph on | |
5432 | n |
|
5455 | n | |
5433 | \emph default |
|
5456 | \emph default | |
5434 | where |
|
5457 | where | |
5435 | \begin_inset Formula $n=0\ldots5.$ |
|
5458 | \begin_inset Formula $n=0\ldots5.$ | |
5436 | \end_inset |
|
5459 | \end_inset | |
5437 |
|
5460 | |||
5438 | The current working directory, with |
|
5461 | The current working directory, with | |
5439 | \family typewriter |
|
5462 | \family typewriter | |
5440 | $HOME |
|
5463 | $HOME | |
5441 | \family default |
|
5464 | \family default | |
5442 | replaced by |
|
5465 | replaced by | |
5443 | \family typewriter |
|
5466 | \family typewriter | |
5444 | ~ |
|
5467 | ~ | |
5445 | \family default |
|
5468 | \family default | |
5446 | , and filtered out to contain only |
|
5469 | , and filtered out to contain only | |
5447 | \begin_inset Formula $n$ |
|
5470 | \begin_inset Formula $n$ | |
5448 | \end_inset |
|
5471 | \end_inset | |
5449 |
|
5472 | |||
5450 | path elements |
|
5473 | path elements | |
5451 | \layout Description |
|
5474 | \layout Description | |
5452 |
|
5475 | |||
5453 |
|
5476 | |||
5454 | \backslash |
|
5477 | \backslash | |
5455 | Y |
|
5478 | Y | |
5456 | \emph on |
|
5479 | \emph on | |
5457 | n |
|
5480 | n | |
5458 | \emph default |
|
5481 | \emph default | |
5459 | Similar to |
|
5482 | Similar to | |
5460 | \backslash |
|
5483 | \backslash | |
5461 | X |
|
5484 | X | |
5462 | \emph on |
|
5485 | \emph on | |
5463 | n |
|
5486 | n | |
5464 | \emph default |
|
5487 | \emph default | |
5465 | , but with the |
|
5488 | , but with the | |
5466 | \begin_inset Formula $n+1$ |
|
5489 | \begin_inset Formula $n+1$ | |
5467 | \end_inset |
|
5490 | \end_inset | |
5468 |
|
5491 | |||
5469 | element included if it is |
|
5492 | element included if it is | |
5470 | \family typewriter |
|
5493 | \family typewriter | |
5471 | ~ |
|
5494 | ~ | |
5472 | \family default |
|
5495 | \family default | |
5473 | (this is similar to the behavior of the %c |
|
5496 | (this is similar to the behavior of the %c | |
5474 | \emph on |
|
5497 | \emph on | |
5475 | n |
|
5498 | n | |
5476 | \emph default |
|
5499 | \emph default | |
5477 | escapes in |
|
5500 | escapes in | |
5478 | \family typewriter |
|
5501 | \family typewriter | |
5479 | tcsh |
|
5502 | tcsh | |
5480 | \family default |
|
5503 | \family default | |
5481 | ) |
|
5504 | ) | |
5482 | \layout Description |
|
5505 | \layout Description | |
5483 |
|
5506 | |||
5484 |
|
5507 | |||
5485 | \backslash |
|
5508 | \backslash | |
5486 | u the username of the current user |
|
5509 | u the username of the current user | |
5487 | \layout Description |
|
5510 | \layout Description | |
5488 |
|
5511 | |||
5489 |
|
5512 | |||
5490 | \backslash |
|
5513 | \backslash | |
5491 | $ if the effective UID is 0, a #, otherwise a $ |
|
5514 | $ if the effective UID is 0, a #, otherwise a $ | |
5492 | \layout Description |
|
5515 | \layout Description | |
5493 |
|
5516 | |||
5494 |
|
5517 | |||
5495 | \backslash |
|
5518 | \backslash | |
5496 | h the hostname up to the first `.' |
|
5519 | h the hostname up to the first `.' | |
5497 | \layout Description |
|
5520 | \layout Description | |
5498 |
|
5521 | |||
5499 |
|
5522 | |||
5500 | \backslash |
|
5523 | \backslash | |
5501 | H the hostname |
|
5524 | H the hostname | |
5502 | \layout Description |
|
5525 | \layout Description | |
5503 |
|
5526 | |||
5504 |
|
5527 | |||
5505 | \backslash |
|
5528 | \backslash | |
5506 | n a newline |
|
5529 | n a newline | |
5507 | \layout Description |
|
5530 | \layout Description | |
5508 |
|
5531 | |||
5509 |
|
5532 | |||
5510 | \backslash |
|
5533 | \backslash | |
5511 | r a carriage return |
|
5534 | r a carriage return | |
5512 | \layout Description |
|
5535 | \layout Description | |
5513 |
|
5536 | |||
5514 |
|
5537 | |||
5515 | \backslash |
|
5538 | \backslash | |
5516 | v IPython version string |
|
5539 | v IPython version string | |
5517 | \layout Standard |
|
5540 | \layout Standard | |
5518 |
|
5541 | |||
5519 | In addition to these, ANSI color escapes can be insterted into the prompts, |
|
5542 | In addition to these, ANSI color escapes can be insterted into the prompts, | |
5520 | as |
|
5543 | as | |
5521 | \family typewriter |
|
5544 | \family typewriter | |
5522 |
|
5545 | |||
5523 | \backslash |
|
5546 | \backslash | |
5524 | C_ |
|
5547 | C_ | |
5525 | \emph on |
|
5548 | \emph on | |
5526 | ColorName |
|
5549 | ColorName | |
5527 | \family default |
|
5550 | \family default | |
5528 | \emph default |
|
5551 | \emph default | |
5529 | . |
|
5552 | . | |
5530 | The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green, |
|
5553 | The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green, | |
5531 | LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor, |
|
5554 | LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor, | |
5532 | Normal, Purple, Red, White, Yellow. |
|
5555 | Normal, Purple, Red, White, Yellow. | |
5533 | \layout Standard |
|
5556 | \layout Standard | |
5534 |
|
5557 | |||
5535 | Finally, IPython supports the evaluation of arbitrary expressions in your |
|
5558 | Finally, IPython supports the evaluation of arbitrary expressions in your | |
5536 | prompt string. |
|
5559 | prompt string. | |
5537 | The prompt strings are evaluated through the syntax of PEP 215, but basically |
|
5560 | The prompt strings are evaluated through the syntax of PEP 215, but basically | |
5538 | you can use |
|
5561 | you can use | |
5539 | \family typewriter |
|
5562 | \family typewriter | |
5540 | $x.y |
|
5563 | $x.y | |
5541 | \family default |
|
5564 | \family default | |
5542 | to expand the value of |
|
5565 | to expand the value of | |
5543 | \family typewriter |
|
5566 | \family typewriter | |
5544 | x.y |
|
5567 | x.y | |
5545 | \family default |
|
5568 | \family default | |
5546 | , and for more complicated expressions you can use braces: |
|
5569 | , and for more complicated expressions you can use braces: | |
5547 | \family typewriter |
|
5570 | \family typewriter | |
5548 | ${foo()+x} |
|
5571 | ${foo()+x} | |
5549 | \family default |
|
5572 | \family default | |
5550 | will call function |
|
5573 | will call function | |
5551 | \family typewriter |
|
5574 | \family typewriter | |
5552 | foo |
|
5575 | foo | |
5553 | \family default |
|
5576 | \family default | |
5554 | and add to it the value of |
|
5577 | and add to it the value of | |
5555 | \family typewriter |
|
5578 | \family typewriter | |
5556 | x |
|
5579 | x | |
5557 | \family default |
|
5580 | \family default | |
5558 | , before putting the result into your prompt. |
|
5581 | , before putting the result into your prompt. | |
5559 | For example, using |
|
5582 | For example, using | |
5560 | \newline |
|
5583 | \newline | |
5561 |
|
5584 | |||
5562 | \family typewriter |
|
5585 | \family typewriter | |
5563 | prompt_in1 '${commands.getoutput("uptime")} |
|
5586 | prompt_in1 '${commands.getoutput("uptime")} | |
5564 | \backslash |
|
5587 | \backslash | |
5565 | nIn [ |
|
5588 | nIn [ | |
5566 | \backslash |
|
5589 | \backslash | |
5567 | #]: ' |
|
5590 | #]: ' | |
5568 | \newline |
|
5591 | \newline | |
5569 |
|
5592 | |||
5570 | \family default |
|
5593 | \family default | |
5571 | will print the result of the uptime command on each prompt (assuming the |
|
5594 | will print the result of the uptime command on each prompt (assuming the | |
5572 |
|
5595 | |||
5573 | \family typewriter |
|
5596 | \family typewriter | |
5574 | commands |
|
5597 | commands | |
5575 | \family default |
|
5598 | \family default | |
5576 | module has been imported in your |
|
5599 | module has been imported in your | |
5577 | \family typewriter |
|
5600 | \family typewriter | |
5578 | ipythonrc |
|
5601 | ipythonrc | |
5579 | \family default |
|
5602 | \family default | |
5580 | file). |
|
5603 | file). | |
5581 | \layout Subsubsection |
|
5604 | \layout Subsubsection | |
5582 |
|
5605 | |||
5583 | Prompt examples |
|
5606 | Prompt examples | |
5584 | \layout Standard |
|
5607 | \layout Standard | |
5585 |
|
5608 | |||
5586 | The following options in an ipythonrc file will give you IPython's default |
|
5609 | The following options in an ipythonrc file will give you IPython's default | |
5587 | prompts: |
|
5610 | prompts: | |
5588 | \layout Standard |
|
5611 | \layout Standard | |
5589 |
|
5612 | |||
5590 |
|
5613 | |||
5591 | \family typewriter |
|
5614 | \family typewriter | |
5592 | prompt_in1 'In [ |
|
5615 | prompt_in1 'In [ | |
5593 | \backslash |
|
5616 | \backslash | |
5594 | #]:' |
|
5617 | #]:' | |
5595 | \newline |
|
5618 | \newline | |
5596 | prompt_in2 '\SpecialChar ~ |
|
5619 | prompt_in2 '\SpecialChar ~ | |
5597 | \SpecialChar ~ |
|
5620 | \SpecialChar ~ | |
5598 | \SpecialChar ~ |
|
5621 | \SpecialChar ~ | |
5599 | . |
|
5622 | . | |
5600 | \backslash |
|
5623 | \backslash | |
5601 | D.:' |
|
5624 | D.:' | |
5602 | \newline |
|
5625 | \newline | |
5603 | prompt_out 'Out[ |
|
5626 | prompt_out 'Out[ | |
5604 | \backslash |
|
5627 | \backslash | |
5605 | #]:' |
|
5628 | #]:' | |
5606 | \layout Standard |
|
5629 | \layout Standard | |
5607 |
|
5630 | |||
5608 | which look like this: |
|
5631 | which look like this: | |
5609 | \layout Standard |
|
5632 | \layout Standard | |
5610 |
|
5633 | |||
5611 |
|
5634 | |||
5612 | \family typewriter |
|
5635 | \family typewriter | |
5613 | In [1]: 1+2 |
|
5636 | In [1]: 1+2 | |
5614 | \newline |
|
5637 | \newline | |
5615 | Out[1]: 3 |
|
5638 | Out[1]: 3 | |
5616 | \layout Standard |
|
5639 | \layout Standard | |
5617 |
|
5640 | |||
5618 |
|
5641 | |||
5619 | \family typewriter |
|
5642 | \family typewriter | |
5620 | In [2]: for i in (1,2,3): |
|
5643 | In [2]: for i in (1,2,3): | |
5621 | \newline |
|
5644 | \newline | |
5622 |
|
5645 | |||
5623 | \begin_inset ERT |
|
5646 | \begin_inset ERT | |
5624 | status Collapsed |
|
5647 | status Collapsed | |
5625 |
|
5648 | |||
5626 | \layout Standard |
|
5649 | \layout Standard | |
5627 |
|
5650 | |||
5628 | \backslash |
|
5651 | \backslash | |
5629 | hspace*{0mm} |
|
5652 | hspace*{0mm} | |
5630 | \end_inset |
|
5653 | \end_inset | |
5631 |
|
5654 | |||
5632 | \SpecialChar ~ |
|
5655 | \SpecialChar ~ | |
5633 | \SpecialChar ~ |
|
5656 | \SpecialChar ~ | |
5634 | \SpecialChar ~ |
|
5657 | \SpecialChar ~ | |
5635 | ...: \SpecialChar ~ |
|
5658 | ...: \SpecialChar ~ | |
5636 | \SpecialChar ~ |
|
5659 | \SpecialChar ~ | |
5637 | \SpecialChar ~ |
|
5660 | \SpecialChar ~ | |
5638 | \SpecialChar ~ |
|
5661 | \SpecialChar ~ | |
5639 | print i, |
|
5662 | print i, | |
5640 | \newline |
|
5663 | \newline | |
5641 |
|
5664 | |||
5642 | \begin_inset ERT |
|
5665 | \begin_inset ERT | |
5643 | status Collapsed |
|
5666 | status Collapsed | |
5644 |
|
5667 | |||
5645 | \layout Standard |
|
5668 | \layout Standard | |
5646 |
|
5669 | |||
5647 | \backslash |
|
5670 | \backslash | |
5648 | hspace*{0mm} |
|
5671 | hspace*{0mm} | |
5649 | \end_inset |
|
5672 | \end_inset | |
5650 |
|
5673 | |||
5651 | \SpecialChar ~ |
|
5674 | \SpecialChar ~ | |
5652 | \SpecialChar ~ |
|
5675 | \SpecialChar ~ | |
5653 | \SpecialChar ~ |
|
5676 | \SpecialChar ~ | |
5654 | ...: |
|
5677 | ...: | |
5655 | \newline |
|
5678 | \newline | |
5656 | 1 2 3 |
|
5679 | 1 2 3 | |
5657 | \layout Standard |
|
5680 | \layout Standard | |
5658 |
|
5681 | |||
5659 | These will give you a very colorful prompt with path information: |
|
5682 | These will give you a very colorful prompt with path information: | |
5660 | \layout Standard |
|
5683 | \layout Standard | |
5661 |
|
5684 | |||
5662 |
|
5685 | |||
5663 | \family typewriter |
|
5686 | \family typewriter | |
5664 | #prompt_in1 ' |
|
5687 | #prompt_in1 ' | |
5665 | \backslash |
|
5688 | \backslash | |
5666 | C_Red |
|
5689 | C_Red | |
5667 | \backslash |
|
5690 | \backslash | |
5668 | u |
|
5691 | u | |
5669 | \backslash |
|
5692 | \backslash | |
5670 | C_Blue[ |
|
5693 | C_Blue[ | |
5671 | \backslash |
|
5694 | \backslash | |
5672 | C_Cyan |
|
5695 | C_Cyan | |
5673 | \backslash |
|
5696 | \backslash | |
5674 | Y1 |
|
5697 | Y1 | |
5675 | \backslash |
|
5698 | \backslash | |
5676 | C_Blue] |
|
5699 | C_Blue] | |
5677 | \backslash |
|
5700 | \backslash | |
5678 | C_LightGreen |
|
5701 | C_LightGreen | |
5679 | \backslash |
|
5702 | \backslash | |
5680 | #>' |
|
5703 | #>' | |
5681 | \newline |
|
5704 | \newline | |
5682 | prompt_in2 ' .. |
|
5705 | prompt_in2 ' .. | |
5683 | \backslash |
|
5706 | \backslash | |
5684 | D>' |
|
5707 | D>' | |
5685 | \newline |
|
5708 | \newline | |
5686 | prompt_out '< |
|
5709 | prompt_out '< | |
5687 | \backslash |
|
5710 | \backslash | |
5688 | #>' |
|
5711 | #>' | |
5689 | \layout Standard |
|
5712 | \layout Standard | |
5690 |
|
5713 | |||
5691 | which look like this: |
|
5714 | which look like this: | |
5692 | \layout Standard |
|
5715 | \layout Standard | |
5693 |
|
5716 | |||
5694 |
|
5717 | |||
5695 | \family typewriter |
|
5718 | \family typewriter | |
5696 | \color red |
|
5719 | \color red | |
5697 | fperez |
|
5720 | fperez | |
5698 | \color blue |
|
5721 | \color blue | |
5699 | [ |
|
5722 | [ | |
5700 | \color cyan |
|
5723 | \color cyan | |
5701 | ~/ipython |
|
5724 | ~/ipython | |
5702 | \color blue |
|
5725 | \color blue | |
5703 | ] |
|
5726 | ] | |
5704 | \color green |
|
5727 | \color green | |
5705 | 1> |
|
5728 | 1> | |
5706 | \color default |
|
5729 | \color default | |
5707 | 1+2 |
|
5730 | 1+2 | |
5708 | \newline |
|
5731 | \newline | |
5709 |
|
5732 | |||
5710 | \begin_inset ERT |
|
5733 | \begin_inset ERT | |
5711 | status Collapsed |
|
5734 | status Collapsed | |
5712 |
|
5735 | |||
5713 | \layout Standard |
|
5736 | \layout Standard | |
5714 |
|
5737 | |||
5715 | \backslash |
|
5738 | \backslash | |
5716 | hspace*{0mm} |
|
5739 | hspace*{0mm} | |
5717 | \end_inset |
|
5740 | \end_inset | |
5718 |
|
5741 | |||
5719 | \SpecialChar ~ |
|
5742 | \SpecialChar ~ | |
5720 | \SpecialChar ~ |
|
5743 | \SpecialChar ~ | |
5721 | \SpecialChar ~ |
|
5744 | \SpecialChar ~ | |
5722 | \SpecialChar ~ |
|
5745 | \SpecialChar ~ | |
5723 | \SpecialChar ~ |
|
5746 | \SpecialChar ~ | |
5724 | \SpecialChar ~ |
|
5747 | \SpecialChar ~ | |
5725 | \SpecialChar ~ |
|
5748 | \SpecialChar ~ | |
5726 | \SpecialChar ~ |
|
5749 | \SpecialChar ~ | |
5727 | \SpecialChar ~ |
|
5750 | \SpecialChar ~ | |
5728 | \SpecialChar ~ |
|
5751 | \SpecialChar ~ | |
5729 | \SpecialChar ~ |
|
5752 | \SpecialChar ~ | |
5730 | \SpecialChar ~ |
|
5753 | \SpecialChar ~ | |
5731 | \SpecialChar ~ |
|
5754 | \SpecialChar ~ | |
5732 | \SpecialChar ~ |
|
5755 | \SpecialChar ~ | |
5733 | \SpecialChar ~ |
|
5756 | \SpecialChar ~ | |
5734 | \SpecialChar ~ |
|
5757 | \SpecialChar ~ | |
5735 |
|
5758 | |||
5736 | \color red |
|
5759 | \color red | |
5737 | <1> |
|
5760 | <1> | |
5738 | \color default |
|
5761 | \color default | |
5739 | 3 |
|
5762 | 3 | |
5740 | \newline |
|
5763 | \newline | |
5741 |
|
5764 | |||
5742 | \color red |
|
5765 | \color red | |
5743 | fperez |
|
5766 | fperez | |
5744 | \color blue |
|
5767 | \color blue | |
5745 | [ |
|
5768 | [ | |
5746 | \color cyan |
|
5769 | \color cyan | |
5747 | ~/ipython |
|
5770 | ~/ipython | |
5748 | \color blue |
|
5771 | \color blue | |
5749 | ] |
|
5772 | ] | |
5750 | \color green |
|
5773 | \color green | |
5751 | 2> |
|
5774 | 2> | |
5752 | \color default |
|
5775 | \color default | |
5753 | for i in (1,2,3): |
|
5776 | for i in (1,2,3): | |
5754 | \newline |
|
5777 | \newline | |
5755 |
|
5778 | |||
5756 | \begin_inset ERT |
|
5779 | \begin_inset ERT | |
5757 | status Collapsed |
|
5780 | status Collapsed | |
5758 |
|
5781 | |||
5759 | \layout Standard |
|
5782 | \layout Standard | |
5760 |
|
5783 | |||
5761 | \backslash |
|
5784 | \backslash | |
5762 | hspace*{0mm} |
|
5785 | hspace*{0mm} | |
5763 | \end_inset |
|
5786 | \end_inset | |
5764 |
|
5787 | |||
5765 | \SpecialChar ~ |
|
5788 | \SpecialChar ~ | |
5766 | \SpecialChar ~ |
|
5789 | \SpecialChar ~ | |
5767 | \SpecialChar ~ |
|
5790 | \SpecialChar ~ | |
5768 | \SpecialChar ~ |
|
5791 | \SpecialChar ~ | |
5769 | \SpecialChar ~ |
|
5792 | \SpecialChar ~ | |
5770 | \SpecialChar ~ |
|
5793 | \SpecialChar ~ | |
5771 | \SpecialChar ~ |
|
5794 | \SpecialChar ~ | |
5772 | \SpecialChar ~ |
|
5795 | \SpecialChar ~ | |
5773 | \SpecialChar ~ |
|
5796 | \SpecialChar ~ | |
5774 | \SpecialChar ~ |
|
5797 | \SpecialChar ~ | |
5775 | \SpecialChar ~ |
|
5798 | \SpecialChar ~ | |
5776 | \SpecialChar ~ |
|
5799 | \SpecialChar ~ | |
5777 | \SpecialChar ~ |
|
5800 | \SpecialChar ~ | |
5778 | \SpecialChar ~ |
|
5801 | \SpecialChar ~ | |
5779 | \SpecialChar ~ |
|
5802 | \SpecialChar ~ | |
5780 |
|
5803 | |||
5781 | \color green |
|
5804 | \color green | |
5782 | ...> |
|
5805 | ...> | |
5783 | \color default |
|
5806 | \color default | |
5784 | \SpecialChar ~ |
|
5807 | \SpecialChar ~ | |
5785 | \SpecialChar ~ |
|
5808 | \SpecialChar ~ | |
5786 | \SpecialChar ~ |
|
5809 | \SpecialChar ~ | |
5787 | \SpecialChar ~ |
|
5810 | \SpecialChar ~ | |
5788 | print i, |
|
5811 | print i, | |
5789 | \newline |
|
5812 | \newline | |
5790 |
|
5813 | |||
5791 | \begin_inset ERT |
|
5814 | \begin_inset ERT | |
5792 | status Collapsed |
|
5815 | status Collapsed | |
5793 |
|
5816 | |||
5794 | \layout Standard |
|
5817 | \layout Standard | |
5795 |
|
5818 | |||
5796 | \backslash |
|
5819 | \backslash | |
5797 | hspace*{0mm} |
|
5820 | hspace*{0mm} | |
5798 | \end_inset |
|
5821 | \end_inset | |
5799 |
|
5822 | |||
5800 | \SpecialChar ~ |
|
5823 | \SpecialChar ~ | |
5801 | \SpecialChar ~ |
|
5824 | \SpecialChar ~ | |
5802 | \SpecialChar ~ |
|
5825 | \SpecialChar ~ | |
5803 | \SpecialChar ~ |
|
5826 | \SpecialChar ~ | |
5804 | \SpecialChar ~ |
|
5827 | \SpecialChar ~ | |
5805 | \SpecialChar ~ |
|
5828 | \SpecialChar ~ | |
5806 | \SpecialChar ~ |
|
5829 | \SpecialChar ~ | |
5807 | \SpecialChar ~ |
|
5830 | \SpecialChar ~ | |
5808 | \SpecialChar ~ |
|
5831 | \SpecialChar ~ | |
5809 | \SpecialChar ~ |
|
5832 | \SpecialChar ~ | |
5810 | \SpecialChar ~ |
|
5833 | \SpecialChar ~ | |
5811 | \SpecialChar ~ |
|
5834 | \SpecialChar ~ | |
5812 | \SpecialChar ~ |
|
5835 | \SpecialChar ~ | |
5813 | \SpecialChar ~ |
|
5836 | \SpecialChar ~ | |
5814 | \SpecialChar ~ |
|
5837 | \SpecialChar ~ | |
5815 |
|
5838 | |||
5816 | \color green |
|
5839 | \color green | |
5817 | ...> |
|
5840 | ...> | |
5818 | \color default |
|
5841 | \color default | |
5819 |
|
5842 | |||
5820 | \newline |
|
5843 | \newline | |
5821 | 1 2 3 |
|
5844 | 1 2 3 | |
5822 | \layout Standard |
|
5845 | \layout Standard | |
5823 |
|
5846 | |||
5824 | The following shows the usage of dynamic expression evaluation: |
|
5847 | The following shows the usage of dynamic expression evaluation: | |
5825 | \layout Subsection |
|
5848 | \layout Subsection | |
5826 |
|
5849 | |||
5827 |
|
5850 | |||
5828 | \begin_inset LatexCommand \label{sec:profiles} |
|
5851 | \begin_inset LatexCommand \label{sec:profiles} | |
5829 |
|
5852 | |||
5830 | \end_inset |
|
5853 | \end_inset | |
5831 |
|
5854 | |||
5832 | IPython profiles |
|
5855 | IPython profiles | |
5833 | \layout Standard |
|
5856 | \layout Standard | |
5834 |
|
5857 | |||
5835 | As we already mentioned, IPython supports the |
|
5858 | As we already mentioned, IPython supports the | |
5836 | \family typewriter |
|
5859 | \family typewriter | |
5837 | -profile |
|
5860 | -profile | |
5838 | \family default |
|
5861 | \family default | |
5839 | command-line option (see sec. |
|
5862 | command-line option (see sec. | |
5840 |
|
5863 | |||
5841 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} |
|
5864 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} | |
5842 |
|
5865 | |||
5843 | \end_inset |
|
5866 | \end_inset | |
5844 |
|
5867 | |||
5845 | ). |
|
5868 | ). | |
5846 | A profile is nothing more than a particular configuration file like your |
|
5869 | A profile is nothing more than a particular configuration file like your | |
5847 | basic |
|
5870 | basic | |
5848 | \family typewriter |
|
5871 | \family typewriter | |
5849 | ipythonrc |
|
5872 | ipythonrc | |
5850 | \family default |
|
5873 | \family default | |
5851 | one, but with particular customizations for a specific purpose. |
|
5874 | one, but with particular customizations for a specific purpose. | |
5852 | When you start IPython with ' |
|
5875 | When you start IPython with ' | |
5853 | \family typewriter |
|
5876 | \family typewriter | |
5854 | ipython -profile <name> |
|
5877 | ipython -profile <name> | |
5855 | \family default |
|
5878 | \family default | |
5856 | ', it assumes that in your |
|
5879 | ', it assumes that in your | |
5857 | \family typewriter |
|
5880 | \family typewriter | |
5858 | IPYTHONDIR |
|
5881 | IPYTHONDIR | |
5859 | \family default |
|
5882 | \family default | |
5860 | there is a file called |
|
5883 | there is a file called | |
5861 | \family typewriter |
|
5884 | \family typewriter | |
5862 | ipythonrc-<name> |
|
5885 | ipythonrc-<name> | |
5863 | \family default |
|
5886 | \family default | |
5864 | , and loads it instead of the normal |
|
5887 | , and loads it instead of the normal | |
5865 | \family typewriter |
|
5888 | \family typewriter | |
5866 | ipythonrc |
|
5889 | ipythonrc | |
5867 | \family default |
|
5890 | \family default | |
5868 | . |
|
5891 | . | |
5869 | \layout Standard |
|
5892 | \layout Standard | |
5870 |
|
5893 | |||
5871 | This system allows you to maintain multiple configurations which load modules, |
|
5894 | This system allows you to maintain multiple configurations which load modules, | |
5872 | set options, define functions, etc. |
|
5895 | set options, define functions, etc. | |
5873 | suitable for different tasks and activate them in a very simple manner. |
|
5896 | suitable for different tasks and activate them in a very simple manner. | |
5874 | In order to avoid having to repeat all of your basic options (common things |
|
5897 | In order to avoid having to repeat all of your basic options (common things | |
5875 | that don't change such as your color preferences, for example), any profile |
|
5898 | that don't change such as your color preferences, for example), any profile | |
5876 | can include another configuration file. |
|
5899 | can include another configuration file. | |
5877 | The most common way to use profiles is then to have each one include your |
|
5900 | The most common way to use profiles is then to have each one include your | |
5878 | basic |
|
5901 | basic | |
5879 | \family typewriter |
|
5902 | \family typewriter | |
5880 | ipythonrc |
|
5903 | ipythonrc | |
5881 | \family default |
|
5904 | \family default | |
5882 | file as a starting point, and then add further customizations. |
|
5905 | file as a starting point, and then add further customizations. | |
5883 | \layout Standard |
|
5906 | \layout Standard | |
5884 |
|
5907 | |||
5885 | In sections |
|
5908 | In sections | |
5886 | \begin_inset LatexCommand \ref{sec:syntax-extensions} |
|
5909 | \begin_inset LatexCommand \ref{sec:syntax-extensions} | |
5887 |
|
5910 | |||
5888 | \end_inset |
|
5911 | \end_inset | |
5889 |
|
5912 | |||
5890 | and |
|
5913 | and | |
5891 | \begin_inset LatexCommand \ref{sec:Gnuplot} |
|
5914 | \begin_inset LatexCommand \ref{sec:Gnuplot} | |
5892 |
|
5915 | |||
5893 | \end_inset |
|
5916 | \end_inset | |
5894 |
|
5917 | |||
5895 | we discuss some particular profiles which come as part of the standard |
|
5918 | we discuss some particular profiles which come as part of the standard | |
5896 | IPython distribution. |
|
5919 | IPython distribution. | |
5897 | You may also look in your |
|
5920 | You may also look in your | |
5898 | \family typewriter |
|
5921 | \family typewriter | |
5899 | IPYTHONDIR |
|
5922 | IPYTHONDIR | |
5900 | \family default |
|
5923 | \family default | |
5901 | directory, any file whose name begins with |
|
5924 | directory, any file whose name begins with | |
5902 | \family typewriter |
|
5925 | \family typewriter | |
5903 | ipythonrc- |
|
5926 | ipythonrc- | |
5904 | \family default |
|
5927 | \family default | |
5905 | is a profile. |
|
5928 | is a profile. | |
5906 | You can use those as examples for further customizations to suit your own |
|
5929 | You can use those as examples for further customizations to suit your own | |
5907 | needs. |
|
5930 | needs. | |
5908 | \layout Section |
|
5931 | \layout Section | |
5909 |
|
5932 | |||
5910 |
|
5933 | |||
5911 | \begin_inset OptArg |
|
5934 | \begin_inset OptArg | |
5912 | collapsed false |
|
5935 | collapsed false | |
5913 |
|
5936 | |||
5914 | \layout Standard |
|
5937 | \layout Standard | |
5915 |
|
5938 | |||
5916 | IPython as default... |
|
5939 | IPython as default... | |
5917 | \end_inset |
|
5940 | \end_inset | |
5918 |
|
5941 | |||
5919 | IPython as your default Python environment |
|
5942 | IPython as your default Python environment | |
5920 | \layout Standard |
|
5943 | \layout Standard | |
5921 |
|
5944 | |||
5922 | Python honors the environment variable |
|
5945 | Python honors the environment variable | |
5923 | \family typewriter |
|
5946 | \family typewriter | |
5924 | PYTHONSTARTUP |
|
5947 | PYTHONSTARTUP | |
5925 | \family default |
|
5948 | \family default | |
5926 | and will execute at startup the file referenced by this variable. |
|
5949 | and will execute at startup the file referenced by this variable. | |
5927 | If you put at the end of this file the following two lines of code: |
|
5950 | If you put at the end of this file the following two lines of code: | |
5928 | \layout Standard |
|
5951 | \layout Standard | |
5929 |
|
5952 | |||
5930 |
|
5953 | |||
5931 | \family typewriter |
|
5954 | \family typewriter | |
5932 | import IPython |
|
5955 | import IPython | |
5933 | \newline |
|
5956 | \newline | |
5934 | IPython.Shell.IPShell().mainloop(sys_exit=1) |
|
5957 | IPython.Shell.IPShell().mainloop(sys_exit=1) | |
5935 | \layout Standard |
|
5958 | \layout Standard | |
5936 |
|
5959 | |||
5937 | then IPython will be your working environment anytime you start Python. |
|
5960 | then IPython will be your working environment anytime you start Python. | |
5938 | The |
|
5961 | The | |
5939 | \family typewriter |
|
5962 | \family typewriter | |
5940 | sys_exit=1 |
|
5963 | sys_exit=1 | |
5941 | \family default |
|
5964 | \family default | |
5942 | is needed to have IPython issue a call to |
|
5965 | is needed to have IPython issue a call to | |
5943 | \family typewriter |
|
5966 | \family typewriter | |
5944 | sys.exit() |
|
5967 | sys.exit() | |
5945 | \family default |
|
5968 | \family default | |
5946 | when it finishes, otherwise you'll be back at the normal Python ' |
|
5969 | when it finishes, otherwise you'll be back at the normal Python ' | |
5947 | \family typewriter |
|
5970 | \family typewriter | |
5948 | >>> |
|
5971 | >>> | |
5949 | \family default |
|
5972 | \family default | |
5950 | ' prompt |
|
5973 | ' prompt | |
5951 | \begin_inset Foot |
|
5974 | \begin_inset Foot | |
5952 | collapsed true |
|
5975 | collapsed true | |
5953 |
|
5976 | |||
5954 | \layout Standard |
|
5977 | \layout Standard | |
5955 |
|
5978 | |||
5956 | Based on an idea by Holger Krekel. |
|
5979 | Based on an idea by Holger Krekel. | |
5957 | \end_inset |
|
5980 | \end_inset | |
5958 |
|
5981 | |||
5959 | . |
|
5982 | . | |
5960 | \layout Standard |
|
5983 | \layout Standard | |
5961 |
|
5984 | |||
5962 | This is probably useful to developers who manage multiple Python versions |
|
5985 | This is probably useful to developers who manage multiple Python versions | |
5963 | and don't want to have correspondingly multiple IPython versions. |
|
5986 | and don't want to have correspondingly multiple IPython versions. | |
5964 | Note that in this mode, there is no way to pass IPython any command-line |
|
5987 | Note that in this mode, there is no way to pass IPython any command-line | |
5965 | options, as those are trapped first by Python itself. |
|
5988 | options, as those are trapped first by Python itself. | |
5966 | \layout Section |
|
5989 | \layout Section | |
5967 |
|
5990 | |||
5968 |
|
5991 | |||
5969 | \begin_inset LatexCommand \label{sec:embed} |
|
5992 | \begin_inset LatexCommand \label{sec:embed} | |
5970 |
|
5993 | |||
5971 | \end_inset |
|
5994 | \end_inset | |
5972 |
|
5995 | |||
5973 | Embedding IPython |
|
5996 | Embedding IPython | |
5974 | \layout Standard |
|
5997 | \layout Standard | |
5975 |
|
5998 | |||
5976 | It is possible to start an IPython instance |
|
5999 | It is possible to start an IPython instance | |
5977 | \emph on |
|
6000 | \emph on | |
5978 | inside |
|
6001 | inside | |
5979 | \emph default |
|
6002 | \emph default | |
5980 | your own Python programs. |
|
6003 | your own Python programs. | |
5981 | This allows you to evaluate dynamically the state of your code, operate |
|
6004 | This allows you to evaluate dynamically the state of your code, operate | |
5982 | with your variables, analyze them, etc. |
|
6005 | with your variables, analyze them, etc. | |
5983 | Note however that any changes you make to values while in the shell do |
|
6006 | Note however that any changes you make to values while in the shell do | |
5984 |
|
6007 | |||
5985 | \emph on |
|
6008 | \emph on | |
5986 | not |
|
6009 | not | |
5987 | \emph default |
|
6010 | \emph default | |
5988 | propagate back to the running code, so it is safe to modify your values |
|
6011 | propagate back to the running code, so it is safe to modify your values | |
5989 | because you won't break your code in bizarre ways by doing so. |
|
6012 | because you won't break your code in bizarre ways by doing so. | |
5990 | \layout Standard |
|
6013 | \layout Standard | |
5991 |
|
6014 | |||
5992 | This feature allows you to easily have a fully functional python environment |
|
6015 | This feature allows you to easily have a fully functional python environment | |
5993 | for doing object introspection anywhere in your code with a simple function |
|
6016 | for doing object introspection anywhere in your code with a simple function | |
5994 | call. |
|
6017 | call. | |
5995 | In some cases a simple print statement is enough, but if you need to do |
|
6018 | In some cases a simple print statement is enough, but if you need to do | |
5996 | more detailed analysis of a code fragment this feature can be very valuable. |
|
6019 | more detailed analysis of a code fragment this feature can be very valuable. | |
5997 | \layout Standard |
|
6020 | \layout Standard | |
5998 |
|
6021 | |||
5999 | It can also be useful in scientific computing situations where it is common |
|
6022 | It can also be useful in scientific computing situations where it is common | |
6000 | to need to do some automatic, computationally intensive part and then stop |
|
6023 | to need to do some automatic, computationally intensive part and then stop | |
6001 | to look at data, plots, etc |
|
6024 | to look at data, plots, etc | |
6002 | \begin_inset Foot |
|
6025 | \begin_inset Foot | |
6003 | collapsed true |
|
6026 | collapsed true | |
6004 |
|
6027 | |||
6005 | \layout Standard |
|
6028 | \layout Standard | |
6006 |
|
6029 | |||
6007 | This functionality was inspired by IDL's combination of the |
|
6030 | This functionality was inspired by IDL's combination of the | |
6008 | \family typewriter |
|
6031 | \family typewriter | |
6009 | stop |
|
6032 | stop | |
6010 | \family default |
|
6033 | \family default | |
6011 | keyword and the |
|
6034 | keyword and the | |
6012 | \family typewriter |
|
6035 | \family typewriter | |
6013 | .continue |
|
6036 | .continue | |
6014 | \family default |
|
6037 | \family default | |
6015 | executive command, which I have found very useful in the past, and by a |
|
6038 | executive command, which I have found very useful in the past, and by a | |
6016 | posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec. |
|
6039 | posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec. | |
6017 | 06/01 concerning similar uses of pyrepl. |
|
6040 | 06/01 concerning similar uses of pyrepl. | |
6018 | \end_inset |
|
6041 | \end_inset | |
6019 |
|
6042 | |||
6020 | . |
|
6043 | . | |
6021 | Opening an IPython instance will give you full access to your data and |
|
6044 | Opening an IPython instance will give you full access to your data and | |
6022 | functions, and you can resume program execution once you are done with |
|
6045 | functions, and you can resume program execution once you are done with | |
6023 | the interactive part (perhaps to stop again later, as many times as needed). |
|
6046 | the interactive part (perhaps to stop again later, as many times as needed). | |
6024 | \layout Standard |
|
6047 | \layout Standard | |
6025 |
|
6048 | |||
6026 | The following code snippet is the bare minimum you need to include in your |
|
6049 | The following code snippet is the bare minimum you need to include in your | |
6027 | Python programs for this to work (detailed examples follow later): |
|
6050 | Python programs for this to work (detailed examples follow later): | |
6028 | \layout LyX-Code |
|
6051 | \layout LyX-Code | |
6029 |
|
6052 | |||
6030 | from IPython.Shell import IPShellEmbed |
|
6053 | from IPython.Shell import IPShellEmbed | |
6031 | \layout LyX-Code |
|
6054 | \layout LyX-Code | |
6032 |
|
6055 | |||
6033 | ipshell = IPShellEmbed() |
|
6056 | ipshell = IPShellEmbed() | |
6034 | \layout LyX-Code |
|
6057 | \layout LyX-Code | |
6035 |
|
6058 | |||
6036 | ipshell() # this call anywhere in your program will start IPython |
|
6059 | ipshell() # this call anywhere in your program will start IPython | |
6037 | \layout Standard |
|
6060 | \layout Standard | |
6038 |
|
6061 | |||
6039 | You can run embedded instances even in code which is itself being run at |
|
6062 | You can run embedded instances even in code which is itself being run at | |
6040 | the IPython interactive prompt with ' |
|
6063 | the IPython interactive prompt with ' | |
6041 | \family typewriter |
|
6064 | \family typewriter | |
6042 | %run\SpecialChar ~ |
|
6065 | %run\SpecialChar ~ | |
6043 | <filename> |
|
6066 | <filename> | |
6044 | \family default |
|
6067 | \family default | |
6045 | '. |
|
6068 | '. | |
6046 | Since it's easy to get lost as to where you are (in your top-level IPython |
|
6069 | Since it's easy to get lost as to where you are (in your top-level IPython | |
6047 | or in your embedded one), it's a good idea in such cases to set the in/out |
|
6070 | or in your embedded one), it's a good idea in such cases to set the in/out | |
6048 | prompts to something different for the embedded instances. |
|
6071 | prompts to something different for the embedded instances. | |
6049 | The code examples below illustrate this. |
|
6072 | The code examples below illustrate this. | |
6050 | \layout Standard |
|
6073 | \layout Standard | |
6051 |
|
6074 | |||
6052 | You can also have multiple IPython instances in your program and open them |
|
6075 | You can also have multiple IPython instances in your program and open them | |
6053 | separately, for example with different options for data presentation. |
|
6076 | separately, for example with different options for data presentation. | |
6054 | If you close and open the same instance multiple times, its prompt counters |
|
6077 | If you close and open the same instance multiple times, its prompt counters | |
6055 | simply continue from each execution to the next. |
|
6078 | simply continue from each execution to the next. | |
6056 | \layout Standard |
|
6079 | \layout Standard | |
6057 |
|
6080 | |||
6058 | Please look at the docstrings in the |
|
6081 | Please look at the docstrings in the | |
6059 | \family typewriter |
|
6082 | \family typewriter | |
6060 | Shell.py |
|
6083 | Shell.py | |
6061 | \family default |
|
6084 | \family default | |
6062 | module for more details on the use of this system. |
|
6085 | module for more details on the use of this system. | |
6063 | \layout Standard |
|
6086 | \layout Standard | |
6064 |
|
6087 | |||
6065 | The following sample file illustrating how to use the embedding functionality |
|
6088 | The following sample file illustrating how to use the embedding functionality | |
6066 | is provided in the examples directory as |
|
6089 | is provided in the examples directory as | |
6067 | \family typewriter |
|
6090 | \family typewriter | |
6068 | example-embed.py |
|
6091 | example-embed.py | |
6069 | \family default |
|
6092 | \family default | |
6070 | . |
|
6093 | . | |
6071 | It should be fairly self-explanatory: |
|
6094 | It should be fairly self-explanatory: | |
6072 | \layout Standard |
|
6095 | \layout Standard | |
6073 |
|
6096 | |||
6074 |
|
6097 | |||
6075 | \begin_inset ERT |
|
6098 | \begin_inset ERT | |
6076 | status Open |
|
6099 | status Open | |
6077 |
|
6100 | |||
6078 | \layout Standard |
|
6101 | \layout Standard | |
6079 |
|
6102 | |||
6080 | \backslash |
|
6103 | \backslash | |
6081 |
|
|
6104 | codelist{examples/example-embed.py} | |
6082 | \end_inset |
|
6105 | \end_inset | |
6083 |
|
6106 | |||
6084 |
|
6107 | |||
6085 | \layout Standard |
|
6108 | \layout Standard | |
6086 |
|
6109 | |||
6087 | Once you understand how the system functions, you can use the following |
|
6110 | Once you understand how the system functions, you can use the following | |
6088 | code fragments in your programs which are ready for cut and paste: |
|
6111 | code fragments in your programs which are ready for cut and paste: | |
6089 | \layout Standard |
|
6112 | \layout Standard | |
6090 |
|
6113 | |||
6091 |
|
6114 | |||
6092 | \begin_inset ERT |
|
6115 | \begin_inset ERT | |
6093 | status Open |
|
6116 | status Open | |
6094 |
|
6117 | |||
6095 | \layout Standard |
|
6118 | \layout Standard | |
6096 |
|
6119 | |||
6097 | \backslash |
|
6120 | \backslash | |
6098 |
|
|
6121 | codelist{examples/example-embed-short.py} | |
6099 | \end_inset |
|
6122 | \end_inset | |
6100 |
|
6123 | |||
6101 |
|
6124 | |||
6102 | \layout Section |
|
6125 | \layout Section | |
6103 |
|
6126 | |||
6104 |
|
6127 | |||
6105 | \begin_inset LatexCommand \label{sec:using-pdb} |
|
6128 | \begin_inset LatexCommand \label{sec:using-pdb} | |
6106 |
|
6129 | |||
6107 | \end_inset |
|
6130 | \end_inset | |
6108 |
|
6131 | |||
6109 | Using the Python debugger ( |
|
6132 | Using the Python debugger ( | |
6110 | \family typewriter |
|
6133 | \family typewriter | |
6111 | pdb |
|
6134 | pdb | |
6112 | \family default |
|
6135 | \family default | |
6113 | ) |
|
6136 | ) | |
6114 | \layout Subsection |
|
6137 | \layout Subsection | |
6115 |
|
6138 | |||
6116 | Running entire programs via |
|
6139 | Running entire programs via | |
6117 | \family typewriter |
|
6140 | \family typewriter | |
6118 | pdb |
|
6141 | pdb | |
6119 | \layout Standard |
|
6142 | \layout Standard | |
6120 |
|
6143 | |||
6121 |
|
6144 | |||
6122 | \family typewriter |
|
6145 | \family typewriter | |
6123 | pdb |
|
6146 | pdb | |
6124 | \family default |
|
6147 | \family default | |
6125 | , the Python debugger, is a powerful interactive debugger which allows you |
|
6148 | , the Python debugger, is a powerful interactive debugger which allows you | |
6126 | to step through code, set breakpoints, watch variables, etc. |
|
6149 | to step through code, set breakpoints, watch variables, etc. | |
6127 | IPython makes it very easy to start any script under the control of |
|
6150 | IPython makes it very easy to start any script under the control of | |
6128 | \family typewriter |
|
6151 | \family typewriter | |
6129 | pdb |
|
6152 | pdb | |
6130 | \family default |
|
6153 | \family default | |
6131 | , regardless of whether you have wrapped it into a |
|
6154 | , regardless of whether you have wrapped it into a | |
6132 | \family typewriter |
|
6155 | \family typewriter | |
6133 | `main()' |
|
6156 | `main()' | |
6134 | \family default |
|
6157 | \family default | |
6135 | function or not. |
|
6158 | function or not. | |
6136 | For this, simply type |
|
6159 | For this, simply type | |
6137 | \family typewriter |
|
6160 | \family typewriter | |
6138 | `%run -d myscript' |
|
6161 | `%run -d myscript' | |
6139 | \family default |
|
6162 | \family default | |
6140 | at an IPython prompt. |
|
6163 | at an IPython prompt. | |
6141 | See the |
|
6164 | See the | |
6142 | \family typewriter |
|
6165 | \family typewriter | |
6143 | %run |
|
6166 | %run | |
6144 | \family default |
|
6167 | \family default | |
6145 | command's documentation (via |
|
6168 | command's documentation (via | |
6146 | \family typewriter |
|
6169 | \family typewriter | |
6147 | `%run?' |
|
6170 | `%run?' | |
6148 | \family default |
|
6171 | \family default | |
6149 | or in Sec.\SpecialChar ~ |
|
6172 | or in Sec.\SpecialChar ~ | |
6150 |
|
6173 | |||
6151 | \begin_inset LatexCommand \ref{sec:magic} |
|
6174 | \begin_inset LatexCommand \ref{sec:magic} | |
6152 |
|
6175 | |||
6153 | \end_inset |
|
6176 | \end_inset | |
6154 |
|
6177 | |||
6155 | ) for more details, including how to control where |
|
6178 | ) for more details, including how to control where | |
6156 | \family typewriter |
|
6179 | \family typewriter | |
6157 | pdb |
|
6180 | pdb | |
6158 | \family default |
|
6181 | \family default | |
6159 | will stop execution first. |
|
6182 | will stop execution first. | |
6160 | \layout Standard |
|
6183 | \layout Standard | |
6161 |
|
6184 | |||
6162 | For more information on the use of the |
|
6185 | For more information on the use of the | |
6163 | \family typewriter |
|
6186 | \family typewriter | |
6164 | pdb |
|
6187 | pdb | |
6165 | \family default |
|
6188 | \family default | |
6166 | debugger, read the included |
|
6189 | debugger, read the included | |
6167 | \family typewriter |
|
6190 | \family typewriter | |
6168 | pdb.doc |
|
6191 | pdb.doc | |
6169 | \family default |
|
6192 | \family default | |
6170 | file (part of the standard Python distribution). |
|
6193 | file (part of the standard Python distribution). | |
6171 | On a stock Linux system it is located at |
|
6194 | On a stock Linux system it is located at | |
6172 | \family typewriter |
|
6195 | \family typewriter | |
6173 | /usr/lib/python2.3/pdb.doc |
|
6196 | /usr/lib/python2.3/pdb.doc | |
6174 | \family default |
|
6197 | \family default | |
6175 | , but the easiest way to read it is by using the |
|
6198 | , but the easiest way to read it is by using the | |
6176 | \family typewriter |
|
6199 | \family typewriter | |
6177 | help() |
|
6200 | help() | |
6178 | \family default |
|
6201 | \family default | |
6179 | function of the |
|
6202 | function of the | |
6180 | \family typewriter |
|
6203 | \family typewriter | |
6181 | pdb |
|
6204 | pdb | |
6182 | \family default |
|
6205 | \family default | |
6183 | module as follows (in an IPython prompt): |
|
6206 | module as follows (in an IPython prompt): | |
6184 | \layout Standard |
|
6207 | \layout Standard | |
6185 |
|
6208 | |||
6186 |
|
6209 | |||
6187 | \family typewriter |
|
6210 | \family typewriter | |
6188 | In [1]: import pdb |
|
6211 | In [1]: import pdb | |
6189 | \newline |
|
6212 | \newline | |
6190 | In [2]: pdb.help() |
|
6213 | In [2]: pdb.help() | |
6191 | \layout Standard |
|
6214 | \layout Standard | |
6192 |
|
6215 | |||
6193 | This will load the |
|
6216 | This will load the | |
6194 | \family typewriter |
|
6217 | \family typewriter | |
6195 | pdb.doc |
|
6218 | pdb.doc | |
6196 | \family default |
|
6219 | \family default | |
6197 | document in a file viewer for you automatically. |
|
6220 | document in a file viewer for you automatically. | |
6198 | \layout Subsection |
|
6221 | \layout Subsection | |
6199 |
|
6222 | |||
6200 | Automatic invocation of |
|
6223 | Automatic invocation of | |
6201 | \family typewriter |
|
6224 | \family typewriter | |
6202 | pdb |
|
6225 | pdb | |
6203 | \family default |
|
6226 | \family default | |
6204 | on exceptions |
|
6227 | on exceptions | |
6205 | \layout Standard |
|
6228 | \layout Standard | |
6206 |
|
6229 | |||
6207 | IPython, if started with the |
|
6230 | IPython, if started with the | |
6208 | \family typewriter |
|
6231 | \family typewriter | |
6209 | -pdb |
|
6232 | -pdb | |
6210 | \family default |
|
6233 | \family default | |
6211 | option (or if the option is set in your rc file) can call the Python |
|
6234 | option (or if the option is set in your rc file) can call the Python | |
6212 | \family typewriter |
|
6235 | \family typewriter | |
6213 | pdb |
|
6236 | pdb | |
6214 | \family default |
|
6237 | \family default | |
6215 | debugger every time your code triggers an uncaught exception |
|
6238 | debugger every time your code triggers an uncaught exception | |
6216 | \begin_inset Foot |
|
6239 | \begin_inset Foot | |
6217 | collapsed true |
|
6240 | collapsed true | |
6218 |
|
6241 | |||
6219 | \layout Standard |
|
6242 | \layout Standard | |
6220 |
|
6243 | |||
6221 | Many thanks to Christopher Hart for the request which prompted adding this |
|
6244 | Many thanks to Christopher Hart for the request which prompted adding this | |
6222 | feature to IPython. |
|
6245 | feature to IPython. | |
6223 | \end_inset |
|
6246 | \end_inset | |
6224 |
|
6247 | |||
6225 | . |
|
6248 | . | |
6226 | This feature can also be toggled at any time with the |
|
6249 | This feature can also be toggled at any time with the | |
6227 | \family typewriter |
|
6250 | \family typewriter | |
6228 | %pdb |
|
6251 | %pdb | |
6229 | \family default |
|
6252 | \family default | |
6230 | magic command. |
|
6253 | magic command. | |
6231 | This can be extremely useful in order to find the origin of subtle bugs, |
|
6254 | This can be extremely useful in order to find the origin of subtle bugs, | |
6232 | because |
|
6255 | because | |
6233 | \family typewriter |
|
6256 | \family typewriter | |
6234 | pdb |
|
6257 | pdb | |
6235 | \family default |
|
6258 | \family default | |
6236 | opens up at the point in your code which triggered the exception, and while |
|
6259 | opens up at the point in your code which triggered the exception, and while | |
6237 | your program is at this point `dead', all the data is still available and |
|
6260 | your program is at this point `dead', all the data is still available and | |
6238 | you can walk up and down the stack frame and understand the origin of the |
|
6261 | you can walk up and down the stack frame and understand the origin of the | |
6239 | problem. |
|
6262 | problem. | |
6240 | \layout Standard |
|
6263 | \layout Standard | |
6241 |
|
6264 | |||
6242 | Furthermore, you can use these debugging facilities both with the embedded |
|
6265 | Furthermore, you can use these debugging facilities both with the embedded | |
6243 | IPython mode and without IPython at all. |
|
6266 | IPython mode and without IPython at all. | |
6244 | For an embedded shell (see sec. |
|
6267 | For an embedded shell (see sec. | |
6245 |
|
6268 | |||
6246 | \begin_inset LatexCommand \ref{sec:embed} |
|
6269 | \begin_inset LatexCommand \ref{sec:embed} | |
6247 |
|
6270 | |||
6248 | \end_inset |
|
6271 | \end_inset | |
6249 |
|
6272 | |||
6250 | ), simply call the constructor with |
|
6273 | ), simply call the constructor with | |
6251 | \family typewriter |
|
6274 | \family typewriter | |
6252 | `-pdb' |
|
6275 | `-pdb' | |
6253 | \family default |
|
6276 | \family default | |
6254 | in the argument string and automatically |
|
6277 | in the argument string and automatically | |
6255 | \family typewriter |
|
6278 | \family typewriter | |
6256 | pdb |
|
6279 | pdb | |
6257 | \family default |
|
6280 | \family default | |
6258 | will be called if an uncaught exception is triggered by your code. |
|
6281 | will be called if an uncaught exception is triggered by your code. | |
6259 |
|
6282 | |||
6260 | \layout Standard |
|
6283 | \layout Standard | |
6261 |
|
6284 | |||
6262 | For stand-alone use of the feature in your programs which do not use IPython |
|
6285 | For stand-alone use of the feature in your programs which do not use IPython | |
6263 | at all, put the following lines toward the top of your `main' routine: |
|
6286 | at all, put the following lines toward the top of your `main' routine: | |
6264 | \layout Standard |
|
6287 | \layout Standard | |
6265 | \align left |
|
6288 | \align left | |
6266 |
|
6289 | |||
6267 | \family typewriter |
|
6290 | \family typewriter | |
6268 | import sys,IPython.ultraTB |
|
6291 | import sys,IPython.ultraTB | |
6269 | \newline |
|
6292 | \newline | |
6270 | sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux', |
|
6293 | sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux', | |
6271 | call_pdb=1) |
|
6294 | call_pdb=1) | |
6272 | \layout Standard |
|
6295 | \layout Standard | |
6273 |
|
6296 | |||
6274 | The |
|
6297 | The | |
6275 | \family typewriter |
|
6298 | \family typewriter | |
6276 | mode |
|
6299 | mode | |
6277 | \family default |
|
6300 | \family default | |
6278 | keyword can be either |
|
6301 | keyword can be either | |
6279 | \family typewriter |
|
6302 | \family typewriter | |
6280 | `Verbose' |
|
6303 | `Verbose' | |
6281 | \family default |
|
6304 | \family default | |
6282 | or |
|
6305 | or | |
6283 | \family typewriter |
|
6306 | \family typewriter | |
6284 | `Plain' |
|
6307 | `Plain' | |
6285 | \family default |
|
6308 | \family default | |
6286 | , giving either very detailed or normal tracebacks respectively. |
|
6309 | , giving either very detailed or normal tracebacks respectively. | |
6287 | The |
|
6310 | The | |
6288 | \family typewriter |
|
6311 | \family typewriter | |
6289 | color_scheme |
|
6312 | color_scheme | |
6290 | \family default |
|
6313 | \family default | |
6291 | keyword can be one of |
|
6314 | keyword can be one of | |
6292 | \family typewriter |
|
6315 | \family typewriter | |
6293 | `NoColor' |
|
6316 | `NoColor' | |
6294 | \family default |
|
6317 | \family default | |
6295 | , |
|
6318 | , | |
6296 | \family typewriter |
|
6319 | \family typewriter | |
6297 | `Linux' |
|
6320 | `Linux' | |
6298 | \family default |
|
6321 | \family default | |
6299 | (default) or |
|
6322 | (default) or | |
6300 | \family typewriter |
|
6323 | \family typewriter | |
6301 | `LightBG' |
|
6324 | `LightBG' | |
6302 | \family default |
|
6325 | \family default | |
6303 | . |
|
6326 | . | |
6304 | These are the same options which can be set in IPython with |
|
6327 | These are the same options which can be set in IPython with | |
6305 | \family typewriter |
|
6328 | \family typewriter | |
6306 | -colors |
|
6329 | -colors | |
6307 | \family default |
|
6330 | \family default | |
6308 | and |
|
6331 | and | |
6309 | \family typewriter |
|
6332 | \family typewriter | |
6310 | -xmode |
|
6333 | -xmode | |
6311 | \family default |
|
6334 | \family default | |
6312 | . |
|
6335 | . | |
6313 | \layout Standard |
|
6336 | \layout Standard | |
6314 |
|
6337 | |||
6315 | This will give any of your programs detailed, colored tracebacks with automatic |
|
6338 | This will give any of your programs detailed, colored tracebacks with automatic | |
6316 | invocation of |
|
6339 | invocation of | |
6317 | \family typewriter |
|
6340 | \family typewriter | |
6318 | pdb |
|
6341 | pdb | |
6319 | \family default |
|
6342 | \family default | |
6320 | . |
|
6343 | . | |
6321 | \layout Section |
|
6344 | \layout Section | |
6322 |
|
6345 | |||
6323 |
|
6346 | |||
6324 | \begin_inset LatexCommand \label{sec:syntax-extensions} |
|
6347 | \begin_inset LatexCommand \label{sec:syntax-extensions} | |
6325 |
|
6348 | |||
6326 | \end_inset |
|
6349 | \end_inset | |
6327 |
|
6350 | |||
6328 | Extensions for syntax processing |
|
6351 | Extensions for syntax processing | |
6329 | \layout Standard |
|
6352 | \layout Standard | |
6330 |
|
6353 | |||
6331 | This isn't for the faint of heart, because the potential for breaking things |
|
6354 | This isn't for the faint of heart, because the potential for breaking things | |
6332 | is quite high. |
|
6355 | is quite high. | |
6333 | But it can be a very powerful and useful feature. |
|
6356 | But it can be a very powerful and useful feature. | |
6334 | In a nutshell, you can redefine the way IPython processes the user input |
|
6357 | In a nutshell, you can redefine the way IPython processes the user input | |
6335 | line to accept new, special extensions to the syntax without needing to |
|
6358 | line to accept new, special extensions to the syntax without needing to | |
6336 | change any of IPython's own code. |
|
6359 | change any of IPython's own code. | |
6337 | \layout Standard |
|
6360 | \layout Standard | |
6338 |
|
6361 | |||
6339 | In the |
|
6362 | In the | |
6340 | \family typewriter |
|
6363 | \family typewriter | |
6341 | IPython/Extensions |
|
6364 | IPython/Extensions | |
6342 | \family default |
|
6365 | \family default | |
6343 | directory you will find some examples supplied, which we will briefly describe |
|
6366 | directory you will find some examples supplied, which we will briefly describe | |
6344 | now. |
|
6367 | now. | |
6345 | These can be used `as is' (and both provide very useful functionality), |
|
6368 | These can be used `as is' (and both provide very useful functionality), | |
6346 | or you can use them as a starting point for writing your own extensions. |
|
6369 | or you can use them as a starting point for writing your own extensions. | |
6347 | \layout Subsection |
|
6370 | \layout Subsection | |
6348 |
|
6371 | |||
6349 | Pasting of code starting with |
|
6372 | Pasting of code starting with | |
6350 | \family typewriter |
|
6373 | \family typewriter | |
6351 | `>>> |
|
6374 | `>>> | |
6352 | \family default |
|
6375 | \family default | |
6353 | ' or |
|
6376 | ' or | |
6354 | \family typewriter |
|
6377 | \family typewriter | |
6355 | `... |
|
6378 | `... | |
6356 |
|
6379 | |||
6357 | \family default |
|
6380 | \family default | |
6358 | ' |
|
6381 | ' | |
6359 | \layout Standard |
|
6382 | \layout Standard | |
6360 |
|
6383 | |||
6361 | In the python tutorial it is common to find code examples which have been |
|
6384 | In the python tutorial it is common to find code examples which have been | |
6362 | taken from real python sessions. |
|
6385 | taken from real python sessions. | |
6363 | The problem with those is that all the lines begin with either |
|
6386 | The problem with those is that all the lines begin with either | |
6364 | \family typewriter |
|
6387 | \family typewriter | |
6365 | `>>> |
|
6388 | `>>> | |
6366 | \family default |
|
6389 | \family default | |
6367 | ' or |
|
6390 | ' or | |
6368 | \family typewriter |
|
6391 | \family typewriter | |
6369 | `... |
|
6392 | `... | |
6370 |
|
6393 | |||
6371 | \family default |
|
6394 | \family default | |
6372 | ', which makes it impossible to paste them all at once. |
|
6395 | ', which makes it impossible to paste them all at once. | |
6373 | One must instead do a line by line manual copying, carefully removing the |
|
6396 | One must instead do a line by line manual copying, carefully removing the | |
6374 | leading extraneous characters. |
|
6397 | leading extraneous characters. | |
6375 | \layout Standard |
|
6398 | \layout Standard | |
6376 |
|
6399 | |||
6377 | This extension identifies those starting characters and removes them from |
|
6400 | This extension identifies those starting characters and removes them from | |
6378 | the input automatically, so that one can paste multi-line examples directly |
|
6401 | the input automatically, so that one can paste multi-line examples directly | |
6379 | into IPython, saving a lot of time. |
|
6402 | into IPython, saving a lot of time. | |
6380 | Please look at the file |
|
6403 | Please look at the file | |
6381 | \family typewriter |
|
6404 | \family typewriter | |
6382 | InterpreterPasteInput.py |
|
6405 | InterpreterPasteInput.py | |
6383 | \family default |
|
6406 | \family default | |
6384 | in the |
|
6407 | in the | |
6385 | \family typewriter |
|
6408 | \family typewriter | |
6386 | IPython/Extensions |
|
6409 | IPython/Extensions | |
6387 | \family default |
|
6410 | \family default | |
6388 | directory for details on how this is done. |
|
6411 | directory for details on how this is done. | |
6389 | \layout Standard |
|
6412 | \layout Standard | |
6390 |
|
6413 | |||
6391 | IPython comes with a special profile enabling this feature, called |
|
6414 | IPython comes with a special profile enabling this feature, called | |
6392 | \family typewriter |
|
6415 | \family typewriter | |
6393 | tutorial |
|
6416 | tutorial | |
6394 | \family default |
|
6417 | \family default | |
6395 | \emph on |
|
6418 | \emph on | |
6396 | . |
|
6419 | . | |
6397 |
|
6420 | |||
6398 | \emph default |
|
6421 | \emph default | |
6399 | Simply start IPython via |
|
6422 | Simply start IPython via | |
6400 | \family typewriter |
|
6423 | \family typewriter | |
6401 | `ipython\SpecialChar ~ |
|
6424 | `ipython\SpecialChar ~ | |
6402 | -p\SpecialChar ~ |
|
6425 | -p\SpecialChar ~ | |
6403 | tutorial' |
|
6426 | tutorial' | |
6404 | \family default |
|
6427 | \family default | |
6405 | and the feature will be available. |
|
6428 | and the feature will be available. | |
6406 | In a normal IPython session you can activate the feature by importing the |
|
6429 | In a normal IPython session you can activate the feature by importing the | |
6407 | corresponding module with: |
|
6430 | corresponding module with: | |
6408 | \newline |
|
6431 | \newline | |
6409 |
|
6432 | |||
6410 | \family typewriter |
|
6433 | \family typewriter | |
6411 | In [1]: import IPython.Extensions.InterpreterPasteInput |
|
6434 | In [1]: import IPython.Extensions.InterpreterPasteInput | |
6412 | \layout Standard |
|
6435 | \layout Standard | |
6413 |
|
6436 | |||
6414 | The following is a 'screenshot' of how things work when this extension is |
|
6437 | The following is a 'screenshot' of how things work when this extension is | |
6415 | on, copying an example from the standard tutorial: |
|
6438 | on, copying an example from the standard tutorial: | |
6416 | \layout Standard |
|
6439 | \layout Standard | |
6417 |
|
6440 | |||
6418 |
|
6441 | |||
6419 | \family typewriter |
|
6442 | \family typewriter | |
6420 | IPython profile: tutorial |
|
6443 | IPython profile: tutorial | |
6421 | \newline |
|
6444 | \newline | |
6422 | \SpecialChar ~ |
|
6445 | \SpecialChar ~ | |
6423 |
|
6446 | |||
6424 | \newline |
|
6447 | \newline | |
6425 | *** Pasting of code with ">>>" or "..." has been enabled. |
|
6448 | *** Pasting of code with ">>>" or "..." has been enabled. | |
6426 | \newline |
|
6449 | \newline | |
6427 | \SpecialChar ~ |
|
6450 | \SpecialChar ~ | |
6428 |
|
6451 | |||
6429 | \newline |
|
6452 | \newline | |
6430 | In [1]: >>> def fib2(n): # return Fibonacci series up to n |
|
6453 | In [1]: >>> def fib2(n): # return Fibonacci series up to n | |
6431 | \newline |
|
6454 | \newline | |
6432 |
|
6455 | |||
6433 | \begin_inset ERT |
|
6456 | \begin_inset ERT | |
6434 | status Collapsed |
|
6457 | status Collapsed | |
6435 |
|
6458 | |||
6436 | \layout Standard |
|
6459 | \layout Standard | |
6437 |
|
6460 | |||
6438 | \backslash |
|
6461 | \backslash | |
6439 | hspace*{0mm} |
|
6462 | hspace*{0mm} | |
6440 | \end_inset |
|
6463 | \end_inset | |
6441 |
|
6464 | |||
6442 | \SpecialChar ~ |
|
6465 | \SpecialChar ~ | |
6443 | \SpecialChar ~ |
|
6466 | \SpecialChar ~ | |
6444 | ...: ...\SpecialChar ~ |
|
6467 | ...: ...\SpecialChar ~ | |
6445 | \SpecialChar ~ |
|
6468 | \SpecialChar ~ | |
6446 | \SpecialChar ~ |
|
6469 | \SpecialChar ~ | |
6447 | \SpecialChar ~ |
|
6470 | \SpecialChar ~ | |
6448 | """Return a list containing the Fibonacci series up to n.""" |
|
6471 | """Return a list containing the Fibonacci series up to n.""" | |
6449 | \newline |
|
6472 | \newline | |
6450 |
|
6473 | |||
6451 | \begin_inset ERT |
|
6474 | \begin_inset ERT | |
6452 | status Collapsed |
|
6475 | status Collapsed | |
6453 |
|
6476 | |||
6454 | \layout Standard |
|
6477 | \layout Standard | |
6455 |
|
6478 | |||
6456 | \backslash |
|
6479 | \backslash | |
6457 | hspace*{0mm} |
|
6480 | hspace*{0mm} | |
6458 | \end_inset |
|
6481 | \end_inset | |
6459 |
|
6482 | |||
6460 | \SpecialChar ~ |
|
6483 | \SpecialChar ~ | |
6461 | \SpecialChar ~ |
|
6484 | \SpecialChar ~ | |
6462 | ...: ...\SpecialChar ~ |
|
6485 | ...: ...\SpecialChar ~ | |
6463 | \SpecialChar ~ |
|
6486 | \SpecialChar ~ | |
6464 | \SpecialChar ~ |
|
6487 | \SpecialChar ~ | |
6465 | \SpecialChar ~ |
|
6488 | \SpecialChar ~ | |
6466 | result = [] |
|
6489 | result = [] | |
6467 | \newline |
|
6490 | \newline | |
6468 |
|
6491 | |||
6469 | \begin_inset ERT |
|
6492 | \begin_inset ERT | |
6470 | status Collapsed |
|
6493 | status Collapsed | |
6471 |
|
6494 | |||
6472 | \layout Standard |
|
6495 | \layout Standard | |
6473 |
|
6496 | |||
6474 | \backslash |
|
6497 | \backslash | |
6475 | hspace*{0mm} |
|
6498 | hspace*{0mm} | |
6476 | \end_inset |
|
6499 | \end_inset | |
6477 |
|
6500 | |||
6478 | \SpecialChar ~ |
|
6501 | \SpecialChar ~ | |
6479 | \SpecialChar ~ |
|
6502 | \SpecialChar ~ | |
6480 | ...: ...\SpecialChar ~ |
|
6503 | ...: ...\SpecialChar ~ | |
6481 | \SpecialChar ~ |
|
6504 | \SpecialChar ~ | |
6482 | \SpecialChar ~ |
|
6505 | \SpecialChar ~ | |
6483 | \SpecialChar ~ |
|
6506 | \SpecialChar ~ | |
6484 | a, b = 0, 1 |
|
6507 | a, b = 0, 1 | |
6485 | \newline |
|
6508 | \newline | |
6486 |
|
6509 | |||
6487 | \begin_inset ERT |
|
6510 | \begin_inset ERT | |
6488 | status Collapsed |
|
6511 | status Collapsed | |
6489 |
|
6512 | |||
6490 | \layout Standard |
|
6513 | \layout Standard | |
6491 |
|
6514 | |||
6492 | \backslash |
|
6515 | \backslash | |
6493 | hspace*{0mm} |
|
6516 | hspace*{0mm} | |
6494 | \end_inset |
|
6517 | \end_inset | |
6495 |
|
6518 | |||
6496 | \SpecialChar ~ |
|
6519 | \SpecialChar ~ | |
6497 | \SpecialChar ~ |
|
6520 | \SpecialChar ~ | |
6498 | ...: ...\SpecialChar ~ |
|
6521 | ...: ...\SpecialChar ~ | |
6499 | \SpecialChar ~ |
|
6522 | \SpecialChar ~ | |
6500 | \SpecialChar ~ |
|
6523 | \SpecialChar ~ | |
6501 | \SpecialChar ~ |
|
6524 | \SpecialChar ~ | |
6502 | while b < n: |
|
6525 | while b < n: | |
6503 | \newline |
|
6526 | \newline | |
6504 |
|
6527 | |||
6505 | \begin_inset ERT |
|
6528 | \begin_inset ERT | |
6506 | status Collapsed |
|
6529 | status Collapsed | |
6507 |
|
6530 | |||
6508 | \layout Standard |
|
6531 | \layout Standard | |
6509 |
|
6532 | |||
6510 | \backslash |
|
6533 | \backslash | |
6511 | hspace*{0mm} |
|
6534 | hspace*{0mm} | |
6512 | \end_inset |
|
6535 | \end_inset | |
6513 |
|
6536 | |||
6514 | \SpecialChar ~ |
|
6537 | \SpecialChar ~ | |
6515 | \SpecialChar ~ |
|
6538 | \SpecialChar ~ | |
6516 | ...: ...\SpecialChar ~ |
|
6539 | ...: ...\SpecialChar ~ | |
6517 | \SpecialChar ~ |
|
6540 | \SpecialChar ~ | |
6518 | \SpecialChar ~ |
|
6541 | \SpecialChar ~ | |
6519 | \SpecialChar ~ |
|
6542 | \SpecialChar ~ | |
6520 | \SpecialChar ~ |
|
6543 | \SpecialChar ~ | |
6521 | \SpecialChar ~ |
|
6544 | \SpecialChar ~ | |
6522 | \SpecialChar ~ |
|
6545 | \SpecialChar ~ | |
6523 | \SpecialChar ~ |
|
6546 | \SpecialChar ~ | |
6524 | result.append(b)\SpecialChar ~ |
|
6547 | result.append(b)\SpecialChar ~ | |
6525 | \SpecialChar ~ |
|
6548 | \SpecialChar ~ | |
6526 | \SpecialChar ~ |
|
6549 | \SpecialChar ~ | |
6527 | # see below |
|
6550 | # see below | |
6528 | \newline |
|
6551 | \newline | |
6529 |
|
6552 | |||
6530 | \begin_inset ERT |
|
6553 | \begin_inset ERT | |
6531 | status Collapsed |
|
6554 | status Collapsed | |
6532 |
|
6555 | |||
6533 | \layout Standard |
|
6556 | \layout Standard | |
6534 |
|
6557 | |||
6535 | \backslash |
|
6558 | \backslash | |
6536 | hspace*{0mm} |
|
6559 | hspace*{0mm} | |
6537 | \end_inset |
|
6560 | \end_inset | |
6538 |
|
6561 | |||
6539 | \SpecialChar ~ |
|
6562 | \SpecialChar ~ | |
6540 | \SpecialChar ~ |
|
6563 | \SpecialChar ~ | |
6541 | ...: ...\SpecialChar ~ |
|
6564 | ...: ...\SpecialChar ~ | |
6542 | \SpecialChar ~ |
|
6565 | \SpecialChar ~ | |
6543 | \SpecialChar ~ |
|
6566 | \SpecialChar ~ | |
6544 | \SpecialChar ~ |
|
6567 | \SpecialChar ~ | |
6545 | \SpecialChar ~ |
|
6568 | \SpecialChar ~ | |
6546 | \SpecialChar ~ |
|
6569 | \SpecialChar ~ | |
6547 | \SpecialChar ~ |
|
6570 | \SpecialChar ~ | |
6548 | \SpecialChar ~ |
|
6571 | \SpecialChar ~ | |
6549 | a, b = b, a+b |
|
6572 | a, b = b, a+b | |
6550 | \newline |
|
6573 | \newline | |
6551 |
|
6574 | |||
6552 | \begin_inset ERT |
|
6575 | \begin_inset ERT | |
6553 | status Collapsed |
|
6576 | status Collapsed | |
6554 |
|
6577 | |||
6555 | \layout Standard |
|
6578 | \layout Standard | |
6556 |
|
6579 | |||
6557 | \backslash |
|
6580 | \backslash | |
6558 | hspace*{0mm} |
|
6581 | hspace*{0mm} | |
6559 | \end_inset |
|
6582 | \end_inset | |
6560 |
|
6583 | |||
6561 | \SpecialChar ~ |
|
6584 | \SpecialChar ~ | |
6562 | \SpecialChar ~ |
|
6585 | \SpecialChar ~ | |
6563 | ...: ...\SpecialChar ~ |
|
6586 | ...: ...\SpecialChar ~ | |
6564 | \SpecialChar ~ |
|
6587 | \SpecialChar ~ | |
6565 | \SpecialChar ~ |
|
6588 | \SpecialChar ~ | |
6566 | \SpecialChar ~ |
|
6589 | \SpecialChar ~ | |
6567 | return result |
|
6590 | return result | |
6568 | \newline |
|
6591 | \newline | |
6569 |
|
6592 | |||
6570 | \begin_inset ERT |
|
6593 | \begin_inset ERT | |
6571 | status Collapsed |
|
6594 | status Collapsed | |
6572 |
|
6595 | |||
6573 | \layout Standard |
|
6596 | \layout Standard | |
6574 |
|
6597 | |||
6575 | \backslash |
|
6598 | \backslash | |
6576 | hspace*{0mm} |
|
6599 | hspace*{0mm} | |
6577 | \end_inset |
|
6600 | \end_inset | |
6578 |
|
6601 | |||
6579 | \SpecialChar ~ |
|
6602 | \SpecialChar ~ | |
6580 | \SpecialChar ~ |
|
6603 | \SpecialChar ~ | |
6581 | ...: |
|
6604 | ...: | |
6582 | \newline |
|
6605 | \newline | |
6583 | \SpecialChar ~ |
|
6606 | \SpecialChar ~ | |
6584 |
|
6607 | |||
6585 | \newline |
|
6608 | \newline | |
6586 | In [2]: fib2(10) |
|
6609 | In [2]: fib2(10) | |
6587 | \newline |
|
6610 | \newline | |
6588 | Out[2]: [1, 1, 2, 3, 5, 8] |
|
6611 | Out[2]: [1, 1, 2, 3, 5, 8] | |
6589 | \layout Standard |
|
6612 | \layout Standard | |
6590 |
|
6613 | |||
6591 | Note that as currently written, this extension does |
|
6614 | Note that as currently written, this extension does | |
6592 | \emph on |
|
6615 | \emph on | |
6593 | not |
|
6616 | not | |
6594 | \emph default |
|
6617 | \emph default | |
6595 | recognize IPython's prompts for pasting. |
|
6618 | recognize IPython's prompts for pasting. | |
6596 | Those are more complicated, since the user can change them very easily, |
|
6619 | Those are more complicated, since the user can change them very easily, | |
6597 | they involve numbers and can vary in length. |
|
6620 | they involve numbers and can vary in length. | |
6598 | One could however extract all the relevant information from the IPython |
|
6621 | One could however extract all the relevant information from the IPython | |
6599 | instance and build an appropriate regular expression. |
|
6622 | instance and build an appropriate regular expression. | |
6600 | This is left as an exercise for the reader. |
|
6623 | This is left as an exercise for the reader. | |
6601 | \layout Subsection |
|
6624 | \layout Subsection | |
6602 |
|
6625 | |||
6603 | Input of physical quantities with units |
|
6626 | Input of physical quantities with units | |
6604 | \layout Standard |
|
6627 | \layout Standard | |
6605 |
|
6628 | |||
6606 | The module |
|
6629 | The module | |
6607 | \family typewriter |
|
6630 | \family typewriter | |
6608 | PhysicalQInput |
|
6631 | PhysicalQInput | |
6609 | \family default |
|
6632 | \family default | |
6610 | allows a simplified form of input for physical quantities with units. |
|
6633 | allows a simplified form of input for physical quantities with units. | |
6611 | This file is meant to be used in conjunction with the |
|
6634 | This file is meant to be used in conjunction with the | |
6612 | \family typewriter |
|
6635 | \family typewriter | |
6613 | PhysicalQInteractive |
|
6636 | PhysicalQInteractive | |
6614 | \family default |
|
6637 | \family default | |
6615 | module (in the same directory) and |
|
6638 | module (in the same directory) and | |
6616 | \family typewriter |
|
6639 | \family typewriter | |
6617 | Physics.PhysicalQuantities |
|
6640 | Physics.PhysicalQuantities | |
6618 | \family default |
|
6641 | \family default | |
6619 | from Konrad Hinsen's ScientificPython ( |
|
6642 | from Konrad Hinsen's ScientificPython ( | |
6620 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html} |
|
6643 | \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html} | |
6621 |
|
6644 | |||
6622 | \end_inset |
|
6645 | \end_inset | |
6623 |
|
6646 | |||
6624 | ). |
|
6647 | ). | |
6625 | \layout Standard |
|
6648 | \layout Standard | |
6626 |
|
6649 | |||
6627 | The |
|
6650 | The | |
6628 | \family typewriter |
|
6651 | \family typewriter | |
6629 | Physics.PhysicalQuantities |
|
6652 | Physics.PhysicalQuantities | |
6630 | \family default |
|
6653 | \family default | |
6631 | module defines |
|
6654 | module defines | |
6632 | \family typewriter |
|
6655 | \family typewriter | |
6633 | PhysicalQuantity |
|
6656 | PhysicalQuantity | |
6634 | \family default |
|
6657 | \family default | |
6635 | objects, but these must be declared as instances of a class. |
|
6658 | objects, but these must be declared as instances of a class. | |
6636 | For example, to define |
|
6659 | For example, to define | |
6637 | \family typewriter |
|
6660 | \family typewriter | |
6638 | v |
|
6661 | v | |
6639 | \family default |
|
6662 | \family default | |
6640 | as a velocity of 3\SpecialChar ~ |
|
6663 | as a velocity of 3\SpecialChar ~ | |
6641 | m/s, normally you would write: |
|
6664 | m/s, normally you would write: | |
6642 | \family typewriter |
|
6665 | \family typewriter | |
6643 |
|
6666 | |||
6644 | \newline |
|
6667 | \newline | |
6645 | In [1]: v = PhysicalQuantity(3,'m/s') |
|
6668 | In [1]: v = PhysicalQuantity(3,'m/s') | |
6646 | \layout Standard |
|
6669 | \layout Standard | |
6647 |
|
6670 | |||
6648 | Using the |
|
6671 | Using the | |
6649 | \family typewriter |
|
6672 | \family typewriter | |
6650 | PhysicalQ_Input |
|
6673 | PhysicalQ_Input | |
6651 | \family default |
|
6674 | \family default | |
6652 | extension this can be input instead as: |
|
6675 | extension this can be input instead as: | |
6653 | \family typewriter |
|
6676 | \family typewriter | |
6654 |
|
6677 | |||
6655 | \newline |
|
6678 | \newline | |
6656 | In [1]: v = 3 m/s |
|
6679 | In [1]: v = 3 m/s | |
6657 | \family default |
|
6680 | \family default | |
6658 |
|
6681 | |||
6659 | \newline |
|
6682 | \newline | |
6660 | which is much more convenient for interactive use (even though it is blatantly |
|
6683 | which is much more convenient for interactive use (even though it is blatantly | |
6661 | invalid Python syntax). |
|
6684 | invalid Python syntax). | |
6662 | \layout Standard |
|
6685 | \layout Standard | |
6663 |
|
6686 | |||
6664 | The |
|
6687 | The | |
6665 | \family typewriter |
|
6688 | \family typewriter | |
6666 | physics |
|
6689 | physics | |
6667 | \family default |
|
6690 | \family default | |
6668 | profile supplied with IPython (enabled via |
|
6691 | profile supplied with IPython (enabled via | |
6669 | \family typewriter |
|
6692 | \family typewriter | |
6670 | 'ipython -p physics' |
|
6693 | 'ipython -p physics' | |
6671 | \family default |
|
6694 | \family default | |
6672 | ) uses these extensions, which you can also activate with: |
|
6695 | ) uses these extensions, which you can also activate with: | |
6673 | \layout Standard |
|
6696 | \layout Standard | |
6674 |
|
6697 | |||
6675 |
|
6698 | |||
6676 | \family typewriter |
|
6699 | \family typewriter | |
6677 | from math import * # math MUST be imported BEFORE PhysicalQInteractive |
|
6700 | from math import * # math MUST be imported BEFORE PhysicalQInteractive | |
6678 | \newline |
|
6701 | \newline | |
6679 | from IPython.Extensions.PhysicalQInteractive import * |
|
6702 | from IPython.Extensions.PhysicalQInteractive import * | |
6680 | \newline |
|
6703 | \newline | |
6681 | import IPython.Extensions.PhysicalQInput |
|
6704 | import IPython.Extensions.PhysicalQInput | |
6682 | \layout Section |
|
6705 | \layout Section | |
6683 |
|
6706 | |||
6684 | IPython as a system shell |
|
6707 | IPython as a system shell | |
6685 | \layout Standard |
|
6708 | \layout Standard | |
6686 |
|
6709 | |||
6687 | IPython ships with a special profile called |
|
6710 | IPython ships with a special profile called | |
6688 | \family typewriter |
|
6711 | \family typewriter | |
6689 | pysh |
|
6712 | pysh | |
6690 | \family default |
|
6713 | \family default | |
6691 | , which you can activate at the command line as |
|
6714 | , which you can activate at the command line as | |
6692 | \family typewriter |
|
6715 | \family typewriter | |
6693 | `ipython -p pysh' |
|
6716 | `ipython -p pysh' | |
6694 | \family default |
|
6717 | \family default | |
6695 | . |
|
6718 | . | |
6696 | This loads |
|
6719 | This loads | |
6697 | \family typewriter |
|
6720 | \family typewriter | |
6698 | InterpreterExec |
|
6721 | InterpreterExec | |
6699 | \family default |
|
6722 | \family default | |
6700 | , along with some additional facilities and a prompt customized for filesystem |
|
6723 | , along with some additional facilities and a prompt customized for filesystem | |
6701 | navigation. |
|
6724 | navigation. | |
6702 | \layout Standard |
|
6725 | \layout Standard | |
6703 |
|
6726 | |||
6704 | Note that this does |
|
6727 | Note that this does | |
6705 | \emph on |
|
6728 | \emph on | |
6706 | not |
|
6729 | not | |
6707 | \emph default |
|
6730 | \emph default | |
6708 | make IPython a full-fledged system shell. |
|
6731 | make IPython a full-fledged system shell. | |
6709 | In particular, it has no job control, so if you type Ctrl-Z (under Unix), |
|
6732 | In particular, it has no job control, so if you type Ctrl-Z (under Unix), | |
6710 | you'll suspend pysh itself, not the process you just started. |
|
6733 | you'll suspend pysh itself, not the process you just started. | |
6711 |
|
6734 | |||
6712 | \layout Standard |
|
6735 | \layout Standard | |
6713 |
|
6736 | |||
6714 | What the shell profile allows you to do is to use the convenient and powerful |
|
6737 | What the shell profile allows you to do is to use the convenient and powerful | |
6715 | syntax of Python to do quick scripting at the command line. |
|
6738 | syntax of Python to do quick scripting at the command line. | |
6716 | Below we describe some of its features. |
|
6739 | Below we describe some of its features. | |
6717 | \layout Subsection |
|
6740 | \layout Subsection | |
6718 |
|
6741 | |||
6719 | Aliases |
|
6742 | Aliases | |
6720 | \layout Standard |
|
6743 | \layout Standard | |
6721 |
|
6744 | |||
6722 | All of your |
|
6745 | All of your | |
6723 | \family typewriter |
|
6746 | \family typewriter | |
6724 | $PATH |
|
6747 | $PATH | |
6725 | \family default |
|
6748 | \family default | |
6726 | has been loaded as IPython aliases, so you should be able to type any normal |
|
6749 | has been loaded as IPython aliases, so you should be able to type any normal | |
6727 | system command and have it executed. |
|
6750 | system command and have it executed. | |
6728 | See |
|
6751 | See | |
6729 | \family typewriter |
|
6752 | \family typewriter | |
6730 | %alias? |
|
6753 | %alias? | |
6731 | \family default |
|
6754 | \family default | |
6732 | and |
|
6755 | and | |
6733 | \family typewriter |
|
6756 | \family typewriter | |
6734 | %unalias? |
|
6757 | %unalias? | |
6735 | \family default |
|
6758 | \family default | |
6736 | for details on the alias facilities. |
|
6759 | for details on the alias facilities. | |
6737 | See also |
|
6760 | See also | |
6738 | \family typewriter |
|
6761 | \family typewriter | |
6739 | %rehash? |
|
6762 | %rehash? | |
6740 | \family default |
|
6763 | \family default | |
6741 | and |
|
6764 | and | |
6742 | \family typewriter |
|
6765 | \family typewriter | |
6743 | %rehashx? |
|
6766 | %rehashx? | |
6744 | \family default |
|
6767 | \family default | |
6745 | for details on the mechanism used to load |
|
6768 | for details on the mechanism used to load | |
6746 | \family typewriter |
|
6769 | \family typewriter | |
6747 | $PATH |
|
6770 | $PATH | |
6748 | \family default |
|
6771 | \family default | |
6749 | . |
|
6772 | . | |
6750 | \layout Subsection |
|
6773 | \layout Subsection | |
6751 |
|
6774 | |||
6752 | Special syntax |
|
6775 | Special syntax | |
6753 | \layout Standard |
|
6776 | \layout Standard | |
6754 |
|
6777 | |||
6755 | Any lines which begin with |
|
6778 | Any lines which begin with | |
6756 | \family typewriter |
|
6779 | \family typewriter | |
6757 | `~' |
|
6780 | `~' | |
6758 | \family default |
|
6781 | \family default | |
6759 | , |
|
6782 | , | |
6760 | \family typewriter |
|
6783 | \family typewriter | |
6761 | `/' |
|
6784 | `/' | |
6762 | \family default |
|
6785 | \family default | |
6763 | and |
|
6786 | and | |
6764 | \family typewriter |
|
6787 | \family typewriter | |
6765 | `.' |
|
6788 | `.' | |
6766 | \family default |
|
6789 | \family default | |
6767 | will be executed as shell commands instead of as Python code. |
|
6790 | will be executed as shell commands instead of as Python code. | |
6768 | The special escapes below are also recognized. |
|
6791 | The special escapes below are also recognized. | |
6769 |
|
6792 | |||
6770 | \family typewriter |
|
6793 | \family typewriter | |
6771 | !cmd |
|
6794 | !cmd | |
6772 | \family default |
|
6795 | \family default | |
6773 | is valid in single or multi-line input, all others are only valid in single-lin |
|
6796 | is valid in single or multi-line input, all others are only valid in single-lin | |
6774 | e input: |
|
6797 | e input: | |
6775 | \layout Description |
|
6798 | \layout Description | |
6776 |
|
6799 | |||
6777 |
|
6800 | |||
6778 | \family typewriter |
|
6801 | \family typewriter | |
6779 | !cmd |
|
6802 | !cmd | |
6780 | \family default |
|
6803 | \family default | |
6781 | pass `cmd' directly to the shell |
|
6804 | pass `cmd' directly to the shell | |
6782 | \layout Description |
|
6805 | \layout Description | |
6783 |
|
6806 | |||
6784 |
|
6807 | |||
6785 | \family typewriter |
|
6808 | \family typewriter | |
6786 | !!cmd |
|
6809 | !!cmd | |
6787 | \family default |
|
6810 | \family default | |
6788 | execute `cmd' and return output as a list (split on ` |
|
6811 | execute `cmd' and return output as a list (split on ` | |
6789 | \backslash |
|
6812 | \backslash | |
6790 | n') |
|
6813 | n') | |
6791 | \layout Description |
|
6814 | \layout Description | |
6792 |
|
6815 | |||
6793 |
|
6816 | |||
6794 | \family typewriter |
|
6817 | \family typewriter | |
6795 | $var=cmd |
|
6818 | $var=cmd | |
6796 | \family default |
|
6819 | \family default | |
6797 | capture output of cmd into var, as a string |
|
6820 | capture output of cmd into var, as a string | |
6798 | \layout Description |
|
6821 | \layout Description | |
6799 |
|
6822 | |||
6800 |
|
6823 | |||
6801 | \family typewriter |
|
6824 | \family typewriter | |
6802 | $$var=cmd |
|
6825 | $$var=cmd | |
6803 | \family default |
|
6826 | \family default | |
6804 | capture output of cmd into var, as a list (split on ` |
|
6827 | capture output of cmd into var, as a list (split on ` | |
6805 | \backslash |
|
6828 | \backslash | |
6806 | n') |
|
6829 | n') | |
6807 | \layout Standard |
|
6830 | \layout Standard | |
6808 |
|
6831 | |||
6809 | The |
|
6832 | The | |
6810 | \family typewriter |
|
6833 | \family typewriter | |
6811 | $ |
|
6834 | $ | |
6812 | \family default |
|
6835 | \family default | |
6813 | / |
|
6836 | / | |
6814 | \family typewriter |
|
6837 | \family typewriter | |
6815 | $$ |
|
6838 | $$ | |
6816 | \family default |
|
6839 | \family default | |
6817 | syntaxes make Python variables from system output, which you can later |
|
6840 | syntaxes make Python variables from system output, which you can later | |
6818 | use for further scripting. |
|
6841 | use for further scripting. | |
6819 | The converse is also possible: when executing an alias or calling to the |
|
6842 | The converse is also possible: when executing an alias or calling to the | |
6820 | system via |
|
6843 | system via | |
6821 | \family typewriter |
|
6844 | \family typewriter | |
6822 | ! |
|
6845 | ! | |
6823 | \family default |
|
6846 | \family default | |
6824 | / |
|
6847 | / | |
6825 | \family typewriter |
|
6848 | \family typewriter | |
6826 | !! |
|
6849 | !! | |
6827 | \family default |
|
6850 | \family default | |
6828 | , you can expand any python variable or expression by prepending it with |
|
6851 | , you can expand any python variable or expression by prepending it with | |
6829 |
|
6852 | |||
6830 | \family typewriter |
|
6853 | \family typewriter | |
6831 | $ |
|
6854 | $ | |
6832 | \family default |
|
6855 | \family default | |
6833 | . |
|
6856 | . | |
6834 | Full details of the allowed syntax can be found in Python's PEP 215. |
|
6857 | Full details of the allowed syntax can be found in Python's PEP 215. | |
6835 | \layout Standard |
|
6858 | \layout Standard | |
6836 |
|
6859 | |||
6837 | A few brief examples will illustrate these (note that the indentation below |
|
6860 | A few brief examples will illustrate these (note that the indentation below | |
6838 | may be incorrectly displayed): |
|
6861 | may be incorrectly displayed): | |
6839 | \layout Standard |
|
6862 | \layout Standard | |
6840 |
|
6863 | |||
6841 |
|
6864 | |||
6842 | \family typewriter |
|
6865 | \family typewriter | |
6843 | fperez[~/test]|3> !ls *s.py |
|
6866 | fperez[~/test]|3> !ls *s.py | |
6844 | \newline |
|
6867 | \newline | |
6845 | scopes.py strings.py |
|
6868 | scopes.py strings.py | |
6846 | \layout Standard |
|
6869 | \layout Standard | |
6847 |
|
6870 | |||
6848 | ls is an internal alias, so there's no need to use |
|
6871 | ls is an internal alias, so there's no need to use | |
6849 | \family typewriter |
|
6872 | \family typewriter | |
6850 | ! |
|
6873 | ! | |
6851 | \family default |
|
6874 | \family default | |
6852 | : |
|
6875 | : | |
6853 | \layout Standard |
|
6876 | \layout Standard | |
6854 |
|
6877 | |||
6855 |
|
6878 | |||
6856 | \family typewriter |
|
6879 | \family typewriter | |
6857 | fperez[~/test]|4> ls *s.py |
|
6880 | fperez[~/test]|4> ls *s.py | |
6858 | \newline |
|
6881 | \newline | |
6859 | scopes.py* strings.py |
|
6882 | scopes.py* strings.py | |
6860 | \layout Standard |
|
6883 | \layout Standard | |
6861 |
|
6884 | |||
6862 | !!ls will return the output into a Python variable: |
|
6885 | !!ls will return the output into a Python variable: | |
6863 | \layout Standard |
|
6886 | \layout Standard | |
6864 |
|
6887 | |||
6865 |
|
6888 | |||
6866 | \family typewriter |
|
6889 | \family typewriter | |
6867 | fperez[~/test]|5> !!ls *s.py |
|
6890 | fperez[~/test]|5> !!ls *s.py | |
6868 | \newline |
|
6891 | \newline | |
6869 |
|
6892 | |||
6870 | \begin_inset ERT |
|
6893 | \begin_inset ERT | |
6871 | status Collapsed |
|
6894 | status Collapsed | |
6872 |
|
6895 | |||
6873 | \layout Standard |
|
6896 | \layout Standard | |
6874 |
|
6897 | |||
6875 | \backslash |
|
6898 | \backslash | |
6876 | hspace*{0mm} |
|
6899 | hspace*{0mm} | |
6877 | \end_inset |
|
6900 | \end_inset | |
6878 |
|
6901 | |||
6879 | \SpecialChar ~ |
|
6902 | \SpecialChar ~ | |
6880 | \SpecialChar ~ |
|
6903 | \SpecialChar ~ | |
6881 | \SpecialChar ~ |
|
6904 | \SpecialChar ~ | |
6882 | \SpecialChar ~ |
|
6905 | \SpecialChar ~ | |
6883 | \SpecialChar ~ |
|
6906 | \SpecialChar ~ | |
6884 | \SpecialChar ~ |
|
6907 | \SpecialChar ~ | |
6885 | \SpecialChar ~ |
|
6908 | \SpecialChar ~ | |
6886 | \SpecialChar ~ |
|
6909 | \SpecialChar ~ | |
6887 | \SpecialChar ~ |
|
6910 | \SpecialChar ~ | |
6888 | \SpecialChar ~ |
|
6911 | \SpecialChar ~ | |
6889 | \SpecialChar ~ |
|
6912 | \SpecialChar ~ | |
6890 | \SpecialChar ~ |
|
6913 | \SpecialChar ~ | |
6891 | \SpecialChar ~ |
|
6914 | \SpecialChar ~ | |
6892 | \SpecialChar ~ |
|
6915 | \SpecialChar ~ | |
6893 | <5> ['scopes.py', 'strings.py'] |
|
6916 | <5> ['scopes.py', 'strings.py'] | |
6894 | \newline |
|
6917 | \newline | |
6895 | fperez[~/test]|6> print _5 |
|
6918 | fperez[~/test]|6> print _5 | |
6896 | \newline |
|
6919 | \newline | |
6897 | ['scopes.py', 'strings.py'] |
|
6920 | ['scopes.py', 'strings.py'] | |
6898 | \layout Standard |
|
6921 | \layout Standard | |
6899 |
|
6922 | |||
6900 |
|
6923 | |||
6901 | \family typewriter |
|
6924 | \family typewriter | |
6902 | $ |
|
6925 | $ | |
6903 | \family default |
|
6926 | \family default | |
6904 | and |
|
6927 | and | |
6905 | \family typewriter |
|
6928 | \family typewriter | |
6906 | $$ |
|
6929 | $$ | |
6907 | \family default |
|
6930 | \family default | |
6908 | allow direct capture to named variables: |
|
6931 | allow direct capture to named variables: | |
6909 | \layout Standard |
|
6932 | \layout Standard | |
6910 |
|
6933 | |||
6911 |
|
6934 | |||
6912 | \family typewriter |
|
6935 | \family typewriter | |
6913 | fperez[~/test]|7> $astr = ls *s.py |
|
6936 | fperez[~/test]|7> $astr = ls *s.py | |
6914 | \newline |
|
6937 | \newline | |
6915 | fperez[~/test]|8> astr |
|
6938 | fperez[~/test]|8> astr | |
6916 | \newline |
|
6939 | \newline | |
6917 |
|
6940 | |||
6918 | \begin_inset ERT |
|
6941 | \begin_inset ERT | |
6919 | status Collapsed |
|
6942 | status Collapsed | |
6920 |
|
6943 | |||
6921 | \layout Standard |
|
6944 | \layout Standard | |
6922 |
|
6945 | |||
6923 | \backslash |
|
6946 | \backslash | |
6924 | hspace*{0mm} |
|
6947 | hspace*{0mm} | |
6925 | \end_inset |
|
6948 | \end_inset | |
6926 |
|
6949 | |||
6927 | \SpecialChar ~ |
|
6950 | \SpecialChar ~ | |
6928 | \SpecialChar ~ |
|
6951 | \SpecialChar ~ | |
6929 | \SpecialChar ~ |
|
6952 | \SpecialChar ~ | |
6930 | \SpecialChar ~ |
|
6953 | \SpecialChar ~ | |
6931 | \SpecialChar ~ |
|
6954 | \SpecialChar ~ | |
6932 | \SpecialChar ~ |
|
6955 | \SpecialChar ~ | |
6933 | \SpecialChar ~ |
|
6956 | \SpecialChar ~ | |
6934 | \SpecialChar ~ |
|
6957 | \SpecialChar ~ | |
6935 | \SpecialChar ~ |
|
6958 | \SpecialChar ~ | |
6936 | \SpecialChar ~ |
|
6959 | \SpecialChar ~ | |
6937 | \SpecialChar ~ |
|
6960 | \SpecialChar ~ | |
6938 | \SpecialChar ~ |
|
6961 | \SpecialChar ~ | |
6939 | \SpecialChar ~ |
|
6962 | \SpecialChar ~ | |
6940 | \SpecialChar ~ |
|
6963 | \SpecialChar ~ | |
6941 | <8> 'scopes.py |
|
6964 | <8> 'scopes.py | |
6942 | \backslash |
|
6965 | \backslash | |
6943 | nstrings.py' |
|
6966 | nstrings.py' | |
6944 | \layout Standard |
|
6967 | \layout Standard | |
6945 |
|
6968 | |||
6946 |
|
6969 | |||
6947 | \family typewriter |
|
6970 | \family typewriter | |
6948 | fperez[~/test]|9> $$alist = ls *s.py |
|
6971 | fperez[~/test]|9> $$alist = ls *s.py | |
6949 | \newline |
|
6972 | \newline | |
6950 | fperez[~/test]|10> alist |
|
6973 | fperez[~/test]|10> alist | |
6951 | \newline |
|
6974 | \newline | |
6952 |
|
6975 | |||
6953 | \begin_inset ERT |
|
6976 | \begin_inset ERT | |
6954 | status Collapsed |
|
6977 | status Collapsed | |
6955 |
|
6978 | |||
6956 | \layout Standard |
|
6979 | \layout Standard | |
6957 |
|
6980 | |||
6958 | \backslash |
|
6981 | \backslash | |
6959 | hspace*{0mm} |
|
6982 | hspace*{0mm} | |
6960 | \end_inset |
|
6983 | \end_inset | |
6961 |
|
6984 | |||
6962 | \SpecialChar ~ |
|
6985 | \SpecialChar ~ | |
6963 | \SpecialChar ~ |
|
6986 | \SpecialChar ~ | |
6964 | \SpecialChar ~ |
|
6987 | \SpecialChar ~ | |
6965 | \SpecialChar ~ |
|
6988 | \SpecialChar ~ | |
6966 | \SpecialChar ~ |
|
6989 | \SpecialChar ~ | |
6967 | \SpecialChar ~ |
|
6990 | \SpecialChar ~ | |
6968 | \SpecialChar ~ |
|
6991 | \SpecialChar ~ | |
6969 | \SpecialChar ~ |
|
6992 | \SpecialChar ~ | |
6970 | \SpecialChar ~ |
|
6993 | \SpecialChar ~ | |
6971 | \SpecialChar ~ |
|
6994 | \SpecialChar ~ | |
6972 | \SpecialChar ~ |
|
6995 | \SpecialChar ~ | |
6973 | \SpecialChar ~ |
|
6996 | \SpecialChar ~ | |
6974 | \SpecialChar ~ |
|
6997 | \SpecialChar ~ | |
6975 | \SpecialChar ~ |
|
6998 | \SpecialChar ~ | |
6976 | <10> ['scopes.py', 'strings.py'] |
|
6999 | <10> ['scopes.py', 'strings.py'] | |
6977 | \layout Standard |
|
7000 | \layout Standard | |
6978 |
|
7001 | |||
6979 | alist is now a normal python list you can loop over. |
|
7002 | alist is now a normal python list you can loop over. | |
6980 | Using |
|
7003 | Using | |
6981 | \family typewriter |
|
7004 | \family typewriter | |
6982 | $ |
|
7005 | $ | |
6983 | \family default |
|
7006 | \family default | |
6984 | will expand back the python values when alias calls are made: |
|
7007 | will expand back the python values when alias calls are made: | |
6985 | \layout Standard |
|
7008 | \layout Standard | |
6986 |
|
7009 | |||
6987 |
|
7010 | |||
6988 | \family typewriter |
|
7011 | \family typewriter | |
6989 | fperez[~/test]|11> for f in alist: |
|
7012 | fperez[~/test]|11> for f in alist: | |
6990 | \newline |
|
7013 | \newline | |
6991 |
|
7014 | |||
6992 | \begin_inset ERT |
|
7015 | \begin_inset ERT | |
6993 | status Collapsed |
|
7016 | status Collapsed | |
6994 |
|
7017 | |||
6995 | \layout Standard |
|
7018 | \layout Standard | |
6996 |
|
7019 | |||
6997 | \backslash |
|
7020 | \backslash | |
6998 | hspace*{0mm} |
|
7021 | hspace*{0mm} | |
6999 | \end_inset |
|
7022 | \end_inset | |
7000 |
|
7023 | |||
7001 | \SpecialChar ~ |
|
7024 | \SpecialChar ~ | |
7002 | \SpecialChar ~ |
|
7025 | \SpecialChar ~ | |
7003 | \SpecialChar ~ |
|
7026 | \SpecialChar ~ | |
7004 | \SpecialChar ~ |
|
7027 | \SpecialChar ~ | |
7005 | \SpecialChar ~ |
|
7028 | \SpecialChar ~ | |
7006 | \SpecialChar ~ |
|
7029 | \SpecialChar ~ | |
7007 | \SpecialChar ~ |
|
7030 | \SpecialChar ~ | |
7008 | \SpecialChar ~ |
|
7031 | \SpecialChar ~ | |
7009 | \SpecialChar ~ |
|
7032 | \SpecialChar ~ | |
7010 | \SpecialChar ~ |
|
7033 | \SpecialChar ~ | |
7011 | \SpecialChar ~ |
|
7034 | \SpecialChar ~ | |
7012 | \SpecialChar ~ |
|
7035 | \SpecialChar ~ | |
7013 | \SpecialChar ~ |
|
7036 | \SpecialChar ~ | |
7014 | \SpecialChar ~ |
|
7037 | \SpecialChar ~ | |
7015 | |..> \SpecialChar ~ |
|
7038 | |..> \SpecialChar ~ | |
7016 | \SpecialChar ~ |
|
7039 | \SpecialChar ~ | |
7017 | \SpecialChar ~ |
|
7040 | \SpecialChar ~ | |
7018 | \SpecialChar ~ |
|
7041 | \SpecialChar ~ | |
7019 | print 'file',f, |
|
7042 | print 'file',f, | |
7020 | \newline |
|
7043 | \newline | |
7021 |
|
7044 | |||
7022 | \begin_inset ERT |
|
7045 | \begin_inset ERT | |
7023 | status Collapsed |
|
7046 | status Collapsed | |
7024 |
|
7047 | |||
7025 | \layout Standard |
|
7048 | \layout Standard | |
7026 |
|
7049 | |||
7027 | \backslash |
|
7050 | \backslash | |
7028 | hspace*{0mm} |
|
7051 | hspace*{0mm} | |
7029 | \end_inset |
|
7052 | \end_inset | |
7030 |
|
7053 | |||
7031 | \SpecialChar ~ |
|
7054 | \SpecialChar ~ | |
7032 | \SpecialChar ~ |
|
7055 | \SpecialChar ~ | |
7033 | \SpecialChar ~ |
|
7056 | \SpecialChar ~ | |
7034 | \SpecialChar ~ |
|
7057 | \SpecialChar ~ | |
7035 | \SpecialChar ~ |
|
7058 | \SpecialChar ~ | |
7036 | \SpecialChar ~ |
|
7059 | \SpecialChar ~ | |
7037 | \SpecialChar ~ |
|
7060 | \SpecialChar ~ | |
7038 | \SpecialChar ~ |
|
7061 | \SpecialChar ~ | |
7039 | \SpecialChar ~ |
|
7062 | \SpecialChar ~ | |
7040 | \SpecialChar ~ |
|
7063 | \SpecialChar ~ | |
7041 | \SpecialChar ~ |
|
7064 | \SpecialChar ~ | |
7042 | \SpecialChar ~ |
|
7065 | \SpecialChar ~ | |
7043 | \SpecialChar ~ |
|
7066 | \SpecialChar ~ | |
7044 | \SpecialChar ~ |
|
7067 | \SpecialChar ~ | |
7045 | |..> \SpecialChar ~ |
|
7068 | |..> \SpecialChar ~ | |
7046 | \SpecialChar ~ |
|
7069 | \SpecialChar ~ | |
7047 | \SpecialChar ~ |
|
7070 | \SpecialChar ~ | |
7048 | \SpecialChar ~ |
|
7071 | \SpecialChar ~ | |
7049 | wc -l $f |
|
7072 | wc -l $f | |
7050 | \newline |
|
7073 | \newline | |
7051 |
|
7074 | |||
7052 | \begin_inset ERT |
|
7075 | \begin_inset ERT | |
7053 | status Collapsed |
|
7076 | status Collapsed | |
7054 |
|
7077 | |||
7055 | \layout Standard |
|
7078 | \layout Standard | |
7056 |
|
7079 | |||
7057 | \backslash |
|
7080 | \backslash | |
7058 | hspace*{0mm} |
|
7081 | hspace*{0mm} | |
7059 | \end_inset |
|
7082 | \end_inset | |
7060 |
|
7083 | |||
7061 | \SpecialChar ~ |
|
7084 | \SpecialChar ~ | |
7062 | \SpecialChar ~ |
|
7085 | \SpecialChar ~ | |
7063 | \SpecialChar ~ |
|
7086 | \SpecialChar ~ | |
7064 | \SpecialChar ~ |
|
7087 | \SpecialChar ~ | |
7065 | \SpecialChar ~ |
|
7088 | \SpecialChar ~ | |
7066 | \SpecialChar ~ |
|
7089 | \SpecialChar ~ | |
7067 | \SpecialChar ~ |
|
7090 | \SpecialChar ~ | |
7068 | \SpecialChar ~ |
|
7091 | \SpecialChar ~ | |
7069 | \SpecialChar ~ |
|
7092 | \SpecialChar ~ | |
7070 | \SpecialChar ~ |
|
7093 | \SpecialChar ~ | |
7071 | \SpecialChar ~ |
|
7094 | \SpecialChar ~ | |
7072 | \SpecialChar ~ |
|
7095 | \SpecialChar ~ | |
7073 | \SpecialChar ~ |
|
7096 | \SpecialChar ~ | |
7074 | \SpecialChar ~ |
|
7097 | \SpecialChar ~ | |
7075 | |..> |
|
7098 | |..> | |
7076 | \newline |
|
7099 | \newline | |
7077 | file scopes.py 13 scopes.py |
|
7100 | file scopes.py 13 scopes.py | |
7078 | \newline |
|
7101 | \newline | |
7079 | file strings.py 4 strings.py |
|
7102 | file strings.py 4 strings.py | |
7080 | \layout Standard |
|
7103 | \layout Standard | |
7081 |
|
7104 | |||
7082 | Note that you may need to protect your variables with braces if you want |
|
7105 | Note that you may need to protect your variables with braces if you want | |
7083 | to append strings to their names. |
|
7106 | to append strings to their names. | |
7084 | To copy all files in alist to |
|
7107 | To copy all files in alist to | |
7085 | \family typewriter |
|
7108 | \family typewriter | |
7086 | .bak |
|
7109 | .bak | |
7087 | \family default |
|
7110 | \family default | |
7088 | extensions, you must use: |
|
7111 | extensions, you must use: | |
7089 | \layout Standard |
|
7112 | \layout Standard | |
7090 |
|
7113 | |||
7091 |
|
7114 | |||
7092 | \family typewriter |
|
7115 | \family typewriter | |
7093 | fperez[~/test]|12> for f in alist: |
|
7116 | fperez[~/test]|12> for f in alist: | |
7094 | \newline |
|
7117 | \newline | |
7095 |
|
7118 | |||
7096 | \begin_inset ERT |
|
7119 | \begin_inset ERT | |
7097 | status Collapsed |
|
7120 | status Collapsed | |
7098 |
|
7121 | |||
7099 | \layout Standard |
|
7122 | \layout Standard | |
7100 |
|
7123 | |||
7101 | \backslash |
|
7124 | \backslash | |
7102 | hspace*{0mm} |
|
7125 | hspace*{0mm} | |
7103 | \end_inset |
|
7126 | \end_inset | |
7104 |
|
7127 | |||
7105 | \SpecialChar ~ |
|
7128 | \SpecialChar ~ | |
7106 | \SpecialChar ~ |
|
7129 | \SpecialChar ~ | |
7107 | \SpecialChar ~ |
|
7130 | \SpecialChar ~ | |
7108 | \SpecialChar ~ |
|
7131 | \SpecialChar ~ | |
7109 | \SpecialChar ~ |
|
7132 | \SpecialChar ~ | |
7110 | \SpecialChar ~ |
|
7133 | \SpecialChar ~ | |
7111 | \SpecialChar ~ |
|
7134 | \SpecialChar ~ | |
7112 | \SpecialChar ~ |
|
7135 | \SpecialChar ~ | |
7113 | \SpecialChar ~ |
|
7136 | \SpecialChar ~ | |
7114 | \SpecialChar ~ |
|
7137 | \SpecialChar ~ | |
7115 | \SpecialChar ~ |
|
7138 | \SpecialChar ~ | |
7116 | \SpecialChar ~ |
|
7139 | \SpecialChar ~ | |
7117 | \SpecialChar ~ |
|
7140 | \SpecialChar ~ | |
7118 | \SpecialChar ~ |
|
7141 | \SpecialChar ~ | |
7119 | |..> \SpecialChar ~ |
|
7142 | |..> \SpecialChar ~ | |
7120 | \SpecialChar ~ |
|
7143 | \SpecialChar ~ | |
7121 | \SpecialChar ~ |
|
7144 | \SpecialChar ~ | |
7122 | \SpecialChar ~ |
|
7145 | \SpecialChar ~ | |
7123 | cp $f ${f}.bak |
|
7146 | cp $f ${f}.bak | |
7124 | \layout Standard |
|
7147 | \layout Standard | |
7125 |
|
7148 | |||
7126 | If you try using |
|
7149 | If you try using | |
7127 | \family typewriter |
|
7150 | \family typewriter | |
7128 | $f.bak |
|
7151 | $f.bak | |
7129 | \family default |
|
7152 | \family default | |
7130 | , you'll get an AttributeError exception saying that your string object |
|
7153 | , you'll get an AttributeError exception saying that your string object | |
7131 | doesn't have a |
|
7154 | doesn't have a | |
7132 | \family typewriter |
|
7155 | \family typewriter | |
7133 | .bak |
|
7156 | .bak | |
7134 | \family default |
|
7157 | \family default | |
7135 | attribute. |
|
7158 | attribute. | |
7136 | This is because the |
|
7159 | This is because the | |
7137 | \family typewriter |
|
7160 | \family typewriter | |
7138 | $ |
|
7161 | $ | |
7139 | \family default |
|
7162 | \family default | |
7140 | expansion mechanism allows you to expand full Python expressions: |
|
7163 | expansion mechanism allows you to expand full Python expressions: | |
7141 | \layout Standard |
|
7164 | \layout Standard | |
7142 |
|
7165 | |||
7143 |
|
7166 | |||
7144 | \family typewriter |
|
7167 | \family typewriter | |
7145 | fperez[~/test]|13> echo "sys.platform is: $sys.platform" |
|
7168 | fperez[~/test]|13> echo "sys.platform is: $sys.platform" | |
7146 | \newline |
|
7169 | \newline | |
7147 | sys.platform is: linux2 |
|
7170 | sys.platform is: linux2 | |
7148 | \layout Standard |
|
7171 | \layout Standard | |
7149 |
|
7172 | |||
7150 | IPython's input history handling is still active, which allows you to rerun |
|
7173 | IPython's input history handling is still active, which allows you to rerun | |
7151 | a single block of multi-line input by simply using exec: |
|
7174 | a single block of multi-line input by simply using exec: | |
7152 | \newline |
|
7175 | \newline | |
7153 |
|
7176 | |||
7154 | \family typewriter |
|
7177 | \family typewriter | |
7155 | fperez[~/test]|14> $$alist = ls *.eps |
|
7178 | fperez[~/test]|14> $$alist = ls *.eps | |
7156 | \newline |
|
7179 | \newline | |
7157 | fperez[~/test]|15> exec _i11 |
|
7180 | fperez[~/test]|15> exec _i11 | |
7158 | \newline |
|
7181 | \newline | |
7159 | file image2.eps 921 image2.eps |
|
7182 | file image2.eps 921 image2.eps | |
7160 | \newline |
|
7183 | \newline | |
7161 | file image.eps 921 image.eps |
|
7184 | file image.eps 921 image.eps | |
7162 | \layout Standard |
|
7185 | \layout Standard | |
7163 |
|
7186 | |||
7164 | While these are new special-case syntaxes, they are designed to allow very |
|
7187 | While these are new special-case syntaxes, they are designed to allow very | |
7165 | efficient use of the shell with minimal typing. |
|
7188 | efficient use of the shell with minimal typing. | |
7166 | At an interactive shell prompt, conciseness of expression wins over readability. |
|
7189 | At an interactive shell prompt, conciseness of expression wins over readability. | |
7167 | \layout Subsection |
|
7190 | \layout Subsection | |
7168 |
|
7191 | |||
7169 | Useful functions and modules |
|
7192 | Useful functions and modules | |
7170 | \layout Standard |
|
7193 | \layout Standard | |
7171 |
|
7194 | |||
7172 | The os, sys and shutil modules from the Python standard library are automaticall |
|
7195 | The os, sys and shutil modules from the Python standard library are automaticall | |
7173 | y loaded. |
|
7196 | y loaded. | |
7174 | Some additional functions, useful for shell usage, are listed below. |
|
7197 | Some additional functions, useful for shell usage, are listed below. | |
7175 | You can request more help about them with ` |
|
7198 | You can request more help about them with ` | |
7176 | \family typewriter |
|
7199 | \family typewriter | |
7177 | ? |
|
7200 | ? | |
7178 | \family default |
|
7201 | \family default | |
7179 | '. |
|
7202 | '. | |
7180 | \layout Description |
|
7203 | \layout Description | |
7181 |
|
7204 | |||
7182 |
|
7205 | |||
7183 | \family typewriter |
|
7206 | \family typewriter | |
7184 | shell |
|
7207 | shell | |
7185 | \family default |
|
7208 | \family default | |
7186 | - execute a command in the underlying system shell |
|
7209 | - execute a command in the underlying system shell | |
7187 | \layout Description |
|
7210 | \layout Description | |
7188 |
|
7211 | |||
7189 |
|
7212 | |||
7190 | \family typewriter |
|
7213 | \family typewriter | |
7191 | system |
|
7214 | system | |
7192 | \family default |
|
7215 | \family default | |
7193 | - like |
|
7216 | - like | |
7194 | \family typewriter |
|
7217 | \family typewriter | |
7195 | shell() |
|
7218 | shell() | |
7196 | \family default |
|
7219 | \family default | |
7197 | , but return the exit status of the command |
|
7220 | , but return the exit status of the command | |
7198 | \layout Description |
|
7221 | \layout Description | |
7199 |
|
7222 | |||
7200 |
|
7223 | |||
7201 | \family typewriter |
|
7224 | \family typewriter | |
7202 | sout |
|
7225 | sout | |
7203 | \family default |
|
7226 | \family default | |
7204 | - capture the output of a command as a string |
|
7227 | - capture the output of a command as a string | |
7205 | \layout Description |
|
7228 | \layout Description | |
7206 |
|
7229 | |||
7207 |
|
7230 | |||
7208 | \family typewriter |
|
7231 | \family typewriter | |
7209 | lout |
|
7232 | lout | |
7210 | \family default |
|
7233 | \family default | |
7211 | - capture the output of a command as a list (split on ` |
|
7234 | - capture the output of a command as a list (split on ` | |
7212 | \backslash |
|
7235 | \backslash | |
7213 | n') |
|
7236 | n') | |
7214 | \layout Description |
|
7237 | \layout Description | |
7215 |
|
7238 | |||
7216 |
|
7239 | |||
7217 | \family typewriter |
|
7240 | \family typewriter | |
7218 | getoutputerror |
|
7241 | getoutputerror | |
7219 | \family default |
|
7242 | \family default | |
7220 | - capture (output,error) of a shell commandss |
|
7243 | - capture (output,error) of a shell commandss | |
7221 | \layout Standard |
|
7244 | \layout Standard | |
7222 |
|
7245 | |||
7223 |
|
7246 | |||
7224 | \family typewriter |
|
7247 | \family typewriter | |
7225 | sout |
|
7248 | sout | |
7226 | \family default |
|
7249 | \family default | |
7227 | / |
|
7250 | / | |
7228 | \family typewriter |
|
7251 | \family typewriter | |
7229 | lout |
|
7252 | lout | |
7230 | \family default |
|
7253 | \family default | |
7231 | are the functional equivalents of |
|
7254 | are the functional equivalents of | |
7232 | \family typewriter |
|
7255 | \family typewriter | |
7233 | $ |
|
7256 | $ | |
7234 | \family default |
|
7257 | \family default | |
7235 | / |
|
7258 | / | |
7236 | \family typewriter |
|
7259 | \family typewriter | |
7237 | $$ |
|
7260 | $$ | |
7238 | \family default |
|
7261 | \family default | |
7239 | . |
|
7262 | . | |
7240 | They are provided to allow you to capture system output in the middle of |
|
7263 | They are provided to allow you to capture system output in the middle of | |
7241 | true python code, function definitions, etc (where |
|
7264 | true python code, function definitions, etc (where | |
7242 | \family typewriter |
|
7265 | \family typewriter | |
7243 | $ |
|
7266 | $ | |
7244 | \family default |
|
7267 | \family default | |
7245 | and |
|
7268 | and | |
7246 | \family typewriter |
|
7269 | \family typewriter | |
7247 | $$ |
|
7270 | $$ | |
7248 | \family default |
|
7271 | \family default | |
7249 | are invalid). |
|
7272 | are invalid). | |
7250 | \layout Subsection |
|
7273 | \layout Subsection | |
7251 |
|
7274 | |||
7252 | Directory management |
|
7275 | Directory management | |
7253 | \layout Standard |
|
7276 | \layout Standard | |
7254 |
|
7277 | |||
7255 | Since each command passed by pysh to the underlying system is executed in |
|
7278 | Since each command passed by pysh to the underlying system is executed in | |
7256 | a subshell which exits immediately, you can NOT use !cd to navigate the |
|
7279 | a subshell which exits immediately, you can NOT use !cd to navigate the | |
7257 | filesystem. |
|
7280 | filesystem. | |
7258 | \layout Standard |
|
7281 | \layout Standard | |
7259 |
|
7282 | |||
7260 | Pysh provides its own builtin |
|
7283 | Pysh provides its own builtin | |
7261 | \family typewriter |
|
7284 | \family typewriter | |
7262 | `%cd |
|
7285 | `%cd | |
7263 | \family default |
|
7286 | \family default | |
7264 | ' magic command to move in the filesystem (the |
|
7287 | ' magic command to move in the filesystem (the | |
7265 | \family typewriter |
|
7288 | \family typewriter | |
7266 | % |
|
7289 | % | |
7267 | \family default |
|
7290 | \family default | |
7268 | is not required with automagic on). |
|
7291 | is not required with automagic on). | |
7269 | It also maintains a list of visited directories (use |
|
7292 | It also maintains a list of visited directories (use | |
7270 | \family typewriter |
|
7293 | \family typewriter | |
7271 | %dhist |
|
7294 | %dhist | |
7272 | \family default |
|
7295 | \family default | |
7273 | to see it) and allows direct switching to any of them. |
|
7296 | to see it) and allows direct switching to any of them. | |
7274 | Type |
|
7297 | Type | |
7275 | \family typewriter |
|
7298 | \family typewriter | |
7276 | `cd? |
|
7299 | `cd? | |
7277 | \family default |
|
7300 | \family default | |
7278 | ' for more details. |
|
7301 | ' for more details. | |
7279 | \layout Standard |
|
7302 | \layout Standard | |
7280 |
|
7303 | |||
7281 |
|
7304 | |||
7282 | \family typewriter |
|
7305 | \family typewriter | |
7283 | %pushd |
|
7306 | %pushd | |
7284 | \family default |
|
7307 | \family default | |
7285 | , |
|
7308 | , | |
7286 | \family typewriter |
|
7309 | \family typewriter | |
7287 | %popd |
|
7310 | %popd | |
7288 | \family default |
|
7311 | \family default | |
7289 | and |
|
7312 | and | |
7290 | \family typewriter |
|
7313 | \family typewriter | |
7291 | %dirs |
|
7314 | %dirs | |
7292 | \family default |
|
7315 | \family default | |
7293 | are provided for directory stack handling. |
|
7316 | are provided for directory stack handling. | |
7294 | \layout Subsection |
|
7317 | \layout Subsection | |
7295 |
|
7318 | |||
7296 | Prompt customization |
|
7319 | Prompt customization | |
7297 | \layout Standard |
|
7320 | \layout Standard | |
7298 |
|
7321 | |||
7299 | The supplied |
|
7322 | The supplied | |
7300 | \family typewriter |
|
7323 | \family typewriter | |
7301 | ipythonrc-pysh |
|
7324 | ipythonrc-pysh | |
7302 | \family default |
|
7325 | \family default | |
7303 | profile comes with an example of a very colored and detailed prompt, mainly |
|
7326 | profile comes with an example of a very colored and detailed prompt, mainly | |
7304 | to serve as an illustration. |
|
7327 | to serve as an illustration. | |
7305 | The valid escape sequences, besides color names, are: |
|
7328 | The valid escape sequences, besides color names, are: | |
7306 | \layout Description |
|
7329 | \layout Description | |
7307 |
|
7330 | |||
7308 |
|
7331 | |||
7309 | \backslash |
|
7332 | \backslash | |
7310 | # - Prompt number. |
|
7333 | # - Prompt number. | |
7311 | \layout Description |
|
7334 | \layout Description | |
7312 |
|
7335 | |||
7313 |
|
7336 | |||
7314 | \backslash |
|
7337 | \backslash | |
7315 | D - Dots, as many as there are digits in |
|
7338 | D - Dots, as many as there are digits in | |
7316 | \backslash |
|
7339 | \backslash | |
7317 | # (so they align). |
|
7340 | # (so they align). | |
7318 | \layout Description |
|
7341 | \layout Description | |
7319 |
|
7342 | |||
7320 |
|
7343 | |||
7321 | \backslash |
|
7344 | \backslash | |
7322 | w - Current working directory (cwd). |
|
7345 | w - Current working directory (cwd). | |
7323 | \layout Description |
|
7346 | \layout Description | |
7324 |
|
7347 | |||
7325 |
|
7348 | |||
7326 | \backslash |
|
7349 | \backslash | |
7327 | W - Basename of current working directory. |
|
7350 | W - Basename of current working directory. | |
7328 | \layout Description |
|
7351 | \layout Description | |
7329 |
|
7352 | |||
7330 |
|
7353 | |||
7331 | \backslash |
|
7354 | \backslash | |
7332 | X |
|
7355 | X | |
7333 | \emph on |
|
7356 | \emph on | |
7334 | N |
|
7357 | N | |
7335 | \emph default |
|
7358 | \emph default | |
7336 | - Where |
|
7359 | - Where | |
7337 | \emph on |
|
7360 | \emph on | |
7338 | N |
|
7361 | N | |
7339 | \emph default |
|
7362 | \emph default | |
7340 | =0..5. |
|
7363 | =0..5. | |
7341 | N terms of the cwd, with $HOME written as ~. |
|
7364 | N terms of the cwd, with $HOME written as ~. | |
7342 | \layout Description |
|
7365 | \layout Description | |
7343 |
|
7366 | |||
7344 |
|
7367 | |||
7345 | \backslash |
|
7368 | \backslash | |
7346 | Y |
|
7369 | Y | |
7347 | \emph on |
|
7370 | \emph on | |
7348 | N |
|
7371 | N | |
7349 | \emph default |
|
7372 | \emph default | |
7350 | - Where |
|
7373 | - Where | |
7351 | \emph on |
|
7374 | \emph on | |
7352 | N |
|
7375 | N | |
7353 | \emph default |
|
7376 | \emph default | |
7354 | =0..5. |
|
7377 | =0..5. | |
7355 | Like X |
|
7378 | Like X | |
7356 | \emph on |
|
7379 | \emph on | |
7357 | N |
|
7380 | N | |
7358 | \emph default |
|
7381 | \emph default | |
7359 | , but if ~ is term |
|
7382 | , but if ~ is term | |
7360 | \emph on |
|
7383 | \emph on | |
7361 | N |
|
7384 | N | |
7362 | \emph default |
|
7385 | \emph default | |
7363 | +1 it's also shown. |
|
7386 | +1 it's also shown. | |
7364 | \layout Description |
|
7387 | \layout Description | |
7365 |
|
7388 | |||
7366 |
|
7389 | |||
7367 | \backslash |
|
7390 | \backslash | |
7368 | u - Username. |
|
7391 | u - Username. | |
7369 | \layout Description |
|
7392 | \layout Description | |
7370 |
|
7393 | |||
7371 |
|
7394 | |||
7372 | \backslash |
|
7395 | \backslash | |
7373 | H - Full hostname. |
|
7396 | H - Full hostname. | |
7374 | \layout Description |
|
7397 | \layout Description | |
7375 |
|
7398 | |||
7376 |
|
7399 | |||
7377 | \backslash |
|
7400 | \backslash | |
7378 | h - Hostname up to first '.' |
|
7401 | h - Hostname up to first '.' | |
7379 | \layout Description |
|
7402 | \layout Description | |
7380 |
|
7403 | |||
7381 |
|
7404 | |||
7382 | \backslash |
|
7405 | \backslash | |
7383 | $ - Root symbol ($ or #). |
|
7406 | $ - Root symbol ($ or #). | |
7384 |
|
7407 | |||
7385 | \layout Description |
|
7408 | \layout Description | |
7386 |
|
7409 | |||
7387 |
|
7410 | |||
7388 | \backslash |
|
7411 | \backslash | |
7389 | t - Current time, in H:M:S format. |
|
7412 | t - Current time, in H:M:S format. | |
7390 | \layout Description |
|
7413 | \layout Description | |
7391 |
|
7414 | |||
7392 |
|
7415 | |||
7393 | \backslash |
|
7416 | \backslash | |
7394 | v - IPython release version. |
|
7417 | v - IPython release version. | |
7395 |
|
7418 | |||
7396 | \layout Description |
|
7419 | \layout Description | |
7397 |
|
7420 | |||
7398 |
|
7421 | |||
7399 | \backslash |
|
7422 | \backslash | |
7400 | n - Newline. |
|
7423 | n - Newline. | |
7401 |
|
7424 | |||
7402 | \layout Description |
|
7425 | \layout Description | |
7403 |
|
7426 | |||
7404 |
|
7427 | |||
7405 | \backslash |
|
7428 | \backslash | |
7406 | r - Carriage return. |
|
7429 | r - Carriage return. | |
7407 |
|
7430 | |||
7408 | \layout Description |
|
7431 | \layout Description | |
7409 |
|
7432 | |||
7410 |
|
7433 | |||
7411 | \backslash |
|
7434 | \backslash | |
7412 |
|
7435 | |||
7413 | \backslash |
|
7436 | \backslash | |
7414 | - An explicitly escaped ' |
|
7437 | - An explicitly escaped ' | |
7415 | \backslash |
|
7438 | \backslash | |
7416 | '. |
|
7439 | '. | |
7417 | \layout Standard |
|
7440 | \layout Standard | |
7418 |
|
7441 | |||
7419 | You can configure your prompt colors using any ANSI color escape. |
|
7442 | You can configure your prompt colors using any ANSI color escape. | |
7420 | Each color escape sets the color for any subsequent text, until another |
|
7443 | Each color escape sets the color for any subsequent text, until another | |
7421 | escape comes in and changes things. |
|
7444 | escape comes in and changes things. | |
7422 | The valid color escapes are: |
|
7445 | The valid color escapes are: | |
7423 | \layout Description |
|
7446 | \layout Description | |
7424 |
|
7447 | |||
7425 |
|
7448 | |||
7426 | \backslash |
|
7449 | \backslash | |
7427 | C_Black |
|
7450 | C_Black | |
7428 | \layout Description |
|
7451 | \layout Description | |
7429 |
|
7452 | |||
7430 |
|
7453 | |||
7431 | \backslash |
|
7454 | \backslash | |
7432 | C_Blue |
|
7455 | C_Blue | |
7433 | \layout Description |
|
7456 | \layout Description | |
7434 |
|
7457 | |||
7435 |
|
7458 | |||
7436 | \backslash |
|
7459 | \backslash | |
7437 | C_Brown |
|
7460 | C_Brown | |
7438 | \layout Description |
|
7461 | \layout Description | |
7439 |
|
7462 | |||
7440 |
|
7463 | |||
7441 | \backslash |
|
7464 | \backslash | |
7442 | C_Cyan |
|
7465 | C_Cyan | |
7443 | \layout Description |
|
7466 | \layout Description | |
7444 |
|
7467 | |||
7445 |
|
7468 | |||
7446 | \backslash |
|
7469 | \backslash | |
7447 | C_DarkGray |
|
7470 | C_DarkGray | |
7448 | \layout Description |
|
7471 | \layout Description | |
7449 |
|
7472 | |||
7450 |
|
7473 | |||
7451 | \backslash |
|
7474 | \backslash | |
7452 | C_Green |
|
7475 | C_Green | |
7453 | \layout Description |
|
7476 | \layout Description | |
7454 |
|
7477 | |||
7455 |
|
7478 | |||
7456 | \backslash |
|
7479 | \backslash | |
7457 | C_LightBlue |
|
7480 | C_LightBlue | |
7458 | \layout Description |
|
7481 | \layout Description | |
7459 |
|
7482 | |||
7460 |
|
7483 | |||
7461 | \backslash |
|
7484 | \backslash | |
7462 | C_LightCyan |
|
7485 | C_LightCyan | |
7463 | \layout Description |
|
7486 | \layout Description | |
7464 |
|
7487 | |||
7465 |
|
7488 | |||
7466 | \backslash |
|
7489 | \backslash | |
7467 | C_LightGray |
|
7490 | C_LightGray | |
7468 | \layout Description |
|
7491 | \layout Description | |
7469 |
|
7492 | |||
7470 |
|
7493 | |||
7471 | \backslash |
|
7494 | \backslash | |
7472 | C_LightGreen |
|
7495 | C_LightGreen | |
7473 | \layout Description |
|
7496 | \layout Description | |
7474 |
|
7497 | |||
7475 |
|
7498 | |||
7476 | \backslash |
|
7499 | \backslash | |
7477 | C_LightPurple |
|
7500 | C_LightPurple | |
7478 | \layout Description |
|
7501 | \layout Description | |
7479 |
|
7502 | |||
7480 |
|
7503 | |||
7481 | \backslash |
|
7504 | \backslash | |
7482 | C_LightRed |
|
7505 | C_LightRed | |
7483 | \layout Description |
|
7506 | \layout Description | |
7484 |
|
7507 | |||
7485 |
|
7508 | |||
7486 | \backslash |
|
7509 | \backslash | |
7487 | C_Purple |
|
7510 | C_Purple | |
7488 | \layout Description |
|
7511 | \layout Description | |
7489 |
|
7512 | |||
7490 |
|
7513 | |||
7491 | \backslash |
|
7514 | \backslash | |
7492 | C_Red |
|
7515 | C_Red | |
7493 | \layout Description |
|
7516 | \layout Description | |
7494 |
|
7517 | |||
7495 |
|
7518 | |||
7496 | \backslash |
|
7519 | \backslash | |
7497 | C_White |
|
7520 | C_White | |
7498 | \layout Description |
|
7521 | \layout Description | |
7499 |
|
7522 | |||
7500 |
|
7523 | |||
7501 | \backslash |
|
7524 | \backslash | |
7502 | C_Yellow |
|
7525 | C_Yellow | |
7503 | \layout Description |
|
7526 | \layout Description | |
7504 |
|
7527 | |||
7505 |
|
7528 | |||
7506 | \backslash |
|
7529 | \backslash | |
7507 | C_Normal Stop coloring, defaults to your terminal settings. |
|
7530 | C_Normal Stop coloring, defaults to your terminal settings. | |
7508 | \layout Section |
|
7531 | \layout Section | |
7509 |
|
7532 | |||
7510 |
|
7533 | |||
7511 | \begin_inset LatexCommand \label{sec:Threading-support} |
|
7534 | \begin_inset LatexCommand \label{sec:Threading-support} | |
7512 |
|
7535 | |||
7513 | \end_inset |
|
7536 | \end_inset | |
7514 |
|
7537 | |||
7515 | Threading support |
|
7538 | Threading support | |
7516 | \layout Standard |
|
7539 | \layout Standard | |
7517 |
|
7540 | |||
7518 |
|
7541 | |||
7519 | \series bold |
|
7542 | \series bold | |
7520 | WARNING: |
|
7543 | WARNING: | |
7521 | \series default |
|
7544 | \series default | |
7522 | The threading support is still somewhat experimental, and it has only seen |
|
7545 | The threading support is still somewhat experimental, and it has only seen | |
7523 | reasonable testing under Linux. |
|
7546 | reasonable testing under Linux. | |
7524 | Threaded code is particularly tricky to debug, and it tends to show extremely |
|
7547 | Threaded code is particularly tricky to debug, and it tends to show extremely | |
7525 | platform-dependent behavior. |
|
7548 | platform-dependent behavior. | |
7526 | Since I only have access to Linux machines, I will have to rely on user's |
|
7549 | Since I only have access to Linux machines, I will have to rely on user's | |
7527 | experiences and assistance for this area of IPython to improve under other |
|
7550 | experiences and assistance for this area of IPython to improve under other | |
7528 | platforms. |
|
7551 | platforms. | |
7529 | \layout Standard |
|
7552 | \layout Standard | |
7530 |
|
7553 | |||
7531 | IPython, via the |
|
7554 | IPython, via the | |
7532 | \family typewriter |
|
7555 | \family typewriter | |
7533 | -gthread |
|
7556 | -gthread | |
7534 | \family default |
|
7557 | \family default | |
|
7558 | , | |||
|
7559 | \family typewriter | |||
|
7560 | -qthread | |||
|
7561 | \family default | |||
7535 | and |
|
7562 | and | |
7536 | \family typewriter |
|
7563 | \family typewriter | |
7537 | -wthread |
|
7564 | -wthread | |
7538 | \family default |
|
7565 | \family default | |
7539 | options (described in Sec.\SpecialChar ~ |
|
7566 | options (described in Sec.\SpecialChar ~ | |
7540 |
|
7567 | |||
7541 | \begin_inset LatexCommand \ref{sec:threading-opts} |
|
7568 | \begin_inset LatexCommand \ref{sec:threading-opts} | |
7542 |
|
7569 | |||
7543 | \end_inset |
|
7570 | \end_inset | |
7544 |
|
7571 | |||
7545 | ), can run in multithreaded mode to support pyGTK and WXPython applications |
|
7572 | ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications | |
7546 | respectively. |
|
7573 | respectively. | |
7547 |
|
|
7574 | These GUI toolkits need to control the python main loop of execution, so | |
7548 |
|
|
7575 | under a normal Python interpreter, starting a pyGTK, Qt or WXPython application | |
7549 |
|
|
7576 | will immediately freeze the shell. | |
7550 |
|
7577 | |||
7551 | \layout Standard |
|
7578 | \layout Standard | |
7552 |
|
7579 | |||
7553 | IPython, with one of these options (you can only use one at a time), separates |
|
7580 | IPython, with one of these options (you can only use one at a time), separates | |
7554 | the graphical loop and IPython's code execution run into different threads. |
|
7581 | the graphical loop and IPython's code execution run into different threads. | |
7555 | This allows you to test interactively (with |
|
7582 | This allows you to test interactively (with | |
7556 | \family typewriter |
|
7583 | \family typewriter | |
7557 | %run |
|
7584 | %run | |
7558 | \family default |
|
7585 | \family default | |
7559 | , for example) your GUI code without blocking. |
|
7586 | , for example) your GUI code without blocking. | |
|
7587 | \layout Standard | |||
|
7588 | ||||
|
7589 | A nice mini-tutorial on using IPython along with the Qt Designer application | |||
|
7590 | is available at the SciPy wiki: | |||
|
7591 | \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner} | |||
|
7592 | ||||
|
7593 | \end_inset | |||
|
7594 | ||||
|
7595 | . | |||
7560 | \layout Subsection |
|
7596 | \layout Subsection | |
7561 |
|
7597 | |||
7562 | Tk issues |
|
7598 | Tk issues | |
7563 | \layout Standard |
|
7599 | \layout Standard | |
7564 |
|
7600 | |||
7565 | As indicated in Sec.\SpecialChar ~ |
|
7601 | As indicated in Sec.\SpecialChar ~ | |
7566 |
|
7602 | |||
7567 | \begin_inset LatexCommand \ref{sec:threading-opts} |
|
7603 | \begin_inset LatexCommand \ref{sec:threading-opts} | |
7568 |
|
7604 | |||
7569 | \end_inset |
|
7605 | \end_inset | |
7570 |
|
7606 | |||
7571 | , a special |
|
7607 | , a special | |
7572 | \family typewriter |
|
7608 | \family typewriter | |
7573 | -tk |
|
7609 | -tk | |
7574 | \family default |
|
7610 | \family default | |
7575 | option is provided to try and allow Tk graphical applications to coexist |
|
7611 | option is provided to try and allow Tk graphical applications to coexist | |
7576 | interactively with WX or GTK ones. |
|
7612 | interactively with WX, Qt or GTK ones. | |
7577 | Whether this works at all, however, is very platform and configuration |
|
7613 | Whether this works at all, however, is very platform and configuration | |
7578 | dependent. |
|
7614 | dependent. | |
7579 | Please experiment with simple test cases before committing to using this |
|
7615 | Please experiment with simple test cases before committing to using this | |
7580 |
combination of Tk and |
|
7616 | combination of Tk and GTK/Qt/WX threading in a production environment. | |
7581 | \layout Subsection |
|
7617 | \layout Subsection | |
7582 |
|
7618 | |||
7583 | Signals and Threads |
|
7619 | Signals and Threads | |
7584 | \layout Standard |
|
7620 | \layout Standard | |
7585 |
|
7621 | |||
7586 |
When any of the thread systems ( |
|
7622 | When any of the thread systems (GTK, Qt or WX) are active, either directly | |
7587 | via |
|
7623 | or via | |
7588 | \family typewriter |
|
7624 | \family typewriter | |
7589 | -pylab |
|
7625 | -pylab | |
7590 | \family default |
|
7626 | \family default | |
7591 | with a threaded backend, it is impossible to interrupt long-running Python |
|
7627 | with a threaded backend, it is impossible to interrupt long-running Python | |
7592 | code via |
|
7628 | code via | |
7593 | \family typewriter |
|
7629 | \family typewriter | |
7594 | Ctrl-C |
|
7630 | Ctrl-C | |
7595 | \family default |
|
7631 | \family default | |
7596 | . |
|
7632 | . | |
7597 | IPython can not pass the KeyboardInterrupt exception (or the underlying |
|
7633 | IPython can not pass the KeyboardInterrupt exception (or the underlying | |
7598 |
|
7634 | |||
7599 | \family typewriter |
|
7635 | \family typewriter | |
7600 | SIGINT |
|
7636 | SIGINT | |
7601 | \family default |
|
7637 | \family default | |
7602 | ) across threads, so any long-running process started from IPython will |
|
7638 | ) across threads, so any long-running process started from IPython will | |
7603 | run to completion, or will have to be killed via an external (OS-based) |
|
7639 | run to completion, or will have to be killed via an external (OS-based) | |
7604 | mechanism. |
|
7640 | mechanism. | |
7605 | \layout Standard |
|
7641 | \layout Standard | |
7606 |
|
7642 | |||
7607 | To the best of my knowledge, this limitation is imposed by the Python interprete |
|
7643 | To the best of my knowledge, this limitation is imposed by the Python interprete | |
7608 | r itself, and it comes from the difficulty of writing portable signal/threaded |
|
7644 | r itself, and it comes from the difficulty of writing portable signal/threaded | |
7609 | code. |
|
7645 | code. | |
7610 | If any user is an expert on this topic and can suggest a better solution, |
|
7646 | If any user is an expert on this topic and can suggest a better solution, | |
7611 | I would love to hear about it. |
|
7647 | I would love to hear about it. | |
7612 | In the IPython sources, look at the |
|
7648 | In the IPython sources, look at the | |
7613 | \family typewriter |
|
7649 | \family typewriter | |
7614 | Shell.py |
|
7650 | Shell.py | |
7615 | \family default |
|
7651 | \family default | |
7616 | module, and in particular at the |
|
7652 | module, and in particular at the | |
7617 | \family typewriter |
|
7653 | \family typewriter | |
7618 | runcode() |
|
7654 | runcode() | |
7619 | \family default |
|
7655 | \family default | |
7620 | method. |
|
7656 | method. | |
7621 |
|
7657 | |||
7622 | \layout Subsection |
|
7658 | \layout Subsection | |
7623 |
|
7659 | |||
7624 | I/O pitfalls |
|
7660 | I/O pitfalls | |
7625 | \layout Standard |
|
7661 | \layout Standard | |
7626 |
|
7662 | |||
7627 | Be mindful that the Python interpreter switches between threads every |
|
7663 | Be mindful that the Python interpreter switches between threads every | |
7628 | \begin_inset Formula $N$ |
|
7664 | \begin_inset Formula $N$ | |
7629 | \end_inset |
|
7665 | \end_inset | |
7630 |
|
7666 | |||
7631 | bytecodes, where the default value as of Python\SpecialChar ~ |
|
7667 | bytecodes, where the default value as of Python\SpecialChar ~ | |
7632 | 2.3 is |
|
7668 | 2.3 is | |
7633 | \begin_inset Formula $N=100.$ |
|
7669 | \begin_inset Formula $N=100.$ | |
7634 | \end_inset |
|
7670 | \end_inset | |
7635 |
|
7671 | |||
7636 | This value can be read by using the |
|
7672 | This value can be read by using the | |
7637 | \family typewriter |
|
7673 | \family typewriter | |
7638 | sys.getcheckinterval() |
|
7674 | sys.getcheckinterval() | |
7639 | \family default |
|
7675 | \family default | |
7640 | function, and it can be reset via |
|
7676 | function, and it can be reset via | |
7641 | \family typewriter |
|
7677 | \family typewriter | |
7642 | sys.setcheckinterval( |
|
7678 | sys.setcheckinterval( | |
7643 | \emph on |
|
7679 | \emph on | |
7644 | N |
|
7680 | N | |
7645 | \emph default |
|
7681 | \emph default | |
7646 | ) |
|
7682 | ) | |
7647 | \family default |
|
7683 | \family default | |
7648 | . |
|
7684 | . | |
7649 | This switching of threads can cause subtly confusing effects if one of |
|
7685 | This switching of threads can cause subtly confusing effects if one of | |
7650 | your threads is doing file I/O. |
|
7686 | your threads is doing file I/O. | |
7651 | In text mode, most systems only flush file buffers when they encounter |
|
7687 | In text mode, most systems only flush file buffers when they encounter | |
7652 | a |
|
7688 | a | |
7653 | \family typewriter |
|
7689 | \family typewriter | |
7654 | ` |
|
7690 | ` | |
7655 | \backslash |
|
7691 | \backslash | |
7656 | n' |
|
7692 | n' | |
7657 | \family default |
|
7693 | \family default | |
7658 | . |
|
7694 | . | |
7659 | An instruction as simple as |
|
7695 | An instruction as simple as | |
7660 | \family typewriter |
|
7696 | \family typewriter | |
7661 |
|
7697 | |||
7662 | \newline |
|
7698 | \newline | |
7663 | \SpecialChar ~ |
|
7699 | \SpecialChar ~ | |
7664 | \SpecialChar ~ |
|
7700 | \SpecialChar ~ | |
7665 | print >> filehandle, |
|
7701 | print >> filehandle, | |
7666 | \begin_inset Quotes eld |
|
7702 | \begin_inset Quotes eld | |
7667 | \end_inset |
|
7703 | \end_inset | |
7668 |
|
7704 | |||
7669 | hello world |
|
7705 | hello world | |
7670 | \begin_inset Quotes erd |
|
7706 | \begin_inset Quotes erd | |
7671 | \end_inset |
|
7707 | \end_inset | |
7672 |
|
7708 | |||
7673 |
|
7709 | |||
7674 | \family default |
|
7710 | \family default | |
7675 |
|
7711 | |||
7676 | \newline |
|
7712 | \newline | |
7677 | actually consists of several bytecodes, so it is possible that the newline |
|
7713 | actually consists of several bytecodes, so it is possible that the newline | |
7678 | does not reach your file before the next thread switch. |
|
7714 | does not reach your file before the next thread switch. | |
7679 | Similarly, if you are writing to a file in binary mode, the file won't |
|
7715 | Similarly, if you are writing to a file in binary mode, the file won't | |
7680 | be flushed until the buffer fills, and your other thread may see apparently |
|
7716 | be flushed until the buffer fills, and your other thread may see apparently | |
7681 | truncated files. |
|
7717 | truncated files. | |
7682 |
|
7718 | |||
7683 | \layout Standard |
|
7719 | \layout Standard | |
7684 |
|
7720 | |||
7685 | For this reason, if you are using IPython's thread support and have (for |
|
7721 | For this reason, if you are using IPython's thread support and have (for | |
7686 | example) a GUI application which will read data generated by files written |
|
7722 | example) a GUI application which will read data generated by files written | |
7687 | to from the IPython thread, the safest approach is to open all of your |
|
7723 | to from the IPython thread, the safest approach is to open all of your | |
7688 | files in unbuffered mode (the third argument to the |
|
7724 | files in unbuffered mode (the third argument to the | |
7689 | \family typewriter |
|
7725 | \family typewriter | |
7690 | file/open |
|
7726 | file/open | |
7691 | \family default |
|
7727 | \family default | |
7692 | function is the buffering value): |
|
7728 | function is the buffering value): | |
7693 | \newline |
|
7729 | \newline | |
7694 |
|
7730 | |||
7695 | \family typewriter |
|
7731 | \family typewriter | |
7696 | \SpecialChar ~ |
|
7732 | \SpecialChar ~ | |
7697 | \SpecialChar ~ |
|
7733 | \SpecialChar ~ | |
7698 | filehandle = open(filename,mode,0) |
|
7734 | filehandle = open(filename,mode,0) | |
7699 | \layout Standard |
|
7735 | \layout Standard | |
7700 |
|
7736 | |||
7701 | This is obviously a brute force way of avoiding race conditions with the |
|
7737 | This is obviously a brute force way of avoiding race conditions with the | |
7702 | file buffering. |
|
7738 | file buffering. | |
7703 | If you want to do it cleanly, and you have a resource which is being shared |
|
7739 | If you want to do it cleanly, and you have a resource which is being shared | |
7704 | by the interactive IPython loop and your GUI thread, you should really |
|
7740 | by the interactive IPython loop and your GUI thread, you should really | |
7705 | handle it with thread locking and syncrhonization properties. |
|
7741 | handle it with thread locking and syncrhonization properties. | |
7706 | The Python documentation discusses these. |
|
7742 | The Python documentation discusses these. | |
7707 | \layout Section |
|
7743 | \layout Section | |
7708 |
|
7744 | |||
7709 |
|
7745 | |||
7710 | \begin_inset LatexCommand \label{sec:interactive-demos} |
|
7746 | \begin_inset LatexCommand \label{sec:interactive-demos} | |
7711 |
|
7747 | |||
7712 | \end_inset |
|
7748 | \end_inset | |
7713 |
|
7749 | |||
7714 | Interactive demos with IPython |
|
7750 | Interactive demos with IPython | |
7715 | \layout Standard |
|
7751 | \layout Standard | |
7716 |
|
7752 | |||
7717 | IPython ships with |
|
7753 | IPython ships with XXX | |
7718 | \layout Standard |
|
7754 | \layout Standard | |
7719 |
|
7755 | |||
7720 |
|
7756 | |||
7721 | \begin_inset ERT |
|
7757 | \begin_inset ERT | |
7722 | status Open |
|
7758 | status Open | |
7723 |
|
7759 | |||
7724 | \layout Standard |
|
7760 | \layout Standard | |
7725 |
|
7761 | |||
7726 | \backslash |
|
7762 | \backslash | |
7727 |
|
|
7763 | codelist{examples/example-demo.py} | |
7728 | \end_inset |
|
7764 | \end_inset | |
7729 |
|
7765 | |||
7730 |
|
7766 | |||
7731 | \layout Section |
|
7767 | \layout Section | |
7732 |
|
7768 | |||
7733 |
|
7769 | |||
7734 | \begin_inset LatexCommand \label{sec:matplotlib-support} |
|
7770 | \begin_inset LatexCommand \label{sec:matplotlib-support} | |
7735 |
|
7771 | |||
7736 | \end_inset |
|
7772 | \end_inset | |
7737 |
|
7773 | |||
7738 | Plotting with |
|
7774 | Plotting with | |
7739 | \family typewriter |
|
7775 | \family typewriter | |
7740 | matplotlib |
|
7776 | matplotlib | |
7741 | \family default |
|
7777 | \family default | |
7742 |
|
7778 | |||
7743 | \layout Standard |
|
7779 | \layout Standard | |
7744 |
|
7780 | |||
7745 | The matplotlib library ( |
|
7781 | The matplotlib library ( | |
7746 | \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net} |
|
7782 | \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net} | |
7747 |
|
7783 | |||
7748 | \end_inset |
|
7784 | \end_inset | |
7749 |
|
7785 | |||
7750 | ) provides high quality 2D plotting for Python. |
|
7786 | ) provides high quality 2D plotting for Python. | |
7751 | Matplotlib can produce plots on screen using a variety of GUI toolkits, |
|
7787 | Matplotlib can produce plots on screen using a variety of GUI toolkits, | |
7752 | including Tk, GTK and WXPython. |
|
7788 | including Tk, GTK and WXPython. | |
7753 | It also provides a number of commands useful for scientific computing, |
|
7789 | It also provides a number of commands useful for scientific computing, | |
7754 | all with a syntax compatible with that of the popular Matlab program. |
|
7790 | all with a syntax compatible with that of the popular Matlab program. | |
7755 | \layout Standard |
|
7791 | \layout Standard | |
7756 |
|
7792 | |||
7757 | IPython accepts the special option |
|
7793 | IPython accepts the special option | |
7758 | \family typewriter |
|
7794 | \family typewriter | |
7759 | -pylab |
|
7795 | -pylab | |
7760 | \family default |
|
7796 | \family default | |
7761 | (Sec.\SpecialChar ~ |
|
7797 | (Sec.\SpecialChar ~ | |
7762 |
|
7798 | |||
7763 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} |
|
7799 | \begin_inset LatexCommand \ref{sec:cmd-line-opts} | |
7764 |
|
7800 | |||
7765 | \end_inset |
|
7801 | \end_inset | |
7766 |
|
7802 | |||
7767 | ). |
|
7803 | ). | |
7768 | This configures it to support matplotlib, honoring the settings in the |
|
7804 | This configures it to support matplotlib, honoring the settings in the | |
7769 |
|
7805 | |||
7770 | \family typewriter |
|
7806 | \family typewriter | |
7771 | .matplotlibrc |
|
7807 | .matplotlibrc | |
7772 | \family default |
|
7808 | \family default | |
7773 | file. |
|
7809 | file. | |
7774 | IPython will detect the user's choice of matplotlib GUI backend, and automatica |
|
7810 | IPython will detect the user's choice of matplotlib GUI backend, and automatica | |
7775 | lly select the proper threading model to prevent blocking. |
|
7811 | lly select the proper threading model to prevent blocking. | |
7776 | It also sets matplotlib in interactive mode and modifies |
|
7812 | It also sets matplotlib in interactive mode and modifies | |
7777 | \family typewriter |
|
7813 | \family typewriter | |
7778 | %run |
|
7814 | %run | |
7779 | \family default |
|
7815 | \family default | |
7780 | slightly, so that any matplotlib-based script can be executed using |
|
7816 | slightly, so that any matplotlib-based script can be executed using | |
7781 | \family typewriter |
|
7817 | \family typewriter | |
7782 | %run |
|
7818 | %run | |
7783 | \family default |
|
7819 | \family default | |
7784 | and the final |
|
7820 | and the final | |
7785 | \family typewriter |
|
7821 | \family typewriter | |
7786 | show() |
|
7822 | show() | |
7787 | \family default |
|
7823 | \family default | |
7788 | command does not block the interactive shell. |
|
7824 | command does not block the interactive shell. | |
7789 | \layout Standard |
|
7825 | \layout Standard | |
7790 |
|
7826 | |||
7791 | The |
|
7827 | The | |
7792 | \family typewriter |
|
7828 | \family typewriter | |
7793 | -pylab |
|
7829 | -pylab | |
7794 | \family default |
|
7830 | \family default | |
7795 | option must be given first in order for IPython to configure its threading |
|
7831 | option must be given first in order for IPython to configure its threading | |
7796 | mode. |
|
7832 | mode. | |
7797 | However, you can still issue other options afterwards. |
|
7833 | However, you can still issue other options afterwards. | |
7798 | This allows you to have a matplotlib-based environment customized with |
|
7834 | This allows you to have a matplotlib-based environment customized with | |
7799 | additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~ |
|
7835 | additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~ | |
7800 |
|
7836 | |||
7801 | \begin_inset LatexCommand \ref{sec:profiles} |
|
7837 | \begin_inset LatexCommand \ref{sec:profiles} | |
7802 |
|
7838 | |||
7803 | \end_inset |
|
7839 | \end_inset | |
7804 |
|
7840 | |||
7805 | ): `` |
|
7841 | ): `` | |
7806 | \family typewriter |
|
7842 | \family typewriter | |
7807 | ipython -pylab -p myprofile |
|
7843 | ipython -pylab -p myprofile | |
7808 | \family default |
|
7844 | \family default | |
7809 | '' will load the profile defined in |
|
7845 | '' will load the profile defined in | |
7810 | \family typewriter |
|
7846 | \family typewriter | |
7811 | ipythonrc-myprofile |
|
7847 | ipythonrc-myprofile | |
7812 | \family default |
|
7848 | \family default | |
7813 | after configuring matplotlib. |
|
7849 | after configuring matplotlib. | |
7814 | \layout Section |
|
7850 | \layout Section | |
7815 |
|
7851 | |||
7816 |
|
7852 | |||
7817 | \begin_inset LatexCommand \label{sec:Gnuplot} |
|
7853 | \begin_inset LatexCommand \label{sec:Gnuplot} | |
7818 |
|
7854 | |||
7819 | \end_inset |
|
7855 | \end_inset | |
7820 |
|
7856 | |||
7821 | Plotting with |
|
7857 | Plotting with | |
7822 | \family typewriter |
|
7858 | \family typewriter | |
7823 | Gnuplot |
|
7859 | Gnuplot | |
7824 | \layout Standard |
|
7860 | \layout Standard | |
7825 |
|
7861 | |||
7826 | Through the magic extension system described in sec. |
|
7862 | Through the magic extension system described in sec. | |
7827 |
|
7863 | |||
7828 | \begin_inset LatexCommand \ref{sec:magic} |
|
7864 | \begin_inset LatexCommand \ref{sec:magic} | |
7829 |
|
7865 | |||
7830 | \end_inset |
|
7866 | \end_inset | |
7831 |
|
7867 | |||
7832 | , IPython incorporates a mechanism for conveniently interfacing with the |
|
7868 | , IPython incorporates a mechanism for conveniently interfacing with the | |
7833 | Gnuplot system ( |
|
7869 | Gnuplot system ( | |
7834 | \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info} |
|
7870 | \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info} | |
7835 |
|
7871 | |||
7836 | \end_inset |
|
7872 | \end_inset | |
7837 |
|
7873 | |||
7838 | ). |
|
7874 | ). | |
7839 | Gnuplot is a very complete 2D and 3D plotting package available for many |
|
7875 | Gnuplot is a very complete 2D and 3D plotting package available for many | |
7840 | operating systems and commonly included in modern Linux distributions. |
|
7876 | operating systems and commonly included in modern Linux distributions. | |
7841 |
|
7877 | |||
7842 | \layout Standard |
|
7878 | \layout Standard | |
7843 |
|
7879 | |||
7844 | Besides having Gnuplot installed, this functionality requires the |
|
7880 | Besides having Gnuplot installed, this functionality requires the | |
7845 | \family typewriter |
|
7881 | \family typewriter | |
7846 | Gnuplot.py |
|
7882 | Gnuplot.py | |
7847 | \family default |
|
7883 | \family default | |
7848 | module for interfacing python with Gnuplot. |
|
7884 | module for interfacing python with Gnuplot. | |
7849 | It can be downloaded from: |
|
7885 | It can be downloaded from: | |
7850 | \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net} |
|
7886 | \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net} | |
7851 |
|
7887 | |||
7852 | \end_inset |
|
7888 | \end_inset | |
7853 |
|
7889 | |||
7854 | . |
|
7890 | . | |
7855 | \layout Subsection |
|
7891 | \layout Subsection | |
7856 |
|
7892 | |||
7857 | Proper Gnuplot configuration |
|
7893 | Proper Gnuplot configuration | |
7858 | \layout Standard |
|
7894 | \layout Standard | |
7859 |
|
7895 | |||
7860 | As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support. |
|
7896 | As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support. | |
7861 | However, as of |
|
7897 | However, as of | |
7862 | \family typewriter |
|
7898 | \family typewriter | |
7863 | Gnuplot.py |
|
7899 | Gnuplot.py | |
7864 | \family default |
|
7900 | \family default | |
7865 | version 1.7, a new option was added to communicate between Python and Gnuplot |
|
7901 | version 1.7, a new option was added to communicate between Python and Gnuplot | |
7866 | via FIFOs (pipes). |
|
7902 | via FIFOs (pipes). | |
7867 | This mechanism, while fast, also breaks the mouse system. |
|
7903 | This mechanism, while fast, also breaks the mouse system. | |
7868 | You must therefore set the variable |
|
7904 | You must therefore set the variable | |
7869 | \family typewriter |
|
7905 | \family typewriter | |
7870 | prefer_fifo_data |
|
7906 | prefer_fifo_data | |
7871 | \family default |
|
7907 | \family default | |
7872 | to |
|
7908 | to | |
7873 | \family typewriter |
|
7909 | \family typewriter | |
7874 | 0 |
|
7910 | 0 | |
7875 | \family default |
|
7911 | \family default | |
7876 | in file |
|
7912 | in file | |
7877 | \family typewriter |
|
7913 | \family typewriter | |
7878 | gp_unix.py |
|
7914 | gp_unix.py | |
7879 | \family default |
|
7915 | \family default | |
7880 | if you wish to keep the interactive mouse and keyboard features working |
|
7916 | if you wish to keep the interactive mouse and keyboard features working | |
7881 | properly ( |
|
7917 | properly ( | |
7882 | \family typewriter |
|
7918 | \family typewriter | |
7883 | prefer_inline_data |
|
7919 | prefer_inline_data | |
7884 | \family default |
|
7920 | \family default | |
7885 | also must be |
|
7921 | also must be | |
7886 | \family typewriter |
|
7922 | \family typewriter | |
7887 | 0 |
|
7923 | 0 | |
7888 | \family default |
|
7924 | \family default | |
7889 | , but this is the default so unless you've changed it manually you should |
|
7925 | , but this is the default so unless you've changed it manually you should | |
7890 | be fine). |
|
7926 | be fine). | |
7891 | \layout Standard |
|
7927 | \layout Standard | |
7892 |
|
7928 | |||
7893 | 'Out of the box', Gnuplot is configured with a rather poor set of size, |
|
7929 | 'Out of the box', Gnuplot is configured with a rather poor set of size, | |
7894 | color and linewidth choices which make the graphs fairly hard to read on |
|
7930 | color and linewidth choices which make the graphs fairly hard to read on | |
7895 | modern high-resolution displays (although they work fine on old 640x480 |
|
7931 | modern high-resolution displays (although they work fine on old 640x480 | |
7896 | ones). |
|
7932 | ones). | |
7897 | Below is a section of my |
|
7933 | Below is a section of my | |
7898 | \family typewriter |
|
7934 | \family typewriter | |
7899 | .Xdefaults |
|
7935 | .Xdefaults | |
7900 | \family default |
|
7936 | \family default | |
7901 | file which I use for having a more convenient Gnuplot setup. |
|
7937 | file which I use for having a more convenient Gnuplot setup. | |
7902 | Remember to load it by running |
|
7938 | Remember to load it by running | |
7903 | \family typewriter |
|
7939 | \family typewriter | |
7904 | `xrdb .Xdefaults` |
|
7940 | `xrdb .Xdefaults` | |
7905 | \family default |
|
7941 | \family default | |
7906 | : |
|
7942 | : | |
7907 | \layout Standard |
|
7943 | \layout Standard | |
7908 |
|
7944 | |||
7909 |
|
7945 | |||
7910 | \family typewriter |
|
7946 | \family typewriter | |
7911 | !****************************************************************** |
|
7947 | !****************************************************************** | |
7912 | \newline |
|
7948 | \newline | |
7913 | ! gnuplot options |
|
7949 | ! gnuplot options | |
7914 | \newline |
|
7950 | \newline | |
7915 | ! modify this for a convenient window size |
|
7951 | ! modify this for a convenient window size | |
7916 | \newline |
|
7952 | \newline | |
7917 | gnuplot*geometry: 780x580 |
|
7953 | gnuplot*geometry: 780x580 | |
7918 | \layout Standard |
|
7954 | \layout Standard | |
7919 |
|
7955 | |||
7920 |
|
7956 | |||
7921 | \family typewriter |
|
7957 | \family typewriter | |
7922 | ! on-screen font (not for PostScript) |
|
7958 | ! on-screen font (not for PostScript) | |
7923 | \newline |
|
7959 | \newline | |
7924 | gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1 |
|
7960 | gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1 | |
7925 | \layout Standard |
|
7961 | \layout Standard | |
7926 |
|
7962 | |||
7927 |
|
7963 | |||
7928 | \family typewriter |
|
7964 | \family typewriter | |
7929 | ! color options |
|
7965 | ! color options | |
7930 | \newline |
|
7966 | \newline | |
7931 | gnuplot*background: black |
|
7967 | gnuplot*background: black | |
7932 | \newline |
|
7968 | \newline | |
7933 | gnuplot*textColor: white |
|
7969 | gnuplot*textColor: white | |
7934 | \newline |
|
7970 | \newline | |
7935 | gnuplot*borderColor: white |
|
7971 | gnuplot*borderColor: white | |
7936 | \newline |
|
7972 | \newline | |
7937 | gnuplot*axisColor: white |
|
7973 | gnuplot*axisColor: white | |
7938 | \newline |
|
7974 | \newline | |
7939 | gnuplot*line1Color: red |
|
7975 | gnuplot*line1Color: red | |
7940 | \newline |
|
7976 | \newline | |
7941 | gnuplot*line2Color: green |
|
7977 | gnuplot*line2Color: green | |
7942 | \newline |
|
7978 | \newline | |
7943 | gnuplot*line3Color: blue |
|
7979 | gnuplot*line3Color: blue | |
7944 | \newline |
|
7980 | \newline | |
7945 | gnuplot*line4Color: magenta |
|
7981 | gnuplot*line4Color: magenta | |
7946 | \newline |
|
7982 | \newline | |
7947 | gnuplot*line5Color: cyan |
|
7983 | gnuplot*line5Color: cyan | |
7948 | \newline |
|
7984 | \newline | |
7949 | gnuplot*line6Color: sienna |
|
7985 | gnuplot*line6Color: sienna | |
7950 | \newline |
|
7986 | \newline | |
7951 | gnuplot*line7Color: orange |
|
7987 | gnuplot*line7Color: orange | |
7952 | \newline |
|
7988 | \newline | |
7953 | gnuplot*line8Color: coral |
|
7989 | gnuplot*line8Color: coral | |
7954 | \layout Standard |
|
7990 | \layout Standard | |
7955 |
|
7991 | |||
7956 |
|
7992 | |||
7957 | \family typewriter |
|
7993 | \family typewriter | |
7958 | ! multiplicative factor for point styles |
|
7994 | ! multiplicative factor for point styles | |
7959 | \newline |
|
7995 | \newline | |
7960 | gnuplot*pointsize: 2 |
|
7996 | gnuplot*pointsize: 2 | |
7961 | \layout Standard |
|
7997 | \layout Standard | |
7962 |
|
7998 | |||
7963 |
|
7999 | |||
7964 | \family typewriter |
|
8000 | \family typewriter | |
7965 | ! line width options (in pixels) |
|
8001 | ! line width options (in pixels) | |
7966 | \newline |
|
8002 | \newline | |
7967 | gnuplot*borderWidth: 2 |
|
8003 | gnuplot*borderWidth: 2 | |
7968 | \newline |
|
8004 | \newline | |
7969 | gnuplot*axisWidth: 2 |
|
8005 | gnuplot*axisWidth: 2 | |
7970 | \newline |
|
8006 | \newline | |
7971 | gnuplot*line1Width: 2 |
|
8007 | gnuplot*line1Width: 2 | |
7972 | \newline |
|
8008 | \newline | |
7973 | gnuplot*line2Width: 2 |
|
8009 | gnuplot*line2Width: 2 | |
7974 | \newline |
|
8010 | \newline | |
7975 | gnuplot*line3Width: 2 |
|
8011 | gnuplot*line3Width: 2 | |
7976 | \newline |
|
8012 | \newline | |
7977 | gnuplot*line4Width: 2 |
|
8013 | gnuplot*line4Width: 2 | |
7978 | \newline |
|
8014 | \newline | |
7979 | gnuplot*line5Width: 2 |
|
8015 | gnuplot*line5Width: 2 | |
7980 | \newline |
|
8016 | \newline | |
7981 | gnuplot*line6Width: 2 |
|
8017 | gnuplot*line6Width: 2 | |
7982 | \newline |
|
8018 | \newline | |
7983 | gnuplot*line7Width: 2 |
|
8019 | gnuplot*line7Width: 2 | |
7984 | \newline |
|
8020 | \newline | |
7985 | gnuplot*line8Width: 2 |
|
8021 | gnuplot*line8Width: 2 | |
7986 | \layout Subsection |
|
8022 | \layout Subsection | |
7987 |
|
8023 | |||
7988 | The |
|
8024 | The | |
7989 | \family typewriter |
|
8025 | \family typewriter | |
7990 | IPython.GnuplotRuntime |
|
8026 | IPython.GnuplotRuntime | |
7991 | \family default |
|
8027 | \family default | |
7992 | module |
|
8028 | module | |
7993 | \layout Standard |
|
8029 | \layout Standard | |
7994 |
|
8030 | |||
7995 | IPython includes a module called |
|
8031 | IPython includes a module called | |
7996 | \family typewriter |
|
8032 | \family typewriter | |
7997 | Gnuplot2.py |
|
8033 | Gnuplot2.py | |
7998 | \family default |
|
8034 | \family default | |
7999 | which extends and improves the default |
|
8035 | which extends and improves the default | |
8000 | \family typewriter |
|
8036 | \family typewriter | |
8001 | Gnuplot |
|
8037 | Gnuplot | |
8002 | \family default |
|
8038 | \family default | |
8003 | . |
|
8039 | . | |
8004 | \family typewriter |
|
8040 | \family typewriter | |
8005 | py |
|
8041 | py | |
8006 | \family default |
|
8042 | \family default | |
8007 | (which it still relies upon). |
|
8043 | (which it still relies upon). | |
8008 | For example, the new |
|
8044 | For example, the new | |
8009 | \family typewriter |
|
8045 | \family typewriter | |
8010 | plot |
|
8046 | plot | |
8011 | \family default |
|
8047 | \family default | |
8012 | function adds several improvements to the original making it more convenient |
|
8048 | function adds several improvements to the original making it more convenient | |
8013 | for interactive use, and |
|
8049 | for interactive use, and | |
8014 | \family typewriter |
|
8050 | \family typewriter | |
8015 | hardcopy |
|
8051 | hardcopy | |
8016 | \family default |
|
8052 | \family default | |
8017 | fixes a bug in the original which under some circumstances blocks the creation |
|
8053 | fixes a bug in the original which under some circumstances blocks the creation | |
8018 | of PostScript output. |
|
8054 | of PostScript output. | |
8019 | \layout Standard |
|
8055 | \layout Standard | |
8020 |
|
8056 | |||
8021 | For scripting use, |
|
8057 | For scripting use, | |
8022 | \family typewriter |
|
8058 | \family typewriter | |
8023 | GnuplotRuntime.py |
|
8059 | GnuplotRuntime.py | |
8024 | \family default |
|
8060 | \family default | |
8025 | is provided, which wraps |
|
8061 | is provided, which wraps | |
8026 | \family typewriter |
|
8062 | \family typewriter | |
8027 | Gnuplot2.py |
|
8063 | Gnuplot2.py | |
8028 | \family default |
|
8064 | \family default | |
8029 | and creates a series of global aliases. |
|
8065 | and creates a series of global aliases. | |
8030 | These make it easy to control Gnuplot plotting jobs through the Python |
|
8066 | These make it easy to control Gnuplot plotting jobs through the Python | |
8031 | language. |
|
8067 | language. | |
8032 | \layout Standard |
|
8068 | \layout Standard | |
8033 |
|
8069 | |||
8034 | Below is some example code which illustrates how to configure Gnuplot inside |
|
8070 | Below is some example code which illustrates how to configure Gnuplot inside | |
8035 | your own programs but have it available for further interactive use through |
|
8071 | your own programs but have it available for further interactive use through | |
8036 | an embedded IPython instance. |
|
8072 | an embedded IPython instance. | |
8037 | Simply run this file at a system prompt. |
|
8073 | Simply run this file at a system prompt. | |
8038 | This file is provided as |
|
8074 | This file is provided as | |
8039 | \family typewriter |
|
8075 | \family typewriter | |
8040 | example-gnuplot.py |
|
8076 | example-gnuplot.py | |
8041 | \family default |
|
8077 | \family default | |
8042 | in the examples directory: |
|
8078 | in the examples directory: | |
8043 | \layout Standard |
|
8079 | \layout Standard | |
8044 |
|
8080 | |||
8045 |
|
8081 | |||
8046 | \begin_inset ERT |
|
8082 | \begin_inset ERT | |
8047 | status Open |
|
8083 | status Open | |
8048 |
|
8084 | |||
8049 | \layout Standard |
|
8085 | \layout Standard | |
8050 |
|
8086 | |||
8051 | \backslash |
|
8087 | \backslash | |
8052 |
|
|
8088 | codelist{examples/example-gnuplot.py} | |
8053 | \end_inset |
|
8089 | \end_inset | |
8054 |
|
8090 | |||
8055 |
|
8091 | |||
8056 | \layout Subsection |
|
8092 | \layout Subsection | |
8057 |
|
8093 | |||
8058 | The |
|
8094 | The | |
8059 | \family typewriter |
|
8095 | \family typewriter | |
8060 | numeric |
|
8096 | numeric | |
8061 | \family default |
|
8097 | \family default | |
8062 | profile: a scientific computing environment |
|
8098 | profile: a scientific computing environment | |
8063 | \layout Standard |
|
8099 | \layout Standard | |
8064 |
|
8100 | |||
8065 | The |
|
8101 | The | |
8066 | \family typewriter |
|
8102 | \family typewriter | |
8067 | numeric |
|
8103 | numeric | |
8068 | \family default |
|
8104 | \family default | |
8069 | IPython profile, which you can activate with |
|
8105 | IPython profile, which you can activate with | |
8070 | \family typewriter |
|
8106 | \family typewriter | |
8071 | `ipython -p numeric |
|
8107 | `ipython -p numeric | |
8072 | \family default |
|
8108 | \family default | |
8073 | ' will automatically load the IPython Gnuplot extensions (plus Numeric and |
|
8109 | ' will automatically load the IPython Gnuplot extensions (plus Numeric and | |
8074 | other useful things for numerical computing), contained in the |
|
8110 | other useful things for numerical computing), contained in the | |
8075 | \family typewriter |
|
8111 | \family typewriter | |
8076 | IPython.GnuplotInteractive |
|
8112 | IPython.GnuplotInteractive | |
8077 | \family default |
|
8113 | \family default | |
8078 | module. |
|
8114 | module. | |
8079 | This will create the globals |
|
8115 | This will create the globals | |
8080 | \family typewriter |
|
8116 | \family typewriter | |
8081 | Gnuplot |
|
8117 | Gnuplot | |
8082 | \family default |
|
8118 | \family default | |
8083 | (an alias to the improved Gnuplot2 module), |
|
8119 | (an alias to the improved Gnuplot2 module), | |
8084 | \family typewriter |
|
8120 | \family typewriter | |
8085 | gp |
|
8121 | gp | |
8086 | \family default |
|
8122 | \family default | |
8087 | (a Gnuplot active instance), the new magic commands |
|
8123 | (a Gnuplot active instance), the new magic commands | |
8088 | \family typewriter |
|
8124 | \family typewriter | |
8089 | %gpc |
|
8125 | %gpc | |
8090 | \family default |
|
8126 | \family default | |
8091 | and |
|
8127 | and | |
8092 | \family typewriter |
|
8128 | \family typewriter | |
8093 | %gp_set_instance |
|
8129 | %gp_set_instance | |
8094 | \family default |
|
8130 | \family default | |
8095 | and several other convenient globals. |
|
8131 | and several other convenient globals. | |
8096 | Type |
|
8132 | Type | |
8097 | \family typewriter |
|
8133 | \family typewriter | |
8098 | gphelp() |
|
8134 | gphelp() | |
8099 | \family default |
|
8135 | \family default | |
8100 | for further details. |
|
8136 | for further details. | |
8101 | \layout Standard |
|
8137 | \layout Standard | |
8102 |
|
8138 | |||
8103 | This should turn IPython into a convenient environment for numerical computing, |
|
8139 | This should turn IPython into a convenient environment for numerical computing, | |
8104 | with all the functions in the NumPy library and the Gnuplot facilities |
|
8140 | with all the functions in the NumPy library and the Gnuplot facilities | |
8105 | for plotting. |
|
8141 | for plotting. | |
8106 | Further improvements can be obtained by loading the SciPy libraries for |
|
8142 | Further improvements can be obtained by loading the SciPy libraries for | |
8107 | scientific computing, available at |
|
8143 | scientific computing, available at | |
8108 | \begin_inset LatexCommand \htmlurl{http://scipy.org} |
|
8144 | \begin_inset LatexCommand \htmlurl{http://scipy.org} | |
8109 |
|
8145 | |||
8110 | \end_inset |
|
8146 | \end_inset | |
8111 |
|
8147 | |||
8112 | . |
|
8148 | . | |
8113 | \layout Standard |
|
8149 | \layout Standard | |
8114 |
|
8150 | |||
8115 | If you are in the middle of a working session with numerical objects and |
|
8151 | If you are in the middle of a working session with numerical objects and | |
8116 | need to plot them but you didn't start the |
|
8152 | need to plot them but you didn't start the | |
8117 | \family typewriter |
|
8153 | \family typewriter | |
8118 | numeric |
|
8154 | numeric | |
8119 | \family default |
|
8155 | \family default | |
8120 | profile, you can load these extensions at any time by typing |
|
8156 | profile, you can load these extensions at any time by typing | |
8121 | \newline |
|
8157 | \newline | |
8122 |
|
8158 | |||
8123 | \family typewriter |
|
8159 | \family typewriter | |
8124 | from IPython.GnuplotInteractive import * |
|
8160 | from IPython.GnuplotInteractive import * | |
8125 | \newline |
|
8161 | \newline | |
8126 |
|
8162 | |||
8127 | \family default |
|
8163 | \family default | |
8128 | at the IPython prompt. |
|
8164 | at the IPython prompt. | |
8129 | This will allow you to keep your objects intact and start using Gnuplot |
|
8165 | This will allow you to keep your objects intact and start using Gnuplot | |
8130 | to view them. |
|
8166 | to view them. | |
8131 | \layout Section |
|
8167 | \layout Section | |
8132 |
|
8168 | |||
8133 | Reporting bugs |
|
8169 | Reporting bugs | |
8134 | \layout Subsection* |
|
8170 | \layout Subsection* | |
8135 |
|
8171 | |||
8136 | Automatic crash reports |
|
8172 | Automatic crash reports | |
8137 | \layout Standard |
|
8173 | \layout Standard | |
8138 |
|
8174 | |||
8139 | Ideally, IPython itself shouldn't crash. |
|
8175 | Ideally, IPython itself shouldn't crash. | |
8140 | It will catch exceptions produced by you, but bugs in its internals will |
|
8176 | It will catch exceptions produced by you, but bugs in its internals will | |
8141 | still crash it. |
|
8177 | still crash it. | |
8142 | \layout Standard |
|
8178 | \layout Standard | |
8143 |
|
8179 | |||
8144 | In such a situation, IPython will leave a file named |
|
8180 | In such a situation, IPython will leave a file named | |
8145 | \family typewriter |
|
8181 | \family typewriter | |
8146 | IPython_crash_report.txt |
|
8182 | IPython_crash_report.txt | |
8147 | \family default |
|
8183 | \family default | |
8148 | in your IPYTHONDIR directory (that way if crashes happen several times |
|
8184 | in your IPYTHONDIR directory (that way if crashes happen several times | |
8149 | it won't litter many directories, the post-mortem file is always located |
|
8185 | it won't litter many directories, the post-mortem file is always located | |
8150 | in the same place and new occurrences just overwrite the previous one). |
|
8186 | in the same place and new occurrences just overwrite the previous one). | |
8151 | If you can mail this file to the developers (see sec. |
|
8187 | If you can mail this file to the developers (see sec. | |
8152 |
|
8188 | |||
8153 | \begin_inset LatexCommand \ref{sec:credits} |
|
8189 | \begin_inset LatexCommand \ref{sec:credits} | |
8154 |
|
8190 | |||
8155 | \end_inset |
|
8191 | \end_inset | |
8156 |
|
8192 | |||
8157 | for names and addresses), it will help us |
|
8193 | for names and addresses), it will help us | |
8158 | \emph on |
|
8194 | \emph on | |
8159 | a lot |
|
8195 | a lot | |
8160 | \emph default |
|
8196 | \emph default | |
8161 | in understanding the cause of the problem and fixing it sooner. |
|
8197 | in understanding the cause of the problem and fixing it sooner. | |
8162 | \layout Subsection* |
|
8198 | \layout Subsection* | |
8163 |
|
8199 | |||
8164 | The bug tracker |
|
8200 | The bug tracker | |
8165 | \layout Standard |
|
8201 | \layout Standard | |
8166 |
|
8202 | |||
8167 | IPython also has an online bug-tracker, located at |
|
8203 | IPython also has an online bug-tracker, located at | |
8168 | \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython} |
|
8204 | \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython} | |
8169 |
|
8205 | |||
8170 | \end_inset |
|
8206 | \end_inset | |
8171 |
|
8207 | |||
8172 | . |
|
8208 | . | |
8173 | In addition to mailing the developers, it would be a good idea to file |
|
8209 | In addition to mailing the developers, it would be a good idea to file | |
8174 | a bug report here. |
|
8210 | a bug report here. | |
8175 | This will ensure that the issue is properly followed to conclusion. |
|
8211 | This will ensure that the issue is properly followed to conclusion. | |
8176 | \layout Standard |
|
8212 | \layout Standard | |
8177 |
|
8213 | |||
8178 | You can also use this bug tracker to file feature requests. |
|
8214 | You can also use this bug tracker to file feature requests. | |
8179 | \layout Section |
|
8215 | \layout Section | |
8180 |
|
8216 | |||
8181 | Brief history |
|
8217 | Brief history | |
8182 | \layout Subsection |
|
8218 | \layout Subsection | |
8183 |
|
8219 | |||
8184 | Origins |
|
8220 | Origins | |
8185 | \layout Standard |
|
8221 | \layout Standard | |
8186 |
|
8222 | |||
8187 | The current IPython system grew out of the following three projects: |
|
8223 | The current IPython system grew out of the following three projects: | |
8188 | \layout List |
|
8224 | \layout List | |
8189 | \labelwidthstring 00.00.0000 |
|
8225 | \labelwidthstring 00.00.0000 | |
8190 |
|
8226 | |||
8191 |
ipython by Fernando P |
|
8227 | ipython by Fernando PΓ©rez. | |
8192 | I was working on adding Mathematica-type prompts and a flexible configuration |
|
8228 | I was working on adding Mathematica-type prompts and a flexible configuration | |
8193 | system (something better than |
|
8229 | system (something better than | |
8194 | \family typewriter |
|
8230 | \family typewriter | |
8195 | $PYTHONSTARTUP |
|
8231 | $PYTHONSTARTUP | |
8196 | \family default |
|
8232 | \family default | |
8197 | ) to the standard Python interactive interpreter. |
|
8233 | ) to the standard Python interactive interpreter. | |
8198 | \layout List |
|
8234 | \layout List | |
8199 | \labelwidthstring 00.00.0000 |
|
8235 | \labelwidthstring 00.00.0000 | |
8200 |
|
8236 | |||
8201 | IPP by Janko Hauser. |
|
8237 | IPP by Janko Hauser. | |
8202 | Very well organized, great usability. |
|
8238 | Very well organized, great usability. | |
8203 | Had an old help system. |
|
8239 | Had an old help system. | |
8204 | IPP was used as the `container' code into which I added the functionality |
|
8240 | IPP was used as the `container' code into which I added the functionality | |
8205 | from ipython and LazyPython. |
|
8241 | from ipython and LazyPython. | |
8206 | \layout List |
|
8242 | \layout List | |
8207 | \labelwidthstring 00.00.0000 |
|
8243 | \labelwidthstring 00.00.0000 | |
8208 |
|
8244 | |||
8209 | LazyPython by Nathan Gray. |
|
8245 | LazyPython by Nathan Gray. | |
8210 | Simple but |
|
8246 | Simple but | |
8211 | \emph on |
|
8247 | \emph on | |
8212 | very |
|
8248 | very | |
8213 | \emph default |
|
8249 | \emph default | |
8214 | powerful. |
|
8250 | powerful. | |
8215 | The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks |
|
8251 | The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks | |
8216 | were all taken from here. |
|
8252 | were all taken from here. | |
8217 | \layout Standard |
|
8253 | \layout Standard | |
8218 |
|
8254 | |||
8219 | When I found out (see sec. |
|
8255 | When I found out (see sec. | |
8220 |
|
8256 | |||
8221 | \begin_inset LatexCommand \ref{figgins} |
|
8257 | \begin_inset LatexCommand \ref{figgins} | |
8222 |
|
8258 | |||
8223 | \end_inset |
|
8259 | \end_inset | |
8224 |
|
8260 | |||
8225 | ) about IPP and LazyPython I tried to join all three into a unified system. |
|
8261 | ) about IPP and LazyPython I tried to join all three into a unified system. | |
8226 | I thought this could provide a very nice working environment, both for |
|
8262 | I thought this could provide a very nice working environment, both for | |
8227 | regular programming and scientific computing: shell-like features, IDL/Matlab |
|
8263 | regular programming and scientific computing: shell-like features, IDL/Matlab | |
8228 | numerics, Mathematica-type prompt history and great object introspection |
|
8264 | numerics, Mathematica-type prompt history and great object introspection | |
8229 | and help facilities. |
|
8265 | and help facilities. | |
8230 | I think it worked reasonably well, though it was a lot more work than I |
|
8266 | I think it worked reasonably well, though it was a lot more work than I | |
8231 | had initially planned. |
|
8267 | had initially planned. | |
8232 | \layout Subsection |
|
8268 | \layout Subsection | |
8233 |
|
8269 | |||
8234 | Current status |
|
8270 | Current status | |
8235 | \layout Standard |
|
8271 | \layout Standard | |
8236 |
|
8272 | |||
8237 | The above listed features work, and quite well for the most part. |
|
8273 | The above listed features work, and quite well for the most part. | |
8238 | But until a major internal restructuring is done (see below), only bug |
|
8274 | But until a major internal restructuring is done (see below), only bug | |
8239 | fixing will be done, no other features will be added (unless very minor |
|
8275 | fixing will be done, no other features will be added (unless very minor | |
8240 | and well localized in the cleaner parts of the code). |
|
8276 | and well localized in the cleaner parts of the code). | |
8241 | \layout Standard |
|
8277 | \layout Standard | |
8242 |
|
8278 | |||
8243 | IPython consists of some 12000 lines of pure python code, of which roughly |
|
8279 | IPython consists of some 12000 lines of pure python code, of which roughly | |
8244 | 50% are fairly clean. |
|
8280 | 50% are fairly clean. | |
8245 | The other 50% are fragile, messy code which needs a massive restructuring |
|
8281 | The other 50% are fragile, messy code which needs a massive restructuring | |
8246 | before any further major work is done. |
|
8282 | before any further major work is done. | |
8247 | Even the messy code is fairly well documented though, and most of the problems |
|
8283 | Even the messy code is fairly well documented though, and most of the problems | |
8248 | in the (non-existent) class design are well pointed to by a PyChecker run. |
|
8284 | in the (non-existent) class design are well pointed to by a PyChecker run. | |
8249 | So the rewriting work isn't that bad, it will just be time-consuming. |
|
8285 | So the rewriting work isn't that bad, it will just be time-consuming. | |
8250 | \layout Subsection |
|
8286 | \layout Subsection | |
8251 |
|
8287 | |||
8252 | Future |
|
8288 | Future | |
8253 | \layout Standard |
|
8289 | \layout Standard | |
8254 |
|
8290 | |||
8255 | See the separate |
|
8291 | See the separate | |
8256 | \family typewriter |
|
8292 | \family typewriter | |
8257 | new_design |
|
8293 | new_design | |
8258 | \family default |
|
8294 | \family default | |
8259 | document for details. |
|
8295 | document for details. | |
8260 | Ultimately, I would like to see IPython become part of the standard Python |
|
8296 | Ultimately, I would like to see IPython become part of the standard Python | |
8261 | distribution as a `big brother with batteries' to the standard Python interacti |
|
8297 | distribution as a `big brother with batteries' to the standard Python interacti | |
8262 | ve interpreter. |
|
8298 | ve interpreter. | |
8263 | But that will never happen with the current state of the code, so all contribut |
|
8299 | But that will never happen with the current state of the code, so all contribut | |
8264 | ions are welcome. |
|
8300 | ions are welcome. | |
8265 | \layout Section |
|
8301 | \layout Section | |
8266 |
|
8302 | |||
8267 | License |
|
8303 | License | |
8268 | \layout Standard |
|
8304 | \layout Standard | |
8269 |
|
8305 | |||
8270 | IPython is released under the terms of the BSD license, whose general form |
|
8306 | IPython is released under the terms of the BSD license, whose general form | |
8271 | can be found at: |
|
8307 | can be found at: | |
8272 | \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php} |
|
8308 | \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php} | |
8273 |
|
8309 | |||
8274 | \end_inset |
|
8310 | \end_inset | |
8275 |
|
8311 | |||
8276 | . |
|
8312 | . | |
8277 | The full text of the IPython license is reproduced below: |
|
8313 | The full text of the IPython license is reproduced below: | |
8278 | \layout Quote |
|
8314 | \layout Quote | |
8279 |
|
8315 | |||
8280 |
|
8316 | |||
8281 | \family typewriter |
|
8317 | \family typewriter | |
8282 | \size small |
|
8318 | \size small | |
8283 | IPython is released under a BSD-type license. |
|
8319 | IPython is released under a BSD-type license. | |
8284 | \layout Quote |
|
8320 | \layout Quote | |
8285 |
|
8321 | |||
8286 |
|
8322 | |||
8287 | \family typewriter |
|
8323 | \family typewriter | |
8288 | \size small |
|
8324 | \size small | |
8289 | Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>. |
|
8325 | Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>. | |
8290 | \layout Quote |
|
8326 | \layout Quote | |
8291 |
|
8327 | |||
8292 |
|
8328 | |||
8293 | \family typewriter |
|
8329 | \family typewriter | |
8294 | \size small |
|
8330 | \size small | |
8295 | Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and |
|
8331 | Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and | |
8296 | \newline |
|
8332 | \newline | |
8297 | Nathaniel Gray <n8gray@caltech.edu>. |
|
8333 | Nathaniel Gray <n8gray@caltech.edu>. | |
8298 | \layout Quote |
|
8334 | \layout Quote | |
8299 |
|
8335 | |||
8300 |
|
8336 | |||
8301 | \family typewriter |
|
8337 | \family typewriter | |
8302 | \size small |
|
8338 | \size small | |
8303 | All rights reserved. |
|
8339 | All rights reserved. | |
8304 | \layout Quote |
|
8340 | \layout Quote | |
8305 |
|
8341 | |||
8306 |
|
8342 | |||
8307 | \family typewriter |
|
8343 | \family typewriter | |
8308 | \size small |
|
8344 | \size small | |
8309 | Redistribution and use in source and binary forms, with or without modification, |
|
8345 | Redistribution and use in source and binary forms, with or without modification, | |
8310 | are permitted provided that the following conditions are met: |
|
8346 | are permitted provided that the following conditions are met: | |
8311 | \layout Quote |
|
8347 | \layout Quote | |
8312 |
|
8348 | |||
8313 |
|
8349 | |||
8314 | \family typewriter |
|
8350 | \family typewriter | |
8315 | \size small |
|
8351 | \size small | |
8316 | a. |
|
8352 | a. | |
8317 | Redistributions of source code must retain the above copyright notice, |
|
8353 | Redistributions of source code must retain the above copyright notice, | |
8318 | this list of conditions and the following disclaimer. |
|
8354 | this list of conditions and the following disclaimer. | |
8319 | \layout Quote |
|
8355 | \layout Quote | |
8320 |
|
8356 | |||
8321 |
|
8357 | |||
8322 | \family typewriter |
|
8358 | \family typewriter | |
8323 | \size small |
|
8359 | \size small | |
8324 | b. |
|
8360 | b. | |
8325 | Redistributions in binary form must reproduce the above copyright notice, |
|
8361 | Redistributions in binary form must reproduce the above copyright notice, | |
8326 | this list of conditions and the following disclaimer in the documentation |
|
8362 | this list of conditions and the following disclaimer in the documentation | |
8327 | and/or other materials provided with the distribution. |
|
8363 | and/or other materials provided with the distribution. | |
8328 | \layout Quote |
|
8364 | \layout Quote | |
8329 |
|
8365 | |||
8330 |
|
8366 | |||
8331 | \family typewriter |
|
8367 | \family typewriter | |
8332 | \size small |
|
8368 | \size small | |
8333 | c. |
|
8369 | c. | |
8334 | Neither the name of the copyright holders nor the names of any contributors |
|
8370 | Neither the name of the copyright holders nor the names of any contributors | |
8335 | to this software may be used to endorse or promote products derived from |
|
8371 | to this software may be used to endorse or promote products derived from | |
8336 | this software without specific prior written permission. |
|
8372 | this software without specific prior written permission. | |
8337 | \layout Quote |
|
8373 | \layout Quote | |
8338 |
|
8374 | |||
8339 |
|
8375 | |||
8340 | \family typewriter |
|
8376 | \family typewriter | |
8341 | \size small |
|
8377 | \size small | |
8342 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
|
8378 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | |
8343 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
|
8379 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
8344 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
8380 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
8345 | PURPOSE ARE DISCLAIMED. |
|
8381 | PURPOSE ARE DISCLAIMED. | |
8346 | IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
8382 | IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
8347 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
8383 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
8348 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
8384 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |
8349 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
|
8385 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
8350 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
8386 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
8351 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
8387 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
8352 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
8388 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
8353 |
|
8389 | |||
8354 | \layout Standard |
|
8390 | \layout Standard | |
8355 |
|
8391 | |||
8356 | Individual authors are the holders of the copyright for their code and are |
|
8392 | Individual authors are the holders of the copyright for their code and are | |
8357 | listed in each file. |
|
8393 | listed in each file. | |
8358 | \layout Standard |
|
8394 | \layout Standard | |
8359 |
|
8395 | |||
8360 | Some files ( |
|
8396 | Some files ( | |
8361 | \family typewriter |
|
8397 | \family typewriter | |
8362 | DPyGetOpt.py |
|
8398 | DPyGetOpt.py | |
8363 | \family default |
|
8399 | \family default | |
8364 | , for example) may be licensed under different conditions. |
|
8400 | , for example) may be licensed under different conditions. | |
8365 | Ultimately each file indicates clearly the conditions under which its author/au |
|
8401 | Ultimately each file indicates clearly the conditions under which its author/au | |
8366 | thors have decided to publish the code. |
|
8402 | thors have decided to publish the code. | |
8367 | \layout Standard |
|
8403 | \layout Standard | |
8368 |
|
8404 | |||
8369 | Versions of IPython up to and including 0.6.3 were released under the GNU |
|
8405 | Versions of IPython up to and including 0.6.3 were released under the GNU | |
8370 | Lesser General Public License (LGPL), available at |
|
8406 | Lesser General Public License (LGPL), available at | |
8371 | \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html} |
|
8407 | \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html} | |
8372 |
|
8408 | |||
8373 | \end_inset |
|
8409 | \end_inset | |
8374 |
|
8410 | |||
8375 | . |
|
8411 | . | |
8376 | \layout Section |
|
8412 | \layout Section | |
8377 |
|
8413 | |||
8378 |
|
8414 | |||
8379 | \begin_inset LatexCommand \label{sec:credits} |
|
8415 | \begin_inset LatexCommand \label{sec:credits} | |
8380 |
|
8416 | |||
8381 | \end_inset |
|
8417 | \end_inset | |
8382 |
|
8418 | |||
8383 | Credits |
|
8419 | Credits | |
8384 | \layout Standard |
|
8420 | \layout Standard | |
8385 |
|
8421 | |||
8386 |
IPython is mainly developed by Fernando P |
|
8422 | IPython is mainly developed by Fernando PΓ©rez | |
8387 | \family typewriter |
|
8423 | \family typewriter | |
8388 | <fperez@colorado.edu> |
|
8424 | <fperez@colorado.edu> | |
8389 | \family default |
|
8425 | \family default | |
8390 | , but the project was born from mixing in Fernando's code with the IPP project |
|
8426 | , but the project was born from mixing in Fernando's code with the IPP project | |
8391 | by Janko Hauser |
|
8427 | by Janko Hauser | |
8392 | \family typewriter |
|
8428 | \family typewriter | |
8393 | <jhauser-AT-zscout.de> |
|
8429 | <jhauser-AT-zscout.de> | |
8394 | \family default |
|
8430 | \family default | |
8395 | and LazyPython by Nathan Gray |
|
8431 | and LazyPython by Nathan Gray | |
8396 | \family typewriter |
|
8432 | \family typewriter | |
8397 | <n8gray-AT-caltech.edu> |
|
8433 | <n8gray-AT-caltech.edu> | |
8398 | \family default |
|
8434 | \family default | |
8399 | . |
|
8435 | . | |
8400 | For all IPython-related requests, please contact Fernando. |
|
8436 | For all IPython-related requests, please contact Fernando. | |
8401 |
|
8437 | |||
8402 | \layout Standard |
|
8438 | \layout Standard | |
8403 |
|
8439 | |||
8404 | As of late 2005, the following developers have joined the core team: |
|
8440 | As of late 2005, the following developers have joined the core team: | |
8405 | \layout List |
|
8441 | \layout List | |
8406 | \labelwidthstring 00.00.0000 |
|
8442 | \labelwidthstring 00.00.0000 | |
8407 |
|
8443 | |||
8408 | Robert\SpecialChar ~ |
|
8444 | Robert\SpecialChar ~ | |
8409 | Kern |
|
8445 | Kern | |
8410 | \family typewriter |
|
8446 | \family typewriter | |
8411 | <rkern-AT-enthought.com> |
|
8447 | <rkern-AT-enthought.com> | |
8412 | \family default |
|
8448 | \family default | |
8413 | : co-mentored the 2005 Google Summer of Code project to develop python interacti |
|
8449 | : co-mentored the 2005 Google Summer of Code project to develop python interacti | |
8414 | ve notebooks (XML documents) and graphical interface. |
|
8450 | ve notebooks (XML documents) and graphical interface. | |
8415 | This project was awarded to the students Tzanko Matev |
|
8451 | This project was awarded to the students Tzanko Matev | |
8416 | \family typewriter |
|
8452 | \family typewriter | |
8417 | <tsanko-AT-gmail.com> |
|
8453 | <tsanko-AT-gmail.com> | |
8418 | \family default |
|
8454 | \family default | |
8419 | and Toni Alatalo |
|
8455 | and Toni Alatalo | |
8420 | \family typewriter |
|
8456 | \family typewriter | |
8421 | <antont-AT-an.org> |
|
8457 | <antont-AT-an.org> | |
8422 | \layout List |
|
8458 | \layout List | |
8423 | \labelwidthstring 00.00.0000 |
|
8459 | \labelwidthstring 00.00.0000 | |
8424 |
|
8460 | |||
8425 | Brian\SpecialChar ~ |
|
8461 | Brian\SpecialChar ~ | |
8426 | Granger |
|
8462 | Granger | |
8427 | \family typewriter |
|
8463 | \family typewriter | |
8428 | <bgranger-AT-scu.edu> |
|
8464 | <bgranger-AT-scu.edu> | |
8429 | \family default |
|
8465 | \family default | |
8430 | : extending IPython to allow support for interactive parallel computing. |
|
8466 | : extending IPython to allow support for interactive parallel computing. | |
8431 | \layout Standard |
|
8467 | \layout Standard | |
8432 |
|
8468 | |||
8433 | User or development help should be requested via the IPython mailing lists: |
|
8469 | User or development help should be requested via the IPython mailing lists: | |
8434 | \layout Description |
|
8470 | \layout Description | |
8435 |
|
8471 | |||
8436 | User\SpecialChar ~ |
|
8472 | User\SpecialChar ~ | |
8437 | list: |
|
8473 | list: | |
8438 | \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user} |
|
8474 | \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user} | |
8439 |
|
8475 | |||
8440 | \end_inset |
|
8476 | \end_inset | |
8441 |
|
8477 | |||
8442 |
|
8478 | |||
8443 | \layout Description |
|
8479 | \layout Description | |
8444 |
|
8480 | |||
8445 | Developer's\SpecialChar ~ |
|
8481 | Developer's\SpecialChar ~ | |
8446 | list: |
|
8482 | list: | |
8447 | \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev} |
|
8483 | \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev} | |
8448 |
|
8484 | |||
8449 | \end_inset |
|
8485 | \end_inset | |
8450 |
|
8486 | |||
8451 |
|
8487 | |||
8452 | \layout Standard |
|
8488 | \layout Standard | |
8453 |
|
8489 | |||
8454 | The IPython project is also very grateful to |
|
8490 | The IPython project is also very grateful to | |
8455 | \begin_inset Foot |
|
8491 | \begin_inset Foot | |
8456 | collapsed true |
|
8492 | collapsed true | |
8457 |
|
8493 | |||
8458 | \layout Standard |
|
8494 | \layout Standard | |
8459 |
|
8495 | |||
8460 | I've mangled email addresses to reduce spam, since the IPython manuals can |
|
8496 | I've mangled email addresses to reduce spam, since the IPython manuals can | |
8461 | be accessed online. |
|
8497 | be accessed online. | |
8462 | \end_inset |
|
8498 | \end_inset | |
8463 |
|
8499 | |||
8464 | : |
|
8500 | : | |
8465 | \layout Standard |
|
8501 | \layout Standard | |
8466 |
|
8502 | |||
8467 | Bill Bumgarner |
|
8503 | Bill Bumgarner | |
8468 | \family typewriter |
|
8504 | \family typewriter | |
8469 | <bbum-AT-friday.com> |
|
8505 | <bbum-AT-friday.com> | |
8470 | \family default |
|
8506 | \family default | |
8471 | : for providing the DPyGetOpt module which gives very powerful and convenient |
|
8507 | : for providing the DPyGetOpt module which gives very powerful and convenient | |
8472 | handling of command-line options (light years ahead of what Python 2.1.1's |
|
8508 | handling of command-line options (light years ahead of what Python 2.1.1's | |
8473 | getopt module does). |
|
8509 | getopt module does). | |
8474 | \layout Standard |
|
8510 | \layout Standard | |
8475 |
|
8511 | |||
8476 | Ka-Ping Yee |
|
8512 | Ka-Ping Yee | |
8477 | \family typewriter |
|
8513 | \family typewriter | |
8478 | <ping-AT-lfw.org> |
|
8514 | <ping-AT-lfw.org> | |
8479 | \family default |
|
8515 | \family default | |
8480 | : for providing the Itpl module for convenient and powerful string interpolation |
|
8516 | : for providing the Itpl module for convenient and powerful string interpolation | |
8481 | with a much nicer syntax than formatting through the '%' operator. |
|
8517 | with a much nicer syntax than formatting through the '%' operator. | |
8482 | \layout Standard |
|
8518 | \layout Standard | |
8483 |
|
8519 | |||
8484 |
Arnd B |
|
8520 | Arnd BΓ€cker | |
8485 | \family typewriter |
|
8521 | \family typewriter | |
8486 | <baecker-AT-physik.tu-dresden.de> |
|
8522 | <baecker-AT-physik.tu-dresden.de> | |
8487 | \family default |
|
8523 | \family default | |
8488 | : for his many very useful suggestions and comments, and lots of help with |
|
8524 | : for his many very useful suggestions and comments, and lots of help with | |
8489 | testing and documentation checking. |
|
8525 | testing and documentation checking. | |
8490 | Many of IPython's newer features are a result of discussions with him (bugs |
|
8526 | Many of IPython's newer features are a result of discussions with him (bugs | |
8491 | are still my fault, not his). |
|
8527 | are still my fault, not his). | |
8492 | \layout Standard |
|
8528 | \layout Standard | |
8493 |
|
8529 | |||
8494 | Obviously Guido van\SpecialChar ~ |
|
8530 | Obviously Guido van\SpecialChar ~ | |
8495 | Rossum and the whole Python development team, that goes |
|
8531 | Rossum and the whole Python development team, that goes | |
8496 | without saying. |
|
8532 | without saying. | |
8497 | \layout Standard |
|
8533 | \layout Standard | |
8498 |
|
8534 | |||
8499 | IPython's website is generously hosted at |
|
8535 | IPython's website is generously hosted at | |
8500 | \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org} |
|
8536 | \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org} | |
8501 |
|
8537 | |||
8502 | \end_inset |
|
8538 | \end_inset | |
8503 |
|
8539 | |||
8504 | by Enthought ( |
|
8540 | by Enthought ( | |
8505 | \begin_inset LatexCommand \htmlurl{http://www.enthought.com} |
|
8541 | \begin_inset LatexCommand \htmlurl{http://www.enthought.com} | |
8506 |
|
8542 | |||
8507 | \end_inset |
|
8543 | \end_inset | |
8508 |
|
8544 | |||
8509 | ). |
|
8545 | ). | |
8510 | I am very grateful to them and all of the SciPy team for their contribution. |
|
8546 | I am very grateful to them and all of the SciPy team for their contribution. | |
8511 | \layout Standard |
|
8547 | \layout Standard | |
8512 |
|
8548 | |||
8513 |
|
8549 | |||
8514 | \begin_inset LatexCommand \label{figgins} |
|
8550 | \begin_inset LatexCommand \label{figgins} | |
8515 |
|
8551 | |||
8516 | \end_inset |
|
8552 | \end_inset | |
8517 |
|
8553 | |||
8518 | Fernando would also like to thank Stephen Figgins |
|
8554 | Fernando would also like to thank Stephen Figgins | |
8519 | \family typewriter |
|
8555 | \family typewriter | |
8520 | <fig-AT-monitor.net> |
|
8556 | <fig-AT-monitor.net> | |
8521 | \family default |
|
8557 | \family default | |
8522 | , an O'Reilly Python editor. |
|
8558 | , an O'Reilly Python editor. | |
8523 | His Oct/11/2001 article about IPP and LazyPython, was what got this project |
|
8559 | His Oct/11/2001 article about IPP and LazyPython, was what got this project | |
8524 | started. |
|
8560 | started. | |
8525 | You can read it at: |
|
8561 | You can read it at: | |
8526 | \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html} |
|
8562 | \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html} | |
8527 |
|
8563 | |||
8528 | \end_inset |
|
8564 | \end_inset | |
8529 |
|
8565 | |||
8530 | . |
|
8566 | . | |
8531 | \layout Standard |
|
8567 | \layout Standard | |
8532 |
|
8568 | |||
8533 | And last but not least, all the kind IPython users who have emailed new |
|
8569 | And last but not least, all the kind IPython users who have emailed new | |
8534 | code, bug reports, fixes, comments and ideas. |
|
8570 | code, bug reports, fixes, comments and ideas. | |
8535 | A brief list follows, please let me know if I have ommitted your name by |
|
8571 | A brief list follows, please let me know if I have ommitted your name by | |
8536 | accident: |
|
8572 | accident: | |
8537 | \layout List |
|
8573 | \layout List | |
8538 | \labelwidthstring 00.00.0000 |
|
8574 | \labelwidthstring 00.00.0000 | |
8539 |
|
8575 | |||
8540 | Jack\SpecialChar ~ |
|
8576 | Jack\SpecialChar ~ | |
8541 | Moffit |
|
8577 | Moffit | |
8542 | \family typewriter |
|
8578 | \family typewriter | |
8543 | <jack-AT-xiph.org> |
|
8579 | <jack-AT-xiph.org> | |
8544 | \family default |
|
8580 | \family default | |
8545 | Bug fixes, including the infamous color problem. |
|
8581 | Bug fixes, including the infamous color problem. | |
8546 | This bug alone caused many lost hours and frustration, many thanks to him |
|
8582 | This bug alone caused many lost hours and frustration, many thanks to him | |
8547 | for the fix. |
|
8583 | for the fix. | |
8548 | I've always been a fan of Ogg & friends, now I have one more reason to |
|
8584 | I've always been a fan of Ogg & friends, now I have one more reason to | |
8549 | like these folks. |
|
8585 | like these folks. | |
8550 | \newline |
|
8586 | \newline | |
8551 | Jack is also contributing with Debian packaging and many other things. |
|
8587 | Jack is also contributing with Debian packaging and many other things. | |
8552 | \layout List |
|
8588 | \layout List | |
8553 | \labelwidthstring 00.00.0000 |
|
8589 | \labelwidthstring 00.00.0000 | |
8554 |
|
8590 | |||
8555 | Alexander\SpecialChar ~ |
|
8591 | Alexander\SpecialChar ~ | |
8556 | Schmolck |
|
8592 | Schmolck | |
8557 | \family typewriter |
|
8593 | \family typewriter | |
8558 | <a.schmolck-AT-gmx.net> |
|
8594 | <a.schmolck-AT-gmx.net> | |
8559 | \family default |
|
8595 | \family default | |
8560 | Emacs work, bug reports, bug fixes, ideas, lots more. |
|
8596 | Emacs work, bug reports, bug fixes, ideas, lots more. | |
8561 | The ipython.el mode for (X)Emacs is Alex's code, providing full support |
|
8597 | The ipython.el mode for (X)Emacs is Alex's code, providing full support | |
8562 | for IPython under (X)Emacs. |
|
8598 | for IPython under (X)Emacs. | |
8563 | \layout List |
|
8599 | \layout List | |
8564 | \labelwidthstring 00.00.0000 |
|
8600 | \labelwidthstring 00.00.0000 | |
8565 |
|
8601 | |||
8566 | Andrea\SpecialChar ~ |
|
8602 | Andrea\SpecialChar ~ | |
8567 | Riciputi |
|
8603 | Riciputi | |
8568 | \family typewriter |
|
8604 | \family typewriter | |
8569 | <andrea.riciputi-AT-libero.it> |
|
8605 | <andrea.riciputi-AT-libero.it> | |
8570 | \family default |
|
8606 | \family default | |
8571 | Mac OSX information, Fink package management. |
|
8607 | Mac OSX information, Fink package management. | |
8572 | \layout List |
|
8608 | \layout List | |
8573 | \labelwidthstring 00.00.0000 |
|
8609 | \labelwidthstring 00.00.0000 | |
8574 |
|
8610 | |||
8575 | Gary\SpecialChar ~ |
|
8611 | Gary\SpecialChar ~ | |
8576 | Bishop |
|
8612 | Bishop | |
8577 | \family typewriter |
|
8613 | \family typewriter | |
8578 | <gb-AT-cs.unc.edu> |
|
8614 | <gb-AT-cs.unc.edu> | |
8579 | \family default |
|
8615 | \family default | |
8580 | Bug reports, and patches to work around the exception handling idiosyncracies |
|
8616 | Bug reports, and patches to work around the exception handling idiosyncracies | |
8581 | of WxPython. |
|
8617 | of WxPython. | |
8582 | Readline and color support for Windows. |
|
8618 | Readline and color support for Windows. | |
8583 | \layout List |
|
8619 | \layout List | |
8584 | \labelwidthstring 00.00.0000 |
|
8620 | \labelwidthstring 00.00.0000 | |
8585 |
|
8621 | |||
8586 | Jeffrey\SpecialChar ~ |
|
8622 | Jeffrey\SpecialChar ~ | |
8587 | Collins |
|
8623 | Collins | |
8588 | \family typewriter |
|
8624 | \family typewriter | |
8589 | <Jeff.Collins-AT-vexcel.com> |
|
8625 | <Jeff.Collins-AT-vexcel.com> | |
8590 | \family default |
|
8626 | \family default | |
8591 | Bug reports. |
|
8627 | Bug reports. | |
8592 | Much improved readline support, including fixes for Python 2.3. |
|
8628 | Much improved readline support, including fixes for Python 2.3. | |
8593 | \layout List |
|
8629 | \layout List | |
8594 | \labelwidthstring 00.00.0000 |
|
8630 | \labelwidthstring 00.00.0000 | |
8595 |
|
8631 | |||
8596 | Dryice\SpecialChar ~ |
|
8632 | Dryice\SpecialChar ~ | |
8597 | Liu |
|
8633 | Liu | |
8598 | \family typewriter |
|
8634 | \family typewriter | |
8599 | <dryice-AT-liu.com.cn> |
|
8635 | <dryice-AT-liu.com.cn> | |
8600 | \family default |
|
8636 | \family default | |
8601 | FreeBSD port. |
|
8637 | FreeBSD port. | |
8602 | \layout List |
|
8638 | \layout List | |
8603 | \labelwidthstring 00.00.0000 |
|
8639 | \labelwidthstring 00.00.0000 | |
8604 |
|
8640 | |||
8605 | Mike\SpecialChar ~ |
|
8641 | Mike\SpecialChar ~ | |
8606 | Heeter |
|
8642 | Heeter | |
8607 | \family typewriter |
|
8643 | \family typewriter | |
8608 | <korora-AT-SDF.LONESTAR.ORG> |
|
8644 | <korora-AT-SDF.LONESTAR.ORG> | |
8609 | \layout List |
|
8645 | \layout List | |
8610 | \labelwidthstring 00.00.0000 |
|
8646 | \labelwidthstring 00.00.0000 | |
8611 |
|
8647 | |||
8612 | Christopher\SpecialChar ~ |
|
8648 | Christopher\SpecialChar ~ | |
8613 | Hart |
|
8649 | Hart | |
8614 | \family typewriter |
|
8650 | \family typewriter | |
8615 | <hart-AT-caltech.edu> |
|
8651 | <hart-AT-caltech.edu> | |
8616 | \family default |
|
8652 | \family default | |
8617 | PDB integration. |
|
8653 | PDB integration. | |
8618 | \layout List |
|
8654 | \layout List | |
8619 | \labelwidthstring 00.00.0000 |
|
8655 | \labelwidthstring 00.00.0000 | |
8620 |
|
8656 | |||
8621 | Milan\SpecialChar ~ |
|
8657 | Milan\SpecialChar ~ | |
8622 | Zamazal |
|
8658 | Zamazal | |
8623 | \family typewriter |
|
8659 | \family typewriter | |
8624 | <pdm-AT-zamazal.org> |
|
8660 | <pdm-AT-zamazal.org> | |
8625 | \family default |
|
8661 | \family default | |
8626 | Emacs info. |
|
8662 | Emacs info. | |
8627 | \layout List |
|
8663 | \layout List | |
8628 | \labelwidthstring 00.00.0000 |
|
8664 | \labelwidthstring 00.00.0000 | |
8629 |
|
8665 | |||
8630 | Philip\SpecialChar ~ |
|
8666 | Philip\SpecialChar ~ | |
8631 | Hisley |
|
8667 | Hisley | |
8632 | \family typewriter |
|
8668 | \family typewriter | |
8633 | <compsys-AT-starpower.net> |
|
8669 | <compsys-AT-starpower.net> | |
8634 | \layout List |
|
8670 | \layout List | |
8635 | \labelwidthstring 00.00.0000 |
|
8671 | \labelwidthstring 00.00.0000 | |
8636 |
|
8672 | |||
8637 | Holger\SpecialChar ~ |
|
8673 | Holger\SpecialChar ~ | |
8638 | Krekel |
|
8674 | Krekel | |
8639 | \family typewriter |
|
8675 | \family typewriter | |
8640 | <pyth-AT-devel.trillke.net> |
|
8676 | <pyth-AT-devel.trillke.net> | |
8641 | \family default |
|
8677 | \family default | |
8642 | Tab completion, lots more. |
|
8678 | Tab completion, lots more. | |
8643 | \layout List |
|
8679 | \layout List | |
8644 | \labelwidthstring 00.00.0000 |
|
8680 | \labelwidthstring 00.00.0000 | |
8645 |
|
8681 | |||
8646 | Robin\SpecialChar ~ |
|
8682 | Robin\SpecialChar ~ | |
8647 | Siebler |
|
8683 | Siebler | |
8648 | \family typewriter |
|
8684 | \family typewriter | |
8649 | <robinsiebler-AT-starband.net> |
|
8685 | <robinsiebler-AT-starband.net> | |
8650 | \layout List |
|
8686 | \layout List | |
8651 | \labelwidthstring 00.00.0000 |
|
8687 | \labelwidthstring 00.00.0000 | |
8652 |
|
8688 | |||
8653 | Ralf\SpecialChar ~ |
|
8689 | Ralf\SpecialChar ~ | |
8654 | Ahlbrink |
|
8690 | Ahlbrink | |
8655 | \family typewriter |
|
8691 | \family typewriter | |
8656 | <ralf_ahlbrink-AT-web.de> |
|
8692 | <ralf_ahlbrink-AT-web.de> | |
8657 | \layout List |
|
8693 | \layout List | |
8658 | \labelwidthstring 00.00.0000 |
|
8694 | \labelwidthstring 00.00.0000 | |
8659 |
|
8695 | |||
8660 | Thorsten\SpecialChar ~ |
|
8696 | Thorsten\SpecialChar ~ | |
8661 | Kampe |
|
8697 | Kampe | |
8662 | \family typewriter |
|
8698 | \family typewriter | |
8663 | <thorsten-AT-thorstenkampe.de> |
|
8699 | <thorsten-AT-thorstenkampe.de> | |
8664 | \layout List |
|
8700 | \layout List | |
8665 | \labelwidthstring 00.00.0000 |
|
8701 | \labelwidthstring 00.00.0000 | |
8666 |
|
8702 | |||
8667 | Fredrik\SpecialChar ~ |
|
8703 | Fredrik\SpecialChar ~ | |
8668 | Kant |
|
8704 | Kant | |
8669 | \family typewriter |
|
8705 | \family typewriter | |
8670 | <fredrik.kant-AT-front.com> |
|
8706 | <fredrik.kant-AT-front.com> | |
8671 | \family default |
|
8707 | \family default | |
8672 | Windows setup. |
|
8708 | Windows setup. | |
8673 | \layout List |
|
8709 | \layout List | |
8674 | \labelwidthstring 00.00.0000 |
|
8710 | \labelwidthstring 00.00.0000 | |
8675 |
|
8711 | |||
8676 | Syver\SpecialChar ~ |
|
8712 | Syver\SpecialChar ~ | |
8677 | Enstad |
|
8713 | Enstad | |
8678 | \family typewriter |
|
8714 | \family typewriter | |
8679 | <syver-en-AT-online.no> |
|
8715 | <syver-en-AT-online.no> | |
8680 | \family default |
|
8716 | \family default | |
8681 | Windows setup. |
|
8717 | Windows setup. | |
8682 | \layout List |
|
8718 | \layout List | |
8683 | \labelwidthstring 00.00.0000 |
|
8719 | \labelwidthstring 00.00.0000 | |
8684 |
|
8720 | |||
8685 | Richard |
|
8721 | Richard | |
8686 | \family typewriter |
|
8722 | \family typewriter | |
8687 | <rxe-AT-renre-europe.com> |
|
8723 | <rxe-AT-renre-europe.com> | |
8688 | \family default |
|
8724 | \family default | |
8689 | Global embedding. |
|
8725 | Global embedding. | |
8690 | \layout List |
|
8726 | \layout List | |
8691 | \labelwidthstring 00.00.0000 |
|
8727 | \labelwidthstring 00.00.0000 | |
8692 |
|
8728 | |||
8693 | Hayden\SpecialChar ~ |
|
8729 | Hayden\SpecialChar ~ | |
8694 | Callow |
|
8730 | Callow | |
8695 | \family typewriter |
|
8731 | \family typewriter | |
8696 | <h.callow-AT-elec.canterbury.ac.nz> |
|
8732 | <h.callow-AT-elec.canterbury.ac.nz> | |
8697 | \family default |
|
8733 | \family default | |
8698 | Gnuplot.py 1.6 compatibility. |
|
8734 | Gnuplot.py 1.6 compatibility. | |
8699 | \layout List |
|
8735 | \layout List | |
8700 | \labelwidthstring 00.00.0000 |
|
8736 | \labelwidthstring 00.00.0000 | |
8701 |
|
8737 | |||
8702 | Leonardo\SpecialChar ~ |
|
8738 | Leonardo\SpecialChar ~ | |
8703 | Santagada |
|
8739 | Santagada | |
8704 | \family typewriter |
|
8740 | \family typewriter | |
8705 | <retype-AT-terra.com.br> |
|
8741 | <retype-AT-terra.com.br> | |
8706 | \family default |
|
8742 | \family default | |
8707 | Fixes for Windows installation. |
|
8743 | Fixes for Windows installation. | |
8708 | \layout List |
|
8744 | \layout List | |
8709 | \labelwidthstring 00.00.0000 |
|
8745 | \labelwidthstring 00.00.0000 | |
8710 |
|
8746 | |||
8711 | Christopher\SpecialChar ~ |
|
8747 | Christopher\SpecialChar ~ | |
8712 | Armstrong |
|
8748 | Armstrong | |
8713 | \family typewriter |
|
8749 | \family typewriter | |
8714 | <radix-AT-twistedmatrix.com> |
|
8750 | <radix-AT-twistedmatrix.com> | |
8715 | \family default |
|
8751 | \family default | |
8716 | Bugfixes. |
|
8752 | Bugfixes. | |
8717 | \layout List |
|
8753 | \layout List | |
8718 | \labelwidthstring 00.00.0000 |
|
8754 | \labelwidthstring 00.00.0000 | |
8719 |
|
8755 | |||
8720 | Francois\SpecialChar ~ |
|
8756 | Francois\SpecialChar ~ | |
8721 | Pinard |
|
8757 | Pinard | |
8722 | \family typewriter |
|
8758 | \family typewriter | |
8723 | <pinard-AT-iro.umontreal.ca> |
|
8759 | <pinard-AT-iro.umontreal.ca> | |
8724 | \family default |
|
8760 | \family default | |
8725 | Code and documentation fixes. |
|
8761 | Code and documentation fixes. | |
8726 | \layout List |
|
8762 | \layout List | |
8727 | \labelwidthstring 00.00.0000 |
|
8763 | \labelwidthstring 00.00.0000 | |
8728 |
|
8764 | |||
8729 | Cory\SpecialChar ~ |
|
8765 | Cory\SpecialChar ~ | |
8730 | Dodt |
|
8766 | Dodt | |
8731 | \family typewriter |
|
8767 | \family typewriter | |
8732 | <cdodt-AT-fcoe.k12.ca.us> |
|
8768 | <cdodt-AT-fcoe.k12.ca.us> | |
8733 | \family default |
|
8769 | \family default | |
8734 | Bug reports and Windows ideas. |
|
8770 | Bug reports and Windows ideas. | |
8735 | Patches for Windows installer. |
|
8771 | Patches for Windows installer. | |
8736 | \layout List |
|
8772 | \layout List | |
8737 | \labelwidthstring 00.00.0000 |
|
8773 | \labelwidthstring 00.00.0000 | |
8738 |
|
8774 | |||
8739 | Olivier\SpecialChar ~ |
|
8775 | Olivier\SpecialChar ~ | |
8740 | Aubert |
|
8776 | Aubert | |
8741 | \family typewriter |
|
8777 | \family typewriter | |
8742 | <oaubert-AT-bat710.univ-lyon1.fr> |
|
8778 | <oaubert-AT-bat710.univ-lyon1.fr> | |
8743 | \family default |
|
8779 | \family default | |
8744 | New magics. |
|
8780 | New magics. | |
8745 | \layout List |
|
8781 | \layout List | |
8746 | \labelwidthstring 00.00.0000 |
|
8782 | \labelwidthstring 00.00.0000 | |
8747 |
|
8783 | |||
8748 | King\SpecialChar ~ |
|
8784 | King\SpecialChar ~ | |
8749 | C.\SpecialChar ~ |
|
8785 | C.\SpecialChar ~ | |
8750 | Shu |
|
8786 | Shu | |
8751 | \family typewriter |
|
8787 | \family typewriter | |
8752 | <kingshu-AT-myrealbox.com> |
|
8788 | <kingshu-AT-myrealbox.com> | |
8753 | \family default |
|
8789 | \family default | |
8754 | Autoindent patch. |
|
8790 | Autoindent patch. | |
8755 | \layout List |
|
8791 | \layout List | |
8756 | \labelwidthstring 00.00.0000 |
|
8792 | \labelwidthstring 00.00.0000 | |
8757 |
|
8793 | |||
8758 | Chris\SpecialChar ~ |
|
8794 | Chris\SpecialChar ~ | |
8759 | Drexler |
|
8795 | Drexler | |
8760 | \family typewriter |
|
8796 | \family typewriter | |
8761 | <chris-AT-ac-drexler.de> |
|
8797 | <chris-AT-ac-drexler.de> | |
8762 | \family default |
|
8798 | \family default | |
8763 | Readline packages for Win32/CygWin. |
|
8799 | Readline packages for Win32/CygWin. | |
8764 | \layout List |
|
8800 | \layout List | |
8765 | \labelwidthstring 00.00.0000 |
|
8801 | \labelwidthstring 00.00.0000 | |
8766 |
|
8802 | |||
8767 | Gustavo\SpecialChar ~ |
|
8803 | Gustavo\SpecialChar ~ | |
8768 |
C |
|
8804 | CΓ³rdova\SpecialChar ~ | |
8769 | Avila |
|
8805 | Avila | |
8770 | \family typewriter |
|
8806 | \family typewriter | |
8771 | <gcordova-AT-sismex.com> |
|
8807 | <gcordova-AT-sismex.com> | |
8772 | \family default |
|
8808 | \family default | |
8773 | EvalDict code for nice, lightweight string interpolation. |
|
8809 | EvalDict code for nice, lightweight string interpolation. | |
8774 | \layout List |
|
8810 | \layout List | |
8775 | \labelwidthstring 00.00.0000 |
|
8811 | \labelwidthstring 00.00.0000 | |
8776 |
|
8812 | |||
8777 | Kasper\SpecialChar ~ |
|
8813 | Kasper\SpecialChar ~ | |
8778 | Souren |
|
8814 | Souren | |
8779 | \family typewriter |
|
8815 | \family typewriter | |
8780 | <Kasper.Souren-AT-ircam.fr> |
|
8816 | <Kasper.Souren-AT-ircam.fr> | |
8781 | \family default |
|
8817 | \family default | |
8782 | Bug reports, ideas. |
|
8818 | Bug reports, ideas. | |
8783 | \layout List |
|
8819 | \layout List | |
8784 | \labelwidthstring 00.00.0000 |
|
8820 | \labelwidthstring 00.00.0000 | |
8785 |
|
8821 | |||
8786 | Gever\SpecialChar ~ |
|
8822 | Gever\SpecialChar ~ | |
8787 | Tulley |
|
8823 | Tulley | |
8788 | \family typewriter |
|
8824 | \family typewriter | |
8789 | <gever-AT-helium.com> |
|
8825 | <gever-AT-helium.com> | |
8790 | \family default |
|
8826 | \family default | |
8791 | Code contributions. |
|
8827 | Code contributions. | |
8792 | \layout List |
|
8828 | \layout List | |
8793 | \labelwidthstring 00.00.0000 |
|
8829 | \labelwidthstring 00.00.0000 | |
8794 |
|
8830 | |||
8795 | Ralf\SpecialChar ~ |
|
8831 | Ralf\SpecialChar ~ | |
8796 | Schmitt |
|
8832 | Schmitt | |
8797 | \family typewriter |
|
8833 | \family typewriter | |
8798 | <ralf-AT-brainbot.com> |
|
8834 | <ralf-AT-brainbot.com> | |
8799 | \family default |
|
8835 | \family default | |
8800 | Bug reports & fixes. |
|
8836 | Bug reports & fixes. | |
8801 | \layout List |
|
8837 | \layout List | |
8802 | \labelwidthstring 00.00.0000 |
|
8838 | \labelwidthstring 00.00.0000 | |
8803 |
|
8839 | |||
8804 | Oliver\SpecialChar ~ |
|
8840 | Oliver\SpecialChar ~ | |
8805 | Sander |
|
8841 | Sander | |
8806 | \family typewriter |
|
8842 | \family typewriter | |
8807 | <osander-AT-gmx.de> |
|
8843 | <osander-AT-gmx.de> | |
8808 | \family default |
|
8844 | \family default | |
8809 | Bug reports. |
|
8845 | Bug reports. | |
8810 | \layout List |
|
8846 | \layout List | |
8811 | \labelwidthstring 00.00.0000 |
|
8847 | \labelwidthstring 00.00.0000 | |
8812 |
|
8848 | |||
8813 | Rod\SpecialChar ~ |
|
8849 | Rod\SpecialChar ~ | |
8814 | Holland |
|
8850 | Holland | |
8815 | \family typewriter |
|
8851 | \family typewriter | |
8816 | <rhh-AT-structurelabs.com> |
|
8852 | <rhh-AT-structurelabs.com> | |
8817 | \family default |
|
8853 | \family default | |
8818 | Bug reports and fixes to logging module. |
|
8854 | Bug reports and fixes to logging module. | |
8819 | \layout List |
|
8855 | \layout List | |
8820 | \labelwidthstring 00.00.0000 |
|
8856 | \labelwidthstring 00.00.0000 | |
8821 |
|
8857 | |||
8822 | Daniel\SpecialChar ~ |
|
8858 | Daniel\SpecialChar ~ | |
8823 | 'Dang'\SpecialChar ~ |
|
8859 | 'Dang'\SpecialChar ~ | |
8824 | Griffith |
|
8860 | Griffith | |
8825 | \family typewriter |
|
8861 | \family typewriter | |
8826 | <pythondev-dang-AT-lazytwinacres.net> |
|
8862 | <pythondev-dang-AT-lazytwinacres.net> | |
8827 | \family default |
|
8863 | \family default | |
8828 | Fixes, enhancement suggestions for system shell use. |
|
8864 | Fixes, enhancement suggestions for system shell use. | |
8829 | \layout List |
|
8865 | \layout List | |
8830 | \labelwidthstring 00.00.0000 |
|
8866 | \labelwidthstring 00.00.0000 | |
8831 |
|
8867 | |||
8832 | Viktor\SpecialChar ~ |
|
8868 | Viktor\SpecialChar ~ | |
8833 | Ransmayr |
|
8869 | Ransmayr | |
8834 | \family typewriter |
|
8870 | \family typewriter | |
8835 | <viktor.ransmayr-AT-t-online.de> |
|
8871 | <viktor.ransmayr-AT-t-online.de> | |
8836 | \family default |
|
8872 | \family default | |
8837 | Tests and reports on Windows installation issues. |
|
8873 | Tests and reports on Windows installation issues. | |
8838 | Contributed a true Windows binary installer. |
|
8874 | Contributed a true Windows binary installer. | |
8839 | \layout List |
|
8875 | \layout List | |
8840 | \labelwidthstring 00.00.0000 |
|
8876 | \labelwidthstring 00.00.0000 | |
8841 |
|
8877 | |||
8842 | Mike\SpecialChar ~ |
|
8878 | Mike\SpecialChar ~ | |
8843 | Salib |
|
8879 | Salib | |
8844 | \family typewriter |
|
8880 | \family typewriter | |
8845 | <msalib-AT-mit.edu> |
|
8881 | <msalib-AT-mit.edu> | |
8846 | \family default |
|
8882 | \family default | |
8847 | Help fixing a subtle bug related to traceback printing. |
|
8883 | Help fixing a subtle bug related to traceback printing. | |
8848 | \layout List |
|
8884 | \layout List | |
8849 | \labelwidthstring 00.00.0000 |
|
8885 | \labelwidthstring 00.00.0000 | |
8850 |
|
8886 | |||
8851 | W.J.\SpecialChar ~ |
|
8887 | W.J.\SpecialChar ~ | |
8852 | van\SpecialChar ~ |
|
8888 | van\SpecialChar ~ | |
8853 | der\SpecialChar ~ |
|
8889 | der\SpecialChar ~ | |
8854 | Laan |
|
8890 | Laan | |
8855 | \family typewriter |
|
8891 | \family typewriter | |
8856 | <gnufnork-AT-hetdigitalegat.nl> |
|
8892 | <gnufnork-AT-hetdigitalegat.nl> | |
8857 | \family default |
|
8893 | \family default | |
8858 | Bash-like prompt specials. |
|
8894 | Bash-like prompt specials. | |
8859 | \layout List |
|
8895 | \layout List | |
8860 | \labelwidthstring 00.00.0000 |
|
8896 | \labelwidthstring 00.00.0000 | |
8861 |
|
8897 | |||
8862 | Ville\SpecialChar ~ |
|
8898 | Ville\SpecialChar ~ | |
8863 | Vainio |
|
8899 | Vainio | |
8864 | \family typewriter |
|
8900 | \family typewriter | |
8865 | <vivainio-AT-kolumbus.fi> |
|
8901 | <vivainio-AT-kolumbus.fi> | |
8866 | \family default |
|
8902 | \family default | |
8867 | Bugfixes and suggestions. |
|
8903 | Bugfixes and suggestions. | |
8868 | Excellent patches for many new features. |
|
8904 | Excellent patches for many new features. | |
8869 | \layout List |
|
8905 | \layout List | |
8870 | \labelwidthstring 00.00.0000 |
|
8906 | \labelwidthstring 00.00.0000 | |
8871 |
|
8907 | |||
8872 | Antoon\SpecialChar ~ |
|
8908 | Antoon\SpecialChar ~ | |
8873 | Pardon |
|
8909 | Pardon | |
8874 | \family typewriter |
|
8910 | \family typewriter | |
8875 | <Antoon.Pardon-AT-rece.vub.ac.be> |
|
8911 | <Antoon.Pardon-AT-rece.vub.ac.be> | |
8876 | \family default |
|
8912 | \family default | |
8877 | Critical fix for the multithreaded IPython. |
|
8913 | Critical fix for the multithreaded IPython. | |
8878 | \layout List |
|
8914 | \layout List | |
8879 | \labelwidthstring 00.00.0000 |
|
8915 | \labelwidthstring 00.00.0000 | |
8880 |
|
8916 | |||
8881 | John\SpecialChar ~ |
|
8917 | John\SpecialChar ~ | |
8882 | Hunter |
|
8918 | Hunter | |
8883 | \family typewriter |
|
8919 | \family typewriter | |
8884 | <jdhunter-AT-nitace.bsd.uchicago.edu> |
|
8920 | <jdhunter-AT-nitace.bsd.uchicago.edu> | |
8885 | \family default |
|
8921 | \family default | |
8886 | Matplotlib author, helped with all the development of support for matplotlib |
|
8922 | Matplotlib author, helped with all the development of support for matplotlib | |
8887 | in IPyhton, including making necessary changes to matplotlib itself. |
|
8923 | in IPyhton, including making necessary changes to matplotlib itself. | |
8888 | \layout List |
|
8924 | \layout List | |
8889 | \labelwidthstring 00.00.0000 |
|
8925 | \labelwidthstring 00.00.0000 | |
8890 |
|
8926 | |||
8891 | Matthew\SpecialChar ~ |
|
8927 | Matthew\SpecialChar ~ | |
8892 | Arnison |
|
8928 | Arnison | |
8893 | \family typewriter |
|
8929 | \family typewriter | |
8894 | <maffew-AT-cat.org.au> |
|
8930 | <maffew-AT-cat.org.au> | |
8895 | \family default |
|
8931 | \family default | |
8896 | Bug reports, ` |
|
8932 | Bug reports, ` | |
8897 | \family typewriter |
|
8933 | \family typewriter | |
8898 | %run -d |
|
8934 | %run -d | |
8899 | \family default |
|
8935 | \family default | |
8900 | ' idea. |
|
8936 | ' idea. | |
8901 | \layout List |
|
8937 | \layout List | |
8902 | \labelwidthstring 00.00.0000 |
|
8938 | \labelwidthstring 00.00.0000 | |
8903 |
|
8939 | |||
8904 | Prabhu\SpecialChar ~ |
|
8940 | Prabhu\SpecialChar ~ | |
8905 | Ramachandran |
|
8941 | Ramachandran | |
8906 | \family typewriter |
|
8942 | \family typewriter | |
8907 | <prabhu_r-AT-users.sourceforge.net> |
|
8943 | <prabhu_r-AT-users.sourceforge.net> | |
8908 | \family default |
|
8944 | \family default | |
8909 | Help with (X)Emacs support, threading patches, ideas... |
|
8945 | Help with (X)Emacs support, threading patches, ideas... | |
8910 | \layout List |
|
8946 | \layout List | |
8911 | \labelwidthstring 00.00.0000 |
|
8947 | \labelwidthstring 00.00.0000 | |
8912 |
|
8948 | |||
8913 | Norbert\SpecialChar ~ |
|
8949 | Norbert\SpecialChar ~ | |
8914 | Tretkowski |
|
8950 | Tretkowski | |
8915 | \family typewriter |
|
8951 | \family typewriter | |
8916 | <tretkowski-AT-inittab.de> |
|
8952 | <tretkowski-AT-inittab.de> | |
8917 | \family default |
|
8953 | \family default | |
8918 | help with Debian packaging and distribution. |
|
8954 | help with Debian packaging and distribution. | |
8919 | \layout List |
|
8955 | \layout List | |
8920 | \labelwidthstring 00.00.0000 |
|
8956 | \labelwidthstring 00.00.0000 | |
8921 |
|
8957 | |||
8922 | George\SpecialChar ~ |
|
8958 | George\SpecialChar ~ | |
8923 | Sakkis < |
|
8959 | Sakkis < | |
8924 | \family typewriter |
|
8960 | \family typewriter | |
8925 | gsakkis-AT-eden.rutgers.edu> |
|
8961 | gsakkis-AT-eden.rutgers.edu> | |
8926 | \family default |
|
8962 | \family default | |
8927 | New matcher for tab-completing named arguments of user-defined functions. |
|
8963 | New matcher for tab-completing named arguments of user-defined functions. | |
8928 | \the_end |
|
8964 | \the_end |
General Comments 0
You need to be logged in to leave comments.
Login now