##// END OF EJS Templates
fix to help users with invalid $HOME under win32.
fperez -
r6:396feddb
parent child Browse files
Show More
@@ -1,1508 +1,1520 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 638 2005-07-18 03:01:41Z fperez $"""
8 $Id: genutils.py 645 2005-07-19 01:59:26Z 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 IPython import Release
17 from IPython import Release
18 __author__ = '%s <%s>' % Release.authors['Fernando']
18 __author__ = '%s <%s>' % Release.authors['Fernando']
19 __license__ = Release.license
19 __license__ = Release.license
20
20
21 #****************************************************************************
21 #****************************************************************************
22 # required modules
22 # required modules
23 import __main__
23 import __main__
24 import types,commands,time,sys,os,re,shutil
24 import types,commands,time,sys,os,re,shutil
25 import tempfile
25 import tempfile
26 import codecs
26 import codecs
27 from IPython.Itpl import Itpl,itpl,printpl
27 from IPython.Itpl import Itpl,itpl,printpl
28 from IPython import DPyGetOpt
28 from IPython import DPyGetOpt
29
29
30 # Build objects which appeared in Python 2.3 for 2.2, to make ipython
30 # Build objects which appeared in Python 2.3 for 2.2, to make ipython
31 # 2.2-friendly
31 # 2.2-friendly
32 try:
32 try:
33 basestring
33 basestring
34 except NameError:
34 except NameError:
35 import types
35 import types
36 basestring = (types.StringType, types.UnicodeType)
36 basestring = (types.StringType, types.UnicodeType)
37 True = 1==1
37 True = 1==1
38 False = 1==0
38 False = 1==0
39
39
40 def enumerate(obj):
40 def enumerate(obj):
41 i = -1
41 i = -1
42 for item in obj:
42 for item in obj:
43 i += 1
43 i += 1
44 yield i, item
44 yield i, item
45
45
46 # add these to the builtin namespace, so that all modules find them
46 # add these to the builtin namespace, so that all modules find them
47 import __builtin__
47 import __builtin__
48 __builtin__.basestring = basestring
48 __builtin__.basestring = basestring
49 __builtin__.True = True
49 __builtin__.True = True
50 __builtin__.False = False
50 __builtin__.False = False
51 __builtin__.enumerate = enumerate
51 __builtin__.enumerate = enumerate
52
52
53 #****************************************************************************
53 #****************************************************************************
54 # Exceptions
54 # Exceptions
55 class Error(Exception):
55 class Error(Exception):
56 """Base class for exceptions in this module."""
56 """Base class for exceptions in this module."""
57 pass
57 pass
58
58
59 #----------------------------------------------------------------------------
59 #----------------------------------------------------------------------------
60 class IOStream:
60 class IOStream:
61 def __init__(self,stream,fallback):
61 def __init__(self,stream,fallback):
62 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
62 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
63 stream = fallback
63 stream = fallback
64 self.stream = stream
64 self.stream = stream
65 self._swrite = stream.write
65 self._swrite = stream.write
66 self.flush = stream.flush
66 self.flush = stream.flush
67
67
68 def write(self,data):
68 def write(self,data):
69 try:
69 try:
70 self._swrite(data)
70 self._swrite(data)
71 except:
71 except:
72 try:
72 try:
73 # print handles some unicode issues which may trip a plain
73 # print handles some unicode issues which may trip a plain
74 # write() call. Attempt to emulate write() by using a
74 # write() call. Attempt to emulate write() by using a
75 # trailing comma
75 # trailing comma
76 print >> self.stream, data,
76 print >> self.stream, data,
77 except:
77 except:
78 # if we get here, something is seriously broken.
78 # if we get here, something is seriously broken.
79 print >> sys.stderr, \
79 print >> sys.stderr, \
80 'ERROR - failed to write data to stream:', stream
80 'ERROR - failed to write data to stream:', stream
81
81
82 class IOTerm:
82 class IOTerm:
83 """ Term holds the file or file-like objects for handling I/O operations.
83 """ Term holds the file or file-like objects for handling I/O operations.
84
84
85 These are normally just sys.stdin, sys.stdout and sys.stderr but for
85 These are normally just sys.stdin, sys.stdout and sys.stderr but for
86 Windows they can can replaced to allow editing the strings before they are
86 Windows they can can replaced to allow editing the strings before they are
87 displayed."""
87 displayed."""
88
88
89 # In the future, having IPython channel all its I/O operations through
89 # In the future, having IPython channel all its I/O operations through
90 # this class will make it easier to embed it into other environments which
90 # this class will make it easier to embed it into other environments which
91 # are not a normal terminal (such as a GUI-based shell)
91 # are not a normal terminal (such as a GUI-based shell)
92 def __init__(self,cin=None,cout=None,cerr=None):
92 def __init__(self,cin=None,cout=None,cerr=None):
93 self.cin = IOStream(cin,sys.stdin)
93 self.cin = IOStream(cin,sys.stdin)
94 self.cout = IOStream(cout,sys.stdout)
94 self.cout = IOStream(cout,sys.stdout)
95 self.cerr = IOStream(cerr,sys.stderr)
95 self.cerr = IOStream(cerr,sys.stderr)
96
96
97 # Global variable to be used for all I/O
97 # Global variable to be used for all I/O
98 Term = IOTerm()
98 Term = IOTerm()
99
99
100 # Windows-specific code to load Gary Bishop's readline and configure it
100 # Windows-specific code to load Gary Bishop's readline and configure it
101 # automatically for the users
101 # automatically for the users
102 # Note: os.name on cygwin returns posix, so this should only pick up 'native'
102 # Note: os.name on cygwin returns posix, so this should only pick up 'native'
103 # windows. Cygwin returns 'cygwin' for sys.platform.
103 # windows. Cygwin returns 'cygwin' for sys.platform.
104 if os.name == 'nt':
104 if os.name == 'nt':
105 try:
105 try:
106 import readline
106 import readline
107 except ImportError:
107 except ImportError:
108 pass
108 pass
109 else:
109 else:
110 try:
110 try:
111 _out = readline.GetOutputFile()
111 _out = readline.GetOutputFile()
112 except AttributeError:
112 except AttributeError:
113 pass
113 pass
114 else:
114 else:
115 # Remake Term to use the readline i/o facilities
115 # Remake Term to use the readline i/o facilities
116 Term = IOTerm(cout=_out,cerr=_out)
116 Term = IOTerm(cout=_out,cerr=_out)
117 del _out
117 del _out
118
118
119 #****************************************************************************
119 #****************************************************************************
120 # Generic warning/error printer, used by everything else
120 # Generic warning/error printer, used by everything else
121 def warn(msg,level=2,exit_val=1):
121 def warn(msg,level=2,exit_val=1):
122 """Standard warning printer. Gives formatting consistency.
122 """Standard warning printer. Gives formatting consistency.
123
123
124 Output is sent to Term.cerr (sys.stderr by default).
124 Output is sent to Term.cerr (sys.stderr by default).
125
125
126 Options:
126 Options:
127
127
128 -level(2): allows finer control:
128 -level(2): allows finer control:
129 0 -> Do nothing, dummy function.
129 0 -> Do nothing, dummy function.
130 1 -> Print message.
130 1 -> Print message.
131 2 -> Print 'WARNING:' + message. (Default level).
131 2 -> Print 'WARNING:' + message. (Default level).
132 3 -> Print 'ERROR:' + message.
132 3 -> Print 'ERROR:' + message.
133 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
133 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
134
134
135 -exit_val (1): exit value returned by sys.exit() for a level 4
135 -exit_val (1): exit value returned by sys.exit() for a level 4
136 warning. Ignored for all other levels."""
136 warning. Ignored for all other levels."""
137
137
138 if level>0:
138 if level>0:
139 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
139 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
140 print >> Term.cerr, '%s%s' % (header[level],msg)
140 print >> Term.cerr, '%s%s' % (header[level],msg)
141 if level == 4:
141 if level == 4:
142 print >> Term.cerr,'Exiting.\n'
142 print >> Term.cerr,'Exiting.\n'
143 sys.exit(exit_val)
143 sys.exit(exit_val)
144
144
145 def info(msg):
145 def info(msg):
146 """Equivalent to warn(msg,level=1)."""
146 """Equivalent to warn(msg,level=1)."""
147
147
148 warn(msg,level=1)
148 warn(msg,level=1)
149
149
150 def error(msg):
150 def error(msg):
151 """Equivalent to warn(msg,level=3)."""
151 """Equivalent to warn(msg,level=3)."""
152
152
153 warn(msg,level=3)
153 warn(msg,level=3)
154
154
155 def fatal(msg,exit_val=1):
155 def fatal(msg,exit_val=1):
156 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
156 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
157
157
158 warn(msg,exit_val=exit_val,level=4)
158 warn(msg,exit_val=exit_val,level=4)
159
159
160 #----------------------------------------------------------------------------
160 #----------------------------------------------------------------------------
161 StringTypes = types.StringTypes
161 StringTypes = types.StringTypes
162
162
163 # Basic timing functionality
163 # Basic timing functionality
164
164
165 # If possible (Unix), use the resource module instead of time.clock()
165 # If possible (Unix), use the resource module instead of time.clock()
166 try:
166 try:
167 import resource
167 import resource
168 def clock():
168 def clock():
169 """clock() -> floating point number
169 """clock() -> floating point number
170
170
171 Return the CPU time in seconds (user time only, system time is
171 Return the CPU time in seconds (user time only, system time is
172 ignored) since the start of the process. This is done via a call to
172 ignored) since the start of the process. This is done via a call to
173 resource.getrusage, so it avoids the wraparound problems in
173 resource.getrusage, so it avoids the wraparound problems in
174 time.clock()."""
174 time.clock()."""
175
175
176 return resource.getrusage(resource.RUSAGE_SELF)[0]
176 return resource.getrusage(resource.RUSAGE_SELF)[0]
177
177
178 def clock2():
178 def clock2():
179 """clock2() -> (t_user,t_system)
179 """clock2() -> (t_user,t_system)
180
180
181 Similar to clock(), but return a tuple of user/system times."""
181 Similar to clock(), but return a tuple of user/system times."""
182 return resource.getrusage(resource.RUSAGE_SELF)[:2]
182 return resource.getrusage(resource.RUSAGE_SELF)[:2]
183
183
184 except ImportError:
184 except ImportError:
185 clock = time.clock
185 clock = time.clock
186 def clock2():
186 def clock2():
187 """Under windows, system CPU time can't be measured.
187 """Under windows, system CPU time can't be measured.
188
188
189 This just returns clock() and zero."""
189 This just returns clock() and zero."""
190 return time.clock(),0.0
190 return time.clock(),0.0
191
191
192 def timings_out(reps,func,*args,**kw):
192 def timings_out(reps,func,*args,**kw):
193 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
193 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
194
194
195 Execute a function reps times, return a tuple with the elapsed total
195 Execute a function reps times, return a tuple with the elapsed total
196 CPU time in seconds, the time per call and the function's output.
196 CPU time in seconds, the time per call and the function's output.
197
197
198 Under Unix, the return value is the sum of user+system time consumed by
198 Under Unix, the return value is the sum of user+system time consumed by
199 the process, computed via the resource module. This prevents problems
199 the process, computed via the resource module. This prevents problems
200 related to the wraparound effect which the time.clock() function has.
200 related to the wraparound effect which the time.clock() function has.
201
201
202 Under Windows the return value is in wall clock seconds. See the
202 Under Windows the return value is in wall clock seconds. See the
203 documentation for the time module for more details."""
203 documentation for the time module for more details."""
204
204
205 reps = int(reps)
205 reps = int(reps)
206 assert reps >=1, 'reps must be >= 1'
206 assert reps >=1, 'reps must be >= 1'
207 if reps==1:
207 if reps==1:
208 start = clock()
208 start = clock()
209 out = func(*args,**kw)
209 out = func(*args,**kw)
210 tot_time = clock()-start
210 tot_time = clock()-start
211 else:
211 else:
212 rng = xrange(reps-1) # the last time is executed separately to store output
212 rng = xrange(reps-1) # the last time is executed separately to store output
213 start = clock()
213 start = clock()
214 for dummy in rng: func(*args,**kw)
214 for dummy in rng: func(*args,**kw)
215 out = func(*args,**kw) # one last time
215 out = func(*args,**kw) # one last time
216 tot_time = clock()-start
216 tot_time = clock()-start
217 av_time = tot_time / reps
217 av_time = tot_time / reps
218 return tot_time,av_time,out
218 return tot_time,av_time,out
219
219
220 def timings(reps,func,*args,**kw):
220 def timings(reps,func,*args,**kw):
221 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
221 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
222
222
223 Execute a function reps times, return a tuple with the elapsed total CPU
223 Execute a function reps times, return a tuple with the elapsed total CPU
224 time in seconds and the time per call. These are just the first two values
224 time in seconds and the time per call. These are just the first two values
225 in timings_out()."""
225 in timings_out()."""
226
226
227 return timings_out(reps,func,*args,**kw)[0:2]
227 return timings_out(reps,func,*args,**kw)[0:2]
228
228
229 def timing(func,*args,**kw):
229 def timing(func,*args,**kw):
230 """timing(func,*args,**kw) -> t_total
230 """timing(func,*args,**kw) -> t_total
231
231
232 Execute a function once, return the elapsed total CPU time in
232 Execute a function once, return the elapsed total CPU time in
233 seconds. This is just the first value in timings_out()."""
233 seconds. This is just the first value in timings_out()."""
234
234
235 return timings_out(1,func,*args,**kw)[0]
235 return timings_out(1,func,*args,**kw)[0]
236
236
237 #****************************************************************************
237 #****************************************************************************
238 # file and system
238 # file and system
239
239
240 def system(cmd,verbose=0,debug=0,header=''):
240 def system(cmd,verbose=0,debug=0,header=''):
241 """Execute a system command, return its exit status.
241 """Execute a system command, return its exit status.
242
242
243 Options:
243 Options:
244
244
245 - verbose (0): print the command to be executed.
245 - verbose (0): print the command to be executed.
246
246
247 - debug (0): only print, do not actually execute.
247 - debug (0): only print, do not actually execute.
248
248
249 - header (''): Header to print on screen prior to the executed command (it
249 - header (''): Header to print on screen prior to the executed command (it
250 is only prepended to the command, no newlines are added).
250 is only prepended to the command, no newlines are added).
251
251
252 Note: a stateful version of this function is available through the
252 Note: a stateful version of this function is available through the
253 SystemExec class."""
253 SystemExec class."""
254
254
255 stat = 0
255 stat = 0
256 if verbose or debug: print header+cmd
256 if verbose or debug: print header+cmd
257 sys.stdout.flush()
257 sys.stdout.flush()
258 if not debug: stat = os.system(cmd)
258 if not debug: stat = os.system(cmd)
259 return stat
259 return stat
260
260
261 def shell(cmd,verbose=0,debug=0,header=''):
261 def shell(cmd,verbose=0,debug=0,header=''):
262 """Execute a command in the system shell, always return None.
262 """Execute a command in the system shell, always return None.
263
263
264 Options:
264 Options:
265
265
266 - verbose (0): print the command to be executed.
266 - verbose (0): print the command to be executed.
267
267
268 - debug (0): only print, do not actually execute.
268 - debug (0): only print, do not actually execute.
269
269
270 - header (''): Header to print on screen prior to the executed command (it
270 - header (''): Header to print on screen prior to the executed command (it
271 is only prepended to the command, no newlines are added).
271 is only prepended to the command, no newlines are added).
272
272
273 Note: this is similar to genutils.system(), but it returns None so it can
273 Note: this is similar to genutils.system(), but it returns None so it can
274 be conveniently used in interactive loops without getting the return value
274 be conveniently used in interactive loops without getting the return value
275 (typically 0) printed many times."""
275 (typically 0) printed many times."""
276
276
277 stat = 0
277 stat = 0
278 if verbose or debug: print header+cmd
278 if verbose or debug: print header+cmd
279 # flush stdout so we don't mangle python's buffering
279 # flush stdout so we don't mangle python's buffering
280 sys.stdout.flush()
280 sys.stdout.flush()
281 if not debug:
281 if not debug:
282 os.system(cmd)
282 os.system(cmd)
283
283
284 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
284 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
285 """Dummy substitute for perl's backquotes.
285 """Dummy substitute for perl's backquotes.
286
286
287 Executes a command and returns the output.
287 Executes a command and returns the output.
288
288
289 Accepts the same arguments as system(), plus:
289 Accepts the same arguments as system(), plus:
290
290
291 - split(0): if true, the output is returned as a list split on newlines.
291 - split(0): if true, the output is returned as a list split on newlines.
292
292
293 Note: a stateful version of this function is available through the
293 Note: a stateful version of this function is available through the
294 SystemExec class."""
294 SystemExec class."""
295
295
296 if verbose or debug: print header+cmd
296 if verbose or debug: print header+cmd
297 if not debug:
297 if not debug:
298 output = commands.getoutput(cmd)
298 output = commands.getoutput(cmd)
299 if split:
299 if split:
300 return output.split('\n')
300 return output.split('\n')
301 else:
301 else:
302 return output
302 return output
303
303
304 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
304 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
305 """Return (standard output,standard error) of executing cmd in a shell.
305 """Return (standard output,standard error) of executing cmd in a shell.
306
306
307 Accepts the same arguments as system(), plus:
307 Accepts the same arguments as system(), plus:
308
308
309 - split(0): if true, each of stdout/err is returned as a list split on
309 - split(0): if true, each of stdout/err is returned as a list split on
310 newlines.
310 newlines.
311
311
312 Note: a stateful version of this function is available through the
312 Note: a stateful version of this function is available through the
313 SystemExec class."""
313 SystemExec class."""
314
314
315 if verbose or debug: print header+cmd
315 if verbose or debug: print header+cmd
316 if not cmd:
316 if not cmd:
317 if split:
317 if split:
318 return [],[]
318 return [],[]
319 else:
319 else:
320 return '',''
320 return '',''
321 if not debug:
321 if not debug:
322 pin,pout,perr = os.popen3(cmd)
322 pin,pout,perr = os.popen3(cmd)
323 tout = pout.read().rstrip()
323 tout = pout.read().rstrip()
324 terr = perr.read().rstrip()
324 terr = perr.read().rstrip()
325 pin.close()
325 pin.close()
326 pout.close()
326 pout.close()
327 perr.close()
327 perr.close()
328 if split:
328 if split:
329 return tout.split('\n'),terr.split('\n')
329 return tout.split('\n'),terr.split('\n')
330 else:
330 else:
331 return tout,terr
331 return tout,terr
332
332
333 # for compatibility with older naming conventions
333 # for compatibility with older naming conventions
334 xsys = system
334 xsys = system
335 bq = getoutput
335 bq = getoutput
336
336
337 class SystemExec:
337 class SystemExec:
338 """Access the system and getoutput functions through a stateful interface.
338 """Access the system and getoutput functions through a stateful interface.
339
339
340 Note: here we refer to the system and getoutput functions from this
340 Note: here we refer to the system and getoutput functions from this
341 library, not the ones from the standard python library.
341 library, not the ones from the standard python library.
342
342
343 This class offers the system and getoutput functions as methods, but the
343 This class offers the system and getoutput functions as methods, but the
344 verbose, debug and header parameters can be set for the instance (at
344 verbose, debug and header parameters can be set for the instance (at
345 creation time or later) so that they don't need to be specified on each
345 creation time or later) so that they don't need to be specified on each
346 call.
346 call.
347
347
348 For efficiency reasons, there's no way to override the parameters on a
348 For efficiency reasons, there's no way to override the parameters on a
349 per-call basis other than by setting instance attributes. If you need
349 per-call basis other than by setting instance attributes. If you need
350 local overrides, it's best to directly call system() or getoutput().
350 local overrides, it's best to directly call system() or getoutput().
351
351
352 The following names are provided as alternate options:
352 The following names are provided as alternate options:
353 - xsys: alias to system
353 - xsys: alias to system
354 - bq: alias to getoutput
354 - bq: alias to getoutput
355
355
356 An instance can then be created as:
356 An instance can then be created as:
357 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
357 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
358
358
359 And used as:
359 And used as:
360 >>> sysexec.xsys('pwd')
360 >>> sysexec.xsys('pwd')
361 >>> dirlist = sysexec.bq('ls -l')
361 >>> dirlist = sysexec.bq('ls -l')
362 """
362 """
363
363
364 def __init__(self,verbose=0,debug=0,header='',split=0):
364 def __init__(self,verbose=0,debug=0,header='',split=0):
365 """Specify the instance's values for verbose, debug and header."""
365 """Specify the instance's values for verbose, debug and header."""
366 setattr_list(self,'verbose debug header split')
366 setattr_list(self,'verbose debug header split')
367
367
368 def system(self,cmd):
368 def system(self,cmd):
369 """Stateful interface to system(), with the same keyword parameters."""
369 """Stateful interface to system(), with the same keyword parameters."""
370
370
371 system(cmd,self.verbose,self.debug,self.header)
371 system(cmd,self.verbose,self.debug,self.header)
372
372
373 def shell(self,cmd):
373 def shell(self,cmd):
374 """Stateful interface to shell(), with the same keyword parameters."""
374 """Stateful interface to shell(), with the same keyword parameters."""
375
375
376 shell(cmd,self.verbose,self.debug,self.header)
376 shell(cmd,self.verbose,self.debug,self.header)
377
377
378 xsys = system # alias
378 xsys = system # alias
379
379
380 def getoutput(self,cmd):
380 def getoutput(self,cmd):
381 """Stateful interface to getoutput()."""
381 """Stateful interface to getoutput()."""
382
382
383 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
383 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
384
384
385 def getoutputerror(self,cmd):
385 def getoutputerror(self,cmd):
386 """Stateful interface to getoutputerror()."""
386 """Stateful interface to getoutputerror()."""
387
387
388 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
388 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
389
389
390 bq = getoutput # alias
390 bq = getoutput # alias
391
391
392 #-----------------------------------------------------------------------------
392 #-----------------------------------------------------------------------------
393 def mutex_opts(dict,ex_op):
393 def mutex_opts(dict,ex_op):
394 """Check for presence of mutually exclusive keys in a dict.
394 """Check for presence of mutually exclusive keys in a dict.
395
395
396 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
396 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
397 for op1,op2 in ex_op:
397 for op1,op2 in ex_op:
398 if op1 in dict and op2 in dict:
398 if op1 in dict and op2 in dict:
399 raise ValueError,'\n*** ERROR in Arguments *** '\
399 raise ValueError,'\n*** ERROR in Arguments *** '\
400 'Options '+op1+' and '+op2+' are mutually exclusive.'
400 'Options '+op1+' and '+op2+' are mutually exclusive.'
401
401
402 #-----------------------------------------------------------------------------
402 #-----------------------------------------------------------------------------
403 def filefind(fname,alt_dirs = None):
403 def filefind(fname,alt_dirs = None):
404 """Return the given filename either in the current directory, if it
404 """Return the given filename either in the current directory, if it
405 exists, or in a specified list of directories.
405 exists, or in a specified list of directories.
406
406
407 ~ expansion is done on all file and directory names.
407 ~ expansion is done on all file and directory names.
408
408
409 Upon an unsuccessful search, raise an IOError exception."""
409 Upon an unsuccessful search, raise an IOError exception."""
410
410
411 if alt_dirs is None:
411 if alt_dirs is None:
412 try:
412 try:
413 alt_dirs = get_home_dir()
413 alt_dirs = get_home_dir()
414 except HomeDirError:
414 except HomeDirError:
415 alt_dirs = os.getcwd()
415 alt_dirs = os.getcwd()
416 search = [fname] + list_strings(alt_dirs)
416 search = [fname] + list_strings(alt_dirs)
417 search = map(os.path.expanduser,search)
417 search = map(os.path.expanduser,search)
418 #print 'search list for',fname,'list:',search # dbg
418 #print 'search list for',fname,'list:',search # dbg
419 fname = search[0]
419 fname = search[0]
420 if os.path.isfile(fname):
420 if os.path.isfile(fname):
421 return fname
421 return fname
422 for direc in search[1:]:
422 for direc in search[1:]:
423 testname = os.path.join(direc,fname)
423 testname = os.path.join(direc,fname)
424 #print 'testname',testname # dbg
424 #print 'testname',testname # dbg
425 if os.path.isfile(testname):
425 if os.path.isfile(testname):
426 return testname
426 return testname
427 raise IOError,'File' + `fname` + \
427 raise IOError,'File' + `fname` + \
428 ' not found in current or supplied directories:' + `alt_dirs`
428 ' not found in current or supplied directories:' + `alt_dirs`
429
429
430 #----------------------------------------------------------------------------
430 #----------------------------------------------------------------------------
431 def target_outdated(target,deps):
431 def target_outdated(target,deps):
432 """Determine whether a target is out of date.
432 """Determine whether a target is out of date.
433
433
434 target_outdated(target,deps) -> 1/0
434 target_outdated(target,deps) -> 1/0
435
435
436 deps: list of filenames which MUST exist.
436 deps: list of filenames which MUST exist.
437 target: single filename which may or may not exist.
437 target: single filename which may or may not exist.
438
438
439 If target doesn't exist or is older than any file listed in deps, return
439 If target doesn't exist or is older than any file listed in deps, return
440 true, otherwise return false.
440 true, otherwise return false.
441 """
441 """
442 try:
442 try:
443 target_time = os.path.getmtime(target)
443 target_time = os.path.getmtime(target)
444 except os.error:
444 except os.error:
445 return 1
445 return 1
446 for dep in deps:
446 for dep in deps:
447 dep_time = os.path.getmtime(dep)
447 dep_time = os.path.getmtime(dep)
448 if dep_time > target_time:
448 if dep_time > target_time:
449 #print "For target",target,"Dep failed:",dep # dbg
449 #print "For target",target,"Dep failed:",dep # dbg
450 #print "times (dep,tar):",dep_time,target_time # dbg
450 #print "times (dep,tar):",dep_time,target_time # dbg
451 return 1
451 return 1
452 return 0
452 return 0
453
453
454 #-----------------------------------------------------------------------------
454 #-----------------------------------------------------------------------------
455 def target_update(target,deps,cmd):
455 def target_update(target,deps,cmd):
456 """Update a target with a given command given a list of dependencies.
456 """Update a target with a given command given a list of dependencies.
457
457
458 target_update(target,deps,cmd) -> runs cmd if target is outdated.
458 target_update(target,deps,cmd) -> runs cmd if target is outdated.
459
459
460 This is just a wrapper around target_outdated() which calls the given
460 This is just a wrapper around target_outdated() which calls the given
461 command if target is outdated."""
461 command if target is outdated."""
462
462
463 if target_outdated(target,deps):
463 if target_outdated(target,deps):
464 xsys(cmd)
464 xsys(cmd)
465
465
466 #----------------------------------------------------------------------------
466 #----------------------------------------------------------------------------
467 def unquote_ends(istr):
467 def unquote_ends(istr):
468 """Remove a single pair of quotes from the endpoints of a string."""
468 """Remove a single pair of quotes from the endpoints of a string."""
469
469
470 if not istr:
470 if not istr:
471 return istr
471 return istr
472 if (istr[0]=="'" and istr[-1]=="'") or \
472 if (istr[0]=="'" and istr[-1]=="'") or \
473 (istr[0]=='"' and istr[-1]=='"'):
473 (istr[0]=='"' and istr[-1]=='"'):
474 return istr[1:-1]
474 return istr[1:-1]
475 else:
475 else:
476 return istr
476 return istr
477
477
478 #----------------------------------------------------------------------------
478 #----------------------------------------------------------------------------
479 def process_cmdline(argv,names=[],defaults={},usage=''):
479 def process_cmdline(argv,names=[],defaults={},usage=''):
480 """ Process command-line options and arguments.
480 """ Process command-line options and arguments.
481
481
482 Arguments:
482 Arguments:
483
483
484 - argv: list of arguments, typically sys.argv.
484 - argv: list of arguments, typically sys.argv.
485
485
486 - names: list of option names. See DPyGetOpt docs for details on options
486 - names: list of option names. See DPyGetOpt docs for details on options
487 syntax.
487 syntax.
488
488
489 - defaults: dict of default values.
489 - defaults: dict of default values.
490
490
491 - usage: optional usage notice to print if a wrong argument is passed.
491 - usage: optional usage notice to print if a wrong argument is passed.
492
492
493 Return a dict of options and a list of free arguments."""
493 Return a dict of options and a list of free arguments."""
494
494
495 getopt = DPyGetOpt.DPyGetOpt()
495 getopt = DPyGetOpt.DPyGetOpt()
496 getopt.setIgnoreCase(0)
496 getopt.setIgnoreCase(0)
497 getopt.parseConfiguration(names)
497 getopt.parseConfiguration(names)
498
498
499 try:
499 try:
500 getopt.processArguments(argv)
500 getopt.processArguments(argv)
501 except:
501 except:
502 print usage
502 print usage
503 warn(`sys.exc_value`,level=4)
503 warn(`sys.exc_value`,level=4)
504
504
505 defaults.update(getopt.optionValues)
505 defaults.update(getopt.optionValues)
506 args = getopt.freeValues
506 args = getopt.freeValues
507
507
508 return defaults,args
508 return defaults,args
509
509
510 #----------------------------------------------------------------------------
510 #----------------------------------------------------------------------------
511 def optstr2types(ostr):
511 def optstr2types(ostr):
512 """Convert a string of option names to a dict of type mappings.
512 """Convert a string of option names to a dict of type mappings.
513
513
514 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
514 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
515
515
516 This is used to get the types of all the options in a string formatted
516 This is used to get the types of all the options in a string formatted
517 with the conventions of DPyGetOpt. The 'type' None is used for options
517 with the conventions of DPyGetOpt. The 'type' None is used for options
518 which are strings (they need no further conversion). This function's main
518 which are strings (they need no further conversion). This function's main
519 use is to get a typemap for use with read_dict().
519 use is to get a typemap for use with read_dict().
520 """
520 """
521
521
522 typeconv = {None:'',int:'',float:''}
522 typeconv = {None:'',int:'',float:''}
523 typemap = {'s':None,'i':int,'f':float}
523 typemap = {'s':None,'i':int,'f':float}
524 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
524 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
525
525
526 for w in ostr.split():
526 for w in ostr.split():
527 oname,alias,otype = opt_re.match(w).groups()
527 oname,alias,otype = opt_re.match(w).groups()
528 if otype == '' or alias == '!': # simple switches are integers too
528 if otype == '' or alias == '!': # simple switches are integers too
529 otype = 'i'
529 otype = 'i'
530 typeconv[typemap[otype]] += oname + ' '
530 typeconv[typemap[otype]] += oname + ' '
531 return typeconv
531 return typeconv
532
532
533 #----------------------------------------------------------------------------
533 #----------------------------------------------------------------------------
534 def read_dict(filename,type_conv=None,**opt):
534 def read_dict(filename,type_conv=None,**opt):
535
535
536 """Read a dictionary of key=value pairs from an input file, optionally
536 """Read a dictionary of key=value pairs from an input file, optionally
537 performing conversions on the resulting values.
537 performing conversions on the resulting values.
538
538
539 read_dict(filename,type_conv,**opt) -> dict
539 read_dict(filename,type_conv,**opt) -> dict
540
540
541 Only one value per line is accepted, the format should be
541 Only one value per line is accepted, the format should be
542 # optional comments are ignored
542 # optional comments are ignored
543 key value\n
543 key value\n
544
544
545 Args:
545 Args:
546
546
547 - type_conv: A dictionary specifying which keys need to be converted to
547 - type_conv: A dictionary specifying which keys need to be converted to
548 which types. By default all keys are read as strings. This dictionary
548 which types. By default all keys are read as strings. This dictionary
549 should have as its keys valid conversion functions for strings
549 should have as its keys valid conversion functions for strings
550 (int,long,float,complex, or your own). The value for each key
550 (int,long,float,complex, or your own). The value for each key
551 (converter) should be a whitespace separated string containing the names
551 (converter) should be a whitespace separated string containing the names
552 of all the entries in the file to be converted using that function. For
552 of all the entries in the file to be converted using that function. For
553 keys to be left alone, use None as the conversion function (only needed
553 keys to be left alone, use None as the conversion function (only needed
554 with purge=1, see below).
554 with purge=1, see below).
555
555
556 - opt: dictionary with extra options as below (default in parens)
556 - opt: dictionary with extra options as below (default in parens)
557
557
558 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
558 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
559 of the dictionary to be returned. If purge is going to be used, the
559 of the dictionary to be returned. If purge is going to be used, the
560 set of keys to be left as strings also has to be explicitly specified
560 set of keys to be left as strings also has to be explicitly specified
561 using the (non-existent) conversion function None.
561 using the (non-existent) conversion function None.
562
562
563 fs(None): field separator. This is the key/value separator to be used
563 fs(None): field separator. This is the key/value separator to be used
564 when parsing the file. The None default means any whitespace [behavior
564 when parsing the file. The None default means any whitespace [behavior
565 of string.split()].
565 of string.split()].
566
566
567 strip(0): if 1, strip string values of leading/trailinig whitespace.
567 strip(0): if 1, strip string values of leading/trailinig whitespace.
568
568
569 warn(1): warning level if requested keys are not found in file.
569 warn(1): warning level if requested keys are not found in file.
570 - 0: silently ignore.
570 - 0: silently ignore.
571 - 1: inform but proceed.
571 - 1: inform but proceed.
572 - 2: raise KeyError exception.
572 - 2: raise KeyError exception.
573
573
574 no_empty(0): if 1, remove keys with whitespace strings as a value.
574 no_empty(0): if 1, remove keys with whitespace strings as a value.
575
575
576 unique([]): list of keys (or space separated string) which can't be
576 unique([]): list of keys (or space separated string) which can't be
577 repeated. If one such key is found in the file, each new instance
577 repeated. If one such key is found in the file, each new instance
578 overwrites the previous one. For keys not listed here, the behavior is
578 overwrites the previous one. For keys not listed here, the behavior is
579 to make a list of all appearances.
579 to make a list of all appearances.
580
580
581 Example:
581 Example:
582 If the input file test.ini has:
582 If the input file test.ini has:
583 i 3
583 i 3
584 x 4.5
584 x 4.5
585 y 5.5
585 y 5.5
586 s hi ho
586 s hi ho
587 Then:
587 Then:
588
588
589 >>> type_conv={int:'i',float:'x',None:'s'}
589 >>> type_conv={int:'i',float:'x',None:'s'}
590 >>> read_dict('test.ini')
590 >>> read_dict('test.ini')
591 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
591 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
592 >>> read_dict('test.ini',type_conv)
592 >>> read_dict('test.ini',type_conv)
593 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
593 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
594 >>> read_dict('test.ini',type_conv,purge=1)
594 >>> read_dict('test.ini',type_conv,purge=1)
595 {'i': 3, 's': 'hi ho', 'x': 4.5}
595 {'i': 3, 's': 'hi ho', 'x': 4.5}
596 """
596 """
597
597
598 # starting config
598 # starting config
599 opt.setdefault('purge',0)
599 opt.setdefault('purge',0)
600 opt.setdefault('fs',None) # field sep defaults to any whitespace
600 opt.setdefault('fs',None) # field sep defaults to any whitespace
601 opt.setdefault('strip',0)
601 opt.setdefault('strip',0)
602 opt.setdefault('warn',1)
602 opt.setdefault('warn',1)
603 opt.setdefault('no_empty',0)
603 opt.setdefault('no_empty',0)
604 opt.setdefault('unique','')
604 opt.setdefault('unique','')
605 if type(opt['unique']) in StringTypes:
605 if type(opt['unique']) in StringTypes:
606 unique_keys = qw(opt['unique'])
606 unique_keys = qw(opt['unique'])
607 elif type(opt['unique']) in (types.TupleType,types.ListType):
607 elif type(opt['unique']) in (types.TupleType,types.ListType):
608 unique_keys = opt['unique']
608 unique_keys = opt['unique']
609 else:
609 else:
610 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
610 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
611
611
612 dict = {}
612 dict = {}
613 # first read in table of values as strings
613 # first read in table of values as strings
614 file = open(filename,'r')
614 file = open(filename,'r')
615 for line in file.readlines():
615 for line in file.readlines():
616 line = line.strip()
616 line = line.strip()
617 if len(line) and line[0]=='#': continue
617 if len(line) and line[0]=='#': continue
618 if len(line)>0:
618 if len(line)>0:
619 lsplit = line.split(opt['fs'],1)
619 lsplit = line.split(opt['fs'],1)
620 try:
620 try:
621 key,val = lsplit
621 key,val = lsplit
622 except ValueError:
622 except ValueError:
623 key,val = lsplit[0],''
623 key,val = lsplit[0],''
624 key = key.strip()
624 key = key.strip()
625 if opt['strip']: val = val.strip()
625 if opt['strip']: val = val.strip()
626 if val == "''" or val == '""': val = ''
626 if val == "''" or val == '""': val = ''
627 if opt['no_empty'] and (val=='' or val.isspace()):
627 if opt['no_empty'] and (val=='' or val.isspace()):
628 continue
628 continue
629 # if a key is found more than once in the file, build a list
629 # if a key is found more than once in the file, build a list
630 # unless it's in the 'unique' list. In that case, last found in file
630 # unless it's in the 'unique' list. In that case, last found in file
631 # takes precedence. User beware.
631 # takes precedence. User beware.
632 try:
632 try:
633 if dict[key] and key in unique_keys:
633 if dict[key] and key in unique_keys:
634 dict[key] = val
634 dict[key] = val
635 elif type(dict[key]) is types.ListType:
635 elif type(dict[key]) is types.ListType:
636 dict[key].append(val)
636 dict[key].append(val)
637 else:
637 else:
638 dict[key] = [dict[key],val]
638 dict[key] = [dict[key],val]
639 except KeyError:
639 except KeyError:
640 dict[key] = val
640 dict[key] = val
641 # purge if requested
641 # purge if requested
642 if opt['purge']:
642 if opt['purge']:
643 accepted_keys = qwflat(type_conv.values())
643 accepted_keys = qwflat(type_conv.values())
644 for key in dict.keys():
644 for key in dict.keys():
645 if key in accepted_keys: continue
645 if key in accepted_keys: continue
646 del(dict[key])
646 del(dict[key])
647 # now convert if requested
647 # now convert if requested
648 if type_conv==None: return dict
648 if type_conv==None: return dict
649 conversions = type_conv.keys()
649 conversions = type_conv.keys()
650 try: conversions.remove(None)
650 try: conversions.remove(None)
651 except: pass
651 except: pass
652 for convert in conversions:
652 for convert in conversions:
653 for val in qw(type_conv[convert]):
653 for val in qw(type_conv[convert]):
654 try:
654 try:
655 dict[val] = convert(dict[val])
655 dict[val] = convert(dict[val])
656 except KeyError,e:
656 except KeyError,e:
657 if opt['warn'] == 0:
657 if opt['warn'] == 0:
658 pass
658 pass
659 elif opt['warn'] == 1:
659 elif opt['warn'] == 1:
660 print >>sys.stderr, 'Warning: key',val,\
660 print >>sys.stderr, 'Warning: key',val,\
661 'not found in file',filename
661 'not found in file',filename
662 elif opt['warn'] == 2:
662 elif opt['warn'] == 2:
663 raise KeyError,e
663 raise KeyError,e
664 else:
664 else:
665 raise ValueError,'Warning level must be 0,1 or 2'
665 raise ValueError,'Warning level must be 0,1 or 2'
666
666
667 return dict
667 return dict
668
668
669 #----------------------------------------------------------------------------
669 #----------------------------------------------------------------------------
670 def flag_calls(func):
670 def flag_calls(func):
671 """Wrap a function to detect and flag when it gets called.
671 """Wrap a function to detect and flag when it gets called.
672
672
673 This is a decorator which takes a function and wraps it in a function with
673 This is a decorator which takes a function and wraps it in a function with
674 a 'called' attribute. wrapper.called is initialized to False.
674 a 'called' attribute. wrapper.called is initialized to False.
675
675
676 The wrapper.called attribute is set to False right before each call to the
676 The wrapper.called attribute is set to False right before each call to the
677 wrapped function, so if the call fails it remains False. After the call
677 wrapped function, so if the call fails it remains False. After the call
678 completes, wrapper.called is set to True and the output is returned.
678 completes, wrapper.called is set to True and the output is returned.
679
679
680 Testing for truth in wrapper.called allows you to determine if a call to
680 Testing for truth in wrapper.called allows you to determine if a call to
681 func() was attempted and succeeded."""
681 func() was attempted and succeeded."""
682
682
683 def wrapper(*args,**kw):
683 def wrapper(*args,**kw):
684 wrapper.called = False
684 wrapper.called = False
685 out = func(*args,**kw)
685 out = func(*args,**kw)
686 wrapper.called = True
686 wrapper.called = True
687 return out
687 return out
688
688
689 wrapper.called = False
689 wrapper.called = False
690 wrapper.__doc__ = func.__doc__
690 wrapper.__doc__ = func.__doc__
691 return wrapper
691 return wrapper
692
692
693 #----------------------------------------------------------------------------
693 #----------------------------------------------------------------------------
694 class HomeDirError(Error):
694 class HomeDirError(Error):
695 pass
695 pass
696
696
697 def get_home_dir():
697 def get_home_dir():
698 """Return the closest possible equivalent to a 'home' directory.
698 """Return the closest possible equivalent to a 'home' directory.
699
699
700 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
700 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
701
701
702 Currently only Posix and NT are implemented, a HomeDirError exception is
702 Currently only Posix and NT are implemented, a HomeDirError exception is
703 raised for all other OSes. """
703 raised for all other OSes. """
704
704
705 isdir = os.path.isdir
706 env = os.environ
705 try:
707 try:
706 return os.environ['HOME']
708 homedir = env['HOME']
709 if not isdir(homedir):
710 # in case a user stuck some string which does NOT resolve to a
711 # valid path, it's as good as if we hadn't foud it
712 raise KeyError
713 return homedir
707 except KeyError:
714 except KeyError:
708 if os.name == 'posix':
715 if os.name == 'posix':
709 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
716 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
710 elif os.name == 'nt':
717 elif os.name == 'nt':
711 # For some strange reason, win9x returns 'nt' for os.name.
718 # For some strange reason, win9x returns 'nt' for os.name.
712 try:
719 try:
713 return os.path.join(os.environ['HOMEDRIVE'],os.environ['HOMEPATH'])
720 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
721 if not isdir(homedir):
722 homedir = os.path.join(env['USERPROFILE'])
723 if not isdir(homedir):
724 raise HomeDirError
725 return homedir
714 except:
726 except:
715 try:
727 try:
716 # Use the registry to get the 'My Documents' folder.
728 # Use the registry to get the 'My Documents' folder.
717 import _winreg as wreg
729 import _winreg as wreg
718 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
730 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
719 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
731 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
720 homedir = wreg.QueryValueEx(key,'Personal')[0]
732 homedir = wreg.QueryValueEx(key,'Personal')[0]
721 key.Close()
733 key.Close()
722 return homedir
734 return homedir
723 except:
735 except:
724 return 'C:\\'
736 return 'C:\\'
725 elif os.name == 'dos':
737 elif os.name == 'dos':
726 # Desperate, may do absurd things in classic MacOS. May work under DOS.
738 # Desperate, may do absurd things in classic MacOS. May work under DOS.
727 return 'C:\\'
739 return 'C:\\'
728 else:
740 else:
729 raise HomeDirError,'support for your operating system not implemented.'
741 raise HomeDirError,'support for your operating system not implemented.'
730
742
731 #****************************************************************************
743 #****************************************************************************
732 # strings and text
744 # strings and text
733
745
734 class LSString(str):
746 class LSString(str):
735 """String derivative with a special access attributes.
747 """String derivative with a special access attributes.
736
748
737 These are normal strings, but with the special attributes:
749 These are normal strings, but with the special attributes:
738
750
739 .l (or .list) : value as list (split on newlines).
751 .l (or .list) : value as list (split on newlines).
740 .n (or .nlstr): original value (the string itself).
752 .n (or .nlstr): original value (the string itself).
741 .s (or .spstr): value as whitespace-separated string.
753 .s (or .spstr): value as whitespace-separated string.
742
754
743 Any values which require transformations are computed only once and
755 Any values which require transformations are computed only once and
744 cached.
756 cached.
745
757
746 Such strings are very useful to efficiently interact with the shell, which
758 Such strings are very useful to efficiently interact with the shell, which
747 typically only understands whitespace-separated options for commands."""
759 typically only understands whitespace-separated options for commands."""
748
760
749 def get_list(self):
761 def get_list(self):
750 try:
762 try:
751 return self.__list
763 return self.__list
752 except AttributeError:
764 except AttributeError:
753 self.__list = self.split('\n')
765 self.__list = self.split('\n')
754 return self.__list
766 return self.__list
755
767
756 l = list = property(get_list)
768 l = list = property(get_list)
757
769
758 def get_spstr(self):
770 def get_spstr(self):
759 try:
771 try:
760 return self.__spstr
772 return self.__spstr
761 except AttributeError:
773 except AttributeError:
762 self.__spstr = self.replace('\n',' ')
774 self.__spstr = self.replace('\n',' ')
763 return self.__spstr
775 return self.__spstr
764
776
765 s = spstr = property(get_spstr)
777 s = spstr = property(get_spstr)
766
778
767 def get_nlstr(self):
779 def get_nlstr(self):
768 return self
780 return self
769
781
770 n = nlstr = property(get_nlstr)
782 n = nlstr = property(get_nlstr)
771
783
772 class SList(list):
784 class SList(list):
773 """List derivative with a special access attributes.
785 """List derivative with a special access attributes.
774
786
775 These are normal lists, but with the special attributes:
787 These are normal lists, but with the special attributes:
776
788
777 .l (or .list) : value as list (the list itself).
789 .l (or .list) : value as list (the list itself).
778 .n (or .nlstr): value as a string, joined on newlines.
790 .n (or .nlstr): value as a string, joined on newlines.
779 .s (or .spstr): value as a string, joined on spaces.
791 .s (or .spstr): value as a string, joined on spaces.
780
792
781 Any values which require transformations are computed only once and
793 Any values which require transformations are computed only once and
782 cached."""
794 cached."""
783
795
784 def get_list(self):
796 def get_list(self):
785 return self
797 return self
786
798
787 l = list = property(get_list)
799 l = list = property(get_list)
788
800
789 def get_spstr(self):
801 def get_spstr(self):
790 try:
802 try:
791 return self.__spstr
803 return self.__spstr
792 except AttributeError:
804 except AttributeError:
793 self.__spstr = ' '.join(self)
805 self.__spstr = ' '.join(self)
794 return self.__spstr
806 return self.__spstr
795
807
796 s = spstr = property(get_spstr)
808 s = spstr = property(get_spstr)
797
809
798 def get_nlstr(self):
810 def get_nlstr(self):
799 try:
811 try:
800 return self.__nlstr
812 return self.__nlstr
801 except AttributeError:
813 except AttributeError:
802 self.__nlstr = '\n'.join(self)
814 self.__nlstr = '\n'.join(self)
803 return self.__nlstr
815 return self.__nlstr
804
816
805 n = nlstr = property(get_nlstr)
817 n = nlstr = property(get_nlstr)
806
818
807 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
819 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
808 """Take multiple lines of input.
820 """Take multiple lines of input.
809
821
810 A list with each line of input as a separate element is returned when a
822 A list with each line of input as a separate element is returned when a
811 termination string is entered (defaults to a single '.'). Input can also
823 termination string is entered (defaults to a single '.'). Input can also
812 terminate via EOF (^D in Unix, ^Z-RET in Windows).
824 terminate via EOF (^D in Unix, ^Z-RET in Windows).
813
825
814 Lines of input which end in \\ are joined into single entries (and a
826 Lines of input which end in \\ are joined into single entries (and a
815 secondary continuation prompt is issued as long as the user terminates
827 secondary continuation prompt is issued as long as the user terminates
816 lines with \\). This allows entering very long strings which are still
828 lines with \\). This allows entering very long strings which are still
817 meant to be treated as single entities.
829 meant to be treated as single entities.
818 """
830 """
819
831
820 try:
832 try:
821 if header:
833 if header:
822 header += '\n'
834 header += '\n'
823 lines = [raw_input(header + ps1)]
835 lines = [raw_input(header + ps1)]
824 except EOFError:
836 except EOFError:
825 return []
837 return []
826 terminate = [terminate_str]
838 terminate = [terminate_str]
827 try:
839 try:
828 while lines[-1:] != terminate:
840 while lines[-1:] != terminate:
829 new_line = raw_input(ps1)
841 new_line = raw_input(ps1)
830 while new_line.endswith('\\'):
842 while new_line.endswith('\\'):
831 new_line = new_line[:-1] + raw_input(ps2)
843 new_line = new_line[:-1] + raw_input(ps2)
832 lines.append(new_line)
844 lines.append(new_line)
833
845
834 return lines[:-1] # don't return the termination command
846 return lines[:-1] # don't return the termination command
835 except EOFError:
847 except EOFError:
836 print
848 print
837 return lines
849 return lines
838
850
839 #----------------------------------------------------------------------------
851 #----------------------------------------------------------------------------
840 def raw_input_ext(prompt='', ps2='... '):
852 def raw_input_ext(prompt='', ps2='... '):
841 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
853 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
842
854
843 line = raw_input(prompt)
855 line = raw_input(prompt)
844 while line.endswith('\\'):
856 while line.endswith('\\'):
845 line = line[:-1] + raw_input(ps2)
857 line = line[:-1] + raw_input(ps2)
846 return line
858 return line
847
859
848 #----------------------------------------------------------------------------
860 #----------------------------------------------------------------------------
849 def ask_yes_no(prompt,default=None):
861 def ask_yes_no(prompt,default=None):
850 """Asks a question and returns an integer 1/0 (y/n) answer.
862 """Asks a question and returns an integer 1/0 (y/n) answer.
851
863
852 If default is given (one of 'y','n'), it is used if the user input is
864 If default is given (one of 'y','n'), it is used if the user input is
853 empty. Otherwise the question is repeated until an answer is given.
865 empty. Otherwise the question is repeated until an answer is given.
854 If EOF occurs 20 times consecutively, the default answer is assumed,
866 If EOF occurs 20 times consecutively, the default answer is assumed,
855 or if there is no default, an exception is raised to prevent infinite
867 or if there is no default, an exception is raised to prevent infinite
856 loops.
868 loops.
857
869
858 Valid answers are: y/yes/n/no (match is not case sensitive)."""
870 Valid answers are: y/yes/n/no (match is not case sensitive)."""
859
871
860 answers = {'y':1,'n':0,'yes':1,'no':0}
872 answers = {'y':1,'n':0,'yes':1,'no':0}
861 ans = None
873 ans = None
862 eofs, max_eofs = 0, 20
874 eofs, max_eofs = 0, 20
863 while ans not in answers.keys():
875 while ans not in answers.keys():
864 try:
876 try:
865 ans = raw_input(prompt+' ').lower()
877 ans = raw_input(prompt+' ').lower()
866 if not ans: # response was an empty string
878 if not ans: # response was an empty string
867 ans = default
879 ans = default
868 eofs = 0
880 eofs = 0
869 except (EOFError,KeyboardInterrupt):
881 except (EOFError,KeyboardInterrupt):
870 eofs = eofs + 1
882 eofs = eofs + 1
871 if eofs >= max_eofs:
883 if eofs >= max_eofs:
872 if default in answers.keys():
884 if default in answers.keys():
873 ans = default
885 ans = default
874 else:
886 else:
875 raise
887 raise
876
888
877 return answers[ans]
889 return answers[ans]
878
890
879 #----------------------------------------------------------------------------
891 #----------------------------------------------------------------------------
880 class EvalDict:
892 class EvalDict:
881 """
893 """
882 Emulate a dict which evaluates its contents in the caller's frame.
894 Emulate a dict which evaluates its contents in the caller's frame.
883
895
884 Usage:
896 Usage:
885 >>>number = 19
897 >>>number = 19
886 >>>text = "python"
898 >>>text = "python"
887 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
899 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
888 """
900 """
889
901
890 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
902 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
891 # modified (shorter) version of:
903 # modified (shorter) version of:
892 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
904 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
893 # Skip Montanaro (skip@pobox.com).
905 # Skip Montanaro (skip@pobox.com).
894
906
895 def __getitem__(self, name):
907 def __getitem__(self, name):
896 frame = sys._getframe(1)
908 frame = sys._getframe(1)
897 return eval(name, frame.f_globals, frame.f_locals)
909 return eval(name, frame.f_globals, frame.f_locals)
898
910
899 EvalString = EvalDict # for backwards compatibility
911 EvalString = EvalDict # for backwards compatibility
900 #----------------------------------------------------------------------------
912 #----------------------------------------------------------------------------
901 def qw(words,flat=0,sep=None,maxsplit=-1):
913 def qw(words,flat=0,sep=None,maxsplit=-1):
902 """Similar to Perl's qw() operator, but with some more options.
914 """Similar to Perl's qw() operator, but with some more options.
903
915
904 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
916 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
905
917
906 words can also be a list itself, and with flat=1, the output will be
918 words can also be a list itself, and with flat=1, the output will be
907 recursively flattened. Examples:
919 recursively flattened. Examples:
908
920
909 >>> qw('1 2')
921 >>> qw('1 2')
910 ['1', '2']
922 ['1', '2']
911 >>> qw(['a b','1 2',['m n','p q']])
923 >>> qw(['a b','1 2',['m n','p q']])
912 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
924 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
913 >>> qw(['a b','1 2',['m n','p q']],flat=1)
925 >>> qw(['a b','1 2',['m n','p q']],flat=1)
914 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
926 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
915
927
916 if type(words) in StringTypes:
928 if type(words) in StringTypes:
917 return [word.strip() for word in words.split(sep,maxsplit)
929 return [word.strip() for word in words.split(sep,maxsplit)
918 if word and not word.isspace() ]
930 if word and not word.isspace() ]
919 if flat:
931 if flat:
920 return flatten(map(qw,words,[1]*len(words)))
932 return flatten(map(qw,words,[1]*len(words)))
921 return map(qw,words)
933 return map(qw,words)
922
934
923 #----------------------------------------------------------------------------
935 #----------------------------------------------------------------------------
924 def qwflat(words,sep=None,maxsplit=-1):
936 def qwflat(words,sep=None,maxsplit=-1):
925 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
937 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
926 return qw(words,1,sep,maxsplit)
938 return qw(words,1,sep,maxsplit)
927
939
928 #-----------------------------------------------------------------------------
940 #-----------------------------------------------------------------------------
929 def list_strings(arg):
941 def list_strings(arg):
930 """Always return a list of strings, given a string or list of strings
942 """Always return a list of strings, given a string or list of strings
931 as input."""
943 as input."""
932
944
933 if type(arg) in StringTypes: return [arg]
945 if type(arg) in StringTypes: return [arg]
934 else: return arg
946 else: return arg
935
947
936 #----------------------------------------------------------------------------
948 #----------------------------------------------------------------------------
937 def grep(pat,list,case=1):
949 def grep(pat,list,case=1):
938 """Simple minded grep-like function.
950 """Simple minded grep-like function.
939 grep(pat,list) returns occurrences of pat in list, None on failure.
951 grep(pat,list) returns occurrences of pat in list, None on failure.
940
952
941 It only does simple string matching, with no support for regexps. Use the
953 It only does simple string matching, with no support for regexps. Use the
942 option case=0 for case-insensitive matching."""
954 option case=0 for case-insensitive matching."""
943
955
944 # This is pretty crude. At least it should implement copying only references
956 # This is pretty crude. At least it should implement copying only references
945 # to the original data in case it's big. Now it copies the data for output.
957 # to the original data in case it's big. Now it copies the data for output.
946 out=[]
958 out=[]
947 if case:
959 if case:
948 for term in list:
960 for term in list:
949 if term.find(pat)>-1: out.append(term)
961 if term.find(pat)>-1: out.append(term)
950 else:
962 else:
951 lpat=pat.lower()
963 lpat=pat.lower()
952 for term in list:
964 for term in list:
953 if term.lower().find(lpat)>-1: out.append(term)
965 if term.lower().find(lpat)>-1: out.append(term)
954
966
955 if len(out): return out
967 if len(out): return out
956 else: return None
968 else: return None
957
969
958 #----------------------------------------------------------------------------
970 #----------------------------------------------------------------------------
959 def dgrep(pat,*opts):
971 def dgrep(pat,*opts):
960 """Return grep() on dir()+dir(__builtins__).
972 """Return grep() on dir()+dir(__builtins__).
961
973
962 A very common use of grep() when working interactively."""
974 A very common use of grep() when working interactively."""
963
975
964 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
976 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
965
977
966 #----------------------------------------------------------------------------
978 #----------------------------------------------------------------------------
967 def idgrep(pat):
979 def idgrep(pat):
968 """Case-insensitive dgrep()"""
980 """Case-insensitive dgrep()"""
969
981
970 return dgrep(pat,0)
982 return dgrep(pat,0)
971
983
972 #----------------------------------------------------------------------------
984 #----------------------------------------------------------------------------
973 def igrep(pat,list):
985 def igrep(pat,list):
974 """Synonym for case-insensitive grep."""
986 """Synonym for case-insensitive grep."""
975
987
976 return grep(pat,list,case=0)
988 return grep(pat,list,case=0)
977
989
978 #----------------------------------------------------------------------------
990 #----------------------------------------------------------------------------
979 def indent(str,nspaces=4,ntabs=0):
991 def indent(str,nspaces=4,ntabs=0):
980 """Indent a string a given number of spaces or tabstops.
992 """Indent a string a given number of spaces or tabstops.
981
993
982 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
994 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
983 """
995 """
984 if str is None:
996 if str is None:
985 return
997 return
986 ind = '\t'*ntabs+' '*nspaces
998 ind = '\t'*ntabs+' '*nspaces
987 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
999 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
988 if outstr.endswith(os.linesep+ind):
1000 if outstr.endswith(os.linesep+ind):
989 return outstr[:-len(ind)]
1001 return outstr[:-len(ind)]
990 else:
1002 else:
991 return outstr
1003 return outstr
992
1004
993 #-----------------------------------------------------------------------------
1005 #-----------------------------------------------------------------------------
994 def native_line_ends(filename,backup=1):
1006 def native_line_ends(filename,backup=1):
995 """Convert (in-place) a file to line-ends native to the current OS.
1007 """Convert (in-place) a file to line-ends native to the current OS.
996
1008
997 If the optional backup argument is given as false, no backup of the
1009 If the optional backup argument is given as false, no backup of the
998 original file is left. """
1010 original file is left. """
999
1011
1000 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1012 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1001
1013
1002 bak_filename = filename + backup_suffixes[os.name]
1014 bak_filename = filename + backup_suffixes[os.name]
1003
1015
1004 original = open(filename).read()
1016 original = open(filename).read()
1005 shutil.copy2(filename,bak_filename)
1017 shutil.copy2(filename,bak_filename)
1006 try:
1018 try:
1007 new = open(filename,'wb')
1019 new = open(filename,'wb')
1008 new.write(os.linesep.join(original.splitlines()))
1020 new.write(os.linesep.join(original.splitlines()))
1009 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1021 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1010 new.close()
1022 new.close()
1011 except:
1023 except:
1012 os.rename(bak_filename,filename)
1024 os.rename(bak_filename,filename)
1013 if not backup:
1025 if not backup:
1014 try:
1026 try:
1015 os.remove(bak_filename)
1027 os.remove(bak_filename)
1016 except:
1028 except:
1017 pass
1029 pass
1018
1030
1019 #----------------------------------------------------------------------------
1031 #----------------------------------------------------------------------------
1020 def get_pager_cmd(pager_cmd = None):
1032 def get_pager_cmd(pager_cmd = None):
1021 """Return a pager command.
1033 """Return a pager command.
1022
1034
1023 Makes some attempts at finding an OS-correct one."""
1035 Makes some attempts at finding an OS-correct one."""
1024
1036
1025 if os.name == 'posix':
1037 if os.name == 'posix':
1026 default_pager_cmd = 'less -r' # -r for color control sequences
1038 default_pager_cmd = 'less -r' # -r for color control sequences
1027 elif os.name in ['nt','dos']:
1039 elif os.name in ['nt','dos']:
1028 default_pager_cmd = 'type'
1040 default_pager_cmd = 'type'
1029
1041
1030 if pager_cmd is None:
1042 if pager_cmd is None:
1031 try:
1043 try:
1032 pager_cmd = os.environ['PAGER']
1044 pager_cmd = os.environ['PAGER']
1033 except:
1045 except:
1034 pager_cmd = default_pager_cmd
1046 pager_cmd = default_pager_cmd
1035 return pager_cmd
1047 return pager_cmd
1036
1048
1037 #-----------------------------------------------------------------------------
1049 #-----------------------------------------------------------------------------
1038 def get_pager_start(pager,start):
1050 def get_pager_start(pager,start):
1039 """Return the string for paging files with an offset.
1051 """Return the string for paging files with an offset.
1040
1052
1041 This is the '+N' argument which less and more (under Unix) accept.
1053 This is the '+N' argument which less and more (under Unix) accept.
1042 """
1054 """
1043
1055
1044 if pager in ['less','more']:
1056 if pager in ['less','more']:
1045 if start:
1057 if start:
1046 start_string = '+' + str(start)
1058 start_string = '+' + str(start)
1047 else:
1059 else:
1048 start_string = ''
1060 start_string = ''
1049 else:
1061 else:
1050 start_string = ''
1062 start_string = ''
1051 return start_string
1063 return start_string
1052
1064
1053 #----------------------------------------------------------------------------
1065 #----------------------------------------------------------------------------
1054 def page_dumb(strng,start=0,screen_lines=25):
1066 def page_dumb(strng,start=0,screen_lines=25):
1055 """Very dumb 'pager' in Python, for when nothing else works.
1067 """Very dumb 'pager' in Python, for when nothing else works.
1056
1068
1057 Only moves forward, same interface as page(), except for pager_cmd and
1069 Only moves forward, same interface as page(), except for pager_cmd and
1058 mode."""
1070 mode."""
1059
1071
1060 out_ln = strng.splitlines()[start:]
1072 out_ln = strng.splitlines()[start:]
1061 screens = chop(out_ln,screen_lines-1)
1073 screens = chop(out_ln,screen_lines-1)
1062 if len(screens) == 1:
1074 if len(screens) == 1:
1063 print >>Term.cout, os.linesep.join(screens[0])
1075 print >>Term.cout, os.linesep.join(screens[0])
1064 else:
1076 else:
1065 for scr in screens[0:-1]:
1077 for scr in screens[0:-1]:
1066 print >>Term.cout, os.linesep.join(scr)
1078 print >>Term.cout, os.linesep.join(scr)
1067 ans = raw_input('---Return to continue, q to quit--- ')
1079 ans = raw_input('---Return to continue, q to quit--- ')
1068 if ans.lower().startswith('q'):
1080 if ans.lower().startswith('q'):
1069 return
1081 return
1070 print >>Term.cout, os.linesep.join(screens[-1])
1082 print >>Term.cout, os.linesep.join(screens[-1])
1071
1083
1072 #----------------------------------------------------------------------------
1084 #----------------------------------------------------------------------------
1073 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1085 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1074 """Print a string, piping through a pager after a certain length.
1086 """Print a string, piping through a pager after a certain length.
1075
1087
1076 The screen_lines parameter specifies the number of *usable* lines of your
1088 The screen_lines parameter specifies the number of *usable* lines of your
1077 terminal screen (total lines minus lines you need to reserve to show other
1089 terminal screen (total lines minus lines you need to reserve to show other
1078 information).
1090 information).
1079
1091
1080 If you set screen_lines to a number <=0, page() will try to auto-determine
1092 If you set screen_lines to a number <=0, page() will try to auto-determine
1081 your screen size and will only use up to (screen_size+screen_lines) for
1093 your screen size and will only use up to (screen_size+screen_lines) for
1082 printing, paging after that. That is, if you want auto-detection but need
1094 printing, paging after that. That is, if you want auto-detection but need
1083 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1095 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1084 auto-detection without any lines reserved simply use screen_lines = 0.
1096 auto-detection without any lines reserved simply use screen_lines = 0.
1085
1097
1086 If a string won't fit in the allowed lines, it is sent through the
1098 If a string won't fit in the allowed lines, it is sent through the
1087 specified pager command. If none given, look for PAGER in the environment,
1099 specified pager command. If none given, look for PAGER in the environment,
1088 and ultimately default to less.
1100 and ultimately default to less.
1089
1101
1090 If no system pager works, the string is sent through a 'dumb pager'
1102 If no system pager works, the string is sent through a 'dumb pager'
1091 written in python, very simplistic.
1103 written in python, very simplistic.
1092 """
1104 """
1093
1105
1094 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1106 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1095 TERM = os.environ.get('TERM','dumb')
1107 TERM = os.environ.get('TERM','dumb')
1096 if TERM in ['dumb','emacs'] and os.name != 'nt':
1108 if TERM in ['dumb','emacs'] and os.name != 'nt':
1097 print strng
1109 print strng
1098 return
1110 return
1099 # chop off the topmost part of the string we don't want to see
1111 # chop off the topmost part of the string we don't want to see
1100 str_lines = strng.split(os.linesep)[start:]
1112 str_lines = strng.split(os.linesep)[start:]
1101 str_toprint = os.linesep.join(str_lines)
1113 str_toprint = os.linesep.join(str_lines)
1102 num_newlines = len(str_lines)
1114 num_newlines = len(str_lines)
1103 len_str = len(str_toprint)
1115 len_str = len(str_toprint)
1104
1116
1105 # Dumb heuristics to guesstimate number of on-screen lines the string
1117 # Dumb heuristics to guesstimate number of on-screen lines the string
1106 # takes. Very basic, but good enough for docstrings in reasonable
1118 # takes. Very basic, but good enough for docstrings in reasonable
1107 # terminals. If someone later feels like refining it, it's not hard.
1119 # terminals. If someone later feels like refining it, it's not hard.
1108 numlines = max(num_newlines,int(len_str/80)+1)
1120 numlines = max(num_newlines,int(len_str/80)+1)
1109
1121
1110 screen_lines_def = 25 # default value if we can't auto-determine
1122 screen_lines_def = 25 # default value if we can't auto-determine
1111
1123
1112 # auto-determine screen size
1124 # auto-determine screen size
1113 if screen_lines <= 0:
1125 if screen_lines <= 0:
1114 if TERM=='xterm':
1126 if TERM=='xterm':
1115 try:
1127 try:
1116 import curses
1128 import curses
1117 if hasattr(curses,'initscr'):
1129 if hasattr(curses,'initscr'):
1118 use_curses = 1
1130 use_curses = 1
1119 else:
1131 else:
1120 use_curses = 0
1132 use_curses = 0
1121 except ImportError:
1133 except ImportError:
1122 use_curses = 0
1134 use_curses = 0
1123 else:
1135 else:
1124 # curses causes problems on many terminals other than xterm.
1136 # curses causes problems on many terminals other than xterm.
1125 use_curses = 0
1137 use_curses = 0
1126 if use_curses:
1138 if use_curses:
1127 scr = curses.initscr()
1139 scr = curses.initscr()
1128 screen_lines_real,screen_cols = scr.getmaxyx()
1140 screen_lines_real,screen_cols = scr.getmaxyx()
1129 curses.endwin()
1141 curses.endwin()
1130 screen_lines += screen_lines_real
1142 screen_lines += screen_lines_real
1131 #print '***Screen size:',screen_lines_real,'lines x',\
1143 #print '***Screen size:',screen_lines_real,'lines x',\
1132 #screen_cols,'columns.' # dbg
1144 #screen_cols,'columns.' # dbg
1133 else:
1145 else:
1134 screen_lines += screen_lines_def
1146 screen_lines += screen_lines_def
1135
1147
1136 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1148 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1137 if numlines <= screen_lines :
1149 if numlines <= screen_lines :
1138 #print '*** normal print' # dbg
1150 #print '*** normal print' # dbg
1139 print >>Term.cout, str_toprint
1151 print >>Term.cout, str_toprint
1140 else:
1152 else:
1141 # Try to open pager and default to internal one if that fails.
1153 # Try to open pager and default to internal one if that fails.
1142 # All failure modes are tagged as 'retval=1', to match the return
1154 # All failure modes are tagged as 'retval=1', to match the return
1143 # value of a failed system command. If any intermediate attempt
1155 # value of a failed system command. If any intermediate attempt
1144 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1156 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1145 pager_cmd = get_pager_cmd(pager_cmd)
1157 pager_cmd = get_pager_cmd(pager_cmd)
1146 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1158 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1147 if os.name == 'nt':
1159 if os.name == 'nt':
1148 if pager_cmd.startswith('type'):
1160 if pager_cmd.startswith('type'):
1149 # The default WinXP 'type' command is failing on complex strings.
1161 # The default WinXP 'type' command is failing on complex strings.
1150 retval = 1
1162 retval = 1
1151 else:
1163 else:
1152 tmpname = tempfile.mktemp('.txt')
1164 tmpname = tempfile.mktemp('.txt')
1153 tmpfile = file(tmpname,'wt')
1165 tmpfile = file(tmpname,'wt')
1154 tmpfile.write(strng)
1166 tmpfile.write(strng)
1155 tmpfile.close()
1167 tmpfile.close()
1156 cmd = "%s < %s" % (pager_cmd,tmpname)
1168 cmd = "%s < %s" % (pager_cmd,tmpname)
1157 if os.system(cmd):
1169 if os.system(cmd):
1158 retval = 1
1170 retval = 1
1159 else:
1171 else:
1160 retval = None
1172 retval = None
1161 os.remove(tmpname)
1173 os.remove(tmpname)
1162 else:
1174 else:
1163 try:
1175 try:
1164 retval = None
1176 retval = None
1165 # if I use popen4, things hang. No idea why.
1177 # if I use popen4, things hang. No idea why.
1166 #pager,shell_out = os.popen4(pager_cmd)
1178 #pager,shell_out = os.popen4(pager_cmd)
1167 pager = os.popen(pager_cmd,'w')
1179 pager = os.popen(pager_cmd,'w')
1168 pager.write(strng)
1180 pager.write(strng)
1169 pager.close()
1181 pager.close()
1170 retval = pager.close() # success returns None
1182 retval = pager.close() # success returns None
1171 except IOError,msg: # broken pipe when user quits
1183 except IOError,msg: # broken pipe when user quits
1172 if msg.args == (32,'Broken pipe'):
1184 if msg.args == (32,'Broken pipe'):
1173 retval = None
1185 retval = None
1174 else:
1186 else:
1175 retval = 1
1187 retval = 1
1176 except OSError:
1188 except OSError:
1177 # Other strange problems, sometimes seen in Win2k/cygwin
1189 # Other strange problems, sometimes seen in Win2k/cygwin
1178 retval = 1
1190 retval = 1
1179 if retval is not None:
1191 if retval is not None:
1180 page_dumb(strng,screen_lines=screen_lines)
1192 page_dumb(strng,screen_lines=screen_lines)
1181
1193
1182 #----------------------------------------------------------------------------
1194 #----------------------------------------------------------------------------
1183 def page_file(fname,start = 0, pager_cmd = None):
1195 def page_file(fname,start = 0, pager_cmd = None):
1184 """Page a file, using an optional pager command and starting line.
1196 """Page a file, using an optional pager command and starting line.
1185 """
1197 """
1186
1198
1187 pager_cmd = get_pager_cmd(pager_cmd)
1199 pager_cmd = get_pager_cmd(pager_cmd)
1188 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1200 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1189
1201
1190 try:
1202 try:
1191 if os.environ['TERM'] in ['emacs','dumb']:
1203 if os.environ['TERM'] in ['emacs','dumb']:
1192 raise EnvironmentError
1204 raise EnvironmentError
1193 xsys(pager_cmd + ' ' + fname)
1205 xsys(pager_cmd + ' ' + fname)
1194 except:
1206 except:
1195 try:
1207 try:
1196 if start > 0:
1208 if start > 0:
1197 start -= 1
1209 start -= 1
1198 page(open(fname).read(),start)
1210 page(open(fname).read(),start)
1199 except:
1211 except:
1200 print 'Unable to show file',`fname`
1212 print 'Unable to show file',`fname`
1201
1213
1202 #----------------------------------------------------------------------------
1214 #----------------------------------------------------------------------------
1203 def snip_print(str,width = 75,print_full = 0,header = ''):
1215 def snip_print(str,width = 75,print_full = 0,header = ''):
1204 """Print a string snipping the midsection to fit in width.
1216 """Print a string snipping the midsection to fit in width.
1205
1217
1206 print_full: mode control:
1218 print_full: mode control:
1207 - 0: only snip long strings
1219 - 0: only snip long strings
1208 - 1: send to page() directly.
1220 - 1: send to page() directly.
1209 - 2: snip long strings and ask for full length viewing with page()
1221 - 2: snip long strings and ask for full length viewing with page()
1210 Return 1 if snipping was necessary, 0 otherwise."""
1222 Return 1 if snipping was necessary, 0 otherwise."""
1211
1223
1212 if print_full == 1:
1224 if print_full == 1:
1213 page(header+str)
1225 page(header+str)
1214 return 0
1226 return 0
1215
1227
1216 print header,
1228 print header,
1217 if len(str) < width:
1229 if len(str) < width:
1218 print str
1230 print str
1219 snip = 0
1231 snip = 0
1220 else:
1232 else:
1221 whalf = int((width -5)/2)
1233 whalf = int((width -5)/2)
1222 print str[:whalf] + ' <...> ' + str[-whalf:]
1234 print str[:whalf] + ' <...> ' + str[-whalf:]
1223 snip = 1
1235 snip = 1
1224 if snip and print_full == 2:
1236 if snip and print_full == 2:
1225 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1237 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1226 page(str)
1238 page(str)
1227 return snip
1239 return snip
1228
1240
1229 #****************************************************************************
1241 #****************************************************************************
1230 # lists, dicts and structures
1242 # lists, dicts and structures
1231
1243
1232 def belong(candidates,checklist):
1244 def belong(candidates,checklist):
1233 """Check whether a list of items appear in a given list of options.
1245 """Check whether a list of items appear in a given list of options.
1234
1246
1235 Returns a list of 1 and 0, one for each candidate given."""
1247 Returns a list of 1 and 0, one for each candidate given."""
1236
1248
1237 return [x in checklist for x in candidates]
1249 return [x in checklist for x in candidates]
1238
1250
1239 #----------------------------------------------------------------------------
1251 #----------------------------------------------------------------------------
1240 def uniq_stable(elems):
1252 def uniq_stable(elems):
1241 """uniq_stable(elems) -> list
1253 """uniq_stable(elems) -> list
1242
1254
1243 Return from an iterable, a list of all the unique elements in the input,
1255 Return from an iterable, a list of all the unique elements in the input,
1244 but maintaining the order in which they first appear.
1256 but maintaining the order in which they first appear.
1245
1257
1246 A naive solution to this problem which just makes a dictionary with the
1258 A naive solution to this problem which just makes a dictionary with the
1247 elements as keys fails to respect the stability condition, since
1259 elements as keys fails to respect the stability condition, since
1248 dictionaries are unsorted by nature.
1260 dictionaries are unsorted by nature.
1249
1261
1250 Note: All elements in the input must be valid dictionary keys for this
1262 Note: All elements in the input must be valid dictionary keys for this
1251 routine to work, as it internally uses a dictionary for efficiency
1263 routine to work, as it internally uses a dictionary for efficiency
1252 reasons."""
1264 reasons."""
1253
1265
1254 unique = []
1266 unique = []
1255 unique_dict = {}
1267 unique_dict = {}
1256 for nn in elems:
1268 for nn in elems:
1257 if nn not in unique_dict:
1269 if nn not in unique_dict:
1258 unique.append(nn)
1270 unique.append(nn)
1259 unique_dict[nn] = None
1271 unique_dict[nn] = None
1260 return unique
1272 return unique
1261
1273
1262 #----------------------------------------------------------------------------
1274 #----------------------------------------------------------------------------
1263 class NLprinter:
1275 class NLprinter:
1264 """Print an arbitrarily nested list, indicating index numbers.
1276 """Print an arbitrarily nested list, indicating index numbers.
1265
1277
1266 An instance of this class called nlprint is available and callable as a
1278 An instance of this class called nlprint is available and callable as a
1267 function.
1279 function.
1268
1280
1269 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1281 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1270 and using 'sep' to separate the index from the value. """
1282 and using 'sep' to separate the index from the value. """
1271
1283
1272 def __init__(self):
1284 def __init__(self):
1273 self.depth = 0
1285 self.depth = 0
1274
1286
1275 def __call__(self,lst,pos='',**kw):
1287 def __call__(self,lst,pos='',**kw):
1276 """Prints the nested list numbering levels."""
1288 """Prints the nested list numbering levels."""
1277 kw.setdefault('indent',' ')
1289 kw.setdefault('indent',' ')
1278 kw.setdefault('sep',': ')
1290 kw.setdefault('sep',': ')
1279 kw.setdefault('start',0)
1291 kw.setdefault('start',0)
1280 kw.setdefault('stop',len(lst))
1292 kw.setdefault('stop',len(lst))
1281 # we need to remove start and stop from kw so they don't propagate
1293 # we need to remove start and stop from kw so they don't propagate
1282 # into a recursive call for a nested list.
1294 # into a recursive call for a nested list.
1283 start = kw['start']; del kw['start']
1295 start = kw['start']; del kw['start']
1284 stop = kw['stop']; del kw['stop']
1296 stop = kw['stop']; del kw['stop']
1285 if self.depth == 0 and 'header' in kw.keys():
1297 if self.depth == 0 and 'header' in kw.keys():
1286 print kw['header']
1298 print kw['header']
1287
1299
1288 for idx in range(start,stop):
1300 for idx in range(start,stop):
1289 elem = lst[idx]
1301 elem = lst[idx]
1290 if type(elem)==type([]):
1302 if type(elem)==type([]):
1291 self.depth += 1
1303 self.depth += 1
1292 self.__call__(elem,itpl('$pos$idx,'),**kw)
1304 self.__call__(elem,itpl('$pos$idx,'),**kw)
1293 self.depth -= 1
1305 self.depth -= 1
1294 else:
1306 else:
1295 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1307 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1296
1308
1297 nlprint = NLprinter()
1309 nlprint = NLprinter()
1298 #----------------------------------------------------------------------------
1310 #----------------------------------------------------------------------------
1299 def all_belong(candidates,checklist):
1311 def all_belong(candidates,checklist):
1300 """Check whether a list of items ALL appear in a given list of options.
1312 """Check whether a list of items ALL appear in a given list of options.
1301
1313
1302 Returns a single 1 or 0 value."""
1314 Returns a single 1 or 0 value."""
1303
1315
1304 return 1-(0 in [x in checklist for x in candidates])
1316 return 1-(0 in [x in checklist for x in candidates])
1305
1317
1306 #----------------------------------------------------------------------------
1318 #----------------------------------------------------------------------------
1307 def sort_compare(lst1,lst2,inplace = 1):
1319 def sort_compare(lst1,lst2,inplace = 1):
1308 """Sort and compare two lists.
1320 """Sort and compare two lists.
1309
1321
1310 By default it does it in place, thus modifying the lists. Use inplace = 0
1322 By default it does it in place, thus modifying the lists. Use inplace = 0
1311 to avoid that (at the cost of temporary copy creation)."""
1323 to avoid that (at the cost of temporary copy creation)."""
1312 if not inplace:
1324 if not inplace:
1313 lst1 = lst1[:]
1325 lst1 = lst1[:]
1314 lst2 = lst2[:]
1326 lst2 = lst2[:]
1315 lst1.sort(); lst2.sort()
1327 lst1.sort(); lst2.sort()
1316 return lst1 == lst2
1328 return lst1 == lst2
1317
1329
1318 #----------------------------------------------------------------------------
1330 #----------------------------------------------------------------------------
1319 def mkdict(**kwargs):
1331 def mkdict(**kwargs):
1320 """Return a dict from a keyword list.
1332 """Return a dict from a keyword list.
1321
1333
1322 It's just syntactic sugar for making ditcionary creation more convenient:
1334 It's just syntactic sugar for making ditcionary creation more convenient:
1323 # the standard way
1335 # the standard way
1324 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1336 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1325 # a cleaner way
1337 # a cleaner way
1326 >>>data = dict(red=1, green=2, blue=3)
1338 >>>data = dict(red=1, green=2, blue=3)
1327
1339
1328 If you need more than this, look at the Struct() class."""
1340 If you need more than this, look at the Struct() class."""
1329
1341
1330 return kwargs
1342 return kwargs
1331
1343
1332 #----------------------------------------------------------------------------
1344 #----------------------------------------------------------------------------
1333 def list2dict(lst):
1345 def list2dict(lst):
1334 """Takes a list of (key,value) pairs and turns it into a dict."""
1346 """Takes a list of (key,value) pairs and turns it into a dict."""
1335
1347
1336 dic = {}
1348 dic = {}
1337 for k,v in lst: dic[k] = v
1349 for k,v in lst: dic[k] = v
1338 return dic
1350 return dic
1339
1351
1340 #----------------------------------------------------------------------------
1352 #----------------------------------------------------------------------------
1341 def list2dict2(lst,default=''):
1353 def list2dict2(lst,default=''):
1342 """Takes a list and turns it into a dict.
1354 """Takes a list and turns it into a dict.
1343 Much slower than list2dict, but more versatile. This version can take
1355 Much slower than list2dict, but more versatile. This version can take
1344 lists with sublists of arbitrary length (including sclars)."""
1356 lists with sublists of arbitrary length (including sclars)."""
1345
1357
1346 dic = {}
1358 dic = {}
1347 for elem in lst:
1359 for elem in lst:
1348 if type(elem) in (types.ListType,types.TupleType):
1360 if type(elem) in (types.ListType,types.TupleType):
1349 size = len(elem)
1361 size = len(elem)
1350 if size == 0:
1362 if size == 0:
1351 pass
1363 pass
1352 elif size == 1:
1364 elif size == 1:
1353 dic[elem] = default
1365 dic[elem] = default
1354 else:
1366 else:
1355 k,v = elem[0], elem[1:]
1367 k,v = elem[0], elem[1:]
1356 if len(v) == 1: v = v[0]
1368 if len(v) == 1: v = v[0]
1357 dic[k] = v
1369 dic[k] = v
1358 else:
1370 else:
1359 dic[elem] = default
1371 dic[elem] = default
1360 return dic
1372 return dic
1361
1373
1362 #----------------------------------------------------------------------------
1374 #----------------------------------------------------------------------------
1363 def flatten(seq):
1375 def flatten(seq):
1364 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1376 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1365
1377
1366 # bug in python??? (YES. Fixed in 2.2, let's leave the kludgy fix in).
1378 # bug in python??? (YES. Fixed in 2.2, let's leave the kludgy fix in).
1367
1379
1368 # if the x=0 isn't made, a *global* variable x is left over after calling
1380 # if the x=0 isn't made, a *global* variable x is left over after calling
1369 # this function, with the value of the last element in the return
1381 # this function, with the value of the last element in the return
1370 # list. This does seem like a bug big time to me.
1382 # list. This does seem like a bug big time to me.
1371
1383
1372 # the problem is fixed with the x=0, which seems to force the creation of
1384 # the problem is fixed with the x=0, which seems to force the creation of
1373 # a local name
1385 # a local name
1374
1386
1375 x = 0
1387 x = 0
1376 return [x for subseq in seq for x in subseq]
1388 return [x for subseq in seq for x in subseq]
1377
1389
1378 #----------------------------------------------------------------------------
1390 #----------------------------------------------------------------------------
1379 def get_slice(seq,start=0,stop=None,step=1):
1391 def get_slice(seq,start=0,stop=None,step=1):
1380 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1392 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1381 if stop == None:
1393 if stop == None:
1382 stop = len(seq)
1394 stop = len(seq)
1383 item = lambda i: seq[i]
1395 item = lambda i: seq[i]
1384 return map(item,xrange(start,stop,step))
1396 return map(item,xrange(start,stop,step))
1385
1397
1386 #----------------------------------------------------------------------------
1398 #----------------------------------------------------------------------------
1387 def chop(seq,size):
1399 def chop(seq,size):
1388 """Chop a sequence into chunks of the given size."""
1400 """Chop a sequence into chunks of the given size."""
1389 chunk = lambda i: seq[i:i+size]
1401 chunk = lambda i: seq[i:i+size]
1390 return map(chunk,xrange(0,len(seq),size))
1402 return map(chunk,xrange(0,len(seq),size))
1391
1403
1392 #----------------------------------------------------------------------------
1404 #----------------------------------------------------------------------------
1393 def with(object, **args):
1405 def with(object, **args):
1394 """Set multiple attributes for an object, similar to Pascal's with.
1406 """Set multiple attributes for an object, similar to Pascal's with.
1395
1407
1396 Example:
1408 Example:
1397 with(jim,
1409 with(jim,
1398 born = 1960,
1410 born = 1960,
1399 haircolour = 'Brown',
1411 haircolour = 'Brown',
1400 eyecolour = 'Green')
1412 eyecolour = 'Green')
1401
1413
1402 Credit: Greg Ewing, in
1414 Credit: Greg Ewing, in
1403 http://mail.python.org/pipermail/python-list/2001-May/040703.html"""
1415 http://mail.python.org/pipermail/python-list/2001-May/040703.html"""
1404
1416
1405 object.__dict__.update(args)
1417 object.__dict__.update(args)
1406
1418
1407 #----------------------------------------------------------------------------
1419 #----------------------------------------------------------------------------
1408 def setattr_list(obj,alist,nspace = None):
1420 def setattr_list(obj,alist,nspace = None):
1409 """Set a list of attributes for an object taken from a namespace.
1421 """Set a list of attributes for an object taken from a namespace.
1410
1422
1411 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1423 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1412 alist with their values taken from nspace, which must be a dict (something
1424 alist with their values taken from nspace, which must be a dict (something
1413 like locals() will often do) If nspace isn't given, locals() of the
1425 like locals() will often do) If nspace isn't given, locals() of the
1414 *caller* is used, so in most cases you can omit it.
1426 *caller* is used, so in most cases you can omit it.
1415
1427
1416 Note that alist can be given as a string, which will be automatically
1428 Note that alist can be given as a string, which will be automatically
1417 split into a list on whitespace. If given as a list, it must be a list of
1429 split into a list on whitespace. If given as a list, it must be a list of
1418 *strings* (the variable names themselves), not of variables."""
1430 *strings* (the variable names themselves), not of variables."""
1419
1431
1420 # this grabs the local variables from the *previous* call frame -- that is
1432 # this grabs the local variables from the *previous* call frame -- that is
1421 # the locals from the function that called setattr_list().
1433 # the locals from the function that called setattr_list().
1422 # - snipped from weave.inline()
1434 # - snipped from weave.inline()
1423 if nspace is None:
1435 if nspace is None:
1424 call_frame = sys._getframe().f_back
1436 call_frame = sys._getframe().f_back
1425 nspace = call_frame.f_locals
1437 nspace = call_frame.f_locals
1426
1438
1427 if type(alist) in StringTypes:
1439 if type(alist) in StringTypes:
1428 alist = alist.split()
1440 alist = alist.split()
1429 for attr in alist:
1441 for attr in alist:
1430 val = eval(attr,nspace)
1442 val = eval(attr,nspace)
1431 setattr(obj,attr,val)
1443 setattr(obj,attr,val)
1432
1444
1433 #----------------------------------------------------------------------------
1445 #----------------------------------------------------------------------------
1434 def getattr_list(obj,alist,*args):
1446 def getattr_list(obj,alist,*args):
1435 """getattr_list(obj,alist[, default]) -> attribute list.
1447 """getattr_list(obj,alist[, default]) -> attribute list.
1436
1448
1437 Get a list of named attributes for an object. When a default argument is
1449 Get a list of named attributes for an object. When a default argument is
1438 given, it is returned when the attribute doesn't exist; without it, an
1450 given, it is returned when the attribute doesn't exist; without it, an
1439 exception is raised in that case.
1451 exception is raised in that case.
1440
1452
1441 Note that alist can be given as a string, which will be automatically
1453 Note that alist can be given as a string, which will be automatically
1442 split into a list on whitespace. If given as a list, it must be a list of
1454 split into a list on whitespace. If given as a list, it must be a list of
1443 *strings* (the variable names themselves), not of variables."""
1455 *strings* (the variable names themselves), not of variables."""
1444
1456
1445 if type(alist) in StringTypes:
1457 if type(alist) in StringTypes:
1446 alist = alist.split()
1458 alist = alist.split()
1447 if args:
1459 if args:
1448 if len(args)==1:
1460 if len(args)==1:
1449 default = args[0]
1461 default = args[0]
1450 return map(lambda attr: getattr(obj,attr,default),alist)
1462 return map(lambda attr: getattr(obj,attr,default),alist)
1451 else:
1463 else:
1452 raise ValueError,'getattr_list() takes only one optional argument'
1464 raise ValueError,'getattr_list() takes only one optional argument'
1453 else:
1465 else:
1454 return map(lambda attr: getattr(obj,attr),alist)
1466 return map(lambda attr: getattr(obj,attr),alist)
1455
1467
1456 #----------------------------------------------------------------------------
1468 #----------------------------------------------------------------------------
1457 def map_method(method,object_list,*argseq,**kw):
1469 def map_method(method,object_list,*argseq,**kw):
1458 """map_method(method,object_list,*args,**kw) -> list
1470 """map_method(method,object_list,*args,**kw) -> list
1459
1471
1460 Return a list of the results of applying the methods to the items of the
1472 Return a list of the results of applying the methods to the items of the
1461 argument sequence(s). If more than one sequence is given, the method is
1473 argument sequence(s). If more than one sequence is given, the method is
1462 called with an argument list consisting of the corresponding item of each
1474 called with an argument list consisting of the corresponding item of each
1463 sequence. All sequences must be of the same length.
1475 sequence. All sequences must be of the same length.
1464
1476
1465 Keyword arguments are passed verbatim to all objects called.
1477 Keyword arguments are passed verbatim to all objects called.
1466
1478
1467 This is Python code, so it's not nearly as fast as the builtin map()."""
1479 This is Python code, so it's not nearly as fast as the builtin map()."""
1468
1480
1469 out_list = []
1481 out_list = []
1470 idx = 0
1482 idx = 0
1471 for object in object_list:
1483 for object in object_list:
1472 try:
1484 try:
1473 handler = getattr(object, method)
1485 handler = getattr(object, method)
1474 except AttributeError:
1486 except AttributeError:
1475 out_list.append(None)
1487 out_list.append(None)
1476 else:
1488 else:
1477 if argseq:
1489 if argseq:
1478 args = map(lambda lst:lst[idx],argseq)
1490 args = map(lambda lst:lst[idx],argseq)
1479 #print 'ob',object,'hand',handler,'ar',args # dbg
1491 #print 'ob',object,'hand',handler,'ar',args # dbg
1480 out_list.append(handler(args,**kw))
1492 out_list.append(handler(args,**kw))
1481 else:
1493 else:
1482 out_list.append(handler(**kw))
1494 out_list.append(handler(**kw))
1483 idx += 1
1495 idx += 1
1484 return out_list
1496 return out_list
1485
1497
1486 #----------------------------------------------------------------------------
1498 #----------------------------------------------------------------------------
1487 # Proposed popitem() extension, written as a method
1499 # Proposed popitem() extension, written as a method
1488
1500
1489 class NotGiven: pass
1501 class NotGiven: pass
1490
1502
1491 def popkey(dct,key,default=NotGiven):
1503 def popkey(dct,key,default=NotGiven):
1492 """Return dct[key] and delete dct[key].
1504 """Return dct[key] and delete dct[key].
1493
1505
1494 If default is given, return it if dct[key] doesn't exist, otherwise raise
1506 If default is given, return it if dct[key] doesn't exist, otherwise raise
1495 KeyError. """
1507 KeyError. """
1496
1508
1497 try:
1509 try:
1498 val = dct[key]
1510 val = dct[key]
1499 except KeyError:
1511 except KeyError:
1500 if default is NotGiven:
1512 if default is NotGiven:
1501 raise
1513 raise
1502 else:
1514 else:
1503 return default
1515 return default
1504 else:
1516 else:
1505 del dct[key]
1517 del dct[key]
1506 return val
1518 return val
1507 #*************************** end of file <genutils.py> **********************
1519 #*************************** end of file <genutils.py> **********************
1508
1520
@@ -1,4294 +1,4299 b''
1 2005-07-18 Fernando Perez <fperez@colorado.edu>
2
3 * IPython/genutils.py (get_home_dir): fix to help users with
4 invalid $HOME under win32.
5
1 2005-07-17 Fernando Perez <fperez@colorado.edu>
6 2005-07-17 Fernando Perez <fperez@colorado.edu>
2
7
3 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
8 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
4 some old hacks and clean up a bit other routines; code should be
9 some old hacks and clean up a bit other routines; code should be
5 simpler and a bit faster.
10 simpler and a bit faster.
6
11
7 * IPython/iplib.py (interact): removed some last-resort attempts
12 * IPython/iplib.py (interact): removed some last-resort attempts
8 to survive broken stdout/stderr. That code was only making it
13 to survive broken stdout/stderr. That code was only making it
9 harder to abstract out the i/o (necessary for gui integration),
14 harder to abstract out the i/o (necessary for gui integration),
10 and the crashes it could prevent were extremely rare in practice
15 and the crashes it could prevent were extremely rare in practice
11 (besides being fully user-induced in a pretty violent manner).
16 (besides being fully user-induced in a pretty violent manner).
12
17
13 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
18 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
14 Nothing major yet, but the code is simpler to read; this should
19 Nothing major yet, but the code is simpler to read; this should
15 make it easier to do more serious modifications in the future.
20 make it easier to do more serious modifications in the future.
16
21
17 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
22 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
18 which broke in .15 (thanks to a report by Ville).
23 which broke in .15 (thanks to a report by Ville).
19
24
20 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
25 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
21 be quite correct, I know next to nothing about unicode). This
26 be quite correct, I know next to nothing about unicode). This
22 will allow unicode strings to be used in prompts, amongst other
27 will allow unicode strings to be used in prompts, amongst other
23 cases. It also will prevent ipython from crashing when unicode
28 cases. It also will prevent ipython from crashing when unicode
24 shows up unexpectedly in many places. If ascii encoding fails, we
29 shows up unexpectedly in many places. If ascii encoding fails, we
25 assume utf_8. Currently the encoding is not a user-visible
30 assume utf_8. Currently the encoding is not a user-visible
26 setting, though it could be made so if there is demand for it.
31 setting, though it could be made so if there is demand for it.
27
32
28 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
33 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
29
34
30 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
35 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
31
36
32 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
37 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
33
38
34 * IPython/genutils.py: Add 2.2 compatibility here, so all other
39 * IPython/genutils.py: Add 2.2 compatibility here, so all other
35 code can work transparently for 2.2/2.3.
40 code can work transparently for 2.2/2.3.
36
41
37 2005-07-16 Fernando Perez <fperez@colorado.edu>
42 2005-07-16 Fernando Perez <fperez@colorado.edu>
38
43
39 * IPython/ultraTB.py (ExceptionColors): Make a global variable
44 * IPython/ultraTB.py (ExceptionColors): Make a global variable
40 out of the color scheme table used for coloring exception
45 out of the color scheme table used for coloring exception
41 tracebacks. This allows user code to add new schemes at runtime.
46 tracebacks. This allows user code to add new schemes at runtime.
42 This is a minimally modified version of the patch at
47 This is a minimally modified version of the patch at
43 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
48 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
44 for the contribution.
49 for the contribution.
45
50
46 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
51 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
47 slightly modified version of the patch in
52 slightly modified version of the patch in
48 http://www.scipy.net/roundup/ipython/issue34, which also allows me
53 http://www.scipy.net/roundup/ipython/issue34, which also allows me
49 to remove the previous try/except solution (which was costlier).
54 to remove the previous try/except solution (which was costlier).
50 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
55 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
51
56
52 2005-06-08 Fernando Perez <fperez@colorado.edu>
57 2005-06-08 Fernando Perez <fperez@colorado.edu>
53
58
54 * IPython/iplib.py (write/write_err): Add methods to abstract all
59 * IPython/iplib.py (write/write_err): Add methods to abstract all
55 I/O a bit more.
60 I/O a bit more.
56
61
57 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
62 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
58 warning, reported by Aric Hagberg, fix by JD Hunter.
63 warning, reported by Aric Hagberg, fix by JD Hunter.
59
64
60 2005-06-02 *** Released version 0.6.15
65 2005-06-02 *** Released version 0.6.15
61
66
62 2005-06-01 Fernando Perez <fperez@colorado.edu>
67 2005-06-01 Fernando Perez <fperez@colorado.edu>
63
68
64 * IPython/iplib.py (MagicCompleter.file_matches): Fix
69 * IPython/iplib.py (MagicCompleter.file_matches): Fix
65 tab-completion of filenames within open-quoted strings. Note that
70 tab-completion of filenames within open-quoted strings. Note that
66 this requires that in ~/.ipython/ipythonrc, users change the
71 this requires that in ~/.ipython/ipythonrc, users change the
67 readline delimiters configuration to read:
72 readline delimiters configuration to read:
68
73
69 readline_remove_delims -/~
74 readline_remove_delims -/~
70
75
71
76
72 2005-05-31 *** Released version 0.6.14
77 2005-05-31 *** Released version 0.6.14
73
78
74 2005-05-29 Fernando Perez <fperez@colorado.edu>
79 2005-05-29 Fernando Perez <fperez@colorado.edu>
75
80
76 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
81 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
77 with files not on the filesystem. Reported by Eliyahu Sandler
82 with files not on the filesystem. Reported by Eliyahu Sandler
78 <eli@gondolin.net>
83 <eli@gondolin.net>
79
84
80 2005-05-22 Fernando Perez <fperez@colorado.edu>
85 2005-05-22 Fernando Perez <fperez@colorado.edu>
81
86
82 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
87 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
83 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
88 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
84
89
85 2005-05-19 Fernando Perez <fperez@colorado.edu>
90 2005-05-19 Fernando Perez <fperez@colorado.edu>
86
91
87 * IPython/iplib.py (safe_execfile): close a file which could be
92 * IPython/iplib.py (safe_execfile): close a file which could be
88 left open (causing problems in win32, which locks open files).
93 left open (causing problems in win32, which locks open files).
89 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
94 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
90
95
91 2005-05-18 Fernando Perez <fperez@colorado.edu>
96 2005-05-18 Fernando Perez <fperez@colorado.edu>
92
97
93 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
98 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
94 keyword arguments correctly to safe_execfile().
99 keyword arguments correctly to safe_execfile().
95
100
96 2005-05-13 Fernando Perez <fperez@colorado.edu>
101 2005-05-13 Fernando Perez <fperez@colorado.edu>
97
102
98 * ipython.1: Added info about Qt to manpage, and threads warning
103 * ipython.1: Added info about Qt to manpage, and threads warning
99 to usage page (invoked with --help).
104 to usage page (invoked with --help).
100
105
101 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
106 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
102 new matcher (it goes at the end of the priority list) to do
107 new matcher (it goes at the end of the priority list) to do
103 tab-completion on named function arguments. Submitted by George
108 tab-completion on named function arguments. Submitted by George
104 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
109 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
105 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
110 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
106 for more details.
111 for more details.
107
112
108 * IPython/Magic.py (magic_run): Added new -e flag to ignore
113 * IPython/Magic.py (magic_run): Added new -e flag to ignore
109 SystemExit exceptions in the script being run. Thanks to a report
114 SystemExit exceptions in the script being run. Thanks to a report
110 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
115 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
111 producing very annoying behavior when running unit tests.
116 producing very annoying behavior when running unit tests.
112
117
113 2005-05-12 Fernando Perez <fperez@colorado.edu>
118 2005-05-12 Fernando Perez <fperez@colorado.edu>
114
119
115 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
120 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
116 which I'd broken (again) due to a changed regexp. In the process,
121 which I'd broken (again) due to a changed regexp. In the process,
117 added ';' as an escape to auto-quote the whole line without
122 added ';' as an escape to auto-quote the whole line without
118 splitting its arguments. Thanks to a report by Jerry McRae
123 splitting its arguments. Thanks to a report by Jerry McRae
119 <qrs0xyc02-AT-sneakemail.com>.
124 <qrs0xyc02-AT-sneakemail.com>.
120
125
121 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
126 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
122 possible crashes caused by a TokenError. Reported by Ed Schofield
127 possible crashes caused by a TokenError. Reported by Ed Schofield
123 <schofield-AT-ftw.at>.
128 <schofield-AT-ftw.at>.
124
129
125 2005-05-06 Fernando Perez <fperez@colorado.edu>
130 2005-05-06 Fernando Perez <fperez@colorado.edu>
126
131
127 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
132 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
128
133
129 2005-04-29 Fernando Perez <fperez@colorado.edu>
134 2005-04-29 Fernando Perez <fperez@colorado.edu>
130
135
131 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
136 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
132 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
137 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
133 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
138 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
134 which provides support for Qt interactive usage (similar to the
139 which provides support for Qt interactive usage (similar to the
135 existing one for WX and GTK). This had been often requested.
140 existing one for WX and GTK). This had been often requested.
136
141
137 2005-04-14 *** Released version 0.6.13
142 2005-04-14 *** Released version 0.6.13
138
143
139 2005-04-08 Fernando Perez <fperez@colorado.edu>
144 2005-04-08 Fernando Perez <fperez@colorado.edu>
140
145
141 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
146 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
142 from _ofind, which gets called on almost every input line. Now,
147 from _ofind, which gets called on almost every input line. Now,
143 we only try to get docstrings if they are actually going to be
148 we only try to get docstrings if they are actually going to be
144 used (the overhead of fetching unnecessary docstrings can be
149 used (the overhead of fetching unnecessary docstrings can be
145 noticeable for certain objects, such as Pyro proxies).
150 noticeable for certain objects, such as Pyro proxies).
146
151
147 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
152 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
148 for completers. For some reason I had been passing them the state
153 for completers. For some reason I had been passing them the state
149 variable, which completers never actually need, and was in
154 variable, which completers never actually need, and was in
150 conflict with the rlcompleter API. Custom completers ONLY need to
155 conflict with the rlcompleter API. Custom completers ONLY need to
151 take the text parameter.
156 take the text parameter.
152
157
153 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
158 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
154 work correctly in pysh. I've also moved all the logic which used
159 work correctly in pysh. I've also moved all the logic which used
155 to be in pysh.py here, which will prevent problems with future
160 to be in pysh.py here, which will prevent problems with future
156 upgrades. However, this time I must warn users to update their
161 upgrades. However, this time I must warn users to update their
157 pysh profile to include the line
162 pysh profile to include the line
158
163
159 import_all IPython.Extensions.InterpreterExec
164 import_all IPython.Extensions.InterpreterExec
160
165
161 because otherwise things won't work for them. They MUST also
166 because otherwise things won't work for them. They MUST also
162 delete pysh.py and the line
167 delete pysh.py and the line
163
168
164 execfile pysh.py
169 execfile pysh.py
165
170
166 from their ipythonrc-pysh.
171 from their ipythonrc-pysh.
167
172
168 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
173 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
169 robust in the face of objects whose dir() returns non-strings
174 robust in the face of objects whose dir() returns non-strings
170 (which it shouldn't, but some broken libs like ITK do). Thanks to
175 (which it shouldn't, but some broken libs like ITK do). Thanks to
171 a patch by John Hunter (implemented differently, though). Also
176 a patch by John Hunter (implemented differently, though). Also
172 minor improvements by using .extend instead of + on lists.
177 minor improvements by using .extend instead of + on lists.
173
178
174 * pysh.py:
179 * pysh.py:
175
180
176 2005-04-06 Fernando Perez <fperez@colorado.edu>
181 2005-04-06 Fernando Perez <fperez@colorado.edu>
177
182
178 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
183 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
179 by default, so that all users benefit from it. Those who don't
184 by default, so that all users benefit from it. Those who don't
180 want it can still turn it off.
185 want it can still turn it off.
181
186
182 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
187 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
183 config file, I'd forgotten about this, so users were getting it
188 config file, I'd forgotten about this, so users were getting it
184 off by default.
189 off by default.
185
190
186 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
191 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
187 consistency. Now magics can be called in multiline statements,
192 consistency. Now magics can be called in multiline statements,
188 and python variables can be expanded in magic calls via $var.
193 and python variables can be expanded in magic calls via $var.
189 This makes the magic system behave just like aliases or !system
194 This makes the magic system behave just like aliases or !system
190 calls.
195 calls.
191
196
192 2005-03-28 Fernando Perez <fperez@colorado.edu>
197 2005-03-28 Fernando Perez <fperez@colorado.edu>
193
198
194 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
199 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
195 expensive string additions for building command. Add support for
200 expensive string additions for building command. Add support for
196 trailing ';' when autocall is used.
201 trailing ';' when autocall is used.
197
202
198 2005-03-26 Fernando Perez <fperez@colorado.edu>
203 2005-03-26 Fernando Perez <fperez@colorado.edu>
199
204
200 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
205 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
201 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
206 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
202 ipython.el robust against prompts with any number of spaces
207 ipython.el robust against prompts with any number of spaces
203 (including 0) after the ':' character.
208 (including 0) after the ':' character.
204
209
205 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
210 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
206 continuation prompt, which misled users to think the line was
211 continuation prompt, which misled users to think the line was
207 already indented. Closes debian Bug#300847, reported to me by
212 already indented. Closes debian Bug#300847, reported to me by
208 Norbert Tretkowski <tretkowski-AT-inittab.de>.
213 Norbert Tretkowski <tretkowski-AT-inittab.de>.
209
214
210 2005-03-23 Fernando Perez <fperez@colorado.edu>
215 2005-03-23 Fernando Perez <fperez@colorado.edu>
211
216
212 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
217 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
213 properly aligned if they have embedded newlines.
218 properly aligned if they have embedded newlines.
214
219
215 * IPython/iplib.py (runlines): Add a public method to expose
220 * IPython/iplib.py (runlines): Add a public method to expose
216 IPython's code execution machinery, so that users can run strings
221 IPython's code execution machinery, so that users can run strings
217 as if they had been typed at the prompt interactively.
222 as if they had been typed at the prompt interactively.
218 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
223 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
219 methods which can call the system shell, but with python variable
224 methods which can call the system shell, but with python variable
220 expansion. The three such methods are: __IPYTHON__.system,
225 expansion. The three such methods are: __IPYTHON__.system,
221 .getoutput and .getoutputerror. These need to be documented in a
226 .getoutput and .getoutputerror. These need to be documented in a
222 'public API' section (to be written) of the manual.
227 'public API' section (to be written) of the manual.
223
228
224 2005-03-20 Fernando Perez <fperez@colorado.edu>
229 2005-03-20 Fernando Perez <fperez@colorado.edu>
225
230
226 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
231 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
227 for custom exception handling. This is quite powerful, and it
232 for custom exception handling. This is quite powerful, and it
228 allows for user-installable exception handlers which can trap
233 allows for user-installable exception handlers which can trap
229 custom exceptions at runtime and treat them separately from
234 custom exceptions at runtime and treat them separately from
230 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
235 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
231 Mantegazza <mantegazza-AT-ill.fr>.
236 Mantegazza <mantegazza-AT-ill.fr>.
232 (InteractiveShell.set_custom_completer): public API function to
237 (InteractiveShell.set_custom_completer): public API function to
233 add new completers at runtime.
238 add new completers at runtime.
234
239
235 2005-03-19 Fernando Perez <fperez@colorado.edu>
240 2005-03-19 Fernando Perez <fperez@colorado.edu>
236
241
237 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
242 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
238 allow objects which provide their docstrings via non-standard
243 allow objects which provide their docstrings via non-standard
239 mechanisms (like Pyro proxies) to still be inspected by ipython's
244 mechanisms (like Pyro proxies) to still be inspected by ipython's
240 ? system.
245 ? system.
241
246
242 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
247 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
243 automatic capture system. I tried quite hard to make it work
248 automatic capture system. I tried quite hard to make it work
244 reliably, and simply failed. I tried many combinations with the
249 reliably, and simply failed. I tried many combinations with the
245 subprocess module, but eventually nothing worked in all needed
250 subprocess module, but eventually nothing worked in all needed
246 cases (not blocking stdin for the child, duplicating stdout
251 cases (not blocking stdin for the child, duplicating stdout
247 without blocking, etc). The new %sc/%sx still do capture to these
252 without blocking, etc). The new %sc/%sx still do capture to these
248 magical list/string objects which make shell use much more
253 magical list/string objects which make shell use much more
249 conveninent, so not all is lost.
254 conveninent, so not all is lost.
250
255
251 XXX - FIX MANUAL for the change above!
256 XXX - FIX MANUAL for the change above!
252
257
253 (runsource): I copied code.py's runsource() into ipython to modify
258 (runsource): I copied code.py's runsource() into ipython to modify
254 it a bit. Now the code object and source to be executed are
259 it a bit. Now the code object and source to be executed are
255 stored in ipython. This makes this info accessible to third-party
260 stored in ipython. This makes this info accessible to third-party
256 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
261 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
257 Mantegazza <mantegazza-AT-ill.fr>.
262 Mantegazza <mantegazza-AT-ill.fr>.
258
263
259 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
264 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
260 history-search via readline (like C-p/C-n). I'd wanted this for a
265 history-search via readline (like C-p/C-n). I'd wanted this for a
261 long time, but only recently found out how to do it. For users
266 long time, but only recently found out how to do it. For users
262 who already have their ipythonrc files made and want this, just
267 who already have their ipythonrc files made and want this, just
263 add:
268 add:
264
269
265 readline_parse_and_bind "\e[A": history-search-backward
270 readline_parse_and_bind "\e[A": history-search-backward
266 readline_parse_and_bind "\e[B": history-search-forward
271 readline_parse_and_bind "\e[B": history-search-forward
267
272
268 2005-03-18 Fernando Perez <fperez@colorado.edu>
273 2005-03-18 Fernando Perez <fperez@colorado.edu>
269
274
270 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
275 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
271 LSString and SList classes which allow transparent conversions
276 LSString and SList classes which allow transparent conversions
272 between list mode and whitespace-separated string.
277 between list mode and whitespace-separated string.
273 (magic_r): Fix recursion problem in %r.
278 (magic_r): Fix recursion problem in %r.
274
279
275 * IPython/genutils.py (LSString): New class to be used for
280 * IPython/genutils.py (LSString): New class to be used for
276 automatic storage of the results of all alias/system calls in _o
281 automatic storage of the results of all alias/system calls in _o
277 and _e (stdout/err). These provide a .l/.list attribute which
282 and _e (stdout/err). These provide a .l/.list attribute which
278 does automatic splitting on newlines. This means that for most
283 does automatic splitting on newlines. This means that for most
279 uses, you'll never need to do capturing of output with %sc/%sx
284 uses, you'll never need to do capturing of output with %sc/%sx
280 anymore, since ipython keeps this always done for you. Note that
285 anymore, since ipython keeps this always done for you. Note that
281 only the LAST results are stored, the _o/e variables are
286 only the LAST results are stored, the _o/e variables are
282 overwritten on each call. If you need to save their contents
287 overwritten on each call. If you need to save their contents
283 further, simply bind them to any other name.
288 further, simply bind them to any other name.
284
289
285 2005-03-17 Fernando Perez <fperez@colorado.edu>
290 2005-03-17 Fernando Perez <fperez@colorado.edu>
286
291
287 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
292 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
288 prompt namespace handling.
293 prompt namespace handling.
289
294
290 2005-03-16 Fernando Perez <fperez@colorado.edu>
295 2005-03-16 Fernando Perez <fperez@colorado.edu>
291
296
292 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
297 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
293 classic prompts to be '>>> ' (final space was missing, and it
298 classic prompts to be '>>> ' (final space was missing, and it
294 trips the emacs python mode).
299 trips the emacs python mode).
295 (BasePrompt.__str__): Added safe support for dynamic prompt
300 (BasePrompt.__str__): Added safe support for dynamic prompt
296 strings. Now you can set your prompt string to be '$x', and the
301 strings. Now you can set your prompt string to be '$x', and the
297 value of x will be printed from your interactive namespace. The
302 value of x will be printed from your interactive namespace. The
298 interpolation syntax includes the full Itpl support, so
303 interpolation syntax includes the full Itpl support, so
299 ${foo()+x+bar()} is a valid prompt string now, and the function
304 ${foo()+x+bar()} is a valid prompt string now, and the function
300 calls will be made at runtime.
305 calls will be made at runtime.
301
306
302 2005-03-15 Fernando Perez <fperez@colorado.edu>
307 2005-03-15 Fernando Perez <fperez@colorado.edu>
303
308
304 * IPython/Magic.py (magic_history): renamed %hist to %history, to
309 * IPython/Magic.py (magic_history): renamed %hist to %history, to
305 avoid name clashes in pylab. %hist still works, it just forwards
310 avoid name clashes in pylab. %hist still works, it just forwards
306 the call to %history.
311 the call to %history.
307
312
308 2005-03-02 *** Released version 0.6.12
313 2005-03-02 *** Released version 0.6.12
309
314
310 2005-03-02 Fernando Perez <fperez@colorado.edu>
315 2005-03-02 Fernando Perez <fperez@colorado.edu>
311
316
312 * IPython/iplib.py (handle_magic): log magic calls properly as
317 * IPython/iplib.py (handle_magic): log magic calls properly as
313 ipmagic() function calls.
318 ipmagic() function calls.
314
319
315 * IPython/Magic.py (magic_time): Improved %time to support
320 * IPython/Magic.py (magic_time): Improved %time to support
316 statements and provide wall-clock as well as CPU time.
321 statements and provide wall-clock as well as CPU time.
317
322
318 2005-02-27 Fernando Perez <fperez@colorado.edu>
323 2005-02-27 Fernando Perez <fperez@colorado.edu>
319
324
320 * IPython/hooks.py: New hooks module, to expose user-modifiable
325 * IPython/hooks.py: New hooks module, to expose user-modifiable
321 IPython functionality in a clean manner. For now only the editor
326 IPython functionality in a clean manner. For now only the editor
322 hook is actually written, and other thigns which I intend to turn
327 hook is actually written, and other thigns which I intend to turn
323 into proper hooks aren't yet there. The display and prefilter
328 into proper hooks aren't yet there. The display and prefilter
324 stuff, for example, should be hooks. But at least now the
329 stuff, for example, should be hooks. But at least now the
325 framework is in place, and the rest can be moved here with more
330 framework is in place, and the rest can be moved here with more
326 time later. IPython had had a .hooks variable for a long time for
331 time later. IPython had had a .hooks variable for a long time for
327 this purpose, but I'd never actually used it for anything.
332 this purpose, but I'd never actually used it for anything.
328
333
329 2005-02-26 Fernando Perez <fperez@colorado.edu>
334 2005-02-26 Fernando Perez <fperez@colorado.edu>
330
335
331 * IPython/ipmaker.py (make_IPython): make the default ipython
336 * IPython/ipmaker.py (make_IPython): make the default ipython
332 directory be called _ipython under win32, to follow more the
337 directory be called _ipython under win32, to follow more the
333 naming peculiarities of that platform (where buggy software like
338 naming peculiarities of that platform (where buggy software like
334 Visual Sourcesafe breaks with .named directories). Reported by
339 Visual Sourcesafe breaks with .named directories). Reported by
335 Ville Vainio.
340 Ville Vainio.
336
341
337 2005-02-23 Fernando Perez <fperez@colorado.edu>
342 2005-02-23 Fernando Perez <fperez@colorado.edu>
338
343
339 * IPython/iplib.py (InteractiveShell.__init__): removed a few
344 * IPython/iplib.py (InteractiveShell.__init__): removed a few
340 auto_aliases for win32 which were causing problems. Users can
345 auto_aliases for win32 which were causing problems. Users can
341 define the ones they personally like.
346 define the ones they personally like.
342
347
343 2005-02-21 Fernando Perez <fperez@colorado.edu>
348 2005-02-21 Fernando Perez <fperez@colorado.edu>
344
349
345 * IPython/Magic.py (magic_time): new magic to time execution of
350 * IPython/Magic.py (magic_time): new magic to time execution of
346 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
351 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
347
352
348 2005-02-19 Fernando Perez <fperez@colorado.edu>
353 2005-02-19 Fernando Perez <fperez@colorado.edu>
349
354
350 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
355 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
351 into keys (for prompts, for example).
356 into keys (for prompts, for example).
352
357
353 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
358 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
354 prompts in case users want them. This introduces a small behavior
359 prompts in case users want them. This introduces a small behavior
355 change: ipython does not automatically add a space to all prompts
360 change: ipython does not automatically add a space to all prompts
356 anymore. To get the old prompts with a space, users should add it
361 anymore. To get the old prompts with a space, users should add it
357 manually to their ipythonrc file, so for example prompt_in1 should
362 manually to their ipythonrc file, so for example prompt_in1 should
358 now read 'In [\#]: ' instead of 'In [\#]:'.
363 now read 'In [\#]: ' instead of 'In [\#]:'.
359 (BasePrompt.__init__): New option prompts_pad_left (only in rc
364 (BasePrompt.__init__): New option prompts_pad_left (only in rc
360 file) to control left-padding of secondary prompts.
365 file) to control left-padding of secondary prompts.
361
366
362 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
367 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
363 the profiler can't be imported. Fix for Debian, which removed
368 the profiler can't be imported. Fix for Debian, which removed
364 profile.py because of License issues. I applied a slightly
369 profile.py because of License issues. I applied a slightly
365 modified version of the original Debian patch at
370 modified version of the original Debian patch at
366 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
371 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
367
372
368 2005-02-17 Fernando Perez <fperez@colorado.edu>
373 2005-02-17 Fernando Perez <fperez@colorado.edu>
369
374
370 * IPython/genutils.py (native_line_ends): Fix bug which would
375 * IPython/genutils.py (native_line_ends): Fix bug which would
371 cause improper line-ends under win32 b/c I was not opening files
376 cause improper line-ends under win32 b/c I was not opening files
372 in binary mode. Bug report and fix thanks to Ville.
377 in binary mode. Bug report and fix thanks to Ville.
373
378
374 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
379 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
375 trying to catch spurious foo[1] autocalls. My fix actually broke
380 trying to catch spurious foo[1] autocalls. My fix actually broke
376 ',/' autoquote/call with explicit escape (bad regexp).
381 ',/' autoquote/call with explicit escape (bad regexp).
377
382
378 2005-02-15 *** Released version 0.6.11
383 2005-02-15 *** Released version 0.6.11
379
384
380 2005-02-14 Fernando Perez <fperez@colorado.edu>
385 2005-02-14 Fernando Perez <fperez@colorado.edu>
381
386
382 * IPython/background_jobs.py: New background job management
387 * IPython/background_jobs.py: New background job management
383 subsystem. This is implemented via a new set of classes, and
388 subsystem. This is implemented via a new set of classes, and
384 IPython now provides a builtin 'jobs' object for background job
389 IPython now provides a builtin 'jobs' object for background job
385 execution. A convenience %bg magic serves as a lightweight
390 execution. A convenience %bg magic serves as a lightweight
386 frontend for starting the more common type of calls. This was
391 frontend for starting the more common type of calls. This was
387 inspired by discussions with B. Granger and the BackgroundCommand
392 inspired by discussions with B. Granger and the BackgroundCommand
388 class described in the book Python Scripting for Computational
393 class described in the book Python Scripting for Computational
389 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
394 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
390 (although ultimately no code from this text was used, as IPython's
395 (although ultimately no code from this text was used, as IPython's
391 system is a separate implementation).
396 system is a separate implementation).
392
397
393 * IPython/iplib.py (MagicCompleter.python_matches): add new option
398 * IPython/iplib.py (MagicCompleter.python_matches): add new option
394 to control the completion of single/double underscore names
399 to control the completion of single/double underscore names
395 separately. As documented in the example ipytonrc file, the
400 separately. As documented in the example ipytonrc file, the
396 readline_omit__names variable can now be set to 2, to omit even
401 readline_omit__names variable can now be set to 2, to omit even
397 single underscore names. Thanks to a patch by Brian Wong
402 single underscore names. Thanks to a patch by Brian Wong
398 <BrianWong-AT-AirgoNetworks.Com>.
403 <BrianWong-AT-AirgoNetworks.Com>.
399 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
404 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
400 be autocalled as foo([1]) if foo were callable. A problem for
405 be autocalled as foo([1]) if foo were callable. A problem for
401 things which are both callable and implement __getitem__.
406 things which are both callable and implement __getitem__.
402 (init_readline): Fix autoindentation for win32. Thanks to a patch
407 (init_readline): Fix autoindentation for win32. Thanks to a patch
403 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
408 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
404
409
405 2005-02-12 Fernando Perez <fperez@colorado.edu>
410 2005-02-12 Fernando Perez <fperez@colorado.edu>
406
411
407 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
412 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
408 which I had written long ago to sort out user error messages which
413 which I had written long ago to sort out user error messages which
409 may occur during startup. This seemed like a good idea initially,
414 may occur during startup. This seemed like a good idea initially,
410 but it has proven a disaster in retrospect. I don't want to
415 but it has proven a disaster in retrospect. I don't want to
411 change much code for now, so my fix is to set the internal 'debug'
416 change much code for now, so my fix is to set the internal 'debug'
412 flag to true everywhere, whose only job was precisely to control
417 flag to true everywhere, whose only job was precisely to control
413 this subsystem. This closes issue 28 (as well as avoiding all
418 this subsystem. This closes issue 28 (as well as avoiding all
414 sorts of strange hangups which occur from time to time).
419 sorts of strange hangups which occur from time to time).
415
420
416 2005-02-07 Fernando Perez <fperez@colorado.edu>
421 2005-02-07 Fernando Perez <fperez@colorado.edu>
417
422
418 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
423 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
419 previous call produced a syntax error.
424 previous call produced a syntax error.
420
425
421 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
426 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
422 classes without constructor.
427 classes without constructor.
423
428
424 2005-02-06 Fernando Perez <fperez@colorado.edu>
429 2005-02-06 Fernando Perez <fperez@colorado.edu>
425
430
426 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
431 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
427 completions with the results of each matcher, so we return results
432 completions with the results of each matcher, so we return results
428 to the user from all namespaces. This breaks with ipython
433 to the user from all namespaces. This breaks with ipython
429 tradition, but I think it's a nicer behavior. Now you get all
434 tradition, but I think it's a nicer behavior. Now you get all
430 possible completions listed, from all possible namespaces (python,
435 possible completions listed, from all possible namespaces (python,
431 filesystem, magics...) After a request by John Hunter
436 filesystem, magics...) After a request by John Hunter
432 <jdhunter-AT-nitace.bsd.uchicago.edu>.
437 <jdhunter-AT-nitace.bsd.uchicago.edu>.
433
438
434 2005-02-05 Fernando Perez <fperez@colorado.edu>
439 2005-02-05 Fernando Perez <fperez@colorado.edu>
435
440
436 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
441 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
437 the call had quote characters in it (the quotes were stripped).
442 the call had quote characters in it (the quotes were stripped).
438
443
439 2005-01-31 Fernando Perez <fperez@colorado.edu>
444 2005-01-31 Fernando Perez <fperez@colorado.edu>
440
445
441 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
446 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
442 Itpl.itpl() to make the code more robust against psyco
447 Itpl.itpl() to make the code more robust against psyco
443 optimizations.
448 optimizations.
444
449
445 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
450 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
446 of causing an exception. Quicker, cleaner.
451 of causing an exception. Quicker, cleaner.
447
452
448 2005-01-28 Fernando Perez <fperez@colorado.edu>
453 2005-01-28 Fernando Perez <fperez@colorado.edu>
449
454
450 * scripts/ipython_win_post_install.py (install): hardcode
455 * scripts/ipython_win_post_install.py (install): hardcode
451 sys.prefix+'python.exe' as the executable path. It turns out that
456 sys.prefix+'python.exe' as the executable path. It turns out that
452 during the post-installation run, sys.executable resolves to the
457 during the post-installation run, sys.executable resolves to the
453 name of the binary installer! I should report this as a distutils
458 name of the binary installer! I should report this as a distutils
454 bug, I think. I updated the .10 release with this tiny fix, to
459 bug, I think. I updated the .10 release with this tiny fix, to
455 avoid annoying the lists further.
460 avoid annoying the lists further.
456
461
457 2005-01-27 *** Released version 0.6.10
462 2005-01-27 *** Released version 0.6.10
458
463
459 2005-01-27 Fernando Perez <fperez@colorado.edu>
464 2005-01-27 Fernando Perez <fperez@colorado.edu>
460
465
461 * IPython/numutils.py (norm): Added 'inf' as optional name for
466 * IPython/numutils.py (norm): Added 'inf' as optional name for
462 L-infinity norm, included references to mathworld.com for vector
467 L-infinity norm, included references to mathworld.com for vector
463 norm definitions.
468 norm definitions.
464 (amin/amax): added amin/amax for array min/max. Similar to what
469 (amin/amax): added amin/amax for array min/max. Similar to what
465 pylab ships with after the recent reorganization of names.
470 pylab ships with after the recent reorganization of names.
466 (spike/spike_odd): removed deprecated spike/spike_odd functions.
471 (spike/spike_odd): removed deprecated spike/spike_odd functions.
467
472
468 * ipython.el: committed Alex's recent fixes and improvements.
473 * ipython.el: committed Alex's recent fixes and improvements.
469 Tested with python-mode from CVS, and it looks excellent. Since
474 Tested with python-mode from CVS, and it looks excellent. Since
470 python-mode hasn't released anything in a while, I'm temporarily
475 python-mode hasn't released anything in a while, I'm temporarily
471 putting a copy of today's CVS (v 4.70) of python-mode in:
476 putting a copy of today's CVS (v 4.70) of python-mode in:
472 http://ipython.scipy.org/tmp/python-mode.el
477 http://ipython.scipy.org/tmp/python-mode.el
473
478
474 * scripts/ipython_win_post_install.py (install): Win32 fix to use
479 * scripts/ipython_win_post_install.py (install): Win32 fix to use
475 sys.executable for the executable name, instead of assuming it's
480 sys.executable for the executable name, instead of assuming it's
476 called 'python.exe' (the post-installer would have produced broken
481 called 'python.exe' (the post-installer would have produced broken
477 setups on systems with a differently named python binary).
482 setups on systems with a differently named python binary).
478
483
479 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
484 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
480 references to os.linesep, to make the code more
485 references to os.linesep, to make the code more
481 platform-independent. This is also part of the win32 coloring
486 platform-independent. This is also part of the win32 coloring
482 fixes.
487 fixes.
483
488
484 * IPython/genutils.py (page_dumb): Remove attempts to chop long
489 * IPython/genutils.py (page_dumb): Remove attempts to chop long
485 lines, which actually cause coloring bugs because the length of
490 lines, which actually cause coloring bugs because the length of
486 the line is very difficult to correctly compute with embedded
491 the line is very difficult to correctly compute with embedded
487 escapes. This was the source of all the coloring problems under
492 escapes. This was the source of all the coloring problems under
488 Win32. I think that _finally_, Win32 users have a properly
493 Win32. I think that _finally_, Win32 users have a properly
489 working ipython in all respects. This would never have happened
494 working ipython in all respects. This would never have happened
490 if not for Gary Bishop and Viktor Ransmayr's great help and work.
495 if not for Gary Bishop and Viktor Ransmayr's great help and work.
491
496
492 2005-01-26 *** Released version 0.6.9
497 2005-01-26 *** Released version 0.6.9
493
498
494 2005-01-25 Fernando Perez <fperez@colorado.edu>
499 2005-01-25 Fernando Perez <fperez@colorado.edu>
495
500
496 * setup.py: finally, we have a true Windows installer, thanks to
501 * setup.py: finally, we have a true Windows installer, thanks to
497 the excellent work of Viktor Ransmayr
502 the excellent work of Viktor Ransmayr
498 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
503 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
499 Windows users. The setup routine is quite a bit cleaner thanks to
504 Windows users. The setup routine is quite a bit cleaner thanks to
500 this, and the post-install script uses the proper functions to
505 this, and the post-install script uses the proper functions to
501 allow a clean de-installation using the standard Windows Control
506 allow a clean de-installation using the standard Windows Control
502 Panel.
507 Panel.
503
508
504 * IPython/genutils.py (get_home_dir): changed to use the $HOME
509 * IPython/genutils.py (get_home_dir): changed to use the $HOME
505 environment variable under all OSes (including win32) if
510 environment variable under all OSes (including win32) if
506 available. This will give consistency to win32 users who have set
511 available. This will give consistency to win32 users who have set
507 this variable for any reason. If os.environ['HOME'] fails, the
512 this variable for any reason. If os.environ['HOME'] fails, the
508 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
513 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
509
514
510 2005-01-24 Fernando Perez <fperez@colorado.edu>
515 2005-01-24 Fernando Perez <fperez@colorado.edu>
511
516
512 * IPython/numutils.py (empty_like): add empty_like(), similar to
517 * IPython/numutils.py (empty_like): add empty_like(), similar to
513 zeros_like() but taking advantage of the new empty() Numeric routine.
518 zeros_like() but taking advantage of the new empty() Numeric routine.
514
519
515 2005-01-23 *** Released version 0.6.8
520 2005-01-23 *** Released version 0.6.8
516
521
517 2005-01-22 Fernando Perez <fperez@colorado.edu>
522 2005-01-22 Fernando Perez <fperez@colorado.edu>
518
523
519 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
524 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
520 automatic show() calls. After discussing things with JDH, it
525 automatic show() calls. After discussing things with JDH, it
521 turns out there are too many corner cases where this can go wrong.
526 turns out there are too many corner cases where this can go wrong.
522 It's best not to try to be 'too smart', and simply have ipython
527 It's best not to try to be 'too smart', and simply have ipython
523 reproduce as much as possible the default behavior of a normal
528 reproduce as much as possible the default behavior of a normal
524 python shell.
529 python shell.
525
530
526 * IPython/iplib.py (InteractiveShell.__init__): Modified the
531 * IPython/iplib.py (InteractiveShell.__init__): Modified the
527 line-splitting regexp and _prefilter() to avoid calling getattr()
532 line-splitting regexp and _prefilter() to avoid calling getattr()
528 on assignments. This closes
533 on assignments. This closes
529 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
534 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
530 readline uses getattr(), so a simple <TAB> keypress is still
535 readline uses getattr(), so a simple <TAB> keypress is still
531 enough to trigger getattr() calls on an object.
536 enough to trigger getattr() calls on an object.
532
537
533 2005-01-21 Fernando Perez <fperez@colorado.edu>
538 2005-01-21 Fernando Perez <fperez@colorado.edu>
534
539
535 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
540 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
536 docstring under pylab so it doesn't mask the original.
541 docstring under pylab so it doesn't mask the original.
537
542
538 2005-01-21 *** Released version 0.6.7
543 2005-01-21 *** Released version 0.6.7
539
544
540 2005-01-21 Fernando Perez <fperez@colorado.edu>
545 2005-01-21 Fernando Perez <fperez@colorado.edu>
541
546
542 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
547 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
543 signal handling for win32 users in multithreaded mode.
548 signal handling for win32 users in multithreaded mode.
544
549
545 2005-01-17 Fernando Perez <fperez@colorado.edu>
550 2005-01-17 Fernando Perez <fperez@colorado.edu>
546
551
547 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
552 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
548 instances with no __init__. After a crash report by Norbert Nemec
553 instances with no __init__. After a crash report by Norbert Nemec
549 <Norbert-AT-nemec-online.de>.
554 <Norbert-AT-nemec-online.de>.
550
555
551 2005-01-14 Fernando Perez <fperez@colorado.edu>
556 2005-01-14 Fernando Perez <fperez@colorado.edu>
552
557
553 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
558 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
554 names for verbose exceptions, when multiple dotted names and the
559 names for verbose exceptions, when multiple dotted names and the
555 'parent' object were present on the same line.
560 'parent' object were present on the same line.
556
561
557 2005-01-11 Fernando Perez <fperez@colorado.edu>
562 2005-01-11 Fernando Perez <fperez@colorado.edu>
558
563
559 * IPython/genutils.py (flag_calls): new utility to trap and flag
564 * IPython/genutils.py (flag_calls): new utility to trap and flag
560 calls in functions. I need it to clean up matplotlib support.
565 calls in functions. I need it to clean up matplotlib support.
561 Also removed some deprecated code in genutils.
566 Also removed some deprecated code in genutils.
562
567
563 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
568 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
564 that matplotlib scripts called with %run, which don't call show()
569 that matplotlib scripts called with %run, which don't call show()
565 themselves, still have their plotting windows open.
570 themselves, still have their plotting windows open.
566
571
567 2005-01-05 Fernando Perez <fperez@colorado.edu>
572 2005-01-05 Fernando Perez <fperez@colorado.edu>
568
573
569 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
574 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
570 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
575 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
571
576
572 2004-12-19 Fernando Perez <fperez@colorado.edu>
577 2004-12-19 Fernando Perez <fperez@colorado.edu>
573
578
574 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
579 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
575 parent_runcode, which was an eyesore. The same result can be
580 parent_runcode, which was an eyesore. The same result can be
576 obtained with Python's regular superclass mechanisms.
581 obtained with Python's regular superclass mechanisms.
577
582
578 2004-12-17 Fernando Perez <fperez@colorado.edu>
583 2004-12-17 Fernando Perez <fperez@colorado.edu>
579
584
580 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
585 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
581 reported by Prabhu.
586 reported by Prabhu.
582 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
587 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
583 sys.stderr) instead of explicitly calling sys.stderr. This helps
588 sys.stderr) instead of explicitly calling sys.stderr. This helps
584 maintain our I/O abstractions clean, for future GUI embeddings.
589 maintain our I/O abstractions clean, for future GUI embeddings.
585
590
586 * IPython/genutils.py (info): added new utility for sys.stderr
591 * IPython/genutils.py (info): added new utility for sys.stderr
587 unified info message handling (thin wrapper around warn()).
592 unified info message handling (thin wrapper around warn()).
588
593
589 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
594 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
590 composite (dotted) names on verbose exceptions.
595 composite (dotted) names on verbose exceptions.
591 (VerboseTB.nullrepr): harden against another kind of errors which
596 (VerboseTB.nullrepr): harden against another kind of errors which
592 Python's inspect module can trigger, and which were crashing
597 Python's inspect module can trigger, and which were crashing
593 IPython. Thanks to a report by Marco Lombardi
598 IPython. Thanks to a report by Marco Lombardi
594 <mlombard-AT-ma010192.hq.eso.org>.
599 <mlombard-AT-ma010192.hq.eso.org>.
595
600
596 2004-12-13 *** Released version 0.6.6
601 2004-12-13 *** Released version 0.6.6
597
602
598 2004-12-12 Fernando Perez <fperez@colorado.edu>
603 2004-12-12 Fernando Perez <fperez@colorado.edu>
599
604
600 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
605 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
601 generated by pygtk upon initialization if it was built without
606 generated by pygtk upon initialization if it was built without
602 threads (for matplotlib users). After a crash reported by
607 threads (for matplotlib users). After a crash reported by
603 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
608 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
604
609
605 * IPython/ipmaker.py (make_IPython): fix small bug in the
610 * IPython/ipmaker.py (make_IPython): fix small bug in the
606 import_some parameter for multiple imports.
611 import_some parameter for multiple imports.
607
612
608 * IPython/iplib.py (ipmagic): simplified the interface of
613 * IPython/iplib.py (ipmagic): simplified the interface of
609 ipmagic() to take a single string argument, just as it would be
614 ipmagic() to take a single string argument, just as it would be
610 typed at the IPython cmd line.
615 typed at the IPython cmd line.
611 (ipalias): Added new ipalias() with an interface identical to
616 (ipalias): Added new ipalias() with an interface identical to
612 ipmagic(). This completes exposing a pure python interface to the
617 ipmagic(). This completes exposing a pure python interface to the
613 alias and magic system, which can be used in loops or more complex
618 alias and magic system, which can be used in loops or more complex
614 code where IPython's automatic line mangling is not active.
619 code where IPython's automatic line mangling is not active.
615
620
616 * IPython/genutils.py (timing): changed interface of timing to
621 * IPython/genutils.py (timing): changed interface of timing to
617 simply run code once, which is the most common case. timings()
622 simply run code once, which is the most common case. timings()
618 remains unchanged, for the cases where you want multiple runs.
623 remains unchanged, for the cases where you want multiple runs.
619
624
620 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
625 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
621 bug where Python2.2 crashes with exec'ing code which does not end
626 bug where Python2.2 crashes with exec'ing code which does not end
622 in a single newline. Python 2.3 is OK, so I hadn't noticed this
627 in a single newline. Python 2.3 is OK, so I hadn't noticed this
623 before.
628 before.
624
629
625 2004-12-10 Fernando Perez <fperez@colorado.edu>
630 2004-12-10 Fernando Perez <fperez@colorado.edu>
626
631
627 * IPython/Magic.py (Magic.magic_prun): changed name of option from
632 * IPython/Magic.py (Magic.magic_prun): changed name of option from
628 -t to -T, to accomodate the new -t flag in %run (the %run and
633 -t to -T, to accomodate the new -t flag in %run (the %run and
629 %prun options are kind of intermixed, and it's not easy to change
634 %prun options are kind of intermixed, and it's not easy to change
630 this with the limitations of python's getopt).
635 this with the limitations of python's getopt).
631
636
632 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
637 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
633 the execution of scripts. It's not as fine-tuned as timeit.py,
638 the execution of scripts. It's not as fine-tuned as timeit.py,
634 but it works from inside ipython (and under 2.2, which lacks
639 but it works from inside ipython (and under 2.2, which lacks
635 timeit.py). Optionally a number of runs > 1 can be given for
640 timeit.py). Optionally a number of runs > 1 can be given for
636 timing very short-running code.
641 timing very short-running code.
637
642
638 * IPython/genutils.py (uniq_stable): new routine which returns a
643 * IPython/genutils.py (uniq_stable): new routine which returns a
639 list of unique elements in any iterable, but in stable order of
644 list of unique elements in any iterable, but in stable order of
640 appearance. I needed this for the ultraTB fixes, and it's a handy
645 appearance. I needed this for the ultraTB fixes, and it's a handy
641 utility.
646 utility.
642
647
643 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
648 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
644 dotted names in Verbose exceptions. This had been broken since
649 dotted names in Verbose exceptions. This had been broken since
645 the very start, now x.y will properly be printed in a Verbose
650 the very start, now x.y will properly be printed in a Verbose
646 traceback, instead of x being shown and y appearing always as an
651 traceback, instead of x being shown and y appearing always as an
647 'undefined global'. Getting this to work was a bit tricky,
652 'undefined global'. Getting this to work was a bit tricky,
648 because by default python tokenizers are stateless. Saved by
653 because by default python tokenizers are stateless. Saved by
649 python's ability to easily add a bit of state to an arbitrary
654 python's ability to easily add a bit of state to an arbitrary
650 function (without needing to build a full-blown callable object).
655 function (without needing to build a full-blown callable object).
651
656
652 Also big cleanup of this code, which had horrendous runtime
657 Also big cleanup of this code, which had horrendous runtime
653 lookups of zillions of attributes for colorization. Moved all
658 lookups of zillions of attributes for colorization. Moved all
654 this code into a few templates, which make it cleaner and quicker.
659 this code into a few templates, which make it cleaner and quicker.
655
660
656 Printout quality was also improved for Verbose exceptions: one
661 Printout quality was also improved for Verbose exceptions: one
657 variable per line, and memory addresses are printed (this can be
662 variable per line, and memory addresses are printed (this can be
658 quite handy in nasty debugging situations, which is what Verbose
663 quite handy in nasty debugging situations, which is what Verbose
659 is for).
664 is for).
660
665
661 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
666 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
662 the command line as scripts to be loaded by embedded instances.
667 the command line as scripts to be loaded by embedded instances.
663 Doing so has the potential for an infinite recursion if there are
668 Doing so has the potential for an infinite recursion if there are
664 exceptions thrown in the process. This fixes a strange crash
669 exceptions thrown in the process. This fixes a strange crash
665 reported by Philippe MULLER <muller-AT-irit.fr>.
670 reported by Philippe MULLER <muller-AT-irit.fr>.
666
671
667 2004-12-09 Fernando Perez <fperez@colorado.edu>
672 2004-12-09 Fernando Perez <fperez@colorado.edu>
668
673
669 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
674 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
670 to reflect new names in matplotlib, which now expose the
675 to reflect new names in matplotlib, which now expose the
671 matlab-compatible interface via a pylab module instead of the
676 matlab-compatible interface via a pylab module instead of the
672 'matlab' name. The new code is backwards compatible, so users of
677 'matlab' name. The new code is backwards compatible, so users of
673 all matplotlib versions are OK. Patch by J. Hunter.
678 all matplotlib versions are OK. Patch by J. Hunter.
674
679
675 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
680 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
676 of __init__ docstrings for instances (class docstrings are already
681 of __init__ docstrings for instances (class docstrings are already
677 automatically printed). Instances with customized docstrings
682 automatically printed). Instances with customized docstrings
678 (indep. of the class) are also recognized and all 3 separate
683 (indep. of the class) are also recognized and all 3 separate
679 docstrings are printed (instance, class, constructor). After some
684 docstrings are printed (instance, class, constructor). After some
680 comments/suggestions by J. Hunter.
685 comments/suggestions by J. Hunter.
681
686
682 2004-12-05 Fernando Perez <fperez@colorado.edu>
687 2004-12-05 Fernando Perez <fperez@colorado.edu>
683
688
684 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
689 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
685 warnings when tab-completion fails and triggers an exception.
690 warnings when tab-completion fails and triggers an exception.
686
691
687 2004-12-03 Fernando Perez <fperez@colorado.edu>
692 2004-12-03 Fernando Perez <fperez@colorado.edu>
688
693
689 * IPython/Magic.py (magic_prun): Fix bug where an exception would
694 * IPython/Magic.py (magic_prun): Fix bug where an exception would
690 be triggered when using 'run -p'. An incorrect option flag was
695 be triggered when using 'run -p'. An incorrect option flag was
691 being set ('d' instead of 'D').
696 being set ('d' instead of 'D').
692 (manpage): fix missing escaped \- sign.
697 (manpage): fix missing escaped \- sign.
693
698
694 2004-11-30 *** Released version 0.6.5
699 2004-11-30 *** Released version 0.6.5
695
700
696 2004-11-30 Fernando Perez <fperez@colorado.edu>
701 2004-11-30 Fernando Perez <fperez@colorado.edu>
697
702
698 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
703 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
699 setting with -d option.
704 setting with -d option.
700
705
701 * setup.py (docfiles): Fix problem where the doc glob I was using
706 * setup.py (docfiles): Fix problem where the doc glob I was using
702 was COMPLETELY BROKEN. It was giving the right files by pure
707 was COMPLETELY BROKEN. It was giving the right files by pure
703 accident, but failed once I tried to include ipython.el. Note:
708 accident, but failed once I tried to include ipython.el. Note:
704 glob() does NOT allow you to do exclusion on multiple endings!
709 glob() does NOT allow you to do exclusion on multiple endings!
705
710
706 2004-11-29 Fernando Perez <fperez@colorado.edu>
711 2004-11-29 Fernando Perez <fperez@colorado.edu>
707
712
708 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
713 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
709 the manpage as the source. Better formatting & consistency.
714 the manpage as the source. Better formatting & consistency.
710
715
711 * IPython/Magic.py (magic_run): Added new -d option, to run
716 * IPython/Magic.py (magic_run): Added new -d option, to run
712 scripts under the control of the python pdb debugger. Note that
717 scripts under the control of the python pdb debugger. Note that
713 this required changing the %prun option -d to -D, to avoid a clash
718 this required changing the %prun option -d to -D, to avoid a clash
714 (since %run must pass options to %prun, and getopt is too dumb to
719 (since %run must pass options to %prun, and getopt is too dumb to
715 handle options with string values with embedded spaces). Thanks
720 handle options with string values with embedded spaces). Thanks
716 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
721 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
717 (magic_who_ls): added type matching to %who and %whos, so that one
722 (magic_who_ls): added type matching to %who and %whos, so that one
718 can filter their output to only include variables of certain
723 can filter their output to only include variables of certain
719 types. Another suggestion by Matthew.
724 types. Another suggestion by Matthew.
720 (magic_whos): Added memory summaries in kb and Mb for arrays.
725 (magic_whos): Added memory summaries in kb and Mb for arrays.
721 (magic_who): Improve formatting (break lines every 9 vars).
726 (magic_who): Improve formatting (break lines every 9 vars).
722
727
723 2004-11-28 Fernando Perez <fperez@colorado.edu>
728 2004-11-28 Fernando Perez <fperez@colorado.edu>
724
729
725 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
730 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
726 cache when empty lines were present.
731 cache when empty lines were present.
727
732
728 2004-11-24 Fernando Perez <fperez@colorado.edu>
733 2004-11-24 Fernando Perez <fperez@colorado.edu>
729
734
730 * IPython/usage.py (__doc__): document the re-activated threading
735 * IPython/usage.py (__doc__): document the re-activated threading
731 options for WX and GTK.
736 options for WX and GTK.
732
737
733 2004-11-23 Fernando Perez <fperez@colorado.edu>
738 2004-11-23 Fernando Perez <fperez@colorado.edu>
734
739
735 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
740 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
736 the -wthread and -gthread options, along with a new -tk one to try
741 the -wthread and -gthread options, along with a new -tk one to try
737 and coordinate Tk threading with wx/gtk. The tk support is very
742 and coordinate Tk threading with wx/gtk. The tk support is very
738 platform dependent, since it seems to require Tcl and Tk to be
743 platform dependent, since it seems to require Tcl and Tk to be
739 built with threads (Fedora1/2 appears NOT to have it, but in
744 built with threads (Fedora1/2 appears NOT to have it, but in
740 Prabhu's Debian boxes it works OK). But even with some Tk
745 Prabhu's Debian boxes it works OK). But even with some Tk
741 limitations, this is a great improvement.
746 limitations, this is a great improvement.
742
747
743 * IPython/Prompts.py (prompt_specials_color): Added \t for time
748 * IPython/Prompts.py (prompt_specials_color): Added \t for time
744 info in user prompts. Patch by Prabhu.
749 info in user prompts. Patch by Prabhu.
745
750
746 2004-11-18 Fernando Perez <fperez@colorado.edu>
751 2004-11-18 Fernando Perez <fperez@colorado.edu>
747
752
748 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
753 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
749 EOFErrors and bail, to avoid infinite loops if a non-terminating
754 EOFErrors and bail, to avoid infinite loops if a non-terminating
750 file is fed into ipython. Patch submitted in issue 19 by user,
755 file is fed into ipython. Patch submitted in issue 19 by user,
751 many thanks.
756 many thanks.
752
757
753 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
758 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
754 autoquote/parens in continuation prompts, which can cause lots of
759 autoquote/parens in continuation prompts, which can cause lots of
755 problems. Closes roundup issue 20.
760 problems. Closes roundup issue 20.
756
761
757 2004-11-17 Fernando Perez <fperez@colorado.edu>
762 2004-11-17 Fernando Perez <fperez@colorado.edu>
758
763
759 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
764 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
760 reported as debian bug #280505. I'm not sure my local changelog
765 reported as debian bug #280505. I'm not sure my local changelog
761 entry has the proper debian format (Jack?).
766 entry has the proper debian format (Jack?).
762
767
763 2004-11-08 *** Released version 0.6.4
768 2004-11-08 *** Released version 0.6.4
764
769
765 2004-11-08 Fernando Perez <fperez@colorado.edu>
770 2004-11-08 Fernando Perez <fperez@colorado.edu>
766
771
767 * IPython/iplib.py (init_readline): Fix exit message for Windows
772 * IPython/iplib.py (init_readline): Fix exit message for Windows
768 when readline is active. Thanks to a report by Eric Jones
773 when readline is active. Thanks to a report by Eric Jones
769 <eric-AT-enthought.com>.
774 <eric-AT-enthought.com>.
770
775
771 2004-11-07 Fernando Perez <fperez@colorado.edu>
776 2004-11-07 Fernando Perez <fperez@colorado.edu>
772
777
773 * IPython/genutils.py (page): Add a trap for OSError exceptions,
778 * IPython/genutils.py (page): Add a trap for OSError exceptions,
774 sometimes seen by win2k/cygwin users.
779 sometimes seen by win2k/cygwin users.
775
780
776 2004-11-06 Fernando Perez <fperez@colorado.edu>
781 2004-11-06 Fernando Perez <fperez@colorado.edu>
777
782
778 * IPython/iplib.py (interact): Change the handling of %Exit from
783 * IPython/iplib.py (interact): Change the handling of %Exit from
779 trying to propagate a SystemExit to an internal ipython flag.
784 trying to propagate a SystemExit to an internal ipython flag.
780 This is less elegant than using Python's exception mechanism, but
785 This is less elegant than using Python's exception mechanism, but
781 I can't get that to work reliably with threads, so under -pylab
786 I can't get that to work reliably with threads, so under -pylab
782 %Exit was hanging IPython. Cross-thread exception handling is
787 %Exit was hanging IPython. Cross-thread exception handling is
783 really a bitch. Thaks to a bug report by Stephen Walton
788 really a bitch. Thaks to a bug report by Stephen Walton
784 <stephen.walton-AT-csun.edu>.
789 <stephen.walton-AT-csun.edu>.
785
790
786 2004-11-04 Fernando Perez <fperez@colorado.edu>
791 2004-11-04 Fernando Perez <fperez@colorado.edu>
787
792
788 * IPython/iplib.py (raw_input_original): store a pointer to the
793 * IPython/iplib.py (raw_input_original): store a pointer to the
789 true raw_input to harden against code which can modify it
794 true raw_input to harden against code which can modify it
790 (wx.py.PyShell does this and would otherwise crash ipython).
795 (wx.py.PyShell does this and would otherwise crash ipython).
791 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
796 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
792
797
793 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
798 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
794 Ctrl-C problem, which does not mess up the input line.
799 Ctrl-C problem, which does not mess up the input line.
795
800
796 2004-11-03 Fernando Perez <fperez@colorado.edu>
801 2004-11-03 Fernando Perez <fperez@colorado.edu>
797
802
798 * IPython/Release.py: Changed licensing to BSD, in all files.
803 * IPython/Release.py: Changed licensing to BSD, in all files.
799 (name): lowercase name for tarball/RPM release.
804 (name): lowercase name for tarball/RPM release.
800
805
801 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
806 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
802 use throughout ipython.
807 use throughout ipython.
803
808
804 * IPython/Magic.py (Magic._ofind): Switch to using the new
809 * IPython/Magic.py (Magic._ofind): Switch to using the new
805 OInspect.getdoc() function.
810 OInspect.getdoc() function.
806
811
807 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
812 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
808 of the line currently being canceled via Ctrl-C. It's extremely
813 of the line currently being canceled via Ctrl-C. It's extremely
809 ugly, but I don't know how to do it better (the problem is one of
814 ugly, but I don't know how to do it better (the problem is one of
810 handling cross-thread exceptions).
815 handling cross-thread exceptions).
811
816
812 2004-10-28 Fernando Perez <fperez@colorado.edu>
817 2004-10-28 Fernando Perez <fperez@colorado.edu>
813
818
814 * IPython/Shell.py (signal_handler): add signal handlers to trap
819 * IPython/Shell.py (signal_handler): add signal handlers to trap
815 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
820 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
816 report by Francesc Alted.
821 report by Francesc Alted.
817
822
818 2004-10-21 Fernando Perez <fperez@colorado.edu>
823 2004-10-21 Fernando Perez <fperez@colorado.edu>
819
824
820 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
825 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
821 to % for pysh syntax extensions.
826 to % for pysh syntax extensions.
822
827
823 2004-10-09 Fernando Perez <fperez@colorado.edu>
828 2004-10-09 Fernando Perez <fperez@colorado.edu>
824
829
825 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
830 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
826 arrays to print a more useful summary, without calling str(arr).
831 arrays to print a more useful summary, without calling str(arr).
827 This avoids the problem of extremely lengthy computations which
832 This avoids the problem of extremely lengthy computations which
828 occur if arr is large, and appear to the user as a system lockup
833 occur if arr is large, and appear to the user as a system lockup
829 with 100% cpu activity. After a suggestion by Kristian Sandberg
834 with 100% cpu activity. After a suggestion by Kristian Sandberg
830 <Kristian.Sandberg@colorado.edu>.
835 <Kristian.Sandberg@colorado.edu>.
831 (Magic.__init__): fix bug in global magic escapes not being
836 (Magic.__init__): fix bug in global magic escapes not being
832 correctly set.
837 correctly set.
833
838
834 2004-10-08 Fernando Perez <fperez@colorado.edu>
839 2004-10-08 Fernando Perez <fperez@colorado.edu>
835
840
836 * IPython/Magic.py (__license__): change to absolute imports of
841 * IPython/Magic.py (__license__): change to absolute imports of
837 ipython's own internal packages, to start adapting to the absolute
842 ipython's own internal packages, to start adapting to the absolute
838 import requirement of PEP-328.
843 import requirement of PEP-328.
839
844
840 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
845 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
841 files, and standardize author/license marks through the Release
846 files, and standardize author/license marks through the Release
842 module instead of having per/file stuff (except for files with
847 module instead of having per/file stuff (except for files with
843 particular licenses, like the MIT/PSF-licensed codes).
848 particular licenses, like the MIT/PSF-licensed codes).
844
849
845 * IPython/Debugger.py: remove dead code for python 2.1
850 * IPython/Debugger.py: remove dead code for python 2.1
846
851
847 2004-10-04 Fernando Perez <fperez@colorado.edu>
852 2004-10-04 Fernando Perez <fperez@colorado.edu>
848
853
849 * IPython/iplib.py (ipmagic): New function for accessing magics
854 * IPython/iplib.py (ipmagic): New function for accessing magics
850 via a normal python function call.
855 via a normal python function call.
851
856
852 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
857 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
853 from '@' to '%', to accomodate the new @decorator syntax of python
858 from '@' to '%', to accomodate the new @decorator syntax of python
854 2.4.
859 2.4.
855
860
856 2004-09-29 Fernando Perez <fperez@colorado.edu>
861 2004-09-29 Fernando Perez <fperez@colorado.edu>
857
862
858 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
863 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
859 matplotlib.use to prevent running scripts which try to switch
864 matplotlib.use to prevent running scripts which try to switch
860 interactive backends from within ipython. This will just crash
865 interactive backends from within ipython. This will just crash
861 the python interpreter, so we can't allow it (but a detailed error
866 the python interpreter, so we can't allow it (but a detailed error
862 is given to the user).
867 is given to the user).
863
868
864 2004-09-28 Fernando Perez <fperez@colorado.edu>
869 2004-09-28 Fernando Perez <fperez@colorado.edu>
865
870
866 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
871 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
867 matplotlib-related fixes so that using @run with non-matplotlib
872 matplotlib-related fixes so that using @run with non-matplotlib
868 scripts doesn't pop up spurious plot windows. This requires
873 scripts doesn't pop up spurious plot windows. This requires
869 matplotlib >= 0.63, where I had to make some changes as well.
874 matplotlib >= 0.63, where I had to make some changes as well.
870
875
871 * IPython/ipmaker.py (make_IPython): update version requirement to
876 * IPython/ipmaker.py (make_IPython): update version requirement to
872 python 2.2.
877 python 2.2.
873
878
874 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
879 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
875 banner arg for embedded customization.
880 banner arg for embedded customization.
876
881
877 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
882 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
878 explicit uses of __IP as the IPython's instance name. Now things
883 explicit uses of __IP as the IPython's instance name. Now things
879 are properly handled via the shell.name value. The actual code
884 are properly handled via the shell.name value. The actual code
880 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
885 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
881 is much better than before. I'll clean things completely when the
886 is much better than before. I'll clean things completely when the
882 magic stuff gets a real overhaul.
887 magic stuff gets a real overhaul.
883
888
884 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
889 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
885 minor changes to debian dir.
890 minor changes to debian dir.
886
891
887 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
892 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
888 pointer to the shell itself in the interactive namespace even when
893 pointer to the shell itself in the interactive namespace even when
889 a user-supplied dict is provided. This is needed for embedding
894 a user-supplied dict is provided. This is needed for embedding
890 purposes (found by tests with Michel Sanner).
895 purposes (found by tests with Michel Sanner).
891
896
892 2004-09-27 Fernando Perez <fperez@colorado.edu>
897 2004-09-27 Fernando Perez <fperez@colorado.edu>
893
898
894 * IPython/UserConfig/ipythonrc: remove []{} from
899 * IPython/UserConfig/ipythonrc: remove []{} from
895 readline_remove_delims, so that things like [modname.<TAB> do
900 readline_remove_delims, so that things like [modname.<TAB> do
896 proper completion. This disables [].TAB, but that's a less common
901 proper completion. This disables [].TAB, but that's a less common
897 case than module names in list comprehensions, for example.
902 case than module names in list comprehensions, for example.
898 Thanks to a report by Andrea Riciputi.
903 Thanks to a report by Andrea Riciputi.
899
904
900 2004-09-09 Fernando Perez <fperez@colorado.edu>
905 2004-09-09 Fernando Perez <fperez@colorado.edu>
901
906
902 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
907 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
903 blocking problems in win32 and osx. Fix by John.
908 blocking problems in win32 and osx. Fix by John.
904
909
905 2004-09-08 Fernando Perez <fperez@colorado.edu>
910 2004-09-08 Fernando Perez <fperez@colorado.edu>
906
911
907 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
912 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
908 for Win32 and OSX. Fix by John Hunter.
913 for Win32 and OSX. Fix by John Hunter.
909
914
910 2004-08-30 *** Released version 0.6.3
915 2004-08-30 *** Released version 0.6.3
911
916
912 2004-08-30 Fernando Perez <fperez@colorado.edu>
917 2004-08-30 Fernando Perez <fperez@colorado.edu>
913
918
914 * setup.py (isfile): Add manpages to list of dependent files to be
919 * setup.py (isfile): Add manpages to list of dependent files to be
915 updated.
920 updated.
916
921
917 2004-08-27 Fernando Perez <fperez@colorado.edu>
922 2004-08-27 Fernando Perez <fperez@colorado.edu>
918
923
919 * IPython/Shell.py (start): I've disabled -wthread and -gthread
924 * IPython/Shell.py (start): I've disabled -wthread and -gthread
920 for now. They don't really work with standalone WX/GTK code
925 for now. They don't really work with standalone WX/GTK code
921 (though matplotlib IS working fine with both of those backends).
926 (though matplotlib IS working fine with both of those backends).
922 This will neeed much more testing. I disabled most things with
927 This will neeed much more testing. I disabled most things with
923 comments, so turning it back on later should be pretty easy.
928 comments, so turning it back on later should be pretty easy.
924
929
925 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
930 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
926 autocalling of expressions like r'foo', by modifying the line
931 autocalling of expressions like r'foo', by modifying the line
927 split regexp. Closes
932 split regexp. Closes
928 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
933 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
929 Riley <ipythonbugs-AT-sabi.net>.
934 Riley <ipythonbugs-AT-sabi.net>.
930 (InteractiveShell.mainloop): honor --nobanner with banner
935 (InteractiveShell.mainloop): honor --nobanner with banner
931 extensions.
936 extensions.
932
937
933 * IPython/Shell.py: Significant refactoring of all classes, so
938 * IPython/Shell.py: Significant refactoring of all classes, so
934 that we can really support ALL matplotlib backends and threading
939 that we can really support ALL matplotlib backends and threading
935 models (John spotted a bug with Tk which required this). Now we
940 models (John spotted a bug with Tk which required this). Now we
936 should support single-threaded, WX-threads and GTK-threads, both
941 should support single-threaded, WX-threads and GTK-threads, both
937 for generic code and for matplotlib.
942 for generic code and for matplotlib.
938
943
939 * IPython/ipmaker.py (__call__): Changed -mpthread option to
944 * IPython/ipmaker.py (__call__): Changed -mpthread option to
940 -pylab, to simplify things for users. Will also remove the pylab
945 -pylab, to simplify things for users. Will also remove the pylab
941 profile, since now all of matplotlib configuration is directly
946 profile, since now all of matplotlib configuration is directly
942 handled here. This also reduces startup time.
947 handled here. This also reduces startup time.
943
948
944 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
949 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
945 shell wasn't being correctly called. Also in IPShellWX.
950 shell wasn't being correctly called. Also in IPShellWX.
946
951
947 * IPython/iplib.py (InteractiveShell.__init__): Added option to
952 * IPython/iplib.py (InteractiveShell.__init__): Added option to
948 fine-tune banner.
953 fine-tune banner.
949
954
950 * IPython/numutils.py (spike): Deprecate these spike functions,
955 * IPython/numutils.py (spike): Deprecate these spike functions,
951 delete (long deprecated) gnuplot_exec handler.
956 delete (long deprecated) gnuplot_exec handler.
952
957
953 2004-08-26 Fernando Perez <fperez@colorado.edu>
958 2004-08-26 Fernando Perez <fperez@colorado.edu>
954
959
955 * ipython.1: Update for threading options, plus some others which
960 * ipython.1: Update for threading options, plus some others which
956 were missing.
961 were missing.
957
962
958 * IPython/ipmaker.py (__call__): Added -wthread option for
963 * IPython/ipmaker.py (__call__): Added -wthread option for
959 wxpython thread handling. Make sure threading options are only
964 wxpython thread handling. Make sure threading options are only
960 valid at the command line.
965 valid at the command line.
961
966
962 * scripts/ipython: moved shell selection into a factory function
967 * scripts/ipython: moved shell selection into a factory function
963 in Shell.py, to keep the starter script to a minimum.
968 in Shell.py, to keep the starter script to a minimum.
964
969
965 2004-08-25 Fernando Perez <fperez@colorado.edu>
970 2004-08-25 Fernando Perez <fperez@colorado.edu>
966
971
967 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
972 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
968 John. Along with some recent changes he made to matplotlib, the
973 John. Along with some recent changes he made to matplotlib, the
969 next versions of both systems should work very well together.
974 next versions of both systems should work very well together.
970
975
971 2004-08-24 Fernando Perez <fperez@colorado.edu>
976 2004-08-24 Fernando Perez <fperez@colorado.edu>
972
977
973 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
978 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
974 tried to switch the profiling to using hotshot, but I'm getting
979 tried to switch the profiling to using hotshot, but I'm getting
975 strange errors from prof.runctx() there. I may be misreading the
980 strange errors from prof.runctx() there. I may be misreading the
976 docs, but it looks weird. For now the profiling code will
981 docs, but it looks weird. For now the profiling code will
977 continue to use the standard profiler.
982 continue to use the standard profiler.
978
983
979 2004-08-23 Fernando Perez <fperez@colorado.edu>
984 2004-08-23 Fernando Perez <fperez@colorado.edu>
980
985
981 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
986 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
982 threaded shell, by John Hunter. It's not quite ready yet, but
987 threaded shell, by John Hunter. It's not quite ready yet, but
983 close.
988 close.
984
989
985 2004-08-22 Fernando Perez <fperez@colorado.edu>
990 2004-08-22 Fernando Perez <fperez@colorado.edu>
986
991
987 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
992 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
988 in Magic and ultraTB.
993 in Magic and ultraTB.
989
994
990 * ipython.1: document threading options in manpage.
995 * ipython.1: document threading options in manpage.
991
996
992 * scripts/ipython: Changed name of -thread option to -gthread,
997 * scripts/ipython: Changed name of -thread option to -gthread,
993 since this is GTK specific. I want to leave the door open for a
998 since this is GTK specific. I want to leave the door open for a
994 -wthread option for WX, which will most likely be necessary. This
999 -wthread option for WX, which will most likely be necessary. This
995 change affects usage and ipmaker as well.
1000 change affects usage and ipmaker as well.
996
1001
997 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1002 * IPython/Shell.py (matplotlib_shell): Add a factory function to
998 handle the matplotlib shell issues. Code by John Hunter
1003 handle the matplotlib shell issues. Code by John Hunter
999 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1004 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1000 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1005 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1001 broken (and disabled for end users) for now, but it puts the
1006 broken (and disabled for end users) for now, but it puts the
1002 infrastructure in place.
1007 infrastructure in place.
1003
1008
1004 2004-08-21 Fernando Perez <fperez@colorado.edu>
1009 2004-08-21 Fernando Perez <fperez@colorado.edu>
1005
1010
1006 * ipythonrc-pylab: Add matplotlib support.
1011 * ipythonrc-pylab: Add matplotlib support.
1007
1012
1008 * matplotlib_config.py: new files for matplotlib support, part of
1013 * matplotlib_config.py: new files for matplotlib support, part of
1009 the pylab profile.
1014 the pylab profile.
1010
1015
1011 * IPython/usage.py (__doc__): documented the threading options.
1016 * IPython/usage.py (__doc__): documented the threading options.
1012
1017
1013 2004-08-20 Fernando Perez <fperez@colorado.edu>
1018 2004-08-20 Fernando Perez <fperez@colorado.edu>
1014
1019
1015 * ipython: Modified the main calling routine to handle the -thread
1020 * ipython: Modified the main calling routine to handle the -thread
1016 and -mpthread options. This needs to be done as a top-level hack,
1021 and -mpthread options. This needs to be done as a top-level hack,
1017 because it determines which class to instantiate for IPython
1022 because it determines which class to instantiate for IPython
1018 itself.
1023 itself.
1019
1024
1020 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1025 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1021 classes to support multithreaded GTK operation without blocking,
1026 classes to support multithreaded GTK operation without blocking,
1022 and matplotlib with all backends. This is a lot of still very
1027 and matplotlib with all backends. This is a lot of still very
1023 experimental code, and threads are tricky. So it may still have a
1028 experimental code, and threads are tricky. So it may still have a
1024 few rough edges... This code owes a lot to
1029 few rough edges... This code owes a lot to
1025 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1030 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1026 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1031 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1027 to John Hunter for all the matplotlib work.
1032 to John Hunter for all the matplotlib work.
1028
1033
1029 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1034 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1030 options for gtk thread and matplotlib support.
1035 options for gtk thread and matplotlib support.
1031
1036
1032 2004-08-16 Fernando Perez <fperez@colorado.edu>
1037 2004-08-16 Fernando Perez <fperez@colorado.edu>
1033
1038
1034 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1039 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1035 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1040 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1036 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1041 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1037
1042
1038 2004-08-11 Fernando Perez <fperez@colorado.edu>
1043 2004-08-11 Fernando Perez <fperez@colorado.edu>
1039
1044
1040 * setup.py (isfile): Fix build so documentation gets updated for
1045 * setup.py (isfile): Fix build so documentation gets updated for
1041 rpms (it was only done for .tgz builds).
1046 rpms (it was only done for .tgz builds).
1042
1047
1043 2004-08-10 Fernando Perez <fperez@colorado.edu>
1048 2004-08-10 Fernando Perez <fperez@colorado.edu>
1044
1049
1045 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1050 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1046
1051
1047 * iplib.py : Silence syntax error exceptions in tab-completion.
1052 * iplib.py : Silence syntax error exceptions in tab-completion.
1048
1053
1049 2004-08-05 Fernando Perez <fperez@colorado.edu>
1054 2004-08-05 Fernando Perez <fperez@colorado.edu>
1050
1055
1051 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1056 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1052 'color off' mark for continuation prompts. This was causing long
1057 'color off' mark for continuation prompts. This was causing long
1053 continuation lines to mis-wrap.
1058 continuation lines to mis-wrap.
1054
1059
1055 2004-08-01 Fernando Perez <fperez@colorado.edu>
1060 2004-08-01 Fernando Perez <fperez@colorado.edu>
1056
1061
1057 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1062 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1058 for building ipython to be a parameter. All this is necessary
1063 for building ipython to be a parameter. All this is necessary
1059 right now to have a multithreaded version, but this insane
1064 right now to have a multithreaded version, but this insane
1060 non-design will be cleaned up soon. For now, it's a hack that
1065 non-design will be cleaned up soon. For now, it's a hack that
1061 works.
1066 works.
1062
1067
1063 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1068 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1064 args in various places. No bugs so far, but it's a dangerous
1069 args in various places. No bugs so far, but it's a dangerous
1065 practice.
1070 practice.
1066
1071
1067 2004-07-31 Fernando Perez <fperez@colorado.edu>
1072 2004-07-31 Fernando Perez <fperez@colorado.edu>
1068
1073
1069 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1074 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1070 fix completion of files with dots in their names under most
1075 fix completion of files with dots in their names under most
1071 profiles (pysh was OK because the completion order is different).
1076 profiles (pysh was OK because the completion order is different).
1072
1077
1073 2004-07-27 Fernando Perez <fperez@colorado.edu>
1078 2004-07-27 Fernando Perez <fperez@colorado.edu>
1074
1079
1075 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1080 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1076 keywords manually, b/c the one in keyword.py was removed in python
1081 keywords manually, b/c the one in keyword.py was removed in python
1077 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1082 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1078 This is NOT a bug under python 2.3 and earlier.
1083 This is NOT a bug under python 2.3 and earlier.
1079
1084
1080 2004-07-26 Fernando Perez <fperez@colorado.edu>
1085 2004-07-26 Fernando Perez <fperez@colorado.edu>
1081
1086
1082 * IPython/ultraTB.py (VerboseTB.text): Add another
1087 * IPython/ultraTB.py (VerboseTB.text): Add another
1083 linecache.checkcache() call to try to prevent inspect.py from
1088 linecache.checkcache() call to try to prevent inspect.py from
1084 crashing under python 2.3. I think this fixes
1089 crashing under python 2.3. I think this fixes
1085 http://www.scipy.net/roundup/ipython/issue17.
1090 http://www.scipy.net/roundup/ipython/issue17.
1086
1091
1087 2004-07-26 *** Released version 0.6.2
1092 2004-07-26 *** Released version 0.6.2
1088
1093
1089 2004-07-26 Fernando Perez <fperez@colorado.edu>
1094 2004-07-26 Fernando Perez <fperez@colorado.edu>
1090
1095
1091 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1096 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1092 fail for any number.
1097 fail for any number.
1093 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1098 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1094 empty bookmarks.
1099 empty bookmarks.
1095
1100
1096 2004-07-26 *** Released version 0.6.1
1101 2004-07-26 *** Released version 0.6.1
1097
1102
1098 2004-07-26 Fernando Perez <fperez@colorado.edu>
1103 2004-07-26 Fernando Perez <fperez@colorado.edu>
1099
1104
1100 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1105 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1101
1106
1102 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1107 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1103 escaping '()[]{}' in filenames.
1108 escaping '()[]{}' in filenames.
1104
1109
1105 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1110 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1106 Python 2.2 users who lack a proper shlex.split.
1111 Python 2.2 users who lack a proper shlex.split.
1107
1112
1108 2004-07-19 Fernando Perez <fperez@colorado.edu>
1113 2004-07-19 Fernando Perez <fperez@colorado.edu>
1109
1114
1110 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1115 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1111 for reading readline's init file. I follow the normal chain:
1116 for reading readline's init file. I follow the normal chain:
1112 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1117 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1113 report by Mike Heeter. This closes
1118 report by Mike Heeter. This closes
1114 http://www.scipy.net/roundup/ipython/issue16.
1119 http://www.scipy.net/roundup/ipython/issue16.
1115
1120
1116 2004-07-18 Fernando Perez <fperez@colorado.edu>
1121 2004-07-18 Fernando Perez <fperez@colorado.edu>
1117
1122
1118 * IPython/iplib.py (__init__): Add better handling of '\' under
1123 * IPython/iplib.py (__init__): Add better handling of '\' under
1119 Win32 for filenames. After a patch by Ville.
1124 Win32 for filenames. After a patch by Ville.
1120
1125
1121 2004-07-17 Fernando Perez <fperez@colorado.edu>
1126 2004-07-17 Fernando Perez <fperez@colorado.edu>
1122
1127
1123 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1128 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1124 autocalling would be triggered for 'foo is bar' if foo is
1129 autocalling would be triggered for 'foo is bar' if foo is
1125 callable. I also cleaned up the autocall detection code to use a
1130 callable. I also cleaned up the autocall detection code to use a
1126 regexp, which is faster. Bug reported by Alexander Schmolck.
1131 regexp, which is faster. Bug reported by Alexander Schmolck.
1127
1132
1128 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1133 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1129 '?' in them would confuse the help system. Reported by Alex
1134 '?' in them would confuse the help system. Reported by Alex
1130 Schmolck.
1135 Schmolck.
1131
1136
1132 2004-07-16 Fernando Perez <fperez@colorado.edu>
1137 2004-07-16 Fernando Perez <fperez@colorado.edu>
1133
1138
1134 * IPython/GnuplotInteractive.py (__all__): added plot2.
1139 * IPython/GnuplotInteractive.py (__all__): added plot2.
1135
1140
1136 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1141 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1137 plotting dictionaries, lists or tuples of 1d arrays.
1142 plotting dictionaries, lists or tuples of 1d arrays.
1138
1143
1139 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1144 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1140 optimizations.
1145 optimizations.
1141
1146
1142 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1147 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1143 the information which was there from Janko's original IPP code:
1148 the information which was there from Janko's original IPP code:
1144
1149
1145 03.05.99 20:53 porto.ifm.uni-kiel.de
1150 03.05.99 20:53 porto.ifm.uni-kiel.de
1146 --Started changelog.
1151 --Started changelog.
1147 --make clear do what it say it does
1152 --make clear do what it say it does
1148 --added pretty output of lines from inputcache
1153 --added pretty output of lines from inputcache
1149 --Made Logger a mixin class, simplifies handling of switches
1154 --Made Logger a mixin class, simplifies handling of switches
1150 --Added own completer class. .string<TAB> expands to last history
1155 --Added own completer class. .string<TAB> expands to last history
1151 line which starts with string. The new expansion is also present
1156 line which starts with string. The new expansion is also present
1152 with Ctrl-r from the readline library. But this shows, who this
1157 with Ctrl-r from the readline library. But this shows, who this
1153 can be done for other cases.
1158 can be done for other cases.
1154 --Added convention that all shell functions should accept a
1159 --Added convention that all shell functions should accept a
1155 parameter_string This opens the door for different behaviour for
1160 parameter_string This opens the door for different behaviour for
1156 each function. @cd is a good example of this.
1161 each function. @cd is a good example of this.
1157
1162
1158 04.05.99 12:12 porto.ifm.uni-kiel.de
1163 04.05.99 12:12 porto.ifm.uni-kiel.de
1159 --added logfile rotation
1164 --added logfile rotation
1160 --added new mainloop method which freezes first the namespace
1165 --added new mainloop method which freezes first the namespace
1161
1166
1162 07.05.99 21:24 porto.ifm.uni-kiel.de
1167 07.05.99 21:24 porto.ifm.uni-kiel.de
1163 --added the docreader classes. Now there is a help system.
1168 --added the docreader classes. Now there is a help system.
1164 -This is only a first try. Currently it's not easy to put new
1169 -This is only a first try. Currently it's not easy to put new
1165 stuff in the indices. But this is the way to go. Info would be
1170 stuff in the indices. But this is the way to go. Info would be
1166 better, but HTML is every where and not everybody has an info
1171 better, but HTML is every where and not everybody has an info
1167 system installed and it's not so easy to change html-docs to info.
1172 system installed and it's not so easy to change html-docs to info.
1168 --added global logfile option
1173 --added global logfile option
1169 --there is now a hook for object inspection method pinfo needs to
1174 --there is now a hook for object inspection method pinfo needs to
1170 be provided for this. Can be reached by two '??'.
1175 be provided for this. Can be reached by two '??'.
1171
1176
1172 08.05.99 20:51 porto.ifm.uni-kiel.de
1177 08.05.99 20:51 porto.ifm.uni-kiel.de
1173 --added a README
1178 --added a README
1174 --bug in rc file. Something has changed so functions in the rc
1179 --bug in rc file. Something has changed so functions in the rc
1175 file need to reference the shell and not self. Not clear if it's a
1180 file need to reference the shell and not self. Not clear if it's a
1176 bug or feature.
1181 bug or feature.
1177 --changed rc file for new behavior
1182 --changed rc file for new behavior
1178
1183
1179 2004-07-15 Fernando Perez <fperez@colorado.edu>
1184 2004-07-15 Fernando Perez <fperez@colorado.edu>
1180
1185
1181 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1186 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1182 cache was falling out of sync in bizarre manners when multi-line
1187 cache was falling out of sync in bizarre manners when multi-line
1183 input was present. Minor optimizations and cleanup.
1188 input was present. Minor optimizations and cleanup.
1184
1189
1185 (Logger): Remove old Changelog info for cleanup. This is the
1190 (Logger): Remove old Changelog info for cleanup. This is the
1186 information which was there from Janko's original code:
1191 information which was there from Janko's original code:
1187
1192
1188 Changes to Logger: - made the default log filename a parameter
1193 Changes to Logger: - made the default log filename a parameter
1189
1194
1190 - put a check for lines beginning with !@? in log(). Needed
1195 - put a check for lines beginning with !@? in log(). Needed
1191 (even if the handlers properly log their lines) for mid-session
1196 (even if the handlers properly log their lines) for mid-session
1192 logging activation to work properly. Without this, lines logged
1197 logging activation to work properly. Without this, lines logged
1193 in mid session, which get read from the cache, would end up
1198 in mid session, which get read from the cache, would end up
1194 'bare' (with !@? in the open) in the log. Now they are caught
1199 'bare' (with !@? in the open) in the log. Now they are caught
1195 and prepended with a #.
1200 and prepended with a #.
1196
1201
1197 * IPython/iplib.py (InteractiveShell.init_readline): added check
1202 * IPython/iplib.py (InteractiveShell.init_readline): added check
1198 in case MagicCompleter fails to be defined, so we don't crash.
1203 in case MagicCompleter fails to be defined, so we don't crash.
1199
1204
1200 2004-07-13 Fernando Perez <fperez@colorado.edu>
1205 2004-07-13 Fernando Perez <fperez@colorado.edu>
1201
1206
1202 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1207 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1203 of EPS if the requested filename ends in '.eps'.
1208 of EPS if the requested filename ends in '.eps'.
1204
1209
1205 2004-07-04 Fernando Perez <fperez@colorado.edu>
1210 2004-07-04 Fernando Perez <fperez@colorado.edu>
1206
1211
1207 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1212 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1208 escaping of quotes when calling the shell.
1213 escaping of quotes when calling the shell.
1209
1214
1210 2004-07-02 Fernando Perez <fperez@colorado.edu>
1215 2004-07-02 Fernando Perez <fperez@colorado.edu>
1211
1216
1212 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1217 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1213 gettext not working because we were clobbering '_'. Fixes
1218 gettext not working because we were clobbering '_'. Fixes
1214 http://www.scipy.net/roundup/ipython/issue6.
1219 http://www.scipy.net/roundup/ipython/issue6.
1215
1220
1216 2004-07-01 Fernando Perez <fperez@colorado.edu>
1221 2004-07-01 Fernando Perez <fperez@colorado.edu>
1217
1222
1218 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1223 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1219 into @cd. Patch by Ville.
1224 into @cd. Patch by Ville.
1220
1225
1221 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1226 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1222 new function to store things after ipmaker runs. Patch by Ville.
1227 new function to store things after ipmaker runs. Patch by Ville.
1223 Eventually this will go away once ipmaker is removed and the class
1228 Eventually this will go away once ipmaker is removed and the class
1224 gets cleaned up, but for now it's ok. Key functionality here is
1229 gets cleaned up, but for now it's ok. Key functionality here is
1225 the addition of the persistent storage mechanism, a dict for
1230 the addition of the persistent storage mechanism, a dict for
1226 keeping data across sessions (for now just bookmarks, but more can
1231 keeping data across sessions (for now just bookmarks, but more can
1227 be implemented later).
1232 be implemented later).
1228
1233
1229 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1234 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1230 persistent across sections. Patch by Ville, I modified it
1235 persistent across sections. Patch by Ville, I modified it
1231 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1236 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1232 added a '-l' option to list all bookmarks.
1237 added a '-l' option to list all bookmarks.
1233
1238
1234 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1239 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1235 center for cleanup. Registered with atexit.register(). I moved
1240 center for cleanup. Registered with atexit.register(). I moved
1236 here the old exit_cleanup(). After a patch by Ville.
1241 here the old exit_cleanup(). After a patch by Ville.
1237
1242
1238 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1243 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1239 characters in the hacked shlex_split for python 2.2.
1244 characters in the hacked shlex_split for python 2.2.
1240
1245
1241 * IPython/iplib.py (file_matches): more fixes to filenames with
1246 * IPython/iplib.py (file_matches): more fixes to filenames with
1242 whitespace in them. It's not perfect, but limitations in python's
1247 whitespace in them. It's not perfect, but limitations in python's
1243 readline make it impossible to go further.
1248 readline make it impossible to go further.
1244
1249
1245 2004-06-29 Fernando Perez <fperez@colorado.edu>
1250 2004-06-29 Fernando Perez <fperez@colorado.edu>
1246
1251
1247 * IPython/iplib.py (file_matches): escape whitespace correctly in
1252 * IPython/iplib.py (file_matches): escape whitespace correctly in
1248 filename completions. Bug reported by Ville.
1253 filename completions. Bug reported by Ville.
1249
1254
1250 2004-06-28 Fernando Perez <fperez@colorado.edu>
1255 2004-06-28 Fernando Perez <fperez@colorado.edu>
1251
1256
1252 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1257 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1253 the history file will be called 'history-PROFNAME' (or just
1258 the history file will be called 'history-PROFNAME' (or just
1254 'history' if no profile is loaded). I was getting annoyed at
1259 'history' if no profile is loaded). I was getting annoyed at
1255 getting my Numerical work history clobbered by pysh sessions.
1260 getting my Numerical work history clobbered by pysh sessions.
1256
1261
1257 * IPython/iplib.py (InteractiveShell.__init__): Internal
1262 * IPython/iplib.py (InteractiveShell.__init__): Internal
1258 getoutputerror() function so that we can honor the system_verbose
1263 getoutputerror() function so that we can honor the system_verbose
1259 flag for _all_ system calls. I also added escaping of #
1264 flag for _all_ system calls. I also added escaping of #
1260 characters here to avoid confusing Itpl.
1265 characters here to avoid confusing Itpl.
1261
1266
1262 * IPython/Magic.py (shlex_split): removed call to shell in
1267 * IPython/Magic.py (shlex_split): removed call to shell in
1263 parse_options and replaced it with shlex.split(). The annoying
1268 parse_options and replaced it with shlex.split(). The annoying
1264 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1269 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1265 to backport it from 2.3, with several frail hacks (the shlex
1270 to backport it from 2.3, with several frail hacks (the shlex
1266 module is rather limited in 2.2). Thanks to a suggestion by Ville
1271 module is rather limited in 2.2). Thanks to a suggestion by Ville
1267 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1272 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1268 problem.
1273 problem.
1269
1274
1270 (Magic.magic_system_verbose): new toggle to print the actual
1275 (Magic.magic_system_verbose): new toggle to print the actual
1271 system calls made by ipython. Mainly for debugging purposes.
1276 system calls made by ipython. Mainly for debugging purposes.
1272
1277
1273 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1278 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1274 doesn't support persistence. Reported (and fix suggested) by
1279 doesn't support persistence. Reported (and fix suggested) by
1275 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1280 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1276
1281
1277 2004-06-26 Fernando Perez <fperez@colorado.edu>
1282 2004-06-26 Fernando Perez <fperez@colorado.edu>
1278
1283
1279 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1284 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1280 continue prompts.
1285 continue prompts.
1281
1286
1282 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1287 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1283 function (basically a big docstring) and a few more things here to
1288 function (basically a big docstring) and a few more things here to
1284 speedup startup. pysh.py is now very lightweight. We want because
1289 speedup startup. pysh.py is now very lightweight. We want because
1285 it gets execfile'd, while InterpreterExec gets imported, so
1290 it gets execfile'd, while InterpreterExec gets imported, so
1286 byte-compilation saves time.
1291 byte-compilation saves time.
1287
1292
1288 2004-06-25 Fernando Perez <fperez@colorado.edu>
1293 2004-06-25 Fernando Perez <fperez@colorado.edu>
1289
1294
1290 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1295 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1291 -NUM', which was recently broken.
1296 -NUM', which was recently broken.
1292
1297
1293 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1298 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1294 in multi-line input (but not !!, which doesn't make sense there).
1299 in multi-line input (but not !!, which doesn't make sense there).
1295
1300
1296 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1301 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1297 It's just too useful, and people can turn it off in the less
1302 It's just too useful, and people can turn it off in the less
1298 common cases where it's a problem.
1303 common cases where it's a problem.
1299
1304
1300 2004-06-24 Fernando Perez <fperez@colorado.edu>
1305 2004-06-24 Fernando Perez <fperez@colorado.edu>
1301
1306
1302 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1307 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1303 special syntaxes (like alias calling) is now allied in multi-line
1308 special syntaxes (like alias calling) is now allied in multi-line
1304 input. This is still _very_ experimental, but it's necessary for
1309 input. This is still _very_ experimental, but it's necessary for
1305 efficient shell usage combining python looping syntax with system
1310 efficient shell usage combining python looping syntax with system
1306 calls. For now it's restricted to aliases, I don't think it
1311 calls. For now it's restricted to aliases, I don't think it
1307 really even makes sense to have this for magics.
1312 really even makes sense to have this for magics.
1308
1313
1309 2004-06-23 Fernando Perez <fperez@colorado.edu>
1314 2004-06-23 Fernando Perez <fperez@colorado.edu>
1310
1315
1311 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1316 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1312 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1317 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1313
1318
1314 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1319 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1315 extensions under Windows (after code sent by Gary Bishop). The
1320 extensions under Windows (after code sent by Gary Bishop). The
1316 extensions considered 'executable' are stored in IPython's rc
1321 extensions considered 'executable' are stored in IPython's rc
1317 structure as win_exec_ext.
1322 structure as win_exec_ext.
1318
1323
1319 * IPython/genutils.py (shell): new function, like system() but
1324 * IPython/genutils.py (shell): new function, like system() but
1320 without return value. Very useful for interactive shell work.
1325 without return value. Very useful for interactive shell work.
1321
1326
1322 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1327 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1323 delete aliases.
1328 delete aliases.
1324
1329
1325 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1330 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1326 sure that the alias table doesn't contain python keywords.
1331 sure that the alias table doesn't contain python keywords.
1327
1332
1328 2004-06-21 Fernando Perez <fperez@colorado.edu>
1333 2004-06-21 Fernando Perez <fperez@colorado.edu>
1329
1334
1330 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1335 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1331 non-existent items are found in $PATH. Reported by Thorsten.
1336 non-existent items are found in $PATH. Reported by Thorsten.
1332
1337
1333 2004-06-20 Fernando Perez <fperez@colorado.edu>
1338 2004-06-20 Fernando Perez <fperez@colorado.edu>
1334
1339
1335 * IPython/iplib.py (complete): modified the completer so that the
1340 * IPython/iplib.py (complete): modified the completer so that the
1336 order of priorities can be easily changed at runtime.
1341 order of priorities can be easily changed at runtime.
1337
1342
1338 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1343 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1339 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1344 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1340
1345
1341 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1346 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1342 expand Python variables prepended with $ in all system calls. The
1347 expand Python variables prepended with $ in all system calls. The
1343 same was done to InteractiveShell.handle_shell_escape. Now all
1348 same was done to InteractiveShell.handle_shell_escape. Now all
1344 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1349 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1345 expansion of python variables and expressions according to the
1350 expansion of python variables and expressions according to the
1346 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1351 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1347
1352
1348 Though PEP-215 has been rejected, a similar (but simpler) one
1353 Though PEP-215 has been rejected, a similar (but simpler) one
1349 seems like it will go into Python 2.4, PEP-292 -
1354 seems like it will go into Python 2.4, PEP-292 -
1350 http://www.python.org/peps/pep-0292.html.
1355 http://www.python.org/peps/pep-0292.html.
1351
1356
1352 I'll keep the full syntax of PEP-215, since IPython has since the
1357 I'll keep the full syntax of PEP-215, since IPython has since the
1353 start used Ka-Ping Yee's reference implementation discussed there
1358 start used Ka-Ping Yee's reference implementation discussed there
1354 (Itpl), and I actually like the powerful semantics it offers.
1359 (Itpl), and I actually like the powerful semantics it offers.
1355
1360
1356 In order to access normal shell variables, the $ has to be escaped
1361 In order to access normal shell variables, the $ has to be escaped
1357 via an extra $. For example:
1362 via an extra $. For example:
1358
1363
1359 In [7]: PATH='a python variable'
1364 In [7]: PATH='a python variable'
1360
1365
1361 In [8]: !echo $PATH
1366 In [8]: !echo $PATH
1362 a python variable
1367 a python variable
1363
1368
1364 In [9]: !echo $$PATH
1369 In [9]: !echo $$PATH
1365 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1370 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1366
1371
1367 (Magic.parse_options): escape $ so the shell doesn't evaluate
1372 (Magic.parse_options): escape $ so the shell doesn't evaluate
1368 things prematurely.
1373 things prematurely.
1369
1374
1370 * IPython/iplib.py (InteractiveShell.call_alias): added the
1375 * IPython/iplib.py (InteractiveShell.call_alias): added the
1371 ability for aliases to expand python variables via $.
1376 ability for aliases to expand python variables via $.
1372
1377
1373 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1378 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1374 system, now there's a @rehash/@rehashx pair of magics. These work
1379 system, now there's a @rehash/@rehashx pair of magics. These work
1375 like the csh rehash command, and can be invoked at any time. They
1380 like the csh rehash command, and can be invoked at any time. They
1376 build a table of aliases to everything in the user's $PATH
1381 build a table of aliases to everything in the user's $PATH
1377 (@rehash uses everything, @rehashx is slower but only adds
1382 (@rehash uses everything, @rehashx is slower but only adds
1378 executable files). With this, the pysh.py-based shell profile can
1383 executable files). With this, the pysh.py-based shell profile can
1379 now simply call rehash upon startup, and full access to all
1384 now simply call rehash upon startup, and full access to all
1380 programs in the user's path is obtained.
1385 programs in the user's path is obtained.
1381
1386
1382 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1387 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1383 functionality is now fully in place. I removed the old dynamic
1388 functionality is now fully in place. I removed the old dynamic
1384 code generation based approach, in favor of a much lighter one
1389 code generation based approach, in favor of a much lighter one
1385 based on a simple dict. The advantage is that this allows me to
1390 based on a simple dict. The advantage is that this allows me to
1386 now have thousands of aliases with negligible cost (unthinkable
1391 now have thousands of aliases with negligible cost (unthinkable
1387 with the old system).
1392 with the old system).
1388
1393
1389 2004-06-19 Fernando Perez <fperez@colorado.edu>
1394 2004-06-19 Fernando Perez <fperez@colorado.edu>
1390
1395
1391 * IPython/iplib.py (__init__): extended MagicCompleter class to
1396 * IPython/iplib.py (__init__): extended MagicCompleter class to
1392 also complete (last in priority) on user aliases.
1397 also complete (last in priority) on user aliases.
1393
1398
1394 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1399 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1395 call to eval.
1400 call to eval.
1396 (ItplNS.__init__): Added a new class which functions like Itpl,
1401 (ItplNS.__init__): Added a new class which functions like Itpl,
1397 but allows configuring the namespace for the evaluation to occur
1402 but allows configuring the namespace for the evaluation to occur
1398 in.
1403 in.
1399
1404
1400 2004-06-18 Fernando Perez <fperez@colorado.edu>
1405 2004-06-18 Fernando Perez <fperez@colorado.edu>
1401
1406
1402 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1407 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1403 better message when 'exit' or 'quit' are typed (a common newbie
1408 better message when 'exit' or 'quit' are typed (a common newbie
1404 confusion).
1409 confusion).
1405
1410
1406 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1411 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1407 check for Windows users.
1412 check for Windows users.
1408
1413
1409 * IPython/iplib.py (InteractiveShell.user_setup): removed
1414 * IPython/iplib.py (InteractiveShell.user_setup): removed
1410 disabling of colors for Windows. I'll test at runtime and issue a
1415 disabling of colors for Windows. I'll test at runtime and issue a
1411 warning if Gary's readline isn't found, as to nudge users to
1416 warning if Gary's readline isn't found, as to nudge users to
1412 download it.
1417 download it.
1413
1418
1414 2004-06-16 Fernando Perez <fperez@colorado.edu>
1419 2004-06-16 Fernando Perez <fperez@colorado.edu>
1415
1420
1416 * IPython/genutils.py (Stream.__init__): changed to print errors
1421 * IPython/genutils.py (Stream.__init__): changed to print errors
1417 to sys.stderr. I had a circular dependency here. Now it's
1422 to sys.stderr. I had a circular dependency here. Now it's
1418 possible to run ipython as IDLE's shell (consider this pre-alpha,
1423 possible to run ipython as IDLE's shell (consider this pre-alpha,
1419 since true stdout things end up in the starting terminal instead
1424 since true stdout things end up in the starting terminal instead
1420 of IDLE's out).
1425 of IDLE's out).
1421
1426
1422 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1427 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1423 users who haven't # updated their prompt_in2 definitions. Remove
1428 users who haven't # updated their prompt_in2 definitions. Remove
1424 eventually.
1429 eventually.
1425 (multiple_replace): added credit to original ASPN recipe.
1430 (multiple_replace): added credit to original ASPN recipe.
1426
1431
1427 2004-06-15 Fernando Perez <fperez@colorado.edu>
1432 2004-06-15 Fernando Perez <fperez@colorado.edu>
1428
1433
1429 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1434 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1430 list of auto-defined aliases.
1435 list of auto-defined aliases.
1431
1436
1432 2004-06-13 Fernando Perez <fperez@colorado.edu>
1437 2004-06-13 Fernando Perez <fperez@colorado.edu>
1433
1438
1434 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1439 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1435 install was really requested (so setup.py can be used for other
1440 install was really requested (so setup.py can be used for other
1436 things under Windows).
1441 things under Windows).
1437
1442
1438 2004-06-10 Fernando Perez <fperez@colorado.edu>
1443 2004-06-10 Fernando Perez <fperez@colorado.edu>
1439
1444
1440 * IPython/Logger.py (Logger.create_log): Manually remove any old
1445 * IPython/Logger.py (Logger.create_log): Manually remove any old
1441 backup, since os.remove may fail under Windows. Fixes bug
1446 backup, since os.remove may fail under Windows. Fixes bug
1442 reported by Thorsten.
1447 reported by Thorsten.
1443
1448
1444 2004-06-09 Fernando Perez <fperez@colorado.edu>
1449 2004-06-09 Fernando Perez <fperez@colorado.edu>
1445
1450
1446 * examples/example-embed.py: fixed all references to %n (replaced
1451 * examples/example-embed.py: fixed all references to %n (replaced
1447 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1452 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1448 for all examples and the manual as well.
1453 for all examples and the manual as well.
1449
1454
1450 2004-06-08 Fernando Perez <fperez@colorado.edu>
1455 2004-06-08 Fernando Perez <fperez@colorado.edu>
1451
1456
1452 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1457 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1453 alignment and color management. All 3 prompt subsystems now
1458 alignment and color management. All 3 prompt subsystems now
1454 inherit from BasePrompt.
1459 inherit from BasePrompt.
1455
1460
1456 * tools/release: updates for windows installer build and tag rpms
1461 * tools/release: updates for windows installer build and tag rpms
1457 with python version (since paths are fixed).
1462 with python version (since paths are fixed).
1458
1463
1459 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1464 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1460 which will become eventually obsolete. Also fixed the default
1465 which will become eventually obsolete. Also fixed the default
1461 prompt_in2 to use \D, so at least new users start with the correct
1466 prompt_in2 to use \D, so at least new users start with the correct
1462 defaults.
1467 defaults.
1463 WARNING: Users with existing ipythonrc files will need to apply
1468 WARNING: Users with existing ipythonrc files will need to apply
1464 this fix manually!
1469 this fix manually!
1465
1470
1466 * setup.py: make windows installer (.exe). This is finally the
1471 * setup.py: make windows installer (.exe). This is finally the
1467 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1472 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1468 which I hadn't included because it required Python 2.3 (or recent
1473 which I hadn't included because it required Python 2.3 (or recent
1469 distutils).
1474 distutils).
1470
1475
1471 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1476 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1472 usage of new '\D' escape.
1477 usage of new '\D' escape.
1473
1478
1474 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1479 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1475 lacks os.getuid())
1480 lacks os.getuid())
1476 (CachedOutput.set_colors): Added the ability to turn coloring
1481 (CachedOutput.set_colors): Added the ability to turn coloring
1477 on/off with @colors even for manually defined prompt colors. It
1482 on/off with @colors even for manually defined prompt colors. It
1478 uses a nasty global, but it works safely and via the generic color
1483 uses a nasty global, but it works safely and via the generic color
1479 handling mechanism.
1484 handling mechanism.
1480 (Prompt2.__init__): Introduced new escape '\D' for continuation
1485 (Prompt2.__init__): Introduced new escape '\D' for continuation
1481 prompts. It represents the counter ('\#') as dots.
1486 prompts. It represents the counter ('\#') as dots.
1482 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1487 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1483 need to update their ipythonrc files and replace '%n' with '\D' in
1488 need to update their ipythonrc files and replace '%n' with '\D' in
1484 their prompt_in2 settings everywhere. Sorry, but there's
1489 their prompt_in2 settings everywhere. Sorry, but there's
1485 otherwise no clean way to get all prompts to properly align. The
1490 otherwise no clean way to get all prompts to properly align. The
1486 ipythonrc shipped with IPython has been updated.
1491 ipythonrc shipped with IPython has been updated.
1487
1492
1488 2004-06-07 Fernando Perez <fperez@colorado.edu>
1493 2004-06-07 Fernando Perez <fperez@colorado.edu>
1489
1494
1490 * setup.py (isfile): Pass local_icons option to latex2html, so the
1495 * setup.py (isfile): Pass local_icons option to latex2html, so the
1491 resulting HTML file is self-contained. Thanks to
1496 resulting HTML file is self-contained. Thanks to
1492 dryice-AT-liu.com.cn for the tip.
1497 dryice-AT-liu.com.cn for the tip.
1493
1498
1494 * pysh.py: I created a new profile 'shell', which implements a
1499 * pysh.py: I created a new profile 'shell', which implements a
1495 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1500 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1496 system shell, nor will it become one anytime soon. It's mainly
1501 system shell, nor will it become one anytime soon. It's mainly
1497 meant to illustrate the use of the new flexible bash-like prompts.
1502 meant to illustrate the use of the new flexible bash-like prompts.
1498 I guess it could be used by hardy souls for true shell management,
1503 I guess it could be used by hardy souls for true shell management,
1499 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1504 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1500 profile. This uses the InterpreterExec extension provided by
1505 profile. This uses the InterpreterExec extension provided by
1501 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1506 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1502
1507
1503 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1508 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1504 auto-align itself with the length of the previous input prompt
1509 auto-align itself with the length of the previous input prompt
1505 (taking into account the invisible color escapes).
1510 (taking into account the invisible color escapes).
1506 (CachedOutput.__init__): Large restructuring of this class. Now
1511 (CachedOutput.__init__): Large restructuring of this class. Now
1507 all three prompts (primary1, primary2, output) are proper objects,
1512 all three prompts (primary1, primary2, output) are proper objects,
1508 managed by the 'parent' CachedOutput class. The code is still a
1513 managed by the 'parent' CachedOutput class. The code is still a
1509 bit hackish (all prompts share state via a pointer to the cache),
1514 bit hackish (all prompts share state via a pointer to the cache),
1510 but it's overall far cleaner than before.
1515 but it's overall far cleaner than before.
1511
1516
1512 * IPython/genutils.py (getoutputerror): modified to add verbose,
1517 * IPython/genutils.py (getoutputerror): modified to add verbose,
1513 debug and header options. This makes the interface of all getout*
1518 debug and header options. This makes the interface of all getout*
1514 functions uniform.
1519 functions uniform.
1515 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1520 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1516
1521
1517 * IPython/Magic.py (Magic.default_option): added a function to
1522 * IPython/Magic.py (Magic.default_option): added a function to
1518 allow registering default options for any magic command. This
1523 allow registering default options for any magic command. This
1519 makes it easy to have profiles which customize the magics globally
1524 makes it easy to have profiles which customize the magics globally
1520 for a certain use. The values set through this function are
1525 for a certain use. The values set through this function are
1521 picked up by the parse_options() method, which all magics should
1526 picked up by the parse_options() method, which all magics should
1522 use to parse their options.
1527 use to parse their options.
1523
1528
1524 * IPython/genutils.py (warn): modified the warnings framework to
1529 * IPython/genutils.py (warn): modified the warnings framework to
1525 use the Term I/O class. I'm trying to slowly unify all of
1530 use the Term I/O class. I'm trying to slowly unify all of
1526 IPython's I/O operations to pass through Term.
1531 IPython's I/O operations to pass through Term.
1527
1532
1528 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1533 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1529 the secondary prompt to correctly match the length of the primary
1534 the secondary prompt to correctly match the length of the primary
1530 one for any prompt. Now multi-line code will properly line up
1535 one for any prompt. Now multi-line code will properly line up
1531 even for path dependent prompts, such as the new ones available
1536 even for path dependent prompts, such as the new ones available
1532 via the prompt_specials.
1537 via the prompt_specials.
1533
1538
1534 2004-06-06 Fernando Perez <fperez@colorado.edu>
1539 2004-06-06 Fernando Perez <fperez@colorado.edu>
1535
1540
1536 * IPython/Prompts.py (prompt_specials): Added the ability to have
1541 * IPython/Prompts.py (prompt_specials): Added the ability to have
1537 bash-like special sequences in the prompts, which get
1542 bash-like special sequences in the prompts, which get
1538 automatically expanded. Things like hostname, current working
1543 automatically expanded. Things like hostname, current working
1539 directory and username are implemented already, but it's easy to
1544 directory and username are implemented already, but it's easy to
1540 add more in the future. Thanks to a patch by W.J. van der Laan
1545 add more in the future. Thanks to a patch by W.J. van der Laan
1541 <gnufnork-AT-hetdigitalegat.nl>
1546 <gnufnork-AT-hetdigitalegat.nl>
1542 (prompt_specials): Added color support for prompt strings, so
1547 (prompt_specials): Added color support for prompt strings, so
1543 users can define arbitrary color setups for their prompts.
1548 users can define arbitrary color setups for their prompts.
1544
1549
1545 2004-06-05 Fernando Perez <fperez@colorado.edu>
1550 2004-06-05 Fernando Perez <fperez@colorado.edu>
1546
1551
1547 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1552 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1548 code to load Gary Bishop's readline and configure it
1553 code to load Gary Bishop's readline and configure it
1549 automatically. Thanks to Gary for help on this.
1554 automatically. Thanks to Gary for help on this.
1550
1555
1551 2004-06-01 Fernando Perez <fperez@colorado.edu>
1556 2004-06-01 Fernando Perez <fperez@colorado.edu>
1552
1557
1553 * IPython/Logger.py (Logger.create_log): fix bug for logging
1558 * IPython/Logger.py (Logger.create_log): fix bug for logging
1554 with no filename (previous fix was incomplete).
1559 with no filename (previous fix was incomplete).
1555
1560
1556 2004-05-25 Fernando Perez <fperez@colorado.edu>
1561 2004-05-25 Fernando Perez <fperez@colorado.edu>
1557
1562
1558 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1563 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1559 parens would get passed to the shell.
1564 parens would get passed to the shell.
1560
1565
1561 2004-05-20 Fernando Perez <fperez@colorado.edu>
1566 2004-05-20 Fernando Perez <fperez@colorado.edu>
1562
1567
1563 * IPython/Magic.py (Magic.magic_prun): changed default profile
1568 * IPython/Magic.py (Magic.magic_prun): changed default profile
1564 sort order to 'time' (the more common profiling need).
1569 sort order to 'time' (the more common profiling need).
1565
1570
1566 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1571 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1567 so that source code shown is guaranteed in sync with the file on
1572 so that source code shown is guaranteed in sync with the file on
1568 disk (also changed in psource). Similar fix to the one for
1573 disk (also changed in psource). Similar fix to the one for
1569 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1574 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1570 <yann.ledu-AT-noos.fr>.
1575 <yann.ledu-AT-noos.fr>.
1571
1576
1572 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1577 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1573 with a single option would not be correctly parsed. Closes
1578 with a single option would not be correctly parsed. Closes
1574 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1579 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1575 introduced in 0.6.0 (on 2004-05-06).
1580 introduced in 0.6.0 (on 2004-05-06).
1576
1581
1577 2004-05-13 *** Released version 0.6.0
1582 2004-05-13 *** Released version 0.6.0
1578
1583
1579 2004-05-13 Fernando Perez <fperez@colorado.edu>
1584 2004-05-13 Fernando Perez <fperez@colorado.edu>
1580
1585
1581 * debian/: Added debian/ directory to CVS, so that debian support
1586 * debian/: Added debian/ directory to CVS, so that debian support
1582 is publicly accessible. The debian package is maintained by Jack
1587 is publicly accessible. The debian package is maintained by Jack
1583 Moffit <jack-AT-xiph.org>.
1588 Moffit <jack-AT-xiph.org>.
1584
1589
1585 * Documentation: included the notes about an ipython-based system
1590 * Documentation: included the notes about an ipython-based system
1586 shell (the hypothetical 'pysh') into the new_design.pdf document,
1591 shell (the hypothetical 'pysh') into the new_design.pdf document,
1587 so that these ideas get distributed to users along with the
1592 so that these ideas get distributed to users along with the
1588 official documentation.
1593 official documentation.
1589
1594
1590 2004-05-10 Fernando Perez <fperez@colorado.edu>
1595 2004-05-10 Fernando Perez <fperez@colorado.edu>
1591
1596
1592 * IPython/Logger.py (Logger.create_log): fix recently introduced
1597 * IPython/Logger.py (Logger.create_log): fix recently introduced
1593 bug (misindented line) where logstart would fail when not given an
1598 bug (misindented line) where logstart would fail when not given an
1594 explicit filename.
1599 explicit filename.
1595
1600
1596 2004-05-09 Fernando Perez <fperez@colorado.edu>
1601 2004-05-09 Fernando Perez <fperez@colorado.edu>
1597
1602
1598 * IPython/Magic.py (Magic.parse_options): skip system call when
1603 * IPython/Magic.py (Magic.parse_options): skip system call when
1599 there are no options to look for. Faster, cleaner for the common
1604 there are no options to look for. Faster, cleaner for the common
1600 case.
1605 case.
1601
1606
1602 * Documentation: many updates to the manual: describing Windows
1607 * Documentation: many updates to the manual: describing Windows
1603 support better, Gnuplot updates, credits, misc small stuff. Also
1608 support better, Gnuplot updates, credits, misc small stuff. Also
1604 updated the new_design doc a bit.
1609 updated the new_design doc a bit.
1605
1610
1606 2004-05-06 *** Released version 0.6.0.rc1
1611 2004-05-06 *** Released version 0.6.0.rc1
1607
1612
1608 2004-05-06 Fernando Perez <fperez@colorado.edu>
1613 2004-05-06 Fernando Perez <fperez@colorado.edu>
1609
1614
1610 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1615 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1611 operations to use the vastly more efficient list/''.join() method.
1616 operations to use the vastly more efficient list/''.join() method.
1612 (FormattedTB.text): Fix
1617 (FormattedTB.text): Fix
1613 http://www.scipy.net/roundup/ipython/issue12 - exception source
1618 http://www.scipy.net/roundup/ipython/issue12 - exception source
1614 extract not updated after reload. Thanks to Mike Salib
1619 extract not updated after reload. Thanks to Mike Salib
1615 <msalib-AT-mit.edu> for pinning the source of the problem.
1620 <msalib-AT-mit.edu> for pinning the source of the problem.
1616 Fortunately, the solution works inside ipython and doesn't require
1621 Fortunately, the solution works inside ipython and doesn't require
1617 any changes to python proper.
1622 any changes to python proper.
1618
1623
1619 * IPython/Magic.py (Magic.parse_options): Improved to process the
1624 * IPython/Magic.py (Magic.parse_options): Improved to process the
1620 argument list as a true shell would (by actually using the
1625 argument list as a true shell would (by actually using the
1621 underlying system shell). This way, all @magics automatically get
1626 underlying system shell). This way, all @magics automatically get
1622 shell expansion for variables. Thanks to a comment by Alex
1627 shell expansion for variables. Thanks to a comment by Alex
1623 Schmolck.
1628 Schmolck.
1624
1629
1625 2004-04-04 Fernando Perez <fperez@colorado.edu>
1630 2004-04-04 Fernando Perez <fperez@colorado.edu>
1626
1631
1627 * IPython/iplib.py (InteractiveShell.interact): Added a special
1632 * IPython/iplib.py (InteractiveShell.interact): Added a special
1628 trap for a debugger quit exception, which is basically impossible
1633 trap for a debugger quit exception, which is basically impossible
1629 to handle by normal mechanisms, given what pdb does to the stack.
1634 to handle by normal mechanisms, given what pdb does to the stack.
1630 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1635 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1631
1636
1632 2004-04-03 Fernando Perez <fperez@colorado.edu>
1637 2004-04-03 Fernando Perez <fperez@colorado.edu>
1633
1638
1634 * IPython/genutils.py (Term): Standardized the names of the Term
1639 * IPython/genutils.py (Term): Standardized the names of the Term
1635 class streams to cin/cout/cerr, following C++ naming conventions
1640 class streams to cin/cout/cerr, following C++ naming conventions
1636 (I can't use in/out/err because 'in' is not a valid attribute
1641 (I can't use in/out/err because 'in' is not a valid attribute
1637 name).
1642 name).
1638
1643
1639 * IPython/iplib.py (InteractiveShell.interact): don't increment
1644 * IPython/iplib.py (InteractiveShell.interact): don't increment
1640 the prompt if there's no user input. By Daniel 'Dang' Griffith
1645 the prompt if there's no user input. By Daniel 'Dang' Griffith
1641 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1646 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1642 Francois Pinard.
1647 Francois Pinard.
1643
1648
1644 2004-04-02 Fernando Perez <fperez@colorado.edu>
1649 2004-04-02 Fernando Perez <fperez@colorado.edu>
1645
1650
1646 * IPython/genutils.py (Stream.__init__): Modified to survive at
1651 * IPython/genutils.py (Stream.__init__): Modified to survive at
1647 least importing in contexts where stdin/out/err aren't true file
1652 least importing in contexts where stdin/out/err aren't true file
1648 objects, such as PyCrust (they lack fileno() and mode). However,
1653 objects, such as PyCrust (they lack fileno() and mode). However,
1649 the recovery facilities which rely on these things existing will
1654 the recovery facilities which rely on these things existing will
1650 not work.
1655 not work.
1651
1656
1652 2004-04-01 Fernando Perez <fperez@colorado.edu>
1657 2004-04-01 Fernando Perez <fperez@colorado.edu>
1653
1658
1654 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1659 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1655 use the new getoutputerror() function, so it properly
1660 use the new getoutputerror() function, so it properly
1656 distinguishes stdout/err.
1661 distinguishes stdout/err.
1657
1662
1658 * IPython/genutils.py (getoutputerror): added a function to
1663 * IPython/genutils.py (getoutputerror): added a function to
1659 capture separately the standard output and error of a command.
1664 capture separately the standard output and error of a command.
1660 After a comment from dang on the mailing lists. This code is
1665 After a comment from dang on the mailing lists. This code is
1661 basically a modified version of commands.getstatusoutput(), from
1666 basically a modified version of commands.getstatusoutput(), from
1662 the standard library.
1667 the standard library.
1663
1668
1664 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1669 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1665 '!!' as a special syntax (shorthand) to access @sx.
1670 '!!' as a special syntax (shorthand) to access @sx.
1666
1671
1667 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1672 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1668 command and return its output as a list split on '\n'.
1673 command and return its output as a list split on '\n'.
1669
1674
1670 2004-03-31 Fernando Perez <fperez@colorado.edu>
1675 2004-03-31 Fernando Perez <fperez@colorado.edu>
1671
1676
1672 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1677 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1673 method to dictionaries used as FakeModule instances if they lack
1678 method to dictionaries used as FakeModule instances if they lack
1674 it. At least pydoc in python2.3 breaks for runtime-defined
1679 it. At least pydoc in python2.3 breaks for runtime-defined
1675 functions without this hack. At some point I need to _really_
1680 functions without this hack. At some point I need to _really_
1676 understand what FakeModule is doing, because it's a gross hack.
1681 understand what FakeModule is doing, because it's a gross hack.
1677 But it solves Arnd's problem for now...
1682 But it solves Arnd's problem for now...
1678
1683
1679 2004-02-27 Fernando Perez <fperez@colorado.edu>
1684 2004-02-27 Fernando Perez <fperez@colorado.edu>
1680
1685
1681 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1686 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1682 mode would behave erratically. Also increased the number of
1687 mode would behave erratically. Also increased the number of
1683 possible logs in rotate mod to 999. Thanks to Rod Holland
1688 possible logs in rotate mod to 999. Thanks to Rod Holland
1684 <rhh@StructureLABS.com> for the report and fixes.
1689 <rhh@StructureLABS.com> for the report and fixes.
1685
1690
1686 2004-02-26 Fernando Perez <fperez@colorado.edu>
1691 2004-02-26 Fernando Perez <fperez@colorado.edu>
1687
1692
1688 * IPython/genutils.py (page): Check that the curses module really
1693 * IPython/genutils.py (page): Check that the curses module really
1689 has the initscr attribute before trying to use it. For some
1694 has the initscr attribute before trying to use it. For some
1690 reason, the Solaris curses module is missing this. I think this
1695 reason, the Solaris curses module is missing this. I think this
1691 should be considered a Solaris python bug, but I'm not sure.
1696 should be considered a Solaris python bug, but I'm not sure.
1692
1697
1693 2004-01-17 Fernando Perez <fperez@colorado.edu>
1698 2004-01-17 Fernando Perez <fperez@colorado.edu>
1694
1699
1695 * IPython/genutils.py (Stream.__init__): Changes to try to make
1700 * IPython/genutils.py (Stream.__init__): Changes to try to make
1696 ipython robust against stdin/out/err being closed by the user.
1701 ipython robust against stdin/out/err being closed by the user.
1697 This is 'user error' (and blocks a normal python session, at least
1702 This is 'user error' (and blocks a normal python session, at least
1698 the stdout case). However, Ipython should be able to survive such
1703 the stdout case). However, Ipython should be able to survive such
1699 instances of abuse as gracefully as possible. To simplify the
1704 instances of abuse as gracefully as possible. To simplify the
1700 coding and maintain compatibility with Gary Bishop's Term
1705 coding and maintain compatibility with Gary Bishop's Term
1701 contributions, I've made use of classmethods for this. I think
1706 contributions, I've made use of classmethods for this. I think
1702 this introduces a dependency on python 2.2.
1707 this introduces a dependency on python 2.2.
1703
1708
1704 2004-01-13 Fernando Perez <fperez@colorado.edu>
1709 2004-01-13 Fernando Perez <fperez@colorado.edu>
1705
1710
1706 * IPython/numutils.py (exp_safe): simplified the code a bit and
1711 * IPython/numutils.py (exp_safe): simplified the code a bit and
1707 removed the need for importing the kinds module altogether.
1712 removed the need for importing the kinds module altogether.
1708
1713
1709 2004-01-06 Fernando Perez <fperez@colorado.edu>
1714 2004-01-06 Fernando Perez <fperez@colorado.edu>
1710
1715
1711 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1716 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1712 a magic function instead, after some community feedback. No
1717 a magic function instead, after some community feedback. No
1713 special syntax will exist for it, but its name is deliberately
1718 special syntax will exist for it, but its name is deliberately
1714 very short.
1719 very short.
1715
1720
1716 2003-12-20 Fernando Perez <fperez@colorado.edu>
1721 2003-12-20 Fernando Perez <fperez@colorado.edu>
1717
1722
1718 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1723 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1719 new functionality, to automagically assign the result of a shell
1724 new functionality, to automagically assign the result of a shell
1720 command to a variable. I'll solicit some community feedback on
1725 command to a variable. I'll solicit some community feedback on
1721 this before making it permanent.
1726 this before making it permanent.
1722
1727
1723 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1728 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1724 requested about callables for which inspect couldn't obtain a
1729 requested about callables for which inspect couldn't obtain a
1725 proper argspec. Thanks to a crash report sent by Etienne
1730 proper argspec. Thanks to a crash report sent by Etienne
1726 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1731 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1727
1732
1728 2003-12-09 Fernando Perez <fperez@colorado.edu>
1733 2003-12-09 Fernando Perez <fperez@colorado.edu>
1729
1734
1730 * IPython/genutils.py (page): patch for the pager to work across
1735 * IPython/genutils.py (page): patch for the pager to work across
1731 various versions of Windows. By Gary Bishop.
1736 various versions of Windows. By Gary Bishop.
1732
1737
1733 2003-12-04 Fernando Perez <fperez@colorado.edu>
1738 2003-12-04 Fernando Perez <fperez@colorado.edu>
1734
1739
1735 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1740 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1736 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1741 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1737 While I tested this and it looks ok, there may still be corner
1742 While I tested this and it looks ok, there may still be corner
1738 cases I've missed.
1743 cases I've missed.
1739
1744
1740 2003-12-01 Fernando Perez <fperez@colorado.edu>
1745 2003-12-01 Fernando Perez <fperez@colorado.edu>
1741
1746
1742 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1747 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1743 where a line like 'p,q=1,2' would fail because the automagic
1748 where a line like 'p,q=1,2' would fail because the automagic
1744 system would be triggered for @p.
1749 system would be triggered for @p.
1745
1750
1746 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1751 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1747 cleanups, code unmodified.
1752 cleanups, code unmodified.
1748
1753
1749 * IPython/genutils.py (Term): added a class for IPython to handle
1754 * IPython/genutils.py (Term): added a class for IPython to handle
1750 output. In most cases it will just be a proxy for stdout/err, but
1755 output. In most cases it will just be a proxy for stdout/err, but
1751 having this allows modifications to be made for some platforms,
1756 having this allows modifications to be made for some platforms,
1752 such as handling color escapes under Windows. All of this code
1757 such as handling color escapes under Windows. All of this code
1753 was contributed by Gary Bishop, with minor modifications by me.
1758 was contributed by Gary Bishop, with minor modifications by me.
1754 The actual changes affect many files.
1759 The actual changes affect many files.
1755
1760
1756 2003-11-30 Fernando Perez <fperez@colorado.edu>
1761 2003-11-30 Fernando Perez <fperez@colorado.edu>
1757
1762
1758 * IPython/iplib.py (file_matches): new completion code, courtesy
1763 * IPython/iplib.py (file_matches): new completion code, courtesy
1759 of Jeff Collins. This enables filename completion again under
1764 of Jeff Collins. This enables filename completion again under
1760 python 2.3, which disabled it at the C level.
1765 python 2.3, which disabled it at the C level.
1761
1766
1762 2003-11-11 Fernando Perez <fperez@colorado.edu>
1767 2003-11-11 Fernando Perez <fperez@colorado.edu>
1763
1768
1764 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1769 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1765 for Numeric.array(map(...)), but often convenient.
1770 for Numeric.array(map(...)), but often convenient.
1766
1771
1767 2003-11-05 Fernando Perez <fperez@colorado.edu>
1772 2003-11-05 Fernando Perez <fperez@colorado.edu>
1768
1773
1769 * IPython/numutils.py (frange): Changed a call from int() to
1774 * IPython/numutils.py (frange): Changed a call from int() to
1770 int(round()) to prevent a problem reported with arange() in the
1775 int(round()) to prevent a problem reported with arange() in the
1771 numpy list.
1776 numpy list.
1772
1777
1773 2003-10-06 Fernando Perez <fperez@colorado.edu>
1778 2003-10-06 Fernando Perez <fperez@colorado.edu>
1774
1779
1775 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1780 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1776 prevent crashes if sys lacks an argv attribute (it happens with
1781 prevent crashes if sys lacks an argv attribute (it happens with
1777 embedded interpreters which build a bare-bones sys module).
1782 embedded interpreters which build a bare-bones sys module).
1778 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1783 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1779
1784
1780 2003-09-24 Fernando Perez <fperez@colorado.edu>
1785 2003-09-24 Fernando Perez <fperez@colorado.edu>
1781
1786
1782 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1787 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1783 to protect against poorly written user objects where __getattr__
1788 to protect against poorly written user objects where __getattr__
1784 raises exceptions other than AttributeError. Thanks to a bug
1789 raises exceptions other than AttributeError. Thanks to a bug
1785 report by Oliver Sander <osander-AT-gmx.de>.
1790 report by Oliver Sander <osander-AT-gmx.de>.
1786
1791
1787 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1792 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1788 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1793 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1789
1794
1790 2003-09-09 Fernando Perez <fperez@colorado.edu>
1795 2003-09-09 Fernando Perez <fperez@colorado.edu>
1791
1796
1792 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1797 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1793 unpacking a list whith a callable as first element would
1798 unpacking a list whith a callable as first element would
1794 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1799 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1795 Collins.
1800 Collins.
1796
1801
1797 2003-08-25 *** Released version 0.5.0
1802 2003-08-25 *** Released version 0.5.0
1798
1803
1799 2003-08-22 Fernando Perez <fperez@colorado.edu>
1804 2003-08-22 Fernando Perez <fperez@colorado.edu>
1800
1805
1801 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1806 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1802 improperly defined user exceptions. Thanks to feedback from Mark
1807 improperly defined user exceptions. Thanks to feedback from Mark
1803 Russell <mrussell-AT-verio.net>.
1808 Russell <mrussell-AT-verio.net>.
1804
1809
1805 2003-08-20 Fernando Perez <fperez@colorado.edu>
1810 2003-08-20 Fernando Perez <fperez@colorado.edu>
1806
1811
1807 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1812 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1808 printing so that it would print multi-line string forms starting
1813 printing so that it would print multi-line string forms starting
1809 with a new line. This way the formatting is better respected for
1814 with a new line. This way the formatting is better respected for
1810 objects which work hard to make nice string forms.
1815 objects which work hard to make nice string forms.
1811
1816
1812 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1817 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1813 autocall would overtake data access for objects with both
1818 autocall would overtake data access for objects with both
1814 __getitem__ and __call__.
1819 __getitem__ and __call__.
1815
1820
1816 2003-08-19 *** Released version 0.5.0-rc1
1821 2003-08-19 *** Released version 0.5.0-rc1
1817
1822
1818 2003-08-19 Fernando Perez <fperez@colorado.edu>
1823 2003-08-19 Fernando Perez <fperez@colorado.edu>
1819
1824
1820 * IPython/deep_reload.py (load_tail): single tiny change here
1825 * IPython/deep_reload.py (load_tail): single tiny change here
1821 seems to fix the long-standing bug of dreload() failing to work
1826 seems to fix the long-standing bug of dreload() failing to work
1822 for dotted names. But this module is pretty tricky, so I may have
1827 for dotted names. But this module is pretty tricky, so I may have
1823 missed some subtlety. Needs more testing!.
1828 missed some subtlety. Needs more testing!.
1824
1829
1825 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1830 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1826 exceptions which have badly implemented __str__ methods.
1831 exceptions which have badly implemented __str__ methods.
1827 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1832 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1828 which I've been getting reports about from Python 2.3 users. I
1833 which I've been getting reports about from Python 2.3 users. I
1829 wish I had a simple test case to reproduce the problem, so I could
1834 wish I had a simple test case to reproduce the problem, so I could
1830 either write a cleaner workaround or file a bug report if
1835 either write a cleaner workaround or file a bug report if
1831 necessary.
1836 necessary.
1832
1837
1833 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1838 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1834 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1839 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1835 a bug report by Tjabo Kloppenburg.
1840 a bug report by Tjabo Kloppenburg.
1836
1841
1837 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1842 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1838 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1843 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1839 seems rather unstable. Thanks to a bug report by Tjabo
1844 seems rather unstable. Thanks to a bug report by Tjabo
1840 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1845 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1841
1846
1842 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1847 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1843 this out soon because of the critical fixes in the inner loop for
1848 this out soon because of the critical fixes in the inner loop for
1844 generators.
1849 generators.
1845
1850
1846 * IPython/Magic.py (Magic.getargspec): removed. This (and
1851 * IPython/Magic.py (Magic.getargspec): removed. This (and
1847 _get_def) have been obsoleted by OInspect for a long time, I
1852 _get_def) have been obsoleted by OInspect for a long time, I
1848 hadn't noticed that they were dead code.
1853 hadn't noticed that they were dead code.
1849 (Magic._ofind): restored _ofind functionality for a few literals
1854 (Magic._ofind): restored _ofind functionality for a few literals
1850 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1855 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1851 for things like "hello".capitalize?, since that would require a
1856 for things like "hello".capitalize?, since that would require a
1852 potentially dangerous eval() again.
1857 potentially dangerous eval() again.
1853
1858
1854 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1859 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1855 logic a bit more to clean up the escapes handling and minimize the
1860 logic a bit more to clean up the escapes handling and minimize the
1856 use of _ofind to only necessary cases. The interactive 'feel' of
1861 use of _ofind to only necessary cases. The interactive 'feel' of
1857 IPython should have improved quite a bit with the changes in
1862 IPython should have improved quite a bit with the changes in
1858 _prefilter and _ofind (besides being far safer than before).
1863 _prefilter and _ofind (besides being far safer than before).
1859
1864
1860 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1865 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1861 obscure, never reported). Edit would fail to find the object to
1866 obscure, never reported). Edit would fail to find the object to
1862 edit under some circumstances.
1867 edit under some circumstances.
1863 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1868 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1864 which were causing double-calling of generators. Those eval calls
1869 which were causing double-calling of generators. Those eval calls
1865 were _very_ dangerous, since code with side effects could be
1870 were _very_ dangerous, since code with side effects could be
1866 triggered. As they say, 'eval is evil'... These were the
1871 triggered. As they say, 'eval is evil'... These were the
1867 nastiest evals in IPython. Besides, _ofind is now far simpler,
1872 nastiest evals in IPython. Besides, _ofind is now far simpler,
1868 and it should also be quite a bit faster. Its use of inspect is
1873 and it should also be quite a bit faster. Its use of inspect is
1869 also safer, so perhaps some of the inspect-related crashes I've
1874 also safer, so perhaps some of the inspect-related crashes I've
1870 seen lately with Python 2.3 might be taken care of. That will
1875 seen lately with Python 2.3 might be taken care of. That will
1871 need more testing.
1876 need more testing.
1872
1877
1873 2003-08-17 Fernando Perez <fperez@colorado.edu>
1878 2003-08-17 Fernando Perez <fperez@colorado.edu>
1874
1879
1875 * IPython/iplib.py (InteractiveShell._prefilter): significant
1880 * IPython/iplib.py (InteractiveShell._prefilter): significant
1876 simplifications to the logic for handling user escapes. Faster
1881 simplifications to the logic for handling user escapes. Faster
1877 and simpler code.
1882 and simpler code.
1878
1883
1879 2003-08-14 Fernando Perez <fperez@colorado.edu>
1884 2003-08-14 Fernando Perez <fperez@colorado.edu>
1880
1885
1881 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
1886 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
1882 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
1887 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
1883 but it should be quite a bit faster. And the recursive version
1888 but it should be quite a bit faster. And the recursive version
1884 generated O(log N) intermediate storage for all rank>1 arrays,
1889 generated O(log N) intermediate storage for all rank>1 arrays,
1885 even if they were contiguous.
1890 even if they were contiguous.
1886 (l1norm): Added this function.
1891 (l1norm): Added this function.
1887 (norm): Added this function for arbitrary norms (including
1892 (norm): Added this function for arbitrary norms (including
1888 l-infinity). l1 and l2 are still special cases for convenience
1893 l-infinity). l1 and l2 are still special cases for convenience
1889 and speed.
1894 and speed.
1890
1895
1891 2003-08-03 Fernando Perez <fperez@colorado.edu>
1896 2003-08-03 Fernando Perez <fperez@colorado.edu>
1892
1897
1893 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
1898 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
1894 exceptions, which now raise PendingDeprecationWarnings in Python
1899 exceptions, which now raise PendingDeprecationWarnings in Python
1895 2.3. There were some in Magic and some in Gnuplot2.
1900 2.3. There were some in Magic and some in Gnuplot2.
1896
1901
1897 2003-06-30 Fernando Perez <fperez@colorado.edu>
1902 2003-06-30 Fernando Perez <fperez@colorado.edu>
1898
1903
1899 * IPython/genutils.py (page): modified to call curses only for
1904 * IPython/genutils.py (page): modified to call curses only for
1900 terminals where TERM=='xterm'. After problems under many other
1905 terminals where TERM=='xterm'. After problems under many other
1901 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
1906 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
1902
1907
1903 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
1908 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
1904 would be triggered when readline was absent. This was just an old
1909 would be triggered when readline was absent. This was just an old
1905 debugging statement I'd forgotten to take out.
1910 debugging statement I'd forgotten to take out.
1906
1911
1907 2003-06-20 Fernando Perez <fperez@colorado.edu>
1912 2003-06-20 Fernando Perez <fperez@colorado.edu>
1908
1913
1909 * IPython/genutils.py (clock): modified to return only user time
1914 * IPython/genutils.py (clock): modified to return only user time
1910 (not counting system time), after a discussion on scipy. While
1915 (not counting system time), after a discussion on scipy. While
1911 system time may be a useful quantity occasionally, it may much
1916 system time may be a useful quantity occasionally, it may much
1912 more easily be skewed by occasional swapping or other similar
1917 more easily be skewed by occasional swapping or other similar
1913 activity.
1918 activity.
1914
1919
1915 2003-06-05 Fernando Perez <fperez@colorado.edu>
1920 2003-06-05 Fernando Perez <fperez@colorado.edu>
1916
1921
1917 * IPython/numutils.py (identity): new function, for building
1922 * IPython/numutils.py (identity): new function, for building
1918 arbitrary rank Kronecker deltas (mostly backwards compatible with
1923 arbitrary rank Kronecker deltas (mostly backwards compatible with
1919 Numeric.identity)
1924 Numeric.identity)
1920
1925
1921 2003-06-03 Fernando Perez <fperez@colorado.edu>
1926 2003-06-03 Fernando Perez <fperez@colorado.edu>
1922
1927
1923 * IPython/iplib.py (InteractiveShell.handle_magic): protect
1928 * IPython/iplib.py (InteractiveShell.handle_magic): protect
1924 arguments passed to magics with spaces, to allow trailing '\' to
1929 arguments passed to magics with spaces, to allow trailing '\' to
1925 work normally (mainly for Windows users).
1930 work normally (mainly for Windows users).
1926
1931
1927 2003-05-29 Fernando Perez <fperez@colorado.edu>
1932 2003-05-29 Fernando Perez <fperez@colorado.edu>
1928
1933
1929 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
1934 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
1930 instead of pydoc.help. This fixes a bizarre behavior where
1935 instead of pydoc.help. This fixes a bizarre behavior where
1931 printing '%s' % locals() would trigger the help system. Now
1936 printing '%s' % locals() would trigger the help system. Now
1932 ipython behaves like normal python does.
1937 ipython behaves like normal python does.
1933
1938
1934 Note that if one does 'from pydoc import help', the bizarre
1939 Note that if one does 'from pydoc import help', the bizarre
1935 behavior returns, but this will also happen in normal python, so
1940 behavior returns, but this will also happen in normal python, so
1936 it's not an ipython bug anymore (it has to do with how pydoc.help
1941 it's not an ipython bug anymore (it has to do with how pydoc.help
1937 is implemented).
1942 is implemented).
1938
1943
1939 2003-05-22 Fernando Perez <fperez@colorado.edu>
1944 2003-05-22 Fernando Perez <fperez@colorado.edu>
1940
1945
1941 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
1946 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
1942 return [] instead of None when nothing matches, also match to end
1947 return [] instead of None when nothing matches, also match to end
1943 of line. Patch by Gary Bishop.
1948 of line. Patch by Gary Bishop.
1944
1949
1945 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
1950 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
1946 protection as before, for files passed on the command line. This
1951 protection as before, for files passed on the command line. This
1947 prevents the CrashHandler from kicking in if user files call into
1952 prevents the CrashHandler from kicking in if user files call into
1948 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
1953 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
1949 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
1954 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
1950
1955
1951 2003-05-20 *** Released version 0.4.0
1956 2003-05-20 *** Released version 0.4.0
1952
1957
1953 2003-05-20 Fernando Perez <fperez@colorado.edu>
1958 2003-05-20 Fernando Perez <fperez@colorado.edu>
1954
1959
1955 * setup.py: added support for manpages. It's a bit hackish b/c of
1960 * setup.py: added support for manpages. It's a bit hackish b/c of
1956 a bug in the way the bdist_rpm distutils target handles gzipped
1961 a bug in the way the bdist_rpm distutils target handles gzipped
1957 manpages, but it works. After a patch by Jack.
1962 manpages, but it works. After a patch by Jack.
1958
1963
1959 2003-05-19 Fernando Perez <fperez@colorado.edu>
1964 2003-05-19 Fernando Perez <fperez@colorado.edu>
1960
1965
1961 * IPython/numutils.py: added a mockup of the kinds module, since
1966 * IPython/numutils.py: added a mockup of the kinds module, since
1962 it was recently removed from Numeric. This way, numutils will
1967 it was recently removed from Numeric. This way, numutils will
1963 work for all users even if they are missing kinds.
1968 work for all users even if they are missing kinds.
1964
1969
1965 * IPython/Magic.py (Magic._ofind): Harden against an inspect
1970 * IPython/Magic.py (Magic._ofind): Harden against an inspect
1966 failure, which can occur with SWIG-wrapped extensions. After a
1971 failure, which can occur with SWIG-wrapped extensions. After a
1967 crash report from Prabhu.
1972 crash report from Prabhu.
1968
1973
1969 2003-05-16 Fernando Perez <fperez@colorado.edu>
1974 2003-05-16 Fernando Perez <fperez@colorado.edu>
1970
1975
1971 * IPython/iplib.py (InteractiveShell.excepthook): New method to
1976 * IPython/iplib.py (InteractiveShell.excepthook): New method to
1972 protect ipython from user code which may call directly
1977 protect ipython from user code which may call directly
1973 sys.excepthook (this looks like an ipython crash to the user, even
1978 sys.excepthook (this looks like an ipython crash to the user, even
1974 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
1979 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
1975 This is especially important to help users of WxWindows, but may
1980 This is especially important to help users of WxWindows, but may
1976 also be useful in other cases.
1981 also be useful in other cases.
1977
1982
1978 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
1983 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
1979 an optional tb_offset to be specified, and to preserve exception
1984 an optional tb_offset to be specified, and to preserve exception
1980 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
1985 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
1981
1986
1982 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
1987 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
1983
1988
1984 2003-05-15 Fernando Perez <fperez@colorado.edu>
1989 2003-05-15 Fernando Perez <fperez@colorado.edu>
1985
1990
1986 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
1991 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
1987 installing for a new user under Windows.
1992 installing for a new user under Windows.
1988
1993
1989 2003-05-12 Fernando Perez <fperez@colorado.edu>
1994 2003-05-12 Fernando Perez <fperez@colorado.edu>
1990
1995
1991 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
1996 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
1992 handler for Emacs comint-based lines. Currently it doesn't do
1997 handler for Emacs comint-based lines. Currently it doesn't do
1993 much (but importantly, it doesn't update the history cache). In
1998 much (but importantly, it doesn't update the history cache). In
1994 the future it may be expanded if Alex needs more functionality
1999 the future it may be expanded if Alex needs more functionality
1995 there.
2000 there.
1996
2001
1997 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2002 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
1998 info to crash reports.
2003 info to crash reports.
1999
2004
2000 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2005 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2001 just like Python's -c. Also fixed crash with invalid -color
2006 just like Python's -c. Also fixed crash with invalid -color
2002 option value at startup. Thanks to Will French
2007 option value at startup. Thanks to Will French
2003 <wfrench-AT-bestweb.net> for the bug report.
2008 <wfrench-AT-bestweb.net> for the bug report.
2004
2009
2005 2003-05-09 Fernando Perez <fperez@colorado.edu>
2010 2003-05-09 Fernando Perez <fperez@colorado.edu>
2006
2011
2007 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2012 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2008 to EvalDict (it's a mapping, after all) and simplified its code
2013 to EvalDict (it's a mapping, after all) and simplified its code
2009 quite a bit, after a nice discussion on c.l.py where Gustavo
2014 quite a bit, after a nice discussion on c.l.py where Gustavo
2010 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2015 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2011
2016
2012 2003-04-30 Fernando Perez <fperez@colorado.edu>
2017 2003-04-30 Fernando Perez <fperez@colorado.edu>
2013
2018
2014 * IPython/genutils.py (timings_out): modified it to reduce its
2019 * IPython/genutils.py (timings_out): modified it to reduce its
2015 overhead in the common reps==1 case.
2020 overhead in the common reps==1 case.
2016
2021
2017 2003-04-29 Fernando Perez <fperez@colorado.edu>
2022 2003-04-29 Fernando Perez <fperez@colorado.edu>
2018
2023
2019 * IPython/genutils.py (timings_out): Modified to use the resource
2024 * IPython/genutils.py (timings_out): Modified to use the resource
2020 module, which avoids the wraparound problems of time.clock().
2025 module, which avoids the wraparound problems of time.clock().
2021
2026
2022 2003-04-17 *** Released version 0.2.15pre4
2027 2003-04-17 *** Released version 0.2.15pre4
2023
2028
2024 2003-04-17 Fernando Perez <fperez@colorado.edu>
2029 2003-04-17 Fernando Perez <fperez@colorado.edu>
2025
2030
2026 * setup.py (scriptfiles): Split windows-specific stuff over to a
2031 * setup.py (scriptfiles): Split windows-specific stuff over to a
2027 separate file, in an attempt to have a Windows GUI installer.
2032 separate file, in an attempt to have a Windows GUI installer.
2028 That didn't work, but part of the groundwork is done.
2033 That didn't work, but part of the groundwork is done.
2029
2034
2030 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2035 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2031 indent/unindent with 4 spaces. Particularly useful in combination
2036 indent/unindent with 4 spaces. Particularly useful in combination
2032 with the new auto-indent option.
2037 with the new auto-indent option.
2033
2038
2034 2003-04-16 Fernando Perez <fperez@colorado.edu>
2039 2003-04-16 Fernando Perez <fperez@colorado.edu>
2035
2040
2036 * IPython/Magic.py: various replacements of self.rc for
2041 * IPython/Magic.py: various replacements of self.rc for
2037 self.shell.rc. A lot more remains to be done to fully disentangle
2042 self.shell.rc. A lot more remains to be done to fully disentangle
2038 this class from the main Shell class.
2043 this class from the main Shell class.
2039
2044
2040 * IPython/GnuplotRuntime.py: added checks for mouse support so
2045 * IPython/GnuplotRuntime.py: added checks for mouse support so
2041 that we don't try to enable it if the current gnuplot doesn't
2046 that we don't try to enable it if the current gnuplot doesn't
2042 really support it. Also added checks so that we don't try to
2047 really support it. Also added checks so that we don't try to
2043 enable persist under Windows (where Gnuplot doesn't recognize the
2048 enable persist under Windows (where Gnuplot doesn't recognize the
2044 option).
2049 option).
2045
2050
2046 * IPython/iplib.py (InteractiveShell.interact): Added optional
2051 * IPython/iplib.py (InteractiveShell.interact): Added optional
2047 auto-indenting code, after a patch by King C. Shu
2052 auto-indenting code, after a patch by King C. Shu
2048 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2053 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2049 get along well with pasting indented code. If I ever figure out
2054 get along well with pasting indented code. If I ever figure out
2050 how to make that part go well, it will become on by default.
2055 how to make that part go well, it will become on by default.
2051
2056
2052 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2057 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2053 crash ipython if there was an unmatched '%' in the user's prompt
2058 crash ipython if there was an unmatched '%' in the user's prompt
2054 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2059 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2055
2060
2056 * IPython/iplib.py (InteractiveShell.interact): removed the
2061 * IPython/iplib.py (InteractiveShell.interact): removed the
2057 ability to ask the user whether he wants to crash or not at the
2062 ability to ask the user whether he wants to crash or not at the
2058 'last line' exception handler. Calling functions at that point
2063 'last line' exception handler. Calling functions at that point
2059 changes the stack, and the error reports would have incorrect
2064 changes the stack, and the error reports would have incorrect
2060 tracebacks.
2065 tracebacks.
2061
2066
2062 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2067 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2063 pass through a peger a pretty-printed form of any object. After a
2068 pass through a peger a pretty-printed form of any object. After a
2064 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2069 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2065
2070
2066 2003-04-14 Fernando Perez <fperez@colorado.edu>
2071 2003-04-14 Fernando Perez <fperez@colorado.edu>
2067
2072
2068 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2073 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2069 all files in ~ would be modified at first install (instead of
2074 all files in ~ would be modified at first install (instead of
2070 ~/.ipython). This could be potentially disastrous, as the
2075 ~/.ipython). This could be potentially disastrous, as the
2071 modification (make line-endings native) could damage binary files.
2076 modification (make line-endings native) could damage binary files.
2072
2077
2073 2003-04-10 Fernando Perez <fperez@colorado.edu>
2078 2003-04-10 Fernando Perez <fperez@colorado.edu>
2074
2079
2075 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2080 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2076 handle only lines which are invalid python. This now means that
2081 handle only lines which are invalid python. This now means that
2077 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2082 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2078 for the bug report.
2083 for the bug report.
2079
2084
2080 2003-04-01 Fernando Perez <fperez@colorado.edu>
2085 2003-04-01 Fernando Perez <fperez@colorado.edu>
2081
2086
2082 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2087 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2083 where failing to set sys.last_traceback would crash pdb.pm().
2088 where failing to set sys.last_traceback would crash pdb.pm().
2084 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2089 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2085 report.
2090 report.
2086
2091
2087 2003-03-25 Fernando Perez <fperez@colorado.edu>
2092 2003-03-25 Fernando Perez <fperez@colorado.edu>
2088
2093
2089 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2094 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2090 before printing it (it had a lot of spurious blank lines at the
2095 before printing it (it had a lot of spurious blank lines at the
2091 end).
2096 end).
2092
2097
2093 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2098 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2094 output would be sent 21 times! Obviously people don't use this
2099 output would be sent 21 times! Obviously people don't use this
2095 too often, or I would have heard about it.
2100 too often, or I would have heard about it.
2096
2101
2097 2003-03-24 Fernando Perez <fperez@colorado.edu>
2102 2003-03-24 Fernando Perez <fperez@colorado.edu>
2098
2103
2099 * setup.py (scriptfiles): renamed the data_files parameter from
2104 * setup.py (scriptfiles): renamed the data_files parameter from
2100 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2105 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2101 for the patch.
2106 for the patch.
2102
2107
2103 2003-03-20 Fernando Perez <fperez@colorado.edu>
2108 2003-03-20 Fernando Perez <fperez@colorado.edu>
2104
2109
2105 * IPython/genutils.py (error): added error() and fatal()
2110 * IPython/genutils.py (error): added error() and fatal()
2106 functions.
2111 functions.
2107
2112
2108 2003-03-18 *** Released version 0.2.15pre3
2113 2003-03-18 *** Released version 0.2.15pre3
2109
2114
2110 2003-03-18 Fernando Perez <fperez@colorado.edu>
2115 2003-03-18 Fernando Perez <fperez@colorado.edu>
2111
2116
2112 * setupext/install_data_ext.py
2117 * setupext/install_data_ext.py
2113 (install_data_ext.initialize_options): Class contributed by Jack
2118 (install_data_ext.initialize_options): Class contributed by Jack
2114 Moffit for fixing the old distutils hack. He is sending this to
2119 Moffit for fixing the old distutils hack. He is sending this to
2115 the distutils folks so in the future we may not need it as a
2120 the distutils folks so in the future we may not need it as a
2116 private fix.
2121 private fix.
2117
2122
2118 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2123 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2119 changes for Debian packaging. See his patch for full details.
2124 changes for Debian packaging. See his patch for full details.
2120 The old distutils hack of making the ipythonrc* files carry a
2125 The old distutils hack of making the ipythonrc* files carry a
2121 bogus .py extension is gone, at last. Examples were moved to a
2126 bogus .py extension is gone, at last. Examples were moved to a
2122 separate subdir under doc/, and the separate executable scripts
2127 separate subdir under doc/, and the separate executable scripts
2123 now live in their own directory. Overall a great cleanup. The
2128 now live in their own directory. Overall a great cleanup. The
2124 manual was updated to use the new files, and setup.py has been
2129 manual was updated to use the new files, and setup.py has been
2125 fixed for this setup.
2130 fixed for this setup.
2126
2131
2127 * IPython/PyColorize.py (Parser.usage): made non-executable and
2132 * IPython/PyColorize.py (Parser.usage): made non-executable and
2128 created a pycolor wrapper around it to be included as a script.
2133 created a pycolor wrapper around it to be included as a script.
2129
2134
2130 2003-03-12 *** Released version 0.2.15pre2
2135 2003-03-12 *** Released version 0.2.15pre2
2131
2136
2132 2003-03-12 Fernando Perez <fperez@colorado.edu>
2137 2003-03-12 Fernando Perez <fperez@colorado.edu>
2133
2138
2134 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2139 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2135 long-standing problem with garbage characters in some terminals.
2140 long-standing problem with garbage characters in some terminals.
2136 The issue was really that the \001 and \002 escapes must _only_ be
2141 The issue was really that the \001 and \002 escapes must _only_ be
2137 passed to input prompts (which call readline), but _never_ to
2142 passed to input prompts (which call readline), but _never_ to
2138 normal text to be printed on screen. I changed ColorANSI to have
2143 normal text to be printed on screen. I changed ColorANSI to have
2139 two classes: TermColors and InputTermColors, each with the
2144 two classes: TermColors and InputTermColors, each with the
2140 appropriate escapes for input prompts or normal text. The code in
2145 appropriate escapes for input prompts or normal text. The code in
2141 Prompts.py got slightly more complicated, but this very old and
2146 Prompts.py got slightly more complicated, but this very old and
2142 annoying bug is finally fixed.
2147 annoying bug is finally fixed.
2143
2148
2144 All the credit for nailing down the real origin of this problem
2149 All the credit for nailing down the real origin of this problem
2145 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2150 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2146 *Many* thanks to him for spending quite a bit of effort on this.
2151 *Many* thanks to him for spending quite a bit of effort on this.
2147
2152
2148 2003-03-05 *** Released version 0.2.15pre1
2153 2003-03-05 *** Released version 0.2.15pre1
2149
2154
2150 2003-03-03 Fernando Perez <fperez@colorado.edu>
2155 2003-03-03 Fernando Perez <fperez@colorado.edu>
2151
2156
2152 * IPython/FakeModule.py: Moved the former _FakeModule to a
2157 * IPython/FakeModule.py: Moved the former _FakeModule to a
2153 separate file, because it's also needed by Magic (to fix a similar
2158 separate file, because it's also needed by Magic (to fix a similar
2154 pickle-related issue in @run).
2159 pickle-related issue in @run).
2155
2160
2156 2003-03-02 Fernando Perez <fperez@colorado.edu>
2161 2003-03-02 Fernando Perez <fperez@colorado.edu>
2157
2162
2158 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2163 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2159 the autocall option at runtime.
2164 the autocall option at runtime.
2160 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2165 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2161 across Magic.py to start separating Magic from InteractiveShell.
2166 across Magic.py to start separating Magic from InteractiveShell.
2162 (Magic._ofind): Fixed to return proper namespace for dotted
2167 (Magic._ofind): Fixed to return proper namespace for dotted
2163 names. Before, a dotted name would always return 'not currently
2168 names. Before, a dotted name would always return 'not currently
2164 defined', because it would find the 'parent'. s.x would be found,
2169 defined', because it would find the 'parent'. s.x would be found,
2165 but since 'x' isn't defined by itself, it would get confused.
2170 but since 'x' isn't defined by itself, it would get confused.
2166 (Magic.magic_run): Fixed pickling problems reported by Ralf
2171 (Magic.magic_run): Fixed pickling problems reported by Ralf
2167 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2172 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2168 that I'd used when Mike Heeter reported similar issues at the
2173 that I'd used when Mike Heeter reported similar issues at the
2169 top-level, but now for @run. It boils down to injecting the
2174 top-level, but now for @run. It boils down to injecting the
2170 namespace where code is being executed with something that looks
2175 namespace where code is being executed with something that looks
2171 enough like a module to fool pickle.dump(). Since a pickle stores
2176 enough like a module to fool pickle.dump(). Since a pickle stores
2172 a named reference to the importing module, we need this for
2177 a named reference to the importing module, we need this for
2173 pickles to save something sensible.
2178 pickles to save something sensible.
2174
2179
2175 * IPython/ipmaker.py (make_IPython): added an autocall option.
2180 * IPython/ipmaker.py (make_IPython): added an autocall option.
2176
2181
2177 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2182 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2178 the auto-eval code. Now autocalling is an option, and the code is
2183 the auto-eval code. Now autocalling is an option, and the code is
2179 also vastly safer. There is no more eval() involved at all.
2184 also vastly safer. There is no more eval() involved at all.
2180
2185
2181 2003-03-01 Fernando Perez <fperez@colorado.edu>
2186 2003-03-01 Fernando Perez <fperez@colorado.edu>
2182
2187
2183 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2188 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2184 dict with named keys instead of a tuple.
2189 dict with named keys instead of a tuple.
2185
2190
2186 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2191 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2187
2192
2188 * setup.py (make_shortcut): Fixed message about directories
2193 * setup.py (make_shortcut): Fixed message about directories
2189 created during Windows installation (the directories were ok, just
2194 created during Windows installation (the directories were ok, just
2190 the printed message was misleading). Thanks to Chris Liechti
2195 the printed message was misleading). Thanks to Chris Liechti
2191 <cliechti-AT-gmx.net> for the heads up.
2196 <cliechti-AT-gmx.net> for the heads up.
2192
2197
2193 2003-02-21 Fernando Perez <fperez@colorado.edu>
2198 2003-02-21 Fernando Perez <fperez@colorado.edu>
2194
2199
2195 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2200 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2196 of ValueError exception when checking for auto-execution. This
2201 of ValueError exception when checking for auto-execution. This
2197 one is raised by things like Numeric arrays arr.flat when the
2202 one is raised by things like Numeric arrays arr.flat when the
2198 array is non-contiguous.
2203 array is non-contiguous.
2199
2204
2200 2003-01-31 Fernando Perez <fperez@colorado.edu>
2205 2003-01-31 Fernando Perez <fperez@colorado.edu>
2201
2206
2202 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2207 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2203 not return any value at all (even though the command would get
2208 not return any value at all (even though the command would get
2204 executed).
2209 executed).
2205 (xsys): Flush stdout right after printing the command to ensure
2210 (xsys): Flush stdout right after printing the command to ensure
2206 proper ordering of commands and command output in the total
2211 proper ordering of commands and command output in the total
2207 output.
2212 output.
2208 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2213 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2209 system/getoutput as defaults. The old ones are kept for
2214 system/getoutput as defaults. The old ones are kept for
2210 compatibility reasons, so no code which uses this library needs
2215 compatibility reasons, so no code which uses this library needs
2211 changing.
2216 changing.
2212
2217
2213 2003-01-27 *** Released version 0.2.14
2218 2003-01-27 *** Released version 0.2.14
2214
2219
2215 2003-01-25 Fernando Perez <fperez@colorado.edu>
2220 2003-01-25 Fernando Perez <fperez@colorado.edu>
2216
2221
2217 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2222 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2218 functions defined in previous edit sessions could not be re-edited
2223 functions defined in previous edit sessions could not be re-edited
2219 (because the temp files were immediately removed). Now temp files
2224 (because the temp files were immediately removed). Now temp files
2220 are removed only at IPython's exit.
2225 are removed only at IPython's exit.
2221 (Magic.magic_run): Improved @run to perform shell-like expansions
2226 (Magic.magic_run): Improved @run to perform shell-like expansions
2222 on its arguments (~users and $VARS). With this, @run becomes more
2227 on its arguments (~users and $VARS). With this, @run becomes more
2223 like a normal command-line.
2228 like a normal command-line.
2224
2229
2225 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2230 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2226 bugs related to embedding and cleaned up that code. A fairly
2231 bugs related to embedding and cleaned up that code. A fairly
2227 important one was the impossibility to access the global namespace
2232 important one was the impossibility to access the global namespace
2228 through the embedded IPython (only local variables were visible).
2233 through the embedded IPython (only local variables were visible).
2229
2234
2230 2003-01-14 Fernando Perez <fperez@colorado.edu>
2235 2003-01-14 Fernando Perez <fperez@colorado.edu>
2231
2236
2232 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2237 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2233 auto-calling to be a bit more conservative. Now it doesn't get
2238 auto-calling to be a bit more conservative. Now it doesn't get
2234 triggered if any of '!=()<>' are in the rest of the input line, to
2239 triggered if any of '!=()<>' are in the rest of the input line, to
2235 allow comparing callables. Thanks to Alex for the heads up.
2240 allow comparing callables. Thanks to Alex for the heads up.
2236
2241
2237 2003-01-07 Fernando Perez <fperez@colorado.edu>
2242 2003-01-07 Fernando Perez <fperez@colorado.edu>
2238
2243
2239 * IPython/genutils.py (page): fixed estimation of the number of
2244 * IPython/genutils.py (page): fixed estimation of the number of
2240 lines in a string to be paged to simply count newlines. This
2245 lines in a string to be paged to simply count newlines. This
2241 prevents over-guessing due to embedded escape sequences. A better
2246 prevents over-guessing due to embedded escape sequences. A better
2242 long-term solution would involve stripping out the control chars
2247 long-term solution would involve stripping out the control chars
2243 for the count, but it's potentially so expensive I just don't
2248 for the count, but it's potentially so expensive I just don't
2244 think it's worth doing.
2249 think it's worth doing.
2245
2250
2246 2002-12-19 *** Released version 0.2.14pre50
2251 2002-12-19 *** Released version 0.2.14pre50
2247
2252
2248 2002-12-19 Fernando Perez <fperez@colorado.edu>
2253 2002-12-19 Fernando Perez <fperez@colorado.edu>
2249
2254
2250 * tools/release (version): Changed release scripts to inform
2255 * tools/release (version): Changed release scripts to inform
2251 Andrea and build a NEWS file with a list of recent changes.
2256 Andrea and build a NEWS file with a list of recent changes.
2252
2257
2253 * IPython/ColorANSI.py (__all__): changed terminal detection
2258 * IPython/ColorANSI.py (__all__): changed terminal detection
2254 code. Seems to work better for xterms without breaking
2259 code. Seems to work better for xterms without breaking
2255 konsole. Will need more testing to determine if WinXP and Mac OSX
2260 konsole. Will need more testing to determine if WinXP and Mac OSX
2256 also work ok.
2261 also work ok.
2257
2262
2258 2002-12-18 *** Released version 0.2.14pre49
2263 2002-12-18 *** Released version 0.2.14pre49
2259
2264
2260 2002-12-18 Fernando Perez <fperez@colorado.edu>
2265 2002-12-18 Fernando Perez <fperez@colorado.edu>
2261
2266
2262 * Docs: added new info about Mac OSX, from Andrea.
2267 * Docs: added new info about Mac OSX, from Andrea.
2263
2268
2264 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2269 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2265 allow direct plotting of python strings whose format is the same
2270 allow direct plotting of python strings whose format is the same
2266 of gnuplot data files.
2271 of gnuplot data files.
2267
2272
2268 2002-12-16 Fernando Perez <fperez@colorado.edu>
2273 2002-12-16 Fernando Perez <fperez@colorado.edu>
2269
2274
2270 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2275 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2271 value of exit question to be acknowledged.
2276 value of exit question to be acknowledged.
2272
2277
2273 2002-12-03 Fernando Perez <fperez@colorado.edu>
2278 2002-12-03 Fernando Perez <fperez@colorado.edu>
2274
2279
2275 * IPython/ipmaker.py: removed generators, which had been added
2280 * IPython/ipmaker.py: removed generators, which had been added
2276 by mistake in an earlier debugging run. This was causing trouble
2281 by mistake in an earlier debugging run. This was causing trouble
2277 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2282 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2278 for pointing this out.
2283 for pointing this out.
2279
2284
2280 2002-11-17 Fernando Perez <fperez@colorado.edu>
2285 2002-11-17 Fernando Perez <fperez@colorado.edu>
2281
2286
2282 * Manual: updated the Gnuplot section.
2287 * Manual: updated the Gnuplot section.
2283
2288
2284 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2289 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2285 a much better split of what goes in Runtime and what goes in
2290 a much better split of what goes in Runtime and what goes in
2286 Interactive.
2291 Interactive.
2287
2292
2288 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2293 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2289 being imported from iplib.
2294 being imported from iplib.
2290
2295
2291 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2296 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2292 for command-passing. Now the global Gnuplot instance is called
2297 for command-passing. Now the global Gnuplot instance is called
2293 'gp' instead of 'g', which was really a far too fragile and
2298 'gp' instead of 'g', which was really a far too fragile and
2294 common name.
2299 common name.
2295
2300
2296 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2301 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2297 bounding boxes generated by Gnuplot for square plots.
2302 bounding boxes generated by Gnuplot for square plots.
2298
2303
2299 * IPython/genutils.py (popkey): new function added. I should
2304 * IPython/genutils.py (popkey): new function added. I should
2300 suggest this on c.l.py as a dict method, it seems useful.
2305 suggest this on c.l.py as a dict method, it seems useful.
2301
2306
2302 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2307 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2303 to transparently handle PostScript generation. MUCH better than
2308 to transparently handle PostScript generation. MUCH better than
2304 the previous plot_eps/replot_eps (which I removed now). The code
2309 the previous plot_eps/replot_eps (which I removed now). The code
2305 is also fairly clean and well documented now (including
2310 is also fairly clean and well documented now (including
2306 docstrings).
2311 docstrings).
2307
2312
2308 2002-11-13 Fernando Perez <fperez@colorado.edu>
2313 2002-11-13 Fernando Perez <fperez@colorado.edu>
2309
2314
2310 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2315 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2311 (inconsistent with options).
2316 (inconsistent with options).
2312
2317
2313 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2318 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2314 manually disabled, I don't know why. Fixed it.
2319 manually disabled, I don't know why. Fixed it.
2315 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2320 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2316 eps output.
2321 eps output.
2317
2322
2318 2002-11-12 Fernando Perez <fperez@colorado.edu>
2323 2002-11-12 Fernando Perez <fperez@colorado.edu>
2319
2324
2320 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2325 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2321 don't propagate up to caller. Fixes crash reported by François
2326 don't propagate up to caller. Fixes crash reported by François
2322 Pinard.
2327 Pinard.
2323
2328
2324 2002-11-09 Fernando Perez <fperez@colorado.edu>
2329 2002-11-09 Fernando Perez <fperez@colorado.edu>
2325
2330
2326 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2331 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2327 history file for new users.
2332 history file for new users.
2328 (make_IPython): fixed bug where initial install would leave the
2333 (make_IPython): fixed bug where initial install would leave the
2329 user running in the .ipython dir.
2334 user running in the .ipython dir.
2330 (make_IPython): fixed bug where config dir .ipython would be
2335 (make_IPython): fixed bug where config dir .ipython would be
2331 created regardless of the given -ipythondir option. Thanks to Cory
2336 created regardless of the given -ipythondir option. Thanks to Cory
2332 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2337 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2333
2338
2334 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2339 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2335 type confirmations. Will need to use it in all of IPython's code
2340 type confirmations. Will need to use it in all of IPython's code
2336 consistently.
2341 consistently.
2337
2342
2338 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2343 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2339 context to print 31 lines instead of the default 5. This will make
2344 context to print 31 lines instead of the default 5. This will make
2340 the crash reports extremely detailed in case the problem is in
2345 the crash reports extremely detailed in case the problem is in
2341 libraries I don't have access to.
2346 libraries I don't have access to.
2342
2347
2343 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2348 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2344 line of defense' code to still crash, but giving users fair
2349 line of defense' code to still crash, but giving users fair
2345 warning. I don't want internal errors to go unreported: if there's
2350 warning. I don't want internal errors to go unreported: if there's
2346 an internal problem, IPython should crash and generate a full
2351 an internal problem, IPython should crash and generate a full
2347 report.
2352 report.
2348
2353
2349 2002-11-08 Fernando Perez <fperez@colorado.edu>
2354 2002-11-08 Fernando Perez <fperez@colorado.edu>
2350
2355
2351 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2356 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2352 otherwise uncaught exceptions which can appear if people set
2357 otherwise uncaught exceptions which can appear if people set
2353 sys.stdout to something badly broken. Thanks to a crash report
2358 sys.stdout to something badly broken. Thanks to a crash report
2354 from henni-AT-mail.brainbot.com.
2359 from henni-AT-mail.brainbot.com.
2355
2360
2356 2002-11-04 Fernando Perez <fperez@colorado.edu>
2361 2002-11-04 Fernando Perez <fperez@colorado.edu>
2357
2362
2358 * IPython/iplib.py (InteractiveShell.interact): added
2363 * IPython/iplib.py (InteractiveShell.interact): added
2359 __IPYTHON__active to the builtins. It's a flag which goes on when
2364 __IPYTHON__active to the builtins. It's a flag which goes on when
2360 the interaction starts and goes off again when it stops. This
2365 the interaction starts and goes off again when it stops. This
2361 allows embedding code to detect being inside IPython. Before this
2366 allows embedding code to detect being inside IPython. Before this
2362 was done via __IPYTHON__, but that only shows that an IPython
2367 was done via __IPYTHON__, but that only shows that an IPython
2363 instance has been created.
2368 instance has been created.
2364
2369
2365 * IPython/Magic.py (Magic.magic_env): I realized that in a
2370 * IPython/Magic.py (Magic.magic_env): I realized that in a
2366 UserDict, instance.data holds the data as a normal dict. So I
2371 UserDict, instance.data holds the data as a normal dict. So I
2367 modified @env to return os.environ.data instead of rebuilding a
2372 modified @env to return os.environ.data instead of rebuilding a
2368 dict by hand.
2373 dict by hand.
2369
2374
2370 2002-11-02 Fernando Perez <fperez@colorado.edu>
2375 2002-11-02 Fernando Perez <fperez@colorado.edu>
2371
2376
2372 * IPython/genutils.py (warn): changed so that level 1 prints no
2377 * IPython/genutils.py (warn): changed so that level 1 prints no
2373 header. Level 2 is now the default (with 'WARNING' header, as
2378 header. Level 2 is now the default (with 'WARNING' header, as
2374 before). I think I tracked all places where changes were needed in
2379 before). I think I tracked all places where changes were needed in
2375 IPython, but outside code using the old level numbering may have
2380 IPython, but outside code using the old level numbering may have
2376 broken.
2381 broken.
2377
2382
2378 * IPython/iplib.py (InteractiveShell.runcode): added this to
2383 * IPython/iplib.py (InteractiveShell.runcode): added this to
2379 handle the tracebacks in SystemExit traps correctly. The previous
2384 handle the tracebacks in SystemExit traps correctly. The previous
2380 code (through interact) was printing more of the stack than
2385 code (through interact) was printing more of the stack than
2381 necessary, showing IPython internal code to the user.
2386 necessary, showing IPython internal code to the user.
2382
2387
2383 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2388 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2384 default. Now that the default at the confirmation prompt is yes,
2389 default. Now that the default at the confirmation prompt is yes,
2385 it's not so intrusive. François' argument that ipython sessions
2390 it's not so intrusive. François' argument that ipython sessions
2386 tend to be complex enough not to lose them from an accidental C-d,
2391 tend to be complex enough not to lose them from an accidental C-d,
2387 is a valid one.
2392 is a valid one.
2388
2393
2389 * IPython/iplib.py (InteractiveShell.interact): added a
2394 * IPython/iplib.py (InteractiveShell.interact): added a
2390 showtraceback() call to the SystemExit trap, and modified the exit
2395 showtraceback() call to the SystemExit trap, and modified the exit
2391 confirmation to have yes as the default.
2396 confirmation to have yes as the default.
2392
2397
2393 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2398 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2394 this file. It's been gone from the code for a long time, this was
2399 this file. It's been gone from the code for a long time, this was
2395 simply leftover junk.
2400 simply leftover junk.
2396
2401
2397 2002-11-01 Fernando Perez <fperez@colorado.edu>
2402 2002-11-01 Fernando Perez <fperez@colorado.edu>
2398
2403
2399 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2404 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2400 added. If set, IPython now traps EOF and asks for
2405 added. If set, IPython now traps EOF and asks for
2401 confirmation. After a request by François Pinard.
2406 confirmation. After a request by François Pinard.
2402
2407
2403 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2408 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2404 of @abort, and with a new (better) mechanism for handling the
2409 of @abort, and with a new (better) mechanism for handling the
2405 exceptions.
2410 exceptions.
2406
2411
2407 2002-10-27 Fernando Perez <fperez@colorado.edu>
2412 2002-10-27 Fernando Perez <fperez@colorado.edu>
2408
2413
2409 * IPython/usage.py (__doc__): updated the --help information and
2414 * IPython/usage.py (__doc__): updated the --help information and
2410 the ipythonrc file to indicate that -log generates
2415 the ipythonrc file to indicate that -log generates
2411 ./ipython.log. Also fixed the corresponding info in @logstart.
2416 ./ipython.log. Also fixed the corresponding info in @logstart.
2412 This and several other fixes in the manuals thanks to reports by
2417 This and several other fixes in the manuals thanks to reports by
2413 François Pinard <pinard-AT-iro.umontreal.ca>.
2418 François Pinard <pinard-AT-iro.umontreal.ca>.
2414
2419
2415 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2420 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2416 refer to @logstart (instead of @log, which doesn't exist).
2421 refer to @logstart (instead of @log, which doesn't exist).
2417
2422
2418 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2423 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2419 AttributeError crash. Thanks to Christopher Armstrong
2424 AttributeError crash. Thanks to Christopher Armstrong
2420 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2425 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2421 introduced recently (in 0.2.14pre37) with the fix to the eval
2426 introduced recently (in 0.2.14pre37) with the fix to the eval
2422 problem mentioned below.
2427 problem mentioned below.
2423
2428
2424 2002-10-17 Fernando Perez <fperez@colorado.edu>
2429 2002-10-17 Fernando Perez <fperez@colorado.edu>
2425
2430
2426 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2431 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2427 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2432 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2428
2433
2429 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2434 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2430 this function to fix a problem reported by Alex Schmolck. He saw
2435 this function to fix a problem reported by Alex Schmolck. He saw
2431 it with list comprehensions and generators, which were getting
2436 it with list comprehensions and generators, which were getting
2432 called twice. The real problem was an 'eval' call in testing for
2437 called twice. The real problem was an 'eval' call in testing for
2433 automagic which was evaluating the input line silently.
2438 automagic which was evaluating the input line silently.
2434
2439
2435 This is a potentially very nasty bug, if the input has side
2440 This is a potentially very nasty bug, if the input has side
2436 effects which must not be repeated. The code is much cleaner now,
2441 effects which must not be repeated. The code is much cleaner now,
2437 without any blanket 'except' left and with a regexp test for
2442 without any blanket 'except' left and with a regexp test for
2438 actual function names.
2443 actual function names.
2439
2444
2440 But an eval remains, which I'm not fully comfortable with. I just
2445 But an eval remains, which I'm not fully comfortable with. I just
2441 don't know how to find out if an expression could be a callable in
2446 don't know how to find out if an expression could be a callable in
2442 the user's namespace without doing an eval on the string. However
2447 the user's namespace without doing an eval on the string. However
2443 that string is now much more strictly checked so that no code
2448 that string is now much more strictly checked so that no code
2444 slips by, so the eval should only happen for things that can
2449 slips by, so the eval should only happen for things that can
2445 really be only function/method names.
2450 really be only function/method names.
2446
2451
2447 2002-10-15 Fernando Perez <fperez@colorado.edu>
2452 2002-10-15 Fernando Perez <fperez@colorado.edu>
2448
2453
2449 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2454 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2450 OSX information to main manual, removed README_Mac_OSX file from
2455 OSX information to main manual, removed README_Mac_OSX file from
2451 distribution. Also updated credits for recent additions.
2456 distribution. Also updated credits for recent additions.
2452
2457
2453 2002-10-10 Fernando Perez <fperez@colorado.edu>
2458 2002-10-10 Fernando Perez <fperez@colorado.edu>
2454
2459
2455 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2460 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2456 terminal-related issues. Many thanks to Andrea Riciputi
2461 terminal-related issues. Many thanks to Andrea Riciputi
2457 <andrea.riciputi-AT-libero.it> for writing it.
2462 <andrea.riciputi-AT-libero.it> for writing it.
2458
2463
2459 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2464 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2460 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2465 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2461
2466
2462 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2467 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2463 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2468 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2464 <syver-en-AT-online.no> who both submitted patches for this problem.
2469 <syver-en-AT-online.no> who both submitted patches for this problem.
2465
2470
2466 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2471 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2467 global embedding to make sure that things don't overwrite user
2472 global embedding to make sure that things don't overwrite user
2468 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2473 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2469
2474
2470 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2475 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2471 compatibility. Thanks to Hayden Callow
2476 compatibility. Thanks to Hayden Callow
2472 <h.callow-AT-elec.canterbury.ac.nz>
2477 <h.callow-AT-elec.canterbury.ac.nz>
2473
2478
2474 2002-10-04 Fernando Perez <fperez@colorado.edu>
2479 2002-10-04 Fernando Perez <fperez@colorado.edu>
2475
2480
2476 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2481 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2477 Gnuplot.File objects.
2482 Gnuplot.File objects.
2478
2483
2479 2002-07-23 Fernando Perez <fperez@colorado.edu>
2484 2002-07-23 Fernando Perez <fperez@colorado.edu>
2480
2485
2481 * IPython/genutils.py (timing): Added timings() and timing() for
2486 * IPython/genutils.py (timing): Added timings() and timing() for
2482 quick access to the most commonly needed data, the execution
2487 quick access to the most commonly needed data, the execution
2483 times. Old timing() renamed to timings_out().
2488 times. Old timing() renamed to timings_out().
2484
2489
2485 2002-07-18 Fernando Perez <fperez@colorado.edu>
2490 2002-07-18 Fernando Perez <fperez@colorado.edu>
2486
2491
2487 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2492 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2488 bug with nested instances disrupting the parent's tab completion.
2493 bug with nested instances disrupting the parent's tab completion.
2489
2494
2490 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2495 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2491 all_completions code to begin the emacs integration.
2496 all_completions code to begin the emacs integration.
2492
2497
2493 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2498 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2494 argument to allow titling individual arrays when plotting.
2499 argument to allow titling individual arrays when plotting.
2495
2500
2496 2002-07-15 Fernando Perez <fperez@colorado.edu>
2501 2002-07-15 Fernando Perez <fperez@colorado.edu>
2497
2502
2498 * setup.py (make_shortcut): changed to retrieve the value of
2503 * setup.py (make_shortcut): changed to retrieve the value of
2499 'Program Files' directory from the registry (this value changes in
2504 'Program Files' directory from the registry (this value changes in
2500 non-english versions of Windows). Thanks to Thomas Fanslau
2505 non-english versions of Windows). Thanks to Thomas Fanslau
2501 <tfanslau-AT-gmx.de> for the report.
2506 <tfanslau-AT-gmx.de> for the report.
2502
2507
2503 2002-07-10 Fernando Perez <fperez@colorado.edu>
2508 2002-07-10 Fernando Perez <fperez@colorado.edu>
2504
2509
2505 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2510 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2506 a bug in pdb, which crashes if a line with only whitespace is
2511 a bug in pdb, which crashes if a line with only whitespace is
2507 entered. Bug report submitted to sourceforge.
2512 entered. Bug report submitted to sourceforge.
2508
2513
2509 2002-07-09 Fernando Perez <fperez@colorado.edu>
2514 2002-07-09 Fernando Perez <fperez@colorado.edu>
2510
2515
2511 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2516 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2512 reporting exceptions (it's a bug in inspect.py, I just set a
2517 reporting exceptions (it's a bug in inspect.py, I just set a
2513 workaround).
2518 workaround).
2514
2519
2515 2002-07-08 Fernando Perez <fperez@colorado.edu>
2520 2002-07-08 Fernando Perez <fperez@colorado.edu>
2516
2521
2517 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2522 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2518 __IPYTHON__ in __builtins__ to show up in user_ns.
2523 __IPYTHON__ in __builtins__ to show up in user_ns.
2519
2524
2520 2002-07-03 Fernando Perez <fperez@colorado.edu>
2525 2002-07-03 Fernando Perez <fperez@colorado.edu>
2521
2526
2522 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2527 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2523 name from @gp_set_instance to @gp_set_default.
2528 name from @gp_set_instance to @gp_set_default.
2524
2529
2525 * IPython/ipmaker.py (make_IPython): default editor value set to
2530 * IPython/ipmaker.py (make_IPython): default editor value set to
2526 '0' (a string), to match the rc file. Otherwise will crash when
2531 '0' (a string), to match the rc file. Otherwise will crash when
2527 .strip() is called on it.
2532 .strip() is called on it.
2528
2533
2529
2534
2530 2002-06-28 Fernando Perez <fperez@colorado.edu>
2535 2002-06-28 Fernando Perez <fperez@colorado.edu>
2531
2536
2532 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2537 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2533 of files in current directory when a file is executed via
2538 of files in current directory when a file is executed via
2534 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2539 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2535
2540
2536 * setup.py (manfiles): fix for rpm builds, submitted by RA
2541 * setup.py (manfiles): fix for rpm builds, submitted by RA
2537 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2542 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2538
2543
2539 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2544 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2540 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2545 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2541 string!). A. Schmolck caught this one.
2546 string!). A. Schmolck caught this one.
2542
2547
2543 2002-06-27 Fernando Perez <fperez@colorado.edu>
2548 2002-06-27 Fernando Perez <fperez@colorado.edu>
2544
2549
2545 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2550 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2546 defined files at the cmd line. __name__ wasn't being set to
2551 defined files at the cmd line. __name__ wasn't being set to
2547 __main__.
2552 __main__.
2548
2553
2549 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2554 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2550 regular lists and tuples besides Numeric arrays.
2555 regular lists and tuples besides Numeric arrays.
2551
2556
2552 * IPython/Prompts.py (CachedOutput.__call__): Added output
2557 * IPython/Prompts.py (CachedOutput.__call__): Added output
2553 supression for input ending with ';'. Similar to Mathematica and
2558 supression for input ending with ';'. Similar to Mathematica and
2554 Matlab. The _* vars and Out[] list are still updated, just like
2559 Matlab. The _* vars and Out[] list are still updated, just like
2555 Mathematica behaves.
2560 Mathematica behaves.
2556
2561
2557 2002-06-25 Fernando Perez <fperez@colorado.edu>
2562 2002-06-25 Fernando Perez <fperez@colorado.edu>
2558
2563
2559 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2564 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2560 .ini extensions for profiels under Windows.
2565 .ini extensions for profiels under Windows.
2561
2566
2562 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2567 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2563 string form. Fix contributed by Alexander Schmolck
2568 string form. Fix contributed by Alexander Schmolck
2564 <a.schmolck-AT-gmx.net>
2569 <a.schmolck-AT-gmx.net>
2565
2570
2566 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2571 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2567 pre-configured Gnuplot instance.
2572 pre-configured Gnuplot instance.
2568
2573
2569 2002-06-21 Fernando Perez <fperez@colorado.edu>
2574 2002-06-21 Fernando Perez <fperez@colorado.edu>
2570
2575
2571 * IPython/numutils.py (exp_safe): new function, works around the
2576 * IPython/numutils.py (exp_safe): new function, works around the
2572 underflow problems in Numeric.
2577 underflow problems in Numeric.
2573 (log2): New fn. Safe log in base 2: returns exact integer answer
2578 (log2): New fn. Safe log in base 2: returns exact integer answer
2574 for exact integer powers of 2.
2579 for exact integer powers of 2.
2575
2580
2576 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2581 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2577 properly.
2582 properly.
2578
2583
2579 2002-06-20 Fernando Perez <fperez@colorado.edu>
2584 2002-06-20 Fernando Perez <fperez@colorado.edu>
2580
2585
2581 * IPython/genutils.py (timing): new function like
2586 * IPython/genutils.py (timing): new function like
2582 Mathematica's. Similar to time_test, but returns more info.
2587 Mathematica's. Similar to time_test, but returns more info.
2583
2588
2584 2002-06-18 Fernando Perez <fperez@colorado.edu>
2589 2002-06-18 Fernando Perez <fperez@colorado.edu>
2585
2590
2586 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2591 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2587 according to Mike Heeter's suggestions.
2592 according to Mike Heeter's suggestions.
2588
2593
2589 2002-06-16 Fernando Perez <fperez@colorado.edu>
2594 2002-06-16 Fernando Perez <fperez@colorado.edu>
2590
2595
2591 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2596 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2592 system. GnuplotMagic is gone as a user-directory option. New files
2597 system. GnuplotMagic is gone as a user-directory option. New files
2593 make it easier to use all the gnuplot stuff both from external
2598 make it easier to use all the gnuplot stuff both from external
2594 programs as well as from IPython. Had to rewrite part of
2599 programs as well as from IPython. Had to rewrite part of
2595 hardcopy() b/c of a strange bug: often the ps files simply don't
2600 hardcopy() b/c of a strange bug: often the ps files simply don't
2596 get created, and require a repeat of the command (often several
2601 get created, and require a repeat of the command (often several
2597 times).
2602 times).
2598
2603
2599 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2604 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2600 resolve output channel at call time, so that if sys.stderr has
2605 resolve output channel at call time, so that if sys.stderr has
2601 been redirected by user this gets honored.
2606 been redirected by user this gets honored.
2602
2607
2603 2002-06-13 Fernando Perez <fperez@colorado.edu>
2608 2002-06-13 Fernando Perez <fperez@colorado.edu>
2604
2609
2605 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2610 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2606 IPShell. Kept a copy with the old names to avoid breaking people's
2611 IPShell. Kept a copy with the old names to avoid breaking people's
2607 embedded code.
2612 embedded code.
2608
2613
2609 * IPython/ipython: simplified it to the bare minimum after
2614 * IPython/ipython: simplified it to the bare minimum after
2610 Holger's suggestions. Added info about how to use it in
2615 Holger's suggestions. Added info about how to use it in
2611 PYTHONSTARTUP.
2616 PYTHONSTARTUP.
2612
2617
2613 * IPython/Shell.py (IPythonShell): changed the options passing
2618 * IPython/Shell.py (IPythonShell): changed the options passing
2614 from a string with funky %s replacements to a straight list. Maybe
2619 from a string with funky %s replacements to a straight list. Maybe
2615 a bit more typing, but it follows sys.argv conventions, so there's
2620 a bit more typing, but it follows sys.argv conventions, so there's
2616 less special-casing to remember.
2621 less special-casing to remember.
2617
2622
2618 2002-06-12 Fernando Perez <fperez@colorado.edu>
2623 2002-06-12 Fernando Perez <fperez@colorado.edu>
2619
2624
2620 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2625 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2621 command. Thanks to a suggestion by Mike Heeter.
2626 command. Thanks to a suggestion by Mike Heeter.
2622 (Magic.magic_pfile): added behavior to look at filenames if given
2627 (Magic.magic_pfile): added behavior to look at filenames if given
2623 arg is not a defined object.
2628 arg is not a defined object.
2624 (Magic.magic_save): New @save function to save code snippets. Also
2629 (Magic.magic_save): New @save function to save code snippets. Also
2625 a Mike Heeter idea.
2630 a Mike Heeter idea.
2626
2631
2627 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2632 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2628 plot() and replot(). Much more convenient now, especially for
2633 plot() and replot(). Much more convenient now, especially for
2629 interactive use.
2634 interactive use.
2630
2635
2631 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2636 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2632 filenames.
2637 filenames.
2633
2638
2634 2002-06-02 Fernando Perez <fperez@colorado.edu>
2639 2002-06-02 Fernando Perez <fperez@colorado.edu>
2635
2640
2636 * IPython/Struct.py (Struct.__init__): modified to admit
2641 * IPython/Struct.py (Struct.__init__): modified to admit
2637 initialization via another struct.
2642 initialization via another struct.
2638
2643
2639 * IPython/genutils.py (SystemExec.__init__): New stateful
2644 * IPython/genutils.py (SystemExec.__init__): New stateful
2640 interface to xsys and bq. Useful for writing system scripts.
2645 interface to xsys and bq. Useful for writing system scripts.
2641
2646
2642 2002-05-30 Fernando Perez <fperez@colorado.edu>
2647 2002-05-30 Fernando Perez <fperez@colorado.edu>
2643
2648
2644 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2649 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2645 documents. This will make the user download smaller (it's getting
2650 documents. This will make the user download smaller (it's getting
2646 too big).
2651 too big).
2647
2652
2648 2002-05-29 Fernando Perez <fperez@colorado.edu>
2653 2002-05-29 Fernando Perez <fperez@colorado.edu>
2649
2654
2650 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2655 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2651 fix problems with shelve and pickle. Seems to work, but I don't
2656 fix problems with shelve and pickle. Seems to work, but I don't
2652 know if corner cases break it. Thanks to Mike Heeter
2657 know if corner cases break it. Thanks to Mike Heeter
2653 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2658 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2654
2659
2655 2002-05-24 Fernando Perez <fperez@colorado.edu>
2660 2002-05-24 Fernando Perez <fperez@colorado.edu>
2656
2661
2657 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2662 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2658 macros having broken.
2663 macros having broken.
2659
2664
2660 2002-05-21 Fernando Perez <fperez@colorado.edu>
2665 2002-05-21 Fernando Perez <fperez@colorado.edu>
2661
2666
2662 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2667 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2663 introduced logging bug: all history before logging started was
2668 introduced logging bug: all history before logging started was
2664 being written one character per line! This came from the redesign
2669 being written one character per line! This came from the redesign
2665 of the input history as a special list which slices to strings,
2670 of the input history as a special list which slices to strings,
2666 not to lists.
2671 not to lists.
2667
2672
2668 2002-05-20 Fernando Perez <fperez@colorado.edu>
2673 2002-05-20 Fernando Perez <fperez@colorado.edu>
2669
2674
2670 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2675 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2671 be an attribute of all classes in this module. The design of these
2676 be an attribute of all classes in this module. The design of these
2672 classes needs some serious overhauling.
2677 classes needs some serious overhauling.
2673
2678
2674 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2679 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2675 which was ignoring '_' in option names.
2680 which was ignoring '_' in option names.
2676
2681
2677 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2682 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2678 'Verbose_novars' to 'Context' and made it the new default. It's a
2683 'Verbose_novars' to 'Context' and made it the new default. It's a
2679 bit more readable and also safer than verbose.
2684 bit more readable and also safer than verbose.
2680
2685
2681 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2686 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2682 triple-quoted strings.
2687 triple-quoted strings.
2683
2688
2684 * IPython/OInspect.py (__all__): new module exposing the object
2689 * IPython/OInspect.py (__all__): new module exposing the object
2685 introspection facilities. Now the corresponding magics are dummy
2690 introspection facilities. Now the corresponding magics are dummy
2686 wrappers around this. Having this module will make it much easier
2691 wrappers around this. Having this module will make it much easier
2687 to put these functions into our modified pdb.
2692 to put these functions into our modified pdb.
2688 This new object inspector system uses the new colorizing module,
2693 This new object inspector system uses the new colorizing module,
2689 so source code and other things are nicely syntax highlighted.
2694 so source code and other things are nicely syntax highlighted.
2690
2695
2691 2002-05-18 Fernando Perez <fperez@colorado.edu>
2696 2002-05-18 Fernando Perez <fperez@colorado.edu>
2692
2697
2693 * IPython/ColorANSI.py: Split the coloring tools into a separate
2698 * IPython/ColorANSI.py: Split the coloring tools into a separate
2694 module so I can use them in other code easier (they were part of
2699 module so I can use them in other code easier (they were part of
2695 ultraTB).
2700 ultraTB).
2696
2701
2697 2002-05-17 Fernando Perez <fperez@colorado.edu>
2702 2002-05-17 Fernando Perez <fperez@colorado.edu>
2698
2703
2699 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2704 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2700 fixed it to set the global 'g' also to the called instance, as
2705 fixed it to set the global 'g' also to the called instance, as
2701 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2706 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2702 user's 'g' variables).
2707 user's 'g' variables).
2703
2708
2704 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2709 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2705 global variables (aliases to _ih,_oh) so that users which expect
2710 global variables (aliases to _ih,_oh) so that users which expect
2706 In[5] or Out[7] to work aren't unpleasantly surprised.
2711 In[5] or Out[7] to work aren't unpleasantly surprised.
2707 (InputList.__getslice__): new class to allow executing slices of
2712 (InputList.__getslice__): new class to allow executing slices of
2708 input history directly. Very simple class, complements the use of
2713 input history directly. Very simple class, complements the use of
2709 macros.
2714 macros.
2710
2715
2711 2002-05-16 Fernando Perez <fperez@colorado.edu>
2716 2002-05-16 Fernando Perez <fperez@colorado.edu>
2712
2717
2713 * setup.py (docdirbase): make doc directory be just doc/IPython
2718 * setup.py (docdirbase): make doc directory be just doc/IPython
2714 without version numbers, it will reduce clutter for users.
2719 without version numbers, it will reduce clutter for users.
2715
2720
2716 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2721 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2717 execfile call to prevent possible memory leak. See for details:
2722 execfile call to prevent possible memory leak. See for details:
2718 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2723 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2719
2724
2720 2002-05-15 Fernando Perez <fperez@colorado.edu>
2725 2002-05-15 Fernando Perez <fperez@colorado.edu>
2721
2726
2722 * IPython/Magic.py (Magic.magic_psource): made the object
2727 * IPython/Magic.py (Magic.magic_psource): made the object
2723 introspection names be more standard: pdoc, pdef, pfile and
2728 introspection names be more standard: pdoc, pdef, pfile and
2724 psource. They all print/page their output, and it makes
2729 psource. They all print/page their output, and it makes
2725 remembering them easier. Kept old names for compatibility as
2730 remembering them easier. Kept old names for compatibility as
2726 aliases.
2731 aliases.
2727
2732
2728 2002-05-14 Fernando Perez <fperez@colorado.edu>
2733 2002-05-14 Fernando Perez <fperez@colorado.edu>
2729
2734
2730 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2735 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2731 what the mouse problem was. The trick is to use gnuplot with temp
2736 what the mouse problem was. The trick is to use gnuplot with temp
2732 files and NOT with pipes (for data communication), because having
2737 files and NOT with pipes (for data communication), because having
2733 both pipes and the mouse on is bad news.
2738 both pipes and the mouse on is bad news.
2734
2739
2735 2002-05-13 Fernando Perez <fperez@colorado.edu>
2740 2002-05-13 Fernando Perez <fperez@colorado.edu>
2736
2741
2737 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2742 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2738 bug. Information would be reported about builtins even when
2743 bug. Information would be reported about builtins even when
2739 user-defined functions overrode them.
2744 user-defined functions overrode them.
2740
2745
2741 2002-05-11 Fernando Perez <fperez@colorado.edu>
2746 2002-05-11 Fernando Perez <fperez@colorado.edu>
2742
2747
2743 * IPython/__init__.py (__all__): removed FlexCompleter from
2748 * IPython/__init__.py (__all__): removed FlexCompleter from
2744 __all__ so that things don't fail in platforms without readline.
2749 __all__ so that things don't fail in platforms without readline.
2745
2750
2746 2002-05-10 Fernando Perez <fperez@colorado.edu>
2751 2002-05-10 Fernando Perez <fperez@colorado.edu>
2747
2752
2748 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2753 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2749 it requires Numeric, effectively making Numeric a dependency for
2754 it requires Numeric, effectively making Numeric a dependency for
2750 IPython.
2755 IPython.
2751
2756
2752 * Released 0.2.13
2757 * Released 0.2.13
2753
2758
2754 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2759 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2755 profiler interface. Now all the major options from the profiler
2760 profiler interface. Now all the major options from the profiler
2756 module are directly supported in IPython, both for single
2761 module are directly supported in IPython, both for single
2757 expressions (@prun) and for full programs (@run -p).
2762 expressions (@prun) and for full programs (@run -p).
2758
2763
2759 2002-05-09 Fernando Perez <fperez@colorado.edu>
2764 2002-05-09 Fernando Perez <fperez@colorado.edu>
2760
2765
2761 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2766 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2762 magic properly formatted for screen.
2767 magic properly formatted for screen.
2763
2768
2764 * setup.py (make_shortcut): Changed things to put pdf version in
2769 * setup.py (make_shortcut): Changed things to put pdf version in
2765 doc/ instead of doc/manual (had to change lyxport a bit).
2770 doc/ instead of doc/manual (had to change lyxport a bit).
2766
2771
2767 * IPython/Magic.py (Profile.string_stats): made profile runs go
2772 * IPython/Magic.py (Profile.string_stats): made profile runs go
2768 through pager (they are long and a pager allows searching, saving,
2773 through pager (they are long and a pager allows searching, saving,
2769 etc.)
2774 etc.)
2770
2775
2771 2002-05-08 Fernando Perez <fperez@colorado.edu>
2776 2002-05-08 Fernando Perez <fperez@colorado.edu>
2772
2777
2773 * Released 0.2.12
2778 * Released 0.2.12
2774
2779
2775 2002-05-06 Fernando Perez <fperez@colorado.edu>
2780 2002-05-06 Fernando Perez <fperez@colorado.edu>
2776
2781
2777 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2782 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2778 introduced); 'hist n1 n2' was broken.
2783 introduced); 'hist n1 n2' was broken.
2779 (Magic.magic_pdb): added optional on/off arguments to @pdb
2784 (Magic.magic_pdb): added optional on/off arguments to @pdb
2780 (Magic.magic_run): added option -i to @run, which executes code in
2785 (Magic.magic_run): added option -i to @run, which executes code in
2781 the IPython namespace instead of a clean one. Also added @irun as
2786 the IPython namespace instead of a clean one. Also added @irun as
2782 an alias to @run -i.
2787 an alias to @run -i.
2783
2788
2784 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2789 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2785 fixed (it didn't really do anything, the namespaces were wrong).
2790 fixed (it didn't really do anything, the namespaces were wrong).
2786
2791
2787 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2792 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2788
2793
2789 * IPython/__init__.py (__all__): Fixed package namespace, now
2794 * IPython/__init__.py (__all__): Fixed package namespace, now
2790 'import IPython' does give access to IPython.<all> as
2795 'import IPython' does give access to IPython.<all> as
2791 expected. Also renamed __release__ to Release.
2796 expected. Also renamed __release__ to Release.
2792
2797
2793 * IPython/Debugger.py (__license__): created new Pdb class which
2798 * IPython/Debugger.py (__license__): created new Pdb class which
2794 functions like a drop-in for the normal pdb.Pdb but does NOT
2799 functions like a drop-in for the normal pdb.Pdb but does NOT
2795 import readline by default. This way it doesn't muck up IPython's
2800 import readline by default. This way it doesn't muck up IPython's
2796 readline handling, and now tab-completion finally works in the
2801 readline handling, and now tab-completion finally works in the
2797 debugger -- sort of. It completes things globally visible, but the
2802 debugger -- sort of. It completes things globally visible, but the
2798 completer doesn't track the stack as pdb walks it. That's a bit
2803 completer doesn't track the stack as pdb walks it. That's a bit
2799 tricky, and I'll have to implement it later.
2804 tricky, and I'll have to implement it later.
2800
2805
2801 2002-05-05 Fernando Perez <fperez@colorado.edu>
2806 2002-05-05 Fernando Perez <fperez@colorado.edu>
2802
2807
2803 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2808 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2804 magic docstrings when printed via ? (explicit \'s were being
2809 magic docstrings when printed via ? (explicit \'s were being
2805 printed).
2810 printed).
2806
2811
2807 * IPython/ipmaker.py (make_IPython): fixed namespace
2812 * IPython/ipmaker.py (make_IPython): fixed namespace
2808 identification bug. Now variables loaded via logs or command-line
2813 identification bug. Now variables loaded via logs or command-line
2809 files are recognized in the interactive namespace by @who.
2814 files are recognized in the interactive namespace by @who.
2810
2815
2811 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2816 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2812 log replay system stemming from the string form of Structs.
2817 log replay system stemming from the string form of Structs.
2813
2818
2814 * IPython/Magic.py (Macro.__init__): improved macros to properly
2819 * IPython/Magic.py (Macro.__init__): improved macros to properly
2815 handle magic commands in them.
2820 handle magic commands in them.
2816 (Magic.magic_logstart): usernames are now expanded so 'logstart
2821 (Magic.magic_logstart): usernames are now expanded so 'logstart
2817 ~/mylog' now works.
2822 ~/mylog' now works.
2818
2823
2819 * IPython/iplib.py (complete): fixed bug where paths starting with
2824 * IPython/iplib.py (complete): fixed bug where paths starting with
2820 '/' would be completed as magic names.
2825 '/' would be completed as magic names.
2821
2826
2822 2002-05-04 Fernando Perez <fperez@colorado.edu>
2827 2002-05-04 Fernando Perez <fperez@colorado.edu>
2823
2828
2824 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2829 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2825 allow running full programs under the profiler's control.
2830 allow running full programs under the profiler's control.
2826
2831
2827 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2832 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2828 mode to report exceptions verbosely but without formatting
2833 mode to report exceptions verbosely but without formatting
2829 variables. This addresses the issue of ipython 'freezing' (it's
2834 variables. This addresses the issue of ipython 'freezing' (it's
2830 not frozen, but caught in an expensive formatting loop) when huge
2835 not frozen, but caught in an expensive formatting loop) when huge
2831 variables are in the context of an exception.
2836 variables are in the context of an exception.
2832 (VerboseTB.text): Added '--->' markers at line where exception was
2837 (VerboseTB.text): Added '--->' markers at line where exception was
2833 triggered. Much clearer to read, especially in NoColor modes.
2838 triggered. Much clearer to read, especially in NoColor modes.
2834
2839
2835 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2840 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2836 implemented in reverse when changing to the new parse_options().
2841 implemented in reverse when changing to the new parse_options().
2837
2842
2838 2002-05-03 Fernando Perez <fperez@colorado.edu>
2843 2002-05-03 Fernando Perez <fperez@colorado.edu>
2839
2844
2840 * IPython/Magic.py (Magic.parse_options): new function so that
2845 * IPython/Magic.py (Magic.parse_options): new function so that
2841 magics can parse options easier.
2846 magics can parse options easier.
2842 (Magic.magic_prun): new function similar to profile.run(),
2847 (Magic.magic_prun): new function similar to profile.run(),
2843 suggested by Chris Hart.
2848 suggested by Chris Hart.
2844 (Magic.magic_cd): fixed behavior so that it only changes if
2849 (Magic.magic_cd): fixed behavior so that it only changes if
2845 directory actually is in history.
2850 directory actually is in history.
2846
2851
2847 * IPython/usage.py (__doc__): added information about potential
2852 * IPython/usage.py (__doc__): added information about potential
2848 slowness of Verbose exception mode when there are huge data
2853 slowness of Verbose exception mode when there are huge data
2849 structures to be formatted (thanks to Archie Paulson).
2854 structures to be formatted (thanks to Archie Paulson).
2850
2855
2851 * IPython/ipmaker.py (make_IPython): Changed default logging
2856 * IPython/ipmaker.py (make_IPython): Changed default logging
2852 (when simply called with -log) to use curr_dir/ipython.log in
2857 (when simply called with -log) to use curr_dir/ipython.log in
2853 rotate mode. Fixed crash which was occuring with -log before
2858 rotate mode. Fixed crash which was occuring with -log before
2854 (thanks to Jim Boyle).
2859 (thanks to Jim Boyle).
2855
2860
2856 2002-05-01 Fernando Perez <fperez@colorado.edu>
2861 2002-05-01 Fernando Perez <fperez@colorado.edu>
2857
2862
2858 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2863 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2859 was nasty -- though somewhat of a corner case).
2864 was nasty -- though somewhat of a corner case).
2860
2865
2861 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2866 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2862 text (was a bug).
2867 text (was a bug).
2863
2868
2864 2002-04-30 Fernando Perez <fperez@colorado.edu>
2869 2002-04-30 Fernando Perez <fperez@colorado.edu>
2865
2870
2866 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2871 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2867 a print after ^D or ^C from the user so that the In[] prompt
2872 a print after ^D or ^C from the user so that the In[] prompt
2868 doesn't over-run the gnuplot one.
2873 doesn't over-run the gnuplot one.
2869
2874
2870 2002-04-29 Fernando Perez <fperez@colorado.edu>
2875 2002-04-29 Fernando Perez <fperez@colorado.edu>
2871
2876
2872 * Released 0.2.10
2877 * Released 0.2.10
2873
2878
2874 * IPython/__release__.py (version): get date dynamically.
2879 * IPython/__release__.py (version): get date dynamically.
2875
2880
2876 * Misc. documentation updates thanks to Arnd's comments. Also ran
2881 * Misc. documentation updates thanks to Arnd's comments. Also ran
2877 a full spellcheck on the manual (hadn't been done in a while).
2882 a full spellcheck on the manual (hadn't been done in a while).
2878
2883
2879 2002-04-27 Fernando Perez <fperez@colorado.edu>
2884 2002-04-27 Fernando Perez <fperez@colorado.edu>
2880
2885
2881 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
2886 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
2882 starting a log in mid-session would reset the input history list.
2887 starting a log in mid-session would reset the input history list.
2883
2888
2884 2002-04-26 Fernando Perez <fperez@colorado.edu>
2889 2002-04-26 Fernando Perez <fperez@colorado.edu>
2885
2890
2886 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
2891 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
2887 all files were being included in an update. Now anything in
2892 all files were being included in an update. Now anything in
2888 UserConfig that matches [A-Za-z]*.py will go (this excludes
2893 UserConfig that matches [A-Za-z]*.py will go (this excludes
2889 __init__.py)
2894 __init__.py)
2890
2895
2891 2002-04-25 Fernando Perez <fperez@colorado.edu>
2896 2002-04-25 Fernando Perez <fperez@colorado.edu>
2892
2897
2893 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
2898 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
2894 to __builtins__ so that any form of embedded or imported code can
2899 to __builtins__ so that any form of embedded or imported code can
2895 test for being inside IPython.
2900 test for being inside IPython.
2896
2901
2897 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
2902 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
2898 changed to GnuplotMagic because it's now an importable module,
2903 changed to GnuplotMagic because it's now an importable module,
2899 this makes the name follow that of the standard Gnuplot module.
2904 this makes the name follow that of the standard Gnuplot module.
2900 GnuplotMagic can now be loaded at any time in mid-session.
2905 GnuplotMagic can now be loaded at any time in mid-session.
2901
2906
2902 2002-04-24 Fernando Perez <fperez@colorado.edu>
2907 2002-04-24 Fernando Perez <fperez@colorado.edu>
2903
2908
2904 * IPython/numutils.py: removed SIUnits. It doesn't properly set
2909 * IPython/numutils.py: removed SIUnits. It doesn't properly set
2905 the globals (IPython has its own namespace) and the
2910 the globals (IPython has its own namespace) and the
2906 PhysicalQuantity stuff is much better anyway.
2911 PhysicalQuantity stuff is much better anyway.
2907
2912
2908 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
2913 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
2909 embedding example to standard user directory for
2914 embedding example to standard user directory for
2910 distribution. Also put it in the manual.
2915 distribution. Also put it in the manual.
2911
2916
2912 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
2917 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
2913 instance as first argument (so it doesn't rely on some obscure
2918 instance as first argument (so it doesn't rely on some obscure
2914 hidden global).
2919 hidden global).
2915
2920
2916 * IPython/UserConfig/ipythonrc.py: put () back in accepted
2921 * IPython/UserConfig/ipythonrc.py: put () back in accepted
2917 delimiters. While it prevents ().TAB from working, it allows
2922 delimiters. While it prevents ().TAB from working, it allows
2918 completions in open (... expressions. This is by far a more common
2923 completions in open (... expressions. This is by far a more common
2919 case.
2924 case.
2920
2925
2921 2002-04-23 Fernando Perez <fperez@colorado.edu>
2926 2002-04-23 Fernando Perez <fperez@colorado.edu>
2922
2927
2923 * IPython/Extensions/InterpreterPasteInput.py: new
2928 * IPython/Extensions/InterpreterPasteInput.py: new
2924 syntax-processing module for pasting lines with >>> or ... at the
2929 syntax-processing module for pasting lines with >>> or ... at the
2925 start.
2930 start.
2926
2931
2927 * IPython/Extensions/PhysicalQ_Interactive.py
2932 * IPython/Extensions/PhysicalQ_Interactive.py
2928 (PhysicalQuantityInteractive.__int__): fixed to work with either
2933 (PhysicalQuantityInteractive.__int__): fixed to work with either
2929 Numeric or math.
2934 Numeric or math.
2930
2935
2931 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
2936 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
2932 provided profiles. Now we have:
2937 provided profiles. Now we have:
2933 -math -> math module as * and cmath with its own namespace.
2938 -math -> math module as * and cmath with its own namespace.
2934 -numeric -> Numeric as *, plus gnuplot & grace
2939 -numeric -> Numeric as *, plus gnuplot & grace
2935 -physics -> same as before
2940 -physics -> same as before
2936
2941
2937 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
2942 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
2938 user-defined magics wouldn't be found by @magic if they were
2943 user-defined magics wouldn't be found by @magic if they were
2939 defined as class methods. Also cleaned up the namespace search
2944 defined as class methods. Also cleaned up the namespace search
2940 logic and the string building (to use %s instead of many repeated
2945 logic and the string building (to use %s instead of many repeated
2941 string adds).
2946 string adds).
2942
2947
2943 * IPython/UserConfig/example-magic.py (magic_foo): updated example
2948 * IPython/UserConfig/example-magic.py (magic_foo): updated example
2944 of user-defined magics to operate with class methods (cleaner, in
2949 of user-defined magics to operate with class methods (cleaner, in
2945 line with the gnuplot code).
2950 line with the gnuplot code).
2946
2951
2947 2002-04-22 Fernando Perez <fperez@colorado.edu>
2952 2002-04-22 Fernando Perez <fperez@colorado.edu>
2948
2953
2949 * setup.py: updated dependency list so that manual is updated when
2954 * setup.py: updated dependency list so that manual is updated when
2950 all included files change.
2955 all included files change.
2951
2956
2952 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
2957 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
2953 the delimiter removal option (the fix is ugly right now).
2958 the delimiter removal option (the fix is ugly right now).
2954
2959
2955 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
2960 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
2956 all of the math profile (quicker loading, no conflict between
2961 all of the math profile (quicker loading, no conflict between
2957 g-9.8 and g-gnuplot).
2962 g-9.8 and g-gnuplot).
2958
2963
2959 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
2964 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
2960 name of post-mortem files to IPython_crash_report.txt.
2965 name of post-mortem files to IPython_crash_report.txt.
2961
2966
2962 * Cleanup/update of the docs. Added all the new readline info and
2967 * Cleanup/update of the docs. Added all the new readline info and
2963 formatted all lists as 'real lists'.
2968 formatted all lists as 'real lists'.
2964
2969
2965 * IPython/ipmaker.py (make_IPython): removed now-obsolete
2970 * IPython/ipmaker.py (make_IPython): removed now-obsolete
2966 tab-completion options, since the full readline parse_and_bind is
2971 tab-completion options, since the full readline parse_and_bind is
2967 now accessible.
2972 now accessible.
2968
2973
2969 * IPython/iplib.py (InteractiveShell.init_readline): Changed
2974 * IPython/iplib.py (InteractiveShell.init_readline): Changed
2970 handling of readline options. Now users can specify any string to
2975 handling of readline options. Now users can specify any string to
2971 be passed to parse_and_bind(), as well as the delimiters to be
2976 be passed to parse_and_bind(), as well as the delimiters to be
2972 removed.
2977 removed.
2973 (InteractiveShell.__init__): Added __name__ to the global
2978 (InteractiveShell.__init__): Added __name__ to the global
2974 namespace so that things like Itpl which rely on its existence
2979 namespace so that things like Itpl which rely on its existence
2975 don't crash.
2980 don't crash.
2976 (InteractiveShell._prefilter): Defined the default with a _ so
2981 (InteractiveShell._prefilter): Defined the default with a _ so
2977 that prefilter() is easier to override, while the default one
2982 that prefilter() is easier to override, while the default one
2978 remains available.
2983 remains available.
2979
2984
2980 2002-04-18 Fernando Perez <fperez@colorado.edu>
2985 2002-04-18 Fernando Perez <fperez@colorado.edu>
2981
2986
2982 * Added information about pdb in the docs.
2987 * Added information about pdb in the docs.
2983
2988
2984 2002-04-17 Fernando Perez <fperez@colorado.edu>
2989 2002-04-17 Fernando Perez <fperez@colorado.edu>
2985
2990
2986 * IPython/ipmaker.py (make_IPython): added rc_override option to
2991 * IPython/ipmaker.py (make_IPython): added rc_override option to
2987 allow passing config options at creation time which may override
2992 allow passing config options at creation time which may override
2988 anything set in the config files or command line. This is
2993 anything set in the config files or command line. This is
2989 particularly useful for configuring embedded instances.
2994 particularly useful for configuring embedded instances.
2990
2995
2991 2002-04-15 Fernando Perez <fperez@colorado.edu>
2996 2002-04-15 Fernando Perez <fperez@colorado.edu>
2992
2997
2993 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
2998 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
2994 crash embedded instances because of the input cache falling out of
2999 crash embedded instances because of the input cache falling out of
2995 sync with the output counter.
3000 sync with the output counter.
2996
3001
2997 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3002 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
2998 mode which calls pdb after an uncaught exception in IPython itself.
3003 mode which calls pdb after an uncaught exception in IPython itself.
2999
3004
3000 2002-04-14 Fernando Perez <fperez@colorado.edu>
3005 2002-04-14 Fernando Perez <fperez@colorado.edu>
3001
3006
3002 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3007 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3003 readline, fix it back after each call.
3008 readline, fix it back after each call.
3004
3009
3005 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3010 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3006 method to force all access via __call__(), which guarantees that
3011 method to force all access via __call__(), which guarantees that
3007 traceback references are properly deleted.
3012 traceback references are properly deleted.
3008
3013
3009 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3014 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3010 improve printing when pprint is in use.
3015 improve printing when pprint is in use.
3011
3016
3012 2002-04-13 Fernando Perez <fperez@colorado.edu>
3017 2002-04-13 Fernando Perez <fperez@colorado.edu>
3013
3018
3014 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3019 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3015 exceptions aren't caught anymore. If the user triggers one, he
3020 exceptions aren't caught anymore. If the user triggers one, he
3016 should know why he's doing it and it should go all the way up,
3021 should know why he's doing it and it should go all the way up,
3017 just like any other exception. So now @abort will fully kill the
3022 just like any other exception. So now @abort will fully kill the
3018 embedded interpreter and the embedding code (unless that happens
3023 embedded interpreter and the embedding code (unless that happens
3019 to catch SystemExit).
3024 to catch SystemExit).
3020
3025
3021 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3026 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3022 and a debugger() method to invoke the interactive pdb debugger
3027 and a debugger() method to invoke the interactive pdb debugger
3023 after printing exception information. Also added the corresponding
3028 after printing exception information. Also added the corresponding
3024 -pdb option and @pdb magic to control this feature, and updated
3029 -pdb option and @pdb magic to control this feature, and updated
3025 the docs. After a suggestion from Christopher Hart
3030 the docs. After a suggestion from Christopher Hart
3026 (hart-AT-caltech.edu).
3031 (hart-AT-caltech.edu).
3027
3032
3028 2002-04-12 Fernando Perez <fperez@colorado.edu>
3033 2002-04-12 Fernando Perez <fperez@colorado.edu>
3029
3034
3030 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3035 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3031 the exception handlers defined by the user (not the CrashHandler)
3036 the exception handlers defined by the user (not the CrashHandler)
3032 so that user exceptions don't trigger an ipython bug report.
3037 so that user exceptions don't trigger an ipython bug report.
3033
3038
3034 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3039 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3035 configurable (it should have always been so).
3040 configurable (it should have always been so).
3036
3041
3037 2002-03-26 Fernando Perez <fperez@colorado.edu>
3042 2002-03-26 Fernando Perez <fperez@colorado.edu>
3038
3043
3039 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3044 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3040 and there to fix embedding namespace issues. This should all be
3045 and there to fix embedding namespace issues. This should all be
3041 done in a more elegant way.
3046 done in a more elegant way.
3042
3047
3043 2002-03-25 Fernando Perez <fperez@colorado.edu>
3048 2002-03-25 Fernando Perez <fperez@colorado.edu>
3044
3049
3045 * IPython/genutils.py (get_home_dir): Try to make it work under
3050 * IPython/genutils.py (get_home_dir): Try to make it work under
3046 win9x also.
3051 win9x also.
3047
3052
3048 2002-03-20 Fernando Perez <fperez@colorado.edu>
3053 2002-03-20 Fernando Perez <fperez@colorado.edu>
3049
3054
3050 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3055 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3051 sys.displayhook untouched upon __init__.
3056 sys.displayhook untouched upon __init__.
3052
3057
3053 2002-03-19 Fernando Perez <fperez@colorado.edu>
3058 2002-03-19 Fernando Perez <fperez@colorado.edu>
3054
3059
3055 * Released 0.2.9 (for embedding bug, basically).
3060 * Released 0.2.9 (for embedding bug, basically).
3056
3061
3057 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3062 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3058 exceptions so that enclosing shell's state can be restored.
3063 exceptions so that enclosing shell's state can be restored.
3059
3064
3060 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3065 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3061 naming conventions in the .ipython/ dir.
3066 naming conventions in the .ipython/ dir.
3062
3067
3063 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3068 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3064 from delimiters list so filenames with - in them get expanded.
3069 from delimiters list so filenames with - in them get expanded.
3065
3070
3066 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3071 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3067 sys.displayhook not being properly restored after an embedded call.
3072 sys.displayhook not being properly restored after an embedded call.
3068
3073
3069 2002-03-18 Fernando Perez <fperez@colorado.edu>
3074 2002-03-18 Fernando Perez <fperez@colorado.edu>
3070
3075
3071 * Released 0.2.8
3076 * Released 0.2.8
3072
3077
3073 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3078 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3074 some files weren't being included in a -upgrade.
3079 some files weren't being included in a -upgrade.
3075 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3080 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3076 on' so that the first tab completes.
3081 on' so that the first tab completes.
3077 (InteractiveShell.handle_magic): fixed bug with spaces around
3082 (InteractiveShell.handle_magic): fixed bug with spaces around
3078 quotes breaking many magic commands.
3083 quotes breaking many magic commands.
3079
3084
3080 * setup.py: added note about ignoring the syntax error messages at
3085 * setup.py: added note about ignoring the syntax error messages at
3081 installation.
3086 installation.
3082
3087
3083 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3088 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3084 streamlining the gnuplot interface, now there's only one magic @gp.
3089 streamlining the gnuplot interface, now there's only one magic @gp.
3085
3090
3086 2002-03-17 Fernando Perez <fperez@colorado.edu>
3091 2002-03-17 Fernando Perez <fperez@colorado.edu>
3087
3092
3088 * IPython/UserConfig/magic_gnuplot.py: new name for the
3093 * IPython/UserConfig/magic_gnuplot.py: new name for the
3089 example-magic_pm.py file. Much enhanced system, now with a shell
3094 example-magic_pm.py file. Much enhanced system, now with a shell
3090 for communicating directly with gnuplot, one command at a time.
3095 for communicating directly with gnuplot, one command at a time.
3091
3096
3092 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3097 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3093 setting __name__=='__main__'.
3098 setting __name__=='__main__'.
3094
3099
3095 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3100 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3096 mini-shell for accessing gnuplot from inside ipython. Should
3101 mini-shell for accessing gnuplot from inside ipython. Should
3097 extend it later for grace access too. Inspired by Arnd's
3102 extend it later for grace access too. Inspired by Arnd's
3098 suggestion.
3103 suggestion.
3099
3104
3100 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3105 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3101 calling magic functions with () in their arguments. Thanks to Arnd
3106 calling magic functions with () in their arguments. Thanks to Arnd
3102 Baecker for pointing this to me.
3107 Baecker for pointing this to me.
3103
3108
3104 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3109 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3105 infinitely for integer or complex arrays (only worked with floats).
3110 infinitely for integer or complex arrays (only worked with floats).
3106
3111
3107 2002-03-16 Fernando Perez <fperez@colorado.edu>
3112 2002-03-16 Fernando Perez <fperez@colorado.edu>
3108
3113
3109 * setup.py: Merged setup and setup_windows into a single script
3114 * setup.py: Merged setup and setup_windows into a single script
3110 which properly handles things for windows users.
3115 which properly handles things for windows users.
3111
3116
3112 2002-03-15 Fernando Perez <fperez@colorado.edu>
3117 2002-03-15 Fernando Perez <fperez@colorado.edu>
3113
3118
3114 * Big change to the manual: now the magics are all automatically
3119 * Big change to the manual: now the magics are all automatically
3115 documented. This information is generated from their docstrings
3120 documented. This information is generated from their docstrings
3116 and put in a latex file included by the manual lyx file. This way
3121 and put in a latex file included by the manual lyx file. This way
3117 we get always up to date information for the magics. The manual
3122 we get always up to date information for the magics. The manual
3118 now also has proper version information, also auto-synced.
3123 now also has proper version information, also auto-synced.
3119
3124
3120 For this to work, an undocumented --magic_docstrings option was added.
3125 For this to work, an undocumented --magic_docstrings option was added.
3121
3126
3122 2002-03-13 Fernando Perez <fperez@colorado.edu>
3127 2002-03-13 Fernando Perez <fperez@colorado.edu>
3123
3128
3124 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3129 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3125 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3130 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3126
3131
3127 2002-03-12 Fernando Perez <fperez@colorado.edu>
3132 2002-03-12 Fernando Perez <fperez@colorado.edu>
3128
3133
3129 * IPython/ultraTB.py (TermColors): changed color escapes again to
3134 * IPython/ultraTB.py (TermColors): changed color escapes again to
3130 fix the (old, reintroduced) line-wrapping bug. Basically, if
3135 fix the (old, reintroduced) line-wrapping bug. Basically, if
3131 \001..\002 aren't given in the color escapes, lines get wrapped
3136 \001..\002 aren't given in the color escapes, lines get wrapped
3132 weirdly. But giving those screws up old xterms and emacs terms. So
3137 weirdly. But giving those screws up old xterms and emacs terms. So
3133 I added some logic for emacs terms to be ok, but I can't identify old
3138 I added some logic for emacs terms to be ok, but I can't identify old
3134 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3139 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3135
3140
3136 2002-03-10 Fernando Perez <fperez@colorado.edu>
3141 2002-03-10 Fernando Perez <fperez@colorado.edu>
3137
3142
3138 * IPython/usage.py (__doc__): Various documentation cleanups and
3143 * IPython/usage.py (__doc__): Various documentation cleanups and
3139 updates, both in usage docstrings and in the manual.
3144 updates, both in usage docstrings and in the manual.
3140
3145
3141 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3146 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3142 handling of caching. Set minimum acceptabe value for having a
3147 handling of caching. Set minimum acceptabe value for having a
3143 cache at 20 values.
3148 cache at 20 values.
3144
3149
3145 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3150 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3146 install_first_time function to a method, renamed it and added an
3151 install_first_time function to a method, renamed it and added an
3147 'upgrade' mode. Now people can update their config directory with
3152 'upgrade' mode. Now people can update their config directory with
3148 a simple command line switch (-upgrade, also new).
3153 a simple command line switch (-upgrade, also new).
3149
3154
3150 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3155 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3151 @file (convenient for automagic users under Python >= 2.2).
3156 @file (convenient for automagic users under Python >= 2.2).
3152 Removed @files (it seemed more like a plural than an abbrev. of
3157 Removed @files (it seemed more like a plural than an abbrev. of
3153 'file show').
3158 'file show').
3154
3159
3155 * IPython/iplib.py (install_first_time): Fixed crash if there were
3160 * IPython/iplib.py (install_first_time): Fixed crash if there were
3156 backup files ('~') in .ipython/ install directory.
3161 backup files ('~') in .ipython/ install directory.
3157
3162
3158 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3163 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3159 system. Things look fine, but these changes are fairly
3164 system. Things look fine, but these changes are fairly
3160 intrusive. Test them for a few days.
3165 intrusive. Test them for a few days.
3161
3166
3162 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3167 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3163 the prompts system. Now all in/out prompt strings are user
3168 the prompts system. Now all in/out prompt strings are user
3164 controllable. This is particularly useful for embedding, as one
3169 controllable. This is particularly useful for embedding, as one
3165 can tag embedded instances with particular prompts.
3170 can tag embedded instances with particular prompts.
3166
3171
3167 Also removed global use of sys.ps1/2, which now allows nested
3172 Also removed global use of sys.ps1/2, which now allows nested
3168 embeddings without any problems. Added command-line options for
3173 embeddings without any problems. Added command-line options for
3169 the prompt strings.
3174 the prompt strings.
3170
3175
3171 2002-03-08 Fernando Perez <fperez@colorado.edu>
3176 2002-03-08 Fernando Perez <fperez@colorado.edu>
3172
3177
3173 * IPython/UserConfig/example-embed-short.py (ipshell): added
3178 * IPython/UserConfig/example-embed-short.py (ipshell): added
3174 example file with the bare minimum code for embedding.
3179 example file with the bare minimum code for embedding.
3175
3180
3176 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3181 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3177 functionality for the embeddable shell to be activated/deactivated
3182 functionality for the embeddable shell to be activated/deactivated
3178 either globally or at each call.
3183 either globally or at each call.
3179
3184
3180 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3185 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3181 rewriting the prompt with '--->' for auto-inputs with proper
3186 rewriting the prompt with '--->' for auto-inputs with proper
3182 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3187 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3183 this is handled by the prompts class itself, as it should.
3188 this is handled by the prompts class itself, as it should.
3184
3189
3185 2002-03-05 Fernando Perez <fperez@colorado.edu>
3190 2002-03-05 Fernando Perez <fperez@colorado.edu>
3186
3191
3187 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3192 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3188 @logstart to avoid name clashes with the math log function.
3193 @logstart to avoid name clashes with the math log function.
3189
3194
3190 * Big updates to X/Emacs section of the manual.
3195 * Big updates to X/Emacs section of the manual.
3191
3196
3192 * Removed ipython_emacs. Milan explained to me how to pass
3197 * Removed ipython_emacs. Milan explained to me how to pass
3193 arguments to ipython through Emacs. Some day I'm going to end up
3198 arguments to ipython through Emacs. Some day I'm going to end up
3194 learning some lisp...
3199 learning some lisp...
3195
3200
3196 2002-03-04 Fernando Perez <fperez@colorado.edu>
3201 2002-03-04 Fernando Perez <fperez@colorado.edu>
3197
3202
3198 * IPython/ipython_emacs: Created script to be used as the
3203 * IPython/ipython_emacs: Created script to be used as the
3199 py-python-command Emacs variable so we can pass IPython
3204 py-python-command Emacs variable so we can pass IPython
3200 parameters. I can't figure out how to tell Emacs directly to pass
3205 parameters. I can't figure out how to tell Emacs directly to pass
3201 parameters to IPython, so a dummy shell script will do it.
3206 parameters to IPython, so a dummy shell script will do it.
3202
3207
3203 Other enhancements made for things to work better under Emacs'
3208 Other enhancements made for things to work better under Emacs'
3204 various types of terminals. Many thanks to Milan Zamazal
3209 various types of terminals. Many thanks to Milan Zamazal
3205 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3210 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3206
3211
3207 2002-03-01 Fernando Perez <fperez@colorado.edu>
3212 2002-03-01 Fernando Perez <fperez@colorado.edu>
3208
3213
3209 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3214 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3210 that loading of readline is now optional. This gives better
3215 that loading of readline is now optional. This gives better
3211 control to emacs users.
3216 control to emacs users.
3212
3217
3213 * IPython/ultraTB.py (__date__): Modified color escape sequences
3218 * IPython/ultraTB.py (__date__): Modified color escape sequences
3214 and now things work fine under xterm and in Emacs' term buffers
3219 and now things work fine under xterm and in Emacs' term buffers
3215 (though not shell ones). Well, in emacs you get colors, but all
3220 (though not shell ones). Well, in emacs you get colors, but all
3216 seem to be 'light' colors (no difference between dark and light
3221 seem to be 'light' colors (no difference between dark and light
3217 ones). But the garbage chars are gone, and also in xterms. It
3222 ones). But the garbage chars are gone, and also in xterms. It
3218 seems that now I'm using 'cleaner' ansi sequences.
3223 seems that now I'm using 'cleaner' ansi sequences.
3219
3224
3220 2002-02-21 Fernando Perez <fperez@colorado.edu>
3225 2002-02-21 Fernando Perez <fperez@colorado.edu>
3221
3226
3222 * Released 0.2.7 (mainly to publish the scoping fix).
3227 * Released 0.2.7 (mainly to publish the scoping fix).
3223
3228
3224 * IPython/Logger.py (Logger.logstate): added. A corresponding
3229 * IPython/Logger.py (Logger.logstate): added. A corresponding
3225 @logstate magic was created.
3230 @logstate magic was created.
3226
3231
3227 * IPython/Magic.py: fixed nested scoping problem under Python
3232 * IPython/Magic.py: fixed nested scoping problem under Python
3228 2.1.x (automagic wasn't working).
3233 2.1.x (automagic wasn't working).
3229
3234
3230 2002-02-20 Fernando Perez <fperez@colorado.edu>
3235 2002-02-20 Fernando Perez <fperez@colorado.edu>
3231
3236
3232 * Released 0.2.6.
3237 * Released 0.2.6.
3233
3238
3234 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3239 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3235 option so that logs can come out without any headers at all.
3240 option so that logs can come out without any headers at all.
3236
3241
3237 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3242 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3238 SciPy.
3243 SciPy.
3239
3244
3240 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3245 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3241 that embedded IPython calls don't require vars() to be explicitly
3246 that embedded IPython calls don't require vars() to be explicitly
3242 passed. Now they are extracted from the caller's frame (code
3247 passed. Now they are extracted from the caller's frame (code
3243 snatched from Eric Jones' weave). Added better documentation to
3248 snatched from Eric Jones' weave). Added better documentation to
3244 the section on embedding and the example file.
3249 the section on embedding and the example file.
3245
3250
3246 * IPython/genutils.py (page): Changed so that under emacs, it just
3251 * IPython/genutils.py (page): Changed so that under emacs, it just
3247 prints the string. You can then page up and down in the emacs
3252 prints the string. You can then page up and down in the emacs
3248 buffer itself. This is how the builtin help() works.
3253 buffer itself. This is how the builtin help() works.
3249
3254
3250 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3255 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3251 macro scoping: macros need to be executed in the user's namespace
3256 macro scoping: macros need to be executed in the user's namespace
3252 to work as if they had been typed by the user.
3257 to work as if they had been typed by the user.
3253
3258
3254 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3259 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3255 execute automatically (no need to type 'exec...'). They then
3260 execute automatically (no need to type 'exec...'). They then
3256 behave like 'true macros'. The printing system was also modified
3261 behave like 'true macros'. The printing system was also modified
3257 for this to work.
3262 for this to work.
3258
3263
3259 2002-02-19 Fernando Perez <fperez@colorado.edu>
3264 2002-02-19 Fernando Perez <fperez@colorado.edu>
3260
3265
3261 * IPython/genutils.py (page_file): new function for paging files
3266 * IPython/genutils.py (page_file): new function for paging files
3262 in an OS-independent way. Also necessary for file viewing to work
3267 in an OS-independent way. Also necessary for file viewing to work
3263 well inside Emacs buffers.
3268 well inside Emacs buffers.
3264 (page): Added checks for being in an emacs buffer.
3269 (page): Added checks for being in an emacs buffer.
3265 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3270 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3266 same bug in iplib.
3271 same bug in iplib.
3267
3272
3268 2002-02-18 Fernando Perez <fperez@colorado.edu>
3273 2002-02-18 Fernando Perez <fperez@colorado.edu>
3269
3274
3270 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3275 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3271 of readline so that IPython can work inside an Emacs buffer.
3276 of readline so that IPython can work inside an Emacs buffer.
3272
3277
3273 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3278 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3274 method signatures (they weren't really bugs, but it looks cleaner
3279 method signatures (they weren't really bugs, but it looks cleaner
3275 and keeps PyChecker happy).
3280 and keeps PyChecker happy).
3276
3281
3277 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3282 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3278 for implementing various user-defined hooks. Currently only
3283 for implementing various user-defined hooks. Currently only
3279 display is done.
3284 display is done.
3280
3285
3281 * IPython/Prompts.py (CachedOutput._display): changed display
3286 * IPython/Prompts.py (CachedOutput._display): changed display
3282 functions so that they can be dynamically changed by users easily.
3287 functions so that they can be dynamically changed by users easily.
3283
3288
3284 * IPython/Extensions/numeric_formats.py (num_display): added an
3289 * IPython/Extensions/numeric_formats.py (num_display): added an
3285 extension for printing NumPy arrays in flexible manners. It
3290 extension for printing NumPy arrays in flexible manners. It
3286 doesn't do anything yet, but all the structure is in
3291 doesn't do anything yet, but all the structure is in
3287 place. Ultimately the plan is to implement output format control
3292 place. Ultimately the plan is to implement output format control
3288 like in Octave.
3293 like in Octave.
3289
3294
3290 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3295 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3291 methods are found at run-time by all the automatic machinery.
3296 methods are found at run-time by all the automatic machinery.
3292
3297
3293 2002-02-17 Fernando Perez <fperez@colorado.edu>
3298 2002-02-17 Fernando Perez <fperez@colorado.edu>
3294
3299
3295 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3300 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3296 whole file a little.
3301 whole file a little.
3297
3302
3298 * ToDo: closed this document. Now there's a new_design.lyx
3303 * ToDo: closed this document. Now there's a new_design.lyx
3299 document for all new ideas. Added making a pdf of it for the
3304 document for all new ideas. Added making a pdf of it for the
3300 end-user distro.
3305 end-user distro.
3301
3306
3302 * IPython/Logger.py (Logger.switch_log): Created this to replace
3307 * IPython/Logger.py (Logger.switch_log): Created this to replace
3303 logon() and logoff(). It also fixes a nasty crash reported by
3308 logon() and logoff(). It also fixes a nasty crash reported by
3304 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3309 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3305
3310
3306 * IPython/iplib.py (complete): got auto-completion to work with
3311 * IPython/iplib.py (complete): got auto-completion to work with
3307 automagic (I had wanted this for a long time).
3312 automagic (I had wanted this for a long time).
3308
3313
3309 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3314 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3310 to @file, since file() is now a builtin and clashes with automagic
3315 to @file, since file() is now a builtin and clashes with automagic
3311 for @file.
3316 for @file.
3312
3317
3313 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3318 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3314 of this was previously in iplib, which had grown to more than 2000
3319 of this was previously in iplib, which had grown to more than 2000
3315 lines, way too long. No new functionality, but it makes managing
3320 lines, way too long. No new functionality, but it makes managing
3316 the code a bit easier.
3321 the code a bit easier.
3317
3322
3318 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3323 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3319 information to crash reports.
3324 information to crash reports.
3320
3325
3321 2002-02-12 Fernando Perez <fperez@colorado.edu>
3326 2002-02-12 Fernando Perez <fperez@colorado.edu>
3322
3327
3323 * Released 0.2.5.
3328 * Released 0.2.5.
3324
3329
3325 2002-02-11 Fernando Perez <fperez@colorado.edu>
3330 2002-02-11 Fernando Perez <fperez@colorado.edu>
3326
3331
3327 * Wrote a relatively complete Windows installer. It puts
3332 * Wrote a relatively complete Windows installer. It puts
3328 everything in place, creates Start Menu entries and fixes the
3333 everything in place, creates Start Menu entries and fixes the
3329 color issues. Nothing fancy, but it works.
3334 color issues. Nothing fancy, but it works.
3330
3335
3331 2002-02-10 Fernando Perez <fperez@colorado.edu>
3336 2002-02-10 Fernando Perez <fperez@colorado.edu>
3332
3337
3333 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3338 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3334 os.path.expanduser() call so that we can type @run ~/myfile.py and
3339 os.path.expanduser() call so that we can type @run ~/myfile.py and
3335 have thigs work as expected.
3340 have thigs work as expected.
3336
3341
3337 * IPython/genutils.py (page): fixed exception handling so things
3342 * IPython/genutils.py (page): fixed exception handling so things
3338 work both in Unix and Windows correctly. Quitting a pager triggers
3343 work both in Unix and Windows correctly. Quitting a pager triggers
3339 an IOError/broken pipe in Unix, and in windows not finding a pager
3344 an IOError/broken pipe in Unix, and in windows not finding a pager
3340 is also an IOError, so I had to actually look at the return value
3345 is also an IOError, so I had to actually look at the return value
3341 of the exception, not just the exception itself. Should be ok now.
3346 of the exception, not just the exception itself. Should be ok now.
3342
3347
3343 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3348 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3344 modified to allow case-insensitive color scheme changes.
3349 modified to allow case-insensitive color scheme changes.
3345
3350
3346 2002-02-09 Fernando Perez <fperez@colorado.edu>
3351 2002-02-09 Fernando Perez <fperez@colorado.edu>
3347
3352
3348 * IPython/genutils.py (native_line_ends): new function to leave
3353 * IPython/genutils.py (native_line_ends): new function to leave
3349 user config files with os-native line-endings.
3354 user config files with os-native line-endings.
3350
3355
3351 * README and manual updates.
3356 * README and manual updates.
3352
3357
3353 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3358 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3354 instead of StringType to catch Unicode strings.
3359 instead of StringType to catch Unicode strings.
3355
3360
3356 * IPython/genutils.py (filefind): fixed bug for paths with
3361 * IPython/genutils.py (filefind): fixed bug for paths with
3357 embedded spaces (very common in Windows).
3362 embedded spaces (very common in Windows).
3358
3363
3359 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3364 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3360 files under Windows, so that they get automatically associated
3365 files under Windows, so that they get automatically associated
3361 with a text editor. Windows makes it a pain to handle
3366 with a text editor. Windows makes it a pain to handle
3362 extension-less files.
3367 extension-less files.
3363
3368
3364 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3369 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3365 warning about readline only occur for Posix. In Windows there's no
3370 warning about readline only occur for Posix. In Windows there's no
3366 way to get readline, so why bother with the warning.
3371 way to get readline, so why bother with the warning.
3367
3372
3368 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3373 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3369 for __str__ instead of dir(self), since dir() changed in 2.2.
3374 for __str__ instead of dir(self), since dir() changed in 2.2.
3370
3375
3371 * Ported to Windows! Tested on XP, I suspect it should work fine
3376 * Ported to Windows! Tested on XP, I suspect it should work fine
3372 on NT/2000, but I don't think it will work on 98 et al. That
3377 on NT/2000, but I don't think it will work on 98 et al. That
3373 series of Windows is such a piece of junk anyway that I won't try
3378 series of Windows is such a piece of junk anyway that I won't try
3374 porting it there. The XP port was straightforward, showed a few
3379 porting it there. The XP port was straightforward, showed a few
3375 bugs here and there (fixed all), in particular some string
3380 bugs here and there (fixed all), in particular some string
3376 handling stuff which required considering Unicode strings (which
3381 handling stuff which required considering Unicode strings (which
3377 Windows uses). This is good, but hasn't been too tested :) No
3382 Windows uses). This is good, but hasn't been too tested :) No
3378 fancy installer yet, I'll put a note in the manual so people at
3383 fancy installer yet, I'll put a note in the manual so people at
3379 least make manually a shortcut.
3384 least make manually a shortcut.
3380
3385
3381 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3386 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3382 into a single one, "colors". This now controls both prompt and
3387 into a single one, "colors". This now controls both prompt and
3383 exception color schemes, and can be changed both at startup
3388 exception color schemes, and can be changed both at startup
3384 (either via command-line switches or via ipythonrc files) and at
3389 (either via command-line switches or via ipythonrc files) and at
3385 runtime, with @colors.
3390 runtime, with @colors.
3386 (Magic.magic_run): renamed @prun to @run and removed the old
3391 (Magic.magic_run): renamed @prun to @run and removed the old
3387 @run. The two were too similar to warrant keeping both.
3392 @run. The two were too similar to warrant keeping both.
3388
3393
3389 2002-02-03 Fernando Perez <fperez@colorado.edu>
3394 2002-02-03 Fernando Perez <fperez@colorado.edu>
3390
3395
3391 * IPython/iplib.py (install_first_time): Added comment on how to
3396 * IPython/iplib.py (install_first_time): Added comment on how to
3392 configure the color options for first-time users. Put a <return>
3397 configure the color options for first-time users. Put a <return>
3393 request at the end so that small-terminal users get a chance to
3398 request at the end so that small-terminal users get a chance to
3394 read the startup info.
3399 read the startup info.
3395
3400
3396 2002-01-23 Fernando Perez <fperez@colorado.edu>
3401 2002-01-23 Fernando Perez <fperez@colorado.edu>
3397
3402
3398 * IPython/iplib.py (CachedOutput.update): Changed output memory
3403 * IPython/iplib.py (CachedOutput.update): Changed output memory
3399 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3404 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3400 input history we still use _i. Did this b/c these variable are
3405 input history we still use _i. Did this b/c these variable are
3401 very commonly used in interactive work, so the less we need to
3406 very commonly used in interactive work, so the less we need to
3402 type the better off we are.
3407 type the better off we are.
3403 (Magic.magic_prun): updated @prun to better handle the namespaces
3408 (Magic.magic_prun): updated @prun to better handle the namespaces
3404 the file will run in, including a fix for __name__ not being set
3409 the file will run in, including a fix for __name__ not being set
3405 before.
3410 before.
3406
3411
3407 2002-01-20 Fernando Perez <fperez@colorado.edu>
3412 2002-01-20 Fernando Perez <fperez@colorado.edu>
3408
3413
3409 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3414 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3410 extra garbage for Python 2.2. Need to look more carefully into
3415 extra garbage for Python 2.2. Need to look more carefully into
3411 this later.
3416 this later.
3412
3417
3413 2002-01-19 Fernando Perez <fperez@colorado.edu>
3418 2002-01-19 Fernando Perez <fperez@colorado.edu>
3414
3419
3415 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3420 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3416 display SyntaxError exceptions properly formatted when they occur
3421 display SyntaxError exceptions properly formatted when they occur
3417 (they can be triggered by imported code).
3422 (they can be triggered by imported code).
3418
3423
3419 2002-01-18 Fernando Perez <fperez@colorado.edu>
3424 2002-01-18 Fernando Perez <fperez@colorado.edu>
3420
3425
3421 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3426 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3422 SyntaxError exceptions are reported nicely formatted, instead of
3427 SyntaxError exceptions are reported nicely formatted, instead of
3423 spitting out only offset information as before.
3428 spitting out only offset information as before.
3424 (Magic.magic_prun): Added the @prun function for executing
3429 (Magic.magic_prun): Added the @prun function for executing
3425 programs with command line args inside IPython.
3430 programs with command line args inside IPython.
3426
3431
3427 2002-01-16 Fernando Perez <fperez@colorado.edu>
3432 2002-01-16 Fernando Perez <fperez@colorado.edu>
3428
3433
3429 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3434 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3430 to *not* include the last item given in a range. This brings their
3435 to *not* include the last item given in a range. This brings their
3431 behavior in line with Python's slicing:
3436 behavior in line with Python's slicing:
3432 a[n1:n2] -> a[n1]...a[n2-1]
3437 a[n1:n2] -> a[n1]...a[n2-1]
3433 It may be a bit less convenient, but I prefer to stick to Python's
3438 It may be a bit less convenient, but I prefer to stick to Python's
3434 conventions *everywhere*, so users never have to wonder.
3439 conventions *everywhere*, so users never have to wonder.
3435 (Magic.magic_macro): Added @macro function to ease the creation of
3440 (Magic.magic_macro): Added @macro function to ease the creation of
3436 macros.
3441 macros.
3437
3442
3438 2002-01-05 Fernando Perez <fperez@colorado.edu>
3443 2002-01-05 Fernando Perez <fperez@colorado.edu>
3439
3444
3440 * Released 0.2.4.
3445 * Released 0.2.4.
3441
3446
3442 * IPython/iplib.py (Magic.magic_pdef):
3447 * IPython/iplib.py (Magic.magic_pdef):
3443 (InteractiveShell.safe_execfile): report magic lines and error
3448 (InteractiveShell.safe_execfile): report magic lines and error
3444 lines without line numbers so one can easily copy/paste them for
3449 lines without line numbers so one can easily copy/paste them for
3445 re-execution.
3450 re-execution.
3446
3451
3447 * Updated manual with recent changes.
3452 * Updated manual with recent changes.
3448
3453
3449 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3454 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3450 docstring printing when class? is called. Very handy for knowing
3455 docstring printing when class? is called. Very handy for knowing
3451 how to create class instances (as long as __init__ is well
3456 how to create class instances (as long as __init__ is well
3452 documented, of course :)
3457 documented, of course :)
3453 (Magic.magic_doc): print both class and constructor docstrings.
3458 (Magic.magic_doc): print both class and constructor docstrings.
3454 (Magic.magic_pdef): give constructor info if passed a class and
3459 (Magic.magic_pdef): give constructor info if passed a class and
3455 __call__ info for callable object instances.
3460 __call__ info for callable object instances.
3456
3461
3457 2002-01-04 Fernando Perez <fperez@colorado.edu>
3462 2002-01-04 Fernando Perez <fperez@colorado.edu>
3458
3463
3459 * Made deep_reload() off by default. It doesn't always work
3464 * Made deep_reload() off by default. It doesn't always work
3460 exactly as intended, so it's probably safer to have it off. It's
3465 exactly as intended, so it's probably safer to have it off. It's
3461 still available as dreload() anyway, so nothing is lost.
3466 still available as dreload() anyway, so nothing is lost.
3462
3467
3463 2002-01-02 Fernando Perez <fperez@colorado.edu>
3468 2002-01-02 Fernando Perez <fperez@colorado.edu>
3464
3469
3465 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3470 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3466 so I wanted an updated release).
3471 so I wanted an updated release).
3467
3472
3468 2001-12-27 Fernando Perez <fperez@colorado.edu>
3473 2001-12-27 Fernando Perez <fperez@colorado.edu>
3469
3474
3470 * IPython/iplib.py (InteractiveShell.interact): Added the original
3475 * IPython/iplib.py (InteractiveShell.interact): Added the original
3471 code from 'code.py' for this module in order to change the
3476 code from 'code.py' for this module in order to change the
3472 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3477 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3473 the history cache would break when the user hit Ctrl-C, and
3478 the history cache would break when the user hit Ctrl-C, and
3474 interact() offers no way to add any hooks to it.
3479 interact() offers no way to add any hooks to it.
3475
3480
3476 2001-12-23 Fernando Perez <fperez@colorado.edu>
3481 2001-12-23 Fernando Perez <fperez@colorado.edu>
3477
3482
3478 * setup.py: added check for 'MANIFEST' before trying to remove
3483 * setup.py: added check for 'MANIFEST' before trying to remove
3479 it. Thanks to Sean Reifschneider.
3484 it. Thanks to Sean Reifschneider.
3480
3485
3481 2001-12-22 Fernando Perez <fperez@colorado.edu>
3486 2001-12-22 Fernando Perez <fperez@colorado.edu>
3482
3487
3483 * Released 0.2.2.
3488 * Released 0.2.2.
3484
3489
3485 * Finished (reasonably) writing the manual. Later will add the
3490 * Finished (reasonably) writing the manual. Later will add the
3486 python-standard navigation stylesheets, but for the time being
3491 python-standard navigation stylesheets, but for the time being
3487 it's fairly complete. Distribution will include html and pdf
3492 it's fairly complete. Distribution will include html and pdf
3488 versions.
3493 versions.
3489
3494
3490 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3495 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3491 (MayaVi author).
3496 (MayaVi author).
3492
3497
3493 2001-12-21 Fernando Perez <fperez@colorado.edu>
3498 2001-12-21 Fernando Perez <fperez@colorado.edu>
3494
3499
3495 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3500 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3496 good public release, I think (with the manual and the distutils
3501 good public release, I think (with the manual and the distutils
3497 installer). The manual can use some work, but that can go
3502 installer). The manual can use some work, but that can go
3498 slowly. Otherwise I think it's quite nice for end users. Next
3503 slowly. Otherwise I think it's quite nice for end users. Next
3499 summer, rewrite the guts of it...
3504 summer, rewrite the guts of it...
3500
3505
3501 * Changed format of ipythonrc files to use whitespace as the
3506 * Changed format of ipythonrc files to use whitespace as the
3502 separator instead of an explicit '='. Cleaner.
3507 separator instead of an explicit '='. Cleaner.
3503
3508
3504 2001-12-20 Fernando Perez <fperez@colorado.edu>
3509 2001-12-20 Fernando Perez <fperez@colorado.edu>
3505
3510
3506 * Started a manual in LyX. For now it's just a quick merge of the
3511 * Started a manual in LyX. For now it's just a quick merge of the
3507 various internal docstrings and READMEs. Later it may grow into a
3512 various internal docstrings and READMEs. Later it may grow into a
3508 nice, full-blown manual.
3513 nice, full-blown manual.
3509
3514
3510 * Set up a distutils based installer. Installation should now be
3515 * Set up a distutils based installer. Installation should now be
3511 trivially simple for end-users.
3516 trivially simple for end-users.
3512
3517
3513 2001-12-11 Fernando Perez <fperez@colorado.edu>
3518 2001-12-11 Fernando Perez <fperez@colorado.edu>
3514
3519
3515 * Released 0.2.0. First public release, announced it at
3520 * Released 0.2.0. First public release, announced it at
3516 comp.lang.python. From now on, just bugfixes...
3521 comp.lang.python. From now on, just bugfixes...
3517
3522
3518 * Went through all the files, set copyright/license notices and
3523 * Went through all the files, set copyright/license notices and
3519 cleaned up things. Ready for release.
3524 cleaned up things. Ready for release.
3520
3525
3521 2001-12-10 Fernando Perez <fperez@colorado.edu>
3526 2001-12-10 Fernando Perez <fperez@colorado.edu>
3522
3527
3523 * Changed the first-time installer not to use tarfiles. It's more
3528 * Changed the first-time installer not to use tarfiles. It's more
3524 robust now and less unix-dependent. Also makes it easier for
3529 robust now and less unix-dependent. Also makes it easier for
3525 people to later upgrade versions.
3530 people to later upgrade versions.
3526
3531
3527 * Changed @exit to @abort to reflect the fact that it's pretty
3532 * Changed @exit to @abort to reflect the fact that it's pretty
3528 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3533 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3529 becomes significant only when IPyhton is embedded: in that case,
3534 becomes significant only when IPyhton is embedded: in that case,
3530 C-D closes IPython only, but @abort kills the enclosing program
3535 C-D closes IPython only, but @abort kills the enclosing program
3531 too (unless it had called IPython inside a try catching
3536 too (unless it had called IPython inside a try catching
3532 SystemExit).
3537 SystemExit).
3533
3538
3534 * Created Shell module which exposes the actuall IPython Shell
3539 * Created Shell module which exposes the actuall IPython Shell
3535 classes, currently the normal and the embeddable one. This at
3540 classes, currently the normal and the embeddable one. This at
3536 least offers a stable interface we won't need to change when
3541 least offers a stable interface we won't need to change when
3537 (later) the internals are rewritten. That rewrite will be confined
3542 (later) the internals are rewritten. That rewrite will be confined
3538 to iplib and ipmaker, but the Shell interface should remain as is.
3543 to iplib and ipmaker, but the Shell interface should remain as is.
3539
3544
3540 * Added embed module which offers an embeddable IPShell object,
3545 * Added embed module which offers an embeddable IPShell object,
3541 useful to fire up IPython *inside* a running program. Great for
3546 useful to fire up IPython *inside* a running program. Great for
3542 debugging or dynamical data analysis.
3547 debugging or dynamical data analysis.
3543
3548
3544 2001-12-08 Fernando Perez <fperez@colorado.edu>
3549 2001-12-08 Fernando Perez <fperez@colorado.edu>
3545
3550
3546 * Fixed small bug preventing seeing info from methods of defined
3551 * Fixed small bug preventing seeing info from methods of defined
3547 objects (incorrect namespace in _ofind()).
3552 objects (incorrect namespace in _ofind()).
3548
3553
3549 * Documentation cleanup. Moved the main usage docstrings to a
3554 * Documentation cleanup. Moved the main usage docstrings to a
3550 separate file, usage.py (cleaner to maintain, and hopefully in the
3555 separate file, usage.py (cleaner to maintain, and hopefully in the
3551 future some perlpod-like way of producing interactive, man and
3556 future some perlpod-like way of producing interactive, man and
3552 html docs out of it will be found).
3557 html docs out of it will be found).
3553
3558
3554 * Added @profile to see your profile at any time.
3559 * Added @profile to see your profile at any time.
3555
3560
3556 * Added @p as an alias for 'print'. It's especially convenient if
3561 * Added @p as an alias for 'print'. It's especially convenient if
3557 using automagic ('p x' prints x).
3562 using automagic ('p x' prints x).
3558
3563
3559 * Small cleanups and fixes after a pychecker run.
3564 * Small cleanups and fixes after a pychecker run.
3560
3565
3561 * Changed the @cd command to handle @cd - and @cd -<n> for
3566 * Changed the @cd command to handle @cd - and @cd -<n> for
3562 visiting any directory in _dh.
3567 visiting any directory in _dh.
3563
3568
3564 * Introduced _dh, a history of visited directories. @dhist prints
3569 * Introduced _dh, a history of visited directories. @dhist prints
3565 it out with numbers.
3570 it out with numbers.
3566
3571
3567 2001-12-07 Fernando Perez <fperez@colorado.edu>
3572 2001-12-07 Fernando Perez <fperez@colorado.edu>
3568
3573
3569 * Released 0.1.22
3574 * Released 0.1.22
3570
3575
3571 * Made initialization a bit more robust against invalid color
3576 * Made initialization a bit more robust against invalid color
3572 options in user input (exit, not traceback-crash).
3577 options in user input (exit, not traceback-crash).
3573
3578
3574 * Changed the bug crash reporter to write the report only in the
3579 * Changed the bug crash reporter to write the report only in the
3575 user's .ipython directory. That way IPython won't litter people's
3580 user's .ipython directory. That way IPython won't litter people's
3576 hard disks with crash files all over the place. Also print on
3581 hard disks with crash files all over the place. Also print on
3577 screen the necessary mail command.
3582 screen the necessary mail command.
3578
3583
3579 * With the new ultraTB, implemented LightBG color scheme for light
3584 * With the new ultraTB, implemented LightBG color scheme for light
3580 background terminals. A lot of people like white backgrounds, so I
3585 background terminals. A lot of people like white backgrounds, so I
3581 guess we should at least give them something readable.
3586 guess we should at least give them something readable.
3582
3587
3583 2001-12-06 Fernando Perez <fperez@colorado.edu>
3588 2001-12-06 Fernando Perez <fperez@colorado.edu>
3584
3589
3585 * Modified the structure of ultraTB. Now there's a proper class
3590 * Modified the structure of ultraTB. Now there's a proper class
3586 for tables of color schemes which allow adding schemes easily and
3591 for tables of color schemes which allow adding schemes easily and
3587 switching the active scheme without creating a new instance every
3592 switching the active scheme without creating a new instance every
3588 time (which was ridiculous). The syntax for creating new schemes
3593 time (which was ridiculous). The syntax for creating new schemes
3589 is also cleaner. I think ultraTB is finally done, with a clean
3594 is also cleaner. I think ultraTB is finally done, with a clean
3590 class structure. Names are also much cleaner (now there's proper
3595 class structure. Names are also much cleaner (now there's proper
3591 color tables, no need for every variable to also have 'color' in
3596 color tables, no need for every variable to also have 'color' in
3592 its name).
3597 its name).
3593
3598
3594 * Broke down genutils into separate files. Now genutils only
3599 * Broke down genutils into separate files. Now genutils only
3595 contains utility functions, and classes have been moved to their
3600 contains utility functions, and classes have been moved to their
3596 own files (they had enough independent functionality to warrant
3601 own files (they had enough independent functionality to warrant
3597 it): ConfigLoader, OutputTrap, Struct.
3602 it): ConfigLoader, OutputTrap, Struct.
3598
3603
3599 2001-12-05 Fernando Perez <fperez@colorado.edu>
3604 2001-12-05 Fernando Perez <fperez@colorado.edu>
3600
3605
3601 * IPython turns 21! Released version 0.1.21, as a candidate for
3606 * IPython turns 21! Released version 0.1.21, as a candidate for
3602 public consumption. If all goes well, release in a few days.
3607 public consumption. If all goes well, release in a few days.
3603
3608
3604 * Fixed path bug (files in Extensions/ directory wouldn't be found
3609 * Fixed path bug (files in Extensions/ directory wouldn't be found
3605 unless IPython/ was explicitly in sys.path).
3610 unless IPython/ was explicitly in sys.path).
3606
3611
3607 * Extended the FlexCompleter class as MagicCompleter to allow
3612 * Extended the FlexCompleter class as MagicCompleter to allow
3608 completion of @-starting lines.
3613 completion of @-starting lines.
3609
3614
3610 * Created __release__.py file as a central repository for release
3615 * Created __release__.py file as a central repository for release
3611 info that other files can read from.
3616 info that other files can read from.
3612
3617
3613 * Fixed small bug in logging: when logging was turned on in
3618 * Fixed small bug in logging: when logging was turned on in
3614 mid-session, old lines with special meanings (!@?) were being
3619 mid-session, old lines with special meanings (!@?) were being
3615 logged without the prepended comment, which is necessary since
3620 logged without the prepended comment, which is necessary since
3616 they are not truly valid python syntax. This should make session
3621 they are not truly valid python syntax. This should make session
3617 restores produce less errors.
3622 restores produce less errors.
3618
3623
3619 * The namespace cleanup forced me to make a FlexCompleter class
3624 * The namespace cleanup forced me to make a FlexCompleter class
3620 which is nothing but a ripoff of rlcompleter, but with selectable
3625 which is nothing but a ripoff of rlcompleter, but with selectable
3621 namespace (rlcompleter only works in __main__.__dict__). I'll try
3626 namespace (rlcompleter only works in __main__.__dict__). I'll try
3622 to submit a note to the authors to see if this change can be
3627 to submit a note to the authors to see if this change can be
3623 incorporated in future rlcompleter releases (Dec.6: done)
3628 incorporated in future rlcompleter releases (Dec.6: done)
3624
3629
3625 * More fixes to namespace handling. It was a mess! Now all
3630 * More fixes to namespace handling. It was a mess! Now all
3626 explicit references to __main__.__dict__ are gone (except when
3631 explicit references to __main__.__dict__ are gone (except when
3627 really needed) and everything is handled through the namespace
3632 really needed) and everything is handled through the namespace
3628 dicts in the IPython instance. We seem to be getting somewhere
3633 dicts in the IPython instance. We seem to be getting somewhere
3629 with this, finally...
3634 with this, finally...
3630
3635
3631 * Small documentation updates.
3636 * Small documentation updates.
3632
3637
3633 * Created the Extensions directory under IPython (with an
3638 * Created the Extensions directory under IPython (with an
3634 __init__.py). Put the PhysicalQ stuff there. This directory should
3639 __init__.py). Put the PhysicalQ stuff there. This directory should
3635 be used for all special-purpose extensions.
3640 be used for all special-purpose extensions.
3636
3641
3637 * File renaming:
3642 * File renaming:
3638 ipythonlib --> ipmaker
3643 ipythonlib --> ipmaker
3639 ipplib --> iplib
3644 ipplib --> iplib
3640 This makes a bit more sense in terms of what these files actually do.
3645 This makes a bit more sense in terms of what these files actually do.
3641
3646
3642 * Moved all the classes and functions in ipythonlib to ipplib, so
3647 * Moved all the classes and functions in ipythonlib to ipplib, so
3643 now ipythonlib only has make_IPython(). This will ease up its
3648 now ipythonlib only has make_IPython(). This will ease up its
3644 splitting in smaller functional chunks later.
3649 splitting in smaller functional chunks later.
3645
3650
3646 * Cleaned up (done, I think) output of @whos. Better column
3651 * Cleaned up (done, I think) output of @whos. Better column
3647 formatting, and now shows str(var) for as much as it can, which is
3652 formatting, and now shows str(var) for as much as it can, which is
3648 typically what one gets with a 'print var'.
3653 typically what one gets with a 'print var'.
3649
3654
3650 2001-12-04 Fernando Perez <fperez@colorado.edu>
3655 2001-12-04 Fernando Perez <fperez@colorado.edu>
3651
3656
3652 * Fixed namespace problems. Now builtin/IPyhton/user names get
3657 * Fixed namespace problems. Now builtin/IPyhton/user names get
3653 properly reported in their namespace. Internal namespace handling
3658 properly reported in their namespace. Internal namespace handling
3654 is finally getting decent (not perfect yet, but much better than
3659 is finally getting decent (not perfect yet, but much better than
3655 the ad-hoc mess we had).
3660 the ad-hoc mess we had).
3656
3661
3657 * Removed -exit option. If people just want to run a python
3662 * Removed -exit option. If people just want to run a python
3658 script, that's what the normal interpreter is for. Less
3663 script, that's what the normal interpreter is for. Less
3659 unnecessary options, less chances for bugs.
3664 unnecessary options, less chances for bugs.
3660
3665
3661 * Added a crash handler which generates a complete post-mortem if
3666 * Added a crash handler which generates a complete post-mortem if
3662 IPython crashes. This will help a lot in tracking bugs down the
3667 IPython crashes. This will help a lot in tracking bugs down the
3663 road.
3668 road.
3664
3669
3665 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3670 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3666 which were boud to functions being reassigned would bypass the
3671 which were boud to functions being reassigned would bypass the
3667 logger, breaking the sync of _il with the prompt counter. This
3672 logger, breaking the sync of _il with the prompt counter. This
3668 would then crash IPython later when a new line was logged.
3673 would then crash IPython later when a new line was logged.
3669
3674
3670 2001-12-02 Fernando Perez <fperez@colorado.edu>
3675 2001-12-02 Fernando Perez <fperez@colorado.edu>
3671
3676
3672 * Made IPython a package. This means people don't have to clutter
3677 * Made IPython a package. This means people don't have to clutter
3673 their sys.path with yet another directory. Changed the INSTALL
3678 their sys.path with yet another directory. Changed the INSTALL
3674 file accordingly.
3679 file accordingly.
3675
3680
3676 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3681 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3677 sorts its output (so @who shows it sorted) and @whos formats the
3682 sorts its output (so @who shows it sorted) and @whos formats the
3678 table according to the width of the first column. Nicer, easier to
3683 table according to the width of the first column. Nicer, easier to
3679 read. Todo: write a generic table_format() which takes a list of
3684 read. Todo: write a generic table_format() which takes a list of
3680 lists and prints it nicely formatted, with optional row/column
3685 lists and prints it nicely formatted, with optional row/column
3681 separators and proper padding and justification.
3686 separators and proper padding and justification.
3682
3687
3683 * Released 0.1.20
3688 * Released 0.1.20
3684
3689
3685 * Fixed bug in @log which would reverse the inputcache list (a
3690 * Fixed bug in @log which would reverse the inputcache list (a
3686 copy operation was missing).
3691 copy operation was missing).
3687
3692
3688 * Code cleanup. @config was changed to use page(). Better, since
3693 * Code cleanup. @config was changed to use page(). Better, since
3689 its output is always quite long.
3694 its output is always quite long.
3690
3695
3691 * Itpl is back as a dependency. I was having too many problems
3696 * Itpl is back as a dependency. I was having too many problems
3692 getting the parametric aliases to work reliably, and it's just
3697 getting the parametric aliases to work reliably, and it's just
3693 easier to code weird string operations with it than playing %()s
3698 easier to code weird string operations with it than playing %()s
3694 games. It's only ~6k, so I don't think it's too big a deal.
3699 games. It's only ~6k, so I don't think it's too big a deal.
3695
3700
3696 * Found (and fixed) a very nasty bug with history. !lines weren't
3701 * Found (and fixed) a very nasty bug with history. !lines weren't
3697 getting cached, and the out of sync caches would crash
3702 getting cached, and the out of sync caches would crash
3698 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3703 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3699 division of labor a bit better. Bug fixed, cleaner structure.
3704 division of labor a bit better. Bug fixed, cleaner structure.
3700
3705
3701 2001-12-01 Fernando Perez <fperez@colorado.edu>
3706 2001-12-01 Fernando Perez <fperez@colorado.edu>
3702
3707
3703 * Released 0.1.19
3708 * Released 0.1.19
3704
3709
3705 * Added option -n to @hist to prevent line number printing. Much
3710 * Added option -n to @hist to prevent line number printing. Much
3706 easier to copy/paste code this way.
3711 easier to copy/paste code this way.
3707
3712
3708 * Created global _il to hold the input list. Allows easy
3713 * Created global _il to hold the input list. Allows easy
3709 re-execution of blocks of code by slicing it (inspired by Janko's
3714 re-execution of blocks of code by slicing it (inspired by Janko's
3710 comment on 'macros').
3715 comment on 'macros').
3711
3716
3712 * Small fixes and doc updates.
3717 * Small fixes and doc updates.
3713
3718
3714 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3719 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3715 much too fragile with automagic. Handles properly multi-line
3720 much too fragile with automagic. Handles properly multi-line
3716 statements and takes parameters.
3721 statements and takes parameters.
3717
3722
3718 2001-11-30 Fernando Perez <fperez@colorado.edu>
3723 2001-11-30 Fernando Perez <fperez@colorado.edu>
3719
3724
3720 * Version 0.1.18 released.
3725 * Version 0.1.18 released.
3721
3726
3722 * Fixed nasty namespace bug in initial module imports.
3727 * Fixed nasty namespace bug in initial module imports.
3723
3728
3724 * Added copyright/license notes to all code files (except
3729 * Added copyright/license notes to all code files (except
3725 DPyGetOpt). For the time being, LGPL. That could change.
3730 DPyGetOpt). For the time being, LGPL. That could change.
3726
3731
3727 * Rewrote a much nicer README, updated INSTALL, cleaned up
3732 * Rewrote a much nicer README, updated INSTALL, cleaned up
3728 ipythonrc-* samples.
3733 ipythonrc-* samples.
3729
3734
3730 * Overall code/documentation cleanup. Basically ready for
3735 * Overall code/documentation cleanup. Basically ready for
3731 release. Only remaining thing: licence decision (LGPL?).
3736 release. Only remaining thing: licence decision (LGPL?).
3732
3737
3733 * Converted load_config to a class, ConfigLoader. Now recursion
3738 * Converted load_config to a class, ConfigLoader. Now recursion
3734 control is better organized. Doesn't include the same file twice.
3739 control is better organized. Doesn't include the same file twice.
3735
3740
3736 2001-11-29 Fernando Perez <fperez@colorado.edu>
3741 2001-11-29 Fernando Perez <fperez@colorado.edu>
3737
3742
3738 * Got input history working. Changed output history variables from
3743 * Got input history working. Changed output history variables from
3739 _p to _o so that _i is for input and _o for output. Just cleaner
3744 _p to _o so that _i is for input and _o for output. Just cleaner
3740 convention.
3745 convention.
3741
3746
3742 * Implemented parametric aliases. This pretty much allows the
3747 * Implemented parametric aliases. This pretty much allows the
3743 alias system to offer full-blown shell convenience, I think.
3748 alias system to offer full-blown shell convenience, I think.
3744
3749
3745 * Version 0.1.17 released, 0.1.18 opened.
3750 * Version 0.1.17 released, 0.1.18 opened.
3746
3751
3747 * dot_ipython/ipythonrc (alias): added documentation.
3752 * dot_ipython/ipythonrc (alias): added documentation.
3748 (xcolor): Fixed small bug (xcolors -> xcolor)
3753 (xcolor): Fixed small bug (xcolors -> xcolor)
3749
3754
3750 * Changed the alias system. Now alias is a magic command to define
3755 * Changed the alias system. Now alias is a magic command to define
3751 aliases just like the shell. Rationale: the builtin magics should
3756 aliases just like the shell. Rationale: the builtin magics should
3752 be there for things deeply connected to IPython's
3757 be there for things deeply connected to IPython's
3753 architecture. And this is a much lighter system for what I think
3758 architecture. And this is a much lighter system for what I think
3754 is the really important feature: allowing users to define quickly
3759 is the really important feature: allowing users to define quickly
3755 magics that will do shell things for them, so they can customize
3760 magics that will do shell things for them, so they can customize
3756 IPython easily to match their work habits. If someone is really
3761 IPython easily to match their work habits. If someone is really
3757 desperate to have another name for a builtin alias, they can
3762 desperate to have another name for a builtin alias, they can
3758 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3763 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3759 works.
3764 works.
3760
3765
3761 2001-11-28 Fernando Perez <fperez@colorado.edu>
3766 2001-11-28 Fernando Perez <fperez@colorado.edu>
3762
3767
3763 * Changed @file so that it opens the source file at the proper
3768 * Changed @file so that it opens the source file at the proper
3764 line. Since it uses less, if your EDITOR environment is
3769 line. Since it uses less, if your EDITOR environment is
3765 configured, typing v will immediately open your editor of choice
3770 configured, typing v will immediately open your editor of choice
3766 right at the line where the object is defined. Not as quick as
3771 right at the line where the object is defined. Not as quick as
3767 having a direct @edit command, but for all intents and purposes it
3772 having a direct @edit command, but for all intents and purposes it
3768 works. And I don't have to worry about writing @edit to deal with
3773 works. And I don't have to worry about writing @edit to deal with
3769 all the editors, less does that.
3774 all the editors, less does that.
3770
3775
3771 * Version 0.1.16 released, 0.1.17 opened.
3776 * Version 0.1.16 released, 0.1.17 opened.
3772
3777
3773 * Fixed some nasty bugs in the page/page_dumb combo that could
3778 * Fixed some nasty bugs in the page/page_dumb combo that could
3774 crash IPython.
3779 crash IPython.
3775
3780
3776 2001-11-27 Fernando Perez <fperez@colorado.edu>
3781 2001-11-27 Fernando Perez <fperez@colorado.edu>
3777
3782
3778 * Version 0.1.15 released, 0.1.16 opened.
3783 * Version 0.1.15 released, 0.1.16 opened.
3779
3784
3780 * Finally got ? and ?? to work for undefined things: now it's
3785 * Finally got ? and ?? to work for undefined things: now it's
3781 possible to type {}.get? and get information about the get method
3786 possible to type {}.get? and get information about the get method
3782 of dicts, or os.path? even if only os is defined (so technically
3787 of dicts, or os.path? even if only os is defined (so technically
3783 os.path isn't). Works at any level. For example, after import os,
3788 os.path isn't). Works at any level. For example, after import os,
3784 os?, os.path?, os.path.abspath? all work. This is great, took some
3789 os?, os.path?, os.path.abspath? all work. This is great, took some
3785 work in _ofind.
3790 work in _ofind.
3786
3791
3787 * Fixed more bugs with logging. The sanest way to do it was to add
3792 * Fixed more bugs with logging. The sanest way to do it was to add
3788 to @log a 'mode' parameter. Killed two in one shot (this mode
3793 to @log a 'mode' parameter. Killed two in one shot (this mode
3789 option was a request of Janko's). I think it's finally clean
3794 option was a request of Janko's). I think it's finally clean
3790 (famous last words).
3795 (famous last words).
3791
3796
3792 * Added a page_dumb() pager which does a decent job of paging on
3797 * Added a page_dumb() pager which does a decent job of paging on
3793 screen, if better things (like less) aren't available. One less
3798 screen, if better things (like less) aren't available. One less
3794 unix dependency (someday maybe somebody will port this to
3799 unix dependency (someday maybe somebody will port this to
3795 windows).
3800 windows).
3796
3801
3797 * Fixed problem in magic_log: would lock of logging out if log
3802 * Fixed problem in magic_log: would lock of logging out if log
3798 creation failed (because it would still think it had succeeded).
3803 creation failed (because it would still think it had succeeded).
3799
3804
3800 * Improved the page() function using curses to auto-detect screen
3805 * Improved the page() function using curses to auto-detect screen
3801 size. Now it can make a much better decision on whether to print
3806 size. Now it can make a much better decision on whether to print
3802 or page a string. Option screen_length was modified: a value 0
3807 or page a string. Option screen_length was modified: a value 0
3803 means auto-detect, and that's the default now.
3808 means auto-detect, and that's the default now.
3804
3809
3805 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3810 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3806 go out. I'll test it for a few days, then talk to Janko about
3811 go out. I'll test it for a few days, then talk to Janko about
3807 licences and announce it.
3812 licences and announce it.
3808
3813
3809 * Fixed the length of the auto-generated ---> prompt which appears
3814 * Fixed the length of the auto-generated ---> prompt which appears
3810 for auto-parens and auto-quotes. Getting this right isn't trivial,
3815 for auto-parens and auto-quotes. Getting this right isn't trivial,
3811 with all the color escapes, different prompt types and optional
3816 with all the color escapes, different prompt types and optional
3812 separators. But it seems to be working in all the combinations.
3817 separators. But it seems to be working in all the combinations.
3813
3818
3814 2001-11-26 Fernando Perez <fperez@colorado.edu>
3819 2001-11-26 Fernando Perez <fperez@colorado.edu>
3815
3820
3816 * Wrote a regexp filter to get option types from the option names
3821 * Wrote a regexp filter to get option types from the option names
3817 string. This eliminates the need to manually keep two duplicate
3822 string. This eliminates the need to manually keep two duplicate
3818 lists.
3823 lists.
3819
3824
3820 * Removed the unneeded check_option_names. Now options are handled
3825 * Removed the unneeded check_option_names. Now options are handled
3821 in a much saner manner and it's easy to visually check that things
3826 in a much saner manner and it's easy to visually check that things
3822 are ok.
3827 are ok.
3823
3828
3824 * Updated version numbers on all files I modified to carry a
3829 * Updated version numbers on all files I modified to carry a
3825 notice so Janko and Nathan have clear version markers.
3830 notice so Janko and Nathan have clear version markers.
3826
3831
3827 * Updated docstring for ultraTB with my changes. I should send
3832 * Updated docstring for ultraTB with my changes. I should send
3828 this to Nathan.
3833 this to Nathan.
3829
3834
3830 * Lots of small fixes. Ran everything through pychecker again.
3835 * Lots of small fixes. Ran everything through pychecker again.
3831
3836
3832 * Made loading of deep_reload an cmd line option. If it's not too
3837 * Made loading of deep_reload an cmd line option. If it's not too
3833 kosher, now people can just disable it. With -nodeep_reload it's
3838 kosher, now people can just disable it. With -nodeep_reload it's
3834 still available as dreload(), it just won't overwrite reload().
3839 still available as dreload(), it just won't overwrite reload().
3835
3840
3836 * Moved many options to the no| form (-opt and -noopt
3841 * Moved many options to the no| form (-opt and -noopt
3837 accepted). Cleaner.
3842 accepted). Cleaner.
3838
3843
3839 * Changed magic_log so that if called with no parameters, it uses
3844 * Changed magic_log so that if called with no parameters, it uses
3840 'rotate' mode. That way auto-generated logs aren't automatically
3845 'rotate' mode. That way auto-generated logs aren't automatically
3841 over-written. For normal logs, now a backup is made if it exists
3846 over-written. For normal logs, now a backup is made if it exists
3842 (only 1 level of backups). A new 'backup' mode was added to the
3847 (only 1 level of backups). A new 'backup' mode was added to the
3843 Logger class to support this. This was a request by Janko.
3848 Logger class to support this. This was a request by Janko.
3844
3849
3845 * Added @logoff/@logon to stop/restart an active log.
3850 * Added @logoff/@logon to stop/restart an active log.
3846
3851
3847 * Fixed a lot of bugs in log saving/replay. It was pretty
3852 * Fixed a lot of bugs in log saving/replay. It was pretty
3848 broken. Now special lines (!@,/) appear properly in the command
3853 broken. Now special lines (!@,/) appear properly in the command
3849 history after a log replay.
3854 history after a log replay.
3850
3855
3851 * Tried and failed to implement full session saving via pickle. My
3856 * Tried and failed to implement full session saving via pickle. My
3852 idea was to pickle __main__.__dict__, but modules can't be
3857 idea was to pickle __main__.__dict__, but modules can't be
3853 pickled. This would be a better alternative to replaying logs, but
3858 pickled. This would be a better alternative to replaying logs, but
3854 seems quite tricky to get to work. Changed -session to be called
3859 seems quite tricky to get to work. Changed -session to be called
3855 -logplay, which more accurately reflects what it does. And if we
3860 -logplay, which more accurately reflects what it does. And if we
3856 ever get real session saving working, -session is now available.
3861 ever get real session saving working, -session is now available.
3857
3862
3858 * Implemented color schemes for prompts also. As for tracebacks,
3863 * Implemented color schemes for prompts also. As for tracebacks,
3859 currently only NoColor and Linux are supported. But now the
3864 currently only NoColor and Linux are supported. But now the
3860 infrastructure is in place, based on a generic ColorScheme
3865 infrastructure is in place, based on a generic ColorScheme
3861 class. So writing and activating new schemes both for the prompts
3866 class. So writing and activating new schemes both for the prompts
3862 and the tracebacks should be straightforward.
3867 and the tracebacks should be straightforward.
3863
3868
3864 * Version 0.1.13 released, 0.1.14 opened.
3869 * Version 0.1.13 released, 0.1.14 opened.
3865
3870
3866 * Changed handling of options for output cache. Now counter is
3871 * Changed handling of options for output cache. Now counter is
3867 hardwired starting at 1 and one specifies the maximum number of
3872 hardwired starting at 1 and one specifies the maximum number of
3868 entries *in the outcache* (not the max prompt counter). This is
3873 entries *in the outcache* (not the max prompt counter). This is
3869 much better, since many statements won't increase the cache
3874 much better, since many statements won't increase the cache
3870 count. It also eliminated some confusing options, now there's only
3875 count. It also eliminated some confusing options, now there's only
3871 one: cache_size.
3876 one: cache_size.
3872
3877
3873 * Added 'alias' magic function and magic_alias option in the
3878 * Added 'alias' magic function and magic_alias option in the
3874 ipythonrc file. Now the user can easily define whatever names he
3879 ipythonrc file. Now the user can easily define whatever names he
3875 wants for the magic functions without having to play weird
3880 wants for the magic functions without having to play weird
3876 namespace games. This gives IPython a real shell-like feel.
3881 namespace games. This gives IPython a real shell-like feel.
3877
3882
3878 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
3883 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
3879 @ or not).
3884 @ or not).
3880
3885
3881 This was one of the last remaining 'visible' bugs (that I know
3886 This was one of the last remaining 'visible' bugs (that I know
3882 of). I think if I can clean up the session loading so it works
3887 of). I think if I can clean up the session loading so it works
3883 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
3888 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
3884 about licensing).
3889 about licensing).
3885
3890
3886 2001-11-25 Fernando Perez <fperez@colorado.edu>
3891 2001-11-25 Fernando Perez <fperez@colorado.edu>
3887
3892
3888 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
3893 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
3889 there's a cleaner distinction between what ? and ?? show.
3894 there's a cleaner distinction between what ? and ?? show.
3890
3895
3891 * Added screen_length option. Now the user can define his own
3896 * Added screen_length option. Now the user can define his own
3892 screen size for page() operations.
3897 screen size for page() operations.
3893
3898
3894 * Implemented magic shell-like functions with automatic code
3899 * Implemented magic shell-like functions with automatic code
3895 generation. Now adding another function is just a matter of adding
3900 generation. Now adding another function is just a matter of adding
3896 an entry to a dict, and the function is dynamically generated at
3901 an entry to a dict, and the function is dynamically generated at
3897 run-time. Python has some really cool features!
3902 run-time. Python has some really cool features!
3898
3903
3899 * Renamed many options to cleanup conventions a little. Now all
3904 * Renamed many options to cleanup conventions a little. Now all
3900 are lowercase, and only underscores where needed. Also in the code
3905 are lowercase, and only underscores where needed. Also in the code
3901 option name tables are clearer.
3906 option name tables are clearer.
3902
3907
3903 * Changed prompts a little. Now input is 'In [n]:' instead of
3908 * Changed prompts a little. Now input is 'In [n]:' instead of
3904 'In[n]:='. This allows it the numbers to be aligned with the
3909 'In[n]:='. This allows it the numbers to be aligned with the
3905 Out[n] numbers, and removes usage of ':=' which doesn't exist in
3910 Out[n] numbers, and removes usage of ':=' which doesn't exist in
3906 Python (it was a Mathematica thing). The '...' continuation prompt
3911 Python (it was a Mathematica thing). The '...' continuation prompt
3907 was also changed a little to align better.
3912 was also changed a little to align better.
3908
3913
3909 * Fixed bug when flushing output cache. Not all _p<n> variables
3914 * Fixed bug when flushing output cache. Not all _p<n> variables
3910 exist, so their deletion needs to be wrapped in a try:
3915 exist, so their deletion needs to be wrapped in a try:
3911
3916
3912 * Figured out how to properly use inspect.formatargspec() (it
3917 * Figured out how to properly use inspect.formatargspec() (it
3913 requires the args preceded by *). So I removed all the code from
3918 requires the args preceded by *). So I removed all the code from
3914 _get_pdef in Magic, which was just replicating that.
3919 _get_pdef in Magic, which was just replicating that.
3915
3920
3916 * Added test to prefilter to allow redefining magic function names
3921 * Added test to prefilter to allow redefining magic function names
3917 as variables. This is ok, since the @ form is always available,
3922 as variables. This is ok, since the @ form is always available,
3918 but whe should allow the user to define a variable called 'ls' if
3923 but whe should allow the user to define a variable called 'ls' if
3919 he needs it.
3924 he needs it.
3920
3925
3921 * Moved the ToDo information from README into a separate ToDo.
3926 * Moved the ToDo information from README into a separate ToDo.
3922
3927
3923 * General code cleanup and small bugfixes. I think it's close to a
3928 * General code cleanup and small bugfixes. I think it's close to a
3924 state where it can be released, obviously with a big 'beta'
3929 state where it can be released, obviously with a big 'beta'
3925 warning on it.
3930 warning on it.
3926
3931
3927 * Got the magic function split to work. Now all magics are defined
3932 * Got the magic function split to work. Now all magics are defined
3928 in a separate class. It just organizes things a bit, and now
3933 in a separate class. It just organizes things a bit, and now
3929 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
3934 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
3930 was too long).
3935 was too long).
3931
3936
3932 * Changed @clear to @reset to avoid potential confusions with
3937 * Changed @clear to @reset to avoid potential confusions with
3933 the shell command clear. Also renamed @cl to @clear, which does
3938 the shell command clear. Also renamed @cl to @clear, which does
3934 exactly what people expect it to from their shell experience.
3939 exactly what people expect it to from their shell experience.
3935
3940
3936 Added a check to the @reset command (since it's so
3941 Added a check to the @reset command (since it's so
3937 destructive, it's probably a good idea to ask for confirmation).
3942 destructive, it's probably a good idea to ask for confirmation).
3938 But now reset only works for full namespace resetting. Since the
3943 But now reset only works for full namespace resetting. Since the
3939 del keyword is already there for deleting a few specific
3944 del keyword is already there for deleting a few specific
3940 variables, I don't see the point of having a redundant magic
3945 variables, I don't see the point of having a redundant magic
3941 function for the same task.
3946 function for the same task.
3942
3947
3943 2001-11-24 Fernando Perez <fperez@colorado.edu>
3948 2001-11-24 Fernando Perez <fperez@colorado.edu>
3944
3949
3945 * Updated the builtin docs (esp. the ? ones).
3950 * Updated the builtin docs (esp. the ? ones).
3946
3951
3947 * Ran all the code through pychecker. Not terribly impressed with
3952 * Ran all the code through pychecker. Not terribly impressed with
3948 it: lots of spurious warnings and didn't really find anything of
3953 it: lots of spurious warnings and didn't really find anything of
3949 substance (just a few modules being imported and not used).
3954 substance (just a few modules being imported and not used).
3950
3955
3951 * Implemented the new ultraTB functionality into IPython. New
3956 * Implemented the new ultraTB functionality into IPython. New
3952 option: xcolors. This chooses color scheme. xmode now only selects
3957 option: xcolors. This chooses color scheme. xmode now only selects
3953 between Plain and Verbose. Better orthogonality.
3958 between Plain and Verbose. Better orthogonality.
3954
3959
3955 * Large rewrite of ultraTB. Much cleaner now, with a separation of
3960 * Large rewrite of ultraTB. Much cleaner now, with a separation of
3956 mode and color scheme for the exception handlers. Now it's
3961 mode and color scheme for the exception handlers. Now it's
3957 possible to have the verbose traceback with no coloring.
3962 possible to have the verbose traceback with no coloring.
3958
3963
3959 2001-11-23 Fernando Perez <fperez@colorado.edu>
3964 2001-11-23 Fernando Perez <fperez@colorado.edu>
3960
3965
3961 * Version 0.1.12 released, 0.1.13 opened.
3966 * Version 0.1.12 released, 0.1.13 opened.
3962
3967
3963 * Removed option to set auto-quote and auto-paren escapes by
3968 * Removed option to set auto-quote and auto-paren escapes by
3964 user. The chances of breaking valid syntax are just too high. If
3969 user. The chances of breaking valid syntax are just too high. If
3965 someone *really* wants, they can always dig into the code.
3970 someone *really* wants, they can always dig into the code.
3966
3971
3967 * Made prompt separators configurable.
3972 * Made prompt separators configurable.
3968
3973
3969 2001-11-22 Fernando Perez <fperez@colorado.edu>
3974 2001-11-22 Fernando Perez <fperez@colorado.edu>
3970
3975
3971 * Small bugfixes in many places.
3976 * Small bugfixes in many places.
3972
3977
3973 * Removed the MyCompleter class from ipplib. It seemed redundant
3978 * Removed the MyCompleter class from ipplib. It seemed redundant
3974 with the C-p,C-n history search functionality. Less code to
3979 with the C-p,C-n history search functionality. Less code to
3975 maintain.
3980 maintain.
3976
3981
3977 * Moved all the original ipython.py code into ipythonlib.py. Right
3982 * Moved all the original ipython.py code into ipythonlib.py. Right
3978 now it's just one big dump into a function called make_IPython, so
3983 now it's just one big dump into a function called make_IPython, so
3979 no real modularity has been gained. But at least it makes the
3984 no real modularity has been gained. But at least it makes the
3980 wrapper script tiny, and since ipythonlib is a module, it gets
3985 wrapper script tiny, and since ipythonlib is a module, it gets
3981 compiled and startup is much faster.
3986 compiled and startup is much faster.
3982
3987
3983 This is a reasobably 'deep' change, so we should test it for a
3988 This is a reasobably 'deep' change, so we should test it for a
3984 while without messing too much more with the code.
3989 while without messing too much more with the code.
3985
3990
3986 2001-11-21 Fernando Perez <fperez@colorado.edu>
3991 2001-11-21 Fernando Perez <fperez@colorado.edu>
3987
3992
3988 * Version 0.1.11 released, 0.1.12 opened for further work.
3993 * Version 0.1.11 released, 0.1.12 opened for further work.
3989
3994
3990 * Removed dependency on Itpl. It was only needed in one place. It
3995 * Removed dependency on Itpl. It was only needed in one place. It
3991 would be nice if this became part of python, though. It makes life
3996 would be nice if this became part of python, though. It makes life
3992 *a lot* easier in some cases.
3997 *a lot* easier in some cases.
3993
3998
3994 * Simplified the prefilter code a bit. Now all handlers are
3999 * Simplified the prefilter code a bit. Now all handlers are
3995 expected to explicitly return a value (at least a blank string).
4000 expected to explicitly return a value (at least a blank string).
3996
4001
3997 * Heavy edits in ipplib. Removed the help system altogether. Now
4002 * Heavy edits in ipplib. Removed the help system altogether. Now
3998 obj?/?? is used for inspecting objects, a magic @doc prints
4003 obj?/?? is used for inspecting objects, a magic @doc prints
3999 docstrings, and full-blown Python help is accessed via the 'help'
4004 docstrings, and full-blown Python help is accessed via the 'help'
4000 keyword. This cleans up a lot of code (less to maintain) and does
4005 keyword. This cleans up a lot of code (less to maintain) and does
4001 the job. Since 'help' is now a standard Python component, might as
4006 the job. Since 'help' is now a standard Python component, might as
4002 well use it and remove duplicate functionality.
4007 well use it and remove duplicate functionality.
4003
4008
4004 Also removed the option to use ipplib as a standalone program. By
4009 Also removed the option to use ipplib as a standalone program. By
4005 now it's too dependent on other parts of IPython to function alone.
4010 now it's too dependent on other parts of IPython to function alone.
4006
4011
4007 * Fixed bug in genutils.pager. It would crash if the pager was
4012 * Fixed bug in genutils.pager. It would crash if the pager was
4008 exited immediately after opening (broken pipe).
4013 exited immediately after opening (broken pipe).
4009
4014
4010 * Trimmed down the VerboseTB reporting a little. The header is
4015 * Trimmed down the VerboseTB reporting a little. The header is
4011 much shorter now and the repeated exception arguments at the end
4016 much shorter now and the repeated exception arguments at the end
4012 have been removed. For interactive use the old header seemed a bit
4017 have been removed. For interactive use the old header seemed a bit
4013 excessive.
4018 excessive.
4014
4019
4015 * Fixed small bug in output of @whos for variables with multi-word
4020 * Fixed small bug in output of @whos for variables with multi-word
4016 types (only first word was displayed).
4021 types (only first word was displayed).
4017
4022
4018 2001-11-17 Fernando Perez <fperez@colorado.edu>
4023 2001-11-17 Fernando Perez <fperez@colorado.edu>
4019
4024
4020 * Version 0.1.10 released, 0.1.11 opened for further work.
4025 * Version 0.1.10 released, 0.1.11 opened for further work.
4021
4026
4022 * Modified dirs and friends. dirs now *returns* the stack (not
4027 * Modified dirs and friends. dirs now *returns* the stack (not
4023 prints), so one can manipulate it as a variable. Convenient to
4028 prints), so one can manipulate it as a variable. Convenient to
4024 travel along many directories.
4029 travel along many directories.
4025
4030
4026 * Fixed bug in magic_pdef: would only work with functions with
4031 * Fixed bug in magic_pdef: would only work with functions with
4027 arguments with default values.
4032 arguments with default values.
4028
4033
4029 2001-11-14 Fernando Perez <fperez@colorado.edu>
4034 2001-11-14 Fernando Perez <fperez@colorado.edu>
4030
4035
4031 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4036 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4032 example with IPython. Various other minor fixes and cleanups.
4037 example with IPython. Various other minor fixes and cleanups.
4033
4038
4034 * Version 0.1.9 released, 0.1.10 opened for further work.
4039 * Version 0.1.9 released, 0.1.10 opened for further work.
4035
4040
4036 * Added sys.path to the list of directories searched in the
4041 * Added sys.path to the list of directories searched in the
4037 execfile= option. It used to be the current directory and the
4042 execfile= option. It used to be the current directory and the
4038 user's IPYTHONDIR only.
4043 user's IPYTHONDIR only.
4039
4044
4040 2001-11-13 Fernando Perez <fperez@colorado.edu>
4045 2001-11-13 Fernando Perez <fperez@colorado.edu>
4041
4046
4042 * Reinstated the raw_input/prefilter separation that Janko had
4047 * Reinstated the raw_input/prefilter separation that Janko had
4043 initially. This gives a more convenient setup for extending the
4048 initially. This gives a more convenient setup for extending the
4044 pre-processor from the outside: raw_input always gets a string,
4049 pre-processor from the outside: raw_input always gets a string,
4045 and prefilter has to process it. We can then redefine prefilter
4050 and prefilter has to process it. We can then redefine prefilter
4046 from the outside and implement extensions for special
4051 from the outside and implement extensions for special
4047 purposes.
4052 purposes.
4048
4053
4049 Today I got one for inputting PhysicalQuantity objects
4054 Today I got one for inputting PhysicalQuantity objects
4050 (from Scientific) without needing any function calls at
4055 (from Scientific) without needing any function calls at
4051 all. Extremely convenient, and it's all done as a user-level
4056 all. Extremely convenient, and it's all done as a user-level
4052 extension (no IPython code was touched). Now instead of:
4057 extension (no IPython code was touched). Now instead of:
4053 a = PhysicalQuantity(4.2,'m/s**2')
4058 a = PhysicalQuantity(4.2,'m/s**2')
4054 one can simply say
4059 one can simply say
4055 a = 4.2 m/s**2
4060 a = 4.2 m/s**2
4056 or even
4061 or even
4057 a = 4.2 m/s^2
4062 a = 4.2 m/s^2
4058
4063
4059 I use this, but it's also a proof of concept: IPython really is
4064 I use this, but it's also a proof of concept: IPython really is
4060 fully user-extensible, even at the level of the parsing of the
4065 fully user-extensible, even at the level of the parsing of the
4061 command line. It's not trivial, but it's perfectly doable.
4066 command line. It's not trivial, but it's perfectly doable.
4062
4067
4063 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4068 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4064 the problem of modules being loaded in the inverse order in which
4069 the problem of modules being loaded in the inverse order in which
4065 they were defined in
4070 they were defined in
4066
4071
4067 * Version 0.1.8 released, 0.1.9 opened for further work.
4072 * Version 0.1.8 released, 0.1.9 opened for further work.
4068
4073
4069 * Added magics pdef, source and file. They respectively show the
4074 * Added magics pdef, source and file. They respectively show the
4070 definition line ('prototype' in C), source code and full python
4075 definition line ('prototype' in C), source code and full python
4071 file for any callable object. The object inspector oinfo uses
4076 file for any callable object. The object inspector oinfo uses
4072 these to show the same information.
4077 these to show the same information.
4073
4078
4074 * Version 0.1.7 released, 0.1.8 opened for further work.
4079 * Version 0.1.7 released, 0.1.8 opened for further work.
4075
4080
4076 * Separated all the magic functions into a class called Magic. The
4081 * Separated all the magic functions into a class called Magic. The
4077 InteractiveShell class was becoming too big for Xemacs to handle
4082 InteractiveShell class was becoming too big for Xemacs to handle
4078 (de-indenting a line would lock it up for 10 seconds while it
4083 (de-indenting a line would lock it up for 10 seconds while it
4079 backtracked on the whole class!)
4084 backtracked on the whole class!)
4080
4085
4081 FIXME: didn't work. It can be done, but right now namespaces are
4086 FIXME: didn't work. It can be done, but right now namespaces are
4082 all messed up. Do it later (reverted it for now, so at least
4087 all messed up. Do it later (reverted it for now, so at least
4083 everything works as before).
4088 everything works as before).
4084
4089
4085 * Got the object introspection system (magic_oinfo) working! I
4090 * Got the object introspection system (magic_oinfo) working! I
4086 think this is pretty much ready for release to Janko, so he can
4091 think this is pretty much ready for release to Janko, so he can
4087 test it for a while and then announce it. Pretty much 100% of what
4092 test it for a while and then announce it. Pretty much 100% of what
4088 I wanted for the 'phase 1' release is ready. Happy, tired.
4093 I wanted for the 'phase 1' release is ready. Happy, tired.
4089
4094
4090 2001-11-12 Fernando Perez <fperez@colorado.edu>
4095 2001-11-12 Fernando Perez <fperez@colorado.edu>
4091
4096
4092 * Version 0.1.6 released, 0.1.7 opened for further work.
4097 * Version 0.1.6 released, 0.1.7 opened for further work.
4093
4098
4094 * Fixed bug in printing: it used to test for truth before
4099 * Fixed bug in printing: it used to test for truth before
4095 printing, so 0 wouldn't print. Now checks for None.
4100 printing, so 0 wouldn't print. Now checks for None.
4096
4101
4097 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4102 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4098 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4103 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4099 reaches by hand into the outputcache. Think of a better way to do
4104 reaches by hand into the outputcache. Think of a better way to do
4100 this later.
4105 this later.
4101
4106
4102 * Various small fixes thanks to Nathan's comments.
4107 * Various small fixes thanks to Nathan's comments.
4103
4108
4104 * Changed magic_pprint to magic_Pprint. This way it doesn't
4109 * Changed magic_pprint to magic_Pprint. This way it doesn't
4105 collide with pprint() and the name is consistent with the command
4110 collide with pprint() and the name is consistent with the command
4106 line option.
4111 line option.
4107
4112
4108 * Changed prompt counter behavior to be fully like
4113 * Changed prompt counter behavior to be fully like
4109 Mathematica's. That is, even input that doesn't return a result
4114 Mathematica's. That is, even input that doesn't return a result
4110 raises the prompt counter. The old behavior was kind of confusing
4115 raises the prompt counter. The old behavior was kind of confusing
4111 (getting the same prompt number several times if the operation
4116 (getting the same prompt number several times if the operation
4112 didn't return a result).
4117 didn't return a result).
4113
4118
4114 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4119 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4115
4120
4116 * Fixed -Classic mode (wasn't working anymore).
4121 * Fixed -Classic mode (wasn't working anymore).
4117
4122
4118 * Added colored prompts using Nathan's new code. Colors are
4123 * Added colored prompts using Nathan's new code. Colors are
4119 currently hardwired, they can be user-configurable. For
4124 currently hardwired, they can be user-configurable. For
4120 developers, they can be chosen in file ipythonlib.py, at the
4125 developers, they can be chosen in file ipythonlib.py, at the
4121 beginning of the CachedOutput class def.
4126 beginning of the CachedOutput class def.
4122
4127
4123 2001-11-11 Fernando Perez <fperez@colorado.edu>
4128 2001-11-11 Fernando Perez <fperez@colorado.edu>
4124
4129
4125 * Version 0.1.5 released, 0.1.6 opened for further work.
4130 * Version 0.1.5 released, 0.1.6 opened for further work.
4126
4131
4127 * Changed magic_env to *return* the environment as a dict (not to
4132 * Changed magic_env to *return* the environment as a dict (not to
4128 print it). This way it prints, but it can also be processed.
4133 print it). This way it prints, but it can also be processed.
4129
4134
4130 * Added Verbose exception reporting to interactive
4135 * Added Verbose exception reporting to interactive
4131 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4136 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4132 traceback. Had to make some changes to the ultraTB file. This is
4137 traceback. Had to make some changes to the ultraTB file. This is
4133 probably the last 'big' thing in my mental todo list. This ties
4138 probably the last 'big' thing in my mental todo list. This ties
4134 in with the next entry:
4139 in with the next entry:
4135
4140
4136 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4141 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4137 has to specify is Plain, Color or Verbose for all exception
4142 has to specify is Plain, Color or Verbose for all exception
4138 handling.
4143 handling.
4139
4144
4140 * Removed ShellServices option. All this can really be done via
4145 * Removed ShellServices option. All this can really be done via
4141 the magic system. It's easier to extend, cleaner and has automatic
4146 the magic system. It's easier to extend, cleaner and has automatic
4142 namespace protection and documentation.
4147 namespace protection and documentation.
4143
4148
4144 2001-11-09 Fernando Perez <fperez@colorado.edu>
4149 2001-11-09 Fernando Perez <fperez@colorado.edu>
4145
4150
4146 * Fixed bug in output cache flushing (missing parameter to
4151 * Fixed bug in output cache flushing (missing parameter to
4147 __init__). Other small bugs fixed (found using pychecker).
4152 __init__). Other small bugs fixed (found using pychecker).
4148
4153
4149 * Version 0.1.4 opened for bugfixing.
4154 * Version 0.1.4 opened for bugfixing.
4150
4155
4151 2001-11-07 Fernando Perez <fperez@colorado.edu>
4156 2001-11-07 Fernando Perez <fperez@colorado.edu>
4152
4157
4153 * Version 0.1.3 released, mainly because of the raw_input bug.
4158 * Version 0.1.3 released, mainly because of the raw_input bug.
4154
4159
4155 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4160 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4156 and when testing for whether things were callable, a call could
4161 and when testing for whether things were callable, a call could
4157 actually be made to certain functions. They would get called again
4162 actually be made to certain functions. They would get called again
4158 once 'really' executed, with a resulting double call. A disaster
4163 once 'really' executed, with a resulting double call. A disaster
4159 in many cases (list.reverse() would never work!).
4164 in many cases (list.reverse() would never work!).
4160
4165
4161 * Removed prefilter() function, moved its code to raw_input (which
4166 * Removed prefilter() function, moved its code to raw_input (which
4162 after all was just a near-empty caller for prefilter). This saves
4167 after all was just a near-empty caller for prefilter). This saves
4163 a function call on every prompt, and simplifies the class a tiny bit.
4168 a function call on every prompt, and simplifies the class a tiny bit.
4164
4169
4165 * Fix _ip to __ip name in magic example file.
4170 * Fix _ip to __ip name in magic example file.
4166
4171
4167 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4172 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4168 work with non-gnu versions of tar.
4173 work with non-gnu versions of tar.
4169
4174
4170 2001-11-06 Fernando Perez <fperez@colorado.edu>
4175 2001-11-06 Fernando Perez <fperez@colorado.edu>
4171
4176
4172 * Version 0.1.2. Just to keep track of the recent changes.
4177 * Version 0.1.2. Just to keep track of the recent changes.
4173
4178
4174 * Fixed nasty bug in output prompt routine. It used to check 'if
4179 * Fixed nasty bug in output prompt routine. It used to check 'if
4175 arg != None...'. Problem is, this fails if arg implements a
4180 arg != None...'. Problem is, this fails if arg implements a
4176 special comparison (__cmp__) which disallows comparing to
4181 special comparison (__cmp__) which disallows comparing to
4177 None. Found it when trying to use the PhysicalQuantity module from
4182 None. Found it when trying to use the PhysicalQuantity module from
4178 ScientificPython.
4183 ScientificPython.
4179
4184
4180 2001-11-05 Fernando Perez <fperez@colorado.edu>
4185 2001-11-05 Fernando Perez <fperez@colorado.edu>
4181
4186
4182 * Also added dirs. Now the pushd/popd/dirs family functions
4187 * Also added dirs. Now the pushd/popd/dirs family functions
4183 basically like the shell, with the added convenience of going home
4188 basically like the shell, with the added convenience of going home
4184 when called with no args.
4189 when called with no args.
4185
4190
4186 * pushd/popd slightly modified to mimic shell behavior more
4191 * pushd/popd slightly modified to mimic shell behavior more
4187 closely.
4192 closely.
4188
4193
4189 * Added env,pushd,popd from ShellServices as magic functions. I
4194 * Added env,pushd,popd from ShellServices as magic functions. I
4190 think the cleanest will be to port all desired functions from
4195 think the cleanest will be to port all desired functions from
4191 ShellServices as magics and remove ShellServices altogether. This
4196 ShellServices as magics and remove ShellServices altogether. This
4192 will provide a single, clean way of adding functionality
4197 will provide a single, clean way of adding functionality
4193 (shell-type or otherwise) to IP.
4198 (shell-type or otherwise) to IP.
4194
4199
4195 2001-11-04 Fernando Perez <fperez@colorado.edu>
4200 2001-11-04 Fernando Perez <fperez@colorado.edu>
4196
4201
4197 * Added .ipython/ directory to sys.path. This way users can keep
4202 * Added .ipython/ directory to sys.path. This way users can keep
4198 customizations there and access them via import.
4203 customizations there and access them via import.
4199
4204
4200 2001-11-03 Fernando Perez <fperez@colorado.edu>
4205 2001-11-03 Fernando Perez <fperez@colorado.edu>
4201
4206
4202 * Opened version 0.1.1 for new changes.
4207 * Opened version 0.1.1 for new changes.
4203
4208
4204 * Changed version number to 0.1.0: first 'public' release, sent to
4209 * Changed version number to 0.1.0: first 'public' release, sent to
4205 Nathan and Janko.
4210 Nathan and Janko.
4206
4211
4207 * Lots of small fixes and tweaks.
4212 * Lots of small fixes and tweaks.
4208
4213
4209 * Minor changes to whos format. Now strings are shown, snipped if
4214 * Minor changes to whos format. Now strings are shown, snipped if
4210 too long.
4215 too long.
4211
4216
4212 * Changed ShellServices to work on __main__ so they show up in @who
4217 * Changed ShellServices to work on __main__ so they show up in @who
4213
4218
4214 * Help also works with ? at the end of a line:
4219 * Help also works with ? at the end of a line:
4215 ?sin and sin?
4220 ?sin and sin?
4216 both produce the same effect. This is nice, as often I use the
4221 both produce the same effect. This is nice, as often I use the
4217 tab-complete to find the name of a method, but I used to then have
4222 tab-complete to find the name of a method, but I used to then have
4218 to go to the beginning of the line to put a ? if I wanted more
4223 to go to the beginning of the line to put a ? if I wanted more
4219 info. Now I can just add the ? and hit return. Convenient.
4224 info. Now I can just add the ? and hit return. Convenient.
4220
4225
4221 2001-11-02 Fernando Perez <fperez@colorado.edu>
4226 2001-11-02 Fernando Perez <fperez@colorado.edu>
4222
4227
4223 * Python version check (>=2.1) added.
4228 * Python version check (>=2.1) added.
4224
4229
4225 * Added LazyPython documentation. At this point the docs are quite
4230 * Added LazyPython documentation. At this point the docs are quite
4226 a mess. A cleanup is in order.
4231 a mess. A cleanup is in order.
4227
4232
4228 * Auto-installer created. For some bizarre reason, the zipfiles
4233 * Auto-installer created. For some bizarre reason, the zipfiles
4229 module isn't working on my system. So I made a tar version
4234 module isn't working on my system. So I made a tar version
4230 (hopefully the command line options in various systems won't kill
4235 (hopefully the command line options in various systems won't kill
4231 me).
4236 me).
4232
4237
4233 * Fixes to Struct in genutils. Now all dictionary-like methods are
4238 * Fixes to Struct in genutils. Now all dictionary-like methods are
4234 protected (reasonably).
4239 protected (reasonably).
4235
4240
4236 * Added pager function to genutils and changed ? to print usage
4241 * Added pager function to genutils and changed ? to print usage
4237 note through it (it was too long).
4242 note through it (it was too long).
4238
4243
4239 * Added the LazyPython functionality. Works great! I changed the
4244 * Added the LazyPython functionality. Works great! I changed the
4240 auto-quote escape to ';', it's on home row and next to '. But
4245 auto-quote escape to ';', it's on home row and next to '. But
4241 both auto-quote and auto-paren (still /) escapes are command-line
4246 both auto-quote and auto-paren (still /) escapes are command-line
4242 parameters.
4247 parameters.
4243
4248
4244
4249
4245 2001-11-01 Fernando Perez <fperez@colorado.edu>
4250 2001-11-01 Fernando Perez <fperez@colorado.edu>
4246
4251
4247 * Version changed to 0.0.7. Fairly large change: configuration now
4252 * Version changed to 0.0.7. Fairly large change: configuration now
4248 is all stored in a directory, by default .ipython. There, all
4253 is all stored in a directory, by default .ipython. There, all
4249 config files have normal looking names (not .names)
4254 config files have normal looking names (not .names)
4250
4255
4251 * Version 0.0.6 Released first to Lucas and Archie as a test
4256 * Version 0.0.6 Released first to Lucas and Archie as a test
4252 run. Since it's the first 'semi-public' release, change version to
4257 run. Since it's the first 'semi-public' release, change version to
4253 > 0.0.6 for any changes now.
4258 > 0.0.6 for any changes now.
4254
4259
4255 * Stuff I had put in the ipplib.py changelog:
4260 * Stuff I had put in the ipplib.py changelog:
4256
4261
4257 Changes to InteractiveShell:
4262 Changes to InteractiveShell:
4258
4263
4259 - Made the usage message a parameter.
4264 - Made the usage message a parameter.
4260
4265
4261 - Require the name of the shell variable to be given. It's a bit
4266 - Require the name of the shell variable to be given. It's a bit
4262 of a hack, but allows the name 'shell' not to be hardwire in the
4267 of a hack, but allows the name 'shell' not to be hardwire in the
4263 magic (@) handler, which is problematic b/c it requires
4268 magic (@) handler, which is problematic b/c it requires
4264 polluting the global namespace with 'shell'. This in turn is
4269 polluting the global namespace with 'shell'. This in turn is
4265 fragile: if a user redefines a variable called shell, things
4270 fragile: if a user redefines a variable called shell, things
4266 break.
4271 break.
4267
4272
4268 - magic @: all functions available through @ need to be defined
4273 - magic @: all functions available through @ need to be defined
4269 as magic_<name>, even though they can be called simply as
4274 as magic_<name>, even though they can be called simply as
4270 @<name>. This allows the special command @magic to gather
4275 @<name>. This allows the special command @magic to gather
4271 information automatically about all existing magic functions,
4276 information automatically about all existing magic functions,
4272 even if they are run-time user extensions, by parsing the shell
4277 even if they are run-time user extensions, by parsing the shell
4273 instance __dict__ looking for special magic_ names.
4278 instance __dict__ looking for special magic_ names.
4274
4279
4275 - mainloop: added *two* local namespace parameters. This allows
4280 - mainloop: added *two* local namespace parameters. This allows
4276 the class to differentiate between parameters which were there
4281 the class to differentiate between parameters which were there
4277 before and after command line initialization was processed. This
4282 before and after command line initialization was processed. This
4278 way, later @who can show things loaded at startup by the
4283 way, later @who can show things loaded at startup by the
4279 user. This trick was necessary to make session saving/reloading
4284 user. This trick was necessary to make session saving/reloading
4280 really work: ideally after saving/exiting/reloading a session,
4285 really work: ideally after saving/exiting/reloading a session,
4281 *everythin* should look the same, including the output of @who. I
4286 *everythin* should look the same, including the output of @who. I
4282 was only able to make this work with this double namespace
4287 was only able to make this work with this double namespace
4283 trick.
4288 trick.
4284
4289
4285 - added a header to the logfile which allows (almost) full
4290 - added a header to the logfile which allows (almost) full
4286 session restoring.
4291 session restoring.
4287
4292
4288 - prepend lines beginning with @ or !, with a and log
4293 - prepend lines beginning with @ or !, with a and log
4289 them. Why? !lines: may be useful to know what you did @lines:
4294 them. Why? !lines: may be useful to know what you did @lines:
4290 they may affect session state. So when restoring a session, at
4295 they may affect session state. So when restoring a session, at
4291 least inform the user of their presence. I couldn't quite get
4296 least inform the user of their presence. I couldn't quite get
4292 them to properly re-execute, but at least the user is warned.
4297 them to properly re-execute, but at least the user is warned.
4293
4298
4294 * Started ChangeLog.
4299 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now