##// END OF EJS Templates
Add new winconsole module and fixes to page_dumb() to improve its behavior...
fperez -
Show More
@@ -0,0 +1,43 b''
1 """
2 Set of functions to work with console on Windows.
3
4 Author: Alexander Belchenko (e-mail: bialix AT ukr.net)
5 License: Public domain
6 """
7
8 __author__ = 'Alexander Belchenko (e-mail: bialix AT ukr.net)'
9 __license__ = 'Public domain'
10
11 import struct
12
13 try:
14 import ctypes
15 except ImportError:
16 ctypes = None
17
18 def get_console_size(defaultx=80, defaulty=25):
19 """ Return size of current console.
20
21 This function try to determine actual size of current working
22 console window and return tuple (sizex, sizey) if success,
23 or default size (defaultx, defaulty) otherwise.
24
25 Dependencies: ctypes should be installed.
26 """
27 if ctypes is None:
28 # no ctypes is found
29 return (defaultx, defaulty)
30
31 h = ctypes.windll.kernel32.GetStdHandle(-11)
32 csbi = ctypes.create_string_buffer(22)
33 res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
34
35 if res:
36 (bufx, bufy, curx, cury, wattr,
37 left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh",
38 csbi.raw)
39 sizex = right - left + 1
40 sizey = bottom - top + 1
41 return (sizex, sizey)
42 else:
43 return (defaultx, defaulty)
@@ -1,1645 +1,1680 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 General purpose utilities.
3 General purpose utilities.
4
4
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 these things are also convenient when working at the command line.
6 these things are also convenient when working at the command line.
7
7
8 $Id: genutils.py 967 2005-12-29 09:02:13Z fperez $"""
8 $Id: genutils.py 971 2005-12-29 18:30:45Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
12 #
12 #
13 # Distributed under the terms of the BSD License. The full license is in
13 # Distributed under the terms of the BSD License. The full license is in
14 # the file COPYING, distributed as part of this software.
14 # the file COPYING, distributed as part of this software.
15 #*****************************************************************************
15 #*****************************************************************************
16
16
17 from __future__ import generators # 2.2 compatibility
17 from __future__ import generators # 2.2 compatibility
18
18
19 from IPython import Release
19 from IPython import Release
20 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __author__ = '%s <%s>' % Release.authors['Fernando']
21 __license__ = Release.license
21 __license__ = Release.license
22
22
23 #****************************************************************************
23 #****************************************************************************
24 # required modules from the Python standard library
24 # required modules from the Python standard library
25 import __main__
25 import __main__
26 import commands
26 import commands
27 import os
27 import os
28 import re
28 import re
29 import shlex
29 import shlex
30 import shutil
30 import shutil
31 import sys
31 import sys
32 import tempfile
32 import tempfile
33 import time
33 import time
34 import types
34 import types
35
35
36 # Other IPython utilities
36 # Other IPython utilities
37 from IPython.Itpl import Itpl,itpl,printpl
37 from IPython.Itpl import Itpl,itpl,printpl
38 from IPython import DPyGetOpt
38 from IPython import DPyGetOpt
39
39
40 if os.name == "nt":
41 from IPython.winconsole import get_console_size
42
40 # Build objects which appeared in Python 2.3 for 2.2, to make ipython
43 # Build objects which appeared in Python 2.3 for 2.2, to make ipython
41 # 2.2-friendly
44 # 2.2-friendly
42 try:
45 try:
43 basestring
46 basestring
44 except NameError:
47 except NameError:
45 import types
48 import types
46 basestring = (types.StringType, types.UnicodeType)
49 basestring = (types.StringType, types.UnicodeType)
47 True = 1==1
50 True = 1==1
48 False = 1==0
51 False = 1==0
49
52
50 def enumerate(obj):
53 def enumerate(obj):
51 i = -1
54 i = -1
52 for item in obj:
55 for item in obj:
53 i += 1
56 i += 1
54 yield i, item
57 yield i, item
55
58
56 # add these to the builtin namespace, so that all modules find them
59 # add these to the builtin namespace, so that all modules find them
57 import __builtin__
60 import __builtin__
58 __builtin__.basestring = basestring
61 __builtin__.basestring = basestring
59 __builtin__.True = True
62 __builtin__.True = True
60 __builtin__.False = False
63 __builtin__.False = False
61 __builtin__.enumerate = enumerate
64 __builtin__.enumerate = enumerate
62
65
63 # Try to use shlex.split for converting an input string into a sys.argv-type
66 # Try to use shlex.split for converting an input string into a sys.argv-type
64 # list. This appeared in Python 2.3, so here's a quick backport for 2.2.
67 # list. This appeared in Python 2.3, so here's a quick backport for 2.2.
65 try:
68 try:
66 shlex_split = shlex.split
69 shlex_split = shlex.split
67 except AttributeError:
70 except AttributeError:
68 _quotesre = re.compile(r'[\'"](.*)[\'"]')
71 _quotesre = re.compile(r'[\'"](.*)[\'"]')
69 _wordchars = ('abcdfeghijklmnopqrstuvwxyz'
72 _wordchars = ('abcdfeghijklmnopqrstuvwxyz'
70 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.~*?'
73 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.~*?'
71 'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
74 'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
72 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ%s'
75 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ%s'
73 % os.sep)
76 % os.sep)
74
77
75 def shlex_split(s):
78 def shlex_split(s):
76 """Simplified backport to Python 2.2 of shlex.split().
79 """Simplified backport to Python 2.2 of shlex.split().
77
80
78 This is a quick and dirty hack, since the shlex module under 2.2 lacks
81 This is a quick and dirty hack, since the shlex module under 2.2 lacks
79 several of the features needed to really match the functionality of
82 several of the features needed to really match the functionality of
80 shlex.split() in 2.3."""
83 shlex.split() in 2.3."""
81
84
82 lex = shlex.shlex(StringIO(s))
85 lex = shlex.shlex(StringIO(s))
83 # Try to get options, extensions and path separators as characters
86 # Try to get options, extensions and path separators as characters
84 lex.wordchars = _wordchars
87 lex.wordchars = _wordchars
85 lex.commenters = ''
88 lex.commenters = ''
86 # Make a list out of the lexer by hand, since in 2.2 it's not an
89 # Make a list out of the lexer by hand, since in 2.2 it's not an
87 # iterator.
90 # iterator.
88 lout = []
91 lout = []
89 while 1:
92 while 1:
90 token = lex.get_token()
93 token = lex.get_token()
91 if token == '':
94 if token == '':
92 break
95 break
93 # Try to handle quoted tokens correctly
96 # Try to handle quoted tokens correctly
94 quotes = _quotesre.match(token)
97 quotes = _quotesre.match(token)
95 if quotes:
98 if quotes:
96 token = quotes.group(1)
99 token = quotes.group(1)
97 lout.append(token)
100 lout.append(token)
98 return lout
101 return lout
99
102
100 #****************************************************************************
103 #****************************************************************************
101 # Exceptions
104 # Exceptions
102 class Error(Exception):
105 class Error(Exception):
103 """Base class for exceptions in this module."""
106 """Base class for exceptions in this module."""
104 pass
107 pass
105
108
106 #----------------------------------------------------------------------------
109 #----------------------------------------------------------------------------
107 class IOStream:
110 class IOStream:
108 def __init__(self,stream,fallback):
111 def __init__(self,stream,fallback):
109 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
112 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
110 stream = fallback
113 stream = fallback
111 self.stream = stream
114 self.stream = stream
112 self._swrite = stream.write
115 self._swrite = stream.write
113 self.flush = stream.flush
116 self.flush = stream.flush
114
117
115 def write(self,data):
118 def write(self,data):
116 try:
119 try:
117 self._swrite(data)
120 self._swrite(data)
118 except:
121 except:
119 try:
122 try:
120 # print handles some unicode issues which may trip a plain
123 # print handles some unicode issues which may trip a plain
121 # write() call. Attempt to emulate write() by using a
124 # write() call. Attempt to emulate write() by using a
122 # trailing comma
125 # trailing comma
123 print >> self.stream, data,
126 print >> self.stream, data,
124 except:
127 except:
125 # if we get here, something is seriously broken.
128 # if we get here, something is seriously broken.
126 print >> sys.stderr, \
129 print >> sys.stderr, \
127 'ERROR - failed to write data to stream:', stream
130 'ERROR - failed to write data to stream:', stream
128
131
129 class IOTerm:
132 class IOTerm:
130 """ Term holds the file or file-like objects for handling I/O operations.
133 """ Term holds the file or file-like objects for handling I/O operations.
131
134
132 These are normally just sys.stdin, sys.stdout and sys.stderr but for
135 These are normally just sys.stdin, sys.stdout and sys.stderr but for
133 Windows they can can replaced to allow editing the strings before they are
136 Windows they can can replaced to allow editing the strings before they are
134 displayed."""
137 displayed."""
135
138
136 # In the future, having IPython channel all its I/O operations through
139 # In the future, having IPython channel all its I/O operations through
137 # this class will make it easier to embed it into other environments which
140 # this class will make it easier to embed it into other environments which
138 # are not a normal terminal (such as a GUI-based shell)
141 # are not a normal terminal (such as a GUI-based shell)
139 def __init__(self,cin=None,cout=None,cerr=None):
142 def __init__(self,cin=None,cout=None,cerr=None):
140 self.cin = IOStream(cin,sys.stdin)
143 self.cin = IOStream(cin,sys.stdin)
141 self.cout = IOStream(cout,sys.stdout)
144 self.cout = IOStream(cout,sys.stdout)
142 self.cerr = IOStream(cerr,sys.stderr)
145 self.cerr = IOStream(cerr,sys.stderr)
143
146
144 # Global variable to be used for all I/O
147 # Global variable to be used for all I/O
145 Term = IOTerm()
148 Term = IOTerm()
146
149
147 # Windows-specific code to load Gary Bishop's readline and configure it
150 # Windows-specific code to load Gary Bishop's readline and configure it
148 # automatically for the users
151 # automatically for the users
149 # Note: os.name on cygwin returns posix, so this should only pick up 'native'
152 # Note: os.name on cygwin returns posix, so this should only pick up 'native'
150 # windows. Cygwin returns 'cygwin' for sys.platform.
153 # windows. Cygwin returns 'cygwin' for sys.platform.
151 if os.name == 'nt':
154 if os.name == 'nt':
152 try:
155 try:
153 import readline
156 import readline
154 except ImportError:
157 except ImportError:
155 pass
158 pass
156 else:
159 else:
157 try:
160 try:
158 _out = readline.GetOutputFile()
161 _out = readline.GetOutputFile()
159 except AttributeError:
162 except AttributeError:
160 pass
163 pass
161 else:
164 else:
162 # Remake Term to use the readline i/o facilities
165 # Remake Term to use the readline i/o facilities
163 Term = IOTerm(cout=_out,cerr=_out)
166 Term = IOTerm(cout=_out,cerr=_out)
164 del _out
167 del _out
165
168
166 #****************************************************************************
169 #****************************************************************************
167 # Generic warning/error printer, used by everything else
170 # Generic warning/error printer, used by everything else
168 def warn(msg,level=2,exit_val=1):
171 def warn(msg,level=2,exit_val=1):
169 """Standard warning printer. Gives formatting consistency.
172 """Standard warning printer. Gives formatting consistency.
170
173
171 Output is sent to Term.cerr (sys.stderr by default).
174 Output is sent to Term.cerr (sys.stderr by default).
172
175
173 Options:
176 Options:
174
177
175 -level(2): allows finer control:
178 -level(2): allows finer control:
176 0 -> Do nothing, dummy function.
179 0 -> Do nothing, dummy function.
177 1 -> Print message.
180 1 -> Print message.
178 2 -> Print 'WARNING:' + message. (Default level).
181 2 -> Print 'WARNING:' + message. (Default level).
179 3 -> Print 'ERROR:' + message.
182 3 -> Print 'ERROR:' + message.
180 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
183 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
181
184
182 -exit_val (1): exit value returned by sys.exit() for a level 4
185 -exit_val (1): exit value returned by sys.exit() for a level 4
183 warning. Ignored for all other levels."""
186 warning. Ignored for all other levels."""
184
187
185 if level>0:
188 if level>0:
186 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
189 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
187 print >> Term.cerr, '%s%s' % (header[level],msg)
190 print >> Term.cerr, '%s%s' % (header[level],msg)
188 if level == 4:
191 if level == 4:
189 print >> Term.cerr,'Exiting.\n'
192 print >> Term.cerr,'Exiting.\n'
190 sys.exit(exit_val)
193 sys.exit(exit_val)
191
194
192 def info(msg):
195 def info(msg):
193 """Equivalent to warn(msg,level=1)."""
196 """Equivalent to warn(msg,level=1)."""
194
197
195 warn(msg,level=1)
198 warn(msg,level=1)
196
199
197 def error(msg):
200 def error(msg):
198 """Equivalent to warn(msg,level=3)."""
201 """Equivalent to warn(msg,level=3)."""
199
202
200 warn(msg,level=3)
203 warn(msg,level=3)
201
204
202 def fatal(msg,exit_val=1):
205 def fatal(msg,exit_val=1):
203 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
206 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
204
207
205 warn(msg,exit_val=exit_val,level=4)
208 warn(msg,exit_val=exit_val,level=4)
206
209
207 #----------------------------------------------------------------------------
210 #----------------------------------------------------------------------------
208 StringTypes = types.StringTypes
211 StringTypes = types.StringTypes
209
212
210 # Basic timing functionality
213 # Basic timing functionality
211
214
212 # If possible (Unix), use the resource module instead of time.clock()
215 # If possible (Unix), use the resource module instead of time.clock()
213 try:
216 try:
214 import resource
217 import resource
215 def clock():
218 def clock():
216 """clock() -> floating point number
219 """clock() -> floating point number
217
220
218 Return the CPU time in seconds (user time only, system time is
221 Return the CPU time in seconds (user time only, system time is
219 ignored) since the start of the process. This is done via a call to
222 ignored) since the start of the process. This is done via a call to
220 resource.getrusage, so it avoids the wraparound problems in
223 resource.getrusage, so it avoids the wraparound problems in
221 time.clock()."""
224 time.clock()."""
222
225
223 return resource.getrusage(resource.RUSAGE_SELF)[0]
226 return resource.getrusage(resource.RUSAGE_SELF)[0]
224
227
225 def clock2():
228 def clock2():
226 """clock2() -> (t_user,t_system)
229 """clock2() -> (t_user,t_system)
227
230
228 Similar to clock(), but return a tuple of user/system times."""
231 Similar to clock(), but return a tuple of user/system times."""
229 return resource.getrusage(resource.RUSAGE_SELF)[:2]
232 return resource.getrusage(resource.RUSAGE_SELF)[:2]
230
233
231 except ImportError:
234 except ImportError:
232 clock = time.clock
235 clock = time.clock
233 def clock2():
236 def clock2():
234 """Under windows, system CPU time can't be measured.
237 """Under windows, system CPU time can't be measured.
235
238
236 This just returns clock() and zero."""
239 This just returns clock() and zero."""
237 return time.clock(),0.0
240 return time.clock(),0.0
238
241
239 def timings_out(reps,func,*args,**kw):
242 def timings_out(reps,func,*args,**kw):
240 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
243 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
241
244
242 Execute a function reps times, return a tuple with the elapsed total
245 Execute a function reps times, return a tuple with the elapsed total
243 CPU time in seconds, the time per call and the function's output.
246 CPU time in seconds, the time per call and the function's output.
244
247
245 Under Unix, the return value is the sum of user+system time consumed by
248 Under Unix, the return value is the sum of user+system time consumed by
246 the process, computed via the resource module. This prevents problems
249 the process, computed via the resource module. This prevents problems
247 related to the wraparound effect which the time.clock() function has.
250 related to the wraparound effect which the time.clock() function has.
248
251
249 Under Windows the return value is in wall clock seconds. See the
252 Under Windows the return value is in wall clock seconds. See the
250 documentation for the time module for more details."""
253 documentation for the time module for more details."""
251
254
252 reps = int(reps)
255 reps = int(reps)
253 assert reps >=1, 'reps must be >= 1'
256 assert reps >=1, 'reps must be >= 1'
254 if reps==1:
257 if reps==1:
255 start = clock()
258 start = clock()
256 out = func(*args,**kw)
259 out = func(*args,**kw)
257 tot_time = clock()-start
260 tot_time = clock()-start
258 else:
261 else:
259 rng = xrange(reps-1) # the last time is executed separately to store output
262 rng = xrange(reps-1) # the last time is executed separately to store output
260 start = clock()
263 start = clock()
261 for dummy in rng: func(*args,**kw)
264 for dummy in rng: func(*args,**kw)
262 out = func(*args,**kw) # one last time
265 out = func(*args,**kw) # one last time
263 tot_time = clock()-start
266 tot_time = clock()-start
264 av_time = tot_time / reps
267 av_time = tot_time / reps
265 return tot_time,av_time,out
268 return tot_time,av_time,out
266
269
267 def timings(reps,func,*args,**kw):
270 def timings(reps,func,*args,**kw):
268 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
271 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
269
272
270 Execute a function reps times, return a tuple with the elapsed total CPU
273 Execute a function reps times, return a tuple with the elapsed total CPU
271 time in seconds and the time per call. These are just the first two values
274 time in seconds and the time per call. These are just the first two values
272 in timings_out()."""
275 in timings_out()."""
273
276
274 return timings_out(reps,func,*args,**kw)[0:2]
277 return timings_out(reps,func,*args,**kw)[0:2]
275
278
276 def timing(func,*args,**kw):
279 def timing(func,*args,**kw):
277 """timing(func,*args,**kw) -> t_total
280 """timing(func,*args,**kw) -> t_total
278
281
279 Execute a function once, return the elapsed total CPU time in
282 Execute a function once, return the elapsed total CPU time in
280 seconds. This is just the first value in timings_out()."""
283 seconds. This is just the first value in timings_out()."""
281
284
282 return timings_out(1,func,*args,**kw)[0]
285 return timings_out(1,func,*args,**kw)[0]
283
286
284 #****************************************************************************
287 #****************************************************************************
285 # file and system
288 # file and system
286
289
287 def system(cmd,verbose=0,debug=0,header=''):
290 def system(cmd,verbose=0,debug=0,header=''):
288 """Execute a system command, return its exit status.
291 """Execute a system command, return its exit status.
289
292
290 Options:
293 Options:
291
294
292 - verbose (0): print the command to be executed.
295 - verbose (0): print the command to be executed.
293
296
294 - debug (0): only print, do not actually execute.
297 - debug (0): only print, do not actually execute.
295
298
296 - header (''): Header to print on screen prior to the executed command (it
299 - header (''): Header to print on screen prior to the executed command (it
297 is only prepended to the command, no newlines are added).
300 is only prepended to the command, no newlines are added).
298
301
299 Note: a stateful version of this function is available through the
302 Note: a stateful version of this function is available through the
300 SystemExec class."""
303 SystemExec class."""
301
304
302 stat = 0
305 stat = 0
303 if verbose or debug: print header+cmd
306 if verbose or debug: print header+cmd
304 sys.stdout.flush()
307 sys.stdout.flush()
305 if not debug: stat = os.system(cmd)
308 if not debug: stat = os.system(cmd)
306 return stat
309 return stat
307
310
308 def shell(cmd,verbose=0,debug=0,header=''):
311 def shell(cmd,verbose=0,debug=0,header=''):
309 """Execute a command in the system shell, always return None.
312 """Execute a command in the system shell, always return None.
310
313
311 Options:
314 Options:
312
315
313 - verbose (0): print the command to be executed.
316 - verbose (0): print the command to be executed.
314
317
315 - debug (0): only print, do not actually execute.
318 - debug (0): only print, do not actually execute.
316
319
317 - header (''): Header to print on screen prior to the executed command (it
320 - header (''): Header to print on screen prior to the executed command (it
318 is only prepended to the command, no newlines are added).
321 is only prepended to the command, no newlines are added).
319
322
320 Note: this is similar to genutils.system(), but it returns None so it can
323 Note: this is similar to genutils.system(), but it returns None so it can
321 be conveniently used in interactive loops without getting the return value
324 be conveniently used in interactive loops without getting the return value
322 (typically 0) printed many times."""
325 (typically 0) printed many times."""
323
326
324 stat = 0
327 stat = 0
325 if verbose or debug: print header+cmd
328 if verbose or debug: print header+cmd
326 # flush stdout so we don't mangle python's buffering
329 # flush stdout so we don't mangle python's buffering
327 sys.stdout.flush()
330 sys.stdout.flush()
328 if not debug:
331 if not debug:
329 os.system(cmd)
332 os.system(cmd)
330
333
331 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
334 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
332 """Dummy substitute for perl's backquotes.
335 """Dummy substitute for perl's backquotes.
333
336
334 Executes a command and returns the output.
337 Executes a command and returns the output.
335
338
336 Accepts the same arguments as system(), plus:
339 Accepts the same arguments as system(), plus:
337
340
338 - split(0): if true, the output is returned as a list split on newlines.
341 - split(0): if true, the output is returned as a list split on newlines.
339
342
340 Note: a stateful version of this function is available through the
343 Note: a stateful version of this function is available through the
341 SystemExec class."""
344 SystemExec class."""
342
345
343 if verbose or debug: print header+cmd
346 if verbose or debug: print header+cmd
344 if not debug:
347 if not debug:
345 output = commands.getoutput(cmd)
348 output = commands.getoutput(cmd)
346 if split:
349 if split:
347 return output.split('\n')
350 return output.split('\n')
348 else:
351 else:
349 return output
352 return output
350
353
351 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
354 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
352 """Return (standard output,standard error) of executing cmd in a shell.
355 """Return (standard output,standard error) of executing cmd in a shell.
353
356
354 Accepts the same arguments as system(), plus:
357 Accepts the same arguments as system(), plus:
355
358
356 - split(0): if true, each of stdout/err is returned as a list split on
359 - split(0): if true, each of stdout/err is returned as a list split on
357 newlines.
360 newlines.
358
361
359 Note: a stateful version of this function is available through the
362 Note: a stateful version of this function is available through the
360 SystemExec class."""
363 SystemExec class."""
361
364
362 if verbose or debug: print header+cmd
365 if verbose or debug: print header+cmd
363 if not cmd:
366 if not cmd:
364 if split:
367 if split:
365 return [],[]
368 return [],[]
366 else:
369 else:
367 return '',''
370 return '',''
368 if not debug:
371 if not debug:
369 pin,pout,perr = os.popen3(cmd)
372 pin,pout,perr = os.popen3(cmd)
370 tout = pout.read().rstrip()
373 tout = pout.read().rstrip()
371 terr = perr.read().rstrip()
374 terr = perr.read().rstrip()
372 pin.close()
375 pin.close()
373 pout.close()
376 pout.close()
374 perr.close()
377 perr.close()
375 if split:
378 if split:
376 return tout.split('\n'),terr.split('\n')
379 return tout.split('\n'),terr.split('\n')
377 else:
380 else:
378 return tout,terr
381 return tout,terr
379
382
380 # for compatibility with older naming conventions
383 # for compatibility with older naming conventions
381 xsys = system
384 xsys = system
382 bq = getoutput
385 bq = getoutput
383
386
384 class SystemExec:
387 class SystemExec:
385 """Access the system and getoutput functions through a stateful interface.
388 """Access the system and getoutput functions through a stateful interface.
386
389
387 Note: here we refer to the system and getoutput functions from this
390 Note: here we refer to the system and getoutput functions from this
388 library, not the ones from the standard python library.
391 library, not the ones from the standard python library.
389
392
390 This class offers the system and getoutput functions as methods, but the
393 This class offers the system and getoutput functions as methods, but the
391 verbose, debug and header parameters can be set for the instance (at
394 verbose, debug and header parameters can be set for the instance (at
392 creation time or later) so that they don't need to be specified on each
395 creation time or later) so that they don't need to be specified on each
393 call.
396 call.
394
397
395 For efficiency reasons, there's no way to override the parameters on a
398 For efficiency reasons, there's no way to override the parameters on a
396 per-call basis other than by setting instance attributes. If you need
399 per-call basis other than by setting instance attributes. If you need
397 local overrides, it's best to directly call system() or getoutput().
400 local overrides, it's best to directly call system() or getoutput().
398
401
399 The following names are provided as alternate options:
402 The following names are provided as alternate options:
400 - xsys: alias to system
403 - xsys: alias to system
401 - bq: alias to getoutput
404 - bq: alias to getoutput
402
405
403 An instance can then be created as:
406 An instance can then be created as:
404 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
407 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
405
408
406 And used as:
409 And used as:
407 >>> sysexec.xsys('pwd')
410 >>> sysexec.xsys('pwd')
408 >>> dirlist = sysexec.bq('ls -l')
411 >>> dirlist = sysexec.bq('ls -l')
409 """
412 """
410
413
411 def __init__(self,verbose=0,debug=0,header='',split=0):
414 def __init__(self,verbose=0,debug=0,header='',split=0):
412 """Specify the instance's values for verbose, debug and header."""
415 """Specify the instance's values for verbose, debug and header."""
413 setattr_list(self,'verbose debug header split')
416 setattr_list(self,'verbose debug header split')
414
417
415 def system(self,cmd):
418 def system(self,cmd):
416 """Stateful interface to system(), with the same keyword parameters."""
419 """Stateful interface to system(), with the same keyword parameters."""
417
420
418 system(cmd,self.verbose,self.debug,self.header)
421 system(cmd,self.verbose,self.debug,self.header)
419
422
420 def shell(self,cmd):
423 def shell(self,cmd):
421 """Stateful interface to shell(), with the same keyword parameters."""
424 """Stateful interface to shell(), with the same keyword parameters."""
422
425
423 shell(cmd,self.verbose,self.debug,self.header)
426 shell(cmd,self.verbose,self.debug,self.header)
424
427
425 xsys = system # alias
428 xsys = system # alias
426
429
427 def getoutput(self,cmd):
430 def getoutput(self,cmd):
428 """Stateful interface to getoutput()."""
431 """Stateful interface to getoutput()."""
429
432
430 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
433 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
431
434
432 def getoutputerror(self,cmd):
435 def getoutputerror(self,cmd):
433 """Stateful interface to getoutputerror()."""
436 """Stateful interface to getoutputerror()."""
434
437
435 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
438 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
436
439
437 bq = getoutput # alias
440 bq = getoutput # alias
438
441
439 #-----------------------------------------------------------------------------
442 #-----------------------------------------------------------------------------
440 def mutex_opts(dict,ex_op):
443 def mutex_opts(dict,ex_op):
441 """Check for presence of mutually exclusive keys in a dict.
444 """Check for presence of mutually exclusive keys in a dict.
442
445
443 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
446 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
444 for op1,op2 in ex_op:
447 for op1,op2 in ex_op:
445 if op1 in dict and op2 in dict:
448 if op1 in dict and op2 in dict:
446 raise ValueError,'\n*** ERROR in Arguments *** '\
449 raise ValueError,'\n*** ERROR in Arguments *** '\
447 'Options '+op1+' and '+op2+' are mutually exclusive.'
450 'Options '+op1+' and '+op2+' are mutually exclusive.'
448
451
449 #-----------------------------------------------------------------------------
452 #-----------------------------------------------------------------------------
450 def get_py_filename(name):
453 def get_py_filename(name):
451 """Return a valid python filename in the current directory.
454 """Return a valid python filename in the current directory.
452
455
453 If the given name is not a file, it adds '.py' and searches again.
456 If the given name is not a file, it adds '.py' and searches again.
454 Raises IOError with an informative message if the file isn't found."""
457 Raises IOError with an informative message if the file isn't found."""
455
458
456 name = os.path.expanduser(name)
459 name = os.path.expanduser(name)
457 if not os.path.isfile(name) and not name.endswith('.py'):
460 if not os.path.isfile(name) and not name.endswith('.py'):
458 name += '.py'
461 name += '.py'
459 if os.path.isfile(name):
462 if os.path.isfile(name):
460 return name
463 return name
461 else:
464 else:
462 raise IOError,'File `%s` not found.' % name
465 raise IOError,'File `%s` not found.' % name
463
466
464 #-----------------------------------------------------------------------------
467 #-----------------------------------------------------------------------------
465 def filefind(fname,alt_dirs = None):
468 def filefind(fname,alt_dirs = None):
466 """Return the given filename either in the current directory, if it
469 """Return the given filename either in the current directory, if it
467 exists, or in a specified list of directories.
470 exists, or in a specified list of directories.
468
471
469 ~ expansion is done on all file and directory names.
472 ~ expansion is done on all file and directory names.
470
473
471 Upon an unsuccessful search, raise an IOError exception."""
474 Upon an unsuccessful search, raise an IOError exception."""
472
475
473 if alt_dirs is None:
476 if alt_dirs is None:
474 try:
477 try:
475 alt_dirs = get_home_dir()
478 alt_dirs = get_home_dir()
476 except HomeDirError:
479 except HomeDirError:
477 alt_dirs = os.getcwd()
480 alt_dirs = os.getcwd()
478 search = [fname] + list_strings(alt_dirs)
481 search = [fname] + list_strings(alt_dirs)
479 search = map(os.path.expanduser,search)
482 search = map(os.path.expanduser,search)
480 #print 'search list for',fname,'list:',search # dbg
483 #print 'search list for',fname,'list:',search # dbg
481 fname = search[0]
484 fname = search[0]
482 if os.path.isfile(fname):
485 if os.path.isfile(fname):
483 return fname
486 return fname
484 for direc in search[1:]:
487 for direc in search[1:]:
485 testname = os.path.join(direc,fname)
488 testname = os.path.join(direc,fname)
486 #print 'testname',testname # dbg
489 #print 'testname',testname # dbg
487 if os.path.isfile(testname):
490 if os.path.isfile(testname):
488 return testname
491 return testname
489 raise IOError,'File' + `fname` + \
492 raise IOError,'File' + `fname` + \
490 ' not found in current or supplied directories:' + `alt_dirs`
493 ' not found in current or supplied directories:' + `alt_dirs`
491
494
492 #----------------------------------------------------------------------------
495 #----------------------------------------------------------------------------
493 def file_read(filename):
496 def file_read(filename):
494 """Read a file and close it. Returns the file source."""
497 """Read a file and close it. Returns the file source."""
495 fobj=open(filename,'r');
498 fobj=open(filename,'r');
496 source = fobj.read();
499 source = fobj.read();
497 fobj.close()
500 fobj.close()
498 return source
501 return source
499
502
500 #----------------------------------------------------------------------------
503 #----------------------------------------------------------------------------
501 def target_outdated(target,deps):
504 def target_outdated(target,deps):
502 """Determine whether a target is out of date.
505 """Determine whether a target is out of date.
503
506
504 target_outdated(target,deps) -> 1/0
507 target_outdated(target,deps) -> 1/0
505
508
506 deps: list of filenames which MUST exist.
509 deps: list of filenames which MUST exist.
507 target: single filename which may or may not exist.
510 target: single filename which may or may not exist.
508
511
509 If target doesn't exist or is older than any file listed in deps, return
512 If target doesn't exist or is older than any file listed in deps, return
510 true, otherwise return false.
513 true, otherwise return false.
511 """
514 """
512 try:
515 try:
513 target_time = os.path.getmtime(target)
516 target_time = os.path.getmtime(target)
514 except os.error:
517 except os.error:
515 return 1
518 return 1
516 for dep in deps:
519 for dep in deps:
517 dep_time = os.path.getmtime(dep)
520 dep_time = os.path.getmtime(dep)
518 if dep_time > target_time:
521 if dep_time > target_time:
519 #print "For target",target,"Dep failed:",dep # dbg
522 #print "For target",target,"Dep failed:",dep # dbg
520 #print "times (dep,tar):",dep_time,target_time # dbg
523 #print "times (dep,tar):",dep_time,target_time # dbg
521 return 1
524 return 1
522 return 0
525 return 0
523
526
524 #-----------------------------------------------------------------------------
527 #-----------------------------------------------------------------------------
525 def target_update(target,deps,cmd):
528 def target_update(target,deps,cmd):
526 """Update a target with a given command given a list of dependencies.
529 """Update a target with a given command given a list of dependencies.
527
530
528 target_update(target,deps,cmd) -> runs cmd if target is outdated.
531 target_update(target,deps,cmd) -> runs cmd if target is outdated.
529
532
530 This is just a wrapper around target_outdated() which calls the given
533 This is just a wrapper around target_outdated() which calls the given
531 command if target is outdated."""
534 command if target is outdated."""
532
535
533 if target_outdated(target,deps):
536 if target_outdated(target,deps):
534 xsys(cmd)
537 xsys(cmd)
535
538
536 #----------------------------------------------------------------------------
539 #----------------------------------------------------------------------------
537 def unquote_ends(istr):
540 def unquote_ends(istr):
538 """Remove a single pair of quotes from the endpoints of a string."""
541 """Remove a single pair of quotes from the endpoints of a string."""
539
542
540 if not istr:
543 if not istr:
541 return istr
544 return istr
542 if (istr[0]=="'" and istr[-1]=="'") or \
545 if (istr[0]=="'" and istr[-1]=="'") or \
543 (istr[0]=='"' and istr[-1]=='"'):
546 (istr[0]=='"' and istr[-1]=='"'):
544 return istr[1:-1]
547 return istr[1:-1]
545 else:
548 else:
546 return istr
549 return istr
547
550
548 #----------------------------------------------------------------------------
551 #----------------------------------------------------------------------------
549 def process_cmdline(argv,names=[],defaults={},usage=''):
552 def process_cmdline(argv,names=[],defaults={},usage=''):
550 """ Process command-line options and arguments.
553 """ Process command-line options and arguments.
551
554
552 Arguments:
555 Arguments:
553
556
554 - argv: list of arguments, typically sys.argv.
557 - argv: list of arguments, typically sys.argv.
555
558
556 - names: list of option names. See DPyGetOpt docs for details on options
559 - names: list of option names. See DPyGetOpt docs for details on options
557 syntax.
560 syntax.
558
561
559 - defaults: dict of default values.
562 - defaults: dict of default values.
560
563
561 - usage: optional usage notice to print if a wrong argument is passed.
564 - usage: optional usage notice to print if a wrong argument is passed.
562
565
563 Return a dict of options and a list of free arguments."""
566 Return a dict of options and a list of free arguments."""
564
567
565 getopt = DPyGetOpt.DPyGetOpt()
568 getopt = DPyGetOpt.DPyGetOpt()
566 getopt.setIgnoreCase(0)
569 getopt.setIgnoreCase(0)
567 getopt.parseConfiguration(names)
570 getopt.parseConfiguration(names)
568
571
569 try:
572 try:
570 getopt.processArguments(argv)
573 getopt.processArguments(argv)
571 except:
574 except:
572 print usage
575 print usage
573 warn(`sys.exc_value`,level=4)
576 warn(`sys.exc_value`,level=4)
574
577
575 defaults.update(getopt.optionValues)
578 defaults.update(getopt.optionValues)
576 args = getopt.freeValues
579 args = getopt.freeValues
577
580
578 return defaults,args
581 return defaults,args
579
582
580 #----------------------------------------------------------------------------
583 #----------------------------------------------------------------------------
581 def optstr2types(ostr):
584 def optstr2types(ostr):
582 """Convert a string of option names to a dict of type mappings.
585 """Convert a string of option names to a dict of type mappings.
583
586
584 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
587 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
585
588
586 This is used to get the types of all the options in a string formatted
589 This is used to get the types of all the options in a string formatted
587 with the conventions of DPyGetOpt. The 'type' None is used for options
590 with the conventions of DPyGetOpt. The 'type' None is used for options
588 which are strings (they need no further conversion). This function's main
591 which are strings (they need no further conversion). This function's main
589 use is to get a typemap for use with read_dict().
592 use is to get a typemap for use with read_dict().
590 """
593 """
591
594
592 typeconv = {None:'',int:'',float:''}
595 typeconv = {None:'',int:'',float:''}
593 typemap = {'s':None,'i':int,'f':float}
596 typemap = {'s':None,'i':int,'f':float}
594 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
597 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
595
598
596 for w in ostr.split():
599 for w in ostr.split():
597 oname,alias,otype = opt_re.match(w).groups()
600 oname,alias,otype = opt_re.match(w).groups()
598 if otype == '' or alias == '!': # simple switches are integers too
601 if otype == '' or alias == '!': # simple switches are integers too
599 otype = 'i'
602 otype = 'i'
600 typeconv[typemap[otype]] += oname + ' '
603 typeconv[typemap[otype]] += oname + ' '
601 return typeconv
604 return typeconv
602
605
603 #----------------------------------------------------------------------------
606 #----------------------------------------------------------------------------
604 def read_dict(filename,type_conv=None,**opt):
607 def read_dict(filename,type_conv=None,**opt):
605
608
606 """Read a dictionary of key=value pairs from an input file, optionally
609 """Read a dictionary of key=value pairs from an input file, optionally
607 performing conversions on the resulting values.
610 performing conversions on the resulting values.
608
611
609 read_dict(filename,type_conv,**opt) -> dict
612 read_dict(filename,type_conv,**opt) -> dict
610
613
611 Only one value per line is accepted, the format should be
614 Only one value per line is accepted, the format should be
612 # optional comments are ignored
615 # optional comments are ignored
613 key value\n
616 key value\n
614
617
615 Args:
618 Args:
616
619
617 - type_conv: A dictionary specifying which keys need to be converted to
620 - type_conv: A dictionary specifying which keys need to be converted to
618 which types. By default all keys are read as strings. This dictionary
621 which types. By default all keys are read as strings. This dictionary
619 should have as its keys valid conversion functions for strings
622 should have as its keys valid conversion functions for strings
620 (int,long,float,complex, or your own). The value for each key
623 (int,long,float,complex, or your own). The value for each key
621 (converter) should be a whitespace separated string containing the names
624 (converter) should be a whitespace separated string containing the names
622 of all the entries in the file to be converted using that function. For
625 of all the entries in the file to be converted using that function. For
623 keys to be left alone, use None as the conversion function (only needed
626 keys to be left alone, use None as the conversion function (only needed
624 with purge=1, see below).
627 with purge=1, see below).
625
628
626 - opt: dictionary with extra options as below (default in parens)
629 - opt: dictionary with extra options as below (default in parens)
627
630
628 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
631 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
629 of the dictionary to be returned. If purge is going to be used, the
632 of the dictionary to be returned. If purge is going to be used, the
630 set of keys to be left as strings also has to be explicitly specified
633 set of keys to be left as strings also has to be explicitly specified
631 using the (non-existent) conversion function None.
634 using the (non-existent) conversion function None.
632
635
633 fs(None): field separator. This is the key/value separator to be used
636 fs(None): field separator. This is the key/value separator to be used
634 when parsing the file. The None default means any whitespace [behavior
637 when parsing the file. The None default means any whitespace [behavior
635 of string.split()].
638 of string.split()].
636
639
637 strip(0): if 1, strip string values of leading/trailinig whitespace.
640 strip(0): if 1, strip string values of leading/trailinig whitespace.
638
641
639 warn(1): warning level if requested keys are not found in file.
642 warn(1): warning level if requested keys are not found in file.
640 - 0: silently ignore.
643 - 0: silently ignore.
641 - 1: inform but proceed.
644 - 1: inform but proceed.
642 - 2: raise KeyError exception.
645 - 2: raise KeyError exception.
643
646
644 no_empty(0): if 1, remove keys with whitespace strings as a value.
647 no_empty(0): if 1, remove keys with whitespace strings as a value.
645
648
646 unique([]): list of keys (or space separated string) which can't be
649 unique([]): list of keys (or space separated string) which can't be
647 repeated. If one such key is found in the file, each new instance
650 repeated. If one such key is found in the file, each new instance
648 overwrites the previous one. For keys not listed here, the behavior is
651 overwrites the previous one. For keys not listed here, the behavior is
649 to make a list of all appearances.
652 to make a list of all appearances.
650
653
651 Example:
654 Example:
652 If the input file test.ini has:
655 If the input file test.ini has:
653 i 3
656 i 3
654 x 4.5
657 x 4.5
655 y 5.5
658 y 5.5
656 s hi ho
659 s hi ho
657 Then:
660 Then:
658
661
659 >>> type_conv={int:'i',float:'x',None:'s'}
662 >>> type_conv={int:'i',float:'x',None:'s'}
660 >>> read_dict('test.ini')
663 >>> read_dict('test.ini')
661 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
664 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
662 >>> read_dict('test.ini',type_conv)
665 >>> read_dict('test.ini',type_conv)
663 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
666 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
664 >>> read_dict('test.ini',type_conv,purge=1)
667 >>> read_dict('test.ini',type_conv,purge=1)
665 {'i': 3, 's': 'hi ho', 'x': 4.5}
668 {'i': 3, 's': 'hi ho', 'x': 4.5}
666 """
669 """
667
670
668 # starting config
671 # starting config
669 opt.setdefault('purge',0)
672 opt.setdefault('purge',0)
670 opt.setdefault('fs',None) # field sep defaults to any whitespace
673 opt.setdefault('fs',None) # field sep defaults to any whitespace
671 opt.setdefault('strip',0)
674 opt.setdefault('strip',0)
672 opt.setdefault('warn',1)
675 opt.setdefault('warn',1)
673 opt.setdefault('no_empty',0)
676 opt.setdefault('no_empty',0)
674 opt.setdefault('unique','')
677 opt.setdefault('unique','')
675 if type(opt['unique']) in StringTypes:
678 if type(opt['unique']) in StringTypes:
676 unique_keys = qw(opt['unique'])
679 unique_keys = qw(opt['unique'])
677 elif type(opt['unique']) in (types.TupleType,types.ListType):
680 elif type(opt['unique']) in (types.TupleType,types.ListType):
678 unique_keys = opt['unique']
681 unique_keys = opt['unique']
679 else:
682 else:
680 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
683 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
681
684
682 dict = {}
685 dict = {}
683 # first read in table of values as strings
686 # first read in table of values as strings
684 file = open(filename,'r')
687 file = open(filename,'r')
685 for line in file.readlines():
688 for line in file.readlines():
686 line = line.strip()
689 line = line.strip()
687 if len(line) and line[0]=='#': continue
690 if len(line) and line[0]=='#': continue
688 if len(line)>0:
691 if len(line)>0:
689 lsplit = line.split(opt['fs'],1)
692 lsplit = line.split(opt['fs'],1)
690 try:
693 try:
691 key,val = lsplit
694 key,val = lsplit
692 except ValueError:
695 except ValueError:
693 key,val = lsplit[0],''
696 key,val = lsplit[0],''
694 key = key.strip()
697 key = key.strip()
695 if opt['strip']: val = val.strip()
698 if opt['strip']: val = val.strip()
696 if val == "''" or val == '""': val = ''
699 if val == "''" or val == '""': val = ''
697 if opt['no_empty'] and (val=='' or val.isspace()):
700 if opt['no_empty'] and (val=='' or val.isspace()):
698 continue
701 continue
699 # if a key is found more than once in the file, build a list
702 # if a key is found more than once in the file, build a list
700 # unless it's in the 'unique' list. In that case, last found in file
703 # unless it's in the 'unique' list. In that case, last found in file
701 # takes precedence. User beware.
704 # takes precedence. User beware.
702 try:
705 try:
703 if dict[key] and key in unique_keys:
706 if dict[key] and key in unique_keys:
704 dict[key] = val
707 dict[key] = val
705 elif type(dict[key]) is types.ListType:
708 elif type(dict[key]) is types.ListType:
706 dict[key].append(val)
709 dict[key].append(val)
707 else:
710 else:
708 dict[key] = [dict[key],val]
711 dict[key] = [dict[key],val]
709 except KeyError:
712 except KeyError:
710 dict[key] = val
713 dict[key] = val
711 # purge if requested
714 # purge if requested
712 if opt['purge']:
715 if opt['purge']:
713 accepted_keys = qwflat(type_conv.values())
716 accepted_keys = qwflat(type_conv.values())
714 for key in dict.keys():
717 for key in dict.keys():
715 if key in accepted_keys: continue
718 if key in accepted_keys: continue
716 del(dict[key])
719 del(dict[key])
717 # now convert if requested
720 # now convert if requested
718 if type_conv==None: return dict
721 if type_conv==None: return dict
719 conversions = type_conv.keys()
722 conversions = type_conv.keys()
720 try: conversions.remove(None)
723 try: conversions.remove(None)
721 except: pass
724 except: pass
722 for convert in conversions:
725 for convert in conversions:
723 for val in qw(type_conv[convert]):
726 for val in qw(type_conv[convert]):
724 try:
727 try:
725 dict[val] = convert(dict[val])
728 dict[val] = convert(dict[val])
726 except KeyError,e:
729 except KeyError,e:
727 if opt['warn'] == 0:
730 if opt['warn'] == 0:
728 pass
731 pass
729 elif opt['warn'] == 1:
732 elif opt['warn'] == 1:
730 print >>sys.stderr, 'Warning: key',val,\
733 print >>sys.stderr, 'Warning: key',val,\
731 'not found in file',filename
734 'not found in file',filename
732 elif opt['warn'] == 2:
735 elif opt['warn'] == 2:
733 raise KeyError,e
736 raise KeyError,e
734 else:
737 else:
735 raise ValueError,'Warning level must be 0,1 or 2'
738 raise ValueError,'Warning level must be 0,1 or 2'
736
739
737 return dict
740 return dict
738
741
739 #----------------------------------------------------------------------------
742 #----------------------------------------------------------------------------
740 def flag_calls(func):
743 def flag_calls(func):
741 """Wrap a function to detect and flag when it gets called.
744 """Wrap a function to detect and flag when it gets called.
742
745
743 This is a decorator which takes a function and wraps it in a function with
746 This is a decorator which takes a function and wraps it in a function with
744 a 'called' attribute. wrapper.called is initialized to False.
747 a 'called' attribute. wrapper.called is initialized to False.
745
748
746 The wrapper.called attribute is set to False right before each call to the
749 The wrapper.called attribute is set to False right before each call to the
747 wrapped function, so if the call fails it remains False. After the call
750 wrapped function, so if the call fails it remains False. After the call
748 completes, wrapper.called is set to True and the output is returned.
751 completes, wrapper.called is set to True and the output is returned.
749
752
750 Testing for truth in wrapper.called allows you to determine if a call to
753 Testing for truth in wrapper.called allows you to determine if a call to
751 func() was attempted and succeeded."""
754 func() was attempted and succeeded."""
752
755
753 def wrapper(*args,**kw):
756 def wrapper(*args,**kw):
754 wrapper.called = False
757 wrapper.called = False
755 out = func(*args,**kw)
758 out = func(*args,**kw)
756 wrapper.called = True
759 wrapper.called = True
757 return out
760 return out
758
761
759 wrapper.called = False
762 wrapper.called = False
760 wrapper.__doc__ = func.__doc__
763 wrapper.__doc__ = func.__doc__
761 return wrapper
764 return wrapper
762
765
763 #----------------------------------------------------------------------------
766 #----------------------------------------------------------------------------
764 class HomeDirError(Error):
767 class HomeDirError(Error):
765 pass
768 pass
766
769
767 def get_home_dir():
770 def get_home_dir():
768 """Return the closest possible equivalent to a 'home' directory.
771 """Return the closest possible equivalent to a 'home' directory.
769
772
770 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
773 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
771
774
772 Currently only Posix and NT are implemented, a HomeDirError exception is
775 Currently only Posix and NT are implemented, a HomeDirError exception is
773 raised for all other OSes. """
776 raised for all other OSes. """
774
777
775 isdir = os.path.isdir
778 isdir = os.path.isdir
776 env = os.environ
779 env = os.environ
777 try:
780 try:
778 homedir = env['HOME']
781 homedir = env['HOME']
779 if not isdir(homedir):
782 if not isdir(homedir):
780 # in case a user stuck some string which does NOT resolve to a
783 # in case a user stuck some string which does NOT resolve to a
781 # valid path, it's as good as if we hadn't foud it
784 # valid path, it's as good as if we hadn't foud it
782 raise KeyError
785 raise KeyError
783 return homedir
786 return homedir
784 except KeyError:
787 except KeyError:
785 if os.name == 'posix':
788 if os.name == 'posix':
786 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
789 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
787 elif os.name == 'nt':
790 elif os.name == 'nt':
788 # For some strange reason, win9x returns 'nt' for os.name.
791 # For some strange reason, win9x returns 'nt' for os.name.
789 try:
792 try:
790 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
793 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
791 if not isdir(homedir):
794 if not isdir(homedir):
792 homedir = os.path.join(env['USERPROFILE'])
795 homedir = os.path.join(env['USERPROFILE'])
793 if not isdir(homedir):
796 if not isdir(homedir):
794 raise HomeDirError
797 raise HomeDirError
795 return homedir
798 return homedir
796 except:
799 except:
797 try:
800 try:
798 # Use the registry to get the 'My Documents' folder.
801 # Use the registry to get the 'My Documents' folder.
799 import _winreg as wreg
802 import _winreg as wreg
800 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
803 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
801 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
804 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
802 homedir = wreg.QueryValueEx(key,'Personal')[0]
805 homedir = wreg.QueryValueEx(key,'Personal')[0]
803 key.Close()
806 key.Close()
804 if not isdir(homedir):
807 if not isdir(homedir):
805 e = ('Invalid "Personal" folder registry key '
808 e = ('Invalid "Personal" folder registry key '
806 'typically "My Documents".\n'
809 'typically "My Documents".\n'
807 'Value: %s\n'
810 'Value: %s\n'
808 'This is not a valid directory on your system.' %
811 'This is not a valid directory on your system.' %
809 homedir)
812 homedir)
810 raise HomeDirError(e)
813 raise HomeDirError(e)
811 return homedir
814 return homedir
812 except HomeDirError:
815 except HomeDirError:
813 raise
816 raise
814 except:
817 except:
815 return 'C:\\'
818 return 'C:\\'
816 elif os.name == 'dos':
819 elif os.name == 'dos':
817 # Desperate, may do absurd things in classic MacOS. May work under DOS.
820 # Desperate, may do absurd things in classic MacOS. May work under DOS.
818 return 'C:\\'
821 return 'C:\\'
819 else:
822 else:
820 raise HomeDirError,'support for your operating system not implemented.'
823 raise HomeDirError,'support for your operating system not implemented.'
821
824
822 #****************************************************************************
825 #****************************************************************************
823 # strings and text
826 # strings and text
824
827
825 class LSString(str):
828 class LSString(str):
826 """String derivative with a special access attributes.
829 """String derivative with a special access attributes.
827
830
828 These are normal strings, but with the special attributes:
831 These are normal strings, but with the special attributes:
829
832
830 .l (or .list) : value as list (split on newlines).
833 .l (or .list) : value as list (split on newlines).
831 .n (or .nlstr): original value (the string itself).
834 .n (or .nlstr): original value (the string itself).
832 .s (or .spstr): value as whitespace-separated string.
835 .s (or .spstr): value as whitespace-separated string.
833
836
834 Any values which require transformations are computed only once and
837 Any values which require transformations are computed only once and
835 cached.
838 cached.
836
839
837 Such strings are very useful to efficiently interact with the shell, which
840 Such strings are very useful to efficiently interact with the shell, which
838 typically only understands whitespace-separated options for commands."""
841 typically only understands whitespace-separated options for commands."""
839
842
840 def get_list(self):
843 def get_list(self):
841 try:
844 try:
842 return self.__list
845 return self.__list
843 except AttributeError:
846 except AttributeError:
844 self.__list = self.split('\n')
847 self.__list = self.split('\n')
845 return self.__list
848 return self.__list
846
849
847 l = list = property(get_list)
850 l = list = property(get_list)
848
851
849 def get_spstr(self):
852 def get_spstr(self):
850 try:
853 try:
851 return self.__spstr
854 return self.__spstr
852 except AttributeError:
855 except AttributeError:
853 self.__spstr = self.replace('\n',' ')
856 self.__spstr = self.replace('\n',' ')
854 return self.__spstr
857 return self.__spstr
855
858
856 s = spstr = property(get_spstr)
859 s = spstr = property(get_spstr)
857
860
858 def get_nlstr(self):
861 def get_nlstr(self):
859 return self
862 return self
860
863
861 n = nlstr = property(get_nlstr)
864 n = nlstr = property(get_nlstr)
862
865
863 #----------------------------------------------------------------------------
866 #----------------------------------------------------------------------------
864 class SList(list):
867 class SList(list):
865 """List derivative with a special access attributes.
868 """List derivative with a special access attributes.
866
869
867 These are normal lists, but with the special attributes:
870 These are normal lists, but with the special attributes:
868
871
869 .l (or .list) : value as list (the list itself).
872 .l (or .list) : value as list (the list itself).
870 .n (or .nlstr): value as a string, joined on newlines.
873 .n (or .nlstr): value as a string, joined on newlines.
871 .s (or .spstr): value as a string, joined on spaces.
874 .s (or .spstr): value as a string, joined on spaces.
872
875
873 Any values which require transformations are computed only once and
876 Any values which require transformations are computed only once and
874 cached."""
877 cached."""
875
878
876 def get_list(self):
879 def get_list(self):
877 return self
880 return self
878
881
879 l = list = property(get_list)
882 l = list = property(get_list)
880
883
881 def get_spstr(self):
884 def get_spstr(self):
882 try:
885 try:
883 return self.__spstr
886 return self.__spstr
884 except AttributeError:
887 except AttributeError:
885 self.__spstr = ' '.join(self)
888 self.__spstr = ' '.join(self)
886 return self.__spstr
889 return self.__spstr
887
890
888 s = spstr = property(get_spstr)
891 s = spstr = property(get_spstr)
889
892
890 def get_nlstr(self):
893 def get_nlstr(self):
891 try:
894 try:
892 return self.__nlstr
895 return self.__nlstr
893 except AttributeError:
896 except AttributeError:
894 self.__nlstr = '\n'.join(self)
897 self.__nlstr = '\n'.join(self)
895 return self.__nlstr
898 return self.__nlstr
896
899
897 n = nlstr = property(get_nlstr)
900 n = nlstr = property(get_nlstr)
898
901
899 #----------------------------------------------------------------------------
902 #----------------------------------------------------------------------------
900 # This can be replaced with an isspace() call once we drop 2.2 compatibility
903 # This can be replaced with an isspace() call once we drop 2.2 compatibility
901 _isspace_match = re.compile(r'^\s+$').match
904 _isspace_match = re.compile(r'^\s+$').match
902 def isspace(s):
905 def isspace(s):
903 return bool(_isspace_match(s))
906 return bool(_isspace_match(s))
904
907
905 #----------------------------------------------------------------------------
908 #----------------------------------------------------------------------------
906 def esc_quotes(strng):
909 def esc_quotes(strng):
907 """Return the input string with single and double quotes escaped out"""
910 """Return the input string with single and double quotes escaped out"""
908
911
909 return strng.replace('"','\\"').replace("'","\\'")
912 return strng.replace('"','\\"').replace("'","\\'")
910
913
911 #----------------------------------------------------------------------------
914 #----------------------------------------------------------------------------
912 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
915 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
913 """Take multiple lines of input.
916 """Take multiple lines of input.
914
917
915 A list with each line of input as a separate element is returned when a
918 A list with each line of input as a separate element is returned when a
916 termination string is entered (defaults to a single '.'). Input can also
919 termination string is entered (defaults to a single '.'). Input can also
917 terminate via EOF (^D in Unix, ^Z-RET in Windows).
920 terminate via EOF (^D in Unix, ^Z-RET in Windows).
918
921
919 Lines of input which end in \\ are joined into single entries (and a
922 Lines of input which end in \\ are joined into single entries (and a
920 secondary continuation prompt is issued as long as the user terminates
923 secondary continuation prompt is issued as long as the user terminates
921 lines with \\). This allows entering very long strings which are still
924 lines with \\). This allows entering very long strings which are still
922 meant to be treated as single entities.
925 meant to be treated as single entities.
923 """
926 """
924
927
925 try:
928 try:
926 if header:
929 if header:
927 header += '\n'
930 header += '\n'
928 lines = [raw_input(header + ps1)]
931 lines = [raw_input(header + ps1)]
929 except EOFError:
932 except EOFError:
930 return []
933 return []
931 terminate = [terminate_str]
934 terminate = [terminate_str]
932 try:
935 try:
933 while lines[-1:] != terminate:
936 while lines[-1:] != terminate:
934 new_line = raw_input(ps1)
937 new_line = raw_input(ps1)
935 while new_line.endswith('\\'):
938 while new_line.endswith('\\'):
936 new_line = new_line[:-1] + raw_input(ps2)
939 new_line = new_line[:-1] + raw_input(ps2)
937 lines.append(new_line)
940 lines.append(new_line)
938
941
939 return lines[:-1] # don't return the termination command
942 return lines[:-1] # don't return the termination command
940 except EOFError:
943 except EOFError:
941 print
944 print
942 return lines
945 return lines
943
946
944 #----------------------------------------------------------------------------
947 #----------------------------------------------------------------------------
945 def raw_input_ext(prompt='', ps2='... '):
948 def raw_input_ext(prompt='', ps2='... '):
946 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
949 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
947
950
948 line = raw_input(prompt)
951 line = raw_input(prompt)
949 while line.endswith('\\'):
952 while line.endswith('\\'):
950 line = line[:-1] + raw_input(ps2)
953 line = line[:-1] + raw_input(ps2)
951 return line
954 return line
952
955
953 #----------------------------------------------------------------------------
956 #----------------------------------------------------------------------------
954 def ask_yes_no(prompt,default=None):
957 def ask_yes_no(prompt,default=None):
955 """Asks a question and returns an integer 1/0 (y/n) answer.
958 """Asks a question and returns an integer 1/0 (y/n) answer.
956
959
957 If default is given (one of 'y','n'), it is used if the user input is
960 If default is given (one of 'y','n'), it is used if the user input is
958 empty. Otherwise the question is repeated until an answer is given.
961 empty. Otherwise the question is repeated until an answer is given.
959 If EOF occurs 20 times consecutively, the default answer is assumed,
962 If EOF occurs 20 times consecutively, the default answer is assumed,
960 or if there is no default, an exception is raised to prevent infinite
963 or if there is no default, an exception is raised to prevent infinite
961 loops.
964 loops.
962
965
963 Valid answers are: y/yes/n/no (match is not case sensitive)."""
966 Valid answers are: y/yes/n/no (match is not case sensitive)."""
964
967
965 answers = {'y':True,'n':False,'yes':True,'no':False}
968 answers = {'y':True,'n':False,'yes':True,'no':False}
966 ans = None
969 ans = None
967 eofs, max_eofs = 0, 20
970 eofs, max_eofs = 0, 20
968 while ans not in answers.keys():
971 while ans not in answers.keys():
969 try:
972 try:
970 ans = raw_input(prompt+' ').lower()
973 ans = raw_input(prompt+' ').lower()
971 if not ans: # response was an empty string
974 if not ans: # response was an empty string
972 ans = default
975 ans = default
973 eofs = 0
976 eofs = 0
974 except (EOFError,KeyboardInterrupt):
977 except (EOFError,KeyboardInterrupt):
975 eofs = eofs + 1
978 eofs = eofs + 1
976 if eofs >= max_eofs:
979 if eofs >= max_eofs:
977 if default in answers.keys():
980 if default in answers.keys():
978 ans = default
981 ans = default
979 else:
982 else:
980 raise
983 raise
981
984
982 return answers[ans]
985 return answers[ans]
983
986
984 #----------------------------------------------------------------------------
987 #----------------------------------------------------------------------------
985 def marquee(txt='',width=78,mark='*'):
988 def marquee(txt='',width=78,mark='*'):
986 """Return the input string centered in a 'marquee'."""
989 """Return the input string centered in a 'marquee'."""
987 if not txt:
990 if not txt:
988 return (mark*width)[:width]
991 return (mark*width)[:width]
989 nmark = (width-len(txt)-2)/len(mark)/2
992 nmark = (width-len(txt)-2)/len(mark)/2
990 if nmark < 0: nmark =0
993 if nmark < 0: nmark =0
991 marks = mark*nmark
994 marks = mark*nmark
992 return '%s %s %s' % (marks,txt,marks)
995 return '%s %s %s' % (marks,txt,marks)
993
996
994 #----------------------------------------------------------------------------
997 #----------------------------------------------------------------------------
995 class EvalDict:
998 class EvalDict:
996 """
999 """
997 Emulate a dict which evaluates its contents in the caller's frame.
1000 Emulate a dict which evaluates its contents in the caller's frame.
998
1001
999 Usage:
1002 Usage:
1000 >>>number = 19
1003 >>>number = 19
1001 >>>text = "python"
1004 >>>text = "python"
1002 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1005 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1003 """
1006 """
1004
1007
1005 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
1008 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
1006 # modified (shorter) version of:
1009 # modified (shorter) version of:
1007 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
1010 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
1008 # Skip Montanaro (skip@pobox.com).
1011 # Skip Montanaro (skip@pobox.com).
1009
1012
1010 def __getitem__(self, name):
1013 def __getitem__(self, name):
1011 frame = sys._getframe(1)
1014 frame = sys._getframe(1)
1012 return eval(name, frame.f_globals, frame.f_locals)
1015 return eval(name, frame.f_globals, frame.f_locals)
1013
1016
1014 EvalString = EvalDict # for backwards compatibility
1017 EvalString = EvalDict # for backwards compatibility
1015 #----------------------------------------------------------------------------
1018 #----------------------------------------------------------------------------
1016 def qw(words,flat=0,sep=None,maxsplit=-1):
1019 def qw(words,flat=0,sep=None,maxsplit=-1):
1017 """Similar to Perl's qw() operator, but with some more options.
1020 """Similar to Perl's qw() operator, but with some more options.
1018
1021
1019 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1022 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1020
1023
1021 words can also be a list itself, and with flat=1, the output will be
1024 words can also be a list itself, and with flat=1, the output will be
1022 recursively flattened. Examples:
1025 recursively flattened. Examples:
1023
1026
1024 >>> qw('1 2')
1027 >>> qw('1 2')
1025 ['1', '2']
1028 ['1', '2']
1026 >>> qw(['a b','1 2',['m n','p q']])
1029 >>> qw(['a b','1 2',['m n','p q']])
1027 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1030 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1028 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1031 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1029 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
1032 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
1030
1033
1031 if type(words) in StringTypes:
1034 if type(words) in StringTypes:
1032 return [word.strip() for word in words.split(sep,maxsplit)
1035 return [word.strip() for word in words.split(sep,maxsplit)
1033 if word and not word.isspace() ]
1036 if word and not word.isspace() ]
1034 if flat:
1037 if flat:
1035 return flatten(map(qw,words,[1]*len(words)))
1038 return flatten(map(qw,words,[1]*len(words)))
1036 return map(qw,words)
1039 return map(qw,words)
1037
1040
1038 #----------------------------------------------------------------------------
1041 #----------------------------------------------------------------------------
1039 def qwflat(words,sep=None,maxsplit=-1):
1042 def qwflat(words,sep=None,maxsplit=-1):
1040 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
1043 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
1041 return qw(words,1,sep,maxsplit)
1044 return qw(words,1,sep,maxsplit)
1042
1045
1043 #----------------------------------------------------------------------------
1046 #----------------------------------------------------------------------------
1044 def qw_lol(indata):
1047 def qw_lol(indata):
1045 """qw_lol('a b') -> [['a','b']],
1048 """qw_lol('a b') -> [['a','b']],
1046 otherwise it's just a call to qw().
1049 otherwise it's just a call to qw().
1047
1050
1048 We need this to make sure the modules_some keys *always* end up as a
1051 We need this to make sure the modules_some keys *always* end up as a
1049 list of lists."""
1052 list of lists."""
1050
1053
1051 if type(indata) in StringTypes:
1054 if type(indata) in StringTypes:
1052 return [qw(indata)]
1055 return [qw(indata)]
1053 else:
1056 else:
1054 return qw(indata)
1057 return qw(indata)
1055
1058
1056 #-----------------------------------------------------------------------------
1059 #-----------------------------------------------------------------------------
1057 def list_strings(arg):
1060 def list_strings(arg):
1058 """Always return a list of strings, given a string or list of strings
1061 """Always return a list of strings, given a string or list of strings
1059 as input."""
1062 as input."""
1060
1063
1061 if type(arg) in StringTypes: return [arg]
1064 if type(arg) in StringTypes: return [arg]
1062 else: return arg
1065 else: return arg
1063
1066
1064 #----------------------------------------------------------------------------
1067 #----------------------------------------------------------------------------
1065 def grep(pat,list,case=1):
1068 def grep(pat,list,case=1):
1066 """Simple minded grep-like function.
1069 """Simple minded grep-like function.
1067 grep(pat,list) returns occurrences of pat in list, None on failure.
1070 grep(pat,list) returns occurrences of pat in list, None on failure.
1068
1071
1069 It only does simple string matching, with no support for regexps. Use the
1072 It only does simple string matching, with no support for regexps. Use the
1070 option case=0 for case-insensitive matching."""
1073 option case=0 for case-insensitive matching."""
1071
1074
1072 # This is pretty crude. At least it should implement copying only references
1075 # This is pretty crude. At least it should implement copying only references
1073 # to the original data in case it's big. Now it copies the data for output.
1076 # to the original data in case it's big. Now it copies the data for output.
1074 out=[]
1077 out=[]
1075 if case:
1078 if case:
1076 for term in list:
1079 for term in list:
1077 if term.find(pat)>-1: out.append(term)
1080 if term.find(pat)>-1: out.append(term)
1078 else:
1081 else:
1079 lpat=pat.lower()
1082 lpat=pat.lower()
1080 for term in list:
1083 for term in list:
1081 if term.lower().find(lpat)>-1: out.append(term)
1084 if term.lower().find(lpat)>-1: out.append(term)
1082
1085
1083 if len(out): return out
1086 if len(out): return out
1084 else: return None
1087 else: return None
1085
1088
1086 #----------------------------------------------------------------------------
1089 #----------------------------------------------------------------------------
1087 def dgrep(pat,*opts):
1090 def dgrep(pat,*opts):
1088 """Return grep() on dir()+dir(__builtins__).
1091 """Return grep() on dir()+dir(__builtins__).
1089
1092
1090 A very common use of grep() when working interactively."""
1093 A very common use of grep() when working interactively."""
1091
1094
1092 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
1095 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
1093
1096
1094 #----------------------------------------------------------------------------
1097 #----------------------------------------------------------------------------
1095 def idgrep(pat):
1098 def idgrep(pat):
1096 """Case-insensitive dgrep()"""
1099 """Case-insensitive dgrep()"""
1097
1100
1098 return dgrep(pat,0)
1101 return dgrep(pat,0)
1099
1102
1100 #----------------------------------------------------------------------------
1103 #----------------------------------------------------------------------------
1101 def igrep(pat,list):
1104 def igrep(pat,list):
1102 """Synonym for case-insensitive grep."""
1105 """Synonym for case-insensitive grep."""
1103
1106
1104 return grep(pat,list,case=0)
1107 return grep(pat,list,case=0)
1105
1108
1106 #----------------------------------------------------------------------------
1109 #----------------------------------------------------------------------------
1107 def indent(str,nspaces=4,ntabs=0):
1110 def indent(str,nspaces=4,ntabs=0):
1108 """Indent a string a given number of spaces or tabstops.
1111 """Indent a string a given number of spaces or tabstops.
1109
1112
1110 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
1113 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
1111 """
1114 """
1112 if str is None:
1115 if str is None:
1113 return
1116 return
1114 ind = '\t'*ntabs+' '*nspaces
1117 ind = '\t'*ntabs+' '*nspaces
1115 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
1118 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
1116 if outstr.endswith(os.linesep+ind):
1119 if outstr.endswith(os.linesep+ind):
1117 return outstr[:-len(ind)]
1120 return outstr[:-len(ind)]
1118 else:
1121 else:
1119 return outstr
1122 return outstr
1120
1123
1121 #-----------------------------------------------------------------------------
1124 #-----------------------------------------------------------------------------
1122 def native_line_ends(filename,backup=1):
1125 def native_line_ends(filename,backup=1):
1123 """Convert (in-place) a file to line-ends native to the current OS.
1126 """Convert (in-place) a file to line-ends native to the current OS.
1124
1127
1125 If the optional backup argument is given as false, no backup of the
1128 If the optional backup argument is given as false, no backup of the
1126 original file is left. """
1129 original file is left. """
1127
1130
1128 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1131 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1129
1132
1130 bak_filename = filename + backup_suffixes[os.name]
1133 bak_filename = filename + backup_suffixes[os.name]
1131
1134
1132 original = open(filename).read()
1135 original = open(filename).read()
1133 shutil.copy2(filename,bak_filename)
1136 shutil.copy2(filename,bak_filename)
1134 try:
1137 try:
1135 new = open(filename,'wb')
1138 new = open(filename,'wb')
1136 new.write(os.linesep.join(original.splitlines()))
1139 new.write(os.linesep.join(original.splitlines()))
1137 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1140 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1138 new.close()
1141 new.close()
1139 except:
1142 except:
1140 os.rename(bak_filename,filename)
1143 os.rename(bak_filename,filename)
1141 if not backup:
1144 if not backup:
1142 try:
1145 try:
1143 os.remove(bak_filename)
1146 os.remove(bak_filename)
1144 except:
1147 except:
1145 pass
1148 pass
1146
1149
1147 #----------------------------------------------------------------------------
1150 #----------------------------------------------------------------------------
1148 def get_pager_cmd(pager_cmd = None):
1151 def get_pager_cmd(pager_cmd = None):
1149 """Return a pager command.
1152 """Return a pager command.
1150
1153
1151 Makes some attempts at finding an OS-correct one."""
1154 Makes some attempts at finding an OS-correct one."""
1152
1155
1153 if os.name == 'posix':
1156 if os.name == 'posix':
1154 default_pager_cmd = 'less -r' # -r for color control sequences
1157 default_pager_cmd = 'less -r' # -r for color control sequences
1155 elif os.name in ['nt','dos']:
1158 elif os.name in ['nt','dos']:
1156 default_pager_cmd = 'type'
1159 default_pager_cmd = 'type'
1157
1160
1158 if pager_cmd is None:
1161 if pager_cmd is None:
1159 try:
1162 try:
1160 pager_cmd = os.environ['PAGER']
1163 pager_cmd = os.environ['PAGER']
1161 except:
1164 except:
1162 pager_cmd = default_pager_cmd
1165 pager_cmd = default_pager_cmd
1163 return pager_cmd
1166 return pager_cmd
1164
1167
1165 #-----------------------------------------------------------------------------
1168 #-----------------------------------------------------------------------------
1166 def get_pager_start(pager,start):
1169 def get_pager_start(pager,start):
1167 """Return the string for paging files with an offset.
1170 """Return the string for paging files with an offset.
1168
1171
1169 This is the '+N' argument which less and more (under Unix) accept.
1172 This is the '+N' argument which less and more (under Unix) accept.
1170 """
1173 """
1171
1174
1172 if pager in ['less','more']:
1175 if pager in ['less','more']:
1173 if start:
1176 if start:
1174 start_string = '+' + str(start)
1177 start_string = '+' + str(start)
1175 else:
1178 else:
1176 start_string = ''
1179 start_string = ''
1177 else:
1180 else:
1178 start_string = ''
1181 start_string = ''
1179 return start_string
1182 return start_string
1180
1183
1181 #----------------------------------------------------------------------------
1184 #----------------------------------------------------------------------------
1185 if os.name == "nt":
1186 import msvcrt
1187 def page_more():
1188 """ Smart pausing between pages
1189
1190 @return: True if need print more lines, False if quit
1191 """
1192 Term.cout.write('---Return to continue, q to quit--- ')
1193 ans = msvcrt.getch()
1194 if ans in ("q", "Q"):
1195 result = False
1196 else:
1197 result = True
1198 Term.cout.write("\b"*37 + " "*37 + "\b"*37)
1199 return result
1200 else:
1201 def page_more():
1202 ans = raw_input('---Return to continue, q to quit--- ')
1203 if ans.lower().startswith('q'):
1204 return False
1205 else:
1206 return True
1207
1208 esc_re = re.compile(r"(\x1b[^m]+m)")
1209
1182 def page_dumb(strng,start=0,screen_lines=25):
1210 def page_dumb(strng,start=0,screen_lines=25):
1183 """Very dumb 'pager' in Python, for when nothing else works.
1211 """Very dumb 'pager' in Python, for when nothing else works.
1184
1212
1185 Only moves forward, same interface as page(), except for pager_cmd and
1213 Only moves forward, same interface as page(), except for pager_cmd and
1186 mode."""
1214 mode."""
1187
1215
1188 out_ln = strng.splitlines()[start:]
1216 out_ln = strng.splitlines()[start:]
1189 screens = chop(out_ln,screen_lines-1)
1217 screens = chop(out_ln,screen_lines-1)
1190 if len(screens) == 1:
1218 if len(screens) == 1:
1191 print >>Term.cout, os.linesep.join(screens[0])
1219 print >>Term.cout, os.linesep.join(screens[0])
1192 else:
1220 else:
1221 last_escape = ""
1193 for scr in screens[0:-1]:
1222 for scr in screens[0:-1]:
1194 print >>Term.cout, os.linesep.join(scr)
1223 hunk = os.linesep.join(scr)
1195 ans = raw_input('---Return to continue, q to quit--- ')
1224 print >>Term.cout, last_escape + hunk
1196 if ans.lower().startswith('q'):
1225 if not page_more():
1197 return
1226 return
1198 print >>Term.cout, os.linesep.join(screens[-1])
1227 esc_list = esc_re.findall(hunk)
1228 if len(esc_list) > 0:
1229 last_escape = esc_list[-1]
1230 print >>Term.cout, last_escape + os.linesep.join(screens[-1])
1199
1231
1200 #----------------------------------------------------------------------------
1232 #----------------------------------------------------------------------------
1201 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1233 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1202 """Print a string, piping through a pager after a certain length.
1234 """Print a string, piping through a pager after a certain length.
1203
1235
1204 The screen_lines parameter specifies the number of *usable* lines of your
1236 The screen_lines parameter specifies the number of *usable* lines of your
1205 terminal screen (total lines minus lines you need to reserve to show other
1237 terminal screen (total lines minus lines you need to reserve to show other
1206 information).
1238 information).
1207
1239
1208 If you set screen_lines to a number <=0, page() will try to auto-determine
1240 If you set screen_lines to a number <=0, page() will try to auto-determine
1209 your screen size and will only use up to (screen_size+screen_lines) for
1241 your screen size and will only use up to (screen_size+screen_lines) for
1210 printing, paging after that. That is, if you want auto-detection but need
1242 printing, paging after that. That is, if you want auto-detection but need
1211 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1243 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1212 auto-detection without any lines reserved simply use screen_lines = 0.
1244 auto-detection without any lines reserved simply use screen_lines = 0.
1213
1245
1214 If a string won't fit in the allowed lines, it is sent through the
1246 If a string won't fit in the allowed lines, it is sent through the
1215 specified pager command. If none given, look for PAGER in the environment,
1247 specified pager command. If none given, look for PAGER in the environment,
1216 and ultimately default to less.
1248 and ultimately default to less.
1217
1249
1218 If no system pager works, the string is sent through a 'dumb pager'
1250 If no system pager works, the string is sent through a 'dumb pager'
1219 written in python, very simplistic.
1251 written in python, very simplistic.
1220 """
1252 """
1221
1253
1222 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1254 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1223 TERM = os.environ.get('TERM','dumb')
1255 TERM = os.environ.get('TERM','dumb')
1224 if TERM in ['dumb','emacs'] and os.name != 'nt':
1256 if TERM in ['dumb','emacs'] and os.name != 'nt':
1225 print strng
1257 print strng
1226 return
1258 return
1227 # chop off the topmost part of the string we don't want to see
1259 # chop off the topmost part of the string we don't want to see
1228 str_lines = strng.split(os.linesep)[start:]
1260 str_lines = strng.split(os.linesep)[start:]
1229 str_toprint = os.linesep.join(str_lines)
1261 str_toprint = os.linesep.join(str_lines)
1230 num_newlines = len(str_lines)
1262 num_newlines = len(str_lines)
1231 len_str = len(str_toprint)
1263 len_str = len(str_toprint)
1232
1264
1233 # Dumb heuristics to guesstimate number of on-screen lines the string
1265 # Dumb heuristics to guesstimate number of on-screen lines the string
1234 # takes. Very basic, but good enough for docstrings in reasonable
1266 # takes. Very basic, but good enough for docstrings in reasonable
1235 # terminals. If someone later feels like refining it, it's not hard.
1267 # terminals. If someone later feels like refining it, it's not hard.
1236 numlines = max(num_newlines,int(len_str/80)+1)
1268 numlines = max(num_newlines,int(len_str/80)+1)
1237
1269
1238 screen_lines_def = 25 # default value if we can't auto-determine
1270 if os.name == "nt":
1271 screen_lines_def = get_console_size(defaulty=25)[1]
1272 else:
1273 screen_lines_def = 25 # default value if we can't auto-determine
1239
1274
1240 # auto-determine screen size
1275 # auto-determine screen size
1241 if screen_lines <= 0:
1276 if screen_lines <= 0:
1242 if TERM=='xterm':
1277 if TERM=='xterm':
1243 try:
1278 try:
1244 import curses
1279 import curses
1245 if hasattr(curses,'initscr'):
1280 if hasattr(curses,'initscr'):
1246 use_curses = 1
1281 use_curses = 1
1247 else:
1282 else:
1248 use_curses = 0
1283 use_curses = 0
1249 except ImportError:
1284 except ImportError:
1250 use_curses = 0
1285 use_curses = 0
1251 else:
1286 else:
1252 # curses causes problems on many terminals other than xterm.
1287 # curses causes problems on many terminals other than xterm.
1253 use_curses = 0
1288 use_curses = 0
1254 if use_curses:
1289 if use_curses:
1255 scr = curses.initscr()
1290 scr = curses.initscr()
1256 screen_lines_real,screen_cols = scr.getmaxyx()
1291 screen_lines_real,screen_cols = scr.getmaxyx()
1257 curses.endwin()
1292 curses.endwin()
1258 screen_lines += screen_lines_real
1293 screen_lines += screen_lines_real
1259 #print '***Screen size:',screen_lines_real,'lines x',\
1294 #print '***Screen size:',screen_lines_real,'lines x',\
1260 #screen_cols,'columns.' # dbg
1295 #screen_cols,'columns.' # dbg
1261 else:
1296 else:
1262 screen_lines += screen_lines_def
1297 screen_lines += screen_lines_def
1263
1298
1264 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1299 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1265 if numlines <= screen_lines :
1300 if numlines <= screen_lines :
1266 #print '*** normal print' # dbg
1301 #print '*** normal print' # dbg
1267 print >>Term.cout, str_toprint
1302 print >>Term.cout, str_toprint
1268 else:
1303 else:
1269 # Try to open pager and default to internal one if that fails.
1304 # Try to open pager and default to internal one if that fails.
1270 # All failure modes are tagged as 'retval=1', to match the return
1305 # All failure modes are tagged as 'retval=1', to match the return
1271 # value of a failed system command. If any intermediate attempt
1306 # value of a failed system command. If any intermediate attempt
1272 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1307 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1273 pager_cmd = get_pager_cmd(pager_cmd)
1308 pager_cmd = get_pager_cmd(pager_cmd)
1274 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1309 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1275 if os.name == 'nt':
1310 if os.name == 'nt':
1276 if pager_cmd.startswith('type'):
1311 if pager_cmd.startswith('type'):
1277 # The default WinXP 'type' command is failing on complex strings.
1312 # The default WinXP 'type' command is failing on complex strings.
1278 retval = 1
1313 retval = 1
1279 else:
1314 else:
1280 tmpname = tempfile.mktemp('.txt')
1315 tmpname = tempfile.mktemp('.txt')
1281 tmpfile = file(tmpname,'wt')
1316 tmpfile = file(tmpname,'wt')
1282 tmpfile.write(strng)
1317 tmpfile.write(strng)
1283 tmpfile.close()
1318 tmpfile.close()
1284 cmd = "%s < %s" % (pager_cmd,tmpname)
1319 cmd = "%s < %s" % (pager_cmd,tmpname)
1285 if os.system(cmd):
1320 if os.system(cmd):
1286 retval = 1
1321 retval = 1
1287 else:
1322 else:
1288 retval = None
1323 retval = None
1289 os.remove(tmpname)
1324 os.remove(tmpname)
1290 else:
1325 else:
1291 try:
1326 try:
1292 retval = None
1327 retval = None
1293 # if I use popen4, things hang. No idea why.
1328 # if I use popen4, things hang. No idea why.
1294 #pager,shell_out = os.popen4(pager_cmd)
1329 #pager,shell_out = os.popen4(pager_cmd)
1295 pager = os.popen(pager_cmd,'w')
1330 pager = os.popen(pager_cmd,'w')
1296 pager.write(strng)
1331 pager.write(strng)
1297 pager.close()
1332 pager.close()
1298 retval = pager.close() # success returns None
1333 retval = pager.close() # success returns None
1299 except IOError,msg: # broken pipe when user quits
1334 except IOError,msg: # broken pipe when user quits
1300 if msg.args == (32,'Broken pipe'):
1335 if msg.args == (32,'Broken pipe'):
1301 retval = None
1336 retval = None
1302 else:
1337 else:
1303 retval = 1
1338 retval = 1
1304 except OSError:
1339 except OSError:
1305 # Other strange problems, sometimes seen in Win2k/cygwin
1340 # Other strange problems, sometimes seen in Win2k/cygwin
1306 retval = 1
1341 retval = 1
1307 if retval is not None:
1342 if retval is not None:
1308 page_dumb(strng,screen_lines=screen_lines)
1343 page_dumb(strng,screen_lines=screen_lines)
1309
1344
1310 #----------------------------------------------------------------------------
1345 #----------------------------------------------------------------------------
1311 def page_file(fname,start = 0, pager_cmd = None):
1346 def page_file(fname,start = 0, pager_cmd = None):
1312 """Page a file, using an optional pager command and starting line.
1347 """Page a file, using an optional pager command and starting line.
1313 """
1348 """
1314
1349
1315 pager_cmd = get_pager_cmd(pager_cmd)
1350 pager_cmd = get_pager_cmd(pager_cmd)
1316 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1351 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1317
1352
1318 try:
1353 try:
1319 if os.environ['TERM'] in ['emacs','dumb']:
1354 if os.environ['TERM'] in ['emacs','dumb']:
1320 raise EnvironmentError
1355 raise EnvironmentError
1321 xsys(pager_cmd + ' ' + fname)
1356 xsys(pager_cmd + ' ' + fname)
1322 except:
1357 except:
1323 try:
1358 try:
1324 if start > 0:
1359 if start > 0:
1325 start -= 1
1360 start -= 1
1326 page(open(fname).read(),start)
1361 page(open(fname).read(),start)
1327 except:
1362 except:
1328 print 'Unable to show file',`fname`
1363 print 'Unable to show file',`fname`
1329
1364
1330 #----------------------------------------------------------------------------
1365 #----------------------------------------------------------------------------
1331 def snip_print(str,width = 75,print_full = 0,header = ''):
1366 def snip_print(str,width = 75,print_full = 0,header = ''):
1332 """Print a string snipping the midsection to fit in width.
1367 """Print a string snipping the midsection to fit in width.
1333
1368
1334 print_full: mode control:
1369 print_full: mode control:
1335 - 0: only snip long strings
1370 - 0: only snip long strings
1336 - 1: send to page() directly.
1371 - 1: send to page() directly.
1337 - 2: snip long strings and ask for full length viewing with page()
1372 - 2: snip long strings and ask for full length viewing with page()
1338 Return 1 if snipping was necessary, 0 otherwise."""
1373 Return 1 if snipping was necessary, 0 otherwise."""
1339
1374
1340 if print_full == 1:
1375 if print_full == 1:
1341 page(header+str)
1376 page(header+str)
1342 return 0
1377 return 0
1343
1378
1344 print header,
1379 print header,
1345 if len(str) < width:
1380 if len(str) < width:
1346 print str
1381 print str
1347 snip = 0
1382 snip = 0
1348 else:
1383 else:
1349 whalf = int((width -5)/2)
1384 whalf = int((width -5)/2)
1350 print str[:whalf] + ' <...> ' + str[-whalf:]
1385 print str[:whalf] + ' <...> ' + str[-whalf:]
1351 snip = 1
1386 snip = 1
1352 if snip and print_full == 2:
1387 if snip and print_full == 2:
1353 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1388 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1354 page(str)
1389 page(str)
1355 return snip
1390 return snip
1356
1391
1357 #****************************************************************************
1392 #****************************************************************************
1358 # lists, dicts and structures
1393 # lists, dicts and structures
1359
1394
1360 def belong(candidates,checklist):
1395 def belong(candidates,checklist):
1361 """Check whether a list of items appear in a given list of options.
1396 """Check whether a list of items appear in a given list of options.
1362
1397
1363 Returns a list of 1 and 0, one for each candidate given."""
1398 Returns a list of 1 and 0, one for each candidate given."""
1364
1399
1365 return [x in checklist for x in candidates]
1400 return [x in checklist for x in candidates]
1366
1401
1367 #----------------------------------------------------------------------------
1402 #----------------------------------------------------------------------------
1368 def uniq_stable(elems):
1403 def uniq_stable(elems):
1369 """uniq_stable(elems) -> list
1404 """uniq_stable(elems) -> list
1370
1405
1371 Return from an iterable, a list of all the unique elements in the input,
1406 Return from an iterable, a list of all the unique elements in the input,
1372 but maintaining the order in which they first appear.
1407 but maintaining the order in which they first appear.
1373
1408
1374 A naive solution to this problem which just makes a dictionary with the
1409 A naive solution to this problem which just makes a dictionary with the
1375 elements as keys fails to respect the stability condition, since
1410 elements as keys fails to respect the stability condition, since
1376 dictionaries are unsorted by nature.
1411 dictionaries are unsorted by nature.
1377
1412
1378 Note: All elements in the input must be valid dictionary keys for this
1413 Note: All elements in the input must be valid dictionary keys for this
1379 routine to work, as it internally uses a dictionary for efficiency
1414 routine to work, as it internally uses a dictionary for efficiency
1380 reasons."""
1415 reasons."""
1381
1416
1382 unique = []
1417 unique = []
1383 unique_dict = {}
1418 unique_dict = {}
1384 for nn in elems:
1419 for nn in elems:
1385 if nn not in unique_dict:
1420 if nn not in unique_dict:
1386 unique.append(nn)
1421 unique.append(nn)
1387 unique_dict[nn] = None
1422 unique_dict[nn] = None
1388 return unique
1423 return unique
1389
1424
1390 #----------------------------------------------------------------------------
1425 #----------------------------------------------------------------------------
1391 class NLprinter:
1426 class NLprinter:
1392 """Print an arbitrarily nested list, indicating index numbers.
1427 """Print an arbitrarily nested list, indicating index numbers.
1393
1428
1394 An instance of this class called nlprint is available and callable as a
1429 An instance of this class called nlprint is available and callable as a
1395 function.
1430 function.
1396
1431
1397 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1432 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1398 and using 'sep' to separate the index from the value. """
1433 and using 'sep' to separate the index from the value. """
1399
1434
1400 def __init__(self):
1435 def __init__(self):
1401 self.depth = 0
1436 self.depth = 0
1402
1437
1403 def __call__(self,lst,pos='',**kw):
1438 def __call__(self,lst,pos='',**kw):
1404 """Prints the nested list numbering levels."""
1439 """Prints the nested list numbering levels."""
1405 kw.setdefault('indent',' ')
1440 kw.setdefault('indent',' ')
1406 kw.setdefault('sep',': ')
1441 kw.setdefault('sep',': ')
1407 kw.setdefault('start',0)
1442 kw.setdefault('start',0)
1408 kw.setdefault('stop',len(lst))
1443 kw.setdefault('stop',len(lst))
1409 # we need to remove start and stop from kw so they don't propagate
1444 # we need to remove start and stop from kw so they don't propagate
1410 # into a recursive call for a nested list.
1445 # into a recursive call for a nested list.
1411 start = kw['start']; del kw['start']
1446 start = kw['start']; del kw['start']
1412 stop = kw['stop']; del kw['stop']
1447 stop = kw['stop']; del kw['stop']
1413 if self.depth == 0 and 'header' in kw.keys():
1448 if self.depth == 0 and 'header' in kw.keys():
1414 print kw['header']
1449 print kw['header']
1415
1450
1416 for idx in range(start,stop):
1451 for idx in range(start,stop):
1417 elem = lst[idx]
1452 elem = lst[idx]
1418 if type(elem)==type([]):
1453 if type(elem)==type([]):
1419 self.depth += 1
1454 self.depth += 1
1420 self.__call__(elem,itpl('$pos$idx,'),**kw)
1455 self.__call__(elem,itpl('$pos$idx,'),**kw)
1421 self.depth -= 1
1456 self.depth -= 1
1422 else:
1457 else:
1423 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1458 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1424
1459
1425 nlprint = NLprinter()
1460 nlprint = NLprinter()
1426 #----------------------------------------------------------------------------
1461 #----------------------------------------------------------------------------
1427 def all_belong(candidates,checklist):
1462 def all_belong(candidates,checklist):
1428 """Check whether a list of items ALL appear in a given list of options.
1463 """Check whether a list of items ALL appear in a given list of options.
1429
1464
1430 Returns a single 1 or 0 value."""
1465 Returns a single 1 or 0 value."""
1431
1466
1432 return 1-(0 in [x in checklist for x in candidates])
1467 return 1-(0 in [x in checklist for x in candidates])
1433
1468
1434 #----------------------------------------------------------------------------
1469 #----------------------------------------------------------------------------
1435 def sort_compare(lst1,lst2,inplace = 1):
1470 def sort_compare(lst1,lst2,inplace = 1):
1436 """Sort and compare two lists.
1471 """Sort and compare two lists.
1437
1472
1438 By default it does it in place, thus modifying the lists. Use inplace = 0
1473 By default it does it in place, thus modifying the lists. Use inplace = 0
1439 to avoid that (at the cost of temporary copy creation)."""
1474 to avoid that (at the cost of temporary copy creation)."""
1440 if not inplace:
1475 if not inplace:
1441 lst1 = lst1[:]
1476 lst1 = lst1[:]
1442 lst2 = lst2[:]
1477 lst2 = lst2[:]
1443 lst1.sort(); lst2.sort()
1478 lst1.sort(); lst2.sort()
1444 return lst1 == lst2
1479 return lst1 == lst2
1445
1480
1446 #----------------------------------------------------------------------------
1481 #----------------------------------------------------------------------------
1447 def mkdict(**kwargs):
1482 def mkdict(**kwargs):
1448 """Return a dict from a keyword list.
1483 """Return a dict from a keyword list.
1449
1484
1450 It's just syntactic sugar for making ditcionary creation more convenient:
1485 It's just syntactic sugar for making ditcionary creation more convenient:
1451 # the standard way
1486 # the standard way
1452 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1487 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1453 # a cleaner way
1488 # a cleaner way
1454 >>>data = dict(red=1, green=2, blue=3)
1489 >>>data = dict(red=1, green=2, blue=3)
1455
1490
1456 If you need more than this, look at the Struct() class."""
1491 If you need more than this, look at the Struct() class."""
1457
1492
1458 return kwargs
1493 return kwargs
1459
1494
1460 #----------------------------------------------------------------------------
1495 #----------------------------------------------------------------------------
1461 def list2dict(lst):
1496 def list2dict(lst):
1462 """Takes a list of (key,value) pairs and turns it into a dict."""
1497 """Takes a list of (key,value) pairs and turns it into a dict."""
1463
1498
1464 dic = {}
1499 dic = {}
1465 for k,v in lst: dic[k] = v
1500 for k,v in lst: dic[k] = v
1466 return dic
1501 return dic
1467
1502
1468 #----------------------------------------------------------------------------
1503 #----------------------------------------------------------------------------
1469 def list2dict2(lst,default=''):
1504 def list2dict2(lst,default=''):
1470 """Takes a list and turns it into a dict.
1505 """Takes a list and turns it into a dict.
1471 Much slower than list2dict, but more versatile. This version can take
1506 Much slower than list2dict, but more versatile. This version can take
1472 lists with sublists of arbitrary length (including sclars)."""
1507 lists with sublists of arbitrary length (including sclars)."""
1473
1508
1474 dic = {}
1509 dic = {}
1475 for elem in lst:
1510 for elem in lst:
1476 if type(elem) in (types.ListType,types.TupleType):
1511 if type(elem) in (types.ListType,types.TupleType):
1477 size = len(elem)
1512 size = len(elem)
1478 if size == 0:
1513 if size == 0:
1479 pass
1514 pass
1480 elif size == 1:
1515 elif size == 1:
1481 dic[elem] = default
1516 dic[elem] = default
1482 else:
1517 else:
1483 k,v = elem[0], elem[1:]
1518 k,v = elem[0], elem[1:]
1484 if len(v) == 1: v = v[0]
1519 if len(v) == 1: v = v[0]
1485 dic[k] = v
1520 dic[k] = v
1486 else:
1521 else:
1487 dic[elem] = default
1522 dic[elem] = default
1488 return dic
1523 return dic
1489
1524
1490 #----------------------------------------------------------------------------
1525 #----------------------------------------------------------------------------
1491 def flatten(seq):
1526 def flatten(seq):
1492 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1527 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1493
1528
1494 # bug in python??? (YES. Fixed in 2.2, let's leave the kludgy fix in).
1529 # bug in python??? (YES. Fixed in 2.2, let's leave the kludgy fix in).
1495
1530
1496 # if the x=0 isn't made, a *global* variable x is left over after calling
1531 # if the x=0 isn't made, a *global* variable x is left over after calling
1497 # this function, with the value of the last element in the return
1532 # this function, with the value of the last element in the return
1498 # list. This does seem like a bug big time to me.
1533 # list. This does seem like a bug big time to me.
1499
1534
1500 # the problem is fixed with the x=0, which seems to force the creation of
1535 # the problem is fixed with the x=0, which seems to force the creation of
1501 # a local name
1536 # a local name
1502
1537
1503 x = 0
1538 x = 0
1504 return [x for subseq in seq for x in subseq]
1539 return [x for subseq in seq for x in subseq]
1505
1540
1506 #----------------------------------------------------------------------------
1541 #----------------------------------------------------------------------------
1507 def get_slice(seq,start=0,stop=None,step=1):
1542 def get_slice(seq,start=0,stop=None,step=1):
1508 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1543 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1509 if stop == None:
1544 if stop == None:
1510 stop = len(seq)
1545 stop = len(seq)
1511 item = lambda i: seq[i]
1546 item = lambda i: seq[i]
1512 return map(item,xrange(start,stop,step))
1547 return map(item,xrange(start,stop,step))
1513
1548
1514 #----------------------------------------------------------------------------
1549 #----------------------------------------------------------------------------
1515 def chop(seq,size):
1550 def chop(seq,size):
1516 """Chop a sequence into chunks of the given size."""
1551 """Chop a sequence into chunks of the given size."""
1517 chunk = lambda i: seq[i:i+size]
1552 chunk = lambda i: seq[i:i+size]
1518 return map(chunk,xrange(0,len(seq),size))
1553 return map(chunk,xrange(0,len(seq),size))
1519
1554
1520 #----------------------------------------------------------------------------
1555 #----------------------------------------------------------------------------
1521 def with(object, **args):
1556 def with(object, **args):
1522 """Set multiple attributes for an object, similar to Pascal's with.
1557 """Set multiple attributes for an object, similar to Pascal's with.
1523
1558
1524 Example:
1559 Example:
1525 with(jim,
1560 with(jim,
1526 born = 1960,
1561 born = 1960,
1527 haircolour = 'Brown',
1562 haircolour = 'Brown',
1528 eyecolour = 'Green')
1563 eyecolour = 'Green')
1529
1564
1530 Credit: Greg Ewing, in
1565 Credit: Greg Ewing, in
1531 http://mail.python.org/pipermail/python-list/2001-May/040703.html"""
1566 http://mail.python.org/pipermail/python-list/2001-May/040703.html"""
1532
1567
1533 object.__dict__.update(args)
1568 object.__dict__.update(args)
1534
1569
1535 #----------------------------------------------------------------------------
1570 #----------------------------------------------------------------------------
1536 def setattr_list(obj,alist,nspace = None):
1571 def setattr_list(obj,alist,nspace = None):
1537 """Set a list of attributes for an object taken from a namespace.
1572 """Set a list of attributes for an object taken from a namespace.
1538
1573
1539 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1574 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1540 alist with their values taken from nspace, which must be a dict (something
1575 alist with their values taken from nspace, which must be a dict (something
1541 like locals() will often do) If nspace isn't given, locals() of the
1576 like locals() will often do) If nspace isn't given, locals() of the
1542 *caller* is used, so in most cases you can omit it.
1577 *caller* is used, so in most cases you can omit it.
1543
1578
1544 Note that alist can be given as a string, which will be automatically
1579 Note that alist can be given as a string, which will be automatically
1545 split into a list on whitespace. If given as a list, it must be a list of
1580 split into a list on whitespace. If given as a list, it must be a list of
1546 *strings* (the variable names themselves), not of variables."""
1581 *strings* (the variable names themselves), not of variables."""
1547
1582
1548 # this grabs the local variables from the *previous* call frame -- that is
1583 # this grabs the local variables from the *previous* call frame -- that is
1549 # the locals from the function that called setattr_list().
1584 # the locals from the function that called setattr_list().
1550 # - snipped from weave.inline()
1585 # - snipped from weave.inline()
1551 if nspace is None:
1586 if nspace is None:
1552 call_frame = sys._getframe().f_back
1587 call_frame = sys._getframe().f_back
1553 nspace = call_frame.f_locals
1588 nspace = call_frame.f_locals
1554
1589
1555 if type(alist) in StringTypes:
1590 if type(alist) in StringTypes:
1556 alist = alist.split()
1591 alist = alist.split()
1557 for attr in alist:
1592 for attr in alist:
1558 val = eval(attr,nspace)
1593 val = eval(attr,nspace)
1559 setattr(obj,attr,val)
1594 setattr(obj,attr,val)
1560
1595
1561 #----------------------------------------------------------------------------
1596 #----------------------------------------------------------------------------
1562 def getattr_list(obj,alist,*args):
1597 def getattr_list(obj,alist,*args):
1563 """getattr_list(obj,alist[, default]) -> attribute list.
1598 """getattr_list(obj,alist[, default]) -> attribute list.
1564
1599
1565 Get a list of named attributes for an object. When a default argument is
1600 Get a list of named attributes for an object. When a default argument is
1566 given, it is returned when the attribute doesn't exist; without it, an
1601 given, it is returned when the attribute doesn't exist; without it, an
1567 exception is raised in that case.
1602 exception is raised in that case.
1568
1603
1569 Note that alist can be given as a string, which will be automatically
1604 Note that alist can be given as a string, which will be automatically
1570 split into a list on whitespace. If given as a list, it must be a list of
1605 split into a list on whitespace. If given as a list, it must be a list of
1571 *strings* (the variable names themselves), not of variables."""
1606 *strings* (the variable names themselves), not of variables."""
1572
1607
1573 if type(alist) in StringTypes:
1608 if type(alist) in StringTypes:
1574 alist = alist.split()
1609 alist = alist.split()
1575 if args:
1610 if args:
1576 if len(args)==1:
1611 if len(args)==1:
1577 default = args[0]
1612 default = args[0]
1578 return map(lambda attr: getattr(obj,attr,default),alist)
1613 return map(lambda attr: getattr(obj,attr,default),alist)
1579 else:
1614 else:
1580 raise ValueError,'getattr_list() takes only one optional argument'
1615 raise ValueError,'getattr_list() takes only one optional argument'
1581 else:
1616 else:
1582 return map(lambda attr: getattr(obj,attr),alist)
1617 return map(lambda attr: getattr(obj,attr),alist)
1583
1618
1584 #----------------------------------------------------------------------------
1619 #----------------------------------------------------------------------------
1585 def map_method(method,object_list,*argseq,**kw):
1620 def map_method(method,object_list,*argseq,**kw):
1586 """map_method(method,object_list,*args,**kw) -> list
1621 """map_method(method,object_list,*args,**kw) -> list
1587
1622
1588 Return a list of the results of applying the methods to the items of the
1623 Return a list of the results of applying the methods to the items of the
1589 argument sequence(s). If more than one sequence is given, the method is
1624 argument sequence(s). If more than one sequence is given, the method is
1590 called with an argument list consisting of the corresponding item of each
1625 called with an argument list consisting of the corresponding item of each
1591 sequence. All sequences must be of the same length.
1626 sequence. All sequences must be of the same length.
1592
1627
1593 Keyword arguments are passed verbatim to all objects called.
1628 Keyword arguments are passed verbatim to all objects called.
1594
1629
1595 This is Python code, so it's not nearly as fast as the builtin map()."""
1630 This is Python code, so it's not nearly as fast as the builtin map()."""
1596
1631
1597 out_list = []
1632 out_list = []
1598 idx = 0
1633 idx = 0
1599 for object in object_list:
1634 for object in object_list:
1600 try:
1635 try:
1601 handler = getattr(object, method)
1636 handler = getattr(object, method)
1602 except AttributeError:
1637 except AttributeError:
1603 out_list.append(None)
1638 out_list.append(None)
1604 else:
1639 else:
1605 if argseq:
1640 if argseq:
1606 args = map(lambda lst:lst[idx],argseq)
1641 args = map(lambda lst:lst[idx],argseq)
1607 #print 'ob',object,'hand',handler,'ar',args # dbg
1642 #print 'ob',object,'hand',handler,'ar',args # dbg
1608 out_list.append(handler(args,**kw))
1643 out_list.append(handler(args,**kw))
1609 else:
1644 else:
1610 out_list.append(handler(**kw))
1645 out_list.append(handler(**kw))
1611 idx += 1
1646 idx += 1
1612 return out_list
1647 return out_list
1613
1648
1614 #----------------------------------------------------------------------------
1649 #----------------------------------------------------------------------------
1615 def import_fail_info(mod_name,fns=None):
1650 def import_fail_info(mod_name,fns=None):
1616 """Inform load failure for a module."""
1651 """Inform load failure for a module."""
1617
1652
1618 if fns == None:
1653 if fns == None:
1619 warn("Loading of %s failed.\n" % (mod_name,))
1654 warn("Loading of %s failed.\n" % (mod_name,))
1620 else:
1655 else:
1621 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
1656 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
1622
1657
1623 #----------------------------------------------------------------------------
1658 #----------------------------------------------------------------------------
1624 # Proposed popitem() extension, written as a method
1659 # Proposed popitem() extension, written as a method
1625
1660
1626 class NotGiven: pass
1661 class NotGiven: pass
1627
1662
1628 def popkey(dct,key,default=NotGiven):
1663 def popkey(dct,key,default=NotGiven):
1629 """Return dct[key] and delete dct[key].
1664 """Return dct[key] and delete dct[key].
1630
1665
1631 If default is given, return it if dct[key] doesn't exist, otherwise raise
1666 If default is given, return it if dct[key] doesn't exist, otherwise raise
1632 KeyError. """
1667 KeyError. """
1633
1668
1634 try:
1669 try:
1635 val = dct[key]
1670 val = dct[key]
1636 except KeyError:
1671 except KeyError:
1637 if default is NotGiven:
1672 if default is NotGiven:
1638 raise
1673 raise
1639 else:
1674 else:
1640 return default
1675 return default
1641 else:
1676 else:
1642 del dct[key]
1677 del dct[key]
1643 return val
1678 return val
1644 #*************************** end of file <genutils.py> **********************
1679 #*************************** end of file <genutils.py> **********************
1645
1680
@@ -1,4631 +1,4635 b''
1 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/winconsole.py (get_console_size): add new winconsole
4 module and fixes to page_dumb() to improve its behavior under
5 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
6
3 * IPython/Magic.py (Macro): simplified Macro class to just
7 * IPython/Magic.py (Macro): simplified Macro class to just
4 subclass list. We've had only 2.2 compatibility for a very long
8 subclass list. We've had only 2.2 compatibility for a very long
5 time, yet I was still avoiding subclassing the builtin types. No
9 time, yet I was still avoiding subclassing the builtin types. No
6 more (I'm also starting to use properties, though I won't shift to
10 more (I'm also starting to use properties, though I won't shift to
7 2.3-specific features quite yet).
11 2.3-specific features quite yet).
8 (magic_store): added Ville's patch for lightweight variable
12 (magic_store): added Ville's patch for lightweight variable
9 persistence, after a request on the user list by Matt Wilkie
13 persistence, after a request on the user list by Matt Wilkie
10 <maphew at gmail.com>. The new %store magic's docstring has full
14 <maphew-AT-gmail.com>. The new %store magic's docstring has full
11 details.
15 details.
12
16
13 * IPython/iplib.py (InteractiveShell.post_config_initialization):
17 * IPython/iplib.py (InteractiveShell.post_config_initialization):
14 changed the default logfile name from 'ipython.log' to
18 changed the default logfile name from 'ipython.log' to
15 'ipython_log.py'. These logs are real python files, and now that
19 'ipython_log.py'. These logs are real python files, and now that
16 we have much better multiline support, people are more likely to
20 we have much better multiline support, people are more likely to
17 want to use them as such. Might as well name them correctly.
21 want to use them as such. Might as well name them correctly.
18
22
19 * IPython/Magic.py: substantial cleanup. While we can't stop
23 * IPython/Magic.py: substantial cleanup. While we can't stop
20 using magics as mixins, due to the existing customizations 'out
24 using magics as mixins, due to the existing customizations 'out
21 there' which rely on the mixin naming conventions, at least I
25 there' which rely on the mixin naming conventions, at least I
22 cleaned out all cross-class name usage. So once we are OK with
26 cleaned out all cross-class name usage. So once we are OK with
23 breaking compatibility, the two systems can be separated.
27 breaking compatibility, the two systems can be separated.
24
28
25 * IPython/Logger.py: major cleanup. This one is NOT a mixin
29 * IPython/Logger.py: major cleanup. This one is NOT a mixin
26 anymore, and the class is a fair bit less hideous as well. New
30 anymore, and the class is a fair bit less hideous as well. New
27 features were also introduced: timestamping of input, and logging
31 features were also introduced: timestamping of input, and logging
28 of output results. These are user-visible with the -t and -o
32 of output results. These are user-visible with the -t and -o
29 options to %logstart. Closes
33 options to %logstart. Closes
30 http://www.scipy.net/roundup/ipython/issue11 and a request by
34 http://www.scipy.net/roundup/ipython/issue11 and a request by
31 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
35 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
32
36
33 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
37 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
34
38
35 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
39 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
36 better hadnle backslashes in paths. See the thread 'More Windows
40 better hadnle backslashes in paths. See the thread 'More Windows
37 questions part 2 - \/ characters revisited' on the iypthon user
41 questions part 2 - \/ characters revisited' on the iypthon user
38 list:
42 list:
39 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
43 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
40
44
41 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
45 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
42
46
43 (InteractiveShell.__init__): change threaded shells to not use the
47 (InteractiveShell.__init__): change threaded shells to not use the
44 ipython crash handler. This was causing more problems than not,
48 ipython crash handler. This was causing more problems than not,
45 as exceptions in the main thread (GUI code, typically) would
49 as exceptions in the main thread (GUI code, typically) would
46 always show up as a 'crash', when they really weren't.
50 always show up as a 'crash', when they really weren't.
47
51
48 The colors and exception mode commands (%colors/%xmode) have been
52 The colors and exception mode commands (%colors/%xmode) have been
49 synchronized to also take this into account, so users can get
53 synchronized to also take this into account, so users can get
50 verbose exceptions for their threaded code as well. I also added
54 verbose exceptions for their threaded code as well. I also added
51 support for activating pdb inside this exception handler as well,
55 support for activating pdb inside this exception handler as well,
52 so now GUI authors can use IPython's enhanced pdb at runtime.
56 so now GUI authors can use IPython's enhanced pdb at runtime.
53
57
54 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
58 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
55 true by default, and add it to the shipped ipythonrc file. Since
59 true by default, and add it to the shipped ipythonrc file. Since
56 this asks the user before proceeding, I think it's OK to make it
60 this asks the user before proceeding, I think it's OK to make it
57 true by default.
61 true by default.
58
62
59 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
63 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
60 of the previous special-casing of input in the eval loop. I think
64 of the previous special-casing of input in the eval loop. I think
61 this is cleaner, as they really are commands and shouldn't have
65 this is cleaner, as they really are commands and shouldn't have
62 a special role in the middle of the core code.
66 a special role in the middle of the core code.
63
67
64 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
68 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
65
69
66 * IPython/iplib.py (edit_syntax_error): added support for
70 * IPython/iplib.py (edit_syntax_error): added support for
67 automatically reopening the editor if the file had a syntax error
71 automatically reopening the editor if the file had a syntax error
68 in it. Thanks to scottt who provided the patch at:
72 in it. Thanks to scottt who provided the patch at:
69 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
73 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
70 version committed).
74 version committed).
71
75
72 * IPython/iplib.py (handle_normal): add suport for multi-line
76 * IPython/iplib.py (handle_normal): add suport for multi-line
73 input with emtpy lines. This fixes
77 input with emtpy lines. This fixes
74 http://www.scipy.net/roundup/ipython/issue43 and a similar
78 http://www.scipy.net/roundup/ipython/issue43 and a similar
75 discussion on the user list.
79 discussion on the user list.
76
80
77 WARNING: a behavior change is necessarily introduced to support
81 WARNING: a behavior change is necessarily introduced to support
78 blank lines: now a single blank line with whitespace does NOT
82 blank lines: now a single blank line with whitespace does NOT
79 break the input loop, which means that when autoindent is on, by
83 break the input loop, which means that when autoindent is on, by
80 default hitting return on the next (indented) line does NOT exit.
84 default hitting return on the next (indented) line does NOT exit.
81
85
82 Instead, to exit a multiline input you can either have:
86 Instead, to exit a multiline input you can either have:
83
87
84 - TWO whitespace lines (just hit return again), or
88 - TWO whitespace lines (just hit return again), or
85 - a single whitespace line of a different length than provided
89 - a single whitespace line of a different length than provided
86 by the autoindent (add or remove a space).
90 by the autoindent (add or remove a space).
87
91
88 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
92 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
89 module to better organize all readline-related functionality.
93 module to better organize all readline-related functionality.
90 I've deleted FlexCompleter and put all completion clases here.
94 I've deleted FlexCompleter and put all completion clases here.
91
95
92 * IPython/iplib.py (raw_input): improve indentation management.
96 * IPython/iplib.py (raw_input): improve indentation management.
93 It is now possible to paste indented code with autoindent on, and
97 It is now possible to paste indented code with autoindent on, and
94 the code is interpreted correctly (though it still looks bad on
98 the code is interpreted correctly (though it still looks bad on
95 screen, due to the line-oriented nature of ipython).
99 screen, due to the line-oriented nature of ipython).
96 (MagicCompleter.complete): change behavior so that a TAB key on an
100 (MagicCompleter.complete): change behavior so that a TAB key on an
97 otherwise empty line actually inserts a tab, instead of completing
101 otherwise empty line actually inserts a tab, instead of completing
98 on the entire global namespace. This makes it easier to use the
102 on the entire global namespace. This makes it easier to use the
99 TAB key for indentation. After a request by Hans Meine
103 TAB key for indentation. After a request by Hans Meine
100 <hans_meine-AT-gmx.net>
104 <hans_meine-AT-gmx.net>
101 (_prefilter): add support so that typing plain 'exit' or 'quit'
105 (_prefilter): add support so that typing plain 'exit' or 'quit'
102 does a sensible thing. Originally I tried to deviate as little as
106 does a sensible thing. Originally I tried to deviate as little as
103 possible from the default python behavior, but even that one may
107 possible from the default python behavior, but even that one may
104 change in this direction (thread on python-dev to that effect).
108 change in this direction (thread on python-dev to that effect).
105 Regardless, ipython should do the right thing even if CPython's
109 Regardless, ipython should do the right thing even if CPython's
106 '>>>' prompt doesn't.
110 '>>>' prompt doesn't.
107 (InteractiveShell): removed subclassing code.InteractiveConsole
111 (InteractiveShell): removed subclassing code.InteractiveConsole
108 class. By now we'd overridden just about all of its methods: I've
112 class. By now we'd overridden just about all of its methods: I've
109 copied the remaining two over, and now ipython is a standalone
113 copied the remaining two over, and now ipython is a standalone
110 class. This will provide a clearer picture for the chainsaw
114 class. This will provide a clearer picture for the chainsaw
111 branch refactoring.
115 branch refactoring.
112
116
113 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
117 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
114
118
115 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
119 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
116 failures for objects which break when dir() is called on them.
120 failures for objects which break when dir() is called on them.
117
121
118 * IPython/FlexCompleter.py (Completer.__init__): Added support for
122 * IPython/FlexCompleter.py (Completer.__init__): Added support for
119 distinct local and global namespaces in the completer API. This
123 distinct local and global namespaces in the completer API. This
120 change allows us top properly handle completion with distinct
124 change allows us top properly handle completion with distinct
121 scopes, including in embedded instances (this had never really
125 scopes, including in embedded instances (this had never really
122 worked correctly).
126 worked correctly).
123
127
124 Note: this introduces a change in the constructor for
128 Note: this introduces a change in the constructor for
125 MagicCompleter, as a new global_namespace parameter is now the
129 MagicCompleter, as a new global_namespace parameter is now the
126 second argument (the others were bumped one position).
130 second argument (the others were bumped one position).
127
131
128 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
132 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
129
133
130 * IPython/iplib.py (embed_mainloop): fix tab-completion in
134 * IPython/iplib.py (embed_mainloop): fix tab-completion in
131 embedded instances (which can be done now thanks to Vivian's
135 embedded instances (which can be done now thanks to Vivian's
132 frame-handling fixes for pdb).
136 frame-handling fixes for pdb).
133 (InteractiveShell.__init__): Fix namespace handling problem in
137 (InteractiveShell.__init__): Fix namespace handling problem in
134 embedded instances. We were overwriting __main__ unconditionally,
138 embedded instances. We were overwriting __main__ unconditionally,
135 and this should only be done for 'full' (non-embedded) IPython;
139 and this should only be done for 'full' (non-embedded) IPython;
136 embedded instances must respect the caller's __main__. Thanks to
140 embedded instances must respect the caller's __main__. Thanks to
137 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
141 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
138
142
139 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
143 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
140
144
141 * setup.py: added download_url to setup(). This registers the
145 * setup.py: added download_url to setup(). This registers the
142 download address at PyPI, which is not only useful to humans
146 download address at PyPI, which is not only useful to humans
143 browsing the site, but is also picked up by setuptools (the Eggs
147 browsing the site, but is also picked up by setuptools (the Eggs
144 machinery). Thanks to Ville and R. Kern for the info/discussion
148 machinery). Thanks to Ville and R. Kern for the info/discussion
145 on this.
149 on this.
146
150
147 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
151 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
148
152
149 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
153 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
150 This brings a lot of nice functionality to the pdb mode, which now
154 This brings a lot of nice functionality to the pdb mode, which now
151 has tab-completion, syntax highlighting, and better stack handling
155 has tab-completion, syntax highlighting, and better stack handling
152 than before. Many thanks to Vivian De Smedt
156 than before. Many thanks to Vivian De Smedt
153 <vivian-AT-vdesmedt.com> for the original patches.
157 <vivian-AT-vdesmedt.com> for the original patches.
154
158
155 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
159 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
156
160
157 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
161 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
158 sequence to consistently accept the banner argument. The
162 sequence to consistently accept the banner argument. The
159 inconsistency was tripping SAGE, thanks to Gary Zablackis
163 inconsistency was tripping SAGE, thanks to Gary Zablackis
160 <gzabl-AT-yahoo.com> for the report.
164 <gzabl-AT-yahoo.com> for the report.
161
165
162 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
166 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
163
167
164 * IPython/iplib.py (InteractiveShell.post_config_initialization):
168 * IPython/iplib.py (InteractiveShell.post_config_initialization):
165 Fix bug where a naked 'alias' call in the ipythonrc file would
169 Fix bug where a naked 'alias' call in the ipythonrc file would
166 cause a crash. Bug reported by Jorgen Stenarson.
170 cause a crash. Bug reported by Jorgen Stenarson.
167
171
168 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
172 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
169
173
170 * IPython/ipmaker.py (make_IPython): cleanups which should improve
174 * IPython/ipmaker.py (make_IPython): cleanups which should improve
171 startup time.
175 startup time.
172
176
173 * IPython/iplib.py (runcode): my globals 'fix' for embedded
177 * IPython/iplib.py (runcode): my globals 'fix' for embedded
174 instances had introduced a bug with globals in normal code. Now
178 instances had introduced a bug with globals in normal code. Now
175 it's working in all cases.
179 it's working in all cases.
176
180
177 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
181 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
178 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
182 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
179 has been introduced to set the default case sensitivity of the
183 has been introduced to set the default case sensitivity of the
180 searches. Users can still select either mode at runtime on a
184 searches. Users can still select either mode at runtime on a
181 per-search basis.
185 per-search basis.
182
186
183 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
187 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
184
188
185 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
189 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
186 attributes in wildcard searches for subclasses. Modified version
190 attributes in wildcard searches for subclasses. Modified version
187 of a patch by Jorgen.
191 of a patch by Jorgen.
188
192
189 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
193 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
190
194
191 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
195 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
192 embedded instances. I added a user_global_ns attribute to the
196 embedded instances. I added a user_global_ns attribute to the
193 InteractiveShell class to handle this.
197 InteractiveShell class to handle this.
194
198
195 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
199 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
196
200
197 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
201 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
198 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
202 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
199 (reported under win32, but may happen also in other platforms).
203 (reported under win32, but may happen also in other platforms).
200 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
204 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
201
205
202 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
206 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
203
207
204 * IPython/Magic.py (magic_psearch): new support for wildcard
208 * IPython/Magic.py (magic_psearch): new support for wildcard
205 patterns. Now, typing ?a*b will list all names which begin with a
209 patterns. Now, typing ?a*b will list all names which begin with a
206 and end in b, for example. The %psearch magic has full
210 and end in b, for example. The %psearch magic has full
207 docstrings. Many thanks to Jörgen Stenarson
211 docstrings. Many thanks to Jörgen Stenarson
208 <jorgen.stenarson-AT-bostream.nu>, author of the patches
212 <jorgen.stenarson-AT-bostream.nu>, author of the patches
209 implementing this functionality.
213 implementing this functionality.
210
214
211 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
215 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
212
216
213 * Manual: fixed long-standing annoyance of double-dashes (as in
217 * Manual: fixed long-standing annoyance of double-dashes (as in
214 --prefix=~, for example) being stripped in the HTML version. This
218 --prefix=~, for example) being stripped in the HTML version. This
215 is a latex2html bug, but a workaround was provided. Many thanks
219 is a latex2html bug, but a workaround was provided. Many thanks
216 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
220 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
217 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
221 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
218 rolling. This seemingly small issue had tripped a number of users
222 rolling. This seemingly small issue had tripped a number of users
219 when first installing, so I'm glad to see it gone.
223 when first installing, so I'm glad to see it gone.
220
224
221 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
225 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
222
226
223 * IPython/Extensions/numeric_formats.py: fix missing import,
227 * IPython/Extensions/numeric_formats.py: fix missing import,
224 reported by Stephen Walton.
228 reported by Stephen Walton.
225
229
226 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
230 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
227
231
228 * IPython/demo.py: finish demo module, fully documented now.
232 * IPython/demo.py: finish demo module, fully documented now.
229
233
230 * IPython/genutils.py (file_read): simple little utility to read a
234 * IPython/genutils.py (file_read): simple little utility to read a
231 file and ensure it's closed afterwards.
235 file and ensure it's closed afterwards.
232
236
233 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
237 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
234
238
235 * IPython/demo.py (Demo.__init__): added support for individually
239 * IPython/demo.py (Demo.__init__): added support for individually
236 tagging blocks for automatic execution.
240 tagging blocks for automatic execution.
237
241
238 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
242 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
239 syntax-highlighted python sources, requested by John.
243 syntax-highlighted python sources, requested by John.
240
244
241 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
245 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
242
246
243 * IPython/demo.py (Demo.again): fix bug where again() blocks after
247 * IPython/demo.py (Demo.again): fix bug where again() blocks after
244 finishing.
248 finishing.
245
249
246 * IPython/genutils.py (shlex_split): moved from Magic to here,
250 * IPython/genutils.py (shlex_split): moved from Magic to here,
247 where all 2.2 compatibility stuff lives. I needed it for demo.py.
251 where all 2.2 compatibility stuff lives. I needed it for demo.py.
248
252
249 * IPython/demo.py (Demo.__init__): added support for silent
253 * IPython/demo.py (Demo.__init__): added support for silent
250 blocks, improved marks as regexps, docstrings written.
254 blocks, improved marks as regexps, docstrings written.
251 (Demo.__init__): better docstring, added support for sys.argv.
255 (Demo.__init__): better docstring, added support for sys.argv.
252
256
253 * IPython/genutils.py (marquee): little utility used by the demo
257 * IPython/genutils.py (marquee): little utility used by the demo
254 code, handy in general.
258 code, handy in general.
255
259
256 * IPython/demo.py (Demo.__init__): new class for interactive
260 * IPython/demo.py (Demo.__init__): new class for interactive
257 demos. Not documented yet, I just wrote it in a hurry for
261 demos. Not documented yet, I just wrote it in a hurry for
258 scipy'05. Will docstring later.
262 scipy'05. Will docstring later.
259
263
260 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
264 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
261
265
262 * IPython/Shell.py (sigint_handler): Drastic simplification which
266 * IPython/Shell.py (sigint_handler): Drastic simplification which
263 also seems to make Ctrl-C work correctly across threads! This is
267 also seems to make Ctrl-C work correctly across threads! This is
264 so simple, that I can't beleive I'd missed it before. Needs more
268 so simple, that I can't beleive I'd missed it before. Needs more
265 testing, though.
269 testing, though.
266 (KBINT): Never mind, revert changes. I'm sure I'd tried something
270 (KBINT): Never mind, revert changes. I'm sure I'd tried something
267 like this before...
271 like this before...
268
272
269 * IPython/genutils.py (get_home_dir): add protection against
273 * IPython/genutils.py (get_home_dir): add protection against
270 non-dirs in win32 registry.
274 non-dirs in win32 registry.
271
275
272 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
276 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
273 bug where dict was mutated while iterating (pysh crash).
277 bug where dict was mutated while iterating (pysh crash).
274
278
275 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
279 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
276
280
277 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
281 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
278 spurious newlines added by this routine. After a report by
282 spurious newlines added by this routine. After a report by
279 F. Mantegazza.
283 F. Mantegazza.
280
284
281 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
285 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
282
286
283 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
287 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
284 calls. These were a leftover from the GTK 1.x days, and can cause
288 calls. These were a leftover from the GTK 1.x days, and can cause
285 problems in certain cases (after a report by John Hunter).
289 problems in certain cases (after a report by John Hunter).
286
290
287 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
291 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
288 os.getcwd() fails at init time. Thanks to patch from David Remahl
292 os.getcwd() fails at init time. Thanks to patch from David Remahl
289 <chmod007-AT-mac.com>.
293 <chmod007-AT-mac.com>.
290 (InteractiveShell.__init__): prevent certain special magics from
294 (InteractiveShell.__init__): prevent certain special magics from
291 being shadowed by aliases. Closes
295 being shadowed by aliases. Closes
292 http://www.scipy.net/roundup/ipython/issue41.
296 http://www.scipy.net/roundup/ipython/issue41.
293
297
294 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
298 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
295
299
296 * IPython/iplib.py (InteractiveShell.complete): Added new
300 * IPython/iplib.py (InteractiveShell.complete): Added new
297 top-level completion method to expose the completion mechanism
301 top-level completion method to expose the completion mechanism
298 beyond readline-based environments.
302 beyond readline-based environments.
299
303
300 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
304 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
301
305
302 * tools/ipsvnc (svnversion): fix svnversion capture.
306 * tools/ipsvnc (svnversion): fix svnversion capture.
303
307
304 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
308 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
305 attribute to self, which was missing. Before, it was set by a
309 attribute to self, which was missing. Before, it was set by a
306 routine which in certain cases wasn't being called, so the
310 routine which in certain cases wasn't being called, so the
307 instance could end up missing the attribute. This caused a crash.
311 instance could end up missing the attribute. This caused a crash.
308 Closes http://www.scipy.net/roundup/ipython/issue40.
312 Closes http://www.scipy.net/roundup/ipython/issue40.
309
313
310 2005-08-16 Fernando Perez <fperez@colorado.edu>
314 2005-08-16 Fernando Perez <fperez@colorado.edu>
311
315
312 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
316 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
313 contains non-string attribute. Closes
317 contains non-string attribute. Closes
314 http://www.scipy.net/roundup/ipython/issue38.
318 http://www.scipy.net/roundup/ipython/issue38.
315
319
316 2005-08-14 Fernando Perez <fperez@colorado.edu>
320 2005-08-14 Fernando Perez <fperez@colorado.edu>
317
321
318 * tools/ipsvnc: Minor improvements, to add changeset info.
322 * tools/ipsvnc: Minor improvements, to add changeset info.
319
323
320 2005-08-12 Fernando Perez <fperez@colorado.edu>
324 2005-08-12 Fernando Perez <fperez@colorado.edu>
321
325
322 * IPython/iplib.py (runsource): remove self.code_to_run_src
326 * IPython/iplib.py (runsource): remove self.code_to_run_src
323 attribute. I realized this is nothing more than
327 attribute. I realized this is nothing more than
324 '\n'.join(self.buffer), and having the same data in two different
328 '\n'.join(self.buffer), and having the same data in two different
325 places is just asking for synchronization bugs. This may impact
329 places is just asking for synchronization bugs. This may impact
326 people who have custom exception handlers, so I need to warn
330 people who have custom exception handlers, so I need to warn
327 ipython-dev about it (F. Mantegazza may use them).
331 ipython-dev about it (F. Mantegazza may use them).
328
332
329 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
333 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
330
334
331 * IPython/genutils.py: fix 2.2 compatibility (generators)
335 * IPython/genutils.py: fix 2.2 compatibility (generators)
332
336
333 2005-07-18 Fernando Perez <fperez@colorado.edu>
337 2005-07-18 Fernando Perez <fperez@colorado.edu>
334
338
335 * IPython/genutils.py (get_home_dir): fix to help users with
339 * IPython/genutils.py (get_home_dir): fix to help users with
336 invalid $HOME under win32.
340 invalid $HOME under win32.
337
341
338 2005-07-17 Fernando Perez <fperez@colorado.edu>
342 2005-07-17 Fernando Perez <fperez@colorado.edu>
339
343
340 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
344 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
341 some old hacks and clean up a bit other routines; code should be
345 some old hacks and clean up a bit other routines; code should be
342 simpler and a bit faster.
346 simpler and a bit faster.
343
347
344 * IPython/iplib.py (interact): removed some last-resort attempts
348 * IPython/iplib.py (interact): removed some last-resort attempts
345 to survive broken stdout/stderr. That code was only making it
349 to survive broken stdout/stderr. That code was only making it
346 harder to abstract out the i/o (necessary for gui integration),
350 harder to abstract out the i/o (necessary for gui integration),
347 and the crashes it could prevent were extremely rare in practice
351 and the crashes it could prevent were extremely rare in practice
348 (besides being fully user-induced in a pretty violent manner).
352 (besides being fully user-induced in a pretty violent manner).
349
353
350 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
354 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
351 Nothing major yet, but the code is simpler to read; this should
355 Nothing major yet, but the code is simpler to read; this should
352 make it easier to do more serious modifications in the future.
356 make it easier to do more serious modifications in the future.
353
357
354 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
358 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
355 which broke in .15 (thanks to a report by Ville).
359 which broke in .15 (thanks to a report by Ville).
356
360
357 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
361 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
358 be quite correct, I know next to nothing about unicode). This
362 be quite correct, I know next to nothing about unicode). This
359 will allow unicode strings to be used in prompts, amongst other
363 will allow unicode strings to be used in prompts, amongst other
360 cases. It also will prevent ipython from crashing when unicode
364 cases. It also will prevent ipython from crashing when unicode
361 shows up unexpectedly in many places. If ascii encoding fails, we
365 shows up unexpectedly in many places. If ascii encoding fails, we
362 assume utf_8. Currently the encoding is not a user-visible
366 assume utf_8. Currently the encoding is not a user-visible
363 setting, though it could be made so if there is demand for it.
367 setting, though it could be made so if there is demand for it.
364
368
365 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
369 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
366
370
367 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
371 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
368
372
369 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
373 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
370
374
371 * IPython/genutils.py: Add 2.2 compatibility here, so all other
375 * IPython/genutils.py: Add 2.2 compatibility here, so all other
372 code can work transparently for 2.2/2.3.
376 code can work transparently for 2.2/2.3.
373
377
374 2005-07-16 Fernando Perez <fperez@colorado.edu>
378 2005-07-16 Fernando Perez <fperez@colorado.edu>
375
379
376 * IPython/ultraTB.py (ExceptionColors): Make a global variable
380 * IPython/ultraTB.py (ExceptionColors): Make a global variable
377 out of the color scheme table used for coloring exception
381 out of the color scheme table used for coloring exception
378 tracebacks. This allows user code to add new schemes at runtime.
382 tracebacks. This allows user code to add new schemes at runtime.
379 This is a minimally modified version of the patch at
383 This is a minimally modified version of the patch at
380 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
384 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
381 for the contribution.
385 for the contribution.
382
386
383 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
387 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
384 slightly modified version of the patch in
388 slightly modified version of the patch in
385 http://www.scipy.net/roundup/ipython/issue34, which also allows me
389 http://www.scipy.net/roundup/ipython/issue34, which also allows me
386 to remove the previous try/except solution (which was costlier).
390 to remove the previous try/except solution (which was costlier).
387 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
391 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
388
392
389 2005-06-08 Fernando Perez <fperez@colorado.edu>
393 2005-06-08 Fernando Perez <fperez@colorado.edu>
390
394
391 * IPython/iplib.py (write/write_err): Add methods to abstract all
395 * IPython/iplib.py (write/write_err): Add methods to abstract all
392 I/O a bit more.
396 I/O a bit more.
393
397
394 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
398 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
395 warning, reported by Aric Hagberg, fix by JD Hunter.
399 warning, reported by Aric Hagberg, fix by JD Hunter.
396
400
397 2005-06-02 *** Released version 0.6.15
401 2005-06-02 *** Released version 0.6.15
398
402
399 2005-06-01 Fernando Perez <fperez@colorado.edu>
403 2005-06-01 Fernando Perez <fperez@colorado.edu>
400
404
401 * IPython/iplib.py (MagicCompleter.file_matches): Fix
405 * IPython/iplib.py (MagicCompleter.file_matches): Fix
402 tab-completion of filenames within open-quoted strings. Note that
406 tab-completion of filenames within open-quoted strings. Note that
403 this requires that in ~/.ipython/ipythonrc, users change the
407 this requires that in ~/.ipython/ipythonrc, users change the
404 readline delimiters configuration to read:
408 readline delimiters configuration to read:
405
409
406 readline_remove_delims -/~
410 readline_remove_delims -/~
407
411
408
412
409 2005-05-31 *** Released version 0.6.14
413 2005-05-31 *** Released version 0.6.14
410
414
411 2005-05-29 Fernando Perez <fperez@colorado.edu>
415 2005-05-29 Fernando Perez <fperez@colorado.edu>
412
416
413 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
417 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
414 with files not on the filesystem. Reported by Eliyahu Sandler
418 with files not on the filesystem. Reported by Eliyahu Sandler
415 <eli@gondolin.net>
419 <eli@gondolin.net>
416
420
417 2005-05-22 Fernando Perez <fperez@colorado.edu>
421 2005-05-22 Fernando Perez <fperez@colorado.edu>
418
422
419 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
423 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
420 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
424 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
421
425
422 2005-05-19 Fernando Perez <fperez@colorado.edu>
426 2005-05-19 Fernando Perez <fperez@colorado.edu>
423
427
424 * IPython/iplib.py (safe_execfile): close a file which could be
428 * IPython/iplib.py (safe_execfile): close a file which could be
425 left open (causing problems in win32, which locks open files).
429 left open (causing problems in win32, which locks open files).
426 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
430 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
427
431
428 2005-05-18 Fernando Perez <fperez@colorado.edu>
432 2005-05-18 Fernando Perez <fperez@colorado.edu>
429
433
430 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
434 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
431 keyword arguments correctly to safe_execfile().
435 keyword arguments correctly to safe_execfile().
432
436
433 2005-05-13 Fernando Perez <fperez@colorado.edu>
437 2005-05-13 Fernando Perez <fperez@colorado.edu>
434
438
435 * ipython.1: Added info about Qt to manpage, and threads warning
439 * ipython.1: Added info about Qt to manpage, and threads warning
436 to usage page (invoked with --help).
440 to usage page (invoked with --help).
437
441
438 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
442 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
439 new matcher (it goes at the end of the priority list) to do
443 new matcher (it goes at the end of the priority list) to do
440 tab-completion on named function arguments. Submitted by George
444 tab-completion on named function arguments. Submitted by George
441 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
445 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
442 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
446 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
443 for more details.
447 for more details.
444
448
445 * IPython/Magic.py (magic_run): Added new -e flag to ignore
449 * IPython/Magic.py (magic_run): Added new -e flag to ignore
446 SystemExit exceptions in the script being run. Thanks to a report
450 SystemExit exceptions in the script being run. Thanks to a report
447 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
451 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
448 producing very annoying behavior when running unit tests.
452 producing very annoying behavior when running unit tests.
449
453
450 2005-05-12 Fernando Perez <fperez@colorado.edu>
454 2005-05-12 Fernando Perez <fperez@colorado.edu>
451
455
452 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
456 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
453 which I'd broken (again) due to a changed regexp. In the process,
457 which I'd broken (again) due to a changed regexp. In the process,
454 added ';' as an escape to auto-quote the whole line without
458 added ';' as an escape to auto-quote the whole line without
455 splitting its arguments. Thanks to a report by Jerry McRae
459 splitting its arguments. Thanks to a report by Jerry McRae
456 <qrs0xyc02-AT-sneakemail.com>.
460 <qrs0xyc02-AT-sneakemail.com>.
457
461
458 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
462 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
459 possible crashes caused by a TokenError. Reported by Ed Schofield
463 possible crashes caused by a TokenError. Reported by Ed Schofield
460 <schofield-AT-ftw.at>.
464 <schofield-AT-ftw.at>.
461
465
462 2005-05-06 Fernando Perez <fperez@colorado.edu>
466 2005-05-06 Fernando Perez <fperez@colorado.edu>
463
467
464 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
468 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
465
469
466 2005-04-29 Fernando Perez <fperez@colorado.edu>
470 2005-04-29 Fernando Perez <fperez@colorado.edu>
467
471
468 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
472 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
469 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
473 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
470 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
474 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
471 which provides support for Qt interactive usage (similar to the
475 which provides support for Qt interactive usage (similar to the
472 existing one for WX and GTK). This had been often requested.
476 existing one for WX and GTK). This had been often requested.
473
477
474 2005-04-14 *** Released version 0.6.13
478 2005-04-14 *** Released version 0.6.13
475
479
476 2005-04-08 Fernando Perez <fperez@colorado.edu>
480 2005-04-08 Fernando Perez <fperez@colorado.edu>
477
481
478 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
482 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
479 from _ofind, which gets called on almost every input line. Now,
483 from _ofind, which gets called on almost every input line. Now,
480 we only try to get docstrings if they are actually going to be
484 we only try to get docstrings if they are actually going to be
481 used (the overhead of fetching unnecessary docstrings can be
485 used (the overhead of fetching unnecessary docstrings can be
482 noticeable for certain objects, such as Pyro proxies).
486 noticeable for certain objects, such as Pyro proxies).
483
487
484 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
488 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
485 for completers. For some reason I had been passing them the state
489 for completers. For some reason I had been passing them the state
486 variable, which completers never actually need, and was in
490 variable, which completers never actually need, and was in
487 conflict with the rlcompleter API. Custom completers ONLY need to
491 conflict with the rlcompleter API. Custom completers ONLY need to
488 take the text parameter.
492 take the text parameter.
489
493
490 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
494 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
491 work correctly in pysh. I've also moved all the logic which used
495 work correctly in pysh. I've also moved all the logic which used
492 to be in pysh.py here, which will prevent problems with future
496 to be in pysh.py here, which will prevent problems with future
493 upgrades. However, this time I must warn users to update their
497 upgrades. However, this time I must warn users to update their
494 pysh profile to include the line
498 pysh profile to include the line
495
499
496 import_all IPython.Extensions.InterpreterExec
500 import_all IPython.Extensions.InterpreterExec
497
501
498 because otherwise things won't work for them. They MUST also
502 because otherwise things won't work for them. They MUST also
499 delete pysh.py and the line
503 delete pysh.py and the line
500
504
501 execfile pysh.py
505 execfile pysh.py
502
506
503 from their ipythonrc-pysh.
507 from their ipythonrc-pysh.
504
508
505 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
509 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
506 robust in the face of objects whose dir() returns non-strings
510 robust in the face of objects whose dir() returns non-strings
507 (which it shouldn't, but some broken libs like ITK do). Thanks to
511 (which it shouldn't, but some broken libs like ITK do). Thanks to
508 a patch by John Hunter (implemented differently, though). Also
512 a patch by John Hunter (implemented differently, though). Also
509 minor improvements by using .extend instead of + on lists.
513 minor improvements by using .extend instead of + on lists.
510
514
511 * pysh.py:
515 * pysh.py:
512
516
513 2005-04-06 Fernando Perez <fperez@colorado.edu>
517 2005-04-06 Fernando Perez <fperez@colorado.edu>
514
518
515 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
519 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
516 by default, so that all users benefit from it. Those who don't
520 by default, so that all users benefit from it. Those who don't
517 want it can still turn it off.
521 want it can still turn it off.
518
522
519 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
523 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
520 config file, I'd forgotten about this, so users were getting it
524 config file, I'd forgotten about this, so users were getting it
521 off by default.
525 off by default.
522
526
523 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
527 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
524 consistency. Now magics can be called in multiline statements,
528 consistency. Now magics can be called in multiline statements,
525 and python variables can be expanded in magic calls via $var.
529 and python variables can be expanded in magic calls via $var.
526 This makes the magic system behave just like aliases or !system
530 This makes the magic system behave just like aliases or !system
527 calls.
531 calls.
528
532
529 2005-03-28 Fernando Perez <fperez@colorado.edu>
533 2005-03-28 Fernando Perez <fperez@colorado.edu>
530
534
531 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
535 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
532 expensive string additions for building command. Add support for
536 expensive string additions for building command. Add support for
533 trailing ';' when autocall is used.
537 trailing ';' when autocall is used.
534
538
535 2005-03-26 Fernando Perez <fperez@colorado.edu>
539 2005-03-26 Fernando Perez <fperez@colorado.edu>
536
540
537 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
541 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
538 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
542 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
539 ipython.el robust against prompts with any number of spaces
543 ipython.el robust against prompts with any number of spaces
540 (including 0) after the ':' character.
544 (including 0) after the ':' character.
541
545
542 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
546 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
543 continuation prompt, which misled users to think the line was
547 continuation prompt, which misled users to think the line was
544 already indented. Closes debian Bug#300847, reported to me by
548 already indented. Closes debian Bug#300847, reported to me by
545 Norbert Tretkowski <tretkowski-AT-inittab.de>.
549 Norbert Tretkowski <tretkowski-AT-inittab.de>.
546
550
547 2005-03-23 Fernando Perez <fperez@colorado.edu>
551 2005-03-23 Fernando Perez <fperez@colorado.edu>
548
552
549 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
553 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
550 properly aligned if they have embedded newlines.
554 properly aligned if they have embedded newlines.
551
555
552 * IPython/iplib.py (runlines): Add a public method to expose
556 * IPython/iplib.py (runlines): Add a public method to expose
553 IPython's code execution machinery, so that users can run strings
557 IPython's code execution machinery, so that users can run strings
554 as if they had been typed at the prompt interactively.
558 as if they had been typed at the prompt interactively.
555 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
559 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
556 methods which can call the system shell, but with python variable
560 methods which can call the system shell, but with python variable
557 expansion. The three such methods are: __IPYTHON__.system,
561 expansion. The three such methods are: __IPYTHON__.system,
558 .getoutput and .getoutputerror. These need to be documented in a
562 .getoutput and .getoutputerror. These need to be documented in a
559 'public API' section (to be written) of the manual.
563 'public API' section (to be written) of the manual.
560
564
561 2005-03-20 Fernando Perez <fperez@colorado.edu>
565 2005-03-20 Fernando Perez <fperez@colorado.edu>
562
566
563 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
567 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
564 for custom exception handling. This is quite powerful, and it
568 for custom exception handling. This is quite powerful, and it
565 allows for user-installable exception handlers which can trap
569 allows for user-installable exception handlers which can trap
566 custom exceptions at runtime and treat them separately from
570 custom exceptions at runtime and treat them separately from
567 IPython's default mechanisms. At the request of Frédéric
571 IPython's default mechanisms. At the request of Frédéric
568 Mantegazza <mantegazza-AT-ill.fr>.
572 Mantegazza <mantegazza-AT-ill.fr>.
569 (InteractiveShell.set_custom_completer): public API function to
573 (InteractiveShell.set_custom_completer): public API function to
570 add new completers at runtime.
574 add new completers at runtime.
571
575
572 2005-03-19 Fernando Perez <fperez@colorado.edu>
576 2005-03-19 Fernando Perez <fperez@colorado.edu>
573
577
574 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
578 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
575 allow objects which provide their docstrings via non-standard
579 allow objects which provide their docstrings via non-standard
576 mechanisms (like Pyro proxies) to still be inspected by ipython's
580 mechanisms (like Pyro proxies) to still be inspected by ipython's
577 ? system.
581 ? system.
578
582
579 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
583 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
580 automatic capture system. I tried quite hard to make it work
584 automatic capture system. I tried quite hard to make it work
581 reliably, and simply failed. I tried many combinations with the
585 reliably, and simply failed. I tried many combinations with the
582 subprocess module, but eventually nothing worked in all needed
586 subprocess module, but eventually nothing worked in all needed
583 cases (not blocking stdin for the child, duplicating stdout
587 cases (not blocking stdin for the child, duplicating stdout
584 without blocking, etc). The new %sc/%sx still do capture to these
588 without blocking, etc). The new %sc/%sx still do capture to these
585 magical list/string objects which make shell use much more
589 magical list/string objects which make shell use much more
586 conveninent, so not all is lost.
590 conveninent, so not all is lost.
587
591
588 XXX - FIX MANUAL for the change above!
592 XXX - FIX MANUAL for the change above!
589
593
590 (runsource): I copied code.py's runsource() into ipython to modify
594 (runsource): I copied code.py's runsource() into ipython to modify
591 it a bit. Now the code object and source to be executed are
595 it a bit. Now the code object and source to be executed are
592 stored in ipython. This makes this info accessible to third-party
596 stored in ipython. This makes this info accessible to third-party
593 tools, like custom exception handlers. After a request by Frédéric
597 tools, like custom exception handlers. After a request by Frédéric
594 Mantegazza <mantegazza-AT-ill.fr>.
598 Mantegazza <mantegazza-AT-ill.fr>.
595
599
596 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
600 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
597 history-search via readline (like C-p/C-n). I'd wanted this for a
601 history-search via readline (like C-p/C-n). I'd wanted this for a
598 long time, but only recently found out how to do it. For users
602 long time, but only recently found out how to do it. For users
599 who already have their ipythonrc files made and want this, just
603 who already have their ipythonrc files made and want this, just
600 add:
604 add:
601
605
602 readline_parse_and_bind "\e[A": history-search-backward
606 readline_parse_and_bind "\e[A": history-search-backward
603 readline_parse_and_bind "\e[B": history-search-forward
607 readline_parse_and_bind "\e[B": history-search-forward
604
608
605 2005-03-18 Fernando Perez <fperez@colorado.edu>
609 2005-03-18 Fernando Perez <fperez@colorado.edu>
606
610
607 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
611 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
608 LSString and SList classes which allow transparent conversions
612 LSString and SList classes which allow transparent conversions
609 between list mode and whitespace-separated string.
613 between list mode and whitespace-separated string.
610 (magic_r): Fix recursion problem in %r.
614 (magic_r): Fix recursion problem in %r.
611
615
612 * IPython/genutils.py (LSString): New class to be used for
616 * IPython/genutils.py (LSString): New class to be used for
613 automatic storage of the results of all alias/system calls in _o
617 automatic storage of the results of all alias/system calls in _o
614 and _e (stdout/err). These provide a .l/.list attribute which
618 and _e (stdout/err). These provide a .l/.list attribute which
615 does automatic splitting on newlines. This means that for most
619 does automatic splitting on newlines. This means that for most
616 uses, you'll never need to do capturing of output with %sc/%sx
620 uses, you'll never need to do capturing of output with %sc/%sx
617 anymore, since ipython keeps this always done for you. Note that
621 anymore, since ipython keeps this always done for you. Note that
618 only the LAST results are stored, the _o/e variables are
622 only the LAST results are stored, the _o/e variables are
619 overwritten on each call. If you need to save their contents
623 overwritten on each call. If you need to save their contents
620 further, simply bind them to any other name.
624 further, simply bind them to any other name.
621
625
622 2005-03-17 Fernando Perez <fperez@colorado.edu>
626 2005-03-17 Fernando Perez <fperez@colorado.edu>
623
627
624 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
628 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
625 prompt namespace handling.
629 prompt namespace handling.
626
630
627 2005-03-16 Fernando Perez <fperez@colorado.edu>
631 2005-03-16 Fernando Perez <fperez@colorado.edu>
628
632
629 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
633 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
630 classic prompts to be '>>> ' (final space was missing, and it
634 classic prompts to be '>>> ' (final space was missing, and it
631 trips the emacs python mode).
635 trips the emacs python mode).
632 (BasePrompt.__str__): Added safe support for dynamic prompt
636 (BasePrompt.__str__): Added safe support for dynamic prompt
633 strings. Now you can set your prompt string to be '$x', and the
637 strings. Now you can set your prompt string to be '$x', and the
634 value of x will be printed from your interactive namespace. The
638 value of x will be printed from your interactive namespace. The
635 interpolation syntax includes the full Itpl support, so
639 interpolation syntax includes the full Itpl support, so
636 ${foo()+x+bar()} is a valid prompt string now, and the function
640 ${foo()+x+bar()} is a valid prompt string now, and the function
637 calls will be made at runtime.
641 calls will be made at runtime.
638
642
639 2005-03-15 Fernando Perez <fperez@colorado.edu>
643 2005-03-15 Fernando Perez <fperez@colorado.edu>
640
644
641 * IPython/Magic.py (magic_history): renamed %hist to %history, to
645 * IPython/Magic.py (magic_history): renamed %hist to %history, to
642 avoid name clashes in pylab. %hist still works, it just forwards
646 avoid name clashes in pylab. %hist still works, it just forwards
643 the call to %history.
647 the call to %history.
644
648
645 2005-03-02 *** Released version 0.6.12
649 2005-03-02 *** Released version 0.6.12
646
650
647 2005-03-02 Fernando Perez <fperez@colorado.edu>
651 2005-03-02 Fernando Perez <fperez@colorado.edu>
648
652
649 * IPython/iplib.py (handle_magic): log magic calls properly as
653 * IPython/iplib.py (handle_magic): log magic calls properly as
650 ipmagic() function calls.
654 ipmagic() function calls.
651
655
652 * IPython/Magic.py (magic_time): Improved %time to support
656 * IPython/Magic.py (magic_time): Improved %time to support
653 statements and provide wall-clock as well as CPU time.
657 statements and provide wall-clock as well as CPU time.
654
658
655 2005-02-27 Fernando Perez <fperez@colorado.edu>
659 2005-02-27 Fernando Perez <fperez@colorado.edu>
656
660
657 * IPython/hooks.py: New hooks module, to expose user-modifiable
661 * IPython/hooks.py: New hooks module, to expose user-modifiable
658 IPython functionality in a clean manner. For now only the editor
662 IPython functionality in a clean manner. For now only the editor
659 hook is actually written, and other thigns which I intend to turn
663 hook is actually written, and other thigns which I intend to turn
660 into proper hooks aren't yet there. The display and prefilter
664 into proper hooks aren't yet there. The display and prefilter
661 stuff, for example, should be hooks. But at least now the
665 stuff, for example, should be hooks. But at least now the
662 framework is in place, and the rest can be moved here with more
666 framework is in place, and the rest can be moved here with more
663 time later. IPython had had a .hooks variable for a long time for
667 time later. IPython had had a .hooks variable for a long time for
664 this purpose, but I'd never actually used it for anything.
668 this purpose, but I'd never actually used it for anything.
665
669
666 2005-02-26 Fernando Perez <fperez@colorado.edu>
670 2005-02-26 Fernando Perez <fperez@colorado.edu>
667
671
668 * IPython/ipmaker.py (make_IPython): make the default ipython
672 * IPython/ipmaker.py (make_IPython): make the default ipython
669 directory be called _ipython under win32, to follow more the
673 directory be called _ipython under win32, to follow more the
670 naming peculiarities of that platform (where buggy software like
674 naming peculiarities of that platform (where buggy software like
671 Visual Sourcesafe breaks with .named directories). Reported by
675 Visual Sourcesafe breaks with .named directories). Reported by
672 Ville Vainio.
676 Ville Vainio.
673
677
674 2005-02-23 Fernando Perez <fperez@colorado.edu>
678 2005-02-23 Fernando Perez <fperez@colorado.edu>
675
679
676 * IPython/iplib.py (InteractiveShell.__init__): removed a few
680 * IPython/iplib.py (InteractiveShell.__init__): removed a few
677 auto_aliases for win32 which were causing problems. Users can
681 auto_aliases for win32 which were causing problems. Users can
678 define the ones they personally like.
682 define the ones they personally like.
679
683
680 2005-02-21 Fernando Perez <fperez@colorado.edu>
684 2005-02-21 Fernando Perez <fperez@colorado.edu>
681
685
682 * IPython/Magic.py (magic_time): new magic to time execution of
686 * IPython/Magic.py (magic_time): new magic to time execution of
683 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
687 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
684
688
685 2005-02-19 Fernando Perez <fperez@colorado.edu>
689 2005-02-19 Fernando Perez <fperez@colorado.edu>
686
690
687 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
691 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
688 into keys (for prompts, for example).
692 into keys (for prompts, for example).
689
693
690 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
694 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
691 prompts in case users want them. This introduces a small behavior
695 prompts in case users want them. This introduces a small behavior
692 change: ipython does not automatically add a space to all prompts
696 change: ipython does not automatically add a space to all prompts
693 anymore. To get the old prompts with a space, users should add it
697 anymore. To get the old prompts with a space, users should add it
694 manually to their ipythonrc file, so for example prompt_in1 should
698 manually to their ipythonrc file, so for example prompt_in1 should
695 now read 'In [\#]: ' instead of 'In [\#]:'.
699 now read 'In [\#]: ' instead of 'In [\#]:'.
696 (BasePrompt.__init__): New option prompts_pad_left (only in rc
700 (BasePrompt.__init__): New option prompts_pad_left (only in rc
697 file) to control left-padding of secondary prompts.
701 file) to control left-padding of secondary prompts.
698
702
699 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
703 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
700 the profiler can't be imported. Fix for Debian, which removed
704 the profiler can't be imported. Fix for Debian, which removed
701 profile.py because of License issues. I applied a slightly
705 profile.py because of License issues. I applied a slightly
702 modified version of the original Debian patch at
706 modified version of the original Debian patch at
703 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
707 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
704
708
705 2005-02-17 Fernando Perez <fperez@colorado.edu>
709 2005-02-17 Fernando Perez <fperez@colorado.edu>
706
710
707 * IPython/genutils.py (native_line_ends): Fix bug which would
711 * IPython/genutils.py (native_line_ends): Fix bug which would
708 cause improper line-ends under win32 b/c I was not opening files
712 cause improper line-ends under win32 b/c I was not opening files
709 in binary mode. Bug report and fix thanks to Ville.
713 in binary mode. Bug report and fix thanks to Ville.
710
714
711 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
715 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
712 trying to catch spurious foo[1] autocalls. My fix actually broke
716 trying to catch spurious foo[1] autocalls. My fix actually broke
713 ',/' autoquote/call with explicit escape (bad regexp).
717 ',/' autoquote/call with explicit escape (bad regexp).
714
718
715 2005-02-15 *** Released version 0.6.11
719 2005-02-15 *** Released version 0.6.11
716
720
717 2005-02-14 Fernando Perez <fperez@colorado.edu>
721 2005-02-14 Fernando Perez <fperez@colorado.edu>
718
722
719 * IPython/background_jobs.py: New background job management
723 * IPython/background_jobs.py: New background job management
720 subsystem. This is implemented via a new set of classes, and
724 subsystem. This is implemented via a new set of classes, and
721 IPython now provides a builtin 'jobs' object for background job
725 IPython now provides a builtin 'jobs' object for background job
722 execution. A convenience %bg magic serves as a lightweight
726 execution. A convenience %bg magic serves as a lightweight
723 frontend for starting the more common type of calls. This was
727 frontend for starting the more common type of calls. This was
724 inspired by discussions with B. Granger and the BackgroundCommand
728 inspired by discussions with B. Granger and the BackgroundCommand
725 class described in the book Python Scripting for Computational
729 class described in the book Python Scripting for Computational
726 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
730 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
727 (although ultimately no code from this text was used, as IPython's
731 (although ultimately no code from this text was used, as IPython's
728 system is a separate implementation).
732 system is a separate implementation).
729
733
730 * IPython/iplib.py (MagicCompleter.python_matches): add new option
734 * IPython/iplib.py (MagicCompleter.python_matches): add new option
731 to control the completion of single/double underscore names
735 to control the completion of single/double underscore names
732 separately. As documented in the example ipytonrc file, the
736 separately. As documented in the example ipytonrc file, the
733 readline_omit__names variable can now be set to 2, to omit even
737 readline_omit__names variable can now be set to 2, to omit even
734 single underscore names. Thanks to a patch by Brian Wong
738 single underscore names. Thanks to a patch by Brian Wong
735 <BrianWong-AT-AirgoNetworks.Com>.
739 <BrianWong-AT-AirgoNetworks.Com>.
736 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
740 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
737 be autocalled as foo([1]) if foo were callable. A problem for
741 be autocalled as foo([1]) if foo were callable. A problem for
738 things which are both callable and implement __getitem__.
742 things which are both callable and implement __getitem__.
739 (init_readline): Fix autoindentation for win32. Thanks to a patch
743 (init_readline): Fix autoindentation for win32. Thanks to a patch
740 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
744 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
741
745
742 2005-02-12 Fernando Perez <fperez@colorado.edu>
746 2005-02-12 Fernando Perez <fperez@colorado.edu>
743
747
744 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
748 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
745 which I had written long ago to sort out user error messages which
749 which I had written long ago to sort out user error messages which
746 may occur during startup. This seemed like a good idea initially,
750 may occur during startup. This seemed like a good idea initially,
747 but it has proven a disaster in retrospect. I don't want to
751 but it has proven a disaster in retrospect. I don't want to
748 change much code for now, so my fix is to set the internal 'debug'
752 change much code for now, so my fix is to set the internal 'debug'
749 flag to true everywhere, whose only job was precisely to control
753 flag to true everywhere, whose only job was precisely to control
750 this subsystem. This closes issue 28 (as well as avoiding all
754 this subsystem. This closes issue 28 (as well as avoiding all
751 sorts of strange hangups which occur from time to time).
755 sorts of strange hangups which occur from time to time).
752
756
753 2005-02-07 Fernando Perez <fperez@colorado.edu>
757 2005-02-07 Fernando Perez <fperez@colorado.edu>
754
758
755 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
759 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
756 previous call produced a syntax error.
760 previous call produced a syntax error.
757
761
758 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
762 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
759 classes without constructor.
763 classes without constructor.
760
764
761 2005-02-06 Fernando Perez <fperez@colorado.edu>
765 2005-02-06 Fernando Perez <fperez@colorado.edu>
762
766
763 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
767 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
764 completions with the results of each matcher, so we return results
768 completions with the results of each matcher, so we return results
765 to the user from all namespaces. This breaks with ipython
769 to the user from all namespaces. This breaks with ipython
766 tradition, but I think it's a nicer behavior. Now you get all
770 tradition, but I think it's a nicer behavior. Now you get all
767 possible completions listed, from all possible namespaces (python,
771 possible completions listed, from all possible namespaces (python,
768 filesystem, magics...) After a request by John Hunter
772 filesystem, magics...) After a request by John Hunter
769 <jdhunter-AT-nitace.bsd.uchicago.edu>.
773 <jdhunter-AT-nitace.bsd.uchicago.edu>.
770
774
771 2005-02-05 Fernando Perez <fperez@colorado.edu>
775 2005-02-05 Fernando Perez <fperez@colorado.edu>
772
776
773 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
777 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
774 the call had quote characters in it (the quotes were stripped).
778 the call had quote characters in it (the quotes were stripped).
775
779
776 2005-01-31 Fernando Perez <fperez@colorado.edu>
780 2005-01-31 Fernando Perez <fperez@colorado.edu>
777
781
778 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
782 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
779 Itpl.itpl() to make the code more robust against psyco
783 Itpl.itpl() to make the code more robust against psyco
780 optimizations.
784 optimizations.
781
785
782 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
786 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
783 of causing an exception. Quicker, cleaner.
787 of causing an exception. Quicker, cleaner.
784
788
785 2005-01-28 Fernando Perez <fperez@colorado.edu>
789 2005-01-28 Fernando Perez <fperez@colorado.edu>
786
790
787 * scripts/ipython_win_post_install.py (install): hardcode
791 * scripts/ipython_win_post_install.py (install): hardcode
788 sys.prefix+'python.exe' as the executable path. It turns out that
792 sys.prefix+'python.exe' as the executable path. It turns out that
789 during the post-installation run, sys.executable resolves to the
793 during the post-installation run, sys.executable resolves to the
790 name of the binary installer! I should report this as a distutils
794 name of the binary installer! I should report this as a distutils
791 bug, I think. I updated the .10 release with this tiny fix, to
795 bug, I think. I updated the .10 release with this tiny fix, to
792 avoid annoying the lists further.
796 avoid annoying the lists further.
793
797
794 2005-01-27 *** Released version 0.6.10
798 2005-01-27 *** Released version 0.6.10
795
799
796 2005-01-27 Fernando Perez <fperez@colorado.edu>
800 2005-01-27 Fernando Perez <fperez@colorado.edu>
797
801
798 * IPython/numutils.py (norm): Added 'inf' as optional name for
802 * IPython/numutils.py (norm): Added 'inf' as optional name for
799 L-infinity norm, included references to mathworld.com for vector
803 L-infinity norm, included references to mathworld.com for vector
800 norm definitions.
804 norm definitions.
801 (amin/amax): added amin/amax for array min/max. Similar to what
805 (amin/amax): added amin/amax for array min/max. Similar to what
802 pylab ships with after the recent reorganization of names.
806 pylab ships with after the recent reorganization of names.
803 (spike/spike_odd): removed deprecated spike/spike_odd functions.
807 (spike/spike_odd): removed deprecated spike/spike_odd functions.
804
808
805 * ipython.el: committed Alex's recent fixes and improvements.
809 * ipython.el: committed Alex's recent fixes and improvements.
806 Tested with python-mode from CVS, and it looks excellent. Since
810 Tested with python-mode from CVS, and it looks excellent. Since
807 python-mode hasn't released anything in a while, I'm temporarily
811 python-mode hasn't released anything in a while, I'm temporarily
808 putting a copy of today's CVS (v 4.70) of python-mode in:
812 putting a copy of today's CVS (v 4.70) of python-mode in:
809 http://ipython.scipy.org/tmp/python-mode.el
813 http://ipython.scipy.org/tmp/python-mode.el
810
814
811 * scripts/ipython_win_post_install.py (install): Win32 fix to use
815 * scripts/ipython_win_post_install.py (install): Win32 fix to use
812 sys.executable for the executable name, instead of assuming it's
816 sys.executable for the executable name, instead of assuming it's
813 called 'python.exe' (the post-installer would have produced broken
817 called 'python.exe' (the post-installer would have produced broken
814 setups on systems with a differently named python binary).
818 setups on systems with a differently named python binary).
815
819
816 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
820 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
817 references to os.linesep, to make the code more
821 references to os.linesep, to make the code more
818 platform-independent. This is also part of the win32 coloring
822 platform-independent. This is also part of the win32 coloring
819 fixes.
823 fixes.
820
824
821 * IPython/genutils.py (page_dumb): Remove attempts to chop long
825 * IPython/genutils.py (page_dumb): Remove attempts to chop long
822 lines, which actually cause coloring bugs because the length of
826 lines, which actually cause coloring bugs because the length of
823 the line is very difficult to correctly compute with embedded
827 the line is very difficult to correctly compute with embedded
824 escapes. This was the source of all the coloring problems under
828 escapes. This was the source of all the coloring problems under
825 Win32. I think that _finally_, Win32 users have a properly
829 Win32. I think that _finally_, Win32 users have a properly
826 working ipython in all respects. This would never have happened
830 working ipython in all respects. This would never have happened
827 if not for Gary Bishop and Viktor Ransmayr's great help and work.
831 if not for Gary Bishop and Viktor Ransmayr's great help and work.
828
832
829 2005-01-26 *** Released version 0.6.9
833 2005-01-26 *** Released version 0.6.9
830
834
831 2005-01-25 Fernando Perez <fperez@colorado.edu>
835 2005-01-25 Fernando Perez <fperez@colorado.edu>
832
836
833 * setup.py: finally, we have a true Windows installer, thanks to
837 * setup.py: finally, we have a true Windows installer, thanks to
834 the excellent work of Viktor Ransmayr
838 the excellent work of Viktor Ransmayr
835 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
839 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
836 Windows users. The setup routine is quite a bit cleaner thanks to
840 Windows users. The setup routine is quite a bit cleaner thanks to
837 this, and the post-install script uses the proper functions to
841 this, and the post-install script uses the proper functions to
838 allow a clean de-installation using the standard Windows Control
842 allow a clean de-installation using the standard Windows Control
839 Panel.
843 Panel.
840
844
841 * IPython/genutils.py (get_home_dir): changed to use the $HOME
845 * IPython/genutils.py (get_home_dir): changed to use the $HOME
842 environment variable under all OSes (including win32) if
846 environment variable under all OSes (including win32) if
843 available. This will give consistency to win32 users who have set
847 available. This will give consistency to win32 users who have set
844 this variable for any reason. If os.environ['HOME'] fails, the
848 this variable for any reason. If os.environ['HOME'] fails, the
845 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
849 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
846
850
847 2005-01-24 Fernando Perez <fperez@colorado.edu>
851 2005-01-24 Fernando Perez <fperez@colorado.edu>
848
852
849 * IPython/numutils.py (empty_like): add empty_like(), similar to
853 * IPython/numutils.py (empty_like): add empty_like(), similar to
850 zeros_like() but taking advantage of the new empty() Numeric routine.
854 zeros_like() but taking advantage of the new empty() Numeric routine.
851
855
852 2005-01-23 *** Released version 0.6.8
856 2005-01-23 *** Released version 0.6.8
853
857
854 2005-01-22 Fernando Perez <fperez@colorado.edu>
858 2005-01-22 Fernando Perez <fperez@colorado.edu>
855
859
856 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
860 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
857 automatic show() calls. After discussing things with JDH, it
861 automatic show() calls. After discussing things with JDH, it
858 turns out there are too many corner cases where this can go wrong.
862 turns out there are too many corner cases where this can go wrong.
859 It's best not to try to be 'too smart', and simply have ipython
863 It's best not to try to be 'too smart', and simply have ipython
860 reproduce as much as possible the default behavior of a normal
864 reproduce as much as possible the default behavior of a normal
861 python shell.
865 python shell.
862
866
863 * IPython/iplib.py (InteractiveShell.__init__): Modified the
867 * IPython/iplib.py (InteractiveShell.__init__): Modified the
864 line-splitting regexp and _prefilter() to avoid calling getattr()
868 line-splitting regexp and _prefilter() to avoid calling getattr()
865 on assignments. This closes
869 on assignments. This closes
866 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
870 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
867 readline uses getattr(), so a simple <TAB> keypress is still
871 readline uses getattr(), so a simple <TAB> keypress is still
868 enough to trigger getattr() calls on an object.
872 enough to trigger getattr() calls on an object.
869
873
870 2005-01-21 Fernando Perez <fperez@colorado.edu>
874 2005-01-21 Fernando Perez <fperez@colorado.edu>
871
875
872 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
876 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
873 docstring under pylab so it doesn't mask the original.
877 docstring under pylab so it doesn't mask the original.
874
878
875 2005-01-21 *** Released version 0.6.7
879 2005-01-21 *** Released version 0.6.7
876
880
877 2005-01-21 Fernando Perez <fperez@colorado.edu>
881 2005-01-21 Fernando Perez <fperez@colorado.edu>
878
882
879 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
883 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
880 signal handling for win32 users in multithreaded mode.
884 signal handling for win32 users in multithreaded mode.
881
885
882 2005-01-17 Fernando Perez <fperez@colorado.edu>
886 2005-01-17 Fernando Perez <fperez@colorado.edu>
883
887
884 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
888 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
885 instances with no __init__. After a crash report by Norbert Nemec
889 instances with no __init__. After a crash report by Norbert Nemec
886 <Norbert-AT-nemec-online.de>.
890 <Norbert-AT-nemec-online.de>.
887
891
888 2005-01-14 Fernando Perez <fperez@colorado.edu>
892 2005-01-14 Fernando Perez <fperez@colorado.edu>
889
893
890 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
894 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
891 names for verbose exceptions, when multiple dotted names and the
895 names for verbose exceptions, when multiple dotted names and the
892 'parent' object were present on the same line.
896 'parent' object were present on the same line.
893
897
894 2005-01-11 Fernando Perez <fperez@colorado.edu>
898 2005-01-11 Fernando Perez <fperez@colorado.edu>
895
899
896 * IPython/genutils.py (flag_calls): new utility to trap and flag
900 * IPython/genutils.py (flag_calls): new utility to trap and flag
897 calls in functions. I need it to clean up matplotlib support.
901 calls in functions. I need it to clean up matplotlib support.
898 Also removed some deprecated code in genutils.
902 Also removed some deprecated code in genutils.
899
903
900 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
904 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
901 that matplotlib scripts called with %run, which don't call show()
905 that matplotlib scripts called with %run, which don't call show()
902 themselves, still have their plotting windows open.
906 themselves, still have their plotting windows open.
903
907
904 2005-01-05 Fernando Perez <fperez@colorado.edu>
908 2005-01-05 Fernando Perez <fperez@colorado.edu>
905
909
906 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
910 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
907 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
911 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
908
912
909 2004-12-19 Fernando Perez <fperez@colorado.edu>
913 2004-12-19 Fernando Perez <fperez@colorado.edu>
910
914
911 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
915 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
912 parent_runcode, which was an eyesore. The same result can be
916 parent_runcode, which was an eyesore. The same result can be
913 obtained with Python's regular superclass mechanisms.
917 obtained with Python's regular superclass mechanisms.
914
918
915 2004-12-17 Fernando Perez <fperez@colorado.edu>
919 2004-12-17 Fernando Perez <fperez@colorado.edu>
916
920
917 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
921 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
918 reported by Prabhu.
922 reported by Prabhu.
919 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
923 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
920 sys.stderr) instead of explicitly calling sys.stderr. This helps
924 sys.stderr) instead of explicitly calling sys.stderr. This helps
921 maintain our I/O abstractions clean, for future GUI embeddings.
925 maintain our I/O abstractions clean, for future GUI embeddings.
922
926
923 * IPython/genutils.py (info): added new utility for sys.stderr
927 * IPython/genutils.py (info): added new utility for sys.stderr
924 unified info message handling (thin wrapper around warn()).
928 unified info message handling (thin wrapper around warn()).
925
929
926 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
930 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
927 composite (dotted) names on verbose exceptions.
931 composite (dotted) names on verbose exceptions.
928 (VerboseTB.nullrepr): harden against another kind of errors which
932 (VerboseTB.nullrepr): harden against another kind of errors which
929 Python's inspect module can trigger, and which were crashing
933 Python's inspect module can trigger, and which were crashing
930 IPython. Thanks to a report by Marco Lombardi
934 IPython. Thanks to a report by Marco Lombardi
931 <mlombard-AT-ma010192.hq.eso.org>.
935 <mlombard-AT-ma010192.hq.eso.org>.
932
936
933 2004-12-13 *** Released version 0.6.6
937 2004-12-13 *** Released version 0.6.6
934
938
935 2004-12-12 Fernando Perez <fperez@colorado.edu>
939 2004-12-12 Fernando Perez <fperez@colorado.edu>
936
940
937 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
941 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
938 generated by pygtk upon initialization if it was built without
942 generated by pygtk upon initialization if it was built without
939 threads (for matplotlib users). After a crash reported by
943 threads (for matplotlib users). After a crash reported by
940 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
944 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
941
945
942 * IPython/ipmaker.py (make_IPython): fix small bug in the
946 * IPython/ipmaker.py (make_IPython): fix small bug in the
943 import_some parameter for multiple imports.
947 import_some parameter for multiple imports.
944
948
945 * IPython/iplib.py (ipmagic): simplified the interface of
949 * IPython/iplib.py (ipmagic): simplified the interface of
946 ipmagic() to take a single string argument, just as it would be
950 ipmagic() to take a single string argument, just as it would be
947 typed at the IPython cmd line.
951 typed at the IPython cmd line.
948 (ipalias): Added new ipalias() with an interface identical to
952 (ipalias): Added new ipalias() with an interface identical to
949 ipmagic(). This completes exposing a pure python interface to the
953 ipmagic(). This completes exposing a pure python interface to the
950 alias and magic system, which can be used in loops or more complex
954 alias and magic system, which can be used in loops or more complex
951 code where IPython's automatic line mangling is not active.
955 code where IPython's automatic line mangling is not active.
952
956
953 * IPython/genutils.py (timing): changed interface of timing to
957 * IPython/genutils.py (timing): changed interface of timing to
954 simply run code once, which is the most common case. timings()
958 simply run code once, which is the most common case. timings()
955 remains unchanged, for the cases where you want multiple runs.
959 remains unchanged, for the cases where you want multiple runs.
956
960
957 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
961 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
958 bug where Python2.2 crashes with exec'ing code which does not end
962 bug where Python2.2 crashes with exec'ing code which does not end
959 in a single newline. Python 2.3 is OK, so I hadn't noticed this
963 in a single newline. Python 2.3 is OK, so I hadn't noticed this
960 before.
964 before.
961
965
962 2004-12-10 Fernando Perez <fperez@colorado.edu>
966 2004-12-10 Fernando Perez <fperez@colorado.edu>
963
967
964 * IPython/Magic.py (Magic.magic_prun): changed name of option from
968 * IPython/Magic.py (Magic.magic_prun): changed name of option from
965 -t to -T, to accomodate the new -t flag in %run (the %run and
969 -t to -T, to accomodate the new -t flag in %run (the %run and
966 %prun options are kind of intermixed, and it's not easy to change
970 %prun options are kind of intermixed, and it's not easy to change
967 this with the limitations of python's getopt).
971 this with the limitations of python's getopt).
968
972
969 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
973 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
970 the execution of scripts. It's not as fine-tuned as timeit.py,
974 the execution of scripts. It's not as fine-tuned as timeit.py,
971 but it works from inside ipython (and under 2.2, which lacks
975 but it works from inside ipython (and under 2.2, which lacks
972 timeit.py). Optionally a number of runs > 1 can be given for
976 timeit.py). Optionally a number of runs > 1 can be given for
973 timing very short-running code.
977 timing very short-running code.
974
978
975 * IPython/genutils.py (uniq_stable): new routine which returns a
979 * IPython/genutils.py (uniq_stable): new routine which returns a
976 list of unique elements in any iterable, but in stable order of
980 list of unique elements in any iterable, but in stable order of
977 appearance. I needed this for the ultraTB fixes, and it's a handy
981 appearance. I needed this for the ultraTB fixes, and it's a handy
978 utility.
982 utility.
979
983
980 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
984 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
981 dotted names in Verbose exceptions. This had been broken since
985 dotted names in Verbose exceptions. This had been broken since
982 the very start, now x.y will properly be printed in a Verbose
986 the very start, now x.y will properly be printed in a Verbose
983 traceback, instead of x being shown and y appearing always as an
987 traceback, instead of x being shown and y appearing always as an
984 'undefined global'. Getting this to work was a bit tricky,
988 'undefined global'. Getting this to work was a bit tricky,
985 because by default python tokenizers are stateless. Saved by
989 because by default python tokenizers are stateless. Saved by
986 python's ability to easily add a bit of state to an arbitrary
990 python's ability to easily add a bit of state to an arbitrary
987 function (without needing to build a full-blown callable object).
991 function (without needing to build a full-blown callable object).
988
992
989 Also big cleanup of this code, which had horrendous runtime
993 Also big cleanup of this code, which had horrendous runtime
990 lookups of zillions of attributes for colorization. Moved all
994 lookups of zillions of attributes for colorization. Moved all
991 this code into a few templates, which make it cleaner and quicker.
995 this code into a few templates, which make it cleaner and quicker.
992
996
993 Printout quality was also improved for Verbose exceptions: one
997 Printout quality was also improved for Verbose exceptions: one
994 variable per line, and memory addresses are printed (this can be
998 variable per line, and memory addresses are printed (this can be
995 quite handy in nasty debugging situations, which is what Verbose
999 quite handy in nasty debugging situations, which is what Verbose
996 is for).
1000 is for).
997
1001
998 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1002 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
999 the command line as scripts to be loaded by embedded instances.
1003 the command line as scripts to be loaded by embedded instances.
1000 Doing so has the potential for an infinite recursion if there are
1004 Doing so has the potential for an infinite recursion if there are
1001 exceptions thrown in the process. This fixes a strange crash
1005 exceptions thrown in the process. This fixes a strange crash
1002 reported by Philippe MULLER <muller-AT-irit.fr>.
1006 reported by Philippe MULLER <muller-AT-irit.fr>.
1003
1007
1004 2004-12-09 Fernando Perez <fperez@colorado.edu>
1008 2004-12-09 Fernando Perez <fperez@colorado.edu>
1005
1009
1006 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1010 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1007 to reflect new names in matplotlib, which now expose the
1011 to reflect new names in matplotlib, which now expose the
1008 matlab-compatible interface via a pylab module instead of the
1012 matlab-compatible interface via a pylab module instead of the
1009 'matlab' name. The new code is backwards compatible, so users of
1013 'matlab' name. The new code is backwards compatible, so users of
1010 all matplotlib versions are OK. Patch by J. Hunter.
1014 all matplotlib versions are OK. Patch by J. Hunter.
1011
1015
1012 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1016 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1013 of __init__ docstrings for instances (class docstrings are already
1017 of __init__ docstrings for instances (class docstrings are already
1014 automatically printed). Instances with customized docstrings
1018 automatically printed). Instances with customized docstrings
1015 (indep. of the class) are also recognized and all 3 separate
1019 (indep. of the class) are also recognized and all 3 separate
1016 docstrings are printed (instance, class, constructor). After some
1020 docstrings are printed (instance, class, constructor). After some
1017 comments/suggestions by J. Hunter.
1021 comments/suggestions by J. Hunter.
1018
1022
1019 2004-12-05 Fernando Perez <fperez@colorado.edu>
1023 2004-12-05 Fernando Perez <fperez@colorado.edu>
1020
1024
1021 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1025 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1022 warnings when tab-completion fails and triggers an exception.
1026 warnings when tab-completion fails and triggers an exception.
1023
1027
1024 2004-12-03 Fernando Perez <fperez@colorado.edu>
1028 2004-12-03 Fernando Perez <fperez@colorado.edu>
1025
1029
1026 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1030 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1027 be triggered when using 'run -p'. An incorrect option flag was
1031 be triggered when using 'run -p'. An incorrect option flag was
1028 being set ('d' instead of 'D').
1032 being set ('d' instead of 'D').
1029 (manpage): fix missing escaped \- sign.
1033 (manpage): fix missing escaped \- sign.
1030
1034
1031 2004-11-30 *** Released version 0.6.5
1035 2004-11-30 *** Released version 0.6.5
1032
1036
1033 2004-11-30 Fernando Perez <fperez@colorado.edu>
1037 2004-11-30 Fernando Perez <fperez@colorado.edu>
1034
1038
1035 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1039 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1036 setting with -d option.
1040 setting with -d option.
1037
1041
1038 * setup.py (docfiles): Fix problem where the doc glob I was using
1042 * setup.py (docfiles): Fix problem where the doc glob I was using
1039 was COMPLETELY BROKEN. It was giving the right files by pure
1043 was COMPLETELY BROKEN. It was giving the right files by pure
1040 accident, but failed once I tried to include ipython.el. Note:
1044 accident, but failed once I tried to include ipython.el. Note:
1041 glob() does NOT allow you to do exclusion on multiple endings!
1045 glob() does NOT allow you to do exclusion on multiple endings!
1042
1046
1043 2004-11-29 Fernando Perez <fperez@colorado.edu>
1047 2004-11-29 Fernando Perez <fperez@colorado.edu>
1044
1048
1045 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1049 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1046 the manpage as the source. Better formatting & consistency.
1050 the manpage as the source. Better formatting & consistency.
1047
1051
1048 * IPython/Magic.py (magic_run): Added new -d option, to run
1052 * IPython/Magic.py (magic_run): Added new -d option, to run
1049 scripts under the control of the python pdb debugger. Note that
1053 scripts under the control of the python pdb debugger. Note that
1050 this required changing the %prun option -d to -D, to avoid a clash
1054 this required changing the %prun option -d to -D, to avoid a clash
1051 (since %run must pass options to %prun, and getopt is too dumb to
1055 (since %run must pass options to %prun, and getopt is too dumb to
1052 handle options with string values with embedded spaces). Thanks
1056 handle options with string values with embedded spaces). Thanks
1053 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1057 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1054 (magic_who_ls): added type matching to %who and %whos, so that one
1058 (magic_who_ls): added type matching to %who and %whos, so that one
1055 can filter their output to only include variables of certain
1059 can filter their output to only include variables of certain
1056 types. Another suggestion by Matthew.
1060 types. Another suggestion by Matthew.
1057 (magic_whos): Added memory summaries in kb and Mb for arrays.
1061 (magic_whos): Added memory summaries in kb and Mb for arrays.
1058 (magic_who): Improve formatting (break lines every 9 vars).
1062 (magic_who): Improve formatting (break lines every 9 vars).
1059
1063
1060 2004-11-28 Fernando Perez <fperez@colorado.edu>
1064 2004-11-28 Fernando Perez <fperez@colorado.edu>
1061
1065
1062 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1066 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1063 cache when empty lines were present.
1067 cache when empty lines were present.
1064
1068
1065 2004-11-24 Fernando Perez <fperez@colorado.edu>
1069 2004-11-24 Fernando Perez <fperez@colorado.edu>
1066
1070
1067 * IPython/usage.py (__doc__): document the re-activated threading
1071 * IPython/usage.py (__doc__): document the re-activated threading
1068 options for WX and GTK.
1072 options for WX and GTK.
1069
1073
1070 2004-11-23 Fernando Perez <fperez@colorado.edu>
1074 2004-11-23 Fernando Perez <fperez@colorado.edu>
1071
1075
1072 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1076 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1073 the -wthread and -gthread options, along with a new -tk one to try
1077 the -wthread and -gthread options, along with a new -tk one to try
1074 and coordinate Tk threading with wx/gtk. The tk support is very
1078 and coordinate Tk threading with wx/gtk. The tk support is very
1075 platform dependent, since it seems to require Tcl and Tk to be
1079 platform dependent, since it seems to require Tcl and Tk to be
1076 built with threads (Fedora1/2 appears NOT to have it, but in
1080 built with threads (Fedora1/2 appears NOT to have it, but in
1077 Prabhu's Debian boxes it works OK). But even with some Tk
1081 Prabhu's Debian boxes it works OK). But even with some Tk
1078 limitations, this is a great improvement.
1082 limitations, this is a great improvement.
1079
1083
1080 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1084 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1081 info in user prompts. Patch by Prabhu.
1085 info in user prompts. Patch by Prabhu.
1082
1086
1083 2004-11-18 Fernando Perez <fperez@colorado.edu>
1087 2004-11-18 Fernando Perez <fperez@colorado.edu>
1084
1088
1085 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1089 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1086 EOFErrors and bail, to avoid infinite loops if a non-terminating
1090 EOFErrors and bail, to avoid infinite loops if a non-terminating
1087 file is fed into ipython. Patch submitted in issue 19 by user,
1091 file is fed into ipython. Patch submitted in issue 19 by user,
1088 many thanks.
1092 many thanks.
1089
1093
1090 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1094 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1091 autoquote/parens in continuation prompts, which can cause lots of
1095 autoquote/parens in continuation prompts, which can cause lots of
1092 problems. Closes roundup issue 20.
1096 problems. Closes roundup issue 20.
1093
1097
1094 2004-11-17 Fernando Perez <fperez@colorado.edu>
1098 2004-11-17 Fernando Perez <fperez@colorado.edu>
1095
1099
1096 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1100 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1097 reported as debian bug #280505. I'm not sure my local changelog
1101 reported as debian bug #280505. I'm not sure my local changelog
1098 entry has the proper debian format (Jack?).
1102 entry has the proper debian format (Jack?).
1099
1103
1100 2004-11-08 *** Released version 0.6.4
1104 2004-11-08 *** Released version 0.6.4
1101
1105
1102 2004-11-08 Fernando Perez <fperez@colorado.edu>
1106 2004-11-08 Fernando Perez <fperez@colorado.edu>
1103
1107
1104 * IPython/iplib.py (init_readline): Fix exit message for Windows
1108 * IPython/iplib.py (init_readline): Fix exit message for Windows
1105 when readline is active. Thanks to a report by Eric Jones
1109 when readline is active. Thanks to a report by Eric Jones
1106 <eric-AT-enthought.com>.
1110 <eric-AT-enthought.com>.
1107
1111
1108 2004-11-07 Fernando Perez <fperez@colorado.edu>
1112 2004-11-07 Fernando Perez <fperez@colorado.edu>
1109
1113
1110 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1114 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1111 sometimes seen by win2k/cygwin users.
1115 sometimes seen by win2k/cygwin users.
1112
1116
1113 2004-11-06 Fernando Perez <fperez@colorado.edu>
1117 2004-11-06 Fernando Perez <fperez@colorado.edu>
1114
1118
1115 * IPython/iplib.py (interact): Change the handling of %Exit from
1119 * IPython/iplib.py (interact): Change the handling of %Exit from
1116 trying to propagate a SystemExit to an internal ipython flag.
1120 trying to propagate a SystemExit to an internal ipython flag.
1117 This is less elegant than using Python's exception mechanism, but
1121 This is less elegant than using Python's exception mechanism, but
1118 I can't get that to work reliably with threads, so under -pylab
1122 I can't get that to work reliably with threads, so under -pylab
1119 %Exit was hanging IPython. Cross-thread exception handling is
1123 %Exit was hanging IPython. Cross-thread exception handling is
1120 really a bitch. Thaks to a bug report by Stephen Walton
1124 really a bitch. Thaks to a bug report by Stephen Walton
1121 <stephen.walton-AT-csun.edu>.
1125 <stephen.walton-AT-csun.edu>.
1122
1126
1123 2004-11-04 Fernando Perez <fperez@colorado.edu>
1127 2004-11-04 Fernando Perez <fperez@colorado.edu>
1124
1128
1125 * IPython/iplib.py (raw_input_original): store a pointer to the
1129 * IPython/iplib.py (raw_input_original): store a pointer to the
1126 true raw_input to harden against code which can modify it
1130 true raw_input to harden against code which can modify it
1127 (wx.py.PyShell does this and would otherwise crash ipython).
1131 (wx.py.PyShell does this and would otherwise crash ipython).
1128 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1132 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1129
1133
1130 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1134 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1131 Ctrl-C problem, which does not mess up the input line.
1135 Ctrl-C problem, which does not mess up the input line.
1132
1136
1133 2004-11-03 Fernando Perez <fperez@colorado.edu>
1137 2004-11-03 Fernando Perez <fperez@colorado.edu>
1134
1138
1135 * IPython/Release.py: Changed licensing to BSD, in all files.
1139 * IPython/Release.py: Changed licensing to BSD, in all files.
1136 (name): lowercase name for tarball/RPM release.
1140 (name): lowercase name for tarball/RPM release.
1137
1141
1138 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1142 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1139 use throughout ipython.
1143 use throughout ipython.
1140
1144
1141 * IPython/Magic.py (Magic._ofind): Switch to using the new
1145 * IPython/Magic.py (Magic._ofind): Switch to using the new
1142 OInspect.getdoc() function.
1146 OInspect.getdoc() function.
1143
1147
1144 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1148 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1145 of the line currently being canceled via Ctrl-C. It's extremely
1149 of the line currently being canceled via Ctrl-C. It's extremely
1146 ugly, but I don't know how to do it better (the problem is one of
1150 ugly, but I don't know how to do it better (the problem is one of
1147 handling cross-thread exceptions).
1151 handling cross-thread exceptions).
1148
1152
1149 2004-10-28 Fernando Perez <fperez@colorado.edu>
1153 2004-10-28 Fernando Perez <fperez@colorado.edu>
1150
1154
1151 * IPython/Shell.py (signal_handler): add signal handlers to trap
1155 * IPython/Shell.py (signal_handler): add signal handlers to trap
1152 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1156 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1153 report by Francesc Alted.
1157 report by Francesc Alted.
1154
1158
1155 2004-10-21 Fernando Perez <fperez@colorado.edu>
1159 2004-10-21 Fernando Perez <fperez@colorado.edu>
1156
1160
1157 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1161 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1158 to % for pysh syntax extensions.
1162 to % for pysh syntax extensions.
1159
1163
1160 2004-10-09 Fernando Perez <fperez@colorado.edu>
1164 2004-10-09 Fernando Perez <fperez@colorado.edu>
1161
1165
1162 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1166 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1163 arrays to print a more useful summary, without calling str(arr).
1167 arrays to print a more useful summary, without calling str(arr).
1164 This avoids the problem of extremely lengthy computations which
1168 This avoids the problem of extremely lengthy computations which
1165 occur if arr is large, and appear to the user as a system lockup
1169 occur if arr is large, and appear to the user as a system lockup
1166 with 100% cpu activity. After a suggestion by Kristian Sandberg
1170 with 100% cpu activity. After a suggestion by Kristian Sandberg
1167 <Kristian.Sandberg@colorado.edu>.
1171 <Kristian.Sandberg@colorado.edu>.
1168 (Magic.__init__): fix bug in global magic escapes not being
1172 (Magic.__init__): fix bug in global magic escapes not being
1169 correctly set.
1173 correctly set.
1170
1174
1171 2004-10-08 Fernando Perez <fperez@colorado.edu>
1175 2004-10-08 Fernando Perez <fperez@colorado.edu>
1172
1176
1173 * IPython/Magic.py (__license__): change to absolute imports of
1177 * IPython/Magic.py (__license__): change to absolute imports of
1174 ipython's own internal packages, to start adapting to the absolute
1178 ipython's own internal packages, to start adapting to the absolute
1175 import requirement of PEP-328.
1179 import requirement of PEP-328.
1176
1180
1177 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1181 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1178 files, and standardize author/license marks through the Release
1182 files, and standardize author/license marks through the Release
1179 module instead of having per/file stuff (except for files with
1183 module instead of having per/file stuff (except for files with
1180 particular licenses, like the MIT/PSF-licensed codes).
1184 particular licenses, like the MIT/PSF-licensed codes).
1181
1185
1182 * IPython/Debugger.py: remove dead code for python 2.1
1186 * IPython/Debugger.py: remove dead code for python 2.1
1183
1187
1184 2004-10-04 Fernando Perez <fperez@colorado.edu>
1188 2004-10-04 Fernando Perez <fperez@colorado.edu>
1185
1189
1186 * IPython/iplib.py (ipmagic): New function for accessing magics
1190 * IPython/iplib.py (ipmagic): New function for accessing magics
1187 via a normal python function call.
1191 via a normal python function call.
1188
1192
1189 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1193 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1190 from '@' to '%', to accomodate the new @decorator syntax of python
1194 from '@' to '%', to accomodate the new @decorator syntax of python
1191 2.4.
1195 2.4.
1192
1196
1193 2004-09-29 Fernando Perez <fperez@colorado.edu>
1197 2004-09-29 Fernando Perez <fperez@colorado.edu>
1194
1198
1195 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1199 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1196 matplotlib.use to prevent running scripts which try to switch
1200 matplotlib.use to prevent running scripts which try to switch
1197 interactive backends from within ipython. This will just crash
1201 interactive backends from within ipython. This will just crash
1198 the python interpreter, so we can't allow it (but a detailed error
1202 the python interpreter, so we can't allow it (but a detailed error
1199 is given to the user).
1203 is given to the user).
1200
1204
1201 2004-09-28 Fernando Perez <fperez@colorado.edu>
1205 2004-09-28 Fernando Perez <fperez@colorado.edu>
1202
1206
1203 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1207 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1204 matplotlib-related fixes so that using @run with non-matplotlib
1208 matplotlib-related fixes so that using @run with non-matplotlib
1205 scripts doesn't pop up spurious plot windows. This requires
1209 scripts doesn't pop up spurious plot windows. This requires
1206 matplotlib >= 0.63, where I had to make some changes as well.
1210 matplotlib >= 0.63, where I had to make some changes as well.
1207
1211
1208 * IPython/ipmaker.py (make_IPython): update version requirement to
1212 * IPython/ipmaker.py (make_IPython): update version requirement to
1209 python 2.2.
1213 python 2.2.
1210
1214
1211 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1215 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1212 banner arg for embedded customization.
1216 banner arg for embedded customization.
1213
1217
1214 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1218 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1215 explicit uses of __IP as the IPython's instance name. Now things
1219 explicit uses of __IP as the IPython's instance name. Now things
1216 are properly handled via the shell.name value. The actual code
1220 are properly handled via the shell.name value. The actual code
1217 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1221 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1218 is much better than before. I'll clean things completely when the
1222 is much better than before. I'll clean things completely when the
1219 magic stuff gets a real overhaul.
1223 magic stuff gets a real overhaul.
1220
1224
1221 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1225 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1222 minor changes to debian dir.
1226 minor changes to debian dir.
1223
1227
1224 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1228 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1225 pointer to the shell itself in the interactive namespace even when
1229 pointer to the shell itself in the interactive namespace even when
1226 a user-supplied dict is provided. This is needed for embedding
1230 a user-supplied dict is provided. This is needed for embedding
1227 purposes (found by tests with Michel Sanner).
1231 purposes (found by tests with Michel Sanner).
1228
1232
1229 2004-09-27 Fernando Perez <fperez@colorado.edu>
1233 2004-09-27 Fernando Perez <fperez@colorado.edu>
1230
1234
1231 * IPython/UserConfig/ipythonrc: remove []{} from
1235 * IPython/UserConfig/ipythonrc: remove []{} from
1232 readline_remove_delims, so that things like [modname.<TAB> do
1236 readline_remove_delims, so that things like [modname.<TAB> do
1233 proper completion. This disables [].TAB, but that's a less common
1237 proper completion. This disables [].TAB, but that's a less common
1234 case than module names in list comprehensions, for example.
1238 case than module names in list comprehensions, for example.
1235 Thanks to a report by Andrea Riciputi.
1239 Thanks to a report by Andrea Riciputi.
1236
1240
1237 2004-09-09 Fernando Perez <fperez@colorado.edu>
1241 2004-09-09 Fernando Perez <fperez@colorado.edu>
1238
1242
1239 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1243 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1240 blocking problems in win32 and osx. Fix by John.
1244 blocking problems in win32 and osx. Fix by John.
1241
1245
1242 2004-09-08 Fernando Perez <fperez@colorado.edu>
1246 2004-09-08 Fernando Perez <fperez@colorado.edu>
1243
1247
1244 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1248 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1245 for Win32 and OSX. Fix by John Hunter.
1249 for Win32 and OSX. Fix by John Hunter.
1246
1250
1247 2004-08-30 *** Released version 0.6.3
1251 2004-08-30 *** Released version 0.6.3
1248
1252
1249 2004-08-30 Fernando Perez <fperez@colorado.edu>
1253 2004-08-30 Fernando Perez <fperez@colorado.edu>
1250
1254
1251 * setup.py (isfile): Add manpages to list of dependent files to be
1255 * setup.py (isfile): Add manpages to list of dependent files to be
1252 updated.
1256 updated.
1253
1257
1254 2004-08-27 Fernando Perez <fperez@colorado.edu>
1258 2004-08-27 Fernando Perez <fperez@colorado.edu>
1255
1259
1256 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1260 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1257 for now. They don't really work with standalone WX/GTK code
1261 for now. They don't really work with standalone WX/GTK code
1258 (though matplotlib IS working fine with both of those backends).
1262 (though matplotlib IS working fine with both of those backends).
1259 This will neeed much more testing. I disabled most things with
1263 This will neeed much more testing. I disabled most things with
1260 comments, so turning it back on later should be pretty easy.
1264 comments, so turning it back on later should be pretty easy.
1261
1265
1262 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1266 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1263 autocalling of expressions like r'foo', by modifying the line
1267 autocalling of expressions like r'foo', by modifying the line
1264 split regexp. Closes
1268 split regexp. Closes
1265 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1269 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1266 Riley <ipythonbugs-AT-sabi.net>.
1270 Riley <ipythonbugs-AT-sabi.net>.
1267 (InteractiveShell.mainloop): honor --nobanner with banner
1271 (InteractiveShell.mainloop): honor --nobanner with banner
1268 extensions.
1272 extensions.
1269
1273
1270 * IPython/Shell.py: Significant refactoring of all classes, so
1274 * IPython/Shell.py: Significant refactoring of all classes, so
1271 that we can really support ALL matplotlib backends and threading
1275 that we can really support ALL matplotlib backends and threading
1272 models (John spotted a bug with Tk which required this). Now we
1276 models (John spotted a bug with Tk which required this). Now we
1273 should support single-threaded, WX-threads and GTK-threads, both
1277 should support single-threaded, WX-threads and GTK-threads, both
1274 for generic code and for matplotlib.
1278 for generic code and for matplotlib.
1275
1279
1276 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1280 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1277 -pylab, to simplify things for users. Will also remove the pylab
1281 -pylab, to simplify things for users. Will also remove the pylab
1278 profile, since now all of matplotlib configuration is directly
1282 profile, since now all of matplotlib configuration is directly
1279 handled here. This also reduces startup time.
1283 handled here. This also reduces startup time.
1280
1284
1281 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1285 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1282 shell wasn't being correctly called. Also in IPShellWX.
1286 shell wasn't being correctly called. Also in IPShellWX.
1283
1287
1284 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1288 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1285 fine-tune banner.
1289 fine-tune banner.
1286
1290
1287 * IPython/numutils.py (spike): Deprecate these spike functions,
1291 * IPython/numutils.py (spike): Deprecate these spike functions,
1288 delete (long deprecated) gnuplot_exec handler.
1292 delete (long deprecated) gnuplot_exec handler.
1289
1293
1290 2004-08-26 Fernando Perez <fperez@colorado.edu>
1294 2004-08-26 Fernando Perez <fperez@colorado.edu>
1291
1295
1292 * ipython.1: Update for threading options, plus some others which
1296 * ipython.1: Update for threading options, plus some others which
1293 were missing.
1297 were missing.
1294
1298
1295 * IPython/ipmaker.py (__call__): Added -wthread option for
1299 * IPython/ipmaker.py (__call__): Added -wthread option for
1296 wxpython thread handling. Make sure threading options are only
1300 wxpython thread handling. Make sure threading options are only
1297 valid at the command line.
1301 valid at the command line.
1298
1302
1299 * scripts/ipython: moved shell selection into a factory function
1303 * scripts/ipython: moved shell selection into a factory function
1300 in Shell.py, to keep the starter script to a minimum.
1304 in Shell.py, to keep the starter script to a minimum.
1301
1305
1302 2004-08-25 Fernando Perez <fperez@colorado.edu>
1306 2004-08-25 Fernando Perez <fperez@colorado.edu>
1303
1307
1304 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1308 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1305 John. Along with some recent changes he made to matplotlib, the
1309 John. Along with some recent changes he made to matplotlib, the
1306 next versions of both systems should work very well together.
1310 next versions of both systems should work very well together.
1307
1311
1308 2004-08-24 Fernando Perez <fperez@colorado.edu>
1312 2004-08-24 Fernando Perez <fperez@colorado.edu>
1309
1313
1310 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1314 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1311 tried to switch the profiling to using hotshot, but I'm getting
1315 tried to switch the profiling to using hotshot, but I'm getting
1312 strange errors from prof.runctx() there. I may be misreading the
1316 strange errors from prof.runctx() there. I may be misreading the
1313 docs, but it looks weird. For now the profiling code will
1317 docs, but it looks weird. For now the profiling code will
1314 continue to use the standard profiler.
1318 continue to use the standard profiler.
1315
1319
1316 2004-08-23 Fernando Perez <fperez@colorado.edu>
1320 2004-08-23 Fernando Perez <fperez@colorado.edu>
1317
1321
1318 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1322 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1319 threaded shell, by John Hunter. It's not quite ready yet, but
1323 threaded shell, by John Hunter. It's not quite ready yet, but
1320 close.
1324 close.
1321
1325
1322 2004-08-22 Fernando Perez <fperez@colorado.edu>
1326 2004-08-22 Fernando Perez <fperez@colorado.edu>
1323
1327
1324 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1328 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1325 in Magic and ultraTB.
1329 in Magic and ultraTB.
1326
1330
1327 * ipython.1: document threading options in manpage.
1331 * ipython.1: document threading options in manpage.
1328
1332
1329 * scripts/ipython: Changed name of -thread option to -gthread,
1333 * scripts/ipython: Changed name of -thread option to -gthread,
1330 since this is GTK specific. I want to leave the door open for a
1334 since this is GTK specific. I want to leave the door open for a
1331 -wthread option for WX, which will most likely be necessary. This
1335 -wthread option for WX, which will most likely be necessary. This
1332 change affects usage and ipmaker as well.
1336 change affects usage and ipmaker as well.
1333
1337
1334 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1338 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1335 handle the matplotlib shell issues. Code by John Hunter
1339 handle the matplotlib shell issues. Code by John Hunter
1336 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1340 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1337 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1341 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1338 broken (and disabled for end users) for now, but it puts the
1342 broken (and disabled for end users) for now, but it puts the
1339 infrastructure in place.
1343 infrastructure in place.
1340
1344
1341 2004-08-21 Fernando Perez <fperez@colorado.edu>
1345 2004-08-21 Fernando Perez <fperez@colorado.edu>
1342
1346
1343 * ipythonrc-pylab: Add matplotlib support.
1347 * ipythonrc-pylab: Add matplotlib support.
1344
1348
1345 * matplotlib_config.py: new files for matplotlib support, part of
1349 * matplotlib_config.py: new files for matplotlib support, part of
1346 the pylab profile.
1350 the pylab profile.
1347
1351
1348 * IPython/usage.py (__doc__): documented the threading options.
1352 * IPython/usage.py (__doc__): documented the threading options.
1349
1353
1350 2004-08-20 Fernando Perez <fperez@colorado.edu>
1354 2004-08-20 Fernando Perez <fperez@colorado.edu>
1351
1355
1352 * ipython: Modified the main calling routine to handle the -thread
1356 * ipython: Modified the main calling routine to handle the -thread
1353 and -mpthread options. This needs to be done as a top-level hack,
1357 and -mpthread options. This needs to be done as a top-level hack,
1354 because it determines which class to instantiate for IPython
1358 because it determines which class to instantiate for IPython
1355 itself.
1359 itself.
1356
1360
1357 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1361 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1358 classes to support multithreaded GTK operation without blocking,
1362 classes to support multithreaded GTK operation without blocking,
1359 and matplotlib with all backends. This is a lot of still very
1363 and matplotlib with all backends. This is a lot of still very
1360 experimental code, and threads are tricky. So it may still have a
1364 experimental code, and threads are tricky. So it may still have a
1361 few rough edges... This code owes a lot to
1365 few rough edges... This code owes a lot to
1362 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1366 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1363 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1367 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1364 to John Hunter for all the matplotlib work.
1368 to John Hunter for all the matplotlib work.
1365
1369
1366 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1370 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1367 options for gtk thread and matplotlib support.
1371 options for gtk thread and matplotlib support.
1368
1372
1369 2004-08-16 Fernando Perez <fperez@colorado.edu>
1373 2004-08-16 Fernando Perez <fperez@colorado.edu>
1370
1374
1371 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1375 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1372 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1376 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1373 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1377 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1374
1378
1375 2004-08-11 Fernando Perez <fperez@colorado.edu>
1379 2004-08-11 Fernando Perez <fperez@colorado.edu>
1376
1380
1377 * setup.py (isfile): Fix build so documentation gets updated for
1381 * setup.py (isfile): Fix build so documentation gets updated for
1378 rpms (it was only done for .tgz builds).
1382 rpms (it was only done for .tgz builds).
1379
1383
1380 2004-08-10 Fernando Perez <fperez@colorado.edu>
1384 2004-08-10 Fernando Perez <fperez@colorado.edu>
1381
1385
1382 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1386 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1383
1387
1384 * iplib.py : Silence syntax error exceptions in tab-completion.
1388 * iplib.py : Silence syntax error exceptions in tab-completion.
1385
1389
1386 2004-08-05 Fernando Perez <fperez@colorado.edu>
1390 2004-08-05 Fernando Perez <fperez@colorado.edu>
1387
1391
1388 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1392 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1389 'color off' mark for continuation prompts. This was causing long
1393 'color off' mark for continuation prompts. This was causing long
1390 continuation lines to mis-wrap.
1394 continuation lines to mis-wrap.
1391
1395
1392 2004-08-01 Fernando Perez <fperez@colorado.edu>
1396 2004-08-01 Fernando Perez <fperez@colorado.edu>
1393
1397
1394 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1398 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1395 for building ipython to be a parameter. All this is necessary
1399 for building ipython to be a parameter. All this is necessary
1396 right now to have a multithreaded version, but this insane
1400 right now to have a multithreaded version, but this insane
1397 non-design will be cleaned up soon. For now, it's a hack that
1401 non-design will be cleaned up soon. For now, it's a hack that
1398 works.
1402 works.
1399
1403
1400 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1404 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1401 args in various places. No bugs so far, but it's a dangerous
1405 args in various places. No bugs so far, but it's a dangerous
1402 practice.
1406 practice.
1403
1407
1404 2004-07-31 Fernando Perez <fperez@colorado.edu>
1408 2004-07-31 Fernando Perez <fperez@colorado.edu>
1405
1409
1406 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1410 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1407 fix completion of files with dots in their names under most
1411 fix completion of files with dots in their names under most
1408 profiles (pysh was OK because the completion order is different).
1412 profiles (pysh was OK because the completion order is different).
1409
1413
1410 2004-07-27 Fernando Perez <fperez@colorado.edu>
1414 2004-07-27 Fernando Perez <fperez@colorado.edu>
1411
1415
1412 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1416 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1413 keywords manually, b/c the one in keyword.py was removed in python
1417 keywords manually, b/c the one in keyword.py was removed in python
1414 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1418 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1415 This is NOT a bug under python 2.3 and earlier.
1419 This is NOT a bug under python 2.3 and earlier.
1416
1420
1417 2004-07-26 Fernando Perez <fperez@colorado.edu>
1421 2004-07-26 Fernando Perez <fperez@colorado.edu>
1418
1422
1419 * IPython/ultraTB.py (VerboseTB.text): Add another
1423 * IPython/ultraTB.py (VerboseTB.text): Add another
1420 linecache.checkcache() call to try to prevent inspect.py from
1424 linecache.checkcache() call to try to prevent inspect.py from
1421 crashing under python 2.3. I think this fixes
1425 crashing under python 2.3. I think this fixes
1422 http://www.scipy.net/roundup/ipython/issue17.
1426 http://www.scipy.net/roundup/ipython/issue17.
1423
1427
1424 2004-07-26 *** Released version 0.6.2
1428 2004-07-26 *** Released version 0.6.2
1425
1429
1426 2004-07-26 Fernando Perez <fperez@colorado.edu>
1430 2004-07-26 Fernando Perez <fperez@colorado.edu>
1427
1431
1428 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1432 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1429 fail for any number.
1433 fail for any number.
1430 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1434 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1431 empty bookmarks.
1435 empty bookmarks.
1432
1436
1433 2004-07-26 *** Released version 0.6.1
1437 2004-07-26 *** Released version 0.6.1
1434
1438
1435 2004-07-26 Fernando Perez <fperez@colorado.edu>
1439 2004-07-26 Fernando Perez <fperez@colorado.edu>
1436
1440
1437 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1441 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1438
1442
1439 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1443 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1440 escaping '()[]{}' in filenames.
1444 escaping '()[]{}' in filenames.
1441
1445
1442 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1446 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1443 Python 2.2 users who lack a proper shlex.split.
1447 Python 2.2 users who lack a proper shlex.split.
1444
1448
1445 2004-07-19 Fernando Perez <fperez@colorado.edu>
1449 2004-07-19 Fernando Perez <fperez@colorado.edu>
1446
1450
1447 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1451 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1448 for reading readline's init file. I follow the normal chain:
1452 for reading readline's init file. I follow the normal chain:
1449 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1453 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1450 report by Mike Heeter. This closes
1454 report by Mike Heeter. This closes
1451 http://www.scipy.net/roundup/ipython/issue16.
1455 http://www.scipy.net/roundup/ipython/issue16.
1452
1456
1453 2004-07-18 Fernando Perez <fperez@colorado.edu>
1457 2004-07-18 Fernando Perez <fperez@colorado.edu>
1454
1458
1455 * IPython/iplib.py (__init__): Add better handling of '\' under
1459 * IPython/iplib.py (__init__): Add better handling of '\' under
1456 Win32 for filenames. After a patch by Ville.
1460 Win32 for filenames. After a patch by Ville.
1457
1461
1458 2004-07-17 Fernando Perez <fperez@colorado.edu>
1462 2004-07-17 Fernando Perez <fperez@colorado.edu>
1459
1463
1460 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1464 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1461 autocalling would be triggered for 'foo is bar' if foo is
1465 autocalling would be triggered for 'foo is bar' if foo is
1462 callable. I also cleaned up the autocall detection code to use a
1466 callable. I also cleaned up the autocall detection code to use a
1463 regexp, which is faster. Bug reported by Alexander Schmolck.
1467 regexp, which is faster. Bug reported by Alexander Schmolck.
1464
1468
1465 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1469 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1466 '?' in them would confuse the help system. Reported by Alex
1470 '?' in them would confuse the help system. Reported by Alex
1467 Schmolck.
1471 Schmolck.
1468
1472
1469 2004-07-16 Fernando Perez <fperez@colorado.edu>
1473 2004-07-16 Fernando Perez <fperez@colorado.edu>
1470
1474
1471 * IPython/GnuplotInteractive.py (__all__): added plot2.
1475 * IPython/GnuplotInteractive.py (__all__): added plot2.
1472
1476
1473 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1477 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1474 plotting dictionaries, lists or tuples of 1d arrays.
1478 plotting dictionaries, lists or tuples of 1d arrays.
1475
1479
1476 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1480 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1477 optimizations.
1481 optimizations.
1478
1482
1479 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1483 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1480 the information which was there from Janko's original IPP code:
1484 the information which was there from Janko's original IPP code:
1481
1485
1482 03.05.99 20:53 porto.ifm.uni-kiel.de
1486 03.05.99 20:53 porto.ifm.uni-kiel.de
1483 --Started changelog.
1487 --Started changelog.
1484 --make clear do what it say it does
1488 --make clear do what it say it does
1485 --added pretty output of lines from inputcache
1489 --added pretty output of lines from inputcache
1486 --Made Logger a mixin class, simplifies handling of switches
1490 --Made Logger a mixin class, simplifies handling of switches
1487 --Added own completer class. .string<TAB> expands to last history
1491 --Added own completer class. .string<TAB> expands to last history
1488 line which starts with string. The new expansion is also present
1492 line which starts with string. The new expansion is also present
1489 with Ctrl-r from the readline library. But this shows, who this
1493 with Ctrl-r from the readline library. But this shows, who this
1490 can be done for other cases.
1494 can be done for other cases.
1491 --Added convention that all shell functions should accept a
1495 --Added convention that all shell functions should accept a
1492 parameter_string This opens the door for different behaviour for
1496 parameter_string This opens the door for different behaviour for
1493 each function. @cd is a good example of this.
1497 each function. @cd is a good example of this.
1494
1498
1495 04.05.99 12:12 porto.ifm.uni-kiel.de
1499 04.05.99 12:12 porto.ifm.uni-kiel.de
1496 --added logfile rotation
1500 --added logfile rotation
1497 --added new mainloop method which freezes first the namespace
1501 --added new mainloop method which freezes first the namespace
1498
1502
1499 07.05.99 21:24 porto.ifm.uni-kiel.de
1503 07.05.99 21:24 porto.ifm.uni-kiel.de
1500 --added the docreader classes. Now there is a help system.
1504 --added the docreader classes. Now there is a help system.
1501 -This is only a first try. Currently it's not easy to put new
1505 -This is only a first try. Currently it's not easy to put new
1502 stuff in the indices. But this is the way to go. Info would be
1506 stuff in the indices. But this is the way to go. Info would be
1503 better, but HTML is every where and not everybody has an info
1507 better, but HTML is every where and not everybody has an info
1504 system installed and it's not so easy to change html-docs to info.
1508 system installed and it's not so easy to change html-docs to info.
1505 --added global logfile option
1509 --added global logfile option
1506 --there is now a hook for object inspection method pinfo needs to
1510 --there is now a hook for object inspection method pinfo needs to
1507 be provided for this. Can be reached by two '??'.
1511 be provided for this. Can be reached by two '??'.
1508
1512
1509 08.05.99 20:51 porto.ifm.uni-kiel.de
1513 08.05.99 20:51 porto.ifm.uni-kiel.de
1510 --added a README
1514 --added a README
1511 --bug in rc file. Something has changed so functions in the rc
1515 --bug in rc file. Something has changed so functions in the rc
1512 file need to reference the shell and not self. Not clear if it's a
1516 file need to reference the shell and not self. Not clear if it's a
1513 bug or feature.
1517 bug or feature.
1514 --changed rc file for new behavior
1518 --changed rc file for new behavior
1515
1519
1516 2004-07-15 Fernando Perez <fperez@colorado.edu>
1520 2004-07-15 Fernando Perez <fperez@colorado.edu>
1517
1521
1518 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1522 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1519 cache was falling out of sync in bizarre manners when multi-line
1523 cache was falling out of sync in bizarre manners when multi-line
1520 input was present. Minor optimizations and cleanup.
1524 input was present. Minor optimizations and cleanup.
1521
1525
1522 (Logger): Remove old Changelog info for cleanup. This is the
1526 (Logger): Remove old Changelog info for cleanup. This is the
1523 information which was there from Janko's original code:
1527 information which was there from Janko's original code:
1524
1528
1525 Changes to Logger: - made the default log filename a parameter
1529 Changes to Logger: - made the default log filename a parameter
1526
1530
1527 - put a check for lines beginning with !@? in log(). Needed
1531 - put a check for lines beginning with !@? in log(). Needed
1528 (even if the handlers properly log their lines) for mid-session
1532 (even if the handlers properly log their lines) for mid-session
1529 logging activation to work properly. Without this, lines logged
1533 logging activation to work properly. Without this, lines logged
1530 in mid session, which get read from the cache, would end up
1534 in mid session, which get read from the cache, would end up
1531 'bare' (with !@? in the open) in the log. Now they are caught
1535 'bare' (with !@? in the open) in the log. Now they are caught
1532 and prepended with a #.
1536 and prepended with a #.
1533
1537
1534 * IPython/iplib.py (InteractiveShell.init_readline): added check
1538 * IPython/iplib.py (InteractiveShell.init_readline): added check
1535 in case MagicCompleter fails to be defined, so we don't crash.
1539 in case MagicCompleter fails to be defined, so we don't crash.
1536
1540
1537 2004-07-13 Fernando Perez <fperez@colorado.edu>
1541 2004-07-13 Fernando Perez <fperez@colorado.edu>
1538
1542
1539 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1543 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1540 of EPS if the requested filename ends in '.eps'.
1544 of EPS if the requested filename ends in '.eps'.
1541
1545
1542 2004-07-04 Fernando Perez <fperez@colorado.edu>
1546 2004-07-04 Fernando Perez <fperez@colorado.edu>
1543
1547
1544 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1548 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1545 escaping of quotes when calling the shell.
1549 escaping of quotes when calling the shell.
1546
1550
1547 2004-07-02 Fernando Perez <fperez@colorado.edu>
1551 2004-07-02 Fernando Perez <fperez@colorado.edu>
1548
1552
1549 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1553 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1550 gettext not working because we were clobbering '_'. Fixes
1554 gettext not working because we were clobbering '_'. Fixes
1551 http://www.scipy.net/roundup/ipython/issue6.
1555 http://www.scipy.net/roundup/ipython/issue6.
1552
1556
1553 2004-07-01 Fernando Perez <fperez@colorado.edu>
1557 2004-07-01 Fernando Perez <fperez@colorado.edu>
1554
1558
1555 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1559 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1556 into @cd. Patch by Ville.
1560 into @cd. Patch by Ville.
1557
1561
1558 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1562 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1559 new function to store things after ipmaker runs. Patch by Ville.
1563 new function to store things after ipmaker runs. Patch by Ville.
1560 Eventually this will go away once ipmaker is removed and the class
1564 Eventually this will go away once ipmaker is removed and the class
1561 gets cleaned up, but for now it's ok. Key functionality here is
1565 gets cleaned up, but for now it's ok. Key functionality here is
1562 the addition of the persistent storage mechanism, a dict for
1566 the addition of the persistent storage mechanism, a dict for
1563 keeping data across sessions (for now just bookmarks, but more can
1567 keeping data across sessions (for now just bookmarks, but more can
1564 be implemented later).
1568 be implemented later).
1565
1569
1566 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1570 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1567 persistent across sections. Patch by Ville, I modified it
1571 persistent across sections. Patch by Ville, I modified it
1568 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1572 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1569 added a '-l' option to list all bookmarks.
1573 added a '-l' option to list all bookmarks.
1570
1574
1571 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1575 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1572 center for cleanup. Registered with atexit.register(). I moved
1576 center for cleanup. Registered with atexit.register(). I moved
1573 here the old exit_cleanup(). After a patch by Ville.
1577 here the old exit_cleanup(). After a patch by Ville.
1574
1578
1575 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1579 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1576 characters in the hacked shlex_split for python 2.2.
1580 characters in the hacked shlex_split for python 2.2.
1577
1581
1578 * IPython/iplib.py (file_matches): more fixes to filenames with
1582 * IPython/iplib.py (file_matches): more fixes to filenames with
1579 whitespace in them. It's not perfect, but limitations in python's
1583 whitespace in them. It's not perfect, but limitations in python's
1580 readline make it impossible to go further.
1584 readline make it impossible to go further.
1581
1585
1582 2004-06-29 Fernando Perez <fperez@colorado.edu>
1586 2004-06-29 Fernando Perez <fperez@colorado.edu>
1583
1587
1584 * IPython/iplib.py (file_matches): escape whitespace correctly in
1588 * IPython/iplib.py (file_matches): escape whitespace correctly in
1585 filename completions. Bug reported by Ville.
1589 filename completions. Bug reported by Ville.
1586
1590
1587 2004-06-28 Fernando Perez <fperez@colorado.edu>
1591 2004-06-28 Fernando Perez <fperez@colorado.edu>
1588
1592
1589 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1593 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1590 the history file will be called 'history-PROFNAME' (or just
1594 the history file will be called 'history-PROFNAME' (or just
1591 'history' if no profile is loaded). I was getting annoyed at
1595 'history' if no profile is loaded). I was getting annoyed at
1592 getting my Numerical work history clobbered by pysh sessions.
1596 getting my Numerical work history clobbered by pysh sessions.
1593
1597
1594 * IPython/iplib.py (InteractiveShell.__init__): Internal
1598 * IPython/iplib.py (InteractiveShell.__init__): Internal
1595 getoutputerror() function so that we can honor the system_verbose
1599 getoutputerror() function so that we can honor the system_verbose
1596 flag for _all_ system calls. I also added escaping of #
1600 flag for _all_ system calls. I also added escaping of #
1597 characters here to avoid confusing Itpl.
1601 characters here to avoid confusing Itpl.
1598
1602
1599 * IPython/Magic.py (shlex_split): removed call to shell in
1603 * IPython/Magic.py (shlex_split): removed call to shell in
1600 parse_options and replaced it with shlex.split(). The annoying
1604 parse_options and replaced it with shlex.split(). The annoying
1601 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1605 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1602 to backport it from 2.3, with several frail hacks (the shlex
1606 to backport it from 2.3, with several frail hacks (the shlex
1603 module is rather limited in 2.2). Thanks to a suggestion by Ville
1607 module is rather limited in 2.2). Thanks to a suggestion by Ville
1604 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1608 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1605 problem.
1609 problem.
1606
1610
1607 (Magic.magic_system_verbose): new toggle to print the actual
1611 (Magic.magic_system_verbose): new toggle to print the actual
1608 system calls made by ipython. Mainly for debugging purposes.
1612 system calls made by ipython. Mainly for debugging purposes.
1609
1613
1610 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1614 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1611 doesn't support persistence. Reported (and fix suggested) by
1615 doesn't support persistence. Reported (and fix suggested) by
1612 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1616 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1613
1617
1614 2004-06-26 Fernando Perez <fperez@colorado.edu>
1618 2004-06-26 Fernando Perez <fperez@colorado.edu>
1615
1619
1616 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1620 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1617 continue prompts.
1621 continue prompts.
1618
1622
1619 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1623 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1620 function (basically a big docstring) and a few more things here to
1624 function (basically a big docstring) and a few more things here to
1621 speedup startup. pysh.py is now very lightweight. We want because
1625 speedup startup. pysh.py is now very lightweight. We want because
1622 it gets execfile'd, while InterpreterExec gets imported, so
1626 it gets execfile'd, while InterpreterExec gets imported, so
1623 byte-compilation saves time.
1627 byte-compilation saves time.
1624
1628
1625 2004-06-25 Fernando Perez <fperez@colorado.edu>
1629 2004-06-25 Fernando Perez <fperez@colorado.edu>
1626
1630
1627 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1631 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1628 -NUM', which was recently broken.
1632 -NUM', which was recently broken.
1629
1633
1630 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1634 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1631 in multi-line input (but not !!, which doesn't make sense there).
1635 in multi-line input (but not !!, which doesn't make sense there).
1632
1636
1633 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1637 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1634 It's just too useful, and people can turn it off in the less
1638 It's just too useful, and people can turn it off in the less
1635 common cases where it's a problem.
1639 common cases where it's a problem.
1636
1640
1637 2004-06-24 Fernando Perez <fperez@colorado.edu>
1641 2004-06-24 Fernando Perez <fperez@colorado.edu>
1638
1642
1639 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1643 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1640 special syntaxes (like alias calling) is now allied in multi-line
1644 special syntaxes (like alias calling) is now allied in multi-line
1641 input. This is still _very_ experimental, but it's necessary for
1645 input. This is still _very_ experimental, but it's necessary for
1642 efficient shell usage combining python looping syntax with system
1646 efficient shell usage combining python looping syntax with system
1643 calls. For now it's restricted to aliases, I don't think it
1647 calls. For now it's restricted to aliases, I don't think it
1644 really even makes sense to have this for magics.
1648 really even makes sense to have this for magics.
1645
1649
1646 2004-06-23 Fernando Perez <fperez@colorado.edu>
1650 2004-06-23 Fernando Perez <fperez@colorado.edu>
1647
1651
1648 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1652 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1649 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1653 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1650
1654
1651 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1655 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1652 extensions under Windows (after code sent by Gary Bishop). The
1656 extensions under Windows (after code sent by Gary Bishop). The
1653 extensions considered 'executable' are stored in IPython's rc
1657 extensions considered 'executable' are stored in IPython's rc
1654 structure as win_exec_ext.
1658 structure as win_exec_ext.
1655
1659
1656 * IPython/genutils.py (shell): new function, like system() but
1660 * IPython/genutils.py (shell): new function, like system() but
1657 without return value. Very useful for interactive shell work.
1661 without return value. Very useful for interactive shell work.
1658
1662
1659 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1663 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1660 delete aliases.
1664 delete aliases.
1661
1665
1662 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1666 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1663 sure that the alias table doesn't contain python keywords.
1667 sure that the alias table doesn't contain python keywords.
1664
1668
1665 2004-06-21 Fernando Perez <fperez@colorado.edu>
1669 2004-06-21 Fernando Perez <fperez@colorado.edu>
1666
1670
1667 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1671 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1668 non-existent items are found in $PATH. Reported by Thorsten.
1672 non-existent items are found in $PATH. Reported by Thorsten.
1669
1673
1670 2004-06-20 Fernando Perez <fperez@colorado.edu>
1674 2004-06-20 Fernando Perez <fperez@colorado.edu>
1671
1675
1672 * IPython/iplib.py (complete): modified the completer so that the
1676 * IPython/iplib.py (complete): modified the completer so that the
1673 order of priorities can be easily changed at runtime.
1677 order of priorities can be easily changed at runtime.
1674
1678
1675 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1679 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1676 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1680 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1677
1681
1678 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1682 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1679 expand Python variables prepended with $ in all system calls. The
1683 expand Python variables prepended with $ in all system calls. The
1680 same was done to InteractiveShell.handle_shell_escape. Now all
1684 same was done to InteractiveShell.handle_shell_escape. Now all
1681 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1685 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1682 expansion of python variables and expressions according to the
1686 expansion of python variables and expressions according to the
1683 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1687 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1684
1688
1685 Though PEP-215 has been rejected, a similar (but simpler) one
1689 Though PEP-215 has been rejected, a similar (but simpler) one
1686 seems like it will go into Python 2.4, PEP-292 -
1690 seems like it will go into Python 2.4, PEP-292 -
1687 http://www.python.org/peps/pep-0292.html.
1691 http://www.python.org/peps/pep-0292.html.
1688
1692
1689 I'll keep the full syntax of PEP-215, since IPython has since the
1693 I'll keep the full syntax of PEP-215, since IPython has since the
1690 start used Ka-Ping Yee's reference implementation discussed there
1694 start used Ka-Ping Yee's reference implementation discussed there
1691 (Itpl), and I actually like the powerful semantics it offers.
1695 (Itpl), and I actually like the powerful semantics it offers.
1692
1696
1693 In order to access normal shell variables, the $ has to be escaped
1697 In order to access normal shell variables, the $ has to be escaped
1694 via an extra $. For example:
1698 via an extra $. For example:
1695
1699
1696 In [7]: PATH='a python variable'
1700 In [7]: PATH='a python variable'
1697
1701
1698 In [8]: !echo $PATH
1702 In [8]: !echo $PATH
1699 a python variable
1703 a python variable
1700
1704
1701 In [9]: !echo $$PATH
1705 In [9]: !echo $$PATH
1702 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1706 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1703
1707
1704 (Magic.parse_options): escape $ so the shell doesn't evaluate
1708 (Magic.parse_options): escape $ so the shell doesn't evaluate
1705 things prematurely.
1709 things prematurely.
1706
1710
1707 * IPython/iplib.py (InteractiveShell.call_alias): added the
1711 * IPython/iplib.py (InteractiveShell.call_alias): added the
1708 ability for aliases to expand python variables via $.
1712 ability for aliases to expand python variables via $.
1709
1713
1710 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1714 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1711 system, now there's a @rehash/@rehashx pair of magics. These work
1715 system, now there's a @rehash/@rehashx pair of magics. These work
1712 like the csh rehash command, and can be invoked at any time. They
1716 like the csh rehash command, and can be invoked at any time. They
1713 build a table of aliases to everything in the user's $PATH
1717 build a table of aliases to everything in the user's $PATH
1714 (@rehash uses everything, @rehashx is slower but only adds
1718 (@rehash uses everything, @rehashx is slower but only adds
1715 executable files). With this, the pysh.py-based shell profile can
1719 executable files). With this, the pysh.py-based shell profile can
1716 now simply call rehash upon startup, and full access to all
1720 now simply call rehash upon startup, and full access to all
1717 programs in the user's path is obtained.
1721 programs in the user's path is obtained.
1718
1722
1719 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1723 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1720 functionality is now fully in place. I removed the old dynamic
1724 functionality is now fully in place. I removed the old dynamic
1721 code generation based approach, in favor of a much lighter one
1725 code generation based approach, in favor of a much lighter one
1722 based on a simple dict. The advantage is that this allows me to
1726 based on a simple dict. The advantage is that this allows me to
1723 now have thousands of aliases with negligible cost (unthinkable
1727 now have thousands of aliases with negligible cost (unthinkable
1724 with the old system).
1728 with the old system).
1725
1729
1726 2004-06-19 Fernando Perez <fperez@colorado.edu>
1730 2004-06-19 Fernando Perez <fperez@colorado.edu>
1727
1731
1728 * IPython/iplib.py (__init__): extended MagicCompleter class to
1732 * IPython/iplib.py (__init__): extended MagicCompleter class to
1729 also complete (last in priority) on user aliases.
1733 also complete (last in priority) on user aliases.
1730
1734
1731 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1735 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1732 call to eval.
1736 call to eval.
1733 (ItplNS.__init__): Added a new class which functions like Itpl,
1737 (ItplNS.__init__): Added a new class which functions like Itpl,
1734 but allows configuring the namespace for the evaluation to occur
1738 but allows configuring the namespace for the evaluation to occur
1735 in.
1739 in.
1736
1740
1737 2004-06-18 Fernando Perez <fperez@colorado.edu>
1741 2004-06-18 Fernando Perez <fperez@colorado.edu>
1738
1742
1739 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1743 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1740 better message when 'exit' or 'quit' are typed (a common newbie
1744 better message when 'exit' or 'quit' are typed (a common newbie
1741 confusion).
1745 confusion).
1742
1746
1743 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1747 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1744 check for Windows users.
1748 check for Windows users.
1745
1749
1746 * IPython/iplib.py (InteractiveShell.user_setup): removed
1750 * IPython/iplib.py (InteractiveShell.user_setup): removed
1747 disabling of colors for Windows. I'll test at runtime and issue a
1751 disabling of colors for Windows. I'll test at runtime and issue a
1748 warning if Gary's readline isn't found, as to nudge users to
1752 warning if Gary's readline isn't found, as to nudge users to
1749 download it.
1753 download it.
1750
1754
1751 2004-06-16 Fernando Perez <fperez@colorado.edu>
1755 2004-06-16 Fernando Perez <fperez@colorado.edu>
1752
1756
1753 * IPython/genutils.py (Stream.__init__): changed to print errors
1757 * IPython/genutils.py (Stream.__init__): changed to print errors
1754 to sys.stderr. I had a circular dependency here. Now it's
1758 to sys.stderr. I had a circular dependency here. Now it's
1755 possible to run ipython as IDLE's shell (consider this pre-alpha,
1759 possible to run ipython as IDLE's shell (consider this pre-alpha,
1756 since true stdout things end up in the starting terminal instead
1760 since true stdout things end up in the starting terminal instead
1757 of IDLE's out).
1761 of IDLE's out).
1758
1762
1759 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1763 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1760 users who haven't # updated their prompt_in2 definitions. Remove
1764 users who haven't # updated their prompt_in2 definitions. Remove
1761 eventually.
1765 eventually.
1762 (multiple_replace): added credit to original ASPN recipe.
1766 (multiple_replace): added credit to original ASPN recipe.
1763
1767
1764 2004-06-15 Fernando Perez <fperez@colorado.edu>
1768 2004-06-15 Fernando Perez <fperez@colorado.edu>
1765
1769
1766 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1770 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1767 list of auto-defined aliases.
1771 list of auto-defined aliases.
1768
1772
1769 2004-06-13 Fernando Perez <fperez@colorado.edu>
1773 2004-06-13 Fernando Perez <fperez@colorado.edu>
1770
1774
1771 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1775 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1772 install was really requested (so setup.py can be used for other
1776 install was really requested (so setup.py can be used for other
1773 things under Windows).
1777 things under Windows).
1774
1778
1775 2004-06-10 Fernando Perez <fperez@colorado.edu>
1779 2004-06-10 Fernando Perez <fperez@colorado.edu>
1776
1780
1777 * IPython/Logger.py (Logger.create_log): Manually remove any old
1781 * IPython/Logger.py (Logger.create_log): Manually remove any old
1778 backup, since os.remove may fail under Windows. Fixes bug
1782 backup, since os.remove may fail under Windows. Fixes bug
1779 reported by Thorsten.
1783 reported by Thorsten.
1780
1784
1781 2004-06-09 Fernando Perez <fperez@colorado.edu>
1785 2004-06-09 Fernando Perez <fperez@colorado.edu>
1782
1786
1783 * examples/example-embed.py: fixed all references to %n (replaced
1787 * examples/example-embed.py: fixed all references to %n (replaced
1784 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1788 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1785 for all examples and the manual as well.
1789 for all examples and the manual as well.
1786
1790
1787 2004-06-08 Fernando Perez <fperez@colorado.edu>
1791 2004-06-08 Fernando Perez <fperez@colorado.edu>
1788
1792
1789 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1793 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1790 alignment and color management. All 3 prompt subsystems now
1794 alignment and color management. All 3 prompt subsystems now
1791 inherit from BasePrompt.
1795 inherit from BasePrompt.
1792
1796
1793 * tools/release: updates for windows installer build and tag rpms
1797 * tools/release: updates for windows installer build and tag rpms
1794 with python version (since paths are fixed).
1798 with python version (since paths are fixed).
1795
1799
1796 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1800 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1797 which will become eventually obsolete. Also fixed the default
1801 which will become eventually obsolete. Also fixed the default
1798 prompt_in2 to use \D, so at least new users start with the correct
1802 prompt_in2 to use \D, so at least new users start with the correct
1799 defaults.
1803 defaults.
1800 WARNING: Users with existing ipythonrc files will need to apply
1804 WARNING: Users with existing ipythonrc files will need to apply
1801 this fix manually!
1805 this fix manually!
1802
1806
1803 * setup.py: make windows installer (.exe). This is finally the
1807 * setup.py: make windows installer (.exe). This is finally the
1804 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1808 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1805 which I hadn't included because it required Python 2.3 (or recent
1809 which I hadn't included because it required Python 2.3 (or recent
1806 distutils).
1810 distutils).
1807
1811
1808 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1812 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1809 usage of new '\D' escape.
1813 usage of new '\D' escape.
1810
1814
1811 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1815 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1812 lacks os.getuid())
1816 lacks os.getuid())
1813 (CachedOutput.set_colors): Added the ability to turn coloring
1817 (CachedOutput.set_colors): Added the ability to turn coloring
1814 on/off with @colors even for manually defined prompt colors. It
1818 on/off with @colors even for manually defined prompt colors. It
1815 uses a nasty global, but it works safely and via the generic color
1819 uses a nasty global, but it works safely and via the generic color
1816 handling mechanism.
1820 handling mechanism.
1817 (Prompt2.__init__): Introduced new escape '\D' for continuation
1821 (Prompt2.__init__): Introduced new escape '\D' for continuation
1818 prompts. It represents the counter ('\#') as dots.
1822 prompts. It represents the counter ('\#') as dots.
1819 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1823 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1820 need to update their ipythonrc files and replace '%n' with '\D' in
1824 need to update their ipythonrc files and replace '%n' with '\D' in
1821 their prompt_in2 settings everywhere. Sorry, but there's
1825 their prompt_in2 settings everywhere. Sorry, but there's
1822 otherwise no clean way to get all prompts to properly align. The
1826 otherwise no clean way to get all prompts to properly align. The
1823 ipythonrc shipped with IPython has been updated.
1827 ipythonrc shipped with IPython has been updated.
1824
1828
1825 2004-06-07 Fernando Perez <fperez@colorado.edu>
1829 2004-06-07 Fernando Perez <fperez@colorado.edu>
1826
1830
1827 * setup.py (isfile): Pass local_icons option to latex2html, so the
1831 * setup.py (isfile): Pass local_icons option to latex2html, so the
1828 resulting HTML file is self-contained. Thanks to
1832 resulting HTML file is self-contained. Thanks to
1829 dryice-AT-liu.com.cn for the tip.
1833 dryice-AT-liu.com.cn for the tip.
1830
1834
1831 * pysh.py: I created a new profile 'shell', which implements a
1835 * pysh.py: I created a new profile 'shell', which implements a
1832 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1836 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1833 system shell, nor will it become one anytime soon. It's mainly
1837 system shell, nor will it become one anytime soon. It's mainly
1834 meant to illustrate the use of the new flexible bash-like prompts.
1838 meant to illustrate the use of the new flexible bash-like prompts.
1835 I guess it could be used by hardy souls for true shell management,
1839 I guess it could be used by hardy souls for true shell management,
1836 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1840 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1837 profile. This uses the InterpreterExec extension provided by
1841 profile. This uses the InterpreterExec extension provided by
1838 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1842 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1839
1843
1840 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1844 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1841 auto-align itself with the length of the previous input prompt
1845 auto-align itself with the length of the previous input prompt
1842 (taking into account the invisible color escapes).
1846 (taking into account the invisible color escapes).
1843 (CachedOutput.__init__): Large restructuring of this class. Now
1847 (CachedOutput.__init__): Large restructuring of this class. Now
1844 all three prompts (primary1, primary2, output) are proper objects,
1848 all three prompts (primary1, primary2, output) are proper objects,
1845 managed by the 'parent' CachedOutput class. The code is still a
1849 managed by the 'parent' CachedOutput class. The code is still a
1846 bit hackish (all prompts share state via a pointer to the cache),
1850 bit hackish (all prompts share state via a pointer to the cache),
1847 but it's overall far cleaner than before.
1851 but it's overall far cleaner than before.
1848
1852
1849 * IPython/genutils.py (getoutputerror): modified to add verbose,
1853 * IPython/genutils.py (getoutputerror): modified to add verbose,
1850 debug and header options. This makes the interface of all getout*
1854 debug and header options. This makes the interface of all getout*
1851 functions uniform.
1855 functions uniform.
1852 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1856 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1853
1857
1854 * IPython/Magic.py (Magic.default_option): added a function to
1858 * IPython/Magic.py (Magic.default_option): added a function to
1855 allow registering default options for any magic command. This
1859 allow registering default options for any magic command. This
1856 makes it easy to have profiles which customize the magics globally
1860 makes it easy to have profiles which customize the magics globally
1857 for a certain use. The values set through this function are
1861 for a certain use. The values set through this function are
1858 picked up by the parse_options() method, which all magics should
1862 picked up by the parse_options() method, which all magics should
1859 use to parse their options.
1863 use to parse their options.
1860
1864
1861 * IPython/genutils.py (warn): modified the warnings framework to
1865 * IPython/genutils.py (warn): modified the warnings framework to
1862 use the Term I/O class. I'm trying to slowly unify all of
1866 use the Term I/O class. I'm trying to slowly unify all of
1863 IPython's I/O operations to pass through Term.
1867 IPython's I/O operations to pass through Term.
1864
1868
1865 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1869 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1866 the secondary prompt to correctly match the length of the primary
1870 the secondary prompt to correctly match the length of the primary
1867 one for any prompt. Now multi-line code will properly line up
1871 one for any prompt. Now multi-line code will properly line up
1868 even for path dependent prompts, such as the new ones available
1872 even for path dependent prompts, such as the new ones available
1869 via the prompt_specials.
1873 via the prompt_specials.
1870
1874
1871 2004-06-06 Fernando Perez <fperez@colorado.edu>
1875 2004-06-06 Fernando Perez <fperez@colorado.edu>
1872
1876
1873 * IPython/Prompts.py (prompt_specials): Added the ability to have
1877 * IPython/Prompts.py (prompt_specials): Added the ability to have
1874 bash-like special sequences in the prompts, which get
1878 bash-like special sequences in the prompts, which get
1875 automatically expanded. Things like hostname, current working
1879 automatically expanded. Things like hostname, current working
1876 directory and username are implemented already, but it's easy to
1880 directory and username are implemented already, but it's easy to
1877 add more in the future. Thanks to a patch by W.J. van der Laan
1881 add more in the future. Thanks to a patch by W.J. van der Laan
1878 <gnufnork-AT-hetdigitalegat.nl>
1882 <gnufnork-AT-hetdigitalegat.nl>
1879 (prompt_specials): Added color support for prompt strings, so
1883 (prompt_specials): Added color support for prompt strings, so
1880 users can define arbitrary color setups for their prompts.
1884 users can define arbitrary color setups for their prompts.
1881
1885
1882 2004-06-05 Fernando Perez <fperez@colorado.edu>
1886 2004-06-05 Fernando Perez <fperez@colorado.edu>
1883
1887
1884 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1888 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1885 code to load Gary Bishop's readline and configure it
1889 code to load Gary Bishop's readline and configure it
1886 automatically. Thanks to Gary for help on this.
1890 automatically. Thanks to Gary for help on this.
1887
1891
1888 2004-06-01 Fernando Perez <fperez@colorado.edu>
1892 2004-06-01 Fernando Perez <fperez@colorado.edu>
1889
1893
1890 * IPython/Logger.py (Logger.create_log): fix bug for logging
1894 * IPython/Logger.py (Logger.create_log): fix bug for logging
1891 with no filename (previous fix was incomplete).
1895 with no filename (previous fix was incomplete).
1892
1896
1893 2004-05-25 Fernando Perez <fperez@colorado.edu>
1897 2004-05-25 Fernando Perez <fperez@colorado.edu>
1894
1898
1895 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1899 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1896 parens would get passed to the shell.
1900 parens would get passed to the shell.
1897
1901
1898 2004-05-20 Fernando Perez <fperez@colorado.edu>
1902 2004-05-20 Fernando Perez <fperez@colorado.edu>
1899
1903
1900 * IPython/Magic.py (Magic.magic_prun): changed default profile
1904 * IPython/Magic.py (Magic.magic_prun): changed default profile
1901 sort order to 'time' (the more common profiling need).
1905 sort order to 'time' (the more common profiling need).
1902
1906
1903 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1907 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1904 so that source code shown is guaranteed in sync with the file on
1908 so that source code shown is guaranteed in sync with the file on
1905 disk (also changed in psource). Similar fix to the one for
1909 disk (also changed in psource). Similar fix to the one for
1906 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1910 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1907 <yann.ledu-AT-noos.fr>.
1911 <yann.ledu-AT-noos.fr>.
1908
1912
1909 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1913 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1910 with a single option would not be correctly parsed. Closes
1914 with a single option would not be correctly parsed. Closes
1911 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1915 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1912 introduced in 0.6.0 (on 2004-05-06).
1916 introduced in 0.6.0 (on 2004-05-06).
1913
1917
1914 2004-05-13 *** Released version 0.6.0
1918 2004-05-13 *** Released version 0.6.0
1915
1919
1916 2004-05-13 Fernando Perez <fperez@colorado.edu>
1920 2004-05-13 Fernando Perez <fperez@colorado.edu>
1917
1921
1918 * debian/: Added debian/ directory to CVS, so that debian support
1922 * debian/: Added debian/ directory to CVS, so that debian support
1919 is publicly accessible. The debian package is maintained by Jack
1923 is publicly accessible. The debian package is maintained by Jack
1920 Moffit <jack-AT-xiph.org>.
1924 Moffit <jack-AT-xiph.org>.
1921
1925
1922 * Documentation: included the notes about an ipython-based system
1926 * Documentation: included the notes about an ipython-based system
1923 shell (the hypothetical 'pysh') into the new_design.pdf document,
1927 shell (the hypothetical 'pysh') into the new_design.pdf document,
1924 so that these ideas get distributed to users along with the
1928 so that these ideas get distributed to users along with the
1925 official documentation.
1929 official documentation.
1926
1930
1927 2004-05-10 Fernando Perez <fperez@colorado.edu>
1931 2004-05-10 Fernando Perez <fperez@colorado.edu>
1928
1932
1929 * IPython/Logger.py (Logger.create_log): fix recently introduced
1933 * IPython/Logger.py (Logger.create_log): fix recently introduced
1930 bug (misindented line) where logstart would fail when not given an
1934 bug (misindented line) where logstart would fail when not given an
1931 explicit filename.
1935 explicit filename.
1932
1936
1933 2004-05-09 Fernando Perez <fperez@colorado.edu>
1937 2004-05-09 Fernando Perez <fperez@colorado.edu>
1934
1938
1935 * IPython/Magic.py (Magic.parse_options): skip system call when
1939 * IPython/Magic.py (Magic.parse_options): skip system call when
1936 there are no options to look for. Faster, cleaner for the common
1940 there are no options to look for. Faster, cleaner for the common
1937 case.
1941 case.
1938
1942
1939 * Documentation: many updates to the manual: describing Windows
1943 * Documentation: many updates to the manual: describing Windows
1940 support better, Gnuplot updates, credits, misc small stuff. Also
1944 support better, Gnuplot updates, credits, misc small stuff. Also
1941 updated the new_design doc a bit.
1945 updated the new_design doc a bit.
1942
1946
1943 2004-05-06 *** Released version 0.6.0.rc1
1947 2004-05-06 *** Released version 0.6.0.rc1
1944
1948
1945 2004-05-06 Fernando Perez <fperez@colorado.edu>
1949 2004-05-06 Fernando Perez <fperez@colorado.edu>
1946
1950
1947 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1951 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1948 operations to use the vastly more efficient list/''.join() method.
1952 operations to use the vastly more efficient list/''.join() method.
1949 (FormattedTB.text): Fix
1953 (FormattedTB.text): Fix
1950 http://www.scipy.net/roundup/ipython/issue12 - exception source
1954 http://www.scipy.net/roundup/ipython/issue12 - exception source
1951 extract not updated after reload. Thanks to Mike Salib
1955 extract not updated after reload. Thanks to Mike Salib
1952 <msalib-AT-mit.edu> for pinning the source of the problem.
1956 <msalib-AT-mit.edu> for pinning the source of the problem.
1953 Fortunately, the solution works inside ipython and doesn't require
1957 Fortunately, the solution works inside ipython and doesn't require
1954 any changes to python proper.
1958 any changes to python proper.
1955
1959
1956 * IPython/Magic.py (Magic.parse_options): Improved to process the
1960 * IPython/Magic.py (Magic.parse_options): Improved to process the
1957 argument list as a true shell would (by actually using the
1961 argument list as a true shell would (by actually using the
1958 underlying system shell). This way, all @magics automatically get
1962 underlying system shell). This way, all @magics automatically get
1959 shell expansion for variables. Thanks to a comment by Alex
1963 shell expansion for variables. Thanks to a comment by Alex
1960 Schmolck.
1964 Schmolck.
1961
1965
1962 2004-04-04 Fernando Perez <fperez@colorado.edu>
1966 2004-04-04 Fernando Perez <fperez@colorado.edu>
1963
1967
1964 * IPython/iplib.py (InteractiveShell.interact): Added a special
1968 * IPython/iplib.py (InteractiveShell.interact): Added a special
1965 trap for a debugger quit exception, which is basically impossible
1969 trap for a debugger quit exception, which is basically impossible
1966 to handle by normal mechanisms, given what pdb does to the stack.
1970 to handle by normal mechanisms, given what pdb does to the stack.
1967 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1971 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1968
1972
1969 2004-04-03 Fernando Perez <fperez@colorado.edu>
1973 2004-04-03 Fernando Perez <fperez@colorado.edu>
1970
1974
1971 * IPython/genutils.py (Term): Standardized the names of the Term
1975 * IPython/genutils.py (Term): Standardized the names of the Term
1972 class streams to cin/cout/cerr, following C++ naming conventions
1976 class streams to cin/cout/cerr, following C++ naming conventions
1973 (I can't use in/out/err because 'in' is not a valid attribute
1977 (I can't use in/out/err because 'in' is not a valid attribute
1974 name).
1978 name).
1975
1979
1976 * IPython/iplib.py (InteractiveShell.interact): don't increment
1980 * IPython/iplib.py (InteractiveShell.interact): don't increment
1977 the prompt if there's no user input. By Daniel 'Dang' Griffith
1981 the prompt if there's no user input. By Daniel 'Dang' Griffith
1978 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1982 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1979 Francois Pinard.
1983 Francois Pinard.
1980
1984
1981 2004-04-02 Fernando Perez <fperez@colorado.edu>
1985 2004-04-02 Fernando Perez <fperez@colorado.edu>
1982
1986
1983 * IPython/genutils.py (Stream.__init__): Modified to survive at
1987 * IPython/genutils.py (Stream.__init__): Modified to survive at
1984 least importing in contexts where stdin/out/err aren't true file
1988 least importing in contexts where stdin/out/err aren't true file
1985 objects, such as PyCrust (they lack fileno() and mode). However,
1989 objects, such as PyCrust (they lack fileno() and mode). However,
1986 the recovery facilities which rely on these things existing will
1990 the recovery facilities which rely on these things existing will
1987 not work.
1991 not work.
1988
1992
1989 2004-04-01 Fernando Perez <fperez@colorado.edu>
1993 2004-04-01 Fernando Perez <fperez@colorado.edu>
1990
1994
1991 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1995 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1992 use the new getoutputerror() function, so it properly
1996 use the new getoutputerror() function, so it properly
1993 distinguishes stdout/err.
1997 distinguishes stdout/err.
1994
1998
1995 * IPython/genutils.py (getoutputerror): added a function to
1999 * IPython/genutils.py (getoutputerror): added a function to
1996 capture separately the standard output and error of a command.
2000 capture separately the standard output and error of a command.
1997 After a comment from dang on the mailing lists. This code is
2001 After a comment from dang on the mailing lists. This code is
1998 basically a modified version of commands.getstatusoutput(), from
2002 basically a modified version of commands.getstatusoutput(), from
1999 the standard library.
2003 the standard library.
2000
2004
2001 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2005 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2002 '!!' as a special syntax (shorthand) to access @sx.
2006 '!!' as a special syntax (shorthand) to access @sx.
2003
2007
2004 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2008 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2005 command and return its output as a list split on '\n'.
2009 command and return its output as a list split on '\n'.
2006
2010
2007 2004-03-31 Fernando Perez <fperez@colorado.edu>
2011 2004-03-31 Fernando Perez <fperez@colorado.edu>
2008
2012
2009 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2013 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2010 method to dictionaries used as FakeModule instances if they lack
2014 method to dictionaries used as FakeModule instances if they lack
2011 it. At least pydoc in python2.3 breaks for runtime-defined
2015 it. At least pydoc in python2.3 breaks for runtime-defined
2012 functions without this hack. At some point I need to _really_
2016 functions without this hack. At some point I need to _really_
2013 understand what FakeModule is doing, because it's a gross hack.
2017 understand what FakeModule is doing, because it's a gross hack.
2014 But it solves Arnd's problem for now...
2018 But it solves Arnd's problem for now...
2015
2019
2016 2004-02-27 Fernando Perez <fperez@colorado.edu>
2020 2004-02-27 Fernando Perez <fperez@colorado.edu>
2017
2021
2018 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2022 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2019 mode would behave erratically. Also increased the number of
2023 mode would behave erratically. Also increased the number of
2020 possible logs in rotate mod to 999. Thanks to Rod Holland
2024 possible logs in rotate mod to 999. Thanks to Rod Holland
2021 <rhh@StructureLABS.com> for the report and fixes.
2025 <rhh@StructureLABS.com> for the report and fixes.
2022
2026
2023 2004-02-26 Fernando Perez <fperez@colorado.edu>
2027 2004-02-26 Fernando Perez <fperez@colorado.edu>
2024
2028
2025 * IPython/genutils.py (page): Check that the curses module really
2029 * IPython/genutils.py (page): Check that the curses module really
2026 has the initscr attribute before trying to use it. For some
2030 has the initscr attribute before trying to use it. For some
2027 reason, the Solaris curses module is missing this. I think this
2031 reason, the Solaris curses module is missing this. I think this
2028 should be considered a Solaris python bug, but I'm not sure.
2032 should be considered a Solaris python bug, but I'm not sure.
2029
2033
2030 2004-01-17 Fernando Perez <fperez@colorado.edu>
2034 2004-01-17 Fernando Perez <fperez@colorado.edu>
2031
2035
2032 * IPython/genutils.py (Stream.__init__): Changes to try to make
2036 * IPython/genutils.py (Stream.__init__): Changes to try to make
2033 ipython robust against stdin/out/err being closed by the user.
2037 ipython robust against stdin/out/err being closed by the user.
2034 This is 'user error' (and blocks a normal python session, at least
2038 This is 'user error' (and blocks a normal python session, at least
2035 the stdout case). However, Ipython should be able to survive such
2039 the stdout case). However, Ipython should be able to survive such
2036 instances of abuse as gracefully as possible. To simplify the
2040 instances of abuse as gracefully as possible. To simplify the
2037 coding and maintain compatibility with Gary Bishop's Term
2041 coding and maintain compatibility with Gary Bishop's Term
2038 contributions, I've made use of classmethods for this. I think
2042 contributions, I've made use of classmethods for this. I think
2039 this introduces a dependency on python 2.2.
2043 this introduces a dependency on python 2.2.
2040
2044
2041 2004-01-13 Fernando Perez <fperez@colorado.edu>
2045 2004-01-13 Fernando Perez <fperez@colorado.edu>
2042
2046
2043 * IPython/numutils.py (exp_safe): simplified the code a bit and
2047 * IPython/numutils.py (exp_safe): simplified the code a bit and
2044 removed the need for importing the kinds module altogether.
2048 removed the need for importing the kinds module altogether.
2045
2049
2046 2004-01-06 Fernando Perez <fperez@colorado.edu>
2050 2004-01-06 Fernando Perez <fperez@colorado.edu>
2047
2051
2048 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2052 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2049 a magic function instead, after some community feedback. No
2053 a magic function instead, after some community feedback. No
2050 special syntax will exist for it, but its name is deliberately
2054 special syntax will exist for it, but its name is deliberately
2051 very short.
2055 very short.
2052
2056
2053 2003-12-20 Fernando Perez <fperez@colorado.edu>
2057 2003-12-20 Fernando Perez <fperez@colorado.edu>
2054
2058
2055 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2059 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2056 new functionality, to automagically assign the result of a shell
2060 new functionality, to automagically assign the result of a shell
2057 command to a variable. I'll solicit some community feedback on
2061 command to a variable. I'll solicit some community feedback on
2058 this before making it permanent.
2062 this before making it permanent.
2059
2063
2060 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2064 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2061 requested about callables for which inspect couldn't obtain a
2065 requested about callables for which inspect couldn't obtain a
2062 proper argspec. Thanks to a crash report sent by Etienne
2066 proper argspec. Thanks to a crash report sent by Etienne
2063 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2067 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2064
2068
2065 2003-12-09 Fernando Perez <fperez@colorado.edu>
2069 2003-12-09 Fernando Perez <fperez@colorado.edu>
2066
2070
2067 * IPython/genutils.py (page): patch for the pager to work across
2071 * IPython/genutils.py (page): patch for the pager to work across
2068 various versions of Windows. By Gary Bishop.
2072 various versions of Windows. By Gary Bishop.
2069
2073
2070 2003-12-04 Fernando Perez <fperez@colorado.edu>
2074 2003-12-04 Fernando Perez <fperez@colorado.edu>
2071
2075
2072 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2076 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2073 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2077 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2074 While I tested this and it looks ok, there may still be corner
2078 While I tested this and it looks ok, there may still be corner
2075 cases I've missed.
2079 cases I've missed.
2076
2080
2077 2003-12-01 Fernando Perez <fperez@colorado.edu>
2081 2003-12-01 Fernando Perez <fperez@colorado.edu>
2078
2082
2079 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2083 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2080 where a line like 'p,q=1,2' would fail because the automagic
2084 where a line like 'p,q=1,2' would fail because the automagic
2081 system would be triggered for @p.
2085 system would be triggered for @p.
2082
2086
2083 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2087 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2084 cleanups, code unmodified.
2088 cleanups, code unmodified.
2085
2089
2086 * IPython/genutils.py (Term): added a class for IPython to handle
2090 * IPython/genutils.py (Term): added a class for IPython to handle
2087 output. In most cases it will just be a proxy for stdout/err, but
2091 output. In most cases it will just be a proxy for stdout/err, but
2088 having this allows modifications to be made for some platforms,
2092 having this allows modifications to be made for some platforms,
2089 such as handling color escapes under Windows. All of this code
2093 such as handling color escapes under Windows. All of this code
2090 was contributed by Gary Bishop, with minor modifications by me.
2094 was contributed by Gary Bishop, with minor modifications by me.
2091 The actual changes affect many files.
2095 The actual changes affect many files.
2092
2096
2093 2003-11-30 Fernando Perez <fperez@colorado.edu>
2097 2003-11-30 Fernando Perez <fperez@colorado.edu>
2094
2098
2095 * IPython/iplib.py (file_matches): new completion code, courtesy
2099 * IPython/iplib.py (file_matches): new completion code, courtesy
2096 of Jeff Collins. This enables filename completion again under
2100 of Jeff Collins. This enables filename completion again under
2097 python 2.3, which disabled it at the C level.
2101 python 2.3, which disabled it at the C level.
2098
2102
2099 2003-11-11 Fernando Perez <fperez@colorado.edu>
2103 2003-11-11 Fernando Perez <fperez@colorado.edu>
2100
2104
2101 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2105 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2102 for Numeric.array(map(...)), but often convenient.
2106 for Numeric.array(map(...)), but often convenient.
2103
2107
2104 2003-11-05 Fernando Perez <fperez@colorado.edu>
2108 2003-11-05 Fernando Perez <fperez@colorado.edu>
2105
2109
2106 * IPython/numutils.py (frange): Changed a call from int() to
2110 * IPython/numutils.py (frange): Changed a call from int() to
2107 int(round()) to prevent a problem reported with arange() in the
2111 int(round()) to prevent a problem reported with arange() in the
2108 numpy list.
2112 numpy list.
2109
2113
2110 2003-10-06 Fernando Perez <fperez@colorado.edu>
2114 2003-10-06 Fernando Perez <fperez@colorado.edu>
2111
2115
2112 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2116 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2113 prevent crashes if sys lacks an argv attribute (it happens with
2117 prevent crashes if sys lacks an argv attribute (it happens with
2114 embedded interpreters which build a bare-bones sys module).
2118 embedded interpreters which build a bare-bones sys module).
2115 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2119 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2116
2120
2117 2003-09-24 Fernando Perez <fperez@colorado.edu>
2121 2003-09-24 Fernando Perez <fperez@colorado.edu>
2118
2122
2119 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2123 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2120 to protect against poorly written user objects where __getattr__
2124 to protect against poorly written user objects where __getattr__
2121 raises exceptions other than AttributeError. Thanks to a bug
2125 raises exceptions other than AttributeError. Thanks to a bug
2122 report by Oliver Sander <osander-AT-gmx.de>.
2126 report by Oliver Sander <osander-AT-gmx.de>.
2123
2127
2124 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2128 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2125 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2129 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2126
2130
2127 2003-09-09 Fernando Perez <fperez@colorado.edu>
2131 2003-09-09 Fernando Perez <fperez@colorado.edu>
2128
2132
2129 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2133 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2130 unpacking a list whith a callable as first element would
2134 unpacking a list whith a callable as first element would
2131 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2135 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2132 Collins.
2136 Collins.
2133
2137
2134 2003-08-25 *** Released version 0.5.0
2138 2003-08-25 *** Released version 0.5.0
2135
2139
2136 2003-08-22 Fernando Perez <fperez@colorado.edu>
2140 2003-08-22 Fernando Perez <fperez@colorado.edu>
2137
2141
2138 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2142 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2139 improperly defined user exceptions. Thanks to feedback from Mark
2143 improperly defined user exceptions. Thanks to feedback from Mark
2140 Russell <mrussell-AT-verio.net>.
2144 Russell <mrussell-AT-verio.net>.
2141
2145
2142 2003-08-20 Fernando Perez <fperez@colorado.edu>
2146 2003-08-20 Fernando Perez <fperez@colorado.edu>
2143
2147
2144 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2148 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2145 printing so that it would print multi-line string forms starting
2149 printing so that it would print multi-line string forms starting
2146 with a new line. This way the formatting is better respected for
2150 with a new line. This way the formatting is better respected for
2147 objects which work hard to make nice string forms.
2151 objects which work hard to make nice string forms.
2148
2152
2149 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2153 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2150 autocall would overtake data access for objects with both
2154 autocall would overtake data access for objects with both
2151 __getitem__ and __call__.
2155 __getitem__ and __call__.
2152
2156
2153 2003-08-19 *** Released version 0.5.0-rc1
2157 2003-08-19 *** Released version 0.5.0-rc1
2154
2158
2155 2003-08-19 Fernando Perez <fperez@colorado.edu>
2159 2003-08-19 Fernando Perez <fperez@colorado.edu>
2156
2160
2157 * IPython/deep_reload.py (load_tail): single tiny change here
2161 * IPython/deep_reload.py (load_tail): single tiny change here
2158 seems to fix the long-standing bug of dreload() failing to work
2162 seems to fix the long-standing bug of dreload() failing to work
2159 for dotted names. But this module is pretty tricky, so I may have
2163 for dotted names. But this module is pretty tricky, so I may have
2160 missed some subtlety. Needs more testing!.
2164 missed some subtlety. Needs more testing!.
2161
2165
2162 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2166 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2163 exceptions which have badly implemented __str__ methods.
2167 exceptions which have badly implemented __str__ methods.
2164 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2168 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2165 which I've been getting reports about from Python 2.3 users. I
2169 which I've been getting reports about from Python 2.3 users. I
2166 wish I had a simple test case to reproduce the problem, so I could
2170 wish I had a simple test case to reproduce the problem, so I could
2167 either write a cleaner workaround or file a bug report if
2171 either write a cleaner workaround or file a bug report if
2168 necessary.
2172 necessary.
2169
2173
2170 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2174 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2171 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2175 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2172 a bug report by Tjabo Kloppenburg.
2176 a bug report by Tjabo Kloppenburg.
2173
2177
2174 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2178 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2175 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2179 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2176 seems rather unstable. Thanks to a bug report by Tjabo
2180 seems rather unstable. Thanks to a bug report by Tjabo
2177 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2181 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2178
2182
2179 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2183 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2180 this out soon because of the critical fixes in the inner loop for
2184 this out soon because of the critical fixes in the inner loop for
2181 generators.
2185 generators.
2182
2186
2183 * IPython/Magic.py (Magic.getargspec): removed. This (and
2187 * IPython/Magic.py (Magic.getargspec): removed. This (and
2184 _get_def) have been obsoleted by OInspect for a long time, I
2188 _get_def) have been obsoleted by OInspect for a long time, I
2185 hadn't noticed that they were dead code.
2189 hadn't noticed that they were dead code.
2186 (Magic._ofind): restored _ofind functionality for a few literals
2190 (Magic._ofind): restored _ofind functionality for a few literals
2187 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2191 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2188 for things like "hello".capitalize?, since that would require a
2192 for things like "hello".capitalize?, since that would require a
2189 potentially dangerous eval() again.
2193 potentially dangerous eval() again.
2190
2194
2191 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2195 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2192 logic a bit more to clean up the escapes handling and minimize the
2196 logic a bit more to clean up the escapes handling and minimize the
2193 use of _ofind to only necessary cases. The interactive 'feel' of
2197 use of _ofind to only necessary cases. The interactive 'feel' of
2194 IPython should have improved quite a bit with the changes in
2198 IPython should have improved quite a bit with the changes in
2195 _prefilter and _ofind (besides being far safer than before).
2199 _prefilter and _ofind (besides being far safer than before).
2196
2200
2197 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2201 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2198 obscure, never reported). Edit would fail to find the object to
2202 obscure, never reported). Edit would fail to find the object to
2199 edit under some circumstances.
2203 edit under some circumstances.
2200 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2204 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2201 which were causing double-calling of generators. Those eval calls
2205 which were causing double-calling of generators. Those eval calls
2202 were _very_ dangerous, since code with side effects could be
2206 were _very_ dangerous, since code with side effects could be
2203 triggered. As they say, 'eval is evil'... These were the
2207 triggered. As they say, 'eval is evil'... These were the
2204 nastiest evals in IPython. Besides, _ofind is now far simpler,
2208 nastiest evals in IPython. Besides, _ofind is now far simpler,
2205 and it should also be quite a bit faster. Its use of inspect is
2209 and it should also be quite a bit faster. Its use of inspect is
2206 also safer, so perhaps some of the inspect-related crashes I've
2210 also safer, so perhaps some of the inspect-related crashes I've
2207 seen lately with Python 2.3 might be taken care of. That will
2211 seen lately with Python 2.3 might be taken care of. That will
2208 need more testing.
2212 need more testing.
2209
2213
2210 2003-08-17 Fernando Perez <fperez@colorado.edu>
2214 2003-08-17 Fernando Perez <fperez@colorado.edu>
2211
2215
2212 * IPython/iplib.py (InteractiveShell._prefilter): significant
2216 * IPython/iplib.py (InteractiveShell._prefilter): significant
2213 simplifications to the logic for handling user escapes. Faster
2217 simplifications to the logic for handling user escapes. Faster
2214 and simpler code.
2218 and simpler code.
2215
2219
2216 2003-08-14 Fernando Perez <fperez@colorado.edu>
2220 2003-08-14 Fernando Perez <fperez@colorado.edu>
2217
2221
2218 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2222 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2219 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2223 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2220 but it should be quite a bit faster. And the recursive version
2224 but it should be quite a bit faster. And the recursive version
2221 generated O(log N) intermediate storage for all rank>1 arrays,
2225 generated O(log N) intermediate storage for all rank>1 arrays,
2222 even if they were contiguous.
2226 even if they were contiguous.
2223 (l1norm): Added this function.
2227 (l1norm): Added this function.
2224 (norm): Added this function for arbitrary norms (including
2228 (norm): Added this function for arbitrary norms (including
2225 l-infinity). l1 and l2 are still special cases for convenience
2229 l-infinity). l1 and l2 are still special cases for convenience
2226 and speed.
2230 and speed.
2227
2231
2228 2003-08-03 Fernando Perez <fperez@colorado.edu>
2232 2003-08-03 Fernando Perez <fperez@colorado.edu>
2229
2233
2230 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2234 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2231 exceptions, which now raise PendingDeprecationWarnings in Python
2235 exceptions, which now raise PendingDeprecationWarnings in Python
2232 2.3. There were some in Magic and some in Gnuplot2.
2236 2.3. There were some in Magic and some in Gnuplot2.
2233
2237
2234 2003-06-30 Fernando Perez <fperez@colorado.edu>
2238 2003-06-30 Fernando Perez <fperez@colorado.edu>
2235
2239
2236 * IPython/genutils.py (page): modified to call curses only for
2240 * IPython/genutils.py (page): modified to call curses only for
2237 terminals where TERM=='xterm'. After problems under many other
2241 terminals where TERM=='xterm'. After problems under many other
2238 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2242 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2239
2243
2240 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2244 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2241 would be triggered when readline was absent. This was just an old
2245 would be triggered when readline was absent. This was just an old
2242 debugging statement I'd forgotten to take out.
2246 debugging statement I'd forgotten to take out.
2243
2247
2244 2003-06-20 Fernando Perez <fperez@colorado.edu>
2248 2003-06-20 Fernando Perez <fperez@colorado.edu>
2245
2249
2246 * IPython/genutils.py (clock): modified to return only user time
2250 * IPython/genutils.py (clock): modified to return only user time
2247 (not counting system time), after a discussion on scipy. While
2251 (not counting system time), after a discussion on scipy. While
2248 system time may be a useful quantity occasionally, it may much
2252 system time may be a useful quantity occasionally, it may much
2249 more easily be skewed by occasional swapping or other similar
2253 more easily be skewed by occasional swapping or other similar
2250 activity.
2254 activity.
2251
2255
2252 2003-06-05 Fernando Perez <fperez@colorado.edu>
2256 2003-06-05 Fernando Perez <fperez@colorado.edu>
2253
2257
2254 * IPython/numutils.py (identity): new function, for building
2258 * IPython/numutils.py (identity): new function, for building
2255 arbitrary rank Kronecker deltas (mostly backwards compatible with
2259 arbitrary rank Kronecker deltas (mostly backwards compatible with
2256 Numeric.identity)
2260 Numeric.identity)
2257
2261
2258 2003-06-03 Fernando Perez <fperez@colorado.edu>
2262 2003-06-03 Fernando Perez <fperez@colorado.edu>
2259
2263
2260 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2264 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2261 arguments passed to magics with spaces, to allow trailing '\' to
2265 arguments passed to magics with spaces, to allow trailing '\' to
2262 work normally (mainly for Windows users).
2266 work normally (mainly for Windows users).
2263
2267
2264 2003-05-29 Fernando Perez <fperez@colorado.edu>
2268 2003-05-29 Fernando Perez <fperez@colorado.edu>
2265
2269
2266 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2270 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2267 instead of pydoc.help. This fixes a bizarre behavior where
2271 instead of pydoc.help. This fixes a bizarre behavior where
2268 printing '%s' % locals() would trigger the help system. Now
2272 printing '%s' % locals() would trigger the help system. Now
2269 ipython behaves like normal python does.
2273 ipython behaves like normal python does.
2270
2274
2271 Note that if one does 'from pydoc import help', the bizarre
2275 Note that if one does 'from pydoc import help', the bizarre
2272 behavior returns, but this will also happen in normal python, so
2276 behavior returns, but this will also happen in normal python, so
2273 it's not an ipython bug anymore (it has to do with how pydoc.help
2277 it's not an ipython bug anymore (it has to do with how pydoc.help
2274 is implemented).
2278 is implemented).
2275
2279
2276 2003-05-22 Fernando Perez <fperez@colorado.edu>
2280 2003-05-22 Fernando Perez <fperez@colorado.edu>
2277
2281
2278 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2282 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2279 return [] instead of None when nothing matches, also match to end
2283 return [] instead of None when nothing matches, also match to end
2280 of line. Patch by Gary Bishop.
2284 of line. Patch by Gary Bishop.
2281
2285
2282 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2286 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2283 protection as before, for files passed on the command line. This
2287 protection as before, for files passed on the command line. This
2284 prevents the CrashHandler from kicking in if user files call into
2288 prevents the CrashHandler from kicking in if user files call into
2285 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2289 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2286 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2290 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2287
2291
2288 2003-05-20 *** Released version 0.4.0
2292 2003-05-20 *** Released version 0.4.0
2289
2293
2290 2003-05-20 Fernando Perez <fperez@colorado.edu>
2294 2003-05-20 Fernando Perez <fperez@colorado.edu>
2291
2295
2292 * setup.py: added support for manpages. It's a bit hackish b/c of
2296 * setup.py: added support for manpages. It's a bit hackish b/c of
2293 a bug in the way the bdist_rpm distutils target handles gzipped
2297 a bug in the way the bdist_rpm distutils target handles gzipped
2294 manpages, but it works. After a patch by Jack.
2298 manpages, but it works. After a patch by Jack.
2295
2299
2296 2003-05-19 Fernando Perez <fperez@colorado.edu>
2300 2003-05-19 Fernando Perez <fperez@colorado.edu>
2297
2301
2298 * IPython/numutils.py: added a mockup of the kinds module, since
2302 * IPython/numutils.py: added a mockup of the kinds module, since
2299 it was recently removed from Numeric. This way, numutils will
2303 it was recently removed from Numeric. This way, numutils will
2300 work for all users even if they are missing kinds.
2304 work for all users even if they are missing kinds.
2301
2305
2302 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2306 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2303 failure, which can occur with SWIG-wrapped extensions. After a
2307 failure, which can occur with SWIG-wrapped extensions. After a
2304 crash report from Prabhu.
2308 crash report from Prabhu.
2305
2309
2306 2003-05-16 Fernando Perez <fperez@colorado.edu>
2310 2003-05-16 Fernando Perez <fperez@colorado.edu>
2307
2311
2308 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2312 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2309 protect ipython from user code which may call directly
2313 protect ipython from user code which may call directly
2310 sys.excepthook (this looks like an ipython crash to the user, even
2314 sys.excepthook (this looks like an ipython crash to the user, even
2311 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2315 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2312 This is especially important to help users of WxWindows, but may
2316 This is especially important to help users of WxWindows, but may
2313 also be useful in other cases.
2317 also be useful in other cases.
2314
2318
2315 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2319 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2316 an optional tb_offset to be specified, and to preserve exception
2320 an optional tb_offset to be specified, and to preserve exception
2317 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2321 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2318
2322
2319 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2323 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2320
2324
2321 2003-05-15 Fernando Perez <fperez@colorado.edu>
2325 2003-05-15 Fernando Perez <fperez@colorado.edu>
2322
2326
2323 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2327 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2324 installing for a new user under Windows.
2328 installing for a new user under Windows.
2325
2329
2326 2003-05-12 Fernando Perez <fperez@colorado.edu>
2330 2003-05-12 Fernando Perez <fperez@colorado.edu>
2327
2331
2328 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2332 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2329 handler for Emacs comint-based lines. Currently it doesn't do
2333 handler for Emacs comint-based lines. Currently it doesn't do
2330 much (but importantly, it doesn't update the history cache). In
2334 much (but importantly, it doesn't update the history cache). In
2331 the future it may be expanded if Alex needs more functionality
2335 the future it may be expanded if Alex needs more functionality
2332 there.
2336 there.
2333
2337
2334 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2338 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2335 info to crash reports.
2339 info to crash reports.
2336
2340
2337 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2341 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2338 just like Python's -c. Also fixed crash with invalid -color
2342 just like Python's -c. Also fixed crash with invalid -color
2339 option value at startup. Thanks to Will French
2343 option value at startup. Thanks to Will French
2340 <wfrench-AT-bestweb.net> for the bug report.
2344 <wfrench-AT-bestweb.net> for the bug report.
2341
2345
2342 2003-05-09 Fernando Perez <fperez@colorado.edu>
2346 2003-05-09 Fernando Perez <fperez@colorado.edu>
2343
2347
2344 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2348 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2345 to EvalDict (it's a mapping, after all) and simplified its code
2349 to EvalDict (it's a mapping, after all) and simplified its code
2346 quite a bit, after a nice discussion on c.l.py where Gustavo
2350 quite a bit, after a nice discussion on c.l.py where Gustavo
2347 Córdova <gcordova-AT-sismex.com> suggested the new version.
2351 Córdova <gcordova-AT-sismex.com> suggested the new version.
2348
2352
2349 2003-04-30 Fernando Perez <fperez@colorado.edu>
2353 2003-04-30 Fernando Perez <fperez@colorado.edu>
2350
2354
2351 * IPython/genutils.py (timings_out): modified it to reduce its
2355 * IPython/genutils.py (timings_out): modified it to reduce its
2352 overhead in the common reps==1 case.
2356 overhead in the common reps==1 case.
2353
2357
2354 2003-04-29 Fernando Perez <fperez@colorado.edu>
2358 2003-04-29 Fernando Perez <fperez@colorado.edu>
2355
2359
2356 * IPython/genutils.py (timings_out): Modified to use the resource
2360 * IPython/genutils.py (timings_out): Modified to use the resource
2357 module, which avoids the wraparound problems of time.clock().
2361 module, which avoids the wraparound problems of time.clock().
2358
2362
2359 2003-04-17 *** Released version 0.2.15pre4
2363 2003-04-17 *** Released version 0.2.15pre4
2360
2364
2361 2003-04-17 Fernando Perez <fperez@colorado.edu>
2365 2003-04-17 Fernando Perez <fperez@colorado.edu>
2362
2366
2363 * setup.py (scriptfiles): Split windows-specific stuff over to a
2367 * setup.py (scriptfiles): Split windows-specific stuff over to a
2364 separate file, in an attempt to have a Windows GUI installer.
2368 separate file, in an attempt to have a Windows GUI installer.
2365 That didn't work, but part of the groundwork is done.
2369 That didn't work, but part of the groundwork is done.
2366
2370
2367 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2371 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2368 indent/unindent with 4 spaces. Particularly useful in combination
2372 indent/unindent with 4 spaces. Particularly useful in combination
2369 with the new auto-indent option.
2373 with the new auto-indent option.
2370
2374
2371 2003-04-16 Fernando Perez <fperez@colorado.edu>
2375 2003-04-16 Fernando Perez <fperez@colorado.edu>
2372
2376
2373 * IPython/Magic.py: various replacements of self.rc for
2377 * IPython/Magic.py: various replacements of self.rc for
2374 self.shell.rc. A lot more remains to be done to fully disentangle
2378 self.shell.rc. A lot more remains to be done to fully disentangle
2375 this class from the main Shell class.
2379 this class from the main Shell class.
2376
2380
2377 * IPython/GnuplotRuntime.py: added checks for mouse support so
2381 * IPython/GnuplotRuntime.py: added checks for mouse support so
2378 that we don't try to enable it if the current gnuplot doesn't
2382 that we don't try to enable it if the current gnuplot doesn't
2379 really support it. Also added checks so that we don't try to
2383 really support it. Also added checks so that we don't try to
2380 enable persist under Windows (where Gnuplot doesn't recognize the
2384 enable persist under Windows (where Gnuplot doesn't recognize the
2381 option).
2385 option).
2382
2386
2383 * IPython/iplib.py (InteractiveShell.interact): Added optional
2387 * IPython/iplib.py (InteractiveShell.interact): Added optional
2384 auto-indenting code, after a patch by King C. Shu
2388 auto-indenting code, after a patch by King C. Shu
2385 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2389 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2386 get along well with pasting indented code. If I ever figure out
2390 get along well with pasting indented code. If I ever figure out
2387 how to make that part go well, it will become on by default.
2391 how to make that part go well, it will become on by default.
2388
2392
2389 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2393 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2390 crash ipython if there was an unmatched '%' in the user's prompt
2394 crash ipython if there was an unmatched '%' in the user's prompt
2391 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2395 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2392
2396
2393 * IPython/iplib.py (InteractiveShell.interact): removed the
2397 * IPython/iplib.py (InteractiveShell.interact): removed the
2394 ability to ask the user whether he wants to crash or not at the
2398 ability to ask the user whether he wants to crash or not at the
2395 'last line' exception handler. Calling functions at that point
2399 'last line' exception handler. Calling functions at that point
2396 changes the stack, and the error reports would have incorrect
2400 changes the stack, and the error reports would have incorrect
2397 tracebacks.
2401 tracebacks.
2398
2402
2399 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2403 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2400 pass through a peger a pretty-printed form of any object. After a
2404 pass through a peger a pretty-printed form of any object. After a
2401 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2405 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2402
2406
2403 2003-04-14 Fernando Perez <fperez@colorado.edu>
2407 2003-04-14 Fernando Perez <fperez@colorado.edu>
2404
2408
2405 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2409 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2406 all files in ~ would be modified at first install (instead of
2410 all files in ~ would be modified at first install (instead of
2407 ~/.ipython). This could be potentially disastrous, as the
2411 ~/.ipython). This could be potentially disastrous, as the
2408 modification (make line-endings native) could damage binary files.
2412 modification (make line-endings native) could damage binary files.
2409
2413
2410 2003-04-10 Fernando Perez <fperez@colorado.edu>
2414 2003-04-10 Fernando Perez <fperez@colorado.edu>
2411
2415
2412 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2416 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2413 handle only lines which are invalid python. This now means that
2417 handle only lines which are invalid python. This now means that
2414 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2418 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2415 for the bug report.
2419 for the bug report.
2416
2420
2417 2003-04-01 Fernando Perez <fperez@colorado.edu>
2421 2003-04-01 Fernando Perez <fperez@colorado.edu>
2418
2422
2419 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2423 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2420 where failing to set sys.last_traceback would crash pdb.pm().
2424 where failing to set sys.last_traceback would crash pdb.pm().
2421 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2425 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2422 report.
2426 report.
2423
2427
2424 2003-03-25 Fernando Perez <fperez@colorado.edu>
2428 2003-03-25 Fernando Perez <fperez@colorado.edu>
2425
2429
2426 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2430 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2427 before printing it (it had a lot of spurious blank lines at the
2431 before printing it (it had a lot of spurious blank lines at the
2428 end).
2432 end).
2429
2433
2430 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2434 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2431 output would be sent 21 times! Obviously people don't use this
2435 output would be sent 21 times! Obviously people don't use this
2432 too often, or I would have heard about it.
2436 too often, or I would have heard about it.
2433
2437
2434 2003-03-24 Fernando Perez <fperez@colorado.edu>
2438 2003-03-24 Fernando Perez <fperez@colorado.edu>
2435
2439
2436 * setup.py (scriptfiles): renamed the data_files parameter from
2440 * setup.py (scriptfiles): renamed the data_files parameter from
2437 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2441 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2438 for the patch.
2442 for the patch.
2439
2443
2440 2003-03-20 Fernando Perez <fperez@colorado.edu>
2444 2003-03-20 Fernando Perez <fperez@colorado.edu>
2441
2445
2442 * IPython/genutils.py (error): added error() and fatal()
2446 * IPython/genutils.py (error): added error() and fatal()
2443 functions.
2447 functions.
2444
2448
2445 2003-03-18 *** Released version 0.2.15pre3
2449 2003-03-18 *** Released version 0.2.15pre3
2446
2450
2447 2003-03-18 Fernando Perez <fperez@colorado.edu>
2451 2003-03-18 Fernando Perez <fperez@colorado.edu>
2448
2452
2449 * setupext/install_data_ext.py
2453 * setupext/install_data_ext.py
2450 (install_data_ext.initialize_options): Class contributed by Jack
2454 (install_data_ext.initialize_options): Class contributed by Jack
2451 Moffit for fixing the old distutils hack. He is sending this to
2455 Moffit for fixing the old distutils hack. He is sending this to
2452 the distutils folks so in the future we may not need it as a
2456 the distutils folks so in the future we may not need it as a
2453 private fix.
2457 private fix.
2454
2458
2455 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2459 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2456 changes for Debian packaging. See his patch for full details.
2460 changes for Debian packaging. See his patch for full details.
2457 The old distutils hack of making the ipythonrc* files carry a
2461 The old distutils hack of making the ipythonrc* files carry a
2458 bogus .py extension is gone, at last. Examples were moved to a
2462 bogus .py extension is gone, at last. Examples were moved to a
2459 separate subdir under doc/, and the separate executable scripts
2463 separate subdir under doc/, and the separate executable scripts
2460 now live in their own directory. Overall a great cleanup. The
2464 now live in their own directory. Overall a great cleanup. The
2461 manual was updated to use the new files, and setup.py has been
2465 manual was updated to use the new files, and setup.py has been
2462 fixed for this setup.
2466 fixed for this setup.
2463
2467
2464 * IPython/PyColorize.py (Parser.usage): made non-executable and
2468 * IPython/PyColorize.py (Parser.usage): made non-executable and
2465 created a pycolor wrapper around it to be included as a script.
2469 created a pycolor wrapper around it to be included as a script.
2466
2470
2467 2003-03-12 *** Released version 0.2.15pre2
2471 2003-03-12 *** Released version 0.2.15pre2
2468
2472
2469 2003-03-12 Fernando Perez <fperez@colorado.edu>
2473 2003-03-12 Fernando Perez <fperez@colorado.edu>
2470
2474
2471 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2475 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2472 long-standing problem with garbage characters in some terminals.
2476 long-standing problem with garbage characters in some terminals.
2473 The issue was really that the \001 and \002 escapes must _only_ be
2477 The issue was really that the \001 and \002 escapes must _only_ be
2474 passed to input prompts (which call readline), but _never_ to
2478 passed to input prompts (which call readline), but _never_ to
2475 normal text to be printed on screen. I changed ColorANSI to have
2479 normal text to be printed on screen. I changed ColorANSI to have
2476 two classes: TermColors and InputTermColors, each with the
2480 two classes: TermColors and InputTermColors, each with the
2477 appropriate escapes for input prompts or normal text. The code in
2481 appropriate escapes for input prompts or normal text. The code in
2478 Prompts.py got slightly more complicated, but this very old and
2482 Prompts.py got slightly more complicated, but this very old and
2479 annoying bug is finally fixed.
2483 annoying bug is finally fixed.
2480
2484
2481 All the credit for nailing down the real origin of this problem
2485 All the credit for nailing down the real origin of this problem
2482 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2486 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2483 *Many* thanks to him for spending quite a bit of effort on this.
2487 *Many* thanks to him for spending quite a bit of effort on this.
2484
2488
2485 2003-03-05 *** Released version 0.2.15pre1
2489 2003-03-05 *** Released version 0.2.15pre1
2486
2490
2487 2003-03-03 Fernando Perez <fperez@colorado.edu>
2491 2003-03-03 Fernando Perez <fperez@colorado.edu>
2488
2492
2489 * IPython/FakeModule.py: Moved the former _FakeModule to a
2493 * IPython/FakeModule.py: Moved the former _FakeModule to a
2490 separate file, because it's also needed by Magic (to fix a similar
2494 separate file, because it's also needed by Magic (to fix a similar
2491 pickle-related issue in @run).
2495 pickle-related issue in @run).
2492
2496
2493 2003-03-02 Fernando Perez <fperez@colorado.edu>
2497 2003-03-02 Fernando Perez <fperez@colorado.edu>
2494
2498
2495 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2499 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2496 the autocall option at runtime.
2500 the autocall option at runtime.
2497 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2501 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2498 across Magic.py to start separating Magic from InteractiveShell.
2502 across Magic.py to start separating Magic from InteractiveShell.
2499 (Magic._ofind): Fixed to return proper namespace for dotted
2503 (Magic._ofind): Fixed to return proper namespace for dotted
2500 names. Before, a dotted name would always return 'not currently
2504 names. Before, a dotted name would always return 'not currently
2501 defined', because it would find the 'parent'. s.x would be found,
2505 defined', because it would find the 'parent'. s.x would be found,
2502 but since 'x' isn't defined by itself, it would get confused.
2506 but since 'x' isn't defined by itself, it would get confused.
2503 (Magic.magic_run): Fixed pickling problems reported by Ralf
2507 (Magic.magic_run): Fixed pickling problems reported by Ralf
2504 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2508 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2505 that I'd used when Mike Heeter reported similar issues at the
2509 that I'd used when Mike Heeter reported similar issues at the
2506 top-level, but now for @run. It boils down to injecting the
2510 top-level, but now for @run. It boils down to injecting the
2507 namespace where code is being executed with something that looks
2511 namespace where code is being executed with something that looks
2508 enough like a module to fool pickle.dump(). Since a pickle stores
2512 enough like a module to fool pickle.dump(). Since a pickle stores
2509 a named reference to the importing module, we need this for
2513 a named reference to the importing module, we need this for
2510 pickles to save something sensible.
2514 pickles to save something sensible.
2511
2515
2512 * IPython/ipmaker.py (make_IPython): added an autocall option.
2516 * IPython/ipmaker.py (make_IPython): added an autocall option.
2513
2517
2514 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2518 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2515 the auto-eval code. Now autocalling is an option, and the code is
2519 the auto-eval code. Now autocalling is an option, and the code is
2516 also vastly safer. There is no more eval() involved at all.
2520 also vastly safer. There is no more eval() involved at all.
2517
2521
2518 2003-03-01 Fernando Perez <fperez@colorado.edu>
2522 2003-03-01 Fernando Perez <fperez@colorado.edu>
2519
2523
2520 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2524 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2521 dict with named keys instead of a tuple.
2525 dict with named keys instead of a tuple.
2522
2526
2523 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2527 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2524
2528
2525 * setup.py (make_shortcut): Fixed message about directories
2529 * setup.py (make_shortcut): Fixed message about directories
2526 created during Windows installation (the directories were ok, just
2530 created during Windows installation (the directories were ok, just
2527 the printed message was misleading). Thanks to Chris Liechti
2531 the printed message was misleading). Thanks to Chris Liechti
2528 <cliechti-AT-gmx.net> for the heads up.
2532 <cliechti-AT-gmx.net> for the heads up.
2529
2533
2530 2003-02-21 Fernando Perez <fperez@colorado.edu>
2534 2003-02-21 Fernando Perez <fperez@colorado.edu>
2531
2535
2532 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2536 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2533 of ValueError exception when checking for auto-execution. This
2537 of ValueError exception when checking for auto-execution. This
2534 one is raised by things like Numeric arrays arr.flat when the
2538 one is raised by things like Numeric arrays arr.flat when the
2535 array is non-contiguous.
2539 array is non-contiguous.
2536
2540
2537 2003-01-31 Fernando Perez <fperez@colorado.edu>
2541 2003-01-31 Fernando Perez <fperez@colorado.edu>
2538
2542
2539 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2543 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2540 not return any value at all (even though the command would get
2544 not return any value at all (even though the command would get
2541 executed).
2545 executed).
2542 (xsys): Flush stdout right after printing the command to ensure
2546 (xsys): Flush stdout right after printing the command to ensure
2543 proper ordering of commands and command output in the total
2547 proper ordering of commands and command output in the total
2544 output.
2548 output.
2545 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2549 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2546 system/getoutput as defaults. The old ones are kept for
2550 system/getoutput as defaults. The old ones are kept for
2547 compatibility reasons, so no code which uses this library needs
2551 compatibility reasons, so no code which uses this library needs
2548 changing.
2552 changing.
2549
2553
2550 2003-01-27 *** Released version 0.2.14
2554 2003-01-27 *** Released version 0.2.14
2551
2555
2552 2003-01-25 Fernando Perez <fperez@colorado.edu>
2556 2003-01-25 Fernando Perez <fperez@colorado.edu>
2553
2557
2554 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2558 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2555 functions defined in previous edit sessions could not be re-edited
2559 functions defined in previous edit sessions could not be re-edited
2556 (because the temp files were immediately removed). Now temp files
2560 (because the temp files were immediately removed). Now temp files
2557 are removed only at IPython's exit.
2561 are removed only at IPython's exit.
2558 (Magic.magic_run): Improved @run to perform shell-like expansions
2562 (Magic.magic_run): Improved @run to perform shell-like expansions
2559 on its arguments (~users and $VARS). With this, @run becomes more
2563 on its arguments (~users and $VARS). With this, @run becomes more
2560 like a normal command-line.
2564 like a normal command-line.
2561
2565
2562 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2566 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2563 bugs related to embedding and cleaned up that code. A fairly
2567 bugs related to embedding and cleaned up that code. A fairly
2564 important one was the impossibility to access the global namespace
2568 important one was the impossibility to access the global namespace
2565 through the embedded IPython (only local variables were visible).
2569 through the embedded IPython (only local variables were visible).
2566
2570
2567 2003-01-14 Fernando Perez <fperez@colorado.edu>
2571 2003-01-14 Fernando Perez <fperez@colorado.edu>
2568
2572
2569 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2573 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2570 auto-calling to be a bit more conservative. Now it doesn't get
2574 auto-calling to be a bit more conservative. Now it doesn't get
2571 triggered if any of '!=()<>' are in the rest of the input line, to
2575 triggered if any of '!=()<>' are in the rest of the input line, to
2572 allow comparing callables. Thanks to Alex for the heads up.
2576 allow comparing callables. Thanks to Alex for the heads up.
2573
2577
2574 2003-01-07 Fernando Perez <fperez@colorado.edu>
2578 2003-01-07 Fernando Perez <fperez@colorado.edu>
2575
2579
2576 * IPython/genutils.py (page): fixed estimation of the number of
2580 * IPython/genutils.py (page): fixed estimation of the number of
2577 lines in a string to be paged to simply count newlines. This
2581 lines in a string to be paged to simply count newlines. This
2578 prevents over-guessing due to embedded escape sequences. A better
2582 prevents over-guessing due to embedded escape sequences. A better
2579 long-term solution would involve stripping out the control chars
2583 long-term solution would involve stripping out the control chars
2580 for the count, but it's potentially so expensive I just don't
2584 for the count, but it's potentially so expensive I just don't
2581 think it's worth doing.
2585 think it's worth doing.
2582
2586
2583 2002-12-19 *** Released version 0.2.14pre50
2587 2002-12-19 *** Released version 0.2.14pre50
2584
2588
2585 2002-12-19 Fernando Perez <fperez@colorado.edu>
2589 2002-12-19 Fernando Perez <fperez@colorado.edu>
2586
2590
2587 * tools/release (version): Changed release scripts to inform
2591 * tools/release (version): Changed release scripts to inform
2588 Andrea and build a NEWS file with a list of recent changes.
2592 Andrea and build a NEWS file with a list of recent changes.
2589
2593
2590 * IPython/ColorANSI.py (__all__): changed terminal detection
2594 * IPython/ColorANSI.py (__all__): changed terminal detection
2591 code. Seems to work better for xterms without breaking
2595 code. Seems to work better for xterms without breaking
2592 konsole. Will need more testing to determine if WinXP and Mac OSX
2596 konsole. Will need more testing to determine if WinXP and Mac OSX
2593 also work ok.
2597 also work ok.
2594
2598
2595 2002-12-18 *** Released version 0.2.14pre49
2599 2002-12-18 *** Released version 0.2.14pre49
2596
2600
2597 2002-12-18 Fernando Perez <fperez@colorado.edu>
2601 2002-12-18 Fernando Perez <fperez@colorado.edu>
2598
2602
2599 * Docs: added new info about Mac OSX, from Andrea.
2603 * Docs: added new info about Mac OSX, from Andrea.
2600
2604
2601 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2605 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2602 allow direct plotting of python strings whose format is the same
2606 allow direct plotting of python strings whose format is the same
2603 of gnuplot data files.
2607 of gnuplot data files.
2604
2608
2605 2002-12-16 Fernando Perez <fperez@colorado.edu>
2609 2002-12-16 Fernando Perez <fperez@colorado.edu>
2606
2610
2607 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2611 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2608 value of exit question to be acknowledged.
2612 value of exit question to be acknowledged.
2609
2613
2610 2002-12-03 Fernando Perez <fperez@colorado.edu>
2614 2002-12-03 Fernando Perez <fperez@colorado.edu>
2611
2615
2612 * IPython/ipmaker.py: removed generators, which had been added
2616 * IPython/ipmaker.py: removed generators, which had been added
2613 by mistake in an earlier debugging run. This was causing trouble
2617 by mistake in an earlier debugging run. This was causing trouble
2614 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2618 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2615 for pointing this out.
2619 for pointing this out.
2616
2620
2617 2002-11-17 Fernando Perez <fperez@colorado.edu>
2621 2002-11-17 Fernando Perez <fperez@colorado.edu>
2618
2622
2619 * Manual: updated the Gnuplot section.
2623 * Manual: updated the Gnuplot section.
2620
2624
2621 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2625 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2622 a much better split of what goes in Runtime and what goes in
2626 a much better split of what goes in Runtime and what goes in
2623 Interactive.
2627 Interactive.
2624
2628
2625 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2629 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2626 being imported from iplib.
2630 being imported from iplib.
2627
2631
2628 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2632 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2629 for command-passing. Now the global Gnuplot instance is called
2633 for command-passing. Now the global Gnuplot instance is called
2630 'gp' instead of 'g', which was really a far too fragile and
2634 'gp' instead of 'g', which was really a far too fragile and
2631 common name.
2635 common name.
2632
2636
2633 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2637 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2634 bounding boxes generated by Gnuplot for square plots.
2638 bounding boxes generated by Gnuplot for square plots.
2635
2639
2636 * IPython/genutils.py (popkey): new function added. I should
2640 * IPython/genutils.py (popkey): new function added. I should
2637 suggest this on c.l.py as a dict method, it seems useful.
2641 suggest this on c.l.py as a dict method, it seems useful.
2638
2642
2639 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2643 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2640 to transparently handle PostScript generation. MUCH better than
2644 to transparently handle PostScript generation. MUCH better than
2641 the previous plot_eps/replot_eps (which I removed now). The code
2645 the previous plot_eps/replot_eps (which I removed now). The code
2642 is also fairly clean and well documented now (including
2646 is also fairly clean and well documented now (including
2643 docstrings).
2647 docstrings).
2644
2648
2645 2002-11-13 Fernando Perez <fperez@colorado.edu>
2649 2002-11-13 Fernando Perez <fperez@colorado.edu>
2646
2650
2647 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2651 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2648 (inconsistent with options).
2652 (inconsistent with options).
2649
2653
2650 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2654 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2651 manually disabled, I don't know why. Fixed it.
2655 manually disabled, I don't know why. Fixed it.
2652 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2656 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2653 eps output.
2657 eps output.
2654
2658
2655 2002-11-12 Fernando Perez <fperez@colorado.edu>
2659 2002-11-12 Fernando Perez <fperez@colorado.edu>
2656
2660
2657 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2661 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2658 don't propagate up to caller. Fixes crash reported by François
2662 don't propagate up to caller. Fixes crash reported by François
2659 Pinard.
2663 Pinard.
2660
2664
2661 2002-11-09 Fernando Perez <fperez@colorado.edu>
2665 2002-11-09 Fernando Perez <fperez@colorado.edu>
2662
2666
2663 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2667 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2664 history file for new users.
2668 history file for new users.
2665 (make_IPython): fixed bug where initial install would leave the
2669 (make_IPython): fixed bug where initial install would leave the
2666 user running in the .ipython dir.
2670 user running in the .ipython dir.
2667 (make_IPython): fixed bug where config dir .ipython would be
2671 (make_IPython): fixed bug where config dir .ipython would be
2668 created regardless of the given -ipythondir option. Thanks to Cory
2672 created regardless of the given -ipythondir option. Thanks to Cory
2669 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2673 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2670
2674
2671 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2675 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2672 type confirmations. Will need to use it in all of IPython's code
2676 type confirmations. Will need to use it in all of IPython's code
2673 consistently.
2677 consistently.
2674
2678
2675 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2679 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2676 context to print 31 lines instead of the default 5. This will make
2680 context to print 31 lines instead of the default 5. This will make
2677 the crash reports extremely detailed in case the problem is in
2681 the crash reports extremely detailed in case the problem is in
2678 libraries I don't have access to.
2682 libraries I don't have access to.
2679
2683
2680 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2684 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2681 line of defense' code to still crash, but giving users fair
2685 line of defense' code to still crash, but giving users fair
2682 warning. I don't want internal errors to go unreported: if there's
2686 warning. I don't want internal errors to go unreported: if there's
2683 an internal problem, IPython should crash and generate a full
2687 an internal problem, IPython should crash and generate a full
2684 report.
2688 report.
2685
2689
2686 2002-11-08 Fernando Perez <fperez@colorado.edu>
2690 2002-11-08 Fernando Perez <fperez@colorado.edu>
2687
2691
2688 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2692 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2689 otherwise uncaught exceptions which can appear if people set
2693 otherwise uncaught exceptions which can appear if people set
2690 sys.stdout to something badly broken. Thanks to a crash report
2694 sys.stdout to something badly broken. Thanks to a crash report
2691 from henni-AT-mail.brainbot.com.
2695 from henni-AT-mail.brainbot.com.
2692
2696
2693 2002-11-04 Fernando Perez <fperez@colorado.edu>
2697 2002-11-04 Fernando Perez <fperez@colorado.edu>
2694
2698
2695 * IPython/iplib.py (InteractiveShell.interact): added
2699 * IPython/iplib.py (InteractiveShell.interact): added
2696 __IPYTHON__active to the builtins. It's a flag which goes on when
2700 __IPYTHON__active to the builtins. It's a flag which goes on when
2697 the interaction starts and goes off again when it stops. This
2701 the interaction starts and goes off again when it stops. This
2698 allows embedding code to detect being inside IPython. Before this
2702 allows embedding code to detect being inside IPython. Before this
2699 was done via __IPYTHON__, but that only shows that an IPython
2703 was done via __IPYTHON__, but that only shows that an IPython
2700 instance has been created.
2704 instance has been created.
2701
2705
2702 * IPython/Magic.py (Magic.magic_env): I realized that in a
2706 * IPython/Magic.py (Magic.magic_env): I realized that in a
2703 UserDict, instance.data holds the data as a normal dict. So I
2707 UserDict, instance.data holds the data as a normal dict. So I
2704 modified @env to return os.environ.data instead of rebuilding a
2708 modified @env to return os.environ.data instead of rebuilding a
2705 dict by hand.
2709 dict by hand.
2706
2710
2707 2002-11-02 Fernando Perez <fperez@colorado.edu>
2711 2002-11-02 Fernando Perez <fperez@colorado.edu>
2708
2712
2709 * IPython/genutils.py (warn): changed so that level 1 prints no
2713 * IPython/genutils.py (warn): changed so that level 1 prints no
2710 header. Level 2 is now the default (with 'WARNING' header, as
2714 header. Level 2 is now the default (with 'WARNING' header, as
2711 before). I think I tracked all places where changes were needed in
2715 before). I think I tracked all places where changes were needed in
2712 IPython, but outside code using the old level numbering may have
2716 IPython, but outside code using the old level numbering may have
2713 broken.
2717 broken.
2714
2718
2715 * IPython/iplib.py (InteractiveShell.runcode): added this to
2719 * IPython/iplib.py (InteractiveShell.runcode): added this to
2716 handle the tracebacks in SystemExit traps correctly. The previous
2720 handle the tracebacks in SystemExit traps correctly. The previous
2717 code (through interact) was printing more of the stack than
2721 code (through interact) was printing more of the stack than
2718 necessary, showing IPython internal code to the user.
2722 necessary, showing IPython internal code to the user.
2719
2723
2720 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2724 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2721 default. Now that the default at the confirmation prompt is yes,
2725 default. Now that the default at the confirmation prompt is yes,
2722 it's not so intrusive. François' argument that ipython sessions
2726 it's not so intrusive. François' argument that ipython sessions
2723 tend to be complex enough not to lose them from an accidental C-d,
2727 tend to be complex enough not to lose them from an accidental C-d,
2724 is a valid one.
2728 is a valid one.
2725
2729
2726 * IPython/iplib.py (InteractiveShell.interact): added a
2730 * IPython/iplib.py (InteractiveShell.interact): added a
2727 showtraceback() call to the SystemExit trap, and modified the exit
2731 showtraceback() call to the SystemExit trap, and modified the exit
2728 confirmation to have yes as the default.
2732 confirmation to have yes as the default.
2729
2733
2730 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2734 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2731 this file. It's been gone from the code for a long time, this was
2735 this file. It's been gone from the code for a long time, this was
2732 simply leftover junk.
2736 simply leftover junk.
2733
2737
2734 2002-11-01 Fernando Perez <fperez@colorado.edu>
2738 2002-11-01 Fernando Perez <fperez@colorado.edu>
2735
2739
2736 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2740 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2737 added. If set, IPython now traps EOF and asks for
2741 added. If set, IPython now traps EOF and asks for
2738 confirmation. After a request by François Pinard.
2742 confirmation. After a request by François Pinard.
2739
2743
2740 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2744 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2741 of @abort, and with a new (better) mechanism for handling the
2745 of @abort, and with a new (better) mechanism for handling the
2742 exceptions.
2746 exceptions.
2743
2747
2744 2002-10-27 Fernando Perez <fperez@colorado.edu>
2748 2002-10-27 Fernando Perez <fperez@colorado.edu>
2745
2749
2746 * IPython/usage.py (__doc__): updated the --help information and
2750 * IPython/usage.py (__doc__): updated the --help information and
2747 the ipythonrc file to indicate that -log generates
2751 the ipythonrc file to indicate that -log generates
2748 ./ipython.log. Also fixed the corresponding info in @logstart.
2752 ./ipython.log. Also fixed the corresponding info in @logstart.
2749 This and several other fixes in the manuals thanks to reports by
2753 This and several other fixes in the manuals thanks to reports by
2750 François Pinard <pinard-AT-iro.umontreal.ca>.
2754 François Pinard <pinard-AT-iro.umontreal.ca>.
2751
2755
2752 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2756 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2753 refer to @logstart (instead of @log, which doesn't exist).
2757 refer to @logstart (instead of @log, which doesn't exist).
2754
2758
2755 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2759 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2756 AttributeError crash. Thanks to Christopher Armstrong
2760 AttributeError crash. Thanks to Christopher Armstrong
2757 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2761 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2758 introduced recently (in 0.2.14pre37) with the fix to the eval
2762 introduced recently (in 0.2.14pre37) with the fix to the eval
2759 problem mentioned below.
2763 problem mentioned below.
2760
2764
2761 2002-10-17 Fernando Perez <fperez@colorado.edu>
2765 2002-10-17 Fernando Perez <fperez@colorado.edu>
2762
2766
2763 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2767 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2764 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2768 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2765
2769
2766 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2770 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2767 this function to fix a problem reported by Alex Schmolck. He saw
2771 this function to fix a problem reported by Alex Schmolck. He saw
2768 it with list comprehensions and generators, which were getting
2772 it with list comprehensions and generators, which were getting
2769 called twice. The real problem was an 'eval' call in testing for
2773 called twice. The real problem was an 'eval' call in testing for
2770 automagic which was evaluating the input line silently.
2774 automagic which was evaluating the input line silently.
2771
2775
2772 This is a potentially very nasty bug, if the input has side
2776 This is a potentially very nasty bug, if the input has side
2773 effects which must not be repeated. The code is much cleaner now,
2777 effects which must not be repeated. The code is much cleaner now,
2774 without any blanket 'except' left and with a regexp test for
2778 without any blanket 'except' left and with a regexp test for
2775 actual function names.
2779 actual function names.
2776
2780
2777 But an eval remains, which I'm not fully comfortable with. I just
2781 But an eval remains, which I'm not fully comfortable with. I just
2778 don't know how to find out if an expression could be a callable in
2782 don't know how to find out if an expression could be a callable in
2779 the user's namespace without doing an eval on the string. However
2783 the user's namespace without doing an eval on the string. However
2780 that string is now much more strictly checked so that no code
2784 that string is now much more strictly checked so that no code
2781 slips by, so the eval should only happen for things that can
2785 slips by, so the eval should only happen for things that can
2782 really be only function/method names.
2786 really be only function/method names.
2783
2787
2784 2002-10-15 Fernando Perez <fperez@colorado.edu>
2788 2002-10-15 Fernando Perez <fperez@colorado.edu>
2785
2789
2786 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2790 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2787 OSX information to main manual, removed README_Mac_OSX file from
2791 OSX information to main manual, removed README_Mac_OSX file from
2788 distribution. Also updated credits for recent additions.
2792 distribution. Also updated credits for recent additions.
2789
2793
2790 2002-10-10 Fernando Perez <fperez@colorado.edu>
2794 2002-10-10 Fernando Perez <fperez@colorado.edu>
2791
2795
2792 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2796 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2793 terminal-related issues. Many thanks to Andrea Riciputi
2797 terminal-related issues. Many thanks to Andrea Riciputi
2794 <andrea.riciputi-AT-libero.it> for writing it.
2798 <andrea.riciputi-AT-libero.it> for writing it.
2795
2799
2796 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2800 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2797 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2801 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2798
2802
2799 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2803 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2800 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2804 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2801 <syver-en-AT-online.no> who both submitted patches for this problem.
2805 <syver-en-AT-online.no> who both submitted patches for this problem.
2802
2806
2803 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2807 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2804 global embedding to make sure that things don't overwrite user
2808 global embedding to make sure that things don't overwrite user
2805 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2809 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2806
2810
2807 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2811 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2808 compatibility. Thanks to Hayden Callow
2812 compatibility. Thanks to Hayden Callow
2809 <h.callow-AT-elec.canterbury.ac.nz>
2813 <h.callow-AT-elec.canterbury.ac.nz>
2810
2814
2811 2002-10-04 Fernando Perez <fperez@colorado.edu>
2815 2002-10-04 Fernando Perez <fperez@colorado.edu>
2812
2816
2813 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2817 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2814 Gnuplot.File objects.
2818 Gnuplot.File objects.
2815
2819
2816 2002-07-23 Fernando Perez <fperez@colorado.edu>
2820 2002-07-23 Fernando Perez <fperez@colorado.edu>
2817
2821
2818 * IPython/genutils.py (timing): Added timings() and timing() for
2822 * IPython/genutils.py (timing): Added timings() and timing() for
2819 quick access to the most commonly needed data, the execution
2823 quick access to the most commonly needed data, the execution
2820 times. Old timing() renamed to timings_out().
2824 times. Old timing() renamed to timings_out().
2821
2825
2822 2002-07-18 Fernando Perez <fperez@colorado.edu>
2826 2002-07-18 Fernando Perez <fperez@colorado.edu>
2823
2827
2824 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2828 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2825 bug with nested instances disrupting the parent's tab completion.
2829 bug with nested instances disrupting the parent's tab completion.
2826
2830
2827 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2831 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2828 all_completions code to begin the emacs integration.
2832 all_completions code to begin the emacs integration.
2829
2833
2830 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2834 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2831 argument to allow titling individual arrays when plotting.
2835 argument to allow titling individual arrays when plotting.
2832
2836
2833 2002-07-15 Fernando Perez <fperez@colorado.edu>
2837 2002-07-15 Fernando Perez <fperez@colorado.edu>
2834
2838
2835 * setup.py (make_shortcut): changed to retrieve the value of
2839 * setup.py (make_shortcut): changed to retrieve the value of
2836 'Program Files' directory from the registry (this value changes in
2840 'Program Files' directory from the registry (this value changes in
2837 non-english versions of Windows). Thanks to Thomas Fanslau
2841 non-english versions of Windows). Thanks to Thomas Fanslau
2838 <tfanslau-AT-gmx.de> for the report.
2842 <tfanslau-AT-gmx.de> for the report.
2839
2843
2840 2002-07-10 Fernando Perez <fperez@colorado.edu>
2844 2002-07-10 Fernando Perez <fperez@colorado.edu>
2841
2845
2842 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2846 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2843 a bug in pdb, which crashes if a line with only whitespace is
2847 a bug in pdb, which crashes if a line with only whitespace is
2844 entered. Bug report submitted to sourceforge.
2848 entered. Bug report submitted to sourceforge.
2845
2849
2846 2002-07-09 Fernando Perez <fperez@colorado.edu>
2850 2002-07-09 Fernando Perez <fperez@colorado.edu>
2847
2851
2848 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2852 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2849 reporting exceptions (it's a bug in inspect.py, I just set a
2853 reporting exceptions (it's a bug in inspect.py, I just set a
2850 workaround).
2854 workaround).
2851
2855
2852 2002-07-08 Fernando Perez <fperez@colorado.edu>
2856 2002-07-08 Fernando Perez <fperez@colorado.edu>
2853
2857
2854 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2858 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2855 __IPYTHON__ in __builtins__ to show up in user_ns.
2859 __IPYTHON__ in __builtins__ to show up in user_ns.
2856
2860
2857 2002-07-03 Fernando Perez <fperez@colorado.edu>
2861 2002-07-03 Fernando Perez <fperez@colorado.edu>
2858
2862
2859 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2863 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2860 name from @gp_set_instance to @gp_set_default.
2864 name from @gp_set_instance to @gp_set_default.
2861
2865
2862 * IPython/ipmaker.py (make_IPython): default editor value set to
2866 * IPython/ipmaker.py (make_IPython): default editor value set to
2863 '0' (a string), to match the rc file. Otherwise will crash when
2867 '0' (a string), to match the rc file. Otherwise will crash when
2864 .strip() is called on it.
2868 .strip() is called on it.
2865
2869
2866
2870
2867 2002-06-28 Fernando Perez <fperez@colorado.edu>
2871 2002-06-28 Fernando Perez <fperez@colorado.edu>
2868
2872
2869 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2873 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2870 of files in current directory when a file is executed via
2874 of files in current directory when a file is executed via
2871 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2875 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2872
2876
2873 * setup.py (manfiles): fix for rpm builds, submitted by RA
2877 * setup.py (manfiles): fix for rpm builds, submitted by RA
2874 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2878 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2875
2879
2876 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2880 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2877 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2881 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2878 string!). A. Schmolck caught this one.
2882 string!). A. Schmolck caught this one.
2879
2883
2880 2002-06-27 Fernando Perez <fperez@colorado.edu>
2884 2002-06-27 Fernando Perez <fperez@colorado.edu>
2881
2885
2882 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2886 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2883 defined files at the cmd line. __name__ wasn't being set to
2887 defined files at the cmd line. __name__ wasn't being set to
2884 __main__.
2888 __main__.
2885
2889
2886 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2890 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2887 regular lists and tuples besides Numeric arrays.
2891 regular lists and tuples besides Numeric arrays.
2888
2892
2889 * IPython/Prompts.py (CachedOutput.__call__): Added output
2893 * IPython/Prompts.py (CachedOutput.__call__): Added output
2890 supression for input ending with ';'. Similar to Mathematica and
2894 supression for input ending with ';'. Similar to Mathematica and
2891 Matlab. The _* vars and Out[] list are still updated, just like
2895 Matlab. The _* vars and Out[] list are still updated, just like
2892 Mathematica behaves.
2896 Mathematica behaves.
2893
2897
2894 2002-06-25 Fernando Perez <fperez@colorado.edu>
2898 2002-06-25 Fernando Perez <fperez@colorado.edu>
2895
2899
2896 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2900 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2897 .ini extensions for profiels under Windows.
2901 .ini extensions for profiels under Windows.
2898
2902
2899 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2903 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2900 string form. Fix contributed by Alexander Schmolck
2904 string form. Fix contributed by Alexander Schmolck
2901 <a.schmolck-AT-gmx.net>
2905 <a.schmolck-AT-gmx.net>
2902
2906
2903 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2907 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2904 pre-configured Gnuplot instance.
2908 pre-configured Gnuplot instance.
2905
2909
2906 2002-06-21 Fernando Perez <fperez@colorado.edu>
2910 2002-06-21 Fernando Perez <fperez@colorado.edu>
2907
2911
2908 * IPython/numutils.py (exp_safe): new function, works around the
2912 * IPython/numutils.py (exp_safe): new function, works around the
2909 underflow problems in Numeric.
2913 underflow problems in Numeric.
2910 (log2): New fn. Safe log in base 2: returns exact integer answer
2914 (log2): New fn. Safe log in base 2: returns exact integer answer
2911 for exact integer powers of 2.
2915 for exact integer powers of 2.
2912
2916
2913 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2917 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2914 properly.
2918 properly.
2915
2919
2916 2002-06-20 Fernando Perez <fperez@colorado.edu>
2920 2002-06-20 Fernando Perez <fperez@colorado.edu>
2917
2921
2918 * IPython/genutils.py (timing): new function like
2922 * IPython/genutils.py (timing): new function like
2919 Mathematica's. Similar to time_test, but returns more info.
2923 Mathematica's. Similar to time_test, but returns more info.
2920
2924
2921 2002-06-18 Fernando Perez <fperez@colorado.edu>
2925 2002-06-18 Fernando Perez <fperez@colorado.edu>
2922
2926
2923 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2927 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2924 according to Mike Heeter's suggestions.
2928 according to Mike Heeter's suggestions.
2925
2929
2926 2002-06-16 Fernando Perez <fperez@colorado.edu>
2930 2002-06-16 Fernando Perez <fperez@colorado.edu>
2927
2931
2928 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2932 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2929 system. GnuplotMagic is gone as a user-directory option. New files
2933 system. GnuplotMagic is gone as a user-directory option. New files
2930 make it easier to use all the gnuplot stuff both from external
2934 make it easier to use all the gnuplot stuff both from external
2931 programs as well as from IPython. Had to rewrite part of
2935 programs as well as from IPython. Had to rewrite part of
2932 hardcopy() b/c of a strange bug: often the ps files simply don't
2936 hardcopy() b/c of a strange bug: often the ps files simply don't
2933 get created, and require a repeat of the command (often several
2937 get created, and require a repeat of the command (often several
2934 times).
2938 times).
2935
2939
2936 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2940 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2937 resolve output channel at call time, so that if sys.stderr has
2941 resolve output channel at call time, so that if sys.stderr has
2938 been redirected by user this gets honored.
2942 been redirected by user this gets honored.
2939
2943
2940 2002-06-13 Fernando Perez <fperez@colorado.edu>
2944 2002-06-13 Fernando Perez <fperez@colorado.edu>
2941
2945
2942 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2946 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2943 IPShell. Kept a copy with the old names to avoid breaking people's
2947 IPShell. Kept a copy with the old names to avoid breaking people's
2944 embedded code.
2948 embedded code.
2945
2949
2946 * IPython/ipython: simplified it to the bare minimum after
2950 * IPython/ipython: simplified it to the bare minimum after
2947 Holger's suggestions. Added info about how to use it in
2951 Holger's suggestions. Added info about how to use it in
2948 PYTHONSTARTUP.
2952 PYTHONSTARTUP.
2949
2953
2950 * IPython/Shell.py (IPythonShell): changed the options passing
2954 * IPython/Shell.py (IPythonShell): changed the options passing
2951 from a string with funky %s replacements to a straight list. Maybe
2955 from a string with funky %s replacements to a straight list. Maybe
2952 a bit more typing, but it follows sys.argv conventions, so there's
2956 a bit more typing, but it follows sys.argv conventions, so there's
2953 less special-casing to remember.
2957 less special-casing to remember.
2954
2958
2955 2002-06-12 Fernando Perez <fperez@colorado.edu>
2959 2002-06-12 Fernando Perez <fperez@colorado.edu>
2956
2960
2957 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2961 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2958 command. Thanks to a suggestion by Mike Heeter.
2962 command. Thanks to a suggestion by Mike Heeter.
2959 (Magic.magic_pfile): added behavior to look at filenames if given
2963 (Magic.magic_pfile): added behavior to look at filenames if given
2960 arg is not a defined object.
2964 arg is not a defined object.
2961 (Magic.magic_save): New @save function to save code snippets. Also
2965 (Magic.magic_save): New @save function to save code snippets. Also
2962 a Mike Heeter idea.
2966 a Mike Heeter idea.
2963
2967
2964 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2968 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2965 plot() and replot(). Much more convenient now, especially for
2969 plot() and replot(). Much more convenient now, especially for
2966 interactive use.
2970 interactive use.
2967
2971
2968 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2972 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2969 filenames.
2973 filenames.
2970
2974
2971 2002-06-02 Fernando Perez <fperez@colorado.edu>
2975 2002-06-02 Fernando Perez <fperez@colorado.edu>
2972
2976
2973 * IPython/Struct.py (Struct.__init__): modified to admit
2977 * IPython/Struct.py (Struct.__init__): modified to admit
2974 initialization via another struct.
2978 initialization via another struct.
2975
2979
2976 * IPython/genutils.py (SystemExec.__init__): New stateful
2980 * IPython/genutils.py (SystemExec.__init__): New stateful
2977 interface to xsys and bq. Useful for writing system scripts.
2981 interface to xsys and bq. Useful for writing system scripts.
2978
2982
2979 2002-05-30 Fernando Perez <fperez@colorado.edu>
2983 2002-05-30 Fernando Perez <fperez@colorado.edu>
2980
2984
2981 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2985 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2982 documents. This will make the user download smaller (it's getting
2986 documents. This will make the user download smaller (it's getting
2983 too big).
2987 too big).
2984
2988
2985 2002-05-29 Fernando Perez <fperez@colorado.edu>
2989 2002-05-29 Fernando Perez <fperez@colorado.edu>
2986
2990
2987 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2991 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2988 fix problems with shelve and pickle. Seems to work, but I don't
2992 fix problems with shelve and pickle. Seems to work, but I don't
2989 know if corner cases break it. Thanks to Mike Heeter
2993 know if corner cases break it. Thanks to Mike Heeter
2990 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2994 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2991
2995
2992 2002-05-24 Fernando Perez <fperez@colorado.edu>
2996 2002-05-24 Fernando Perez <fperez@colorado.edu>
2993
2997
2994 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2998 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2995 macros having broken.
2999 macros having broken.
2996
3000
2997 2002-05-21 Fernando Perez <fperez@colorado.edu>
3001 2002-05-21 Fernando Perez <fperez@colorado.edu>
2998
3002
2999 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3003 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3000 introduced logging bug: all history before logging started was
3004 introduced logging bug: all history before logging started was
3001 being written one character per line! This came from the redesign
3005 being written one character per line! This came from the redesign
3002 of the input history as a special list which slices to strings,
3006 of the input history as a special list which slices to strings,
3003 not to lists.
3007 not to lists.
3004
3008
3005 2002-05-20 Fernando Perez <fperez@colorado.edu>
3009 2002-05-20 Fernando Perez <fperez@colorado.edu>
3006
3010
3007 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3011 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3008 be an attribute of all classes in this module. The design of these
3012 be an attribute of all classes in this module. The design of these
3009 classes needs some serious overhauling.
3013 classes needs some serious overhauling.
3010
3014
3011 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3015 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3012 which was ignoring '_' in option names.
3016 which was ignoring '_' in option names.
3013
3017
3014 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3018 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3015 'Verbose_novars' to 'Context' and made it the new default. It's a
3019 'Verbose_novars' to 'Context' and made it the new default. It's a
3016 bit more readable and also safer than verbose.
3020 bit more readable and also safer than verbose.
3017
3021
3018 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3022 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3019 triple-quoted strings.
3023 triple-quoted strings.
3020
3024
3021 * IPython/OInspect.py (__all__): new module exposing the object
3025 * IPython/OInspect.py (__all__): new module exposing the object
3022 introspection facilities. Now the corresponding magics are dummy
3026 introspection facilities. Now the corresponding magics are dummy
3023 wrappers around this. Having this module will make it much easier
3027 wrappers around this. Having this module will make it much easier
3024 to put these functions into our modified pdb.
3028 to put these functions into our modified pdb.
3025 This new object inspector system uses the new colorizing module,
3029 This new object inspector system uses the new colorizing module,
3026 so source code and other things are nicely syntax highlighted.
3030 so source code and other things are nicely syntax highlighted.
3027
3031
3028 2002-05-18 Fernando Perez <fperez@colorado.edu>
3032 2002-05-18 Fernando Perez <fperez@colorado.edu>
3029
3033
3030 * IPython/ColorANSI.py: Split the coloring tools into a separate
3034 * IPython/ColorANSI.py: Split the coloring tools into a separate
3031 module so I can use them in other code easier (they were part of
3035 module so I can use them in other code easier (they were part of
3032 ultraTB).
3036 ultraTB).
3033
3037
3034 2002-05-17 Fernando Perez <fperez@colorado.edu>
3038 2002-05-17 Fernando Perez <fperez@colorado.edu>
3035
3039
3036 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3040 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3037 fixed it to set the global 'g' also to the called instance, as
3041 fixed it to set the global 'g' also to the called instance, as
3038 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3042 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3039 user's 'g' variables).
3043 user's 'g' variables).
3040
3044
3041 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3045 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3042 global variables (aliases to _ih,_oh) so that users which expect
3046 global variables (aliases to _ih,_oh) so that users which expect
3043 In[5] or Out[7] to work aren't unpleasantly surprised.
3047 In[5] or Out[7] to work aren't unpleasantly surprised.
3044 (InputList.__getslice__): new class to allow executing slices of
3048 (InputList.__getslice__): new class to allow executing slices of
3045 input history directly. Very simple class, complements the use of
3049 input history directly. Very simple class, complements the use of
3046 macros.
3050 macros.
3047
3051
3048 2002-05-16 Fernando Perez <fperez@colorado.edu>
3052 2002-05-16 Fernando Perez <fperez@colorado.edu>
3049
3053
3050 * setup.py (docdirbase): make doc directory be just doc/IPython
3054 * setup.py (docdirbase): make doc directory be just doc/IPython
3051 without version numbers, it will reduce clutter for users.
3055 without version numbers, it will reduce clutter for users.
3052
3056
3053 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3057 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3054 execfile call to prevent possible memory leak. See for details:
3058 execfile call to prevent possible memory leak. See for details:
3055 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3059 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3056
3060
3057 2002-05-15 Fernando Perez <fperez@colorado.edu>
3061 2002-05-15 Fernando Perez <fperez@colorado.edu>
3058
3062
3059 * IPython/Magic.py (Magic.magic_psource): made the object
3063 * IPython/Magic.py (Magic.magic_psource): made the object
3060 introspection names be more standard: pdoc, pdef, pfile and
3064 introspection names be more standard: pdoc, pdef, pfile and
3061 psource. They all print/page their output, and it makes
3065 psource. They all print/page their output, and it makes
3062 remembering them easier. Kept old names for compatibility as
3066 remembering them easier. Kept old names for compatibility as
3063 aliases.
3067 aliases.
3064
3068
3065 2002-05-14 Fernando Perez <fperez@colorado.edu>
3069 2002-05-14 Fernando Perez <fperez@colorado.edu>
3066
3070
3067 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3071 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3068 what the mouse problem was. The trick is to use gnuplot with temp
3072 what the mouse problem was. The trick is to use gnuplot with temp
3069 files and NOT with pipes (for data communication), because having
3073 files and NOT with pipes (for data communication), because having
3070 both pipes and the mouse on is bad news.
3074 both pipes and the mouse on is bad news.
3071
3075
3072 2002-05-13 Fernando Perez <fperez@colorado.edu>
3076 2002-05-13 Fernando Perez <fperez@colorado.edu>
3073
3077
3074 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3078 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3075 bug. Information would be reported about builtins even when
3079 bug. Information would be reported about builtins even when
3076 user-defined functions overrode them.
3080 user-defined functions overrode them.
3077
3081
3078 2002-05-11 Fernando Perez <fperez@colorado.edu>
3082 2002-05-11 Fernando Perez <fperez@colorado.edu>
3079
3083
3080 * IPython/__init__.py (__all__): removed FlexCompleter from
3084 * IPython/__init__.py (__all__): removed FlexCompleter from
3081 __all__ so that things don't fail in platforms without readline.
3085 __all__ so that things don't fail in platforms without readline.
3082
3086
3083 2002-05-10 Fernando Perez <fperez@colorado.edu>
3087 2002-05-10 Fernando Perez <fperez@colorado.edu>
3084
3088
3085 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3089 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3086 it requires Numeric, effectively making Numeric a dependency for
3090 it requires Numeric, effectively making Numeric a dependency for
3087 IPython.
3091 IPython.
3088
3092
3089 * Released 0.2.13
3093 * Released 0.2.13
3090
3094
3091 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3095 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3092 profiler interface. Now all the major options from the profiler
3096 profiler interface. Now all the major options from the profiler
3093 module are directly supported in IPython, both for single
3097 module are directly supported in IPython, both for single
3094 expressions (@prun) and for full programs (@run -p).
3098 expressions (@prun) and for full programs (@run -p).
3095
3099
3096 2002-05-09 Fernando Perez <fperez@colorado.edu>
3100 2002-05-09 Fernando Perez <fperez@colorado.edu>
3097
3101
3098 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3102 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3099 magic properly formatted for screen.
3103 magic properly formatted for screen.
3100
3104
3101 * setup.py (make_shortcut): Changed things to put pdf version in
3105 * setup.py (make_shortcut): Changed things to put pdf version in
3102 doc/ instead of doc/manual (had to change lyxport a bit).
3106 doc/ instead of doc/manual (had to change lyxport a bit).
3103
3107
3104 * IPython/Magic.py (Profile.string_stats): made profile runs go
3108 * IPython/Magic.py (Profile.string_stats): made profile runs go
3105 through pager (they are long and a pager allows searching, saving,
3109 through pager (they are long and a pager allows searching, saving,
3106 etc.)
3110 etc.)
3107
3111
3108 2002-05-08 Fernando Perez <fperez@colorado.edu>
3112 2002-05-08 Fernando Perez <fperez@colorado.edu>
3109
3113
3110 * Released 0.2.12
3114 * Released 0.2.12
3111
3115
3112 2002-05-06 Fernando Perez <fperez@colorado.edu>
3116 2002-05-06 Fernando Perez <fperez@colorado.edu>
3113
3117
3114 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3118 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3115 introduced); 'hist n1 n2' was broken.
3119 introduced); 'hist n1 n2' was broken.
3116 (Magic.magic_pdb): added optional on/off arguments to @pdb
3120 (Magic.magic_pdb): added optional on/off arguments to @pdb
3117 (Magic.magic_run): added option -i to @run, which executes code in
3121 (Magic.magic_run): added option -i to @run, which executes code in
3118 the IPython namespace instead of a clean one. Also added @irun as
3122 the IPython namespace instead of a clean one. Also added @irun as
3119 an alias to @run -i.
3123 an alias to @run -i.
3120
3124
3121 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3125 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3122 fixed (it didn't really do anything, the namespaces were wrong).
3126 fixed (it didn't really do anything, the namespaces were wrong).
3123
3127
3124 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3128 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3125
3129
3126 * IPython/__init__.py (__all__): Fixed package namespace, now
3130 * IPython/__init__.py (__all__): Fixed package namespace, now
3127 'import IPython' does give access to IPython.<all> as
3131 'import IPython' does give access to IPython.<all> as
3128 expected. Also renamed __release__ to Release.
3132 expected. Also renamed __release__ to Release.
3129
3133
3130 * IPython/Debugger.py (__license__): created new Pdb class which
3134 * IPython/Debugger.py (__license__): created new Pdb class which
3131 functions like a drop-in for the normal pdb.Pdb but does NOT
3135 functions like a drop-in for the normal pdb.Pdb but does NOT
3132 import readline by default. This way it doesn't muck up IPython's
3136 import readline by default. This way it doesn't muck up IPython's
3133 readline handling, and now tab-completion finally works in the
3137 readline handling, and now tab-completion finally works in the
3134 debugger -- sort of. It completes things globally visible, but the
3138 debugger -- sort of. It completes things globally visible, but the
3135 completer doesn't track the stack as pdb walks it. That's a bit
3139 completer doesn't track the stack as pdb walks it. That's a bit
3136 tricky, and I'll have to implement it later.
3140 tricky, and I'll have to implement it later.
3137
3141
3138 2002-05-05 Fernando Perez <fperez@colorado.edu>
3142 2002-05-05 Fernando Perez <fperez@colorado.edu>
3139
3143
3140 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3144 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3141 magic docstrings when printed via ? (explicit \'s were being
3145 magic docstrings when printed via ? (explicit \'s were being
3142 printed).
3146 printed).
3143
3147
3144 * IPython/ipmaker.py (make_IPython): fixed namespace
3148 * IPython/ipmaker.py (make_IPython): fixed namespace
3145 identification bug. Now variables loaded via logs or command-line
3149 identification bug. Now variables loaded via logs or command-line
3146 files are recognized in the interactive namespace by @who.
3150 files are recognized in the interactive namespace by @who.
3147
3151
3148 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3152 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3149 log replay system stemming from the string form of Structs.
3153 log replay system stemming from the string form of Structs.
3150
3154
3151 * IPython/Magic.py (Macro.__init__): improved macros to properly
3155 * IPython/Magic.py (Macro.__init__): improved macros to properly
3152 handle magic commands in them.
3156 handle magic commands in them.
3153 (Magic.magic_logstart): usernames are now expanded so 'logstart
3157 (Magic.magic_logstart): usernames are now expanded so 'logstart
3154 ~/mylog' now works.
3158 ~/mylog' now works.
3155
3159
3156 * IPython/iplib.py (complete): fixed bug where paths starting with
3160 * IPython/iplib.py (complete): fixed bug where paths starting with
3157 '/' would be completed as magic names.
3161 '/' would be completed as magic names.
3158
3162
3159 2002-05-04 Fernando Perez <fperez@colorado.edu>
3163 2002-05-04 Fernando Perez <fperez@colorado.edu>
3160
3164
3161 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3165 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3162 allow running full programs under the profiler's control.
3166 allow running full programs under the profiler's control.
3163
3167
3164 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3168 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3165 mode to report exceptions verbosely but without formatting
3169 mode to report exceptions verbosely but without formatting
3166 variables. This addresses the issue of ipython 'freezing' (it's
3170 variables. This addresses the issue of ipython 'freezing' (it's
3167 not frozen, but caught in an expensive formatting loop) when huge
3171 not frozen, but caught in an expensive formatting loop) when huge
3168 variables are in the context of an exception.
3172 variables are in the context of an exception.
3169 (VerboseTB.text): Added '--->' markers at line where exception was
3173 (VerboseTB.text): Added '--->' markers at line where exception was
3170 triggered. Much clearer to read, especially in NoColor modes.
3174 triggered. Much clearer to read, especially in NoColor modes.
3171
3175
3172 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3176 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3173 implemented in reverse when changing to the new parse_options().
3177 implemented in reverse when changing to the new parse_options().
3174
3178
3175 2002-05-03 Fernando Perez <fperez@colorado.edu>
3179 2002-05-03 Fernando Perez <fperez@colorado.edu>
3176
3180
3177 * IPython/Magic.py (Magic.parse_options): new function so that
3181 * IPython/Magic.py (Magic.parse_options): new function so that
3178 magics can parse options easier.
3182 magics can parse options easier.
3179 (Magic.magic_prun): new function similar to profile.run(),
3183 (Magic.magic_prun): new function similar to profile.run(),
3180 suggested by Chris Hart.
3184 suggested by Chris Hart.
3181 (Magic.magic_cd): fixed behavior so that it only changes if
3185 (Magic.magic_cd): fixed behavior so that it only changes if
3182 directory actually is in history.
3186 directory actually is in history.
3183
3187
3184 * IPython/usage.py (__doc__): added information about potential
3188 * IPython/usage.py (__doc__): added information about potential
3185 slowness of Verbose exception mode when there are huge data
3189 slowness of Verbose exception mode when there are huge data
3186 structures to be formatted (thanks to Archie Paulson).
3190 structures to be formatted (thanks to Archie Paulson).
3187
3191
3188 * IPython/ipmaker.py (make_IPython): Changed default logging
3192 * IPython/ipmaker.py (make_IPython): Changed default logging
3189 (when simply called with -log) to use curr_dir/ipython.log in
3193 (when simply called with -log) to use curr_dir/ipython.log in
3190 rotate mode. Fixed crash which was occuring with -log before
3194 rotate mode. Fixed crash which was occuring with -log before
3191 (thanks to Jim Boyle).
3195 (thanks to Jim Boyle).
3192
3196
3193 2002-05-01 Fernando Perez <fperez@colorado.edu>
3197 2002-05-01 Fernando Perez <fperez@colorado.edu>
3194
3198
3195 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3199 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3196 was nasty -- though somewhat of a corner case).
3200 was nasty -- though somewhat of a corner case).
3197
3201
3198 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3202 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3199 text (was a bug).
3203 text (was a bug).
3200
3204
3201 2002-04-30 Fernando Perez <fperez@colorado.edu>
3205 2002-04-30 Fernando Perez <fperez@colorado.edu>
3202
3206
3203 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3207 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3204 a print after ^D or ^C from the user so that the In[] prompt
3208 a print after ^D or ^C from the user so that the In[] prompt
3205 doesn't over-run the gnuplot one.
3209 doesn't over-run the gnuplot one.
3206
3210
3207 2002-04-29 Fernando Perez <fperez@colorado.edu>
3211 2002-04-29 Fernando Perez <fperez@colorado.edu>
3208
3212
3209 * Released 0.2.10
3213 * Released 0.2.10
3210
3214
3211 * IPython/__release__.py (version): get date dynamically.
3215 * IPython/__release__.py (version): get date dynamically.
3212
3216
3213 * Misc. documentation updates thanks to Arnd's comments. Also ran
3217 * Misc. documentation updates thanks to Arnd's comments. Also ran
3214 a full spellcheck on the manual (hadn't been done in a while).
3218 a full spellcheck on the manual (hadn't been done in a while).
3215
3219
3216 2002-04-27 Fernando Perez <fperez@colorado.edu>
3220 2002-04-27 Fernando Perez <fperez@colorado.edu>
3217
3221
3218 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3222 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3219 starting a log in mid-session would reset the input history list.
3223 starting a log in mid-session would reset the input history list.
3220
3224
3221 2002-04-26 Fernando Perez <fperez@colorado.edu>
3225 2002-04-26 Fernando Perez <fperez@colorado.edu>
3222
3226
3223 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3227 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3224 all files were being included in an update. Now anything in
3228 all files were being included in an update. Now anything in
3225 UserConfig that matches [A-Za-z]*.py will go (this excludes
3229 UserConfig that matches [A-Za-z]*.py will go (this excludes
3226 __init__.py)
3230 __init__.py)
3227
3231
3228 2002-04-25 Fernando Perez <fperez@colorado.edu>
3232 2002-04-25 Fernando Perez <fperez@colorado.edu>
3229
3233
3230 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3234 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3231 to __builtins__ so that any form of embedded or imported code can
3235 to __builtins__ so that any form of embedded or imported code can
3232 test for being inside IPython.
3236 test for being inside IPython.
3233
3237
3234 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3238 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3235 changed to GnuplotMagic because it's now an importable module,
3239 changed to GnuplotMagic because it's now an importable module,
3236 this makes the name follow that of the standard Gnuplot module.
3240 this makes the name follow that of the standard Gnuplot module.
3237 GnuplotMagic can now be loaded at any time in mid-session.
3241 GnuplotMagic can now be loaded at any time in mid-session.
3238
3242
3239 2002-04-24 Fernando Perez <fperez@colorado.edu>
3243 2002-04-24 Fernando Perez <fperez@colorado.edu>
3240
3244
3241 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3245 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3242 the globals (IPython has its own namespace) and the
3246 the globals (IPython has its own namespace) and the
3243 PhysicalQuantity stuff is much better anyway.
3247 PhysicalQuantity stuff is much better anyway.
3244
3248
3245 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3249 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3246 embedding example to standard user directory for
3250 embedding example to standard user directory for
3247 distribution. Also put it in the manual.
3251 distribution. Also put it in the manual.
3248
3252
3249 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3253 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3250 instance as first argument (so it doesn't rely on some obscure
3254 instance as first argument (so it doesn't rely on some obscure
3251 hidden global).
3255 hidden global).
3252
3256
3253 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3257 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3254 delimiters. While it prevents ().TAB from working, it allows
3258 delimiters. While it prevents ().TAB from working, it allows
3255 completions in open (... expressions. This is by far a more common
3259 completions in open (... expressions. This is by far a more common
3256 case.
3260 case.
3257
3261
3258 2002-04-23 Fernando Perez <fperez@colorado.edu>
3262 2002-04-23 Fernando Perez <fperez@colorado.edu>
3259
3263
3260 * IPython/Extensions/InterpreterPasteInput.py: new
3264 * IPython/Extensions/InterpreterPasteInput.py: new
3261 syntax-processing module for pasting lines with >>> or ... at the
3265 syntax-processing module for pasting lines with >>> or ... at the
3262 start.
3266 start.
3263
3267
3264 * IPython/Extensions/PhysicalQ_Interactive.py
3268 * IPython/Extensions/PhysicalQ_Interactive.py
3265 (PhysicalQuantityInteractive.__int__): fixed to work with either
3269 (PhysicalQuantityInteractive.__int__): fixed to work with either
3266 Numeric or math.
3270 Numeric or math.
3267
3271
3268 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3272 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3269 provided profiles. Now we have:
3273 provided profiles. Now we have:
3270 -math -> math module as * and cmath with its own namespace.
3274 -math -> math module as * and cmath with its own namespace.
3271 -numeric -> Numeric as *, plus gnuplot & grace
3275 -numeric -> Numeric as *, plus gnuplot & grace
3272 -physics -> same as before
3276 -physics -> same as before
3273
3277
3274 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3278 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3275 user-defined magics wouldn't be found by @magic if they were
3279 user-defined magics wouldn't be found by @magic if they were
3276 defined as class methods. Also cleaned up the namespace search
3280 defined as class methods. Also cleaned up the namespace search
3277 logic and the string building (to use %s instead of many repeated
3281 logic and the string building (to use %s instead of many repeated
3278 string adds).
3282 string adds).
3279
3283
3280 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3284 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3281 of user-defined magics to operate with class methods (cleaner, in
3285 of user-defined magics to operate with class methods (cleaner, in
3282 line with the gnuplot code).
3286 line with the gnuplot code).
3283
3287
3284 2002-04-22 Fernando Perez <fperez@colorado.edu>
3288 2002-04-22 Fernando Perez <fperez@colorado.edu>
3285
3289
3286 * setup.py: updated dependency list so that manual is updated when
3290 * setup.py: updated dependency list so that manual is updated when
3287 all included files change.
3291 all included files change.
3288
3292
3289 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3293 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3290 the delimiter removal option (the fix is ugly right now).
3294 the delimiter removal option (the fix is ugly right now).
3291
3295
3292 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3296 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3293 all of the math profile (quicker loading, no conflict between
3297 all of the math profile (quicker loading, no conflict between
3294 g-9.8 and g-gnuplot).
3298 g-9.8 and g-gnuplot).
3295
3299
3296 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3300 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3297 name of post-mortem files to IPython_crash_report.txt.
3301 name of post-mortem files to IPython_crash_report.txt.
3298
3302
3299 * Cleanup/update of the docs. Added all the new readline info and
3303 * Cleanup/update of the docs. Added all the new readline info and
3300 formatted all lists as 'real lists'.
3304 formatted all lists as 'real lists'.
3301
3305
3302 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3306 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3303 tab-completion options, since the full readline parse_and_bind is
3307 tab-completion options, since the full readline parse_and_bind is
3304 now accessible.
3308 now accessible.
3305
3309
3306 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3310 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3307 handling of readline options. Now users can specify any string to
3311 handling of readline options. Now users can specify any string to
3308 be passed to parse_and_bind(), as well as the delimiters to be
3312 be passed to parse_and_bind(), as well as the delimiters to be
3309 removed.
3313 removed.
3310 (InteractiveShell.__init__): Added __name__ to the global
3314 (InteractiveShell.__init__): Added __name__ to the global
3311 namespace so that things like Itpl which rely on its existence
3315 namespace so that things like Itpl which rely on its existence
3312 don't crash.
3316 don't crash.
3313 (InteractiveShell._prefilter): Defined the default with a _ so
3317 (InteractiveShell._prefilter): Defined the default with a _ so
3314 that prefilter() is easier to override, while the default one
3318 that prefilter() is easier to override, while the default one
3315 remains available.
3319 remains available.
3316
3320
3317 2002-04-18 Fernando Perez <fperez@colorado.edu>
3321 2002-04-18 Fernando Perez <fperez@colorado.edu>
3318
3322
3319 * Added information about pdb in the docs.
3323 * Added information about pdb in the docs.
3320
3324
3321 2002-04-17 Fernando Perez <fperez@colorado.edu>
3325 2002-04-17 Fernando Perez <fperez@colorado.edu>
3322
3326
3323 * IPython/ipmaker.py (make_IPython): added rc_override option to
3327 * IPython/ipmaker.py (make_IPython): added rc_override option to
3324 allow passing config options at creation time which may override
3328 allow passing config options at creation time which may override
3325 anything set in the config files or command line. This is
3329 anything set in the config files or command line. This is
3326 particularly useful for configuring embedded instances.
3330 particularly useful for configuring embedded instances.
3327
3331
3328 2002-04-15 Fernando Perez <fperez@colorado.edu>
3332 2002-04-15 Fernando Perez <fperez@colorado.edu>
3329
3333
3330 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3334 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3331 crash embedded instances because of the input cache falling out of
3335 crash embedded instances because of the input cache falling out of
3332 sync with the output counter.
3336 sync with the output counter.
3333
3337
3334 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3338 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3335 mode which calls pdb after an uncaught exception in IPython itself.
3339 mode which calls pdb after an uncaught exception in IPython itself.
3336
3340
3337 2002-04-14 Fernando Perez <fperez@colorado.edu>
3341 2002-04-14 Fernando Perez <fperez@colorado.edu>
3338
3342
3339 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3343 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3340 readline, fix it back after each call.
3344 readline, fix it back after each call.
3341
3345
3342 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3346 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3343 method to force all access via __call__(), which guarantees that
3347 method to force all access via __call__(), which guarantees that
3344 traceback references are properly deleted.
3348 traceback references are properly deleted.
3345
3349
3346 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3350 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3347 improve printing when pprint is in use.
3351 improve printing when pprint is in use.
3348
3352
3349 2002-04-13 Fernando Perez <fperez@colorado.edu>
3353 2002-04-13 Fernando Perez <fperez@colorado.edu>
3350
3354
3351 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3355 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3352 exceptions aren't caught anymore. If the user triggers one, he
3356 exceptions aren't caught anymore. If the user triggers one, he
3353 should know why he's doing it and it should go all the way up,
3357 should know why he's doing it and it should go all the way up,
3354 just like any other exception. So now @abort will fully kill the
3358 just like any other exception. So now @abort will fully kill the
3355 embedded interpreter and the embedding code (unless that happens
3359 embedded interpreter and the embedding code (unless that happens
3356 to catch SystemExit).
3360 to catch SystemExit).
3357
3361
3358 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3362 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3359 and a debugger() method to invoke the interactive pdb debugger
3363 and a debugger() method to invoke the interactive pdb debugger
3360 after printing exception information. Also added the corresponding
3364 after printing exception information. Also added the corresponding
3361 -pdb option and @pdb magic to control this feature, and updated
3365 -pdb option and @pdb magic to control this feature, and updated
3362 the docs. After a suggestion from Christopher Hart
3366 the docs. After a suggestion from Christopher Hart
3363 (hart-AT-caltech.edu).
3367 (hart-AT-caltech.edu).
3364
3368
3365 2002-04-12 Fernando Perez <fperez@colorado.edu>
3369 2002-04-12 Fernando Perez <fperez@colorado.edu>
3366
3370
3367 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3371 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3368 the exception handlers defined by the user (not the CrashHandler)
3372 the exception handlers defined by the user (not the CrashHandler)
3369 so that user exceptions don't trigger an ipython bug report.
3373 so that user exceptions don't trigger an ipython bug report.
3370
3374
3371 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3375 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3372 configurable (it should have always been so).
3376 configurable (it should have always been so).
3373
3377
3374 2002-03-26 Fernando Perez <fperez@colorado.edu>
3378 2002-03-26 Fernando Perez <fperez@colorado.edu>
3375
3379
3376 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3380 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3377 and there to fix embedding namespace issues. This should all be
3381 and there to fix embedding namespace issues. This should all be
3378 done in a more elegant way.
3382 done in a more elegant way.
3379
3383
3380 2002-03-25 Fernando Perez <fperez@colorado.edu>
3384 2002-03-25 Fernando Perez <fperez@colorado.edu>
3381
3385
3382 * IPython/genutils.py (get_home_dir): Try to make it work under
3386 * IPython/genutils.py (get_home_dir): Try to make it work under
3383 win9x also.
3387 win9x also.
3384
3388
3385 2002-03-20 Fernando Perez <fperez@colorado.edu>
3389 2002-03-20 Fernando Perez <fperez@colorado.edu>
3386
3390
3387 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3391 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3388 sys.displayhook untouched upon __init__.
3392 sys.displayhook untouched upon __init__.
3389
3393
3390 2002-03-19 Fernando Perez <fperez@colorado.edu>
3394 2002-03-19 Fernando Perez <fperez@colorado.edu>
3391
3395
3392 * Released 0.2.9 (for embedding bug, basically).
3396 * Released 0.2.9 (for embedding bug, basically).
3393
3397
3394 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3398 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3395 exceptions so that enclosing shell's state can be restored.
3399 exceptions so that enclosing shell's state can be restored.
3396
3400
3397 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3401 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3398 naming conventions in the .ipython/ dir.
3402 naming conventions in the .ipython/ dir.
3399
3403
3400 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3404 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3401 from delimiters list so filenames with - in them get expanded.
3405 from delimiters list so filenames with - in them get expanded.
3402
3406
3403 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3407 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3404 sys.displayhook not being properly restored after an embedded call.
3408 sys.displayhook not being properly restored after an embedded call.
3405
3409
3406 2002-03-18 Fernando Perez <fperez@colorado.edu>
3410 2002-03-18 Fernando Perez <fperez@colorado.edu>
3407
3411
3408 * Released 0.2.8
3412 * Released 0.2.8
3409
3413
3410 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3414 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3411 some files weren't being included in a -upgrade.
3415 some files weren't being included in a -upgrade.
3412 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3416 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3413 on' so that the first tab completes.
3417 on' so that the first tab completes.
3414 (InteractiveShell.handle_magic): fixed bug with spaces around
3418 (InteractiveShell.handle_magic): fixed bug with spaces around
3415 quotes breaking many magic commands.
3419 quotes breaking many magic commands.
3416
3420
3417 * setup.py: added note about ignoring the syntax error messages at
3421 * setup.py: added note about ignoring the syntax error messages at
3418 installation.
3422 installation.
3419
3423
3420 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3424 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3421 streamlining the gnuplot interface, now there's only one magic @gp.
3425 streamlining the gnuplot interface, now there's only one magic @gp.
3422
3426
3423 2002-03-17 Fernando Perez <fperez@colorado.edu>
3427 2002-03-17 Fernando Perez <fperez@colorado.edu>
3424
3428
3425 * IPython/UserConfig/magic_gnuplot.py: new name for the
3429 * IPython/UserConfig/magic_gnuplot.py: new name for the
3426 example-magic_pm.py file. Much enhanced system, now with a shell
3430 example-magic_pm.py file. Much enhanced system, now with a shell
3427 for communicating directly with gnuplot, one command at a time.
3431 for communicating directly with gnuplot, one command at a time.
3428
3432
3429 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3433 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3430 setting __name__=='__main__'.
3434 setting __name__=='__main__'.
3431
3435
3432 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3436 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3433 mini-shell for accessing gnuplot from inside ipython. Should
3437 mini-shell for accessing gnuplot from inside ipython. Should
3434 extend it later for grace access too. Inspired by Arnd's
3438 extend it later for grace access too. Inspired by Arnd's
3435 suggestion.
3439 suggestion.
3436
3440
3437 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3441 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3438 calling magic functions with () in their arguments. Thanks to Arnd
3442 calling magic functions with () in their arguments. Thanks to Arnd
3439 Baecker for pointing this to me.
3443 Baecker for pointing this to me.
3440
3444
3441 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3445 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3442 infinitely for integer or complex arrays (only worked with floats).
3446 infinitely for integer or complex arrays (only worked with floats).
3443
3447
3444 2002-03-16 Fernando Perez <fperez@colorado.edu>
3448 2002-03-16 Fernando Perez <fperez@colorado.edu>
3445
3449
3446 * setup.py: Merged setup and setup_windows into a single script
3450 * setup.py: Merged setup and setup_windows into a single script
3447 which properly handles things for windows users.
3451 which properly handles things for windows users.
3448
3452
3449 2002-03-15 Fernando Perez <fperez@colorado.edu>
3453 2002-03-15 Fernando Perez <fperez@colorado.edu>
3450
3454
3451 * Big change to the manual: now the magics are all automatically
3455 * Big change to the manual: now the magics are all automatically
3452 documented. This information is generated from their docstrings
3456 documented. This information is generated from their docstrings
3453 and put in a latex file included by the manual lyx file. This way
3457 and put in a latex file included by the manual lyx file. This way
3454 we get always up to date information for the magics. The manual
3458 we get always up to date information for the magics. The manual
3455 now also has proper version information, also auto-synced.
3459 now also has proper version information, also auto-synced.
3456
3460
3457 For this to work, an undocumented --magic_docstrings option was added.
3461 For this to work, an undocumented --magic_docstrings option was added.
3458
3462
3459 2002-03-13 Fernando Perez <fperez@colorado.edu>
3463 2002-03-13 Fernando Perez <fperez@colorado.edu>
3460
3464
3461 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3465 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3462 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3466 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3463
3467
3464 2002-03-12 Fernando Perez <fperez@colorado.edu>
3468 2002-03-12 Fernando Perez <fperez@colorado.edu>
3465
3469
3466 * IPython/ultraTB.py (TermColors): changed color escapes again to
3470 * IPython/ultraTB.py (TermColors): changed color escapes again to
3467 fix the (old, reintroduced) line-wrapping bug. Basically, if
3471 fix the (old, reintroduced) line-wrapping bug. Basically, if
3468 \001..\002 aren't given in the color escapes, lines get wrapped
3472 \001..\002 aren't given in the color escapes, lines get wrapped
3469 weirdly. But giving those screws up old xterms and emacs terms. So
3473 weirdly. But giving those screws up old xterms and emacs terms. So
3470 I added some logic for emacs terms to be ok, but I can't identify old
3474 I added some logic for emacs terms to be ok, but I can't identify old
3471 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3475 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3472
3476
3473 2002-03-10 Fernando Perez <fperez@colorado.edu>
3477 2002-03-10 Fernando Perez <fperez@colorado.edu>
3474
3478
3475 * IPython/usage.py (__doc__): Various documentation cleanups and
3479 * IPython/usage.py (__doc__): Various documentation cleanups and
3476 updates, both in usage docstrings and in the manual.
3480 updates, both in usage docstrings and in the manual.
3477
3481
3478 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3482 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3479 handling of caching. Set minimum acceptabe value for having a
3483 handling of caching. Set minimum acceptabe value for having a
3480 cache at 20 values.
3484 cache at 20 values.
3481
3485
3482 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3486 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3483 install_first_time function to a method, renamed it and added an
3487 install_first_time function to a method, renamed it and added an
3484 'upgrade' mode. Now people can update their config directory with
3488 'upgrade' mode. Now people can update their config directory with
3485 a simple command line switch (-upgrade, also new).
3489 a simple command line switch (-upgrade, also new).
3486
3490
3487 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3491 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3488 @file (convenient for automagic users under Python >= 2.2).
3492 @file (convenient for automagic users under Python >= 2.2).
3489 Removed @files (it seemed more like a plural than an abbrev. of
3493 Removed @files (it seemed more like a plural than an abbrev. of
3490 'file show').
3494 'file show').
3491
3495
3492 * IPython/iplib.py (install_first_time): Fixed crash if there were
3496 * IPython/iplib.py (install_first_time): Fixed crash if there were
3493 backup files ('~') in .ipython/ install directory.
3497 backup files ('~') in .ipython/ install directory.
3494
3498
3495 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3499 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3496 system. Things look fine, but these changes are fairly
3500 system. Things look fine, but these changes are fairly
3497 intrusive. Test them for a few days.
3501 intrusive. Test them for a few days.
3498
3502
3499 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3503 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3500 the prompts system. Now all in/out prompt strings are user
3504 the prompts system. Now all in/out prompt strings are user
3501 controllable. This is particularly useful for embedding, as one
3505 controllable. This is particularly useful for embedding, as one
3502 can tag embedded instances with particular prompts.
3506 can tag embedded instances with particular prompts.
3503
3507
3504 Also removed global use of sys.ps1/2, which now allows nested
3508 Also removed global use of sys.ps1/2, which now allows nested
3505 embeddings without any problems. Added command-line options for
3509 embeddings without any problems. Added command-line options for
3506 the prompt strings.
3510 the prompt strings.
3507
3511
3508 2002-03-08 Fernando Perez <fperez@colorado.edu>
3512 2002-03-08 Fernando Perez <fperez@colorado.edu>
3509
3513
3510 * IPython/UserConfig/example-embed-short.py (ipshell): added
3514 * IPython/UserConfig/example-embed-short.py (ipshell): added
3511 example file with the bare minimum code for embedding.
3515 example file with the bare minimum code for embedding.
3512
3516
3513 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3517 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3514 functionality for the embeddable shell to be activated/deactivated
3518 functionality for the embeddable shell to be activated/deactivated
3515 either globally or at each call.
3519 either globally or at each call.
3516
3520
3517 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3521 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3518 rewriting the prompt with '--->' for auto-inputs with proper
3522 rewriting the prompt with '--->' for auto-inputs with proper
3519 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3523 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3520 this is handled by the prompts class itself, as it should.
3524 this is handled by the prompts class itself, as it should.
3521
3525
3522 2002-03-05 Fernando Perez <fperez@colorado.edu>
3526 2002-03-05 Fernando Perez <fperez@colorado.edu>
3523
3527
3524 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3528 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3525 @logstart to avoid name clashes with the math log function.
3529 @logstart to avoid name clashes with the math log function.
3526
3530
3527 * Big updates to X/Emacs section of the manual.
3531 * Big updates to X/Emacs section of the manual.
3528
3532
3529 * Removed ipython_emacs. Milan explained to me how to pass
3533 * Removed ipython_emacs. Milan explained to me how to pass
3530 arguments to ipython through Emacs. Some day I'm going to end up
3534 arguments to ipython through Emacs. Some day I'm going to end up
3531 learning some lisp...
3535 learning some lisp...
3532
3536
3533 2002-03-04 Fernando Perez <fperez@colorado.edu>
3537 2002-03-04 Fernando Perez <fperez@colorado.edu>
3534
3538
3535 * IPython/ipython_emacs: Created script to be used as the
3539 * IPython/ipython_emacs: Created script to be used as the
3536 py-python-command Emacs variable so we can pass IPython
3540 py-python-command Emacs variable so we can pass IPython
3537 parameters. I can't figure out how to tell Emacs directly to pass
3541 parameters. I can't figure out how to tell Emacs directly to pass
3538 parameters to IPython, so a dummy shell script will do it.
3542 parameters to IPython, so a dummy shell script will do it.
3539
3543
3540 Other enhancements made for things to work better under Emacs'
3544 Other enhancements made for things to work better under Emacs'
3541 various types of terminals. Many thanks to Milan Zamazal
3545 various types of terminals. Many thanks to Milan Zamazal
3542 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3546 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3543
3547
3544 2002-03-01 Fernando Perez <fperez@colorado.edu>
3548 2002-03-01 Fernando Perez <fperez@colorado.edu>
3545
3549
3546 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3550 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3547 that loading of readline is now optional. This gives better
3551 that loading of readline is now optional. This gives better
3548 control to emacs users.
3552 control to emacs users.
3549
3553
3550 * IPython/ultraTB.py (__date__): Modified color escape sequences
3554 * IPython/ultraTB.py (__date__): Modified color escape sequences
3551 and now things work fine under xterm and in Emacs' term buffers
3555 and now things work fine under xterm and in Emacs' term buffers
3552 (though not shell ones). Well, in emacs you get colors, but all
3556 (though not shell ones). Well, in emacs you get colors, but all
3553 seem to be 'light' colors (no difference between dark and light
3557 seem to be 'light' colors (no difference between dark and light
3554 ones). But the garbage chars are gone, and also in xterms. It
3558 ones). But the garbage chars are gone, and also in xterms. It
3555 seems that now I'm using 'cleaner' ansi sequences.
3559 seems that now I'm using 'cleaner' ansi sequences.
3556
3560
3557 2002-02-21 Fernando Perez <fperez@colorado.edu>
3561 2002-02-21 Fernando Perez <fperez@colorado.edu>
3558
3562
3559 * Released 0.2.7 (mainly to publish the scoping fix).
3563 * Released 0.2.7 (mainly to publish the scoping fix).
3560
3564
3561 * IPython/Logger.py (Logger.logstate): added. A corresponding
3565 * IPython/Logger.py (Logger.logstate): added. A corresponding
3562 @logstate magic was created.
3566 @logstate magic was created.
3563
3567
3564 * IPython/Magic.py: fixed nested scoping problem under Python
3568 * IPython/Magic.py: fixed nested scoping problem under Python
3565 2.1.x (automagic wasn't working).
3569 2.1.x (automagic wasn't working).
3566
3570
3567 2002-02-20 Fernando Perez <fperez@colorado.edu>
3571 2002-02-20 Fernando Perez <fperez@colorado.edu>
3568
3572
3569 * Released 0.2.6.
3573 * Released 0.2.6.
3570
3574
3571 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3575 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3572 option so that logs can come out without any headers at all.
3576 option so that logs can come out without any headers at all.
3573
3577
3574 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3578 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3575 SciPy.
3579 SciPy.
3576
3580
3577 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3581 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3578 that embedded IPython calls don't require vars() to be explicitly
3582 that embedded IPython calls don't require vars() to be explicitly
3579 passed. Now they are extracted from the caller's frame (code
3583 passed. Now they are extracted from the caller's frame (code
3580 snatched from Eric Jones' weave). Added better documentation to
3584 snatched from Eric Jones' weave). Added better documentation to
3581 the section on embedding and the example file.
3585 the section on embedding and the example file.
3582
3586
3583 * IPython/genutils.py (page): Changed so that under emacs, it just
3587 * IPython/genutils.py (page): Changed so that under emacs, it just
3584 prints the string. You can then page up and down in the emacs
3588 prints the string. You can then page up and down in the emacs
3585 buffer itself. This is how the builtin help() works.
3589 buffer itself. This is how the builtin help() works.
3586
3590
3587 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3591 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3588 macro scoping: macros need to be executed in the user's namespace
3592 macro scoping: macros need to be executed in the user's namespace
3589 to work as if they had been typed by the user.
3593 to work as if they had been typed by the user.
3590
3594
3591 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3595 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3592 execute automatically (no need to type 'exec...'). They then
3596 execute automatically (no need to type 'exec...'). They then
3593 behave like 'true macros'. The printing system was also modified
3597 behave like 'true macros'. The printing system was also modified
3594 for this to work.
3598 for this to work.
3595
3599
3596 2002-02-19 Fernando Perez <fperez@colorado.edu>
3600 2002-02-19 Fernando Perez <fperez@colorado.edu>
3597
3601
3598 * IPython/genutils.py (page_file): new function for paging files
3602 * IPython/genutils.py (page_file): new function for paging files
3599 in an OS-independent way. Also necessary for file viewing to work
3603 in an OS-independent way. Also necessary for file viewing to work
3600 well inside Emacs buffers.
3604 well inside Emacs buffers.
3601 (page): Added checks for being in an emacs buffer.
3605 (page): Added checks for being in an emacs buffer.
3602 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3606 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3603 same bug in iplib.
3607 same bug in iplib.
3604
3608
3605 2002-02-18 Fernando Perez <fperez@colorado.edu>
3609 2002-02-18 Fernando Perez <fperez@colorado.edu>
3606
3610
3607 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3611 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3608 of readline so that IPython can work inside an Emacs buffer.
3612 of readline so that IPython can work inside an Emacs buffer.
3609
3613
3610 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3614 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3611 method signatures (they weren't really bugs, but it looks cleaner
3615 method signatures (they weren't really bugs, but it looks cleaner
3612 and keeps PyChecker happy).
3616 and keeps PyChecker happy).
3613
3617
3614 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3618 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3615 for implementing various user-defined hooks. Currently only
3619 for implementing various user-defined hooks. Currently only
3616 display is done.
3620 display is done.
3617
3621
3618 * IPython/Prompts.py (CachedOutput._display): changed display
3622 * IPython/Prompts.py (CachedOutput._display): changed display
3619 functions so that they can be dynamically changed by users easily.
3623 functions so that they can be dynamically changed by users easily.
3620
3624
3621 * IPython/Extensions/numeric_formats.py (num_display): added an
3625 * IPython/Extensions/numeric_formats.py (num_display): added an
3622 extension for printing NumPy arrays in flexible manners. It
3626 extension for printing NumPy arrays in flexible manners. It
3623 doesn't do anything yet, but all the structure is in
3627 doesn't do anything yet, but all the structure is in
3624 place. Ultimately the plan is to implement output format control
3628 place. Ultimately the plan is to implement output format control
3625 like in Octave.
3629 like in Octave.
3626
3630
3627 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3631 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3628 methods are found at run-time by all the automatic machinery.
3632 methods are found at run-time by all the automatic machinery.
3629
3633
3630 2002-02-17 Fernando Perez <fperez@colorado.edu>
3634 2002-02-17 Fernando Perez <fperez@colorado.edu>
3631
3635
3632 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3636 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3633 whole file a little.
3637 whole file a little.
3634
3638
3635 * ToDo: closed this document. Now there's a new_design.lyx
3639 * ToDo: closed this document. Now there's a new_design.lyx
3636 document for all new ideas. Added making a pdf of it for the
3640 document for all new ideas. Added making a pdf of it for the
3637 end-user distro.
3641 end-user distro.
3638
3642
3639 * IPython/Logger.py (Logger.switch_log): Created this to replace
3643 * IPython/Logger.py (Logger.switch_log): Created this to replace
3640 logon() and logoff(). It also fixes a nasty crash reported by
3644 logon() and logoff(). It also fixes a nasty crash reported by
3641 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3645 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3642
3646
3643 * IPython/iplib.py (complete): got auto-completion to work with
3647 * IPython/iplib.py (complete): got auto-completion to work with
3644 automagic (I had wanted this for a long time).
3648 automagic (I had wanted this for a long time).
3645
3649
3646 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3650 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3647 to @file, since file() is now a builtin and clashes with automagic
3651 to @file, since file() is now a builtin and clashes with automagic
3648 for @file.
3652 for @file.
3649
3653
3650 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3654 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3651 of this was previously in iplib, which had grown to more than 2000
3655 of this was previously in iplib, which had grown to more than 2000
3652 lines, way too long. No new functionality, but it makes managing
3656 lines, way too long. No new functionality, but it makes managing
3653 the code a bit easier.
3657 the code a bit easier.
3654
3658
3655 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3659 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3656 information to crash reports.
3660 information to crash reports.
3657
3661
3658 2002-02-12 Fernando Perez <fperez@colorado.edu>
3662 2002-02-12 Fernando Perez <fperez@colorado.edu>
3659
3663
3660 * Released 0.2.5.
3664 * Released 0.2.5.
3661
3665
3662 2002-02-11 Fernando Perez <fperez@colorado.edu>
3666 2002-02-11 Fernando Perez <fperez@colorado.edu>
3663
3667
3664 * Wrote a relatively complete Windows installer. It puts
3668 * Wrote a relatively complete Windows installer. It puts
3665 everything in place, creates Start Menu entries and fixes the
3669 everything in place, creates Start Menu entries and fixes the
3666 color issues. Nothing fancy, but it works.
3670 color issues. Nothing fancy, but it works.
3667
3671
3668 2002-02-10 Fernando Perez <fperez@colorado.edu>
3672 2002-02-10 Fernando Perez <fperez@colorado.edu>
3669
3673
3670 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3674 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3671 os.path.expanduser() call so that we can type @run ~/myfile.py and
3675 os.path.expanduser() call so that we can type @run ~/myfile.py and
3672 have thigs work as expected.
3676 have thigs work as expected.
3673
3677
3674 * IPython/genutils.py (page): fixed exception handling so things
3678 * IPython/genutils.py (page): fixed exception handling so things
3675 work both in Unix and Windows correctly. Quitting a pager triggers
3679 work both in Unix and Windows correctly. Quitting a pager triggers
3676 an IOError/broken pipe in Unix, and in windows not finding a pager
3680 an IOError/broken pipe in Unix, and in windows not finding a pager
3677 is also an IOError, so I had to actually look at the return value
3681 is also an IOError, so I had to actually look at the return value
3678 of the exception, not just the exception itself. Should be ok now.
3682 of the exception, not just the exception itself. Should be ok now.
3679
3683
3680 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3684 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3681 modified to allow case-insensitive color scheme changes.
3685 modified to allow case-insensitive color scheme changes.
3682
3686
3683 2002-02-09 Fernando Perez <fperez@colorado.edu>
3687 2002-02-09 Fernando Perez <fperez@colorado.edu>
3684
3688
3685 * IPython/genutils.py (native_line_ends): new function to leave
3689 * IPython/genutils.py (native_line_ends): new function to leave
3686 user config files with os-native line-endings.
3690 user config files with os-native line-endings.
3687
3691
3688 * README and manual updates.
3692 * README and manual updates.
3689
3693
3690 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3694 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3691 instead of StringType to catch Unicode strings.
3695 instead of StringType to catch Unicode strings.
3692
3696
3693 * IPython/genutils.py (filefind): fixed bug for paths with
3697 * IPython/genutils.py (filefind): fixed bug for paths with
3694 embedded spaces (very common in Windows).
3698 embedded spaces (very common in Windows).
3695
3699
3696 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3700 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3697 files under Windows, so that they get automatically associated
3701 files under Windows, so that they get automatically associated
3698 with a text editor. Windows makes it a pain to handle
3702 with a text editor. Windows makes it a pain to handle
3699 extension-less files.
3703 extension-less files.
3700
3704
3701 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3705 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3702 warning about readline only occur for Posix. In Windows there's no
3706 warning about readline only occur for Posix. In Windows there's no
3703 way to get readline, so why bother with the warning.
3707 way to get readline, so why bother with the warning.
3704
3708
3705 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3709 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3706 for __str__ instead of dir(self), since dir() changed in 2.2.
3710 for __str__ instead of dir(self), since dir() changed in 2.2.
3707
3711
3708 * Ported to Windows! Tested on XP, I suspect it should work fine
3712 * Ported to Windows! Tested on XP, I suspect it should work fine
3709 on NT/2000, but I don't think it will work on 98 et al. That
3713 on NT/2000, but I don't think it will work on 98 et al. That
3710 series of Windows is such a piece of junk anyway that I won't try
3714 series of Windows is such a piece of junk anyway that I won't try
3711 porting it there. The XP port was straightforward, showed a few
3715 porting it there. The XP port was straightforward, showed a few
3712 bugs here and there (fixed all), in particular some string
3716 bugs here and there (fixed all), in particular some string
3713 handling stuff which required considering Unicode strings (which
3717 handling stuff which required considering Unicode strings (which
3714 Windows uses). This is good, but hasn't been too tested :) No
3718 Windows uses). This is good, but hasn't been too tested :) No
3715 fancy installer yet, I'll put a note in the manual so people at
3719 fancy installer yet, I'll put a note in the manual so people at
3716 least make manually a shortcut.
3720 least make manually a shortcut.
3717
3721
3718 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3722 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3719 into a single one, "colors". This now controls both prompt and
3723 into a single one, "colors". This now controls both prompt and
3720 exception color schemes, and can be changed both at startup
3724 exception color schemes, and can be changed both at startup
3721 (either via command-line switches or via ipythonrc files) and at
3725 (either via command-line switches or via ipythonrc files) and at
3722 runtime, with @colors.
3726 runtime, with @colors.
3723 (Magic.magic_run): renamed @prun to @run and removed the old
3727 (Magic.magic_run): renamed @prun to @run and removed the old
3724 @run. The two were too similar to warrant keeping both.
3728 @run. The two were too similar to warrant keeping both.
3725
3729
3726 2002-02-03 Fernando Perez <fperez@colorado.edu>
3730 2002-02-03 Fernando Perez <fperez@colorado.edu>
3727
3731
3728 * IPython/iplib.py (install_first_time): Added comment on how to
3732 * IPython/iplib.py (install_first_time): Added comment on how to
3729 configure the color options for first-time users. Put a <return>
3733 configure the color options for first-time users. Put a <return>
3730 request at the end so that small-terminal users get a chance to
3734 request at the end so that small-terminal users get a chance to
3731 read the startup info.
3735 read the startup info.
3732
3736
3733 2002-01-23 Fernando Perez <fperez@colorado.edu>
3737 2002-01-23 Fernando Perez <fperez@colorado.edu>
3734
3738
3735 * IPython/iplib.py (CachedOutput.update): Changed output memory
3739 * IPython/iplib.py (CachedOutput.update): Changed output memory
3736 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3740 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3737 input history we still use _i. Did this b/c these variable are
3741 input history we still use _i. Did this b/c these variable are
3738 very commonly used in interactive work, so the less we need to
3742 very commonly used in interactive work, so the less we need to
3739 type the better off we are.
3743 type the better off we are.
3740 (Magic.magic_prun): updated @prun to better handle the namespaces
3744 (Magic.magic_prun): updated @prun to better handle the namespaces
3741 the file will run in, including a fix for __name__ not being set
3745 the file will run in, including a fix for __name__ not being set
3742 before.
3746 before.
3743
3747
3744 2002-01-20 Fernando Perez <fperez@colorado.edu>
3748 2002-01-20 Fernando Perez <fperez@colorado.edu>
3745
3749
3746 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3750 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3747 extra garbage for Python 2.2. Need to look more carefully into
3751 extra garbage for Python 2.2. Need to look more carefully into
3748 this later.
3752 this later.
3749
3753
3750 2002-01-19 Fernando Perez <fperez@colorado.edu>
3754 2002-01-19 Fernando Perez <fperez@colorado.edu>
3751
3755
3752 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3756 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3753 display SyntaxError exceptions properly formatted when they occur
3757 display SyntaxError exceptions properly formatted when they occur
3754 (they can be triggered by imported code).
3758 (they can be triggered by imported code).
3755
3759
3756 2002-01-18 Fernando Perez <fperez@colorado.edu>
3760 2002-01-18 Fernando Perez <fperez@colorado.edu>
3757
3761
3758 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3762 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3759 SyntaxError exceptions are reported nicely formatted, instead of
3763 SyntaxError exceptions are reported nicely formatted, instead of
3760 spitting out only offset information as before.
3764 spitting out only offset information as before.
3761 (Magic.magic_prun): Added the @prun function for executing
3765 (Magic.magic_prun): Added the @prun function for executing
3762 programs with command line args inside IPython.
3766 programs with command line args inside IPython.
3763
3767
3764 2002-01-16 Fernando Perez <fperez@colorado.edu>
3768 2002-01-16 Fernando Perez <fperez@colorado.edu>
3765
3769
3766 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3770 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3767 to *not* include the last item given in a range. This brings their
3771 to *not* include the last item given in a range. This brings their
3768 behavior in line with Python's slicing:
3772 behavior in line with Python's slicing:
3769 a[n1:n2] -> a[n1]...a[n2-1]
3773 a[n1:n2] -> a[n1]...a[n2-1]
3770 It may be a bit less convenient, but I prefer to stick to Python's
3774 It may be a bit less convenient, but I prefer to stick to Python's
3771 conventions *everywhere*, so users never have to wonder.
3775 conventions *everywhere*, so users never have to wonder.
3772 (Magic.magic_macro): Added @macro function to ease the creation of
3776 (Magic.magic_macro): Added @macro function to ease the creation of
3773 macros.
3777 macros.
3774
3778
3775 2002-01-05 Fernando Perez <fperez@colorado.edu>
3779 2002-01-05 Fernando Perez <fperez@colorado.edu>
3776
3780
3777 * Released 0.2.4.
3781 * Released 0.2.4.
3778
3782
3779 * IPython/iplib.py (Magic.magic_pdef):
3783 * IPython/iplib.py (Magic.magic_pdef):
3780 (InteractiveShell.safe_execfile): report magic lines and error
3784 (InteractiveShell.safe_execfile): report magic lines and error
3781 lines without line numbers so one can easily copy/paste them for
3785 lines without line numbers so one can easily copy/paste them for
3782 re-execution.
3786 re-execution.
3783
3787
3784 * Updated manual with recent changes.
3788 * Updated manual with recent changes.
3785
3789
3786 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3790 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3787 docstring printing when class? is called. Very handy for knowing
3791 docstring printing when class? is called. Very handy for knowing
3788 how to create class instances (as long as __init__ is well
3792 how to create class instances (as long as __init__ is well
3789 documented, of course :)
3793 documented, of course :)
3790 (Magic.magic_doc): print both class and constructor docstrings.
3794 (Magic.magic_doc): print both class and constructor docstrings.
3791 (Magic.magic_pdef): give constructor info if passed a class and
3795 (Magic.magic_pdef): give constructor info if passed a class and
3792 __call__ info for callable object instances.
3796 __call__ info for callable object instances.
3793
3797
3794 2002-01-04 Fernando Perez <fperez@colorado.edu>
3798 2002-01-04 Fernando Perez <fperez@colorado.edu>
3795
3799
3796 * Made deep_reload() off by default. It doesn't always work
3800 * Made deep_reload() off by default. It doesn't always work
3797 exactly as intended, so it's probably safer to have it off. It's
3801 exactly as intended, so it's probably safer to have it off. It's
3798 still available as dreload() anyway, so nothing is lost.
3802 still available as dreload() anyway, so nothing is lost.
3799
3803
3800 2002-01-02 Fernando Perez <fperez@colorado.edu>
3804 2002-01-02 Fernando Perez <fperez@colorado.edu>
3801
3805
3802 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3806 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3803 so I wanted an updated release).
3807 so I wanted an updated release).
3804
3808
3805 2001-12-27 Fernando Perez <fperez@colorado.edu>
3809 2001-12-27 Fernando Perez <fperez@colorado.edu>
3806
3810
3807 * IPython/iplib.py (InteractiveShell.interact): Added the original
3811 * IPython/iplib.py (InteractiveShell.interact): Added the original
3808 code from 'code.py' for this module in order to change the
3812 code from 'code.py' for this module in order to change the
3809 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3813 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3810 the history cache would break when the user hit Ctrl-C, and
3814 the history cache would break when the user hit Ctrl-C, and
3811 interact() offers no way to add any hooks to it.
3815 interact() offers no way to add any hooks to it.
3812
3816
3813 2001-12-23 Fernando Perez <fperez@colorado.edu>
3817 2001-12-23 Fernando Perez <fperez@colorado.edu>
3814
3818
3815 * setup.py: added check for 'MANIFEST' before trying to remove
3819 * setup.py: added check for 'MANIFEST' before trying to remove
3816 it. Thanks to Sean Reifschneider.
3820 it. Thanks to Sean Reifschneider.
3817
3821
3818 2001-12-22 Fernando Perez <fperez@colorado.edu>
3822 2001-12-22 Fernando Perez <fperez@colorado.edu>
3819
3823
3820 * Released 0.2.2.
3824 * Released 0.2.2.
3821
3825
3822 * Finished (reasonably) writing the manual. Later will add the
3826 * Finished (reasonably) writing the manual. Later will add the
3823 python-standard navigation stylesheets, but for the time being
3827 python-standard navigation stylesheets, but for the time being
3824 it's fairly complete. Distribution will include html and pdf
3828 it's fairly complete. Distribution will include html and pdf
3825 versions.
3829 versions.
3826
3830
3827 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3831 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3828 (MayaVi author).
3832 (MayaVi author).
3829
3833
3830 2001-12-21 Fernando Perez <fperez@colorado.edu>
3834 2001-12-21 Fernando Perez <fperez@colorado.edu>
3831
3835
3832 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3836 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3833 good public release, I think (with the manual and the distutils
3837 good public release, I think (with the manual and the distutils
3834 installer). The manual can use some work, but that can go
3838 installer). The manual can use some work, but that can go
3835 slowly. Otherwise I think it's quite nice for end users. Next
3839 slowly. Otherwise I think it's quite nice for end users. Next
3836 summer, rewrite the guts of it...
3840 summer, rewrite the guts of it...
3837
3841
3838 * Changed format of ipythonrc files to use whitespace as the
3842 * Changed format of ipythonrc files to use whitespace as the
3839 separator instead of an explicit '='. Cleaner.
3843 separator instead of an explicit '='. Cleaner.
3840
3844
3841 2001-12-20 Fernando Perez <fperez@colorado.edu>
3845 2001-12-20 Fernando Perez <fperez@colorado.edu>
3842
3846
3843 * Started a manual in LyX. For now it's just a quick merge of the
3847 * Started a manual in LyX. For now it's just a quick merge of the
3844 various internal docstrings and READMEs. Later it may grow into a
3848 various internal docstrings and READMEs. Later it may grow into a
3845 nice, full-blown manual.
3849 nice, full-blown manual.
3846
3850
3847 * Set up a distutils based installer. Installation should now be
3851 * Set up a distutils based installer. Installation should now be
3848 trivially simple for end-users.
3852 trivially simple for end-users.
3849
3853
3850 2001-12-11 Fernando Perez <fperez@colorado.edu>
3854 2001-12-11 Fernando Perez <fperez@colorado.edu>
3851
3855
3852 * Released 0.2.0. First public release, announced it at
3856 * Released 0.2.0. First public release, announced it at
3853 comp.lang.python. From now on, just bugfixes...
3857 comp.lang.python. From now on, just bugfixes...
3854
3858
3855 * Went through all the files, set copyright/license notices and
3859 * Went through all the files, set copyright/license notices and
3856 cleaned up things. Ready for release.
3860 cleaned up things. Ready for release.
3857
3861
3858 2001-12-10 Fernando Perez <fperez@colorado.edu>
3862 2001-12-10 Fernando Perez <fperez@colorado.edu>
3859
3863
3860 * Changed the first-time installer not to use tarfiles. It's more
3864 * Changed the first-time installer not to use tarfiles. It's more
3861 robust now and less unix-dependent. Also makes it easier for
3865 robust now and less unix-dependent. Also makes it easier for
3862 people to later upgrade versions.
3866 people to later upgrade versions.
3863
3867
3864 * Changed @exit to @abort to reflect the fact that it's pretty
3868 * Changed @exit to @abort to reflect the fact that it's pretty
3865 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3869 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3866 becomes significant only when IPyhton is embedded: in that case,
3870 becomes significant only when IPyhton is embedded: in that case,
3867 C-D closes IPython only, but @abort kills the enclosing program
3871 C-D closes IPython only, but @abort kills the enclosing program
3868 too (unless it had called IPython inside a try catching
3872 too (unless it had called IPython inside a try catching
3869 SystemExit).
3873 SystemExit).
3870
3874
3871 * Created Shell module which exposes the actuall IPython Shell
3875 * Created Shell module which exposes the actuall IPython Shell
3872 classes, currently the normal and the embeddable one. This at
3876 classes, currently the normal and the embeddable one. This at
3873 least offers a stable interface we won't need to change when
3877 least offers a stable interface we won't need to change when
3874 (later) the internals are rewritten. That rewrite will be confined
3878 (later) the internals are rewritten. That rewrite will be confined
3875 to iplib and ipmaker, but the Shell interface should remain as is.
3879 to iplib and ipmaker, but the Shell interface should remain as is.
3876
3880
3877 * Added embed module which offers an embeddable IPShell object,
3881 * Added embed module which offers an embeddable IPShell object,
3878 useful to fire up IPython *inside* a running program. Great for
3882 useful to fire up IPython *inside* a running program. Great for
3879 debugging or dynamical data analysis.
3883 debugging or dynamical data analysis.
3880
3884
3881 2001-12-08 Fernando Perez <fperez@colorado.edu>
3885 2001-12-08 Fernando Perez <fperez@colorado.edu>
3882
3886
3883 * Fixed small bug preventing seeing info from methods of defined
3887 * Fixed small bug preventing seeing info from methods of defined
3884 objects (incorrect namespace in _ofind()).
3888 objects (incorrect namespace in _ofind()).
3885
3889
3886 * Documentation cleanup. Moved the main usage docstrings to a
3890 * Documentation cleanup. Moved the main usage docstrings to a
3887 separate file, usage.py (cleaner to maintain, and hopefully in the
3891 separate file, usage.py (cleaner to maintain, and hopefully in the
3888 future some perlpod-like way of producing interactive, man and
3892 future some perlpod-like way of producing interactive, man and
3889 html docs out of it will be found).
3893 html docs out of it will be found).
3890
3894
3891 * Added @profile to see your profile at any time.
3895 * Added @profile to see your profile at any time.
3892
3896
3893 * Added @p as an alias for 'print'. It's especially convenient if
3897 * Added @p as an alias for 'print'. It's especially convenient if
3894 using automagic ('p x' prints x).
3898 using automagic ('p x' prints x).
3895
3899
3896 * Small cleanups and fixes after a pychecker run.
3900 * Small cleanups and fixes after a pychecker run.
3897
3901
3898 * Changed the @cd command to handle @cd - and @cd -<n> for
3902 * Changed the @cd command to handle @cd - and @cd -<n> for
3899 visiting any directory in _dh.
3903 visiting any directory in _dh.
3900
3904
3901 * Introduced _dh, a history of visited directories. @dhist prints
3905 * Introduced _dh, a history of visited directories. @dhist prints
3902 it out with numbers.
3906 it out with numbers.
3903
3907
3904 2001-12-07 Fernando Perez <fperez@colorado.edu>
3908 2001-12-07 Fernando Perez <fperez@colorado.edu>
3905
3909
3906 * Released 0.1.22
3910 * Released 0.1.22
3907
3911
3908 * Made initialization a bit more robust against invalid color
3912 * Made initialization a bit more robust against invalid color
3909 options in user input (exit, not traceback-crash).
3913 options in user input (exit, not traceback-crash).
3910
3914
3911 * Changed the bug crash reporter to write the report only in the
3915 * Changed the bug crash reporter to write the report only in the
3912 user's .ipython directory. That way IPython won't litter people's
3916 user's .ipython directory. That way IPython won't litter people's
3913 hard disks with crash files all over the place. Also print on
3917 hard disks with crash files all over the place. Also print on
3914 screen the necessary mail command.
3918 screen the necessary mail command.
3915
3919
3916 * With the new ultraTB, implemented LightBG color scheme for light
3920 * With the new ultraTB, implemented LightBG color scheme for light
3917 background terminals. A lot of people like white backgrounds, so I
3921 background terminals. A lot of people like white backgrounds, so I
3918 guess we should at least give them something readable.
3922 guess we should at least give them something readable.
3919
3923
3920 2001-12-06 Fernando Perez <fperez@colorado.edu>
3924 2001-12-06 Fernando Perez <fperez@colorado.edu>
3921
3925
3922 * Modified the structure of ultraTB. Now there's a proper class
3926 * Modified the structure of ultraTB. Now there's a proper class
3923 for tables of color schemes which allow adding schemes easily and
3927 for tables of color schemes which allow adding schemes easily and
3924 switching the active scheme without creating a new instance every
3928 switching the active scheme without creating a new instance every
3925 time (which was ridiculous). The syntax for creating new schemes
3929 time (which was ridiculous). The syntax for creating new schemes
3926 is also cleaner. I think ultraTB is finally done, with a clean
3930 is also cleaner. I think ultraTB is finally done, with a clean
3927 class structure. Names are also much cleaner (now there's proper
3931 class structure. Names are also much cleaner (now there's proper
3928 color tables, no need for every variable to also have 'color' in
3932 color tables, no need for every variable to also have 'color' in
3929 its name).
3933 its name).
3930
3934
3931 * Broke down genutils into separate files. Now genutils only
3935 * Broke down genutils into separate files. Now genutils only
3932 contains utility functions, and classes have been moved to their
3936 contains utility functions, and classes have been moved to their
3933 own files (they had enough independent functionality to warrant
3937 own files (they had enough independent functionality to warrant
3934 it): ConfigLoader, OutputTrap, Struct.
3938 it): ConfigLoader, OutputTrap, Struct.
3935
3939
3936 2001-12-05 Fernando Perez <fperez@colorado.edu>
3940 2001-12-05 Fernando Perez <fperez@colorado.edu>
3937
3941
3938 * IPython turns 21! Released version 0.1.21, as a candidate for
3942 * IPython turns 21! Released version 0.1.21, as a candidate for
3939 public consumption. If all goes well, release in a few days.
3943 public consumption. If all goes well, release in a few days.
3940
3944
3941 * Fixed path bug (files in Extensions/ directory wouldn't be found
3945 * Fixed path bug (files in Extensions/ directory wouldn't be found
3942 unless IPython/ was explicitly in sys.path).
3946 unless IPython/ was explicitly in sys.path).
3943
3947
3944 * Extended the FlexCompleter class as MagicCompleter to allow
3948 * Extended the FlexCompleter class as MagicCompleter to allow
3945 completion of @-starting lines.
3949 completion of @-starting lines.
3946
3950
3947 * Created __release__.py file as a central repository for release
3951 * Created __release__.py file as a central repository for release
3948 info that other files can read from.
3952 info that other files can read from.
3949
3953
3950 * Fixed small bug in logging: when logging was turned on in
3954 * Fixed small bug in logging: when logging was turned on in
3951 mid-session, old lines with special meanings (!@?) were being
3955 mid-session, old lines with special meanings (!@?) were being
3952 logged without the prepended comment, which is necessary since
3956 logged without the prepended comment, which is necessary since
3953 they are not truly valid python syntax. This should make session
3957 they are not truly valid python syntax. This should make session
3954 restores produce less errors.
3958 restores produce less errors.
3955
3959
3956 * The namespace cleanup forced me to make a FlexCompleter class
3960 * The namespace cleanup forced me to make a FlexCompleter class
3957 which is nothing but a ripoff of rlcompleter, but with selectable
3961 which is nothing but a ripoff of rlcompleter, but with selectable
3958 namespace (rlcompleter only works in __main__.__dict__). I'll try
3962 namespace (rlcompleter only works in __main__.__dict__). I'll try
3959 to submit a note to the authors to see if this change can be
3963 to submit a note to the authors to see if this change can be
3960 incorporated in future rlcompleter releases (Dec.6: done)
3964 incorporated in future rlcompleter releases (Dec.6: done)
3961
3965
3962 * More fixes to namespace handling. It was a mess! Now all
3966 * More fixes to namespace handling. It was a mess! Now all
3963 explicit references to __main__.__dict__ are gone (except when
3967 explicit references to __main__.__dict__ are gone (except when
3964 really needed) and everything is handled through the namespace
3968 really needed) and everything is handled through the namespace
3965 dicts in the IPython instance. We seem to be getting somewhere
3969 dicts in the IPython instance. We seem to be getting somewhere
3966 with this, finally...
3970 with this, finally...
3967
3971
3968 * Small documentation updates.
3972 * Small documentation updates.
3969
3973
3970 * Created the Extensions directory under IPython (with an
3974 * Created the Extensions directory under IPython (with an
3971 __init__.py). Put the PhysicalQ stuff there. This directory should
3975 __init__.py). Put the PhysicalQ stuff there. This directory should
3972 be used for all special-purpose extensions.
3976 be used for all special-purpose extensions.
3973
3977
3974 * File renaming:
3978 * File renaming:
3975 ipythonlib --> ipmaker
3979 ipythonlib --> ipmaker
3976 ipplib --> iplib
3980 ipplib --> iplib
3977 This makes a bit more sense in terms of what these files actually do.
3981 This makes a bit more sense in terms of what these files actually do.
3978
3982
3979 * Moved all the classes and functions in ipythonlib to ipplib, so
3983 * Moved all the classes and functions in ipythonlib to ipplib, so
3980 now ipythonlib only has make_IPython(). This will ease up its
3984 now ipythonlib only has make_IPython(). This will ease up its
3981 splitting in smaller functional chunks later.
3985 splitting in smaller functional chunks later.
3982
3986
3983 * Cleaned up (done, I think) output of @whos. Better column
3987 * Cleaned up (done, I think) output of @whos. Better column
3984 formatting, and now shows str(var) for as much as it can, which is
3988 formatting, and now shows str(var) for as much as it can, which is
3985 typically what one gets with a 'print var'.
3989 typically what one gets with a 'print var'.
3986
3990
3987 2001-12-04 Fernando Perez <fperez@colorado.edu>
3991 2001-12-04 Fernando Perez <fperez@colorado.edu>
3988
3992
3989 * Fixed namespace problems. Now builtin/IPyhton/user names get
3993 * Fixed namespace problems. Now builtin/IPyhton/user names get
3990 properly reported in their namespace. Internal namespace handling
3994 properly reported in their namespace. Internal namespace handling
3991 is finally getting decent (not perfect yet, but much better than
3995 is finally getting decent (not perfect yet, but much better than
3992 the ad-hoc mess we had).
3996 the ad-hoc mess we had).
3993
3997
3994 * Removed -exit option. If people just want to run a python
3998 * Removed -exit option. If people just want to run a python
3995 script, that's what the normal interpreter is for. Less
3999 script, that's what the normal interpreter is for. Less
3996 unnecessary options, less chances for bugs.
4000 unnecessary options, less chances for bugs.
3997
4001
3998 * Added a crash handler which generates a complete post-mortem if
4002 * Added a crash handler which generates a complete post-mortem if
3999 IPython crashes. This will help a lot in tracking bugs down the
4003 IPython crashes. This will help a lot in tracking bugs down the
4000 road.
4004 road.
4001
4005
4002 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4006 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4003 which were boud to functions being reassigned would bypass the
4007 which were boud to functions being reassigned would bypass the
4004 logger, breaking the sync of _il with the prompt counter. This
4008 logger, breaking the sync of _il with the prompt counter. This
4005 would then crash IPython later when a new line was logged.
4009 would then crash IPython later when a new line was logged.
4006
4010
4007 2001-12-02 Fernando Perez <fperez@colorado.edu>
4011 2001-12-02 Fernando Perez <fperez@colorado.edu>
4008
4012
4009 * Made IPython a package. This means people don't have to clutter
4013 * Made IPython a package. This means people don't have to clutter
4010 their sys.path with yet another directory. Changed the INSTALL
4014 their sys.path with yet another directory. Changed the INSTALL
4011 file accordingly.
4015 file accordingly.
4012
4016
4013 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4017 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4014 sorts its output (so @who shows it sorted) and @whos formats the
4018 sorts its output (so @who shows it sorted) and @whos formats the
4015 table according to the width of the first column. Nicer, easier to
4019 table according to the width of the first column. Nicer, easier to
4016 read. Todo: write a generic table_format() which takes a list of
4020 read. Todo: write a generic table_format() which takes a list of
4017 lists and prints it nicely formatted, with optional row/column
4021 lists and prints it nicely formatted, with optional row/column
4018 separators and proper padding and justification.
4022 separators and proper padding and justification.
4019
4023
4020 * Released 0.1.20
4024 * Released 0.1.20
4021
4025
4022 * Fixed bug in @log which would reverse the inputcache list (a
4026 * Fixed bug in @log which would reverse the inputcache list (a
4023 copy operation was missing).
4027 copy operation was missing).
4024
4028
4025 * Code cleanup. @config was changed to use page(). Better, since
4029 * Code cleanup. @config was changed to use page(). Better, since
4026 its output is always quite long.
4030 its output is always quite long.
4027
4031
4028 * Itpl is back as a dependency. I was having too many problems
4032 * Itpl is back as a dependency. I was having too many problems
4029 getting the parametric aliases to work reliably, and it's just
4033 getting the parametric aliases to work reliably, and it's just
4030 easier to code weird string operations with it than playing %()s
4034 easier to code weird string operations with it than playing %()s
4031 games. It's only ~6k, so I don't think it's too big a deal.
4035 games. It's only ~6k, so I don't think it's too big a deal.
4032
4036
4033 * Found (and fixed) a very nasty bug with history. !lines weren't
4037 * Found (and fixed) a very nasty bug with history. !lines weren't
4034 getting cached, and the out of sync caches would crash
4038 getting cached, and the out of sync caches would crash
4035 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4039 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4036 division of labor a bit better. Bug fixed, cleaner structure.
4040 division of labor a bit better. Bug fixed, cleaner structure.
4037
4041
4038 2001-12-01 Fernando Perez <fperez@colorado.edu>
4042 2001-12-01 Fernando Perez <fperez@colorado.edu>
4039
4043
4040 * Released 0.1.19
4044 * Released 0.1.19
4041
4045
4042 * Added option -n to @hist to prevent line number printing. Much
4046 * Added option -n to @hist to prevent line number printing. Much
4043 easier to copy/paste code this way.
4047 easier to copy/paste code this way.
4044
4048
4045 * Created global _il to hold the input list. Allows easy
4049 * Created global _il to hold the input list. Allows easy
4046 re-execution of blocks of code by slicing it (inspired by Janko's
4050 re-execution of blocks of code by slicing it (inspired by Janko's
4047 comment on 'macros').
4051 comment on 'macros').
4048
4052
4049 * Small fixes and doc updates.
4053 * Small fixes and doc updates.
4050
4054
4051 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4055 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4052 much too fragile with automagic. Handles properly multi-line
4056 much too fragile with automagic. Handles properly multi-line
4053 statements and takes parameters.
4057 statements and takes parameters.
4054
4058
4055 2001-11-30 Fernando Perez <fperez@colorado.edu>
4059 2001-11-30 Fernando Perez <fperez@colorado.edu>
4056
4060
4057 * Version 0.1.18 released.
4061 * Version 0.1.18 released.
4058
4062
4059 * Fixed nasty namespace bug in initial module imports.
4063 * Fixed nasty namespace bug in initial module imports.
4060
4064
4061 * Added copyright/license notes to all code files (except
4065 * Added copyright/license notes to all code files (except
4062 DPyGetOpt). For the time being, LGPL. That could change.
4066 DPyGetOpt). For the time being, LGPL. That could change.
4063
4067
4064 * Rewrote a much nicer README, updated INSTALL, cleaned up
4068 * Rewrote a much nicer README, updated INSTALL, cleaned up
4065 ipythonrc-* samples.
4069 ipythonrc-* samples.
4066
4070
4067 * Overall code/documentation cleanup. Basically ready for
4071 * Overall code/documentation cleanup. Basically ready for
4068 release. Only remaining thing: licence decision (LGPL?).
4072 release. Only remaining thing: licence decision (LGPL?).
4069
4073
4070 * Converted load_config to a class, ConfigLoader. Now recursion
4074 * Converted load_config to a class, ConfigLoader. Now recursion
4071 control is better organized. Doesn't include the same file twice.
4075 control is better organized. Doesn't include the same file twice.
4072
4076
4073 2001-11-29 Fernando Perez <fperez@colorado.edu>
4077 2001-11-29 Fernando Perez <fperez@colorado.edu>
4074
4078
4075 * Got input history working. Changed output history variables from
4079 * Got input history working. Changed output history variables from
4076 _p to _o so that _i is for input and _o for output. Just cleaner
4080 _p to _o so that _i is for input and _o for output. Just cleaner
4077 convention.
4081 convention.
4078
4082
4079 * Implemented parametric aliases. This pretty much allows the
4083 * Implemented parametric aliases. This pretty much allows the
4080 alias system to offer full-blown shell convenience, I think.
4084 alias system to offer full-blown shell convenience, I think.
4081
4085
4082 * Version 0.1.17 released, 0.1.18 opened.
4086 * Version 0.1.17 released, 0.1.18 opened.
4083
4087
4084 * dot_ipython/ipythonrc (alias): added documentation.
4088 * dot_ipython/ipythonrc (alias): added documentation.
4085 (xcolor): Fixed small bug (xcolors -> xcolor)
4089 (xcolor): Fixed small bug (xcolors -> xcolor)
4086
4090
4087 * Changed the alias system. Now alias is a magic command to define
4091 * Changed the alias system. Now alias is a magic command to define
4088 aliases just like the shell. Rationale: the builtin magics should
4092 aliases just like the shell. Rationale: the builtin magics should
4089 be there for things deeply connected to IPython's
4093 be there for things deeply connected to IPython's
4090 architecture. And this is a much lighter system for what I think
4094 architecture. And this is a much lighter system for what I think
4091 is the really important feature: allowing users to define quickly
4095 is the really important feature: allowing users to define quickly
4092 magics that will do shell things for them, so they can customize
4096 magics that will do shell things for them, so they can customize
4093 IPython easily to match their work habits. If someone is really
4097 IPython easily to match their work habits. If someone is really
4094 desperate to have another name for a builtin alias, they can
4098 desperate to have another name for a builtin alias, they can
4095 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4099 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4096 works.
4100 works.
4097
4101
4098 2001-11-28 Fernando Perez <fperez@colorado.edu>
4102 2001-11-28 Fernando Perez <fperez@colorado.edu>
4099
4103
4100 * Changed @file so that it opens the source file at the proper
4104 * Changed @file so that it opens the source file at the proper
4101 line. Since it uses less, if your EDITOR environment is
4105 line. Since it uses less, if your EDITOR environment is
4102 configured, typing v will immediately open your editor of choice
4106 configured, typing v will immediately open your editor of choice
4103 right at the line where the object is defined. Not as quick as
4107 right at the line where the object is defined. Not as quick as
4104 having a direct @edit command, but for all intents and purposes it
4108 having a direct @edit command, but for all intents and purposes it
4105 works. And I don't have to worry about writing @edit to deal with
4109 works. And I don't have to worry about writing @edit to deal with
4106 all the editors, less does that.
4110 all the editors, less does that.
4107
4111
4108 * Version 0.1.16 released, 0.1.17 opened.
4112 * Version 0.1.16 released, 0.1.17 opened.
4109
4113
4110 * Fixed some nasty bugs in the page/page_dumb combo that could
4114 * Fixed some nasty bugs in the page/page_dumb combo that could
4111 crash IPython.
4115 crash IPython.
4112
4116
4113 2001-11-27 Fernando Perez <fperez@colorado.edu>
4117 2001-11-27 Fernando Perez <fperez@colorado.edu>
4114
4118
4115 * Version 0.1.15 released, 0.1.16 opened.
4119 * Version 0.1.15 released, 0.1.16 opened.
4116
4120
4117 * Finally got ? and ?? to work for undefined things: now it's
4121 * Finally got ? and ?? to work for undefined things: now it's
4118 possible to type {}.get? and get information about the get method
4122 possible to type {}.get? and get information about the get method
4119 of dicts, or os.path? even if only os is defined (so technically
4123 of dicts, or os.path? even if only os is defined (so technically
4120 os.path isn't). Works at any level. For example, after import os,
4124 os.path isn't). Works at any level. For example, after import os,
4121 os?, os.path?, os.path.abspath? all work. This is great, took some
4125 os?, os.path?, os.path.abspath? all work. This is great, took some
4122 work in _ofind.
4126 work in _ofind.
4123
4127
4124 * Fixed more bugs with logging. The sanest way to do it was to add
4128 * Fixed more bugs with logging. The sanest way to do it was to add
4125 to @log a 'mode' parameter. Killed two in one shot (this mode
4129 to @log a 'mode' parameter. Killed two in one shot (this mode
4126 option was a request of Janko's). I think it's finally clean
4130 option was a request of Janko's). I think it's finally clean
4127 (famous last words).
4131 (famous last words).
4128
4132
4129 * Added a page_dumb() pager which does a decent job of paging on
4133 * Added a page_dumb() pager which does a decent job of paging on
4130 screen, if better things (like less) aren't available. One less
4134 screen, if better things (like less) aren't available. One less
4131 unix dependency (someday maybe somebody will port this to
4135 unix dependency (someday maybe somebody will port this to
4132 windows).
4136 windows).
4133
4137
4134 * Fixed problem in magic_log: would lock of logging out if log
4138 * Fixed problem in magic_log: would lock of logging out if log
4135 creation failed (because it would still think it had succeeded).
4139 creation failed (because it would still think it had succeeded).
4136
4140
4137 * Improved the page() function using curses to auto-detect screen
4141 * Improved the page() function using curses to auto-detect screen
4138 size. Now it can make a much better decision on whether to print
4142 size. Now it can make a much better decision on whether to print
4139 or page a string. Option screen_length was modified: a value 0
4143 or page a string. Option screen_length was modified: a value 0
4140 means auto-detect, and that's the default now.
4144 means auto-detect, and that's the default now.
4141
4145
4142 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4146 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4143 go out. I'll test it for a few days, then talk to Janko about
4147 go out. I'll test it for a few days, then talk to Janko about
4144 licences and announce it.
4148 licences and announce it.
4145
4149
4146 * Fixed the length of the auto-generated ---> prompt which appears
4150 * Fixed the length of the auto-generated ---> prompt which appears
4147 for auto-parens and auto-quotes. Getting this right isn't trivial,
4151 for auto-parens and auto-quotes. Getting this right isn't trivial,
4148 with all the color escapes, different prompt types and optional
4152 with all the color escapes, different prompt types and optional
4149 separators. But it seems to be working in all the combinations.
4153 separators. But it seems to be working in all the combinations.
4150
4154
4151 2001-11-26 Fernando Perez <fperez@colorado.edu>
4155 2001-11-26 Fernando Perez <fperez@colorado.edu>
4152
4156
4153 * Wrote a regexp filter to get option types from the option names
4157 * Wrote a regexp filter to get option types from the option names
4154 string. This eliminates the need to manually keep two duplicate
4158 string. This eliminates the need to manually keep two duplicate
4155 lists.
4159 lists.
4156
4160
4157 * Removed the unneeded check_option_names. Now options are handled
4161 * Removed the unneeded check_option_names. Now options are handled
4158 in a much saner manner and it's easy to visually check that things
4162 in a much saner manner and it's easy to visually check that things
4159 are ok.
4163 are ok.
4160
4164
4161 * Updated version numbers on all files I modified to carry a
4165 * Updated version numbers on all files I modified to carry a
4162 notice so Janko and Nathan have clear version markers.
4166 notice so Janko and Nathan have clear version markers.
4163
4167
4164 * Updated docstring for ultraTB with my changes. I should send
4168 * Updated docstring for ultraTB with my changes. I should send
4165 this to Nathan.
4169 this to Nathan.
4166
4170
4167 * Lots of small fixes. Ran everything through pychecker again.
4171 * Lots of small fixes. Ran everything through pychecker again.
4168
4172
4169 * Made loading of deep_reload an cmd line option. If it's not too
4173 * Made loading of deep_reload an cmd line option. If it's not too
4170 kosher, now people can just disable it. With -nodeep_reload it's
4174 kosher, now people can just disable it. With -nodeep_reload it's
4171 still available as dreload(), it just won't overwrite reload().
4175 still available as dreload(), it just won't overwrite reload().
4172
4176
4173 * Moved many options to the no| form (-opt and -noopt
4177 * Moved many options to the no| form (-opt and -noopt
4174 accepted). Cleaner.
4178 accepted). Cleaner.
4175
4179
4176 * Changed magic_log so that if called with no parameters, it uses
4180 * Changed magic_log so that if called with no parameters, it uses
4177 'rotate' mode. That way auto-generated logs aren't automatically
4181 'rotate' mode. That way auto-generated logs aren't automatically
4178 over-written. For normal logs, now a backup is made if it exists
4182 over-written. For normal logs, now a backup is made if it exists
4179 (only 1 level of backups). A new 'backup' mode was added to the
4183 (only 1 level of backups). A new 'backup' mode was added to the
4180 Logger class to support this. This was a request by Janko.
4184 Logger class to support this. This was a request by Janko.
4181
4185
4182 * Added @logoff/@logon to stop/restart an active log.
4186 * Added @logoff/@logon to stop/restart an active log.
4183
4187
4184 * Fixed a lot of bugs in log saving/replay. It was pretty
4188 * Fixed a lot of bugs in log saving/replay. It was pretty
4185 broken. Now special lines (!@,/) appear properly in the command
4189 broken. Now special lines (!@,/) appear properly in the command
4186 history after a log replay.
4190 history after a log replay.
4187
4191
4188 * Tried and failed to implement full session saving via pickle. My
4192 * Tried and failed to implement full session saving via pickle. My
4189 idea was to pickle __main__.__dict__, but modules can't be
4193 idea was to pickle __main__.__dict__, but modules can't be
4190 pickled. This would be a better alternative to replaying logs, but
4194 pickled. This would be a better alternative to replaying logs, but
4191 seems quite tricky to get to work. Changed -session to be called
4195 seems quite tricky to get to work. Changed -session to be called
4192 -logplay, which more accurately reflects what it does. And if we
4196 -logplay, which more accurately reflects what it does. And if we
4193 ever get real session saving working, -session is now available.
4197 ever get real session saving working, -session is now available.
4194
4198
4195 * Implemented color schemes for prompts also. As for tracebacks,
4199 * Implemented color schemes for prompts also. As for tracebacks,
4196 currently only NoColor and Linux are supported. But now the
4200 currently only NoColor and Linux are supported. But now the
4197 infrastructure is in place, based on a generic ColorScheme
4201 infrastructure is in place, based on a generic ColorScheme
4198 class. So writing and activating new schemes both for the prompts
4202 class. So writing and activating new schemes both for the prompts
4199 and the tracebacks should be straightforward.
4203 and the tracebacks should be straightforward.
4200
4204
4201 * Version 0.1.13 released, 0.1.14 opened.
4205 * Version 0.1.13 released, 0.1.14 opened.
4202
4206
4203 * Changed handling of options for output cache. Now counter is
4207 * Changed handling of options for output cache. Now counter is
4204 hardwired starting at 1 and one specifies the maximum number of
4208 hardwired starting at 1 and one specifies the maximum number of
4205 entries *in the outcache* (not the max prompt counter). This is
4209 entries *in the outcache* (not the max prompt counter). This is
4206 much better, since many statements won't increase the cache
4210 much better, since many statements won't increase the cache
4207 count. It also eliminated some confusing options, now there's only
4211 count. It also eliminated some confusing options, now there's only
4208 one: cache_size.
4212 one: cache_size.
4209
4213
4210 * Added 'alias' magic function and magic_alias option in the
4214 * Added 'alias' magic function and magic_alias option in the
4211 ipythonrc file. Now the user can easily define whatever names he
4215 ipythonrc file. Now the user can easily define whatever names he
4212 wants for the magic functions without having to play weird
4216 wants for the magic functions without having to play weird
4213 namespace games. This gives IPython a real shell-like feel.
4217 namespace games. This gives IPython a real shell-like feel.
4214
4218
4215 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4219 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4216 @ or not).
4220 @ or not).
4217
4221
4218 This was one of the last remaining 'visible' bugs (that I know
4222 This was one of the last remaining 'visible' bugs (that I know
4219 of). I think if I can clean up the session loading so it works
4223 of). I think if I can clean up the session loading so it works
4220 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4224 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4221 about licensing).
4225 about licensing).
4222
4226
4223 2001-11-25 Fernando Perez <fperez@colorado.edu>
4227 2001-11-25 Fernando Perez <fperez@colorado.edu>
4224
4228
4225 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4229 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4226 there's a cleaner distinction between what ? and ?? show.
4230 there's a cleaner distinction between what ? and ?? show.
4227
4231
4228 * Added screen_length option. Now the user can define his own
4232 * Added screen_length option. Now the user can define his own
4229 screen size for page() operations.
4233 screen size for page() operations.
4230
4234
4231 * Implemented magic shell-like functions with automatic code
4235 * Implemented magic shell-like functions with automatic code
4232 generation. Now adding another function is just a matter of adding
4236 generation. Now adding another function is just a matter of adding
4233 an entry to a dict, and the function is dynamically generated at
4237 an entry to a dict, and the function is dynamically generated at
4234 run-time. Python has some really cool features!
4238 run-time. Python has some really cool features!
4235
4239
4236 * Renamed many options to cleanup conventions a little. Now all
4240 * Renamed many options to cleanup conventions a little. Now all
4237 are lowercase, and only underscores where needed. Also in the code
4241 are lowercase, and only underscores where needed. Also in the code
4238 option name tables are clearer.
4242 option name tables are clearer.
4239
4243
4240 * Changed prompts a little. Now input is 'In [n]:' instead of
4244 * Changed prompts a little. Now input is 'In [n]:' instead of
4241 'In[n]:='. This allows it the numbers to be aligned with the
4245 'In[n]:='. This allows it the numbers to be aligned with the
4242 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4246 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4243 Python (it was a Mathematica thing). The '...' continuation prompt
4247 Python (it was a Mathematica thing). The '...' continuation prompt
4244 was also changed a little to align better.
4248 was also changed a little to align better.
4245
4249
4246 * Fixed bug when flushing output cache. Not all _p<n> variables
4250 * Fixed bug when flushing output cache. Not all _p<n> variables
4247 exist, so their deletion needs to be wrapped in a try:
4251 exist, so their deletion needs to be wrapped in a try:
4248
4252
4249 * Figured out how to properly use inspect.formatargspec() (it
4253 * Figured out how to properly use inspect.formatargspec() (it
4250 requires the args preceded by *). So I removed all the code from
4254 requires the args preceded by *). So I removed all the code from
4251 _get_pdef in Magic, which was just replicating that.
4255 _get_pdef in Magic, which was just replicating that.
4252
4256
4253 * Added test to prefilter to allow redefining magic function names
4257 * Added test to prefilter to allow redefining magic function names
4254 as variables. This is ok, since the @ form is always available,
4258 as variables. This is ok, since the @ form is always available,
4255 but whe should allow the user to define a variable called 'ls' if
4259 but whe should allow the user to define a variable called 'ls' if
4256 he needs it.
4260 he needs it.
4257
4261
4258 * Moved the ToDo information from README into a separate ToDo.
4262 * Moved the ToDo information from README into a separate ToDo.
4259
4263
4260 * General code cleanup and small bugfixes. I think it's close to a
4264 * General code cleanup and small bugfixes. I think it's close to a
4261 state where it can be released, obviously with a big 'beta'
4265 state where it can be released, obviously with a big 'beta'
4262 warning on it.
4266 warning on it.
4263
4267
4264 * Got the magic function split to work. Now all magics are defined
4268 * Got the magic function split to work. Now all magics are defined
4265 in a separate class. It just organizes things a bit, and now
4269 in a separate class. It just organizes things a bit, and now
4266 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4270 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4267 was too long).
4271 was too long).
4268
4272
4269 * Changed @clear to @reset to avoid potential confusions with
4273 * Changed @clear to @reset to avoid potential confusions with
4270 the shell command clear. Also renamed @cl to @clear, which does
4274 the shell command clear. Also renamed @cl to @clear, which does
4271 exactly what people expect it to from their shell experience.
4275 exactly what people expect it to from their shell experience.
4272
4276
4273 Added a check to the @reset command (since it's so
4277 Added a check to the @reset command (since it's so
4274 destructive, it's probably a good idea to ask for confirmation).
4278 destructive, it's probably a good idea to ask for confirmation).
4275 But now reset only works for full namespace resetting. Since the
4279 But now reset only works for full namespace resetting. Since the
4276 del keyword is already there for deleting a few specific
4280 del keyword is already there for deleting a few specific
4277 variables, I don't see the point of having a redundant magic
4281 variables, I don't see the point of having a redundant magic
4278 function for the same task.
4282 function for the same task.
4279
4283
4280 2001-11-24 Fernando Perez <fperez@colorado.edu>
4284 2001-11-24 Fernando Perez <fperez@colorado.edu>
4281
4285
4282 * Updated the builtin docs (esp. the ? ones).
4286 * Updated the builtin docs (esp. the ? ones).
4283
4287
4284 * Ran all the code through pychecker. Not terribly impressed with
4288 * Ran all the code through pychecker. Not terribly impressed with
4285 it: lots of spurious warnings and didn't really find anything of
4289 it: lots of spurious warnings and didn't really find anything of
4286 substance (just a few modules being imported and not used).
4290 substance (just a few modules being imported and not used).
4287
4291
4288 * Implemented the new ultraTB functionality into IPython. New
4292 * Implemented the new ultraTB functionality into IPython. New
4289 option: xcolors. This chooses color scheme. xmode now only selects
4293 option: xcolors. This chooses color scheme. xmode now only selects
4290 between Plain and Verbose. Better orthogonality.
4294 between Plain and Verbose. Better orthogonality.
4291
4295
4292 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4296 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4293 mode and color scheme for the exception handlers. Now it's
4297 mode and color scheme for the exception handlers. Now it's
4294 possible to have the verbose traceback with no coloring.
4298 possible to have the verbose traceback with no coloring.
4295
4299
4296 2001-11-23 Fernando Perez <fperez@colorado.edu>
4300 2001-11-23 Fernando Perez <fperez@colorado.edu>
4297
4301
4298 * Version 0.1.12 released, 0.1.13 opened.
4302 * Version 0.1.12 released, 0.1.13 opened.
4299
4303
4300 * Removed option to set auto-quote and auto-paren escapes by
4304 * Removed option to set auto-quote and auto-paren escapes by
4301 user. The chances of breaking valid syntax are just too high. If
4305 user. The chances of breaking valid syntax are just too high. If
4302 someone *really* wants, they can always dig into the code.
4306 someone *really* wants, they can always dig into the code.
4303
4307
4304 * Made prompt separators configurable.
4308 * Made prompt separators configurable.
4305
4309
4306 2001-11-22 Fernando Perez <fperez@colorado.edu>
4310 2001-11-22 Fernando Perez <fperez@colorado.edu>
4307
4311
4308 * Small bugfixes in many places.
4312 * Small bugfixes in many places.
4309
4313
4310 * Removed the MyCompleter class from ipplib. It seemed redundant
4314 * Removed the MyCompleter class from ipplib. It seemed redundant
4311 with the C-p,C-n history search functionality. Less code to
4315 with the C-p,C-n history search functionality. Less code to
4312 maintain.
4316 maintain.
4313
4317
4314 * Moved all the original ipython.py code into ipythonlib.py. Right
4318 * Moved all the original ipython.py code into ipythonlib.py. Right
4315 now it's just one big dump into a function called make_IPython, so
4319 now it's just one big dump into a function called make_IPython, so
4316 no real modularity has been gained. But at least it makes the
4320 no real modularity has been gained. But at least it makes the
4317 wrapper script tiny, and since ipythonlib is a module, it gets
4321 wrapper script tiny, and since ipythonlib is a module, it gets
4318 compiled and startup is much faster.
4322 compiled and startup is much faster.
4319
4323
4320 This is a reasobably 'deep' change, so we should test it for a
4324 This is a reasobably 'deep' change, so we should test it for a
4321 while without messing too much more with the code.
4325 while without messing too much more with the code.
4322
4326
4323 2001-11-21 Fernando Perez <fperez@colorado.edu>
4327 2001-11-21 Fernando Perez <fperez@colorado.edu>
4324
4328
4325 * Version 0.1.11 released, 0.1.12 opened for further work.
4329 * Version 0.1.11 released, 0.1.12 opened for further work.
4326
4330
4327 * Removed dependency on Itpl. It was only needed in one place. It
4331 * Removed dependency on Itpl. It was only needed in one place. It
4328 would be nice if this became part of python, though. It makes life
4332 would be nice if this became part of python, though. It makes life
4329 *a lot* easier in some cases.
4333 *a lot* easier in some cases.
4330
4334
4331 * Simplified the prefilter code a bit. Now all handlers are
4335 * Simplified the prefilter code a bit. Now all handlers are
4332 expected to explicitly return a value (at least a blank string).
4336 expected to explicitly return a value (at least a blank string).
4333
4337
4334 * Heavy edits in ipplib. Removed the help system altogether. Now
4338 * Heavy edits in ipplib. Removed the help system altogether. Now
4335 obj?/?? is used for inspecting objects, a magic @doc prints
4339 obj?/?? is used for inspecting objects, a magic @doc prints
4336 docstrings, and full-blown Python help is accessed via the 'help'
4340 docstrings, and full-blown Python help is accessed via the 'help'
4337 keyword. This cleans up a lot of code (less to maintain) and does
4341 keyword. This cleans up a lot of code (less to maintain) and does
4338 the job. Since 'help' is now a standard Python component, might as
4342 the job. Since 'help' is now a standard Python component, might as
4339 well use it and remove duplicate functionality.
4343 well use it and remove duplicate functionality.
4340
4344
4341 Also removed the option to use ipplib as a standalone program. By
4345 Also removed the option to use ipplib as a standalone program. By
4342 now it's too dependent on other parts of IPython to function alone.
4346 now it's too dependent on other parts of IPython to function alone.
4343
4347
4344 * Fixed bug in genutils.pager. It would crash if the pager was
4348 * Fixed bug in genutils.pager. It would crash if the pager was
4345 exited immediately after opening (broken pipe).
4349 exited immediately after opening (broken pipe).
4346
4350
4347 * Trimmed down the VerboseTB reporting a little. The header is
4351 * Trimmed down the VerboseTB reporting a little. The header is
4348 much shorter now and the repeated exception arguments at the end
4352 much shorter now and the repeated exception arguments at the end
4349 have been removed. For interactive use the old header seemed a bit
4353 have been removed. For interactive use the old header seemed a bit
4350 excessive.
4354 excessive.
4351
4355
4352 * Fixed small bug in output of @whos for variables with multi-word
4356 * Fixed small bug in output of @whos for variables with multi-word
4353 types (only first word was displayed).
4357 types (only first word was displayed).
4354
4358
4355 2001-11-17 Fernando Perez <fperez@colorado.edu>
4359 2001-11-17 Fernando Perez <fperez@colorado.edu>
4356
4360
4357 * Version 0.1.10 released, 0.1.11 opened for further work.
4361 * Version 0.1.10 released, 0.1.11 opened for further work.
4358
4362
4359 * Modified dirs and friends. dirs now *returns* the stack (not
4363 * Modified dirs and friends. dirs now *returns* the stack (not
4360 prints), so one can manipulate it as a variable. Convenient to
4364 prints), so one can manipulate it as a variable. Convenient to
4361 travel along many directories.
4365 travel along many directories.
4362
4366
4363 * Fixed bug in magic_pdef: would only work with functions with
4367 * Fixed bug in magic_pdef: would only work with functions with
4364 arguments with default values.
4368 arguments with default values.
4365
4369
4366 2001-11-14 Fernando Perez <fperez@colorado.edu>
4370 2001-11-14 Fernando Perez <fperez@colorado.edu>
4367
4371
4368 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4372 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4369 example with IPython. Various other minor fixes and cleanups.
4373 example with IPython. Various other minor fixes and cleanups.
4370
4374
4371 * Version 0.1.9 released, 0.1.10 opened for further work.
4375 * Version 0.1.9 released, 0.1.10 opened for further work.
4372
4376
4373 * Added sys.path to the list of directories searched in the
4377 * Added sys.path to the list of directories searched in the
4374 execfile= option. It used to be the current directory and the
4378 execfile= option. It used to be the current directory and the
4375 user's IPYTHONDIR only.
4379 user's IPYTHONDIR only.
4376
4380
4377 2001-11-13 Fernando Perez <fperez@colorado.edu>
4381 2001-11-13 Fernando Perez <fperez@colorado.edu>
4378
4382
4379 * Reinstated the raw_input/prefilter separation that Janko had
4383 * Reinstated the raw_input/prefilter separation that Janko had
4380 initially. This gives a more convenient setup for extending the
4384 initially. This gives a more convenient setup for extending the
4381 pre-processor from the outside: raw_input always gets a string,
4385 pre-processor from the outside: raw_input always gets a string,
4382 and prefilter has to process it. We can then redefine prefilter
4386 and prefilter has to process it. We can then redefine prefilter
4383 from the outside and implement extensions for special
4387 from the outside and implement extensions for special
4384 purposes.
4388 purposes.
4385
4389
4386 Today I got one for inputting PhysicalQuantity objects
4390 Today I got one for inputting PhysicalQuantity objects
4387 (from Scientific) without needing any function calls at
4391 (from Scientific) without needing any function calls at
4388 all. Extremely convenient, and it's all done as a user-level
4392 all. Extremely convenient, and it's all done as a user-level
4389 extension (no IPython code was touched). Now instead of:
4393 extension (no IPython code was touched). Now instead of:
4390 a = PhysicalQuantity(4.2,'m/s**2')
4394 a = PhysicalQuantity(4.2,'m/s**2')
4391 one can simply say
4395 one can simply say
4392 a = 4.2 m/s**2
4396 a = 4.2 m/s**2
4393 or even
4397 or even
4394 a = 4.2 m/s^2
4398 a = 4.2 m/s^2
4395
4399
4396 I use this, but it's also a proof of concept: IPython really is
4400 I use this, but it's also a proof of concept: IPython really is
4397 fully user-extensible, even at the level of the parsing of the
4401 fully user-extensible, even at the level of the parsing of the
4398 command line. It's not trivial, but it's perfectly doable.
4402 command line. It's not trivial, but it's perfectly doable.
4399
4403
4400 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4404 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4401 the problem of modules being loaded in the inverse order in which
4405 the problem of modules being loaded in the inverse order in which
4402 they were defined in
4406 they were defined in
4403
4407
4404 * Version 0.1.8 released, 0.1.9 opened for further work.
4408 * Version 0.1.8 released, 0.1.9 opened for further work.
4405
4409
4406 * Added magics pdef, source and file. They respectively show the
4410 * Added magics pdef, source and file. They respectively show the
4407 definition line ('prototype' in C), source code and full python
4411 definition line ('prototype' in C), source code and full python
4408 file for any callable object. The object inspector oinfo uses
4412 file for any callable object. The object inspector oinfo uses
4409 these to show the same information.
4413 these to show the same information.
4410
4414
4411 * Version 0.1.7 released, 0.1.8 opened for further work.
4415 * Version 0.1.7 released, 0.1.8 opened for further work.
4412
4416
4413 * Separated all the magic functions into a class called Magic. The
4417 * Separated all the magic functions into a class called Magic. The
4414 InteractiveShell class was becoming too big for Xemacs to handle
4418 InteractiveShell class was becoming too big for Xemacs to handle
4415 (de-indenting a line would lock it up for 10 seconds while it
4419 (de-indenting a line would lock it up for 10 seconds while it
4416 backtracked on the whole class!)
4420 backtracked on the whole class!)
4417
4421
4418 FIXME: didn't work. It can be done, but right now namespaces are
4422 FIXME: didn't work. It can be done, but right now namespaces are
4419 all messed up. Do it later (reverted it for now, so at least
4423 all messed up. Do it later (reverted it for now, so at least
4420 everything works as before).
4424 everything works as before).
4421
4425
4422 * Got the object introspection system (magic_oinfo) working! I
4426 * Got the object introspection system (magic_oinfo) working! I
4423 think this is pretty much ready for release to Janko, so he can
4427 think this is pretty much ready for release to Janko, so he can
4424 test it for a while and then announce it. Pretty much 100% of what
4428 test it for a while and then announce it. Pretty much 100% of what
4425 I wanted for the 'phase 1' release is ready. Happy, tired.
4429 I wanted for the 'phase 1' release is ready. Happy, tired.
4426
4430
4427 2001-11-12 Fernando Perez <fperez@colorado.edu>
4431 2001-11-12 Fernando Perez <fperez@colorado.edu>
4428
4432
4429 * Version 0.1.6 released, 0.1.7 opened for further work.
4433 * Version 0.1.6 released, 0.1.7 opened for further work.
4430
4434
4431 * Fixed bug in printing: it used to test for truth before
4435 * Fixed bug in printing: it used to test for truth before
4432 printing, so 0 wouldn't print. Now checks for None.
4436 printing, so 0 wouldn't print. Now checks for None.
4433
4437
4434 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4438 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4435 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4439 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4436 reaches by hand into the outputcache. Think of a better way to do
4440 reaches by hand into the outputcache. Think of a better way to do
4437 this later.
4441 this later.
4438
4442
4439 * Various small fixes thanks to Nathan's comments.
4443 * Various small fixes thanks to Nathan's comments.
4440
4444
4441 * Changed magic_pprint to magic_Pprint. This way it doesn't
4445 * Changed magic_pprint to magic_Pprint. This way it doesn't
4442 collide with pprint() and the name is consistent with the command
4446 collide with pprint() and the name is consistent with the command
4443 line option.
4447 line option.
4444
4448
4445 * Changed prompt counter behavior to be fully like
4449 * Changed prompt counter behavior to be fully like
4446 Mathematica's. That is, even input that doesn't return a result
4450 Mathematica's. That is, even input that doesn't return a result
4447 raises the prompt counter. The old behavior was kind of confusing
4451 raises the prompt counter. The old behavior was kind of confusing
4448 (getting the same prompt number several times if the operation
4452 (getting the same prompt number several times if the operation
4449 didn't return a result).
4453 didn't return a result).
4450
4454
4451 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4455 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4452
4456
4453 * Fixed -Classic mode (wasn't working anymore).
4457 * Fixed -Classic mode (wasn't working anymore).
4454
4458
4455 * Added colored prompts using Nathan's new code. Colors are
4459 * Added colored prompts using Nathan's new code. Colors are
4456 currently hardwired, they can be user-configurable. For
4460 currently hardwired, they can be user-configurable. For
4457 developers, they can be chosen in file ipythonlib.py, at the
4461 developers, they can be chosen in file ipythonlib.py, at the
4458 beginning of the CachedOutput class def.
4462 beginning of the CachedOutput class def.
4459
4463
4460 2001-11-11 Fernando Perez <fperez@colorado.edu>
4464 2001-11-11 Fernando Perez <fperez@colorado.edu>
4461
4465
4462 * Version 0.1.5 released, 0.1.6 opened for further work.
4466 * Version 0.1.5 released, 0.1.6 opened for further work.
4463
4467
4464 * Changed magic_env to *return* the environment as a dict (not to
4468 * Changed magic_env to *return* the environment as a dict (not to
4465 print it). This way it prints, but it can also be processed.
4469 print it). This way it prints, but it can also be processed.
4466
4470
4467 * Added Verbose exception reporting to interactive
4471 * Added Verbose exception reporting to interactive
4468 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4472 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4469 traceback. Had to make some changes to the ultraTB file. This is
4473 traceback. Had to make some changes to the ultraTB file. This is
4470 probably the last 'big' thing in my mental todo list. This ties
4474 probably the last 'big' thing in my mental todo list. This ties
4471 in with the next entry:
4475 in with the next entry:
4472
4476
4473 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4477 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4474 has to specify is Plain, Color or Verbose for all exception
4478 has to specify is Plain, Color or Verbose for all exception
4475 handling.
4479 handling.
4476
4480
4477 * Removed ShellServices option. All this can really be done via
4481 * Removed ShellServices option. All this can really be done via
4478 the magic system. It's easier to extend, cleaner and has automatic
4482 the magic system. It's easier to extend, cleaner and has automatic
4479 namespace protection and documentation.
4483 namespace protection and documentation.
4480
4484
4481 2001-11-09 Fernando Perez <fperez@colorado.edu>
4485 2001-11-09 Fernando Perez <fperez@colorado.edu>
4482
4486
4483 * Fixed bug in output cache flushing (missing parameter to
4487 * Fixed bug in output cache flushing (missing parameter to
4484 __init__). Other small bugs fixed (found using pychecker).
4488 __init__). Other small bugs fixed (found using pychecker).
4485
4489
4486 * Version 0.1.4 opened for bugfixing.
4490 * Version 0.1.4 opened for bugfixing.
4487
4491
4488 2001-11-07 Fernando Perez <fperez@colorado.edu>
4492 2001-11-07 Fernando Perez <fperez@colorado.edu>
4489
4493
4490 * Version 0.1.3 released, mainly because of the raw_input bug.
4494 * Version 0.1.3 released, mainly because of the raw_input bug.
4491
4495
4492 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4496 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4493 and when testing for whether things were callable, a call could
4497 and when testing for whether things were callable, a call could
4494 actually be made to certain functions. They would get called again
4498 actually be made to certain functions. They would get called again
4495 once 'really' executed, with a resulting double call. A disaster
4499 once 'really' executed, with a resulting double call. A disaster
4496 in many cases (list.reverse() would never work!).
4500 in many cases (list.reverse() would never work!).
4497
4501
4498 * Removed prefilter() function, moved its code to raw_input (which
4502 * Removed prefilter() function, moved its code to raw_input (which
4499 after all was just a near-empty caller for prefilter). This saves
4503 after all was just a near-empty caller for prefilter). This saves
4500 a function call on every prompt, and simplifies the class a tiny bit.
4504 a function call on every prompt, and simplifies the class a tiny bit.
4501
4505
4502 * Fix _ip to __ip name in magic example file.
4506 * Fix _ip to __ip name in magic example file.
4503
4507
4504 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4508 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4505 work with non-gnu versions of tar.
4509 work with non-gnu versions of tar.
4506
4510
4507 2001-11-06 Fernando Perez <fperez@colorado.edu>
4511 2001-11-06 Fernando Perez <fperez@colorado.edu>
4508
4512
4509 * Version 0.1.2. Just to keep track of the recent changes.
4513 * Version 0.1.2. Just to keep track of the recent changes.
4510
4514
4511 * Fixed nasty bug in output prompt routine. It used to check 'if
4515 * Fixed nasty bug in output prompt routine. It used to check 'if
4512 arg != None...'. Problem is, this fails if arg implements a
4516 arg != None...'. Problem is, this fails if arg implements a
4513 special comparison (__cmp__) which disallows comparing to
4517 special comparison (__cmp__) which disallows comparing to
4514 None. Found it when trying to use the PhysicalQuantity module from
4518 None. Found it when trying to use the PhysicalQuantity module from
4515 ScientificPython.
4519 ScientificPython.
4516
4520
4517 2001-11-05 Fernando Perez <fperez@colorado.edu>
4521 2001-11-05 Fernando Perez <fperez@colorado.edu>
4518
4522
4519 * Also added dirs. Now the pushd/popd/dirs family functions
4523 * Also added dirs. Now the pushd/popd/dirs family functions
4520 basically like the shell, with the added convenience of going home
4524 basically like the shell, with the added convenience of going home
4521 when called with no args.
4525 when called with no args.
4522
4526
4523 * pushd/popd slightly modified to mimic shell behavior more
4527 * pushd/popd slightly modified to mimic shell behavior more
4524 closely.
4528 closely.
4525
4529
4526 * Added env,pushd,popd from ShellServices as magic functions. I
4530 * Added env,pushd,popd from ShellServices as magic functions. I
4527 think the cleanest will be to port all desired functions from
4531 think the cleanest will be to port all desired functions from
4528 ShellServices as magics and remove ShellServices altogether. This
4532 ShellServices as magics and remove ShellServices altogether. This
4529 will provide a single, clean way of adding functionality
4533 will provide a single, clean way of adding functionality
4530 (shell-type or otherwise) to IP.
4534 (shell-type or otherwise) to IP.
4531
4535
4532 2001-11-04 Fernando Perez <fperez@colorado.edu>
4536 2001-11-04 Fernando Perez <fperez@colorado.edu>
4533
4537
4534 * Added .ipython/ directory to sys.path. This way users can keep
4538 * Added .ipython/ directory to sys.path. This way users can keep
4535 customizations there and access them via import.
4539 customizations there and access them via import.
4536
4540
4537 2001-11-03 Fernando Perez <fperez@colorado.edu>
4541 2001-11-03 Fernando Perez <fperez@colorado.edu>
4538
4542
4539 * Opened version 0.1.1 for new changes.
4543 * Opened version 0.1.1 for new changes.
4540
4544
4541 * Changed version number to 0.1.0: first 'public' release, sent to
4545 * Changed version number to 0.1.0: first 'public' release, sent to
4542 Nathan and Janko.
4546 Nathan and Janko.
4543
4547
4544 * Lots of small fixes and tweaks.
4548 * Lots of small fixes and tweaks.
4545
4549
4546 * Minor changes to whos format. Now strings are shown, snipped if
4550 * Minor changes to whos format. Now strings are shown, snipped if
4547 too long.
4551 too long.
4548
4552
4549 * Changed ShellServices to work on __main__ so they show up in @who
4553 * Changed ShellServices to work on __main__ so they show up in @who
4550
4554
4551 * Help also works with ? at the end of a line:
4555 * Help also works with ? at the end of a line:
4552 ?sin and sin?
4556 ?sin and sin?
4553 both produce the same effect. This is nice, as often I use the
4557 both produce the same effect. This is nice, as often I use the
4554 tab-complete to find the name of a method, but I used to then have
4558 tab-complete to find the name of a method, but I used to then have
4555 to go to the beginning of the line to put a ? if I wanted more
4559 to go to the beginning of the line to put a ? if I wanted more
4556 info. Now I can just add the ? and hit return. Convenient.
4560 info. Now I can just add the ? and hit return. Convenient.
4557
4561
4558 2001-11-02 Fernando Perez <fperez@colorado.edu>
4562 2001-11-02 Fernando Perez <fperez@colorado.edu>
4559
4563
4560 * Python version check (>=2.1) added.
4564 * Python version check (>=2.1) added.
4561
4565
4562 * Added LazyPython documentation. At this point the docs are quite
4566 * Added LazyPython documentation. At this point the docs are quite
4563 a mess. A cleanup is in order.
4567 a mess. A cleanup is in order.
4564
4568
4565 * Auto-installer created. For some bizarre reason, the zipfiles
4569 * Auto-installer created. For some bizarre reason, the zipfiles
4566 module isn't working on my system. So I made a tar version
4570 module isn't working on my system. So I made a tar version
4567 (hopefully the command line options in various systems won't kill
4571 (hopefully the command line options in various systems won't kill
4568 me).
4572 me).
4569
4573
4570 * Fixes to Struct in genutils. Now all dictionary-like methods are
4574 * Fixes to Struct in genutils. Now all dictionary-like methods are
4571 protected (reasonably).
4575 protected (reasonably).
4572
4576
4573 * Added pager function to genutils and changed ? to print usage
4577 * Added pager function to genutils and changed ? to print usage
4574 note through it (it was too long).
4578 note through it (it was too long).
4575
4579
4576 * Added the LazyPython functionality. Works great! I changed the
4580 * Added the LazyPython functionality. Works great! I changed the
4577 auto-quote escape to ';', it's on home row and next to '. But
4581 auto-quote escape to ';', it's on home row and next to '. But
4578 both auto-quote and auto-paren (still /) escapes are command-line
4582 both auto-quote and auto-paren (still /) escapes are command-line
4579 parameters.
4583 parameters.
4580
4584
4581
4585
4582 2001-11-01 Fernando Perez <fperez@colorado.edu>
4586 2001-11-01 Fernando Perez <fperez@colorado.edu>
4583
4587
4584 * Version changed to 0.0.7. Fairly large change: configuration now
4588 * Version changed to 0.0.7. Fairly large change: configuration now
4585 is all stored in a directory, by default .ipython. There, all
4589 is all stored in a directory, by default .ipython. There, all
4586 config files have normal looking names (not .names)
4590 config files have normal looking names (not .names)
4587
4591
4588 * Version 0.0.6 Released first to Lucas and Archie as a test
4592 * Version 0.0.6 Released first to Lucas and Archie as a test
4589 run. Since it's the first 'semi-public' release, change version to
4593 run. Since it's the first 'semi-public' release, change version to
4590 > 0.0.6 for any changes now.
4594 > 0.0.6 for any changes now.
4591
4595
4592 * Stuff I had put in the ipplib.py changelog:
4596 * Stuff I had put in the ipplib.py changelog:
4593
4597
4594 Changes to InteractiveShell:
4598 Changes to InteractiveShell:
4595
4599
4596 - Made the usage message a parameter.
4600 - Made the usage message a parameter.
4597
4601
4598 - Require the name of the shell variable to be given. It's a bit
4602 - Require the name of the shell variable to be given. It's a bit
4599 of a hack, but allows the name 'shell' not to be hardwire in the
4603 of a hack, but allows the name 'shell' not to be hardwire in the
4600 magic (@) handler, which is problematic b/c it requires
4604 magic (@) handler, which is problematic b/c it requires
4601 polluting the global namespace with 'shell'. This in turn is
4605 polluting the global namespace with 'shell'. This in turn is
4602 fragile: if a user redefines a variable called shell, things
4606 fragile: if a user redefines a variable called shell, things
4603 break.
4607 break.
4604
4608
4605 - magic @: all functions available through @ need to be defined
4609 - magic @: all functions available through @ need to be defined
4606 as magic_<name>, even though they can be called simply as
4610 as magic_<name>, even though they can be called simply as
4607 @<name>. This allows the special command @magic to gather
4611 @<name>. This allows the special command @magic to gather
4608 information automatically about all existing magic functions,
4612 information automatically about all existing magic functions,
4609 even if they are run-time user extensions, by parsing the shell
4613 even if they are run-time user extensions, by parsing the shell
4610 instance __dict__ looking for special magic_ names.
4614 instance __dict__ looking for special magic_ names.
4611
4615
4612 - mainloop: added *two* local namespace parameters. This allows
4616 - mainloop: added *two* local namespace parameters. This allows
4613 the class to differentiate between parameters which were there
4617 the class to differentiate between parameters which were there
4614 before and after command line initialization was processed. This
4618 before and after command line initialization was processed. This
4615 way, later @who can show things loaded at startup by the
4619 way, later @who can show things loaded at startup by the
4616 user. This trick was necessary to make session saving/reloading
4620 user. This trick was necessary to make session saving/reloading
4617 really work: ideally after saving/exiting/reloading a session,
4621 really work: ideally after saving/exiting/reloading a session,
4618 *everythin* should look the same, including the output of @who. I
4622 *everythin* should look the same, including the output of @who. I
4619 was only able to make this work with this double namespace
4623 was only able to make this work with this double namespace
4620 trick.
4624 trick.
4621
4625
4622 - added a header to the logfile which allows (almost) full
4626 - added a header to the logfile which allows (almost) full
4623 session restoring.
4627 session restoring.
4624
4628
4625 - prepend lines beginning with @ or !, with a and log
4629 - prepend lines beginning with @ or !, with a and log
4626 them. Why? !lines: may be useful to know what you did @lines:
4630 them. Why? !lines: may be useful to know what you did @lines:
4627 they may affect session state. So when restoring a session, at
4631 they may affect session state. So when restoring a session, at
4628 least inform the user of their presence. I couldn't quite get
4632 least inform the user of their presence. I couldn't quite get
4629 them to properly re-execute, but at least the user is warned.
4633 them to properly re-execute, but at least the user is warned.
4630
4634
4631 * Started ChangeLog.
4635 * Started ChangeLog.
@@ -1,9152 +1,9161 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
38
39 % Define a \codelist command which either uses listings for latex, or
39 % Define a \codelist command which either uses listings for latex, or
40 % plain verbatim for html (since latex2html doesn't understand the
40 % plain verbatim for html (since latex2html doesn't understand the
41 % listings package).
41 % listings package).
42 \usepackage{verbatim}
42 \usepackage{verbatim}
43 \newcommand{\codelist}[1] {
43 \newcommand{\codelist}[1] {
44 \latex{\lstinputlisting{#1}}
44 \latex{\lstinputlisting{#1}}
45 \html{\verbatiminput{#1}}
45 \html{\verbatiminput{#1}}
46 }
46 }
47 \end_preamble
47 \end_preamble
48 \language english
48 \language english
49 \inputencoding latin1
49 \inputencoding latin1
50 \fontscheme palatino
50 \fontscheme palatino
51 \graphics default
51 \graphics default
52 \paperfontsize 10
52 \paperfontsize 10
53 \spacing single
53 \spacing single
54 \papersize Default
54 \papersize Default
55 \paperpackage a4
55 \paperpackage a4
56 \use_geometry 1
56 \use_geometry 1
57 \use_amsmath 0
57 \use_amsmath 0
58 \use_natbib 0
58 \use_natbib 0
59 \use_numerical_citations 0
59 \use_numerical_citations 0
60 \paperorientation portrait
60 \paperorientation portrait
61 \leftmargin 1.1in
61 \leftmargin 1.1in
62 \topmargin 1in
62 \topmargin 1in
63 \rightmargin 1.1in
63 \rightmargin 1.1in
64 \bottommargin 1in
64 \bottommargin 1in
65 \secnumdepth 3
65 \secnumdepth 3
66 \tocdepth 3
66 \tocdepth 3
67 \paragraph_separation skip
67 \paragraph_separation skip
68 \defskip medskip
68 \defskip medskip
69 \quotes_language english
69 \quotes_language english
70 \quotes_times 2
70 \quotes_times 2
71 \papercolumns 1
71 \papercolumns 1
72 \papersides 1
72 \papersides 1
73 \paperpagestyle fancy
73 \paperpagestyle fancy
74
74
75 \layout Title
75 \layout Title
76
76
77 IPython
77 IPython
78 \newline
78 \newline
79
79
80 \size larger
80 \size larger
81 An enhanced Interactive Python
81 An enhanced Interactive Python
82 \size large
82 \size large
83
83
84 \newline
84 \newline
85 User Manual, v.
85 User Manual, v.
86 __version__
86 __version__
87 \layout Author
87 \layout Author
88
88
89 Fernando P�rez
89 Fernando P�rez
90 \layout Standard
90 \layout Standard
91
91
92
92
93 \begin_inset ERT
93 \begin_inset ERT
94 status Collapsed
94 status Collapsed
95
95
96 \layout Standard
96 \layout Standard
97
97
98 \backslash
98 \backslash
99 latex{
99 latex{
100 \end_inset
100 \end_inset
101
101
102
102
103 \begin_inset LatexCommand \tableofcontents{}
103 \begin_inset LatexCommand \tableofcontents{}
104
104
105 \end_inset
105 \end_inset
106
106
107
107
108 \begin_inset ERT
108 \begin_inset ERT
109 status Collapsed
109 status Collapsed
110
110
111 \layout Standard
111 \layout Standard
112 }
112 }
113 \end_inset
113 \end_inset
114
114
115
115
116 \layout Standard
116 \layout Standard
117
117
118
118
119 \begin_inset ERT
119 \begin_inset ERT
120 status Open
120 status Open
121
121
122 \layout Standard
122 \layout Standard
123
123
124 \backslash
124 \backslash
125 html{
125 html{
126 \backslash
126 \backslash
127 bodytext{bgcolor=#ffffff}}
127 bodytext{bgcolor=#ffffff}}
128 \end_inset
128 \end_inset
129
129
130
130
131 \layout Section
131 \layout Section
132 \pagebreak_top
132 \pagebreak_top
133 Overview
133 Overview
134 \layout Standard
134 \layout Standard
135
135
136 One of Python's most useful features is its interactive interpreter.
136 One of Python's most useful features is its interactive interpreter.
137 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
138 test files as is typical in most programming languages.
138 test files as is typical in most programming languages.
139 However, the interpreter supplied with the standard Python distribution
139 However, the interpreter supplied with the standard Python distribution
140 is somewhat limited for extended interactive use.
140 is somewhat limited for extended interactive use.
141 \layout Standard
141 \layout Standard
142
142
143 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
144 tries to:
144 tries to:
145 \layout Enumerate
145 \layout Enumerate
146
146
147 Provide an interactive shell superior to Python's default.
147 Provide an interactive shell superior to Python's default.
148 IPython has many features for object introspection, system shell access,
148 IPython has many features for object introspection, system shell access,
149 and its own special command system for adding functionality when working
149 and its own special command system for adding functionality when working
150 interactively.
150 interactively.
151 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
152 and for exploration of problems using Python objects (in situations like
152 and for exploration of problems using Python objects (in situations like
153 data analysis).
153 data analysis).
154 \layout Enumerate
154 \layout Enumerate
155
155
156 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.
157 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,
158 providing access to the current namespace.
158 providing access to the current namespace.
159 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
160 where a blend of batch-processing and interactive exploration are needed.
160 where a blend of batch-processing and interactive exploration are needed.
161 \layout Enumerate
161 \layout Enumerate
162
162
163 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
164 other systems with Python as the underlying language.
164 other systems with Python as the underlying language.
165 Specifically scientific environments like Mathematica, IDL and Matlab inspired
165 Specifically scientific environments like Mathematica, IDL and Matlab inspired
166 its design, but similar ideas can be useful in many fields.
166 its design, but similar ideas can be useful in many fields.
167 \layout Subsection
167 \layout Subsection
168
168
169 Main features
169 Main features
170 \layout Itemize
170 \layout Itemize
171
171
172 Dynamic object introspection.
172 Dynamic object introspection.
173 One can access docstrings, function definition prototypes, source code,
173 One can access docstrings, function definition prototypes, source code,
174 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
175 with a single keystroke (`
175 with a single keystroke (`
176 \family typewriter
176 \family typewriter
177 ?
177 ?
178 \family default
178 \family default
179 ').
179 ').
180 \layout Itemize
180 \layout Itemize
181
181
182 Completion in the local namespace, by typing TAB at the prompt.
182 Completion in the local namespace, by typing TAB at the prompt.
183 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.
184 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
185 readline's behavior is provided.
185 readline's behavior is provided.
186 \layout Itemize
186 \layout Itemize
187
187
188 Numbered input/output prompts with command history (persistent across sessions
188 Numbered input/output prompts with command history (persistent across sessions
189 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
190 all input and output.
190 all input and output.
191 \layout Itemize
191 \layout Itemize
192
192
193 User-extensible `magic' commands.
193 User-extensible `magic' commands.
194 A set of commands prefixed with
194 A set of commands prefixed with
195 \family typewriter
195 \family typewriter
196 %
196 %
197 \family default
197 \family default
198 is available for controlling IPython itself and provides directory control,
198 is available for controlling IPython itself and provides directory control,
199 namespace information and many aliases to common system shell commands.
199 namespace information and many aliases to common system shell commands.
200 \layout Itemize
200 \layout Itemize
201
201
202 Alias facility for defining your own system aliases.
202 Alias facility for defining your own system aliases.
203 \layout Itemize
203 \layout Itemize
204
204
205 Complete system shell access.
205 Complete system shell access.
206 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
207 !! captures shell output into python variables for further use.
207 !! captures shell output into python variables for further use.
208 \layout Itemize
208 \layout Itemize
209
209
210 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
211 automatically stored as strings, and also available as lists.
211 automatically stored as strings, and also available as lists.
212 \layout Itemize
212 \layout Itemize
213
213
214 Background execution of Python commands in a separate thread.
214 Background execution of Python commands in a separate thread.
215 IPython has an internal job manager called
215 IPython has an internal job manager called
216 \family typewriter
216 \family typewriter
217 jobs
217 jobs
218 \family default
218 \family default
219 , and a conveninence backgrounding magic function called
219 , and a conveninence backgrounding magic function called
220 \family typewriter
220 \family typewriter
221 %bg
221 %bg
222 \family default
222 \family default
223 .
223 .
224 \layout Itemize
224 \layout Itemize
225
225
226 The ability to expand python variables when calling the system shell.
226 The ability to expand python variables when calling the system shell.
227 In a shell command, any python variable prefixed with
227 In a shell command, any python variable prefixed with
228 \family typewriter
228 \family typewriter
229 $
229 $
230 \family default
230 \family default
231 is expanded.
231 is expanded.
232 A double
232 A double
233 \family typewriter
233 \family typewriter
234 $$
234 $$
235 \family default
235 \family default
236 allows passing a literal
236 allows passing a literal
237 \family typewriter
237 \family typewriter
238 $
238 $
239 \family default
239 \family default
240 to the shell (for access to shell and environment variables like
240 to the shell (for access to shell and environment variables like
241 \family typewriter
241 \family typewriter
242 $PATH
242 $PATH
243 \family default
243 \family default
244 ).
244 ).
245 \layout Itemize
245 \layout Itemize
246
246
247 Filesystem navigation, via a magic
247 Filesystem navigation, via a magic
248 \family typewriter
248 \family typewriter
249 %cd
249 %cd
250 \family default
250 \family default
251 command, along with a persistent bookmark system (using
251 command, along with a persistent bookmark system (using
252 \family typewriter
252 \family typewriter
253 %bookmark
253 %bookmark
254 \family default
254 \family default
255 ) for fast access to frequently visited directories.
255 ) for fast access to frequently visited directories.
256 \layout Itemize
256 \layout Itemize
257
257
258 Automatic indentation (optional) of code as you type (through the readline
258 Automatic indentation (optional) of code as you type (through the readline
259 library).
259 library).
260 \layout Itemize
260 \layout Itemize
261
261
262 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
263 a single name.
263 a single name.
264 \layout Itemize
264 \layout Itemize
265
265
266 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).
267 \layout Itemize
267 \layout Itemize
268
268
269 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
270 the state where you left it.
270 the state where you left it.
271 \layout Itemize
271 \layout Itemize
272
272
273 Verbose and colored exception traceback printouts.
273 Verbose and colored exception traceback printouts.
274 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
275 debugging information (basically a terminal version of the cgitb module).
275 debugging information (basically a terminal version of the cgitb module).
276 \layout Itemize
276 \layout Itemize
277
277
278 Auto-parentheses: callable objects can be executed without parentheses:
278 Auto-parentheses: callable objects can be executed without parentheses:
279
279
280 \family typewriter
280 \family typewriter
281 `sin 3'
281 `sin 3'
282 \family default
282 \family default
283 is automatically converted to
283 is automatically converted to
284 \family typewriter
284 \family typewriter
285 `sin(3)
285 `sin(3)
286 \family default
286 \family default
287 '.
287 '.
288 \layout Itemize
288 \layout Itemize
289
289
290 Auto-quoting: using `
290 Auto-quoting: using `
291 \family typewriter
291 \family typewriter
292 ,
292 ,
293 \family default
293 \family default
294 ' or `
294 ' or `
295 \family typewriter
295 \family typewriter
296 ;
296 ;
297 \family default
297 \family default
298 ' 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:
299 \family typewriter
299 \family typewriter
300 `,my_function a\SpecialChar ~
300 `,my_function a\SpecialChar ~
301 b'
301 b'
302 \family default
302 \family default
303 becomes automatically
303 becomes automatically
304 \family typewriter
304 \family typewriter
305 `my_function("a","b")'
305 `my_function("a","b")'
306 \family default
306 \family default
307 , while
307 , while
308 \family typewriter
308 \family typewriter
309 `;my_function a\SpecialChar ~
309 `;my_function a\SpecialChar ~
310 b'
310 b'
311 \family default
311 \family default
312 becomes
312 becomes
313 \family typewriter
313 \family typewriter
314 `my_function("a b")'
314 `my_function("a b")'
315 \family default
315 \family default
316 .
316 .
317 \layout Itemize
317 \layout Itemize
318
318
319 Extensible input syntax.
319 Extensible input syntax.
320 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
321 special situations.
321 special situations.
322 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
323
323
324 \family typewriter
324 \family typewriter
325 `>>>'
325 `>>>'
326 \family default
326 \family default
327 or
327 or
328 \family typewriter
328 \family typewriter
329 `...'
329 `...'
330 \family default
330 \family default
331 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.
332 \layout Itemize
332 \layout Itemize
333
333
334 Flexible configuration system.
334 Flexible configuration system.
335 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
336 options, module loading, code and file execution.
336 options, module loading, code and file execution.
337 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
338 with defaults and layers which load other customizations for particular
338 with defaults and layers which load other customizations for particular
339 projects.
339 projects.
340 \layout Itemize
340 \layout Itemize
341
341
342 Embeddable.
342 Embeddable.
343 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.
344 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
345 to your programs with knowledge about the local namespaces (very useful
345 to your programs with knowledge about the local namespaces (very useful
346 in debugging and data analysis situations).
346 in debugging and data analysis situations).
347 \layout Itemize
347 \layout Itemize
348
348
349 Easy debugger access.
349 Easy debugger access.
350 You can set IPython to call up an enhanced version of the Python debugger
350 You can set IPython to call up an enhanced version of the Python debugger
351 (
351 (
352 \family typewriter
352 \family typewriter
353 pdb
353 pdb
354 \family default
354 \family default
355 ) every time there is an uncaught exception.
355 ) every time there is an uncaught exception.
356 This drops you inside the code which triggered the exception with all the
356 This drops you inside the code which triggered the exception with all the
357 data live and it is possible to navigate the stack to rapidly isolate the
357 data live and it is possible to navigate the stack to rapidly isolate the
358 source of a bug.
358 source of a bug.
359 The
359 The
360 \family typewriter
360 \family typewriter
361 %run
361 %run
362 \family default
362 \family default
363 magic command --with the
363 magic command --with the
364 \family typewriter
364 \family typewriter
365 -d
365 -d
366 \family default
366 \family default
367 option-- can run any script under
367 option-- can run any script under
368 \family typewriter
368 \family typewriter
369 pdb
369 pdb
370 \family default
370 \family default
371 's control, automatically setting initial breakpoints for you.
371 's control, automatically setting initial breakpoints for you.
372 This version of
372 This version of
373 \family typewriter
373 \family typewriter
374 pdb
374 pdb
375 \family default
375 \family default
376 has IPython-specific improvements, including tab-completion and traceback
376 has IPython-specific improvements, including tab-completion and traceback
377 coloring support.
377 coloring support.
378 \layout Itemize
378 \layout Itemize
379
379
380 Profiler support.
380 Profiler support.
381 You can run single statements (similar to
381 You can run single statements (similar to
382 \family typewriter
382 \family typewriter
383 profile.run()
383 profile.run()
384 \family default
384 \family default
385 ) or complete programs under the profiler's control.
385 ) or complete programs under the profiler's control.
386 While this is possible with the standard
386 While this is possible with the standard
387 \family typewriter
387 \family typewriter
388 profile
388 profile
389 \family default
389 \family default
390 module, IPython wraps this functionality with magic commands (see
390 module, IPython wraps this functionality with magic commands (see
391 \family typewriter
391 \family typewriter
392 `%prun'
392 `%prun'
393 \family default
393 \family default
394 and
394 and
395 \family typewriter
395 \family typewriter
396 `%run -p
396 `%run -p
397 \family default
397 \family default
398 ') convenient for rapid interactive work.
398 ') convenient for rapid interactive work.
399 \layout Subsection
399 \layout Subsection
400
400
401 Portability and Python requirements
401 Portability and Python requirements
402 \layout Standard
402 \layout Standard
403
403
404
404
405 \series bold
405 \series bold
406 Python requirements:
406 Python requirements:
407 \series default
407 \series default
408 IPython works with Python version 2.2 or newer.
408 IPython works with Python version 2.2 or newer.
409 It has been tested with Python 2.4 and no problems have been reported.
409 It has been tested with Python 2.4 and no problems have been reported.
410 Support for Python 2.1 hasn't been recently tested, since I don't have access
410 Support for Python 2.1 hasn't been recently tested, since I don't have access
411 to it on any of my systems.
411 to it on any of my systems.
412 But I suspect there may be some problems with Python 2.1, because some of
412 But I suspect there may be some problems with Python 2.1, because some of
413 the newer code may use 2.2 features.
413 the newer code may use 2.2 features.
414 \layout Standard
414 \layout Standard
415
415
416 IPython is developed under
416 IPython is developed under
417 \series bold
417 \series bold
418 Linux
418 Linux
419 \series default
419 \series default
420 , but it should work in any reasonable Unix-type system (tested OK under
420 , but it should work in any reasonable Unix-type system (tested OK under
421 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
421 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
422 \layout Standard
422 \layout Standard
423
423
424
424
425 \series bold
425 \series bold
426 Mac OS X
426 Mac OS X
427 \series default
427 \series default
428 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
428 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
429 Livermore for the information).
429 Livermore for the information).
430 Thanks to Andrea Riciputi, Fink support is available.
430 Thanks to Andrea Riciputi, Fink support is available.
431 \layout Standard
431 \layout Standard
432
432
433
433
434 \series bold
434 \series bold
435 CygWin
435 CygWin
436 \series default
436 \series default
437 : it works mostly OK, though some users have reported problems with prompt
437 : it works mostly OK, though some users have reported problems with prompt
438 coloring.
438 coloring.
439 No satisfactory solution to this has been found so far, you may want to
439 No satisfactory solution to this has been found so far, you may want to
440 disable colors permanently in the
440 disable colors permanently in the
441 \family typewriter
441 \family typewriter
442 ipythonrc
442 ipythonrc
443 \family default
443 \family default
444 configuration file if you experience problems.
444 configuration file if you experience problems.
445 If you have proper color support under cygwin, please post to the IPython
445 If you have proper color support under cygwin, please post to the IPython
446 mailing list so this issue can be resolved for all users.
446 mailing list so this issue can be resolved for all users.
447 \layout Standard
447 \layout Standard
448
448
449
449
450 \series bold
450 \series bold
451 Windows
451 Windows
452 \series default
452 \series default
453 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
453 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
454 Section\SpecialChar ~
454 Section\SpecialChar ~
455
455
456 \begin_inset LatexCommand \ref{sub:Under-Windows}
456 \begin_inset LatexCommand \ref{sub:Under-Windows}
457
457
458 \end_inset
458 \end_inset
459
459
460 describes installation details for Windows, including some additional tools
460 describes installation details for Windows, including some additional tools
461 needed on this platform.
461 needed on this platform.
462 \layout Standard
462 \layout Standard
463
463
464 Windows 9x support is present, and has been reported to work fine (at least
464 Windows 9x support is present, and has been reported to work fine (at least
465 on WinME).
465 on WinME).
466 \layout Standard
466 \layout Standard
467
467
468 Please note, however, that I have very little access to and experience with
468 Please note, however, that I have very little access to and experience with
469 Windows development.
469 Windows development.
470 For this reason, Windows-specific bugs tend to linger far longer than I
470 For this reason, Windows-specific bugs tend to linger far longer than I
471 would like, and often I just can't find a satisfactory solution.
471 would like, and often I just can't find a satisfactory solution.
472 If any Windows user wants to join in with development help, all hands are
472 If any Windows user wants to join in with development help, all hands are
473 always welcome.
473 always welcome.
474 \layout Subsection
474 \layout Subsection
475
475
476 Location
476 Location
477 \layout Standard
477 \layout Standard
478
478
479 IPython is generously hosted at
479 IPython is generously hosted at
480 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
480 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
481
481
482 \end_inset
482 \end_inset
483
483
484 by the SciPy project.
484 by the SciPy project.
485 This site offers downloads, subversion access, mailing lists and a bug
485 This site offers downloads, subversion access, mailing lists and a bug
486 tracking system.
486 tracking system.
487 I am very grateful to Enthought (
487 I am very grateful to Enthought (
488 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
488 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
489
489
490 \end_inset
490 \end_inset
491
491
492 ) and all of the SciPy team for their contribution.
492 ) and all of the SciPy team for their contribution.
493 \layout Section
493 \layout Section
494
494
495
495
496 \begin_inset LatexCommand \label{sec:install}
496 \begin_inset LatexCommand \label{sec:install}
497
497
498 \end_inset
498 \end_inset
499
499
500 Installation
500 Installation
501 \layout Subsection
501 \layout Subsection
502
502
503 Instant instructions
503 Instant instructions
504 \layout Standard
504 \layout Standard
505
505
506 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
506 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
507 download, then install with
507 download, then install with
508 \family typewriter
508 \family typewriter
509 `python setup.py install'
509 `python setup.py install'
510 \family default
510 \family default
511 .
511 .
512 Under Windows, double-click on the provided
512 Under Windows, double-click on the provided
513 \family typewriter
513 \family typewriter
514 .exe
514 .exe
515 \family default
515 \family default
516 binary installer.
516 binary installer.
517 \layout Standard
517 \layout Standard
518
518
519 Then, take a look at Sections
519 Then, take a look at Sections
520 \begin_inset LatexCommand \ref{sec:good_config}
520 \begin_inset LatexCommand \ref{sec:good_config}
521
521
522 \end_inset
522 \end_inset
523
523
524 for configuring things optimally and
524 for configuring things optimally and
525 \begin_inset LatexCommand \ref{sec:quick_tips}
525 \begin_inset LatexCommand \ref{sec:quick_tips}
526
526
527 \end_inset
527 \end_inset
528
528
529 for quick tips on efficient use of IPython.
529 for quick tips on efficient use of IPython.
530 You can later refer to the rest of the manual for all the gory details.
530 You can later refer to the rest of the manual for all the gory details.
531 \layout Standard
531 \layout Standard
532
532
533 See the notes in sec.
533 See the notes in sec.
534
534
535 \begin_inset LatexCommand \ref{sec:upgrade}
535 \begin_inset LatexCommand \ref{sec:upgrade}
536
536
537 \end_inset
537 \end_inset
538
538
539 for upgrading IPython versions.
539 for upgrading IPython versions.
540 \layout Subsection
540 \layout Subsection
541
541
542 Detailed Unix instructions (Linux, Mac OS X, etc.)
542 Detailed Unix instructions (Linux, Mac OS X, etc.)
543 \layout Standard
543 \layout Standard
544
544
545 For RPM based systems, simply install the supplied package in the usual
545 For RPM based systems, simply install the supplied package in the usual
546 manner.
546 manner.
547 If you download the tar archive, the process is:
547 If you download the tar archive, the process is:
548 \layout Enumerate
548 \layout Enumerate
549
549
550 Unzip/untar the
550 Unzip/untar the
551 \family typewriter
551 \family typewriter
552 ipython-XXX.tar.gz
552 ipython-XXX.tar.gz
553 \family default
553 \family default
554 file wherever you want (
554 file wherever you want (
555 \family typewriter
555 \family typewriter
556 XXX
556 XXX
557 \family default
557 \family default
558 is the version number).
558 is the version number).
559 It will make a directory called
559 It will make a directory called
560 \family typewriter
560 \family typewriter
561 ipython-XXX.
561 ipython-XXX.
562
562
563 \family default
563 \family default
564 Change into that directory where you will find the files
564 Change into that directory where you will find the files
565 \family typewriter
565 \family typewriter
566 README
566 README
567 \family default
567 \family default
568 and
568 and
569 \family typewriter
569 \family typewriter
570 setup.py
570 setup.py
571 \family default
571 \family default
572 .
572 .
573
573
574 \family typewriter
574 \family typewriter
575 O
575 O
576 \family default
576 \family default
577 nce you've completed the installation, you can safely remove this directory.
577 nce you've completed the installation, you can safely remove this directory.
578
578
579 \layout Enumerate
579 \layout Enumerate
580
580
581 If you are installing over a previous installation of version 0.2.0 or earlier,
581 If you are installing over a previous installation of version 0.2.0 or earlier,
582 first remove your
582 first remove your
583 \family typewriter
583 \family typewriter
584 $HOME/.ipython
584 $HOME/.ipython
585 \family default
585 \family default
586 directory, since the configuration file format has changed somewhat (the
586 directory, since the configuration file format has changed somewhat (the
587 '=' were removed from all option specifications).
587 '=' were removed from all option specifications).
588 Or you can call ipython with the
588 Or you can call ipython with the
589 \family typewriter
589 \family typewriter
590 -upgrade
590 -upgrade
591 \family default
591 \family default
592 option and it will do this automatically for you.
592 option and it will do this automatically for you.
593 \layout Enumerate
593 \layout Enumerate
594
594
595 IPython uses distutils, so you can install it by simply typing at the system
595 IPython uses distutils, so you can install it by simply typing at the system
596 prompt (don't type the
596 prompt (don't type the
597 \family typewriter
597 \family typewriter
598 $
598 $
599 \family default
599 \family default
600 )
600 )
601 \newline
601 \newline
602
602
603 \family typewriter
603 \family typewriter
604 $ python setup.py install
604 $ python setup.py install
605 \family default
605 \family default
606
606
607 \newline
607 \newline
608 Note that this assumes you have root access to your machine.
608 Note that this assumes you have root access to your machine.
609 If you don't have root access or don't want IPython to go in the default
609 If you don't have root access or don't want IPython to go in the default
610 python directories, you'll need to use the
610 python directories, you'll need to use the
611 \begin_inset ERT
611 \begin_inset ERT
612 status Collapsed
612 status Collapsed
613
613
614 \layout Standard
614 \layout Standard
615
615
616 \backslash
616 \backslash
617 verb|--home|
617 verb|--home|
618 \end_inset
618 \end_inset
619
619
620 option (or
620 option (or
621 \begin_inset ERT
621 \begin_inset ERT
622 status Collapsed
622 status Collapsed
623
623
624 \layout Standard
624 \layout Standard
625
625
626 \backslash
626 \backslash
627 verb|--prefix|
627 verb|--prefix|
628 \end_inset
628 \end_inset
629
629
630 ).
630 ).
631 For example:
631 For example:
632 \newline
632 \newline
633
633
634 \begin_inset ERT
634 \begin_inset ERT
635 status Collapsed
635 status Collapsed
636
636
637 \layout Standard
637 \layout Standard
638
638
639 \backslash
639 \backslash
640 verb|$ python setup.py install --home $HOME/local|
640 verb|$ python setup.py install --home $HOME/local|
641 \end_inset
641 \end_inset
642
642
643
643
644 \newline
644 \newline
645 will install IPython into
645 will install IPython into
646 \family typewriter
646 \family typewriter
647 $HOME/local
647 $HOME/local
648 \family default
648 \family default
649 and its subdirectories (creating them if necessary).
649 and its subdirectories (creating them if necessary).
650 \newline
650 \newline
651 You can type
651 You can type
652 \newline
652 \newline
653
653
654 \begin_inset ERT
654 \begin_inset ERT
655 status Collapsed
655 status Collapsed
656
656
657 \layout Standard
657 \layout Standard
658
658
659 \backslash
659 \backslash
660 verb|$ python setup.py --help|
660 verb|$ python setup.py --help|
661 \end_inset
661 \end_inset
662
662
663
663
664 \newline
664 \newline
665 for more details.
665 for more details.
666 \newline
666 \newline
667 Note that if you change the default location for
667 Note that if you change the default location for
668 \begin_inset ERT
668 \begin_inset ERT
669 status Collapsed
669 status Collapsed
670
670
671 \layout Standard
671 \layout Standard
672
672
673 \backslash
673 \backslash
674 verb|--home|
674 verb|--home|
675 \end_inset
675 \end_inset
676
676
677 at installation, IPython may end up installed at a location which is not
677 at installation, IPython may end up installed at a location which is not
678 part of your
678 part of your
679 \family typewriter
679 \family typewriter
680 $PYTHONPATH
680 $PYTHONPATH
681 \family default
681 \family default
682 environment variable.
682 environment variable.
683 In this case, you'll need to configure this variable to include the actual
683 In this case, you'll need to configure this variable to include the actual
684 directory where the
684 directory where the
685 \family typewriter
685 \family typewriter
686 IPython/
686 IPython/
687 \family default
687 \family default
688 directory ended (typically the value you give to
688 directory ended (typically the value you give to
689 \begin_inset ERT
689 \begin_inset ERT
690 status Collapsed
690 status Collapsed
691
691
692 \layout Standard
692 \layout Standard
693
693
694 \backslash
694 \backslash
695 verb|--home|
695 verb|--home|
696 \end_inset
696 \end_inset
697
697
698 plus
698 plus
699 \family typewriter
699 \family typewriter
700 /lib/python
700 /lib/python
701 \family default
701 \family default
702 ).
702 ).
703 \layout Subsubsection
703 \layout Subsubsection
704
704
705 Mac OSX information
705 Mac OSX information
706 \layout Standard
706 \layout Standard
707
707
708 Under OSX, there is a choice you need to make.
708 Under OSX, there is a choice you need to make.
709 Apple ships its own build of Python, which lives in the core OSX filesystem
709 Apple ships its own build of Python, which lives in the core OSX filesystem
710 hierarchy.
710 hierarchy.
711 You can also manually install a separate Python, either purely by hand
711 You can also manually install a separate Python, either purely by hand
712 (typically in
712 (typically in
713 \family typewriter
713 \family typewriter
714 /usr/local
714 /usr/local
715 \family default
715 \family default
716 ) or by using Fink, which puts everything under
716 ) or by using Fink, which puts everything under
717 \family typewriter
717 \family typewriter
718 /sw
718 /sw
719 \family default
719 \family default
720 .
720 .
721 Which route to follow is a matter of personal preference, as I've seen
721 Which route to follow is a matter of personal preference, as I've seen
722 users who favor each of the approaches.
722 users who favor each of the approaches.
723 Here I will simply list the known installation issues under OSX, along
723 Here I will simply list the known installation issues under OSX, along
724 with their solutions.
724 with their solutions.
725 \layout Standard
725 \layout Standard
726
726
727 This page:
727 This page:
728 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
728 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
729
729
730 \end_inset
730 \end_inset
731
731
732 contains information on this topic, with additional details on how to make
732 contains information on this topic, with additional details on how to make
733 IPython and matplotlib play nicely under OSX.
733 IPython and matplotlib play nicely under OSX.
734 \layout Subsubsection*
734 \layout Subsubsection*
735
735
736 GUI problems
736 GUI problems
737 \layout Standard
737 \layout Standard
738
738
739 The following instructions apply to an install of IPython under OSX from
739 The following instructions apply to an install of IPython under OSX from
740 unpacking the
740 unpacking the
741 \family typewriter
741 \family typewriter
742 .tar.gz
742 .tar.gz
743 \family default
743 \family default
744 distribution and installing it for the default Python interpreter shipped
744 distribution and installing it for the default Python interpreter shipped
745 by Apple.
745 by Apple.
746 If you are using a fink install, fink will take care of these details for
746 If you are using a fink install, fink will take care of these details for
747 you, by installing IPython against fink's Python.
747 you, by installing IPython against fink's Python.
748 \layout Standard
748 \layout Standard
749
749
750 IPython offers various forms of support for interacting with graphical applicati
750 IPython offers various forms of support for interacting with graphical applicati
751 ons from the command line, from simple Tk apps (which are in principle always
751 ons from the command line, from simple Tk apps (which are in principle always
752 supported by Python) to interactive control of WX, Qt and GTK apps.
752 supported by Python) to interactive control of WX, Qt and GTK apps.
753 Under OSX, however, this requires that ipython is installed by calling
753 Under OSX, however, this requires that ipython is installed by calling
754 the special
754 the special
755 \family typewriter
755 \family typewriter
756 pythonw
756 pythonw
757 \family default
757 \family default
758 script at installation time, which takes care of coordinating things with
758 script at installation time, which takes care of coordinating things with
759 Apple's graphical environment.
759 Apple's graphical environment.
760 \layout Standard
760 \layout Standard
761
761
762 So when installing under OSX, it is best to use the following command:
762 So when installing under OSX, it is best to use the following command:
763 \family typewriter
763 \family typewriter
764
764
765 \newline
765 \newline
766
766
767 \family default
767 \family default
768
768
769 \begin_inset ERT
769 \begin_inset ERT
770 status Collapsed
770 status Collapsed
771
771
772 \layout Standard
772 \layout Standard
773
773
774 \backslash
774 \backslash
775 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
775 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
776 \end_inset
776 \end_inset
777
777
778
778
779 \newline
779 \newline
780 or
780 or
781 \newline
781 \newline
782
782
783 \begin_inset ERT
783 \begin_inset ERT
784 status Open
784 status Open
785
785
786 \layout Standard
786 \layout Standard
787
787
788 \backslash
788 \backslash
789 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
789 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
790 \end_inset
790 \end_inset
791
791
792
792
793 \newline
793 \newline
794 depending on where you like to keep hand-installed executables.
794 depending on where you like to keep hand-installed executables.
795 \layout Standard
795 \layout Standard
796
796
797 The resulting script will have an appropriate shebang line (the first line
797 The resulting script will have an appropriate shebang line (the first line
798 in the script whic begins with
798 in the script whic begins with
799 \family typewriter
799 \family typewriter
800 #!...
800 #!...
801 \family default
801 \family default
802 ) such that the ipython interpreter can interact with the OS X GUI.
802 ) such that the ipython interpreter can interact with the OS X GUI.
803 If the installed version does not work and has a shebang line that points
803 If the installed version does not work and has a shebang line that points
804 to, for example, just
804 to, for example, just
805 \family typewriter
805 \family typewriter
806 /usr/bin/python
806 /usr/bin/python
807 \family default
807 \family default
808 , then you might have a stale, cached version in your
808 , then you might have a stale, cached version in your
809 \family typewriter
809 \family typewriter
810 build/scripts-<python-version>
810 build/scripts-<python-version>
811 \family default
811 \family default
812 directory.
812 directory.
813 Delete that directory and rerun the
813 Delete that directory and rerun the
814 \family typewriter
814 \family typewriter
815 setup.py
815 setup.py
816 \family default
816 \family default
817 .
817 .
818
818
819 \layout Standard
819 \layout Standard
820
820
821 It is also a good idea to use the special flag
821 It is also a good idea to use the special flag
822 \begin_inset ERT
822 \begin_inset ERT
823 status Collapsed
823 status Collapsed
824
824
825 \layout Standard
825 \layout Standard
826
826
827 \backslash
827 \backslash
828 verb|--install-scripts|
828 verb|--install-scripts|
829 \end_inset
829 \end_inset
830
830
831 as indicated above, to ensure that the ipython scripts end up in a location
831 as indicated above, to ensure that the ipython scripts end up in a location
832 which is part of your
832 which is part of your
833 \family typewriter
833 \family typewriter
834 $PATH
834 $PATH
835 \family default
835 \family default
836 .
836 .
837 Otherwise Apple's Python will put the scripts in an internal directory
837 Otherwise Apple's Python will put the scripts in an internal directory
838 not available by default at the command line (if you use
838 not available by default at the command line (if you use
839 \family typewriter
839 \family typewriter
840 /usr/local/bin
840 /usr/local/bin
841 \family default
841 \family default
842 , you need to make sure this is in your
842 , you need to make sure this is in your
843 \family typewriter
843 \family typewriter
844 $PATH
844 $PATH
845 \family default
845 \family default
846 , which may not be true by default).
846 , which may not be true by default).
847 \layout Subsubsection*
847 \layout Subsubsection*
848
848
849 Readline problems
849 Readline problems
850 \layout Standard
850 \layout Standard
851
851
852 By default, the Python version shipped by Apple does
852 By default, the Python version shipped by Apple does
853 \emph on
853 \emph on
854 not
854 not
855 \emph default
855 \emph default
856 include the readline library, so central to IPython's behavior.
856 include the readline library, so central to IPython's behavior.
857 If you install IPython against Apple's Python, you will not have arrow
857 If you install IPython against Apple's Python, you will not have arrow
858 keys, tab completion, etc.
858 keys, tab completion, etc.
859 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
859 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
860 \newline
860 \newline
861
861
862 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
862 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
863
863
864 \end_inset
864 \end_inset
865
865
866
866
867 \layout Standard
867 \layout Standard
868
868
869 If you are using OSX 10.4 (Tiger), after installing this package you need
869 If you are using OSX 10.4 (Tiger), after installing this package you need
870 to either:
870 to either:
871 \layout Enumerate
871 \layout Enumerate
872
872
873 move
873 move
874 \family typewriter
874 \family typewriter
875 readline.so
875 readline.so
876 \family default
876 \family default
877 from
877 from
878 \family typewriter
878 \family typewriter
879 /Library/Python/2.3
879 /Library/Python/2.3
880 \family default
880 \family default
881 to
881 to
882 \family typewriter
882 \family typewriter
883 /Library/Python/2.3/site-packages
883 /Library/Python/2.3/site-packages
884 \family default
884 \family default
885 , or
885 , or
886 \layout Enumerate
886 \layout Enumerate
887
887
888 install
888 install
889 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
889 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
890
890
891 \end_inset
891 \end_inset
892
892
893
893
894 \layout Standard
894 \layout Standard
895
895
896 Users installing against Fink's Python or a properly hand-built one should
896 Users installing against Fink's Python or a properly hand-built one should
897 not have this problem.
897 not have this problem.
898 \layout Subsubsection*
898 \layout Subsubsection*
899
899
900 DarwinPorts
900 DarwinPorts
901 \layout Standard
901 \layout Standard
902
902
903 I report here a message from an OSX user, who suggests an alternative means
903 I report here a message from an OSX user, who suggests an alternative means
904 of using IPython under this operating system with good results.
904 of using IPython under this operating system with good results.
905 Please let me know of any updates that may be useful for this section.
905 Please let me know of any updates that may be useful for this section.
906 His message is reproduced verbatim below:
906 His message is reproduced verbatim below:
907 \layout Quote
907 \layout Quote
908
908
909 From: Markus Banfi
909 From: Markus Banfi
910 \family typewriter
910 \family typewriter
911 <markus.banfi-AT-mospheira.net>
911 <markus.banfi-AT-mospheira.net>
912 \layout Quote
912 \layout Quote
913
913
914 As a MacOS X (10.4.2) user I prefer to install software using DawinPorts instead
914 As a MacOS X (10.4.2) user I prefer to install software using DawinPorts instead
915 of Fink.
915 of Fink.
916 I had no problems installing ipython with DarwinPorts.
916 I had no problems installing ipython with DarwinPorts.
917 It's just:
917 It's just:
918 \layout Quote
918 \layout Quote
919
919
920
920
921 \family typewriter
921 \family typewriter
922 sudo port install py-ipython
922 sudo port install py-ipython
923 \layout Quote
923 \layout Quote
924
924
925 It automatically resolved all dependencies (python24, readline, py-readline).
925 It automatically resolved all dependencies (python24, readline, py-readline).
926 So far I did not encounter any problems with the DarwinPorts port of ipython.
926 So far I did not encounter any problems with the DarwinPorts port of ipython.
927
927
928 \layout Subsection
928 \layout Subsection
929
929
930
930
931 \begin_inset LatexCommand \label{sub:Under-Windows}
931 \begin_inset LatexCommand \label{sub:Under-Windows}
932
932
933 \end_inset
933 \end_inset
934
934
935 Windows instructions
935 Windows instructions
936 \layout Standard
936 \layout Standard
937
937
938 Some of IPython's very useful features are:
938 Some of IPython's very useful features are:
939 \layout Itemize
939 \layout Itemize
940
940
941 Integrated readline support (Tab-based file, object and attribute completion,
941 Integrated readline support (Tab-based file, object and attribute completion,
942 input history across sessions, editable command line, etc.)
942 input history across sessions, editable command line, etc.)
943 \layout Itemize
943 \layout Itemize
944
944
945 Coloring of prompts, code and tracebacks.
945 Coloring of prompts, code and tracebacks.
946 \layout Standard
946 \layout Standard
947
947
948 These, by default, are only available under Unix-like operating systems.
948 These, by default, are only available under Unix-like operating systems.
949 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
949 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
950 from them.
950 from them.
951 His readline library implements both GNU readline functionality and color
951 His readline library implements both GNU readline functionality and color
952 support, so that IPython under Windows XP/2k can be as friendly and powerful
952 support, so that IPython under Windows XP/2k can be as friendly and powerful
953 as under Unix-like environments.
953 as under Unix-like environments.
954 \layout Standard
954 \layout Standard
955
955
956 The
956 The
957 \family typewriter
957 \family typewriter
958 readline
958 readline
959 \family default
959 \family default
960 extension needs two other libraries to work, so in all you need:
960 extension needs two other libraries to work, so in all you need:
961 \layout Enumerate
961 \layout Enumerate
962
962
963
963
964 \family typewriter
964 \family typewriter
965 PyWin32
965 PyWin32
966 \family default
966 \family default
967 from
967 from
968 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
968 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
969
969
970 \end_inset
970 \end_inset
971
971
972 .
972 .
973 \layout Enumerate
973 \layout Enumerate
974
974
975
975
976 \family typewriter
976 \family typewriter
977 CTypes
977 CTypes
978 \family default
978 \family default
979 from
979 from
980 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
980 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
981
981
982 \end_inset
982 \end_inset
983
983
984 (you
984 (you
985 \emph on
985 \emph on
986 must
986 must
987 \emph default
987 \emph default
988 use version 0.9.1 or newer).
988 use version 0.9.1 or newer).
989 \layout Enumerate
989 \layout Enumerate
990
990
991
991
992 \family typewriter
992 \family typewriter
993 Readline
993 Readline
994 \family default
994 \family default
995 for Windows from
995 for Windows from
996 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
996 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
997
997
998 \end_inset
998 \end_inset
999
999
1000 .
1000 .
1001 \layout Standard
1001 \layout Standard
1002
1002
1003
1003
1004 \series bold
1004 \series bold
1005 Warning about a broken readline-like library:
1005 Warning about a broken readline-like library:
1006 \series default
1006 \series default
1007 several users have reported problems stemming from using the pseudo-readline
1007 several users have reported problems stemming from using the pseudo-readline
1008 library at
1008 library at
1009 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
1009 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
1010
1010
1011 \end_inset
1011 \end_inset
1012
1012
1013 .
1013 .
1014 This is a broken library which, while called readline, only implements
1014 This is a broken library which, while called readline, only implements
1015 an incomplete subset of the readline API.
1015 an incomplete subset of the readline API.
1016 Since it is still called readline, it fools IPython's detection mechanisms
1016 Since it is still called readline, it fools IPython's detection mechanisms
1017 and causes unpredictable crashes later.
1017 and causes unpredictable crashes later.
1018 If you wish to use IPython under Windows, you must NOT use this library,
1018 If you wish to use IPython under Windows, you must NOT use this library,
1019 which for all purposes is (at least as of version 1.6) terminally broken.
1019 which for all purposes is (at least as of version 1.6) terminally broken.
1020 \layout Subsubsection
1020 \layout Subsubsection
1021
1021
1022 Installation procedure
1022 Installation procedure
1023 \layout Standard
1023 \layout Standard
1024
1024
1025 Once you have the above installed, from the IPython download directory grab
1025 Once you have the above installed, from the IPython download directory grab
1026 the
1026 the
1027 \family typewriter
1027 \family typewriter
1028 ipython-XXX.win32.exe
1028 ipython-XXX.win32.exe
1029 \family default
1029 \family default
1030 file, where
1030 file, where
1031 \family typewriter
1031 \family typewriter
1032 XXX
1032 XXX
1033 \family default
1033 \family default
1034 represents the version number.
1034 represents the version number.
1035 This is a regular windows executable installer, which you can simply double-cli
1035 This is a regular windows executable installer, which you can simply double-cli
1036 ck to install.
1036 ck to install.
1037 It will add an entry for IPython to your Start Menu, as well as registering
1037 It will add an entry for IPython to your Start Menu, as well as registering
1038 IPython in the Windows list of applications, so you can later uninstall
1038 IPython in the Windows list of applications, so you can later uninstall
1039 it from the Control Panel.
1039 it from the Control Panel.
1040
1040
1041 \layout Standard
1041 \layout Standard
1042
1042
1043 IPython tries to install the configuration information in a directory named
1043 IPython tries to install the configuration information in a directory named
1044
1044
1045 \family typewriter
1045 \family typewriter
1046 .ipython
1046 .ipython
1047 \family default
1047 \family default
1048 (
1048 (
1049 \family typewriter
1049 \family typewriter
1050 _ipython
1050 _ipython
1051 \family default
1051 \family default
1052 under Windows) located in your `home' directory.
1052 under Windows) located in your `home' directory.
1053 IPython sets this directory by looking for a
1053 IPython sets this directory by looking for a
1054 \family typewriter
1054 \family typewriter
1055 HOME
1055 HOME
1056 \family default
1056 \family default
1057 environment variable; if such a variable does not exist, it uses
1057 environment variable; if such a variable does not exist, it uses
1058 \family typewriter
1058 \family typewriter
1059 HOMEDRIVE
1059 HOMEDRIVE
1060 \backslash
1060 \backslash
1061 HOMEPATH
1061 HOMEPATH
1062 \family default
1062 \family default
1063 (these are always defined by Windows).
1063 (these are always defined by Windows).
1064 This typically gives something like
1064 This typically gives something like
1065 \family typewriter
1065 \family typewriter
1066 C:
1066 C:
1067 \backslash
1067 \backslash
1068 Documents and Settings
1068 Documents and Settings
1069 \backslash
1069 \backslash
1070 YourUserName
1070 YourUserName
1071 \family default
1071 \family default
1072 , but your local details may vary.
1072 , but your local details may vary.
1073 In this directory you will find all the files that configure IPython's
1073 In this directory you will find all the files that configure IPython's
1074 defaults, and you can put there your profiles and extensions.
1074 defaults, and you can put there your profiles and extensions.
1075 This directory is automatically added by IPython to
1075 This directory is automatically added by IPython to
1076 \family typewriter
1076 \family typewriter
1077 sys.path
1077 sys.path
1078 \family default
1078 \family default
1079 , so anything you place there can be found by
1079 , so anything you place there can be found by
1080 \family typewriter
1080 \family typewriter
1081 import
1081 import
1082 \family default
1082 \family default
1083 statements.
1083 statements.
1084 \layout Paragraph
1084 \layout Paragraph
1085
1085
1086 Upgrading
1086 Upgrading
1087 \layout Standard
1087 \layout Standard
1088
1088
1089 For an IPython upgrade, you should first uninstall the previous version.
1089 For an IPython upgrade, you should first uninstall the previous version.
1090 This will ensure that all files and directories (such as the documentation)
1090 This will ensure that all files and directories (such as the documentation)
1091 which carry embedded version strings in their names are properly removed.
1091 which carry embedded version strings in their names are properly removed.
1092 \layout Paragraph
1092 \layout Paragraph
1093
1093
1094 Manual installation under Win32
1094 Manual installation under Win32
1095 \layout Standard
1095 \layout Standard
1096
1096
1097 In case the automatic installer does not work for some reason, you can download
1097 In case the automatic installer does not work for some reason, you can download
1098 the
1098 the
1099 \family typewriter
1099 \family typewriter
1100 ipython-XXX.tar.gz
1100 ipython-XXX.tar.gz
1101 \family default
1101 \family default
1102 file, which contains the full IPython source distribution (the popular
1102 file, which contains the full IPython source distribution (the popular
1103 WinZip can read
1103 WinZip can read
1104 \family typewriter
1104 \family typewriter
1105 .tar.gz
1105 .tar.gz
1106 \family default
1106 \family default
1107 files).
1107 files).
1108 After uncompressing the archive, you can install it at a command terminal
1108 After uncompressing the archive, you can install it at a command terminal
1109 just like any other Python module, by using
1109 just like any other Python module, by using
1110 \family typewriter
1110 \family typewriter
1111 `python setup.py install'
1111 `python setup.py install'
1112 \family default
1112 \family default
1113 .
1113 .
1114
1114
1115 \layout Standard
1115 \layout Standard
1116
1116
1117 After the installation, run the supplied
1117 After the installation, run the supplied
1118 \family typewriter
1118 \family typewriter
1119 win32_manual_post_install.py
1119 win32_manual_post_install.py
1120 \family default
1120 \family default
1121 script, which creates the necessary Start Menu shortcuts for you.
1121 script, which creates the necessary Start Menu shortcuts for you.
1122 \layout Subsection
1122 \layout Subsection
1123
1123
1124
1124
1125 \begin_inset LatexCommand \label{sec:upgrade}
1125 \begin_inset LatexCommand \label{sec:upgrade}
1126
1126
1127 \end_inset
1127 \end_inset
1128
1128
1129 Upgrading from a previous version
1129 Upgrading from a previous version
1130 \layout Standard
1130 \layout Standard
1131
1131
1132 If you are upgrading from a previous version of IPython, after doing the
1132 If you are upgrading from a previous version of IPython, after doing the
1133 routine installation described above, you should call IPython with the
1133 routine installation described above, you should call IPython with the
1134
1134
1135 \family typewriter
1135 \family typewriter
1136 -upgrade
1136 -upgrade
1137 \family default
1137 \family default
1138 option the first time you run your new copy.
1138 option the first time you run your new copy.
1139 This will automatically update your configuration directory while preserving
1139 This will automatically update your configuration directory while preserving
1140 copies of your old files.
1140 copies of your old files.
1141 You can then later merge back any personal customizations you may have
1141 You can then later merge back any personal customizations you may have
1142 made into the new files.
1142 made into the new files.
1143 It is a good idea to do this as there may be new options available in the
1143 It is a good idea to do this as there may be new options available in the
1144 new configuration files which you will not have.
1144 new configuration files which you will not have.
1145 \layout Standard
1145 \layout Standard
1146
1146
1147 Under Windows, if you don't know how to call python scripts with arguments
1147 Under Windows, if you don't know how to call python scripts with arguments
1148 from a command line, simply delete the old config directory and IPython
1148 from a command line, simply delete the old config directory and IPython
1149 will make a new one.
1149 will make a new one.
1150 Win2k and WinXP users will find it in
1150 Win2k and WinXP users will find it in
1151 \family typewriter
1151 \family typewriter
1152 C:
1152 C:
1153 \backslash
1153 \backslash
1154 Documents and Settings
1154 Documents and Settings
1155 \backslash
1155 \backslash
1156 YourUserName
1156 YourUserName
1157 \backslash
1157 \backslash
1158 _ipython
1158 _ipython
1159 \family default
1159 \family default
1160 , and Win 9x users under
1160 , and Win 9x users under
1161 \family typewriter
1161 \family typewriter
1162 C:
1162 C:
1163 \backslash
1163 \backslash
1164 Program Files
1164 Program Files
1165 \backslash
1165 \backslash
1166 IPython
1166 IPython
1167 \backslash
1167 \backslash
1168 _ipython.
1168 _ipython.
1169 \layout Section
1169 \layout Section
1170
1170
1171
1171
1172 \begin_inset LatexCommand \label{sec:good_config}
1172 \begin_inset LatexCommand \label{sec:good_config}
1173
1173
1174 \end_inset
1174 \end_inset
1175
1175
1176
1176
1177 \begin_inset OptArg
1177 \begin_inset OptArg
1178 collapsed true
1178 collapsed true
1179
1179
1180 \layout Standard
1180 \layout Standard
1181
1181
1182 Initial configuration
1182 Initial configuration
1183 \begin_inset ERT
1183 \begin_inset ERT
1184 status Collapsed
1184 status Collapsed
1185
1185
1186 \layout Standard
1186 \layout Standard
1187
1187
1188 \backslash
1188 \backslash
1189 ldots
1189 ldots
1190 \end_inset
1190 \end_inset
1191
1191
1192
1192
1193 \end_inset
1193 \end_inset
1194
1194
1195 Initial configuration of your environment
1195 Initial configuration of your environment
1196 \layout Standard
1196 \layout Standard
1197
1197
1198 This section will help you set various things in your environment for your
1198 This section will help you set various things in your environment for your
1199 IPython sessions to be as efficient as possible.
1199 IPython sessions to be as efficient as possible.
1200 All of IPython's configuration information, along with several example
1200 All of IPython's configuration information, along with several example
1201 files, is stored in a directory named by default
1201 files, is stored in a directory named by default
1202 \family typewriter
1202 \family typewriter
1203 $HOME/.ipython
1203 $HOME/.ipython
1204 \family default
1204 \family default
1205 .
1205 .
1206 You can change this by defining the environment variable
1206 You can change this by defining the environment variable
1207 \family typewriter
1207 \family typewriter
1208 IPYTHONDIR
1208 IPYTHONDIR
1209 \family default
1209 \family default
1210 , or at runtime with the command line option
1210 , or at runtime with the command line option
1211 \family typewriter
1211 \family typewriter
1212 -ipythondir
1212 -ipythondir
1213 \family default
1213 \family default
1214 .
1214 .
1215 \layout Standard
1215 \layout Standard
1216
1216
1217 If all goes well, the first time you run IPython it should automatically
1217 If all goes well, the first time you run IPython it should automatically
1218 create a user copy of the config directory for you, based on its builtin
1218 create a user copy of the config directory for you, based on its builtin
1219 defaults.
1219 defaults.
1220 You can look at the files it creates to learn more about configuring the
1220 You can look at the files it creates to learn more about configuring the
1221 system.
1221 system.
1222 The main file you will modify to configure IPython's behavior is called
1222 The main file you will modify to configure IPython's behavior is called
1223
1223
1224 \family typewriter
1224 \family typewriter
1225 ipythonrc
1225 ipythonrc
1226 \family default
1226 \family default
1227 (with a
1227 (with a
1228 \family typewriter
1228 \family typewriter
1229 .ini
1229 .ini
1230 \family default
1230 \family default
1231 extension under Windows), included for reference in Sec.
1231 extension under Windows), included for reference in Sec.
1232
1232
1233 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1233 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1234
1234
1235 \end_inset
1235 \end_inset
1236
1236
1237 .
1237 .
1238 This file is very commented and has many variables you can change to suit
1238 This file is very commented and has many variables you can change to suit
1239 your taste, you can find more details in Sec.
1239 your taste, you can find more details in Sec.
1240
1240
1241 \begin_inset LatexCommand \ref{sec:customization}
1241 \begin_inset LatexCommand \ref{sec:customization}
1242
1242
1243 \end_inset
1243 \end_inset
1244
1244
1245 .
1245 .
1246 Here we discuss the basic things you will want to make sure things are
1246 Here we discuss the basic things you will want to make sure things are
1247 working properly from the beginning.
1247 working properly from the beginning.
1248 \layout Subsection
1248 \layout Subsection
1249
1249
1250
1250
1251 \begin_inset LatexCommand \label{sec:help-access}
1251 \begin_inset LatexCommand \label{sec:help-access}
1252
1252
1253 \end_inset
1253 \end_inset
1254
1254
1255 Access to the Python help system
1255 Access to the Python help system
1256 \layout Standard
1256 \layout Standard
1257
1257
1258 This is true for Python in general (not just for IPython): you should have
1258 This is true for Python in general (not just for IPython): you should have
1259 an environment variable called
1259 an environment variable called
1260 \family typewriter
1260 \family typewriter
1261 PYTHONDOCS
1261 PYTHONDOCS
1262 \family default
1262 \family default
1263 pointing to the directory where your HTML Python documentation lives.
1263 pointing to the directory where your HTML Python documentation lives.
1264 In my system it's
1264 In my system it's
1265 \family typewriter
1265 \family typewriter
1266 /usr/share/doc/python-docs-2.3.4/html
1266 /usr/share/doc/python-docs-2.3.4/html
1267 \family default
1267 \family default
1268 , check your local details or ask your systems administrator.
1268 , check your local details or ask your systems administrator.
1269
1269
1270 \layout Standard
1270 \layout Standard
1271
1271
1272 This is the directory which holds the HTML version of the Python manuals.
1272 This is the directory which holds the HTML version of the Python manuals.
1273 Unfortunately it seems that different Linux distributions package these
1273 Unfortunately it seems that different Linux distributions package these
1274 files differently, so you may have to look around a bit.
1274 files differently, so you may have to look around a bit.
1275 Below I show the contents of this directory on my system for reference:
1275 Below I show the contents of this directory on my system for reference:
1276 \layout Standard
1276 \layout Standard
1277
1277
1278
1278
1279 \family typewriter
1279 \family typewriter
1280 [html]> ls
1280 [html]> ls
1281 \newline
1281 \newline
1282 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/
1282 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/
1283 about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1283 about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1284 \layout Standard
1284 \layout Standard
1285
1285
1286 You should really make sure this variable is correctly set so that Python's
1286 You should really make sure this variable is correctly set so that Python's
1287 pydoc-based help system works.
1287 pydoc-based help system works.
1288 It is a powerful and convenient system with full access to the Python manuals
1288 It is a powerful and convenient system with full access to the Python manuals
1289 and all modules accessible to you.
1289 and all modules accessible to you.
1290 \layout Standard
1290 \layout Standard
1291
1291
1292 Under Windows it seems that pydoc finds the documentation automatically,
1292 Under Windows it seems that pydoc finds the documentation automatically,
1293 so no extra setup appears necessary.
1293 so no extra setup appears necessary.
1294 \layout Subsection
1294 \layout Subsection
1295
1295
1296 Editor
1296 Editor
1297 \layout Standard
1297 \layout Standard
1298
1298
1299 The
1299 The
1300 \family typewriter
1300 \family typewriter
1301 %edit
1301 %edit
1302 \family default
1302 \family default
1303 command (and its alias
1303 command (and its alias
1304 \family typewriter
1304 \family typewriter
1305 %ed
1305 %ed
1306 \family default
1306 \family default
1307 ) will invoke the editor set in your environment as
1307 ) will invoke the editor set in your environment as
1308 \family typewriter
1308 \family typewriter
1309 EDITOR
1309 EDITOR
1310 \family default
1310 \family default
1311 .
1311 .
1312 If this variable is not set, it will default to
1312 If this variable is not set, it will default to
1313 \family typewriter
1313 \family typewriter
1314 vi
1314 vi
1315 \family default
1315 \family default
1316 under Linux/Unix and to
1316 under Linux/Unix and to
1317 \family typewriter
1317 \family typewriter
1318 notepad
1318 notepad
1319 \family default
1319 \family default
1320 under Windows.
1320 under Windows.
1321 You may want to set this variable properly and to a lightweight editor
1321 You may want to set this variable properly and to a lightweight editor
1322 which doesn't take too long to start (that is, something other than a new
1322 which doesn't take too long to start (that is, something other than a new
1323 instance of
1323 instance of
1324 \family typewriter
1324 \family typewriter
1325 Emacs
1325 Emacs
1326 \family default
1326 \family default
1327 ).
1327 ).
1328 This way you can edit multi-line code quickly and with the power of a real
1328 This way you can edit multi-line code quickly and with the power of a real
1329 editor right inside IPython.
1329 editor right inside IPython.
1330
1330
1331 \layout Standard
1331 \layout Standard
1332
1332
1333 If you are a dedicated
1333 If you are a dedicated
1334 \family typewriter
1334 \family typewriter
1335 Emacs
1335 Emacs
1336 \family default
1336 \family default
1337 user, you should set up the
1337 user, you should set up the
1338 \family typewriter
1338 \family typewriter
1339 Emacs
1339 Emacs
1340 \family default
1340 \family default
1341 server so that new requests are handled by the original process.
1341 server so that new requests are handled by the original process.
1342 This means that almost no time is spent in handling the request (assuming
1342 This means that almost no time is spent in handling the request (assuming
1343 an
1343 an
1344 \family typewriter
1344 \family typewriter
1345 Emacs
1345 Emacs
1346 \family default
1346 \family default
1347 process is already running).
1347 process is already running).
1348 For this to work, you need to set your
1348 For this to work, you need to set your
1349 \family typewriter
1349 \family typewriter
1350 EDITOR
1350 EDITOR
1351 \family default
1351 \family default
1352 environment variable to
1352 environment variable to
1353 \family typewriter
1353 \family typewriter
1354 'emacsclient'
1354 'emacsclient'
1355 \family default
1355 \family default
1356 .
1356 .
1357
1357
1358 \family typewriter
1358 \family typewriter
1359
1359
1360 \family default
1360 \family default
1361 The code below, supplied by Francois Pinard, can then be used in your
1361 The code below, supplied by Francois Pinard, can then be used in your
1362 \family typewriter
1362 \family typewriter
1363 .emacs
1363 .emacs
1364 \family default
1364 \family default
1365 file to enable the server:
1365 file to enable the server:
1366 \layout Standard
1366 \layout Standard
1367
1367
1368
1368
1369 \family typewriter
1369 \family typewriter
1370 (defvar server-buffer-clients)
1370 (defvar server-buffer-clients)
1371 \newline
1371 \newline
1372 (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
1372 (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
1373 \newline
1373 \newline
1374
1374
1375 \begin_inset ERT
1375 \begin_inset ERT
1376 status Collapsed
1376 status Collapsed
1377
1377
1378 \layout Standard
1378 \layout Standard
1379
1379
1380 \backslash
1380 \backslash
1381 hspace*{0mm}
1381 hspace*{0mm}
1382 \end_inset
1382 \end_inset
1383
1383
1384 \SpecialChar ~
1384 \SpecialChar ~
1385 \SpecialChar ~
1385 \SpecialChar ~
1386 (server-start)
1386 (server-start)
1387 \newline
1387 \newline
1388
1388
1389 \begin_inset ERT
1389 \begin_inset ERT
1390 status Collapsed
1390 status Collapsed
1391
1391
1392 \layout Standard
1392 \layout Standard
1393
1393
1394 \backslash
1394 \backslash
1395 hspace*{0mm}
1395 hspace*{0mm}
1396 \end_inset
1396 \end_inset
1397
1397
1398 \SpecialChar ~
1398 \SpecialChar ~
1399 \SpecialChar ~
1399 \SpecialChar ~
1400 (defun fp-kill-server-with-buffer-routine ()
1400 (defun fp-kill-server-with-buffer-routine ()
1401 \newline
1401 \newline
1402
1402
1403 \begin_inset ERT
1403 \begin_inset ERT
1404 status Collapsed
1404 status Collapsed
1405
1405
1406 \layout Standard
1406 \layout Standard
1407
1407
1408 \backslash
1408 \backslash
1409 hspace*{0mm}
1409 hspace*{0mm}
1410 \end_inset
1410 \end_inset
1411
1411
1412 \SpecialChar ~
1412 \SpecialChar ~
1413 \SpecialChar ~
1413 \SpecialChar ~
1414 \SpecialChar ~
1414 \SpecialChar ~
1415 \SpecialChar ~
1415 \SpecialChar ~
1416 (and server-buffer-clients (server-done)))
1416 (and server-buffer-clients (server-done)))
1417 \newline
1417 \newline
1418
1418
1419 \begin_inset ERT
1419 \begin_inset ERT
1420 status Collapsed
1420 status Collapsed
1421
1421
1422 \layout Standard
1422 \layout Standard
1423
1423
1424 \backslash
1424 \backslash
1425 hspace*{0mm}
1425 hspace*{0mm}
1426 \end_inset
1426 \end_inset
1427
1427
1428 \SpecialChar ~
1428 \SpecialChar ~
1429 \SpecialChar ~
1429 \SpecialChar ~
1430 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1430 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1431 \layout Standard
1431 \layout Standard
1432
1432
1433 You can also set the value of this editor via the commmand-line option '-
1433 You can also set the value of this editor via the commmand-line option '-
1434 \family typewriter
1434 \family typewriter
1435 editor'
1435 editor'
1436 \family default
1436 \family default
1437 or in your
1437 or in your
1438 \family typewriter
1438 \family typewriter
1439 ipythonrc
1439 ipythonrc
1440 \family default
1440 \family default
1441 file.
1441 file.
1442 This is useful if you wish to use specifically for IPython an editor different
1442 This is useful if you wish to use specifically for IPython an editor different
1443 from your typical default (and for Windows users who tend to use fewer
1443 from your typical default (and for Windows users who tend to use fewer
1444 environment variables).
1444 environment variables).
1445 \layout Subsection
1445 \layout Subsection
1446
1446
1447 Color
1447 Color
1448 \layout Standard
1448 \layout Standard
1449
1449
1450 The default IPython configuration has most bells and whistles turned on
1450 The default IPython configuration has most bells and whistles turned on
1451 (they're pretty safe).
1451 (they're pretty safe).
1452 But there's one that
1452 But there's one that
1453 \emph on
1453 \emph on
1454 may
1454 may
1455 \emph default
1455 \emph default
1456 cause problems on some systems: the use of color on screen for displaying
1456 cause problems on some systems: the use of color on screen for displaying
1457 information.
1457 information.
1458 This is very useful, since IPython can show prompts and exception tracebacks
1458 This is very useful, since IPython can show prompts and exception tracebacks
1459 with various colors, display syntax-highlighted source code, and in general
1459 with various colors, display syntax-highlighted source code, and in general
1460 make it easier to visually parse information.
1460 make it easier to visually parse information.
1461 \layout Standard
1461 \layout Standard
1462
1462
1463 The following terminals seem to handle the color sequences fine:
1463 The following terminals seem to handle the color sequences fine:
1464 \layout Itemize
1464 \layout Itemize
1465
1465
1466 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1466 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1467 \layout Itemize
1467 \layout Itemize
1468
1468
1469 CDE terminal (tested under Solaris).
1469 CDE terminal (tested under Solaris).
1470 This one boldfaces light colors.
1470 This one boldfaces light colors.
1471 \layout Itemize
1471 \layout Itemize
1472
1472
1473 (X)Emacs buffers.
1473 (X)Emacs buffers.
1474 See sec.
1474 See sec.
1475 \begin_inset LatexCommand \ref{sec:emacs}
1475 \begin_inset LatexCommand \ref{sec:emacs}
1476
1476
1477 \end_inset
1477 \end_inset
1478
1478
1479 for more details on using IPython with (X)Emacs.
1479 for more details on using IPython with (X)Emacs.
1480 \layout Itemize
1480 \layout Itemize
1481
1481
1482 A Windows (XP/2k) command prompt
1482 A Windows (XP/2k) command prompt
1483 \emph on
1483 \emph on
1484 with Gary Bishop's support extensions
1484 with Gary Bishop's support extensions
1485 \emph default
1485 \emph default
1486 .
1486 .
1487 Gary's extensions are discussed in Sec.\SpecialChar ~
1487 Gary's extensions are discussed in Sec.\SpecialChar ~
1488
1488
1489 \begin_inset LatexCommand \ref{sub:Under-Windows}
1489 \begin_inset LatexCommand \ref{sub:Under-Windows}
1490
1490
1491 \end_inset
1491 \end_inset
1492
1492
1493 .
1493 .
1494 \layout Itemize
1494 \layout Itemize
1495
1495
1496 A Windows (XP/2k) CygWin shell.
1496 A Windows (XP/2k) CygWin shell.
1497 Although some users have reported problems; it is not clear whether there
1497 Although some users have reported problems; it is not clear whether there
1498 is an issue for everyone or only under specific configurations.
1498 is an issue for everyone or only under specific configurations.
1499 If you have full color support under cygwin, please post to the IPython
1499 If you have full color support under cygwin, please post to the IPython
1500 mailing list so this issue can be resolved for all users.
1500 mailing list so this issue can be resolved for all users.
1501 \layout Standard
1501 \layout Standard
1502
1502
1503 These have shown problems:
1503 These have shown problems:
1504 \layout Itemize
1504 \layout Itemize
1505
1505
1506 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1506 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1507 or ssh.
1507 or ssh.
1508 \layout Itemize
1508 \layout Itemize
1509
1509
1510 Windows native command prompt in WinXP/2k,
1510 Windows native command prompt in WinXP/2k,
1511 \emph on
1511 \emph on
1512 without
1512 without
1513 \emph default
1513 \emph default
1514 Gary Bishop's extensions.
1514 Gary Bishop's extensions.
1515 Once Gary's readline library is installed, the normal WinXP/2k command
1515 Once Gary's readline library is installed, the normal WinXP/2k command
1516 prompt works perfectly.
1516 prompt works perfectly.
1517 \layout Standard
1517 \layout Standard
1518
1518
1519 Currently the following color schemes are available:
1519 Currently the following color schemes are available:
1520 \layout Itemize
1520 \layout Itemize
1521
1521
1522
1522
1523 \family typewriter
1523 \family typewriter
1524 NoColor
1524 NoColor
1525 \family default
1525 \family default
1526 : uses no color escapes at all (all escapes are empty
1526 : uses no color escapes at all (all escapes are empty
1527 \begin_inset Quotes eld
1527 \begin_inset Quotes eld
1528 \end_inset
1528 \end_inset
1529
1529
1530
1530
1531 \begin_inset Quotes eld
1531 \begin_inset Quotes eld
1532 \end_inset
1532 \end_inset
1533
1533
1534 strings).
1534 strings).
1535 This 'scheme' is thus fully safe to use in any terminal.
1535 This 'scheme' is thus fully safe to use in any terminal.
1536 \layout Itemize
1536 \layout Itemize
1537
1537
1538
1538
1539 \family typewriter
1539 \family typewriter
1540 Linux
1540 Linux
1541 \family default
1541 \family default
1542 : works well in Linux console type environments: dark background with light
1542 : works well in Linux console type environments: dark background with light
1543 fonts.
1543 fonts.
1544 It uses bright colors for information, so it is difficult to read if you
1544 It uses bright colors for information, so it is difficult to read if you
1545 have a light colored background.
1545 have a light colored background.
1546 \layout Itemize
1546 \layout Itemize
1547
1547
1548
1548
1549 \family typewriter
1549 \family typewriter
1550 LightBG
1550 LightBG
1551 \family default
1551 \family default
1552 : the basic colors are similar to those in the
1552 : the basic colors are similar to those in the
1553 \family typewriter
1553 \family typewriter
1554 Linux
1554 Linux
1555 \family default
1555 \family default
1556 scheme but darker.
1556 scheme but darker.
1557 It is easy to read in terminals with light backgrounds.
1557 It is easy to read in terminals with light backgrounds.
1558 \layout Standard
1558 \layout Standard
1559
1559
1560 IPython uses colors for two main groups of things: prompts and tracebacks
1560 IPython uses colors for two main groups of things: prompts and tracebacks
1561 which are directly printed to the terminal, and the object introspection
1561 which are directly printed to the terminal, and the object introspection
1562 system which passes large sets of data through a pager.
1562 system which passes large sets of data through a pager.
1563 \layout Subsubsection
1563 \layout Subsubsection
1564
1564
1565 Input/Output prompts and exception tracebacks
1565 Input/Output prompts and exception tracebacks
1566 \layout Standard
1566 \layout Standard
1567
1567
1568 You can test whether the colored prompts and tracebacks work on your system
1568 You can test whether the colored prompts and tracebacks work on your system
1569 interactively by typing
1569 interactively by typing
1570 \family typewriter
1570 \family typewriter
1571 '%colors Linux'
1571 '%colors Linux'
1572 \family default
1572 \family default
1573 at the prompt (use '
1573 at the prompt (use '
1574 \family typewriter
1574 \family typewriter
1575 %colors LightBG'
1575 %colors LightBG'
1576 \family default
1576 \family default
1577 if your terminal has a light background).
1577 if your terminal has a light background).
1578 If the input prompt shows garbage like:
1578 If the input prompt shows garbage like:
1579 \newline
1579 \newline
1580
1580
1581 \family typewriter
1581 \family typewriter
1582 [0;32mIn [[1;32m1[0;32m]: [0;00m
1582 [0;32mIn [[1;32m1[0;32m]: [0;00m
1583 \family default
1583 \family default
1584
1584
1585 \newline
1585 \newline
1586 instead of (in color) something like:
1586 instead of (in color) something like:
1587 \newline
1587 \newline
1588
1588
1589 \family typewriter
1589 \family typewriter
1590 In [1]:
1590 In [1]:
1591 \family default
1591 \family default
1592
1592
1593 \newline
1593 \newline
1594 this means that your terminal doesn't properly handle color escape sequences.
1594 this means that your terminal doesn't properly handle color escape sequences.
1595 You can go to a 'no color' mode by typing '
1595 You can go to a 'no color' mode by typing '
1596 \family typewriter
1596 \family typewriter
1597 %colors NoColor
1597 %colors NoColor
1598 \family default
1598 \family default
1599 '.
1599 '.
1600
1600
1601 \layout Standard
1601 \layout Standard
1602
1602
1603 You can try using a different terminal emulator program.
1603 You can try using a different terminal emulator program.
1604 To permanently set your color preferences, edit the file
1604 To permanently set your color preferences, edit the file
1605 \family typewriter
1605 \family typewriter
1606 $HOME/.ipython/ipythonrc
1606 $HOME/.ipython/ipythonrc
1607 \family default
1607 \family default
1608 and set the
1608 and set the
1609 \family typewriter
1609 \family typewriter
1610 colors
1610 colors
1611 \family default
1611 \family default
1612 option to the desired value.
1612 option to the desired value.
1613 \layout Subsubsection
1613 \layout Subsubsection
1614
1614
1615 Object details (types, docstrings, source code, etc.)
1615 Object details (types, docstrings, source code, etc.)
1616 \layout Standard
1616 \layout Standard
1617
1617
1618 IPython has a set of special functions for studying the objects you are
1618 IPython has a set of special functions for studying the objects you are
1619 working with, discussed in detail in Sec.
1619 working with, discussed in detail in Sec.
1620
1620
1621 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1621 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1622
1622
1623 \end_inset
1623 \end_inset
1624
1624
1625 .
1625 .
1626 But this system relies on passing information which is longer than your
1626 But this system relies on passing information which is longer than your
1627 screen through a data pager, such as the common Unix
1627 screen through a data pager, such as the common Unix
1628 \family typewriter
1628 \family typewriter
1629 less
1629 less
1630 \family default
1630 \family default
1631 and
1631 and
1632 \family typewriter
1632 \family typewriter
1633 more
1633 more
1634 \family default
1634 \family default
1635 programs.
1635 programs.
1636 In order to be able to see this information in color, your pager needs
1636 In order to be able to see this information in color, your pager needs
1637 to be properly configured.
1637 to be properly configured.
1638 I strongly recommend using
1638 I strongly recommend using
1639 \family typewriter
1639 \family typewriter
1640 less
1640 less
1641 \family default
1641 \family default
1642 instead of
1642 instead of
1643 \family typewriter
1643 \family typewriter
1644 more
1644 more
1645 \family default
1645 \family default
1646 , as it seems that
1646 , as it seems that
1647 \family typewriter
1647 \family typewriter
1648 more
1648 more
1649 \family default
1649 \family default
1650 simply can not understand colored text correctly.
1650 simply can not understand colored text correctly.
1651 \layout Standard
1651 \layout Standard
1652
1652
1653 In order to configure
1653 In order to configure
1654 \family typewriter
1654 \family typewriter
1655 less
1655 less
1656 \family default
1656 \family default
1657 as your default pager, do the following:
1657 as your default pager, do the following:
1658 \layout Enumerate
1658 \layout Enumerate
1659
1659
1660 Set the environment
1660 Set the environment
1661 \family typewriter
1661 \family typewriter
1662 PAGER
1662 PAGER
1663 \family default
1663 \family default
1664 variable to
1664 variable to
1665 \family typewriter
1665 \family typewriter
1666 less
1666 less
1667 \family default
1667 \family default
1668 .
1668 .
1669 \layout Enumerate
1669 \layout Enumerate
1670
1670
1671 Set the environment
1671 Set the environment
1672 \family typewriter
1672 \family typewriter
1673 LESS
1673 LESS
1674 \family default
1674 \family default
1675 variable to
1675 variable to
1676 \family typewriter
1676 \family typewriter
1677 -r
1677 -r
1678 \family default
1678 \family default
1679 (plus any other options you always want to pass to
1679 (plus any other options you always want to pass to
1680 \family typewriter
1680 \family typewriter
1681 less
1681 less
1682 \family default
1682 \family default
1683 by default).
1683 by default).
1684 This tells
1684 This tells
1685 \family typewriter
1685 \family typewriter
1686 less
1686 less
1687 \family default
1687 \family default
1688 to properly interpret control sequences, which is how color information
1688 to properly interpret control sequences, which is how color information
1689 is given to your terminal.
1689 is given to your terminal.
1690 \layout Standard
1690 \layout Standard
1691
1691
1692 For the
1692 For the
1693 \family typewriter
1693 \family typewriter
1694 csh
1694 csh
1695 \family default
1695 \family default
1696 or
1696 or
1697 \family typewriter
1697 \family typewriter
1698 tcsh
1698 tcsh
1699 \family default
1699 \family default
1700 shells, add to your
1700 shells, add to your
1701 \family typewriter
1701 \family typewriter
1702 ~/.cshrc
1702 ~/.cshrc
1703 \family default
1703 \family default
1704 file the lines:
1704 file the lines:
1705 \layout Standard
1705 \layout Standard
1706
1706
1707
1707
1708 \family typewriter
1708 \family typewriter
1709 setenv PAGER less
1709 setenv PAGER less
1710 \newline
1710 \newline
1711 setenv LESS -r
1711 setenv LESS -r
1712 \layout Standard
1712 \layout Standard
1713
1713
1714 There is similar syntax for other Unix shells, look at your system documentation
1714 There is similar syntax for other Unix shells, look at your system documentation
1715 for details.
1715 for details.
1716 \layout Standard
1716 \layout Standard
1717
1717
1718 If you are on a system which lacks proper data pagers (such as Windows),
1718 If you are on a system which lacks proper data pagers (such as Windows),
1719 IPython will use a very limited builtin pager.
1719 IPython will use a very limited builtin pager.
1720 \layout Subsection
1720 \layout Subsection
1721
1721
1722
1722
1723 \begin_inset LatexCommand \label{sec:emacs}
1723 \begin_inset LatexCommand \label{sec:emacs}
1724
1724
1725 \end_inset
1725 \end_inset
1726
1726
1727 (X)Emacs configuration
1727 (X)Emacs configuration
1728 \layout Standard
1728 \layout Standard
1729
1729
1730 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
1730 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
1731 (X)Emacs and IPython get along very well.
1731 (X)Emacs and IPython get along very well.
1732
1732
1733 \layout Standard
1733 \layout Standard
1734
1734
1735
1735
1736 \series bold
1736 \series bold
1737 Important note:
1737 Important note:
1738 \series default
1738 \series default
1739 You will need to use a recent enough version of
1739 You will need to use a recent enough version of
1740 \family typewriter
1740 \family typewriter
1741 python-mode.el
1741 python-mode.el
1742 \family default
1742 \family default
1743 , along with the file
1743 , along with the file
1744 \family typewriter
1744 \family typewriter
1745 ipython.el
1745 ipython.el
1746 \family default
1746 \family default
1747 .
1747 .
1748 You can check that the version you have of
1748 You can check that the version you have of
1749 \family typewriter
1749 \family typewriter
1750 python-mode.el
1750 python-mode.el
1751 \family default
1751 \family default
1752 is new enough by either looking at the revision number in the file itself,
1752 is new enough by either looking at the revision number in the file itself,
1753 or asking for it in (X)Emacs via
1753 or asking for it in (X)Emacs via
1754 \family typewriter
1754 \family typewriter
1755 M-x py-version
1755 M-x py-version
1756 \family default
1756 \family default
1757 .
1757 .
1758 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
1758 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
1759 \layout Standard
1759 \layout Standard
1760
1760
1761 The file
1761 The file
1762 \family typewriter
1762 \family typewriter
1763 ipython.el
1763 ipython.el
1764 \family default
1764 \family default
1765 is included with the IPython distribution, in the documentation directory
1765 is included with the IPython distribution, in the documentation directory
1766 (where this manual resides in PDF and HTML formats).
1766 (where this manual resides in PDF and HTML formats).
1767 \layout Standard
1767 \layout Standard
1768
1768
1769 Once you put these files in your Emacs path, all you need in your
1769 Once you put these files in your Emacs path, all you need in your
1770 \family typewriter
1770 \family typewriter
1771 .emacs
1771 .emacs
1772 \family default
1772 \family default
1773 file is:
1773 file is:
1774 \layout Standard
1774 \layout Standard
1775
1775
1776
1776
1777 \family typewriter
1777 \family typewriter
1778 (require 'ipython)
1778 (require 'ipython)
1779 \layout Standard
1779 \layout Standard
1780
1780
1781 This should give you full support for executing code snippets via IPython,
1781 This should give you full support for executing code snippets via IPython,
1782 opening IPython as your Python shell via
1782 opening IPython as your Python shell via
1783 \family typewriter
1783 \family typewriter
1784 C-c\SpecialChar ~
1784 C-c\SpecialChar ~
1785 !
1785 !
1786 \family default
1786 \family default
1787 , etc.
1787 , etc.
1788
1788
1789 \layout Subsubsection*
1789 \layout Subsubsection*
1790
1790
1791 Notes
1791 Notes
1792 \layout Itemize
1792 \layout Itemize
1793
1793
1794 There is one caveat you should be aware of: you must start the IPython shell
1794 There is one caveat you should be aware of: you must start the IPython shell
1795
1795
1796 \emph on
1796 \emph on
1797 before
1797 before
1798 \emph default
1798 \emph default
1799 attempting to execute any code regions via
1799 attempting to execute any code regions via
1800 \family typewriter
1800 \family typewriter
1801 C-c\SpecialChar ~
1801 C-c\SpecialChar ~
1802 |
1802 |
1803 \family default
1803 \family default
1804 .
1804 .
1805 Simply type
1805 Simply type
1806 \family typewriter
1806 \family typewriter
1807 C-c\SpecialChar ~
1807 C-c\SpecialChar ~
1808 !
1808 !
1809 \family default
1809 \family default
1810 to start IPython before passing any code regions to the interpreter, and
1810 to start IPython before passing any code regions to the interpreter, and
1811 you shouldn't experience any problems.
1811 you shouldn't experience any problems.
1812 \newline
1812 \newline
1813 This is due to a bug in Python itself, which has been fixed for Python 2.3,
1813 This is due to a bug in Python itself, which has been fixed for Python 2.3,
1814 but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]).
1814 but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]).
1815 \layout Itemize
1815 \layout Itemize
1816
1816
1817 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
1817 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
1818 ts should be directed to him through the IPython mailing lists.
1818 ts should be directed to him through the IPython mailing lists.
1819
1819
1820 \layout Itemize
1820 \layout Itemize
1821
1821
1822 This code is still somewhat experimental so it's a bit rough around the
1822 This code is still somewhat experimental so it's a bit rough around the
1823 edges (although in practice, it works quite well).
1823 edges (although in practice, it works quite well).
1824 \layout Itemize
1824 \layout Itemize
1825
1825
1826 Be aware that if you customize
1826 Be aware that if you customize
1827 \family typewriter
1827 \family typewriter
1828 py-python-command
1828 py-python-command
1829 \family default
1829 \family default
1830 previously, this value will override what
1830 previously, this value will override what
1831 \family typewriter
1831 \family typewriter
1832 ipython.el
1832 ipython.el
1833 \family default
1833 \family default
1834 does (because loading the customization variables comes later).
1834 does (because loading the customization variables comes later).
1835 \layout Section
1835 \layout Section
1836
1836
1837
1837
1838 \begin_inset LatexCommand \label{sec:quick_tips}
1838 \begin_inset LatexCommand \label{sec:quick_tips}
1839
1839
1840 \end_inset
1840 \end_inset
1841
1841
1842 Quick tips
1842 Quick tips
1843 \layout Standard
1843 \layout Standard
1844
1844
1845 IPython can be used as an improved replacement for the Python prompt, and
1845 IPython can be used as an improved replacement for the Python prompt, and
1846 for that you don't really need to read any more of this manual.
1846 for that you don't really need to read any more of this manual.
1847 But in this section we'll try to summarize a few tips on how to make the
1847 But in this section we'll try to summarize a few tips on how to make the
1848 most effective use of it for everyday Python development, highlighting
1848 most effective use of it for everyday Python development, highlighting
1849 things you might miss in the rest of the manual (which is getting long).
1849 things you might miss in the rest of the manual (which is getting long).
1850 We'll give references to parts in the manual which provide more detail
1850 We'll give references to parts in the manual which provide more detail
1851 when appropriate.
1851 when appropriate.
1852 \layout Standard
1852 \layout Standard
1853
1853
1854 The following article by Jeremy Jones provides an introductory tutorial
1854 The following article by Jeremy Jones provides an introductory tutorial
1855 about IPython:
1855 about IPython:
1856 \newline
1856 \newline
1857
1857
1858 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
1858 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
1859
1859
1860 \end_inset
1860 \end_inset
1861
1861
1862
1862
1863 \layout Itemize
1863 \layout Itemize
1864
1864
1865 The TAB key.
1865 The TAB key.
1866 TAB-completion, especially for attributes, is a convenient way to explore
1866 TAB-completion, especially for attributes, is a convenient way to explore
1867 the structure of any object you're dealing with.
1867 the structure of any object you're dealing with.
1868 Simply type
1868 Simply type
1869 \family typewriter
1869 \family typewriter
1870 object_name.<TAB>
1870 object_name.<TAB>
1871 \family default
1871 \family default
1872 and a list of the object's attributes will be printed (see sec.
1872 and a list of the object's attributes will be printed (see sec.
1873
1873
1874 \begin_inset LatexCommand \ref{sec:readline}
1874 \begin_inset LatexCommand \ref{sec:readline}
1875
1875
1876 \end_inset
1876 \end_inset
1877
1877
1878 for more).
1878 for more).
1879 Tab completion also works on file and directory names, which combined with
1879 Tab completion also works on file and directory names, which combined with
1880 IPython's alias system allows you to do from within IPython many of the
1880 IPython's alias system allows you to do from within IPython many of the
1881 things you normally would need the system shell for.
1881 things you normally would need the system shell for.
1882
1882
1883 \layout Itemize
1883 \layout Itemize
1884
1884
1885 Explore your objects.
1885 Explore your objects.
1886 Typing
1886 Typing
1887 \family typewriter
1887 \family typewriter
1888 object_name?
1888 object_name?
1889 \family default
1889 \family default
1890 will print all sorts of details about any object, including docstrings,
1890 will print all sorts of details about any object, including docstrings,
1891 function definition lines (for call arguments) and constructor details
1891 function definition lines (for call arguments) and constructor details
1892 for classes.
1892 for classes.
1893 The magic commands
1893 The magic commands
1894 \family typewriter
1894 \family typewriter
1895 %pdoc
1895 %pdoc
1896 \family default
1896 \family default
1897 ,
1897 ,
1898 \family typewriter
1898 \family typewriter
1899 %pdef
1899 %pdef
1900 \family default
1900 \family default
1901 ,
1901 ,
1902 \family typewriter
1902 \family typewriter
1903 %psource
1903 %psource
1904 \family default
1904 \family default
1905 and
1905 and
1906 \family typewriter
1906 \family typewriter
1907 %pfile
1907 %pfile
1908 \family default
1908 \family default
1909 will respectively print the docstring, function definition line, full source
1909 will respectively print the docstring, function definition line, full source
1910 code and the complete file for any object (when they can be found).
1910 code and the complete file for any object (when they can be found).
1911 If automagic is on (it is by default), you don't need to type the '
1911 If automagic is on (it is by default), you don't need to type the '
1912 \family typewriter
1912 \family typewriter
1913 %
1913 %
1914 \family default
1914 \family default
1915 ' explicitly.
1915 ' explicitly.
1916 See sec.
1916 See sec.
1917
1917
1918 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1918 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1919
1919
1920 \end_inset
1920 \end_inset
1921
1921
1922 for more.
1922 for more.
1923 \layout Itemize
1923 \layout Itemize
1924
1924
1925 The
1925 The
1926 \family typewriter
1926 \family typewriter
1927 %run
1927 %run
1928 \family default
1928 \family default
1929 magic command allows you to run any python script and load all of its data
1929 magic command allows you to run any python script and load all of its data
1930 directly into the interactive namespace.
1930 directly into the interactive namespace.
1931 Since the file is re-read from disk each time, changes you make to it are
1931 Since the file is re-read from disk each time, changes you make to it are
1932 reflected immediately (in contrast to the behavior of
1932 reflected immediately (in contrast to the behavior of
1933 \family typewriter
1933 \family typewriter
1934 import
1934 import
1935 \family default
1935 \family default
1936 ).
1936 ).
1937 I rarely use
1937 I rarely use
1938 \family typewriter
1938 \family typewriter
1939 import
1939 import
1940 \family default
1940 \family default
1941 for code I am testing, relying on
1941 for code I am testing, relying on
1942 \family typewriter
1942 \family typewriter
1943 %run
1943 %run
1944 \family default
1944 \family default
1945 instead.
1945 instead.
1946 See sec.
1946 See sec.
1947
1947
1948 \begin_inset LatexCommand \ref{sec:magic}
1948 \begin_inset LatexCommand \ref{sec:magic}
1949
1949
1950 \end_inset
1950 \end_inset
1951
1951
1952 for more on this and other magic commands, or type the name of any magic
1952 for more on this and other magic commands, or type the name of any magic
1953 command and ? to get details on it.
1953 command and ? to get details on it.
1954 See also sec.
1954 See also sec.
1955
1955
1956 \begin_inset LatexCommand \ref{sec:dreload}
1956 \begin_inset LatexCommand \ref{sec:dreload}
1957
1957
1958 \end_inset
1958 \end_inset
1959
1959
1960 for a recursive reload command.
1960 for a recursive reload command.
1961 \newline
1961 \newline
1962
1962
1963 \family typewriter
1963 \family typewriter
1964 %run
1964 %run
1965 \family default
1965 \family default
1966 also has special flags for timing the execution of your scripts (
1966 also has special flags for timing the execution of your scripts (
1967 \family typewriter
1967 \family typewriter
1968 -t
1968 -t
1969 \family default
1969 \family default
1970 ) and for executing them under the control of either Python's
1970 ) and for executing them under the control of either Python's
1971 \family typewriter
1971 \family typewriter
1972 pdb
1972 pdb
1973 \family default
1973 \family default
1974 debugger (
1974 debugger (
1975 \family typewriter
1975 \family typewriter
1976 -d
1976 -d
1977 \family default
1977 \family default
1978 ) or profiler (
1978 ) or profiler (
1979 \family typewriter
1979 \family typewriter
1980 -p
1980 -p
1981 \family default
1981 \family default
1982 ).
1982 ).
1983 With all of these,
1983 With all of these,
1984 \family typewriter
1984 \family typewriter
1985 %run
1985 %run
1986 \family default
1986 \family default
1987 can be used as the main tool for efficient interactive development of code
1987 can be used as the main tool for efficient interactive development of code
1988 which you write in your editor of choice.
1988 which you write in your editor of choice.
1989 \layout Itemize
1989 \layout Itemize
1990
1990
1991 Use the Python debugger,
1991 Use the Python debugger,
1992 \family typewriter
1992 \family typewriter
1993 pdb
1993 pdb
1994 \family default
1994 \family default
1995
1995
1996 \begin_inset Foot
1996 \begin_inset Foot
1997 collapsed true
1997 collapsed true
1998
1998
1999 \layout Standard
1999 \layout Standard
2000
2000
2001 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2001 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2002 to IPython's improved debugger and profiler support.
2002 to IPython's improved debugger and profiler support.
2003 \end_inset
2003 \end_inset
2004
2004
2005 .
2005 .
2006 The
2006 The
2007 \family typewriter
2007 \family typewriter
2008 %pdb
2008 %pdb
2009 \family default
2009 \family default
2010 command allows you to toggle on and off the automatic invocation of an
2010 command allows you to toggle on and off the automatic invocation of an
2011 IPython-enhanced
2011 IPython-enhanced
2012 \family typewriter
2012 \family typewriter
2013 pdb
2013 pdb
2014 \family default
2014 \family default
2015 debugger (with coloring, tab completion and more) at any uncaught exception.
2015 debugger (with coloring, tab completion and more) at any uncaught exception.
2016 The advantage of this is that
2016 The advantage of this is that
2017 \family typewriter
2017 \family typewriter
2018 pdb
2018 pdb
2019 \family default
2019 \family default
2020 starts
2020 starts
2021 \emph on
2021 \emph on
2022 inside
2022 inside
2023 \emph default
2023 \emph default
2024 the function where the exception occurred, with all data still available.
2024 the function where the exception occurred, with all data still available.
2025 You can print variables, see code, execute statements and even walk up
2025 You can print variables, see code, execute statements and even walk up
2026 and down the call stack to track down the true source of the problem (which
2026 and down the call stack to track down the true source of the problem (which
2027 often is many layers in the stack above where the exception gets triggered).
2027 often is many layers in the stack above where the exception gets triggered).
2028 \newline
2028 \newline
2029 Running programs with
2029 Running programs with
2030 \family typewriter
2030 \family typewriter
2031 %run
2031 %run
2032 \family default
2032 \family default
2033 and pdb active can be an efficient to develop and debug code, in many cases
2033 and pdb active can be an efficient to develop and debug code, in many cases
2034 eliminating the need for
2034 eliminating the need for
2035 \family typewriter
2035 \family typewriter
2036 print
2036 print
2037 \family default
2037 \family default
2038 statements or external debugging tools.
2038 statements or external debugging tools.
2039 I often simply put a
2039 I often simply put a
2040 \family typewriter
2040 \family typewriter
2041 1/0
2041 1/0
2042 \family default
2042 \family default
2043 in a place where I want to take a look so that pdb gets called, quickly
2043 in a place where I want to take a look so that pdb gets called, quickly
2044 view whatever variables I need to or test various pieces of code and then
2044 view whatever variables I need to or test various pieces of code and then
2045 remove the
2045 remove the
2046 \family typewriter
2046 \family typewriter
2047 1/0
2047 1/0
2048 \family default
2048 \family default
2049 .
2049 .
2050 \newline
2050 \newline
2051 Note also that `
2051 Note also that `
2052 \family typewriter
2052 \family typewriter
2053 %run -d
2053 %run -d
2054 \family default
2054 \family default
2055 ' activates
2055 ' activates
2056 \family typewriter
2056 \family typewriter
2057 pdb
2057 pdb
2058 \family default
2058 \family default
2059 and automatically sets initial breakpoints for you to step through your
2059 and automatically sets initial breakpoints for you to step through your
2060 code, watch variables, etc.
2060 code, watch variables, etc.
2061 See Sec.\SpecialChar ~
2061 See Sec.\SpecialChar ~
2062
2062
2063 \begin_inset LatexCommand \ref{sec:cache_output}
2063 \begin_inset LatexCommand \ref{sec:cache_output}
2064
2064
2065 \end_inset
2065 \end_inset
2066
2066
2067 for details.
2067 for details.
2068 \layout Itemize
2068 \layout Itemize
2069
2069
2070 Use the output cache.
2070 Use the output cache.
2071 All output results are automatically stored in a global dictionary named
2071 All output results are automatically stored in a global dictionary named
2072
2072
2073 \family typewriter
2073 \family typewriter
2074 Out
2074 Out
2075 \family default
2075 \family default
2076 and variables named
2076 and variables named
2077 \family typewriter
2077 \family typewriter
2078 _1
2078 _1
2079 \family default
2079 \family default
2080 ,
2080 ,
2081 \family typewriter
2081 \family typewriter
2082 _2
2082 _2
2083 \family default
2083 \family default
2084 , etc.
2084 , etc.
2085 alias them.
2085 alias them.
2086 For example, the result of input line 4 is available either as
2086 For example, the result of input line 4 is available either as
2087 \family typewriter
2087 \family typewriter
2088 Out[4]
2088 Out[4]
2089 \family default
2089 \family default
2090 or as
2090 or as
2091 \family typewriter
2091 \family typewriter
2092 _4
2092 _4
2093 \family default
2093 \family default
2094 .
2094 .
2095 Additionally, three variables named
2095 Additionally, three variables named
2096 \family typewriter
2096 \family typewriter
2097 _
2097 _
2098 \family default
2098 \family default
2099 ,
2099 ,
2100 \family typewriter
2100 \family typewriter
2101 __
2101 __
2102 \family default
2102 \family default
2103 and
2103 and
2104 \family typewriter
2104 \family typewriter
2105 ___
2105 ___
2106 \family default
2106 \family default
2107 are always kept updated with the for the last three results.
2107 are always kept updated with the for the last three results.
2108 This allows you to recall any previous result and further use it for new
2108 This allows you to recall any previous result and further use it for new
2109 calculations.
2109 calculations.
2110 See Sec.\SpecialChar ~
2110 See Sec.\SpecialChar ~
2111
2111
2112 \begin_inset LatexCommand \ref{sec:cache_output}
2112 \begin_inset LatexCommand \ref{sec:cache_output}
2113
2113
2114 \end_inset
2114 \end_inset
2115
2115
2116 for more.
2116 for more.
2117 \layout Itemize
2117 \layout Itemize
2118
2118
2119 Put a '
2119 Put a '
2120 \family typewriter
2120 \family typewriter
2121 ;
2121 ;
2122 \family default
2122 \family default
2123 ' at the end of a line to supress the printing of output.
2123 ' at the end of a line to supress the printing of output.
2124 This is useful when doing calculations which generate long output you are
2124 This is useful when doing calculations which generate long output you are
2125 not interested in seeing.
2125 not interested in seeing.
2126 The
2126 The
2127 \family typewriter
2127 \family typewriter
2128 _*
2128 _*
2129 \family default
2129 \family default
2130 variables and the
2130 variables and the
2131 \family typewriter
2131 \family typewriter
2132 Out[]
2132 Out[]
2133 \family default
2133 \family default
2134 list do get updated with the contents of the output, even if it is not
2134 list do get updated with the contents of the output, even if it is not
2135 printed.
2135 printed.
2136 You can thus still access the generated results this way for further processing.
2136 You can thus still access the generated results this way for further processing.
2137 \layout Itemize
2137 \layout Itemize
2138
2138
2139 A similar system exists for caching input.
2139 A similar system exists for caching input.
2140 All input is stored in a global list called
2140 All input is stored in a global list called
2141 \family typewriter
2141 \family typewriter
2142 In
2142 In
2143 \family default
2143 \family default
2144 , so you can re-execute lines 22 through 28 plus line 34 by typing
2144 , so you can re-execute lines 22 through 28 plus line 34 by typing
2145 \family typewriter
2145 \family typewriter
2146 'exec In[22:29]+In[34]'
2146 'exec In[22:29]+In[34]'
2147 \family default
2147 \family default
2148 (using Python slicing notation).
2148 (using Python slicing notation).
2149 If you need to execute the same set of lines often, you can assign them
2149 If you need to execute the same set of lines often, you can assign them
2150 to a macro with the
2150 to a macro with the
2151 \family typewriter
2151 \family typewriter
2152 %macro
2152 %macro
2153 \family default
2153 \family default
2154
2154
2155 \family typewriter
2155 \family typewriter
2156 function.
2156 function.
2157
2157
2158 \family default
2158 \family default
2159 See sec.
2159 See sec.
2160
2160
2161 \begin_inset LatexCommand \ref{sec:cache_input}
2161 \begin_inset LatexCommand \ref{sec:cache_input}
2162
2162
2163 \end_inset
2163 \end_inset
2164
2164
2165 for more.
2165 for more.
2166 \layout Itemize
2166 \layout Itemize
2167
2167
2168 Use your input history.
2168 Use your input history.
2169 The
2169 The
2170 \family typewriter
2170 \family typewriter
2171 %hist
2171 %hist
2172 \family default
2172 \family default
2173 command can show you all previous input, without line numbers if desired
2173 command can show you all previous input, without line numbers if desired
2174 (option
2174 (option
2175 \family typewriter
2175 \family typewriter
2176 -n
2176 -n
2177 \family default
2177 \family default
2178 ) so you can directly copy and paste code either back in IPython or in a
2178 ) so you can directly copy and paste code either back in IPython or in a
2179 text editor.
2179 text editor.
2180 You can also save all your history by turning on logging via
2180 You can also save all your history by turning on logging via
2181 \family typewriter
2181 \family typewriter
2182 %logstart
2182 %logstart
2183 \family default
2183 \family default
2184 ; these logs can later be either reloaded as IPython sessions or used as
2184 ; these logs can later be either reloaded as IPython sessions or used as
2185 code for your programs.
2185 code for your programs.
2186 \layout Itemize
2186 \layout Itemize
2187
2187
2188 Define your own macros with
2188 Define your own macros with
2189 \family typewriter
2189 \family typewriter
2190 %macro
2190 %macro
2191 \family default
2191 \family default
2192 .
2192 .
2193 This can be useful for automating sequences of expressions when working
2193 This can be useful for automating sequences of expressions when working
2194 interactively.
2194 interactively.
2195 \layout Itemize
2195 \layout Itemize
2196
2196
2197 Define your own system aliases.
2197 Define your own system aliases.
2198 Even though IPython gives you access to your system shell via the
2198 Even though IPython gives you access to your system shell via the
2199 \family typewriter
2199 \family typewriter
2200 !
2200 !
2201 \family default
2201 \family default
2202 prefix, it is convenient to have aliases to the system commands you use
2202 prefix, it is convenient to have aliases to the system commands you use
2203 most often.
2203 most often.
2204 This allows you to work seamlessly from inside IPython with the same commands
2204 This allows you to work seamlessly from inside IPython with the same commands
2205 you are used to in your system shell.
2205 you are used to in your system shell.
2206 \newline
2206 \newline
2207 IPython comes with some pre-defined aliases and a complete system for changing
2207 IPython comes with some pre-defined aliases and a complete system for changing
2208 directories, both via a stack (see
2208 directories, both via a stack (see
2209 \family typewriter
2209 \family typewriter
2210 %pushd
2210 %pushd
2211 \family default
2211 \family default
2212 ,
2212 ,
2213 \family typewriter
2213 \family typewriter
2214 %popd
2214 %popd
2215 \family default
2215 \family default
2216 and
2216 and
2217 \family typewriter
2217 \family typewriter
2218 %ds
2218 %ds
2219 \family default
2219 \family default
2220 ) and via direct
2220 ) and via direct
2221 \family typewriter
2221 \family typewriter
2222 %cd
2222 %cd
2223 \family default
2223 \family default
2224 .
2224 .
2225 The latter keeps a history of visited directories and allows you to go
2225 The latter keeps a history of visited directories and allows you to go
2226 to any previously visited one.
2226 to any previously visited one.
2227 \layout Itemize
2227 \layout Itemize
2228
2228
2229 Use Python to manipulate the results of system commands.
2229 Use Python to manipulate the results of system commands.
2230 The `
2230 The `
2231 \family typewriter
2231 \family typewriter
2232 !!
2232 !!
2233 \family default
2233 \family default
2234 ' special syntax, and the
2234 ' special syntax, and the
2235 \family typewriter
2235 \family typewriter
2236 %sc
2236 %sc
2237 \family default
2237 \family default
2238 and
2238 and
2239 \family typewriter
2239 \family typewriter
2240 %sx
2240 %sx
2241 \family default
2241 \family default
2242 magic commands allow you to capture system output into Python variables.
2242 magic commands allow you to capture system output into Python variables.
2243 \layout Itemize
2243 \layout Itemize
2244
2244
2245 Expand python variables when calling the shell (either via
2245 Expand python variables when calling the shell (either via
2246 \family typewriter
2246 \family typewriter
2247 `!'
2247 `!'
2248 \family default
2248 \family default
2249 and
2249 and
2250 \family typewriter
2250 \family typewriter
2251 `!!'
2251 `!!'
2252 \family default
2252 \family default
2253 or via aliases) by prepending a
2253 or via aliases) by prepending a
2254 \family typewriter
2254 \family typewriter
2255 $
2255 $
2256 \family default
2256 \family default
2257 in front of them.
2257 in front of them.
2258 You can also expand complete python expressions.
2258 You can also expand complete python expressions.
2259 See sec.\SpecialChar ~
2259 See sec.\SpecialChar ~
2260
2260
2261 \begin_inset LatexCommand \ref{sub:System-shell-access}
2261 \begin_inset LatexCommand \ref{sub:System-shell-access}
2262
2262
2263 \end_inset
2263 \end_inset
2264
2264
2265 for more.
2265 for more.
2266 \layout Itemize
2266 \layout Itemize
2267
2267
2268 Use profiles to maintain different configurations (modules to load, function
2268 Use profiles to maintain different configurations (modules to load, function
2269 definitions, option settings) for particular tasks.
2269 definitions, option settings) for particular tasks.
2270 You can then have customized versions of IPython for specific purposes.
2270 You can then have customized versions of IPython for specific purposes.
2271 See sec.\SpecialChar ~
2271 See sec.\SpecialChar ~
2272
2272
2273 \begin_inset LatexCommand \ref{sec:profiles}
2273 \begin_inset LatexCommand \ref{sec:profiles}
2274
2274
2275 \end_inset
2275 \end_inset
2276
2276
2277 for more.
2277 for more.
2278 \layout Itemize
2278 \layout Itemize
2279
2279
2280 Embed IPython in your programs.
2280 Embed IPython in your programs.
2281 A few lines of code are enough to load a complete IPython inside your own
2281 A few lines of code are enough to load a complete IPython inside your own
2282 programs, giving you the ability to work with your data interactively after
2282 programs, giving you the ability to work with your data interactively after
2283 automatic processing has been completed.
2283 automatic processing has been completed.
2284 See sec.\SpecialChar ~
2284 See sec.\SpecialChar ~
2285
2285
2286 \begin_inset LatexCommand \ref{sec:embed}
2286 \begin_inset LatexCommand \ref{sec:embed}
2287
2287
2288 \end_inset
2288 \end_inset
2289
2289
2290 for more.
2290 for more.
2291 \layout Itemize
2291 \layout Itemize
2292
2292
2293 Use the Python profiler.
2293 Use the Python profiler.
2294 When dealing with performance issues, the
2294 When dealing with performance issues, the
2295 \family typewriter
2295 \family typewriter
2296 %run
2296 %run
2297 \family default
2297 \family default
2298 command with a
2298 command with a
2299 \family typewriter
2299 \family typewriter
2300 -p
2300 -p
2301 \family default
2301 \family default
2302 option allows you to run complete programs under the control of the Python
2302 option allows you to run complete programs under the control of the Python
2303 profiler.
2303 profiler.
2304 The
2304 The
2305 \family typewriter
2305 \family typewriter
2306 %prun
2306 %prun
2307 \family default
2307 \family default
2308 command does a similar job for single Python expressions (like function
2308 command does a similar job for single Python expressions (like function
2309 calls).
2309 calls).
2310 \layout Itemize
2310 \layout Itemize
2311
2311
2312 Use
2312 Use
2313 \family typewriter
2313 \family typewriter
2314 %edit
2314 %edit
2315 \family default
2315 \family default
2316 to have almost multiline editing.
2316 to have almost multiline editing.
2317 While IPython doesn't support true multiline editing, this command allows
2317 While IPython doesn't support true multiline editing, this command allows
2318 you to call an editor on the spot, and IPython will execute the code you
2318 you to call an editor on the spot, and IPython will execute the code you
2319 type in there as if it were typed interactively.
2319 type in there as if it were typed interactively.
2320 \layout Itemize
2320 \layout Itemize
2321
2321
2322 Use the IPython.demo.Demo class to load any Python script as an interactive
2322 Use the IPython.demo.Demo class to load any Python script as an interactive
2323 demo.
2323 demo.
2324 With a minimal amount of simple markup, you can control the execution of
2324 With a minimal amount of simple markup, you can control the execution of
2325 the script, stopping as needed.
2325 the script, stopping as needed.
2326 See sec.\SpecialChar ~
2326 See sec.\SpecialChar ~
2327
2327
2328 \begin_inset LatexCommand \ref{sec:interactive-demos}
2328 \begin_inset LatexCommand \ref{sec:interactive-demos}
2329
2329
2330 \end_inset
2330 \end_inset
2331
2331
2332 for more.
2332 for more.
2333 \layout Standard
2333 \layout Standard
2334
2334
2335
2335
2336 \series bold
2336 \series bold
2337 Effective logging:
2337 Effective logging:
2338 \series default
2338 \series default
2339 a very useful suggestion sent in by Robert Kern follows
2339 a very useful suggestion sent in by Robert Kern follows
2340 \layout Standard
2340 \layout Standard
2341
2341
2342 I recently happened on a nifty way to keep tidy per-project log files.
2342 I recently happened on a nifty way to keep tidy per-project log files.
2343 I made a profile for my project (which is called "parkfield").
2343 I made a profile for my project (which is called "parkfield").
2344 \layout LyX-Code
2344 \layout LyX-Code
2345
2345
2346 include ipythonrc
2346 include ipythonrc
2347 \layout LyX-Code
2347 \layout LyX-Code
2348
2348
2349 logfile '' # cancel earlier logfile invocation
2349 logfile '' # cancel earlier logfile invocation
2350 \layout LyX-Code
2350 \layout LyX-Code
2351
2351
2352 execute import time
2352 execute import time
2353 \layout LyX-Code
2353 \layout LyX-Code
2354
2354
2355 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
2355 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
2356 \layout LyX-Code
2356 \layout LyX-Code
2357
2357
2358 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
2358 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
2359 \layout Standard
2359 \layout Standard
2360
2360
2361 I also added a shell alias for convenience:
2361 I also added a shell alias for convenience:
2362 \layout LyX-Code
2362 \layout LyX-Code
2363
2363
2364 alias parkfield="ipython -pylab -profile parkfield"
2364 alias parkfield="ipython -pylab -profile parkfield"
2365 \layout Standard
2365 \layout Standard
2366
2366
2367 Now I have a nice little directory with everything I ever type in, organized
2367 Now I have a nice little directory with everything I ever type in, organized
2368 by project and date.
2368 by project and date.
2369 \layout Standard
2369 \layout Standard
2370
2370
2371
2371
2372 \series bold
2372 \series bold
2373 Contribute your own:
2373 Contribute your own:
2374 \series default
2374 \series default
2375 If you have your own favorite tip on using IPython efficiently for a certain
2375 If you have your own favorite tip on using IPython efficiently for a certain
2376 task (especially things which can't be done in the normal Python interpreter),
2376 task (especially things which can't be done in the normal Python interpreter),
2377 don't hesitate to send it!
2377 don't hesitate to send it!
2378 \layout Section
2378 \layout Section
2379
2379
2380 Command-line use
2380 Command-line use
2381 \layout Standard
2381 \layout Standard
2382
2382
2383 You start IPython with the command:
2383 You start IPython with the command:
2384 \layout Standard
2384 \layout Standard
2385
2385
2386
2386
2387 \family typewriter
2387 \family typewriter
2388 $ ipython [options] files
2388 $ ipython [options] files
2389 \layout Standard
2389 \layout Standard
2390
2390
2391 If invoked with no options, it executes all the files listed in sequence
2391 If invoked with no options, it executes all the files listed in sequence
2392 and drops you into the interpreter while still acknowledging any options
2392 and drops you into the interpreter while still acknowledging any options
2393 you may have set in your ipythonrc file.
2393 you may have set in your ipythonrc file.
2394 This behavior is different from standard Python, which when called as
2394 This behavior is different from standard Python, which when called as
2395 \family typewriter
2395 \family typewriter
2396 python -i
2396 python -i
2397 \family default
2397 \family default
2398 will only execute one file and ignore your configuration setup.
2398 will only execute one file and ignore your configuration setup.
2399 \layout Standard
2399 \layout Standard
2400
2400
2401 Please note that some of the configuration options are not available at
2401 Please note that some of the configuration options are not available at
2402 the command line, simply because they are not practical here.
2402 the command line, simply because they are not practical here.
2403 Look into your ipythonrc configuration file for details on those.
2403 Look into your ipythonrc configuration file for details on those.
2404 This file typically installed in the
2404 This file typically installed in the
2405 \family typewriter
2405 \family typewriter
2406 $HOME/.ipython
2406 $HOME/.ipython
2407 \family default
2407 \family default
2408 directory.
2408 directory.
2409 For Windows users,
2409 For Windows users,
2410 \family typewriter
2410 \family typewriter
2411 $HOME
2411 $HOME
2412 \family default
2412 \family default
2413 resolves to
2413 resolves to
2414 \family typewriter
2414 \family typewriter
2415 C:
2415 C:
2416 \backslash
2416 \backslash
2417
2417
2418 \backslash
2418 \backslash
2419 Documents and Settings
2419 Documents and Settings
2420 \backslash
2420 \backslash
2421
2421
2422 \backslash
2422 \backslash
2423 YourUserName
2423 YourUserName
2424 \family default
2424 \family default
2425 in most instances.
2425 in most instances.
2426 In the rest of this text, we will refer to this directory as
2426 In the rest of this text, we will refer to this directory as
2427 \family typewriter
2427 \family typewriter
2428 IPYTHONDIR
2428 IPYTHONDIR
2429 \family default
2429 \family default
2430 .
2430 .
2431 \layout Subsection
2431 \layout Subsection
2432
2432
2433
2433
2434 \begin_inset LatexCommand \label{sec:threading-opts}
2434 \begin_inset LatexCommand \label{sec:threading-opts}
2435
2435
2436 \end_inset
2436 \end_inset
2437
2437
2438 Special Threading Options
2438 Special Threading Options
2439 \layout Standard
2439 \layout Standard
2440
2440
2441 The following special options are ONLY valid at the beginning of the command
2441 The following special options are ONLY valid at the beginning of the command
2442 line, and not later.
2442 line, and not later.
2443 This is because they control the initial- ization of ipython itself, before
2443 This is because they control the initial- ization of ipython itself, before
2444 the normal option-handling mechanism is active.
2444 the normal option-handling mechanism is active.
2445 \layout List
2445 \layout List
2446 \labelwidthstring 00.00.0000
2446 \labelwidthstring 00.00.0000
2447
2447
2448
2448
2449 \family typewriter
2449 \family typewriter
2450 \series bold
2450 \series bold
2451 -gthread,\SpecialChar ~
2451 -gthread,\SpecialChar ~
2452 -qthread,\SpecialChar ~
2452 -qthread,\SpecialChar ~
2453 -wthread,\SpecialChar ~
2453 -wthread,\SpecialChar ~
2454 -pylab:
2454 -pylab:
2455 \family default
2455 \family default
2456 \series default
2456 \series default
2457 Only
2457 Only
2458 \emph on
2458 \emph on
2459 one
2459 one
2460 \emph default
2460 \emph default
2461 of these can be given, and it can only be given as the first option passed
2461 of these can be given, and it can only be given as the first option passed
2462 to IPython (it will have no effect in any other position).
2462 to IPython (it will have no effect in any other position).
2463 They provide threading support for the GTK Qt and WXPython toolkits, and
2463 They provide threading support for the GTK Qt and WXPython toolkits, and
2464 for the matplotlib library.
2464 for the matplotlib library.
2465 \layout List
2465 \layout List
2466 \labelwidthstring 00.00.0000
2466 \labelwidthstring 00.00.0000
2467
2467
2468 \SpecialChar ~
2468 \SpecialChar ~
2469 With any of the first three options, IPython starts running a separate
2469 With any of the first three options, IPython starts running a separate
2470 thread for the graphical toolkit's operation, so that you can open and
2470 thread for the graphical toolkit's operation, so that you can open and
2471 control graphical elements from within an IPython command line, without
2471 control graphical elements from within an IPython command line, without
2472 blocking.
2472 blocking.
2473 All three provide essentially the same functionality, respectively for
2473 All three provide essentially the same functionality, respectively for
2474 GTK, QT and WXWidgets (via their Python interfaces).
2474 GTK, QT and WXWidgets (via their Python interfaces).
2475 \layout List
2475 \layout List
2476 \labelwidthstring 00.00.0000
2476 \labelwidthstring 00.00.0000
2477
2477
2478 \SpecialChar ~
2478 \SpecialChar ~
2479 If
2479 If
2480 \family typewriter
2480 \family typewriter
2481 -pylab
2481 -pylab
2482 \family default
2482 \family default
2483 is given, IPython loads special support for the mat plotlib library (
2483 is given, IPython loads special support for the mat plotlib library (
2484 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
2484 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
2485
2485
2486 \end_inset
2486 \end_inset
2487
2487
2488 ), allowing interactive usage of any of its backends as defined in the user's
2488 ), allowing interactive usage of any of its backends as defined in the user's
2489
2489
2490 \family typewriter
2490 \family typewriter
2491 ~/.matplotlib/matplotlibrc
2491 ~/.matplotlib/matplotlibrc
2492 \family default
2492 \family default
2493 file.
2493 file.
2494 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
2494 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
2495 of matplotlib backend requires it.
2495 of matplotlib backend requires it.
2496 It also modifies the
2496 It also modifies the
2497 \family typewriter
2497 \family typewriter
2498 %run
2498 %run
2499 \family default
2499 \family default
2500 command to correctly execute (without blocking) any matplotlib-based script
2500 command to correctly execute (without blocking) any matplotlib-based script
2501 which calls
2501 which calls
2502 \family typewriter
2502 \family typewriter
2503 show()
2503 show()
2504 \family default
2504 \family default
2505 at the end.
2505 at the end.
2506
2506
2507 \layout List
2507 \layout List
2508 \labelwidthstring 00.00.0000
2508 \labelwidthstring 00.00.0000
2509
2509
2510
2510
2511 \family typewriter
2511 \family typewriter
2512 \series bold
2512 \series bold
2513 -tk
2513 -tk
2514 \family default
2514 \family default
2515 \series default
2515 \series default
2516 The
2516 The
2517 \family typewriter
2517 \family typewriter
2518 -g/q/wthread
2518 -g/q/wthread
2519 \family default
2519 \family default
2520 options, and
2520 options, and
2521 \family typewriter
2521 \family typewriter
2522 -pylab
2522 -pylab
2523 \family default
2523 \family default
2524 (if matplotlib is configured to use GTK, Qt or WX), will normally block
2524 (if matplotlib is configured to use GTK, Qt or WX), will normally block
2525 Tk graphical interfaces.
2525 Tk graphical interfaces.
2526 This means that when either GTK, Qt or WX threading is active, any attempt
2526 This means that when either GTK, Qt or WX threading is active, any attempt
2527 to open a Tk GUI will result in a dead window, and possibly cause the Python
2527 to open a Tk GUI will result in a dead window, and possibly cause the Python
2528 interpreter to crash.
2528 interpreter to crash.
2529 An extra option,
2529 An extra option,
2530 \family typewriter
2530 \family typewriter
2531 -tk
2531 -tk
2532 \family default
2532 \family default
2533 , is available to address this issue.
2533 , is available to address this issue.
2534 It can
2534 It can
2535 \emph on
2535 \emph on
2536 only
2536 only
2537 \emph default
2537 \emph default
2538 be given as a
2538 be given as a
2539 \emph on
2539 \emph on
2540 second
2540 second
2541 \emph default
2541 \emph default
2542 option after any of the above (
2542 option after any of the above (
2543 \family typewriter
2543 \family typewriter
2544 -gthread
2544 -gthread
2545 \family default
2545 \family default
2546 ,
2546 ,
2547 \family typewriter
2547 \family typewriter
2548 -wthread
2548 -wthread
2549 \family default
2549 \family default
2550 or
2550 or
2551 \family typewriter
2551 \family typewriter
2552 -pylab
2552 -pylab
2553 \family default
2553 \family default
2554 ).
2554 ).
2555 \layout List
2555 \layout List
2556 \labelwidthstring 00.00.0000
2556 \labelwidthstring 00.00.0000
2557
2557
2558 \SpecialChar ~
2558 \SpecialChar ~
2559 If
2559 If
2560 \family typewriter
2560 \family typewriter
2561 -tk
2561 -tk
2562 \family default
2562 \family default
2563 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
2563 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
2564 This is however potentially unreliable, and you will have to test on your
2564 This is however potentially unreliable, and you will have to test on your
2565 platform and Python configuration to determine whether it works for you.
2565 platform and Python configuration to determine whether it works for you.
2566 Debian users have reported success, apparently due to the fact that Debian
2566 Debian users have reported success, apparently due to the fact that Debian
2567 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
2567 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
2568 Under other Linux environments (such as Fedora Core 2/3), this option has
2568 Under other Linux environments (such as Fedora Core 2/3), this option has
2569 caused random crashes and lockups of the Python interpreter.
2569 caused random crashes and lockups of the Python interpreter.
2570 Under other operating systems (Mac OSX and Windows), you'll need to try
2570 Under other operating systems (Mac OSX and Windows), you'll need to try
2571 it to find out, since currently no user reports are available.
2571 it to find out, since currently no user reports are available.
2572 \layout List
2572 \layout List
2573 \labelwidthstring 00.00.0000
2573 \labelwidthstring 00.00.0000
2574
2574
2575 \SpecialChar ~
2575 \SpecialChar ~
2576 There is unfortunately no way for IPython to determine at run time whether
2576 There is unfortunately no way for IPython to determine at run time whether
2577
2577
2578 \family typewriter
2578 \family typewriter
2579 -tk
2579 -tk
2580 \family default
2580 \family default
2581 will work reliably or not, so you will need to do some experiments before
2581 will work reliably or not, so you will need to do some experiments before
2582 relying on it for regular work.
2582 relying on it for regular work.
2583
2583
2584 \layout Subsection
2584 \layout Subsection
2585
2585
2586
2586
2587 \begin_inset LatexCommand \label{sec:cmd-line-opts}
2587 \begin_inset LatexCommand \label{sec:cmd-line-opts}
2588
2588
2589 \end_inset
2589 \end_inset
2590
2590
2591 Regular Options
2591 Regular Options
2592 \layout Standard
2592 \layout Standard
2593
2593
2594 After the above threading options have been given, regular options can follow
2594 After the above threading options have been given, regular options can follow
2595 in any order.
2595 in any order.
2596 All options can be abbreviated to their shortest non-ambiguous form and
2596 All options can be abbreviated to their shortest non-ambiguous form and
2597 are case-sensitive.
2597 are case-sensitive.
2598 One or two dashes can be used.
2598 One or two dashes can be used.
2599 Some options have an alternate short form, indicated after a
2599 Some options have an alternate short form, indicated after a
2600 \family typewriter
2600 \family typewriter
2601 |
2601 |
2602 \family default
2602 \family default
2603 .
2603 .
2604 \layout Standard
2604 \layout Standard
2605
2605
2606 Most options can also be set from your ipythonrc configuration file.
2606 Most options can also be set from your ipythonrc configuration file.
2607 See the provided example for more details on what the options do.
2607 See the provided example for more details on what the options do.
2608 Options given at the command line override the values set in the ipythonrc
2608 Options given at the command line override the values set in the ipythonrc
2609 file.
2609 file.
2610 \layout Standard
2610 \layout Standard
2611
2611
2612 All options with a
2612 All options with a
2613 \family typewriter
2613 \family typewriter
2614 [no]
2614 [no]
2615 \family default
2615 \family default
2616 prepended can be specified in negated form (
2616 prepended can be specified in negated form (
2617 \family typewriter
2617 \family typewriter
2618 -nooption
2618 -nooption
2619 \family default
2619 \family default
2620 instead of
2620 instead of
2621 \family typewriter
2621 \family typewriter
2622 -option
2622 -option
2623 \family default
2623 \family default
2624 ) to turn the feature off.
2624 ) to turn the feature off.
2625 \layout List
2625 \layout List
2626 \labelwidthstring 00.00.0000
2626 \labelwidthstring 00.00.0000
2627
2627
2628
2628
2629 \family typewriter
2629 \family typewriter
2630 \series bold
2630 \series bold
2631 -help
2631 -help
2632 \family default
2632 \family default
2633 \series default
2633 \series default
2634 : print a help message and exit.
2634 : print a help message and exit.
2635 \layout List
2635 \layout List
2636 \labelwidthstring 00.00.0000
2636 \labelwidthstring 00.00.0000
2637
2637
2638
2638
2639 \family typewriter
2639 \family typewriter
2640 \series bold
2640 \series bold
2641 -pylab:
2641 -pylab:
2642 \family default
2642 \family default
2643 \series default
2643 \series default
2644 this can
2644 this can
2645 \emph on
2645 \emph on
2646 only
2646 only
2647 \emph default
2647 \emph default
2648 be given as the
2648 be given as the
2649 \emph on
2649 \emph on
2650 first
2650 first
2651 \emph default
2651 \emph default
2652 option passed to IPython (it will have no effect in any other position).
2652 option passed to IPython (it will have no effect in any other position).
2653 It adds special support for the matplotlib library (
2653 It adds special support for the matplotlib library (
2654 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
2654 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
2655
2655
2656 \end_inset
2656 \end_inset
2657
2657
2658 ), allowing interactive usage of any of its backends as defined in the user's
2658 ), allowing interactive usage of any of its backends as defined in the user's
2659
2659
2660 \family typewriter
2660 \family typewriter
2661 .matplotlibrc
2661 .matplotlibrc
2662 \family default
2662 \family default
2663 file.
2663 file.
2664 It automatically activates GTK or WX threading for IPyhton if the choice
2664 It automatically activates GTK or WX threading for IPyhton if the choice
2665 of matplotlib backend requires it.
2665 of matplotlib backend requires it.
2666 It also modifies the
2666 It also modifies the
2667 \family typewriter
2667 \family typewriter
2668 %run
2668 %run
2669 \family default
2669 \family default
2670 command to correctly execute (without blocking) any matplotlib-based script
2670 command to correctly execute (without blocking) any matplotlib-based script
2671 which calls
2671 which calls
2672 \family typewriter
2672 \family typewriter
2673 show()
2673 show()
2674 \family default
2674 \family default
2675 at the end.
2675 at the end.
2676 See Sec.\SpecialChar ~
2676 See Sec.\SpecialChar ~
2677
2677
2678 \begin_inset LatexCommand \ref{sec:matplotlib-support}
2678 \begin_inset LatexCommand \ref{sec:matplotlib-support}
2679
2679
2680 \end_inset
2680 \end_inset
2681
2681
2682 for more details.
2682 for more details.
2683 \layout List
2683 \layout List
2684 \labelwidthstring 00.00.0000
2684 \labelwidthstring 00.00.0000
2685
2685
2686
2686
2687 \family typewriter
2687 \family typewriter
2688 \series bold
2688 \series bold
2689 -[no]autocall:
2689 -[no]autocall:
2690 \family default
2690 \family default
2691 \series default
2691 \series default
2692 Make IPython automatically call any callable object even if you didn't
2692 Make IPython automatically call any callable object even if you didn't
2693 type explicit parentheses.
2693 type explicit parentheses.
2694 For example, `str 43' becomes `str(43)' automatically.
2694 For example, `str 43' becomes `str(43)' automatically.
2695 \layout List
2695 \layout List
2696 \labelwidthstring 00.00.0000
2696 \labelwidthstring 00.00.0000
2697
2697
2698
2698
2699 \family typewriter
2699 \family typewriter
2700 \series bold
2700 \series bold
2701 -[no]autoindent:
2701 -[no]autoindent:
2702 \family default
2702 \family default
2703 \series default
2703 \series default
2704 Turn automatic indentation on/off.
2704 Turn automatic indentation on/off.
2705 \layout List
2705 \layout List
2706 \labelwidthstring 00.00.0000
2706 \labelwidthstring 00.00.0000
2707
2707
2708
2708
2709 \family typewriter
2709 \family typewriter
2710 \series bold
2710 \series bold
2711 -[no]automagic
2711 -[no]automagic
2712 \series default
2712 \series default
2713 :
2713 :
2714 \family default
2714 \family default
2715 make magic commands automatic (without needing their first character to
2715 make magic commands automatic (without needing their first character to
2716 be
2716 be
2717 \family typewriter
2717 \family typewriter
2718 %
2718 %
2719 \family default
2719 \family default
2720 ).
2720 ).
2721 Type
2721 Type
2722 \family typewriter
2722 \family typewriter
2723 %magic
2723 %magic
2724 \family default
2724 \family default
2725 at the IPython prompt for more information.
2725 at the IPython prompt for more information.
2726 \layout List
2726 \layout List
2727 \labelwidthstring 00.00.0000
2727 \labelwidthstring 00.00.0000
2728
2728
2729
2729
2730 \family typewriter
2730 \family typewriter
2731 \series bold
2731 \series bold
2732 -[no]autoedit_syntax:
2732 -[no]autoedit_syntax:
2733 \family default
2733 \family default
2734 \series default
2734 \series default
2735 When a syntax error occurs after editing a file, automatically open the
2735 When a syntax error occurs after editing a file, automatically open the
2736 file to the trouble causing line for convenient fixing.
2736 file to the trouble causing line for convenient fixing.
2737
2737
2738 \layout List
2738 \layout List
2739 \labelwidthstring 00.00.0000
2739 \labelwidthstring 00.00.0000
2740
2740
2741
2741
2742 \family typewriter
2742 \family typewriter
2743 \series bold
2743 \series bold
2744 -[no]banner
2744 -[no]banner
2745 \series default
2745 \series default
2746 :
2746 :
2747 \family default
2747 \family default
2748 Print the initial information banner (default on).
2748 Print the initial information banner (default on).
2749 \layout List
2749 \layout List
2750 \labelwidthstring 00.00.0000
2750 \labelwidthstring 00.00.0000
2751
2751
2752
2752
2753 \family typewriter
2753 \family typewriter
2754 \series bold
2754 \series bold
2755 -c\SpecialChar ~
2755 -c\SpecialChar ~
2756 <command>:
2756 <command>:
2757 \family default
2757 \family default
2758 \series default
2758 \series default
2759 execute the given command string, and set sys.argv to
2759 execute the given command string, and set sys.argv to
2760 \family typewriter
2760 \family typewriter
2761 ['c']
2761 ['c']
2762 \family default
2762 \family default
2763 .
2763 .
2764 This is similar to the
2764 This is similar to the
2765 \family typewriter
2765 \family typewriter
2766 -c
2766 -c
2767 \family default
2767 \family default
2768 option in the normal Python interpreter.
2768 option in the normal Python interpreter.
2769
2769
2770 \layout List
2770 \layout List
2771 \labelwidthstring 00.00.0000
2771 \labelwidthstring 00.00.0000
2772
2772
2773
2773
2774 \family typewriter
2774 \family typewriter
2775 \series bold
2775 \series bold
2776 -cache_size|cs\SpecialChar ~
2776 -cache_size|cs\SpecialChar ~
2777 <n>
2777 <n>
2778 \series default
2778 \series default
2779 :
2779 :
2780 \family default
2780 \family default
2781 size of the output cache (maximum number of entries to hold in memory).
2781 size of the output cache (maximum number of entries to hold in memory).
2782 The default is 1000, you can change it permanently in your config file.
2782 The default is 1000, you can change it permanently in your config file.
2783 Setting it to 0 completely disables the caching system, and the minimum
2783 Setting it to 0 completely disables the caching system, and the minimum
2784 value accepted is 20 (if you provide a value less than 20, it is reset
2784 value accepted is 20 (if you provide a value less than 20, it is reset
2785 to 0 and a warning is issued) This limit is defined because otherwise you'll
2785 to 0 and a warning is issued) This limit is defined because otherwise you'll
2786 spend more time re-flushing a too small cache than working.
2786 spend more time re-flushing a too small cache than working.
2787 \layout List
2787 \layout List
2788 \labelwidthstring 00.00.0000
2788 \labelwidthstring 00.00.0000
2789
2789
2790
2790
2791 \family typewriter
2791 \family typewriter
2792 \series bold
2792 \series bold
2793 -classic|cl
2793 -classic|cl
2794 \series default
2794 \series default
2795 :
2795 :
2796 \family default
2796 \family default
2797 Gives IPython a similar feel to the classic Python prompt.
2797 Gives IPython a similar feel to the classic Python prompt.
2798 \layout List
2798 \layout List
2799 \labelwidthstring 00.00.0000
2799 \labelwidthstring 00.00.0000
2800
2800
2801
2801
2802 \family typewriter
2802 \family typewriter
2803 \series bold
2803 \series bold
2804 -colors\SpecialChar ~
2804 -colors\SpecialChar ~
2805 <scheme>:
2805 <scheme>:
2806 \family default
2806 \family default
2807 \series default
2807 \series default
2808 Color scheme for prompts and exception reporting.
2808 Color scheme for prompts and exception reporting.
2809 Currently implemented: NoColor, Linux and LightBG.
2809 Currently implemented: NoColor, Linux and LightBG.
2810 \layout List
2810 \layout List
2811 \labelwidthstring 00.00.0000
2811 \labelwidthstring 00.00.0000
2812
2812
2813
2813
2814 \family typewriter
2814 \family typewriter
2815 \series bold
2815 \series bold
2816 -[no]color_info:
2816 -[no]color_info:
2817 \family default
2817 \family default
2818 \series default
2818 \series default
2819 IPython can display information about objects via a set of functions, and
2819 IPython can display information about objects via a set of functions, and
2820 optionally can use colors for this, syntax highlighting source code and
2820 optionally can use colors for this, syntax highlighting source code and
2821 various other elements.
2821 various other elements.
2822 However, because this information is passed through a pager (like 'less')
2822 However, because this information is passed through a pager (like 'less')
2823 and many pagers get confused with color codes, this option is off by default.
2823 and many pagers get confused with color codes, this option is off by default.
2824 You can test it and turn it on permanently in your ipythonrc file if it
2824 You can test it and turn it on permanently in your ipythonrc file if it
2825 works for you.
2825 works for you.
2826 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
2826 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
2827 that in RedHat 7.2 doesn't.
2827 that in RedHat 7.2 doesn't.
2828 \layout List
2828 \layout List
2829 \labelwidthstring 00.00.0000
2829 \labelwidthstring 00.00.0000
2830
2830
2831 \SpecialChar ~
2831 \SpecialChar ~
2832 Test it and turn it on permanently if it works with your system.
2832 Test it and turn it on permanently if it works with your system.
2833 The magic function
2833 The magic function
2834 \family typewriter
2834 \family typewriter
2835 %color_info
2835 %color_info
2836 \family default
2836 \family default
2837 allows you to toggle this interactively for testing.
2837 allows you to toggle this interactively for testing.
2838 \layout List
2838 \layout List
2839 \labelwidthstring 00.00.0000
2839 \labelwidthstring 00.00.0000
2840
2840
2841
2841
2842 \family typewriter
2842 \family typewriter
2843 \series bold
2843 \series bold
2844 -[no]debug
2844 -[no]debug
2845 \family default
2845 \family default
2846 \series default
2846 \series default
2847 : Show information about the loading process.
2847 : Show information about the loading process.
2848 Very useful to pin down problems with your configuration files or to get
2848 Very useful to pin down problems with your configuration files or to get
2849 details about session restores.
2849 details about session restores.
2850 \layout List
2850 \layout List
2851 \labelwidthstring 00.00.0000
2851 \labelwidthstring 00.00.0000
2852
2852
2853
2853
2854 \family typewriter
2854 \family typewriter
2855 \series bold
2855 \series bold
2856 -[no]deep_reload
2856 -[no]deep_reload
2857 \series default
2857 \series default
2858 :
2858 :
2859 \family default
2859 \family default
2860 IPython can use the
2860 IPython can use the
2861 \family typewriter
2861 \family typewriter
2862 deep_reload
2862 deep_reload
2863 \family default
2863 \family default
2864 module which reloads changes in modules recursively (it replaces the
2864 module which reloads changes in modules recursively (it replaces the
2865 \family typewriter
2865 \family typewriter
2866 reload()
2866 reload()
2867 \family default
2867 \family default
2868 function, so you don't need to change anything to use it).
2868 function, so you don't need to change anything to use it).
2869
2869
2870 \family typewriter
2870 \family typewriter
2871 deep_reload()
2871 deep_reload()
2872 \family default
2872 \family default
2873 forces a full reload of modules whose code may have changed, which the
2873 forces a full reload of modules whose code may have changed, which the
2874 default
2874 default
2875 \family typewriter
2875 \family typewriter
2876 reload()
2876 reload()
2877 \family default
2877 \family default
2878 function does not.
2878 function does not.
2879 \layout List
2879 \layout List
2880 \labelwidthstring 00.00.0000
2880 \labelwidthstring 00.00.0000
2881
2881
2882 \SpecialChar ~
2882 \SpecialChar ~
2883 When deep_reload is off, IPython will use the normal
2883 When deep_reload is off, IPython will use the normal
2884 \family typewriter
2884 \family typewriter
2885 reload()
2885 reload()
2886 \family default
2886 \family default
2887 , but deep_reload will still be available as
2887 , but deep_reload will still be available as
2888 \family typewriter
2888 \family typewriter
2889 dreload()
2889 dreload()
2890 \family default
2890 \family default
2891 .
2891 .
2892 This feature is off by default [which means that you have both normal
2892 This feature is off by default [which means that you have both normal
2893 \family typewriter
2893 \family typewriter
2894 reload()
2894 reload()
2895 \family default
2895 \family default
2896 and
2896 and
2897 \family typewriter
2897 \family typewriter
2898 dreload()
2898 dreload()
2899 \family default
2899 \family default
2900 ].
2900 ].
2901 \layout List
2901 \layout List
2902 \labelwidthstring 00.00.0000
2902 \labelwidthstring 00.00.0000
2903
2903
2904
2904
2905 \family typewriter
2905 \family typewriter
2906 \series bold
2906 \series bold
2907 -editor\SpecialChar ~
2907 -editor\SpecialChar ~
2908 <name>
2908 <name>
2909 \family default
2909 \family default
2910 \series default
2910 \series default
2911 : Which editor to use with the
2911 : Which editor to use with the
2912 \family typewriter
2912 \family typewriter
2913 %edit
2913 %edit
2914 \family default
2914 \family default
2915 command.
2915 command.
2916 By default, IPython will honor your
2916 By default, IPython will honor your
2917 \family typewriter
2917 \family typewriter
2918 EDITOR
2918 EDITOR
2919 \family default
2919 \family default
2920 environment variable (if not set, vi is the Unix default and notepad the
2920 environment variable (if not set, vi is the Unix default and notepad the
2921 Windows one).
2921 Windows one).
2922 Since this editor is invoked on the fly by IPython and is meant for editing
2922 Since this editor is invoked on the fly by IPython and is meant for editing
2923 small code snippets, you may want to use a small, lightweight editor here
2923 small code snippets, you may want to use a small, lightweight editor here
2924 (in case your default
2924 (in case your default
2925 \family typewriter
2925 \family typewriter
2926 EDITOR
2926 EDITOR
2927 \family default
2927 \family default
2928 is something like Emacs).
2928 is something like Emacs).
2929 \layout List
2929 \layout List
2930 \labelwidthstring 00.00.0000
2930 \labelwidthstring 00.00.0000
2931
2931
2932
2932
2933 \family typewriter
2933 \family typewriter
2934 \series bold
2934 \series bold
2935 -ipythondir\SpecialChar ~
2935 -ipythondir\SpecialChar ~
2936 <name>
2936 <name>
2937 \series default
2937 \series default
2938 :
2938 :
2939 \family default
2939 \family default
2940 name of your IPython configuration directory
2940 name of your IPython configuration directory
2941 \family typewriter
2941 \family typewriter
2942 IPYTHONDIR
2942 IPYTHONDIR
2943 \family default
2943 \family default
2944 .
2944 .
2945 This can also be specified through the environment variable
2945 This can also be specified through the environment variable
2946 \family typewriter
2946 \family typewriter
2947 IPYTHONDIR
2947 IPYTHONDIR
2948 \family default
2948 \family default
2949 .
2949 .
2950 \layout List
2950 \layout List
2951 \labelwidthstring 00.00.0000
2951 \labelwidthstring 00.00.0000
2952
2952
2953
2953
2954 \family typewriter
2954 \family typewriter
2955 \series bold
2955 \series bold
2956 -log|l
2956 -log|l
2957 \family default
2957 \family default
2958 \series default
2958 \series default
2959 : generate a log file of all input.
2959 : generate a log file of all input.
2960 The file is named
2960 The file is named
2961 \family typewriter
2961 \family typewriter
2962 ipython_log.py
2962 ipython_log.py
2963 \family default
2963 \family default
2964 in your current directory (which prevents logs from multiple IPython sessions
2964 in your current directory (which prevents logs from multiple IPython sessions
2965 from trampling each other).
2965 from trampling each other).
2966 You can use this to later restore a session by loading your logfile as
2966 You can use this to later restore a session by loading your logfile as
2967 a file to be executed with option
2967 a file to be executed with option
2968 \family typewriter
2968 \family typewriter
2969 -logplay
2969 -logplay
2970 \family default
2970 \family default
2971 (see below).
2971 (see below).
2972 \layout List
2972 \layout List
2973 \labelwidthstring 00.00.0000
2973 \labelwidthstring 00.00.0000
2974
2974
2975
2975
2976 \family typewriter
2976 \family typewriter
2977 \series bold
2977 \series bold
2978 -logfile|lf\SpecialChar ~
2978 -logfile|lf\SpecialChar ~
2979 <name>
2979 <name>
2980 \series default
2980 \series default
2981 :
2981 :
2982 \family default
2982 \family default
2983 specify the name of your logfile.
2983 specify the name of your logfile.
2984 \layout List
2984 \layout List
2985 \labelwidthstring 00.00.0000
2985 \labelwidthstring 00.00.0000
2986
2986
2987
2987
2988 \family typewriter
2988 \family typewriter
2989 \series bold
2989 \series bold
2990 -logplay|lp\SpecialChar ~
2990 -logplay|lp\SpecialChar ~
2991 <name>
2991 <name>
2992 \series default
2992 \series default
2993 :
2993 :
2994 \family default
2994 \family default
2995 you can replay a previous log.
2995 you can replay a previous log.
2996 For restoring a session as close as possible to the state you left it in,
2996 For restoring a session as close as possible to the state you left it in,
2997 use this option (don't just run the logfile).
2997 use this option (don't just run the logfile).
2998 With
2998 With
2999 \family typewriter
2999 \family typewriter
3000 -logplay
3000 -logplay
3001 \family default
3001 \family default
3002 , IPython will try to reconstruct the previous working environment in full,
3002 , IPython will try to reconstruct the previous working environment in full,
3003 not just execute the commands in the logfile.
3003 not just execute the commands in the logfile.
3004 \layout List
3004 \layout List
3005 \labelwidthstring 00.00.0000
3005 \labelwidthstring 00.00.0000
3006
3006
3007 \SpecialChar ~
3007 \SpecialChar ~
3008 When a session is restored, logging is automatically turned on again with
3008 When a session is restored, logging is automatically turned on again with
3009 the name of the logfile it was invoked with (it is read from the log header).
3009 the name of the logfile it was invoked with (it is read from the log header).
3010 So once you've turned logging on for a session, you can quit IPython and
3010 So once you've turned logging on for a session, you can quit IPython and
3011 reload it as many times as you want and it will continue to log its history
3011 reload it as many times as you want and it will continue to log its history
3012 and restore from the beginning every time.
3012 and restore from the beginning every time.
3013 \layout List
3013 \layout List
3014 \labelwidthstring 00.00.0000
3014 \labelwidthstring 00.00.0000
3015
3015
3016 \SpecialChar ~
3016 \SpecialChar ~
3017 Caveats: there are limitations in this option.
3017 Caveats: there are limitations in this option.
3018 The history variables
3018 The history variables
3019 \family typewriter
3019 \family typewriter
3020 _i*
3020 _i*
3021 \family default
3021 \family default
3022 ,
3022 ,
3023 \family typewriter
3023 \family typewriter
3024 _*
3024 _*
3025 \family default
3025 \family default
3026 and
3026 and
3027 \family typewriter
3027 \family typewriter
3028 _dh
3028 _dh
3029 \family default
3029 \family default
3030 don't get restored properly.
3030 don't get restored properly.
3031 In the future we will try to implement full session saving by writing and
3031 In the future we will try to implement full session saving by writing and
3032 retrieving a 'snapshot' of the memory state of IPython.
3032 retrieving a 'snapshot' of the memory state of IPython.
3033 But our first attempts failed because of inherent limitations of Python's
3033 But our first attempts failed because of inherent limitations of Python's
3034 Pickle module, so this may have to wait.
3034 Pickle module, so this may have to wait.
3035 \layout List
3035 \layout List
3036 \labelwidthstring 00.00.0000
3036 \labelwidthstring 00.00.0000
3037
3037
3038
3038
3039 \family typewriter
3039 \family typewriter
3040 \series bold
3040 \series bold
3041 -[no]messages
3041 -[no]messages
3042 \series default
3042 \series default
3043 :
3043 :
3044 \family default
3044 \family default
3045 Print messages which IPython collects about its startup process (default
3045 Print messages which IPython collects about its startup process (default
3046 on).
3046 on).
3047 \layout List
3047 \layout List
3048 \labelwidthstring 00.00.0000
3048 \labelwidthstring 00.00.0000
3049
3049
3050
3050
3051 \family typewriter
3051 \family typewriter
3052 \series bold
3052 \series bold
3053 -[no]pdb
3053 -[no]pdb
3054 \family default
3054 \family default
3055 \series default
3055 \series default
3056 : Automatically call the pdb debugger after every uncaught exception.
3056 : Automatically call the pdb debugger after every uncaught exception.
3057 If you are used to debugging using pdb, this puts you automatically inside
3057 If you are used to debugging using pdb, this puts you automatically inside
3058 of it after any call (either in IPython or in code called by it) which
3058 of it after any call (either in IPython or in code called by it) which
3059 triggers an exception which goes uncaught.
3059 triggers an exception which goes uncaught.
3060 \layout List
3060 \layout List
3061 \labelwidthstring 00.00.0000
3061 \labelwidthstring 00.00.0000
3062
3062
3063
3063
3064 \family typewriter
3064 \family typewriter
3065 \series bold
3065 \series bold
3066 -[no]pprint
3066 -[no]pprint
3067 \series default
3067 \series default
3068 :
3068 :
3069 \family default
3069 \family default
3070 ipython can optionally use the pprint (pretty printer) module for displaying
3070 ipython can optionally use the pprint (pretty printer) module for displaying
3071 results.
3071 results.
3072 pprint tends to give a nicer display of nested data structures.
3072 pprint tends to give a nicer display of nested data structures.
3073 If you like it, you can turn it on permanently in your config file (default
3073 If you like it, you can turn it on permanently in your config file (default
3074 off).
3074 off).
3075 \layout List
3075 \layout List
3076 \labelwidthstring 00.00.0000
3076 \labelwidthstring 00.00.0000
3077
3077
3078
3078
3079 \family typewriter
3079 \family typewriter
3080 \series bold
3080 \series bold
3081 -profile|p <name>
3081 -profile|p <name>
3082 \series default
3082 \series default
3083 :
3083 :
3084 \family default
3084 \family default
3085 assume that your config file is
3085 assume that your config file is
3086 \family typewriter
3086 \family typewriter
3087 ipythonrc-<name>
3087 ipythonrc-<name>
3088 \family default
3088 \family default
3089 (looks in current dir first, then in
3089 (looks in current dir first, then in
3090 \family typewriter
3090 \family typewriter
3091 IPYTHONDIR
3091 IPYTHONDIR
3092 \family default
3092 \family default
3093 ).
3093 ).
3094 This is a quick way to keep and load multiple config files for different
3094 This is a quick way to keep and load multiple config files for different
3095 tasks, especially if you use the include option of config files.
3095 tasks, especially if you use the include option of config files.
3096 You can keep a basic
3096 You can keep a basic
3097 \family typewriter
3097 \family typewriter
3098 IPYTHONDIR/ipythonrc
3098 IPYTHONDIR/ipythonrc
3099 \family default
3099 \family default
3100 file and then have other 'profiles' which include this one and load extra
3100 file and then have other 'profiles' which include this one and load extra
3101 things for particular tasks.
3101 things for particular tasks.
3102 For example:
3102 For example:
3103 \layout List
3103 \layout List
3104 \labelwidthstring 00.00.0000
3104 \labelwidthstring 00.00.0000
3105
3105
3106
3106
3107 \family typewriter
3107 \family typewriter
3108 \SpecialChar ~
3108 \SpecialChar ~
3109
3109
3110 \family default
3110 \family default
3111 1.
3111 1.
3112
3112
3113 \family typewriter
3113 \family typewriter
3114 $HOME/.ipython/ipythonrc
3114 $HOME/.ipython/ipythonrc
3115 \family default
3115 \family default
3116 : load basic things you always want.
3116 : load basic things you always want.
3117 \layout List
3117 \layout List
3118 \labelwidthstring 00.00.0000
3118 \labelwidthstring 00.00.0000
3119
3119
3120
3120
3121 \family typewriter
3121 \family typewriter
3122 \SpecialChar ~
3122 \SpecialChar ~
3123
3123
3124 \family default
3124 \family default
3125 2.
3125 2.
3126
3126
3127 \family typewriter
3127 \family typewriter
3128 $HOME/.ipython/ipythonrc-math
3128 $HOME/.ipython/ipythonrc-math
3129 \family default
3129 \family default
3130 : load (1) and basic math-related modules.
3130 : load (1) and basic math-related modules.
3131
3131
3132 \layout List
3132 \layout List
3133 \labelwidthstring 00.00.0000
3133 \labelwidthstring 00.00.0000
3134
3134
3135
3135
3136 \family typewriter
3136 \family typewriter
3137 \SpecialChar ~
3137 \SpecialChar ~
3138
3138
3139 \family default
3139 \family default
3140 3.
3140 3.
3141
3141
3142 \family typewriter
3142 \family typewriter
3143 $HOME/.ipython/ipythonrc-numeric
3143 $HOME/.ipython/ipythonrc-numeric
3144 \family default
3144 \family default
3145 : load (1) and Numeric and plotting modules.
3145 : load (1) and Numeric and plotting modules.
3146 \layout List
3146 \layout List
3147 \labelwidthstring 00.00.0000
3147 \labelwidthstring 00.00.0000
3148
3148
3149 \SpecialChar ~
3149 \SpecialChar ~
3150 Since it is possible to create an endless loop by having circular file
3150 Since it is possible to create an endless loop by having circular file
3151 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3151 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3152 \layout List
3152 \layout List
3153 \labelwidthstring 00.00.0000
3153 \labelwidthstring 00.00.0000
3154
3154
3155
3155
3156 \family typewriter
3156 \family typewriter
3157 \series bold
3157 \series bold
3158 -prompt_in1|pi1\SpecialChar ~
3158 -prompt_in1|pi1\SpecialChar ~
3159 <string>:
3159 <string>:
3160 \family default
3160 \family default
3161 \series default
3161 \series default
3162 Specify the string used for input prompts.
3162 Specify the string used for input prompts.
3163 Note that if you are using numbered prompts, the number is represented
3163 Note that if you are using numbered prompts, the number is represented
3164 with a '
3164 with a '
3165 \backslash
3165 \backslash
3166 #' in the string.
3166 #' in the string.
3167 Don't forget to quote strings with spaces embedded in them.
3167 Don't forget to quote strings with spaces embedded in them.
3168 Default: '
3168 Default: '
3169 \family typewriter
3169 \family typewriter
3170 In\SpecialChar ~
3170 In\SpecialChar ~
3171 [
3171 [
3172 \backslash
3172 \backslash
3173 #]:
3173 #]:
3174 \family default
3174 \family default
3175 '.
3175 '.
3176 Sec.\SpecialChar ~
3176 Sec.\SpecialChar ~
3177
3177
3178 \begin_inset LatexCommand \ref{sec:prompts}
3178 \begin_inset LatexCommand \ref{sec:prompts}
3179
3179
3180 \end_inset
3180 \end_inset
3181
3181
3182 discusses in detail all the available escapes to customize your prompts.
3182 discusses in detail all the available escapes to customize your prompts.
3183 \layout List
3183 \layout List
3184 \labelwidthstring 00.00.0000
3184 \labelwidthstring 00.00.0000
3185
3185
3186
3186
3187 \family typewriter
3187 \family typewriter
3188 \series bold
3188 \series bold
3189 -prompt_in2|pi2\SpecialChar ~
3189 -prompt_in2|pi2\SpecialChar ~
3190 <string>:
3190 <string>:
3191 \family default
3191 \family default
3192 \series default
3192 \series default
3193 Similar to the previous option, but used for the continuation prompts.
3193 Similar to the previous option, but used for the continuation prompts.
3194 The special sequence '
3194 The special sequence '
3195 \family typewriter
3195 \family typewriter
3196
3196
3197 \backslash
3197 \backslash
3198 D
3198 D
3199 \family default
3199 \family default
3200 ' is similar to '
3200 ' is similar to '
3201 \family typewriter
3201 \family typewriter
3202
3202
3203 \backslash
3203 \backslash
3204 #
3204 #
3205 \family default
3205 \family default
3206 ', but with all digits replaced dots (so you can have your continuation
3206 ', but with all digits replaced dots (so you can have your continuation
3207 prompt aligned with your input prompt).
3207 prompt aligned with your input prompt).
3208 Default: '
3208 Default: '
3209 \family typewriter
3209 \family typewriter
3210 \SpecialChar ~
3210 \SpecialChar ~
3211 \SpecialChar ~
3211 \SpecialChar ~
3212 \SpecialChar ~
3212 \SpecialChar ~
3213 .
3213 .
3214 \backslash
3214 \backslash
3215 D.:
3215 D.:
3216 \family default
3216 \family default
3217 ' (note three spaces at the start for alignment with '
3217 ' (note three spaces at the start for alignment with '
3218 \family typewriter
3218 \family typewriter
3219 In\SpecialChar ~
3219 In\SpecialChar ~
3220 [
3220 [
3221 \backslash
3221 \backslash
3222 #]
3222 #]
3223 \family default
3223 \family default
3224 ').
3224 ').
3225 \layout List
3225 \layout List
3226 \labelwidthstring 00.00.0000
3226 \labelwidthstring 00.00.0000
3227
3227
3228
3228
3229 \family typewriter
3229 \family typewriter
3230 \series bold
3230 \series bold
3231 -prompt_out|po\SpecialChar ~
3231 -prompt_out|po\SpecialChar ~
3232 <string>:
3232 <string>:
3233 \family default
3233 \family default
3234 \series default
3234 \series default
3235 String used for output prompts, also uses numbers like
3235 String used for output prompts, also uses numbers like
3236 \family typewriter
3236 \family typewriter
3237 prompt_in1
3237 prompt_in1
3238 \family default
3238 \family default
3239 .
3239 .
3240 Default: '
3240 Default: '
3241 \family typewriter
3241 \family typewriter
3242 Out[
3242 Out[
3243 \backslash
3243 \backslash
3244 #]:
3244 #]:
3245 \family default
3245 \family default
3246 '
3246 '
3247 \layout List
3247 \layout List
3248 \labelwidthstring 00.00.0000
3248 \labelwidthstring 00.00.0000
3249
3249
3250
3250
3251 \family typewriter
3251 \family typewriter
3252 \series bold
3252 \series bold
3253 -quick
3253 -quick
3254 \family default
3254 \family default
3255 \series default
3255 \series default
3256 : start in bare bones mode (no config file loaded).
3256 : start in bare bones mode (no config file loaded).
3257 \layout List
3257 \layout List
3258 \labelwidthstring 00.00.0000
3258 \labelwidthstring 00.00.0000
3259
3259
3260
3260
3261 \family typewriter
3261 \family typewriter
3262 \series bold
3262 \series bold
3263 -rcfile\SpecialChar ~
3263 -rcfile\SpecialChar ~
3264 <name>
3264 <name>
3265 \series default
3265 \series default
3266 :
3266 :
3267 \family default
3267 \family default
3268 name of your IPython resource configuration file.
3268 name of your IPython resource configuration file.
3269 Normally IPython loads ipythonrc (from current directory) or
3269 Normally IPython loads ipythonrc (from current directory) or
3270 \family typewriter
3270 \family typewriter
3271 IPYTHONDIR/ipythonrc
3271 IPYTHONDIR/ipythonrc
3272 \family default
3272 \family default
3273 .
3273 .
3274 \layout List
3274 \layout List
3275 \labelwidthstring 00.00.0000
3275 \labelwidthstring 00.00.0000
3276
3276
3277 \SpecialChar ~
3277 \SpecialChar ~
3278 If the loading of your config file fails, IPython starts with a bare bones
3278 If the loading of your config file fails, IPython starts with a bare bones
3279 configuration (no modules loaded at all).
3279 configuration (no modules loaded at all).
3280 \layout List
3280 \layout List
3281 \labelwidthstring 00.00.0000
3281 \labelwidthstring 00.00.0000
3282
3282
3283
3283
3284 \family typewriter
3284 \family typewriter
3285 \series bold
3285 \series bold
3286 -[no]readline
3286 -[no]readline
3287 \family default
3287 \family default
3288 \series default
3288 \series default
3289 : use the readline library, which is needed to support name completion and
3289 : use the readline library, which is needed to support name completion and
3290 command history, among other things.
3290 command history, among other things.
3291 It is enabled by default, but may cause problems for users of X/Emacs in
3291 It is enabled by default, but may cause problems for users of X/Emacs in
3292 Python comint or shell buffers.
3292 Python comint or shell buffers.
3293 \layout List
3293 \layout List
3294 \labelwidthstring 00.00.0000
3294 \labelwidthstring 00.00.0000
3295
3295
3296 \SpecialChar ~
3296 \SpecialChar ~
3297 Note that X/Emacs 'eterm' buffers (opened with
3297 Note that X/Emacs 'eterm' buffers (opened with
3298 \family typewriter
3298 \family typewriter
3299 M-x\SpecialChar ~
3299 M-x\SpecialChar ~
3300 term
3300 term
3301 \family default
3301 \family default
3302 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3302 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3303 \family typewriter
3303 \family typewriter
3304 M-x\SpecialChar ~
3304 M-x\SpecialChar ~
3305 shell
3305 shell
3306 \family default
3306 \family default
3307 and
3307 and
3308 \family typewriter
3308 \family typewriter
3309 C-c\SpecialChar ~
3309 C-c\SpecialChar ~
3310 !
3310 !
3311 \family default
3311 \family default
3312 ) buffers do not.
3312 ) buffers do not.
3313 \layout List
3313 \layout List
3314 \labelwidthstring 00.00.0000
3314 \labelwidthstring 00.00.0000
3315
3315
3316
3316
3317 \family typewriter
3317 \family typewriter
3318 \series bold
3318 \series bold
3319 -screen_length|sl\SpecialChar ~
3319 -screen_length|sl\SpecialChar ~
3320 <n>
3320 <n>
3321 \series default
3321 \series default
3322 :
3322 :
3323 \family default
3323 \family default
3324 number of lines of your screen.
3324 number of lines of your screen.
3325 This is used to control printing of very long strings.
3325 This is used to control printing of very long strings.
3326 Strings longer than this number of lines will be sent through a pager instead
3326 Strings longer than this number of lines will be sent through a pager instead
3327 of directly printed.
3327 of directly printed.
3328 \layout List
3328 \layout List
3329 \labelwidthstring 00.00.0000
3329 \labelwidthstring 00.00.0000
3330
3330
3331 \SpecialChar ~
3331 \SpecialChar ~
3332 The default value for this is 0, which means IPython will auto-detect your
3332 The default value for this is 0, which means IPython will auto-detect your
3333 screen size every time it needs to print certain potentially long strings
3333 screen size every time it needs to print certain potentially long strings
3334 (this doesn't change the behavior of the 'print' keyword, it's only triggered
3334 (this doesn't change the behavior of the 'print' keyword, it's only triggered
3335 internally).
3335 internally).
3336 If for some reason this isn't working well (it needs curses support), specify
3336 If for some reason this isn't working well (it needs curses support), specify
3337 it yourself.
3337 it yourself.
3338 Otherwise don't change the default.
3338 Otherwise don't change the default.
3339 \layout List
3339 \layout List
3340 \labelwidthstring 00.00.0000
3340 \labelwidthstring 00.00.0000
3341
3341
3342
3342
3343 \family typewriter
3343 \family typewriter
3344 \series bold
3344 \series bold
3345 -separate_in|si\SpecialChar ~
3345 -separate_in|si\SpecialChar ~
3346 <string>
3346 <string>
3347 \series default
3347 \series default
3348 :
3348 :
3349 \family default
3349 \family default
3350 separator before input prompts.
3350 separator before input prompts.
3351 Default: '
3351 Default: '
3352 \family typewriter
3352 \family typewriter
3353
3353
3354 \backslash
3354 \backslash
3355 n
3355 n
3356 \family default
3356 \family default
3357 '
3357 '
3358 \layout List
3358 \layout List
3359 \labelwidthstring 00.00.0000
3359 \labelwidthstring 00.00.0000
3360
3360
3361
3361
3362 \family typewriter
3362 \family typewriter
3363 \series bold
3363 \series bold
3364 -separate_out|so\SpecialChar ~
3364 -separate_out|so\SpecialChar ~
3365 <string>
3365 <string>
3366 \family default
3366 \family default
3367 \series default
3367 \series default
3368 : separator before output prompts.
3368 : separator before output prompts.
3369 Default: nothing.
3369 Default: nothing.
3370 \layout List
3370 \layout List
3371 \labelwidthstring 00.00.0000
3371 \labelwidthstring 00.00.0000
3372
3372
3373
3373
3374 \family typewriter
3374 \family typewriter
3375 \series bold
3375 \series bold
3376 -separate_out2|so2\SpecialChar ~
3376 -separate_out2|so2\SpecialChar ~
3377 <string>
3377 <string>
3378 \series default
3378 \series default
3379 :
3379 :
3380 \family default
3380 \family default
3381 separator after output prompts.
3381 separator after output prompts.
3382 Default: nothing.
3382 Default: nothing.
3383 \layout List
3383 \layout List
3384 \labelwidthstring 00.00.0000
3384 \labelwidthstring 00.00.0000
3385
3385
3386 \SpecialChar ~
3386 \SpecialChar ~
3387 For these three options, use the value 0 to specify no separator.
3387 For these three options, use the value 0 to specify no separator.
3388 \layout List
3388 \layout List
3389 \labelwidthstring 00.00.0000
3389 \labelwidthstring 00.00.0000
3390
3390
3391
3391
3392 \family typewriter
3392 \family typewriter
3393 \series bold
3393 \series bold
3394 -nosep
3394 -nosep
3395 \series default
3395 \series default
3396 :
3396 :
3397 \family default
3397 \family default
3398 shorthand for
3398 shorthand for
3399 \family typewriter
3399 \family typewriter
3400 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
3400 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
3401 \family default
3401 \family default
3402 .
3402 .
3403 Simply removes all input/output separators.
3403 Simply removes all input/output separators.
3404 \layout List
3404 \layout List
3405 \labelwidthstring 00.00.0000
3405 \labelwidthstring 00.00.0000
3406
3406
3407
3407
3408 \family typewriter
3408 \family typewriter
3409 \series bold
3409 \series bold
3410 -upgrade
3410 -upgrade
3411 \family default
3411 \family default
3412 \series default
3412 \series default
3413 : allows you to upgrade your
3413 : allows you to upgrade your
3414 \family typewriter
3414 \family typewriter
3415 IPYTHONDIR
3415 IPYTHONDIR
3416 \family default
3416 \family default
3417 configuration when you install a new version of IPython.
3417 configuration when you install a new version of IPython.
3418 Since new versions may include new command line options or example files,
3418 Since new versions may include new command line options or example files,
3419 this copies updated ipythonrc-type files.
3419 this copies updated ipythonrc-type files.
3420 However, it backs up (with a
3420 However, it backs up (with a
3421 \family typewriter
3421 \family typewriter
3422 .old
3422 .old
3423 \family default
3423 \family default
3424 extension) all files which it overwrites so that you can merge back any
3424 extension) all files which it overwrites so that you can merge back any
3425 customizations you might have in your personal files.
3425 customizations you might have in your personal files.
3426 \layout List
3426 \layout List
3427 \labelwidthstring 00.00.0000
3427 \labelwidthstring 00.00.0000
3428
3428
3429
3429
3430 \family typewriter
3430 \family typewriter
3431 \series bold
3431 \series bold
3432 -Version
3432 -Version
3433 \series default
3433 \series default
3434 :
3434 :
3435 \family default
3435 \family default
3436 print version information and exit.
3436 print version information and exit.
3437 \layout List
3437 \layout List
3438 \labelwidthstring 00.00.0000
3438 \labelwidthstring 00.00.0000
3439
3439
3440
3440
3441 \family typewriter
3441 \family typewriter
3442 \series bold
3442 \series bold
3443 -xmode <modename>
3443 -xmode <modename>
3444 \series default
3444 \series default
3445 :
3445 :
3446 \family default
3446 \family default
3447 Mode for exception reporting.
3447 Mode for exception reporting.
3448 \layout List
3448 \layout List
3449 \labelwidthstring 00.00.0000
3449 \labelwidthstring 00.00.0000
3450
3450
3451 \SpecialChar ~
3451 \SpecialChar ~
3452 Valid modes: Plain, Context and Verbose.
3452 Valid modes: Plain, Context and Verbose.
3453 \layout List
3453 \layout List
3454 \labelwidthstring 00.00.0000
3454 \labelwidthstring 00.00.0000
3455
3455
3456 \SpecialChar ~
3456 \SpecialChar ~
3457 Plain: similar to python's normal traceback printing.
3457 Plain: similar to python's normal traceback printing.
3458 \layout List
3458 \layout List
3459 \labelwidthstring 00.00.0000
3459 \labelwidthstring 00.00.0000
3460
3460
3461 \SpecialChar ~
3461 \SpecialChar ~
3462 Context: prints 5 lines of context source code around each line in the
3462 Context: prints 5 lines of context source code around each line in the
3463 traceback.
3463 traceback.
3464 \layout List
3464 \layout List
3465 \labelwidthstring 00.00.0000
3465 \labelwidthstring 00.00.0000
3466
3466
3467 \SpecialChar ~
3467 \SpecialChar ~
3468 Verbose: similar to Context, but additionally prints the variables currently
3468 Verbose: similar to Context, but additionally prints the variables currently
3469 visible where the exception happened (shortening their strings if too long).
3469 visible where the exception happened (shortening their strings if too long).
3470 This can potentially be very slow, if you happen to have a huge data structure
3470 This can potentially be very slow, if you happen to have a huge data structure
3471 whose string representation is complex to compute.
3471 whose string representation is complex to compute.
3472 Your computer may appear to freeze for a while with cpu usage at 100%.
3472 Your computer may appear to freeze for a while with cpu usage at 100%.
3473 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
3473 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
3474 it more than once).
3474 it more than once).
3475 \layout Section
3475 \layout Section
3476
3476
3477 Interactive use
3477 Interactive use
3478 \layout Standard
3478 \layout Standard
3479
3479
3480
3480
3481 \series bold
3481 \series bold
3482 Warning
3482 Warning
3483 \series default
3483 \series default
3484 : IPython relies on the existence of a global variable called
3484 : IPython relies on the existence of a global variable called
3485 \family typewriter
3485 \family typewriter
3486 __IP
3486 __IP
3487 \family default
3487 \family default
3488 which controls the shell itself.
3488 which controls the shell itself.
3489 If you redefine
3489 If you redefine
3490 \family typewriter
3490 \family typewriter
3491 __IP
3491 __IP
3492 \family default
3492 \family default
3493 to anything, bizarre behavior will quickly occur.
3493 to anything, bizarre behavior will quickly occur.
3494 \layout Standard
3494 \layout Standard
3495
3495
3496 Other than the above warning, IPython is meant to work as a drop-in replacement
3496 Other than the above warning, IPython is meant to work as a drop-in replacement
3497 for the standard interactive interpreter.
3497 for the standard interactive interpreter.
3498 As such, any code which is valid python should execute normally under IPython
3498 As such, any code which is valid python should execute normally under IPython
3499 (cases where this is not true should be reported as bugs).
3499 (cases where this is not true should be reported as bugs).
3500 It does, however, offer many features which are not available at a standard
3500 It does, however, offer many features which are not available at a standard
3501 python prompt.
3501 python prompt.
3502 What follows is a list of these.
3502 What follows is a list of these.
3503 \layout Subsection
3503 \layout Subsection
3504
3504
3505 Caution for Windows users
3505 Caution for Windows users
3506 \layout Standard
3506 \layout Standard
3507
3507
3508 Windows, unfortunately, uses the `
3508 Windows, unfortunately, uses the `
3509 \family typewriter
3509 \family typewriter
3510
3510
3511 \backslash
3511 \backslash
3512
3512
3513 \family default
3513 \family default
3514 ' character as a path separator.
3514 ' character as a path separator.
3515 This is a terrible choice, because `
3515 This is a terrible choice, because `
3516 \family typewriter
3516 \family typewriter
3517
3517
3518 \backslash
3518 \backslash
3519
3519
3520 \family default
3520 \family default
3521 ' also represents the escape character in most modern programming languages,
3521 ' also represents the escape character in most modern programming languages,
3522 including Python.
3522 including Python.
3523 For this reason, issuing many of the commands discussed below (especially
3523 For this reason, issuing many of the commands discussed below (especially
3524 magics which affect the filesystem) with `
3524 magics which affect the filesystem) with `
3525 \family typewriter
3525 \family typewriter
3526
3526
3527 \backslash
3527 \backslash
3528
3528
3529 \family default
3529 \family default
3530 ' in them will cause strange errors.
3530 ' in them will cause strange errors.
3531 \layout Standard
3531 \layout Standard
3532
3532
3533 A partial solution is to use instead the `
3533 A partial solution is to use instead the `
3534 \family typewriter
3534 \family typewriter
3535 /
3535 /
3536 \family default
3536 \family default
3537 ' character as a path separator, which Windows recognizes in
3537 ' character as a path separator, which Windows recognizes in
3538 \emph on
3538 \emph on
3539 most
3539 most
3540 \emph default
3540 \emph default
3541 situations.
3541 situations.
3542 However, in Windows commands `
3542 However, in Windows commands `
3543 \family typewriter
3543 \family typewriter
3544 /
3544 /
3545 \family default
3545 \family default
3546 ' flags options, so you can not use it for the root directory.
3546 ' flags options, so you can not use it for the root directory.
3547 This means that paths beginning at the root must be typed in a contrived
3547 This means that paths beginning at the root must be typed in a contrived
3548 manner like:
3548 manner like:
3549 \newline
3549 \newline
3550
3550
3551 \family typewriter
3551 \family typewriter
3552 %copy
3552 %copy
3553 \backslash
3553 \backslash
3554 opt/foo/bar.txt
3554 opt/foo/bar.txt
3555 \backslash
3555 \backslash
3556 tmp
3556 tmp
3557 \layout Standard
3557 \layout Standard
3558
3558
3559 There is no sensible thing IPython can do to truly work around this flaw
3559 There is no sensible thing IPython can do to truly work around this flaw
3560 in Windows
3560 in Windows
3561 \begin_inset Foot
3561 \begin_inset Foot
3562 collapsed true
3562 collapsed true
3563
3563
3564 \layout Standard
3564 \layout Standard
3565
3565
3566 If anyone comes up with a
3566 If anyone comes up with a
3567 \emph on
3567 \emph on
3568 clean
3568 clean
3569 \emph default
3569 \emph default
3570 solution which works consistently and does not negatively impact other
3570 solution which works consistently and does not negatively impact other
3571 platforms at all, I'll gladly accept a patch.
3571 platforms at all, I'll gladly accept a patch.
3572 \end_inset
3572 \end_inset
3573
3573
3574 .
3574 .
3575 \layout Subsection
3575 \layout Subsection
3576
3576
3577
3577
3578 \begin_inset LatexCommand \label{sec:magic}
3578 \begin_inset LatexCommand \label{sec:magic}
3579
3579
3580 \end_inset
3580 \end_inset
3581
3581
3582 Magic command system
3582 Magic command system
3583 \layout Standard
3583 \layout Standard
3584
3584
3585 IPython will treat any line whose first character is a
3585 IPython will treat any line whose first character is a
3586 \family typewriter
3586 \family typewriter
3587 %
3587 %
3588 \family default
3588 \family default
3589 as a special call to a 'magic' function.
3589 as a special call to a 'magic' function.
3590 These allow you to control the behavior of IPython itself, plus a lot of
3590 These allow you to control the behavior of IPython itself, plus a lot of
3591 system-type features.
3591 system-type features.
3592 They are all prefixed with a
3592 They are all prefixed with a
3593 \family typewriter
3593 \family typewriter
3594 %
3594 %
3595 \family default
3595 \family default
3596 character, but parameters are given without parentheses or quotes.
3596 character, but parameters are given without parentheses or quotes.
3597 \layout Standard
3597 \layout Standard
3598
3598
3599 Example: typing
3599 Example: typing
3600 \family typewriter
3600 \family typewriter
3601 '%cd mydir'
3601 '%cd mydir'
3602 \family default
3602 \family default
3603 (without the quotes) changes you working directory to
3603 (without the quotes) changes you working directory to
3604 \family typewriter
3604 \family typewriter
3605 'mydir'
3605 'mydir'
3606 \family default
3606 \family default
3607 , if it exists.
3607 , if it exists.
3608 \layout Standard
3608 \layout Standard
3609
3609
3610 If you have 'automagic' enabled (in your
3610 If you have 'automagic' enabled (in your
3611 \family typewriter
3611 \family typewriter
3612 ipythonrc
3612 ipythonrc
3613 \family default
3613 \family default
3614 file, via the command line option
3614 file, via the command line option
3615 \family typewriter
3615 \family typewriter
3616 -automagic
3616 -automagic
3617 \family default
3617 \family default
3618 or with the
3618 or with the
3619 \family typewriter
3619 \family typewriter
3620 %automagic
3620 %automagic
3621 \family default
3621 \family default
3622 function), you don't need to type in the
3622 function), you don't need to type in the
3623 \family typewriter
3623 \family typewriter
3624 %
3624 %
3625 \family default
3625 \family default
3626 explicitly.
3626 explicitly.
3627 IPython will scan its internal list of magic functions and call one if
3627 IPython will scan its internal list of magic functions and call one if
3628 it exists.
3628 it exists.
3629 With automagic on you can then just type '
3629 With automagic on you can then just type '
3630 \family typewriter
3630 \family typewriter
3631 cd mydir
3631 cd mydir
3632 \family default
3632 \family default
3633 ' to go to directory '
3633 ' to go to directory '
3634 \family typewriter
3634 \family typewriter
3635 mydir
3635 mydir
3636 \family default
3636 \family default
3637 '.
3637 '.
3638 The automagic system has the lowest possible precedence in name searches,
3638 The automagic system has the lowest possible precedence in name searches,
3639 so defining an identifier with the same name as an existing magic function
3639 so defining an identifier with the same name as an existing magic function
3640 will shadow it for automagic use.
3640 will shadow it for automagic use.
3641 You can still access the shadowed magic function by explicitly using the
3641 You can still access the shadowed magic function by explicitly using the
3642
3642
3643 \family typewriter
3643 \family typewriter
3644 %
3644 %
3645 \family default
3645 \family default
3646 character at the beginning of the line.
3646 character at the beginning of the line.
3647 \layout Standard
3647 \layout Standard
3648
3648
3649 An example (with automagic on) should clarify all this:
3649 An example (with automagic on) should clarify all this:
3650 \layout LyX-Code
3650 \layout LyX-Code
3651
3651
3652 In [1]: cd ipython # %cd is called by automagic
3652 In [1]: cd ipython # %cd is called by automagic
3653 \layout LyX-Code
3653 \layout LyX-Code
3654
3654
3655 /home/fperez/ipython
3655 /home/fperez/ipython
3656 \layout LyX-Code
3656 \layout LyX-Code
3657
3657
3658 In [2]: cd=1 # now cd is just a variable
3658 In [2]: cd=1 # now cd is just a variable
3659 \layout LyX-Code
3659 \layout LyX-Code
3660
3660
3661 In [3]: cd ..
3661 In [3]: cd ..
3662 # and doesn't work as a function anymore
3662 # and doesn't work as a function anymore
3663 \layout LyX-Code
3663 \layout LyX-Code
3664
3664
3665 ------------------------------------------------------------
3665 ------------------------------------------------------------
3666 \layout LyX-Code
3666 \layout LyX-Code
3667
3667
3668 File "<console>", line 1
3668 File "<console>", line 1
3669 \layout LyX-Code
3669 \layout LyX-Code
3670
3670
3671 cd ..
3671 cd ..
3672 \layout LyX-Code
3672 \layout LyX-Code
3673
3673
3674 ^
3674 ^
3675 \layout LyX-Code
3675 \layout LyX-Code
3676
3676
3677 SyntaxError: invalid syntax
3677 SyntaxError: invalid syntax
3678 \layout LyX-Code
3678 \layout LyX-Code
3679
3679
3680 \layout LyX-Code
3680 \layout LyX-Code
3681
3681
3682 In [4]: %cd ..
3682 In [4]: %cd ..
3683 # but %cd always works
3683 # but %cd always works
3684 \layout LyX-Code
3684 \layout LyX-Code
3685
3685
3686 /home/fperez
3686 /home/fperez
3687 \layout LyX-Code
3687 \layout LyX-Code
3688
3688
3689 In [5]: del cd # if you remove the cd variable
3689 In [5]: del cd # if you remove the cd variable
3690 \layout LyX-Code
3690 \layout LyX-Code
3691
3691
3692 In [6]: cd ipython # automagic can work again
3692 In [6]: cd ipython # automagic can work again
3693 \layout LyX-Code
3693 \layout LyX-Code
3694
3694
3695 /home/fperez/ipython
3695 /home/fperez/ipython
3696 \layout Standard
3696 \layout Standard
3697
3697
3698 You can define your own magic functions to extend the system.
3698 You can define your own magic functions to extend the system.
3699 The following is a snippet of code which shows how to do it.
3699 The following is a snippet of code which shows how to do it.
3700 It is provided as file
3700 It is provided as file
3701 \family typewriter
3701 \family typewriter
3702 example-magic.py
3702 example-magic.py
3703 \family default
3703 \family default
3704 in the examples directory:
3704 in the examples directory:
3705 \layout Standard
3705 \layout Standard
3706
3706
3707
3707
3708 \begin_inset ERT
3708 \begin_inset ERT
3709 status Open
3709 status Open
3710
3710
3711 \layout Standard
3711 \layout Standard
3712
3712
3713 \backslash
3713 \backslash
3714 codelist{examples/example-magic.py}
3714 codelist{examples/example-magic.py}
3715 \end_inset
3715 \end_inset
3716
3716
3717
3717
3718 \layout Standard
3718 \layout Standard
3719
3719
3720 You can also define your own aliased names for magic functions.
3720 You can also define your own aliased names for magic functions.
3721 In your
3721 In your
3722 \family typewriter
3722 \family typewriter
3723 ipythonrc
3723 ipythonrc
3724 \family default
3724 \family default
3725 file, placing a line like:
3725 file, placing a line like:
3726 \layout Standard
3726 \layout Standard
3727
3727
3728
3728
3729 \family typewriter
3729 \family typewriter
3730 execute __IP.magic_cl = __IP.magic_clear
3730 execute __IP.magic_cl = __IP.magic_clear
3731 \layout Standard
3731 \layout Standard
3732
3732
3733 will define
3733 will define
3734 \family typewriter
3734 \family typewriter
3735 %cl
3735 %cl
3736 \family default
3736 \family default
3737 as a new name for
3737 as a new name for
3738 \family typewriter
3738 \family typewriter
3739 %clear
3739 %clear
3740 \family default
3740 \family default
3741 .
3741 .
3742 \layout Standard
3742 \layout Standard
3743
3743
3744 Type
3744 Type
3745 \family typewriter
3745 \family typewriter
3746 %magic
3746 %magic
3747 \family default
3747 \family default
3748 for more information, including a list of all available magic functions
3748 for more information, including a list of all available magic functions
3749 at any time and their docstrings.
3749 at any time and their docstrings.
3750 You can also type
3750 You can also type
3751 \family typewriter
3751 \family typewriter
3752 %magic_function_name?
3752 %magic_function_name?
3753 \family default
3753 \family default
3754 (see sec.
3754 (see sec.
3755
3755
3756 \begin_inset LatexCommand \ref{sec:dyn-object-info}
3756 \begin_inset LatexCommand \ref{sec:dyn-object-info}
3757
3757
3758 \end_inset
3758 \end_inset
3759
3759
3760 for information on the
3760 for information on the
3761 \family typewriter
3761 \family typewriter
3762 '?'
3762 '?'
3763 \family default
3763 \family default
3764 system) to get information about any particular magic function you are
3764 system) to get information about any particular magic function you are
3765 interested in.
3765 interested in.
3766 \layout Subsubsection
3766 \layout Subsubsection
3767
3767
3768 Magic commands
3768 Magic commands
3769 \layout Standard
3769 \layout Standard
3770
3770
3771 The rest of this section is automatically generated for each release from
3771 The rest of this section is automatically generated for each release from
3772 the docstrings in the IPython code.
3772 the docstrings in the IPython code.
3773 Therefore the formatting is somewhat minimal, but this method has the advantage
3773 Therefore the formatting is somewhat minimal, but this method has the advantage
3774 of having information always in sync with the code.
3774 of having information always in sync with the code.
3775 \layout Standard
3775 \layout Standard
3776
3776
3777 A list of all the magic commands available in IPython's
3777 A list of all the magic commands available in IPython's
3778 \emph on
3778 \emph on
3779 default
3779 default
3780 \emph default
3780 \emph default
3781 installation follows.
3781 installation follows.
3782 This is similar to what you'll see by simply typing
3782 This is similar to what you'll see by simply typing
3783 \family typewriter
3783 \family typewriter
3784 %magic
3784 %magic
3785 \family default
3785 \family default
3786 at the prompt, but that will also give you information about magic commands
3786 at the prompt, but that will also give you information about magic commands
3787 you may have added as part of your personal customizations.
3787 you may have added as part of your personal customizations.
3788 \layout Standard
3788 \layout Standard
3789
3789
3790
3790
3791 \begin_inset Include \input{magic.tex}
3791 \begin_inset Include \input{magic.tex}
3792 preview false
3792 preview false
3793
3793
3794 \end_inset
3794 \end_inset
3795
3795
3796
3796
3797 \layout Subsection
3797 \layout Subsection
3798
3798
3799 Access to the standard Python help
3799 Access to the standard Python help
3800 \layout Standard
3800 \layout Standard
3801
3801
3802 As of Python 2.1, a help system is available with access to object docstrings
3802 As of Python 2.1, a help system is available with access to object docstrings
3803 and the Python manuals.
3803 and the Python manuals.
3804 Simply type
3804 Simply type
3805 \family typewriter
3805 \family typewriter
3806 'help'
3806 'help'
3807 \family default
3807 \family default
3808 (no quotes) to access it.
3808 (no quotes) to access it.
3809 You can also type
3809 You can also type
3810 \family typewriter
3810 \family typewriter
3811 help(object)
3811 help(object)
3812 \family default
3812 \family default
3813 to obtain information about a given object, and
3813 to obtain information about a given object, and
3814 \family typewriter
3814 \family typewriter
3815 help('keyword')
3815 help('keyword')
3816 \family default
3816 \family default
3817 for information on a keyword.
3817 for information on a keyword.
3818 As noted in sec.
3818 As noted in sec.
3819
3819
3820 \begin_inset LatexCommand \ref{sec:help-access}
3820 \begin_inset LatexCommand \ref{sec:help-access}
3821
3821
3822 \end_inset
3822 \end_inset
3823
3823
3824 , you need to properly configure your environment variable
3824 , you need to properly configure your environment variable
3825 \family typewriter
3825 \family typewriter
3826 PYTHONDOCS
3826 PYTHONDOCS
3827 \family default
3827 \family default
3828 for this feature to work correctly.
3828 for this feature to work correctly.
3829 \layout Subsection
3829 \layout Subsection
3830
3830
3831
3831
3832 \begin_inset LatexCommand \label{sec:dyn-object-info}
3832 \begin_inset LatexCommand \label{sec:dyn-object-info}
3833
3833
3834 \end_inset
3834 \end_inset
3835
3835
3836 Dynamic object information
3836 Dynamic object information
3837 \layout Standard
3837 \layout Standard
3838
3838
3839 Typing
3839 Typing
3840 \family typewriter
3840 \family typewriter
3841 ?word
3841 ?word
3842 \family default
3842 \family default
3843 or
3843 or
3844 \family typewriter
3844 \family typewriter
3845 word?
3845 word?
3846 \family default
3846 \family default
3847 prints detailed information about an object.
3847 prints detailed information about an object.
3848 If certain strings in the object are too long (docstrings, code, etc.) they
3848 If certain strings in the object are too long (docstrings, code, etc.) they
3849 get snipped in the center for brevity.
3849 get snipped in the center for brevity.
3850 This system gives access variable types and values, full source code for
3850 This system gives access variable types and values, full source code for
3851 any object (if available), function prototypes and other useful information.
3851 any object (if available), function prototypes and other useful information.
3852 \layout Standard
3852 \layout Standard
3853
3853
3854 Typing
3854 Typing
3855 \family typewriter
3855 \family typewriter
3856 ??word
3856 ??word
3857 \family default
3857 \family default
3858 or
3858 or
3859 \family typewriter
3859 \family typewriter
3860 word??
3860 word??
3861 \family default
3861 \family default
3862 gives access to the full information without snipping long strings.
3862 gives access to the full information without snipping long strings.
3863 Long strings are sent to the screen through the
3863 Long strings are sent to the screen through the
3864 \family typewriter
3864 \family typewriter
3865 less
3865 less
3866 \family default
3866 \family default
3867 pager if longer than the screen and printed otherwise.
3867 pager if longer than the screen and printed otherwise.
3868 On systems lacking the
3868 On systems lacking the
3869 \family typewriter
3869 \family typewriter
3870 less
3870 less
3871 \family default
3871 \family default
3872 command, IPython uses a very basic internal pager.
3872 command, IPython uses a very basic internal pager.
3873 \layout Standard
3873 \layout Standard
3874
3874
3875 The following magic functions are particularly useful for gathering information
3875 The following magic functions are particularly useful for gathering information
3876 about your working environment.
3876 about your working environment.
3877 You can get more details by typing
3877 You can get more details by typing
3878 \family typewriter
3878 \family typewriter
3879 %magic
3879 %magic
3880 \family default
3880 \family default
3881 or querying them individually (use
3881 or querying them individually (use
3882 \family typewriter
3882 \family typewriter
3883 %function_name?
3883 %function_name?
3884 \family default
3884 \family default
3885 with or without the
3885 with or without the
3886 \family typewriter
3886 \family typewriter
3887 %
3887 %
3888 \family default
3888 \family default
3889 ), this is just a summary:
3889 ), this is just a summary:
3890 \layout List
3890 \layout List
3891 \labelwidthstring 00.00.0000
3891 \labelwidthstring 00.00.0000
3892
3892
3893
3893
3894 \family typewriter
3894 \family typewriter
3895 \series bold
3895 \series bold
3896 %pdoc\SpecialChar ~
3896 %pdoc\SpecialChar ~
3897 <object>
3897 <object>
3898 \family default
3898 \family default
3899 \series default
3899 \series default
3900 : Print (or run through a pager if too long) the docstring for an object.
3900 : Print (or run through a pager if too long) the docstring for an object.
3901 If the given object is a class, it will print both the class and the constructo
3901 If the given object is a class, it will print both the class and the constructo
3902 r docstrings.
3902 r docstrings.
3903 \layout List
3903 \layout List
3904 \labelwidthstring 00.00.0000
3904 \labelwidthstring 00.00.0000
3905
3905
3906
3906
3907 \family typewriter
3907 \family typewriter
3908 \series bold
3908 \series bold
3909 %pdef\SpecialChar ~
3909 %pdef\SpecialChar ~
3910 <object>
3910 <object>
3911 \family default
3911 \family default
3912 \series default
3912 \series default
3913 : Print the definition header for any callable object.
3913 : Print the definition header for any callable object.
3914 If the object is a class, print the constructor information.
3914 If the object is a class, print the constructor information.
3915 \layout List
3915 \layout List
3916 \labelwidthstring 00.00.0000
3916 \labelwidthstring 00.00.0000
3917
3917
3918
3918
3919 \family typewriter
3919 \family typewriter
3920 \series bold
3920 \series bold
3921 %psource\SpecialChar ~
3921 %psource\SpecialChar ~
3922 <object>
3922 <object>
3923 \family default
3923 \family default
3924 \series default
3924 \series default
3925 : Print (or run through a pager if too long) the source code for an object.
3925 : Print (or run through a pager if too long) the source code for an object.
3926 \layout List
3926 \layout List
3927 \labelwidthstring 00.00.0000
3927 \labelwidthstring 00.00.0000
3928
3928
3929
3929
3930 \family typewriter
3930 \family typewriter
3931 \series bold
3931 \series bold
3932 %pfile\SpecialChar ~
3932 %pfile\SpecialChar ~
3933 <object>
3933 <object>
3934 \family default
3934 \family default
3935 \series default
3935 \series default
3936 : Show the entire source file where an object was defined via a pager, opening
3936 : Show the entire source file where an object was defined via a pager, opening
3937 it at the line where the object definition begins.
3937 it at the line where the object definition begins.
3938 \layout List
3938 \layout List
3939 \labelwidthstring 00.00.0000
3939 \labelwidthstring 00.00.0000
3940
3940
3941
3941
3942 \family typewriter
3942 \family typewriter
3943 \series bold
3943 \series bold
3944 %who/%whos
3944 %who/%whos
3945 \family default
3945 \family default
3946 \series default
3946 \series default
3947 : These functions give information about identifiers you have defined interactiv
3947 : These functions give information about identifiers you have defined interactiv
3948 ely (not things you loaded or defined in your configuration files).
3948 ely (not things you loaded or defined in your configuration files).
3949
3949
3950 \family typewriter
3950 \family typewriter
3951 %who
3951 %who
3952 \family default
3952 \family default
3953 just prints a list of identifiers and
3953 just prints a list of identifiers and
3954 \family typewriter
3954 \family typewriter
3955 %whos
3955 %whos
3956 \family default
3956 \family default
3957 prints a table with some basic details about each identifier.
3957 prints a table with some basic details about each identifier.
3958 \layout Standard
3958 \layout Standard
3959
3959
3960 Note that the dynamic object information functions (
3960 Note that the dynamic object information functions (
3961 \family typewriter
3961 \family typewriter
3962 ?/??, %pdoc, %pfile, %pdef, %psource
3962 ?/??, %pdoc, %pfile, %pdef, %psource
3963 \family default
3963 \family default
3964 ) give you access to documentation even on things which are not really defined
3964 ) give you access to documentation even on things which are not really defined
3965 as separate identifiers.
3965 as separate identifiers.
3966 Try for example typing
3966 Try for example typing
3967 \family typewriter
3967 \family typewriter
3968 {}.get?
3968 {}.get?
3969 \family default
3969 \family default
3970 or after doing
3970 or after doing
3971 \family typewriter
3971 \family typewriter
3972 import os
3972 import os
3973 \family default
3973 \family default
3974 , type
3974 , type
3975 \family typewriter
3975 \family typewriter
3976 os.path.abspath??
3976 os.path.abspath??
3977 \family default
3977 \family default
3978 .
3978 .
3979 \layout Subsection
3979 \layout Subsection
3980
3980
3981
3981
3982 \begin_inset LatexCommand \label{sec:readline}
3982 \begin_inset LatexCommand \label{sec:readline}
3983
3983
3984 \end_inset
3984 \end_inset
3985
3985
3986 Readline-based features
3986 Readline-based features
3987 \layout Standard
3987 \layout Standard
3988
3988
3989 These features require the GNU readline library, so they won't work if your
3989 These features require the GNU readline library, so they won't work if your
3990 Python installation lacks readline support.
3990 Python installation lacks readline support.
3991 We will first describe the default behavior IPython uses, and then how
3991 We will first describe the default behavior IPython uses, and then how
3992 to change it to suit your preferences.
3992 to change it to suit your preferences.
3993 \layout Subsubsection
3993 \layout Subsubsection
3994
3994
3995 Command line completion
3995 Command line completion
3996 \layout Standard
3996 \layout Standard
3997
3997
3998 At any time, hitting TAB will complete any available python commands or
3998 At any time, hitting TAB will complete any available python commands or
3999 variable names, and show you a list of the possible completions if there's
3999 variable names, and show you a list of the possible completions if there's
4000 no unambiguous one.
4000 no unambiguous one.
4001 It will also complete filenames in the current directory if no python names
4001 It will also complete filenames in the current directory if no python names
4002 match what you've typed so far.
4002 match what you've typed so far.
4003 \layout Subsubsection
4003 \layout Subsubsection
4004
4004
4005 Search command history
4005 Search command history
4006 \layout Standard
4006 \layout Standard
4007
4007
4008 IPython provides two ways for searching through previous input and thus
4008 IPython provides two ways for searching through previous input and thus
4009 reduce the need for repetitive typing:
4009 reduce the need for repetitive typing:
4010 \layout Enumerate
4010 \layout Enumerate
4011
4011
4012 Start typing, and then use
4012 Start typing, and then use
4013 \family typewriter
4013 \family typewriter
4014 Ctrl-p
4014 Ctrl-p
4015 \family default
4015 \family default
4016 (previous,up) and
4016 (previous,up) and
4017 \family typewriter
4017 \family typewriter
4018 Ctrl-n
4018 Ctrl-n
4019 \family default
4019 \family default
4020 (next,down) to search through only the history items that match what you've
4020 (next,down) to search through only the history items that match what you've
4021 typed so far.
4021 typed so far.
4022 If you use
4022 If you use
4023 \family typewriter
4023 \family typewriter
4024 Ctrl-p/Ctrl-n
4024 Ctrl-p/Ctrl-n
4025 \family default
4025 \family default
4026 at a blank prompt, they just behave like normal arrow keys.
4026 at a blank prompt, they just behave like normal arrow keys.
4027 \layout Enumerate
4027 \layout Enumerate
4028
4028
4029 Hit
4029 Hit
4030 \family typewriter
4030 \family typewriter
4031 Ctrl-r
4031 Ctrl-r
4032 \family default
4032 \family default
4033 : opens a search prompt.
4033 : opens a search prompt.
4034 Begin typing and the system searches your history for lines that contain
4034 Begin typing and the system searches your history for lines that contain
4035 what you've typed so far, completing as much as it can.
4035 what you've typed so far, completing as much as it can.
4036 \layout Subsubsection
4036 \layout Subsubsection
4037
4037
4038 Persistent command history across sessions
4038 Persistent command history across sessions
4039 \layout Standard
4039 \layout Standard
4040
4040
4041 IPython will save your input history when it leaves and reload it next time
4041 IPython will save your input history when it leaves and reload it next time
4042 you restart it.
4042 you restart it.
4043 By default, the history file is named
4043 By default, the history file is named
4044 \family typewriter
4044 \family typewriter
4045 $IPYTHONDIR/history
4045 $IPYTHONDIR/history
4046 \family default
4046 \family default
4047 , but if you've loaded a named profile, '
4047 , but if you've loaded a named profile, '
4048 \family typewriter
4048 \family typewriter
4049 -PROFILE_NAME
4049 -PROFILE_NAME
4050 \family default
4050 \family default
4051 ' is appended to the name.
4051 ' is appended to the name.
4052 This allows you to keep separate histories related to various tasks: commands
4052 This allows you to keep separate histories related to various tasks: commands
4053 related to numerical work will not be clobbered by a system shell history,
4053 related to numerical work will not be clobbered by a system shell history,
4054 for example.
4054 for example.
4055 \layout Subsubsection
4055 \layout Subsubsection
4056
4056
4057 Autoindent
4057 Autoindent
4058 \layout Standard
4058 \layout Standard
4059
4059
4060 IPython can recognize lines ending in ':' and indent the next line, while
4060 IPython can recognize lines ending in ':' and indent the next line, while
4061 also un-indenting automatically after 'raise' or 'return'.
4061 also un-indenting automatically after 'raise' or 'return'.
4062
4062
4063 \layout Standard
4063 \layout Standard
4064
4064
4065 This feature uses the readline library, so it will honor your
4065 This feature uses the readline library, so it will honor your
4066 \family typewriter
4066 \family typewriter
4067 ~/.inputrc
4067 ~/.inputrc
4068 \family default
4068 \family default
4069 configuration (or whatever file your
4069 configuration (or whatever file your
4070 \family typewriter
4070 \family typewriter
4071 INPUTRC
4071 INPUTRC
4072 \family default
4072 \family default
4073 variable points to).
4073 variable points to).
4074 Adding the following lines to your
4074 Adding the following lines to your
4075 \family typewriter
4075 \family typewriter
4076 .inputrc
4076 .inputrc
4077 \family default
4077 \family default
4078 file can make indenting/unindenting more convenient (
4078 file can make indenting/unindenting more convenient (
4079 \family typewriter
4079 \family typewriter
4080 M-i
4080 M-i
4081 \family default
4081 \family default
4082 indents,
4082 indents,
4083 \family typewriter
4083 \family typewriter
4084 M-u
4084 M-u
4085 \family default
4085 \family default
4086 unindents):
4086 unindents):
4087 \layout Standard
4087 \layout Standard
4088
4088
4089
4089
4090 \family typewriter
4090 \family typewriter
4091 $if Python
4091 $if Python
4092 \newline
4092 \newline
4093 "
4093 "
4094 \backslash
4094 \backslash
4095 M-i": "\SpecialChar ~
4095 M-i": "\SpecialChar ~
4096 \SpecialChar ~
4096 \SpecialChar ~
4097 \SpecialChar ~
4097 \SpecialChar ~
4098 \SpecialChar ~
4098 \SpecialChar ~
4099 "
4099 "
4100 \newline
4100 \newline
4101 "
4101 "
4102 \backslash
4102 \backslash
4103 M-u": "
4103 M-u": "
4104 \backslash
4104 \backslash
4105 d
4105 d
4106 \backslash
4106 \backslash
4107 d
4107 d
4108 \backslash
4108 \backslash
4109 d
4109 d
4110 \backslash
4110 \backslash
4111 d"
4111 d"
4112 \newline
4112 \newline
4113 $endif
4113 $endif
4114 \layout Standard
4114 \layout Standard
4115
4115
4116 Note that there are 4 spaces between the quote marks after
4116 Note that there are 4 spaces between the quote marks after
4117 \family typewriter
4117 \family typewriter
4118 "M-i"
4118 "M-i"
4119 \family default
4119 \family default
4120 above.
4120 above.
4121 \layout Standard
4121 \layout Standard
4122
4122
4123
4123
4124 \series bold
4124 \series bold
4125 Warning:
4125 Warning:
4126 \series default
4126 \series default
4127 this feature is ON by default, but it can cause problems with the pasting
4127 this feature is ON by default, but it can cause problems with the pasting
4128 of multi-line indented code (the pasted code gets re-indented on each line).
4128 of multi-line indented code (the pasted code gets re-indented on each line).
4129 A magic function
4129 A magic function
4130 \family typewriter
4130 \family typewriter
4131 %autoindent
4131 %autoindent
4132 \family default
4132 \family default
4133 allows you to toggle it on/off at runtime.
4133 allows you to toggle it on/off at runtime.
4134 You can also disable it permanently on in your
4134 You can also disable it permanently on in your
4135 \family typewriter
4135 \family typewriter
4136 ipythonrc
4136 ipythonrc
4137 \family default
4137 \family default
4138 file (set
4138 file (set
4139 \family typewriter
4139 \family typewriter
4140 autoindent 0
4140 autoindent 0
4141 \family default
4141 \family default
4142 ).
4142 ).
4143 \layout Subsubsection
4143 \layout Subsubsection
4144
4144
4145 Customizing readline behavior
4145 Customizing readline behavior
4146 \layout Standard
4146 \layout Standard
4147
4147
4148 All these features are based on the GNU readline library, which has an extremely
4148 All these features are based on the GNU readline library, which has an extremely
4149 customizable interface.
4149 customizable interface.
4150 Normally, readline is configured via a file which defines the behavior
4150 Normally, readline is configured via a file which defines the behavior
4151 of the library; the details of the syntax for this can be found in the
4151 of the library; the details of the syntax for this can be found in the
4152 readline documentation available with your system or on the Internet.
4152 readline documentation available with your system or on the Internet.
4153 IPython doesn't read this file (if it exists) directly, but it does support
4153 IPython doesn't read this file (if it exists) directly, but it does support
4154 passing to readline valid options via a simple interface.
4154 passing to readline valid options via a simple interface.
4155 In brief, you can customize readline by setting the following options in
4155 In brief, you can customize readline by setting the following options in
4156 your
4156 your
4157 \family typewriter
4157 \family typewriter
4158 ipythonrc
4158 ipythonrc
4159 \family default
4159 \family default
4160 configuration file (note that these options can
4160 configuration file (note that these options can
4161 \emph on
4161 \emph on
4162 not
4162 not
4163 \emph default
4163 \emph default
4164 be specified at the command line):
4164 be specified at the command line):
4165 \layout List
4165 \layout List
4166 \labelwidthstring 00.00.0000
4166 \labelwidthstring 00.00.0000
4167
4167
4168
4168
4169 \family typewriter
4169 \family typewriter
4170 \series bold
4170 \series bold
4171 readline_parse_and_bind:
4171 readline_parse_and_bind:
4172 \family default
4172 \family default
4173 \series default
4173 \series default
4174 this option can appear as many times as you want, each time defining a
4174 this option can appear as many times as you want, each time defining a
4175 string to be executed via a
4175 string to be executed via a
4176 \family typewriter
4176 \family typewriter
4177 readline.parse_and_bind()
4177 readline.parse_and_bind()
4178 \family default
4178 \family default
4179 command.
4179 command.
4180 The syntax for valid commands of this kind can be found by reading the
4180 The syntax for valid commands of this kind can be found by reading the
4181 documentation for the GNU readline library, as these commands are of the
4181 documentation for the GNU readline library, as these commands are of the
4182 kind which readline accepts in its configuration file.
4182 kind which readline accepts in its configuration file.
4183 \layout List
4183 \layout List
4184 \labelwidthstring 00.00.0000
4184 \labelwidthstring 00.00.0000
4185
4185
4186
4186
4187 \family typewriter
4187 \family typewriter
4188 \series bold
4188 \series bold
4189 readline_remove_delims:
4189 readline_remove_delims:
4190 \family default
4190 \family default
4191 \series default
4191 \series default
4192 a string of characters to be removed from the default word-delimiters list
4192 a string of characters to be removed from the default word-delimiters list
4193 used by readline, so that completions may be performed on strings which
4193 used by readline, so that completions may be performed on strings which
4194 contain them.
4194 contain them.
4195 Do not change the default value unless you know what you're doing.
4195 Do not change the default value unless you know what you're doing.
4196 \layout List
4196 \layout List
4197 \labelwidthstring 00.00.0000
4197 \labelwidthstring 00.00.0000
4198
4198
4199
4199
4200 \family typewriter
4200 \family typewriter
4201 \series bold
4201 \series bold
4202 readline_omit__names
4202 readline_omit__names
4203 \family default
4203 \family default
4204 \series default
4204 \series default
4205 : when tab-completion is enabled, hitting
4205 : when tab-completion is enabled, hitting
4206 \family typewriter
4206 \family typewriter
4207 <tab>
4207 <tab>
4208 \family default
4208 \family default
4209 after a '
4209 after a '
4210 \family typewriter
4210 \family typewriter
4211 .
4211 .
4212 \family default
4212 \family default
4213 ' in a name will complete all attributes of an object, including all the
4213 ' in a name will complete all attributes of an object, including all the
4214 special methods whose names include double underscores (like
4214 special methods whose names include double underscores (like
4215 \family typewriter
4215 \family typewriter
4216 __getitem__
4216 __getitem__
4217 \family default
4217 \family default
4218 or
4218 or
4219 \family typewriter
4219 \family typewriter
4220 __class__
4220 __class__
4221 \family default
4221 \family default
4222 ).
4222 ).
4223 If you'd rather not see these names by default, you can set this option
4223 If you'd rather not see these names by default, you can set this option
4224 to 1.
4224 to 1.
4225 Note that even when this option is set, you can still see those names by
4225 Note that even when this option is set, you can still see those names by
4226 explicitly typing a
4226 explicitly typing a
4227 \family typewriter
4227 \family typewriter
4228 _
4228 _
4229 \family default
4229 \family default
4230 after the period and hitting
4230 after the period and hitting
4231 \family typewriter
4231 \family typewriter
4232 <tab>
4232 <tab>
4233 \family default
4233 \family default
4234 : '
4234 : '
4235 \family typewriter
4235 \family typewriter
4236 name._<tab>
4236 name._<tab>
4237 \family default
4237 \family default
4238 ' will always complete attribute names starting with '
4238 ' will always complete attribute names starting with '
4239 \family typewriter
4239 \family typewriter
4240 _
4240 _
4241 \family default
4241 \family default
4242 '.
4242 '.
4243 \layout List
4243 \layout List
4244 \labelwidthstring 00.00.0000
4244 \labelwidthstring 00.00.0000
4245
4245
4246 \SpecialChar ~
4246 \SpecialChar ~
4247 This option is off by default so that new users see all attributes of any
4247 This option is off by default so that new users see all attributes of any
4248 objects they are dealing with.
4248 objects they are dealing with.
4249 \layout Standard
4249 \layout Standard
4250
4250
4251 You will find the default values along with a corresponding detailed explanation
4251 You will find the default values along with a corresponding detailed explanation
4252 in your
4252 in your
4253 \family typewriter
4253 \family typewriter
4254 ipythonrc
4254 ipythonrc
4255 \family default
4255 \family default
4256 file.
4256 file.
4257 \layout Subsection
4257 \layout Subsection
4258
4258
4259 Session logging and restoring
4259 Session logging and restoring
4260 \layout Standard
4260 \layout Standard
4261
4261
4262 You can log all input from a session either by starting IPython with the
4262 You can log all input from a session either by starting IPython with the
4263 command line switches
4263 command line switches
4264 \family typewriter
4264 \family typewriter
4265 -log
4265 -log
4266 \family default
4266 \family default
4267 or
4267 or
4268 \family typewriter
4268 \family typewriter
4269 -logfile
4269 -logfile
4270 \family default
4270 \family default
4271 (see sec.
4271 (see sec.
4272
4272
4273 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
4273 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
4274
4274
4275 \end_inset
4275 \end_inset
4276
4276
4277 )or by activating the logging at any moment with the magic function
4277 )or by activating the logging at any moment with the magic function
4278 \family typewriter
4278 \family typewriter
4279 %logstart
4279 %logstart
4280 \family default
4280 \family default
4281 .
4281 .
4282
4282
4283 \layout Standard
4283 \layout Standard
4284
4284
4285 Log files can later be reloaded with the
4285 Log files can later be reloaded with the
4286 \family typewriter
4286 \family typewriter
4287 -logplay
4287 -logplay
4288 \family default
4288 \family default
4289 option and IPython will attempt to 'replay' the log by executing all the
4289 option and IPython will attempt to 'replay' the log by executing all the
4290 lines in it, thus restoring the state of a previous session.
4290 lines in it, thus restoring the state of a previous session.
4291 This feature is not quite perfect, but can still be useful in many cases.
4291 This feature is not quite perfect, but can still be useful in many cases.
4292 \layout Standard
4292 \layout Standard
4293
4293
4294 The log files can also be used as a way to have a permanent record of any
4294 The log files can also be used as a way to have a permanent record of any
4295 code you wrote while experimenting.
4295 code you wrote while experimenting.
4296 Log files are regular text files which you can later open in your favorite
4296 Log files are regular text files which you can later open in your favorite
4297 text editor to extract code or to 'clean them up' before using them to
4297 text editor to extract code or to 'clean them up' before using them to
4298 replay a session.
4298 replay a session.
4299 \layout Standard
4299 \layout Standard
4300
4300
4301 The
4301 The
4302 \family typewriter
4302 \family typewriter
4303 %logstart
4303 %logstart
4304 \family default
4304 \family default
4305 function for activating logging in mid-session is used as follows:
4305 function for activating logging in mid-session is used as follows:
4306 \layout Standard
4306 \layout Standard
4307
4307
4308
4308
4309 \family typewriter
4309 \family typewriter
4310 %logstart [log_name [log_mode]]
4310 %logstart [log_name [log_mode]]
4311 \layout Standard
4311 \layout Standard
4312
4312
4313 If no name is given, it defaults to a file named
4313 If no name is given, it defaults to a file named
4314 \family typewriter
4314 \family typewriter
4315 'log'
4315 'log'
4316 \family default
4316 \family default
4317 in your IPYTHONDIR directory, in
4317 in your IPYTHONDIR directory, in
4318 \family typewriter
4318 \family typewriter
4319 'rotate'
4319 'rotate'
4320 \family default
4320 \family default
4321 mode (see below).
4321 mode (see below).
4322 \layout Standard
4322 \layout Standard
4323
4323
4324 '
4324 '
4325 \family typewriter
4325 \family typewriter
4326 %logstart name
4326 %logstart name
4327 \family default
4327 \family default
4328 ' saves to file
4328 ' saves to file
4329 \family typewriter
4329 \family typewriter
4330 'name'
4330 'name'
4331 \family default
4331 \family default
4332 in
4332 in
4333 \family typewriter
4333 \family typewriter
4334 'backup'
4334 'backup'
4335 \family default
4335 \family default
4336 mode.
4336 mode.
4337 It saves your history up to that point and then continues logging.
4337 It saves your history up to that point and then continues logging.
4338 \layout Standard
4338 \layout Standard
4339
4339
4340
4340
4341 \family typewriter
4341 \family typewriter
4342 %logstart
4342 %logstart
4343 \family default
4343 \family default
4344 takes a second optional parameter: logging mode.
4344 takes a second optional parameter: logging mode.
4345 This can be one of (note that the modes are given unquoted):
4345 This can be one of (note that the modes are given unquoted):
4346 \layout List
4346 \layout List
4347 \labelwidthstring 00.00.0000
4347 \labelwidthstring 00.00.0000
4348
4348
4349
4349
4350 \family typewriter
4350 \family typewriter
4351 over
4351 over
4352 \family default
4352 \family default
4353 : overwrite existing
4353 : overwrite existing
4354 \family typewriter
4354 \family typewriter
4355 log_name
4355 log_name
4356 \family default
4356 \family default
4357 .
4357 .
4358 \layout List
4358 \layout List
4359 \labelwidthstring 00.00.0000
4359 \labelwidthstring 00.00.0000
4360
4360
4361
4361
4362 \family typewriter
4362 \family typewriter
4363 backup
4363 backup
4364 \family default
4364 \family default
4365 : rename (if exists) to
4365 : rename (if exists) to
4366 \family typewriter
4366 \family typewriter
4367 log_name~
4367 log_name~
4368 \family default
4368 \family default
4369 and start
4369 and start
4370 \family typewriter
4370 \family typewriter
4371 log_name
4371 log_name
4372 \family default
4372 \family default
4373 .
4373 .
4374 \layout List
4374 \layout List
4375 \labelwidthstring 00.00.0000
4375 \labelwidthstring 00.00.0000
4376
4376
4377
4377
4378 \family typewriter
4378 \family typewriter
4379 append
4379 append
4380 \family default
4380 \family default
4381 : well, that says it.
4381 : well, that says it.
4382 \layout List
4382 \layout List
4383 \labelwidthstring 00.00.0000
4383 \labelwidthstring 00.00.0000
4384
4384
4385
4385
4386 \family typewriter
4386 \family typewriter
4387 rotate
4387 rotate
4388 \family default
4388 \family default
4389 : create rotating logs
4389 : create rotating logs
4390 \family typewriter
4390 \family typewriter
4391 log_name
4391 log_name
4392 \family default
4392 \family default
4393 .
4393 .
4394 \family typewriter
4394 \family typewriter
4395 1~
4395 1~
4396 \family default
4396 \family default
4397 ,
4397 ,
4398 \family typewriter
4398 \family typewriter
4399 log_name.2~
4399 log_name.2~
4400 \family default
4400 \family default
4401 , etc.
4401 , etc.
4402 \layout Standard
4402 \layout Standard
4403
4403
4404 The
4404 The
4405 \family typewriter
4405 \family typewriter
4406 %logoff
4406 %logoff
4407 \family default
4407 \family default
4408 and
4408 and
4409 \family typewriter
4409 \family typewriter
4410 %logon
4410 %logon
4411 \family default
4411 \family default
4412 functions allow you to temporarily stop and resume logging to a file which
4412 functions allow you to temporarily stop and resume logging to a file which
4413 had previously been started with
4413 had previously been started with
4414 \family typewriter
4414 \family typewriter
4415 %logstart
4415 %logstart
4416 \family default
4416 \family default
4417 .
4417 .
4418 They will fail (with an explanation) if you try to use them before logging
4418 They will fail (with an explanation) if you try to use them before logging
4419 has been started.
4419 has been started.
4420 \layout Subsection
4420 \layout Subsection
4421
4421
4422
4422
4423 \begin_inset LatexCommand \label{sub:System-shell-access}
4423 \begin_inset LatexCommand \label{sub:System-shell-access}
4424
4424
4425 \end_inset
4425 \end_inset
4426
4426
4427 System shell access
4427 System shell access
4428 \layout Standard
4428 \layout Standard
4429
4429
4430 Any input line beginning with a
4430 Any input line beginning with a
4431 \family typewriter
4431 \family typewriter
4432 !
4432 !
4433 \family default
4433 \family default
4434 character is passed verbatim (minus the
4434 character is passed verbatim (minus the
4435 \family typewriter
4435 \family typewriter
4436 !
4436 !
4437 \family default
4437 \family default
4438 , of course) to the underlying operating system.
4438 , of course) to the underlying operating system.
4439 For example, typing
4439 For example, typing
4440 \family typewriter
4440 \family typewriter
4441 !ls
4441 !ls
4442 \family default
4442 \family default
4443 will run
4443 will run
4444 \family typewriter
4444 \family typewriter
4445 'ls'
4445 'ls'
4446 \family default
4446 \family default
4447 in the current directory.
4447 in the current directory.
4448 \layout Subsubsection
4448 \layout Subsubsection
4449
4449
4450 Manual capture of command output
4450 Manual capture of command output
4451 \layout Standard
4451 \layout Standard
4452
4452
4453 If the input line begins with
4453 If the input line begins with
4454 \emph on
4454 \emph on
4455 two
4455 two
4456 \emph default
4456 \emph default
4457 exclamation marks,
4457 exclamation marks,
4458 \family typewriter
4458 \family typewriter
4459 !!
4459 !!
4460 \family default
4460 \family default
4461 , the command is executed but its output is captured and returned as a python
4461 , the command is executed but its output is captured and returned as a python
4462 list, split on newlines.
4462 list, split on newlines.
4463 Any output sent by the subprocess to standard error is printed separately,
4463 Any output sent by the subprocess to standard error is printed separately,
4464 so that the resulting list only captures standard output.
4464 so that the resulting list only captures standard output.
4465 The
4465 The
4466 \family typewriter
4466 \family typewriter
4467 !!
4467 !!
4468 \family default
4468 \family default
4469 syntax is a shorthand for the
4469 syntax is a shorthand for the
4470 \family typewriter
4470 \family typewriter
4471 %sx
4471 %sx
4472 \family default
4472 \family default
4473 magic command.
4473 magic command.
4474 \layout Standard
4474 \layout Standard
4475
4475
4476 Finally, the
4476 Finally, the
4477 \family typewriter
4477 \family typewriter
4478 %sc
4478 %sc
4479 \family default
4479 \family default
4480 magic (short for `shell capture') is similar to
4480 magic (short for `shell capture') is similar to
4481 \family typewriter
4481 \family typewriter
4482 %sx
4482 %sx
4483 \family default
4483 \family default
4484 , but allowing more fine-grained control of the capture details, and storing
4484 , but allowing more fine-grained control of the capture details, and storing
4485 the result directly into a named variable.
4485 the result directly into a named variable.
4486 \layout Standard
4486 \layout Standard
4487
4487
4488 See Sec.\SpecialChar ~
4488 See Sec.\SpecialChar ~
4489
4489
4490 \begin_inset LatexCommand \ref{sec:magic}
4490 \begin_inset LatexCommand \ref{sec:magic}
4491
4491
4492 \end_inset
4492 \end_inset
4493
4493
4494 for details on the magics
4494 for details on the magics
4495 \family typewriter
4495 \family typewriter
4496 %sc
4496 %sc
4497 \family default
4497 \family default
4498 and
4498 and
4499 \family typewriter
4499 \family typewriter
4500 %sx
4500 %sx
4501 \family default
4501 \family default
4502 , or use IPython's own help (
4502 , or use IPython's own help (
4503 \family typewriter
4503 \family typewriter
4504 sc?
4504 sc?
4505 \family default
4505 \family default
4506 and
4506 and
4507 \family typewriter
4507 \family typewriter
4508 sx?
4508 sx?
4509 \family default
4509 \family default
4510 ) for further details.
4510 ) for further details.
4511 \layout Standard
4511 \layout Standard
4512
4512
4513 IPython also allows you to expand the value of python variables when making
4513 IPython also allows you to expand the value of python variables when making
4514 system calls.
4514 system calls.
4515 Any python variable or expression which you prepend with
4515 Any python variable or expression which you prepend with
4516 \family typewriter
4516 \family typewriter
4517 $
4517 $
4518 \family default
4518 \family default
4519 will get expanded before the system call is made.
4519 will get expanded before the system call is made.
4520
4520
4521 \layout Standard
4521 \layout Standard
4522
4522
4523
4523
4524 \family typewriter
4524 \family typewriter
4525 In [1]: pyvar='Hello world'
4525 In [1]: pyvar='Hello world'
4526 \newline
4526 \newline
4527 In [2]: !echo "A python variable: $pyvar"
4527 In [2]: !echo "A python variable: $pyvar"
4528 \newline
4528 \newline
4529 A python variable: Hello world
4529 A python variable: Hello world
4530 \layout Standard
4530 \layout Standard
4531
4531
4532 If you want the shell to actually see a literal
4532 If you want the shell to actually see a literal
4533 \family typewriter
4533 \family typewriter
4534 $
4534 $
4535 \family default
4535 \family default
4536 , you need to type it twice:
4536 , you need to type it twice:
4537 \layout Standard
4537 \layout Standard
4538
4538
4539
4539
4540 \family typewriter
4540 \family typewriter
4541 In [3]: !echo "A system variable: $$HOME"
4541 In [3]: !echo "A system variable: $$HOME"
4542 \newline
4542 \newline
4543 A system variable: /home/fperez
4543 A system variable: /home/fperez
4544 \layout Standard
4544 \layout Standard
4545
4545
4546 You can pass arbitrary expressions, though you'll need to delimit them with
4546 You can pass arbitrary expressions, though you'll need to delimit them with
4547
4547
4548 \family typewriter
4548 \family typewriter
4549 {}
4549 {}
4550 \family default
4550 \family default
4551 if there is ambiguity as to the extent of the expression:
4551 if there is ambiguity as to the extent of the expression:
4552 \layout Standard
4552 \layout Standard
4553
4553
4554
4554
4555 \family typewriter
4555 \family typewriter
4556 In [5]: x=10
4556 In [5]: x=10
4557 \newline
4557 \newline
4558 In [6]: y=20
4558 In [6]: y=20
4559 \newline
4559 \newline
4560 In [13]: !echo $x+y
4560 In [13]: !echo $x+y
4561 \newline
4561 \newline
4562 10+y
4562 10+y
4563 \newline
4563 \newline
4564 In [7]: !echo ${x+y}
4564 In [7]: !echo ${x+y}
4565 \newline
4565 \newline
4566 30
4566 30
4567 \layout Standard
4567 \layout Standard
4568
4568
4569 Even object attributes can be expanded:
4569 Even object attributes can be expanded:
4570 \layout Standard
4570 \layout Standard
4571
4571
4572
4572
4573 \family typewriter
4573 \family typewriter
4574 In [12]: !echo $sys.argv
4574 In [12]: !echo $sys.argv
4575 \newline
4575 \newline
4576 [/home/fperez/usr/bin/ipython]
4576 [/home/fperez/usr/bin/ipython]
4577 \layout Subsection
4577 \layout Subsection
4578
4578
4579 System command aliases
4579 System command aliases
4580 \layout Standard
4580 \layout Standard
4581
4581
4582 The
4582 The
4583 \family typewriter
4583 \family typewriter
4584 %alias
4584 %alias
4585 \family default
4585 \family default
4586 magic function and the
4586 magic function and the
4587 \family typewriter
4587 \family typewriter
4588 alias
4588 alias
4589 \family default
4589 \family default
4590 option in the
4590 option in the
4591 \family typewriter
4591 \family typewriter
4592 ipythonrc
4592 ipythonrc
4593 \family default
4593 \family default
4594 configuration file allow you to define magic functions which are in fact
4594 configuration file allow you to define magic functions which are in fact
4595 system shell commands.
4595 system shell commands.
4596 These aliases can have parameters.
4596 These aliases can have parameters.
4597
4597
4598 \layout Standard
4598 \layout Standard
4599
4599
4600 '
4600 '
4601 \family typewriter
4601 \family typewriter
4602 %alias alias_name cmd
4602 %alias alias_name cmd
4603 \family default
4603 \family default
4604 ' defines '
4604 ' defines '
4605 \family typewriter
4605 \family typewriter
4606 alias_name
4606 alias_name
4607 \family default
4607 \family default
4608 ' as an alias for '
4608 ' as an alias for '
4609 \family typewriter
4609 \family typewriter
4610 cmd
4610 cmd
4611 \family default
4611 \family default
4612 '
4612 '
4613 \layout Standard
4613 \layout Standard
4614
4614
4615 Then, typing '
4615 Then, typing '
4616 \family typewriter
4616 \family typewriter
4617 %alias_name params
4617 %alias_name params
4618 \family default
4618 \family default
4619 ' will execute the system command '
4619 ' will execute the system command '
4620 \family typewriter
4620 \family typewriter
4621 cmd params
4621 cmd params
4622 \family default
4622 \family default
4623 ' (from your underlying operating system).
4623 ' (from your underlying operating system).
4624
4624
4625 \layout Standard
4625 \layout Standard
4626
4626
4627 You can also define aliases with parameters using
4627 You can also define aliases with parameters using
4628 \family typewriter
4628 \family typewriter
4629 %s
4629 %s
4630 \family default
4630 \family default
4631 specifiers (one per parameter).
4631 specifiers (one per parameter).
4632 The following example defines the
4632 The following example defines the
4633 \family typewriter
4633 \family typewriter
4634 %parts
4634 %parts
4635 \family default
4635 \family default
4636 function as an alias to the command '
4636 function as an alias to the command '
4637 \family typewriter
4637 \family typewriter
4638 echo first %s second %s
4638 echo first %s second %s
4639 \family default
4639 \family default
4640 ' where each
4640 ' where each
4641 \family typewriter
4641 \family typewriter
4642 %s
4642 %s
4643 \family default
4643 \family default
4644 will be replaced by a positional parameter to the call to
4644 will be replaced by a positional parameter to the call to
4645 \family typewriter
4645 \family typewriter
4646 %parts:
4646 %parts:
4647 \layout Standard
4647 \layout Standard
4648
4648
4649
4649
4650 \family typewriter
4650 \family typewriter
4651 In [1]: alias parts echo first %s second %s
4651 In [1]: alias parts echo first %s second %s
4652 \newline
4652 \newline
4653 In [2]: %parts A B
4653 In [2]: %parts A B
4654 \newline
4654 \newline
4655 first A second B
4655 first A second B
4656 \newline
4656 \newline
4657 In [3]: %parts A
4657 In [3]: %parts A
4658 \newline
4658 \newline
4659 Incorrect number of arguments: 2 expected.
4659 Incorrect number of arguments: 2 expected.
4660
4660
4661 \newline
4661 \newline
4662 parts is an alias to: 'echo first %s second %s'
4662 parts is an alias to: 'echo first %s second %s'
4663 \layout Standard
4663 \layout Standard
4664
4664
4665 If called with no parameters,
4665 If called with no parameters,
4666 \family typewriter
4666 \family typewriter
4667 %alias
4667 %alias
4668 \family default
4668 \family default
4669 prints the table of currently defined aliases.
4669 prints the table of currently defined aliases.
4670 \layout Standard
4670 \layout Standard
4671
4671
4672 The
4672 The
4673 \family typewriter
4673 \family typewriter
4674 %rehash/rehashx
4674 %rehash/rehashx
4675 \family default
4675 \family default
4676 magics allow you to load your entire
4676 magics allow you to load your entire
4677 \family typewriter
4677 \family typewriter
4678 $PATH
4678 $PATH
4679 \family default
4679 \family default
4680 as ipython aliases.
4680 as ipython aliases.
4681 See their respective docstrings (or sec.\SpecialChar ~
4681 See their respective docstrings (or sec.\SpecialChar ~
4682
4682
4683 \begin_inset LatexCommand \ref{sec:magic}
4683 \begin_inset LatexCommand \ref{sec:magic}
4684
4684
4685 \end_inset
4685 \end_inset
4686
4686
4687 for further details).
4687 for further details).
4688 \layout Subsection
4688 \layout Subsection
4689
4689
4690
4690
4691 \begin_inset LatexCommand \label{sec:dreload}
4691 \begin_inset LatexCommand \label{sec:dreload}
4692
4692
4693 \end_inset
4693 \end_inset
4694
4694
4695 Recursive reload
4695 Recursive reload
4696 \layout Standard
4696 \layout Standard
4697
4697
4698 The
4698 The
4699 \family typewriter
4699 \family typewriter
4700 %dreload
4700 %dreload
4701 \family default
4701 \family default
4702 command does a recursive reload of a module: changes made to the module
4702 command does a recursive reload of a module: changes made to the module
4703 since you imported will actually be available without having to exit.
4703 since you imported will actually be available without having to exit.
4704 \layout Subsection
4704 \layout Subsection
4705
4705
4706 Verbose and colored exception traceback printouts
4706 Verbose and colored exception traceback printouts
4707 \layout Standard
4707 \layout Standard
4708
4708
4709 IPython provides the option to see very detailed exception tracebacks, which
4709 IPython provides the option to see very detailed exception tracebacks, which
4710 can be especially useful when debugging large programs.
4710 can be especially useful when debugging large programs.
4711 You can run any Python file with the
4711 You can run any Python file with the
4712 \family typewriter
4712 \family typewriter
4713 %run
4713 %run
4714 \family default
4714 \family default
4715 function to benefit from these detailed tracebacks.
4715 function to benefit from these detailed tracebacks.
4716 Furthermore, both normal and verbose tracebacks can be colored (if your
4716 Furthermore, both normal and verbose tracebacks can be colored (if your
4717 terminal supports it) which makes them much easier to parse visually.
4717 terminal supports it) which makes them much easier to parse visually.
4718 \layout Standard
4718 \layout Standard
4719
4719
4720 See the magic
4720 See the magic
4721 \family typewriter
4721 \family typewriter
4722 xmode
4722 xmode
4723 \family default
4723 \family default
4724 and
4724 and
4725 \family typewriter
4725 \family typewriter
4726 colors
4726 colors
4727 \family default
4727 \family default
4728 functions for details (just type
4728 functions for details (just type
4729 \family typewriter
4729 \family typewriter
4730 %magic
4730 %magic
4731 \family default
4731 \family default
4732 ).
4732 ).
4733 \layout Standard
4733 \layout Standard
4734
4734
4735 These features are basically a terminal version of Ka-Ping Yee's
4735 These features are basically a terminal version of Ka-Ping Yee's
4736 \family typewriter
4736 \family typewriter
4737 cgitb
4737 cgitb
4738 \family default
4738 \family default
4739 module, now part of the standard Python library.
4739 module, now part of the standard Python library.
4740 \layout Subsection
4740 \layout Subsection
4741
4741
4742
4742
4743 \begin_inset LatexCommand \label{sec:cache_input}
4743 \begin_inset LatexCommand \label{sec:cache_input}
4744
4744
4745 \end_inset
4745 \end_inset
4746
4746
4747 Input caching system
4747 Input caching system
4748 \layout Standard
4748 \layout Standard
4749
4749
4750 IPython offers numbered prompts (In/Out) with input and output caching.
4750 IPython offers numbered prompts (In/Out) with input and output caching.
4751 All input is saved and can be retrieved as variables (besides the usual
4751 All input is saved and can be retrieved as variables (besides the usual
4752 arrow key recall).
4752 arrow key recall).
4753 \layout Standard
4753 \layout Standard
4754
4754
4755 The following GLOBAL variables always exist (so don't overwrite them!):
4755 The following GLOBAL variables always exist (so don't overwrite them!):
4756
4756
4757 \family typewriter
4757 \family typewriter
4758 _i
4758 _i
4759 \family default
4759 \family default
4760 : stores previous input.
4760 : stores previous input.
4761
4761
4762 \family typewriter
4762 \family typewriter
4763 _ii
4763 _ii
4764 \family default
4764 \family default
4765 : next previous.
4765 : next previous.
4766
4766
4767 \family typewriter
4767 \family typewriter
4768 _iii
4768 _iii
4769 \family default
4769 \family default
4770 : next-next previous.
4770 : next-next previous.
4771
4771
4772 \family typewriter
4772 \family typewriter
4773 _ih
4773 _ih
4774 \family default
4774 \family default
4775 : a list of all input
4775 : a list of all input
4776 \family typewriter
4776 \family typewriter
4777 _ih[n]
4777 _ih[n]
4778 \family default
4778 \family default
4779 is the input from line
4779 is the input from line
4780 \family typewriter
4780 \family typewriter
4781 n
4781 n
4782 \family default
4782 \family default
4783 and this list is aliased to the global variable
4783 and this list is aliased to the global variable
4784 \family typewriter
4784 \family typewriter
4785 In
4785 In
4786 \family default
4786 \family default
4787 .
4787 .
4788 If you overwrite
4788 If you overwrite
4789 \family typewriter
4789 \family typewriter
4790 In
4790 In
4791 \family default
4791 \family default
4792 with a variable of your own, you can remake the assignment to the internal
4792 with a variable of your own, you can remake the assignment to the internal
4793 list with a simple
4793 list with a simple
4794 \family typewriter
4794 \family typewriter
4795 'In=_ih'
4795 'In=_ih'
4796 \family default
4796 \family default
4797 .
4797 .
4798 \layout Standard
4798 \layout Standard
4799
4799
4800 Additionally, global variables named
4800 Additionally, global variables named
4801 \family typewriter
4801 \family typewriter
4802 _i<n>
4802 _i<n>
4803 \family default
4803 \family default
4804 are dynamically created (
4804 are dynamically created (
4805 \family typewriter
4805 \family typewriter
4806 <n>
4806 <n>
4807 \family default
4807 \family default
4808 being the prompt counter), such that
4808 being the prompt counter), such that
4809 \newline
4809 \newline
4810
4810
4811 \family typewriter
4811 \family typewriter
4812 _i<n> == _ih[<n>] == In[<n>].
4812 _i<n> == _ih[<n>] == In[<n>].
4813 \layout Standard
4813 \layout Standard
4814
4814
4815 For example, what you typed at prompt 14 is available as
4815 For example, what you typed at prompt 14 is available as
4816 \family typewriter
4816 \family typewriter
4817 _i14,
4817 _i14,
4818 \family default
4818 \family default
4819
4819
4820 \family typewriter
4820 \family typewriter
4821 _ih[14]
4821 _ih[14]
4822 \family default
4822 \family default
4823 and
4823 and
4824 \family typewriter
4824 \family typewriter
4825 In[14]
4825 In[14]
4826 \family default
4826 \family default
4827 .
4827 .
4828 \layout Standard
4828 \layout Standard
4829
4829
4830 This allows you to easily cut and paste multi line interactive prompts by
4830 This allows you to easily cut and paste multi line interactive prompts by
4831 printing them out: they print like a clean string, without prompt characters.
4831 printing them out: they print like a clean string, without prompt characters.
4832 You can also manipulate them like regular variables (they are strings),
4832 You can also manipulate them like regular variables (they are strings),
4833 modify or exec them (typing
4833 modify or exec them (typing
4834 \family typewriter
4834 \family typewriter
4835 'exec _i9'
4835 'exec _i9'
4836 \family default
4836 \family default
4837 will re-execute the contents of input prompt 9, '
4837 will re-execute the contents of input prompt 9, '
4838 \family typewriter
4838 \family typewriter
4839 exec In[9:14]+In[18]
4839 exec In[9:14]+In[18]
4840 \family default
4840 \family default
4841 ' will re-execute lines 9 through 13 and line 18).
4841 ' will re-execute lines 9 through 13 and line 18).
4842 \layout Standard
4842 \layout Standard
4843
4843
4844 You can also re-execute multiple lines of input easily by using the magic
4844 You can also re-execute multiple lines of input easily by using the magic
4845
4845
4846 \family typewriter
4846 \family typewriter
4847 %macro
4847 %macro
4848 \family default
4848 \family default
4849 function (which automates the process and allows re-execution without having
4849 function (which automates the process and allows re-execution without having
4850 to type '
4850 to type '
4851 \family typewriter
4851 \family typewriter
4852 exec
4852 exec
4853 \family default
4853 \family default
4854 ' every time).
4854 ' every time).
4855 The macro system also allows you to re-execute previous lines which include
4855 The macro system also allows you to re-execute previous lines which include
4856 magic function calls (which require special processing).
4856 magic function calls (which require special processing).
4857 Type
4857 Type
4858 \family typewriter
4858 \family typewriter
4859 %macro?
4859 %macro?
4860 \family default
4860 \family default
4861 or see sec.
4861 or see sec.
4862
4862
4863 \begin_inset LatexCommand \ref{sec:magic}
4863 \begin_inset LatexCommand \ref{sec:magic}
4864
4864
4865 \end_inset
4865 \end_inset
4866
4866
4867 for more details on the macro system.
4867 for more details on the macro system.
4868 \layout Standard
4868 \layout Standard
4869
4869
4870 A history function
4870 A history function
4871 \family typewriter
4871 \family typewriter
4872 %hist
4872 %hist
4873 \family default
4873 \family default
4874 allows you to see any part of your input history by printing a range of
4874 allows you to see any part of your input history by printing a range of
4875 the
4875 the
4876 \family typewriter
4876 \family typewriter
4877 _i
4877 _i
4878 \family default
4878 \family default
4879 variables.
4879 variables.
4880 \layout Subsection
4880 \layout Subsection
4881
4881
4882
4882
4883 \begin_inset LatexCommand \label{sec:cache_output}
4883 \begin_inset LatexCommand \label{sec:cache_output}
4884
4884
4885 \end_inset
4885 \end_inset
4886
4886
4887 Output caching system
4887 Output caching system
4888 \layout Standard
4888 \layout Standard
4889
4889
4890 For output that is returned from actions, a system similar to the input
4890 For output that is returned from actions, a system similar to the input
4891 cache exists but using
4891 cache exists but using
4892 \family typewriter
4892 \family typewriter
4893 _
4893 _
4894 \family default
4894 \family default
4895 instead of
4895 instead of
4896 \family typewriter
4896 \family typewriter
4897 _i
4897 _i
4898 \family default
4898 \family default
4899 .
4899 .
4900 Only actions that produce a result (NOT assignments, for example) are cached.
4900 Only actions that produce a result (NOT assignments, for example) are cached.
4901 If you are familiar with Mathematica, IPython's
4901 If you are familiar with Mathematica, IPython's
4902 \family typewriter
4902 \family typewriter
4903 _
4903 _
4904 \family default
4904 \family default
4905 variables behave exactly like Mathematica's
4905 variables behave exactly like Mathematica's
4906 \family typewriter
4906 \family typewriter
4907 %
4907 %
4908 \family default
4908 \family default
4909 variables.
4909 variables.
4910 \layout Standard
4910 \layout Standard
4911
4911
4912 The following GLOBAL variables always exist (so don't overwrite them!):
4912 The following GLOBAL variables always exist (so don't overwrite them!):
4913
4913
4914 \layout List
4914 \layout List
4915 \labelwidthstring 00.00.0000
4915 \labelwidthstring 00.00.0000
4916
4916
4917
4917
4918 \family typewriter
4918 \family typewriter
4919 \series bold
4919 \series bold
4920 _
4920 _
4921 \family default
4921 \family default
4922 \series default
4922 \series default
4923 (a
4923 (a
4924 \emph on
4924 \emph on
4925 single
4925 single
4926 \emph default
4926 \emph default
4927 underscore) : stores previous output, like Python's default interpreter.
4927 underscore) : stores previous output, like Python's default interpreter.
4928 \layout List
4928 \layout List
4929 \labelwidthstring 00.00.0000
4929 \labelwidthstring 00.00.0000
4930
4930
4931
4931
4932 \family typewriter
4932 \family typewriter
4933 \series bold
4933 \series bold
4934 __
4934 __
4935 \family default
4935 \family default
4936 \series default
4936 \series default
4937 (two underscores): next previous.
4937 (two underscores): next previous.
4938 \layout List
4938 \layout List
4939 \labelwidthstring 00.00.0000
4939 \labelwidthstring 00.00.0000
4940
4940
4941
4941
4942 \family typewriter
4942 \family typewriter
4943 \series bold
4943 \series bold
4944 ___
4944 ___
4945 \family default
4945 \family default
4946 \series default
4946 \series default
4947 (three underscores): next-next previous.
4947 (three underscores): next-next previous.
4948 \layout Standard
4948 \layout Standard
4949
4949
4950 Additionally, global variables named
4950 Additionally, global variables named
4951 \family typewriter
4951 \family typewriter
4952 _<n>
4952 _<n>
4953 \family default
4953 \family default
4954 are dynamically created (
4954 are dynamically created (
4955 \family typewriter
4955 \family typewriter
4956 <n>
4956 <n>
4957 \family default
4957 \family default
4958 being the prompt counter), such that the result of output
4958 being the prompt counter), such that the result of output
4959 \family typewriter
4959 \family typewriter
4960 <n>
4960 <n>
4961 \family default
4961 \family default
4962 is always available as
4962 is always available as
4963 \family typewriter
4963 \family typewriter
4964 _<n>
4964 _<n>
4965 \family default
4965 \family default
4966 (don't use the angle brackets, just the number, e.g.
4966 (don't use the angle brackets, just the number, e.g.
4967
4967
4968 \family typewriter
4968 \family typewriter
4969 _21
4969 _21
4970 \family default
4970 \family default
4971 ).
4971 ).
4972 \layout Standard
4972 \layout Standard
4973
4973
4974 These global variables are all stored in a global dictionary (not a list,
4974 These global variables are all stored in a global dictionary (not a list,
4975 since it only has entries for lines which returned a result) available
4975 since it only has entries for lines which returned a result) available
4976 under the names
4976 under the names
4977 \family typewriter
4977 \family typewriter
4978 _oh
4978 _oh
4979 \family default
4979 \family default
4980 and
4980 and
4981 \family typewriter
4981 \family typewriter
4982 Out
4982 Out
4983 \family default
4983 \family default
4984 (similar to
4984 (similar to
4985 \family typewriter
4985 \family typewriter
4986 _ih
4986 _ih
4987 \family default
4987 \family default
4988 and
4988 and
4989 \family typewriter
4989 \family typewriter
4990 In
4990 In
4991 \family default
4991 \family default
4992 ).
4992 ).
4993 So the output from line 12 can be obtained as
4993 So the output from line 12 can be obtained as
4994 \family typewriter
4994 \family typewriter
4995 _12
4995 _12
4996 \family default
4996 \family default
4997 ,
4997 ,
4998 \family typewriter
4998 \family typewriter
4999 Out[12]
4999 Out[12]
5000 \family default
5000 \family default
5001 or
5001 or
5002 \family typewriter
5002 \family typewriter
5003 _oh[12]
5003 _oh[12]
5004 \family default
5004 \family default
5005 .
5005 .
5006 If you accidentally overwrite the
5006 If you accidentally overwrite the
5007 \family typewriter
5007 \family typewriter
5008 Out
5008 Out
5009 \family default
5009 \family default
5010 variable you can recover it by typing
5010 variable you can recover it by typing
5011 \family typewriter
5011 \family typewriter
5012 'Out=_oh
5012 'Out=_oh
5013 \family default
5013 \family default
5014 ' at the prompt.
5014 ' at the prompt.
5015 \layout Standard
5015 \layout Standard
5016
5016
5017 This system obviously can potentially put heavy memory demands on your system,
5017 This system obviously can potentially put heavy memory demands on your system,
5018 since it prevents Python's garbage collector from removing any previously
5018 since it prevents Python's garbage collector from removing any previously
5019 computed results.
5019 computed results.
5020 You can control how many results are kept in memory with the option (at
5020 You can control how many results are kept in memory with the option (at
5021 the command line or in your
5021 the command line or in your
5022 \family typewriter
5022 \family typewriter
5023 ipythonrc
5023 ipythonrc
5024 \family default
5024 \family default
5025 file)
5025 file)
5026 \family typewriter
5026 \family typewriter
5027 cache_size
5027 cache_size
5028 \family default
5028 \family default
5029 .
5029 .
5030 If you set it to 0, the whole system is completely disabled and the prompts
5030 If you set it to 0, the whole system is completely disabled and the prompts
5031 revert to the classic
5031 revert to the classic
5032 \family typewriter
5032 \family typewriter
5033 '>>>'
5033 '>>>'
5034 \family default
5034 \family default
5035 of normal Python.
5035 of normal Python.
5036 \layout Subsection
5036 \layout Subsection
5037
5037
5038 Directory history
5038 Directory history
5039 \layout Standard
5039 \layout Standard
5040
5040
5041 Your history of visited directories is kept in the global list
5041 Your history of visited directories is kept in the global list
5042 \family typewriter
5042 \family typewriter
5043 _dh
5043 _dh
5044 \family default
5044 \family default
5045 , and the magic
5045 , and the magic
5046 \family typewriter
5046 \family typewriter
5047 %cd
5047 %cd
5048 \family default
5048 \family default
5049 command can be used to go to any entry in that list.
5049 command can be used to go to any entry in that list.
5050 The
5050 The
5051 \family typewriter
5051 \family typewriter
5052 %dhist
5052 %dhist
5053 \family default
5053 \family default
5054 command allows you to view this history.
5054 command allows you to view this history.
5055 \layout Subsection
5055 \layout Subsection
5056
5056
5057 Automatic parentheses and quotes
5057 Automatic parentheses and quotes
5058 \layout Standard
5058 \layout Standard
5059
5059
5060 These features were adapted from Nathan Gray's LazyPython.
5060 These features were adapted from Nathan Gray's LazyPython.
5061 They are meant to allow less typing for common situations.
5061 They are meant to allow less typing for common situations.
5062 \layout Subsubsection
5062 \layout Subsubsection
5063
5063
5064 Automatic parentheses
5064 Automatic parentheses
5065 \layout Standard
5065 \layout Standard
5066
5066
5067 Callable objects (i.e.
5067 Callable objects (i.e.
5068 functions, methods, etc) can be invoked like this (notice the commas between
5068 functions, methods, etc) can be invoked like this (notice the commas between
5069 the arguments):
5069 the arguments):
5070 \layout Standard
5070 \layout Standard
5071
5071
5072
5072
5073 \family typewriter
5073 \family typewriter
5074 >>> callable_ob arg1, arg2, arg3
5074 >>> callable_ob arg1, arg2, arg3
5075 \layout Standard
5075 \layout Standard
5076
5076
5077 and the input will be translated to this:
5077 and the input will be translated to this:
5078 \layout Standard
5078 \layout Standard
5079
5079
5080
5080
5081 \family typewriter
5081 \family typewriter
5082 --> callable_ob(arg1, arg2, arg3)
5082 --> callable_ob(arg1, arg2, arg3)
5083 \layout Standard
5083 \layout Standard
5084
5084
5085 You can force automatic parentheses by using '/' as the first character
5085 You can force automatic parentheses by using '/' as the first character
5086 of a line.
5086 of a line.
5087 For example:
5087 For example:
5088 \layout Standard
5088 \layout Standard
5089
5089
5090
5090
5091 \family typewriter
5091 \family typewriter
5092 >>> /globals # becomes 'globals()'
5092 >>> /globals # becomes 'globals()'
5093 \layout Standard
5093 \layout Standard
5094
5094
5095 Note that the '/' MUST be the first character on the line! This won't work:
5095 Note that the '/' MUST be the first character on the line! This won't work:
5096
5096
5097 \layout Standard
5097 \layout Standard
5098
5098
5099
5099
5100 \family typewriter
5100 \family typewriter
5101 >>> print /globals # syntax error
5101 >>> print /globals # syntax error
5102 \layout Standard
5102 \layout Standard
5103
5103
5104 In most cases the automatic algorithm should work, so you should rarely
5104 In most cases the automatic algorithm should work, so you should rarely
5105 need to explicitly invoke /.
5105 need to explicitly invoke /.
5106 One notable exception is if you are trying to call a function with a list
5106 One notable exception is if you are trying to call a function with a list
5107 of tuples as arguments (the parenthesis will confuse IPython):
5107 of tuples as arguments (the parenthesis will confuse IPython):
5108 \layout Standard
5108 \layout Standard
5109
5109
5110
5110
5111 \family typewriter
5111 \family typewriter
5112 In [1]: zip (1,2,3),(4,5,6) # won't work
5112 In [1]: zip (1,2,3),(4,5,6) # won't work
5113 \layout Standard
5113 \layout Standard
5114
5114
5115 but this will work:
5115 but this will work:
5116 \layout Standard
5116 \layout Standard
5117
5117
5118
5118
5119 \family typewriter
5119 \family typewriter
5120 In [2]: /zip (1,2,3),(4,5,6)
5120 In [2]: /zip (1,2,3),(4,5,6)
5121 \newline
5121 \newline
5122 ------> zip ((1,2,3),(4,5,6))
5122 ------> zip ((1,2,3),(4,5,6))
5123 \newline
5123 \newline
5124 Out[2]= [(1, 4), (2, 5), (3, 6)]
5124 Out[2]= [(1, 4), (2, 5), (3, 6)]
5125 \layout Standard
5125 \layout Standard
5126
5126
5127 IPython tells you that it has altered your command line by displaying the
5127 IPython tells you that it has altered your command line by displaying the
5128 new command line preceded by
5128 new command line preceded by
5129 \family typewriter
5129 \family typewriter
5130 -->
5130 -->
5131 \family default
5131 \family default
5132 .
5132 .
5133 e.g.:
5133 e.g.:
5134 \layout Standard
5134 \layout Standard
5135
5135
5136
5136
5137 \family typewriter
5137 \family typewriter
5138 In [18]: callable list
5138 In [18]: callable list
5139 \newline
5139 \newline
5140 -------> callable (list)
5140 -------> callable (list)
5141 \layout Subsubsection
5141 \layout Subsubsection
5142
5142
5143 Automatic quoting
5143 Automatic quoting
5144 \layout Standard
5144 \layout Standard
5145
5145
5146 You can force automatic quoting of a function's arguments by using
5146 You can force automatic quoting of a function's arguments by using
5147 \family typewriter
5147 \family typewriter
5148 `,'
5148 `,'
5149 \family default
5149 \family default
5150 or
5150 or
5151 \family typewriter
5151 \family typewriter
5152 `;'
5152 `;'
5153 \family default
5153 \family default
5154 as the first character of a line.
5154 as the first character of a line.
5155 For example:
5155 For example:
5156 \layout Standard
5156 \layout Standard
5157
5157
5158
5158
5159 \family typewriter
5159 \family typewriter
5160 >>> ,my_function /home/me # becomes my_function("/home/me")
5160 >>> ,my_function /home/me # becomes my_function("/home/me")
5161 \layout Standard
5161 \layout Standard
5162
5162
5163 If you use
5163 If you use
5164 \family typewriter
5164 \family typewriter
5165 `;'
5165 `;'
5166 \family default
5166 \family default
5167 instead, the whole argument is quoted as a single string (while
5167 instead, the whole argument is quoted as a single string (while
5168 \family typewriter
5168 \family typewriter
5169 `,'
5169 `,'
5170 \family default
5170 \family default
5171 splits on whitespace):
5171 splits on whitespace):
5172 \layout Standard
5172 \layout Standard
5173
5173
5174
5174
5175 \family typewriter
5175 \family typewriter
5176 >>> ,my_function a b c # becomes my_function("a","b","c")
5176 >>> ,my_function a b c # becomes my_function("a","b","c")
5177 \layout Standard
5177 \layout Standard
5178
5178
5179
5179
5180 \family typewriter
5180 \family typewriter
5181 >>> ;my_function a b c # becomes my_function("a b c")
5181 >>> ;my_function a b c # becomes my_function("a b c")
5182 \layout Standard
5182 \layout Standard
5183
5183
5184 Note that the `
5184 Note that the `
5185 \family typewriter
5185 \family typewriter
5186 ,
5186 ,
5187 \family default
5187 \family default
5188 ' or `
5188 ' or `
5189 \family typewriter
5189 \family typewriter
5190 ;
5190 ;
5191 \family default
5191 \family default
5192 ' MUST be the first character on the line! This won't work:
5192 ' MUST be the first character on the line! This won't work:
5193 \layout Standard
5193 \layout Standard
5194
5194
5195
5195
5196 \family typewriter
5196 \family typewriter
5197 >>> x = ,my_function /home/me # syntax error
5197 >>> x = ,my_function /home/me # syntax error
5198 \layout Section
5198 \layout Section
5199
5199
5200
5200
5201 \begin_inset LatexCommand \label{sec:customization}
5201 \begin_inset LatexCommand \label{sec:customization}
5202
5202
5203 \end_inset
5203 \end_inset
5204
5204
5205 Customization
5205 Customization
5206 \layout Standard
5206 \layout Standard
5207
5207
5208 As we've already mentioned, IPython reads a configuration file which can
5208 As we've already mentioned, IPython reads a configuration file which can
5209 be specified at the command line (
5209 be specified at the command line (
5210 \family typewriter
5210 \family typewriter
5211 -rcfile
5211 -rcfile
5212 \family default
5212 \family default
5213 ) or which by default is assumed to be called
5213 ) or which by default is assumed to be called
5214 \family typewriter
5214 \family typewriter
5215 ipythonrc
5215 ipythonrc
5216 \family default
5216 \family default
5217 .
5217 .
5218 Such a file is looked for in the current directory where IPython is started
5218 Such a file is looked for in the current directory where IPython is started
5219 and then in your
5219 and then in your
5220 \family typewriter
5220 \family typewriter
5221 IPYTHONDIR
5221 IPYTHONDIR
5222 \family default
5222 \family default
5223 , which allows you to have local configuration files for specific projects.
5223 , which allows you to have local configuration files for specific projects.
5224 In this section we will call these types of configuration files simply
5224 In this section we will call these types of configuration files simply
5225 rcfiles (short for resource configuration file).
5225 rcfiles (short for resource configuration file).
5226 \layout Standard
5226 \layout Standard
5227
5227
5228 The syntax of an rcfile is one of key-value pairs separated by whitespace,
5228 The syntax of an rcfile is one of key-value pairs separated by whitespace,
5229 one per line.
5229 one per line.
5230 Lines beginning with a
5230 Lines beginning with a
5231 \family typewriter
5231 \family typewriter
5232 #
5232 #
5233 \family default
5233 \family default
5234 are ignored as comments, but comments can
5234 are ignored as comments, but comments can
5235 \series bold
5235 \series bold
5236 not
5236 not
5237 \series default
5237 \series default
5238 be put on lines with data (the parser is fairly primitive).
5238 be put on lines with data (the parser is fairly primitive).
5239 Note that these are not python files, and this is deliberate, because it
5239 Note that these are not python files, and this is deliberate, because it
5240 allows us to do some things which would be quite tricky to implement if
5240 allows us to do some things which would be quite tricky to implement if
5241 they were normal python files.
5241 they were normal python files.
5242 \layout Standard
5242 \layout Standard
5243
5243
5244 First, an rcfile can contain permanent default values for almost all command
5244 First, an rcfile can contain permanent default values for almost all command
5245 line options (except things like
5245 line options (except things like
5246 \family typewriter
5246 \family typewriter
5247 -help
5247 -help
5248 \family default
5248 \family default
5249 or
5249 or
5250 \family typewriter
5250 \family typewriter
5251 -Version
5251 -Version
5252 \family default
5252 \family default
5253 ).
5253 ).
5254 Sec\SpecialChar ~
5254 Sec\SpecialChar ~
5255
5255
5256 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5256 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5257
5257
5258 \end_inset
5258 \end_inset
5259
5259
5260 contains a description of all command-line options.
5260 contains a description of all command-line options.
5261 However, values you explicitly specify at the command line override the
5261 However, values you explicitly specify at the command line override the
5262 values defined in the rcfile.
5262 values defined in the rcfile.
5263 \layout Standard
5263 \layout Standard
5264
5264
5265 Besides command line option values, the rcfile can specify values for certain
5265 Besides command line option values, the rcfile can specify values for certain
5266 extra special options which are not available at the command line.
5266 extra special options which are not available at the command line.
5267 These options are briefly described below.
5267 These options are briefly described below.
5268
5268
5269 \layout Standard
5269 \layout Standard
5270
5270
5271 Each of these options may appear as many times as you need it in the file.
5271 Each of these options may appear as many times as you need it in the file.
5272 \layout List
5272 \layout List
5273 \labelwidthstring 00.00.0000
5273 \labelwidthstring 00.00.0000
5274
5274
5275
5275
5276 \family typewriter
5276 \family typewriter
5277 \series bold
5277 \series bold
5278 include\SpecialChar ~
5278 include\SpecialChar ~
5279 <file1>\SpecialChar ~
5279 <file1>\SpecialChar ~
5280 <file2>\SpecialChar ~
5280 <file2>\SpecialChar ~
5281 ...
5281 ...
5282 \family default
5282 \family default
5283 \series default
5283 \series default
5284 : you can name
5284 : you can name
5285 \emph on
5285 \emph on
5286 other
5286 other
5287 \emph default
5287 \emph default
5288 rcfiles you want to recursively load up to 15 levels (don't use the
5288 rcfiles you want to recursively load up to 15 levels (don't use the
5289 \family typewriter
5289 \family typewriter
5290 <>
5290 <>
5291 \family default
5291 \family default
5292 brackets in your names!).
5292 brackets in your names!).
5293 This feature allows you to define a 'base' rcfile with general options
5293 This feature allows you to define a 'base' rcfile with general options
5294 and special-purpose files which can be loaded only when needed with particular
5294 and special-purpose files which can be loaded only when needed with particular
5295 configuration options.
5295 configuration options.
5296 To make this more convenient, IPython accepts the
5296 To make this more convenient, IPython accepts the
5297 \family typewriter
5297 \family typewriter
5298 -profile <name>
5298 -profile <name>
5299 \family default
5299 \family default
5300 option (abbreviates to
5300 option (abbreviates to
5301 \family typewriter
5301 \family typewriter
5302 -p <name
5302 -p <name
5303 \family default
5303 \family default
5304 >)
5304 >)
5305 \family typewriter
5305 \family typewriter
5306 which
5306 which
5307 \family default
5307 \family default
5308 tells it to look for an rcfile named
5308 tells it to look for an rcfile named
5309 \family typewriter
5309 \family typewriter
5310 ipythonrc-<name>
5310 ipythonrc-<name>
5311 \family default
5311 \family default
5312 .
5312 .
5313
5313
5314 \layout List
5314 \layout List
5315 \labelwidthstring 00.00.0000
5315 \labelwidthstring 00.00.0000
5316
5316
5317
5317
5318 \family typewriter
5318 \family typewriter
5319 \series bold
5319 \series bold
5320 import_mod\SpecialChar ~
5320 import_mod\SpecialChar ~
5321 <mod1>\SpecialChar ~
5321 <mod1>\SpecialChar ~
5322 <mod2>\SpecialChar ~
5322 <mod2>\SpecialChar ~
5323 ...
5323 ...
5324 \family default
5324 \family default
5325 \series default
5325 \series default
5326 : import modules with '
5326 : import modules with '
5327 \family typewriter
5327 \family typewriter
5328 import
5328 import
5329 \family default
5329 \family default
5330
5330
5331 \family typewriter
5331 \family typewriter
5332 <mod1>,<mod2>,...
5332 <mod1>,<mod2>,...
5333 \family default
5333 \family default
5334 '
5334 '
5335 \layout List
5335 \layout List
5336 \labelwidthstring 00.00.0000
5336 \labelwidthstring 00.00.0000
5337
5337
5338
5338
5339 \family typewriter
5339 \family typewriter
5340 \series bold
5340 \series bold
5341 import_some\SpecialChar ~
5341 import_some\SpecialChar ~
5342 <mod>\SpecialChar ~
5342 <mod>\SpecialChar ~
5343 <f1>\SpecialChar ~
5343 <f1>\SpecialChar ~
5344 <f2>\SpecialChar ~
5344 <f2>\SpecialChar ~
5345 ...
5345 ...
5346 \family default
5346 \family default
5347 \series default
5347 \series default
5348 : import functions with '
5348 : import functions with '
5349 \family typewriter
5349 \family typewriter
5350 from <mod> import
5350 from <mod> import
5351 \family default
5351 \family default
5352
5352
5353 \family typewriter
5353 \family typewriter
5354 <f1>,<f2>,...
5354 <f1>,<f2>,...
5355 \family default
5355 \family default
5356 '
5356 '
5357 \layout List
5357 \layout List
5358 \labelwidthstring 00.00.0000
5358 \labelwidthstring 00.00.0000
5359
5359
5360
5360
5361 \family typewriter
5361 \family typewriter
5362 \series bold
5362 \series bold
5363 import_all\SpecialChar ~
5363 import_all\SpecialChar ~
5364 <mod1>\SpecialChar ~
5364 <mod1>\SpecialChar ~
5365 <mod2>\SpecialChar ~
5365 <mod2>\SpecialChar ~
5366 ...
5366 ...
5367 \family default
5367 \family default
5368 \series default
5368 \series default
5369 : for each module listed import functions with '
5369 : for each module listed import functions with '
5370 \family typewriter
5370 \family typewriter
5371 from <mod> import *
5371 from <mod> import *
5372 \family default
5372 \family default
5373 '
5373 '
5374 \layout List
5374 \layout List
5375 \labelwidthstring 00.00.0000
5375 \labelwidthstring 00.00.0000
5376
5376
5377
5377
5378 \family typewriter
5378 \family typewriter
5379 \series bold
5379 \series bold
5380 execute\SpecialChar ~
5380 execute\SpecialChar ~
5381 <python\SpecialChar ~
5381 <python\SpecialChar ~
5382 code>
5382 code>
5383 \family default
5383 \family default
5384 \series default
5384 \series default
5385 : give any single-line python code to be executed.
5385 : give any single-line python code to be executed.
5386 \layout List
5386 \layout List
5387 \labelwidthstring 00.00.0000
5387 \labelwidthstring 00.00.0000
5388
5388
5389
5389
5390 \family typewriter
5390 \family typewriter
5391 \series bold
5391 \series bold
5392 execfile\SpecialChar ~
5392 execfile\SpecialChar ~
5393 <filename>
5393 <filename>
5394 \family default
5394 \family default
5395 \series default
5395 \series default
5396 : execute the python file given with an '
5396 : execute the python file given with an '
5397 \family typewriter
5397 \family typewriter
5398 execfile(filename)
5398 execfile(filename)
5399 \family default
5399 \family default
5400 ' command.
5400 ' command.
5401 Username expansion is performed on the given names.
5401 Username expansion is performed on the given names.
5402 So if you need any amount of extra fancy customization that won't fit in
5402 So if you need any amount of extra fancy customization that won't fit in
5403 any of the above 'canned' options, you can just put it in a separate python
5403 any of the above 'canned' options, you can just put it in a separate python
5404 file and execute it.
5404 file and execute it.
5405 \layout List
5405 \layout List
5406 \labelwidthstring 00.00.0000
5406 \labelwidthstring 00.00.0000
5407
5407
5408
5408
5409 \family typewriter
5409 \family typewriter
5410 \series bold
5410 \series bold
5411 alias\SpecialChar ~
5411 alias\SpecialChar ~
5412 <alias_def>
5412 <alias_def>
5413 \family default
5413 \family default
5414 \series default
5414 \series default
5415 : this is equivalent to calling '
5415 : this is equivalent to calling '
5416 \family typewriter
5416 \family typewriter
5417 %alias\SpecialChar ~
5417 %alias\SpecialChar ~
5418 <alias_def>
5418 <alias_def>
5419 \family default
5419 \family default
5420 ' at the IPython command line.
5420 ' at the IPython command line.
5421 This way, from within IPython you can do common system tasks without having
5421 This way, from within IPython you can do common system tasks without having
5422 to exit it or use the
5422 to exit it or use the
5423 \family typewriter
5423 \family typewriter
5424 !
5424 !
5425 \family default
5425 \family default
5426 escape.
5426 escape.
5427 IPython isn't meant to be a shell replacement, but it is often very useful
5427 IPython isn't meant to be a shell replacement, but it is often very useful
5428 to be able to do things with files while testing code.
5428 to be able to do things with files while testing code.
5429 This gives you the flexibility to have within IPython any aliases you may
5429 This gives you the flexibility to have within IPython any aliases you may
5430 be used to under your normal system shell.
5430 be used to under your normal system shell.
5431 \layout Subsection
5431 \layout Subsection
5432
5432
5433
5433
5434 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
5434 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
5435
5435
5436 \end_inset
5436 \end_inset
5437
5437
5438 Sample
5438 Sample
5439 \family typewriter
5439 \family typewriter
5440 ipythonrc
5440 ipythonrc
5441 \family default
5441 \family default
5442 file
5442 file
5443 \layout Standard
5443 \layout Standard
5444
5444
5445 The default rcfile, called
5445 The default rcfile, called
5446 \family typewriter
5446 \family typewriter
5447 ipythonrc
5447 ipythonrc
5448 \family default
5448 \family default
5449 and supplied in your
5449 and supplied in your
5450 \family typewriter
5450 \family typewriter
5451 IPYTHONDIR
5451 IPYTHONDIR
5452 \family default
5452 \family default
5453 directory contains lots of comments on all of these options.
5453 directory contains lots of comments on all of these options.
5454 We reproduce it here for reference:
5454 We reproduce it here for reference:
5455 \layout Standard
5455 \layout Standard
5456
5456
5457
5457
5458 \begin_inset ERT
5458 \begin_inset ERT
5459 status Open
5459 status Open
5460
5460
5461 \layout Standard
5461 \layout Standard
5462
5462
5463 \backslash
5463 \backslash
5464 codelist{../IPython/UserConfig/ipythonrc}
5464 codelist{../IPython/UserConfig/ipythonrc}
5465 \end_inset
5465 \end_inset
5466
5466
5467
5467
5468 \layout Subsection
5468 \layout Subsection
5469
5469
5470
5470
5471 \begin_inset LatexCommand \label{sec:prompts}
5471 \begin_inset LatexCommand \label{sec:prompts}
5472
5472
5473 \end_inset
5473 \end_inset
5474
5474
5475 Fine-tuning your prompt
5475 Fine-tuning your prompt
5476 \layout Standard
5476 \layout Standard
5477
5477
5478 IPython's prompts can be customized using a syntax similar to that of the
5478 IPython's prompts can be customized using a syntax similar to that of the
5479
5479
5480 \family typewriter
5480 \family typewriter
5481 bash
5481 bash
5482 \family default
5482 \family default
5483 shell.
5483 shell.
5484 Many of
5484 Many of
5485 \family typewriter
5485 \family typewriter
5486 bash
5486 bash
5487 \family default
5487 \family default
5488 's escapes are supported, as well as a few additional ones.
5488 's escapes are supported, as well as a few additional ones.
5489 We list them below:
5489 We list them below:
5490 \layout Description
5490 \layout Description
5491
5491
5492
5492
5493 \backslash
5493 \backslash
5494 # the prompt/history count number
5494 # the prompt/history count number
5495 \layout Description
5495 \layout Description
5496
5496
5497
5497
5498 \backslash
5498 \backslash
5499 D the prompt/history count, with the actual digits replaced by dots.
5499 D the prompt/history count, with the actual digits replaced by dots.
5500 Used mainly in continuation prompts (prompt_in2)
5500 Used mainly in continuation prompts (prompt_in2)
5501 \layout Description
5501 \layout Description
5502
5502
5503
5503
5504 \backslash
5504 \backslash
5505 w the current working directory
5505 w the current working directory
5506 \layout Description
5506 \layout Description
5507
5507
5508
5508
5509 \backslash
5509 \backslash
5510 W the basename of current working directory
5510 W the basename of current working directory
5511 \layout Description
5511 \layout Description
5512
5512
5513
5513
5514 \backslash
5514 \backslash
5515 X
5515 X
5516 \emph on
5516 \emph on
5517 n
5517 n
5518 \emph default
5518 \emph default
5519 where
5519 where
5520 \begin_inset Formula $n=0\ldots5.$
5520 \begin_inset Formula $n=0\ldots5.$
5521 \end_inset
5521 \end_inset
5522
5522
5523 The current working directory, with
5523 The current working directory, with
5524 \family typewriter
5524 \family typewriter
5525 $HOME
5525 $HOME
5526 \family default
5526 \family default
5527 replaced by
5527 replaced by
5528 \family typewriter
5528 \family typewriter
5529 ~
5529 ~
5530 \family default
5530 \family default
5531 , and filtered out to contain only
5531 , and filtered out to contain only
5532 \begin_inset Formula $n$
5532 \begin_inset Formula $n$
5533 \end_inset
5533 \end_inset
5534
5534
5535 path elements
5535 path elements
5536 \layout Description
5536 \layout Description
5537
5537
5538
5538
5539 \backslash
5539 \backslash
5540 Y
5540 Y
5541 \emph on
5541 \emph on
5542 n
5542 n
5543 \emph default
5543 \emph default
5544 Similar to
5544 Similar to
5545 \backslash
5545 \backslash
5546 X
5546 X
5547 \emph on
5547 \emph on
5548 n
5548 n
5549 \emph default
5549 \emph default
5550 , but with the
5550 , but with the
5551 \begin_inset Formula $n+1$
5551 \begin_inset Formula $n+1$
5552 \end_inset
5552 \end_inset
5553
5553
5554 element included if it is
5554 element included if it is
5555 \family typewriter
5555 \family typewriter
5556 ~
5556 ~
5557 \family default
5557 \family default
5558 (this is similar to the behavior of the %c
5558 (this is similar to the behavior of the %c
5559 \emph on
5559 \emph on
5560 n
5560 n
5561 \emph default
5561 \emph default
5562 escapes in
5562 escapes in
5563 \family typewriter
5563 \family typewriter
5564 tcsh
5564 tcsh
5565 \family default
5565 \family default
5566 )
5566 )
5567 \layout Description
5567 \layout Description
5568
5568
5569
5569
5570 \backslash
5570 \backslash
5571 u the username of the current user
5571 u the username of the current user
5572 \layout Description
5572 \layout Description
5573
5573
5574
5574
5575 \backslash
5575 \backslash
5576 $ if the effective UID is 0, a #, otherwise a $
5576 $ if the effective UID is 0, a #, otherwise a $
5577 \layout Description
5577 \layout Description
5578
5578
5579
5579
5580 \backslash
5580 \backslash
5581 h the hostname up to the first `.'
5581 h the hostname up to the first `.'
5582 \layout Description
5582 \layout Description
5583
5583
5584
5584
5585 \backslash
5585 \backslash
5586 H the hostname
5586 H the hostname
5587 \layout Description
5587 \layout Description
5588
5588
5589
5589
5590 \backslash
5590 \backslash
5591 n a newline
5591 n a newline
5592 \layout Description
5592 \layout Description
5593
5593
5594
5594
5595 \backslash
5595 \backslash
5596 r a carriage return
5596 r a carriage return
5597 \layout Description
5597 \layout Description
5598
5598
5599
5599
5600 \backslash
5600 \backslash
5601 v IPython version string
5601 v IPython version string
5602 \layout Standard
5602 \layout Standard
5603
5603
5604 In addition to these, ANSI color escapes can be insterted into the prompts,
5604 In addition to these, ANSI color escapes can be insterted into the prompts,
5605 as
5605 as
5606 \family typewriter
5606 \family typewriter
5607
5607
5608 \backslash
5608 \backslash
5609 C_
5609 C_
5610 \emph on
5610 \emph on
5611 ColorName
5611 ColorName
5612 \family default
5612 \family default
5613 \emph default
5613 \emph default
5614 .
5614 .
5615 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
5615 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
5616 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
5616 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
5617 Normal, Purple, Red, White, Yellow.
5617 Normal, Purple, Red, White, Yellow.
5618 \layout Standard
5618 \layout Standard
5619
5619
5620 Finally, IPython supports the evaluation of arbitrary expressions in your
5620 Finally, IPython supports the evaluation of arbitrary expressions in your
5621 prompt string.
5621 prompt string.
5622 The prompt strings are evaluated through the syntax of PEP 215, but basically
5622 The prompt strings are evaluated through the syntax of PEP 215, but basically
5623 you can use
5623 you can use
5624 \family typewriter
5624 \family typewriter
5625 $x.y
5625 $x.y
5626 \family default
5626 \family default
5627 to expand the value of
5627 to expand the value of
5628 \family typewriter
5628 \family typewriter
5629 x.y
5629 x.y
5630 \family default
5630 \family default
5631 , and for more complicated expressions you can use braces:
5631 , and for more complicated expressions you can use braces:
5632 \family typewriter
5632 \family typewriter
5633 ${foo()+x}
5633 ${foo()+x}
5634 \family default
5634 \family default
5635 will call function
5635 will call function
5636 \family typewriter
5636 \family typewriter
5637 foo
5637 foo
5638 \family default
5638 \family default
5639 and add to it the value of
5639 and add to it the value of
5640 \family typewriter
5640 \family typewriter
5641 x
5641 x
5642 \family default
5642 \family default
5643 , before putting the result into your prompt.
5643 , before putting the result into your prompt.
5644 For example, using
5644 For example, using
5645 \newline
5645 \newline
5646
5646
5647 \family typewriter
5647 \family typewriter
5648 prompt_in1 '${commands.getoutput("uptime")}
5648 prompt_in1 '${commands.getoutput("uptime")}
5649 \backslash
5649 \backslash
5650 nIn [
5650 nIn [
5651 \backslash
5651 \backslash
5652 #]: '
5652 #]: '
5653 \newline
5653 \newline
5654
5654
5655 \family default
5655 \family default
5656 will print the result of the uptime command on each prompt (assuming the
5656 will print the result of the uptime command on each prompt (assuming the
5657
5657
5658 \family typewriter
5658 \family typewriter
5659 commands
5659 commands
5660 \family default
5660 \family default
5661 module has been imported in your
5661 module has been imported in your
5662 \family typewriter
5662 \family typewriter
5663 ipythonrc
5663 ipythonrc
5664 \family default
5664 \family default
5665 file).
5665 file).
5666 \layout Subsubsection
5666 \layout Subsubsection
5667
5667
5668 Prompt examples
5668 Prompt examples
5669 \layout Standard
5669 \layout Standard
5670
5670
5671 The following options in an ipythonrc file will give you IPython's default
5671 The following options in an ipythonrc file will give you IPython's default
5672 prompts:
5672 prompts:
5673 \layout Standard
5673 \layout Standard
5674
5674
5675
5675
5676 \family typewriter
5676 \family typewriter
5677 prompt_in1 'In [
5677 prompt_in1 'In [
5678 \backslash
5678 \backslash
5679 #]:'
5679 #]:'
5680 \newline
5680 \newline
5681 prompt_in2 '\SpecialChar ~
5681 prompt_in2 '\SpecialChar ~
5682 \SpecialChar ~
5682 \SpecialChar ~
5683 \SpecialChar ~
5683 \SpecialChar ~
5684 .
5684 .
5685 \backslash
5685 \backslash
5686 D.:'
5686 D.:'
5687 \newline
5687 \newline
5688 prompt_out 'Out[
5688 prompt_out 'Out[
5689 \backslash
5689 \backslash
5690 #]:'
5690 #]:'
5691 \layout Standard
5691 \layout Standard
5692
5692
5693 which look like this:
5693 which look like this:
5694 \layout Standard
5694 \layout Standard
5695
5695
5696
5696
5697 \family typewriter
5697 \family typewriter
5698 In [1]: 1+2
5698 In [1]: 1+2
5699 \newline
5699 \newline
5700 Out[1]: 3
5700 Out[1]: 3
5701 \layout Standard
5701 \layout Standard
5702
5702
5703
5703
5704 \family typewriter
5704 \family typewriter
5705 In [2]: for i in (1,2,3):
5705 In [2]: for i in (1,2,3):
5706 \newline
5706 \newline
5707
5707
5708 \begin_inset ERT
5708 \begin_inset ERT
5709 status Collapsed
5709 status Collapsed
5710
5710
5711 \layout Standard
5711 \layout Standard
5712
5712
5713 \backslash
5713 \backslash
5714 hspace*{0mm}
5714 hspace*{0mm}
5715 \end_inset
5715 \end_inset
5716
5716
5717 \SpecialChar ~
5717 \SpecialChar ~
5718 \SpecialChar ~
5718 \SpecialChar ~
5719 \SpecialChar ~
5719 \SpecialChar ~
5720 ...: \SpecialChar ~
5720 ...: \SpecialChar ~
5721 \SpecialChar ~
5721 \SpecialChar ~
5722 \SpecialChar ~
5722 \SpecialChar ~
5723 \SpecialChar ~
5723 \SpecialChar ~
5724 print i,
5724 print i,
5725 \newline
5725 \newline
5726
5726
5727 \begin_inset ERT
5727 \begin_inset ERT
5728 status Collapsed
5728 status Collapsed
5729
5729
5730 \layout Standard
5730 \layout Standard
5731
5731
5732 \backslash
5732 \backslash
5733 hspace*{0mm}
5733 hspace*{0mm}
5734 \end_inset
5734 \end_inset
5735
5735
5736 \SpecialChar ~
5736 \SpecialChar ~
5737 \SpecialChar ~
5737 \SpecialChar ~
5738 \SpecialChar ~
5738 \SpecialChar ~
5739 ...:
5739 ...:
5740 \newline
5740 \newline
5741 1 2 3
5741 1 2 3
5742 \layout Standard
5742 \layout Standard
5743
5743
5744 These will give you a very colorful prompt with path information:
5744 These will give you a very colorful prompt with path information:
5745 \layout Standard
5745 \layout Standard
5746
5746
5747
5747
5748 \family typewriter
5748 \family typewriter
5749 #prompt_in1 '
5749 #prompt_in1 '
5750 \backslash
5750 \backslash
5751 C_Red
5751 C_Red
5752 \backslash
5752 \backslash
5753 u
5753 u
5754 \backslash
5754 \backslash
5755 C_Blue[
5755 C_Blue[
5756 \backslash
5756 \backslash
5757 C_Cyan
5757 C_Cyan
5758 \backslash
5758 \backslash
5759 Y1
5759 Y1
5760 \backslash
5760 \backslash
5761 C_Blue]
5761 C_Blue]
5762 \backslash
5762 \backslash
5763 C_LightGreen
5763 C_LightGreen
5764 \backslash
5764 \backslash
5765 #>'
5765 #>'
5766 \newline
5766 \newline
5767 prompt_in2 ' ..
5767 prompt_in2 ' ..
5768 \backslash
5768 \backslash
5769 D>'
5769 D>'
5770 \newline
5770 \newline
5771 prompt_out '<
5771 prompt_out '<
5772 \backslash
5772 \backslash
5773 #>'
5773 #>'
5774 \layout Standard
5774 \layout Standard
5775
5775
5776 which look like this:
5776 which look like this:
5777 \layout Standard
5777 \layout Standard
5778
5778
5779
5779
5780 \family typewriter
5780 \family typewriter
5781 \color red
5781 \color red
5782 fperez
5782 fperez
5783 \color blue
5783 \color blue
5784 [
5784 [
5785 \color cyan
5785 \color cyan
5786 ~/ipython
5786 ~/ipython
5787 \color blue
5787 \color blue
5788 ]
5788 ]
5789 \color green
5789 \color green
5790 1>
5790 1>
5791 \color default
5791 \color default
5792 1+2
5792 1+2
5793 \newline
5793 \newline
5794
5794
5795 \begin_inset ERT
5795 \begin_inset ERT
5796 status Collapsed
5796 status Collapsed
5797
5797
5798 \layout Standard
5798 \layout Standard
5799
5799
5800 \backslash
5800 \backslash
5801 hspace*{0mm}
5801 hspace*{0mm}
5802 \end_inset
5802 \end_inset
5803
5803
5804 \SpecialChar ~
5804 \SpecialChar ~
5805 \SpecialChar ~
5805 \SpecialChar ~
5806 \SpecialChar ~
5806 \SpecialChar ~
5807 \SpecialChar ~
5807 \SpecialChar ~
5808 \SpecialChar ~
5808 \SpecialChar ~
5809 \SpecialChar ~
5809 \SpecialChar ~
5810 \SpecialChar ~
5810 \SpecialChar ~
5811 \SpecialChar ~
5811 \SpecialChar ~
5812 \SpecialChar ~
5812 \SpecialChar ~
5813 \SpecialChar ~
5813 \SpecialChar ~
5814 \SpecialChar ~
5814 \SpecialChar ~
5815 \SpecialChar ~
5815 \SpecialChar ~
5816 \SpecialChar ~
5816 \SpecialChar ~
5817 \SpecialChar ~
5817 \SpecialChar ~
5818 \SpecialChar ~
5818 \SpecialChar ~
5819 \SpecialChar ~
5819 \SpecialChar ~
5820
5820
5821 \color red
5821 \color red
5822 <1>
5822 <1>
5823 \color default
5823 \color default
5824 3
5824 3
5825 \newline
5825 \newline
5826
5826
5827 \color red
5827 \color red
5828 fperez
5828 fperez
5829 \color blue
5829 \color blue
5830 [
5830 [
5831 \color cyan
5831 \color cyan
5832 ~/ipython
5832 ~/ipython
5833 \color blue
5833 \color blue
5834 ]
5834 ]
5835 \color green
5835 \color green
5836 2>
5836 2>
5837 \color default
5837 \color default
5838 for i in (1,2,3):
5838 for i in (1,2,3):
5839 \newline
5839 \newline
5840
5840
5841 \begin_inset ERT
5841 \begin_inset ERT
5842 status Collapsed
5842 status Collapsed
5843
5843
5844 \layout Standard
5844 \layout Standard
5845
5845
5846 \backslash
5846 \backslash
5847 hspace*{0mm}
5847 hspace*{0mm}
5848 \end_inset
5848 \end_inset
5849
5849
5850 \SpecialChar ~
5850 \SpecialChar ~
5851 \SpecialChar ~
5851 \SpecialChar ~
5852 \SpecialChar ~
5852 \SpecialChar ~
5853 \SpecialChar ~
5853 \SpecialChar ~
5854 \SpecialChar ~
5854 \SpecialChar ~
5855 \SpecialChar ~
5855 \SpecialChar ~
5856 \SpecialChar ~
5856 \SpecialChar ~
5857 \SpecialChar ~
5857 \SpecialChar ~
5858 \SpecialChar ~
5858 \SpecialChar ~
5859 \SpecialChar ~
5859 \SpecialChar ~
5860 \SpecialChar ~
5860 \SpecialChar ~
5861 \SpecialChar ~
5861 \SpecialChar ~
5862 \SpecialChar ~
5862 \SpecialChar ~
5863 \SpecialChar ~
5863 \SpecialChar ~
5864 \SpecialChar ~
5864 \SpecialChar ~
5865
5865
5866 \color green
5866 \color green
5867 ...>
5867 ...>
5868 \color default
5868 \color default
5869 \SpecialChar ~
5869 \SpecialChar ~
5870 \SpecialChar ~
5870 \SpecialChar ~
5871 \SpecialChar ~
5871 \SpecialChar ~
5872 \SpecialChar ~
5872 \SpecialChar ~
5873 print i,
5873 print i,
5874 \newline
5874 \newline
5875
5875
5876 \begin_inset ERT
5876 \begin_inset ERT
5877 status Collapsed
5877 status Collapsed
5878
5878
5879 \layout Standard
5879 \layout Standard
5880
5880
5881 \backslash
5881 \backslash
5882 hspace*{0mm}
5882 hspace*{0mm}
5883 \end_inset
5883 \end_inset
5884
5884
5885 \SpecialChar ~
5885 \SpecialChar ~
5886 \SpecialChar ~
5886 \SpecialChar ~
5887 \SpecialChar ~
5887 \SpecialChar ~
5888 \SpecialChar ~
5888 \SpecialChar ~
5889 \SpecialChar ~
5889 \SpecialChar ~
5890 \SpecialChar ~
5890 \SpecialChar ~
5891 \SpecialChar ~
5891 \SpecialChar ~
5892 \SpecialChar ~
5892 \SpecialChar ~
5893 \SpecialChar ~
5893 \SpecialChar ~
5894 \SpecialChar ~
5894 \SpecialChar ~
5895 \SpecialChar ~
5895 \SpecialChar ~
5896 \SpecialChar ~
5896 \SpecialChar ~
5897 \SpecialChar ~
5897 \SpecialChar ~
5898 \SpecialChar ~
5898 \SpecialChar ~
5899 \SpecialChar ~
5899 \SpecialChar ~
5900
5900
5901 \color green
5901 \color green
5902 ...>
5902 ...>
5903 \color default
5903 \color default
5904
5904
5905 \newline
5905 \newline
5906 1 2 3
5906 1 2 3
5907 \layout Standard
5907 \layout Standard
5908
5908
5909 The following shows the usage of dynamic expression evaluation:
5909 The following shows the usage of dynamic expression evaluation:
5910 \layout Subsection
5910 \layout Subsection
5911
5911
5912
5912
5913 \begin_inset LatexCommand \label{sec:profiles}
5913 \begin_inset LatexCommand \label{sec:profiles}
5914
5914
5915 \end_inset
5915 \end_inset
5916
5916
5917 IPython profiles
5917 IPython profiles
5918 \layout Standard
5918 \layout Standard
5919
5919
5920 As we already mentioned, IPython supports the
5920 As we already mentioned, IPython supports the
5921 \family typewriter
5921 \family typewriter
5922 -profile
5922 -profile
5923 \family default
5923 \family default
5924 command-line option (see sec.
5924 command-line option (see sec.
5925
5925
5926 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5926 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5927
5927
5928 \end_inset
5928 \end_inset
5929
5929
5930 ).
5930 ).
5931 A profile is nothing more than a particular configuration file like your
5931 A profile is nothing more than a particular configuration file like your
5932 basic
5932 basic
5933 \family typewriter
5933 \family typewriter
5934 ipythonrc
5934 ipythonrc
5935 \family default
5935 \family default
5936 one, but with particular customizations for a specific purpose.
5936 one, but with particular customizations for a specific purpose.
5937 When you start IPython with '
5937 When you start IPython with '
5938 \family typewriter
5938 \family typewriter
5939 ipython -profile <name>
5939 ipython -profile <name>
5940 \family default
5940 \family default
5941 ', it assumes that in your
5941 ', it assumes that in your
5942 \family typewriter
5942 \family typewriter
5943 IPYTHONDIR
5943 IPYTHONDIR
5944 \family default
5944 \family default
5945 there is a file called
5945 there is a file called
5946 \family typewriter
5946 \family typewriter
5947 ipythonrc-<name>
5947 ipythonrc-<name>
5948 \family default
5948 \family default
5949 , and loads it instead of the normal
5949 , and loads it instead of the normal
5950 \family typewriter
5950 \family typewriter
5951 ipythonrc
5951 ipythonrc
5952 \family default
5952 \family default
5953 .
5953 .
5954 \layout Standard
5954 \layout Standard
5955
5955
5956 This system allows you to maintain multiple configurations which load modules,
5956 This system allows you to maintain multiple configurations which load modules,
5957 set options, define functions, etc.
5957 set options, define functions, etc.
5958 suitable for different tasks and activate them in a very simple manner.
5958 suitable for different tasks and activate them in a very simple manner.
5959 In order to avoid having to repeat all of your basic options (common things
5959 In order to avoid having to repeat all of your basic options (common things
5960 that don't change such as your color preferences, for example), any profile
5960 that don't change such as your color preferences, for example), any profile
5961 can include another configuration file.
5961 can include another configuration file.
5962 The most common way to use profiles is then to have each one include your
5962 The most common way to use profiles is then to have each one include your
5963 basic
5963 basic
5964 \family typewriter
5964 \family typewriter
5965 ipythonrc
5965 ipythonrc
5966 \family default
5966 \family default
5967 file as a starting point, and then add further customizations.
5967 file as a starting point, and then add further customizations.
5968 \layout Standard
5968 \layout Standard
5969
5969
5970 In sections
5970 In sections
5971 \begin_inset LatexCommand \ref{sec:syntax-extensions}
5971 \begin_inset LatexCommand \ref{sec:syntax-extensions}
5972
5972
5973 \end_inset
5973 \end_inset
5974
5974
5975 and
5975 and
5976 \begin_inset LatexCommand \ref{sec:Gnuplot}
5976 \begin_inset LatexCommand \ref{sec:Gnuplot}
5977
5977
5978 \end_inset
5978 \end_inset
5979
5979
5980 we discuss some particular profiles which come as part of the standard
5980 we discuss some particular profiles which come as part of the standard
5981 IPython distribution.
5981 IPython distribution.
5982 You may also look in your
5982 You may also look in your
5983 \family typewriter
5983 \family typewriter
5984 IPYTHONDIR
5984 IPYTHONDIR
5985 \family default
5985 \family default
5986 directory, any file whose name begins with
5986 directory, any file whose name begins with
5987 \family typewriter
5987 \family typewriter
5988 ipythonrc-
5988 ipythonrc-
5989 \family default
5989 \family default
5990 is a profile.
5990 is a profile.
5991 You can use those as examples for further customizations to suit your own
5991 You can use those as examples for further customizations to suit your own
5992 needs.
5992 needs.
5993 \layout Section
5993 \layout Section
5994
5994
5995
5995
5996 \begin_inset OptArg
5996 \begin_inset OptArg
5997 collapsed false
5997 collapsed false
5998
5998
5999 \layout Standard
5999 \layout Standard
6000
6000
6001 IPython as default...
6001 IPython as default...
6002 \end_inset
6002 \end_inset
6003
6003
6004 IPython as your default Python environment
6004 IPython as your default Python environment
6005 \layout Standard
6005 \layout Standard
6006
6006
6007 Python honors the environment variable
6007 Python honors the environment variable
6008 \family typewriter
6008 \family typewriter
6009 PYTHONSTARTUP
6009 PYTHONSTARTUP
6010 \family default
6010 \family default
6011 and will execute at startup the file referenced by this variable.
6011 and will execute at startup the file referenced by this variable.
6012 If you put at the end of this file the following two lines of code:
6012 If you put at the end of this file the following two lines of code:
6013 \layout Standard
6013 \layout Standard
6014
6014
6015
6015
6016 \family typewriter
6016 \family typewriter
6017 import IPython
6017 import IPython
6018 \newline
6018 \newline
6019 IPython.Shell.IPShell().mainloop(sys_exit=1)
6019 IPython.Shell.IPShell().mainloop(sys_exit=1)
6020 \layout Standard
6020 \layout Standard
6021
6021
6022 then IPython will be your working environment anytime you start Python.
6022 then IPython will be your working environment anytime you start Python.
6023 The
6023 The
6024 \family typewriter
6024 \family typewriter
6025 sys_exit=1
6025 sys_exit=1
6026 \family default
6026 \family default
6027 is needed to have IPython issue a call to
6027 is needed to have IPython issue a call to
6028 \family typewriter
6028 \family typewriter
6029 sys.exit()
6029 sys.exit()
6030 \family default
6030 \family default
6031 when it finishes, otherwise you'll be back at the normal Python '
6031 when it finishes, otherwise you'll be back at the normal Python '
6032 \family typewriter
6032 \family typewriter
6033 >>>
6033 >>>
6034 \family default
6034 \family default
6035 ' prompt
6035 ' prompt
6036 \begin_inset Foot
6036 \begin_inset Foot
6037 collapsed true
6037 collapsed true
6038
6038
6039 \layout Standard
6039 \layout Standard
6040
6040
6041 Based on an idea by Holger Krekel.
6041 Based on an idea by Holger Krekel.
6042 \end_inset
6042 \end_inset
6043
6043
6044 .
6044 .
6045 \layout Standard
6045 \layout Standard
6046
6046
6047 This is probably useful to developers who manage multiple Python versions
6047 This is probably useful to developers who manage multiple Python versions
6048 and don't want to have correspondingly multiple IPython versions.
6048 and don't want to have correspondingly multiple IPython versions.
6049 Note that in this mode, there is no way to pass IPython any command-line
6049 Note that in this mode, there is no way to pass IPython any command-line
6050 options, as those are trapped first by Python itself.
6050 options, as those are trapped first by Python itself.
6051 \layout Section
6051 \layout Section
6052
6052
6053
6053
6054 \begin_inset LatexCommand \label{sec:embed}
6054 \begin_inset LatexCommand \label{sec:embed}
6055
6055
6056 \end_inset
6056 \end_inset
6057
6057
6058 Embedding IPython
6058 Embedding IPython
6059 \layout Standard
6059 \layout Standard
6060
6060
6061 It is possible to start an IPython instance
6061 It is possible to start an IPython instance
6062 \emph on
6062 \emph on
6063 inside
6063 inside
6064 \emph default
6064 \emph default
6065 your own Python programs.
6065 your own Python programs.
6066 This allows you to evaluate dynamically the state of your code, operate
6066 This allows you to evaluate dynamically the state of your code, operate
6067 with your variables, analyze them, etc.
6067 with your variables, analyze them, etc.
6068 Note however that any changes you make to values while in the shell do
6068 Note however that any changes you make to values while in the shell do
6069
6069
6070 \emph on
6070 \emph on
6071 not
6071 not
6072 \emph default
6072 \emph default
6073 propagate back to the running code, so it is safe to modify your values
6073 propagate back to the running code, so it is safe to modify your values
6074 because you won't break your code in bizarre ways by doing so.
6074 because you won't break your code in bizarre ways by doing so.
6075 \layout Standard
6075 \layout Standard
6076
6076
6077 This feature allows you to easily have a fully functional python environment
6077 This feature allows you to easily have a fully functional python environment
6078 for doing object introspection anywhere in your code with a simple function
6078 for doing object introspection anywhere in your code with a simple function
6079 call.
6079 call.
6080 In some cases a simple print statement is enough, but if you need to do
6080 In some cases a simple print statement is enough, but if you need to do
6081 more detailed analysis of a code fragment this feature can be very valuable.
6081 more detailed analysis of a code fragment this feature can be very valuable.
6082 \layout Standard
6082 \layout Standard
6083
6083
6084 It can also be useful in scientific computing situations where it is common
6084 It can also be useful in scientific computing situations where it is common
6085 to need to do some automatic, computationally intensive part and then stop
6085 to need to do some automatic, computationally intensive part and then stop
6086 to look at data, plots, etc
6086 to look at data, plots, etc
6087 \begin_inset Foot
6087 \begin_inset Foot
6088 collapsed true
6088 collapsed true
6089
6089
6090 \layout Standard
6090 \layout Standard
6091
6091
6092 This functionality was inspired by IDL's combination of the
6092 This functionality was inspired by IDL's combination of the
6093 \family typewriter
6093 \family typewriter
6094 stop
6094 stop
6095 \family default
6095 \family default
6096 keyword and the
6096 keyword and the
6097 \family typewriter
6097 \family typewriter
6098 .continue
6098 .continue
6099 \family default
6099 \family default
6100 executive command, which I have found very useful in the past, and by a
6100 executive command, which I have found very useful in the past, and by a
6101 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
6101 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
6102 06/01 concerning similar uses of pyrepl.
6102 06/01 concerning similar uses of pyrepl.
6103 \end_inset
6103 \end_inset
6104
6104
6105 .
6105 .
6106 Opening an IPython instance will give you full access to your data and
6106 Opening an IPython instance will give you full access to your data and
6107 functions, and you can resume program execution once you are done with
6107 functions, and you can resume program execution once you are done with
6108 the interactive part (perhaps to stop again later, as many times as needed).
6108 the interactive part (perhaps to stop again later, as many times as needed).
6109 \layout Standard
6109 \layout Standard
6110
6110
6111 The following code snippet is the bare minimum you need to include in your
6111 The following code snippet is the bare minimum you need to include in your
6112 Python programs for this to work (detailed examples follow later):
6112 Python programs for this to work (detailed examples follow later):
6113 \layout LyX-Code
6113 \layout LyX-Code
6114
6114
6115 from IPython.Shell import IPShellEmbed
6115 from IPython.Shell import IPShellEmbed
6116 \layout LyX-Code
6116 \layout LyX-Code
6117
6117
6118 ipshell = IPShellEmbed()
6118 ipshell = IPShellEmbed()
6119 \layout LyX-Code
6119 \layout LyX-Code
6120
6120
6121 ipshell() # this call anywhere in your program will start IPython
6121 ipshell() # this call anywhere in your program will start IPython
6122 \layout Standard
6122 \layout Standard
6123
6123
6124 You can run embedded instances even in code which is itself being run at
6124 You can run embedded instances even in code which is itself being run at
6125 the IPython interactive prompt with '
6125 the IPython interactive prompt with '
6126 \family typewriter
6126 \family typewriter
6127 %run\SpecialChar ~
6127 %run\SpecialChar ~
6128 <filename>
6128 <filename>
6129 \family default
6129 \family default
6130 '.
6130 '.
6131 Since it's easy to get lost as to where you are (in your top-level IPython
6131 Since it's easy to get lost as to where you are (in your top-level IPython
6132 or in your embedded one), it's a good idea in such cases to set the in/out
6132 or in your embedded one), it's a good idea in such cases to set the in/out
6133 prompts to something different for the embedded instances.
6133 prompts to something different for the embedded instances.
6134 The code examples below illustrate this.
6134 The code examples below illustrate this.
6135 \layout Standard
6135 \layout Standard
6136
6136
6137 You can also have multiple IPython instances in your program and open them
6137 You can also have multiple IPython instances in your program and open them
6138 separately, for example with different options for data presentation.
6138 separately, for example with different options for data presentation.
6139 If you close and open the same instance multiple times, its prompt counters
6139 If you close and open the same instance multiple times, its prompt counters
6140 simply continue from each execution to the next.
6140 simply continue from each execution to the next.
6141 \layout Standard
6141 \layout Standard
6142
6142
6143 Please look at the docstrings in the
6143 Please look at the docstrings in the
6144 \family typewriter
6144 \family typewriter
6145 Shell.py
6145 Shell.py
6146 \family default
6146 \family default
6147 module for more details on the use of this system.
6147 module for more details on the use of this system.
6148 \layout Standard
6148 \layout Standard
6149
6149
6150 The following sample file illustrating how to use the embedding functionality
6150 The following sample file illustrating how to use the embedding functionality
6151 is provided in the examples directory as
6151 is provided in the examples directory as
6152 \family typewriter
6152 \family typewriter
6153 example-embed.py
6153 example-embed.py
6154 \family default
6154 \family default
6155 .
6155 .
6156 It should be fairly self-explanatory:
6156 It should be fairly self-explanatory:
6157 \layout Standard
6157 \layout Standard
6158
6158
6159
6159
6160 \begin_inset ERT
6160 \begin_inset ERT
6161 status Open
6161 status Open
6162
6162
6163 \layout Standard
6163 \layout Standard
6164
6164
6165 \backslash
6165 \backslash
6166 codelist{examples/example-embed.py}
6166 codelist{examples/example-embed.py}
6167 \end_inset
6167 \end_inset
6168
6168
6169
6169
6170 \layout Standard
6170 \layout Standard
6171
6171
6172 Once you understand how the system functions, you can use the following
6172 Once you understand how the system functions, you can use the following
6173 code fragments in your programs which are ready for cut and paste:
6173 code fragments in your programs which are ready for cut and paste:
6174 \layout Standard
6174 \layout Standard
6175
6175
6176
6176
6177 \begin_inset ERT
6177 \begin_inset ERT
6178 status Open
6178 status Open
6179
6179
6180 \layout Standard
6180 \layout Standard
6181
6181
6182 \backslash
6182 \backslash
6183 codelist{examples/example-embed-short.py}
6183 codelist{examples/example-embed-short.py}
6184 \end_inset
6184 \end_inset
6185
6185
6186
6186
6187 \layout Section
6187 \layout Section
6188
6188
6189
6189
6190 \begin_inset LatexCommand \label{sec:using-pdb}
6190 \begin_inset LatexCommand \label{sec:using-pdb}
6191
6191
6192 \end_inset
6192 \end_inset
6193
6193
6194 Using the Python debugger (
6194 Using the Python debugger (
6195 \family typewriter
6195 \family typewriter
6196 pdb
6196 pdb
6197 \family default
6197 \family default
6198 )
6198 )
6199 \layout Subsection
6199 \layout Subsection
6200
6200
6201 Running entire programs via
6201 Running entire programs via
6202 \family typewriter
6202 \family typewriter
6203 pdb
6203 pdb
6204 \layout Standard
6204 \layout Standard
6205
6205
6206
6206
6207 \family typewriter
6207 \family typewriter
6208 pdb
6208 pdb
6209 \family default
6209 \family default
6210 , the Python debugger, is a powerful interactive debugger which allows you
6210 , the Python debugger, is a powerful interactive debugger which allows you
6211 to step through code, set breakpoints, watch variables, etc.
6211 to step through code, set breakpoints, watch variables, etc.
6212 IPython makes it very easy to start any script under the control of
6212 IPython makes it very easy to start any script under the control of
6213 \family typewriter
6213 \family typewriter
6214 pdb
6214 pdb
6215 \family default
6215 \family default
6216 , regardless of whether you have wrapped it into a
6216 , regardless of whether you have wrapped it into a
6217 \family typewriter
6217 \family typewriter
6218 `main()'
6218 `main()'
6219 \family default
6219 \family default
6220 function or not.
6220 function or not.
6221 For this, simply type
6221 For this, simply type
6222 \family typewriter
6222 \family typewriter
6223 `%run -d myscript'
6223 `%run -d myscript'
6224 \family default
6224 \family default
6225 at an IPython prompt.
6225 at an IPython prompt.
6226 See the
6226 See the
6227 \family typewriter
6227 \family typewriter
6228 %run
6228 %run
6229 \family default
6229 \family default
6230 command's documentation (via
6230 command's documentation (via
6231 \family typewriter
6231 \family typewriter
6232 `%run?'
6232 `%run?'
6233 \family default
6233 \family default
6234 or in Sec.\SpecialChar ~
6234 or in Sec.\SpecialChar ~
6235
6235
6236 \begin_inset LatexCommand \ref{sec:magic}
6236 \begin_inset LatexCommand \ref{sec:magic}
6237
6237
6238 \end_inset
6238 \end_inset
6239
6239
6240 ) for more details, including how to control where
6240 ) for more details, including how to control where
6241 \family typewriter
6241 \family typewriter
6242 pdb
6242 pdb
6243 \family default
6243 \family default
6244 will stop execution first.
6244 will stop execution first.
6245 \layout Standard
6245 \layout Standard
6246
6246
6247 For more information on the use of the
6247 For more information on the use of the
6248 \family typewriter
6248 \family typewriter
6249 pdb
6249 pdb
6250 \family default
6250 \family default
6251 debugger, read the included
6251 debugger, read the included
6252 \family typewriter
6252 \family typewriter
6253 pdb.doc
6253 pdb.doc
6254 \family default
6254 \family default
6255 file (part of the standard Python distribution).
6255 file (part of the standard Python distribution).
6256 On a stock Linux system it is located at
6256 On a stock Linux system it is located at
6257 \family typewriter
6257 \family typewriter
6258 /usr/lib/python2.3/pdb.doc
6258 /usr/lib/python2.3/pdb.doc
6259 \family default
6259 \family default
6260 , but the easiest way to read it is by using the
6260 , but the easiest way to read it is by using the
6261 \family typewriter
6261 \family typewriter
6262 help()
6262 help()
6263 \family default
6263 \family default
6264 function of the
6264 function of the
6265 \family typewriter
6265 \family typewriter
6266 pdb
6266 pdb
6267 \family default
6267 \family default
6268 module as follows (in an IPython prompt):
6268 module as follows (in an IPython prompt):
6269 \layout Standard
6269 \layout Standard
6270
6270
6271
6271
6272 \family typewriter
6272 \family typewriter
6273 In [1]: import pdb
6273 In [1]: import pdb
6274 \newline
6274 \newline
6275 In [2]: pdb.help()
6275 In [2]: pdb.help()
6276 \layout Standard
6276 \layout Standard
6277
6277
6278 This will load the
6278 This will load the
6279 \family typewriter
6279 \family typewriter
6280 pdb.doc
6280 pdb.doc
6281 \family default
6281 \family default
6282 document in a file viewer for you automatically.
6282 document in a file viewer for you automatically.
6283 \layout Subsection
6283 \layout Subsection
6284
6284
6285 Automatic invocation of
6285 Automatic invocation of
6286 \family typewriter
6286 \family typewriter
6287 pdb
6287 pdb
6288 \family default
6288 \family default
6289 on exceptions
6289 on exceptions
6290 \layout Standard
6290 \layout Standard
6291
6291
6292 IPython, if started with the
6292 IPython, if started with the
6293 \family typewriter
6293 \family typewriter
6294 -pdb
6294 -pdb
6295 \family default
6295 \family default
6296 option (or if the option is set in your rc file) can call the Python
6296 option (or if the option is set in your rc file) can call the Python
6297 \family typewriter
6297 \family typewriter
6298 pdb
6298 pdb
6299 \family default
6299 \family default
6300 debugger every time your code triggers an uncaught exception
6300 debugger every time your code triggers an uncaught exception
6301 \begin_inset Foot
6301 \begin_inset Foot
6302 collapsed true
6302 collapsed true
6303
6303
6304 \layout Standard
6304 \layout Standard
6305
6305
6306 Many thanks to Christopher Hart for the request which prompted adding this
6306 Many thanks to Christopher Hart for the request which prompted adding this
6307 feature to IPython.
6307 feature to IPython.
6308 \end_inset
6308 \end_inset
6309
6309
6310 .
6310 .
6311 This feature can also be toggled at any time with the
6311 This feature can also be toggled at any time with the
6312 \family typewriter
6312 \family typewriter
6313 %pdb
6313 %pdb
6314 \family default
6314 \family default
6315 magic command.
6315 magic command.
6316 This can be extremely useful in order to find the origin of subtle bugs,
6316 This can be extremely useful in order to find the origin of subtle bugs,
6317 because
6317 because
6318 \family typewriter
6318 \family typewriter
6319 pdb
6319 pdb
6320 \family default
6320 \family default
6321 opens up at the point in your code which triggered the exception, and while
6321 opens up at the point in your code which triggered the exception, and while
6322 your program is at this point `dead', all the data is still available and
6322 your program is at this point `dead', all the data is still available and
6323 you can walk up and down the stack frame and understand the origin of the
6323 you can walk up and down the stack frame and understand the origin of the
6324 problem.
6324 problem.
6325 \layout Standard
6325 \layout Standard
6326
6326
6327 Furthermore, you can use these debugging facilities both with the embedded
6327 Furthermore, you can use these debugging facilities both with the embedded
6328 IPython mode and without IPython at all.
6328 IPython mode and without IPython at all.
6329 For an embedded shell (see sec.
6329 For an embedded shell (see sec.
6330
6330
6331 \begin_inset LatexCommand \ref{sec:embed}
6331 \begin_inset LatexCommand \ref{sec:embed}
6332
6332
6333 \end_inset
6333 \end_inset
6334
6334
6335 ), simply call the constructor with
6335 ), simply call the constructor with
6336 \family typewriter
6336 \family typewriter
6337 `-pdb'
6337 `-pdb'
6338 \family default
6338 \family default
6339 in the argument string and automatically
6339 in the argument string and automatically
6340 \family typewriter
6340 \family typewriter
6341 pdb
6341 pdb
6342 \family default
6342 \family default
6343 will be called if an uncaught exception is triggered by your code.
6343 will be called if an uncaught exception is triggered by your code.
6344
6344
6345 \layout Standard
6345 \layout Standard
6346
6346
6347 For stand-alone use of the feature in your programs which do not use IPython
6347 For stand-alone use of the feature in your programs which do not use IPython
6348 at all, put the following lines toward the top of your `main' routine:
6348 at all, put the following lines toward the top of your `main' routine:
6349 \layout Standard
6349 \layout Standard
6350 \align left
6350 \align left
6351
6351
6352 \family typewriter
6352 \family typewriter
6353 import sys,IPython.ultraTB
6353 import sys,IPython.ultraTB
6354 \newline
6354 \newline
6355 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux',
6355 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux',
6356 call_pdb=1)
6356 call_pdb=1)
6357 \layout Standard
6357 \layout Standard
6358
6358
6359 The
6359 The
6360 \family typewriter
6360 \family typewriter
6361 mode
6361 mode
6362 \family default
6362 \family default
6363 keyword can be either
6363 keyword can be either
6364 \family typewriter
6364 \family typewriter
6365 `Verbose'
6365 `Verbose'
6366 \family default
6366 \family default
6367 or
6367 or
6368 \family typewriter
6368 \family typewriter
6369 `Plain'
6369 `Plain'
6370 \family default
6370 \family default
6371 , giving either very detailed or normal tracebacks respectively.
6371 , giving either very detailed or normal tracebacks respectively.
6372 The
6372 The
6373 \family typewriter
6373 \family typewriter
6374 color_scheme
6374 color_scheme
6375 \family default
6375 \family default
6376 keyword can be one of
6376 keyword can be one of
6377 \family typewriter
6377 \family typewriter
6378 `NoColor'
6378 `NoColor'
6379 \family default
6379 \family default
6380 ,
6380 ,
6381 \family typewriter
6381 \family typewriter
6382 `Linux'
6382 `Linux'
6383 \family default
6383 \family default
6384 (default) or
6384 (default) or
6385 \family typewriter
6385 \family typewriter
6386 `LightBG'
6386 `LightBG'
6387 \family default
6387 \family default
6388 .
6388 .
6389 These are the same options which can be set in IPython with
6389 These are the same options which can be set in IPython with
6390 \family typewriter
6390 \family typewriter
6391 -colors
6391 -colors
6392 \family default
6392 \family default
6393 and
6393 and
6394 \family typewriter
6394 \family typewriter
6395 -xmode
6395 -xmode
6396 \family default
6396 \family default
6397 .
6397 .
6398 \layout Standard
6398 \layout Standard
6399
6399
6400 This will give any of your programs detailed, colored tracebacks with automatic
6400 This will give any of your programs detailed, colored tracebacks with automatic
6401 invocation of
6401 invocation of
6402 \family typewriter
6402 \family typewriter
6403 pdb
6403 pdb
6404 \family default
6404 \family default
6405 .
6405 .
6406 \layout Section
6406 \layout Section
6407
6407
6408
6408
6409 \begin_inset LatexCommand \label{sec:syntax-extensions}
6409 \begin_inset LatexCommand \label{sec:syntax-extensions}
6410
6410
6411 \end_inset
6411 \end_inset
6412
6412
6413 Extensions for syntax processing
6413 Extensions for syntax processing
6414 \layout Standard
6414 \layout Standard
6415
6415
6416 This isn't for the faint of heart, because the potential for breaking things
6416 This isn't for the faint of heart, because the potential for breaking things
6417 is quite high.
6417 is quite high.
6418 But it can be a very powerful and useful feature.
6418 But it can be a very powerful and useful feature.
6419 In a nutshell, you can redefine the way IPython processes the user input
6419 In a nutshell, you can redefine the way IPython processes the user input
6420 line to accept new, special extensions to the syntax without needing to
6420 line to accept new, special extensions to the syntax without needing to
6421 change any of IPython's own code.
6421 change any of IPython's own code.
6422 \layout Standard
6422 \layout Standard
6423
6423
6424 In the
6424 In the
6425 \family typewriter
6425 \family typewriter
6426 IPython/Extensions
6426 IPython/Extensions
6427 \family default
6427 \family default
6428 directory you will find some examples supplied, which we will briefly describe
6428 directory you will find some examples supplied, which we will briefly describe
6429 now.
6429 now.
6430 These can be used `as is' (and both provide very useful functionality),
6430 These can be used `as is' (and both provide very useful functionality),
6431 or you can use them as a starting point for writing your own extensions.
6431 or you can use them as a starting point for writing your own extensions.
6432 \layout Subsection
6432 \layout Subsection
6433
6433
6434 Pasting of code starting with
6434 Pasting of code starting with
6435 \family typewriter
6435 \family typewriter
6436 `>>>
6436 `>>>
6437 \family default
6437 \family default
6438 ' or
6438 ' or
6439 \family typewriter
6439 \family typewriter
6440 `...
6440 `...
6441
6441
6442 \family default
6442 \family default
6443 '
6443 '
6444 \layout Standard
6444 \layout Standard
6445
6445
6446 In the python tutorial it is common to find code examples which have been
6446 In the python tutorial it is common to find code examples which have been
6447 taken from real python sessions.
6447 taken from real python sessions.
6448 The problem with those is that all the lines begin with either
6448 The problem with those is that all the lines begin with either
6449 \family typewriter
6449 \family typewriter
6450 `>>>
6450 `>>>
6451 \family default
6451 \family default
6452 ' or
6452 ' or
6453 \family typewriter
6453 \family typewriter
6454 `...
6454 `...
6455
6455
6456 \family default
6456 \family default
6457 ', which makes it impossible to paste them all at once.
6457 ', which makes it impossible to paste them all at once.
6458 One must instead do a line by line manual copying, carefully removing the
6458 One must instead do a line by line manual copying, carefully removing the
6459 leading extraneous characters.
6459 leading extraneous characters.
6460 \layout Standard
6460 \layout Standard
6461
6461
6462 This extension identifies those starting characters and removes them from
6462 This extension identifies those starting characters and removes them from
6463 the input automatically, so that one can paste multi-line examples directly
6463 the input automatically, so that one can paste multi-line examples directly
6464 into IPython, saving a lot of time.
6464 into IPython, saving a lot of time.
6465 Please look at the file
6465 Please look at the file
6466 \family typewriter
6466 \family typewriter
6467 InterpreterPasteInput.py
6467 InterpreterPasteInput.py
6468 \family default
6468 \family default
6469 in the
6469 in the
6470 \family typewriter
6470 \family typewriter
6471 IPython/Extensions
6471 IPython/Extensions
6472 \family default
6472 \family default
6473 directory for details on how this is done.
6473 directory for details on how this is done.
6474 \layout Standard
6474 \layout Standard
6475
6475
6476 IPython comes with a special profile enabling this feature, called
6476 IPython comes with a special profile enabling this feature, called
6477 \family typewriter
6477 \family typewriter
6478 tutorial
6478 tutorial
6479 \family default
6479 \family default
6480 \emph on
6480 \emph on
6481 .
6481 .
6482
6482
6483 \emph default
6483 \emph default
6484 Simply start IPython via
6484 Simply start IPython via
6485 \family typewriter
6485 \family typewriter
6486 `ipython\SpecialChar ~
6486 `ipython\SpecialChar ~
6487 -p\SpecialChar ~
6487 -p\SpecialChar ~
6488 tutorial'
6488 tutorial'
6489 \family default
6489 \family default
6490 and the feature will be available.
6490 and the feature will be available.
6491 In a normal IPython session you can activate the feature by importing the
6491 In a normal IPython session you can activate the feature by importing the
6492 corresponding module with:
6492 corresponding module with:
6493 \newline
6493 \newline
6494
6494
6495 \family typewriter
6495 \family typewriter
6496 In [1]: import IPython.Extensions.InterpreterPasteInput
6496 In [1]: import IPython.Extensions.InterpreterPasteInput
6497 \layout Standard
6497 \layout Standard
6498
6498
6499 The following is a 'screenshot' of how things work when this extension is
6499 The following is a 'screenshot' of how things work when this extension is
6500 on, copying an example from the standard tutorial:
6500 on, copying an example from the standard tutorial:
6501 \layout Standard
6501 \layout Standard
6502
6502
6503
6503
6504 \family typewriter
6504 \family typewriter
6505 IPython profile: tutorial
6505 IPython profile: tutorial
6506 \newline
6506 \newline
6507 \SpecialChar ~
6507 \SpecialChar ~
6508
6508
6509 \newline
6509 \newline
6510 *** Pasting of code with ">>>" or "..." has been enabled.
6510 *** Pasting of code with ">>>" or "..." has been enabled.
6511 \newline
6511 \newline
6512 \SpecialChar ~
6512 \SpecialChar ~
6513
6513
6514 \newline
6514 \newline
6515 In [1]: >>> def fib2(n): # return Fibonacci series up to n
6515 In [1]: >>> def fib2(n): # return Fibonacci series up to n
6516 \newline
6516 \newline
6517
6517
6518 \begin_inset ERT
6518 \begin_inset ERT
6519 status Collapsed
6519 status Collapsed
6520
6520
6521 \layout Standard
6521 \layout Standard
6522
6522
6523 \backslash
6523 \backslash
6524 hspace*{0mm}
6524 hspace*{0mm}
6525 \end_inset
6525 \end_inset
6526
6526
6527 \SpecialChar ~
6527 \SpecialChar ~
6528 \SpecialChar ~
6528 \SpecialChar ~
6529 ...: ...\SpecialChar ~
6529 ...: ...\SpecialChar ~
6530 \SpecialChar ~
6530 \SpecialChar ~
6531 \SpecialChar ~
6531 \SpecialChar ~
6532 \SpecialChar ~
6532 \SpecialChar ~
6533 """Return a list containing the Fibonacci series up to n."""
6533 """Return a list containing the Fibonacci series up to n."""
6534 \newline
6534 \newline
6535
6535
6536 \begin_inset ERT
6536 \begin_inset ERT
6537 status Collapsed
6537 status Collapsed
6538
6538
6539 \layout Standard
6539 \layout Standard
6540
6540
6541 \backslash
6541 \backslash
6542 hspace*{0mm}
6542 hspace*{0mm}
6543 \end_inset
6543 \end_inset
6544
6544
6545 \SpecialChar ~
6545 \SpecialChar ~
6546 \SpecialChar ~
6546 \SpecialChar ~
6547 ...: ...\SpecialChar ~
6547 ...: ...\SpecialChar ~
6548 \SpecialChar ~
6548 \SpecialChar ~
6549 \SpecialChar ~
6549 \SpecialChar ~
6550 \SpecialChar ~
6550 \SpecialChar ~
6551 result = []
6551 result = []
6552 \newline
6552 \newline
6553
6553
6554 \begin_inset ERT
6554 \begin_inset ERT
6555 status Collapsed
6555 status Collapsed
6556
6556
6557 \layout Standard
6557 \layout Standard
6558
6558
6559 \backslash
6559 \backslash
6560 hspace*{0mm}
6560 hspace*{0mm}
6561 \end_inset
6561 \end_inset
6562
6562
6563 \SpecialChar ~
6563 \SpecialChar ~
6564 \SpecialChar ~
6564 \SpecialChar ~
6565 ...: ...\SpecialChar ~
6565 ...: ...\SpecialChar ~
6566 \SpecialChar ~
6566 \SpecialChar ~
6567 \SpecialChar ~
6567 \SpecialChar ~
6568 \SpecialChar ~
6568 \SpecialChar ~
6569 a, b = 0, 1
6569 a, b = 0, 1
6570 \newline
6570 \newline
6571
6571
6572 \begin_inset ERT
6572 \begin_inset ERT
6573 status Collapsed
6573 status Collapsed
6574
6574
6575 \layout Standard
6575 \layout Standard
6576
6576
6577 \backslash
6577 \backslash
6578 hspace*{0mm}
6578 hspace*{0mm}
6579 \end_inset
6579 \end_inset
6580
6580
6581 \SpecialChar ~
6581 \SpecialChar ~
6582 \SpecialChar ~
6582 \SpecialChar ~
6583 ...: ...\SpecialChar ~
6583 ...: ...\SpecialChar ~
6584 \SpecialChar ~
6584 \SpecialChar ~
6585 \SpecialChar ~
6585 \SpecialChar ~
6586 \SpecialChar ~
6586 \SpecialChar ~
6587 while b < n:
6587 while b < n:
6588 \newline
6588 \newline
6589
6589
6590 \begin_inset ERT
6590 \begin_inset ERT
6591 status Collapsed
6591 status Collapsed
6592
6592
6593 \layout Standard
6593 \layout Standard
6594
6594
6595 \backslash
6595 \backslash
6596 hspace*{0mm}
6596 hspace*{0mm}
6597 \end_inset
6597 \end_inset
6598
6598
6599 \SpecialChar ~
6599 \SpecialChar ~
6600 \SpecialChar ~
6600 \SpecialChar ~
6601 ...: ...\SpecialChar ~
6601 ...: ...\SpecialChar ~
6602 \SpecialChar ~
6602 \SpecialChar ~
6603 \SpecialChar ~
6603 \SpecialChar ~
6604 \SpecialChar ~
6604 \SpecialChar ~
6605 \SpecialChar ~
6605 \SpecialChar ~
6606 \SpecialChar ~
6606 \SpecialChar ~
6607 \SpecialChar ~
6607 \SpecialChar ~
6608 \SpecialChar ~
6608 \SpecialChar ~
6609 result.append(b)\SpecialChar ~
6609 result.append(b)\SpecialChar ~
6610 \SpecialChar ~
6610 \SpecialChar ~
6611 \SpecialChar ~
6611 \SpecialChar ~
6612 # see below
6612 # see below
6613 \newline
6613 \newline
6614
6614
6615 \begin_inset ERT
6615 \begin_inset ERT
6616 status Collapsed
6616 status Collapsed
6617
6617
6618 \layout Standard
6618 \layout Standard
6619
6619
6620 \backslash
6620 \backslash
6621 hspace*{0mm}
6621 hspace*{0mm}
6622 \end_inset
6622 \end_inset
6623
6623
6624 \SpecialChar ~
6624 \SpecialChar ~
6625 \SpecialChar ~
6625 \SpecialChar ~
6626 ...: ...\SpecialChar ~
6626 ...: ...\SpecialChar ~
6627 \SpecialChar ~
6627 \SpecialChar ~
6628 \SpecialChar ~
6628 \SpecialChar ~
6629 \SpecialChar ~
6629 \SpecialChar ~
6630 \SpecialChar ~
6630 \SpecialChar ~
6631 \SpecialChar ~
6631 \SpecialChar ~
6632 \SpecialChar ~
6632 \SpecialChar ~
6633 \SpecialChar ~
6633 \SpecialChar ~
6634 a, b = b, a+b
6634 a, b = b, a+b
6635 \newline
6635 \newline
6636
6636
6637 \begin_inset ERT
6637 \begin_inset ERT
6638 status Collapsed
6638 status Collapsed
6639
6639
6640 \layout Standard
6640 \layout Standard
6641
6641
6642 \backslash
6642 \backslash
6643 hspace*{0mm}
6643 hspace*{0mm}
6644 \end_inset
6644 \end_inset
6645
6645
6646 \SpecialChar ~
6646 \SpecialChar ~
6647 \SpecialChar ~
6647 \SpecialChar ~
6648 ...: ...\SpecialChar ~
6648 ...: ...\SpecialChar ~
6649 \SpecialChar ~
6649 \SpecialChar ~
6650 \SpecialChar ~
6650 \SpecialChar ~
6651 \SpecialChar ~
6651 \SpecialChar ~
6652 return result
6652 return result
6653 \newline
6653 \newline
6654
6654
6655 \begin_inset ERT
6655 \begin_inset ERT
6656 status Collapsed
6656 status Collapsed
6657
6657
6658 \layout Standard
6658 \layout Standard
6659
6659
6660 \backslash
6660 \backslash
6661 hspace*{0mm}
6661 hspace*{0mm}
6662 \end_inset
6662 \end_inset
6663
6663
6664 \SpecialChar ~
6664 \SpecialChar ~
6665 \SpecialChar ~
6665 \SpecialChar ~
6666 ...:
6666 ...:
6667 \newline
6667 \newline
6668 \SpecialChar ~
6668 \SpecialChar ~
6669
6669
6670 \newline
6670 \newline
6671 In [2]: fib2(10)
6671 In [2]: fib2(10)
6672 \newline
6672 \newline
6673 Out[2]: [1, 1, 2, 3, 5, 8]
6673 Out[2]: [1, 1, 2, 3, 5, 8]
6674 \layout Standard
6674 \layout Standard
6675
6675
6676 Note that as currently written, this extension does
6676 Note that as currently written, this extension does
6677 \emph on
6677 \emph on
6678 not
6678 not
6679 \emph default
6679 \emph default
6680 recognize IPython's prompts for pasting.
6680 recognize IPython's prompts for pasting.
6681 Those are more complicated, since the user can change them very easily,
6681 Those are more complicated, since the user can change them very easily,
6682 they involve numbers and can vary in length.
6682 they involve numbers and can vary in length.
6683 One could however extract all the relevant information from the IPython
6683 One could however extract all the relevant information from the IPython
6684 instance and build an appropriate regular expression.
6684 instance and build an appropriate regular expression.
6685 This is left as an exercise for the reader.
6685 This is left as an exercise for the reader.
6686 \layout Subsection
6686 \layout Subsection
6687
6687
6688 Input of physical quantities with units
6688 Input of physical quantities with units
6689 \layout Standard
6689 \layout Standard
6690
6690
6691 The module
6691 The module
6692 \family typewriter
6692 \family typewriter
6693 PhysicalQInput
6693 PhysicalQInput
6694 \family default
6694 \family default
6695 allows a simplified form of input for physical quantities with units.
6695 allows a simplified form of input for physical quantities with units.
6696 This file is meant to be used in conjunction with the
6696 This file is meant to be used in conjunction with the
6697 \family typewriter
6697 \family typewriter
6698 PhysicalQInteractive
6698 PhysicalQInteractive
6699 \family default
6699 \family default
6700 module (in the same directory) and
6700 module (in the same directory) and
6701 \family typewriter
6701 \family typewriter
6702 Physics.PhysicalQuantities
6702 Physics.PhysicalQuantities
6703 \family default
6703 \family default
6704 from Konrad Hinsen's ScientificPython (
6704 from Konrad Hinsen's ScientificPython (
6705 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html}
6705 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html}
6706
6706
6707 \end_inset
6707 \end_inset
6708
6708
6709 ).
6709 ).
6710 \layout Standard
6710 \layout Standard
6711
6711
6712 The
6712 The
6713 \family typewriter
6713 \family typewriter
6714 Physics.PhysicalQuantities
6714 Physics.PhysicalQuantities
6715 \family default
6715 \family default
6716 module defines
6716 module defines
6717 \family typewriter
6717 \family typewriter
6718 PhysicalQuantity
6718 PhysicalQuantity
6719 \family default
6719 \family default
6720 objects, but these must be declared as instances of a class.
6720 objects, but these must be declared as instances of a class.
6721 For example, to define
6721 For example, to define
6722 \family typewriter
6722 \family typewriter
6723 v
6723 v
6724 \family default
6724 \family default
6725 as a velocity of 3\SpecialChar ~
6725 as a velocity of 3\SpecialChar ~
6726 m/s, normally you would write:
6726 m/s, normally you would write:
6727 \family typewriter
6727 \family typewriter
6728
6728
6729 \newline
6729 \newline
6730 In [1]: v = PhysicalQuantity(3,'m/s')
6730 In [1]: v = PhysicalQuantity(3,'m/s')
6731 \layout Standard
6731 \layout Standard
6732
6732
6733 Using the
6733 Using the
6734 \family typewriter
6734 \family typewriter
6735 PhysicalQ_Input
6735 PhysicalQ_Input
6736 \family default
6736 \family default
6737 extension this can be input instead as:
6737 extension this can be input instead as:
6738 \family typewriter
6738 \family typewriter
6739
6739
6740 \newline
6740 \newline
6741 In [1]: v = 3 m/s
6741 In [1]: v = 3 m/s
6742 \family default
6742 \family default
6743
6743
6744 \newline
6744 \newline
6745 which is much more convenient for interactive use (even though it is blatantly
6745 which is much more convenient for interactive use (even though it is blatantly
6746 invalid Python syntax).
6746 invalid Python syntax).
6747 \layout Standard
6747 \layout Standard
6748
6748
6749 The
6749 The
6750 \family typewriter
6750 \family typewriter
6751 physics
6751 physics
6752 \family default
6752 \family default
6753 profile supplied with IPython (enabled via
6753 profile supplied with IPython (enabled via
6754 \family typewriter
6754 \family typewriter
6755 'ipython -p physics'
6755 'ipython -p physics'
6756 \family default
6756 \family default
6757 ) uses these extensions, which you can also activate with:
6757 ) uses these extensions, which you can also activate with:
6758 \layout Standard
6758 \layout Standard
6759
6759
6760
6760
6761 \family typewriter
6761 \family typewriter
6762 from math import * # math MUST be imported BEFORE PhysicalQInteractive
6762 from math import * # math MUST be imported BEFORE PhysicalQInteractive
6763 \newline
6763 \newline
6764 from IPython.Extensions.PhysicalQInteractive import *
6764 from IPython.Extensions.PhysicalQInteractive import *
6765 \newline
6765 \newline
6766 import IPython.Extensions.PhysicalQInput
6766 import IPython.Extensions.PhysicalQInput
6767 \layout Section
6767 \layout Section
6768
6768
6769 IPython as a system shell
6769 IPython as a system shell
6770 \layout Standard
6770 \layout Standard
6771
6771
6772 IPython ships with a special profile called
6772 IPython ships with a special profile called
6773 \family typewriter
6773 \family typewriter
6774 pysh
6774 pysh
6775 \family default
6775 \family default
6776 , which you can activate at the command line as
6776 , which you can activate at the command line as
6777 \family typewriter
6777 \family typewriter
6778 `ipython -p pysh'
6778 `ipython -p pysh'
6779 \family default
6779 \family default
6780 .
6780 .
6781 This loads
6781 This loads
6782 \family typewriter
6782 \family typewriter
6783 InterpreterExec
6783 InterpreterExec
6784 \family default
6784 \family default
6785 , along with some additional facilities and a prompt customized for filesystem
6785 , along with some additional facilities and a prompt customized for filesystem
6786 navigation.
6786 navigation.
6787 \layout Standard
6787 \layout Standard
6788
6788
6789 Note that this does
6789 Note that this does
6790 \emph on
6790 \emph on
6791 not
6791 not
6792 \emph default
6792 \emph default
6793 make IPython a full-fledged system shell.
6793 make IPython a full-fledged system shell.
6794 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
6794 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
6795 you'll suspend pysh itself, not the process you just started.
6795 you'll suspend pysh itself, not the process you just started.
6796
6796
6797 \layout Standard
6797 \layout Standard
6798
6798
6799 What the shell profile allows you to do is to use the convenient and powerful
6799 What the shell profile allows you to do is to use the convenient and powerful
6800 syntax of Python to do quick scripting at the command line.
6800 syntax of Python to do quick scripting at the command line.
6801 Below we describe some of its features.
6801 Below we describe some of its features.
6802 \layout Subsection
6802 \layout Subsection
6803
6803
6804 Aliases
6804 Aliases
6805 \layout Standard
6805 \layout Standard
6806
6806
6807 All of your
6807 All of your
6808 \family typewriter
6808 \family typewriter
6809 $PATH
6809 $PATH
6810 \family default
6810 \family default
6811 has been loaded as IPython aliases, so you should be able to type any normal
6811 has been loaded as IPython aliases, so you should be able to type any normal
6812 system command and have it executed.
6812 system command and have it executed.
6813 See
6813 See
6814 \family typewriter
6814 \family typewriter
6815 %alias?
6815 %alias?
6816 \family default
6816 \family default
6817 and
6817 and
6818 \family typewriter
6818 \family typewriter
6819 %unalias?
6819 %unalias?
6820 \family default
6820 \family default
6821 for details on the alias facilities.
6821 for details on the alias facilities.
6822 See also
6822 See also
6823 \family typewriter
6823 \family typewriter
6824 %rehash?
6824 %rehash?
6825 \family default
6825 \family default
6826 and
6826 and
6827 \family typewriter
6827 \family typewriter
6828 %rehashx?
6828 %rehashx?
6829 \family default
6829 \family default
6830 for details on the mechanism used to load
6830 for details on the mechanism used to load
6831 \family typewriter
6831 \family typewriter
6832 $PATH
6832 $PATH
6833 \family default
6833 \family default
6834 .
6834 .
6835 \layout Subsection
6835 \layout Subsection
6836
6836
6837 Special syntax
6837 Special syntax
6838 \layout Standard
6838 \layout Standard
6839
6839
6840 Any lines which begin with
6840 Any lines which begin with
6841 \family typewriter
6841 \family typewriter
6842 `~'
6842 `~'
6843 \family default
6843 \family default
6844 ,
6844 ,
6845 \family typewriter
6845 \family typewriter
6846 `/'
6846 `/'
6847 \family default
6847 \family default
6848 and
6848 and
6849 \family typewriter
6849 \family typewriter
6850 `.'
6850 `.'
6851 \family default
6851 \family default
6852 will be executed as shell commands instead of as Python code.
6852 will be executed as shell commands instead of as Python code.
6853 The special escapes below are also recognized.
6853 The special escapes below are also recognized.
6854
6854
6855 \family typewriter
6855 \family typewriter
6856 !cmd
6856 !cmd
6857 \family default
6857 \family default
6858 is valid in single or multi-line input, all others are only valid in single-lin
6858 is valid in single or multi-line input, all others are only valid in single-lin
6859 e input:
6859 e input:
6860 \layout Description
6860 \layout Description
6861
6861
6862
6862
6863 \family typewriter
6863 \family typewriter
6864 !cmd
6864 !cmd
6865 \family default
6865 \family default
6866 pass `cmd' directly to the shell
6866 pass `cmd' directly to the shell
6867 \layout Description
6867 \layout Description
6868
6868
6869
6869
6870 \family typewriter
6870 \family typewriter
6871 !!cmd
6871 !!cmd
6872 \family default
6872 \family default
6873 execute `cmd' and return output as a list (split on `
6873 execute `cmd' and return output as a list (split on `
6874 \backslash
6874 \backslash
6875 n')
6875 n')
6876 \layout Description
6876 \layout Description
6877
6877
6878
6878
6879 \family typewriter
6879 \family typewriter
6880 $var=cmd
6880 $var=cmd
6881 \family default
6881 \family default
6882 capture output of cmd into var, as a string
6882 capture output of cmd into var, as a string
6883 \layout Description
6883 \layout Description
6884
6884
6885
6885
6886 \family typewriter
6886 \family typewriter
6887 $$var=cmd
6887 $$var=cmd
6888 \family default
6888 \family default
6889 capture output of cmd into var, as a list (split on `
6889 capture output of cmd into var, as a list (split on `
6890 \backslash
6890 \backslash
6891 n')
6891 n')
6892 \layout Standard
6892 \layout Standard
6893
6893
6894 The
6894 The
6895 \family typewriter
6895 \family typewriter
6896 $
6896 $
6897 \family default
6897 \family default
6898 /
6898 /
6899 \family typewriter
6899 \family typewriter
6900 $$
6900 $$
6901 \family default
6901 \family default
6902 syntaxes make Python variables from system output, which you can later
6902 syntaxes make Python variables from system output, which you can later
6903 use for further scripting.
6903 use for further scripting.
6904 The converse is also possible: when executing an alias or calling to the
6904 The converse is also possible: when executing an alias or calling to the
6905 system via
6905 system via
6906 \family typewriter
6906 \family typewriter
6907 !
6907 !
6908 \family default
6908 \family default
6909 /
6909 /
6910 \family typewriter
6910 \family typewriter
6911 !!
6911 !!
6912 \family default
6912 \family default
6913 , you can expand any python variable or expression by prepending it with
6913 , you can expand any python variable or expression by prepending it with
6914
6914
6915 \family typewriter
6915 \family typewriter
6916 $
6916 $
6917 \family default
6917 \family default
6918 .
6918 .
6919 Full details of the allowed syntax can be found in Python's PEP 215.
6919 Full details of the allowed syntax can be found in Python's PEP 215.
6920 \layout Standard
6920 \layout Standard
6921
6921
6922 A few brief examples will illustrate these (note that the indentation below
6922 A few brief examples will illustrate these (note that the indentation below
6923 may be incorrectly displayed):
6923 may be incorrectly displayed):
6924 \layout Standard
6924 \layout Standard
6925
6925
6926
6926
6927 \family typewriter
6927 \family typewriter
6928 fperez[~/test]|3> !ls *s.py
6928 fperez[~/test]|3> !ls *s.py
6929 \newline
6929 \newline
6930 scopes.py strings.py
6930 scopes.py strings.py
6931 \layout Standard
6931 \layout Standard
6932
6932
6933 ls is an internal alias, so there's no need to use
6933 ls is an internal alias, so there's no need to use
6934 \family typewriter
6934 \family typewriter
6935 !
6935 !
6936 \family default
6936 \family default
6937 :
6937 :
6938 \layout Standard
6938 \layout Standard
6939
6939
6940
6940
6941 \family typewriter
6941 \family typewriter
6942 fperez[~/test]|4> ls *s.py
6942 fperez[~/test]|4> ls *s.py
6943 \newline
6943 \newline
6944 scopes.py* strings.py
6944 scopes.py* strings.py
6945 \layout Standard
6945 \layout Standard
6946
6946
6947 !!ls will return the output into a Python variable:
6947 !!ls will return the output into a Python variable:
6948 \layout Standard
6948 \layout Standard
6949
6949
6950
6950
6951 \family typewriter
6951 \family typewriter
6952 fperez[~/test]|5> !!ls *s.py
6952 fperez[~/test]|5> !!ls *s.py
6953 \newline
6953 \newline
6954
6954
6955 \begin_inset ERT
6955 \begin_inset ERT
6956 status Collapsed
6956 status Collapsed
6957
6957
6958 \layout Standard
6958 \layout Standard
6959
6959
6960 \backslash
6960 \backslash
6961 hspace*{0mm}
6961 hspace*{0mm}
6962 \end_inset
6962 \end_inset
6963
6963
6964 \SpecialChar ~
6964 \SpecialChar ~
6965 \SpecialChar ~
6965 \SpecialChar ~
6966 \SpecialChar ~
6966 \SpecialChar ~
6967 \SpecialChar ~
6967 \SpecialChar ~
6968 \SpecialChar ~
6968 \SpecialChar ~
6969 \SpecialChar ~
6969 \SpecialChar ~
6970 \SpecialChar ~
6970 \SpecialChar ~
6971 \SpecialChar ~
6971 \SpecialChar ~
6972 \SpecialChar ~
6972 \SpecialChar ~
6973 \SpecialChar ~
6973 \SpecialChar ~
6974 \SpecialChar ~
6974 \SpecialChar ~
6975 \SpecialChar ~
6975 \SpecialChar ~
6976 \SpecialChar ~
6976 \SpecialChar ~
6977 \SpecialChar ~
6977 \SpecialChar ~
6978 <5> ['scopes.py', 'strings.py']
6978 <5> ['scopes.py', 'strings.py']
6979 \newline
6979 \newline
6980 fperez[~/test]|6> print _5
6980 fperez[~/test]|6> print _5
6981 \newline
6981 \newline
6982 ['scopes.py', 'strings.py']
6982 ['scopes.py', 'strings.py']
6983 \layout Standard
6983 \layout Standard
6984
6984
6985
6985
6986 \family typewriter
6986 \family typewriter
6987 $
6987 $
6988 \family default
6988 \family default
6989 and
6989 and
6990 \family typewriter
6990 \family typewriter
6991 $$
6991 $$
6992 \family default
6992 \family default
6993 allow direct capture to named variables:
6993 allow direct capture to named variables:
6994 \layout Standard
6994 \layout Standard
6995
6995
6996
6996
6997 \family typewriter
6997 \family typewriter
6998 fperez[~/test]|7> $astr = ls *s.py
6998 fperez[~/test]|7> $astr = ls *s.py
6999 \newline
6999 \newline
7000 fperez[~/test]|8> astr
7000 fperez[~/test]|8> astr
7001 \newline
7001 \newline
7002
7002
7003 \begin_inset ERT
7003 \begin_inset ERT
7004 status Collapsed
7004 status Collapsed
7005
7005
7006 \layout Standard
7006 \layout Standard
7007
7007
7008 \backslash
7008 \backslash
7009 hspace*{0mm}
7009 hspace*{0mm}
7010 \end_inset
7010 \end_inset
7011
7011
7012 \SpecialChar ~
7012 \SpecialChar ~
7013 \SpecialChar ~
7013 \SpecialChar ~
7014 \SpecialChar ~
7014 \SpecialChar ~
7015 \SpecialChar ~
7015 \SpecialChar ~
7016 \SpecialChar ~
7016 \SpecialChar ~
7017 \SpecialChar ~
7017 \SpecialChar ~
7018 \SpecialChar ~
7018 \SpecialChar ~
7019 \SpecialChar ~
7019 \SpecialChar ~
7020 \SpecialChar ~
7020 \SpecialChar ~
7021 \SpecialChar ~
7021 \SpecialChar ~
7022 \SpecialChar ~
7022 \SpecialChar ~
7023 \SpecialChar ~
7023 \SpecialChar ~
7024 \SpecialChar ~
7024 \SpecialChar ~
7025 \SpecialChar ~
7025 \SpecialChar ~
7026 <8> 'scopes.py
7026 <8> 'scopes.py
7027 \backslash
7027 \backslash
7028 nstrings.py'
7028 nstrings.py'
7029 \layout Standard
7029 \layout Standard
7030
7030
7031
7031
7032 \family typewriter
7032 \family typewriter
7033 fperez[~/test]|9> $$alist = ls *s.py
7033 fperez[~/test]|9> $$alist = ls *s.py
7034 \newline
7034 \newline
7035 fperez[~/test]|10> alist
7035 fperez[~/test]|10> alist
7036 \newline
7036 \newline
7037
7037
7038 \begin_inset ERT
7038 \begin_inset ERT
7039 status Collapsed
7039 status Collapsed
7040
7040
7041 \layout Standard
7041 \layout Standard
7042
7042
7043 \backslash
7043 \backslash
7044 hspace*{0mm}
7044 hspace*{0mm}
7045 \end_inset
7045 \end_inset
7046
7046
7047 \SpecialChar ~
7047 \SpecialChar ~
7048 \SpecialChar ~
7048 \SpecialChar ~
7049 \SpecialChar ~
7049 \SpecialChar ~
7050 \SpecialChar ~
7050 \SpecialChar ~
7051 \SpecialChar ~
7051 \SpecialChar ~
7052 \SpecialChar ~
7052 \SpecialChar ~
7053 \SpecialChar ~
7053 \SpecialChar ~
7054 \SpecialChar ~
7054 \SpecialChar ~
7055 \SpecialChar ~
7055 \SpecialChar ~
7056 \SpecialChar ~
7056 \SpecialChar ~
7057 \SpecialChar ~
7057 \SpecialChar ~
7058 \SpecialChar ~
7058 \SpecialChar ~
7059 \SpecialChar ~
7059 \SpecialChar ~
7060 \SpecialChar ~
7060 \SpecialChar ~
7061 <10> ['scopes.py', 'strings.py']
7061 <10> ['scopes.py', 'strings.py']
7062 \layout Standard
7062 \layout Standard
7063
7063
7064 alist is now a normal python list you can loop over.
7064 alist is now a normal python list you can loop over.
7065 Using
7065 Using
7066 \family typewriter
7066 \family typewriter
7067 $
7067 $
7068 \family default
7068 \family default
7069 will expand back the python values when alias calls are made:
7069 will expand back the python values when alias calls are made:
7070 \layout Standard
7070 \layout Standard
7071
7071
7072
7072
7073 \family typewriter
7073 \family typewriter
7074 fperez[~/test]|11> for f in alist:
7074 fperez[~/test]|11> for f in alist:
7075 \newline
7075 \newline
7076
7076
7077 \begin_inset ERT
7077 \begin_inset ERT
7078 status Collapsed
7078 status Collapsed
7079
7079
7080 \layout Standard
7080 \layout Standard
7081
7081
7082 \backslash
7082 \backslash
7083 hspace*{0mm}
7083 hspace*{0mm}
7084 \end_inset
7084 \end_inset
7085
7085
7086 \SpecialChar ~
7086 \SpecialChar ~
7087 \SpecialChar ~
7087 \SpecialChar ~
7088 \SpecialChar ~
7088 \SpecialChar ~
7089 \SpecialChar ~
7089 \SpecialChar ~
7090 \SpecialChar ~
7090 \SpecialChar ~
7091 \SpecialChar ~
7091 \SpecialChar ~
7092 \SpecialChar ~
7092 \SpecialChar ~
7093 \SpecialChar ~
7093 \SpecialChar ~
7094 \SpecialChar ~
7094 \SpecialChar ~
7095 \SpecialChar ~
7095 \SpecialChar ~
7096 \SpecialChar ~
7096 \SpecialChar ~
7097 \SpecialChar ~
7097 \SpecialChar ~
7098 \SpecialChar ~
7098 \SpecialChar ~
7099 \SpecialChar ~
7099 \SpecialChar ~
7100 |..> \SpecialChar ~
7100 |..> \SpecialChar ~
7101 \SpecialChar ~
7101 \SpecialChar ~
7102 \SpecialChar ~
7102 \SpecialChar ~
7103 \SpecialChar ~
7103 \SpecialChar ~
7104 print 'file',f,
7104 print 'file',f,
7105 \newline
7105 \newline
7106
7106
7107 \begin_inset ERT
7107 \begin_inset ERT
7108 status Collapsed
7108 status Collapsed
7109
7109
7110 \layout Standard
7110 \layout Standard
7111
7111
7112 \backslash
7112 \backslash
7113 hspace*{0mm}
7113 hspace*{0mm}
7114 \end_inset
7114 \end_inset
7115
7115
7116 \SpecialChar ~
7116 \SpecialChar ~
7117 \SpecialChar ~
7117 \SpecialChar ~
7118 \SpecialChar ~
7118 \SpecialChar ~
7119 \SpecialChar ~
7119 \SpecialChar ~
7120 \SpecialChar ~
7120 \SpecialChar ~
7121 \SpecialChar ~
7121 \SpecialChar ~
7122 \SpecialChar ~
7122 \SpecialChar ~
7123 \SpecialChar ~
7123 \SpecialChar ~
7124 \SpecialChar ~
7124 \SpecialChar ~
7125 \SpecialChar ~
7125 \SpecialChar ~
7126 \SpecialChar ~
7126 \SpecialChar ~
7127 \SpecialChar ~
7127 \SpecialChar ~
7128 \SpecialChar ~
7128 \SpecialChar ~
7129 \SpecialChar ~
7129 \SpecialChar ~
7130 |..> \SpecialChar ~
7130 |..> \SpecialChar ~
7131 \SpecialChar ~
7131 \SpecialChar ~
7132 \SpecialChar ~
7132 \SpecialChar ~
7133 \SpecialChar ~
7133 \SpecialChar ~
7134 wc -l $f
7134 wc -l $f
7135 \newline
7135 \newline
7136
7136
7137 \begin_inset ERT
7137 \begin_inset ERT
7138 status Collapsed
7138 status Collapsed
7139
7139
7140 \layout Standard
7140 \layout Standard
7141
7141
7142 \backslash
7142 \backslash
7143 hspace*{0mm}
7143 hspace*{0mm}
7144 \end_inset
7144 \end_inset
7145
7145
7146 \SpecialChar ~
7146 \SpecialChar ~
7147 \SpecialChar ~
7147 \SpecialChar ~
7148 \SpecialChar ~
7148 \SpecialChar ~
7149 \SpecialChar ~
7149 \SpecialChar ~
7150 \SpecialChar ~
7150 \SpecialChar ~
7151 \SpecialChar ~
7151 \SpecialChar ~
7152 \SpecialChar ~
7152 \SpecialChar ~
7153 \SpecialChar ~
7153 \SpecialChar ~
7154 \SpecialChar ~
7154 \SpecialChar ~
7155 \SpecialChar ~
7155 \SpecialChar ~
7156 \SpecialChar ~
7156 \SpecialChar ~
7157 \SpecialChar ~
7157 \SpecialChar ~
7158 \SpecialChar ~
7158 \SpecialChar ~
7159 \SpecialChar ~
7159 \SpecialChar ~
7160 |..>
7160 |..>
7161 \newline
7161 \newline
7162 file scopes.py 13 scopes.py
7162 file scopes.py 13 scopes.py
7163 \newline
7163 \newline
7164 file strings.py 4 strings.py
7164 file strings.py 4 strings.py
7165 \layout Standard
7165 \layout Standard
7166
7166
7167 Note that you may need to protect your variables with braces if you want
7167 Note that you may need to protect your variables with braces if you want
7168 to append strings to their names.
7168 to append strings to their names.
7169 To copy all files in alist to
7169 To copy all files in alist to
7170 \family typewriter
7170 \family typewriter
7171 .bak
7171 .bak
7172 \family default
7172 \family default
7173 extensions, you must use:
7173 extensions, you must use:
7174 \layout Standard
7174 \layout Standard
7175
7175
7176
7176
7177 \family typewriter
7177 \family typewriter
7178 fperez[~/test]|12> for f in alist:
7178 fperez[~/test]|12> for f in alist:
7179 \newline
7179 \newline
7180
7180
7181 \begin_inset ERT
7181 \begin_inset ERT
7182 status Collapsed
7182 status Collapsed
7183
7183
7184 \layout Standard
7184 \layout Standard
7185
7185
7186 \backslash
7186 \backslash
7187 hspace*{0mm}
7187 hspace*{0mm}
7188 \end_inset
7188 \end_inset
7189
7189
7190 \SpecialChar ~
7190 \SpecialChar ~
7191 \SpecialChar ~
7191 \SpecialChar ~
7192 \SpecialChar ~
7192 \SpecialChar ~
7193 \SpecialChar ~
7193 \SpecialChar ~
7194 \SpecialChar ~
7194 \SpecialChar ~
7195 \SpecialChar ~
7195 \SpecialChar ~
7196 \SpecialChar ~
7196 \SpecialChar ~
7197 \SpecialChar ~
7197 \SpecialChar ~
7198 \SpecialChar ~
7198 \SpecialChar ~
7199 \SpecialChar ~
7199 \SpecialChar ~
7200 \SpecialChar ~
7200 \SpecialChar ~
7201 \SpecialChar ~
7201 \SpecialChar ~
7202 \SpecialChar ~
7202 \SpecialChar ~
7203 \SpecialChar ~
7203 \SpecialChar ~
7204 |..> \SpecialChar ~
7204 |..> \SpecialChar ~
7205 \SpecialChar ~
7205 \SpecialChar ~
7206 \SpecialChar ~
7206 \SpecialChar ~
7207 \SpecialChar ~
7207 \SpecialChar ~
7208 cp $f ${f}.bak
7208 cp $f ${f}.bak
7209 \layout Standard
7209 \layout Standard
7210
7210
7211 If you try using
7211 If you try using
7212 \family typewriter
7212 \family typewriter
7213 $f.bak
7213 $f.bak
7214 \family default
7214 \family default
7215 , you'll get an AttributeError exception saying that your string object
7215 , you'll get an AttributeError exception saying that your string object
7216 doesn't have a
7216 doesn't have a
7217 \family typewriter
7217 \family typewriter
7218 .bak
7218 .bak
7219 \family default
7219 \family default
7220 attribute.
7220 attribute.
7221 This is because the
7221 This is because the
7222 \family typewriter
7222 \family typewriter
7223 $
7223 $
7224 \family default
7224 \family default
7225 expansion mechanism allows you to expand full Python expressions:
7225 expansion mechanism allows you to expand full Python expressions:
7226 \layout Standard
7226 \layout Standard
7227
7227
7228
7228
7229 \family typewriter
7229 \family typewriter
7230 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
7230 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
7231 \newline
7231 \newline
7232 sys.platform is: linux2
7232 sys.platform is: linux2
7233 \layout Standard
7233 \layout Standard
7234
7234
7235 IPython's input history handling is still active, which allows you to rerun
7235 IPython's input history handling is still active, which allows you to rerun
7236 a single block of multi-line input by simply using exec:
7236 a single block of multi-line input by simply using exec:
7237 \newline
7237 \newline
7238
7238
7239 \family typewriter
7239 \family typewriter
7240 fperez[~/test]|14> $$alist = ls *.eps
7240 fperez[~/test]|14> $$alist = ls *.eps
7241 \newline
7241 \newline
7242 fperez[~/test]|15> exec _i11
7242 fperez[~/test]|15> exec _i11
7243 \newline
7243 \newline
7244 file image2.eps 921 image2.eps
7244 file image2.eps 921 image2.eps
7245 \newline
7245 \newline
7246 file image.eps 921 image.eps
7246 file image.eps 921 image.eps
7247 \layout Standard
7247 \layout Standard
7248
7248
7249 While these are new special-case syntaxes, they are designed to allow very
7249 While these are new special-case syntaxes, they are designed to allow very
7250 efficient use of the shell with minimal typing.
7250 efficient use of the shell with minimal typing.
7251 At an interactive shell prompt, conciseness of expression wins over readability.
7251 At an interactive shell prompt, conciseness of expression wins over readability.
7252 \layout Subsection
7252 \layout Subsection
7253
7253
7254 Useful functions and modules
7254 Useful functions and modules
7255 \layout Standard
7255 \layout Standard
7256
7256
7257 The os, sys and shutil modules from the Python standard library are automaticall
7257 The os, sys and shutil modules from the Python standard library are automaticall
7258 y loaded.
7258 y loaded.
7259 Some additional functions, useful for shell usage, are listed below.
7259 Some additional functions, useful for shell usage, are listed below.
7260 You can request more help about them with `
7260 You can request more help about them with `
7261 \family typewriter
7261 \family typewriter
7262 ?
7262 ?
7263 \family default
7263 \family default
7264 '.
7264 '.
7265 \layout Description
7265 \layout Description
7266
7266
7267
7267
7268 \family typewriter
7268 \family typewriter
7269 shell
7269 shell
7270 \family default
7270 \family default
7271 - execute a command in the underlying system shell
7271 - execute a command in the underlying system shell
7272 \layout Description
7272 \layout Description
7273
7273
7274
7274
7275 \family typewriter
7275 \family typewriter
7276 system
7276 system
7277 \family default
7277 \family default
7278 - like
7278 - like
7279 \family typewriter
7279 \family typewriter
7280 shell()
7280 shell()
7281 \family default
7281 \family default
7282 , but return the exit status of the command
7282 , but return the exit status of the command
7283 \layout Description
7283 \layout Description
7284
7284
7285
7285
7286 \family typewriter
7286 \family typewriter
7287 sout
7287 sout
7288 \family default
7288 \family default
7289 - capture the output of a command as a string
7289 - capture the output of a command as a string
7290 \layout Description
7290 \layout Description
7291
7291
7292
7292
7293 \family typewriter
7293 \family typewriter
7294 lout
7294 lout
7295 \family default
7295 \family default
7296 - capture the output of a command as a list (split on `
7296 - capture the output of a command as a list (split on `
7297 \backslash
7297 \backslash
7298 n')
7298 n')
7299 \layout Description
7299 \layout Description
7300
7300
7301
7301
7302 \family typewriter
7302 \family typewriter
7303 getoutputerror
7303 getoutputerror
7304 \family default
7304 \family default
7305 - capture (output,error) of a shell commandss
7305 - capture (output,error) of a shell commandss
7306 \layout Standard
7306 \layout Standard
7307
7307
7308
7308
7309 \family typewriter
7309 \family typewriter
7310 sout
7310 sout
7311 \family default
7311 \family default
7312 /
7312 /
7313 \family typewriter
7313 \family typewriter
7314 lout
7314 lout
7315 \family default
7315 \family default
7316 are the functional equivalents of
7316 are the functional equivalents of
7317 \family typewriter
7317 \family typewriter
7318 $
7318 $
7319 \family default
7319 \family default
7320 /
7320 /
7321 \family typewriter
7321 \family typewriter
7322 $$
7322 $$
7323 \family default
7323 \family default
7324 .
7324 .
7325 They are provided to allow you to capture system output in the middle of
7325 They are provided to allow you to capture system output in the middle of
7326 true python code, function definitions, etc (where
7326 true python code, function definitions, etc (where
7327 \family typewriter
7327 \family typewriter
7328 $
7328 $
7329 \family default
7329 \family default
7330 and
7330 and
7331 \family typewriter
7331 \family typewriter
7332 $$
7332 $$
7333 \family default
7333 \family default
7334 are invalid).
7334 are invalid).
7335 \layout Subsection
7335 \layout Subsection
7336
7336
7337 Directory management
7337 Directory management
7338 \layout Standard
7338 \layout Standard
7339
7339
7340 Since each command passed by pysh to the underlying system is executed in
7340 Since each command passed by pysh to the underlying system is executed in
7341 a subshell which exits immediately, you can NOT use !cd to navigate the
7341 a subshell which exits immediately, you can NOT use !cd to navigate the
7342 filesystem.
7342 filesystem.
7343 \layout Standard
7343 \layout Standard
7344
7344
7345 Pysh provides its own builtin
7345 Pysh provides its own builtin
7346 \family typewriter
7346 \family typewriter
7347 `%cd
7347 `%cd
7348 \family default
7348 \family default
7349 ' magic command to move in the filesystem (the
7349 ' magic command to move in the filesystem (the
7350 \family typewriter
7350 \family typewriter
7351 %
7351 %
7352 \family default
7352 \family default
7353 is not required with automagic on).
7353 is not required with automagic on).
7354 It also maintains a list of visited directories (use
7354 It also maintains a list of visited directories (use
7355 \family typewriter
7355 \family typewriter
7356 %dhist
7356 %dhist
7357 \family default
7357 \family default
7358 to see it) and allows direct switching to any of them.
7358 to see it) and allows direct switching to any of them.
7359 Type
7359 Type
7360 \family typewriter
7360 \family typewriter
7361 `cd?
7361 `cd?
7362 \family default
7362 \family default
7363 ' for more details.
7363 ' for more details.
7364 \layout Standard
7364 \layout Standard
7365
7365
7366
7366
7367 \family typewriter
7367 \family typewriter
7368 %pushd
7368 %pushd
7369 \family default
7369 \family default
7370 ,
7370 ,
7371 \family typewriter
7371 \family typewriter
7372 %popd
7372 %popd
7373 \family default
7373 \family default
7374 and
7374 and
7375 \family typewriter
7375 \family typewriter
7376 %dirs
7376 %dirs
7377 \family default
7377 \family default
7378 are provided for directory stack handling.
7378 are provided for directory stack handling.
7379 \layout Subsection
7379 \layout Subsection
7380
7380
7381 Prompt customization
7381 Prompt customization
7382 \layout Standard
7382 \layout Standard
7383
7383
7384 The supplied
7384 The supplied
7385 \family typewriter
7385 \family typewriter
7386 ipythonrc-pysh
7386 ipythonrc-pysh
7387 \family default
7387 \family default
7388 profile comes with an example of a very colored and detailed prompt, mainly
7388 profile comes with an example of a very colored and detailed prompt, mainly
7389 to serve as an illustration.
7389 to serve as an illustration.
7390 The valid escape sequences, besides color names, are:
7390 The valid escape sequences, besides color names, are:
7391 \layout Description
7391 \layout Description
7392
7392
7393
7393
7394 \backslash
7394 \backslash
7395 # - Prompt number.
7395 # - Prompt number.
7396 \layout Description
7396 \layout Description
7397
7397
7398
7398
7399 \backslash
7399 \backslash
7400 D - Dots, as many as there are digits in
7400 D - Dots, as many as there are digits in
7401 \backslash
7401 \backslash
7402 # (so they align).
7402 # (so they align).
7403 \layout Description
7403 \layout Description
7404
7404
7405
7405
7406 \backslash
7406 \backslash
7407 w - Current working directory (cwd).
7407 w - Current working directory (cwd).
7408 \layout Description
7408 \layout Description
7409
7409
7410
7410
7411 \backslash
7411 \backslash
7412 W - Basename of current working directory.
7412 W - Basename of current working directory.
7413 \layout Description
7413 \layout Description
7414
7414
7415
7415
7416 \backslash
7416 \backslash
7417 X
7417 X
7418 \emph on
7418 \emph on
7419 N
7419 N
7420 \emph default
7420 \emph default
7421 - Where
7421 - Where
7422 \emph on
7422 \emph on
7423 N
7423 N
7424 \emph default
7424 \emph default
7425 =0..5.
7425 =0..5.
7426 N terms of the cwd, with $HOME written as ~.
7426 N terms of the cwd, with $HOME written as ~.
7427 \layout Description
7427 \layout Description
7428
7428
7429
7429
7430 \backslash
7430 \backslash
7431 Y
7431 Y
7432 \emph on
7432 \emph on
7433 N
7433 N
7434 \emph default
7434 \emph default
7435 - Where
7435 - Where
7436 \emph on
7436 \emph on
7437 N
7437 N
7438 \emph default
7438 \emph default
7439 =0..5.
7439 =0..5.
7440 Like X
7440 Like X
7441 \emph on
7441 \emph on
7442 N
7442 N
7443 \emph default
7443 \emph default
7444 , but if ~ is term
7444 , but if ~ is term
7445 \emph on
7445 \emph on
7446 N
7446 N
7447 \emph default
7447 \emph default
7448 +1 it's also shown.
7448 +1 it's also shown.
7449 \layout Description
7449 \layout Description
7450
7450
7451
7451
7452 \backslash
7452 \backslash
7453 u - Username.
7453 u - Username.
7454 \layout Description
7454 \layout Description
7455
7455
7456
7456
7457 \backslash
7457 \backslash
7458 H - Full hostname.
7458 H - Full hostname.
7459 \layout Description
7459 \layout Description
7460
7460
7461
7461
7462 \backslash
7462 \backslash
7463 h - Hostname up to first '.'
7463 h - Hostname up to first '.'
7464 \layout Description
7464 \layout Description
7465
7465
7466
7466
7467 \backslash
7467 \backslash
7468 $ - Root symbol ($ or #).
7468 $ - Root symbol ($ or #).
7469
7469
7470 \layout Description
7470 \layout Description
7471
7471
7472
7472
7473 \backslash
7473 \backslash
7474 t - Current time, in H:M:S format.
7474 t - Current time, in H:M:S format.
7475 \layout Description
7475 \layout Description
7476
7476
7477
7477
7478 \backslash
7478 \backslash
7479 v - IPython release version.
7479 v - IPython release version.
7480
7480
7481 \layout Description
7481 \layout Description
7482
7482
7483
7483
7484 \backslash
7484 \backslash
7485 n - Newline.
7485 n - Newline.
7486
7486
7487 \layout Description
7487 \layout Description
7488
7488
7489
7489
7490 \backslash
7490 \backslash
7491 r - Carriage return.
7491 r - Carriage return.
7492
7492
7493 \layout Description
7493 \layout Description
7494
7494
7495
7495
7496 \backslash
7496 \backslash
7497
7497
7498 \backslash
7498 \backslash
7499 - An explicitly escaped '
7499 - An explicitly escaped '
7500 \backslash
7500 \backslash
7501 '.
7501 '.
7502 \layout Standard
7502 \layout Standard
7503
7503
7504 You can configure your prompt colors using any ANSI color escape.
7504 You can configure your prompt colors using any ANSI color escape.
7505 Each color escape sets the color for any subsequent text, until another
7505 Each color escape sets the color for any subsequent text, until another
7506 escape comes in and changes things.
7506 escape comes in and changes things.
7507 The valid color escapes are:
7507 The valid color escapes are:
7508 \layout Description
7508 \layout Description
7509
7509
7510
7510
7511 \backslash
7511 \backslash
7512 C_Black
7512 C_Black
7513 \layout Description
7513 \layout Description
7514
7514
7515
7515
7516 \backslash
7516 \backslash
7517 C_Blue
7517 C_Blue
7518 \layout Description
7518 \layout Description
7519
7519
7520
7520
7521 \backslash
7521 \backslash
7522 C_Brown
7522 C_Brown
7523 \layout Description
7523 \layout Description
7524
7524
7525
7525
7526 \backslash
7526 \backslash
7527 C_Cyan
7527 C_Cyan
7528 \layout Description
7528 \layout Description
7529
7529
7530
7530
7531 \backslash
7531 \backslash
7532 C_DarkGray
7532 C_DarkGray
7533 \layout Description
7533 \layout Description
7534
7534
7535
7535
7536 \backslash
7536 \backslash
7537 C_Green
7537 C_Green
7538 \layout Description
7538 \layout Description
7539
7539
7540
7540
7541 \backslash
7541 \backslash
7542 C_LightBlue
7542 C_LightBlue
7543 \layout Description
7543 \layout Description
7544
7544
7545
7545
7546 \backslash
7546 \backslash
7547 C_LightCyan
7547 C_LightCyan
7548 \layout Description
7548 \layout Description
7549
7549
7550
7550
7551 \backslash
7551 \backslash
7552 C_LightGray
7552 C_LightGray
7553 \layout Description
7553 \layout Description
7554
7554
7555
7555
7556 \backslash
7556 \backslash
7557 C_LightGreen
7557 C_LightGreen
7558 \layout Description
7558 \layout Description
7559
7559
7560
7560
7561 \backslash
7561 \backslash
7562 C_LightPurple
7562 C_LightPurple
7563 \layout Description
7563 \layout Description
7564
7564
7565
7565
7566 \backslash
7566 \backslash
7567 C_LightRed
7567 C_LightRed
7568 \layout Description
7568 \layout Description
7569
7569
7570
7570
7571 \backslash
7571 \backslash
7572 C_Purple
7572 C_Purple
7573 \layout Description
7573 \layout Description
7574
7574
7575
7575
7576 \backslash
7576 \backslash
7577 C_Red
7577 C_Red
7578 \layout Description
7578 \layout Description
7579
7579
7580
7580
7581 \backslash
7581 \backslash
7582 C_White
7582 C_White
7583 \layout Description
7583 \layout Description
7584
7584
7585
7585
7586 \backslash
7586 \backslash
7587 C_Yellow
7587 C_Yellow
7588 \layout Description
7588 \layout Description
7589
7589
7590
7590
7591 \backslash
7591 \backslash
7592 C_Normal Stop coloring, defaults to your terminal settings.
7592 C_Normal Stop coloring, defaults to your terminal settings.
7593 \layout Section
7593 \layout Section
7594
7594
7595
7595
7596 \begin_inset LatexCommand \label{sec:Threading-support}
7596 \begin_inset LatexCommand \label{sec:Threading-support}
7597
7597
7598 \end_inset
7598 \end_inset
7599
7599
7600 Threading support
7600 Threading support
7601 \layout Standard
7601 \layout Standard
7602
7602
7603
7603
7604 \series bold
7604 \series bold
7605 WARNING:
7605 WARNING:
7606 \series default
7606 \series default
7607 The threading support is still somewhat experimental, and it has only seen
7607 The threading support is still somewhat experimental, and it has only seen
7608 reasonable testing under Linux.
7608 reasonable testing under Linux.
7609 Threaded code is particularly tricky to debug, and it tends to show extremely
7609 Threaded code is particularly tricky to debug, and it tends to show extremely
7610 platform-dependent behavior.
7610 platform-dependent behavior.
7611 Since I only have access to Linux machines, I will have to rely on user's
7611 Since I only have access to Linux machines, I will have to rely on user's
7612 experiences and assistance for this area of IPython to improve under other
7612 experiences and assistance for this area of IPython to improve under other
7613 platforms.
7613 platforms.
7614 \layout Standard
7614 \layout Standard
7615
7615
7616 IPython, via the
7616 IPython, via the
7617 \family typewriter
7617 \family typewriter
7618 -gthread
7618 -gthread
7619 \family default
7619 \family default
7620 ,
7620 ,
7621 \family typewriter
7621 \family typewriter
7622 -qthread
7622 -qthread
7623 \family default
7623 \family default
7624 and
7624 and
7625 \family typewriter
7625 \family typewriter
7626 -wthread
7626 -wthread
7627 \family default
7627 \family default
7628 options (described in Sec.\SpecialChar ~
7628 options (described in Sec.\SpecialChar ~
7629
7629
7630 \begin_inset LatexCommand \ref{sec:threading-opts}
7630 \begin_inset LatexCommand \ref{sec:threading-opts}
7631
7631
7632 \end_inset
7632 \end_inset
7633
7633
7634 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
7634 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
7635 respectively.
7635 respectively.
7636 These GUI toolkits need to control the python main loop of execution, so
7636 These GUI toolkits need to control the python main loop of execution, so
7637 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
7637 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
7638 will immediately freeze the shell.
7638 will immediately freeze the shell.
7639
7639
7640 \layout Standard
7640 \layout Standard
7641
7641
7642 IPython, with one of these options (you can only use one at a time), separates
7642 IPython, with one of these options (you can only use one at a time), separates
7643 the graphical loop and IPython's code execution run into different threads.
7643 the graphical loop and IPython's code execution run into different threads.
7644 This allows you to test interactively (with
7644 This allows you to test interactively (with
7645 \family typewriter
7645 \family typewriter
7646 %run
7646 %run
7647 \family default
7647 \family default
7648 , for example) your GUI code without blocking.
7648 , for example) your GUI code without blocking.
7649 \layout Standard
7649 \layout Standard
7650
7650
7651 A nice mini-tutorial on using IPython along with the Qt Designer application
7651 A nice mini-tutorial on using IPython along with the Qt Designer application
7652 is available at the SciPy wiki:
7652 is available at the SciPy wiki:
7653 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner}
7653 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner}
7654
7654
7655 \end_inset
7655 \end_inset
7656
7656
7657 .
7657 .
7658 \layout Subsection
7658 \layout Subsection
7659
7659
7660 Tk issues
7660 Tk issues
7661 \layout Standard
7661 \layout Standard
7662
7662
7663 As indicated in Sec.\SpecialChar ~
7663 As indicated in Sec.\SpecialChar ~
7664
7664
7665 \begin_inset LatexCommand \ref{sec:threading-opts}
7665 \begin_inset LatexCommand \ref{sec:threading-opts}
7666
7666
7667 \end_inset
7667 \end_inset
7668
7668
7669 , a special
7669 , a special
7670 \family typewriter
7670 \family typewriter
7671 -tk
7671 -tk
7672 \family default
7672 \family default
7673 option is provided to try and allow Tk graphical applications to coexist
7673 option is provided to try and allow Tk graphical applications to coexist
7674 interactively with WX, Qt or GTK ones.
7674 interactively with WX, Qt or GTK ones.
7675 Whether this works at all, however, is very platform and configuration
7675 Whether this works at all, however, is very platform and configuration
7676 dependent.
7676 dependent.
7677 Please experiment with simple test cases before committing to using this
7677 Please experiment with simple test cases before committing to using this
7678 combination of Tk and GTK/Qt/WX threading in a production environment.
7678 combination of Tk and GTK/Qt/WX threading in a production environment.
7679 \layout Subsection
7679 \layout Subsection
7680
7680
7681 Signals and Threads
7681 Signals and Threads
7682 \layout Standard
7682 \layout Standard
7683
7683
7684 When any of the thread systems (GTK, Qt or WX) are active, either directly
7684 When any of the thread systems (GTK, Qt or WX) are active, either directly
7685 or via
7685 or via
7686 \family typewriter
7686 \family typewriter
7687 -pylab
7687 -pylab
7688 \family default
7688 \family default
7689 with a threaded backend, it is impossible to interrupt long-running Python
7689 with a threaded backend, it is impossible to interrupt long-running Python
7690 code via
7690 code via
7691 \family typewriter
7691 \family typewriter
7692 Ctrl-C
7692 Ctrl-C
7693 \family default
7693 \family default
7694 .
7694 .
7695 IPython can not pass the KeyboardInterrupt exception (or the underlying
7695 IPython can not pass the KeyboardInterrupt exception (or the underlying
7696
7696
7697 \family typewriter
7697 \family typewriter
7698 SIGINT
7698 SIGINT
7699 \family default
7699 \family default
7700 ) across threads, so any long-running process started from IPython will
7700 ) across threads, so any long-running process started from IPython will
7701 run to completion, or will have to be killed via an external (OS-based)
7701 run to completion, or will have to be killed via an external (OS-based)
7702 mechanism.
7702 mechanism.
7703 \layout Standard
7703 \layout Standard
7704
7704
7705 To the best of my knowledge, this limitation is imposed by the Python interprete
7705 To the best of my knowledge, this limitation is imposed by the Python interprete
7706 r itself, and it comes from the difficulty of writing portable signal/threaded
7706 r itself, and it comes from the difficulty of writing portable signal/threaded
7707 code.
7707 code.
7708 If any user is an expert on this topic and can suggest a better solution,
7708 If any user is an expert on this topic and can suggest a better solution,
7709 I would love to hear about it.
7709 I would love to hear about it.
7710 In the IPython sources, look at the
7710 In the IPython sources, look at the
7711 \family typewriter
7711 \family typewriter
7712 Shell.py
7712 Shell.py
7713 \family default
7713 \family default
7714 module, and in particular at the
7714 module, and in particular at the
7715 \family typewriter
7715 \family typewriter
7716 runcode()
7716 runcode()
7717 \family default
7717 \family default
7718 method.
7718 method.
7719
7719
7720 \layout Subsection
7720 \layout Subsection
7721
7721
7722 I/O pitfalls
7722 I/O pitfalls
7723 \layout Standard
7723 \layout Standard
7724
7724
7725 Be mindful that the Python interpreter switches between threads every
7725 Be mindful that the Python interpreter switches between threads every
7726 \begin_inset Formula $N$
7726 \begin_inset Formula $N$
7727 \end_inset
7727 \end_inset
7728
7728
7729 bytecodes, where the default value as of Python\SpecialChar ~
7729 bytecodes, where the default value as of Python\SpecialChar ~
7730 2.3 is
7730 2.3 is
7731 \begin_inset Formula $N=100.$
7731 \begin_inset Formula $N=100.$
7732 \end_inset
7732 \end_inset
7733
7733
7734 This value can be read by using the
7734 This value can be read by using the
7735 \family typewriter
7735 \family typewriter
7736 sys.getcheckinterval()
7736 sys.getcheckinterval()
7737 \family default
7737 \family default
7738 function, and it can be reset via
7738 function, and it can be reset via
7739 \family typewriter
7739 \family typewriter
7740 sys.setcheckinterval(
7740 sys.setcheckinterval(
7741 \emph on
7741 \emph on
7742 N
7742 N
7743 \emph default
7743 \emph default
7744 )
7744 )
7745 \family default
7745 \family default
7746 .
7746 .
7747 This switching of threads can cause subtly confusing effects if one of
7747 This switching of threads can cause subtly confusing effects if one of
7748 your threads is doing file I/O.
7748 your threads is doing file I/O.
7749 In text mode, most systems only flush file buffers when they encounter
7749 In text mode, most systems only flush file buffers when they encounter
7750 a
7750 a
7751 \family typewriter
7751 \family typewriter
7752 `
7752 `
7753 \backslash
7753 \backslash
7754 n'
7754 n'
7755 \family default
7755 \family default
7756 .
7756 .
7757 An instruction as simple as
7757 An instruction as simple as
7758 \family typewriter
7758 \family typewriter
7759
7759
7760 \newline
7760 \newline
7761 \SpecialChar ~
7761 \SpecialChar ~
7762 \SpecialChar ~
7762 \SpecialChar ~
7763 print >> filehandle,
7763 print >> filehandle,
7764 \begin_inset Quotes eld
7764 \begin_inset Quotes eld
7765 \end_inset
7765 \end_inset
7766
7766
7767 hello world
7767 hello world
7768 \begin_inset Quotes erd
7768 \begin_inset Quotes erd
7769 \end_inset
7769 \end_inset
7770
7770
7771
7771
7772 \family default
7772 \family default
7773
7773
7774 \newline
7774 \newline
7775 actually consists of several bytecodes, so it is possible that the newline
7775 actually consists of several bytecodes, so it is possible that the newline
7776 does not reach your file before the next thread switch.
7776 does not reach your file before the next thread switch.
7777 Similarly, if you are writing to a file in binary mode, the file won't
7777 Similarly, if you are writing to a file in binary mode, the file won't
7778 be flushed until the buffer fills, and your other thread may see apparently
7778 be flushed until the buffer fills, and your other thread may see apparently
7779 truncated files.
7779 truncated files.
7780
7780
7781 \layout Standard
7781 \layout Standard
7782
7782
7783 For this reason, if you are using IPython's thread support and have (for
7783 For this reason, if you are using IPython's thread support and have (for
7784 example) a GUI application which will read data generated by files written
7784 example) a GUI application which will read data generated by files written
7785 to from the IPython thread, the safest approach is to open all of your
7785 to from the IPython thread, the safest approach is to open all of your
7786 files in unbuffered mode (the third argument to the
7786 files in unbuffered mode (the third argument to the
7787 \family typewriter
7787 \family typewriter
7788 file/open
7788 file/open
7789 \family default
7789 \family default
7790 function is the buffering value):
7790 function is the buffering value):
7791 \newline
7791 \newline
7792
7792
7793 \family typewriter
7793 \family typewriter
7794 \SpecialChar ~
7794 \SpecialChar ~
7795 \SpecialChar ~
7795 \SpecialChar ~
7796 filehandle = open(filename,mode,0)
7796 filehandle = open(filename,mode,0)
7797 \layout Standard
7797 \layout Standard
7798
7798
7799 This is obviously a brute force way of avoiding race conditions with the
7799 This is obviously a brute force way of avoiding race conditions with the
7800 file buffering.
7800 file buffering.
7801 If you want to do it cleanly, and you have a resource which is being shared
7801 If you want to do it cleanly, and you have a resource which is being shared
7802 by the interactive IPython loop and your GUI thread, you should really
7802 by the interactive IPython loop and your GUI thread, you should really
7803 handle it with thread locking and syncrhonization properties.
7803 handle it with thread locking and syncrhonization properties.
7804 The Python documentation discusses these.
7804 The Python documentation discusses these.
7805 \layout Section
7805 \layout Section
7806
7806
7807
7807
7808 \begin_inset LatexCommand \label{sec:interactive-demos}
7808 \begin_inset LatexCommand \label{sec:interactive-demos}
7809
7809
7810 \end_inset
7810 \end_inset
7811
7811
7812 Interactive demos with IPython
7812 Interactive demos with IPython
7813 \layout Standard
7813 \layout Standard
7814
7814
7815 IPython ships with a basic system for running scripts interactively in sections,
7815 IPython ships with a basic system for running scripts interactively in sections,
7816 useful when presenting code to audiences.
7816 useful when presenting code to audiences.
7817 A few tags embedded in comments (so that the script remains valid Python
7817 A few tags embedded in comments (so that the script remains valid Python
7818 code) divide a file into separate blocks, and the demo can be run one block
7818 code) divide a file into separate blocks, and the demo can be run one block
7819 at a time, with IPython printing (with syntax highlighting) the block before
7819 at a time, with IPython printing (with syntax highlighting) the block before
7820 executing it, and returning to the interactive prompt after each block.
7820 executing it, and returning to the interactive prompt after each block.
7821 The interactive namespace is updated after each block is run with the contents
7821 The interactive namespace is updated after each block is run with the contents
7822 of the demo's namespace.
7822 of the demo's namespace.
7823 \layout Standard
7823 \layout Standard
7824
7824
7825 This allows you to show a piece of code, run it and then execute interactively
7825 This allows you to show a piece of code, run it and then execute interactively
7826 commands based on the variables just created.
7826 commands based on the variables just created.
7827 Once you want to continue, you simply execute the next block of the demo.
7827 Once you want to continue, you simply execute the next block of the demo.
7828 The following listing shows the markup necessary for dividing a script
7828 The following listing shows the markup necessary for dividing a script
7829 into sections for execution as a demo.
7829 into sections for execution as a demo.
7830 \layout Standard
7830 \layout Standard
7831
7831
7832
7832
7833 \begin_inset ERT
7833 \begin_inset ERT
7834 status Open
7834 status Open
7835
7835
7836 \layout Standard
7836 \layout Standard
7837
7837
7838 \backslash
7838 \backslash
7839 codelist{examples/example-demo.py}
7839 codelist{examples/example-demo.py}
7840 \end_inset
7840 \end_inset
7841
7841
7842
7842
7843 \layout Standard
7843 \layout Standard
7844
7844
7845 In order to run a file as a demo, you must first make a
7845 In order to run a file as a demo, you must first make a
7846 \family typewriter
7846 \family typewriter
7847 Demo
7847 Demo
7848 \family default
7848 \family default
7849 object out of it.
7849 object out of it.
7850 If the file is named
7850 If the file is named
7851 \family typewriter
7851 \family typewriter
7852 myscript.py
7852 myscript.py
7853 \family default
7853 \family default
7854 , the following code will make a demo:
7854 , the following code will make a demo:
7855 \layout LyX-Code
7855 \layout LyX-Code
7856
7856
7857 from IPython.demo import Demo
7857 from IPython.demo import Demo
7858 \layout LyX-Code
7858 \layout LyX-Code
7859
7859
7860 mydemo = Demo('myscript.py')
7860 mydemo = Demo('myscript.py')
7861 \layout Standard
7861 \layout Standard
7862
7862
7863 This creates the
7863 This creates the
7864 \family typewriter
7864 \family typewriter
7865 mydemo
7865 mydemo
7866 \family default
7866 \family default
7867 object, whose blocks you run one at a time by simply calling the object
7867 object, whose blocks you run one at a time by simply calling the object
7868 with no arguments.
7868 with no arguments.
7869 If you have autocall active in IPython (the default), all you need to do
7869 If you have autocall active in IPython (the default), all you need to do
7870 is type
7870 is type
7871 \layout LyX-Code
7871 \layout LyX-Code
7872
7872
7873 mydemo
7873 mydemo
7874 \layout Standard
7874 \layout Standard
7875
7875
7876 and IPython will call it, executing each block.
7876 and IPython will call it, executing each block.
7877 Demo objects can be restarted, you can move forward or back skipping blocks,
7877 Demo objects can be restarted, you can move forward or back skipping blocks,
7878 re-execute the last block, etc.
7878 re-execute the last block, etc.
7879 Simply use the Tab key on a demo object to see its methods, and call
7879 Simply use the Tab key on a demo object to see its methods, and call
7880 \family typewriter
7880 \family typewriter
7881 `?'
7881 `?'
7882 \family default
7882 \family default
7883 on them to see their docstrings for more usage details.
7883 on them to see their docstrings for more usage details.
7884 In addition, the
7884 In addition, the
7885 \family typewriter
7885 \family typewriter
7886 demo
7886 demo
7887 \family default
7887 \family default
7888 module itself contains a comprehensive docstring, which you can access
7888 module itself contains a comprehensive docstring, which you can access
7889 via
7889 via
7890 \layout LyX-Code
7890 \layout LyX-Code
7891
7891
7892 from IPython import demo
7892 from IPython import demo
7893 \layout LyX-Code
7893 \layout LyX-Code
7894
7894
7895 demo?
7895 demo?
7896 \layout Standard
7896 \layout Standard
7897
7897
7898
7898
7899 \series bold
7899 \series bold
7900 Limitations:
7900 Limitations:
7901 \series default
7901 \series default
7902 It is important to note that these demos are limited to fairly simple uses.
7902 It is important to note that these demos are limited to fairly simple uses.
7903 In particular, you can
7903 In particular, you can
7904 \emph on
7904 \emph on
7905 not
7905 not
7906 \emph default
7906 \emph default
7907 put division marks in indented code (loops, if statements, function definitions
7907 put division marks in indented code (loops, if statements, function definitions
7908 , etc.) Supporting something like this would basically require tracking the
7908 , etc.) Supporting something like this would basically require tracking the
7909 internal execution state of the Python interpreter, so only top-level divisions
7909 internal execution state of the Python interpreter, so only top-level divisions
7910 are allowed.
7910 are allowed.
7911 If you want to be able to open an IPython instance at an arbitrary point
7911 If you want to be able to open an IPython instance at an arbitrary point
7912 in a program, you can use IPython's embedding facilities, described in
7912 in a program, you can use IPython's embedding facilities, described in
7913 detail in Sec\SpecialChar \@.
7913 detail in Sec\SpecialChar \@.
7914 \SpecialChar ~
7914 \SpecialChar ~
7915
7915
7916 \begin_inset LatexCommand \ref{sec:embed}
7916 \begin_inset LatexCommand \ref{sec:embed}
7917
7917
7918 \end_inset
7918 \end_inset
7919
7919
7920 .
7920 .
7921 \layout Section
7921 \layout Section
7922
7922
7923
7923
7924 \begin_inset LatexCommand \label{sec:matplotlib-support}
7924 \begin_inset LatexCommand \label{sec:matplotlib-support}
7925
7925
7926 \end_inset
7926 \end_inset
7927
7927
7928 Plotting with
7928 Plotting with
7929 \family typewriter
7929 \family typewriter
7930 matplotlib
7930 matplotlib
7931 \family default
7931 \family default
7932
7932
7933 \layout Standard
7933 \layout Standard
7934
7934
7935 The matplotlib library (
7935 The matplotlib library (
7936 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
7936 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
7937
7937
7938 \end_inset
7938 \end_inset
7939
7939
7940 ) provides high quality 2D plotting for Python.
7940 ) provides high quality 2D plotting for Python.
7941 Matplotlib can produce plots on screen using a variety of GUI toolkits,
7941 Matplotlib can produce plots on screen using a variety of GUI toolkits,
7942 including Tk, GTK and WXPython.
7942 including Tk, GTK and WXPython.
7943 It also provides a number of commands useful for scientific computing,
7943 It also provides a number of commands useful for scientific computing,
7944 all with a syntax compatible with that of the popular Matlab program.
7944 all with a syntax compatible with that of the popular Matlab program.
7945 \layout Standard
7945 \layout Standard
7946
7946
7947 IPython accepts the special option
7947 IPython accepts the special option
7948 \family typewriter
7948 \family typewriter
7949 -pylab
7949 -pylab
7950 \family default
7950 \family default
7951 (Sec.\SpecialChar ~
7951 (Sec.\SpecialChar ~
7952
7952
7953 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
7953 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
7954
7954
7955 \end_inset
7955 \end_inset
7956
7956
7957 ).
7957 ).
7958 This configures it to support matplotlib, honoring the settings in the
7958 This configures it to support matplotlib, honoring the settings in the
7959
7959
7960 \family typewriter
7960 \family typewriter
7961 .matplotlibrc
7961 .matplotlibrc
7962 \family default
7962 \family default
7963 file.
7963 file.
7964 IPython will detect the user's choice of matplotlib GUI backend, and automatica
7964 IPython will detect the user's choice of matplotlib GUI backend, and automatica
7965 lly select the proper threading model to prevent blocking.
7965 lly select the proper threading model to prevent blocking.
7966 It also sets matplotlib in interactive mode and modifies
7966 It also sets matplotlib in interactive mode and modifies
7967 \family typewriter
7967 \family typewriter
7968 %run
7968 %run
7969 \family default
7969 \family default
7970 slightly, so that any matplotlib-based script can be executed using
7970 slightly, so that any matplotlib-based script can be executed using
7971 \family typewriter
7971 \family typewriter
7972 %run
7972 %run
7973 \family default
7973 \family default
7974 and the final
7974 and the final
7975 \family typewriter
7975 \family typewriter
7976 show()
7976 show()
7977 \family default
7977 \family default
7978 command does not block the interactive shell.
7978 command does not block the interactive shell.
7979 \layout Standard
7979 \layout Standard
7980
7980
7981 The
7981 The
7982 \family typewriter
7982 \family typewriter
7983 -pylab
7983 -pylab
7984 \family default
7984 \family default
7985 option must be given first in order for IPython to configure its threading
7985 option must be given first in order for IPython to configure its threading
7986 mode.
7986 mode.
7987 However, you can still issue other options afterwards.
7987 However, you can still issue other options afterwards.
7988 This allows you to have a matplotlib-based environment customized with
7988 This allows you to have a matplotlib-based environment customized with
7989 additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~
7989 additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~
7990
7990
7991 \begin_inset LatexCommand \ref{sec:profiles}
7991 \begin_inset LatexCommand \ref{sec:profiles}
7992
7992
7993 \end_inset
7993 \end_inset
7994
7994
7995 ): ``
7995 ): ``
7996 \family typewriter
7996 \family typewriter
7997 ipython -pylab -p myprofile
7997 ipython -pylab -p myprofile
7998 \family default
7998 \family default
7999 '' will load the profile defined in
7999 '' will load the profile defined in
8000 \family typewriter
8000 \family typewriter
8001 ipythonrc-myprofile
8001 ipythonrc-myprofile
8002 \family default
8002 \family default
8003 after configuring matplotlib.
8003 after configuring matplotlib.
8004 \layout Section
8004 \layout Section
8005
8005
8006
8006
8007 \begin_inset LatexCommand \label{sec:Gnuplot}
8007 \begin_inset LatexCommand \label{sec:Gnuplot}
8008
8008
8009 \end_inset
8009 \end_inset
8010
8010
8011 Plotting with
8011 Plotting with
8012 \family typewriter
8012 \family typewriter
8013 Gnuplot
8013 Gnuplot
8014 \layout Standard
8014 \layout Standard
8015
8015
8016 Through the magic extension system described in sec.
8016 Through the magic extension system described in sec.
8017
8017
8018 \begin_inset LatexCommand \ref{sec:magic}
8018 \begin_inset LatexCommand \ref{sec:magic}
8019
8019
8020 \end_inset
8020 \end_inset
8021
8021
8022 , IPython incorporates a mechanism for conveniently interfacing with the
8022 , IPython incorporates a mechanism for conveniently interfacing with the
8023 Gnuplot system (
8023 Gnuplot system (
8024 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
8024 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
8025
8025
8026 \end_inset
8026 \end_inset
8027
8027
8028 ).
8028 ).
8029 Gnuplot is a very complete 2D and 3D plotting package available for many
8029 Gnuplot is a very complete 2D and 3D plotting package available for many
8030 operating systems and commonly included in modern Linux distributions.
8030 operating systems and commonly included in modern Linux distributions.
8031
8031
8032 \layout Standard
8032 \layout Standard
8033
8033
8034 Besides having Gnuplot installed, this functionality requires the
8034 Besides having Gnuplot installed, this functionality requires the
8035 \family typewriter
8035 \family typewriter
8036 Gnuplot.py
8036 Gnuplot.py
8037 \family default
8037 \family default
8038 module for interfacing python with Gnuplot.
8038 module for interfacing python with Gnuplot.
8039 It can be downloaded from:
8039 It can be downloaded from:
8040 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
8040 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
8041
8041
8042 \end_inset
8042 \end_inset
8043
8043
8044 .
8044 .
8045 \layout Subsection
8045 \layout Subsection
8046
8046
8047 Proper Gnuplot configuration
8047 Proper Gnuplot configuration
8048 \layout Standard
8048 \layout Standard
8049
8049
8050 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
8050 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
8051 However, as of
8051 However, as of
8052 \family typewriter
8052 \family typewriter
8053 Gnuplot.py
8053 Gnuplot.py
8054 \family default
8054 \family default
8055 version 1.7, a new option was added to communicate between Python and Gnuplot
8055 version 1.7, a new option was added to communicate between Python and Gnuplot
8056 via FIFOs (pipes).
8056 via FIFOs (pipes).
8057 This mechanism, while fast, also breaks the mouse system.
8057 This mechanism, while fast, also breaks the mouse system.
8058 You must therefore set the variable
8058 You must therefore set the variable
8059 \family typewriter
8059 \family typewriter
8060 prefer_fifo_data
8060 prefer_fifo_data
8061 \family default
8061 \family default
8062 to
8062 to
8063 \family typewriter
8063 \family typewriter
8064 0
8064 0
8065 \family default
8065 \family default
8066 in file
8066 in file
8067 \family typewriter
8067 \family typewriter
8068 gp_unix.py
8068 gp_unix.py
8069 \family default
8069 \family default
8070 if you wish to keep the interactive mouse and keyboard features working
8070 if you wish to keep the interactive mouse and keyboard features working
8071 properly (
8071 properly (
8072 \family typewriter
8072 \family typewriter
8073 prefer_inline_data
8073 prefer_inline_data
8074 \family default
8074 \family default
8075 also must be
8075 also must be
8076 \family typewriter
8076 \family typewriter
8077 0
8077 0
8078 \family default
8078 \family default
8079 , but this is the default so unless you've changed it manually you should
8079 , but this is the default so unless you've changed it manually you should
8080 be fine).
8080 be fine).
8081 \layout Standard
8081 \layout Standard
8082
8082
8083 'Out of the box', Gnuplot is configured with a rather poor set of size,
8083 'Out of the box', Gnuplot is configured with a rather poor set of size,
8084 color and linewidth choices which make the graphs fairly hard to read on
8084 color and linewidth choices which make the graphs fairly hard to read on
8085 modern high-resolution displays (although they work fine on old 640x480
8085 modern high-resolution displays (although they work fine on old 640x480
8086 ones).
8086 ones).
8087 Below is a section of my
8087 Below is a section of my
8088 \family typewriter
8088 \family typewriter
8089 .Xdefaults
8089 .Xdefaults
8090 \family default
8090 \family default
8091 file which I use for having a more convenient Gnuplot setup.
8091 file which I use for having a more convenient Gnuplot setup.
8092 Remember to load it by running
8092 Remember to load it by running
8093 \family typewriter
8093 \family typewriter
8094 `xrdb .Xdefaults`
8094 `xrdb .Xdefaults`
8095 \family default
8095 \family default
8096 :
8096 :
8097 \layout Standard
8097 \layout Standard
8098
8098
8099
8099
8100 \family typewriter
8100 \family typewriter
8101 !******************************************************************
8101 !******************************************************************
8102 \newline
8102 \newline
8103 ! gnuplot options
8103 ! gnuplot options
8104 \newline
8104 \newline
8105 ! modify this for a convenient window size
8105 ! modify this for a convenient window size
8106 \newline
8106 \newline
8107 gnuplot*geometry: 780x580
8107 gnuplot*geometry: 780x580
8108 \layout Standard
8108 \layout Standard
8109
8109
8110
8110
8111 \family typewriter
8111 \family typewriter
8112 ! on-screen font (not for PostScript)
8112 ! on-screen font (not for PostScript)
8113 \newline
8113 \newline
8114 gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1
8114 gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1
8115 \layout Standard
8115 \layout Standard
8116
8116
8117
8117
8118 \family typewriter
8118 \family typewriter
8119 ! color options
8119 ! color options
8120 \newline
8120 \newline
8121 gnuplot*background: black
8121 gnuplot*background: black
8122 \newline
8122 \newline
8123 gnuplot*textColor: white
8123 gnuplot*textColor: white
8124 \newline
8124 \newline
8125 gnuplot*borderColor: white
8125 gnuplot*borderColor: white
8126 \newline
8126 \newline
8127 gnuplot*axisColor: white
8127 gnuplot*axisColor: white
8128 \newline
8128 \newline
8129 gnuplot*line1Color: red
8129 gnuplot*line1Color: red
8130 \newline
8130 \newline
8131 gnuplot*line2Color: green
8131 gnuplot*line2Color: green
8132 \newline
8132 \newline
8133 gnuplot*line3Color: blue
8133 gnuplot*line3Color: blue
8134 \newline
8134 \newline
8135 gnuplot*line4Color: magenta
8135 gnuplot*line4Color: magenta
8136 \newline
8136 \newline
8137 gnuplot*line5Color: cyan
8137 gnuplot*line5Color: cyan
8138 \newline
8138 \newline
8139 gnuplot*line6Color: sienna
8139 gnuplot*line6Color: sienna
8140 \newline
8140 \newline
8141 gnuplot*line7Color: orange
8141 gnuplot*line7Color: orange
8142 \newline
8142 \newline
8143 gnuplot*line8Color: coral
8143 gnuplot*line8Color: coral
8144 \layout Standard
8144 \layout Standard
8145
8145
8146
8146
8147 \family typewriter
8147 \family typewriter
8148 ! multiplicative factor for point styles
8148 ! multiplicative factor for point styles
8149 \newline
8149 \newline
8150 gnuplot*pointsize: 2
8150 gnuplot*pointsize: 2
8151 \layout Standard
8151 \layout Standard
8152
8152
8153
8153
8154 \family typewriter
8154 \family typewriter
8155 ! line width options (in pixels)
8155 ! line width options (in pixels)
8156 \newline
8156 \newline
8157 gnuplot*borderWidth: 2
8157 gnuplot*borderWidth: 2
8158 \newline
8158 \newline
8159 gnuplot*axisWidth: 2
8159 gnuplot*axisWidth: 2
8160 \newline
8160 \newline
8161 gnuplot*line1Width: 2
8161 gnuplot*line1Width: 2
8162 \newline
8162 \newline
8163 gnuplot*line2Width: 2
8163 gnuplot*line2Width: 2
8164 \newline
8164 \newline
8165 gnuplot*line3Width: 2
8165 gnuplot*line3Width: 2
8166 \newline
8166 \newline
8167 gnuplot*line4Width: 2
8167 gnuplot*line4Width: 2
8168 \newline
8168 \newline
8169 gnuplot*line5Width: 2
8169 gnuplot*line5Width: 2
8170 \newline
8170 \newline
8171 gnuplot*line6Width: 2
8171 gnuplot*line6Width: 2
8172 \newline
8172 \newline
8173 gnuplot*line7Width: 2
8173 gnuplot*line7Width: 2
8174 \newline
8174 \newline
8175 gnuplot*line8Width: 2
8175 gnuplot*line8Width: 2
8176 \layout Subsection
8176 \layout Subsection
8177
8177
8178 The
8178 The
8179 \family typewriter
8179 \family typewriter
8180 IPython.GnuplotRuntime
8180 IPython.GnuplotRuntime
8181 \family default
8181 \family default
8182 module
8182 module
8183 \layout Standard
8183 \layout Standard
8184
8184
8185 IPython includes a module called
8185 IPython includes a module called
8186 \family typewriter
8186 \family typewriter
8187 Gnuplot2.py
8187 Gnuplot2.py
8188 \family default
8188 \family default
8189 which extends and improves the default
8189 which extends and improves the default
8190 \family typewriter
8190 \family typewriter
8191 Gnuplot
8191 Gnuplot
8192 \family default
8192 \family default
8193 .
8193 .
8194 \family typewriter
8194 \family typewriter
8195 py
8195 py
8196 \family default
8196 \family default
8197 (which it still relies upon).
8197 (which it still relies upon).
8198 For example, the new
8198 For example, the new
8199 \family typewriter
8199 \family typewriter
8200 plot
8200 plot
8201 \family default
8201 \family default
8202 function adds several improvements to the original making it more convenient
8202 function adds several improvements to the original making it more convenient
8203 for interactive use, and
8203 for interactive use, and
8204 \family typewriter
8204 \family typewriter
8205 hardcopy
8205 hardcopy
8206 \family default
8206 \family default
8207 fixes a bug in the original which under some circumstances blocks the creation
8207 fixes a bug in the original which under some circumstances blocks the creation
8208 of PostScript output.
8208 of PostScript output.
8209 \layout Standard
8209 \layout Standard
8210
8210
8211 For scripting use,
8211 For scripting use,
8212 \family typewriter
8212 \family typewriter
8213 GnuplotRuntime.py
8213 GnuplotRuntime.py
8214 \family default
8214 \family default
8215 is provided, which wraps
8215 is provided, which wraps
8216 \family typewriter
8216 \family typewriter
8217 Gnuplot2.py
8217 Gnuplot2.py
8218 \family default
8218 \family default
8219 and creates a series of global aliases.
8219 and creates a series of global aliases.
8220 These make it easy to control Gnuplot plotting jobs through the Python
8220 These make it easy to control Gnuplot plotting jobs through the Python
8221 language.
8221 language.
8222 \layout Standard
8222 \layout Standard
8223
8223
8224 Below is some example code which illustrates how to configure Gnuplot inside
8224 Below is some example code which illustrates how to configure Gnuplot inside
8225 your own programs but have it available for further interactive use through
8225 your own programs but have it available for further interactive use through
8226 an embedded IPython instance.
8226 an embedded IPython instance.
8227 Simply run this file at a system prompt.
8227 Simply run this file at a system prompt.
8228 This file is provided as
8228 This file is provided as
8229 \family typewriter
8229 \family typewriter
8230 example-gnuplot.py
8230 example-gnuplot.py
8231 \family default
8231 \family default
8232 in the examples directory:
8232 in the examples directory:
8233 \layout Standard
8233 \layout Standard
8234
8234
8235
8235
8236 \begin_inset ERT
8236 \begin_inset ERT
8237 status Open
8237 status Open
8238
8238
8239 \layout Standard
8239 \layout Standard
8240
8240
8241 \backslash
8241 \backslash
8242 codelist{examples/example-gnuplot.py}
8242 codelist{examples/example-gnuplot.py}
8243 \end_inset
8243 \end_inset
8244
8244
8245
8245
8246 \layout Subsection
8246 \layout Subsection
8247
8247
8248 The
8248 The
8249 \family typewriter
8249 \family typewriter
8250 numeric
8250 numeric
8251 \family default
8251 \family default
8252 profile: a scientific computing environment
8252 profile: a scientific computing environment
8253 \layout Standard
8253 \layout Standard
8254
8254
8255 The
8255 The
8256 \family typewriter
8256 \family typewriter
8257 numeric
8257 numeric
8258 \family default
8258 \family default
8259 IPython profile, which you can activate with
8259 IPython profile, which you can activate with
8260 \family typewriter
8260 \family typewriter
8261 `ipython -p numeric
8261 `ipython -p numeric
8262 \family default
8262 \family default
8263 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
8263 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
8264 other useful things for numerical computing), contained in the
8264 other useful things for numerical computing), contained in the
8265 \family typewriter
8265 \family typewriter
8266 IPython.GnuplotInteractive
8266 IPython.GnuplotInteractive
8267 \family default
8267 \family default
8268 module.
8268 module.
8269 This will create the globals
8269 This will create the globals
8270 \family typewriter
8270 \family typewriter
8271 Gnuplot
8271 Gnuplot
8272 \family default
8272 \family default
8273 (an alias to the improved Gnuplot2 module),
8273 (an alias to the improved Gnuplot2 module),
8274 \family typewriter
8274 \family typewriter
8275 gp
8275 gp
8276 \family default
8276 \family default
8277 (a Gnuplot active instance), the new magic commands
8277 (a Gnuplot active instance), the new magic commands
8278 \family typewriter
8278 \family typewriter
8279 %gpc
8279 %gpc
8280 \family default
8280 \family default
8281 and
8281 and
8282 \family typewriter
8282 \family typewriter
8283 %gp_set_instance
8283 %gp_set_instance
8284 \family default
8284 \family default
8285 and several other convenient globals.
8285 and several other convenient globals.
8286 Type
8286 Type
8287 \family typewriter
8287 \family typewriter
8288 gphelp()
8288 gphelp()
8289 \family default
8289 \family default
8290 for further details.
8290 for further details.
8291 \layout Standard
8291 \layout Standard
8292
8292
8293 This should turn IPython into a convenient environment for numerical computing,
8293 This should turn IPython into a convenient environment for numerical computing,
8294 with all the functions in the NumPy library and the Gnuplot facilities
8294 with all the functions in the NumPy library and the Gnuplot facilities
8295 for plotting.
8295 for plotting.
8296 Further improvements can be obtained by loading the SciPy libraries for
8296 Further improvements can be obtained by loading the SciPy libraries for
8297 scientific computing, available at
8297 scientific computing, available at
8298 \begin_inset LatexCommand \htmlurl{http://scipy.org}
8298 \begin_inset LatexCommand \htmlurl{http://scipy.org}
8299
8299
8300 \end_inset
8300 \end_inset
8301
8301
8302 .
8302 .
8303 \layout Standard
8303 \layout Standard
8304
8304
8305 If you are in the middle of a working session with numerical objects and
8305 If you are in the middle of a working session with numerical objects and
8306 need to plot them but you didn't start the
8306 need to plot them but you didn't start the
8307 \family typewriter
8307 \family typewriter
8308 numeric
8308 numeric
8309 \family default
8309 \family default
8310 profile, you can load these extensions at any time by typing
8310 profile, you can load these extensions at any time by typing
8311 \newline
8311 \newline
8312
8312
8313 \family typewriter
8313 \family typewriter
8314 from IPython.GnuplotInteractive import *
8314 from IPython.GnuplotInteractive import *
8315 \newline
8315 \newline
8316
8316
8317 \family default
8317 \family default
8318 at the IPython prompt.
8318 at the IPython prompt.
8319 This will allow you to keep your objects intact and start using Gnuplot
8319 This will allow you to keep your objects intact and start using Gnuplot
8320 to view them.
8320 to view them.
8321 \layout Section
8321 \layout Section
8322
8322
8323 Reporting bugs
8323 Reporting bugs
8324 \layout Subsection*
8324 \layout Subsection*
8325
8325
8326 Automatic crash reports
8326 Automatic crash reports
8327 \layout Standard
8327 \layout Standard
8328
8328
8329 Ideally, IPython itself shouldn't crash.
8329 Ideally, IPython itself shouldn't crash.
8330 It will catch exceptions produced by you, but bugs in its internals will
8330 It will catch exceptions produced by you, but bugs in its internals will
8331 still crash it.
8331 still crash it.
8332 \layout Standard
8332 \layout Standard
8333
8333
8334 In such a situation, IPython will leave a file named
8334 In such a situation, IPython will leave a file named
8335 \family typewriter
8335 \family typewriter
8336 IPython_crash_report.txt
8336 IPython_crash_report.txt
8337 \family default
8337 \family default
8338 in your IPYTHONDIR directory (that way if crashes happen several times
8338 in your IPYTHONDIR directory (that way if crashes happen several times
8339 it won't litter many directories, the post-mortem file is always located
8339 it won't litter many directories, the post-mortem file is always located
8340 in the same place and new occurrences just overwrite the previous one).
8340 in the same place and new occurrences just overwrite the previous one).
8341 If you can mail this file to the developers (see sec.
8341 If you can mail this file to the developers (see sec.
8342
8342
8343 \begin_inset LatexCommand \ref{sec:credits}
8343 \begin_inset LatexCommand \ref{sec:credits}
8344
8344
8345 \end_inset
8345 \end_inset
8346
8346
8347 for names and addresses), it will help us
8347 for names and addresses), it will help us
8348 \emph on
8348 \emph on
8349 a lot
8349 a lot
8350 \emph default
8350 \emph default
8351 in understanding the cause of the problem and fixing it sooner.
8351 in understanding the cause of the problem and fixing it sooner.
8352 \layout Subsection*
8352 \layout Subsection*
8353
8353
8354 The bug tracker
8354 The bug tracker
8355 \layout Standard
8355 \layout Standard
8356
8356
8357 IPython also has an online bug-tracker, located at
8357 IPython also has an online bug-tracker, located at
8358 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython}
8358 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython}
8359
8359
8360 \end_inset
8360 \end_inset
8361
8361
8362 .
8362 .
8363 In addition to mailing the developers, it would be a good idea to file
8363 In addition to mailing the developers, it would be a good idea to file
8364 a bug report here.
8364 a bug report here.
8365 This will ensure that the issue is properly followed to conclusion.
8365 This will ensure that the issue is properly followed to conclusion.
8366 \layout Standard
8366 \layout Standard
8367
8367
8368 You can also use this bug tracker to file feature requests.
8368 You can also use this bug tracker to file feature requests.
8369 \layout Section
8369 \layout Section
8370
8370
8371 Brief history
8371 Brief history
8372 \layout Subsection
8372 \layout Subsection
8373
8373
8374 Origins
8374 Origins
8375 \layout Standard
8375 \layout Standard
8376
8376
8377 The current IPython system grew out of the following three projects:
8377 The current IPython system grew out of the following three projects:
8378 \layout List
8378 \layout List
8379 \labelwidthstring 00.00.0000
8379 \labelwidthstring 00.00.0000
8380
8380
8381 ipython by Fernando Pérez.
8381 ipython by Fernando Pérez.
8382 I was working on adding Mathematica-type prompts and a flexible configuration
8382 I was working on adding Mathematica-type prompts and a flexible configuration
8383 system (something better than
8383 system (something better than
8384 \family typewriter
8384 \family typewriter
8385 $PYTHONSTARTUP
8385 $PYTHONSTARTUP
8386 \family default
8386 \family default
8387 ) to the standard Python interactive interpreter.
8387 ) to the standard Python interactive interpreter.
8388 \layout List
8388 \layout List
8389 \labelwidthstring 00.00.0000
8389 \labelwidthstring 00.00.0000
8390
8390
8391 IPP by Janko Hauser.
8391 IPP by Janko Hauser.
8392 Very well organized, great usability.
8392 Very well organized, great usability.
8393 Had an old help system.
8393 Had an old help system.
8394 IPP was used as the `container' code into which I added the functionality
8394 IPP was used as the `container' code into which I added the functionality
8395 from ipython and LazyPython.
8395 from ipython and LazyPython.
8396 \layout List
8396 \layout List
8397 \labelwidthstring 00.00.0000
8397 \labelwidthstring 00.00.0000
8398
8398
8399 LazyPython by Nathan Gray.
8399 LazyPython by Nathan Gray.
8400 Simple but
8400 Simple but
8401 \emph on
8401 \emph on
8402 very
8402 very
8403 \emph default
8403 \emph default
8404 powerful.
8404 powerful.
8405 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
8405 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
8406 were all taken from here.
8406 were all taken from here.
8407 \layout Standard
8407 \layout Standard
8408
8408
8409 When I found out (see sec.
8409 When I found out (see sec.
8410
8410
8411 \begin_inset LatexCommand \ref{figgins}
8411 \begin_inset LatexCommand \ref{figgins}
8412
8412
8413 \end_inset
8413 \end_inset
8414
8414
8415 ) about IPP and LazyPython I tried to join all three into a unified system.
8415 ) about IPP and LazyPython I tried to join all three into a unified system.
8416 I thought this could provide a very nice working environment, both for
8416 I thought this could provide a very nice working environment, both for
8417 regular programming and scientific computing: shell-like features, IDL/Matlab
8417 regular programming and scientific computing: shell-like features, IDL/Matlab
8418 numerics, Mathematica-type prompt history and great object introspection
8418 numerics, Mathematica-type prompt history and great object introspection
8419 and help facilities.
8419 and help facilities.
8420 I think it worked reasonably well, though it was a lot more work than I
8420 I think it worked reasonably well, though it was a lot more work than I
8421 had initially planned.
8421 had initially planned.
8422 \layout Subsection
8422 \layout Subsection
8423
8423
8424 Current status
8424 Current status
8425 \layout Standard
8425 \layout Standard
8426
8426
8427 The above listed features work, and quite well for the most part.
8427 The above listed features work, and quite well for the most part.
8428 But until a major internal restructuring is done (see below), only bug
8428 But until a major internal restructuring is done (see below), only bug
8429 fixing will be done, no other features will be added (unless very minor
8429 fixing will be done, no other features will be added (unless very minor
8430 and well localized in the cleaner parts of the code).
8430 and well localized in the cleaner parts of the code).
8431 \layout Standard
8431 \layout Standard
8432
8432
8433 IPython consists of some 12000 lines of pure python code, of which roughly
8433 IPython consists of some 12000 lines of pure python code, of which roughly
8434 50% are fairly clean.
8434 50% are fairly clean.
8435 The other 50% are fragile, messy code which needs a massive restructuring
8435 The other 50% are fragile, messy code which needs a massive restructuring
8436 before any further major work is done.
8436 before any further major work is done.
8437 Even the messy code is fairly well documented though, and most of the problems
8437 Even the messy code is fairly well documented though, and most of the problems
8438 in the (non-existent) class design are well pointed to by a PyChecker run.
8438 in the (non-existent) class design are well pointed to by a PyChecker run.
8439 So the rewriting work isn't that bad, it will just be time-consuming.
8439 So the rewriting work isn't that bad, it will just be time-consuming.
8440 \layout Subsection
8440 \layout Subsection
8441
8441
8442 Future
8442 Future
8443 \layout Standard
8443 \layout Standard
8444
8444
8445 See the separate
8445 See the separate
8446 \family typewriter
8446 \family typewriter
8447 new_design
8447 new_design
8448 \family default
8448 \family default
8449 document for details.
8449 document for details.
8450 Ultimately, I would like to see IPython become part of the standard Python
8450 Ultimately, I would like to see IPython become part of the standard Python
8451 distribution as a `big brother with batteries' to the standard Python interacti
8451 distribution as a `big brother with batteries' to the standard Python interacti
8452 ve interpreter.
8452 ve interpreter.
8453 But that will never happen with the current state of the code, so all contribut
8453 But that will never happen with the current state of the code, so all contribut
8454 ions are welcome.
8454 ions are welcome.
8455 \layout Section
8455 \layout Section
8456
8456
8457 License
8457 License
8458 \layout Standard
8458 \layout Standard
8459
8459
8460 IPython is released under the terms of the BSD license, whose general form
8460 IPython is released under the terms of the BSD license, whose general form
8461 can be found at:
8461 can be found at:
8462 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
8462 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
8463
8463
8464 \end_inset
8464 \end_inset
8465
8465
8466 .
8466 .
8467 The full text of the IPython license is reproduced below:
8467 The full text of the IPython license is reproduced below:
8468 \layout Quote
8468 \layout Quote
8469
8469
8470
8470
8471 \family typewriter
8471 \family typewriter
8472 \size small
8472 \size small
8473 IPython is released under a BSD-type license.
8473 IPython is released under a BSD-type license.
8474 \layout Quote
8474 \layout Quote
8475
8475
8476
8476
8477 \family typewriter
8477 \family typewriter
8478 \size small
8478 \size small
8479 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
8479 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
8480 \layout Quote
8480 \layout Quote
8481
8481
8482
8482
8483 \family typewriter
8483 \family typewriter
8484 \size small
8484 \size small
8485 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
8485 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
8486 \newline
8486 \newline
8487 Nathaniel Gray <n8gray@caltech.edu>.
8487 Nathaniel Gray <n8gray@caltech.edu>.
8488 \layout Quote
8488 \layout Quote
8489
8489
8490
8490
8491 \family typewriter
8491 \family typewriter
8492 \size small
8492 \size small
8493 All rights reserved.
8493 All rights reserved.
8494 \layout Quote
8494 \layout Quote
8495
8495
8496
8496
8497 \family typewriter
8497 \family typewriter
8498 \size small
8498 \size small
8499 Redistribution and use in source and binary forms, with or without modification,
8499 Redistribution and use in source and binary forms, with or without modification,
8500 are permitted provided that the following conditions are met:
8500 are permitted provided that the following conditions are met:
8501 \layout Quote
8501 \layout Quote
8502
8502
8503
8503
8504 \family typewriter
8504 \family typewriter
8505 \size small
8505 \size small
8506 a.
8506 a.
8507 Redistributions of source code must retain the above copyright notice,
8507 Redistributions of source code must retain the above copyright notice,
8508 this list of conditions and the following disclaimer.
8508 this list of conditions and the following disclaimer.
8509 \layout Quote
8509 \layout Quote
8510
8510
8511
8511
8512 \family typewriter
8512 \family typewriter
8513 \size small
8513 \size small
8514 b.
8514 b.
8515 Redistributions in binary form must reproduce the above copyright notice,
8515 Redistributions in binary form must reproduce the above copyright notice,
8516 this list of conditions and the following disclaimer in the documentation
8516 this list of conditions and the following disclaimer in the documentation
8517 and/or other materials provided with the distribution.
8517 and/or other materials provided with the distribution.
8518 \layout Quote
8518 \layout Quote
8519
8519
8520
8520
8521 \family typewriter
8521 \family typewriter
8522 \size small
8522 \size small
8523 c.
8523 c.
8524 Neither the name of the copyright holders nor the names of any contributors
8524 Neither the name of the copyright holders nor the names of any contributors
8525 to this software may be used to endorse or promote products derived from
8525 to this software may be used to endorse or promote products derived from
8526 this software without specific prior written permission.
8526 this software without specific prior written permission.
8527 \layout Quote
8527 \layout Quote
8528
8528
8529
8529
8530 \family typewriter
8530 \family typewriter
8531 \size small
8531 \size small
8532 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
8532 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
8533 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8533 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8534 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8534 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8535 PURPOSE ARE DISCLAIMED.
8535 PURPOSE ARE DISCLAIMED.
8536 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
8536 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
8537 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
8537 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
8538 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
8538 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
8539 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8539 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8540 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8540 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8541 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8541 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8542 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8542 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8543
8543
8544 \layout Standard
8544 \layout Standard
8545
8545
8546 Individual authors are the holders of the copyright for their code and are
8546 Individual authors are the holders of the copyright for their code and are
8547 listed in each file.
8547 listed in each file.
8548 \layout Standard
8548 \layout Standard
8549
8549
8550 Some files (
8550 Some files (
8551 \family typewriter
8551 \family typewriter
8552 DPyGetOpt.py
8552 DPyGetOpt.py
8553 \family default
8553 \family default
8554 , for example) may be licensed under different conditions.
8554 , for example) may be licensed under different conditions.
8555 Ultimately each file indicates clearly the conditions under which its author/au
8555 Ultimately each file indicates clearly the conditions under which its author/au
8556 thors have decided to publish the code.
8556 thors have decided to publish the code.
8557 \layout Standard
8557 \layout Standard
8558
8558
8559 Versions of IPython up to and including 0.6.3 were released under the GNU
8559 Versions of IPython up to and including 0.6.3 were released under the GNU
8560 Lesser General Public License (LGPL), available at
8560 Lesser General Public License (LGPL), available at
8561 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
8561 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
8562
8562
8563 \end_inset
8563 \end_inset
8564
8564
8565 .
8565 .
8566 \layout Section
8566 \layout Section
8567
8567
8568
8568
8569 \begin_inset LatexCommand \label{sec:credits}
8569 \begin_inset LatexCommand \label{sec:credits}
8570
8570
8571 \end_inset
8571 \end_inset
8572
8572
8573 Credits
8573 Credits
8574 \layout Standard
8574 \layout Standard
8575
8575
8576 IPython is mainly developed by Fernando Pérez
8576 IPython is mainly developed by Fernando Pérez
8577 \family typewriter
8577 \family typewriter
8578 <fperez@colorado.edu>
8578 <fperez@colorado.edu>
8579 \family default
8579 \family default
8580 , but the project was born from mixing in Fernando's code with the IPP project
8580 , but the project was born from mixing in Fernando's code with the IPP project
8581 by Janko Hauser
8581 by Janko Hauser
8582 \family typewriter
8582 \family typewriter
8583 <jhauser-AT-zscout.de>
8583 <jhauser-AT-zscout.de>
8584 \family default
8584 \family default
8585 and LazyPython by Nathan Gray
8585 and LazyPython by Nathan Gray
8586 \family typewriter
8586 \family typewriter
8587 <n8gray-AT-caltech.edu>
8587 <n8gray-AT-caltech.edu>
8588 \family default
8588 \family default
8589 .
8589 .
8590 For all IPython-related requests, please contact Fernando.
8590 For all IPython-related requests, please contact Fernando.
8591
8591
8592 \layout Standard
8592 \layout Standard
8593
8593
8594 As of late 2005, the following developers have joined the core team:
8594 As of late 2005, the following developers have joined the core team:
8595 \layout List
8595 \layout List
8596 \labelwidthstring 00.00.0000
8596 \labelwidthstring 00.00.0000
8597
8597
8598 Robert\SpecialChar ~
8598 Robert\SpecialChar ~
8599 Kern
8599 Kern
8600 \family typewriter
8600 \family typewriter
8601 <rkern-AT-enthought.com>
8601 <rkern-AT-enthought.com>
8602 \family default
8602 \family default
8603 : co-mentored the 2005 Google Summer of Code project to develop python interacti
8603 : co-mentored the 2005 Google Summer of Code project to develop python interacti
8604 ve notebooks (XML documents) and graphical interface.
8604 ve notebooks (XML documents) and graphical interface.
8605 This project was awarded to the students Tzanko Matev
8605 This project was awarded to the students Tzanko Matev
8606 \family typewriter
8606 \family typewriter
8607 <tsanko-AT-gmail.com>
8607 <tsanko-AT-gmail.com>
8608 \family default
8608 \family default
8609 and Toni Alatalo
8609 and Toni Alatalo
8610 \family typewriter
8610 \family typewriter
8611 <antont-AT-an.org>
8611 <antont-AT-an.org>
8612 \layout List
8612 \layout List
8613 \labelwidthstring 00.00.0000
8613 \labelwidthstring 00.00.0000
8614
8614
8615 Brian\SpecialChar ~
8615 Brian\SpecialChar ~
8616 Granger
8616 Granger
8617 \family typewriter
8617 \family typewriter
8618 <bgranger-AT-scu.edu>
8618 <bgranger-AT-scu.edu>
8619 \family default
8619 \family default
8620 : extending IPython to allow support for interactive parallel computing.
8620 : extending IPython to allow support for interactive parallel computing.
8621 \layout Standard
8621 \layout Standard
8622
8622
8623 User or development help should be requested via the IPython mailing lists:
8623 User or development help should be requested via the IPython mailing lists:
8624 \layout Description
8624 \layout Description
8625
8625
8626 User\SpecialChar ~
8626 User\SpecialChar ~
8627 list:
8627 list:
8628 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
8628 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
8629
8629
8630 \end_inset
8630 \end_inset
8631
8631
8632
8632
8633 \layout Description
8633 \layout Description
8634
8634
8635 Developer's\SpecialChar ~
8635 Developer's\SpecialChar ~
8636 list:
8636 list:
8637 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
8637 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
8638
8638
8639 \end_inset
8639 \end_inset
8640
8640
8641
8641
8642 \layout Standard
8642 \layout Standard
8643
8643
8644 The IPython project is also very grateful to
8644 The IPython project is also very grateful to
8645 \begin_inset Foot
8645 \begin_inset Foot
8646 collapsed true
8646 collapsed true
8647
8647
8648 \layout Standard
8648 \layout Standard
8649
8649
8650 I've mangled email addresses to reduce spam, since the IPython manuals can
8650 I've mangled email addresses to reduce spam, since the IPython manuals can
8651 be accessed online.
8651 be accessed online.
8652 \end_inset
8652 \end_inset
8653
8653
8654 :
8654 :
8655 \layout Standard
8655 \layout Standard
8656
8656
8657 Bill Bumgarner
8657 Bill Bumgarner
8658 \family typewriter
8658 \family typewriter
8659 <bbum-AT-friday.com>
8659 <bbum-AT-friday.com>
8660 \family default
8660 \family default
8661 : for providing the DPyGetOpt module which gives very powerful and convenient
8661 : for providing the DPyGetOpt module which gives very powerful and convenient
8662 handling of command-line options (light years ahead of what Python 2.1.1's
8662 handling of command-line options (light years ahead of what Python 2.1.1's
8663 getopt module does).
8663 getopt module does).
8664 \layout Standard
8664 \layout Standard
8665
8665
8666 Ka-Ping Yee
8666 Ka-Ping Yee
8667 \family typewriter
8667 \family typewriter
8668 <ping-AT-lfw.org>
8668 <ping-AT-lfw.org>
8669 \family default
8669 \family default
8670 : for providing the Itpl module for convenient and powerful string interpolation
8670 : for providing the Itpl module for convenient and powerful string interpolation
8671 with a much nicer syntax than formatting through the '%' operator.
8671 with a much nicer syntax than formatting through the '%' operator.
8672 \layout Standard
8672 \layout Standard
8673
8673
8674 Arnd Bäcker
8674 Arnd Bäcker
8675 \family typewriter
8675 \family typewriter
8676 <baecker-AT-physik.tu-dresden.de>
8676 <baecker-AT-physik.tu-dresden.de>
8677 \family default
8677 \family default
8678 : for his many very useful suggestions and comments, and lots of help with
8678 : for his many very useful suggestions and comments, and lots of help with
8679 testing and documentation checking.
8679 testing and documentation checking.
8680 Many of IPython's newer features are a result of discussions with him (bugs
8680 Many of IPython's newer features are a result of discussions with him (bugs
8681 are still my fault, not his).
8681 are still my fault, not his).
8682 \layout Standard
8682 \layout Standard
8683
8683
8684 Obviously Guido van\SpecialChar ~
8684 Obviously Guido van\SpecialChar ~
8685 Rossum and the whole Python development team, that goes
8685 Rossum and the whole Python development team, that goes
8686 without saying.
8686 without saying.
8687 \layout Standard
8687 \layout Standard
8688
8688
8689 IPython's website is generously hosted at
8689 IPython's website is generously hosted at
8690 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
8690 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
8691
8691
8692 \end_inset
8692 \end_inset
8693
8693
8694 by Enthought (
8694 by Enthought (
8695 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
8695 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
8696
8696
8697 \end_inset
8697 \end_inset
8698
8698
8699 ).
8699 ).
8700 I am very grateful to them and all of the SciPy team for their contribution.
8700 I am very grateful to them and all of the SciPy team for their contribution.
8701 \layout Standard
8701 \layout Standard
8702
8702
8703
8703
8704 \begin_inset LatexCommand \label{figgins}
8704 \begin_inset LatexCommand \label{figgins}
8705
8705
8706 \end_inset
8706 \end_inset
8707
8707
8708 Fernando would also like to thank Stephen Figgins
8708 Fernando would also like to thank Stephen Figgins
8709 \family typewriter
8709 \family typewriter
8710 <fig-AT-monitor.net>
8710 <fig-AT-monitor.net>
8711 \family default
8711 \family default
8712 , an O'Reilly Python editor.
8712 , an O'Reilly Python editor.
8713 His Oct/11/2001 article about IPP and LazyPython, was what got this project
8713 His Oct/11/2001 article about IPP and LazyPython, was what got this project
8714 started.
8714 started.
8715 You can read it at:
8715 You can read it at:
8716 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
8716 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
8717
8717
8718 \end_inset
8718 \end_inset
8719
8719
8720 .
8720 .
8721 \layout Standard
8721 \layout Standard
8722
8722
8723 And last but not least, all the kind IPython users who have emailed new
8723 And last but not least, all the kind IPython users who have emailed new
8724 code, bug reports, fixes, comments and ideas.
8724 code, bug reports, fixes, comments and ideas.
8725 A brief list follows, please let me know if I have ommitted your name by
8725 A brief list follows, please let me know if I have ommitted your name by
8726 accident:
8726 accident:
8727 \layout List
8727 \layout List
8728 \labelwidthstring 00.00.0000
8728 \labelwidthstring 00.00.0000
8729
8729
8730 Jack\SpecialChar ~
8730 Jack\SpecialChar ~
8731 Moffit
8731 Moffit
8732 \family typewriter
8732 \family typewriter
8733 <jack-AT-xiph.org>
8733 <jack-AT-xiph.org>
8734 \family default
8734 \family default
8735 Bug fixes, including the infamous color problem.
8735 Bug fixes, including the infamous color problem.
8736 This bug alone caused many lost hours and frustration, many thanks to him
8736 This bug alone caused many lost hours and frustration, many thanks to him
8737 for the fix.
8737 for the fix.
8738 I've always been a fan of Ogg & friends, now I have one more reason to
8738 I've always been a fan of Ogg & friends, now I have one more reason to
8739 like these folks.
8739 like these folks.
8740 \newline
8740 \newline
8741 Jack is also contributing with Debian packaging and many other things.
8741 Jack is also contributing with Debian packaging and many other things.
8742 \layout List
8742 \layout List
8743 \labelwidthstring 00.00.0000
8743 \labelwidthstring 00.00.0000
8744
8744
8745 Alexander\SpecialChar ~
8745 Alexander\SpecialChar ~
8746 Schmolck
8746 Schmolck
8747 \family typewriter
8747 \family typewriter
8748 <a.schmolck-AT-gmx.net>
8748 <a.schmolck-AT-gmx.net>
8749 \family default
8749 \family default
8750 Emacs work, bug reports, bug fixes, ideas, lots more.
8750 Emacs work, bug reports, bug fixes, ideas, lots more.
8751 The ipython.el mode for (X)Emacs is Alex's code, providing full support
8751 The ipython.el mode for (X)Emacs is Alex's code, providing full support
8752 for IPython under (X)Emacs.
8752 for IPython under (X)Emacs.
8753 \layout List
8753 \layout List
8754 \labelwidthstring 00.00.0000
8754 \labelwidthstring 00.00.0000
8755
8755
8756 Andrea\SpecialChar ~
8756 Andrea\SpecialChar ~
8757 Riciputi
8757 Riciputi
8758 \family typewriter
8758 \family typewriter
8759 <andrea.riciputi-AT-libero.it>
8759 <andrea.riciputi-AT-libero.it>
8760 \family default
8760 \family default
8761 Mac OSX information, Fink package management.
8761 Mac OSX information, Fink package management.
8762 \layout List
8762 \layout List
8763 \labelwidthstring 00.00.0000
8763 \labelwidthstring 00.00.0000
8764
8764
8765 Gary\SpecialChar ~
8765 Gary\SpecialChar ~
8766 Bishop
8766 Bishop
8767 \family typewriter
8767 \family typewriter
8768 <gb-AT-cs.unc.edu>
8768 <gb-AT-cs.unc.edu>
8769 \family default
8769 \family default
8770 Bug reports, and patches to work around the exception handling idiosyncracies
8770 Bug reports, and patches to work around the exception handling idiosyncracies
8771 of WxPython.
8771 of WxPython.
8772 Readline and color support for Windows.
8772 Readline and color support for Windows.
8773 \layout List
8773 \layout List
8774 \labelwidthstring 00.00.0000
8774 \labelwidthstring 00.00.0000
8775
8775
8776 Jeffrey\SpecialChar ~
8776 Jeffrey\SpecialChar ~
8777 Collins
8777 Collins
8778 \family typewriter
8778 \family typewriter
8779 <Jeff.Collins-AT-vexcel.com>
8779 <Jeff.Collins-AT-vexcel.com>
8780 \family default
8780 \family default
8781 Bug reports.
8781 Bug reports.
8782 Much improved readline support, including fixes for Python 2.3.
8782 Much improved readline support, including fixes for Python 2.3.
8783 \layout List
8783 \layout List
8784 \labelwidthstring 00.00.0000
8784 \labelwidthstring 00.00.0000
8785
8785
8786 Dryice\SpecialChar ~
8786 Dryice\SpecialChar ~
8787 Liu
8787 Liu
8788 \family typewriter
8788 \family typewriter
8789 <dryice-AT-liu.com.cn>
8789 <dryice-AT-liu.com.cn>
8790 \family default
8790 \family default
8791 FreeBSD port.
8791 FreeBSD port.
8792 \layout List
8792 \layout List
8793 \labelwidthstring 00.00.0000
8793 \labelwidthstring 00.00.0000
8794
8794
8795 Mike\SpecialChar ~
8795 Mike\SpecialChar ~
8796 Heeter
8796 Heeter
8797 \family typewriter
8797 \family typewriter
8798 <korora-AT-SDF.LONESTAR.ORG>
8798 <korora-AT-SDF.LONESTAR.ORG>
8799 \layout List
8799 \layout List
8800 \labelwidthstring 00.00.0000
8800 \labelwidthstring 00.00.0000
8801
8801
8802 Christopher\SpecialChar ~
8802 Christopher\SpecialChar ~
8803 Hart
8803 Hart
8804 \family typewriter
8804 \family typewriter
8805 <hart-AT-caltech.edu>
8805 <hart-AT-caltech.edu>
8806 \family default
8806 \family default
8807 PDB integration.
8807 PDB integration.
8808 \layout List
8808 \layout List
8809 \labelwidthstring 00.00.0000
8809 \labelwidthstring 00.00.0000
8810
8810
8811 Milan\SpecialChar ~
8811 Milan\SpecialChar ~
8812 Zamazal
8812 Zamazal
8813 \family typewriter
8813 \family typewriter
8814 <pdm-AT-zamazal.org>
8814 <pdm-AT-zamazal.org>
8815 \family default
8815 \family default
8816 Emacs info.
8816 Emacs info.
8817 \layout List
8817 \layout List
8818 \labelwidthstring 00.00.0000
8818 \labelwidthstring 00.00.0000
8819
8819
8820 Philip\SpecialChar ~
8820 Philip\SpecialChar ~
8821 Hisley
8821 Hisley
8822 \family typewriter
8822 \family typewriter
8823 <compsys-AT-starpower.net>
8823 <compsys-AT-starpower.net>
8824 \layout List
8824 \layout List
8825 \labelwidthstring 00.00.0000
8825 \labelwidthstring 00.00.0000
8826
8826
8827 Holger\SpecialChar ~
8827 Holger\SpecialChar ~
8828 Krekel
8828 Krekel
8829 \family typewriter
8829 \family typewriter
8830 <pyth-AT-devel.trillke.net>
8830 <pyth-AT-devel.trillke.net>
8831 \family default
8831 \family default
8832 Tab completion, lots more.
8832 Tab completion, lots more.
8833 \layout List
8833 \layout List
8834 \labelwidthstring 00.00.0000
8834 \labelwidthstring 00.00.0000
8835
8835
8836 Robin\SpecialChar ~
8836 Robin\SpecialChar ~
8837 Siebler
8837 Siebler
8838 \family typewriter
8838 \family typewriter
8839 <robinsiebler-AT-starband.net>
8839 <robinsiebler-AT-starband.net>
8840 \layout List
8840 \layout List
8841 \labelwidthstring 00.00.0000
8841 \labelwidthstring 00.00.0000
8842
8842
8843 Ralf\SpecialChar ~
8843 Ralf\SpecialChar ~
8844 Ahlbrink
8844 Ahlbrink
8845 \family typewriter
8845 \family typewriter
8846 <ralf_ahlbrink-AT-web.de>
8846 <ralf_ahlbrink-AT-web.de>
8847 \layout List
8847 \layout List
8848 \labelwidthstring 00.00.0000
8848 \labelwidthstring 00.00.0000
8849
8849
8850 Thorsten\SpecialChar ~
8850 Thorsten\SpecialChar ~
8851 Kampe
8851 Kampe
8852 \family typewriter
8852 \family typewriter
8853 <thorsten-AT-thorstenkampe.de>
8853 <thorsten-AT-thorstenkampe.de>
8854 \layout List
8854 \layout List
8855 \labelwidthstring 00.00.0000
8855 \labelwidthstring 00.00.0000
8856
8856
8857 Fredrik\SpecialChar ~
8857 Fredrik\SpecialChar ~
8858 Kant
8858 Kant
8859 \family typewriter
8859 \family typewriter
8860 <fredrik.kant-AT-front.com>
8860 <fredrik.kant-AT-front.com>
8861 \family default
8861 \family default
8862 Windows setup.
8862 Windows setup.
8863 \layout List
8863 \layout List
8864 \labelwidthstring 00.00.0000
8864 \labelwidthstring 00.00.0000
8865
8865
8866 Syver\SpecialChar ~
8866 Syver\SpecialChar ~
8867 Enstad
8867 Enstad
8868 \family typewriter
8868 \family typewriter
8869 <syver-en-AT-online.no>
8869 <syver-en-AT-online.no>
8870 \family default
8870 \family default
8871 Windows setup.
8871 Windows setup.
8872 \layout List
8872 \layout List
8873 \labelwidthstring 00.00.0000
8873 \labelwidthstring 00.00.0000
8874
8874
8875 Richard
8875 Richard
8876 \family typewriter
8876 \family typewriter
8877 <rxe-AT-renre-europe.com>
8877 <rxe-AT-renre-europe.com>
8878 \family default
8878 \family default
8879 Global embedding.
8879 Global embedding.
8880 \layout List
8880 \layout List
8881 \labelwidthstring 00.00.0000
8881 \labelwidthstring 00.00.0000
8882
8882
8883 Hayden\SpecialChar ~
8883 Hayden\SpecialChar ~
8884 Callow
8884 Callow
8885 \family typewriter
8885 \family typewriter
8886 <h.callow-AT-elec.canterbury.ac.nz>
8886 <h.callow-AT-elec.canterbury.ac.nz>
8887 \family default
8887 \family default
8888 Gnuplot.py 1.6 compatibility.
8888 Gnuplot.py 1.6 compatibility.
8889 \layout List
8889 \layout List
8890 \labelwidthstring 00.00.0000
8890 \labelwidthstring 00.00.0000
8891
8891
8892 Leonardo\SpecialChar ~
8892 Leonardo\SpecialChar ~
8893 Santagada
8893 Santagada
8894 \family typewriter
8894 \family typewriter
8895 <retype-AT-terra.com.br>
8895 <retype-AT-terra.com.br>
8896 \family default
8896 \family default
8897 Fixes for Windows installation.
8897 Fixes for Windows installation.
8898 \layout List
8898 \layout List
8899 \labelwidthstring 00.00.0000
8899 \labelwidthstring 00.00.0000
8900
8900
8901 Christopher\SpecialChar ~
8901 Christopher\SpecialChar ~
8902 Armstrong
8902 Armstrong
8903 \family typewriter
8903 \family typewriter
8904 <radix-AT-twistedmatrix.com>
8904 <radix-AT-twistedmatrix.com>
8905 \family default
8905 \family default
8906 Bugfixes.
8906 Bugfixes.
8907 \layout List
8907 \layout List
8908 \labelwidthstring 00.00.0000
8908 \labelwidthstring 00.00.0000
8909
8909
8910 Francois\SpecialChar ~
8910 Francois\SpecialChar ~
8911 Pinard
8911 Pinard
8912 \family typewriter
8912 \family typewriter
8913 <pinard-AT-iro.umontreal.ca>
8913 <pinard-AT-iro.umontreal.ca>
8914 \family default
8914 \family default
8915 Code and documentation fixes.
8915 Code and documentation fixes.
8916 \layout List
8916 \layout List
8917 \labelwidthstring 00.00.0000
8917 \labelwidthstring 00.00.0000
8918
8918
8919 Cory\SpecialChar ~
8919 Cory\SpecialChar ~
8920 Dodt
8920 Dodt
8921 \family typewriter
8921 \family typewriter
8922 <cdodt-AT-fcoe.k12.ca.us>
8922 <cdodt-AT-fcoe.k12.ca.us>
8923 \family default
8923 \family default
8924 Bug reports and Windows ideas.
8924 Bug reports and Windows ideas.
8925 Patches for Windows installer.
8925 Patches for Windows installer.
8926 \layout List
8926 \layout List
8927 \labelwidthstring 00.00.0000
8927 \labelwidthstring 00.00.0000
8928
8928
8929 Olivier\SpecialChar ~
8929 Olivier\SpecialChar ~
8930 Aubert
8930 Aubert
8931 \family typewriter
8931 \family typewriter
8932 <oaubert-AT-bat710.univ-lyon1.fr>
8932 <oaubert-AT-bat710.univ-lyon1.fr>
8933 \family default
8933 \family default
8934 New magics.
8934 New magics.
8935 \layout List
8935 \layout List
8936 \labelwidthstring 00.00.0000
8936 \labelwidthstring 00.00.0000
8937
8937
8938 King\SpecialChar ~
8938 King\SpecialChar ~
8939 C.\SpecialChar ~
8939 C.\SpecialChar ~
8940 Shu
8940 Shu
8941 \family typewriter
8941 \family typewriter
8942 <kingshu-AT-myrealbox.com>
8942 <kingshu-AT-myrealbox.com>
8943 \family default
8943 \family default
8944 Autoindent patch.
8944 Autoindent patch.
8945 \layout List
8945 \layout List
8946 \labelwidthstring 00.00.0000
8946 \labelwidthstring 00.00.0000
8947
8947
8948 Chris\SpecialChar ~
8948 Chris\SpecialChar ~
8949 Drexler
8949 Drexler
8950 \family typewriter
8950 \family typewriter
8951 <chris-AT-ac-drexler.de>
8951 <chris-AT-ac-drexler.de>
8952 \family default
8952 \family default
8953 Readline packages for Win32/CygWin.
8953 Readline packages for Win32/CygWin.
8954 \layout List
8954 \layout List
8955 \labelwidthstring 00.00.0000
8955 \labelwidthstring 00.00.0000
8956
8956
8957 Gustavo\SpecialChar ~
8957 Gustavo\SpecialChar ~
8958 Córdova\SpecialChar ~
8958 Córdova\SpecialChar ~
8959 Avila
8959 Avila
8960 \family typewriter
8960 \family typewriter
8961 <gcordova-AT-sismex.com>
8961 <gcordova-AT-sismex.com>
8962 \family default
8962 \family default
8963 EvalDict code for nice, lightweight string interpolation.
8963 EvalDict code for nice, lightweight string interpolation.
8964 \layout List
8964 \layout List
8965 \labelwidthstring 00.00.0000
8965 \labelwidthstring 00.00.0000
8966
8966
8967 Kasper\SpecialChar ~
8967 Kasper\SpecialChar ~
8968 Souren
8968 Souren
8969 \family typewriter
8969 \family typewriter
8970 <Kasper.Souren-AT-ircam.fr>
8970 <Kasper.Souren-AT-ircam.fr>
8971 \family default
8971 \family default
8972 Bug reports, ideas.
8972 Bug reports, ideas.
8973 \layout List
8973 \layout List
8974 \labelwidthstring 00.00.0000
8974 \labelwidthstring 00.00.0000
8975
8975
8976 Gever\SpecialChar ~
8976 Gever\SpecialChar ~
8977 Tulley
8977 Tulley
8978 \family typewriter
8978 \family typewriter
8979 <gever-AT-helium.com>
8979 <gever-AT-helium.com>
8980 \family default
8980 \family default
8981 Code contributions.
8981 Code contributions.
8982 \layout List
8982 \layout List
8983 \labelwidthstring 00.00.0000
8983 \labelwidthstring 00.00.0000
8984
8984
8985 Ralf\SpecialChar ~
8985 Ralf\SpecialChar ~
8986 Schmitt
8986 Schmitt
8987 \family typewriter
8987 \family typewriter
8988 <ralf-AT-brainbot.com>
8988 <ralf-AT-brainbot.com>
8989 \family default
8989 \family default
8990 Bug reports & fixes.
8990 Bug reports & fixes.
8991 \layout List
8991 \layout List
8992 \labelwidthstring 00.00.0000
8992 \labelwidthstring 00.00.0000
8993
8993
8994 Oliver\SpecialChar ~
8994 Oliver\SpecialChar ~
8995 Sander
8995 Sander
8996 \family typewriter
8996 \family typewriter
8997 <osander-AT-gmx.de>
8997 <osander-AT-gmx.de>
8998 \family default
8998 \family default
8999 Bug reports.
8999 Bug reports.
9000 \layout List
9000 \layout List
9001 \labelwidthstring 00.00.0000
9001 \labelwidthstring 00.00.0000
9002
9002
9003 Rod\SpecialChar ~
9003 Rod\SpecialChar ~
9004 Holland
9004 Holland
9005 \family typewriter
9005 \family typewriter
9006 <rhh-AT-structurelabs.com>
9006 <rhh-AT-structurelabs.com>
9007 \family default
9007 \family default
9008 Bug reports and fixes to logging module.
9008 Bug reports and fixes to logging module.
9009 \layout List
9009 \layout List
9010 \labelwidthstring 00.00.0000
9010 \labelwidthstring 00.00.0000
9011
9011
9012 Daniel\SpecialChar ~
9012 Daniel\SpecialChar ~
9013 'Dang'\SpecialChar ~
9013 'Dang'\SpecialChar ~
9014 Griffith
9014 Griffith
9015 \family typewriter
9015 \family typewriter
9016 <pythondev-dang-AT-lazytwinacres.net>
9016 <pythondev-dang-AT-lazytwinacres.net>
9017 \family default
9017 \family default
9018 Fixes, enhancement suggestions for system shell use.
9018 Fixes, enhancement suggestions for system shell use.
9019 \layout List
9019 \layout List
9020 \labelwidthstring 00.00.0000
9020 \labelwidthstring 00.00.0000
9021
9021
9022 Viktor\SpecialChar ~
9022 Viktor\SpecialChar ~
9023 Ransmayr
9023 Ransmayr
9024 \family typewriter
9024 \family typewriter
9025 <viktor.ransmayr-AT-t-online.de>
9025 <viktor.ransmayr-AT-t-online.de>
9026 \family default
9026 \family default
9027 Tests and reports on Windows installation issues.
9027 Tests and reports on Windows installation issues.
9028 Contributed a true Windows binary installer.
9028 Contributed a true Windows binary installer.
9029 \layout List
9029 \layout List
9030 \labelwidthstring 00.00.0000
9030 \labelwidthstring 00.00.0000
9031
9031
9032 Mike\SpecialChar ~
9032 Mike\SpecialChar ~
9033 Salib
9033 Salib
9034 \family typewriter
9034 \family typewriter
9035 <msalib-AT-mit.edu>
9035 <msalib-AT-mit.edu>
9036 \family default
9036 \family default
9037 Help fixing a subtle bug related to traceback printing.
9037 Help fixing a subtle bug related to traceback printing.
9038 \layout List
9038 \layout List
9039 \labelwidthstring 00.00.0000
9039 \labelwidthstring 00.00.0000
9040
9040
9041 W.J.\SpecialChar ~
9041 W.J.\SpecialChar ~
9042 van\SpecialChar ~
9042 van\SpecialChar ~
9043 der\SpecialChar ~
9043 der\SpecialChar ~
9044 Laan
9044 Laan
9045 \family typewriter
9045 \family typewriter
9046 <gnufnork-AT-hetdigitalegat.nl>
9046 <gnufnork-AT-hetdigitalegat.nl>
9047 \family default
9047 \family default
9048 Bash-like prompt specials.
9048 Bash-like prompt specials.
9049 \layout List
9049 \layout List
9050 \labelwidthstring 00.00.0000
9050 \labelwidthstring 00.00.0000
9051
9051
9052 Ville\SpecialChar ~
9052 Ville\SpecialChar ~
9053 Vainio
9053 Vainio
9054 \family typewriter
9054 \family typewriter
9055 <vivainio-AT-kolumbus.fi>
9055 <vivainio-AT-kolumbus.fi>
9056 \family default
9056 \family default
9057 Bugfixes and suggestions.
9057 Bugfixes and suggestions.
9058 Excellent patches for many new features.
9058 Excellent patches for many new features.
9059 \layout List
9059 \layout List
9060 \labelwidthstring 00.00.0000
9060 \labelwidthstring 00.00.0000
9061
9061
9062 Antoon\SpecialChar ~
9062 Antoon\SpecialChar ~
9063 Pardon
9063 Pardon
9064 \family typewriter
9064 \family typewriter
9065 <Antoon.Pardon-AT-rece.vub.ac.be>
9065 <Antoon.Pardon-AT-rece.vub.ac.be>
9066 \family default
9066 \family default
9067 Critical fix for the multithreaded IPython.
9067 Critical fix for the multithreaded IPython.
9068 \layout List
9068 \layout List
9069 \labelwidthstring 00.00.0000
9069 \labelwidthstring 00.00.0000
9070
9070
9071 John\SpecialChar ~
9071 John\SpecialChar ~
9072 Hunter
9072 Hunter
9073 \family typewriter
9073 \family typewriter
9074 <jdhunter-AT-nitace.bsd.uchicago.edu>
9074 <jdhunter-AT-nitace.bsd.uchicago.edu>
9075 \family default
9075 \family default
9076 Matplotlib author, helped with all the development of support for matplotlib
9076 Matplotlib author, helped with all the development of support for matplotlib
9077 in IPyhton, including making necessary changes to matplotlib itself.
9077 in IPyhton, including making necessary changes to matplotlib itself.
9078 \layout List
9078 \layout List
9079 \labelwidthstring 00.00.0000
9079 \labelwidthstring 00.00.0000
9080
9080
9081 Matthew\SpecialChar ~
9081 Matthew\SpecialChar ~
9082 Arnison
9082 Arnison
9083 \family typewriter
9083 \family typewriter
9084 <maffew-AT-cat.org.au>
9084 <maffew-AT-cat.org.au>
9085 \family default
9085 \family default
9086 Bug reports, `
9086 Bug reports, `
9087 \family typewriter
9087 \family typewriter
9088 %run -d
9088 %run -d
9089 \family default
9089 \family default
9090 ' idea.
9090 ' idea.
9091 \layout List
9091 \layout List
9092 \labelwidthstring 00.00.0000
9092 \labelwidthstring 00.00.0000
9093
9093
9094 Prabhu\SpecialChar ~
9094 Prabhu\SpecialChar ~
9095 Ramachandran
9095 Ramachandran
9096 \family typewriter
9096 \family typewriter
9097 <prabhu_r-AT-users.sourceforge.net>
9097 <prabhu_r-AT-users.sourceforge.net>
9098 \family default
9098 \family default
9099 Help with (X)Emacs support, threading patches, ideas...
9099 Help with (X)Emacs support, threading patches, ideas...
9100 \layout List
9100 \layout List
9101 \labelwidthstring 00.00.0000
9101 \labelwidthstring 00.00.0000
9102
9102
9103 Norbert\SpecialChar ~
9103 Norbert\SpecialChar ~
9104 Tretkowski
9104 Tretkowski
9105 \family typewriter
9105 \family typewriter
9106 <tretkowski-AT-inittab.de>
9106 <tretkowski-AT-inittab.de>
9107 \family default
9107 \family default
9108 help with Debian packaging and distribution.
9108 help with Debian packaging and distribution.
9109 \layout List
9109 \layout List
9110 \labelwidthstring 00.00.0000
9110 \labelwidthstring 00.00.0000
9111
9111
9112 George\SpecialChar ~
9112 George\SpecialChar ~
9113 Sakkis <
9113 Sakkis <
9114 \family typewriter
9114 \family typewriter
9115 gsakkis-AT-eden.rutgers.edu>
9115 gsakkis-AT-eden.rutgers.edu>
9116 \family default
9116 \family default
9117 New matcher for tab-completing named arguments of user-defined functions.
9117 New matcher for tab-completing named arguments of user-defined functions.
9118 \layout List
9118 \layout List
9119 \labelwidthstring 00.00.0000
9119 \labelwidthstring 00.00.0000
9120
9120
9121 J�rgen\SpecialChar ~
9121 J�rgen\SpecialChar ~
9122 Stenarson
9122 Stenarson
9123 \family typewriter
9123 \family typewriter
9124 <jorgen.stenarson-AT-bostream.nu>
9124 <jorgen.stenarson-AT-bostream.nu>
9125 \family default
9125 \family default
9126 Wildcard support implementation for searching namespaces.
9126 Wildcard support implementation for searching namespaces.
9127 \layout List
9127 \layout List
9128 \labelwidthstring 00.00.0000
9128 \labelwidthstring 00.00.0000
9129
9129
9130 Vivian\SpecialChar ~
9130 Vivian\SpecialChar ~
9131 De\SpecialChar ~
9131 De\SpecialChar ~
9132 Smedt
9132 Smedt
9133 \family typewriter
9133 \family typewriter
9134 <vivian-AT-vdesmedt.com>
9134 <vivian-AT-vdesmedt.com>
9135 \family default
9135 \family default
9136 Debugger enhancements, so that when pdb is activated from within IPython,
9136 Debugger enhancements, so that when pdb is activated from within IPython,
9137 coloring, tab completion and other features continue to work seamlessly.
9137 coloring, tab completion and other features continue to work seamlessly.
9138 \layout List
9138 \layout List
9139 \labelwidthstring 00.00.0000
9139 \labelwidthstring 00.00.0000
9140
9140
9141 Scott\SpecialChar ~
9141 Scott\SpecialChar ~
9142 Tsai
9142 Tsai
9143 \family typewriter
9143 \family typewriter
9144 <scottt958-AT-yahoo.com.tw>
9144 <scottt958-AT-yahoo.com.tw>
9145 \family default
9145 \family default
9146 Support for automatic editor invocation on syntax errors (see
9146 Support for automatic editor invocation on syntax errors (see
9147 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython/issue36}
9147 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython/issue36}
9148
9148
9149 \end_inset
9149 \end_inset
9150
9150
9151 ).
9151 ).
9152 \layout List
9153 \labelwidthstring 00.00.0000
9154
9155 Alexander\SpecialChar ~
9156 Belchenko
9157 \family typewriter
9158 <bialix-AT-ukr.net>
9159 \family default
9160 Improvements for win32 paging system.
9152 \the_end
9161 \the_end
General Comments 0
You need to be logged in to leave comments. Login now