##// END OF EJS Templates
- Work around pexcept buglet which causes wraparound problems with long...
fptest -
Show More
@@ -1,526 +1,548 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Tools for inspecting Python objects.
2 """Tools for inspecting Python objects.
3
3
4 Uses syntax highlighting for presenting the various information elements.
4 Uses syntax highlighting for presenting the various information elements.
5
5
6 Similar in spirit to the inspect module, but all calls take a name argument to
6 Similar in spirit to the inspect module, but all calls take a name argument to
7 reference the name under which an object is being read.
7 reference the name under which an object is being read.
8
8
9 $Id: OInspect.py 1625 2006-08-12 10:34:44Z vivainio $
9 $Id: OInspect.py 1850 2006-10-28 19:48:13Z fptest $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
13 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
14 #
14 #
15 # Distributed under the terms of the BSD License. The full license is in
15 # Distributed under the terms of the BSD License. The full license is in
16 # the file COPYING, distributed as part of this software.
16 # the file COPYING, distributed as part of this software.
17 #*****************************************************************************
17 #*****************************************************************************
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 __all__ = ['Inspector','InspectColors']
23 __all__ = ['Inspector','InspectColors']
24
24
25 # stdlib modules
25 # stdlib modules
26 import __builtin__
26 import __builtin__
27 import inspect
27 import inspect
28 import linecache
28 import linecache
29 import string
29 import string
30 import StringIO
30 import StringIO
31 import types
31 import types
32 import os
32 import os
33 import sys
33 import sys
34 # IPython's own
34 # IPython's own
35 from IPython import PyColorize
35 from IPython import PyColorize
36 from IPython.genutils import page,indent,Term,mkdict
36 from IPython.genutils import page,indent,Term,mkdict
37 from IPython.Itpl import itpl
37 from IPython.Itpl import itpl
38 from IPython.wildcard import list_namespace
38 from IPython.wildcard import list_namespace
39 from IPython.ColorANSI import *
39 from IPython.ColorANSI import *
40
40
41 #****************************************************************************
41 #****************************************************************************
42 # HACK!!! This is a crude fix for bugs in python 2.3's inspect module. We
42 # HACK!!! This is a crude fix for bugs in python 2.3's inspect module. We
43 # simply monkeypatch inspect with code copied from python 2.4.
43 # simply monkeypatch inspect with code copied from python 2.4.
44 if sys.version_info[:2] == (2,3):
44 if sys.version_info[:2] == (2,3):
45 from inspect import ismodule, getabsfile, modulesbyfile
45 from inspect import ismodule, getabsfile, modulesbyfile
46 def getmodule(object):
46 def getmodule(object):
47 """Return the module an object was defined in, or None if not found."""
47 """Return the module an object was defined in, or None if not found."""
48 if ismodule(object):
48 if ismodule(object):
49 return object
49 return object
50 if hasattr(object, '__module__'):
50 if hasattr(object, '__module__'):
51 return sys.modules.get(object.__module__)
51 return sys.modules.get(object.__module__)
52 try:
52 try:
53 file = getabsfile(object)
53 file = getabsfile(object)
54 except TypeError:
54 except TypeError:
55 return None
55 return None
56 if file in modulesbyfile:
56 if file in modulesbyfile:
57 return sys.modules.get(modulesbyfile[file])
57 return sys.modules.get(modulesbyfile[file])
58 for module in sys.modules.values():
58 for module in sys.modules.values():
59 if hasattr(module, '__file__'):
59 if hasattr(module, '__file__'):
60 modulesbyfile[
60 modulesbyfile[
61 os.path.realpath(
61 os.path.realpath(
62 getabsfile(module))] = module.__name__
62 getabsfile(module))] = module.__name__
63 if file in modulesbyfile:
63 if file in modulesbyfile:
64 return sys.modules.get(modulesbyfile[file])
64 return sys.modules.get(modulesbyfile[file])
65 main = sys.modules['__main__']
65 main = sys.modules['__main__']
66 if not hasattr(object, '__name__'):
66 if not hasattr(object, '__name__'):
67 return None
67 return None
68 if hasattr(main, object.__name__):
68 if hasattr(main, object.__name__):
69 mainobject = getattr(main, object.__name__)
69 mainobject = getattr(main, object.__name__)
70 if mainobject is object:
70 if mainobject is object:
71 return main
71 return main
72 builtin = sys.modules['__builtin__']
72 builtin = sys.modules['__builtin__']
73 if hasattr(builtin, object.__name__):
73 if hasattr(builtin, object.__name__):
74 builtinobject = getattr(builtin, object.__name__)
74 builtinobject = getattr(builtin, object.__name__)
75 if builtinobject is object:
75 if builtinobject is object:
76 return builtin
76 return builtin
77
77
78 inspect.getmodule = getmodule
78 inspect.getmodule = getmodule
79
79
80 #****************************************************************************
80 #****************************************************************************
81 # Builtin color schemes
81 # Builtin color schemes
82
82
83 Colors = TermColors # just a shorthand
83 Colors = TermColors # just a shorthand
84
84
85 # Build a few color schemes
85 # Build a few color schemes
86 NoColor = ColorScheme(
86 NoColor = ColorScheme(
87 'NoColor',{
87 'NoColor',{
88 'header' : Colors.NoColor,
88 'header' : Colors.NoColor,
89 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
89 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
90 } )
90 } )
91
91
92 LinuxColors = ColorScheme(
92 LinuxColors = ColorScheme(
93 'Linux',{
93 'Linux',{
94 'header' : Colors.LightRed,
94 'header' : Colors.LightRed,
95 'normal' : Colors.Normal # color off (usu. Colors.Normal)
95 'normal' : Colors.Normal # color off (usu. Colors.Normal)
96 } )
96 } )
97
97
98 LightBGColors = ColorScheme(
98 LightBGColors = ColorScheme(
99 'LightBG',{
99 'LightBG',{
100 'header' : Colors.Red,
100 'header' : Colors.Red,
101 'normal' : Colors.Normal # color off (usu. Colors.Normal)
101 'normal' : Colors.Normal # color off (usu. Colors.Normal)
102 } )
102 } )
103
103
104 # Build table of color schemes (needed by the parser)
104 # Build table of color schemes (needed by the parser)
105 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
105 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
106 'Linux')
106 'Linux')
107
107
108 #****************************************************************************
108 #****************************************************************************
109 # Auxiliary functions
109 # Auxiliary functions
110 def getdoc(obj):
110 def getdoc(obj):
111 """Stable wrapper around inspect.getdoc.
111 """Stable wrapper around inspect.getdoc.
112
112
113 This can't crash because of attribute problems.
113 This can't crash because of attribute problems.
114
114
115 It also attempts to call a getdoc() method on the given object. This
115 It also attempts to call a getdoc() method on the given object. This
116 allows objects which provide their docstrings via non-standard mechanisms
116 allows objects which provide their docstrings via non-standard mechanisms
117 (like Pyro proxies) to still be inspected by ipython's ? system."""
117 (like Pyro proxies) to still be inspected by ipython's ? system."""
118
118
119 ds = None # default return value
119 ds = None # default return value
120 try:
120 try:
121 ds = inspect.getdoc(obj)
121 ds = inspect.getdoc(obj)
122 except:
122 except:
123 # Harden against an inspect failure, which can occur with
123 # Harden against an inspect failure, which can occur with
124 # SWIG-wrapped extensions.
124 # SWIG-wrapped extensions.
125 pass
125 pass
126 # Allow objects to offer customized documentation via a getdoc method:
126 # Allow objects to offer customized documentation via a getdoc method:
127 try:
127 try:
128 ds2 = obj.getdoc()
128 ds2 = obj.getdoc()
129 except:
129 except:
130 pass
130 pass
131 else:
131 else:
132 # if we get extra info, we add it to the normal docstring.
132 # if we get extra info, we add it to the normal docstring.
133 if ds is None:
133 if ds is None:
134 ds = ds2
134 ds = ds2
135 else:
135 else:
136 ds = '%s\n%s' % (ds,ds2)
136 ds = '%s\n%s' % (ds,ds2)
137 return ds
137 return ds
138
138
139 def getsource(obj,is_binary=False):
140 """Wrapper around inspect.getsource.
141
142 This can be modified by other projects to provide customized source
143 extraction.
144
145 Inputs:
146
147 - obj: an object whose source code we will attempt to extract.
148
149 Optional inputs:
150
151 - is_binary: whether the object is known to come from a binary source.
152 This implementation will skip returning any output for binary objects, but
153 custom extractors may know how to meaninfully process them."""
154
155 if is_binary:
156 return None
157 else:
158 return inspect.getsource(obj)
159
139 #****************************************************************************
160 #****************************************************************************
140 # Class definitions
161 # Class definitions
141
162
142 class myStringIO(StringIO.StringIO):
163 class myStringIO(StringIO.StringIO):
143 """Adds a writeln method to normal StringIO."""
164 """Adds a writeln method to normal StringIO."""
144 def writeln(self,*arg,**kw):
165 def writeln(self,*arg,**kw):
145 """Does a write() and then a write('\n')"""
166 """Does a write() and then a write('\n')"""
146 self.write(*arg,**kw)
167 self.write(*arg,**kw)
147 self.write('\n')
168 self.write('\n')
148
169
149 class Inspector:
170 class Inspector:
150 def __init__(self,color_table,code_color_table,scheme,
171 def __init__(self,color_table,code_color_table,scheme,
151 str_detail_level=0):
172 str_detail_level=0):
152 self.color_table = color_table
173 self.color_table = color_table
153 self.parser = PyColorize.Parser(code_color_table,out='str')
174 self.parser = PyColorize.Parser(code_color_table,out='str')
154 self.format = self.parser.format
175 self.format = self.parser.format
155 self.str_detail_level = str_detail_level
176 self.str_detail_level = str_detail_level
156 self.set_active_scheme(scheme)
177 self.set_active_scheme(scheme)
157
178
158 def __getargspec(self,obj):
179 def __getargspec(self,obj):
159 """Get the names and default values of a function's arguments.
180 """Get the names and default values of a function's arguments.
160
181
161 A tuple of four things is returned: (args, varargs, varkw, defaults).
182 A tuple of four things is returned: (args, varargs, varkw, defaults).
162 'args' is a list of the argument names (it may contain nested lists).
183 'args' is a list of the argument names (it may contain nested lists).
163 'varargs' and 'varkw' are the names of the * and ** arguments or None.
184 'varargs' and 'varkw' are the names of the * and ** arguments or None.
164 'defaults' is an n-tuple of the default values of the last n arguments.
185 'defaults' is an n-tuple of the default values of the last n arguments.
165
186
166 Modified version of inspect.getargspec from the Python Standard
187 Modified version of inspect.getargspec from the Python Standard
167 Library."""
188 Library."""
168
189
169 if inspect.isfunction(obj):
190 if inspect.isfunction(obj):
170 func_obj = obj
191 func_obj = obj
171 elif inspect.ismethod(obj):
192 elif inspect.ismethod(obj):
172 func_obj = obj.im_func
193 func_obj = obj.im_func
173 else:
194 else:
174 raise TypeError, 'arg is not a Python function'
195 raise TypeError, 'arg is not a Python function'
175 args, varargs, varkw = inspect.getargs(func_obj.func_code)
196 args, varargs, varkw = inspect.getargs(func_obj.func_code)
176 return args, varargs, varkw, func_obj.func_defaults
197 return args, varargs, varkw, func_obj.func_defaults
177
198
178 def __getdef(self,obj,oname=''):
199 def __getdef(self,obj,oname=''):
179 """Return the definition header for any callable object.
200 """Return the definition header for any callable object.
180
201
181 If any exception is generated, None is returned instead and the
202 If any exception is generated, None is returned instead and the
182 exception is suppressed."""
203 exception is suppressed."""
183
204
184 try:
205 try:
185 return oname + inspect.formatargspec(*self.__getargspec(obj))
206 return oname + inspect.formatargspec(*self.__getargspec(obj))
186 except:
207 except:
187 return None
208 return None
188
209
189 def __head(self,h):
210 def __head(self,h):
190 """Return a header string with proper colors."""
211 """Return a header string with proper colors."""
191 return '%s%s%s' % (self.color_table.active_colors.header,h,
212 return '%s%s%s' % (self.color_table.active_colors.header,h,
192 self.color_table.active_colors.normal)
213 self.color_table.active_colors.normal)
193
214
194 def set_active_scheme(self,scheme):
215 def set_active_scheme(self,scheme):
195 self.color_table.set_active_scheme(scheme)
216 self.color_table.set_active_scheme(scheme)
196 self.parser.color_table.set_active_scheme(scheme)
217 self.parser.color_table.set_active_scheme(scheme)
197
218
198 def noinfo(self,msg,oname):
219 def noinfo(self,msg,oname):
199 """Generic message when no information is found."""
220 """Generic message when no information is found."""
200 print 'No %s found' % msg,
221 print 'No %s found' % msg,
201 if oname:
222 if oname:
202 print 'for %s' % oname
223 print 'for %s' % oname
203 else:
224 else:
204 print
225 print
205
226
206 def pdef(self,obj,oname=''):
227 def pdef(self,obj,oname=''):
207 """Print the definition header for any callable object.
228 """Print the definition header for any callable object.
208
229
209 If the object is a class, print the constructor information."""
230 If the object is a class, print the constructor information."""
210
231
211 if not callable(obj):
232 if not callable(obj):
212 print 'Object is not callable.'
233 print 'Object is not callable.'
213 return
234 return
214
235
215 header = ''
236 header = ''
216 if type(obj) is types.ClassType:
237 if type(obj) is types.ClassType:
217 header = self.__head('Class constructor information:\n')
238 header = self.__head('Class constructor information:\n')
218 obj = obj.__init__
239 obj = obj.__init__
219 elif type(obj) is types.InstanceType:
240 elif type(obj) is types.InstanceType:
220 obj = obj.__call__
241 obj = obj.__call__
221
242
222 output = self.__getdef(obj,oname)
243 output = self.__getdef(obj,oname)
223 if output is None:
244 if output is None:
224 self.noinfo('definition header',oname)
245 self.noinfo('definition header',oname)
225 else:
246 else:
226 print >>Term.cout, header,self.format(output),
247 print >>Term.cout, header,self.format(output),
227
248
228 def pdoc(self,obj,oname='',formatter = None):
249 def pdoc(self,obj,oname='',formatter = None):
229 """Print the docstring for any object.
250 """Print the docstring for any object.
230
251
231 Optional:
252 Optional:
232 -formatter: a function to run the docstring through for specially
253 -formatter: a function to run the docstring through for specially
233 formatted docstrings."""
254 formatted docstrings."""
234
255
235 head = self.__head # so that itpl can find it even if private
256 head = self.__head # so that itpl can find it even if private
236 ds = getdoc(obj)
257 ds = getdoc(obj)
237 if formatter:
258 if formatter:
238 ds = formatter(ds)
259 ds = formatter(ds)
239 if type(obj) is types.ClassType:
260 if type(obj) is types.ClassType:
240 init_ds = getdoc(obj.__init__)
261 init_ds = getdoc(obj.__init__)
241 output = itpl('$head("Class Docstring:")\n'
262 output = itpl('$head("Class Docstring:")\n'
242 '$indent(ds)\n'
263 '$indent(ds)\n'
243 '$head("Constructor Docstring"):\n'
264 '$head("Constructor Docstring"):\n'
244 '$indent(init_ds)')
265 '$indent(init_ds)')
245 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
266 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
246 call_ds = getdoc(obj.__call__)
267 call_ds = getdoc(obj.__call__)
247 if call_ds:
268 if call_ds:
248 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
269 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
249 '$head("Calling Docstring:")\n$indent(call_ds)')
270 '$head("Calling Docstring:")\n$indent(call_ds)')
250 else:
271 else:
251 output = ds
272 output = ds
252 else:
273 else:
253 output = ds
274 output = ds
254 if output is None:
275 if output is None:
255 self.noinfo('documentation',oname)
276 self.noinfo('documentation',oname)
256 return
277 return
257 page(output)
278 page(output)
258
279
259 def psource(self,obj,oname=''):
280 def psource(self,obj,oname=''):
260 """Print the source code for an object."""
281 """Print the source code for an object."""
261
282
262 # Flush the source cache because inspect can return out-of-date source
283 # Flush the source cache because inspect can return out-of-date source
263 linecache.checkcache()
284 linecache.checkcache()
264 try:
285 try:
265 src = inspect.getsource(obj)
286 src = getsource(obj)
266 except:
287 except:
267 self.noinfo('source',oname)
288 self.noinfo('source',oname)
268 else:
289 else:
269 page(self.format(src))
290 page(self.format(src))
270
291
271 def pfile(self,obj,oname=''):
292 def pfile(self,obj,oname=''):
272 """Show the whole file where an object was defined."""
293 """Show the whole file where an object was defined."""
273 try:
294 try:
274 sourcelines,lineno = inspect.getsourcelines(obj)
295 sourcelines,lineno = inspect.getsourcelines(obj)
275 except:
296 except:
276 self.noinfo('file',oname)
297 self.noinfo('file',oname)
277 else:
298 else:
278 # run contents of file through pager starting at line
299 # run contents of file through pager starting at line
279 # where the object is defined
300 # where the object is defined
280 ofile = inspect.getabsfile(obj)
301 ofile = inspect.getabsfile(obj)
281
302
282 if (ofile.endswith('.so') or ofile.endswith('.dll')):
303 if (ofile.endswith('.so') or ofile.endswith('.dll')):
283 print 'File %r is binary, not printing.' % ofile
304 print 'File %r is binary, not printing.' % ofile
284 elif not os.path.isfile(ofile):
305 elif not os.path.isfile(ofile):
285 print 'File %r does not exist, not printing.' % ofile
306 print 'File %r does not exist, not printing.' % ofile
286 else:
307 else:
287 # Print only text files, not extension binaries.
308 # Print only text files, not extension binaries.
288 page(self.format(open(ofile).read()),lineno)
309 page(self.format(open(ofile).read()),lineno)
289 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
310 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
290
311
291 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
312 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
292 """Show detailed information about an object.
313 """Show detailed information about an object.
293
314
294 Optional arguments:
315 Optional arguments:
295
316
296 - oname: name of the variable pointing to the object.
317 - oname: name of the variable pointing to the object.
297
318
298 - formatter: special formatter for docstrings (see pdoc)
319 - formatter: special formatter for docstrings (see pdoc)
299
320
300 - info: a structure with some information fields which may have been
321 - info: a structure with some information fields which may have been
301 precomputed already.
322 precomputed already.
302
323
303 - detail_level: if set to 1, more information is given.
324 - detail_level: if set to 1, more information is given.
304 """
325 """
305
326
306 obj_type = type(obj)
327 obj_type = type(obj)
307
328
308 header = self.__head
329 header = self.__head
309 if info is None:
330 if info is None:
310 ismagic = 0
331 ismagic = 0
311 isalias = 0
332 isalias = 0
312 ospace = ''
333 ospace = ''
313 else:
334 else:
314 ismagic = info.ismagic
335 ismagic = info.ismagic
315 isalias = info.isalias
336 isalias = info.isalias
316 ospace = info.namespace
337 ospace = info.namespace
317 # Get docstring, special-casing aliases:
338 # Get docstring, special-casing aliases:
318 if isalias:
339 if isalias:
319 ds = "Alias to the system command:\n %s" % obj[1]
340 ds = "Alias to the system command:\n %s" % obj[1]
320 else:
341 else:
321 ds = getdoc(obj)
342 ds = getdoc(obj)
322 if ds is None:
343 if ds is None:
323 ds = '<no docstring>'
344 ds = '<no docstring>'
324 if formatter is not None:
345 if formatter is not None:
325 ds = formatter(ds)
346 ds = formatter(ds)
326
347
327 # store output in a list which gets joined with \n at the end.
348 # store output in a list which gets joined with \n at the end.
328 out = myStringIO()
349 out = myStringIO()
329
350
330 string_max = 200 # max size of strings to show (snipped if longer)
351 string_max = 200 # max size of strings to show (snipped if longer)
331 shalf = int((string_max -5)/2)
352 shalf = int((string_max -5)/2)
332
353
333 if ismagic:
354 if ismagic:
334 obj_type_name = 'Magic function'
355 obj_type_name = 'Magic function'
335 elif isalias:
356 elif isalias:
336 obj_type_name = 'System alias'
357 obj_type_name = 'System alias'
337 else:
358 else:
338 obj_type_name = obj_type.__name__
359 obj_type_name = obj_type.__name__
339 out.writeln(header('Type:\t\t')+obj_type_name)
360 out.writeln(header('Type:\t\t')+obj_type_name)
340
361
341 try:
362 try:
342 bclass = obj.__class__
363 bclass = obj.__class__
343 out.writeln(header('Base Class:\t')+str(bclass))
364 out.writeln(header('Base Class:\t')+str(bclass))
344 except: pass
365 except: pass
345
366
346 # String form, but snip if too long in ? form (full in ??)
367 # String form, but snip if too long in ? form (full in ??)
347 if detail_level >= self.str_detail_level:
368 if detail_level >= self.str_detail_level:
348 try:
369 try:
349 ostr = str(obj)
370 ostr = str(obj)
350 str_head = 'String Form:'
371 str_head = 'String Form:'
351 if not detail_level and len(ostr)>string_max:
372 if not detail_level and len(ostr)>string_max:
352 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
373 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
353 ostr = ("\n" + " " * len(str_head.expandtabs())).\
374 ostr = ("\n" + " " * len(str_head.expandtabs())).\
354 join(map(string.strip,ostr.split("\n")))
375 join(map(string.strip,ostr.split("\n")))
355 if ostr.find('\n') > -1:
376 if ostr.find('\n') > -1:
356 # Print multi-line strings starting at the next line.
377 # Print multi-line strings starting at the next line.
357 str_sep = '\n'
378 str_sep = '\n'
358 else:
379 else:
359 str_sep = '\t'
380 str_sep = '\t'
360 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
381 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
361 except:
382 except:
362 pass
383 pass
363
384
364 if ospace:
385 if ospace:
365 out.writeln(header('Namespace:\t')+ospace)
386 out.writeln(header('Namespace:\t')+ospace)
366
387
367 # Length (for strings and lists)
388 # Length (for strings and lists)
368 try:
389 try:
369 length = str(len(obj))
390 length = str(len(obj))
370 out.writeln(header('Length:\t\t')+length)
391 out.writeln(header('Length:\t\t')+length)
371 except: pass
392 except: pass
372
393
373 # Filename where object was defined
394 # Filename where object was defined
374 binary_file = False
395 binary_file = False
375 try:
396 try:
376 fname = inspect.getabsfile(obj)
397 fname = inspect.getabsfile(obj)
377 if fname.endswith('<string>'):
398 if fname.endswith('<string>'):
378 fname = 'Dynamically generated function. No source code available.'
399 fname = 'Dynamically generated function. No source code available.'
379 if (fname.endswith('.so') or fname.endswith('.dll') or
400 if (fname.endswith('.so') or fname.endswith('.dll') or
380 not os.path.isfile(fname)):
401 not os.path.isfile(fname)):
381 binary_file = True
402 binary_file = True
382 out.writeln(header('File:\t\t')+fname)
403 out.writeln(header('File:\t\t')+fname)
383 except:
404 except:
384 # if anything goes wrong, we don't want to show source, so it's as
405 # if anything goes wrong, we don't want to show source, so it's as
385 # if the file was binary
406 # if the file was binary
386 binary_file = True
407 binary_file = True
387
408
388 # reconstruct the function definition and print it:
409 # reconstruct the function definition and print it:
389 defln = self.__getdef(obj,oname)
410 defln = self.__getdef(obj,oname)
390 if defln:
411 if defln:
391 out.write(header('Definition:\t')+self.format(defln))
412 out.write(header('Definition:\t')+self.format(defln))
392
413
393 # Docstrings only in detail 0 mode, since source contains them (we
414 # Docstrings only in detail 0 mode, since source contains them (we
394 # avoid repetitions). If source fails, we add them back, see below.
415 # avoid repetitions). If source fails, we add them back, see below.
395 if ds and detail_level == 0:
416 if ds and detail_level == 0:
396 out.writeln(header('Docstring:\n') + indent(ds))
417 out.writeln(header('Docstring:\n') + indent(ds))
397
418
398
419
399 # Original source code for any callable
420 # Original source code for any callable
400 if detail_level:
421 if detail_level:
401 # Flush the source cache because inspect can return out-of-date source
422 # Flush the source cache because inspect can return out-of-date source
402 linecache.checkcache()
423 linecache.checkcache()
403 source_success = False
424 source_success = False
404 try:
425 try:
405 if not binary_file:
426 source = self.format(getsource(obj,binary_file))
406 source = self.format(inspect.getsource(obj))
427 if source:
407 out.write(header('Source:\n')+source.rstrip())
428 out.write(header('Source:\n')+source.rstrip())
408 source_success = True
429 source_success = True
409 except:
430 except Exception, msg:
410 pass
431 pass
411
432
412 if ds and not source_success:
433 if ds and not source_success:
413 out.writeln(header('Docstring [source file open failed]:\n') + indent(ds))
434 out.writeln(header('Docstring [source file open failed]:\n')
435 + indent(ds))
414
436
415 # Constructor docstring for classes
437 # Constructor docstring for classes
416 if obj_type is types.ClassType:
438 if obj_type is types.ClassType:
417 # reconstruct the function definition and print it:
439 # reconstruct the function definition and print it:
418 try:
440 try:
419 obj_init = obj.__init__
441 obj_init = obj.__init__
420 except AttributeError:
442 except AttributeError:
421 init_def = init_ds = None
443 init_def = init_ds = None
422 else:
444 else:
423 init_def = self.__getdef(obj_init,oname)
445 init_def = self.__getdef(obj_init,oname)
424 init_ds = getdoc(obj_init)
446 init_ds = getdoc(obj_init)
425
447
426 if init_def or init_ds:
448 if init_def or init_ds:
427 out.writeln(header('\nConstructor information:'))
449 out.writeln(header('\nConstructor information:'))
428 if init_def:
450 if init_def:
429 out.write(header('Definition:\t')+ self.format(init_def))
451 out.write(header('Definition:\t')+ self.format(init_def))
430 if init_ds:
452 if init_ds:
431 out.writeln(header('Docstring:\n') + indent(init_ds))
453 out.writeln(header('Docstring:\n') + indent(init_ds))
432 # and class docstring for instances:
454 # and class docstring for instances:
433 elif obj_type is types.InstanceType:
455 elif obj_type is types.InstanceType:
434
456
435 # First, check whether the instance docstring is identical to the
457 # First, check whether the instance docstring is identical to the
436 # class one, and print it separately if they don't coincide. In
458 # class one, and print it separately if they don't coincide. In
437 # most cases they will, but it's nice to print all the info for
459 # most cases they will, but it's nice to print all the info for
438 # objects which use instance-customized docstrings.
460 # objects which use instance-customized docstrings.
439 if ds:
461 if ds:
440 class_ds = getdoc(obj.__class__)
462 class_ds = getdoc(obj.__class__)
441 if class_ds and ds != class_ds:
463 if class_ds and ds != class_ds:
442 out.writeln(header('Class Docstring:\n') +
464 out.writeln(header('Class Docstring:\n') +
443 indent(class_ds))
465 indent(class_ds))
444
466
445 # Next, try to show constructor docstrings
467 # Next, try to show constructor docstrings
446 try:
468 try:
447 init_ds = getdoc(obj.__init__)
469 init_ds = getdoc(obj.__init__)
448 except AttributeError:
470 except AttributeError:
449 init_ds = None
471 init_ds = None
450 if init_ds:
472 if init_ds:
451 out.writeln(header('Constructor Docstring:\n') +
473 out.writeln(header('Constructor Docstring:\n') +
452 indent(init_ds))
474 indent(init_ds))
453
475
454 # Call form docstring for callable instances
476 # Call form docstring for callable instances
455 if hasattr(obj,'__call__'):
477 if hasattr(obj,'__call__'):
456 out.writeln(header('Callable:\t')+'Yes')
478 out.writeln(header('Callable:\t')+'Yes')
457 call_def = self.__getdef(obj.__call__,oname)
479 call_def = self.__getdef(obj.__call__,oname)
458 if call_def is None:
480 if call_def is None:
459 out.write(header('Call def:\t')+
481 out.write(header('Call def:\t')+
460 'Calling definition not available.')
482 'Calling definition not available.')
461 else:
483 else:
462 out.write(header('Call def:\t')+self.format(call_def))
484 out.write(header('Call def:\t')+self.format(call_def))
463 call_ds = getdoc(obj.__call__)
485 call_ds = getdoc(obj.__call__)
464 if call_ds:
486 if call_ds:
465 out.writeln(header('Call docstring:\n') + indent(call_ds))
487 out.writeln(header('Call docstring:\n') + indent(call_ds))
466
488
467 # Finally send to printer/pager
489 # Finally send to printer/pager
468 output = out.getvalue()
490 output = out.getvalue()
469 if output:
491 if output:
470 page(output)
492 page(output)
471 # end pinfo
493 # end pinfo
472
494
473 def psearch(self,pattern,ns_table,ns_search=[],
495 def psearch(self,pattern,ns_table,ns_search=[],
474 ignore_case=False,show_all=False):
496 ignore_case=False,show_all=False):
475 """Search namespaces with wildcards for objects.
497 """Search namespaces with wildcards for objects.
476
498
477 Arguments:
499 Arguments:
478
500
479 - pattern: string containing shell-like wildcards to use in namespace
501 - pattern: string containing shell-like wildcards to use in namespace
480 searches and optionally a type specification to narrow the search to
502 searches and optionally a type specification to narrow the search to
481 objects of that type.
503 objects of that type.
482
504
483 - ns_table: dict of name->namespaces for search.
505 - ns_table: dict of name->namespaces for search.
484
506
485 Optional arguments:
507 Optional arguments:
486
508
487 - ns_search: list of namespace names to include in search.
509 - ns_search: list of namespace names to include in search.
488
510
489 - ignore_case(False): make the search case-insensitive.
511 - ignore_case(False): make the search case-insensitive.
490
512
491 - show_all(False): show all names, including those starting with
513 - show_all(False): show all names, including those starting with
492 underscores.
514 underscores.
493 """
515 """
494 # defaults
516 # defaults
495 type_pattern = 'all'
517 type_pattern = 'all'
496 filter = ''
518 filter = ''
497
519
498 cmds = pattern.split()
520 cmds = pattern.split()
499 len_cmds = len(cmds)
521 len_cmds = len(cmds)
500 if len_cmds == 1:
522 if len_cmds == 1:
501 # Only filter pattern given
523 # Only filter pattern given
502 filter = cmds[0]
524 filter = cmds[0]
503 elif len_cmds == 2:
525 elif len_cmds == 2:
504 # Both filter and type specified
526 # Both filter and type specified
505 filter,type_pattern = cmds
527 filter,type_pattern = cmds
506 else:
528 else:
507 raise ValueError('invalid argument string for psearch: <%s>' %
529 raise ValueError('invalid argument string for psearch: <%s>' %
508 pattern)
530 pattern)
509
531
510 # filter search namespaces
532 # filter search namespaces
511 for name in ns_search:
533 for name in ns_search:
512 if name not in ns_table:
534 if name not in ns_table:
513 raise ValueError('invalid namespace <%s>. Valid names: %s' %
535 raise ValueError('invalid namespace <%s>. Valid names: %s' %
514 (name,ns_table.keys()))
536 (name,ns_table.keys()))
515
537
516 #print 'type_pattern:',type_pattern # dbg
538 #print 'type_pattern:',type_pattern # dbg
517 search_result = []
539 search_result = []
518 for ns_name in ns_search:
540 for ns_name in ns_search:
519 ns = ns_table[ns_name]
541 ns = ns_table[ns_name]
520 tmp_res = list(list_namespace(ns,type_pattern,filter,
542 tmp_res = list(list_namespace(ns,type_pattern,filter,
521 ignore_case=ignore_case,
543 ignore_case=ignore_case,
522 show_all=show_all))
544 show_all=show_all))
523 search_result.extend(tmp_res)
545 search_result.extend(tmp_res)
524 search_result.sort()
546 search_result.sort()
525
547
526 page('\n'.join(search_result))
548 page('\n'.join(search_result))
@@ -1,588 +1,588 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 Classes for handling input/output prompts.
3 Classes for handling input/output prompts.
4
4
5 $Id: Prompts.py 1366 2006-06-15 19:45:50Z vivainio $"""
5 $Id: Prompts.py 1850 2006-10-28 19:48:13Z fptest $"""
6
6
7 #*****************************************************************************
7 #*****************************************************************************
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
12 #*****************************************************************************
12 #*****************************************************************************
13
13
14 from IPython import Release
14 from IPython import Release
15 __author__ = '%s <%s>' % Release.authors['Fernando']
15 __author__ = '%s <%s>' % Release.authors['Fernando']
16 __license__ = Release.license
16 __license__ = Release.license
17 __version__ = Release.version
17 __version__ = Release.version
18
18
19 #****************************************************************************
19 #****************************************************************************
20 # Required modules
20 # Required modules
21 import __builtin__
21 import __builtin__
22 import os
22 import os
23 import socket
23 import socket
24 import sys
24 import sys
25 import time
25 import time
26
26
27 # IPython's own
27 # IPython's own
28 from IPython import ColorANSI
28 from IPython import ColorANSI
29 from IPython.Itpl import ItplNS
29 from IPython.Itpl import ItplNS
30 from IPython.ipstruct import Struct
30 from IPython.ipstruct import Struct
31 from IPython.macro import Macro
31 from IPython.macro import Macro
32 from IPython.genutils import *
32 from IPython.genutils import *
33
33
34 #****************************************************************************
34 #****************************************************************************
35 #Color schemes for Prompts.
35 #Color schemes for Prompts.
36
36
37 PromptColors = ColorANSI.ColorSchemeTable()
37 PromptColors = ColorANSI.ColorSchemeTable()
38 InputColors = ColorANSI.InputTermColors # just a shorthand
38 InputColors = ColorANSI.InputTermColors # just a shorthand
39 Colors = ColorANSI.TermColors # just a shorthand
39 Colors = ColorANSI.TermColors # just a shorthand
40
40
41 PromptColors.add_scheme(ColorANSI.ColorScheme(
41 PromptColors.add_scheme(ColorANSI.ColorScheme(
42 'NoColor',
42 'NoColor',
43 in_prompt = InputColors.NoColor, # Input prompt
43 in_prompt = InputColors.NoColor, # Input prompt
44 in_number = InputColors.NoColor, # Input prompt number
44 in_number = InputColors.NoColor, # Input prompt number
45 in_prompt2 = InputColors.NoColor, # Continuation prompt
45 in_prompt2 = InputColors.NoColor, # Continuation prompt
46 in_normal = InputColors.NoColor, # color off (usu. Colors.Normal)
46 in_normal = InputColors.NoColor, # color off (usu. Colors.Normal)
47
47
48 out_prompt = Colors.NoColor, # Output prompt
48 out_prompt = Colors.NoColor, # Output prompt
49 out_number = Colors.NoColor, # Output prompt number
49 out_number = Colors.NoColor, # Output prompt number
50
50
51 normal = Colors.NoColor # color off (usu. Colors.Normal)
51 normal = Colors.NoColor # color off (usu. Colors.Normal)
52 ))
52 ))
53
53
54 # make some schemes as instances so we can copy them for modification easily:
54 # make some schemes as instances so we can copy them for modification easily:
55 __PColLinux = ColorANSI.ColorScheme(
55 __PColLinux = ColorANSI.ColorScheme(
56 'Linux',
56 'Linux',
57 in_prompt = InputColors.Green,
57 in_prompt = InputColors.Green,
58 in_number = InputColors.LightGreen,
58 in_number = InputColors.LightGreen,
59 in_prompt2 = InputColors.Green,
59 in_prompt2 = InputColors.Green,
60 in_normal = InputColors.Normal, # color off (usu. Colors.Normal)
60 in_normal = InputColors.Normal, # color off (usu. Colors.Normal)
61
61
62 out_prompt = Colors.Red,
62 out_prompt = Colors.Red,
63 out_number = Colors.LightRed,
63 out_number = Colors.LightRed,
64
64
65 normal = Colors.Normal
65 normal = Colors.Normal
66 )
66 )
67 # Don't forget to enter it into the table!
67 # Don't forget to enter it into the table!
68 PromptColors.add_scheme(__PColLinux)
68 PromptColors.add_scheme(__PColLinux)
69
69
70 # Slightly modified Linux for light backgrounds
70 # Slightly modified Linux for light backgrounds
71 __PColLightBG = __PColLinux.copy('LightBG')
71 __PColLightBG = __PColLinux.copy('LightBG')
72
72
73 __PColLightBG.colors.update(
73 __PColLightBG.colors.update(
74 in_prompt = InputColors.Blue,
74 in_prompt = InputColors.Blue,
75 in_number = InputColors.LightBlue,
75 in_number = InputColors.LightBlue,
76 in_prompt2 = InputColors.Blue
76 in_prompt2 = InputColors.Blue
77 )
77 )
78 PromptColors.add_scheme(__PColLightBG)
78 PromptColors.add_scheme(__PColLightBG)
79
79
80 del Colors,InputColors
80 del Colors,InputColors
81
81
82 #-----------------------------------------------------------------------------
82 #-----------------------------------------------------------------------------
83 def multiple_replace(dict, text):
83 def multiple_replace(dict, text):
84 """ Replace in 'text' all occurences of any key in the given
84 """ Replace in 'text' all occurences of any key in the given
85 dictionary by its corresponding value. Returns the new string."""
85 dictionary by its corresponding value. Returns the new string."""
86
86
87 # Function by Xavier Defrang, originally found at:
87 # Function by Xavier Defrang, originally found at:
88 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330
88 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330
89
89
90 # Create a regular expression from the dictionary keys
90 # Create a regular expression from the dictionary keys
91 regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys())))
91 regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys())))
92 # For each match, look-up corresponding value in dictionary
92 # For each match, look-up corresponding value in dictionary
93 return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text)
93 return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text)
94
94
95 #-----------------------------------------------------------------------------
95 #-----------------------------------------------------------------------------
96 # Special characters that can be used in prompt templates, mainly bash-like
96 # Special characters that can be used in prompt templates, mainly bash-like
97
97
98 # If $HOME isn't defined (Windows), make it an absurd string so that it can
98 # If $HOME isn't defined (Windows), make it an absurd string so that it can
99 # never be expanded out into '~'. Basically anything which can never be a
99 # never be expanded out into '~'. Basically anything which can never be a
100 # reasonable directory name will do, we just want the $HOME -> '~' operation
100 # reasonable directory name will do, we just want the $HOME -> '~' operation
101 # to become a no-op. We pre-compute $HOME here so it's not done on every
101 # to become a no-op. We pre-compute $HOME here so it's not done on every
102 # prompt call.
102 # prompt call.
103
103
104 # FIXME:
104 # FIXME:
105
105
106 # - This should be turned into a class which does proper namespace management,
106 # - This should be turned into a class which does proper namespace management,
107 # since the prompt specials need to be evaluated in a certain namespace.
107 # since the prompt specials need to be evaluated in a certain namespace.
108 # Currently it's just globals, which need to be managed manually by code
108 # Currently it's just globals, which need to be managed manually by code
109 # below.
109 # below.
110
110
111 # - I also need to split up the color schemes from the prompt specials
111 # - I also need to split up the color schemes from the prompt specials
112 # somehow. I don't have a clean design for that quite yet.
112 # somehow. I don't have a clean design for that quite yet.
113
113
114 HOME = os.environ.get("HOME","//////:::::ZZZZZ,,,~~~")
114 HOME = os.environ.get("HOME","//////:::::ZZZZZ,,,~~~")
115
115
116 # We precompute a few more strings here for the prompt_specials, which are
116 # We precompute a few more strings here for the prompt_specials, which are
117 # fixed once ipython starts. This reduces the runtime overhead of computing
117 # fixed once ipython starts. This reduces the runtime overhead of computing
118 # prompt strings.
118 # prompt strings.
119 USER = os.environ.get("USER")
119 USER = os.environ.get("USER")
120 HOSTNAME = socket.gethostname()
120 HOSTNAME = socket.gethostname()
121 HOSTNAME_SHORT = HOSTNAME.split(".")[0]
121 HOSTNAME_SHORT = HOSTNAME.split(".")[0]
122 ROOT_SYMBOL = "$#"[os.name=='nt' or os.getuid()==0]
122 ROOT_SYMBOL = "$#"[os.name=='nt' or os.getuid()==0]
123
123
124 prompt_specials_color = {
124 prompt_specials_color = {
125 # Prompt/history count
125 # Prompt/history count
126 '%n' : '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
126 '%n' : '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
127 '\\#': '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
127 '\\#': '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
128 # Prompt/history count, with the actual digits replaced by dots. Used
128 # Prompt/history count, with the actual digits replaced by dots. Used
129 # mainly in continuation prompts (prompt_in2)
129 # mainly in continuation prompts (prompt_in2)
130 '\\D': '${"."*len(str(self.cache.prompt_count))}',
130 '\\D': '${"."*len(str(self.cache.prompt_count))}',
131 # Current working directory
131 # Current working directory
132 '\\w': '${os.getcwd()}',
132 '\\w': '${os.getcwd()}',
133 # Current time
133 # Current time
134 '\\t' : '${time.strftime("%H:%M:%S")}',
134 '\\t' : '${time.strftime("%H:%M:%S")}',
135 # Basename of current working directory.
135 # Basename of current working directory.
136 # (use os.sep to make this portable across OSes)
136 # (use os.sep to make this portable across OSes)
137 '\\W' : '${os.getcwd().split("%s")[-1]}' % os.sep,
137 '\\W' : '${os.getcwd().split("%s")[-1]}' % os.sep,
138 # These X<N> are an extension to the normal bash prompts. They return
138 # These X<N> are an extension to the normal bash prompts. They return
139 # N terms of the path, after replacing $HOME with '~'
139 # N terms of the path, after replacing $HOME with '~'
140 '\\X0': '${os.getcwd().replace("%s","~")}' % HOME,
140 '\\X0': '${os.getcwd().replace("%s","~")}' % HOME,
141 '\\X1': '${self.cwd_filt(1)}',
141 '\\X1': '${self.cwd_filt(1)}',
142 '\\X2': '${self.cwd_filt(2)}',
142 '\\X2': '${self.cwd_filt(2)}',
143 '\\X3': '${self.cwd_filt(3)}',
143 '\\X3': '${self.cwd_filt(3)}',
144 '\\X4': '${self.cwd_filt(4)}',
144 '\\X4': '${self.cwd_filt(4)}',
145 '\\X5': '${self.cwd_filt(5)}',
145 '\\X5': '${self.cwd_filt(5)}',
146 # Y<N> are similar to X<N>, but they show '~' if it's the directory
146 # Y<N> are similar to X<N>, but they show '~' if it's the directory
147 # N+1 in the list. Somewhat like %cN in tcsh.
147 # N+1 in the list. Somewhat like %cN in tcsh.
148 '\\Y0': '${self.cwd_filt2(0)}',
148 '\\Y0': '${self.cwd_filt2(0)}',
149 '\\Y1': '${self.cwd_filt2(1)}',
149 '\\Y1': '${self.cwd_filt2(1)}',
150 '\\Y2': '${self.cwd_filt2(2)}',
150 '\\Y2': '${self.cwd_filt2(2)}',
151 '\\Y3': '${self.cwd_filt2(3)}',
151 '\\Y3': '${self.cwd_filt2(3)}',
152 '\\Y4': '${self.cwd_filt2(4)}',
152 '\\Y4': '${self.cwd_filt2(4)}',
153 '\\Y5': '${self.cwd_filt2(5)}',
153 '\\Y5': '${self.cwd_filt2(5)}',
154 # Hostname up to first .
154 # Hostname up to first .
155 '\\h': HOSTNAME_SHORT,
155 '\\h': HOSTNAME_SHORT,
156 # Full hostname
156 # Full hostname
157 '\\H': HOSTNAME,
157 '\\H': HOSTNAME,
158 # Username of current user
158 # Username of current user
159 '\\u': USER,
159 '\\u': USER,
160 # Escaped '\'
160 # Escaped '\'
161 '\\\\': '\\',
161 '\\\\': '\\',
162 # Newline
162 # Newline
163 '\\n': '\n',
163 '\\n': '\n',
164 # Carriage return
164 # Carriage return
165 '\\r': '\r',
165 '\\r': '\r',
166 # Release version
166 # Release version
167 '\\v': __version__,
167 '\\v': __version__,
168 # Root symbol ($ or #)
168 # Root symbol ($ or #)
169 '\\$': ROOT_SYMBOL,
169 '\\$': ROOT_SYMBOL,
170 }
170 }
171
171
172 # A copy of the prompt_specials dictionary but with all color escapes removed,
172 # A copy of the prompt_specials dictionary but with all color escapes removed,
173 # so we can correctly compute the prompt length for the auto_rewrite method.
173 # so we can correctly compute the prompt length for the auto_rewrite method.
174 prompt_specials_nocolor = prompt_specials_color.copy()
174 prompt_specials_nocolor = prompt_specials_color.copy()
175 prompt_specials_nocolor['%n'] = '${self.cache.prompt_count}'
175 prompt_specials_nocolor['%n'] = '${self.cache.prompt_count}'
176 prompt_specials_nocolor['\\#'] = '${self.cache.prompt_count}'
176 prompt_specials_nocolor['\\#'] = '${self.cache.prompt_count}'
177
177
178 # Add in all the InputTermColors color escapes as valid prompt characters.
178 # Add in all the InputTermColors color escapes as valid prompt characters.
179 # They all get added as \\C_COLORNAME, so that we don't have any conflicts
179 # They all get added as \\C_COLORNAME, so that we don't have any conflicts
180 # with a color name which may begin with a letter used by any other of the
180 # with a color name which may begin with a letter used by any other of the
181 # allowed specials. This of course means that \\C will never be allowed for
181 # allowed specials. This of course means that \\C will never be allowed for
182 # anything else.
182 # anything else.
183 input_colors = ColorANSI.InputTermColors
183 input_colors = ColorANSI.InputTermColors
184 for _color in dir(input_colors):
184 for _color in dir(input_colors):
185 if _color[0] != '_':
185 if _color[0] != '_':
186 c_name = '\\C_'+_color
186 c_name = '\\C_'+_color
187 prompt_specials_color[c_name] = getattr(input_colors,_color)
187 prompt_specials_color[c_name] = getattr(input_colors,_color)
188 prompt_specials_nocolor[c_name] = ''
188 prompt_specials_nocolor[c_name] = ''
189
189
190 # we default to no color for safety. Note that prompt_specials is a global
190 # we default to no color for safety. Note that prompt_specials is a global
191 # variable used by all prompt objects.
191 # variable used by all prompt objects.
192 prompt_specials = prompt_specials_nocolor
192 prompt_specials = prompt_specials_nocolor
193
193
194 #-----------------------------------------------------------------------------
194 #-----------------------------------------------------------------------------
195 def str_safe(arg):
195 def str_safe(arg):
196 """Convert to a string, without ever raising an exception.
196 """Convert to a string, without ever raising an exception.
197
197
198 If str(arg) fails, <ERROR: ... > is returned, where ... is the exception
198 If str(arg) fails, <ERROR: ... > is returned, where ... is the exception
199 error message."""
199 error message."""
200
200
201 try:
201 try:
202 out = str(arg)
202 out = str(arg)
203 except UnicodeError:
203 except UnicodeError:
204 try:
204 try:
205 out = arg.encode('utf_8','replace')
205 out = arg.encode('utf_8','replace')
206 except Exception,msg:
206 except Exception,msg:
207 # let's keep this little duplication here, so that the most common
207 # let's keep this little duplication here, so that the most common
208 # case doesn't suffer from a double try wrapping.
208 # case doesn't suffer from a double try wrapping.
209 out = '<ERROR: %s>' % msg
209 out = '<ERROR: %s>' % msg
210 except Exception,msg:
210 except Exception,msg:
211 out = '<ERROR: %s>' % msg
211 out = '<ERROR: %s>' % msg
212 return out
212 return out
213
213
214 class BasePrompt:
214 class BasePrompt:
215 """Interactive prompt similar to Mathematica's."""
215 """Interactive prompt similar to Mathematica's."""
216 def __init__(self,cache,sep,prompt,pad_left=False):
216 def __init__(self,cache,sep,prompt,pad_left=False):
217
217
218 # Hack: we access information about the primary prompt through the
218 # Hack: we access information about the primary prompt through the
219 # cache argument. We need this, because we want the secondary prompt
219 # cache argument. We need this, because we want the secondary prompt
220 # to be aligned with the primary one. Color table info is also shared
220 # to be aligned with the primary one. Color table info is also shared
221 # by all prompt classes through the cache. Nice OO spaghetti code!
221 # by all prompt classes through the cache. Nice OO spaghetti code!
222 self.cache = cache
222 self.cache = cache
223 self.sep = sep
223 self.sep = sep
224
224
225 # regexp to count the number of spaces at the end of a prompt
225 # regexp to count the number of spaces at the end of a prompt
226 # expression, useful for prompt auto-rewriting
226 # expression, useful for prompt auto-rewriting
227 self.rspace = re.compile(r'(\s*)$')
227 self.rspace = re.compile(r'(\s*)$')
228 # Flag to left-pad prompt strings to match the length of the primary
228 # Flag to left-pad prompt strings to match the length of the primary
229 # prompt
229 # prompt
230 self.pad_left = pad_left
230 self.pad_left = pad_left
231 # Set template to create each actual prompt (where numbers change)
231 # Set template to create each actual prompt (where numbers change)
232 self.p_template = prompt
232 self.p_template = prompt
233 self.set_p_str()
233 self.set_p_str()
234
234
235 def set_p_str(self):
235 def set_p_str(self):
236 """ Set the interpolating prompt strings.
236 """ Set the interpolating prompt strings.
237
237
238 This must be called every time the color settings change, because the
238 This must be called every time the color settings change, because the
239 prompt_specials global may have changed."""
239 prompt_specials global may have changed."""
240
240
241 import os,time # needed in locals for prompt string handling
241 import os,time # needed in locals for prompt string handling
242 loc = locals()
242 loc = locals()
243 self.p_str = ItplNS('%s%s%s' %
243 self.p_str = ItplNS('%s%s%s' %
244 ('${self.sep}${self.col_p}',
244 ('${self.sep}${self.col_p}',
245 multiple_replace(prompt_specials, self.p_template),
245 multiple_replace(prompt_specials, self.p_template),
246 '${self.col_norm}'),self.cache.user_ns,loc)
246 '${self.col_norm}'),self.cache.user_ns,loc)
247
247
248 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
248 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
249 self.p_template),
249 self.p_template),
250 self.cache.user_ns,loc)
250 self.cache.user_ns,loc)
251
251
252 def write(self,msg): # dbg
252 def write(self,msg): # dbg
253 sys.stdout.write(msg)
253 sys.stdout.write(msg)
254 return ''
254 return ''
255
255
256 def __str__(self):
256 def __str__(self):
257 """Return a string form of the prompt.
257 """Return a string form of the prompt.
258
258
259 This for is useful for continuation and output prompts, since it is
259 This for is useful for continuation and output prompts, since it is
260 left-padded to match lengths with the primary one (if the
260 left-padded to match lengths with the primary one (if the
261 self.pad_left attribute is set)."""
261 self.pad_left attribute is set)."""
262
262
263 out_str = str_safe(self.p_str)
263 out_str = str_safe(self.p_str)
264 if self.pad_left:
264 if self.pad_left:
265 # We must find the amount of padding required to match lengths,
265 # We must find the amount of padding required to match lengths,
266 # taking the color escapes (which are invisible on-screen) into
266 # taking the color escapes (which are invisible on-screen) into
267 # account.
267 # account.
268 esc_pad = len(out_str) - len(str_safe(self.p_str_nocolor))
268 esc_pad = len(out_str) - len(str_safe(self.p_str_nocolor))
269 format = '%%%ss' % (len(str(self.cache.last_prompt))+esc_pad)
269 format = '%%%ss' % (len(str(self.cache.last_prompt))+esc_pad)
270 return format % out_str
270 return format % out_str
271 else:
271 else:
272 return out_str
272 return out_str
273
273
274 # these path filters are put in as methods so that we can control the
274 # these path filters are put in as methods so that we can control the
275 # namespace where the prompt strings get evaluated
275 # namespace where the prompt strings get evaluated
276 def cwd_filt(self,depth):
276 def cwd_filt(self,depth):
277 """Return the last depth elements of the current working directory.
277 """Return the last depth elements of the current working directory.
278
278
279 $HOME is always replaced with '~'.
279 $HOME is always replaced with '~'.
280 If depth==0, the full path is returned."""
280 If depth==0, the full path is returned."""
281
281
282 cwd = os.getcwd().replace(HOME,"~")
282 cwd = os.getcwd().replace(HOME,"~")
283 out = os.sep.join(cwd.split(os.sep)[-depth:])
283 out = os.sep.join(cwd.split(os.sep)[-depth:])
284 if out:
284 if out:
285 return out
285 return out
286 else:
286 else:
287 return os.sep
287 return os.sep
288
288
289 def cwd_filt2(self,depth):
289 def cwd_filt2(self,depth):
290 """Return the last depth elements of the current working directory.
290 """Return the last depth elements of the current working directory.
291
291
292 $HOME is always replaced with '~'.
292 $HOME is always replaced with '~'.
293 If depth==0, the full path is returned."""
293 If depth==0, the full path is returned."""
294
294
295 cwd = os.getcwd().replace(HOME,"~").split(os.sep)
295 cwd = os.getcwd().replace(HOME,"~").split(os.sep)
296 if '~' in cwd and len(cwd) == depth+1:
296 if '~' in cwd and len(cwd) == depth+1:
297 depth += 1
297 depth += 1
298 out = os.sep.join(cwd[-depth:])
298 out = os.sep.join(cwd[-depth:])
299 if out:
299 if out:
300 return out
300 return out
301 else:
301 else:
302 return os.sep
302 return os.sep
303
303
304 class Prompt1(BasePrompt):
304 class Prompt1(BasePrompt):
305 """Input interactive prompt similar to Mathematica's."""
305 """Input interactive prompt similar to Mathematica's."""
306
306
307 def __init__(self,cache,sep='\n',prompt='In [\\#]: ',pad_left=True):
307 def __init__(self,cache,sep='\n',prompt='In [\\#]: ',pad_left=True):
308 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
308 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
309
309
310 def set_colors(self):
310 def set_colors(self):
311 self.set_p_str()
311 self.set_p_str()
312 Colors = self.cache.color_table.active_colors # shorthand
312 Colors = self.cache.color_table.active_colors # shorthand
313 self.col_p = Colors.in_prompt
313 self.col_p = Colors.in_prompt
314 self.col_num = Colors.in_number
314 self.col_num = Colors.in_number
315 self.col_norm = Colors.in_normal
315 self.col_norm = Colors.in_normal
316 # We need a non-input version of these escapes for the '--->'
316 # We need a non-input version of these escapes for the '--->'
317 # auto-call prompts used in the auto_rewrite() method.
317 # auto-call prompts used in the auto_rewrite() method.
318 self.col_p_ni = self.col_p.replace('\001','').replace('\002','')
318 self.col_p_ni = self.col_p.replace('\001','').replace('\002','')
319 self.col_norm_ni = Colors.normal
319 self.col_norm_ni = Colors.normal
320
320
321 def __str__(self):
321 def __str__(self):
322 self.cache.prompt_count += 1
322 self.cache.prompt_count += 1
323 self.cache.last_prompt = str_safe(self.p_str_nocolor).split('\n')[-1]
323 self.cache.last_prompt = str_safe(self.p_str_nocolor).split('\n')[-1]
324 return str_safe(self.p_str)
324 return str_safe(self.p_str)
325
325
326 def auto_rewrite(self):
326 def auto_rewrite(self):
327 """Print a string of the form '--->' which lines up with the previous
327 """Print a string of the form '--->' which lines up with the previous
328 input string. Useful for systems which re-write the user input when
328 input string. Useful for systems which re-write the user input when
329 handling automatically special syntaxes."""
329 handling automatically special syntaxes."""
330
330
331 curr = str(self.cache.last_prompt)
331 curr = str(self.cache.last_prompt)
332 nrspaces = len(self.rspace.search(curr).group())
332 nrspaces = len(self.rspace.search(curr).group())
333 return '%s%s>%s%s' % (self.col_p_ni,'-'*(len(curr)-nrspaces-1),
333 return '%s%s>%s%s' % (self.col_p_ni,'-'*(len(curr)-nrspaces-1),
334 ' '*nrspaces,self.col_norm_ni)
334 ' '*nrspaces,self.col_norm_ni)
335
335
336 class PromptOut(BasePrompt):
336 class PromptOut(BasePrompt):
337 """Output interactive prompt similar to Mathematica's."""
337 """Output interactive prompt similar to Mathematica's."""
338
338
339 def __init__(self,cache,sep='',prompt='Out[\\#]: ',pad_left=True):
339 def __init__(self,cache,sep='',prompt='Out[\\#]: ',pad_left=True):
340 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
340 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
341 if not self.p_template:
341 if not self.p_template:
342 self.__str__ = lambda: ''
342 self.__str__ = lambda: ''
343
343
344 def set_colors(self):
344 def set_colors(self):
345 self.set_p_str()
345 self.set_p_str()
346 Colors = self.cache.color_table.active_colors # shorthand
346 Colors = self.cache.color_table.active_colors # shorthand
347 self.col_p = Colors.out_prompt
347 self.col_p = Colors.out_prompt
348 self.col_num = Colors.out_number
348 self.col_num = Colors.out_number
349 self.col_norm = Colors.normal
349 self.col_norm = Colors.normal
350
350
351 class Prompt2(BasePrompt):
351 class Prompt2(BasePrompt):
352 """Interactive continuation prompt."""
352 """Interactive continuation prompt."""
353
353
354 def __init__(self,cache,prompt=' .\\D.: ',pad_left=True):
354 def __init__(self,cache,prompt=' .\\D.: ',pad_left=True):
355 self.cache = cache
355 self.cache = cache
356 self.p_template = prompt
356 self.p_template = prompt
357 self.pad_left = pad_left
357 self.pad_left = pad_left
358 self.set_p_str()
358 self.set_p_str()
359
359
360 def set_p_str(self):
360 def set_p_str(self):
361 import os,time # needed in locals for prompt string handling
361 import os,time # needed in locals for prompt string handling
362 loc = locals()
362 loc = locals()
363 self.p_str = ItplNS('%s%s%s' %
363 self.p_str = ItplNS('%s%s%s' %
364 ('${self.col_p2}',
364 ('${self.col_p2}',
365 multiple_replace(prompt_specials, self.p_template),
365 multiple_replace(prompt_specials, self.p_template),
366 '$self.col_norm'),
366 '$self.col_norm'),
367 self.cache.user_ns,loc)
367 self.cache.user_ns,loc)
368 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
368 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
369 self.p_template),
369 self.p_template),
370 self.cache.user_ns,loc)
370 self.cache.user_ns,loc)
371
371
372 def set_colors(self):
372 def set_colors(self):
373 self.set_p_str()
373 self.set_p_str()
374 Colors = self.cache.color_table.active_colors
374 Colors = self.cache.color_table.active_colors
375 self.col_p2 = Colors.in_prompt2
375 self.col_p2 = Colors.in_prompt2
376 self.col_norm = Colors.in_normal
376 self.col_norm = Colors.in_normal
377 # FIXME (2004-06-16) HACK: prevent crashes for users who haven't
377 # FIXME (2004-06-16) HACK: prevent crashes for users who haven't
378 # updated their prompt_in2 definitions. Remove eventually.
378 # updated their prompt_in2 definitions. Remove eventually.
379 self.col_p = Colors.out_prompt
379 self.col_p = Colors.out_prompt
380 self.col_num = Colors.out_number
380 self.col_num = Colors.out_number
381
381
382
382
383 #-----------------------------------------------------------------------------
383 #-----------------------------------------------------------------------------
384 class CachedOutput:
384 class CachedOutput:
385 """Class for printing output from calculations while keeping a cache of
385 """Class for printing output from calculations while keeping a cache of
386 reults. It dynamically creates global variables prefixed with _ which
386 reults. It dynamically creates global variables prefixed with _ which
387 contain these results.
387 contain these results.
388
388
389 Meant to be used as a sys.displayhook replacement, providing numbered
389 Meant to be used as a sys.displayhook replacement, providing numbered
390 prompts and cache services.
390 prompts and cache services.
391
391
392 Initialize with initial and final values for cache counter (this defines
392 Initialize with initial and final values for cache counter (this defines
393 the maximum size of the cache."""
393 the maximum size of the cache."""
394
394
395 def __init__(self,shell,cache_size,Pprint,
395 def __init__(self,shell,cache_size,Pprint,
396 colors='NoColor',input_sep='\n',
396 colors='NoColor',input_sep='\n',
397 output_sep='\n',output_sep2='',
397 output_sep='\n',output_sep2='',
398 ps1 = None, ps2 = None,ps_out = None,pad_left=True):
398 ps1 = None, ps2 = None,ps_out = None,pad_left=True):
399
399
400 cache_size_min = 3
400 cache_size_min = 3
401 if cache_size <= 0:
401 if cache_size <= 0:
402 self.do_full_cache = 0
402 self.do_full_cache = 0
403 cache_size = 0
403 cache_size = 0
404 elif cache_size < cache_size_min:
404 elif cache_size < cache_size_min:
405 self.do_full_cache = 0
405 self.do_full_cache = 0
406 cache_size = 0
406 cache_size = 0
407 warn('caching was disabled (min value for cache size is %s).' %
407 warn('caching was disabled (min value for cache size is %s).' %
408 cache_size_min,level=3)
408 cache_size_min,level=3)
409 else:
409 else:
410 self.do_full_cache = 1
410 self.do_full_cache = 1
411
411
412 self.cache_size = cache_size
412 self.cache_size = cache_size
413 self.input_sep = input_sep
413 self.input_sep = input_sep
414
414
415 # we need a reference to the user-level namespace
415 # we need a reference to the user-level namespace
416 self.shell = shell
416 self.shell = shell
417 self.user_ns = shell.user_ns
417 self.user_ns = shell.user_ns
418 # and to the user's input
418 # and to the user's input
419 self.input_hist = shell.input_hist
419 self.input_hist = shell.input_hist
420 # and to the user's logger, for logging output
420 # and to the user's logger, for logging output
421 self.logger = shell.logger
421 self.logger = shell.logger
422
422
423 # Set input prompt strings and colors
423 # Set input prompt strings and colors
424 if cache_size == 0:
424 if cache_size == 0:
425 if ps1.find('%n') > -1 or ps1.find('\\#') > -1: ps1 = '>>> '
425 if ps1.find('%n') > -1 or ps1.find('\\#') > -1: ps1 = '>>> '
426 if ps2.find('%n') > -1 or ps2.find('\\#') > -1: ps2 = '... '
426 if ps2.find('%n') > -1 or ps2.find('\\#') > -1: ps2 = '... '
427 self.ps1_str = self._set_prompt_str(ps1,'In [\\#]: ','>>> ')
427 self.ps1_str = self._set_prompt_str(ps1,'In [\\#]: ','>>> ')
428 self.ps2_str = self._set_prompt_str(ps2,' .\\D.: ','... ')
428 self.ps2_str = self._set_prompt_str(ps2,' .\\D.: ','... ')
429 self.ps_out_str = self._set_prompt_str(ps_out,'Out[\\#]: ','')
429 self.ps_out_str = self._set_prompt_str(ps_out,'Out[\\#]: ','')
430
430
431 self.color_table = PromptColors
431 self.color_table = PromptColors
432 self.prompt1 = Prompt1(self,sep=input_sep,prompt=self.ps1_str,
432 self.prompt1 = Prompt1(self,sep=input_sep,prompt=self.ps1_str,
433 pad_left=pad_left)
433 pad_left=pad_left)
434 self.prompt2 = Prompt2(self,prompt=self.ps2_str,pad_left=pad_left)
434 self.prompt2 = Prompt2(self,prompt=self.ps2_str,pad_left=pad_left)
435 self.prompt_out = PromptOut(self,sep='',prompt=self.ps_out_str,
435 self.prompt_out = PromptOut(self,sep='',prompt=self.ps_out_str,
436 pad_left=pad_left)
436 pad_left=pad_left)
437 self.set_colors(colors)
437 self.set_colors(colors)
438
438
439 # other more normal stuff
439 # other more normal stuff
440 # b/c each call to the In[] prompt raises it by 1, even the first.
440 # b/c each call to the In[] prompt raises it by 1, even the first.
441 self.prompt_count = 0
441 self.prompt_count = 0
442 # Store the last prompt string each time, we need it for aligning
442 # Store the last prompt string each time, we need it for aligning
443 # continuation and auto-rewrite prompts
443 # continuation and auto-rewrite prompts
444 self.last_prompt = ''
444 self.last_prompt = ''
445 self.Pprint = Pprint
445 self.Pprint = Pprint
446 self.output_sep = output_sep
446 self.output_sep = output_sep
447 self.output_sep2 = output_sep2
447 self.output_sep2 = output_sep2
448 self._,self.__,self.___ = '','',''
448 self._,self.__,self.___ = '','',''
449 self.pprint_types = map(type,[(),[],{}])
449 self.pprint_types = map(type,[(),[],{}])
450
450
451 # these are deliberately global:
451 # these are deliberately global:
452 to_user_ns = {'_':self._,'__':self.__,'___':self.___}
452 to_user_ns = {'_':self._,'__':self.__,'___':self.___}
453 self.user_ns.update(to_user_ns)
453 self.user_ns.update(to_user_ns)
454
454
455 def _set_prompt_str(self,p_str,cache_def,no_cache_def):
455 def _set_prompt_str(self,p_str,cache_def,no_cache_def):
456 if p_str is None:
456 if p_str is None:
457 if self.do_full_cache:
457 if self.do_full_cache:
458 return cache_def
458 return cache_def
459 else:
459 else:
460 return no_cache_def
460 return no_cache_def
461 else:
461 else:
462 return p_str
462 return p_str
463
463
464 def set_colors(self,colors):
464 def set_colors(self,colors):
465 """Set the active color scheme and configure colors for the three
465 """Set the active color scheme and configure colors for the three
466 prompt subsystems."""
466 prompt subsystems."""
467
467
468 # FIXME: the prompt_specials global should be gobbled inside this
468 # FIXME: the prompt_specials global should be gobbled inside this
469 # class instead. Do it when cleaning up the whole 3-prompt system.
469 # class instead. Do it when cleaning up the whole 3-prompt system.
470 global prompt_specials
470 global prompt_specials
471 if colors.lower()=='nocolor':
471 if colors.lower()=='nocolor':
472 prompt_specials = prompt_specials_nocolor
472 prompt_specials = prompt_specials_nocolor
473 else:
473 else:
474 prompt_specials = prompt_specials_color
474 prompt_specials = prompt_specials_color
475
475
476 self.color_table.set_active_scheme(colors)
476 self.color_table.set_active_scheme(colors)
477 self.prompt1.set_colors()
477 self.prompt1.set_colors()
478 self.prompt2.set_colors()
478 self.prompt2.set_colors()
479 self.prompt_out.set_colors()
479 self.prompt_out.set_colors()
480
480
481 def __call__(self,arg=None):
481 def __call__(self,arg=None):
482 """Printing with history cache management.
482 """Printing with history cache management.
483
483
484 This is invoked everytime the interpreter needs to print, and is
484 This is invoked everytime the interpreter needs to print, and is
485 activated by setting the variable sys.displayhook to it."""
485 activated by setting the variable sys.displayhook to it."""
486
486
487 # If something injected a '_' variable in __builtin__, delete
487 # If something injected a '_' variable in __builtin__, delete
488 # ipython's automatic one so we don't clobber that. gettext() in
488 # ipython's automatic one so we don't clobber that. gettext() in
489 # particular uses _, so we need to stay away from it.
489 # particular uses _, so we need to stay away from it.
490 if '_' in __builtin__.__dict__:
490 if '_' in __builtin__.__dict__:
491 try:
491 try:
492 del self.user_ns['_']
492 del self.user_ns['_']
493 except KeyError:
493 except KeyError:
494 pass
494 pass
495 if arg is not None:
495 if arg is not None:
496 cout_write = Term.cout.write # fast lookup
496 cout_write = Term.cout.write # fast lookup
497 # first handle the cache and counters
497 # first handle the cache and counters
498
498
499 # do not print output if input ends in ';'
499 # do not print output if input ends in ';'
500 if self.input_hist[self.prompt_count].endswith(';\n'):
500 if self.input_hist[self.prompt_count].endswith(';\n'):
501 return
501 return
502 # don't use print, puts an extra space
502 # don't use print, puts an extra space
503 cout_write(self.output_sep)
503 cout_write(self.output_sep)
504 outprompt = self.shell.hooks.generate_output_prompt()
504 outprompt = self.shell.hooks.generate_output_prompt()
505 if self.do_full_cache:
505 if self.do_full_cache:
506 cout_write(outprompt)
506 cout_write(outprompt)
507
507
508 if isinstance(arg,Macro):
508 if isinstance(arg,Macro):
509 print 'Executing Macro...'
509 print 'Executing Macro...'
510 # in case the macro takes a long time to execute
510 # in case the macro takes a long time to execute
511 Term.cout.flush()
511 Term.cout.flush()
512 self.shell.runlines(arg.value)
512 self.shell.runlines(arg.value)
513 return None
513 return None
514
514
515 # and now call a possibly user-defined print mechanism
515 # and now call a possibly user-defined print mechanism
516 manipulated_val = self.display(arg)
516 manipulated_val = self.display(arg)
517
517
518 # user display hooks can change the variable to be stored in
518 # user display hooks can change the variable to be stored in
519 # output history
519 # output history
520
520
521 if manipulated_val is not None:
521 if manipulated_val is not None:
522 arg = manipulated_val
522 arg = manipulated_val
523
523
524 # avoid recursive reference when displaying _oh/Out
524 # avoid recursive reference when displaying _oh/Out
525 if arg is not self.user_ns['_oh']:
525 if arg is not self.user_ns['_oh']:
526 self.update(arg)
526 self.update(arg)
527
527
528 if self.logger.log_output:
528 if self.logger.log_output:
529 self.logger.log_write(repr(arg),'output')
529 self.logger.log_write(repr(arg),'output')
530 cout_write(self.output_sep2)
530 cout_write(self.output_sep2)
531 Term.cout.flush()
531 Term.cout.flush()
532
532
533 def _display(self,arg):
533 def _display(self,arg):
534 """Default printer method, uses pprint.
534 """Default printer method, uses pprint.
535
535
536 Do ip.set_hook("result_display", my_displayhook) for custom result
536 Do ip.set_hook("result_display", my_displayhook) for custom result
537 display, e.g. when your own objects need special formatting.
537 display, e.g. when your own objects need special formatting.
538 """
538 """
539
539
540 return self.shell.hooks.result_display(arg)
540 return self.shell.hooks.result_display(arg)
541
541
542 # Assign the default display method:
542 # Assign the default display method:
543 display = _display
543 display = _display
544
544
545 def update(self,arg):
545 def update(self,arg):
546 #print '***cache_count', self.cache_count # dbg
546 #print '***cache_count', self.cache_count # dbg
547 if len(self.user_ns['_oh']) >= self.cache_size and self.do_full_cache:
547 if len(self.user_ns['_oh']) >= self.cache_size and self.do_full_cache:
548 warn('Output cache limit (currently '+
548 warn('Output cache limit (currently '+
549 `self.cache_size`+' entries) hit.\n'
549 `self.cache_size`+' entries) hit.\n'
550 'Flushing cache and resetting history counter...\n'
550 'Flushing cache and resetting history counter...\n'
551 'The only history variables available will be _,__,___ and _1\n'
551 'The only history variables available will be _,__,___ and _1\n'
552 'with the current result.')
552 'with the current result.')
553
553
554 self.flush()
554 self.flush()
555 # Don't overwrite '_' and friends if '_' is in __builtin__ (otherwise
555 # Don't overwrite '_' and friends if '_' is in __builtin__ (otherwise
556 # we cause buggy behavior for things like gettext).
556 # we cause buggy behavior for things like gettext).
557 if '_' not in __builtin__.__dict__:
557 if '_' not in __builtin__.__dict__:
558 self.___ = self.__
558 self.___ = self.__
559 self.__ = self._
559 self.__ = self._
560 self._ = arg
560 self._ = arg
561 self.user_ns.update({'_':self._,'__':self.__,'___':self.___})
561 self.user_ns.update({'_':self._,'__':self.__,'___':self.___})
562
562
563 # hackish access to top-level namespace to create _1,_2... dynamically
563 # hackish access to top-level namespace to create _1,_2... dynamically
564 to_main = {}
564 to_main = {}
565 if self.do_full_cache:
565 if self.do_full_cache:
566 new_result = '_'+`self.prompt_count`
566 new_result = '_'+`self.prompt_count`
567 to_main[new_result] = arg
567 to_main[new_result] = arg
568 self.user_ns.update(to_main)
568 self.user_ns.update(to_main)
569 self.user_ns['_oh'][self.prompt_count] = arg
569 self.user_ns['_oh'][self.prompt_count] = arg
570
570
571 def flush(self):
571 def flush(self):
572 if not self.do_full_cache:
572 if not self.do_full_cache:
573 raise ValueError,"You shouldn't have reached the cache flush "\
573 raise ValueError,"You shouldn't have reached the cache flush "\
574 "if full caching is not enabled!"
574 "if full caching is not enabled!"
575 # delete auto-generated vars from global namespace
575 # delete auto-generated vars from global namespace
576
576
577 for n in range(1,self.prompt_count + 1):
577 for n in range(1,self.prompt_count + 1):
578 key = '_'+`n`
578 key = '_'+`n`
579 try:
579 try:
580 del self.user_ns[key]
580 del self.user_ns[key]
581 except: pass
581 except: pass
582 self.user_ns['_oh'].clear()
582 self.user_ns['_oh'].clear()
583
583
584 if '_' not in __builtin__.__dict__:
584 if '_' not in __builtin__.__dict__:
585 self.user_ns.update({'_':None,'__':None, '___':None})
585 self.user_ns.update({'_':None,'__':None, '___':None})
586 import gc
586 import gc
587 gc.collect() # xxx needed?
587 gc.collect() # xxx needed?
588
588
@@ -1,2432 +1,2434 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.3 or newer.
5 Requires Python 2.3 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 1828 2006-10-16 02:04:33Z fptest $
9 $Id: iplib.py 1850 2006-10-28 19:48:13Z fptest $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pdb
50 import pdb
51 import pydoc
51 import pydoc
52 import re
52 import re
53 import shutil
53 import shutil
54 import string
54 import string
55 import sys
55 import sys
56 import tempfile
56 import tempfile
57 import traceback
57 import traceback
58 import types
58 import types
59 import pickleshare
59 import pickleshare
60 from sets import Set
60 from sets import Set
61 from pprint import pprint, pformat
61 from pprint import pprint, pformat
62
62
63 # IPython's own modules
63 # IPython's own modules
64 import IPython
64 import IPython
65 from IPython import OInspect,PyColorize,ultraTB
65 from IPython import OInspect,PyColorize,ultraTB
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.FakeModule import FakeModule
67 from IPython.FakeModule import FakeModule
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 from IPython.Logger import Logger
69 from IPython.Logger import Logger
70 from IPython.Magic import Magic
70 from IPython.Magic import Magic
71 from IPython.Prompts import CachedOutput
71 from IPython.Prompts import CachedOutput
72 from IPython.ipstruct import Struct
72 from IPython.ipstruct import Struct
73 from IPython.background_jobs import BackgroundJobManager
73 from IPython.background_jobs import BackgroundJobManager
74 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.genutils import *
75 from IPython.genutils import *
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class Quitter(object):
129 class Quitter(object):
130 """Simple class to handle exit, similar to Python 2.5's.
130 """Simple class to handle exit, similar to Python 2.5's.
131
131
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
133 doesn't do (obviously, since it doesn't know about ipython)."""
133 doesn't do (obviously, since it doesn't know about ipython)."""
134
134
135 def __init__(self,shell,name):
135 def __init__(self,shell,name):
136 self.shell = shell
136 self.shell = shell
137 self.name = name
137 self.name = name
138
138
139 def __repr__(self):
139 def __repr__(self):
140 return 'Type %s() to exit.' % self.name
140 return 'Type %s() to exit.' % self.name
141 __str__ = __repr__
141 __str__ = __repr__
142
142
143 def __call__(self):
143 def __call__(self):
144 self.shell.exit()
144 self.shell.exit()
145
145
146 class InputList(list):
146 class InputList(list):
147 """Class to store user input.
147 """Class to store user input.
148
148
149 It's basically a list, but slices return a string instead of a list, thus
149 It's basically a list, but slices return a string instead of a list, thus
150 allowing things like (assuming 'In' is an instance):
150 allowing things like (assuming 'In' is an instance):
151
151
152 exec In[4:7]
152 exec In[4:7]
153
153
154 or
154 or
155
155
156 exec In[5:9] + In[14] + In[21:25]"""
156 exec In[5:9] + In[14] + In[21:25]"""
157
157
158 def __getslice__(self,i,j):
158 def __getslice__(self,i,j):
159 return ''.join(list.__getslice__(self,i,j))
159 return ''.join(list.__getslice__(self,i,j))
160
160
161 class SyntaxTB(ultraTB.ListTB):
161 class SyntaxTB(ultraTB.ListTB):
162 """Extension which holds some state: the last exception value"""
162 """Extension which holds some state: the last exception value"""
163
163
164 def __init__(self,color_scheme = 'NoColor'):
164 def __init__(self,color_scheme = 'NoColor'):
165 ultraTB.ListTB.__init__(self,color_scheme)
165 ultraTB.ListTB.__init__(self,color_scheme)
166 self.last_syntax_error = None
166 self.last_syntax_error = None
167
167
168 def __call__(self, etype, value, elist):
168 def __call__(self, etype, value, elist):
169 self.last_syntax_error = value
169 self.last_syntax_error = value
170 ultraTB.ListTB.__call__(self,etype,value,elist)
170 ultraTB.ListTB.__call__(self,etype,value,elist)
171
171
172 def clear_err_state(self):
172 def clear_err_state(self):
173 """Return the current error state and clear it"""
173 """Return the current error state and clear it"""
174 e = self.last_syntax_error
174 e = self.last_syntax_error
175 self.last_syntax_error = None
175 self.last_syntax_error = None
176 return e
176 return e
177
177
178 #****************************************************************************
178 #****************************************************************************
179 # Main IPython class
179 # Main IPython class
180
180
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
182 # until a full rewrite is made. I've cleaned all cross-class uses of
182 # until a full rewrite is made. I've cleaned all cross-class uses of
183 # attributes and methods, but too much user code out there relies on the
183 # attributes and methods, but too much user code out there relies on the
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
185 #
185 #
186 # But at least now, all the pieces have been separated and we could, in
186 # But at least now, all the pieces have been separated and we could, in
187 # principle, stop using the mixin. This will ease the transition to the
187 # principle, stop using the mixin. This will ease the transition to the
188 # chainsaw branch.
188 # chainsaw branch.
189
189
190 # For reference, the following is the list of 'self.foo' uses in the Magic
190 # For reference, the following is the list of 'self.foo' uses in the Magic
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
192 # class, to prevent clashes.
192 # class, to prevent clashes.
193
193
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 # 'self.value']
197 # 'self.value']
198
198
199 class InteractiveShell(object,Magic):
199 class InteractiveShell(object,Magic):
200 """An enhanced console for Python."""
200 """An enhanced console for Python."""
201
201
202 # class attribute to indicate whether the class supports threads or not.
202 # class attribute to indicate whether the class supports threads or not.
203 # Subclasses with thread support should override this as needed.
203 # Subclasses with thread support should override this as needed.
204 isthreaded = False
204 isthreaded = False
205
205
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
207 user_ns = None,user_global_ns=None,banner2='',
207 user_ns = None,user_global_ns=None,banner2='',
208 custom_exceptions=((),None),embedded=False):
208 custom_exceptions=((),None),embedded=False):
209
209
210 # log system
210 # log system
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212
212
213 # some minimal strict typechecks. For some core data structures, I
213 # some minimal strict typechecks. For some core data structures, I
214 # want actual basic python types, not just anything that looks like
214 # want actual basic python types, not just anything that looks like
215 # one. This is especially true for namespaces.
215 # one. This is especially true for namespaces.
216 for ns in (user_ns,user_global_ns):
216 for ns in (user_ns,user_global_ns):
217 if ns is not None and type(ns) != types.DictType:
217 if ns is not None and type(ns) != types.DictType:
218 raise TypeError,'namespace must be a dictionary'
218 raise TypeError,'namespace must be a dictionary'
219
219
220 # Job manager (for jobs run as background threads)
220 # Job manager (for jobs run as background threads)
221 self.jobs = BackgroundJobManager()
221 self.jobs = BackgroundJobManager()
222
222
223 # Store the actual shell's name
223 # Store the actual shell's name
224 self.name = name
224 self.name = name
225
225
226 # We need to know whether the instance is meant for embedding, since
226 # We need to know whether the instance is meant for embedding, since
227 # global/local namespaces need to be handled differently in that case
227 # global/local namespaces need to be handled differently in that case
228 self.embedded = embedded
228 self.embedded = embedded
229
229
230 # command compiler
230 # command compiler
231 self.compile = codeop.CommandCompiler()
231 self.compile = codeop.CommandCompiler()
232
232
233 # User input buffer
233 # User input buffer
234 self.buffer = []
234 self.buffer = []
235
235
236 # Default name given in compilation of code
236 # Default name given in compilation of code
237 self.filename = '<ipython console>'
237 self.filename = '<ipython console>'
238
238
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
241 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.exit = Quitter(self,'exit')
242 __builtin__.quit = Quitter(self,'quit')
242 __builtin__.quit = Quitter(self,'quit')
243
243
244 # Make an empty namespace, which extension writers can rely on both
244 # Make an empty namespace, which extension writers can rely on both
245 # existing and NEVER being used by ipython itself. This gives them a
245 # existing and NEVER being used by ipython itself. This gives them a
246 # convenient location for storing additional information and state
246 # convenient location for storing additional information and state
247 # their extensions may require, without fear of collisions with other
247 # their extensions may require, without fear of collisions with other
248 # ipython names that may develop later.
248 # ipython names that may develop later.
249 self.meta = Struct()
249 self.meta = Struct()
250
250
251 # Create the namespace where the user will operate. user_ns is
251 # Create the namespace where the user will operate. user_ns is
252 # normally the only one used, and it is passed to the exec calls as
252 # normally the only one used, and it is passed to the exec calls as
253 # the locals argument. But we do carry a user_global_ns namespace
253 # the locals argument. But we do carry a user_global_ns namespace
254 # given as the exec 'globals' argument, This is useful in embedding
254 # given as the exec 'globals' argument, This is useful in embedding
255 # situations where the ipython shell opens in a context where the
255 # situations where the ipython shell opens in a context where the
256 # distinction between locals and globals is meaningful.
256 # distinction between locals and globals is meaningful.
257
257
258 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # FIXME. For some strange reason, __builtins__ is showing up at user
259 # level as a dict instead of a module. This is a manual fix, but I
259 # level as a dict instead of a module. This is a manual fix, but I
260 # should really track down where the problem is coming from. Alex
260 # should really track down where the problem is coming from. Alex
261 # Schmolck reported this problem first.
261 # Schmolck reported this problem first.
262
262
263 # A useful post by Alex Martelli on this topic:
263 # A useful post by Alex Martelli on this topic:
264 # Re: inconsistent value from __builtins__
264 # Re: inconsistent value from __builtins__
265 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Von: Alex Martelli <aleaxit@yahoo.com>
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 # Gruppen: comp.lang.python
267 # Gruppen: comp.lang.python
268
268
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 # > <type 'dict'>
271 # > <type 'dict'>
272 # > >>> print type(__builtins__)
272 # > >>> print type(__builtins__)
273 # > <type 'module'>
273 # > <type 'module'>
274 # > Is this difference in return value intentional?
274 # > Is this difference in return value intentional?
275
275
276 # Well, it's documented that '__builtins__' can be either a dictionary
276 # Well, it's documented that '__builtins__' can be either a dictionary
277 # or a module, and it's been that way for a long time. Whether it's
277 # or a module, and it's been that way for a long time. Whether it's
278 # intentional (or sensible), I don't know. In any case, the idea is
278 # intentional (or sensible), I don't know. In any case, the idea is
279 # that if you need to access the built-in namespace directly, you
279 # that if you need to access the built-in namespace directly, you
280 # should start with "import __builtin__" (note, no 's') which will
280 # should start with "import __builtin__" (note, no 's') which will
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282
282
283 # These routines return properly built dicts as needed by the rest of
283 # These routines return properly built dicts as needed by the rest of
284 # the code, and can also be used by extension writers to generate
284 # the code, and can also be used by extension writers to generate
285 # properly initialized namespaces.
285 # properly initialized namespaces.
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
288
288
289 # Assign namespaces
289 # Assign namespaces
290 # This is the namespace where all normal user variables live
290 # This is the namespace where all normal user variables live
291 self.user_ns = user_ns
291 self.user_ns = user_ns
292 # Embedded instances require a separate namespace for globals.
292 # Embedded instances require a separate namespace for globals.
293 # Normally this one is unused by non-embedded instances.
293 # Normally this one is unused by non-embedded instances.
294 self.user_global_ns = user_global_ns
294 self.user_global_ns = user_global_ns
295 # A namespace to keep track of internal data structures to prevent
295 # A namespace to keep track of internal data structures to prevent
296 # them from cluttering user-visible stuff. Will be updated later
296 # them from cluttering user-visible stuff. Will be updated later
297 self.internal_ns = {}
297 self.internal_ns = {}
298
298
299 # Namespace of system aliases. Each entry in the alias
299 # Namespace of system aliases. Each entry in the alias
300 # table must be a 2-tuple of the form (N,name), where N is the number
300 # table must be a 2-tuple of the form (N,name), where N is the number
301 # of positional arguments of the alias.
301 # of positional arguments of the alias.
302 self.alias_table = {}
302 self.alias_table = {}
303
303
304 # A table holding all the namespaces IPython deals with, so that
304 # A table holding all the namespaces IPython deals with, so that
305 # introspection facilities can search easily.
305 # introspection facilities can search easily.
306 self.ns_table = {'user':user_ns,
306 self.ns_table = {'user':user_ns,
307 'user_global':user_global_ns,
307 'user_global':user_global_ns,
308 'alias':self.alias_table,
308 'alias':self.alias_table,
309 'internal':self.internal_ns,
309 'internal':self.internal_ns,
310 'builtin':__builtin__.__dict__
310 'builtin':__builtin__.__dict__
311 }
311 }
312
312
313 # The user namespace MUST have a pointer to the shell itself.
313 # The user namespace MUST have a pointer to the shell itself.
314 self.user_ns[name] = self
314 self.user_ns[name] = self
315
315
316 # We need to insert into sys.modules something that looks like a
316 # We need to insert into sys.modules something that looks like a
317 # module but which accesses the IPython namespace, for shelve and
317 # module but which accesses the IPython namespace, for shelve and
318 # pickle to work interactively. Normally they rely on getting
318 # pickle to work interactively. Normally they rely on getting
319 # everything out of __main__, but for embedding purposes each IPython
319 # everything out of __main__, but for embedding purposes each IPython
320 # instance has its own private namespace, so we can't go shoving
320 # instance has its own private namespace, so we can't go shoving
321 # everything into __main__.
321 # everything into __main__.
322
322
323 # note, however, that we should only do this for non-embedded
323 # note, however, that we should only do this for non-embedded
324 # ipythons, which really mimic the __main__.__dict__ with their own
324 # ipythons, which really mimic the __main__.__dict__ with their own
325 # namespace. Embedded instances, on the other hand, should not do
325 # namespace. Embedded instances, on the other hand, should not do
326 # this because they need to manage the user local/global namespaces
326 # this because they need to manage the user local/global namespaces
327 # only, but they live within a 'normal' __main__ (meaning, they
327 # only, but they live within a 'normal' __main__ (meaning, they
328 # shouldn't overtake the execution environment of the script they're
328 # shouldn't overtake the execution environment of the script they're
329 # embedded in).
329 # embedded in).
330
330
331 if not embedded:
331 if not embedded:
332 try:
332 try:
333 main_name = self.user_ns['__name__']
333 main_name = self.user_ns['__name__']
334 except KeyError:
334 except KeyError:
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 else:
336 else:
337 #print "pickle hack in place" # dbg
337 #print "pickle hack in place" # dbg
338 #print 'main_name:',main_name # dbg
338 #print 'main_name:',main_name # dbg
339 sys.modules[main_name] = FakeModule(self.user_ns)
339 sys.modules[main_name] = FakeModule(self.user_ns)
340
340
341 # List of input with multi-line handling.
341 # List of input with multi-line handling.
342 # Fill its zero entry, user counter starts at 1
342 # Fill its zero entry, user counter starts at 1
343 self.input_hist = InputList(['\n'])
343 self.input_hist = InputList(['\n'])
344 # This one will hold the 'raw' input history, without any
344 # This one will hold the 'raw' input history, without any
345 # pre-processing. This will allow users to retrieve the input just as
345 # pre-processing. This will allow users to retrieve the input just as
346 # it was exactly typed in by the user, with %hist -r.
346 # it was exactly typed in by the user, with %hist -r.
347 self.input_hist_raw = InputList(['\n'])
347 self.input_hist_raw = InputList(['\n'])
348
348
349 # list of visited directories
349 # list of visited directories
350 try:
350 try:
351 self.dir_hist = [os.getcwd()]
351 self.dir_hist = [os.getcwd()]
352 except IOError, e:
352 except IOError, e:
353 self.dir_hist = []
353 self.dir_hist = []
354
354
355 # dict of output history
355 # dict of output history
356 self.output_hist = {}
356 self.output_hist = {}
357
357
358 # dict of things NOT to alias (keywords, builtins and some magics)
358 # dict of things NOT to alias (keywords, builtins and some magics)
359 no_alias = {}
359 no_alias = {}
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 for key in keyword.kwlist + no_alias_magics:
361 for key in keyword.kwlist + no_alias_magics:
362 no_alias[key] = 1
362 no_alias[key] = 1
363 no_alias.update(__builtin__.__dict__)
363 no_alias.update(__builtin__.__dict__)
364 self.no_alias = no_alias
364 self.no_alias = no_alias
365
365
366 # make global variables for user access to these
366 # make global variables for user access to these
367 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_ih'] = self.input_hist
368 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_oh'] = self.output_hist
369 self.user_ns['_dh'] = self.dir_hist
369 self.user_ns['_dh'] = self.dir_hist
370
370
371 # user aliases to input and output histories
371 # user aliases to input and output histories
372 self.user_ns['In'] = self.input_hist
372 self.user_ns['In'] = self.input_hist
373 self.user_ns['Out'] = self.output_hist
373 self.user_ns['Out'] = self.output_hist
374
374
375 # Object variable to store code object waiting execution. This is
375 # Object variable to store code object waiting execution. This is
376 # used mainly by the multithreaded shells, but it can come in handy in
376 # used mainly by the multithreaded shells, but it can come in handy in
377 # other situations. No need to use a Queue here, since it's a single
377 # other situations. No need to use a Queue here, since it's a single
378 # item which gets cleared once run.
378 # item which gets cleared once run.
379 self.code_to_run = None
379 self.code_to_run = None
380
380
381 # escapes for automatic behavior on the command line
381 # escapes for automatic behavior on the command line
382 self.ESC_SHELL = '!'
382 self.ESC_SHELL = '!'
383 self.ESC_HELP = '?'
383 self.ESC_HELP = '?'
384 self.ESC_MAGIC = '%'
384 self.ESC_MAGIC = '%'
385 self.ESC_QUOTE = ','
385 self.ESC_QUOTE = ','
386 self.ESC_QUOTE2 = ';'
386 self.ESC_QUOTE2 = ';'
387 self.ESC_PAREN = '/'
387 self.ESC_PAREN = '/'
388
388
389 # And their associated handlers
389 # And their associated handlers
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
393 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_MAGIC : self.handle_magic,
394 self.ESC_HELP : self.handle_help,
394 self.ESC_HELP : self.handle_help,
395 self.ESC_SHELL : self.handle_shell_escape,
395 self.ESC_SHELL : self.handle_shell_escape,
396 }
396 }
397
397
398 # class initializations
398 # class initializations
399 Magic.__init__(self,self)
399 Magic.__init__(self,self)
400
400
401 # Python source parser/formatter for syntax highlighting
401 # Python source parser/formatter for syntax highlighting
402 pyformat = PyColorize.Parser().format
402 pyformat = PyColorize.Parser().format
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404
404
405 # hooks holds pointers used for user-side customizations
405 # hooks holds pointers used for user-side customizations
406 self.hooks = Struct()
406 self.hooks = Struct()
407
407
408 # Set all default hooks, defined in the IPython.hooks module.
408 # Set all default hooks, defined in the IPython.hooks module.
409 hooks = IPython.hooks
409 hooks = IPython.hooks
410 for hook_name in hooks.__all__:
410 for hook_name in hooks.__all__:
411 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
411 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
412 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
412 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
413 #print "bound hook",hook_name
413 #print "bound hook",hook_name
414
414
415 # Flag to mark unconditional exit
415 # Flag to mark unconditional exit
416 self.exit_now = False
416 self.exit_now = False
417
417
418 self.usage_min = """\
418 self.usage_min = """\
419 An enhanced console for Python.
419 An enhanced console for Python.
420 Some of its features are:
420 Some of its features are:
421 - Readline support if the readline library is present.
421 - Readline support if the readline library is present.
422 - Tab completion in the local namespace.
422 - Tab completion in the local namespace.
423 - Logging of input, see command-line options.
423 - Logging of input, see command-line options.
424 - System shell escape via ! , eg !ls.
424 - System shell escape via ! , eg !ls.
425 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
425 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
426 - Keeps track of locally defined variables via %who, %whos.
426 - Keeps track of locally defined variables via %who, %whos.
427 - Show object information with a ? eg ?x or x? (use ?? for more info).
427 - Show object information with a ? eg ?x or x? (use ?? for more info).
428 """
428 """
429 if usage: self.usage = usage
429 if usage: self.usage = usage
430 else: self.usage = self.usage_min
430 else: self.usage = self.usage_min
431
431
432 # Storage
432 # Storage
433 self.rc = rc # This will hold all configuration information
433 self.rc = rc # This will hold all configuration information
434 self.pager = 'less'
434 self.pager = 'less'
435 # temporary files used for various purposes. Deleted at exit.
435 # temporary files used for various purposes. Deleted at exit.
436 self.tempfiles = []
436 self.tempfiles = []
437
437
438 # Keep track of readline usage (later set by init_readline)
438 # Keep track of readline usage (later set by init_readline)
439 self.has_readline = False
439 self.has_readline = False
440
440
441 # template for logfile headers. It gets resolved at runtime by the
441 # template for logfile headers. It gets resolved at runtime by the
442 # logstart method.
442 # logstart method.
443 self.loghead_tpl = \
443 self.loghead_tpl = \
444 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
444 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
445 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
445 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
446 #log# opts = %s
446 #log# opts = %s
447 #log# args = %s
447 #log# args = %s
448 #log# It is safe to make manual edits below here.
448 #log# It is safe to make manual edits below here.
449 #log#-----------------------------------------------------------------------
449 #log#-----------------------------------------------------------------------
450 """
450 """
451 # for pushd/popd management
451 # for pushd/popd management
452 try:
452 try:
453 self.home_dir = get_home_dir()
453 self.home_dir = get_home_dir()
454 except HomeDirError,msg:
454 except HomeDirError,msg:
455 fatal(msg)
455 fatal(msg)
456
456
457 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
457 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
458
458
459 # Functions to call the underlying shell.
459 # Functions to call the underlying shell.
460
460
461 # utility to expand user variables via Itpl
461 # utility to expand user variables via Itpl
462 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
462 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
463 self.user_ns))
463 self.user_ns))
464 # The first is similar to os.system, but it doesn't return a value,
464 # The first is similar to os.system, but it doesn't return a value,
465 # and it allows interpolation of variables in the user's namespace.
465 # and it allows interpolation of variables in the user's namespace.
466 self.system = lambda cmd: shell(self.var_expand(cmd),
466 self.system = lambda cmd: shell(self.var_expand(cmd),
467 header='IPython system call: ',
467 header='IPython system call: ',
468 verbose=self.rc.system_verbose)
468 verbose=self.rc.system_verbose)
469 # These are for getoutput and getoutputerror:
469 # These are for getoutput and getoutputerror:
470 self.getoutput = lambda cmd: \
470 self.getoutput = lambda cmd: \
471 getoutput(self.var_expand(cmd),
471 getoutput(self.var_expand(cmd),
472 header='IPython system call: ',
472 header='IPython system call: ',
473 verbose=self.rc.system_verbose)
473 verbose=self.rc.system_verbose)
474 self.getoutputerror = lambda cmd: \
474 self.getoutputerror = lambda cmd: \
475 getoutputerror(self.var_expand(cmd),
475 getoutputerror(self.var_expand(cmd),
476 header='IPython system call: ',
476 header='IPython system call: ',
477 verbose=self.rc.system_verbose)
477 verbose=self.rc.system_verbose)
478
478
479 # RegExp for splitting line contents into pre-char//first
479 # RegExp for splitting line contents into pre-char//first
480 # word-method//rest. For clarity, each group in on one line.
480 # word-method//rest. For clarity, each group in on one line.
481
481
482 # WARNING: update the regexp if the above escapes are changed, as they
482 # WARNING: update the regexp if the above escapes are changed, as they
483 # are hardwired in.
483 # are hardwired in.
484
484
485 # Don't get carried away with trying to make the autocalling catch too
485 # Don't get carried away with trying to make the autocalling catch too
486 # much: it's better to be conservative rather than to trigger hidden
486 # much: it's better to be conservative rather than to trigger hidden
487 # evals() somewhere and end up causing side effects.
487 # evals() somewhere and end up causing side effects.
488
488
489 self.line_split = re.compile(r'^([\s*,;/])'
489 self.line_split = re.compile(r'^([\s*,;/])'
490 r'([\?\w\.]+\w*\s*)'
490 r'([\?\w\.]+\w*\s*)'
491 r'(\(?.*$)')
491 r'(\(?.*$)')
492
492
493 # Original re, keep around for a while in case changes break something
493 # Original re, keep around for a while in case changes break something
494 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
494 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
495 # r'(\s*[\?\w\.]+\w*\s*)'
495 # r'(\s*[\?\w\.]+\w*\s*)'
496 # r'(\(?.*$)')
496 # r'(\(?.*$)')
497
497
498 # RegExp to identify potential function names
498 # RegExp to identify potential function names
499 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
499 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
500
500
501 # RegExp to exclude strings with this start from autocalling. In
501 # RegExp to exclude strings with this start from autocalling. In
502 # particular, all binary operators should be excluded, so that if foo
502 # particular, all binary operators should be excluded, so that if foo
503 # is callable, foo OP bar doesn't become foo(OP bar), which is
503 # is callable, foo OP bar doesn't become foo(OP bar), which is
504 # invalid. The characters '!=()' don't need to be checked for, as the
504 # invalid. The characters '!=()' don't need to be checked for, as the
505 # _prefilter routine explicitely does so, to catch direct calls and
505 # _prefilter routine explicitely does so, to catch direct calls and
506 # rebindings of existing names.
506 # rebindings of existing names.
507
507
508 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
508 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
509 # it affects the rest of the group in square brackets.
509 # it affects the rest of the group in square brackets.
510 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
510 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
511 '|^is |^not |^in |^and |^or ')
511 '|^is |^not |^in |^and |^or ')
512
512
513 # try to catch also methods for stuff in lists/tuples/dicts: off
513 # try to catch also methods for stuff in lists/tuples/dicts: off
514 # (experimental). For this to work, the line_split regexp would need
514 # (experimental). For this to work, the line_split regexp would need
515 # to be modified so it wouldn't break things at '['. That line is
515 # to be modified so it wouldn't break things at '['. That line is
516 # nasty enough that I shouldn't change it until I can test it _well_.
516 # nasty enough that I shouldn't change it until I can test it _well_.
517 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
517 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
518
518
519 # keep track of where we started running (mainly for crash post-mortem)
519 # keep track of where we started running (mainly for crash post-mortem)
520 self.starting_dir = os.getcwd()
520 self.starting_dir = os.getcwd()
521
521
522 # Various switches which can be set
522 # Various switches which can be set
523 self.CACHELENGTH = 5000 # this is cheap, it's just text
523 self.CACHELENGTH = 5000 # this is cheap, it's just text
524 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
524 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
525 self.banner2 = banner2
525 self.banner2 = banner2
526
526
527 # TraceBack handlers:
527 # TraceBack handlers:
528
528
529 # Syntax error handler.
529 # Syntax error handler.
530 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
530 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
531
531
532 # The interactive one is initialized with an offset, meaning we always
532 # The interactive one is initialized with an offset, meaning we always
533 # want to remove the topmost item in the traceback, which is our own
533 # want to remove the topmost item in the traceback, which is our own
534 # internal code. Valid modes: ['Plain','Context','Verbose']
534 # internal code. Valid modes: ['Plain','Context','Verbose']
535 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
535 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
536 color_scheme='NoColor',
536 color_scheme='NoColor',
537 tb_offset = 1)
537 tb_offset = 1)
538
538
539 # IPython itself shouldn't crash. This will produce a detailed
539 # IPython itself shouldn't crash. This will produce a detailed
540 # post-mortem if it does. But we only install the crash handler for
540 # post-mortem if it does. But we only install the crash handler for
541 # non-threaded shells, the threaded ones use a normal verbose reporter
541 # non-threaded shells, the threaded ones use a normal verbose reporter
542 # and lose the crash handler. This is because exceptions in the main
542 # and lose the crash handler. This is because exceptions in the main
543 # thread (such as in GUI code) propagate directly to sys.excepthook,
543 # thread (such as in GUI code) propagate directly to sys.excepthook,
544 # and there's no point in printing crash dumps for every user exception.
544 # and there's no point in printing crash dumps for every user exception.
545 if self.isthreaded:
545 if self.isthreaded:
546 ipCrashHandler = ultraTB.FormattedTB()
546 ipCrashHandler = ultraTB.FormattedTB()
547 else:
547 else:
548 from IPython import CrashHandler
548 from IPython import CrashHandler
549 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
549 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
550 self.set_crash_handler(ipCrashHandler)
550 self.set_crash_handler(ipCrashHandler)
551
551
552 # and add any custom exception handlers the user may have specified
552 # and add any custom exception handlers the user may have specified
553 self.set_custom_exc(*custom_exceptions)
553 self.set_custom_exc(*custom_exceptions)
554
554
555 # indentation management
555 # indentation management
556 self.autoindent = False
556 self.autoindent = False
557 self.indent_current_nsp = 0
557 self.indent_current_nsp = 0
558
558
559 # Make some aliases automatically
559 # Make some aliases automatically
560 # Prepare list of shell aliases to auto-define
560 # Prepare list of shell aliases to auto-define
561 if os.name == 'posix':
561 if os.name == 'posix':
562 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
562 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
563 'mv mv -i','rm rm -i','cp cp -i',
563 'mv mv -i','rm rm -i','cp cp -i',
564 'cat cat','less less','clear clear',
564 'cat cat','less less','clear clear',
565 # a better ls
565 # a better ls
566 'ls ls -F',
566 'ls ls -F',
567 # long ls
567 # long ls
568 'll ls -lF')
568 'll ls -lF')
569 # Extra ls aliases with color, which need special treatment on BSD
569 # Extra ls aliases with color, which need special treatment on BSD
570 # variants
570 # variants
571 ls_extra = ( # color ls
571 ls_extra = ( # color ls
572 'lc ls -F -o --color',
572 'lc ls -F -o --color',
573 # ls normal files only
573 # ls normal files only
574 'lf ls -F -o --color %l | grep ^-',
574 'lf ls -F -o --color %l | grep ^-',
575 # ls symbolic links
575 # ls symbolic links
576 'lk ls -F -o --color %l | grep ^l',
576 'lk ls -F -o --color %l | grep ^l',
577 # directories or links to directories,
577 # directories or links to directories,
578 'ldir ls -F -o --color %l | grep /$',
578 'ldir ls -F -o --color %l | grep /$',
579 # things which are executable
579 # things which are executable
580 'lx ls -F -o --color %l | grep ^-..x',
580 'lx ls -F -o --color %l | grep ^-..x',
581 )
581 )
582 # The BSDs don't ship GNU ls, so they don't understand the
582 # The BSDs don't ship GNU ls, so they don't understand the
583 # --color switch out of the box
583 # --color switch out of the box
584 if 'bsd' in sys.platform:
584 if 'bsd' in sys.platform:
585 ls_extra = ( # ls normal files only
585 ls_extra = ( # ls normal files only
586 'lf ls -lF | grep ^-',
586 'lf ls -lF | grep ^-',
587 # ls symbolic links
587 # ls symbolic links
588 'lk ls -lF | grep ^l',
588 'lk ls -lF | grep ^l',
589 # directories or links to directories,
589 # directories or links to directories,
590 'ldir ls -lF | grep /$',
590 'ldir ls -lF | grep /$',
591 # things which are executable
591 # things which are executable
592 'lx ls -lF | grep ^-..x',
592 'lx ls -lF | grep ^-..x',
593 )
593 )
594 auto_alias = auto_alias + ls_extra
594 auto_alias = auto_alias + ls_extra
595 elif os.name in ['nt','dos']:
595 elif os.name in ['nt','dos']:
596 auto_alias = ('dir dir /on', 'ls dir /on',
596 auto_alias = ('dir dir /on', 'ls dir /on',
597 'ddir dir /ad /on', 'ldir dir /ad /on',
597 'ddir dir /ad /on', 'ldir dir /ad /on',
598 'mkdir mkdir','rmdir rmdir','echo echo',
598 'mkdir mkdir','rmdir rmdir','echo echo',
599 'ren ren','cls cls','copy copy')
599 'ren ren','cls cls','copy copy')
600 else:
600 else:
601 auto_alias = ()
601 auto_alias = ()
602 self.auto_alias = [s.split(None,1) for s in auto_alias]
602 self.auto_alias = [s.split(None,1) for s in auto_alias]
603 # Call the actual (public) initializer
603 # Call the actual (public) initializer
604 self.init_auto_alias()
604 self.init_auto_alias()
605
605
606 # Produce a public API instance
606 # Produce a public API instance
607 self.api = IPython.ipapi.IPApi(self)
607 self.api = IPython.ipapi.IPApi(self)
608
608
609 # track which builtins we add, so we can clean up later
609 # track which builtins we add, so we can clean up later
610 self.builtins_added = {}
610 self.builtins_added = {}
611 # This method will add the necessary builtins for operation, but
611 # This method will add the necessary builtins for operation, but
612 # tracking what it did via the builtins_added dict.
612 # tracking what it did via the builtins_added dict.
613 self.add_builtins()
613 self.add_builtins()
614
614
615 # end __init__
615 # end __init__
616
616
617 def pre_config_initialization(self):
617 def pre_config_initialization(self):
618 """Pre-configuration init method
618 """Pre-configuration init method
619
619
620 This is called before the configuration files are processed to
620 This is called before the configuration files are processed to
621 prepare the services the config files might need.
621 prepare the services the config files might need.
622
622
623 self.rc already has reasonable default values at this point.
623 self.rc already has reasonable default values at this point.
624 """
624 """
625 rc = self.rc
625 rc = self.rc
626
626
627 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
627 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
628
628
629 def post_config_initialization(self):
629 def post_config_initialization(self):
630 """Post configuration init method
630 """Post configuration init method
631
631
632 This is called after the configuration files have been processed to
632 This is called after the configuration files have been processed to
633 'finalize' the initialization."""
633 'finalize' the initialization."""
634
634
635 rc = self.rc
635 rc = self.rc
636
636
637 # Object inspector
637 # Object inspector
638 self.inspector = OInspect.Inspector(OInspect.InspectColors,
638 self.inspector = OInspect.Inspector(OInspect.InspectColors,
639 PyColorize.ANSICodeColors,
639 PyColorize.ANSICodeColors,
640 'NoColor',
640 'NoColor',
641 rc.object_info_string_level)
641 rc.object_info_string_level)
642
642
643 # Load readline proper
643 # Load readline proper
644 if rc.readline:
644 if rc.readline:
645 self.init_readline()
645 self.init_readline()
646
646
647 # local shortcut, this is used a LOT
647 # local shortcut, this is used a LOT
648 self.log = self.logger.log
648 self.log = self.logger.log
649
649
650 # Initialize cache, set in/out prompts and printing system
650 # Initialize cache, set in/out prompts and printing system
651 self.outputcache = CachedOutput(self,
651 self.outputcache = CachedOutput(self,
652 rc.cache_size,
652 rc.cache_size,
653 rc.pprint,
653 rc.pprint,
654 input_sep = rc.separate_in,
654 input_sep = rc.separate_in,
655 output_sep = rc.separate_out,
655 output_sep = rc.separate_out,
656 output_sep2 = rc.separate_out2,
656 output_sep2 = rc.separate_out2,
657 ps1 = rc.prompt_in1,
657 ps1 = rc.prompt_in1,
658 ps2 = rc.prompt_in2,
658 ps2 = rc.prompt_in2,
659 ps_out = rc.prompt_out,
659 ps_out = rc.prompt_out,
660 pad_left = rc.prompts_pad_left)
660 pad_left = rc.prompts_pad_left)
661
661
662 # user may have over-ridden the default print hook:
662 # user may have over-ridden the default print hook:
663 try:
663 try:
664 self.outputcache.__class__.display = self.hooks.display
664 self.outputcache.__class__.display = self.hooks.display
665 except AttributeError:
665 except AttributeError:
666 pass
666 pass
667
667
668 # I don't like assigning globally to sys, because it means when embedding
668 # I don't like assigning globally to sys, because it means when
669 # instances, each embedded instance overrides the previous choice. But
669 # embedding instances, each embedded instance overrides the previous
670 # sys.displayhook seems to be called internally by exec, so I don't see a
670 # choice. But sys.displayhook seems to be called internally by exec,
671 # way around it.
671 # so I don't see a way around it. We first save the original and then
672 # overwrite it.
673 self.sys_displayhook = sys.displayhook
672 sys.displayhook = self.outputcache
674 sys.displayhook = self.outputcache
673
675
674 # Set user colors (don't do it in the constructor above so that it
676 # Set user colors (don't do it in the constructor above so that it
675 # doesn't crash if colors option is invalid)
677 # doesn't crash if colors option is invalid)
676 self.magic_colors(rc.colors)
678 self.magic_colors(rc.colors)
677
679
678 # Set calling of pdb on exceptions
680 # Set calling of pdb on exceptions
679 self.call_pdb = rc.pdb
681 self.call_pdb = rc.pdb
680
682
681 # Load user aliases
683 # Load user aliases
682 for alias in rc.alias:
684 for alias in rc.alias:
683 self.magic_alias(alias)
685 self.magic_alias(alias)
684 self.hooks.late_startup_hook()
686 self.hooks.late_startup_hook()
685
687
686 batchrun = False
688 batchrun = False
687 for batchfile in [path(arg) for arg in self.rc.args
689 for batchfile in [path(arg) for arg in self.rc.args
688 if arg.lower().endswith('.ipy')]:
690 if arg.lower().endswith('.ipy')]:
689 if not batchfile.isfile():
691 if not batchfile.isfile():
690 print "No such batch file:", batchfile
692 print "No such batch file:", batchfile
691 continue
693 continue
692 self.api.runlines(batchfile.text())
694 self.api.runlines(batchfile.text())
693 batchrun = True
695 batchrun = True
694 if batchrun:
696 if batchrun:
695 self.exit_now = True
697 self.exit_now = True
696
698
697 def add_builtins(self):
699 def add_builtins(self):
698 """Store ipython references into the builtin namespace.
700 """Store ipython references into the builtin namespace.
699
701
700 Some parts of ipython operate via builtins injected here, which hold a
702 Some parts of ipython operate via builtins injected here, which hold a
701 reference to IPython itself."""
703 reference to IPython itself."""
702
704
703 # TODO: deprecate all except _ip; 'jobs' should be installed
705 # TODO: deprecate all except _ip; 'jobs' should be installed
704 # by an extension and the rest are under _ip, ipalias is redundant
706 # by an extension and the rest are under _ip, ipalias is redundant
705 builtins_new = dict(__IPYTHON__ = self,
707 builtins_new = dict(__IPYTHON__ = self,
706 ip_set_hook = self.set_hook,
708 ip_set_hook = self.set_hook,
707 jobs = self.jobs,
709 jobs = self.jobs,
708 ipmagic = self.ipmagic,
710 ipmagic = self.ipmagic,
709 ipalias = self.ipalias,
711 ipalias = self.ipalias,
710 ipsystem = self.ipsystem,
712 ipsystem = self.ipsystem,
711 _ip = self.api
713 _ip = self.api
712 )
714 )
713 for biname,bival in builtins_new.items():
715 for biname,bival in builtins_new.items():
714 try:
716 try:
715 # store the orignal value so we can restore it
717 # store the orignal value so we can restore it
716 self.builtins_added[biname] = __builtin__.__dict__[biname]
718 self.builtins_added[biname] = __builtin__.__dict__[biname]
717 except KeyError:
719 except KeyError:
718 # or mark that it wasn't defined, and we'll just delete it at
720 # or mark that it wasn't defined, and we'll just delete it at
719 # cleanup
721 # cleanup
720 self.builtins_added[biname] = Undefined
722 self.builtins_added[biname] = Undefined
721 __builtin__.__dict__[biname] = bival
723 __builtin__.__dict__[biname] = bival
722
724
723 # Keep in the builtins a flag for when IPython is active. We set it
725 # Keep in the builtins a flag for when IPython is active. We set it
724 # with setdefault so that multiple nested IPythons don't clobber one
726 # with setdefault so that multiple nested IPythons don't clobber one
725 # another. Each will increase its value by one upon being activated,
727 # another. Each will increase its value by one upon being activated,
726 # which also gives us a way to determine the nesting level.
728 # which also gives us a way to determine the nesting level.
727 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
729 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
728
730
729 def clean_builtins(self):
731 def clean_builtins(self):
730 """Remove any builtins which might have been added by add_builtins, or
732 """Remove any builtins which might have been added by add_builtins, or
731 restore overwritten ones to their previous values."""
733 restore overwritten ones to their previous values."""
732 for biname,bival in self.builtins_added.items():
734 for biname,bival in self.builtins_added.items():
733 if bival is Undefined:
735 if bival is Undefined:
734 del __builtin__.__dict__[biname]
736 del __builtin__.__dict__[biname]
735 else:
737 else:
736 __builtin__.__dict__[biname] = bival
738 __builtin__.__dict__[biname] = bival
737 self.builtins_added.clear()
739 self.builtins_added.clear()
738
740
739 def set_hook(self,name,hook, priority = 50):
741 def set_hook(self,name,hook, priority = 50):
740 """set_hook(name,hook) -> sets an internal IPython hook.
742 """set_hook(name,hook) -> sets an internal IPython hook.
741
743
742 IPython exposes some of its internal API as user-modifiable hooks. By
744 IPython exposes some of its internal API as user-modifiable hooks. By
743 adding your function to one of these hooks, you can modify IPython's
745 adding your function to one of these hooks, you can modify IPython's
744 behavior to call at runtime your own routines."""
746 behavior to call at runtime your own routines."""
745
747
746 # At some point in the future, this should validate the hook before it
748 # At some point in the future, this should validate the hook before it
747 # accepts it. Probably at least check that the hook takes the number
749 # accepts it. Probably at least check that the hook takes the number
748 # of args it's supposed to.
750 # of args it's supposed to.
749 dp = getattr(self.hooks, name, None)
751 dp = getattr(self.hooks, name, None)
750 if name not in IPython.hooks.__all__:
752 if name not in IPython.hooks.__all__:
751 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
753 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
752 if not dp:
754 if not dp:
753 dp = IPython.hooks.CommandChainDispatcher()
755 dp = IPython.hooks.CommandChainDispatcher()
754
756
755 f = new.instancemethod(hook,self,self.__class__)
757 f = new.instancemethod(hook,self,self.__class__)
756 try:
758 try:
757 dp.add(f,priority)
759 dp.add(f,priority)
758 except AttributeError:
760 except AttributeError:
759 # it was not commandchain, plain old func - replace
761 # it was not commandchain, plain old func - replace
760 dp = f
762 dp = f
761
763
762 setattr(self.hooks,name, dp)
764 setattr(self.hooks,name, dp)
763
765
764
766
765 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
767 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
766
768
767 def set_crash_handler(self,crashHandler):
769 def set_crash_handler(self,crashHandler):
768 """Set the IPython crash handler.
770 """Set the IPython crash handler.
769
771
770 This must be a callable with a signature suitable for use as
772 This must be a callable with a signature suitable for use as
771 sys.excepthook."""
773 sys.excepthook."""
772
774
773 # Install the given crash handler as the Python exception hook
775 # Install the given crash handler as the Python exception hook
774 sys.excepthook = crashHandler
776 sys.excepthook = crashHandler
775
777
776 # The instance will store a pointer to this, so that runtime code
778 # The instance will store a pointer to this, so that runtime code
777 # (such as magics) can access it. This is because during the
779 # (such as magics) can access it. This is because during the
778 # read-eval loop, it gets temporarily overwritten (to deal with GUI
780 # read-eval loop, it gets temporarily overwritten (to deal with GUI
779 # frameworks).
781 # frameworks).
780 self.sys_excepthook = sys.excepthook
782 self.sys_excepthook = sys.excepthook
781
783
782
784
783 def set_custom_exc(self,exc_tuple,handler):
785 def set_custom_exc(self,exc_tuple,handler):
784 """set_custom_exc(exc_tuple,handler)
786 """set_custom_exc(exc_tuple,handler)
785
787
786 Set a custom exception handler, which will be called if any of the
788 Set a custom exception handler, which will be called if any of the
787 exceptions in exc_tuple occur in the mainloop (specifically, in the
789 exceptions in exc_tuple occur in the mainloop (specifically, in the
788 runcode() method.
790 runcode() method.
789
791
790 Inputs:
792 Inputs:
791
793
792 - exc_tuple: a *tuple* of valid exceptions to call the defined
794 - exc_tuple: a *tuple* of valid exceptions to call the defined
793 handler for. It is very important that you use a tuple, and NOT A
795 handler for. It is very important that you use a tuple, and NOT A
794 LIST here, because of the way Python's except statement works. If
796 LIST here, because of the way Python's except statement works. If
795 you only want to trap a single exception, use a singleton tuple:
797 you only want to trap a single exception, use a singleton tuple:
796
798
797 exc_tuple == (MyCustomException,)
799 exc_tuple == (MyCustomException,)
798
800
799 - handler: this must be defined as a function with the following
801 - handler: this must be defined as a function with the following
800 basic interface: def my_handler(self,etype,value,tb).
802 basic interface: def my_handler(self,etype,value,tb).
801
803
802 This will be made into an instance method (via new.instancemethod)
804 This will be made into an instance method (via new.instancemethod)
803 of IPython itself, and it will be called if any of the exceptions
805 of IPython itself, and it will be called if any of the exceptions
804 listed in the exc_tuple are caught. If the handler is None, an
806 listed in the exc_tuple are caught. If the handler is None, an
805 internal basic one is used, which just prints basic info.
807 internal basic one is used, which just prints basic info.
806
808
807 WARNING: by putting in your own exception handler into IPython's main
809 WARNING: by putting in your own exception handler into IPython's main
808 execution loop, you run a very good chance of nasty crashes. This
810 execution loop, you run a very good chance of nasty crashes. This
809 facility should only be used if you really know what you are doing."""
811 facility should only be used if you really know what you are doing."""
810
812
811 assert type(exc_tuple)==type(()) , \
813 assert type(exc_tuple)==type(()) , \
812 "The custom exceptions must be given AS A TUPLE."
814 "The custom exceptions must be given AS A TUPLE."
813
815
814 def dummy_handler(self,etype,value,tb):
816 def dummy_handler(self,etype,value,tb):
815 print '*** Simple custom exception handler ***'
817 print '*** Simple custom exception handler ***'
816 print 'Exception type :',etype
818 print 'Exception type :',etype
817 print 'Exception value:',value
819 print 'Exception value:',value
818 print 'Traceback :',tb
820 print 'Traceback :',tb
819 print 'Source code :','\n'.join(self.buffer)
821 print 'Source code :','\n'.join(self.buffer)
820
822
821 if handler is None: handler = dummy_handler
823 if handler is None: handler = dummy_handler
822
824
823 self.CustomTB = new.instancemethod(handler,self,self.__class__)
825 self.CustomTB = new.instancemethod(handler,self,self.__class__)
824 self.custom_exceptions = exc_tuple
826 self.custom_exceptions = exc_tuple
825
827
826 def set_custom_completer(self,completer,pos=0):
828 def set_custom_completer(self,completer,pos=0):
827 """set_custom_completer(completer,pos=0)
829 """set_custom_completer(completer,pos=0)
828
830
829 Adds a new custom completer function.
831 Adds a new custom completer function.
830
832
831 The position argument (defaults to 0) is the index in the completers
833 The position argument (defaults to 0) is the index in the completers
832 list where you want the completer to be inserted."""
834 list where you want the completer to be inserted."""
833
835
834 newcomp = new.instancemethod(completer,self.Completer,
836 newcomp = new.instancemethod(completer,self.Completer,
835 self.Completer.__class__)
837 self.Completer.__class__)
836 self.Completer.matchers.insert(pos,newcomp)
838 self.Completer.matchers.insert(pos,newcomp)
837
839
838 def _get_call_pdb(self):
840 def _get_call_pdb(self):
839 return self._call_pdb
841 return self._call_pdb
840
842
841 def _set_call_pdb(self,val):
843 def _set_call_pdb(self,val):
842
844
843 if val not in (0,1,False,True):
845 if val not in (0,1,False,True):
844 raise ValueError,'new call_pdb value must be boolean'
846 raise ValueError,'new call_pdb value must be boolean'
845
847
846 # store value in instance
848 # store value in instance
847 self._call_pdb = val
849 self._call_pdb = val
848
850
849 # notify the actual exception handlers
851 # notify the actual exception handlers
850 self.InteractiveTB.call_pdb = val
852 self.InteractiveTB.call_pdb = val
851 if self.isthreaded:
853 if self.isthreaded:
852 try:
854 try:
853 self.sys_excepthook.call_pdb = val
855 self.sys_excepthook.call_pdb = val
854 except:
856 except:
855 warn('Failed to activate pdb for threaded exception handler')
857 warn('Failed to activate pdb for threaded exception handler')
856
858
857 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
859 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
858 'Control auto-activation of pdb at exceptions')
860 'Control auto-activation of pdb at exceptions')
859
861
860
862
861 # These special functions get installed in the builtin namespace, to
863 # These special functions get installed in the builtin namespace, to
862 # provide programmatic (pure python) access to magics, aliases and system
864 # provide programmatic (pure python) access to magics, aliases and system
863 # calls. This is important for logging, user scripting, and more.
865 # calls. This is important for logging, user scripting, and more.
864
866
865 # We are basically exposing, via normal python functions, the three
867 # We are basically exposing, via normal python functions, the three
866 # mechanisms in which ipython offers special call modes (magics for
868 # mechanisms in which ipython offers special call modes (magics for
867 # internal control, aliases for direct system access via pre-selected
869 # internal control, aliases for direct system access via pre-selected
868 # names, and !cmd for calling arbitrary system commands).
870 # names, and !cmd for calling arbitrary system commands).
869
871
870 def ipmagic(self,arg_s):
872 def ipmagic(self,arg_s):
871 """Call a magic function by name.
873 """Call a magic function by name.
872
874
873 Input: a string containing the name of the magic function to call and any
875 Input: a string containing the name of the magic function to call and any
874 additional arguments to be passed to the magic.
876 additional arguments to be passed to the magic.
875
877
876 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
878 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
877 prompt:
879 prompt:
878
880
879 In[1]: %name -opt foo bar
881 In[1]: %name -opt foo bar
880
882
881 To call a magic without arguments, simply use ipmagic('name').
883 To call a magic without arguments, simply use ipmagic('name').
882
884
883 This provides a proper Python function to call IPython's magics in any
885 This provides a proper Python function to call IPython's magics in any
884 valid Python code you can type at the interpreter, including loops and
886 valid Python code you can type at the interpreter, including loops and
885 compound statements. It is added by IPython to the Python builtin
887 compound statements. It is added by IPython to the Python builtin
886 namespace upon initialization."""
888 namespace upon initialization."""
887
889
888 args = arg_s.split(' ',1)
890 args = arg_s.split(' ',1)
889 magic_name = args[0]
891 magic_name = args[0]
890 magic_name = magic_name.lstrip(self.ESC_MAGIC)
892 magic_name = magic_name.lstrip(self.ESC_MAGIC)
891
893
892 try:
894 try:
893 magic_args = args[1]
895 magic_args = args[1]
894 except IndexError:
896 except IndexError:
895 magic_args = ''
897 magic_args = ''
896 fn = getattr(self,'magic_'+magic_name,None)
898 fn = getattr(self,'magic_'+magic_name,None)
897 if fn is None:
899 if fn is None:
898 error("Magic function `%s` not found." % magic_name)
900 error("Magic function `%s` not found." % magic_name)
899 else:
901 else:
900 magic_args = self.var_expand(magic_args)
902 magic_args = self.var_expand(magic_args)
901 return fn(magic_args)
903 return fn(magic_args)
902
904
903 def ipalias(self,arg_s):
905 def ipalias(self,arg_s):
904 """Call an alias by name.
906 """Call an alias by name.
905
907
906 Input: a string containing the name of the alias to call and any
908 Input: a string containing the name of the alias to call and any
907 additional arguments to be passed to the magic.
909 additional arguments to be passed to the magic.
908
910
909 ipalias('name -opt foo bar') is equivalent to typing at the ipython
911 ipalias('name -opt foo bar') is equivalent to typing at the ipython
910 prompt:
912 prompt:
911
913
912 In[1]: name -opt foo bar
914 In[1]: name -opt foo bar
913
915
914 To call an alias without arguments, simply use ipalias('name').
916 To call an alias without arguments, simply use ipalias('name').
915
917
916 This provides a proper Python function to call IPython's aliases in any
918 This provides a proper Python function to call IPython's aliases in any
917 valid Python code you can type at the interpreter, including loops and
919 valid Python code you can type at the interpreter, including loops and
918 compound statements. It is added by IPython to the Python builtin
920 compound statements. It is added by IPython to the Python builtin
919 namespace upon initialization."""
921 namespace upon initialization."""
920
922
921 args = arg_s.split(' ',1)
923 args = arg_s.split(' ',1)
922 alias_name = args[0]
924 alias_name = args[0]
923 try:
925 try:
924 alias_args = args[1]
926 alias_args = args[1]
925 except IndexError:
927 except IndexError:
926 alias_args = ''
928 alias_args = ''
927 if alias_name in self.alias_table:
929 if alias_name in self.alias_table:
928 self.call_alias(alias_name,alias_args)
930 self.call_alias(alias_name,alias_args)
929 else:
931 else:
930 error("Alias `%s` not found." % alias_name)
932 error("Alias `%s` not found." % alias_name)
931
933
932 def ipsystem(self,arg_s):
934 def ipsystem(self,arg_s):
933 """Make a system call, using IPython."""
935 """Make a system call, using IPython."""
934
936
935 self.system(arg_s)
937 self.system(arg_s)
936
938
937 def complete(self,text):
939 def complete(self,text):
938 """Return a sorted list of all possible completions on text.
940 """Return a sorted list of all possible completions on text.
939
941
940 Inputs:
942 Inputs:
941
943
942 - text: a string of text to be completed on.
944 - text: a string of text to be completed on.
943
945
944 This is a wrapper around the completion mechanism, similar to what
946 This is a wrapper around the completion mechanism, similar to what
945 readline does at the command line when the TAB key is hit. By
947 readline does at the command line when the TAB key is hit. By
946 exposing it as a method, it can be used by other non-readline
948 exposing it as a method, it can be used by other non-readline
947 environments (such as GUIs) for text completion.
949 environments (such as GUIs) for text completion.
948
950
949 Simple usage example:
951 Simple usage example:
950
952
951 In [1]: x = 'hello'
953 In [1]: x = 'hello'
952
954
953 In [2]: __IP.complete('x.l')
955 In [2]: __IP.complete('x.l')
954 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
956 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
955
957
956 complete = self.Completer.complete
958 complete = self.Completer.complete
957 state = 0
959 state = 0
958 # use a dict so we get unique keys, since ipyhton's multiple
960 # use a dict so we get unique keys, since ipyhton's multiple
959 # completers can return duplicates.
961 # completers can return duplicates.
960 comps = {}
962 comps = {}
961 while True:
963 while True:
962 newcomp = complete(text,state)
964 newcomp = complete(text,state)
963 if newcomp is None:
965 if newcomp is None:
964 break
966 break
965 comps[newcomp] = 1
967 comps[newcomp] = 1
966 state += 1
968 state += 1
967 outcomps = comps.keys()
969 outcomps = comps.keys()
968 outcomps.sort()
970 outcomps.sort()
969 return outcomps
971 return outcomps
970
972
971 def set_completer_frame(self, frame=None):
973 def set_completer_frame(self, frame=None):
972 if frame:
974 if frame:
973 self.Completer.namespace = frame.f_locals
975 self.Completer.namespace = frame.f_locals
974 self.Completer.global_namespace = frame.f_globals
976 self.Completer.global_namespace = frame.f_globals
975 else:
977 else:
976 self.Completer.namespace = self.user_ns
978 self.Completer.namespace = self.user_ns
977 self.Completer.global_namespace = self.user_global_ns
979 self.Completer.global_namespace = self.user_global_ns
978
980
979 def init_auto_alias(self):
981 def init_auto_alias(self):
980 """Define some aliases automatically.
982 """Define some aliases automatically.
981
983
982 These are ALL parameter-less aliases"""
984 These are ALL parameter-less aliases"""
983
985
984 for alias,cmd in self.auto_alias:
986 for alias,cmd in self.auto_alias:
985 self.alias_table[alias] = (0,cmd)
987 self.alias_table[alias] = (0,cmd)
986
988
987 def alias_table_validate(self,verbose=0):
989 def alias_table_validate(self,verbose=0):
988 """Update information about the alias table.
990 """Update information about the alias table.
989
991
990 In particular, make sure no Python keywords/builtins are in it."""
992 In particular, make sure no Python keywords/builtins are in it."""
991
993
992 no_alias = self.no_alias
994 no_alias = self.no_alias
993 for k in self.alias_table.keys():
995 for k in self.alias_table.keys():
994 if k in no_alias:
996 if k in no_alias:
995 del self.alias_table[k]
997 del self.alias_table[k]
996 if verbose:
998 if verbose:
997 print ("Deleting alias <%s>, it's a Python "
999 print ("Deleting alias <%s>, it's a Python "
998 "keyword or builtin." % k)
1000 "keyword or builtin." % k)
999
1001
1000 def set_autoindent(self,value=None):
1002 def set_autoindent(self,value=None):
1001 """Set the autoindent flag, checking for readline support.
1003 """Set the autoindent flag, checking for readline support.
1002
1004
1003 If called with no arguments, it acts as a toggle."""
1005 If called with no arguments, it acts as a toggle."""
1004
1006
1005 if not self.has_readline:
1007 if not self.has_readline:
1006 if os.name == 'posix':
1008 if os.name == 'posix':
1007 warn("The auto-indent feature requires the readline library")
1009 warn("The auto-indent feature requires the readline library")
1008 self.autoindent = 0
1010 self.autoindent = 0
1009 return
1011 return
1010 if value is None:
1012 if value is None:
1011 self.autoindent = not self.autoindent
1013 self.autoindent = not self.autoindent
1012 else:
1014 else:
1013 self.autoindent = value
1015 self.autoindent = value
1014
1016
1015 def rc_set_toggle(self,rc_field,value=None):
1017 def rc_set_toggle(self,rc_field,value=None):
1016 """Set or toggle a field in IPython's rc config. structure.
1018 """Set or toggle a field in IPython's rc config. structure.
1017
1019
1018 If called with no arguments, it acts as a toggle.
1020 If called with no arguments, it acts as a toggle.
1019
1021
1020 If called with a non-existent field, the resulting AttributeError
1022 If called with a non-existent field, the resulting AttributeError
1021 exception will propagate out."""
1023 exception will propagate out."""
1022
1024
1023 rc_val = getattr(self.rc,rc_field)
1025 rc_val = getattr(self.rc,rc_field)
1024 if value is None:
1026 if value is None:
1025 value = not rc_val
1027 value = not rc_val
1026 setattr(self.rc,rc_field,value)
1028 setattr(self.rc,rc_field,value)
1027
1029
1028 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1030 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1029 """Install the user configuration directory.
1031 """Install the user configuration directory.
1030
1032
1031 Can be called when running for the first time or to upgrade the user's
1033 Can be called when running for the first time or to upgrade the user's
1032 .ipython/ directory with the mode parameter. Valid modes are 'install'
1034 .ipython/ directory with the mode parameter. Valid modes are 'install'
1033 and 'upgrade'."""
1035 and 'upgrade'."""
1034
1036
1035 def wait():
1037 def wait():
1036 try:
1038 try:
1037 raw_input("Please press <RETURN> to start IPython.")
1039 raw_input("Please press <RETURN> to start IPython.")
1038 except EOFError:
1040 except EOFError:
1039 print >> Term.cout
1041 print >> Term.cout
1040 print '*'*70
1042 print '*'*70
1041
1043
1042 cwd = os.getcwd() # remember where we started
1044 cwd = os.getcwd() # remember where we started
1043 glb = glob.glob
1045 glb = glob.glob
1044 print '*'*70
1046 print '*'*70
1045 if mode == 'install':
1047 if mode == 'install':
1046 print \
1048 print \
1047 """Welcome to IPython. I will try to create a personal configuration directory
1049 """Welcome to IPython. I will try to create a personal configuration directory
1048 where you can customize many aspects of IPython's functionality in:\n"""
1050 where you can customize many aspects of IPython's functionality in:\n"""
1049 else:
1051 else:
1050 print 'I am going to upgrade your configuration in:'
1052 print 'I am going to upgrade your configuration in:'
1051
1053
1052 print ipythondir
1054 print ipythondir
1053
1055
1054 rcdirend = os.path.join('IPython','UserConfig')
1056 rcdirend = os.path.join('IPython','UserConfig')
1055 cfg = lambda d: os.path.join(d,rcdirend)
1057 cfg = lambda d: os.path.join(d,rcdirend)
1056 try:
1058 try:
1057 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1059 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1058 except IOError:
1060 except IOError:
1059 warning = """
1061 warning = """
1060 Installation error. IPython's directory was not found.
1062 Installation error. IPython's directory was not found.
1061
1063
1062 Check the following:
1064 Check the following:
1063
1065
1064 The ipython/IPython directory should be in a directory belonging to your
1066 The ipython/IPython directory should be in a directory belonging to your
1065 PYTHONPATH environment variable (that is, it should be in a directory
1067 PYTHONPATH environment variable (that is, it should be in a directory
1066 belonging to sys.path). You can copy it explicitly there or just link to it.
1068 belonging to sys.path). You can copy it explicitly there or just link to it.
1067
1069
1068 IPython will proceed with builtin defaults.
1070 IPython will proceed with builtin defaults.
1069 """
1071 """
1070 warn(warning)
1072 warn(warning)
1071 wait()
1073 wait()
1072 return
1074 return
1073
1075
1074 if mode == 'install':
1076 if mode == 'install':
1075 try:
1077 try:
1076 shutil.copytree(rcdir,ipythondir)
1078 shutil.copytree(rcdir,ipythondir)
1077 os.chdir(ipythondir)
1079 os.chdir(ipythondir)
1078 rc_files = glb("ipythonrc*")
1080 rc_files = glb("ipythonrc*")
1079 for rc_file in rc_files:
1081 for rc_file in rc_files:
1080 os.rename(rc_file,rc_file+rc_suffix)
1082 os.rename(rc_file,rc_file+rc_suffix)
1081 except:
1083 except:
1082 warning = """
1084 warning = """
1083
1085
1084 There was a problem with the installation:
1086 There was a problem with the installation:
1085 %s
1087 %s
1086 Try to correct it or contact the developers if you think it's a bug.
1088 Try to correct it or contact the developers if you think it's a bug.
1087 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1089 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1088 warn(warning)
1090 warn(warning)
1089 wait()
1091 wait()
1090 return
1092 return
1091
1093
1092 elif mode == 'upgrade':
1094 elif mode == 'upgrade':
1093 try:
1095 try:
1094 os.chdir(ipythondir)
1096 os.chdir(ipythondir)
1095 except:
1097 except:
1096 print """
1098 print """
1097 Can not upgrade: changing to directory %s failed. Details:
1099 Can not upgrade: changing to directory %s failed. Details:
1098 %s
1100 %s
1099 """ % (ipythondir,sys.exc_info()[1])
1101 """ % (ipythondir,sys.exc_info()[1])
1100 wait()
1102 wait()
1101 return
1103 return
1102 else:
1104 else:
1103 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1105 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1104 for new_full_path in sources:
1106 for new_full_path in sources:
1105 new_filename = os.path.basename(new_full_path)
1107 new_filename = os.path.basename(new_full_path)
1106 if new_filename.startswith('ipythonrc'):
1108 if new_filename.startswith('ipythonrc'):
1107 new_filename = new_filename + rc_suffix
1109 new_filename = new_filename + rc_suffix
1108 # The config directory should only contain files, skip any
1110 # The config directory should only contain files, skip any
1109 # directories which may be there (like CVS)
1111 # directories which may be there (like CVS)
1110 if os.path.isdir(new_full_path):
1112 if os.path.isdir(new_full_path):
1111 continue
1113 continue
1112 if os.path.exists(new_filename):
1114 if os.path.exists(new_filename):
1113 old_file = new_filename+'.old'
1115 old_file = new_filename+'.old'
1114 if os.path.exists(old_file):
1116 if os.path.exists(old_file):
1115 os.remove(old_file)
1117 os.remove(old_file)
1116 os.rename(new_filename,old_file)
1118 os.rename(new_filename,old_file)
1117 shutil.copy(new_full_path,new_filename)
1119 shutil.copy(new_full_path,new_filename)
1118 else:
1120 else:
1119 raise ValueError,'unrecognized mode for install:',`mode`
1121 raise ValueError,'unrecognized mode for install:',`mode`
1120
1122
1121 # Fix line-endings to those native to each platform in the config
1123 # Fix line-endings to those native to each platform in the config
1122 # directory.
1124 # directory.
1123 try:
1125 try:
1124 os.chdir(ipythondir)
1126 os.chdir(ipythondir)
1125 except:
1127 except:
1126 print """
1128 print """
1127 Problem: changing to directory %s failed.
1129 Problem: changing to directory %s failed.
1128 Details:
1130 Details:
1129 %s
1131 %s
1130
1132
1131 Some configuration files may have incorrect line endings. This should not
1133 Some configuration files may have incorrect line endings. This should not
1132 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1134 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1133 wait()
1135 wait()
1134 else:
1136 else:
1135 for fname in glb('ipythonrc*'):
1137 for fname in glb('ipythonrc*'):
1136 try:
1138 try:
1137 native_line_ends(fname,backup=0)
1139 native_line_ends(fname,backup=0)
1138 except IOError:
1140 except IOError:
1139 pass
1141 pass
1140
1142
1141 if mode == 'install':
1143 if mode == 'install':
1142 print """
1144 print """
1143 Successful installation!
1145 Successful installation!
1144
1146
1145 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1147 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1146 IPython manual (there are both HTML and PDF versions supplied with the
1148 IPython manual (there are both HTML and PDF versions supplied with the
1147 distribution) to make sure that your system environment is properly configured
1149 distribution) to make sure that your system environment is properly configured
1148 to take advantage of IPython's features.
1150 to take advantage of IPython's features.
1149
1151
1150 Important note: the configuration system has changed! The old system is
1152 Important note: the configuration system has changed! The old system is
1151 still in place, but its setting may be partly overridden by the settings in
1153 still in place, but its setting may be partly overridden by the settings in
1152 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1154 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1153 if some of the new settings bother you.
1155 if some of the new settings bother you.
1154
1156
1155 """
1157 """
1156 else:
1158 else:
1157 print """
1159 print """
1158 Successful upgrade!
1160 Successful upgrade!
1159
1161
1160 All files in your directory:
1162 All files in your directory:
1161 %(ipythondir)s
1163 %(ipythondir)s
1162 which would have been overwritten by the upgrade were backed up with a .old
1164 which would have been overwritten by the upgrade were backed up with a .old
1163 extension. If you had made particular customizations in those files you may
1165 extension. If you had made particular customizations in those files you may
1164 want to merge them back into the new files.""" % locals()
1166 want to merge them back into the new files.""" % locals()
1165 wait()
1167 wait()
1166 os.chdir(cwd)
1168 os.chdir(cwd)
1167 # end user_setup()
1169 # end user_setup()
1168
1170
1169 def atexit_operations(self):
1171 def atexit_operations(self):
1170 """This will be executed at the time of exit.
1172 """This will be executed at the time of exit.
1171
1173
1172 Saving of persistent data should be performed here. """
1174 Saving of persistent data should be performed here. """
1173
1175
1174 #print '*** IPython exit cleanup ***' # dbg
1176 #print '*** IPython exit cleanup ***' # dbg
1175 # input history
1177 # input history
1176 self.savehist()
1178 self.savehist()
1177
1179
1178 # Cleanup all tempfiles left around
1180 # Cleanup all tempfiles left around
1179 for tfile in self.tempfiles:
1181 for tfile in self.tempfiles:
1180 try:
1182 try:
1181 os.unlink(tfile)
1183 os.unlink(tfile)
1182 except OSError:
1184 except OSError:
1183 pass
1185 pass
1184
1186
1185 # save the "persistent data" catch-all dictionary
1187 # save the "persistent data" catch-all dictionary
1186 self.hooks.shutdown_hook()
1188 self.hooks.shutdown_hook()
1187
1189
1188 def savehist(self):
1190 def savehist(self):
1189 """Save input history to a file (via readline library)."""
1191 """Save input history to a file (via readline library)."""
1190 try:
1192 try:
1191 self.readline.write_history_file(self.histfile)
1193 self.readline.write_history_file(self.histfile)
1192 except:
1194 except:
1193 print 'Unable to save IPython command history to file: ' + \
1195 print 'Unable to save IPython command history to file: ' + \
1194 `self.histfile`
1196 `self.histfile`
1195
1197
1196 def pre_readline(self):
1198 def pre_readline(self):
1197 """readline hook to be used at the start of each line.
1199 """readline hook to be used at the start of each line.
1198
1200
1199 Currently it handles auto-indent only."""
1201 Currently it handles auto-indent only."""
1200
1202
1201 #debugx('self.indent_current_nsp','pre_readline:')
1203 #debugx('self.indent_current_nsp','pre_readline:')
1202 self.readline.insert_text(self.indent_current_str())
1204 self.readline.insert_text(self.indent_current_str())
1203
1205
1204 def init_readline(self):
1206 def init_readline(self):
1205 """Command history completion/saving/reloading."""
1207 """Command history completion/saving/reloading."""
1206
1208
1207 import IPython.rlineimpl as readline
1209 import IPython.rlineimpl as readline
1208 if not readline.have_readline:
1210 if not readline.have_readline:
1209 self.has_readline = 0
1211 self.has_readline = 0
1210 self.readline = None
1212 self.readline = None
1211 # no point in bugging windows users with this every time:
1213 # no point in bugging windows users with this every time:
1212 warn('Readline services not available on this platform.')
1214 warn('Readline services not available on this platform.')
1213 else:
1215 else:
1214 sys.modules['readline'] = readline
1216 sys.modules['readline'] = readline
1215 import atexit
1217 import atexit
1216 from IPython.completer import IPCompleter
1218 from IPython.completer import IPCompleter
1217 self.Completer = IPCompleter(self,
1219 self.Completer = IPCompleter(self,
1218 self.user_ns,
1220 self.user_ns,
1219 self.user_global_ns,
1221 self.user_global_ns,
1220 self.rc.readline_omit__names,
1222 self.rc.readline_omit__names,
1221 self.alias_table)
1223 self.alias_table)
1222
1224
1223 # Platform-specific configuration
1225 # Platform-specific configuration
1224 if os.name == 'nt':
1226 if os.name == 'nt':
1225 self.readline_startup_hook = readline.set_pre_input_hook
1227 self.readline_startup_hook = readline.set_pre_input_hook
1226 else:
1228 else:
1227 self.readline_startup_hook = readline.set_startup_hook
1229 self.readline_startup_hook = readline.set_startup_hook
1228
1230
1229 # Load user's initrc file (readline config)
1231 # Load user's initrc file (readline config)
1230 inputrc_name = os.environ.get('INPUTRC')
1232 inputrc_name = os.environ.get('INPUTRC')
1231 if inputrc_name is None:
1233 if inputrc_name is None:
1232 home_dir = get_home_dir()
1234 home_dir = get_home_dir()
1233 if home_dir is not None:
1235 if home_dir is not None:
1234 inputrc_name = os.path.join(home_dir,'.inputrc')
1236 inputrc_name = os.path.join(home_dir,'.inputrc')
1235 if os.path.isfile(inputrc_name):
1237 if os.path.isfile(inputrc_name):
1236 try:
1238 try:
1237 readline.read_init_file(inputrc_name)
1239 readline.read_init_file(inputrc_name)
1238 except:
1240 except:
1239 warn('Problems reading readline initialization file <%s>'
1241 warn('Problems reading readline initialization file <%s>'
1240 % inputrc_name)
1242 % inputrc_name)
1241
1243
1242 self.has_readline = 1
1244 self.has_readline = 1
1243 self.readline = readline
1245 self.readline = readline
1244 # save this in sys so embedded copies can restore it properly
1246 # save this in sys so embedded copies can restore it properly
1245 sys.ipcompleter = self.Completer.complete
1247 sys.ipcompleter = self.Completer.complete
1246 readline.set_completer(self.Completer.complete)
1248 readline.set_completer(self.Completer.complete)
1247
1249
1248 # Configure readline according to user's prefs
1250 # Configure readline according to user's prefs
1249 for rlcommand in self.rc.readline_parse_and_bind:
1251 for rlcommand in self.rc.readline_parse_and_bind:
1250 readline.parse_and_bind(rlcommand)
1252 readline.parse_and_bind(rlcommand)
1251
1253
1252 # remove some chars from the delimiters list
1254 # remove some chars from the delimiters list
1253 delims = readline.get_completer_delims()
1255 delims = readline.get_completer_delims()
1254 delims = delims.translate(string._idmap,
1256 delims = delims.translate(string._idmap,
1255 self.rc.readline_remove_delims)
1257 self.rc.readline_remove_delims)
1256 readline.set_completer_delims(delims)
1258 readline.set_completer_delims(delims)
1257 # otherwise we end up with a monster history after a while:
1259 # otherwise we end up with a monster history after a while:
1258 readline.set_history_length(1000)
1260 readline.set_history_length(1000)
1259 try:
1261 try:
1260 #print '*** Reading readline history' # dbg
1262 #print '*** Reading readline history' # dbg
1261 readline.read_history_file(self.histfile)
1263 readline.read_history_file(self.histfile)
1262 except IOError:
1264 except IOError:
1263 pass # It doesn't exist yet.
1265 pass # It doesn't exist yet.
1264
1266
1265 atexit.register(self.atexit_operations)
1267 atexit.register(self.atexit_operations)
1266 del atexit
1268 del atexit
1267
1269
1268 # Configure auto-indent for all platforms
1270 # Configure auto-indent for all platforms
1269 self.set_autoindent(self.rc.autoindent)
1271 self.set_autoindent(self.rc.autoindent)
1270
1272
1271 def ask_yes_no(self,prompt,default=True):
1273 def ask_yes_no(self,prompt,default=True):
1272 if self.rc.quiet:
1274 if self.rc.quiet:
1273 return True
1275 return True
1274 return ask_yes_no(prompt,default)
1276 return ask_yes_no(prompt,default)
1275
1277
1276 def _should_recompile(self,e):
1278 def _should_recompile(self,e):
1277 """Utility routine for edit_syntax_error"""
1279 """Utility routine for edit_syntax_error"""
1278
1280
1279 if e.filename in ('<ipython console>','<input>','<string>',
1281 if e.filename in ('<ipython console>','<input>','<string>',
1280 '<console>','<BackgroundJob compilation>',
1282 '<console>','<BackgroundJob compilation>',
1281 None):
1283 None):
1282
1284
1283 return False
1285 return False
1284 try:
1286 try:
1285 if (self.rc.autoedit_syntax and
1287 if (self.rc.autoedit_syntax and
1286 not self.ask_yes_no('Return to editor to correct syntax error? '
1288 not self.ask_yes_no('Return to editor to correct syntax error? '
1287 '[Y/n] ','y')):
1289 '[Y/n] ','y')):
1288 return False
1290 return False
1289 except EOFError:
1291 except EOFError:
1290 return False
1292 return False
1291
1293
1292 def int0(x):
1294 def int0(x):
1293 try:
1295 try:
1294 return int(x)
1296 return int(x)
1295 except TypeError:
1297 except TypeError:
1296 return 0
1298 return 0
1297 # always pass integer line and offset values to editor hook
1299 # always pass integer line and offset values to editor hook
1298 self.hooks.fix_error_editor(e.filename,
1300 self.hooks.fix_error_editor(e.filename,
1299 int0(e.lineno),int0(e.offset),e.msg)
1301 int0(e.lineno),int0(e.offset),e.msg)
1300 return True
1302 return True
1301
1303
1302 def edit_syntax_error(self):
1304 def edit_syntax_error(self):
1303 """The bottom half of the syntax error handler called in the main loop.
1305 """The bottom half of the syntax error handler called in the main loop.
1304
1306
1305 Loop until syntax error is fixed or user cancels.
1307 Loop until syntax error is fixed or user cancels.
1306 """
1308 """
1307
1309
1308 while self.SyntaxTB.last_syntax_error:
1310 while self.SyntaxTB.last_syntax_error:
1309 # copy and clear last_syntax_error
1311 # copy and clear last_syntax_error
1310 err = self.SyntaxTB.clear_err_state()
1312 err = self.SyntaxTB.clear_err_state()
1311 if not self._should_recompile(err):
1313 if not self._should_recompile(err):
1312 return
1314 return
1313 try:
1315 try:
1314 # may set last_syntax_error again if a SyntaxError is raised
1316 # may set last_syntax_error again if a SyntaxError is raised
1315 self.safe_execfile(err.filename,self.user_ns)
1317 self.safe_execfile(err.filename,self.user_ns)
1316 except:
1318 except:
1317 self.showtraceback()
1319 self.showtraceback()
1318 else:
1320 else:
1319 try:
1321 try:
1320 f = file(err.filename)
1322 f = file(err.filename)
1321 try:
1323 try:
1322 sys.displayhook(f.read())
1324 sys.displayhook(f.read())
1323 finally:
1325 finally:
1324 f.close()
1326 f.close()
1325 except:
1327 except:
1326 self.showtraceback()
1328 self.showtraceback()
1327
1329
1328 def showsyntaxerror(self, filename=None):
1330 def showsyntaxerror(self, filename=None):
1329 """Display the syntax error that just occurred.
1331 """Display the syntax error that just occurred.
1330
1332
1331 This doesn't display a stack trace because there isn't one.
1333 This doesn't display a stack trace because there isn't one.
1332
1334
1333 If a filename is given, it is stuffed in the exception instead
1335 If a filename is given, it is stuffed in the exception instead
1334 of what was there before (because Python's parser always uses
1336 of what was there before (because Python's parser always uses
1335 "<string>" when reading from a string).
1337 "<string>" when reading from a string).
1336 """
1338 """
1337 etype, value, last_traceback = sys.exc_info()
1339 etype, value, last_traceback = sys.exc_info()
1338
1340
1339 # See note about these variables in showtraceback() below
1341 # See note about these variables in showtraceback() below
1340 sys.last_type = etype
1342 sys.last_type = etype
1341 sys.last_value = value
1343 sys.last_value = value
1342 sys.last_traceback = last_traceback
1344 sys.last_traceback = last_traceback
1343
1345
1344 if filename and etype is SyntaxError:
1346 if filename and etype is SyntaxError:
1345 # Work hard to stuff the correct filename in the exception
1347 # Work hard to stuff the correct filename in the exception
1346 try:
1348 try:
1347 msg, (dummy_filename, lineno, offset, line) = value
1349 msg, (dummy_filename, lineno, offset, line) = value
1348 except:
1350 except:
1349 # Not the format we expect; leave it alone
1351 # Not the format we expect; leave it alone
1350 pass
1352 pass
1351 else:
1353 else:
1352 # Stuff in the right filename
1354 # Stuff in the right filename
1353 try:
1355 try:
1354 # Assume SyntaxError is a class exception
1356 # Assume SyntaxError is a class exception
1355 value = SyntaxError(msg, (filename, lineno, offset, line))
1357 value = SyntaxError(msg, (filename, lineno, offset, line))
1356 except:
1358 except:
1357 # If that failed, assume SyntaxError is a string
1359 # If that failed, assume SyntaxError is a string
1358 value = msg, (filename, lineno, offset, line)
1360 value = msg, (filename, lineno, offset, line)
1359 self.SyntaxTB(etype,value,[])
1361 self.SyntaxTB(etype,value,[])
1360
1362
1361 def debugger(self):
1363 def debugger(self):
1362 """Call the pdb debugger."""
1364 """Call the pdb debugger."""
1363
1365
1364 if not self.rc.pdb:
1366 if not self.rc.pdb:
1365 return
1367 return
1366 pdb.pm()
1368 pdb.pm()
1367
1369
1368 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1370 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1369 """Display the exception that just occurred.
1371 """Display the exception that just occurred.
1370
1372
1371 If nothing is known about the exception, this is the method which
1373 If nothing is known about the exception, this is the method which
1372 should be used throughout the code for presenting user tracebacks,
1374 should be used throughout the code for presenting user tracebacks,
1373 rather than directly invoking the InteractiveTB object.
1375 rather than directly invoking the InteractiveTB object.
1374
1376
1375 A specific showsyntaxerror() also exists, but this method can take
1377 A specific showsyntaxerror() also exists, but this method can take
1376 care of calling it if needed, so unless you are explicitly catching a
1378 care of calling it if needed, so unless you are explicitly catching a
1377 SyntaxError exception, don't try to analyze the stack manually and
1379 SyntaxError exception, don't try to analyze the stack manually and
1378 simply call this method."""
1380 simply call this method."""
1379
1381
1380 # Though this won't be called by syntax errors in the input line,
1382 # Though this won't be called by syntax errors in the input line,
1381 # there may be SyntaxError cases whith imported code.
1383 # there may be SyntaxError cases whith imported code.
1382 if exc_tuple is None:
1384 if exc_tuple is None:
1383 etype, value, tb = sys.exc_info()
1385 etype, value, tb = sys.exc_info()
1384 else:
1386 else:
1385 etype, value, tb = exc_tuple
1387 etype, value, tb = exc_tuple
1386 if etype is SyntaxError:
1388 if etype is SyntaxError:
1387 self.showsyntaxerror(filename)
1389 self.showsyntaxerror(filename)
1388 else:
1390 else:
1389 # WARNING: these variables are somewhat deprecated and not
1391 # WARNING: these variables are somewhat deprecated and not
1390 # necessarily safe to use in a threaded environment, but tools
1392 # necessarily safe to use in a threaded environment, but tools
1391 # like pdb depend on their existence, so let's set them. If we
1393 # like pdb depend on their existence, so let's set them. If we
1392 # find problems in the field, we'll need to revisit their use.
1394 # find problems in the field, we'll need to revisit their use.
1393 sys.last_type = etype
1395 sys.last_type = etype
1394 sys.last_value = value
1396 sys.last_value = value
1395 sys.last_traceback = tb
1397 sys.last_traceback = tb
1396
1398
1397 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1399 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1398 if self.InteractiveTB.call_pdb and self.has_readline:
1400 if self.InteractiveTB.call_pdb and self.has_readline:
1399 # pdb mucks up readline, fix it back
1401 # pdb mucks up readline, fix it back
1400 self.readline.set_completer(self.Completer.complete)
1402 self.readline.set_completer(self.Completer.complete)
1401
1403
1402 def mainloop(self,banner=None):
1404 def mainloop(self,banner=None):
1403 """Creates the local namespace and starts the mainloop.
1405 """Creates the local namespace and starts the mainloop.
1404
1406
1405 If an optional banner argument is given, it will override the
1407 If an optional banner argument is given, it will override the
1406 internally created default banner."""
1408 internally created default banner."""
1407
1409
1408 if self.rc.c: # Emulate Python's -c option
1410 if self.rc.c: # Emulate Python's -c option
1409 self.exec_init_cmd()
1411 self.exec_init_cmd()
1410 if banner is None:
1412 if banner is None:
1411 if not self.rc.banner:
1413 if not self.rc.banner:
1412 banner = ''
1414 banner = ''
1413 # banner is string? Use it directly!
1415 # banner is string? Use it directly!
1414 elif isinstance(self.rc.banner,basestring):
1416 elif isinstance(self.rc.banner,basestring):
1415 banner = self.rc.banner
1417 banner = self.rc.banner
1416 else:
1418 else:
1417 banner = self.BANNER+self.banner2
1419 banner = self.BANNER+self.banner2
1418
1420
1419 self.interact(banner)
1421 self.interact(banner)
1420
1422
1421 def exec_init_cmd(self):
1423 def exec_init_cmd(self):
1422 """Execute a command given at the command line.
1424 """Execute a command given at the command line.
1423
1425
1424 This emulates Python's -c option."""
1426 This emulates Python's -c option."""
1425
1427
1426 #sys.argv = ['-c']
1428 #sys.argv = ['-c']
1427 self.push(self.rc.c)
1429 self.push(self.rc.c)
1428
1430
1429 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1431 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1430 """Embeds IPython into a running python program.
1432 """Embeds IPython into a running python program.
1431
1433
1432 Input:
1434 Input:
1433
1435
1434 - header: An optional header message can be specified.
1436 - header: An optional header message can be specified.
1435
1437
1436 - local_ns, global_ns: working namespaces. If given as None, the
1438 - local_ns, global_ns: working namespaces. If given as None, the
1437 IPython-initialized one is updated with __main__.__dict__, so that
1439 IPython-initialized one is updated with __main__.__dict__, so that
1438 program variables become visible but user-specific configuration
1440 program variables become visible but user-specific configuration
1439 remains possible.
1441 remains possible.
1440
1442
1441 - stack_depth: specifies how many levels in the stack to go to
1443 - stack_depth: specifies how many levels in the stack to go to
1442 looking for namespaces (when local_ns and global_ns are None). This
1444 looking for namespaces (when local_ns and global_ns are None). This
1443 allows an intermediate caller to make sure that this function gets
1445 allows an intermediate caller to make sure that this function gets
1444 the namespace from the intended level in the stack. By default (0)
1446 the namespace from the intended level in the stack. By default (0)
1445 it will get its locals and globals from the immediate caller.
1447 it will get its locals and globals from the immediate caller.
1446
1448
1447 Warning: it's possible to use this in a program which is being run by
1449 Warning: it's possible to use this in a program which is being run by
1448 IPython itself (via %run), but some funny things will happen (a few
1450 IPython itself (via %run), but some funny things will happen (a few
1449 globals get overwritten). In the future this will be cleaned up, as
1451 globals get overwritten). In the future this will be cleaned up, as
1450 there is no fundamental reason why it can't work perfectly."""
1452 there is no fundamental reason why it can't work perfectly."""
1451
1453
1452 # Get locals and globals from caller
1454 # Get locals and globals from caller
1453 if local_ns is None or global_ns is None:
1455 if local_ns is None or global_ns is None:
1454 call_frame = sys._getframe(stack_depth).f_back
1456 call_frame = sys._getframe(stack_depth).f_back
1455
1457
1456 if local_ns is None:
1458 if local_ns is None:
1457 local_ns = call_frame.f_locals
1459 local_ns = call_frame.f_locals
1458 if global_ns is None:
1460 if global_ns is None:
1459 global_ns = call_frame.f_globals
1461 global_ns = call_frame.f_globals
1460
1462
1461 # Update namespaces and fire up interpreter
1463 # Update namespaces and fire up interpreter
1462
1464
1463 # The global one is easy, we can just throw it in
1465 # The global one is easy, we can just throw it in
1464 self.user_global_ns = global_ns
1466 self.user_global_ns = global_ns
1465
1467
1466 # but the user/local one is tricky: ipython needs it to store internal
1468 # but the user/local one is tricky: ipython needs it to store internal
1467 # data, but we also need the locals. We'll copy locals in the user
1469 # data, but we also need the locals. We'll copy locals in the user
1468 # one, but will track what got copied so we can delete them at exit.
1470 # one, but will track what got copied so we can delete them at exit.
1469 # This is so that a later embedded call doesn't see locals from a
1471 # This is so that a later embedded call doesn't see locals from a
1470 # previous call (which most likely existed in a separate scope).
1472 # previous call (which most likely existed in a separate scope).
1471 local_varnames = local_ns.keys()
1473 local_varnames = local_ns.keys()
1472 self.user_ns.update(local_ns)
1474 self.user_ns.update(local_ns)
1473
1475
1474 # Patch for global embedding to make sure that things don't overwrite
1476 # Patch for global embedding to make sure that things don't overwrite
1475 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1477 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1476 # FIXME. Test this a bit more carefully (the if.. is new)
1478 # FIXME. Test this a bit more carefully (the if.. is new)
1477 if local_ns is None and global_ns is None:
1479 if local_ns is None and global_ns is None:
1478 self.user_global_ns.update(__main__.__dict__)
1480 self.user_global_ns.update(__main__.__dict__)
1479
1481
1480 # make sure the tab-completer has the correct frame information, so it
1482 # make sure the tab-completer has the correct frame information, so it
1481 # actually completes using the frame's locals/globals
1483 # actually completes using the frame's locals/globals
1482 self.set_completer_frame()
1484 self.set_completer_frame()
1483
1485
1484 # before activating the interactive mode, we need to make sure that
1486 # before activating the interactive mode, we need to make sure that
1485 # all names in the builtin namespace needed by ipython point to
1487 # all names in the builtin namespace needed by ipython point to
1486 # ourselves, and not to other instances.
1488 # ourselves, and not to other instances.
1487 self.add_builtins()
1489 self.add_builtins()
1488
1490
1489 self.interact(header)
1491 self.interact(header)
1490
1492
1491 # now, purge out the user namespace from anything we might have added
1493 # now, purge out the user namespace from anything we might have added
1492 # from the caller's local namespace
1494 # from the caller's local namespace
1493 delvar = self.user_ns.pop
1495 delvar = self.user_ns.pop
1494 for var in local_varnames:
1496 for var in local_varnames:
1495 delvar(var,None)
1497 delvar(var,None)
1496 # and clean builtins we may have overridden
1498 # and clean builtins we may have overridden
1497 self.clean_builtins()
1499 self.clean_builtins()
1498
1500
1499 def interact(self, banner=None):
1501 def interact(self, banner=None):
1500 """Closely emulate the interactive Python console.
1502 """Closely emulate the interactive Python console.
1501
1503
1502 The optional banner argument specify the banner to print
1504 The optional banner argument specify the banner to print
1503 before the first interaction; by default it prints a banner
1505 before the first interaction; by default it prints a banner
1504 similar to the one printed by the real Python interpreter,
1506 similar to the one printed by the real Python interpreter,
1505 followed by the current class name in parentheses (so as not
1507 followed by the current class name in parentheses (so as not
1506 to confuse this with the real interpreter -- since it's so
1508 to confuse this with the real interpreter -- since it's so
1507 close!).
1509 close!).
1508
1510
1509 """
1511 """
1510
1512
1511 if self.exit_now:
1513 if self.exit_now:
1512 # batch run -> do not interact
1514 # batch run -> do not interact
1513 return
1515 return
1514 cprt = 'Type "copyright", "credits" or "license" for more information.'
1516 cprt = 'Type "copyright", "credits" or "license" for more information.'
1515 if banner is None:
1517 if banner is None:
1516 self.write("Python %s on %s\n%s\n(%s)\n" %
1518 self.write("Python %s on %s\n%s\n(%s)\n" %
1517 (sys.version, sys.platform, cprt,
1519 (sys.version, sys.platform, cprt,
1518 self.__class__.__name__))
1520 self.__class__.__name__))
1519 else:
1521 else:
1520 self.write(banner)
1522 self.write(banner)
1521
1523
1522 more = 0
1524 more = 0
1523
1525
1524 # Mark activity in the builtins
1526 # Mark activity in the builtins
1525 __builtin__.__dict__['__IPYTHON__active'] += 1
1527 __builtin__.__dict__['__IPYTHON__active'] += 1
1526
1528
1527 # exit_now is set by a call to %Exit or %Quit
1529 # exit_now is set by a call to %Exit or %Quit
1528 while not self.exit_now:
1530 while not self.exit_now:
1529 if more:
1531 if more:
1530 prompt = self.hooks.generate_prompt(True)
1532 prompt = self.hooks.generate_prompt(True)
1531 if self.autoindent:
1533 if self.autoindent:
1532 self.readline_startup_hook(self.pre_readline)
1534 self.readline_startup_hook(self.pre_readline)
1533 else:
1535 else:
1534 prompt = self.hooks.generate_prompt(False)
1536 prompt = self.hooks.generate_prompt(False)
1535 try:
1537 try:
1536 line = self.raw_input(prompt,more)
1538 line = self.raw_input(prompt,more)
1537 if self.exit_now:
1539 if self.exit_now:
1538 # quick exit on sys.std[in|out] close
1540 # quick exit on sys.std[in|out] close
1539 break
1541 break
1540 if self.autoindent:
1542 if self.autoindent:
1541 self.readline_startup_hook(None)
1543 self.readline_startup_hook(None)
1542 except KeyboardInterrupt:
1544 except KeyboardInterrupt:
1543 self.write('\nKeyboardInterrupt\n')
1545 self.write('\nKeyboardInterrupt\n')
1544 self.resetbuffer()
1546 self.resetbuffer()
1545 # keep cache in sync with the prompt counter:
1547 # keep cache in sync with the prompt counter:
1546 self.outputcache.prompt_count -= 1
1548 self.outputcache.prompt_count -= 1
1547
1549
1548 if self.autoindent:
1550 if self.autoindent:
1549 self.indent_current_nsp = 0
1551 self.indent_current_nsp = 0
1550 more = 0
1552 more = 0
1551 except EOFError:
1553 except EOFError:
1552 if self.autoindent:
1554 if self.autoindent:
1553 self.readline_startup_hook(None)
1555 self.readline_startup_hook(None)
1554 self.write('\n')
1556 self.write('\n')
1555 self.exit()
1557 self.exit()
1556 except bdb.BdbQuit:
1558 except bdb.BdbQuit:
1557 warn('The Python debugger has exited with a BdbQuit exception.\n'
1559 warn('The Python debugger has exited with a BdbQuit exception.\n'
1558 'Because of how pdb handles the stack, it is impossible\n'
1560 'Because of how pdb handles the stack, it is impossible\n'
1559 'for IPython to properly format this particular exception.\n'
1561 'for IPython to properly format this particular exception.\n'
1560 'IPython will resume normal operation.')
1562 'IPython will resume normal operation.')
1561 except:
1563 except:
1562 # exceptions here are VERY RARE, but they can be triggered
1564 # exceptions here are VERY RARE, but they can be triggered
1563 # asynchronously by signal handlers, for example.
1565 # asynchronously by signal handlers, for example.
1564 self.showtraceback()
1566 self.showtraceback()
1565 else:
1567 else:
1566 more = self.push(line)
1568 more = self.push(line)
1567 if (self.SyntaxTB.last_syntax_error and
1569 if (self.SyntaxTB.last_syntax_error and
1568 self.rc.autoedit_syntax):
1570 self.rc.autoedit_syntax):
1569 self.edit_syntax_error()
1571 self.edit_syntax_error()
1570
1572
1571 # We are off again...
1573 # We are off again...
1572 __builtin__.__dict__['__IPYTHON__active'] -= 1
1574 __builtin__.__dict__['__IPYTHON__active'] -= 1
1573
1575
1574 def excepthook(self, etype, value, tb):
1576 def excepthook(self, etype, value, tb):
1575 """One more defense for GUI apps that call sys.excepthook.
1577 """One more defense for GUI apps that call sys.excepthook.
1576
1578
1577 GUI frameworks like wxPython trap exceptions and call
1579 GUI frameworks like wxPython trap exceptions and call
1578 sys.excepthook themselves. I guess this is a feature that
1580 sys.excepthook themselves. I guess this is a feature that
1579 enables them to keep running after exceptions that would
1581 enables them to keep running after exceptions that would
1580 otherwise kill their mainloop. This is a bother for IPython
1582 otherwise kill their mainloop. This is a bother for IPython
1581 which excepts to catch all of the program exceptions with a try:
1583 which excepts to catch all of the program exceptions with a try:
1582 except: statement.
1584 except: statement.
1583
1585
1584 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1586 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1585 any app directly invokes sys.excepthook, it will look to the user like
1587 any app directly invokes sys.excepthook, it will look to the user like
1586 IPython crashed. In order to work around this, we can disable the
1588 IPython crashed. In order to work around this, we can disable the
1587 CrashHandler and replace it with this excepthook instead, which prints a
1589 CrashHandler and replace it with this excepthook instead, which prints a
1588 regular traceback using our InteractiveTB. In this fashion, apps which
1590 regular traceback using our InteractiveTB. In this fashion, apps which
1589 call sys.excepthook will generate a regular-looking exception from
1591 call sys.excepthook will generate a regular-looking exception from
1590 IPython, and the CrashHandler will only be triggered by real IPython
1592 IPython, and the CrashHandler will only be triggered by real IPython
1591 crashes.
1593 crashes.
1592
1594
1593 This hook should be used sparingly, only in places which are not likely
1595 This hook should be used sparingly, only in places which are not likely
1594 to be true IPython errors.
1596 to be true IPython errors.
1595 """
1597 """
1596 self.showtraceback((etype,value,tb),tb_offset=0)
1598 self.showtraceback((etype,value,tb),tb_offset=0)
1597
1599
1598 def expand_aliases(self,fn,rest):
1600 def expand_aliases(self,fn,rest):
1599 """ Expand multiple levels of aliases:
1601 """ Expand multiple levels of aliases:
1600
1602
1601 if:
1603 if:
1602
1604
1603 alias foo bar /tmp
1605 alias foo bar /tmp
1604 alias baz foo
1606 alias baz foo
1605
1607
1606 then:
1608 then:
1607
1609
1608 baz huhhahhei -> bar /tmp huhhahhei
1610 baz huhhahhei -> bar /tmp huhhahhei
1609
1611
1610 """
1612 """
1611 line = fn + " " + rest
1613 line = fn + " " + rest
1612
1614
1613 done = Set()
1615 done = Set()
1614 while 1:
1616 while 1:
1615 pre,fn,rest = self.split_user_input(line)
1617 pre,fn,rest = self.split_user_input(line)
1616 if fn in self.alias_table:
1618 if fn in self.alias_table:
1617 if fn in done:
1619 if fn in done:
1618 warn("Cyclic alias definition, repeated '%s'" % fn)
1620 warn("Cyclic alias definition, repeated '%s'" % fn)
1619 return ""
1621 return ""
1620 done.add(fn)
1622 done.add(fn)
1621
1623
1622 l2 = self.transform_alias(fn,rest)
1624 l2 = self.transform_alias(fn,rest)
1623 # dir -> dir
1625 # dir -> dir
1624 if l2 == line:
1626 if l2 == line:
1625 break
1627 break
1626 # ls -> ls -F should not recurse forever
1628 # ls -> ls -F should not recurse forever
1627 if l2.split(None,1)[0] == line.split(None,1)[0]:
1629 if l2.split(None,1)[0] == line.split(None,1)[0]:
1628 line = l2
1630 line = l2
1629 break
1631 break
1630
1632
1631 line=l2
1633 line=l2
1632
1634
1633
1635
1634 # print "al expand to",line #dbg
1636 # print "al expand to",line #dbg
1635 else:
1637 else:
1636 break
1638 break
1637
1639
1638 return line
1640 return line
1639
1641
1640 def transform_alias(self, alias,rest=''):
1642 def transform_alias(self, alias,rest=''):
1641 """ Transform alias to system command string.
1643 """ Transform alias to system command string.
1642 """
1644 """
1643 nargs,cmd = self.alias_table[alias]
1645 nargs,cmd = self.alias_table[alias]
1644 if ' ' in cmd and os.path.isfile(cmd):
1646 if ' ' in cmd and os.path.isfile(cmd):
1645 cmd = '"%s"' % cmd
1647 cmd = '"%s"' % cmd
1646
1648
1647 # Expand the %l special to be the user's input line
1649 # Expand the %l special to be the user's input line
1648 if cmd.find('%l') >= 0:
1650 if cmd.find('%l') >= 0:
1649 cmd = cmd.replace('%l',rest)
1651 cmd = cmd.replace('%l',rest)
1650 rest = ''
1652 rest = ''
1651 if nargs==0:
1653 if nargs==0:
1652 # Simple, argument-less aliases
1654 # Simple, argument-less aliases
1653 cmd = '%s %s' % (cmd,rest)
1655 cmd = '%s %s' % (cmd,rest)
1654 else:
1656 else:
1655 # Handle aliases with positional arguments
1657 # Handle aliases with positional arguments
1656 args = rest.split(None,nargs)
1658 args = rest.split(None,nargs)
1657 if len(args)< nargs:
1659 if len(args)< nargs:
1658 error('Alias <%s> requires %s arguments, %s given.' %
1660 error('Alias <%s> requires %s arguments, %s given.' %
1659 (alias,nargs,len(args)))
1661 (alias,nargs,len(args)))
1660 return None
1662 return None
1661 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1663 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1662 # Now call the macro, evaluating in the user's namespace
1664 # Now call the macro, evaluating in the user's namespace
1663 #print 'new command: <%r>' % cmd # dbg
1665 #print 'new command: <%r>' % cmd # dbg
1664 return cmd
1666 return cmd
1665
1667
1666 def call_alias(self,alias,rest=''):
1668 def call_alias(self,alias,rest=''):
1667 """Call an alias given its name and the rest of the line.
1669 """Call an alias given its name and the rest of the line.
1668
1670
1669 This is only used to provide backwards compatibility for users of
1671 This is only used to provide backwards compatibility for users of
1670 ipalias(), use of which is not recommended for anymore."""
1672 ipalias(), use of which is not recommended for anymore."""
1671
1673
1672 # Now call the macro, evaluating in the user's namespace
1674 # Now call the macro, evaluating in the user's namespace
1673 cmd = self.transform_alias(alias, rest)
1675 cmd = self.transform_alias(alias, rest)
1674 try:
1676 try:
1675 self.system(cmd)
1677 self.system(cmd)
1676 except:
1678 except:
1677 self.showtraceback()
1679 self.showtraceback()
1678
1680
1679 def indent_current_str(self):
1681 def indent_current_str(self):
1680 """return the current level of indentation as a string"""
1682 """return the current level of indentation as a string"""
1681 return self.indent_current_nsp * ' '
1683 return self.indent_current_nsp * ' '
1682
1684
1683 def autoindent_update(self,line):
1685 def autoindent_update(self,line):
1684 """Keep track of the indent level."""
1686 """Keep track of the indent level."""
1685
1687
1686 #debugx('line')
1688 #debugx('line')
1687 #debugx('self.indent_current_nsp')
1689 #debugx('self.indent_current_nsp')
1688 if self.autoindent:
1690 if self.autoindent:
1689 if line:
1691 if line:
1690 inisp = num_ini_spaces(line)
1692 inisp = num_ini_spaces(line)
1691 if inisp < self.indent_current_nsp:
1693 if inisp < self.indent_current_nsp:
1692 self.indent_current_nsp = inisp
1694 self.indent_current_nsp = inisp
1693
1695
1694 if line[-1] == ':':
1696 if line[-1] == ':':
1695 self.indent_current_nsp += 4
1697 self.indent_current_nsp += 4
1696 elif dedent_re.match(line):
1698 elif dedent_re.match(line):
1697 self.indent_current_nsp -= 4
1699 self.indent_current_nsp -= 4
1698 else:
1700 else:
1699 self.indent_current_nsp = 0
1701 self.indent_current_nsp = 0
1700
1702
1701 def runlines(self,lines):
1703 def runlines(self,lines):
1702 """Run a string of one or more lines of source.
1704 """Run a string of one or more lines of source.
1703
1705
1704 This method is capable of running a string containing multiple source
1706 This method is capable of running a string containing multiple source
1705 lines, as if they had been entered at the IPython prompt. Since it
1707 lines, as if they had been entered at the IPython prompt. Since it
1706 exposes IPython's processing machinery, the given strings can contain
1708 exposes IPython's processing machinery, the given strings can contain
1707 magic calls (%magic), special shell access (!cmd), etc."""
1709 magic calls (%magic), special shell access (!cmd), etc."""
1708
1710
1709 # We must start with a clean buffer, in case this is run from an
1711 # We must start with a clean buffer, in case this is run from an
1710 # interactive IPython session (via a magic, for example).
1712 # interactive IPython session (via a magic, for example).
1711 self.resetbuffer()
1713 self.resetbuffer()
1712 lines = lines.split('\n')
1714 lines = lines.split('\n')
1713 more = 0
1715 more = 0
1714 for line in lines:
1716 for line in lines:
1715 # skip blank lines so we don't mess up the prompt counter, but do
1717 # skip blank lines so we don't mess up the prompt counter, but do
1716 # NOT skip even a blank line if we are in a code block (more is
1718 # NOT skip even a blank line if we are in a code block (more is
1717 # true)
1719 # true)
1718 if line or more:
1720 if line or more:
1719 more = self.push(self.prefilter(line,more))
1721 more = self.push(self.prefilter(line,more))
1720 # IPython's runsource returns None if there was an error
1722 # IPython's runsource returns None if there was an error
1721 # compiling the code. This allows us to stop processing right
1723 # compiling the code. This allows us to stop processing right
1722 # away, so the user gets the error message at the right place.
1724 # away, so the user gets the error message at the right place.
1723 if more is None:
1725 if more is None:
1724 break
1726 break
1725 # final newline in case the input didn't have it, so that the code
1727 # final newline in case the input didn't have it, so that the code
1726 # actually does get executed
1728 # actually does get executed
1727 if more:
1729 if more:
1728 self.push('\n')
1730 self.push('\n')
1729
1731
1730 def runsource(self, source, filename='<input>', symbol='single'):
1732 def runsource(self, source, filename='<input>', symbol='single'):
1731 """Compile and run some source in the interpreter.
1733 """Compile and run some source in the interpreter.
1732
1734
1733 Arguments are as for compile_command().
1735 Arguments are as for compile_command().
1734
1736
1735 One several things can happen:
1737 One several things can happen:
1736
1738
1737 1) The input is incorrect; compile_command() raised an
1739 1) The input is incorrect; compile_command() raised an
1738 exception (SyntaxError or OverflowError). A syntax traceback
1740 exception (SyntaxError or OverflowError). A syntax traceback
1739 will be printed by calling the showsyntaxerror() method.
1741 will be printed by calling the showsyntaxerror() method.
1740
1742
1741 2) The input is incomplete, and more input is required;
1743 2) The input is incomplete, and more input is required;
1742 compile_command() returned None. Nothing happens.
1744 compile_command() returned None. Nothing happens.
1743
1745
1744 3) The input is complete; compile_command() returned a code
1746 3) The input is complete; compile_command() returned a code
1745 object. The code is executed by calling self.runcode() (which
1747 object. The code is executed by calling self.runcode() (which
1746 also handles run-time exceptions, except for SystemExit).
1748 also handles run-time exceptions, except for SystemExit).
1747
1749
1748 The return value is:
1750 The return value is:
1749
1751
1750 - True in case 2
1752 - True in case 2
1751
1753
1752 - False in the other cases, unless an exception is raised, where
1754 - False in the other cases, unless an exception is raised, where
1753 None is returned instead. This can be used by external callers to
1755 None is returned instead. This can be used by external callers to
1754 know whether to continue feeding input or not.
1756 know whether to continue feeding input or not.
1755
1757
1756 The return value can be used to decide whether to use sys.ps1 or
1758 The return value can be used to decide whether to use sys.ps1 or
1757 sys.ps2 to prompt the next line."""
1759 sys.ps2 to prompt the next line."""
1758
1760
1759 try:
1761 try:
1760 code = self.compile(source,filename,symbol)
1762 code = self.compile(source,filename,symbol)
1761 except (OverflowError, SyntaxError, ValueError):
1763 except (OverflowError, SyntaxError, ValueError):
1762 # Case 1
1764 # Case 1
1763 self.showsyntaxerror(filename)
1765 self.showsyntaxerror(filename)
1764 return None
1766 return None
1765
1767
1766 if code is None:
1768 if code is None:
1767 # Case 2
1769 # Case 2
1768 return True
1770 return True
1769
1771
1770 # Case 3
1772 # Case 3
1771 # We store the code object so that threaded shells and
1773 # We store the code object so that threaded shells and
1772 # custom exception handlers can access all this info if needed.
1774 # custom exception handlers can access all this info if needed.
1773 # The source corresponding to this can be obtained from the
1775 # The source corresponding to this can be obtained from the
1774 # buffer attribute as '\n'.join(self.buffer).
1776 # buffer attribute as '\n'.join(self.buffer).
1775 self.code_to_run = code
1777 self.code_to_run = code
1776 # now actually execute the code object
1778 # now actually execute the code object
1777 if self.runcode(code) == 0:
1779 if self.runcode(code) == 0:
1778 return False
1780 return False
1779 else:
1781 else:
1780 return None
1782 return None
1781
1783
1782 def runcode(self,code_obj):
1784 def runcode(self,code_obj):
1783 """Execute a code object.
1785 """Execute a code object.
1784
1786
1785 When an exception occurs, self.showtraceback() is called to display a
1787 When an exception occurs, self.showtraceback() is called to display a
1786 traceback.
1788 traceback.
1787
1789
1788 Return value: a flag indicating whether the code to be run completed
1790 Return value: a flag indicating whether the code to be run completed
1789 successfully:
1791 successfully:
1790
1792
1791 - 0: successful execution.
1793 - 0: successful execution.
1792 - 1: an error occurred.
1794 - 1: an error occurred.
1793 """
1795 """
1794
1796
1795 # Set our own excepthook in case the user code tries to call it
1797 # Set our own excepthook in case the user code tries to call it
1796 # directly, so that the IPython crash handler doesn't get triggered
1798 # directly, so that the IPython crash handler doesn't get triggered
1797 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1799 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1798
1800
1799 # we save the original sys.excepthook in the instance, in case config
1801 # we save the original sys.excepthook in the instance, in case config
1800 # code (such as magics) needs access to it.
1802 # code (such as magics) needs access to it.
1801 self.sys_excepthook = old_excepthook
1803 self.sys_excepthook = old_excepthook
1802 outflag = 1 # happens in more places, so it's easier as default
1804 outflag = 1 # happens in more places, so it's easier as default
1803 try:
1805 try:
1804 try:
1806 try:
1805 # Embedded instances require separate global/local namespaces
1807 # Embedded instances require separate global/local namespaces
1806 # so they can see both the surrounding (local) namespace and
1808 # so they can see both the surrounding (local) namespace and
1807 # the module-level globals when called inside another function.
1809 # the module-level globals when called inside another function.
1808 if self.embedded:
1810 if self.embedded:
1809 exec code_obj in self.user_global_ns, self.user_ns
1811 exec code_obj in self.user_global_ns, self.user_ns
1810 # Normal (non-embedded) instances should only have a single
1812 # Normal (non-embedded) instances should only have a single
1811 # namespace for user code execution, otherwise functions won't
1813 # namespace for user code execution, otherwise functions won't
1812 # see interactive top-level globals.
1814 # see interactive top-level globals.
1813 else:
1815 else:
1814 exec code_obj in self.user_ns
1816 exec code_obj in self.user_ns
1815 finally:
1817 finally:
1816 # Reset our crash handler in place
1818 # Reset our crash handler in place
1817 sys.excepthook = old_excepthook
1819 sys.excepthook = old_excepthook
1818 except SystemExit:
1820 except SystemExit:
1819 self.resetbuffer()
1821 self.resetbuffer()
1820 self.showtraceback()
1822 self.showtraceback()
1821 warn("Type %exit or %quit to exit IPython "
1823 warn("Type %exit or %quit to exit IPython "
1822 "(%Exit or %Quit do so unconditionally).",level=1)
1824 "(%Exit or %Quit do so unconditionally).",level=1)
1823 except self.custom_exceptions:
1825 except self.custom_exceptions:
1824 etype,value,tb = sys.exc_info()
1826 etype,value,tb = sys.exc_info()
1825 self.CustomTB(etype,value,tb)
1827 self.CustomTB(etype,value,tb)
1826 except:
1828 except:
1827 self.showtraceback()
1829 self.showtraceback()
1828 else:
1830 else:
1829 outflag = 0
1831 outflag = 0
1830 if softspace(sys.stdout, 0):
1832 if softspace(sys.stdout, 0):
1831 print
1833 print
1832 # Flush out code object which has been run (and source)
1834 # Flush out code object which has been run (and source)
1833 self.code_to_run = None
1835 self.code_to_run = None
1834 return outflag
1836 return outflag
1835
1837
1836 def push(self, line):
1838 def push(self, line):
1837 """Push a line to the interpreter.
1839 """Push a line to the interpreter.
1838
1840
1839 The line should not have a trailing newline; it may have
1841 The line should not have a trailing newline; it may have
1840 internal newlines. The line is appended to a buffer and the
1842 internal newlines. The line is appended to a buffer and the
1841 interpreter's runsource() method is called with the
1843 interpreter's runsource() method is called with the
1842 concatenated contents of the buffer as source. If this
1844 concatenated contents of the buffer as source. If this
1843 indicates that the command was executed or invalid, the buffer
1845 indicates that the command was executed or invalid, the buffer
1844 is reset; otherwise, the command is incomplete, and the buffer
1846 is reset; otherwise, the command is incomplete, and the buffer
1845 is left as it was after the line was appended. The return
1847 is left as it was after the line was appended. The return
1846 value is 1 if more input is required, 0 if the line was dealt
1848 value is 1 if more input is required, 0 if the line was dealt
1847 with in some way (this is the same as runsource()).
1849 with in some way (this is the same as runsource()).
1848 """
1850 """
1849
1851
1850 # autoindent management should be done here, and not in the
1852 # autoindent management should be done here, and not in the
1851 # interactive loop, since that one is only seen by keyboard input. We
1853 # interactive loop, since that one is only seen by keyboard input. We
1852 # need this done correctly even for code run via runlines (which uses
1854 # need this done correctly even for code run via runlines (which uses
1853 # push).
1855 # push).
1854
1856
1855 #print 'push line: <%s>' % line # dbg
1857 #print 'push line: <%s>' % line # dbg
1856 for subline in line.splitlines():
1858 for subline in line.splitlines():
1857 self.autoindent_update(subline)
1859 self.autoindent_update(subline)
1858 self.buffer.append(line)
1860 self.buffer.append(line)
1859 more = self.runsource('\n'.join(self.buffer), self.filename)
1861 more = self.runsource('\n'.join(self.buffer), self.filename)
1860 if not more:
1862 if not more:
1861 self.resetbuffer()
1863 self.resetbuffer()
1862 return more
1864 return more
1863
1865
1864 def resetbuffer(self):
1866 def resetbuffer(self):
1865 """Reset the input buffer."""
1867 """Reset the input buffer."""
1866 self.buffer[:] = []
1868 self.buffer[:] = []
1867
1869
1868 def raw_input(self,prompt='',continue_prompt=False):
1870 def raw_input(self,prompt='',continue_prompt=False):
1869 """Write a prompt and read a line.
1871 """Write a prompt and read a line.
1870
1872
1871 The returned line does not include the trailing newline.
1873 The returned line does not include the trailing newline.
1872 When the user enters the EOF key sequence, EOFError is raised.
1874 When the user enters the EOF key sequence, EOFError is raised.
1873
1875
1874 Optional inputs:
1876 Optional inputs:
1875
1877
1876 - prompt(''): a string to be printed to prompt the user.
1878 - prompt(''): a string to be printed to prompt the user.
1877
1879
1878 - continue_prompt(False): whether this line is the first one or a
1880 - continue_prompt(False): whether this line is the first one or a
1879 continuation in a sequence of inputs.
1881 continuation in a sequence of inputs.
1880 """
1882 """
1881
1883
1882 try:
1884 try:
1883 line = raw_input_original(prompt)
1885 line = raw_input_original(prompt)
1884 except ValueError:
1886 except ValueError:
1885 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1887 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1886 self.exit_now = True
1888 self.exit_now = True
1887 return ""
1889 return ""
1888
1890
1889
1891
1890 # Try to be reasonably smart about not re-indenting pasted input more
1892 # Try to be reasonably smart about not re-indenting pasted input more
1891 # than necessary. We do this by trimming out the auto-indent initial
1893 # than necessary. We do this by trimming out the auto-indent initial
1892 # spaces, if the user's actual input started itself with whitespace.
1894 # spaces, if the user's actual input started itself with whitespace.
1893 #debugx('self.buffer[-1]')
1895 #debugx('self.buffer[-1]')
1894
1896
1895 if self.autoindent:
1897 if self.autoindent:
1896 if num_ini_spaces(line) > self.indent_current_nsp:
1898 if num_ini_spaces(line) > self.indent_current_nsp:
1897 line = line[self.indent_current_nsp:]
1899 line = line[self.indent_current_nsp:]
1898 self.indent_current_nsp = 0
1900 self.indent_current_nsp = 0
1899
1901
1900 # store the unfiltered input before the user has any chance to modify
1902 # store the unfiltered input before the user has any chance to modify
1901 # it.
1903 # it.
1902 if line.strip():
1904 if line.strip():
1903 if continue_prompt:
1905 if continue_prompt:
1904 self.input_hist_raw[-1] += '%s\n' % line
1906 self.input_hist_raw[-1] += '%s\n' % line
1905 if self.has_readline: # and some config option is set?
1907 if self.has_readline: # and some config option is set?
1906 try:
1908 try:
1907 histlen = self.readline.get_current_history_length()
1909 histlen = self.readline.get_current_history_length()
1908 newhist = self.input_hist_raw[-1].rstrip()
1910 newhist = self.input_hist_raw[-1].rstrip()
1909 self.readline.remove_history_item(histlen-1)
1911 self.readline.remove_history_item(histlen-1)
1910 self.readline.replace_history_item(histlen-2,newhist)
1912 self.readline.replace_history_item(histlen-2,newhist)
1911 except AttributeError:
1913 except AttributeError:
1912 pass # re{move,place}_history_item are new in 2.4.
1914 pass # re{move,place}_history_item are new in 2.4.
1913 else:
1915 else:
1914 self.input_hist_raw.append('%s\n' % line)
1916 self.input_hist_raw.append('%s\n' % line)
1915
1917
1916 try:
1918 try:
1917 lineout = self.prefilter(line,continue_prompt)
1919 lineout = self.prefilter(line,continue_prompt)
1918 except:
1920 except:
1919 # blanket except, in case a user-defined prefilter crashes, so it
1921 # blanket except, in case a user-defined prefilter crashes, so it
1920 # can't take all of ipython with it.
1922 # can't take all of ipython with it.
1921 self.showtraceback()
1923 self.showtraceback()
1922 return ''
1924 return ''
1923 else:
1925 else:
1924 return lineout
1926 return lineout
1925
1927
1926 def split_user_input(self,line):
1928 def split_user_input(self,line):
1927 """Split user input into pre-char, function part and rest."""
1929 """Split user input into pre-char, function part and rest."""
1928
1930
1929 lsplit = self.line_split.match(line)
1931 lsplit = self.line_split.match(line)
1930 if lsplit is None: # no regexp match returns None
1932 if lsplit is None: # no regexp match returns None
1931 try:
1933 try:
1932 iFun,theRest = line.split(None,1)
1934 iFun,theRest = line.split(None,1)
1933 except ValueError:
1935 except ValueError:
1934 iFun,theRest = line,''
1936 iFun,theRest = line,''
1935 pre = re.match('^(\s*)(.*)',line).groups()[0]
1937 pre = re.match('^(\s*)(.*)',line).groups()[0]
1936 else:
1938 else:
1937 pre,iFun,theRest = lsplit.groups()
1939 pre,iFun,theRest = lsplit.groups()
1938
1940
1939 #print 'line:<%s>' % line # dbg
1941 #print 'line:<%s>' % line # dbg
1940 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1942 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1941 return pre,iFun.strip(),theRest
1943 return pre,iFun.strip(),theRest
1942
1944
1943 def _prefilter(self, line, continue_prompt):
1945 def _prefilter(self, line, continue_prompt):
1944 """Calls different preprocessors, depending on the form of line."""
1946 """Calls different preprocessors, depending on the form of line."""
1945
1947
1946 # All handlers *must* return a value, even if it's blank ('').
1948 # All handlers *must* return a value, even if it's blank ('').
1947
1949
1948 # Lines are NOT logged here. Handlers should process the line as
1950 # Lines are NOT logged here. Handlers should process the line as
1949 # needed, update the cache AND log it (so that the input cache array
1951 # needed, update the cache AND log it (so that the input cache array
1950 # stays synced).
1952 # stays synced).
1951
1953
1952 # This function is _very_ delicate, and since it's also the one which
1954 # This function is _very_ delicate, and since it's also the one which
1953 # determines IPython's response to user input, it must be as efficient
1955 # determines IPython's response to user input, it must be as efficient
1954 # as possible. For this reason it has _many_ returns in it, trying
1956 # as possible. For this reason it has _many_ returns in it, trying
1955 # always to exit as quickly as it can figure out what it needs to do.
1957 # always to exit as quickly as it can figure out what it needs to do.
1956
1958
1957 # This function is the main responsible for maintaining IPython's
1959 # This function is the main responsible for maintaining IPython's
1958 # behavior respectful of Python's semantics. So be _very_ careful if
1960 # behavior respectful of Python's semantics. So be _very_ careful if
1959 # making changes to anything here.
1961 # making changes to anything here.
1960
1962
1961 #.....................................................................
1963 #.....................................................................
1962 # Code begins
1964 # Code begins
1963
1965
1964 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1966 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1965
1967
1966 # save the line away in case we crash, so the post-mortem handler can
1968 # save the line away in case we crash, so the post-mortem handler can
1967 # record it
1969 # record it
1968 self._last_input_line = line
1970 self._last_input_line = line
1969
1971
1970 #print '***line: <%s>' % line # dbg
1972 #print '***line: <%s>' % line # dbg
1971
1973
1972 # the input history needs to track even empty lines
1974 # the input history needs to track even empty lines
1973 stripped = line.strip()
1975 stripped = line.strip()
1974
1976
1975 if not stripped:
1977 if not stripped:
1976 if not continue_prompt:
1978 if not continue_prompt:
1977 self.outputcache.prompt_count -= 1
1979 self.outputcache.prompt_count -= 1
1978 return self.handle_normal(line,continue_prompt)
1980 return self.handle_normal(line,continue_prompt)
1979 #return self.handle_normal('',continue_prompt)
1981 #return self.handle_normal('',continue_prompt)
1980
1982
1981 # print '***cont',continue_prompt # dbg
1983 # print '***cont',continue_prompt # dbg
1982 # special handlers are only allowed for single line statements
1984 # special handlers are only allowed for single line statements
1983 if continue_prompt and not self.rc.multi_line_specials:
1985 if continue_prompt and not self.rc.multi_line_specials:
1984 return self.handle_normal(line,continue_prompt)
1986 return self.handle_normal(line,continue_prompt)
1985
1987
1986
1988
1987 # For the rest, we need the structure of the input
1989 # For the rest, we need the structure of the input
1988 pre,iFun,theRest = self.split_user_input(line)
1990 pre,iFun,theRest = self.split_user_input(line)
1989
1991
1990 # See whether any pre-existing handler can take care of it
1992 # See whether any pre-existing handler can take care of it
1991
1993
1992 rewritten = self.hooks.input_prefilter(stripped)
1994 rewritten = self.hooks.input_prefilter(stripped)
1993 if rewritten != stripped: # ok, some prefilter did something
1995 if rewritten != stripped: # ok, some prefilter did something
1994 rewritten = pre + rewritten # add indentation
1996 rewritten = pre + rewritten # add indentation
1995 return self.handle_normal(rewritten)
1997 return self.handle_normal(rewritten)
1996
1998
1997 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1999 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1998
2000
1999 # First check for explicit escapes in the last/first character
2001 # First check for explicit escapes in the last/first character
2000 handler = None
2002 handler = None
2001 if line[-1] == self.ESC_HELP:
2003 if line[-1] == self.ESC_HELP:
2002 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2004 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2003 if handler is None:
2005 if handler is None:
2004 # look at the first character of iFun, NOT of line, so we skip
2006 # look at the first character of iFun, NOT of line, so we skip
2005 # leading whitespace in multiline input
2007 # leading whitespace in multiline input
2006 handler = self.esc_handlers.get(iFun[0:1])
2008 handler = self.esc_handlers.get(iFun[0:1])
2007 if handler is not None:
2009 if handler is not None:
2008 return handler(line,continue_prompt,pre,iFun,theRest)
2010 return handler(line,continue_prompt,pre,iFun,theRest)
2009 # Emacs ipython-mode tags certain input lines
2011 # Emacs ipython-mode tags certain input lines
2010 if line.endswith('# PYTHON-MODE'):
2012 if line.endswith('# PYTHON-MODE'):
2011 return self.handle_emacs(line,continue_prompt)
2013 return self.handle_emacs(line,continue_prompt)
2012
2014
2013 # Next, check if we can automatically execute this thing
2015 # Next, check if we can automatically execute this thing
2014
2016
2015 # Allow ! in multi-line statements if multi_line_specials is on:
2017 # Allow ! in multi-line statements if multi_line_specials is on:
2016 if continue_prompt and self.rc.multi_line_specials and \
2018 if continue_prompt and self.rc.multi_line_specials and \
2017 iFun.startswith(self.ESC_SHELL):
2019 iFun.startswith(self.ESC_SHELL):
2018 return self.handle_shell_escape(line,continue_prompt,
2020 return self.handle_shell_escape(line,continue_prompt,
2019 pre=pre,iFun=iFun,
2021 pre=pre,iFun=iFun,
2020 theRest=theRest)
2022 theRest=theRest)
2021
2023
2022 # Let's try to find if the input line is a magic fn
2024 # Let's try to find if the input line is a magic fn
2023 oinfo = None
2025 oinfo = None
2024 if hasattr(self,'magic_'+iFun):
2026 if hasattr(self,'magic_'+iFun):
2025 # WARNING: _ofind uses getattr(), so it can consume generators and
2027 # WARNING: _ofind uses getattr(), so it can consume generators and
2026 # cause other side effects.
2028 # cause other side effects.
2027 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2029 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2028 if oinfo['ismagic']:
2030 if oinfo['ismagic']:
2029 # Be careful not to call magics when a variable assignment is
2031 # Be careful not to call magics when a variable assignment is
2030 # being made (ls='hi', for example)
2032 # being made (ls='hi', for example)
2031 if self.rc.automagic and \
2033 if self.rc.automagic and \
2032 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2034 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2033 (self.rc.multi_line_specials or not continue_prompt):
2035 (self.rc.multi_line_specials or not continue_prompt):
2034 return self.handle_magic(line,continue_prompt,
2036 return self.handle_magic(line,continue_prompt,
2035 pre,iFun,theRest)
2037 pre,iFun,theRest)
2036 else:
2038 else:
2037 return self.handle_normal(line,continue_prompt)
2039 return self.handle_normal(line,continue_prompt)
2038
2040
2039 # If the rest of the line begins with an (in)equality, assginment or
2041 # If the rest of the line begins with an (in)equality, assginment or
2040 # function call, we should not call _ofind but simply execute it.
2042 # function call, we should not call _ofind but simply execute it.
2041 # This avoids spurious geattr() accesses on objects upon assignment.
2043 # This avoids spurious geattr() accesses on objects upon assignment.
2042 #
2044 #
2043 # It also allows users to assign to either alias or magic names true
2045 # It also allows users to assign to either alias or magic names true
2044 # python variables (the magic/alias systems always take second seat to
2046 # python variables (the magic/alias systems always take second seat to
2045 # true python code).
2047 # true python code).
2046 if theRest and theRest[0] in '!=()':
2048 if theRest and theRest[0] in '!=()':
2047 return self.handle_normal(line,continue_prompt)
2049 return self.handle_normal(line,continue_prompt)
2048
2050
2049 if oinfo is None:
2051 if oinfo is None:
2050 # let's try to ensure that _oinfo is ONLY called when autocall is
2052 # let's try to ensure that _oinfo is ONLY called when autocall is
2051 # on. Since it has inevitable potential side effects, at least
2053 # on. Since it has inevitable potential side effects, at least
2052 # having autocall off should be a guarantee to the user that no
2054 # having autocall off should be a guarantee to the user that no
2053 # weird things will happen.
2055 # weird things will happen.
2054
2056
2055 if self.rc.autocall:
2057 if self.rc.autocall:
2056 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2058 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2057 else:
2059 else:
2058 # in this case, all that's left is either an alias or
2060 # in this case, all that's left is either an alias or
2059 # processing the line normally.
2061 # processing the line normally.
2060 if iFun in self.alias_table:
2062 if iFun in self.alias_table:
2061 # if autocall is off, by not running _ofind we won't know
2063 # if autocall is off, by not running _ofind we won't know
2062 # whether the given name may also exist in one of the
2064 # whether the given name may also exist in one of the
2063 # user's namespace. At this point, it's best to do a
2065 # user's namespace. At this point, it's best to do a
2064 # quick check just to be sure that we don't let aliases
2066 # quick check just to be sure that we don't let aliases
2065 # shadow variables.
2067 # shadow variables.
2066 head = iFun.split('.',1)[0]
2068 head = iFun.split('.',1)[0]
2067 if head in self.user_ns or head in self.internal_ns \
2069 if head in self.user_ns or head in self.internal_ns \
2068 or head in __builtin__.__dict__:
2070 or head in __builtin__.__dict__:
2069 return self.handle_normal(line,continue_prompt)
2071 return self.handle_normal(line,continue_prompt)
2070 else:
2072 else:
2071 return self.handle_alias(line,continue_prompt,
2073 return self.handle_alias(line,continue_prompt,
2072 pre,iFun,theRest)
2074 pre,iFun,theRest)
2073
2075
2074 else:
2076 else:
2075 return self.handle_normal(line,continue_prompt)
2077 return self.handle_normal(line,continue_prompt)
2076
2078
2077 if not oinfo['found']:
2079 if not oinfo['found']:
2078 return self.handle_normal(line,continue_prompt)
2080 return self.handle_normal(line,continue_prompt)
2079 else:
2081 else:
2080 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2082 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2081 if oinfo['isalias']:
2083 if oinfo['isalias']:
2082 return self.handle_alias(line,continue_prompt,
2084 return self.handle_alias(line,continue_prompt,
2083 pre,iFun,theRest)
2085 pre,iFun,theRest)
2084
2086
2085 if (self.rc.autocall
2087 if (self.rc.autocall
2086 and
2088 and
2087 (
2089 (
2088 #only consider exclusion re if not "," or ";" autoquoting
2090 #only consider exclusion re if not "," or ";" autoquoting
2089 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2091 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2090 or pre == self.ESC_PAREN) or
2092 or pre == self.ESC_PAREN) or
2091 (not self.re_exclude_auto.match(theRest)))
2093 (not self.re_exclude_auto.match(theRest)))
2092 and
2094 and
2093 self.re_fun_name.match(iFun) and
2095 self.re_fun_name.match(iFun) and
2094 callable(oinfo['obj'])) :
2096 callable(oinfo['obj'])) :
2095 #print 'going auto' # dbg
2097 #print 'going auto' # dbg
2096 return self.handle_auto(line,continue_prompt,
2098 return self.handle_auto(line,continue_prompt,
2097 pre,iFun,theRest,oinfo['obj'])
2099 pre,iFun,theRest,oinfo['obj'])
2098 else:
2100 else:
2099 #print 'was callable?', callable(oinfo['obj']) # dbg
2101 #print 'was callable?', callable(oinfo['obj']) # dbg
2100 return self.handle_normal(line,continue_prompt)
2102 return self.handle_normal(line,continue_prompt)
2101
2103
2102 # If we get here, we have a normal Python line. Log and return.
2104 # If we get here, we have a normal Python line. Log and return.
2103 return self.handle_normal(line,continue_prompt)
2105 return self.handle_normal(line,continue_prompt)
2104
2106
2105 def _prefilter_dumb(self, line, continue_prompt):
2107 def _prefilter_dumb(self, line, continue_prompt):
2106 """simple prefilter function, for debugging"""
2108 """simple prefilter function, for debugging"""
2107 return self.handle_normal(line,continue_prompt)
2109 return self.handle_normal(line,continue_prompt)
2108
2110
2109
2111
2110 def multiline_prefilter(self, line, continue_prompt):
2112 def multiline_prefilter(self, line, continue_prompt):
2111 """ Run _prefilter for each line of input
2113 """ Run _prefilter for each line of input
2112
2114
2113 Covers cases where there are multiple lines in the user entry,
2115 Covers cases where there are multiple lines in the user entry,
2114 which is the case when the user goes back to a multiline history
2116 which is the case when the user goes back to a multiline history
2115 entry and presses enter.
2117 entry and presses enter.
2116
2118
2117 """
2119 """
2118 out = []
2120 out = []
2119 for l in line.rstrip('\n').split('\n'):
2121 for l in line.rstrip('\n').split('\n'):
2120 out.append(self._prefilter(l, continue_prompt))
2122 out.append(self._prefilter(l, continue_prompt))
2121 return '\n'.join(out)
2123 return '\n'.join(out)
2122
2124
2123 # Set the default prefilter() function (this can be user-overridden)
2125 # Set the default prefilter() function (this can be user-overridden)
2124 prefilter = multiline_prefilter
2126 prefilter = multiline_prefilter
2125
2127
2126 def handle_normal(self,line,continue_prompt=None,
2128 def handle_normal(self,line,continue_prompt=None,
2127 pre=None,iFun=None,theRest=None):
2129 pre=None,iFun=None,theRest=None):
2128 """Handle normal input lines. Use as a template for handlers."""
2130 """Handle normal input lines. Use as a template for handlers."""
2129
2131
2130 # With autoindent on, we need some way to exit the input loop, and I
2132 # With autoindent on, we need some way to exit the input loop, and I
2131 # don't want to force the user to have to backspace all the way to
2133 # don't want to force the user to have to backspace all the way to
2132 # clear the line. The rule will be in this case, that either two
2134 # clear the line. The rule will be in this case, that either two
2133 # lines of pure whitespace in a row, or a line of pure whitespace but
2135 # lines of pure whitespace in a row, or a line of pure whitespace but
2134 # of a size different to the indent level, will exit the input loop.
2136 # of a size different to the indent level, will exit the input loop.
2135
2137
2136 if (continue_prompt and self.autoindent and line.isspace() and
2138 if (continue_prompt and self.autoindent and line.isspace() and
2137 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2139 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2138 (self.buffer[-1]).isspace() )):
2140 (self.buffer[-1]).isspace() )):
2139 line = ''
2141 line = ''
2140
2142
2141 self.log(line,line,continue_prompt)
2143 self.log(line,line,continue_prompt)
2142 return line
2144 return line
2143
2145
2144 def handle_alias(self,line,continue_prompt=None,
2146 def handle_alias(self,line,continue_prompt=None,
2145 pre=None,iFun=None,theRest=None):
2147 pre=None,iFun=None,theRest=None):
2146 """Handle alias input lines. """
2148 """Handle alias input lines. """
2147
2149
2148 # pre is needed, because it carries the leading whitespace. Otherwise
2150 # pre is needed, because it carries the leading whitespace. Otherwise
2149 # aliases won't work in indented sections.
2151 # aliases won't work in indented sections.
2150 transformed = self.expand_aliases(iFun, theRest)
2152 transformed = self.expand_aliases(iFun, theRest)
2151 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2153 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2152 self.log(line,line_out,continue_prompt)
2154 self.log(line,line_out,continue_prompt)
2153 #print 'line out:',line_out # dbg
2155 #print 'line out:',line_out # dbg
2154 return line_out
2156 return line_out
2155
2157
2156 def handle_shell_escape(self, line, continue_prompt=None,
2158 def handle_shell_escape(self, line, continue_prompt=None,
2157 pre=None,iFun=None,theRest=None):
2159 pre=None,iFun=None,theRest=None):
2158 """Execute the line in a shell, empty return value"""
2160 """Execute the line in a shell, empty return value"""
2159
2161
2160 #print 'line in :', `line` # dbg
2162 #print 'line in :', `line` # dbg
2161 # Example of a special handler. Others follow a similar pattern.
2163 # Example of a special handler. Others follow a similar pattern.
2162 if line.lstrip().startswith('!!'):
2164 if line.lstrip().startswith('!!'):
2163 # rewrite iFun/theRest to properly hold the call to %sx and
2165 # rewrite iFun/theRest to properly hold the call to %sx and
2164 # the actual command to be executed, so handle_magic can work
2166 # the actual command to be executed, so handle_magic can work
2165 # correctly
2167 # correctly
2166 theRest = '%s %s' % (iFun[2:],theRest)
2168 theRest = '%s %s' % (iFun[2:],theRest)
2167 iFun = 'sx'
2169 iFun = 'sx'
2168 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2170 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2169 line.lstrip()[2:]),
2171 line.lstrip()[2:]),
2170 continue_prompt,pre,iFun,theRest)
2172 continue_prompt,pre,iFun,theRest)
2171 else:
2173 else:
2172 cmd=line.lstrip().lstrip('!')
2174 cmd=line.lstrip().lstrip('!')
2173 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2175 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2174 # update cache/log and return
2176 # update cache/log and return
2175 self.log(line,line_out,continue_prompt)
2177 self.log(line,line_out,continue_prompt)
2176 return line_out
2178 return line_out
2177
2179
2178 def handle_magic(self, line, continue_prompt=None,
2180 def handle_magic(self, line, continue_prompt=None,
2179 pre=None,iFun=None,theRest=None):
2181 pre=None,iFun=None,theRest=None):
2180 """Execute magic functions."""
2182 """Execute magic functions."""
2181
2183
2182
2184
2183 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2185 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2184 self.log(line,cmd,continue_prompt)
2186 self.log(line,cmd,continue_prompt)
2185 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2187 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2186 return cmd
2188 return cmd
2187
2189
2188 def handle_auto(self, line, continue_prompt=None,
2190 def handle_auto(self, line, continue_prompt=None,
2189 pre=None,iFun=None,theRest=None,obj=None):
2191 pre=None,iFun=None,theRest=None,obj=None):
2190 """Hande lines which can be auto-executed, quoting if requested."""
2192 """Hande lines which can be auto-executed, quoting if requested."""
2191
2193
2192 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2194 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2193
2195
2194 # This should only be active for single-line input!
2196 # This should only be active for single-line input!
2195 if continue_prompt:
2197 if continue_prompt:
2196 self.log(line,line,continue_prompt)
2198 self.log(line,line,continue_prompt)
2197 return line
2199 return line
2198
2200
2199 auto_rewrite = True
2201 auto_rewrite = True
2200
2202
2201 if pre == self.ESC_QUOTE:
2203 if pre == self.ESC_QUOTE:
2202 # Auto-quote splitting on whitespace
2204 # Auto-quote splitting on whitespace
2203 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2205 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2204 elif pre == self.ESC_QUOTE2:
2206 elif pre == self.ESC_QUOTE2:
2205 # Auto-quote whole string
2207 # Auto-quote whole string
2206 newcmd = '%s("%s")' % (iFun,theRest)
2208 newcmd = '%s("%s")' % (iFun,theRest)
2207 elif pre == self.ESC_PAREN:
2209 elif pre == self.ESC_PAREN:
2208 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2210 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2209 else:
2211 else:
2210 # Auto-paren.
2212 # Auto-paren.
2211 # We only apply it to argument-less calls if the autocall
2213 # We only apply it to argument-less calls if the autocall
2212 # parameter is set to 2. We only need to check that autocall is <
2214 # parameter is set to 2. We only need to check that autocall is <
2213 # 2, since this function isn't called unless it's at least 1.
2215 # 2, since this function isn't called unless it's at least 1.
2214 if not theRest and (self.rc.autocall < 2):
2216 if not theRest and (self.rc.autocall < 2):
2215 newcmd = '%s %s' % (iFun,theRest)
2217 newcmd = '%s %s' % (iFun,theRest)
2216 auto_rewrite = False
2218 auto_rewrite = False
2217 else:
2219 else:
2218 if theRest.startswith('['):
2220 if theRest.startswith('['):
2219 if hasattr(obj,'__getitem__'):
2221 if hasattr(obj,'__getitem__'):
2220 # Don't autocall in this case: item access for an object
2222 # Don't autocall in this case: item access for an object
2221 # which is BOTH callable and implements __getitem__.
2223 # which is BOTH callable and implements __getitem__.
2222 newcmd = '%s %s' % (iFun,theRest)
2224 newcmd = '%s %s' % (iFun,theRest)
2223 auto_rewrite = False
2225 auto_rewrite = False
2224 else:
2226 else:
2225 # if the object doesn't support [] access, go ahead and
2227 # if the object doesn't support [] access, go ahead and
2226 # autocall
2228 # autocall
2227 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2229 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2228 elif theRest.endswith(';'):
2230 elif theRest.endswith(';'):
2229 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2231 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2230 else:
2232 else:
2231 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2233 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2232
2234
2233 if auto_rewrite:
2235 if auto_rewrite:
2234 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2236 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2235 # log what is now valid Python, not the actual user input (without the
2237 # log what is now valid Python, not the actual user input (without the
2236 # final newline)
2238 # final newline)
2237 self.log(line,newcmd,continue_prompt)
2239 self.log(line,newcmd,continue_prompt)
2238 return newcmd
2240 return newcmd
2239
2241
2240 def handle_help(self, line, continue_prompt=None,
2242 def handle_help(self, line, continue_prompt=None,
2241 pre=None,iFun=None,theRest=None):
2243 pre=None,iFun=None,theRest=None):
2242 """Try to get some help for the object.
2244 """Try to get some help for the object.
2243
2245
2244 obj? or ?obj -> basic information.
2246 obj? or ?obj -> basic information.
2245 obj?? or ??obj -> more details.
2247 obj?? or ??obj -> more details.
2246 """
2248 """
2247
2249
2248 # We need to make sure that we don't process lines which would be
2250 # We need to make sure that we don't process lines which would be
2249 # otherwise valid python, such as "x=1 # what?"
2251 # otherwise valid python, such as "x=1 # what?"
2250 try:
2252 try:
2251 codeop.compile_command(line)
2253 codeop.compile_command(line)
2252 except SyntaxError:
2254 except SyntaxError:
2253 # We should only handle as help stuff which is NOT valid syntax
2255 # We should only handle as help stuff which is NOT valid syntax
2254 if line[0]==self.ESC_HELP:
2256 if line[0]==self.ESC_HELP:
2255 line = line[1:]
2257 line = line[1:]
2256 elif line[-1]==self.ESC_HELP:
2258 elif line[-1]==self.ESC_HELP:
2257 line = line[:-1]
2259 line = line[:-1]
2258 self.log(line,'#?'+line,continue_prompt)
2260 self.log(line,'#?'+line,continue_prompt)
2259 if line:
2261 if line:
2260 self.magic_pinfo(line)
2262 self.magic_pinfo(line)
2261 else:
2263 else:
2262 page(self.usage,screen_lines=self.rc.screen_length)
2264 page(self.usage,screen_lines=self.rc.screen_length)
2263 return '' # Empty string is needed here!
2265 return '' # Empty string is needed here!
2264 except:
2266 except:
2265 # Pass any other exceptions through to the normal handler
2267 # Pass any other exceptions through to the normal handler
2266 return self.handle_normal(line,continue_prompt)
2268 return self.handle_normal(line,continue_prompt)
2267 else:
2269 else:
2268 # If the code compiles ok, we should handle it normally
2270 # If the code compiles ok, we should handle it normally
2269 return self.handle_normal(line,continue_prompt)
2271 return self.handle_normal(line,continue_prompt)
2270
2272
2271 def getapi(self):
2273 def getapi(self):
2272 """ Get an IPApi object for this shell instance
2274 """ Get an IPApi object for this shell instance
2273
2275
2274 Getting an IPApi object is always preferable to accessing the shell
2276 Getting an IPApi object is always preferable to accessing the shell
2275 directly, but this holds true especially for extensions.
2277 directly, but this holds true especially for extensions.
2276
2278
2277 It should always be possible to implement an extension with IPApi
2279 It should always be possible to implement an extension with IPApi
2278 alone. If not, contact maintainer to request an addition.
2280 alone. If not, contact maintainer to request an addition.
2279
2281
2280 """
2282 """
2281 return self.api
2283 return self.api
2282
2284
2283 def handle_emacs(self,line,continue_prompt=None,
2285 def handle_emacs(self,line,continue_prompt=None,
2284 pre=None,iFun=None,theRest=None):
2286 pre=None,iFun=None,theRest=None):
2285 """Handle input lines marked by python-mode."""
2287 """Handle input lines marked by python-mode."""
2286
2288
2287 # Currently, nothing is done. Later more functionality can be added
2289 # Currently, nothing is done. Later more functionality can be added
2288 # here if needed.
2290 # here if needed.
2289
2291
2290 # The input cache shouldn't be updated
2292 # The input cache shouldn't be updated
2291
2293
2292 return line
2294 return line
2293
2295
2294 def mktempfile(self,data=None):
2296 def mktempfile(self,data=None):
2295 """Make a new tempfile and return its filename.
2297 """Make a new tempfile and return its filename.
2296
2298
2297 This makes a call to tempfile.mktemp, but it registers the created
2299 This makes a call to tempfile.mktemp, but it registers the created
2298 filename internally so ipython cleans it up at exit time.
2300 filename internally so ipython cleans it up at exit time.
2299
2301
2300 Optional inputs:
2302 Optional inputs:
2301
2303
2302 - data(None): if data is given, it gets written out to the temp file
2304 - data(None): if data is given, it gets written out to the temp file
2303 immediately, and the file is closed again."""
2305 immediately, and the file is closed again."""
2304
2306
2305 filename = tempfile.mktemp('.py','ipython_edit_')
2307 filename = tempfile.mktemp('.py','ipython_edit_')
2306 self.tempfiles.append(filename)
2308 self.tempfiles.append(filename)
2307
2309
2308 if data:
2310 if data:
2309 tmp_file = open(filename,'w')
2311 tmp_file = open(filename,'w')
2310 tmp_file.write(data)
2312 tmp_file.write(data)
2311 tmp_file.close()
2313 tmp_file.close()
2312 return filename
2314 return filename
2313
2315
2314 def write(self,data):
2316 def write(self,data):
2315 """Write a string to the default output"""
2317 """Write a string to the default output"""
2316 Term.cout.write(data)
2318 Term.cout.write(data)
2317
2319
2318 def write_err(self,data):
2320 def write_err(self,data):
2319 """Write a string to the default error output"""
2321 """Write a string to the default error output"""
2320 Term.cerr.write(data)
2322 Term.cerr.write(data)
2321
2323
2322 def exit(self):
2324 def exit(self):
2323 """Handle interactive exit.
2325 """Handle interactive exit.
2324
2326
2325 This method sets the exit_now attribute."""
2327 This method sets the exit_now attribute."""
2326
2328
2327 if self.rc.confirm_exit:
2329 if self.rc.confirm_exit:
2328 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2330 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2329 self.exit_now = True
2331 self.exit_now = True
2330 else:
2332 else:
2331 self.exit_now = True
2333 self.exit_now = True
2332
2334
2333 def safe_execfile(self,fname,*where,**kw):
2335 def safe_execfile(self,fname,*where,**kw):
2334 fname = os.path.expanduser(fname)
2336 fname = os.path.expanduser(fname)
2335
2337
2336 # find things also in current directory
2338 # find things also in current directory
2337 dname = os.path.dirname(fname)
2339 dname = os.path.dirname(fname)
2338 if not sys.path.count(dname):
2340 if not sys.path.count(dname):
2339 sys.path.append(dname)
2341 sys.path.append(dname)
2340
2342
2341 try:
2343 try:
2342 xfile = open(fname)
2344 xfile = open(fname)
2343 except:
2345 except:
2344 print >> Term.cerr, \
2346 print >> Term.cerr, \
2345 'Could not open file <%s> for safe execution.' % fname
2347 'Could not open file <%s> for safe execution.' % fname
2346 return None
2348 return None
2347
2349
2348 kw.setdefault('islog',0)
2350 kw.setdefault('islog',0)
2349 kw.setdefault('quiet',1)
2351 kw.setdefault('quiet',1)
2350 kw.setdefault('exit_ignore',0)
2352 kw.setdefault('exit_ignore',0)
2351 first = xfile.readline()
2353 first = xfile.readline()
2352 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2354 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2353 xfile.close()
2355 xfile.close()
2354 # line by line execution
2356 # line by line execution
2355 if first.startswith(loghead) or kw['islog']:
2357 if first.startswith(loghead) or kw['islog']:
2356 print 'Loading log file <%s> one line at a time...' % fname
2358 print 'Loading log file <%s> one line at a time...' % fname
2357 if kw['quiet']:
2359 if kw['quiet']:
2358 stdout_save = sys.stdout
2360 stdout_save = sys.stdout
2359 sys.stdout = StringIO.StringIO()
2361 sys.stdout = StringIO.StringIO()
2360 try:
2362 try:
2361 globs,locs = where[0:2]
2363 globs,locs = where[0:2]
2362 except:
2364 except:
2363 try:
2365 try:
2364 globs = locs = where[0]
2366 globs = locs = where[0]
2365 except:
2367 except:
2366 globs = locs = globals()
2368 globs = locs = globals()
2367 badblocks = []
2369 badblocks = []
2368
2370
2369 # we also need to identify indented blocks of code when replaying
2371 # we also need to identify indented blocks of code when replaying
2370 # logs and put them together before passing them to an exec
2372 # logs and put them together before passing them to an exec
2371 # statement. This takes a bit of regexp and look-ahead work in the
2373 # statement. This takes a bit of regexp and look-ahead work in the
2372 # file. It's easiest if we swallow the whole thing in memory
2374 # file. It's easiest if we swallow the whole thing in memory
2373 # first, and manually walk through the lines list moving the
2375 # first, and manually walk through the lines list moving the
2374 # counter ourselves.
2376 # counter ourselves.
2375 indent_re = re.compile('\s+\S')
2377 indent_re = re.compile('\s+\S')
2376 xfile = open(fname)
2378 xfile = open(fname)
2377 filelines = xfile.readlines()
2379 filelines = xfile.readlines()
2378 xfile.close()
2380 xfile.close()
2379 nlines = len(filelines)
2381 nlines = len(filelines)
2380 lnum = 0
2382 lnum = 0
2381 while lnum < nlines:
2383 while lnum < nlines:
2382 line = filelines[lnum]
2384 line = filelines[lnum]
2383 lnum += 1
2385 lnum += 1
2384 # don't re-insert logger status info into cache
2386 # don't re-insert logger status info into cache
2385 if line.startswith('#log#'):
2387 if line.startswith('#log#'):
2386 continue
2388 continue
2387 else:
2389 else:
2388 # build a block of code (maybe a single line) for execution
2390 # build a block of code (maybe a single line) for execution
2389 block = line
2391 block = line
2390 try:
2392 try:
2391 next = filelines[lnum] # lnum has already incremented
2393 next = filelines[lnum] # lnum has already incremented
2392 except:
2394 except:
2393 next = None
2395 next = None
2394 while next and indent_re.match(next):
2396 while next and indent_re.match(next):
2395 block += next
2397 block += next
2396 lnum += 1
2398 lnum += 1
2397 try:
2399 try:
2398 next = filelines[lnum]
2400 next = filelines[lnum]
2399 except:
2401 except:
2400 next = None
2402 next = None
2401 # now execute the block of one or more lines
2403 # now execute the block of one or more lines
2402 try:
2404 try:
2403 exec block in globs,locs
2405 exec block in globs,locs
2404 except SystemExit:
2406 except SystemExit:
2405 pass
2407 pass
2406 except:
2408 except:
2407 badblocks.append(block.rstrip())
2409 badblocks.append(block.rstrip())
2408 if kw['quiet']: # restore stdout
2410 if kw['quiet']: # restore stdout
2409 sys.stdout.close()
2411 sys.stdout.close()
2410 sys.stdout = stdout_save
2412 sys.stdout = stdout_save
2411 print 'Finished replaying log file <%s>' % fname
2413 print 'Finished replaying log file <%s>' % fname
2412 if badblocks:
2414 if badblocks:
2413 print >> sys.stderr, ('\nThe following lines/blocks in file '
2415 print >> sys.stderr, ('\nThe following lines/blocks in file '
2414 '<%s> reported errors:' % fname)
2416 '<%s> reported errors:' % fname)
2415
2417
2416 for badline in badblocks:
2418 for badline in badblocks:
2417 print >> sys.stderr, badline
2419 print >> sys.stderr, badline
2418 else: # regular file execution
2420 else: # regular file execution
2419 try:
2421 try:
2420 execfile(fname,*where)
2422 execfile(fname,*where)
2421 except SyntaxError:
2423 except SyntaxError:
2422 self.showsyntaxerror()
2424 self.showsyntaxerror()
2423 warn('Failure executing file: <%s>' % fname)
2425 warn('Failure executing file: <%s>' % fname)
2424 except SystemExit,status:
2426 except SystemExit,status:
2425 if not kw['exit_ignore']:
2427 if not kw['exit_ignore']:
2426 self.showtraceback()
2428 self.showtraceback()
2427 warn('Failure executing file: <%s>' % fname)
2429 warn('Failure executing file: <%s>' % fname)
2428 except:
2430 except:
2429 self.showtraceback()
2431 self.showtraceback()
2430 warn('Failure executing file: <%s>' % fname)
2432 warn('Failure executing file: <%s>' % fname)
2431
2433
2432 #************************* end of file <iplib.py> *****************************
2434 #************************* end of file <iplib.py> *****************************
@@ -1,297 +1,305 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Module for interactively running scripts.
2 """Module for interactively running scripts.
3
3
4 This module implements classes for interactively running scripts written for
4 This module implements classes for interactively running scripts written for
5 any system with a prompt which can be matched by a regexp suitable for
5 any system with a prompt which can be matched by a regexp suitable for
6 pexpect. It can be used to run as if they had been typed up interactively, an
6 pexpect. It can be used to run as if they had been typed up interactively, an
7 arbitrary series of commands for the target system.
7 arbitrary series of commands for the target system.
8
8
9 The module includes classes ready for IPython (with the default prompts),
9 The module includes classes ready for IPython (with the default prompts),
10 plain Python and SAGE, but making a new one is trivial. To see how to use it,
10 plain Python and SAGE, but making a new one is trivial. To see how to use it,
11 simply run the module as a script:
11 simply run the module as a script:
12
12
13 ./irunner.py --help
13 ./irunner.py --help
14
14
15
15
16 This is an extension of Ken Schutte <kschutte-AT-csail.mit.edu>'s script
16 This is an extension of Ken Schutte <kschutte-AT-csail.mit.edu>'s script
17 contributed on the ipython-user list:
17 contributed on the ipython-user list:
18
18
19 http://scipy.net/pipermail/ipython-user/2006-May/001705.html
19 http://scipy.net/pipermail/ipython-user/2006-May/001705.html
20
20
21
21
22 NOTES:
22 NOTES:
23
23
24 - This module requires pexpect, available in most linux distros, or which can
24 - This module requires pexpect, available in most linux distros, or which can
25 be downloaded from
25 be downloaded from
26
26
27 http://pexpect.sourceforge.net
27 http://pexpect.sourceforge.net
28
28
29 - Because pexpect only works under Unix or Windows-Cygwin, this has the same
29 - Because pexpect only works under Unix or Windows-Cygwin, this has the same
30 limitations. This means that it will NOT work under native windows Python.
30 limitations. This means that it will NOT work under native windows Python.
31 """
31 """
32
32
33 # Stdlib imports
33 # Stdlib imports
34 import optparse
34 import optparse
35 import os
35 import os
36 import sys
36 import sys
37
37
38 # Third-party modules.
38 # Third-party modules.
39 import pexpect
39 import pexpect
40
40
41 # Global usage strings, to avoid indentation issues when typing it below.
41 # Global usage strings, to avoid indentation issues when typing it below.
42 USAGE = """
42 USAGE = """
43 Interactive script runner, type: %s
43 Interactive script runner, type: %s
44
44
45 runner [opts] script_name
45 runner [opts] script_name
46 """
46 """
47
47
48 # The generic runner class
48 # The generic runner class
49 class InteractiveRunner(object):
49 class InteractiveRunner(object):
50 """Class to run a sequence of commands through an interactive program."""
50 """Class to run a sequence of commands through an interactive program."""
51
51
52 def __init__(self,program,prompts,args=None):
52 def __init__(self,program,prompts,args=None):
53 """Construct a runner.
53 """Construct a runner.
54
54
55 Inputs:
55 Inputs:
56
56
57 - program: command to execute the given program.
57 - program: command to execute the given program.
58
58
59 - prompts: a list of patterns to match as valid prompts, in the
59 - prompts: a list of patterns to match as valid prompts, in the
60 format used by pexpect. This basically means that it can be either
60 format used by pexpect. This basically means that it can be either
61 a string (to be compiled as a regular expression) or a list of such
61 a string (to be compiled as a regular expression) or a list of such
62 (it must be a true list, as pexpect does type checks).
62 (it must be a true list, as pexpect does type checks).
63
63
64 If more than one prompt is given, the first is treated as the main
64 If more than one prompt is given, the first is treated as the main
65 program prompt and the others as 'continuation' prompts, like
65 program prompt and the others as 'continuation' prompts, like
66 python's. This means that blank lines in the input source are
66 python's. This means that blank lines in the input source are
67 ommitted when the first prompt is matched, but are NOT ommitted when
67 ommitted when the first prompt is matched, but are NOT ommitted when
68 the continuation one matches, since this is how python signals the
68 the continuation one matches, since this is how python signals the
69 end of multiline input interactively.
69 end of multiline input interactively.
70
70
71 Optional inputs:
71 Optional inputs:
72
72
73 - args(None): optional list of strings to pass as arguments to the
73 - args(None): optional list of strings to pass as arguments to the
74 child program.
74 child program.
75
75
76 Public members not parameterized in the constructor:
76 Public members not parameterized in the constructor:
77
77
78 - delaybeforesend(0): Newer versions of pexpect have a delay before
78 - delaybeforesend(0): Newer versions of pexpect have a delay before
79 sending each new input. For our purposes here, it's typically best
79 sending each new input. For our purposes here, it's typically best
80 to just set this to zero, but if you encounter reliability problems
80 to just set this to zero, but if you encounter reliability problems
81 or want an interactive run to pause briefly at each prompt, just
81 or want an interactive run to pause briefly at each prompt, just
82 increase this value (it is measured in seconds). Note that this
82 increase this value (it is measured in seconds). Note that this
83 variable is not honored at all by older versions of pexpect.
83 variable is not honored at all by older versions of pexpect.
84 """
84 """
85
85
86 self.program = program
86 self.program = program
87 self.prompts = prompts
87 self.prompts = prompts
88 if args is None: args = []
88 if args is None: args = []
89 self.args = args
89 self.args = args
90 # Other public members which we don't make as parameters, but which
90 # Other public members which we don't make as parameters, but which
91 # users may occasionally want to tweak
91 # users may occasionally want to tweak
92 self.delaybeforesend = 0
92 self.delaybeforesend = 0
93
93
94 def run_file(self,fname,interact=False):
94 def run_file(self,fname,interact=False):
95 """Run the given file interactively.
95 """Run the given file interactively.
96
96
97 Inputs:
97 Inputs:
98
98
99 -fname: name of the file to execute.
99 -fname: name of the file to execute.
100
100
101 See the run_source docstring for the meaning of the optional
101 See the run_source docstring for the meaning of the optional
102 arguments."""
102 arguments."""
103
103
104 fobj = open(fname,'r')
104 fobj = open(fname,'r')
105 try:
105 try:
106 self.run_source(fobj,interact)
106 self.run_source(fobj,interact)
107 finally:
107 finally:
108 fobj.close()
108 fobj.close()
109
109
110 def run_source(self,source,interact=False):
110 def run_source(self,source,interact=False):
111 """Run the given source code interactively.
111 """Run the given source code interactively.
112
112
113 Inputs:
113 Inputs:
114
114
115 - source: a string of code to be executed, or an open file object we
115 - source: a string of code to be executed, or an open file object we
116 can iterate over.
116 can iterate over.
117
117
118 Optional inputs:
118 Optional inputs:
119
119
120 - interact(False): if true, start to interact with the running
120 - interact(False): if true, start to interact with the running
121 program at the end of the script. Otherwise, just exit.
121 program at the end of the script. Otherwise, just exit.
122 """
122 """
123
123
124 # if the source is a string, chop it up in lines so we can iterate
124 # if the source is a string, chop it up in lines so we can iterate
125 # over it just as if it were an open file.
125 # over it just as if it were an open file.
126 if not isinstance(source,file):
126 if not isinstance(source,file):
127 source = source.splitlines(True)
127 source = source.splitlines(True)
128
128
129 # grab the true write method of stdout, in case anything later
129 # grab the true write method of stdout, in case anything later
130 # reassigns sys.stdout, so that we really are writing to the true
130 # reassigns sys.stdout, so that we really are writing to the true
131 # stdout and not to something else. We also normalize all strings we
131 # stdout and not to something else. We also normalize all strings we
132 # write to use the native OS line separators.
132 # write to use the native OS line separators.
133 linesep = os.linesep
133 linesep = os.linesep
134 stdwrite = sys.stdout.write
134 stdwrite = sys.stdout.write
135 write = lambda s: stdwrite(s.replace('\r\n',linesep))
135 write = lambda s: stdwrite(s.replace('\r\n',linesep))
136
136
137 c = pexpect.spawn(self.program,self.args,timeout=None)
137 c = pexpect.spawn(self.program,self.args,timeout=None)
138 c.delaybeforesend = self.delaybeforesend
138 c.delaybeforesend = self.delaybeforesend
139
140 # pexpect hard-codes the terminal size as (24,80) (rows,columns).
141 # This causes problems because any line longer than 80 characters gets
142 # completely overwrapped on the printed outptut (even though
143 # internally the code runs fine). We reset this to 99 rows X 200
144 # columns (arbitrarily chosen), which should avoid problems in all
145 # reasonable cases.
146 c.setwinsize(99,200)
139
147
140 prompts = c.compile_pattern_list(self.prompts)
148 prompts = c.compile_pattern_list(self.prompts)
141
149
142 prompt_idx = c.expect_list(prompts)
150 prompt_idx = c.expect_list(prompts)
143 # Flag whether the script ends normally or not, to know whether we can
151 # Flag whether the script ends normally or not, to know whether we can
144 # do anything further with the underlying process.
152 # do anything further with the underlying process.
145 end_normal = True
153 end_normal = True
146 for cmd in source:
154 for cmd in source:
147 # skip blank lines for all matches to the 'main' prompt, while the
155 # skip blank lines for all matches to the 'main' prompt, while the
148 # secondary prompts do not
156 # secondary prompts do not
149 if prompt_idx==0 and \
157 if prompt_idx==0 and \
150 (cmd.isspace() or cmd.lstrip().startswith('#')):
158 (cmd.isspace() or cmd.lstrip().startswith('#')):
151 print cmd,
159 print cmd,
152 continue
160 continue
153
161
154 write(c.after)
162 write(c.after)
155 c.send(cmd)
163 c.send(cmd)
156 try:
164 try:
157 prompt_idx = c.expect_list(prompts)
165 prompt_idx = c.expect_list(prompts)
158 except pexpect.EOF:
166 except pexpect.EOF:
159 # this will happen if the child dies unexpectedly
167 # this will happen if the child dies unexpectedly
160 write(c.before)
168 write(c.before)
161 end_normal = False
169 end_normal = False
162 break
170 break
163 write(c.before)
171 write(c.before)
164
172
165 if end_normal:
173 if end_normal:
166 if interact:
174 if interact:
167 c.send('\n')
175 c.send('\n')
168 print '<< Starting interactive mode >>',
176 print '<< Starting interactive mode >>',
169 try:
177 try:
170 c.interact()
178 c.interact()
171 except OSError:
179 except OSError:
172 # This is what fires when the child stops. Simply print a
180 # This is what fires when the child stops. Simply print a
173 # newline so the system prompt is aligned. The extra
181 # newline so the system prompt is aligned. The extra
174 # space is there to make sure it gets printed, otherwise
182 # space is there to make sure it gets printed, otherwise
175 # OS buffering sometimes just suppresses it.
183 # OS buffering sometimes just suppresses it.
176 write(' \n')
184 write(' \n')
177 sys.stdout.flush()
185 sys.stdout.flush()
178 else:
186 else:
179 c.close()
187 c.close()
180 else:
188 else:
181 if interact:
189 if interact:
182 e="Further interaction is not possible: child process is dead."
190 e="Further interaction is not possible: child process is dead."
183 print >> sys.stderr, e
191 print >> sys.stderr, e
184
192
185 def main(self,argv=None):
193 def main(self,argv=None):
186 """Run as a command-line script."""
194 """Run as a command-line script."""
187
195
188 parser = optparse.OptionParser(usage=USAGE % self.__class__.__name__)
196 parser = optparse.OptionParser(usage=USAGE % self.__class__.__name__)
189 newopt = parser.add_option
197 newopt = parser.add_option
190 newopt('-i','--interact',action='store_true',default=False,
198 newopt('-i','--interact',action='store_true',default=False,
191 help='Interact with the program after the script is run.')
199 help='Interact with the program after the script is run.')
192
200
193 opts,args = parser.parse_args(argv)
201 opts,args = parser.parse_args(argv)
194
202
195 if len(args) != 1:
203 if len(args) != 1:
196 print >> sys.stderr,"You must supply exactly one file to run."
204 print >> sys.stderr,"You must supply exactly one file to run."
197 sys.exit(1)
205 sys.exit(1)
198
206
199 self.run_file(args[0],opts.interact)
207 self.run_file(args[0],opts.interact)
200
208
201
209
202 # Specific runners for particular programs
210 # Specific runners for particular programs
203 class IPythonRunner(InteractiveRunner):
211 class IPythonRunner(InteractiveRunner):
204 """Interactive IPython runner.
212 """Interactive IPython runner.
205
213
206 This initalizes IPython in 'nocolor' mode for simplicity. This lets us
214 This initalizes IPython in 'nocolor' mode for simplicity. This lets us
207 avoid having to write a regexp that matches ANSI sequences, though pexpect
215 avoid having to write a regexp that matches ANSI sequences, though pexpect
208 does support them. If anyone contributes patches for ANSI color support,
216 does support them. If anyone contributes patches for ANSI color support,
209 they will be welcome.
217 they will be welcome.
210
218
211 It also sets the prompts manually, since the prompt regexps for
219 It also sets the prompts manually, since the prompt regexps for
212 pexpect need to be matched to the actual prompts, so user-customized
220 pexpect need to be matched to the actual prompts, so user-customized
213 prompts would break this.
221 prompts would break this.
214 """
222 """
215
223
216 def __init__(self,program = 'ipython',args=None):
224 def __init__(self,program = 'ipython',args=None):
217 """New runner, optionally passing the ipython command to use."""
225 """New runner, optionally passing the ipython command to use."""
218
226
219 args0 = ['-colors','NoColor',
227 args0 = ['-colors','NoColor',
220 '-pi1','In [\\#]: ',
228 '-pi1','In [\\#]: ',
221 '-pi2',' .\\D.: ']
229 '-pi2',' .\\D.: ']
222 if args is None: args = args0
230 if args is None: args = args0
223 else: args = args0 + args
231 else: args = args0 + args
224 prompts = [r'In \[\d+\]: ',r' \.*: ']
232 prompts = [r'In \[\d+\]: ',r' \.*: ']
225 InteractiveRunner.__init__(self,program,prompts,args)
233 InteractiveRunner.__init__(self,program,prompts,args)
226
234
227
235
228 class PythonRunner(InteractiveRunner):
236 class PythonRunner(InteractiveRunner):
229 """Interactive Python runner."""
237 """Interactive Python runner."""
230
238
231 def __init__(self,program='python',args=None):
239 def __init__(self,program='python',args=None):
232 """New runner, optionally passing the python command to use."""
240 """New runner, optionally passing the python command to use."""
233
241
234 prompts = [r'>>> ',r'\.\.\. ']
242 prompts = [r'>>> ',r'\.\.\. ']
235 InteractiveRunner.__init__(self,program,prompts,args)
243 InteractiveRunner.__init__(self,program,prompts,args)
236
244
237
245
238 class SAGERunner(InteractiveRunner):
246 class SAGERunner(InteractiveRunner):
239 """Interactive SAGE runner.
247 """Interactive SAGE runner.
240
248
241 WARNING: this runner only works if you manually configure your SAGE copy
249 WARNING: this runner only works if you manually configure your SAGE copy
242 to use 'colors NoColor' in the ipythonrc config file, since currently the
250 to use 'colors NoColor' in the ipythonrc config file, since currently the
243 prompt matching regexp does not identify color sequences."""
251 prompt matching regexp does not identify color sequences."""
244
252
245 def __init__(self,program='sage',args=None):
253 def __init__(self,program='sage',args=None):
246 """New runner, optionally passing the sage command to use."""
254 """New runner, optionally passing the sage command to use."""
247
255
248 prompts = ['sage: ',r'\s*\.\.\. ']
256 prompts = ['sage: ',r'\s*\.\.\. ']
249 InteractiveRunner.__init__(self,program,prompts,args)
257 InteractiveRunner.__init__(self,program,prompts,args)
250
258
251 # Global usage string, to avoid indentation issues if typed in a function def.
259 # Global usage string, to avoid indentation issues if typed in a function def.
252 MAIN_USAGE = """
260 MAIN_USAGE = """
253 %prog [options] file_to_run
261 %prog [options] file_to_run
254
262
255 This is an interface to the various interactive runners available in this
263 This is an interface to the various interactive runners available in this
256 module. If you want to pass specific options to one of the runners, you need
264 module. If you want to pass specific options to one of the runners, you need
257 to first terminate the main options with a '--', and then provide the runner's
265 to first terminate the main options with a '--', and then provide the runner's
258 options. For example:
266 options. For example:
259
267
260 irunner.py --python -- --help
268 irunner.py --python -- --help
261
269
262 will pass --help to the python runner. Similarly,
270 will pass --help to the python runner. Similarly,
263
271
264 irunner.py --ipython -- --interact script.ipy
272 irunner.py --ipython -- --interact script.ipy
265
273
266 will run the script.ipy file under the IPython runner, and then will start to
274 will run the script.ipy file under the IPython runner, and then will start to
267 interact with IPython at the end of the script (instead of exiting).
275 interact with IPython at the end of the script (instead of exiting).
268
276
269 The already implemented runners are listed below; adding one for a new program
277 The already implemented runners are listed below; adding one for a new program
270 is a trivial task, see the source for examples.
278 is a trivial task, see the source for examples.
271
279
272 WARNING: the SAGE runner only works if you manually configure your SAGE copy
280 WARNING: the SAGE runner only works if you manually configure your SAGE copy
273 to use 'colors NoColor' in the ipythonrc config file, since currently the
281 to use 'colors NoColor' in the ipythonrc config file, since currently the
274 prompt matching regexp does not identify color sequences.
282 prompt matching regexp does not identify color sequences.
275 """
283 """
276
284
277 def main():
285 def main():
278 """Run as a command-line script."""
286 """Run as a command-line script."""
279
287
280 parser = optparse.OptionParser(usage=MAIN_USAGE)
288 parser = optparse.OptionParser(usage=MAIN_USAGE)
281 newopt = parser.add_option
289 newopt = parser.add_option
282 parser.set_defaults(mode='ipython')
290 parser.set_defaults(mode='ipython')
283 newopt('--ipython',action='store_const',dest='mode',const='ipython',
291 newopt('--ipython',action='store_const',dest='mode',const='ipython',
284 help='IPython interactive runner (default).')
292 help='IPython interactive runner (default).')
285 newopt('--python',action='store_const',dest='mode',const='python',
293 newopt('--python',action='store_const',dest='mode',const='python',
286 help='Python interactive runner.')
294 help='Python interactive runner.')
287 newopt('--sage',action='store_const',dest='mode',const='sage',
295 newopt('--sage',action='store_const',dest='mode',const='sage',
288 help='SAGE interactive runner.')
296 help='SAGE interactive runner.')
289
297
290 opts,args = parser.parse_args()
298 opts,args = parser.parse_args()
291 runners = dict(ipython=IPythonRunner,
299 runners = dict(ipython=IPythonRunner,
292 python=PythonRunner,
300 python=PythonRunner,
293 sage=SAGERunner)
301 sage=SAGERunner)
294 runners[opts.mode]().main(args)
302 runners[opts.mode]().main(args)
295
303
296 if __name__ == '__main__':
304 if __name__ == '__main__':
297 main()
305 main()
@@ -1,5815 +1,5827 b''
1 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/genutils.py (arg_split): moved to genutils, since it's a
4 pretty generic function and useful for other things.
5
6 * IPython/OInspect.py (getsource): Add customizable source
7 extractor. After a request/patch form W. Stein (SAGE).
8
9 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
10 window size to a more reasonable value from what pexpect does,
11 since their choice causes wrapping bugs with long input lines.
12
1 2006-10-28 Ville Vainio <vivainio@gmail.com>
13 2006-10-28 Ville Vainio <vivainio@gmail.com>
2
14
3 * Magic.py (%run): Save and restore the readline history from
15 * Magic.py (%run): Save and restore the readline history from
4 file around %run commands to prevent side effects from
16 file around %run commands to prevent side effects from
5 %runned programs that might use readline (e.g. pydb).
17 %runned programs that might use readline (e.g. pydb).
6
18
7 * extensions/pydb_ipy.py: Adds %pydb magic when imported, for
19 * extensions/pydb_ipy.py: Adds %pydb magic when imported, for
8 invoking the pydb enhanced debugger.
20 invoking the pydb enhanced debugger.
9
21
10 2006-10-23 Walter Doerwald <walter@livinglogic.de>
22 2006-10-23 Walter Doerwald <walter@livinglogic.de>
11
23
12 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
24 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
13 call the base class method and propagate the return value to
25 call the base class method and propagate the return value to
14 ifile. This is now done by path itself.
26 ifile. This is now done by path itself.
15
27
16 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
28 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
17
29
18 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
30 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
19 api: set_crash_handler(), to expose the ability to change the
31 api: set_crash_handler(), to expose the ability to change the
20 internal crash handler.
32 internal crash handler.
21
33
22 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
34 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
23 the various parameters of the crash handler so that apps using
35 the various parameters of the crash handler so that apps using
24 IPython as their engine can customize crash handling. Ipmlemented
36 IPython as their engine can customize crash handling. Ipmlemented
25 at the request of SAGE.
37 at the request of SAGE.
26
38
27 2006-10-14 Ville Vainio <vivainio@gmail.com>
39 2006-10-14 Ville Vainio <vivainio@gmail.com>
28
40
29 * Magic.py, ipython.el: applied first "safe" part of Rocky
41 * Magic.py, ipython.el: applied first "safe" part of Rocky
30 Bernstein's patch set for pydb integration.
42 Bernstein's patch set for pydb integration.
31
43
32 * Magic.py (%unalias, %alias): %store'd aliases can now be
44 * Magic.py (%unalias, %alias): %store'd aliases can now be
33 removed with '%unalias'. %alias w/o args now shows most
45 removed with '%unalias'. %alias w/o args now shows most
34 interesting (stored / manually defined) aliases last
46 interesting (stored / manually defined) aliases last
35 where they catch the eye w/o scrolling.
47 where they catch the eye w/o scrolling.
36
48
37 * Magic.py (%rehashx), ext_rehashdir.py: files with
49 * Magic.py (%rehashx), ext_rehashdir.py: files with
38 'py' extension are always considered executable, even
50 'py' extension are always considered executable, even
39 when not in PATHEXT environment variable.
51 when not in PATHEXT environment variable.
40
52
41 2006-10-12 Ville Vainio <vivainio@gmail.com>
53 2006-10-12 Ville Vainio <vivainio@gmail.com>
42
54
43 * jobctrl.py: Add new "jobctrl" extension for spawning background
55 * jobctrl.py: Add new "jobctrl" extension for spawning background
44 processes with "&find /". 'import jobctrl' to try it out. Requires
56 processes with "&find /". 'import jobctrl' to try it out. Requires
45 'subprocess' module, standard in python 2.4+.
57 'subprocess' module, standard in python 2.4+.
46
58
47 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
59 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
48 so if foo -> bar and bar -> baz, then foo -> baz.
60 so if foo -> bar and bar -> baz, then foo -> baz.
49
61
50 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
62 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
51
63
52 * IPython/Magic.py (Magic.parse_options): add a new posix option
64 * IPython/Magic.py (Magic.parse_options): add a new posix option
53 to allow parsing of input args in magics that doesn't strip quotes
65 to allow parsing of input args in magics that doesn't strip quotes
54 (if posix=False). This also closes %timeit bug reported by
66 (if posix=False). This also closes %timeit bug reported by
55 Stefan.
67 Stefan.
56
68
57 2006-10-03 Ville Vainio <vivainio@gmail.com>
69 2006-10-03 Ville Vainio <vivainio@gmail.com>
58
70
59 * iplib.py (raw_input, interact): Return ValueError catching for
71 * iplib.py (raw_input, interact): Return ValueError catching for
60 raw_input. Fixes infinite loop for sys.stdin.close() or
72 raw_input. Fixes infinite loop for sys.stdin.close() or
61 sys.stdout.close().
73 sys.stdout.close().
62
74
63 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
75 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
64
76
65 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
77 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
66 to help in handling doctests. irunner is now pretty useful for
78 to help in handling doctests. irunner is now pretty useful for
67 running standalone scripts and simulate a full interactive session
79 running standalone scripts and simulate a full interactive session
68 in a format that can be then pasted as a doctest.
80 in a format that can be then pasted as a doctest.
69
81
70 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
82 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
71 on top of the default (useless) ones. This also fixes the nasty
83 on top of the default (useless) ones. This also fixes the nasty
72 way in which 2.5's Quitter() exits (reverted [1785]).
84 way in which 2.5's Quitter() exits (reverted [1785]).
73
85
74 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
86 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
75 2.5.
87 2.5.
76
88
77 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
89 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
78 color scheme is updated as well when color scheme is changed
90 color scheme is updated as well when color scheme is changed
79 interactively.
91 interactively.
80
92
81 2006-09-27 Ville Vainio <vivainio@gmail.com>
93 2006-09-27 Ville Vainio <vivainio@gmail.com>
82
94
83 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
95 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
84 infinite loop and just exit. It's a hack, but will do for a while.
96 infinite loop and just exit. It's a hack, but will do for a while.
85
97
86 2006-08-25 Walter Doerwald <walter@livinglogic.de>
98 2006-08-25 Walter Doerwald <walter@livinglogic.de>
87
99
88 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
100 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
89 the constructor, this makes it possible to get a list of only directories
101 the constructor, this makes it possible to get a list of only directories
90 or only files.
102 or only files.
91
103
92 2006-08-12 Ville Vainio <vivainio@gmail.com>
104 2006-08-12 Ville Vainio <vivainio@gmail.com>
93
105
94 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
106 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
95 they broke unittest
107 they broke unittest
96
108
97 2006-08-11 Ville Vainio <vivainio@gmail.com>
109 2006-08-11 Ville Vainio <vivainio@gmail.com>
98
110
99 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
111 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
100 by resolving issue properly, i.e. by inheriting FakeModule
112 by resolving issue properly, i.e. by inheriting FakeModule
101 from types.ModuleType. Pickling ipython interactive data
113 from types.ModuleType. Pickling ipython interactive data
102 should still work as usual (testing appreciated).
114 should still work as usual (testing appreciated).
103
115
104 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
116 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
105
117
106 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
118 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
107 running under python 2.3 with code from 2.4 to fix a bug with
119 running under python 2.3 with code from 2.4 to fix a bug with
108 help(). Reported by the Debian maintainers, Norbert Tretkowski
120 help(). Reported by the Debian maintainers, Norbert Tretkowski
109 <norbert-AT-tretkowski.de> and Alexandre Fayolle
121 <norbert-AT-tretkowski.de> and Alexandre Fayolle
110 <afayolle-AT-debian.org>.
122 <afayolle-AT-debian.org>.
111
123
112 2006-08-04 Walter Doerwald <walter@livinglogic.de>
124 2006-08-04 Walter Doerwald <walter@livinglogic.de>
113
125
114 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
126 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
115 (which was displaying "quit" twice).
127 (which was displaying "quit" twice).
116
128
117 2006-07-28 Walter Doerwald <walter@livinglogic.de>
129 2006-07-28 Walter Doerwald <walter@livinglogic.de>
118
130
119 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
131 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
120 the mode argument).
132 the mode argument).
121
133
122 2006-07-27 Walter Doerwald <walter@livinglogic.de>
134 2006-07-27 Walter Doerwald <walter@livinglogic.de>
123
135
124 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
136 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
125 not running under IPython.
137 not running under IPython.
126
138
127 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
139 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
128 and make it iterable (iterating over the attribute itself). Add two new
140 and make it iterable (iterating over the attribute itself). Add two new
129 magic strings for __xattrs__(): If the string starts with "-", the attribute
141 magic strings for __xattrs__(): If the string starts with "-", the attribute
130 will not be displayed in ibrowse's detail view (but it can still be
142 will not be displayed in ibrowse's detail view (but it can still be
131 iterated over). This makes it possible to add attributes that are large
143 iterated over). This makes it possible to add attributes that are large
132 lists or generator methods to the detail view. Replace magic attribute names
144 lists or generator methods to the detail view. Replace magic attribute names
133 and _attrname() and _getattr() with "descriptors": For each type of magic
145 and _attrname() and _getattr() with "descriptors": For each type of magic
134 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
146 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
135 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
147 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
136 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
148 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
137 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
149 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
138 are still supported.
150 are still supported.
139
151
140 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
152 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
141 fails in ibrowse.fetch(), the exception object is added as the last item
153 fails in ibrowse.fetch(), the exception object is added as the last item
142 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
154 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
143 a generator throws an exception midway through execution.
155 a generator throws an exception midway through execution.
144
156
145 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
157 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
146 encoding into methods.
158 encoding into methods.
147
159
148 2006-07-26 Ville Vainio <vivainio@gmail.com>
160 2006-07-26 Ville Vainio <vivainio@gmail.com>
149
161
150 * iplib.py: history now stores multiline input as single
162 * iplib.py: history now stores multiline input as single
151 history entries. Patch by Jorgen Cederlof.
163 history entries. Patch by Jorgen Cederlof.
152
164
153 2006-07-18 Walter Doerwald <walter@livinglogic.de>
165 2006-07-18 Walter Doerwald <walter@livinglogic.de>
154
166
155 * IPython/Extensions/ibrowse.py: Make cursor visible over
167 * IPython/Extensions/ibrowse.py: Make cursor visible over
156 non existing attributes.
168 non existing attributes.
157
169
158 2006-07-14 Walter Doerwald <walter@livinglogic.de>
170 2006-07-14 Walter Doerwald <walter@livinglogic.de>
159
171
160 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
172 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
161 error output of the running command doesn't mess up the screen.
173 error output of the running command doesn't mess up the screen.
162
174
163 2006-07-13 Walter Doerwald <walter@livinglogic.de>
175 2006-07-13 Walter Doerwald <walter@livinglogic.de>
164
176
165 * IPython/Extensions/ipipe.py (isort): Make isort usable without
177 * IPython/Extensions/ipipe.py (isort): Make isort usable without
166 argument. This sorts the items themselves.
178 argument. This sorts the items themselves.
167
179
168 2006-07-12 Walter Doerwald <walter@livinglogic.de>
180 2006-07-12 Walter Doerwald <walter@livinglogic.de>
169
181
170 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
182 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
171 Compile expression strings into code objects. This should speed
183 Compile expression strings into code objects. This should speed
172 up ifilter and friends somewhat.
184 up ifilter and friends somewhat.
173
185
174 2006-07-08 Ville Vainio <vivainio@gmail.com>
186 2006-07-08 Ville Vainio <vivainio@gmail.com>
175
187
176 * Magic.py: %cpaste now strips > from the beginning of lines
188 * Magic.py: %cpaste now strips > from the beginning of lines
177 to ease pasting quoted code from emails. Contributed by
189 to ease pasting quoted code from emails. Contributed by
178 Stefan van der Walt.
190 Stefan van der Walt.
179
191
180 2006-06-29 Ville Vainio <vivainio@gmail.com>
192 2006-06-29 Ville Vainio <vivainio@gmail.com>
181
193
182 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
194 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
183 mode, patch contributed by Darren Dale. NEEDS TESTING!
195 mode, patch contributed by Darren Dale. NEEDS TESTING!
184
196
185 2006-06-28 Walter Doerwald <walter@livinglogic.de>
197 2006-06-28 Walter Doerwald <walter@livinglogic.de>
186
198
187 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
199 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
188 a blue background. Fix fetching new display rows when the browser
200 a blue background. Fix fetching new display rows when the browser
189 scrolls more than a screenful (e.g. by using the goto command).
201 scrolls more than a screenful (e.g. by using the goto command).
190
202
191 2006-06-27 Ville Vainio <vivainio@gmail.com>
203 2006-06-27 Ville Vainio <vivainio@gmail.com>
192
204
193 * Magic.py (_inspect, _ofind) Apply David Huard's
205 * Magic.py (_inspect, _ofind) Apply David Huard's
194 patch for displaying the correct docstring for 'property'
206 patch for displaying the correct docstring for 'property'
195 attributes.
207 attributes.
196
208
197 2006-06-23 Walter Doerwald <walter@livinglogic.de>
209 2006-06-23 Walter Doerwald <walter@livinglogic.de>
198
210
199 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
211 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
200 commands into the methods implementing them.
212 commands into the methods implementing them.
201
213
202 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
214 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
203
215
204 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
216 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
205 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
217 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
206 autoindent support was authored by Jin Liu.
218 autoindent support was authored by Jin Liu.
207
219
208 2006-06-22 Walter Doerwald <walter@livinglogic.de>
220 2006-06-22 Walter Doerwald <walter@livinglogic.de>
209
221
210 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
222 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
211 for keymaps with a custom class that simplifies handling.
223 for keymaps with a custom class that simplifies handling.
212
224
213 2006-06-19 Walter Doerwald <walter@livinglogic.de>
225 2006-06-19 Walter Doerwald <walter@livinglogic.de>
214
226
215 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
227 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
216 resizing. This requires Python 2.5 to work.
228 resizing. This requires Python 2.5 to work.
217
229
218 2006-06-16 Walter Doerwald <walter@livinglogic.de>
230 2006-06-16 Walter Doerwald <walter@livinglogic.de>
219
231
220 * IPython/Extensions/ibrowse.py: Add two new commands to
232 * IPython/Extensions/ibrowse.py: Add two new commands to
221 ibrowse: "hideattr" (mapped to "h") hides the attribute under
233 ibrowse: "hideattr" (mapped to "h") hides the attribute under
222 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
234 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
223 attributes again. Remapped the help command to "?". Display
235 attributes again. Remapped the help command to "?". Display
224 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
236 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
225 as keys for the "home" and "end" commands. Add three new commands
237 as keys for the "home" and "end" commands. Add three new commands
226 to the input mode for "find" and friends: "delend" (CTRL-K)
238 to the input mode for "find" and friends: "delend" (CTRL-K)
227 deletes to the end of line. "incsearchup" searches upwards in the
239 deletes to the end of line. "incsearchup" searches upwards in the
228 command history for an input that starts with the text before the cursor.
240 command history for an input that starts with the text before the cursor.
229 "incsearchdown" does the same downwards. Removed a bogus mapping of
241 "incsearchdown" does the same downwards. Removed a bogus mapping of
230 the x key to "delete".
242 the x key to "delete".
231
243
232 2006-06-15 Ville Vainio <vivainio@gmail.com>
244 2006-06-15 Ville Vainio <vivainio@gmail.com>
233
245
234 * iplib.py, hooks.py: Added new generate_prompt hook that can be
246 * iplib.py, hooks.py: Added new generate_prompt hook that can be
235 used to create prompts dynamically, instead of the "old" way of
247 used to create prompts dynamically, instead of the "old" way of
236 assigning "magic" strings to prompt_in1 and prompt_in2. The old
248 assigning "magic" strings to prompt_in1 and prompt_in2. The old
237 way still works (it's invoked by the default hook), of course.
249 way still works (it's invoked by the default hook), of course.
238
250
239 * Prompts.py: added generate_output_prompt hook for altering output
251 * Prompts.py: added generate_output_prompt hook for altering output
240 prompt
252 prompt
241
253
242 * Release.py: Changed version string to 0.7.3.svn.
254 * Release.py: Changed version string to 0.7.3.svn.
243
255
244 2006-06-15 Walter Doerwald <walter@livinglogic.de>
256 2006-06-15 Walter Doerwald <walter@livinglogic.de>
245
257
246 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
258 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
247 the call to fetch() always tries to fetch enough data for at least one
259 the call to fetch() always tries to fetch enough data for at least one
248 full screen. This makes it possible to simply call moveto(0,0,True) in
260 full screen. This makes it possible to simply call moveto(0,0,True) in
249 the constructor. Fix typos and removed the obsolete goto attribute.
261 the constructor. Fix typos and removed the obsolete goto attribute.
250
262
251 2006-06-12 Ville Vainio <vivainio@gmail.com>
263 2006-06-12 Ville Vainio <vivainio@gmail.com>
252
264
253 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
265 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
254 allowing $variable interpolation within multiline statements,
266 allowing $variable interpolation within multiline statements,
255 though so far only with "sh" profile for a testing period.
267 though so far only with "sh" profile for a testing period.
256 The patch also enables splitting long commands with \ but it
268 The patch also enables splitting long commands with \ but it
257 doesn't work properly yet.
269 doesn't work properly yet.
258
270
259 2006-06-12 Walter Doerwald <walter@livinglogic.de>
271 2006-06-12 Walter Doerwald <walter@livinglogic.de>
260
272
261 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
273 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
262 input history and the position of the cursor in the input history for
274 input history and the position of the cursor in the input history for
263 the find, findbackwards and goto command.
275 the find, findbackwards and goto command.
264
276
265 2006-06-10 Walter Doerwald <walter@livinglogic.de>
277 2006-06-10 Walter Doerwald <walter@livinglogic.de>
266
278
267 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
279 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
268 implements the basic functionality of browser commands that require
280 implements the basic functionality of browser commands that require
269 input. Reimplement the goto, find and findbackwards commands as
281 input. Reimplement the goto, find and findbackwards commands as
270 subclasses of _CommandInput. Add an input history and keymaps to those
282 subclasses of _CommandInput. Add an input history and keymaps to those
271 commands. Add "\r" as a keyboard shortcut for the enterdefault and
283 commands. Add "\r" as a keyboard shortcut for the enterdefault and
272 execute commands.
284 execute commands.
273
285
274 2006-06-07 Ville Vainio <vivainio@gmail.com>
286 2006-06-07 Ville Vainio <vivainio@gmail.com>
275
287
276 * iplib.py: ipython mybatch.ipy exits ipython immediately after
288 * iplib.py: ipython mybatch.ipy exits ipython immediately after
277 running the batch files instead of leaving the session open.
289 running the batch files instead of leaving the session open.
278
290
279 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
291 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
280
292
281 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
293 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
282 the original fix was incomplete. Patch submitted by W. Maier.
294 the original fix was incomplete. Patch submitted by W. Maier.
283
295
284 2006-06-07 Ville Vainio <vivainio@gmail.com>
296 2006-06-07 Ville Vainio <vivainio@gmail.com>
285
297
286 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
298 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
287 Confirmation prompts can be supressed by 'quiet' option.
299 Confirmation prompts can be supressed by 'quiet' option.
288 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
300 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
289
301
290 2006-06-06 *** Released version 0.7.2
302 2006-06-06 *** Released version 0.7.2
291
303
292 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
304 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
293
305
294 * IPython/Release.py (version): Made 0.7.2 final for release.
306 * IPython/Release.py (version): Made 0.7.2 final for release.
295 Repo tagged and release cut.
307 Repo tagged and release cut.
296
308
297 2006-06-05 Ville Vainio <vivainio@gmail.com>
309 2006-06-05 Ville Vainio <vivainio@gmail.com>
298
310
299 * Magic.py (magic_rehashx): Honor no_alias list earlier in
311 * Magic.py (magic_rehashx): Honor no_alias list earlier in
300 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
312 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
301
313
302 * upgrade_dir.py: try import 'path' module a bit harder
314 * upgrade_dir.py: try import 'path' module a bit harder
303 (for %upgrade)
315 (for %upgrade)
304
316
305 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
317 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
306
318
307 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
319 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
308 instead of looping 20 times.
320 instead of looping 20 times.
309
321
310 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
322 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
311 correctly at initialization time. Bug reported by Krishna Mohan
323 correctly at initialization time. Bug reported by Krishna Mohan
312 Gundu <gkmohan-AT-gmail.com> on the user list.
324 Gundu <gkmohan-AT-gmail.com> on the user list.
313
325
314 * IPython/Release.py (version): Mark 0.7.2 version to start
326 * IPython/Release.py (version): Mark 0.7.2 version to start
315 testing for release on 06/06.
327 testing for release on 06/06.
316
328
317 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
329 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
318
330
319 * scripts/irunner: thin script interface so users don't have to
331 * scripts/irunner: thin script interface so users don't have to
320 find the module and call it as an executable, since modules rarely
332 find the module and call it as an executable, since modules rarely
321 live in people's PATH.
333 live in people's PATH.
322
334
323 * IPython/irunner.py (InteractiveRunner.__init__): added
335 * IPython/irunner.py (InteractiveRunner.__init__): added
324 delaybeforesend attribute to control delays with newer versions of
336 delaybeforesend attribute to control delays with newer versions of
325 pexpect. Thanks to detailed help from pexpect's author, Noah
337 pexpect. Thanks to detailed help from pexpect's author, Noah
326 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
338 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
327 correctly (it works in NoColor mode).
339 correctly (it works in NoColor mode).
328
340
329 * IPython/iplib.py (handle_normal): fix nasty crash reported on
341 * IPython/iplib.py (handle_normal): fix nasty crash reported on
330 SAGE list, from improper log() calls.
342 SAGE list, from improper log() calls.
331
343
332 2006-05-31 Ville Vainio <vivainio@gmail.com>
344 2006-05-31 Ville Vainio <vivainio@gmail.com>
333
345
334 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
346 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
335 with args in parens to work correctly with dirs that have spaces.
347 with args in parens to work correctly with dirs that have spaces.
336
348
337 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
349 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
338
350
339 * IPython/Logger.py (Logger.logstart): add option to log raw input
351 * IPython/Logger.py (Logger.logstart): add option to log raw input
340 instead of the processed one. A -r flag was added to the
352 instead of the processed one. A -r flag was added to the
341 %logstart magic used for controlling logging.
353 %logstart magic used for controlling logging.
342
354
343 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
355 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
344
356
345 * IPython/iplib.py (InteractiveShell.__init__): add check for the
357 * IPython/iplib.py (InteractiveShell.__init__): add check for the
346 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
358 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
347 recognize the option. After a bug report by Will Maier. This
359 recognize the option. After a bug report by Will Maier. This
348 closes #64 (will do it after confirmation from W. Maier).
360 closes #64 (will do it after confirmation from W. Maier).
349
361
350 * IPython/irunner.py: New module to run scripts as if manually
362 * IPython/irunner.py: New module to run scripts as if manually
351 typed into an interactive environment, based on pexpect. After a
363 typed into an interactive environment, based on pexpect. After a
352 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
364 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
353 ipython-user list. Simple unittests in the tests/ directory.
365 ipython-user list. Simple unittests in the tests/ directory.
354
366
355 * tools/release: add Will Maier, OpenBSD port maintainer, to
367 * tools/release: add Will Maier, OpenBSD port maintainer, to
356 recepients list. We are now officially part of the OpenBSD ports:
368 recepients list. We are now officially part of the OpenBSD ports:
357 http://www.openbsd.org/ports.html ! Many thanks to Will for the
369 http://www.openbsd.org/ports.html ! Many thanks to Will for the
358 work.
370 work.
359
371
360 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
372 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
361
373
362 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
374 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
363 so that it doesn't break tkinter apps.
375 so that it doesn't break tkinter apps.
364
376
365 * IPython/iplib.py (_prefilter): fix bug where aliases would
377 * IPython/iplib.py (_prefilter): fix bug where aliases would
366 shadow variables when autocall was fully off. Reported by SAGE
378 shadow variables when autocall was fully off. Reported by SAGE
367 author William Stein.
379 author William Stein.
368
380
369 * IPython/OInspect.py (Inspector.__init__): add a flag to control
381 * IPython/OInspect.py (Inspector.__init__): add a flag to control
370 at what detail level strings are computed when foo? is requested.
382 at what detail level strings are computed when foo? is requested.
371 This allows users to ask for example that the string form of an
383 This allows users to ask for example that the string form of an
372 object is only computed when foo?? is called, or even never, by
384 object is only computed when foo?? is called, or even never, by
373 setting the object_info_string_level >= 2 in the configuration
385 setting the object_info_string_level >= 2 in the configuration
374 file. This new option has been added and documented. After a
386 file. This new option has been added and documented. After a
375 request by SAGE to be able to control the printing of very large
387 request by SAGE to be able to control the printing of very large
376 objects more easily.
388 objects more easily.
377
389
378 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
390 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
379
391
380 * IPython/ipmaker.py (make_IPython): remove the ipython call path
392 * IPython/ipmaker.py (make_IPython): remove the ipython call path
381 from sys.argv, to be 100% consistent with how Python itself works
393 from sys.argv, to be 100% consistent with how Python itself works
382 (as seen for example with python -i file.py). After a bug report
394 (as seen for example with python -i file.py). After a bug report
383 by Jeffrey Collins.
395 by Jeffrey Collins.
384
396
385 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
397 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
386 nasty bug which was preventing custom namespaces with -pylab,
398 nasty bug which was preventing custom namespaces with -pylab,
387 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
399 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
388 compatibility (long gone from mpl).
400 compatibility (long gone from mpl).
389
401
390 * IPython/ipapi.py (make_session): name change: create->make. We
402 * IPython/ipapi.py (make_session): name change: create->make. We
391 use make in other places (ipmaker,...), it's shorter and easier to
403 use make in other places (ipmaker,...), it's shorter and easier to
392 type and say, etc. I'm trying to clean things before 0.7.2 so
404 type and say, etc. I'm trying to clean things before 0.7.2 so
393 that I can keep things stable wrt to ipapi in the chainsaw branch.
405 that I can keep things stable wrt to ipapi in the chainsaw branch.
394
406
395 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
407 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
396 python-mode recognizes our debugger mode. Add support for
408 python-mode recognizes our debugger mode. Add support for
397 autoindent inside (X)emacs. After a patch sent in by Jin Liu
409 autoindent inside (X)emacs. After a patch sent in by Jin Liu
398 <m.liu.jin-AT-gmail.com> originally written by
410 <m.liu.jin-AT-gmail.com> originally written by
399 doxgen-AT-newsmth.net (with minor modifications for xemacs
411 doxgen-AT-newsmth.net (with minor modifications for xemacs
400 compatibility)
412 compatibility)
401
413
402 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
414 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
403 tracebacks when walking the stack so that the stack tracking system
415 tracebacks when walking the stack so that the stack tracking system
404 in emacs' python-mode can identify the frames correctly.
416 in emacs' python-mode can identify the frames correctly.
405
417
406 * IPython/ipmaker.py (make_IPython): make the internal (and
418 * IPython/ipmaker.py (make_IPython): make the internal (and
407 default config) autoedit_syntax value false by default. Too many
419 default config) autoedit_syntax value false by default. Too many
408 users have complained to me (both on and off-list) about problems
420 users have complained to me (both on and off-list) about problems
409 with this option being on by default, so I'm making it default to
421 with this option being on by default, so I'm making it default to
410 off. It can still be enabled by anyone via the usual mechanisms.
422 off. It can still be enabled by anyone via the usual mechanisms.
411
423
412 * IPython/completer.py (Completer.attr_matches): add support for
424 * IPython/completer.py (Completer.attr_matches): add support for
413 PyCrust-style _getAttributeNames magic method. Patch contributed
425 PyCrust-style _getAttributeNames magic method. Patch contributed
414 by <mscott-AT-goldenspud.com>. Closes #50.
426 by <mscott-AT-goldenspud.com>. Closes #50.
415
427
416 * IPython/iplib.py (InteractiveShell.__init__): remove the
428 * IPython/iplib.py (InteractiveShell.__init__): remove the
417 deletion of exit/quit from __builtin__, which can break
429 deletion of exit/quit from __builtin__, which can break
418 third-party tools like the Zope debugging console. The
430 third-party tools like the Zope debugging console. The
419 %exit/%quit magics remain. In general, it's probably a good idea
431 %exit/%quit magics remain. In general, it's probably a good idea
420 not to delete anything from __builtin__, since we never know what
432 not to delete anything from __builtin__, since we never know what
421 that will break. In any case, python now (for 2.5) will support
433 that will break. In any case, python now (for 2.5) will support
422 'real' exit/quit, so this issue is moot. Closes #55.
434 'real' exit/quit, so this issue is moot. Closes #55.
423
435
424 * IPython/genutils.py (with_obj): rename the 'with' function to
436 * IPython/genutils.py (with_obj): rename the 'with' function to
425 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
437 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
426 becomes a language keyword. Closes #53.
438 becomes a language keyword. Closes #53.
427
439
428 * IPython/FakeModule.py (FakeModule.__init__): add a proper
440 * IPython/FakeModule.py (FakeModule.__init__): add a proper
429 __file__ attribute to this so it fools more things into thinking
441 __file__ attribute to this so it fools more things into thinking
430 it is a real module. Closes #59.
442 it is a real module. Closes #59.
431
443
432 * IPython/Magic.py (magic_edit): add -n option to open the editor
444 * IPython/Magic.py (magic_edit): add -n option to open the editor
433 at a specific line number. After a patch by Stefan van der Walt.
445 at a specific line number. After a patch by Stefan van der Walt.
434
446
435 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
447 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
436
448
437 * IPython/iplib.py (edit_syntax_error): fix crash when for some
449 * IPython/iplib.py (edit_syntax_error): fix crash when for some
438 reason the file could not be opened. After automatic crash
450 reason the file could not be opened. After automatic crash
439 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
451 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
440 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
452 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
441 (_should_recompile): Don't fire editor if using %bg, since there
453 (_should_recompile): Don't fire editor if using %bg, since there
442 is no file in the first place. From the same report as above.
454 is no file in the first place. From the same report as above.
443 (raw_input): protect against faulty third-party prefilters. After
455 (raw_input): protect against faulty third-party prefilters. After
444 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
456 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
445 while running under SAGE.
457 while running under SAGE.
446
458
447 2006-05-23 Ville Vainio <vivainio@gmail.com>
459 2006-05-23 Ville Vainio <vivainio@gmail.com>
448
460
449 * ipapi.py: Stripped down ip.to_user_ns() to work only as
461 * ipapi.py: Stripped down ip.to_user_ns() to work only as
450 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
462 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
451 now returns None (again), unless dummy is specifically allowed by
463 now returns None (again), unless dummy is specifically allowed by
452 ipapi.get(allow_dummy=True).
464 ipapi.get(allow_dummy=True).
453
465
454 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
466 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
455
467
456 * IPython: remove all 2.2-compatibility objects and hacks from
468 * IPython: remove all 2.2-compatibility objects and hacks from
457 everywhere, since we only support 2.3 at this point. Docs
469 everywhere, since we only support 2.3 at this point. Docs
458 updated.
470 updated.
459
471
460 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
472 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
461 Anything requiring extra validation can be turned into a Python
473 Anything requiring extra validation can be turned into a Python
462 property in the future. I used a property for the db one b/c
474 property in the future. I used a property for the db one b/c
463 there was a nasty circularity problem with the initialization
475 there was a nasty circularity problem with the initialization
464 order, which right now I don't have time to clean up.
476 order, which right now I don't have time to clean up.
465
477
466 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
478 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
467 another locking bug reported by Jorgen. I'm not 100% sure though,
479 another locking bug reported by Jorgen. I'm not 100% sure though,
468 so more testing is needed...
480 so more testing is needed...
469
481
470 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
482 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
471
483
472 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
484 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
473 local variables from any routine in user code (typically executed
485 local variables from any routine in user code (typically executed
474 with %run) directly into the interactive namespace. Very useful
486 with %run) directly into the interactive namespace. Very useful
475 when doing complex debugging.
487 when doing complex debugging.
476 (IPythonNotRunning): Changed the default None object to a dummy
488 (IPythonNotRunning): Changed the default None object to a dummy
477 whose attributes can be queried as well as called without
489 whose attributes can be queried as well as called without
478 exploding, to ease writing code which works transparently both in
490 exploding, to ease writing code which works transparently both in
479 and out of ipython and uses some of this API.
491 and out of ipython and uses some of this API.
480
492
481 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
493 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
482
494
483 * IPython/hooks.py (result_display): Fix the fact that our display
495 * IPython/hooks.py (result_display): Fix the fact that our display
484 hook was using str() instead of repr(), as the default python
496 hook was using str() instead of repr(), as the default python
485 console does. This had gone unnoticed b/c it only happened if
497 console does. This had gone unnoticed b/c it only happened if
486 %Pprint was off, but the inconsistency was there.
498 %Pprint was off, but the inconsistency was there.
487
499
488 2006-05-15 Ville Vainio <vivainio@gmail.com>
500 2006-05-15 Ville Vainio <vivainio@gmail.com>
489
501
490 * Oinspect.py: Only show docstring for nonexisting/binary files
502 * Oinspect.py: Only show docstring for nonexisting/binary files
491 when doing object??, closing ticket #62
503 when doing object??, closing ticket #62
492
504
493 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
505 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
494
506
495 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
507 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
496 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
508 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
497 was being released in a routine which hadn't checked if it had
509 was being released in a routine which hadn't checked if it had
498 been the one to acquire it.
510 been the one to acquire it.
499
511
500 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
512 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
501
513
502 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
514 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
503
515
504 2006-04-11 Ville Vainio <vivainio@gmail.com>
516 2006-04-11 Ville Vainio <vivainio@gmail.com>
505
517
506 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
518 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
507 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
519 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
508 prefilters, allowing stuff like magics and aliases in the file.
520 prefilters, allowing stuff like magics and aliases in the file.
509
521
510 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
522 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
511 added. Supported now are "%clear in" and "%clear out" (clear input and
523 added. Supported now are "%clear in" and "%clear out" (clear input and
512 output history, respectively). Also fixed CachedOutput.flush to
524 output history, respectively). Also fixed CachedOutput.flush to
513 properly flush the output cache.
525 properly flush the output cache.
514
526
515 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
527 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
516 half-success (and fail explicitly).
528 half-success (and fail explicitly).
517
529
518 2006-03-28 Ville Vainio <vivainio@gmail.com>
530 2006-03-28 Ville Vainio <vivainio@gmail.com>
519
531
520 * iplib.py: Fix quoting of aliases so that only argless ones
532 * iplib.py: Fix quoting of aliases so that only argless ones
521 are quoted
533 are quoted
522
534
523 2006-03-28 Ville Vainio <vivainio@gmail.com>
535 2006-03-28 Ville Vainio <vivainio@gmail.com>
524
536
525 * iplib.py: Quote aliases with spaces in the name.
537 * iplib.py: Quote aliases with spaces in the name.
526 "c:\program files\blah\bin" is now legal alias target.
538 "c:\program files\blah\bin" is now legal alias target.
527
539
528 * ext_rehashdir.py: Space no longer allowed as arg
540 * ext_rehashdir.py: Space no longer allowed as arg
529 separator, since space is legal in path names.
541 separator, since space is legal in path names.
530
542
531 2006-03-16 Ville Vainio <vivainio@gmail.com>
543 2006-03-16 Ville Vainio <vivainio@gmail.com>
532
544
533 * upgrade_dir.py: Take path.py from Extensions, correcting
545 * upgrade_dir.py: Take path.py from Extensions, correcting
534 %upgrade magic
546 %upgrade magic
535
547
536 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
548 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
537
549
538 * hooks.py: Only enclose editor binary in quotes if legal and
550 * hooks.py: Only enclose editor binary in quotes if legal and
539 necessary (space in the name, and is an existing file). Fixes a bug
551 necessary (space in the name, and is an existing file). Fixes a bug
540 reported by Zachary Pincus.
552 reported by Zachary Pincus.
541
553
542 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
554 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
543
555
544 * Manual: thanks to a tip on proper color handling for Emacs, by
556 * Manual: thanks to a tip on proper color handling for Emacs, by
545 Eric J Haywiser <ejh1-AT-MIT.EDU>.
557 Eric J Haywiser <ejh1-AT-MIT.EDU>.
546
558
547 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
559 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
548 by applying the provided patch. Thanks to Liu Jin
560 by applying the provided patch. Thanks to Liu Jin
549 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
561 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
550 XEmacs/Linux, I'm trusting the submitter that it actually helps
562 XEmacs/Linux, I'm trusting the submitter that it actually helps
551 under win32/GNU Emacs. Will revisit if any problems are reported.
563 under win32/GNU Emacs. Will revisit if any problems are reported.
552
564
553 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
565 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
554
566
555 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
567 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
556 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
568 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
557
569
558 2006-03-12 Ville Vainio <vivainio@gmail.com>
570 2006-03-12 Ville Vainio <vivainio@gmail.com>
559
571
560 * Magic.py (magic_timeit): Added %timeit magic, contributed by
572 * Magic.py (magic_timeit): Added %timeit magic, contributed by
561 Torsten Marek.
573 Torsten Marek.
562
574
563 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
575 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
564
576
565 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
577 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
566 line ranges works again.
578 line ranges works again.
567
579
568 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
580 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
569
581
570 * IPython/iplib.py (showtraceback): add back sys.last_traceback
582 * IPython/iplib.py (showtraceback): add back sys.last_traceback
571 and friends, after a discussion with Zach Pincus on ipython-user.
583 and friends, after a discussion with Zach Pincus on ipython-user.
572 I'm not 100% sure, but after thinking about it quite a bit, it may
584 I'm not 100% sure, but after thinking about it quite a bit, it may
573 be OK. Testing with the multithreaded shells didn't reveal any
585 be OK. Testing with the multithreaded shells didn't reveal any
574 problems, but let's keep an eye out.
586 problems, but let's keep an eye out.
575
587
576 In the process, I fixed a few things which were calling
588 In the process, I fixed a few things which were calling
577 self.InteractiveTB() directly (like safe_execfile), which is a
589 self.InteractiveTB() directly (like safe_execfile), which is a
578 mistake: ALL exception reporting should be done by calling
590 mistake: ALL exception reporting should be done by calling
579 self.showtraceback(), which handles state and tab-completion and
591 self.showtraceback(), which handles state and tab-completion and
580 more.
592 more.
581
593
582 2006-03-01 Ville Vainio <vivainio@gmail.com>
594 2006-03-01 Ville Vainio <vivainio@gmail.com>
583
595
584 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
596 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
585 To use, do "from ipipe import *".
597 To use, do "from ipipe import *".
586
598
587 2006-02-24 Ville Vainio <vivainio@gmail.com>
599 2006-02-24 Ville Vainio <vivainio@gmail.com>
588
600
589 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
601 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
590 "cleanly" and safely than the older upgrade mechanism.
602 "cleanly" and safely than the older upgrade mechanism.
591
603
592 2006-02-21 Ville Vainio <vivainio@gmail.com>
604 2006-02-21 Ville Vainio <vivainio@gmail.com>
593
605
594 * Magic.py: %save works again.
606 * Magic.py: %save works again.
595
607
596 2006-02-15 Ville Vainio <vivainio@gmail.com>
608 2006-02-15 Ville Vainio <vivainio@gmail.com>
597
609
598 * Magic.py: %Pprint works again
610 * Magic.py: %Pprint works again
599
611
600 * Extensions/ipy_sane_defaults.py: Provide everything provided
612 * Extensions/ipy_sane_defaults.py: Provide everything provided
601 in default ipythonrc, to make it possible to have a completely empty
613 in default ipythonrc, to make it possible to have a completely empty
602 ipythonrc (and thus completely rc-file free configuration)
614 ipythonrc (and thus completely rc-file free configuration)
603
615
604 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
616 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
605
617
606 * IPython/hooks.py (editor): quote the call to the editor command,
618 * IPython/hooks.py (editor): quote the call to the editor command,
607 to allow commands with spaces in them. Problem noted by watching
619 to allow commands with spaces in them. Problem noted by watching
608 Ian Oswald's video about textpad under win32 at
620 Ian Oswald's video about textpad under win32 at
609 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
621 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
610
622
611 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
623 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
612 describing magics (we haven't used @ for a loong time).
624 describing magics (we haven't used @ for a loong time).
613
625
614 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
626 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
615 contributed by marienz to close
627 contributed by marienz to close
616 http://www.scipy.net/roundup/ipython/issue53.
628 http://www.scipy.net/roundup/ipython/issue53.
617
629
618 2006-02-10 Ville Vainio <vivainio@gmail.com>
630 2006-02-10 Ville Vainio <vivainio@gmail.com>
619
631
620 * genutils.py: getoutput now works in win32 too
632 * genutils.py: getoutput now works in win32 too
621
633
622 * completer.py: alias and magic completion only invoked
634 * completer.py: alias and magic completion only invoked
623 at the first "item" in the line, to avoid "cd %store"
635 at the first "item" in the line, to avoid "cd %store"
624 nonsense.
636 nonsense.
625
637
626 2006-02-09 Ville Vainio <vivainio@gmail.com>
638 2006-02-09 Ville Vainio <vivainio@gmail.com>
627
639
628 * test/*: Added a unit testing framework (finally).
640 * test/*: Added a unit testing framework (finally).
629 '%run runtests.py' to run test_*.
641 '%run runtests.py' to run test_*.
630
642
631 * ipapi.py: Exposed runlines and set_custom_exc
643 * ipapi.py: Exposed runlines and set_custom_exc
632
644
633 2006-02-07 Ville Vainio <vivainio@gmail.com>
645 2006-02-07 Ville Vainio <vivainio@gmail.com>
634
646
635 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
647 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
636 instead use "f(1 2)" as before.
648 instead use "f(1 2)" as before.
637
649
638 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
650 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
639
651
640 * IPython/demo.py (IPythonDemo): Add new classes to the demo
652 * IPython/demo.py (IPythonDemo): Add new classes to the demo
641 facilities, for demos processed by the IPython input filter
653 facilities, for demos processed by the IPython input filter
642 (IPythonDemo), and for running a script one-line-at-a-time as a
654 (IPythonDemo), and for running a script one-line-at-a-time as a
643 demo, both for pure Python (LineDemo) and for IPython-processed
655 demo, both for pure Python (LineDemo) and for IPython-processed
644 input (IPythonLineDemo). After a request by Dave Kohel, from the
656 input (IPythonLineDemo). After a request by Dave Kohel, from the
645 SAGE team.
657 SAGE team.
646 (Demo.edit): added an edit() method to the demo objects, to edit
658 (Demo.edit): added an edit() method to the demo objects, to edit
647 the in-memory copy of the last executed block.
659 the in-memory copy of the last executed block.
648
660
649 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
661 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
650 processing to %edit, %macro and %save. These commands can now be
662 processing to %edit, %macro and %save. These commands can now be
651 invoked on the unprocessed input as it was typed by the user
663 invoked on the unprocessed input as it was typed by the user
652 (without any prefilters applied). After requests by the SAGE team
664 (without any prefilters applied). After requests by the SAGE team
653 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
665 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
654
666
655 2006-02-01 Ville Vainio <vivainio@gmail.com>
667 2006-02-01 Ville Vainio <vivainio@gmail.com>
656
668
657 * setup.py, eggsetup.py: easy_install ipython==dev works
669 * setup.py, eggsetup.py: easy_install ipython==dev works
658 correctly now (on Linux)
670 correctly now (on Linux)
659
671
660 * ipy_user_conf,ipmaker: user config changes, removed spurious
672 * ipy_user_conf,ipmaker: user config changes, removed spurious
661 warnings
673 warnings
662
674
663 * iplib: if rc.banner is string, use it as is.
675 * iplib: if rc.banner is string, use it as is.
664
676
665 * Magic: %pycat accepts a string argument and pages it's contents.
677 * Magic: %pycat accepts a string argument and pages it's contents.
666
678
667
679
668 2006-01-30 Ville Vainio <vivainio@gmail.com>
680 2006-01-30 Ville Vainio <vivainio@gmail.com>
669
681
670 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
682 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
671 Now %store and bookmarks work through PickleShare, meaning that
683 Now %store and bookmarks work through PickleShare, meaning that
672 concurrent access is possible and all ipython sessions see the
684 concurrent access is possible and all ipython sessions see the
673 same database situation all the time, instead of snapshot of
685 same database situation all the time, instead of snapshot of
674 the situation when the session was started. Hence, %bookmark
686 the situation when the session was started. Hence, %bookmark
675 results are immediately accessible from othes sessions. The database
687 results are immediately accessible from othes sessions. The database
676 is also available for use by user extensions. See:
688 is also available for use by user extensions. See:
677 http://www.python.org/pypi/pickleshare
689 http://www.python.org/pypi/pickleshare
678
690
679 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
691 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
680
692
681 * aliases can now be %store'd
693 * aliases can now be %store'd
682
694
683 * path.py moved to Extensions so that pickleshare does not need
695 * path.py moved to Extensions so that pickleshare does not need
684 IPython-specific import. Extensions added to pythonpath right
696 IPython-specific import. Extensions added to pythonpath right
685 at __init__.
697 at __init__.
686
698
687 * iplib.py: ipalias deprecated/redundant; aliases are converted and
699 * iplib.py: ipalias deprecated/redundant; aliases are converted and
688 called with _ip.system and the pre-transformed command string.
700 called with _ip.system and the pre-transformed command string.
689
701
690 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
702 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
691
703
692 * IPython/iplib.py (interact): Fix that we were not catching
704 * IPython/iplib.py (interact): Fix that we were not catching
693 KeyboardInterrupt exceptions properly. I'm not quite sure why the
705 KeyboardInterrupt exceptions properly. I'm not quite sure why the
694 logic here had to change, but it's fixed now.
706 logic here had to change, but it's fixed now.
695
707
696 2006-01-29 Ville Vainio <vivainio@gmail.com>
708 2006-01-29 Ville Vainio <vivainio@gmail.com>
697
709
698 * iplib.py: Try to import pyreadline on Windows.
710 * iplib.py: Try to import pyreadline on Windows.
699
711
700 2006-01-27 Ville Vainio <vivainio@gmail.com>
712 2006-01-27 Ville Vainio <vivainio@gmail.com>
701
713
702 * iplib.py: Expose ipapi as _ip in builtin namespace.
714 * iplib.py: Expose ipapi as _ip in builtin namespace.
703 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
715 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
704 and ip_set_hook (-> _ip.set_hook) redundant. % and !
716 and ip_set_hook (-> _ip.set_hook) redundant. % and !
705 syntax now produce _ip.* variant of the commands.
717 syntax now produce _ip.* variant of the commands.
706
718
707 * "_ip.options().autoedit_syntax = 2" automatically throws
719 * "_ip.options().autoedit_syntax = 2" automatically throws
708 user to editor for syntax error correction without prompting.
720 user to editor for syntax error correction without prompting.
709
721
710 2006-01-27 Ville Vainio <vivainio@gmail.com>
722 2006-01-27 Ville Vainio <vivainio@gmail.com>
711
723
712 * ipmaker.py: Give "realistic" sys.argv for scripts (without
724 * ipmaker.py: Give "realistic" sys.argv for scripts (without
713 'ipython' at argv[0]) executed through command line.
725 'ipython' at argv[0]) executed through command line.
714 NOTE: this DEPRECATES calling ipython with multiple scripts
726 NOTE: this DEPRECATES calling ipython with multiple scripts
715 ("ipython a.py b.py c.py")
727 ("ipython a.py b.py c.py")
716
728
717 * iplib.py, hooks.py: Added configurable input prefilter,
729 * iplib.py, hooks.py: Added configurable input prefilter,
718 named 'input_prefilter'. See ext_rescapture.py for example
730 named 'input_prefilter'. See ext_rescapture.py for example
719 usage.
731 usage.
720
732
721 * ext_rescapture.py, Magic.py: Better system command output capture
733 * ext_rescapture.py, Magic.py: Better system command output capture
722 through 'var = !ls' (deprecates user-visible %sc). Same notation
734 through 'var = !ls' (deprecates user-visible %sc). Same notation
723 applies for magics, 'var = %alias' assigns alias list to var.
735 applies for magics, 'var = %alias' assigns alias list to var.
724
736
725 * ipapi.py: added meta() for accessing extension-usable data store.
737 * ipapi.py: added meta() for accessing extension-usable data store.
726
738
727 * iplib.py: added InteractiveShell.getapi(). New magics should be
739 * iplib.py: added InteractiveShell.getapi(). New magics should be
728 written doing self.getapi() instead of using the shell directly.
740 written doing self.getapi() instead of using the shell directly.
729
741
730 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
742 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
731 %store foo >> ~/myfoo.txt to store variables to files (in clean
743 %store foo >> ~/myfoo.txt to store variables to files (in clean
732 textual form, not a restorable pickle).
744 textual form, not a restorable pickle).
733
745
734 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
746 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
735
747
736 * usage.py, Magic.py: added %quickref
748 * usage.py, Magic.py: added %quickref
737
749
738 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
750 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
739
751
740 * GetoptErrors when invoking magics etc. with wrong args
752 * GetoptErrors when invoking magics etc. with wrong args
741 are now more helpful:
753 are now more helpful:
742 GetoptError: option -l not recognized (allowed: "qb" )
754 GetoptError: option -l not recognized (allowed: "qb" )
743
755
744 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
756 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
745
757
746 * IPython/demo.py (Demo.show): Flush stdout after each block, so
758 * IPython/demo.py (Demo.show): Flush stdout after each block, so
747 computationally intensive blocks don't appear to stall the demo.
759 computationally intensive blocks don't appear to stall the demo.
748
760
749 2006-01-24 Ville Vainio <vivainio@gmail.com>
761 2006-01-24 Ville Vainio <vivainio@gmail.com>
750
762
751 * iplib.py, hooks.py: 'result_display' hook can return a non-None
763 * iplib.py, hooks.py: 'result_display' hook can return a non-None
752 value to manipulate resulting history entry.
764 value to manipulate resulting history entry.
753
765
754 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
766 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
755 to instance methods of IPApi class, to make extending an embedded
767 to instance methods of IPApi class, to make extending an embedded
756 IPython feasible. See ext_rehashdir.py for example usage.
768 IPython feasible. See ext_rehashdir.py for example usage.
757
769
758 * Merged 1071-1076 from branches/0.7.1
770 * Merged 1071-1076 from branches/0.7.1
759
771
760
772
761 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
773 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
762
774
763 * tools/release (daystamp): Fix build tools to use the new
775 * tools/release (daystamp): Fix build tools to use the new
764 eggsetup.py script to build lightweight eggs.
776 eggsetup.py script to build lightweight eggs.
765
777
766 * Applied changesets 1062 and 1064 before 0.7.1 release.
778 * Applied changesets 1062 and 1064 before 0.7.1 release.
767
779
768 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
780 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
769 see the raw input history (without conversions like %ls ->
781 see the raw input history (without conversions like %ls ->
770 ipmagic("ls")). After a request from W. Stein, SAGE
782 ipmagic("ls")). After a request from W. Stein, SAGE
771 (http://modular.ucsd.edu/sage) developer. This information is
783 (http://modular.ucsd.edu/sage) developer. This information is
772 stored in the input_hist_raw attribute of the IPython instance, so
784 stored in the input_hist_raw attribute of the IPython instance, so
773 developers can access it if needed (it's an InputList instance).
785 developers can access it if needed (it's an InputList instance).
774
786
775 * Versionstring = 0.7.2.svn
787 * Versionstring = 0.7.2.svn
776
788
777 * eggsetup.py: A separate script for constructing eggs, creates
789 * eggsetup.py: A separate script for constructing eggs, creates
778 proper launch scripts even on Windows (an .exe file in
790 proper launch scripts even on Windows (an .exe file in
779 \python24\scripts).
791 \python24\scripts).
780
792
781 * ipapi.py: launch_new_instance, launch entry point needed for the
793 * ipapi.py: launch_new_instance, launch entry point needed for the
782 egg.
794 egg.
783
795
784 2006-01-23 Ville Vainio <vivainio@gmail.com>
796 2006-01-23 Ville Vainio <vivainio@gmail.com>
785
797
786 * Added %cpaste magic for pasting python code
798 * Added %cpaste magic for pasting python code
787
799
788 2006-01-22 Ville Vainio <vivainio@gmail.com>
800 2006-01-22 Ville Vainio <vivainio@gmail.com>
789
801
790 * Merge from branches/0.7.1 into trunk, revs 1052-1057
802 * Merge from branches/0.7.1 into trunk, revs 1052-1057
791
803
792 * Versionstring = 0.7.2.svn
804 * Versionstring = 0.7.2.svn
793
805
794 * eggsetup.py: A separate script for constructing eggs, creates
806 * eggsetup.py: A separate script for constructing eggs, creates
795 proper launch scripts even on Windows (an .exe file in
807 proper launch scripts even on Windows (an .exe file in
796 \python24\scripts).
808 \python24\scripts).
797
809
798 * ipapi.py: launch_new_instance, launch entry point needed for the
810 * ipapi.py: launch_new_instance, launch entry point needed for the
799 egg.
811 egg.
800
812
801 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
813 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
802
814
803 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
815 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
804 %pfile foo would print the file for foo even if it was a binary.
816 %pfile foo would print the file for foo even if it was a binary.
805 Now, extensions '.so' and '.dll' are skipped.
817 Now, extensions '.so' and '.dll' are skipped.
806
818
807 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
819 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
808 bug, where macros would fail in all threaded modes. I'm not 100%
820 bug, where macros would fail in all threaded modes. I'm not 100%
809 sure, so I'm going to put out an rc instead of making a release
821 sure, so I'm going to put out an rc instead of making a release
810 today, and wait for feedback for at least a few days.
822 today, and wait for feedback for at least a few days.
811
823
812 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
824 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
813 it...) the handling of pasting external code with autoindent on.
825 it...) the handling of pasting external code with autoindent on.
814 To get out of a multiline input, the rule will appear for most
826 To get out of a multiline input, the rule will appear for most
815 users unchanged: two blank lines or change the indent level
827 users unchanged: two blank lines or change the indent level
816 proposed by IPython. But there is a twist now: you can
828 proposed by IPython. But there is a twist now: you can
817 add/subtract only *one or two spaces*. If you add/subtract three
829 add/subtract only *one or two spaces*. If you add/subtract three
818 or more (unless you completely delete the line), IPython will
830 or more (unless you completely delete the line), IPython will
819 accept that line, and you'll need to enter a second one of pure
831 accept that line, and you'll need to enter a second one of pure
820 whitespace. I know it sounds complicated, but I can't find a
832 whitespace. I know it sounds complicated, but I can't find a
821 different solution that covers all the cases, with the right
833 different solution that covers all the cases, with the right
822 heuristics. Hopefully in actual use, nobody will really notice
834 heuristics. Hopefully in actual use, nobody will really notice
823 all these strange rules and things will 'just work'.
835 all these strange rules and things will 'just work'.
824
836
825 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
837 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
826
838
827 * IPython/iplib.py (interact): catch exceptions which can be
839 * IPython/iplib.py (interact): catch exceptions which can be
828 triggered asynchronously by signal handlers. Thanks to an
840 triggered asynchronously by signal handlers. Thanks to an
829 automatic crash report, submitted by Colin Kingsley
841 automatic crash report, submitted by Colin Kingsley
830 <tercel-AT-gentoo.org>.
842 <tercel-AT-gentoo.org>.
831
843
832 2006-01-20 Ville Vainio <vivainio@gmail.com>
844 2006-01-20 Ville Vainio <vivainio@gmail.com>
833
845
834 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
846 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
835 (%rehashdir, very useful, try it out) of how to extend ipython
847 (%rehashdir, very useful, try it out) of how to extend ipython
836 with new magics. Also added Extensions dir to pythonpath to make
848 with new magics. Also added Extensions dir to pythonpath to make
837 importing extensions easy.
849 importing extensions easy.
838
850
839 * %store now complains when trying to store interactively declared
851 * %store now complains when trying to store interactively declared
840 classes / instances of those classes.
852 classes / instances of those classes.
841
853
842 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
854 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
843 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
855 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
844 if they exist, and ipy_user_conf.py with some defaults is created for
856 if they exist, and ipy_user_conf.py with some defaults is created for
845 the user.
857 the user.
846
858
847 * Startup rehashing done by the config file, not InterpreterExec.
859 * Startup rehashing done by the config file, not InterpreterExec.
848 This means system commands are available even without selecting the
860 This means system commands are available even without selecting the
849 pysh profile. It's the sensible default after all.
861 pysh profile. It's the sensible default after all.
850
862
851 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
863 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
852
864
853 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
865 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
854 multiline code with autoindent on working. But I am really not
866 multiline code with autoindent on working. But I am really not
855 sure, so this needs more testing. Will commit a debug-enabled
867 sure, so this needs more testing. Will commit a debug-enabled
856 version for now, while I test it some more, so that Ville and
868 version for now, while I test it some more, so that Ville and
857 others may also catch any problems. Also made
869 others may also catch any problems. Also made
858 self.indent_current_str() a method, to ensure that there's no
870 self.indent_current_str() a method, to ensure that there's no
859 chance of the indent space count and the corresponding string
871 chance of the indent space count and the corresponding string
860 falling out of sync. All code needing the string should just call
872 falling out of sync. All code needing the string should just call
861 the method.
873 the method.
862
874
863 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
875 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
864
876
865 * IPython/Magic.py (magic_edit): fix check for when users don't
877 * IPython/Magic.py (magic_edit): fix check for when users don't
866 save their output files, the try/except was in the wrong section.
878 save their output files, the try/except was in the wrong section.
867
879
868 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
880 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
869
881
870 * IPython/Magic.py (magic_run): fix __file__ global missing from
882 * IPython/Magic.py (magic_run): fix __file__ global missing from
871 script's namespace when executed via %run. After a report by
883 script's namespace when executed via %run. After a report by
872 Vivian.
884 Vivian.
873
885
874 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
886 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
875 when using python 2.4. The parent constructor changed in 2.4, and
887 when using python 2.4. The parent constructor changed in 2.4, and
876 we need to track it directly (we can't call it, as it messes up
888 we need to track it directly (we can't call it, as it messes up
877 readline and tab-completion inside our pdb would stop working).
889 readline and tab-completion inside our pdb would stop working).
878 After a bug report by R. Bernstein <rocky-AT-panix.com>.
890 After a bug report by R. Bernstein <rocky-AT-panix.com>.
879
891
880 2006-01-16 Ville Vainio <vivainio@gmail.com>
892 2006-01-16 Ville Vainio <vivainio@gmail.com>
881
893
882 * Ipython/magic.py: Reverted back to old %edit functionality
894 * Ipython/magic.py: Reverted back to old %edit functionality
883 that returns file contents on exit.
895 that returns file contents on exit.
884
896
885 * IPython/path.py: Added Jason Orendorff's "path" module to
897 * IPython/path.py: Added Jason Orendorff's "path" module to
886 IPython tree, http://www.jorendorff.com/articles/python/path/.
898 IPython tree, http://www.jorendorff.com/articles/python/path/.
887 You can get path objects conveniently through %sc, and !!, e.g.:
899 You can get path objects conveniently through %sc, and !!, e.g.:
888 sc files=ls
900 sc files=ls
889 for p in files.paths: # or files.p
901 for p in files.paths: # or files.p
890 print p,p.mtime
902 print p,p.mtime
891
903
892 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
904 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
893 now work again without considering the exclusion regexp -
905 now work again without considering the exclusion regexp -
894 hence, things like ',foo my/path' turn to 'foo("my/path")'
906 hence, things like ',foo my/path' turn to 'foo("my/path")'
895 instead of syntax error.
907 instead of syntax error.
896
908
897
909
898 2006-01-14 Ville Vainio <vivainio@gmail.com>
910 2006-01-14 Ville Vainio <vivainio@gmail.com>
899
911
900 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
912 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
901 ipapi decorators for python 2.4 users, options() provides access to rc
913 ipapi decorators for python 2.4 users, options() provides access to rc
902 data.
914 data.
903
915
904 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
916 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
905 as path separators (even on Linux ;-). Space character after
917 as path separators (even on Linux ;-). Space character after
906 backslash (as yielded by tab completer) is still space;
918 backslash (as yielded by tab completer) is still space;
907 "%cd long\ name" works as expected.
919 "%cd long\ name" works as expected.
908
920
909 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
921 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
910 as "chain of command", with priority. API stays the same,
922 as "chain of command", with priority. API stays the same,
911 TryNext exception raised by a hook function signals that
923 TryNext exception raised by a hook function signals that
912 current hook failed and next hook should try handling it, as
924 current hook failed and next hook should try handling it, as
913 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
925 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
914 requested configurable display hook, which is now implemented.
926 requested configurable display hook, which is now implemented.
915
927
916 2006-01-13 Ville Vainio <vivainio@gmail.com>
928 2006-01-13 Ville Vainio <vivainio@gmail.com>
917
929
918 * IPython/platutils*.py: platform specific utility functions,
930 * IPython/platutils*.py: platform specific utility functions,
919 so far only set_term_title is implemented (change terminal
931 so far only set_term_title is implemented (change terminal
920 label in windowing systems). %cd now changes the title to
932 label in windowing systems). %cd now changes the title to
921 current dir.
933 current dir.
922
934
923 * IPython/Release.py: Added myself to "authors" list,
935 * IPython/Release.py: Added myself to "authors" list,
924 had to create new files.
936 had to create new files.
925
937
926 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
938 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
927 shell escape; not a known bug but had potential to be one in the
939 shell escape; not a known bug but had potential to be one in the
928 future.
940 future.
929
941
930 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
942 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
931 extension API for IPython! See the module for usage example. Fix
943 extension API for IPython! See the module for usage example. Fix
932 OInspect for docstring-less magic functions.
944 OInspect for docstring-less magic functions.
933
945
934
946
935 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
947 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
936
948
937 * IPython/iplib.py (raw_input): temporarily deactivate all
949 * IPython/iplib.py (raw_input): temporarily deactivate all
938 attempts at allowing pasting of code with autoindent on. It
950 attempts at allowing pasting of code with autoindent on. It
939 introduced bugs (reported by Prabhu) and I can't seem to find a
951 introduced bugs (reported by Prabhu) and I can't seem to find a
940 robust combination which works in all cases. Will have to revisit
952 robust combination which works in all cases. Will have to revisit
941 later.
953 later.
942
954
943 * IPython/genutils.py: remove isspace() function. We've dropped
955 * IPython/genutils.py: remove isspace() function. We've dropped
944 2.2 compatibility, so it's OK to use the string method.
956 2.2 compatibility, so it's OK to use the string method.
945
957
946 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
958 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
947
959
948 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
960 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
949 matching what NOT to autocall on, to include all python binary
961 matching what NOT to autocall on, to include all python binary
950 operators (including things like 'and', 'or', 'is' and 'in').
962 operators (including things like 'and', 'or', 'is' and 'in').
951 Prompted by a bug report on 'foo & bar', but I realized we had
963 Prompted by a bug report on 'foo & bar', but I realized we had
952 many more potential bug cases with other operators. The regexp is
964 many more potential bug cases with other operators. The regexp is
953 self.re_exclude_auto, it's fairly commented.
965 self.re_exclude_auto, it's fairly commented.
954
966
955 2006-01-12 Ville Vainio <vivainio@gmail.com>
967 2006-01-12 Ville Vainio <vivainio@gmail.com>
956
968
957 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
969 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
958 Prettified and hardened string/backslash quoting with ipsystem(),
970 Prettified and hardened string/backslash quoting with ipsystem(),
959 ipalias() and ipmagic(). Now even \ characters are passed to
971 ipalias() and ipmagic(). Now even \ characters are passed to
960 %magics, !shell escapes and aliases exactly as they are in the
972 %magics, !shell escapes and aliases exactly as they are in the
961 ipython command line. Should improve backslash experience,
973 ipython command line. Should improve backslash experience,
962 particularly in Windows (path delimiter for some commands that
974 particularly in Windows (path delimiter for some commands that
963 won't understand '/'), but Unix benefits as well (regexps). %cd
975 won't understand '/'), but Unix benefits as well (regexps). %cd
964 magic still doesn't support backslash path delimiters, though. Also
976 magic still doesn't support backslash path delimiters, though. Also
965 deleted all pretense of supporting multiline command strings in
977 deleted all pretense of supporting multiline command strings in
966 !system or %magic commands. Thanks to Jerry McRae for suggestions.
978 !system or %magic commands. Thanks to Jerry McRae for suggestions.
967
979
968 * doc/build_doc_instructions.txt added. Documentation on how to
980 * doc/build_doc_instructions.txt added. Documentation on how to
969 use doc/update_manual.py, added yesterday. Both files contributed
981 use doc/update_manual.py, added yesterday. Both files contributed
970 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
982 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
971 doc/*.sh for deprecation at a later date.
983 doc/*.sh for deprecation at a later date.
972
984
973 * /ipython.py Added ipython.py to root directory for
985 * /ipython.py Added ipython.py to root directory for
974 zero-installation (tar xzvf ipython.tgz; cd ipython; python
986 zero-installation (tar xzvf ipython.tgz; cd ipython; python
975 ipython.py) and development convenience (no need to keep doing
987 ipython.py) and development convenience (no need to keep doing
976 "setup.py install" between changes).
988 "setup.py install" between changes).
977
989
978 * Made ! and !! shell escapes work (again) in multiline expressions:
990 * Made ! and !! shell escapes work (again) in multiline expressions:
979 if 1:
991 if 1:
980 !ls
992 !ls
981 !!ls
993 !!ls
982
994
983 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
995 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
984
996
985 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
997 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
986 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
998 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
987 module in case-insensitive installation. Was causing crashes
999 module in case-insensitive installation. Was causing crashes
988 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1000 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
989
1001
990 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1002 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
991 <marienz-AT-gentoo.org>, closes
1003 <marienz-AT-gentoo.org>, closes
992 http://www.scipy.net/roundup/ipython/issue51.
1004 http://www.scipy.net/roundup/ipython/issue51.
993
1005
994 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1006 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
995
1007
996 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1008 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
997 problem of excessive CPU usage under *nix and keyboard lag under
1009 problem of excessive CPU usage under *nix and keyboard lag under
998 win32.
1010 win32.
999
1011
1000 2006-01-10 *** Released version 0.7.0
1012 2006-01-10 *** Released version 0.7.0
1001
1013
1002 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1014 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1003
1015
1004 * IPython/Release.py (revision): tag version number to 0.7.0,
1016 * IPython/Release.py (revision): tag version number to 0.7.0,
1005 ready for release.
1017 ready for release.
1006
1018
1007 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1019 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1008 it informs the user of the name of the temp. file used. This can
1020 it informs the user of the name of the temp. file used. This can
1009 help if you decide later to reuse that same file, so you know
1021 help if you decide later to reuse that same file, so you know
1010 where to copy the info from.
1022 where to copy the info from.
1011
1023
1012 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1024 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1013
1025
1014 * setup_bdist_egg.py: little script to build an egg. Added
1026 * setup_bdist_egg.py: little script to build an egg. Added
1015 support in the release tools as well.
1027 support in the release tools as well.
1016
1028
1017 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1029 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1018
1030
1019 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1031 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1020 version selection (new -wxversion command line and ipythonrc
1032 version selection (new -wxversion command line and ipythonrc
1021 parameter). Patch contributed by Arnd Baecker
1033 parameter). Patch contributed by Arnd Baecker
1022 <arnd.baecker-AT-web.de>.
1034 <arnd.baecker-AT-web.de>.
1023
1035
1024 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1036 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1025 embedded instances, for variables defined at the interactive
1037 embedded instances, for variables defined at the interactive
1026 prompt of the embedded ipython. Reported by Arnd.
1038 prompt of the embedded ipython. Reported by Arnd.
1027
1039
1028 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1040 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1029 it can be used as a (stateful) toggle, or with a direct parameter.
1041 it can be used as a (stateful) toggle, or with a direct parameter.
1030
1042
1031 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1043 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1032 could be triggered in certain cases and cause the traceback
1044 could be triggered in certain cases and cause the traceback
1033 printer not to work.
1045 printer not to work.
1034
1046
1035 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1047 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1036
1048
1037 * IPython/iplib.py (_should_recompile): Small fix, closes
1049 * IPython/iplib.py (_should_recompile): Small fix, closes
1038 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1050 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1039
1051
1040 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1052 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1041
1053
1042 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1054 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1043 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1055 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1044 Moad for help with tracking it down.
1056 Moad for help with tracking it down.
1045
1057
1046 * IPython/iplib.py (handle_auto): fix autocall handling for
1058 * IPython/iplib.py (handle_auto): fix autocall handling for
1047 objects which support BOTH __getitem__ and __call__ (so that f [x]
1059 objects which support BOTH __getitem__ and __call__ (so that f [x]
1048 is left alone, instead of becoming f([x]) automatically).
1060 is left alone, instead of becoming f([x]) automatically).
1049
1061
1050 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1062 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1051 Ville's patch.
1063 Ville's patch.
1052
1064
1053 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1065 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1054
1066
1055 * IPython/iplib.py (handle_auto): changed autocall semantics to
1067 * IPython/iplib.py (handle_auto): changed autocall semantics to
1056 include 'smart' mode, where the autocall transformation is NOT
1068 include 'smart' mode, where the autocall transformation is NOT
1057 applied if there are no arguments on the line. This allows you to
1069 applied if there are no arguments on the line. This allows you to
1058 just type 'foo' if foo is a callable to see its internal form,
1070 just type 'foo' if foo is a callable to see its internal form,
1059 instead of having it called with no arguments (typically a
1071 instead of having it called with no arguments (typically a
1060 mistake). The old 'full' autocall still exists: for that, you
1072 mistake). The old 'full' autocall still exists: for that, you
1061 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1073 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1062
1074
1063 * IPython/completer.py (Completer.attr_matches): add
1075 * IPython/completer.py (Completer.attr_matches): add
1064 tab-completion support for Enthoughts' traits. After a report by
1076 tab-completion support for Enthoughts' traits. After a report by
1065 Arnd and a patch by Prabhu.
1077 Arnd and a patch by Prabhu.
1066
1078
1067 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1079 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1068
1080
1069 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1081 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1070 Schmolck's patch to fix inspect.getinnerframes().
1082 Schmolck's patch to fix inspect.getinnerframes().
1071
1083
1072 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1084 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1073 for embedded instances, regarding handling of namespaces and items
1085 for embedded instances, regarding handling of namespaces and items
1074 added to the __builtin__ one. Multiple embedded instances and
1086 added to the __builtin__ one. Multiple embedded instances and
1075 recursive embeddings should work better now (though I'm not sure
1087 recursive embeddings should work better now (though I'm not sure
1076 I've got all the corner cases fixed, that code is a bit of a brain
1088 I've got all the corner cases fixed, that code is a bit of a brain
1077 twister).
1089 twister).
1078
1090
1079 * IPython/Magic.py (magic_edit): added support to edit in-memory
1091 * IPython/Magic.py (magic_edit): added support to edit in-memory
1080 macros (automatically creates the necessary temp files). %edit
1092 macros (automatically creates the necessary temp files). %edit
1081 also doesn't return the file contents anymore, it's just noise.
1093 also doesn't return the file contents anymore, it's just noise.
1082
1094
1083 * IPython/completer.py (Completer.attr_matches): revert change to
1095 * IPython/completer.py (Completer.attr_matches): revert change to
1084 complete only on attributes listed in __all__. I realized it
1096 complete only on attributes listed in __all__. I realized it
1085 cripples the tab-completion system as a tool for exploring the
1097 cripples the tab-completion system as a tool for exploring the
1086 internals of unknown libraries (it renders any non-__all__
1098 internals of unknown libraries (it renders any non-__all__
1087 attribute off-limits). I got bit by this when trying to see
1099 attribute off-limits). I got bit by this when trying to see
1088 something inside the dis module.
1100 something inside the dis module.
1089
1101
1090 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1102 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1091
1103
1092 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1104 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1093 namespace for users and extension writers to hold data in. This
1105 namespace for users and extension writers to hold data in. This
1094 follows the discussion in
1106 follows the discussion in
1095 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1107 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1096
1108
1097 * IPython/completer.py (IPCompleter.complete): small patch to help
1109 * IPython/completer.py (IPCompleter.complete): small patch to help
1098 tab-completion under Emacs, after a suggestion by John Barnard
1110 tab-completion under Emacs, after a suggestion by John Barnard
1099 <barnarj-AT-ccf.org>.
1111 <barnarj-AT-ccf.org>.
1100
1112
1101 * IPython/Magic.py (Magic.extract_input_slices): added support for
1113 * IPython/Magic.py (Magic.extract_input_slices): added support for
1102 the slice notation in magics to use N-M to represent numbers N...M
1114 the slice notation in magics to use N-M to represent numbers N...M
1103 (closed endpoints). This is used by %macro and %save.
1115 (closed endpoints). This is used by %macro and %save.
1104
1116
1105 * IPython/completer.py (Completer.attr_matches): for modules which
1117 * IPython/completer.py (Completer.attr_matches): for modules which
1106 define __all__, complete only on those. After a patch by Jeffrey
1118 define __all__, complete only on those. After a patch by Jeffrey
1107 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1119 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1108 speed up this routine.
1120 speed up this routine.
1109
1121
1110 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1122 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1111 don't know if this is the end of it, but the behavior now is
1123 don't know if this is the end of it, but the behavior now is
1112 certainly much more correct. Note that coupled with macros,
1124 certainly much more correct. Note that coupled with macros,
1113 slightly surprising (at first) behavior may occur: a macro will in
1125 slightly surprising (at first) behavior may occur: a macro will in
1114 general expand to multiple lines of input, so upon exiting, the
1126 general expand to multiple lines of input, so upon exiting, the
1115 in/out counters will both be bumped by the corresponding amount
1127 in/out counters will both be bumped by the corresponding amount
1116 (as if the macro's contents had been typed interactively). Typing
1128 (as if the macro's contents had been typed interactively). Typing
1117 %hist will reveal the intermediate (silently processed) lines.
1129 %hist will reveal the intermediate (silently processed) lines.
1118
1130
1119 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1131 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1120 pickle to fail (%run was overwriting __main__ and not restoring
1132 pickle to fail (%run was overwriting __main__ and not restoring
1121 it, but pickle relies on __main__ to operate).
1133 it, but pickle relies on __main__ to operate).
1122
1134
1123 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1135 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1124 using properties, but forgot to make the main InteractiveShell
1136 using properties, but forgot to make the main InteractiveShell
1125 class a new-style class. Properties fail silently, and
1137 class a new-style class. Properties fail silently, and
1126 mysteriously, with old-style class (getters work, but
1138 mysteriously, with old-style class (getters work, but
1127 setters don't do anything).
1139 setters don't do anything).
1128
1140
1129 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1141 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1130
1142
1131 * IPython/Magic.py (magic_history): fix history reporting bug (I
1143 * IPython/Magic.py (magic_history): fix history reporting bug (I
1132 know some nasties are still there, I just can't seem to find a
1144 know some nasties are still there, I just can't seem to find a
1133 reproducible test case to track them down; the input history is
1145 reproducible test case to track them down; the input history is
1134 falling out of sync...)
1146 falling out of sync...)
1135
1147
1136 * IPython/iplib.py (handle_shell_escape): fix bug where both
1148 * IPython/iplib.py (handle_shell_escape): fix bug where both
1137 aliases and system accesses where broken for indented code (such
1149 aliases and system accesses where broken for indented code (such
1138 as loops).
1150 as loops).
1139
1151
1140 * IPython/genutils.py (shell): fix small but critical bug for
1152 * IPython/genutils.py (shell): fix small but critical bug for
1141 win32 system access.
1153 win32 system access.
1142
1154
1143 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1155 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1144
1156
1145 * IPython/iplib.py (showtraceback): remove use of the
1157 * IPython/iplib.py (showtraceback): remove use of the
1146 sys.last_{type/value/traceback} structures, which are non
1158 sys.last_{type/value/traceback} structures, which are non
1147 thread-safe.
1159 thread-safe.
1148 (_prefilter): change control flow to ensure that we NEVER
1160 (_prefilter): change control flow to ensure that we NEVER
1149 introspect objects when autocall is off. This will guarantee that
1161 introspect objects when autocall is off. This will guarantee that
1150 having an input line of the form 'x.y', where access to attribute
1162 having an input line of the form 'x.y', where access to attribute
1151 'y' has side effects, doesn't trigger the side effect TWICE. It
1163 'y' has side effects, doesn't trigger the side effect TWICE. It
1152 is important to note that, with autocall on, these side effects
1164 is important to note that, with autocall on, these side effects
1153 can still happen.
1165 can still happen.
1154 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1166 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1155 trio. IPython offers these three kinds of special calls which are
1167 trio. IPython offers these three kinds of special calls which are
1156 not python code, and it's a good thing to have their call method
1168 not python code, and it's a good thing to have their call method
1157 be accessible as pure python functions (not just special syntax at
1169 be accessible as pure python functions (not just special syntax at
1158 the command line). It gives us a better internal implementation
1170 the command line). It gives us a better internal implementation
1159 structure, as well as exposing these for user scripting more
1171 structure, as well as exposing these for user scripting more
1160 cleanly.
1172 cleanly.
1161
1173
1162 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1174 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1163 file. Now that they'll be more likely to be used with the
1175 file. Now that they'll be more likely to be used with the
1164 persistance system (%store), I want to make sure their module path
1176 persistance system (%store), I want to make sure their module path
1165 doesn't change in the future, so that we don't break things for
1177 doesn't change in the future, so that we don't break things for
1166 users' persisted data.
1178 users' persisted data.
1167
1179
1168 * IPython/iplib.py (autoindent_update): move indentation
1180 * IPython/iplib.py (autoindent_update): move indentation
1169 management into the _text_ processing loop, not the keyboard
1181 management into the _text_ processing loop, not the keyboard
1170 interactive one. This is necessary to correctly process non-typed
1182 interactive one. This is necessary to correctly process non-typed
1171 multiline input (such as macros).
1183 multiline input (such as macros).
1172
1184
1173 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1185 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1174 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1186 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1175 which was producing problems in the resulting manual.
1187 which was producing problems in the resulting manual.
1176 (magic_whos): improve reporting of instances (show their class,
1188 (magic_whos): improve reporting of instances (show their class,
1177 instead of simply printing 'instance' which isn't terribly
1189 instead of simply printing 'instance' which isn't terribly
1178 informative).
1190 informative).
1179
1191
1180 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1192 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1181 (minor mods) to support network shares under win32.
1193 (minor mods) to support network shares under win32.
1182
1194
1183 * IPython/winconsole.py (get_console_size): add new winconsole
1195 * IPython/winconsole.py (get_console_size): add new winconsole
1184 module and fixes to page_dumb() to improve its behavior under
1196 module and fixes to page_dumb() to improve its behavior under
1185 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1197 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1186
1198
1187 * IPython/Magic.py (Macro): simplified Macro class to just
1199 * IPython/Magic.py (Macro): simplified Macro class to just
1188 subclass list. We've had only 2.2 compatibility for a very long
1200 subclass list. We've had only 2.2 compatibility for a very long
1189 time, yet I was still avoiding subclassing the builtin types. No
1201 time, yet I was still avoiding subclassing the builtin types. No
1190 more (I'm also starting to use properties, though I won't shift to
1202 more (I'm also starting to use properties, though I won't shift to
1191 2.3-specific features quite yet).
1203 2.3-specific features quite yet).
1192 (magic_store): added Ville's patch for lightweight variable
1204 (magic_store): added Ville's patch for lightweight variable
1193 persistence, after a request on the user list by Matt Wilkie
1205 persistence, after a request on the user list by Matt Wilkie
1194 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1206 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1195 details.
1207 details.
1196
1208
1197 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1209 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1198 changed the default logfile name from 'ipython.log' to
1210 changed the default logfile name from 'ipython.log' to
1199 'ipython_log.py'. These logs are real python files, and now that
1211 'ipython_log.py'. These logs are real python files, and now that
1200 we have much better multiline support, people are more likely to
1212 we have much better multiline support, people are more likely to
1201 want to use them as such. Might as well name them correctly.
1213 want to use them as such. Might as well name them correctly.
1202
1214
1203 * IPython/Magic.py: substantial cleanup. While we can't stop
1215 * IPython/Magic.py: substantial cleanup. While we can't stop
1204 using magics as mixins, due to the existing customizations 'out
1216 using magics as mixins, due to the existing customizations 'out
1205 there' which rely on the mixin naming conventions, at least I
1217 there' which rely on the mixin naming conventions, at least I
1206 cleaned out all cross-class name usage. So once we are OK with
1218 cleaned out all cross-class name usage. So once we are OK with
1207 breaking compatibility, the two systems can be separated.
1219 breaking compatibility, the two systems can be separated.
1208
1220
1209 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1221 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1210 anymore, and the class is a fair bit less hideous as well. New
1222 anymore, and the class is a fair bit less hideous as well. New
1211 features were also introduced: timestamping of input, and logging
1223 features were also introduced: timestamping of input, and logging
1212 of output results. These are user-visible with the -t and -o
1224 of output results. These are user-visible with the -t and -o
1213 options to %logstart. Closes
1225 options to %logstart. Closes
1214 http://www.scipy.net/roundup/ipython/issue11 and a request by
1226 http://www.scipy.net/roundup/ipython/issue11 and a request by
1215 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1227 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1216
1228
1217 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1229 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1218
1230
1219 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1231 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1220 better handle backslashes in paths. See the thread 'More Windows
1232 better handle backslashes in paths. See the thread 'More Windows
1221 questions part 2 - \/ characters revisited' on the iypthon user
1233 questions part 2 - \/ characters revisited' on the iypthon user
1222 list:
1234 list:
1223 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1235 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1224
1236
1225 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1237 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1226
1238
1227 (InteractiveShell.__init__): change threaded shells to not use the
1239 (InteractiveShell.__init__): change threaded shells to not use the
1228 ipython crash handler. This was causing more problems than not,
1240 ipython crash handler. This was causing more problems than not,
1229 as exceptions in the main thread (GUI code, typically) would
1241 as exceptions in the main thread (GUI code, typically) would
1230 always show up as a 'crash', when they really weren't.
1242 always show up as a 'crash', when they really weren't.
1231
1243
1232 The colors and exception mode commands (%colors/%xmode) have been
1244 The colors and exception mode commands (%colors/%xmode) have been
1233 synchronized to also take this into account, so users can get
1245 synchronized to also take this into account, so users can get
1234 verbose exceptions for their threaded code as well. I also added
1246 verbose exceptions for their threaded code as well. I also added
1235 support for activating pdb inside this exception handler as well,
1247 support for activating pdb inside this exception handler as well,
1236 so now GUI authors can use IPython's enhanced pdb at runtime.
1248 so now GUI authors can use IPython's enhanced pdb at runtime.
1237
1249
1238 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1250 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1239 true by default, and add it to the shipped ipythonrc file. Since
1251 true by default, and add it to the shipped ipythonrc file. Since
1240 this asks the user before proceeding, I think it's OK to make it
1252 this asks the user before proceeding, I think it's OK to make it
1241 true by default.
1253 true by default.
1242
1254
1243 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1255 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1244 of the previous special-casing of input in the eval loop. I think
1256 of the previous special-casing of input in the eval loop. I think
1245 this is cleaner, as they really are commands and shouldn't have
1257 this is cleaner, as they really are commands and shouldn't have
1246 a special role in the middle of the core code.
1258 a special role in the middle of the core code.
1247
1259
1248 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1260 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1249
1261
1250 * IPython/iplib.py (edit_syntax_error): added support for
1262 * IPython/iplib.py (edit_syntax_error): added support for
1251 automatically reopening the editor if the file had a syntax error
1263 automatically reopening the editor if the file had a syntax error
1252 in it. Thanks to scottt who provided the patch at:
1264 in it. Thanks to scottt who provided the patch at:
1253 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1265 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1254 version committed).
1266 version committed).
1255
1267
1256 * IPython/iplib.py (handle_normal): add suport for multi-line
1268 * IPython/iplib.py (handle_normal): add suport for multi-line
1257 input with emtpy lines. This fixes
1269 input with emtpy lines. This fixes
1258 http://www.scipy.net/roundup/ipython/issue43 and a similar
1270 http://www.scipy.net/roundup/ipython/issue43 and a similar
1259 discussion on the user list.
1271 discussion on the user list.
1260
1272
1261 WARNING: a behavior change is necessarily introduced to support
1273 WARNING: a behavior change is necessarily introduced to support
1262 blank lines: now a single blank line with whitespace does NOT
1274 blank lines: now a single blank line with whitespace does NOT
1263 break the input loop, which means that when autoindent is on, by
1275 break the input loop, which means that when autoindent is on, by
1264 default hitting return on the next (indented) line does NOT exit.
1276 default hitting return on the next (indented) line does NOT exit.
1265
1277
1266 Instead, to exit a multiline input you can either have:
1278 Instead, to exit a multiline input you can either have:
1267
1279
1268 - TWO whitespace lines (just hit return again), or
1280 - TWO whitespace lines (just hit return again), or
1269 - a single whitespace line of a different length than provided
1281 - a single whitespace line of a different length than provided
1270 by the autoindent (add or remove a space).
1282 by the autoindent (add or remove a space).
1271
1283
1272 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1284 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1273 module to better organize all readline-related functionality.
1285 module to better organize all readline-related functionality.
1274 I've deleted FlexCompleter and put all completion clases here.
1286 I've deleted FlexCompleter and put all completion clases here.
1275
1287
1276 * IPython/iplib.py (raw_input): improve indentation management.
1288 * IPython/iplib.py (raw_input): improve indentation management.
1277 It is now possible to paste indented code with autoindent on, and
1289 It is now possible to paste indented code with autoindent on, and
1278 the code is interpreted correctly (though it still looks bad on
1290 the code is interpreted correctly (though it still looks bad on
1279 screen, due to the line-oriented nature of ipython).
1291 screen, due to the line-oriented nature of ipython).
1280 (MagicCompleter.complete): change behavior so that a TAB key on an
1292 (MagicCompleter.complete): change behavior so that a TAB key on an
1281 otherwise empty line actually inserts a tab, instead of completing
1293 otherwise empty line actually inserts a tab, instead of completing
1282 on the entire global namespace. This makes it easier to use the
1294 on the entire global namespace. This makes it easier to use the
1283 TAB key for indentation. After a request by Hans Meine
1295 TAB key for indentation. After a request by Hans Meine
1284 <hans_meine-AT-gmx.net>
1296 <hans_meine-AT-gmx.net>
1285 (_prefilter): add support so that typing plain 'exit' or 'quit'
1297 (_prefilter): add support so that typing plain 'exit' or 'quit'
1286 does a sensible thing. Originally I tried to deviate as little as
1298 does a sensible thing. Originally I tried to deviate as little as
1287 possible from the default python behavior, but even that one may
1299 possible from the default python behavior, but even that one may
1288 change in this direction (thread on python-dev to that effect).
1300 change in this direction (thread on python-dev to that effect).
1289 Regardless, ipython should do the right thing even if CPython's
1301 Regardless, ipython should do the right thing even if CPython's
1290 '>>>' prompt doesn't.
1302 '>>>' prompt doesn't.
1291 (InteractiveShell): removed subclassing code.InteractiveConsole
1303 (InteractiveShell): removed subclassing code.InteractiveConsole
1292 class. By now we'd overridden just about all of its methods: I've
1304 class. By now we'd overridden just about all of its methods: I've
1293 copied the remaining two over, and now ipython is a standalone
1305 copied the remaining two over, and now ipython is a standalone
1294 class. This will provide a clearer picture for the chainsaw
1306 class. This will provide a clearer picture for the chainsaw
1295 branch refactoring.
1307 branch refactoring.
1296
1308
1297 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1309 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1298
1310
1299 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1311 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1300 failures for objects which break when dir() is called on them.
1312 failures for objects which break when dir() is called on them.
1301
1313
1302 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1314 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1303 distinct local and global namespaces in the completer API. This
1315 distinct local and global namespaces in the completer API. This
1304 change allows us to properly handle completion with distinct
1316 change allows us to properly handle completion with distinct
1305 scopes, including in embedded instances (this had never really
1317 scopes, including in embedded instances (this had never really
1306 worked correctly).
1318 worked correctly).
1307
1319
1308 Note: this introduces a change in the constructor for
1320 Note: this introduces a change in the constructor for
1309 MagicCompleter, as a new global_namespace parameter is now the
1321 MagicCompleter, as a new global_namespace parameter is now the
1310 second argument (the others were bumped one position).
1322 second argument (the others were bumped one position).
1311
1323
1312 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1324 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1313
1325
1314 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1326 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1315 embedded instances (which can be done now thanks to Vivian's
1327 embedded instances (which can be done now thanks to Vivian's
1316 frame-handling fixes for pdb).
1328 frame-handling fixes for pdb).
1317 (InteractiveShell.__init__): Fix namespace handling problem in
1329 (InteractiveShell.__init__): Fix namespace handling problem in
1318 embedded instances. We were overwriting __main__ unconditionally,
1330 embedded instances. We were overwriting __main__ unconditionally,
1319 and this should only be done for 'full' (non-embedded) IPython;
1331 and this should only be done for 'full' (non-embedded) IPython;
1320 embedded instances must respect the caller's __main__. Thanks to
1332 embedded instances must respect the caller's __main__. Thanks to
1321 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1333 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1322
1334
1323 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1335 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1324
1336
1325 * setup.py: added download_url to setup(). This registers the
1337 * setup.py: added download_url to setup(). This registers the
1326 download address at PyPI, which is not only useful to humans
1338 download address at PyPI, which is not only useful to humans
1327 browsing the site, but is also picked up by setuptools (the Eggs
1339 browsing the site, but is also picked up by setuptools (the Eggs
1328 machinery). Thanks to Ville and R. Kern for the info/discussion
1340 machinery). Thanks to Ville and R. Kern for the info/discussion
1329 on this.
1341 on this.
1330
1342
1331 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1343 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1332
1344
1333 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1345 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1334 This brings a lot of nice functionality to the pdb mode, which now
1346 This brings a lot of nice functionality to the pdb mode, which now
1335 has tab-completion, syntax highlighting, and better stack handling
1347 has tab-completion, syntax highlighting, and better stack handling
1336 than before. Many thanks to Vivian De Smedt
1348 than before. Many thanks to Vivian De Smedt
1337 <vivian-AT-vdesmedt.com> for the original patches.
1349 <vivian-AT-vdesmedt.com> for the original patches.
1338
1350
1339 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1351 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1340
1352
1341 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1353 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1342 sequence to consistently accept the banner argument. The
1354 sequence to consistently accept the banner argument. The
1343 inconsistency was tripping SAGE, thanks to Gary Zablackis
1355 inconsistency was tripping SAGE, thanks to Gary Zablackis
1344 <gzabl-AT-yahoo.com> for the report.
1356 <gzabl-AT-yahoo.com> for the report.
1345
1357
1346 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1358 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1347
1359
1348 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1360 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1349 Fix bug where a naked 'alias' call in the ipythonrc file would
1361 Fix bug where a naked 'alias' call in the ipythonrc file would
1350 cause a crash. Bug reported by Jorgen Stenarson.
1362 cause a crash. Bug reported by Jorgen Stenarson.
1351
1363
1352 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1364 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1353
1365
1354 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1366 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1355 startup time.
1367 startup time.
1356
1368
1357 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1369 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1358 instances had introduced a bug with globals in normal code. Now
1370 instances had introduced a bug with globals in normal code. Now
1359 it's working in all cases.
1371 it's working in all cases.
1360
1372
1361 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1373 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1362 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1374 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1363 has been introduced to set the default case sensitivity of the
1375 has been introduced to set the default case sensitivity of the
1364 searches. Users can still select either mode at runtime on a
1376 searches. Users can still select either mode at runtime on a
1365 per-search basis.
1377 per-search basis.
1366
1378
1367 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1379 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1368
1380
1369 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1381 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1370 attributes in wildcard searches for subclasses. Modified version
1382 attributes in wildcard searches for subclasses. Modified version
1371 of a patch by Jorgen.
1383 of a patch by Jorgen.
1372
1384
1373 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1385 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1374
1386
1375 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1387 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1376 embedded instances. I added a user_global_ns attribute to the
1388 embedded instances. I added a user_global_ns attribute to the
1377 InteractiveShell class to handle this.
1389 InteractiveShell class to handle this.
1378
1390
1379 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1391 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1380
1392
1381 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1393 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1382 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1394 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1383 (reported under win32, but may happen also in other platforms).
1395 (reported under win32, but may happen also in other platforms).
1384 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1396 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1385
1397
1386 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1398 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1387
1399
1388 * IPython/Magic.py (magic_psearch): new support for wildcard
1400 * IPython/Magic.py (magic_psearch): new support for wildcard
1389 patterns. Now, typing ?a*b will list all names which begin with a
1401 patterns. Now, typing ?a*b will list all names which begin with a
1390 and end in b, for example. The %psearch magic has full
1402 and end in b, for example. The %psearch magic has full
1391 docstrings. Many thanks to JΓΆrgen Stenarson
1403 docstrings. Many thanks to JΓΆrgen Stenarson
1392 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1404 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1393 implementing this functionality.
1405 implementing this functionality.
1394
1406
1395 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1407 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1396
1408
1397 * Manual: fixed long-standing annoyance of double-dashes (as in
1409 * Manual: fixed long-standing annoyance of double-dashes (as in
1398 --prefix=~, for example) being stripped in the HTML version. This
1410 --prefix=~, for example) being stripped in the HTML version. This
1399 is a latex2html bug, but a workaround was provided. Many thanks
1411 is a latex2html bug, but a workaround was provided. Many thanks
1400 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1412 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1401 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1413 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1402 rolling. This seemingly small issue had tripped a number of users
1414 rolling. This seemingly small issue had tripped a number of users
1403 when first installing, so I'm glad to see it gone.
1415 when first installing, so I'm glad to see it gone.
1404
1416
1405 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1417 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1406
1418
1407 * IPython/Extensions/numeric_formats.py: fix missing import,
1419 * IPython/Extensions/numeric_formats.py: fix missing import,
1408 reported by Stephen Walton.
1420 reported by Stephen Walton.
1409
1421
1410 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1422 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1411
1423
1412 * IPython/demo.py: finish demo module, fully documented now.
1424 * IPython/demo.py: finish demo module, fully documented now.
1413
1425
1414 * IPython/genutils.py (file_read): simple little utility to read a
1426 * IPython/genutils.py (file_read): simple little utility to read a
1415 file and ensure it's closed afterwards.
1427 file and ensure it's closed afterwards.
1416
1428
1417 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1429 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1418
1430
1419 * IPython/demo.py (Demo.__init__): added support for individually
1431 * IPython/demo.py (Demo.__init__): added support for individually
1420 tagging blocks for automatic execution.
1432 tagging blocks for automatic execution.
1421
1433
1422 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1434 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1423 syntax-highlighted python sources, requested by John.
1435 syntax-highlighted python sources, requested by John.
1424
1436
1425 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1437 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1426
1438
1427 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1439 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1428 finishing.
1440 finishing.
1429
1441
1430 * IPython/genutils.py (shlex_split): moved from Magic to here,
1442 * IPython/genutils.py (shlex_split): moved from Magic to here,
1431 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1443 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1432
1444
1433 * IPython/demo.py (Demo.__init__): added support for silent
1445 * IPython/demo.py (Demo.__init__): added support for silent
1434 blocks, improved marks as regexps, docstrings written.
1446 blocks, improved marks as regexps, docstrings written.
1435 (Demo.__init__): better docstring, added support for sys.argv.
1447 (Demo.__init__): better docstring, added support for sys.argv.
1436
1448
1437 * IPython/genutils.py (marquee): little utility used by the demo
1449 * IPython/genutils.py (marquee): little utility used by the demo
1438 code, handy in general.
1450 code, handy in general.
1439
1451
1440 * IPython/demo.py (Demo.__init__): new class for interactive
1452 * IPython/demo.py (Demo.__init__): new class for interactive
1441 demos. Not documented yet, I just wrote it in a hurry for
1453 demos. Not documented yet, I just wrote it in a hurry for
1442 scipy'05. Will docstring later.
1454 scipy'05. Will docstring later.
1443
1455
1444 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1456 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1445
1457
1446 * IPython/Shell.py (sigint_handler): Drastic simplification which
1458 * IPython/Shell.py (sigint_handler): Drastic simplification which
1447 also seems to make Ctrl-C work correctly across threads! This is
1459 also seems to make Ctrl-C work correctly across threads! This is
1448 so simple, that I can't beleive I'd missed it before. Needs more
1460 so simple, that I can't beleive I'd missed it before. Needs more
1449 testing, though.
1461 testing, though.
1450 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1462 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1451 like this before...
1463 like this before...
1452
1464
1453 * IPython/genutils.py (get_home_dir): add protection against
1465 * IPython/genutils.py (get_home_dir): add protection against
1454 non-dirs in win32 registry.
1466 non-dirs in win32 registry.
1455
1467
1456 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1468 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1457 bug where dict was mutated while iterating (pysh crash).
1469 bug where dict was mutated while iterating (pysh crash).
1458
1470
1459 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1471 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1460
1472
1461 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1473 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1462 spurious newlines added by this routine. After a report by
1474 spurious newlines added by this routine. After a report by
1463 F. Mantegazza.
1475 F. Mantegazza.
1464
1476
1465 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1477 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1466
1478
1467 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1479 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1468 calls. These were a leftover from the GTK 1.x days, and can cause
1480 calls. These were a leftover from the GTK 1.x days, and can cause
1469 problems in certain cases (after a report by John Hunter).
1481 problems in certain cases (after a report by John Hunter).
1470
1482
1471 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1483 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1472 os.getcwd() fails at init time. Thanks to patch from David Remahl
1484 os.getcwd() fails at init time. Thanks to patch from David Remahl
1473 <chmod007-AT-mac.com>.
1485 <chmod007-AT-mac.com>.
1474 (InteractiveShell.__init__): prevent certain special magics from
1486 (InteractiveShell.__init__): prevent certain special magics from
1475 being shadowed by aliases. Closes
1487 being shadowed by aliases. Closes
1476 http://www.scipy.net/roundup/ipython/issue41.
1488 http://www.scipy.net/roundup/ipython/issue41.
1477
1489
1478 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1490 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1479
1491
1480 * IPython/iplib.py (InteractiveShell.complete): Added new
1492 * IPython/iplib.py (InteractiveShell.complete): Added new
1481 top-level completion method to expose the completion mechanism
1493 top-level completion method to expose the completion mechanism
1482 beyond readline-based environments.
1494 beyond readline-based environments.
1483
1495
1484 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1496 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1485
1497
1486 * tools/ipsvnc (svnversion): fix svnversion capture.
1498 * tools/ipsvnc (svnversion): fix svnversion capture.
1487
1499
1488 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1500 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1489 attribute to self, which was missing. Before, it was set by a
1501 attribute to self, which was missing. Before, it was set by a
1490 routine which in certain cases wasn't being called, so the
1502 routine which in certain cases wasn't being called, so the
1491 instance could end up missing the attribute. This caused a crash.
1503 instance could end up missing the attribute. This caused a crash.
1492 Closes http://www.scipy.net/roundup/ipython/issue40.
1504 Closes http://www.scipy.net/roundup/ipython/issue40.
1493
1505
1494 2005-08-16 Fernando Perez <fperez@colorado.edu>
1506 2005-08-16 Fernando Perez <fperez@colorado.edu>
1495
1507
1496 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1508 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1497 contains non-string attribute. Closes
1509 contains non-string attribute. Closes
1498 http://www.scipy.net/roundup/ipython/issue38.
1510 http://www.scipy.net/roundup/ipython/issue38.
1499
1511
1500 2005-08-14 Fernando Perez <fperez@colorado.edu>
1512 2005-08-14 Fernando Perez <fperez@colorado.edu>
1501
1513
1502 * tools/ipsvnc: Minor improvements, to add changeset info.
1514 * tools/ipsvnc: Minor improvements, to add changeset info.
1503
1515
1504 2005-08-12 Fernando Perez <fperez@colorado.edu>
1516 2005-08-12 Fernando Perez <fperez@colorado.edu>
1505
1517
1506 * IPython/iplib.py (runsource): remove self.code_to_run_src
1518 * IPython/iplib.py (runsource): remove self.code_to_run_src
1507 attribute. I realized this is nothing more than
1519 attribute. I realized this is nothing more than
1508 '\n'.join(self.buffer), and having the same data in two different
1520 '\n'.join(self.buffer), and having the same data in two different
1509 places is just asking for synchronization bugs. This may impact
1521 places is just asking for synchronization bugs. This may impact
1510 people who have custom exception handlers, so I need to warn
1522 people who have custom exception handlers, so I need to warn
1511 ipython-dev about it (F. Mantegazza may use them).
1523 ipython-dev about it (F. Mantegazza may use them).
1512
1524
1513 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1525 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1514
1526
1515 * IPython/genutils.py: fix 2.2 compatibility (generators)
1527 * IPython/genutils.py: fix 2.2 compatibility (generators)
1516
1528
1517 2005-07-18 Fernando Perez <fperez@colorado.edu>
1529 2005-07-18 Fernando Perez <fperez@colorado.edu>
1518
1530
1519 * IPython/genutils.py (get_home_dir): fix to help users with
1531 * IPython/genutils.py (get_home_dir): fix to help users with
1520 invalid $HOME under win32.
1532 invalid $HOME under win32.
1521
1533
1522 2005-07-17 Fernando Perez <fperez@colorado.edu>
1534 2005-07-17 Fernando Perez <fperez@colorado.edu>
1523
1535
1524 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1536 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1525 some old hacks and clean up a bit other routines; code should be
1537 some old hacks and clean up a bit other routines; code should be
1526 simpler and a bit faster.
1538 simpler and a bit faster.
1527
1539
1528 * IPython/iplib.py (interact): removed some last-resort attempts
1540 * IPython/iplib.py (interact): removed some last-resort attempts
1529 to survive broken stdout/stderr. That code was only making it
1541 to survive broken stdout/stderr. That code was only making it
1530 harder to abstract out the i/o (necessary for gui integration),
1542 harder to abstract out the i/o (necessary for gui integration),
1531 and the crashes it could prevent were extremely rare in practice
1543 and the crashes it could prevent were extremely rare in practice
1532 (besides being fully user-induced in a pretty violent manner).
1544 (besides being fully user-induced in a pretty violent manner).
1533
1545
1534 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1546 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1535 Nothing major yet, but the code is simpler to read; this should
1547 Nothing major yet, but the code is simpler to read; this should
1536 make it easier to do more serious modifications in the future.
1548 make it easier to do more serious modifications in the future.
1537
1549
1538 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1550 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1539 which broke in .15 (thanks to a report by Ville).
1551 which broke in .15 (thanks to a report by Ville).
1540
1552
1541 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1553 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1542 be quite correct, I know next to nothing about unicode). This
1554 be quite correct, I know next to nothing about unicode). This
1543 will allow unicode strings to be used in prompts, amongst other
1555 will allow unicode strings to be used in prompts, amongst other
1544 cases. It also will prevent ipython from crashing when unicode
1556 cases. It also will prevent ipython from crashing when unicode
1545 shows up unexpectedly in many places. If ascii encoding fails, we
1557 shows up unexpectedly in many places. If ascii encoding fails, we
1546 assume utf_8. Currently the encoding is not a user-visible
1558 assume utf_8. Currently the encoding is not a user-visible
1547 setting, though it could be made so if there is demand for it.
1559 setting, though it could be made so if there is demand for it.
1548
1560
1549 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1561 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1550
1562
1551 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1563 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1552
1564
1553 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1565 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1554
1566
1555 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1567 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1556 code can work transparently for 2.2/2.3.
1568 code can work transparently for 2.2/2.3.
1557
1569
1558 2005-07-16 Fernando Perez <fperez@colorado.edu>
1570 2005-07-16 Fernando Perez <fperez@colorado.edu>
1559
1571
1560 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1572 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1561 out of the color scheme table used for coloring exception
1573 out of the color scheme table used for coloring exception
1562 tracebacks. This allows user code to add new schemes at runtime.
1574 tracebacks. This allows user code to add new schemes at runtime.
1563 This is a minimally modified version of the patch at
1575 This is a minimally modified version of the patch at
1564 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1576 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1565 for the contribution.
1577 for the contribution.
1566
1578
1567 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1579 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1568 slightly modified version of the patch in
1580 slightly modified version of the patch in
1569 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1581 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1570 to remove the previous try/except solution (which was costlier).
1582 to remove the previous try/except solution (which was costlier).
1571 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1583 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1572
1584
1573 2005-06-08 Fernando Perez <fperez@colorado.edu>
1585 2005-06-08 Fernando Perez <fperez@colorado.edu>
1574
1586
1575 * IPython/iplib.py (write/write_err): Add methods to abstract all
1587 * IPython/iplib.py (write/write_err): Add methods to abstract all
1576 I/O a bit more.
1588 I/O a bit more.
1577
1589
1578 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1590 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1579 warning, reported by Aric Hagberg, fix by JD Hunter.
1591 warning, reported by Aric Hagberg, fix by JD Hunter.
1580
1592
1581 2005-06-02 *** Released version 0.6.15
1593 2005-06-02 *** Released version 0.6.15
1582
1594
1583 2005-06-01 Fernando Perez <fperez@colorado.edu>
1595 2005-06-01 Fernando Perez <fperez@colorado.edu>
1584
1596
1585 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1597 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1586 tab-completion of filenames within open-quoted strings. Note that
1598 tab-completion of filenames within open-quoted strings. Note that
1587 this requires that in ~/.ipython/ipythonrc, users change the
1599 this requires that in ~/.ipython/ipythonrc, users change the
1588 readline delimiters configuration to read:
1600 readline delimiters configuration to read:
1589
1601
1590 readline_remove_delims -/~
1602 readline_remove_delims -/~
1591
1603
1592
1604
1593 2005-05-31 *** Released version 0.6.14
1605 2005-05-31 *** Released version 0.6.14
1594
1606
1595 2005-05-29 Fernando Perez <fperez@colorado.edu>
1607 2005-05-29 Fernando Perez <fperez@colorado.edu>
1596
1608
1597 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1609 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1598 with files not on the filesystem. Reported by Eliyahu Sandler
1610 with files not on the filesystem. Reported by Eliyahu Sandler
1599 <eli@gondolin.net>
1611 <eli@gondolin.net>
1600
1612
1601 2005-05-22 Fernando Perez <fperez@colorado.edu>
1613 2005-05-22 Fernando Perez <fperez@colorado.edu>
1602
1614
1603 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1615 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1604 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1616 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1605
1617
1606 2005-05-19 Fernando Perez <fperez@colorado.edu>
1618 2005-05-19 Fernando Perez <fperez@colorado.edu>
1607
1619
1608 * IPython/iplib.py (safe_execfile): close a file which could be
1620 * IPython/iplib.py (safe_execfile): close a file which could be
1609 left open (causing problems in win32, which locks open files).
1621 left open (causing problems in win32, which locks open files).
1610 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1622 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1611
1623
1612 2005-05-18 Fernando Perez <fperez@colorado.edu>
1624 2005-05-18 Fernando Perez <fperez@colorado.edu>
1613
1625
1614 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1626 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1615 keyword arguments correctly to safe_execfile().
1627 keyword arguments correctly to safe_execfile().
1616
1628
1617 2005-05-13 Fernando Perez <fperez@colorado.edu>
1629 2005-05-13 Fernando Perez <fperez@colorado.edu>
1618
1630
1619 * ipython.1: Added info about Qt to manpage, and threads warning
1631 * ipython.1: Added info about Qt to manpage, and threads warning
1620 to usage page (invoked with --help).
1632 to usage page (invoked with --help).
1621
1633
1622 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1634 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1623 new matcher (it goes at the end of the priority list) to do
1635 new matcher (it goes at the end of the priority list) to do
1624 tab-completion on named function arguments. Submitted by George
1636 tab-completion on named function arguments. Submitted by George
1625 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1637 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1626 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1638 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1627 for more details.
1639 for more details.
1628
1640
1629 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1641 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1630 SystemExit exceptions in the script being run. Thanks to a report
1642 SystemExit exceptions in the script being run. Thanks to a report
1631 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1643 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1632 producing very annoying behavior when running unit tests.
1644 producing very annoying behavior when running unit tests.
1633
1645
1634 2005-05-12 Fernando Perez <fperez@colorado.edu>
1646 2005-05-12 Fernando Perez <fperez@colorado.edu>
1635
1647
1636 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1648 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1637 which I'd broken (again) due to a changed regexp. In the process,
1649 which I'd broken (again) due to a changed regexp. In the process,
1638 added ';' as an escape to auto-quote the whole line without
1650 added ';' as an escape to auto-quote the whole line without
1639 splitting its arguments. Thanks to a report by Jerry McRae
1651 splitting its arguments. Thanks to a report by Jerry McRae
1640 <qrs0xyc02-AT-sneakemail.com>.
1652 <qrs0xyc02-AT-sneakemail.com>.
1641
1653
1642 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1654 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1643 possible crashes caused by a TokenError. Reported by Ed Schofield
1655 possible crashes caused by a TokenError. Reported by Ed Schofield
1644 <schofield-AT-ftw.at>.
1656 <schofield-AT-ftw.at>.
1645
1657
1646 2005-05-06 Fernando Perez <fperez@colorado.edu>
1658 2005-05-06 Fernando Perez <fperez@colorado.edu>
1647
1659
1648 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1660 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1649
1661
1650 2005-04-29 Fernando Perez <fperez@colorado.edu>
1662 2005-04-29 Fernando Perez <fperez@colorado.edu>
1651
1663
1652 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1664 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1653 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1665 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1654 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1666 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1655 which provides support for Qt interactive usage (similar to the
1667 which provides support for Qt interactive usage (similar to the
1656 existing one for WX and GTK). This had been often requested.
1668 existing one for WX and GTK). This had been often requested.
1657
1669
1658 2005-04-14 *** Released version 0.6.13
1670 2005-04-14 *** Released version 0.6.13
1659
1671
1660 2005-04-08 Fernando Perez <fperez@colorado.edu>
1672 2005-04-08 Fernando Perez <fperez@colorado.edu>
1661
1673
1662 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1674 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1663 from _ofind, which gets called on almost every input line. Now,
1675 from _ofind, which gets called on almost every input line. Now,
1664 we only try to get docstrings if they are actually going to be
1676 we only try to get docstrings if they are actually going to be
1665 used (the overhead of fetching unnecessary docstrings can be
1677 used (the overhead of fetching unnecessary docstrings can be
1666 noticeable for certain objects, such as Pyro proxies).
1678 noticeable for certain objects, such as Pyro proxies).
1667
1679
1668 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1680 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1669 for completers. For some reason I had been passing them the state
1681 for completers. For some reason I had been passing them the state
1670 variable, which completers never actually need, and was in
1682 variable, which completers never actually need, and was in
1671 conflict with the rlcompleter API. Custom completers ONLY need to
1683 conflict with the rlcompleter API. Custom completers ONLY need to
1672 take the text parameter.
1684 take the text parameter.
1673
1685
1674 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1686 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1675 work correctly in pysh. I've also moved all the logic which used
1687 work correctly in pysh. I've also moved all the logic which used
1676 to be in pysh.py here, which will prevent problems with future
1688 to be in pysh.py here, which will prevent problems with future
1677 upgrades. However, this time I must warn users to update their
1689 upgrades. However, this time I must warn users to update their
1678 pysh profile to include the line
1690 pysh profile to include the line
1679
1691
1680 import_all IPython.Extensions.InterpreterExec
1692 import_all IPython.Extensions.InterpreterExec
1681
1693
1682 because otherwise things won't work for them. They MUST also
1694 because otherwise things won't work for them. They MUST also
1683 delete pysh.py and the line
1695 delete pysh.py and the line
1684
1696
1685 execfile pysh.py
1697 execfile pysh.py
1686
1698
1687 from their ipythonrc-pysh.
1699 from their ipythonrc-pysh.
1688
1700
1689 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1701 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1690 robust in the face of objects whose dir() returns non-strings
1702 robust in the face of objects whose dir() returns non-strings
1691 (which it shouldn't, but some broken libs like ITK do). Thanks to
1703 (which it shouldn't, but some broken libs like ITK do). Thanks to
1692 a patch by John Hunter (implemented differently, though). Also
1704 a patch by John Hunter (implemented differently, though). Also
1693 minor improvements by using .extend instead of + on lists.
1705 minor improvements by using .extend instead of + on lists.
1694
1706
1695 * pysh.py:
1707 * pysh.py:
1696
1708
1697 2005-04-06 Fernando Perez <fperez@colorado.edu>
1709 2005-04-06 Fernando Perez <fperez@colorado.edu>
1698
1710
1699 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1711 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1700 by default, so that all users benefit from it. Those who don't
1712 by default, so that all users benefit from it. Those who don't
1701 want it can still turn it off.
1713 want it can still turn it off.
1702
1714
1703 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1715 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1704 config file, I'd forgotten about this, so users were getting it
1716 config file, I'd forgotten about this, so users were getting it
1705 off by default.
1717 off by default.
1706
1718
1707 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1719 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1708 consistency. Now magics can be called in multiline statements,
1720 consistency. Now magics can be called in multiline statements,
1709 and python variables can be expanded in magic calls via $var.
1721 and python variables can be expanded in magic calls via $var.
1710 This makes the magic system behave just like aliases or !system
1722 This makes the magic system behave just like aliases or !system
1711 calls.
1723 calls.
1712
1724
1713 2005-03-28 Fernando Perez <fperez@colorado.edu>
1725 2005-03-28 Fernando Perez <fperez@colorado.edu>
1714
1726
1715 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1727 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1716 expensive string additions for building command. Add support for
1728 expensive string additions for building command. Add support for
1717 trailing ';' when autocall is used.
1729 trailing ';' when autocall is used.
1718
1730
1719 2005-03-26 Fernando Perez <fperez@colorado.edu>
1731 2005-03-26 Fernando Perez <fperez@colorado.edu>
1720
1732
1721 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1733 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1722 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1734 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1723 ipython.el robust against prompts with any number of spaces
1735 ipython.el robust against prompts with any number of spaces
1724 (including 0) after the ':' character.
1736 (including 0) after the ':' character.
1725
1737
1726 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1738 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1727 continuation prompt, which misled users to think the line was
1739 continuation prompt, which misled users to think the line was
1728 already indented. Closes debian Bug#300847, reported to me by
1740 already indented. Closes debian Bug#300847, reported to me by
1729 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1741 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1730
1742
1731 2005-03-23 Fernando Perez <fperez@colorado.edu>
1743 2005-03-23 Fernando Perez <fperez@colorado.edu>
1732
1744
1733 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1745 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1734 properly aligned if they have embedded newlines.
1746 properly aligned if they have embedded newlines.
1735
1747
1736 * IPython/iplib.py (runlines): Add a public method to expose
1748 * IPython/iplib.py (runlines): Add a public method to expose
1737 IPython's code execution machinery, so that users can run strings
1749 IPython's code execution machinery, so that users can run strings
1738 as if they had been typed at the prompt interactively.
1750 as if they had been typed at the prompt interactively.
1739 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1751 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1740 methods which can call the system shell, but with python variable
1752 methods which can call the system shell, but with python variable
1741 expansion. The three such methods are: __IPYTHON__.system,
1753 expansion. The three such methods are: __IPYTHON__.system,
1742 .getoutput and .getoutputerror. These need to be documented in a
1754 .getoutput and .getoutputerror. These need to be documented in a
1743 'public API' section (to be written) of the manual.
1755 'public API' section (to be written) of the manual.
1744
1756
1745 2005-03-20 Fernando Perez <fperez@colorado.edu>
1757 2005-03-20 Fernando Perez <fperez@colorado.edu>
1746
1758
1747 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1759 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1748 for custom exception handling. This is quite powerful, and it
1760 for custom exception handling. This is quite powerful, and it
1749 allows for user-installable exception handlers which can trap
1761 allows for user-installable exception handlers which can trap
1750 custom exceptions at runtime and treat them separately from
1762 custom exceptions at runtime and treat them separately from
1751 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1763 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1752 Mantegazza <mantegazza-AT-ill.fr>.
1764 Mantegazza <mantegazza-AT-ill.fr>.
1753 (InteractiveShell.set_custom_completer): public API function to
1765 (InteractiveShell.set_custom_completer): public API function to
1754 add new completers at runtime.
1766 add new completers at runtime.
1755
1767
1756 2005-03-19 Fernando Perez <fperez@colorado.edu>
1768 2005-03-19 Fernando Perez <fperez@colorado.edu>
1757
1769
1758 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1770 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1759 allow objects which provide their docstrings via non-standard
1771 allow objects which provide their docstrings via non-standard
1760 mechanisms (like Pyro proxies) to still be inspected by ipython's
1772 mechanisms (like Pyro proxies) to still be inspected by ipython's
1761 ? system.
1773 ? system.
1762
1774
1763 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1775 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1764 automatic capture system. I tried quite hard to make it work
1776 automatic capture system. I tried quite hard to make it work
1765 reliably, and simply failed. I tried many combinations with the
1777 reliably, and simply failed. I tried many combinations with the
1766 subprocess module, but eventually nothing worked in all needed
1778 subprocess module, but eventually nothing worked in all needed
1767 cases (not blocking stdin for the child, duplicating stdout
1779 cases (not blocking stdin for the child, duplicating stdout
1768 without blocking, etc). The new %sc/%sx still do capture to these
1780 without blocking, etc). The new %sc/%sx still do capture to these
1769 magical list/string objects which make shell use much more
1781 magical list/string objects which make shell use much more
1770 conveninent, so not all is lost.
1782 conveninent, so not all is lost.
1771
1783
1772 XXX - FIX MANUAL for the change above!
1784 XXX - FIX MANUAL for the change above!
1773
1785
1774 (runsource): I copied code.py's runsource() into ipython to modify
1786 (runsource): I copied code.py's runsource() into ipython to modify
1775 it a bit. Now the code object and source to be executed are
1787 it a bit. Now the code object and source to be executed are
1776 stored in ipython. This makes this info accessible to third-party
1788 stored in ipython. This makes this info accessible to third-party
1777 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1789 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1778 Mantegazza <mantegazza-AT-ill.fr>.
1790 Mantegazza <mantegazza-AT-ill.fr>.
1779
1791
1780 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1792 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1781 history-search via readline (like C-p/C-n). I'd wanted this for a
1793 history-search via readline (like C-p/C-n). I'd wanted this for a
1782 long time, but only recently found out how to do it. For users
1794 long time, but only recently found out how to do it. For users
1783 who already have their ipythonrc files made and want this, just
1795 who already have their ipythonrc files made and want this, just
1784 add:
1796 add:
1785
1797
1786 readline_parse_and_bind "\e[A": history-search-backward
1798 readline_parse_and_bind "\e[A": history-search-backward
1787 readline_parse_and_bind "\e[B": history-search-forward
1799 readline_parse_and_bind "\e[B": history-search-forward
1788
1800
1789 2005-03-18 Fernando Perez <fperez@colorado.edu>
1801 2005-03-18 Fernando Perez <fperez@colorado.edu>
1790
1802
1791 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1803 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1792 LSString and SList classes which allow transparent conversions
1804 LSString and SList classes which allow transparent conversions
1793 between list mode and whitespace-separated string.
1805 between list mode and whitespace-separated string.
1794 (magic_r): Fix recursion problem in %r.
1806 (magic_r): Fix recursion problem in %r.
1795
1807
1796 * IPython/genutils.py (LSString): New class to be used for
1808 * IPython/genutils.py (LSString): New class to be used for
1797 automatic storage of the results of all alias/system calls in _o
1809 automatic storage of the results of all alias/system calls in _o
1798 and _e (stdout/err). These provide a .l/.list attribute which
1810 and _e (stdout/err). These provide a .l/.list attribute which
1799 does automatic splitting on newlines. This means that for most
1811 does automatic splitting on newlines. This means that for most
1800 uses, you'll never need to do capturing of output with %sc/%sx
1812 uses, you'll never need to do capturing of output with %sc/%sx
1801 anymore, since ipython keeps this always done for you. Note that
1813 anymore, since ipython keeps this always done for you. Note that
1802 only the LAST results are stored, the _o/e variables are
1814 only the LAST results are stored, the _o/e variables are
1803 overwritten on each call. If you need to save their contents
1815 overwritten on each call. If you need to save their contents
1804 further, simply bind them to any other name.
1816 further, simply bind them to any other name.
1805
1817
1806 2005-03-17 Fernando Perez <fperez@colorado.edu>
1818 2005-03-17 Fernando Perez <fperez@colorado.edu>
1807
1819
1808 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1820 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1809 prompt namespace handling.
1821 prompt namespace handling.
1810
1822
1811 2005-03-16 Fernando Perez <fperez@colorado.edu>
1823 2005-03-16 Fernando Perez <fperez@colorado.edu>
1812
1824
1813 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1825 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1814 classic prompts to be '>>> ' (final space was missing, and it
1826 classic prompts to be '>>> ' (final space was missing, and it
1815 trips the emacs python mode).
1827 trips the emacs python mode).
1816 (BasePrompt.__str__): Added safe support for dynamic prompt
1828 (BasePrompt.__str__): Added safe support for dynamic prompt
1817 strings. Now you can set your prompt string to be '$x', and the
1829 strings. Now you can set your prompt string to be '$x', and the
1818 value of x will be printed from your interactive namespace. The
1830 value of x will be printed from your interactive namespace. The
1819 interpolation syntax includes the full Itpl support, so
1831 interpolation syntax includes the full Itpl support, so
1820 ${foo()+x+bar()} is a valid prompt string now, and the function
1832 ${foo()+x+bar()} is a valid prompt string now, and the function
1821 calls will be made at runtime.
1833 calls will be made at runtime.
1822
1834
1823 2005-03-15 Fernando Perez <fperez@colorado.edu>
1835 2005-03-15 Fernando Perez <fperez@colorado.edu>
1824
1836
1825 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1837 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1826 avoid name clashes in pylab. %hist still works, it just forwards
1838 avoid name clashes in pylab. %hist still works, it just forwards
1827 the call to %history.
1839 the call to %history.
1828
1840
1829 2005-03-02 *** Released version 0.6.12
1841 2005-03-02 *** Released version 0.6.12
1830
1842
1831 2005-03-02 Fernando Perez <fperez@colorado.edu>
1843 2005-03-02 Fernando Perez <fperez@colorado.edu>
1832
1844
1833 * IPython/iplib.py (handle_magic): log magic calls properly as
1845 * IPython/iplib.py (handle_magic): log magic calls properly as
1834 ipmagic() function calls.
1846 ipmagic() function calls.
1835
1847
1836 * IPython/Magic.py (magic_time): Improved %time to support
1848 * IPython/Magic.py (magic_time): Improved %time to support
1837 statements and provide wall-clock as well as CPU time.
1849 statements and provide wall-clock as well as CPU time.
1838
1850
1839 2005-02-27 Fernando Perez <fperez@colorado.edu>
1851 2005-02-27 Fernando Perez <fperez@colorado.edu>
1840
1852
1841 * IPython/hooks.py: New hooks module, to expose user-modifiable
1853 * IPython/hooks.py: New hooks module, to expose user-modifiable
1842 IPython functionality in a clean manner. For now only the editor
1854 IPython functionality in a clean manner. For now only the editor
1843 hook is actually written, and other thigns which I intend to turn
1855 hook is actually written, and other thigns which I intend to turn
1844 into proper hooks aren't yet there. The display and prefilter
1856 into proper hooks aren't yet there. The display and prefilter
1845 stuff, for example, should be hooks. But at least now the
1857 stuff, for example, should be hooks. But at least now the
1846 framework is in place, and the rest can be moved here with more
1858 framework is in place, and the rest can be moved here with more
1847 time later. IPython had had a .hooks variable for a long time for
1859 time later. IPython had had a .hooks variable for a long time for
1848 this purpose, but I'd never actually used it for anything.
1860 this purpose, but I'd never actually used it for anything.
1849
1861
1850 2005-02-26 Fernando Perez <fperez@colorado.edu>
1862 2005-02-26 Fernando Perez <fperez@colorado.edu>
1851
1863
1852 * IPython/ipmaker.py (make_IPython): make the default ipython
1864 * IPython/ipmaker.py (make_IPython): make the default ipython
1853 directory be called _ipython under win32, to follow more the
1865 directory be called _ipython under win32, to follow more the
1854 naming peculiarities of that platform (where buggy software like
1866 naming peculiarities of that platform (where buggy software like
1855 Visual Sourcesafe breaks with .named directories). Reported by
1867 Visual Sourcesafe breaks with .named directories). Reported by
1856 Ville Vainio.
1868 Ville Vainio.
1857
1869
1858 2005-02-23 Fernando Perez <fperez@colorado.edu>
1870 2005-02-23 Fernando Perez <fperez@colorado.edu>
1859
1871
1860 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1872 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1861 auto_aliases for win32 which were causing problems. Users can
1873 auto_aliases for win32 which were causing problems. Users can
1862 define the ones they personally like.
1874 define the ones they personally like.
1863
1875
1864 2005-02-21 Fernando Perez <fperez@colorado.edu>
1876 2005-02-21 Fernando Perez <fperez@colorado.edu>
1865
1877
1866 * IPython/Magic.py (magic_time): new magic to time execution of
1878 * IPython/Magic.py (magic_time): new magic to time execution of
1867 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1879 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1868
1880
1869 2005-02-19 Fernando Perez <fperez@colorado.edu>
1881 2005-02-19 Fernando Perez <fperez@colorado.edu>
1870
1882
1871 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1883 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1872 into keys (for prompts, for example).
1884 into keys (for prompts, for example).
1873
1885
1874 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1886 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1875 prompts in case users want them. This introduces a small behavior
1887 prompts in case users want them. This introduces a small behavior
1876 change: ipython does not automatically add a space to all prompts
1888 change: ipython does not automatically add a space to all prompts
1877 anymore. To get the old prompts with a space, users should add it
1889 anymore. To get the old prompts with a space, users should add it
1878 manually to their ipythonrc file, so for example prompt_in1 should
1890 manually to their ipythonrc file, so for example prompt_in1 should
1879 now read 'In [\#]: ' instead of 'In [\#]:'.
1891 now read 'In [\#]: ' instead of 'In [\#]:'.
1880 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1892 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1881 file) to control left-padding of secondary prompts.
1893 file) to control left-padding of secondary prompts.
1882
1894
1883 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1895 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1884 the profiler can't be imported. Fix for Debian, which removed
1896 the profiler can't be imported. Fix for Debian, which removed
1885 profile.py because of License issues. I applied a slightly
1897 profile.py because of License issues. I applied a slightly
1886 modified version of the original Debian patch at
1898 modified version of the original Debian patch at
1887 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1899 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1888
1900
1889 2005-02-17 Fernando Perez <fperez@colorado.edu>
1901 2005-02-17 Fernando Perez <fperez@colorado.edu>
1890
1902
1891 * IPython/genutils.py (native_line_ends): Fix bug which would
1903 * IPython/genutils.py (native_line_ends): Fix bug which would
1892 cause improper line-ends under win32 b/c I was not opening files
1904 cause improper line-ends under win32 b/c I was not opening files
1893 in binary mode. Bug report and fix thanks to Ville.
1905 in binary mode. Bug report and fix thanks to Ville.
1894
1906
1895 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1907 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1896 trying to catch spurious foo[1] autocalls. My fix actually broke
1908 trying to catch spurious foo[1] autocalls. My fix actually broke
1897 ',/' autoquote/call with explicit escape (bad regexp).
1909 ',/' autoquote/call with explicit escape (bad regexp).
1898
1910
1899 2005-02-15 *** Released version 0.6.11
1911 2005-02-15 *** Released version 0.6.11
1900
1912
1901 2005-02-14 Fernando Perez <fperez@colorado.edu>
1913 2005-02-14 Fernando Perez <fperez@colorado.edu>
1902
1914
1903 * IPython/background_jobs.py: New background job management
1915 * IPython/background_jobs.py: New background job management
1904 subsystem. This is implemented via a new set of classes, and
1916 subsystem. This is implemented via a new set of classes, and
1905 IPython now provides a builtin 'jobs' object for background job
1917 IPython now provides a builtin 'jobs' object for background job
1906 execution. A convenience %bg magic serves as a lightweight
1918 execution. A convenience %bg magic serves as a lightweight
1907 frontend for starting the more common type of calls. This was
1919 frontend for starting the more common type of calls. This was
1908 inspired by discussions with B. Granger and the BackgroundCommand
1920 inspired by discussions with B. Granger and the BackgroundCommand
1909 class described in the book Python Scripting for Computational
1921 class described in the book Python Scripting for Computational
1910 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1922 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1911 (although ultimately no code from this text was used, as IPython's
1923 (although ultimately no code from this text was used, as IPython's
1912 system is a separate implementation).
1924 system is a separate implementation).
1913
1925
1914 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1926 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1915 to control the completion of single/double underscore names
1927 to control the completion of single/double underscore names
1916 separately. As documented in the example ipytonrc file, the
1928 separately. As documented in the example ipytonrc file, the
1917 readline_omit__names variable can now be set to 2, to omit even
1929 readline_omit__names variable can now be set to 2, to omit even
1918 single underscore names. Thanks to a patch by Brian Wong
1930 single underscore names. Thanks to a patch by Brian Wong
1919 <BrianWong-AT-AirgoNetworks.Com>.
1931 <BrianWong-AT-AirgoNetworks.Com>.
1920 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1932 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1921 be autocalled as foo([1]) if foo were callable. A problem for
1933 be autocalled as foo([1]) if foo were callable. A problem for
1922 things which are both callable and implement __getitem__.
1934 things which are both callable and implement __getitem__.
1923 (init_readline): Fix autoindentation for win32. Thanks to a patch
1935 (init_readline): Fix autoindentation for win32. Thanks to a patch
1924 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1936 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1925
1937
1926 2005-02-12 Fernando Perez <fperez@colorado.edu>
1938 2005-02-12 Fernando Perez <fperez@colorado.edu>
1927
1939
1928 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1940 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1929 which I had written long ago to sort out user error messages which
1941 which I had written long ago to sort out user error messages which
1930 may occur during startup. This seemed like a good idea initially,
1942 may occur during startup. This seemed like a good idea initially,
1931 but it has proven a disaster in retrospect. I don't want to
1943 but it has proven a disaster in retrospect. I don't want to
1932 change much code for now, so my fix is to set the internal 'debug'
1944 change much code for now, so my fix is to set the internal 'debug'
1933 flag to true everywhere, whose only job was precisely to control
1945 flag to true everywhere, whose only job was precisely to control
1934 this subsystem. This closes issue 28 (as well as avoiding all
1946 this subsystem. This closes issue 28 (as well as avoiding all
1935 sorts of strange hangups which occur from time to time).
1947 sorts of strange hangups which occur from time to time).
1936
1948
1937 2005-02-07 Fernando Perez <fperez@colorado.edu>
1949 2005-02-07 Fernando Perez <fperez@colorado.edu>
1938
1950
1939 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1951 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1940 previous call produced a syntax error.
1952 previous call produced a syntax error.
1941
1953
1942 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1954 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1943 classes without constructor.
1955 classes without constructor.
1944
1956
1945 2005-02-06 Fernando Perez <fperez@colorado.edu>
1957 2005-02-06 Fernando Perez <fperez@colorado.edu>
1946
1958
1947 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1959 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1948 completions with the results of each matcher, so we return results
1960 completions with the results of each matcher, so we return results
1949 to the user from all namespaces. This breaks with ipython
1961 to the user from all namespaces. This breaks with ipython
1950 tradition, but I think it's a nicer behavior. Now you get all
1962 tradition, but I think it's a nicer behavior. Now you get all
1951 possible completions listed, from all possible namespaces (python,
1963 possible completions listed, from all possible namespaces (python,
1952 filesystem, magics...) After a request by John Hunter
1964 filesystem, magics...) After a request by John Hunter
1953 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1965 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1954
1966
1955 2005-02-05 Fernando Perez <fperez@colorado.edu>
1967 2005-02-05 Fernando Perez <fperez@colorado.edu>
1956
1968
1957 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1969 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1958 the call had quote characters in it (the quotes were stripped).
1970 the call had quote characters in it (the quotes were stripped).
1959
1971
1960 2005-01-31 Fernando Perez <fperez@colorado.edu>
1972 2005-01-31 Fernando Perez <fperez@colorado.edu>
1961
1973
1962 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1974 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1963 Itpl.itpl() to make the code more robust against psyco
1975 Itpl.itpl() to make the code more robust against psyco
1964 optimizations.
1976 optimizations.
1965
1977
1966 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1978 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1967 of causing an exception. Quicker, cleaner.
1979 of causing an exception. Quicker, cleaner.
1968
1980
1969 2005-01-28 Fernando Perez <fperez@colorado.edu>
1981 2005-01-28 Fernando Perez <fperez@colorado.edu>
1970
1982
1971 * scripts/ipython_win_post_install.py (install): hardcode
1983 * scripts/ipython_win_post_install.py (install): hardcode
1972 sys.prefix+'python.exe' as the executable path. It turns out that
1984 sys.prefix+'python.exe' as the executable path. It turns out that
1973 during the post-installation run, sys.executable resolves to the
1985 during the post-installation run, sys.executable resolves to the
1974 name of the binary installer! I should report this as a distutils
1986 name of the binary installer! I should report this as a distutils
1975 bug, I think. I updated the .10 release with this tiny fix, to
1987 bug, I think. I updated the .10 release with this tiny fix, to
1976 avoid annoying the lists further.
1988 avoid annoying the lists further.
1977
1989
1978 2005-01-27 *** Released version 0.6.10
1990 2005-01-27 *** Released version 0.6.10
1979
1991
1980 2005-01-27 Fernando Perez <fperez@colorado.edu>
1992 2005-01-27 Fernando Perez <fperez@colorado.edu>
1981
1993
1982 * IPython/numutils.py (norm): Added 'inf' as optional name for
1994 * IPython/numutils.py (norm): Added 'inf' as optional name for
1983 L-infinity norm, included references to mathworld.com for vector
1995 L-infinity norm, included references to mathworld.com for vector
1984 norm definitions.
1996 norm definitions.
1985 (amin/amax): added amin/amax for array min/max. Similar to what
1997 (amin/amax): added amin/amax for array min/max. Similar to what
1986 pylab ships with after the recent reorganization of names.
1998 pylab ships with after the recent reorganization of names.
1987 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1999 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1988
2000
1989 * ipython.el: committed Alex's recent fixes and improvements.
2001 * ipython.el: committed Alex's recent fixes and improvements.
1990 Tested with python-mode from CVS, and it looks excellent. Since
2002 Tested with python-mode from CVS, and it looks excellent. Since
1991 python-mode hasn't released anything in a while, I'm temporarily
2003 python-mode hasn't released anything in a while, I'm temporarily
1992 putting a copy of today's CVS (v 4.70) of python-mode in:
2004 putting a copy of today's CVS (v 4.70) of python-mode in:
1993 http://ipython.scipy.org/tmp/python-mode.el
2005 http://ipython.scipy.org/tmp/python-mode.el
1994
2006
1995 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2007 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1996 sys.executable for the executable name, instead of assuming it's
2008 sys.executable for the executable name, instead of assuming it's
1997 called 'python.exe' (the post-installer would have produced broken
2009 called 'python.exe' (the post-installer would have produced broken
1998 setups on systems with a differently named python binary).
2010 setups on systems with a differently named python binary).
1999
2011
2000 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2012 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2001 references to os.linesep, to make the code more
2013 references to os.linesep, to make the code more
2002 platform-independent. This is also part of the win32 coloring
2014 platform-independent. This is also part of the win32 coloring
2003 fixes.
2015 fixes.
2004
2016
2005 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2017 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2006 lines, which actually cause coloring bugs because the length of
2018 lines, which actually cause coloring bugs because the length of
2007 the line is very difficult to correctly compute with embedded
2019 the line is very difficult to correctly compute with embedded
2008 escapes. This was the source of all the coloring problems under
2020 escapes. This was the source of all the coloring problems under
2009 Win32. I think that _finally_, Win32 users have a properly
2021 Win32. I think that _finally_, Win32 users have a properly
2010 working ipython in all respects. This would never have happened
2022 working ipython in all respects. This would never have happened
2011 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2023 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2012
2024
2013 2005-01-26 *** Released version 0.6.9
2025 2005-01-26 *** Released version 0.6.9
2014
2026
2015 2005-01-25 Fernando Perez <fperez@colorado.edu>
2027 2005-01-25 Fernando Perez <fperez@colorado.edu>
2016
2028
2017 * setup.py: finally, we have a true Windows installer, thanks to
2029 * setup.py: finally, we have a true Windows installer, thanks to
2018 the excellent work of Viktor Ransmayr
2030 the excellent work of Viktor Ransmayr
2019 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2031 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2020 Windows users. The setup routine is quite a bit cleaner thanks to
2032 Windows users. The setup routine is quite a bit cleaner thanks to
2021 this, and the post-install script uses the proper functions to
2033 this, and the post-install script uses the proper functions to
2022 allow a clean de-installation using the standard Windows Control
2034 allow a clean de-installation using the standard Windows Control
2023 Panel.
2035 Panel.
2024
2036
2025 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2037 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2026 environment variable under all OSes (including win32) if
2038 environment variable under all OSes (including win32) if
2027 available. This will give consistency to win32 users who have set
2039 available. This will give consistency to win32 users who have set
2028 this variable for any reason. If os.environ['HOME'] fails, the
2040 this variable for any reason. If os.environ['HOME'] fails, the
2029 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2041 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2030
2042
2031 2005-01-24 Fernando Perez <fperez@colorado.edu>
2043 2005-01-24 Fernando Perez <fperez@colorado.edu>
2032
2044
2033 * IPython/numutils.py (empty_like): add empty_like(), similar to
2045 * IPython/numutils.py (empty_like): add empty_like(), similar to
2034 zeros_like() but taking advantage of the new empty() Numeric routine.
2046 zeros_like() but taking advantage of the new empty() Numeric routine.
2035
2047
2036 2005-01-23 *** Released version 0.6.8
2048 2005-01-23 *** Released version 0.6.8
2037
2049
2038 2005-01-22 Fernando Perez <fperez@colorado.edu>
2050 2005-01-22 Fernando Perez <fperez@colorado.edu>
2039
2051
2040 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2052 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2041 automatic show() calls. After discussing things with JDH, it
2053 automatic show() calls. After discussing things with JDH, it
2042 turns out there are too many corner cases where this can go wrong.
2054 turns out there are too many corner cases where this can go wrong.
2043 It's best not to try to be 'too smart', and simply have ipython
2055 It's best not to try to be 'too smart', and simply have ipython
2044 reproduce as much as possible the default behavior of a normal
2056 reproduce as much as possible the default behavior of a normal
2045 python shell.
2057 python shell.
2046
2058
2047 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2059 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2048 line-splitting regexp and _prefilter() to avoid calling getattr()
2060 line-splitting regexp and _prefilter() to avoid calling getattr()
2049 on assignments. This closes
2061 on assignments. This closes
2050 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2062 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2051 readline uses getattr(), so a simple <TAB> keypress is still
2063 readline uses getattr(), so a simple <TAB> keypress is still
2052 enough to trigger getattr() calls on an object.
2064 enough to trigger getattr() calls on an object.
2053
2065
2054 2005-01-21 Fernando Perez <fperez@colorado.edu>
2066 2005-01-21 Fernando Perez <fperez@colorado.edu>
2055
2067
2056 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2068 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2057 docstring under pylab so it doesn't mask the original.
2069 docstring under pylab so it doesn't mask the original.
2058
2070
2059 2005-01-21 *** Released version 0.6.7
2071 2005-01-21 *** Released version 0.6.7
2060
2072
2061 2005-01-21 Fernando Perez <fperez@colorado.edu>
2073 2005-01-21 Fernando Perez <fperez@colorado.edu>
2062
2074
2063 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2075 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2064 signal handling for win32 users in multithreaded mode.
2076 signal handling for win32 users in multithreaded mode.
2065
2077
2066 2005-01-17 Fernando Perez <fperez@colorado.edu>
2078 2005-01-17 Fernando Perez <fperez@colorado.edu>
2067
2079
2068 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2080 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2069 instances with no __init__. After a crash report by Norbert Nemec
2081 instances with no __init__. After a crash report by Norbert Nemec
2070 <Norbert-AT-nemec-online.de>.
2082 <Norbert-AT-nemec-online.de>.
2071
2083
2072 2005-01-14 Fernando Perez <fperez@colorado.edu>
2084 2005-01-14 Fernando Perez <fperez@colorado.edu>
2073
2085
2074 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2086 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2075 names for verbose exceptions, when multiple dotted names and the
2087 names for verbose exceptions, when multiple dotted names and the
2076 'parent' object were present on the same line.
2088 'parent' object were present on the same line.
2077
2089
2078 2005-01-11 Fernando Perez <fperez@colorado.edu>
2090 2005-01-11 Fernando Perez <fperez@colorado.edu>
2079
2091
2080 * IPython/genutils.py (flag_calls): new utility to trap and flag
2092 * IPython/genutils.py (flag_calls): new utility to trap and flag
2081 calls in functions. I need it to clean up matplotlib support.
2093 calls in functions. I need it to clean up matplotlib support.
2082 Also removed some deprecated code in genutils.
2094 Also removed some deprecated code in genutils.
2083
2095
2084 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2096 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2085 that matplotlib scripts called with %run, which don't call show()
2097 that matplotlib scripts called with %run, which don't call show()
2086 themselves, still have their plotting windows open.
2098 themselves, still have their plotting windows open.
2087
2099
2088 2005-01-05 Fernando Perez <fperez@colorado.edu>
2100 2005-01-05 Fernando Perez <fperez@colorado.edu>
2089
2101
2090 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2102 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2091 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2103 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2092
2104
2093 2004-12-19 Fernando Perez <fperez@colorado.edu>
2105 2004-12-19 Fernando Perez <fperez@colorado.edu>
2094
2106
2095 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2107 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2096 parent_runcode, which was an eyesore. The same result can be
2108 parent_runcode, which was an eyesore. The same result can be
2097 obtained with Python's regular superclass mechanisms.
2109 obtained with Python's regular superclass mechanisms.
2098
2110
2099 2004-12-17 Fernando Perez <fperez@colorado.edu>
2111 2004-12-17 Fernando Perez <fperez@colorado.edu>
2100
2112
2101 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2113 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2102 reported by Prabhu.
2114 reported by Prabhu.
2103 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2115 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2104 sys.stderr) instead of explicitly calling sys.stderr. This helps
2116 sys.stderr) instead of explicitly calling sys.stderr. This helps
2105 maintain our I/O abstractions clean, for future GUI embeddings.
2117 maintain our I/O abstractions clean, for future GUI embeddings.
2106
2118
2107 * IPython/genutils.py (info): added new utility for sys.stderr
2119 * IPython/genutils.py (info): added new utility for sys.stderr
2108 unified info message handling (thin wrapper around warn()).
2120 unified info message handling (thin wrapper around warn()).
2109
2121
2110 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2122 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2111 composite (dotted) names on verbose exceptions.
2123 composite (dotted) names on verbose exceptions.
2112 (VerboseTB.nullrepr): harden against another kind of errors which
2124 (VerboseTB.nullrepr): harden against another kind of errors which
2113 Python's inspect module can trigger, and which were crashing
2125 Python's inspect module can trigger, and which were crashing
2114 IPython. Thanks to a report by Marco Lombardi
2126 IPython. Thanks to a report by Marco Lombardi
2115 <mlombard-AT-ma010192.hq.eso.org>.
2127 <mlombard-AT-ma010192.hq.eso.org>.
2116
2128
2117 2004-12-13 *** Released version 0.6.6
2129 2004-12-13 *** Released version 0.6.6
2118
2130
2119 2004-12-12 Fernando Perez <fperez@colorado.edu>
2131 2004-12-12 Fernando Perez <fperez@colorado.edu>
2120
2132
2121 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2133 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2122 generated by pygtk upon initialization if it was built without
2134 generated by pygtk upon initialization if it was built without
2123 threads (for matplotlib users). After a crash reported by
2135 threads (for matplotlib users). After a crash reported by
2124 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2136 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2125
2137
2126 * IPython/ipmaker.py (make_IPython): fix small bug in the
2138 * IPython/ipmaker.py (make_IPython): fix small bug in the
2127 import_some parameter for multiple imports.
2139 import_some parameter for multiple imports.
2128
2140
2129 * IPython/iplib.py (ipmagic): simplified the interface of
2141 * IPython/iplib.py (ipmagic): simplified the interface of
2130 ipmagic() to take a single string argument, just as it would be
2142 ipmagic() to take a single string argument, just as it would be
2131 typed at the IPython cmd line.
2143 typed at the IPython cmd line.
2132 (ipalias): Added new ipalias() with an interface identical to
2144 (ipalias): Added new ipalias() with an interface identical to
2133 ipmagic(). This completes exposing a pure python interface to the
2145 ipmagic(). This completes exposing a pure python interface to the
2134 alias and magic system, which can be used in loops or more complex
2146 alias and magic system, which can be used in loops or more complex
2135 code where IPython's automatic line mangling is not active.
2147 code where IPython's automatic line mangling is not active.
2136
2148
2137 * IPython/genutils.py (timing): changed interface of timing to
2149 * IPython/genutils.py (timing): changed interface of timing to
2138 simply run code once, which is the most common case. timings()
2150 simply run code once, which is the most common case. timings()
2139 remains unchanged, for the cases where you want multiple runs.
2151 remains unchanged, for the cases where you want multiple runs.
2140
2152
2141 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2153 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2142 bug where Python2.2 crashes with exec'ing code which does not end
2154 bug where Python2.2 crashes with exec'ing code which does not end
2143 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2155 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2144 before.
2156 before.
2145
2157
2146 2004-12-10 Fernando Perez <fperez@colorado.edu>
2158 2004-12-10 Fernando Perez <fperez@colorado.edu>
2147
2159
2148 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2160 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2149 -t to -T, to accomodate the new -t flag in %run (the %run and
2161 -t to -T, to accomodate the new -t flag in %run (the %run and
2150 %prun options are kind of intermixed, and it's not easy to change
2162 %prun options are kind of intermixed, and it's not easy to change
2151 this with the limitations of python's getopt).
2163 this with the limitations of python's getopt).
2152
2164
2153 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2165 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2154 the execution of scripts. It's not as fine-tuned as timeit.py,
2166 the execution of scripts. It's not as fine-tuned as timeit.py,
2155 but it works from inside ipython (and under 2.2, which lacks
2167 but it works from inside ipython (and under 2.2, which lacks
2156 timeit.py). Optionally a number of runs > 1 can be given for
2168 timeit.py). Optionally a number of runs > 1 can be given for
2157 timing very short-running code.
2169 timing very short-running code.
2158
2170
2159 * IPython/genutils.py (uniq_stable): new routine which returns a
2171 * IPython/genutils.py (uniq_stable): new routine which returns a
2160 list of unique elements in any iterable, but in stable order of
2172 list of unique elements in any iterable, but in stable order of
2161 appearance. I needed this for the ultraTB fixes, and it's a handy
2173 appearance. I needed this for the ultraTB fixes, and it's a handy
2162 utility.
2174 utility.
2163
2175
2164 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2176 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2165 dotted names in Verbose exceptions. This had been broken since
2177 dotted names in Verbose exceptions. This had been broken since
2166 the very start, now x.y will properly be printed in a Verbose
2178 the very start, now x.y will properly be printed in a Verbose
2167 traceback, instead of x being shown and y appearing always as an
2179 traceback, instead of x being shown and y appearing always as an
2168 'undefined global'. Getting this to work was a bit tricky,
2180 'undefined global'. Getting this to work was a bit tricky,
2169 because by default python tokenizers are stateless. Saved by
2181 because by default python tokenizers are stateless. Saved by
2170 python's ability to easily add a bit of state to an arbitrary
2182 python's ability to easily add a bit of state to an arbitrary
2171 function (without needing to build a full-blown callable object).
2183 function (without needing to build a full-blown callable object).
2172
2184
2173 Also big cleanup of this code, which had horrendous runtime
2185 Also big cleanup of this code, which had horrendous runtime
2174 lookups of zillions of attributes for colorization. Moved all
2186 lookups of zillions of attributes for colorization. Moved all
2175 this code into a few templates, which make it cleaner and quicker.
2187 this code into a few templates, which make it cleaner and quicker.
2176
2188
2177 Printout quality was also improved for Verbose exceptions: one
2189 Printout quality was also improved for Verbose exceptions: one
2178 variable per line, and memory addresses are printed (this can be
2190 variable per line, and memory addresses are printed (this can be
2179 quite handy in nasty debugging situations, which is what Verbose
2191 quite handy in nasty debugging situations, which is what Verbose
2180 is for).
2192 is for).
2181
2193
2182 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2194 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2183 the command line as scripts to be loaded by embedded instances.
2195 the command line as scripts to be loaded by embedded instances.
2184 Doing so has the potential for an infinite recursion if there are
2196 Doing so has the potential for an infinite recursion if there are
2185 exceptions thrown in the process. This fixes a strange crash
2197 exceptions thrown in the process. This fixes a strange crash
2186 reported by Philippe MULLER <muller-AT-irit.fr>.
2198 reported by Philippe MULLER <muller-AT-irit.fr>.
2187
2199
2188 2004-12-09 Fernando Perez <fperez@colorado.edu>
2200 2004-12-09 Fernando Perez <fperez@colorado.edu>
2189
2201
2190 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2202 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2191 to reflect new names in matplotlib, which now expose the
2203 to reflect new names in matplotlib, which now expose the
2192 matlab-compatible interface via a pylab module instead of the
2204 matlab-compatible interface via a pylab module instead of the
2193 'matlab' name. The new code is backwards compatible, so users of
2205 'matlab' name. The new code is backwards compatible, so users of
2194 all matplotlib versions are OK. Patch by J. Hunter.
2206 all matplotlib versions are OK. Patch by J. Hunter.
2195
2207
2196 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2208 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2197 of __init__ docstrings for instances (class docstrings are already
2209 of __init__ docstrings for instances (class docstrings are already
2198 automatically printed). Instances with customized docstrings
2210 automatically printed). Instances with customized docstrings
2199 (indep. of the class) are also recognized and all 3 separate
2211 (indep. of the class) are also recognized and all 3 separate
2200 docstrings are printed (instance, class, constructor). After some
2212 docstrings are printed (instance, class, constructor). After some
2201 comments/suggestions by J. Hunter.
2213 comments/suggestions by J. Hunter.
2202
2214
2203 2004-12-05 Fernando Perez <fperez@colorado.edu>
2215 2004-12-05 Fernando Perez <fperez@colorado.edu>
2204
2216
2205 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2217 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2206 warnings when tab-completion fails and triggers an exception.
2218 warnings when tab-completion fails and triggers an exception.
2207
2219
2208 2004-12-03 Fernando Perez <fperez@colorado.edu>
2220 2004-12-03 Fernando Perez <fperez@colorado.edu>
2209
2221
2210 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2222 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2211 be triggered when using 'run -p'. An incorrect option flag was
2223 be triggered when using 'run -p'. An incorrect option flag was
2212 being set ('d' instead of 'D').
2224 being set ('d' instead of 'D').
2213 (manpage): fix missing escaped \- sign.
2225 (manpage): fix missing escaped \- sign.
2214
2226
2215 2004-11-30 *** Released version 0.6.5
2227 2004-11-30 *** Released version 0.6.5
2216
2228
2217 2004-11-30 Fernando Perez <fperez@colorado.edu>
2229 2004-11-30 Fernando Perez <fperez@colorado.edu>
2218
2230
2219 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2231 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2220 setting with -d option.
2232 setting with -d option.
2221
2233
2222 * setup.py (docfiles): Fix problem where the doc glob I was using
2234 * setup.py (docfiles): Fix problem where the doc glob I was using
2223 was COMPLETELY BROKEN. It was giving the right files by pure
2235 was COMPLETELY BROKEN. It was giving the right files by pure
2224 accident, but failed once I tried to include ipython.el. Note:
2236 accident, but failed once I tried to include ipython.el. Note:
2225 glob() does NOT allow you to do exclusion on multiple endings!
2237 glob() does NOT allow you to do exclusion on multiple endings!
2226
2238
2227 2004-11-29 Fernando Perez <fperez@colorado.edu>
2239 2004-11-29 Fernando Perez <fperez@colorado.edu>
2228
2240
2229 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2241 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2230 the manpage as the source. Better formatting & consistency.
2242 the manpage as the source. Better formatting & consistency.
2231
2243
2232 * IPython/Magic.py (magic_run): Added new -d option, to run
2244 * IPython/Magic.py (magic_run): Added new -d option, to run
2233 scripts under the control of the python pdb debugger. Note that
2245 scripts under the control of the python pdb debugger. Note that
2234 this required changing the %prun option -d to -D, to avoid a clash
2246 this required changing the %prun option -d to -D, to avoid a clash
2235 (since %run must pass options to %prun, and getopt is too dumb to
2247 (since %run must pass options to %prun, and getopt is too dumb to
2236 handle options with string values with embedded spaces). Thanks
2248 handle options with string values with embedded spaces). Thanks
2237 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2249 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2238 (magic_who_ls): added type matching to %who and %whos, so that one
2250 (magic_who_ls): added type matching to %who and %whos, so that one
2239 can filter their output to only include variables of certain
2251 can filter their output to only include variables of certain
2240 types. Another suggestion by Matthew.
2252 types. Another suggestion by Matthew.
2241 (magic_whos): Added memory summaries in kb and Mb for arrays.
2253 (magic_whos): Added memory summaries in kb and Mb for arrays.
2242 (magic_who): Improve formatting (break lines every 9 vars).
2254 (magic_who): Improve formatting (break lines every 9 vars).
2243
2255
2244 2004-11-28 Fernando Perez <fperez@colorado.edu>
2256 2004-11-28 Fernando Perez <fperez@colorado.edu>
2245
2257
2246 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2258 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2247 cache when empty lines were present.
2259 cache when empty lines were present.
2248
2260
2249 2004-11-24 Fernando Perez <fperez@colorado.edu>
2261 2004-11-24 Fernando Perez <fperez@colorado.edu>
2250
2262
2251 * IPython/usage.py (__doc__): document the re-activated threading
2263 * IPython/usage.py (__doc__): document the re-activated threading
2252 options for WX and GTK.
2264 options for WX and GTK.
2253
2265
2254 2004-11-23 Fernando Perez <fperez@colorado.edu>
2266 2004-11-23 Fernando Perez <fperez@colorado.edu>
2255
2267
2256 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2268 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2257 the -wthread and -gthread options, along with a new -tk one to try
2269 the -wthread and -gthread options, along with a new -tk one to try
2258 and coordinate Tk threading with wx/gtk. The tk support is very
2270 and coordinate Tk threading with wx/gtk. The tk support is very
2259 platform dependent, since it seems to require Tcl and Tk to be
2271 platform dependent, since it seems to require Tcl and Tk to be
2260 built with threads (Fedora1/2 appears NOT to have it, but in
2272 built with threads (Fedora1/2 appears NOT to have it, but in
2261 Prabhu's Debian boxes it works OK). But even with some Tk
2273 Prabhu's Debian boxes it works OK). But even with some Tk
2262 limitations, this is a great improvement.
2274 limitations, this is a great improvement.
2263
2275
2264 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2276 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2265 info in user prompts. Patch by Prabhu.
2277 info in user prompts. Patch by Prabhu.
2266
2278
2267 2004-11-18 Fernando Perez <fperez@colorado.edu>
2279 2004-11-18 Fernando Perez <fperez@colorado.edu>
2268
2280
2269 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2281 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2270 EOFErrors and bail, to avoid infinite loops if a non-terminating
2282 EOFErrors and bail, to avoid infinite loops if a non-terminating
2271 file is fed into ipython. Patch submitted in issue 19 by user,
2283 file is fed into ipython. Patch submitted in issue 19 by user,
2272 many thanks.
2284 many thanks.
2273
2285
2274 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2286 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2275 autoquote/parens in continuation prompts, which can cause lots of
2287 autoquote/parens in continuation prompts, which can cause lots of
2276 problems. Closes roundup issue 20.
2288 problems. Closes roundup issue 20.
2277
2289
2278 2004-11-17 Fernando Perez <fperez@colorado.edu>
2290 2004-11-17 Fernando Perez <fperez@colorado.edu>
2279
2291
2280 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2292 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2281 reported as debian bug #280505. I'm not sure my local changelog
2293 reported as debian bug #280505. I'm not sure my local changelog
2282 entry has the proper debian format (Jack?).
2294 entry has the proper debian format (Jack?).
2283
2295
2284 2004-11-08 *** Released version 0.6.4
2296 2004-11-08 *** Released version 0.6.4
2285
2297
2286 2004-11-08 Fernando Perez <fperez@colorado.edu>
2298 2004-11-08 Fernando Perez <fperez@colorado.edu>
2287
2299
2288 * IPython/iplib.py (init_readline): Fix exit message for Windows
2300 * IPython/iplib.py (init_readline): Fix exit message for Windows
2289 when readline is active. Thanks to a report by Eric Jones
2301 when readline is active. Thanks to a report by Eric Jones
2290 <eric-AT-enthought.com>.
2302 <eric-AT-enthought.com>.
2291
2303
2292 2004-11-07 Fernando Perez <fperez@colorado.edu>
2304 2004-11-07 Fernando Perez <fperez@colorado.edu>
2293
2305
2294 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2306 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2295 sometimes seen by win2k/cygwin users.
2307 sometimes seen by win2k/cygwin users.
2296
2308
2297 2004-11-06 Fernando Perez <fperez@colorado.edu>
2309 2004-11-06 Fernando Perez <fperez@colorado.edu>
2298
2310
2299 * IPython/iplib.py (interact): Change the handling of %Exit from
2311 * IPython/iplib.py (interact): Change the handling of %Exit from
2300 trying to propagate a SystemExit to an internal ipython flag.
2312 trying to propagate a SystemExit to an internal ipython flag.
2301 This is less elegant than using Python's exception mechanism, but
2313 This is less elegant than using Python's exception mechanism, but
2302 I can't get that to work reliably with threads, so under -pylab
2314 I can't get that to work reliably with threads, so under -pylab
2303 %Exit was hanging IPython. Cross-thread exception handling is
2315 %Exit was hanging IPython. Cross-thread exception handling is
2304 really a bitch. Thaks to a bug report by Stephen Walton
2316 really a bitch. Thaks to a bug report by Stephen Walton
2305 <stephen.walton-AT-csun.edu>.
2317 <stephen.walton-AT-csun.edu>.
2306
2318
2307 2004-11-04 Fernando Perez <fperez@colorado.edu>
2319 2004-11-04 Fernando Perez <fperez@colorado.edu>
2308
2320
2309 * IPython/iplib.py (raw_input_original): store a pointer to the
2321 * IPython/iplib.py (raw_input_original): store a pointer to the
2310 true raw_input to harden against code which can modify it
2322 true raw_input to harden against code which can modify it
2311 (wx.py.PyShell does this and would otherwise crash ipython).
2323 (wx.py.PyShell does this and would otherwise crash ipython).
2312 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2324 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2313
2325
2314 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2326 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2315 Ctrl-C problem, which does not mess up the input line.
2327 Ctrl-C problem, which does not mess up the input line.
2316
2328
2317 2004-11-03 Fernando Perez <fperez@colorado.edu>
2329 2004-11-03 Fernando Perez <fperez@colorado.edu>
2318
2330
2319 * IPython/Release.py: Changed licensing to BSD, in all files.
2331 * IPython/Release.py: Changed licensing to BSD, in all files.
2320 (name): lowercase name for tarball/RPM release.
2332 (name): lowercase name for tarball/RPM release.
2321
2333
2322 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2334 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2323 use throughout ipython.
2335 use throughout ipython.
2324
2336
2325 * IPython/Magic.py (Magic._ofind): Switch to using the new
2337 * IPython/Magic.py (Magic._ofind): Switch to using the new
2326 OInspect.getdoc() function.
2338 OInspect.getdoc() function.
2327
2339
2328 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2340 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2329 of the line currently being canceled via Ctrl-C. It's extremely
2341 of the line currently being canceled via Ctrl-C. It's extremely
2330 ugly, but I don't know how to do it better (the problem is one of
2342 ugly, but I don't know how to do it better (the problem is one of
2331 handling cross-thread exceptions).
2343 handling cross-thread exceptions).
2332
2344
2333 2004-10-28 Fernando Perez <fperez@colorado.edu>
2345 2004-10-28 Fernando Perez <fperez@colorado.edu>
2334
2346
2335 * IPython/Shell.py (signal_handler): add signal handlers to trap
2347 * IPython/Shell.py (signal_handler): add signal handlers to trap
2336 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2348 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2337 report by Francesc Alted.
2349 report by Francesc Alted.
2338
2350
2339 2004-10-21 Fernando Perez <fperez@colorado.edu>
2351 2004-10-21 Fernando Perez <fperez@colorado.edu>
2340
2352
2341 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2353 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2342 to % for pysh syntax extensions.
2354 to % for pysh syntax extensions.
2343
2355
2344 2004-10-09 Fernando Perez <fperez@colorado.edu>
2356 2004-10-09 Fernando Perez <fperez@colorado.edu>
2345
2357
2346 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2358 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2347 arrays to print a more useful summary, without calling str(arr).
2359 arrays to print a more useful summary, without calling str(arr).
2348 This avoids the problem of extremely lengthy computations which
2360 This avoids the problem of extremely lengthy computations which
2349 occur if arr is large, and appear to the user as a system lockup
2361 occur if arr is large, and appear to the user as a system lockup
2350 with 100% cpu activity. After a suggestion by Kristian Sandberg
2362 with 100% cpu activity. After a suggestion by Kristian Sandberg
2351 <Kristian.Sandberg@colorado.edu>.
2363 <Kristian.Sandberg@colorado.edu>.
2352 (Magic.__init__): fix bug in global magic escapes not being
2364 (Magic.__init__): fix bug in global magic escapes not being
2353 correctly set.
2365 correctly set.
2354
2366
2355 2004-10-08 Fernando Perez <fperez@colorado.edu>
2367 2004-10-08 Fernando Perez <fperez@colorado.edu>
2356
2368
2357 * IPython/Magic.py (__license__): change to absolute imports of
2369 * IPython/Magic.py (__license__): change to absolute imports of
2358 ipython's own internal packages, to start adapting to the absolute
2370 ipython's own internal packages, to start adapting to the absolute
2359 import requirement of PEP-328.
2371 import requirement of PEP-328.
2360
2372
2361 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2373 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2362 files, and standardize author/license marks through the Release
2374 files, and standardize author/license marks through the Release
2363 module instead of having per/file stuff (except for files with
2375 module instead of having per/file stuff (except for files with
2364 particular licenses, like the MIT/PSF-licensed codes).
2376 particular licenses, like the MIT/PSF-licensed codes).
2365
2377
2366 * IPython/Debugger.py: remove dead code for python 2.1
2378 * IPython/Debugger.py: remove dead code for python 2.1
2367
2379
2368 2004-10-04 Fernando Perez <fperez@colorado.edu>
2380 2004-10-04 Fernando Perez <fperez@colorado.edu>
2369
2381
2370 * IPython/iplib.py (ipmagic): New function for accessing magics
2382 * IPython/iplib.py (ipmagic): New function for accessing magics
2371 via a normal python function call.
2383 via a normal python function call.
2372
2384
2373 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2385 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2374 from '@' to '%', to accomodate the new @decorator syntax of python
2386 from '@' to '%', to accomodate the new @decorator syntax of python
2375 2.4.
2387 2.4.
2376
2388
2377 2004-09-29 Fernando Perez <fperez@colorado.edu>
2389 2004-09-29 Fernando Perez <fperez@colorado.edu>
2378
2390
2379 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2391 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2380 matplotlib.use to prevent running scripts which try to switch
2392 matplotlib.use to prevent running scripts which try to switch
2381 interactive backends from within ipython. This will just crash
2393 interactive backends from within ipython. This will just crash
2382 the python interpreter, so we can't allow it (but a detailed error
2394 the python interpreter, so we can't allow it (but a detailed error
2383 is given to the user).
2395 is given to the user).
2384
2396
2385 2004-09-28 Fernando Perez <fperez@colorado.edu>
2397 2004-09-28 Fernando Perez <fperez@colorado.edu>
2386
2398
2387 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2399 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2388 matplotlib-related fixes so that using @run with non-matplotlib
2400 matplotlib-related fixes so that using @run with non-matplotlib
2389 scripts doesn't pop up spurious plot windows. This requires
2401 scripts doesn't pop up spurious plot windows. This requires
2390 matplotlib >= 0.63, where I had to make some changes as well.
2402 matplotlib >= 0.63, where I had to make some changes as well.
2391
2403
2392 * IPython/ipmaker.py (make_IPython): update version requirement to
2404 * IPython/ipmaker.py (make_IPython): update version requirement to
2393 python 2.2.
2405 python 2.2.
2394
2406
2395 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2407 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2396 banner arg for embedded customization.
2408 banner arg for embedded customization.
2397
2409
2398 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2410 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2399 explicit uses of __IP as the IPython's instance name. Now things
2411 explicit uses of __IP as the IPython's instance name. Now things
2400 are properly handled via the shell.name value. The actual code
2412 are properly handled via the shell.name value. The actual code
2401 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2413 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2402 is much better than before. I'll clean things completely when the
2414 is much better than before. I'll clean things completely when the
2403 magic stuff gets a real overhaul.
2415 magic stuff gets a real overhaul.
2404
2416
2405 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2417 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2406 minor changes to debian dir.
2418 minor changes to debian dir.
2407
2419
2408 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2420 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2409 pointer to the shell itself in the interactive namespace even when
2421 pointer to the shell itself in the interactive namespace even when
2410 a user-supplied dict is provided. This is needed for embedding
2422 a user-supplied dict is provided. This is needed for embedding
2411 purposes (found by tests with Michel Sanner).
2423 purposes (found by tests with Michel Sanner).
2412
2424
2413 2004-09-27 Fernando Perez <fperez@colorado.edu>
2425 2004-09-27 Fernando Perez <fperez@colorado.edu>
2414
2426
2415 * IPython/UserConfig/ipythonrc: remove []{} from
2427 * IPython/UserConfig/ipythonrc: remove []{} from
2416 readline_remove_delims, so that things like [modname.<TAB> do
2428 readline_remove_delims, so that things like [modname.<TAB> do
2417 proper completion. This disables [].TAB, but that's a less common
2429 proper completion. This disables [].TAB, but that's a less common
2418 case than module names in list comprehensions, for example.
2430 case than module names in list comprehensions, for example.
2419 Thanks to a report by Andrea Riciputi.
2431 Thanks to a report by Andrea Riciputi.
2420
2432
2421 2004-09-09 Fernando Perez <fperez@colorado.edu>
2433 2004-09-09 Fernando Perez <fperez@colorado.edu>
2422
2434
2423 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2435 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2424 blocking problems in win32 and osx. Fix by John.
2436 blocking problems in win32 and osx. Fix by John.
2425
2437
2426 2004-09-08 Fernando Perez <fperez@colorado.edu>
2438 2004-09-08 Fernando Perez <fperez@colorado.edu>
2427
2439
2428 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2440 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2429 for Win32 and OSX. Fix by John Hunter.
2441 for Win32 and OSX. Fix by John Hunter.
2430
2442
2431 2004-08-30 *** Released version 0.6.3
2443 2004-08-30 *** Released version 0.6.3
2432
2444
2433 2004-08-30 Fernando Perez <fperez@colorado.edu>
2445 2004-08-30 Fernando Perez <fperez@colorado.edu>
2434
2446
2435 * setup.py (isfile): Add manpages to list of dependent files to be
2447 * setup.py (isfile): Add manpages to list of dependent files to be
2436 updated.
2448 updated.
2437
2449
2438 2004-08-27 Fernando Perez <fperez@colorado.edu>
2450 2004-08-27 Fernando Perez <fperez@colorado.edu>
2439
2451
2440 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2452 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2441 for now. They don't really work with standalone WX/GTK code
2453 for now. They don't really work with standalone WX/GTK code
2442 (though matplotlib IS working fine with both of those backends).
2454 (though matplotlib IS working fine with both of those backends).
2443 This will neeed much more testing. I disabled most things with
2455 This will neeed much more testing. I disabled most things with
2444 comments, so turning it back on later should be pretty easy.
2456 comments, so turning it back on later should be pretty easy.
2445
2457
2446 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2458 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2447 autocalling of expressions like r'foo', by modifying the line
2459 autocalling of expressions like r'foo', by modifying the line
2448 split regexp. Closes
2460 split regexp. Closes
2449 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2461 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2450 Riley <ipythonbugs-AT-sabi.net>.
2462 Riley <ipythonbugs-AT-sabi.net>.
2451 (InteractiveShell.mainloop): honor --nobanner with banner
2463 (InteractiveShell.mainloop): honor --nobanner with banner
2452 extensions.
2464 extensions.
2453
2465
2454 * IPython/Shell.py: Significant refactoring of all classes, so
2466 * IPython/Shell.py: Significant refactoring of all classes, so
2455 that we can really support ALL matplotlib backends and threading
2467 that we can really support ALL matplotlib backends and threading
2456 models (John spotted a bug with Tk which required this). Now we
2468 models (John spotted a bug with Tk which required this). Now we
2457 should support single-threaded, WX-threads and GTK-threads, both
2469 should support single-threaded, WX-threads and GTK-threads, both
2458 for generic code and for matplotlib.
2470 for generic code and for matplotlib.
2459
2471
2460 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2472 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2461 -pylab, to simplify things for users. Will also remove the pylab
2473 -pylab, to simplify things for users. Will also remove the pylab
2462 profile, since now all of matplotlib configuration is directly
2474 profile, since now all of matplotlib configuration is directly
2463 handled here. This also reduces startup time.
2475 handled here. This also reduces startup time.
2464
2476
2465 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2477 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2466 shell wasn't being correctly called. Also in IPShellWX.
2478 shell wasn't being correctly called. Also in IPShellWX.
2467
2479
2468 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2480 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2469 fine-tune banner.
2481 fine-tune banner.
2470
2482
2471 * IPython/numutils.py (spike): Deprecate these spike functions,
2483 * IPython/numutils.py (spike): Deprecate these spike functions,
2472 delete (long deprecated) gnuplot_exec handler.
2484 delete (long deprecated) gnuplot_exec handler.
2473
2485
2474 2004-08-26 Fernando Perez <fperez@colorado.edu>
2486 2004-08-26 Fernando Perez <fperez@colorado.edu>
2475
2487
2476 * ipython.1: Update for threading options, plus some others which
2488 * ipython.1: Update for threading options, plus some others which
2477 were missing.
2489 were missing.
2478
2490
2479 * IPython/ipmaker.py (__call__): Added -wthread option for
2491 * IPython/ipmaker.py (__call__): Added -wthread option for
2480 wxpython thread handling. Make sure threading options are only
2492 wxpython thread handling. Make sure threading options are only
2481 valid at the command line.
2493 valid at the command line.
2482
2494
2483 * scripts/ipython: moved shell selection into a factory function
2495 * scripts/ipython: moved shell selection into a factory function
2484 in Shell.py, to keep the starter script to a minimum.
2496 in Shell.py, to keep the starter script to a minimum.
2485
2497
2486 2004-08-25 Fernando Perez <fperez@colorado.edu>
2498 2004-08-25 Fernando Perez <fperez@colorado.edu>
2487
2499
2488 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2500 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2489 John. Along with some recent changes he made to matplotlib, the
2501 John. Along with some recent changes he made to matplotlib, the
2490 next versions of both systems should work very well together.
2502 next versions of both systems should work very well together.
2491
2503
2492 2004-08-24 Fernando Perez <fperez@colorado.edu>
2504 2004-08-24 Fernando Perez <fperez@colorado.edu>
2493
2505
2494 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2506 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2495 tried to switch the profiling to using hotshot, but I'm getting
2507 tried to switch the profiling to using hotshot, but I'm getting
2496 strange errors from prof.runctx() there. I may be misreading the
2508 strange errors from prof.runctx() there. I may be misreading the
2497 docs, but it looks weird. For now the profiling code will
2509 docs, but it looks weird. For now the profiling code will
2498 continue to use the standard profiler.
2510 continue to use the standard profiler.
2499
2511
2500 2004-08-23 Fernando Perez <fperez@colorado.edu>
2512 2004-08-23 Fernando Perez <fperez@colorado.edu>
2501
2513
2502 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2514 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2503 threaded shell, by John Hunter. It's not quite ready yet, but
2515 threaded shell, by John Hunter. It's not quite ready yet, but
2504 close.
2516 close.
2505
2517
2506 2004-08-22 Fernando Perez <fperez@colorado.edu>
2518 2004-08-22 Fernando Perez <fperez@colorado.edu>
2507
2519
2508 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2520 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2509 in Magic and ultraTB.
2521 in Magic and ultraTB.
2510
2522
2511 * ipython.1: document threading options in manpage.
2523 * ipython.1: document threading options in manpage.
2512
2524
2513 * scripts/ipython: Changed name of -thread option to -gthread,
2525 * scripts/ipython: Changed name of -thread option to -gthread,
2514 since this is GTK specific. I want to leave the door open for a
2526 since this is GTK specific. I want to leave the door open for a
2515 -wthread option for WX, which will most likely be necessary. This
2527 -wthread option for WX, which will most likely be necessary. This
2516 change affects usage and ipmaker as well.
2528 change affects usage and ipmaker as well.
2517
2529
2518 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2530 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2519 handle the matplotlib shell issues. Code by John Hunter
2531 handle the matplotlib shell issues. Code by John Hunter
2520 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2532 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2521 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2533 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2522 broken (and disabled for end users) for now, but it puts the
2534 broken (and disabled for end users) for now, but it puts the
2523 infrastructure in place.
2535 infrastructure in place.
2524
2536
2525 2004-08-21 Fernando Perez <fperez@colorado.edu>
2537 2004-08-21 Fernando Perez <fperez@colorado.edu>
2526
2538
2527 * ipythonrc-pylab: Add matplotlib support.
2539 * ipythonrc-pylab: Add matplotlib support.
2528
2540
2529 * matplotlib_config.py: new files for matplotlib support, part of
2541 * matplotlib_config.py: new files for matplotlib support, part of
2530 the pylab profile.
2542 the pylab profile.
2531
2543
2532 * IPython/usage.py (__doc__): documented the threading options.
2544 * IPython/usage.py (__doc__): documented the threading options.
2533
2545
2534 2004-08-20 Fernando Perez <fperez@colorado.edu>
2546 2004-08-20 Fernando Perez <fperez@colorado.edu>
2535
2547
2536 * ipython: Modified the main calling routine to handle the -thread
2548 * ipython: Modified the main calling routine to handle the -thread
2537 and -mpthread options. This needs to be done as a top-level hack,
2549 and -mpthread options. This needs to be done as a top-level hack,
2538 because it determines which class to instantiate for IPython
2550 because it determines which class to instantiate for IPython
2539 itself.
2551 itself.
2540
2552
2541 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2553 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2542 classes to support multithreaded GTK operation without blocking,
2554 classes to support multithreaded GTK operation without blocking,
2543 and matplotlib with all backends. This is a lot of still very
2555 and matplotlib with all backends. This is a lot of still very
2544 experimental code, and threads are tricky. So it may still have a
2556 experimental code, and threads are tricky. So it may still have a
2545 few rough edges... This code owes a lot to
2557 few rough edges... This code owes a lot to
2546 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2558 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2547 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2559 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2548 to John Hunter for all the matplotlib work.
2560 to John Hunter for all the matplotlib work.
2549
2561
2550 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2562 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2551 options for gtk thread and matplotlib support.
2563 options for gtk thread and matplotlib support.
2552
2564
2553 2004-08-16 Fernando Perez <fperez@colorado.edu>
2565 2004-08-16 Fernando Perez <fperez@colorado.edu>
2554
2566
2555 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2567 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2556 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2568 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2557 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2569 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2558
2570
2559 2004-08-11 Fernando Perez <fperez@colorado.edu>
2571 2004-08-11 Fernando Perez <fperez@colorado.edu>
2560
2572
2561 * setup.py (isfile): Fix build so documentation gets updated for
2573 * setup.py (isfile): Fix build so documentation gets updated for
2562 rpms (it was only done for .tgz builds).
2574 rpms (it was only done for .tgz builds).
2563
2575
2564 2004-08-10 Fernando Perez <fperez@colorado.edu>
2576 2004-08-10 Fernando Perez <fperez@colorado.edu>
2565
2577
2566 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2578 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2567
2579
2568 * iplib.py : Silence syntax error exceptions in tab-completion.
2580 * iplib.py : Silence syntax error exceptions in tab-completion.
2569
2581
2570 2004-08-05 Fernando Perez <fperez@colorado.edu>
2582 2004-08-05 Fernando Perez <fperez@colorado.edu>
2571
2583
2572 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2584 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2573 'color off' mark for continuation prompts. This was causing long
2585 'color off' mark for continuation prompts. This was causing long
2574 continuation lines to mis-wrap.
2586 continuation lines to mis-wrap.
2575
2587
2576 2004-08-01 Fernando Perez <fperez@colorado.edu>
2588 2004-08-01 Fernando Perez <fperez@colorado.edu>
2577
2589
2578 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2590 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2579 for building ipython to be a parameter. All this is necessary
2591 for building ipython to be a parameter. All this is necessary
2580 right now to have a multithreaded version, but this insane
2592 right now to have a multithreaded version, but this insane
2581 non-design will be cleaned up soon. For now, it's a hack that
2593 non-design will be cleaned up soon. For now, it's a hack that
2582 works.
2594 works.
2583
2595
2584 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2596 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2585 args in various places. No bugs so far, but it's a dangerous
2597 args in various places. No bugs so far, but it's a dangerous
2586 practice.
2598 practice.
2587
2599
2588 2004-07-31 Fernando Perez <fperez@colorado.edu>
2600 2004-07-31 Fernando Perez <fperez@colorado.edu>
2589
2601
2590 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2602 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2591 fix completion of files with dots in their names under most
2603 fix completion of files with dots in their names under most
2592 profiles (pysh was OK because the completion order is different).
2604 profiles (pysh was OK because the completion order is different).
2593
2605
2594 2004-07-27 Fernando Perez <fperez@colorado.edu>
2606 2004-07-27 Fernando Perez <fperez@colorado.edu>
2595
2607
2596 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2608 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2597 keywords manually, b/c the one in keyword.py was removed in python
2609 keywords manually, b/c the one in keyword.py was removed in python
2598 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2610 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2599 This is NOT a bug under python 2.3 and earlier.
2611 This is NOT a bug under python 2.3 and earlier.
2600
2612
2601 2004-07-26 Fernando Perez <fperez@colorado.edu>
2613 2004-07-26 Fernando Perez <fperez@colorado.edu>
2602
2614
2603 * IPython/ultraTB.py (VerboseTB.text): Add another
2615 * IPython/ultraTB.py (VerboseTB.text): Add another
2604 linecache.checkcache() call to try to prevent inspect.py from
2616 linecache.checkcache() call to try to prevent inspect.py from
2605 crashing under python 2.3. I think this fixes
2617 crashing under python 2.3. I think this fixes
2606 http://www.scipy.net/roundup/ipython/issue17.
2618 http://www.scipy.net/roundup/ipython/issue17.
2607
2619
2608 2004-07-26 *** Released version 0.6.2
2620 2004-07-26 *** Released version 0.6.2
2609
2621
2610 2004-07-26 Fernando Perez <fperez@colorado.edu>
2622 2004-07-26 Fernando Perez <fperez@colorado.edu>
2611
2623
2612 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2624 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2613 fail for any number.
2625 fail for any number.
2614 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2626 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2615 empty bookmarks.
2627 empty bookmarks.
2616
2628
2617 2004-07-26 *** Released version 0.6.1
2629 2004-07-26 *** Released version 0.6.1
2618
2630
2619 2004-07-26 Fernando Perez <fperez@colorado.edu>
2631 2004-07-26 Fernando Perez <fperez@colorado.edu>
2620
2632
2621 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2633 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2622
2634
2623 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2635 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2624 escaping '()[]{}' in filenames.
2636 escaping '()[]{}' in filenames.
2625
2637
2626 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2638 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2627 Python 2.2 users who lack a proper shlex.split.
2639 Python 2.2 users who lack a proper shlex.split.
2628
2640
2629 2004-07-19 Fernando Perez <fperez@colorado.edu>
2641 2004-07-19 Fernando Perez <fperez@colorado.edu>
2630
2642
2631 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2643 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2632 for reading readline's init file. I follow the normal chain:
2644 for reading readline's init file. I follow the normal chain:
2633 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2645 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2634 report by Mike Heeter. This closes
2646 report by Mike Heeter. This closes
2635 http://www.scipy.net/roundup/ipython/issue16.
2647 http://www.scipy.net/roundup/ipython/issue16.
2636
2648
2637 2004-07-18 Fernando Perez <fperez@colorado.edu>
2649 2004-07-18 Fernando Perez <fperez@colorado.edu>
2638
2650
2639 * IPython/iplib.py (__init__): Add better handling of '\' under
2651 * IPython/iplib.py (__init__): Add better handling of '\' under
2640 Win32 for filenames. After a patch by Ville.
2652 Win32 for filenames. After a patch by Ville.
2641
2653
2642 2004-07-17 Fernando Perez <fperez@colorado.edu>
2654 2004-07-17 Fernando Perez <fperez@colorado.edu>
2643
2655
2644 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2656 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2645 autocalling would be triggered for 'foo is bar' if foo is
2657 autocalling would be triggered for 'foo is bar' if foo is
2646 callable. I also cleaned up the autocall detection code to use a
2658 callable. I also cleaned up the autocall detection code to use a
2647 regexp, which is faster. Bug reported by Alexander Schmolck.
2659 regexp, which is faster. Bug reported by Alexander Schmolck.
2648
2660
2649 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2661 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2650 '?' in them would confuse the help system. Reported by Alex
2662 '?' in them would confuse the help system. Reported by Alex
2651 Schmolck.
2663 Schmolck.
2652
2664
2653 2004-07-16 Fernando Perez <fperez@colorado.edu>
2665 2004-07-16 Fernando Perez <fperez@colorado.edu>
2654
2666
2655 * IPython/GnuplotInteractive.py (__all__): added plot2.
2667 * IPython/GnuplotInteractive.py (__all__): added plot2.
2656
2668
2657 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2669 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2658 plotting dictionaries, lists or tuples of 1d arrays.
2670 plotting dictionaries, lists or tuples of 1d arrays.
2659
2671
2660 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2672 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2661 optimizations.
2673 optimizations.
2662
2674
2663 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2675 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2664 the information which was there from Janko's original IPP code:
2676 the information which was there from Janko's original IPP code:
2665
2677
2666 03.05.99 20:53 porto.ifm.uni-kiel.de
2678 03.05.99 20:53 porto.ifm.uni-kiel.de
2667 --Started changelog.
2679 --Started changelog.
2668 --make clear do what it say it does
2680 --make clear do what it say it does
2669 --added pretty output of lines from inputcache
2681 --added pretty output of lines from inputcache
2670 --Made Logger a mixin class, simplifies handling of switches
2682 --Made Logger a mixin class, simplifies handling of switches
2671 --Added own completer class. .string<TAB> expands to last history
2683 --Added own completer class. .string<TAB> expands to last history
2672 line which starts with string. The new expansion is also present
2684 line which starts with string. The new expansion is also present
2673 with Ctrl-r from the readline library. But this shows, who this
2685 with Ctrl-r from the readline library. But this shows, who this
2674 can be done for other cases.
2686 can be done for other cases.
2675 --Added convention that all shell functions should accept a
2687 --Added convention that all shell functions should accept a
2676 parameter_string This opens the door for different behaviour for
2688 parameter_string This opens the door for different behaviour for
2677 each function. @cd is a good example of this.
2689 each function. @cd is a good example of this.
2678
2690
2679 04.05.99 12:12 porto.ifm.uni-kiel.de
2691 04.05.99 12:12 porto.ifm.uni-kiel.de
2680 --added logfile rotation
2692 --added logfile rotation
2681 --added new mainloop method which freezes first the namespace
2693 --added new mainloop method which freezes first the namespace
2682
2694
2683 07.05.99 21:24 porto.ifm.uni-kiel.de
2695 07.05.99 21:24 porto.ifm.uni-kiel.de
2684 --added the docreader classes. Now there is a help system.
2696 --added the docreader classes. Now there is a help system.
2685 -This is only a first try. Currently it's not easy to put new
2697 -This is only a first try. Currently it's not easy to put new
2686 stuff in the indices. But this is the way to go. Info would be
2698 stuff in the indices. But this is the way to go. Info would be
2687 better, but HTML is every where and not everybody has an info
2699 better, but HTML is every where and not everybody has an info
2688 system installed and it's not so easy to change html-docs to info.
2700 system installed and it's not so easy to change html-docs to info.
2689 --added global logfile option
2701 --added global logfile option
2690 --there is now a hook for object inspection method pinfo needs to
2702 --there is now a hook for object inspection method pinfo needs to
2691 be provided for this. Can be reached by two '??'.
2703 be provided for this. Can be reached by two '??'.
2692
2704
2693 08.05.99 20:51 porto.ifm.uni-kiel.de
2705 08.05.99 20:51 porto.ifm.uni-kiel.de
2694 --added a README
2706 --added a README
2695 --bug in rc file. Something has changed so functions in the rc
2707 --bug in rc file. Something has changed so functions in the rc
2696 file need to reference the shell and not self. Not clear if it's a
2708 file need to reference the shell and not self. Not clear if it's a
2697 bug or feature.
2709 bug or feature.
2698 --changed rc file for new behavior
2710 --changed rc file for new behavior
2699
2711
2700 2004-07-15 Fernando Perez <fperez@colorado.edu>
2712 2004-07-15 Fernando Perez <fperez@colorado.edu>
2701
2713
2702 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2714 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2703 cache was falling out of sync in bizarre manners when multi-line
2715 cache was falling out of sync in bizarre manners when multi-line
2704 input was present. Minor optimizations and cleanup.
2716 input was present. Minor optimizations and cleanup.
2705
2717
2706 (Logger): Remove old Changelog info for cleanup. This is the
2718 (Logger): Remove old Changelog info for cleanup. This is the
2707 information which was there from Janko's original code:
2719 information which was there from Janko's original code:
2708
2720
2709 Changes to Logger: - made the default log filename a parameter
2721 Changes to Logger: - made the default log filename a parameter
2710
2722
2711 - put a check for lines beginning with !@? in log(). Needed
2723 - put a check for lines beginning with !@? in log(). Needed
2712 (even if the handlers properly log their lines) for mid-session
2724 (even if the handlers properly log their lines) for mid-session
2713 logging activation to work properly. Without this, lines logged
2725 logging activation to work properly. Without this, lines logged
2714 in mid session, which get read from the cache, would end up
2726 in mid session, which get read from the cache, would end up
2715 'bare' (with !@? in the open) in the log. Now they are caught
2727 'bare' (with !@? in the open) in the log. Now they are caught
2716 and prepended with a #.
2728 and prepended with a #.
2717
2729
2718 * IPython/iplib.py (InteractiveShell.init_readline): added check
2730 * IPython/iplib.py (InteractiveShell.init_readline): added check
2719 in case MagicCompleter fails to be defined, so we don't crash.
2731 in case MagicCompleter fails to be defined, so we don't crash.
2720
2732
2721 2004-07-13 Fernando Perez <fperez@colorado.edu>
2733 2004-07-13 Fernando Perez <fperez@colorado.edu>
2722
2734
2723 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2735 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2724 of EPS if the requested filename ends in '.eps'.
2736 of EPS if the requested filename ends in '.eps'.
2725
2737
2726 2004-07-04 Fernando Perez <fperez@colorado.edu>
2738 2004-07-04 Fernando Perez <fperez@colorado.edu>
2727
2739
2728 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2740 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2729 escaping of quotes when calling the shell.
2741 escaping of quotes when calling the shell.
2730
2742
2731 2004-07-02 Fernando Perez <fperez@colorado.edu>
2743 2004-07-02 Fernando Perez <fperez@colorado.edu>
2732
2744
2733 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2745 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2734 gettext not working because we were clobbering '_'. Fixes
2746 gettext not working because we were clobbering '_'. Fixes
2735 http://www.scipy.net/roundup/ipython/issue6.
2747 http://www.scipy.net/roundup/ipython/issue6.
2736
2748
2737 2004-07-01 Fernando Perez <fperez@colorado.edu>
2749 2004-07-01 Fernando Perez <fperez@colorado.edu>
2738
2750
2739 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2751 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2740 into @cd. Patch by Ville.
2752 into @cd. Patch by Ville.
2741
2753
2742 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2754 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2743 new function to store things after ipmaker runs. Patch by Ville.
2755 new function to store things after ipmaker runs. Patch by Ville.
2744 Eventually this will go away once ipmaker is removed and the class
2756 Eventually this will go away once ipmaker is removed and the class
2745 gets cleaned up, but for now it's ok. Key functionality here is
2757 gets cleaned up, but for now it's ok. Key functionality here is
2746 the addition of the persistent storage mechanism, a dict for
2758 the addition of the persistent storage mechanism, a dict for
2747 keeping data across sessions (for now just bookmarks, but more can
2759 keeping data across sessions (for now just bookmarks, but more can
2748 be implemented later).
2760 be implemented later).
2749
2761
2750 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2762 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2751 persistent across sections. Patch by Ville, I modified it
2763 persistent across sections. Patch by Ville, I modified it
2752 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2764 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2753 added a '-l' option to list all bookmarks.
2765 added a '-l' option to list all bookmarks.
2754
2766
2755 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2767 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2756 center for cleanup. Registered with atexit.register(). I moved
2768 center for cleanup. Registered with atexit.register(). I moved
2757 here the old exit_cleanup(). After a patch by Ville.
2769 here the old exit_cleanup(). After a patch by Ville.
2758
2770
2759 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2771 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2760 characters in the hacked shlex_split for python 2.2.
2772 characters in the hacked shlex_split for python 2.2.
2761
2773
2762 * IPython/iplib.py (file_matches): more fixes to filenames with
2774 * IPython/iplib.py (file_matches): more fixes to filenames with
2763 whitespace in them. It's not perfect, but limitations in python's
2775 whitespace in them. It's not perfect, but limitations in python's
2764 readline make it impossible to go further.
2776 readline make it impossible to go further.
2765
2777
2766 2004-06-29 Fernando Perez <fperez@colorado.edu>
2778 2004-06-29 Fernando Perez <fperez@colorado.edu>
2767
2779
2768 * IPython/iplib.py (file_matches): escape whitespace correctly in
2780 * IPython/iplib.py (file_matches): escape whitespace correctly in
2769 filename completions. Bug reported by Ville.
2781 filename completions. Bug reported by Ville.
2770
2782
2771 2004-06-28 Fernando Perez <fperez@colorado.edu>
2783 2004-06-28 Fernando Perez <fperez@colorado.edu>
2772
2784
2773 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2785 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2774 the history file will be called 'history-PROFNAME' (or just
2786 the history file will be called 'history-PROFNAME' (or just
2775 'history' if no profile is loaded). I was getting annoyed at
2787 'history' if no profile is loaded). I was getting annoyed at
2776 getting my Numerical work history clobbered by pysh sessions.
2788 getting my Numerical work history clobbered by pysh sessions.
2777
2789
2778 * IPython/iplib.py (InteractiveShell.__init__): Internal
2790 * IPython/iplib.py (InteractiveShell.__init__): Internal
2779 getoutputerror() function so that we can honor the system_verbose
2791 getoutputerror() function so that we can honor the system_verbose
2780 flag for _all_ system calls. I also added escaping of #
2792 flag for _all_ system calls. I also added escaping of #
2781 characters here to avoid confusing Itpl.
2793 characters here to avoid confusing Itpl.
2782
2794
2783 * IPython/Magic.py (shlex_split): removed call to shell in
2795 * IPython/Magic.py (shlex_split): removed call to shell in
2784 parse_options and replaced it with shlex.split(). The annoying
2796 parse_options and replaced it with shlex.split(). The annoying
2785 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2797 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2786 to backport it from 2.3, with several frail hacks (the shlex
2798 to backport it from 2.3, with several frail hacks (the shlex
2787 module is rather limited in 2.2). Thanks to a suggestion by Ville
2799 module is rather limited in 2.2). Thanks to a suggestion by Ville
2788 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2800 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2789 problem.
2801 problem.
2790
2802
2791 (Magic.magic_system_verbose): new toggle to print the actual
2803 (Magic.magic_system_verbose): new toggle to print the actual
2792 system calls made by ipython. Mainly for debugging purposes.
2804 system calls made by ipython. Mainly for debugging purposes.
2793
2805
2794 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2806 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2795 doesn't support persistence. Reported (and fix suggested) by
2807 doesn't support persistence. Reported (and fix suggested) by
2796 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2808 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2797
2809
2798 2004-06-26 Fernando Perez <fperez@colorado.edu>
2810 2004-06-26 Fernando Perez <fperez@colorado.edu>
2799
2811
2800 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2812 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2801 continue prompts.
2813 continue prompts.
2802
2814
2803 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2815 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2804 function (basically a big docstring) and a few more things here to
2816 function (basically a big docstring) and a few more things here to
2805 speedup startup. pysh.py is now very lightweight. We want because
2817 speedup startup. pysh.py is now very lightweight. We want because
2806 it gets execfile'd, while InterpreterExec gets imported, so
2818 it gets execfile'd, while InterpreterExec gets imported, so
2807 byte-compilation saves time.
2819 byte-compilation saves time.
2808
2820
2809 2004-06-25 Fernando Perez <fperez@colorado.edu>
2821 2004-06-25 Fernando Perez <fperez@colorado.edu>
2810
2822
2811 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2823 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2812 -NUM', which was recently broken.
2824 -NUM', which was recently broken.
2813
2825
2814 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2826 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2815 in multi-line input (but not !!, which doesn't make sense there).
2827 in multi-line input (but not !!, which doesn't make sense there).
2816
2828
2817 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2829 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2818 It's just too useful, and people can turn it off in the less
2830 It's just too useful, and people can turn it off in the less
2819 common cases where it's a problem.
2831 common cases where it's a problem.
2820
2832
2821 2004-06-24 Fernando Perez <fperez@colorado.edu>
2833 2004-06-24 Fernando Perez <fperez@colorado.edu>
2822
2834
2823 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2835 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2824 special syntaxes (like alias calling) is now allied in multi-line
2836 special syntaxes (like alias calling) is now allied in multi-line
2825 input. This is still _very_ experimental, but it's necessary for
2837 input. This is still _very_ experimental, but it's necessary for
2826 efficient shell usage combining python looping syntax with system
2838 efficient shell usage combining python looping syntax with system
2827 calls. For now it's restricted to aliases, I don't think it
2839 calls. For now it's restricted to aliases, I don't think it
2828 really even makes sense to have this for magics.
2840 really even makes sense to have this for magics.
2829
2841
2830 2004-06-23 Fernando Perez <fperez@colorado.edu>
2842 2004-06-23 Fernando Perez <fperez@colorado.edu>
2831
2843
2832 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2844 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2833 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2845 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2834
2846
2835 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2847 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2836 extensions under Windows (after code sent by Gary Bishop). The
2848 extensions under Windows (after code sent by Gary Bishop). The
2837 extensions considered 'executable' are stored in IPython's rc
2849 extensions considered 'executable' are stored in IPython's rc
2838 structure as win_exec_ext.
2850 structure as win_exec_ext.
2839
2851
2840 * IPython/genutils.py (shell): new function, like system() but
2852 * IPython/genutils.py (shell): new function, like system() but
2841 without return value. Very useful for interactive shell work.
2853 without return value. Very useful for interactive shell work.
2842
2854
2843 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2855 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2844 delete aliases.
2856 delete aliases.
2845
2857
2846 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2858 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2847 sure that the alias table doesn't contain python keywords.
2859 sure that the alias table doesn't contain python keywords.
2848
2860
2849 2004-06-21 Fernando Perez <fperez@colorado.edu>
2861 2004-06-21 Fernando Perez <fperez@colorado.edu>
2850
2862
2851 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2863 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2852 non-existent items are found in $PATH. Reported by Thorsten.
2864 non-existent items are found in $PATH. Reported by Thorsten.
2853
2865
2854 2004-06-20 Fernando Perez <fperez@colorado.edu>
2866 2004-06-20 Fernando Perez <fperez@colorado.edu>
2855
2867
2856 * IPython/iplib.py (complete): modified the completer so that the
2868 * IPython/iplib.py (complete): modified the completer so that the
2857 order of priorities can be easily changed at runtime.
2869 order of priorities can be easily changed at runtime.
2858
2870
2859 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2871 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2860 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2872 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2861
2873
2862 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2874 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2863 expand Python variables prepended with $ in all system calls. The
2875 expand Python variables prepended with $ in all system calls. The
2864 same was done to InteractiveShell.handle_shell_escape. Now all
2876 same was done to InteractiveShell.handle_shell_escape. Now all
2865 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2877 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2866 expansion of python variables and expressions according to the
2878 expansion of python variables and expressions according to the
2867 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2879 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2868
2880
2869 Though PEP-215 has been rejected, a similar (but simpler) one
2881 Though PEP-215 has been rejected, a similar (but simpler) one
2870 seems like it will go into Python 2.4, PEP-292 -
2882 seems like it will go into Python 2.4, PEP-292 -
2871 http://www.python.org/peps/pep-0292.html.
2883 http://www.python.org/peps/pep-0292.html.
2872
2884
2873 I'll keep the full syntax of PEP-215, since IPython has since the
2885 I'll keep the full syntax of PEP-215, since IPython has since the
2874 start used Ka-Ping Yee's reference implementation discussed there
2886 start used Ka-Ping Yee's reference implementation discussed there
2875 (Itpl), and I actually like the powerful semantics it offers.
2887 (Itpl), and I actually like the powerful semantics it offers.
2876
2888
2877 In order to access normal shell variables, the $ has to be escaped
2889 In order to access normal shell variables, the $ has to be escaped
2878 via an extra $. For example:
2890 via an extra $. For example:
2879
2891
2880 In [7]: PATH='a python variable'
2892 In [7]: PATH='a python variable'
2881
2893
2882 In [8]: !echo $PATH
2894 In [8]: !echo $PATH
2883 a python variable
2895 a python variable
2884
2896
2885 In [9]: !echo $$PATH
2897 In [9]: !echo $$PATH
2886 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2898 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2887
2899
2888 (Magic.parse_options): escape $ so the shell doesn't evaluate
2900 (Magic.parse_options): escape $ so the shell doesn't evaluate
2889 things prematurely.
2901 things prematurely.
2890
2902
2891 * IPython/iplib.py (InteractiveShell.call_alias): added the
2903 * IPython/iplib.py (InteractiveShell.call_alias): added the
2892 ability for aliases to expand python variables via $.
2904 ability for aliases to expand python variables via $.
2893
2905
2894 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2906 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2895 system, now there's a @rehash/@rehashx pair of magics. These work
2907 system, now there's a @rehash/@rehashx pair of magics. These work
2896 like the csh rehash command, and can be invoked at any time. They
2908 like the csh rehash command, and can be invoked at any time. They
2897 build a table of aliases to everything in the user's $PATH
2909 build a table of aliases to everything in the user's $PATH
2898 (@rehash uses everything, @rehashx is slower but only adds
2910 (@rehash uses everything, @rehashx is slower but only adds
2899 executable files). With this, the pysh.py-based shell profile can
2911 executable files). With this, the pysh.py-based shell profile can
2900 now simply call rehash upon startup, and full access to all
2912 now simply call rehash upon startup, and full access to all
2901 programs in the user's path is obtained.
2913 programs in the user's path is obtained.
2902
2914
2903 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2915 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2904 functionality is now fully in place. I removed the old dynamic
2916 functionality is now fully in place. I removed the old dynamic
2905 code generation based approach, in favor of a much lighter one
2917 code generation based approach, in favor of a much lighter one
2906 based on a simple dict. The advantage is that this allows me to
2918 based on a simple dict. The advantage is that this allows me to
2907 now have thousands of aliases with negligible cost (unthinkable
2919 now have thousands of aliases with negligible cost (unthinkable
2908 with the old system).
2920 with the old system).
2909
2921
2910 2004-06-19 Fernando Perez <fperez@colorado.edu>
2922 2004-06-19 Fernando Perez <fperez@colorado.edu>
2911
2923
2912 * IPython/iplib.py (__init__): extended MagicCompleter class to
2924 * IPython/iplib.py (__init__): extended MagicCompleter class to
2913 also complete (last in priority) on user aliases.
2925 also complete (last in priority) on user aliases.
2914
2926
2915 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2927 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2916 call to eval.
2928 call to eval.
2917 (ItplNS.__init__): Added a new class which functions like Itpl,
2929 (ItplNS.__init__): Added a new class which functions like Itpl,
2918 but allows configuring the namespace for the evaluation to occur
2930 but allows configuring the namespace for the evaluation to occur
2919 in.
2931 in.
2920
2932
2921 2004-06-18 Fernando Perez <fperez@colorado.edu>
2933 2004-06-18 Fernando Perez <fperez@colorado.edu>
2922
2934
2923 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2935 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2924 better message when 'exit' or 'quit' are typed (a common newbie
2936 better message when 'exit' or 'quit' are typed (a common newbie
2925 confusion).
2937 confusion).
2926
2938
2927 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2939 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2928 check for Windows users.
2940 check for Windows users.
2929
2941
2930 * IPython/iplib.py (InteractiveShell.user_setup): removed
2942 * IPython/iplib.py (InteractiveShell.user_setup): removed
2931 disabling of colors for Windows. I'll test at runtime and issue a
2943 disabling of colors for Windows. I'll test at runtime and issue a
2932 warning if Gary's readline isn't found, as to nudge users to
2944 warning if Gary's readline isn't found, as to nudge users to
2933 download it.
2945 download it.
2934
2946
2935 2004-06-16 Fernando Perez <fperez@colorado.edu>
2947 2004-06-16 Fernando Perez <fperez@colorado.edu>
2936
2948
2937 * IPython/genutils.py (Stream.__init__): changed to print errors
2949 * IPython/genutils.py (Stream.__init__): changed to print errors
2938 to sys.stderr. I had a circular dependency here. Now it's
2950 to sys.stderr. I had a circular dependency here. Now it's
2939 possible to run ipython as IDLE's shell (consider this pre-alpha,
2951 possible to run ipython as IDLE's shell (consider this pre-alpha,
2940 since true stdout things end up in the starting terminal instead
2952 since true stdout things end up in the starting terminal instead
2941 of IDLE's out).
2953 of IDLE's out).
2942
2954
2943 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2955 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2944 users who haven't # updated their prompt_in2 definitions. Remove
2956 users who haven't # updated their prompt_in2 definitions. Remove
2945 eventually.
2957 eventually.
2946 (multiple_replace): added credit to original ASPN recipe.
2958 (multiple_replace): added credit to original ASPN recipe.
2947
2959
2948 2004-06-15 Fernando Perez <fperez@colorado.edu>
2960 2004-06-15 Fernando Perez <fperez@colorado.edu>
2949
2961
2950 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2962 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2951 list of auto-defined aliases.
2963 list of auto-defined aliases.
2952
2964
2953 2004-06-13 Fernando Perez <fperez@colorado.edu>
2965 2004-06-13 Fernando Perez <fperez@colorado.edu>
2954
2966
2955 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2967 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2956 install was really requested (so setup.py can be used for other
2968 install was really requested (so setup.py can be used for other
2957 things under Windows).
2969 things under Windows).
2958
2970
2959 2004-06-10 Fernando Perez <fperez@colorado.edu>
2971 2004-06-10 Fernando Perez <fperez@colorado.edu>
2960
2972
2961 * IPython/Logger.py (Logger.create_log): Manually remove any old
2973 * IPython/Logger.py (Logger.create_log): Manually remove any old
2962 backup, since os.remove may fail under Windows. Fixes bug
2974 backup, since os.remove may fail under Windows. Fixes bug
2963 reported by Thorsten.
2975 reported by Thorsten.
2964
2976
2965 2004-06-09 Fernando Perez <fperez@colorado.edu>
2977 2004-06-09 Fernando Perez <fperez@colorado.edu>
2966
2978
2967 * examples/example-embed.py: fixed all references to %n (replaced
2979 * examples/example-embed.py: fixed all references to %n (replaced
2968 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2980 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2969 for all examples and the manual as well.
2981 for all examples and the manual as well.
2970
2982
2971 2004-06-08 Fernando Perez <fperez@colorado.edu>
2983 2004-06-08 Fernando Perez <fperez@colorado.edu>
2972
2984
2973 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2985 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2974 alignment and color management. All 3 prompt subsystems now
2986 alignment and color management. All 3 prompt subsystems now
2975 inherit from BasePrompt.
2987 inherit from BasePrompt.
2976
2988
2977 * tools/release: updates for windows installer build and tag rpms
2989 * tools/release: updates for windows installer build and tag rpms
2978 with python version (since paths are fixed).
2990 with python version (since paths are fixed).
2979
2991
2980 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2992 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2981 which will become eventually obsolete. Also fixed the default
2993 which will become eventually obsolete. Also fixed the default
2982 prompt_in2 to use \D, so at least new users start with the correct
2994 prompt_in2 to use \D, so at least new users start with the correct
2983 defaults.
2995 defaults.
2984 WARNING: Users with existing ipythonrc files will need to apply
2996 WARNING: Users with existing ipythonrc files will need to apply
2985 this fix manually!
2997 this fix manually!
2986
2998
2987 * setup.py: make windows installer (.exe). This is finally the
2999 * setup.py: make windows installer (.exe). This is finally the
2988 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3000 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2989 which I hadn't included because it required Python 2.3 (or recent
3001 which I hadn't included because it required Python 2.3 (or recent
2990 distutils).
3002 distutils).
2991
3003
2992 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3004 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2993 usage of new '\D' escape.
3005 usage of new '\D' escape.
2994
3006
2995 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3007 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2996 lacks os.getuid())
3008 lacks os.getuid())
2997 (CachedOutput.set_colors): Added the ability to turn coloring
3009 (CachedOutput.set_colors): Added the ability to turn coloring
2998 on/off with @colors even for manually defined prompt colors. It
3010 on/off with @colors even for manually defined prompt colors. It
2999 uses a nasty global, but it works safely and via the generic color
3011 uses a nasty global, but it works safely and via the generic color
3000 handling mechanism.
3012 handling mechanism.
3001 (Prompt2.__init__): Introduced new escape '\D' for continuation
3013 (Prompt2.__init__): Introduced new escape '\D' for continuation
3002 prompts. It represents the counter ('\#') as dots.
3014 prompts. It represents the counter ('\#') as dots.
3003 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3015 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3004 need to update their ipythonrc files and replace '%n' with '\D' in
3016 need to update their ipythonrc files and replace '%n' with '\D' in
3005 their prompt_in2 settings everywhere. Sorry, but there's
3017 their prompt_in2 settings everywhere. Sorry, but there's
3006 otherwise no clean way to get all prompts to properly align. The
3018 otherwise no clean way to get all prompts to properly align. The
3007 ipythonrc shipped with IPython has been updated.
3019 ipythonrc shipped with IPython has been updated.
3008
3020
3009 2004-06-07 Fernando Perez <fperez@colorado.edu>
3021 2004-06-07 Fernando Perez <fperez@colorado.edu>
3010
3022
3011 * setup.py (isfile): Pass local_icons option to latex2html, so the
3023 * setup.py (isfile): Pass local_icons option to latex2html, so the
3012 resulting HTML file is self-contained. Thanks to
3024 resulting HTML file is self-contained. Thanks to
3013 dryice-AT-liu.com.cn for the tip.
3025 dryice-AT-liu.com.cn for the tip.
3014
3026
3015 * pysh.py: I created a new profile 'shell', which implements a
3027 * pysh.py: I created a new profile 'shell', which implements a
3016 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3028 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3017 system shell, nor will it become one anytime soon. It's mainly
3029 system shell, nor will it become one anytime soon. It's mainly
3018 meant to illustrate the use of the new flexible bash-like prompts.
3030 meant to illustrate the use of the new flexible bash-like prompts.
3019 I guess it could be used by hardy souls for true shell management,
3031 I guess it could be used by hardy souls for true shell management,
3020 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3032 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3021 profile. This uses the InterpreterExec extension provided by
3033 profile. This uses the InterpreterExec extension provided by
3022 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3034 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3023
3035
3024 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3036 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3025 auto-align itself with the length of the previous input prompt
3037 auto-align itself with the length of the previous input prompt
3026 (taking into account the invisible color escapes).
3038 (taking into account the invisible color escapes).
3027 (CachedOutput.__init__): Large restructuring of this class. Now
3039 (CachedOutput.__init__): Large restructuring of this class. Now
3028 all three prompts (primary1, primary2, output) are proper objects,
3040 all three prompts (primary1, primary2, output) are proper objects,
3029 managed by the 'parent' CachedOutput class. The code is still a
3041 managed by the 'parent' CachedOutput class. The code is still a
3030 bit hackish (all prompts share state via a pointer to the cache),
3042 bit hackish (all prompts share state via a pointer to the cache),
3031 but it's overall far cleaner than before.
3043 but it's overall far cleaner than before.
3032
3044
3033 * IPython/genutils.py (getoutputerror): modified to add verbose,
3045 * IPython/genutils.py (getoutputerror): modified to add verbose,
3034 debug and header options. This makes the interface of all getout*
3046 debug and header options. This makes the interface of all getout*
3035 functions uniform.
3047 functions uniform.
3036 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3048 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3037
3049
3038 * IPython/Magic.py (Magic.default_option): added a function to
3050 * IPython/Magic.py (Magic.default_option): added a function to
3039 allow registering default options for any magic command. This
3051 allow registering default options for any magic command. This
3040 makes it easy to have profiles which customize the magics globally
3052 makes it easy to have profiles which customize the magics globally
3041 for a certain use. The values set through this function are
3053 for a certain use. The values set through this function are
3042 picked up by the parse_options() method, which all magics should
3054 picked up by the parse_options() method, which all magics should
3043 use to parse their options.
3055 use to parse their options.
3044
3056
3045 * IPython/genutils.py (warn): modified the warnings framework to
3057 * IPython/genutils.py (warn): modified the warnings framework to
3046 use the Term I/O class. I'm trying to slowly unify all of
3058 use the Term I/O class. I'm trying to slowly unify all of
3047 IPython's I/O operations to pass through Term.
3059 IPython's I/O operations to pass through Term.
3048
3060
3049 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3061 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3050 the secondary prompt to correctly match the length of the primary
3062 the secondary prompt to correctly match the length of the primary
3051 one for any prompt. Now multi-line code will properly line up
3063 one for any prompt. Now multi-line code will properly line up
3052 even for path dependent prompts, such as the new ones available
3064 even for path dependent prompts, such as the new ones available
3053 via the prompt_specials.
3065 via the prompt_specials.
3054
3066
3055 2004-06-06 Fernando Perez <fperez@colorado.edu>
3067 2004-06-06 Fernando Perez <fperez@colorado.edu>
3056
3068
3057 * IPython/Prompts.py (prompt_specials): Added the ability to have
3069 * IPython/Prompts.py (prompt_specials): Added the ability to have
3058 bash-like special sequences in the prompts, which get
3070 bash-like special sequences in the prompts, which get
3059 automatically expanded. Things like hostname, current working
3071 automatically expanded. Things like hostname, current working
3060 directory and username are implemented already, but it's easy to
3072 directory and username are implemented already, but it's easy to
3061 add more in the future. Thanks to a patch by W.J. van der Laan
3073 add more in the future. Thanks to a patch by W.J. van der Laan
3062 <gnufnork-AT-hetdigitalegat.nl>
3074 <gnufnork-AT-hetdigitalegat.nl>
3063 (prompt_specials): Added color support for prompt strings, so
3075 (prompt_specials): Added color support for prompt strings, so
3064 users can define arbitrary color setups for their prompts.
3076 users can define arbitrary color setups for their prompts.
3065
3077
3066 2004-06-05 Fernando Perez <fperez@colorado.edu>
3078 2004-06-05 Fernando Perez <fperez@colorado.edu>
3067
3079
3068 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3080 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3069 code to load Gary Bishop's readline and configure it
3081 code to load Gary Bishop's readline and configure it
3070 automatically. Thanks to Gary for help on this.
3082 automatically. Thanks to Gary for help on this.
3071
3083
3072 2004-06-01 Fernando Perez <fperez@colorado.edu>
3084 2004-06-01 Fernando Perez <fperez@colorado.edu>
3073
3085
3074 * IPython/Logger.py (Logger.create_log): fix bug for logging
3086 * IPython/Logger.py (Logger.create_log): fix bug for logging
3075 with no filename (previous fix was incomplete).
3087 with no filename (previous fix was incomplete).
3076
3088
3077 2004-05-25 Fernando Perez <fperez@colorado.edu>
3089 2004-05-25 Fernando Perez <fperez@colorado.edu>
3078
3090
3079 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3091 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3080 parens would get passed to the shell.
3092 parens would get passed to the shell.
3081
3093
3082 2004-05-20 Fernando Perez <fperez@colorado.edu>
3094 2004-05-20 Fernando Perez <fperez@colorado.edu>
3083
3095
3084 * IPython/Magic.py (Magic.magic_prun): changed default profile
3096 * IPython/Magic.py (Magic.magic_prun): changed default profile
3085 sort order to 'time' (the more common profiling need).
3097 sort order to 'time' (the more common profiling need).
3086
3098
3087 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3099 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3088 so that source code shown is guaranteed in sync with the file on
3100 so that source code shown is guaranteed in sync with the file on
3089 disk (also changed in psource). Similar fix to the one for
3101 disk (also changed in psource). Similar fix to the one for
3090 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3102 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3091 <yann.ledu-AT-noos.fr>.
3103 <yann.ledu-AT-noos.fr>.
3092
3104
3093 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3105 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3094 with a single option would not be correctly parsed. Closes
3106 with a single option would not be correctly parsed. Closes
3095 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3107 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3096 introduced in 0.6.0 (on 2004-05-06).
3108 introduced in 0.6.0 (on 2004-05-06).
3097
3109
3098 2004-05-13 *** Released version 0.6.0
3110 2004-05-13 *** Released version 0.6.0
3099
3111
3100 2004-05-13 Fernando Perez <fperez@colorado.edu>
3112 2004-05-13 Fernando Perez <fperez@colorado.edu>
3101
3113
3102 * debian/: Added debian/ directory to CVS, so that debian support
3114 * debian/: Added debian/ directory to CVS, so that debian support
3103 is publicly accessible. The debian package is maintained by Jack
3115 is publicly accessible. The debian package is maintained by Jack
3104 Moffit <jack-AT-xiph.org>.
3116 Moffit <jack-AT-xiph.org>.
3105
3117
3106 * Documentation: included the notes about an ipython-based system
3118 * Documentation: included the notes about an ipython-based system
3107 shell (the hypothetical 'pysh') into the new_design.pdf document,
3119 shell (the hypothetical 'pysh') into the new_design.pdf document,
3108 so that these ideas get distributed to users along with the
3120 so that these ideas get distributed to users along with the
3109 official documentation.
3121 official documentation.
3110
3122
3111 2004-05-10 Fernando Perez <fperez@colorado.edu>
3123 2004-05-10 Fernando Perez <fperez@colorado.edu>
3112
3124
3113 * IPython/Logger.py (Logger.create_log): fix recently introduced
3125 * IPython/Logger.py (Logger.create_log): fix recently introduced
3114 bug (misindented line) where logstart would fail when not given an
3126 bug (misindented line) where logstart would fail when not given an
3115 explicit filename.
3127 explicit filename.
3116
3128
3117 2004-05-09 Fernando Perez <fperez@colorado.edu>
3129 2004-05-09 Fernando Perez <fperez@colorado.edu>
3118
3130
3119 * IPython/Magic.py (Magic.parse_options): skip system call when
3131 * IPython/Magic.py (Magic.parse_options): skip system call when
3120 there are no options to look for. Faster, cleaner for the common
3132 there are no options to look for. Faster, cleaner for the common
3121 case.
3133 case.
3122
3134
3123 * Documentation: many updates to the manual: describing Windows
3135 * Documentation: many updates to the manual: describing Windows
3124 support better, Gnuplot updates, credits, misc small stuff. Also
3136 support better, Gnuplot updates, credits, misc small stuff. Also
3125 updated the new_design doc a bit.
3137 updated the new_design doc a bit.
3126
3138
3127 2004-05-06 *** Released version 0.6.0.rc1
3139 2004-05-06 *** Released version 0.6.0.rc1
3128
3140
3129 2004-05-06 Fernando Perez <fperez@colorado.edu>
3141 2004-05-06 Fernando Perez <fperez@colorado.edu>
3130
3142
3131 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3143 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3132 operations to use the vastly more efficient list/''.join() method.
3144 operations to use the vastly more efficient list/''.join() method.
3133 (FormattedTB.text): Fix
3145 (FormattedTB.text): Fix
3134 http://www.scipy.net/roundup/ipython/issue12 - exception source
3146 http://www.scipy.net/roundup/ipython/issue12 - exception source
3135 extract not updated after reload. Thanks to Mike Salib
3147 extract not updated after reload. Thanks to Mike Salib
3136 <msalib-AT-mit.edu> for pinning the source of the problem.
3148 <msalib-AT-mit.edu> for pinning the source of the problem.
3137 Fortunately, the solution works inside ipython and doesn't require
3149 Fortunately, the solution works inside ipython and doesn't require
3138 any changes to python proper.
3150 any changes to python proper.
3139
3151
3140 * IPython/Magic.py (Magic.parse_options): Improved to process the
3152 * IPython/Magic.py (Magic.parse_options): Improved to process the
3141 argument list as a true shell would (by actually using the
3153 argument list as a true shell would (by actually using the
3142 underlying system shell). This way, all @magics automatically get
3154 underlying system shell). This way, all @magics automatically get
3143 shell expansion for variables. Thanks to a comment by Alex
3155 shell expansion for variables. Thanks to a comment by Alex
3144 Schmolck.
3156 Schmolck.
3145
3157
3146 2004-04-04 Fernando Perez <fperez@colorado.edu>
3158 2004-04-04 Fernando Perez <fperez@colorado.edu>
3147
3159
3148 * IPython/iplib.py (InteractiveShell.interact): Added a special
3160 * IPython/iplib.py (InteractiveShell.interact): Added a special
3149 trap for a debugger quit exception, which is basically impossible
3161 trap for a debugger quit exception, which is basically impossible
3150 to handle by normal mechanisms, given what pdb does to the stack.
3162 to handle by normal mechanisms, given what pdb does to the stack.
3151 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3163 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3152
3164
3153 2004-04-03 Fernando Perez <fperez@colorado.edu>
3165 2004-04-03 Fernando Perez <fperez@colorado.edu>
3154
3166
3155 * IPython/genutils.py (Term): Standardized the names of the Term
3167 * IPython/genutils.py (Term): Standardized the names of the Term
3156 class streams to cin/cout/cerr, following C++ naming conventions
3168 class streams to cin/cout/cerr, following C++ naming conventions
3157 (I can't use in/out/err because 'in' is not a valid attribute
3169 (I can't use in/out/err because 'in' is not a valid attribute
3158 name).
3170 name).
3159
3171
3160 * IPython/iplib.py (InteractiveShell.interact): don't increment
3172 * IPython/iplib.py (InteractiveShell.interact): don't increment
3161 the prompt if there's no user input. By Daniel 'Dang' Griffith
3173 the prompt if there's no user input. By Daniel 'Dang' Griffith
3162 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3174 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3163 Francois Pinard.
3175 Francois Pinard.
3164
3176
3165 2004-04-02 Fernando Perez <fperez@colorado.edu>
3177 2004-04-02 Fernando Perez <fperez@colorado.edu>
3166
3178
3167 * IPython/genutils.py (Stream.__init__): Modified to survive at
3179 * IPython/genutils.py (Stream.__init__): Modified to survive at
3168 least importing in contexts where stdin/out/err aren't true file
3180 least importing in contexts where stdin/out/err aren't true file
3169 objects, such as PyCrust (they lack fileno() and mode). However,
3181 objects, such as PyCrust (they lack fileno() and mode). However,
3170 the recovery facilities which rely on these things existing will
3182 the recovery facilities which rely on these things existing will
3171 not work.
3183 not work.
3172
3184
3173 2004-04-01 Fernando Perez <fperez@colorado.edu>
3185 2004-04-01 Fernando Perez <fperez@colorado.edu>
3174
3186
3175 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3187 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3176 use the new getoutputerror() function, so it properly
3188 use the new getoutputerror() function, so it properly
3177 distinguishes stdout/err.
3189 distinguishes stdout/err.
3178
3190
3179 * IPython/genutils.py (getoutputerror): added a function to
3191 * IPython/genutils.py (getoutputerror): added a function to
3180 capture separately the standard output and error of a command.
3192 capture separately the standard output and error of a command.
3181 After a comment from dang on the mailing lists. This code is
3193 After a comment from dang on the mailing lists. This code is
3182 basically a modified version of commands.getstatusoutput(), from
3194 basically a modified version of commands.getstatusoutput(), from
3183 the standard library.
3195 the standard library.
3184
3196
3185 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3197 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3186 '!!' as a special syntax (shorthand) to access @sx.
3198 '!!' as a special syntax (shorthand) to access @sx.
3187
3199
3188 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3200 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3189 command and return its output as a list split on '\n'.
3201 command and return its output as a list split on '\n'.
3190
3202
3191 2004-03-31 Fernando Perez <fperez@colorado.edu>
3203 2004-03-31 Fernando Perez <fperez@colorado.edu>
3192
3204
3193 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3205 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3194 method to dictionaries used as FakeModule instances if they lack
3206 method to dictionaries used as FakeModule instances if they lack
3195 it. At least pydoc in python2.3 breaks for runtime-defined
3207 it. At least pydoc in python2.3 breaks for runtime-defined
3196 functions without this hack. At some point I need to _really_
3208 functions without this hack. At some point I need to _really_
3197 understand what FakeModule is doing, because it's a gross hack.
3209 understand what FakeModule is doing, because it's a gross hack.
3198 But it solves Arnd's problem for now...
3210 But it solves Arnd's problem for now...
3199
3211
3200 2004-02-27 Fernando Perez <fperez@colorado.edu>
3212 2004-02-27 Fernando Perez <fperez@colorado.edu>
3201
3213
3202 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3214 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3203 mode would behave erratically. Also increased the number of
3215 mode would behave erratically. Also increased the number of
3204 possible logs in rotate mod to 999. Thanks to Rod Holland
3216 possible logs in rotate mod to 999. Thanks to Rod Holland
3205 <rhh@StructureLABS.com> for the report and fixes.
3217 <rhh@StructureLABS.com> for the report and fixes.
3206
3218
3207 2004-02-26 Fernando Perez <fperez@colorado.edu>
3219 2004-02-26 Fernando Perez <fperez@colorado.edu>
3208
3220
3209 * IPython/genutils.py (page): Check that the curses module really
3221 * IPython/genutils.py (page): Check that the curses module really
3210 has the initscr attribute before trying to use it. For some
3222 has the initscr attribute before trying to use it. For some
3211 reason, the Solaris curses module is missing this. I think this
3223 reason, the Solaris curses module is missing this. I think this
3212 should be considered a Solaris python bug, but I'm not sure.
3224 should be considered a Solaris python bug, but I'm not sure.
3213
3225
3214 2004-01-17 Fernando Perez <fperez@colorado.edu>
3226 2004-01-17 Fernando Perez <fperez@colorado.edu>
3215
3227
3216 * IPython/genutils.py (Stream.__init__): Changes to try to make
3228 * IPython/genutils.py (Stream.__init__): Changes to try to make
3217 ipython robust against stdin/out/err being closed by the user.
3229 ipython robust against stdin/out/err being closed by the user.
3218 This is 'user error' (and blocks a normal python session, at least
3230 This is 'user error' (and blocks a normal python session, at least
3219 the stdout case). However, Ipython should be able to survive such
3231 the stdout case). However, Ipython should be able to survive such
3220 instances of abuse as gracefully as possible. To simplify the
3232 instances of abuse as gracefully as possible. To simplify the
3221 coding and maintain compatibility with Gary Bishop's Term
3233 coding and maintain compatibility with Gary Bishop's Term
3222 contributions, I've made use of classmethods for this. I think
3234 contributions, I've made use of classmethods for this. I think
3223 this introduces a dependency on python 2.2.
3235 this introduces a dependency on python 2.2.
3224
3236
3225 2004-01-13 Fernando Perez <fperez@colorado.edu>
3237 2004-01-13 Fernando Perez <fperez@colorado.edu>
3226
3238
3227 * IPython/numutils.py (exp_safe): simplified the code a bit and
3239 * IPython/numutils.py (exp_safe): simplified the code a bit and
3228 removed the need for importing the kinds module altogether.
3240 removed the need for importing the kinds module altogether.
3229
3241
3230 2004-01-06 Fernando Perez <fperez@colorado.edu>
3242 2004-01-06 Fernando Perez <fperez@colorado.edu>
3231
3243
3232 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3244 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3233 a magic function instead, after some community feedback. No
3245 a magic function instead, after some community feedback. No
3234 special syntax will exist for it, but its name is deliberately
3246 special syntax will exist for it, but its name is deliberately
3235 very short.
3247 very short.
3236
3248
3237 2003-12-20 Fernando Perez <fperez@colorado.edu>
3249 2003-12-20 Fernando Perez <fperez@colorado.edu>
3238
3250
3239 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3251 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3240 new functionality, to automagically assign the result of a shell
3252 new functionality, to automagically assign the result of a shell
3241 command to a variable. I'll solicit some community feedback on
3253 command to a variable. I'll solicit some community feedback on
3242 this before making it permanent.
3254 this before making it permanent.
3243
3255
3244 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3256 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3245 requested about callables for which inspect couldn't obtain a
3257 requested about callables for which inspect couldn't obtain a
3246 proper argspec. Thanks to a crash report sent by Etienne
3258 proper argspec. Thanks to a crash report sent by Etienne
3247 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3259 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3248
3260
3249 2003-12-09 Fernando Perez <fperez@colorado.edu>
3261 2003-12-09 Fernando Perez <fperez@colorado.edu>
3250
3262
3251 * IPython/genutils.py (page): patch for the pager to work across
3263 * IPython/genutils.py (page): patch for the pager to work across
3252 various versions of Windows. By Gary Bishop.
3264 various versions of Windows. By Gary Bishop.
3253
3265
3254 2003-12-04 Fernando Perez <fperez@colorado.edu>
3266 2003-12-04 Fernando Perez <fperez@colorado.edu>
3255
3267
3256 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3268 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3257 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3269 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3258 While I tested this and it looks ok, there may still be corner
3270 While I tested this and it looks ok, there may still be corner
3259 cases I've missed.
3271 cases I've missed.
3260
3272
3261 2003-12-01 Fernando Perez <fperez@colorado.edu>
3273 2003-12-01 Fernando Perez <fperez@colorado.edu>
3262
3274
3263 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3275 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3264 where a line like 'p,q=1,2' would fail because the automagic
3276 where a line like 'p,q=1,2' would fail because the automagic
3265 system would be triggered for @p.
3277 system would be triggered for @p.
3266
3278
3267 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3279 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3268 cleanups, code unmodified.
3280 cleanups, code unmodified.
3269
3281
3270 * IPython/genutils.py (Term): added a class for IPython to handle
3282 * IPython/genutils.py (Term): added a class for IPython to handle
3271 output. In most cases it will just be a proxy for stdout/err, but
3283 output. In most cases it will just be a proxy for stdout/err, but
3272 having this allows modifications to be made for some platforms,
3284 having this allows modifications to be made for some platforms,
3273 such as handling color escapes under Windows. All of this code
3285 such as handling color escapes under Windows. All of this code
3274 was contributed by Gary Bishop, with minor modifications by me.
3286 was contributed by Gary Bishop, with minor modifications by me.
3275 The actual changes affect many files.
3287 The actual changes affect many files.
3276
3288
3277 2003-11-30 Fernando Perez <fperez@colorado.edu>
3289 2003-11-30 Fernando Perez <fperez@colorado.edu>
3278
3290
3279 * IPython/iplib.py (file_matches): new completion code, courtesy
3291 * IPython/iplib.py (file_matches): new completion code, courtesy
3280 of Jeff Collins. This enables filename completion again under
3292 of Jeff Collins. This enables filename completion again under
3281 python 2.3, which disabled it at the C level.
3293 python 2.3, which disabled it at the C level.
3282
3294
3283 2003-11-11 Fernando Perez <fperez@colorado.edu>
3295 2003-11-11 Fernando Perez <fperez@colorado.edu>
3284
3296
3285 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3297 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3286 for Numeric.array(map(...)), but often convenient.
3298 for Numeric.array(map(...)), but often convenient.
3287
3299
3288 2003-11-05 Fernando Perez <fperez@colorado.edu>
3300 2003-11-05 Fernando Perez <fperez@colorado.edu>
3289
3301
3290 * IPython/numutils.py (frange): Changed a call from int() to
3302 * IPython/numutils.py (frange): Changed a call from int() to
3291 int(round()) to prevent a problem reported with arange() in the
3303 int(round()) to prevent a problem reported with arange() in the
3292 numpy list.
3304 numpy list.
3293
3305
3294 2003-10-06 Fernando Perez <fperez@colorado.edu>
3306 2003-10-06 Fernando Perez <fperez@colorado.edu>
3295
3307
3296 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3308 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3297 prevent crashes if sys lacks an argv attribute (it happens with
3309 prevent crashes if sys lacks an argv attribute (it happens with
3298 embedded interpreters which build a bare-bones sys module).
3310 embedded interpreters which build a bare-bones sys module).
3299 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3311 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3300
3312
3301 2003-09-24 Fernando Perez <fperez@colorado.edu>
3313 2003-09-24 Fernando Perez <fperez@colorado.edu>
3302
3314
3303 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3315 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3304 to protect against poorly written user objects where __getattr__
3316 to protect against poorly written user objects where __getattr__
3305 raises exceptions other than AttributeError. Thanks to a bug
3317 raises exceptions other than AttributeError. Thanks to a bug
3306 report by Oliver Sander <osander-AT-gmx.de>.
3318 report by Oliver Sander <osander-AT-gmx.de>.
3307
3319
3308 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3320 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3309 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3321 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3310
3322
3311 2003-09-09 Fernando Perez <fperez@colorado.edu>
3323 2003-09-09 Fernando Perez <fperez@colorado.edu>
3312
3324
3313 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3325 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3314 unpacking a list whith a callable as first element would
3326 unpacking a list whith a callable as first element would
3315 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3327 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3316 Collins.
3328 Collins.
3317
3329
3318 2003-08-25 *** Released version 0.5.0
3330 2003-08-25 *** Released version 0.5.0
3319
3331
3320 2003-08-22 Fernando Perez <fperez@colorado.edu>
3332 2003-08-22 Fernando Perez <fperez@colorado.edu>
3321
3333
3322 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3334 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3323 improperly defined user exceptions. Thanks to feedback from Mark
3335 improperly defined user exceptions. Thanks to feedback from Mark
3324 Russell <mrussell-AT-verio.net>.
3336 Russell <mrussell-AT-verio.net>.
3325
3337
3326 2003-08-20 Fernando Perez <fperez@colorado.edu>
3338 2003-08-20 Fernando Perez <fperez@colorado.edu>
3327
3339
3328 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3340 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3329 printing so that it would print multi-line string forms starting
3341 printing so that it would print multi-line string forms starting
3330 with a new line. This way the formatting is better respected for
3342 with a new line. This way the formatting is better respected for
3331 objects which work hard to make nice string forms.
3343 objects which work hard to make nice string forms.
3332
3344
3333 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3345 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3334 autocall would overtake data access for objects with both
3346 autocall would overtake data access for objects with both
3335 __getitem__ and __call__.
3347 __getitem__ and __call__.
3336
3348
3337 2003-08-19 *** Released version 0.5.0-rc1
3349 2003-08-19 *** Released version 0.5.0-rc1
3338
3350
3339 2003-08-19 Fernando Perez <fperez@colorado.edu>
3351 2003-08-19 Fernando Perez <fperez@colorado.edu>
3340
3352
3341 * IPython/deep_reload.py (load_tail): single tiny change here
3353 * IPython/deep_reload.py (load_tail): single tiny change here
3342 seems to fix the long-standing bug of dreload() failing to work
3354 seems to fix the long-standing bug of dreload() failing to work
3343 for dotted names. But this module is pretty tricky, so I may have
3355 for dotted names. But this module is pretty tricky, so I may have
3344 missed some subtlety. Needs more testing!.
3356 missed some subtlety. Needs more testing!.
3345
3357
3346 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3358 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3347 exceptions which have badly implemented __str__ methods.
3359 exceptions which have badly implemented __str__ methods.
3348 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3360 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3349 which I've been getting reports about from Python 2.3 users. I
3361 which I've been getting reports about from Python 2.3 users. I
3350 wish I had a simple test case to reproduce the problem, so I could
3362 wish I had a simple test case to reproduce the problem, so I could
3351 either write a cleaner workaround or file a bug report if
3363 either write a cleaner workaround or file a bug report if
3352 necessary.
3364 necessary.
3353
3365
3354 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3366 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3355 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3367 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3356 a bug report by Tjabo Kloppenburg.
3368 a bug report by Tjabo Kloppenburg.
3357
3369
3358 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3370 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3359 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3371 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3360 seems rather unstable. Thanks to a bug report by Tjabo
3372 seems rather unstable. Thanks to a bug report by Tjabo
3361 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3373 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3362
3374
3363 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3375 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3364 this out soon because of the critical fixes in the inner loop for
3376 this out soon because of the critical fixes in the inner loop for
3365 generators.
3377 generators.
3366
3378
3367 * IPython/Magic.py (Magic.getargspec): removed. This (and
3379 * IPython/Magic.py (Magic.getargspec): removed. This (and
3368 _get_def) have been obsoleted by OInspect for a long time, I
3380 _get_def) have been obsoleted by OInspect for a long time, I
3369 hadn't noticed that they were dead code.
3381 hadn't noticed that they were dead code.
3370 (Magic._ofind): restored _ofind functionality for a few literals
3382 (Magic._ofind): restored _ofind functionality for a few literals
3371 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3383 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3372 for things like "hello".capitalize?, since that would require a
3384 for things like "hello".capitalize?, since that would require a
3373 potentially dangerous eval() again.
3385 potentially dangerous eval() again.
3374
3386
3375 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3387 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3376 logic a bit more to clean up the escapes handling and minimize the
3388 logic a bit more to clean up the escapes handling and minimize the
3377 use of _ofind to only necessary cases. The interactive 'feel' of
3389 use of _ofind to only necessary cases. The interactive 'feel' of
3378 IPython should have improved quite a bit with the changes in
3390 IPython should have improved quite a bit with the changes in
3379 _prefilter and _ofind (besides being far safer than before).
3391 _prefilter and _ofind (besides being far safer than before).
3380
3392
3381 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3393 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3382 obscure, never reported). Edit would fail to find the object to
3394 obscure, never reported). Edit would fail to find the object to
3383 edit under some circumstances.
3395 edit under some circumstances.
3384 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3396 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3385 which were causing double-calling of generators. Those eval calls
3397 which were causing double-calling of generators. Those eval calls
3386 were _very_ dangerous, since code with side effects could be
3398 were _very_ dangerous, since code with side effects could be
3387 triggered. As they say, 'eval is evil'... These were the
3399 triggered. As they say, 'eval is evil'... These were the
3388 nastiest evals in IPython. Besides, _ofind is now far simpler,
3400 nastiest evals in IPython. Besides, _ofind is now far simpler,
3389 and it should also be quite a bit faster. Its use of inspect is
3401 and it should also be quite a bit faster. Its use of inspect is
3390 also safer, so perhaps some of the inspect-related crashes I've
3402 also safer, so perhaps some of the inspect-related crashes I've
3391 seen lately with Python 2.3 might be taken care of. That will
3403 seen lately with Python 2.3 might be taken care of. That will
3392 need more testing.
3404 need more testing.
3393
3405
3394 2003-08-17 Fernando Perez <fperez@colorado.edu>
3406 2003-08-17 Fernando Perez <fperez@colorado.edu>
3395
3407
3396 * IPython/iplib.py (InteractiveShell._prefilter): significant
3408 * IPython/iplib.py (InteractiveShell._prefilter): significant
3397 simplifications to the logic for handling user escapes. Faster
3409 simplifications to the logic for handling user escapes. Faster
3398 and simpler code.
3410 and simpler code.
3399
3411
3400 2003-08-14 Fernando Perez <fperez@colorado.edu>
3412 2003-08-14 Fernando Perez <fperez@colorado.edu>
3401
3413
3402 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3414 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3403 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3415 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3404 but it should be quite a bit faster. And the recursive version
3416 but it should be quite a bit faster. And the recursive version
3405 generated O(log N) intermediate storage for all rank>1 arrays,
3417 generated O(log N) intermediate storage for all rank>1 arrays,
3406 even if they were contiguous.
3418 even if they were contiguous.
3407 (l1norm): Added this function.
3419 (l1norm): Added this function.
3408 (norm): Added this function for arbitrary norms (including
3420 (norm): Added this function for arbitrary norms (including
3409 l-infinity). l1 and l2 are still special cases for convenience
3421 l-infinity). l1 and l2 are still special cases for convenience
3410 and speed.
3422 and speed.
3411
3423
3412 2003-08-03 Fernando Perez <fperez@colorado.edu>
3424 2003-08-03 Fernando Perez <fperez@colorado.edu>
3413
3425
3414 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3426 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3415 exceptions, which now raise PendingDeprecationWarnings in Python
3427 exceptions, which now raise PendingDeprecationWarnings in Python
3416 2.3. There were some in Magic and some in Gnuplot2.
3428 2.3. There were some in Magic and some in Gnuplot2.
3417
3429
3418 2003-06-30 Fernando Perez <fperez@colorado.edu>
3430 2003-06-30 Fernando Perez <fperez@colorado.edu>
3419
3431
3420 * IPython/genutils.py (page): modified to call curses only for
3432 * IPython/genutils.py (page): modified to call curses only for
3421 terminals where TERM=='xterm'. After problems under many other
3433 terminals where TERM=='xterm'. After problems under many other
3422 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3434 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3423
3435
3424 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3436 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3425 would be triggered when readline was absent. This was just an old
3437 would be triggered when readline was absent. This was just an old
3426 debugging statement I'd forgotten to take out.
3438 debugging statement I'd forgotten to take out.
3427
3439
3428 2003-06-20 Fernando Perez <fperez@colorado.edu>
3440 2003-06-20 Fernando Perez <fperez@colorado.edu>
3429
3441
3430 * IPython/genutils.py (clock): modified to return only user time
3442 * IPython/genutils.py (clock): modified to return only user time
3431 (not counting system time), after a discussion on scipy. While
3443 (not counting system time), after a discussion on scipy. While
3432 system time may be a useful quantity occasionally, it may much
3444 system time may be a useful quantity occasionally, it may much
3433 more easily be skewed by occasional swapping or other similar
3445 more easily be skewed by occasional swapping or other similar
3434 activity.
3446 activity.
3435
3447
3436 2003-06-05 Fernando Perez <fperez@colorado.edu>
3448 2003-06-05 Fernando Perez <fperez@colorado.edu>
3437
3449
3438 * IPython/numutils.py (identity): new function, for building
3450 * IPython/numutils.py (identity): new function, for building
3439 arbitrary rank Kronecker deltas (mostly backwards compatible with
3451 arbitrary rank Kronecker deltas (mostly backwards compatible with
3440 Numeric.identity)
3452 Numeric.identity)
3441
3453
3442 2003-06-03 Fernando Perez <fperez@colorado.edu>
3454 2003-06-03 Fernando Perez <fperez@colorado.edu>
3443
3455
3444 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3456 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3445 arguments passed to magics with spaces, to allow trailing '\' to
3457 arguments passed to magics with spaces, to allow trailing '\' to
3446 work normally (mainly for Windows users).
3458 work normally (mainly for Windows users).
3447
3459
3448 2003-05-29 Fernando Perez <fperez@colorado.edu>
3460 2003-05-29 Fernando Perez <fperez@colorado.edu>
3449
3461
3450 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3462 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3451 instead of pydoc.help. This fixes a bizarre behavior where
3463 instead of pydoc.help. This fixes a bizarre behavior where
3452 printing '%s' % locals() would trigger the help system. Now
3464 printing '%s' % locals() would trigger the help system. Now
3453 ipython behaves like normal python does.
3465 ipython behaves like normal python does.
3454
3466
3455 Note that if one does 'from pydoc import help', the bizarre
3467 Note that if one does 'from pydoc import help', the bizarre
3456 behavior returns, but this will also happen in normal python, so
3468 behavior returns, but this will also happen in normal python, so
3457 it's not an ipython bug anymore (it has to do with how pydoc.help
3469 it's not an ipython bug anymore (it has to do with how pydoc.help
3458 is implemented).
3470 is implemented).
3459
3471
3460 2003-05-22 Fernando Perez <fperez@colorado.edu>
3472 2003-05-22 Fernando Perez <fperez@colorado.edu>
3461
3473
3462 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3474 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3463 return [] instead of None when nothing matches, also match to end
3475 return [] instead of None when nothing matches, also match to end
3464 of line. Patch by Gary Bishop.
3476 of line. Patch by Gary Bishop.
3465
3477
3466 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3478 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3467 protection as before, for files passed on the command line. This
3479 protection as before, for files passed on the command line. This
3468 prevents the CrashHandler from kicking in if user files call into
3480 prevents the CrashHandler from kicking in if user files call into
3469 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3481 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3470 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3482 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3471
3483
3472 2003-05-20 *** Released version 0.4.0
3484 2003-05-20 *** Released version 0.4.0
3473
3485
3474 2003-05-20 Fernando Perez <fperez@colorado.edu>
3486 2003-05-20 Fernando Perez <fperez@colorado.edu>
3475
3487
3476 * setup.py: added support for manpages. It's a bit hackish b/c of
3488 * setup.py: added support for manpages. It's a bit hackish b/c of
3477 a bug in the way the bdist_rpm distutils target handles gzipped
3489 a bug in the way the bdist_rpm distutils target handles gzipped
3478 manpages, but it works. After a patch by Jack.
3490 manpages, but it works. After a patch by Jack.
3479
3491
3480 2003-05-19 Fernando Perez <fperez@colorado.edu>
3492 2003-05-19 Fernando Perez <fperez@colorado.edu>
3481
3493
3482 * IPython/numutils.py: added a mockup of the kinds module, since
3494 * IPython/numutils.py: added a mockup of the kinds module, since
3483 it was recently removed from Numeric. This way, numutils will
3495 it was recently removed from Numeric. This way, numutils will
3484 work for all users even if they are missing kinds.
3496 work for all users even if they are missing kinds.
3485
3497
3486 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3498 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3487 failure, which can occur with SWIG-wrapped extensions. After a
3499 failure, which can occur with SWIG-wrapped extensions. After a
3488 crash report from Prabhu.
3500 crash report from Prabhu.
3489
3501
3490 2003-05-16 Fernando Perez <fperez@colorado.edu>
3502 2003-05-16 Fernando Perez <fperez@colorado.edu>
3491
3503
3492 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3504 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3493 protect ipython from user code which may call directly
3505 protect ipython from user code which may call directly
3494 sys.excepthook (this looks like an ipython crash to the user, even
3506 sys.excepthook (this looks like an ipython crash to the user, even
3495 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3507 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3496 This is especially important to help users of WxWindows, but may
3508 This is especially important to help users of WxWindows, but may
3497 also be useful in other cases.
3509 also be useful in other cases.
3498
3510
3499 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3511 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3500 an optional tb_offset to be specified, and to preserve exception
3512 an optional tb_offset to be specified, and to preserve exception
3501 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3513 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3502
3514
3503 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3515 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3504
3516
3505 2003-05-15 Fernando Perez <fperez@colorado.edu>
3517 2003-05-15 Fernando Perez <fperez@colorado.edu>
3506
3518
3507 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3519 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3508 installing for a new user under Windows.
3520 installing for a new user under Windows.
3509
3521
3510 2003-05-12 Fernando Perez <fperez@colorado.edu>
3522 2003-05-12 Fernando Perez <fperez@colorado.edu>
3511
3523
3512 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3524 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3513 handler for Emacs comint-based lines. Currently it doesn't do
3525 handler for Emacs comint-based lines. Currently it doesn't do
3514 much (but importantly, it doesn't update the history cache). In
3526 much (but importantly, it doesn't update the history cache). In
3515 the future it may be expanded if Alex needs more functionality
3527 the future it may be expanded if Alex needs more functionality
3516 there.
3528 there.
3517
3529
3518 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3530 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3519 info to crash reports.
3531 info to crash reports.
3520
3532
3521 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3533 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3522 just like Python's -c. Also fixed crash with invalid -color
3534 just like Python's -c. Also fixed crash with invalid -color
3523 option value at startup. Thanks to Will French
3535 option value at startup. Thanks to Will French
3524 <wfrench-AT-bestweb.net> for the bug report.
3536 <wfrench-AT-bestweb.net> for the bug report.
3525
3537
3526 2003-05-09 Fernando Perez <fperez@colorado.edu>
3538 2003-05-09 Fernando Perez <fperez@colorado.edu>
3527
3539
3528 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3540 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3529 to EvalDict (it's a mapping, after all) and simplified its code
3541 to EvalDict (it's a mapping, after all) and simplified its code
3530 quite a bit, after a nice discussion on c.l.py where Gustavo
3542 quite a bit, after a nice discussion on c.l.py where Gustavo
3531 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3543 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3532
3544
3533 2003-04-30 Fernando Perez <fperez@colorado.edu>
3545 2003-04-30 Fernando Perez <fperez@colorado.edu>
3534
3546
3535 * IPython/genutils.py (timings_out): modified it to reduce its
3547 * IPython/genutils.py (timings_out): modified it to reduce its
3536 overhead in the common reps==1 case.
3548 overhead in the common reps==1 case.
3537
3549
3538 2003-04-29 Fernando Perez <fperez@colorado.edu>
3550 2003-04-29 Fernando Perez <fperez@colorado.edu>
3539
3551
3540 * IPython/genutils.py (timings_out): Modified to use the resource
3552 * IPython/genutils.py (timings_out): Modified to use the resource
3541 module, which avoids the wraparound problems of time.clock().
3553 module, which avoids the wraparound problems of time.clock().
3542
3554
3543 2003-04-17 *** Released version 0.2.15pre4
3555 2003-04-17 *** Released version 0.2.15pre4
3544
3556
3545 2003-04-17 Fernando Perez <fperez@colorado.edu>
3557 2003-04-17 Fernando Perez <fperez@colorado.edu>
3546
3558
3547 * setup.py (scriptfiles): Split windows-specific stuff over to a
3559 * setup.py (scriptfiles): Split windows-specific stuff over to a
3548 separate file, in an attempt to have a Windows GUI installer.
3560 separate file, in an attempt to have a Windows GUI installer.
3549 That didn't work, but part of the groundwork is done.
3561 That didn't work, but part of the groundwork is done.
3550
3562
3551 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3563 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3552 indent/unindent with 4 spaces. Particularly useful in combination
3564 indent/unindent with 4 spaces. Particularly useful in combination
3553 with the new auto-indent option.
3565 with the new auto-indent option.
3554
3566
3555 2003-04-16 Fernando Perez <fperez@colorado.edu>
3567 2003-04-16 Fernando Perez <fperez@colorado.edu>
3556
3568
3557 * IPython/Magic.py: various replacements of self.rc for
3569 * IPython/Magic.py: various replacements of self.rc for
3558 self.shell.rc. A lot more remains to be done to fully disentangle
3570 self.shell.rc. A lot more remains to be done to fully disentangle
3559 this class from the main Shell class.
3571 this class from the main Shell class.
3560
3572
3561 * IPython/GnuplotRuntime.py: added checks for mouse support so
3573 * IPython/GnuplotRuntime.py: added checks for mouse support so
3562 that we don't try to enable it if the current gnuplot doesn't
3574 that we don't try to enable it if the current gnuplot doesn't
3563 really support it. Also added checks so that we don't try to
3575 really support it. Also added checks so that we don't try to
3564 enable persist under Windows (where Gnuplot doesn't recognize the
3576 enable persist under Windows (where Gnuplot doesn't recognize the
3565 option).
3577 option).
3566
3578
3567 * IPython/iplib.py (InteractiveShell.interact): Added optional
3579 * IPython/iplib.py (InteractiveShell.interact): Added optional
3568 auto-indenting code, after a patch by King C. Shu
3580 auto-indenting code, after a patch by King C. Shu
3569 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3581 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3570 get along well with pasting indented code. If I ever figure out
3582 get along well with pasting indented code. If I ever figure out
3571 how to make that part go well, it will become on by default.
3583 how to make that part go well, it will become on by default.
3572
3584
3573 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3585 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3574 crash ipython if there was an unmatched '%' in the user's prompt
3586 crash ipython if there was an unmatched '%' in the user's prompt
3575 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3587 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3576
3588
3577 * IPython/iplib.py (InteractiveShell.interact): removed the
3589 * IPython/iplib.py (InteractiveShell.interact): removed the
3578 ability to ask the user whether he wants to crash or not at the
3590 ability to ask the user whether he wants to crash or not at the
3579 'last line' exception handler. Calling functions at that point
3591 'last line' exception handler. Calling functions at that point
3580 changes the stack, and the error reports would have incorrect
3592 changes the stack, and the error reports would have incorrect
3581 tracebacks.
3593 tracebacks.
3582
3594
3583 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3595 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3584 pass through a peger a pretty-printed form of any object. After a
3596 pass through a peger a pretty-printed form of any object. After a
3585 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3597 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3586
3598
3587 2003-04-14 Fernando Perez <fperez@colorado.edu>
3599 2003-04-14 Fernando Perez <fperez@colorado.edu>
3588
3600
3589 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3601 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3590 all files in ~ would be modified at first install (instead of
3602 all files in ~ would be modified at first install (instead of
3591 ~/.ipython). This could be potentially disastrous, as the
3603 ~/.ipython). This could be potentially disastrous, as the
3592 modification (make line-endings native) could damage binary files.
3604 modification (make line-endings native) could damage binary files.
3593
3605
3594 2003-04-10 Fernando Perez <fperez@colorado.edu>
3606 2003-04-10 Fernando Perez <fperez@colorado.edu>
3595
3607
3596 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3608 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3597 handle only lines which are invalid python. This now means that
3609 handle only lines which are invalid python. This now means that
3598 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3610 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3599 for the bug report.
3611 for the bug report.
3600
3612
3601 2003-04-01 Fernando Perez <fperez@colorado.edu>
3613 2003-04-01 Fernando Perez <fperez@colorado.edu>
3602
3614
3603 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3615 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3604 where failing to set sys.last_traceback would crash pdb.pm().
3616 where failing to set sys.last_traceback would crash pdb.pm().
3605 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3617 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3606 report.
3618 report.
3607
3619
3608 2003-03-25 Fernando Perez <fperez@colorado.edu>
3620 2003-03-25 Fernando Perez <fperez@colorado.edu>
3609
3621
3610 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3622 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3611 before printing it (it had a lot of spurious blank lines at the
3623 before printing it (it had a lot of spurious blank lines at the
3612 end).
3624 end).
3613
3625
3614 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3626 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3615 output would be sent 21 times! Obviously people don't use this
3627 output would be sent 21 times! Obviously people don't use this
3616 too often, or I would have heard about it.
3628 too often, or I would have heard about it.
3617
3629
3618 2003-03-24 Fernando Perez <fperez@colorado.edu>
3630 2003-03-24 Fernando Perez <fperez@colorado.edu>
3619
3631
3620 * setup.py (scriptfiles): renamed the data_files parameter from
3632 * setup.py (scriptfiles): renamed the data_files parameter from
3621 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3633 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3622 for the patch.
3634 for the patch.
3623
3635
3624 2003-03-20 Fernando Perez <fperez@colorado.edu>
3636 2003-03-20 Fernando Perez <fperez@colorado.edu>
3625
3637
3626 * IPython/genutils.py (error): added error() and fatal()
3638 * IPython/genutils.py (error): added error() and fatal()
3627 functions.
3639 functions.
3628
3640
3629 2003-03-18 *** Released version 0.2.15pre3
3641 2003-03-18 *** Released version 0.2.15pre3
3630
3642
3631 2003-03-18 Fernando Perez <fperez@colorado.edu>
3643 2003-03-18 Fernando Perez <fperez@colorado.edu>
3632
3644
3633 * setupext/install_data_ext.py
3645 * setupext/install_data_ext.py
3634 (install_data_ext.initialize_options): Class contributed by Jack
3646 (install_data_ext.initialize_options): Class contributed by Jack
3635 Moffit for fixing the old distutils hack. He is sending this to
3647 Moffit for fixing the old distutils hack. He is sending this to
3636 the distutils folks so in the future we may not need it as a
3648 the distutils folks so in the future we may not need it as a
3637 private fix.
3649 private fix.
3638
3650
3639 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3651 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3640 changes for Debian packaging. See his patch for full details.
3652 changes for Debian packaging. See his patch for full details.
3641 The old distutils hack of making the ipythonrc* files carry a
3653 The old distutils hack of making the ipythonrc* files carry a
3642 bogus .py extension is gone, at last. Examples were moved to a
3654 bogus .py extension is gone, at last. Examples were moved to a
3643 separate subdir under doc/, and the separate executable scripts
3655 separate subdir under doc/, and the separate executable scripts
3644 now live in their own directory. Overall a great cleanup. The
3656 now live in their own directory. Overall a great cleanup. The
3645 manual was updated to use the new files, and setup.py has been
3657 manual was updated to use the new files, and setup.py has been
3646 fixed for this setup.
3658 fixed for this setup.
3647
3659
3648 * IPython/PyColorize.py (Parser.usage): made non-executable and
3660 * IPython/PyColorize.py (Parser.usage): made non-executable and
3649 created a pycolor wrapper around it to be included as a script.
3661 created a pycolor wrapper around it to be included as a script.
3650
3662
3651 2003-03-12 *** Released version 0.2.15pre2
3663 2003-03-12 *** Released version 0.2.15pre2
3652
3664
3653 2003-03-12 Fernando Perez <fperez@colorado.edu>
3665 2003-03-12 Fernando Perez <fperez@colorado.edu>
3654
3666
3655 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3667 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3656 long-standing problem with garbage characters in some terminals.
3668 long-standing problem with garbage characters in some terminals.
3657 The issue was really that the \001 and \002 escapes must _only_ be
3669 The issue was really that the \001 and \002 escapes must _only_ be
3658 passed to input prompts (which call readline), but _never_ to
3670 passed to input prompts (which call readline), but _never_ to
3659 normal text to be printed on screen. I changed ColorANSI to have
3671 normal text to be printed on screen. I changed ColorANSI to have
3660 two classes: TermColors and InputTermColors, each with the
3672 two classes: TermColors and InputTermColors, each with the
3661 appropriate escapes for input prompts or normal text. The code in
3673 appropriate escapes for input prompts or normal text. The code in
3662 Prompts.py got slightly more complicated, but this very old and
3674 Prompts.py got slightly more complicated, but this very old and
3663 annoying bug is finally fixed.
3675 annoying bug is finally fixed.
3664
3676
3665 All the credit for nailing down the real origin of this problem
3677 All the credit for nailing down the real origin of this problem
3666 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3678 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3667 *Many* thanks to him for spending quite a bit of effort on this.
3679 *Many* thanks to him for spending quite a bit of effort on this.
3668
3680
3669 2003-03-05 *** Released version 0.2.15pre1
3681 2003-03-05 *** Released version 0.2.15pre1
3670
3682
3671 2003-03-03 Fernando Perez <fperez@colorado.edu>
3683 2003-03-03 Fernando Perez <fperez@colorado.edu>
3672
3684
3673 * IPython/FakeModule.py: Moved the former _FakeModule to a
3685 * IPython/FakeModule.py: Moved the former _FakeModule to a
3674 separate file, because it's also needed by Magic (to fix a similar
3686 separate file, because it's also needed by Magic (to fix a similar
3675 pickle-related issue in @run).
3687 pickle-related issue in @run).
3676
3688
3677 2003-03-02 Fernando Perez <fperez@colorado.edu>
3689 2003-03-02 Fernando Perez <fperez@colorado.edu>
3678
3690
3679 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3691 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3680 the autocall option at runtime.
3692 the autocall option at runtime.
3681 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3693 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3682 across Magic.py to start separating Magic from InteractiveShell.
3694 across Magic.py to start separating Magic from InteractiveShell.
3683 (Magic._ofind): Fixed to return proper namespace for dotted
3695 (Magic._ofind): Fixed to return proper namespace for dotted
3684 names. Before, a dotted name would always return 'not currently
3696 names. Before, a dotted name would always return 'not currently
3685 defined', because it would find the 'parent'. s.x would be found,
3697 defined', because it would find the 'parent'. s.x would be found,
3686 but since 'x' isn't defined by itself, it would get confused.
3698 but since 'x' isn't defined by itself, it would get confused.
3687 (Magic.magic_run): Fixed pickling problems reported by Ralf
3699 (Magic.magic_run): Fixed pickling problems reported by Ralf
3688 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3700 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3689 that I'd used when Mike Heeter reported similar issues at the
3701 that I'd used when Mike Heeter reported similar issues at the
3690 top-level, but now for @run. It boils down to injecting the
3702 top-level, but now for @run. It boils down to injecting the
3691 namespace where code is being executed with something that looks
3703 namespace where code is being executed with something that looks
3692 enough like a module to fool pickle.dump(). Since a pickle stores
3704 enough like a module to fool pickle.dump(). Since a pickle stores
3693 a named reference to the importing module, we need this for
3705 a named reference to the importing module, we need this for
3694 pickles to save something sensible.
3706 pickles to save something sensible.
3695
3707
3696 * IPython/ipmaker.py (make_IPython): added an autocall option.
3708 * IPython/ipmaker.py (make_IPython): added an autocall option.
3697
3709
3698 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3710 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3699 the auto-eval code. Now autocalling is an option, and the code is
3711 the auto-eval code. Now autocalling is an option, and the code is
3700 also vastly safer. There is no more eval() involved at all.
3712 also vastly safer. There is no more eval() involved at all.
3701
3713
3702 2003-03-01 Fernando Perez <fperez@colorado.edu>
3714 2003-03-01 Fernando Perez <fperez@colorado.edu>
3703
3715
3704 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3716 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3705 dict with named keys instead of a tuple.
3717 dict with named keys instead of a tuple.
3706
3718
3707 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3719 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3708
3720
3709 * setup.py (make_shortcut): Fixed message about directories
3721 * setup.py (make_shortcut): Fixed message about directories
3710 created during Windows installation (the directories were ok, just
3722 created during Windows installation (the directories were ok, just
3711 the printed message was misleading). Thanks to Chris Liechti
3723 the printed message was misleading). Thanks to Chris Liechti
3712 <cliechti-AT-gmx.net> for the heads up.
3724 <cliechti-AT-gmx.net> for the heads up.
3713
3725
3714 2003-02-21 Fernando Perez <fperez@colorado.edu>
3726 2003-02-21 Fernando Perez <fperez@colorado.edu>
3715
3727
3716 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3728 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3717 of ValueError exception when checking for auto-execution. This
3729 of ValueError exception when checking for auto-execution. This
3718 one is raised by things like Numeric arrays arr.flat when the
3730 one is raised by things like Numeric arrays arr.flat when the
3719 array is non-contiguous.
3731 array is non-contiguous.
3720
3732
3721 2003-01-31 Fernando Perez <fperez@colorado.edu>
3733 2003-01-31 Fernando Perez <fperez@colorado.edu>
3722
3734
3723 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3735 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3724 not return any value at all (even though the command would get
3736 not return any value at all (even though the command would get
3725 executed).
3737 executed).
3726 (xsys): Flush stdout right after printing the command to ensure
3738 (xsys): Flush stdout right after printing the command to ensure
3727 proper ordering of commands and command output in the total
3739 proper ordering of commands and command output in the total
3728 output.
3740 output.
3729 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3741 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3730 system/getoutput as defaults. The old ones are kept for
3742 system/getoutput as defaults. The old ones are kept for
3731 compatibility reasons, so no code which uses this library needs
3743 compatibility reasons, so no code which uses this library needs
3732 changing.
3744 changing.
3733
3745
3734 2003-01-27 *** Released version 0.2.14
3746 2003-01-27 *** Released version 0.2.14
3735
3747
3736 2003-01-25 Fernando Perez <fperez@colorado.edu>
3748 2003-01-25 Fernando Perez <fperez@colorado.edu>
3737
3749
3738 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3750 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3739 functions defined in previous edit sessions could not be re-edited
3751 functions defined in previous edit sessions could not be re-edited
3740 (because the temp files were immediately removed). Now temp files
3752 (because the temp files were immediately removed). Now temp files
3741 are removed only at IPython's exit.
3753 are removed only at IPython's exit.
3742 (Magic.magic_run): Improved @run to perform shell-like expansions
3754 (Magic.magic_run): Improved @run to perform shell-like expansions
3743 on its arguments (~users and $VARS). With this, @run becomes more
3755 on its arguments (~users and $VARS). With this, @run becomes more
3744 like a normal command-line.
3756 like a normal command-line.
3745
3757
3746 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3758 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3747 bugs related to embedding and cleaned up that code. A fairly
3759 bugs related to embedding and cleaned up that code. A fairly
3748 important one was the impossibility to access the global namespace
3760 important one was the impossibility to access the global namespace
3749 through the embedded IPython (only local variables were visible).
3761 through the embedded IPython (only local variables were visible).
3750
3762
3751 2003-01-14 Fernando Perez <fperez@colorado.edu>
3763 2003-01-14 Fernando Perez <fperez@colorado.edu>
3752
3764
3753 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3765 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3754 auto-calling to be a bit more conservative. Now it doesn't get
3766 auto-calling to be a bit more conservative. Now it doesn't get
3755 triggered if any of '!=()<>' are in the rest of the input line, to
3767 triggered if any of '!=()<>' are in the rest of the input line, to
3756 allow comparing callables. Thanks to Alex for the heads up.
3768 allow comparing callables. Thanks to Alex for the heads up.
3757
3769
3758 2003-01-07 Fernando Perez <fperez@colorado.edu>
3770 2003-01-07 Fernando Perez <fperez@colorado.edu>
3759
3771
3760 * IPython/genutils.py (page): fixed estimation of the number of
3772 * IPython/genutils.py (page): fixed estimation of the number of
3761 lines in a string to be paged to simply count newlines. This
3773 lines in a string to be paged to simply count newlines. This
3762 prevents over-guessing due to embedded escape sequences. A better
3774 prevents over-guessing due to embedded escape sequences. A better
3763 long-term solution would involve stripping out the control chars
3775 long-term solution would involve stripping out the control chars
3764 for the count, but it's potentially so expensive I just don't
3776 for the count, but it's potentially so expensive I just don't
3765 think it's worth doing.
3777 think it's worth doing.
3766
3778
3767 2002-12-19 *** Released version 0.2.14pre50
3779 2002-12-19 *** Released version 0.2.14pre50
3768
3780
3769 2002-12-19 Fernando Perez <fperez@colorado.edu>
3781 2002-12-19 Fernando Perez <fperez@colorado.edu>
3770
3782
3771 * tools/release (version): Changed release scripts to inform
3783 * tools/release (version): Changed release scripts to inform
3772 Andrea and build a NEWS file with a list of recent changes.
3784 Andrea and build a NEWS file with a list of recent changes.
3773
3785
3774 * IPython/ColorANSI.py (__all__): changed terminal detection
3786 * IPython/ColorANSI.py (__all__): changed terminal detection
3775 code. Seems to work better for xterms without breaking
3787 code. Seems to work better for xterms without breaking
3776 konsole. Will need more testing to determine if WinXP and Mac OSX
3788 konsole. Will need more testing to determine if WinXP and Mac OSX
3777 also work ok.
3789 also work ok.
3778
3790
3779 2002-12-18 *** Released version 0.2.14pre49
3791 2002-12-18 *** Released version 0.2.14pre49
3780
3792
3781 2002-12-18 Fernando Perez <fperez@colorado.edu>
3793 2002-12-18 Fernando Perez <fperez@colorado.edu>
3782
3794
3783 * Docs: added new info about Mac OSX, from Andrea.
3795 * Docs: added new info about Mac OSX, from Andrea.
3784
3796
3785 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3797 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3786 allow direct plotting of python strings whose format is the same
3798 allow direct plotting of python strings whose format is the same
3787 of gnuplot data files.
3799 of gnuplot data files.
3788
3800
3789 2002-12-16 Fernando Perez <fperez@colorado.edu>
3801 2002-12-16 Fernando Perez <fperez@colorado.edu>
3790
3802
3791 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3803 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3792 value of exit question to be acknowledged.
3804 value of exit question to be acknowledged.
3793
3805
3794 2002-12-03 Fernando Perez <fperez@colorado.edu>
3806 2002-12-03 Fernando Perez <fperez@colorado.edu>
3795
3807
3796 * IPython/ipmaker.py: removed generators, which had been added
3808 * IPython/ipmaker.py: removed generators, which had been added
3797 by mistake in an earlier debugging run. This was causing trouble
3809 by mistake in an earlier debugging run. This was causing trouble
3798 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3810 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3799 for pointing this out.
3811 for pointing this out.
3800
3812
3801 2002-11-17 Fernando Perez <fperez@colorado.edu>
3813 2002-11-17 Fernando Perez <fperez@colorado.edu>
3802
3814
3803 * Manual: updated the Gnuplot section.
3815 * Manual: updated the Gnuplot section.
3804
3816
3805 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3817 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3806 a much better split of what goes in Runtime and what goes in
3818 a much better split of what goes in Runtime and what goes in
3807 Interactive.
3819 Interactive.
3808
3820
3809 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3821 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3810 being imported from iplib.
3822 being imported from iplib.
3811
3823
3812 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3824 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3813 for command-passing. Now the global Gnuplot instance is called
3825 for command-passing. Now the global Gnuplot instance is called
3814 'gp' instead of 'g', which was really a far too fragile and
3826 'gp' instead of 'g', which was really a far too fragile and
3815 common name.
3827 common name.
3816
3828
3817 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3829 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3818 bounding boxes generated by Gnuplot for square plots.
3830 bounding boxes generated by Gnuplot for square plots.
3819
3831
3820 * IPython/genutils.py (popkey): new function added. I should
3832 * IPython/genutils.py (popkey): new function added. I should
3821 suggest this on c.l.py as a dict method, it seems useful.
3833 suggest this on c.l.py as a dict method, it seems useful.
3822
3834
3823 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3835 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3824 to transparently handle PostScript generation. MUCH better than
3836 to transparently handle PostScript generation. MUCH better than
3825 the previous plot_eps/replot_eps (which I removed now). The code
3837 the previous plot_eps/replot_eps (which I removed now). The code
3826 is also fairly clean and well documented now (including
3838 is also fairly clean and well documented now (including
3827 docstrings).
3839 docstrings).
3828
3840
3829 2002-11-13 Fernando Perez <fperez@colorado.edu>
3841 2002-11-13 Fernando Perez <fperez@colorado.edu>
3830
3842
3831 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3843 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3832 (inconsistent with options).
3844 (inconsistent with options).
3833
3845
3834 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3846 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3835 manually disabled, I don't know why. Fixed it.
3847 manually disabled, I don't know why. Fixed it.
3836 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3848 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3837 eps output.
3849 eps output.
3838
3850
3839 2002-11-12 Fernando Perez <fperez@colorado.edu>
3851 2002-11-12 Fernando Perez <fperez@colorado.edu>
3840
3852
3841 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3853 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3842 don't propagate up to caller. Fixes crash reported by François
3854 don't propagate up to caller. Fixes crash reported by François
3843 Pinard.
3855 Pinard.
3844
3856
3845 2002-11-09 Fernando Perez <fperez@colorado.edu>
3857 2002-11-09 Fernando Perez <fperez@colorado.edu>
3846
3858
3847 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3859 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3848 history file for new users.
3860 history file for new users.
3849 (make_IPython): fixed bug where initial install would leave the
3861 (make_IPython): fixed bug where initial install would leave the
3850 user running in the .ipython dir.
3862 user running in the .ipython dir.
3851 (make_IPython): fixed bug where config dir .ipython would be
3863 (make_IPython): fixed bug where config dir .ipython would be
3852 created regardless of the given -ipythondir option. Thanks to Cory
3864 created regardless of the given -ipythondir option. Thanks to Cory
3853 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3865 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3854
3866
3855 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3867 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3856 type confirmations. Will need to use it in all of IPython's code
3868 type confirmations. Will need to use it in all of IPython's code
3857 consistently.
3869 consistently.
3858
3870
3859 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3871 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3860 context to print 31 lines instead of the default 5. This will make
3872 context to print 31 lines instead of the default 5. This will make
3861 the crash reports extremely detailed in case the problem is in
3873 the crash reports extremely detailed in case the problem is in
3862 libraries I don't have access to.
3874 libraries I don't have access to.
3863
3875
3864 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3876 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3865 line of defense' code to still crash, but giving users fair
3877 line of defense' code to still crash, but giving users fair
3866 warning. I don't want internal errors to go unreported: if there's
3878 warning. I don't want internal errors to go unreported: if there's
3867 an internal problem, IPython should crash and generate a full
3879 an internal problem, IPython should crash and generate a full
3868 report.
3880 report.
3869
3881
3870 2002-11-08 Fernando Perez <fperez@colorado.edu>
3882 2002-11-08 Fernando Perez <fperez@colorado.edu>
3871
3883
3872 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3884 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3873 otherwise uncaught exceptions which can appear if people set
3885 otherwise uncaught exceptions which can appear if people set
3874 sys.stdout to something badly broken. Thanks to a crash report
3886 sys.stdout to something badly broken. Thanks to a crash report
3875 from henni-AT-mail.brainbot.com.
3887 from henni-AT-mail.brainbot.com.
3876
3888
3877 2002-11-04 Fernando Perez <fperez@colorado.edu>
3889 2002-11-04 Fernando Perez <fperez@colorado.edu>
3878
3890
3879 * IPython/iplib.py (InteractiveShell.interact): added
3891 * IPython/iplib.py (InteractiveShell.interact): added
3880 __IPYTHON__active to the builtins. It's a flag which goes on when
3892 __IPYTHON__active to the builtins. It's a flag which goes on when
3881 the interaction starts and goes off again when it stops. This
3893 the interaction starts and goes off again when it stops. This
3882 allows embedding code to detect being inside IPython. Before this
3894 allows embedding code to detect being inside IPython. Before this
3883 was done via __IPYTHON__, but that only shows that an IPython
3895 was done via __IPYTHON__, but that only shows that an IPython
3884 instance has been created.
3896 instance has been created.
3885
3897
3886 * IPython/Magic.py (Magic.magic_env): I realized that in a
3898 * IPython/Magic.py (Magic.magic_env): I realized that in a
3887 UserDict, instance.data holds the data as a normal dict. So I
3899 UserDict, instance.data holds the data as a normal dict. So I
3888 modified @env to return os.environ.data instead of rebuilding a
3900 modified @env to return os.environ.data instead of rebuilding a
3889 dict by hand.
3901 dict by hand.
3890
3902
3891 2002-11-02 Fernando Perez <fperez@colorado.edu>
3903 2002-11-02 Fernando Perez <fperez@colorado.edu>
3892
3904
3893 * IPython/genutils.py (warn): changed so that level 1 prints no
3905 * IPython/genutils.py (warn): changed so that level 1 prints no
3894 header. Level 2 is now the default (with 'WARNING' header, as
3906 header. Level 2 is now the default (with 'WARNING' header, as
3895 before). I think I tracked all places where changes were needed in
3907 before). I think I tracked all places where changes were needed in
3896 IPython, but outside code using the old level numbering may have
3908 IPython, but outside code using the old level numbering may have
3897 broken.
3909 broken.
3898
3910
3899 * IPython/iplib.py (InteractiveShell.runcode): added this to
3911 * IPython/iplib.py (InteractiveShell.runcode): added this to
3900 handle the tracebacks in SystemExit traps correctly. The previous
3912 handle the tracebacks in SystemExit traps correctly. The previous
3901 code (through interact) was printing more of the stack than
3913 code (through interact) was printing more of the stack than
3902 necessary, showing IPython internal code to the user.
3914 necessary, showing IPython internal code to the user.
3903
3915
3904 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3916 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3905 default. Now that the default at the confirmation prompt is yes,
3917 default. Now that the default at the confirmation prompt is yes,
3906 it's not so intrusive. François' argument that ipython sessions
3918 it's not so intrusive. François' argument that ipython sessions
3907 tend to be complex enough not to lose them from an accidental C-d,
3919 tend to be complex enough not to lose them from an accidental C-d,
3908 is a valid one.
3920 is a valid one.
3909
3921
3910 * IPython/iplib.py (InteractiveShell.interact): added a
3922 * IPython/iplib.py (InteractiveShell.interact): added a
3911 showtraceback() call to the SystemExit trap, and modified the exit
3923 showtraceback() call to the SystemExit trap, and modified the exit
3912 confirmation to have yes as the default.
3924 confirmation to have yes as the default.
3913
3925
3914 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3926 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3915 this file. It's been gone from the code for a long time, this was
3927 this file. It's been gone from the code for a long time, this was
3916 simply leftover junk.
3928 simply leftover junk.
3917
3929
3918 2002-11-01 Fernando Perez <fperez@colorado.edu>
3930 2002-11-01 Fernando Perez <fperez@colorado.edu>
3919
3931
3920 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3932 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3921 added. If set, IPython now traps EOF and asks for
3933 added. If set, IPython now traps EOF and asks for
3922 confirmation. After a request by François Pinard.
3934 confirmation. After a request by François Pinard.
3923
3935
3924 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3936 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3925 of @abort, and with a new (better) mechanism for handling the
3937 of @abort, and with a new (better) mechanism for handling the
3926 exceptions.
3938 exceptions.
3927
3939
3928 2002-10-27 Fernando Perez <fperez@colorado.edu>
3940 2002-10-27 Fernando Perez <fperez@colorado.edu>
3929
3941
3930 * IPython/usage.py (__doc__): updated the --help information and
3942 * IPython/usage.py (__doc__): updated the --help information and
3931 the ipythonrc file to indicate that -log generates
3943 the ipythonrc file to indicate that -log generates
3932 ./ipython.log. Also fixed the corresponding info in @logstart.
3944 ./ipython.log. Also fixed the corresponding info in @logstart.
3933 This and several other fixes in the manuals thanks to reports by
3945 This and several other fixes in the manuals thanks to reports by
3934 François Pinard <pinard-AT-iro.umontreal.ca>.
3946 François Pinard <pinard-AT-iro.umontreal.ca>.
3935
3947
3936 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3948 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3937 refer to @logstart (instead of @log, which doesn't exist).
3949 refer to @logstart (instead of @log, which doesn't exist).
3938
3950
3939 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3951 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3940 AttributeError crash. Thanks to Christopher Armstrong
3952 AttributeError crash. Thanks to Christopher Armstrong
3941 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3953 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3942 introduced recently (in 0.2.14pre37) with the fix to the eval
3954 introduced recently (in 0.2.14pre37) with the fix to the eval
3943 problem mentioned below.
3955 problem mentioned below.
3944
3956
3945 2002-10-17 Fernando Perez <fperez@colorado.edu>
3957 2002-10-17 Fernando Perez <fperez@colorado.edu>
3946
3958
3947 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3959 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3948 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3960 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3949
3961
3950 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3962 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3951 this function to fix a problem reported by Alex Schmolck. He saw
3963 this function to fix a problem reported by Alex Schmolck. He saw
3952 it with list comprehensions and generators, which were getting
3964 it with list comprehensions and generators, which were getting
3953 called twice. The real problem was an 'eval' call in testing for
3965 called twice. The real problem was an 'eval' call in testing for
3954 automagic which was evaluating the input line silently.
3966 automagic which was evaluating the input line silently.
3955
3967
3956 This is a potentially very nasty bug, if the input has side
3968 This is a potentially very nasty bug, if the input has side
3957 effects which must not be repeated. The code is much cleaner now,
3969 effects which must not be repeated. The code is much cleaner now,
3958 without any blanket 'except' left and with a regexp test for
3970 without any blanket 'except' left and with a regexp test for
3959 actual function names.
3971 actual function names.
3960
3972
3961 But an eval remains, which I'm not fully comfortable with. I just
3973 But an eval remains, which I'm not fully comfortable with. I just
3962 don't know how to find out if an expression could be a callable in
3974 don't know how to find out if an expression could be a callable in
3963 the user's namespace without doing an eval on the string. However
3975 the user's namespace without doing an eval on the string. However
3964 that string is now much more strictly checked so that no code
3976 that string is now much more strictly checked so that no code
3965 slips by, so the eval should only happen for things that can
3977 slips by, so the eval should only happen for things that can
3966 really be only function/method names.
3978 really be only function/method names.
3967
3979
3968 2002-10-15 Fernando Perez <fperez@colorado.edu>
3980 2002-10-15 Fernando Perez <fperez@colorado.edu>
3969
3981
3970 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3982 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3971 OSX information to main manual, removed README_Mac_OSX file from
3983 OSX information to main manual, removed README_Mac_OSX file from
3972 distribution. Also updated credits for recent additions.
3984 distribution. Also updated credits for recent additions.
3973
3985
3974 2002-10-10 Fernando Perez <fperez@colorado.edu>
3986 2002-10-10 Fernando Perez <fperez@colorado.edu>
3975
3987
3976 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3988 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3977 terminal-related issues. Many thanks to Andrea Riciputi
3989 terminal-related issues. Many thanks to Andrea Riciputi
3978 <andrea.riciputi-AT-libero.it> for writing it.
3990 <andrea.riciputi-AT-libero.it> for writing it.
3979
3991
3980 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3992 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3981 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3993 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3982
3994
3983 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3995 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3984 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3996 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3985 <syver-en-AT-online.no> who both submitted patches for this problem.
3997 <syver-en-AT-online.no> who both submitted patches for this problem.
3986
3998
3987 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3999 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3988 global embedding to make sure that things don't overwrite user
4000 global embedding to make sure that things don't overwrite user
3989 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4001 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3990
4002
3991 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4003 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3992 compatibility. Thanks to Hayden Callow
4004 compatibility. Thanks to Hayden Callow
3993 <h.callow-AT-elec.canterbury.ac.nz>
4005 <h.callow-AT-elec.canterbury.ac.nz>
3994
4006
3995 2002-10-04 Fernando Perez <fperez@colorado.edu>
4007 2002-10-04 Fernando Perez <fperez@colorado.edu>
3996
4008
3997 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4009 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3998 Gnuplot.File objects.
4010 Gnuplot.File objects.
3999
4011
4000 2002-07-23 Fernando Perez <fperez@colorado.edu>
4012 2002-07-23 Fernando Perez <fperez@colorado.edu>
4001
4013
4002 * IPython/genutils.py (timing): Added timings() and timing() for
4014 * IPython/genutils.py (timing): Added timings() and timing() for
4003 quick access to the most commonly needed data, the execution
4015 quick access to the most commonly needed data, the execution
4004 times. Old timing() renamed to timings_out().
4016 times. Old timing() renamed to timings_out().
4005
4017
4006 2002-07-18 Fernando Perez <fperez@colorado.edu>
4018 2002-07-18 Fernando Perez <fperez@colorado.edu>
4007
4019
4008 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4020 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4009 bug with nested instances disrupting the parent's tab completion.
4021 bug with nested instances disrupting the parent's tab completion.
4010
4022
4011 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4023 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4012 all_completions code to begin the emacs integration.
4024 all_completions code to begin the emacs integration.
4013
4025
4014 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4026 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4015 argument to allow titling individual arrays when plotting.
4027 argument to allow titling individual arrays when plotting.
4016
4028
4017 2002-07-15 Fernando Perez <fperez@colorado.edu>
4029 2002-07-15 Fernando Perez <fperez@colorado.edu>
4018
4030
4019 * setup.py (make_shortcut): changed to retrieve the value of
4031 * setup.py (make_shortcut): changed to retrieve the value of
4020 'Program Files' directory from the registry (this value changes in
4032 'Program Files' directory from the registry (this value changes in
4021 non-english versions of Windows). Thanks to Thomas Fanslau
4033 non-english versions of Windows). Thanks to Thomas Fanslau
4022 <tfanslau-AT-gmx.de> for the report.
4034 <tfanslau-AT-gmx.de> for the report.
4023
4035
4024 2002-07-10 Fernando Perez <fperez@colorado.edu>
4036 2002-07-10 Fernando Perez <fperez@colorado.edu>
4025
4037
4026 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4038 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4027 a bug in pdb, which crashes if a line with only whitespace is
4039 a bug in pdb, which crashes if a line with only whitespace is
4028 entered. Bug report submitted to sourceforge.
4040 entered. Bug report submitted to sourceforge.
4029
4041
4030 2002-07-09 Fernando Perez <fperez@colorado.edu>
4042 2002-07-09 Fernando Perez <fperez@colorado.edu>
4031
4043
4032 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4044 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4033 reporting exceptions (it's a bug in inspect.py, I just set a
4045 reporting exceptions (it's a bug in inspect.py, I just set a
4034 workaround).
4046 workaround).
4035
4047
4036 2002-07-08 Fernando Perez <fperez@colorado.edu>
4048 2002-07-08 Fernando Perez <fperez@colorado.edu>
4037
4049
4038 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4050 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4039 __IPYTHON__ in __builtins__ to show up in user_ns.
4051 __IPYTHON__ in __builtins__ to show up in user_ns.
4040
4052
4041 2002-07-03 Fernando Perez <fperez@colorado.edu>
4053 2002-07-03 Fernando Perez <fperez@colorado.edu>
4042
4054
4043 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4055 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4044 name from @gp_set_instance to @gp_set_default.
4056 name from @gp_set_instance to @gp_set_default.
4045
4057
4046 * IPython/ipmaker.py (make_IPython): default editor value set to
4058 * IPython/ipmaker.py (make_IPython): default editor value set to
4047 '0' (a string), to match the rc file. Otherwise will crash when
4059 '0' (a string), to match the rc file. Otherwise will crash when
4048 .strip() is called on it.
4060 .strip() is called on it.
4049
4061
4050
4062
4051 2002-06-28 Fernando Perez <fperez@colorado.edu>
4063 2002-06-28 Fernando Perez <fperez@colorado.edu>
4052
4064
4053 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4065 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4054 of files in current directory when a file is executed via
4066 of files in current directory when a file is executed via
4055 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4067 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4056
4068
4057 * setup.py (manfiles): fix for rpm builds, submitted by RA
4069 * setup.py (manfiles): fix for rpm builds, submitted by RA
4058 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4070 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4059
4071
4060 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4072 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4061 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4073 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4062 string!). A. Schmolck caught this one.
4074 string!). A. Schmolck caught this one.
4063
4075
4064 2002-06-27 Fernando Perez <fperez@colorado.edu>
4076 2002-06-27 Fernando Perez <fperez@colorado.edu>
4065
4077
4066 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4078 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4067 defined files at the cmd line. __name__ wasn't being set to
4079 defined files at the cmd line. __name__ wasn't being set to
4068 __main__.
4080 __main__.
4069
4081
4070 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4082 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4071 regular lists and tuples besides Numeric arrays.
4083 regular lists and tuples besides Numeric arrays.
4072
4084
4073 * IPython/Prompts.py (CachedOutput.__call__): Added output
4085 * IPython/Prompts.py (CachedOutput.__call__): Added output
4074 supression for input ending with ';'. Similar to Mathematica and
4086 supression for input ending with ';'. Similar to Mathematica and
4075 Matlab. The _* vars and Out[] list are still updated, just like
4087 Matlab. The _* vars and Out[] list are still updated, just like
4076 Mathematica behaves.
4088 Mathematica behaves.
4077
4089
4078 2002-06-25 Fernando Perez <fperez@colorado.edu>
4090 2002-06-25 Fernando Perez <fperez@colorado.edu>
4079
4091
4080 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4092 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4081 .ini extensions for profiels under Windows.
4093 .ini extensions for profiels under Windows.
4082
4094
4083 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4095 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4084 string form. Fix contributed by Alexander Schmolck
4096 string form. Fix contributed by Alexander Schmolck
4085 <a.schmolck-AT-gmx.net>
4097 <a.schmolck-AT-gmx.net>
4086
4098
4087 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4099 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4088 pre-configured Gnuplot instance.
4100 pre-configured Gnuplot instance.
4089
4101
4090 2002-06-21 Fernando Perez <fperez@colorado.edu>
4102 2002-06-21 Fernando Perez <fperez@colorado.edu>
4091
4103
4092 * IPython/numutils.py (exp_safe): new function, works around the
4104 * IPython/numutils.py (exp_safe): new function, works around the
4093 underflow problems in Numeric.
4105 underflow problems in Numeric.
4094 (log2): New fn. Safe log in base 2: returns exact integer answer
4106 (log2): New fn. Safe log in base 2: returns exact integer answer
4095 for exact integer powers of 2.
4107 for exact integer powers of 2.
4096
4108
4097 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4109 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4098 properly.
4110 properly.
4099
4111
4100 2002-06-20 Fernando Perez <fperez@colorado.edu>
4112 2002-06-20 Fernando Perez <fperez@colorado.edu>
4101
4113
4102 * IPython/genutils.py (timing): new function like
4114 * IPython/genutils.py (timing): new function like
4103 Mathematica's. Similar to time_test, but returns more info.
4115 Mathematica's. Similar to time_test, but returns more info.
4104
4116
4105 2002-06-18 Fernando Perez <fperez@colorado.edu>
4117 2002-06-18 Fernando Perez <fperez@colorado.edu>
4106
4118
4107 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4119 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4108 according to Mike Heeter's suggestions.
4120 according to Mike Heeter's suggestions.
4109
4121
4110 2002-06-16 Fernando Perez <fperez@colorado.edu>
4122 2002-06-16 Fernando Perez <fperez@colorado.edu>
4111
4123
4112 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4124 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4113 system. GnuplotMagic is gone as a user-directory option. New files
4125 system. GnuplotMagic is gone as a user-directory option. New files
4114 make it easier to use all the gnuplot stuff both from external
4126 make it easier to use all the gnuplot stuff both from external
4115 programs as well as from IPython. Had to rewrite part of
4127 programs as well as from IPython. Had to rewrite part of
4116 hardcopy() b/c of a strange bug: often the ps files simply don't
4128 hardcopy() b/c of a strange bug: often the ps files simply don't
4117 get created, and require a repeat of the command (often several
4129 get created, and require a repeat of the command (often several
4118 times).
4130 times).
4119
4131
4120 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4132 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4121 resolve output channel at call time, so that if sys.stderr has
4133 resolve output channel at call time, so that if sys.stderr has
4122 been redirected by user this gets honored.
4134 been redirected by user this gets honored.
4123
4135
4124 2002-06-13 Fernando Perez <fperez@colorado.edu>
4136 2002-06-13 Fernando Perez <fperez@colorado.edu>
4125
4137
4126 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4138 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4127 IPShell. Kept a copy with the old names to avoid breaking people's
4139 IPShell. Kept a copy with the old names to avoid breaking people's
4128 embedded code.
4140 embedded code.
4129
4141
4130 * IPython/ipython: simplified it to the bare minimum after
4142 * IPython/ipython: simplified it to the bare minimum after
4131 Holger's suggestions. Added info about how to use it in
4143 Holger's suggestions. Added info about how to use it in
4132 PYTHONSTARTUP.
4144 PYTHONSTARTUP.
4133
4145
4134 * IPython/Shell.py (IPythonShell): changed the options passing
4146 * IPython/Shell.py (IPythonShell): changed the options passing
4135 from a string with funky %s replacements to a straight list. Maybe
4147 from a string with funky %s replacements to a straight list. Maybe
4136 a bit more typing, but it follows sys.argv conventions, so there's
4148 a bit more typing, but it follows sys.argv conventions, so there's
4137 less special-casing to remember.
4149 less special-casing to remember.
4138
4150
4139 2002-06-12 Fernando Perez <fperez@colorado.edu>
4151 2002-06-12 Fernando Perez <fperez@colorado.edu>
4140
4152
4141 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4153 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4142 command. Thanks to a suggestion by Mike Heeter.
4154 command. Thanks to a suggestion by Mike Heeter.
4143 (Magic.magic_pfile): added behavior to look at filenames if given
4155 (Magic.magic_pfile): added behavior to look at filenames if given
4144 arg is not a defined object.
4156 arg is not a defined object.
4145 (Magic.magic_save): New @save function to save code snippets. Also
4157 (Magic.magic_save): New @save function to save code snippets. Also
4146 a Mike Heeter idea.
4158 a Mike Heeter idea.
4147
4159
4148 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4160 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4149 plot() and replot(). Much more convenient now, especially for
4161 plot() and replot(). Much more convenient now, especially for
4150 interactive use.
4162 interactive use.
4151
4163
4152 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4164 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4153 filenames.
4165 filenames.
4154
4166
4155 2002-06-02 Fernando Perez <fperez@colorado.edu>
4167 2002-06-02 Fernando Perez <fperez@colorado.edu>
4156
4168
4157 * IPython/Struct.py (Struct.__init__): modified to admit
4169 * IPython/Struct.py (Struct.__init__): modified to admit
4158 initialization via another struct.
4170 initialization via another struct.
4159
4171
4160 * IPython/genutils.py (SystemExec.__init__): New stateful
4172 * IPython/genutils.py (SystemExec.__init__): New stateful
4161 interface to xsys and bq. Useful for writing system scripts.
4173 interface to xsys and bq. Useful for writing system scripts.
4162
4174
4163 2002-05-30 Fernando Perez <fperez@colorado.edu>
4175 2002-05-30 Fernando Perez <fperez@colorado.edu>
4164
4176
4165 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4177 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4166 documents. This will make the user download smaller (it's getting
4178 documents. This will make the user download smaller (it's getting
4167 too big).
4179 too big).
4168
4180
4169 2002-05-29 Fernando Perez <fperez@colorado.edu>
4181 2002-05-29 Fernando Perez <fperez@colorado.edu>
4170
4182
4171 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4183 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4172 fix problems with shelve and pickle. Seems to work, but I don't
4184 fix problems with shelve and pickle. Seems to work, but I don't
4173 know if corner cases break it. Thanks to Mike Heeter
4185 know if corner cases break it. Thanks to Mike Heeter
4174 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4186 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4175
4187
4176 2002-05-24 Fernando Perez <fperez@colorado.edu>
4188 2002-05-24 Fernando Perez <fperez@colorado.edu>
4177
4189
4178 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4190 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4179 macros having broken.
4191 macros having broken.
4180
4192
4181 2002-05-21 Fernando Perez <fperez@colorado.edu>
4193 2002-05-21 Fernando Perez <fperez@colorado.edu>
4182
4194
4183 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4195 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4184 introduced logging bug: all history before logging started was
4196 introduced logging bug: all history before logging started was
4185 being written one character per line! This came from the redesign
4197 being written one character per line! This came from the redesign
4186 of the input history as a special list which slices to strings,
4198 of the input history as a special list which slices to strings,
4187 not to lists.
4199 not to lists.
4188
4200
4189 2002-05-20 Fernando Perez <fperez@colorado.edu>
4201 2002-05-20 Fernando Perez <fperez@colorado.edu>
4190
4202
4191 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4203 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4192 be an attribute of all classes in this module. The design of these
4204 be an attribute of all classes in this module. The design of these
4193 classes needs some serious overhauling.
4205 classes needs some serious overhauling.
4194
4206
4195 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4207 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4196 which was ignoring '_' in option names.
4208 which was ignoring '_' in option names.
4197
4209
4198 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4210 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4199 'Verbose_novars' to 'Context' and made it the new default. It's a
4211 'Verbose_novars' to 'Context' and made it the new default. It's a
4200 bit more readable and also safer than verbose.
4212 bit more readable and also safer than verbose.
4201
4213
4202 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4214 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4203 triple-quoted strings.
4215 triple-quoted strings.
4204
4216
4205 * IPython/OInspect.py (__all__): new module exposing the object
4217 * IPython/OInspect.py (__all__): new module exposing the object
4206 introspection facilities. Now the corresponding magics are dummy
4218 introspection facilities. Now the corresponding magics are dummy
4207 wrappers around this. Having this module will make it much easier
4219 wrappers around this. Having this module will make it much easier
4208 to put these functions into our modified pdb.
4220 to put these functions into our modified pdb.
4209 This new object inspector system uses the new colorizing module,
4221 This new object inspector system uses the new colorizing module,
4210 so source code and other things are nicely syntax highlighted.
4222 so source code and other things are nicely syntax highlighted.
4211
4223
4212 2002-05-18 Fernando Perez <fperez@colorado.edu>
4224 2002-05-18 Fernando Perez <fperez@colorado.edu>
4213
4225
4214 * IPython/ColorANSI.py: Split the coloring tools into a separate
4226 * IPython/ColorANSI.py: Split the coloring tools into a separate
4215 module so I can use them in other code easier (they were part of
4227 module so I can use them in other code easier (they were part of
4216 ultraTB).
4228 ultraTB).
4217
4229
4218 2002-05-17 Fernando Perez <fperez@colorado.edu>
4230 2002-05-17 Fernando Perez <fperez@colorado.edu>
4219
4231
4220 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4232 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4221 fixed it to set the global 'g' also to the called instance, as
4233 fixed it to set the global 'g' also to the called instance, as
4222 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4234 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4223 user's 'g' variables).
4235 user's 'g' variables).
4224
4236
4225 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4237 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4226 global variables (aliases to _ih,_oh) so that users which expect
4238 global variables (aliases to _ih,_oh) so that users which expect
4227 In[5] or Out[7] to work aren't unpleasantly surprised.
4239 In[5] or Out[7] to work aren't unpleasantly surprised.
4228 (InputList.__getslice__): new class to allow executing slices of
4240 (InputList.__getslice__): new class to allow executing slices of
4229 input history directly. Very simple class, complements the use of
4241 input history directly. Very simple class, complements the use of
4230 macros.
4242 macros.
4231
4243
4232 2002-05-16 Fernando Perez <fperez@colorado.edu>
4244 2002-05-16 Fernando Perez <fperez@colorado.edu>
4233
4245
4234 * setup.py (docdirbase): make doc directory be just doc/IPython
4246 * setup.py (docdirbase): make doc directory be just doc/IPython
4235 without version numbers, it will reduce clutter for users.
4247 without version numbers, it will reduce clutter for users.
4236
4248
4237 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4249 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4238 execfile call to prevent possible memory leak. See for details:
4250 execfile call to prevent possible memory leak. See for details:
4239 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4251 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4240
4252
4241 2002-05-15 Fernando Perez <fperez@colorado.edu>
4253 2002-05-15 Fernando Perez <fperez@colorado.edu>
4242
4254
4243 * IPython/Magic.py (Magic.magic_psource): made the object
4255 * IPython/Magic.py (Magic.magic_psource): made the object
4244 introspection names be more standard: pdoc, pdef, pfile and
4256 introspection names be more standard: pdoc, pdef, pfile and
4245 psource. They all print/page their output, and it makes
4257 psource. They all print/page their output, and it makes
4246 remembering them easier. Kept old names for compatibility as
4258 remembering them easier. Kept old names for compatibility as
4247 aliases.
4259 aliases.
4248
4260
4249 2002-05-14 Fernando Perez <fperez@colorado.edu>
4261 2002-05-14 Fernando Perez <fperez@colorado.edu>
4250
4262
4251 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4263 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4252 what the mouse problem was. The trick is to use gnuplot with temp
4264 what the mouse problem was. The trick is to use gnuplot with temp
4253 files and NOT with pipes (for data communication), because having
4265 files and NOT with pipes (for data communication), because having
4254 both pipes and the mouse on is bad news.
4266 both pipes and the mouse on is bad news.
4255
4267
4256 2002-05-13 Fernando Perez <fperez@colorado.edu>
4268 2002-05-13 Fernando Perez <fperez@colorado.edu>
4257
4269
4258 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4270 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4259 bug. Information would be reported about builtins even when
4271 bug. Information would be reported about builtins even when
4260 user-defined functions overrode them.
4272 user-defined functions overrode them.
4261
4273
4262 2002-05-11 Fernando Perez <fperez@colorado.edu>
4274 2002-05-11 Fernando Perez <fperez@colorado.edu>
4263
4275
4264 * IPython/__init__.py (__all__): removed FlexCompleter from
4276 * IPython/__init__.py (__all__): removed FlexCompleter from
4265 __all__ so that things don't fail in platforms without readline.
4277 __all__ so that things don't fail in platforms without readline.
4266
4278
4267 2002-05-10 Fernando Perez <fperez@colorado.edu>
4279 2002-05-10 Fernando Perez <fperez@colorado.edu>
4268
4280
4269 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4281 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4270 it requires Numeric, effectively making Numeric a dependency for
4282 it requires Numeric, effectively making Numeric a dependency for
4271 IPython.
4283 IPython.
4272
4284
4273 * Released 0.2.13
4285 * Released 0.2.13
4274
4286
4275 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4287 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4276 profiler interface. Now all the major options from the profiler
4288 profiler interface. Now all the major options from the profiler
4277 module are directly supported in IPython, both for single
4289 module are directly supported in IPython, both for single
4278 expressions (@prun) and for full programs (@run -p).
4290 expressions (@prun) and for full programs (@run -p).
4279
4291
4280 2002-05-09 Fernando Perez <fperez@colorado.edu>
4292 2002-05-09 Fernando Perez <fperez@colorado.edu>
4281
4293
4282 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4294 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4283 magic properly formatted for screen.
4295 magic properly formatted for screen.
4284
4296
4285 * setup.py (make_shortcut): Changed things to put pdf version in
4297 * setup.py (make_shortcut): Changed things to put pdf version in
4286 doc/ instead of doc/manual (had to change lyxport a bit).
4298 doc/ instead of doc/manual (had to change lyxport a bit).
4287
4299
4288 * IPython/Magic.py (Profile.string_stats): made profile runs go
4300 * IPython/Magic.py (Profile.string_stats): made profile runs go
4289 through pager (they are long and a pager allows searching, saving,
4301 through pager (they are long and a pager allows searching, saving,
4290 etc.)
4302 etc.)
4291
4303
4292 2002-05-08 Fernando Perez <fperez@colorado.edu>
4304 2002-05-08 Fernando Perez <fperez@colorado.edu>
4293
4305
4294 * Released 0.2.12
4306 * Released 0.2.12
4295
4307
4296 2002-05-06 Fernando Perez <fperez@colorado.edu>
4308 2002-05-06 Fernando Perez <fperez@colorado.edu>
4297
4309
4298 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4310 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4299 introduced); 'hist n1 n2' was broken.
4311 introduced); 'hist n1 n2' was broken.
4300 (Magic.magic_pdb): added optional on/off arguments to @pdb
4312 (Magic.magic_pdb): added optional on/off arguments to @pdb
4301 (Magic.magic_run): added option -i to @run, which executes code in
4313 (Magic.magic_run): added option -i to @run, which executes code in
4302 the IPython namespace instead of a clean one. Also added @irun as
4314 the IPython namespace instead of a clean one. Also added @irun as
4303 an alias to @run -i.
4315 an alias to @run -i.
4304
4316
4305 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4317 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4306 fixed (it didn't really do anything, the namespaces were wrong).
4318 fixed (it didn't really do anything, the namespaces were wrong).
4307
4319
4308 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4320 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4309
4321
4310 * IPython/__init__.py (__all__): Fixed package namespace, now
4322 * IPython/__init__.py (__all__): Fixed package namespace, now
4311 'import IPython' does give access to IPython.<all> as
4323 'import IPython' does give access to IPython.<all> as
4312 expected. Also renamed __release__ to Release.
4324 expected. Also renamed __release__ to Release.
4313
4325
4314 * IPython/Debugger.py (__license__): created new Pdb class which
4326 * IPython/Debugger.py (__license__): created new Pdb class which
4315 functions like a drop-in for the normal pdb.Pdb but does NOT
4327 functions like a drop-in for the normal pdb.Pdb but does NOT
4316 import readline by default. This way it doesn't muck up IPython's
4328 import readline by default. This way it doesn't muck up IPython's
4317 readline handling, and now tab-completion finally works in the
4329 readline handling, and now tab-completion finally works in the
4318 debugger -- sort of. It completes things globally visible, but the
4330 debugger -- sort of. It completes things globally visible, but the
4319 completer doesn't track the stack as pdb walks it. That's a bit
4331 completer doesn't track the stack as pdb walks it. That's a bit
4320 tricky, and I'll have to implement it later.
4332 tricky, and I'll have to implement it later.
4321
4333
4322 2002-05-05 Fernando Perez <fperez@colorado.edu>
4334 2002-05-05 Fernando Perez <fperez@colorado.edu>
4323
4335
4324 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4336 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4325 magic docstrings when printed via ? (explicit \'s were being
4337 magic docstrings when printed via ? (explicit \'s were being
4326 printed).
4338 printed).
4327
4339
4328 * IPython/ipmaker.py (make_IPython): fixed namespace
4340 * IPython/ipmaker.py (make_IPython): fixed namespace
4329 identification bug. Now variables loaded via logs or command-line
4341 identification bug. Now variables loaded via logs or command-line
4330 files are recognized in the interactive namespace by @who.
4342 files are recognized in the interactive namespace by @who.
4331
4343
4332 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4344 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4333 log replay system stemming from the string form of Structs.
4345 log replay system stemming from the string form of Structs.
4334
4346
4335 * IPython/Magic.py (Macro.__init__): improved macros to properly
4347 * IPython/Magic.py (Macro.__init__): improved macros to properly
4336 handle magic commands in them.
4348 handle magic commands in them.
4337 (Magic.magic_logstart): usernames are now expanded so 'logstart
4349 (Magic.magic_logstart): usernames are now expanded so 'logstart
4338 ~/mylog' now works.
4350 ~/mylog' now works.
4339
4351
4340 * IPython/iplib.py (complete): fixed bug where paths starting with
4352 * IPython/iplib.py (complete): fixed bug where paths starting with
4341 '/' would be completed as magic names.
4353 '/' would be completed as magic names.
4342
4354
4343 2002-05-04 Fernando Perez <fperez@colorado.edu>
4355 2002-05-04 Fernando Perez <fperez@colorado.edu>
4344
4356
4345 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4357 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4346 allow running full programs under the profiler's control.
4358 allow running full programs under the profiler's control.
4347
4359
4348 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4360 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4349 mode to report exceptions verbosely but without formatting
4361 mode to report exceptions verbosely but without formatting
4350 variables. This addresses the issue of ipython 'freezing' (it's
4362 variables. This addresses the issue of ipython 'freezing' (it's
4351 not frozen, but caught in an expensive formatting loop) when huge
4363 not frozen, but caught in an expensive formatting loop) when huge
4352 variables are in the context of an exception.
4364 variables are in the context of an exception.
4353 (VerboseTB.text): Added '--->' markers at line where exception was
4365 (VerboseTB.text): Added '--->' markers at line where exception was
4354 triggered. Much clearer to read, especially in NoColor modes.
4366 triggered. Much clearer to read, especially in NoColor modes.
4355
4367
4356 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4368 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4357 implemented in reverse when changing to the new parse_options().
4369 implemented in reverse when changing to the new parse_options().
4358
4370
4359 2002-05-03 Fernando Perez <fperez@colorado.edu>
4371 2002-05-03 Fernando Perez <fperez@colorado.edu>
4360
4372
4361 * IPython/Magic.py (Magic.parse_options): new function so that
4373 * IPython/Magic.py (Magic.parse_options): new function so that
4362 magics can parse options easier.
4374 magics can parse options easier.
4363 (Magic.magic_prun): new function similar to profile.run(),
4375 (Magic.magic_prun): new function similar to profile.run(),
4364 suggested by Chris Hart.
4376 suggested by Chris Hart.
4365 (Magic.magic_cd): fixed behavior so that it only changes if
4377 (Magic.magic_cd): fixed behavior so that it only changes if
4366 directory actually is in history.
4378 directory actually is in history.
4367
4379
4368 * IPython/usage.py (__doc__): added information about potential
4380 * IPython/usage.py (__doc__): added information about potential
4369 slowness of Verbose exception mode when there are huge data
4381 slowness of Verbose exception mode when there are huge data
4370 structures to be formatted (thanks to Archie Paulson).
4382 structures to be formatted (thanks to Archie Paulson).
4371
4383
4372 * IPython/ipmaker.py (make_IPython): Changed default logging
4384 * IPython/ipmaker.py (make_IPython): Changed default logging
4373 (when simply called with -log) to use curr_dir/ipython.log in
4385 (when simply called with -log) to use curr_dir/ipython.log in
4374 rotate mode. Fixed crash which was occuring with -log before
4386 rotate mode. Fixed crash which was occuring with -log before
4375 (thanks to Jim Boyle).
4387 (thanks to Jim Boyle).
4376
4388
4377 2002-05-01 Fernando Perez <fperez@colorado.edu>
4389 2002-05-01 Fernando Perez <fperez@colorado.edu>
4378
4390
4379 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4391 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4380 was nasty -- though somewhat of a corner case).
4392 was nasty -- though somewhat of a corner case).
4381
4393
4382 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4394 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4383 text (was a bug).
4395 text (was a bug).
4384
4396
4385 2002-04-30 Fernando Perez <fperez@colorado.edu>
4397 2002-04-30 Fernando Perez <fperez@colorado.edu>
4386
4398
4387 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4399 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4388 a print after ^D or ^C from the user so that the In[] prompt
4400 a print after ^D or ^C from the user so that the In[] prompt
4389 doesn't over-run the gnuplot one.
4401 doesn't over-run the gnuplot one.
4390
4402
4391 2002-04-29 Fernando Perez <fperez@colorado.edu>
4403 2002-04-29 Fernando Perez <fperez@colorado.edu>
4392
4404
4393 * Released 0.2.10
4405 * Released 0.2.10
4394
4406
4395 * IPython/__release__.py (version): get date dynamically.
4407 * IPython/__release__.py (version): get date dynamically.
4396
4408
4397 * Misc. documentation updates thanks to Arnd's comments. Also ran
4409 * Misc. documentation updates thanks to Arnd's comments. Also ran
4398 a full spellcheck on the manual (hadn't been done in a while).
4410 a full spellcheck on the manual (hadn't been done in a while).
4399
4411
4400 2002-04-27 Fernando Perez <fperez@colorado.edu>
4412 2002-04-27 Fernando Perez <fperez@colorado.edu>
4401
4413
4402 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4414 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4403 starting a log in mid-session would reset the input history list.
4415 starting a log in mid-session would reset the input history list.
4404
4416
4405 2002-04-26 Fernando Perez <fperez@colorado.edu>
4417 2002-04-26 Fernando Perez <fperez@colorado.edu>
4406
4418
4407 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4419 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4408 all files were being included in an update. Now anything in
4420 all files were being included in an update. Now anything in
4409 UserConfig that matches [A-Za-z]*.py will go (this excludes
4421 UserConfig that matches [A-Za-z]*.py will go (this excludes
4410 __init__.py)
4422 __init__.py)
4411
4423
4412 2002-04-25 Fernando Perez <fperez@colorado.edu>
4424 2002-04-25 Fernando Perez <fperez@colorado.edu>
4413
4425
4414 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4426 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4415 to __builtins__ so that any form of embedded or imported code can
4427 to __builtins__ so that any form of embedded or imported code can
4416 test for being inside IPython.
4428 test for being inside IPython.
4417
4429
4418 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4430 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4419 changed to GnuplotMagic because it's now an importable module,
4431 changed to GnuplotMagic because it's now an importable module,
4420 this makes the name follow that of the standard Gnuplot module.
4432 this makes the name follow that of the standard Gnuplot module.
4421 GnuplotMagic can now be loaded at any time in mid-session.
4433 GnuplotMagic can now be loaded at any time in mid-session.
4422
4434
4423 2002-04-24 Fernando Perez <fperez@colorado.edu>
4435 2002-04-24 Fernando Perez <fperez@colorado.edu>
4424
4436
4425 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4437 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4426 the globals (IPython has its own namespace) and the
4438 the globals (IPython has its own namespace) and the
4427 PhysicalQuantity stuff is much better anyway.
4439 PhysicalQuantity stuff is much better anyway.
4428
4440
4429 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4441 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4430 embedding example to standard user directory for
4442 embedding example to standard user directory for
4431 distribution. Also put it in the manual.
4443 distribution. Also put it in the manual.
4432
4444
4433 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4445 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4434 instance as first argument (so it doesn't rely on some obscure
4446 instance as first argument (so it doesn't rely on some obscure
4435 hidden global).
4447 hidden global).
4436
4448
4437 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4449 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4438 delimiters. While it prevents ().TAB from working, it allows
4450 delimiters. While it prevents ().TAB from working, it allows
4439 completions in open (... expressions. This is by far a more common
4451 completions in open (... expressions. This is by far a more common
4440 case.
4452 case.
4441
4453
4442 2002-04-23 Fernando Perez <fperez@colorado.edu>
4454 2002-04-23 Fernando Perez <fperez@colorado.edu>
4443
4455
4444 * IPython/Extensions/InterpreterPasteInput.py: new
4456 * IPython/Extensions/InterpreterPasteInput.py: new
4445 syntax-processing module for pasting lines with >>> or ... at the
4457 syntax-processing module for pasting lines with >>> or ... at the
4446 start.
4458 start.
4447
4459
4448 * IPython/Extensions/PhysicalQ_Interactive.py
4460 * IPython/Extensions/PhysicalQ_Interactive.py
4449 (PhysicalQuantityInteractive.__int__): fixed to work with either
4461 (PhysicalQuantityInteractive.__int__): fixed to work with either
4450 Numeric or math.
4462 Numeric or math.
4451
4463
4452 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4464 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4453 provided profiles. Now we have:
4465 provided profiles. Now we have:
4454 -math -> math module as * and cmath with its own namespace.
4466 -math -> math module as * and cmath with its own namespace.
4455 -numeric -> Numeric as *, plus gnuplot & grace
4467 -numeric -> Numeric as *, plus gnuplot & grace
4456 -physics -> same as before
4468 -physics -> same as before
4457
4469
4458 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4470 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4459 user-defined magics wouldn't be found by @magic if they were
4471 user-defined magics wouldn't be found by @magic if they were
4460 defined as class methods. Also cleaned up the namespace search
4472 defined as class methods. Also cleaned up the namespace search
4461 logic and the string building (to use %s instead of many repeated
4473 logic and the string building (to use %s instead of many repeated
4462 string adds).
4474 string adds).
4463
4475
4464 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4476 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4465 of user-defined magics to operate with class methods (cleaner, in
4477 of user-defined magics to operate with class methods (cleaner, in
4466 line with the gnuplot code).
4478 line with the gnuplot code).
4467
4479
4468 2002-04-22 Fernando Perez <fperez@colorado.edu>
4480 2002-04-22 Fernando Perez <fperez@colorado.edu>
4469
4481
4470 * setup.py: updated dependency list so that manual is updated when
4482 * setup.py: updated dependency list so that manual is updated when
4471 all included files change.
4483 all included files change.
4472
4484
4473 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4485 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4474 the delimiter removal option (the fix is ugly right now).
4486 the delimiter removal option (the fix is ugly right now).
4475
4487
4476 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4488 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4477 all of the math profile (quicker loading, no conflict between
4489 all of the math profile (quicker loading, no conflict between
4478 g-9.8 and g-gnuplot).
4490 g-9.8 and g-gnuplot).
4479
4491
4480 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4492 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4481 name of post-mortem files to IPython_crash_report.txt.
4493 name of post-mortem files to IPython_crash_report.txt.
4482
4494
4483 * Cleanup/update of the docs. Added all the new readline info and
4495 * Cleanup/update of the docs. Added all the new readline info and
4484 formatted all lists as 'real lists'.
4496 formatted all lists as 'real lists'.
4485
4497
4486 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4498 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4487 tab-completion options, since the full readline parse_and_bind is
4499 tab-completion options, since the full readline parse_and_bind is
4488 now accessible.
4500 now accessible.
4489
4501
4490 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4502 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4491 handling of readline options. Now users can specify any string to
4503 handling of readline options. Now users can specify any string to
4492 be passed to parse_and_bind(), as well as the delimiters to be
4504 be passed to parse_and_bind(), as well as the delimiters to be
4493 removed.
4505 removed.
4494 (InteractiveShell.__init__): Added __name__ to the global
4506 (InteractiveShell.__init__): Added __name__ to the global
4495 namespace so that things like Itpl which rely on its existence
4507 namespace so that things like Itpl which rely on its existence
4496 don't crash.
4508 don't crash.
4497 (InteractiveShell._prefilter): Defined the default with a _ so
4509 (InteractiveShell._prefilter): Defined the default with a _ so
4498 that prefilter() is easier to override, while the default one
4510 that prefilter() is easier to override, while the default one
4499 remains available.
4511 remains available.
4500
4512
4501 2002-04-18 Fernando Perez <fperez@colorado.edu>
4513 2002-04-18 Fernando Perez <fperez@colorado.edu>
4502
4514
4503 * Added information about pdb in the docs.
4515 * Added information about pdb in the docs.
4504
4516
4505 2002-04-17 Fernando Perez <fperez@colorado.edu>
4517 2002-04-17 Fernando Perez <fperez@colorado.edu>
4506
4518
4507 * IPython/ipmaker.py (make_IPython): added rc_override option to
4519 * IPython/ipmaker.py (make_IPython): added rc_override option to
4508 allow passing config options at creation time which may override
4520 allow passing config options at creation time which may override
4509 anything set in the config files or command line. This is
4521 anything set in the config files or command line. This is
4510 particularly useful for configuring embedded instances.
4522 particularly useful for configuring embedded instances.
4511
4523
4512 2002-04-15 Fernando Perez <fperez@colorado.edu>
4524 2002-04-15 Fernando Perez <fperez@colorado.edu>
4513
4525
4514 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4526 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4515 crash embedded instances because of the input cache falling out of
4527 crash embedded instances because of the input cache falling out of
4516 sync with the output counter.
4528 sync with the output counter.
4517
4529
4518 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4530 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4519 mode which calls pdb after an uncaught exception in IPython itself.
4531 mode which calls pdb after an uncaught exception in IPython itself.
4520
4532
4521 2002-04-14 Fernando Perez <fperez@colorado.edu>
4533 2002-04-14 Fernando Perez <fperez@colorado.edu>
4522
4534
4523 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4535 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4524 readline, fix it back after each call.
4536 readline, fix it back after each call.
4525
4537
4526 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4538 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4527 method to force all access via __call__(), which guarantees that
4539 method to force all access via __call__(), which guarantees that
4528 traceback references are properly deleted.
4540 traceback references are properly deleted.
4529
4541
4530 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4542 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4531 improve printing when pprint is in use.
4543 improve printing when pprint is in use.
4532
4544
4533 2002-04-13 Fernando Perez <fperez@colorado.edu>
4545 2002-04-13 Fernando Perez <fperez@colorado.edu>
4534
4546
4535 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4547 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4536 exceptions aren't caught anymore. If the user triggers one, he
4548 exceptions aren't caught anymore. If the user triggers one, he
4537 should know why he's doing it and it should go all the way up,
4549 should know why he's doing it and it should go all the way up,
4538 just like any other exception. So now @abort will fully kill the
4550 just like any other exception. So now @abort will fully kill the
4539 embedded interpreter and the embedding code (unless that happens
4551 embedded interpreter and the embedding code (unless that happens
4540 to catch SystemExit).
4552 to catch SystemExit).
4541
4553
4542 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4554 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4543 and a debugger() method to invoke the interactive pdb debugger
4555 and a debugger() method to invoke the interactive pdb debugger
4544 after printing exception information. Also added the corresponding
4556 after printing exception information. Also added the corresponding
4545 -pdb option and @pdb magic to control this feature, and updated
4557 -pdb option and @pdb magic to control this feature, and updated
4546 the docs. After a suggestion from Christopher Hart
4558 the docs. After a suggestion from Christopher Hart
4547 (hart-AT-caltech.edu).
4559 (hart-AT-caltech.edu).
4548
4560
4549 2002-04-12 Fernando Perez <fperez@colorado.edu>
4561 2002-04-12 Fernando Perez <fperez@colorado.edu>
4550
4562
4551 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4563 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4552 the exception handlers defined by the user (not the CrashHandler)
4564 the exception handlers defined by the user (not the CrashHandler)
4553 so that user exceptions don't trigger an ipython bug report.
4565 so that user exceptions don't trigger an ipython bug report.
4554
4566
4555 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4567 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4556 configurable (it should have always been so).
4568 configurable (it should have always been so).
4557
4569
4558 2002-03-26 Fernando Perez <fperez@colorado.edu>
4570 2002-03-26 Fernando Perez <fperez@colorado.edu>
4559
4571
4560 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4572 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4561 and there to fix embedding namespace issues. This should all be
4573 and there to fix embedding namespace issues. This should all be
4562 done in a more elegant way.
4574 done in a more elegant way.
4563
4575
4564 2002-03-25 Fernando Perez <fperez@colorado.edu>
4576 2002-03-25 Fernando Perez <fperez@colorado.edu>
4565
4577
4566 * IPython/genutils.py (get_home_dir): Try to make it work under
4578 * IPython/genutils.py (get_home_dir): Try to make it work under
4567 win9x also.
4579 win9x also.
4568
4580
4569 2002-03-20 Fernando Perez <fperez@colorado.edu>
4581 2002-03-20 Fernando Perez <fperez@colorado.edu>
4570
4582
4571 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4583 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4572 sys.displayhook untouched upon __init__.
4584 sys.displayhook untouched upon __init__.
4573
4585
4574 2002-03-19 Fernando Perez <fperez@colorado.edu>
4586 2002-03-19 Fernando Perez <fperez@colorado.edu>
4575
4587
4576 * Released 0.2.9 (for embedding bug, basically).
4588 * Released 0.2.9 (for embedding bug, basically).
4577
4589
4578 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4590 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4579 exceptions so that enclosing shell's state can be restored.
4591 exceptions so that enclosing shell's state can be restored.
4580
4592
4581 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4593 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4582 naming conventions in the .ipython/ dir.
4594 naming conventions in the .ipython/ dir.
4583
4595
4584 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4596 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4585 from delimiters list so filenames with - in them get expanded.
4597 from delimiters list so filenames with - in them get expanded.
4586
4598
4587 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4599 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4588 sys.displayhook not being properly restored after an embedded call.
4600 sys.displayhook not being properly restored after an embedded call.
4589
4601
4590 2002-03-18 Fernando Perez <fperez@colorado.edu>
4602 2002-03-18 Fernando Perez <fperez@colorado.edu>
4591
4603
4592 * Released 0.2.8
4604 * Released 0.2.8
4593
4605
4594 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4606 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4595 some files weren't being included in a -upgrade.
4607 some files weren't being included in a -upgrade.
4596 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4608 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4597 on' so that the first tab completes.
4609 on' so that the first tab completes.
4598 (InteractiveShell.handle_magic): fixed bug with spaces around
4610 (InteractiveShell.handle_magic): fixed bug with spaces around
4599 quotes breaking many magic commands.
4611 quotes breaking many magic commands.
4600
4612
4601 * setup.py: added note about ignoring the syntax error messages at
4613 * setup.py: added note about ignoring the syntax error messages at
4602 installation.
4614 installation.
4603
4615
4604 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4616 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4605 streamlining the gnuplot interface, now there's only one magic @gp.
4617 streamlining the gnuplot interface, now there's only one magic @gp.
4606
4618
4607 2002-03-17 Fernando Perez <fperez@colorado.edu>
4619 2002-03-17 Fernando Perez <fperez@colorado.edu>
4608
4620
4609 * IPython/UserConfig/magic_gnuplot.py: new name for the
4621 * IPython/UserConfig/magic_gnuplot.py: new name for the
4610 example-magic_pm.py file. Much enhanced system, now with a shell
4622 example-magic_pm.py file. Much enhanced system, now with a shell
4611 for communicating directly with gnuplot, one command at a time.
4623 for communicating directly with gnuplot, one command at a time.
4612
4624
4613 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4625 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4614 setting __name__=='__main__'.
4626 setting __name__=='__main__'.
4615
4627
4616 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4628 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4617 mini-shell for accessing gnuplot from inside ipython. Should
4629 mini-shell for accessing gnuplot from inside ipython. Should
4618 extend it later for grace access too. Inspired by Arnd's
4630 extend it later for grace access too. Inspired by Arnd's
4619 suggestion.
4631 suggestion.
4620
4632
4621 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4633 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4622 calling magic functions with () in their arguments. Thanks to Arnd
4634 calling magic functions with () in their arguments. Thanks to Arnd
4623 Baecker for pointing this to me.
4635 Baecker for pointing this to me.
4624
4636
4625 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4637 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4626 infinitely for integer or complex arrays (only worked with floats).
4638 infinitely for integer or complex arrays (only worked with floats).
4627
4639
4628 2002-03-16 Fernando Perez <fperez@colorado.edu>
4640 2002-03-16 Fernando Perez <fperez@colorado.edu>
4629
4641
4630 * setup.py: Merged setup and setup_windows into a single script
4642 * setup.py: Merged setup and setup_windows into a single script
4631 which properly handles things for windows users.
4643 which properly handles things for windows users.
4632
4644
4633 2002-03-15 Fernando Perez <fperez@colorado.edu>
4645 2002-03-15 Fernando Perez <fperez@colorado.edu>
4634
4646
4635 * Big change to the manual: now the magics are all automatically
4647 * Big change to the manual: now the magics are all automatically
4636 documented. This information is generated from their docstrings
4648 documented. This information is generated from their docstrings
4637 and put in a latex file included by the manual lyx file. This way
4649 and put in a latex file included by the manual lyx file. This way
4638 we get always up to date information for the magics. The manual
4650 we get always up to date information for the magics. The manual
4639 now also has proper version information, also auto-synced.
4651 now also has proper version information, also auto-synced.
4640
4652
4641 For this to work, an undocumented --magic_docstrings option was added.
4653 For this to work, an undocumented --magic_docstrings option was added.
4642
4654
4643 2002-03-13 Fernando Perez <fperez@colorado.edu>
4655 2002-03-13 Fernando Perez <fperez@colorado.edu>
4644
4656
4645 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4657 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4646 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4658 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4647
4659
4648 2002-03-12 Fernando Perez <fperez@colorado.edu>
4660 2002-03-12 Fernando Perez <fperez@colorado.edu>
4649
4661
4650 * IPython/ultraTB.py (TermColors): changed color escapes again to
4662 * IPython/ultraTB.py (TermColors): changed color escapes again to
4651 fix the (old, reintroduced) line-wrapping bug. Basically, if
4663 fix the (old, reintroduced) line-wrapping bug. Basically, if
4652 \001..\002 aren't given in the color escapes, lines get wrapped
4664 \001..\002 aren't given in the color escapes, lines get wrapped
4653 weirdly. But giving those screws up old xterms and emacs terms. So
4665 weirdly. But giving those screws up old xterms and emacs terms. So
4654 I added some logic for emacs terms to be ok, but I can't identify old
4666 I added some logic for emacs terms to be ok, but I can't identify old
4655 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4667 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4656
4668
4657 2002-03-10 Fernando Perez <fperez@colorado.edu>
4669 2002-03-10 Fernando Perez <fperez@colorado.edu>
4658
4670
4659 * IPython/usage.py (__doc__): Various documentation cleanups and
4671 * IPython/usage.py (__doc__): Various documentation cleanups and
4660 updates, both in usage docstrings and in the manual.
4672 updates, both in usage docstrings and in the manual.
4661
4673
4662 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4674 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4663 handling of caching. Set minimum acceptabe value for having a
4675 handling of caching. Set minimum acceptabe value for having a
4664 cache at 20 values.
4676 cache at 20 values.
4665
4677
4666 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4678 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4667 install_first_time function to a method, renamed it and added an
4679 install_first_time function to a method, renamed it and added an
4668 'upgrade' mode. Now people can update their config directory with
4680 'upgrade' mode. Now people can update their config directory with
4669 a simple command line switch (-upgrade, also new).
4681 a simple command line switch (-upgrade, also new).
4670
4682
4671 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4683 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4672 @file (convenient for automagic users under Python >= 2.2).
4684 @file (convenient for automagic users under Python >= 2.2).
4673 Removed @files (it seemed more like a plural than an abbrev. of
4685 Removed @files (it seemed more like a plural than an abbrev. of
4674 'file show').
4686 'file show').
4675
4687
4676 * IPython/iplib.py (install_first_time): Fixed crash if there were
4688 * IPython/iplib.py (install_first_time): Fixed crash if there were
4677 backup files ('~') in .ipython/ install directory.
4689 backup files ('~') in .ipython/ install directory.
4678
4690
4679 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4691 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4680 system. Things look fine, but these changes are fairly
4692 system. Things look fine, but these changes are fairly
4681 intrusive. Test them for a few days.
4693 intrusive. Test them for a few days.
4682
4694
4683 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4695 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4684 the prompts system. Now all in/out prompt strings are user
4696 the prompts system. Now all in/out prompt strings are user
4685 controllable. This is particularly useful for embedding, as one
4697 controllable. This is particularly useful for embedding, as one
4686 can tag embedded instances with particular prompts.
4698 can tag embedded instances with particular prompts.
4687
4699
4688 Also removed global use of sys.ps1/2, which now allows nested
4700 Also removed global use of sys.ps1/2, which now allows nested
4689 embeddings without any problems. Added command-line options for
4701 embeddings without any problems. Added command-line options for
4690 the prompt strings.
4702 the prompt strings.
4691
4703
4692 2002-03-08 Fernando Perez <fperez@colorado.edu>
4704 2002-03-08 Fernando Perez <fperez@colorado.edu>
4693
4705
4694 * IPython/UserConfig/example-embed-short.py (ipshell): added
4706 * IPython/UserConfig/example-embed-short.py (ipshell): added
4695 example file with the bare minimum code for embedding.
4707 example file with the bare minimum code for embedding.
4696
4708
4697 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4709 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4698 functionality for the embeddable shell to be activated/deactivated
4710 functionality for the embeddable shell to be activated/deactivated
4699 either globally or at each call.
4711 either globally or at each call.
4700
4712
4701 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4713 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4702 rewriting the prompt with '--->' for auto-inputs with proper
4714 rewriting the prompt with '--->' for auto-inputs with proper
4703 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4715 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4704 this is handled by the prompts class itself, as it should.
4716 this is handled by the prompts class itself, as it should.
4705
4717
4706 2002-03-05 Fernando Perez <fperez@colorado.edu>
4718 2002-03-05 Fernando Perez <fperez@colorado.edu>
4707
4719
4708 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4720 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4709 @logstart to avoid name clashes with the math log function.
4721 @logstart to avoid name clashes with the math log function.
4710
4722
4711 * Big updates to X/Emacs section of the manual.
4723 * Big updates to X/Emacs section of the manual.
4712
4724
4713 * Removed ipython_emacs. Milan explained to me how to pass
4725 * Removed ipython_emacs. Milan explained to me how to pass
4714 arguments to ipython through Emacs. Some day I'm going to end up
4726 arguments to ipython through Emacs. Some day I'm going to end up
4715 learning some lisp...
4727 learning some lisp...
4716
4728
4717 2002-03-04 Fernando Perez <fperez@colorado.edu>
4729 2002-03-04 Fernando Perez <fperez@colorado.edu>
4718
4730
4719 * IPython/ipython_emacs: Created script to be used as the
4731 * IPython/ipython_emacs: Created script to be used as the
4720 py-python-command Emacs variable so we can pass IPython
4732 py-python-command Emacs variable so we can pass IPython
4721 parameters. I can't figure out how to tell Emacs directly to pass
4733 parameters. I can't figure out how to tell Emacs directly to pass
4722 parameters to IPython, so a dummy shell script will do it.
4734 parameters to IPython, so a dummy shell script will do it.
4723
4735
4724 Other enhancements made for things to work better under Emacs'
4736 Other enhancements made for things to work better under Emacs'
4725 various types of terminals. Many thanks to Milan Zamazal
4737 various types of terminals. Many thanks to Milan Zamazal
4726 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4738 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4727
4739
4728 2002-03-01 Fernando Perez <fperez@colorado.edu>
4740 2002-03-01 Fernando Perez <fperez@colorado.edu>
4729
4741
4730 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4742 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4731 that loading of readline is now optional. This gives better
4743 that loading of readline is now optional. This gives better
4732 control to emacs users.
4744 control to emacs users.
4733
4745
4734 * IPython/ultraTB.py (__date__): Modified color escape sequences
4746 * IPython/ultraTB.py (__date__): Modified color escape sequences
4735 and now things work fine under xterm and in Emacs' term buffers
4747 and now things work fine under xterm and in Emacs' term buffers
4736 (though not shell ones). Well, in emacs you get colors, but all
4748 (though not shell ones). Well, in emacs you get colors, but all
4737 seem to be 'light' colors (no difference between dark and light
4749 seem to be 'light' colors (no difference between dark and light
4738 ones). But the garbage chars are gone, and also in xterms. It
4750 ones). But the garbage chars are gone, and also in xterms. It
4739 seems that now I'm using 'cleaner' ansi sequences.
4751 seems that now I'm using 'cleaner' ansi sequences.
4740
4752
4741 2002-02-21 Fernando Perez <fperez@colorado.edu>
4753 2002-02-21 Fernando Perez <fperez@colorado.edu>
4742
4754
4743 * Released 0.2.7 (mainly to publish the scoping fix).
4755 * Released 0.2.7 (mainly to publish the scoping fix).
4744
4756
4745 * IPython/Logger.py (Logger.logstate): added. A corresponding
4757 * IPython/Logger.py (Logger.logstate): added. A corresponding
4746 @logstate magic was created.
4758 @logstate magic was created.
4747
4759
4748 * IPython/Magic.py: fixed nested scoping problem under Python
4760 * IPython/Magic.py: fixed nested scoping problem under Python
4749 2.1.x (automagic wasn't working).
4761 2.1.x (automagic wasn't working).
4750
4762
4751 2002-02-20 Fernando Perez <fperez@colorado.edu>
4763 2002-02-20 Fernando Perez <fperez@colorado.edu>
4752
4764
4753 * Released 0.2.6.
4765 * Released 0.2.6.
4754
4766
4755 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4767 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4756 option so that logs can come out without any headers at all.
4768 option so that logs can come out without any headers at all.
4757
4769
4758 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4770 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4759 SciPy.
4771 SciPy.
4760
4772
4761 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4773 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4762 that embedded IPython calls don't require vars() to be explicitly
4774 that embedded IPython calls don't require vars() to be explicitly
4763 passed. Now they are extracted from the caller's frame (code
4775 passed. Now they are extracted from the caller's frame (code
4764 snatched from Eric Jones' weave). Added better documentation to
4776 snatched from Eric Jones' weave). Added better documentation to
4765 the section on embedding and the example file.
4777 the section on embedding and the example file.
4766
4778
4767 * IPython/genutils.py (page): Changed so that under emacs, it just
4779 * IPython/genutils.py (page): Changed so that under emacs, it just
4768 prints the string. You can then page up and down in the emacs
4780 prints the string. You can then page up and down in the emacs
4769 buffer itself. This is how the builtin help() works.
4781 buffer itself. This is how the builtin help() works.
4770
4782
4771 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4783 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4772 macro scoping: macros need to be executed in the user's namespace
4784 macro scoping: macros need to be executed in the user's namespace
4773 to work as if they had been typed by the user.
4785 to work as if they had been typed by the user.
4774
4786
4775 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4787 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4776 execute automatically (no need to type 'exec...'). They then
4788 execute automatically (no need to type 'exec...'). They then
4777 behave like 'true macros'. The printing system was also modified
4789 behave like 'true macros'. The printing system was also modified
4778 for this to work.
4790 for this to work.
4779
4791
4780 2002-02-19 Fernando Perez <fperez@colorado.edu>
4792 2002-02-19 Fernando Perez <fperez@colorado.edu>
4781
4793
4782 * IPython/genutils.py (page_file): new function for paging files
4794 * IPython/genutils.py (page_file): new function for paging files
4783 in an OS-independent way. Also necessary for file viewing to work
4795 in an OS-independent way. Also necessary for file viewing to work
4784 well inside Emacs buffers.
4796 well inside Emacs buffers.
4785 (page): Added checks for being in an emacs buffer.
4797 (page): Added checks for being in an emacs buffer.
4786 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4798 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4787 same bug in iplib.
4799 same bug in iplib.
4788
4800
4789 2002-02-18 Fernando Perez <fperez@colorado.edu>
4801 2002-02-18 Fernando Perez <fperez@colorado.edu>
4790
4802
4791 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4803 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4792 of readline so that IPython can work inside an Emacs buffer.
4804 of readline so that IPython can work inside an Emacs buffer.
4793
4805
4794 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4806 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4795 method signatures (they weren't really bugs, but it looks cleaner
4807 method signatures (they weren't really bugs, but it looks cleaner
4796 and keeps PyChecker happy).
4808 and keeps PyChecker happy).
4797
4809
4798 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4810 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4799 for implementing various user-defined hooks. Currently only
4811 for implementing various user-defined hooks. Currently only
4800 display is done.
4812 display is done.
4801
4813
4802 * IPython/Prompts.py (CachedOutput._display): changed display
4814 * IPython/Prompts.py (CachedOutput._display): changed display
4803 functions so that they can be dynamically changed by users easily.
4815 functions so that they can be dynamically changed by users easily.
4804
4816
4805 * IPython/Extensions/numeric_formats.py (num_display): added an
4817 * IPython/Extensions/numeric_formats.py (num_display): added an
4806 extension for printing NumPy arrays in flexible manners. It
4818 extension for printing NumPy arrays in flexible manners. It
4807 doesn't do anything yet, but all the structure is in
4819 doesn't do anything yet, but all the structure is in
4808 place. Ultimately the plan is to implement output format control
4820 place. Ultimately the plan is to implement output format control
4809 like in Octave.
4821 like in Octave.
4810
4822
4811 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4823 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4812 methods are found at run-time by all the automatic machinery.
4824 methods are found at run-time by all the automatic machinery.
4813
4825
4814 2002-02-17 Fernando Perez <fperez@colorado.edu>
4826 2002-02-17 Fernando Perez <fperez@colorado.edu>
4815
4827
4816 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4828 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4817 whole file a little.
4829 whole file a little.
4818
4830
4819 * ToDo: closed this document. Now there's a new_design.lyx
4831 * ToDo: closed this document. Now there's a new_design.lyx
4820 document for all new ideas. Added making a pdf of it for the
4832 document for all new ideas. Added making a pdf of it for the
4821 end-user distro.
4833 end-user distro.
4822
4834
4823 * IPython/Logger.py (Logger.switch_log): Created this to replace
4835 * IPython/Logger.py (Logger.switch_log): Created this to replace
4824 logon() and logoff(). It also fixes a nasty crash reported by
4836 logon() and logoff(). It also fixes a nasty crash reported by
4825 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4837 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4826
4838
4827 * IPython/iplib.py (complete): got auto-completion to work with
4839 * IPython/iplib.py (complete): got auto-completion to work with
4828 automagic (I had wanted this for a long time).
4840 automagic (I had wanted this for a long time).
4829
4841
4830 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4842 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4831 to @file, since file() is now a builtin and clashes with automagic
4843 to @file, since file() is now a builtin and clashes with automagic
4832 for @file.
4844 for @file.
4833
4845
4834 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4846 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4835 of this was previously in iplib, which had grown to more than 2000
4847 of this was previously in iplib, which had grown to more than 2000
4836 lines, way too long. No new functionality, but it makes managing
4848 lines, way too long. No new functionality, but it makes managing
4837 the code a bit easier.
4849 the code a bit easier.
4838
4850
4839 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4851 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4840 information to crash reports.
4852 information to crash reports.
4841
4853
4842 2002-02-12 Fernando Perez <fperez@colorado.edu>
4854 2002-02-12 Fernando Perez <fperez@colorado.edu>
4843
4855
4844 * Released 0.2.5.
4856 * Released 0.2.5.
4845
4857
4846 2002-02-11 Fernando Perez <fperez@colorado.edu>
4858 2002-02-11 Fernando Perez <fperez@colorado.edu>
4847
4859
4848 * Wrote a relatively complete Windows installer. It puts
4860 * Wrote a relatively complete Windows installer. It puts
4849 everything in place, creates Start Menu entries and fixes the
4861 everything in place, creates Start Menu entries and fixes the
4850 color issues. Nothing fancy, but it works.
4862 color issues. Nothing fancy, but it works.
4851
4863
4852 2002-02-10 Fernando Perez <fperez@colorado.edu>
4864 2002-02-10 Fernando Perez <fperez@colorado.edu>
4853
4865
4854 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4866 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4855 os.path.expanduser() call so that we can type @run ~/myfile.py and
4867 os.path.expanduser() call so that we can type @run ~/myfile.py and
4856 have thigs work as expected.
4868 have thigs work as expected.
4857
4869
4858 * IPython/genutils.py (page): fixed exception handling so things
4870 * IPython/genutils.py (page): fixed exception handling so things
4859 work both in Unix and Windows correctly. Quitting a pager triggers
4871 work both in Unix and Windows correctly. Quitting a pager triggers
4860 an IOError/broken pipe in Unix, and in windows not finding a pager
4872 an IOError/broken pipe in Unix, and in windows not finding a pager
4861 is also an IOError, so I had to actually look at the return value
4873 is also an IOError, so I had to actually look at the return value
4862 of the exception, not just the exception itself. Should be ok now.
4874 of the exception, not just the exception itself. Should be ok now.
4863
4875
4864 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4876 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4865 modified to allow case-insensitive color scheme changes.
4877 modified to allow case-insensitive color scheme changes.
4866
4878
4867 2002-02-09 Fernando Perez <fperez@colorado.edu>
4879 2002-02-09 Fernando Perez <fperez@colorado.edu>
4868
4880
4869 * IPython/genutils.py (native_line_ends): new function to leave
4881 * IPython/genutils.py (native_line_ends): new function to leave
4870 user config files with os-native line-endings.
4882 user config files with os-native line-endings.
4871
4883
4872 * README and manual updates.
4884 * README and manual updates.
4873
4885
4874 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4886 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4875 instead of StringType to catch Unicode strings.
4887 instead of StringType to catch Unicode strings.
4876
4888
4877 * IPython/genutils.py (filefind): fixed bug for paths with
4889 * IPython/genutils.py (filefind): fixed bug for paths with
4878 embedded spaces (very common in Windows).
4890 embedded spaces (very common in Windows).
4879
4891
4880 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4892 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4881 files under Windows, so that they get automatically associated
4893 files under Windows, so that they get automatically associated
4882 with a text editor. Windows makes it a pain to handle
4894 with a text editor. Windows makes it a pain to handle
4883 extension-less files.
4895 extension-less files.
4884
4896
4885 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4897 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4886 warning about readline only occur for Posix. In Windows there's no
4898 warning about readline only occur for Posix. In Windows there's no
4887 way to get readline, so why bother with the warning.
4899 way to get readline, so why bother with the warning.
4888
4900
4889 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4901 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4890 for __str__ instead of dir(self), since dir() changed in 2.2.
4902 for __str__ instead of dir(self), since dir() changed in 2.2.
4891
4903
4892 * Ported to Windows! Tested on XP, I suspect it should work fine
4904 * Ported to Windows! Tested on XP, I suspect it should work fine
4893 on NT/2000, but I don't think it will work on 98 et al. That
4905 on NT/2000, but I don't think it will work on 98 et al. That
4894 series of Windows is such a piece of junk anyway that I won't try
4906 series of Windows is such a piece of junk anyway that I won't try
4895 porting it there. The XP port was straightforward, showed a few
4907 porting it there. The XP port was straightforward, showed a few
4896 bugs here and there (fixed all), in particular some string
4908 bugs here and there (fixed all), in particular some string
4897 handling stuff which required considering Unicode strings (which
4909 handling stuff which required considering Unicode strings (which
4898 Windows uses). This is good, but hasn't been too tested :) No
4910 Windows uses). This is good, but hasn't been too tested :) No
4899 fancy installer yet, I'll put a note in the manual so people at
4911 fancy installer yet, I'll put a note in the manual so people at
4900 least make manually a shortcut.
4912 least make manually a shortcut.
4901
4913
4902 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4914 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4903 into a single one, "colors". This now controls both prompt and
4915 into a single one, "colors". This now controls both prompt and
4904 exception color schemes, and can be changed both at startup
4916 exception color schemes, and can be changed both at startup
4905 (either via command-line switches or via ipythonrc files) and at
4917 (either via command-line switches or via ipythonrc files) and at
4906 runtime, with @colors.
4918 runtime, with @colors.
4907 (Magic.magic_run): renamed @prun to @run and removed the old
4919 (Magic.magic_run): renamed @prun to @run and removed the old
4908 @run. The two were too similar to warrant keeping both.
4920 @run. The two were too similar to warrant keeping both.
4909
4921
4910 2002-02-03 Fernando Perez <fperez@colorado.edu>
4922 2002-02-03 Fernando Perez <fperez@colorado.edu>
4911
4923
4912 * IPython/iplib.py (install_first_time): Added comment on how to
4924 * IPython/iplib.py (install_first_time): Added comment on how to
4913 configure the color options for first-time users. Put a <return>
4925 configure the color options for first-time users. Put a <return>
4914 request at the end so that small-terminal users get a chance to
4926 request at the end so that small-terminal users get a chance to
4915 read the startup info.
4927 read the startup info.
4916
4928
4917 2002-01-23 Fernando Perez <fperez@colorado.edu>
4929 2002-01-23 Fernando Perez <fperez@colorado.edu>
4918
4930
4919 * IPython/iplib.py (CachedOutput.update): Changed output memory
4931 * IPython/iplib.py (CachedOutput.update): Changed output memory
4920 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4932 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4921 input history we still use _i. Did this b/c these variable are
4933 input history we still use _i. Did this b/c these variable are
4922 very commonly used in interactive work, so the less we need to
4934 very commonly used in interactive work, so the less we need to
4923 type the better off we are.
4935 type the better off we are.
4924 (Magic.magic_prun): updated @prun to better handle the namespaces
4936 (Magic.magic_prun): updated @prun to better handle the namespaces
4925 the file will run in, including a fix for __name__ not being set
4937 the file will run in, including a fix for __name__ not being set
4926 before.
4938 before.
4927
4939
4928 2002-01-20 Fernando Perez <fperez@colorado.edu>
4940 2002-01-20 Fernando Perez <fperez@colorado.edu>
4929
4941
4930 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4942 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4931 extra garbage for Python 2.2. Need to look more carefully into
4943 extra garbage for Python 2.2. Need to look more carefully into
4932 this later.
4944 this later.
4933
4945
4934 2002-01-19 Fernando Perez <fperez@colorado.edu>
4946 2002-01-19 Fernando Perez <fperez@colorado.edu>
4935
4947
4936 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4948 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4937 display SyntaxError exceptions properly formatted when they occur
4949 display SyntaxError exceptions properly formatted when they occur
4938 (they can be triggered by imported code).
4950 (they can be triggered by imported code).
4939
4951
4940 2002-01-18 Fernando Perez <fperez@colorado.edu>
4952 2002-01-18 Fernando Perez <fperez@colorado.edu>
4941
4953
4942 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4954 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4943 SyntaxError exceptions are reported nicely formatted, instead of
4955 SyntaxError exceptions are reported nicely formatted, instead of
4944 spitting out only offset information as before.
4956 spitting out only offset information as before.
4945 (Magic.magic_prun): Added the @prun function for executing
4957 (Magic.magic_prun): Added the @prun function for executing
4946 programs with command line args inside IPython.
4958 programs with command line args inside IPython.
4947
4959
4948 2002-01-16 Fernando Perez <fperez@colorado.edu>
4960 2002-01-16 Fernando Perez <fperez@colorado.edu>
4949
4961
4950 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4962 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4951 to *not* include the last item given in a range. This brings their
4963 to *not* include the last item given in a range. This brings their
4952 behavior in line with Python's slicing:
4964 behavior in line with Python's slicing:
4953 a[n1:n2] -> a[n1]...a[n2-1]
4965 a[n1:n2] -> a[n1]...a[n2-1]
4954 It may be a bit less convenient, but I prefer to stick to Python's
4966 It may be a bit less convenient, but I prefer to stick to Python's
4955 conventions *everywhere*, so users never have to wonder.
4967 conventions *everywhere*, so users never have to wonder.
4956 (Magic.magic_macro): Added @macro function to ease the creation of
4968 (Magic.magic_macro): Added @macro function to ease the creation of
4957 macros.
4969 macros.
4958
4970
4959 2002-01-05 Fernando Perez <fperez@colorado.edu>
4971 2002-01-05 Fernando Perez <fperez@colorado.edu>
4960
4972
4961 * Released 0.2.4.
4973 * Released 0.2.4.
4962
4974
4963 * IPython/iplib.py (Magic.magic_pdef):
4975 * IPython/iplib.py (Magic.magic_pdef):
4964 (InteractiveShell.safe_execfile): report magic lines and error
4976 (InteractiveShell.safe_execfile): report magic lines and error
4965 lines without line numbers so one can easily copy/paste them for
4977 lines without line numbers so one can easily copy/paste them for
4966 re-execution.
4978 re-execution.
4967
4979
4968 * Updated manual with recent changes.
4980 * Updated manual with recent changes.
4969
4981
4970 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4982 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4971 docstring printing when class? is called. Very handy for knowing
4983 docstring printing when class? is called. Very handy for knowing
4972 how to create class instances (as long as __init__ is well
4984 how to create class instances (as long as __init__ is well
4973 documented, of course :)
4985 documented, of course :)
4974 (Magic.magic_doc): print both class and constructor docstrings.
4986 (Magic.magic_doc): print both class and constructor docstrings.
4975 (Magic.magic_pdef): give constructor info if passed a class and
4987 (Magic.magic_pdef): give constructor info if passed a class and
4976 __call__ info for callable object instances.
4988 __call__ info for callable object instances.
4977
4989
4978 2002-01-04 Fernando Perez <fperez@colorado.edu>
4990 2002-01-04 Fernando Perez <fperez@colorado.edu>
4979
4991
4980 * Made deep_reload() off by default. It doesn't always work
4992 * Made deep_reload() off by default. It doesn't always work
4981 exactly as intended, so it's probably safer to have it off. It's
4993 exactly as intended, so it's probably safer to have it off. It's
4982 still available as dreload() anyway, so nothing is lost.
4994 still available as dreload() anyway, so nothing is lost.
4983
4995
4984 2002-01-02 Fernando Perez <fperez@colorado.edu>
4996 2002-01-02 Fernando Perez <fperez@colorado.edu>
4985
4997
4986 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4998 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4987 so I wanted an updated release).
4999 so I wanted an updated release).
4988
5000
4989 2001-12-27 Fernando Perez <fperez@colorado.edu>
5001 2001-12-27 Fernando Perez <fperez@colorado.edu>
4990
5002
4991 * IPython/iplib.py (InteractiveShell.interact): Added the original
5003 * IPython/iplib.py (InteractiveShell.interact): Added the original
4992 code from 'code.py' for this module in order to change the
5004 code from 'code.py' for this module in order to change the
4993 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5005 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4994 the history cache would break when the user hit Ctrl-C, and
5006 the history cache would break when the user hit Ctrl-C, and
4995 interact() offers no way to add any hooks to it.
5007 interact() offers no way to add any hooks to it.
4996
5008
4997 2001-12-23 Fernando Perez <fperez@colorado.edu>
5009 2001-12-23 Fernando Perez <fperez@colorado.edu>
4998
5010
4999 * setup.py: added check for 'MANIFEST' before trying to remove
5011 * setup.py: added check for 'MANIFEST' before trying to remove
5000 it. Thanks to Sean Reifschneider.
5012 it. Thanks to Sean Reifschneider.
5001
5013
5002 2001-12-22 Fernando Perez <fperez@colorado.edu>
5014 2001-12-22 Fernando Perez <fperez@colorado.edu>
5003
5015
5004 * Released 0.2.2.
5016 * Released 0.2.2.
5005
5017
5006 * Finished (reasonably) writing the manual. Later will add the
5018 * Finished (reasonably) writing the manual. Later will add the
5007 python-standard navigation stylesheets, but for the time being
5019 python-standard navigation stylesheets, but for the time being
5008 it's fairly complete. Distribution will include html and pdf
5020 it's fairly complete. Distribution will include html and pdf
5009 versions.
5021 versions.
5010
5022
5011 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5023 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5012 (MayaVi author).
5024 (MayaVi author).
5013
5025
5014 2001-12-21 Fernando Perez <fperez@colorado.edu>
5026 2001-12-21 Fernando Perez <fperez@colorado.edu>
5015
5027
5016 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5028 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5017 good public release, I think (with the manual and the distutils
5029 good public release, I think (with the manual and the distutils
5018 installer). The manual can use some work, but that can go
5030 installer). The manual can use some work, but that can go
5019 slowly. Otherwise I think it's quite nice for end users. Next
5031 slowly. Otherwise I think it's quite nice for end users. Next
5020 summer, rewrite the guts of it...
5032 summer, rewrite the guts of it...
5021
5033
5022 * Changed format of ipythonrc files to use whitespace as the
5034 * Changed format of ipythonrc files to use whitespace as the
5023 separator instead of an explicit '='. Cleaner.
5035 separator instead of an explicit '='. Cleaner.
5024
5036
5025 2001-12-20 Fernando Perez <fperez@colorado.edu>
5037 2001-12-20 Fernando Perez <fperez@colorado.edu>
5026
5038
5027 * Started a manual in LyX. For now it's just a quick merge of the
5039 * Started a manual in LyX. For now it's just a quick merge of the
5028 various internal docstrings and READMEs. Later it may grow into a
5040 various internal docstrings and READMEs. Later it may grow into a
5029 nice, full-blown manual.
5041 nice, full-blown manual.
5030
5042
5031 * Set up a distutils based installer. Installation should now be
5043 * Set up a distutils based installer. Installation should now be
5032 trivially simple for end-users.
5044 trivially simple for end-users.
5033
5045
5034 2001-12-11 Fernando Perez <fperez@colorado.edu>
5046 2001-12-11 Fernando Perez <fperez@colorado.edu>
5035
5047
5036 * Released 0.2.0. First public release, announced it at
5048 * Released 0.2.0. First public release, announced it at
5037 comp.lang.python. From now on, just bugfixes...
5049 comp.lang.python. From now on, just bugfixes...
5038
5050
5039 * Went through all the files, set copyright/license notices and
5051 * Went through all the files, set copyright/license notices and
5040 cleaned up things. Ready for release.
5052 cleaned up things. Ready for release.
5041
5053
5042 2001-12-10 Fernando Perez <fperez@colorado.edu>
5054 2001-12-10 Fernando Perez <fperez@colorado.edu>
5043
5055
5044 * Changed the first-time installer not to use tarfiles. It's more
5056 * Changed the first-time installer not to use tarfiles. It's more
5045 robust now and less unix-dependent. Also makes it easier for
5057 robust now and less unix-dependent. Also makes it easier for
5046 people to later upgrade versions.
5058 people to later upgrade versions.
5047
5059
5048 * Changed @exit to @abort to reflect the fact that it's pretty
5060 * Changed @exit to @abort to reflect the fact that it's pretty
5049 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5061 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5050 becomes significant only when IPyhton is embedded: in that case,
5062 becomes significant only when IPyhton is embedded: in that case,
5051 C-D closes IPython only, but @abort kills the enclosing program
5063 C-D closes IPython only, but @abort kills the enclosing program
5052 too (unless it had called IPython inside a try catching
5064 too (unless it had called IPython inside a try catching
5053 SystemExit).
5065 SystemExit).
5054
5066
5055 * Created Shell module which exposes the actuall IPython Shell
5067 * Created Shell module which exposes the actuall IPython Shell
5056 classes, currently the normal and the embeddable one. This at
5068 classes, currently the normal and the embeddable one. This at
5057 least offers a stable interface we won't need to change when
5069 least offers a stable interface we won't need to change when
5058 (later) the internals are rewritten. That rewrite will be confined
5070 (later) the internals are rewritten. That rewrite will be confined
5059 to iplib and ipmaker, but the Shell interface should remain as is.
5071 to iplib and ipmaker, but the Shell interface should remain as is.
5060
5072
5061 * Added embed module which offers an embeddable IPShell object,
5073 * Added embed module which offers an embeddable IPShell object,
5062 useful to fire up IPython *inside* a running program. Great for
5074 useful to fire up IPython *inside* a running program. Great for
5063 debugging or dynamical data analysis.
5075 debugging or dynamical data analysis.
5064
5076
5065 2001-12-08 Fernando Perez <fperez@colorado.edu>
5077 2001-12-08 Fernando Perez <fperez@colorado.edu>
5066
5078
5067 * Fixed small bug preventing seeing info from methods of defined
5079 * Fixed small bug preventing seeing info from methods of defined
5068 objects (incorrect namespace in _ofind()).
5080 objects (incorrect namespace in _ofind()).
5069
5081
5070 * Documentation cleanup. Moved the main usage docstrings to a
5082 * Documentation cleanup. Moved the main usage docstrings to a
5071 separate file, usage.py (cleaner to maintain, and hopefully in the
5083 separate file, usage.py (cleaner to maintain, and hopefully in the
5072 future some perlpod-like way of producing interactive, man and
5084 future some perlpod-like way of producing interactive, man and
5073 html docs out of it will be found).
5085 html docs out of it will be found).
5074
5086
5075 * Added @profile to see your profile at any time.
5087 * Added @profile to see your profile at any time.
5076
5088
5077 * Added @p as an alias for 'print'. It's especially convenient if
5089 * Added @p as an alias for 'print'. It's especially convenient if
5078 using automagic ('p x' prints x).
5090 using automagic ('p x' prints x).
5079
5091
5080 * Small cleanups and fixes after a pychecker run.
5092 * Small cleanups and fixes after a pychecker run.
5081
5093
5082 * Changed the @cd command to handle @cd - and @cd -<n> for
5094 * Changed the @cd command to handle @cd - and @cd -<n> for
5083 visiting any directory in _dh.
5095 visiting any directory in _dh.
5084
5096
5085 * Introduced _dh, a history of visited directories. @dhist prints
5097 * Introduced _dh, a history of visited directories. @dhist prints
5086 it out with numbers.
5098 it out with numbers.
5087
5099
5088 2001-12-07 Fernando Perez <fperez@colorado.edu>
5100 2001-12-07 Fernando Perez <fperez@colorado.edu>
5089
5101
5090 * Released 0.1.22
5102 * Released 0.1.22
5091
5103
5092 * Made initialization a bit more robust against invalid color
5104 * Made initialization a bit more robust against invalid color
5093 options in user input (exit, not traceback-crash).
5105 options in user input (exit, not traceback-crash).
5094
5106
5095 * Changed the bug crash reporter to write the report only in the
5107 * Changed the bug crash reporter to write the report only in the
5096 user's .ipython directory. That way IPython won't litter people's
5108 user's .ipython directory. That way IPython won't litter people's
5097 hard disks with crash files all over the place. Also print on
5109 hard disks with crash files all over the place. Also print on
5098 screen the necessary mail command.
5110 screen the necessary mail command.
5099
5111
5100 * With the new ultraTB, implemented LightBG color scheme for light
5112 * With the new ultraTB, implemented LightBG color scheme for light
5101 background terminals. A lot of people like white backgrounds, so I
5113 background terminals. A lot of people like white backgrounds, so I
5102 guess we should at least give them something readable.
5114 guess we should at least give them something readable.
5103
5115
5104 2001-12-06 Fernando Perez <fperez@colorado.edu>
5116 2001-12-06 Fernando Perez <fperez@colorado.edu>
5105
5117
5106 * Modified the structure of ultraTB. Now there's a proper class
5118 * Modified the structure of ultraTB. Now there's a proper class
5107 for tables of color schemes which allow adding schemes easily and
5119 for tables of color schemes which allow adding schemes easily and
5108 switching the active scheme without creating a new instance every
5120 switching the active scheme without creating a new instance every
5109 time (which was ridiculous). The syntax for creating new schemes
5121 time (which was ridiculous). The syntax for creating new schemes
5110 is also cleaner. I think ultraTB is finally done, with a clean
5122 is also cleaner. I think ultraTB is finally done, with a clean
5111 class structure. Names are also much cleaner (now there's proper
5123 class structure. Names are also much cleaner (now there's proper
5112 color tables, no need for every variable to also have 'color' in
5124 color tables, no need for every variable to also have 'color' in
5113 its name).
5125 its name).
5114
5126
5115 * Broke down genutils into separate files. Now genutils only
5127 * Broke down genutils into separate files. Now genutils only
5116 contains utility functions, and classes have been moved to their
5128 contains utility functions, and classes have been moved to their
5117 own files (they had enough independent functionality to warrant
5129 own files (they had enough independent functionality to warrant
5118 it): ConfigLoader, OutputTrap, Struct.
5130 it): ConfigLoader, OutputTrap, Struct.
5119
5131
5120 2001-12-05 Fernando Perez <fperez@colorado.edu>
5132 2001-12-05 Fernando Perez <fperez@colorado.edu>
5121
5133
5122 * IPython turns 21! Released version 0.1.21, as a candidate for
5134 * IPython turns 21! Released version 0.1.21, as a candidate for
5123 public consumption. If all goes well, release in a few days.
5135 public consumption. If all goes well, release in a few days.
5124
5136
5125 * Fixed path bug (files in Extensions/ directory wouldn't be found
5137 * Fixed path bug (files in Extensions/ directory wouldn't be found
5126 unless IPython/ was explicitly in sys.path).
5138 unless IPython/ was explicitly in sys.path).
5127
5139
5128 * Extended the FlexCompleter class as MagicCompleter to allow
5140 * Extended the FlexCompleter class as MagicCompleter to allow
5129 completion of @-starting lines.
5141 completion of @-starting lines.
5130
5142
5131 * Created __release__.py file as a central repository for release
5143 * Created __release__.py file as a central repository for release
5132 info that other files can read from.
5144 info that other files can read from.
5133
5145
5134 * Fixed small bug in logging: when logging was turned on in
5146 * Fixed small bug in logging: when logging was turned on in
5135 mid-session, old lines with special meanings (!@?) were being
5147 mid-session, old lines with special meanings (!@?) were being
5136 logged without the prepended comment, which is necessary since
5148 logged without the prepended comment, which is necessary since
5137 they are not truly valid python syntax. This should make session
5149 they are not truly valid python syntax. This should make session
5138 restores produce less errors.
5150 restores produce less errors.
5139
5151
5140 * The namespace cleanup forced me to make a FlexCompleter class
5152 * The namespace cleanup forced me to make a FlexCompleter class
5141 which is nothing but a ripoff of rlcompleter, but with selectable
5153 which is nothing but a ripoff of rlcompleter, but with selectable
5142 namespace (rlcompleter only works in __main__.__dict__). I'll try
5154 namespace (rlcompleter only works in __main__.__dict__). I'll try
5143 to submit a note to the authors to see if this change can be
5155 to submit a note to the authors to see if this change can be
5144 incorporated in future rlcompleter releases (Dec.6: done)
5156 incorporated in future rlcompleter releases (Dec.6: done)
5145
5157
5146 * More fixes to namespace handling. It was a mess! Now all
5158 * More fixes to namespace handling. It was a mess! Now all
5147 explicit references to __main__.__dict__ are gone (except when
5159 explicit references to __main__.__dict__ are gone (except when
5148 really needed) and everything is handled through the namespace
5160 really needed) and everything is handled through the namespace
5149 dicts in the IPython instance. We seem to be getting somewhere
5161 dicts in the IPython instance. We seem to be getting somewhere
5150 with this, finally...
5162 with this, finally...
5151
5163
5152 * Small documentation updates.
5164 * Small documentation updates.
5153
5165
5154 * Created the Extensions directory under IPython (with an
5166 * Created the Extensions directory under IPython (with an
5155 __init__.py). Put the PhysicalQ stuff there. This directory should
5167 __init__.py). Put the PhysicalQ stuff there. This directory should
5156 be used for all special-purpose extensions.
5168 be used for all special-purpose extensions.
5157
5169
5158 * File renaming:
5170 * File renaming:
5159 ipythonlib --> ipmaker
5171 ipythonlib --> ipmaker
5160 ipplib --> iplib
5172 ipplib --> iplib
5161 This makes a bit more sense in terms of what these files actually do.
5173 This makes a bit more sense in terms of what these files actually do.
5162
5174
5163 * Moved all the classes and functions in ipythonlib to ipplib, so
5175 * Moved all the classes and functions in ipythonlib to ipplib, so
5164 now ipythonlib only has make_IPython(). This will ease up its
5176 now ipythonlib only has make_IPython(). This will ease up its
5165 splitting in smaller functional chunks later.
5177 splitting in smaller functional chunks later.
5166
5178
5167 * Cleaned up (done, I think) output of @whos. Better column
5179 * Cleaned up (done, I think) output of @whos. Better column
5168 formatting, and now shows str(var) for as much as it can, which is
5180 formatting, and now shows str(var) for as much as it can, which is
5169 typically what one gets with a 'print var'.
5181 typically what one gets with a 'print var'.
5170
5182
5171 2001-12-04 Fernando Perez <fperez@colorado.edu>
5183 2001-12-04 Fernando Perez <fperez@colorado.edu>
5172
5184
5173 * Fixed namespace problems. Now builtin/IPyhton/user names get
5185 * Fixed namespace problems. Now builtin/IPyhton/user names get
5174 properly reported in their namespace. Internal namespace handling
5186 properly reported in their namespace. Internal namespace handling
5175 is finally getting decent (not perfect yet, but much better than
5187 is finally getting decent (not perfect yet, but much better than
5176 the ad-hoc mess we had).
5188 the ad-hoc mess we had).
5177
5189
5178 * Removed -exit option. If people just want to run a python
5190 * Removed -exit option. If people just want to run a python
5179 script, that's what the normal interpreter is for. Less
5191 script, that's what the normal interpreter is for. Less
5180 unnecessary options, less chances for bugs.
5192 unnecessary options, less chances for bugs.
5181
5193
5182 * Added a crash handler which generates a complete post-mortem if
5194 * Added a crash handler which generates a complete post-mortem if
5183 IPython crashes. This will help a lot in tracking bugs down the
5195 IPython crashes. This will help a lot in tracking bugs down the
5184 road.
5196 road.
5185
5197
5186 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5198 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5187 which were boud to functions being reassigned would bypass the
5199 which were boud to functions being reassigned would bypass the
5188 logger, breaking the sync of _il with the prompt counter. This
5200 logger, breaking the sync of _il with the prompt counter. This
5189 would then crash IPython later when a new line was logged.
5201 would then crash IPython later when a new line was logged.
5190
5202
5191 2001-12-02 Fernando Perez <fperez@colorado.edu>
5203 2001-12-02 Fernando Perez <fperez@colorado.edu>
5192
5204
5193 * Made IPython a package. This means people don't have to clutter
5205 * Made IPython a package. This means people don't have to clutter
5194 their sys.path with yet another directory. Changed the INSTALL
5206 their sys.path with yet another directory. Changed the INSTALL
5195 file accordingly.
5207 file accordingly.
5196
5208
5197 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5209 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5198 sorts its output (so @who shows it sorted) and @whos formats the
5210 sorts its output (so @who shows it sorted) and @whos formats the
5199 table according to the width of the first column. Nicer, easier to
5211 table according to the width of the first column. Nicer, easier to
5200 read. Todo: write a generic table_format() which takes a list of
5212 read. Todo: write a generic table_format() which takes a list of
5201 lists and prints it nicely formatted, with optional row/column
5213 lists and prints it nicely formatted, with optional row/column
5202 separators and proper padding and justification.
5214 separators and proper padding and justification.
5203
5215
5204 * Released 0.1.20
5216 * Released 0.1.20
5205
5217
5206 * Fixed bug in @log which would reverse the inputcache list (a
5218 * Fixed bug in @log which would reverse the inputcache list (a
5207 copy operation was missing).
5219 copy operation was missing).
5208
5220
5209 * Code cleanup. @config was changed to use page(). Better, since
5221 * Code cleanup. @config was changed to use page(). Better, since
5210 its output is always quite long.
5222 its output is always quite long.
5211
5223
5212 * Itpl is back as a dependency. I was having too many problems
5224 * Itpl is back as a dependency. I was having too many problems
5213 getting the parametric aliases to work reliably, and it's just
5225 getting the parametric aliases to work reliably, and it's just
5214 easier to code weird string operations with it than playing %()s
5226 easier to code weird string operations with it than playing %()s
5215 games. It's only ~6k, so I don't think it's too big a deal.
5227 games. It's only ~6k, so I don't think it's too big a deal.
5216
5228
5217 * Found (and fixed) a very nasty bug with history. !lines weren't
5229 * Found (and fixed) a very nasty bug with history. !lines weren't
5218 getting cached, and the out of sync caches would crash
5230 getting cached, and the out of sync caches would crash
5219 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5231 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5220 division of labor a bit better. Bug fixed, cleaner structure.
5232 division of labor a bit better. Bug fixed, cleaner structure.
5221
5233
5222 2001-12-01 Fernando Perez <fperez@colorado.edu>
5234 2001-12-01 Fernando Perez <fperez@colorado.edu>
5223
5235
5224 * Released 0.1.19
5236 * Released 0.1.19
5225
5237
5226 * Added option -n to @hist to prevent line number printing. Much
5238 * Added option -n to @hist to prevent line number printing. Much
5227 easier to copy/paste code this way.
5239 easier to copy/paste code this way.
5228
5240
5229 * Created global _il to hold the input list. Allows easy
5241 * Created global _il to hold the input list. Allows easy
5230 re-execution of blocks of code by slicing it (inspired by Janko's
5242 re-execution of blocks of code by slicing it (inspired by Janko's
5231 comment on 'macros').
5243 comment on 'macros').
5232
5244
5233 * Small fixes and doc updates.
5245 * Small fixes and doc updates.
5234
5246
5235 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5247 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5236 much too fragile with automagic. Handles properly multi-line
5248 much too fragile with automagic. Handles properly multi-line
5237 statements and takes parameters.
5249 statements and takes parameters.
5238
5250
5239 2001-11-30 Fernando Perez <fperez@colorado.edu>
5251 2001-11-30 Fernando Perez <fperez@colorado.edu>
5240
5252
5241 * Version 0.1.18 released.
5253 * Version 0.1.18 released.
5242
5254
5243 * Fixed nasty namespace bug in initial module imports.
5255 * Fixed nasty namespace bug in initial module imports.
5244
5256
5245 * Added copyright/license notes to all code files (except
5257 * Added copyright/license notes to all code files (except
5246 DPyGetOpt). For the time being, LGPL. That could change.
5258 DPyGetOpt). For the time being, LGPL. That could change.
5247
5259
5248 * Rewrote a much nicer README, updated INSTALL, cleaned up
5260 * Rewrote a much nicer README, updated INSTALL, cleaned up
5249 ipythonrc-* samples.
5261 ipythonrc-* samples.
5250
5262
5251 * Overall code/documentation cleanup. Basically ready for
5263 * Overall code/documentation cleanup. Basically ready for
5252 release. Only remaining thing: licence decision (LGPL?).
5264 release. Only remaining thing: licence decision (LGPL?).
5253
5265
5254 * Converted load_config to a class, ConfigLoader. Now recursion
5266 * Converted load_config to a class, ConfigLoader. Now recursion
5255 control is better organized. Doesn't include the same file twice.
5267 control is better organized. Doesn't include the same file twice.
5256
5268
5257 2001-11-29 Fernando Perez <fperez@colorado.edu>
5269 2001-11-29 Fernando Perez <fperez@colorado.edu>
5258
5270
5259 * Got input history working. Changed output history variables from
5271 * Got input history working. Changed output history variables from
5260 _p to _o so that _i is for input and _o for output. Just cleaner
5272 _p to _o so that _i is for input and _o for output. Just cleaner
5261 convention.
5273 convention.
5262
5274
5263 * Implemented parametric aliases. This pretty much allows the
5275 * Implemented parametric aliases. This pretty much allows the
5264 alias system to offer full-blown shell convenience, I think.
5276 alias system to offer full-blown shell convenience, I think.
5265
5277
5266 * Version 0.1.17 released, 0.1.18 opened.
5278 * Version 0.1.17 released, 0.1.18 opened.
5267
5279
5268 * dot_ipython/ipythonrc (alias): added documentation.
5280 * dot_ipython/ipythonrc (alias): added documentation.
5269 (xcolor): Fixed small bug (xcolors -> xcolor)
5281 (xcolor): Fixed small bug (xcolors -> xcolor)
5270
5282
5271 * Changed the alias system. Now alias is a magic command to define
5283 * Changed the alias system. Now alias is a magic command to define
5272 aliases just like the shell. Rationale: the builtin magics should
5284 aliases just like the shell. Rationale: the builtin magics should
5273 be there for things deeply connected to IPython's
5285 be there for things deeply connected to IPython's
5274 architecture. And this is a much lighter system for what I think
5286 architecture. And this is a much lighter system for what I think
5275 is the really important feature: allowing users to define quickly
5287 is the really important feature: allowing users to define quickly
5276 magics that will do shell things for them, so they can customize
5288 magics that will do shell things for them, so they can customize
5277 IPython easily to match their work habits. If someone is really
5289 IPython easily to match their work habits. If someone is really
5278 desperate to have another name for a builtin alias, they can
5290 desperate to have another name for a builtin alias, they can
5279 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5291 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5280 works.
5292 works.
5281
5293
5282 2001-11-28 Fernando Perez <fperez@colorado.edu>
5294 2001-11-28 Fernando Perez <fperez@colorado.edu>
5283
5295
5284 * Changed @file so that it opens the source file at the proper
5296 * Changed @file so that it opens the source file at the proper
5285 line. Since it uses less, if your EDITOR environment is
5297 line. Since it uses less, if your EDITOR environment is
5286 configured, typing v will immediately open your editor of choice
5298 configured, typing v will immediately open your editor of choice
5287 right at the line where the object is defined. Not as quick as
5299 right at the line where the object is defined. Not as quick as
5288 having a direct @edit command, but for all intents and purposes it
5300 having a direct @edit command, but for all intents and purposes it
5289 works. And I don't have to worry about writing @edit to deal with
5301 works. And I don't have to worry about writing @edit to deal with
5290 all the editors, less does that.
5302 all the editors, less does that.
5291
5303
5292 * Version 0.1.16 released, 0.1.17 opened.
5304 * Version 0.1.16 released, 0.1.17 opened.
5293
5305
5294 * Fixed some nasty bugs in the page/page_dumb combo that could
5306 * Fixed some nasty bugs in the page/page_dumb combo that could
5295 crash IPython.
5307 crash IPython.
5296
5308
5297 2001-11-27 Fernando Perez <fperez@colorado.edu>
5309 2001-11-27 Fernando Perez <fperez@colorado.edu>
5298
5310
5299 * Version 0.1.15 released, 0.1.16 opened.
5311 * Version 0.1.15 released, 0.1.16 opened.
5300
5312
5301 * Finally got ? and ?? to work for undefined things: now it's
5313 * Finally got ? and ?? to work for undefined things: now it's
5302 possible to type {}.get? and get information about the get method
5314 possible to type {}.get? and get information about the get method
5303 of dicts, or os.path? even if only os is defined (so technically
5315 of dicts, or os.path? even if only os is defined (so technically
5304 os.path isn't). Works at any level. For example, after import os,
5316 os.path isn't). Works at any level. For example, after import os,
5305 os?, os.path?, os.path.abspath? all work. This is great, took some
5317 os?, os.path?, os.path.abspath? all work. This is great, took some
5306 work in _ofind.
5318 work in _ofind.
5307
5319
5308 * Fixed more bugs with logging. The sanest way to do it was to add
5320 * Fixed more bugs with logging. The sanest way to do it was to add
5309 to @log a 'mode' parameter. Killed two in one shot (this mode
5321 to @log a 'mode' parameter. Killed two in one shot (this mode
5310 option was a request of Janko's). I think it's finally clean
5322 option was a request of Janko's). I think it's finally clean
5311 (famous last words).
5323 (famous last words).
5312
5324
5313 * Added a page_dumb() pager which does a decent job of paging on
5325 * Added a page_dumb() pager which does a decent job of paging on
5314 screen, if better things (like less) aren't available. One less
5326 screen, if better things (like less) aren't available. One less
5315 unix dependency (someday maybe somebody will port this to
5327 unix dependency (someday maybe somebody will port this to
5316 windows).
5328 windows).
5317
5329
5318 * Fixed problem in magic_log: would lock of logging out if log
5330 * Fixed problem in magic_log: would lock of logging out if log
5319 creation failed (because it would still think it had succeeded).
5331 creation failed (because it would still think it had succeeded).
5320
5332
5321 * Improved the page() function using curses to auto-detect screen
5333 * Improved the page() function using curses to auto-detect screen
5322 size. Now it can make a much better decision on whether to print
5334 size. Now it can make a much better decision on whether to print
5323 or page a string. Option screen_length was modified: a value 0
5335 or page a string. Option screen_length was modified: a value 0
5324 means auto-detect, and that's the default now.
5336 means auto-detect, and that's the default now.
5325
5337
5326 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5338 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5327 go out. I'll test it for a few days, then talk to Janko about
5339 go out. I'll test it for a few days, then talk to Janko about
5328 licences and announce it.
5340 licences and announce it.
5329
5341
5330 * Fixed the length of the auto-generated ---> prompt which appears
5342 * Fixed the length of the auto-generated ---> prompt which appears
5331 for auto-parens and auto-quotes. Getting this right isn't trivial,
5343 for auto-parens and auto-quotes. Getting this right isn't trivial,
5332 with all the color escapes, different prompt types and optional
5344 with all the color escapes, different prompt types and optional
5333 separators. But it seems to be working in all the combinations.
5345 separators. But it seems to be working in all the combinations.
5334
5346
5335 2001-11-26 Fernando Perez <fperez@colorado.edu>
5347 2001-11-26 Fernando Perez <fperez@colorado.edu>
5336
5348
5337 * Wrote a regexp filter to get option types from the option names
5349 * Wrote a regexp filter to get option types from the option names
5338 string. This eliminates the need to manually keep two duplicate
5350 string. This eliminates the need to manually keep two duplicate
5339 lists.
5351 lists.
5340
5352
5341 * Removed the unneeded check_option_names. Now options are handled
5353 * Removed the unneeded check_option_names. Now options are handled
5342 in a much saner manner and it's easy to visually check that things
5354 in a much saner manner and it's easy to visually check that things
5343 are ok.
5355 are ok.
5344
5356
5345 * Updated version numbers on all files I modified to carry a
5357 * Updated version numbers on all files I modified to carry a
5346 notice so Janko and Nathan have clear version markers.
5358 notice so Janko and Nathan have clear version markers.
5347
5359
5348 * Updated docstring for ultraTB with my changes. I should send
5360 * Updated docstring for ultraTB with my changes. I should send
5349 this to Nathan.
5361 this to Nathan.
5350
5362
5351 * Lots of small fixes. Ran everything through pychecker again.
5363 * Lots of small fixes. Ran everything through pychecker again.
5352
5364
5353 * Made loading of deep_reload an cmd line option. If it's not too
5365 * Made loading of deep_reload an cmd line option. If it's not too
5354 kosher, now people can just disable it. With -nodeep_reload it's
5366 kosher, now people can just disable it. With -nodeep_reload it's
5355 still available as dreload(), it just won't overwrite reload().
5367 still available as dreload(), it just won't overwrite reload().
5356
5368
5357 * Moved many options to the no| form (-opt and -noopt
5369 * Moved many options to the no| form (-opt and -noopt
5358 accepted). Cleaner.
5370 accepted). Cleaner.
5359
5371
5360 * Changed magic_log so that if called with no parameters, it uses
5372 * Changed magic_log so that if called with no parameters, it uses
5361 'rotate' mode. That way auto-generated logs aren't automatically
5373 'rotate' mode. That way auto-generated logs aren't automatically
5362 over-written. For normal logs, now a backup is made if it exists
5374 over-written. For normal logs, now a backup is made if it exists
5363 (only 1 level of backups). A new 'backup' mode was added to the
5375 (only 1 level of backups). A new 'backup' mode was added to the
5364 Logger class to support this. This was a request by Janko.
5376 Logger class to support this. This was a request by Janko.
5365
5377
5366 * Added @logoff/@logon to stop/restart an active log.
5378 * Added @logoff/@logon to stop/restart an active log.
5367
5379
5368 * Fixed a lot of bugs in log saving/replay. It was pretty
5380 * Fixed a lot of bugs in log saving/replay. It was pretty
5369 broken. Now special lines (!@,/) appear properly in the command
5381 broken. Now special lines (!@,/) appear properly in the command
5370 history after a log replay.
5382 history after a log replay.
5371
5383
5372 * Tried and failed to implement full session saving via pickle. My
5384 * Tried and failed to implement full session saving via pickle. My
5373 idea was to pickle __main__.__dict__, but modules can't be
5385 idea was to pickle __main__.__dict__, but modules can't be
5374 pickled. This would be a better alternative to replaying logs, but
5386 pickled. This would be a better alternative to replaying logs, but
5375 seems quite tricky to get to work. Changed -session to be called
5387 seems quite tricky to get to work. Changed -session to be called
5376 -logplay, which more accurately reflects what it does. And if we
5388 -logplay, which more accurately reflects what it does. And if we
5377 ever get real session saving working, -session is now available.
5389 ever get real session saving working, -session is now available.
5378
5390
5379 * Implemented color schemes for prompts also. As for tracebacks,
5391 * Implemented color schemes for prompts also. As for tracebacks,
5380 currently only NoColor and Linux are supported. But now the
5392 currently only NoColor and Linux are supported. But now the
5381 infrastructure is in place, based on a generic ColorScheme
5393 infrastructure is in place, based on a generic ColorScheme
5382 class. So writing and activating new schemes both for the prompts
5394 class. So writing and activating new schemes both for the prompts
5383 and the tracebacks should be straightforward.
5395 and the tracebacks should be straightforward.
5384
5396
5385 * Version 0.1.13 released, 0.1.14 opened.
5397 * Version 0.1.13 released, 0.1.14 opened.
5386
5398
5387 * Changed handling of options for output cache. Now counter is
5399 * Changed handling of options for output cache. Now counter is
5388 hardwired starting at 1 and one specifies the maximum number of
5400 hardwired starting at 1 and one specifies the maximum number of
5389 entries *in the outcache* (not the max prompt counter). This is
5401 entries *in the outcache* (not the max prompt counter). This is
5390 much better, since many statements won't increase the cache
5402 much better, since many statements won't increase the cache
5391 count. It also eliminated some confusing options, now there's only
5403 count. It also eliminated some confusing options, now there's only
5392 one: cache_size.
5404 one: cache_size.
5393
5405
5394 * Added 'alias' magic function and magic_alias option in the
5406 * Added 'alias' magic function and magic_alias option in the
5395 ipythonrc file. Now the user can easily define whatever names he
5407 ipythonrc file. Now the user can easily define whatever names he
5396 wants for the magic functions without having to play weird
5408 wants for the magic functions without having to play weird
5397 namespace games. This gives IPython a real shell-like feel.
5409 namespace games. This gives IPython a real shell-like feel.
5398
5410
5399 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5411 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5400 @ or not).
5412 @ or not).
5401
5413
5402 This was one of the last remaining 'visible' bugs (that I know
5414 This was one of the last remaining 'visible' bugs (that I know
5403 of). I think if I can clean up the session loading so it works
5415 of). I think if I can clean up the session loading so it works
5404 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5416 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5405 about licensing).
5417 about licensing).
5406
5418
5407 2001-11-25 Fernando Perez <fperez@colorado.edu>
5419 2001-11-25 Fernando Perez <fperez@colorado.edu>
5408
5420
5409 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5421 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5410 there's a cleaner distinction between what ? and ?? show.
5422 there's a cleaner distinction between what ? and ?? show.
5411
5423
5412 * Added screen_length option. Now the user can define his own
5424 * Added screen_length option. Now the user can define his own
5413 screen size for page() operations.
5425 screen size for page() operations.
5414
5426
5415 * Implemented magic shell-like functions with automatic code
5427 * Implemented magic shell-like functions with automatic code
5416 generation. Now adding another function is just a matter of adding
5428 generation. Now adding another function is just a matter of adding
5417 an entry to a dict, and the function is dynamically generated at
5429 an entry to a dict, and the function is dynamically generated at
5418 run-time. Python has some really cool features!
5430 run-time. Python has some really cool features!
5419
5431
5420 * Renamed many options to cleanup conventions a little. Now all
5432 * Renamed many options to cleanup conventions a little. Now all
5421 are lowercase, and only underscores where needed. Also in the code
5433 are lowercase, and only underscores where needed. Also in the code
5422 option name tables are clearer.
5434 option name tables are clearer.
5423
5435
5424 * Changed prompts a little. Now input is 'In [n]:' instead of
5436 * Changed prompts a little. Now input is 'In [n]:' instead of
5425 'In[n]:='. This allows it the numbers to be aligned with the
5437 'In[n]:='. This allows it the numbers to be aligned with the
5426 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5438 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5427 Python (it was a Mathematica thing). The '...' continuation prompt
5439 Python (it was a Mathematica thing). The '...' continuation prompt
5428 was also changed a little to align better.
5440 was also changed a little to align better.
5429
5441
5430 * Fixed bug when flushing output cache. Not all _p<n> variables
5442 * Fixed bug when flushing output cache. Not all _p<n> variables
5431 exist, so their deletion needs to be wrapped in a try:
5443 exist, so their deletion needs to be wrapped in a try:
5432
5444
5433 * Figured out how to properly use inspect.formatargspec() (it
5445 * Figured out how to properly use inspect.formatargspec() (it
5434 requires the args preceded by *). So I removed all the code from
5446 requires the args preceded by *). So I removed all the code from
5435 _get_pdef in Magic, which was just replicating that.
5447 _get_pdef in Magic, which was just replicating that.
5436
5448
5437 * Added test to prefilter to allow redefining magic function names
5449 * Added test to prefilter to allow redefining magic function names
5438 as variables. This is ok, since the @ form is always available,
5450 as variables. This is ok, since the @ form is always available,
5439 but whe should allow the user to define a variable called 'ls' if
5451 but whe should allow the user to define a variable called 'ls' if
5440 he needs it.
5452 he needs it.
5441
5453
5442 * Moved the ToDo information from README into a separate ToDo.
5454 * Moved the ToDo information from README into a separate ToDo.
5443
5455
5444 * General code cleanup and small bugfixes. I think it's close to a
5456 * General code cleanup and small bugfixes. I think it's close to a
5445 state where it can be released, obviously with a big 'beta'
5457 state where it can be released, obviously with a big 'beta'
5446 warning on it.
5458 warning on it.
5447
5459
5448 * Got the magic function split to work. Now all magics are defined
5460 * Got the magic function split to work. Now all magics are defined
5449 in a separate class. It just organizes things a bit, and now
5461 in a separate class. It just organizes things a bit, and now
5450 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5462 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5451 was too long).
5463 was too long).
5452
5464
5453 * Changed @clear to @reset to avoid potential confusions with
5465 * Changed @clear to @reset to avoid potential confusions with
5454 the shell command clear. Also renamed @cl to @clear, which does
5466 the shell command clear. Also renamed @cl to @clear, which does
5455 exactly what people expect it to from their shell experience.
5467 exactly what people expect it to from their shell experience.
5456
5468
5457 Added a check to the @reset command (since it's so
5469 Added a check to the @reset command (since it's so
5458 destructive, it's probably a good idea to ask for confirmation).
5470 destructive, it's probably a good idea to ask for confirmation).
5459 But now reset only works for full namespace resetting. Since the
5471 But now reset only works for full namespace resetting. Since the
5460 del keyword is already there for deleting a few specific
5472 del keyword is already there for deleting a few specific
5461 variables, I don't see the point of having a redundant magic
5473 variables, I don't see the point of having a redundant magic
5462 function for the same task.
5474 function for the same task.
5463
5475
5464 2001-11-24 Fernando Perez <fperez@colorado.edu>
5476 2001-11-24 Fernando Perez <fperez@colorado.edu>
5465
5477
5466 * Updated the builtin docs (esp. the ? ones).
5478 * Updated the builtin docs (esp. the ? ones).
5467
5479
5468 * Ran all the code through pychecker. Not terribly impressed with
5480 * Ran all the code through pychecker. Not terribly impressed with
5469 it: lots of spurious warnings and didn't really find anything of
5481 it: lots of spurious warnings and didn't really find anything of
5470 substance (just a few modules being imported and not used).
5482 substance (just a few modules being imported and not used).
5471
5483
5472 * Implemented the new ultraTB functionality into IPython. New
5484 * Implemented the new ultraTB functionality into IPython. New
5473 option: xcolors. This chooses color scheme. xmode now only selects
5485 option: xcolors. This chooses color scheme. xmode now only selects
5474 between Plain and Verbose. Better orthogonality.
5486 between Plain and Verbose. Better orthogonality.
5475
5487
5476 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5488 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5477 mode and color scheme for the exception handlers. Now it's
5489 mode and color scheme for the exception handlers. Now it's
5478 possible to have the verbose traceback with no coloring.
5490 possible to have the verbose traceback with no coloring.
5479
5491
5480 2001-11-23 Fernando Perez <fperez@colorado.edu>
5492 2001-11-23 Fernando Perez <fperez@colorado.edu>
5481
5493
5482 * Version 0.1.12 released, 0.1.13 opened.
5494 * Version 0.1.12 released, 0.1.13 opened.
5483
5495
5484 * Removed option to set auto-quote and auto-paren escapes by
5496 * Removed option to set auto-quote and auto-paren escapes by
5485 user. The chances of breaking valid syntax are just too high. If
5497 user. The chances of breaking valid syntax are just too high. If
5486 someone *really* wants, they can always dig into the code.
5498 someone *really* wants, they can always dig into the code.
5487
5499
5488 * Made prompt separators configurable.
5500 * Made prompt separators configurable.
5489
5501
5490 2001-11-22 Fernando Perez <fperez@colorado.edu>
5502 2001-11-22 Fernando Perez <fperez@colorado.edu>
5491
5503
5492 * Small bugfixes in many places.
5504 * Small bugfixes in many places.
5493
5505
5494 * Removed the MyCompleter class from ipplib. It seemed redundant
5506 * Removed the MyCompleter class from ipplib. It seemed redundant
5495 with the C-p,C-n history search functionality. Less code to
5507 with the C-p,C-n history search functionality. Less code to
5496 maintain.
5508 maintain.
5497
5509
5498 * Moved all the original ipython.py code into ipythonlib.py. Right
5510 * Moved all the original ipython.py code into ipythonlib.py. Right
5499 now it's just one big dump into a function called make_IPython, so
5511 now it's just one big dump into a function called make_IPython, so
5500 no real modularity has been gained. But at least it makes the
5512 no real modularity has been gained. But at least it makes the
5501 wrapper script tiny, and since ipythonlib is a module, it gets
5513 wrapper script tiny, and since ipythonlib is a module, it gets
5502 compiled and startup is much faster.
5514 compiled and startup is much faster.
5503
5515
5504 This is a reasobably 'deep' change, so we should test it for a
5516 This is a reasobably 'deep' change, so we should test it for a
5505 while without messing too much more with the code.
5517 while without messing too much more with the code.
5506
5518
5507 2001-11-21 Fernando Perez <fperez@colorado.edu>
5519 2001-11-21 Fernando Perez <fperez@colorado.edu>
5508
5520
5509 * Version 0.1.11 released, 0.1.12 opened for further work.
5521 * Version 0.1.11 released, 0.1.12 opened for further work.
5510
5522
5511 * Removed dependency on Itpl. It was only needed in one place. It
5523 * Removed dependency on Itpl. It was only needed in one place. It
5512 would be nice if this became part of python, though. It makes life
5524 would be nice if this became part of python, though. It makes life
5513 *a lot* easier in some cases.
5525 *a lot* easier in some cases.
5514
5526
5515 * Simplified the prefilter code a bit. Now all handlers are
5527 * Simplified the prefilter code a bit. Now all handlers are
5516 expected to explicitly return a value (at least a blank string).
5528 expected to explicitly return a value (at least a blank string).
5517
5529
5518 * Heavy edits in ipplib. Removed the help system altogether. Now
5530 * Heavy edits in ipplib. Removed the help system altogether. Now
5519 obj?/?? is used for inspecting objects, a magic @doc prints
5531 obj?/?? is used for inspecting objects, a magic @doc prints
5520 docstrings, and full-blown Python help is accessed via the 'help'
5532 docstrings, and full-blown Python help is accessed via the 'help'
5521 keyword. This cleans up a lot of code (less to maintain) and does
5533 keyword. This cleans up a lot of code (less to maintain) and does
5522 the job. Since 'help' is now a standard Python component, might as
5534 the job. Since 'help' is now a standard Python component, might as
5523 well use it and remove duplicate functionality.
5535 well use it and remove duplicate functionality.
5524
5536
5525 Also removed the option to use ipplib as a standalone program. By
5537 Also removed the option to use ipplib as a standalone program. By
5526 now it's too dependent on other parts of IPython to function alone.
5538 now it's too dependent on other parts of IPython to function alone.
5527
5539
5528 * Fixed bug in genutils.pager. It would crash if the pager was
5540 * Fixed bug in genutils.pager. It would crash if the pager was
5529 exited immediately after opening (broken pipe).
5541 exited immediately after opening (broken pipe).
5530
5542
5531 * Trimmed down the VerboseTB reporting a little. The header is
5543 * Trimmed down the VerboseTB reporting a little. The header is
5532 much shorter now and the repeated exception arguments at the end
5544 much shorter now and the repeated exception arguments at the end
5533 have been removed. For interactive use the old header seemed a bit
5545 have been removed. For interactive use the old header seemed a bit
5534 excessive.
5546 excessive.
5535
5547
5536 * Fixed small bug in output of @whos for variables with multi-word
5548 * Fixed small bug in output of @whos for variables with multi-word
5537 types (only first word was displayed).
5549 types (only first word was displayed).
5538
5550
5539 2001-11-17 Fernando Perez <fperez@colorado.edu>
5551 2001-11-17 Fernando Perez <fperez@colorado.edu>
5540
5552
5541 * Version 0.1.10 released, 0.1.11 opened for further work.
5553 * Version 0.1.10 released, 0.1.11 opened for further work.
5542
5554
5543 * Modified dirs and friends. dirs now *returns* the stack (not
5555 * Modified dirs and friends. dirs now *returns* the stack (not
5544 prints), so one can manipulate it as a variable. Convenient to
5556 prints), so one can manipulate it as a variable. Convenient to
5545 travel along many directories.
5557 travel along many directories.
5546
5558
5547 * Fixed bug in magic_pdef: would only work with functions with
5559 * Fixed bug in magic_pdef: would only work with functions with
5548 arguments with default values.
5560 arguments with default values.
5549
5561
5550 2001-11-14 Fernando Perez <fperez@colorado.edu>
5562 2001-11-14 Fernando Perez <fperez@colorado.edu>
5551
5563
5552 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5564 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5553 example with IPython. Various other minor fixes and cleanups.
5565 example with IPython. Various other minor fixes and cleanups.
5554
5566
5555 * Version 0.1.9 released, 0.1.10 opened for further work.
5567 * Version 0.1.9 released, 0.1.10 opened for further work.
5556
5568
5557 * Added sys.path to the list of directories searched in the
5569 * Added sys.path to the list of directories searched in the
5558 execfile= option. It used to be the current directory and the
5570 execfile= option. It used to be the current directory and the
5559 user's IPYTHONDIR only.
5571 user's IPYTHONDIR only.
5560
5572
5561 2001-11-13 Fernando Perez <fperez@colorado.edu>
5573 2001-11-13 Fernando Perez <fperez@colorado.edu>
5562
5574
5563 * Reinstated the raw_input/prefilter separation that Janko had
5575 * Reinstated the raw_input/prefilter separation that Janko had
5564 initially. This gives a more convenient setup for extending the
5576 initially. This gives a more convenient setup for extending the
5565 pre-processor from the outside: raw_input always gets a string,
5577 pre-processor from the outside: raw_input always gets a string,
5566 and prefilter has to process it. We can then redefine prefilter
5578 and prefilter has to process it. We can then redefine prefilter
5567 from the outside and implement extensions for special
5579 from the outside and implement extensions for special
5568 purposes.
5580 purposes.
5569
5581
5570 Today I got one for inputting PhysicalQuantity objects
5582 Today I got one for inputting PhysicalQuantity objects
5571 (from Scientific) without needing any function calls at
5583 (from Scientific) without needing any function calls at
5572 all. Extremely convenient, and it's all done as a user-level
5584 all. Extremely convenient, and it's all done as a user-level
5573 extension (no IPython code was touched). Now instead of:
5585 extension (no IPython code was touched). Now instead of:
5574 a = PhysicalQuantity(4.2,'m/s**2')
5586 a = PhysicalQuantity(4.2,'m/s**2')
5575 one can simply say
5587 one can simply say
5576 a = 4.2 m/s**2
5588 a = 4.2 m/s**2
5577 or even
5589 or even
5578 a = 4.2 m/s^2
5590 a = 4.2 m/s^2
5579
5591
5580 I use this, but it's also a proof of concept: IPython really is
5592 I use this, but it's also a proof of concept: IPython really is
5581 fully user-extensible, even at the level of the parsing of the
5593 fully user-extensible, even at the level of the parsing of the
5582 command line. It's not trivial, but it's perfectly doable.
5594 command line. It's not trivial, but it's perfectly doable.
5583
5595
5584 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5596 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5585 the problem of modules being loaded in the inverse order in which
5597 the problem of modules being loaded in the inverse order in which
5586 they were defined in
5598 they were defined in
5587
5599
5588 * Version 0.1.8 released, 0.1.9 opened for further work.
5600 * Version 0.1.8 released, 0.1.9 opened for further work.
5589
5601
5590 * Added magics pdef, source and file. They respectively show the
5602 * Added magics pdef, source and file. They respectively show the
5591 definition line ('prototype' in C), source code and full python
5603 definition line ('prototype' in C), source code and full python
5592 file for any callable object. The object inspector oinfo uses
5604 file for any callable object. The object inspector oinfo uses
5593 these to show the same information.
5605 these to show the same information.
5594
5606
5595 * Version 0.1.7 released, 0.1.8 opened for further work.
5607 * Version 0.1.7 released, 0.1.8 opened for further work.
5596
5608
5597 * Separated all the magic functions into a class called Magic. The
5609 * Separated all the magic functions into a class called Magic. The
5598 InteractiveShell class was becoming too big for Xemacs to handle
5610 InteractiveShell class was becoming too big for Xemacs to handle
5599 (de-indenting a line would lock it up for 10 seconds while it
5611 (de-indenting a line would lock it up for 10 seconds while it
5600 backtracked on the whole class!)
5612 backtracked on the whole class!)
5601
5613
5602 FIXME: didn't work. It can be done, but right now namespaces are
5614 FIXME: didn't work. It can be done, but right now namespaces are
5603 all messed up. Do it later (reverted it for now, so at least
5615 all messed up. Do it later (reverted it for now, so at least
5604 everything works as before).
5616 everything works as before).
5605
5617
5606 * Got the object introspection system (magic_oinfo) working! I
5618 * Got the object introspection system (magic_oinfo) working! I
5607 think this is pretty much ready for release to Janko, so he can
5619 think this is pretty much ready for release to Janko, so he can
5608 test it for a while and then announce it. Pretty much 100% of what
5620 test it for a while and then announce it. Pretty much 100% of what
5609 I wanted for the 'phase 1' release is ready. Happy, tired.
5621 I wanted for the 'phase 1' release is ready. Happy, tired.
5610
5622
5611 2001-11-12 Fernando Perez <fperez@colorado.edu>
5623 2001-11-12 Fernando Perez <fperez@colorado.edu>
5612
5624
5613 * Version 0.1.6 released, 0.1.7 opened for further work.
5625 * Version 0.1.6 released, 0.1.7 opened for further work.
5614
5626
5615 * Fixed bug in printing: it used to test for truth before
5627 * Fixed bug in printing: it used to test for truth before
5616 printing, so 0 wouldn't print. Now checks for None.
5628 printing, so 0 wouldn't print. Now checks for None.
5617
5629
5618 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5630 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5619 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5631 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5620 reaches by hand into the outputcache. Think of a better way to do
5632 reaches by hand into the outputcache. Think of a better way to do
5621 this later.
5633 this later.
5622
5634
5623 * Various small fixes thanks to Nathan's comments.
5635 * Various small fixes thanks to Nathan's comments.
5624
5636
5625 * Changed magic_pprint to magic_Pprint. This way it doesn't
5637 * Changed magic_pprint to magic_Pprint. This way it doesn't
5626 collide with pprint() and the name is consistent with the command
5638 collide with pprint() and the name is consistent with the command
5627 line option.
5639 line option.
5628
5640
5629 * Changed prompt counter behavior to be fully like
5641 * Changed prompt counter behavior to be fully like
5630 Mathematica's. That is, even input that doesn't return a result
5642 Mathematica's. That is, even input that doesn't return a result
5631 raises the prompt counter. The old behavior was kind of confusing
5643 raises the prompt counter. The old behavior was kind of confusing
5632 (getting the same prompt number several times if the operation
5644 (getting the same prompt number several times if the operation
5633 didn't return a result).
5645 didn't return a result).
5634
5646
5635 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5647 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5636
5648
5637 * Fixed -Classic mode (wasn't working anymore).
5649 * Fixed -Classic mode (wasn't working anymore).
5638
5650
5639 * Added colored prompts using Nathan's new code. Colors are
5651 * Added colored prompts using Nathan's new code. Colors are
5640 currently hardwired, they can be user-configurable. For
5652 currently hardwired, they can be user-configurable. For
5641 developers, they can be chosen in file ipythonlib.py, at the
5653 developers, they can be chosen in file ipythonlib.py, at the
5642 beginning of the CachedOutput class def.
5654 beginning of the CachedOutput class def.
5643
5655
5644 2001-11-11 Fernando Perez <fperez@colorado.edu>
5656 2001-11-11 Fernando Perez <fperez@colorado.edu>
5645
5657
5646 * Version 0.1.5 released, 0.1.6 opened for further work.
5658 * Version 0.1.5 released, 0.1.6 opened for further work.
5647
5659
5648 * Changed magic_env to *return* the environment as a dict (not to
5660 * Changed magic_env to *return* the environment as a dict (not to
5649 print it). This way it prints, but it can also be processed.
5661 print it). This way it prints, but it can also be processed.
5650
5662
5651 * Added Verbose exception reporting to interactive
5663 * Added Verbose exception reporting to interactive
5652 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5664 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5653 traceback. Had to make some changes to the ultraTB file. This is
5665 traceback. Had to make some changes to the ultraTB file. This is
5654 probably the last 'big' thing in my mental todo list. This ties
5666 probably the last 'big' thing in my mental todo list. This ties
5655 in with the next entry:
5667 in with the next entry:
5656
5668
5657 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5669 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5658 has to specify is Plain, Color or Verbose for all exception
5670 has to specify is Plain, Color or Verbose for all exception
5659 handling.
5671 handling.
5660
5672
5661 * Removed ShellServices option. All this can really be done via
5673 * Removed ShellServices option. All this can really be done via
5662 the magic system. It's easier to extend, cleaner and has automatic
5674 the magic system. It's easier to extend, cleaner and has automatic
5663 namespace protection and documentation.
5675 namespace protection and documentation.
5664
5676
5665 2001-11-09 Fernando Perez <fperez@colorado.edu>
5677 2001-11-09 Fernando Perez <fperez@colorado.edu>
5666
5678
5667 * Fixed bug in output cache flushing (missing parameter to
5679 * Fixed bug in output cache flushing (missing parameter to
5668 __init__). Other small bugs fixed (found using pychecker).
5680 __init__). Other small bugs fixed (found using pychecker).
5669
5681
5670 * Version 0.1.4 opened for bugfixing.
5682 * Version 0.1.4 opened for bugfixing.
5671
5683
5672 2001-11-07 Fernando Perez <fperez@colorado.edu>
5684 2001-11-07 Fernando Perez <fperez@colorado.edu>
5673
5685
5674 * Version 0.1.3 released, mainly because of the raw_input bug.
5686 * Version 0.1.3 released, mainly because of the raw_input bug.
5675
5687
5676 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5688 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5677 and when testing for whether things were callable, a call could
5689 and when testing for whether things were callable, a call could
5678 actually be made to certain functions. They would get called again
5690 actually be made to certain functions. They would get called again
5679 once 'really' executed, with a resulting double call. A disaster
5691 once 'really' executed, with a resulting double call. A disaster
5680 in many cases (list.reverse() would never work!).
5692 in many cases (list.reverse() would never work!).
5681
5693
5682 * Removed prefilter() function, moved its code to raw_input (which
5694 * Removed prefilter() function, moved its code to raw_input (which
5683 after all was just a near-empty caller for prefilter). This saves
5695 after all was just a near-empty caller for prefilter). This saves
5684 a function call on every prompt, and simplifies the class a tiny bit.
5696 a function call on every prompt, and simplifies the class a tiny bit.
5685
5697
5686 * Fix _ip to __ip name in magic example file.
5698 * Fix _ip to __ip name in magic example file.
5687
5699
5688 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5700 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5689 work with non-gnu versions of tar.
5701 work with non-gnu versions of tar.
5690
5702
5691 2001-11-06 Fernando Perez <fperez@colorado.edu>
5703 2001-11-06 Fernando Perez <fperez@colorado.edu>
5692
5704
5693 * Version 0.1.2. Just to keep track of the recent changes.
5705 * Version 0.1.2. Just to keep track of the recent changes.
5694
5706
5695 * Fixed nasty bug in output prompt routine. It used to check 'if
5707 * Fixed nasty bug in output prompt routine. It used to check 'if
5696 arg != None...'. Problem is, this fails if arg implements a
5708 arg != None...'. Problem is, this fails if arg implements a
5697 special comparison (__cmp__) which disallows comparing to
5709 special comparison (__cmp__) which disallows comparing to
5698 None. Found it when trying to use the PhysicalQuantity module from
5710 None. Found it when trying to use the PhysicalQuantity module from
5699 ScientificPython.
5711 ScientificPython.
5700
5712
5701 2001-11-05 Fernando Perez <fperez@colorado.edu>
5713 2001-11-05 Fernando Perez <fperez@colorado.edu>
5702
5714
5703 * Also added dirs. Now the pushd/popd/dirs family functions
5715 * Also added dirs. Now the pushd/popd/dirs family functions
5704 basically like the shell, with the added convenience of going home
5716 basically like the shell, with the added convenience of going home
5705 when called with no args.
5717 when called with no args.
5706
5718
5707 * pushd/popd slightly modified to mimic shell behavior more
5719 * pushd/popd slightly modified to mimic shell behavior more
5708 closely.
5720 closely.
5709
5721
5710 * Added env,pushd,popd from ShellServices as magic functions. I
5722 * Added env,pushd,popd from ShellServices as magic functions. I
5711 think the cleanest will be to port all desired functions from
5723 think the cleanest will be to port all desired functions from
5712 ShellServices as magics and remove ShellServices altogether. This
5724 ShellServices as magics and remove ShellServices altogether. This
5713 will provide a single, clean way of adding functionality
5725 will provide a single, clean way of adding functionality
5714 (shell-type or otherwise) to IP.
5726 (shell-type or otherwise) to IP.
5715
5727
5716 2001-11-04 Fernando Perez <fperez@colorado.edu>
5728 2001-11-04 Fernando Perez <fperez@colorado.edu>
5717
5729
5718 * Added .ipython/ directory to sys.path. This way users can keep
5730 * Added .ipython/ directory to sys.path. This way users can keep
5719 customizations there and access them via import.
5731 customizations there and access them via import.
5720
5732
5721 2001-11-03 Fernando Perez <fperez@colorado.edu>
5733 2001-11-03 Fernando Perez <fperez@colorado.edu>
5722
5734
5723 * Opened version 0.1.1 for new changes.
5735 * Opened version 0.1.1 for new changes.
5724
5736
5725 * Changed version number to 0.1.0: first 'public' release, sent to
5737 * Changed version number to 0.1.0: first 'public' release, sent to
5726 Nathan and Janko.
5738 Nathan and Janko.
5727
5739
5728 * Lots of small fixes and tweaks.
5740 * Lots of small fixes and tweaks.
5729
5741
5730 * Minor changes to whos format. Now strings are shown, snipped if
5742 * Minor changes to whos format. Now strings are shown, snipped if
5731 too long.
5743 too long.
5732
5744
5733 * Changed ShellServices to work on __main__ so they show up in @who
5745 * Changed ShellServices to work on __main__ so they show up in @who
5734
5746
5735 * Help also works with ? at the end of a line:
5747 * Help also works with ? at the end of a line:
5736 ?sin and sin?
5748 ?sin and sin?
5737 both produce the same effect. This is nice, as often I use the
5749 both produce the same effect. This is nice, as often I use the
5738 tab-complete to find the name of a method, but I used to then have
5750 tab-complete to find the name of a method, but I used to then have
5739 to go to the beginning of the line to put a ? if I wanted more
5751 to go to the beginning of the line to put a ? if I wanted more
5740 info. Now I can just add the ? and hit return. Convenient.
5752 info. Now I can just add the ? and hit return. Convenient.
5741
5753
5742 2001-11-02 Fernando Perez <fperez@colorado.edu>
5754 2001-11-02 Fernando Perez <fperez@colorado.edu>
5743
5755
5744 * Python version check (>=2.1) added.
5756 * Python version check (>=2.1) added.
5745
5757
5746 * Added LazyPython documentation. At this point the docs are quite
5758 * Added LazyPython documentation. At this point the docs are quite
5747 a mess. A cleanup is in order.
5759 a mess. A cleanup is in order.
5748
5760
5749 * Auto-installer created. For some bizarre reason, the zipfiles
5761 * Auto-installer created. For some bizarre reason, the zipfiles
5750 module isn't working on my system. So I made a tar version
5762 module isn't working on my system. So I made a tar version
5751 (hopefully the command line options in various systems won't kill
5763 (hopefully the command line options in various systems won't kill
5752 me).
5764 me).
5753
5765
5754 * Fixes to Struct in genutils. Now all dictionary-like methods are
5766 * Fixes to Struct in genutils. Now all dictionary-like methods are
5755 protected (reasonably).
5767 protected (reasonably).
5756
5768
5757 * Added pager function to genutils and changed ? to print usage
5769 * Added pager function to genutils and changed ? to print usage
5758 note through it (it was too long).
5770 note through it (it was too long).
5759
5771
5760 * Added the LazyPython functionality. Works great! I changed the
5772 * Added the LazyPython functionality. Works great! I changed the
5761 auto-quote escape to ';', it's on home row and next to '. But
5773 auto-quote escape to ';', it's on home row and next to '. But
5762 both auto-quote and auto-paren (still /) escapes are command-line
5774 both auto-quote and auto-paren (still /) escapes are command-line
5763 parameters.
5775 parameters.
5764
5776
5765
5777
5766 2001-11-01 Fernando Perez <fperez@colorado.edu>
5778 2001-11-01 Fernando Perez <fperez@colorado.edu>
5767
5779
5768 * Version changed to 0.0.7. Fairly large change: configuration now
5780 * Version changed to 0.0.7. Fairly large change: configuration now
5769 is all stored in a directory, by default .ipython. There, all
5781 is all stored in a directory, by default .ipython. There, all
5770 config files have normal looking names (not .names)
5782 config files have normal looking names (not .names)
5771
5783
5772 * Version 0.0.6 Released first to Lucas and Archie as a test
5784 * Version 0.0.6 Released first to Lucas and Archie as a test
5773 run. Since it's the first 'semi-public' release, change version to
5785 run. Since it's the first 'semi-public' release, change version to
5774 > 0.0.6 for any changes now.
5786 > 0.0.6 for any changes now.
5775
5787
5776 * Stuff I had put in the ipplib.py changelog:
5788 * Stuff I had put in the ipplib.py changelog:
5777
5789
5778 Changes to InteractiveShell:
5790 Changes to InteractiveShell:
5779
5791
5780 - Made the usage message a parameter.
5792 - Made the usage message a parameter.
5781
5793
5782 - Require the name of the shell variable to be given. It's a bit
5794 - Require the name of the shell variable to be given. It's a bit
5783 of a hack, but allows the name 'shell' not to be hardwired in the
5795 of a hack, but allows the name 'shell' not to be hardwired in the
5784 magic (@) handler, which is problematic b/c it requires
5796 magic (@) handler, which is problematic b/c it requires
5785 polluting the global namespace with 'shell'. This in turn is
5797 polluting the global namespace with 'shell'. This in turn is
5786 fragile: if a user redefines a variable called shell, things
5798 fragile: if a user redefines a variable called shell, things
5787 break.
5799 break.
5788
5800
5789 - magic @: all functions available through @ need to be defined
5801 - magic @: all functions available through @ need to be defined
5790 as magic_<name>, even though they can be called simply as
5802 as magic_<name>, even though they can be called simply as
5791 @<name>. This allows the special command @magic to gather
5803 @<name>. This allows the special command @magic to gather
5792 information automatically about all existing magic functions,
5804 information automatically about all existing magic functions,
5793 even if they are run-time user extensions, by parsing the shell
5805 even if they are run-time user extensions, by parsing the shell
5794 instance __dict__ looking for special magic_ names.
5806 instance __dict__ looking for special magic_ names.
5795
5807
5796 - mainloop: added *two* local namespace parameters. This allows
5808 - mainloop: added *two* local namespace parameters. This allows
5797 the class to differentiate between parameters which were there
5809 the class to differentiate between parameters which were there
5798 before and after command line initialization was processed. This
5810 before and after command line initialization was processed. This
5799 way, later @who can show things loaded at startup by the
5811 way, later @who can show things loaded at startup by the
5800 user. This trick was necessary to make session saving/reloading
5812 user. This trick was necessary to make session saving/reloading
5801 really work: ideally after saving/exiting/reloading a session,
5813 really work: ideally after saving/exiting/reloading a session,
5802 *everything* should look the same, including the output of @who. I
5814 *everything* should look the same, including the output of @who. I
5803 was only able to make this work with this double namespace
5815 was only able to make this work with this double namespace
5804 trick.
5816 trick.
5805
5817
5806 - added a header to the logfile which allows (almost) full
5818 - added a header to the logfile which allows (almost) full
5807 session restoring.
5819 session restoring.
5808
5820
5809 - prepend lines beginning with @ or !, with a and log
5821 - prepend lines beginning with @ or !, with a and log
5810 them. Why? !lines: may be useful to know what you did @lines:
5822 them. Why? !lines: may be useful to know what you did @lines:
5811 they may affect session state. So when restoring a session, at
5823 they may affect session state. So when restoring a session, at
5812 least inform the user of their presence. I couldn't quite get
5824 least inform the user of their presence. I couldn't quite get
5813 them to properly re-execute, but at least the user is warned.
5825 them to properly re-execute, but at least the user is warned.
5814
5826
5815 * Started ChangeLog.
5827 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now