##// END OF EJS Templates
fix small but critical bug for win32 system access.
fperez -
Show More
@@ -1,1705 +1,1705 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 972 2005-12-29 18:45:19Z fperez $"""
8 $Id: genutils.py 980 2005-12-30 15:42:04Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
12 #
12 #
13 # Distributed under the terms of the BSD License. The full license is in
13 # Distributed under the terms of the BSD License. The full license is in
14 # the file COPYING, distributed as part of this software.
14 # the file COPYING, distributed as part of this software.
15 #*****************************************************************************
15 #*****************************************************************************
16
16
17 from __future__ import generators # 2.2 compatibility
17 from __future__ import generators # 2.2 compatibility
18
18
19 from IPython import Release
19 from IPython import Release
20 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __author__ = '%s <%s>' % Release.authors['Fernando']
21 __license__ = Release.license
21 __license__ = Release.license
22
22
23 #****************************************************************************
23 #****************************************************************************
24 # required modules from the Python standard library
24 # required modules from the Python standard library
25 import __main__
25 import __main__
26 import commands
26 import commands
27 import os
27 import os
28 import re
28 import re
29 import shlex
29 import shlex
30 import shutil
30 import shutil
31 import sys
31 import sys
32 import tempfile
32 import tempfile
33 import time
33 import time
34 import types
34 import types
35
35
36 # Other IPython utilities
36 # Other IPython utilities
37 from IPython.Itpl import Itpl,itpl,printpl
37 from IPython.Itpl import Itpl,itpl,printpl
38 from IPython import DPyGetOpt
38 from IPython import DPyGetOpt
39
39
40 if os.name == "nt":
40 if os.name == "nt":
41 from IPython.winconsole import get_console_size
41 from IPython.winconsole import get_console_size
42
42
43 # Build objects which appeared in Python 2.3 for 2.2, to make ipython
43 # Build objects which appeared in Python 2.3 for 2.2, to make ipython
44 # 2.2-friendly
44 # 2.2-friendly
45 try:
45 try:
46 basestring
46 basestring
47 except NameError:
47 except NameError:
48 import types
48 import types
49 basestring = (types.StringType, types.UnicodeType)
49 basestring = (types.StringType, types.UnicodeType)
50 True = 1==1
50 True = 1==1
51 False = 1==0
51 False = 1==0
52
52
53 def enumerate(obj):
53 def enumerate(obj):
54 i = -1
54 i = -1
55 for item in obj:
55 for item in obj:
56 i += 1
56 i += 1
57 yield i, item
57 yield i, item
58
58
59 # add these to the builtin namespace, so that all modules find them
59 # add these to the builtin namespace, so that all modules find them
60 import __builtin__
60 import __builtin__
61 __builtin__.basestring = basestring
61 __builtin__.basestring = basestring
62 __builtin__.True = True
62 __builtin__.True = True
63 __builtin__.False = False
63 __builtin__.False = False
64 __builtin__.enumerate = enumerate
64 __builtin__.enumerate = enumerate
65
65
66 # Try to use shlex.split for converting an input string into a sys.argv-type
66 # Try to use shlex.split for converting an input string into a sys.argv-type
67 # list. This appeared in Python 2.3, so here's a quick backport for 2.2.
67 # list. This appeared in Python 2.3, so here's a quick backport for 2.2.
68 try:
68 try:
69 shlex_split = shlex.split
69 shlex_split = shlex.split
70 except AttributeError:
70 except AttributeError:
71 _quotesre = re.compile(r'[\'"](.*)[\'"]')
71 _quotesre = re.compile(r'[\'"](.*)[\'"]')
72 _wordchars = ('abcdfeghijklmnopqrstuvwxyz'
72 _wordchars = ('abcdfeghijklmnopqrstuvwxyz'
73 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.~*?'
73 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.~*?'
74 'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
74 'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
75 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ%s'
75 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ%s'
76 % os.sep)
76 % os.sep)
77
77
78 def shlex_split(s):
78 def shlex_split(s):
79 """Simplified backport to Python 2.2 of shlex.split().
79 """Simplified backport to Python 2.2 of shlex.split().
80
80
81 This is a quick and dirty hack, since the shlex module under 2.2 lacks
81 This is a quick and dirty hack, since the shlex module under 2.2 lacks
82 several of the features needed to really match the functionality of
82 several of the features needed to really match the functionality of
83 shlex.split() in 2.3."""
83 shlex.split() in 2.3."""
84
84
85 lex = shlex.shlex(StringIO(s))
85 lex = shlex.shlex(StringIO(s))
86 # Try to get options, extensions and path separators as characters
86 # Try to get options, extensions and path separators as characters
87 lex.wordchars = _wordchars
87 lex.wordchars = _wordchars
88 lex.commenters = ''
88 lex.commenters = ''
89 # Make a list out of the lexer by hand, since in 2.2 it's not an
89 # Make a list out of the lexer by hand, since in 2.2 it's not an
90 # iterator.
90 # iterator.
91 lout = []
91 lout = []
92 while 1:
92 while 1:
93 token = lex.get_token()
93 token = lex.get_token()
94 if token == '':
94 if token == '':
95 break
95 break
96 # Try to handle quoted tokens correctly
96 # Try to handle quoted tokens correctly
97 quotes = _quotesre.match(token)
97 quotes = _quotesre.match(token)
98 if quotes:
98 if quotes:
99 token = quotes.group(1)
99 token = quotes.group(1)
100 lout.append(token)
100 lout.append(token)
101 return lout
101 return lout
102
102
103 #****************************************************************************
103 #****************************************************************************
104 # Exceptions
104 # Exceptions
105 class Error(Exception):
105 class Error(Exception):
106 """Base class for exceptions in this module."""
106 """Base class for exceptions in this module."""
107 pass
107 pass
108
108
109 #----------------------------------------------------------------------------
109 #----------------------------------------------------------------------------
110 class IOStream:
110 class IOStream:
111 def __init__(self,stream,fallback):
111 def __init__(self,stream,fallback):
112 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
112 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
113 stream = fallback
113 stream = fallback
114 self.stream = stream
114 self.stream = stream
115 self._swrite = stream.write
115 self._swrite = stream.write
116 self.flush = stream.flush
116 self.flush = stream.flush
117
117
118 def write(self,data):
118 def write(self,data):
119 try:
119 try:
120 self._swrite(data)
120 self._swrite(data)
121 except:
121 except:
122 try:
122 try:
123 # print handles some unicode issues which may trip a plain
123 # print handles some unicode issues which may trip a plain
124 # write() call. Attempt to emulate write() by using a
124 # write() call. Attempt to emulate write() by using a
125 # trailing comma
125 # trailing comma
126 print >> self.stream, data,
126 print >> self.stream, data,
127 except:
127 except:
128 # if we get here, something is seriously broken.
128 # if we get here, something is seriously broken.
129 print >> sys.stderr, \
129 print >> sys.stderr, \
130 'ERROR - failed to write data to stream:', stream
130 'ERROR - failed to write data to stream:', stream
131
131
132 class IOTerm:
132 class IOTerm:
133 """ Term holds the file or file-like objects for handling I/O operations.
133 """ Term holds the file or file-like objects for handling I/O operations.
134
134
135 These are normally just sys.stdin, sys.stdout and sys.stderr but for
135 These are normally just sys.stdin, sys.stdout and sys.stderr but for
136 Windows they can can replaced to allow editing the strings before they are
136 Windows they can can replaced to allow editing the strings before they are
137 displayed."""
137 displayed."""
138
138
139 # In the future, having IPython channel all its I/O operations through
139 # In the future, having IPython channel all its I/O operations through
140 # this class will make it easier to embed it into other environments which
140 # this class will make it easier to embed it into other environments which
141 # are not a normal terminal (such as a GUI-based shell)
141 # are not a normal terminal (such as a GUI-based shell)
142 def __init__(self,cin=None,cout=None,cerr=None):
142 def __init__(self,cin=None,cout=None,cerr=None):
143 self.cin = IOStream(cin,sys.stdin)
143 self.cin = IOStream(cin,sys.stdin)
144 self.cout = IOStream(cout,sys.stdout)
144 self.cout = IOStream(cout,sys.stdout)
145 self.cerr = IOStream(cerr,sys.stderr)
145 self.cerr = IOStream(cerr,sys.stderr)
146
146
147 # Global variable to be used for all I/O
147 # Global variable to be used for all I/O
148 Term = IOTerm()
148 Term = IOTerm()
149
149
150 # Windows-specific code to load Gary Bishop's readline and configure it
150 # Windows-specific code to load Gary Bishop's readline and configure it
151 # automatically for the users
151 # automatically for the users
152 # Note: os.name on cygwin returns posix, so this should only pick up 'native'
152 # Note: os.name on cygwin returns posix, so this should only pick up 'native'
153 # windows. Cygwin returns 'cygwin' for sys.platform.
153 # windows. Cygwin returns 'cygwin' for sys.platform.
154 if os.name == 'nt':
154 if os.name == 'nt':
155 try:
155 try:
156 import readline
156 import readline
157 except ImportError:
157 except ImportError:
158 pass
158 pass
159 else:
159 else:
160 try:
160 try:
161 _out = readline.GetOutputFile()
161 _out = readline.GetOutputFile()
162 except AttributeError:
162 except AttributeError:
163 pass
163 pass
164 else:
164 else:
165 # Remake Term to use the readline i/o facilities
165 # Remake Term to use the readline i/o facilities
166 Term = IOTerm(cout=_out,cerr=_out)
166 Term = IOTerm(cout=_out,cerr=_out)
167 del _out
167 del _out
168
168
169 #****************************************************************************
169 #****************************************************************************
170 # Generic warning/error printer, used by everything else
170 # Generic warning/error printer, used by everything else
171 def warn(msg,level=2,exit_val=1):
171 def warn(msg,level=2,exit_val=1):
172 """Standard warning printer. Gives formatting consistency.
172 """Standard warning printer. Gives formatting consistency.
173
173
174 Output is sent to Term.cerr (sys.stderr by default).
174 Output is sent to Term.cerr (sys.stderr by default).
175
175
176 Options:
176 Options:
177
177
178 -level(2): allows finer control:
178 -level(2): allows finer control:
179 0 -> Do nothing, dummy function.
179 0 -> Do nothing, dummy function.
180 1 -> Print message.
180 1 -> Print message.
181 2 -> Print 'WARNING:' + message. (Default level).
181 2 -> Print 'WARNING:' + message. (Default level).
182 3 -> Print 'ERROR:' + message.
182 3 -> Print 'ERROR:' + message.
183 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
183 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
184
184
185 -exit_val (1): exit value returned by sys.exit() for a level 4
185 -exit_val (1): exit value returned by sys.exit() for a level 4
186 warning. Ignored for all other levels."""
186 warning. Ignored for all other levels."""
187
187
188 if level>0:
188 if level>0:
189 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
189 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
190 print >> Term.cerr, '%s%s' % (header[level],msg)
190 print >> Term.cerr, '%s%s' % (header[level],msg)
191 if level == 4:
191 if level == 4:
192 print >> Term.cerr,'Exiting.\n'
192 print >> Term.cerr,'Exiting.\n'
193 sys.exit(exit_val)
193 sys.exit(exit_val)
194
194
195 def info(msg):
195 def info(msg):
196 """Equivalent to warn(msg,level=1)."""
196 """Equivalent to warn(msg,level=1)."""
197
197
198 warn(msg,level=1)
198 warn(msg,level=1)
199
199
200 def error(msg):
200 def error(msg):
201 """Equivalent to warn(msg,level=3)."""
201 """Equivalent to warn(msg,level=3)."""
202
202
203 warn(msg,level=3)
203 warn(msg,level=3)
204
204
205 def fatal(msg,exit_val=1):
205 def fatal(msg,exit_val=1):
206 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
206 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
207
207
208 warn(msg,exit_val=exit_val,level=4)
208 warn(msg,exit_val=exit_val,level=4)
209
209
210 #----------------------------------------------------------------------------
210 #----------------------------------------------------------------------------
211 StringTypes = types.StringTypes
211 StringTypes = types.StringTypes
212
212
213 # Basic timing functionality
213 # Basic timing functionality
214
214
215 # If possible (Unix), use the resource module instead of time.clock()
215 # If possible (Unix), use the resource module instead of time.clock()
216 try:
216 try:
217 import resource
217 import resource
218 def clock():
218 def clock():
219 """clock() -> floating point number
219 """clock() -> floating point number
220
220
221 Return the CPU time in seconds (user time only, system time is
221 Return the CPU time in seconds (user time only, system time is
222 ignored) since the start of the process. This is done via a call to
222 ignored) since the start of the process. This is done via a call to
223 resource.getrusage, so it avoids the wraparound problems in
223 resource.getrusage, so it avoids the wraparound problems in
224 time.clock()."""
224 time.clock()."""
225
225
226 return resource.getrusage(resource.RUSAGE_SELF)[0]
226 return resource.getrusage(resource.RUSAGE_SELF)[0]
227
227
228 def clock2():
228 def clock2():
229 """clock2() -> (t_user,t_system)
229 """clock2() -> (t_user,t_system)
230
230
231 Similar to clock(), but return a tuple of user/system times."""
231 Similar to clock(), but return a tuple of user/system times."""
232 return resource.getrusage(resource.RUSAGE_SELF)[:2]
232 return resource.getrusage(resource.RUSAGE_SELF)[:2]
233
233
234 except ImportError:
234 except ImportError:
235 clock = time.clock
235 clock = time.clock
236 def clock2():
236 def clock2():
237 """Under windows, system CPU time can't be measured.
237 """Under windows, system CPU time can't be measured.
238
238
239 This just returns clock() and zero."""
239 This just returns clock() and zero."""
240 return time.clock(),0.0
240 return time.clock(),0.0
241
241
242 def timings_out(reps,func,*args,**kw):
242 def timings_out(reps,func,*args,**kw):
243 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
243 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
244
244
245 Execute a function reps times, return a tuple with the elapsed total
245 Execute a function reps times, return a tuple with the elapsed total
246 CPU time in seconds, the time per call and the function's output.
246 CPU time in seconds, the time per call and the function's output.
247
247
248 Under Unix, the return value is the sum of user+system time consumed by
248 Under Unix, the return value is the sum of user+system time consumed by
249 the process, computed via the resource module. This prevents problems
249 the process, computed via the resource module. This prevents problems
250 related to the wraparound effect which the time.clock() function has.
250 related to the wraparound effect which the time.clock() function has.
251
251
252 Under Windows the return value is in wall clock seconds. See the
252 Under Windows the return value is in wall clock seconds. See the
253 documentation for the time module for more details."""
253 documentation for the time module for more details."""
254
254
255 reps = int(reps)
255 reps = int(reps)
256 assert reps >=1, 'reps must be >= 1'
256 assert reps >=1, 'reps must be >= 1'
257 if reps==1:
257 if reps==1:
258 start = clock()
258 start = clock()
259 out = func(*args,**kw)
259 out = func(*args,**kw)
260 tot_time = clock()-start
260 tot_time = clock()-start
261 else:
261 else:
262 rng = xrange(reps-1) # the last time is executed separately to store output
262 rng = xrange(reps-1) # the last time is executed separately to store output
263 start = clock()
263 start = clock()
264 for dummy in rng: func(*args,**kw)
264 for dummy in rng: func(*args,**kw)
265 out = func(*args,**kw) # one last time
265 out = func(*args,**kw) # one last time
266 tot_time = clock()-start
266 tot_time = clock()-start
267 av_time = tot_time / reps
267 av_time = tot_time / reps
268 return tot_time,av_time,out
268 return tot_time,av_time,out
269
269
270 def timings(reps,func,*args,**kw):
270 def timings(reps,func,*args,**kw):
271 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
271 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
272
272
273 Execute a function reps times, return a tuple with the elapsed total CPU
273 Execute a function reps times, return a tuple with the elapsed total CPU
274 time in seconds and the time per call. These are just the first two values
274 time in seconds and the time per call. These are just the first two values
275 in timings_out()."""
275 in timings_out()."""
276
276
277 return timings_out(reps,func,*args,**kw)[0:2]
277 return timings_out(reps,func,*args,**kw)[0:2]
278
278
279 def timing(func,*args,**kw):
279 def timing(func,*args,**kw):
280 """timing(func,*args,**kw) -> t_total
280 """timing(func,*args,**kw) -> t_total
281
281
282 Execute a function once, return the elapsed total CPU time in
282 Execute a function once, return the elapsed total CPU time in
283 seconds. This is just the first value in timings_out()."""
283 seconds. This is just the first value in timings_out()."""
284
284
285 return timings_out(1,func,*args,**kw)[0]
285 return timings_out(1,func,*args,**kw)[0]
286
286
287 #****************************************************************************
287 #****************************************************************************
288 # file and system
288 # file and system
289
289
290 def system(cmd,verbose=0,debug=0,header=''):
290 def system(cmd,verbose=0,debug=0,header=''):
291 """Execute a system command, return its exit status.
291 """Execute a system command, return its exit status.
292
292
293 Options:
293 Options:
294
294
295 - verbose (0): print the command to be executed.
295 - verbose (0): print the command to be executed.
296
296
297 - debug (0): only print, do not actually execute.
297 - debug (0): only print, do not actually execute.
298
298
299 - header (''): Header to print on screen prior to the executed command (it
299 - header (''): Header to print on screen prior to the executed command (it
300 is only prepended to the command, no newlines are added).
300 is only prepended to the command, no newlines are added).
301
301
302 Note: a stateful version of this function is available through the
302 Note: a stateful version of this function is available through the
303 SystemExec class."""
303 SystemExec class."""
304
304
305 stat = 0
305 stat = 0
306 if verbose or debug: print header+cmd
306 if verbose or debug: print header+cmd
307 sys.stdout.flush()
307 sys.stdout.flush()
308 if not debug: stat = os.system(cmd)
308 if not debug: stat = os.system(cmd)
309 return stat
309 return stat
310
310
311 # This function is used by ipython in a lot of places to make system calls.
311 # This function is used by ipython in a lot of places to make system calls.
312 # We need it to be slightly different under win32, due to the vagaries of
312 # We need it to be slightly different under win32, due to the vagaries of
313 # 'network shares'. A win32 override is below.
313 # 'network shares'. A win32 override is below.
314
314
315 def shell(cmd,verbose=0,debug=0,header=''):
315 def shell(cmd,verbose=0,debug=0,header=''):
316 """Execute a command in the system shell, always return None.
316 """Execute a command in the system shell, always return None.
317
317
318 Options:
318 Options:
319
319
320 - verbose (0): print the command to be executed.
320 - verbose (0): print the command to be executed.
321
321
322 - debug (0): only print, do not actually execute.
322 - debug (0): only print, do not actually execute.
323
323
324 - header (''): Header to print on screen prior to the executed command (it
324 - header (''): Header to print on screen prior to the executed command (it
325 is only prepended to the command, no newlines are added).
325 is only prepended to the command, no newlines are added).
326
326
327 Note: this is similar to genutils.system(), but it returns None so it can
327 Note: this is similar to genutils.system(), but it returns None so it can
328 be conveniently used in interactive loops without getting the return value
328 be conveniently used in interactive loops without getting the return value
329 (typically 0) printed many times."""
329 (typically 0) printed many times."""
330
330
331 stat = 0
331 stat = 0
332 if verbose or debug: print header+cmd
332 if verbose or debug: print header+cmd
333 # flush stdout so we don't mangle python's buffering
333 # flush stdout so we don't mangle python's buffering
334 sys.stdout.flush()
334 sys.stdout.flush()
335 if not debug:
335 if not debug:
336 os.system(cmd)
336 os.system(cmd)
337
337
338 # override shell() for win32 to deal with network shares
338 # override shell() for win32 to deal with network shares
339 if os.name in ('nt','dos'):
339 if os.name in ('nt','dos'):
340
340
341 shell_ori = shell
341 shell_ori = shell
342
342
343 def shell(cmd,verbose=0,debug=0,header=''):
343 def shell(cmd,verbose=0,debug=0,header=''):
344 if os.getcwd().startswith(r"\\"):
344 if os.getcwd().startswith(r"\\"):
345 path = os.getcwd()
345 path = os.getcwd()
346 # change to c drive (cannot be on UNC-share when issuing os.system,
346 # change to c drive (cannot be on UNC-share when issuing os.system,
347 # as cmd.exe cannot handle UNC addresses)
347 # as cmd.exe cannot handle UNC addresses)
348 os.chdir("c:")
348 os.chdir("c:")
349 # issue pushd to the UNC-share and then run the command
349 # issue pushd to the UNC-share and then run the command
350 try:
350 try:
351 shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
351 shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
352 finally:
352 finally:
353 os.chdir(path)
353 os.chdir(path)
354 else:
354 else:
355 shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
355 shell_ori(cmd,verbose,debug,header)
356
356
357 shell.__doc__ = shell_ori.__doc__
357 shell.__doc__ = shell_ori.__doc__
358
358
359 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
359 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
360 """Dummy substitute for perl's backquotes.
360 """Dummy substitute for perl's backquotes.
361
361
362 Executes a command and returns the output.
362 Executes a command and returns the output.
363
363
364 Accepts the same arguments as system(), plus:
364 Accepts the same arguments as system(), plus:
365
365
366 - split(0): if true, the output is returned as a list split on newlines.
366 - split(0): if true, the output is returned as a list split on newlines.
367
367
368 Note: a stateful version of this function is available through the
368 Note: a stateful version of this function is available through the
369 SystemExec class."""
369 SystemExec class."""
370
370
371 if verbose or debug: print header+cmd
371 if verbose or debug: print header+cmd
372 if not debug:
372 if not debug:
373 output = commands.getoutput(cmd)
373 output = commands.getoutput(cmd)
374 if split:
374 if split:
375 return output.split('\n')
375 return output.split('\n')
376 else:
376 else:
377 return output
377 return output
378
378
379 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
379 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
380 """Return (standard output,standard error) of executing cmd in a shell.
380 """Return (standard output,standard error) of executing cmd in a shell.
381
381
382 Accepts the same arguments as system(), plus:
382 Accepts the same arguments as system(), plus:
383
383
384 - split(0): if true, each of stdout/err is returned as a list split on
384 - split(0): if true, each of stdout/err is returned as a list split on
385 newlines.
385 newlines.
386
386
387 Note: a stateful version of this function is available through the
387 Note: a stateful version of this function is available through the
388 SystemExec class."""
388 SystemExec class."""
389
389
390 if verbose or debug: print header+cmd
390 if verbose or debug: print header+cmd
391 if not cmd:
391 if not cmd:
392 if split:
392 if split:
393 return [],[]
393 return [],[]
394 else:
394 else:
395 return '',''
395 return '',''
396 if not debug:
396 if not debug:
397 pin,pout,perr = os.popen3(cmd)
397 pin,pout,perr = os.popen3(cmd)
398 tout = pout.read().rstrip()
398 tout = pout.read().rstrip()
399 terr = perr.read().rstrip()
399 terr = perr.read().rstrip()
400 pin.close()
400 pin.close()
401 pout.close()
401 pout.close()
402 perr.close()
402 perr.close()
403 if split:
403 if split:
404 return tout.split('\n'),terr.split('\n')
404 return tout.split('\n'),terr.split('\n')
405 else:
405 else:
406 return tout,terr
406 return tout,terr
407
407
408 # for compatibility with older naming conventions
408 # for compatibility with older naming conventions
409 xsys = system
409 xsys = system
410 bq = getoutput
410 bq = getoutput
411
411
412 class SystemExec:
412 class SystemExec:
413 """Access the system and getoutput functions through a stateful interface.
413 """Access the system and getoutput functions through a stateful interface.
414
414
415 Note: here we refer to the system and getoutput functions from this
415 Note: here we refer to the system and getoutput functions from this
416 library, not the ones from the standard python library.
416 library, not the ones from the standard python library.
417
417
418 This class offers the system and getoutput functions as methods, but the
418 This class offers the system and getoutput functions as methods, but the
419 verbose, debug and header parameters can be set for the instance (at
419 verbose, debug and header parameters can be set for the instance (at
420 creation time or later) so that they don't need to be specified on each
420 creation time or later) so that they don't need to be specified on each
421 call.
421 call.
422
422
423 For efficiency reasons, there's no way to override the parameters on a
423 For efficiency reasons, there's no way to override the parameters on a
424 per-call basis other than by setting instance attributes. If you need
424 per-call basis other than by setting instance attributes. If you need
425 local overrides, it's best to directly call system() or getoutput().
425 local overrides, it's best to directly call system() or getoutput().
426
426
427 The following names are provided as alternate options:
427 The following names are provided as alternate options:
428 - xsys: alias to system
428 - xsys: alias to system
429 - bq: alias to getoutput
429 - bq: alias to getoutput
430
430
431 An instance can then be created as:
431 An instance can then be created as:
432 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
432 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
433
433
434 And used as:
434 And used as:
435 >>> sysexec.xsys('pwd')
435 >>> sysexec.xsys('pwd')
436 >>> dirlist = sysexec.bq('ls -l')
436 >>> dirlist = sysexec.bq('ls -l')
437 """
437 """
438
438
439 def __init__(self,verbose=0,debug=0,header='',split=0):
439 def __init__(self,verbose=0,debug=0,header='',split=0):
440 """Specify the instance's values for verbose, debug and header."""
440 """Specify the instance's values for verbose, debug and header."""
441 setattr_list(self,'verbose debug header split')
441 setattr_list(self,'verbose debug header split')
442
442
443 def system(self,cmd):
443 def system(self,cmd):
444 """Stateful interface to system(), with the same keyword parameters."""
444 """Stateful interface to system(), with the same keyword parameters."""
445
445
446 system(cmd,self.verbose,self.debug,self.header)
446 system(cmd,self.verbose,self.debug,self.header)
447
447
448 def shell(self,cmd):
448 def shell(self,cmd):
449 """Stateful interface to shell(), with the same keyword parameters."""
449 """Stateful interface to shell(), with the same keyword parameters."""
450
450
451 shell(cmd,self.verbose,self.debug,self.header)
451 shell(cmd,self.verbose,self.debug,self.header)
452
452
453 xsys = system # alias
453 xsys = system # alias
454
454
455 def getoutput(self,cmd):
455 def getoutput(self,cmd):
456 """Stateful interface to getoutput()."""
456 """Stateful interface to getoutput()."""
457
457
458 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
458 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
459
459
460 def getoutputerror(self,cmd):
460 def getoutputerror(self,cmd):
461 """Stateful interface to getoutputerror()."""
461 """Stateful interface to getoutputerror()."""
462
462
463 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
463 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
464
464
465 bq = getoutput # alias
465 bq = getoutput # alias
466
466
467 #-----------------------------------------------------------------------------
467 #-----------------------------------------------------------------------------
468 def mutex_opts(dict,ex_op):
468 def mutex_opts(dict,ex_op):
469 """Check for presence of mutually exclusive keys in a dict.
469 """Check for presence of mutually exclusive keys in a dict.
470
470
471 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
471 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
472 for op1,op2 in ex_op:
472 for op1,op2 in ex_op:
473 if op1 in dict and op2 in dict:
473 if op1 in dict and op2 in dict:
474 raise ValueError,'\n*** ERROR in Arguments *** '\
474 raise ValueError,'\n*** ERROR in Arguments *** '\
475 'Options '+op1+' and '+op2+' are mutually exclusive.'
475 'Options '+op1+' and '+op2+' are mutually exclusive.'
476
476
477 #-----------------------------------------------------------------------------
477 #-----------------------------------------------------------------------------
478 def get_py_filename(name):
478 def get_py_filename(name):
479 """Return a valid python filename in the current directory.
479 """Return a valid python filename in the current directory.
480
480
481 If the given name is not a file, it adds '.py' and searches again.
481 If the given name is not a file, it adds '.py' and searches again.
482 Raises IOError with an informative message if the file isn't found."""
482 Raises IOError with an informative message if the file isn't found."""
483
483
484 name = os.path.expanduser(name)
484 name = os.path.expanduser(name)
485 if not os.path.isfile(name) and not name.endswith('.py'):
485 if not os.path.isfile(name) and not name.endswith('.py'):
486 name += '.py'
486 name += '.py'
487 if os.path.isfile(name):
487 if os.path.isfile(name):
488 return name
488 return name
489 else:
489 else:
490 raise IOError,'File `%s` not found.' % name
490 raise IOError,'File `%s` not found.' % name
491
491
492 #-----------------------------------------------------------------------------
492 #-----------------------------------------------------------------------------
493 def filefind(fname,alt_dirs = None):
493 def filefind(fname,alt_dirs = None):
494 """Return the given filename either in the current directory, if it
494 """Return the given filename either in the current directory, if it
495 exists, or in a specified list of directories.
495 exists, or in a specified list of directories.
496
496
497 ~ expansion is done on all file and directory names.
497 ~ expansion is done on all file and directory names.
498
498
499 Upon an unsuccessful search, raise an IOError exception."""
499 Upon an unsuccessful search, raise an IOError exception."""
500
500
501 if alt_dirs is None:
501 if alt_dirs is None:
502 try:
502 try:
503 alt_dirs = get_home_dir()
503 alt_dirs = get_home_dir()
504 except HomeDirError:
504 except HomeDirError:
505 alt_dirs = os.getcwd()
505 alt_dirs = os.getcwd()
506 search = [fname] + list_strings(alt_dirs)
506 search = [fname] + list_strings(alt_dirs)
507 search = map(os.path.expanduser,search)
507 search = map(os.path.expanduser,search)
508 #print 'search list for',fname,'list:',search # dbg
508 #print 'search list for',fname,'list:',search # dbg
509 fname = search[0]
509 fname = search[0]
510 if os.path.isfile(fname):
510 if os.path.isfile(fname):
511 return fname
511 return fname
512 for direc in search[1:]:
512 for direc in search[1:]:
513 testname = os.path.join(direc,fname)
513 testname = os.path.join(direc,fname)
514 #print 'testname',testname # dbg
514 #print 'testname',testname # dbg
515 if os.path.isfile(testname):
515 if os.path.isfile(testname):
516 return testname
516 return testname
517 raise IOError,'File' + `fname` + \
517 raise IOError,'File' + `fname` + \
518 ' not found in current or supplied directories:' + `alt_dirs`
518 ' not found in current or supplied directories:' + `alt_dirs`
519
519
520 #----------------------------------------------------------------------------
520 #----------------------------------------------------------------------------
521 def file_read(filename):
521 def file_read(filename):
522 """Read a file and close it. Returns the file source."""
522 """Read a file and close it. Returns the file source."""
523 fobj=open(filename,'r');
523 fobj=open(filename,'r');
524 source = fobj.read();
524 source = fobj.read();
525 fobj.close()
525 fobj.close()
526 return source
526 return source
527
527
528 #----------------------------------------------------------------------------
528 #----------------------------------------------------------------------------
529 def target_outdated(target,deps):
529 def target_outdated(target,deps):
530 """Determine whether a target is out of date.
530 """Determine whether a target is out of date.
531
531
532 target_outdated(target,deps) -> 1/0
532 target_outdated(target,deps) -> 1/0
533
533
534 deps: list of filenames which MUST exist.
534 deps: list of filenames which MUST exist.
535 target: single filename which may or may not exist.
535 target: single filename which may or may not exist.
536
536
537 If target doesn't exist or is older than any file listed in deps, return
537 If target doesn't exist or is older than any file listed in deps, return
538 true, otherwise return false.
538 true, otherwise return false.
539 """
539 """
540 try:
540 try:
541 target_time = os.path.getmtime(target)
541 target_time = os.path.getmtime(target)
542 except os.error:
542 except os.error:
543 return 1
543 return 1
544 for dep in deps:
544 for dep in deps:
545 dep_time = os.path.getmtime(dep)
545 dep_time = os.path.getmtime(dep)
546 if dep_time > target_time:
546 if dep_time > target_time:
547 #print "For target",target,"Dep failed:",dep # dbg
547 #print "For target",target,"Dep failed:",dep # dbg
548 #print "times (dep,tar):",dep_time,target_time # dbg
548 #print "times (dep,tar):",dep_time,target_time # dbg
549 return 1
549 return 1
550 return 0
550 return 0
551
551
552 #-----------------------------------------------------------------------------
552 #-----------------------------------------------------------------------------
553 def target_update(target,deps,cmd):
553 def target_update(target,deps,cmd):
554 """Update a target with a given command given a list of dependencies.
554 """Update a target with a given command given a list of dependencies.
555
555
556 target_update(target,deps,cmd) -> runs cmd if target is outdated.
556 target_update(target,deps,cmd) -> runs cmd if target is outdated.
557
557
558 This is just a wrapper around target_outdated() which calls the given
558 This is just a wrapper around target_outdated() which calls the given
559 command if target is outdated."""
559 command if target is outdated."""
560
560
561 if target_outdated(target,deps):
561 if target_outdated(target,deps):
562 xsys(cmd)
562 xsys(cmd)
563
563
564 #----------------------------------------------------------------------------
564 #----------------------------------------------------------------------------
565 def unquote_ends(istr):
565 def unquote_ends(istr):
566 """Remove a single pair of quotes from the endpoints of a string."""
566 """Remove a single pair of quotes from the endpoints of a string."""
567
567
568 if not istr:
568 if not istr:
569 return istr
569 return istr
570 if (istr[0]=="'" and istr[-1]=="'") or \
570 if (istr[0]=="'" and istr[-1]=="'") or \
571 (istr[0]=='"' and istr[-1]=='"'):
571 (istr[0]=='"' and istr[-1]=='"'):
572 return istr[1:-1]
572 return istr[1:-1]
573 else:
573 else:
574 return istr
574 return istr
575
575
576 #----------------------------------------------------------------------------
576 #----------------------------------------------------------------------------
577 def process_cmdline(argv,names=[],defaults={},usage=''):
577 def process_cmdline(argv,names=[],defaults={},usage=''):
578 """ Process command-line options and arguments.
578 """ Process command-line options and arguments.
579
579
580 Arguments:
580 Arguments:
581
581
582 - argv: list of arguments, typically sys.argv.
582 - argv: list of arguments, typically sys.argv.
583
583
584 - names: list of option names. See DPyGetOpt docs for details on options
584 - names: list of option names. See DPyGetOpt docs for details on options
585 syntax.
585 syntax.
586
586
587 - defaults: dict of default values.
587 - defaults: dict of default values.
588
588
589 - usage: optional usage notice to print if a wrong argument is passed.
589 - usage: optional usage notice to print if a wrong argument is passed.
590
590
591 Return a dict of options and a list of free arguments."""
591 Return a dict of options and a list of free arguments."""
592
592
593 getopt = DPyGetOpt.DPyGetOpt()
593 getopt = DPyGetOpt.DPyGetOpt()
594 getopt.setIgnoreCase(0)
594 getopt.setIgnoreCase(0)
595 getopt.parseConfiguration(names)
595 getopt.parseConfiguration(names)
596
596
597 try:
597 try:
598 getopt.processArguments(argv)
598 getopt.processArguments(argv)
599 except:
599 except:
600 print usage
600 print usage
601 warn(`sys.exc_value`,level=4)
601 warn(`sys.exc_value`,level=4)
602
602
603 defaults.update(getopt.optionValues)
603 defaults.update(getopt.optionValues)
604 args = getopt.freeValues
604 args = getopt.freeValues
605
605
606 return defaults,args
606 return defaults,args
607
607
608 #----------------------------------------------------------------------------
608 #----------------------------------------------------------------------------
609 def optstr2types(ostr):
609 def optstr2types(ostr):
610 """Convert a string of option names to a dict of type mappings.
610 """Convert a string of option names to a dict of type mappings.
611
611
612 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
612 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
613
613
614 This is used to get the types of all the options in a string formatted
614 This is used to get the types of all the options in a string formatted
615 with the conventions of DPyGetOpt. The 'type' None is used for options
615 with the conventions of DPyGetOpt. The 'type' None is used for options
616 which are strings (they need no further conversion). This function's main
616 which are strings (they need no further conversion). This function's main
617 use is to get a typemap for use with read_dict().
617 use is to get a typemap for use with read_dict().
618 """
618 """
619
619
620 typeconv = {None:'',int:'',float:''}
620 typeconv = {None:'',int:'',float:''}
621 typemap = {'s':None,'i':int,'f':float}
621 typemap = {'s':None,'i':int,'f':float}
622 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
622 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
623
623
624 for w in ostr.split():
624 for w in ostr.split():
625 oname,alias,otype = opt_re.match(w).groups()
625 oname,alias,otype = opt_re.match(w).groups()
626 if otype == '' or alias == '!': # simple switches are integers too
626 if otype == '' or alias == '!': # simple switches are integers too
627 otype = 'i'
627 otype = 'i'
628 typeconv[typemap[otype]] += oname + ' '
628 typeconv[typemap[otype]] += oname + ' '
629 return typeconv
629 return typeconv
630
630
631 #----------------------------------------------------------------------------
631 #----------------------------------------------------------------------------
632 def read_dict(filename,type_conv=None,**opt):
632 def read_dict(filename,type_conv=None,**opt):
633
633
634 """Read a dictionary of key=value pairs from an input file, optionally
634 """Read a dictionary of key=value pairs from an input file, optionally
635 performing conversions on the resulting values.
635 performing conversions on the resulting values.
636
636
637 read_dict(filename,type_conv,**opt) -> dict
637 read_dict(filename,type_conv,**opt) -> dict
638
638
639 Only one value per line is accepted, the format should be
639 Only one value per line is accepted, the format should be
640 # optional comments are ignored
640 # optional comments are ignored
641 key value\n
641 key value\n
642
642
643 Args:
643 Args:
644
644
645 - type_conv: A dictionary specifying which keys need to be converted to
645 - type_conv: A dictionary specifying which keys need to be converted to
646 which types. By default all keys are read as strings. This dictionary
646 which types. By default all keys are read as strings. This dictionary
647 should have as its keys valid conversion functions for strings
647 should have as its keys valid conversion functions for strings
648 (int,long,float,complex, or your own). The value for each key
648 (int,long,float,complex, or your own). The value for each key
649 (converter) should be a whitespace separated string containing the names
649 (converter) should be a whitespace separated string containing the names
650 of all the entries in the file to be converted using that function. For
650 of all the entries in the file to be converted using that function. For
651 keys to be left alone, use None as the conversion function (only needed
651 keys to be left alone, use None as the conversion function (only needed
652 with purge=1, see below).
652 with purge=1, see below).
653
653
654 - opt: dictionary with extra options as below (default in parens)
654 - opt: dictionary with extra options as below (default in parens)
655
655
656 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
656 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
657 of the dictionary to be returned. If purge is going to be used, the
657 of the dictionary to be returned. If purge is going to be used, the
658 set of keys to be left as strings also has to be explicitly specified
658 set of keys to be left as strings also has to be explicitly specified
659 using the (non-existent) conversion function None.
659 using the (non-existent) conversion function None.
660
660
661 fs(None): field separator. This is the key/value separator to be used
661 fs(None): field separator. This is the key/value separator to be used
662 when parsing the file. The None default means any whitespace [behavior
662 when parsing the file. The None default means any whitespace [behavior
663 of string.split()].
663 of string.split()].
664
664
665 strip(0): if 1, strip string values of leading/trailinig whitespace.
665 strip(0): if 1, strip string values of leading/trailinig whitespace.
666
666
667 warn(1): warning level if requested keys are not found in file.
667 warn(1): warning level if requested keys are not found in file.
668 - 0: silently ignore.
668 - 0: silently ignore.
669 - 1: inform but proceed.
669 - 1: inform but proceed.
670 - 2: raise KeyError exception.
670 - 2: raise KeyError exception.
671
671
672 no_empty(0): if 1, remove keys with whitespace strings as a value.
672 no_empty(0): if 1, remove keys with whitespace strings as a value.
673
673
674 unique([]): list of keys (or space separated string) which can't be
674 unique([]): list of keys (or space separated string) which can't be
675 repeated. If one such key is found in the file, each new instance
675 repeated. If one such key is found in the file, each new instance
676 overwrites the previous one. For keys not listed here, the behavior is
676 overwrites the previous one. For keys not listed here, the behavior is
677 to make a list of all appearances.
677 to make a list of all appearances.
678
678
679 Example:
679 Example:
680 If the input file test.ini has:
680 If the input file test.ini has:
681 i 3
681 i 3
682 x 4.5
682 x 4.5
683 y 5.5
683 y 5.5
684 s hi ho
684 s hi ho
685 Then:
685 Then:
686
686
687 >>> type_conv={int:'i',float:'x',None:'s'}
687 >>> type_conv={int:'i',float:'x',None:'s'}
688 >>> read_dict('test.ini')
688 >>> read_dict('test.ini')
689 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
689 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
690 >>> read_dict('test.ini',type_conv)
690 >>> read_dict('test.ini',type_conv)
691 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
691 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
692 >>> read_dict('test.ini',type_conv,purge=1)
692 >>> read_dict('test.ini',type_conv,purge=1)
693 {'i': 3, 's': 'hi ho', 'x': 4.5}
693 {'i': 3, 's': 'hi ho', 'x': 4.5}
694 """
694 """
695
695
696 # starting config
696 # starting config
697 opt.setdefault('purge',0)
697 opt.setdefault('purge',0)
698 opt.setdefault('fs',None) # field sep defaults to any whitespace
698 opt.setdefault('fs',None) # field sep defaults to any whitespace
699 opt.setdefault('strip',0)
699 opt.setdefault('strip',0)
700 opt.setdefault('warn',1)
700 opt.setdefault('warn',1)
701 opt.setdefault('no_empty',0)
701 opt.setdefault('no_empty',0)
702 opt.setdefault('unique','')
702 opt.setdefault('unique','')
703 if type(opt['unique']) in StringTypes:
703 if type(opt['unique']) in StringTypes:
704 unique_keys = qw(opt['unique'])
704 unique_keys = qw(opt['unique'])
705 elif type(opt['unique']) in (types.TupleType,types.ListType):
705 elif type(opt['unique']) in (types.TupleType,types.ListType):
706 unique_keys = opt['unique']
706 unique_keys = opt['unique']
707 else:
707 else:
708 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
708 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
709
709
710 dict = {}
710 dict = {}
711 # first read in table of values as strings
711 # first read in table of values as strings
712 file = open(filename,'r')
712 file = open(filename,'r')
713 for line in file.readlines():
713 for line in file.readlines():
714 line = line.strip()
714 line = line.strip()
715 if len(line) and line[0]=='#': continue
715 if len(line) and line[0]=='#': continue
716 if len(line)>0:
716 if len(line)>0:
717 lsplit = line.split(opt['fs'],1)
717 lsplit = line.split(opt['fs'],1)
718 try:
718 try:
719 key,val = lsplit
719 key,val = lsplit
720 except ValueError:
720 except ValueError:
721 key,val = lsplit[0],''
721 key,val = lsplit[0],''
722 key = key.strip()
722 key = key.strip()
723 if opt['strip']: val = val.strip()
723 if opt['strip']: val = val.strip()
724 if val == "''" or val == '""': val = ''
724 if val == "''" or val == '""': val = ''
725 if opt['no_empty'] and (val=='' or val.isspace()):
725 if opt['no_empty'] and (val=='' or val.isspace()):
726 continue
726 continue
727 # if a key is found more than once in the file, build a list
727 # if a key is found more than once in the file, build a list
728 # unless it's in the 'unique' list. In that case, last found in file
728 # unless it's in the 'unique' list. In that case, last found in file
729 # takes precedence. User beware.
729 # takes precedence. User beware.
730 try:
730 try:
731 if dict[key] and key in unique_keys:
731 if dict[key] and key in unique_keys:
732 dict[key] = val
732 dict[key] = val
733 elif type(dict[key]) is types.ListType:
733 elif type(dict[key]) is types.ListType:
734 dict[key].append(val)
734 dict[key].append(val)
735 else:
735 else:
736 dict[key] = [dict[key],val]
736 dict[key] = [dict[key],val]
737 except KeyError:
737 except KeyError:
738 dict[key] = val
738 dict[key] = val
739 # purge if requested
739 # purge if requested
740 if opt['purge']:
740 if opt['purge']:
741 accepted_keys = qwflat(type_conv.values())
741 accepted_keys = qwflat(type_conv.values())
742 for key in dict.keys():
742 for key in dict.keys():
743 if key in accepted_keys: continue
743 if key in accepted_keys: continue
744 del(dict[key])
744 del(dict[key])
745 # now convert if requested
745 # now convert if requested
746 if type_conv==None: return dict
746 if type_conv==None: return dict
747 conversions = type_conv.keys()
747 conversions = type_conv.keys()
748 try: conversions.remove(None)
748 try: conversions.remove(None)
749 except: pass
749 except: pass
750 for convert in conversions:
750 for convert in conversions:
751 for val in qw(type_conv[convert]):
751 for val in qw(type_conv[convert]):
752 try:
752 try:
753 dict[val] = convert(dict[val])
753 dict[val] = convert(dict[val])
754 except KeyError,e:
754 except KeyError,e:
755 if opt['warn'] == 0:
755 if opt['warn'] == 0:
756 pass
756 pass
757 elif opt['warn'] == 1:
757 elif opt['warn'] == 1:
758 print >>sys.stderr, 'Warning: key',val,\
758 print >>sys.stderr, 'Warning: key',val,\
759 'not found in file',filename
759 'not found in file',filename
760 elif opt['warn'] == 2:
760 elif opt['warn'] == 2:
761 raise KeyError,e
761 raise KeyError,e
762 else:
762 else:
763 raise ValueError,'Warning level must be 0,1 or 2'
763 raise ValueError,'Warning level must be 0,1 or 2'
764
764
765 return dict
765 return dict
766
766
767 #----------------------------------------------------------------------------
767 #----------------------------------------------------------------------------
768 def flag_calls(func):
768 def flag_calls(func):
769 """Wrap a function to detect and flag when it gets called.
769 """Wrap a function to detect and flag when it gets called.
770
770
771 This is a decorator which takes a function and wraps it in a function with
771 This is a decorator which takes a function and wraps it in a function with
772 a 'called' attribute. wrapper.called is initialized to False.
772 a 'called' attribute. wrapper.called is initialized to False.
773
773
774 The wrapper.called attribute is set to False right before each call to the
774 The wrapper.called attribute is set to False right before each call to the
775 wrapped function, so if the call fails it remains False. After the call
775 wrapped function, so if the call fails it remains False. After the call
776 completes, wrapper.called is set to True and the output is returned.
776 completes, wrapper.called is set to True and the output is returned.
777
777
778 Testing for truth in wrapper.called allows you to determine if a call to
778 Testing for truth in wrapper.called allows you to determine if a call to
779 func() was attempted and succeeded."""
779 func() was attempted and succeeded."""
780
780
781 def wrapper(*args,**kw):
781 def wrapper(*args,**kw):
782 wrapper.called = False
782 wrapper.called = False
783 out = func(*args,**kw)
783 out = func(*args,**kw)
784 wrapper.called = True
784 wrapper.called = True
785 return out
785 return out
786
786
787 wrapper.called = False
787 wrapper.called = False
788 wrapper.__doc__ = func.__doc__
788 wrapper.__doc__ = func.__doc__
789 return wrapper
789 return wrapper
790
790
791 #----------------------------------------------------------------------------
791 #----------------------------------------------------------------------------
792 class HomeDirError(Error):
792 class HomeDirError(Error):
793 pass
793 pass
794
794
795 def get_home_dir():
795 def get_home_dir():
796 """Return the closest possible equivalent to a 'home' directory.
796 """Return the closest possible equivalent to a 'home' directory.
797
797
798 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
798 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
799
799
800 Currently only Posix and NT are implemented, a HomeDirError exception is
800 Currently only Posix and NT are implemented, a HomeDirError exception is
801 raised for all other OSes. """
801 raised for all other OSes. """
802
802
803 isdir = os.path.isdir
803 isdir = os.path.isdir
804 env = os.environ
804 env = os.environ
805 try:
805 try:
806 homedir = env['HOME']
806 homedir = env['HOME']
807 if not isdir(homedir):
807 if not isdir(homedir):
808 # in case a user stuck some string which does NOT resolve to a
808 # in case a user stuck some string which does NOT resolve to a
809 # valid path, it's as good as if we hadn't foud it
809 # valid path, it's as good as if we hadn't foud it
810 raise KeyError
810 raise KeyError
811 return homedir
811 return homedir
812 except KeyError:
812 except KeyError:
813 if os.name == 'posix':
813 if os.name == 'posix':
814 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
814 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
815 elif os.name == 'nt':
815 elif os.name == 'nt':
816 # For some strange reason, win9x returns 'nt' for os.name.
816 # For some strange reason, win9x returns 'nt' for os.name.
817 try:
817 try:
818 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
818 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
819 if not isdir(homedir):
819 if not isdir(homedir):
820 homedir = os.path.join(env['USERPROFILE'])
820 homedir = os.path.join(env['USERPROFILE'])
821 if not isdir(homedir):
821 if not isdir(homedir):
822 raise HomeDirError
822 raise HomeDirError
823 return homedir
823 return homedir
824 except:
824 except:
825 try:
825 try:
826 # Use the registry to get the 'My Documents' folder.
826 # Use the registry to get the 'My Documents' folder.
827 import _winreg as wreg
827 import _winreg as wreg
828 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
828 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
829 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
829 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
830 homedir = wreg.QueryValueEx(key,'Personal')[0]
830 homedir = wreg.QueryValueEx(key,'Personal')[0]
831 key.Close()
831 key.Close()
832 if not isdir(homedir):
832 if not isdir(homedir):
833 e = ('Invalid "Personal" folder registry key '
833 e = ('Invalid "Personal" folder registry key '
834 'typically "My Documents".\n'
834 'typically "My Documents".\n'
835 'Value: %s\n'
835 'Value: %s\n'
836 'This is not a valid directory on your system.' %
836 'This is not a valid directory on your system.' %
837 homedir)
837 homedir)
838 raise HomeDirError(e)
838 raise HomeDirError(e)
839 return homedir
839 return homedir
840 except HomeDirError:
840 except HomeDirError:
841 raise
841 raise
842 except:
842 except:
843 return 'C:\\'
843 return 'C:\\'
844 elif os.name == 'dos':
844 elif os.name == 'dos':
845 # Desperate, may do absurd things in classic MacOS. May work under DOS.
845 # Desperate, may do absurd things in classic MacOS. May work under DOS.
846 return 'C:\\'
846 return 'C:\\'
847 else:
847 else:
848 raise HomeDirError,'support for your operating system not implemented.'
848 raise HomeDirError,'support for your operating system not implemented.'
849
849
850 #****************************************************************************
850 #****************************************************************************
851 # strings and text
851 # strings and text
852
852
853 class LSString(str):
853 class LSString(str):
854 """String derivative with a special access attributes.
854 """String derivative with a special access attributes.
855
855
856 These are normal strings, but with the special attributes:
856 These are normal strings, but with the special attributes:
857
857
858 .l (or .list) : value as list (split on newlines).
858 .l (or .list) : value as list (split on newlines).
859 .n (or .nlstr): original value (the string itself).
859 .n (or .nlstr): original value (the string itself).
860 .s (or .spstr): value as whitespace-separated string.
860 .s (or .spstr): value as whitespace-separated string.
861
861
862 Any values which require transformations are computed only once and
862 Any values which require transformations are computed only once and
863 cached.
863 cached.
864
864
865 Such strings are very useful to efficiently interact with the shell, which
865 Such strings are very useful to efficiently interact with the shell, which
866 typically only understands whitespace-separated options for commands."""
866 typically only understands whitespace-separated options for commands."""
867
867
868 def get_list(self):
868 def get_list(self):
869 try:
869 try:
870 return self.__list
870 return self.__list
871 except AttributeError:
871 except AttributeError:
872 self.__list = self.split('\n')
872 self.__list = self.split('\n')
873 return self.__list
873 return self.__list
874
874
875 l = list = property(get_list)
875 l = list = property(get_list)
876
876
877 def get_spstr(self):
877 def get_spstr(self):
878 try:
878 try:
879 return self.__spstr
879 return self.__spstr
880 except AttributeError:
880 except AttributeError:
881 self.__spstr = self.replace('\n',' ')
881 self.__spstr = self.replace('\n',' ')
882 return self.__spstr
882 return self.__spstr
883
883
884 s = spstr = property(get_spstr)
884 s = spstr = property(get_spstr)
885
885
886 def get_nlstr(self):
886 def get_nlstr(self):
887 return self
887 return self
888
888
889 n = nlstr = property(get_nlstr)
889 n = nlstr = property(get_nlstr)
890
890
891 #----------------------------------------------------------------------------
891 #----------------------------------------------------------------------------
892 class SList(list):
892 class SList(list):
893 """List derivative with a special access attributes.
893 """List derivative with a special access attributes.
894
894
895 These are normal lists, but with the special attributes:
895 These are normal lists, but with the special attributes:
896
896
897 .l (or .list) : value as list (the list itself).
897 .l (or .list) : value as list (the list itself).
898 .n (or .nlstr): value as a string, joined on newlines.
898 .n (or .nlstr): value as a string, joined on newlines.
899 .s (or .spstr): value as a string, joined on spaces.
899 .s (or .spstr): value as a string, joined on spaces.
900
900
901 Any values which require transformations are computed only once and
901 Any values which require transformations are computed only once and
902 cached."""
902 cached."""
903
903
904 def get_list(self):
904 def get_list(self):
905 return self
905 return self
906
906
907 l = list = property(get_list)
907 l = list = property(get_list)
908
908
909 def get_spstr(self):
909 def get_spstr(self):
910 try:
910 try:
911 return self.__spstr
911 return self.__spstr
912 except AttributeError:
912 except AttributeError:
913 self.__spstr = ' '.join(self)
913 self.__spstr = ' '.join(self)
914 return self.__spstr
914 return self.__spstr
915
915
916 s = spstr = property(get_spstr)
916 s = spstr = property(get_spstr)
917
917
918 def get_nlstr(self):
918 def get_nlstr(self):
919 try:
919 try:
920 return self.__nlstr
920 return self.__nlstr
921 except AttributeError:
921 except AttributeError:
922 self.__nlstr = '\n'.join(self)
922 self.__nlstr = '\n'.join(self)
923 return self.__nlstr
923 return self.__nlstr
924
924
925 n = nlstr = property(get_nlstr)
925 n = nlstr = property(get_nlstr)
926
926
927 #----------------------------------------------------------------------------
927 #----------------------------------------------------------------------------
928 # This can be replaced with an isspace() call once we drop 2.2 compatibility
928 # This can be replaced with an isspace() call once we drop 2.2 compatibility
929 _isspace_match = re.compile(r'^\s+$').match
929 _isspace_match = re.compile(r'^\s+$').match
930 def isspace(s):
930 def isspace(s):
931 return bool(_isspace_match(s))
931 return bool(_isspace_match(s))
932
932
933 #----------------------------------------------------------------------------
933 #----------------------------------------------------------------------------
934 def esc_quotes(strng):
934 def esc_quotes(strng):
935 """Return the input string with single and double quotes escaped out"""
935 """Return the input string with single and double quotes escaped out"""
936
936
937 return strng.replace('"','\\"').replace("'","\\'")
937 return strng.replace('"','\\"').replace("'","\\'")
938
938
939 #----------------------------------------------------------------------------
939 #----------------------------------------------------------------------------
940 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
940 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
941 """Take multiple lines of input.
941 """Take multiple lines of input.
942
942
943 A list with each line of input as a separate element is returned when a
943 A list with each line of input as a separate element is returned when a
944 termination string is entered (defaults to a single '.'). Input can also
944 termination string is entered (defaults to a single '.'). Input can also
945 terminate via EOF (^D in Unix, ^Z-RET in Windows).
945 terminate via EOF (^D in Unix, ^Z-RET in Windows).
946
946
947 Lines of input which end in \\ are joined into single entries (and a
947 Lines of input which end in \\ are joined into single entries (and a
948 secondary continuation prompt is issued as long as the user terminates
948 secondary continuation prompt is issued as long as the user terminates
949 lines with \\). This allows entering very long strings which are still
949 lines with \\). This allows entering very long strings which are still
950 meant to be treated as single entities.
950 meant to be treated as single entities.
951 """
951 """
952
952
953 try:
953 try:
954 if header:
954 if header:
955 header += '\n'
955 header += '\n'
956 lines = [raw_input(header + ps1)]
956 lines = [raw_input(header + ps1)]
957 except EOFError:
957 except EOFError:
958 return []
958 return []
959 terminate = [terminate_str]
959 terminate = [terminate_str]
960 try:
960 try:
961 while lines[-1:] != terminate:
961 while lines[-1:] != terminate:
962 new_line = raw_input(ps1)
962 new_line = raw_input(ps1)
963 while new_line.endswith('\\'):
963 while new_line.endswith('\\'):
964 new_line = new_line[:-1] + raw_input(ps2)
964 new_line = new_line[:-1] + raw_input(ps2)
965 lines.append(new_line)
965 lines.append(new_line)
966
966
967 return lines[:-1] # don't return the termination command
967 return lines[:-1] # don't return the termination command
968 except EOFError:
968 except EOFError:
969 print
969 print
970 return lines
970 return lines
971
971
972 #----------------------------------------------------------------------------
972 #----------------------------------------------------------------------------
973 def raw_input_ext(prompt='', ps2='... '):
973 def raw_input_ext(prompt='', ps2='... '):
974 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
974 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
975
975
976 line = raw_input(prompt)
976 line = raw_input(prompt)
977 while line.endswith('\\'):
977 while line.endswith('\\'):
978 line = line[:-1] + raw_input(ps2)
978 line = line[:-1] + raw_input(ps2)
979 return line
979 return line
980
980
981 #----------------------------------------------------------------------------
981 #----------------------------------------------------------------------------
982 def ask_yes_no(prompt,default=None):
982 def ask_yes_no(prompt,default=None):
983 """Asks a question and returns an integer 1/0 (y/n) answer.
983 """Asks a question and returns an integer 1/0 (y/n) answer.
984
984
985 If default is given (one of 'y','n'), it is used if the user input is
985 If default is given (one of 'y','n'), it is used if the user input is
986 empty. Otherwise the question is repeated until an answer is given.
986 empty. Otherwise the question is repeated until an answer is given.
987 If EOF occurs 20 times consecutively, the default answer is assumed,
987 If EOF occurs 20 times consecutively, the default answer is assumed,
988 or if there is no default, an exception is raised to prevent infinite
988 or if there is no default, an exception is raised to prevent infinite
989 loops.
989 loops.
990
990
991 Valid answers are: y/yes/n/no (match is not case sensitive)."""
991 Valid answers are: y/yes/n/no (match is not case sensitive)."""
992
992
993 answers = {'y':True,'n':False,'yes':True,'no':False}
993 answers = {'y':True,'n':False,'yes':True,'no':False}
994 ans = None
994 ans = None
995 eofs, max_eofs = 0, 20
995 eofs, max_eofs = 0, 20
996 while ans not in answers.keys():
996 while ans not in answers.keys():
997 try:
997 try:
998 ans = raw_input(prompt+' ').lower()
998 ans = raw_input(prompt+' ').lower()
999 if not ans: # response was an empty string
999 if not ans: # response was an empty string
1000 ans = default
1000 ans = default
1001 eofs = 0
1001 eofs = 0
1002 except (EOFError,KeyboardInterrupt):
1002 except (EOFError,KeyboardInterrupt):
1003 eofs = eofs + 1
1003 eofs = eofs + 1
1004 if eofs >= max_eofs:
1004 if eofs >= max_eofs:
1005 if default in answers.keys():
1005 if default in answers.keys():
1006 ans = default
1006 ans = default
1007 else:
1007 else:
1008 raise
1008 raise
1009
1009
1010 return answers[ans]
1010 return answers[ans]
1011
1011
1012 #----------------------------------------------------------------------------
1012 #----------------------------------------------------------------------------
1013 def marquee(txt='',width=78,mark='*'):
1013 def marquee(txt='',width=78,mark='*'):
1014 """Return the input string centered in a 'marquee'."""
1014 """Return the input string centered in a 'marquee'."""
1015 if not txt:
1015 if not txt:
1016 return (mark*width)[:width]
1016 return (mark*width)[:width]
1017 nmark = (width-len(txt)-2)/len(mark)/2
1017 nmark = (width-len(txt)-2)/len(mark)/2
1018 if nmark < 0: nmark =0
1018 if nmark < 0: nmark =0
1019 marks = mark*nmark
1019 marks = mark*nmark
1020 return '%s %s %s' % (marks,txt,marks)
1020 return '%s %s %s' % (marks,txt,marks)
1021
1021
1022 #----------------------------------------------------------------------------
1022 #----------------------------------------------------------------------------
1023 class EvalDict:
1023 class EvalDict:
1024 """
1024 """
1025 Emulate a dict which evaluates its contents in the caller's frame.
1025 Emulate a dict which evaluates its contents in the caller's frame.
1026
1026
1027 Usage:
1027 Usage:
1028 >>>number = 19
1028 >>>number = 19
1029 >>>text = "python"
1029 >>>text = "python"
1030 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1030 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1031 """
1031 """
1032
1032
1033 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
1033 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
1034 # modified (shorter) version of:
1034 # modified (shorter) version of:
1035 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
1035 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
1036 # Skip Montanaro (skip@pobox.com).
1036 # Skip Montanaro (skip@pobox.com).
1037
1037
1038 def __getitem__(self, name):
1038 def __getitem__(self, name):
1039 frame = sys._getframe(1)
1039 frame = sys._getframe(1)
1040 return eval(name, frame.f_globals, frame.f_locals)
1040 return eval(name, frame.f_globals, frame.f_locals)
1041
1041
1042 EvalString = EvalDict # for backwards compatibility
1042 EvalString = EvalDict # for backwards compatibility
1043 #----------------------------------------------------------------------------
1043 #----------------------------------------------------------------------------
1044 def qw(words,flat=0,sep=None,maxsplit=-1):
1044 def qw(words,flat=0,sep=None,maxsplit=-1):
1045 """Similar to Perl's qw() operator, but with some more options.
1045 """Similar to Perl's qw() operator, but with some more options.
1046
1046
1047 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1047 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1048
1048
1049 words can also be a list itself, and with flat=1, the output will be
1049 words can also be a list itself, and with flat=1, the output will be
1050 recursively flattened. Examples:
1050 recursively flattened. Examples:
1051
1051
1052 >>> qw('1 2')
1052 >>> qw('1 2')
1053 ['1', '2']
1053 ['1', '2']
1054 >>> qw(['a b','1 2',['m n','p q']])
1054 >>> qw(['a b','1 2',['m n','p q']])
1055 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1055 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1056 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1056 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1057 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
1057 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
1058
1058
1059 if type(words) in StringTypes:
1059 if type(words) in StringTypes:
1060 return [word.strip() for word in words.split(sep,maxsplit)
1060 return [word.strip() for word in words.split(sep,maxsplit)
1061 if word and not word.isspace() ]
1061 if word and not word.isspace() ]
1062 if flat:
1062 if flat:
1063 return flatten(map(qw,words,[1]*len(words)))
1063 return flatten(map(qw,words,[1]*len(words)))
1064 return map(qw,words)
1064 return map(qw,words)
1065
1065
1066 #----------------------------------------------------------------------------
1066 #----------------------------------------------------------------------------
1067 def qwflat(words,sep=None,maxsplit=-1):
1067 def qwflat(words,sep=None,maxsplit=-1):
1068 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
1068 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
1069 return qw(words,1,sep,maxsplit)
1069 return qw(words,1,sep,maxsplit)
1070
1070
1071 #----------------------------------------------------------------------------
1071 #----------------------------------------------------------------------------
1072 def qw_lol(indata):
1072 def qw_lol(indata):
1073 """qw_lol('a b') -> [['a','b']],
1073 """qw_lol('a b') -> [['a','b']],
1074 otherwise it's just a call to qw().
1074 otherwise it's just a call to qw().
1075
1075
1076 We need this to make sure the modules_some keys *always* end up as a
1076 We need this to make sure the modules_some keys *always* end up as a
1077 list of lists."""
1077 list of lists."""
1078
1078
1079 if type(indata) in StringTypes:
1079 if type(indata) in StringTypes:
1080 return [qw(indata)]
1080 return [qw(indata)]
1081 else:
1081 else:
1082 return qw(indata)
1082 return qw(indata)
1083
1083
1084 #-----------------------------------------------------------------------------
1084 #-----------------------------------------------------------------------------
1085 def list_strings(arg):
1085 def list_strings(arg):
1086 """Always return a list of strings, given a string or list of strings
1086 """Always return a list of strings, given a string or list of strings
1087 as input."""
1087 as input."""
1088
1088
1089 if type(arg) in StringTypes: return [arg]
1089 if type(arg) in StringTypes: return [arg]
1090 else: return arg
1090 else: return arg
1091
1091
1092 #----------------------------------------------------------------------------
1092 #----------------------------------------------------------------------------
1093 def grep(pat,list,case=1):
1093 def grep(pat,list,case=1):
1094 """Simple minded grep-like function.
1094 """Simple minded grep-like function.
1095 grep(pat,list) returns occurrences of pat in list, None on failure.
1095 grep(pat,list) returns occurrences of pat in list, None on failure.
1096
1096
1097 It only does simple string matching, with no support for regexps. Use the
1097 It only does simple string matching, with no support for regexps. Use the
1098 option case=0 for case-insensitive matching."""
1098 option case=0 for case-insensitive matching."""
1099
1099
1100 # This is pretty crude. At least it should implement copying only references
1100 # This is pretty crude. At least it should implement copying only references
1101 # to the original data in case it's big. Now it copies the data for output.
1101 # to the original data in case it's big. Now it copies the data for output.
1102 out=[]
1102 out=[]
1103 if case:
1103 if case:
1104 for term in list:
1104 for term in list:
1105 if term.find(pat)>-1: out.append(term)
1105 if term.find(pat)>-1: out.append(term)
1106 else:
1106 else:
1107 lpat=pat.lower()
1107 lpat=pat.lower()
1108 for term in list:
1108 for term in list:
1109 if term.lower().find(lpat)>-1: out.append(term)
1109 if term.lower().find(lpat)>-1: out.append(term)
1110
1110
1111 if len(out): return out
1111 if len(out): return out
1112 else: return None
1112 else: return None
1113
1113
1114 #----------------------------------------------------------------------------
1114 #----------------------------------------------------------------------------
1115 def dgrep(pat,*opts):
1115 def dgrep(pat,*opts):
1116 """Return grep() on dir()+dir(__builtins__).
1116 """Return grep() on dir()+dir(__builtins__).
1117
1117
1118 A very common use of grep() when working interactively."""
1118 A very common use of grep() when working interactively."""
1119
1119
1120 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
1120 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
1121
1121
1122 #----------------------------------------------------------------------------
1122 #----------------------------------------------------------------------------
1123 def idgrep(pat):
1123 def idgrep(pat):
1124 """Case-insensitive dgrep()"""
1124 """Case-insensitive dgrep()"""
1125
1125
1126 return dgrep(pat,0)
1126 return dgrep(pat,0)
1127
1127
1128 #----------------------------------------------------------------------------
1128 #----------------------------------------------------------------------------
1129 def igrep(pat,list):
1129 def igrep(pat,list):
1130 """Synonym for case-insensitive grep."""
1130 """Synonym for case-insensitive grep."""
1131
1131
1132 return grep(pat,list,case=0)
1132 return grep(pat,list,case=0)
1133
1133
1134 #----------------------------------------------------------------------------
1134 #----------------------------------------------------------------------------
1135 def indent(str,nspaces=4,ntabs=0):
1135 def indent(str,nspaces=4,ntabs=0):
1136 """Indent a string a given number of spaces or tabstops.
1136 """Indent a string a given number of spaces or tabstops.
1137
1137
1138 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
1138 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
1139 """
1139 """
1140 if str is None:
1140 if str is None:
1141 return
1141 return
1142 ind = '\t'*ntabs+' '*nspaces
1142 ind = '\t'*ntabs+' '*nspaces
1143 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
1143 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
1144 if outstr.endswith(os.linesep+ind):
1144 if outstr.endswith(os.linesep+ind):
1145 return outstr[:-len(ind)]
1145 return outstr[:-len(ind)]
1146 else:
1146 else:
1147 return outstr
1147 return outstr
1148
1148
1149 #-----------------------------------------------------------------------------
1149 #-----------------------------------------------------------------------------
1150 def native_line_ends(filename,backup=1):
1150 def native_line_ends(filename,backup=1):
1151 """Convert (in-place) a file to line-ends native to the current OS.
1151 """Convert (in-place) a file to line-ends native to the current OS.
1152
1152
1153 If the optional backup argument is given as false, no backup of the
1153 If the optional backup argument is given as false, no backup of the
1154 original file is left. """
1154 original file is left. """
1155
1155
1156 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1156 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1157
1157
1158 bak_filename = filename + backup_suffixes[os.name]
1158 bak_filename = filename + backup_suffixes[os.name]
1159
1159
1160 original = open(filename).read()
1160 original = open(filename).read()
1161 shutil.copy2(filename,bak_filename)
1161 shutil.copy2(filename,bak_filename)
1162 try:
1162 try:
1163 new = open(filename,'wb')
1163 new = open(filename,'wb')
1164 new.write(os.linesep.join(original.splitlines()))
1164 new.write(os.linesep.join(original.splitlines()))
1165 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1165 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1166 new.close()
1166 new.close()
1167 except:
1167 except:
1168 os.rename(bak_filename,filename)
1168 os.rename(bak_filename,filename)
1169 if not backup:
1169 if not backup:
1170 try:
1170 try:
1171 os.remove(bak_filename)
1171 os.remove(bak_filename)
1172 except:
1172 except:
1173 pass
1173 pass
1174
1174
1175 #----------------------------------------------------------------------------
1175 #----------------------------------------------------------------------------
1176 def get_pager_cmd(pager_cmd = None):
1176 def get_pager_cmd(pager_cmd = None):
1177 """Return a pager command.
1177 """Return a pager command.
1178
1178
1179 Makes some attempts at finding an OS-correct one."""
1179 Makes some attempts at finding an OS-correct one."""
1180
1180
1181 if os.name == 'posix':
1181 if os.name == 'posix':
1182 default_pager_cmd = 'less -r' # -r for color control sequences
1182 default_pager_cmd = 'less -r' # -r for color control sequences
1183 elif os.name in ['nt','dos']:
1183 elif os.name in ['nt','dos']:
1184 default_pager_cmd = 'type'
1184 default_pager_cmd = 'type'
1185
1185
1186 if pager_cmd is None:
1186 if pager_cmd is None:
1187 try:
1187 try:
1188 pager_cmd = os.environ['PAGER']
1188 pager_cmd = os.environ['PAGER']
1189 except:
1189 except:
1190 pager_cmd = default_pager_cmd
1190 pager_cmd = default_pager_cmd
1191 return pager_cmd
1191 return pager_cmd
1192
1192
1193 #-----------------------------------------------------------------------------
1193 #-----------------------------------------------------------------------------
1194 def get_pager_start(pager,start):
1194 def get_pager_start(pager,start):
1195 """Return the string for paging files with an offset.
1195 """Return the string for paging files with an offset.
1196
1196
1197 This is the '+N' argument which less and more (under Unix) accept.
1197 This is the '+N' argument which less and more (under Unix) accept.
1198 """
1198 """
1199
1199
1200 if pager in ['less','more']:
1200 if pager in ['less','more']:
1201 if start:
1201 if start:
1202 start_string = '+' + str(start)
1202 start_string = '+' + str(start)
1203 else:
1203 else:
1204 start_string = ''
1204 start_string = ''
1205 else:
1205 else:
1206 start_string = ''
1206 start_string = ''
1207 return start_string
1207 return start_string
1208
1208
1209 #----------------------------------------------------------------------------
1209 #----------------------------------------------------------------------------
1210 if os.name == "nt":
1210 if os.name == "nt":
1211 import msvcrt
1211 import msvcrt
1212 def page_more():
1212 def page_more():
1213 """ Smart pausing between pages
1213 """ Smart pausing between pages
1214
1214
1215 @return: True if need print more lines, False if quit
1215 @return: True if need print more lines, False if quit
1216 """
1216 """
1217 Term.cout.write('---Return to continue, q to quit--- ')
1217 Term.cout.write('---Return to continue, q to quit--- ')
1218 ans = msvcrt.getch()
1218 ans = msvcrt.getch()
1219 if ans in ("q", "Q"):
1219 if ans in ("q", "Q"):
1220 result = False
1220 result = False
1221 else:
1221 else:
1222 result = True
1222 result = True
1223 Term.cout.write("\b"*37 + " "*37 + "\b"*37)
1223 Term.cout.write("\b"*37 + " "*37 + "\b"*37)
1224 return result
1224 return result
1225 else:
1225 else:
1226 def page_more():
1226 def page_more():
1227 ans = raw_input('---Return to continue, q to quit--- ')
1227 ans = raw_input('---Return to continue, q to quit--- ')
1228 if ans.lower().startswith('q'):
1228 if ans.lower().startswith('q'):
1229 return False
1229 return False
1230 else:
1230 else:
1231 return True
1231 return True
1232
1232
1233 esc_re = re.compile(r"(\x1b[^m]+m)")
1233 esc_re = re.compile(r"(\x1b[^m]+m)")
1234
1234
1235 def page_dumb(strng,start=0,screen_lines=25):
1235 def page_dumb(strng,start=0,screen_lines=25):
1236 """Very dumb 'pager' in Python, for when nothing else works.
1236 """Very dumb 'pager' in Python, for when nothing else works.
1237
1237
1238 Only moves forward, same interface as page(), except for pager_cmd and
1238 Only moves forward, same interface as page(), except for pager_cmd and
1239 mode."""
1239 mode."""
1240
1240
1241 out_ln = strng.splitlines()[start:]
1241 out_ln = strng.splitlines()[start:]
1242 screens = chop(out_ln,screen_lines-1)
1242 screens = chop(out_ln,screen_lines-1)
1243 if len(screens) == 1:
1243 if len(screens) == 1:
1244 print >>Term.cout, os.linesep.join(screens[0])
1244 print >>Term.cout, os.linesep.join(screens[0])
1245 else:
1245 else:
1246 last_escape = ""
1246 last_escape = ""
1247 for scr in screens[0:-1]:
1247 for scr in screens[0:-1]:
1248 hunk = os.linesep.join(scr)
1248 hunk = os.linesep.join(scr)
1249 print >>Term.cout, last_escape + hunk
1249 print >>Term.cout, last_escape + hunk
1250 if not page_more():
1250 if not page_more():
1251 return
1251 return
1252 esc_list = esc_re.findall(hunk)
1252 esc_list = esc_re.findall(hunk)
1253 if len(esc_list) > 0:
1253 if len(esc_list) > 0:
1254 last_escape = esc_list[-1]
1254 last_escape = esc_list[-1]
1255 print >>Term.cout, last_escape + os.linesep.join(screens[-1])
1255 print >>Term.cout, last_escape + os.linesep.join(screens[-1])
1256
1256
1257 #----------------------------------------------------------------------------
1257 #----------------------------------------------------------------------------
1258 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1258 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1259 """Print a string, piping through a pager after a certain length.
1259 """Print a string, piping through a pager after a certain length.
1260
1260
1261 The screen_lines parameter specifies the number of *usable* lines of your
1261 The screen_lines parameter specifies the number of *usable* lines of your
1262 terminal screen (total lines minus lines you need to reserve to show other
1262 terminal screen (total lines minus lines you need to reserve to show other
1263 information).
1263 information).
1264
1264
1265 If you set screen_lines to a number <=0, page() will try to auto-determine
1265 If you set screen_lines to a number <=0, page() will try to auto-determine
1266 your screen size and will only use up to (screen_size+screen_lines) for
1266 your screen size and will only use up to (screen_size+screen_lines) for
1267 printing, paging after that. That is, if you want auto-detection but need
1267 printing, paging after that. That is, if you want auto-detection but need
1268 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1268 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1269 auto-detection without any lines reserved simply use screen_lines = 0.
1269 auto-detection without any lines reserved simply use screen_lines = 0.
1270
1270
1271 If a string won't fit in the allowed lines, it is sent through the
1271 If a string won't fit in the allowed lines, it is sent through the
1272 specified pager command. If none given, look for PAGER in the environment,
1272 specified pager command. If none given, look for PAGER in the environment,
1273 and ultimately default to less.
1273 and ultimately default to less.
1274
1274
1275 If no system pager works, the string is sent through a 'dumb pager'
1275 If no system pager works, the string is sent through a 'dumb pager'
1276 written in python, very simplistic.
1276 written in python, very simplistic.
1277 """
1277 """
1278
1278
1279 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1279 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1280 TERM = os.environ.get('TERM','dumb')
1280 TERM = os.environ.get('TERM','dumb')
1281 if TERM in ['dumb','emacs'] and os.name != 'nt':
1281 if TERM in ['dumb','emacs'] and os.name != 'nt':
1282 print strng
1282 print strng
1283 return
1283 return
1284 # chop off the topmost part of the string we don't want to see
1284 # chop off the topmost part of the string we don't want to see
1285 str_lines = strng.split(os.linesep)[start:]
1285 str_lines = strng.split(os.linesep)[start:]
1286 str_toprint = os.linesep.join(str_lines)
1286 str_toprint = os.linesep.join(str_lines)
1287 num_newlines = len(str_lines)
1287 num_newlines = len(str_lines)
1288 len_str = len(str_toprint)
1288 len_str = len(str_toprint)
1289
1289
1290 # Dumb heuristics to guesstimate number of on-screen lines the string
1290 # Dumb heuristics to guesstimate number of on-screen lines the string
1291 # takes. Very basic, but good enough for docstrings in reasonable
1291 # takes. Very basic, but good enough for docstrings in reasonable
1292 # terminals. If someone later feels like refining it, it's not hard.
1292 # terminals. If someone later feels like refining it, it's not hard.
1293 numlines = max(num_newlines,int(len_str/80)+1)
1293 numlines = max(num_newlines,int(len_str/80)+1)
1294
1294
1295 if os.name == "nt":
1295 if os.name == "nt":
1296 screen_lines_def = get_console_size(defaulty=25)[1]
1296 screen_lines_def = get_console_size(defaulty=25)[1]
1297 else:
1297 else:
1298 screen_lines_def = 25 # default value if we can't auto-determine
1298 screen_lines_def = 25 # default value if we can't auto-determine
1299
1299
1300 # auto-determine screen size
1300 # auto-determine screen size
1301 if screen_lines <= 0:
1301 if screen_lines <= 0:
1302 if TERM=='xterm':
1302 if TERM=='xterm':
1303 try:
1303 try:
1304 import curses
1304 import curses
1305 if hasattr(curses,'initscr'):
1305 if hasattr(curses,'initscr'):
1306 use_curses = 1
1306 use_curses = 1
1307 else:
1307 else:
1308 use_curses = 0
1308 use_curses = 0
1309 except ImportError:
1309 except ImportError:
1310 use_curses = 0
1310 use_curses = 0
1311 else:
1311 else:
1312 # curses causes problems on many terminals other than xterm.
1312 # curses causes problems on many terminals other than xterm.
1313 use_curses = 0
1313 use_curses = 0
1314 if use_curses:
1314 if use_curses:
1315 scr = curses.initscr()
1315 scr = curses.initscr()
1316 screen_lines_real,screen_cols = scr.getmaxyx()
1316 screen_lines_real,screen_cols = scr.getmaxyx()
1317 curses.endwin()
1317 curses.endwin()
1318 screen_lines += screen_lines_real
1318 screen_lines += screen_lines_real
1319 #print '***Screen size:',screen_lines_real,'lines x',\
1319 #print '***Screen size:',screen_lines_real,'lines x',\
1320 #screen_cols,'columns.' # dbg
1320 #screen_cols,'columns.' # dbg
1321 else:
1321 else:
1322 screen_lines += screen_lines_def
1322 screen_lines += screen_lines_def
1323
1323
1324 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1324 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1325 if numlines <= screen_lines :
1325 if numlines <= screen_lines :
1326 #print '*** normal print' # dbg
1326 #print '*** normal print' # dbg
1327 print >>Term.cout, str_toprint
1327 print >>Term.cout, str_toprint
1328 else:
1328 else:
1329 # Try to open pager and default to internal one if that fails.
1329 # Try to open pager and default to internal one if that fails.
1330 # All failure modes are tagged as 'retval=1', to match the return
1330 # All failure modes are tagged as 'retval=1', to match the return
1331 # value of a failed system command. If any intermediate attempt
1331 # value of a failed system command. If any intermediate attempt
1332 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1332 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1333 pager_cmd = get_pager_cmd(pager_cmd)
1333 pager_cmd = get_pager_cmd(pager_cmd)
1334 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1334 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1335 if os.name == 'nt':
1335 if os.name == 'nt':
1336 if pager_cmd.startswith('type'):
1336 if pager_cmd.startswith('type'):
1337 # The default WinXP 'type' command is failing on complex strings.
1337 # The default WinXP 'type' command is failing on complex strings.
1338 retval = 1
1338 retval = 1
1339 else:
1339 else:
1340 tmpname = tempfile.mktemp('.txt')
1340 tmpname = tempfile.mktemp('.txt')
1341 tmpfile = file(tmpname,'wt')
1341 tmpfile = file(tmpname,'wt')
1342 tmpfile.write(strng)
1342 tmpfile.write(strng)
1343 tmpfile.close()
1343 tmpfile.close()
1344 cmd = "%s < %s" % (pager_cmd,tmpname)
1344 cmd = "%s < %s" % (pager_cmd,tmpname)
1345 if os.system(cmd):
1345 if os.system(cmd):
1346 retval = 1
1346 retval = 1
1347 else:
1347 else:
1348 retval = None
1348 retval = None
1349 os.remove(tmpname)
1349 os.remove(tmpname)
1350 else:
1350 else:
1351 try:
1351 try:
1352 retval = None
1352 retval = None
1353 # if I use popen4, things hang. No idea why.
1353 # if I use popen4, things hang. No idea why.
1354 #pager,shell_out = os.popen4(pager_cmd)
1354 #pager,shell_out = os.popen4(pager_cmd)
1355 pager = os.popen(pager_cmd,'w')
1355 pager = os.popen(pager_cmd,'w')
1356 pager.write(strng)
1356 pager.write(strng)
1357 pager.close()
1357 pager.close()
1358 retval = pager.close() # success returns None
1358 retval = pager.close() # success returns None
1359 except IOError,msg: # broken pipe when user quits
1359 except IOError,msg: # broken pipe when user quits
1360 if msg.args == (32,'Broken pipe'):
1360 if msg.args == (32,'Broken pipe'):
1361 retval = None
1361 retval = None
1362 else:
1362 else:
1363 retval = 1
1363 retval = 1
1364 except OSError:
1364 except OSError:
1365 # Other strange problems, sometimes seen in Win2k/cygwin
1365 # Other strange problems, sometimes seen in Win2k/cygwin
1366 retval = 1
1366 retval = 1
1367 if retval is not None:
1367 if retval is not None:
1368 page_dumb(strng,screen_lines=screen_lines)
1368 page_dumb(strng,screen_lines=screen_lines)
1369
1369
1370 #----------------------------------------------------------------------------
1370 #----------------------------------------------------------------------------
1371 def page_file(fname,start = 0, pager_cmd = None):
1371 def page_file(fname,start = 0, pager_cmd = None):
1372 """Page a file, using an optional pager command and starting line.
1372 """Page a file, using an optional pager command and starting line.
1373 """
1373 """
1374
1374
1375 pager_cmd = get_pager_cmd(pager_cmd)
1375 pager_cmd = get_pager_cmd(pager_cmd)
1376 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1376 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1377
1377
1378 try:
1378 try:
1379 if os.environ['TERM'] in ['emacs','dumb']:
1379 if os.environ['TERM'] in ['emacs','dumb']:
1380 raise EnvironmentError
1380 raise EnvironmentError
1381 xsys(pager_cmd + ' ' + fname)
1381 xsys(pager_cmd + ' ' + fname)
1382 except:
1382 except:
1383 try:
1383 try:
1384 if start > 0:
1384 if start > 0:
1385 start -= 1
1385 start -= 1
1386 page(open(fname).read(),start)
1386 page(open(fname).read(),start)
1387 except:
1387 except:
1388 print 'Unable to show file',`fname`
1388 print 'Unable to show file',`fname`
1389
1389
1390 #----------------------------------------------------------------------------
1390 #----------------------------------------------------------------------------
1391 def snip_print(str,width = 75,print_full = 0,header = ''):
1391 def snip_print(str,width = 75,print_full = 0,header = ''):
1392 """Print a string snipping the midsection to fit in width.
1392 """Print a string snipping the midsection to fit in width.
1393
1393
1394 print_full: mode control:
1394 print_full: mode control:
1395 - 0: only snip long strings
1395 - 0: only snip long strings
1396 - 1: send to page() directly.
1396 - 1: send to page() directly.
1397 - 2: snip long strings and ask for full length viewing with page()
1397 - 2: snip long strings and ask for full length viewing with page()
1398 Return 1 if snipping was necessary, 0 otherwise."""
1398 Return 1 if snipping was necessary, 0 otherwise."""
1399
1399
1400 if print_full == 1:
1400 if print_full == 1:
1401 page(header+str)
1401 page(header+str)
1402 return 0
1402 return 0
1403
1403
1404 print header,
1404 print header,
1405 if len(str) < width:
1405 if len(str) < width:
1406 print str
1406 print str
1407 snip = 0
1407 snip = 0
1408 else:
1408 else:
1409 whalf = int((width -5)/2)
1409 whalf = int((width -5)/2)
1410 print str[:whalf] + ' <...> ' + str[-whalf:]
1410 print str[:whalf] + ' <...> ' + str[-whalf:]
1411 snip = 1
1411 snip = 1
1412 if snip and print_full == 2:
1412 if snip and print_full == 2:
1413 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1413 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1414 page(str)
1414 page(str)
1415 return snip
1415 return snip
1416
1416
1417 #****************************************************************************
1417 #****************************************************************************
1418 # lists, dicts and structures
1418 # lists, dicts and structures
1419
1419
1420 def belong(candidates,checklist):
1420 def belong(candidates,checklist):
1421 """Check whether a list of items appear in a given list of options.
1421 """Check whether a list of items appear in a given list of options.
1422
1422
1423 Returns a list of 1 and 0, one for each candidate given."""
1423 Returns a list of 1 and 0, one for each candidate given."""
1424
1424
1425 return [x in checklist for x in candidates]
1425 return [x in checklist for x in candidates]
1426
1426
1427 #----------------------------------------------------------------------------
1427 #----------------------------------------------------------------------------
1428 def uniq_stable(elems):
1428 def uniq_stable(elems):
1429 """uniq_stable(elems) -> list
1429 """uniq_stable(elems) -> list
1430
1430
1431 Return from an iterable, a list of all the unique elements in the input,
1431 Return from an iterable, a list of all the unique elements in the input,
1432 but maintaining the order in which they first appear.
1432 but maintaining the order in which they first appear.
1433
1433
1434 A naive solution to this problem which just makes a dictionary with the
1434 A naive solution to this problem which just makes a dictionary with the
1435 elements as keys fails to respect the stability condition, since
1435 elements as keys fails to respect the stability condition, since
1436 dictionaries are unsorted by nature.
1436 dictionaries are unsorted by nature.
1437
1437
1438 Note: All elements in the input must be valid dictionary keys for this
1438 Note: All elements in the input must be valid dictionary keys for this
1439 routine to work, as it internally uses a dictionary for efficiency
1439 routine to work, as it internally uses a dictionary for efficiency
1440 reasons."""
1440 reasons."""
1441
1441
1442 unique = []
1442 unique = []
1443 unique_dict = {}
1443 unique_dict = {}
1444 for nn in elems:
1444 for nn in elems:
1445 if nn not in unique_dict:
1445 if nn not in unique_dict:
1446 unique.append(nn)
1446 unique.append(nn)
1447 unique_dict[nn] = None
1447 unique_dict[nn] = None
1448 return unique
1448 return unique
1449
1449
1450 #----------------------------------------------------------------------------
1450 #----------------------------------------------------------------------------
1451 class NLprinter:
1451 class NLprinter:
1452 """Print an arbitrarily nested list, indicating index numbers.
1452 """Print an arbitrarily nested list, indicating index numbers.
1453
1453
1454 An instance of this class called nlprint is available and callable as a
1454 An instance of this class called nlprint is available and callable as a
1455 function.
1455 function.
1456
1456
1457 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1457 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1458 and using 'sep' to separate the index from the value. """
1458 and using 'sep' to separate the index from the value. """
1459
1459
1460 def __init__(self):
1460 def __init__(self):
1461 self.depth = 0
1461 self.depth = 0
1462
1462
1463 def __call__(self,lst,pos='',**kw):
1463 def __call__(self,lst,pos='',**kw):
1464 """Prints the nested list numbering levels."""
1464 """Prints the nested list numbering levels."""
1465 kw.setdefault('indent',' ')
1465 kw.setdefault('indent',' ')
1466 kw.setdefault('sep',': ')
1466 kw.setdefault('sep',': ')
1467 kw.setdefault('start',0)
1467 kw.setdefault('start',0)
1468 kw.setdefault('stop',len(lst))
1468 kw.setdefault('stop',len(lst))
1469 # we need to remove start and stop from kw so they don't propagate
1469 # we need to remove start and stop from kw so they don't propagate
1470 # into a recursive call for a nested list.
1470 # into a recursive call for a nested list.
1471 start = kw['start']; del kw['start']
1471 start = kw['start']; del kw['start']
1472 stop = kw['stop']; del kw['stop']
1472 stop = kw['stop']; del kw['stop']
1473 if self.depth == 0 and 'header' in kw.keys():
1473 if self.depth == 0 and 'header' in kw.keys():
1474 print kw['header']
1474 print kw['header']
1475
1475
1476 for idx in range(start,stop):
1476 for idx in range(start,stop):
1477 elem = lst[idx]
1477 elem = lst[idx]
1478 if type(elem)==type([]):
1478 if type(elem)==type([]):
1479 self.depth += 1
1479 self.depth += 1
1480 self.__call__(elem,itpl('$pos$idx,'),**kw)
1480 self.__call__(elem,itpl('$pos$idx,'),**kw)
1481 self.depth -= 1
1481 self.depth -= 1
1482 else:
1482 else:
1483 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1483 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1484
1484
1485 nlprint = NLprinter()
1485 nlprint = NLprinter()
1486 #----------------------------------------------------------------------------
1486 #----------------------------------------------------------------------------
1487 def all_belong(candidates,checklist):
1487 def all_belong(candidates,checklist):
1488 """Check whether a list of items ALL appear in a given list of options.
1488 """Check whether a list of items ALL appear in a given list of options.
1489
1489
1490 Returns a single 1 or 0 value."""
1490 Returns a single 1 or 0 value."""
1491
1491
1492 return 1-(0 in [x in checklist for x in candidates])
1492 return 1-(0 in [x in checklist for x in candidates])
1493
1493
1494 #----------------------------------------------------------------------------
1494 #----------------------------------------------------------------------------
1495 def sort_compare(lst1,lst2,inplace = 1):
1495 def sort_compare(lst1,lst2,inplace = 1):
1496 """Sort and compare two lists.
1496 """Sort and compare two lists.
1497
1497
1498 By default it does it in place, thus modifying the lists. Use inplace = 0
1498 By default it does it in place, thus modifying the lists. Use inplace = 0
1499 to avoid that (at the cost of temporary copy creation)."""
1499 to avoid that (at the cost of temporary copy creation)."""
1500 if not inplace:
1500 if not inplace:
1501 lst1 = lst1[:]
1501 lst1 = lst1[:]
1502 lst2 = lst2[:]
1502 lst2 = lst2[:]
1503 lst1.sort(); lst2.sort()
1503 lst1.sort(); lst2.sort()
1504 return lst1 == lst2
1504 return lst1 == lst2
1505
1505
1506 #----------------------------------------------------------------------------
1506 #----------------------------------------------------------------------------
1507 def mkdict(**kwargs):
1507 def mkdict(**kwargs):
1508 """Return a dict from a keyword list.
1508 """Return a dict from a keyword list.
1509
1509
1510 It's just syntactic sugar for making ditcionary creation more convenient:
1510 It's just syntactic sugar for making ditcionary creation more convenient:
1511 # the standard way
1511 # the standard way
1512 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1512 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1513 # a cleaner way
1513 # a cleaner way
1514 >>>data = dict(red=1, green=2, blue=3)
1514 >>>data = dict(red=1, green=2, blue=3)
1515
1515
1516 If you need more than this, look at the Struct() class."""
1516 If you need more than this, look at the Struct() class."""
1517
1517
1518 return kwargs
1518 return kwargs
1519
1519
1520 #----------------------------------------------------------------------------
1520 #----------------------------------------------------------------------------
1521 def list2dict(lst):
1521 def list2dict(lst):
1522 """Takes a list of (key,value) pairs and turns it into a dict."""
1522 """Takes a list of (key,value) pairs and turns it into a dict."""
1523
1523
1524 dic = {}
1524 dic = {}
1525 for k,v in lst: dic[k] = v
1525 for k,v in lst: dic[k] = v
1526 return dic
1526 return dic
1527
1527
1528 #----------------------------------------------------------------------------
1528 #----------------------------------------------------------------------------
1529 def list2dict2(lst,default=''):
1529 def list2dict2(lst,default=''):
1530 """Takes a list and turns it into a dict.
1530 """Takes a list and turns it into a dict.
1531 Much slower than list2dict, but more versatile. This version can take
1531 Much slower than list2dict, but more versatile. This version can take
1532 lists with sublists of arbitrary length (including sclars)."""
1532 lists with sublists of arbitrary length (including sclars)."""
1533
1533
1534 dic = {}
1534 dic = {}
1535 for elem in lst:
1535 for elem in lst:
1536 if type(elem) in (types.ListType,types.TupleType):
1536 if type(elem) in (types.ListType,types.TupleType):
1537 size = len(elem)
1537 size = len(elem)
1538 if size == 0:
1538 if size == 0:
1539 pass
1539 pass
1540 elif size == 1:
1540 elif size == 1:
1541 dic[elem] = default
1541 dic[elem] = default
1542 else:
1542 else:
1543 k,v = elem[0], elem[1:]
1543 k,v = elem[0], elem[1:]
1544 if len(v) == 1: v = v[0]
1544 if len(v) == 1: v = v[0]
1545 dic[k] = v
1545 dic[k] = v
1546 else:
1546 else:
1547 dic[elem] = default
1547 dic[elem] = default
1548 return dic
1548 return dic
1549
1549
1550 #----------------------------------------------------------------------------
1550 #----------------------------------------------------------------------------
1551 def flatten(seq):
1551 def flatten(seq):
1552 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1552 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1553
1553
1554 # bug in python??? (YES. Fixed in 2.2, let's leave the kludgy fix in).
1554 # bug in python??? (YES. Fixed in 2.2, let's leave the kludgy fix in).
1555
1555
1556 # if the x=0 isn't made, a *global* variable x is left over after calling
1556 # if the x=0 isn't made, a *global* variable x is left over after calling
1557 # this function, with the value of the last element in the return
1557 # this function, with the value of the last element in the return
1558 # list. This does seem like a bug big time to me.
1558 # list. This does seem like a bug big time to me.
1559
1559
1560 # the problem is fixed with the x=0, which seems to force the creation of
1560 # the problem is fixed with the x=0, which seems to force the creation of
1561 # a local name
1561 # a local name
1562
1562
1563 x = 0
1563 x = 0
1564 return [x for subseq in seq for x in subseq]
1564 return [x for subseq in seq for x in subseq]
1565
1565
1566 #----------------------------------------------------------------------------
1566 #----------------------------------------------------------------------------
1567 def get_slice(seq,start=0,stop=None,step=1):
1567 def get_slice(seq,start=0,stop=None,step=1):
1568 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1568 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1569 if stop == None:
1569 if stop == None:
1570 stop = len(seq)
1570 stop = len(seq)
1571 item = lambda i: seq[i]
1571 item = lambda i: seq[i]
1572 return map(item,xrange(start,stop,step))
1572 return map(item,xrange(start,stop,step))
1573
1573
1574 #----------------------------------------------------------------------------
1574 #----------------------------------------------------------------------------
1575 def chop(seq,size):
1575 def chop(seq,size):
1576 """Chop a sequence into chunks of the given size."""
1576 """Chop a sequence into chunks of the given size."""
1577 chunk = lambda i: seq[i:i+size]
1577 chunk = lambda i: seq[i:i+size]
1578 return map(chunk,xrange(0,len(seq),size))
1578 return map(chunk,xrange(0,len(seq),size))
1579
1579
1580 #----------------------------------------------------------------------------
1580 #----------------------------------------------------------------------------
1581 def with(object, **args):
1581 def with(object, **args):
1582 """Set multiple attributes for an object, similar to Pascal's with.
1582 """Set multiple attributes for an object, similar to Pascal's with.
1583
1583
1584 Example:
1584 Example:
1585 with(jim,
1585 with(jim,
1586 born = 1960,
1586 born = 1960,
1587 haircolour = 'Brown',
1587 haircolour = 'Brown',
1588 eyecolour = 'Green')
1588 eyecolour = 'Green')
1589
1589
1590 Credit: Greg Ewing, in
1590 Credit: Greg Ewing, in
1591 http://mail.python.org/pipermail/python-list/2001-May/040703.html"""
1591 http://mail.python.org/pipermail/python-list/2001-May/040703.html"""
1592
1592
1593 object.__dict__.update(args)
1593 object.__dict__.update(args)
1594
1594
1595 #----------------------------------------------------------------------------
1595 #----------------------------------------------------------------------------
1596 def setattr_list(obj,alist,nspace = None):
1596 def setattr_list(obj,alist,nspace = None):
1597 """Set a list of attributes for an object taken from a namespace.
1597 """Set a list of attributes for an object taken from a namespace.
1598
1598
1599 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1599 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1600 alist with their values taken from nspace, which must be a dict (something
1600 alist with their values taken from nspace, which must be a dict (something
1601 like locals() will often do) If nspace isn't given, locals() of the
1601 like locals() will often do) If nspace isn't given, locals() of the
1602 *caller* is used, so in most cases you can omit it.
1602 *caller* is used, so in most cases you can omit it.
1603
1603
1604 Note that alist can be given as a string, which will be automatically
1604 Note that alist can be given as a string, which will be automatically
1605 split into a list on whitespace. If given as a list, it must be a list of
1605 split into a list on whitespace. If given as a list, it must be a list of
1606 *strings* (the variable names themselves), not of variables."""
1606 *strings* (the variable names themselves), not of variables."""
1607
1607
1608 # this grabs the local variables from the *previous* call frame -- that is
1608 # this grabs the local variables from the *previous* call frame -- that is
1609 # the locals from the function that called setattr_list().
1609 # the locals from the function that called setattr_list().
1610 # - snipped from weave.inline()
1610 # - snipped from weave.inline()
1611 if nspace is None:
1611 if nspace is None:
1612 call_frame = sys._getframe().f_back
1612 call_frame = sys._getframe().f_back
1613 nspace = call_frame.f_locals
1613 nspace = call_frame.f_locals
1614
1614
1615 if type(alist) in StringTypes:
1615 if type(alist) in StringTypes:
1616 alist = alist.split()
1616 alist = alist.split()
1617 for attr in alist:
1617 for attr in alist:
1618 val = eval(attr,nspace)
1618 val = eval(attr,nspace)
1619 setattr(obj,attr,val)
1619 setattr(obj,attr,val)
1620
1620
1621 #----------------------------------------------------------------------------
1621 #----------------------------------------------------------------------------
1622 def getattr_list(obj,alist,*args):
1622 def getattr_list(obj,alist,*args):
1623 """getattr_list(obj,alist[, default]) -> attribute list.
1623 """getattr_list(obj,alist[, default]) -> attribute list.
1624
1624
1625 Get a list of named attributes for an object. When a default argument is
1625 Get a list of named attributes for an object. When a default argument is
1626 given, it is returned when the attribute doesn't exist; without it, an
1626 given, it is returned when the attribute doesn't exist; without it, an
1627 exception is raised in that case.
1627 exception is raised in that case.
1628
1628
1629 Note that alist can be given as a string, which will be automatically
1629 Note that alist can be given as a string, which will be automatically
1630 split into a list on whitespace. If given as a list, it must be a list of
1630 split into a list on whitespace. If given as a list, it must be a list of
1631 *strings* (the variable names themselves), not of variables."""
1631 *strings* (the variable names themselves), not of variables."""
1632
1632
1633 if type(alist) in StringTypes:
1633 if type(alist) in StringTypes:
1634 alist = alist.split()
1634 alist = alist.split()
1635 if args:
1635 if args:
1636 if len(args)==1:
1636 if len(args)==1:
1637 default = args[0]
1637 default = args[0]
1638 return map(lambda attr: getattr(obj,attr,default),alist)
1638 return map(lambda attr: getattr(obj,attr,default),alist)
1639 else:
1639 else:
1640 raise ValueError,'getattr_list() takes only one optional argument'
1640 raise ValueError,'getattr_list() takes only one optional argument'
1641 else:
1641 else:
1642 return map(lambda attr: getattr(obj,attr),alist)
1642 return map(lambda attr: getattr(obj,attr),alist)
1643
1643
1644 #----------------------------------------------------------------------------
1644 #----------------------------------------------------------------------------
1645 def map_method(method,object_list,*argseq,**kw):
1645 def map_method(method,object_list,*argseq,**kw):
1646 """map_method(method,object_list,*args,**kw) -> list
1646 """map_method(method,object_list,*args,**kw) -> list
1647
1647
1648 Return a list of the results of applying the methods to the items of the
1648 Return a list of the results of applying the methods to the items of the
1649 argument sequence(s). If more than one sequence is given, the method is
1649 argument sequence(s). If more than one sequence is given, the method is
1650 called with an argument list consisting of the corresponding item of each
1650 called with an argument list consisting of the corresponding item of each
1651 sequence. All sequences must be of the same length.
1651 sequence. All sequences must be of the same length.
1652
1652
1653 Keyword arguments are passed verbatim to all objects called.
1653 Keyword arguments are passed verbatim to all objects called.
1654
1654
1655 This is Python code, so it's not nearly as fast as the builtin map()."""
1655 This is Python code, so it's not nearly as fast as the builtin map()."""
1656
1656
1657 out_list = []
1657 out_list = []
1658 idx = 0
1658 idx = 0
1659 for object in object_list:
1659 for object in object_list:
1660 try:
1660 try:
1661 handler = getattr(object, method)
1661 handler = getattr(object, method)
1662 except AttributeError:
1662 except AttributeError:
1663 out_list.append(None)
1663 out_list.append(None)
1664 else:
1664 else:
1665 if argseq:
1665 if argseq:
1666 args = map(lambda lst:lst[idx],argseq)
1666 args = map(lambda lst:lst[idx],argseq)
1667 #print 'ob',object,'hand',handler,'ar',args # dbg
1667 #print 'ob',object,'hand',handler,'ar',args # dbg
1668 out_list.append(handler(args,**kw))
1668 out_list.append(handler(args,**kw))
1669 else:
1669 else:
1670 out_list.append(handler(**kw))
1670 out_list.append(handler(**kw))
1671 idx += 1
1671 idx += 1
1672 return out_list
1672 return out_list
1673
1673
1674 #----------------------------------------------------------------------------
1674 #----------------------------------------------------------------------------
1675 def import_fail_info(mod_name,fns=None):
1675 def import_fail_info(mod_name,fns=None):
1676 """Inform load failure for a module."""
1676 """Inform load failure for a module."""
1677
1677
1678 if fns == None:
1678 if fns == None:
1679 warn("Loading of %s failed.\n" % (mod_name,))
1679 warn("Loading of %s failed.\n" % (mod_name,))
1680 else:
1680 else:
1681 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
1681 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
1682
1682
1683 #----------------------------------------------------------------------------
1683 #----------------------------------------------------------------------------
1684 # Proposed popitem() extension, written as a method
1684 # Proposed popitem() extension, written as a method
1685
1685
1686 class NotGiven: pass
1686 class NotGiven: pass
1687
1687
1688 def popkey(dct,key,default=NotGiven):
1688 def popkey(dct,key,default=NotGiven):
1689 """Return dct[key] and delete dct[key].
1689 """Return dct[key] and delete dct[key].
1690
1690
1691 If default is given, return it if dct[key] doesn't exist, otherwise raise
1691 If default is given, return it if dct[key] doesn't exist, otherwise raise
1692 KeyError. """
1692 KeyError. """
1693
1693
1694 try:
1694 try:
1695 val = dct[key]
1695 val = dct[key]
1696 except KeyError:
1696 except KeyError:
1697 if default is NotGiven:
1697 if default is NotGiven:
1698 raise
1698 raise
1699 else:
1699 else:
1700 return default
1700 return default
1701 else:
1701 else:
1702 del dct[key]
1702 del dct[key]
1703 return val
1703 return val
1704 #*************************** end of file <genutils.py> **********************
1704 #*************************** end of file <genutils.py> **********************
1705
1705
@@ -1,4673 +1,4678 b''
1 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/genutils.py (shell): fix small but critical bug for
4 win32 system access.
5
1 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
6 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2
7
3 * IPython/iplib.py (showtraceback): remove use of the
8 * IPython/iplib.py (showtraceback): remove use of the
4 sys.last_{type/value/traceback} structures, which are non
9 sys.last_{type/value/traceback} structures, which are non
5 thread-safe.
10 thread-safe.
6 (_prefilter): change control flow to ensure that we NEVER
11 (_prefilter): change control flow to ensure that we NEVER
7 introspect objects when autocall is off. This will guarantee that
12 introspect objects when autocall is off. This will guarantee that
8 having an input line of the form 'x.y', where access to attribute
13 having an input line of the form 'x.y', where access to attribute
9 'y' has side effects, doesn't trigger the side effect TWICE. It
14 'y' has side effects, doesn't trigger the side effect TWICE. It
10 is important to note that, with autocall on, these side effects
15 is important to note that, with autocall on, these side effects
11 can still happen.
16 can still happen.
12 (ipsystem): new builtin, to complete the ip{magic/alias/system}
17 (ipsystem): new builtin, to complete the ip{magic/alias/system}
13 trio. IPython offers these three kinds of special calls which are
18 trio. IPython offers these three kinds of special calls which are
14 not python code, and it's a good thing to have their call method
19 not python code, and it's a good thing to have their call method
15 be accessible as pure python functions (not just special syntax at
20 be accessible as pure python functions (not just special syntax at
16 the command line). It gives us a better internal implementation
21 the command line). It gives us a better internal implementation
17 structure, as well as exposing these for user scripting more
22 structure, as well as exposing these for user scripting more
18 cleanly.
23 cleanly.
19
24
20 * IPython/macro.py (Macro.__init__): moved macros to a standalone
25 * IPython/macro.py (Macro.__init__): moved macros to a standalone
21 file. Now that they'll be more likely to be used with the
26 file. Now that they'll be more likely to be used with the
22 persistance system (%store), I want to make sure their module path
27 persistance system (%store), I want to make sure their module path
23 doesn't change in the future, so that we don't break things for
28 doesn't change in the future, so that we don't break things for
24 users' persisted data.
29 users' persisted data.
25
30
26 * IPython/iplib.py (autoindent_update): move indentation
31 * IPython/iplib.py (autoindent_update): move indentation
27 management into the _text_ processing loop, not the keyboard
32 management into the _text_ processing loop, not the keyboard
28 interactive one. This is necessary to correctly process non-typed
33 interactive one. This is necessary to correctly process non-typed
29 multiline input (such as macros).
34 multiline input (such as macros).
30
35
31 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
36 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
32 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
37 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
33 which was producing problems in the resulting manual.
38 which was producing problems in the resulting manual.
34 (magic_whos): improve reporting of instances (show their class,
39 (magic_whos): improve reporting of instances (show their class,
35 instead of simply printing 'instance' which isn't terribly
40 instead of simply printing 'instance' which isn't terribly
36 informative).
41 informative).
37
42
38 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
43 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
39 (minor mods) to support network shares under win32.
44 (minor mods) to support network shares under win32.
40
45
41 * IPython/winconsole.py (get_console_size): add new winconsole
46 * IPython/winconsole.py (get_console_size): add new winconsole
42 module and fixes to page_dumb() to improve its behavior under
47 module and fixes to page_dumb() to improve its behavior under
43 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
48 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
44
49
45 * IPython/Magic.py (Macro): simplified Macro class to just
50 * IPython/Magic.py (Macro): simplified Macro class to just
46 subclass list. We've had only 2.2 compatibility for a very long
51 subclass list. We've had only 2.2 compatibility for a very long
47 time, yet I was still avoiding subclassing the builtin types. No
52 time, yet I was still avoiding subclassing the builtin types. No
48 more (I'm also starting to use properties, though I won't shift to
53 more (I'm also starting to use properties, though I won't shift to
49 2.3-specific features quite yet).
54 2.3-specific features quite yet).
50 (magic_store): added Ville's patch for lightweight variable
55 (magic_store): added Ville's patch for lightweight variable
51 persistence, after a request on the user list by Matt Wilkie
56 persistence, after a request on the user list by Matt Wilkie
52 <maphew-AT-gmail.com>. The new %store magic's docstring has full
57 <maphew-AT-gmail.com>. The new %store magic's docstring has full
53 details.
58 details.
54
59
55 * IPython/iplib.py (InteractiveShell.post_config_initialization):
60 * IPython/iplib.py (InteractiveShell.post_config_initialization):
56 changed the default logfile name from 'ipython.log' to
61 changed the default logfile name from 'ipython.log' to
57 'ipython_log.py'. These logs are real python files, and now that
62 'ipython_log.py'. These logs are real python files, and now that
58 we have much better multiline support, people are more likely to
63 we have much better multiline support, people are more likely to
59 want to use them as such. Might as well name them correctly.
64 want to use them as such. Might as well name them correctly.
60
65
61 * IPython/Magic.py: substantial cleanup. While we can't stop
66 * IPython/Magic.py: substantial cleanup. While we can't stop
62 using magics as mixins, due to the existing customizations 'out
67 using magics as mixins, due to the existing customizations 'out
63 there' which rely on the mixin naming conventions, at least I
68 there' which rely on the mixin naming conventions, at least I
64 cleaned out all cross-class name usage. So once we are OK with
69 cleaned out all cross-class name usage. So once we are OK with
65 breaking compatibility, the two systems can be separated.
70 breaking compatibility, the two systems can be separated.
66
71
67 * IPython/Logger.py: major cleanup. This one is NOT a mixin
72 * IPython/Logger.py: major cleanup. This one is NOT a mixin
68 anymore, and the class is a fair bit less hideous as well. New
73 anymore, and the class is a fair bit less hideous as well. New
69 features were also introduced: timestamping of input, and logging
74 features were also introduced: timestamping of input, and logging
70 of output results. These are user-visible with the -t and -o
75 of output results. These are user-visible with the -t and -o
71 options to %logstart. Closes
76 options to %logstart. Closes
72 http://www.scipy.net/roundup/ipython/issue11 and a request by
77 http://www.scipy.net/roundup/ipython/issue11 and a request by
73 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
78 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
74
79
75 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
80 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
76
81
77 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
82 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
78 better hadnle backslashes in paths. See the thread 'More Windows
83 better hadnle backslashes in paths. See the thread 'More Windows
79 questions part 2 - \/ characters revisited' on the iypthon user
84 questions part 2 - \/ characters revisited' on the iypthon user
80 list:
85 list:
81 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
86 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
82
87
83 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
88 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
84
89
85 (InteractiveShell.__init__): change threaded shells to not use the
90 (InteractiveShell.__init__): change threaded shells to not use the
86 ipython crash handler. This was causing more problems than not,
91 ipython crash handler. This was causing more problems than not,
87 as exceptions in the main thread (GUI code, typically) would
92 as exceptions in the main thread (GUI code, typically) would
88 always show up as a 'crash', when they really weren't.
93 always show up as a 'crash', when they really weren't.
89
94
90 The colors and exception mode commands (%colors/%xmode) have been
95 The colors and exception mode commands (%colors/%xmode) have been
91 synchronized to also take this into account, so users can get
96 synchronized to also take this into account, so users can get
92 verbose exceptions for their threaded code as well. I also added
97 verbose exceptions for their threaded code as well. I also added
93 support for activating pdb inside this exception handler as well,
98 support for activating pdb inside this exception handler as well,
94 so now GUI authors can use IPython's enhanced pdb at runtime.
99 so now GUI authors can use IPython's enhanced pdb at runtime.
95
100
96 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
101 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
97 true by default, and add it to the shipped ipythonrc file. Since
102 true by default, and add it to the shipped ipythonrc file. Since
98 this asks the user before proceeding, I think it's OK to make it
103 this asks the user before proceeding, I think it's OK to make it
99 true by default.
104 true by default.
100
105
101 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
106 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
102 of the previous special-casing of input in the eval loop. I think
107 of the previous special-casing of input in the eval loop. I think
103 this is cleaner, as they really are commands and shouldn't have
108 this is cleaner, as they really are commands and shouldn't have
104 a special role in the middle of the core code.
109 a special role in the middle of the core code.
105
110
106 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
111 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
107
112
108 * IPython/iplib.py (edit_syntax_error): added support for
113 * IPython/iplib.py (edit_syntax_error): added support for
109 automatically reopening the editor if the file had a syntax error
114 automatically reopening the editor if the file had a syntax error
110 in it. Thanks to scottt who provided the patch at:
115 in it. Thanks to scottt who provided the patch at:
111 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
116 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
112 version committed).
117 version committed).
113
118
114 * IPython/iplib.py (handle_normal): add suport for multi-line
119 * IPython/iplib.py (handle_normal): add suport for multi-line
115 input with emtpy lines. This fixes
120 input with emtpy lines. This fixes
116 http://www.scipy.net/roundup/ipython/issue43 and a similar
121 http://www.scipy.net/roundup/ipython/issue43 and a similar
117 discussion on the user list.
122 discussion on the user list.
118
123
119 WARNING: a behavior change is necessarily introduced to support
124 WARNING: a behavior change is necessarily introduced to support
120 blank lines: now a single blank line with whitespace does NOT
125 blank lines: now a single blank line with whitespace does NOT
121 break the input loop, which means that when autoindent is on, by
126 break the input loop, which means that when autoindent is on, by
122 default hitting return on the next (indented) line does NOT exit.
127 default hitting return on the next (indented) line does NOT exit.
123
128
124 Instead, to exit a multiline input you can either have:
129 Instead, to exit a multiline input you can either have:
125
130
126 - TWO whitespace lines (just hit return again), or
131 - TWO whitespace lines (just hit return again), or
127 - a single whitespace line of a different length than provided
132 - a single whitespace line of a different length than provided
128 by the autoindent (add or remove a space).
133 by the autoindent (add or remove a space).
129
134
130 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
135 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
131 module to better organize all readline-related functionality.
136 module to better organize all readline-related functionality.
132 I've deleted FlexCompleter and put all completion clases here.
137 I've deleted FlexCompleter and put all completion clases here.
133
138
134 * IPython/iplib.py (raw_input): improve indentation management.
139 * IPython/iplib.py (raw_input): improve indentation management.
135 It is now possible to paste indented code with autoindent on, and
140 It is now possible to paste indented code with autoindent on, and
136 the code is interpreted correctly (though it still looks bad on
141 the code is interpreted correctly (though it still looks bad on
137 screen, due to the line-oriented nature of ipython).
142 screen, due to the line-oriented nature of ipython).
138 (MagicCompleter.complete): change behavior so that a TAB key on an
143 (MagicCompleter.complete): change behavior so that a TAB key on an
139 otherwise empty line actually inserts a tab, instead of completing
144 otherwise empty line actually inserts a tab, instead of completing
140 on the entire global namespace. This makes it easier to use the
145 on the entire global namespace. This makes it easier to use the
141 TAB key for indentation. After a request by Hans Meine
146 TAB key for indentation. After a request by Hans Meine
142 <hans_meine-AT-gmx.net>
147 <hans_meine-AT-gmx.net>
143 (_prefilter): add support so that typing plain 'exit' or 'quit'
148 (_prefilter): add support so that typing plain 'exit' or 'quit'
144 does a sensible thing. Originally I tried to deviate as little as
149 does a sensible thing. Originally I tried to deviate as little as
145 possible from the default python behavior, but even that one may
150 possible from the default python behavior, but even that one may
146 change in this direction (thread on python-dev to that effect).
151 change in this direction (thread on python-dev to that effect).
147 Regardless, ipython should do the right thing even if CPython's
152 Regardless, ipython should do the right thing even if CPython's
148 '>>>' prompt doesn't.
153 '>>>' prompt doesn't.
149 (InteractiveShell): removed subclassing code.InteractiveConsole
154 (InteractiveShell): removed subclassing code.InteractiveConsole
150 class. By now we'd overridden just about all of its methods: I've
155 class. By now we'd overridden just about all of its methods: I've
151 copied the remaining two over, and now ipython is a standalone
156 copied the remaining two over, and now ipython is a standalone
152 class. This will provide a clearer picture for the chainsaw
157 class. This will provide a clearer picture for the chainsaw
153 branch refactoring.
158 branch refactoring.
154
159
155 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
160 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
156
161
157 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
162 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
158 failures for objects which break when dir() is called on them.
163 failures for objects which break when dir() is called on them.
159
164
160 * IPython/FlexCompleter.py (Completer.__init__): Added support for
165 * IPython/FlexCompleter.py (Completer.__init__): Added support for
161 distinct local and global namespaces in the completer API. This
166 distinct local and global namespaces in the completer API. This
162 change allows us top properly handle completion with distinct
167 change allows us top properly handle completion with distinct
163 scopes, including in embedded instances (this had never really
168 scopes, including in embedded instances (this had never really
164 worked correctly).
169 worked correctly).
165
170
166 Note: this introduces a change in the constructor for
171 Note: this introduces a change in the constructor for
167 MagicCompleter, as a new global_namespace parameter is now the
172 MagicCompleter, as a new global_namespace parameter is now the
168 second argument (the others were bumped one position).
173 second argument (the others were bumped one position).
169
174
170 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
175 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
171
176
172 * IPython/iplib.py (embed_mainloop): fix tab-completion in
177 * IPython/iplib.py (embed_mainloop): fix tab-completion in
173 embedded instances (which can be done now thanks to Vivian's
178 embedded instances (which can be done now thanks to Vivian's
174 frame-handling fixes for pdb).
179 frame-handling fixes for pdb).
175 (InteractiveShell.__init__): Fix namespace handling problem in
180 (InteractiveShell.__init__): Fix namespace handling problem in
176 embedded instances. We were overwriting __main__ unconditionally,
181 embedded instances. We were overwriting __main__ unconditionally,
177 and this should only be done for 'full' (non-embedded) IPython;
182 and this should only be done for 'full' (non-embedded) IPython;
178 embedded instances must respect the caller's __main__. Thanks to
183 embedded instances must respect the caller's __main__. Thanks to
179 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
184 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
180
185
181 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
186 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
182
187
183 * setup.py: added download_url to setup(). This registers the
188 * setup.py: added download_url to setup(). This registers the
184 download address at PyPI, which is not only useful to humans
189 download address at PyPI, which is not only useful to humans
185 browsing the site, but is also picked up by setuptools (the Eggs
190 browsing the site, but is also picked up by setuptools (the Eggs
186 machinery). Thanks to Ville and R. Kern for the info/discussion
191 machinery). Thanks to Ville and R. Kern for the info/discussion
187 on this.
192 on this.
188
193
189 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
194 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
190
195
191 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
196 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
192 This brings a lot of nice functionality to the pdb mode, which now
197 This brings a lot of nice functionality to the pdb mode, which now
193 has tab-completion, syntax highlighting, and better stack handling
198 has tab-completion, syntax highlighting, and better stack handling
194 than before. Many thanks to Vivian De Smedt
199 than before. Many thanks to Vivian De Smedt
195 <vivian-AT-vdesmedt.com> for the original patches.
200 <vivian-AT-vdesmedt.com> for the original patches.
196
201
197 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
202 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
198
203
199 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
204 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
200 sequence to consistently accept the banner argument. The
205 sequence to consistently accept the banner argument. The
201 inconsistency was tripping SAGE, thanks to Gary Zablackis
206 inconsistency was tripping SAGE, thanks to Gary Zablackis
202 <gzabl-AT-yahoo.com> for the report.
207 <gzabl-AT-yahoo.com> for the report.
203
208
204 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
209 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
205
210
206 * IPython/iplib.py (InteractiveShell.post_config_initialization):
211 * IPython/iplib.py (InteractiveShell.post_config_initialization):
207 Fix bug where a naked 'alias' call in the ipythonrc file would
212 Fix bug where a naked 'alias' call in the ipythonrc file would
208 cause a crash. Bug reported by Jorgen Stenarson.
213 cause a crash. Bug reported by Jorgen Stenarson.
209
214
210 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
215 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
211
216
212 * IPython/ipmaker.py (make_IPython): cleanups which should improve
217 * IPython/ipmaker.py (make_IPython): cleanups which should improve
213 startup time.
218 startup time.
214
219
215 * IPython/iplib.py (runcode): my globals 'fix' for embedded
220 * IPython/iplib.py (runcode): my globals 'fix' for embedded
216 instances had introduced a bug with globals in normal code. Now
221 instances had introduced a bug with globals in normal code. Now
217 it's working in all cases.
222 it's working in all cases.
218
223
219 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
224 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
220 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
225 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
221 has been introduced to set the default case sensitivity of the
226 has been introduced to set the default case sensitivity of the
222 searches. Users can still select either mode at runtime on a
227 searches. Users can still select either mode at runtime on a
223 per-search basis.
228 per-search basis.
224
229
225 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
230 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
226
231
227 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
232 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
228 attributes in wildcard searches for subclasses. Modified version
233 attributes in wildcard searches for subclasses. Modified version
229 of a patch by Jorgen.
234 of a patch by Jorgen.
230
235
231 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
236 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
232
237
233 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
238 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
234 embedded instances. I added a user_global_ns attribute to the
239 embedded instances. I added a user_global_ns attribute to the
235 InteractiveShell class to handle this.
240 InteractiveShell class to handle this.
236
241
237 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
242 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
238
243
239 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
244 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
240 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
245 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
241 (reported under win32, but may happen also in other platforms).
246 (reported under win32, but may happen also in other platforms).
242 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
247 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
243
248
244 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
249 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
245
250
246 * IPython/Magic.py (magic_psearch): new support for wildcard
251 * IPython/Magic.py (magic_psearch): new support for wildcard
247 patterns. Now, typing ?a*b will list all names which begin with a
252 patterns. Now, typing ?a*b will list all names which begin with a
248 and end in b, for example. The %psearch magic has full
253 and end in b, for example. The %psearch magic has full
249 docstrings. Many thanks to Jörgen Stenarson
254 docstrings. Many thanks to Jörgen Stenarson
250 <jorgen.stenarson-AT-bostream.nu>, author of the patches
255 <jorgen.stenarson-AT-bostream.nu>, author of the patches
251 implementing this functionality.
256 implementing this functionality.
252
257
253 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
258 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
254
259
255 * Manual: fixed long-standing annoyance of double-dashes (as in
260 * Manual: fixed long-standing annoyance of double-dashes (as in
256 --prefix=~, for example) being stripped in the HTML version. This
261 --prefix=~, for example) being stripped in the HTML version. This
257 is a latex2html bug, but a workaround was provided. Many thanks
262 is a latex2html bug, but a workaround was provided. Many thanks
258 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
263 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
259 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
264 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
260 rolling. This seemingly small issue had tripped a number of users
265 rolling. This seemingly small issue had tripped a number of users
261 when first installing, so I'm glad to see it gone.
266 when first installing, so I'm glad to see it gone.
262
267
263 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
268 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
264
269
265 * IPython/Extensions/numeric_formats.py: fix missing import,
270 * IPython/Extensions/numeric_formats.py: fix missing import,
266 reported by Stephen Walton.
271 reported by Stephen Walton.
267
272
268 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
273 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
269
274
270 * IPython/demo.py: finish demo module, fully documented now.
275 * IPython/demo.py: finish demo module, fully documented now.
271
276
272 * IPython/genutils.py (file_read): simple little utility to read a
277 * IPython/genutils.py (file_read): simple little utility to read a
273 file and ensure it's closed afterwards.
278 file and ensure it's closed afterwards.
274
279
275 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
280 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
276
281
277 * IPython/demo.py (Demo.__init__): added support for individually
282 * IPython/demo.py (Demo.__init__): added support for individually
278 tagging blocks for automatic execution.
283 tagging blocks for automatic execution.
279
284
280 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
285 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
281 syntax-highlighted python sources, requested by John.
286 syntax-highlighted python sources, requested by John.
282
287
283 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
288 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
284
289
285 * IPython/demo.py (Demo.again): fix bug where again() blocks after
290 * IPython/demo.py (Demo.again): fix bug where again() blocks after
286 finishing.
291 finishing.
287
292
288 * IPython/genutils.py (shlex_split): moved from Magic to here,
293 * IPython/genutils.py (shlex_split): moved from Magic to here,
289 where all 2.2 compatibility stuff lives. I needed it for demo.py.
294 where all 2.2 compatibility stuff lives. I needed it for demo.py.
290
295
291 * IPython/demo.py (Demo.__init__): added support for silent
296 * IPython/demo.py (Demo.__init__): added support for silent
292 blocks, improved marks as regexps, docstrings written.
297 blocks, improved marks as regexps, docstrings written.
293 (Demo.__init__): better docstring, added support for sys.argv.
298 (Demo.__init__): better docstring, added support for sys.argv.
294
299
295 * IPython/genutils.py (marquee): little utility used by the demo
300 * IPython/genutils.py (marquee): little utility used by the demo
296 code, handy in general.
301 code, handy in general.
297
302
298 * IPython/demo.py (Demo.__init__): new class for interactive
303 * IPython/demo.py (Demo.__init__): new class for interactive
299 demos. Not documented yet, I just wrote it in a hurry for
304 demos. Not documented yet, I just wrote it in a hurry for
300 scipy'05. Will docstring later.
305 scipy'05. Will docstring later.
301
306
302 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
307 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
303
308
304 * IPython/Shell.py (sigint_handler): Drastic simplification which
309 * IPython/Shell.py (sigint_handler): Drastic simplification which
305 also seems to make Ctrl-C work correctly across threads! This is
310 also seems to make Ctrl-C work correctly across threads! This is
306 so simple, that I can't beleive I'd missed it before. Needs more
311 so simple, that I can't beleive I'd missed it before. Needs more
307 testing, though.
312 testing, though.
308 (KBINT): Never mind, revert changes. I'm sure I'd tried something
313 (KBINT): Never mind, revert changes. I'm sure I'd tried something
309 like this before...
314 like this before...
310
315
311 * IPython/genutils.py (get_home_dir): add protection against
316 * IPython/genutils.py (get_home_dir): add protection against
312 non-dirs in win32 registry.
317 non-dirs in win32 registry.
313
318
314 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
319 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
315 bug where dict was mutated while iterating (pysh crash).
320 bug where dict was mutated while iterating (pysh crash).
316
321
317 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
322 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
318
323
319 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
324 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
320 spurious newlines added by this routine. After a report by
325 spurious newlines added by this routine. After a report by
321 F. Mantegazza.
326 F. Mantegazza.
322
327
323 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
328 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
324
329
325 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
330 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
326 calls. These were a leftover from the GTK 1.x days, and can cause
331 calls. These were a leftover from the GTK 1.x days, and can cause
327 problems in certain cases (after a report by John Hunter).
332 problems in certain cases (after a report by John Hunter).
328
333
329 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
334 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
330 os.getcwd() fails at init time. Thanks to patch from David Remahl
335 os.getcwd() fails at init time. Thanks to patch from David Remahl
331 <chmod007-AT-mac.com>.
336 <chmod007-AT-mac.com>.
332 (InteractiveShell.__init__): prevent certain special magics from
337 (InteractiveShell.__init__): prevent certain special magics from
333 being shadowed by aliases. Closes
338 being shadowed by aliases. Closes
334 http://www.scipy.net/roundup/ipython/issue41.
339 http://www.scipy.net/roundup/ipython/issue41.
335
340
336 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
341 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
337
342
338 * IPython/iplib.py (InteractiveShell.complete): Added new
343 * IPython/iplib.py (InteractiveShell.complete): Added new
339 top-level completion method to expose the completion mechanism
344 top-level completion method to expose the completion mechanism
340 beyond readline-based environments.
345 beyond readline-based environments.
341
346
342 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
347 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
343
348
344 * tools/ipsvnc (svnversion): fix svnversion capture.
349 * tools/ipsvnc (svnversion): fix svnversion capture.
345
350
346 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
351 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
347 attribute to self, which was missing. Before, it was set by a
352 attribute to self, which was missing. Before, it was set by a
348 routine which in certain cases wasn't being called, so the
353 routine which in certain cases wasn't being called, so the
349 instance could end up missing the attribute. This caused a crash.
354 instance could end up missing the attribute. This caused a crash.
350 Closes http://www.scipy.net/roundup/ipython/issue40.
355 Closes http://www.scipy.net/roundup/ipython/issue40.
351
356
352 2005-08-16 Fernando Perez <fperez@colorado.edu>
357 2005-08-16 Fernando Perez <fperez@colorado.edu>
353
358
354 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
359 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
355 contains non-string attribute. Closes
360 contains non-string attribute. Closes
356 http://www.scipy.net/roundup/ipython/issue38.
361 http://www.scipy.net/roundup/ipython/issue38.
357
362
358 2005-08-14 Fernando Perez <fperez@colorado.edu>
363 2005-08-14 Fernando Perez <fperez@colorado.edu>
359
364
360 * tools/ipsvnc: Minor improvements, to add changeset info.
365 * tools/ipsvnc: Minor improvements, to add changeset info.
361
366
362 2005-08-12 Fernando Perez <fperez@colorado.edu>
367 2005-08-12 Fernando Perez <fperez@colorado.edu>
363
368
364 * IPython/iplib.py (runsource): remove self.code_to_run_src
369 * IPython/iplib.py (runsource): remove self.code_to_run_src
365 attribute. I realized this is nothing more than
370 attribute. I realized this is nothing more than
366 '\n'.join(self.buffer), and having the same data in two different
371 '\n'.join(self.buffer), and having the same data in two different
367 places is just asking for synchronization bugs. This may impact
372 places is just asking for synchronization bugs. This may impact
368 people who have custom exception handlers, so I need to warn
373 people who have custom exception handlers, so I need to warn
369 ipython-dev about it (F. Mantegazza may use them).
374 ipython-dev about it (F. Mantegazza may use them).
370
375
371 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
376 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
372
377
373 * IPython/genutils.py: fix 2.2 compatibility (generators)
378 * IPython/genutils.py: fix 2.2 compatibility (generators)
374
379
375 2005-07-18 Fernando Perez <fperez@colorado.edu>
380 2005-07-18 Fernando Perez <fperez@colorado.edu>
376
381
377 * IPython/genutils.py (get_home_dir): fix to help users with
382 * IPython/genutils.py (get_home_dir): fix to help users with
378 invalid $HOME under win32.
383 invalid $HOME under win32.
379
384
380 2005-07-17 Fernando Perez <fperez@colorado.edu>
385 2005-07-17 Fernando Perez <fperez@colorado.edu>
381
386
382 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
387 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
383 some old hacks and clean up a bit other routines; code should be
388 some old hacks and clean up a bit other routines; code should be
384 simpler and a bit faster.
389 simpler and a bit faster.
385
390
386 * IPython/iplib.py (interact): removed some last-resort attempts
391 * IPython/iplib.py (interact): removed some last-resort attempts
387 to survive broken stdout/stderr. That code was only making it
392 to survive broken stdout/stderr. That code was only making it
388 harder to abstract out the i/o (necessary for gui integration),
393 harder to abstract out the i/o (necessary for gui integration),
389 and the crashes it could prevent were extremely rare in practice
394 and the crashes it could prevent were extremely rare in practice
390 (besides being fully user-induced in a pretty violent manner).
395 (besides being fully user-induced in a pretty violent manner).
391
396
392 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
397 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
393 Nothing major yet, but the code is simpler to read; this should
398 Nothing major yet, but the code is simpler to read; this should
394 make it easier to do more serious modifications in the future.
399 make it easier to do more serious modifications in the future.
395
400
396 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
401 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
397 which broke in .15 (thanks to a report by Ville).
402 which broke in .15 (thanks to a report by Ville).
398
403
399 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
404 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
400 be quite correct, I know next to nothing about unicode). This
405 be quite correct, I know next to nothing about unicode). This
401 will allow unicode strings to be used in prompts, amongst other
406 will allow unicode strings to be used in prompts, amongst other
402 cases. It also will prevent ipython from crashing when unicode
407 cases. It also will prevent ipython from crashing when unicode
403 shows up unexpectedly in many places. If ascii encoding fails, we
408 shows up unexpectedly in many places. If ascii encoding fails, we
404 assume utf_8. Currently the encoding is not a user-visible
409 assume utf_8. Currently the encoding is not a user-visible
405 setting, though it could be made so if there is demand for it.
410 setting, though it could be made so if there is demand for it.
406
411
407 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
412 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
408
413
409 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
414 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
410
415
411 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
416 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
412
417
413 * IPython/genutils.py: Add 2.2 compatibility here, so all other
418 * IPython/genutils.py: Add 2.2 compatibility here, so all other
414 code can work transparently for 2.2/2.3.
419 code can work transparently for 2.2/2.3.
415
420
416 2005-07-16 Fernando Perez <fperez@colorado.edu>
421 2005-07-16 Fernando Perez <fperez@colorado.edu>
417
422
418 * IPython/ultraTB.py (ExceptionColors): Make a global variable
423 * IPython/ultraTB.py (ExceptionColors): Make a global variable
419 out of the color scheme table used for coloring exception
424 out of the color scheme table used for coloring exception
420 tracebacks. This allows user code to add new schemes at runtime.
425 tracebacks. This allows user code to add new schemes at runtime.
421 This is a minimally modified version of the patch at
426 This is a minimally modified version of the patch at
422 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
427 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
423 for the contribution.
428 for the contribution.
424
429
425 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
430 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
426 slightly modified version of the patch in
431 slightly modified version of the patch in
427 http://www.scipy.net/roundup/ipython/issue34, which also allows me
432 http://www.scipy.net/roundup/ipython/issue34, which also allows me
428 to remove the previous try/except solution (which was costlier).
433 to remove the previous try/except solution (which was costlier).
429 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
434 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
430
435
431 2005-06-08 Fernando Perez <fperez@colorado.edu>
436 2005-06-08 Fernando Perez <fperez@colorado.edu>
432
437
433 * IPython/iplib.py (write/write_err): Add methods to abstract all
438 * IPython/iplib.py (write/write_err): Add methods to abstract all
434 I/O a bit more.
439 I/O a bit more.
435
440
436 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
441 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
437 warning, reported by Aric Hagberg, fix by JD Hunter.
442 warning, reported by Aric Hagberg, fix by JD Hunter.
438
443
439 2005-06-02 *** Released version 0.6.15
444 2005-06-02 *** Released version 0.6.15
440
445
441 2005-06-01 Fernando Perez <fperez@colorado.edu>
446 2005-06-01 Fernando Perez <fperez@colorado.edu>
442
447
443 * IPython/iplib.py (MagicCompleter.file_matches): Fix
448 * IPython/iplib.py (MagicCompleter.file_matches): Fix
444 tab-completion of filenames within open-quoted strings. Note that
449 tab-completion of filenames within open-quoted strings. Note that
445 this requires that in ~/.ipython/ipythonrc, users change the
450 this requires that in ~/.ipython/ipythonrc, users change the
446 readline delimiters configuration to read:
451 readline delimiters configuration to read:
447
452
448 readline_remove_delims -/~
453 readline_remove_delims -/~
449
454
450
455
451 2005-05-31 *** Released version 0.6.14
456 2005-05-31 *** Released version 0.6.14
452
457
453 2005-05-29 Fernando Perez <fperez@colorado.edu>
458 2005-05-29 Fernando Perez <fperez@colorado.edu>
454
459
455 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
460 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
456 with files not on the filesystem. Reported by Eliyahu Sandler
461 with files not on the filesystem. Reported by Eliyahu Sandler
457 <eli@gondolin.net>
462 <eli@gondolin.net>
458
463
459 2005-05-22 Fernando Perez <fperez@colorado.edu>
464 2005-05-22 Fernando Perez <fperez@colorado.edu>
460
465
461 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
466 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
462 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
467 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
463
468
464 2005-05-19 Fernando Perez <fperez@colorado.edu>
469 2005-05-19 Fernando Perez <fperez@colorado.edu>
465
470
466 * IPython/iplib.py (safe_execfile): close a file which could be
471 * IPython/iplib.py (safe_execfile): close a file which could be
467 left open (causing problems in win32, which locks open files).
472 left open (causing problems in win32, which locks open files).
468 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
473 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
469
474
470 2005-05-18 Fernando Perez <fperez@colorado.edu>
475 2005-05-18 Fernando Perez <fperez@colorado.edu>
471
476
472 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
477 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
473 keyword arguments correctly to safe_execfile().
478 keyword arguments correctly to safe_execfile().
474
479
475 2005-05-13 Fernando Perez <fperez@colorado.edu>
480 2005-05-13 Fernando Perez <fperez@colorado.edu>
476
481
477 * ipython.1: Added info about Qt to manpage, and threads warning
482 * ipython.1: Added info about Qt to manpage, and threads warning
478 to usage page (invoked with --help).
483 to usage page (invoked with --help).
479
484
480 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
485 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
481 new matcher (it goes at the end of the priority list) to do
486 new matcher (it goes at the end of the priority list) to do
482 tab-completion on named function arguments. Submitted by George
487 tab-completion on named function arguments. Submitted by George
483 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
488 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
484 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
489 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
485 for more details.
490 for more details.
486
491
487 * IPython/Magic.py (magic_run): Added new -e flag to ignore
492 * IPython/Magic.py (magic_run): Added new -e flag to ignore
488 SystemExit exceptions in the script being run. Thanks to a report
493 SystemExit exceptions in the script being run. Thanks to a report
489 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
494 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
490 producing very annoying behavior when running unit tests.
495 producing very annoying behavior when running unit tests.
491
496
492 2005-05-12 Fernando Perez <fperez@colorado.edu>
497 2005-05-12 Fernando Perez <fperez@colorado.edu>
493
498
494 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
499 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
495 which I'd broken (again) due to a changed regexp. In the process,
500 which I'd broken (again) due to a changed regexp. In the process,
496 added ';' as an escape to auto-quote the whole line without
501 added ';' as an escape to auto-quote the whole line without
497 splitting its arguments. Thanks to a report by Jerry McRae
502 splitting its arguments. Thanks to a report by Jerry McRae
498 <qrs0xyc02-AT-sneakemail.com>.
503 <qrs0xyc02-AT-sneakemail.com>.
499
504
500 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
505 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
501 possible crashes caused by a TokenError. Reported by Ed Schofield
506 possible crashes caused by a TokenError. Reported by Ed Schofield
502 <schofield-AT-ftw.at>.
507 <schofield-AT-ftw.at>.
503
508
504 2005-05-06 Fernando Perez <fperez@colorado.edu>
509 2005-05-06 Fernando Perez <fperez@colorado.edu>
505
510
506 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
511 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
507
512
508 2005-04-29 Fernando Perez <fperez@colorado.edu>
513 2005-04-29 Fernando Perez <fperez@colorado.edu>
509
514
510 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
515 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
511 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
516 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
512 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
517 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
513 which provides support for Qt interactive usage (similar to the
518 which provides support for Qt interactive usage (similar to the
514 existing one for WX and GTK). This had been often requested.
519 existing one for WX and GTK). This had been often requested.
515
520
516 2005-04-14 *** Released version 0.6.13
521 2005-04-14 *** Released version 0.6.13
517
522
518 2005-04-08 Fernando Perez <fperez@colorado.edu>
523 2005-04-08 Fernando Perez <fperez@colorado.edu>
519
524
520 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
525 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
521 from _ofind, which gets called on almost every input line. Now,
526 from _ofind, which gets called on almost every input line. Now,
522 we only try to get docstrings if they are actually going to be
527 we only try to get docstrings if they are actually going to be
523 used (the overhead of fetching unnecessary docstrings can be
528 used (the overhead of fetching unnecessary docstrings can be
524 noticeable for certain objects, such as Pyro proxies).
529 noticeable for certain objects, such as Pyro proxies).
525
530
526 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
531 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
527 for completers. For some reason I had been passing them the state
532 for completers. For some reason I had been passing them the state
528 variable, which completers never actually need, and was in
533 variable, which completers never actually need, and was in
529 conflict with the rlcompleter API. Custom completers ONLY need to
534 conflict with the rlcompleter API. Custom completers ONLY need to
530 take the text parameter.
535 take the text parameter.
531
536
532 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
537 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
533 work correctly in pysh. I've also moved all the logic which used
538 work correctly in pysh. I've also moved all the logic which used
534 to be in pysh.py here, which will prevent problems with future
539 to be in pysh.py here, which will prevent problems with future
535 upgrades. However, this time I must warn users to update their
540 upgrades. However, this time I must warn users to update their
536 pysh profile to include the line
541 pysh profile to include the line
537
542
538 import_all IPython.Extensions.InterpreterExec
543 import_all IPython.Extensions.InterpreterExec
539
544
540 because otherwise things won't work for them. They MUST also
545 because otherwise things won't work for them. They MUST also
541 delete pysh.py and the line
546 delete pysh.py and the line
542
547
543 execfile pysh.py
548 execfile pysh.py
544
549
545 from their ipythonrc-pysh.
550 from their ipythonrc-pysh.
546
551
547 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
552 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
548 robust in the face of objects whose dir() returns non-strings
553 robust in the face of objects whose dir() returns non-strings
549 (which it shouldn't, but some broken libs like ITK do). Thanks to
554 (which it shouldn't, but some broken libs like ITK do). Thanks to
550 a patch by John Hunter (implemented differently, though). Also
555 a patch by John Hunter (implemented differently, though). Also
551 minor improvements by using .extend instead of + on lists.
556 minor improvements by using .extend instead of + on lists.
552
557
553 * pysh.py:
558 * pysh.py:
554
559
555 2005-04-06 Fernando Perez <fperez@colorado.edu>
560 2005-04-06 Fernando Perez <fperez@colorado.edu>
556
561
557 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
562 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
558 by default, so that all users benefit from it. Those who don't
563 by default, so that all users benefit from it. Those who don't
559 want it can still turn it off.
564 want it can still turn it off.
560
565
561 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
566 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
562 config file, I'd forgotten about this, so users were getting it
567 config file, I'd forgotten about this, so users were getting it
563 off by default.
568 off by default.
564
569
565 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
570 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
566 consistency. Now magics can be called in multiline statements,
571 consistency. Now magics can be called in multiline statements,
567 and python variables can be expanded in magic calls via $var.
572 and python variables can be expanded in magic calls via $var.
568 This makes the magic system behave just like aliases or !system
573 This makes the magic system behave just like aliases or !system
569 calls.
574 calls.
570
575
571 2005-03-28 Fernando Perez <fperez@colorado.edu>
576 2005-03-28 Fernando Perez <fperez@colorado.edu>
572
577
573 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
578 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
574 expensive string additions for building command. Add support for
579 expensive string additions for building command. Add support for
575 trailing ';' when autocall is used.
580 trailing ';' when autocall is used.
576
581
577 2005-03-26 Fernando Perez <fperez@colorado.edu>
582 2005-03-26 Fernando Perez <fperez@colorado.edu>
578
583
579 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
584 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
580 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
585 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
581 ipython.el robust against prompts with any number of spaces
586 ipython.el robust against prompts with any number of spaces
582 (including 0) after the ':' character.
587 (including 0) after the ':' character.
583
588
584 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
589 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
585 continuation prompt, which misled users to think the line was
590 continuation prompt, which misled users to think the line was
586 already indented. Closes debian Bug#300847, reported to me by
591 already indented. Closes debian Bug#300847, reported to me by
587 Norbert Tretkowski <tretkowski-AT-inittab.de>.
592 Norbert Tretkowski <tretkowski-AT-inittab.de>.
588
593
589 2005-03-23 Fernando Perez <fperez@colorado.edu>
594 2005-03-23 Fernando Perez <fperez@colorado.edu>
590
595
591 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
596 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
592 properly aligned if they have embedded newlines.
597 properly aligned if they have embedded newlines.
593
598
594 * IPython/iplib.py (runlines): Add a public method to expose
599 * IPython/iplib.py (runlines): Add a public method to expose
595 IPython's code execution machinery, so that users can run strings
600 IPython's code execution machinery, so that users can run strings
596 as if they had been typed at the prompt interactively.
601 as if they had been typed at the prompt interactively.
597 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
602 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
598 methods which can call the system shell, but with python variable
603 methods which can call the system shell, but with python variable
599 expansion. The three such methods are: __IPYTHON__.system,
604 expansion. The three such methods are: __IPYTHON__.system,
600 .getoutput and .getoutputerror. These need to be documented in a
605 .getoutput and .getoutputerror. These need to be documented in a
601 'public API' section (to be written) of the manual.
606 'public API' section (to be written) of the manual.
602
607
603 2005-03-20 Fernando Perez <fperez@colorado.edu>
608 2005-03-20 Fernando Perez <fperez@colorado.edu>
604
609
605 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
610 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
606 for custom exception handling. This is quite powerful, and it
611 for custom exception handling. This is quite powerful, and it
607 allows for user-installable exception handlers which can trap
612 allows for user-installable exception handlers which can trap
608 custom exceptions at runtime and treat them separately from
613 custom exceptions at runtime and treat them separately from
609 IPython's default mechanisms. At the request of Frédéric
614 IPython's default mechanisms. At the request of Frédéric
610 Mantegazza <mantegazza-AT-ill.fr>.
615 Mantegazza <mantegazza-AT-ill.fr>.
611 (InteractiveShell.set_custom_completer): public API function to
616 (InteractiveShell.set_custom_completer): public API function to
612 add new completers at runtime.
617 add new completers at runtime.
613
618
614 2005-03-19 Fernando Perez <fperez@colorado.edu>
619 2005-03-19 Fernando Perez <fperez@colorado.edu>
615
620
616 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
621 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
617 allow objects which provide their docstrings via non-standard
622 allow objects which provide their docstrings via non-standard
618 mechanisms (like Pyro proxies) to still be inspected by ipython's
623 mechanisms (like Pyro proxies) to still be inspected by ipython's
619 ? system.
624 ? system.
620
625
621 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
626 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
622 automatic capture system. I tried quite hard to make it work
627 automatic capture system. I tried quite hard to make it work
623 reliably, and simply failed. I tried many combinations with the
628 reliably, and simply failed. I tried many combinations with the
624 subprocess module, but eventually nothing worked in all needed
629 subprocess module, but eventually nothing worked in all needed
625 cases (not blocking stdin for the child, duplicating stdout
630 cases (not blocking stdin for the child, duplicating stdout
626 without blocking, etc). The new %sc/%sx still do capture to these
631 without blocking, etc). The new %sc/%sx still do capture to these
627 magical list/string objects which make shell use much more
632 magical list/string objects which make shell use much more
628 conveninent, so not all is lost.
633 conveninent, so not all is lost.
629
634
630 XXX - FIX MANUAL for the change above!
635 XXX - FIX MANUAL for the change above!
631
636
632 (runsource): I copied code.py's runsource() into ipython to modify
637 (runsource): I copied code.py's runsource() into ipython to modify
633 it a bit. Now the code object and source to be executed are
638 it a bit. Now the code object and source to be executed are
634 stored in ipython. This makes this info accessible to third-party
639 stored in ipython. This makes this info accessible to third-party
635 tools, like custom exception handlers. After a request by Frédéric
640 tools, like custom exception handlers. After a request by Frédéric
636 Mantegazza <mantegazza-AT-ill.fr>.
641 Mantegazza <mantegazza-AT-ill.fr>.
637
642
638 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
643 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
639 history-search via readline (like C-p/C-n). I'd wanted this for a
644 history-search via readline (like C-p/C-n). I'd wanted this for a
640 long time, but only recently found out how to do it. For users
645 long time, but only recently found out how to do it. For users
641 who already have their ipythonrc files made and want this, just
646 who already have their ipythonrc files made and want this, just
642 add:
647 add:
643
648
644 readline_parse_and_bind "\e[A": history-search-backward
649 readline_parse_and_bind "\e[A": history-search-backward
645 readline_parse_and_bind "\e[B": history-search-forward
650 readline_parse_and_bind "\e[B": history-search-forward
646
651
647 2005-03-18 Fernando Perez <fperez@colorado.edu>
652 2005-03-18 Fernando Perez <fperez@colorado.edu>
648
653
649 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
654 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
650 LSString and SList classes which allow transparent conversions
655 LSString and SList classes which allow transparent conversions
651 between list mode and whitespace-separated string.
656 between list mode and whitespace-separated string.
652 (magic_r): Fix recursion problem in %r.
657 (magic_r): Fix recursion problem in %r.
653
658
654 * IPython/genutils.py (LSString): New class to be used for
659 * IPython/genutils.py (LSString): New class to be used for
655 automatic storage of the results of all alias/system calls in _o
660 automatic storage of the results of all alias/system calls in _o
656 and _e (stdout/err). These provide a .l/.list attribute which
661 and _e (stdout/err). These provide a .l/.list attribute which
657 does automatic splitting on newlines. This means that for most
662 does automatic splitting on newlines. This means that for most
658 uses, you'll never need to do capturing of output with %sc/%sx
663 uses, you'll never need to do capturing of output with %sc/%sx
659 anymore, since ipython keeps this always done for you. Note that
664 anymore, since ipython keeps this always done for you. Note that
660 only the LAST results are stored, the _o/e variables are
665 only the LAST results are stored, the _o/e variables are
661 overwritten on each call. If you need to save their contents
666 overwritten on each call. If you need to save their contents
662 further, simply bind them to any other name.
667 further, simply bind them to any other name.
663
668
664 2005-03-17 Fernando Perez <fperez@colorado.edu>
669 2005-03-17 Fernando Perez <fperez@colorado.edu>
665
670
666 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
671 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
667 prompt namespace handling.
672 prompt namespace handling.
668
673
669 2005-03-16 Fernando Perez <fperez@colorado.edu>
674 2005-03-16 Fernando Perez <fperez@colorado.edu>
670
675
671 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
676 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
672 classic prompts to be '>>> ' (final space was missing, and it
677 classic prompts to be '>>> ' (final space was missing, and it
673 trips the emacs python mode).
678 trips the emacs python mode).
674 (BasePrompt.__str__): Added safe support for dynamic prompt
679 (BasePrompt.__str__): Added safe support for dynamic prompt
675 strings. Now you can set your prompt string to be '$x', and the
680 strings. Now you can set your prompt string to be '$x', and the
676 value of x will be printed from your interactive namespace. The
681 value of x will be printed from your interactive namespace. The
677 interpolation syntax includes the full Itpl support, so
682 interpolation syntax includes the full Itpl support, so
678 ${foo()+x+bar()} is a valid prompt string now, and the function
683 ${foo()+x+bar()} is a valid prompt string now, and the function
679 calls will be made at runtime.
684 calls will be made at runtime.
680
685
681 2005-03-15 Fernando Perez <fperez@colorado.edu>
686 2005-03-15 Fernando Perez <fperez@colorado.edu>
682
687
683 * IPython/Magic.py (magic_history): renamed %hist to %history, to
688 * IPython/Magic.py (magic_history): renamed %hist to %history, to
684 avoid name clashes in pylab. %hist still works, it just forwards
689 avoid name clashes in pylab. %hist still works, it just forwards
685 the call to %history.
690 the call to %history.
686
691
687 2005-03-02 *** Released version 0.6.12
692 2005-03-02 *** Released version 0.6.12
688
693
689 2005-03-02 Fernando Perez <fperez@colorado.edu>
694 2005-03-02 Fernando Perez <fperez@colorado.edu>
690
695
691 * IPython/iplib.py (handle_magic): log magic calls properly as
696 * IPython/iplib.py (handle_magic): log magic calls properly as
692 ipmagic() function calls.
697 ipmagic() function calls.
693
698
694 * IPython/Magic.py (magic_time): Improved %time to support
699 * IPython/Magic.py (magic_time): Improved %time to support
695 statements and provide wall-clock as well as CPU time.
700 statements and provide wall-clock as well as CPU time.
696
701
697 2005-02-27 Fernando Perez <fperez@colorado.edu>
702 2005-02-27 Fernando Perez <fperez@colorado.edu>
698
703
699 * IPython/hooks.py: New hooks module, to expose user-modifiable
704 * IPython/hooks.py: New hooks module, to expose user-modifiable
700 IPython functionality in a clean manner. For now only the editor
705 IPython functionality in a clean manner. For now only the editor
701 hook is actually written, and other thigns which I intend to turn
706 hook is actually written, and other thigns which I intend to turn
702 into proper hooks aren't yet there. The display and prefilter
707 into proper hooks aren't yet there. The display and prefilter
703 stuff, for example, should be hooks. But at least now the
708 stuff, for example, should be hooks. But at least now the
704 framework is in place, and the rest can be moved here with more
709 framework is in place, and the rest can be moved here with more
705 time later. IPython had had a .hooks variable for a long time for
710 time later. IPython had had a .hooks variable for a long time for
706 this purpose, but I'd never actually used it for anything.
711 this purpose, but I'd never actually used it for anything.
707
712
708 2005-02-26 Fernando Perez <fperez@colorado.edu>
713 2005-02-26 Fernando Perez <fperez@colorado.edu>
709
714
710 * IPython/ipmaker.py (make_IPython): make the default ipython
715 * IPython/ipmaker.py (make_IPython): make the default ipython
711 directory be called _ipython under win32, to follow more the
716 directory be called _ipython under win32, to follow more the
712 naming peculiarities of that platform (where buggy software like
717 naming peculiarities of that platform (where buggy software like
713 Visual Sourcesafe breaks with .named directories). Reported by
718 Visual Sourcesafe breaks with .named directories). Reported by
714 Ville Vainio.
719 Ville Vainio.
715
720
716 2005-02-23 Fernando Perez <fperez@colorado.edu>
721 2005-02-23 Fernando Perez <fperez@colorado.edu>
717
722
718 * IPython/iplib.py (InteractiveShell.__init__): removed a few
723 * IPython/iplib.py (InteractiveShell.__init__): removed a few
719 auto_aliases for win32 which were causing problems. Users can
724 auto_aliases for win32 which were causing problems. Users can
720 define the ones they personally like.
725 define the ones they personally like.
721
726
722 2005-02-21 Fernando Perez <fperez@colorado.edu>
727 2005-02-21 Fernando Perez <fperez@colorado.edu>
723
728
724 * IPython/Magic.py (magic_time): new magic to time execution of
729 * IPython/Magic.py (magic_time): new magic to time execution of
725 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
730 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
726
731
727 2005-02-19 Fernando Perez <fperez@colorado.edu>
732 2005-02-19 Fernando Perez <fperez@colorado.edu>
728
733
729 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
734 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
730 into keys (for prompts, for example).
735 into keys (for prompts, for example).
731
736
732 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
737 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
733 prompts in case users want them. This introduces a small behavior
738 prompts in case users want them. This introduces a small behavior
734 change: ipython does not automatically add a space to all prompts
739 change: ipython does not automatically add a space to all prompts
735 anymore. To get the old prompts with a space, users should add it
740 anymore. To get the old prompts with a space, users should add it
736 manually to their ipythonrc file, so for example prompt_in1 should
741 manually to their ipythonrc file, so for example prompt_in1 should
737 now read 'In [\#]: ' instead of 'In [\#]:'.
742 now read 'In [\#]: ' instead of 'In [\#]:'.
738 (BasePrompt.__init__): New option prompts_pad_left (only in rc
743 (BasePrompt.__init__): New option prompts_pad_left (only in rc
739 file) to control left-padding of secondary prompts.
744 file) to control left-padding of secondary prompts.
740
745
741 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
746 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
742 the profiler can't be imported. Fix for Debian, which removed
747 the profiler can't be imported. Fix for Debian, which removed
743 profile.py because of License issues. I applied a slightly
748 profile.py because of License issues. I applied a slightly
744 modified version of the original Debian patch at
749 modified version of the original Debian patch at
745 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
750 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
746
751
747 2005-02-17 Fernando Perez <fperez@colorado.edu>
752 2005-02-17 Fernando Perez <fperez@colorado.edu>
748
753
749 * IPython/genutils.py (native_line_ends): Fix bug which would
754 * IPython/genutils.py (native_line_ends): Fix bug which would
750 cause improper line-ends under win32 b/c I was not opening files
755 cause improper line-ends under win32 b/c I was not opening files
751 in binary mode. Bug report and fix thanks to Ville.
756 in binary mode. Bug report and fix thanks to Ville.
752
757
753 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
758 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
754 trying to catch spurious foo[1] autocalls. My fix actually broke
759 trying to catch spurious foo[1] autocalls. My fix actually broke
755 ',/' autoquote/call with explicit escape (bad regexp).
760 ',/' autoquote/call with explicit escape (bad regexp).
756
761
757 2005-02-15 *** Released version 0.6.11
762 2005-02-15 *** Released version 0.6.11
758
763
759 2005-02-14 Fernando Perez <fperez@colorado.edu>
764 2005-02-14 Fernando Perez <fperez@colorado.edu>
760
765
761 * IPython/background_jobs.py: New background job management
766 * IPython/background_jobs.py: New background job management
762 subsystem. This is implemented via a new set of classes, and
767 subsystem. This is implemented via a new set of classes, and
763 IPython now provides a builtin 'jobs' object for background job
768 IPython now provides a builtin 'jobs' object for background job
764 execution. A convenience %bg magic serves as a lightweight
769 execution. A convenience %bg magic serves as a lightweight
765 frontend for starting the more common type of calls. This was
770 frontend for starting the more common type of calls. This was
766 inspired by discussions with B. Granger and the BackgroundCommand
771 inspired by discussions with B. Granger and the BackgroundCommand
767 class described in the book Python Scripting for Computational
772 class described in the book Python Scripting for Computational
768 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
773 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
769 (although ultimately no code from this text was used, as IPython's
774 (although ultimately no code from this text was used, as IPython's
770 system is a separate implementation).
775 system is a separate implementation).
771
776
772 * IPython/iplib.py (MagicCompleter.python_matches): add new option
777 * IPython/iplib.py (MagicCompleter.python_matches): add new option
773 to control the completion of single/double underscore names
778 to control the completion of single/double underscore names
774 separately. As documented in the example ipytonrc file, the
779 separately. As documented in the example ipytonrc file, the
775 readline_omit__names variable can now be set to 2, to omit even
780 readline_omit__names variable can now be set to 2, to omit even
776 single underscore names. Thanks to a patch by Brian Wong
781 single underscore names. Thanks to a patch by Brian Wong
777 <BrianWong-AT-AirgoNetworks.Com>.
782 <BrianWong-AT-AirgoNetworks.Com>.
778 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
783 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
779 be autocalled as foo([1]) if foo were callable. A problem for
784 be autocalled as foo([1]) if foo were callable. A problem for
780 things which are both callable and implement __getitem__.
785 things which are both callable and implement __getitem__.
781 (init_readline): Fix autoindentation for win32. Thanks to a patch
786 (init_readline): Fix autoindentation for win32. Thanks to a patch
782 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
787 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
783
788
784 2005-02-12 Fernando Perez <fperez@colorado.edu>
789 2005-02-12 Fernando Perez <fperez@colorado.edu>
785
790
786 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
791 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
787 which I had written long ago to sort out user error messages which
792 which I had written long ago to sort out user error messages which
788 may occur during startup. This seemed like a good idea initially,
793 may occur during startup. This seemed like a good idea initially,
789 but it has proven a disaster in retrospect. I don't want to
794 but it has proven a disaster in retrospect. I don't want to
790 change much code for now, so my fix is to set the internal 'debug'
795 change much code for now, so my fix is to set the internal 'debug'
791 flag to true everywhere, whose only job was precisely to control
796 flag to true everywhere, whose only job was precisely to control
792 this subsystem. This closes issue 28 (as well as avoiding all
797 this subsystem. This closes issue 28 (as well as avoiding all
793 sorts of strange hangups which occur from time to time).
798 sorts of strange hangups which occur from time to time).
794
799
795 2005-02-07 Fernando Perez <fperez@colorado.edu>
800 2005-02-07 Fernando Perez <fperez@colorado.edu>
796
801
797 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
802 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
798 previous call produced a syntax error.
803 previous call produced a syntax error.
799
804
800 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
805 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
801 classes without constructor.
806 classes without constructor.
802
807
803 2005-02-06 Fernando Perez <fperez@colorado.edu>
808 2005-02-06 Fernando Perez <fperez@colorado.edu>
804
809
805 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
810 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
806 completions with the results of each matcher, so we return results
811 completions with the results of each matcher, so we return results
807 to the user from all namespaces. This breaks with ipython
812 to the user from all namespaces. This breaks with ipython
808 tradition, but I think it's a nicer behavior. Now you get all
813 tradition, but I think it's a nicer behavior. Now you get all
809 possible completions listed, from all possible namespaces (python,
814 possible completions listed, from all possible namespaces (python,
810 filesystem, magics...) After a request by John Hunter
815 filesystem, magics...) After a request by John Hunter
811 <jdhunter-AT-nitace.bsd.uchicago.edu>.
816 <jdhunter-AT-nitace.bsd.uchicago.edu>.
812
817
813 2005-02-05 Fernando Perez <fperez@colorado.edu>
818 2005-02-05 Fernando Perez <fperez@colorado.edu>
814
819
815 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
820 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
816 the call had quote characters in it (the quotes were stripped).
821 the call had quote characters in it (the quotes were stripped).
817
822
818 2005-01-31 Fernando Perez <fperez@colorado.edu>
823 2005-01-31 Fernando Perez <fperez@colorado.edu>
819
824
820 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
825 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
821 Itpl.itpl() to make the code more robust against psyco
826 Itpl.itpl() to make the code more robust against psyco
822 optimizations.
827 optimizations.
823
828
824 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
829 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
825 of causing an exception. Quicker, cleaner.
830 of causing an exception. Quicker, cleaner.
826
831
827 2005-01-28 Fernando Perez <fperez@colorado.edu>
832 2005-01-28 Fernando Perez <fperez@colorado.edu>
828
833
829 * scripts/ipython_win_post_install.py (install): hardcode
834 * scripts/ipython_win_post_install.py (install): hardcode
830 sys.prefix+'python.exe' as the executable path. It turns out that
835 sys.prefix+'python.exe' as the executable path. It turns out that
831 during the post-installation run, sys.executable resolves to the
836 during the post-installation run, sys.executable resolves to the
832 name of the binary installer! I should report this as a distutils
837 name of the binary installer! I should report this as a distutils
833 bug, I think. I updated the .10 release with this tiny fix, to
838 bug, I think. I updated the .10 release with this tiny fix, to
834 avoid annoying the lists further.
839 avoid annoying the lists further.
835
840
836 2005-01-27 *** Released version 0.6.10
841 2005-01-27 *** Released version 0.6.10
837
842
838 2005-01-27 Fernando Perez <fperez@colorado.edu>
843 2005-01-27 Fernando Perez <fperez@colorado.edu>
839
844
840 * IPython/numutils.py (norm): Added 'inf' as optional name for
845 * IPython/numutils.py (norm): Added 'inf' as optional name for
841 L-infinity norm, included references to mathworld.com for vector
846 L-infinity norm, included references to mathworld.com for vector
842 norm definitions.
847 norm definitions.
843 (amin/amax): added amin/amax for array min/max. Similar to what
848 (amin/amax): added amin/amax for array min/max. Similar to what
844 pylab ships with after the recent reorganization of names.
849 pylab ships with after the recent reorganization of names.
845 (spike/spike_odd): removed deprecated spike/spike_odd functions.
850 (spike/spike_odd): removed deprecated spike/spike_odd functions.
846
851
847 * ipython.el: committed Alex's recent fixes and improvements.
852 * ipython.el: committed Alex's recent fixes and improvements.
848 Tested with python-mode from CVS, and it looks excellent. Since
853 Tested with python-mode from CVS, and it looks excellent. Since
849 python-mode hasn't released anything in a while, I'm temporarily
854 python-mode hasn't released anything in a while, I'm temporarily
850 putting a copy of today's CVS (v 4.70) of python-mode in:
855 putting a copy of today's CVS (v 4.70) of python-mode in:
851 http://ipython.scipy.org/tmp/python-mode.el
856 http://ipython.scipy.org/tmp/python-mode.el
852
857
853 * scripts/ipython_win_post_install.py (install): Win32 fix to use
858 * scripts/ipython_win_post_install.py (install): Win32 fix to use
854 sys.executable for the executable name, instead of assuming it's
859 sys.executable for the executable name, instead of assuming it's
855 called 'python.exe' (the post-installer would have produced broken
860 called 'python.exe' (the post-installer would have produced broken
856 setups on systems with a differently named python binary).
861 setups on systems with a differently named python binary).
857
862
858 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
863 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
859 references to os.linesep, to make the code more
864 references to os.linesep, to make the code more
860 platform-independent. This is also part of the win32 coloring
865 platform-independent. This is also part of the win32 coloring
861 fixes.
866 fixes.
862
867
863 * IPython/genutils.py (page_dumb): Remove attempts to chop long
868 * IPython/genutils.py (page_dumb): Remove attempts to chop long
864 lines, which actually cause coloring bugs because the length of
869 lines, which actually cause coloring bugs because the length of
865 the line is very difficult to correctly compute with embedded
870 the line is very difficult to correctly compute with embedded
866 escapes. This was the source of all the coloring problems under
871 escapes. This was the source of all the coloring problems under
867 Win32. I think that _finally_, Win32 users have a properly
872 Win32. I think that _finally_, Win32 users have a properly
868 working ipython in all respects. This would never have happened
873 working ipython in all respects. This would never have happened
869 if not for Gary Bishop and Viktor Ransmayr's great help and work.
874 if not for Gary Bishop and Viktor Ransmayr's great help and work.
870
875
871 2005-01-26 *** Released version 0.6.9
876 2005-01-26 *** Released version 0.6.9
872
877
873 2005-01-25 Fernando Perez <fperez@colorado.edu>
878 2005-01-25 Fernando Perez <fperez@colorado.edu>
874
879
875 * setup.py: finally, we have a true Windows installer, thanks to
880 * setup.py: finally, we have a true Windows installer, thanks to
876 the excellent work of Viktor Ransmayr
881 the excellent work of Viktor Ransmayr
877 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
882 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
878 Windows users. The setup routine is quite a bit cleaner thanks to
883 Windows users. The setup routine is quite a bit cleaner thanks to
879 this, and the post-install script uses the proper functions to
884 this, and the post-install script uses the proper functions to
880 allow a clean de-installation using the standard Windows Control
885 allow a clean de-installation using the standard Windows Control
881 Panel.
886 Panel.
882
887
883 * IPython/genutils.py (get_home_dir): changed to use the $HOME
888 * IPython/genutils.py (get_home_dir): changed to use the $HOME
884 environment variable under all OSes (including win32) if
889 environment variable under all OSes (including win32) if
885 available. This will give consistency to win32 users who have set
890 available. This will give consistency to win32 users who have set
886 this variable for any reason. If os.environ['HOME'] fails, the
891 this variable for any reason. If os.environ['HOME'] fails, the
887 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
892 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
888
893
889 2005-01-24 Fernando Perez <fperez@colorado.edu>
894 2005-01-24 Fernando Perez <fperez@colorado.edu>
890
895
891 * IPython/numutils.py (empty_like): add empty_like(), similar to
896 * IPython/numutils.py (empty_like): add empty_like(), similar to
892 zeros_like() but taking advantage of the new empty() Numeric routine.
897 zeros_like() but taking advantage of the new empty() Numeric routine.
893
898
894 2005-01-23 *** Released version 0.6.8
899 2005-01-23 *** Released version 0.6.8
895
900
896 2005-01-22 Fernando Perez <fperez@colorado.edu>
901 2005-01-22 Fernando Perez <fperez@colorado.edu>
897
902
898 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
903 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
899 automatic show() calls. After discussing things with JDH, it
904 automatic show() calls. After discussing things with JDH, it
900 turns out there are too many corner cases where this can go wrong.
905 turns out there are too many corner cases where this can go wrong.
901 It's best not to try to be 'too smart', and simply have ipython
906 It's best not to try to be 'too smart', and simply have ipython
902 reproduce as much as possible the default behavior of a normal
907 reproduce as much as possible the default behavior of a normal
903 python shell.
908 python shell.
904
909
905 * IPython/iplib.py (InteractiveShell.__init__): Modified the
910 * IPython/iplib.py (InteractiveShell.__init__): Modified the
906 line-splitting regexp and _prefilter() to avoid calling getattr()
911 line-splitting regexp and _prefilter() to avoid calling getattr()
907 on assignments. This closes
912 on assignments. This closes
908 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
913 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
909 readline uses getattr(), so a simple <TAB> keypress is still
914 readline uses getattr(), so a simple <TAB> keypress is still
910 enough to trigger getattr() calls on an object.
915 enough to trigger getattr() calls on an object.
911
916
912 2005-01-21 Fernando Perez <fperez@colorado.edu>
917 2005-01-21 Fernando Perez <fperez@colorado.edu>
913
918
914 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
919 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
915 docstring under pylab so it doesn't mask the original.
920 docstring under pylab so it doesn't mask the original.
916
921
917 2005-01-21 *** Released version 0.6.7
922 2005-01-21 *** Released version 0.6.7
918
923
919 2005-01-21 Fernando Perez <fperez@colorado.edu>
924 2005-01-21 Fernando Perez <fperez@colorado.edu>
920
925
921 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
926 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
922 signal handling for win32 users in multithreaded mode.
927 signal handling for win32 users in multithreaded mode.
923
928
924 2005-01-17 Fernando Perez <fperez@colorado.edu>
929 2005-01-17 Fernando Perez <fperez@colorado.edu>
925
930
926 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
931 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
927 instances with no __init__. After a crash report by Norbert Nemec
932 instances with no __init__. After a crash report by Norbert Nemec
928 <Norbert-AT-nemec-online.de>.
933 <Norbert-AT-nemec-online.de>.
929
934
930 2005-01-14 Fernando Perez <fperez@colorado.edu>
935 2005-01-14 Fernando Perez <fperez@colorado.edu>
931
936
932 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
937 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
933 names for verbose exceptions, when multiple dotted names and the
938 names for verbose exceptions, when multiple dotted names and the
934 'parent' object were present on the same line.
939 'parent' object were present on the same line.
935
940
936 2005-01-11 Fernando Perez <fperez@colorado.edu>
941 2005-01-11 Fernando Perez <fperez@colorado.edu>
937
942
938 * IPython/genutils.py (flag_calls): new utility to trap and flag
943 * IPython/genutils.py (flag_calls): new utility to trap and flag
939 calls in functions. I need it to clean up matplotlib support.
944 calls in functions. I need it to clean up matplotlib support.
940 Also removed some deprecated code in genutils.
945 Also removed some deprecated code in genutils.
941
946
942 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
947 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
943 that matplotlib scripts called with %run, which don't call show()
948 that matplotlib scripts called with %run, which don't call show()
944 themselves, still have their plotting windows open.
949 themselves, still have their plotting windows open.
945
950
946 2005-01-05 Fernando Perez <fperez@colorado.edu>
951 2005-01-05 Fernando Perez <fperez@colorado.edu>
947
952
948 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
953 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
949 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
954 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
950
955
951 2004-12-19 Fernando Perez <fperez@colorado.edu>
956 2004-12-19 Fernando Perez <fperez@colorado.edu>
952
957
953 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
958 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
954 parent_runcode, which was an eyesore. The same result can be
959 parent_runcode, which was an eyesore. The same result can be
955 obtained with Python's regular superclass mechanisms.
960 obtained with Python's regular superclass mechanisms.
956
961
957 2004-12-17 Fernando Perez <fperez@colorado.edu>
962 2004-12-17 Fernando Perez <fperez@colorado.edu>
958
963
959 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
964 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
960 reported by Prabhu.
965 reported by Prabhu.
961 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
966 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
962 sys.stderr) instead of explicitly calling sys.stderr. This helps
967 sys.stderr) instead of explicitly calling sys.stderr. This helps
963 maintain our I/O abstractions clean, for future GUI embeddings.
968 maintain our I/O abstractions clean, for future GUI embeddings.
964
969
965 * IPython/genutils.py (info): added new utility for sys.stderr
970 * IPython/genutils.py (info): added new utility for sys.stderr
966 unified info message handling (thin wrapper around warn()).
971 unified info message handling (thin wrapper around warn()).
967
972
968 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
973 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
969 composite (dotted) names on verbose exceptions.
974 composite (dotted) names on verbose exceptions.
970 (VerboseTB.nullrepr): harden against another kind of errors which
975 (VerboseTB.nullrepr): harden against another kind of errors which
971 Python's inspect module can trigger, and which were crashing
976 Python's inspect module can trigger, and which were crashing
972 IPython. Thanks to a report by Marco Lombardi
977 IPython. Thanks to a report by Marco Lombardi
973 <mlombard-AT-ma010192.hq.eso.org>.
978 <mlombard-AT-ma010192.hq.eso.org>.
974
979
975 2004-12-13 *** Released version 0.6.6
980 2004-12-13 *** Released version 0.6.6
976
981
977 2004-12-12 Fernando Perez <fperez@colorado.edu>
982 2004-12-12 Fernando Perez <fperez@colorado.edu>
978
983
979 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
984 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
980 generated by pygtk upon initialization if it was built without
985 generated by pygtk upon initialization if it was built without
981 threads (for matplotlib users). After a crash reported by
986 threads (for matplotlib users). After a crash reported by
982 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
987 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
983
988
984 * IPython/ipmaker.py (make_IPython): fix small bug in the
989 * IPython/ipmaker.py (make_IPython): fix small bug in the
985 import_some parameter for multiple imports.
990 import_some parameter for multiple imports.
986
991
987 * IPython/iplib.py (ipmagic): simplified the interface of
992 * IPython/iplib.py (ipmagic): simplified the interface of
988 ipmagic() to take a single string argument, just as it would be
993 ipmagic() to take a single string argument, just as it would be
989 typed at the IPython cmd line.
994 typed at the IPython cmd line.
990 (ipalias): Added new ipalias() with an interface identical to
995 (ipalias): Added new ipalias() with an interface identical to
991 ipmagic(). This completes exposing a pure python interface to the
996 ipmagic(). This completes exposing a pure python interface to the
992 alias and magic system, which can be used in loops or more complex
997 alias and magic system, which can be used in loops or more complex
993 code where IPython's automatic line mangling is not active.
998 code where IPython's automatic line mangling is not active.
994
999
995 * IPython/genutils.py (timing): changed interface of timing to
1000 * IPython/genutils.py (timing): changed interface of timing to
996 simply run code once, which is the most common case. timings()
1001 simply run code once, which is the most common case. timings()
997 remains unchanged, for the cases where you want multiple runs.
1002 remains unchanged, for the cases where you want multiple runs.
998
1003
999 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1004 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1000 bug where Python2.2 crashes with exec'ing code which does not end
1005 bug where Python2.2 crashes with exec'ing code which does not end
1001 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1006 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1002 before.
1007 before.
1003
1008
1004 2004-12-10 Fernando Perez <fperez@colorado.edu>
1009 2004-12-10 Fernando Perez <fperez@colorado.edu>
1005
1010
1006 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1011 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1007 -t to -T, to accomodate the new -t flag in %run (the %run and
1012 -t to -T, to accomodate the new -t flag in %run (the %run and
1008 %prun options are kind of intermixed, and it's not easy to change
1013 %prun options are kind of intermixed, and it's not easy to change
1009 this with the limitations of python's getopt).
1014 this with the limitations of python's getopt).
1010
1015
1011 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1016 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1012 the execution of scripts. It's not as fine-tuned as timeit.py,
1017 the execution of scripts. It's not as fine-tuned as timeit.py,
1013 but it works from inside ipython (and under 2.2, which lacks
1018 but it works from inside ipython (and under 2.2, which lacks
1014 timeit.py). Optionally a number of runs > 1 can be given for
1019 timeit.py). Optionally a number of runs > 1 can be given for
1015 timing very short-running code.
1020 timing very short-running code.
1016
1021
1017 * IPython/genutils.py (uniq_stable): new routine which returns a
1022 * IPython/genutils.py (uniq_stable): new routine which returns a
1018 list of unique elements in any iterable, but in stable order of
1023 list of unique elements in any iterable, but in stable order of
1019 appearance. I needed this for the ultraTB fixes, and it's a handy
1024 appearance. I needed this for the ultraTB fixes, and it's a handy
1020 utility.
1025 utility.
1021
1026
1022 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1027 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1023 dotted names in Verbose exceptions. This had been broken since
1028 dotted names in Verbose exceptions. This had been broken since
1024 the very start, now x.y will properly be printed in a Verbose
1029 the very start, now x.y will properly be printed in a Verbose
1025 traceback, instead of x being shown and y appearing always as an
1030 traceback, instead of x being shown and y appearing always as an
1026 'undefined global'. Getting this to work was a bit tricky,
1031 'undefined global'. Getting this to work was a bit tricky,
1027 because by default python tokenizers are stateless. Saved by
1032 because by default python tokenizers are stateless. Saved by
1028 python's ability to easily add a bit of state to an arbitrary
1033 python's ability to easily add a bit of state to an arbitrary
1029 function (without needing to build a full-blown callable object).
1034 function (without needing to build a full-blown callable object).
1030
1035
1031 Also big cleanup of this code, which had horrendous runtime
1036 Also big cleanup of this code, which had horrendous runtime
1032 lookups of zillions of attributes for colorization. Moved all
1037 lookups of zillions of attributes for colorization. Moved all
1033 this code into a few templates, which make it cleaner and quicker.
1038 this code into a few templates, which make it cleaner and quicker.
1034
1039
1035 Printout quality was also improved for Verbose exceptions: one
1040 Printout quality was also improved for Verbose exceptions: one
1036 variable per line, and memory addresses are printed (this can be
1041 variable per line, and memory addresses are printed (this can be
1037 quite handy in nasty debugging situations, which is what Verbose
1042 quite handy in nasty debugging situations, which is what Verbose
1038 is for).
1043 is for).
1039
1044
1040 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1045 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1041 the command line as scripts to be loaded by embedded instances.
1046 the command line as scripts to be loaded by embedded instances.
1042 Doing so has the potential for an infinite recursion if there are
1047 Doing so has the potential for an infinite recursion if there are
1043 exceptions thrown in the process. This fixes a strange crash
1048 exceptions thrown in the process. This fixes a strange crash
1044 reported by Philippe MULLER <muller-AT-irit.fr>.
1049 reported by Philippe MULLER <muller-AT-irit.fr>.
1045
1050
1046 2004-12-09 Fernando Perez <fperez@colorado.edu>
1051 2004-12-09 Fernando Perez <fperez@colorado.edu>
1047
1052
1048 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1053 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1049 to reflect new names in matplotlib, which now expose the
1054 to reflect new names in matplotlib, which now expose the
1050 matlab-compatible interface via a pylab module instead of the
1055 matlab-compatible interface via a pylab module instead of the
1051 'matlab' name. The new code is backwards compatible, so users of
1056 'matlab' name. The new code is backwards compatible, so users of
1052 all matplotlib versions are OK. Patch by J. Hunter.
1057 all matplotlib versions are OK. Patch by J. Hunter.
1053
1058
1054 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1059 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1055 of __init__ docstrings for instances (class docstrings are already
1060 of __init__ docstrings for instances (class docstrings are already
1056 automatically printed). Instances with customized docstrings
1061 automatically printed). Instances with customized docstrings
1057 (indep. of the class) are also recognized and all 3 separate
1062 (indep. of the class) are also recognized and all 3 separate
1058 docstrings are printed (instance, class, constructor). After some
1063 docstrings are printed (instance, class, constructor). After some
1059 comments/suggestions by J. Hunter.
1064 comments/suggestions by J. Hunter.
1060
1065
1061 2004-12-05 Fernando Perez <fperez@colorado.edu>
1066 2004-12-05 Fernando Perez <fperez@colorado.edu>
1062
1067
1063 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1068 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1064 warnings when tab-completion fails and triggers an exception.
1069 warnings when tab-completion fails and triggers an exception.
1065
1070
1066 2004-12-03 Fernando Perez <fperez@colorado.edu>
1071 2004-12-03 Fernando Perez <fperez@colorado.edu>
1067
1072
1068 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1073 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1069 be triggered when using 'run -p'. An incorrect option flag was
1074 be triggered when using 'run -p'. An incorrect option flag was
1070 being set ('d' instead of 'D').
1075 being set ('d' instead of 'D').
1071 (manpage): fix missing escaped \- sign.
1076 (manpage): fix missing escaped \- sign.
1072
1077
1073 2004-11-30 *** Released version 0.6.5
1078 2004-11-30 *** Released version 0.6.5
1074
1079
1075 2004-11-30 Fernando Perez <fperez@colorado.edu>
1080 2004-11-30 Fernando Perez <fperez@colorado.edu>
1076
1081
1077 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1082 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1078 setting with -d option.
1083 setting with -d option.
1079
1084
1080 * setup.py (docfiles): Fix problem where the doc glob I was using
1085 * setup.py (docfiles): Fix problem where the doc glob I was using
1081 was COMPLETELY BROKEN. It was giving the right files by pure
1086 was COMPLETELY BROKEN. It was giving the right files by pure
1082 accident, but failed once I tried to include ipython.el. Note:
1087 accident, but failed once I tried to include ipython.el. Note:
1083 glob() does NOT allow you to do exclusion on multiple endings!
1088 glob() does NOT allow you to do exclusion on multiple endings!
1084
1089
1085 2004-11-29 Fernando Perez <fperez@colorado.edu>
1090 2004-11-29 Fernando Perez <fperez@colorado.edu>
1086
1091
1087 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1092 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1088 the manpage as the source. Better formatting & consistency.
1093 the manpage as the source. Better formatting & consistency.
1089
1094
1090 * IPython/Magic.py (magic_run): Added new -d option, to run
1095 * IPython/Magic.py (magic_run): Added new -d option, to run
1091 scripts under the control of the python pdb debugger. Note that
1096 scripts under the control of the python pdb debugger. Note that
1092 this required changing the %prun option -d to -D, to avoid a clash
1097 this required changing the %prun option -d to -D, to avoid a clash
1093 (since %run must pass options to %prun, and getopt is too dumb to
1098 (since %run must pass options to %prun, and getopt is too dumb to
1094 handle options with string values with embedded spaces). Thanks
1099 handle options with string values with embedded spaces). Thanks
1095 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1100 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1096 (magic_who_ls): added type matching to %who and %whos, so that one
1101 (magic_who_ls): added type matching to %who and %whos, so that one
1097 can filter their output to only include variables of certain
1102 can filter their output to only include variables of certain
1098 types. Another suggestion by Matthew.
1103 types. Another suggestion by Matthew.
1099 (magic_whos): Added memory summaries in kb and Mb for arrays.
1104 (magic_whos): Added memory summaries in kb and Mb for arrays.
1100 (magic_who): Improve formatting (break lines every 9 vars).
1105 (magic_who): Improve formatting (break lines every 9 vars).
1101
1106
1102 2004-11-28 Fernando Perez <fperez@colorado.edu>
1107 2004-11-28 Fernando Perez <fperez@colorado.edu>
1103
1108
1104 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1109 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1105 cache when empty lines were present.
1110 cache when empty lines were present.
1106
1111
1107 2004-11-24 Fernando Perez <fperez@colorado.edu>
1112 2004-11-24 Fernando Perez <fperez@colorado.edu>
1108
1113
1109 * IPython/usage.py (__doc__): document the re-activated threading
1114 * IPython/usage.py (__doc__): document the re-activated threading
1110 options for WX and GTK.
1115 options for WX and GTK.
1111
1116
1112 2004-11-23 Fernando Perez <fperez@colorado.edu>
1117 2004-11-23 Fernando Perez <fperez@colorado.edu>
1113
1118
1114 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1119 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1115 the -wthread and -gthread options, along with a new -tk one to try
1120 the -wthread and -gthread options, along with a new -tk one to try
1116 and coordinate Tk threading with wx/gtk. The tk support is very
1121 and coordinate Tk threading with wx/gtk. The tk support is very
1117 platform dependent, since it seems to require Tcl and Tk to be
1122 platform dependent, since it seems to require Tcl and Tk to be
1118 built with threads (Fedora1/2 appears NOT to have it, but in
1123 built with threads (Fedora1/2 appears NOT to have it, but in
1119 Prabhu's Debian boxes it works OK). But even with some Tk
1124 Prabhu's Debian boxes it works OK). But even with some Tk
1120 limitations, this is a great improvement.
1125 limitations, this is a great improvement.
1121
1126
1122 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1127 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1123 info in user prompts. Patch by Prabhu.
1128 info in user prompts. Patch by Prabhu.
1124
1129
1125 2004-11-18 Fernando Perez <fperez@colorado.edu>
1130 2004-11-18 Fernando Perez <fperez@colorado.edu>
1126
1131
1127 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1132 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1128 EOFErrors and bail, to avoid infinite loops if a non-terminating
1133 EOFErrors and bail, to avoid infinite loops if a non-terminating
1129 file is fed into ipython. Patch submitted in issue 19 by user,
1134 file is fed into ipython. Patch submitted in issue 19 by user,
1130 many thanks.
1135 many thanks.
1131
1136
1132 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1137 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1133 autoquote/parens in continuation prompts, which can cause lots of
1138 autoquote/parens in continuation prompts, which can cause lots of
1134 problems. Closes roundup issue 20.
1139 problems. Closes roundup issue 20.
1135
1140
1136 2004-11-17 Fernando Perez <fperez@colorado.edu>
1141 2004-11-17 Fernando Perez <fperez@colorado.edu>
1137
1142
1138 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1143 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1139 reported as debian bug #280505. I'm not sure my local changelog
1144 reported as debian bug #280505. I'm not sure my local changelog
1140 entry has the proper debian format (Jack?).
1145 entry has the proper debian format (Jack?).
1141
1146
1142 2004-11-08 *** Released version 0.6.4
1147 2004-11-08 *** Released version 0.6.4
1143
1148
1144 2004-11-08 Fernando Perez <fperez@colorado.edu>
1149 2004-11-08 Fernando Perez <fperez@colorado.edu>
1145
1150
1146 * IPython/iplib.py (init_readline): Fix exit message for Windows
1151 * IPython/iplib.py (init_readline): Fix exit message for Windows
1147 when readline is active. Thanks to a report by Eric Jones
1152 when readline is active. Thanks to a report by Eric Jones
1148 <eric-AT-enthought.com>.
1153 <eric-AT-enthought.com>.
1149
1154
1150 2004-11-07 Fernando Perez <fperez@colorado.edu>
1155 2004-11-07 Fernando Perez <fperez@colorado.edu>
1151
1156
1152 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1157 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1153 sometimes seen by win2k/cygwin users.
1158 sometimes seen by win2k/cygwin users.
1154
1159
1155 2004-11-06 Fernando Perez <fperez@colorado.edu>
1160 2004-11-06 Fernando Perez <fperez@colorado.edu>
1156
1161
1157 * IPython/iplib.py (interact): Change the handling of %Exit from
1162 * IPython/iplib.py (interact): Change the handling of %Exit from
1158 trying to propagate a SystemExit to an internal ipython flag.
1163 trying to propagate a SystemExit to an internal ipython flag.
1159 This is less elegant than using Python's exception mechanism, but
1164 This is less elegant than using Python's exception mechanism, but
1160 I can't get that to work reliably with threads, so under -pylab
1165 I can't get that to work reliably with threads, so under -pylab
1161 %Exit was hanging IPython. Cross-thread exception handling is
1166 %Exit was hanging IPython. Cross-thread exception handling is
1162 really a bitch. Thaks to a bug report by Stephen Walton
1167 really a bitch. Thaks to a bug report by Stephen Walton
1163 <stephen.walton-AT-csun.edu>.
1168 <stephen.walton-AT-csun.edu>.
1164
1169
1165 2004-11-04 Fernando Perez <fperez@colorado.edu>
1170 2004-11-04 Fernando Perez <fperez@colorado.edu>
1166
1171
1167 * IPython/iplib.py (raw_input_original): store a pointer to the
1172 * IPython/iplib.py (raw_input_original): store a pointer to the
1168 true raw_input to harden against code which can modify it
1173 true raw_input to harden against code which can modify it
1169 (wx.py.PyShell does this and would otherwise crash ipython).
1174 (wx.py.PyShell does this and would otherwise crash ipython).
1170 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1175 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1171
1176
1172 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1177 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1173 Ctrl-C problem, which does not mess up the input line.
1178 Ctrl-C problem, which does not mess up the input line.
1174
1179
1175 2004-11-03 Fernando Perez <fperez@colorado.edu>
1180 2004-11-03 Fernando Perez <fperez@colorado.edu>
1176
1181
1177 * IPython/Release.py: Changed licensing to BSD, in all files.
1182 * IPython/Release.py: Changed licensing to BSD, in all files.
1178 (name): lowercase name for tarball/RPM release.
1183 (name): lowercase name for tarball/RPM release.
1179
1184
1180 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1185 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1181 use throughout ipython.
1186 use throughout ipython.
1182
1187
1183 * IPython/Magic.py (Magic._ofind): Switch to using the new
1188 * IPython/Magic.py (Magic._ofind): Switch to using the new
1184 OInspect.getdoc() function.
1189 OInspect.getdoc() function.
1185
1190
1186 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1191 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1187 of the line currently being canceled via Ctrl-C. It's extremely
1192 of the line currently being canceled via Ctrl-C. It's extremely
1188 ugly, but I don't know how to do it better (the problem is one of
1193 ugly, but I don't know how to do it better (the problem is one of
1189 handling cross-thread exceptions).
1194 handling cross-thread exceptions).
1190
1195
1191 2004-10-28 Fernando Perez <fperez@colorado.edu>
1196 2004-10-28 Fernando Perez <fperez@colorado.edu>
1192
1197
1193 * IPython/Shell.py (signal_handler): add signal handlers to trap
1198 * IPython/Shell.py (signal_handler): add signal handlers to trap
1194 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1199 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1195 report by Francesc Alted.
1200 report by Francesc Alted.
1196
1201
1197 2004-10-21 Fernando Perez <fperez@colorado.edu>
1202 2004-10-21 Fernando Perez <fperez@colorado.edu>
1198
1203
1199 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1204 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1200 to % for pysh syntax extensions.
1205 to % for pysh syntax extensions.
1201
1206
1202 2004-10-09 Fernando Perez <fperez@colorado.edu>
1207 2004-10-09 Fernando Perez <fperez@colorado.edu>
1203
1208
1204 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1209 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1205 arrays to print a more useful summary, without calling str(arr).
1210 arrays to print a more useful summary, without calling str(arr).
1206 This avoids the problem of extremely lengthy computations which
1211 This avoids the problem of extremely lengthy computations which
1207 occur if arr is large, and appear to the user as a system lockup
1212 occur if arr is large, and appear to the user as a system lockup
1208 with 100% cpu activity. After a suggestion by Kristian Sandberg
1213 with 100% cpu activity. After a suggestion by Kristian Sandberg
1209 <Kristian.Sandberg@colorado.edu>.
1214 <Kristian.Sandberg@colorado.edu>.
1210 (Magic.__init__): fix bug in global magic escapes not being
1215 (Magic.__init__): fix bug in global magic escapes not being
1211 correctly set.
1216 correctly set.
1212
1217
1213 2004-10-08 Fernando Perez <fperez@colorado.edu>
1218 2004-10-08 Fernando Perez <fperez@colorado.edu>
1214
1219
1215 * IPython/Magic.py (__license__): change to absolute imports of
1220 * IPython/Magic.py (__license__): change to absolute imports of
1216 ipython's own internal packages, to start adapting to the absolute
1221 ipython's own internal packages, to start adapting to the absolute
1217 import requirement of PEP-328.
1222 import requirement of PEP-328.
1218
1223
1219 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1224 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1220 files, and standardize author/license marks through the Release
1225 files, and standardize author/license marks through the Release
1221 module instead of having per/file stuff (except for files with
1226 module instead of having per/file stuff (except for files with
1222 particular licenses, like the MIT/PSF-licensed codes).
1227 particular licenses, like the MIT/PSF-licensed codes).
1223
1228
1224 * IPython/Debugger.py: remove dead code for python 2.1
1229 * IPython/Debugger.py: remove dead code for python 2.1
1225
1230
1226 2004-10-04 Fernando Perez <fperez@colorado.edu>
1231 2004-10-04 Fernando Perez <fperez@colorado.edu>
1227
1232
1228 * IPython/iplib.py (ipmagic): New function for accessing magics
1233 * IPython/iplib.py (ipmagic): New function for accessing magics
1229 via a normal python function call.
1234 via a normal python function call.
1230
1235
1231 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1236 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1232 from '@' to '%', to accomodate the new @decorator syntax of python
1237 from '@' to '%', to accomodate the new @decorator syntax of python
1233 2.4.
1238 2.4.
1234
1239
1235 2004-09-29 Fernando Perez <fperez@colorado.edu>
1240 2004-09-29 Fernando Perez <fperez@colorado.edu>
1236
1241
1237 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1242 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1238 matplotlib.use to prevent running scripts which try to switch
1243 matplotlib.use to prevent running scripts which try to switch
1239 interactive backends from within ipython. This will just crash
1244 interactive backends from within ipython. This will just crash
1240 the python interpreter, so we can't allow it (but a detailed error
1245 the python interpreter, so we can't allow it (but a detailed error
1241 is given to the user).
1246 is given to the user).
1242
1247
1243 2004-09-28 Fernando Perez <fperez@colorado.edu>
1248 2004-09-28 Fernando Perez <fperez@colorado.edu>
1244
1249
1245 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1250 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1246 matplotlib-related fixes so that using @run with non-matplotlib
1251 matplotlib-related fixes so that using @run with non-matplotlib
1247 scripts doesn't pop up spurious plot windows. This requires
1252 scripts doesn't pop up spurious plot windows. This requires
1248 matplotlib >= 0.63, where I had to make some changes as well.
1253 matplotlib >= 0.63, where I had to make some changes as well.
1249
1254
1250 * IPython/ipmaker.py (make_IPython): update version requirement to
1255 * IPython/ipmaker.py (make_IPython): update version requirement to
1251 python 2.2.
1256 python 2.2.
1252
1257
1253 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1258 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1254 banner arg for embedded customization.
1259 banner arg for embedded customization.
1255
1260
1256 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1261 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1257 explicit uses of __IP as the IPython's instance name. Now things
1262 explicit uses of __IP as the IPython's instance name. Now things
1258 are properly handled via the shell.name value. The actual code
1263 are properly handled via the shell.name value. The actual code
1259 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1264 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1260 is much better than before. I'll clean things completely when the
1265 is much better than before. I'll clean things completely when the
1261 magic stuff gets a real overhaul.
1266 magic stuff gets a real overhaul.
1262
1267
1263 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1268 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1264 minor changes to debian dir.
1269 minor changes to debian dir.
1265
1270
1266 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1271 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1267 pointer to the shell itself in the interactive namespace even when
1272 pointer to the shell itself in the interactive namespace even when
1268 a user-supplied dict is provided. This is needed for embedding
1273 a user-supplied dict is provided. This is needed for embedding
1269 purposes (found by tests with Michel Sanner).
1274 purposes (found by tests with Michel Sanner).
1270
1275
1271 2004-09-27 Fernando Perez <fperez@colorado.edu>
1276 2004-09-27 Fernando Perez <fperez@colorado.edu>
1272
1277
1273 * IPython/UserConfig/ipythonrc: remove []{} from
1278 * IPython/UserConfig/ipythonrc: remove []{} from
1274 readline_remove_delims, so that things like [modname.<TAB> do
1279 readline_remove_delims, so that things like [modname.<TAB> do
1275 proper completion. This disables [].TAB, but that's a less common
1280 proper completion. This disables [].TAB, but that's a less common
1276 case than module names in list comprehensions, for example.
1281 case than module names in list comprehensions, for example.
1277 Thanks to a report by Andrea Riciputi.
1282 Thanks to a report by Andrea Riciputi.
1278
1283
1279 2004-09-09 Fernando Perez <fperez@colorado.edu>
1284 2004-09-09 Fernando Perez <fperez@colorado.edu>
1280
1285
1281 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1286 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1282 blocking problems in win32 and osx. Fix by John.
1287 blocking problems in win32 and osx. Fix by John.
1283
1288
1284 2004-09-08 Fernando Perez <fperez@colorado.edu>
1289 2004-09-08 Fernando Perez <fperez@colorado.edu>
1285
1290
1286 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1291 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1287 for Win32 and OSX. Fix by John Hunter.
1292 for Win32 and OSX. Fix by John Hunter.
1288
1293
1289 2004-08-30 *** Released version 0.6.3
1294 2004-08-30 *** Released version 0.6.3
1290
1295
1291 2004-08-30 Fernando Perez <fperez@colorado.edu>
1296 2004-08-30 Fernando Perez <fperez@colorado.edu>
1292
1297
1293 * setup.py (isfile): Add manpages to list of dependent files to be
1298 * setup.py (isfile): Add manpages to list of dependent files to be
1294 updated.
1299 updated.
1295
1300
1296 2004-08-27 Fernando Perez <fperez@colorado.edu>
1301 2004-08-27 Fernando Perez <fperez@colorado.edu>
1297
1302
1298 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1303 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1299 for now. They don't really work with standalone WX/GTK code
1304 for now. They don't really work with standalone WX/GTK code
1300 (though matplotlib IS working fine with both of those backends).
1305 (though matplotlib IS working fine with both of those backends).
1301 This will neeed much more testing. I disabled most things with
1306 This will neeed much more testing. I disabled most things with
1302 comments, so turning it back on later should be pretty easy.
1307 comments, so turning it back on later should be pretty easy.
1303
1308
1304 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1309 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1305 autocalling of expressions like r'foo', by modifying the line
1310 autocalling of expressions like r'foo', by modifying the line
1306 split regexp. Closes
1311 split regexp. Closes
1307 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1312 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1308 Riley <ipythonbugs-AT-sabi.net>.
1313 Riley <ipythonbugs-AT-sabi.net>.
1309 (InteractiveShell.mainloop): honor --nobanner with banner
1314 (InteractiveShell.mainloop): honor --nobanner with banner
1310 extensions.
1315 extensions.
1311
1316
1312 * IPython/Shell.py: Significant refactoring of all classes, so
1317 * IPython/Shell.py: Significant refactoring of all classes, so
1313 that we can really support ALL matplotlib backends and threading
1318 that we can really support ALL matplotlib backends and threading
1314 models (John spotted a bug with Tk which required this). Now we
1319 models (John spotted a bug with Tk which required this). Now we
1315 should support single-threaded, WX-threads and GTK-threads, both
1320 should support single-threaded, WX-threads and GTK-threads, both
1316 for generic code and for matplotlib.
1321 for generic code and for matplotlib.
1317
1322
1318 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1323 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1319 -pylab, to simplify things for users. Will also remove the pylab
1324 -pylab, to simplify things for users. Will also remove the pylab
1320 profile, since now all of matplotlib configuration is directly
1325 profile, since now all of matplotlib configuration is directly
1321 handled here. This also reduces startup time.
1326 handled here. This also reduces startup time.
1322
1327
1323 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1328 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1324 shell wasn't being correctly called. Also in IPShellWX.
1329 shell wasn't being correctly called. Also in IPShellWX.
1325
1330
1326 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1331 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1327 fine-tune banner.
1332 fine-tune banner.
1328
1333
1329 * IPython/numutils.py (spike): Deprecate these spike functions,
1334 * IPython/numutils.py (spike): Deprecate these spike functions,
1330 delete (long deprecated) gnuplot_exec handler.
1335 delete (long deprecated) gnuplot_exec handler.
1331
1336
1332 2004-08-26 Fernando Perez <fperez@colorado.edu>
1337 2004-08-26 Fernando Perez <fperez@colorado.edu>
1333
1338
1334 * ipython.1: Update for threading options, plus some others which
1339 * ipython.1: Update for threading options, plus some others which
1335 were missing.
1340 were missing.
1336
1341
1337 * IPython/ipmaker.py (__call__): Added -wthread option for
1342 * IPython/ipmaker.py (__call__): Added -wthread option for
1338 wxpython thread handling. Make sure threading options are only
1343 wxpython thread handling. Make sure threading options are only
1339 valid at the command line.
1344 valid at the command line.
1340
1345
1341 * scripts/ipython: moved shell selection into a factory function
1346 * scripts/ipython: moved shell selection into a factory function
1342 in Shell.py, to keep the starter script to a minimum.
1347 in Shell.py, to keep the starter script to a minimum.
1343
1348
1344 2004-08-25 Fernando Perez <fperez@colorado.edu>
1349 2004-08-25 Fernando Perez <fperez@colorado.edu>
1345
1350
1346 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1351 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1347 John. Along with some recent changes he made to matplotlib, the
1352 John. Along with some recent changes he made to matplotlib, the
1348 next versions of both systems should work very well together.
1353 next versions of both systems should work very well together.
1349
1354
1350 2004-08-24 Fernando Perez <fperez@colorado.edu>
1355 2004-08-24 Fernando Perez <fperez@colorado.edu>
1351
1356
1352 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1357 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1353 tried to switch the profiling to using hotshot, but I'm getting
1358 tried to switch the profiling to using hotshot, but I'm getting
1354 strange errors from prof.runctx() there. I may be misreading the
1359 strange errors from prof.runctx() there. I may be misreading the
1355 docs, but it looks weird. For now the profiling code will
1360 docs, but it looks weird. For now the profiling code will
1356 continue to use the standard profiler.
1361 continue to use the standard profiler.
1357
1362
1358 2004-08-23 Fernando Perez <fperez@colorado.edu>
1363 2004-08-23 Fernando Perez <fperez@colorado.edu>
1359
1364
1360 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1365 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1361 threaded shell, by John Hunter. It's not quite ready yet, but
1366 threaded shell, by John Hunter. It's not quite ready yet, but
1362 close.
1367 close.
1363
1368
1364 2004-08-22 Fernando Perez <fperez@colorado.edu>
1369 2004-08-22 Fernando Perez <fperez@colorado.edu>
1365
1370
1366 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1371 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1367 in Magic and ultraTB.
1372 in Magic and ultraTB.
1368
1373
1369 * ipython.1: document threading options in manpage.
1374 * ipython.1: document threading options in manpage.
1370
1375
1371 * scripts/ipython: Changed name of -thread option to -gthread,
1376 * scripts/ipython: Changed name of -thread option to -gthread,
1372 since this is GTK specific. I want to leave the door open for a
1377 since this is GTK specific. I want to leave the door open for a
1373 -wthread option for WX, which will most likely be necessary. This
1378 -wthread option for WX, which will most likely be necessary. This
1374 change affects usage and ipmaker as well.
1379 change affects usage and ipmaker as well.
1375
1380
1376 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1381 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1377 handle the matplotlib shell issues. Code by John Hunter
1382 handle the matplotlib shell issues. Code by John Hunter
1378 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1383 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1379 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1384 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1380 broken (and disabled for end users) for now, but it puts the
1385 broken (and disabled for end users) for now, but it puts the
1381 infrastructure in place.
1386 infrastructure in place.
1382
1387
1383 2004-08-21 Fernando Perez <fperez@colorado.edu>
1388 2004-08-21 Fernando Perez <fperez@colorado.edu>
1384
1389
1385 * ipythonrc-pylab: Add matplotlib support.
1390 * ipythonrc-pylab: Add matplotlib support.
1386
1391
1387 * matplotlib_config.py: new files for matplotlib support, part of
1392 * matplotlib_config.py: new files for matplotlib support, part of
1388 the pylab profile.
1393 the pylab profile.
1389
1394
1390 * IPython/usage.py (__doc__): documented the threading options.
1395 * IPython/usage.py (__doc__): documented the threading options.
1391
1396
1392 2004-08-20 Fernando Perez <fperez@colorado.edu>
1397 2004-08-20 Fernando Perez <fperez@colorado.edu>
1393
1398
1394 * ipython: Modified the main calling routine to handle the -thread
1399 * ipython: Modified the main calling routine to handle the -thread
1395 and -mpthread options. This needs to be done as a top-level hack,
1400 and -mpthread options. This needs to be done as a top-level hack,
1396 because it determines which class to instantiate for IPython
1401 because it determines which class to instantiate for IPython
1397 itself.
1402 itself.
1398
1403
1399 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1404 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1400 classes to support multithreaded GTK operation without blocking,
1405 classes to support multithreaded GTK operation without blocking,
1401 and matplotlib with all backends. This is a lot of still very
1406 and matplotlib with all backends. This is a lot of still very
1402 experimental code, and threads are tricky. So it may still have a
1407 experimental code, and threads are tricky. So it may still have a
1403 few rough edges... This code owes a lot to
1408 few rough edges... This code owes a lot to
1404 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1409 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1405 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1410 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1406 to John Hunter for all the matplotlib work.
1411 to John Hunter for all the matplotlib work.
1407
1412
1408 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1413 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1409 options for gtk thread and matplotlib support.
1414 options for gtk thread and matplotlib support.
1410
1415
1411 2004-08-16 Fernando Perez <fperez@colorado.edu>
1416 2004-08-16 Fernando Perez <fperez@colorado.edu>
1412
1417
1413 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1418 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1414 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1419 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1415 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1420 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1416
1421
1417 2004-08-11 Fernando Perez <fperez@colorado.edu>
1422 2004-08-11 Fernando Perez <fperez@colorado.edu>
1418
1423
1419 * setup.py (isfile): Fix build so documentation gets updated for
1424 * setup.py (isfile): Fix build so documentation gets updated for
1420 rpms (it was only done for .tgz builds).
1425 rpms (it was only done for .tgz builds).
1421
1426
1422 2004-08-10 Fernando Perez <fperez@colorado.edu>
1427 2004-08-10 Fernando Perez <fperez@colorado.edu>
1423
1428
1424 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1429 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1425
1430
1426 * iplib.py : Silence syntax error exceptions in tab-completion.
1431 * iplib.py : Silence syntax error exceptions in tab-completion.
1427
1432
1428 2004-08-05 Fernando Perez <fperez@colorado.edu>
1433 2004-08-05 Fernando Perez <fperez@colorado.edu>
1429
1434
1430 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1435 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1431 'color off' mark for continuation prompts. This was causing long
1436 'color off' mark for continuation prompts. This was causing long
1432 continuation lines to mis-wrap.
1437 continuation lines to mis-wrap.
1433
1438
1434 2004-08-01 Fernando Perez <fperez@colorado.edu>
1439 2004-08-01 Fernando Perez <fperez@colorado.edu>
1435
1440
1436 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1441 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1437 for building ipython to be a parameter. All this is necessary
1442 for building ipython to be a parameter. All this is necessary
1438 right now to have a multithreaded version, but this insane
1443 right now to have a multithreaded version, but this insane
1439 non-design will be cleaned up soon. For now, it's a hack that
1444 non-design will be cleaned up soon. For now, it's a hack that
1440 works.
1445 works.
1441
1446
1442 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1447 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1443 args in various places. No bugs so far, but it's a dangerous
1448 args in various places. No bugs so far, but it's a dangerous
1444 practice.
1449 practice.
1445
1450
1446 2004-07-31 Fernando Perez <fperez@colorado.edu>
1451 2004-07-31 Fernando Perez <fperez@colorado.edu>
1447
1452
1448 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1453 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1449 fix completion of files with dots in their names under most
1454 fix completion of files with dots in their names under most
1450 profiles (pysh was OK because the completion order is different).
1455 profiles (pysh was OK because the completion order is different).
1451
1456
1452 2004-07-27 Fernando Perez <fperez@colorado.edu>
1457 2004-07-27 Fernando Perez <fperez@colorado.edu>
1453
1458
1454 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1459 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1455 keywords manually, b/c the one in keyword.py was removed in python
1460 keywords manually, b/c the one in keyword.py was removed in python
1456 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1461 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1457 This is NOT a bug under python 2.3 and earlier.
1462 This is NOT a bug under python 2.3 and earlier.
1458
1463
1459 2004-07-26 Fernando Perez <fperez@colorado.edu>
1464 2004-07-26 Fernando Perez <fperez@colorado.edu>
1460
1465
1461 * IPython/ultraTB.py (VerboseTB.text): Add another
1466 * IPython/ultraTB.py (VerboseTB.text): Add another
1462 linecache.checkcache() call to try to prevent inspect.py from
1467 linecache.checkcache() call to try to prevent inspect.py from
1463 crashing under python 2.3. I think this fixes
1468 crashing under python 2.3. I think this fixes
1464 http://www.scipy.net/roundup/ipython/issue17.
1469 http://www.scipy.net/roundup/ipython/issue17.
1465
1470
1466 2004-07-26 *** Released version 0.6.2
1471 2004-07-26 *** Released version 0.6.2
1467
1472
1468 2004-07-26 Fernando Perez <fperez@colorado.edu>
1473 2004-07-26 Fernando Perez <fperez@colorado.edu>
1469
1474
1470 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1475 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1471 fail for any number.
1476 fail for any number.
1472 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1477 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1473 empty bookmarks.
1478 empty bookmarks.
1474
1479
1475 2004-07-26 *** Released version 0.6.1
1480 2004-07-26 *** Released version 0.6.1
1476
1481
1477 2004-07-26 Fernando Perez <fperez@colorado.edu>
1482 2004-07-26 Fernando Perez <fperez@colorado.edu>
1478
1483
1479 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1484 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1480
1485
1481 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1486 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1482 escaping '()[]{}' in filenames.
1487 escaping '()[]{}' in filenames.
1483
1488
1484 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1489 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1485 Python 2.2 users who lack a proper shlex.split.
1490 Python 2.2 users who lack a proper shlex.split.
1486
1491
1487 2004-07-19 Fernando Perez <fperez@colorado.edu>
1492 2004-07-19 Fernando Perez <fperez@colorado.edu>
1488
1493
1489 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1494 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1490 for reading readline's init file. I follow the normal chain:
1495 for reading readline's init file. I follow the normal chain:
1491 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1496 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1492 report by Mike Heeter. This closes
1497 report by Mike Heeter. This closes
1493 http://www.scipy.net/roundup/ipython/issue16.
1498 http://www.scipy.net/roundup/ipython/issue16.
1494
1499
1495 2004-07-18 Fernando Perez <fperez@colorado.edu>
1500 2004-07-18 Fernando Perez <fperez@colorado.edu>
1496
1501
1497 * IPython/iplib.py (__init__): Add better handling of '\' under
1502 * IPython/iplib.py (__init__): Add better handling of '\' under
1498 Win32 for filenames. After a patch by Ville.
1503 Win32 for filenames. After a patch by Ville.
1499
1504
1500 2004-07-17 Fernando Perez <fperez@colorado.edu>
1505 2004-07-17 Fernando Perez <fperez@colorado.edu>
1501
1506
1502 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1507 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1503 autocalling would be triggered for 'foo is bar' if foo is
1508 autocalling would be triggered for 'foo is bar' if foo is
1504 callable. I also cleaned up the autocall detection code to use a
1509 callable. I also cleaned up the autocall detection code to use a
1505 regexp, which is faster. Bug reported by Alexander Schmolck.
1510 regexp, which is faster. Bug reported by Alexander Schmolck.
1506
1511
1507 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1512 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1508 '?' in them would confuse the help system. Reported by Alex
1513 '?' in them would confuse the help system. Reported by Alex
1509 Schmolck.
1514 Schmolck.
1510
1515
1511 2004-07-16 Fernando Perez <fperez@colorado.edu>
1516 2004-07-16 Fernando Perez <fperez@colorado.edu>
1512
1517
1513 * IPython/GnuplotInteractive.py (__all__): added plot2.
1518 * IPython/GnuplotInteractive.py (__all__): added plot2.
1514
1519
1515 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1520 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1516 plotting dictionaries, lists or tuples of 1d arrays.
1521 plotting dictionaries, lists or tuples of 1d arrays.
1517
1522
1518 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1523 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1519 optimizations.
1524 optimizations.
1520
1525
1521 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1526 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1522 the information which was there from Janko's original IPP code:
1527 the information which was there from Janko's original IPP code:
1523
1528
1524 03.05.99 20:53 porto.ifm.uni-kiel.de
1529 03.05.99 20:53 porto.ifm.uni-kiel.de
1525 --Started changelog.
1530 --Started changelog.
1526 --make clear do what it say it does
1531 --make clear do what it say it does
1527 --added pretty output of lines from inputcache
1532 --added pretty output of lines from inputcache
1528 --Made Logger a mixin class, simplifies handling of switches
1533 --Made Logger a mixin class, simplifies handling of switches
1529 --Added own completer class. .string<TAB> expands to last history
1534 --Added own completer class. .string<TAB> expands to last history
1530 line which starts with string. The new expansion is also present
1535 line which starts with string. The new expansion is also present
1531 with Ctrl-r from the readline library. But this shows, who this
1536 with Ctrl-r from the readline library. But this shows, who this
1532 can be done for other cases.
1537 can be done for other cases.
1533 --Added convention that all shell functions should accept a
1538 --Added convention that all shell functions should accept a
1534 parameter_string This opens the door for different behaviour for
1539 parameter_string This opens the door for different behaviour for
1535 each function. @cd is a good example of this.
1540 each function. @cd is a good example of this.
1536
1541
1537 04.05.99 12:12 porto.ifm.uni-kiel.de
1542 04.05.99 12:12 porto.ifm.uni-kiel.de
1538 --added logfile rotation
1543 --added logfile rotation
1539 --added new mainloop method which freezes first the namespace
1544 --added new mainloop method which freezes first the namespace
1540
1545
1541 07.05.99 21:24 porto.ifm.uni-kiel.de
1546 07.05.99 21:24 porto.ifm.uni-kiel.de
1542 --added the docreader classes. Now there is a help system.
1547 --added the docreader classes. Now there is a help system.
1543 -This is only a first try. Currently it's not easy to put new
1548 -This is only a first try. Currently it's not easy to put new
1544 stuff in the indices. But this is the way to go. Info would be
1549 stuff in the indices. But this is the way to go. Info would be
1545 better, but HTML is every where and not everybody has an info
1550 better, but HTML is every where and not everybody has an info
1546 system installed and it's not so easy to change html-docs to info.
1551 system installed and it's not so easy to change html-docs to info.
1547 --added global logfile option
1552 --added global logfile option
1548 --there is now a hook for object inspection method pinfo needs to
1553 --there is now a hook for object inspection method pinfo needs to
1549 be provided for this. Can be reached by two '??'.
1554 be provided for this. Can be reached by two '??'.
1550
1555
1551 08.05.99 20:51 porto.ifm.uni-kiel.de
1556 08.05.99 20:51 porto.ifm.uni-kiel.de
1552 --added a README
1557 --added a README
1553 --bug in rc file. Something has changed so functions in the rc
1558 --bug in rc file. Something has changed so functions in the rc
1554 file need to reference the shell and not self. Not clear if it's a
1559 file need to reference the shell and not self. Not clear if it's a
1555 bug or feature.
1560 bug or feature.
1556 --changed rc file for new behavior
1561 --changed rc file for new behavior
1557
1562
1558 2004-07-15 Fernando Perez <fperez@colorado.edu>
1563 2004-07-15 Fernando Perez <fperez@colorado.edu>
1559
1564
1560 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1565 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1561 cache was falling out of sync in bizarre manners when multi-line
1566 cache was falling out of sync in bizarre manners when multi-line
1562 input was present. Minor optimizations and cleanup.
1567 input was present. Minor optimizations and cleanup.
1563
1568
1564 (Logger): Remove old Changelog info for cleanup. This is the
1569 (Logger): Remove old Changelog info for cleanup. This is the
1565 information which was there from Janko's original code:
1570 information which was there from Janko's original code:
1566
1571
1567 Changes to Logger: - made the default log filename a parameter
1572 Changes to Logger: - made the default log filename a parameter
1568
1573
1569 - put a check for lines beginning with !@? in log(). Needed
1574 - put a check for lines beginning with !@? in log(). Needed
1570 (even if the handlers properly log their lines) for mid-session
1575 (even if the handlers properly log their lines) for mid-session
1571 logging activation to work properly. Without this, lines logged
1576 logging activation to work properly. Without this, lines logged
1572 in mid session, which get read from the cache, would end up
1577 in mid session, which get read from the cache, would end up
1573 'bare' (with !@? in the open) in the log. Now they are caught
1578 'bare' (with !@? in the open) in the log. Now they are caught
1574 and prepended with a #.
1579 and prepended with a #.
1575
1580
1576 * IPython/iplib.py (InteractiveShell.init_readline): added check
1581 * IPython/iplib.py (InteractiveShell.init_readline): added check
1577 in case MagicCompleter fails to be defined, so we don't crash.
1582 in case MagicCompleter fails to be defined, so we don't crash.
1578
1583
1579 2004-07-13 Fernando Perez <fperez@colorado.edu>
1584 2004-07-13 Fernando Perez <fperez@colorado.edu>
1580
1585
1581 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1586 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1582 of EPS if the requested filename ends in '.eps'.
1587 of EPS if the requested filename ends in '.eps'.
1583
1588
1584 2004-07-04 Fernando Perez <fperez@colorado.edu>
1589 2004-07-04 Fernando Perez <fperez@colorado.edu>
1585
1590
1586 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1591 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1587 escaping of quotes when calling the shell.
1592 escaping of quotes when calling the shell.
1588
1593
1589 2004-07-02 Fernando Perez <fperez@colorado.edu>
1594 2004-07-02 Fernando Perez <fperez@colorado.edu>
1590
1595
1591 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1596 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1592 gettext not working because we were clobbering '_'. Fixes
1597 gettext not working because we were clobbering '_'. Fixes
1593 http://www.scipy.net/roundup/ipython/issue6.
1598 http://www.scipy.net/roundup/ipython/issue6.
1594
1599
1595 2004-07-01 Fernando Perez <fperez@colorado.edu>
1600 2004-07-01 Fernando Perez <fperez@colorado.edu>
1596
1601
1597 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1602 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1598 into @cd. Patch by Ville.
1603 into @cd. Patch by Ville.
1599
1604
1600 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1605 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1601 new function to store things after ipmaker runs. Patch by Ville.
1606 new function to store things after ipmaker runs. Patch by Ville.
1602 Eventually this will go away once ipmaker is removed and the class
1607 Eventually this will go away once ipmaker is removed and the class
1603 gets cleaned up, but for now it's ok. Key functionality here is
1608 gets cleaned up, but for now it's ok. Key functionality here is
1604 the addition of the persistent storage mechanism, a dict for
1609 the addition of the persistent storage mechanism, a dict for
1605 keeping data across sessions (for now just bookmarks, but more can
1610 keeping data across sessions (for now just bookmarks, but more can
1606 be implemented later).
1611 be implemented later).
1607
1612
1608 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1613 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1609 persistent across sections. Patch by Ville, I modified it
1614 persistent across sections. Patch by Ville, I modified it
1610 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1615 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1611 added a '-l' option to list all bookmarks.
1616 added a '-l' option to list all bookmarks.
1612
1617
1613 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1618 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1614 center for cleanup. Registered with atexit.register(). I moved
1619 center for cleanup. Registered with atexit.register(). I moved
1615 here the old exit_cleanup(). After a patch by Ville.
1620 here the old exit_cleanup(). After a patch by Ville.
1616
1621
1617 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1622 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1618 characters in the hacked shlex_split for python 2.2.
1623 characters in the hacked shlex_split for python 2.2.
1619
1624
1620 * IPython/iplib.py (file_matches): more fixes to filenames with
1625 * IPython/iplib.py (file_matches): more fixes to filenames with
1621 whitespace in them. It's not perfect, but limitations in python's
1626 whitespace in them. It's not perfect, but limitations in python's
1622 readline make it impossible to go further.
1627 readline make it impossible to go further.
1623
1628
1624 2004-06-29 Fernando Perez <fperez@colorado.edu>
1629 2004-06-29 Fernando Perez <fperez@colorado.edu>
1625
1630
1626 * IPython/iplib.py (file_matches): escape whitespace correctly in
1631 * IPython/iplib.py (file_matches): escape whitespace correctly in
1627 filename completions. Bug reported by Ville.
1632 filename completions. Bug reported by Ville.
1628
1633
1629 2004-06-28 Fernando Perez <fperez@colorado.edu>
1634 2004-06-28 Fernando Perez <fperez@colorado.edu>
1630
1635
1631 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1636 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1632 the history file will be called 'history-PROFNAME' (or just
1637 the history file will be called 'history-PROFNAME' (or just
1633 'history' if no profile is loaded). I was getting annoyed at
1638 'history' if no profile is loaded). I was getting annoyed at
1634 getting my Numerical work history clobbered by pysh sessions.
1639 getting my Numerical work history clobbered by pysh sessions.
1635
1640
1636 * IPython/iplib.py (InteractiveShell.__init__): Internal
1641 * IPython/iplib.py (InteractiveShell.__init__): Internal
1637 getoutputerror() function so that we can honor the system_verbose
1642 getoutputerror() function so that we can honor the system_verbose
1638 flag for _all_ system calls. I also added escaping of #
1643 flag for _all_ system calls. I also added escaping of #
1639 characters here to avoid confusing Itpl.
1644 characters here to avoid confusing Itpl.
1640
1645
1641 * IPython/Magic.py (shlex_split): removed call to shell in
1646 * IPython/Magic.py (shlex_split): removed call to shell in
1642 parse_options and replaced it with shlex.split(). The annoying
1647 parse_options and replaced it with shlex.split(). The annoying
1643 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1648 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1644 to backport it from 2.3, with several frail hacks (the shlex
1649 to backport it from 2.3, with several frail hacks (the shlex
1645 module is rather limited in 2.2). Thanks to a suggestion by Ville
1650 module is rather limited in 2.2). Thanks to a suggestion by Ville
1646 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1651 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1647 problem.
1652 problem.
1648
1653
1649 (Magic.magic_system_verbose): new toggle to print the actual
1654 (Magic.magic_system_verbose): new toggle to print the actual
1650 system calls made by ipython. Mainly for debugging purposes.
1655 system calls made by ipython. Mainly for debugging purposes.
1651
1656
1652 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1657 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1653 doesn't support persistence. Reported (and fix suggested) by
1658 doesn't support persistence. Reported (and fix suggested) by
1654 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1659 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1655
1660
1656 2004-06-26 Fernando Perez <fperez@colorado.edu>
1661 2004-06-26 Fernando Perez <fperez@colorado.edu>
1657
1662
1658 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1663 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1659 continue prompts.
1664 continue prompts.
1660
1665
1661 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1666 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1662 function (basically a big docstring) and a few more things here to
1667 function (basically a big docstring) and a few more things here to
1663 speedup startup. pysh.py is now very lightweight. We want because
1668 speedup startup. pysh.py is now very lightweight. We want because
1664 it gets execfile'd, while InterpreterExec gets imported, so
1669 it gets execfile'd, while InterpreterExec gets imported, so
1665 byte-compilation saves time.
1670 byte-compilation saves time.
1666
1671
1667 2004-06-25 Fernando Perez <fperez@colorado.edu>
1672 2004-06-25 Fernando Perez <fperez@colorado.edu>
1668
1673
1669 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1674 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1670 -NUM', which was recently broken.
1675 -NUM', which was recently broken.
1671
1676
1672 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1677 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1673 in multi-line input (but not !!, which doesn't make sense there).
1678 in multi-line input (but not !!, which doesn't make sense there).
1674
1679
1675 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1680 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1676 It's just too useful, and people can turn it off in the less
1681 It's just too useful, and people can turn it off in the less
1677 common cases where it's a problem.
1682 common cases where it's a problem.
1678
1683
1679 2004-06-24 Fernando Perez <fperez@colorado.edu>
1684 2004-06-24 Fernando Perez <fperez@colorado.edu>
1680
1685
1681 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1686 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1682 special syntaxes (like alias calling) is now allied in multi-line
1687 special syntaxes (like alias calling) is now allied in multi-line
1683 input. This is still _very_ experimental, but it's necessary for
1688 input. This is still _very_ experimental, but it's necessary for
1684 efficient shell usage combining python looping syntax with system
1689 efficient shell usage combining python looping syntax with system
1685 calls. For now it's restricted to aliases, I don't think it
1690 calls. For now it's restricted to aliases, I don't think it
1686 really even makes sense to have this for magics.
1691 really even makes sense to have this for magics.
1687
1692
1688 2004-06-23 Fernando Perez <fperez@colorado.edu>
1693 2004-06-23 Fernando Perez <fperez@colorado.edu>
1689
1694
1690 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1695 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1691 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1696 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1692
1697
1693 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1698 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1694 extensions under Windows (after code sent by Gary Bishop). The
1699 extensions under Windows (after code sent by Gary Bishop). The
1695 extensions considered 'executable' are stored in IPython's rc
1700 extensions considered 'executable' are stored in IPython's rc
1696 structure as win_exec_ext.
1701 structure as win_exec_ext.
1697
1702
1698 * IPython/genutils.py (shell): new function, like system() but
1703 * IPython/genutils.py (shell): new function, like system() but
1699 without return value. Very useful for interactive shell work.
1704 without return value. Very useful for interactive shell work.
1700
1705
1701 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1706 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1702 delete aliases.
1707 delete aliases.
1703
1708
1704 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1709 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1705 sure that the alias table doesn't contain python keywords.
1710 sure that the alias table doesn't contain python keywords.
1706
1711
1707 2004-06-21 Fernando Perez <fperez@colorado.edu>
1712 2004-06-21 Fernando Perez <fperez@colorado.edu>
1708
1713
1709 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1714 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1710 non-existent items are found in $PATH. Reported by Thorsten.
1715 non-existent items are found in $PATH. Reported by Thorsten.
1711
1716
1712 2004-06-20 Fernando Perez <fperez@colorado.edu>
1717 2004-06-20 Fernando Perez <fperez@colorado.edu>
1713
1718
1714 * IPython/iplib.py (complete): modified the completer so that the
1719 * IPython/iplib.py (complete): modified the completer so that the
1715 order of priorities can be easily changed at runtime.
1720 order of priorities can be easily changed at runtime.
1716
1721
1717 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1722 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1718 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1723 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1719
1724
1720 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1725 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1721 expand Python variables prepended with $ in all system calls. The
1726 expand Python variables prepended with $ in all system calls. The
1722 same was done to InteractiveShell.handle_shell_escape. Now all
1727 same was done to InteractiveShell.handle_shell_escape. Now all
1723 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1728 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1724 expansion of python variables and expressions according to the
1729 expansion of python variables and expressions according to the
1725 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1730 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1726
1731
1727 Though PEP-215 has been rejected, a similar (but simpler) one
1732 Though PEP-215 has been rejected, a similar (but simpler) one
1728 seems like it will go into Python 2.4, PEP-292 -
1733 seems like it will go into Python 2.4, PEP-292 -
1729 http://www.python.org/peps/pep-0292.html.
1734 http://www.python.org/peps/pep-0292.html.
1730
1735
1731 I'll keep the full syntax of PEP-215, since IPython has since the
1736 I'll keep the full syntax of PEP-215, since IPython has since the
1732 start used Ka-Ping Yee's reference implementation discussed there
1737 start used Ka-Ping Yee's reference implementation discussed there
1733 (Itpl), and I actually like the powerful semantics it offers.
1738 (Itpl), and I actually like the powerful semantics it offers.
1734
1739
1735 In order to access normal shell variables, the $ has to be escaped
1740 In order to access normal shell variables, the $ has to be escaped
1736 via an extra $. For example:
1741 via an extra $. For example:
1737
1742
1738 In [7]: PATH='a python variable'
1743 In [7]: PATH='a python variable'
1739
1744
1740 In [8]: !echo $PATH
1745 In [8]: !echo $PATH
1741 a python variable
1746 a python variable
1742
1747
1743 In [9]: !echo $$PATH
1748 In [9]: !echo $$PATH
1744 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1749 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1745
1750
1746 (Magic.parse_options): escape $ so the shell doesn't evaluate
1751 (Magic.parse_options): escape $ so the shell doesn't evaluate
1747 things prematurely.
1752 things prematurely.
1748
1753
1749 * IPython/iplib.py (InteractiveShell.call_alias): added the
1754 * IPython/iplib.py (InteractiveShell.call_alias): added the
1750 ability for aliases to expand python variables via $.
1755 ability for aliases to expand python variables via $.
1751
1756
1752 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1757 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1753 system, now there's a @rehash/@rehashx pair of magics. These work
1758 system, now there's a @rehash/@rehashx pair of magics. These work
1754 like the csh rehash command, and can be invoked at any time. They
1759 like the csh rehash command, and can be invoked at any time. They
1755 build a table of aliases to everything in the user's $PATH
1760 build a table of aliases to everything in the user's $PATH
1756 (@rehash uses everything, @rehashx is slower but only adds
1761 (@rehash uses everything, @rehashx is slower but only adds
1757 executable files). With this, the pysh.py-based shell profile can
1762 executable files). With this, the pysh.py-based shell profile can
1758 now simply call rehash upon startup, and full access to all
1763 now simply call rehash upon startup, and full access to all
1759 programs in the user's path is obtained.
1764 programs in the user's path is obtained.
1760
1765
1761 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1766 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1762 functionality is now fully in place. I removed the old dynamic
1767 functionality is now fully in place. I removed the old dynamic
1763 code generation based approach, in favor of a much lighter one
1768 code generation based approach, in favor of a much lighter one
1764 based on a simple dict. The advantage is that this allows me to
1769 based on a simple dict. The advantage is that this allows me to
1765 now have thousands of aliases with negligible cost (unthinkable
1770 now have thousands of aliases with negligible cost (unthinkable
1766 with the old system).
1771 with the old system).
1767
1772
1768 2004-06-19 Fernando Perez <fperez@colorado.edu>
1773 2004-06-19 Fernando Perez <fperez@colorado.edu>
1769
1774
1770 * IPython/iplib.py (__init__): extended MagicCompleter class to
1775 * IPython/iplib.py (__init__): extended MagicCompleter class to
1771 also complete (last in priority) on user aliases.
1776 also complete (last in priority) on user aliases.
1772
1777
1773 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1778 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1774 call to eval.
1779 call to eval.
1775 (ItplNS.__init__): Added a new class which functions like Itpl,
1780 (ItplNS.__init__): Added a new class which functions like Itpl,
1776 but allows configuring the namespace for the evaluation to occur
1781 but allows configuring the namespace for the evaluation to occur
1777 in.
1782 in.
1778
1783
1779 2004-06-18 Fernando Perez <fperez@colorado.edu>
1784 2004-06-18 Fernando Perez <fperez@colorado.edu>
1780
1785
1781 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1786 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1782 better message when 'exit' or 'quit' are typed (a common newbie
1787 better message when 'exit' or 'quit' are typed (a common newbie
1783 confusion).
1788 confusion).
1784
1789
1785 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1790 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1786 check for Windows users.
1791 check for Windows users.
1787
1792
1788 * IPython/iplib.py (InteractiveShell.user_setup): removed
1793 * IPython/iplib.py (InteractiveShell.user_setup): removed
1789 disabling of colors for Windows. I'll test at runtime and issue a
1794 disabling of colors for Windows. I'll test at runtime and issue a
1790 warning if Gary's readline isn't found, as to nudge users to
1795 warning if Gary's readline isn't found, as to nudge users to
1791 download it.
1796 download it.
1792
1797
1793 2004-06-16 Fernando Perez <fperez@colorado.edu>
1798 2004-06-16 Fernando Perez <fperez@colorado.edu>
1794
1799
1795 * IPython/genutils.py (Stream.__init__): changed to print errors
1800 * IPython/genutils.py (Stream.__init__): changed to print errors
1796 to sys.stderr. I had a circular dependency here. Now it's
1801 to sys.stderr. I had a circular dependency here. Now it's
1797 possible to run ipython as IDLE's shell (consider this pre-alpha,
1802 possible to run ipython as IDLE's shell (consider this pre-alpha,
1798 since true stdout things end up in the starting terminal instead
1803 since true stdout things end up in the starting terminal instead
1799 of IDLE's out).
1804 of IDLE's out).
1800
1805
1801 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1806 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1802 users who haven't # updated their prompt_in2 definitions. Remove
1807 users who haven't # updated their prompt_in2 definitions. Remove
1803 eventually.
1808 eventually.
1804 (multiple_replace): added credit to original ASPN recipe.
1809 (multiple_replace): added credit to original ASPN recipe.
1805
1810
1806 2004-06-15 Fernando Perez <fperez@colorado.edu>
1811 2004-06-15 Fernando Perez <fperez@colorado.edu>
1807
1812
1808 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1813 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1809 list of auto-defined aliases.
1814 list of auto-defined aliases.
1810
1815
1811 2004-06-13 Fernando Perez <fperez@colorado.edu>
1816 2004-06-13 Fernando Perez <fperez@colorado.edu>
1812
1817
1813 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1818 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1814 install was really requested (so setup.py can be used for other
1819 install was really requested (so setup.py can be used for other
1815 things under Windows).
1820 things under Windows).
1816
1821
1817 2004-06-10 Fernando Perez <fperez@colorado.edu>
1822 2004-06-10 Fernando Perez <fperez@colorado.edu>
1818
1823
1819 * IPython/Logger.py (Logger.create_log): Manually remove any old
1824 * IPython/Logger.py (Logger.create_log): Manually remove any old
1820 backup, since os.remove may fail under Windows. Fixes bug
1825 backup, since os.remove may fail under Windows. Fixes bug
1821 reported by Thorsten.
1826 reported by Thorsten.
1822
1827
1823 2004-06-09 Fernando Perez <fperez@colorado.edu>
1828 2004-06-09 Fernando Perez <fperez@colorado.edu>
1824
1829
1825 * examples/example-embed.py: fixed all references to %n (replaced
1830 * examples/example-embed.py: fixed all references to %n (replaced
1826 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1831 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1827 for all examples and the manual as well.
1832 for all examples and the manual as well.
1828
1833
1829 2004-06-08 Fernando Perez <fperez@colorado.edu>
1834 2004-06-08 Fernando Perez <fperez@colorado.edu>
1830
1835
1831 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1836 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1832 alignment and color management. All 3 prompt subsystems now
1837 alignment and color management. All 3 prompt subsystems now
1833 inherit from BasePrompt.
1838 inherit from BasePrompt.
1834
1839
1835 * tools/release: updates for windows installer build and tag rpms
1840 * tools/release: updates for windows installer build and tag rpms
1836 with python version (since paths are fixed).
1841 with python version (since paths are fixed).
1837
1842
1838 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1843 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1839 which will become eventually obsolete. Also fixed the default
1844 which will become eventually obsolete. Also fixed the default
1840 prompt_in2 to use \D, so at least new users start with the correct
1845 prompt_in2 to use \D, so at least new users start with the correct
1841 defaults.
1846 defaults.
1842 WARNING: Users with existing ipythonrc files will need to apply
1847 WARNING: Users with existing ipythonrc files will need to apply
1843 this fix manually!
1848 this fix manually!
1844
1849
1845 * setup.py: make windows installer (.exe). This is finally the
1850 * setup.py: make windows installer (.exe). This is finally the
1846 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1851 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1847 which I hadn't included because it required Python 2.3 (or recent
1852 which I hadn't included because it required Python 2.3 (or recent
1848 distutils).
1853 distutils).
1849
1854
1850 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1855 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1851 usage of new '\D' escape.
1856 usage of new '\D' escape.
1852
1857
1853 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1858 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1854 lacks os.getuid())
1859 lacks os.getuid())
1855 (CachedOutput.set_colors): Added the ability to turn coloring
1860 (CachedOutput.set_colors): Added the ability to turn coloring
1856 on/off with @colors even for manually defined prompt colors. It
1861 on/off with @colors even for manually defined prompt colors. It
1857 uses a nasty global, but it works safely and via the generic color
1862 uses a nasty global, but it works safely and via the generic color
1858 handling mechanism.
1863 handling mechanism.
1859 (Prompt2.__init__): Introduced new escape '\D' for continuation
1864 (Prompt2.__init__): Introduced new escape '\D' for continuation
1860 prompts. It represents the counter ('\#') as dots.
1865 prompts. It represents the counter ('\#') as dots.
1861 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1866 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1862 need to update their ipythonrc files and replace '%n' with '\D' in
1867 need to update their ipythonrc files and replace '%n' with '\D' in
1863 their prompt_in2 settings everywhere. Sorry, but there's
1868 their prompt_in2 settings everywhere. Sorry, but there's
1864 otherwise no clean way to get all prompts to properly align. The
1869 otherwise no clean way to get all prompts to properly align. The
1865 ipythonrc shipped with IPython has been updated.
1870 ipythonrc shipped with IPython has been updated.
1866
1871
1867 2004-06-07 Fernando Perez <fperez@colorado.edu>
1872 2004-06-07 Fernando Perez <fperez@colorado.edu>
1868
1873
1869 * setup.py (isfile): Pass local_icons option to latex2html, so the
1874 * setup.py (isfile): Pass local_icons option to latex2html, so the
1870 resulting HTML file is self-contained. Thanks to
1875 resulting HTML file is self-contained. Thanks to
1871 dryice-AT-liu.com.cn for the tip.
1876 dryice-AT-liu.com.cn for the tip.
1872
1877
1873 * pysh.py: I created a new profile 'shell', which implements a
1878 * pysh.py: I created a new profile 'shell', which implements a
1874 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1879 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1875 system shell, nor will it become one anytime soon. It's mainly
1880 system shell, nor will it become one anytime soon. It's mainly
1876 meant to illustrate the use of the new flexible bash-like prompts.
1881 meant to illustrate the use of the new flexible bash-like prompts.
1877 I guess it could be used by hardy souls for true shell management,
1882 I guess it could be used by hardy souls for true shell management,
1878 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1883 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1879 profile. This uses the InterpreterExec extension provided by
1884 profile. This uses the InterpreterExec extension provided by
1880 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1885 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1881
1886
1882 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1887 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1883 auto-align itself with the length of the previous input prompt
1888 auto-align itself with the length of the previous input prompt
1884 (taking into account the invisible color escapes).
1889 (taking into account the invisible color escapes).
1885 (CachedOutput.__init__): Large restructuring of this class. Now
1890 (CachedOutput.__init__): Large restructuring of this class. Now
1886 all three prompts (primary1, primary2, output) are proper objects,
1891 all three prompts (primary1, primary2, output) are proper objects,
1887 managed by the 'parent' CachedOutput class. The code is still a
1892 managed by the 'parent' CachedOutput class. The code is still a
1888 bit hackish (all prompts share state via a pointer to the cache),
1893 bit hackish (all prompts share state via a pointer to the cache),
1889 but it's overall far cleaner than before.
1894 but it's overall far cleaner than before.
1890
1895
1891 * IPython/genutils.py (getoutputerror): modified to add verbose,
1896 * IPython/genutils.py (getoutputerror): modified to add verbose,
1892 debug and header options. This makes the interface of all getout*
1897 debug and header options. This makes the interface of all getout*
1893 functions uniform.
1898 functions uniform.
1894 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1899 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1895
1900
1896 * IPython/Magic.py (Magic.default_option): added a function to
1901 * IPython/Magic.py (Magic.default_option): added a function to
1897 allow registering default options for any magic command. This
1902 allow registering default options for any magic command. This
1898 makes it easy to have profiles which customize the magics globally
1903 makes it easy to have profiles which customize the magics globally
1899 for a certain use. The values set through this function are
1904 for a certain use. The values set through this function are
1900 picked up by the parse_options() method, which all magics should
1905 picked up by the parse_options() method, which all magics should
1901 use to parse their options.
1906 use to parse their options.
1902
1907
1903 * IPython/genutils.py (warn): modified the warnings framework to
1908 * IPython/genutils.py (warn): modified the warnings framework to
1904 use the Term I/O class. I'm trying to slowly unify all of
1909 use the Term I/O class. I'm trying to slowly unify all of
1905 IPython's I/O operations to pass through Term.
1910 IPython's I/O operations to pass through Term.
1906
1911
1907 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1912 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1908 the secondary prompt to correctly match the length of the primary
1913 the secondary prompt to correctly match the length of the primary
1909 one for any prompt. Now multi-line code will properly line up
1914 one for any prompt. Now multi-line code will properly line up
1910 even for path dependent prompts, such as the new ones available
1915 even for path dependent prompts, such as the new ones available
1911 via the prompt_specials.
1916 via the prompt_specials.
1912
1917
1913 2004-06-06 Fernando Perez <fperez@colorado.edu>
1918 2004-06-06 Fernando Perez <fperez@colorado.edu>
1914
1919
1915 * IPython/Prompts.py (prompt_specials): Added the ability to have
1920 * IPython/Prompts.py (prompt_specials): Added the ability to have
1916 bash-like special sequences in the prompts, which get
1921 bash-like special sequences in the prompts, which get
1917 automatically expanded. Things like hostname, current working
1922 automatically expanded. Things like hostname, current working
1918 directory and username are implemented already, but it's easy to
1923 directory and username are implemented already, but it's easy to
1919 add more in the future. Thanks to a patch by W.J. van der Laan
1924 add more in the future. Thanks to a patch by W.J. van der Laan
1920 <gnufnork-AT-hetdigitalegat.nl>
1925 <gnufnork-AT-hetdigitalegat.nl>
1921 (prompt_specials): Added color support for prompt strings, so
1926 (prompt_specials): Added color support for prompt strings, so
1922 users can define arbitrary color setups for their prompts.
1927 users can define arbitrary color setups for their prompts.
1923
1928
1924 2004-06-05 Fernando Perez <fperez@colorado.edu>
1929 2004-06-05 Fernando Perez <fperez@colorado.edu>
1925
1930
1926 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1931 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1927 code to load Gary Bishop's readline and configure it
1932 code to load Gary Bishop's readline and configure it
1928 automatically. Thanks to Gary for help on this.
1933 automatically. Thanks to Gary for help on this.
1929
1934
1930 2004-06-01 Fernando Perez <fperez@colorado.edu>
1935 2004-06-01 Fernando Perez <fperez@colorado.edu>
1931
1936
1932 * IPython/Logger.py (Logger.create_log): fix bug for logging
1937 * IPython/Logger.py (Logger.create_log): fix bug for logging
1933 with no filename (previous fix was incomplete).
1938 with no filename (previous fix was incomplete).
1934
1939
1935 2004-05-25 Fernando Perez <fperez@colorado.edu>
1940 2004-05-25 Fernando Perez <fperez@colorado.edu>
1936
1941
1937 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1942 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1938 parens would get passed to the shell.
1943 parens would get passed to the shell.
1939
1944
1940 2004-05-20 Fernando Perez <fperez@colorado.edu>
1945 2004-05-20 Fernando Perez <fperez@colorado.edu>
1941
1946
1942 * IPython/Magic.py (Magic.magic_prun): changed default profile
1947 * IPython/Magic.py (Magic.magic_prun): changed default profile
1943 sort order to 'time' (the more common profiling need).
1948 sort order to 'time' (the more common profiling need).
1944
1949
1945 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1950 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1946 so that source code shown is guaranteed in sync with the file on
1951 so that source code shown is guaranteed in sync with the file on
1947 disk (also changed in psource). Similar fix to the one for
1952 disk (also changed in psource). Similar fix to the one for
1948 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1953 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1949 <yann.ledu-AT-noos.fr>.
1954 <yann.ledu-AT-noos.fr>.
1950
1955
1951 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1956 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1952 with a single option would not be correctly parsed. Closes
1957 with a single option would not be correctly parsed. Closes
1953 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1958 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1954 introduced in 0.6.0 (on 2004-05-06).
1959 introduced in 0.6.0 (on 2004-05-06).
1955
1960
1956 2004-05-13 *** Released version 0.6.0
1961 2004-05-13 *** Released version 0.6.0
1957
1962
1958 2004-05-13 Fernando Perez <fperez@colorado.edu>
1963 2004-05-13 Fernando Perez <fperez@colorado.edu>
1959
1964
1960 * debian/: Added debian/ directory to CVS, so that debian support
1965 * debian/: Added debian/ directory to CVS, so that debian support
1961 is publicly accessible. The debian package is maintained by Jack
1966 is publicly accessible. The debian package is maintained by Jack
1962 Moffit <jack-AT-xiph.org>.
1967 Moffit <jack-AT-xiph.org>.
1963
1968
1964 * Documentation: included the notes about an ipython-based system
1969 * Documentation: included the notes about an ipython-based system
1965 shell (the hypothetical 'pysh') into the new_design.pdf document,
1970 shell (the hypothetical 'pysh') into the new_design.pdf document,
1966 so that these ideas get distributed to users along with the
1971 so that these ideas get distributed to users along with the
1967 official documentation.
1972 official documentation.
1968
1973
1969 2004-05-10 Fernando Perez <fperez@colorado.edu>
1974 2004-05-10 Fernando Perez <fperez@colorado.edu>
1970
1975
1971 * IPython/Logger.py (Logger.create_log): fix recently introduced
1976 * IPython/Logger.py (Logger.create_log): fix recently introduced
1972 bug (misindented line) where logstart would fail when not given an
1977 bug (misindented line) where logstart would fail when not given an
1973 explicit filename.
1978 explicit filename.
1974
1979
1975 2004-05-09 Fernando Perez <fperez@colorado.edu>
1980 2004-05-09 Fernando Perez <fperez@colorado.edu>
1976
1981
1977 * IPython/Magic.py (Magic.parse_options): skip system call when
1982 * IPython/Magic.py (Magic.parse_options): skip system call when
1978 there are no options to look for. Faster, cleaner for the common
1983 there are no options to look for. Faster, cleaner for the common
1979 case.
1984 case.
1980
1985
1981 * Documentation: many updates to the manual: describing Windows
1986 * Documentation: many updates to the manual: describing Windows
1982 support better, Gnuplot updates, credits, misc small stuff. Also
1987 support better, Gnuplot updates, credits, misc small stuff. Also
1983 updated the new_design doc a bit.
1988 updated the new_design doc a bit.
1984
1989
1985 2004-05-06 *** Released version 0.6.0.rc1
1990 2004-05-06 *** Released version 0.6.0.rc1
1986
1991
1987 2004-05-06 Fernando Perez <fperez@colorado.edu>
1992 2004-05-06 Fernando Perez <fperez@colorado.edu>
1988
1993
1989 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1994 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1990 operations to use the vastly more efficient list/''.join() method.
1995 operations to use the vastly more efficient list/''.join() method.
1991 (FormattedTB.text): Fix
1996 (FormattedTB.text): Fix
1992 http://www.scipy.net/roundup/ipython/issue12 - exception source
1997 http://www.scipy.net/roundup/ipython/issue12 - exception source
1993 extract not updated after reload. Thanks to Mike Salib
1998 extract not updated after reload. Thanks to Mike Salib
1994 <msalib-AT-mit.edu> for pinning the source of the problem.
1999 <msalib-AT-mit.edu> for pinning the source of the problem.
1995 Fortunately, the solution works inside ipython and doesn't require
2000 Fortunately, the solution works inside ipython and doesn't require
1996 any changes to python proper.
2001 any changes to python proper.
1997
2002
1998 * IPython/Magic.py (Magic.parse_options): Improved to process the
2003 * IPython/Magic.py (Magic.parse_options): Improved to process the
1999 argument list as a true shell would (by actually using the
2004 argument list as a true shell would (by actually using the
2000 underlying system shell). This way, all @magics automatically get
2005 underlying system shell). This way, all @magics automatically get
2001 shell expansion for variables. Thanks to a comment by Alex
2006 shell expansion for variables. Thanks to a comment by Alex
2002 Schmolck.
2007 Schmolck.
2003
2008
2004 2004-04-04 Fernando Perez <fperez@colorado.edu>
2009 2004-04-04 Fernando Perez <fperez@colorado.edu>
2005
2010
2006 * IPython/iplib.py (InteractiveShell.interact): Added a special
2011 * IPython/iplib.py (InteractiveShell.interact): Added a special
2007 trap for a debugger quit exception, which is basically impossible
2012 trap for a debugger quit exception, which is basically impossible
2008 to handle by normal mechanisms, given what pdb does to the stack.
2013 to handle by normal mechanisms, given what pdb does to the stack.
2009 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2014 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2010
2015
2011 2004-04-03 Fernando Perez <fperez@colorado.edu>
2016 2004-04-03 Fernando Perez <fperez@colorado.edu>
2012
2017
2013 * IPython/genutils.py (Term): Standardized the names of the Term
2018 * IPython/genutils.py (Term): Standardized the names of the Term
2014 class streams to cin/cout/cerr, following C++ naming conventions
2019 class streams to cin/cout/cerr, following C++ naming conventions
2015 (I can't use in/out/err because 'in' is not a valid attribute
2020 (I can't use in/out/err because 'in' is not a valid attribute
2016 name).
2021 name).
2017
2022
2018 * IPython/iplib.py (InteractiveShell.interact): don't increment
2023 * IPython/iplib.py (InteractiveShell.interact): don't increment
2019 the prompt if there's no user input. By Daniel 'Dang' Griffith
2024 the prompt if there's no user input. By Daniel 'Dang' Griffith
2020 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2025 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2021 Francois Pinard.
2026 Francois Pinard.
2022
2027
2023 2004-04-02 Fernando Perez <fperez@colorado.edu>
2028 2004-04-02 Fernando Perez <fperez@colorado.edu>
2024
2029
2025 * IPython/genutils.py (Stream.__init__): Modified to survive at
2030 * IPython/genutils.py (Stream.__init__): Modified to survive at
2026 least importing in contexts where stdin/out/err aren't true file
2031 least importing in contexts where stdin/out/err aren't true file
2027 objects, such as PyCrust (they lack fileno() and mode). However,
2032 objects, such as PyCrust (they lack fileno() and mode). However,
2028 the recovery facilities which rely on these things existing will
2033 the recovery facilities which rely on these things existing will
2029 not work.
2034 not work.
2030
2035
2031 2004-04-01 Fernando Perez <fperez@colorado.edu>
2036 2004-04-01 Fernando Perez <fperez@colorado.edu>
2032
2037
2033 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2038 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2034 use the new getoutputerror() function, so it properly
2039 use the new getoutputerror() function, so it properly
2035 distinguishes stdout/err.
2040 distinguishes stdout/err.
2036
2041
2037 * IPython/genutils.py (getoutputerror): added a function to
2042 * IPython/genutils.py (getoutputerror): added a function to
2038 capture separately the standard output and error of a command.
2043 capture separately the standard output and error of a command.
2039 After a comment from dang on the mailing lists. This code is
2044 After a comment from dang on the mailing lists. This code is
2040 basically a modified version of commands.getstatusoutput(), from
2045 basically a modified version of commands.getstatusoutput(), from
2041 the standard library.
2046 the standard library.
2042
2047
2043 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2048 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2044 '!!' as a special syntax (shorthand) to access @sx.
2049 '!!' as a special syntax (shorthand) to access @sx.
2045
2050
2046 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2051 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2047 command and return its output as a list split on '\n'.
2052 command and return its output as a list split on '\n'.
2048
2053
2049 2004-03-31 Fernando Perez <fperez@colorado.edu>
2054 2004-03-31 Fernando Perez <fperez@colorado.edu>
2050
2055
2051 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2056 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2052 method to dictionaries used as FakeModule instances if they lack
2057 method to dictionaries used as FakeModule instances if they lack
2053 it. At least pydoc in python2.3 breaks for runtime-defined
2058 it. At least pydoc in python2.3 breaks for runtime-defined
2054 functions without this hack. At some point I need to _really_
2059 functions without this hack. At some point I need to _really_
2055 understand what FakeModule is doing, because it's a gross hack.
2060 understand what FakeModule is doing, because it's a gross hack.
2056 But it solves Arnd's problem for now...
2061 But it solves Arnd's problem for now...
2057
2062
2058 2004-02-27 Fernando Perez <fperez@colorado.edu>
2063 2004-02-27 Fernando Perez <fperez@colorado.edu>
2059
2064
2060 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2065 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2061 mode would behave erratically. Also increased the number of
2066 mode would behave erratically. Also increased the number of
2062 possible logs in rotate mod to 999. Thanks to Rod Holland
2067 possible logs in rotate mod to 999. Thanks to Rod Holland
2063 <rhh@StructureLABS.com> for the report and fixes.
2068 <rhh@StructureLABS.com> for the report and fixes.
2064
2069
2065 2004-02-26 Fernando Perez <fperez@colorado.edu>
2070 2004-02-26 Fernando Perez <fperez@colorado.edu>
2066
2071
2067 * IPython/genutils.py (page): Check that the curses module really
2072 * IPython/genutils.py (page): Check that the curses module really
2068 has the initscr attribute before trying to use it. For some
2073 has the initscr attribute before trying to use it. For some
2069 reason, the Solaris curses module is missing this. I think this
2074 reason, the Solaris curses module is missing this. I think this
2070 should be considered a Solaris python bug, but I'm not sure.
2075 should be considered a Solaris python bug, but I'm not sure.
2071
2076
2072 2004-01-17 Fernando Perez <fperez@colorado.edu>
2077 2004-01-17 Fernando Perez <fperez@colorado.edu>
2073
2078
2074 * IPython/genutils.py (Stream.__init__): Changes to try to make
2079 * IPython/genutils.py (Stream.__init__): Changes to try to make
2075 ipython robust against stdin/out/err being closed by the user.
2080 ipython robust against stdin/out/err being closed by the user.
2076 This is 'user error' (and blocks a normal python session, at least
2081 This is 'user error' (and blocks a normal python session, at least
2077 the stdout case). However, Ipython should be able to survive such
2082 the stdout case). However, Ipython should be able to survive such
2078 instances of abuse as gracefully as possible. To simplify the
2083 instances of abuse as gracefully as possible. To simplify the
2079 coding and maintain compatibility with Gary Bishop's Term
2084 coding and maintain compatibility with Gary Bishop's Term
2080 contributions, I've made use of classmethods for this. I think
2085 contributions, I've made use of classmethods for this. I think
2081 this introduces a dependency on python 2.2.
2086 this introduces a dependency on python 2.2.
2082
2087
2083 2004-01-13 Fernando Perez <fperez@colorado.edu>
2088 2004-01-13 Fernando Perez <fperez@colorado.edu>
2084
2089
2085 * IPython/numutils.py (exp_safe): simplified the code a bit and
2090 * IPython/numutils.py (exp_safe): simplified the code a bit and
2086 removed the need for importing the kinds module altogether.
2091 removed the need for importing the kinds module altogether.
2087
2092
2088 2004-01-06 Fernando Perez <fperez@colorado.edu>
2093 2004-01-06 Fernando Perez <fperez@colorado.edu>
2089
2094
2090 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2095 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2091 a magic function instead, after some community feedback. No
2096 a magic function instead, after some community feedback. No
2092 special syntax will exist for it, but its name is deliberately
2097 special syntax will exist for it, but its name is deliberately
2093 very short.
2098 very short.
2094
2099
2095 2003-12-20 Fernando Perez <fperez@colorado.edu>
2100 2003-12-20 Fernando Perez <fperez@colorado.edu>
2096
2101
2097 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2102 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2098 new functionality, to automagically assign the result of a shell
2103 new functionality, to automagically assign the result of a shell
2099 command to a variable. I'll solicit some community feedback on
2104 command to a variable. I'll solicit some community feedback on
2100 this before making it permanent.
2105 this before making it permanent.
2101
2106
2102 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2107 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2103 requested about callables for which inspect couldn't obtain a
2108 requested about callables for which inspect couldn't obtain a
2104 proper argspec. Thanks to a crash report sent by Etienne
2109 proper argspec. Thanks to a crash report sent by Etienne
2105 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2110 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2106
2111
2107 2003-12-09 Fernando Perez <fperez@colorado.edu>
2112 2003-12-09 Fernando Perez <fperez@colorado.edu>
2108
2113
2109 * IPython/genutils.py (page): patch for the pager to work across
2114 * IPython/genutils.py (page): patch for the pager to work across
2110 various versions of Windows. By Gary Bishop.
2115 various versions of Windows. By Gary Bishop.
2111
2116
2112 2003-12-04 Fernando Perez <fperez@colorado.edu>
2117 2003-12-04 Fernando Perez <fperez@colorado.edu>
2113
2118
2114 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2119 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2115 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2120 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2116 While I tested this and it looks ok, there may still be corner
2121 While I tested this and it looks ok, there may still be corner
2117 cases I've missed.
2122 cases I've missed.
2118
2123
2119 2003-12-01 Fernando Perez <fperez@colorado.edu>
2124 2003-12-01 Fernando Perez <fperez@colorado.edu>
2120
2125
2121 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2126 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2122 where a line like 'p,q=1,2' would fail because the automagic
2127 where a line like 'p,q=1,2' would fail because the automagic
2123 system would be triggered for @p.
2128 system would be triggered for @p.
2124
2129
2125 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2130 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2126 cleanups, code unmodified.
2131 cleanups, code unmodified.
2127
2132
2128 * IPython/genutils.py (Term): added a class for IPython to handle
2133 * IPython/genutils.py (Term): added a class for IPython to handle
2129 output. In most cases it will just be a proxy for stdout/err, but
2134 output. In most cases it will just be a proxy for stdout/err, but
2130 having this allows modifications to be made for some platforms,
2135 having this allows modifications to be made for some platforms,
2131 such as handling color escapes under Windows. All of this code
2136 such as handling color escapes under Windows. All of this code
2132 was contributed by Gary Bishop, with minor modifications by me.
2137 was contributed by Gary Bishop, with minor modifications by me.
2133 The actual changes affect many files.
2138 The actual changes affect many files.
2134
2139
2135 2003-11-30 Fernando Perez <fperez@colorado.edu>
2140 2003-11-30 Fernando Perez <fperez@colorado.edu>
2136
2141
2137 * IPython/iplib.py (file_matches): new completion code, courtesy
2142 * IPython/iplib.py (file_matches): new completion code, courtesy
2138 of Jeff Collins. This enables filename completion again under
2143 of Jeff Collins. This enables filename completion again under
2139 python 2.3, which disabled it at the C level.
2144 python 2.3, which disabled it at the C level.
2140
2145
2141 2003-11-11 Fernando Perez <fperez@colorado.edu>
2146 2003-11-11 Fernando Perez <fperez@colorado.edu>
2142
2147
2143 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2148 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2144 for Numeric.array(map(...)), but often convenient.
2149 for Numeric.array(map(...)), but often convenient.
2145
2150
2146 2003-11-05 Fernando Perez <fperez@colorado.edu>
2151 2003-11-05 Fernando Perez <fperez@colorado.edu>
2147
2152
2148 * IPython/numutils.py (frange): Changed a call from int() to
2153 * IPython/numutils.py (frange): Changed a call from int() to
2149 int(round()) to prevent a problem reported with arange() in the
2154 int(round()) to prevent a problem reported with arange() in the
2150 numpy list.
2155 numpy list.
2151
2156
2152 2003-10-06 Fernando Perez <fperez@colorado.edu>
2157 2003-10-06 Fernando Perez <fperez@colorado.edu>
2153
2158
2154 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2159 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2155 prevent crashes if sys lacks an argv attribute (it happens with
2160 prevent crashes if sys lacks an argv attribute (it happens with
2156 embedded interpreters which build a bare-bones sys module).
2161 embedded interpreters which build a bare-bones sys module).
2157 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2162 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2158
2163
2159 2003-09-24 Fernando Perez <fperez@colorado.edu>
2164 2003-09-24 Fernando Perez <fperez@colorado.edu>
2160
2165
2161 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2166 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2162 to protect against poorly written user objects where __getattr__
2167 to protect against poorly written user objects where __getattr__
2163 raises exceptions other than AttributeError. Thanks to a bug
2168 raises exceptions other than AttributeError. Thanks to a bug
2164 report by Oliver Sander <osander-AT-gmx.de>.
2169 report by Oliver Sander <osander-AT-gmx.de>.
2165
2170
2166 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2171 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2167 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2172 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2168
2173
2169 2003-09-09 Fernando Perez <fperez@colorado.edu>
2174 2003-09-09 Fernando Perez <fperez@colorado.edu>
2170
2175
2171 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2176 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2172 unpacking a list whith a callable as first element would
2177 unpacking a list whith a callable as first element would
2173 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2178 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2174 Collins.
2179 Collins.
2175
2180
2176 2003-08-25 *** Released version 0.5.0
2181 2003-08-25 *** Released version 0.5.0
2177
2182
2178 2003-08-22 Fernando Perez <fperez@colorado.edu>
2183 2003-08-22 Fernando Perez <fperez@colorado.edu>
2179
2184
2180 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2185 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2181 improperly defined user exceptions. Thanks to feedback from Mark
2186 improperly defined user exceptions. Thanks to feedback from Mark
2182 Russell <mrussell-AT-verio.net>.
2187 Russell <mrussell-AT-verio.net>.
2183
2188
2184 2003-08-20 Fernando Perez <fperez@colorado.edu>
2189 2003-08-20 Fernando Perez <fperez@colorado.edu>
2185
2190
2186 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2191 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2187 printing so that it would print multi-line string forms starting
2192 printing so that it would print multi-line string forms starting
2188 with a new line. This way the formatting is better respected for
2193 with a new line. This way the formatting is better respected for
2189 objects which work hard to make nice string forms.
2194 objects which work hard to make nice string forms.
2190
2195
2191 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2196 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2192 autocall would overtake data access for objects with both
2197 autocall would overtake data access for objects with both
2193 __getitem__ and __call__.
2198 __getitem__ and __call__.
2194
2199
2195 2003-08-19 *** Released version 0.5.0-rc1
2200 2003-08-19 *** Released version 0.5.0-rc1
2196
2201
2197 2003-08-19 Fernando Perez <fperez@colorado.edu>
2202 2003-08-19 Fernando Perez <fperez@colorado.edu>
2198
2203
2199 * IPython/deep_reload.py (load_tail): single tiny change here
2204 * IPython/deep_reload.py (load_tail): single tiny change here
2200 seems to fix the long-standing bug of dreload() failing to work
2205 seems to fix the long-standing bug of dreload() failing to work
2201 for dotted names. But this module is pretty tricky, so I may have
2206 for dotted names. But this module is pretty tricky, so I may have
2202 missed some subtlety. Needs more testing!.
2207 missed some subtlety. Needs more testing!.
2203
2208
2204 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2209 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2205 exceptions which have badly implemented __str__ methods.
2210 exceptions which have badly implemented __str__ methods.
2206 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2211 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2207 which I've been getting reports about from Python 2.3 users. I
2212 which I've been getting reports about from Python 2.3 users. I
2208 wish I had a simple test case to reproduce the problem, so I could
2213 wish I had a simple test case to reproduce the problem, so I could
2209 either write a cleaner workaround or file a bug report if
2214 either write a cleaner workaround or file a bug report if
2210 necessary.
2215 necessary.
2211
2216
2212 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2217 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2213 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2218 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2214 a bug report by Tjabo Kloppenburg.
2219 a bug report by Tjabo Kloppenburg.
2215
2220
2216 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2221 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2217 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2222 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2218 seems rather unstable. Thanks to a bug report by Tjabo
2223 seems rather unstable. Thanks to a bug report by Tjabo
2219 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2224 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2220
2225
2221 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2226 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2222 this out soon because of the critical fixes in the inner loop for
2227 this out soon because of the critical fixes in the inner loop for
2223 generators.
2228 generators.
2224
2229
2225 * IPython/Magic.py (Magic.getargspec): removed. This (and
2230 * IPython/Magic.py (Magic.getargspec): removed. This (and
2226 _get_def) have been obsoleted by OInspect for a long time, I
2231 _get_def) have been obsoleted by OInspect for a long time, I
2227 hadn't noticed that they were dead code.
2232 hadn't noticed that they were dead code.
2228 (Magic._ofind): restored _ofind functionality for a few literals
2233 (Magic._ofind): restored _ofind functionality for a few literals
2229 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2234 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2230 for things like "hello".capitalize?, since that would require a
2235 for things like "hello".capitalize?, since that would require a
2231 potentially dangerous eval() again.
2236 potentially dangerous eval() again.
2232
2237
2233 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2238 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2234 logic a bit more to clean up the escapes handling and minimize the
2239 logic a bit more to clean up the escapes handling and minimize the
2235 use of _ofind to only necessary cases. The interactive 'feel' of
2240 use of _ofind to only necessary cases. The interactive 'feel' of
2236 IPython should have improved quite a bit with the changes in
2241 IPython should have improved quite a bit with the changes in
2237 _prefilter and _ofind (besides being far safer than before).
2242 _prefilter and _ofind (besides being far safer than before).
2238
2243
2239 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2244 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2240 obscure, never reported). Edit would fail to find the object to
2245 obscure, never reported). Edit would fail to find the object to
2241 edit under some circumstances.
2246 edit under some circumstances.
2242 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2247 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2243 which were causing double-calling of generators. Those eval calls
2248 which were causing double-calling of generators. Those eval calls
2244 were _very_ dangerous, since code with side effects could be
2249 were _very_ dangerous, since code with side effects could be
2245 triggered. As they say, 'eval is evil'... These were the
2250 triggered. As they say, 'eval is evil'... These were the
2246 nastiest evals in IPython. Besides, _ofind is now far simpler,
2251 nastiest evals in IPython. Besides, _ofind is now far simpler,
2247 and it should also be quite a bit faster. Its use of inspect is
2252 and it should also be quite a bit faster. Its use of inspect is
2248 also safer, so perhaps some of the inspect-related crashes I've
2253 also safer, so perhaps some of the inspect-related crashes I've
2249 seen lately with Python 2.3 might be taken care of. That will
2254 seen lately with Python 2.3 might be taken care of. That will
2250 need more testing.
2255 need more testing.
2251
2256
2252 2003-08-17 Fernando Perez <fperez@colorado.edu>
2257 2003-08-17 Fernando Perez <fperez@colorado.edu>
2253
2258
2254 * IPython/iplib.py (InteractiveShell._prefilter): significant
2259 * IPython/iplib.py (InteractiveShell._prefilter): significant
2255 simplifications to the logic for handling user escapes. Faster
2260 simplifications to the logic for handling user escapes. Faster
2256 and simpler code.
2261 and simpler code.
2257
2262
2258 2003-08-14 Fernando Perez <fperez@colorado.edu>
2263 2003-08-14 Fernando Perez <fperez@colorado.edu>
2259
2264
2260 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2265 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2261 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2266 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2262 but it should be quite a bit faster. And the recursive version
2267 but it should be quite a bit faster. And the recursive version
2263 generated O(log N) intermediate storage for all rank>1 arrays,
2268 generated O(log N) intermediate storage for all rank>1 arrays,
2264 even if they were contiguous.
2269 even if they were contiguous.
2265 (l1norm): Added this function.
2270 (l1norm): Added this function.
2266 (norm): Added this function for arbitrary norms (including
2271 (norm): Added this function for arbitrary norms (including
2267 l-infinity). l1 and l2 are still special cases for convenience
2272 l-infinity). l1 and l2 are still special cases for convenience
2268 and speed.
2273 and speed.
2269
2274
2270 2003-08-03 Fernando Perez <fperez@colorado.edu>
2275 2003-08-03 Fernando Perez <fperez@colorado.edu>
2271
2276
2272 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2277 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2273 exceptions, which now raise PendingDeprecationWarnings in Python
2278 exceptions, which now raise PendingDeprecationWarnings in Python
2274 2.3. There were some in Magic and some in Gnuplot2.
2279 2.3. There were some in Magic and some in Gnuplot2.
2275
2280
2276 2003-06-30 Fernando Perez <fperez@colorado.edu>
2281 2003-06-30 Fernando Perez <fperez@colorado.edu>
2277
2282
2278 * IPython/genutils.py (page): modified to call curses only for
2283 * IPython/genutils.py (page): modified to call curses only for
2279 terminals where TERM=='xterm'. After problems under many other
2284 terminals where TERM=='xterm'. After problems under many other
2280 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2285 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2281
2286
2282 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2287 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2283 would be triggered when readline was absent. This was just an old
2288 would be triggered when readline was absent. This was just an old
2284 debugging statement I'd forgotten to take out.
2289 debugging statement I'd forgotten to take out.
2285
2290
2286 2003-06-20 Fernando Perez <fperez@colorado.edu>
2291 2003-06-20 Fernando Perez <fperez@colorado.edu>
2287
2292
2288 * IPython/genutils.py (clock): modified to return only user time
2293 * IPython/genutils.py (clock): modified to return only user time
2289 (not counting system time), after a discussion on scipy. While
2294 (not counting system time), after a discussion on scipy. While
2290 system time may be a useful quantity occasionally, it may much
2295 system time may be a useful quantity occasionally, it may much
2291 more easily be skewed by occasional swapping or other similar
2296 more easily be skewed by occasional swapping or other similar
2292 activity.
2297 activity.
2293
2298
2294 2003-06-05 Fernando Perez <fperez@colorado.edu>
2299 2003-06-05 Fernando Perez <fperez@colorado.edu>
2295
2300
2296 * IPython/numutils.py (identity): new function, for building
2301 * IPython/numutils.py (identity): new function, for building
2297 arbitrary rank Kronecker deltas (mostly backwards compatible with
2302 arbitrary rank Kronecker deltas (mostly backwards compatible with
2298 Numeric.identity)
2303 Numeric.identity)
2299
2304
2300 2003-06-03 Fernando Perez <fperez@colorado.edu>
2305 2003-06-03 Fernando Perez <fperez@colorado.edu>
2301
2306
2302 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2307 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2303 arguments passed to magics with spaces, to allow trailing '\' to
2308 arguments passed to magics with spaces, to allow trailing '\' to
2304 work normally (mainly for Windows users).
2309 work normally (mainly for Windows users).
2305
2310
2306 2003-05-29 Fernando Perez <fperez@colorado.edu>
2311 2003-05-29 Fernando Perez <fperez@colorado.edu>
2307
2312
2308 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2313 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2309 instead of pydoc.help. This fixes a bizarre behavior where
2314 instead of pydoc.help. This fixes a bizarre behavior where
2310 printing '%s' % locals() would trigger the help system. Now
2315 printing '%s' % locals() would trigger the help system. Now
2311 ipython behaves like normal python does.
2316 ipython behaves like normal python does.
2312
2317
2313 Note that if one does 'from pydoc import help', the bizarre
2318 Note that if one does 'from pydoc import help', the bizarre
2314 behavior returns, but this will also happen in normal python, so
2319 behavior returns, but this will also happen in normal python, so
2315 it's not an ipython bug anymore (it has to do with how pydoc.help
2320 it's not an ipython bug anymore (it has to do with how pydoc.help
2316 is implemented).
2321 is implemented).
2317
2322
2318 2003-05-22 Fernando Perez <fperez@colorado.edu>
2323 2003-05-22 Fernando Perez <fperez@colorado.edu>
2319
2324
2320 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2325 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2321 return [] instead of None when nothing matches, also match to end
2326 return [] instead of None when nothing matches, also match to end
2322 of line. Patch by Gary Bishop.
2327 of line. Patch by Gary Bishop.
2323
2328
2324 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2329 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2325 protection as before, for files passed on the command line. This
2330 protection as before, for files passed on the command line. This
2326 prevents the CrashHandler from kicking in if user files call into
2331 prevents the CrashHandler from kicking in if user files call into
2327 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2332 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2328 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2333 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2329
2334
2330 2003-05-20 *** Released version 0.4.0
2335 2003-05-20 *** Released version 0.4.0
2331
2336
2332 2003-05-20 Fernando Perez <fperez@colorado.edu>
2337 2003-05-20 Fernando Perez <fperez@colorado.edu>
2333
2338
2334 * setup.py: added support for manpages. It's a bit hackish b/c of
2339 * setup.py: added support for manpages. It's a bit hackish b/c of
2335 a bug in the way the bdist_rpm distutils target handles gzipped
2340 a bug in the way the bdist_rpm distutils target handles gzipped
2336 manpages, but it works. After a patch by Jack.
2341 manpages, but it works. After a patch by Jack.
2337
2342
2338 2003-05-19 Fernando Perez <fperez@colorado.edu>
2343 2003-05-19 Fernando Perez <fperez@colorado.edu>
2339
2344
2340 * IPython/numutils.py: added a mockup of the kinds module, since
2345 * IPython/numutils.py: added a mockup of the kinds module, since
2341 it was recently removed from Numeric. This way, numutils will
2346 it was recently removed from Numeric. This way, numutils will
2342 work for all users even if they are missing kinds.
2347 work for all users even if they are missing kinds.
2343
2348
2344 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2349 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2345 failure, which can occur with SWIG-wrapped extensions. After a
2350 failure, which can occur with SWIG-wrapped extensions. After a
2346 crash report from Prabhu.
2351 crash report from Prabhu.
2347
2352
2348 2003-05-16 Fernando Perez <fperez@colorado.edu>
2353 2003-05-16 Fernando Perez <fperez@colorado.edu>
2349
2354
2350 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2355 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2351 protect ipython from user code which may call directly
2356 protect ipython from user code which may call directly
2352 sys.excepthook (this looks like an ipython crash to the user, even
2357 sys.excepthook (this looks like an ipython crash to the user, even
2353 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2358 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2354 This is especially important to help users of WxWindows, but may
2359 This is especially important to help users of WxWindows, but may
2355 also be useful in other cases.
2360 also be useful in other cases.
2356
2361
2357 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2362 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2358 an optional tb_offset to be specified, and to preserve exception
2363 an optional tb_offset to be specified, and to preserve exception
2359 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2364 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2360
2365
2361 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2366 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2362
2367
2363 2003-05-15 Fernando Perez <fperez@colorado.edu>
2368 2003-05-15 Fernando Perez <fperez@colorado.edu>
2364
2369
2365 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2370 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2366 installing for a new user under Windows.
2371 installing for a new user under Windows.
2367
2372
2368 2003-05-12 Fernando Perez <fperez@colorado.edu>
2373 2003-05-12 Fernando Perez <fperez@colorado.edu>
2369
2374
2370 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2375 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2371 handler for Emacs comint-based lines. Currently it doesn't do
2376 handler for Emacs comint-based lines. Currently it doesn't do
2372 much (but importantly, it doesn't update the history cache). In
2377 much (but importantly, it doesn't update the history cache). In
2373 the future it may be expanded if Alex needs more functionality
2378 the future it may be expanded if Alex needs more functionality
2374 there.
2379 there.
2375
2380
2376 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2381 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2377 info to crash reports.
2382 info to crash reports.
2378
2383
2379 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2384 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2380 just like Python's -c. Also fixed crash with invalid -color
2385 just like Python's -c. Also fixed crash with invalid -color
2381 option value at startup. Thanks to Will French
2386 option value at startup. Thanks to Will French
2382 <wfrench-AT-bestweb.net> for the bug report.
2387 <wfrench-AT-bestweb.net> for the bug report.
2383
2388
2384 2003-05-09 Fernando Perez <fperez@colorado.edu>
2389 2003-05-09 Fernando Perez <fperez@colorado.edu>
2385
2390
2386 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2391 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2387 to EvalDict (it's a mapping, after all) and simplified its code
2392 to EvalDict (it's a mapping, after all) and simplified its code
2388 quite a bit, after a nice discussion on c.l.py where Gustavo
2393 quite a bit, after a nice discussion on c.l.py where Gustavo
2389 Córdova <gcordova-AT-sismex.com> suggested the new version.
2394 Córdova <gcordova-AT-sismex.com> suggested the new version.
2390
2395
2391 2003-04-30 Fernando Perez <fperez@colorado.edu>
2396 2003-04-30 Fernando Perez <fperez@colorado.edu>
2392
2397
2393 * IPython/genutils.py (timings_out): modified it to reduce its
2398 * IPython/genutils.py (timings_out): modified it to reduce its
2394 overhead in the common reps==1 case.
2399 overhead in the common reps==1 case.
2395
2400
2396 2003-04-29 Fernando Perez <fperez@colorado.edu>
2401 2003-04-29 Fernando Perez <fperez@colorado.edu>
2397
2402
2398 * IPython/genutils.py (timings_out): Modified to use the resource
2403 * IPython/genutils.py (timings_out): Modified to use the resource
2399 module, which avoids the wraparound problems of time.clock().
2404 module, which avoids the wraparound problems of time.clock().
2400
2405
2401 2003-04-17 *** Released version 0.2.15pre4
2406 2003-04-17 *** Released version 0.2.15pre4
2402
2407
2403 2003-04-17 Fernando Perez <fperez@colorado.edu>
2408 2003-04-17 Fernando Perez <fperez@colorado.edu>
2404
2409
2405 * setup.py (scriptfiles): Split windows-specific stuff over to a
2410 * setup.py (scriptfiles): Split windows-specific stuff over to a
2406 separate file, in an attempt to have a Windows GUI installer.
2411 separate file, in an attempt to have a Windows GUI installer.
2407 That didn't work, but part of the groundwork is done.
2412 That didn't work, but part of the groundwork is done.
2408
2413
2409 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2414 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2410 indent/unindent with 4 spaces. Particularly useful in combination
2415 indent/unindent with 4 spaces. Particularly useful in combination
2411 with the new auto-indent option.
2416 with the new auto-indent option.
2412
2417
2413 2003-04-16 Fernando Perez <fperez@colorado.edu>
2418 2003-04-16 Fernando Perez <fperez@colorado.edu>
2414
2419
2415 * IPython/Magic.py: various replacements of self.rc for
2420 * IPython/Magic.py: various replacements of self.rc for
2416 self.shell.rc. A lot more remains to be done to fully disentangle
2421 self.shell.rc. A lot more remains to be done to fully disentangle
2417 this class from the main Shell class.
2422 this class from the main Shell class.
2418
2423
2419 * IPython/GnuplotRuntime.py: added checks for mouse support so
2424 * IPython/GnuplotRuntime.py: added checks for mouse support so
2420 that we don't try to enable it if the current gnuplot doesn't
2425 that we don't try to enable it if the current gnuplot doesn't
2421 really support it. Also added checks so that we don't try to
2426 really support it. Also added checks so that we don't try to
2422 enable persist under Windows (where Gnuplot doesn't recognize the
2427 enable persist under Windows (where Gnuplot doesn't recognize the
2423 option).
2428 option).
2424
2429
2425 * IPython/iplib.py (InteractiveShell.interact): Added optional
2430 * IPython/iplib.py (InteractiveShell.interact): Added optional
2426 auto-indenting code, after a patch by King C. Shu
2431 auto-indenting code, after a patch by King C. Shu
2427 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2432 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2428 get along well with pasting indented code. If I ever figure out
2433 get along well with pasting indented code. If I ever figure out
2429 how to make that part go well, it will become on by default.
2434 how to make that part go well, it will become on by default.
2430
2435
2431 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2436 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2432 crash ipython if there was an unmatched '%' in the user's prompt
2437 crash ipython if there was an unmatched '%' in the user's prompt
2433 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2438 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2434
2439
2435 * IPython/iplib.py (InteractiveShell.interact): removed the
2440 * IPython/iplib.py (InteractiveShell.interact): removed the
2436 ability to ask the user whether he wants to crash or not at the
2441 ability to ask the user whether he wants to crash or not at the
2437 'last line' exception handler. Calling functions at that point
2442 'last line' exception handler. Calling functions at that point
2438 changes the stack, and the error reports would have incorrect
2443 changes the stack, and the error reports would have incorrect
2439 tracebacks.
2444 tracebacks.
2440
2445
2441 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2446 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2442 pass through a peger a pretty-printed form of any object. After a
2447 pass through a peger a pretty-printed form of any object. After a
2443 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2448 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2444
2449
2445 2003-04-14 Fernando Perez <fperez@colorado.edu>
2450 2003-04-14 Fernando Perez <fperez@colorado.edu>
2446
2451
2447 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2452 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2448 all files in ~ would be modified at first install (instead of
2453 all files in ~ would be modified at first install (instead of
2449 ~/.ipython). This could be potentially disastrous, as the
2454 ~/.ipython). This could be potentially disastrous, as the
2450 modification (make line-endings native) could damage binary files.
2455 modification (make line-endings native) could damage binary files.
2451
2456
2452 2003-04-10 Fernando Perez <fperez@colorado.edu>
2457 2003-04-10 Fernando Perez <fperez@colorado.edu>
2453
2458
2454 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2459 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2455 handle only lines which are invalid python. This now means that
2460 handle only lines which are invalid python. This now means that
2456 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2461 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2457 for the bug report.
2462 for the bug report.
2458
2463
2459 2003-04-01 Fernando Perez <fperez@colorado.edu>
2464 2003-04-01 Fernando Perez <fperez@colorado.edu>
2460
2465
2461 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2466 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2462 where failing to set sys.last_traceback would crash pdb.pm().
2467 where failing to set sys.last_traceback would crash pdb.pm().
2463 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2468 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2464 report.
2469 report.
2465
2470
2466 2003-03-25 Fernando Perez <fperez@colorado.edu>
2471 2003-03-25 Fernando Perez <fperez@colorado.edu>
2467
2472
2468 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2473 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2469 before printing it (it had a lot of spurious blank lines at the
2474 before printing it (it had a lot of spurious blank lines at the
2470 end).
2475 end).
2471
2476
2472 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2477 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2473 output would be sent 21 times! Obviously people don't use this
2478 output would be sent 21 times! Obviously people don't use this
2474 too often, or I would have heard about it.
2479 too often, or I would have heard about it.
2475
2480
2476 2003-03-24 Fernando Perez <fperez@colorado.edu>
2481 2003-03-24 Fernando Perez <fperez@colorado.edu>
2477
2482
2478 * setup.py (scriptfiles): renamed the data_files parameter from
2483 * setup.py (scriptfiles): renamed the data_files parameter from
2479 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2484 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2480 for the patch.
2485 for the patch.
2481
2486
2482 2003-03-20 Fernando Perez <fperez@colorado.edu>
2487 2003-03-20 Fernando Perez <fperez@colorado.edu>
2483
2488
2484 * IPython/genutils.py (error): added error() and fatal()
2489 * IPython/genutils.py (error): added error() and fatal()
2485 functions.
2490 functions.
2486
2491
2487 2003-03-18 *** Released version 0.2.15pre3
2492 2003-03-18 *** Released version 0.2.15pre3
2488
2493
2489 2003-03-18 Fernando Perez <fperez@colorado.edu>
2494 2003-03-18 Fernando Perez <fperez@colorado.edu>
2490
2495
2491 * setupext/install_data_ext.py
2496 * setupext/install_data_ext.py
2492 (install_data_ext.initialize_options): Class contributed by Jack
2497 (install_data_ext.initialize_options): Class contributed by Jack
2493 Moffit for fixing the old distutils hack. He is sending this to
2498 Moffit for fixing the old distutils hack. He is sending this to
2494 the distutils folks so in the future we may not need it as a
2499 the distutils folks so in the future we may not need it as a
2495 private fix.
2500 private fix.
2496
2501
2497 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2502 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2498 changes for Debian packaging. See his patch for full details.
2503 changes for Debian packaging. See his patch for full details.
2499 The old distutils hack of making the ipythonrc* files carry a
2504 The old distutils hack of making the ipythonrc* files carry a
2500 bogus .py extension is gone, at last. Examples were moved to a
2505 bogus .py extension is gone, at last. Examples were moved to a
2501 separate subdir under doc/, and the separate executable scripts
2506 separate subdir under doc/, and the separate executable scripts
2502 now live in their own directory. Overall a great cleanup. The
2507 now live in their own directory. Overall a great cleanup. The
2503 manual was updated to use the new files, and setup.py has been
2508 manual was updated to use the new files, and setup.py has been
2504 fixed for this setup.
2509 fixed for this setup.
2505
2510
2506 * IPython/PyColorize.py (Parser.usage): made non-executable and
2511 * IPython/PyColorize.py (Parser.usage): made non-executable and
2507 created a pycolor wrapper around it to be included as a script.
2512 created a pycolor wrapper around it to be included as a script.
2508
2513
2509 2003-03-12 *** Released version 0.2.15pre2
2514 2003-03-12 *** Released version 0.2.15pre2
2510
2515
2511 2003-03-12 Fernando Perez <fperez@colorado.edu>
2516 2003-03-12 Fernando Perez <fperez@colorado.edu>
2512
2517
2513 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2518 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2514 long-standing problem with garbage characters in some terminals.
2519 long-standing problem with garbage characters in some terminals.
2515 The issue was really that the \001 and \002 escapes must _only_ be
2520 The issue was really that the \001 and \002 escapes must _only_ be
2516 passed to input prompts (which call readline), but _never_ to
2521 passed to input prompts (which call readline), but _never_ to
2517 normal text to be printed on screen. I changed ColorANSI to have
2522 normal text to be printed on screen. I changed ColorANSI to have
2518 two classes: TermColors and InputTermColors, each with the
2523 two classes: TermColors and InputTermColors, each with the
2519 appropriate escapes for input prompts or normal text. The code in
2524 appropriate escapes for input prompts or normal text. The code in
2520 Prompts.py got slightly more complicated, but this very old and
2525 Prompts.py got slightly more complicated, but this very old and
2521 annoying bug is finally fixed.
2526 annoying bug is finally fixed.
2522
2527
2523 All the credit for nailing down the real origin of this problem
2528 All the credit for nailing down the real origin of this problem
2524 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2529 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2525 *Many* thanks to him for spending quite a bit of effort on this.
2530 *Many* thanks to him for spending quite a bit of effort on this.
2526
2531
2527 2003-03-05 *** Released version 0.2.15pre1
2532 2003-03-05 *** Released version 0.2.15pre1
2528
2533
2529 2003-03-03 Fernando Perez <fperez@colorado.edu>
2534 2003-03-03 Fernando Perez <fperez@colorado.edu>
2530
2535
2531 * IPython/FakeModule.py: Moved the former _FakeModule to a
2536 * IPython/FakeModule.py: Moved the former _FakeModule to a
2532 separate file, because it's also needed by Magic (to fix a similar
2537 separate file, because it's also needed by Magic (to fix a similar
2533 pickle-related issue in @run).
2538 pickle-related issue in @run).
2534
2539
2535 2003-03-02 Fernando Perez <fperez@colorado.edu>
2540 2003-03-02 Fernando Perez <fperez@colorado.edu>
2536
2541
2537 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2542 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2538 the autocall option at runtime.
2543 the autocall option at runtime.
2539 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2544 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2540 across Magic.py to start separating Magic from InteractiveShell.
2545 across Magic.py to start separating Magic from InteractiveShell.
2541 (Magic._ofind): Fixed to return proper namespace for dotted
2546 (Magic._ofind): Fixed to return proper namespace for dotted
2542 names. Before, a dotted name would always return 'not currently
2547 names. Before, a dotted name would always return 'not currently
2543 defined', because it would find the 'parent'. s.x would be found,
2548 defined', because it would find the 'parent'. s.x would be found,
2544 but since 'x' isn't defined by itself, it would get confused.
2549 but since 'x' isn't defined by itself, it would get confused.
2545 (Magic.magic_run): Fixed pickling problems reported by Ralf
2550 (Magic.magic_run): Fixed pickling problems reported by Ralf
2546 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2551 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2547 that I'd used when Mike Heeter reported similar issues at the
2552 that I'd used when Mike Heeter reported similar issues at the
2548 top-level, but now for @run. It boils down to injecting the
2553 top-level, but now for @run. It boils down to injecting the
2549 namespace where code is being executed with something that looks
2554 namespace where code is being executed with something that looks
2550 enough like a module to fool pickle.dump(). Since a pickle stores
2555 enough like a module to fool pickle.dump(). Since a pickle stores
2551 a named reference to the importing module, we need this for
2556 a named reference to the importing module, we need this for
2552 pickles to save something sensible.
2557 pickles to save something sensible.
2553
2558
2554 * IPython/ipmaker.py (make_IPython): added an autocall option.
2559 * IPython/ipmaker.py (make_IPython): added an autocall option.
2555
2560
2556 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2561 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2557 the auto-eval code. Now autocalling is an option, and the code is
2562 the auto-eval code. Now autocalling is an option, and the code is
2558 also vastly safer. There is no more eval() involved at all.
2563 also vastly safer. There is no more eval() involved at all.
2559
2564
2560 2003-03-01 Fernando Perez <fperez@colorado.edu>
2565 2003-03-01 Fernando Perez <fperez@colorado.edu>
2561
2566
2562 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2567 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2563 dict with named keys instead of a tuple.
2568 dict with named keys instead of a tuple.
2564
2569
2565 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2570 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2566
2571
2567 * setup.py (make_shortcut): Fixed message about directories
2572 * setup.py (make_shortcut): Fixed message about directories
2568 created during Windows installation (the directories were ok, just
2573 created during Windows installation (the directories were ok, just
2569 the printed message was misleading). Thanks to Chris Liechti
2574 the printed message was misleading). Thanks to Chris Liechti
2570 <cliechti-AT-gmx.net> for the heads up.
2575 <cliechti-AT-gmx.net> for the heads up.
2571
2576
2572 2003-02-21 Fernando Perez <fperez@colorado.edu>
2577 2003-02-21 Fernando Perez <fperez@colorado.edu>
2573
2578
2574 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2579 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2575 of ValueError exception when checking for auto-execution. This
2580 of ValueError exception when checking for auto-execution. This
2576 one is raised by things like Numeric arrays arr.flat when the
2581 one is raised by things like Numeric arrays arr.flat when the
2577 array is non-contiguous.
2582 array is non-contiguous.
2578
2583
2579 2003-01-31 Fernando Perez <fperez@colorado.edu>
2584 2003-01-31 Fernando Perez <fperez@colorado.edu>
2580
2585
2581 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2586 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2582 not return any value at all (even though the command would get
2587 not return any value at all (even though the command would get
2583 executed).
2588 executed).
2584 (xsys): Flush stdout right after printing the command to ensure
2589 (xsys): Flush stdout right after printing the command to ensure
2585 proper ordering of commands and command output in the total
2590 proper ordering of commands and command output in the total
2586 output.
2591 output.
2587 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2592 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2588 system/getoutput as defaults. The old ones are kept for
2593 system/getoutput as defaults. The old ones are kept for
2589 compatibility reasons, so no code which uses this library needs
2594 compatibility reasons, so no code which uses this library needs
2590 changing.
2595 changing.
2591
2596
2592 2003-01-27 *** Released version 0.2.14
2597 2003-01-27 *** Released version 0.2.14
2593
2598
2594 2003-01-25 Fernando Perez <fperez@colorado.edu>
2599 2003-01-25 Fernando Perez <fperez@colorado.edu>
2595
2600
2596 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2601 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2597 functions defined in previous edit sessions could not be re-edited
2602 functions defined in previous edit sessions could not be re-edited
2598 (because the temp files were immediately removed). Now temp files
2603 (because the temp files were immediately removed). Now temp files
2599 are removed only at IPython's exit.
2604 are removed only at IPython's exit.
2600 (Magic.magic_run): Improved @run to perform shell-like expansions
2605 (Magic.magic_run): Improved @run to perform shell-like expansions
2601 on its arguments (~users and $VARS). With this, @run becomes more
2606 on its arguments (~users and $VARS). With this, @run becomes more
2602 like a normal command-line.
2607 like a normal command-line.
2603
2608
2604 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2609 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2605 bugs related to embedding and cleaned up that code. A fairly
2610 bugs related to embedding and cleaned up that code. A fairly
2606 important one was the impossibility to access the global namespace
2611 important one was the impossibility to access the global namespace
2607 through the embedded IPython (only local variables were visible).
2612 through the embedded IPython (only local variables were visible).
2608
2613
2609 2003-01-14 Fernando Perez <fperez@colorado.edu>
2614 2003-01-14 Fernando Perez <fperez@colorado.edu>
2610
2615
2611 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2616 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2612 auto-calling to be a bit more conservative. Now it doesn't get
2617 auto-calling to be a bit more conservative. Now it doesn't get
2613 triggered if any of '!=()<>' are in the rest of the input line, to
2618 triggered if any of '!=()<>' are in the rest of the input line, to
2614 allow comparing callables. Thanks to Alex for the heads up.
2619 allow comparing callables. Thanks to Alex for the heads up.
2615
2620
2616 2003-01-07 Fernando Perez <fperez@colorado.edu>
2621 2003-01-07 Fernando Perez <fperez@colorado.edu>
2617
2622
2618 * IPython/genutils.py (page): fixed estimation of the number of
2623 * IPython/genutils.py (page): fixed estimation of the number of
2619 lines in a string to be paged to simply count newlines. This
2624 lines in a string to be paged to simply count newlines. This
2620 prevents over-guessing due to embedded escape sequences. A better
2625 prevents over-guessing due to embedded escape sequences. A better
2621 long-term solution would involve stripping out the control chars
2626 long-term solution would involve stripping out the control chars
2622 for the count, but it's potentially so expensive I just don't
2627 for the count, but it's potentially so expensive I just don't
2623 think it's worth doing.
2628 think it's worth doing.
2624
2629
2625 2002-12-19 *** Released version 0.2.14pre50
2630 2002-12-19 *** Released version 0.2.14pre50
2626
2631
2627 2002-12-19 Fernando Perez <fperez@colorado.edu>
2632 2002-12-19 Fernando Perez <fperez@colorado.edu>
2628
2633
2629 * tools/release (version): Changed release scripts to inform
2634 * tools/release (version): Changed release scripts to inform
2630 Andrea and build a NEWS file with a list of recent changes.
2635 Andrea and build a NEWS file with a list of recent changes.
2631
2636
2632 * IPython/ColorANSI.py (__all__): changed terminal detection
2637 * IPython/ColorANSI.py (__all__): changed terminal detection
2633 code. Seems to work better for xterms without breaking
2638 code. Seems to work better for xterms without breaking
2634 konsole. Will need more testing to determine if WinXP and Mac OSX
2639 konsole. Will need more testing to determine if WinXP and Mac OSX
2635 also work ok.
2640 also work ok.
2636
2641
2637 2002-12-18 *** Released version 0.2.14pre49
2642 2002-12-18 *** Released version 0.2.14pre49
2638
2643
2639 2002-12-18 Fernando Perez <fperez@colorado.edu>
2644 2002-12-18 Fernando Perez <fperez@colorado.edu>
2640
2645
2641 * Docs: added new info about Mac OSX, from Andrea.
2646 * Docs: added new info about Mac OSX, from Andrea.
2642
2647
2643 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2648 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2644 allow direct plotting of python strings whose format is the same
2649 allow direct plotting of python strings whose format is the same
2645 of gnuplot data files.
2650 of gnuplot data files.
2646
2651
2647 2002-12-16 Fernando Perez <fperez@colorado.edu>
2652 2002-12-16 Fernando Perez <fperez@colorado.edu>
2648
2653
2649 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2654 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2650 value of exit question to be acknowledged.
2655 value of exit question to be acknowledged.
2651
2656
2652 2002-12-03 Fernando Perez <fperez@colorado.edu>
2657 2002-12-03 Fernando Perez <fperez@colorado.edu>
2653
2658
2654 * IPython/ipmaker.py: removed generators, which had been added
2659 * IPython/ipmaker.py: removed generators, which had been added
2655 by mistake in an earlier debugging run. This was causing trouble
2660 by mistake in an earlier debugging run. This was causing trouble
2656 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2661 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2657 for pointing this out.
2662 for pointing this out.
2658
2663
2659 2002-11-17 Fernando Perez <fperez@colorado.edu>
2664 2002-11-17 Fernando Perez <fperez@colorado.edu>
2660
2665
2661 * Manual: updated the Gnuplot section.
2666 * Manual: updated the Gnuplot section.
2662
2667
2663 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2668 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2664 a much better split of what goes in Runtime and what goes in
2669 a much better split of what goes in Runtime and what goes in
2665 Interactive.
2670 Interactive.
2666
2671
2667 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2672 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2668 being imported from iplib.
2673 being imported from iplib.
2669
2674
2670 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2675 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2671 for command-passing. Now the global Gnuplot instance is called
2676 for command-passing. Now the global Gnuplot instance is called
2672 'gp' instead of 'g', which was really a far too fragile and
2677 'gp' instead of 'g', which was really a far too fragile and
2673 common name.
2678 common name.
2674
2679
2675 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2680 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2676 bounding boxes generated by Gnuplot for square plots.
2681 bounding boxes generated by Gnuplot for square plots.
2677
2682
2678 * IPython/genutils.py (popkey): new function added. I should
2683 * IPython/genutils.py (popkey): new function added. I should
2679 suggest this on c.l.py as a dict method, it seems useful.
2684 suggest this on c.l.py as a dict method, it seems useful.
2680
2685
2681 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2686 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2682 to transparently handle PostScript generation. MUCH better than
2687 to transparently handle PostScript generation. MUCH better than
2683 the previous plot_eps/replot_eps (which I removed now). The code
2688 the previous plot_eps/replot_eps (which I removed now). The code
2684 is also fairly clean and well documented now (including
2689 is also fairly clean and well documented now (including
2685 docstrings).
2690 docstrings).
2686
2691
2687 2002-11-13 Fernando Perez <fperez@colorado.edu>
2692 2002-11-13 Fernando Perez <fperez@colorado.edu>
2688
2693
2689 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2694 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2690 (inconsistent with options).
2695 (inconsistent with options).
2691
2696
2692 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2697 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2693 manually disabled, I don't know why. Fixed it.
2698 manually disabled, I don't know why. Fixed it.
2694 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2699 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2695 eps output.
2700 eps output.
2696
2701
2697 2002-11-12 Fernando Perez <fperez@colorado.edu>
2702 2002-11-12 Fernando Perez <fperez@colorado.edu>
2698
2703
2699 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2704 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2700 don't propagate up to caller. Fixes crash reported by François
2705 don't propagate up to caller. Fixes crash reported by François
2701 Pinard.
2706 Pinard.
2702
2707
2703 2002-11-09 Fernando Perez <fperez@colorado.edu>
2708 2002-11-09 Fernando Perez <fperez@colorado.edu>
2704
2709
2705 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2710 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2706 history file for new users.
2711 history file for new users.
2707 (make_IPython): fixed bug where initial install would leave the
2712 (make_IPython): fixed bug where initial install would leave the
2708 user running in the .ipython dir.
2713 user running in the .ipython dir.
2709 (make_IPython): fixed bug where config dir .ipython would be
2714 (make_IPython): fixed bug where config dir .ipython would be
2710 created regardless of the given -ipythondir option. Thanks to Cory
2715 created regardless of the given -ipythondir option. Thanks to Cory
2711 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2716 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2712
2717
2713 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2718 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2714 type confirmations. Will need to use it in all of IPython's code
2719 type confirmations. Will need to use it in all of IPython's code
2715 consistently.
2720 consistently.
2716
2721
2717 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2722 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2718 context to print 31 lines instead of the default 5. This will make
2723 context to print 31 lines instead of the default 5. This will make
2719 the crash reports extremely detailed in case the problem is in
2724 the crash reports extremely detailed in case the problem is in
2720 libraries I don't have access to.
2725 libraries I don't have access to.
2721
2726
2722 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2727 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2723 line of defense' code to still crash, but giving users fair
2728 line of defense' code to still crash, but giving users fair
2724 warning. I don't want internal errors to go unreported: if there's
2729 warning. I don't want internal errors to go unreported: if there's
2725 an internal problem, IPython should crash and generate a full
2730 an internal problem, IPython should crash and generate a full
2726 report.
2731 report.
2727
2732
2728 2002-11-08 Fernando Perez <fperez@colorado.edu>
2733 2002-11-08 Fernando Perez <fperez@colorado.edu>
2729
2734
2730 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2735 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2731 otherwise uncaught exceptions which can appear if people set
2736 otherwise uncaught exceptions which can appear if people set
2732 sys.stdout to something badly broken. Thanks to a crash report
2737 sys.stdout to something badly broken. Thanks to a crash report
2733 from henni-AT-mail.brainbot.com.
2738 from henni-AT-mail.brainbot.com.
2734
2739
2735 2002-11-04 Fernando Perez <fperez@colorado.edu>
2740 2002-11-04 Fernando Perez <fperez@colorado.edu>
2736
2741
2737 * IPython/iplib.py (InteractiveShell.interact): added
2742 * IPython/iplib.py (InteractiveShell.interact): added
2738 __IPYTHON__active to the builtins. It's a flag which goes on when
2743 __IPYTHON__active to the builtins. It's a flag which goes on when
2739 the interaction starts and goes off again when it stops. This
2744 the interaction starts and goes off again when it stops. This
2740 allows embedding code to detect being inside IPython. Before this
2745 allows embedding code to detect being inside IPython. Before this
2741 was done via __IPYTHON__, but that only shows that an IPython
2746 was done via __IPYTHON__, but that only shows that an IPython
2742 instance has been created.
2747 instance has been created.
2743
2748
2744 * IPython/Magic.py (Magic.magic_env): I realized that in a
2749 * IPython/Magic.py (Magic.magic_env): I realized that in a
2745 UserDict, instance.data holds the data as a normal dict. So I
2750 UserDict, instance.data holds the data as a normal dict. So I
2746 modified @env to return os.environ.data instead of rebuilding a
2751 modified @env to return os.environ.data instead of rebuilding a
2747 dict by hand.
2752 dict by hand.
2748
2753
2749 2002-11-02 Fernando Perez <fperez@colorado.edu>
2754 2002-11-02 Fernando Perez <fperez@colorado.edu>
2750
2755
2751 * IPython/genutils.py (warn): changed so that level 1 prints no
2756 * IPython/genutils.py (warn): changed so that level 1 prints no
2752 header. Level 2 is now the default (with 'WARNING' header, as
2757 header. Level 2 is now the default (with 'WARNING' header, as
2753 before). I think I tracked all places where changes were needed in
2758 before). I think I tracked all places where changes were needed in
2754 IPython, but outside code using the old level numbering may have
2759 IPython, but outside code using the old level numbering may have
2755 broken.
2760 broken.
2756
2761
2757 * IPython/iplib.py (InteractiveShell.runcode): added this to
2762 * IPython/iplib.py (InteractiveShell.runcode): added this to
2758 handle the tracebacks in SystemExit traps correctly. The previous
2763 handle the tracebacks in SystemExit traps correctly. The previous
2759 code (through interact) was printing more of the stack than
2764 code (through interact) was printing more of the stack than
2760 necessary, showing IPython internal code to the user.
2765 necessary, showing IPython internal code to the user.
2761
2766
2762 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2767 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2763 default. Now that the default at the confirmation prompt is yes,
2768 default. Now that the default at the confirmation prompt is yes,
2764 it's not so intrusive. François' argument that ipython sessions
2769 it's not so intrusive. François' argument that ipython sessions
2765 tend to be complex enough not to lose them from an accidental C-d,
2770 tend to be complex enough not to lose them from an accidental C-d,
2766 is a valid one.
2771 is a valid one.
2767
2772
2768 * IPython/iplib.py (InteractiveShell.interact): added a
2773 * IPython/iplib.py (InteractiveShell.interact): added a
2769 showtraceback() call to the SystemExit trap, and modified the exit
2774 showtraceback() call to the SystemExit trap, and modified the exit
2770 confirmation to have yes as the default.
2775 confirmation to have yes as the default.
2771
2776
2772 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2777 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2773 this file. It's been gone from the code for a long time, this was
2778 this file. It's been gone from the code for a long time, this was
2774 simply leftover junk.
2779 simply leftover junk.
2775
2780
2776 2002-11-01 Fernando Perez <fperez@colorado.edu>
2781 2002-11-01 Fernando Perez <fperez@colorado.edu>
2777
2782
2778 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2783 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2779 added. If set, IPython now traps EOF and asks for
2784 added. If set, IPython now traps EOF and asks for
2780 confirmation. After a request by François Pinard.
2785 confirmation. After a request by François Pinard.
2781
2786
2782 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2787 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2783 of @abort, and with a new (better) mechanism for handling the
2788 of @abort, and with a new (better) mechanism for handling the
2784 exceptions.
2789 exceptions.
2785
2790
2786 2002-10-27 Fernando Perez <fperez@colorado.edu>
2791 2002-10-27 Fernando Perez <fperez@colorado.edu>
2787
2792
2788 * IPython/usage.py (__doc__): updated the --help information and
2793 * IPython/usage.py (__doc__): updated the --help information and
2789 the ipythonrc file to indicate that -log generates
2794 the ipythonrc file to indicate that -log generates
2790 ./ipython.log. Also fixed the corresponding info in @logstart.
2795 ./ipython.log. Also fixed the corresponding info in @logstart.
2791 This and several other fixes in the manuals thanks to reports by
2796 This and several other fixes in the manuals thanks to reports by
2792 François Pinard <pinard-AT-iro.umontreal.ca>.
2797 François Pinard <pinard-AT-iro.umontreal.ca>.
2793
2798
2794 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2799 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2795 refer to @logstart (instead of @log, which doesn't exist).
2800 refer to @logstart (instead of @log, which doesn't exist).
2796
2801
2797 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2802 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2798 AttributeError crash. Thanks to Christopher Armstrong
2803 AttributeError crash. Thanks to Christopher Armstrong
2799 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2804 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2800 introduced recently (in 0.2.14pre37) with the fix to the eval
2805 introduced recently (in 0.2.14pre37) with the fix to the eval
2801 problem mentioned below.
2806 problem mentioned below.
2802
2807
2803 2002-10-17 Fernando Perez <fperez@colorado.edu>
2808 2002-10-17 Fernando Perez <fperez@colorado.edu>
2804
2809
2805 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2810 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2806 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2811 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2807
2812
2808 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2813 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2809 this function to fix a problem reported by Alex Schmolck. He saw
2814 this function to fix a problem reported by Alex Schmolck. He saw
2810 it with list comprehensions and generators, which were getting
2815 it with list comprehensions and generators, which were getting
2811 called twice. The real problem was an 'eval' call in testing for
2816 called twice. The real problem was an 'eval' call in testing for
2812 automagic which was evaluating the input line silently.
2817 automagic which was evaluating the input line silently.
2813
2818
2814 This is a potentially very nasty bug, if the input has side
2819 This is a potentially very nasty bug, if the input has side
2815 effects which must not be repeated. The code is much cleaner now,
2820 effects which must not be repeated. The code is much cleaner now,
2816 without any blanket 'except' left and with a regexp test for
2821 without any blanket 'except' left and with a regexp test for
2817 actual function names.
2822 actual function names.
2818
2823
2819 But an eval remains, which I'm not fully comfortable with. I just
2824 But an eval remains, which I'm not fully comfortable with. I just
2820 don't know how to find out if an expression could be a callable in
2825 don't know how to find out if an expression could be a callable in
2821 the user's namespace without doing an eval on the string. However
2826 the user's namespace without doing an eval on the string. However
2822 that string is now much more strictly checked so that no code
2827 that string is now much more strictly checked so that no code
2823 slips by, so the eval should only happen for things that can
2828 slips by, so the eval should only happen for things that can
2824 really be only function/method names.
2829 really be only function/method names.
2825
2830
2826 2002-10-15 Fernando Perez <fperez@colorado.edu>
2831 2002-10-15 Fernando Perez <fperez@colorado.edu>
2827
2832
2828 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2833 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2829 OSX information to main manual, removed README_Mac_OSX file from
2834 OSX information to main manual, removed README_Mac_OSX file from
2830 distribution. Also updated credits for recent additions.
2835 distribution. Also updated credits for recent additions.
2831
2836
2832 2002-10-10 Fernando Perez <fperez@colorado.edu>
2837 2002-10-10 Fernando Perez <fperez@colorado.edu>
2833
2838
2834 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2839 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2835 terminal-related issues. Many thanks to Andrea Riciputi
2840 terminal-related issues. Many thanks to Andrea Riciputi
2836 <andrea.riciputi-AT-libero.it> for writing it.
2841 <andrea.riciputi-AT-libero.it> for writing it.
2837
2842
2838 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2843 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2839 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2844 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2840
2845
2841 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2846 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2842 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2847 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2843 <syver-en-AT-online.no> who both submitted patches for this problem.
2848 <syver-en-AT-online.no> who both submitted patches for this problem.
2844
2849
2845 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2850 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2846 global embedding to make sure that things don't overwrite user
2851 global embedding to make sure that things don't overwrite user
2847 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2852 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2848
2853
2849 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2854 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2850 compatibility. Thanks to Hayden Callow
2855 compatibility. Thanks to Hayden Callow
2851 <h.callow-AT-elec.canterbury.ac.nz>
2856 <h.callow-AT-elec.canterbury.ac.nz>
2852
2857
2853 2002-10-04 Fernando Perez <fperez@colorado.edu>
2858 2002-10-04 Fernando Perez <fperez@colorado.edu>
2854
2859
2855 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2860 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2856 Gnuplot.File objects.
2861 Gnuplot.File objects.
2857
2862
2858 2002-07-23 Fernando Perez <fperez@colorado.edu>
2863 2002-07-23 Fernando Perez <fperez@colorado.edu>
2859
2864
2860 * IPython/genutils.py (timing): Added timings() and timing() for
2865 * IPython/genutils.py (timing): Added timings() and timing() for
2861 quick access to the most commonly needed data, the execution
2866 quick access to the most commonly needed data, the execution
2862 times. Old timing() renamed to timings_out().
2867 times. Old timing() renamed to timings_out().
2863
2868
2864 2002-07-18 Fernando Perez <fperez@colorado.edu>
2869 2002-07-18 Fernando Perez <fperez@colorado.edu>
2865
2870
2866 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2871 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2867 bug with nested instances disrupting the parent's tab completion.
2872 bug with nested instances disrupting the parent's tab completion.
2868
2873
2869 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2874 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2870 all_completions code to begin the emacs integration.
2875 all_completions code to begin the emacs integration.
2871
2876
2872 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2877 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2873 argument to allow titling individual arrays when plotting.
2878 argument to allow titling individual arrays when plotting.
2874
2879
2875 2002-07-15 Fernando Perez <fperez@colorado.edu>
2880 2002-07-15 Fernando Perez <fperez@colorado.edu>
2876
2881
2877 * setup.py (make_shortcut): changed to retrieve the value of
2882 * setup.py (make_shortcut): changed to retrieve the value of
2878 'Program Files' directory from the registry (this value changes in
2883 'Program Files' directory from the registry (this value changes in
2879 non-english versions of Windows). Thanks to Thomas Fanslau
2884 non-english versions of Windows). Thanks to Thomas Fanslau
2880 <tfanslau-AT-gmx.de> for the report.
2885 <tfanslau-AT-gmx.de> for the report.
2881
2886
2882 2002-07-10 Fernando Perez <fperez@colorado.edu>
2887 2002-07-10 Fernando Perez <fperez@colorado.edu>
2883
2888
2884 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2889 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2885 a bug in pdb, which crashes if a line with only whitespace is
2890 a bug in pdb, which crashes if a line with only whitespace is
2886 entered. Bug report submitted to sourceforge.
2891 entered. Bug report submitted to sourceforge.
2887
2892
2888 2002-07-09 Fernando Perez <fperez@colorado.edu>
2893 2002-07-09 Fernando Perez <fperez@colorado.edu>
2889
2894
2890 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2895 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2891 reporting exceptions (it's a bug in inspect.py, I just set a
2896 reporting exceptions (it's a bug in inspect.py, I just set a
2892 workaround).
2897 workaround).
2893
2898
2894 2002-07-08 Fernando Perez <fperez@colorado.edu>
2899 2002-07-08 Fernando Perez <fperez@colorado.edu>
2895
2900
2896 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2901 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2897 __IPYTHON__ in __builtins__ to show up in user_ns.
2902 __IPYTHON__ in __builtins__ to show up in user_ns.
2898
2903
2899 2002-07-03 Fernando Perez <fperez@colorado.edu>
2904 2002-07-03 Fernando Perez <fperez@colorado.edu>
2900
2905
2901 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2906 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2902 name from @gp_set_instance to @gp_set_default.
2907 name from @gp_set_instance to @gp_set_default.
2903
2908
2904 * IPython/ipmaker.py (make_IPython): default editor value set to
2909 * IPython/ipmaker.py (make_IPython): default editor value set to
2905 '0' (a string), to match the rc file. Otherwise will crash when
2910 '0' (a string), to match the rc file. Otherwise will crash when
2906 .strip() is called on it.
2911 .strip() is called on it.
2907
2912
2908
2913
2909 2002-06-28 Fernando Perez <fperez@colorado.edu>
2914 2002-06-28 Fernando Perez <fperez@colorado.edu>
2910
2915
2911 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2916 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2912 of files in current directory when a file is executed via
2917 of files in current directory when a file is executed via
2913 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2918 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2914
2919
2915 * setup.py (manfiles): fix for rpm builds, submitted by RA
2920 * setup.py (manfiles): fix for rpm builds, submitted by RA
2916 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2921 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2917
2922
2918 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2923 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2919 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2924 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2920 string!). A. Schmolck caught this one.
2925 string!). A. Schmolck caught this one.
2921
2926
2922 2002-06-27 Fernando Perez <fperez@colorado.edu>
2927 2002-06-27 Fernando Perez <fperez@colorado.edu>
2923
2928
2924 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2929 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2925 defined files at the cmd line. __name__ wasn't being set to
2930 defined files at the cmd line. __name__ wasn't being set to
2926 __main__.
2931 __main__.
2927
2932
2928 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2933 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2929 regular lists and tuples besides Numeric arrays.
2934 regular lists and tuples besides Numeric arrays.
2930
2935
2931 * IPython/Prompts.py (CachedOutput.__call__): Added output
2936 * IPython/Prompts.py (CachedOutput.__call__): Added output
2932 supression for input ending with ';'. Similar to Mathematica and
2937 supression for input ending with ';'. Similar to Mathematica and
2933 Matlab. The _* vars and Out[] list are still updated, just like
2938 Matlab. The _* vars and Out[] list are still updated, just like
2934 Mathematica behaves.
2939 Mathematica behaves.
2935
2940
2936 2002-06-25 Fernando Perez <fperez@colorado.edu>
2941 2002-06-25 Fernando Perez <fperez@colorado.edu>
2937
2942
2938 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2943 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2939 .ini extensions for profiels under Windows.
2944 .ini extensions for profiels under Windows.
2940
2945
2941 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2946 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2942 string form. Fix contributed by Alexander Schmolck
2947 string form. Fix contributed by Alexander Schmolck
2943 <a.schmolck-AT-gmx.net>
2948 <a.schmolck-AT-gmx.net>
2944
2949
2945 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2950 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2946 pre-configured Gnuplot instance.
2951 pre-configured Gnuplot instance.
2947
2952
2948 2002-06-21 Fernando Perez <fperez@colorado.edu>
2953 2002-06-21 Fernando Perez <fperez@colorado.edu>
2949
2954
2950 * IPython/numutils.py (exp_safe): new function, works around the
2955 * IPython/numutils.py (exp_safe): new function, works around the
2951 underflow problems in Numeric.
2956 underflow problems in Numeric.
2952 (log2): New fn. Safe log in base 2: returns exact integer answer
2957 (log2): New fn. Safe log in base 2: returns exact integer answer
2953 for exact integer powers of 2.
2958 for exact integer powers of 2.
2954
2959
2955 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2960 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2956 properly.
2961 properly.
2957
2962
2958 2002-06-20 Fernando Perez <fperez@colorado.edu>
2963 2002-06-20 Fernando Perez <fperez@colorado.edu>
2959
2964
2960 * IPython/genutils.py (timing): new function like
2965 * IPython/genutils.py (timing): new function like
2961 Mathematica's. Similar to time_test, but returns more info.
2966 Mathematica's. Similar to time_test, but returns more info.
2962
2967
2963 2002-06-18 Fernando Perez <fperez@colorado.edu>
2968 2002-06-18 Fernando Perez <fperez@colorado.edu>
2964
2969
2965 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2970 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2966 according to Mike Heeter's suggestions.
2971 according to Mike Heeter's suggestions.
2967
2972
2968 2002-06-16 Fernando Perez <fperez@colorado.edu>
2973 2002-06-16 Fernando Perez <fperez@colorado.edu>
2969
2974
2970 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2975 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2971 system. GnuplotMagic is gone as a user-directory option. New files
2976 system. GnuplotMagic is gone as a user-directory option. New files
2972 make it easier to use all the gnuplot stuff both from external
2977 make it easier to use all the gnuplot stuff both from external
2973 programs as well as from IPython. Had to rewrite part of
2978 programs as well as from IPython. Had to rewrite part of
2974 hardcopy() b/c of a strange bug: often the ps files simply don't
2979 hardcopy() b/c of a strange bug: often the ps files simply don't
2975 get created, and require a repeat of the command (often several
2980 get created, and require a repeat of the command (often several
2976 times).
2981 times).
2977
2982
2978 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2983 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2979 resolve output channel at call time, so that if sys.stderr has
2984 resolve output channel at call time, so that if sys.stderr has
2980 been redirected by user this gets honored.
2985 been redirected by user this gets honored.
2981
2986
2982 2002-06-13 Fernando Perez <fperez@colorado.edu>
2987 2002-06-13 Fernando Perez <fperez@colorado.edu>
2983
2988
2984 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2989 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2985 IPShell. Kept a copy with the old names to avoid breaking people's
2990 IPShell. Kept a copy with the old names to avoid breaking people's
2986 embedded code.
2991 embedded code.
2987
2992
2988 * IPython/ipython: simplified it to the bare minimum after
2993 * IPython/ipython: simplified it to the bare minimum after
2989 Holger's suggestions. Added info about how to use it in
2994 Holger's suggestions. Added info about how to use it in
2990 PYTHONSTARTUP.
2995 PYTHONSTARTUP.
2991
2996
2992 * IPython/Shell.py (IPythonShell): changed the options passing
2997 * IPython/Shell.py (IPythonShell): changed the options passing
2993 from a string with funky %s replacements to a straight list. Maybe
2998 from a string with funky %s replacements to a straight list. Maybe
2994 a bit more typing, but it follows sys.argv conventions, so there's
2999 a bit more typing, but it follows sys.argv conventions, so there's
2995 less special-casing to remember.
3000 less special-casing to remember.
2996
3001
2997 2002-06-12 Fernando Perez <fperez@colorado.edu>
3002 2002-06-12 Fernando Perez <fperez@colorado.edu>
2998
3003
2999 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3004 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3000 command. Thanks to a suggestion by Mike Heeter.
3005 command. Thanks to a suggestion by Mike Heeter.
3001 (Magic.magic_pfile): added behavior to look at filenames if given
3006 (Magic.magic_pfile): added behavior to look at filenames if given
3002 arg is not a defined object.
3007 arg is not a defined object.
3003 (Magic.magic_save): New @save function to save code snippets. Also
3008 (Magic.magic_save): New @save function to save code snippets. Also
3004 a Mike Heeter idea.
3009 a Mike Heeter idea.
3005
3010
3006 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3011 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3007 plot() and replot(). Much more convenient now, especially for
3012 plot() and replot(). Much more convenient now, especially for
3008 interactive use.
3013 interactive use.
3009
3014
3010 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3015 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3011 filenames.
3016 filenames.
3012
3017
3013 2002-06-02 Fernando Perez <fperez@colorado.edu>
3018 2002-06-02 Fernando Perez <fperez@colorado.edu>
3014
3019
3015 * IPython/Struct.py (Struct.__init__): modified to admit
3020 * IPython/Struct.py (Struct.__init__): modified to admit
3016 initialization via another struct.
3021 initialization via another struct.
3017
3022
3018 * IPython/genutils.py (SystemExec.__init__): New stateful
3023 * IPython/genutils.py (SystemExec.__init__): New stateful
3019 interface to xsys and bq. Useful for writing system scripts.
3024 interface to xsys and bq. Useful for writing system scripts.
3020
3025
3021 2002-05-30 Fernando Perez <fperez@colorado.edu>
3026 2002-05-30 Fernando Perez <fperez@colorado.edu>
3022
3027
3023 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3028 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3024 documents. This will make the user download smaller (it's getting
3029 documents. This will make the user download smaller (it's getting
3025 too big).
3030 too big).
3026
3031
3027 2002-05-29 Fernando Perez <fperez@colorado.edu>
3032 2002-05-29 Fernando Perez <fperez@colorado.edu>
3028
3033
3029 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3034 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3030 fix problems with shelve and pickle. Seems to work, but I don't
3035 fix problems with shelve and pickle. Seems to work, but I don't
3031 know if corner cases break it. Thanks to Mike Heeter
3036 know if corner cases break it. Thanks to Mike Heeter
3032 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3037 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3033
3038
3034 2002-05-24 Fernando Perez <fperez@colorado.edu>
3039 2002-05-24 Fernando Perez <fperez@colorado.edu>
3035
3040
3036 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3041 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3037 macros having broken.
3042 macros having broken.
3038
3043
3039 2002-05-21 Fernando Perez <fperez@colorado.edu>
3044 2002-05-21 Fernando Perez <fperez@colorado.edu>
3040
3045
3041 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3046 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3042 introduced logging bug: all history before logging started was
3047 introduced logging bug: all history before logging started was
3043 being written one character per line! This came from the redesign
3048 being written one character per line! This came from the redesign
3044 of the input history as a special list which slices to strings,
3049 of the input history as a special list which slices to strings,
3045 not to lists.
3050 not to lists.
3046
3051
3047 2002-05-20 Fernando Perez <fperez@colorado.edu>
3052 2002-05-20 Fernando Perez <fperez@colorado.edu>
3048
3053
3049 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3054 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3050 be an attribute of all classes in this module. The design of these
3055 be an attribute of all classes in this module. The design of these
3051 classes needs some serious overhauling.
3056 classes needs some serious overhauling.
3052
3057
3053 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3058 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3054 which was ignoring '_' in option names.
3059 which was ignoring '_' in option names.
3055
3060
3056 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3061 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3057 'Verbose_novars' to 'Context' and made it the new default. It's a
3062 'Verbose_novars' to 'Context' and made it the new default. It's a
3058 bit more readable and also safer than verbose.
3063 bit more readable and also safer than verbose.
3059
3064
3060 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3065 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3061 triple-quoted strings.
3066 triple-quoted strings.
3062
3067
3063 * IPython/OInspect.py (__all__): new module exposing the object
3068 * IPython/OInspect.py (__all__): new module exposing the object
3064 introspection facilities. Now the corresponding magics are dummy
3069 introspection facilities. Now the corresponding magics are dummy
3065 wrappers around this. Having this module will make it much easier
3070 wrappers around this. Having this module will make it much easier
3066 to put these functions into our modified pdb.
3071 to put these functions into our modified pdb.
3067 This new object inspector system uses the new colorizing module,
3072 This new object inspector system uses the new colorizing module,
3068 so source code and other things are nicely syntax highlighted.
3073 so source code and other things are nicely syntax highlighted.
3069
3074
3070 2002-05-18 Fernando Perez <fperez@colorado.edu>
3075 2002-05-18 Fernando Perez <fperez@colorado.edu>
3071
3076
3072 * IPython/ColorANSI.py: Split the coloring tools into a separate
3077 * IPython/ColorANSI.py: Split the coloring tools into a separate
3073 module so I can use them in other code easier (they were part of
3078 module so I can use them in other code easier (they were part of
3074 ultraTB).
3079 ultraTB).
3075
3080
3076 2002-05-17 Fernando Perez <fperez@colorado.edu>
3081 2002-05-17 Fernando Perez <fperez@colorado.edu>
3077
3082
3078 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3083 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3079 fixed it to set the global 'g' also to the called instance, as
3084 fixed it to set the global 'g' also to the called instance, as
3080 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3085 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3081 user's 'g' variables).
3086 user's 'g' variables).
3082
3087
3083 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3088 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3084 global variables (aliases to _ih,_oh) so that users which expect
3089 global variables (aliases to _ih,_oh) so that users which expect
3085 In[5] or Out[7] to work aren't unpleasantly surprised.
3090 In[5] or Out[7] to work aren't unpleasantly surprised.
3086 (InputList.__getslice__): new class to allow executing slices of
3091 (InputList.__getslice__): new class to allow executing slices of
3087 input history directly. Very simple class, complements the use of
3092 input history directly. Very simple class, complements the use of
3088 macros.
3093 macros.
3089
3094
3090 2002-05-16 Fernando Perez <fperez@colorado.edu>
3095 2002-05-16 Fernando Perez <fperez@colorado.edu>
3091
3096
3092 * setup.py (docdirbase): make doc directory be just doc/IPython
3097 * setup.py (docdirbase): make doc directory be just doc/IPython
3093 without version numbers, it will reduce clutter for users.
3098 without version numbers, it will reduce clutter for users.
3094
3099
3095 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3100 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3096 execfile call to prevent possible memory leak. See for details:
3101 execfile call to prevent possible memory leak. See for details:
3097 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3102 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3098
3103
3099 2002-05-15 Fernando Perez <fperez@colorado.edu>
3104 2002-05-15 Fernando Perez <fperez@colorado.edu>
3100
3105
3101 * IPython/Magic.py (Magic.magic_psource): made the object
3106 * IPython/Magic.py (Magic.magic_psource): made the object
3102 introspection names be more standard: pdoc, pdef, pfile and
3107 introspection names be more standard: pdoc, pdef, pfile and
3103 psource. They all print/page their output, and it makes
3108 psource. They all print/page their output, and it makes
3104 remembering them easier. Kept old names for compatibility as
3109 remembering them easier. Kept old names for compatibility as
3105 aliases.
3110 aliases.
3106
3111
3107 2002-05-14 Fernando Perez <fperez@colorado.edu>
3112 2002-05-14 Fernando Perez <fperez@colorado.edu>
3108
3113
3109 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3114 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3110 what the mouse problem was. The trick is to use gnuplot with temp
3115 what the mouse problem was. The trick is to use gnuplot with temp
3111 files and NOT with pipes (for data communication), because having
3116 files and NOT with pipes (for data communication), because having
3112 both pipes and the mouse on is bad news.
3117 both pipes and the mouse on is bad news.
3113
3118
3114 2002-05-13 Fernando Perez <fperez@colorado.edu>
3119 2002-05-13 Fernando Perez <fperez@colorado.edu>
3115
3120
3116 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3121 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3117 bug. Information would be reported about builtins even when
3122 bug. Information would be reported about builtins even when
3118 user-defined functions overrode them.
3123 user-defined functions overrode them.
3119
3124
3120 2002-05-11 Fernando Perez <fperez@colorado.edu>
3125 2002-05-11 Fernando Perez <fperez@colorado.edu>
3121
3126
3122 * IPython/__init__.py (__all__): removed FlexCompleter from
3127 * IPython/__init__.py (__all__): removed FlexCompleter from
3123 __all__ so that things don't fail in platforms without readline.
3128 __all__ so that things don't fail in platforms without readline.
3124
3129
3125 2002-05-10 Fernando Perez <fperez@colorado.edu>
3130 2002-05-10 Fernando Perez <fperez@colorado.edu>
3126
3131
3127 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3132 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3128 it requires Numeric, effectively making Numeric a dependency for
3133 it requires Numeric, effectively making Numeric a dependency for
3129 IPython.
3134 IPython.
3130
3135
3131 * Released 0.2.13
3136 * Released 0.2.13
3132
3137
3133 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3138 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3134 profiler interface. Now all the major options from the profiler
3139 profiler interface. Now all the major options from the profiler
3135 module are directly supported in IPython, both for single
3140 module are directly supported in IPython, both for single
3136 expressions (@prun) and for full programs (@run -p).
3141 expressions (@prun) and for full programs (@run -p).
3137
3142
3138 2002-05-09 Fernando Perez <fperez@colorado.edu>
3143 2002-05-09 Fernando Perez <fperez@colorado.edu>
3139
3144
3140 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3145 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3141 magic properly formatted for screen.
3146 magic properly formatted for screen.
3142
3147
3143 * setup.py (make_shortcut): Changed things to put pdf version in
3148 * setup.py (make_shortcut): Changed things to put pdf version in
3144 doc/ instead of doc/manual (had to change lyxport a bit).
3149 doc/ instead of doc/manual (had to change lyxport a bit).
3145
3150
3146 * IPython/Magic.py (Profile.string_stats): made profile runs go
3151 * IPython/Magic.py (Profile.string_stats): made profile runs go
3147 through pager (they are long and a pager allows searching, saving,
3152 through pager (they are long and a pager allows searching, saving,
3148 etc.)
3153 etc.)
3149
3154
3150 2002-05-08 Fernando Perez <fperez@colorado.edu>
3155 2002-05-08 Fernando Perez <fperez@colorado.edu>
3151
3156
3152 * Released 0.2.12
3157 * Released 0.2.12
3153
3158
3154 2002-05-06 Fernando Perez <fperez@colorado.edu>
3159 2002-05-06 Fernando Perez <fperez@colorado.edu>
3155
3160
3156 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3161 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3157 introduced); 'hist n1 n2' was broken.
3162 introduced); 'hist n1 n2' was broken.
3158 (Magic.magic_pdb): added optional on/off arguments to @pdb
3163 (Magic.magic_pdb): added optional on/off arguments to @pdb
3159 (Magic.magic_run): added option -i to @run, which executes code in
3164 (Magic.magic_run): added option -i to @run, which executes code in
3160 the IPython namespace instead of a clean one. Also added @irun as
3165 the IPython namespace instead of a clean one. Also added @irun as
3161 an alias to @run -i.
3166 an alias to @run -i.
3162
3167
3163 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3168 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3164 fixed (it didn't really do anything, the namespaces were wrong).
3169 fixed (it didn't really do anything, the namespaces were wrong).
3165
3170
3166 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3171 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3167
3172
3168 * IPython/__init__.py (__all__): Fixed package namespace, now
3173 * IPython/__init__.py (__all__): Fixed package namespace, now
3169 'import IPython' does give access to IPython.<all> as
3174 'import IPython' does give access to IPython.<all> as
3170 expected. Also renamed __release__ to Release.
3175 expected. Also renamed __release__ to Release.
3171
3176
3172 * IPython/Debugger.py (__license__): created new Pdb class which
3177 * IPython/Debugger.py (__license__): created new Pdb class which
3173 functions like a drop-in for the normal pdb.Pdb but does NOT
3178 functions like a drop-in for the normal pdb.Pdb but does NOT
3174 import readline by default. This way it doesn't muck up IPython's
3179 import readline by default. This way it doesn't muck up IPython's
3175 readline handling, and now tab-completion finally works in the
3180 readline handling, and now tab-completion finally works in the
3176 debugger -- sort of. It completes things globally visible, but the
3181 debugger -- sort of. It completes things globally visible, but the
3177 completer doesn't track the stack as pdb walks it. That's a bit
3182 completer doesn't track the stack as pdb walks it. That's a bit
3178 tricky, and I'll have to implement it later.
3183 tricky, and I'll have to implement it later.
3179
3184
3180 2002-05-05 Fernando Perez <fperez@colorado.edu>
3185 2002-05-05 Fernando Perez <fperez@colorado.edu>
3181
3186
3182 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3187 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3183 magic docstrings when printed via ? (explicit \'s were being
3188 magic docstrings when printed via ? (explicit \'s were being
3184 printed).
3189 printed).
3185
3190
3186 * IPython/ipmaker.py (make_IPython): fixed namespace
3191 * IPython/ipmaker.py (make_IPython): fixed namespace
3187 identification bug. Now variables loaded via logs or command-line
3192 identification bug. Now variables loaded via logs or command-line
3188 files are recognized in the interactive namespace by @who.
3193 files are recognized in the interactive namespace by @who.
3189
3194
3190 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3195 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3191 log replay system stemming from the string form of Structs.
3196 log replay system stemming from the string form of Structs.
3192
3197
3193 * IPython/Magic.py (Macro.__init__): improved macros to properly
3198 * IPython/Magic.py (Macro.__init__): improved macros to properly
3194 handle magic commands in them.
3199 handle magic commands in them.
3195 (Magic.magic_logstart): usernames are now expanded so 'logstart
3200 (Magic.magic_logstart): usernames are now expanded so 'logstart
3196 ~/mylog' now works.
3201 ~/mylog' now works.
3197
3202
3198 * IPython/iplib.py (complete): fixed bug where paths starting with
3203 * IPython/iplib.py (complete): fixed bug where paths starting with
3199 '/' would be completed as magic names.
3204 '/' would be completed as magic names.
3200
3205
3201 2002-05-04 Fernando Perez <fperez@colorado.edu>
3206 2002-05-04 Fernando Perez <fperez@colorado.edu>
3202
3207
3203 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3208 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3204 allow running full programs under the profiler's control.
3209 allow running full programs under the profiler's control.
3205
3210
3206 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3211 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3207 mode to report exceptions verbosely but without formatting
3212 mode to report exceptions verbosely but without formatting
3208 variables. This addresses the issue of ipython 'freezing' (it's
3213 variables. This addresses the issue of ipython 'freezing' (it's
3209 not frozen, but caught in an expensive formatting loop) when huge
3214 not frozen, but caught in an expensive formatting loop) when huge
3210 variables are in the context of an exception.
3215 variables are in the context of an exception.
3211 (VerboseTB.text): Added '--->' markers at line where exception was
3216 (VerboseTB.text): Added '--->' markers at line where exception was
3212 triggered. Much clearer to read, especially in NoColor modes.
3217 triggered. Much clearer to read, especially in NoColor modes.
3213
3218
3214 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3219 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3215 implemented in reverse when changing to the new parse_options().
3220 implemented in reverse when changing to the new parse_options().
3216
3221
3217 2002-05-03 Fernando Perez <fperez@colorado.edu>
3222 2002-05-03 Fernando Perez <fperez@colorado.edu>
3218
3223
3219 * IPython/Magic.py (Magic.parse_options): new function so that
3224 * IPython/Magic.py (Magic.parse_options): new function so that
3220 magics can parse options easier.
3225 magics can parse options easier.
3221 (Magic.magic_prun): new function similar to profile.run(),
3226 (Magic.magic_prun): new function similar to profile.run(),
3222 suggested by Chris Hart.
3227 suggested by Chris Hart.
3223 (Magic.magic_cd): fixed behavior so that it only changes if
3228 (Magic.magic_cd): fixed behavior so that it only changes if
3224 directory actually is in history.
3229 directory actually is in history.
3225
3230
3226 * IPython/usage.py (__doc__): added information about potential
3231 * IPython/usage.py (__doc__): added information about potential
3227 slowness of Verbose exception mode when there are huge data
3232 slowness of Verbose exception mode when there are huge data
3228 structures to be formatted (thanks to Archie Paulson).
3233 structures to be formatted (thanks to Archie Paulson).
3229
3234
3230 * IPython/ipmaker.py (make_IPython): Changed default logging
3235 * IPython/ipmaker.py (make_IPython): Changed default logging
3231 (when simply called with -log) to use curr_dir/ipython.log in
3236 (when simply called with -log) to use curr_dir/ipython.log in
3232 rotate mode. Fixed crash which was occuring with -log before
3237 rotate mode. Fixed crash which was occuring with -log before
3233 (thanks to Jim Boyle).
3238 (thanks to Jim Boyle).
3234
3239
3235 2002-05-01 Fernando Perez <fperez@colorado.edu>
3240 2002-05-01 Fernando Perez <fperez@colorado.edu>
3236
3241
3237 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3242 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3238 was nasty -- though somewhat of a corner case).
3243 was nasty -- though somewhat of a corner case).
3239
3244
3240 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3245 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3241 text (was a bug).
3246 text (was a bug).
3242
3247
3243 2002-04-30 Fernando Perez <fperez@colorado.edu>
3248 2002-04-30 Fernando Perez <fperez@colorado.edu>
3244
3249
3245 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3250 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3246 a print after ^D or ^C from the user so that the In[] prompt
3251 a print after ^D or ^C from the user so that the In[] prompt
3247 doesn't over-run the gnuplot one.
3252 doesn't over-run the gnuplot one.
3248
3253
3249 2002-04-29 Fernando Perez <fperez@colorado.edu>
3254 2002-04-29 Fernando Perez <fperez@colorado.edu>
3250
3255
3251 * Released 0.2.10
3256 * Released 0.2.10
3252
3257
3253 * IPython/__release__.py (version): get date dynamically.
3258 * IPython/__release__.py (version): get date dynamically.
3254
3259
3255 * Misc. documentation updates thanks to Arnd's comments. Also ran
3260 * Misc. documentation updates thanks to Arnd's comments. Also ran
3256 a full spellcheck on the manual (hadn't been done in a while).
3261 a full spellcheck on the manual (hadn't been done in a while).
3257
3262
3258 2002-04-27 Fernando Perez <fperez@colorado.edu>
3263 2002-04-27 Fernando Perez <fperez@colorado.edu>
3259
3264
3260 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3265 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3261 starting a log in mid-session would reset the input history list.
3266 starting a log in mid-session would reset the input history list.
3262
3267
3263 2002-04-26 Fernando Perez <fperez@colorado.edu>
3268 2002-04-26 Fernando Perez <fperez@colorado.edu>
3264
3269
3265 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3270 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3266 all files were being included in an update. Now anything in
3271 all files were being included in an update. Now anything in
3267 UserConfig that matches [A-Za-z]*.py will go (this excludes
3272 UserConfig that matches [A-Za-z]*.py will go (this excludes
3268 __init__.py)
3273 __init__.py)
3269
3274
3270 2002-04-25 Fernando Perez <fperez@colorado.edu>
3275 2002-04-25 Fernando Perez <fperez@colorado.edu>
3271
3276
3272 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3277 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3273 to __builtins__ so that any form of embedded or imported code can
3278 to __builtins__ so that any form of embedded or imported code can
3274 test for being inside IPython.
3279 test for being inside IPython.
3275
3280
3276 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3281 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3277 changed to GnuplotMagic because it's now an importable module,
3282 changed to GnuplotMagic because it's now an importable module,
3278 this makes the name follow that of the standard Gnuplot module.
3283 this makes the name follow that of the standard Gnuplot module.
3279 GnuplotMagic can now be loaded at any time in mid-session.
3284 GnuplotMagic can now be loaded at any time in mid-session.
3280
3285
3281 2002-04-24 Fernando Perez <fperez@colorado.edu>
3286 2002-04-24 Fernando Perez <fperez@colorado.edu>
3282
3287
3283 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3288 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3284 the globals (IPython has its own namespace) and the
3289 the globals (IPython has its own namespace) and the
3285 PhysicalQuantity stuff is much better anyway.
3290 PhysicalQuantity stuff is much better anyway.
3286
3291
3287 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3292 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3288 embedding example to standard user directory for
3293 embedding example to standard user directory for
3289 distribution. Also put it in the manual.
3294 distribution. Also put it in the manual.
3290
3295
3291 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3296 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3292 instance as first argument (so it doesn't rely on some obscure
3297 instance as first argument (so it doesn't rely on some obscure
3293 hidden global).
3298 hidden global).
3294
3299
3295 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3300 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3296 delimiters. While it prevents ().TAB from working, it allows
3301 delimiters. While it prevents ().TAB from working, it allows
3297 completions in open (... expressions. This is by far a more common
3302 completions in open (... expressions. This is by far a more common
3298 case.
3303 case.
3299
3304
3300 2002-04-23 Fernando Perez <fperez@colorado.edu>
3305 2002-04-23 Fernando Perez <fperez@colorado.edu>
3301
3306
3302 * IPython/Extensions/InterpreterPasteInput.py: new
3307 * IPython/Extensions/InterpreterPasteInput.py: new
3303 syntax-processing module for pasting lines with >>> or ... at the
3308 syntax-processing module for pasting lines with >>> or ... at the
3304 start.
3309 start.
3305
3310
3306 * IPython/Extensions/PhysicalQ_Interactive.py
3311 * IPython/Extensions/PhysicalQ_Interactive.py
3307 (PhysicalQuantityInteractive.__int__): fixed to work with either
3312 (PhysicalQuantityInteractive.__int__): fixed to work with either
3308 Numeric or math.
3313 Numeric or math.
3309
3314
3310 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3315 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3311 provided profiles. Now we have:
3316 provided profiles. Now we have:
3312 -math -> math module as * and cmath with its own namespace.
3317 -math -> math module as * and cmath with its own namespace.
3313 -numeric -> Numeric as *, plus gnuplot & grace
3318 -numeric -> Numeric as *, plus gnuplot & grace
3314 -physics -> same as before
3319 -physics -> same as before
3315
3320
3316 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3321 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3317 user-defined magics wouldn't be found by @magic if they were
3322 user-defined magics wouldn't be found by @magic if they were
3318 defined as class methods. Also cleaned up the namespace search
3323 defined as class methods. Also cleaned up the namespace search
3319 logic and the string building (to use %s instead of many repeated
3324 logic and the string building (to use %s instead of many repeated
3320 string adds).
3325 string adds).
3321
3326
3322 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3327 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3323 of user-defined magics to operate with class methods (cleaner, in
3328 of user-defined magics to operate with class methods (cleaner, in
3324 line with the gnuplot code).
3329 line with the gnuplot code).
3325
3330
3326 2002-04-22 Fernando Perez <fperez@colorado.edu>
3331 2002-04-22 Fernando Perez <fperez@colorado.edu>
3327
3332
3328 * setup.py: updated dependency list so that manual is updated when
3333 * setup.py: updated dependency list so that manual is updated when
3329 all included files change.
3334 all included files change.
3330
3335
3331 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3336 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3332 the delimiter removal option (the fix is ugly right now).
3337 the delimiter removal option (the fix is ugly right now).
3333
3338
3334 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3339 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3335 all of the math profile (quicker loading, no conflict between
3340 all of the math profile (quicker loading, no conflict between
3336 g-9.8 and g-gnuplot).
3341 g-9.8 and g-gnuplot).
3337
3342
3338 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3343 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3339 name of post-mortem files to IPython_crash_report.txt.
3344 name of post-mortem files to IPython_crash_report.txt.
3340
3345
3341 * Cleanup/update of the docs. Added all the new readline info and
3346 * Cleanup/update of the docs. Added all the new readline info and
3342 formatted all lists as 'real lists'.
3347 formatted all lists as 'real lists'.
3343
3348
3344 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3349 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3345 tab-completion options, since the full readline parse_and_bind is
3350 tab-completion options, since the full readline parse_and_bind is
3346 now accessible.
3351 now accessible.
3347
3352
3348 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3353 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3349 handling of readline options. Now users can specify any string to
3354 handling of readline options. Now users can specify any string to
3350 be passed to parse_and_bind(), as well as the delimiters to be
3355 be passed to parse_and_bind(), as well as the delimiters to be
3351 removed.
3356 removed.
3352 (InteractiveShell.__init__): Added __name__ to the global
3357 (InteractiveShell.__init__): Added __name__ to the global
3353 namespace so that things like Itpl which rely on its existence
3358 namespace so that things like Itpl which rely on its existence
3354 don't crash.
3359 don't crash.
3355 (InteractiveShell._prefilter): Defined the default with a _ so
3360 (InteractiveShell._prefilter): Defined the default with a _ so
3356 that prefilter() is easier to override, while the default one
3361 that prefilter() is easier to override, while the default one
3357 remains available.
3362 remains available.
3358
3363
3359 2002-04-18 Fernando Perez <fperez@colorado.edu>
3364 2002-04-18 Fernando Perez <fperez@colorado.edu>
3360
3365
3361 * Added information about pdb in the docs.
3366 * Added information about pdb in the docs.
3362
3367
3363 2002-04-17 Fernando Perez <fperez@colorado.edu>
3368 2002-04-17 Fernando Perez <fperez@colorado.edu>
3364
3369
3365 * IPython/ipmaker.py (make_IPython): added rc_override option to
3370 * IPython/ipmaker.py (make_IPython): added rc_override option to
3366 allow passing config options at creation time which may override
3371 allow passing config options at creation time which may override
3367 anything set in the config files or command line. This is
3372 anything set in the config files or command line. This is
3368 particularly useful for configuring embedded instances.
3373 particularly useful for configuring embedded instances.
3369
3374
3370 2002-04-15 Fernando Perez <fperez@colorado.edu>
3375 2002-04-15 Fernando Perez <fperez@colorado.edu>
3371
3376
3372 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3377 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3373 crash embedded instances because of the input cache falling out of
3378 crash embedded instances because of the input cache falling out of
3374 sync with the output counter.
3379 sync with the output counter.
3375
3380
3376 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3381 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3377 mode which calls pdb after an uncaught exception in IPython itself.
3382 mode which calls pdb after an uncaught exception in IPython itself.
3378
3383
3379 2002-04-14 Fernando Perez <fperez@colorado.edu>
3384 2002-04-14 Fernando Perez <fperez@colorado.edu>
3380
3385
3381 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3386 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3382 readline, fix it back after each call.
3387 readline, fix it back after each call.
3383
3388
3384 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3389 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3385 method to force all access via __call__(), which guarantees that
3390 method to force all access via __call__(), which guarantees that
3386 traceback references are properly deleted.
3391 traceback references are properly deleted.
3387
3392
3388 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3393 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3389 improve printing when pprint is in use.
3394 improve printing when pprint is in use.
3390
3395
3391 2002-04-13 Fernando Perez <fperez@colorado.edu>
3396 2002-04-13 Fernando Perez <fperez@colorado.edu>
3392
3397
3393 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3398 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3394 exceptions aren't caught anymore. If the user triggers one, he
3399 exceptions aren't caught anymore. If the user triggers one, he
3395 should know why he's doing it and it should go all the way up,
3400 should know why he's doing it and it should go all the way up,
3396 just like any other exception. So now @abort will fully kill the
3401 just like any other exception. So now @abort will fully kill the
3397 embedded interpreter and the embedding code (unless that happens
3402 embedded interpreter and the embedding code (unless that happens
3398 to catch SystemExit).
3403 to catch SystemExit).
3399
3404
3400 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3405 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3401 and a debugger() method to invoke the interactive pdb debugger
3406 and a debugger() method to invoke the interactive pdb debugger
3402 after printing exception information. Also added the corresponding
3407 after printing exception information. Also added the corresponding
3403 -pdb option and @pdb magic to control this feature, and updated
3408 -pdb option and @pdb magic to control this feature, and updated
3404 the docs. After a suggestion from Christopher Hart
3409 the docs. After a suggestion from Christopher Hart
3405 (hart-AT-caltech.edu).
3410 (hart-AT-caltech.edu).
3406
3411
3407 2002-04-12 Fernando Perez <fperez@colorado.edu>
3412 2002-04-12 Fernando Perez <fperez@colorado.edu>
3408
3413
3409 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3414 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3410 the exception handlers defined by the user (not the CrashHandler)
3415 the exception handlers defined by the user (not the CrashHandler)
3411 so that user exceptions don't trigger an ipython bug report.
3416 so that user exceptions don't trigger an ipython bug report.
3412
3417
3413 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3418 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3414 configurable (it should have always been so).
3419 configurable (it should have always been so).
3415
3420
3416 2002-03-26 Fernando Perez <fperez@colorado.edu>
3421 2002-03-26 Fernando Perez <fperez@colorado.edu>
3417
3422
3418 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3423 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3419 and there to fix embedding namespace issues. This should all be
3424 and there to fix embedding namespace issues. This should all be
3420 done in a more elegant way.
3425 done in a more elegant way.
3421
3426
3422 2002-03-25 Fernando Perez <fperez@colorado.edu>
3427 2002-03-25 Fernando Perez <fperez@colorado.edu>
3423
3428
3424 * IPython/genutils.py (get_home_dir): Try to make it work under
3429 * IPython/genutils.py (get_home_dir): Try to make it work under
3425 win9x also.
3430 win9x also.
3426
3431
3427 2002-03-20 Fernando Perez <fperez@colorado.edu>
3432 2002-03-20 Fernando Perez <fperez@colorado.edu>
3428
3433
3429 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3434 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3430 sys.displayhook untouched upon __init__.
3435 sys.displayhook untouched upon __init__.
3431
3436
3432 2002-03-19 Fernando Perez <fperez@colorado.edu>
3437 2002-03-19 Fernando Perez <fperez@colorado.edu>
3433
3438
3434 * Released 0.2.9 (for embedding bug, basically).
3439 * Released 0.2.9 (for embedding bug, basically).
3435
3440
3436 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3441 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3437 exceptions so that enclosing shell's state can be restored.
3442 exceptions so that enclosing shell's state can be restored.
3438
3443
3439 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3444 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3440 naming conventions in the .ipython/ dir.
3445 naming conventions in the .ipython/ dir.
3441
3446
3442 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3447 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3443 from delimiters list so filenames with - in them get expanded.
3448 from delimiters list so filenames with - in them get expanded.
3444
3449
3445 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3450 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3446 sys.displayhook not being properly restored after an embedded call.
3451 sys.displayhook not being properly restored after an embedded call.
3447
3452
3448 2002-03-18 Fernando Perez <fperez@colorado.edu>
3453 2002-03-18 Fernando Perez <fperez@colorado.edu>
3449
3454
3450 * Released 0.2.8
3455 * Released 0.2.8
3451
3456
3452 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3457 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3453 some files weren't being included in a -upgrade.
3458 some files weren't being included in a -upgrade.
3454 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3459 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3455 on' so that the first tab completes.
3460 on' so that the first tab completes.
3456 (InteractiveShell.handle_magic): fixed bug with spaces around
3461 (InteractiveShell.handle_magic): fixed bug with spaces around
3457 quotes breaking many magic commands.
3462 quotes breaking many magic commands.
3458
3463
3459 * setup.py: added note about ignoring the syntax error messages at
3464 * setup.py: added note about ignoring the syntax error messages at
3460 installation.
3465 installation.
3461
3466
3462 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3467 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3463 streamlining the gnuplot interface, now there's only one magic @gp.
3468 streamlining the gnuplot interface, now there's only one magic @gp.
3464
3469
3465 2002-03-17 Fernando Perez <fperez@colorado.edu>
3470 2002-03-17 Fernando Perez <fperez@colorado.edu>
3466
3471
3467 * IPython/UserConfig/magic_gnuplot.py: new name for the
3472 * IPython/UserConfig/magic_gnuplot.py: new name for the
3468 example-magic_pm.py file. Much enhanced system, now with a shell
3473 example-magic_pm.py file. Much enhanced system, now with a shell
3469 for communicating directly with gnuplot, one command at a time.
3474 for communicating directly with gnuplot, one command at a time.
3470
3475
3471 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3476 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3472 setting __name__=='__main__'.
3477 setting __name__=='__main__'.
3473
3478
3474 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3479 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3475 mini-shell for accessing gnuplot from inside ipython. Should
3480 mini-shell for accessing gnuplot from inside ipython. Should
3476 extend it later for grace access too. Inspired by Arnd's
3481 extend it later for grace access too. Inspired by Arnd's
3477 suggestion.
3482 suggestion.
3478
3483
3479 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3484 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3480 calling magic functions with () in their arguments. Thanks to Arnd
3485 calling magic functions with () in their arguments. Thanks to Arnd
3481 Baecker for pointing this to me.
3486 Baecker for pointing this to me.
3482
3487
3483 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3488 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3484 infinitely for integer or complex arrays (only worked with floats).
3489 infinitely for integer or complex arrays (only worked with floats).
3485
3490
3486 2002-03-16 Fernando Perez <fperez@colorado.edu>
3491 2002-03-16 Fernando Perez <fperez@colorado.edu>
3487
3492
3488 * setup.py: Merged setup and setup_windows into a single script
3493 * setup.py: Merged setup and setup_windows into a single script
3489 which properly handles things for windows users.
3494 which properly handles things for windows users.
3490
3495
3491 2002-03-15 Fernando Perez <fperez@colorado.edu>
3496 2002-03-15 Fernando Perez <fperez@colorado.edu>
3492
3497
3493 * Big change to the manual: now the magics are all automatically
3498 * Big change to the manual: now the magics are all automatically
3494 documented. This information is generated from their docstrings
3499 documented. This information is generated from their docstrings
3495 and put in a latex file included by the manual lyx file. This way
3500 and put in a latex file included by the manual lyx file. This way
3496 we get always up to date information for the magics. The manual
3501 we get always up to date information for the magics. The manual
3497 now also has proper version information, also auto-synced.
3502 now also has proper version information, also auto-synced.
3498
3503
3499 For this to work, an undocumented --magic_docstrings option was added.
3504 For this to work, an undocumented --magic_docstrings option was added.
3500
3505
3501 2002-03-13 Fernando Perez <fperez@colorado.edu>
3506 2002-03-13 Fernando Perez <fperez@colorado.edu>
3502
3507
3503 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3508 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3504 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3509 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3505
3510
3506 2002-03-12 Fernando Perez <fperez@colorado.edu>
3511 2002-03-12 Fernando Perez <fperez@colorado.edu>
3507
3512
3508 * IPython/ultraTB.py (TermColors): changed color escapes again to
3513 * IPython/ultraTB.py (TermColors): changed color escapes again to
3509 fix the (old, reintroduced) line-wrapping bug. Basically, if
3514 fix the (old, reintroduced) line-wrapping bug. Basically, if
3510 \001..\002 aren't given in the color escapes, lines get wrapped
3515 \001..\002 aren't given in the color escapes, lines get wrapped
3511 weirdly. But giving those screws up old xterms and emacs terms. So
3516 weirdly. But giving those screws up old xterms and emacs terms. So
3512 I added some logic for emacs terms to be ok, but I can't identify old
3517 I added some logic for emacs terms to be ok, but I can't identify old
3513 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3518 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3514
3519
3515 2002-03-10 Fernando Perez <fperez@colorado.edu>
3520 2002-03-10 Fernando Perez <fperez@colorado.edu>
3516
3521
3517 * IPython/usage.py (__doc__): Various documentation cleanups and
3522 * IPython/usage.py (__doc__): Various documentation cleanups and
3518 updates, both in usage docstrings and in the manual.
3523 updates, both in usage docstrings and in the manual.
3519
3524
3520 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3525 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3521 handling of caching. Set minimum acceptabe value for having a
3526 handling of caching. Set minimum acceptabe value for having a
3522 cache at 20 values.
3527 cache at 20 values.
3523
3528
3524 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3529 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3525 install_first_time function to a method, renamed it and added an
3530 install_first_time function to a method, renamed it and added an
3526 'upgrade' mode. Now people can update their config directory with
3531 'upgrade' mode. Now people can update their config directory with
3527 a simple command line switch (-upgrade, also new).
3532 a simple command line switch (-upgrade, also new).
3528
3533
3529 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3534 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3530 @file (convenient for automagic users under Python >= 2.2).
3535 @file (convenient for automagic users under Python >= 2.2).
3531 Removed @files (it seemed more like a plural than an abbrev. of
3536 Removed @files (it seemed more like a plural than an abbrev. of
3532 'file show').
3537 'file show').
3533
3538
3534 * IPython/iplib.py (install_first_time): Fixed crash if there were
3539 * IPython/iplib.py (install_first_time): Fixed crash if there were
3535 backup files ('~') in .ipython/ install directory.
3540 backup files ('~') in .ipython/ install directory.
3536
3541
3537 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3542 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3538 system. Things look fine, but these changes are fairly
3543 system. Things look fine, but these changes are fairly
3539 intrusive. Test them for a few days.
3544 intrusive. Test them for a few days.
3540
3545
3541 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3546 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3542 the prompts system. Now all in/out prompt strings are user
3547 the prompts system. Now all in/out prompt strings are user
3543 controllable. This is particularly useful for embedding, as one
3548 controllable. This is particularly useful for embedding, as one
3544 can tag embedded instances with particular prompts.
3549 can tag embedded instances with particular prompts.
3545
3550
3546 Also removed global use of sys.ps1/2, which now allows nested
3551 Also removed global use of sys.ps1/2, which now allows nested
3547 embeddings without any problems. Added command-line options for
3552 embeddings without any problems. Added command-line options for
3548 the prompt strings.
3553 the prompt strings.
3549
3554
3550 2002-03-08 Fernando Perez <fperez@colorado.edu>
3555 2002-03-08 Fernando Perez <fperez@colorado.edu>
3551
3556
3552 * IPython/UserConfig/example-embed-short.py (ipshell): added
3557 * IPython/UserConfig/example-embed-short.py (ipshell): added
3553 example file with the bare minimum code for embedding.
3558 example file with the bare minimum code for embedding.
3554
3559
3555 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3560 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3556 functionality for the embeddable shell to be activated/deactivated
3561 functionality for the embeddable shell to be activated/deactivated
3557 either globally or at each call.
3562 either globally or at each call.
3558
3563
3559 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3564 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3560 rewriting the prompt with '--->' for auto-inputs with proper
3565 rewriting the prompt with '--->' for auto-inputs with proper
3561 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3566 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3562 this is handled by the prompts class itself, as it should.
3567 this is handled by the prompts class itself, as it should.
3563
3568
3564 2002-03-05 Fernando Perez <fperez@colorado.edu>
3569 2002-03-05 Fernando Perez <fperez@colorado.edu>
3565
3570
3566 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3571 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3567 @logstart to avoid name clashes with the math log function.
3572 @logstart to avoid name clashes with the math log function.
3568
3573
3569 * Big updates to X/Emacs section of the manual.
3574 * Big updates to X/Emacs section of the manual.
3570
3575
3571 * Removed ipython_emacs. Milan explained to me how to pass
3576 * Removed ipython_emacs. Milan explained to me how to pass
3572 arguments to ipython through Emacs. Some day I'm going to end up
3577 arguments to ipython through Emacs. Some day I'm going to end up
3573 learning some lisp...
3578 learning some lisp...
3574
3579
3575 2002-03-04 Fernando Perez <fperez@colorado.edu>
3580 2002-03-04 Fernando Perez <fperez@colorado.edu>
3576
3581
3577 * IPython/ipython_emacs: Created script to be used as the
3582 * IPython/ipython_emacs: Created script to be used as the
3578 py-python-command Emacs variable so we can pass IPython
3583 py-python-command Emacs variable so we can pass IPython
3579 parameters. I can't figure out how to tell Emacs directly to pass
3584 parameters. I can't figure out how to tell Emacs directly to pass
3580 parameters to IPython, so a dummy shell script will do it.
3585 parameters to IPython, so a dummy shell script will do it.
3581
3586
3582 Other enhancements made for things to work better under Emacs'
3587 Other enhancements made for things to work better under Emacs'
3583 various types of terminals. Many thanks to Milan Zamazal
3588 various types of terminals. Many thanks to Milan Zamazal
3584 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3589 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3585
3590
3586 2002-03-01 Fernando Perez <fperez@colorado.edu>
3591 2002-03-01 Fernando Perez <fperez@colorado.edu>
3587
3592
3588 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3593 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3589 that loading of readline is now optional. This gives better
3594 that loading of readline is now optional. This gives better
3590 control to emacs users.
3595 control to emacs users.
3591
3596
3592 * IPython/ultraTB.py (__date__): Modified color escape sequences
3597 * IPython/ultraTB.py (__date__): Modified color escape sequences
3593 and now things work fine under xterm and in Emacs' term buffers
3598 and now things work fine under xterm and in Emacs' term buffers
3594 (though not shell ones). Well, in emacs you get colors, but all
3599 (though not shell ones). Well, in emacs you get colors, but all
3595 seem to be 'light' colors (no difference between dark and light
3600 seem to be 'light' colors (no difference between dark and light
3596 ones). But the garbage chars are gone, and also in xterms. It
3601 ones). But the garbage chars are gone, and also in xterms. It
3597 seems that now I'm using 'cleaner' ansi sequences.
3602 seems that now I'm using 'cleaner' ansi sequences.
3598
3603
3599 2002-02-21 Fernando Perez <fperez@colorado.edu>
3604 2002-02-21 Fernando Perez <fperez@colorado.edu>
3600
3605
3601 * Released 0.2.7 (mainly to publish the scoping fix).
3606 * Released 0.2.7 (mainly to publish the scoping fix).
3602
3607
3603 * IPython/Logger.py (Logger.logstate): added. A corresponding
3608 * IPython/Logger.py (Logger.logstate): added. A corresponding
3604 @logstate magic was created.
3609 @logstate magic was created.
3605
3610
3606 * IPython/Magic.py: fixed nested scoping problem under Python
3611 * IPython/Magic.py: fixed nested scoping problem under Python
3607 2.1.x (automagic wasn't working).
3612 2.1.x (automagic wasn't working).
3608
3613
3609 2002-02-20 Fernando Perez <fperez@colorado.edu>
3614 2002-02-20 Fernando Perez <fperez@colorado.edu>
3610
3615
3611 * Released 0.2.6.
3616 * Released 0.2.6.
3612
3617
3613 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3618 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3614 option so that logs can come out without any headers at all.
3619 option so that logs can come out without any headers at all.
3615
3620
3616 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3621 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3617 SciPy.
3622 SciPy.
3618
3623
3619 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3624 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3620 that embedded IPython calls don't require vars() to be explicitly
3625 that embedded IPython calls don't require vars() to be explicitly
3621 passed. Now they are extracted from the caller's frame (code
3626 passed. Now they are extracted from the caller's frame (code
3622 snatched from Eric Jones' weave). Added better documentation to
3627 snatched from Eric Jones' weave). Added better documentation to
3623 the section on embedding and the example file.
3628 the section on embedding and the example file.
3624
3629
3625 * IPython/genutils.py (page): Changed so that under emacs, it just
3630 * IPython/genutils.py (page): Changed so that under emacs, it just
3626 prints the string. You can then page up and down in the emacs
3631 prints the string. You can then page up and down in the emacs
3627 buffer itself. This is how the builtin help() works.
3632 buffer itself. This is how the builtin help() works.
3628
3633
3629 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3634 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3630 macro scoping: macros need to be executed in the user's namespace
3635 macro scoping: macros need to be executed in the user's namespace
3631 to work as if they had been typed by the user.
3636 to work as if they had been typed by the user.
3632
3637
3633 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3638 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3634 execute automatically (no need to type 'exec...'). They then
3639 execute automatically (no need to type 'exec...'). They then
3635 behave like 'true macros'. The printing system was also modified
3640 behave like 'true macros'. The printing system was also modified
3636 for this to work.
3641 for this to work.
3637
3642
3638 2002-02-19 Fernando Perez <fperez@colorado.edu>
3643 2002-02-19 Fernando Perez <fperez@colorado.edu>
3639
3644
3640 * IPython/genutils.py (page_file): new function for paging files
3645 * IPython/genutils.py (page_file): new function for paging files
3641 in an OS-independent way. Also necessary for file viewing to work
3646 in an OS-independent way. Also necessary for file viewing to work
3642 well inside Emacs buffers.
3647 well inside Emacs buffers.
3643 (page): Added checks for being in an emacs buffer.
3648 (page): Added checks for being in an emacs buffer.
3644 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3649 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3645 same bug in iplib.
3650 same bug in iplib.
3646
3651
3647 2002-02-18 Fernando Perez <fperez@colorado.edu>
3652 2002-02-18 Fernando Perez <fperez@colorado.edu>
3648
3653
3649 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3654 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3650 of readline so that IPython can work inside an Emacs buffer.
3655 of readline so that IPython can work inside an Emacs buffer.
3651
3656
3652 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3657 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3653 method signatures (they weren't really bugs, but it looks cleaner
3658 method signatures (they weren't really bugs, but it looks cleaner
3654 and keeps PyChecker happy).
3659 and keeps PyChecker happy).
3655
3660
3656 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3661 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3657 for implementing various user-defined hooks. Currently only
3662 for implementing various user-defined hooks. Currently only
3658 display is done.
3663 display is done.
3659
3664
3660 * IPython/Prompts.py (CachedOutput._display): changed display
3665 * IPython/Prompts.py (CachedOutput._display): changed display
3661 functions so that they can be dynamically changed by users easily.
3666 functions so that they can be dynamically changed by users easily.
3662
3667
3663 * IPython/Extensions/numeric_formats.py (num_display): added an
3668 * IPython/Extensions/numeric_formats.py (num_display): added an
3664 extension for printing NumPy arrays in flexible manners. It
3669 extension for printing NumPy arrays in flexible manners. It
3665 doesn't do anything yet, but all the structure is in
3670 doesn't do anything yet, but all the structure is in
3666 place. Ultimately the plan is to implement output format control
3671 place. Ultimately the plan is to implement output format control
3667 like in Octave.
3672 like in Octave.
3668
3673
3669 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3674 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3670 methods are found at run-time by all the automatic machinery.
3675 methods are found at run-time by all the automatic machinery.
3671
3676
3672 2002-02-17 Fernando Perez <fperez@colorado.edu>
3677 2002-02-17 Fernando Perez <fperez@colorado.edu>
3673
3678
3674 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3679 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3675 whole file a little.
3680 whole file a little.
3676
3681
3677 * ToDo: closed this document. Now there's a new_design.lyx
3682 * ToDo: closed this document. Now there's a new_design.lyx
3678 document for all new ideas. Added making a pdf of it for the
3683 document for all new ideas. Added making a pdf of it for the
3679 end-user distro.
3684 end-user distro.
3680
3685
3681 * IPython/Logger.py (Logger.switch_log): Created this to replace
3686 * IPython/Logger.py (Logger.switch_log): Created this to replace
3682 logon() and logoff(). It also fixes a nasty crash reported by
3687 logon() and logoff(). It also fixes a nasty crash reported by
3683 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3688 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3684
3689
3685 * IPython/iplib.py (complete): got auto-completion to work with
3690 * IPython/iplib.py (complete): got auto-completion to work with
3686 automagic (I had wanted this for a long time).
3691 automagic (I had wanted this for a long time).
3687
3692
3688 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3693 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3689 to @file, since file() is now a builtin and clashes with automagic
3694 to @file, since file() is now a builtin and clashes with automagic
3690 for @file.
3695 for @file.
3691
3696
3692 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3697 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3693 of this was previously in iplib, which had grown to more than 2000
3698 of this was previously in iplib, which had grown to more than 2000
3694 lines, way too long. No new functionality, but it makes managing
3699 lines, way too long. No new functionality, but it makes managing
3695 the code a bit easier.
3700 the code a bit easier.
3696
3701
3697 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3702 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3698 information to crash reports.
3703 information to crash reports.
3699
3704
3700 2002-02-12 Fernando Perez <fperez@colorado.edu>
3705 2002-02-12 Fernando Perez <fperez@colorado.edu>
3701
3706
3702 * Released 0.2.5.
3707 * Released 0.2.5.
3703
3708
3704 2002-02-11 Fernando Perez <fperez@colorado.edu>
3709 2002-02-11 Fernando Perez <fperez@colorado.edu>
3705
3710
3706 * Wrote a relatively complete Windows installer. It puts
3711 * Wrote a relatively complete Windows installer. It puts
3707 everything in place, creates Start Menu entries and fixes the
3712 everything in place, creates Start Menu entries and fixes the
3708 color issues. Nothing fancy, but it works.
3713 color issues. Nothing fancy, but it works.
3709
3714
3710 2002-02-10 Fernando Perez <fperez@colorado.edu>
3715 2002-02-10 Fernando Perez <fperez@colorado.edu>
3711
3716
3712 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3717 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3713 os.path.expanduser() call so that we can type @run ~/myfile.py and
3718 os.path.expanduser() call so that we can type @run ~/myfile.py and
3714 have thigs work as expected.
3719 have thigs work as expected.
3715
3720
3716 * IPython/genutils.py (page): fixed exception handling so things
3721 * IPython/genutils.py (page): fixed exception handling so things
3717 work both in Unix and Windows correctly. Quitting a pager triggers
3722 work both in Unix and Windows correctly. Quitting a pager triggers
3718 an IOError/broken pipe in Unix, and in windows not finding a pager
3723 an IOError/broken pipe in Unix, and in windows not finding a pager
3719 is also an IOError, so I had to actually look at the return value
3724 is also an IOError, so I had to actually look at the return value
3720 of the exception, not just the exception itself. Should be ok now.
3725 of the exception, not just the exception itself. Should be ok now.
3721
3726
3722 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3727 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3723 modified to allow case-insensitive color scheme changes.
3728 modified to allow case-insensitive color scheme changes.
3724
3729
3725 2002-02-09 Fernando Perez <fperez@colorado.edu>
3730 2002-02-09 Fernando Perez <fperez@colorado.edu>
3726
3731
3727 * IPython/genutils.py (native_line_ends): new function to leave
3732 * IPython/genutils.py (native_line_ends): new function to leave
3728 user config files with os-native line-endings.
3733 user config files with os-native line-endings.
3729
3734
3730 * README and manual updates.
3735 * README and manual updates.
3731
3736
3732 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3737 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3733 instead of StringType to catch Unicode strings.
3738 instead of StringType to catch Unicode strings.
3734
3739
3735 * IPython/genutils.py (filefind): fixed bug for paths with
3740 * IPython/genutils.py (filefind): fixed bug for paths with
3736 embedded spaces (very common in Windows).
3741 embedded spaces (very common in Windows).
3737
3742
3738 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3743 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3739 files under Windows, so that they get automatically associated
3744 files under Windows, so that they get automatically associated
3740 with a text editor. Windows makes it a pain to handle
3745 with a text editor. Windows makes it a pain to handle
3741 extension-less files.
3746 extension-less files.
3742
3747
3743 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3748 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3744 warning about readline only occur for Posix. In Windows there's no
3749 warning about readline only occur for Posix. In Windows there's no
3745 way to get readline, so why bother with the warning.
3750 way to get readline, so why bother with the warning.
3746
3751
3747 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3752 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3748 for __str__ instead of dir(self), since dir() changed in 2.2.
3753 for __str__ instead of dir(self), since dir() changed in 2.2.
3749
3754
3750 * Ported to Windows! Tested on XP, I suspect it should work fine
3755 * Ported to Windows! Tested on XP, I suspect it should work fine
3751 on NT/2000, but I don't think it will work on 98 et al. That
3756 on NT/2000, but I don't think it will work on 98 et al. That
3752 series of Windows is such a piece of junk anyway that I won't try
3757 series of Windows is such a piece of junk anyway that I won't try
3753 porting it there. The XP port was straightforward, showed a few
3758 porting it there. The XP port was straightforward, showed a few
3754 bugs here and there (fixed all), in particular some string
3759 bugs here and there (fixed all), in particular some string
3755 handling stuff which required considering Unicode strings (which
3760 handling stuff which required considering Unicode strings (which
3756 Windows uses). This is good, but hasn't been too tested :) No
3761 Windows uses). This is good, but hasn't been too tested :) No
3757 fancy installer yet, I'll put a note in the manual so people at
3762 fancy installer yet, I'll put a note in the manual so people at
3758 least make manually a shortcut.
3763 least make manually a shortcut.
3759
3764
3760 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3765 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3761 into a single one, "colors". This now controls both prompt and
3766 into a single one, "colors". This now controls both prompt and
3762 exception color schemes, and can be changed both at startup
3767 exception color schemes, and can be changed both at startup
3763 (either via command-line switches or via ipythonrc files) and at
3768 (either via command-line switches or via ipythonrc files) and at
3764 runtime, with @colors.
3769 runtime, with @colors.
3765 (Magic.magic_run): renamed @prun to @run and removed the old
3770 (Magic.magic_run): renamed @prun to @run and removed the old
3766 @run. The two were too similar to warrant keeping both.
3771 @run. The two were too similar to warrant keeping both.
3767
3772
3768 2002-02-03 Fernando Perez <fperez@colorado.edu>
3773 2002-02-03 Fernando Perez <fperez@colorado.edu>
3769
3774
3770 * IPython/iplib.py (install_first_time): Added comment on how to
3775 * IPython/iplib.py (install_first_time): Added comment on how to
3771 configure the color options for first-time users. Put a <return>
3776 configure the color options for first-time users. Put a <return>
3772 request at the end so that small-terminal users get a chance to
3777 request at the end so that small-terminal users get a chance to
3773 read the startup info.
3778 read the startup info.
3774
3779
3775 2002-01-23 Fernando Perez <fperez@colorado.edu>
3780 2002-01-23 Fernando Perez <fperez@colorado.edu>
3776
3781
3777 * IPython/iplib.py (CachedOutput.update): Changed output memory
3782 * IPython/iplib.py (CachedOutput.update): Changed output memory
3778 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3783 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3779 input history we still use _i. Did this b/c these variable are
3784 input history we still use _i. Did this b/c these variable are
3780 very commonly used in interactive work, so the less we need to
3785 very commonly used in interactive work, so the less we need to
3781 type the better off we are.
3786 type the better off we are.
3782 (Magic.magic_prun): updated @prun to better handle the namespaces
3787 (Magic.magic_prun): updated @prun to better handle the namespaces
3783 the file will run in, including a fix for __name__ not being set
3788 the file will run in, including a fix for __name__ not being set
3784 before.
3789 before.
3785
3790
3786 2002-01-20 Fernando Perez <fperez@colorado.edu>
3791 2002-01-20 Fernando Perez <fperez@colorado.edu>
3787
3792
3788 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3793 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3789 extra garbage for Python 2.2. Need to look more carefully into
3794 extra garbage for Python 2.2. Need to look more carefully into
3790 this later.
3795 this later.
3791
3796
3792 2002-01-19 Fernando Perez <fperez@colorado.edu>
3797 2002-01-19 Fernando Perez <fperez@colorado.edu>
3793
3798
3794 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3799 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3795 display SyntaxError exceptions properly formatted when they occur
3800 display SyntaxError exceptions properly formatted when they occur
3796 (they can be triggered by imported code).
3801 (they can be triggered by imported code).
3797
3802
3798 2002-01-18 Fernando Perez <fperez@colorado.edu>
3803 2002-01-18 Fernando Perez <fperez@colorado.edu>
3799
3804
3800 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3805 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3801 SyntaxError exceptions are reported nicely formatted, instead of
3806 SyntaxError exceptions are reported nicely formatted, instead of
3802 spitting out only offset information as before.
3807 spitting out only offset information as before.
3803 (Magic.magic_prun): Added the @prun function for executing
3808 (Magic.magic_prun): Added the @prun function for executing
3804 programs with command line args inside IPython.
3809 programs with command line args inside IPython.
3805
3810
3806 2002-01-16 Fernando Perez <fperez@colorado.edu>
3811 2002-01-16 Fernando Perez <fperez@colorado.edu>
3807
3812
3808 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3813 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3809 to *not* include the last item given in a range. This brings their
3814 to *not* include the last item given in a range. This brings their
3810 behavior in line with Python's slicing:
3815 behavior in line with Python's slicing:
3811 a[n1:n2] -> a[n1]...a[n2-1]
3816 a[n1:n2] -> a[n1]...a[n2-1]
3812 It may be a bit less convenient, but I prefer to stick to Python's
3817 It may be a bit less convenient, but I prefer to stick to Python's
3813 conventions *everywhere*, so users never have to wonder.
3818 conventions *everywhere*, so users never have to wonder.
3814 (Magic.magic_macro): Added @macro function to ease the creation of
3819 (Magic.magic_macro): Added @macro function to ease the creation of
3815 macros.
3820 macros.
3816
3821
3817 2002-01-05 Fernando Perez <fperez@colorado.edu>
3822 2002-01-05 Fernando Perez <fperez@colorado.edu>
3818
3823
3819 * Released 0.2.4.
3824 * Released 0.2.4.
3820
3825
3821 * IPython/iplib.py (Magic.magic_pdef):
3826 * IPython/iplib.py (Magic.magic_pdef):
3822 (InteractiveShell.safe_execfile): report magic lines and error
3827 (InteractiveShell.safe_execfile): report magic lines and error
3823 lines without line numbers so one can easily copy/paste them for
3828 lines without line numbers so one can easily copy/paste them for
3824 re-execution.
3829 re-execution.
3825
3830
3826 * Updated manual with recent changes.
3831 * Updated manual with recent changes.
3827
3832
3828 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3833 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3829 docstring printing when class? is called. Very handy for knowing
3834 docstring printing when class? is called. Very handy for knowing
3830 how to create class instances (as long as __init__ is well
3835 how to create class instances (as long as __init__ is well
3831 documented, of course :)
3836 documented, of course :)
3832 (Magic.magic_doc): print both class and constructor docstrings.
3837 (Magic.magic_doc): print both class and constructor docstrings.
3833 (Magic.magic_pdef): give constructor info if passed a class and
3838 (Magic.magic_pdef): give constructor info if passed a class and
3834 __call__ info for callable object instances.
3839 __call__ info for callable object instances.
3835
3840
3836 2002-01-04 Fernando Perez <fperez@colorado.edu>
3841 2002-01-04 Fernando Perez <fperez@colorado.edu>
3837
3842
3838 * Made deep_reload() off by default. It doesn't always work
3843 * Made deep_reload() off by default. It doesn't always work
3839 exactly as intended, so it's probably safer to have it off. It's
3844 exactly as intended, so it's probably safer to have it off. It's
3840 still available as dreload() anyway, so nothing is lost.
3845 still available as dreload() anyway, so nothing is lost.
3841
3846
3842 2002-01-02 Fernando Perez <fperez@colorado.edu>
3847 2002-01-02 Fernando Perez <fperez@colorado.edu>
3843
3848
3844 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3849 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3845 so I wanted an updated release).
3850 so I wanted an updated release).
3846
3851
3847 2001-12-27 Fernando Perez <fperez@colorado.edu>
3852 2001-12-27 Fernando Perez <fperez@colorado.edu>
3848
3853
3849 * IPython/iplib.py (InteractiveShell.interact): Added the original
3854 * IPython/iplib.py (InteractiveShell.interact): Added the original
3850 code from 'code.py' for this module in order to change the
3855 code from 'code.py' for this module in order to change the
3851 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3856 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3852 the history cache would break when the user hit Ctrl-C, and
3857 the history cache would break when the user hit Ctrl-C, and
3853 interact() offers no way to add any hooks to it.
3858 interact() offers no way to add any hooks to it.
3854
3859
3855 2001-12-23 Fernando Perez <fperez@colorado.edu>
3860 2001-12-23 Fernando Perez <fperez@colorado.edu>
3856
3861
3857 * setup.py: added check for 'MANIFEST' before trying to remove
3862 * setup.py: added check for 'MANIFEST' before trying to remove
3858 it. Thanks to Sean Reifschneider.
3863 it. Thanks to Sean Reifschneider.
3859
3864
3860 2001-12-22 Fernando Perez <fperez@colorado.edu>
3865 2001-12-22 Fernando Perez <fperez@colorado.edu>
3861
3866
3862 * Released 0.2.2.
3867 * Released 0.2.2.
3863
3868
3864 * Finished (reasonably) writing the manual. Later will add the
3869 * Finished (reasonably) writing the manual. Later will add the
3865 python-standard navigation stylesheets, but for the time being
3870 python-standard navigation stylesheets, but for the time being
3866 it's fairly complete. Distribution will include html and pdf
3871 it's fairly complete. Distribution will include html and pdf
3867 versions.
3872 versions.
3868
3873
3869 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3874 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3870 (MayaVi author).
3875 (MayaVi author).
3871
3876
3872 2001-12-21 Fernando Perez <fperez@colorado.edu>
3877 2001-12-21 Fernando Perez <fperez@colorado.edu>
3873
3878
3874 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3879 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3875 good public release, I think (with the manual and the distutils
3880 good public release, I think (with the manual and the distutils
3876 installer). The manual can use some work, but that can go
3881 installer). The manual can use some work, but that can go
3877 slowly. Otherwise I think it's quite nice for end users. Next
3882 slowly. Otherwise I think it's quite nice for end users. Next
3878 summer, rewrite the guts of it...
3883 summer, rewrite the guts of it...
3879
3884
3880 * Changed format of ipythonrc files to use whitespace as the
3885 * Changed format of ipythonrc files to use whitespace as the
3881 separator instead of an explicit '='. Cleaner.
3886 separator instead of an explicit '='. Cleaner.
3882
3887
3883 2001-12-20 Fernando Perez <fperez@colorado.edu>
3888 2001-12-20 Fernando Perez <fperez@colorado.edu>
3884
3889
3885 * Started a manual in LyX. For now it's just a quick merge of the
3890 * Started a manual in LyX. For now it's just a quick merge of the
3886 various internal docstrings and READMEs. Later it may grow into a
3891 various internal docstrings and READMEs. Later it may grow into a
3887 nice, full-blown manual.
3892 nice, full-blown manual.
3888
3893
3889 * Set up a distutils based installer. Installation should now be
3894 * Set up a distutils based installer. Installation should now be
3890 trivially simple for end-users.
3895 trivially simple for end-users.
3891
3896
3892 2001-12-11 Fernando Perez <fperez@colorado.edu>
3897 2001-12-11 Fernando Perez <fperez@colorado.edu>
3893
3898
3894 * Released 0.2.0. First public release, announced it at
3899 * Released 0.2.0. First public release, announced it at
3895 comp.lang.python. From now on, just bugfixes...
3900 comp.lang.python. From now on, just bugfixes...
3896
3901
3897 * Went through all the files, set copyright/license notices and
3902 * Went through all the files, set copyright/license notices and
3898 cleaned up things. Ready for release.
3903 cleaned up things. Ready for release.
3899
3904
3900 2001-12-10 Fernando Perez <fperez@colorado.edu>
3905 2001-12-10 Fernando Perez <fperez@colorado.edu>
3901
3906
3902 * Changed the first-time installer not to use tarfiles. It's more
3907 * Changed the first-time installer not to use tarfiles. It's more
3903 robust now and less unix-dependent. Also makes it easier for
3908 robust now and less unix-dependent. Also makes it easier for
3904 people to later upgrade versions.
3909 people to later upgrade versions.
3905
3910
3906 * Changed @exit to @abort to reflect the fact that it's pretty
3911 * Changed @exit to @abort to reflect the fact that it's pretty
3907 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3912 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3908 becomes significant only when IPyhton is embedded: in that case,
3913 becomes significant only when IPyhton is embedded: in that case,
3909 C-D closes IPython only, but @abort kills the enclosing program
3914 C-D closes IPython only, but @abort kills the enclosing program
3910 too (unless it had called IPython inside a try catching
3915 too (unless it had called IPython inside a try catching
3911 SystemExit).
3916 SystemExit).
3912
3917
3913 * Created Shell module which exposes the actuall IPython Shell
3918 * Created Shell module which exposes the actuall IPython Shell
3914 classes, currently the normal and the embeddable one. This at
3919 classes, currently the normal and the embeddable one. This at
3915 least offers a stable interface we won't need to change when
3920 least offers a stable interface we won't need to change when
3916 (later) the internals are rewritten. That rewrite will be confined
3921 (later) the internals are rewritten. That rewrite will be confined
3917 to iplib and ipmaker, but the Shell interface should remain as is.
3922 to iplib and ipmaker, but the Shell interface should remain as is.
3918
3923
3919 * Added embed module which offers an embeddable IPShell object,
3924 * Added embed module which offers an embeddable IPShell object,
3920 useful to fire up IPython *inside* a running program. Great for
3925 useful to fire up IPython *inside* a running program. Great for
3921 debugging or dynamical data analysis.
3926 debugging or dynamical data analysis.
3922
3927
3923 2001-12-08 Fernando Perez <fperez@colorado.edu>
3928 2001-12-08 Fernando Perez <fperez@colorado.edu>
3924
3929
3925 * Fixed small bug preventing seeing info from methods of defined
3930 * Fixed small bug preventing seeing info from methods of defined
3926 objects (incorrect namespace in _ofind()).
3931 objects (incorrect namespace in _ofind()).
3927
3932
3928 * Documentation cleanup. Moved the main usage docstrings to a
3933 * Documentation cleanup. Moved the main usage docstrings to a
3929 separate file, usage.py (cleaner to maintain, and hopefully in the
3934 separate file, usage.py (cleaner to maintain, and hopefully in the
3930 future some perlpod-like way of producing interactive, man and
3935 future some perlpod-like way of producing interactive, man and
3931 html docs out of it will be found).
3936 html docs out of it will be found).
3932
3937
3933 * Added @profile to see your profile at any time.
3938 * Added @profile to see your profile at any time.
3934
3939
3935 * Added @p as an alias for 'print'. It's especially convenient if
3940 * Added @p as an alias for 'print'. It's especially convenient if
3936 using automagic ('p x' prints x).
3941 using automagic ('p x' prints x).
3937
3942
3938 * Small cleanups and fixes after a pychecker run.
3943 * Small cleanups and fixes after a pychecker run.
3939
3944
3940 * Changed the @cd command to handle @cd - and @cd -<n> for
3945 * Changed the @cd command to handle @cd - and @cd -<n> for
3941 visiting any directory in _dh.
3946 visiting any directory in _dh.
3942
3947
3943 * Introduced _dh, a history of visited directories. @dhist prints
3948 * Introduced _dh, a history of visited directories. @dhist prints
3944 it out with numbers.
3949 it out with numbers.
3945
3950
3946 2001-12-07 Fernando Perez <fperez@colorado.edu>
3951 2001-12-07 Fernando Perez <fperez@colorado.edu>
3947
3952
3948 * Released 0.1.22
3953 * Released 0.1.22
3949
3954
3950 * Made initialization a bit more robust against invalid color
3955 * Made initialization a bit more robust against invalid color
3951 options in user input (exit, not traceback-crash).
3956 options in user input (exit, not traceback-crash).
3952
3957
3953 * Changed the bug crash reporter to write the report only in the
3958 * Changed the bug crash reporter to write the report only in the
3954 user's .ipython directory. That way IPython won't litter people's
3959 user's .ipython directory. That way IPython won't litter people's
3955 hard disks with crash files all over the place. Also print on
3960 hard disks with crash files all over the place. Also print on
3956 screen the necessary mail command.
3961 screen the necessary mail command.
3957
3962
3958 * With the new ultraTB, implemented LightBG color scheme for light
3963 * With the new ultraTB, implemented LightBG color scheme for light
3959 background terminals. A lot of people like white backgrounds, so I
3964 background terminals. A lot of people like white backgrounds, so I
3960 guess we should at least give them something readable.
3965 guess we should at least give them something readable.
3961
3966
3962 2001-12-06 Fernando Perez <fperez@colorado.edu>
3967 2001-12-06 Fernando Perez <fperez@colorado.edu>
3963
3968
3964 * Modified the structure of ultraTB. Now there's a proper class
3969 * Modified the structure of ultraTB. Now there's a proper class
3965 for tables of color schemes which allow adding schemes easily and
3970 for tables of color schemes which allow adding schemes easily and
3966 switching the active scheme without creating a new instance every
3971 switching the active scheme without creating a new instance every
3967 time (which was ridiculous). The syntax for creating new schemes
3972 time (which was ridiculous). The syntax for creating new schemes
3968 is also cleaner. I think ultraTB is finally done, with a clean
3973 is also cleaner. I think ultraTB is finally done, with a clean
3969 class structure. Names are also much cleaner (now there's proper
3974 class structure. Names are also much cleaner (now there's proper
3970 color tables, no need for every variable to also have 'color' in
3975 color tables, no need for every variable to also have 'color' in
3971 its name).
3976 its name).
3972
3977
3973 * Broke down genutils into separate files. Now genutils only
3978 * Broke down genutils into separate files. Now genutils only
3974 contains utility functions, and classes have been moved to their
3979 contains utility functions, and classes have been moved to their
3975 own files (they had enough independent functionality to warrant
3980 own files (they had enough independent functionality to warrant
3976 it): ConfigLoader, OutputTrap, Struct.
3981 it): ConfigLoader, OutputTrap, Struct.
3977
3982
3978 2001-12-05 Fernando Perez <fperez@colorado.edu>
3983 2001-12-05 Fernando Perez <fperez@colorado.edu>
3979
3984
3980 * IPython turns 21! Released version 0.1.21, as a candidate for
3985 * IPython turns 21! Released version 0.1.21, as a candidate for
3981 public consumption. If all goes well, release in a few days.
3986 public consumption. If all goes well, release in a few days.
3982
3987
3983 * Fixed path bug (files in Extensions/ directory wouldn't be found
3988 * Fixed path bug (files in Extensions/ directory wouldn't be found
3984 unless IPython/ was explicitly in sys.path).
3989 unless IPython/ was explicitly in sys.path).
3985
3990
3986 * Extended the FlexCompleter class as MagicCompleter to allow
3991 * Extended the FlexCompleter class as MagicCompleter to allow
3987 completion of @-starting lines.
3992 completion of @-starting lines.
3988
3993
3989 * Created __release__.py file as a central repository for release
3994 * Created __release__.py file as a central repository for release
3990 info that other files can read from.
3995 info that other files can read from.
3991
3996
3992 * Fixed small bug in logging: when logging was turned on in
3997 * Fixed small bug in logging: when logging was turned on in
3993 mid-session, old lines with special meanings (!@?) were being
3998 mid-session, old lines with special meanings (!@?) were being
3994 logged without the prepended comment, which is necessary since
3999 logged without the prepended comment, which is necessary since
3995 they are not truly valid python syntax. This should make session
4000 they are not truly valid python syntax. This should make session
3996 restores produce less errors.
4001 restores produce less errors.
3997
4002
3998 * The namespace cleanup forced me to make a FlexCompleter class
4003 * The namespace cleanup forced me to make a FlexCompleter class
3999 which is nothing but a ripoff of rlcompleter, but with selectable
4004 which is nothing but a ripoff of rlcompleter, but with selectable
4000 namespace (rlcompleter only works in __main__.__dict__). I'll try
4005 namespace (rlcompleter only works in __main__.__dict__). I'll try
4001 to submit a note to the authors to see if this change can be
4006 to submit a note to the authors to see if this change can be
4002 incorporated in future rlcompleter releases (Dec.6: done)
4007 incorporated in future rlcompleter releases (Dec.6: done)
4003
4008
4004 * More fixes to namespace handling. It was a mess! Now all
4009 * More fixes to namespace handling. It was a mess! Now all
4005 explicit references to __main__.__dict__ are gone (except when
4010 explicit references to __main__.__dict__ are gone (except when
4006 really needed) and everything is handled through the namespace
4011 really needed) and everything is handled through the namespace
4007 dicts in the IPython instance. We seem to be getting somewhere
4012 dicts in the IPython instance. We seem to be getting somewhere
4008 with this, finally...
4013 with this, finally...
4009
4014
4010 * Small documentation updates.
4015 * Small documentation updates.
4011
4016
4012 * Created the Extensions directory under IPython (with an
4017 * Created the Extensions directory under IPython (with an
4013 __init__.py). Put the PhysicalQ stuff there. This directory should
4018 __init__.py). Put the PhysicalQ stuff there. This directory should
4014 be used for all special-purpose extensions.
4019 be used for all special-purpose extensions.
4015
4020
4016 * File renaming:
4021 * File renaming:
4017 ipythonlib --> ipmaker
4022 ipythonlib --> ipmaker
4018 ipplib --> iplib
4023 ipplib --> iplib
4019 This makes a bit more sense in terms of what these files actually do.
4024 This makes a bit more sense in terms of what these files actually do.
4020
4025
4021 * Moved all the classes and functions in ipythonlib to ipplib, so
4026 * Moved all the classes and functions in ipythonlib to ipplib, so
4022 now ipythonlib only has make_IPython(). This will ease up its
4027 now ipythonlib only has make_IPython(). This will ease up its
4023 splitting in smaller functional chunks later.
4028 splitting in smaller functional chunks later.
4024
4029
4025 * Cleaned up (done, I think) output of @whos. Better column
4030 * Cleaned up (done, I think) output of @whos. Better column
4026 formatting, and now shows str(var) for as much as it can, which is
4031 formatting, and now shows str(var) for as much as it can, which is
4027 typically what one gets with a 'print var'.
4032 typically what one gets with a 'print var'.
4028
4033
4029 2001-12-04 Fernando Perez <fperez@colorado.edu>
4034 2001-12-04 Fernando Perez <fperez@colorado.edu>
4030
4035
4031 * Fixed namespace problems. Now builtin/IPyhton/user names get
4036 * Fixed namespace problems. Now builtin/IPyhton/user names get
4032 properly reported in their namespace. Internal namespace handling
4037 properly reported in their namespace. Internal namespace handling
4033 is finally getting decent (not perfect yet, but much better than
4038 is finally getting decent (not perfect yet, but much better than
4034 the ad-hoc mess we had).
4039 the ad-hoc mess we had).
4035
4040
4036 * Removed -exit option. If people just want to run a python
4041 * Removed -exit option. If people just want to run a python
4037 script, that's what the normal interpreter is for. Less
4042 script, that's what the normal interpreter is for. Less
4038 unnecessary options, less chances for bugs.
4043 unnecessary options, less chances for bugs.
4039
4044
4040 * Added a crash handler which generates a complete post-mortem if
4045 * Added a crash handler which generates a complete post-mortem if
4041 IPython crashes. This will help a lot in tracking bugs down the
4046 IPython crashes. This will help a lot in tracking bugs down the
4042 road.
4047 road.
4043
4048
4044 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4049 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4045 which were boud to functions being reassigned would bypass the
4050 which were boud to functions being reassigned would bypass the
4046 logger, breaking the sync of _il with the prompt counter. This
4051 logger, breaking the sync of _il with the prompt counter. This
4047 would then crash IPython later when a new line was logged.
4052 would then crash IPython later when a new line was logged.
4048
4053
4049 2001-12-02 Fernando Perez <fperez@colorado.edu>
4054 2001-12-02 Fernando Perez <fperez@colorado.edu>
4050
4055
4051 * Made IPython a package. This means people don't have to clutter
4056 * Made IPython a package. This means people don't have to clutter
4052 their sys.path with yet another directory. Changed the INSTALL
4057 their sys.path with yet another directory. Changed the INSTALL
4053 file accordingly.
4058 file accordingly.
4054
4059
4055 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4060 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4056 sorts its output (so @who shows it sorted) and @whos formats the
4061 sorts its output (so @who shows it sorted) and @whos formats the
4057 table according to the width of the first column. Nicer, easier to
4062 table according to the width of the first column. Nicer, easier to
4058 read. Todo: write a generic table_format() which takes a list of
4063 read. Todo: write a generic table_format() which takes a list of
4059 lists and prints it nicely formatted, with optional row/column
4064 lists and prints it nicely formatted, with optional row/column
4060 separators and proper padding and justification.
4065 separators and proper padding and justification.
4061
4066
4062 * Released 0.1.20
4067 * Released 0.1.20
4063
4068
4064 * Fixed bug in @log which would reverse the inputcache list (a
4069 * Fixed bug in @log which would reverse the inputcache list (a
4065 copy operation was missing).
4070 copy operation was missing).
4066
4071
4067 * Code cleanup. @config was changed to use page(). Better, since
4072 * Code cleanup. @config was changed to use page(). Better, since
4068 its output is always quite long.
4073 its output is always quite long.
4069
4074
4070 * Itpl is back as a dependency. I was having too many problems
4075 * Itpl is back as a dependency. I was having too many problems
4071 getting the parametric aliases to work reliably, and it's just
4076 getting the parametric aliases to work reliably, and it's just
4072 easier to code weird string operations with it than playing %()s
4077 easier to code weird string operations with it than playing %()s
4073 games. It's only ~6k, so I don't think it's too big a deal.
4078 games. It's only ~6k, so I don't think it's too big a deal.
4074
4079
4075 * Found (and fixed) a very nasty bug with history. !lines weren't
4080 * Found (and fixed) a very nasty bug with history. !lines weren't
4076 getting cached, and the out of sync caches would crash
4081 getting cached, and the out of sync caches would crash
4077 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4082 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4078 division of labor a bit better. Bug fixed, cleaner structure.
4083 division of labor a bit better. Bug fixed, cleaner structure.
4079
4084
4080 2001-12-01 Fernando Perez <fperez@colorado.edu>
4085 2001-12-01 Fernando Perez <fperez@colorado.edu>
4081
4086
4082 * Released 0.1.19
4087 * Released 0.1.19
4083
4088
4084 * Added option -n to @hist to prevent line number printing. Much
4089 * Added option -n to @hist to prevent line number printing. Much
4085 easier to copy/paste code this way.
4090 easier to copy/paste code this way.
4086
4091
4087 * Created global _il to hold the input list. Allows easy
4092 * Created global _il to hold the input list. Allows easy
4088 re-execution of blocks of code by slicing it (inspired by Janko's
4093 re-execution of blocks of code by slicing it (inspired by Janko's
4089 comment on 'macros').
4094 comment on 'macros').
4090
4095
4091 * Small fixes and doc updates.
4096 * Small fixes and doc updates.
4092
4097
4093 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4098 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4094 much too fragile with automagic. Handles properly multi-line
4099 much too fragile with automagic. Handles properly multi-line
4095 statements and takes parameters.
4100 statements and takes parameters.
4096
4101
4097 2001-11-30 Fernando Perez <fperez@colorado.edu>
4102 2001-11-30 Fernando Perez <fperez@colorado.edu>
4098
4103
4099 * Version 0.1.18 released.
4104 * Version 0.1.18 released.
4100
4105
4101 * Fixed nasty namespace bug in initial module imports.
4106 * Fixed nasty namespace bug in initial module imports.
4102
4107
4103 * Added copyright/license notes to all code files (except
4108 * Added copyright/license notes to all code files (except
4104 DPyGetOpt). For the time being, LGPL. That could change.
4109 DPyGetOpt). For the time being, LGPL. That could change.
4105
4110
4106 * Rewrote a much nicer README, updated INSTALL, cleaned up
4111 * Rewrote a much nicer README, updated INSTALL, cleaned up
4107 ipythonrc-* samples.
4112 ipythonrc-* samples.
4108
4113
4109 * Overall code/documentation cleanup. Basically ready for
4114 * Overall code/documentation cleanup. Basically ready for
4110 release. Only remaining thing: licence decision (LGPL?).
4115 release. Only remaining thing: licence decision (LGPL?).
4111
4116
4112 * Converted load_config to a class, ConfigLoader. Now recursion
4117 * Converted load_config to a class, ConfigLoader. Now recursion
4113 control is better organized. Doesn't include the same file twice.
4118 control is better organized. Doesn't include the same file twice.
4114
4119
4115 2001-11-29 Fernando Perez <fperez@colorado.edu>
4120 2001-11-29 Fernando Perez <fperez@colorado.edu>
4116
4121
4117 * Got input history working. Changed output history variables from
4122 * Got input history working. Changed output history variables from
4118 _p to _o so that _i is for input and _o for output. Just cleaner
4123 _p to _o so that _i is for input and _o for output. Just cleaner
4119 convention.
4124 convention.
4120
4125
4121 * Implemented parametric aliases. This pretty much allows the
4126 * Implemented parametric aliases. This pretty much allows the
4122 alias system to offer full-blown shell convenience, I think.
4127 alias system to offer full-blown shell convenience, I think.
4123
4128
4124 * Version 0.1.17 released, 0.1.18 opened.
4129 * Version 0.1.17 released, 0.1.18 opened.
4125
4130
4126 * dot_ipython/ipythonrc (alias): added documentation.
4131 * dot_ipython/ipythonrc (alias): added documentation.
4127 (xcolor): Fixed small bug (xcolors -> xcolor)
4132 (xcolor): Fixed small bug (xcolors -> xcolor)
4128
4133
4129 * Changed the alias system. Now alias is a magic command to define
4134 * Changed the alias system. Now alias is a magic command to define
4130 aliases just like the shell. Rationale: the builtin magics should
4135 aliases just like the shell. Rationale: the builtin magics should
4131 be there for things deeply connected to IPython's
4136 be there for things deeply connected to IPython's
4132 architecture. And this is a much lighter system for what I think
4137 architecture. And this is a much lighter system for what I think
4133 is the really important feature: allowing users to define quickly
4138 is the really important feature: allowing users to define quickly
4134 magics that will do shell things for them, so they can customize
4139 magics that will do shell things for them, so they can customize
4135 IPython easily to match their work habits. If someone is really
4140 IPython easily to match their work habits. If someone is really
4136 desperate to have another name for a builtin alias, they can
4141 desperate to have another name for a builtin alias, they can
4137 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4142 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4138 works.
4143 works.
4139
4144
4140 2001-11-28 Fernando Perez <fperez@colorado.edu>
4145 2001-11-28 Fernando Perez <fperez@colorado.edu>
4141
4146
4142 * Changed @file so that it opens the source file at the proper
4147 * Changed @file so that it opens the source file at the proper
4143 line. Since it uses less, if your EDITOR environment is
4148 line. Since it uses less, if your EDITOR environment is
4144 configured, typing v will immediately open your editor of choice
4149 configured, typing v will immediately open your editor of choice
4145 right at the line where the object is defined. Not as quick as
4150 right at the line where the object is defined. Not as quick as
4146 having a direct @edit command, but for all intents and purposes it
4151 having a direct @edit command, but for all intents and purposes it
4147 works. And I don't have to worry about writing @edit to deal with
4152 works. And I don't have to worry about writing @edit to deal with
4148 all the editors, less does that.
4153 all the editors, less does that.
4149
4154
4150 * Version 0.1.16 released, 0.1.17 opened.
4155 * Version 0.1.16 released, 0.1.17 opened.
4151
4156
4152 * Fixed some nasty bugs in the page/page_dumb combo that could
4157 * Fixed some nasty bugs in the page/page_dumb combo that could
4153 crash IPython.
4158 crash IPython.
4154
4159
4155 2001-11-27 Fernando Perez <fperez@colorado.edu>
4160 2001-11-27 Fernando Perez <fperez@colorado.edu>
4156
4161
4157 * Version 0.1.15 released, 0.1.16 opened.
4162 * Version 0.1.15 released, 0.1.16 opened.
4158
4163
4159 * Finally got ? and ?? to work for undefined things: now it's
4164 * Finally got ? and ?? to work for undefined things: now it's
4160 possible to type {}.get? and get information about the get method
4165 possible to type {}.get? and get information about the get method
4161 of dicts, or os.path? even if only os is defined (so technically
4166 of dicts, or os.path? even if only os is defined (so technically
4162 os.path isn't). Works at any level. For example, after import os,
4167 os.path isn't). Works at any level. For example, after import os,
4163 os?, os.path?, os.path.abspath? all work. This is great, took some
4168 os?, os.path?, os.path.abspath? all work. This is great, took some
4164 work in _ofind.
4169 work in _ofind.
4165
4170
4166 * Fixed more bugs with logging. The sanest way to do it was to add
4171 * Fixed more bugs with logging. The sanest way to do it was to add
4167 to @log a 'mode' parameter. Killed two in one shot (this mode
4172 to @log a 'mode' parameter. Killed two in one shot (this mode
4168 option was a request of Janko's). I think it's finally clean
4173 option was a request of Janko's). I think it's finally clean
4169 (famous last words).
4174 (famous last words).
4170
4175
4171 * Added a page_dumb() pager which does a decent job of paging on
4176 * Added a page_dumb() pager which does a decent job of paging on
4172 screen, if better things (like less) aren't available. One less
4177 screen, if better things (like less) aren't available. One less
4173 unix dependency (someday maybe somebody will port this to
4178 unix dependency (someday maybe somebody will port this to
4174 windows).
4179 windows).
4175
4180
4176 * Fixed problem in magic_log: would lock of logging out if log
4181 * Fixed problem in magic_log: would lock of logging out if log
4177 creation failed (because it would still think it had succeeded).
4182 creation failed (because it would still think it had succeeded).
4178
4183
4179 * Improved the page() function using curses to auto-detect screen
4184 * Improved the page() function using curses to auto-detect screen
4180 size. Now it can make a much better decision on whether to print
4185 size. Now it can make a much better decision on whether to print
4181 or page a string. Option screen_length was modified: a value 0
4186 or page a string. Option screen_length was modified: a value 0
4182 means auto-detect, and that's the default now.
4187 means auto-detect, and that's the default now.
4183
4188
4184 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4189 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4185 go out. I'll test it for a few days, then talk to Janko about
4190 go out. I'll test it for a few days, then talk to Janko about
4186 licences and announce it.
4191 licences and announce it.
4187
4192
4188 * Fixed the length of the auto-generated ---> prompt which appears
4193 * Fixed the length of the auto-generated ---> prompt which appears
4189 for auto-parens and auto-quotes. Getting this right isn't trivial,
4194 for auto-parens and auto-quotes. Getting this right isn't trivial,
4190 with all the color escapes, different prompt types and optional
4195 with all the color escapes, different prompt types and optional
4191 separators. But it seems to be working in all the combinations.
4196 separators. But it seems to be working in all the combinations.
4192
4197
4193 2001-11-26 Fernando Perez <fperez@colorado.edu>
4198 2001-11-26 Fernando Perez <fperez@colorado.edu>
4194
4199
4195 * Wrote a regexp filter to get option types from the option names
4200 * Wrote a regexp filter to get option types from the option names
4196 string. This eliminates the need to manually keep two duplicate
4201 string. This eliminates the need to manually keep two duplicate
4197 lists.
4202 lists.
4198
4203
4199 * Removed the unneeded check_option_names. Now options are handled
4204 * Removed the unneeded check_option_names. Now options are handled
4200 in a much saner manner and it's easy to visually check that things
4205 in a much saner manner and it's easy to visually check that things
4201 are ok.
4206 are ok.
4202
4207
4203 * Updated version numbers on all files I modified to carry a
4208 * Updated version numbers on all files I modified to carry a
4204 notice so Janko and Nathan have clear version markers.
4209 notice so Janko and Nathan have clear version markers.
4205
4210
4206 * Updated docstring for ultraTB with my changes. I should send
4211 * Updated docstring for ultraTB with my changes. I should send
4207 this to Nathan.
4212 this to Nathan.
4208
4213
4209 * Lots of small fixes. Ran everything through pychecker again.
4214 * Lots of small fixes. Ran everything through pychecker again.
4210
4215
4211 * Made loading of deep_reload an cmd line option. If it's not too
4216 * Made loading of deep_reload an cmd line option. If it's not too
4212 kosher, now people can just disable it. With -nodeep_reload it's
4217 kosher, now people can just disable it. With -nodeep_reload it's
4213 still available as dreload(), it just won't overwrite reload().
4218 still available as dreload(), it just won't overwrite reload().
4214
4219
4215 * Moved many options to the no| form (-opt and -noopt
4220 * Moved many options to the no| form (-opt and -noopt
4216 accepted). Cleaner.
4221 accepted). Cleaner.
4217
4222
4218 * Changed magic_log so that if called with no parameters, it uses
4223 * Changed magic_log so that if called with no parameters, it uses
4219 'rotate' mode. That way auto-generated logs aren't automatically
4224 'rotate' mode. That way auto-generated logs aren't automatically
4220 over-written. For normal logs, now a backup is made if it exists
4225 over-written. For normal logs, now a backup is made if it exists
4221 (only 1 level of backups). A new 'backup' mode was added to the
4226 (only 1 level of backups). A new 'backup' mode was added to the
4222 Logger class to support this. This was a request by Janko.
4227 Logger class to support this. This was a request by Janko.
4223
4228
4224 * Added @logoff/@logon to stop/restart an active log.
4229 * Added @logoff/@logon to stop/restart an active log.
4225
4230
4226 * Fixed a lot of bugs in log saving/replay. It was pretty
4231 * Fixed a lot of bugs in log saving/replay. It was pretty
4227 broken. Now special lines (!@,/) appear properly in the command
4232 broken. Now special lines (!@,/) appear properly in the command
4228 history after a log replay.
4233 history after a log replay.
4229
4234
4230 * Tried and failed to implement full session saving via pickle. My
4235 * Tried and failed to implement full session saving via pickle. My
4231 idea was to pickle __main__.__dict__, but modules can't be
4236 idea was to pickle __main__.__dict__, but modules can't be
4232 pickled. This would be a better alternative to replaying logs, but
4237 pickled. This would be a better alternative to replaying logs, but
4233 seems quite tricky to get to work. Changed -session to be called
4238 seems quite tricky to get to work. Changed -session to be called
4234 -logplay, which more accurately reflects what it does. And if we
4239 -logplay, which more accurately reflects what it does. And if we
4235 ever get real session saving working, -session is now available.
4240 ever get real session saving working, -session is now available.
4236
4241
4237 * Implemented color schemes for prompts also. As for tracebacks,
4242 * Implemented color schemes for prompts also. As for tracebacks,
4238 currently only NoColor and Linux are supported. But now the
4243 currently only NoColor and Linux are supported. But now the
4239 infrastructure is in place, based on a generic ColorScheme
4244 infrastructure is in place, based on a generic ColorScheme
4240 class. So writing and activating new schemes both for the prompts
4245 class. So writing and activating new schemes both for the prompts
4241 and the tracebacks should be straightforward.
4246 and the tracebacks should be straightforward.
4242
4247
4243 * Version 0.1.13 released, 0.1.14 opened.
4248 * Version 0.1.13 released, 0.1.14 opened.
4244
4249
4245 * Changed handling of options for output cache. Now counter is
4250 * Changed handling of options for output cache. Now counter is
4246 hardwired starting at 1 and one specifies the maximum number of
4251 hardwired starting at 1 and one specifies the maximum number of
4247 entries *in the outcache* (not the max prompt counter). This is
4252 entries *in the outcache* (not the max prompt counter). This is
4248 much better, since many statements won't increase the cache
4253 much better, since many statements won't increase the cache
4249 count. It also eliminated some confusing options, now there's only
4254 count. It also eliminated some confusing options, now there's only
4250 one: cache_size.
4255 one: cache_size.
4251
4256
4252 * Added 'alias' magic function and magic_alias option in the
4257 * Added 'alias' magic function and magic_alias option in the
4253 ipythonrc file. Now the user can easily define whatever names he
4258 ipythonrc file. Now the user can easily define whatever names he
4254 wants for the magic functions without having to play weird
4259 wants for the magic functions without having to play weird
4255 namespace games. This gives IPython a real shell-like feel.
4260 namespace games. This gives IPython a real shell-like feel.
4256
4261
4257 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4262 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4258 @ or not).
4263 @ or not).
4259
4264
4260 This was one of the last remaining 'visible' bugs (that I know
4265 This was one of the last remaining 'visible' bugs (that I know
4261 of). I think if I can clean up the session loading so it works
4266 of). I think if I can clean up the session loading so it works
4262 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4267 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4263 about licensing).
4268 about licensing).
4264
4269
4265 2001-11-25 Fernando Perez <fperez@colorado.edu>
4270 2001-11-25 Fernando Perez <fperez@colorado.edu>
4266
4271
4267 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4272 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4268 there's a cleaner distinction between what ? and ?? show.
4273 there's a cleaner distinction between what ? and ?? show.
4269
4274
4270 * Added screen_length option. Now the user can define his own
4275 * Added screen_length option. Now the user can define his own
4271 screen size for page() operations.
4276 screen size for page() operations.
4272
4277
4273 * Implemented magic shell-like functions with automatic code
4278 * Implemented magic shell-like functions with automatic code
4274 generation. Now adding another function is just a matter of adding
4279 generation. Now adding another function is just a matter of adding
4275 an entry to a dict, and the function is dynamically generated at
4280 an entry to a dict, and the function is dynamically generated at
4276 run-time. Python has some really cool features!
4281 run-time. Python has some really cool features!
4277
4282
4278 * Renamed many options to cleanup conventions a little. Now all
4283 * Renamed many options to cleanup conventions a little. Now all
4279 are lowercase, and only underscores where needed. Also in the code
4284 are lowercase, and only underscores where needed. Also in the code
4280 option name tables are clearer.
4285 option name tables are clearer.
4281
4286
4282 * Changed prompts a little. Now input is 'In [n]:' instead of
4287 * Changed prompts a little. Now input is 'In [n]:' instead of
4283 'In[n]:='. This allows it the numbers to be aligned with the
4288 'In[n]:='. This allows it the numbers to be aligned with the
4284 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4289 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4285 Python (it was a Mathematica thing). The '...' continuation prompt
4290 Python (it was a Mathematica thing). The '...' continuation prompt
4286 was also changed a little to align better.
4291 was also changed a little to align better.
4287
4292
4288 * Fixed bug when flushing output cache. Not all _p<n> variables
4293 * Fixed bug when flushing output cache. Not all _p<n> variables
4289 exist, so their deletion needs to be wrapped in a try:
4294 exist, so their deletion needs to be wrapped in a try:
4290
4295
4291 * Figured out how to properly use inspect.formatargspec() (it
4296 * Figured out how to properly use inspect.formatargspec() (it
4292 requires the args preceded by *). So I removed all the code from
4297 requires the args preceded by *). So I removed all the code from
4293 _get_pdef in Magic, which was just replicating that.
4298 _get_pdef in Magic, which was just replicating that.
4294
4299
4295 * Added test to prefilter to allow redefining magic function names
4300 * Added test to prefilter to allow redefining magic function names
4296 as variables. This is ok, since the @ form is always available,
4301 as variables. This is ok, since the @ form is always available,
4297 but whe should allow the user to define a variable called 'ls' if
4302 but whe should allow the user to define a variable called 'ls' if
4298 he needs it.
4303 he needs it.
4299
4304
4300 * Moved the ToDo information from README into a separate ToDo.
4305 * Moved the ToDo information from README into a separate ToDo.
4301
4306
4302 * General code cleanup and small bugfixes. I think it's close to a
4307 * General code cleanup and small bugfixes. I think it's close to a
4303 state where it can be released, obviously with a big 'beta'
4308 state where it can be released, obviously with a big 'beta'
4304 warning on it.
4309 warning on it.
4305
4310
4306 * Got the magic function split to work. Now all magics are defined
4311 * Got the magic function split to work. Now all magics are defined
4307 in a separate class. It just organizes things a bit, and now
4312 in a separate class. It just organizes things a bit, and now
4308 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4313 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4309 was too long).
4314 was too long).
4310
4315
4311 * Changed @clear to @reset to avoid potential confusions with
4316 * Changed @clear to @reset to avoid potential confusions with
4312 the shell command clear. Also renamed @cl to @clear, which does
4317 the shell command clear. Also renamed @cl to @clear, which does
4313 exactly what people expect it to from their shell experience.
4318 exactly what people expect it to from their shell experience.
4314
4319
4315 Added a check to the @reset command (since it's so
4320 Added a check to the @reset command (since it's so
4316 destructive, it's probably a good idea to ask for confirmation).
4321 destructive, it's probably a good idea to ask for confirmation).
4317 But now reset only works for full namespace resetting. Since the
4322 But now reset only works for full namespace resetting. Since the
4318 del keyword is already there for deleting a few specific
4323 del keyword is already there for deleting a few specific
4319 variables, I don't see the point of having a redundant magic
4324 variables, I don't see the point of having a redundant magic
4320 function for the same task.
4325 function for the same task.
4321
4326
4322 2001-11-24 Fernando Perez <fperez@colorado.edu>
4327 2001-11-24 Fernando Perez <fperez@colorado.edu>
4323
4328
4324 * Updated the builtin docs (esp. the ? ones).
4329 * Updated the builtin docs (esp. the ? ones).
4325
4330
4326 * Ran all the code through pychecker. Not terribly impressed with
4331 * Ran all the code through pychecker. Not terribly impressed with
4327 it: lots of spurious warnings and didn't really find anything of
4332 it: lots of spurious warnings and didn't really find anything of
4328 substance (just a few modules being imported and not used).
4333 substance (just a few modules being imported and not used).
4329
4334
4330 * Implemented the new ultraTB functionality into IPython. New
4335 * Implemented the new ultraTB functionality into IPython. New
4331 option: xcolors. This chooses color scheme. xmode now only selects
4336 option: xcolors. This chooses color scheme. xmode now only selects
4332 between Plain and Verbose. Better orthogonality.
4337 between Plain and Verbose. Better orthogonality.
4333
4338
4334 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4339 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4335 mode and color scheme for the exception handlers. Now it's
4340 mode and color scheme for the exception handlers. Now it's
4336 possible to have the verbose traceback with no coloring.
4341 possible to have the verbose traceback with no coloring.
4337
4342
4338 2001-11-23 Fernando Perez <fperez@colorado.edu>
4343 2001-11-23 Fernando Perez <fperez@colorado.edu>
4339
4344
4340 * Version 0.1.12 released, 0.1.13 opened.
4345 * Version 0.1.12 released, 0.1.13 opened.
4341
4346
4342 * Removed option to set auto-quote and auto-paren escapes by
4347 * Removed option to set auto-quote and auto-paren escapes by
4343 user. The chances of breaking valid syntax are just too high. If
4348 user. The chances of breaking valid syntax are just too high. If
4344 someone *really* wants, they can always dig into the code.
4349 someone *really* wants, they can always dig into the code.
4345
4350
4346 * Made prompt separators configurable.
4351 * Made prompt separators configurable.
4347
4352
4348 2001-11-22 Fernando Perez <fperez@colorado.edu>
4353 2001-11-22 Fernando Perez <fperez@colorado.edu>
4349
4354
4350 * Small bugfixes in many places.
4355 * Small bugfixes in many places.
4351
4356
4352 * Removed the MyCompleter class from ipplib. It seemed redundant
4357 * Removed the MyCompleter class from ipplib. It seemed redundant
4353 with the C-p,C-n history search functionality. Less code to
4358 with the C-p,C-n history search functionality. Less code to
4354 maintain.
4359 maintain.
4355
4360
4356 * Moved all the original ipython.py code into ipythonlib.py. Right
4361 * Moved all the original ipython.py code into ipythonlib.py. Right
4357 now it's just one big dump into a function called make_IPython, so
4362 now it's just one big dump into a function called make_IPython, so
4358 no real modularity has been gained. But at least it makes the
4363 no real modularity has been gained. But at least it makes the
4359 wrapper script tiny, and since ipythonlib is a module, it gets
4364 wrapper script tiny, and since ipythonlib is a module, it gets
4360 compiled and startup is much faster.
4365 compiled and startup is much faster.
4361
4366
4362 This is a reasobably 'deep' change, so we should test it for a
4367 This is a reasobably 'deep' change, so we should test it for a
4363 while without messing too much more with the code.
4368 while without messing too much more with the code.
4364
4369
4365 2001-11-21 Fernando Perez <fperez@colorado.edu>
4370 2001-11-21 Fernando Perez <fperez@colorado.edu>
4366
4371
4367 * Version 0.1.11 released, 0.1.12 opened for further work.
4372 * Version 0.1.11 released, 0.1.12 opened for further work.
4368
4373
4369 * Removed dependency on Itpl. It was only needed in one place. It
4374 * Removed dependency on Itpl. It was only needed in one place. It
4370 would be nice if this became part of python, though. It makes life
4375 would be nice if this became part of python, though. It makes life
4371 *a lot* easier in some cases.
4376 *a lot* easier in some cases.
4372
4377
4373 * Simplified the prefilter code a bit. Now all handlers are
4378 * Simplified the prefilter code a bit. Now all handlers are
4374 expected to explicitly return a value (at least a blank string).
4379 expected to explicitly return a value (at least a blank string).
4375
4380
4376 * Heavy edits in ipplib. Removed the help system altogether. Now
4381 * Heavy edits in ipplib. Removed the help system altogether. Now
4377 obj?/?? is used for inspecting objects, a magic @doc prints
4382 obj?/?? is used for inspecting objects, a magic @doc prints
4378 docstrings, and full-blown Python help is accessed via the 'help'
4383 docstrings, and full-blown Python help is accessed via the 'help'
4379 keyword. This cleans up a lot of code (less to maintain) and does
4384 keyword. This cleans up a lot of code (less to maintain) and does
4380 the job. Since 'help' is now a standard Python component, might as
4385 the job. Since 'help' is now a standard Python component, might as
4381 well use it and remove duplicate functionality.
4386 well use it and remove duplicate functionality.
4382
4387
4383 Also removed the option to use ipplib as a standalone program. By
4388 Also removed the option to use ipplib as a standalone program. By
4384 now it's too dependent on other parts of IPython to function alone.
4389 now it's too dependent on other parts of IPython to function alone.
4385
4390
4386 * Fixed bug in genutils.pager. It would crash if the pager was
4391 * Fixed bug in genutils.pager. It would crash if the pager was
4387 exited immediately after opening (broken pipe).
4392 exited immediately after opening (broken pipe).
4388
4393
4389 * Trimmed down the VerboseTB reporting a little. The header is
4394 * Trimmed down the VerboseTB reporting a little. The header is
4390 much shorter now and the repeated exception arguments at the end
4395 much shorter now and the repeated exception arguments at the end
4391 have been removed. For interactive use the old header seemed a bit
4396 have been removed. For interactive use the old header seemed a bit
4392 excessive.
4397 excessive.
4393
4398
4394 * Fixed small bug in output of @whos for variables with multi-word
4399 * Fixed small bug in output of @whos for variables with multi-word
4395 types (only first word was displayed).
4400 types (only first word was displayed).
4396
4401
4397 2001-11-17 Fernando Perez <fperez@colorado.edu>
4402 2001-11-17 Fernando Perez <fperez@colorado.edu>
4398
4403
4399 * Version 0.1.10 released, 0.1.11 opened for further work.
4404 * Version 0.1.10 released, 0.1.11 opened for further work.
4400
4405
4401 * Modified dirs and friends. dirs now *returns* the stack (not
4406 * Modified dirs and friends. dirs now *returns* the stack (not
4402 prints), so one can manipulate it as a variable. Convenient to
4407 prints), so one can manipulate it as a variable. Convenient to
4403 travel along many directories.
4408 travel along many directories.
4404
4409
4405 * Fixed bug in magic_pdef: would only work with functions with
4410 * Fixed bug in magic_pdef: would only work with functions with
4406 arguments with default values.
4411 arguments with default values.
4407
4412
4408 2001-11-14 Fernando Perez <fperez@colorado.edu>
4413 2001-11-14 Fernando Perez <fperez@colorado.edu>
4409
4414
4410 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4415 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4411 example with IPython. Various other minor fixes and cleanups.
4416 example with IPython. Various other minor fixes and cleanups.
4412
4417
4413 * Version 0.1.9 released, 0.1.10 opened for further work.
4418 * Version 0.1.9 released, 0.1.10 opened for further work.
4414
4419
4415 * Added sys.path to the list of directories searched in the
4420 * Added sys.path to the list of directories searched in the
4416 execfile= option. It used to be the current directory and the
4421 execfile= option. It used to be the current directory and the
4417 user's IPYTHONDIR only.
4422 user's IPYTHONDIR only.
4418
4423
4419 2001-11-13 Fernando Perez <fperez@colorado.edu>
4424 2001-11-13 Fernando Perez <fperez@colorado.edu>
4420
4425
4421 * Reinstated the raw_input/prefilter separation that Janko had
4426 * Reinstated the raw_input/prefilter separation that Janko had
4422 initially. This gives a more convenient setup for extending the
4427 initially. This gives a more convenient setup for extending the
4423 pre-processor from the outside: raw_input always gets a string,
4428 pre-processor from the outside: raw_input always gets a string,
4424 and prefilter has to process it. We can then redefine prefilter
4429 and prefilter has to process it. We can then redefine prefilter
4425 from the outside and implement extensions for special
4430 from the outside and implement extensions for special
4426 purposes.
4431 purposes.
4427
4432
4428 Today I got one for inputting PhysicalQuantity objects
4433 Today I got one for inputting PhysicalQuantity objects
4429 (from Scientific) without needing any function calls at
4434 (from Scientific) without needing any function calls at
4430 all. Extremely convenient, and it's all done as a user-level
4435 all. Extremely convenient, and it's all done as a user-level
4431 extension (no IPython code was touched). Now instead of:
4436 extension (no IPython code was touched). Now instead of:
4432 a = PhysicalQuantity(4.2,'m/s**2')
4437 a = PhysicalQuantity(4.2,'m/s**2')
4433 one can simply say
4438 one can simply say
4434 a = 4.2 m/s**2
4439 a = 4.2 m/s**2
4435 or even
4440 or even
4436 a = 4.2 m/s^2
4441 a = 4.2 m/s^2
4437
4442
4438 I use this, but it's also a proof of concept: IPython really is
4443 I use this, but it's also a proof of concept: IPython really is
4439 fully user-extensible, even at the level of the parsing of the
4444 fully user-extensible, even at the level of the parsing of the
4440 command line. It's not trivial, but it's perfectly doable.
4445 command line. It's not trivial, but it's perfectly doable.
4441
4446
4442 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4447 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4443 the problem of modules being loaded in the inverse order in which
4448 the problem of modules being loaded in the inverse order in which
4444 they were defined in
4449 they were defined in
4445
4450
4446 * Version 0.1.8 released, 0.1.9 opened for further work.
4451 * Version 0.1.8 released, 0.1.9 opened for further work.
4447
4452
4448 * Added magics pdef, source and file. They respectively show the
4453 * Added magics pdef, source and file. They respectively show the
4449 definition line ('prototype' in C), source code and full python
4454 definition line ('prototype' in C), source code and full python
4450 file for any callable object. The object inspector oinfo uses
4455 file for any callable object. The object inspector oinfo uses
4451 these to show the same information.
4456 these to show the same information.
4452
4457
4453 * Version 0.1.7 released, 0.1.8 opened for further work.
4458 * Version 0.1.7 released, 0.1.8 opened for further work.
4454
4459
4455 * Separated all the magic functions into a class called Magic. The
4460 * Separated all the magic functions into a class called Magic. The
4456 InteractiveShell class was becoming too big for Xemacs to handle
4461 InteractiveShell class was becoming too big for Xemacs to handle
4457 (de-indenting a line would lock it up for 10 seconds while it
4462 (de-indenting a line would lock it up for 10 seconds while it
4458 backtracked on the whole class!)
4463 backtracked on the whole class!)
4459
4464
4460 FIXME: didn't work. It can be done, but right now namespaces are
4465 FIXME: didn't work. It can be done, but right now namespaces are
4461 all messed up. Do it later (reverted it for now, so at least
4466 all messed up. Do it later (reverted it for now, so at least
4462 everything works as before).
4467 everything works as before).
4463
4468
4464 * Got the object introspection system (magic_oinfo) working! I
4469 * Got the object introspection system (magic_oinfo) working! I
4465 think this is pretty much ready for release to Janko, so he can
4470 think this is pretty much ready for release to Janko, so he can
4466 test it for a while and then announce it. Pretty much 100% of what
4471 test it for a while and then announce it. Pretty much 100% of what
4467 I wanted for the 'phase 1' release is ready. Happy, tired.
4472 I wanted for the 'phase 1' release is ready. Happy, tired.
4468
4473
4469 2001-11-12 Fernando Perez <fperez@colorado.edu>
4474 2001-11-12 Fernando Perez <fperez@colorado.edu>
4470
4475
4471 * Version 0.1.6 released, 0.1.7 opened for further work.
4476 * Version 0.1.6 released, 0.1.7 opened for further work.
4472
4477
4473 * Fixed bug in printing: it used to test for truth before
4478 * Fixed bug in printing: it used to test for truth before
4474 printing, so 0 wouldn't print. Now checks for None.
4479 printing, so 0 wouldn't print. Now checks for None.
4475
4480
4476 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4481 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4477 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4482 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4478 reaches by hand into the outputcache. Think of a better way to do
4483 reaches by hand into the outputcache. Think of a better way to do
4479 this later.
4484 this later.
4480
4485
4481 * Various small fixes thanks to Nathan's comments.
4486 * Various small fixes thanks to Nathan's comments.
4482
4487
4483 * Changed magic_pprint to magic_Pprint. This way it doesn't
4488 * Changed magic_pprint to magic_Pprint. This way it doesn't
4484 collide with pprint() and the name is consistent with the command
4489 collide with pprint() and the name is consistent with the command
4485 line option.
4490 line option.
4486
4491
4487 * Changed prompt counter behavior to be fully like
4492 * Changed prompt counter behavior to be fully like
4488 Mathematica's. That is, even input that doesn't return a result
4493 Mathematica's. That is, even input that doesn't return a result
4489 raises the prompt counter. The old behavior was kind of confusing
4494 raises the prompt counter. The old behavior was kind of confusing
4490 (getting the same prompt number several times if the operation
4495 (getting the same prompt number several times if the operation
4491 didn't return a result).
4496 didn't return a result).
4492
4497
4493 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4498 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4494
4499
4495 * Fixed -Classic mode (wasn't working anymore).
4500 * Fixed -Classic mode (wasn't working anymore).
4496
4501
4497 * Added colored prompts using Nathan's new code. Colors are
4502 * Added colored prompts using Nathan's new code. Colors are
4498 currently hardwired, they can be user-configurable. For
4503 currently hardwired, they can be user-configurable. For
4499 developers, they can be chosen in file ipythonlib.py, at the
4504 developers, they can be chosen in file ipythonlib.py, at the
4500 beginning of the CachedOutput class def.
4505 beginning of the CachedOutput class def.
4501
4506
4502 2001-11-11 Fernando Perez <fperez@colorado.edu>
4507 2001-11-11 Fernando Perez <fperez@colorado.edu>
4503
4508
4504 * Version 0.1.5 released, 0.1.6 opened for further work.
4509 * Version 0.1.5 released, 0.1.6 opened for further work.
4505
4510
4506 * Changed magic_env to *return* the environment as a dict (not to
4511 * Changed magic_env to *return* the environment as a dict (not to
4507 print it). This way it prints, but it can also be processed.
4512 print it). This way it prints, but it can also be processed.
4508
4513
4509 * Added Verbose exception reporting to interactive
4514 * Added Verbose exception reporting to interactive
4510 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4515 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4511 traceback. Had to make some changes to the ultraTB file. This is
4516 traceback. Had to make some changes to the ultraTB file. This is
4512 probably the last 'big' thing in my mental todo list. This ties
4517 probably the last 'big' thing in my mental todo list. This ties
4513 in with the next entry:
4518 in with the next entry:
4514
4519
4515 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4520 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4516 has to specify is Plain, Color or Verbose for all exception
4521 has to specify is Plain, Color or Verbose for all exception
4517 handling.
4522 handling.
4518
4523
4519 * Removed ShellServices option. All this can really be done via
4524 * Removed ShellServices option. All this can really be done via
4520 the magic system. It's easier to extend, cleaner and has automatic
4525 the magic system. It's easier to extend, cleaner and has automatic
4521 namespace protection and documentation.
4526 namespace protection and documentation.
4522
4527
4523 2001-11-09 Fernando Perez <fperez@colorado.edu>
4528 2001-11-09 Fernando Perez <fperez@colorado.edu>
4524
4529
4525 * Fixed bug in output cache flushing (missing parameter to
4530 * Fixed bug in output cache flushing (missing parameter to
4526 __init__). Other small bugs fixed (found using pychecker).
4531 __init__). Other small bugs fixed (found using pychecker).
4527
4532
4528 * Version 0.1.4 opened for bugfixing.
4533 * Version 0.1.4 opened for bugfixing.
4529
4534
4530 2001-11-07 Fernando Perez <fperez@colorado.edu>
4535 2001-11-07 Fernando Perez <fperez@colorado.edu>
4531
4536
4532 * Version 0.1.3 released, mainly because of the raw_input bug.
4537 * Version 0.1.3 released, mainly because of the raw_input bug.
4533
4538
4534 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4539 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4535 and when testing for whether things were callable, a call could
4540 and when testing for whether things were callable, a call could
4536 actually be made to certain functions. They would get called again
4541 actually be made to certain functions. They would get called again
4537 once 'really' executed, with a resulting double call. A disaster
4542 once 'really' executed, with a resulting double call. A disaster
4538 in many cases (list.reverse() would never work!).
4543 in many cases (list.reverse() would never work!).
4539
4544
4540 * Removed prefilter() function, moved its code to raw_input (which
4545 * Removed prefilter() function, moved its code to raw_input (which
4541 after all was just a near-empty caller for prefilter). This saves
4546 after all was just a near-empty caller for prefilter). This saves
4542 a function call on every prompt, and simplifies the class a tiny bit.
4547 a function call on every prompt, and simplifies the class a tiny bit.
4543
4548
4544 * Fix _ip to __ip name in magic example file.
4549 * Fix _ip to __ip name in magic example file.
4545
4550
4546 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4551 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4547 work with non-gnu versions of tar.
4552 work with non-gnu versions of tar.
4548
4553
4549 2001-11-06 Fernando Perez <fperez@colorado.edu>
4554 2001-11-06 Fernando Perez <fperez@colorado.edu>
4550
4555
4551 * Version 0.1.2. Just to keep track of the recent changes.
4556 * Version 0.1.2. Just to keep track of the recent changes.
4552
4557
4553 * Fixed nasty bug in output prompt routine. It used to check 'if
4558 * Fixed nasty bug in output prompt routine. It used to check 'if
4554 arg != None...'. Problem is, this fails if arg implements a
4559 arg != None...'. Problem is, this fails if arg implements a
4555 special comparison (__cmp__) which disallows comparing to
4560 special comparison (__cmp__) which disallows comparing to
4556 None. Found it when trying to use the PhysicalQuantity module from
4561 None. Found it when trying to use the PhysicalQuantity module from
4557 ScientificPython.
4562 ScientificPython.
4558
4563
4559 2001-11-05 Fernando Perez <fperez@colorado.edu>
4564 2001-11-05 Fernando Perez <fperez@colorado.edu>
4560
4565
4561 * Also added dirs. Now the pushd/popd/dirs family functions
4566 * Also added dirs. Now the pushd/popd/dirs family functions
4562 basically like the shell, with the added convenience of going home
4567 basically like the shell, with the added convenience of going home
4563 when called with no args.
4568 when called with no args.
4564
4569
4565 * pushd/popd slightly modified to mimic shell behavior more
4570 * pushd/popd slightly modified to mimic shell behavior more
4566 closely.
4571 closely.
4567
4572
4568 * Added env,pushd,popd from ShellServices as magic functions. I
4573 * Added env,pushd,popd from ShellServices as magic functions. I
4569 think the cleanest will be to port all desired functions from
4574 think the cleanest will be to port all desired functions from
4570 ShellServices as magics and remove ShellServices altogether. This
4575 ShellServices as magics and remove ShellServices altogether. This
4571 will provide a single, clean way of adding functionality
4576 will provide a single, clean way of adding functionality
4572 (shell-type or otherwise) to IP.
4577 (shell-type or otherwise) to IP.
4573
4578
4574 2001-11-04 Fernando Perez <fperez@colorado.edu>
4579 2001-11-04 Fernando Perez <fperez@colorado.edu>
4575
4580
4576 * Added .ipython/ directory to sys.path. This way users can keep
4581 * Added .ipython/ directory to sys.path. This way users can keep
4577 customizations there and access them via import.
4582 customizations there and access them via import.
4578
4583
4579 2001-11-03 Fernando Perez <fperez@colorado.edu>
4584 2001-11-03 Fernando Perez <fperez@colorado.edu>
4580
4585
4581 * Opened version 0.1.1 for new changes.
4586 * Opened version 0.1.1 for new changes.
4582
4587
4583 * Changed version number to 0.1.0: first 'public' release, sent to
4588 * Changed version number to 0.1.0: first 'public' release, sent to
4584 Nathan and Janko.
4589 Nathan and Janko.
4585
4590
4586 * Lots of small fixes and tweaks.
4591 * Lots of small fixes and tweaks.
4587
4592
4588 * Minor changes to whos format. Now strings are shown, snipped if
4593 * Minor changes to whos format. Now strings are shown, snipped if
4589 too long.
4594 too long.
4590
4595
4591 * Changed ShellServices to work on __main__ so they show up in @who
4596 * Changed ShellServices to work on __main__ so they show up in @who
4592
4597
4593 * Help also works with ? at the end of a line:
4598 * Help also works with ? at the end of a line:
4594 ?sin and sin?
4599 ?sin and sin?
4595 both produce the same effect. This is nice, as often I use the
4600 both produce the same effect. This is nice, as often I use the
4596 tab-complete to find the name of a method, but I used to then have
4601 tab-complete to find the name of a method, but I used to then have
4597 to go to the beginning of the line to put a ? if I wanted more
4602 to go to the beginning of the line to put a ? if I wanted more
4598 info. Now I can just add the ? and hit return. Convenient.
4603 info. Now I can just add the ? and hit return. Convenient.
4599
4604
4600 2001-11-02 Fernando Perez <fperez@colorado.edu>
4605 2001-11-02 Fernando Perez <fperez@colorado.edu>
4601
4606
4602 * Python version check (>=2.1) added.
4607 * Python version check (>=2.1) added.
4603
4608
4604 * Added LazyPython documentation. At this point the docs are quite
4609 * Added LazyPython documentation. At this point the docs are quite
4605 a mess. A cleanup is in order.
4610 a mess. A cleanup is in order.
4606
4611
4607 * Auto-installer created. For some bizarre reason, the zipfiles
4612 * Auto-installer created. For some bizarre reason, the zipfiles
4608 module isn't working on my system. So I made a tar version
4613 module isn't working on my system. So I made a tar version
4609 (hopefully the command line options in various systems won't kill
4614 (hopefully the command line options in various systems won't kill
4610 me).
4615 me).
4611
4616
4612 * Fixes to Struct in genutils. Now all dictionary-like methods are
4617 * Fixes to Struct in genutils. Now all dictionary-like methods are
4613 protected (reasonably).
4618 protected (reasonably).
4614
4619
4615 * Added pager function to genutils and changed ? to print usage
4620 * Added pager function to genutils and changed ? to print usage
4616 note through it (it was too long).
4621 note through it (it was too long).
4617
4622
4618 * Added the LazyPython functionality. Works great! I changed the
4623 * Added the LazyPython functionality. Works great! I changed the
4619 auto-quote escape to ';', it's on home row and next to '. But
4624 auto-quote escape to ';', it's on home row and next to '. But
4620 both auto-quote and auto-paren (still /) escapes are command-line
4625 both auto-quote and auto-paren (still /) escapes are command-line
4621 parameters.
4626 parameters.
4622
4627
4623
4628
4624 2001-11-01 Fernando Perez <fperez@colorado.edu>
4629 2001-11-01 Fernando Perez <fperez@colorado.edu>
4625
4630
4626 * Version changed to 0.0.7. Fairly large change: configuration now
4631 * Version changed to 0.0.7. Fairly large change: configuration now
4627 is all stored in a directory, by default .ipython. There, all
4632 is all stored in a directory, by default .ipython. There, all
4628 config files have normal looking names (not .names)
4633 config files have normal looking names (not .names)
4629
4634
4630 * Version 0.0.6 Released first to Lucas and Archie as a test
4635 * Version 0.0.6 Released first to Lucas and Archie as a test
4631 run. Since it's the first 'semi-public' release, change version to
4636 run. Since it's the first 'semi-public' release, change version to
4632 > 0.0.6 for any changes now.
4637 > 0.0.6 for any changes now.
4633
4638
4634 * Stuff I had put in the ipplib.py changelog:
4639 * Stuff I had put in the ipplib.py changelog:
4635
4640
4636 Changes to InteractiveShell:
4641 Changes to InteractiveShell:
4637
4642
4638 - Made the usage message a parameter.
4643 - Made the usage message a parameter.
4639
4644
4640 - Require the name of the shell variable to be given. It's a bit
4645 - Require the name of the shell variable to be given. It's a bit
4641 of a hack, but allows the name 'shell' not to be hardwire in the
4646 of a hack, but allows the name 'shell' not to be hardwire in the
4642 magic (@) handler, which is problematic b/c it requires
4647 magic (@) handler, which is problematic b/c it requires
4643 polluting the global namespace with 'shell'. This in turn is
4648 polluting the global namespace with 'shell'. This in turn is
4644 fragile: if a user redefines a variable called shell, things
4649 fragile: if a user redefines a variable called shell, things
4645 break.
4650 break.
4646
4651
4647 - magic @: all functions available through @ need to be defined
4652 - magic @: all functions available through @ need to be defined
4648 as magic_<name>, even though they can be called simply as
4653 as magic_<name>, even though they can be called simply as
4649 @<name>. This allows the special command @magic to gather
4654 @<name>. This allows the special command @magic to gather
4650 information automatically about all existing magic functions,
4655 information automatically about all existing magic functions,
4651 even if they are run-time user extensions, by parsing the shell
4656 even if they are run-time user extensions, by parsing the shell
4652 instance __dict__ looking for special magic_ names.
4657 instance __dict__ looking for special magic_ names.
4653
4658
4654 - mainloop: added *two* local namespace parameters. This allows
4659 - mainloop: added *two* local namespace parameters. This allows
4655 the class to differentiate between parameters which were there
4660 the class to differentiate between parameters which were there
4656 before and after command line initialization was processed. This
4661 before and after command line initialization was processed. This
4657 way, later @who can show things loaded at startup by the
4662 way, later @who can show things loaded at startup by the
4658 user. This trick was necessary to make session saving/reloading
4663 user. This trick was necessary to make session saving/reloading
4659 really work: ideally after saving/exiting/reloading a session,
4664 really work: ideally after saving/exiting/reloading a session,
4660 *everythin* should look the same, including the output of @who. I
4665 *everythin* should look the same, including the output of @who. I
4661 was only able to make this work with this double namespace
4666 was only able to make this work with this double namespace
4662 trick.
4667 trick.
4663
4668
4664 - added a header to the logfile which allows (almost) full
4669 - added a header to the logfile which allows (almost) full
4665 session restoring.
4670 session restoring.
4666
4671
4667 - prepend lines beginning with @ or !, with a and log
4672 - prepend lines beginning with @ or !, with a and log
4668 them. Why? !lines: may be useful to know what you did @lines:
4673 them. Why? !lines: may be useful to know what you did @lines:
4669 they may affect session state. So when restoring a session, at
4674 they may affect session state. So when restoring a session, at
4670 least inform the user of their presence. I couldn't quite get
4675 least inform the user of their presence. I couldn't quite get
4671 them to properly re-execute, but at least the user is warned.
4676 them to properly re-execute, but at least the user is warned.
4672
4677
4673 * Started ChangeLog.
4678 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now