##// END OF EJS Templates
implement callable (i.e. straight python) aliases and _sh shadow namespace
vivainio -
Show More
@@ -0,0 +1,1 b''
1 """ Shadow namespace """ No newline at end of file
@@ -1,548 +1,551 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 1850 2006-10-28 19:48:13Z fptest $
9 $Id: OInspect.py 2463 2007-06-27 22:51:16Z vivainio $
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):
139 def getsource(obj,is_binary=False):
140 """Wrapper around inspect.getsource.
140 """Wrapper around inspect.getsource.
141
141
142 This can be modified by other projects to provide customized source
142 This can be modified by other projects to provide customized source
143 extraction.
143 extraction.
144
144
145 Inputs:
145 Inputs:
146
146
147 - obj: an object whose source code we will attempt to extract.
147 - obj: an object whose source code we will attempt to extract.
148
148
149 Optional inputs:
149 Optional inputs:
150
150
151 - is_binary: whether the object is known to come from a binary source.
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
152 This implementation will skip returning any output for binary objects, but
153 custom extractors may know how to meaninfully process them."""
153 custom extractors may know how to meaninfully process them."""
154
154
155 if is_binary:
155 if is_binary:
156 return None
156 return None
157 else:
157 else:
158 return inspect.getsource(obj)
158 return inspect.getsource(obj)
159
159
160 #****************************************************************************
160 #****************************************************************************
161 # Class definitions
161 # Class definitions
162
162
163 class myStringIO(StringIO.StringIO):
163 class myStringIO(StringIO.StringIO):
164 """Adds a writeln method to normal StringIO."""
164 """Adds a writeln method to normal StringIO."""
165 def writeln(self,*arg,**kw):
165 def writeln(self,*arg,**kw):
166 """Does a write() and then a write('\n')"""
166 """Does a write() and then a write('\n')"""
167 self.write(*arg,**kw)
167 self.write(*arg,**kw)
168 self.write('\n')
168 self.write('\n')
169
169
170 class Inspector:
170 class Inspector:
171 def __init__(self,color_table,code_color_table,scheme,
171 def __init__(self,color_table,code_color_table,scheme,
172 str_detail_level=0):
172 str_detail_level=0):
173 self.color_table = color_table
173 self.color_table = color_table
174 self.parser = PyColorize.Parser(code_color_table,out='str')
174 self.parser = PyColorize.Parser(code_color_table,out='str')
175 self.format = self.parser.format
175 self.format = self.parser.format
176 self.str_detail_level = str_detail_level
176 self.str_detail_level = str_detail_level
177 self.set_active_scheme(scheme)
177 self.set_active_scheme(scheme)
178
178
179 def __getargspec(self,obj):
179 def __getargspec(self,obj):
180 """Get the names and default values of a function's arguments.
180 """Get the names and default values of a function's arguments.
181
181
182 A tuple of four things is returned: (args, varargs, varkw, defaults).
182 A tuple of four things is returned: (args, varargs, varkw, defaults).
183 '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).
184 '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.
185 '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.
186
186
187 Modified version of inspect.getargspec from the Python Standard
187 Modified version of inspect.getargspec from the Python Standard
188 Library."""
188 Library."""
189
189
190 if inspect.isfunction(obj):
190 if inspect.isfunction(obj):
191 func_obj = obj
191 func_obj = obj
192 elif inspect.ismethod(obj):
192 elif inspect.ismethod(obj):
193 func_obj = obj.im_func
193 func_obj = obj.im_func
194 else:
194 else:
195 raise TypeError, 'arg is not a Python function'
195 raise TypeError, 'arg is not a Python function'
196 args, varargs, varkw = inspect.getargs(func_obj.func_code)
196 args, varargs, varkw = inspect.getargs(func_obj.func_code)
197 return args, varargs, varkw, func_obj.func_defaults
197 return args, varargs, varkw, func_obj.func_defaults
198
198
199 def __getdef(self,obj,oname=''):
199 def __getdef(self,obj,oname=''):
200 """Return the definition header for any callable object.
200 """Return the definition header for any callable object.
201
201
202 If any exception is generated, None is returned instead and the
202 If any exception is generated, None is returned instead and the
203 exception is suppressed."""
203 exception is suppressed."""
204
204
205 try:
205 try:
206 return oname + inspect.formatargspec(*self.__getargspec(obj))
206 return oname + inspect.formatargspec(*self.__getargspec(obj))
207 except:
207 except:
208 return None
208 return None
209
209
210 def __head(self,h):
210 def __head(self,h):
211 """Return a header string with proper colors."""
211 """Return a header string with proper colors."""
212 return '%s%s%s' % (self.color_table.active_colors.header,h,
212 return '%s%s%s' % (self.color_table.active_colors.header,h,
213 self.color_table.active_colors.normal)
213 self.color_table.active_colors.normal)
214
214
215 def set_active_scheme(self,scheme):
215 def set_active_scheme(self,scheme):
216 self.color_table.set_active_scheme(scheme)
216 self.color_table.set_active_scheme(scheme)
217 self.parser.color_table.set_active_scheme(scheme)
217 self.parser.color_table.set_active_scheme(scheme)
218
218
219 def noinfo(self,msg,oname):
219 def noinfo(self,msg,oname):
220 """Generic message when no information is found."""
220 """Generic message when no information is found."""
221 print 'No %s found' % msg,
221 print 'No %s found' % msg,
222 if oname:
222 if oname:
223 print 'for %s' % oname
223 print 'for %s' % oname
224 else:
224 else:
225 print
225 print
226
226
227 def pdef(self,obj,oname=''):
227 def pdef(self,obj,oname=''):
228 """Print the definition header for any callable object.
228 """Print the definition header for any callable object.
229
229
230 If the object is a class, print the constructor information."""
230 If the object is a class, print the constructor information."""
231
231
232 if not callable(obj):
232 if not callable(obj):
233 print 'Object is not callable.'
233 print 'Object is not callable.'
234 return
234 return
235
235
236 header = ''
236 header = ''
237 if type(obj) is types.ClassType:
237 if type(obj) is types.ClassType:
238 header = self.__head('Class constructor information:\n')
238 header = self.__head('Class constructor information:\n')
239 obj = obj.__init__
239 obj = obj.__init__
240 elif type(obj) is types.InstanceType:
240 elif type(obj) is types.InstanceType:
241 obj = obj.__call__
241 obj = obj.__call__
242
242
243 output = self.__getdef(obj,oname)
243 output = self.__getdef(obj,oname)
244 if output is None:
244 if output is None:
245 self.noinfo('definition header',oname)
245 self.noinfo('definition header',oname)
246 else:
246 else:
247 print >>Term.cout, header,self.format(output),
247 print >>Term.cout, header,self.format(output),
248
248
249 def pdoc(self,obj,oname='',formatter = None):
249 def pdoc(self,obj,oname='',formatter = None):
250 """Print the docstring for any object.
250 """Print the docstring for any object.
251
251
252 Optional:
252 Optional:
253 -formatter: a function to run the docstring through for specially
253 -formatter: a function to run the docstring through for specially
254 formatted docstrings."""
254 formatted docstrings."""
255
255
256 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
257 ds = getdoc(obj)
257 ds = getdoc(obj)
258 if formatter:
258 if formatter:
259 ds = formatter(ds)
259 ds = formatter(ds)
260 if type(obj) is types.ClassType:
260 if type(obj) is types.ClassType:
261 init_ds = getdoc(obj.__init__)
261 init_ds = getdoc(obj.__init__)
262 output = itpl('$head("Class Docstring:")\n'
262 output = itpl('$head("Class Docstring:")\n'
263 '$indent(ds)\n'
263 '$indent(ds)\n'
264 '$head("Constructor Docstring"):\n'
264 '$head("Constructor Docstring"):\n'
265 '$indent(init_ds)')
265 '$indent(init_ds)')
266 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
266 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
267 call_ds = getdoc(obj.__call__)
267 call_ds = getdoc(obj.__call__)
268 if call_ds:
268 if call_ds:
269 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
269 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
270 '$head("Calling Docstring:")\n$indent(call_ds)')
270 '$head("Calling Docstring:")\n$indent(call_ds)')
271 else:
271 else:
272 output = ds
272 output = ds
273 else:
273 else:
274 output = ds
274 output = ds
275 if output is None:
275 if output is None:
276 self.noinfo('documentation',oname)
276 self.noinfo('documentation',oname)
277 return
277 return
278 page(output)
278 page(output)
279
279
280 def psource(self,obj,oname=''):
280 def psource(self,obj,oname=''):
281 """Print the source code for an object."""
281 """Print the source code for an object."""
282
282
283 # 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
284 linecache.checkcache()
284 linecache.checkcache()
285 try:
285 try:
286 src = getsource(obj)
286 src = getsource(obj)
287 except:
287 except:
288 self.noinfo('source',oname)
288 self.noinfo('source',oname)
289 else:
289 else:
290 page(self.format(src))
290 page(self.format(src))
291
291
292 def pfile(self,obj,oname=''):
292 def pfile(self,obj,oname=''):
293 """Show the whole file where an object was defined."""
293 """Show the whole file where an object was defined."""
294 try:
294 try:
295 sourcelines,lineno = inspect.getsourcelines(obj)
295 sourcelines,lineno = inspect.getsourcelines(obj)
296 except:
296 except:
297 self.noinfo('file',oname)
297 self.noinfo('file',oname)
298 else:
298 else:
299 # run contents of file through pager starting at line
299 # run contents of file through pager starting at line
300 # where the object is defined
300 # where the object is defined
301 ofile = inspect.getabsfile(obj)
301 ofile = inspect.getabsfile(obj)
302
302
303 if (ofile.endswith('.so') or ofile.endswith('.dll')):
303 if (ofile.endswith('.so') or ofile.endswith('.dll')):
304 print 'File %r is binary, not printing.' % ofile
304 print 'File %r is binary, not printing.' % ofile
305 elif not os.path.isfile(ofile):
305 elif not os.path.isfile(ofile):
306 print 'File %r does not exist, not printing.' % ofile
306 print 'File %r does not exist, not printing.' % ofile
307 else:
307 else:
308 # Print only text files, not extension binaries.
308 # Print only text files, not extension binaries.
309 page(self.format(open(ofile).read()),lineno)
309 page(self.format(open(ofile).read()),lineno)
310 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
310 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
311
311
312 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):
313 """Show detailed information about an object.
313 """Show detailed information about an object.
314
314
315 Optional arguments:
315 Optional arguments:
316
316
317 - oname: name of the variable pointing to the object.
317 - oname: name of the variable pointing to the object.
318
318
319 - formatter: special formatter for docstrings (see pdoc)
319 - formatter: special formatter for docstrings (see pdoc)
320
320
321 - info: a structure with some information fields which may have been
321 - info: a structure with some information fields which may have been
322 precomputed already.
322 precomputed already.
323
323
324 - detail_level: if set to 1, more information is given.
324 - detail_level: if set to 1, more information is given.
325 """
325 """
326
326
327 obj_type = type(obj)
327 obj_type = type(obj)
328
328
329 header = self.__head
329 header = self.__head
330 if info is None:
330 if info is None:
331 ismagic = 0
331 ismagic = 0
332 isalias = 0
332 isalias = 0
333 ospace = ''
333 ospace = ''
334 else:
334 else:
335 ismagic = info.ismagic
335 ismagic = info.ismagic
336 isalias = info.isalias
336 isalias = info.isalias
337 ospace = info.namespace
337 ospace = info.namespace
338 # Get docstring, special-casing aliases:
338 # Get docstring, special-casing aliases:
339 if isalias:
339 if isalias:
340 if not callable(obj):
340 ds = "Alias to the system command:\n %s" % obj[1]
341 ds = "Alias to the system command:\n %s" % obj[1]
341 else:
342 else:
343 ds = "Alias to " + str(obj)
344 else:
342 ds = getdoc(obj)
345 ds = getdoc(obj)
343 if ds is None:
346 if ds is None:
344 ds = '<no docstring>'
347 ds = '<no docstring>'
345 if formatter is not None:
348 if formatter is not None:
346 ds = formatter(ds)
349 ds = formatter(ds)
347
350
348 # store output in a list which gets joined with \n at the end.
351 # store output in a list which gets joined with \n at the end.
349 out = myStringIO()
352 out = myStringIO()
350
353
351 string_max = 200 # max size of strings to show (snipped if longer)
354 string_max = 200 # max size of strings to show (snipped if longer)
352 shalf = int((string_max -5)/2)
355 shalf = int((string_max -5)/2)
353
356
354 if ismagic:
357 if ismagic:
355 obj_type_name = 'Magic function'
358 obj_type_name = 'Magic function'
356 elif isalias:
359 elif isalias:
357 obj_type_name = 'System alias'
360 obj_type_name = 'System alias'
358 else:
361 else:
359 obj_type_name = obj_type.__name__
362 obj_type_name = obj_type.__name__
360 out.writeln(header('Type:\t\t')+obj_type_name)
363 out.writeln(header('Type:\t\t')+obj_type_name)
361
364
362 try:
365 try:
363 bclass = obj.__class__
366 bclass = obj.__class__
364 out.writeln(header('Base Class:\t')+str(bclass))
367 out.writeln(header('Base Class:\t')+str(bclass))
365 except: pass
368 except: pass
366
369
367 # String form, but snip if too long in ? form (full in ??)
370 # String form, but snip if too long in ? form (full in ??)
368 if detail_level >= self.str_detail_level:
371 if detail_level >= self.str_detail_level:
369 try:
372 try:
370 ostr = str(obj)
373 ostr = str(obj)
371 str_head = 'String Form:'
374 str_head = 'String Form:'
372 if not detail_level and len(ostr)>string_max:
375 if not detail_level and len(ostr)>string_max:
373 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
376 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
374 ostr = ("\n" + " " * len(str_head.expandtabs())).\
377 ostr = ("\n" + " " * len(str_head.expandtabs())).\
375 join(map(string.strip,ostr.split("\n")))
378 join(map(string.strip,ostr.split("\n")))
376 if ostr.find('\n') > -1:
379 if ostr.find('\n') > -1:
377 # Print multi-line strings starting at the next line.
380 # Print multi-line strings starting at the next line.
378 str_sep = '\n'
381 str_sep = '\n'
379 else:
382 else:
380 str_sep = '\t'
383 str_sep = '\t'
381 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
384 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
382 except:
385 except:
383 pass
386 pass
384
387
385 if ospace:
388 if ospace:
386 out.writeln(header('Namespace:\t')+ospace)
389 out.writeln(header('Namespace:\t')+ospace)
387
390
388 # Length (for strings and lists)
391 # Length (for strings and lists)
389 try:
392 try:
390 length = str(len(obj))
393 length = str(len(obj))
391 out.writeln(header('Length:\t\t')+length)
394 out.writeln(header('Length:\t\t')+length)
392 except: pass
395 except: pass
393
396
394 # Filename where object was defined
397 # Filename where object was defined
395 binary_file = False
398 binary_file = False
396 try:
399 try:
397 fname = inspect.getabsfile(obj)
400 fname = inspect.getabsfile(obj)
398 if fname.endswith('<string>'):
401 if fname.endswith('<string>'):
399 fname = 'Dynamically generated function. No source code available.'
402 fname = 'Dynamically generated function. No source code available.'
400 if (fname.endswith('.so') or fname.endswith('.dll') or
403 if (fname.endswith('.so') or fname.endswith('.dll') or
401 not os.path.isfile(fname)):
404 not os.path.isfile(fname)):
402 binary_file = True
405 binary_file = True
403 out.writeln(header('File:\t\t')+fname)
406 out.writeln(header('File:\t\t')+fname)
404 except:
407 except:
405 # if anything goes wrong, we don't want to show source, so it's as
408 # if anything goes wrong, we don't want to show source, so it's as
406 # if the file was binary
409 # if the file was binary
407 binary_file = True
410 binary_file = True
408
411
409 # reconstruct the function definition and print it:
412 # reconstruct the function definition and print it:
410 defln = self.__getdef(obj,oname)
413 defln = self.__getdef(obj,oname)
411 if defln:
414 if defln:
412 out.write(header('Definition:\t')+self.format(defln))
415 out.write(header('Definition:\t')+self.format(defln))
413
416
414 # Docstrings only in detail 0 mode, since source contains them (we
417 # Docstrings only in detail 0 mode, since source contains them (we
415 # avoid repetitions). If source fails, we add them back, see below.
418 # avoid repetitions). If source fails, we add them back, see below.
416 if ds and detail_level == 0:
419 if ds and detail_level == 0:
417 out.writeln(header('Docstring:\n') + indent(ds))
420 out.writeln(header('Docstring:\n') + indent(ds))
418
421
419
422
420 # Original source code for any callable
423 # Original source code for any callable
421 if detail_level:
424 if detail_level:
422 # Flush the source cache because inspect can return out-of-date source
425 # Flush the source cache because inspect can return out-of-date source
423 linecache.checkcache()
426 linecache.checkcache()
424 source_success = False
427 source_success = False
425 try:
428 try:
426 source = self.format(getsource(obj,binary_file))
429 source = self.format(getsource(obj,binary_file))
427 if source:
430 if source:
428 out.write(header('Source:\n')+source.rstrip())
431 out.write(header('Source:\n')+source.rstrip())
429 source_success = True
432 source_success = True
430 except Exception, msg:
433 except Exception, msg:
431 pass
434 pass
432
435
433 if ds and not source_success:
436 if ds and not source_success:
434 out.writeln(header('Docstring [source file open failed]:\n')
437 out.writeln(header('Docstring [source file open failed]:\n')
435 + indent(ds))
438 + indent(ds))
436
439
437 # Constructor docstring for classes
440 # Constructor docstring for classes
438 if obj_type is types.ClassType:
441 if obj_type is types.ClassType:
439 # reconstruct the function definition and print it:
442 # reconstruct the function definition and print it:
440 try:
443 try:
441 obj_init = obj.__init__
444 obj_init = obj.__init__
442 except AttributeError:
445 except AttributeError:
443 init_def = init_ds = None
446 init_def = init_ds = None
444 else:
447 else:
445 init_def = self.__getdef(obj_init,oname)
448 init_def = self.__getdef(obj_init,oname)
446 init_ds = getdoc(obj_init)
449 init_ds = getdoc(obj_init)
447
450
448 if init_def or init_ds:
451 if init_def or init_ds:
449 out.writeln(header('\nConstructor information:'))
452 out.writeln(header('\nConstructor information:'))
450 if init_def:
453 if init_def:
451 out.write(header('Definition:\t')+ self.format(init_def))
454 out.write(header('Definition:\t')+ self.format(init_def))
452 if init_ds:
455 if init_ds:
453 out.writeln(header('Docstring:\n') + indent(init_ds))
456 out.writeln(header('Docstring:\n') + indent(init_ds))
454 # and class docstring for instances:
457 # and class docstring for instances:
455 elif obj_type is types.InstanceType:
458 elif obj_type is types.InstanceType:
456
459
457 # First, check whether the instance docstring is identical to the
460 # First, check whether the instance docstring is identical to the
458 # class one, and print it separately if they don't coincide. In
461 # class one, and print it separately if they don't coincide. In
459 # most cases they will, but it's nice to print all the info for
462 # most cases they will, but it's nice to print all the info for
460 # objects which use instance-customized docstrings.
463 # objects which use instance-customized docstrings.
461 if ds:
464 if ds:
462 class_ds = getdoc(obj.__class__)
465 class_ds = getdoc(obj.__class__)
463 if class_ds and ds != class_ds:
466 if class_ds and ds != class_ds:
464 out.writeln(header('Class Docstring:\n') +
467 out.writeln(header('Class Docstring:\n') +
465 indent(class_ds))
468 indent(class_ds))
466
469
467 # Next, try to show constructor docstrings
470 # Next, try to show constructor docstrings
468 try:
471 try:
469 init_ds = getdoc(obj.__init__)
472 init_ds = getdoc(obj.__init__)
470 except AttributeError:
473 except AttributeError:
471 init_ds = None
474 init_ds = None
472 if init_ds:
475 if init_ds:
473 out.writeln(header('Constructor Docstring:\n') +
476 out.writeln(header('Constructor Docstring:\n') +
474 indent(init_ds))
477 indent(init_ds))
475
478
476 # Call form docstring for callable instances
479 # Call form docstring for callable instances
477 if hasattr(obj,'__call__'):
480 if hasattr(obj,'__call__'):
478 out.writeln(header('Callable:\t')+'Yes')
481 out.writeln(header('Callable:\t')+'Yes')
479 call_def = self.__getdef(obj.__call__,oname)
482 call_def = self.__getdef(obj.__call__,oname)
480 if call_def is None:
483 if call_def is None:
481 out.write(header('Call def:\t')+
484 out.write(header('Call def:\t')+
482 'Calling definition not available.')
485 'Calling definition not available.')
483 else:
486 else:
484 out.write(header('Call def:\t')+self.format(call_def))
487 out.write(header('Call def:\t')+self.format(call_def))
485 call_ds = getdoc(obj.__call__)
488 call_ds = getdoc(obj.__call__)
486 if call_ds:
489 if call_ds:
487 out.writeln(header('Call docstring:\n') + indent(call_ds))
490 out.writeln(header('Call docstring:\n') + indent(call_ds))
488
491
489 # Finally send to printer/pager
492 # Finally send to printer/pager
490 output = out.getvalue()
493 output = out.getvalue()
491 if output:
494 if output:
492 page(output)
495 page(output)
493 # end pinfo
496 # end pinfo
494
497
495 def psearch(self,pattern,ns_table,ns_search=[],
498 def psearch(self,pattern,ns_table,ns_search=[],
496 ignore_case=False,show_all=False):
499 ignore_case=False,show_all=False):
497 """Search namespaces with wildcards for objects.
500 """Search namespaces with wildcards for objects.
498
501
499 Arguments:
502 Arguments:
500
503
501 - pattern: string containing shell-like wildcards to use in namespace
504 - pattern: string containing shell-like wildcards to use in namespace
502 searches and optionally a type specification to narrow the search to
505 searches and optionally a type specification to narrow the search to
503 objects of that type.
506 objects of that type.
504
507
505 - ns_table: dict of name->namespaces for search.
508 - ns_table: dict of name->namespaces for search.
506
509
507 Optional arguments:
510 Optional arguments:
508
511
509 - ns_search: list of namespace names to include in search.
512 - ns_search: list of namespace names to include in search.
510
513
511 - ignore_case(False): make the search case-insensitive.
514 - ignore_case(False): make the search case-insensitive.
512
515
513 - show_all(False): show all names, including those starting with
516 - show_all(False): show all names, including those starting with
514 underscores.
517 underscores.
515 """
518 """
516 # defaults
519 # defaults
517 type_pattern = 'all'
520 type_pattern = 'all'
518 filter = ''
521 filter = ''
519
522
520 cmds = pattern.split()
523 cmds = pattern.split()
521 len_cmds = len(cmds)
524 len_cmds = len(cmds)
522 if len_cmds == 1:
525 if len_cmds == 1:
523 # Only filter pattern given
526 # Only filter pattern given
524 filter = cmds[0]
527 filter = cmds[0]
525 elif len_cmds == 2:
528 elif len_cmds == 2:
526 # Both filter and type specified
529 # Both filter and type specified
527 filter,type_pattern = cmds
530 filter,type_pattern = cmds
528 else:
531 else:
529 raise ValueError('invalid argument string for psearch: <%s>' %
532 raise ValueError('invalid argument string for psearch: <%s>' %
530 pattern)
533 pattern)
531
534
532 # filter search namespaces
535 # filter search namespaces
533 for name in ns_search:
536 for name in ns_search:
534 if name not in ns_table:
537 if name not in ns_table:
535 raise ValueError('invalid namespace <%s>. Valid names: %s' %
538 raise ValueError('invalid namespace <%s>. Valid names: %s' %
536 (name,ns_table.keys()))
539 (name,ns_table.keys()))
537
540
538 #print 'type_pattern:',type_pattern # dbg
541 #print 'type_pattern:',type_pattern # dbg
539 search_result = []
542 search_result = []
540 for ns_name in ns_search:
543 for ns_name in ns_search:
541 ns = ns_table[ns_name]
544 ns = ns_table[ns_name]
542 tmp_res = list(list_namespace(ns,type_pattern,filter,
545 tmp_res = list(list_namespace(ns,type_pattern,filter,
543 ignore_case=ignore_case,
546 ignore_case=ignore_case,
544 show_all=show_all))
547 show_all=show_all))
545 search_result.extend(tmp_res)
548 search_result.extend(tmp_res)
546 search_result.sort()
549 search_result.sort()
547
550
548 page('\n'.join(search_result))
551 page('\n'.join(search_result))
@@ -1,457 +1,463 b''
1 ''' IPython customization API
1 ''' IPython customization API
2
2
3 Your one-stop module for configuring & extending ipython
3 Your one-stop module for configuring & extending ipython
4
4
5 The API will probably break when ipython 1.0 is released, but so
5 The API will probably break when ipython 1.0 is released, but so
6 will the other configuration method (rc files).
6 will the other configuration method (rc files).
7
7
8 All names prefixed by underscores are for internal use, not part
8 All names prefixed by underscores are for internal use, not part
9 of the public api.
9 of the public api.
10
10
11 Below is an example that you can just put to a module and import from ipython.
11 Below is an example that you can just put to a module and import from ipython.
12
12
13 A good practice is to install the config script below as e.g.
13 A good practice is to install the config script below as e.g.
14
14
15 ~/.ipython/my_private_conf.py
15 ~/.ipython/my_private_conf.py
16
16
17 And do
17 And do
18
18
19 import_mod my_private_conf
19 import_mod my_private_conf
20
20
21 in ~/.ipython/ipythonrc
21 in ~/.ipython/ipythonrc
22
22
23 That way the module is imported at startup and you can have all your
23 That way the module is imported at startup and you can have all your
24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
25 stuff) in there.
25 stuff) in there.
26
26
27 -----------------------------------------------
27 -----------------------------------------------
28 import IPython.ipapi
28 import IPython.ipapi
29 ip = IPython.ipapi.get()
29 ip = IPython.ipapi.get()
30
30
31 def ankka_f(self, arg):
31 def ankka_f(self, arg):
32 print "Ankka",self,"says uppercase:",arg.upper()
32 print "Ankka",self,"says uppercase:",arg.upper()
33
33
34 ip.expose_magic("ankka",ankka_f)
34 ip.expose_magic("ankka",ankka_f)
35
35
36 ip.magic('alias sayhi echo "Testing, hi ok"')
36 ip.magic('alias sayhi echo "Testing, hi ok"')
37 ip.magic('alias helloworld echo "Hello world"')
37 ip.magic('alias helloworld echo "Hello world"')
38 ip.system('pwd')
38 ip.system('pwd')
39
39
40 ip.ex('import re')
40 ip.ex('import re')
41 ip.ex("""
41 ip.ex("""
42 def funcci(a,b):
42 def funcci(a,b):
43 print a+b
43 print a+b
44 print funcci(3,4)
44 print funcci(3,4)
45 """)
45 """)
46 ip.ex("funcci(348,9)")
46 ip.ex("funcci(348,9)")
47
47
48 def jed_editor(self,filename, linenum=None):
48 def jed_editor(self,filename, linenum=None):
49 print "Calling my own editor, jed ... via hook!"
49 print "Calling my own editor, jed ... via hook!"
50 import os
50 import os
51 if linenum is None: linenum = 0
51 if linenum is None: linenum = 0
52 os.system('jed +%d %s' % (linenum, filename))
52 os.system('jed +%d %s' % (linenum, filename))
53 print "exiting jed"
53 print "exiting jed"
54
54
55 ip.set_hook('editor',jed_editor)
55 ip.set_hook('editor',jed_editor)
56
56
57 o = ip.options
57 o = ip.options
58 o.autocall = 2 # FULL autocall mode
58 o.autocall = 2 # FULL autocall mode
59
59
60 print "done!"
60 print "done!"
61 '''
61 '''
62
62
63 # stdlib imports
63 # stdlib imports
64 import __builtin__
64 import __builtin__
65 import sys
65 import sys
66
66
67 # our own
67 # our own
68 #from IPython.genutils import warn,error
68 #from IPython.genutils import warn,error
69
69
70 class TryNext(Exception):
70 class TryNext(Exception):
71 """Try next hook exception.
71 """Try next hook exception.
72
72
73 Raise this in your hook function to indicate that the next hook handler
73 Raise this in your hook function to indicate that the next hook handler
74 should be used to handle the operation. If you pass arguments to the
74 should be used to handle the operation. If you pass arguments to the
75 constructor those arguments will be used by the next hook instead of the
75 constructor those arguments will be used by the next hook instead of the
76 original ones.
76 original ones.
77 """
77 """
78
78
79 def __init__(self, *args, **kwargs):
79 def __init__(self, *args, **kwargs):
80 self.args = args
80 self.args = args
81 self.kwargs = kwargs
81 self.kwargs = kwargs
82
82
83 class IPyAutocall:
83 class IPyAutocall:
84 """ Instances of this class are always autocalled
84 """ Instances of this class are always autocalled
85
85
86 This happens regardless of 'autocall' variable state. Use this to
86 This happens regardless of 'autocall' variable state. Use this to
87 develop macro-like mechanisms.
87 develop macro-like mechanisms.
88 """
88 """
89
89
90 def set_ip(self,ip):
90 def set_ip(self,ip):
91 """ Will be used to set _ip point to current ipython instance b/f call
91 """ Will be used to set _ip point to current ipython instance b/f call
92
92
93 Override this method if you don't want this to happen.
93 Override this method if you don't want this to happen.
94
94
95 """
95 """
96 self._ip = ip
96 self._ip = ip
97
97
98
98
99 # contains the most recently instantiated IPApi
99 # contains the most recently instantiated IPApi
100
100
101 class IPythonNotRunning:
101 class IPythonNotRunning:
102 """Dummy do-nothing class.
102 """Dummy do-nothing class.
103
103
104 Instances of this class return a dummy attribute on all accesses, which
104 Instances of this class return a dummy attribute on all accesses, which
105 can be called and warns. This makes it easier to write scripts which use
105 can be called and warns. This makes it easier to write scripts which use
106 the ipapi.get() object for informational purposes to operate both with and
106 the ipapi.get() object for informational purposes to operate both with and
107 without ipython. Obviously code which uses the ipython object for
107 without ipython. Obviously code which uses the ipython object for
108 computations will not work, but this allows a wider range of code to
108 computations will not work, but this allows a wider range of code to
109 transparently work whether ipython is being used or not."""
109 transparently work whether ipython is being used or not."""
110
110
111 def __init__(self,warn=True):
111 def __init__(self,warn=True):
112 if warn:
112 if warn:
113 self.dummy = self._dummy_warn
113 self.dummy = self._dummy_warn
114 else:
114 else:
115 self.dummy = self._dummy_silent
115 self.dummy = self._dummy_silent
116
116
117 def __str__(self):
117 def __str__(self):
118 return "<IPythonNotRunning>"
118 return "<IPythonNotRunning>"
119
119
120 __repr__ = __str__
120 __repr__ = __str__
121
121
122 def __getattr__(self,name):
122 def __getattr__(self,name):
123 return self.dummy
123 return self.dummy
124
124
125 def _dummy_warn(self,*args,**kw):
125 def _dummy_warn(self,*args,**kw):
126 """Dummy function, which doesn't do anything but warn."""
126 """Dummy function, which doesn't do anything but warn."""
127
127
128 print ("IPython is not running, this is a dummy no-op function")
128 print ("IPython is not running, this is a dummy no-op function")
129
129
130 def _dummy_silent(self,*args,**kw):
130 def _dummy_silent(self,*args,**kw):
131 """Dummy function, which doesn't do anything and emits no warnings."""
131 """Dummy function, which doesn't do anything and emits no warnings."""
132 pass
132 pass
133
133
134 _recent = None
134 _recent = None
135
135
136
136
137 def get(allow_dummy=False,dummy_warn=True):
137 def get(allow_dummy=False,dummy_warn=True):
138 """Get an IPApi object.
138 """Get an IPApi object.
139
139
140 If allow_dummy is true, returns an instance of IPythonNotRunning
140 If allow_dummy is true, returns an instance of IPythonNotRunning
141 instead of None if not running under IPython.
141 instead of None if not running under IPython.
142
142
143 If dummy_warn is false, the dummy instance will be completely silent.
143 If dummy_warn is false, the dummy instance will be completely silent.
144
144
145 Running this should be the first thing you do when writing extensions that
145 Running this should be the first thing you do when writing extensions that
146 can be imported as normal modules. You can then direct all the
146 can be imported as normal modules. You can then direct all the
147 configuration operations against the returned object.
147 configuration operations against the returned object.
148 """
148 """
149 global _recent
149 global _recent
150 if allow_dummy and not _recent:
150 if allow_dummy and not _recent:
151 _recent = IPythonNotRunning(dummy_warn)
151 _recent = IPythonNotRunning(dummy_warn)
152 return _recent
152 return _recent
153
153
154 class IPApi:
154 class IPApi:
155 """ The actual API class for configuring IPython
155 """ The actual API class for configuring IPython
156
156
157 You should do all of the IPython configuration by getting an IPApi object
157 You should do all of the IPython configuration by getting an IPApi object
158 with IPython.ipapi.get() and using the attributes and methods of the
158 with IPython.ipapi.get() and using the attributes and methods of the
159 returned object."""
159 returned object."""
160
160
161 def __init__(self,ip):
161 def __init__(self,ip):
162
162
163 # All attributes exposed here are considered to be the public API of
163 # All attributes exposed here are considered to be the public API of
164 # IPython. As needs dictate, some of these may be wrapped as
164 # IPython. As needs dictate, some of these may be wrapped as
165 # properties.
165 # properties.
166
166
167 self.magic = ip.ipmagic
167 self.magic = ip.ipmagic
168
168
169 self.system = ip.system
169 self.system = ip.system
170
170
171 self.set_hook = ip.set_hook
171 self.set_hook = ip.set_hook
172
172
173 self.set_custom_exc = ip.set_custom_exc
173 self.set_custom_exc = ip.set_custom_exc
174
174
175 self.user_ns = ip.user_ns
175 self.user_ns = ip.user_ns
176
176
177 self.set_crash_handler = ip.set_crash_handler
177 self.set_crash_handler = ip.set_crash_handler
178
178
179 # Session-specific data store, which can be used to store
179 # Session-specific data store, which can be used to store
180 # data that should persist through the ipython session.
180 # data that should persist through the ipython session.
181 self.meta = ip.meta
181 self.meta = ip.meta
182
182
183 # The ipython instance provided
183 # The ipython instance provided
184 self.IP = ip
184 self.IP = ip
185
185
186 self.extensions = {}
186 self.extensions = {}
187 global _recent
187 global _recent
188 _recent = self
188 _recent = self
189
189
190 # Use a property for some things which are added to the instance very
190 # Use a property for some things which are added to the instance very
191 # late. I don't have time right now to disentangle the initialization
191 # late. I don't have time right now to disentangle the initialization
192 # order issues, so a property lets us delay item extraction while
192 # order issues, so a property lets us delay item extraction while
193 # providing a normal attribute API.
193 # providing a normal attribute API.
194 def get_db(self):
194 def get_db(self):
195 """A handle to persistent dict-like database (a PickleShareDB object)"""
195 """A handle to persistent dict-like database (a PickleShareDB object)"""
196 return self.IP.db
196 return self.IP.db
197
197
198 db = property(get_db,None,None,get_db.__doc__)
198 db = property(get_db,None,None,get_db.__doc__)
199
199
200 def get_options(self):
200 def get_options(self):
201 """All configurable variables."""
201 """All configurable variables."""
202
202
203 # catch typos by disabling new attribute creation. If new attr creation
203 # catch typos by disabling new attribute creation. If new attr creation
204 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
204 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
205 # for the received rc struct.
205 # for the received rc struct.
206
206
207 self.IP.rc.allow_new_attr(False)
207 self.IP.rc.allow_new_attr(False)
208 return self.IP.rc
208 return self.IP.rc
209
209
210 options = property(get_options,None,None,get_options.__doc__)
210 options = property(get_options,None,None,get_options.__doc__)
211
211
212 def expose_magic(self,magicname, func):
212 def expose_magic(self,magicname, func):
213 ''' Expose own function as magic function for ipython
213 ''' Expose own function as magic function for ipython
214
214
215 def foo_impl(self,parameter_s=''):
215 def foo_impl(self,parameter_s=''):
216 """My very own magic!. (Use docstrings, IPython reads them)."""
216 """My very own magic!. (Use docstrings, IPython reads them)."""
217 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
217 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
218 print 'The self object is:',self
218 print 'The self object is:',self
219
219
220 ipapi.expose_magic("foo",foo_impl)
220 ipapi.expose_magic("foo",foo_impl)
221 '''
221 '''
222
222
223 import new
223 import new
224 im = new.instancemethod(func,self.IP, self.IP.__class__)
224 im = new.instancemethod(func,self.IP, self.IP.__class__)
225 setattr(self.IP, "magic_" + magicname, im)
225 setattr(self.IP, "magic_" + magicname, im)
226
226
227 def ex(self,cmd):
227 def ex(self,cmd):
228 """ Execute a normal python statement in user namespace """
228 """ Execute a normal python statement in user namespace """
229 exec cmd in self.user_ns
229 exec cmd in self.user_ns
230
230
231 def ev(self,expr):
231 def ev(self,expr):
232 """ Evaluate python expression expr in user namespace
232 """ Evaluate python expression expr in user namespace
233
233
234 Returns the result of evaluation"""
234 Returns the result of evaluation"""
235 return eval(expr,self.user_ns)
235 return eval(expr,self.user_ns)
236
236
237 def runlines(self,lines):
237 def runlines(self,lines):
238 """ Run the specified lines in interpreter, honoring ipython directives.
238 """ Run the specified lines in interpreter, honoring ipython directives.
239
239
240 This allows %magic and !shell escape notations.
240 This allows %magic and !shell escape notations.
241
241
242 Takes either all lines in one string or list of lines.
242 Takes either all lines in one string or list of lines.
243 """
243 """
244 if isinstance(lines,basestring):
244 if isinstance(lines,basestring):
245 self.IP.runlines(lines)
245 self.IP.runlines(lines)
246 else:
246 else:
247 self.IP.runlines('\n'.join(lines))
247 self.IP.runlines('\n'.join(lines))
248
248
249 def to_user_ns(self,vars, interactive = True):
249 def to_user_ns(self,vars, interactive = True):
250 """Inject a group of variables into the IPython user namespace.
250 """Inject a group of variables into the IPython user namespace.
251
251
252 Inputs:
252 Inputs:
253
253
254 - vars: string with variable names separated by whitespace
254 - vars: string with variable names separated by whitespace
255
255
256 - interactive: if True (default), the var will be listed with
256 - interactive: if True (default), the var will be listed with
257 %whos et. al.
257 %whos et. al.
258
258
259 This utility routine is meant to ease interactive debugging work,
259 This utility routine is meant to ease interactive debugging work,
260 where you want to easily propagate some internal variable in your code
260 where you want to easily propagate some internal variable in your code
261 up to the interactive namespace for further exploration.
261 up to the interactive namespace for further exploration.
262
262
263 When you run code via %run, globals in your script become visible at
263 When you run code via %run, globals in your script become visible at
264 the interactive prompt, but this doesn't happen for locals inside your
264 the interactive prompt, but this doesn't happen for locals inside your
265 own functions and methods. Yet when debugging, it is common to want
265 own functions and methods. Yet when debugging, it is common to want
266 to explore some internal variables further at the interactive propmt.
266 to explore some internal variables further at the interactive propmt.
267
267
268 Examples:
268 Examples:
269
269
270 To use this, you first must obtain a handle on the ipython object as
270 To use this, you first must obtain a handle on the ipython object as
271 indicated above, via:
271 indicated above, via:
272
272
273 import IPython.ipapi
273 import IPython.ipapi
274 ip = IPython.ipapi.get()
274 ip = IPython.ipapi.get()
275
275
276 Once this is done, inside a routine foo() where you want to expose
276 Once this is done, inside a routine foo() where you want to expose
277 variables x and y, you do the following:
277 variables x and y, you do the following:
278
278
279 def foo():
279 def foo():
280 ...
280 ...
281 x = your_computation()
281 x = your_computation()
282 y = something_else()
282 y = something_else()
283
283
284 # This pushes x and y to the interactive prompt immediately, even
284 # This pushes x and y to the interactive prompt immediately, even
285 # if this routine crashes on the next line after:
285 # if this routine crashes on the next line after:
286 ip.to_user_ns('x y')
286 ip.to_user_ns('x y')
287 ...
287 ...
288 # return
288 # return
289
289
290 If you need to rename variables, just use ip.user_ns with dict
290 If you need to rename variables, just use ip.user_ns with dict
291 and update:
291 and update:
292
292
293 # exposes variables 'foo' as 'x' and 'bar' as 'y' in IPython
293 # exposes variables 'foo' as 'x' and 'bar' as 'y' in IPython
294 # user namespace
294 # user namespace
295 ip.user_ns.update(dict(x=foo,y=bar))
295 ip.user_ns.update(dict(x=foo,y=bar))
296 """
296 """
297
297
298 # print 'vars given:',vars # dbg
298 # print 'vars given:',vars # dbg
299 # Get the caller's frame to evaluate the given names in
299 # Get the caller's frame to evaluate the given names in
300 cf = sys._getframe(1)
300 cf = sys._getframe(1)
301
301
302 user_ns = self.user_ns
302 user_ns = self.user_ns
303 config_ns = self.IP.user_config_ns
303 config_ns = self.IP.user_config_ns
304 for name in vars.split():
304 for name in vars.split():
305 try:
305 try:
306 val = eval(name,cf.f_globals,cf.f_locals)
306 val = eval(name,cf.f_globals,cf.f_locals)
307 user_ns[name] = val
307 user_ns[name] = val
308 if not interactive:
308 if not interactive:
309 config_ns[name] = val
309 config_ns[name] = val
310 else:
310 else:
311 config_ns.pop(name,None)
311 config_ns.pop(name,None)
312 except:
312 except:
313 print ('could not get var. %s from %s' %
313 print ('could not get var. %s from %s' %
314 (name,cf.f_code.co_name))
314 (name,cf.f_code.co_name))
315
315
316 def expand_alias(self,line):
316 def expand_alias(self,line):
317 """ Expand an alias in the command line
317 """ Expand an alias in the command line
318
318
319 Returns the provided command line, possibly with the first word
319 Returns the provided command line, possibly with the first word
320 (command) translated according to alias expansion rules.
320 (command) translated according to alias expansion rules.
321
321
322 [ipython]|16> _ip.expand_aliases("np myfile.txt")
322 [ipython]|16> _ip.expand_aliases("np myfile.txt")
323 <16> 'q:/opt/np/notepad++.exe myfile.txt'
323 <16> 'q:/opt/np/notepad++.exe myfile.txt'
324 """
324 """
325
325
326 pre,fn,rest = self.IP.split_user_input(line)
326 pre,fn,rest = self.IP.split_user_input(line)
327 res = pre + self.IP.expand_aliases(fn,rest)
327 res = pre + self.IP.expand_aliases(fn,rest)
328 return res
328 return res
329
329
330 def defalias(self, name, cmd):
330 def defalias(self, name, cmd):
331 """ Define a new alias
331 """ Define a new alias
332
332
333 _ip.defalias('bb','bldmake bldfiles')
333 _ip.defalias('bb','bldmake bldfiles')
334
334
335 Creates a new alias named 'bb' in ipython user namespace
335 Creates a new alias named 'bb' in ipython user namespace
336 """
336 """
337
337
338 if callable(cmd):
339 self.IP.alias_table[name] = cmd
340 import IPython.shawodns
341 setattr(IPython.shadowns, name,cmd)
342 return
343
338
344
339 nargs = cmd.count('%s')
345 nargs = cmd.count('%s')
340 if nargs>0 and cmd.find('%l')>=0:
346 if nargs>0 and cmd.find('%l')>=0:
341 raise Exception('The %s and %l specifiers are mutually exclusive '
347 raise Exception('The %s and %l specifiers are mutually exclusive '
342 'in alias definitions.')
348 'in alias definitions.')
343
349
344 else: # all looks OK
350 else: # all looks OK
345 self.IP.alias_table[name] = (nargs,cmd)
351 self.IP.alias_table[name] = (nargs,cmd)
346
352
347 def defmacro(self, *args):
353 def defmacro(self, *args):
348 """ Define a new macro
354 """ Define a new macro
349
355
350 2 forms of calling:
356 2 forms of calling:
351
357
352 mac = _ip.defmacro('print "hello"\nprint "world"')
358 mac = _ip.defmacro('print "hello"\nprint "world"')
353
359
354 (doesn't put the created macro on user namespace)
360 (doesn't put the created macro on user namespace)
355
361
356 _ip.defmacro('build', 'bldmake bldfiles\nabld build winscw udeb')
362 _ip.defmacro('build', 'bldmake bldfiles\nabld build winscw udeb')
357
363
358 (creates a macro named 'build' in user namespace)
364 (creates a macro named 'build' in user namespace)
359 """
365 """
360
366
361 import IPython.macro
367 import IPython.macro
362
368
363 if len(args) == 1:
369 if len(args) == 1:
364 return IPython.macro.Macro(args[0])
370 return IPython.macro.Macro(args[0])
365 elif len(args) == 2:
371 elif len(args) == 2:
366 self.user_ns[args[0]] = IPython.macro.Macro(args[1])
372 self.user_ns[args[0]] = IPython.macro.Macro(args[1])
367 else:
373 else:
368 return Exception("_ip.defmacro must be called with 1 or 2 arguments")
374 return Exception("_ip.defmacro must be called with 1 or 2 arguments")
369
375
370 def set_next_input(self, s):
376 def set_next_input(self, s):
371 """ Sets the 'default' input string for the next command line.
377 """ Sets the 'default' input string for the next command line.
372
378
373 Requires readline.
379 Requires readline.
374
380
375 Example:
381 Example:
376
382
377 [D:\ipython]|1> _ip.set_next_input("Hello Word")
383 [D:\ipython]|1> _ip.set_next_input("Hello Word")
378 [D:\ipython]|2> Hello Word_ # cursor is here
384 [D:\ipython]|2> Hello Word_ # cursor is here
379 """
385 """
380
386
381 self.IP.rl_next_input = s
387 self.IP.rl_next_input = s
382
388
383 def load(self, mod):
389 def load(self, mod):
384 if mod in self.extensions:
390 if mod in self.extensions:
385 # just to make sure we don't init it twice
391 # just to make sure we don't init it twice
386 # note that if you 'load' a module that has already been
392 # note that if you 'load' a module that has already been
387 # imported, init_ipython gets run anyway
393 # imported, init_ipython gets run anyway
388
394
389 return self.extensions[mod]
395 return self.extensions[mod]
390 __import__(mod)
396 __import__(mod)
391 m = sys.modules[mod]
397 m = sys.modules[mod]
392 if hasattr(m,'init_ipython'):
398 if hasattr(m,'init_ipython'):
393 m.init_ipython(self)
399 m.init_ipython(self)
394 self.extensions[mod] = m
400 self.extensions[mod] = m
395 return m
401 return m
396
402
397
403
398 def launch_new_instance(user_ns = None):
404 def launch_new_instance(user_ns = None):
399 """ Make and start a new ipython instance.
405 """ Make and start a new ipython instance.
400
406
401 This can be called even without having an already initialized
407 This can be called even without having an already initialized
402 ipython session running.
408 ipython session running.
403
409
404 This is also used as the egg entry point for the 'ipython' script.
410 This is also used as the egg entry point for the 'ipython' script.
405
411
406 """
412 """
407 ses = make_session(user_ns)
413 ses = make_session(user_ns)
408 ses.mainloop()
414 ses.mainloop()
409
415
410
416
411 def make_user_ns(user_ns = None):
417 def make_user_ns(user_ns = None):
412 """Return a valid user interactive namespace.
418 """Return a valid user interactive namespace.
413
419
414 This builds a dict with the minimal information needed to operate as a
420 This builds a dict with the minimal information needed to operate as a
415 valid IPython user namespace, which you can pass to the various embedding
421 valid IPython user namespace, which you can pass to the various embedding
416 classes in ipython.
422 classes in ipython.
417 """
423 """
418
424
419 if user_ns is None:
425 if user_ns is None:
420 # Set __name__ to __main__ to better match the behavior of the
426 # Set __name__ to __main__ to better match the behavior of the
421 # normal interpreter.
427 # normal interpreter.
422 user_ns = {'__name__' :'__main__',
428 user_ns = {'__name__' :'__main__',
423 '__builtins__' : __builtin__,
429 '__builtins__' : __builtin__,
424 }
430 }
425 else:
431 else:
426 user_ns.setdefault('__name__','__main__')
432 user_ns.setdefault('__name__','__main__')
427 user_ns.setdefault('__builtins__',__builtin__)
433 user_ns.setdefault('__builtins__',__builtin__)
428
434
429 return user_ns
435 return user_ns
430
436
431
437
432 def make_user_global_ns(ns = None):
438 def make_user_global_ns(ns = None):
433 """Return a valid user global namespace.
439 """Return a valid user global namespace.
434
440
435 Similar to make_user_ns(), but global namespaces are really only needed in
441 Similar to make_user_ns(), but global namespaces are really only needed in
436 embedded applications, where there is a distinction between the user's
442 embedded applications, where there is a distinction between the user's
437 interactive namespace and the global one where ipython is running."""
443 interactive namespace and the global one where ipython is running."""
438
444
439 if ns is None: ns = {}
445 if ns is None: ns = {}
440 return ns
446 return ns
441
447
442
448
443 def make_session(user_ns = None):
449 def make_session(user_ns = None):
444 """Makes, but does not launch an IPython session.
450 """Makes, but does not launch an IPython session.
445
451
446 Later on you can call obj.mainloop() on the returned object.
452 Later on you can call obj.mainloop() on the returned object.
447
453
448 Inputs:
454 Inputs:
449
455
450 - user_ns(None): a dict to be used as the user's namespace with initial
456 - user_ns(None): a dict to be used as the user's namespace with initial
451 data.
457 data.
452
458
453 WARNING: This should *not* be run when a session exists already."""
459 WARNING: This should *not* be run when a session exists already."""
454
460
455 import IPython
461 import IPython
456 return IPython.Shell.start(user_ns)
462 return IPython.Shell.start(user_ns)
457
463
@@ -1,2461 +1,2467 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 2442 2007-06-14 21:20:10Z vivainio $
9 $Id: iplib.py 2463 2007-06-27 22:51:16Z vivainio $
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 pydoc
50 import pydoc
51 import re
51 import re
52 import shutil
52 import shutil
53 import string
53 import string
54 import sys
54 import sys
55 import tempfile
55 import tempfile
56 import traceback
56 import traceback
57 import types
57 import types
58 import pickleshare
58 import pickleshare
59 from sets import Set
59 from sets import Set
60 from pprint import pprint, pformat
60 from pprint import pprint, pformat
61
61
62 # IPython's own modules
62 # IPython's own modules
63 #import IPython
63 #import IPython
64 from IPython import Debugger,OInspect,PyColorize,ultraTB
64 from IPython import Debugger,OInspect,PyColorize,ultraTB
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.FakeModule import FakeModule
66 from IPython.FakeModule import FakeModule
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Logger import Logger
68 from IPython.Logger import Logger
69 from IPython.Magic import Magic
69 from IPython.Magic import Magic
70 from IPython.Prompts import CachedOutput
70 from IPython.Prompts import CachedOutput
71 from IPython.ipstruct import Struct
71 from IPython.ipstruct import Struct
72 from IPython.background_jobs import BackgroundJobManager
72 from IPython.background_jobs import BackgroundJobManager
73 from IPython.usage import cmd_line_usage,interactive_usage
73 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.genutils import *
74 from IPython.genutils import *
75 from IPython.strdispatch import StrDispatch
75 from IPython.strdispatch import StrDispatch
76 import IPython.ipapi
76 import IPython.ipapi
77 import IPython.history
77 import IPython.history
78 import IPython.prefilter as prefilter
78 import IPython.prefilter as prefilter
79
79 import IPython.shadowns
80 # Globals
80 # Globals
81
81
82 # store the builtin raw_input globally, and use this always, in case user code
82 # store the builtin raw_input globally, and use this always, in case user code
83 # overwrites it (like wx.py.PyShell does)
83 # overwrites it (like wx.py.PyShell does)
84 raw_input_original = raw_input
84 raw_input_original = raw_input
85
85
86 # compiled regexps for autoindent management
86 # compiled regexps for autoindent management
87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88
88
89
89
90 #****************************************************************************
90 #****************************************************************************
91 # Some utility function definitions
91 # Some utility function definitions
92
92
93 ini_spaces_re = re.compile(r'^(\s+)')
93 ini_spaces_re = re.compile(r'^(\s+)')
94
94
95 def num_ini_spaces(strng):
95 def num_ini_spaces(strng):
96 """Return the number of initial spaces in a string"""
96 """Return the number of initial spaces in a string"""
97
97
98 ini_spaces = ini_spaces_re.match(strng)
98 ini_spaces = ini_spaces_re.match(strng)
99 if ini_spaces:
99 if ini_spaces:
100 return ini_spaces.end()
100 return ini_spaces.end()
101 else:
101 else:
102 return 0
102 return 0
103
103
104 def softspace(file, newvalue):
104 def softspace(file, newvalue):
105 """Copied from code.py, to remove the dependency"""
105 """Copied from code.py, to remove the dependency"""
106
106
107 oldvalue = 0
107 oldvalue = 0
108 try:
108 try:
109 oldvalue = file.softspace
109 oldvalue = file.softspace
110 except AttributeError:
110 except AttributeError:
111 pass
111 pass
112 try:
112 try:
113 file.softspace = newvalue
113 file.softspace = newvalue
114 except (AttributeError, TypeError):
114 except (AttributeError, TypeError):
115 # "attribute-less object" or "read-only attributes"
115 # "attribute-less object" or "read-only attributes"
116 pass
116 pass
117 return oldvalue
117 return oldvalue
118
118
119
119
120 #****************************************************************************
120 #****************************************************************************
121 # Local use exceptions
121 # Local use exceptions
122 class SpaceInInput(exceptions.Exception): pass
122 class SpaceInInput(exceptions.Exception): pass
123
123
124
124
125 #****************************************************************************
125 #****************************************************************************
126 # Local use classes
126 # Local use classes
127 class Bunch: pass
127 class Bunch: pass
128
128
129 class Undefined: pass
129 class Undefined: pass
130
130
131 class Quitter(object):
131 class Quitter(object):
132 """Simple class to handle exit, similar to Python 2.5's.
132 """Simple class to handle exit, similar to Python 2.5's.
133
133
134 It handles exiting in an ipython-safe manner, which the one in Python 2.5
134 It handles exiting in an ipython-safe manner, which the one in Python 2.5
135 doesn't do (obviously, since it doesn't know about ipython)."""
135 doesn't do (obviously, since it doesn't know about ipython)."""
136
136
137 def __init__(self,shell,name):
137 def __init__(self,shell,name):
138 self.shell = shell
138 self.shell = shell
139 self.name = name
139 self.name = name
140
140
141 def __repr__(self):
141 def __repr__(self):
142 return 'Type %s() to exit.' % self.name
142 return 'Type %s() to exit.' % self.name
143 __str__ = __repr__
143 __str__ = __repr__
144
144
145 def __call__(self):
145 def __call__(self):
146 self.shell.exit()
146 self.shell.exit()
147
147
148 class InputList(list):
148 class InputList(list):
149 """Class to store user input.
149 """Class to store user input.
150
150
151 It's basically a list, but slices return a string instead of a list, thus
151 It's basically a list, but slices return a string instead of a list, thus
152 allowing things like (assuming 'In' is an instance):
152 allowing things like (assuming 'In' is an instance):
153
153
154 exec In[4:7]
154 exec In[4:7]
155
155
156 or
156 or
157
157
158 exec In[5:9] + In[14] + In[21:25]"""
158 exec In[5:9] + In[14] + In[21:25]"""
159
159
160 def __getslice__(self,i,j):
160 def __getslice__(self,i,j):
161 return ''.join(list.__getslice__(self,i,j))
161 return ''.join(list.__getslice__(self,i,j))
162
162
163 class SyntaxTB(ultraTB.ListTB):
163 class SyntaxTB(ultraTB.ListTB):
164 """Extension which holds some state: the last exception value"""
164 """Extension which holds some state: the last exception value"""
165
165
166 def __init__(self,color_scheme = 'NoColor'):
166 def __init__(self,color_scheme = 'NoColor'):
167 ultraTB.ListTB.__init__(self,color_scheme)
167 ultraTB.ListTB.__init__(self,color_scheme)
168 self.last_syntax_error = None
168 self.last_syntax_error = None
169
169
170 def __call__(self, etype, value, elist):
170 def __call__(self, etype, value, elist):
171 self.last_syntax_error = value
171 self.last_syntax_error = value
172 ultraTB.ListTB.__call__(self,etype,value,elist)
172 ultraTB.ListTB.__call__(self,etype,value,elist)
173
173
174 def clear_err_state(self):
174 def clear_err_state(self):
175 """Return the current error state and clear it"""
175 """Return the current error state and clear it"""
176 e = self.last_syntax_error
176 e = self.last_syntax_error
177 self.last_syntax_error = None
177 self.last_syntax_error = None
178 return e
178 return e
179
179
180 #****************************************************************************
180 #****************************************************************************
181 # Main IPython class
181 # Main IPython class
182
182
183 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
183 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
184 # until a full rewrite is made. I've cleaned all cross-class uses of
184 # until a full rewrite is made. I've cleaned all cross-class uses of
185 # attributes and methods, but too much user code out there relies on the
185 # attributes and methods, but too much user code out there relies on the
186 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
186 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
187 #
187 #
188 # But at least now, all the pieces have been separated and we could, in
188 # But at least now, all the pieces have been separated and we could, in
189 # principle, stop using the mixin. This will ease the transition to the
189 # principle, stop using the mixin. This will ease the transition to the
190 # chainsaw branch.
190 # chainsaw branch.
191
191
192 # For reference, the following is the list of 'self.foo' uses in the Magic
192 # For reference, the following is the list of 'self.foo' uses in the Magic
193 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
193 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
194 # class, to prevent clashes.
194 # class, to prevent clashes.
195
195
196 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
196 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
197 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
197 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
198 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
198 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
199 # 'self.value']
199 # 'self.value']
200
200
201 class InteractiveShell(object,Magic):
201 class InteractiveShell(object,Magic):
202 """An enhanced console for Python."""
202 """An enhanced console for Python."""
203
203
204 # class attribute to indicate whether the class supports threads or not.
204 # class attribute to indicate whether the class supports threads or not.
205 # Subclasses with thread support should override this as needed.
205 # Subclasses with thread support should override this as needed.
206 isthreaded = False
206 isthreaded = False
207
207
208 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
208 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
209 user_ns = None,user_global_ns=None,banner2='',
209 user_ns = None,user_global_ns=None,banner2='',
210 custom_exceptions=((),None),embedded=False):
210 custom_exceptions=((),None),embedded=False):
211
211
212 # log system
212 # log system
213 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
213 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
214
214
215 # some minimal strict typechecks. For some core data structures, I
215 # some minimal strict typechecks. For some core data structures, I
216 # want actual basic python types, not just anything that looks like
216 # want actual basic python types, not just anything that looks like
217 # one. This is especially true for namespaces.
217 # one. This is especially true for namespaces.
218 for ns in (user_ns,user_global_ns):
218 for ns in (user_ns,user_global_ns):
219 if ns is not None and type(ns) != types.DictType:
219 if ns is not None and type(ns) != types.DictType:
220 raise TypeError,'namespace must be a dictionary'
220 raise TypeError,'namespace must be a dictionary'
221
221
222 # Job manager (for jobs run as background threads)
222 # Job manager (for jobs run as background threads)
223 self.jobs = BackgroundJobManager()
223 self.jobs = BackgroundJobManager()
224
224
225 # Store the actual shell's name
225 # Store the actual shell's name
226 self.name = name
226 self.name = name
227
227
228 # We need to know whether the instance is meant for embedding, since
228 # We need to know whether the instance is meant for embedding, since
229 # global/local namespaces need to be handled differently in that case
229 # global/local namespaces need to be handled differently in that case
230 self.embedded = embedded
230 self.embedded = embedded
231
231
232 # command compiler
232 # command compiler
233 self.compile = codeop.CommandCompiler()
233 self.compile = codeop.CommandCompiler()
234
234
235 # User input buffer
235 # User input buffer
236 self.buffer = []
236 self.buffer = []
237
237
238 # Default name given in compilation of code
238 # Default name given in compilation of code
239 self.filename = '<ipython console>'
239 self.filename = '<ipython console>'
240
240
241 # Install our own quitter instead of the builtins. For python2.3-2.4,
241 # Install our own quitter instead of the builtins. For python2.3-2.4,
242 # this brings in behavior like 2.5, and for 2.5 it's identical.
242 # this brings in behavior like 2.5, and for 2.5 it's identical.
243 __builtin__.exit = Quitter(self,'exit')
243 __builtin__.exit = Quitter(self,'exit')
244 __builtin__.quit = Quitter(self,'quit')
244 __builtin__.quit = Quitter(self,'quit')
245
245
246 # Make an empty namespace, which extension writers can rely on both
246 # Make an empty namespace, which extension writers can rely on both
247 # existing and NEVER being used by ipython itself. This gives them a
247 # existing and NEVER being used by ipython itself. This gives them a
248 # convenient location for storing additional information and state
248 # convenient location for storing additional information and state
249 # their extensions may require, without fear of collisions with other
249 # their extensions may require, without fear of collisions with other
250 # ipython names that may develop later.
250 # ipython names that may develop later.
251 self.meta = Struct()
251 self.meta = Struct()
252
252
253 # Create the namespace where the user will operate. user_ns is
253 # Create the namespace where the user will operate. user_ns is
254 # normally the only one used, and it is passed to the exec calls as
254 # normally the only one used, and it is passed to the exec calls as
255 # the locals argument. But we do carry a user_global_ns namespace
255 # the locals argument. But we do carry a user_global_ns namespace
256 # given as the exec 'globals' argument, This is useful in embedding
256 # given as the exec 'globals' argument, This is useful in embedding
257 # situations where the ipython shell opens in a context where the
257 # situations where the ipython shell opens in a context where the
258 # distinction between locals and globals is meaningful.
258 # distinction between locals and globals is meaningful.
259
259
260 # FIXME. For some strange reason, __builtins__ is showing up at user
260 # FIXME. For some strange reason, __builtins__ is showing up at user
261 # level as a dict instead of a module. This is a manual fix, but I
261 # level as a dict instead of a module. This is a manual fix, but I
262 # should really track down where the problem is coming from. Alex
262 # should really track down where the problem is coming from. Alex
263 # Schmolck reported this problem first.
263 # Schmolck reported this problem first.
264
264
265 # A useful post by Alex Martelli on this topic:
265 # A useful post by Alex Martelli on this topic:
266 # Re: inconsistent value from __builtins__
266 # Re: inconsistent value from __builtins__
267 # Von: Alex Martelli <aleaxit@yahoo.com>
267 # Von: Alex Martelli <aleaxit@yahoo.com>
268 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
268 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
269 # Gruppen: comp.lang.python
269 # Gruppen: comp.lang.python
270
270
271 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
271 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
272 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
272 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
273 # > <type 'dict'>
273 # > <type 'dict'>
274 # > >>> print type(__builtins__)
274 # > >>> print type(__builtins__)
275 # > <type 'module'>
275 # > <type 'module'>
276 # > Is this difference in return value intentional?
276 # > Is this difference in return value intentional?
277
277
278 # Well, it's documented that '__builtins__' can be either a dictionary
278 # Well, it's documented that '__builtins__' can be either a dictionary
279 # or a module, and it's been that way for a long time. Whether it's
279 # or a module, and it's been that way for a long time. Whether it's
280 # intentional (or sensible), I don't know. In any case, the idea is
280 # intentional (or sensible), I don't know. In any case, the idea is
281 # that if you need to access the built-in namespace directly, you
281 # that if you need to access the built-in namespace directly, you
282 # should start with "import __builtin__" (note, no 's') which will
282 # should start with "import __builtin__" (note, no 's') which will
283 # definitely give you a module. Yeah, it's somewhat confusing:-(.
283 # definitely give you a module. Yeah, it's somewhat confusing:-(.
284
284
285 # These routines return properly built dicts as needed by the rest of
285 # These routines return properly built dicts as needed by the rest of
286 # the code, and can also be used by extension writers to generate
286 # the code, and can also be used by extension writers to generate
287 # properly initialized namespaces.
287 # properly initialized namespaces.
288 user_ns = IPython.ipapi.make_user_ns(user_ns)
288 user_ns = IPython.ipapi.make_user_ns(user_ns)
289 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
289 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
290
290
291 # Assign namespaces
291 # Assign namespaces
292 # This is the namespace where all normal user variables live
292 # This is the namespace where all normal user variables live
293 self.user_ns = user_ns
293 self.user_ns = user_ns
294 # Embedded instances require a separate namespace for globals.
294 # Embedded instances require a separate namespace for globals.
295 # Normally this one is unused by non-embedded instances.
295 # Normally this one is unused by non-embedded instances.
296 self.user_global_ns = user_global_ns
296 self.user_global_ns = user_global_ns
297 # A namespace to keep track of internal data structures to prevent
297 # A namespace to keep track of internal data structures to prevent
298 # them from cluttering user-visible stuff. Will be updated later
298 # them from cluttering user-visible stuff. Will be updated later
299 self.internal_ns = {}
299 self.internal_ns = {}
300
300
301 # Namespace of system aliases. Each entry in the alias
301 # Namespace of system aliases. Each entry in the alias
302 # table must be a 2-tuple of the form (N,name), where N is the number
302 # table must be a 2-tuple of the form (N,name), where N is the number
303 # of positional arguments of the alias.
303 # of positional arguments of the alias.
304 self.alias_table = {}
304 self.alias_table = {}
305
305
306 # A table holding all the namespaces IPython deals with, so that
306 # A table holding all the namespaces IPython deals with, so that
307 # introspection facilities can search easily.
307 # introspection facilities can search easily.
308 self.ns_table = {'user':user_ns,
308 self.ns_table = {'user':user_ns,
309 'user_global':user_global_ns,
309 'user_global':user_global_ns,
310 'alias':self.alias_table,
310 'alias':self.alias_table,
311 'internal':self.internal_ns,
311 'internal':self.internal_ns,
312 'builtin':__builtin__.__dict__
312 'builtin':__builtin__.__dict__
313 }
313 }
314
314
315 # The user namespace MUST have a pointer to the shell itself.
315 # The user namespace MUST have a pointer to the shell itself.
316 self.user_ns[name] = self
316 self.user_ns[name] = self
317
317
318 # We need to insert into sys.modules something that looks like a
318 # We need to insert into sys.modules something that looks like a
319 # module but which accesses the IPython namespace, for shelve and
319 # module but which accesses the IPython namespace, for shelve and
320 # pickle to work interactively. Normally they rely on getting
320 # pickle to work interactively. Normally they rely on getting
321 # everything out of __main__, but for embedding purposes each IPython
321 # everything out of __main__, but for embedding purposes each IPython
322 # instance has its own private namespace, so we can't go shoving
322 # instance has its own private namespace, so we can't go shoving
323 # everything into __main__.
323 # everything into __main__.
324
324
325 # note, however, that we should only do this for non-embedded
325 # note, however, that we should only do this for non-embedded
326 # ipythons, which really mimic the __main__.__dict__ with their own
326 # ipythons, which really mimic the __main__.__dict__ with their own
327 # namespace. Embedded instances, on the other hand, should not do
327 # namespace. Embedded instances, on the other hand, should not do
328 # this because they need to manage the user local/global namespaces
328 # this because they need to manage the user local/global namespaces
329 # only, but they live within a 'normal' __main__ (meaning, they
329 # only, but they live within a 'normal' __main__ (meaning, they
330 # shouldn't overtake the execution environment of the script they're
330 # shouldn't overtake the execution environment of the script they're
331 # embedded in).
331 # embedded in).
332
332
333 if not embedded:
333 if not embedded:
334 try:
334 try:
335 main_name = self.user_ns['__name__']
335 main_name = self.user_ns['__name__']
336 except KeyError:
336 except KeyError:
337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
338 else:
338 else:
339 #print "pickle hack in place" # dbg
339 #print "pickle hack in place" # dbg
340 #print 'main_name:',main_name # dbg
340 #print 'main_name:',main_name # dbg
341 sys.modules[main_name] = FakeModule(self.user_ns)
341 sys.modules[main_name] = FakeModule(self.user_ns)
342
342
343 # List of input with multi-line handling.
343 # List of input with multi-line handling.
344 # Fill its zero entry, user counter starts at 1
344 # Fill its zero entry, user counter starts at 1
345 self.input_hist = InputList(['\n'])
345 self.input_hist = InputList(['\n'])
346 # This one will hold the 'raw' input history, without any
346 # This one will hold the 'raw' input history, without any
347 # pre-processing. This will allow users to retrieve the input just as
347 # pre-processing. This will allow users to retrieve the input just as
348 # it was exactly typed in by the user, with %hist -r.
348 # it was exactly typed in by the user, with %hist -r.
349 self.input_hist_raw = InputList(['\n'])
349 self.input_hist_raw = InputList(['\n'])
350
350
351 # list of visited directories
351 # list of visited directories
352 try:
352 try:
353 self.dir_hist = [os.getcwd()]
353 self.dir_hist = [os.getcwd()]
354 except OSError:
354 except OSError:
355 self.dir_hist = []
355 self.dir_hist = []
356
356
357 # dict of output history
357 # dict of output history
358 self.output_hist = {}
358 self.output_hist = {}
359
359
360 # Get system encoding at startup time. Certain terminals (like Emacs
360 # Get system encoding at startup time. Certain terminals (like Emacs
361 # under Win32 have it set to None, and we need to have a known valid
361 # under Win32 have it set to None, and we need to have a known valid
362 # encoding to use in the raw_input() method
362 # encoding to use in the raw_input() method
363 self.stdin_encoding = sys.stdin.encoding or 'ascii'
363 self.stdin_encoding = sys.stdin.encoding or 'ascii'
364
364
365 # dict of things NOT to alias (keywords, builtins and some magics)
365 # dict of things NOT to alias (keywords, builtins and some magics)
366 no_alias = {}
366 no_alias = {}
367 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
367 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
368 for key in keyword.kwlist + no_alias_magics:
368 for key in keyword.kwlist + no_alias_magics:
369 no_alias[key] = 1
369 no_alias[key] = 1
370 no_alias.update(__builtin__.__dict__)
370 no_alias.update(__builtin__.__dict__)
371 self.no_alias = no_alias
371 self.no_alias = no_alias
372
372
373 # make global variables for user access to these
373 # make global variables for user access to these
374 self.user_ns['_ih'] = self.input_hist
374 self.user_ns['_ih'] = self.input_hist
375 self.user_ns['_oh'] = self.output_hist
375 self.user_ns['_oh'] = self.output_hist
376 self.user_ns['_dh'] = self.dir_hist
376 self.user_ns['_dh'] = self.dir_hist
377
377
378 # user aliases to input and output histories
378 # user aliases to input and output histories
379 self.user_ns['In'] = self.input_hist
379 self.user_ns['In'] = self.input_hist
380 self.user_ns['Out'] = self.output_hist
380 self.user_ns['Out'] = self.output_hist
381
381
382 self.user_ns['_sh'] = IPython.shadowns
382 # Object variable to store code object waiting execution. This is
383 # Object variable to store code object waiting execution. This is
383 # used mainly by the multithreaded shells, but it can come in handy in
384 # used mainly by the multithreaded shells, but it can come in handy in
384 # other situations. No need to use a Queue here, since it's a single
385 # other situations. No need to use a Queue here, since it's a single
385 # item which gets cleared once run.
386 # item which gets cleared once run.
386 self.code_to_run = None
387 self.code_to_run = None
387
388
388 # escapes for automatic behavior on the command line
389 # escapes for automatic behavior on the command line
389 self.ESC_SHELL = '!'
390 self.ESC_SHELL = '!'
390 self.ESC_SH_CAP = '!!'
391 self.ESC_SH_CAP = '!!'
391 self.ESC_HELP = '?'
392 self.ESC_HELP = '?'
392 self.ESC_MAGIC = '%'
393 self.ESC_MAGIC = '%'
393 self.ESC_QUOTE = ','
394 self.ESC_QUOTE = ','
394 self.ESC_QUOTE2 = ';'
395 self.ESC_QUOTE2 = ';'
395 self.ESC_PAREN = '/'
396 self.ESC_PAREN = '/'
396
397
397 # And their associated handlers
398 # And their associated handlers
398 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
399 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
399 self.ESC_QUOTE : self.handle_auto,
400 self.ESC_QUOTE : self.handle_auto,
400 self.ESC_QUOTE2 : self.handle_auto,
401 self.ESC_QUOTE2 : self.handle_auto,
401 self.ESC_MAGIC : self.handle_magic,
402 self.ESC_MAGIC : self.handle_magic,
402 self.ESC_HELP : self.handle_help,
403 self.ESC_HELP : self.handle_help,
403 self.ESC_SHELL : self.handle_shell_escape,
404 self.ESC_SHELL : self.handle_shell_escape,
404 self.ESC_SH_CAP : self.handle_shell_escape,
405 self.ESC_SH_CAP : self.handle_shell_escape,
405 }
406 }
406
407
407 # class initializations
408 # class initializations
408 Magic.__init__(self,self)
409 Magic.__init__(self,self)
409
410
410 # Python source parser/formatter for syntax highlighting
411 # Python source parser/formatter for syntax highlighting
411 pyformat = PyColorize.Parser().format
412 pyformat = PyColorize.Parser().format
412 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
413 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
413
414
414 # hooks holds pointers used for user-side customizations
415 # hooks holds pointers used for user-side customizations
415 self.hooks = Struct()
416 self.hooks = Struct()
416
417
417 self.strdispatchers = {}
418 self.strdispatchers = {}
418
419
419 # Set all default hooks, defined in the IPython.hooks module.
420 # Set all default hooks, defined in the IPython.hooks module.
420 hooks = IPython.hooks
421 hooks = IPython.hooks
421 for hook_name in hooks.__all__:
422 for hook_name in hooks.__all__:
422 # default hooks have priority 100, i.e. low; user hooks should have
423 # default hooks have priority 100, i.e. low; user hooks should have
423 # 0-100 priority
424 # 0-100 priority
424 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
425 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
425 #print "bound hook",hook_name
426 #print "bound hook",hook_name
426
427
427 # Flag to mark unconditional exit
428 # Flag to mark unconditional exit
428 self.exit_now = False
429 self.exit_now = False
429
430
430 self.usage_min = """\
431 self.usage_min = """\
431 An enhanced console for Python.
432 An enhanced console for Python.
432 Some of its features are:
433 Some of its features are:
433 - Readline support if the readline library is present.
434 - Readline support if the readline library is present.
434 - Tab completion in the local namespace.
435 - Tab completion in the local namespace.
435 - Logging of input, see command-line options.
436 - Logging of input, see command-line options.
436 - System shell escape via ! , eg !ls.
437 - System shell escape via ! , eg !ls.
437 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
438 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
438 - Keeps track of locally defined variables via %who, %whos.
439 - Keeps track of locally defined variables via %who, %whos.
439 - Show object information with a ? eg ?x or x? (use ?? for more info).
440 - Show object information with a ? eg ?x or x? (use ?? for more info).
440 """
441 """
441 if usage: self.usage = usage
442 if usage: self.usage = usage
442 else: self.usage = self.usage_min
443 else: self.usage = self.usage_min
443
444
444 # Storage
445 # Storage
445 self.rc = rc # This will hold all configuration information
446 self.rc = rc # This will hold all configuration information
446 self.pager = 'less'
447 self.pager = 'less'
447 # temporary files used for various purposes. Deleted at exit.
448 # temporary files used for various purposes. Deleted at exit.
448 self.tempfiles = []
449 self.tempfiles = []
449
450
450 # Keep track of readline usage (later set by init_readline)
451 # Keep track of readline usage (later set by init_readline)
451 self.has_readline = False
452 self.has_readline = False
452
453
453 # template for logfile headers. It gets resolved at runtime by the
454 # template for logfile headers. It gets resolved at runtime by the
454 # logstart method.
455 # logstart method.
455 self.loghead_tpl = \
456 self.loghead_tpl = \
456 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
457 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
457 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
458 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
458 #log# opts = %s
459 #log# opts = %s
459 #log# args = %s
460 #log# args = %s
460 #log# It is safe to make manual edits below here.
461 #log# It is safe to make manual edits below here.
461 #log#-----------------------------------------------------------------------
462 #log#-----------------------------------------------------------------------
462 """
463 """
463 # for pushd/popd management
464 # for pushd/popd management
464 try:
465 try:
465 self.home_dir = get_home_dir()
466 self.home_dir = get_home_dir()
466 except HomeDirError,msg:
467 except HomeDirError,msg:
467 fatal(msg)
468 fatal(msg)
468
469
469 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
470 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
470
471
471 # Functions to call the underlying shell.
472 # Functions to call the underlying shell.
472
473
473 # The first is similar to os.system, but it doesn't return a value,
474 # The first is similar to os.system, but it doesn't return a value,
474 # and it allows interpolation of variables in the user's namespace.
475 # and it allows interpolation of variables in the user's namespace.
475 self.system = lambda cmd: \
476 self.system = lambda cmd: \
476 shell(self.var_expand(cmd,depth=2),
477 shell(self.var_expand(cmd,depth=2),
477 header=self.rc.system_header,
478 header=self.rc.system_header,
478 verbose=self.rc.system_verbose)
479 verbose=self.rc.system_verbose)
479
480
480 # These are for getoutput and getoutputerror:
481 # These are for getoutput and getoutputerror:
481 self.getoutput = lambda cmd: \
482 self.getoutput = lambda cmd: \
482 getoutput(self.var_expand(cmd,depth=2),
483 getoutput(self.var_expand(cmd,depth=2),
483 header=self.rc.system_header,
484 header=self.rc.system_header,
484 verbose=self.rc.system_verbose)
485 verbose=self.rc.system_verbose)
485
486
486 self.getoutputerror = lambda cmd: \
487 self.getoutputerror = lambda cmd: \
487 getoutputerror(self.var_expand(cmd,depth=2),
488 getoutputerror(self.var_expand(cmd,depth=2),
488 header=self.rc.system_header,
489 header=self.rc.system_header,
489 verbose=self.rc.system_verbose)
490 verbose=self.rc.system_verbose)
490
491
491
492
492 # keep track of where we started running (mainly for crash post-mortem)
493 # keep track of where we started running (mainly for crash post-mortem)
493 self.starting_dir = os.getcwd()
494 self.starting_dir = os.getcwd()
494
495
495 # Various switches which can be set
496 # Various switches which can be set
496 self.CACHELENGTH = 5000 # this is cheap, it's just text
497 self.CACHELENGTH = 5000 # this is cheap, it's just text
497 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
498 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
498 self.banner2 = banner2
499 self.banner2 = banner2
499
500
500 # TraceBack handlers:
501 # TraceBack handlers:
501
502
502 # Syntax error handler.
503 # Syntax error handler.
503 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
504 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
504
505
505 # The interactive one is initialized with an offset, meaning we always
506 # The interactive one is initialized with an offset, meaning we always
506 # want to remove the topmost item in the traceback, which is our own
507 # want to remove the topmost item in the traceback, which is our own
507 # internal code. Valid modes: ['Plain','Context','Verbose']
508 # internal code. Valid modes: ['Plain','Context','Verbose']
508 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
509 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
509 color_scheme='NoColor',
510 color_scheme='NoColor',
510 tb_offset = 1)
511 tb_offset = 1)
511
512
512 # IPython itself shouldn't crash. This will produce a detailed
513 # IPython itself shouldn't crash. This will produce a detailed
513 # post-mortem if it does. But we only install the crash handler for
514 # post-mortem if it does. But we only install the crash handler for
514 # non-threaded shells, the threaded ones use a normal verbose reporter
515 # non-threaded shells, the threaded ones use a normal verbose reporter
515 # and lose the crash handler. This is because exceptions in the main
516 # and lose the crash handler. This is because exceptions in the main
516 # thread (such as in GUI code) propagate directly to sys.excepthook,
517 # thread (such as in GUI code) propagate directly to sys.excepthook,
517 # and there's no point in printing crash dumps for every user exception.
518 # and there's no point in printing crash dumps for every user exception.
518 if self.isthreaded:
519 if self.isthreaded:
519 ipCrashHandler = ultraTB.FormattedTB()
520 ipCrashHandler = ultraTB.FormattedTB()
520 else:
521 else:
521 from IPython import CrashHandler
522 from IPython import CrashHandler
522 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
523 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
523 self.set_crash_handler(ipCrashHandler)
524 self.set_crash_handler(ipCrashHandler)
524
525
525 # and add any custom exception handlers the user may have specified
526 # and add any custom exception handlers the user may have specified
526 self.set_custom_exc(*custom_exceptions)
527 self.set_custom_exc(*custom_exceptions)
527
528
528 # indentation management
529 # indentation management
529 self.autoindent = False
530 self.autoindent = False
530 self.indent_current_nsp = 0
531 self.indent_current_nsp = 0
531
532
532 # Make some aliases automatically
533 # Make some aliases automatically
533 # Prepare list of shell aliases to auto-define
534 # Prepare list of shell aliases to auto-define
534 if os.name == 'posix':
535 if os.name == 'posix':
535 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
536 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
536 'mv mv -i','rm rm -i','cp cp -i',
537 'mv mv -i','rm rm -i','cp cp -i',
537 'cat cat','less less','clear clear',
538 'cat cat','less less','clear clear',
538 # a better ls
539 # a better ls
539 'ls ls -F',
540 'ls ls -F',
540 # long ls
541 # long ls
541 'll ls -lF')
542 'll ls -lF')
542 # Extra ls aliases with color, which need special treatment on BSD
543 # Extra ls aliases with color, which need special treatment on BSD
543 # variants
544 # variants
544 ls_extra = ( # color ls
545 ls_extra = ( # color ls
545 'lc ls -F -o --color',
546 'lc ls -F -o --color',
546 # ls normal files only
547 # ls normal files only
547 'lf ls -F -o --color %l | grep ^-',
548 'lf ls -F -o --color %l | grep ^-',
548 # ls symbolic links
549 # ls symbolic links
549 'lk ls -F -o --color %l | grep ^l',
550 'lk ls -F -o --color %l | grep ^l',
550 # directories or links to directories,
551 # directories or links to directories,
551 'ldir ls -F -o --color %l | grep /$',
552 'ldir ls -F -o --color %l | grep /$',
552 # things which are executable
553 # things which are executable
553 'lx ls -F -o --color %l | grep ^-..x',
554 'lx ls -F -o --color %l | grep ^-..x',
554 )
555 )
555 # The BSDs don't ship GNU ls, so they don't understand the
556 # The BSDs don't ship GNU ls, so they don't understand the
556 # --color switch out of the box
557 # --color switch out of the box
557 if 'bsd' in sys.platform:
558 if 'bsd' in sys.platform:
558 ls_extra = ( # ls normal files only
559 ls_extra = ( # ls normal files only
559 'lf ls -lF | grep ^-',
560 'lf ls -lF | grep ^-',
560 # ls symbolic links
561 # ls symbolic links
561 'lk ls -lF | grep ^l',
562 'lk ls -lF | grep ^l',
562 # directories or links to directories,
563 # directories or links to directories,
563 'ldir ls -lF | grep /$',
564 'ldir ls -lF | grep /$',
564 # things which are executable
565 # things which are executable
565 'lx ls -lF | grep ^-..x',
566 'lx ls -lF | grep ^-..x',
566 )
567 )
567 auto_alias = auto_alias + ls_extra
568 auto_alias = auto_alias + ls_extra
568 elif os.name in ['nt','dos']:
569 elif os.name in ['nt','dos']:
569 auto_alias = ('dir dir /on', 'ls dir /on',
570 auto_alias = ('dir dir /on', 'ls dir /on',
570 'ddir dir /ad /on', 'ldir dir /ad /on',
571 'ddir dir /ad /on', 'ldir dir /ad /on',
571 'mkdir mkdir','rmdir rmdir','echo echo',
572 'mkdir mkdir','rmdir rmdir','echo echo',
572 'ren ren','cls cls','copy copy')
573 'ren ren','cls cls','copy copy')
573 else:
574 else:
574 auto_alias = ()
575 auto_alias = ()
575 self.auto_alias = [s.split(None,1) for s in auto_alias]
576 self.auto_alias = [s.split(None,1) for s in auto_alias]
576 # Call the actual (public) initializer
577 # Call the actual (public) initializer
577 self.init_auto_alias()
578 self.init_auto_alias()
578
579
579 # Produce a public API instance
580 # Produce a public API instance
580 self.api = IPython.ipapi.IPApi(self)
581 self.api = IPython.ipapi.IPApi(self)
581
582
582 # track which builtins we add, so we can clean up later
583 # track which builtins we add, so we can clean up later
583 self.builtins_added = {}
584 self.builtins_added = {}
584 # This method will add the necessary builtins for operation, but
585 # This method will add the necessary builtins for operation, but
585 # tracking what it did via the builtins_added dict.
586 # tracking what it did via the builtins_added dict.
586 self.add_builtins()
587 self.add_builtins()
587
588
588 # end __init__
589 # end __init__
589
590
590 def var_expand(self,cmd,depth=0):
591 def var_expand(self,cmd,depth=0):
591 """Expand python variables in a string.
592 """Expand python variables in a string.
592
593
593 The depth argument indicates how many frames above the caller should
594 The depth argument indicates how many frames above the caller should
594 be walked to look for the local namespace where to expand variables.
595 be walked to look for the local namespace where to expand variables.
595
596
596 The global namespace for expansion is always the user's interactive
597 The global namespace for expansion is always the user's interactive
597 namespace.
598 namespace.
598 """
599 """
599
600
600 return str(ItplNS(cmd.replace('#','\#'),
601 return str(ItplNS(cmd.replace('#','\#'),
601 self.user_ns, # globals
602 self.user_ns, # globals
602 # Skip our own frame in searching for locals:
603 # Skip our own frame in searching for locals:
603 sys._getframe(depth+1).f_locals # locals
604 sys._getframe(depth+1).f_locals # locals
604 ))
605 ))
605
606
606 def pre_config_initialization(self):
607 def pre_config_initialization(self):
607 """Pre-configuration init method
608 """Pre-configuration init method
608
609
609 This is called before the configuration files are processed to
610 This is called before the configuration files are processed to
610 prepare the services the config files might need.
611 prepare the services the config files might need.
611
612
612 self.rc already has reasonable default values at this point.
613 self.rc already has reasonable default values at this point.
613 """
614 """
614 rc = self.rc
615 rc = self.rc
615 try:
616 try:
616 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
617 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
617 except exceptions.UnicodeDecodeError:
618 except exceptions.UnicodeDecodeError:
618 print "Your ipythondir can't be decoded to unicode!"
619 print "Your ipythondir can't be decoded to unicode!"
619 print "Please set HOME environment variable to something that"
620 print "Please set HOME environment variable to something that"
620 print r"only has ASCII characters, e.g. c:\home"
621 print r"only has ASCII characters, e.g. c:\home"
621 print "Now it is",rc.ipythondir
622 print "Now it is",rc.ipythondir
622 sys.exit()
623 sys.exit()
623 self.shadowhist = IPython.history.ShadowHist(self.db)
624 self.shadowhist = IPython.history.ShadowHist(self.db)
624
625
625
626
626 def post_config_initialization(self):
627 def post_config_initialization(self):
627 """Post configuration init method
628 """Post configuration init method
628
629
629 This is called after the configuration files have been processed to
630 This is called after the configuration files have been processed to
630 'finalize' the initialization."""
631 'finalize' the initialization."""
631
632
632 rc = self.rc
633 rc = self.rc
633
634
634 # Object inspector
635 # Object inspector
635 self.inspector = OInspect.Inspector(OInspect.InspectColors,
636 self.inspector = OInspect.Inspector(OInspect.InspectColors,
636 PyColorize.ANSICodeColors,
637 PyColorize.ANSICodeColors,
637 'NoColor',
638 'NoColor',
638 rc.object_info_string_level)
639 rc.object_info_string_level)
639
640
640 self.rl_next_input = None
641 self.rl_next_input = None
641 self.rl_do_indent = False
642 self.rl_do_indent = False
642 # Load readline proper
643 # Load readline proper
643 if rc.readline:
644 if rc.readline:
644 self.init_readline()
645 self.init_readline()
645
646
646
647
647 # local shortcut, this is used a LOT
648 # local shortcut, this is used a LOT
648 self.log = self.logger.log
649 self.log = self.logger.log
649
650
650 # Initialize cache, set in/out prompts and printing system
651 # Initialize cache, set in/out prompts and printing system
651 self.outputcache = CachedOutput(self,
652 self.outputcache = CachedOutput(self,
652 rc.cache_size,
653 rc.cache_size,
653 rc.pprint,
654 rc.pprint,
654 input_sep = rc.separate_in,
655 input_sep = rc.separate_in,
655 output_sep = rc.separate_out,
656 output_sep = rc.separate_out,
656 output_sep2 = rc.separate_out2,
657 output_sep2 = rc.separate_out2,
657 ps1 = rc.prompt_in1,
658 ps1 = rc.prompt_in1,
658 ps2 = rc.prompt_in2,
659 ps2 = rc.prompt_in2,
659 ps_out = rc.prompt_out,
660 ps_out = rc.prompt_out,
660 pad_left = rc.prompts_pad_left)
661 pad_left = rc.prompts_pad_left)
661
662
662 # user may have over-ridden the default print hook:
663 # user may have over-ridden the default print hook:
663 try:
664 try:
664 self.outputcache.__class__.display = self.hooks.display
665 self.outputcache.__class__.display = self.hooks.display
665 except AttributeError:
666 except AttributeError:
666 pass
667 pass
667
668
668 # I don't like assigning globally to sys, because it means when
669 # I don't like assigning globally to sys, because it means when
669 # embedding instances, each embedded instance overrides the previous
670 # embedding instances, each embedded instance overrides the previous
670 # choice. But sys.displayhook seems to be called internally by exec,
671 # choice. But sys.displayhook seems to be called internally by exec,
671 # so I don't see a way around it. We first save the original and then
672 # so I don't see a way around it. We first save the original and then
672 # overwrite it.
673 # overwrite it.
673 self.sys_displayhook = sys.displayhook
674 self.sys_displayhook = sys.displayhook
674 sys.displayhook = self.outputcache
675 sys.displayhook = self.outputcache
675
676
676 # Set user colors (don't do it in the constructor above so that it
677 # Set user colors (don't do it in the constructor above so that it
677 # doesn't crash if colors option is invalid)
678 # doesn't crash if colors option is invalid)
678 self.magic_colors(rc.colors)
679 self.magic_colors(rc.colors)
679
680
680 # Set calling of pdb on exceptions
681 # Set calling of pdb on exceptions
681 self.call_pdb = rc.pdb
682 self.call_pdb = rc.pdb
682
683
683 # Load user aliases
684 # Load user aliases
684 for alias in rc.alias:
685 for alias in rc.alias:
685 self.magic_alias(alias)
686 self.magic_alias(alias)
686 self.hooks.late_startup_hook()
687 self.hooks.late_startup_hook()
687
688
688 batchrun = False
689 batchrun = False
689 for batchfile in [path(arg) for arg in self.rc.args
690 for batchfile in [path(arg) for arg in self.rc.args
690 if arg.lower().endswith('.ipy')]:
691 if arg.lower().endswith('.ipy')]:
691 if not batchfile.isfile():
692 if not batchfile.isfile():
692 print "No such batch file:", batchfile
693 print "No such batch file:", batchfile
693 continue
694 continue
694 self.api.runlines(batchfile.text())
695 self.api.runlines(batchfile.text())
695 batchrun = True
696 batchrun = True
696 if batchrun:
697 if batchrun:
697 self.exit_now = True
698 self.exit_now = True
698
699
699 def add_builtins(self):
700 def add_builtins(self):
700 """Store ipython references into the builtin namespace.
701 """Store ipython references into the builtin namespace.
701
702
702 Some parts of ipython operate via builtins injected here, which hold a
703 Some parts of ipython operate via builtins injected here, which hold a
703 reference to IPython itself."""
704 reference to IPython itself."""
704
705
705 # TODO: deprecate all except _ip; 'jobs' should be installed
706 # TODO: deprecate all except _ip; 'jobs' should be installed
706 # by an extension and the rest are under _ip, ipalias is redundant
707 # by an extension and the rest are under _ip, ipalias is redundant
707 builtins_new = dict(__IPYTHON__ = self,
708 builtins_new = dict(__IPYTHON__ = self,
708 ip_set_hook = self.set_hook,
709 ip_set_hook = self.set_hook,
709 jobs = self.jobs,
710 jobs = self.jobs,
710 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
711 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
711 ipalias = wrap_deprecated(self.ipalias),
712 ipalias = wrap_deprecated(self.ipalias),
712 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
713 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
713 _ip = self.api
714 _ip = self.api
714 )
715 )
715 for biname,bival in builtins_new.items():
716 for biname,bival in builtins_new.items():
716 try:
717 try:
717 # store the orignal value so we can restore it
718 # store the orignal value so we can restore it
718 self.builtins_added[biname] = __builtin__.__dict__[biname]
719 self.builtins_added[biname] = __builtin__.__dict__[biname]
719 except KeyError:
720 except KeyError:
720 # or mark that it wasn't defined, and we'll just delete it at
721 # or mark that it wasn't defined, and we'll just delete it at
721 # cleanup
722 # cleanup
722 self.builtins_added[biname] = Undefined
723 self.builtins_added[biname] = Undefined
723 __builtin__.__dict__[biname] = bival
724 __builtin__.__dict__[biname] = bival
724
725
725 # Keep in the builtins a flag for when IPython is active. We set it
726 # Keep in the builtins a flag for when IPython is active. We set it
726 # with setdefault so that multiple nested IPythons don't clobber one
727 # with setdefault so that multiple nested IPythons don't clobber one
727 # another. Each will increase its value by one upon being activated,
728 # another. Each will increase its value by one upon being activated,
728 # which also gives us a way to determine the nesting level.
729 # which also gives us a way to determine the nesting level.
729 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
730 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
730
731
731 def clean_builtins(self):
732 def clean_builtins(self):
732 """Remove any builtins which might have been added by add_builtins, or
733 """Remove any builtins which might have been added by add_builtins, or
733 restore overwritten ones to their previous values."""
734 restore overwritten ones to their previous values."""
734 for biname,bival in self.builtins_added.items():
735 for biname,bival in self.builtins_added.items():
735 if bival is Undefined:
736 if bival is Undefined:
736 del __builtin__.__dict__[biname]
737 del __builtin__.__dict__[biname]
737 else:
738 else:
738 __builtin__.__dict__[biname] = bival
739 __builtin__.__dict__[biname] = bival
739 self.builtins_added.clear()
740 self.builtins_added.clear()
740
741
741 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
742 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
742 """set_hook(name,hook) -> sets an internal IPython hook.
743 """set_hook(name,hook) -> sets an internal IPython hook.
743
744
744 IPython exposes some of its internal API as user-modifiable hooks. By
745 IPython exposes some of its internal API as user-modifiable hooks. By
745 adding your function to one of these hooks, you can modify IPython's
746 adding your function to one of these hooks, you can modify IPython's
746 behavior to call at runtime your own routines."""
747 behavior to call at runtime your own routines."""
747
748
748 # At some point in the future, this should validate the hook before it
749 # At some point in the future, this should validate the hook before it
749 # accepts it. Probably at least check that the hook takes the number
750 # accepts it. Probably at least check that the hook takes the number
750 # of args it's supposed to.
751 # of args it's supposed to.
751
752
752 f = new.instancemethod(hook,self,self.__class__)
753 f = new.instancemethod(hook,self,self.__class__)
753
754
754 # check if the hook is for strdispatcher first
755 # check if the hook is for strdispatcher first
755 if str_key is not None:
756 if str_key is not None:
756 sdp = self.strdispatchers.get(name, StrDispatch())
757 sdp = self.strdispatchers.get(name, StrDispatch())
757 sdp.add_s(str_key, f, priority )
758 sdp.add_s(str_key, f, priority )
758 self.strdispatchers[name] = sdp
759 self.strdispatchers[name] = sdp
759 return
760 return
760 if re_key is not None:
761 if re_key is not None:
761 sdp = self.strdispatchers.get(name, StrDispatch())
762 sdp = self.strdispatchers.get(name, StrDispatch())
762 sdp.add_re(re.compile(re_key), f, priority )
763 sdp.add_re(re.compile(re_key), f, priority )
763 self.strdispatchers[name] = sdp
764 self.strdispatchers[name] = sdp
764 return
765 return
765
766
766 dp = getattr(self.hooks, name, None)
767 dp = getattr(self.hooks, name, None)
767 if name not in IPython.hooks.__all__:
768 if name not in IPython.hooks.__all__:
768 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
769 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
769 if not dp:
770 if not dp:
770 dp = IPython.hooks.CommandChainDispatcher()
771 dp = IPython.hooks.CommandChainDispatcher()
771
772
772 try:
773 try:
773 dp.add(f,priority)
774 dp.add(f,priority)
774 except AttributeError:
775 except AttributeError:
775 # it was not commandchain, plain old func - replace
776 # it was not commandchain, plain old func - replace
776 dp = f
777 dp = f
777
778
778 setattr(self.hooks,name, dp)
779 setattr(self.hooks,name, dp)
779
780
780
781
781 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
782 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
782
783
783 def set_crash_handler(self,crashHandler):
784 def set_crash_handler(self,crashHandler):
784 """Set the IPython crash handler.
785 """Set the IPython crash handler.
785
786
786 This must be a callable with a signature suitable for use as
787 This must be a callable with a signature suitable for use as
787 sys.excepthook."""
788 sys.excepthook."""
788
789
789 # Install the given crash handler as the Python exception hook
790 # Install the given crash handler as the Python exception hook
790 sys.excepthook = crashHandler
791 sys.excepthook = crashHandler
791
792
792 # The instance will store a pointer to this, so that runtime code
793 # The instance will store a pointer to this, so that runtime code
793 # (such as magics) can access it. This is because during the
794 # (such as magics) can access it. This is because during the
794 # read-eval loop, it gets temporarily overwritten (to deal with GUI
795 # read-eval loop, it gets temporarily overwritten (to deal with GUI
795 # frameworks).
796 # frameworks).
796 self.sys_excepthook = sys.excepthook
797 self.sys_excepthook = sys.excepthook
797
798
798
799
799 def set_custom_exc(self,exc_tuple,handler):
800 def set_custom_exc(self,exc_tuple,handler):
800 """set_custom_exc(exc_tuple,handler)
801 """set_custom_exc(exc_tuple,handler)
801
802
802 Set a custom exception handler, which will be called if any of the
803 Set a custom exception handler, which will be called if any of the
803 exceptions in exc_tuple occur in the mainloop (specifically, in the
804 exceptions in exc_tuple occur in the mainloop (specifically, in the
804 runcode() method.
805 runcode() method.
805
806
806 Inputs:
807 Inputs:
807
808
808 - exc_tuple: a *tuple* of valid exceptions to call the defined
809 - exc_tuple: a *tuple* of valid exceptions to call the defined
809 handler for. It is very important that you use a tuple, and NOT A
810 handler for. It is very important that you use a tuple, and NOT A
810 LIST here, because of the way Python's except statement works. If
811 LIST here, because of the way Python's except statement works. If
811 you only want to trap a single exception, use a singleton tuple:
812 you only want to trap a single exception, use a singleton tuple:
812
813
813 exc_tuple == (MyCustomException,)
814 exc_tuple == (MyCustomException,)
814
815
815 - handler: this must be defined as a function with the following
816 - handler: this must be defined as a function with the following
816 basic interface: def my_handler(self,etype,value,tb).
817 basic interface: def my_handler(self,etype,value,tb).
817
818
818 This will be made into an instance method (via new.instancemethod)
819 This will be made into an instance method (via new.instancemethod)
819 of IPython itself, and it will be called if any of the exceptions
820 of IPython itself, and it will be called if any of the exceptions
820 listed in the exc_tuple are caught. If the handler is None, an
821 listed in the exc_tuple are caught. If the handler is None, an
821 internal basic one is used, which just prints basic info.
822 internal basic one is used, which just prints basic info.
822
823
823 WARNING: by putting in your own exception handler into IPython's main
824 WARNING: by putting in your own exception handler into IPython's main
824 execution loop, you run a very good chance of nasty crashes. This
825 execution loop, you run a very good chance of nasty crashes. This
825 facility should only be used if you really know what you are doing."""
826 facility should only be used if you really know what you are doing."""
826
827
827 assert type(exc_tuple)==type(()) , \
828 assert type(exc_tuple)==type(()) , \
828 "The custom exceptions must be given AS A TUPLE."
829 "The custom exceptions must be given AS A TUPLE."
829
830
830 def dummy_handler(self,etype,value,tb):
831 def dummy_handler(self,etype,value,tb):
831 print '*** Simple custom exception handler ***'
832 print '*** Simple custom exception handler ***'
832 print 'Exception type :',etype
833 print 'Exception type :',etype
833 print 'Exception value:',value
834 print 'Exception value:',value
834 print 'Traceback :',tb
835 print 'Traceback :',tb
835 print 'Source code :','\n'.join(self.buffer)
836 print 'Source code :','\n'.join(self.buffer)
836
837
837 if handler is None: handler = dummy_handler
838 if handler is None: handler = dummy_handler
838
839
839 self.CustomTB = new.instancemethod(handler,self,self.__class__)
840 self.CustomTB = new.instancemethod(handler,self,self.__class__)
840 self.custom_exceptions = exc_tuple
841 self.custom_exceptions = exc_tuple
841
842
842 def set_custom_completer(self,completer,pos=0):
843 def set_custom_completer(self,completer,pos=0):
843 """set_custom_completer(completer,pos=0)
844 """set_custom_completer(completer,pos=0)
844
845
845 Adds a new custom completer function.
846 Adds a new custom completer function.
846
847
847 The position argument (defaults to 0) is the index in the completers
848 The position argument (defaults to 0) is the index in the completers
848 list where you want the completer to be inserted."""
849 list where you want the completer to be inserted."""
849
850
850 newcomp = new.instancemethod(completer,self.Completer,
851 newcomp = new.instancemethod(completer,self.Completer,
851 self.Completer.__class__)
852 self.Completer.__class__)
852 self.Completer.matchers.insert(pos,newcomp)
853 self.Completer.matchers.insert(pos,newcomp)
853
854
854 def set_completer(self):
855 def set_completer(self):
855 """reset readline's completer to be our own."""
856 """reset readline's completer to be our own."""
856 self.readline.set_completer(self.Completer.complete)
857 self.readline.set_completer(self.Completer.complete)
857
858
858 def _get_call_pdb(self):
859 def _get_call_pdb(self):
859 return self._call_pdb
860 return self._call_pdb
860
861
861 def _set_call_pdb(self,val):
862 def _set_call_pdb(self,val):
862
863
863 if val not in (0,1,False,True):
864 if val not in (0,1,False,True):
864 raise ValueError,'new call_pdb value must be boolean'
865 raise ValueError,'new call_pdb value must be boolean'
865
866
866 # store value in instance
867 # store value in instance
867 self._call_pdb = val
868 self._call_pdb = val
868
869
869 # notify the actual exception handlers
870 # notify the actual exception handlers
870 self.InteractiveTB.call_pdb = val
871 self.InteractiveTB.call_pdb = val
871 if self.isthreaded:
872 if self.isthreaded:
872 try:
873 try:
873 self.sys_excepthook.call_pdb = val
874 self.sys_excepthook.call_pdb = val
874 except:
875 except:
875 warn('Failed to activate pdb for threaded exception handler')
876 warn('Failed to activate pdb for threaded exception handler')
876
877
877 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
878 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
878 'Control auto-activation of pdb at exceptions')
879 'Control auto-activation of pdb at exceptions')
879
880
880
881
881 # These special functions get installed in the builtin namespace, to
882 # These special functions get installed in the builtin namespace, to
882 # provide programmatic (pure python) access to magics, aliases and system
883 # provide programmatic (pure python) access to magics, aliases and system
883 # calls. This is important for logging, user scripting, and more.
884 # calls. This is important for logging, user scripting, and more.
884
885
885 # We are basically exposing, via normal python functions, the three
886 # We are basically exposing, via normal python functions, the three
886 # mechanisms in which ipython offers special call modes (magics for
887 # mechanisms in which ipython offers special call modes (magics for
887 # internal control, aliases for direct system access via pre-selected
888 # internal control, aliases for direct system access via pre-selected
888 # names, and !cmd for calling arbitrary system commands).
889 # names, and !cmd for calling arbitrary system commands).
889
890
890 def ipmagic(self,arg_s):
891 def ipmagic(self,arg_s):
891 """Call a magic function by name.
892 """Call a magic function by name.
892
893
893 Input: a string containing the name of the magic function to call and any
894 Input: a string containing the name of the magic function to call and any
894 additional arguments to be passed to the magic.
895 additional arguments to be passed to the magic.
895
896
896 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
897 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
897 prompt:
898 prompt:
898
899
899 In[1]: %name -opt foo bar
900 In[1]: %name -opt foo bar
900
901
901 To call a magic without arguments, simply use ipmagic('name').
902 To call a magic without arguments, simply use ipmagic('name').
902
903
903 This provides a proper Python function to call IPython's magics in any
904 This provides a proper Python function to call IPython's magics in any
904 valid Python code you can type at the interpreter, including loops and
905 valid Python code you can type at the interpreter, including loops and
905 compound statements. It is added by IPython to the Python builtin
906 compound statements. It is added by IPython to the Python builtin
906 namespace upon initialization."""
907 namespace upon initialization."""
907
908
908 args = arg_s.split(' ',1)
909 args = arg_s.split(' ',1)
909 magic_name = args[0]
910 magic_name = args[0]
910 magic_name = magic_name.lstrip(self.ESC_MAGIC)
911 magic_name = magic_name.lstrip(self.ESC_MAGIC)
911
912
912 try:
913 try:
913 magic_args = args[1]
914 magic_args = args[1]
914 except IndexError:
915 except IndexError:
915 magic_args = ''
916 magic_args = ''
916 fn = getattr(self,'magic_'+magic_name,None)
917 fn = getattr(self,'magic_'+magic_name,None)
917 if fn is None:
918 if fn is None:
918 error("Magic function `%s` not found." % magic_name)
919 error("Magic function `%s` not found." % magic_name)
919 else:
920 else:
920 magic_args = self.var_expand(magic_args,1)
921 magic_args = self.var_expand(magic_args,1)
921 return fn(magic_args)
922 return fn(magic_args)
922
923
923 def ipalias(self,arg_s):
924 def ipalias(self,arg_s):
924 """Call an alias by name.
925 """Call an alias by name.
925
926
926 Input: a string containing the name of the alias to call and any
927 Input: a string containing the name of the alias to call and any
927 additional arguments to be passed to the magic.
928 additional arguments to be passed to the magic.
928
929
929 ipalias('name -opt foo bar') is equivalent to typing at the ipython
930 ipalias('name -opt foo bar') is equivalent to typing at the ipython
930 prompt:
931 prompt:
931
932
932 In[1]: name -opt foo bar
933 In[1]: name -opt foo bar
933
934
934 To call an alias without arguments, simply use ipalias('name').
935 To call an alias without arguments, simply use ipalias('name').
935
936
936 This provides a proper Python function to call IPython's aliases in any
937 This provides a proper Python function to call IPython's aliases in any
937 valid Python code you can type at the interpreter, including loops and
938 valid Python code you can type at the interpreter, including loops and
938 compound statements. It is added by IPython to the Python builtin
939 compound statements. It is added by IPython to the Python builtin
939 namespace upon initialization."""
940 namespace upon initialization."""
940
941
941 args = arg_s.split(' ',1)
942 args = arg_s.split(' ',1)
942 alias_name = args[0]
943 alias_name = args[0]
943 try:
944 try:
944 alias_args = args[1]
945 alias_args = args[1]
945 except IndexError:
946 except IndexError:
946 alias_args = ''
947 alias_args = ''
947 if alias_name in self.alias_table:
948 if alias_name in self.alias_table:
948 self.call_alias(alias_name,alias_args)
949 self.call_alias(alias_name,alias_args)
949 else:
950 else:
950 error("Alias `%s` not found." % alias_name)
951 error("Alias `%s` not found." % alias_name)
951
952
952 def ipsystem(self,arg_s):
953 def ipsystem(self,arg_s):
953 """Make a system call, using IPython."""
954 """Make a system call, using IPython."""
954
955
955 self.system(arg_s)
956 self.system(arg_s)
956
957
957 def complete(self,text):
958 def complete(self,text):
958 """Return a sorted list of all possible completions on text.
959 """Return a sorted list of all possible completions on text.
959
960
960 Inputs:
961 Inputs:
961
962
962 - text: a string of text to be completed on.
963 - text: a string of text to be completed on.
963
964
964 This is a wrapper around the completion mechanism, similar to what
965 This is a wrapper around the completion mechanism, similar to what
965 readline does at the command line when the TAB key is hit. By
966 readline does at the command line when the TAB key is hit. By
966 exposing it as a method, it can be used by other non-readline
967 exposing it as a method, it can be used by other non-readline
967 environments (such as GUIs) for text completion.
968 environments (such as GUIs) for text completion.
968
969
969 Simple usage example:
970 Simple usage example:
970
971
971 In [1]: x = 'hello'
972 In [1]: x = 'hello'
972
973
973 In [2]: __IP.complete('x.l')
974 In [2]: __IP.complete('x.l')
974 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
975 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
975
976
976 complete = self.Completer.complete
977 complete = self.Completer.complete
977 state = 0
978 state = 0
978 # use a dict so we get unique keys, since ipyhton's multiple
979 # use a dict so we get unique keys, since ipyhton's multiple
979 # completers can return duplicates. When we make 2.4 a requirement,
980 # completers can return duplicates. When we make 2.4 a requirement,
980 # start using sets instead, which are faster.
981 # start using sets instead, which are faster.
981 comps = {}
982 comps = {}
982 while True:
983 while True:
983 newcomp = complete(text,state,line_buffer=text)
984 newcomp = complete(text,state,line_buffer=text)
984 if newcomp is None:
985 if newcomp is None:
985 break
986 break
986 comps[newcomp] = 1
987 comps[newcomp] = 1
987 state += 1
988 state += 1
988 outcomps = comps.keys()
989 outcomps = comps.keys()
989 outcomps.sort()
990 outcomps.sort()
990 return outcomps
991 return outcomps
991
992
992 def set_completer_frame(self, frame=None):
993 def set_completer_frame(self, frame=None):
993 if frame:
994 if frame:
994 self.Completer.namespace = frame.f_locals
995 self.Completer.namespace = frame.f_locals
995 self.Completer.global_namespace = frame.f_globals
996 self.Completer.global_namespace = frame.f_globals
996 else:
997 else:
997 self.Completer.namespace = self.user_ns
998 self.Completer.namespace = self.user_ns
998 self.Completer.global_namespace = self.user_global_ns
999 self.Completer.global_namespace = self.user_global_ns
999
1000
1000 def init_auto_alias(self):
1001 def init_auto_alias(self):
1001 """Define some aliases automatically.
1002 """Define some aliases automatically.
1002
1003
1003 These are ALL parameter-less aliases"""
1004 These are ALL parameter-less aliases"""
1004
1005
1005 for alias,cmd in self.auto_alias:
1006 for alias,cmd in self.auto_alias:
1006 self.alias_table[alias] = (0,cmd)
1007 self.alias_table[alias] = (0,cmd)
1007
1008
1008 def alias_table_validate(self,verbose=0):
1009 def alias_table_validate(self,verbose=0):
1009 """Update information about the alias table.
1010 """Update information about the alias table.
1010
1011
1011 In particular, make sure no Python keywords/builtins are in it."""
1012 In particular, make sure no Python keywords/builtins are in it."""
1012
1013
1013 no_alias = self.no_alias
1014 no_alias = self.no_alias
1014 for k in self.alias_table.keys():
1015 for k in self.alias_table.keys():
1015 if k in no_alias:
1016 if k in no_alias:
1016 del self.alias_table[k]
1017 del self.alias_table[k]
1017 if verbose:
1018 if verbose:
1018 print ("Deleting alias <%s>, it's a Python "
1019 print ("Deleting alias <%s>, it's a Python "
1019 "keyword or builtin." % k)
1020 "keyword or builtin." % k)
1020
1021
1021 def set_autoindent(self,value=None):
1022 def set_autoindent(self,value=None):
1022 """Set the autoindent flag, checking for readline support.
1023 """Set the autoindent flag, checking for readline support.
1023
1024
1024 If called with no arguments, it acts as a toggle."""
1025 If called with no arguments, it acts as a toggle."""
1025
1026
1026 if not self.has_readline:
1027 if not self.has_readline:
1027 if os.name == 'posix':
1028 if os.name == 'posix':
1028 warn("The auto-indent feature requires the readline library")
1029 warn("The auto-indent feature requires the readline library")
1029 self.autoindent = 0
1030 self.autoindent = 0
1030 return
1031 return
1031 if value is None:
1032 if value is None:
1032 self.autoindent = not self.autoindent
1033 self.autoindent = not self.autoindent
1033 else:
1034 else:
1034 self.autoindent = value
1035 self.autoindent = value
1035
1036
1036 def rc_set_toggle(self,rc_field,value=None):
1037 def rc_set_toggle(self,rc_field,value=None):
1037 """Set or toggle a field in IPython's rc config. structure.
1038 """Set or toggle a field in IPython's rc config. structure.
1038
1039
1039 If called with no arguments, it acts as a toggle.
1040 If called with no arguments, it acts as a toggle.
1040
1041
1041 If called with a non-existent field, the resulting AttributeError
1042 If called with a non-existent field, the resulting AttributeError
1042 exception will propagate out."""
1043 exception will propagate out."""
1043
1044
1044 rc_val = getattr(self.rc,rc_field)
1045 rc_val = getattr(self.rc,rc_field)
1045 if value is None:
1046 if value is None:
1046 value = not rc_val
1047 value = not rc_val
1047 setattr(self.rc,rc_field,value)
1048 setattr(self.rc,rc_field,value)
1048
1049
1049 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1050 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1050 """Install the user configuration directory.
1051 """Install the user configuration directory.
1051
1052
1052 Can be called when running for the first time or to upgrade the user's
1053 Can be called when running for the first time or to upgrade the user's
1053 .ipython/ directory with the mode parameter. Valid modes are 'install'
1054 .ipython/ directory with the mode parameter. Valid modes are 'install'
1054 and 'upgrade'."""
1055 and 'upgrade'."""
1055
1056
1056 def wait():
1057 def wait():
1057 try:
1058 try:
1058 raw_input("Please press <RETURN> to start IPython.")
1059 raw_input("Please press <RETURN> to start IPython.")
1059 except EOFError:
1060 except EOFError:
1060 print >> Term.cout
1061 print >> Term.cout
1061 print '*'*70
1062 print '*'*70
1062
1063
1063 cwd = os.getcwd() # remember where we started
1064 cwd = os.getcwd() # remember where we started
1064 glb = glob.glob
1065 glb = glob.glob
1065 print '*'*70
1066 print '*'*70
1066 if mode == 'install':
1067 if mode == 'install':
1067 print \
1068 print \
1068 """Welcome to IPython. I will try to create a personal configuration directory
1069 """Welcome to IPython. I will try to create a personal configuration directory
1069 where you can customize many aspects of IPython's functionality in:\n"""
1070 where you can customize many aspects of IPython's functionality in:\n"""
1070 else:
1071 else:
1071 print 'I am going to upgrade your configuration in:'
1072 print 'I am going to upgrade your configuration in:'
1072
1073
1073 print ipythondir
1074 print ipythondir
1074
1075
1075 rcdirend = os.path.join('IPython','UserConfig')
1076 rcdirend = os.path.join('IPython','UserConfig')
1076 cfg = lambda d: os.path.join(d,rcdirend)
1077 cfg = lambda d: os.path.join(d,rcdirend)
1077 try:
1078 try:
1078 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1079 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1079 except IOError:
1080 except IOError:
1080 warning = """
1081 warning = """
1081 Installation error. IPython's directory was not found.
1082 Installation error. IPython's directory was not found.
1082
1083
1083 Check the following:
1084 Check the following:
1084
1085
1085 The ipython/IPython directory should be in a directory belonging to your
1086 The ipython/IPython directory should be in a directory belonging to your
1086 PYTHONPATH environment variable (that is, it should be in a directory
1087 PYTHONPATH environment variable (that is, it should be in a directory
1087 belonging to sys.path). You can copy it explicitly there or just link to it.
1088 belonging to sys.path). You can copy it explicitly there or just link to it.
1088
1089
1089 IPython will proceed with builtin defaults.
1090 IPython will proceed with builtin defaults.
1090 """
1091 """
1091 warn(warning)
1092 warn(warning)
1092 wait()
1093 wait()
1093 return
1094 return
1094
1095
1095 if mode == 'install':
1096 if mode == 'install':
1096 try:
1097 try:
1097 shutil.copytree(rcdir,ipythondir)
1098 shutil.copytree(rcdir,ipythondir)
1098 os.chdir(ipythondir)
1099 os.chdir(ipythondir)
1099 rc_files = glb("ipythonrc*")
1100 rc_files = glb("ipythonrc*")
1100 for rc_file in rc_files:
1101 for rc_file in rc_files:
1101 os.rename(rc_file,rc_file+rc_suffix)
1102 os.rename(rc_file,rc_file+rc_suffix)
1102 except:
1103 except:
1103 warning = """
1104 warning = """
1104
1105
1105 There was a problem with the installation:
1106 There was a problem with the installation:
1106 %s
1107 %s
1107 Try to correct it or contact the developers if you think it's a bug.
1108 Try to correct it or contact the developers if you think it's a bug.
1108 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1109 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1109 warn(warning)
1110 warn(warning)
1110 wait()
1111 wait()
1111 return
1112 return
1112
1113
1113 elif mode == 'upgrade':
1114 elif mode == 'upgrade':
1114 try:
1115 try:
1115 os.chdir(ipythondir)
1116 os.chdir(ipythondir)
1116 except:
1117 except:
1117 print """
1118 print """
1118 Can not upgrade: changing to directory %s failed. Details:
1119 Can not upgrade: changing to directory %s failed. Details:
1119 %s
1120 %s
1120 """ % (ipythondir,sys.exc_info()[1])
1121 """ % (ipythondir,sys.exc_info()[1])
1121 wait()
1122 wait()
1122 return
1123 return
1123 else:
1124 else:
1124 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1125 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1125 for new_full_path in sources:
1126 for new_full_path in sources:
1126 new_filename = os.path.basename(new_full_path)
1127 new_filename = os.path.basename(new_full_path)
1127 if new_filename.startswith('ipythonrc'):
1128 if new_filename.startswith('ipythonrc'):
1128 new_filename = new_filename + rc_suffix
1129 new_filename = new_filename + rc_suffix
1129 # The config directory should only contain files, skip any
1130 # The config directory should only contain files, skip any
1130 # directories which may be there (like CVS)
1131 # directories which may be there (like CVS)
1131 if os.path.isdir(new_full_path):
1132 if os.path.isdir(new_full_path):
1132 continue
1133 continue
1133 if os.path.exists(new_filename):
1134 if os.path.exists(new_filename):
1134 old_file = new_filename+'.old'
1135 old_file = new_filename+'.old'
1135 if os.path.exists(old_file):
1136 if os.path.exists(old_file):
1136 os.remove(old_file)
1137 os.remove(old_file)
1137 os.rename(new_filename,old_file)
1138 os.rename(new_filename,old_file)
1138 shutil.copy(new_full_path,new_filename)
1139 shutil.copy(new_full_path,new_filename)
1139 else:
1140 else:
1140 raise ValueError,'unrecognized mode for install:',`mode`
1141 raise ValueError,'unrecognized mode for install:',`mode`
1141
1142
1142 # Fix line-endings to those native to each platform in the config
1143 # Fix line-endings to those native to each platform in the config
1143 # directory.
1144 # directory.
1144 try:
1145 try:
1145 os.chdir(ipythondir)
1146 os.chdir(ipythondir)
1146 except:
1147 except:
1147 print """
1148 print """
1148 Problem: changing to directory %s failed.
1149 Problem: changing to directory %s failed.
1149 Details:
1150 Details:
1150 %s
1151 %s
1151
1152
1152 Some configuration files may have incorrect line endings. This should not
1153 Some configuration files may have incorrect line endings. This should not
1153 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1154 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1154 wait()
1155 wait()
1155 else:
1156 else:
1156 for fname in glb('ipythonrc*'):
1157 for fname in glb('ipythonrc*'):
1157 try:
1158 try:
1158 native_line_ends(fname,backup=0)
1159 native_line_ends(fname,backup=0)
1159 except IOError:
1160 except IOError:
1160 pass
1161 pass
1161
1162
1162 if mode == 'install':
1163 if mode == 'install':
1163 print """
1164 print """
1164 Successful installation!
1165 Successful installation!
1165
1166
1166 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1167 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1167 IPython manual (there are both HTML and PDF versions supplied with the
1168 IPython manual (there are both HTML and PDF versions supplied with the
1168 distribution) to make sure that your system environment is properly configured
1169 distribution) to make sure that your system environment is properly configured
1169 to take advantage of IPython's features.
1170 to take advantage of IPython's features.
1170
1171
1171 Important note: the configuration system has changed! The old system is
1172 Important note: the configuration system has changed! The old system is
1172 still in place, but its setting may be partly overridden by the settings in
1173 still in place, but its setting may be partly overridden by the settings in
1173 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1174 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1174 if some of the new settings bother you.
1175 if some of the new settings bother you.
1175
1176
1176 """
1177 """
1177 else:
1178 else:
1178 print """
1179 print """
1179 Successful upgrade!
1180 Successful upgrade!
1180
1181
1181 All files in your directory:
1182 All files in your directory:
1182 %(ipythondir)s
1183 %(ipythondir)s
1183 which would have been overwritten by the upgrade were backed up with a .old
1184 which would have been overwritten by the upgrade were backed up with a .old
1184 extension. If you had made particular customizations in those files you may
1185 extension. If you had made particular customizations in those files you may
1185 want to merge them back into the new files.""" % locals()
1186 want to merge them back into the new files.""" % locals()
1186 wait()
1187 wait()
1187 os.chdir(cwd)
1188 os.chdir(cwd)
1188 # end user_setup()
1189 # end user_setup()
1189
1190
1190 def atexit_operations(self):
1191 def atexit_operations(self):
1191 """This will be executed at the time of exit.
1192 """This will be executed at the time of exit.
1192
1193
1193 Saving of persistent data should be performed here. """
1194 Saving of persistent data should be performed here. """
1194
1195
1195 #print '*** IPython exit cleanup ***' # dbg
1196 #print '*** IPython exit cleanup ***' # dbg
1196 # input history
1197 # input history
1197 self.savehist()
1198 self.savehist()
1198
1199
1199 # Cleanup all tempfiles left around
1200 # Cleanup all tempfiles left around
1200 for tfile in self.tempfiles:
1201 for tfile in self.tempfiles:
1201 try:
1202 try:
1202 os.unlink(tfile)
1203 os.unlink(tfile)
1203 except OSError:
1204 except OSError:
1204 pass
1205 pass
1205
1206
1206 self.hooks.shutdown_hook()
1207 self.hooks.shutdown_hook()
1207
1208
1208 def savehist(self):
1209 def savehist(self):
1209 """Save input history to a file (via readline library)."""
1210 """Save input history to a file (via readline library)."""
1210 try:
1211 try:
1211 self.readline.write_history_file(self.histfile)
1212 self.readline.write_history_file(self.histfile)
1212 except:
1213 except:
1213 print 'Unable to save IPython command history to file: ' + \
1214 print 'Unable to save IPython command history to file: ' + \
1214 `self.histfile`
1215 `self.histfile`
1215
1216
1216 def reloadhist(self):
1217 def reloadhist(self):
1217 """Reload the input history from disk file."""
1218 """Reload the input history from disk file."""
1218
1219
1219 if self.has_readline:
1220 if self.has_readline:
1220 self.readline.clear_history()
1221 self.readline.clear_history()
1221 self.readline.read_history_file(self.shell.histfile)
1222 self.readline.read_history_file(self.shell.histfile)
1222
1223
1223 def history_saving_wrapper(self, func):
1224 def history_saving_wrapper(self, func):
1224 """ Wrap func for readline history saving
1225 """ Wrap func for readline history saving
1225
1226
1226 Convert func into callable that saves & restores
1227 Convert func into callable that saves & restores
1227 history around the call """
1228 history around the call """
1228
1229
1229 if not self.has_readline:
1230 if not self.has_readline:
1230 return func
1231 return func
1231
1232
1232 def wrapper():
1233 def wrapper():
1233 self.savehist()
1234 self.savehist()
1234 try:
1235 try:
1235 func()
1236 func()
1236 finally:
1237 finally:
1237 readline.read_history_file(self.histfile)
1238 readline.read_history_file(self.histfile)
1238 return wrapper
1239 return wrapper
1239
1240
1240
1241
1241 def pre_readline(self):
1242 def pre_readline(self):
1242 """readline hook to be used at the start of each line.
1243 """readline hook to be used at the start of each line.
1243
1244
1244 Currently it handles auto-indent only."""
1245 Currently it handles auto-indent only."""
1245
1246
1246 #debugx('self.indent_current_nsp','pre_readline:')
1247 #debugx('self.indent_current_nsp','pre_readline:')
1247
1248
1248 if self.rl_do_indent:
1249 if self.rl_do_indent:
1249 self.readline.insert_text(self.indent_current_str())
1250 self.readline.insert_text(self.indent_current_str())
1250 if self.rl_next_input is not None:
1251 if self.rl_next_input is not None:
1251 self.readline.insert_text(self.rl_next_input)
1252 self.readline.insert_text(self.rl_next_input)
1252 self.rl_next_input = None
1253 self.rl_next_input = None
1253
1254
1254 def init_readline(self):
1255 def init_readline(self):
1255 """Command history completion/saving/reloading."""
1256 """Command history completion/saving/reloading."""
1256
1257
1257 import IPython.rlineimpl as readline
1258 import IPython.rlineimpl as readline
1258 if not readline.have_readline:
1259 if not readline.have_readline:
1259 self.has_readline = 0
1260 self.has_readline = 0
1260 self.readline = None
1261 self.readline = None
1261 # no point in bugging windows users with this every time:
1262 # no point in bugging windows users with this every time:
1262 warn('Readline services not available on this platform.')
1263 warn('Readline services not available on this platform.')
1263 else:
1264 else:
1264 sys.modules['readline'] = readline
1265 sys.modules['readline'] = readline
1265 import atexit
1266 import atexit
1266 from IPython.completer import IPCompleter
1267 from IPython.completer import IPCompleter
1267 self.Completer = IPCompleter(self,
1268 self.Completer = IPCompleter(self,
1268 self.user_ns,
1269 self.user_ns,
1269 self.user_global_ns,
1270 self.user_global_ns,
1270 self.rc.readline_omit__names,
1271 self.rc.readline_omit__names,
1271 self.alias_table)
1272 self.alias_table)
1272 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1273 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1273 self.strdispatchers['complete_command'] = sdisp
1274 self.strdispatchers['complete_command'] = sdisp
1274 self.Completer.custom_completers = sdisp
1275 self.Completer.custom_completers = sdisp
1275 # Platform-specific configuration
1276 # Platform-specific configuration
1276 if os.name == 'nt':
1277 if os.name == 'nt':
1277 self.readline_startup_hook = readline.set_pre_input_hook
1278 self.readline_startup_hook = readline.set_pre_input_hook
1278 else:
1279 else:
1279 self.readline_startup_hook = readline.set_startup_hook
1280 self.readline_startup_hook = readline.set_startup_hook
1280
1281
1281 # Load user's initrc file (readline config)
1282 # Load user's initrc file (readline config)
1282 inputrc_name = os.environ.get('INPUTRC')
1283 inputrc_name = os.environ.get('INPUTRC')
1283 if inputrc_name is None:
1284 if inputrc_name is None:
1284 home_dir = get_home_dir()
1285 home_dir = get_home_dir()
1285 if home_dir is not None:
1286 if home_dir is not None:
1286 inputrc_name = os.path.join(home_dir,'.inputrc')
1287 inputrc_name = os.path.join(home_dir,'.inputrc')
1287 if os.path.isfile(inputrc_name):
1288 if os.path.isfile(inputrc_name):
1288 try:
1289 try:
1289 readline.read_init_file(inputrc_name)
1290 readline.read_init_file(inputrc_name)
1290 except:
1291 except:
1291 warn('Problems reading readline initialization file <%s>'
1292 warn('Problems reading readline initialization file <%s>'
1292 % inputrc_name)
1293 % inputrc_name)
1293
1294
1294 self.has_readline = 1
1295 self.has_readline = 1
1295 self.readline = readline
1296 self.readline = readline
1296 # save this in sys so embedded copies can restore it properly
1297 # save this in sys so embedded copies can restore it properly
1297 sys.ipcompleter = self.Completer.complete
1298 sys.ipcompleter = self.Completer.complete
1298 self.set_completer()
1299 self.set_completer()
1299
1300
1300 # Configure readline according to user's prefs
1301 # Configure readline according to user's prefs
1301 for rlcommand in self.rc.readline_parse_and_bind:
1302 for rlcommand in self.rc.readline_parse_and_bind:
1302 readline.parse_and_bind(rlcommand)
1303 readline.parse_and_bind(rlcommand)
1303
1304
1304 # remove some chars from the delimiters list
1305 # remove some chars from the delimiters list
1305 delims = readline.get_completer_delims()
1306 delims = readline.get_completer_delims()
1306 delims = delims.translate(string._idmap,
1307 delims = delims.translate(string._idmap,
1307 self.rc.readline_remove_delims)
1308 self.rc.readline_remove_delims)
1308 readline.set_completer_delims(delims)
1309 readline.set_completer_delims(delims)
1309 # otherwise we end up with a monster history after a while:
1310 # otherwise we end up with a monster history after a while:
1310 readline.set_history_length(1000)
1311 readline.set_history_length(1000)
1311 try:
1312 try:
1312 #print '*** Reading readline history' # dbg
1313 #print '*** Reading readline history' # dbg
1313 readline.read_history_file(self.histfile)
1314 readline.read_history_file(self.histfile)
1314 except IOError:
1315 except IOError:
1315 pass # It doesn't exist yet.
1316 pass # It doesn't exist yet.
1316
1317
1317 atexit.register(self.atexit_operations)
1318 atexit.register(self.atexit_operations)
1318 del atexit
1319 del atexit
1319
1320
1320 # Configure auto-indent for all platforms
1321 # Configure auto-indent for all platforms
1321 self.set_autoindent(self.rc.autoindent)
1322 self.set_autoindent(self.rc.autoindent)
1322
1323
1323 def ask_yes_no(self,prompt,default=True):
1324 def ask_yes_no(self,prompt,default=True):
1324 if self.rc.quiet:
1325 if self.rc.quiet:
1325 return True
1326 return True
1326 return ask_yes_no(prompt,default)
1327 return ask_yes_no(prompt,default)
1327
1328
1328 def _should_recompile(self,e):
1329 def _should_recompile(self,e):
1329 """Utility routine for edit_syntax_error"""
1330 """Utility routine for edit_syntax_error"""
1330
1331
1331 if e.filename in ('<ipython console>','<input>','<string>',
1332 if e.filename in ('<ipython console>','<input>','<string>',
1332 '<console>','<BackgroundJob compilation>',
1333 '<console>','<BackgroundJob compilation>',
1333 None):
1334 None):
1334
1335
1335 return False
1336 return False
1336 try:
1337 try:
1337 if (self.rc.autoedit_syntax and
1338 if (self.rc.autoedit_syntax and
1338 not self.ask_yes_no('Return to editor to correct syntax error? '
1339 not self.ask_yes_no('Return to editor to correct syntax error? '
1339 '[Y/n] ','y')):
1340 '[Y/n] ','y')):
1340 return False
1341 return False
1341 except EOFError:
1342 except EOFError:
1342 return False
1343 return False
1343
1344
1344 def int0(x):
1345 def int0(x):
1345 try:
1346 try:
1346 return int(x)
1347 return int(x)
1347 except TypeError:
1348 except TypeError:
1348 return 0
1349 return 0
1349 # always pass integer line and offset values to editor hook
1350 # always pass integer line and offset values to editor hook
1350 self.hooks.fix_error_editor(e.filename,
1351 self.hooks.fix_error_editor(e.filename,
1351 int0(e.lineno),int0(e.offset),e.msg)
1352 int0(e.lineno),int0(e.offset),e.msg)
1352 return True
1353 return True
1353
1354
1354 def edit_syntax_error(self):
1355 def edit_syntax_error(self):
1355 """The bottom half of the syntax error handler called in the main loop.
1356 """The bottom half of the syntax error handler called in the main loop.
1356
1357
1357 Loop until syntax error is fixed or user cancels.
1358 Loop until syntax error is fixed or user cancels.
1358 """
1359 """
1359
1360
1360 while self.SyntaxTB.last_syntax_error:
1361 while self.SyntaxTB.last_syntax_error:
1361 # copy and clear last_syntax_error
1362 # copy and clear last_syntax_error
1362 err = self.SyntaxTB.clear_err_state()
1363 err = self.SyntaxTB.clear_err_state()
1363 if not self._should_recompile(err):
1364 if not self._should_recompile(err):
1364 return
1365 return
1365 try:
1366 try:
1366 # may set last_syntax_error again if a SyntaxError is raised
1367 # may set last_syntax_error again if a SyntaxError is raised
1367 self.safe_execfile(err.filename,self.user_ns)
1368 self.safe_execfile(err.filename,self.user_ns)
1368 except:
1369 except:
1369 self.showtraceback()
1370 self.showtraceback()
1370 else:
1371 else:
1371 try:
1372 try:
1372 f = file(err.filename)
1373 f = file(err.filename)
1373 try:
1374 try:
1374 sys.displayhook(f.read())
1375 sys.displayhook(f.read())
1375 finally:
1376 finally:
1376 f.close()
1377 f.close()
1377 except:
1378 except:
1378 self.showtraceback()
1379 self.showtraceback()
1379
1380
1380 def showsyntaxerror(self, filename=None):
1381 def showsyntaxerror(self, filename=None):
1381 """Display the syntax error that just occurred.
1382 """Display the syntax error that just occurred.
1382
1383
1383 This doesn't display a stack trace because there isn't one.
1384 This doesn't display a stack trace because there isn't one.
1384
1385
1385 If a filename is given, it is stuffed in the exception instead
1386 If a filename is given, it is stuffed in the exception instead
1386 of what was there before (because Python's parser always uses
1387 of what was there before (because Python's parser always uses
1387 "<string>" when reading from a string).
1388 "<string>" when reading from a string).
1388 """
1389 """
1389 etype, value, last_traceback = sys.exc_info()
1390 etype, value, last_traceback = sys.exc_info()
1390
1391
1391 # See note about these variables in showtraceback() below
1392 # See note about these variables in showtraceback() below
1392 sys.last_type = etype
1393 sys.last_type = etype
1393 sys.last_value = value
1394 sys.last_value = value
1394 sys.last_traceback = last_traceback
1395 sys.last_traceback = last_traceback
1395
1396
1396 if filename and etype is SyntaxError:
1397 if filename and etype is SyntaxError:
1397 # Work hard to stuff the correct filename in the exception
1398 # Work hard to stuff the correct filename in the exception
1398 try:
1399 try:
1399 msg, (dummy_filename, lineno, offset, line) = value
1400 msg, (dummy_filename, lineno, offset, line) = value
1400 except:
1401 except:
1401 # Not the format we expect; leave it alone
1402 # Not the format we expect; leave it alone
1402 pass
1403 pass
1403 else:
1404 else:
1404 # Stuff in the right filename
1405 # Stuff in the right filename
1405 try:
1406 try:
1406 # Assume SyntaxError is a class exception
1407 # Assume SyntaxError is a class exception
1407 value = SyntaxError(msg, (filename, lineno, offset, line))
1408 value = SyntaxError(msg, (filename, lineno, offset, line))
1408 except:
1409 except:
1409 # If that failed, assume SyntaxError is a string
1410 # If that failed, assume SyntaxError is a string
1410 value = msg, (filename, lineno, offset, line)
1411 value = msg, (filename, lineno, offset, line)
1411 self.SyntaxTB(etype,value,[])
1412 self.SyntaxTB(etype,value,[])
1412
1413
1413 def debugger(self,force=False):
1414 def debugger(self,force=False):
1414 """Call the pydb/pdb debugger.
1415 """Call the pydb/pdb debugger.
1415
1416
1416 Keywords:
1417 Keywords:
1417
1418
1418 - force(False): by default, this routine checks the instance call_pdb
1419 - force(False): by default, this routine checks the instance call_pdb
1419 flag and does not actually invoke the debugger if the flag is false.
1420 flag and does not actually invoke the debugger if the flag is false.
1420 The 'force' option forces the debugger to activate even if the flag
1421 The 'force' option forces the debugger to activate even if the flag
1421 is false.
1422 is false.
1422 """
1423 """
1423
1424
1424 if not (force or self.call_pdb):
1425 if not (force or self.call_pdb):
1425 return
1426 return
1426
1427
1427 if not hasattr(sys,'last_traceback'):
1428 if not hasattr(sys,'last_traceback'):
1428 error('No traceback has been produced, nothing to debug.')
1429 error('No traceback has been produced, nothing to debug.')
1429 return
1430 return
1430
1431
1431 # use pydb if available
1432 # use pydb if available
1432 if Debugger.has_pydb:
1433 if Debugger.has_pydb:
1433 from pydb import pm
1434 from pydb import pm
1434 else:
1435 else:
1435 # fallback to our internal debugger
1436 # fallback to our internal debugger
1436 pm = lambda : self.InteractiveTB.debugger(force=True)
1437 pm = lambda : self.InteractiveTB.debugger(force=True)
1437 self.history_saving_wrapper(pm)()
1438 self.history_saving_wrapper(pm)()
1438
1439
1439 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1440 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1440 """Display the exception that just occurred.
1441 """Display the exception that just occurred.
1441
1442
1442 If nothing is known about the exception, this is the method which
1443 If nothing is known about the exception, this is the method which
1443 should be used throughout the code for presenting user tracebacks,
1444 should be used throughout the code for presenting user tracebacks,
1444 rather than directly invoking the InteractiveTB object.
1445 rather than directly invoking the InteractiveTB object.
1445
1446
1446 A specific showsyntaxerror() also exists, but this method can take
1447 A specific showsyntaxerror() also exists, but this method can take
1447 care of calling it if needed, so unless you are explicitly catching a
1448 care of calling it if needed, so unless you are explicitly catching a
1448 SyntaxError exception, don't try to analyze the stack manually and
1449 SyntaxError exception, don't try to analyze the stack manually and
1449 simply call this method."""
1450 simply call this method."""
1450
1451
1451
1452
1452 # Though this won't be called by syntax errors in the input line,
1453 # Though this won't be called by syntax errors in the input line,
1453 # there may be SyntaxError cases whith imported code.
1454 # there may be SyntaxError cases whith imported code.
1454
1455
1455
1456
1456 if exc_tuple is None:
1457 if exc_tuple is None:
1457 etype, value, tb = sys.exc_info()
1458 etype, value, tb = sys.exc_info()
1458 else:
1459 else:
1459 etype, value, tb = exc_tuple
1460 etype, value, tb = exc_tuple
1460
1461
1461 if etype is SyntaxError:
1462 if etype is SyntaxError:
1462 self.showsyntaxerror(filename)
1463 self.showsyntaxerror(filename)
1463 else:
1464 else:
1464 # WARNING: these variables are somewhat deprecated and not
1465 # WARNING: these variables are somewhat deprecated and not
1465 # necessarily safe to use in a threaded environment, but tools
1466 # necessarily safe to use in a threaded environment, but tools
1466 # like pdb depend on their existence, so let's set them. If we
1467 # like pdb depend on their existence, so let's set them. If we
1467 # find problems in the field, we'll need to revisit their use.
1468 # find problems in the field, we'll need to revisit their use.
1468 sys.last_type = etype
1469 sys.last_type = etype
1469 sys.last_value = value
1470 sys.last_value = value
1470 sys.last_traceback = tb
1471 sys.last_traceback = tb
1471
1472
1472 if etype in self.custom_exceptions:
1473 if etype in self.custom_exceptions:
1473 self.CustomTB(etype,value,tb)
1474 self.CustomTB(etype,value,tb)
1474 else:
1475 else:
1475 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1476 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1476 if self.InteractiveTB.call_pdb and self.has_readline:
1477 if self.InteractiveTB.call_pdb and self.has_readline:
1477 # pdb mucks up readline, fix it back
1478 # pdb mucks up readline, fix it back
1478 self.set_completer()
1479 self.set_completer()
1479
1480
1480
1481
1481 def mainloop(self,banner=None):
1482 def mainloop(self,banner=None):
1482 """Creates the local namespace and starts the mainloop.
1483 """Creates the local namespace and starts the mainloop.
1483
1484
1484 If an optional banner argument is given, it will override the
1485 If an optional banner argument is given, it will override the
1485 internally created default banner."""
1486 internally created default banner."""
1486
1487
1487 if self.rc.c: # Emulate Python's -c option
1488 if self.rc.c: # Emulate Python's -c option
1488 self.exec_init_cmd()
1489 self.exec_init_cmd()
1489 if banner is None:
1490 if banner is None:
1490 if not self.rc.banner:
1491 if not self.rc.banner:
1491 banner = ''
1492 banner = ''
1492 # banner is string? Use it directly!
1493 # banner is string? Use it directly!
1493 elif isinstance(self.rc.banner,basestring):
1494 elif isinstance(self.rc.banner,basestring):
1494 banner = self.rc.banner
1495 banner = self.rc.banner
1495 else:
1496 else:
1496 banner = self.BANNER+self.banner2
1497 banner = self.BANNER+self.banner2
1497
1498
1498 self.interact(banner)
1499 self.interact(banner)
1499
1500
1500 def exec_init_cmd(self):
1501 def exec_init_cmd(self):
1501 """Execute a command given at the command line.
1502 """Execute a command given at the command line.
1502
1503
1503 This emulates Python's -c option."""
1504 This emulates Python's -c option."""
1504
1505
1505 #sys.argv = ['-c']
1506 #sys.argv = ['-c']
1506 self.push(self.prefilter(self.rc.c, False))
1507 self.push(self.prefilter(self.rc.c, False))
1507 self.exit_now = True
1508 self.exit_now = True
1508
1509
1509 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1510 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1510 """Embeds IPython into a running python program.
1511 """Embeds IPython into a running python program.
1511
1512
1512 Input:
1513 Input:
1513
1514
1514 - header: An optional header message can be specified.
1515 - header: An optional header message can be specified.
1515
1516
1516 - local_ns, global_ns: working namespaces. If given as None, the
1517 - local_ns, global_ns: working namespaces. If given as None, the
1517 IPython-initialized one is updated with __main__.__dict__, so that
1518 IPython-initialized one is updated with __main__.__dict__, so that
1518 program variables become visible but user-specific configuration
1519 program variables become visible but user-specific configuration
1519 remains possible.
1520 remains possible.
1520
1521
1521 - stack_depth: specifies how many levels in the stack to go to
1522 - stack_depth: specifies how many levels in the stack to go to
1522 looking for namespaces (when local_ns and global_ns are None). This
1523 looking for namespaces (when local_ns and global_ns are None). This
1523 allows an intermediate caller to make sure that this function gets
1524 allows an intermediate caller to make sure that this function gets
1524 the namespace from the intended level in the stack. By default (0)
1525 the namespace from the intended level in the stack. By default (0)
1525 it will get its locals and globals from the immediate caller.
1526 it will get its locals and globals from the immediate caller.
1526
1527
1527 Warning: it's possible to use this in a program which is being run by
1528 Warning: it's possible to use this in a program which is being run by
1528 IPython itself (via %run), but some funny things will happen (a few
1529 IPython itself (via %run), but some funny things will happen (a few
1529 globals get overwritten). In the future this will be cleaned up, as
1530 globals get overwritten). In the future this will be cleaned up, as
1530 there is no fundamental reason why it can't work perfectly."""
1531 there is no fundamental reason why it can't work perfectly."""
1531
1532
1532 # Get locals and globals from caller
1533 # Get locals and globals from caller
1533 if local_ns is None or global_ns is None:
1534 if local_ns is None or global_ns is None:
1534 call_frame = sys._getframe(stack_depth).f_back
1535 call_frame = sys._getframe(stack_depth).f_back
1535
1536
1536 if local_ns is None:
1537 if local_ns is None:
1537 local_ns = call_frame.f_locals
1538 local_ns = call_frame.f_locals
1538 if global_ns is None:
1539 if global_ns is None:
1539 global_ns = call_frame.f_globals
1540 global_ns = call_frame.f_globals
1540
1541
1541 # Update namespaces and fire up interpreter
1542 # Update namespaces and fire up interpreter
1542
1543
1543 # The global one is easy, we can just throw it in
1544 # The global one is easy, we can just throw it in
1544 self.user_global_ns = global_ns
1545 self.user_global_ns = global_ns
1545
1546
1546 # but the user/local one is tricky: ipython needs it to store internal
1547 # but the user/local one is tricky: ipython needs it to store internal
1547 # data, but we also need the locals. We'll copy locals in the user
1548 # data, but we also need the locals. We'll copy locals in the user
1548 # one, but will track what got copied so we can delete them at exit.
1549 # one, but will track what got copied so we can delete them at exit.
1549 # This is so that a later embedded call doesn't see locals from a
1550 # This is so that a later embedded call doesn't see locals from a
1550 # previous call (which most likely existed in a separate scope).
1551 # previous call (which most likely existed in a separate scope).
1551 local_varnames = local_ns.keys()
1552 local_varnames = local_ns.keys()
1552 self.user_ns.update(local_ns)
1553 self.user_ns.update(local_ns)
1553
1554
1554 # Patch for global embedding to make sure that things don't overwrite
1555 # Patch for global embedding to make sure that things don't overwrite
1555 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1556 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1556 # FIXME. Test this a bit more carefully (the if.. is new)
1557 # FIXME. Test this a bit more carefully (the if.. is new)
1557 if local_ns is None and global_ns is None:
1558 if local_ns is None and global_ns is None:
1558 self.user_global_ns.update(__main__.__dict__)
1559 self.user_global_ns.update(__main__.__dict__)
1559
1560
1560 # make sure the tab-completer has the correct frame information, so it
1561 # make sure the tab-completer has the correct frame information, so it
1561 # actually completes using the frame's locals/globals
1562 # actually completes using the frame's locals/globals
1562 self.set_completer_frame()
1563 self.set_completer_frame()
1563
1564
1564 # before activating the interactive mode, we need to make sure that
1565 # before activating the interactive mode, we need to make sure that
1565 # all names in the builtin namespace needed by ipython point to
1566 # all names in the builtin namespace needed by ipython point to
1566 # ourselves, and not to other instances.
1567 # ourselves, and not to other instances.
1567 self.add_builtins()
1568 self.add_builtins()
1568
1569
1569 self.interact(header)
1570 self.interact(header)
1570
1571
1571 # now, purge out the user namespace from anything we might have added
1572 # now, purge out the user namespace from anything we might have added
1572 # from the caller's local namespace
1573 # from the caller's local namespace
1573 delvar = self.user_ns.pop
1574 delvar = self.user_ns.pop
1574 for var in local_varnames:
1575 for var in local_varnames:
1575 delvar(var,None)
1576 delvar(var,None)
1576 # and clean builtins we may have overridden
1577 # and clean builtins we may have overridden
1577 self.clean_builtins()
1578 self.clean_builtins()
1578
1579
1579 def interact(self, banner=None):
1580 def interact(self, banner=None):
1580 """Closely emulate the interactive Python console.
1581 """Closely emulate the interactive Python console.
1581
1582
1582 The optional banner argument specify the banner to print
1583 The optional banner argument specify the banner to print
1583 before the first interaction; by default it prints a banner
1584 before the first interaction; by default it prints a banner
1584 similar to the one printed by the real Python interpreter,
1585 similar to the one printed by the real Python interpreter,
1585 followed by the current class name in parentheses (so as not
1586 followed by the current class name in parentheses (so as not
1586 to confuse this with the real interpreter -- since it's so
1587 to confuse this with the real interpreter -- since it's so
1587 close!).
1588 close!).
1588
1589
1589 """
1590 """
1590
1591
1591 if self.exit_now:
1592 if self.exit_now:
1592 # batch run -> do not interact
1593 # batch run -> do not interact
1593 return
1594 return
1594 cprt = 'Type "copyright", "credits" or "license" for more information.'
1595 cprt = 'Type "copyright", "credits" or "license" for more information.'
1595 if banner is None:
1596 if banner is None:
1596 self.write("Python %s on %s\n%s\n(%s)\n" %
1597 self.write("Python %s on %s\n%s\n(%s)\n" %
1597 (sys.version, sys.platform, cprt,
1598 (sys.version, sys.platform, cprt,
1598 self.__class__.__name__))
1599 self.__class__.__name__))
1599 else:
1600 else:
1600 self.write(banner)
1601 self.write(banner)
1601
1602
1602 more = 0
1603 more = 0
1603
1604
1604 # Mark activity in the builtins
1605 # Mark activity in the builtins
1605 __builtin__.__dict__['__IPYTHON__active'] += 1
1606 __builtin__.__dict__['__IPYTHON__active'] += 1
1606
1607
1607 if readline.have_readline:
1608 if readline.have_readline:
1608 self.readline_startup_hook(self.pre_readline)
1609 self.readline_startup_hook(self.pre_readline)
1609 # exit_now is set by a call to %Exit or %Quit
1610 # exit_now is set by a call to %Exit or %Quit
1610
1611
1611 while not self.exit_now:
1612 while not self.exit_now:
1612 if more:
1613 if more:
1613 prompt = self.hooks.generate_prompt(True)
1614 prompt = self.hooks.generate_prompt(True)
1614 if self.autoindent:
1615 if self.autoindent:
1615 self.rl_do_indent = True
1616 self.rl_do_indent = True
1616
1617
1617 else:
1618 else:
1618 prompt = self.hooks.generate_prompt(False)
1619 prompt = self.hooks.generate_prompt(False)
1619 try:
1620 try:
1620 line = self.raw_input(prompt,more)
1621 line = self.raw_input(prompt,more)
1621 if self.exit_now:
1622 if self.exit_now:
1622 # quick exit on sys.std[in|out] close
1623 # quick exit on sys.std[in|out] close
1623 break
1624 break
1624 if self.autoindent:
1625 if self.autoindent:
1625 self.rl_do_indent = False
1626 self.rl_do_indent = False
1626
1627
1627 except KeyboardInterrupt:
1628 except KeyboardInterrupt:
1628 self.write('\nKeyboardInterrupt\n')
1629 self.write('\nKeyboardInterrupt\n')
1629 self.resetbuffer()
1630 self.resetbuffer()
1630 # keep cache in sync with the prompt counter:
1631 # keep cache in sync with the prompt counter:
1631 self.outputcache.prompt_count -= 1
1632 self.outputcache.prompt_count -= 1
1632
1633
1633 if self.autoindent:
1634 if self.autoindent:
1634 self.indent_current_nsp = 0
1635 self.indent_current_nsp = 0
1635 more = 0
1636 more = 0
1636 except EOFError:
1637 except EOFError:
1637 if self.autoindent:
1638 if self.autoindent:
1638 self.rl_do_indent = False
1639 self.rl_do_indent = False
1639 self.readline_startup_hook(None)
1640 self.readline_startup_hook(None)
1640 self.write('\n')
1641 self.write('\n')
1641 self.exit()
1642 self.exit()
1642 except bdb.BdbQuit:
1643 except bdb.BdbQuit:
1643 warn('The Python debugger has exited with a BdbQuit exception.\n'
1644 warn('The Python debugger has exited with a BdbQuit exception.\n'
1644 'Because of how pdb handles the stack, it is impossible\n'
1645 'Because of how pdb handles the stack, it is impossible\n'
1645 'for IPython to properly format this particular exception.\n'
1646 'for IPython to properly format this particular exception.\n'
1646 'IPython will resume normal operation.')
1647 'IPython will resume normal operation.')
1647 except:
1648 except:
1648 # exceptions here are VERY RARE, but they can be triggered
1649 # exceptions here are VERY RARE, but they can be triggered
1649 # asynchronously by signal handlers, for example.
1650 # asynchronously by signal handlers, for example.
1650 self.showtraceback()
1651 self.showtraceback()
1651 else:
1652 else:
1652 more = self.push(line)
1653 more = self.push(line)
1653 if (self.SyntaxTB.last_syntax_error and
1654 if (self.SyntaxTB.last_syntax_error and
1654 self.rc.autoedit_syntax):
1655 self.rc.autoedit_syntax):
1655 self.edit_syntax_error()
1656 self.edit_syntax_error()
1656
1657
1657 # We are off again...
1658 # We are off again...
1658 __builtin__.__dict__['__IPYTHON__active'] -= 1
1659 __builtin__.__dict__['__IPYTHON__active'] -= 1
1659
1660
1660 def excepthook(self, etype, value, tb):
1661 def excepthook(self, etype, value, tb):
1661 """One more defense for GUI apps that call sys.excepthook.
1662 """One more defense for GUI apps that call sys.excepthook.
1662
1663
1663 GUI frameworks like wxPython trap exceptions and call
1664 GUI frameworks like wxPython trap exceptions and call
1664 sys.excepthook themselves. I guess this is a feature that
1665 sys.excepthook themselves. I guess this is a feature that
1665 enables them to keep running after exceptions that would
1666 enables them to keep running after exceptions that would
1666 otherwise kill their mainloop. This is a bother for IPython
1667 otherwise kill their mainloop. This is a bother for IPython
1667 which excepts to catch all of the program exceptions with a try:
1668 which excepts to catch all of the program exceptions with a try:
1668 except: statement.
1669 except: statement.
1669
1670
1670 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1671 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1671 any app directly invokes sys.excepthook, it will look to the user like
1672 any app directly invokes sys.excepthook, it will look to the user like
1672 IPython crashed. In order to work around this, we can disable the
1673 IPython crashed. In order to work around this, we can disable the
1673 CrashHandler and replace it with this excepthook instead, which prints a
1674 CrashHandler and replace it with this excepthook instead, which prints a
1674 regular traceback using our InteractiveTB. In this fashion, apps which
1675 regular traceback using our InteractiveTB. In this fashion, apps which
1675 call sys.excepthook will generate a regular-looking exception from
1676 call sys.excepthook will generate a regular-looking exception from
1676 IPython, and the CrashHandler will only be triggered by real IPython
1677 IPython, and the CrashHandler will only be triggered by real IPython
1677 crashes.
1678 crashes.
1678
1679
1679 This hook should be used sparingly, only in places which are not likely
1680 This hook should be used sparingly, only in places which are not likely
1680 to be true IPython errors.
1681 to be true IPython errors.
1681 """
1682 """
1682 self.showtraceback((etype,value,tb),tb_offset=0)
1683 self.showtraceback((etype,value,tb),tb_offset=0)
1683
1684
1684 def expand_aliases(self,fn,rest):
1685 def expand_aliases(self,fn,rest):
1685 """ Expand multiple levels of aliases:
1686 """ Expand multiple levels of aliases:
1686
1687
1687 if:
1688 if:
1688
1689
1689 alias foo bar /tmp
1690 alias foo bar /tmp
1690 alias baz foo
1691 alias baz foo
1691
1692
1692 then:
1693 then:
1693
1694
1694 baz huhhahhei -> bar /tmp huhhahhei
1695 baz huhhahhei -> bar /tmp huhhahhei
1695
1696
1696 """
1697 """
1697 line = fn + " " + rest
1698 line = fn + " " + rest
1698
1699
1699 done = Set()
1700 done = Set()
1700 while 1:
1701 while 1:
1701 pre,fn,rest = prefilter.splitUserInput(line,
1702 pre,fn,rest = prefilter.splitUserInput(line,
1702 prefilter.shell_line_split)
1703 prefilter.shell_line_split)
1703 if fn in self.alias_table:
1704 if fn in self.alias_table:
1704 if fn in done:
1705 if fn in done:
1705 warn("Cyclic alias definition, repeated '%s'" % fn)
1706 warn("Cyclic alias definition, repeated '%s'" % fn)
1706 return ""
1707 return ""
1707 done.add(fn)
1708 done.add(fn)
1708
1709
1709 l2 = self.transform_alias(fn,rest)
1710 l2 = self.transform_alias(fn,rest)
1710 # dir -> dir
1711 # dir -> dir
1711 # print "alias",line, "->",l2 #dbg
1712 # print "alias",line, "->",l2 #dbg
1712 if l2 == line:
1713 if l2 == line:
1713 break
1714 break
1714 # ls -> ls -F should not recurse forever
1715 # ls -> ls -F should not recurse forever
1715 if l2.split(None,1)[0] == line.split(None,1)[0]:
1716 if l2.split(None,1)[0] == line.split(None,1)[0]:
1716 line = l2
1717 line = l2
1717 break
1718 break
1718
1719
1719 line=l2
1720 line=l2
1720
1721
1721
1722
1722 # print "al expand to",line #dbg
1723 # print "al expand to",line #dbg
1723 else:
1724 else:
1724 break
1725 break
1725
1726
1726 return line
1727 return line
1727
1728
1728 def transform_alias(self, alias,rest=''):
1729 def transform_alias(self, alias,rest=''):
1729 """ Transform alias to system command string.
1730 """ Transform alias to system command string.
1730 """
1731 """
1731 nargs,cmd = self.alias_table[alias]
1732 nargs,cmd = self.alias_table[alias]
1732 if ' ' in cmd and os.path.isfile(cmd):
1733 if ' ' in cmd and os.path.isfile(cmd):
1733 cmd = '"%s"' % cmd
1734 cmd = '"%s"' % cmd
1734
1735
1735 # Expand the %l special to be the user's input line
1736 # Expand the %l special to be the user's input line
1736 if cmd.find('%l') >= 0:
1737 if cmd.find('%l') >= 0:
1737 cmd = cmd.replace('%l',rest)
1738 cmd = cmd.replace('%l',rest)
1738 rest = ''
1739 rest = ''
1739 if nargs==0:
1740 if nargs==0:
1740 # Simple, argument-less aliases
1741 # Simple, argument-less aliases
1741 cmd = '%s %s' % (cmd,rest)
1742 cmd = '%s %s' % (cmd,rest)
1742 else:
1743 else:
1743 # Handle aliases with positional arguments
1744 # Handle aliases with positional arguments
1744 args = rest.split(None,nargs)
1745 args = rest.split(None,nargs)
1745 if len(args)< nargs:
1746 if len(args)< nargs:
1746 error('Alias <%s> requires %s arguments, %s given.' %
1747 error('Alias <%s> requires %s arguments, %s given.' %
1747 (alias,nargs,len(args)))
1748 (alias,nargs,len(args)))
1748 return None
1749 return None
1749 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1750 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1750 # Now call the macro, evaluating in the user's namespace
1751 # Now call the macro, evaluating in the user's namespace
1751 #print 'new command: <%r>' % cmd # dbg
1752 #print 'new command: <%r>' % cmd # dbg
1752 return cmd
1753 return cmd
1753
1754
1754 def call_alias(self,alias,rest=''):
1755 def call_alias(self,alias,rest=''):
1755 """Call an alias given its name and the rest of the line.
1756 """Call an alias given its name and the rest of the line.
1756
1757
1757 This is only used to provide backwards compatibility for users of
1758 This is only used to provide backwards compatibility for users of
1758 ipalias(), use of which is not recommended for anymore."""
1759 ipalias(), use of which is not recommended for anymore."""
1759
1760
1760 # Now call the macro, evaluating in the user's namespace
1761 # Now call the macro, evaluating in the user's namespace
1761 cmd = self.transform_alias(alias, rest)
1762 cmd = self.transform_alias(alias, rest)
1762 try:
1763 try:
1763 self.system(cmd)
1764 self.system(cmd)
1764 except:
1765 except:
1765 self.showtraceback()
1766 self.showtraceback()
1766
1767
1767 def indent_current_str(self):
1768 def indent_current_str(self):
1768 """return the current level of indentation as a string"""
1769 """return the current level of indentation as a string"""
1769 return self.indent_current_nsp * ' '
1770 return self.indent_current_nsp * ' '
1770
1771
1771 def autoindent_update(self,line):
1772 def autoindent_update(self,line):
1772 """Keep track of the indent level."""
1773 """Keep track of the indent level."""
1773
1774
1774 #debugx('line')
1775 #debugx('line')
1775 #debugx('self.indent_current_nsp')
1776 #debugx('self.indent_current_nsp')
1776 if self.autoindent:
1777 if self.autoindent:
1777 if line:
1778 if line:
1778 inisp = num_ini_spaces(line)
1779 inisp = num_ini_spaces(line)
1779 if inisp < self.indent_current_nsp:
1780 if inisp < self.indent_current_nsp:
1780 self.indent_current_nsp = inisp
1781 self.indent_current_nsp = inisp
1781
1782
1782 if line[-1] == ':':
1783 if line[-1] == ':':
1783 self.indent_current_nsp += 4
1784 self.indent_current_nsp += 4
1784 elif dedent_re.match(line):
1785 elif dedent_re.match(line):
1785 self.indent_current_nsp -= 4
1786 self.indent_current_nsp -= 4
1786 else:
1787 else:
1787 self.indent_current_nsp = 0
1788 self.indent_current_nsp = 0
1788
1789
1789 def runlines(self,lines):
1790 def runlines(self,lines):
1790 """Run a string of one or more lines of source.
1791 """Run a string of one or more lines of source.
1791
1792
1792 This method is capable of running a string containing multiple source
1793 This method is capable of running a string containing multiple source
1793 lines, as if they had been entered at the IPython prompt. Since it
1794 lines, as if they had been entered at the IPython prompt. Since it
1794 exposes IPython's processing machinery, the given strings can contain
1795 exposes IPython's processing machinery, the given strings can contain
1795 magic calls (%magic), special shell access (!cmd), etc."""
1796 magic calls (%magic), special shell access (!cmd), etc."""
1796
1797
1797 # We must start with a clean buffer, in case this is run from an
1798 # We must start with a clean buffer, in case this is run from an
1798 # interactive IPython session (via a magic, for example).
1799 # interactive IPython session (via a magic, for example).
1799 self.resetbuffer()
1800 self.resetbuffer()
1800 lines = lines.split('\n')
1801 lines = lines.split('\n')
1801 more = 0
1802 more = 0
1802 for line in lines:
1803 for line in lines:
1803 # skip blank lines so we don't mess up the prompt counter, but do
1804 # skip blank lines so we don't mess up the prompt counter, but do
1804 # NOT skip even a blank line if we are in a code block (more is
1805 # NOT skip even a blank line if we are in a code block (more is
1805 # true)
1806 # true)
1806 if line or more:
1807 if line or more:
1807 more = self.push(self.prefilter(line,more))
1808 more = self.push(self.prefilter(line,more))
1808 # IPython's runsource returns None if there was an error
1809 # IPython's runsource returns None if there was an error
1809 # compiling the code. This allows us to stop processing right
1810 # compiling the code. This allows us to stop processing right
1810 # away, so the user gets the error message at the right place.
1811 # away, so the user gets the error message at the right place.
1811 if more is None:
1812 if more is None:
1812 break
1813 break
1813 # final newline in case the input didn't have it, so that the code
1814 # final newline in case the input didn't have it, so that the code
1814 # actually does get executed
1815 # actually does get executed
1815 if more:
1816 if more:
1816 self.push('\n')
1817 self.push('\n')
1817
1818
1818 def runsource(self, source, filename='<input>', symbol='single'):
1819 def runsource(self, source, filename='<input>', symbol='single'):
1819 """Compile and run some source in the interpreter.
1820 """Compile and run some source in the interpreter.
1820
1821
1821 Arguments are as for compile_command().
1822 Arguments are as for compile_command().
1822
1823
1823 One several things can happen:
1824 One several things can happen:
1824
1825
1825 1) The input is incorrect; compile_command() raised an
1826 1) The input is incorrect; compile_command() raised an
1826 exception (SyntaxError or OverflowError). A syntax traceback
1827 exception (SyntaxError or OverflowError). A syntax traceback
1827 will be printed by calling the showsyntaxerror() method.
1828 will be printed by calling the showsyntaxerror() method.
1828
1829
1829 2) The input is incomplete, and more input is required;
1830 2) The input is incomplete, and more input is required;
1830 compile_command() returned None. Nothing happens.
1831 compile_command() returned None. Nothing happens.
1831
1832
1832 3) The input is complete; compile_command() returned a code
1833 3) The input is complete; compile_command() returned a code
1833 object. The code is executed by calling self.runcode() (which
1834 object. The code is executed by calling self.runcode() (which
1834 also handles run-time exceptions, except for SystemExit).
1835 also handles run-time exceptions, except for SystemExit).
1835
1836
1836 The return value is:
1837 The return value is:
1837
1838
1838 - True in case 2
1839 - True in case 2
1839
1840
1840 - False in the other cases, unless an exception is raised, where
1841 - False in the other cases, unless an exception is raised, where
1841 None is returned instead. This can be used by external callers to
1842 None is returned instead. This can be used by external callers to
1842 know whether to continue feeding input or not.
1843 know whether to continue feeding input or not.
1843
1844
1844 The return value can be used to decide whether to use sys.ps1 or
1845 The return value can be used to decide whether to use sys.ps1 or
1845 sys.ps2 to prompt the next line."""
1846 sys.ps2 to prompt the next line."""
1846
1847
1847 # if the source code has leading blanks, add 'if 1:\n' to it
1848 # if the source code has leading blanks, add 'if 1:\n' to it
1848 # this allows execution of indented pasted code. It is tempting
1849 # this allows execution of indented pasted code. It is tempting
1849 # to add '\n' at the end of source to run commands like ' a=1'
1850 # to add '\n' at the end of source to run commands like ' a=1'
1850 # directly, but this fails for more complicated scenarios
1851 # directly, but this fails for more complicated scenarios
1851 if source[:1] in [' ', '\t']:
1852 if source[:1] in [' ', '\t']:
1852 source = 'if 1:\n%s' % source
1853 source = 'if 1:\n%s' % source
1853
1854
1854 try:
1855 try:
1855 code = self.compile(source,filename,symbol)
1856 code = self.compile(source,filename,symbol)
1856 except (OverflowError, SyntaxError, ValueError):
1857 except (OverflowError, SyntaxError, ValueError):
1857 # Case 1
1858 # Case 1
1858 self.showsyntaxerror(filename)
1859 self.showsyntaxerror(filename)
1859 return None
1860 return None
1860
1861
1861 if code is None:
1862 if code is None:
1862 # Case 2
1863 # Case 2
1863 return True
1864 return True
1864
1865
1865 # Case 3
1866 # Case 3
1866 # We store the code object so that threaded shells and
1867 # We store the code object so that threaded shells and
1867 # custom exception handlers can access all this info if needed.
1868 # custom exception handlers can access all this info if needed.
1868 # The source corresponding to this can be obtained from the
1869 # The source corresponding to this can be obtained from the
1869 # buffer attribute as '\n'.join(self.buffer).
1870 # buffer attribute as '\n'.join(self.buffer).
1870 self.code_to_run = code
1871 self.code_to_run = code
1871 # now actually execute the code object
1872 # now actually execute the code object
1872 if self.runcode(code) == 0:
1873 if self.runcode(code) == 0:
1873 return False
1874 return False
1874 else:
1875 else:
1875 return None
1876 return None
1876
1877
1877 def runcode(self,code_obj):
1878 def runcode(self,code_obj):
1878 """Execute a code object.
1879 """Execute a code object.
1879
1880
1880 When an exception occurs, self.showtraceback() is called to display a
1881 When an exception occurs, self.showtraceback() is called to display a
1881 traceback.
1882 traceback.
1882
1883
1883 Return value: a flag indicating whether the code to be run completed
1884 Return value: a flag indicating whether the code to be run completed
1884 successfully:
1885 successfully:
1885
1886
1886 - 0: successful execution.
1887 - 0: successful execution.
1887 - 1: an error occurred.
1888 - 1: an error occurred.
1888 """
1889 """
1889
1890
1890 # Set our own excepthook in case the user code tries to call it
1891 # Set our own excepthook in case the user code tries to call it
1891 # directly, so that the IPython crash handler doesn't get triggered
1892 # directly, so that the IPython crash handler doesn't get triggered
1892 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1893 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1893
1894
1894 # we save the original sys.excepthook in the instance, in case config
1895 # we save the original sys.excepthook in the instance, in case config
1895 # code (such as magics) needs access to it.
1896 # code (such as magics) needs access to it.
1896 self.sys_excepthook = old_excepthook
1897 self.sys_excepthook = old_excepthook
1897 outflag = 1 # happens in more places, so it's easier as default
1898 outflag = 1 # happens in more places, so it's easier as default
1898 try:
1899 try:
1899 try:
1900 try:
1900 # Embedded instances require separate global/local namespaces
1901 # Embedded instances require separate global/local namespaces
1901 # so they can see both the surrounding (local) namespace and
1902 # so they can see both the surrounding (local) namespace and
1902 # the module-level globals when called inside another function.
1903 # the module-level globals when called inside another function.
1903 if self.embedded:
1904 if self.embedded:
1904 exec code_obj in self.user_global_ns, self.user_ns
1905 exec code_obj in self.user_global_ns, self.user_ns
1905 # Normal (non-embedded) instances should only have a single
1906 # Normal (non-embedded) instances should only have a single
1906 # namespace for user code execution, otherwise functions won't
1907 # namespace for user code execution, otherwise functions won't
1907 # see interactive top-level globals.
1908 # see interactive top-level globals.
1908 else:
1909 else:
1909 exec code_obj in self.user_ns
1910 exec code_obj in self.user_ns
1910 finally:
1911 finally:
1911 # Reset our crash handler in place
1912 # Reset our crash handler in place
1912 sys.excepthook = old_excepthook
1913 sys.excepthook = old_excepthook
1913 except SystemExit:
1914 except SystemExit:
1914 self.resetbuffer()
1915 self.resetbuffer()
1915 self.showtraceback()
1916 self.showtraceback()
1916 warn("Type %exit or %quit to exit IPython "
1917 warn("Type %exit or %quit to exit IPython "
1917 "(%Exit or %Quit do so unconditionally).",level=1)
1918 "(%Exit or %Quit do so unconditionally).",level=1)
1918 except self.custom_exceptions:
1919 except self.custom_exceptions:
1919 etype,value,tb = sys.exc_info()
1920 etype,value,tb = sys.exc_info()
1920 self.CustomTB(etype,value,tb)
1921 self.CustomTB(etype,value,tb)
1921 except:
1922 except:
1922 self.showtraceback()
1923 self.showtraceback()
1923 else:
1924 else:
1924 outflag = 0
1925 outflag = 0
1925 if softspace(sys.stdout, 0):
1926 if softspace(sys.stdout, 0):
1926 print
1927 print
1927 # Flush out code object which has been run (and source)
1928 # Flush out code object which has been run (and source)
1928 self.code_to_run = None
1929 self.code_to_run = None
1929 return outflag
1930 return outflag
1930
1931
1931 def push(self, line):
1932 def push(self, line):
1932 """Push a line to the interpreter.
1933 """Push a line to the interpreter.
1933
1934
1934 The line should not have a trailing newline; it may have
1935 The line should not have a trailing newline; it may have
1935 internal newlines. The line is appended to a buffer and the
1936 internal newlines. The line is appended to a buffer and the
1936 interpreter's runsource() method is called with the
1937 interpreter's runsource() method is called with the
1937 concatenated contents of the buffer as source. If this
1938 concatenated contents of the buffer as source. If this
1938 indicates that the command was executed or invalid, the buffer
1939 indicates that the command was executed or invalid, the buffer
1939 is reset; otherwise, the command is incomplete, and the buffer
1940 is reset; otherwise, the command is incomplete, and the buffer
1940 is left as it was after the line was appended. The return
1941 is left as it was after the line was appended. The return
1941 value is 1 if more input is required, 0 if the line was dealt
1942 value is 1 if more input is required, 0 if the line was dealt
1942 with in some way (this is the same as runsource()).
1943 with in some way (this is the same as runsource()).
1943 """
1944 """
1944
1945
1945 # autoindent management should be done here, and not in the
1946 # autoindent management should be done here, and not in the
1946 # interactive loop, since that one is only seen by keyboard input. We
1947 # interactive loop, since that one is only seen by keyboard input. We
1947 # need this done correctly even for code run via runlines (which uses
1948 # need this done correctly even for code run via runlines (which uses
1948 # push).
1949 # push).
1949
1950
1950 #print 'push line: <%s>' % line # dbg
1951 #print 'push line: <%s>' % line # dbg
1951 for subline in line.splitlines():
1952 for subline in line.splitlines():
1952 self.autoindent_update(subline)
1953 self.autoindent_update(subline)
1953 self.buffer.append(line)
1954 self.buffer.append(line)
1954 more = self.runsource('\n'.join(self.buffer), self.filename)
1955 more = self.runsource('\n'.join(self.buffer), self.filename)
1955 if not more:
1956 if not more:
1956 self.resetbuffer()
1957 self.resetbuffer()
1957 return more
1958 return more
1958
1959
1959 def split_user_input(self, line):
1960 def split_user_input(self, line):
1960 # This is really a hold-over to support ipapi and some extensions
1961 # This is really a hold-over to support ipapi and some extensions
1961 return prefilter.splitUserInput(line)
1962 return prefilter.splitUserInput(line)
1962
1963
1963 def resetbuffer(self):
1964 def resetbuffer(self):
1964 """Reset the input buffer."""
1965 """Reset the input buffer."""
1965 self.buffer[:] = []
1966 self.buffer[:] = []
1966
1967
1967 def raw_input(self,prompt='',continue_prompt=False):
1968 def raw_input(self,prompt='',continue_prompt=False):
1968 """Write a prompt and read a line.
1969 """Write a prompt and read a line.
1969
1970
1970 The returned line does not include the trailing newline.
1971 The returned line does not include the trailing newline.
1971 When the user enters the EOF key sequence, EOFError is raised.
1972 When the user enters the EOF key sequence, EOFError is raised.
1972
1973
1973 Optional inputs:
1974 Optional inputs:
1974
1975
1975 - prompt(''): a string to be printed to prompt the user.
1976 - prompt(''): a string to be printed to prompt the user.
1976
1977
1977 - continue_prompt(False): whether this line is the first one or a
1978 - continue_prompt(False): whether this line is the first one or a
1978 continuation in a sequence of inputs.
1979 continuation in a sequence of inputs.
1979 """
1980 """
1980
1981
1981 # Code run by the user may have modified the readline completer state.
1982 # Code run by the user may have modified the readline completer state.
1982 # We must ensure that our completer is back in place.
1983 # We must ensure that our completer is back in place.
1983 if self.has_readline:
1984 if self.has_readline:
1984 self.set_completer()
1985 self.set_completer()
1985
1986
1986 try:
1987 try:
1987 line = raw_input_original(prompt).decode(self.stdin_encoding)
1988 line = raw_input_original(prompt).decode(self.stdin_encoding)
1988 except ValueError:
1989 except ValueError:
1989 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
1990 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
1990 " or sys.stdout.close()!\nExiting IPython!")
1991 " or sys.stdout.close()!\nExiting IPython!")
1991 self.exit_now = True
1992 self.exit_now = True
1992 return ""
1993 return ""
1993
1994
1994 # Try to be reasonably smart about not re-indenting pasted input more
1995 # Try to be reasonably smart about not re-indenting pasted input more
1995 # than necessary. We do this by trimming out the auto-indent initial
1996 # than necessary. We do this by trimming out the auto-indent initial
1996 # spaces, if the user's actual input started itself with whitespace.
1997 # spaces, if the user's actual input started itself with whitespace.
1997 #debugx('self.buffer[-1]')
1998 #debugx('self.buffer[-1]')
1998
1999
1999 if self.autoindent:
2000 if self.autoindent:
2000 if num_ini_spaces(line) > self.indent_current_nsp:
2001 if num_ini_spaces(line) > self.indent_current_nsp:
2001 line = line[self.indent_current_nsp:]
2002 line = line[self.indent_current_nsp:]
2002 self.indent_current_nsp = 0
2003 self.indent_current_nsp = 0
2003
2004
2004 # store the unfiltered input before the user has any chance to modify
2005 # store the unfiltered input before the user has any chance to modify
2005 # it.
2006 # it.
2006 if line.strip():
2007 if line.strip():
2007 if continue_prompt:
2008 if continue_prompt:
2008 self.input_hist_raw[-1] += '%s\n' % line
2009 self.input_hist_raw[-1] += '%s\n' % line
2009 if self.has_readline: # and some config option is set?
2010 if self.has_readline: # and some config option is set?
2010 try:
2011 try:
2011 histlen = self.readline.get_current_history_length()
2012 histlen = self.readline.get_current_history_length()
2012 newhist = self.input_hist_raw[-1].rstrip()
2013 newhist = self.input_hist_raw[-1].rstrip()
2013 self.readline.remove_history_item(histlen-1)
2014 self.readline.remove_history_item(histlen-1)
2014 self.readline.replace_history_item(histlen-2,newhist)
2015 self.readline.replace_history_item(histlen-2,newhist)
2015 except AttributeError:
2016 except AttributeError:
2016 pass # re{move,place}_history_item are new in 2.4.
2017 pass # re{move,place}_history_item are new in 2.4.
2017 else:
2018 else:
2018 self.input_hist_raw.append('%s\n' % line)
2019 self.input_hist_raw.append('%s\n' % line)
2019
2020
2020 if line.lstrip() == line:
2021 if line.lstrip() == line:
2021 self.shadowhist.add(line.strip())
2022 self.shadowhist.add(line.strip())
2022
2023
2023 try:
2024 try:
2024 lineout = self.prefilter(line,continue_prompt)
2025 lineout = self.prefilter(line,continue_prompt)
2025 except:
2026 except:
2026 # blanket except, in case a user-defined prefilter crashes, so it
2027 # blanket except, in case a user-defined prefilter crashes, so it
2027 # can't take all of ipython with it.
2028 # can't take all of ipython with it.
2028 self.showtraceback()
2029 self.showtraceback()
2029 return ''
2030 return ''
2030 else:
2031 else:
2031 return lineout
2032 return lineout
2032
2033
2033 def _prefilter(self, line, continue_prompt):
2034 def _prefilter(self, line, continue_prompt):
2034 """Calls different preprocessors, depending on the form of line."""
2035 """Calls different preprocessors, depending on the form of line."""
2035
2036
2036 # All handlers *must* return a value, even if it's blank ('').
2037 # All handlers *must* return a value, even if it's blank ('').
2037
2038
2038 # Lines are NOT logged here. Handlers should process the line as
2039 # Lines are NOT logged here. Handlers should process the line as
2039 # needed, update the cache AND log it (so that the input cache array
2040 # needed, update the cache AND log it (so that the input cache array
2040 # stays synced).
2041 # stays synced).
2041
2042
2042 #.....................................................................
2043 #.....................................................................
2043 # Code begins
2044 # Code begins
2044
2045
2045 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2046 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2046
2047
2047 # save the line away in case we crash, so the post-mortem handler can
2048 # save the line away in case we crash, so the post-mortem handler can
2048 # record it
2049 # record it
2049 self._last_input_line = line
2050 self._last_input_line = line
2050
2051
2051 #print '***line: <%s>' % line # dbg
2052 #print '***line: <%s>' % line # dbg
2052
2053
2053 line_info = prefilter.LineInfo(line, continue_prompt)
2054 line_info = prefilter.LineInfo(line, continue_prompt)
2054
2055
2055 # the input history needs to track even empty lines
2056 # the input history needs to track even empty lines
2056 stripped = line.strip()
2057 stripped = line.strip()
2057
2058
2058 if not stripped:
2059 if not stripped:
2059 if not continue_prompt:
2060 if not continue_prompt:
2060 self.outputcache.prompt_count -= 1
2061 self.outputcache.prompt_count -= 1
2061 return self.handle_normal(line_info)
2062 return self.handle_normal(line_info)
2062
2063
2063 # print '***cont',continue_prompt # dbg
2064 # print '***cont',continue_prompt # dbg
2064 # special handlers are only allowed for single line statements
2065 # special handlers are only allowed for single line statements
2065 if continue_prompt and not self.rc.multi_line_specials:
2066 if continue_prompt and not self.rc.multi_line_specials:
2066 return self.handle_normal(line_info)
2067 return self.handle_normal(line_info)
2067
2068
2068
2069
2069 # See whether any pre-existing handler can take care of it
2070 # See whether any pre-existing handler can take care of it
2070 rewritten = self.hooks.input_prefilter(stripped)
2071 rewritten = self.hooks.input_prefilter(stripped)
2071 if rewritten != stripped: # ok, some prefilter did something
2072 if rewritten != stripped: # ok, some prefilter did something
2072 rewritten = line_info.pre + rewritten # add indentation
2073 rewritten = line_info.pre + rewritten # add indentation
2073 return self.handle_normal(prefilter.LineInfo(rewritten,
2074 return self.handle_normal(prefilter.LineInfo(rewritten,
2074 continue_prompt))
2075 continue_prompt))
2075
2076
2076 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2077 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2077
2078
2078 return prefilter.prefilter(line_info, self)
2079 return prefilter.prefilter(line_info, self)
2079
2080
2080
2081
2081 def _prefilter_dumb(self, line, continue_prompt):
2082 def _prefilter_dumb(self, line, continue_prompt):
2082 """simple prefilter function, for debugging"""
2083 """simple prefilter function, for debugging"""
2083 return self.handle_normal(line,continue_prompt)
2084 return self.handle_normal(line,continue_prompt)
2084
2085
2085
2086
2086 def multiline_prefilter(self, line, continue_prompt):
2087 def multiline_prefilter(self, line, continue_prompt):
2087 """ Run _prefilter for each line of input
2088 """ Run _prefilter for each line of input
2088
2089
2089 Covers cases where there are multiple lines in the user entry,
2090 Covers cases where there are multiple lines in the user entry,
2090 which is the case when the user goes back to a multiline history
2091 which is the case when the user goes back to a multiline history
2091 entry and presses enter.
2092 entry and presses enter.
2092
2093
2093 """
2094 """
2094 out = []
2095 out = []
2095 for l in line.rstrip('\n').split('\n'):
2096 for l in line.rstrip('\n').split('\n'):
2096 out.append(self._prefilter(l, continue_prompt))
2097 out.append(self._prefilter(l, continue_prompt))
2097 return '\n'.join(out)
2098 return '\n'.join(out)
2098
2099
2099 # Set the default prefilter() function (this can be user-overridden)
2100 # Set the default prefilter() function (this can be user-overridden)
2100 prefilter = multiline_prefilter
2101 prefilter = multiline_prefilter
2101
2102
2102 def handle_normal(self,line_info):
2103 def handle_normal(self,line_info):
2103 """Handle normal input lines. Use as a template for handlers."""
2104 """Handle normal input lines. Use as a template for handlers."""
2104
2105
2105 # With autoindent on, we need some way to exit the input loop, and I
2106 # With autoindent on, we need some way to exit the input loop, and I
2106 # don't want to force the user to have to backspace all the way to
2107 # don't want to force the user to have to backspace all the way to
2107 # clear the line. The rule will be in this case, that either two
2108 # clear the line. The rule will be in this case, that either two
2108 # lines of pure whitespace in a row, or a line of pure whitespace but
2109 # lines of pure whitespace in a row, or a line of pure whitespace but
2109 # of a size different to the indent level, will exit the input loop.
2110 # of a size different to the indent level, will exit the input loop.
2110 line = line_info.line
2111 line = line_info.line
2111 continue_prompt = line_info.continue_prompt
2112 continue_prompt = line_info.continue_prompt
2112
2113
2113 if (continue_prompt and self.autoindent and line.isspace() and
2114 if (continue_prompt and self.autoindent and line.isspace() and
2114 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2115 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2115 (self.buffer[-1]).isspace() )):
2116 (self.buffer[-1]).isspace() )):
2116 line = ''
2117 line = ''
2117
2118
2118 self.log(line,line,continue_prompt)
2119 self.log(line,line,continue_prompt)
2119 return line
2120 return line
2120
2121
2121 def handle_alias(self,line_info):
2122 def handle_alias(self,line_info):
2122 """Handle alias input lines. """
2123 """Handle alias input lines. """
2124 tgt = self.alias_table[line_info.iFun]
2125 # print "=>",tgt #dbg
2126 if callable(tgt):
2127 line_out = "_sh." + line_info.iFun + '(r"""' + line_info.theRest + '""")'
2128 else:
2123 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2129 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2124
2130
2125 # pre is needed, because it carries the leading whitespace. Otherwise
2131 # pre is needed, because it carries the leading whitespace. Otherwise
2126 # aliases won't work in indented sections.
2132 # aliases won't work in indented sections.
2127 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2133 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2128 make_quoted_expr( transformed ))
2134 make_quoted_expr( transformed ))
2129
2135
2130 self.log(line_info.line,line_out,line_info.continue_prompt)
2136 self.log(line_info.line,line_out,line_info.continue_prompt)
2131 #print 'line out:',line_out # dbg
2137 #print 'line out:',line_out # dbg
2132 return line_out
2138 return line_out
2133
2139
2134 def handle_shell_escape(self, line_info):
2140 def handle_shell_escape(self, line_info):
2135 """Execute the line in a shell, empty return value"""
2141 """Execute the line in a shell, empty return value"""
2136 #print 'line in :', `line` # dbg
2142 #print 'line in :', `line` # dbg
2137 line = line_info.line
2143 line = line_info.line
2138 if line.lstrip().startswith('!!'):
2144 if line.lstrip().startswith('!!'):
2139 # rewrite LineInfo's line, iFun and theRest to properly hold the
2145 # rewrite LineInfo's line, iFun and theRest to properly hold the
2140 # call to %sx and the actual command to be executed, so
2146 # call to %sx and the actual command to be executed, so
2141 # handle_magic can work correctly. Note that this works even if
2147 # handle_magic can work correctly. Note that this works even if
2142 # the line is indented, so it handles multi_line_specials
2148 # the line is indented, so it handles multi_line_specials
2143 # properly.
2149 # properly.
2144 new_rest = line.lstrip()[2:]
2150 new_rest = line.lstrip()[2:]
2145 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2151 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2146 line_info.iFun = 'sx'
2152 line_info.iFun = 'sx'
2147 line_info.theRest = new_rest
2153 line_info.theRest = new_rest
2148 return self.handle_magic(line_info)
2154 return self.handle_magic(line_info)
2149 else:
2155 else:
2150 cmd = line.lstrip().lstrip('!')
2156 cmd = line.lstrip().lstrip('!')
2151 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2157 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2152 make_quoted_expr(cmd))
2158 make_quoted_expr(cmd))
2153 # update cache/log and return
2159 # update cache/log and return
2154 self.log(line,line_out,line_info.continue_prompt)
2160 self.log(line,line_out,line_info.continue_prompt)
2155 return line_out
2161 return line_out
2156
2162
2157 def handle_magic(self, line_info):
2163 def handle_magic(self, line_info):
2158 """Execute magic functions."""
2164 """Execute magic functions."""
2159 iFun = line_info.iFun
2165 iFun = line_info.iFun
2160 theRest = line_info.theRest
2166 theRest = line_info.theRest
2161 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2167 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2162 make_quoted_expr(iFun + " " + theRest))
2168 make_quoted_expr(iFun + " " + theRest))
2163 self.log(line_info.line,cmd,line_info.continue_prompt)
2169 self.log(line_info.line,cmd,line_info.continue_prompt)
2164 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2170 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2165 return cmd
2171 return cmd
2166
2172
2167 def handle_auto(self, line_info):
2173 def handle_auto(self, line_info):
2168 """Hande lines which can be auto-executed, quoting if requested."""
2174 """Hande lines which can be auto-executed, quoting if requested."""
2169
2175
2170 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2176 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2171 line = line_info.line
2177 line = line_info.line
2172 iFun = line_info.iFun
2178 iFun = line_info.iFun
2173 theRest = line_info.theRest
2179 theRest = line_info.theRest
2174 pre = line_info.pre
2180 pre = line_info.pre
2175 continue_prompt = line_info.continue_prompt
2181 continue_prompt = line_info.continue_prompt
2176 obj = line_info.ofind(self)['obj']
2182 obj = line_info.ofind(self)['obj']
2177
2183
2178 # This should only be active for single-line input!
2184 # This should only be active for single-line input!
2179 if continue_prompt:
2185 if continue_prompt:
2180 self.log(line,line,continue_prompt)
2186 self.log(line,line,continue_prompt)
2181 return line
2187 return line
2182
2188
2183 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2189 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2184 auto_rewrite = True
2190 auto_rewrite = True
2185
2191
2186 if pre == self.ESC_QUOTE:
2192 if pre == self.ESC_QUOTE:
2187 # Auto-quote splitting on whitespace
2193 # Auto-quote splitting on whitespace
2188 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2194 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2189 elif pre == self.ESC_QUOTE2:
2195 elif pre == self.ESC_QUOTE2:
2190 # Auto-quote whole string
2196 # Auto-quote whole string
2191 newcmd = '%s("%s")' % (iFun,theRest)
2197 newcmd = '%s("%s")' % (iFun,theRest)
2192 elif pre == self.ESC_PAREN:
2198 elif pre == self.ESC_PAREN:
2193 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2199 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2194 else:
2200 else:
2195 # Auto-paren.
2201 # Auto-paren.
2196 # We only apply it to argument-less calls if the autocall
2202 # We only apply it to argument-less calls if the autocall
2197 # parameter is set to 2. We only need to check that autocall is <
2203 # parameter is set to 2. We only need to check that autocall is <
2198 # 2, since this function isn't called unless it's at least 1.
2204 # 2, since this function isn't called unless it's at least 1.
2199 if not theRest and (self.rc.autocall < 2) and not force_auto:
2205 if not theRest and (self.rc.autocall < 2) and not force_auto:
2200 newcmd = '%s %s' % (iFun,theRest)
2206 newcmd = '%s %s' % (iFun,theRest)
2201 auto_rewrite = False
2207 auto_rewrite = False
2202 else:
2208 else:
2203 if not force_auto and theRest.startswith('['):
2209 if not force_auto and theRest.startswith('['):
2204 if hasattr(obj,'__getitem__'):
2210 if hasattr(obj,'__getitem__'):
2205 # Don't autocall in this case: item access for an object
2211 # Don't autocall in this case: item access for an object
2206 # which is BOTH callable and implements __getitem__.
2212 # which is BOTH callable and implements __getitem__.
2207 newcmd = '%s %s' % (iFun,theRest)
2213 newcmd = '%s %s' % (iFun,theRest)
2208 auto_rewrite = False
2214 auto_rewrite = False
2209 else:
2215 else:
2210 # if the object doesn't support [] access, go ahead and
2216 # if the object doesn't support [] access, go ahead and
2211 # autocall
2217 # autocall
2212 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2218 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2213 elif theRest.endswith(';'):
2219 elif theRest.endswith(';'):
2214 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2220 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2215 else:
2221 else:
2216 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2222 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2217
2223
2218 if auto_rewrite:
2224 if auto_rewrite:
2219 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2225 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2220
2226
2221 try:
2227 try:
2222 # plain ascii works better w/ pyreadline, on some machines, so
2228 # plain ascii works better w/ pyreadline, on some machines, so
2223 # we use it and only print uncolored rewrite if we have unicode
2229 # we use it and only print uncolored rewrite if we have unicode
2224 rw = str(rw)
2230 rw = str(rw)
2225 print >>Term.cout, rw
2231 print >>Term.cout, rw
2226 except UnicodeEncodeError:
2232 except UnicodeEncodeError:
2227 print "-------------->" + newcmd
2233 print "-------------->" + newcmd
2228
2234
2229 # log what is now valid Python, not the actual user input (without the
2235 # log what is now valid Python, not the actual user input (without the
2230 # final newline)
2236 # final newline)
2231 self.log(line,newcmd,continue_prompt)
2237 self.log(line,newcmd,continue_prompt)
2232 return newcmd
2238 return newcmd
2233
2239
2234 def handle_help(self, line_info):
2240 def handle_help(self, line_info):
2235 """Try to get some help for the object.
2241 """Try to get some help for the object.
2236
2242
2237 obj? or ?obj -> basic information.
2243 obj? or ?obj -> basic information.
2238 obj?? or ??obj -> more details.
2244 obj?? or ??obj -> more details.
2239 """
2245 """
2240
2246
2241 line = line_info.line
2247 line = line_info.line
2242 # We need to make sure that we don't process lines which would be
2248 # We need to make sure that we don't process lines which would be
2243 # otherwise valid python, such as "x=1 # what?"
2249 # otherwise valid python, such as "x=1 # what?"
2244 try:
2250 try:
2245 codeop.compile_command(line)
2251 codeop.compile_command(line)
2246 except SyntaxError:
2252 except SyntaxError:
2247 # We should only handle as help stuff which is NOT valid syntax
2253 # We should only handle as help stuff which is NOT valid syntax
2248 if line[0]==self.ESC_HELP:
2254 if line[0]==self.ESC_HELP:
2249 line = line[1:]
2255 line = line[1:]
2250 elif line[-1]==self.ESC_HELP:
2256 elif line[-1]==self.ESC_HELP:
2251 line = line[:-1]
2257 line = line[:-1]
2252 self.log(line,'#?'+line,line_info.continue_prompt)
2258 self.log(line,'#?'+line,line_info.continue_prompt)
2253 if line:
2259 if line:
2254 #print 'line:<%r>' % line # dbg
2260 #print 'line:<%r>' % line # dbg
2255 self.magic_pinfo(line)
2261 self.magic_pinfo(line)
2256 else:
2262 else:
2257 page(self.usage,screen_lines=self.rc.screen_length)
2263 page(self.usage,screen_lines=self.rc.screen_length)
2258 return '' # Empty string is needed here!
2264 return '' # Empty string is needed here!
2259 except:
2265 except:
2260 # Pass any other exceptions through to the normal handler
2266 # Pass any other exceptions through to the normal handler
2261 return self.handle_normal(line_info)
2267 return self.handle_normal(line_info)
2262 else:
2268 else:
2263 # If the code compiles ok, we should handle it normally
2269 # If the code compiles ok, we should handle it normally
2264 return self.handle_normal(line_info)
2270 return self.handle_normal(line_info)
2265
2271
2266 def getapi(self):
2272 def getapi(self):
2267 """ Get an IPApi object for this shell instance
2273 """ Get an IPApi object for this shell instance
2268
2274
2269 Getting an IPApi object is always preferable to accessing the shell
2275 Getting an IPApi object is always preferable to accessing the shell
2270 directly, but this holds true especially for extensions.
2276 directly, but this holds true especially for extensions.
2271
2277
2272 It should always be possible to implement an extension with IPApi
2278 It should always be possible to implement an extension with IPApi
2273 alone. If not, contact maintainer to request an addition.
2279 alone. If not, contact maintainer to request an addition.
2274
2280
2275 """
2281 """
2276 return self.api
2282 return self.api
2277
2283
2278 def handle_emacs(self, line_info):
2284 def handle_emacs(self, line_info):
2279 """Handle input lines marked by python-mode."""
2285 """Handle input lines marked by python-mode."""
2280
2286
2281 # Currently, nothing is done. Later more functionality can be added
2287 # Currently, nothing is done. Later more functionality can be added
2282 # here if needed.
2288 # here if needed.
2283
2289
2284 # The input cache shouldn't be updated
2290 # The input cache shouldn't be updated
2285 return line_info.line
2291 return line_info.line
2286
2292
2287
2293
2288 def mktempfile(self,data=None):
2294 def mktempfile(self,data=None):
2289 """Make a new tempfile and return its filename.
2295 """Make a new tempfile and return its filename.
2290
2296
2291 This makes a call to tempfile.mktemp, but it registers the created
2297 This makes a call to tempfile.mktemp, but it registers the created
2292 filename internally so ipython cleans it up at exit time.
2298 filename internally so ipython cleans it up at exit time.
2293
2299
2294 Optional inputs:
2300 Optional inputs:
2295
2301
2296 - data(None): if data is given, it gets written out to the temp file
2302 - data(None): if data is given, it gets written out to the temp file
2297 immediately, and the file is closed again."""
2303 immediately, and the file is closed again."""
2298
2304
2299 filename = tempfile.mktemp('.py','ipython_edit_')
2305 filename = tempfile.mktemp('.py','ipython_edit_')
2300 self.tempfiles.append(filename)
2306 self.tempfiles.append(filename)
2301
2307
2302 if data:
2308 if data:
2303 tmp_file = open(filename,'w')
2309 tmp_file = open(filename,'w')
2304 tmp_file.write(data)
2310 tmp_file.write(data)
2305 tmp_file.close()
2311 tmp_file.close()
2306 return filename
2312 return filename
2307
2313
2308 def write(self,data):
2314 def write(self,data):
2309 """Write a string to the default output"""
2315 """Write a string to the default output"""
2310 Term.cout.write(data)
2316 Term.cout.write(data)
2311
2317
2312 def write_err(self,data):
2318 def write_err(self,data):
2313 """Write a string to the default error output"""
2319 """Write a string to the default error output"""
2314 Term.cerr.write(data)
2320 Term.cerr.write(data)
2315
2321
2316 def exit(self):
2322 def exit(self):
2317 """Handle interactive exit.
2323 """Handle interactive exit.
2318
2324
2319 This method sets the exit_now attribute."""
2325 This method sets the exit_now attribute."""
2320
2326
2321 if self.rc.confirm_exit:
2327 if self.rc.confirm_exit:
2322 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2328 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2323 self.exit_now = True
2329 self.exit_now = True
2324 else:
2330 else:
2325 self.exit_now = True
2331 self.exit_now = True
2326
2332
2327 def safe_execfile(self,fname,*where,**kw):
2333 def safe_execfile(self,fname,*where,**kw):
2328 """A safe version of the builtin execfile().
2334 """A safe version of the builtin execfile().
2329
2335
2330 This version will never throw an exception, and knows how to handle
2336 This version will never throw an exception, and knows how to handle
2331 ipython logs as well."""
2337 ipython logs as well."""
2332
2338
2333 def syspath_cleanup():
2339 def syspath_cleanup():
2334 """Internal cleanup routine for sys.path."""
2340 """Internal cleanup routine for sys.path."""
2335 if add_dname:
2341 if add_dname:
2336 try:
2342 try:
2337 sys.path.remove(dname)
2343 sys.path.remove(dname)
2338 except ValueError:
2344 except ValueError:
2339 # For some reason the user has already removed it, ignore.
2345 # For some reason the user has already removed it, ignore.
2340 pass
2346 pass
2341
2347
2342 fname = os.path.expanduser(fname)
2348 fname = os.path.expanduser(fname)
2343
2349
2344 # Find things also in current directory. This is needed to mimic the
2350 # Find things also in current directory. This is needed to mimic the
2345 # behavior of running a script from the system command line, where
2351 # behavior of running a script from the system command line, where
2346 # Python inserts the script's directory into sys.path
2352 # Python inserts the script's directory into sys.path
2347 dname = os.path.dirname(os.path.abspath(fname))
2353 dname = os.path.dirname(os.path.abspath(fname))
2348 add_dname = False
2354 add_dname = False
2349 if dname not in sys.path:
2355 if dname not in sys.path:
2350 sys.path.insert(0,dname)
2356 sys.path.insert(0,dname)
2351 add_dname = True
2357 add_dname = True
2352
2358
2353 try:
2359 try:
2354 xfile = open(fname)
2360 xfile = open(fname)
2355 except:
2361 except:
2356 print >> Term.cerr, \
2362 print >> Term.cerr, \
2357 'Could not open file <%s> for safe execution.' % fname
2363 'Could not open file <%s> for safe execution.' % fname
2358 syspath_cleanup()
2364 syspath_cleanup()
2359 return None
2365 return None
2360
2366
2361 kw.setdefault('islog',0)
2367 kw.setdefault('islog',0)
2362 kw.setdefault('quiet',1)
2368 kw.setdefault('quiet',1)
2363 kw.setdefault('exit_ignore',0)
2369 kw.setdefault('exit_ignore',0)
2364 first = xfile.readline()
2370 first = xfile.readline()
2365 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2371 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2366 xfile.close()
2372 xfile.close()
2367 # line by line execution
2373 # line by line execution
2368 if first.startswith(loghead) or kw['islog']:
2374 if first.startswith(loghead) or kw['islog']:
2369 print 'Loading log file <%s> one line at a time...' % fname
2375 print 'Loading log file <%s> one line at a time...' % fname
2370 if kw['quiet']:
2376 if kw['quiet']:
2371 stdout_save = sys.stdout
2377 stdout_save = sys.stdout
2372 sys.stdout = StringIO.StringIO()
2378 sys.stdout = StringIO.StringIO()
2373 try:
2379 try:
2374 globs,locs = where[0:2]
2380 globs,locs = where[0:2]
2375 except:
2381 except:
2376 try:
2382 try:
2377 globs = locs = where[0]
2383 globs = locs = where[0]
2378 except:
2384 except:
2379 globs = locs = globals()
2385 globs = locs = globals()
2380 badblocks = []
2386 badblocks = []
2381
2387
2382 # we also need to identify indented blocks of code when replaying
2388 # we also need to identify indented blocks of code when replaying
2383 # logs and put them together before passing them to an exec
2389 # logs and put them together before passing them to an exec
2384 # statement. This takes a bit of regexp and look-ahead work in the
2390 # statement. This takes a bit of regexp and look-ahead work in the
2385 # file. It's easiest if we swallow the whole thing in memory
2391 # file. It's easiest if we swallow the whole thing in memory
2386 # first, and manually walk through the lines list moving the
2392 # first, and manually walk through the lines list moving the
2387 # counter ourselves.
2393 # counter ourselves.
2388 indent_re = re.compile('\s+\S')
2394 indent_re = re.compile('\s+\S')
2389 xfile = open(fname)
2395 xfile = open(fname)
2390 filelines = xfile.readlines()
2396 filelines = xfile.readlines()
2391 xfile.close()
2397 xfile.close()
2392 nlines = len(filelines)
2398 nlines = len(filelines)
2393 lnum = 0
2399 lnum = 0
2394 while lnum < nlines:
2400 while lnum < nlines:
2395 line = filelines[lnum]
2401 line = filelines[lnum]
2396 lnum += 1
2402 lnum += 1
2397 # don't re-insert logger status info into cache
2403 # don't re-insert logger status info into cache
2398 if line.startswith('#log#'):
2404 if line.startswith('#log#'):
2399 continue
2405 continue
2400 else:
2406 else:
2401 # build a block of code (maybe a single line) for execution
2407 # build a block of code (maybe a single line) for execution
2402 block = line
2408 block = line
2403 try:
2409 try:
2404 next = filelines[lnum] # lnum has already incremented
2410 next = filelines[lnum] # lnum has already incremented
2405 except:
2411 except:
2406 next = None
2412 next = None
2407 while next and indent_re.match(next):
2413 while next and indent_re.match(next):
2408 block += next
2414 block += next
2409 lnum += 1
2415 lnum += 1
2410 try:
2416 try:
2411 next = filelines[lnum]
2417 next = filelines[lnum]
2412 except:
2418 except:
2413 next = None
2419 next = None
2414 # now execute the block of one or more lines
2420 # now execute the block of one or more lines
2415 try:
2421 try:
2416 exec block in globs,locs
2422 exec block in globs,locs
2417 except SystemExit:
2423 except SystemExit:
2418 pass
2424 pass
2419 except:
2425 except:
2420 badblocks.append(block.rstrip())
2426 badblocks.append(block.rstrip())
2421 if kw['quiet']: # restore stdout
2427 if kw['quiet']: # restore stdout
2422 sys.stdout.close()
2428 sys.stdout.close()
2423 sys.stdout = stdout_save
2429 sys.stdout = stdout_save
2424 print 'Finished replaying log file <%s>' % fname
2430 print 'Finished replaying log file <%s>' % fname
2425 if badblocks:
2431 if badblocks:
2426 print >> sys.stderr, ('\nThe following lines/blocks in file '
2432 print >> sys.stderr, ('\nThe following lines/blocks in file '
2427 '<%s> reported errors:' % fname)
2433 '<%s> reported errors:' % fname)
2428
2434
2429 for badline in badblocks:
2435 for badline in badblocks:
2430 print >> sys.stderr, badline
2436 print >> sys.stderr, badline
2431 else: # regular file execution
2437 else: # regular file execution
2432 try:
2438 try:
2433 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2439 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2434 # Work around a bug in Python for Windows. The bug was
2440 # Work around a bug in Python for Windows. The bug was
2435 # fixed in in Python 2.5 r54159 and 54158, but that's still
2441 # fixed in in Python 2.5 r54159 and 54158, but that's still
2436 # SVN Python as of March/07. For details, see:
2442 # SVN Python as of March/07. For details, see:
2437 # http://projects.scipy.org/ipython/ipython/ticket/123
2443 # http://projects.scipy.org/ipython/ipython/ticket/123
2438 try:
2444 try:
2439 globs,locs = where[0:2]
2445 globs,locs = where[0:2]
2440 except:
2446 except:
2441 try:
2447 try:
2442 globs = locs = where[0]
2448 globs = locs = where[0]
2443 except:
2449 except:
2444 globs = locs = globals()
2450 globs = locs = globals()
2445 exec file(fname) in globs,locs
2451 exec file(fname) in globs,locs
2446 else:
2452 else:
2447 execfile(fname,*where)
2453 execfile(fname,*where)
2448 except SyntaxError:
2454 except SyntaxError:
2449 self.showsyntaxerror()
2455 self.showsyntaxerror()
2450 warn('Failure executing file: <%s>' % fname)
2456 warn('Failure executing file: <%s>' % fname)
2451 except SystemExit,status:
2457 except SystemExit,status:
2452 if not kw['exit_ignore']:
2458 if not kw['exit_ignore']:
2453 self.showtraceback()
2459 self.showtraceback()
2454 warn('Failure executing file: <%s>' % fname)
2460 warn('Failure executing file: <%s>' % fname)
2455 except:
2461 except:
2456 self.showtraceback()
2462 self.showtraceback()
2457 warn('Failure executing file: <%s>' % fname)
2463 warn('Failure executing file: <%s>' % fname)
2458
2464
2459 syspath_cleanup()
2465 syspath_cleanup()
2460
2466
2461 #************************* end of file <iplib.py> *****************************
2467 #************************* end of file <iplib.py> *****************************
@@ -1,6824 +1,6838 b''
1 2007-06-28 Ville Vainio <vivainio@gmail.com>
2
3 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
4 Implement "shadow" namespace, and callable aliases that reside there.
5 Use them by:
6
7 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
8
9 foo hello world
10 (gets translated to:)
11 _sh.foo(r"""hello world""")
12
13 In practice, this kind of alias can take the role of a magic function
14
1 2007-06-14 Ville Vainio <vivainio@gmail.com>
15 2007-06-14 Ville Vainio <vivainio@gmail.com>
2
16
3 * iplib.py (handle_auto): Try to use ascii for printing "--->"
17 * iplib.py (handle_auto): Try to use ascii for printing "--->"
4 autocall rewrite indication, becausesometimes unicode fails to print
18 autocall rewrite indication, becausesometimes unicode fails to print
5 properly (and you get ' - - - '). Use plain uncoloured ---> for
19 properly (and you get ' - - - '). Use plain uncoloured ---> for
6 unicode.
20 unicode.
7
21
8 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
22 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
9
23
10 . pickleshare 'hash' commands (hget, hset, hcompress,
24 . pickleshare 'hash' commands (hget, hset, hcompress,
11 hdict) for efficient shadow history storage.
25 hdict) for efficient shadow history storage.
12
26
13 2007-06-13 Ville Vainio <vivainio@gmail.com>
27 2007-06-13 Ville Vainio <vivainio@gmail.com>
14
28
15 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
29 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
16 Added kw arg 'interactive', tell whether vars should be visible
30 Added kw arg 'interactive', tell whether vars should be visible
17 with %whos.
31 with %whos.
18
32
19 2007-06-11 Ville Vainio <vivainio@gmail.com>
33 2007-06-11 Ville Vainio <vivainio@gmail.com>
20
34
21 * pspersistence.py, Magic.py, iplib.py: directory history now saved
35 * pspersistence.py, Magic.py, iplib.py: directory history now saved
22 to db
36 to db
23
37
24 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
38 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
25 Also, it exits IPython immediately after evaluating the command (just like
39 Also, it exits IPython immediately after evaluating the command (just like
26 std python)
40 std python)
27
41
28 2007-06-05 Walter Doerwald <walter@livinglogic.de>
42 2007-06-05 Walter Doerwald <walter@livinglogic.de>
29
43
30 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
44 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
31 Python string and captures the output. (Idea and original patch by
45 Python string and captures the output. (Idea and original patch by
32 StοΏ½fan van der Walt)
46 StοΏ½fan van der Walt)
33
47
34 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
48 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
35
49
36 * IPython/ultraTB.py (VerboseTB.text): update printing of
50 * IPython/ultraTB.py (VerboseTB.text): update printing of
37 exception types for Python 2.5 (now all exceptions in the stdlib
51 exception types for Python 2.5 (now all exceptions in the stdlib
38 are new-style classes).
52 are new-style classes).
39
53
40 2007-05-31 Walter Doerwald <walter@livinglogic.de>
54 2007-05-31 Walter Doerwald <walter@livinglogic.de>
41
55
42 * IPython/Extensions/igrid.py: Add new commands refresh and
56 * IPython/Extensions/igrid.py: Add new commands refresh and
43 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
57 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
44 the iterator once (refresh) or after every x seconds (refresh_timer).
58 the iterator once (refresh) or after every x seconds (refresh_timer).
45 Add a working implementation of "searchexpression", where the text
59 Add a working implementation of "searchexpression", where the text
46 entered is not the text to search for, but an expression that must
60 entered is not the text to search for, but an expression that must
47 be true. Added display of shortcuts to the menu. Added commands "pickinput"
61 be true. Added display of shortcuts to the menu. Added commands "pickinput"
48 and "pickinputattr" that put the object or attribute under the cursor
62 and "pickinputattr" that put the object or attribute under the cursor
49 in the input line. Split the statusbar to be able to display the currently
63 in the input line. Split the statusbar to be able to display the currently
50 active refresh interval. (Patch by Nik Tautenhahn)
64 active refresh interval. (Patch by Nik Tautenhahn)
51
65
52 2007-05-29 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
66 2007-05-29 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
53
67
54 * fixing set_term_title to use ctypes as default
68 * fixing set_term_title to use ctypes as default
55
69
56 * fixing set_term_title fallback to work when curent dir
70 * fixing set_term_title fallback to work when curent dir
57 is on a windows network share
71 is on a windows network share
58
72
59 2007-05-28 Ville Vainio <vivainio@gmail.com>
73 2007-05-28 Ville Vainio <vivainio@gmail.com>
60
74
61 * %cpaste: strip + with > from left (diffs).
75 * %cpaste: strip + with > from left (diffs).
62
76
63 * iplib.py: Fix crash when readline not installed
77 * iplib.py: Fix crash when readline not installed
64
78
65 2007-05-26 Ville Vainio <vivainio@gmail.com>
79 2007-05-26 Ville Vainio <vivainio@gmail.com>
66
80
67 * generics.py: intruduce easy to extend result_display generic
81 * generics.py: intruduce easy to extend result_display generic
68 function (using simplegeneric.py).
82 function (using simplegeneric.py).
69
83
70 * Fixed the append functionality of %set.
84 * Fixed the append functionality of %set.
71
85
72 2007-05-25 Ville Vainio <vivainio@gmail.com>
86 2007-05-25 Ville Vainio <vivainio@gmail.com>
73
87
74 * New magic: %rep (fetch / run old commands from history)
88 * New magic: %rep (fetch / run old commands from history)
75
89
76 * New extension: mglob (%mglob magic), for powerful glob / find /filter
90 * New extension: mglob (%mglob magic), for powerful glob / find /filter
77 like functionality
91 like functionality
78
92
79 % maghistory.py: %hist -g PATTERM greps the history for pattern
93 % maghistory.py: %hist -g PATTERM greps the history for pattern
80
94
81 2007-05-24 Walter Doerwald <walter@livinglogic.de>
95 2007-05-24 Walter Doerwald <walter@livinglogic.de>
82
96
83 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
97 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
84 browse the IPython input history
98 browse the IPython input history
85
99
86 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
100 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
87 (mapped to "i") can be used to put the object under the curser in the input
101 (mapped to "i") can be used to put the object under the curser in the input
88 line. pickinputattr (mapped to "I") does the same for the attribute under
102 line. pickinputattr (mapped to "I") does the same for the attribute under
89 the cursor.
103 the cursor.
90
104
91 2007-05-24 Ville Vainio <vivainio@gmail.com>
105 2007-05-24 Ville Vainio <vivainio@gmail.com>
92
106
93 * Grand magic cleansing (changeset [2380]):
107 * Grand magic cleansing (changeset [2380]):
94
108
95 * Introduce ipy_legacy.py where the following magics were
109 * Introduce ipy_legacy.py where the following magics were
96 moved:
110 moved:
97
111
98 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
112 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
99
113
100 If you need them, either use default profile or "import ipy_legacy"
114 If you need them, either use default profile or "import ipy_legacy"
101 in your ipy_user_conf.py
115 in your ipy_user_conf.py
102
116
103 * Move sh and scipy profile to Extensions from UserConfig. this implies
117 * Move sh and scipy profile to Extensions from UserConfig. this implies
104 you should not edit them, but you don't need to run %upgrade when
118 you should not edit them, but you don't need to run %upgrade when
105 upgrading IPython anymore.
119 upgrading IPython anymore.
106
120
107 * %hist/%history now operates in "raw" mode by default. To get the old
121 * %hist/%history now operates in "raw" mode by default. To get the old
108 behaviour, run '%hist -n' (native mode).
122 behaviour, run '%hist -n' (native mode).
109
123
110 * split ipy_stock_completers.py to ipy_stock_completers.py and
124 * split ipy_stock_completers.py to ipy_stock_completers.py and
111 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
125 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
112 installed as default.
126 installed as default.
113
127
114 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
128 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
115 handling.
129 handling.
116
130
117 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
131 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
118 input if readline is available.
132 input if readline is available.
119
133
120 2007-05-23 Ville Vainio <vivainio@gmail.com>
134 2007-05-23 Ville Vainio <vivainio@gmail.com>
121
135
122 * macro.py: %store uses __getstate__ properly
136 * macro.py: %store uses __getstate__ properly
123
137
124 * exesetup.py: added new setup script for creating
138 * exesetup.py: added new setup script for creating
125 standalone IPython executables with py2exe (i.e.
139 standalone IPython executables with py2exe (i.e.
126 no python installation required).
140 no python installation required).
127
141
128 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
142 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
129 its place.
143 its place.
130
144
131 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
145 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
132
146
133 2007-05-21 Ville Vainio <vivainio@gmail.com>
147 2007-05-21 Ville Vainio <vivainio@gmail.com>
134
148
135 * platutil_win32.py (set_term_title): handle
149 * platutil_win32.py (set_term_title): handle
136 failure of 'title' system call properly.
150 failure of 'title' system call properly.
137
151
138 2007-05-17 Walter Doerwald <walter@livinglogic.de>
152 2007-05-17 Walter Doerwald <walter@livinglogic.de>
139
153
140 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
154 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
141 (Bug detected by Paul Mueller).
155 (Bug detected by Paul Mueller).
142
156
143 2007-05-16 Ville Vainio <vivainio@gmail.com>
157 2007-05-16 Ville Vainio <vivainio@gmail.com>
144
158
145 * ipy_profile_sci.py, ipython_win_post_install.py: Create
159 * ipy_profile_sci.py, ipython_win_post_install.py: Create
146 new "sci" profile, effectively a modern version of the old
160 new "sci" profile, effectively a modern version of the old
147 "scipy" profile (which is now slated for deprecation).
161 "scipy" profile (which is now slated for deprecation).
148
162
149 2007-05-15 Ville Vainio <vivainio@gmail.com>
163 2007-05-15 Ville Vainio <vivainio@gmail.com>
150
164
151 * pycolorize.py, pycolor.1: Paul Mueller's patches that
165 * pycolorize.py, pycolor.1: Paul Mueller's patches that
152 make pycolorize read input from stdin when run without arguments.
166 make pycolorize read input from stdin when run without arguments.
153
167
154 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
168 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
155
169
156 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
170 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
157 it in sh profile (instead of ipy_system_conf.py).
171 it in sh profile (instead of ipy_system_conf.py).
158
172
159 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
173 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
160 aliases are now lower case on windows (MyCommand.exe => mycommand).
174 aliases are now lower case on windows (MyCommand.exe => mycommand).
161
175
162 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
176 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
163 Macros are now callable objects that inherit from ipapi.IPyAutocall,
177 Macros are now callable objects that inherit from ipapi.IPyAutocall,
164 i.e. get autocalled regardless of system autocall setting.
178 i.e. get autocalled regardless of system autocall setting.
165
179
166 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
180 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
167
181
168 * IPython/rlineimpl.py: check for clear_history in readline and
182 * IPython/rlineimpl.py: check for clear_history in readline and
169 make it a dummy no-op if not available. This function isn't
183 make it a dummy no-op if not available. This function isn't
170 guaranteed to be in the API and appeared in Python 2.4, so we need
184 guaranteed to be in the API and appeared in Python 2.4, so we need
171 to check it ourselves. Also, clean up this file quite a bit.
185 to check it ourselves. Also, clean up this file quite a bit.
172
186
173 * ipython.1: update man page and full manual with information
187 * ipython.1: update man page and full manual with information
174 about threads (remove outdated warning). Closes #151.
188 about threads (remove outdated warning). Closes #151.
175
189
176 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
190 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
177
191
178 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
192 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
179 in trunk (note that this made it into the 0.8.1 release already,
193 in trunk (note that this made it into the 0.8.1 release already,
180 but the changelogs didn't get coordinated). Many thanks to Gael
194 but the changelogs didn't get coordinated). Many thanks to Gael
181 Varoquaux <gael.varoquaux-AT-normalesup.org>
195 Varoquaux <gael.varoquaux-AT-normalesup.org>
182
196
183 2007-05-09 *** Released version 0.8.1
197 2007-05-09 *** Released version 0.8.1
184
198
185 2007-05-10 Walter Doerwald <walter@livinglogic.de>
199 2007-05-10 Walter Doerwald <walter@livinglogic.de>
186
200
187 * IPython/Extensions/igrid.py: Incorporate html help into
201 * IPython/Extensions/igrid.py: Incorporate html help into
188 the module, so we don't have to search for the file.
202 the module, so we don't have to search for the file.
189
203
190 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
204 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
191
205
192 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
206 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
193
207
194 2007-04-30 Ville Vainio <vivainio@gmail.com>
208 2007-04-30 Ville Vainio <vivainio@gmail.com>
195
209
196 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
210 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
197 user has illegal (non-ascii) home directory name
211 user has illegal (non-ascii) home directory name
198
212
199 2007-04-27 Ville Vainio <vivainio@gmail.com>
213 2007-04-27 Ville Vainio <vivainio@gmail.com>
200
214
201 * platutils_win32.py: implement set_term_title for windows
215 * platutils_win32.py: implement set_term_title for windows
202
216
203 * Update version number
217 * Update version number
204
218
205 * ipy_profile_sh.py: more informative prompt (2 dir levels)
219 * ipy_profile_sh.py: more informative prompt (2 dir levels)
206
220
207 2007-04-26 Walter Doerwald <walter@livinglogic.de>
221 2007-04-26 Walter Doerwald <walter@livinglogic.de>
208
222
209 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
223 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
210 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
224 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
211 bug discovered by Ville).
225 bug discovered by Ville).
212
226
213 2007-04-26 Ville Vainio <vivainio@gmail.com>
227 2007-04-26 Ville Vainio <vivainio@gmail.com>
214
228
215 * Extensions/ipy_completers.py: Olivier's module completer now
229 * Extensions/ipy_completers.py: Olivier's module completer now
216 saves the list of root modules if it takes > 4 secs on the first run.
230 saves the list of root modules if it takes > 4 secs on the first run.
217
231
218 * Magic.py (%rehashx): %rehashx now clears the completer cache
232 * Magic.py (%rehashx): %rehashx now clears the completer cache
219
233
220
234
221 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
235 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
222
236
223 * ipython.el: fix incorrect color scheme, reported by Stefan.
237 * ipython.el: fix incorrect color scheme, reported by Stefan.
224 Closes #149.
238 Closes #149.
225
239
226 * IPython/PyColorize.py (Parser.format2): fix state-handling
240 * IPython/PyColorize.py (Parser.format2): fix state-handling
227 logic. I still don't like how that code handles state, but at
241 logic. I still don't like how that code handles state, but at
228 least now it should be correct, if inelegant. Closes #146.
242 least now it should be correct, if inelegant. Closes #146.
229
243
230 2007-04-25 Ville Vainio <vivainio@gmail.com>
244 2007-04-25 Ville Vainio <vivainio@gmail.com>
231
245
232 * Extensions/ipy_which.py: added extension for %which magic, works
246 * Extensions/ipy_which.py: added extension for %which magic, works
233 a lot like unix 'which' but also finds and expands aliases, and
247 a lot like unix 'which' but also finds and expands aliases, and
234 allows wildcards.
248 allows wildcards.
235
249
236 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
250 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
237 as opposed to returning nothing.
251 as opposed to returning nothing.
238
252
239 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
253 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
240 ipy_stock_completers on default profile, do import on sh profile.
254 ipy_stock_completers on default profile, do import on sh profile.
241
255
242 2007-04-22 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
256 2007-04-22 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
243
257
244 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
258 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
245 like ipython.py foo.py which raised a IndexError.
259 like ipython.py foo.py which raised a IndexError.
246
260
247 2007-04-21 Ville Vainio <vivainio@gmail.com>
261 2007-04-21 Ville Vainio <vivainio@gmail.com>
248
262
249 * Extensions/ipy_extutil.py: added extension to manage other ipython
263 * Extensions/ipy_extutil.py: added extension to manage other ipython
250 extensions. Now only supports 'ls' == list extensions.
264 extensions. Now only supports 'ls' == list extensions.
251
265
252 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
266 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
253
267
254 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
268 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
255 would prevent use of the exception system outside of a running
269 would prevent use of the exception system outside of a running
256 IPython instance.
270 IPython instance.
257
271
258 2007-04-20 Ville Vainio <vivainio@gmail.com>
272 2007-04-20 Ville Vainio <vivainio@gmail.com>
259
273
260 * Extensions/ipy_render.py: added extension for easy
274 * Extensions/ipy_render.py: added extension for easy
261 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
275 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
262 'Iptl' template notation,
276 'Iptl' template notation,
263
277
264 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
278 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
265 safer & faster 'import' completer.
279 safer & faster 'import' completer.
266
280
267 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
281 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
268 and _ip.defalias(name, command).
282 and _ip.defalias(name, command).
269
283
270 * Extensions/ipy_exportdb.py: New extension for exporting all the
284 * Extensions/ipy_exportdb.py: New extension for exporting all the
271 %store'd data in a portable format (normal ipapi calls like
285 %store'd data in a portable format (normal ipapi calls like
272 defmacro() etc.)
286 defmacro() etc.)
273
287
274 2007-04-19 Ville Vainio <vivainio@gmail.com>
288 2007-04-19 Ville Vainio <vivainio@gmail.com>
275
289
276 * upgrade_dir.py: skip junk files like *.pyc
290 * upgrade_dir.py: skip junk files like *.pyc
277
291
278 * Release.py: version number to 0.8.1
292 * Release.py: version number to 0.8.1
279
293
280 2007-04-18 Ville Vainio <vivainio@gmail.com>
294 2007-04-18 Ville Vainio <vivainio@gmail.com>
281
295
282 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
296 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
283 and later on win32.
297 and later on win32.
284
298
285 2007-04-16 Ville Vainio <vivainio@gmail.com>
299 2007-04-16 Ville Vainio <vivainio@gmail.com>
286
300
287 * iplib.py (showtraceback): Do not crash when running w/o readline.
301 * iplib.py (showtraceback): Do not crash when running w/o readline.
288
302
289 2007-04-12 Walter Doerwald <walter@livinglogic.de>
303 2007-04-12 Walter Doerwald <walter@livinglogic.de>
290
304
291 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
305 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
292 sorted (case sensitive with files and dirs mixed).
306 sorted (case sensitive with files and dirs mixed).
293
307
294 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
308 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
295
309
296 * IPython/Release.py (version): Open trunk for 0.8.1 development.
310 * IPython/Release.py (version): Open trunk for 0.8.1 development.
297
311
298 2007-04-10 *** Released version 0.8.0
312 2007-04-10 *** Released version 0.8.0
299
313
300 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
314 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
301
315
302 * Tag 0.8.0 for release.
316 * Tag 0.8.0 for release.
303
317
304 * IPython/iplib.py (reloadhist): add API function to cleanly
318 * IPython/iplib.py (reloadhist): add API function to cleanly
305 reload the readline history, which was growing inappropriately on
319 reload the readline history, which was growing inappropriately on
306 every %run call.
320 every %run call.
307
321
308 * win32_manual_post_install.py (run): apply last part of Nicolas
322 * win32_manual_post_install.py (run): apply last part of Nicolas
309 Pernetty's patch (I'd accidentally applied it in a different
323 Pernetty's patch (I'd accidentally applied it in a different
310 directory and this particular file didn't get patched).
324 directory and this particular file didn't get patched).
311
325
312 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
326 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
313
327
314 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
328 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
315 find the main thread id and use the proper API call. Thanks to
329 find the main thread id and use the proper API call. Thanks to
316 Stefan for the fix.
330 Stefan for the fix.
317
331
318 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
332 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
319 unit tests to reflect fixed ticket #52, and add more tests sent by
333 unit tests to reflect fixed ticket #52, and add more tests sent by
320 him.
334 him.
321
335
322 * IPython/iplib.py (raw_input): restore the readline completer
336 * IPython/iplib.py (raw_input): restore the readline completer
323 state on every input, in case third-party code messed it up.
337 state on every input, in case third-party code messed it up.
324 (_prefilter): revert recent addition of early-escape checks which
338 (_prefilter): revert recent addition of early-escape checks which
325 prevent many valid alias calls from working.
339 prevent many valid alias calls from working.
326
340
327 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
341 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
328 flag for sigint handler so we don't run a full signal() call on
342 flag for sigint handler so we don't run a full signal() call on
329 each runcode access.
343 each runcode access.
330
344
331 * IPython/Magic.py (magic_whos): small improvement to diagnostic
345 * IPython/Magic.py (magic_whos): small improvement to diagnostic
332 message.
346 message.
333
347
334 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
348 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
335
349
336 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
350 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
337 asynchronous exceptions working, i.e., Ctrl-C can actually
351 asynchronous exceptions working, i.e., Ctrl-C can actually
338 interrupt long-running code in the multithreaded shells.
352 interrupt long-running code in the multithreaded shells.
339
353
340 This is using Tomer Filiba's great ctypes-based trick:
354 This is using Tomer Filiba's great ctypes-based trick:
341 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
355 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
342 this in the past, but hadn't been able to make it work before. So
356 this in the past, but hadn't been able to make it work before. So
343 far it looks like it's actually running, but this needs more
357 far it looks like it's actually running, but this needs more
344 testing. If it really works, I'll be *very* happy, and we'll owe
358 testing. If it really works, I'll be *very* happy, and we'll owe
345 a huge thank you to Tomer. My current implementation is ugly,
359 a huge thank you to Tomer. My current implementation is ugly,
346 hackish and uses nasty globals, but I don't want to try and clean
360 hackish and uses nasty globals, but I don't want to try and clean
347 anything up until we know if it actually works.
361 anything up until we know if it actually works.
348
362
349 NOTE: this feature needs ctypes to work. ctypes is included in
363 NOTE: this feature needs ctypes to work. ctypes is included in
350 Python2.5, but 2.4 users will need to manually install it. This
364 Python2.5, but 2.4 users will need to manually install it. This
351 feature makes multi-threaded shells so much more usable that it's
365 feature makes multi-threaded shells so much more usable that it's
352 a minor price to pay (ctypes is very easy to install, already a
366 a minor price to pay (ctypes is very easy to install, already a
353 requirement for win32 and available in major linux distros).
367 requirement for win32 and available in major linux distros).
354
368
355 2007-04-04 Ville Vainio <vivainio@gmail.com>
369 2007-04-04 Ville Vainio <vivainio@gmail.com>
356
370
357 * Extensions/ipy_completers.py, ipy_stock_completers.py:
371 * Extensions/ipy_completers.py, ipy_stock_completers.py:
358 Moved implementations of 'bundled' completers to ipy_completers.py,
372 Moved implementations of 'bundled' completers to ipy_completers.py,
359 they are only enabled in ipy_stock_completers.py.
373 they are only enabled in ipy_stock_completers.py.
360
374
361 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
375 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
362
376
363 * IPython/PyColorize.py (Parser.format2): Fix identation of
377 * IPython/PyColorize.py (Parser.format2): Fix identation of
364 colorzied output and return early if color scheme is NoColor, to
378 colorzied output and return early if color scheme is NoColor, to
365 avoid unnecessary and expensive tokenization. Closes #131.
379 avoid unnecessary and expensive tokenization. Closes #131.
366
380
367 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
381 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
368
382
369 * IPython/Debugger.py: disable the use of pydb version 1.17. It
383 * IPython/Debugger.py: disable the use of pydb version 1.17. It
370 has a critical bug (a missing import that makes post-mortem not
384 has a critical bug (a missing import that makes post-mortem not
371 work at all). Unfortunately as of this time, this is the version
385 work at all). Unfortunately as of this time, this is the version
372 shipped with Ubuntu Edgy, so quite a few people have this one. I
386 shipped with Ubuntu Edgy, so quite a few people have this one. I
373 hope Edgy will update to a more recent package.
387 hope Edgy will update to a more recent package.
374
388
375 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
389 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
376
390
377 * IPython/iplib.py (_prefilter): close #52, second part of a patch
391 * IPython/iplib.py (_prefilter): close #52, second part of a patch
378 set by Stefan (only the first part had been applied before).
392 set by Stefan (only the first part had been applied before).
379
393
380 * IPython/Extensions/ipy_stock_completers.py (module_completer):
394 * IPython/Extensions/ipy_stock_completers.py (module_completer):
381 remove usage of the dangerous pkgutil.walk_packages(). See
395 remove usage of the dangerous pkgutil.walk_packages(). See
382 details in comments left in the code.
396 details in comments left in the code.
383
397
384 * IPython/Magic.py (magic_whos): add support for numpy arrays
398 * IPython/Magic.py (magic_whos): add support for numpy arrays
385 similar to what we had for Numeric.
399 similar to what we had for Numeric.
386
400
387 * IPython/completer.py (IPCompleter.complete): extend the
401 * IPython/completer.py (IPCompleter.complete): extend the
388 complete() call API to support completions by other mechanisms
402 complete() call API to support completions by other mechanisms
389 than readline. Closes #109.
403 than readline. Closes #109.
390
404
391 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
405 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
392 protect against a bug in Python's execfile(). Closes #123.
406 protect against a bug in Python's execfile(). Closes #123.
393
407
394 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
408 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
395
409
396 * IPython/iplib.py (split_user_input): ensure that when splitting
410 * IPython/iplib.py (split_user_input): ensure that when splitting
397 user input, the part that can be treated as a python name is pure
411 user input, the part that can be treated as a python name is pure
398 ascii (Python identifiers MUST be pure ascii). Part of the
412 ascii (Python identifiers MUST be pure ascii). Part of the
399 ongoing Unicode support work.
413 ongoing Unicode support work.
400
414
401 * IPython/Prompts.py (prompt_specials_color): Add \N for the
415 * IPython/Prompts.py (prompt_specials_color): Add \N for the
402 actual prompt number, without any coloring. This allows users to
416 actual prompt number, without any coloring. This allows users to
403 produce numbered prompts with their own colors. Added after a
417 produce numbered prompts with their own colors. Added after a
404 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
418 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
405
419
406 2007-03-31 Walter Doerwald <walter@livinglogic.de>
420 2007-03-31 Walter Doerwald <walter@livinglogic.de>
407
421
408 * IPython/Extensions/igrid.py: Map the return key
422 * IPython/Extensions/igrid.py: Map the return key
409 to enter() and shift-return to enterattr().
423 to enter() and shift-return to enterattr().
410
424
411 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
425 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
412
426
413 * IPython/Magic.py (magic_psearch): add unicode support by
427 * IPython/Magic.py (magic_psearch): add unicode support by
414 encoding to ascii the input, since this routine also only deals
428 encoding to ascii the input, since this routine also only deals
415 with valid Python names. Fixes a bug reported by Stefan.
429 with valid Python names. Fixes a bug reported by Stefan.
416
430
417 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
431 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
418
432
419 * IPython/Magic.py (_inspect): convert unicode input into ascii
433 * IPython/Magic.py (_inspect): convert unicode input into ascii
420 before trying to evaluate it as a Python identifier. This fixes a
434 before trying to evaluate it as a Python identifier. This fixes a
421 problem that the new unicode support had introduced when analyzing
435 problem that the new unicode support had introduced when analyzing
422 long definition lines for functions.
436 long definition lines for functions.
423
437
424 2007-03-24 Walter Doerwald <walter@livinglogic.de>
438 2007-03-24 Walter Doerwald <walter@livinglogic.de>
425
439
426 * IPython/Extensions/igrid.py: Fix picking. Using
440 * IPython/Extensions/igrid.py: Fix picking. Using
427 igrid with wxPython 2.6 and -wthread should work now.
441 igrid with wxPython 2.6 and -wthread should work now.
428 igrid.display() simply tries to create a frame without
442 igrid.display() simply tries to create a frame without
429 an application. Only if this fails an application is created.
443 an application. Only if this fails an application is created.
430
444
431 2007-03-23 Walter Doerwald <walter@livinglogic.de>
445 2007-03-23 Walter Doerwald <walter@livinglogic.de>
432
446
433 * IPython/Extensions/path.py: Updated to version 2.2.
447 * IPython/Extensions/path.py: Updated to version 2.2.
434
448
435 2007-03-23 Ville Vainio <vivainio@gmail.com>
449 2007-03-23 Ville Vainio <vivainio@gmail.com>
436
450
437 * iplib.py: recursive alias expansion now works better, so that
451 * iplib.py: recursive alias expansion now works better, so that
438 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
452 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
439 doesn't trip up the process, if 'd' has been aliased to 'ls'.
453 doesn't trip up the process, if 'd' has been aliased to 'ls'.
440
454
441 * Extensions/ipy_gnuglobal.py added, provides %global magic
455 * Extensions/ipy_gnuglobal.py added, provides %global magic
442 for users of http://www.gnu.org/software/global
456 for users of http://www.gnu.org/software/global
443
457
444 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
458 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
445 Closes #52. Patch by Stefan van der Walt.
459 Closes #52. Patch by Stefan van der Walt.
446
460
447 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
461 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
448
462
449 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
463 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
450 respect the __file__ attribute when using %run. Thanks to a bug
464 respect the __file__ attribute when using %run. Thanks to a bug
451 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
465 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
452
466
453 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
467 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
454
468
455 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
469 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
456 input. Patch sent by Stefan.
470 input. Patch sent by Stefan.
457
471
458 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
472 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
459 * IPython/Extensions/ipy_stock_completer.py
473 * IPython/Extensions/ipy_stock_completer.py
460 shlex_split, fix bug in shlex_split. len function
474 shlex_split, fix bug in shlex_split. len function
461 call was missing an if statement. Caused shlex_split to
475 call was missing an if statement. Caused shlex_split to
462 sometimes return "" as last element.
476 sometimes return "" as last element.
463
477
464 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
478 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
465
479
466 * IPython/completer.py
480 * IPython/completer.py
467 (IPCompleter.file_matches.single_dir_expand): fix a problem
481 (IPCompleter.file_matches.single_dir_expand): fix a problem
468 reported by Stefan, where directories containign a single subdir
482 reported by Stefan, where directories containign a single subdir
469 would be completed too early.
483 would be completed too early.
470
484
471 * IPython/Shell.py (_load_pylab): Make the execution of 'from
485 * IPython/Shell.py (_load_pylab): Make the execution of 'from
472 pylab import *' when -pylab is given be optional. A new flag,
486 pylab import *' when -pylab is given be optional. A new flag,
473 pylab_import_all controls this behavior, the default is True for
487 pylab_import_all controls this behavior, the default is True for
474 backwards compatibility.
488 backwards compatibility.
475
489
476 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
490 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
477 modified) R. Bernstein's patch for fully syntax highlighted
491 modified) R. Bernstein's patch for fully syntax highlighted
478 tracebacks. The functionality is also available under ultraTB for
492 tracebacks. The functionality is also available under ultraTB for
479 non-ipython users (someone using ultraTB but outside an ipython
493 non-ipython users (someone using ultraTB but outside an ipython
480 session). They can select the color scheme by setting the
494 session). They can select the color scheme by setting the
481 module-level global DEFAULT_SCHEME. The highlight functionality
495 module-level global DEFAULT_SCHEME. The highlight functionality
482 also works when debugging.
496 also works when debugging.
483
497
484 * IPython/genutils.py (IOStream.close): small patch by
498 * IPython/genutils.py (IOStream.close): small patch by
485 R. Bernstein for improved pydb support.
499 R. Bernstein for improved pydb support.
486
500
487 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
501 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
488 DaveS <davls@telus.net> to improve support of debugging under
502 DaveS <davls@telus.net> to improve support of debugging under
489 NTEmacs, including improved pydb behavior.
503 NTEmacs, including improved pydb behavior.
490
504
491 * IPython/Magic.py (magic_prun): Fix saving of profile info for
505 * IPython/Magic.py (magic_prun): Fix saving of profile info for
492 Python 2.5, where the stats object API changed a little. Thanks
506 Python 2.5, where the stats object API changed a little. Thanks
493 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
507 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
494
508
495 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
509 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
496 Pernetty's patch to improve support for (X)Emacs under Win32.
510 Pernetty's patch to improve support for (X)Emacs under Win32.
497
511
498 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
512 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
499
513
500 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
514 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
501 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
515 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
502 a report by Nik Tautenhahn.
516 a report by Nik Tautenhahn.
503
517
504 2007-03-16 Walter Doerwald <walter@livinglogic.de>
518 2007-03-16 Walter Doerwald <walter@livinglogic.de>
505
519
506 * setup.py: Add the igrid help files to the list of data files
520 * setup.py: Add the igrid help files to the list of data files
507 to be installed alongside igrid.
521 to be installed alongside igrid.
508 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
522 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
509 Show the input object of the igrid browser as the window tile.
523 Show the input object of the igrid browser as the window tile.
510 Show the object the cursor is on in the statusbar.
524 Show the object the cursor is on in the statusbar.
511
525
512 2007-03-15 Ville Vainio <vivainio@gmail.com>
526 2007-03-15 Ville Vainio <vivainio@gmail.com>
513
527
514 * Extensions/ipy_stock_completers.py: Fixed exception
528 * Extensions/ipy_stock_completers.py: Fixed exception
515 on mismatching quotes in %run completer. Patch by
529 on mismatching quotes in %run completer. Patch by
516 JοΏ½rgen Stenarson. Closes #127.
530 JοΏ½rgen Stenarson. Closes #127.
517
531
518 2007-03-14 Ville Vainio <vivainio@gmail.com>
532 2007-03-14 Ville Vainio <vivainio@gmail.com>
519
533
520 * Extensions/ext_rehashdir.py: Do not do auto_alias
534 * Extensions/ext_rehashdir.py: Do not do auto_alias
521 in %rehashdir, it clobbers %store'd aliases.
535 in %rehashdir, it clobbers %store'd aliases.
522
536
523 * UserConfig/ipy_profile_sh.py: envpersist.py extension
537 * UserConfig/ipy_profile_sh.py: envpersist.py extension
524 (beefed up %env) imported for sh profile.
538 (beefed up %env) imported for sh profile.
525
539
526 2007-03-10 Walter Doerwald <walter@livinglogic.de>
540 2007-03-10 Walter Doerwald <walter@livinglogic.de>
527
541
528 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
542 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
529 as the default browser.
543 as the default browser.
530 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
544 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
531 As igrid displays all attributes it ever encounters, fetch() (which has
545 As igrid displays all attributes it ever encounters, fetch() (which has
532 been renamed to _fetch()) doesn't have to recalculate the display attributes
546 been renamed to _fetch()) doesn't have to recalculate the display attributes
533 every time a new item is fetched. This should speed up scrolling.
547 every time a new item is fetched. This should speed up scrolling.
534
548
535 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
549 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
536
550
537 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
551 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
538 Schmolck's recently reported tab-completion bug (my previous one
552 Schmolck's recently reported tab-completion bug (my previous one
539 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
553 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
540
554
541 2007-03-09 Walter Doerwald <walter@livinglogic.de>
555 2007-03-09 Walter Doerwald <walter@livinglogic.de>
542
556
543 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
557 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
544 Close help window if exiting igrid.
558 Close help window if exiting igrid.
545
559
546 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
560 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
547
561
548 * IPython/Extensions/ipy_defaults.py: Check if readline is available
562 * IPython/Extensions/ipy_defaults.py: Check if readline is available
549 before calling functions from readline.
563 before calling functions from readline.
550
564
551 2007-03-02 Walter Doerwald <walter@livinglogic.de>
565 2007-03-02 Walter Doerwald <walter@livinglogic.de>
552
566
553 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
567 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
554 igrid is a wxPython-based display object for ipipe. If your system has
568 igrid is a wxPython-based display object for ipipe. If your system has
555 wx installed igrid will be the default display. Without wx ipipe falls
569 wx installed igrid will be the default display. Without wx ipipe falls
556 back to ibrowse (which needs curses). If no curses is installed ipipe
570 back to ibrowse (which needs curses). If no curses is installed ipipe
557 falls back to idump.
571 falls back to idump.
558
572
559 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
573 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
560
574
561 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
575 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
562 my changes from yesterday, they introduced bugs. Will reactivate
576 my changes from yesterday, they introduced bugs. Will reactivate
563 once I get a correct solution, which will be much easier thanks to
577 once I get a correct solution, which will be much easier thanks to
564 Dan Milstein's new prefilter test suite.
578 Dan Milstein's new prefilter test suite.
565
579
566 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
580 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
567
581
568 * IPython/iplib.py (split_user_input): fix input splitting so we
582 * IPython/iplib.py (split_user_input): fix input splitting so we
569 don't attempt attribute accesses on things that can't possibly be
583 don't attempt attribute accesses on things that can't possibly be
570 valid Python attributes. After a bug report by Alex Schmolck.
584 valid Python attributes. After a bug report by Alex Schmolck.
571 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
585 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
572 %magic with explicit % prefix.
586 %magic with explicit % prefix.
573
587
574 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
588 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
575
589
576 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
590 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
577 avoid a DeprecationWarning from GTK.
591 avoid a DeprecationWarning from GTK.
578
592
579 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
593 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
580
594
581 * IPython/genutils.py (clock): I modified clock() to return total
595 * IPython/genutils.py (clock): I modified clock() to return total
582 time, user+system. This is a more commonly needed metric. I also
596 time, user+system. This is a more commonly needed metric. I also
583 introduced the new clocku/clocks to get only user/system time if
597 introduced the new clocku/clocks to get only user/system time if
584 one wants those instead.
598 one wants those instead.
585
599
586 ***WARNING: API CHANGE*** clock() used to return only user time,
600 ***WARNING: API CHANGE*** clock() used to return only user time,
587 so if you want exactly the same results as before, use clocku
601 so if you want exactly the same results as before, use clocku
588 instead.
602 instead.
589
603
590 2007-02-22 Ville Vainio <vivainio@gmail.com>
604 2007-02-22 Ville Vainio <vivainio@gmail.com>
591
605
592 * IPython/Extensions/ipy_p4.py: Extension for improved
606 * IPython/Extensions/ipy_p4.py: Extension for improved
593 p4 (perforce version control system) experience.
607 p4 (perforce version control system) experience.
594 Adds %p4 magic with p4 command completion and
608 Adds %p4 magic with p4 command completion and
595 automatic -G argument (marshall output as python dict)
609 automatic -G argument (marshall output as python dict)
596
610
597 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
611 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
598
612
599 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
613 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
600 stop marks.
614 stop marks.
601 (ClearingMixin): a simple mixin to easily make a Demo class clear
615 (ClearingMixin): a simple mixin to easily make a Demo class clear
602 the screen in between blocks and have empty marquees. The
616 the screen in between blocks and have empty marquees. The
603 ClearDemo and ClearIPDemo classes that use it are included.
617 ClearDemo and ClearIPDemo classes that use it are included.
604
618
605 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
619 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
606
620
607 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
621 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
608 protect against exceptions at Python shutdown time. Patch
622 protect against exceptions at Python shutdown time. Patch
609 sumbmitted to upstream.
623 sumbmitted to upstream.
610
624
611 2007-02-14 Walter Doerwald <walter@livinglogic.de>
625 2007-02-14 Walter Doerwald <walter@livinglogic.de>
612
626
613 * IPython/Extensions/ibrowse.py: If entering the first object level
627 * IPython/Extensions/ibrowse.py: If entering the first object level
614 (i.e. the object for which the browser has been started) fails,
628 (i.e. the object for which the browser has been started) fails,
615 now the error is raised directly (aborting the browser) instead of
629 now the error is raised directly (aborting the browser) instead of
616 running into an empty levels list later.
630 running into an empty levels list later.
617
631
618 2007-02-03 Walter Doerwald <walter@livinglogic.de>
632 2007-02-03 Walter Doerwald <walter@livinglogic.de>
619
633
620 * IPython/Extensions/ipipe.py: Add an xrepr implementation
634 * IPython/Extensions/ipipe.py: Add an xrepr implementation
621 for the noitem object.
635 for the noitem object.
622
636
623 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
637 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
624
638
625 * IPython/completer.py (Completer.attr_matches): Fix small
639 * IPython/completer.py (Completer.attr_matches): Fix small
626 tab-completion bug with Enthought Traits objects with units.
640 tab-completion bug with Enthought Traits objects with units.
627 Thanks to a bug report by Tom Denniston
641 Thanks to a bug report by Tom Denniston
628 <tom.denniston-AT-alum.dartmouth.org>.
642 <tom.denniston-AT-alum.dartmouth.org>.
629
643
630 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
644 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
631
645
632 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
646 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
633 bug where only .ipy or .py would be completed. Once the first
647 bug where only .ipy or .py would be completed. Once the first
634 argument to %run has been given, all completions are valid because
648 argument to %run has been given, all completions are valid because
635 they are the arguments to the script, which may well be non-python
649 they are the arguments to the script, which may well be non-python
636 filenames.
650 filenames.
637
651
638 * IPython/irunner.py (InteractiveRunner.run_source): major updates
652 * IPython/irunner.py (InteractiveRunner.run_source): major updates
639 to irunner to allow it to correctly support real doctesting of
653 to irunner to allow it to correctly support real doctesting of
640 out-of-process ipython code.
654 out-of-process ipython code.
641
655
642 * IPython/Magic.py (magic_cd): Make the setting of the terminal
656 * IPython/Magic.py (magic_cd): Make the setting of the terminal
643 title an option (-noterm_title) because it completely breaks
657 title an option (-noterm_title) because it completely breaks
644 doctesting.
658 doctesting.
645
659
646 * IPython/demo.py: fix IPythonDemo class that was not actually working.
660 * IPython/demo.py: fix IPythonDemo class that was not actually working.
647
661
648 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
662 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
649
663
650 * IPython/irunner.py (main): fix small bug where extensions were
664 * IPython/irunner.py (main): fix small bug where extensions were
651 not being correctly recognized.
665 not being correctly recognized.
652
666
653 2007-01-23 Walter Doerwald <walter@livinglogic.de>
667 2007-01-23 Walter Doerwald <walter@livinglogic.de>
654
668
655 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
669 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
656 a string containing a single line yields the string itself as the
670 a string containing a single line yields the string itself as the
657 only item.
671 only item.
658
672
659 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
673 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
660 object if it's the same as the one on the last level (This avoids
674 object if it's the same as the one on the last level (This avoids
661 infinite recursion for one line strings).
675 infinite recursion for one line strings).
662
676
663 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
677 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
664
678
665 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
679 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
666 all output streams before printing tracebacks. This ensures that
680 all output streams before printing tracebacks. This ensures that
667 user output doesn't end up interleaved with traceback output.
681 user output doesn't end up interleaved with traceback output.
668
682
669 2007-01-10 Ville Vainio <vivainio@gmail.com>
683 2007-01-10 Ville Vainio <vivainio@gmail.com>
670
684
671 * Extensions/envpersist.py: Turbocharged %env that remembers
685 * Extensions/envpersist.py: Turbocharged %env that remembers
672 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
686 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
673 "%env VISUAL=jed".
687 "%env VISUAL=jed".
674
688
675 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
689 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
676
690
677 * IPython/iplib.py (showtraceback): ensure that we correctly call
691 * IPython/iplib.py (showtraceback): ensure that we correctly call
678 custom handlers in all cases (some with pdb were slipping through,
692 custom handlers in all cases (some with pdb were slipping through,
679 but I'm not exactly sure why).
693 but I'm not exactly sure why).
680
694
681 * IPython/Debugger.py (Tracer.__init__): added new class to
695 * IPython/Debugger.py (Tracer.__init__): added new class to
682 support set_trace-like usage of IPython's enhanced debugger.
696 support set_trace-like usage of IPython's enhanced debugger.
683
697
684 2006-12-24 Ville Vainio <vivainio@gmail.com>
698 2006-12-24 Ville Vainio <vivainio@gmail.com>
685
699
686 * ipmaker.py: more informative message when ipy_user_conf
700 * ipmaker.py: more informative message when ipy_user_conf
687 import fails (suggest running %upgrade).
701 import fails (suggest running %upgrade).
688
702
689 * tools/run_ipy_in_profiler.py: Utility to see where
703 * tools/run_ipy_in_profiler.py: Utility to see where
690 the time during IPython startup is spent.
704 the time during IPython startup is spent.
691
705
692 2006-12-20 Ville Vainio <vivainio@gmail.com>
706 2006-12-20 Ville Vainio <vivainio@gmail.com>
693
707
694 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
708 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
695
709
696 * ipapi.py: Add new ipapi method, expand_alias.
710 * ipapi.py: Add new ipapi method, expand_alias.
697
711
698 * Release.py: Bump up version to 0.7.4.svn
712 * Release.py: Bump up version to 0.7.4.svn
699
713
700 2006-12-17 Ville Vainio <vivainio@gmail.com>
714 2006-12-17 Ville Vainio <vivainio@gmail.com>
701
715
702 * Extensions/jobctrl.py: Fixed &cmd arg arg...
716 * Extensions/jobctrl.py: Fixed &cmd arg arg...
703 to work properly on posix too
717 to work properly on posix too
704
718
705 * Release.py: Update revnum (version is still just 0.7.3).
719 * Release.py: Update revnum (version is still just 0.7.3).
706
720
707 2006-12-15 Ville Vainio <vivainio@gmail.com>
721 2006-12-15 Ville Vainio <vivainio@gmail.com>
708
722
709 * scripts/ipython_win_post_install: create ipython.py in
723 * scripts/ipython_win_post_install: create ipython.py in
710 prefix + "/scripts".
724 prefix + "/scripts".
711
725
712 * Release.py: Update version to 0.7.3.
726 * Release.py: Update version to 0.7.3.
713
727
714 2006-12-14 Ville Vainio <vivainio@gmail.com>
728 2006-12-14 Ville Vainio <vivainio@gmail.com>
715
729
716 * scripts/ipython_win_post_install: Overwrite old shortcuts
730 * scripts/ipython_win_post_install: Overwrite old shortcuts
717 if they already exist
731 if they already exist
718
732
719 * Release.py: release 0.7.3rc2
733 * Release.py: release 0.7.3rc2
720
734
721 2006-12-13 Ville Vainio <vivainio@gmail.com>
735 2006-12-13 Ville Vainio <vivainio@gmail.com>
722
736
723 * Branch and update Release.py for 0.7.3rc1
737 * Branch and update Release.py for 0.7.3rc1
724
738
725 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
739 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
726
740
727 * IPython/Shell.py (IPShellWX): update for current WX naming
741 * IPython/Shell.py (IPShellWX): update for current WX naming
728 conventions, to avoid a deprecation warning with current WX
742 conventions, to avoid a deprecation warning with current WX
729 versions. Thanks to a report by Danny Shevitz.
743 versions. Thanks to a report by Danny Shevitz.
730
744
731 2006-12-12 Ville Vainio <vivainio@gmail.com>
745 2006-12-12 Ville Vainio <vivainio@gmail.com>
732
746
733 * ipmaker.py: apply david cournapeau's patch to make
747 * ipmaker.py: apply david cournapeau's patch to make
734 import_some work properly even when ipythonrc does
748 import_some work properly even when ipythonrc does
735 import_some on empty list (it was an old bug!).
749 import_some on empty list (it was an old bug!).
736
750
737 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
751 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
738 Add deprecation note to ipythonrc and a url to wiki
752 Add deprecation note to ipythonrc and a url to wiki
739 in ipy_user_conf.py
753 in ipy_user_conf.py
740
754
741
755
742 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
756 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
743 as if it was typed on IPython command prompt, i.e.
757 as if it was typed on IPython command prompt, i.e.
744 as IPython script.
758 as IPython script.
745
759
746 * example-magic.py, magic_grepl.py: remove outdated examples
760 * example-magic.py, magic_grepl.py: remove outdated examples
747
761
748 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
762 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
749
763
750 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
764 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
751 is called before any exception has occurred.
765 is called before any exception has occurred.
752
766
753 2006-12-08 Ville Vainio <vivainio@gmail.com>
767 2006-12-08 Ville Vainio <vivainio@gmail.com>
754
768
755 * Extensions/ipy_stock_completers.py: fix cd completer
769 * Extensions/ipy_stock_completers.py: fix cd completer
756 to translate /'s to \'s again.
770 to translate /'s to \'s again.
757
771
758 * completer.py: prevent traceback on file completions w/
772 * completer.py: prevent traceback on file completions w/
759 backslash.
773 backslash.
760
774
761 * Release.py: Update release number to 0.7.3b3 for release
775 * Release.py: Update release number to 0.7.3b3 for release
762
776
763 2006-12-07 Ville Vainio <vivainio@gmail.com>
777 2006-12-07 Ville Vainio <vivainio@gmail.com>
764
778
765 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
779 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
766 while executing external code. Provides more shell-like behaviour
780 while executing external code. Provides more shell-like behaviour
767 and overall better response to ctrl + C / ctrl + break.
781 and overall better response to ctrl + C / ctrl + break.
768
782
769 * tools/make_tarball.py: new script to create tarball straight from svn
783 * tools/make_tarball.py: new script to create tarball straight from svn
770 (setup.py sdist doesn't work on win32).
784 (setup.py sdist doesn't work on win32).
771
785
772 * Extensions/ipy_stock_completers.py: fix cd completer to give up
786 * Extensions/ipy_stock_completers.py: fix cd completer to give up
773 on dirnames with spaces and use the default completer instead.
787 on dirnames with spaces and use the default completer instead.
774
788
775 * Revision.py: Change version to 0.7.3b2 for release.
789 * Revision.py: Change version to 0.7.3b2 for release.
776
790
777 2006-12-05 Ville Vainio <vivainio@gmail.com>
791 2006-12-05 Ville Vainio <vivainio@gmail.com>
778
792
779 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
793 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
780 pydb patch 4 (rm debug printing, py 2.5 checking)
794 pydb patch 4 (rm debug printing, py 2.5 checking)
781
795
782 2006-11-30 Walter Doerwald <walter@livinglogic.de>
796 2006-11-30 Walter Doerwald <walter@livinglogic.de>
783 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
797 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
784 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
798 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
785 "refreshfind" (mapped to "R") does the same but tries to go back to the same
799 "refreshfind" (mapped to "R") does the same but tries to go back to the same
786 object the cursor was on before the refresh. The command "markrange" is
800 object the cursor was on before the refresh. The command "markrange" is
787 mapped to "%" now.
801 mapped to "%" now.
788 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
802 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
789
803
790 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
804 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
791
805
792 * IPython/Magic.py (magic_debug): new %debug magic to activate the
806 * IPython/Magic.py (magic_debug): new %debug magic to activate the
793 interactive debugger on the last traceback, without having to call
807 interactive debugger on the last traceback, without having to call
794 %pdb and rerun your code. Made minor changes in various modules,
808 %pdb and rerun your code. Made minor changes in various modules,
795 should automatically recognize pydb if available.
809 should automatically recognize pydb if available.
796
810
797 2006-11-28 Ville Vainio <vivainio@gmail.com>
811 2006-11-28 Ville Vainio <vivainio@gmail.com>
798
812
799 * completer.py: If the text start with !, show file completions
813 * completer.py: If the text start with !, show file completions
800 properly. This helps when trying to complete command name
814 properly. This helps when trying to complete command name
801 for shell escapes.
815 for shell escapes.
802
816
803 2006-11-27 Ville Vainio <vivainio@gmail.com>
817 2006-11-27 Ville Vainio <vivainio@gmail.com>
804
818
805 * ipy_stock_completers.py: bzr completer submitted by Stefan van
819 * ipy_stock_completers.py: bzr completer submitted by Stefan van
806 der Walt. Clean up svn and hg completers by using a common
820 der Walt. Clean up svn and hg completers by using a common
807 vcs_completer.
821 vcs_completer.
808
822
809 2006-11-26 Ville Vainio <vivainio@gmail.com>
823 2006-11-26 Ville Vainio <vivainio@gmail.com>
810
824
811 * Remove ipconfig and %config; you should use _ip.options structure
825 * Remove ipconfig and %config; you should use _ip.options structure
812 directly instead!
826 directly instead!
813
827
814 * genutils.py: add wrap_deprecated function for deprecating callables
828 * genutils.py: add wrap_deprecated function for deprecating callables
815
829
816 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
830 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
817 _ip.system instead. ipalias is redundant.
831 _ip.system instead. ipalias is redundant.
818
832
819 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
833 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
820 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
834 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
821 explicit.
835 explicit.
822
836
823 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
837 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
824 completer. Try it by entering 'hg ' and pressing tab.
838 completer. Try it by entering 'hg ' and pressing tab.
825
839
826 * macro.py: Give Macro a useful __repr__ method
840 * macro.py: Give Macro a useful __repr__ method
827
841
828 * Magic.py: %whos abbreviates the typename of Macro for brevity.
842 * Magic.py: %whos abbreviates the typename of Macro for brevity.
829
843
830 2006-11-24 Walter Doerwald <walter@livinglogic.de>
844 2006-11-24 Walter Doerwald <walter@livinglogic.de>
831 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
845 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
832 we don't get a duplicate ipipe module, where registration of the xrepr
846 we don't get a duplicate ipipe module, where registration of the xrepr
833 implementation for Text is useless.
847 implementation for Text is useless.
834
848
835 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
849 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
836
850
837 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
851 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
838
852
839 2006-11-24 Ville Vainio <vivainio@gmail.com>
853 2006-11-24 Ville Vainio <vivainio@gmail.com>
840
854
841 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
855 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
842 try to use "cProfile" instead of the slower pure python
856 try to use "cProfile" instead of the slower pure python
843 "profile"
857 "profile"
844
858
845 2006-11-23 Ville Vainio <vivainio@gmail.com>
859 2006-11-23 Ville Vainio <vivainio@gmail.com>
846
860
847 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
861 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
848 Qt+IPython+Designer link in documentation.
862 Qt+IPython+Designer link in documentation.
849
863
850 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
864 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
851 correct Pdb object to %pydb.
865 correct Pdb object to %pydb.
852
866
853
867
854 2006-11-22 Walter Doerwald <walter@livinglogic.de>
868 2006-11-22 Walter Doerwald <walter@livinglogic.de>
855 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
869 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
856 generic xrepr(), otherwise the list implementation would kick in.
870 generic xrepr(), otherwise the list implementation would kick in.
857
871
858 2006-11-21 Ville Vainio <vivainio@gmail.com>
872 2006-11-21 Ville Vainio <vivainio@gmail.com>
859
873
860 * upgrade_dir.py: Now actually overwrites a nonmodified user file
874 * upgrade_dir.py: Now actually overwrites a nonmodified user file
861 with one from UserConfig.
875 with one from UserConfig.
862
876
863 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
877 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
864 it was missing which broke the sh profile.
878 it was missing which broke the sh profile.
865
879
866 * completer.py: file completer now uses explicit '/' instead
880 * completer.py: file completer now uses explicit '/' instead
867 of os.path.join, expansion of 'foo' was broken on win32
881 of os.path.join, expansion of 'foo' was broken on win32
868 if there was one directory with name 'foobar'.
882 if there was one directory with name 'foobar'.
869
883
870 * A bunch of patches from Kirill Smelkov:
884 * A bunch of patches from Kirill Smelkov:
871
885
872 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
886 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
873
887
874 * [patch 7/9] Implement %page -r (page in raw mode) -
888 * [patch 7/9] Implement %page -r (page in raw mode) -
875
889
876 * [patch 5/9] ScientificPython webpage has moved
890 * [patch 5/9] ScientificPython webpage has moved
877
891
878 * [patch 4/9] The manual mentions %ds, should be %dhist
892 * [patch 4/9] The manual mentions %ds, should be %dhist
879
893
880 * [patch 3/9] Kill old bits from %prun doc.
894 * [patch 3/9] Kill old bits from %prun doc.
881
895
882 * [patch 1/9] Fix typos here and there.
896 * [patch 1/9] Fix typos here and there.
883
897
884 2006-11-08 Ville Vainio <vivainio@gmail.com>
898 2006-11-08 Ville Vainio <vivainio@gmail.com>
885
899
886 * completer.py (attr_matches): catch all exceptions raised
900 * completer.py (attr_matches): catch all exceptions raised
887 by eval of expr with dots.
901 by eval of expr with dots.
888
902
889 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
903 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
890
904
891 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
905 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
892 input if it starts with whitespace. This allows you to paste
906 input if it starts with whitespace. This allows you to paste
893 indented input from any editor without manually having to type in
907 indented input from any editor without manually having to type in
894 the 'if 1:', which is convenient when working interactively.
908 the 'if 1:', which is convenient when working interactively.
895 Slightly modifed version of a patch by Bo Peng
909 Slightly modifed version of a patch by Bo Peng
896 <bpeng-AT-rice.edu>.
910 <bpeng-AT-rice.edu>.
897
911
898 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
912 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
899
913
900 * IPython/irunner.py (main): modified irunner so it automatically
914 * IPython/irunner.py (main): modified irunner so it automatically
901 recognizes the right runner to use based on the extension (.py for
915 recognizes the right runner to use based on the extension (.py for
902 python, .ipy for ipython and .sage for sage).
916 python, .ipy for ipython and .sage for sage).
903
917
904 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
918 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
905 visible in ipapi as ip.config(), to programatically control the
919 visible in ipapi as ip.config(), to programatically control the
906 internal rc object. There's an accompanying %config magic for
920 internal rc object. There's an accompanying %config magic for
907 interactive use, which has been enhanced to match the
921 interactive use, which has been enhanced to match the
908 funtionality in ipconfig.
922 funtionality in ipconfig.
909
923
910 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
924 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
911 so it's not just a toggle, it now takes an argument. Add support
925 so it's not just a toggle, it now takes an argument. Add support
912 for a customizable header when making system calls, as the new
926 for a customizable header when making system calls, as the new
913 system_header variable in the ipythonrc file.
927 system_header variable in the ipythonrc file.
914
928
915 2006-11-03 Walter Doerwald <walter@livinglogic.de>
929 2006-11-03 Walter Doerwald <walter@livinglogic.de>
916
930
917 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
931 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
918 generic functions (using Philip J. Eby's simplegeneric package).
932 generic functions (using Philip J. Eby's simplegeneric package).
919 This makes it possible to customize the display of third-party classes
933 This makes it possible to customize the display of third-party classes
920 without having to monkeypatch them. xiter() no longer supports a mode
934 without having to monkeypatch them. xiter() no longer supports a mode
921 argument and the XMode class has been removed. The same functionality can
935 argument and the XMode class has been removed. The same functionality can
922 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
936 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
923 One consequence of the switch to generic functions is that xrepr() and
937 One consequence of the switch to generic functions is that xrepr() and
924 xattrs() implementation must define the default value for the mode
938 xattrs() implementation must define the default value for the mode
925 argument themselves and xattrs() implementations must return real
939 argument themselves and xattrs() implementations must return real
926 descriptors.
940 descriptors.
927
941
928 * IPython/external: This new subpackage will contain all third-party
942 * IPython/external: This new subpackage will contain all third-party
929 packages that are bundled with IPython. (The first one is simplegeneric).
943 packages that are bundled with IPython. (The first one is simplegeneric).
930
944
931 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
945 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
932 directory which as been dropped in r1703.
946 directory which as been dropped in r1703.
933
947
934 * IPython/Extensions/ipipe.py (iless): Fixed.
948 * IPython/Extensions/ipipe.py (iless): Fixed.
935
949
936 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
950 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
937
951
938 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
952 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
939
953
940 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
954 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
941 handling in variable expansion so that shells and magics recognize
955 handling in variable expansion so that shells and magics recognize
942 function local scopes correctly. Bug reported by Brian.
956 function local scopes correctly. Bug reported by Brian.
943
957
944 * scripts/ipython: remove the very first entry in sys.path which
958 * scripts/ipython: remove the very first entry in sys.path which
945 Python auto-inserts for scripts, so that sys.path under IPython is
959 Python auto-inserts for scripts, so that sys.path under IPython is
946 as similar as possible to that under plain Python.
960 as similar as possible to that under plain Python.
947
961
948 * IPython/completer.py (IPCompleter.file_matches): Fix
962 * IPython/completer.py (IPCompleter.file_matches): Fix
949 tab-completion so that quotes are not closed unless the completion
963 tab-completion so that quotes are not closed unless the completion
950 is unambiguous. After a request by Stefan. Minor cleanups in
964 is unambiguous. After a request by Stefan. Minor cleanups in
951 ipy_stock_completers.
965 ipy_stock_completers.
952
966
953 2006-11-02 Ville Vainio <vivainio@gmail.com>
967 2006-11-02 Ville Vainio <vivainio@gmail.com>
954
968
955 * ipy_stock_completers.py: Add %run and %cd completers.
969 * ipy_stock_completers.py: Add %run and %cd completers.
956
970
957 * completer.py: Try running custom completer for both
971 * completer.py: Try running custom completer for both
958 "foo" and "%foo" if the command is just "foo". Ignore case
972 "foo" and "%foo" if the command is just "foo". Ignore case
959 when filtering possible completions.
973 when filtering possible completions.
960
974
961 * UserConfig/ipy_user_conf.py: install stock completers as default
975 * UserConfig/ipy_user_conf.py: install stock completers as default
962
976
963 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
977 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
964 simplified readline history save / restore through a wrapper
978 simplified readline history save / restore through a wrapper
965 function
979 function
966
980
967
981
968 2006-10-31 Ville Vainio <vivainio@gmail.com>
982 2006-10-31 Ville Vainio <vivainio@gmail.com>
969
983
970 * strdispatch.py, completer.py, ipy_stock_completers.py:
984 * strdispatch.py, completer.py, ipy_stock_completers.py:
971 Allow str_key ("command") in completer hooks. Implement
985 Allow str_key ("command") in completer hooks. Implement
972 trivial completer for 'import' (stdlib modules only). Rename
986 trivial completer for 'import' (stdlib modules only). Rename
973 ipy_linux_package_managers.py to ipy_stock_completers.py.
987 ipy_linux_package_managers.py to ipy_stock_completers.py.
974 SVN completer.
988 SVN completer.
975
989
976 * Extensions/ledit.py: %magic line editor for easily and
990 * Extensions/ledit.py: %magic line editor for easily and
977 incrementally manipulating lists of strings. The magic command
991 incrementally manipulating lists of strings. The magic command
978 name is %led.
992 name is %led.
979
993
980 2006-10-30 Ville Vainio <vivainio@gmail.com>
994 2006-10-30 Ville Vainio <vivainio@gmail.com>
981
995
982 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
996 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
983 Bernsteins's patches for pydb integration.
997 Bernsteins's patches for pydb integration.
984 http://bashdb.sourceforge.net/pydb/
998 http://bashdb.sourceforge.net/pydb/
985
999
986 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1000 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
987 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1001 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
988 custom completer hook to allow the users to implement their own
1002 custom completer hook to allow the users to implement their own
989 completers. See ipy_linux_package_managers.py for example. The
1003 completers. See ipy_linux_package_managers.py for example. The
990 hook name is 'complete_command'.
1004 hook name is 'complete_command'.
991
1005
992 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1006 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
993
1007
994 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1008 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
995 Numeric leftovers.
1009 Numeric leftovers.
996
1010
997 * ipython.el (py-execute-region): apply Stefan's patch to fix
1011 * ipython.el (py-execute-region): apply Stefan's patch to fix
998 garbled results if the python shell hasn't been previously started.
1012 garbled results if the python shell hasn't been previously started.
999
1013
1000 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1014 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1001 pretty generic function and useful for other things.
1015 pretty generic function and useful for other things.
1002
1016
1003 * IPython/OInspect.py (getsource): Add customizable source
1017 * IPython/OInspect.py (getsource): Add customizable source
1004 extractor. After a request/patch form W. Stein (SAGE).
1018 extractor. After a request/patch form W. Stein (SAGE).
1005
1019
1006 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1020 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1007 window size to a more reasonable value from what pexpect does,
1021 window size to a more reasonable value from what pexpect does,
1008 since their choice causes wrapping bugs with long input lines.
1022 since their choice causes wrapping bugs with long input lines.
1009
1023
1010 2006-10-28 Ville Vainio <vivainio@gmail.com>
1024 2006-10-28 Ville Vainio <vivainio@gmail.com>
1011
1025
1012 * Magic.py (%run): Save and restore the readline history from
1026 * Magic.py (%run): Save and restore the readline history from
1013 file around %run commands to prevent side effects from
1027 file around %run commands to prevent side effects from
1014 %runned programs that might use readline (e.g. pydb).
1028 %runned programs that might use readline (e.g. pydb).
1015
1029
1016 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1030 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1017 invoking the pydb enhanced debugger.
1031 invoking the pydb enhanced debugger.
1018
1032
1019 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1033 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1020
1034
1021 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1035 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1022 call the base class method and propagate the return value to
1036 call the base class method and propagate the return value to
1023 ifile. This is now done by path itself.
1037 ifile. This is now done by path itself.
1024
1038
1025 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1039 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1026
1040
1027 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1041 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1028 api: set_crash_handler(), to expose the ability to change the
1042 api: set_crash_handler(), to expose the ability to change the
1029 internal crash handler.
1043 internal crash handler.
1030
1044
1031 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1045 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1032 the various parameters of the crash handler so that apps using
1046 the various parameters of the crash handler so that apps using
1033 IPython as their engine can customize crash handling. Ipmlemented
1047 IPython as their engine can customize crash handling. Ipmlemented
1034 at the request of SAGE.
1048 at the request of SAGE.
1035
1049
1036 2006-10-14 Ville Vainio <vivainio@gmail.com>
1050 2006-10-14 Ville Vainio <vivainio@gmail.com>
1037
1051
1038 * Magic.py, ipython.el: applied first "safe" part of Rocky
1052 * Magic.py, ipython.el: applied first "safe" part of Rocky
1039 Bernstein's patch set for pydb integration.
1053 Bernstein's patch set for pydb integration.
1040
1054
1041 * Magic.py (%unalias, %alias): %store'd aliases can now be
1055 * Magic.py (%unalias, %alias): %store'd aliases can now be
1042 removed with '%unalias'. %alias w/o args now shows most
1056 removed with '%unalias'. %alias w/o args now shows most
1043 interesting (stored / manually defined) aliases last
1057 interesting (stored / manually defined) aliases last
1044 where they catch the eye w/o scrolling.
1058 where they catch the eye w/o scrolling.
1045
1059
1046 * Magic.py (%rehashx), ext_rehashdir.py: files with
1060 * Magic.py (%rehashx), ext_rehashdir.py: files with
1047 'py' extension are always considered executable, even
1061 'py' extension are always considered executable, even
1048 when not in PATHEXT environment variable.
1062 when not in PATHEXT environment variable.
1049
1063
1050 2006-10-12 Ville Vainio <vivainio@gmail.com>
1064 2006-10-12 Ville Vainio <vivainio@gmail.com>
1051
1065
1052 * jobctrl.py: Add new "jobctrl" extension for spawning background
1066 * jobctrl.py: Add new "jobctrl" extension for spawning background
1053 processes with "&find /". 'import jobctrl' to try it out. Requires
1067 processes with "&find /". 'import jobctrl' to try it out. Requires
1054 'subprocess' module, standard in python 2.4+.
1068 'subprocess' module, standard in python 2.4+.
1055
1069
1056 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1070 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1057 so if foo -> bar and bar -> baz, then foo -> baz.
1071 so if foo -> bar and bar -> baz, then foo -> baz.
1058
1072
1059 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1073 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1060
1074
1061 * IPython/Magic.py (Magic.parse_options): add a new posix option
1075 * IPython/Magic.py (Magic.parse_options): add a new posix option
1062 to allow parsing of input args in magics that doesn't strip quotes
1076 to allow parsing of input args in magics that doesn't strip quotes
1063 (if posix=False). This also closes %timeit bug reported by
1077 (if posix=False). This also closes %timeit bug reported by
1064 Stefan.
1078 Stefan.
1065
1079
1066 2006-10-03 Ville Vainio <vivainio@gmail.com>
1080 2006-10-03 Ville Vainio <vivainio@gmail.com>
1067
1081
1068 * iplib.py (raw_input, interact): Return ValueError catching for
1082 * iplib.py (raw_input, interact): Return ValueError catching for
1069 raw_input. Fixes infinite loop for sys.stdin.close() or
1083 raw_input. Fixes infinite loop for sys.stdin.close() or
1070 sys.stdout.close().
1084 sys.stdout.close().
1071
1085
1072 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1086 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1073
1087
1074 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1088 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1075 to help in handling doctests. irunner is now pretty useful for
1089 to help in handling doctests. irunner is now pretty useful for
1076 running standalone scripts and simulate a full interactive session
1090 running standalone scripts and simulate a full interactive session
1077 in a format that can be then pasted as a doctest.
1091 in a format that can be then pasted as a doctest.
1078
1092
1079 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1093 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1080 on top of the default (useless) ones. This also fixes the nasty
1094 on top of the default (useless) ones. This also fixes the nasty
1081 way in which 2.5's Quitter() exits (reverted [1785]).
1095 way in which 2.5's Quitter() exits (reverted [1785]).
1082
1096
1083 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1097 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1084 2.5.
1098 2.5.
1085
1099
1086 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1100 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1087 color scheme is updated as well when color scheme is changed
1101 color scheme is updated as well when color scheme is changed
1088 interactively.
1102 interactively.
1089
1103
1090 2006-09-27 Ville Vainio <vivainio@gmail.com>
1104 2006-09-27 Ville Vainio <vivainio@gmail.com>
1091
1105
1092 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1106 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1093 infinite loop and just exit. It's a hack, but will do for a while.
1107 infinite loop and just exit. It's a hack, but will do for a while.
1094
1108
1095 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1109 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1096
1110
1097 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1111 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1098 the constructor, this makes it possible to get a list of only directories
1112 the constructor, this makes it possible to get a list of only directories
1099 or only files.
1113 or only files.
1100
1114
1101 2006-08-12 Ville Vainio <vivainio@gmail.com>
1115 2006-08-12 Ville Vainio <vivainio@gmail.com>
1102
1116
1103 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1117 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1104 they broke unittest
1118 they broke unittest
1105
1119
1106 2006-08-11 Ville Vainio <vivainio@gmail.com>
1120 2006-08-11 Ville Vainio <vivainio@gmail.com>
1107
1121
1108 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1122 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1109 by resolving issue properly, i.e. by inheriting FakeModule
1123 by resolving issue properly, i.e. by inheriting FakeModule
1110 from types.ModuleType. Pickling ipython interactive data
1124 from types.ModuleType. Pickling ipython interactive data
1111 should still work as usual (testing appreciated).
1125 should still work as usual (testing appreciated).
1112
1126
1113 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1127 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1114
1128
1115 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1129 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1116 running under python 2.3 with code from 2.4 to fix a bug with
1130 running under python 2.3 with code from 2.4 to fix a bug with
1117 help(). Reported by the Debian maintainers, Norbert Tretkowski
1131 help(). Reported by the Debian maintainers, Norbert Tretkowski
1118 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1132 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1119 <afayolle-AT-debian.org>.
1133 <afayolle-AT-debian.org>.
1120
1134
1121 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1135 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1122
1136
1123 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1137 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1124 (which was displaying "quit" twice).
1138 (which was displaying "quit" twice).
1125
1139
1126 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1140 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1127
1141
1128 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1142 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1129 the mode argument).
1143 the mode argument).
1130
1144
1131 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1145 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1132
1146
1133 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1147 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1134 not running under IPython.
1148 not running under IPython.
1135
1149
1136 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1150 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1137 and make it iterable (iterating over the attribute itself). Add two new
1151 and make it iterable (iterating over the attribute itself). Add two new
1138 magic strings for __xattrs__(): If the string starts with "-", the attribute
1152 magic strings for __xattrs__(): If the string starts with "-", the attribute
1139 will not be displayed in ibrowse's detail view (but it can still be
1153 will not be displayed in ibrowse's detail view (but it can still be
1140 iterated over). This makes it possible to add attributes that are large
1154 iterated over). This makes it possible to add attributes that are large
1141 lists or generator methods to the detail view. Replace magic attribute names
1155 lists or generator methods to the detail view. Replace magic attribute names
1142 and _attrname() and _getattr() with "descriptors": For each type of magic
1156 and _attrname() and _getattr() with "descriptors": For each type of magic
1143 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1157 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1144 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1158 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1145 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1159 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1146 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1160 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1147 are still supported.
1161 are still supported.
1148
1162
1149 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1163 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1150 fails in ibrowse.fetch(), the exception object is added as the last item
1164 fails in ibrowse.fetch(), the exception object is added as the last item
1151 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1165 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1152 a generator throws an exception midway through execution.
1166 a generator throws an exception midway through execution.
1153
1167
1154 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1168 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1155 encoding into methods.
1169 encoding into methods.
1156
1170
1157 2006-07-26 Ville Vainio <vivainio@gmail.com>
1171 2006-07-26 Ville Vainio <vivainio@gmail.com>
1158
1172
1159 * iplib.py: history now stores multiline input as single
1173 * iplib.py: history now stores multiline input as single
1160 history entries. Patch by Jorgen Cederlof.
1174 history entries. Patch by Jorgen Cederlof.
1161
1175
1162 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1176 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1163
1177
1164 * IPython/Extensions/ibrowse.py: Make cursor visible over
1178 * IPython/Extensions/ibrowse.py: Make cursor visible over
1165 non existing attributes.
1179 non existing attributes.
1166
1180
1167 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1181 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1168
1182
1169 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1183 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1170 error output of the running command doesn't mess up the screen.
1184 error output of the running command doesn't mess up the screen.
1171
1185
1172 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1186 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1173
1187
1174 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1188 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1175 argument. This sorts the items themselves.
1189 argument. This sorts the items themselves.
1176
1190
1177 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1191 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1178
1192
1179 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1193 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1180 Compile expression strings into code objects. This should speed
1194 Compile expression strings into code objects. This should speed
1181 up ifilter and friends somewhat.
1195 up ifilter and friends somewhat.
1182
1196
1183 2006-07-08 Ville Vainio <vivainio@gmail.com>
1197 2006-07-08 Ville Vainio <vivainio@gmail.com>
1184
1198
1185 * Magic.py: %cpaste now strips > from the beginning of lines
1199 * Magic.py: %cpaste now strips > from the beginning of lines
1186 to ease pasting quoted code from emails. Contributed by
1200 to ease pasting quoted code from emails. Contributed by
1187 Stefan van der Walt.
1201 Stefan van der Walt.
1188
1202
1189 2006-06-29 Ville Vainio <vivainio@gmail.com>
1203 2006-06-29 Ville Vainio <vivainio@gmail.com>
1190
1204
1191 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1205 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1192 mode, patch contributed by Darren Dale. NEEDS TESTING!
1206 mode, patch contributed by Darren Dale. NEEDS TESTING!
1193
1207
1194 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1208 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1195
1209
1196 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1210 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1197 a blue background. Fix fetching new display rows when the browser
1211 a blue background. Fix fetching new display rows when the browser
1198 scrolls more than a screenful (e.g. by using the goto command).
1212 scrolls more than a screenful (e.g. by using the goto command).
1199
1213
1200 2006-06-27 Ville Vainio <vivainio@gmail.com>
1214 2006-06-27 Ville Vainio <vivainio@gmail.com>
1201
1215
1202 * Magic.py (_inspect, _ofind) Apply David Huard's
1216 * Magic.py (_inspect, _ofind) Apply David Huard's
1203 patch for displaying the correct docstring for 'property'
1217 patch for displaying the correct docstring for 'property'
1204 attributes.
1218 attributes.
1205
1219
1206 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1220 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1207
1221
1208 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1222 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1209 commands into the methods implementing them.
1223 commands into the methods implementing them.
1210
1224
1211 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1225 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1212
1226
1213 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1227 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1214 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1228 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1215 autoindent support was authored by Jin Liu.
1229 autoindent support was authored by Jin Liu.
1216
1230
1217 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1231 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1218
1232
1219 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1233 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1220 for keymaps with a custom class that simplifies handling.
1234 for keymaps with a custom class that simplifies handling.
1221
1235
1222 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1236 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1223
1237
1224 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1238 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1225 resizing. This requires Python 2.5 to work.
1239 resizing. This requires Python 2.5 to work.
1226
1240
1227 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1241 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1228
1242
1229 * IPython/Extensions/ibrowse.py: Add two new commands to
1243 * IPython/Extensions/ibrowse.py: Add two new commands to
1230 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1244 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1231 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1245 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1232 attributes again. Remapped the help command to "?". Display
1246 attributes again. Remapped the help command to "?". Display
1233 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1247 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1234 as keys for the "home" and "end" commands. Add three new commands
1248 as keys for the "home" and "end" commands. Add three new commands
1235 to the input mode for "find" and friends: "delend" (CTRL-K)
1249 to the input mode for "find" and friends: "delend" (CTRL-K)
1236 deletes to the end of line. "incsearchup" searches upwards in the
1250 deletes to the end of line. "incsearchup" searches upwards in the
1237 command history for an input that starts with the text before the cursor.
1251 command history for an input that starts with the text before the cursor.
1238 "incsearchdown" does the same downwards. Removed a bogus mapping of
1252 "incsearchdown" does the same downwards. Removed a bogus mapping of
1239 the x key to "delete".
1253 the x key to "delete".
1240
1254
1241 2006-06-15 Ville Vainio <vivainio@gmail.com>
1255 2006-06-15 Ville Vainio <vivainio@gmail.com>
1242
1256
1243 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1257 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1244 used to create prompts dynamically, instead of the "old" way of
1258 used to create prompts dynamically, instead of the "old" way of
1245 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1259 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1246 way still works (it's invoked by the default hook), of course.
1260 way still works (it's invoked by the default hook), of course.
1247
1261
1248 * Prompts.py: added generate_output_prompt hook for altering output
1262 * Prompts.py: added generate_output_prompt hook for altering output
1249 prompt
1263 prompt
1250
1264
1251 * Release.py: Changed version string to 0.7.3.svn.
1265 * Release.py: Changed version string to 0.7.3.svn.
1252
1266
1253 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1267 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1254
1268
1255 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1269 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1256 the call to fetch() always tries to fetch enough data for at least one
1270 the call to fetch() always tries to fetch enough data for at least one
1257 full screen. This makes it possible to simply call moveto(0,0,True) in
1271 full screen. This makes it possible to simply call moveto(0,0,True) in
1258 the constructor. Fix typos and removed the obsolete goto attribute.
1272 the constructor. Fix typos and removed the obsolete goto attribute.
1259
1273
1260 2006-06-12 Ville Vainio <vivainio@gmail.com>
1274 2006-06-12 Ville Vainio <vivainio@gmail.com>
1261
1275
1262 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1276 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1263 allowing $variable interpolation within multiline statements,
1277 allowing $variable interpolation within multiline statements,
1264 though so far only with "sh" profile for a testing period.
1278 though so far only with "sh" profile for a testing period.
1265 The patch also enables splitting long commands with \ but it
1279 The patch also enables splitting long commands with \ but it
1266 doesn't work properly yet.
1280 doesn't work properly yet.
1267
1281
1268 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1282 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1269
1283
1270 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1284 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1271 input history and the position of the cursor in the input history for
1285 input history and the position of the cursor in the input history for
1272 the find, findbackwards and goto command.
1286 the find, findbackwards and goto command.
1273
1287
1274 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1288 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1275
1289
1276 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1290 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1277 implements the basic functionality of browser commands that require
1291 implements the basic functionality of browser commands that require
1278 input. Reimplement the goto, find and findbackwards commands as
1292 input. Reimplement the goto, find and findbackwards commands as
1279 subclasses of _CommandInput. Add an input history and keymaps to those
1293 subclasses of _CommandInput. Add an input history and keymaps to those
1280 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1294 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1281 execute commands.
1295 execute commands.
1282
1296
1283 2006-06-07 Ville Vainio <vivainio@gmail.com>
1297 2006-06-07 Ville Vainio <vivainio@gmail.com>
1284
1298
1285 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1299 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1286 running the batch files instead of leaving the session open.
1300 running the batch files instead of leaving the session open.
1287
1301
1288 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1302 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1289
1303
1290 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1304 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1291 the original fix was incomplete. Patch submitted by W. Maier.
1305 the original fix was incomplete. Patch submitted by W. Maier.
1292
1306
1293 2006-06-07 Ville Vainio <vivainio@gmail.com>
1307 2006-06-07 Ville Vainio <vivainio@gmail.com>
1294
1308
1295 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1309 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1296 Confirmation prompts can be supressed by 'quiet' option.
1310 Confirmation prompts can be supressed by 'quiet' option.
1297 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1311 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1298
1312
1299 2006-06-06 *** Released version 0.7.2
1313 2006-06-06 *** Released version 0.7.2
1300
1314
1301 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1315 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1302
1316
1303 * IPython/Release.py (version): Made 0.7.2 final for release.
1317 * IPython/Release.py (version): Made 0.7.2 final for release.
1304 Repo tagged and release cut.
1318 Repo tagged and release cut.
1305
1319
1306 2006-06-05 Ville Vainio <vivainio@gmail.com>
1320 2006-06-05 Ville Vainio <vivainio@gmail.com>
1307
1321
1308 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1322 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1309 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1323 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1310
1324
1311 * upgrade_dir.py: try import 'path' module a bit harder
1325 * upgrade_dir.py: try import 'path' module a bit harder
1312 (for %upgrade)
1326 (for %upgrade)
1313
1327
1314 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1328 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1315
1329
1316 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1330 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1317 instead of looping 20 times.
1331 instead of looping 20 times.
1318
1332
1319 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1333 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1320 correctly at initialization time. Bug reported by Krishna Mohan
1334 correctly at initialization time. Bug reported by Krishna Mohan
1321 Gundu <gkmohan-AT-gmail.com> on the user list.
1335 Gundu <gkmohan-AT-gmail.com> on the user list.
1322
1336
1323 * IPython/Release.py (version): Mark 0.7.2 version to start
1337 * IPython/Release.py (version): Mark 0.7.2 version to start
1324 testing for release on 06/06.
1338 testing for release on 06/06.
1325
1339
1326 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1340 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1327
1341
1328 * scripts/irunner: thin script interface so users don't have to
1342 * scripts/irunner: thin script interface so users don't have to
1329 find the module and call it as an executable, since modules rarely
1343 find the module and call it as an executable, since modules rarely
1330 live in people's PATH.
1344 live in people's PATH.
1331
1345
1332 * IPython/irunner.py (InteractiveRunner.__init__): added
1346 * IPython/irunner.py (InteractiveRunner.__init__): added
1333 delaybeforesend attribute to control delays with newer versions of
1347 delaybeforesend attribute to control delays with newer versions of
1334 pexpect. Thanks to detailed help from pexpect's author, Noah
1348 pexpect. Thanks to detailed help from pexpect's author, Noah
1335 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1349 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1336 correctly (it works in NoColor mode).
1350 correctly (it works in NoColor mode).
1337
1351
1338 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1352 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1339 SAGE list, from improper log() calls.
1353 SAGE list, from improper log() calls.
1340
1354
1341 2006-05-31 Ville Vainio <vivainio@gmail.com>
1355 2006-05-31 Ville Vainio <vivainio@gmail.com>
1342
1356
1343 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1357 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1344 with args in parens to work correctly with dirs that have spaces.
1358 with args in parens to work correctly with dirs that have spaces.
1345
1359
1346 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1360 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1347
1361
1348 * IPython/Logger.py (Logger.logstart): add option to log raw input
1362 * IPython/Logger.py (Logger.logstart): add option to log raw input
1349 instead of the processed one. A -r flag was added to the
1363 instead of the processed one. A -r flag was added to the
1350 %logstart magic used for controlling logging.
1364 %logstart magic used for controlling logging.
1351
1365
1352 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1366 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1353
1367
1354 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1368 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1355 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1369 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1356 recognize the option. After a bug report by Will Maier. This
1370 recognize the option. After a bug report by Will Maier. This
1357 closes #64 (will do it after confirmation from W. Maier).
1371 closes #64 (will do it after confirmation from W. Maier).
1358
1372
1359 * IPython/irunner.py: New module to run scripts as if manually
1373 * IPython/irunner.py: New module to run scripts as if manually
1360 typed into an interactive environment, based on pexpect. After a
1374 typed into an interactive environment, based on pexpect. After a
1361 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1375 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1362 ipython-user list. Simple unittests in the tests/ directory.
1376 ipython-user list. Simple unittests in the tests/ directory.
1363
1377
1364 * tools/release: add Will Maier, OpenBSD port maintainer, to
1378 * tools/release: add Will Maier, OpenBSD port maintainer, to
1365 recepients list. We are now officially part of the OpenBSD ports:
1379 recepients list. We are now officially part of the OpenBSD ports:
1366 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1380 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1367 work.
1381 work.
1368
1382
1369 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1383 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1370
1384
1371 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1385 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1372 so that it doesn't break tkinter apps.
1386 so that it doesn't break tkinter apps.
1373
1387
1374 * IPython/iplib.py (_prefilter): fix bug where aliases would
1388 * IPython/iplib.py (_prefilter): fix bug where aliases would
1375 shadow variables when autocall was fully off. Reported by SAGE
1389 shadow variables when autocall was fully off. Reported by SAGE
1376 author William Stein.
1390 author William Stein.
1377
1391
1378 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1392 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1379 at what detail level strings are computed when foo? is requested.
1393 at what detail level strings are computed when foo? is requested.
1380 This allows users to ask for example that the string form of an
1394 This allows users to ask for example that the string form of an
1381 object is only computed when foo?? is called, or even never, by
1395 object is only computed when foo?? is called, or even never, by
1382 setting the object_info_string_level >= 2 in the configuration
1396 setting the object_info_string_level >= 2 in the configuration
1383 file. This new option has been added and documented. After a
1397 file. This new option has been added and documented. After a
1384 request by SAGE to be able to control the printing of very large
1398 request by SAGE to be able to control the printing of very large
1385 objects more easily.
1399 objects more easily.
1386
1400
1387 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1401 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1388
1402
1389 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1403 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1390 from sys.argv, to be 100% consistent with how Python itself works
1404 from sys.argv, to be 100% consistent with how Python itself works
1391 (as seen for example with python -i file.py). After a bug report
1405 (as seen for example with python -i file.py). After a bug report
1392 by Jeffrey Collins.
1406 by Jeffrey Collins.
1393
1407
1394 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1408 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1395 nasty bug which was preventing custom namespaces with -pylab,
1409 nasty bug which was preventing custom namespaces with -pylab,
1396 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1410 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1397 compatibility (long gone from mpl).
1411 compatibility (long gone from mpl).
1398
1412
1399 * IPython/ipapi.py (make_session): name change: create->make. We
1413 * IPython/ipapi.py (make_session): name change: create->make. We
1400 use make in other places (ipmaker,...), it's shorter and easier to
1414 use make in other places (ipmaker,...), it's shorter and easier to
1401 type and say, etc. I'm trying to clean things before 0.7.2 so
1415 type and say, etc. I'm trying to clean things before 0.7.2 so
1402 that I can keep things stable wrt to ipapi in the chainsaw branch.
1416 that I can keep things stable wrt to ipapi in the chainsaw branch.
1403
1417
1404 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1418 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1405 python-mode recognizes our debugger mode. Add support for
1419 python-mode recognizes our debugger mode. Add support for
1406 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1420 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1407 <m.liu.jin-AT-gmail.com> originally written by
1421 <m.liu.jin-AT-gmail.com> originally written by
1408 doxgen-AT-newsmth.net (with minor modifications for xemacs
1422 doxgen-AT-newsmth.net (with minor modifications for xemacs
1409 compatibility)
1423 compatibility)
1410
1424
1411 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1425 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1412 tracebacks when walking the stack so that the stack tracking system
1426 tracebacks when walking the stack so that the stack tracking system
1413 in emacs' python-mode can identify the frames correctly.
1427 in emacs' python-mode can identify the frames correctly.
1414
1428
1415 * IPython/ipmaker.py (make_IPython): make the internal (and
1429 * IPython/ipmaker.py (make_IPython): make the internal (and
1416 default config) autoedit_syntax value false by default. Too many
1430 default config) autoedit_syntax value false by default. Too many
1417 users have complained to me (both on and off-list) about problems
1431 users have complained to me (both on and off-list) about problems
1418 with this option being on by default, so I'm making it default to
1432 with this option being on by default, so I'm making it default to
1419 off. It can still be enabled by anyone via the usual mechanisms.
1433 off. It can still be enabled by anyone via the usual mechanisms.
1420
1434
1421 * IPython/completer.py (Completer.attr_matches): add support for
1435 * IPython/completer.py (Completer.attr_matches): add support for
1422 PyCrust-style _getAttributeNames magic method. Patch contributed
1436 PyCrust-style _getAttributeNames magic method. Patch contributed
1423 by <mscott-AT-goldenspud.com>. Closes #50.
1437 by <mscott-AT-goldenspud.com>. Closes #50.
1424
1438
1425 * IPython/iplib.py (InteractiveShell.__init__): remove the
1439 * IPython/iplib.py (InteractiveShell.__init__): remove the
1426 deletion of exit/quit from __builtin__, which can break
1440 deletion of exit/quit from __builtin__, which can break
1427 third-party tools like the Zope debugging console. The
1441 third-party tools like the Zope debugging console. The
1428 %exit/%quit magics remain. In general, it's probably a good idea
1442 %exit/%quit magics remain. In general, it's probably a good idea
1429 not to delete anything from __builtin__, since we never know what
1443 not to delete anything from __builtin__, since we never know what
1430 that will break. In any case, python now (for 2.5) will support
1444 that will break. In any case, python now (for 2.5) will support
1431 'real' exit/quit, so this issue is moot. Closes #55.
1445 'real' exit/quit, so this issue is moot. Closes #55.
1432
1446
1433 * IPython/genutils.py (with_obj): rename the 'with' function to
1447 * IPython/genutils.py (with_obj): rename the 'with' function to
1434 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1448 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1435 becomes a language keyword. Closes #53.
1449 becomes a language keyword. Closes #53.
1436
1450
1437 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1451 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1438 __file__ attribute to this so it fools more things into thinking
1452 __file__ attribute to this so it fools more things into thinking
1439 it is a real module. Closes #59.
1453 it is a real module. Closes #59.
1440
1454
1441 * IPython/Magic.py (magic_edit): add -n option to open the editor
1455 * IPython/Magic.py (magic_edit): add -n option to open the editor
1442 at a specific line number. After a patch by Stefan van der Walt.
1456 at a specific line number. After a patch by Stefan van der Walt.
1443
1457
1444 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1458 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1445
1459
1446 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1460 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1447 reason the file could not be opened. After automatic crash
1461 reason the file could not be opened. After automatic crash
1448 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1462 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1449 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1463 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1450 (_should_recompile): Don't fire editor if using %bg, since there
1464 (_should_recompile): Don't fire editor if using %bg, since there
1451 is no file in the first place. From the same report as above.
1465 is no file in the first place. From the same report as above.
1452 (raw_input): protect against faulty third-party prefilters. After
1466 (raw_input): protect against faulty third-party prefilters. After
1453 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1467 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1454 while running under SAGE.
1468 while running under SAGE.
1455
1469
1456 2006-05-23 Ville Vainio <vivainio@gmail.com>
1470 2006-05-23 Ville Vainio <vivainio@gmail.com>
1457
1471
1458 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1472 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1459 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1473 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1460 now returns None (again), unless dummy is specifically allowed by
1474 now returns None (again), unless dummy is specifically allowed by
1461 ipapi.get(allow_dummy=True).
1475 ipapi.get(allow_dummy=True).
1462
1476
1463 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1477 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1464
1478
1465 * IPython: remove all 2.2-compatibility objects and hacks from
1479 * IPython: remove all 2.2-compatibility objects and hacks from
1466 everywhere, since we only support 2.3 at this point. Docs
1480 everywhere, since we only support 2.3 at this point. Docs
1467 updated.
1481 updated.
1468
1482
1469 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1483 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1470 Anything requiring extra validation can be turned into a Python
1484 Anything requiring extra validation can be turned into a Python
1471 property in the future. I used a property for the db one b/c
1485 property in the future. I used a property for the db one b/c
1472 there was a nasty circularity problem with the initialization
1486 there was a nasty circularity problem with the initialization
1473 order, which right now I don't have time to clean up.
1487 order, which right now I don't have time to clean up.
1474
1488
1475 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1489 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1476 another locking bug reported by Jorgen. I'm not 100% sure though,
1490 another locking bug reported by Jorgen. I'm not 100% sure though,
1477 so more testing is needed...
1491 so more testing is needed...
1478
1492
1479 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1493 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1480
1494
1481 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1495 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1482 local variables from any routine in user code (typically executed
1496 local variables from any routine in user code (typically executed
1483 with %run) directly into the interactive namespace. Very useful
1497 with %run) directly into the interactive namespace. Very useful
1484 when doing complex debugging.
1498 when doing complex debugging.
1485 (IPythonNotRunning): Changed the default None object to a dummy
1499 (IPythonNotRunning): Changed the default None object to a dummy
1486 whose attributes can be queried as well as called without
1500 whose attributes can be queried as well as called without
1487 exploding, to ease writing code which works transparently both in
1501 exploding, to ease writing code which works transparently both in
1488 and out of ipython and uses some of this API.
1502 and out of ipython and uses some of this API.
1489
1503
1490 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1504 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1491
1505
1492 * IPython/hooks.py (result_display): Fix the fact that our display
1506 * IPython/hooks.py (result_display): Fix the fact that our display
1493 hook was using str() instead of repr(), as the default python
1507 hook was using str() instead of repr(), as the default python
1494 console does. This had gone unnoticed b/c it only happened if
1508 console does. This had gone unnoticed b/c it only happened if
1495 %Pprint was off, but the inconsistency was there.
1509 %Pprint was off, but the inconsistency was there.
1496
1510
1497 2006-05-15 Ville Vainio <vivainio@gmail.com>
1511 2006-05-15 Ville Vainio <vivainio@gmail.com>
1498
1512
1499 * Oinspect.py: Only show docstring for nonexisting/binary files
1513 * Oinspect.py: Only show docstring for nonexisting/binary files
1500 when doing object??, closing ticket #62
1514 when doing object??, closing ticket #62
1501
1515
1502 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1516 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1503
1517
1504 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1518 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1505 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1519 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1506 was being released in a routine which hadn't checked if it had
1520 was being released in a routine which hadn't checked if it had
1507 been the one to acquire it.
1521 been the one to acquire it.
1508
1522
1509 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1523 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1510
1524
1511 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1525 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1512
1526
1513 2006-04-11 Ville Vainio <vivainio@gmail.com>
1527 2006-04-11 Ville Vainio <vivainio@gmail.com>
1514
1528
1515 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1529 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1516 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1530 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1517 prefilters, allowing stuff like magics and aliases in the file.
1531 prefilters, allowing stuff like magics and aliases in the file.
1518
1532
1519 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1533 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1520 added. Supported now are "%clear in" and "%clear out" (clear input and
1534 added. Supported now are "%clear in" and "%clear out" (clear input and
1521 output history, respectively). Also fixed CachedOutput.flush to
1535 output history, respectively). Also fixed CachedOutput.flush to
1522 properly flush the output cache.
1536 properly flush the output cache.
1523
1537
1524 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1538 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1525 half-success (and fail explicitly).
1539 half-success (and fail explicitly).
1526
1540
1527 2006-03-28 Ville Vainio <vivainio@gmail.com>
1541 2006-03-28 Ville Vainio <vivainio@gmail.com>
1528
1542
1529 * iplib.py: Fix quoting of aliases so that only argless ones
1543 * iplib.py: Fix quoting of aliases so that only argless ones
1530 are quoted
1544 are quoted
1531
1545
1532 2006-03-28 Ville Vainio <vivainio@gmail.com>
1546 2006-03-28 Ville Vainio <vivainio@gmail.com>
1533
1547
1534 * iplib.py: Quote aliases with spaces in the name.
1548 * iplib.py: Quote aliases with spaces in the name.
1535 "c:\program files\blah\bin" is now legal alias target.
1549 "c:\program files\blah\bin" is now legal alias target.
1536
1550
1537 * ext_rehashdir.py: Space no longer allowed as arg
1551 * ext_rehashdir.py: Space no longer allowed as arg
1538 separator, since space is legal in path names.
1552 separator, since space is legal in path names.
1539
1553
1540 2006-03-16 Ville Vainio <vivainio@gmail.com>
1554 2006-03-16 Ville Vainio <vivainio@gmail.com>
1541
1555
1542 * upgrade_dir.py: Take path.py from Extensions, correcting
1556 * upgrade_dir.py: Take path.py from Extensions, correcting
1543 %upgrade magic
1557 %upgrade magic
1544
1558
1545 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1559 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1546
1560
1547 * hooks.py: Only enclose editor binary in quotes if legal and
1561 * hooks.py: Only enclose editor binary in quotes if legal and
1548 necessary (space in the name, and is an existing file). Fixes a bug
1562 necessary (space in the name, and is an existing file). Fixes a bug
1549 reported by Zachary Pincus.
1563 reported by Zachary Pincus.
1550
1564
1551 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1565 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1552
1566
1553 * Manual: thanks to a tip on proper color handling for Emacs, by
1567 * Manual: thanks to a tip on proper color handling for Emacs, by
1554 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1568 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1555
1569
1556 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1570 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1557 by applying the provided patch. Thanks to Liu Jin
1571 by applying the provided patch. Thanks to Liu Jin
1558 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1572 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1559 XEmacs/Linux, I'm trusting the submitter that it actually helps
1573 XEmacs/Linux, I'm trusting the submitter that it actually helps
1560 under win32/GNU Emacs. Will revisit if any problems are reported.
1574 under win32/GNU Emacs. Will revisit if any problems are reported.
1561
1575
1562 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1576 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1563
1577
1564 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1578 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1565 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1579 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1566
1580
1567 2006-03-12 Ville Vainio <vivainio@gmail.com>
1581 2006-03-12 Ville Vainio <vivainio@gmail.com>
1568
1582
1569 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1583 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1570 Torsten Marek.
1584 Torsten Marek.
1571
1585
1572 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1586 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1573
1587
1574 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1588 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1575 line ranges works again.
1589 line ranges works again.
1576
1590
1577 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1591 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1578
1592
1579 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1593 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1580 and friends, after a discussion with Zach Pincus on ipython-user.
1594 and friends, after a discussion with Zach Pincus on ipython-user.
1581 I'm not 100% sure, but after thinking about it quite a bit, it may
1595 I'm not 100% sure, but after thinking about it quite a bit, it may
1582 be OK. Testing with the multithreaded shells didn't reveal any
1596 be OK. Testing with the multithreaded shells didn't reveal any
1583 problems, but let's keep an eye out.
1597 problems, but let's keep an eye out.
1584
1598
1585 In the process, I fixed a few things which were calling
1599 In the process, I fixed a few things which were calling
1586 self.InteractiveTB() directly (like safe_execfile), which is a
1600 self.InteractiveTB() directly (like safe_execfile), which is a
1587 mistake: ALL exception reporting should be done by calling
1601 mistake: ALL exception reporting should be done by calling
1588 self.showtraceback(), which handles state and tab-completion and
1602 self.showtraceback(), which handles state and tab-completion and
1589 more.
1603 more.
1590
1604
1591 2006-03-01 Ville Vainio <vivainio@gmail.com>
1605 2006-03-01 Ville Vainio <vivainio@gmail.com>
1592
1606
1593 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1607 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1594 To use, do "from ipipe import *".
1608 To use, do "from ipipe import *".
1595
1609
1596 2006-02-24 Ville Vainio <vivainio@gmail.com>
1610 2006-02-24 Ville Vainio <vivainio@gmail.com>
1597
1611
1598 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1612 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1599 "cleanly" and safely than the older upgrade mechanism.
1613 "cleanly" and safely than the older upgrade mechanism.
1600
1614
1601 2006-02-21 Ville Vainio <vivainio@gmail.com>
1615 2006-02-21 Ville Vainio <vivainio@gmail.com>
1602
1616
1603 * Magic.py: %save works again.
1617 * Magic.py: %save works again.
1604
1618
1605 2006-02-15 Ville Vainio <vivainio@gmail.com>
1619 2006-02-15 Ville Vainio <vivainio@gmail.com>
1606
1620
1607 * Magic.py: %Pprint works again
1621 * Magic.py: %Pprint works again
1608
1622
1609 * Extensions/ipy_sane_defaults.py: Provide everything provided
1623 * Extensions/ipy_sane_defaults.py: Provide everything provided
1610 in default ipythonrc, to make it possible to have a completely empty
1624 in default ipythonrc, to make it possible to have a completely empty
1611 ipythonrc (and thus completely rc-file free configuration)
1625 ipythonrc (and thus completely rc-file free configuration)
1612
1626
1613 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1627 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1614
1628
1615 * IPython/hooks.py (editor): quote the call to the editor command,
1629 * IPython/hooks.py (editor): quote the call to the editor command,
1616 to allow commands with spaces in them. Problem noted by watching
1630 to allow commands with spaces in them. Problem noted by watching
1617 Ian Oswald's video about textpad under win32 at
1631 Ian Oswald's video about textpad under win32 at
1618 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1632 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1619
1633
1620 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1634 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1621 describing magics (we haven't used @ for a loong time).
1635 describing magics (we haven't used @ for a loong time).
1622
1636
1623 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1637 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1624 contributed by marienz to close
1638 contributed by marienz to close
1625 http://www.scipy.net/roundup/ipython/issue53.
1639 http://www.scipy.net/roundup/ipython/issue53.
1626
1640
1627 2006-02-10 Ville Vainio <vivainio@gmail.com>
1641 2006-02-10 Ville Vainio <vivainio@gmail.com>
1628
1642
1629 * genutils.py: getoutput now works in win32 too
1643 * genutils.py: getoutput now works in win32 too
1630
1644
1631 * completer.py: alias and magic completion only invoked
1645 * completer.py: alias and magic completion only invoked
1632 at the first "item" in the line, to avoid "cd %store"
1646 at the first "item" in the line, to avoid "cd %store"
1633 nonsense.
1647 nonsense.
1634
1648
1635 2006-02-09 Ville Vainio <vivainio@gmail.com>
1649 2006-02-09 Ville Vainio <vivainio@gmail.com>
1636
1650
1637 * test/*: Added a unit testing framework (finally).
1651 * test/*: Added a unit testing framework (finally).
1638 '%run runtests.py' to run test_*.
1652 '%run runtests.py' to run test_*.
1639
1653
1640 * ipapi.py: Exposed runlines and set_custom_exc
1654 * ipapi.py: Exposed runlines and set_custom_exc
1641
1655
1642 2006-02-07 Ville Vainio <vivainio@gmail.com>
1656 2006-02-07 Ville Vainio <vivainio@gmail.com>
1643
1657
1644 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1658 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1645 instead use "f(1 2)" as before.
1659 instead use "f(1 2)" as before.
1646
1660
1647 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1661 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1648
1662
1649 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1663 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1650 facilities, for demos processed by the IPython input filter
1664 facilities, for demos processed by the IPython input filter
1651 (IPythonDemo), and for running a script one-line-at-a-time as a
1665 (IPythonDemo), and for running a script one-line-at-a-time as a
1652 demo, both for pure Python (LineDemo) and for IPython-processed
1666 demo, both for pure Python (LineDemo) and for IPython-processed
1653 input (IPythonLineDemo). After a request by Dave Kohel, from the
1667 input (IPythonLineDemo). After a request by Dave Kohel, from the
1654 SAGE team.
1668 SAGE team.
1655 (Demo.edit): added an edit() method to the demo objects, to edit
1669 (Demo.edit): added an edit() method to the demo objects, to edit
1656 the in-memory copy of the last executed block.
1670 the in-memory copy of the last executed block.
1657
1671
1658 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1672 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1659 processing to %edit, %macro and %save. These commands can now be
1673 processing to %edit, %macro and %save. These commands can now be
1660 invoked on the unprocessed input as it was typed by the user
1674 invoked on the unprocessed input as it was typed by the user
1661 (without any prefilters applied). After requests by the SAGE team
1675 (without any prefilters applied). After requests by the SAGE team
1662 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1676 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1663
1677
1664 2006-02-01 Ville Vainio <vivainio@gmail.com>
1678 2006-02-01 Ville Vainio <vivainio@gmail.com>
1665
1679
1666 * setup.py, eggsetup.py: easy_install ipython==dev works
1680 * setup.py, eggsetup.py: easy_install ipython==dev works
1667 correctly now (on Linux)
1681 correctly now (on Linux)
1668
1682
1669 * ipy_user_conf,ipmaker: user config changes, removed spurious
1683 * ipy_user_conf,ipmaker: user config changes, removed spurious
1670 warnings
1684 warnings
1671
1685
1672 * iplib: if rc.banner is string, use it as is.
1686 * iplib: if rc.banner is string, use it as is.
1673
1687
1674 * Magic: %pycat accepts a string argument and pages it's contents.
1688 * Magic: %pycat accepts a string argument and pages it's contents.
1675
1689
1676
1690
1677 2006-01-30 Ville Vainio <vivainio@gmail.com>
1691 2006-01-30 Ville Vainio <vivainio@gmail.com>
1678
1692
1679 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1693 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1680 Now %store and bookmarks work through PickleShare, meaning that
1694 Now %store and bookmarks work through PickleShare, meaning that
1681 concurrent access is possible and all ipython sessions see the
1695 concurrent access is possible and all ipython sessions see the
1682 same database situation all the time, instead of snapshot of
1696 same database situation all the time, instead of snapshot of
1683 the situation when the session was started. Hence, %bookmark
1697 the situation when the session was started. Hence, %bookmark
1684 results are immediately accessible from othes sessions. The database
1698 results are immediately accessible from othes sessions. The database
1685 is also available for use by user extensions. See:
1699 is also available for use by user extensions. See:
1686 http://www.python.org/pypi/pickleshare
1700 http://www.python.org/pypi/pickleshare
1687
1701
1688 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1702 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1689
1703
1690 * aliases can now be %store'd
1704 * aliases can now be %store'd
1691
1705
1692 * path.py moved to Extensions so that pickleshare does not need
1706 * path.py moved to Extensions so that pickleshare does not need
1693 IPython-specific import. Extensions added to pythonpath right
1707 IPython-specific import. Extensions added to pythonpath right
1694 at __init__.
1708 at __init__.
1695
1709
1696 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1710 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1697 called with _ip.system and the pre-transformed command string.
1711 called with _ip.system and the pre-transformed command string.
1698
1712
1699 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1713 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1700
1714
1701 * IPython/iplib.py (interact): Fix that we were not catching
1715 * IPython/iplib.py (interact): Fix that we were not catching
1702 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1716 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1703 logic here had to change, but it's fixed now.
1717 logic here had to change, but it's fixed now.
1704
1718
1705 2006-01-29 Ville Vainio <vivainio@gmail.com>
1719 2006-01-29 Ville Vainio <vivainio@gmail.com>
1706
1720
1707 * iplib.py: Try to import pyreadline on Windows.
1721 * iplib.py: Try to import pyreadline on Windows.
1708
1722
1709 2006-01-27 Ville Vainio <vivainio@gmail.com>
1723 2006-01-27 Ville Vainio <vivainio@gmail.com>
1710
1724
1711 * iplib.py: Expose ipapi as _ip in builtin namespace.
1725 * iplib.py: Expose ipapi as _ip in builtin namespace.
1712 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1726 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1713 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1727 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1714 syntax now produce _ip.* variant of the commands.
1728 syntax now produce _ip.* variant of the commands.
1715
1729
1716 * "_ip.options().autoedit_syntax = 2" automatically throws
1730 * "_ip.options().autoedit_syntax = 2" automatically throws
1717 user to editor for syntax error correction without prompting.
1731 user to editor for syntax error correction without prompting.
1718
1732
1719 2006-01-27 Ville Vainio <vivainio@gmail.com>
1733 2006-01-27 Ville Vainio <vivainio@gmail.com>
1720
1734
1721 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1735 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1722 'ipython' at argv[0]) executed through command line.
1736 'ipython' at argv[0]) executed through command line.
1723 NOTE: this DEPRECATES calling ipython with multiple scripts
1737 NOTE: this DEPRECATES calling ipython with multiple scripts
1724 ("ipython a.py b.py c.py")
1738 ("ipython a.py b.py c.py")
1725
1739
1726 * iplib.py, hooks.py: Added configurable input prefilter,
1740 * iplib.py, hooks.py: Added configurable input prefilter,
1727 named 'input_prefilter'. See ext_rescapture.py for example
1741 named 'input_prefilter'. See ext_rescapture.py for example
1728 usage.
1742 usage.
1729
1743
1730 * ext_rescapture.py, Magic.py: Better system command output capture
1744 * ext_rescapture.py, Magic.py: Better system command output capture
1731 through 'var = !ls' (deprecates user-visible %sc). Same notation
1745 through 'var = !ls' (deprecates user-visible %sc). Same notation
1732 applies for magics, 'var = %alias' assigns alias list to var.
1746 applies for magics, 'var = %alias' assigns alias list to var.
1733
1747
1734 * ipapi.py: added meta() for accessing extension-usable data store.
1748 * ipapi.py: added meta() for accessing extension-usable data store.
1735
1749
1736 * iplib.py: added InteractiveShell.getapi(). New magics should be
1750 * iplib.py: added InteractiveShell.getapi(). New magics should be
1737 written doing self.getapi() instead of using the shell directly.
1751 written doing self.getapi() instead of using the shell directly.
1738
1752
1739 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1753 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1740 %store foo >> ~/myfoo.txt to store variables to files (in clean
1754 %store foo >> ~/myfoo.txt to store variables to files (in clean
1741 textual form, not a restorable pickle).
1755 textual form, not a restorable pickle).
1742
1756
1743 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1757 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1744
1758
1745 * usage.py, Magic.py: added %quickref
1759 * usage.py, Magic.py: added %quickref
1746
1760
1747 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1761 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1748
1762
1749 * GetoptErrors when invoking magics etc. with wrong args
1763 * GetoptErrors when invoking magics etc. with wrong args
1750 are now more helpful:
1764 are now more helpful:
1751 GetoptError: option -l not recognized (allowed: "qb" )
1765 GetoptError: option -l not recognized (allowed: "qb" )
1752
1766
1753 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1767 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1754
1768
1755 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1769 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1756 computationally intensive blocks don't appear to stall the demo.
1770 computationally intensive blocks don't appear to stall the demo.
1757
1771
1758 2006-01-24 Ville Vainio <vivainio@gmail.com>
1772 2006-01-24 Ville Vainio <vivainio@gmail.com>
1759
1773
1760 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1774 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1761 value to manipulate resulting history entry.
1775 value to manipulate resulting history entry.
1762
1776
1763 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1777 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1764 to instance methods of IPApi class, to make extending an embedded
1778 to instance methods of IPApi class, to make extending an embedded
1765 IPython feasible. See ext_rehashdir.py for example usage.
1779 IPython feasible. See ext_rehashdir.py for example usage.
1766
1780
1767 * Merged 1071-1076 from branches/0.7.1
1781 * Merged 1071-1076 from branches/0.7.1
1768
1782
1769
1783
1770 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1784 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1771
1785
1772 * tools/release (daystamp): Fix build tools to use the new
1786 * tools/release (daystamp): Fix build tools to use the new
1773 eggsetup.py script to build lightweight eggs.
1787 eggsetup.py script to build lightweight eggs.
1774
1788
1775 * Applied changesets 1062 and 1064 before 0.7.1 release.
1789 * Applied changesets 1062 and 1064 before 0.7.1 release.
1776
1790
1777 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1791 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1778 see the raw input history (without conversions like %ls ->
1792 see the raw input history (without conversions like %ls ->
1779 ipmagic("ls")). After a request from W. Stein, SAGE
1793 ipmagic("ls")). After a request from W. Stein, SAGE
1780 (http://modular.ucsd.edu/sage) developer. This information is
1794 (http://modular.ucsd.edu/sage) developer. This information is
1781 stored in the input_hist_raw attribute of the IPython instance, so
1795 stored in the input_hist_raw attribute of the IPython instance, so
1782 developers can access it if needed (it's an InputList instance).
1796 developers can access it if needed (it's an InputList instance).
1783
1797
1784 * Versionstring = 0.7.2.svn
1798 * Versionstring = 0.7.2.svn
1785
1799
1786 * eggsetup.py: A separate script for constructing eggs, creates
1800 * eggsetup.py: A separate script for constructing eggs, creates
1787 proper launch scripts even on Windows (an .exe file in
1801 proper launch scripts even on Windows (an .exe file in
1788 \python24\scripts).
1802 \python24\scripts).
1789
1803
1790 * ipapi.py: launch_new_instance, launch entry point needed for the
1804 * ipapi.py: launch_new_instance, launch entry point needed for the
1791 egg.
1805 egg.
1792
1806
1793 2006-01-23 Ville Vainio <vivainio@gmail.com>
1807 2006-01-23 Ville Vainio <vivainio@gmail.com>
1794
1808
1795 * Added %cpaste magic for pasting python code
1809 * Added %cpaste magic for pasting python code
1796
1810
1797 2006-01-22 Ville Vainio <vivainio@gmail.com>
1811 2006-01-22 Ville Vainio <vivainio@gmail.com>
1798
1812
1799 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1813 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1800
1814
1801 * Versionstring = 0.7.2.svn
1815 * Versionstring = 0.7.2.svn
1802
1816
1803 * eggsetup.py: A separate script for constructing eggs, creates
1817 * eggsetup.py: A separate script for constructing eggs, creates
1804 proper launch scripts even on Windows (an .exe file in
1818 proper launch scripts even on Windows (an .exe file in
1805 \python24\scripts).
1819 \python24\scripts).
1806
1820
1807 * ipapi.py: launch_new_instance, launch entry point needed for the
1821 * ipapi.py: launch_new_instance, launch entry point needed for the
1808 egg.
1822 egg.
1809
1823
1810 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1824 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1811
1825
1812 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1826 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1813 %pfile foo would print the file for foo even if it was a binary.
1827 %pfile foo would print the file for foo even if it was a binary.
1814 Now, extensions '.so' and '.dll' are skipped.
1828 Now, extensions '.so' and '.dll' are skipped.
1815
1829
1816 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1830 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1817 bug, where macros would fail in all threaded modes. I'm not 100%
1831 bug, where macros would fail in all threaded modes. I'm not 100%
1818 sure, so I'm going to put out an rc instead of making a release
1832 sure, so I'm going to put out an rc instead of making a release
1819 today, and wait for feedback for at least a few days.
1833 today, and wait for feedback for at least a few days.
1820
1834
1821 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1835 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1822 it...) the handling of pasting external code with autoindent on.
1836 it...) the handling of pasting external code with autoindent on.
1823 To get out of a multiline input, the rule will appear for most
1837 To get out of a multiline input, the rule will appear for most
1824 users unchanged: two blank lines or change the indent level
1838 users unchanged: two blank lines or change the indent level
1825 proposed by IPython. But there is a twist now: you can
1839 proposed by IPython. But there is a twist now: you can
1826 add/subtract only *one or two spaces*. If you add/subtract three
1840 add/subtract only *one or two spaces*. If you add/subtract three
1827 or more (unless you completely delete the line), IPython will
1841 or more (unless you completely delete the line), IPython will
1828 accept that line, and you'll need to enter a second one of pure
1842 accept that line, and you'll need to enter a second one of pure
1829 whitespace. I know it sounds complicated, but I can't find a
1843 whitespace. I know it sounds complicated, but I can't find a
1830 different solution that covers all the cases, with the right
1844 different solution that covers all the cases, with the right
1831 heuristics. Hopefully in actual use, nobody will really notice
1845 heuristics. Hopefully in actual use, nobody will really notice
1832 all these strange rules and things will 'just work'.
1846 all these strange rules and things will 'just work'.
1833
1847
1834 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1848 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1835
1849
1836 * IPython/iplib.py (interact): catch exceptions which can be
1850 * IPython/iplib.py (interact): catch exceptions which can be
1837 triggered asynchronously by signal handlers. Thanks to an
1851 triggered asynchronously by signal handlers. Thanks to an
1838 automatic crash report, submitted by Colin Kingsley
1852 automatic crash report, submitted by Colin Kingsley
1839 <tercel-AT-gentoo.org>.
1853 <tercel-AT-gentoo.org>.
1840
1854
1841 2006-01-20 Ville Vainio <vivainio@gmail.com>
1855 2006-01-20 Ville Vainio <vivainio@gmail.com>
1842
1856
1843 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1857 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1844 (%rehashdir, very useful, try it out) of how to extend ipython
1858 (%rehashdir, very useful, try it out) of how to extend ipython
1845 with new magics. Also added Extensions dir to pythonpath to make
1859 with new magics. Also added Extensions dir to pythonpath to make
1846 importing extensions easy.
1860 importing extensions easy.
1847
1861
1848 * %store now complains when trying to store interactively declared
1862 * %store now complains when trying to store interactively declared
1849 classes / instances of those classes.
1863 classes / instances of those classes.
1850
1864
1851 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1865 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1852 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1866 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1853 if they exist, and ipy_user_conf.py with some defaults is created for
1867 if they exist, and ipy_user_conf.py with some defaults is created for
1854 the user.
1868 the user.
1855
1869
1856 * Startup rehashing done by the config file, not InterpreterExec.
1870 * Startup rehashing done by the config file, not InterpreterExec.
1857 This means system commands are available even without selecting the
1871 This means system commands are available even without selecting the
1858 pysh profile. It's the sensible default after all.
1872 pysh profile. It's the sensible default after all.
1859
1873
1860 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1874 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1861
1875
1862 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1876 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1863 multiline code with autoindent on working. But I am really not
1877 multiline code with autoindent on working. But I am really not
1864 sure, so this needs more testing. Will commit a debug-enabled
1878 sure, so this needs more testing. Will commit a debug-enabled
1865 version for now, while I test it some more, so that Ville and
1879 version for now, while I test it some more, so that Ville and
1866 others may also catch any problems. Also made
1880 others may also catch any problems. Also made
1867 self.indent_current_str() a method, to ensure that there's no
1881 self.indent_current_str() a method, to ensure that there's no
1868 chance of the indent space count and the corresponding string
1882 chance of the indent space count and the corresponding string
1869 falling out of sync. All code needing the string should just call
1883 falling out of sync. All code needing the string should just call
1870 the method.
1884 the method.
1871
1885
1872 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1886 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1873
1887
1874 * IPython/Magic.py (magic_edit): fix check for when users don't
1888 * IPython/Magic.py (magic_edit): fix check for when users don't
1875 save their output files, the try/except was in the wrong section.
1889 save their output files, the try/except was in the wrong section.
1876
1890
1877 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1891 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1878
1892
1879 * IPython/Magic.py (magic_run): fix __file__ global missing from
1893 * IPython/Magic.py (magic_run): fix __file__ global missing from
1880 script's namespace when executed via %run. After a report by
1894 script's namespace when executed via %run. After a report by
1881 Vivian.
1895 Vivian.
1882
1896
1883 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1897 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1884 when using python 2.4. The parent constructor changed in 2.4, and
1898 when using python 2.4. The parent constructor changed in 2.4, and
1885 we need to track it directly (we can't call it, as it messes up
1899 we need to track it directly (we can't call it, as it messes up
1886 readline and tab-completion inside our pdb would stop working).
1900 readline and tab-completion inside our pdb would stop working).
1887 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1901 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1888
1902
1889 2006-01-16 Ville Vainio <vivainio@gmail.com>
1903 2006-01-16 Ville Vainio <vivainio@gmail.com>
1890
1904
1891 * Ipython/magic.py: Reverted back to old %edit functionality
1905 * Ipython/magic.py: Reverted back to old %edit functionality
1892 that returns file contents on exit.
1906 that returns file contents on exit.
1893
1907
1894 * IPython/path.py: Added Jason Orendorff's "path" module to
1908 * IPython/path.py: Added Jason Orendorff's "path" module to
1895 IPython tree, http://www.jorendorff.com/articles/python/path/.
1909 IPython tree, http://www.jorendorff.com/articles/python/path/.
1896 You can get path objects conveniently through %sc, and !!, e.g.:
1910 You can get path objects conveniently through %sc, and !!, e.g.:
1897 sc files=ls
1911 sc files=ls
1898 for p in files.paths: # or files.p
1912 for p in files.paths: # or files.p
1899 print p,p.mtime
1913 print p,p.mtime
1900
1914
1901 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1915 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1902 now work again without considering the exclusion regexp -
1916 now work again without considering the exclusion regexp -
1903 hence, things like ',foo my/path' turn to 'foo("my/path")'
1917 hence, things like ',foo my/path' turn to 'foo("my/path")'
1904 instead of syntax error.
1918 instead of syntax error.
1905
1919
1906
1920
1907 2006-01-14 Ville Vainio <vivainio@gmail.com>
1921 2006-01-14 Ville Vainio <vivainio@gmail.com>
1908
1922
1909 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1923 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1910 ipapi decorators for python 2.4 users, options() provides access to rc
1924 ipapi decorators for python 2.4 users, options() provides access to rc
1911 data.
1925 data.
1912
1926
1913 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1927 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1914 as path separators (even on Linux ;-). Space character after
1928 as path separators (even on Linux ;-). Space character after
1915 backslash (as yielded by tab completer) is still space;
1929 backslash (as yielded by tab completer) is still space;
1916 "%cd long\ name" works as expected.
1930 "%cd long\ name" works as expected.
1917
1931
1918 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1932 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1919 as "chain of command", with priority. API stays the same,
1933 as "chain of command", with priority. API stays the same,
1920 TryNext exception raised by a hook function signals that
1934 TryNext exception raised by a hook function signals that
1921 current hook failed and next hook should try handling it, as
1935 current hook failed and next hook should try handling it, as
1922 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1936 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1923 requested configurable display hook, which is now implemented.
1937 requested configurable display hook, which is now implemented.
1924
1938
1925 2006-01-13 Ville Vainio <vivainio@gmail.com>
1939 2006-01-13 Ville Vainio <vivainio@gmail.com>
1926
1940
1927 * IPython/platutils*.py: platform specific utility functions,
1941 * IPython/platutils*.py: platform specific utility functions,
1928 so far only set_term_title is implemented (change terminal
1942 so far only set_term_title is implemented (change terminal
1929 label in windowing systems). %cd now changes the title to
1943 label in windowing systems). %cd now changes the title to
1930 current dir.
1944 current dir.
1931
1945
1932 * IPython/Release.py: Added myself to "authors" list,
1946 * IPython/Release.py: Added myself to "authors" list,
1933 had to create new files.
1947 had to create new files.
1934
1948
1935 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1949 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1936 shell escape; not a known bug but had potential to be one in the
1950 shell escape; not a known bug but had potential to be one in the
1937 future.
1951 future.
1938
1952
1939 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1953 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1940 extension API for IPython! See the module for usage example. Fix
1954 extension API for IPython! See the module for usage example. Fix
1941 OInspect for docstring-less magic functions.
1955 OInspect for docstring-less magic functions.
1942
1956
1943
1957
1944 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1958 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1945
1959
1946 * IPython/iplib.py (raw_input): temporarily deactivate all
1960 * IPython/iplib.py (raw_input): temporarily deactivate all
1947 attempts at allowing pasting of code with autoindent on. It
1961 attempts at allowing pasting of code with autoindent on. It
1948 introduced bugs (reported by Prabhu) and I can't seem to find a
1962 introduced bugs (reported by Prabhu) and I can't seem to find a
1949 robust combination which works in all cases. Will have to revisit
1963 robust combination which works in all cases. Will have to revisit
1950 later.
1964 later.
1951
1965
1952 * IPython/genutils.py: remove isspace() function. We've dropped
1966 * IPython/genutils.py: remove isspace() function. We've dropped
1953 2.2 compatibility, so it's OK to use the string method.
1967 2.2 compatibility, so it's OK to use the string method.
1954
1968
1955 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1969 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1956
1970
1957 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1971 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1958 matching what NOT to autocall on, to include all python binary
1972 matching what NOT to autocall on, to include all python binary
1959 operators (including things like 'and', 'or', 'is' and 'in').
1973 operators (including things like 'and', 'or', 'is' and 'in').
1960 Prompted by a bug report on 'foo & bar', but I realized we had
1974 Prompted by a bug report on 'foo & bar', but I realized we had
1961 many more potential bug cases with other operators. The regexp is
1975 many more potential bug cases with other operators. The regexp is
1962 self.re_exclude_auto, it's fairly commented.
1976 self.re_exclude_auto, it's fairly commented.
1963
1977
1964 2006-01-12 Ville Vainio <vivainio@gmail.com>
1978 2006-01-12 Ville Vainio <vivainio@gmail.com>
1965
1979
1966 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1980 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1967 Prettified and hardened string/backslash quoting with ipsystem(),
1981 Prettified and hardened string/backslash quoting with ipsystem(),
1968 ipalias() and ipmagic(). Now even \ characters are passed to
1982 ipalias() and ipmagic(). Now even \ characters are passed to
1969 %magics, !shell escapes and aliases exactly as they are in the
1983 %magics, !shell escapes and aliases exactly as they are in the
1970 ipython command line. Should improve backslash experience,
1984 ipython command line. Should improve backslash experience,
1971 particularly in Windows (path delimiter for some commands that
1985 particularly in Windows (path delimiter for some commands that
1972 won't understand '/'), but Unix benefits as well (regexps). %cd
1986 won't understand '/'), but Unix benefits as well (regexps). %cd
1973 magic still doesn't support backslash path delimiters, though. Also
1987 magic still doesn't support backslash path delimiters, though. Also
1974 deleted all pretense of supporting multiline command strings in
1988 deleted all pretense of supporting multiline command strings in
1975 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1989 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1976
1990
1977 * doc/build_doc_instructions.txt added. Documentation on how to
1991 * doc/build_doc_instructions.txt added. Documentation on how to
1978 use doc/update_manual.py, added yesterday. Both files contributed
1992 use doc/update_manual.py, added yesterday. Both files contributed
1979 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1993 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1980 doc/*.sh for deprecation at a later date.
1994 doc/*.sh for deprecation at a later date.
1981
1995
1982 * /ipython.py Added ipython.py to root directory for
1996 * /ipython.py Added ipython.py to root directory for
1983 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1997 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1984 ipython.py) and development convenience (no need to keep doing
1998 ipython.py) and development convenience (no need to keep doing
1985 "setup.py install" between changes).
1999 "setup.py install" between changes).
1986
2000
1987 * Made ! and !! shell escapes work (again) in multiline expressions:
2001 * Made ! and !! shell escapes work (again) in multiline expressions:
1988 if 1:
2002 if 1:
1989 !ls
2003 !ls
1990 !!ls
2004 !!ls
1991
2005
1992 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2006 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1993
2007
1994 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2008 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1995 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2009 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1996 module in case-insensitive installation. Was causing crashes
2010 module in case-insensitive installation. Was causing crashes
1997 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2011 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1998
2012
1999 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2013 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2000 <marienz-AT-gentoo.org>, closes
2014 <marienz-AT-gentoo.org>, closes
2001 http://www.scipy.net/roundup/ipython/issue51.
2015 http://www.scipy.net/roundup/ipython/issue51.
2002
2016
2003 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2017 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2004
2018
2005 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2019 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2006 problem of excessive CPU usage under *nix and keyboard lag under
2020 problem of excessive CPU usage under *nix and keyboard lag under
2007 win32.
2021 win32.
2008
2022
2009 2006-01-10 *** Released version 0.7.0
2023 2006-01-10 *** Released version 0.7.0
2010
2024
2011 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2025 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2012
2026
2013 * IPython/Release.py (revision): tag version number to 0.7.0,
2027 * IPython/Release.py (revision): tag version number to 0.7.0,
2014 ready for release.
2028 ready for release.
2015
2029
2016 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2030 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2017 it informs the user of the name of the temp. file used. This can
2031 it informs the user of the name of the temp. file used. This can
2018 help if you decide later to reuse that same file, so you know
2032 help if you decide later to reuse that same file, so you know
2019 where to copy the info from.
2033 where to copy the info from.
2020
2034
2021 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2035 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2022
2036
2023 * setup_bdist_egg.py: little script to build an egg. Added
2037 * setup_bdist_egg.py: little script to build an egg. Added
2024 support in the release tools as well.
2038 support in the release tools as well.
2025
2039
2026 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2040 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2027
2041
2028 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2042 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2029 version selection (new -wxversion command line and ipythonrc
2043 version selection (new -wxversion command line and ipythonrc
2030 parameter). Patch contributed by Arnd Baecker
2044 parameter). Patch contributed by Arnd Baecker
2031 <arnd.baecker-AT-web.de>.
2045 <arnd.baecker-AT-web.de>.
2032
2046
2033 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2047 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2034 embedded instances, for variables defined at the interactive
2048 embedded instances, for variables defined at the interactive
2035 prompt of the embedded ipython. Reported by Arnd.
2049 prompt of the embedded ipython. Reported by Arnd.
2036
2050
2037 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2051 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2038 it can be used as a (stateful) toggle, or with a direct parameter.
2052 it can be used as a (stateful) toggle, or with a direct parameter.
2039
2053
2040 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2054 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2041 could be triggered in certain cases and cause the traceback
2055 could be triggered in certain cases and cause the traceback
2042 printer not to work.
2056 printer not to work.
2043
2057
2044 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2058 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2045
2059
2046 * IPython/iplib.py (_should_recompile): Small fix, closes
2060 * IPython/iplib.py (_should_recompile): Small fix, closes
2047 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2061 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2048
2062
2049 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2063 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2050
2064
2051 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2065 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2052 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2066 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2053 Moad for help with tracking it down.
2067 Moad for help with tracking it down.
2054
2068
2055 * IPython/iplib.py (handle_auto): fix autocall handling for
2069 * IPython/iplib.py (handle_auto): fix autocall handling for
2056 objects which support BOTH __getitem__ and __call__ (so that f [x]
2070 objects which support BOTH __getitem__ and __call__ (so that f [x]
2057 is left alone, instead of becoming f([x]) automatically).
2071 is left alone, instead of becoming f([x]) automatically).
2058
2072
2059 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2073 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2060 Ville's patch.
2074 Ville's patch.
2061
2075
2062 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2076 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2063
2077
2064 * IPython/iplib.py (handle_auto): changed autocall semantics to
2078 * IPython/iplib.py (handle_auto): changed autocall semantics to
2065 include 'smart' mode, where the autocall transformation is NOT
2079 include 'smart' mode, where the autocall transformation is NOT
2066 applied if there are no arguments on the line. This allows you to
2080 applied if there are no arguments on the line. This allows you to
2067 just type 'foo' if foo is a callable to see its internal form,
2081 just type 'foo' if foo is a callable to see its internal form,
2068 instead of having it called with no arguments (typically a
2082 instead of having it called with no arguments (typically a
2069 mistake). The old 'full' autocall still exists: for that, you
2083 mistake). The old 'full' autocall still exists: for that, you
2070 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2084 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2071
2085
2072 * IPython/completer.py (Completer.attr_matches): add
2086 * IPython/completer.py (Completer.attr_matches): add
2073 tab-completion support for Enthoughts' traits. After a report by
2087 tab-completion support for Enthoughts' traits. After a report by
2074 Arnd and a patch by Prabhu.
2088 Arnd and a patch by Prabhu.
2075
2089
2076 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2090 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2077
2091
2078 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2092 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2079 Schmolck's patch to fix inspect.getinnerframes().
2093 Schmolck's patch to fix inspect.getinnerframes().
2080
2094
2081 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2095 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2082 for embedded instances, regarding handling of namespaces and items
2096 for embedded instances, regarding handling of namespaces and items
2083 added to the __builtin__ one. Multiple embedded instances and
2097 added to the __builtin__ one. Multiple embedded instances and
2084 recursive embeddings should work better now (though I'm not sure
2098 recursive embeddings should work better now (though I'm not sure
2085 I've got all the corner cases fixed, that code is a bit of a brain
2099 I've got all the corner cases fixed, that code is a bit of a brain
2086 twister).
2100 twister).
2087
2101
2088 * IPython/Magic.py (magic_edit): added support to edit in-memory
2102 * IPython/Magic.py (magic_edit): added support to edit in-memory
2089 macros (automatically creates the necessary temp files). %edit
2103 macros (automatically creates the necessary temp files). %edit
2090 also doesn't return the file contents anymore, it's just noise.
2104 also doesn't return the file contents anymore, it's just noise.
2091
2105
2092 * IPython/completer.py (Completer.attr_matches): revert change to
2106 * IPython/completer.py (Completer.attr_matches): revert change to
2093 complete only on attributes listed in __all__. I realized it
2107 complete only on attributes listed in __all__. I realized it
2094 cripples the tab-completion system as a tool for exploring the
2108 cripples the tab-completion system as a tool for exploring the
2095 internals of unknown libraries (it renders any non-__all__
2109 internals of unknown libraries (it renders any non-__all__
2096 attribute off-limits). I got bit by this when trying to see
2110 attribute off-limits). I got bit by this when trying to see
2097 something inside the dis module.
2111 something inside the dis module.
2098
2112
2099 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2113 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2100
2114
2101 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2115 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2102 namespace for users and extension writers to hold data in. This
2116 namespace for users and extension writers to hold data in. This
2103 follows the discussion in
2117 follows the discussion in
2104 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2118 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2105
2119
2106 * IPython/completer.py (IPCompleter.complete): small patch to help
2120 * IPython/completer.py (IPCompleter.complete): small patch to help
2107 tab-completion under Emacs, after a suggestion by John Barnard
2121 tab-completion under Emacs, after a suggestion by John Barnard
2108 <barnarj-AT-ccf.org>.
2122 <barnarj-AT-ccf.org>.
2109
2123
2110 * IPython/Magic.py (Magic.extract_input_slices): added support for
2124 * IPython/Magic.py (Magic.extract_input_slices): added support for
2111 the slice notation in magics to use N-M to represent numbers N...M
2125 the slice notation in magics to use N-M to represent numbers N...M
2112 (closed endpoints). This is used by %macro and %save.
2126 (closed endpoints). This is used by %macro and %save.
2113
2127
2114 * IPython/completer.py (Completer.attr_matches): for modules which
2128 * IPython/completer.py (Completer.attr_matches): for modules which
2115 define __all__, complete only on those. After a patch by Jeffrey
2129 define __all__, complete only on those. After a patch by Jeffrey
2116 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2130 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2117 speed up this routine.
2131 speed up this routine.
2118
2132
2119 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2133 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2120 don't know if this is the end of it, but the behavior now is
2134 don't know if this is the end of it, but the behavior now is
2121 certainly much more correct. Note that coupled with macros,
2135 certainly much more correct. Note that coupled with macros,
2122 slightly surprising (at first) behavior may occur: a macro will in
2136 slightly surprising (at first) behavior may occur: a macro will in
2123 general expand to multiple lines of input, so upon exiting, the
2137 general expand to multiple lines of input, so upon exiting, the
2124 in/out counters will both be bumped by the corresponding amount
2138 in/out counters will both be bumped by the corresponding amount
2125 (as if the macro's contents had been typed interactively). Typing
2139 (as if the macro's contents had been typed interactively). Typing
2126 %hist will reveal the intermediate (silently processed) lines.
2140 %hist will reveal the intermediate (silently processed) lines.
2127
2141
2128 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2142 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2129 pickle to fail (%run was overwriting __main__ and not restoring
2143 pickle to fail (%run was overwriting __main__ and not restoring
2130 it, but pickle relies on __main__ to operate).
2144 it, but pickle relies on __main__ to operate).
2131
2145
2132 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2146 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2133 using properties, but forgot to make the main InteractiveShell
2147 using properties, but forgot to make the main InteractiveShell
2134 class a new-style class. Properties fail silently, and
2148 class a new-style class. Properties fail silently, and
2135 mysteriously, with old-style class (getters work, but
2149 mysteriously, with old-style class (getters work, but
2136 setters don't do anything).
2150 setters don't do anything).
2137
2151
2138 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2152 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2139
2153
2140 * IPython/Magic.py (magic_history): fix history reporting bug (I
2154 * IPython/Magic.py (magic_history): fix history reporting bug (I
2141 know some nasties are still there, I just can't seem to find a
2155 know some nasties are still there, I just can't seem to find a
2142 reproducible test case to track them down; the input history is
2156 reproducible test case to track them down; the input history is
2143 falling out of sync...)
2157 falling out of sync...)
2144
2158
2145 * IPython/iplib.py (handle_shell_escape): fix bug where both
2159 * IPython/iplib.py (handle_shell_escape): fix bug where both
2146 aliases and system accesses where broken for indented code (such
2160 aliases and system accesses where broken for indented code (such
2147 as loops).
2161 as loops).
2148
2162
2149 * IPython/genutils.py (shell): fix small but critical bug for
2163 * IPython/genutils.py (shell): fix small but critical bug for
2150 win32 system access.
2164 win32 system access.
2151
2165
2152 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2166 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2153
2167
2154 * IPython/iplib.py (showtraceback): remove use of the
2168 * IPython/iplib.py (showtraceback): remove use of the
2155 sys.last_{type/value/traceback} structures, which are non
2169 sys.last_{type/value/traceback} structures, which are non
2156 thread-safe.
2170 thread-safe.
2157 (_prefilter): change control flow to ensure that we NEVER
2171 (_prefilter): change control flow to ensure that we NEVER
2158 introspect objects when autocall is off. This will guarantee that
2172 introspect objects when autocall is off. This will guarantee that
2159 having an input line of the form 'x.y', where access to attribute
2173 having an input line of the form 'x.y', where access to attribute
2160 'y' has side effects, doesn't trigger the side effect TWICE. It
2174 'y' has side effects, doesn't trigger the side effect TWICE. It
2161 is important to note that, with autocall on, these side effects
2175 is important to note that, with autocall on, these side effects
2162 can still happen.
2176 can still happen.
2163 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2177 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2164 trio. IPython offers these three kinds of special calls which are
2178 trio. IPython offers these three kinds of special calls which are
2165 not python code, and it's a good thing to have their call method
2179 not python code, and it's a good thing to have their call method
2166 be accessible as pure python functions (not just special syntax at
2180 be accessible as pure python functions (not just special syntax at
2167 the command line). It gives us a better internal implementation
2181 the command line). It gives us a better internal implementation
2168 structure, as well as exposing these for user scripting more
2182 structure, as well as exposing these for user scripting more
2169 cleanly.
2183 cleanly.
2170
2184
2171 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2185 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2172 file. Now that they'll be more likely to be used with the
2186 file. Now that they'll be more likely to be used with the
2173 persistance system (%store), I want to make sure their module path
2187 persistance system (%store), I want to make sure their module path
2174 doesn't change in the future, so that we don't break things for
2188 doesn't change in the future, so that we don't break things for
2175 users' persisted data.
2189 users' persisted data.
2176
2190
2177 * IPython/iplib.py (autoindent_update): move indentation
2191 * IPython/iplib.py (autoindent_update): move indentation
2178 management into the _text_ processing loop, not the keyboard
2192 management into the _text_ processing loop, not the keyboard
2179 interactive one. This is necessary to correctly process non-typed
2193 interactive one. This is necessary to correctly process non-typed
2180 multiline input (such as macros).
2194 multiline input (such as macros).
2181
2195
2182 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2196 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2183 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2197 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2184 which was producing problems in the resulting manual.
2198 which was producing problems in the resulting manual.
2185 (magic_whos): improve reporting of instances (show their class,
2199 (magic_whos): improve reporting of instances (show their class,
2186 instead of simply printing 'instance' which isn't terribly
2200 instead of simply printing 'instance' which isn't terribly
2187 informative).
2201 informative).
2188
2202
2189 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2203 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2190 (minor mods) to support network shares under win32.
2204 (minor mods) to support network shares under win32.
2191
2205
2192 * IPython/winconsole.py (get_console_size): add new winconsole
2206 * IPython/winconsole.py (get_console_size): add new winconsole
2193 module and fixes to page_dumb() to improve its behavior under
2207 module and fixes to page_dumb() to improve its behavior under
2194 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2208 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2195
2209
2196 * IPython/Magic.py (Macro): simplified Macro class to just
2210 * IPython/Magic.py (Macro): simplified Macro class to just
2197 subclass list. We've had only 2.2 compatibility for a very long
2211 subclass list. We've had only 2.2 compatibility for a very long
2198 time, yet I was still avoiding subclassing the builtin types. No
2212 time, yet I was still avoiding subclassing the builtin types. No
2199 more (I'm also starting to use properties, though I won't shift to
2213 more (I'm also starting to use properties, though I won't shift to
2200 2.3-specific features quite yet).
2214 2.3-specific features quite yet).
2201 (magic_store): added Ville's patch for lightweight variable
2215 (magic_store): added Ville's patch for lightweight variable
2202 persistence, after a request on the user list by Matt Wilkie
2216 persistence, after a request on the user list by Matt Wilkie
2203 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2217 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2204 details.
2218 details.
2205
2219
2206 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2220 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2207 changed the default logfile name from 'ipython.log' to
2221 changed the default logfile name from 'ipython.log' to
2208 'ipython_log.py'. These logs are real python files, and now that
2222 'ipython_log.py'. These logs are real python files, and now that
2209 we have much better multiline support, people are more likely to
2223 we have much better multiline support, people are more likely to
2210 want to use them as such. Might as well name them correctly.
2224 want to use them as such. Might as well name them correctly.
2211
2225
2212 * IPython/Magic.py: substantial cleanup. While we can't stop
2226 * IPython/Magic.py: substantial cleanup. While we can't stop
2213 using magics as mixins, due to the existing customizations 'out
2227 using magics as mixins, due to the existing customizations 'out
2214 there' which rely on the mixin naming conventions, at least I
2228 there' which rely on the mixin naming conventions, at least I
2215 cleaned out all cross-class name usage. So once we are OK with
2229 cleaned out all cross-class name usage. So once we are OK with
2216 breaking compatibility, the two systems can be separated.
2230 breaking compatibility, the two systems can be separated.
2217
2231
2218 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2232 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2219 anymore, and the class is a fair bit less hideous as well. New
2233 anymore, and the class is a fair bit less hideous as well. New
2220 features were also introduced: timestamping of input, and logging
2234 features were also introduced: timestamping of input, and logging
2221 of output results. These are user-visible with the -t and -o
2235 of output results. These are user-visible with the -t and -o
2222 options to %logstart. Closes
2236 options to %logstart. Closes
2223 http://www.scipy.net/roundup/ipython/issue11 and a request by
2237 http://www.scipy.net/roundup/ipython/issue11 and a request by
2224 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2238 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2225
2239
2226 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2240 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2227
2241
2228 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2242 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2229 better handle backslashes in paths. See the thread 'More Windows
2243 better handle backslashes in paths. See the thread 'More Windows
2230 questions part 2 - \/ characters revisited' on the iypthon user
2244 questions part 2 - \/ characters revisited' on the iypthon user
2231 list:
2245 list:
2232 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2246 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2233
2247
2234 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2248 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2235
2249
2236 (InteractiveShell.__init__): change threaded shells to not use the
2250 (InteractiveShell.__init__): change threaded shells to not use the
2237 ipython crash handler. This was causing more problems than not,
2251 ipython crash handler. This was causing more problems than not,
2238 as exceptions in the main thread (GUI code, typically) would
2252 as exceptions in the main thread (GUI code, typically) would
2239 always show up as a 'crash', when they really weren't.
2253 always show up as a 'crash', when they really weren't.
2240
2254
2241 The colors and exception mode commands (%colors/%xmode) have been
2255 The colors and exception mode commands (%colors/%xmode) have been
2242 synchronized to also take this into account, so users can get
2256 synchronized to also take this into account, so users can get
2243 verbose exceptions for their threaded code as well. I also added
2257 verbose exceptions for their threaded code as well. I also added
2244 support for activating pdb inside this exception handler as well,
2258 support for activating pdb inside this exception handler as well,
2245 so now GUI authors can use IPython's enhanced pdb at runtime.
2259 so now GUI authors can use IPython's enhanced pdb at runtime.
2246
2260
2247 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2261 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2248 true by default, and add it to the shipped ipythonrc file. Since
2262 true by default, and add it to the shipped ipythonrc file. Since
2249 this asks the user before proceeding, I think it's OK to make it
2263 this asks the user before proceeding, I think it's OK to make it
2250 true by default.
2264 true by default.
2251
2265
2252 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2266 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2253 of the previous special-casing of input in the eval loop. I think
2267 of the previous special-casing of input in the eval loop. I think
2254 this is cleaner, as they really are commands and shouldn't have
2268 this is cleaner, as they really are commands and shouldn't have
2255 a special role in the middle of the core code.
2269 a special role in the middle of the core code.
2256
2270
2257 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2271 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2258
2272
2259 * IPython/iplib.py (edit_syntax_error): added support for
2273 * IPython/iplib.py (edit_syntax_error): added support for
2260 automatically reopening the editor if the file had a syntax error
2274 automatically reopening the editor if the file had a syntax error
2261 in it. Thanks to scottt who provided the patch at:
2275 in it. Thanks to scottt who provided the patch at:
2262 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2276 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2263 version committed).
2277 version committed).
2264
2278
2265 * IPython/iplib.py (handle_normal): add suport for multi-line
2279 * IPython/iplib.py (handle_normal): add suport for multi-line
2266 input with emtpy lines. This fixes
2280 input with emtpy lines. This fixes
2267 http://www.scipy.net/roundup/ipython/issue43 and a similar
2281 http://www.scipy.net/roundup/ipython/issue43 and a similar
2268 discussion on the user list.
2282 discussion on the user list.
2269
2283
2270 WARNING: a behavior change is necessarily introduced to support
2284 WARNING: a behavior change is necessarily introduced to support
2271 blank lines: now a single blank line with whitespace does NOT
2285 blank lines: now a single blank line with whitespace does NOT
2272 break the input loop, which means that when autoindent is on, by
2286 break the input loop, which means that when autoindent is on, by
2273 default hitting return on the next (indented) line does NOT exit.
2287 default hitting return on the next (indented) line does NOT exit.
2274
2288
2275 Instead, to exit a multiline input you can either have:
2289 Instead, to exit a multiline input you can either have:
2276
2290
2277 - TWO whitespace lines (just hit return again), or
2291 - TWO whitespace lines (just hit return again), or
2278 - a single whitespace line of a different length than provided
2292 - a single whitespace line of a different length than provided
2279 by the autoindent (add or remove a space).
2293 by the autoindent (add or remove a space).
2280
2294
2281 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2295 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2282 module to better organize all readline-related functionality.
2296 module to better organize all readline-related functionality.
2283 I've deleted FlexCompleter and put all completion clases here.
2297 I've deleted FlexCompleter and put all completion clases here.
2284
2298
2285 * IPython/iplib.py (raw_input): improve indentation management.
2299 * IPython/iplib.py (raw_input): improve indentation management.
2286 It is now possible to paste indented code with autoindent on, and
2300 It is now possible to paste indented code with autoindent on, and
2287 the code is interpreted correctly (though it still looks bad on
2301 the code is interpreted correctly (though it still looks bad on
2288 screen, due to the line-oriented nature of ipython).
2302 screen, due to the line-oriented nature of ipython).
2289 (MagicCompleter.complete): change behavior so that a TAB key on an
2303 (MagicCompleter.complete): change behavior so that a TAB key on an
2290 otherwise empty line actually inserts a tab, instead of completing
2304 otherwise empty line actually inserts a tab, instead of completing
2291 on the entire global namespace. This makes it easier to use the
2305 on the entire global namespace. This makes it easier to use the
2292 TAB key for indentation. After a request by Hans Meine
2306 TAB key for indentation. After a request by Hans Meine
2293 <hans_meine-AT-gmx.net>
2307 <hans_meine-AT-gmx.net>
2294 (_prefilter): add support so that typing plain 'exit' or 'quit'
2308 (_prefilter): add support so that typing plain 'exit' or 'quit'
2295 does a sensible thing. Originally I tried to deviate as little as
2309 does a sensible thing. Originally I tried to deviate as little as
2296 possible from the default python behavior, but even that one may
2310 possible from the default python behavior, but even that one may
2297 change in this direction (thread on python-dev to that effect).
2311 change in this direction (thread on python-dev to that effect).
2298 Regardless, ipython should do the right thing even if CPython's
2312 Regardless, ipython should do the right thing even if CPython's
2299 '>>>' prompt doesn't.
2313 '>>>' prompt doesn't.
2300 (InteractiveShell): removed subclassing code.InteractiveConsole
2314 (InteractiveShell): removed subclassing code.InteractiveConsole
2301 class. By now we'd overridden just about all of its methods: I've
2315 class. By now we'd overridden just about all of its methods: I've
2302 copied the remaining two over, and now ipython is a standalone
2316 copied the remaining two over, and now ipython is a standalone
2303 class. This will provide a clearer picture for the chainsaw
2317 class. This will provide a clearer picture for the chainsaw
2304 branch refactoring.
2318 branch refactoring.
2305
2319
2306 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2320 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2307
2321
2308 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2322 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2309 failures for objects which break when dir() is called on them.
2323 failures for objects which break when dir() is called on them.
2310
2324
2311 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2325 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2312 distinct local and global namespaces in the completer API. This
2326 distinct local and global namespaces in the completer API. This
2313 change allows us to properly handle completion with distinct
2327 change allows us to properly handle completion with distinct
2314 scopes, including in embedded instances (this had never really
2328 scopes, including in embedded instances (this had never really
2315 worked correctly).
2329 worked correctly).
2316
2330
2317 Note: this introduces a change in the constructor for
2331 Note: this introduces a change in the constructor for
2318 MagicCompleter, as a new global_namespace parameter is now the
2332 MagicCompleter, as a new global_namespace parameter is now the
2319 second argument (the others were bumped one position).
2333 second argument (the others were bumped one position).
2320
2334
2321 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2335 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2322
2336
2323 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2337 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2324 embedded instances (which can be done now thanks to Vivian's
2338 embedded instances (which can be done now thanks to Vivian's
2325 frame-handling fixes for pdb).
2339 frame-handling fixes for pdb).
2326 (InteractiveShell.__init__): Fix namespace handling problem in
2340 (InteractiveShell.__init__): Fix namespace handling problem in
2327 embedded instances. We were overwriting __main__ unconditionally,
2341 embedded instances. We were overwriting __main__ unconditionally,
2328 and this should only be done for 'full' (non-embedded) IPython;
2342 and this should only be done for 'full' (non-embedded) IPython;
2329 embedded instances must respect the caller's __main__. Thanks to
2343 embedded instances must respect the caller's __main__. Thanks to
2330 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2344 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2331
2345
2332 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2346 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2333
2347
2334 * setup.py: added download_url to setup(). This registers the
2348 * setup.py: added download_url to setup(). This registers the
2335 download address at PyPI, which is not only useful to humans
2349 download address at PyPI, which is not only useful to humans
2336 browsing the site, but is also picked up by setuptools (the Eggs
2350 browsing the site, but is also picked up by setuptools (the Eggs
2337 machinery). Thanks to Ville and R. Kern for the info/discussion
2351 machinery). Thanks to Ville and R. Kern for the info/discussion
2338 on this.
2352 on this.
2339
2353
2340 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2354 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2341
2355
2342 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2356 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2343 This brings a lot of nice functionality to the pdb mode, which now
2357 This brings a lot of nice functionality to the pdb mode, which now
2344 has tab-completion, syntax highlighting, and better stack handling
2358 has tab-completion, syntax highlighting, and better stack handling
2345 than before. Many thanks to Vivian De Smedt
2359 than before. Many thanks to Vivian De Smedt
2346 <vivian-AT-vdesmedt.com> for the original patches.
2360 <vivian-AT-vdesmedt.com> for the original patches.
2347
2361
2348 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2362 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2349
2363
2350 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2364 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2351 sequence to consistently accept the banner argument. The
2365 sequence to consistently accept the banner argument. The
2352 inconsistency was tripping SAGE, thanks to Gary Zablackis
2366 inconsistency was tripping SAGE, thanks to Gary Zablackis
2353 <gzabl-AT-yahoo.com> for the report.
2367 <gzabl-AT-yahoo.com> for the report.
2354
2368
2355 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2369 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2356
2370
2357 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2371 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2358 Fix bug where a naked 'alias' call in the ipythonrc file would
2372 Fix bug where a naked 'alias' call in the ipythonrc file would
2359 cause a crash. Bug reported by Jorgen Stenarson.
2373 cause a crash. Bug reported by Jorgen Stenarson.
2360
2374
2361 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2375 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2362
2376
2363 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2377 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2364 startup time.
2378 startup time.
2365
2379
2366 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2380 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2367 instances had introduced a bug with globals in normal code. Now
2381 instances had introduced a bug with globals in normal code. Now
2368 it's working in all cases.
2382 it's working in all cases.
2369
2383
2370 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2384 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2371 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2385 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2372 has been introduced to set the default case sensitivity of the
2386 has been introduced to set the default case sensitivity of the
2373 searches. Users can still select either mode at runtime on a
2387 searches. Users can still select either mode at runtime on a
2374 per-search basis.
2388 per-search basis.
2375
2389
2376 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2390 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2377
2391
2378 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2392 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2379 attributes in wildcard searches for subclasses. Modified version
2393 attributes in wildcard searches for subclasses. Modified version
2380 of a patch by Jorgen.
2394 of a patch by Jorgen.
2381
2395
2382 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2396 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2383
2397
2384 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2398 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2385 embedded instances. I added a user_global_ns attribute to the
2399 embedded instances. I added a user_global_ns attribute to the
2386 InteractiveShell class to handle this.
2400 InteractiveShell class to handle this.
2387
2401
2388 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2402 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2389
2403
2390 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2404 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2391 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2405 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2392 (reported under win32, but may happen also in other platforms).
2406 (reported under win32, but may happen also in other platforms).
2393 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2407 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2394
2408
2395 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2409 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2396
2410
2397 * IPython/Magic.py (magic_psearch): new support for wildcard
2411 * IPython/Magic.py (magic_psearch): new support for wildcard
2398 patterns. Now, typing ?a*b will list all names which begin with a
2412 patterns. Now, typing ?a*b will list all names which begin with a
2399 and end in b, for example. The %psearch magic has full
2413 and end in b, for example. The %psearch magic has full
2400 docstrings. Many thanks to JΓΆrgen Stenarson
2414 docstrings. Many thanks to JΓΆrgen Stenarson
2401 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2415 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2402 implementing this functionality.
2416 implementing this functionality.
2403
2417
2404 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2418 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2405
2419
2406 * Manual: fixed long-standing annoyance of double-dashes (as in
2420 * Manual: fixed long-standing annoyance of double-dashes (as in
2407 --prefix=~, for example) being stripped in the HTML version. This
2421 --prefix=~, for example) being stripped in the HTML version. This
2408 is a latex2html bug, but a workaround was provided. Many thanks
2422 is a latex2html bug, but a workaround was provided. Many thanks
2409 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2423 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2410 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2424 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2411 rolling. This seemingly small issue had tripped a number of users
2425 rolling. This seemingly small issue had tripped a number of users
2412 when first installing, so I'm glad to see it gone.
2426 when first installing, so I'm glad to see it gone.
2413
2427
2414 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2428 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2415
2429
2416 * IPython/Extensions/numeric_formats.py: fix missing import,
2430 * IPython/Extensions/numeric_formats.py: fix missing import,
2417 reported by Stephen Walton.
2431 reported by Stephen Walton.
2418
2432
2419 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2433 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2420
2434
2421 * IPython/demo.py: finish demo module, fully documented now.
2435 * IPython/demo.py: finish demo module, fully documented now.
2422
2436
2423 * IPython/genutils.py (file_read): simple little utility to read a
2437 * IPython/genutils.py (file_read): simple little utility to read a
2424 file and ensure it's closed afterwards.
2438 file and ensure it's closed afterwards.
2425
2439
2426 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2440 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2427
2441
2428 * IPython/demo.py (Demo.__init__): added support for individually
2442 * IPython/demo.py (Demo.__init__): added support for individually
2429 tagging blocks for automatic execution.
2443 tagging blocks for automatic execution.
2430
2444
2431 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2445 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2432 syntax-highlighted python sources, requested by John.
2446 syntax-highlighted python sources, requested by John.
2433
2447
2434 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2448 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2435
2449
2436 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2450 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2437 finishing.
2451 finishing.
2438
2452
2439 * IPython/genutils.py (shlex_split): moved from Magic to here,
2453 * IPython/genutils.py (shlex_split): moved from Magic to here,
2440 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2454 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2441
2455
2442 * IPython/demo.py (Demo.__init__): added support for silent
2456 * IPython/demo.py (Demo.__init__): added support for silent
2443 blocks, improved marks as regexps, docstrings written.
2457 blocks, improved marks as regexps, docstrings written.
2444 (Demo.__init__): better docstring, added support for sys.argv.
2458 (Demo.__init__): better docstring, added support for sys.argv.
2445
2459
2446 * IPython/genutils.py (marquee): little utility used by the demo
2460 * IPython/genutils.py (marquee): little utility used by the demo
2447 code, handy in general.
2461 code, handy in general.
2448
2462
2449 * IPython/demo.py (Demo.__init__): new class for interactive
2463 * IPython/demo.py (Demo.__init__): new class for interactive
2450 demos. Not documented yet, I just wrote it in a hurry for
2464 demos. Not documented yet, I just wrote it in a hurry for
2451 scipy'05. Will docstring later.
2465 scipy'05. Will docstring later.
2452
2466
2453 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2467 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2454
2468
2455 * IPython/Shell.py (sigint_handler): Drastic simplification which
2469 * IPython/Shell.py (sigint_handler): Drastic simplification which
2456 also seems to make Ctrl-C work correctly across threads! This is
2470 also seems to make Ctrl-C work correctly across threads! This is
2457 so simple, that I can't beleive I'd missed it before. Needs more
2471 so simple, that I can't beleive I'd missed it before. Needs more
2458 testing, though.
2472 testing, though.
2459 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2473 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2460 like this before...
2474 like this before...
2461
2475
2462 * IPython/genutils.py (get_home_dir): add protection against
2476 * IPython/genutils.py (get_home_dir): add protection against
2463 non-dirs in win32 registry.
2477 non-dirs in win32 registry.
2464
2478
2465 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2479 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2466 bug where dict was mutated while iterating (pysh crash).
2480 bug where dict was mutated while iterating (pysh crash).
2467
2481
2468 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2482 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2469
2483
2470 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2484 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2471 spurious newlines added by this routine. After a report by
2485 spurious newlines added by this routine. After a report by
2472 F. Mantegazza.
2486 F. Mantegazza.
2473
2487
2474 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2488 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2475
2489
2476 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2490 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2477 calls. These were a leftover from the GTK 1.x days, and can cause
2491 calls. These were a leftover from the GTK 1.x days, and can cause
2478 problems in certain cases (after a report by John Hunter).
2492 problems in certain cases (after a report by John Hunter).
2479
2493
2480 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2494 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2481 os.getcwd() fails at init time. Thanks to patch from David Remahl
2495 os.getcwd() fails at init time. Thanks to patch from David Remahl
2482 <chmod007-AT-mac.com>.
2496 <chmod007-AT-mac.com>.
2483 (InteractiveShell.__init__): prevent certain special magics from
2497 (InteractiveShell.__init__): prevent certain special magics from
2484 being shadowed by aliases. Closes
2498 being shadowed by aliases. Closes
2485 http://www.scipy.net/roundup/ipython/issue41.
2499 http://www.scipy.net/roundup/ipython/issue41.
2486
2500
2487 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2501 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2488
2502
2489 * IPython/iplib.py (InteractiveShell.complete): Added new
2503 * IPython/iplib.py (InteractiveShell.complete): Added new
2490 top-level completion method to expose the completion mechanism
2504 top-level completion method to expose the completion mechanism
2491 beyond readline-based environments.
2505 beyond readline-based environments.
2492
2506
2493 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2507 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2494
2508
2495 * tools/ipsvnc (svnversion): fix svnversion capture.
2509 * tools/ipsvnc (svnversion): fix svnversion capture.
2496
2510
2497 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2511 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2498 attribute to self, which was missing. Before, it was set by a
2512 attribute to self, which was missing. Before, it was set by a
2499 routine which in certain cases wasn't being called, so the
2513 routine which in certain cases wasn't being called, so the
2500 instance could end up missing the attribute. This caused a crash.
2514 instance could end up missing the attribute. This caused a crash.
2501 Closes http://www.scipy.net/roundup/ipython/issue40.
2515 Closes http://www.scipy.net/roundup/ipython/issue40.
2502
2516
2503 2005-08-16 Fernando Perez <fperez@colorado.edu>
2517 2005-08-16 Fernando Perez <fperez@colorado.edu>
2504
2518
2505 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2519 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2506 contains non-string attribute. Closes
2520 contains non-string attribute. Closes
2507 http://www.scipy.net/roundup/ipython/issue38.
2521 http://www.scipy.net/roundup/ipython/issue38.
2508
2522
2509 2005-08-14 Fernando Perez <fperez@colorado.edu>
2523 2005-08-14 Fernando Perez <fperez@colorado.edu>
2510
2524
2511 * tools/ipsvnc: Minor improvements, to add changeset info.
2525 * tools/ipsvnc: Minor improvements, to add changeset info.
2512
2526
2513 2005-08-12 Fernando Perez <fperez@colorado.edu>
2527 2005-08-12 Fernando Perez <fperez@colorado.edu>
2514
2528
2515 * IPython/iplib.py (runsource): remove self.code_to_run_src
2529 * IPython/iplib.py (runsource): remove self.code_to_run_src
2516 attribute. I realized this is nothing more than
2530 attribute. I realized this is nothing more than
2517 '\n'.join(self.buffer), and having the same data in two different
2531 '\n'.join(self.buffer), and having the same data in two different
2518 places is just asking for synchronization bugs. This may impact
2532 places is just asking for synchronization bugs. This may impact
2519 people who have custom exception handlers, so I need to warn
2533 people who have custom exception handlers, so I need to warn
2520 ipython-dev about it (F. Mantegazza may use them).
2534 ipython-dev about it (F. Mantegazza may use them).
2521
2535
2522 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2536 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2523
2537
2524 * IPython/genutils.py: fix 2.2 compatibility (generators)
2538 * IPython/genutils.py: fix 2.2 compatibility (generators)
2525
2539
2526 2005-07-18 Fernando Perez <fperez@colorado.edu>
2540 2005-07-18 Fernando Perez <fperez@colorado.edu>
2527
2541
2528 * IPython/genutils.py (get_home_dir): fix to help users with
2542 * IPython/genutils.py (get_home_dir): fix to help users with
2529 invalid $HOME under win32.
2543 invalid $HOME under win32.
2530
2544
2531 2005-07-17 Fernando Perez <fperez@colorado.edu>
2545 2005-07-17 Fernando Perez <fperez@colorado.edu>
2532
2546
2533 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2547 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2534 some old hacks and clean up a bit other routines; code should be
2548 some old hacks and clean up a bit other routines; code should be
2535 simpler and a bit faster.
2549 simpler and a bit faster.
2536
2550
2537 * IPython/iplib.py (interact): removed some last-resort attempts
2551 * IPython/iplib.py (interact): removed some last-resort attempts
2538 to survive broken stdout/stderr. That code was only making it
2552 to survive broken stdout/stderr. That code was only making it
2539 harder to abstract out the i/o (necessary for gui integration),
2553 harder to abstract out the i/o (necessary for gui integration),
2540 and the crashes it could prevent were extremely rare in practice
2554 and the crashes it could prevent were extremely rare in practice
2541 (besides being fully user-induced in a pretty violent manner).
2555 (besides being fully user-induced in a pretty violent manner).
2542
2556
2543 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2557 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2544 Nothing major yet, but the code is simpler to read; this should
2558 Nothing major yet, but the code is simpler to read; this should
2545 make it easier to do more serious modifications in the future.
2559 make it easier to do more serious modifications in the future.
2546
2560
2547 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2561 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2548 which broke in .15 (thanks to a report by Ville).
2562 which broke in .15 (thanks to a report by Ville).
2549
2563
2550 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2564 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2551 be quite correct, I know next to nothing about unicode). This
2565 be quite correct, I know next to nothing about unicode). This
2552 will allow unicode strings to be used in prompts, amongst other
2566 will allow unicode strings to be used in prompts, amongst other
2553 cases. It also will prevent ipython from crashing when unicode
2567 cases. It also will prevent ipython from crashing when unicode
2554 shows up unexpectedly in many places. If ascii encoding fails, we
2568 shows up unexpectedly in many places. If ascii encoding fails, we
2555 assume utf_8. Currently the encoding is not a user-visible
2569 assume utf_8. Currently the encoding is not a user-visible
2556 setting, though it could be made so if there is demand for it.
2570 setting, though it could be made so if there is demand for it.
2557
2571
2558 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2572 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2559
2573
2560 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2574 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2561
2575
2562 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2576 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2563
2577
2564 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2578 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2565 code can work transparently for 2.2/2.3.
2579 code can work transparently for 2.2/2.3.
2566
2580
2567 2005-07-16 Fernando Perez <fperez@colorado.edu>
2581 2005-07-16 Fernando Perez <fperez@colorado.edu>
2568
2582
2569 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2583 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2570 out of the color scheme table used for coloring exception
2584 out of the color scheme table used for coloring exception
2571 tracebacks. This allows user code to add new schemes at runtime.
2585 tracebacks. This allows user code to add new schemes at runtime.
2572 This is a minimally modified version of the patch at
2586 This is a minimally modified version of the patch at
2573 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2587 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2574 for the contribution.
2588 for the contribution.
2575
2589
2576 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2590 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2577 slightly modified version of the patch in
2591 slightly modified version of the patch in
2578 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2592 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2579 to remove the previous try/except solution (which was costlier).
2593 to remove the previous try/except solution (which was costlier).
2580 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2594 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2581
2595
2582 2005-06-08 Fernando Perez <fperez@colorado.edu>
2596 2005-06-08 Fernando Perez <fperez@colorado.edu>
2583
2597
2584 * IPython/iplib.py (write/write_err): Add methods to abstract all
2598 * IPython/iplib.py (write/write_err): Add methods to abstract all
2585 I/O a bit more.
2599 I/O a bit more.
2586
2600
2587 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2601 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2588 warning, reported by Aric Hagberg, fix by JD Hunter.
2602 warning, reported by Aric Hagberg, fix by JD Hunter.
2589
2603
2590 2005-06-02 *** Released version 0.6.15
2604 2005-06-02 *** Released version 0.6.15
2591
2605
2592 2005-06-01 Fernando Perez <fperez@colorado.edu>
2606 2005-06-01 Fernando Perez <fperez@colorado.edu>
2593
2607
2594 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2608 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2595 tab-completion of filenames within open-quoted strings. Note that
2609 tab-completion of filenames within open-quoted strings. Note that
2596 this requires that in ~/.ipython/ipythonrc, users change the
2610 this requires that in ~/.ipython/ipythonrc, users change the
2597 readline delimiters configuration to read:
2611 readline delimiters configuration to read:
2598
2612
2599 readline_remove_delims -/~
2613 readline_remove_delims -/~
2600
2614
2601
2615
2602 2005-05-31 *** Released version 0.6.14
2616 2005-05-31 *** Released version 0.6.14
2603
2617
2604 2005-05-29 Fernando Perez <fperez@colorado.edu>
2618 2005-05-29 Fernando Perez <fperez@colorado.edu>
2605
2619
2606 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2620 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2607 with files not on the filesystem. Reported by Eliyahu Sandler
2621 with files not on the filesystem. Reported by Eliyahu Sandler
2608 <eli@gondolin.net>
2622 <eli@gondolin.net>
2609
2623
2610 2005-05-22 Fernando Perez <fperez@colorado.edu>
2624 2005-05-22 Fernando Perez <fperez@colorado.edu>
2611
2625
2612 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2626 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2613 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2627 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2614
2628
2615 2005-05-19 Fernando Perez <fperez@colorado.edu>
2629 2005-05-19 Fernando Perez <fperez@colorado.edu>
2616
2630
2617 * IPython/iplib.py (safe_execfile): close a file which could be
2631 * IPython/iplib.py (safe_execfile): close a file which could be
2618 left open (causing problems in win32, which locks open files).
2632 left open (causing problems in win32, which locks open files).
2619 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2633 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2620
2634
2621 2005-05-18 Fernando Perez <fperez@colorado.edu>
2635 2005-05-18 Fernando Perez <fperez@colorado.edu>
2622
2636
2623 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2637 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2624 keyword arguments correctly to safe_execfile().
2638 keyword arguments correctly to safe_execfile().
2625
2639
2626 2005-05-13 Fernando Perez <fperez@colorado.edu>
2640 2005-05-13 Fernando Perez <fperez@colorado.edu>
2627
2641
2628 * ipython.1: Added info about Qt to manpage, and threads warning
2642 * ipython.1: Added info about Qt to manpage, and threads warning
2629 to usage page (invoked with --help).
2643 to usage page (invoked with --help).
2630
2644
2631 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2645 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2632 new matcher (it goes at the end of the priority list) to do
2646 new matcher (it goes at the end of the priority list) to do
2633 tab-completion on named function arguments. Submitted by George
2647 tab-completion on named function arguments. Submitted by George
2634 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2648 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2635 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2649 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2636 for more details.
2650 for more details.
2637
2651
2638 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2652 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2639 SystemExit exceptions in the script being run. Thanks to a report
2653 SystemExit exceptions in the script being run. Thanks to a report
2640 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2654 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2641 producing very annoying behavior when running unit tests.
2655 producing very annoying behavior when running unit tests.
2642
2656
2643 2005-05-12 Fernando Perez <fperez@colorado.edu>
2657 2005-05-12 Fernando Perez <fperez@colorado.edu>
2644
2658
2645 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2659 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2646 which I'd broken (again) due to a changed regexp. In the process,
2660 which I'd broken (again) due to a changed regexp. In the process,
2647 added ';' as an escape to auto-quote the whole line without
2661 added ';' as an escape to auto-quote the whole line without
2648 splitting its arguments. Thanks to a report by Jerry McRae
2662 splitting its arguments. Thanks to a report by Jerry McRae
2649 <qrs0xyc02-AT-sneakemail.com>.
2663 <qrs0xyc02-AT-sneakemail.com>.
2650
2664
2651 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2665 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2652 possible crashes caused by a TokenError. Reported by Ed Schofield
2666 possible crashes caused by a TokenError. Reported by Ed Schofield
2653 <schofield-AT-ftw.at>.
2667 <schofield-AT-ftw.at>.
2654
2668
2655 2005-05-06 Fernando Perez <fperez@colorado.edu>
2669 2005-05-06 Fernando Perez <fperez@colorado.edu>
2656
2670
2657 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2671 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2658
2672
2659 2005-04-29 Fernando Perez <fperez@colorado.edu>
2673 2005-04-29 Fernando Perez <fperez@colorado.edu>
2660
2674
2661 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2675 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2662 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2676 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2663 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2677 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2664 which provides support for Qt interactive usage (similar to the
2678 which provides support for Qt interactive usage (similar to the
2665 existing one for WX and GTK). This had been often requested.
2679 existing one for WX and GTK). This had been often requested.
2666
2680
2667 2005-04-14 *** Released version 0.6.13
2681 2005-04-14 *** Released version 0.6.13
2668
2682
2669 2005-04-08 Fernando Perez <fperez@colorado.edu>
2683 2005-04-08 Fernando Perez <fperez@colorado.edu>
2670
2684
2671 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2685 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2672 from _ofind, which gets called on almost every input line. Now,
2686 from _ofind, which gets called on almost every input line. Now,
2673 we only try to get docstrings if they are actually going to be
2687 we only try to get docstrings if they are actually going to be
2674 used (the overhead of fetching unnecessary docstrings can be
2688 used (the overhead of fetching unnecessary docstrings can be
2675 noticeable for certain objects, such as Pyro proxies).
2689 noticeable for certain objects, such as Pyro proxies).
2676
2690
2677 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2691 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2678 for completers. For some reason I had been passing them the state
2692 for completers. For some reason I had been passing them the state
2679 variable, which completers never actually need, and was in
2693 variable, which completers never actually need, and was in
2680 conflict with the rlcompleter API. Custom completers ONLY need to
2694 conflict with the rlcompleter API. Custom completers ONLY need to
2681 take the text parameter.
2695 take the text parameter.
2682
2696
2683 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2697 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2684 work correctly in pysh. I've also moved all the logic which used
2698 work correctly in pysh. I've also moved all the logic which used
2685 to be in pysh.py here, which will prevent problems with future
2699 to be in pysh.py here, which will prevent problems with future
2686 upgrades. However, this time I must warn users to update their
2700 upgrades. However, this time I must warn users to update their
2687 pysh profile to include the line
2701 pysh profile to include the line
2688
2702
2689 import_all IPython.Extensions.InterpreterExec
2703 import_all IPython.Extensions.InterpreterExec
2690
2704
2691 because otherwise things won't work for them. They MUST also
2705 because otherwise things won't work for them. They MUST also
2692 delete pysh.py and the line
2706 delete pysh.py and the line
2693
2707
2694 execfile pysh.py
2708 execfile pysh.py
2695
2709
2696 from their ipythonrc-pysh.
2710 from their ipythonrc-pysh.
2697
2711
2698 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2712 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2699 robust in the face of objects whose dir() returns non-strings
2713 robust in the face of objects whose dir() returns non-strings
2700 (which it shouldn't, but some broken libs like ITK do). Thanks to
2714 (which it shouldn't, but some broken libs like ITK do). Thanks to
2701 a patch by John Hunter (implemented differently, though). Also
2715 a patch by John Hunter (implemented differently, though). Also
2702 minor improvements by using .extend instead of + on lists.
2716 minor improvements by using .extend instead of + on lists.
2703
2717
2704 * pysh.py:
2718 * pysh.py:
2705
2719
2706 2005-04-06 Fernando Perez <fperez@colorado.edu>
2720 2005-04-06 Fernando Perez <fperez@colorado.edu>
2707
2721
2708 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2722 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2709 by default, so that all users benefit from it. Those who don't
2723 by default, so that all users benefit from it. Those who don't
2710 want it can still turn it off.
2724 want it can still turn it off.
2711
2725
2712 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2726 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2713 config file, I'd forgotten about this, so users were getting it
2727 config file, I'd forgotten about this, so users were getting it
2714 off by default.
2728 off by default.
2715
2729
2716 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2730 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2717 consistency. Now magics can be called in multiline statements,
2731 consistency. Now magics can be called in multiline statements,
2718 and python variables can be expanded in magic calls via $var.
2732 and python variables can be expanded in magic calls via $var.
2719 This makes the magic system behave just like aliases or !system
2733 This makes the magic system behave just like aliases or !system
2720 calls.
2734 calls.
2721
2735
2722 2005-03-28 Fernando Perez <fperez@colorado.edu>
2736 2005-03-28 Fernando Perez <fperez@colorado.edu>
2723
2737
2724 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2738 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2725 expensive string additions for building command. Add support for
2739 expensive string additions for building command. Add support for
2726 trailing ';' when autocall is used.
2740 trailing ';' when autocall is used.
2727
2741
2728 2005-03-26 Fernando Perez <fperez@colorado.edu>
2742 2005-03-26 Fernando Perez <fperez@colorado.edu>
2729
2743
2730 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2744 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2731 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2745 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2732 ipython.el robust against prompts with any number of spaces
2746 ipython.el robust against prompts with any number of spaces
2733 (including 0) after the ':' character.
2747 (including 0) after the ':' character.
2734
2748
2735 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2749 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2736 continuation prompt, which misled users to think the line was
2750 continuation prompt, which misled users to think the line was
2737 already indented. Closes debian Bug#300847, reported to me by
2751 already indented. Closes debian Bug#300847, reported to me by
2738 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2752 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2739
2753
2740 2005-03-23 Fernando Perez <fperez@colorado.edu>
2754 2005-03-23 Fernando Perez <fperez@colorado.edu>
2741
2755
2742 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2756 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2743 properly aligned if they have embedded newlines.
2757 properly aligned if they have embedded newlines.
2744
2758
2745 * IPython/iplib.py (runlines): Add a public method to expose
2759 * IPython/iplib.py (runlines): Add a public method to expose
2746 IPython's code execution machinery, so that users can run strings
2760 IPython's code execution machinery, so that users can run strings
2747 as if they had been typed at the prompt interactively.
2761 as if they had been typed at the prompt interactively.
2748 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2762 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2749 methods which can call the system shell, but with python variable
2763 methods which can call the system shell, but with python variable
2750 expansion. The three such methods are: __IPYTHON__.system,
2764 expansion. The three such methods are: __IPYTHON__.system,
2751 .getoutput and .getoutputerror. These need to be documented in a
2765 .getoutput and .getoutputerror. These need to be documented in a
2752 'public API' section (to be written) of the manual.
2766 'public API' section (to be written) of the manual.
2753
2767
2754 2005-03-20 Fernando Perez <fperez@colorado.edu>
2768 2005-03-20 Fernando Perez <fperez@colorado.edu>
2755
2769
2756 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2770 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2757 for custom exception handling. This is quite powerful, and it
2771 for custom exception handling. This is quite powerful, and it
2758 allows for user-installable exception handlers which can trap
2772 allows for user-installable exception handlers which can trap
2759 custom exceptions at runtime and treat them separately from
2773 custom exceptions at runtime and treat them separately from
2760 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2774 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2761 Mantegazza <mantegazza-AT-ill.fr>.
2775 Mantegazza <mantegazza-AT-ill.fr>.
2762 (InteractiveShell.set_custom_completer): public API function to
2776 (InteractiveShell.set_custom_completer): public API function to
2763 add new completers at runtime.
2777 add new completers at runtime.
2764
2778
2765 2005-03-19 Fernando Perez <fperez@colorado.edu>
2779 2005-03-19 Fernando Perez <fperez@colorado.edu>
2766
2780
2767 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2781 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2768 allow objects which provide their docstrings via non-standard
2782 allow objects which provide their docstrings via non-standard
2769 mechanisms (like Pyro proxies) to still be inspected by ipython's
2783 mechanisms (like Pyro proxies) to still be inspected by ipython's
2770 ? system.
2784 ? system.
2771
2785
2772 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2786 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2773 automatic capture system. I tried quite hard to make it work
2787 automatic capture system. I tried quite hard to make it work
2774 reliably, and simply failed. I tried many combinations with the
2788 reliably, and simply failed. I tried many combinations with the
2775 subprocess module, but eventually nothing worked in all needed
2789 subprocess module, but eventually nothing worked in all needed
2776 cases (not blocking stdin for the child, duplicating stdout
2790 cases (not blocking stdin for the child, duplicating stdout
2777 without blocking, etc). The new %sc/%sx still do capture to these
2791 without blocking, etc). The new %sc/%sx still do capture to these
2778 magical list/string objects which make shell use much more
2792 magical list/string objects which make shell use much more
2779 conveninent, so not all is lost.
2793 conveninent, so not all is lost.
2780
2794
2781 XXX - FIX MANUAL for the change above!
2795 XXX - FIX MANUAL for the change above!
2782
2796
2783 (runsource): I copied code.py's runsource() into ipython to modify
2797 (runsource): I copied code.py's runsource() into ipython to modify
2784 it a bit. Now the code object and source to be executed are
2798 it a bit. Now the code object and source to be executed are
2785 stored in ipython. This makes this info accessible to third-party
2799 stored in ipython. This makes this info accessible to third-party
2786 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2800 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2787 Mantegazza <mantegazza-AT-ill.fr>.
2801 Mantegazza <mantegazza-AT-ill.fr>.
2788
2802
2789 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2803 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2790 history-search via readline (like C-p/C-n). I'd wanted this for a
2804 history-search via readline (like C-p/C-n). I'd wanted this for a
2791 long time, but only recently found out how to do it. For users
2805 long time, but only recently found out how to do it. For users
2792 who already have their ipythonrc files made and want this, just
2806 who already have their ipythonrc files made and want this, just
2793 add:
2807 add:
2794
2808
2795 readline_parse_and_bind "\e[A": history-search-backward
2809 readline_parse_and_bind "\e[A": history-search-backward
2796 readline_parse_and_bind "\e[B": history-search-forward
2810 readline_parse_and_bind "\e[B": history-search-forward
2797
2811
2798 2005-03-18 Fernando Perez <fperez@colorado.edu>
2812 2005-03-18 Fernando Perez <fperez@colorado.edu>
2799
2813
2800 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2814 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2801 LSString and SList classes which allow transparent conversions
2815 LSString and SList classes which allow transparent conversions
2802 between list mode and whitespace-separated string.
2816 between list mode and whitespace-separated string.
2803 (magic_r): Fix recursion problem in %r.
2817 (magic_r): Fix recursion problem in %r.
2804
2818
2805 * IPython/genutils.py (LSString): New class to be used for
2819 * IPython/genutils.py (LSString): New class to be used for
2806 automatic storage of the results of all alias/system calls in _o
2820 automatic storage of the results of all alias/system calls in _o
2807 and _e (stdout/err). These provide a .l/.list attribute which
2821 and _e (stdout/err). These provide a .l/.list attribute which
2808 does automatic splitting on newlines. This means that for most
2822 does automatic splitting on newlines. This means that for most
2809 uses, you'll never need to do capturing of output with %sc/%sx
2823 uses, you'll never need to do capturing of output with %sc/%sx
2810 anymore, since ipython keeps this always done for you. Note that
2824 anymore, since ipython keeps this always done for you. Note that
2811 only the LAST results are stored, the _o/e variables are
2825 only the LAST results are stored, the _o/e variables are
2812 overwritten on each call. If you need to save their contents
2826 overwritten on each call. If you need to save their contents
2813 further, simply bind them to any other name.
2827 further, simply bind them to any other name.
2814
2828
2815 2005-03-17 Fernando Perez <fperez@colorado.edu>
2829 2005-03-17 Fernando Perez <fperez@colorado.edu>
2816
2830
2817 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2831 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2818 prompt namespace handling.
2832 prompt namespace handling.
2819
2833
2820 2005-03-16 Fernando Perez <fperez@colorado.edu>
2834 2005-03-16 Fernando Perez <fperez@colorado.edu>
2821
2835
2822 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2836 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2823 classic prompts to be '>>> ' (final space was missing, and it
2837 classic prompts to be '>>> ' (final space was missing, and it
2824 trips the emacs python mode).
2838 trips the emacs python mode).
2825 (BasePrompt.__str__): Added safe support for dynamic prompt
2839 (BasePrompt.__str__): Added safe support for dynamic prompt
2826 strings. Now you can set your prompt string to be '$x', and the
2840 strings. Now you can set your prompt string to be '$x', and the
2827 value of x will be printed from your interactive namespace. The
2841 value of x will be printed from your interactive namespace. The
2828 interpolation syntax includes the full Itpl support, so
2842 interpolation syntax includes the full Itpl support, so
2829 ${foo()+x+bar()} is a valid prompt string now, and the function
2843 ${foo()+x+bar()} is a valid prompt string now, and the function
2830 calls will be made at runtime.
2844 calls will be made at runtime.
2831
2845
2832 2005-03-15 Fernando Perez <fperez@colorado.edu>
2846 2005-03-15 Fernando Perez <fperez@colorado.edu>
2833
2847
2834 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2848 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2835 avoid name clashes in pylab. %hist still works, it just forwards
2849 avoid name clashes in pylab. %hist still works, it just forwards
2836 the call to %history.
2850 the call to %history.
2837
2851
2838 2005-03-02 *** Released version 0.6.12
2852 2005-03-02 *** Released version 0.6.12
2839
2853
2840 2005-03-02 Fernando Perez <fperez@colorado.edu>
2854 2005-03-02 Fernando Perez <fperez@colorado.edu>
2841
2855
2842 * IPython/iplib.py (handle_magic): log magic calls properly as
2856 * IPython/iplib.py (handle_magic): log magic calls properly as
2843 ipmagic() function calls.
2857 ipmagic() function calls.
2844
2858
2845 * IPython/Magic.py (magic_time): Improved %time to support
2859 * IPython/Magic.py (magic_time): Improved %time to support
2846 statements and provide wall-clock as well as CPU time.
2860 statements and provide wall-clock as well as CPU time.
2847
2861
2848 2005-02-27 Fernando Perez <fperez@colorado.edu>
2862 2005-02-27 Fernando Perez <fperez@colorado.edu>
2849
2863
2850 * IPython/hooks.py: New hooks module, to expose user-modifiable
2864 * IPython/hooks.py: New hooks module, to expose user-modifiable
2851 IPython functionality in a clean manner. For now only the editor
2865 IPython functionality in a clean manner. For now only the editor
2852 hook is actually written, and other thigns which I intend to turn
2866 hook is actually written, and other thigns which I intend to turn
2853 into proper hooks aren't yet there. The display and prefilter
2867 into proper hooks aren't yet there. The display and prefilter
2854 stuff, for example, should be hooks. But at least now the
2868 stuff, for example, should be hooks. But at least now the
2855 framework is in place, and the rest can be moved here with more
2869 framework is in place, and the rest can be moved here with more
2856 time later. IPython had had a .hooks variable for a long time for
2870 time later. IPython had had a .hooks variable for a long time for
2857 this purpose, but I'd never actually used it for anything.
2871 this purpose, but I'd never actually used it for anything.
2858
2872
2859 2005-02-26 Fernando Perez <fperez@colorado.edu>
2873 2005-02-26 Fernando Perez <fperez@colorado.edu>
2860
2874
2861 * IPython/ipmaker.py (make_IPython): make the default ipython
2875 * IPython/ipmaker.py (make_IPython): make the default ipython
2862 directory be called _ipython under win32, to follow more the
2876 directory be called _ipython under win32, to follow more the
2863 naming peculiarities of that platform (where buggy software like
2877 naming peculiarities of that platform (where buggy software like
2864 Visual Sourcesafe breaks with .named directories). Reported by
2878 Visual Sourcesafe breaks with .named directories). Reported by
2865 Ville Vainio.
2879 Ville Vainio.
2866
2880
2867 2005-02-23 Fernando Perez <fperez@colorado.edu>
2881 2005-02-23 Fernando Perez <fperez@colorado.edu>
2868
2882
2869 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2883 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2870 auto_aliases for win32 which were causing problems. Users can
2884 auto_aliases for win32 which were causing problems. Users can
2871 define the ones they personally like.
2885 define the ones they personally like.
2872
2886
2873 2005-02-21 Fernando Perez <fperez@colorado.edu>
2887 2005-02-21 Fernando Perez <fperez@colorado.edu>
2874
2888
2875 * IPython/Magic.py (magic_time): new magic to time execution of
2889 * IPython/Magic.py (magic_time): new magic to time execution of
2876 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2890 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2877
2891
2878 2005-02-19 Fernando Perez <fperez@colorado.edu>
2892 2005-02-19 Fernando Perez <fperez@colorado.edu>
2879
2893
2880 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2894 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2881 into keys (for prompts, for example).
2895 into keys (for prompts, for example).
2882
2896
2883 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2897 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2884 prompts in case users want them. This introduces a small behavior
2898 prompts in case users want them. This introduces a small behavior
2885 change: ipython does not automatically add a space to all prompts
2899 change: ipython does not automatically add a space to all prompts
2886 anymore. To get the old prompts with a space, users should add it
2900 anymore. To get the old prompts with a space, users should add it
2887 manually to their ipythonrc file, so for example prompt_in1 should
2901 manually to their ipythonrc file, so for example prompt_in1 should
2888 now read 'In [\#]: ' instead of 'In [\#]:'.
2902 now read 'In [\#]: ' instead of 'In [\#]:'.
2889 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2903 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2890 file) to control left-padding of secondary prompts.
2904 file) to control left-padding of secondary prompts.
2891
2905
2892 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2906 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2893 the profiler can't be imported. Fix for Debian, which removed
2907 the profiler can't be imported. Fix for Debian, which removed
2894 profile.py because of License issues. I applied a slightly
2908 profile.py because of License issues. I applied a slightly
2895 modified version of the original Debian patch at
2909 modified version of the original Debian patch at
2896 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2910 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2897
2911
2898 2005-02-17 Fernando Perez <fperez@colorado.edu>
2912 2005-02-17 Fernando Perez <fperez@colorado.edu>
2899
2913
2900 * IPython/genutils.py (native_line_ends): Fix bug which would
2914 * IPython/genutils.py (native_line_ends): Fix bug which would
2901 cause improper line-ends under win32 b/c I was not opening files
2915 cause improper line-ends under win32 b/c I was not opening files
2902 in binary mode. Bug report and fix thanks to Ville.
2916 in binary mode. Bug report and fix thanks to Ville.
2903
2917
2904 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2918 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2905 trying to catch spurious foo[1] autocalls. My fix actually broke
2919 trying to catch spurious foo[1] autocalls. My fix actually broke
2906 ',/' autoquote/call with explicit escape (bad regexp).
2920 ',/' autoquote/call with explicit escape (bad regexp).
2907
2921
2908 2005-02-15 *** Released version 0.6.11
2922 2005-02-15 *** Released version 0.6.11
2909
2923
2910 2005-02-14 Fernando Perez <fperez@colorado.edu>
2924 2005-02-14 Fernando Perez <fperez@colorado.edu>
2911
2925
2912 * IPython/background_jobs.py: New background job management
2926 * IPython/background_jobs.py: New background job management
2913 subsystem. This is implemented via a new set of classes, and
2927 subsystem. This is implemented via a new set of classes, and
2914 IPython now provides a builtin 'jobs' object for background job
2928 IPython now provides a builtin 'jobs' object for background job
2915 execution. A convenience %bg magic serves as a lightweight
2929 execution. A convenience %bg magic serves as a lightweight
2916 frontend for starting the more common type of calls. This was
2930 frontend for starting the more common type of calls. This was
2917 inspired by discussions with B. Granger and the BackgroundCommand
2931 inspired by discussions with B. Granger and the BackgroundCommand
2918 class described in the book Python Scripting for Computational
2932 class described in the book Python Scripting for Computational
2919 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2933 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2920 (although ultimately no code from this text was used, as IPython's
2934 (although ultimately no code from this text was used, as IPython's
2921 system is a separate implementation).
2935 system is a separate implementation).
2922
2936
2923 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2937 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2924 to control the completion of single/double underscore names
2938 to control the completion of single/double underscore names
2925 separately. As documented in the example ipytonrc file, the
2939 separately. As documented in the example ipytonrc file, the
2926 readline_omit__names variable can now be set to 2, to omit even
2940 readline_omit__names variable can now be set to 2, to omit even
2927 single underscore names. Thanks to a patch by Brian Wong
2941 single underscore names. Thanks to a patch by Brian Wong
2928 <BrianWong-AT-AirgoNetworks.Com>.
2942 <BrianWong-AT-AirgoNetworks.Com>.
2929 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2943 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2930 be autocalled as foo([1]) if foo were callable. A problem for
2944 be autocalled as foo([1]) if foo were callable. A problem for
2931 things which are both callable and implement __getitem__.
2945 things which are both callable and implement __getitem__.
2932 (init_readline): Fix autoindentation for win32. Thanks to a patch
2946 (init_readline): Fix autoindentation for win32. Thanks to a patch
2933 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2947 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2934
2948
2935 2005-02-12 Fernando Perez <fperez@colorado.edu>
2949 2005-02-12 Fernando Perez <fperez@colorado.edu>
2936
2950
2937 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2951 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2938 which I had written long ago to sort out user error messages which
2952 which I had written long ago to sort out user error messages which
2939 may occur during startup. This seemed like a good idea initially,
2953 may occur during startup. This seemed like a good idea initially,
2940 but it has proven a disaster in retrospect. I don't want to
2954 but it has proven a disaster in retrospect. I don't want to
2941 change much code for now, so my fix is to set the internal 'debug'
2955 change much code for now, so my fix is to set the internal 'debug'
2942 flag to true everywhere, whose only job was precisely to control
2956 flag to true everywhere, whose only job was precisely to control
2943 this subsystem. This closes issue 28 (as well as avoiding all
2957 this subsystem. This closes issue 28 (as well as avoiding all
2944 sorts of strange hangups which occur from time to time).
2958 sorts of strange hangups which occur from time to time).
2945
2959
2946 2005-02-07 Fernando Perez <fperez@colorado.edu>
2960 2005-02-07 Fernando Perez <fperez@colorado.edu>
2947
2961
2948 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2962 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2949 previous call produced a syntax error.
2963 previous call produced a syntax error.
2950
2964
2951 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2965 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2952 classes without constructor.
2966 classes without constructor.
2953
2967
2954 2005-02-06 Fernando Perez <fperez@colorado.edu>
2968 2005-02-06 Fernando Perez <fperez@colorado.edu>
2955
2969
2956 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2970 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2957 completions with the results of each matcher, so we return results
2971 completions with the results of each matcher, so we return results
2958 to the user from all namespaces. This breaks with ipython
2972 to the user from all namespaces. This breaks with ipython
2959 tradition, but I think it's a nicer behavior. Now you get all
2973 tradition, but I think it's a nicer behavior. Now you get all
2960 possible completions listed, from all possible namespaces (python,
2974 possible completions listed, from all possible namespaces (python,
2961 filesystem, magics...) After a request by John Hunter
2975 filesystem, magics...) After a request by John Hunter
2962 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2976 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2963
2977
2964 2005-02-05 Fernando Perez <fperez@colorado.edu>
2978 2005-02-05 Fernando Perez <fperez@colorado.edu>
2965
2979
2966 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2980 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2967 the call had quote characters in it (the quotes were stripped).
2981 the call had quote characters in it (the quotes were stripped).
2968
2982
2969 2005-01-31 Fernando Perez <fperez@colorado.edu>
2983 2005-01-31 Fernando Perez <fperez@colorado.edu>
2970
2984
2971 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2985 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2972 Itpl.itpl() to make the code more robust against psyco
2986 Itpl.itpl() to make the code more robust against psyco
2973 optimizations.
2987 optimizations.
2974
2988
2975 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2989 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2976 of causing an exception. Quicker, cleaner.
2990 of causing an exception. Quicker, cleaner.
2977
2991
2978 2005-01-28 Fernando Perez <fperez@colorado.edu>
2992 2005-01-28 Fernando Perez <fperez@colorado.edu>
2979
2993
2980 * scripts/ipython_win_post_install.py (install): hardcode
2994 * scripts/ipython_win_post_install.py (install): hardcode
2981 sys.prefix+'python.exe' as the executable path. It turns out that
2995 sys.prefix+'python.exe' as the executable path. It turns out that
2982 during the post-installation run, sys.executable resolves to the
2996 during the post-installation run, sys.executable resolves to the
2983 name of the binary installer! I should report this as a distutils
2997 name of the binary installer! I should report this as a distutils
2984 bug, I think. I updated the .10 release with this tiny fix, to
2998 bug, I think. I updated the .10 release with this tiny fix, to
2985 avoid annoying the lists further.
2999 avoid annoying the lists further.
2986
3000
2987 2005-01-27 *** Released version 0.6.10
3001 2005-01-27 *** Released version 0.6.10
2988
3002
2989 2005-01-27 Fernando Perez <fperez@colorado.edu>
3003 2005-01-27 Fernando Perez <fperez@colorado.edu>
2990
3004
2991 * IPython/numutils.py (norm): Added 'inf' as optional name for
3005 * IPython/numutils.py (norm): Added 'inf' as optional name for
2992 L-infinity norm, included references to mathworld.com for vector
3006 L-infinity norm, included references to mathworld.com for vector
2993 norm definitions.
3007 norm definitions.
2994 (amin/amax): added amin/amax for array min/max. Similar to what
3008 (amin/amax): added amin/amax for array min/max. Similar to what
2995 pylab ships with after the recent reorganization of names.
3009 pylab ships with after the recent reorganization of names.
2996 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3010 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2997
3011
2998 * ipython.el: committed Alex's recent fixes and improvements.
3012 * ipython.el: committed Alex's recent fixes and improvements.
2999 Tested with python-mode from CVS, and it looks excellent. Since
3013 Tested with python-mode from CVS, and it looks excellent. Since
3000 python-mode hasn't released anything in a while, I'm temporarily
3014 python-mode hasn't released anything in a while, I'm temporarily
3001 putting a copy of today's CVS (v 4.70) of python-mode in:
3015 putting a copy of today's CVS (v 4.70) of python-mode in:
3002 http://ipython.scipy.org/tmp/python-mode.el
3016 http://ipython.scipy.org/tmp/python-mode.el
3003
3017
3004 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3018 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3005 sys.executable for the executable name, instead of assuming it's
3019 sys.executable for the executable name, instead of assuming it's
3006 called 'python.exe' (the post-installer would have produced broken
3020 called 'python.exe' (the post-installer would have produced broken
3007 setups on systems with a differently named python binary).
3021 setups on systems with a differently named python binary).
3008
3022
3009 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3023 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3010 references to os.linesep, to make the code more
3024 references to os.linesep, to make the code more
3011 platform-independent. This is also part of the win32 coloring
3025 platform-independent. This is also part of the win32 coloring
3012 fixes.
3026 fixes.
3013
3027
3014 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3028 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3015 lines, which actually cause coloring bugs because the length of
3029 lines, which actually cause coloring bugs because the length of
3016 the line is very difficult to correctly compute with embedded
3030 the line is very difficult to correctly compute with embedded
3017 escapes. This was the source of all the coloring problems under
3031 escapes. This was the source of all the coloring problems under
3018 Win32. I think that _finally_, Win32 users have a properly
3032 Win32. I think that _finally_, Win32 users have a properly
3019 working ipython in all respects. This would never have happened
3033 working ipython in all respects. This would never have happened
3020 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3034 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3021
3035
3022 2005-01-26 *** Released version 0.6.9
3036 2005-01-26 *** Released version 0.6.9
3023
3037
3024 2005-01-25 Fernando Perez <fperez@colorado.edu>
3038 2005-01-25 Fernando Perez <fperez@colorado.edu>
3025
3039
3026 * setup.py: finally, we have a true Windows installer, thanks to
3040 * setup.py: finally, we have a true Windows installer, thanks to
3027 the excellent work of Viktor Ransmayr
3041 the excellent work of Viktor Ransmayr
3028 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3042 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3029 Windows users. The setup routine is quite a bit cleaner thanks to
3043 Windows users. The setup routine is quite a bit cleaner thanks to
3030 this, and the post-install script uses the proper functions to
3044 this, and the post-install script uses the proper functions to
3031 allow a clean de-installation using the standard Windows Control
3045 allow a clean de-installation using the standard Windows Control
3032 Panel.
3046 Panel.
3033
3047
3034 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3048 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3035 environment variable under all OSes (including win32) if
3049 environment variable under all OSes (including win32) if
3036 available. This will give consistency to win32 users who have set
3050 available. This will give consistency to win32 users who have set
3037 this variable for any reason. If os.environ['HOME'] fails, the
3051 this variable for any reason. If os.environ['HOME'] fails, the
3038 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3052 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3039
3053
3040 2005-01-24 Fernando Perez <fperez@colorado.edu>
3054 2005-01-24 Fernando Perez <fperez@colorado.edu>
3041
3055
3042 * IPython/numutils.py (empty_like): add empty_like(), similar to
3056 * IPython/numutils.py (empty_like): add empty_like(), similar to
3043 zeros_like() but taking advantage of the new empty() Numeric routine.
3057 zeros_like() but taking advantage of the new empty() Numeric routine.
3044
3058
3045 2005-01-23 *** Released version 0.6.8
3059 2005-01-23 *** Released version 0.6.8
3046
3060
3047 2005-01-22 Fernando Perez <fperez@colorado.edu>
3061 2005-01-22 Fernando Perez <fperez@colorado.edu>
3048
3062
3049 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3063 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3050 automatic show() calls. After discussing things with JDH, it
3064 automatic show() calls. After discussing things with JDH, it
3051 turns out there are too many corner cases where this can go wrong.
3065 turns out there are too many corner cases where this can go wrong.
3052 It's best not to try to be 'too smart', and simply have ipython
3066 It's best not to try to be 'too smart', and simply have ipython
3053 reproduce as much as possible the default behavior of a normal
3067 reproduce as much as possible the default behavior of a normal
3054 python shell.
3068 python shell.
3055
3069
3056 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3070 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3057 line-splitting regexp and _prefilter() to avoid calling getattr()
3071 line-splitting regexp and _prefilter() to avoid calling getattr()
3058 on assignments. This closes
3072 on assignments. This closes
3059 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3073 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3060 readline uses getattr(), so a simple <TAB> keypress is still
3074 readline uses getattr(), so a simple <TAB> keypress is still
3061 enough to trigger getattr() calls on an object.
3075 enough to trigger getattr() calls on an object.
3062
3076
3063 2005-01-21 Fernando Perez <fperez@colorado.edu>
3077 2005-01-21 Fernando Perez <fperez@colorado.edu>
3064
3078
3065 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3079 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3066 docstring under pylab so it doesn't mask the original.
3080 docstring under pylab so it doesn't mask the original.
3067
3081
3068 2005-01-21 *** Released version 0.6.7
3082 2005-01-21 *** Released version 0.6.7
3069
3083
3070 2005-01-21 Fernando Perez <fperez@colorado.edu>
3084 2005-01-21 Fernando Perez <fperez@colorado.edu>
3071
3085
3072 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3086 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3073 signal handling for win32 users in multithreaded mode.
3087 signal handling for win32 users in multithreaded mode.
3074
3088
3075 2005-01-17 Fernando Perez <fperez@colorado.edu>
3089 2005-01-17 Fernando Perez <fperez@colorado.edu>
3076
3090
3077 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3091 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3078 instances with no __init__. After a crash report by Norbert Nemec
3092 instances with no __init__. After a crash report by Norbert Nemec
3079 <Norbert-AT-nemec-online.de>.
3093 <Norbert-AT-nemec-online.de>.
3080
3094
3081 2005-01-14 Fernando Perez <fperez@colorado.edu>
3095 2005-01-14 Fernando Perez <fperez@colorado.edu>
3082
3096
3083 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3097 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3084 names for verbose exceptions, when multiple dotted names and the
3098 names for verbose exceptions, when multiple dotted names and the
3085 'parent' object were present on the same line.
3099 'parent' object were present on the same line.
3086
3100
3087 2005-01-11 Fernando Perez <fperez@colorado.edu>
3101 2005-01-11 Fernando Perez <fperez@colorado.edu>
3088
3102
3089 * IPython/genutils.py (flag_calls): new utility to trap and flag
3103 * IPython/genutils.py (flag_calls): new utility to trap and flag
3090 calls in functions. I need it to clean up matplotlib support.
3104 calls in functions. I need it to clean up matplotlib support.
3091 Also removed some deprecated code in genutils.
3105 Also removed some deprecated code in genutils.
3092
3106
3093 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3107 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3094 that matplotlib scripts called with %run, which don't call show()
3108 that matplotlib scripts called with %run, which don't call show()
3095 themselves, still have their plotting windows open.
3109 themselves, still have their plotting windows open.
3096
3110
3097 2005-01-05 Fernando Perez <fperez@colorado.edu>
3111 2005-01-05 Fernando Perez <fperez@colorado.edu>
3098
3112
3099 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3113 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3100 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3114 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3101
3115
3102 2004-12-19 Fernando Perez <fperez@colorado.edu>
3116 2004-12-19 Fernando Perez <fperez@colorado.edu>
3103
3117
3104 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3118 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3105 parent_runcode, which was an eyesore. The same result can be
3119 parent_runcode, which was an eyesore. The same result can be
3106 obtained with Python's regular superclass mechanisms.
3120 obtained with Python's regular superclass mechanisms.
3107
3121
3108 2004-12-17 Fernando Perez <fperez@colorado.edu>
3122 2004-12-17 Fernando Perez <fperez@colorado.edu>
3109
3123
3110 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3124 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3111 reported by Prabhu.
3125 reported by Prabhu.
3112 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3126 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3113 sys.stderr) instead of explicitly calling sys.stderr. This helps
3127 sys.stderr) instead of explicitly calling sys.stderr. This helps
3114 maintain our I/O abstractions clean, for future GUI embeddings.
3128 maintain our I/O abstractions clean, for future GUI embeddings.
3115
3129
3116 * IPython/genutils.py (info): added new utility for sys.stderr
3130 * IPython/genutils.py (info): added new utility for sys.stderr
3117 unified info message handling (thin wrapper around warn()).
3131 unified info message handling (thin wrapper around warn()).
3118
3132
3119 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3133 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3120 composite (dotted) names on verbose exceptions.
3134 composite (dotted) names on verbose exceptions.
3121 (VerboseTB.nullrepr): harden against another kind of errors which
3135 (VerboseTB.nullrepr): harden against another kind of errors which
3122 Python's inspect module can trigger, and which were crashing
3136 Python's inspect module can trigger, and which were crashing
3123 IPython. Thanks to a report by Marco Lombardi
3137 IPython. Thanks to a report by Marco Lombardi
3124 <mlombard-AT-ma010192.hq.eso.org>.
3138 <mlombard-AT-ma010192.hq.eso.org>.
3125
3139
3126 2004-12-13 *** Released version 0.6.6
3140 2004-12-13 *** Released version 0.6.6
3127
3141
3128 2004-12-12 Fernando Perez <fperez@colorado.edu>
3142 2004-12-12 Fernando Perez <fperez@colorado.edu>
3129
3143
3130 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3144 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3131 generated by pygtk upon initialization if it was built without
3145 generated by pygtk upon initialization if it was built without
3132 threads (for matplotlib users). After a crash reported by
3146 threads (for matplotlib users). After a crash reported by
3133 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3147 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3134
3148
3135 * IPython/ipmaker.py (make_IPython): fix small bug in the
3149 * IPython/ipmaker.py (make_IPython): fix small bug in the
3136 import_some parameter for multiple imports.
3150 import_some parameter for multiple imports.
3137
3151
3138 * IPython/iplib.py (ipmagic): simplified the interface of
3152 * IPython/iplib.py (ipmagic): simplified the interface of
3139 ipmagic() to take a single string argument, just as it would be
3153 ipmagic() to take a single string argument, just as it would be
3140 typed at the IPython cmd line.
3154 typed at the IPython cmd line.
3141 (ipalias): Added new ipalias() with an interface identical to
3155 (ipalias): Added new ipalias() with an interface identical to
3142 ipmagic(). This completes exposing a pure python interface to the
3156 ipmagic(). This completes exposing a pure python interface to the
3143 alias and magic system, which can be used in loops or more complex
3157 alias and magic system, which can be used in loops or more complex
3144 code where IPython's automatic line mangling is not active.
3158 code where IPython's automatic line mangling is not active.
3145
3159
3146 * IPython/genutils.py (timing): changed interface of timing to
3160 * IPython/genutils.py (timing): changed interface of timing to
3147 simply run code once, which is the most common case. timings()
3161 simply run code once, which is the most common case. timings()
3148 remains unchanged, for the cases where you want multiple runs.
3162 remains unchanged, for the cases where you want multiple runs.
3149
3163
3150 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3164 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3151 bug where Python2.2 crashes with exec'ing code which does not end
3165 bug where Python2.2 crashes with exec'ing code which does not end
3152 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3166 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3153 before.
3167 before.
3154
3168
3155 2004-12-10 Fernando Perez <fperez@colorado.edu>
3169 2004-12-10 Fernando Perez <fperez@colorado.edu>
3156
3170
3157 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3171 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3158 -t to -T, to accomodate the new -t flag in %run (the %run and
3172 -t to -T, to accomodate the new -t flag in %run (the %run and
3159 %prun options are kind of intermixed, and it's not easy to change
3173 %prun options are kind of intermixed, and it's not easy to change
3160 this with the limitations of python's getopt).
3174 this with the limitations of python's getopt).
3161
3175
3162 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3176 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3163 the execution of scripts. It's not as fine-tuned as timeit.py,
3177 the execution of scripts. It's not as fine-tuned as timeit.py,
3164 but it works from inside ipython (and under 2.2, which lacks
3178 but it works from inside ipython (and under 2.2, which lacks
3165 timeit.py). Optionally a number of runs > 1 can be given for
3179 timeit.py). Optionally a number of runs > 1 can be given for
3166 timing very short-running code.
3180 timing very short-running code.
3167
3181
3168 * IPython/genutils.py (uniq_stable): new routine which returns a
3182 * IPython/genutils.py (uniq_stable): new routine which returns a
3169 list of unique elements in any iterable, but in stable order of
3183 list of unique elements in any iterable, but in stable order of
3170 appearance. I needed this for the ultraTB fixes, and it's a handy
3184 appearance. I needed this for the ultraTB fixes, and it's a handy
3171 utility.
3185 utility.
3172
3186
3173 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3187 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3174 dotted names in Verbose exceptions. This had been broken since
3188 dotted names in Verbose exceptions. This had been broken since
3175 the very start, now x.y will properly be printed in a Verbose
3189 the very start, now x.y will properly be printed in a Verbose
3176 traceback, instead of x being shown and y appearing always as an
3190 traceback, instead of x being shown and y appearing always as an
3177 'undefined global'. Getting this to work was a bit tricky,
3191 'undefined global'. Getting this to work was a bit tricky,
3178 because by default python tokenizers are stateless. Saved by
3192 because by default python tokenizers are stateless. Saved by
3179 python's ability to easily add a bit of state to an arbitrary
3193 python's ability to easily add a bit of state to an arbitrary
3180 function (without needing to build a full-blown callable object).
3194 function (without needing to build a full-blown callable object).
3181
3195
3182 Also big cleanup of this code, which had horrendous runtime
3196 Also big cleanup of this code, which had horrendous runtime
3183 lookups of zillions of attributes for colorization. Moved all
3197 lookups of zillions of attributes for colorization. Moved all
3184 this code into a few templates, which make it cleaner and quicker.
3198 this code into a few templates, which make it cleaner and quicker.
3185
3199
3186 Printout quality was also improved for Verbose exceptions: one
3200 Printout quality was also improved for Verbose exceptions: one
3187 variable per line, and memory addresses are printed (this can be
3201 variable per line, and memory addresses are printed (this can be
3188 quite handy in nasty debugging situations, which is what Verbose
3202 quite handy in nasty debugging situations, which is what Verbose
3189 is for).
3203 is for).
3190
3204
3191 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3205 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3192 the command line as scripts to be loaded by embedded instances.
3206 the command line as scripts to be loaded by embedded instances.
3193 Doing so has the potential for an infinite recursion if there are
3207 Doing so has the potential for an infinite recursion if there are
3194 exceptions thrown in the process. This fixes a strange crash
3208 exceptions thrown in the process. This fixes a strange crash
3195 reported by Philippe MULLER <muller-AT-irit.fr>.
3209 reported by Philippe MULLER <muller-AT-irit.fr>.
3196
3210
3197 2004-12-09 Fernando Perez <fperez@colorado.edu>
3211 2004-12-09 Fernando Perez <fperez@colorado.edu>
3198
3212
3199 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3213 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3200 to reflect new names in matplotlib, which now expose the
3214 to reflect new names in matplotlib, which now expose the
3201 matlab-compatible interface via a pylab module instead of the
3215 matlab-compatible interface via a pylab module instead of the
3202 'matlab' name. The new code is backwards compatible, so users of
3216 'matlab' name. The new code is backwards compatible, so users of
3203 all matplotlib versions are OK. Patch by J. Hunter.
3217 all matplotlib versions are OK. Patch by J. Hunter.
3204
3218
3205 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3219 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3206 of __init__ docstrings for instances (class docstrings are already
3220 of __init__ docstrings for instances (class docstrings are already
3207 automatically printed). Instances with customized docstrings
3221 automatically printed). Instances with customized docstrings
3208 (indep. of the class) are also recognized and all 3 separate
3222 (indep. of the class) are also recognized and all 3 separate
3209 docstrings are printed (instance, class, constructor). After some
3223 docstrings are printed (instance, class, constructor). After some
3210 comments/suggestions by J. Hunter.
3224 comments/suggestions by J. Hunter.
3211
3225
3212 2004-12-05 Fernando Perez <fperez@colorado.edu>
3226 2004-12-05 Fernando Perez <fperez@colorado.edu>
3213
3227
3214 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3228 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3215 warnings when tab-completion fails and triggers an exception.
3229 warnings when tab-completion fails and triggers an exception.
3216
3230
3217 2004-12-03 Fernando Perez <fperez@colorado.edu>
3231 2004-12-03 Fernando Perez <fperez@colorado.edu>
3218
3232
3219 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3233 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3220 be triggered when using 'run -p'. An incorrect option flag was
3234 be triggered when using 'run -p'. An incorrect option flag was
3221 being set ('d' instead of 'D').
3235 being set ('d' instead of 'D').
3222 (manpage): fix missing escaped \- sign.
3236 (manpage): fix missing escaped \- sign.
3223
3237
3224 2004-11-30 *** Released version 0.6.5
3238 2004-11-30 *** Released version 0.6.5
3225
3239
3226 2004-11-30 Fernando Perez <fperez@colorado.edu>
3240 2004-11-30 Fernando Perez <fperez@colorado.edu>
3227
3241
3228 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3242 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3229 setting with -d option.
3243 setting with -d option.
3230
3244
3231 * setup.py (docfiles): Fix problem where the doc glob I was using
3245 * setup.py (docfiles): Fix problem where the doc glob I was using
3232 was COMPLETELY BROKEN. It was giving the right files by pure
3246 was COMPLETELY BROKEN. It was giving the right files by pure
3233 accident, but failed once I tried to include ipython.el. Note:
3247 accident, but failed once I tried to include ipython.el. Note:
3234 glob() does NOT allow you to do exclusion on multiple endings!
3248 glob() does NOT allow you to do exclusion on multiple endings!
3235
3249
3236 2004-11-29 Fernando Perez <fperez@colorado.edu>
3250 2004-11-29 Fernando Perez <fperez@colorado.edu>
3237
3251
3238 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3252 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3239 the manpage as the source. Better formatting & consistency.
3253 the manpage as the source. Better formatting & consistency.
3240
3254
3241 * IPython/Magic.py (magic_run): Added new -d option, to run
3255 * IPython/Magic.py (magic_run): Added new -d option, to run
3242 scripts under the control of the python pdb debugger. Note that
3256 scripts under the control of the python pdb debugger. Note that
3243 this required changing the %prun option -d to -D, to avoid a clash
3257 this required changing the %prun option -d to -D, to avoid a clash
3244 (since %run must pass options to %prun, and getopt is too dumb to
3258 (since %run must pass options to %prun, and getopt is too dumb to
3245 handle options with string values with embedded spaces). Thanks
3259 handle options with string values with embedded spaces). Thanks
3246 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3260 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3247 (magic_who_ls): added type matching to %who and %whos, so that one
3261 (magic_who_ls): added type matching to %who and %whos, so that one
3248 can filter their output to only include variables of certain
3262 can filter their output to only include variables of certain
3249 types. Another suggestion by Matthew.
3263 types. Another suggestion by Matthew.
3250 (magic_whos): Added memory summaries in kb and Mb for arrays.
3264 (magic_whos): Added memory summaries in kb and Mb for arrays.
3251 (magic_who): Improve formatting (break lines every 9 vars).
3265 (magic_who): Improve formatting (break lines every 9 vars).
3252
3266
3253 2004-11-28 Fernando Perez <fperez@colorado.edu>
3267 2004-11-28 Fernando Perez <fperez@colorado.edu>
3254
3268
3255 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3269 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3256 cache when empty lines were present.
3270 cache when empty lines were present.
3257
3271
3258 2004-11-24 Fernando Perez <fperez@colorado.edu>
3272 2004-11-24 Fernando Perez <fperez@colorado.edu>
3259
3273
3260 * IPython/usage.py (__doc__): document the re-activated threading
3274 * IPython/usage.py (__doc__): document the re-activated threading
3261 options for WX and GTK.
3275 options for WX and GTK.
3262
3276
3263 2004-11-23 Fernando Perez <fperez@colorado.edu>
3277 2004-11-23 Fernando Perez <fperez@colorado.edu>
3264
3278
3265 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3279 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3266 the -wthread and -gthread options, along with a new -tk one to try
3280 the -wthread and -gthread options, along with a new -tk one to try
3267 and coordinate Tk threading with wx/gtk. The tk support is very
3281 and coordinate Tk threading with wx/gtk. The tk support is very
3268 platform dependent, since it seems to require Tcl and Tk to be
3282 platform dependent, since it seems to require Tcl and Tk to be
3269 built with threads (Fedora1/2 appears NOT to have it, but in
3283 built with threads (Fedora1/2 appears NOT to have it, but in
3270 Prabhu's Debian boxes it works OK). But even with some Tk
3284 Prabhu's Debian boxes it works OK). But even with some Tk
3271 limitations, this is a great improvement.
3285 limitations, this is a great improvement.
3272
3286
3273 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3287 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3274 info in user prompts. Patch by Prabhu.
3288 info in user prompts. Patch by Prabhu.
3275
3289
3276 2004-11-18 Fernando Perez <fperez@colorado.edu>
3290 2004-11-18 Fernando Perez <fperez@colorado.edu>
3277
3291
3278 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3292 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3279 EOFErrors and bail, to avoid infinite loops if a non-terminating
3293 EOFErrors and bail, to avoid infinite loops if a non-terminating
3280 file is fed into ipython. Patch submitted in issue 19 by user,
3294 file is fed into ipython. Patch submitted in issue 19 by user,
3281 many thanks.
3295 many thanks.
3282
3296
3283 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3297 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3284 autoquote/parens in continuation prompts, which can cause lots of
3298 autoquote/parens in continuation prompts, which can cause lots of
3285 problems. Closes roundup issue 20.
3299 problems. Closes roundup issue 20.
3286
3300
3287 2004-11-17 Fernando Perez <fperez@colorado.edu>
3301 2004-11-17 Fernando Perez <fperez@colorado.edu>
3288
3302
3289 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3303 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3290 reported as debian bug #280505. I'm not sure my local changelog
3304 reported as debian bug #280505. I'm not sure my local changelog
3291 entry has the proper debian format (Jack?).
3305 entry has the proper debian format (Jack?).
3292
3306
3293 2004-11-08 *** Released version 0.6.4
3307 2004-11-08 *** Released version 0.6.4
3294
3308
3295 2004-11-08 Fernando Perez <fperez@colorado.edu>
3309 2004-11-08 Fernando Perez <fperez@colorado.edu>
3296
3310
3297 * IPython/iplib.py (init_readline): Fix exit message for Windows
3311 * IPython/iplib.py (init_readline): Fix exit message for Windows
3298 when readline is active. Thanks to a report by Eric Jones
3312 when readline is active. Thanks to a report by Eric Jones
3299 <eric-AT-enthought.com>.
3313 <eric-AT-enthought.com>.
3300
3314
3301 2004-11-07 Fernando Perez <fperez@colorado.edu>
3315 2004-11-07 Fernando Perez <fperez@colorado.edu>
3302
3316
3303 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3317 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3304 sometimes seen by win2k/cygwin users.
3318 sometimes seen by win2k/cygwin users.
3305
3319
3306 2004-11-06 Fernando Perez <fperez@colorado.edu>
3320 2004-11-06 Fernando Perez <fperez@colorado.edu>
3307
3321
3308 * IPython/iplib.py (interact): Change the handling of %Exit from
3322 * IPython/iplib.py (interact): Change the handling of %Exit from
3309 trying to propagate a SystemExit to an internal ipython flag.
3323 trying to propagate a SystemExit to an internal ipython flag.
3310 This is less elegant than using Python's exception mechanism, but
3324 This is less elegant than using Python's exception mechanism, but
3311 I can't get that to work reliably with threads, so under -pylab
3325 I can't get that to work reliably with threads, so under -pylab
3312 %Exit was hanging IPython. Cross-thread exception handling is
3326 %Exit was hanging IPython. Cross-thread exception handling is
3313 really a bitch. Thaks to a bug report by Stephen Walton
3327 really a bitch. Thaks to a bug report by Stephen Walton
3314 <stephen.walton-AT-csun.edu>.
3328 <stephen.walton-AT-csun.edu>.
3315
3329
3316 2004-11-04 Fernando Perez <fperez@colorado.edu>
3330 2004-11-04 Fernando Perez <fperez@colorado.edu>
3317
3331
3318 * IPython/iplib.py (raw_input_original): store a pointer to the
3332 * IPython/iplib.py (raw_input_original): store a pointer to the
3319 true raw_input to harden against code which can modify it
3333 true raw_input to harden against code which can modify it
3320 (wx.py.PyShell does this and would otherwise crash ipython).
3334 (wx.py.PyShell does this and would otherwise crash ipython).
3321 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3335 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3322
3336
3323 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3337 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3324 Ctrl-C problem, which does not mess up the input line.
3338 Ctrl-C problem, which does not mess up the input line.
3325
3339
3326 2004-11-03 Fernando Perez <fperez@colorado.edu>
3340 2004-11-03 Fernando Perez <fperez@colorado.edu>
3327
3341
3328 * IPython/Release.py: Changed licensing to BSD, in all files.
3342 * IPython/Release.py: Changed licensing to BSD, in all files.
3329 (name): lowercase name for tarball/RPM release.
3343 (name): lowercase name for tarball/RPM release.
3330
3344
3331 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3345 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3332 use throughout ipython.
3346 use throughout ipython.
3333
3347
3334 * IPython/Magic.py (Magic._ofind): Switch to using the new
3348 * IPython/Magic.py (Magic._ofind): Switch to using the new
3335 OInspect.getdoc() function.
3349 OInspect.getdoc() function.
3336
3350
3337 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3351 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3338 of the line currently being canceled via Ctrl-C. It's extremely
3352 of the line currently being canceled via Ctrl-C. It's extremely
3339 ugly, but I don't know how to do it better (the problem is one of
3353 ugly, but I don't know how to do it better (the problem is one of
3340 handling cross-thread exceptions).
3354 handling cross-thread exceptions).
3341
3355
3342 2004-10-28 Fernando Perez <fperez@colorado.edu>
3356 2004-10-28 Fernando Perez <fperez@colorado.edu>
3343
3357
3344 * IPython/Shell.py (signal_handler): add signal handlers to trap
3358 * IPython/Shell.py (signal_handler): add signal handlers to trap
3345 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3359 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3346 report by Francesc Alted.
3360 report by Francesc Alted.
3347
3361
3348 2004-10-21 Fernando Perez <fperez@colorado.edu>
3362 2004-10-21 Fernando Perez <fperez@colorado.edu>
3349
3363
3350 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3364 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3351 to % for pysh syntax extensions.
3365 to % for pysh syntax extensions.
3352
3366
3353 2004-10-09 Fernando Perez <fperez@colorado.edu>
3367 2004-10-09 Fernando Perez <fperez@colorado.edu>
3354
3368
3355 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3369 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3356 arrays to print a more useful summary, without calling str(arr).
3370 arrays to print a more useful summary, without calling str(arr).
3357 This avoids the problem of extremely lengthy computations which
3371 This avoids the problem of extremely lengthy computations which
3358 occur if arr is large, and appear to the user as a system lockup
3372 occur if arr is large, and appear to the user as a system lockup
3359 with 100% cpu activity. After a suggestion by Kristian Sandberg
3373 with 100% cpu activity. After a suggestion by Kristian Sandberg
3360 <Kristian.Sandberg@colorado.edu>.
3374 <Kristian.Sandberg@colorado.edu>.
3361 (Magic.__init__): fix bug in global magic escapes not being
3375 (Magic.__init__): fix bug in global magic escapes not being
3362 correctly set.
3376 correctly set.
3363
3377
3364 2004-10-08 Fernando Perez <fperez@colorado.edu>
3378 2004-10-08 Fernando Perez <fperez@colorado.edu>
3365
3379
3366 * IPython/Magic.py (__license__): change to absolute imports of
3380 * IPython/Magic.py (__license__): change to absolute imports of
3367 ipython's own internal packages, to start adapting to the absolute
3381 ipython's own internal packages, to start adapting to the absolute
3368 import requirement of PEP-328.
3382 import requirement of PEP-328.
3369
3383
3370 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3384 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3371 files, and standardize author/license marks through the Release
3385 files, and standardize author/license marks through the Release
3372 module instead of having per/file stuff (except for files with
3386 module instead of having per/file stuff (except for files with
3373 particular licenses, like the MIT/PSF-licensed codes).
3387 particular licenses, like the MIT/PSF-licensed codes).
3374
3388
3375 * IPython/Debugger.py: remove dead code for python 2.1
3389 * IPython/Debugger.py: remove dead code for python 2.1
3376
3390
3377 2004-10-04 Fernando Perez <fperez@colorado.edu>
3391 2004-10-04 Fernando Perez <fperez@colorado.edu>
3378
3392
3379 * IPython/iplib.py (ipmagic): New function for accessing magics
3393 * IPython/iplib.py (ipmagic): New function for accessing magics
3380 via a normal python function call.
3394 via a normal python function call.
3381
3395
3382 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3396 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3383 from '@' to '%', to accomodate the new @decorator syntax of python
3397 from '@' to '%', to accomodate the new @decorator syntax of python
3384 2.4.
3398 2.4.
3385
3399
3386 2004-09-29 Fernando Perez <fperez@colorado.edu>
3400 2004-09-29 Fernando Perez <fperez@colorado.edu>
3387
3401
3388 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3402 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3389 matplotlib.use to prevent running scripts which try to switch
3403 matplotlib.use to prevent running scripts which try to switch
3390 interactive backends from within ipython. This will just crash
3404 interactive backends from within ipython. This will just crash
3391 the python interpreter, so we can't allow it (but a detailed error
3405 the python interpreter, so we can't allow it (but a detailed error
3392 is given to the user).
3406 is given to the user).
3393
3407
3394 2004-09-28 Fernando Perez <fperez@colorado.edu>
3408 2004-09-28 Fernando Perez <fperez@colorado.edu>
3395
3409
3396 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3410 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3397 matplotlib-related fixes so that using @run with non-matplotlib
3411 matplotlib-related fixes so that using @run with non-matplotlib
3398 scripts doesn't pop up spurious plot windows. This requires
3412 scripts doesn't pop up spurious plot windows. This requires
3399 matplotlib >= 0.63, where I had to make some changes as well.
3413 matplotlib >= 0.63, where I had to make some changes as well.
3400
3414
3401 * IPython/ipmaker.py (make_IPython): update version requirement to
3415 * IPython/ipmaker.py (make_IPython): update version requirement to
3402 python 2.2.
3416 python 2.2.
3403
3417
3404 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3418 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3405 banner arg for embedded customization.
3419 banner arg for embedded customization.
3406
3420
3407 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3421 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3408 explicit uses of __IP as the IPython's instance name. Now things
3422 explicit uses of __IP as the IPython's instance name. Now things
3409 are properly handled via the shell.name value. The actual code
3423 are properly handled via the shell.name value. The actual code
3410 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3424 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3411 is much better than before. I'll clean things completely when the
3425 is much better than before. I'll clean things completely when the
3412 magic stuff gets a real overhaul.
3426 magic stuff gets a real overhaul.
3413
3427
3414 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3428 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3415 minor changes to debian dir.
3429 minor changes to debian dir.
3416
3430
3417 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3431 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3418 pointer to the shell itself in the interactive namespace even when
3432 pointer to the shell itself in the interactive namespace even when
3419 a user-supplied dict is provided. This is needed for embedding
3433 a user-supplied dict is provided. This is needed for embedding
3420 purposes (found by tests with Michel Sanner).
3434 purposes (found by tests with Michel Sanner).
3421
3435
3422 2004-09-27 Fernando Perez <fperez@colorado.edu>
3436 2004-09-27 Fernando Perez <fperez@colorado.edu>
3423
3437
3424 * IPython/UserConfig/ipythonrc: remove []{} from
3438 * IPython/UserConfig/ipythonrc: remove []{} from
3425 readline_remove_delims, so that things like [modname.<TAB> do
3439 readline_remove_delims, so that things like [modname.<TAB> do
3426 proper completion. This disables [].TAB, but that's a less common
3440 proper completion. This disables [].TAB, but that's a less common
3427 case than module names in list comprehensions, for example.
3441 case than module names in list comprehensions, for example.
3428 Thanks to a report by Andrea Riciputi.
3442 Thanks to a report by Andrea Riciputi.
3429
3443
3430 2004-09-09 Fernando Perez <fperez@colorado.edu>
3444 2004-09-09 Fernando Perez <fperez@colorado.edu>
3431
3445
3432 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3446 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3433 blocking problems in win32 and osx. Fix by John.
3447 blocking problems in win32 and osx. Fix by John.
3434
3448
3435 2004-09-08 Fernando Perez <fperez@colorado.edu>
3449 2004-09-08 Fernando Perez <fperez@colorado.edu>
3436
3450
3437 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3451 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3438 for Win32 and OSX. Fix by John Hunter.
3452 for Win32 and OSX. Fix by John Hunter.
3439
3453
3440 2004-08-30 *** Released version 0.6.3
3454 2004-08-30 *** Released version 0.6.3
3441
3455
3442 2004-08-30 Fernando Perez <fperez@colorado.edu>
3456 2004-08-30 Fernando Perez <fperez@colorado.edu>
3443
3457
3444 * setup.py (isfile): Add manpages to list of dependent files to be
3458 * setup.py (isfile): Add manpages to list of dependent files to be
3445 updated.
3459 updated.
3446
3460
3447 2004-08-27 Fernando Perez <fperez@colorado.edu>
3461 2004-08-27 Fernando Perez <fperez@colorado.edu>
3448
3462
3449 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3463 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3450 for now. They don't really work with standalone WX/GTK code
3464 for now. They don't really work with standalone WX/GTK code
3451 (though matplotlib IS working fine with both of those backends).
3465 (though matplotlib IS working fine with both of those backends).
3452 This will neeed much more testing. I disabled most things with
3466 This will neeed much more testing. I disabled most things with
3453 comments, so turning it back on later should be pretty easy.
3467 comments, so turning it back on later should be pretty easy.
3454
3468
3455 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3469 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3456 autocalling of expressions like r'foo', by modifying the line
3470 autocalling of expressions like r'foo', by modifying the line
3457 split regexp. Closes
3471 split regexp. Closes
3458 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3472 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3459 Riley <ipythonbugs-AT-sabi.net>.
3473 Riley <ipythonbugs-AT-sabi.net>.
3460 (InteractiveShell.mainloop): honor --nobanner with banner
3474 (InteractiveShell.mainloop): honor --nobanner with banner
3461 extensions.
3475 extensions.
3462
3476
3463 * IPython/Shell.py: Significant refactoring of all classes, so
3477 * IPython/Shell.py: Significant refactoring of all classes, so
3464 that we can really support ALL matplotlib backends and threading
3478 that we can really support ALL matplotlib backends and threading
3465 models (John spotted a bug with Tk which required this). Now we
3479 models (John spotted a bug with Tk which required this). Now we
3466 should support single-threaded, WX-threads and GTK-threads, both
3480 should support single-threaded, WX-threads and GTK-threads, both
3467 for generic code and for matplotlib.
3481 for generic code and for matplotlib.
3468
3482
3469 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3483 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3470 -pylab, to simplify things for users. Will also remove the pylab
3484 -pylab, to simplify things for users. Will also remove the pylab
3471 profile, since now all of matplotlib configuration is directly
3485 profile, since now all of matplotlib configuration is directly
3472 handled here. This also reduces startup time.
3486 handled here. This also reduces startup time.
3473
3487
3474 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3488 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3475 shell wasn't being correctly called. Also in IPShellWX.
3489 shell wasn't being correctly called. Also in IPShellWX.
3476
3490
3477 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3491 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3478 fine-tune banner.
3492 fine-tune banner.
3479
3493
3480 * IPython/numutils.py (spike): Deprecate these spike functions,
3494 * IPython/numutils.py (spike): Deprecate these spike functions,
3481 delete (long deprecated) gnuplot_exec handler.
3495 delete (long deprecated) gnuplot_exec handler.
3482
3496
3483 2004-08-26 Fernando Perez <fperez@colorado.edu>
3497 2004-08-26 Fernando Perez <fperez@colorado.edu>
3484
3498
3485 * ipython.1: Update for threading options, plus some others which
3499 * ipython.1: Update for threading options, plus some others which
3486 were missing.
3500 were missing.
3487
3501
3488 * IPython/ipmaker.py (__call__): Added -wthread option for
3502 * IPython/ipmaker.py (__call__): Added -wthread option for
3489 wxpython thread handling. Make sure threading options are only
3503 wxpython thread handling. Make sure threading options are only
3490 valid at the command line.
3504 valid at the command line.
3491
3505
3492 * scripts/ipython: moved shell selection into a factory function
3506 * scripts/ipython: moved shell selection into a factory function
3493 in Shell.py, to keep the starter script to a minimum.
3507 in Shell.py, to keep the starter script to a minimum.
3494
3508
3495 2004-08-25 Fernando Perez <fperez@colorado.edu>
3509 2004-08-25 Fernando Perez <fperez@colorado.edu>
3496
3510
3497 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3511 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3498 John. Along with some recent changes he made to matplotlib, the
3512 John. Along with some recent changes he made to matplotlib, the
3499 next versions of both systems should work very well together.
3513 next versions of both systems should work very well together.
3500
3514
3501 2004-08-24 Fernando Perez <fperez@colorado.edu>
3515 2004-08-24 Fernando Perez <fperez@colorado.edu>
3502
3516
3503 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3517 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3504 tried to switch the profiling to using hotshot, but I'm getting
3518 tried to switch the profiling to using hotshot, but I'm getting
3505 strange errors from prof.runctx() there. I may be misreading the
3519 strange errors from prof.runctx() there. I may be misreading the
3506 docs, but it looks weird. For now the profiling code will
3520 docs, but it looks weird. For now the profiling code will
3507 continue to use the standard profiler.
3521 continue to use the standard profiler.
3508
3522
3509 2004-08-23 Fernando Perez <fperez@colorado.edu>
3523 2004-08-23 Fernando Perez <fperez@colorado.edu>
3510
3524
3511 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3525 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3512 threaded shell, by John Hunter. It's not quite ready yet, but
3526 threaded shell, by John Hunter. It's not quite ready yet, but
3513 close.
3527 close.
3514
3528
3515 2004-08-22 Fernando Perez <fperez@colorado.edu>
3529 2004-08-22 Fernando Perez <fperez@colorado.edu>
3516
3530
3517 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3531 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3518 in Magic and ultraTB.
3532 in Magic and ultraTB.
3519
3533
3520 * ipython.1: document threading options in manpage.
3534 * ipython.1: document threading options in manpage.
3521
3535
3522 * scripts/ipython: Changed name of -thread option to -gthread,
3536 * scripts/ipython: Changed name of -thread option to -gthread,
3523 since this is GTK specific. I want to leave the door open for a
3537 since this is GTK specific. I want to leave the door open for a
3524 -wthread option for WX, which will most likely be necessary. This
3538 -wthread option for WX, which will most likely be necessary. This
3525 change affects usage and ipmaker as well.
3539 change affects usage and ipmaker as well.
3526
3540
3527 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3541 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3528 handle the matplotlib shell issues. Code by John Hunter
3542 handle the matplotlib shell issues. Code by John Hunter
3529 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3543 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3530 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3544 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3531 broken (and disabled for end users) for now, but it puts the
3545 broken (and disabled for end users) for now, but it puts the
3532 infrastructure in place.
3546 infrastructure in place.
3533
3547
3534 2004-08-21 Fernando Perez <fperez@colorado.edu>
3548 2004-08-21 Fernando Perez <fperez@colorado.edu>
3535
3549
3536 * ipythonrc-pylab: Add matplotlib support.
3550 * ipythonrc-pylab: Add matplotlib support.
3537
3551
3538 * matplotlib_config.py: new files for matplotlib support, part of
3552 * matplotlib_config.py: new files for matplotlib support, part of
3539 the pylab profile.
3553 the pylab profile.
3540
3554
3541 * IPython/usage.py (__doc__): documented the threading options.
3555 * IPython/usage.py (__doc__): documented the threading options.
3542
3556
3543 2004-08-20 Fernando Perez <fperez@colorado.edu>
3557 2004-08-20 Fernando Perez <fperez@colorado.edu>
3544
3558
3545 * ipython: Modified the main calling routine to handle the -thread
3559 * ipython: Modified the main calling routine to handle the -thread
3546 and -mpthread options. This needs to be done as a top-level hack,
3560 and -mpthread options. This needs to be done as a top-level hack,
3547 because it determines which class to instantiate for IPython
3561 because it determines which class to instantiate for IPython
3548 itself.
3562 itself.
3549
3563
3550 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3564 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3551 classes to support multithreaded GTK operation without blocking,
3565 classes to support multithreaded GTK operation without blocking,
3552 and matplotlib with all backends. This is a lot of still very
3566 and matplotlib with all backends. This is a lot of still very
3553 experimental code, and threads are tricky. So it may still have a
3567 experimental code, and threads are tricky. So it may still have a
3554 few rough edges... This code owes a lot to
3568 few rough edges... This code owes a lot to
3555 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3569 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3556 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3570 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3557 to John Hunter for all the matplotlib work.
3571 to John Hunter for all the matplotlib work.
3558
3572
3559 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3573 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3560 options for gtk thread and matplotlib support.
3574 options for gtk thread and matplotlib support.
3561
3575
3562 2004-08-16 Fernando Perez <fperez@colorado.edu>
3576 2004-08-16 Fernando Perez <fperez@colorado.edu>
3563
3577
3564 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3578 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3565 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3579 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3566 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3580 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3567
3581
3568 2004-08-11 Fernando Perez <fperez@colorado.edu>
3582 2004-08-11 Fernando Perez <fperez@colorado.edu>
3569
3583
3570 * setup.py (isfile): Fix build so documentation gets updated for
3584 * setup.py (isfile): Fix build so documentation gets updated for
3571 rpms (it was only done for .tgz builds).
3585 rpms (it was only done for .tgz builds).
3572
3586
3573 2004-08-10 Fernando Perez <fperez@colorado.edu>
3587 2004-08-10 Fernando Perez <fperez@colorado.edu>
3574
3588
3575 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3589 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3576
3590
3577 * iplib.py : Silence syntax error exceptions in tab-completion.
3591 * iplib.py : Silence syntax error exceptions in tab-completion.
3578
3592
3579 2004-08-05 Fernando Perez <fperez@colorado.edu>
3593 2004-08-05 Fernando Perez <fperez@colorado.edu>
3580
3594
3581 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3595 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3582 'color off' mark for continuation prompts. This was causing long
3596 'color off' mark for continuation prompts. This was causing long
3583 continuation lines to mis-wrap.
3597 continuation lines to mis-wrap.
3584
3598
3585 2004-08-01 Fernando Perez <fperez@colorado.edu>
3599 2004-08-01 Fernando Perez <fperez@colorado.edu>
3586
3600
3587 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3601 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3588 for building ipython to be a parameter. All this is necessary
3602 for building ipython to be a parameter. All this is necessary
3589 right now to have a multithreaded version, but this insane
3603 right now to have a multithreaded version, but this insane
3590 non-design will be cleaned up soon. For now, it's a hack that
3604 non-design will be cleaned up soon. For now, it's a hack that
3591 works.
3605 works.
3592
3606
3593 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3607 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3594 args in various places. No bugs so far, but it's a dangerous
3608 args in various places. No bugs so far, but it's a dangerous
3595 practice.
3609 practice.
3596
3610
3597 2004-07-31 Fernando Perez <fperez@colorado.edu>
3611 2004-07-31 Fernando Perez <fperez@colorado.edu>
3598
3612
3599 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3613 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3600 fix completion of files with dots in their names under most
3614 fix completion of files with dots in their names under most
3601 profiles (pysh was OK because the completion order is different).
3615 profiles (pysh was OK because the completion order is different).
3602
3616
3603 2004-07-27 Fernando Perez <fperez@colorado.edu>
3617 2004-07-27 Fernando Perez <fperez@colorado.edu>
3604
3618
3605 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3619 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3606 keywords manually, b/c the one in keyword.py was removed in python
3620 keywords manually, b/c the one in keyword.py was removed in python
3607 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3621 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3608 This is NOT a bug under python 2.3 and earlier.
3622 This is NOT a bug under python 2.3 and earlier.
3609
3623
3610 2004-07-26 Fernando Perez <fperez@colorado.edu>
3624 2004-07-26 Fernando Perez <fperez@colorado.edu>
3611
3625
3612 * IPython/ultraTB.py (VerboseTB.text): Add another
3626 * IPython/ultraTB.py (VerboseTB.text): Add another
3613 linecache.checkcache() call to try to prevent inspect.py from
3627 linecache.checkcache() call to try to prevent inspect.py from
3614 crashing under python 2.3. I think this fixes
3628 crashing under python 2.3. I think this fixes
3615 http://www.scipy.net/roundup/ipython/issue17.
3629 http://www.scipy.net/roundup/ipython/issue17.
3616
3630
3617 2004-07-26 *** Released version 0.6.2
3631 2004-07-26 *** Released version 0.6.2
3618
3632
3619 2004-07-26 Fernando Perez <fperez@colorado.edu>
3633 2004-07-26 Fernando Perez <fperez@colorado.edu>
3620
3634
3621 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3635 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3622 fail for any number.
3636 fail for any number.
3623 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3637 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3624 empty bookmarks.
3638 empty bookmarks.
3625
3639
3626 2004-07-26 *** Released version 0.6.1
3640 2004-07-26 *** Released version 0.6.1
3627
3641
3628 2004-07-26 Fernando Perez <fperez@colorado.edu>
3642 2004-07-26 Fernando Perez <fperez@colorado.edu>
3629
3643
3630 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3644 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3631
3645
3632 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3646 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3633 escaping '()[]{}' in filenames.
3647 escaping '()[]{}' in filenames.
3634
3648
3635 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3649 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3636 Python 2.2 users who lack a proper shlex.split.
3650 Python 2.2 users who lack a proper shlex.split.
3637
3651
3638 2004-07-19 Fernando Perez <fperez@colorado.edu>
3652 2004-07-19 Fernando Perez <fperez@colorado.edu>
3639
3653
3640 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3654 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3641 for reading readline's init file. I follow the normal chain:
3655 for reading readline's init file. I follow the normal chain:
3642 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3656 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3643 report by Mike Heeter. This closes
3657 report by Mike Heeter. This closes
3644 http://www.scipy.net/roundup/ipython/issue16.
3658 http://www.scipy.net/roundup/ipython/issue16.
3645
3659
3646 2004-07-18 Fernando Perez <fperez@colorado.edu>
3660 2004-07-18 Fernando Perez <fperez@colorado.edu>
3647
3661
3648 * IPython/iplib.py (__init__): Add better handling of '\' under
3662 * IPython/iplib.py (__init__): Add better handling of '\' under
3649 Win32 for filenames. After a patch by Ville.
3663 Win32 for filenames. After a patch by Ville.
3650
3664
3651 2004-07-17 Fernando Perez <fperez@colorado.edu>
3665 2004-07-17 Fernando Perez <fperez@colorado.edu>
3652
3666
3653 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3667 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3654 autocalling would be triggered for 'foo is bar' if foo is
3668 autocalling would be triggered for 'foo is bar' if foo is
3655 callable. I also cleaned up the autocall detection code to use a
3669 callable. I also cleaned up the autocall detection code to use a
3656 regexp, which is faster. Bug reported by Alexander Schmolck.
3670 regexp, which is faster. Bug reported by Alexander Schmolck.
3657
3671
3658 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3672 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3659 '?' in them would confuse the help system. Reported by Alex
3673 '?' in them would confuse the help system. Reported by Alex
3660 Schmolck.
3674 Schmolck.
3661
3675
3662 2004-07-16 Fernando Perez <fperez@colorado.edu>
3676 2004-07-16 Fernando Perez <fperez@colorado.edu>
3663
3677
3664 * IPython/GnuplotInteractive.py (__all__): added plot2.
3678 * IPython/GnuplotInteractive.py (__all__): added plot2.
3665
3679
3666 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3680 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3667 plotting dictionaries, lists or tuples of 1d arrays.
3681 plotting dictionaries, lists or tuples of 1d arrays.
3668
3682
3669 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3683 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3670 optimizations.
3684 optimizations.
3671
3685
3672 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3686 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3673 the information which was there from Janko's original IPP code:
3687 the information which was there from Janko's original IPP code:
3674
3688
3675 03.05.99 20:53 porto.ifm.uni-kiel.de
3689 03.05.99 20:53 porto.ifm.uni-kiel.de
3676 --Started changelog.
3690 --Started changelog.
3677 --make clear do what it say it does
3691 --make clear do what it say it does
3678 --added pretty output of lines from inputcache
3692 --added pretty output of lines from inputcache
3679 --Made Logger a mixin class, simplifies handling of switches
3693 --Made Logger a mixin class, simplifies handling of switches
3680 --Added own completer class. .string<TAB> expands to last history
3694 --Added own completer class. .string<TAB> expands to last history
3681 line which starts with string. The new expansion is also present
3695 line which starts with string. The new expansion is also present
3682 with Ctrl-r from the readline library. But this shows, who this
3696 with Ctrl-r from the readline library. But this shows, who this
3683 can be done for other cases.
3697 can be done for other cases.
3684 --Added convention that all shell functions should accept a
3698 --Added convention that all shell functions should accept a
3685 parameter_string This opens the door for different behaviour for
3699 parameter_string This opens the door for different behaviour for
3686 each function. @cd is a good example of this.
3700 each function. @cd is a good example of this.
3687
3701
3688 04.05.99 12:12 porto.ifm.uni-kiel.de
3702 04.05.99 12:12 porto.ifm.uni-kiel.de
3689 --added logfile rotation
3703 --added logfile rotation
3690 --added new mainloop method which freezes first the namespace
3704 --added new mainloop method which freezes first the namespace
3691
3705
3692 07.05.99 21:24 porto.ifm.uni-kiel.de
3706 07.05.99 21:24 porto.ifm.uni-kiel.de
3693 --added the docreader classes. Now there is a help system.
3707 --added the docreader classes. Now there is a help system.
3694 -This is only a first try. Currently it's not easy to put new
3708 -This is only a first try. Currently it's not easy to put new
3695 stuff in the indices. But this is the way to go. Info would be
3709 stuff in the indices. But this is the way to go. Info would be
3696 better, but HTML is every where and not everybody has an info
3710 better, but HTML is every where and not everybody has an info
3697 system installed and it's not so easy to change html-docs to info.
3711 system installed and it's not so easy to change html-docs to info.
3698 --added global logfile option
3712 --added global logfile option
3699 --there is now a hook for object inspection method pinfo needs to
3713 --there is now a hook for object inspection method pinfo needs to
3700 be provided for this. Can be reached by two '??'.
3714 be provided for this. Can be reached by two '??'.
3701
3715
3702 08.05.99 20:51 porto.ifm.uni-kiel.de
3716 08.05.99 20:51 porto.ifm.uni-kiel.de
3703 --added a README
3717 --added a README
3704 --bug in rc file. Something has changed so functions in the rc
3718 --bug in rc file. Something has changed so functions in the rc
3705 file need to reference the shell and not self. Not clear if it's a
3719 file need to reference the shell and not self. Not clear if it's a
3706 bug or feature.
3720 bug or feature.
3707 --changed rc file for new behavior
3721 --changed rc file for new behavior
3708
3722
3709 2004-07-15 Fernando Perez <fperez@colorado.edu>
3723 2004-07-15 Fernando Perez <fperez@colorado.edu>
3710
3724
3711 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3725 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3712 cache was falling out of sync in bizarre manners when multi-line
3726 cache was falling out of sync in bizarre manners when multi-line
3713 input was present. Minor optimizations and cleanup.
3727 input was present. Minor optimizations and cleanup.
3714
3728
3715 (Logger): Remove old Changelog info for cleanup. This is the
3729 (Logger): Remove old Changelog info for cleanup. This is the
3716 information which was there from Janko's original code:
3730 information which was there from Janko's original code:
3717
3731
3718 Changes to Logger: - made the default log filename a parameter
3732 Changes to Logger: - made the default log filename a parameter
3719
3733
3720 - put a check for lines beginning with !@? in log(). Needed
3734 - put a check for lines beginning with !@? in log(). Needed
3721 (even if the handlers properly log their lines) for mid-session
3735 (even if the handlers properly log their lines) for mid-session
3722 logging activation to work properly. Without this, lines logged
3736 logging activation to work properly. Without this, lines logged
3723 in mid session, which get read from the cache, would end up
3737 in mid session, which get read from the cache, would end up
3724 'bare' (with !@? in the open) in the log. Now they are caught
3738 'bare' (with !@? in the open) in the log. Now they are caught
3725 and prepended with a #.
3739 and prepended with a #.
3726
3740
3727 * IPython/iplib.py (InteractiveShell.init_readline): added check
3741 * IPython/iplib.py (InteractiveShell.init_readline): added check
3728 in case MagicCompleter fails to be defined, so we don't crash.
3742 in case MagicCompleter fails to be defined, so we don't crash.
3729
3743
3730 2004-07-13 Fernando Perez <fperez@colorado.edu>
3744 2004-07-13 Fernando Perez <fperez@colorado.edu>
3731
3745
3732 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3746 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3733 of EPS if the requested filename ends in '.eps'.
3747 of EPS if the requested filename ends in '.eps'.
3734
3748
3735 2004-07-04 Fernando Perez <fperez@colorado.edu>
3749 2004-07-04 Fernando Perez <fperez@colorado.edu>
3736
3750
3737 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3751 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3738 escaping of quotes when calling the shell.
3752 escaping of quotes when calling the shell.
3739
3753
3740 2004-07-02 Fernando Perez <fperez@colorado.edu>
3754 2004-07-02 Fernando Perez <fperez@colorado.edu>
3741
3755
3742 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3756 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3743 gettext not working because we were clobbering '_'. Fixes
3757 gettext not working because we were clobbering '_'. Fixes
3744 http://www.scipy.net/roundup/ipython/issue6.
3758 http://www.scipy.net/roundup/ipython/issue6.
3745
3759
3746 2004-07-01 Fernando Perez <fperez@colorado.edu>
3760 2004-07-01 Fernando Perez <fperez@colorado.edu>
3747
3761
3748 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3762 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3749 into @cd. Patch by Ville.
3763 into @cd. Patch by Ville.
3750
3764
3751 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3765 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3752 new function to store things after ipmaker runs. Patch by Ville.
3766 new function to store things after ipmaker runs. Patch by Ville.
3753 Eventually this will go away once ipmaker is removed and the class
3767 Eventually this will go away once ipmaker is removed and the class
3754 gets cleaned up, but for now it's ok. Key functionality here is
3768 gets cleaned up, but for now it's ok. Key functionality here is
3755 the addition of the persistent storage mechanism, a dict for
3769 the addition of the persistent storage mechanism, a dict for
3756 keeping data across sessions (for now just bookmarks, but more can
3770 keeping data across sessions (for now just bookmarks, but more can
3757 be implemented later).
3771 be implemented later).
3758
3772
3759 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3773 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3760 persistent across sections. Patch by Ville, I modified it
3774 persistent across sections. Patch by Ville, I modified it
3761 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3775 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3762 added a '-l' option to list all bookmarks.
3776 added a '-l' option to list all bookmarks.
3763
3777
3764 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3778 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3765 center for cleanup. Registered with atexit.register(). I moved
3779 center for cleanup. Registered with atexit.register(). I moved
3766 here the old exit_cleanup(). After a patch by Ville.
3780 here the old exit_cleanup(). After a patch by Ville.
3767
3781
3768 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3782 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3769 characters in the hacked shlex_split for python 2.2.
3783 characters in the hacked shlex_split for python 2.2.
3770
3784
3771 * IPython/iplib.py (file_matches): more fixes to filenames with
3785 * IPython/iplib.py (file_matches): more fixes to filenames with
3772 whitespace in them. It's not perfect, but limitations in python's
3786 whitespace in them. It's not perfect, but limitations in python's
3773 readline make it impossible to go further.
3787 readline make it impossible to go further.
3774
3788
3775 2004-06-29 Fernando Perez <fperez@colorado.edu>
3789 2004-06-29 Fernando Perez <fperez@colorado.edu>
3776
3790
3777 * IPython/iplib.py (file_matches): escape whitespace correctly in
3791 * IPython/iplib.py (file_matches): escape whitespace correctly in
3778 filename completions. Bug reported by Ville.
3792 filename completions. Bug reported by Ville.
3779
3793
3780 2004-06-28 Fernando Perez <fperez@colorado.edu>
3794 2004-06-28 Fernando Perez <fperez@colorado.edu>
3781
3795
3782 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3796 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3783 the history file will be called 'history-PROFNAME' (or just
3797 the history file will be called 'history-PROFNAME' (or just
3784 'history' if no profile is loaded). I was getting annoyed at
3798 'history' if no profile is loaded). I was getting annoyed at
3785 getting my Numerical work history clobbered by pysh sessions.
3799 getting my Numerical work history clobbered by pysh sessions.
3786
3800
3787 * IPython/iplib.py (InteractiveShell.__init__): Internal
3801 * IPython/iplib.py (InteractiveShell.__init__): Internal
3788 getoutputerror() function so that we can honor the system_verbose
3802 getoutputerror() function so that we can honor the system_verbose
3789 flag for _all_ system calls. I also added escaping of #
3803 flag for _all_ system calls. I also added escaping of #
3790 characters here to avoid confusing Itpl.
3804 characters here to avoid confusing Itpl.
3791
3805
3792 * IPython/Magic.py (shlex_split): removed call to shell in
3806 * IPython/Magic.py (shlex_split): removed call to shell in
3793 parse_options and replaced it with shlex.split(). The annoying
3807 parse_options and replaced it with shlex.split(). The annoying
3794 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3808 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3795 to backport it from 2.3, with several frail hacks (the shlex
3809 to backport it from 2.3, with several frail hacks (the shlex
3796 module is rather limited in 2.2). Thanks to a suggestion by Ville
3810 module is rather limited in 2.2). Thanks to a suggestion by Ville
3797 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3811 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3798 problem.
3812 problem.
3799
3813
3800 (Magic.magic_system_verbose): new toggle to print the actual
3814 (Magic.magic_system_verbose): new toggle to print the actual
3801 system calls made by ipython. Mainly for debugging purposes.
3815 system calls made by ipython. Mainly for debugging purposes.
3802
3816
3803 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3817 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3804 doesn't support persistence. Reported (and fix suggested) by
3818 doesn't support persistence. Reported (and fix suggested) by
3805 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3819 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3806
3820
3807 2004-06-26 Fernando Perez <fperez@colorado.edu>
3821 2004-06-26 Fernando Perez <fperez@colorado.edu>
3808
3822
3809 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3823 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3810 continue prompts.
3824 continue prompts.
3811
3825
3812 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3826 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3813 function (basically a big docstring) and a few more things here to
3827 function (basically a big docstring) and a few more things here to
3814 speedup startup. pysh.py is now very lightweight. We want because
3828 speedup startup. pysh.py is now very lightweight. We want because
3815 it gets execfile'd, while InterpreterExec gets imported, so
3829 it gets execfile'd, while InterpreterExec gets imported, so
3816 byte-compilation saves time.
3830 byte-compilation saves time.
3817
3831
3818 2004-06-25 Fernando Perez <fperez@colorado.edu>
3832 2004-06-25 Fernando Perez <fperez@colorado.edu>
3819
3833
3820 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3834 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3821 -NUM', which was recently broken.
3835 -NUM', which was recently broken.
3822
3836
3823 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3837 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3824 in multi-line input (but not !!, which doesn't make sense there).
3838 in multi-line input (but not !!, which doesn't make sense there).
3825
3839
3826 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3840 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3827 It's just too useful, and people can turn it off in the less
3841 It's just too useful, and people can turn it off in the less
3828 common cases where it's a problem.
3842 common cases where it's a problem.
3829
3843
3830 2004-06-24 Fernando Perez <fperez@colorado.edu>
3844 2004-06-24 Fernando Perez <fperez@colorado.edu>
3831
3845
3832 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3846 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3833 special syntaxes (like alias calling) is now allied in multi-line
3847 special syntaxes (like alias calling) is now allied in multi-line
3834 input. This is still _very_ experimental, but it's necessary for
3848 input. This is still _very_ experimental, but it's necessary for
3835 efficient shell usage combining python looping syntax with system
3849 efficient shell usage combining python looping syntax with system
3836 calls. For now it's restricted to aliases, I don't think it
3850 calls. For now it's restricted to aliases, I don't think it
3837 really even makes sense to have this for magics.
3851 really even makes sense to have this for magics.
3838
3852
3839 2004-06-23 Fernando Perez <fperez@colorado.edu>
3853 2004-06-23 Fernando Perez <fperez@colorado.edu>
3840
3854
3841 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3855 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3842 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3856 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3843
3857
3844 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3858 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3845 extensions under Windows (after code sent by Gary Bishop). The
3859 extensions under Windows (after code sent by Gary Bishop). The
3846 extensions considered 'executable' are stored in IPython's rc
3860 extensions considered 'executable' are stored in IPython's rc
3847 structure as win_exec_ext.
3861 structure as win_exec_ext.
3848
3862
3849 * IPython/genutils.py (shell): new function, like system() but
3863 * IPython/genutils.py (shell): new function, like system() but
3850 without return value. Very useful for interactive shell work.
3864 without return value. Very useful for interactive shell work.
3851
3865
3852 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3866 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3853 delete aliases.
3867 delete aliases.
3854
3868
3855 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3869 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3856 sure that the alias table doesn't contain python keywords.
3870 sure that the alias table doesn't contain python keywords.
3857
3871
3858 2004-06-21 Fernando Perez <fperez@colorado.edu>
3872 2004-06-21 Fernando Perez <fperez@colorado.edu>
3859
3873
3860 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3874 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3861 non-existent items are found in $PATH. Reported by Thorsten.
3875 non-existent items are found in $PATH. Reported by Thorsten.
3862
3876
3863 2004-06-20 Fernando Perez <fperez@colorado.edu>
3877 2004-06-20 Fernando Perez <fperez@colorado.edu>
3864
3878
3865 * IPython/iplib.py (complete): modified the completer so that the
3879 * IPython/iplib.py (complete): modified the completer so that the
3866 order of priorities can be easily changed at runtime.
3880 order of priorities can be easily changed at runtime.
3867
3881
3868 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3882 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3869 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3883 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3870
3884
3871 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3885 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3872 expand Python variables prepended with $ in all system calls. The
3886 expand Python variables prepended with $ in all system calls. The
3873 same was done to InteractiveShell.handle_shell_escape. Now all
3887 same was done to InteractiveShell.handle_shell_escape. Now all
3874 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3888 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3875 expansion of python variables and expressions according to the
3889 expansion of python variables and expressions according to the
3876 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3890 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3877
3891
3878 Though PEP-215 has been rejected, a similar (but simpler) one
3892 Though PEP-215 has been rejected, a similar (but simpler) one
3879 seems like it will go into Python 2.4, PEP-292 -
3893 seems like it will go into Python 2.4, PEP-292 -
3880 http://www.python.org/peps/pep-0292.html.
3894 http://www.python.org/peps/pep-0292.html.
3881
3895
3882 I'll keep the full syntax of PEP-215, since IPython has since the
3896 I'll keep the full syntax of PEP-215, since IPython has since the
3883 start used Ka-Ping Yee's reference implementation discussed there
3897 start used Ka-Ping Yee's reference implementation discussed there
3884 (Itpl), and I actually like the powerful semantics it offers.
3898 (Itpl), and I actually like the powerful semantics it offers.
3885
3899
3886 In order to access normal shell variables, the $ has to be escaped
3900 In order to access normal shell variables, the $ has to be escaped
3887 via an extra $. For example:
3901 via an extra $. For example:
3888
3902
3889 In [7]: PATH='a python variable'
3903 In [7]: PATH='a python variable'
3890
3904
3891 In [8]: !echo $PATH
3905 In [8]: !echo $PATH
3892 a python variable
3906 a python variable
3893
3907
3894 In [9]: !echo $$PATH
3908 In [9]: !echo $$PATH
3895 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3909 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3896
3910
3897 (Magic.parse_options): escape $ so the shell doesn't evaluate
3911 (Magic.parse_options): escape $ so the shell doesn't evaluate
3898 things prematurely.
3912 things prematurely.
3899
3913
3900 * IPython/iplib.py (InteractiveShell.call_alias): added the
3914 * IPython/iplib.py (InteractiveShell.call_alias): added the
3901 ability for aliases to expand python variables via $.
3915 ability for aliases to expand python variables via $.
3902
3916
3903 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3917 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3904 system, now there's a @rehash/@rehashx pair of magics. These work
3918 system, now there's a @rehash/@rehashx pair of magics. These work
3905 like the csh rehash command, and can be invoked at any time. They
3919 like the csh rehash command, and can be invoked at any time. They
3906 build a table of aliases to everything in the user's $PATH
3920 build a table of aliases to everything in the user's $PATH
3907 (@rehash uses everything, @rehashx is slower but only adds
3921 (@rehash uses everything, @rehashx is slower but only adds
3908 executable files). With this, the pysh.py-based shell profile can
3922 executable files). With this, the pysh.py-based shell profile can
3909 now simply call rehash upon startup, and full access to all
3923 now simply call rehash upon startup, and full access to all
3910 programs in the user's path is obtained.
3924 programs in the user's path is obtained.
3911
3925
3912 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3926 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3913 functionality is now fully in place. I removed the old dynamic
3927 functionality is now fully in place. I removed the old dynamic
3914 code generation based approach, in favor of a much lighter one
3928 code generation based approach, in favor of a much lighter one
3915 based on a simple dict. The advantage is that this allows me to
3929 based on a simple dict. The advantage is that this allows me to
3916 now have thousands of aliases with negligible cost (unthinkable
3930 now have thousands of aliases with negligible cost (unthinkable
3917 with the old system).
3931 with the old system).
3918
3932
3919 2004-06-19 Fernando Perez <fperez@colorado.edu>
3933 2004-06-19 Fernando Perez <fperez@colorado.edu>
3920
3934
3921 * IPython/iplib.py (__init__): extended MagicCompleter class to
3935 * IPython/iplib.py (__init__): extended MagicCompleter class to
3922 also complete (last in priority) on user aliases.
3936 also complete (last in priority) on user aliases.
3923
3937
3924 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3938 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3925 call to eval.
3939 call to eval.
3926 (ItplNS.__init__): Added a new class which functions like Itpl,
3940 (ItplNS.__init__): Added a new class which functions like Itpl,
3927 but allows configuring the namespace for the evaluation to occur
3941 but allows configuring the namespace for the evaluation to occur
3928 in.
3942 in.
3929
3943
3930 2004-06-18 Fernando Perez <fperez@colorado.edu>
3944 2004-06-18 Fernando Perez <fperez@colorado.edu>
3931
3945
3932 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3946 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3933 better message when 'exit' or 'quit' are typed (a common newbie
3947 better message when 'exit' or 'quit' are typed (a common newbie
3934 confusion).
3948 confusion).
3935
3949
3936 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3950 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3937 check for Windows users.
3951 check for Windows users.
3938
3952
3939 * IPython/iplib.py (InteractiveShell.user_setup): removed
3953 * IPython/iplib.py (InteractiveShell.user_setup): removed
3940 disabling of colors for Windows. I'll test at runtime and issue a
3954 disabling of colors for Windows. I'll test at runtime and issue a
3941 warning if Gary's readline isn't found, as to nudge users to
3955 warning if Gary's readline isn't found, as to nudge users to
3942 download it.
3956 download it.
3943
3957
3944 2004-06-16 Fernando Perez <fperez@colorado.edu>
3958 2004-06-16 Fernando Perez <fperez@colorado.edu>
3945
3959
3946 * IPython/genutils.py (Stream.__init__): changed to print errors
3960 * IPython/genutils.py (Stream.__init__): changed to print errors
3947 to sys.stderr. I had a circular dependency here. Now it's
3961 to sys.stderr. I had a circular dependency here. Now it's
3948 possible to run ipython as IDLE's shell (consider this pre-alpha,
3962 possible to run ipython as IDLE's shell (consider this pre-alpha,
3949 since true stdout things end up in the starting terminal instead
3963 since true stdout things end up in the starting terminal instead
3950 of IDLE's out).
3964 of IDLE's out).
3951
3965
3952 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3966 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3953 users who haven't # updated their prompt_in2 definitions. Remove
3967 users who haven't # updated their prompt_in2 definitions. Remove
3954 eventually.
3968 eventually.
3955 (multiple_replace): added credit to original ASPN recipe.
3969 (multiple_replace): added credit to original ASPN recipe.
3956
3970
3957 2004-06-15 Fernando Perez <fperez@colorado.edu>
3971 2004-06-15 Fernando Perez <fperez@colorado.edu>
3958
3972
3959 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3973 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3960 list of auto-defined aliases.
3974 list of auto-defined aliases.
3961
3975
3962 2004-06-13 Fernando Perez <fperez@colorado.edu>
3976 2004-06-13 Fernando Perez <fperez@colorado.edu>
3963
3977
3964 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3978 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3965 install was really requested (so setup.py can be used for other
3979 install was really requested (so setup.py can be used for other
3966 things under Windows).
3980 things under Windows).
3967
3981
3968 2004-06-10 Fernando Perez <fperez@colorado.edu>
3982 2004-06-10 Fernando Perez <fperez@colorado.edu>
3969
3983
3970 * IPython/Logger.py (Logger.create_log): Manually remove any old
3984 * IPython/Logger.py (Logger.create_log): Manually remove any old
3971 backup, since os.remove may fail under Windows. Fixes bug
3985 backup, since os.remove may fail under Windows. Fixes bug
3972 reported by Thorsten.
3986 reported by Thorsten.
3973
3987
3974 2004-06-09 Fernando Perez <fperez@colorado.edu>
3988 2004-06-09 Fernando Perez <fperez@colorado.edu>
3975
3989
3976 * examples/example-embed.py: fixed all references to %n (replaced
3990 * examples/example-embed.py: fixed all references to %n (replaced
3977 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3991 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3978 for all examples and the manual as well.
3992 for all examples and the manual as well.
3979
3993
3980 2004-06-08 Fernando Perez <fperez@colorado.edu>
3994 2004-06-08 Fernando Perez <fperez@colorado.edu>
3981
3995
3982 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3996 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3983 alignment and color management. All 3 prompt subsystems now
3997 alignment and color management. All 3 prompt subsystems now
3984 inherit from BasePrompt.
3998 inherit from BasePrompt.
3985
3999
3986 * tools/release: updates for windows installer build and tag rpms
4000 * tools/release: updates for windows installer build and tag rpms
3987 with python version (since paths are fixed).
4001 with python version (since paths are fixed).
3988
4002
3989 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4003 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3990 which will become eventually obsolete. Also fixed the default
4004 which will become eventually obsolete. Also fixed the default
3991 prompt_in2 to use \D, so at least new users start with the correct
4005 prompt_in2 to use \D, so at least new users start with the correct
3992 defaults.
4006 defaults.
3993 WARNING: Users with existing ipythonrc files will need to apply
4007 WARNING: Users with existing ipythonrc files will need to apply
3994 this fix manually!
4008 this fix manually!
3995
4009
3996 * setup.py: make windows installer (.exe). This is finally the
4010 * setup.py: make windows installer (.exe). This is finally the
3997 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4011 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3998 which I hadn't included because it required Python 2.3 (or recent
4012 which I hadn't included because it required Python 2.3 (or recent
3999 distutils).
4013 distutils).
4000
4014
4001 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4015 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4002 usage of new '\D' escape.
4016 usage of new '\D' escape.
4003
4017
4004 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4018 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4005 lacks os.getuid())
4019 lacks os.getuid())
4006 (CachedOutput.set_colors): Added the ability to turn coloring
4020 (CachedOutput.set_colors): Added the ability to turn coloring
4007 on/off with @colors even for manually defined prompt colors. It
4021 on/off with @colors even for manually defined prompt colors. It
4008 uses a nasty global, but it works safely and via the generic color
4022 uses a nasty global, but it works safely and via the generic color
4009 handling mechanism.
4023 handling mechanism.
4010 (Prompt2.__init__): Introduced new escape '\D' for continuation
4024 (Prompt2.__init__): Introduced new escape '\D' for continuation
4011 prompts. It represents the counter ('\#') as dots.
4025 prompts. It represents the counter ('\#') as dots.
4012 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4026 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4013 need to update their ipythonrc files and replace '%n' with '\D' in
4027 need to update their ipythonrc files and replace '%n' with '\D' in
4014 their prompt_in2 settings everywhere. Sorry, but there's
4028 their prompt_in2 settings everywhere. Sorry, but there's
4015 otherwise no clean way to get all prompts to properly align. The
4029 otherwise no clean way to get all prompts to properly align. The
4016 ipythonrc shipped with IPython has been updated.
4030 ipythonrc shipped with IPython has been updated.
4017
4031
4018 2004-06-07 Fernando Perez <fperez@colorado.edu>
4032 2004-06-07 Fernando Perez <fperez@colorado.edu>
4019
4033
4020 * setup.py (isfile): Pass local_icons option to latex2html, so the
4034 * setup.py (isfile): Pass local_icons option to latex2html, so the
4021 resulting HTML file is self-contained. Thanks to
4035 resulting HTML file is self-contained. Thanks to
4022 dryice-AT-liu.com.cn for the tip.
4036 dryice-AT-liu.com.cn for the tip.
4023
4037
4024 * pysh.py: I created a new profile 'shell', which implements a
4038 * pysh.py: I created a new profile 'shell', which implements a
4025 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4039 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4026 system shell, nor will it become one anytime soon. It's mainly
4040 system shell, nor will it become one anytime soon. It's mainly
4027 meant to illustrate the use of the new flexible bash-like prompts.
4041 meant to illustrate the use of the new flexible bash-like prompts.
4028 I guess it could be used by hardy souls for true shell management,
4042 I guess it could be used by hardy souls for true shell management,
4029 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4043 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4030 profile. This uses the InterpreterExec extension provided by
4044 profile. This uses the InterpreterExec extension provided by
4031 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4045 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4032
4046
4033 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4047 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4034 auto-align itself with the length of the previous input prompt
4048 auto-align itself with the length of the previous input prompt
4035 (taking into account the invisible color escapes).
4049 (taking into account the invisible color escapes).
4036 (CachedOutput.__init__): Large restructuring of this class. Now
4050 (CachedOutput.__init__): Large restructuring of this class. Now
4037 all three prompts (primary1, primary2, output) are proper objects,
4051 all three prompts (primary1, primary2, output) are proper objects,
4038 managed by the 'parent' CachedOutput class. The code is still a
4052 managed by the 'parent' CachedOutput class. The code is still a
4039 bit hackish (all prompts share state via a pointer to the cache),
4053 bit hackish (all prompts share state via a pointer to the cache),
4040 but it's overall far cleaner than before.
4054 but it's overall far cleaner than before.
4041
4055
4042 * IPython/genutils.py (getoutputerror): modified to add verbose,
4056 * IPython/genutils.py (getoutputerror): modified to add verbose,
4043 debug and header options. This makes the interface of all getout*
4057 debug and header options. This makes the interface of all getout*
4044 functions uniform.
4058 functions uniform.
4045 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4059 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4046
4060
4047 * IPython/Magic.py (Magic.default_option): added a function to
4061 * IPython/Magic.py (Magic.default_option): added a function to
4048 allow registering default options for any magic command. This
4062 allow registering default options for any magic command. This
4049 makes it easy to have profiles which customize the magics globally
4063 makes it easy to have profiles which customize the magics globally
4050 for a certain use. The values set through this function are
4064 for a certain use. The values set through this function are
4051 picked up by the parse_options() method, which all magics should
4065 picked up by the parse_options() method, which all magics should
4052 use to parse their options.
4066 use to parse their options.
4053
4067
4054 * IPython/genutils.py (warn): modified the warnings framework to
4068 * IPython/genutils.py (warn): modified the warnings framework to
4055 use the Term I/O class. I'm trying to slowly unify all of
4069 use the Term I/O class. I'm trying to slowly unify all of
4056 IPython's I/O operations to pass through Term.
4070 IPython's I/O operations to pass through Term.
4057
4071
4058 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4072 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4059 the secondary prompt to correctly match the length of the primary
4073 the secondary prompt to correctly match the length of the primary
4060 one for any prompt. Now multi-line code will properly line up
4074 one for any prompt. Now multi-line code will properly line up
4061 even for path dependent prompts, such as the new ones available
4075 even for path dependent prompts, such as the new ones available
4062 via the prompt_specials.
4076 via the prompt_specials.
4063
4077
4064 2004-06-06 Fernando Perez <fperez@colorado.edu>
4078 2004-06-06 Fernando Perez <fperez@colorado.edu>
4065
4079
4066 * IPython/Prompts.py (prompt_specials): Added the ability to have
4080 * IPython/Prompts.py (prompt_specials): Added the ability to have
4067 bash-like special sequences in the prompts, which get
4081 bash-like special sequences in the prompts, which get
4068 automatically expanded. Things like hostname, current working
4082 automatically expanded. Things like hostname, current working
4069 directory and username are implemented already, but it's easy to
4083 directory and username are implemented already, but it's easy to
4070 add more in the future. Thanks to a patch by W.J. van der Laan
4084 add more in the future. Thanks to a patch by W.J. van der Laan
4071 <gnufnork-AT-hetdigitalegat.nl>
4085 <gnufnork-AT-hetdigitalegat.nl>
4072 (prompt_specials): Added color support for prompt strings, so
4086 (prompt_specials): Added color support for prompt strings, so
4073 users can define arbitrary color setups for their prompts.
4087 users can define arbitrary color setups for their prompts.
4074
4088
4075 2004-06-05 Fernando Perez <fperez@colorado.edu>
4089 2004-06-05 Fernando Perez <fperez@colorado.edu>
4076
4090
4077 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4091 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4078 code to load Gary Bishop's readline and configure it
4092 code to load Gary Bishop's readline and configure it
4079 automatically. Thanks to Gary for help on this.
4093 automatically. Thanks to Gary for help on this.
4080
4094
4081 2004-06-01 Fernando Perez <fperez@colorado.edu>
4095 2004-06-01 Fernando Perez <fperez@colorado.edu>
4082
4096
4083 * IPython/Logger.py (Logger.create_log): fix bug for logging
4097 * IPython/Logger.py (Logger.create_log): fix bug for logging
4084 with no filename (previous fix was incomplete).
4098 with no filename (previous fix was incomplete).
4085
4099
4086 2004-05-25 Fernando Perez <fperez@colorado.edu>
4100 2004-05-25 Fernando Perez <fperez@colorado.edu>
4087
4101
4088 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4102 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4089 parens would get passed to the shell.
4103 parens would get passed to the shell.
4090
4104
4091 2004-05-20 Fernando Perez <fperez@colorado.edu>
4105 2004-05-20 Fernando Perez <fperez@colorado.edu>
4092
4106
4093 * IPython/Magic.py (Magic.magic_prun): changed default profile
4107 * IPython/Magic.py (Magic.magic_prun): changed default profile
4094 sort order to 'time' (the more common profiling need).
4108 sort order to 'time' (the more common profiling need).
4095
4109
4096 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4110 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4097 so that source code shown is guaranteed in sync with the file on
4111 so that source code shown is guaranteed in sync with the file on
4098 disk (also changed in psource). Similar fix to the one for
4112 disk (also changed in psource). Similar fix to the one for
4099 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4113 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4100 <yann.ledu-AT-noos.fr>.
4114 <yann.ledu-AT-noos.fr>.
4101
4115
4102 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4116 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4103 with a single option would not be correctly parsed. Closes
4117 with a single option would not be correctly parsed. Closes
4104 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4118 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4105 introduced in 0.6.0 (on 2004-05-06).
4119 introduced in 0.6.0 (on 2004-05-06).
4106
4120
4107 2004-05-13 *** Released version 0.6.0
4121 2004-05-13 *** Released version 0.6.0
4108
4122
4109 2004-05-13 Fernando Perez <fperez@colorado.edu>
4123 2004-05-13 Fernando Perez <fperez@colorado.edu>
4110
4124
4111 * debian/: Added debian/ directory to CVS, so that debian support
4125 * debian/: Added debian/ directory to CVS, so that debian support
4112 is publicly accessible. The debian package is maintained by Jack
4126 is publicly accessible. The debian package is maintained by Jack
4113 Moffit <jack-AT-xiph.org>.
4127 Moffit <jack-AT-xiph.org>.
4114
4128
4115 * Documentation: included the notes about an ipython-based system
4129 * Documentation: included the notes about an ipython-based system
4116 shell (the hypothetical 'pysh') into the new_design.pdf document,
4130 shell (the hypothetical 'pysh') into the new_design.pdf document,
4117 so that these ideas get distributed to users along with the
4131 so that these ideas get distributed to users along with the
4118 official documentation.
4132 official documentation.
4119
4133
4120 2004-05-10 Fernando Perez <fperez@colorado.edu>
4134 2004-05-10 Fernando Perez <fperez@colorado.edu>
4121
4135
4122 * IPython/Logger.py (Logger.create_log): fix recently introduced
4136 * IPython/Logger.py (Logger.create_log): fix recently introduced
4123 bug (misindented line) where logstart would fail when not given an
4137 bug (misindented line) where logstart would fail when not given an
4124 explicit filename.
4138 explicit filename.
4125
4139
4126 2004-05-09 Fernando Perez <fperez@colorado.edu>
4140 2004-05-09 Fernando Perez <fperez@colorado.edu>
4127
4141
4128 * IPython/Magic.py (Magic.parse_options): skip system call when
4142 * IPython/Magic.py (Magic.parse_options): skip system call when
4129 there are no options to look for. Faster, cleaner for the common
4143 there are no options to look for. Faster, cleaner for the common
4130 case.
4144 case.
4131
4145
4132 * Documentation: many updates to the manual: describing Windows
4146 * Documentation: many updates to the manual: describing Windows
4133 support better, Gnuplot updates, credits, misc small stuff. Also
4147 support better, Gnuplot updates, credits, misc small stuff. Also
4134 updated the new_design doc a bit.
4148 updated the new_design doc a bit.
4135
4149
4136 2004-05-06 *** Released version 0.6.0.rc1
4150 2004-05-06 *** Released version 0.6.0.rc1
4137
4151
4138 2004-05-06 Fernando Perez <fperez@colorado.edu>
4152 2004-05-06 Fernando Perez <fperez@colorado.edu>
4139
4153
4140 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4154 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4141 operations to use the vastly more efficient list/''.join() method.
4155 operations to use the vastly more efficient list/''.join() method.
4142 (FormattedTB.text): Fix
4156 (FormattedTB.text): Fix
4143 http://www.scipy.net/roundup/ipython/issue12 - exception source
4157 http://www.scipy.net/roundup/ipython/issue12 - exception source
4144 extract not updated after reload. Thanks to Mike Salib
4158 extract not updated after reload. Thanks to Mike Salib
4145 <msalib-AT-mit.edu> for pinning the source of the problem.
4159 <msalib-AT-mit.edu> for pinning the source of the problem.
4146 Fortunately, the solution works inside ipython and doesn't require
4160 Fortunately, the solution works inside ipython and doesn't require
4147 any changes to python proper.
4161 any changes to python proper.
4148
4162
4149 * IPython/Magic.py (Magic.parse_options): Improved to process the
4163 * IPython/Magic.py (Magic.parse_options): Improved to process the
4150 argument list as a true shell would (by actually using the
4164 argument list as a true shell would (by actually using the
4151 underlying system shell). This way, all @magics automatically get
4165 underlying system shell). This way, all @magics automatically get
4152 shell expansion for variables. Thanks to a comment by Alex
4166 shell expansion for variables. Thanks to a comment by Alex
4153 Schmolck.
4167 Schmolck.
4154
4168
4155 2004-04-04 Fernando Perez <fperez@colorado.edu>
4169 2004-04-04 Fernando Perez <fperez@colorado.edu>
4156
4170
4157 * IPython/iplib.py (InteractiveShell.interact): Added a special
4171 * IPython/iplib.py (InteractiveShell.interact): Added a special
4158 trap for a debugger quit exception, which is basically impossible
4172 trap for a debugger quit exception, which is basically impossible
4159 to handle by normal mechanisms, given what pdb does to the stack.
4173 to handle by normal mechanisms, given what pdb does to the stack.
4160 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4174 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4161
4175
4162 2004-04-03 Fernando Perez <fperez@colorado.edu>
4176 2004-04-03 Fernando Perez <fperez@colorado.edu>
4163
4177
4164 * IPython/genutils.py (Term): Standardized the names of the Term
4178 * IPython/genutils.py (Term): Standardized the names of the Term
4165 class streams to cin/cout/cerr, following C++ naming conventions
4179 class streams to cin/cout/cerr, following C++ naming conventions
4166 (I can't use in/out/err because 'in' is not a valid attribute
4180 (I can't use in/out/err because 'in' is not a valid attribute
4167 name).
4181 name).
4168
4182
4169 * IPython/iplib.py (InteractiveShell.interact): don't increment
4183 * IPython/iplib.py (InteractiveShell.interact): don't increment
4170 the prompt if there's no user input. By Daniel 'Dang' Griffith
4184 the prompt if there's no user input. By Daniel 'Dang' Griffith
4171 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4185 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4172 Francois Pinard.
4186 Francois Pinard.
4173
4187
4174 2004-04-02 Fernando Perez <fperez@colorado.edu>
4188 2004-04-02 Fernando Perez <fperez@colorado.edu>
4175
4189
4176 * IPython/genutils.py (Stream.__init__): Modified to survive at
4190 * IPython/genutils.py (Stream.__init__): Modified to survive at
4177 least importing in contexts where stdin/out/err aren't true file
4191 least importing in contexts where stdin/out/err aren't true file
4178 objects, such as PyCrust (they lack fileno() and mode). However,
4192 objects, such as PyCrust (they lack fileno() and mode). However,
4179 the recovery facilities which rely on these things existing will
4193 the recovery facilities which rely on these things existing will
4180 not work.
4194 not work.
4181
4195
4182 2004-04-01 Fernando Perez <fperez@colorado.edu>
4196 2004-04-01 Fernando Perez <fperez@colorado.edu>
4183
4197
4184 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4198 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4185 use the new getoutputerror() function, so it properly
4199 use the new getoutputerror() function, so it properly
4186 distinguishes stdout/err.
4200 distinguishes stdout/err.
4187
4201
4188 * IPython/genutils.py (getoutputerror): added a function to
4202 * IPython/genutils.py (getoutputerror): added a function to
4189 capture separately the standard output and error of a command.
4203 capture separately the standard output and error of a command.
4190 After a comment from dang on the mailing lists. This code is
4204 After a comment from dang on the mailing lists. This code is
4191 basically a modified version of commands.getstatusoutput(), from
4205 basically a modified version of commands.getstatusoutput(), from
4192 the standard library.
4206 the standard library.
4193
4207
4194 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4208 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4195 '!!' as a special syntax (shorthand) to access @sx.
4209 '!!' as a special syntax (shorthand) to access @sx.
4196
4210
4197 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4211 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4198 command and return its output as a list split on '\n'.
4212 command and return its output as a list split on '\n'.
4199
4213
4200 2004-03-31 Fernando Perez <fperez@colorado.edu>
4214 2004-03-31 Fernando Perez <fperez@colorado.edu>
4201
4215
4202 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4216 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4203 method to dictionaries used as FakeModule instances if they lack
4217 method to dictionaries used as FakeModule instances if they lack
4204 it. At least pydoc in python2.3 breaks for runtime-defined
4218 it. At least pydoc in python2.3 breaks for runtime-defined
4205 functions without this hack. At some point I need to _really_
4219 functions without this hack. At some point I need to _really_
4206 understand what FakeModule is doing, because it's a gross hack.
4220 understand what FakeModule is doing, because it's a gross hack.
4207 But it solves Arnd's problem for now...
4221 But it solves Arnd's problem for now...
4208
4222
4209 2004-02-27 Fernando Perez <fperez@colorado.edu>
4223 2004-02-27 Fernando Perez <fperez@colorado.edu>
4210
4224
4211 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4225 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4212 mode would behave erratically. Also increased the number of
4226 mode would behave erratically. Also increased the number of
4213 possible logs in rotate mod to 999. Thanks to Rod Holland
4227 possible logs in rotate mod to 999. Thanks to Rod Holland
4214 <rhh@StructureLABS.com> for the report and fixes.
4228 <rhh@StructureLABS.com> for the report and fixes.
4215
4229
4216 2004-02-26 Fernando Perez <fperez@colorado.edu>
4230 2004-02-26 Fernando Perez <fperez@colorado.edu>
4217
4231
4218 * IPython/genutils.py (page): Check that the curses module really
4232 * IPython/genutils.py (page): Check that the curses module really
4219 has the initscr attribute before trying to use it. For some
4233 has the initscr attribute before trying to use it. For some
4220 reason, the Solaris curses module is missing this. I think this
4234 reason, the Solaris curses module is missing this. I think this
4221 should be considered a Solaris python bug, but I'm not sure.
4235 should be considered a Solaris python bug, but I'm not sure.
4222
4236
4223 2004-01-17 Fernando Perez <fperez@colorado.edu>
4237 2004-01-17 Fernando Perez <fperez@colorado.edu>
4224
4238
4225 * IPython/genutils.py (Stream.__init__): Changes to try to make
4239 * IPython/genutils.py (Stream.__init__): Changes to try to make
4226 ipython robust against stdin/out/err being closed by the user.
4240 ipython robust against stdin/out/err being closed by the user.
4227 This is 'user error' (and blocks a normal python session, at least
4241 This is 'user error' (and blocks a normal python session, at least
4228 the stdout case). However, Ipython should be able to survive such
4242 the stdout case). However, Ipython should be able to survive such
4229 instances of abuse as gracefully as possible. To simplify the
4243 instances of abuse as gracefully as possible. To simplify the
4230 coding and maintain compatibility with Gary Bishop's Term
4244 coding and maintain compatibility with Gary Bishop's Term
4231 contributions, I've made use of classmethods for this. I think
4245 contributions, I've made use of classmethods for this. I think
4232 this introduces a dependency on python 2.2.
4246 this introduces a dependency on python 2.2.
4233
4247
4234 2004-01-13 Fernando Perez <fperez@colorado.edu>
4248 2004-01-13 Fernando Perez <fperez@colorado.edu>
4235
4249
4236 * IPython/numutils.py (exp_safe): simplified the code a bit and
4250 * IPython/numutils.py (exp_safe): simplified the code a bit and
4237 removed the need for importing the kinds module altogether.
4251 removed the need for importing the kinds module altogether.
4238
4252
4239 2004-01-06 Fernando Perez <fperez@colorado.edu>
4253 2004-01-06 Fernando Perez <fperez@colorado.edu>
4240
4254
4241 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4255 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4242 a magic function instead, after some community feedback. No
4256 a magic function instead, after some community feedback. No
4243 special syntax will exist for it, but its name is deliberately
4257 special syntax will exist for it, but its name is deliberately
4244 very short.
4258 very short.
4245
4259
4246 2003-12-20 Fernando Perez <fperez@colorado.edu>
4260 2003-12-20 Fernando Perez <fperez@colorado.edu>
4247
4261
4248 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4262 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4249 new functionality, to automagically assign the result of a shell
4263 new functionality, to automagically assign the result of a shell
4250 command to a variable. I'll solicit some community feedback on
4264 command to a variable. I'll solicit some community feedback on
4251 this before making it permanent.
4265 this before making it permanent.
4252
4266
4253 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4267 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4254 requested about callables for which inspect couldn't obtain a
4268 requested about callables for which inspect couldn't obtain a
4255 proper argspec. Thanks to a crash report sent by Etienne
4269 proper argspec. Thanks to a crash report sent by Etienne
4256 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4270 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4257
4271
4258 2003-12-09 Fernando Perez <fperez@colorado.edu>
4272 2003-12-09 Fernando Perez <fperez@colorado.edu>
4259
4273
4260 * IPython/genutils.py (page): patch for the pager to work across
4274 * IPython/genutils.py (page): patch for the pager to work across
4261 various versions of Windows. By Gary Bishop.
4275 various versions of Windows. By Gary Bishop.
4262
4276
4263 2003-12-04 Fernando Perez <fperez@colorado.edu>
4277 2003-12-04 Fernando Perez <fperez@colorado.edu>
4264
4278
4265 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4279 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4266 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4280 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4267 While I tested this and it looks ok, there may still be corner
4281 While I tested this and it looks ok, there may still be corner
4268 cases I've missed.
4282 cases I've missed.
4269
4283
4270 2003-12-01 Fernando Perez <fperez@colorado.edu>
4284 2003-12-01 Fernando Perez <fperez@colorado.edu>
4271
4285
4272 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4286 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4273 where a line like 'p,q=1,2' would fail because the automagic
4287 where a line like 'p,q=1,2' would fail because the automagic
4274 system would be triggered for @p.
4288 system would be triggered for @p.
4275
4289
4276 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4290 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4277 cleanups, code unmodified.
4291 cleanups, code unmodified.
4278
4292
4279 * IPython/genutils.py (Term): added a class for IPython to handle
4293 * IPython/genutils.py (Term): added a class for IPython to handle
4280 output. In most cases it will just be a proxy for stdout/err, but
4294 output. In most cases it will just be a proxy for stdout/err, but
4281 having this allows modifications to be made for some platforms,
4295 having this allows modifications to be made for some platforms,
4282 such as handling color escapes under Windows. All of this code
4296 such as handling color escapes under Windows. All of this code
4283 was contributed by Gary Bishop, with minor modifications by me.
4297 was contributed by Gary Bishop, with minor modifications by me.
4284 The actual changes affect many files.
4298 The actual changes affect many files.
4285
4299
4286 2003-11-30 Fernando Perez <fperez@colorado.edu>
4300 2003-11-30 Fernando Perez <fperez@colorado.edu>
4287
4301
4288 * IPython/iplib.py (file_matches): new completion code, courtesy
4302 * IPython/iplib.py (file_matches): new completion code, courtesy
4289 of Jeff Collins. This enables filename completion again under
4303 of Jeff Collins. This enables filename completion again under
4290 python 2.3, which disabled it at the C level.
4304 python 2.3, which disabled it at the C level.
4291
4305
4292 2003-11-11 Fernando Perez <fperez@colorado.edu>
4306 2003-11-11 Fernando Perez <fperez@colorado.edu>
4293
4307
4294 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4308 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4295 for Numeric.array(map(...)), but often convenient.
4309 for Numeric.array(map(...)), but often convenient.
4296
4310
4297 2003-11-05 Fernando Perez <fperez@colorado.edu>
4311 2003-11-05 Fernando Perez <fperez@colorado.edu>
4298
4312
4299 * IPython/numutils.py (frange): Changed a call from int() to
4313 * IPython/numutils.py (frange): Changed a call from int() to
4300 int(round()) to prevent a problem reported with arange() in the
4314 int(round()) to prevent a problem reported with arange() in the
4301 numpy list.
4315 numpy list.
4302
4316
4303 2003-10-06 Fernando Perez <fperez@colorado.edu>
4317 2003-10-06 Fernando Perez <fperez@colorado.edu>
4304
4318
4305 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4319 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4306 prevent crashes if sys lacks an argv attribute (it happens with
4320 prevent crashes if sys lacks an argv attribute (it happens with
4307 embedded interpreters which build a bare-bones sys module).
4321 embedded interpreters which build a bare-bones sys module).
4308 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4322 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4309
4323
4310 2003-09-24 Fernando Perez <fperez@colorado.edu>
4324 2003-09-24 Fernando Perez <fperez@colorado.edu>
4311
4325
4312 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4326 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4313 to protect against poorly written user objects where __getattr__
4327 to protect against poorly written user objects where __getattr__
4314 raises exceptions other than AttributeError. Thanks to a bug
4328 raises exceptions other than AttributeError. Thanks to a bug
4315 report by Oliver Sander <osander-AT-gmx.de>.
4329 report by Oliver Sander <osander-AT-gmx.de>.
4316
4330
4317 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4331 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4318 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4332 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4319
4333
4320 2003-09-09 Fernando Perez <fperez@colorado.edu>
4334 2003-09-09 Fernando Perez <fperez@colorado.edu>
4321
4335
4322 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4336 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4323 unpacking a list whith a callable as first element would
4337 unpacking a list whith a callable as first element would
4324 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4338 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4325 Collins.
4339 Collins.
4326
4340
4327 2003-08-25 *** Released version 0.5.0
4341 2003-08-25 *** Released version 0.5.0
4328
4342
4329 2003-08-22 Fernando Perez <fperez@colorado.edu>
4343 2003-08-22 Fernando Perez <fperez@colorado.edu>
4330
4344
4331 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4345 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4332 improperly defined user exceptions. Thanks to feedback from Mark
4346 improperly defined user exceptions. Thanks to feedback from Mark
4333 Russell <mrussell-AT-verio.net>.
4347 Russell <mrussell-AT-verio.net>.
4334
4348
4335 2003-08-20 Fernando Perez <fperez@colorado.edu>
4349 2003-08-20 Fernando Perez <fperez@colorado.edu>
4336
4350
4337 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4351 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4338 printing so that it would print multi-line string forms starting
4352 printing so that it would print multi-line string forms starting
4339 with a new line. This way the formatting is better respected for
4353 with a new line. This way the formatting is better respected for
4340 objects which work hard to make nice string forms.
4354 objects which work hard to make nice string forms.
4341
4355
4342 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4356 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4343 autocall would overtake data access for objects with both
4357 autocall would overtake data access for objects with both
4344 __getitem__ and __call__.
4358 __getitem__ and __call__.
4345
4359
4346 2003-08-19 *** Released version 0.5.0-rc1
4360 2003-08-19 *** Released version 0.5.0-rc1
4347
4361
4348 2003-08-19 Fernando Perez <fperez@colorado.edu>
4362 2003-08-19 Fernando Perez <fperez@colorado.edu>
4349
4363
4350 * IPython/deep_reload.py (load_tail): single tiny change here
4364 * IPython/deep_reload.py (load_tail): single tiny change here
4351 seems to fix the long-standing bug of dreload() failing to work
4365 seems to fix the long-standing bug of dreload() failing to work
4352 for dotted names. But this module is pretty tricky, so I may have
4366 for dotted names. But this module is pretty tricky, so I may have
4353 missed some subtlety. Needs more testing!.
4367 missed some subtlety. Needs more testing!.
4354
4368
4355 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4369 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4356 exceptions which have badly implemented __str__ methods.
4370 exceptions which have badly implemented __str__ methods.
4357 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4371 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4358 which I've been getting reports about from Python 2.3 users. I
4372 which I've been getting reports about from Python 2.3 users. I
4359 wish I had a simple test case to reproduce the problem, so I could
4373 wish I had a simple test case to reproduce the problem, so I could
4360 either write a cleaner workaround or file a bug report if
4374 either write a cleaner workaround or file a bug report if
4361 necessary.
4375 necessary.
4362
4376
4363 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4377 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4364 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4378 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4365 a bug report by Tjabo Kloppenburg.
4379 a bug report by Tjabo Kloppenburg.
4366
4380
4367 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4381 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4368 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4382 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4369 seems rather unstable. Thanks to a bug report by Tjabo
4383 seems rather unstable. Thanks to a bug report by Tjabo
4370 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4384 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4371
4385
4372 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4386 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4373 this out soon because of the critical fixes in the inner loop for
4387 this out soon because of the critical fixes in the inner loop for
4374 generators.
4388 generators.
4375
4389
4376 * IPython/Magic.py (Magic.getargspec): removed. This (and
4390 * IPython/Magic.py (Magic.getargspec): removed. This (and
4377 _get_def) have been obsoleted by OInspect for a long time, I
4391 _get_def) have been obsoleted by OInspect for a long time, I
4378 hadn't noticed that they were dead code.
4392 hadn't noticed that they were dead code.
4379 (Magic._ofind): restored _ofind functionality for a few literals
4393 (Magic._ofind): restored _ofind functionality for a few literals
4380 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4394 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4381 for things like "hello".capitalize?, since that would require a
4395 for things like "hello".capitalize?, since that would require a
4382 potentially dangerous eval() again.
4396 potentially dangerous eval() again.
4383
4397
4384 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4398 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4385 logic a bit more to clean up the escapes handling and minimize the
4399 logic a bit more to clean up the escapes handling and minimize the
4386 use of _ofind to only necessary cases. The interactive 'feel' of
4400 use of _ofind to only necessary cases. The interactive 'feel' of
4387 IPython should have improved quite a bit with the changes in
4401 IPython should have improved quite a bit with the changes in
4388 _prefilter and _ofind (besides being far safer than before).
4402 _prefilter and _ofind (besides being far safer than before).
4389
4403
4390 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4404 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4391 obscure, never reported). Edit would fail to find the object to
4405 obscure, never reported). Edit would fail to find the object to
4392 edit under some circumstances.
4406 edit under some circumstances.
4393 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4407 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4394 which were causing double-calling of generators. Those eval calls
4408 which were causing double-calling of generators. Those eval calls
4395 were _very_ dangerous, since code with side effects could be
4409 were _very_ dangerous, since code with side effects could be
4396 triggered. As they say, 'eval is evil'... These were the
4410 triggered. As they say, 'eval is evil'... These were the
4397 nastiest evals in IPython. Besides, _ofind is now far simpler,
4411 nastiest evals in IPython. Besides, _ofind is now far simpler,
4398 and it should also be quite a bit faster. Its use of inspect is
4412 and it should also be quite a bit faster. Its use of inspect is
4399 also safer, so perhaps some of the inspect-related crashes I've
4413 also safer, so perhaps some of the inspect-related crashes I've
4400 seen lately with Python 2.3 might be taken care of. That will
4414 seen lately with Python 2.3 might be taken care of. That will
4401 need more testing.
4415 need more testing.
4402
4416
4403 2003-08-17 Fernando Perez <fperez@colorado.edu>
4417 2003-08-17 Fernando Perez <fperez@colorado.edu>
4404
4418
4405 * IPython/iplib.py (InteractiveShell._prefilter): significant
4419 * IPython/iplib.py (InteractiveShell._prefilter): significant
4406 simplifications to the logic for handling user escapes. Faster
4420 simplifications to the logic for handling user escapes. Faster
4407 and simpler code.
4421 and simpler code.
4408
4422
4409 2003-08-14 Fernando Perez <fperez@colorado.edu>
4423 2003-08-14 Fernando Perez <fperez@colorado.edu>
4410
4424
4411 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4425 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4412 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4426 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4413 but it should be quite a bit faster. And the recursive version
4427 but it should be quite a bit faster. And the recursive version
4414 generated O(log N) intermediate storage for all rank>1 arrays,
4428 generated O(log N) intermediate storage for all rank>1 arrays,
4415 even if they were contiguous.
4429 even if they were contiguous.
4416 (l1norm): Added this function.
4430 (l1norm): Added this function.
4417 (norm): Added this function for arbitrary norms (including
4431 (norm): Added this function for arbitrary norms (including
4418 l-infinity). l1 and l2 are still special cases for convenience
4432 l-infinity). l1 and l2 are still special cases for convenience
4419 and speed.
4433 and speed.
4420
4434
4421 2003-08-03 Fernando Perez <fperez@colorado.edu>
4435 2003-08-03 Fernando Perez <fperez@colorado.edu>
4422
4436
4423 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4437 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4424 exceptions, which now raise PendingDeprecationWarnings in Python
4438 exceptions, which now raise PendingDeprecationWarnings in Python
4425 2.3. There were some in Magic and some in Gnuplot2.
4439 2.3. There were some in Magic and some in Gnuplot2.
4426
4440
4427 2003-06-30 Fernando Perez <fperez@colorado.edu>
4441 2003-06-30 Fernando Perez <fperez@colorado.edu>
4428
4442
4429 * IPython/genutils.py (page): modified to call curses only for
4443 * IPython/genutils.py (page): modified to call curses only for
4430 terminals where TERM=='xterm'. After problems under many other
4444 terminals where TERM=='xterm'. After problems under many other
4431 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4445 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4432
4446
4433 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4447 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4434 would be triggered when readline was absent. This was just an old
4448 would be triggered when readline was absent. This was just an old
4435 debugging statement I'd forgotten to take out.
4449 debugging statement I'd forgotten to take out.
4436
4450
4437 2003-06-20 Fernando Perez <fperez@colorado.edu>
4451 2003-06-20 Fernando Perez <fperez@colorado.edu>
4438
4452
4439 * IPython/genutils.py (clock): modified to return only user time
4453 * IPython/genutils.py (clock): modified to return only user time
4440 (not counting system time), after a discussion on scipy. While
4454 (not counting system time), after a discussion on scipy. While
4441 system time may be a useful quantity occasionally, it may much
4455 system time may be a useful quantity occasionally, it may much
4442 more easily be skewed by occasional swapping or other similar
4456 more easily be skewed by occasional swapping or other similar
4443 activity.
4457 activity.
4444
4458
4445 2003-06-05 Fernando Perez <fperez@colorado.edu>
4459 2003-06-05 Fernando Perez <fperez@colorado.edu>
4446
4460
4447 * IPython/numutils.py (identity): new function, for building
4461 * IPython/numutils.py (identity): new function, for building
4448 arbitrary rank Kronecker deltas (mostly backwards compatible with
4462 arbitrary rank Kronecker deltas (mostly backwards compatible with
4449 Numeric.identity)
4463 Numeric.identity)
4450
4464
4451 2003-06-03 Fernando Perez <fperez@colorado.edu>
4465 2003-06-03 Fernando Perez <fperez@colorado.edu>
4452
4466
4453 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4467 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4454 arguments passed to magics with spaces, to allow trailing '\' to
4468 arguments passed to magics with spaces, to allow trailing '\' to
4455 work normally (mainly for Windows users).
4469 work normally (mainly for Windows users).
4456
4470
4457 2003-05-29 Fernando Perez <fperez@colorado.edu>
4471 2003-05-29 Fernando Perez <fperez@colorado.edu>
4458
4472
4459 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4473 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4460 instead of pydoc.help. This fixes a bizarre behavior where
4474 instead of pydoc.help. This fixes a bizarre behavior where
4461 printing '%s' % locals() would trigger the help system. Now
4475 printing '%s' % locals() would trigger the help system. Now
4462 ipython behaves like normal python does.
4476 ipython behaves like normal python does.
4463
4477
4464 Note that if one does 'from pydoc import help', the bizarre
4478 Note that if one does 'from pydoc import help', the bizarre
4465 behavior returns, but this will also happen in normal python, so
4479 behavior returns, but this will also happen in normal python, so
4466 it's not an ipython bug anymore (it has to do with how pydoc.help
4480 it's not an ipython bug anymore (it has to do with how pydoc.help
4467 is implemented).
4481 is implemented).
4468
4482
4469 2003-05-22 Fernando Perez <fperez@colorado.edu>
4483 2003-05-22 Fernando Perez <fperez@colorado.edu>
4470
4484
4471 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4485 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4472 return [] instead of None when nothing matches, also match to end
4486 return [] instead of None when nothing matches, also match to end
4473 of line. Patch by Gary Bishop.
4487 of line. Patch by Gary Bishop.
4474
4488
4475 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4489 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4476 protection as before, for files passed on the command line. This
4490 protection as before, for files passed on the command line. This
4477 prevents the CrashHandler from kicking in if user files call into
4491 prevents the CrashHandler from kicking in if user files call into
4478 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4492 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4479 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4493 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4480
4494
4481 2003-05-20 *** Released version 0.4.0
4495 2003-05-20 *** Released version 0.4.0
4482
4496
4483 2003-05-20 Fernando Perez <fperez@colorado.edu>
4497 2003-05-20 Fernando Perez <fperez@colorado.edu>
4484
4498
4485 * setup.py: added support for manpages. It's a bit hackish b/c of
4499 * setup.py: added support for manpages. It's a bit hackish b/c of
4486 a bug in the way the bdist_rpm distutils target handles gzipped
4500 a bug in the way the bdist_rpm distutils target handles gzipped
4487 manpages, but it works. After a patch by Jack.
4501 manpages, but it works. After a patch by Jack.
4488
4502
4489 2003-05-19 Fernando Perez <fperez@colorado.edu>
4503 2003-05-19 Fernando Perez <fperez@colorado.edu>
4490
4504
4491 * IPython/numutils.py: added a mockup of the kinds module, since
4505 * IPython/numutils.py: added a mockup of the kinds module, since
4492 it was recently removed from Numeric. This way, numutils will
4506 it was recently removed from Numeric. This way, numutils will
4493 work for all users even if they are missing kinds.
4507 work for all users even if they are missing kinds.
4494
4508
4495 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4509 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4496 failure, which can occur with SWIG-wrapped extensions. After a
4510 failure, which can occur with SWIG-wrapped extensions. After a
4497 crash report from Prabhu.
4511 crash report from Prabhu.
4498
4512
4499 2003-05-16 Fernando Perez <fperez@colorado.edu>
4513 2003-05-16 Fernando Perez <fperez@colorado.edu>
4500
4514
4501 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4515 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4502 protect ipython from user code which may call directly
4516 protect ipython from user code which may call directly
4503 sys.excepthook (this looks like an ipython crash to the user, even
4517 sys.excepthook (this looks like an ipython crash to the user, even
4504 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4518 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4505 This is especially important to help users of WxWindows, but may
4519 This is especially important to help users of WxWindows, but may
4506 also be useful in other cases.
4520 also be useful in other cases.
4507
4521
4508 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4522 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4509 an optional tb_offset to be specified, and to preserve exception
4523 an optional tb_offset to be specified, and to preserve exception
4510 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4524 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4511
4525
4512 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4526 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4513
4527
4514 2003-05-15 Fernando Perez <fperez@colorado.edu>
4528 2003-05-15 Fernando Perez <fperez@colorado.edu>
4515
4529
4516 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4530 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4517 installing for a new user under Windows.
4531 installing for a new user under Windows.
4518
4532
4519 2003-05-12 Fernando Perez <fperez@colorado.edu>
4533 2003-05-12 Fernando Perez <fperez@colorado.edu>
4520
4534
4521 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4535 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4522 handler for Emacs comint-based lines. Currently it doesn't do
4536 handler for Emacs comint-based lines. Currently it doesn't do
4523 much (but importantly, it doesn't update the history cache). In
4537 much (but importantly, it doesn't update the history cache). In
4524 the future it may be expanded if Alex needs more functionality
4538 the future it may be expanded if Alex needs more functionality
4525 there.
4539 there.
4526
4540
4527 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4541 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4528 info to crash reports.
4542 info to crash reports.
4529
4543
4530 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4544 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4531 just like Python's -c. Also fixed crash with invalid -color
4545 just like Python's -c. Also fixed crash with invalid -color
4532 option value at startup. Thanks to Will French
4546 option value at startup. Thanks to Will French
4533 <wfrench-AT-bestweb.net> for the bug report.
4547 <wfrench-AT-bestweb.net> for the bug report.
4534
4548
4535 2003-05-09 Fernando Perez <fperez@colorado.edu>
4549 2003-05-09 Fernando Perez <fperez@colorado.edu>
4536
4550
4537 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4551 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4538 to EvalDict (it's a mapping, after all) and simplified its code
4552 to EvalDict (it's a mapping, after all) and simplified its code
4539 quite a bit, after a nice discussion on c.l.py where Gustavo
4553 quite a bit, after a nice discussion on c.l.py where Gustavo
4540 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4554 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4541
4555
4542 2003-04-30 Fernando Perez <fperez@colorado.edu>
4556 2003-04-30 Fernando Perez <fperez@colorado.edu>
4543
4557
4544 * IPython/genutils.py (timings_out): modified it to reduce its
4558 * IPython/genutils.py (timings_out): modified it to reduce its
4545 overhead in the common reps==1 case.
4559 overhead in the common reps==1 case.
4546
4560
4547 2003-04-29 Fernando Perez <fperez@colorado.edu>
4561 2003-04-29 Fernando Perez <fperez@colorado.edu>
4548
4562
4549 * IPython/genutils.py (timings_out): Modified to use the resource
4563 * IPython/genutils.py (timings_out): Modified to use the resource
4550 module, which avoids the wraparound problems of time.clock().
4564 module, which avoids the wraparound problems of time.clock().
4551
4565
4552 2003-04-17 *** Released version 0.2.15pre4
4566 2003-04-17 *** Released version 0.2.15pre4
4553
4567
4554 2003-04-17 Fernando Perez <fperez@colorado.edu>
4568 2003-04-17 Fernando Perez <fperez@colorado.edu>
4555
4569
4556 * setup.py (scriptfiles): Split windows-specific stuff over to a
4570 * setup.py (scriptfiles): Split windows-specific stuff over to a
4557 separate file, in an attempt to have a Windows GUI installer.
4571 separate file, in an attempt to have a Windows GUI installer.
4558 That didn't work, but part of the groundwork is done.
4572 That didn't work, but part of the groundwork is done.
4559
4573
4560 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4574 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4561 indent/unindent with 4 spaces. Particularly useful in combination
4575 indent/unindent with 4 spaces. Particularly useful in combination
4562 with the new auto-indent option.
4576 with the new auto-indent option.
4563
4577
4564 2003-04-16 Fernando Perez <fperez@colorado.edu>
4578 2003-04-16 Fernando Perez <fperez@colorado.edu>
4565
4579
4566 * IPython/Magic.py: various replacements of self.rc for
4580 * IPython/Magic.py: various replacements of self.rc for
4567 self.shell.rc. A lot more remains to be done to fully disentangle
4581 self.shell.rc. A lot more remains to be done to fully disentangle
4568 this class from the main Shell class.
4582 this class from the main Shell class.
4569
4583
4570 * IPython/GnuplotRuntime.py: added checks for mouse support so
4584 * IPython/GnuplotRuntime.py: added checks for mouse support so
4571 that we don't try to enable it if the current gnuplot doesn't
4585 that we don't try to enable it if the current gnuplot doesn't
4572 really support it. Also added checks so that we don't try to
4586 really support it. Also added checks so that we don't try to
4573 enable persist under Windows (where Gnuplot doesn't recognize the
4587 enable persist under Windows (where Gnuplot doesn't recognize the
4574 option).
4588 option).
4575
4589
4576 * IPython/iplib.py (InteractiveShell.interact): Added optional
4590 * IPython/iplib.py (InteractiveShell.interact): Added optional
4577 auto-indenting code, after a patch by King C. Shu
4591 auto-indenting code, after a patch by King C. Shu
4578 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4592 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4579 get along well with pasting indented code. If I ever figure out
4593 get along well with pasting indented code. If I ever figure out
4580 how to make that part go well, it will become on by default.
4594 how to make that part go well, it will become on by default.
4581
4595
4582 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4596 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4583 crash ipython if there was an unmatched '%' in the user's prompt
4597 crash ipython if there was an unmatched '%' in the user's prompt
4584 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4598 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4585
4599
4586 * IPython/iplib.py (InteractiveShell.interact): removed the
4600 * IPython/iplib.py (InteractiveShell.interact): removed the
4587 ability to ask the user whether he wants to crash or not at the
4601 ability to ask the user whether he wants to crash or not at the
4588 'last line' exception handler. Calling functions at that point
4602 'last line' exception handler. Calling functions at that point
4589 changes the stack, and the error reports would have incorrect
4603 changes the stack, and the error reports would have incorrect
4590 tracebacks.
4604 tracebacks.
4591
4605
4592 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4606 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4593 pass through a peger a pretty-printed form of any object. After a
4607 pass through a peger a pretty-printed form of any object. After a
4594 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4608 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4595
4609
4596 2003-04-14 Fernando Perez <fperez@colorado.edu>
4610 2003-04-14 Fernando Perez <fperez@colorado.edu>
4597
4611
4598 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4612 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4599 all files in ~ would be modified at first install (instead of
4613 all files in ~ would be modified at first install (instead of
4600 ~/.ipython). This could be potentially disastrous, as the
4614 ~/.ipython). This could be potentially disastrous, as the
4601 modification (make line-endings native) could damage binary files.
4615 modification (make line-endings native) could damage binary files.
4602
4616
4603 2003-04-10 Fernando Perez <fperez@colorado.edu>
4617 2003-04-10 Fernando Perez <fperez@colorado.edu>
4604
4618
4605 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4619 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4606 handle only lines which are invalid python. This now means that
4620 handle only lines which are invalid python. This now means that
4607 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4621 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4608 for the bug report.
4622 for the bug report.
4609
4623
4610 2003-04-01 Fernando Perez <fperez@colorado.edu>
4624 2003-04-01 Fernando Perez <fperez@colorado.edu>
4611
4625
4612 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4626 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4613 where failing to set sys.last_traceback would crash pdb.pm().
4627 where failing to set sys.last_traceback would crash pdb.pm().
4614 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4628 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4615 report.
4629 report.
4616
4630
4617 2003-03-25 Fernando Perez <fperez@colorado.edu>
4631 2003-03-25 Fernando Perez <fperez@colorado.edu>
4618
4632
4619 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4633 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4620 before printing it (it had a lot of spurious blank lines at the
4634 before printing it (it had a lot of spurious blank lines at the
4621 end).
4635 end).
4622
4636
4623 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4637 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4624 output would be sent 21 times! Obviously people don't use this
4638 output would be sent 21 times! Obviously people don't use this
4625 too often, or I would have heard about it.
4639 too often, or I would have heard about it.
4626
4640
4627 2003-03-24 Fernando Perez <fperez@colorado.edu>
4641 2003-03-24 Fernando Perez <fperez@colorado.edu>
4628
4642
4629 * setup.py (scriptfiles): renamed the data_files parameter from
4643 * setup.py (scriptfiles): renamed the data_files parameter from
4630 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4644 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4631 for the patch.
4645 for the patch.
4632
4646
4633 2003-03-20 Fernando Perez <fperez@colorado.edu>
4647 2003-03-20 Fernando Perez <fperez@colorado.edu>
4634
4648
4635 * IPython/genutils.py (error): added error() and fatal()
4649 * IPython/genutils.py (error): added error() and fatal()
4636 functions.
4650 functions.
4637
4651
4638 2003-03-18 *** Released version 0.2.15pre3
4652 2003-03-18 *** Released version 0.2.15pre3
4639
4653
4640 2003-03-18 Fernando Perez <fperez@colorado.edu>
4654 2003-03-18 Fernando Perez <fperez@colorado.edu>
4641
4655
4642 * setupext/install_data_ext.py
4656 * setupext/install_data_ext.py
4643 (install_data_ext.initialize_options): Class contributed by Jack
4657 (install_data_ext.initialize_options): Class contributed by Jack
4644 Moffit for fixing the old distutils hack. He is sending this to
4658 Moffit for fixing the old distutils hack. He is sending this to
4645 the distutils folks so in the future we may not need it as a
4659 the distutils folks so in the future we may not need it as a
4646 private fix.
4660 private fix.
4647
4661
4648 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4662 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4649 changes for Debian packaging. See his patch for full details.
4663 changes for Debian packaging. See his patch for full details.
4650 The old distutils hack of making the ipythonrc* files carry a
4664 The old distutils hack of making the ipythonrc* files carry a
4651 bogus .py extension is gone, at last. Examples were moved to a
4665 bogus .py extension is gone, at last. Examples were moved to a
4652 separate subdir under doc/, and the separate executable scripts
4666 separate subdir under doc/, and the separate executable scripts
4653 now live in their own directory. Overall a great cleanup. The
4667 now live in their own directory. Overall a great cleanup. The
4654 manual was updated to use the new files, and setup.py has been
4668 manual was updated to use the new files, and setup.py has been
4655 fixed for this setup.
4669 fixed for this setup.
4656
4670
4657 * IPython/PyColorize.py (Parser.usage): made non-executable and
4671 * IPython/PyColorize.py (Parser.usage): made non-executable and
4658 created a pycolor wrapper around it to be included as a script.
4672 created a pycolor wrapper around it to be included as a script.
4659
4673
4660 2003-03-12 *** Released version 0.2.15pre2
4674 2003-03-12 *** Released version 0.2.15pre2
4661
4675
4662 2003-03-12 Fernando Perez <fperez@colorado.edu>
4676 2003-03-12 Fernando Perez <fperez@colorado.edu>
4663
4677
4664 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4678 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4665 long-standing problem with garbage characters in some terminals.
4679 long-standing problem with garbage characters in some terminals.
4666 The issue was really that the \001 and \002 escapes must _only_ be
4680 The issue was really that the \001 and \002 escapes must _only_ be
4667 passed to input prompts (which call readline), but _never_ to
4681 passed to input prompts (which call readline), but _never_ to
4668 normal text to be printed on screen. I changed ColorANSI to have
4682 normal text to be printed on screen. I changed ColorANSI to have
4669 two classes: TermColors and InputTermColors, each with the
4683 two classes: TermColors and InputTermColors, each with the
4670 appropriate escapes for input prompts or normal text. The code in
4684 appropriate escapes for input prompts or normal text. The code in
4671 Prompts.py got slightly more complicated, but this very old and
4685 Prompts.py got slightly more complicated, but this very old and
4672 annoying bug is finally fixed.
4686 annoying bug is finally fixed.
4673
4687
4674 All the credit for nailing down the real origin of this problem
4688 All the credit for nailing down the real origin of this problem
4675 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4689 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4676 *Many* thanks to him for spending quite a bit of effort on this.
4690 *Many* thanks to him for spending quite a bit of effort on this.
4677
4691
4678 2003-03-05 *** Released version 0.2.15pre1
4692 2003-03-05 *** Released version 0.2.15pre1
4679
4693
4680 2003-03-03 Fernando Perez <fperez@colorado.edu>
4694 2003-03-03 Fernando Perez <fperez@colorado.edu>
4681
4695
4682 * IPython/FakeModule.py: Moved the former _FakeModule to a
4696 * IPython/FakeModule.py: Moved the former _FakeModule to a
4683 separate file, because it's also needed by Magic (to fix a similar
4697 separate file, because it's also needed by Magic (to fix a similar
4684 pickle-related issue in @run).
4698 pickle-related issue in @run).
4685
4699
4686 2003-03-02 Fernando Perez <fperez@colorado.edu>
4700 2003-03-02 Fernando Perez <fperez@colorado.edu>
4687
4701
4688 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4702 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4689 the autocall option at runtime.
4703 the autocall option at runtime.
4690 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4704 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4691 across Magic.py to start separating Magic from InteractiveShell.
4705 across Magic.py to start separating Magic from InteractiveShell.
4692 (Magic._ofind): Fixed to return proper namespace for dotted
4706 (Magic._ofind): Fixed to return proper namespace for dotted
4693 names. Before, a dotted name would always return 'not currently
4707 names. Before, a dotted name would always return 'not currently
4694 defined', because it would find the 'parent'. s.x would be found,
4708 defined', because it would find the 'parent'. s.x would be found,
4695 but since 'x' isn't defined by itself, it would get confused.
4709 but since 'x' isn't defined by itself, it would get confused.
4696 (Magic.magic_run): Fixed pickling problems reported by Ralf
4710 (Magic.magic_run): Fixed pickling problems reported by Ralf
4697 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4711 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4698 that I'd used when Mike Heeter reported similar issues at the
4712 that I'd used when Mike Heeter reported similar issues at the
4699 top-level, but now for @run. It boils down to injecting the
4713 top-level, but now for @run. It boils down to injecting the
4700 namespace where code is being executed with something that looks
4714 namespace where code is being executed with something that looks
4701 enough like a module to fool pickle.dump(). Since a pickle stores
4715 enough like a module to fool pickle.dump(). Since a pickle stores
4702 a named reference to the importing module, we need this for
4716 a named reference to the importing module, we need this for
4703 pickles to save something sensible.
4717 pickles to save something sensible.
4704
4718
4705 * IPython/ipmaker.py (make_IPython): added an autocall option.
4719 * IPython/ipmaker.py (make_IPython): added an autocall option.
4706
4720
4707 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4721 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4708 the auto-eval code. Now autocalling is an option, and the code is
4722 the auto-eval code. Now autocalling is an option, and the code is
4709 also vastly safer. There is no more eval() involved at all.
4723 also vastly safer. There is no more eval() involved at all.
4710
4724
4711 2003-03-01 Fernando Perez <fperez@colorado.edu>
4725 2003-03-01 Fernando Perez <fperez@colorado.edu>
4712
4726
4713 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4727 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4714 dict with named keys instead of a tuple.
4728 dict with named keys instead of a tuple.
4715
4729
4716 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4730 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4717
4731
4718 * setup.py (make_shortcut): Fixed message about directories
4732 * setup.py (make_shortcut): Fixed message about directories
4719 created during Windows installation (the directories were ok, just
4733 created during Windows installation (the directories were ok, just
4720 the printed message was misleading). Thanks to Chris Liechti
4734 the printed message was misleading). Thanks to Chris Liechti
4721 <cliechti-AT-gmx.net> for the heads up.
4735 <cliechti-AT-gmx.net> for the heads up.
4722
4736
4723 2003-02-21 Fernando Perez <fperez@colorado.edu>
4737 2003-02-21 Fernando Perez <fperez@colorado.edu>
4724
4738
4725 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4739 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4726 of ValueError exception when checking for auto-execution. This
4740 of ValueError exception when checking for auto-execution. This
4727 one is raised by things like Numeric arrays arr.flat when the
4741 one is raised by things like Numeric arrays arr.flat when the
4728 array is non-contiguous.
4742 array is non-contiguous.
4729
4743
4730 2003-01-31 Fernando Perez <fperez@colorado.edu>
4744 2003-01-31 Fernando Perez <fperez@colorado.edu>
4731
4745
4732 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4746 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4733 not return any value at all (even though the command would get
4747 not return any value at all (even though the command would get
4734 executed).
4748 executed).
4735 (xsys): Flush stdout right after printing the command to ensure
4749 (xsys): Flush stdout right after printing the command to ensure
4736 proper ordering of commands and command output in the total
4750 proper ordering of commands and command output in the total
4737 output.
4751 output.
4738 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4752 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4739 system/getoutput as defaults. The old ones are kept for
4753 system/getoutput as defaults. The old ones are kept for
4740 compatibility reasons, so no code which uses this library needs
4754 compatibility reasons, so no code which uses this library needs
4741 changing.
4755 changing.
4742
4756
4743 2003-01-27 *** Released version 0.2.14
4757 2003-01-27 *** Released version 0.2.14
4744
4758
4745 2003-01-25 Fernando Perez <fperez@colorado.edu>
4759 2003-01-25 Fernando Perez <fperez@colorado.edu>
4746
4760
4747 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4761 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4748 functions defined in previous edit sessions could not be re-edited
4762 functions defined in previous edit sessions could not be re-edited
4749 (because the temp files were immediately removed). Now temp files
4763 (because the temp files were immediately removed). Now temp files
4750 are removed only at IPython's exit.
4764 are removed only at IPython's exit.
4751 (Magic.magic_run): Improved @run to perform shell-like expansions
4765 (Magic.magic_run): Improved @run to perform shell-like expansions
4752 on its arguments (~users and $VARS). With this, @run becomes more
4766 on its arguments (~users and $VARS). With this, @run becomes more
4753 like a normal command-line.
4767 like a normal command-line.
4754
4768
4755 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4769 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4756 bugs related to embedding and cleaned up that code. A fairly
4770 bugs related to embedding and cleaned up that code. A fairly
4757 important one was the impossibility to access the global namespace
4771 important one was the impossibility to access the global namespace
4758 through the embedded IPython (only local variables were visible).
4772 through the embedded IPython (only local variables were visible).
4759
4773
4760 2003-01-14 Fernando Perez <fperez@colorado.edu>
4774 2003-01-14 Fernando Perez <fperez@colorado.edu>
4761
4775
4762 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4776 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4763 auto-calling to be a bit more conservative. Now it doesn't get
4777 auto-calling to be a bit more conservative. Now it doesn't get
4764 triggered if any of '!=()<>' are in the rest of the input line, to
4778 triggered if any of '!=()<>' are in the rest of the input line, to
4765 allow comparing callables. Thanks to Alex for the heads up.
4779 allow comparing callables. Thanks to Alex for the heads up.
4766
4780
4767 2003-01-07 Fernando Perez <fperez@colorado.edu>
4781 2003-01-07 Fernando Perez <fperez@colorado.edu>
4768
4782
4769 * IPython/genutils.py (page): fixed estimation of the number of
4783 * IPython/genutils.py (page): fixed estimation of the number of
4770 lines in a string to be paged to simply count newlines. This
4784 lines in a string to be paged to simply count newlines. This
4771 prevents over-guessing due to embedded escape sequences. A better
4785 prevents over-guessing due to embedded escape sequences. A better
4772 long-term solution would involve stripping out the control chars
4786 long-term solution would involve stripping out the control chars
4773 for the count, but it's potentially so expensive I just don't
4787 for the count, but it's potentially so expensive I just don't
4774 think it's worth doing.
4788 think it's worth doing.
4775
4789
4776 2002-12-19 *** Released version 0.2.14pre50
4790 2002-12-19 *** Released version 0.2.14pre50
4777
4791
4778 2002-12-19 Fernando Perez <fperez@colorado.edu>
4792 2002-12-19 Fernando Perez <fperez@colorado.edu>
4779
4793
4780 * tools/release (version): Changed release scripts to inform
4794 * tools/release (version): Changed release scripts to inform
4781 Andrea and build a NEWS file with a list of recent changes.
4795 Andrea and build a NEWS file with a list of recent changes.
4782
4796
4783 * IPython/ColorANSI.py (__all__): changed terminal detection
4797 * IPython/ColorANSI.py (__all__): changed terminal detection
4784 code. Seems to work better for xterms without breaking
4798 code. Seems to work better for xterms without breaking
4785 konsole. Will need more testing to determine if WinXP and Mac OSX
4799 konsole. Will need more testing to determine if WinXP and Mac OSX
4786 also work ok.
4800 also work ok.
4787
4801
4788 2002-12-18 *** Released version 0.2.14pre49
4802 2002-12-18 *** Released version 0.2.14pre49
4789
4803
4790 2002-12-18 Fernando Perez <fperez@colorado.edu>
4804 2002-12-18 Fernando Perez <fperez@colorado.edu>
4791
4805
4792 * Docs: added new info about Mac OSX, from Andrea.
4806 * Docs: added new info about Mac OSX, from Andrea.
4793
4807
4794 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4808 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4795 allow direct plotting of python strings whose format is the same
4809 allow direct plotting of python strings whose format is the same
4796 of gnuplot data files.
4810 of gnuplot data files.
4797
4811
4798 2002-12-16 Fernando Perez <fperez@colorado.edu>
4812 2002-12-16 Fernando Perez <fperez@colorado.edu>
4799
4813
4800 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4814 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4801 value of exit question to be acknowledged.
4815 value of exit question to be acknowledged.
4802
4816
4803 2002-12-03 Fernando Perez <fperez@colorado.edu>
4817 2002-12-03 Fernando Perez <fperez@colorado.edu>
4804
4818
4805 * IPython/ipmaker.py: removed generators, which had been added
4819 * IPython/ipmaker.py: removed generators, which had been added
4806 by mistake in an earlier debugging run. This was causing trouble
4820 by mistake in an earlier debugging run. This was causing trouble
4807 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4821 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4808 for pointing this out.
4822 for pointing this out.
4809
4823
4810 2002-11-17 Fernando Perez <fperez@colorado.edu>
4824 2002-11-17 Fernando Perez <fperez@colorado.edu>
4811
4825
4812 * Manual: updated the Gnuplot section.
4826 * Manual: updated the Gnuplot section.
4813
4827
4814 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4828 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4815 a much better split of what goes in Runtime and what goes in
4829 a much better split of what goes in Runtime and what goes in
4816 Interactive.
4830 Interactive.
4817
4831
4818 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4832 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4819 being imported from iplib.
4833 being imported from iplib.
4820
4834
4821 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4835 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4822 for command-passing. Now the global Gnuplot instance is called
4836 for command-passing. Now the global Gnuplot instance is called
4823 'gp' instead of 'g', which was really a far too fragile and
4837 'gp' instead of 'g', which was really a far too fragile and
4824 common name.
4838 common name.
4825
4839
4826 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4840 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4827 bounding boxes generated by Gnuplot for square plots.
4841 bounding boxes generated by Gnuplot for square plots.
4828
4842
4829 * IPython/genutils.py (popkey): new function added. I should
4843 * IPython/genutils.py (popkey): new function added. I should
4830 suggest this on c.l.py as a dict method, it seems useful.
4844 suggest this on c.l.py as a dict method, it seems useful.
4831
4845
4832 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4846 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4833 to transparently handle PostScript generation. MUCH better than
4847 to transparently handle PostScript generation. MUCH better than
4834 the previous plot_eps/replot_eps (which I removed now). The code
4848 the previous plot_eps/replot_eps (which I removed now). The code
4835 is also fairly clean and well documented now (including
4849 is also fairly clean and well documented now (including
4836 docstrings).
4850 docstrings).
4837
4851
4838 2002-11-13 Fernando Perez <fperez@colorado.edu>
4852 2002-11-13 Fernando Perez <fperez@colorado.edu>
4839
4853
4840 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4854 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4841 (inconsistent with options).
4855 (inconsistent with options).
4842
4856
4843 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4857 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4844 manually disabled, I don't know why. Fixed it.
4858 manually disabled, I don't know why. Fixed it.
4845 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4859 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4846 eps output.
4860 eps output.
4847
4861
4848 2002-11-12 Fernando Perez <fperez@colorado.edu>
4862 2002-11-12 Fernando Perez <fperez@colorado.edu>
4849
4863
4850 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4864 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4851 don't propagate up to caller. Fixes crash reported by François
4865 don't propagate up to caller. Fixes crash reported by François
4852 Pinard.
4866 Pinard.
4853
4867
4854 2002-11-09 Fernando Perez <fperez@colorado.edu>
4868 2002-11-09 Fernando Perez <fperez@colorado.edu>
4855
4869
4856 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4870 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4857 history file for new users.
4871 history file for new users.
4858 (make_IPython): fixed bug where initial install would leave the
4872 (make_IPython): fixed bug where initial install would leave the
4859 user running in the .ipython dir.
4873 user running in the .ipython dir.
4860 (make_IPython): fixed bug where config dir .ipython would be
4874 (make_IPython): fixed bug where config dir .ipython would be
4861 created regardless of the given -ipythondir option. Thanks to Cory
4875 created regardless of the given -ipythondir option. Thanks to Cory
4862 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4876 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4863
4877
4864 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4878 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4865 type confirmations. Will need to use it in all of IPython's code
4879 type confirmations. Will need to use it in all of IPython's code
4866 consistently.
4880 consistently.
4867
4881
4868 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4882 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4869 context to print 31 lines instead of the default 5. This will make
4883 context to print 31 lines instead of the default 5. This will make
4870 the crash reports extremely detailed in case the problem is in
4884 the crash reports extremely detailed in case the problem is in
4871 libraries I don't have access to.
4885 libraries I don't have access to.
4872
4886
4873 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4887 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4874 line of defense' code to still crash, but giving users fair
4888 line of defense' code to still crash, but giving users fair
4875 warning. I don't want internal errors to go unreported: if there's
4889 warning. I don't want internal errors to go unreported: if there's
4876 an internal problem, IPython should crash and generate a full
4890 an internal problem, IPython should crash and generate a full
4877 report.
4891 report.
4878
4892
4879 2002-11-08 Fernando Perez <fperez@colorado.edu>
4893 2002-11-08 Fernando Perez <fperez@colorado.edu>
4880
4894
4881 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4895 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4882 otherwise uncaught exceptions which can appear if people set
4896 otherwise uncaught exceptions which can appear if people set
4883 sys.stdout to something badly broken. Thanks to a crash report
4897 sys.stdout to something badly broken. Thanks to a crash report
4884 from henni-AT-mail.brainbot.com.
4898 from henni-AT-mail.brainbot.com.
4885
4899
4886 2002-11-04 Fernando Perez <fperez@colorado.edu>
4900 2002-11-04 Fernando Perez <fperez@colorado.edu>
4887
4901
4888 * IPython/iplib.py (InteractiveShell.interact): added
4902 * IPython/iplib.py (InteractiveShell.interact): added
4889 __IPYTHON__active to the builtins. It's a flag which goes on when
4903 __IPYTHON__active to the builtins. It's a flag which goes on when
4890 the interaction starts and goes off again when it stops. This
4904 the interaction starts and goes off again when it stops. This
4891 allows embedding code to detect being inside IPython. Before this
4905 allows embedding code to detect being inside IPython. Before this
4892 was done via __IPYTHON__, but that only shows that an IPython
4906 was done via __IPYTHON__, but that only shows that an IPython
4893 instance has been created.
4907 instance has been created.
4894
4908
4895 * IPython/Magic.py (Magic.magic_env): I realized that in a
4909 * IPython/Magic.py (Magic.magic_env): I realized that in a
4896 UserDict, instance.data holds the data as a normal dict. So I
4910 UserDict, instance.data holds the data as a normal dict. So I
4897 modified @env to return os.environ.data instead of rebuilding a
4911 modified @env to return os.environ.data instead of rebuilding a
4898 dict by hand.
4912 dict by hand.
4899
4913
4900 2002-11-02 Fernando Perez <fperez@colorado.edu>
4914 2002-11-02 Fernando Perez <fperez@colorado.edu>
4901
4915
4902 * IPython/genutils.py (warn): changed so that level 1 prints no
4916 * IPython/genutils.py (warn): changed so that level 1 prints no
4903 header. Level 2 is now the default (with 'WARNING' header, as
4917 header. Level 2 is now the default (with 'WARNING' header, as
4904 before). I think I tracked all places where changes were needed in
4918 before). I think I tracked all places where changes were needed in
4905 IPython, but outside code using the old level numbering may have
4919 IPython, but outside code using the old level numbering may have
4906 broken.
4920 broken.
4907
4921
4908 * IPython/iplib.py (InteractiveShell.runcode): added this to
4922 * IPython/iplib.py (InteractiveShell.runcode): added this to
4909 handle the tracebacks in SystemExit traps correctly. The previous
4923 handle the tracebacks in SystemExit traps correctly. The previous
4910 code (through interact) was printing more of the stack than
4924 code (through interact) was printing more of the stack than
4911 necessary, showing IPython internal code to the user.
4925 necessary, showing IPython internal code to the user.
4912
4926
4913 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4927 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4914 default. Now that the default at the confirmation prompt is yes,
4928 default. Now that the default at the confirmation prompt is yes,
4915 it's not so intrusive. François' argument that ipython sessions
4929 it's not so intrusive. François' argument that ipython sessions
4916 tend to be complex enough not to lose them from an accidental C-d,
4930 tend to be complex enough not to lose them from an accidental C-d,
4917 is a valid one.
4931 is a valid one.
4918
4932
4919 * IPython/iplib.py (InteractiveShell.interact): added a
4933 * IPython/iplib.py (InteractiveShell.interact): added a
4920 showtraceback() call to the SystemExit trap, and modified the exit
4934 showtraceback() call to the SystemExit trap, and modified the exit
4921 confirmation to have yes as the default.
4935 confirmation to have yes as the default.
4922
4936
4923 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4937 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4924 this file. It's been gone from the code for a long time, this was
4938 this file. It's been gone from the code for a long time, this was
4925 simply leftover junk.
4939 simply leftover junk.
4926
4940
4927 2002-11-01 Fernando Perez <fperez@colorado.edu>
4941 2002-11-01 Fernando Perez <fperez@colorado.edu>
4928
4942
4929 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4943 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4930 added. If set, IPython now traps EOF and asks for
4944 added. If set, IPython now traps EOF and asks for
4931 confirmation. After a request by François Pinard.
4945 confirmation. After a request by François Pinard.
4932
4946
4933 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4947 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4934 of @abort, and with a new (better) mechanism for handling the
4948 of @abort, and with a new (better) mechanism for handling the
4935 exceptions.
4949 exceptions.
4936
4950
4937 2002-10-27 Fernando Perez <fperez@colorado.edu>
4951 2002-10-27 Fernando Perez <fperez@colorado.edu>
4938
4952
4939 * IPython/usage.py (__doc__): updated the --help information and
4953 * IPython/usage.py (__doc__): updated the --help information and
4940 the ipythonrc file to indicate that -log generates
4954 the ipythonrc file to indicate that -log generates
4941 ./ipython.log. Also fixed the corresponding info in @logstart.
4955 ./ipython.log. Also fixed the corresponding info in @logstart.
4942 This and several other fixes in the manuals thanks to reports by
4956 This and several other fixes in the manuals thanks to reports by
4943 François Pinard <pinard-AT-iro.umontreal.ca>.
4957 François Pinard <pinard-AT-iro.umontreal.ca>.
4944
4958
4945 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4959 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4946 refer to @logstart (instead of @log, which doesn't exist).
4960 refer to @logstart (instead of @log, which doesn't exist).
4947
4961
4948 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4962 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4949 AttributeError crash. Thanks to Christopher Armstrong
4963 AttributeError crash. Thanks to Christopher Armstrong
4950 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4964 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4951 introduced recently (in 0.2.14pre37) with the fix to the eval
4965 introduced recently (in 0.2.14pre37) with the fix to the eval
4952 problem mentioned below.
4966 problem mentioned below.
4953
4967
4954 2002-10-17 Fernando Perez <fperez@colorado.edu>
4968 2002-10-17 Fernando Perez <fperez@colorado.edu>
4955
4969
4956 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4970 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4957 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4971 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4958
4972
4959 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4973 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4960 this function to fix a problem reported by Alex Schmolck. He saw
4974 this function to fix a problem reported by Alex Schmolck. He saw
4961 it with list comprehensions and generators, which were getting
4975 it with list comprehensions and generators, which were getting
4962 called twice. The real problem was an 'eval' call in testing for
4976 called twice. The real problem was an 'eval' call in testing for
4963 automagic which was evaluating the input line silently.
4977 automagic which was evaluating the input line silently.
4964
4978
4965 This is a potentially very nasty bug, if the input has side
4979 This is a potentially very nasty bug, if the input has side
4966 effects which must not be repeated. The code is much cleaner now,
4980 effects which must not be repeated. The code is much cleaner now,
4967 without any blanket 'except' left and with a regexp test for
4981 without any blanket 'except' left and with a regexp test for
4968 actual function names.
4982 actual function names.
4969
4983
4970 But an eval remains, which I'm not fully comfortable with. I just
4984 But an eval remains, which I'm not fully comfortable with. I just
4971 don't know how to find out if an expression could be a callable in
4985 don't know how to find out if an expression could be a callable in
4972 the user's namespace without doing an eval on the string. However
4986 the user's namespace without doing an eval on the string. However
4973 that string is now much more strictly checked so that no code
4987 that string is now much more strictly checked so that no code
4974 slips by, so the eval should only happen for things that can
4988 slips by, so the eval should only happen for things that can
4975 really be only function/method names.
4989 really be only function/method names.
4976
4990
4977 2002-10-15 Fernando Perez <fperez@colorado.edu>
4991 2002-10-15 Fernando Perez <fperez@colorado.edu>
4978
4992
4979 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4993 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4980 OSX information to main manual, removed README_Mac_OSX file from
4994 OSX information to main manual, removed README_Mac_OSX file from
4981 distribution. Also updated credits for recent additions.
4995 distribution. Also updated credits for recent additions.
4982
4996
4983 2002-10-10 Fernando Perez <fperez@colorado.edu>
4997 2002-10-10 Fernando Perez <fperez@colorado.edu>
4984
4998
4985 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4999 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4986 terminal-related issues. Many thanks to Andrea Riciputi
5000 terminal-related issues. Many thanks to Andrea Riciputi
4987 <andrea.riciputi-AT-libero.it> for writing it.
5001 <andrea.riciputi-AT-libero.it> for writing it.
4988
5002
4989 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5003 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4990 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5004 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4991
5005
4992 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5006 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4993 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5007 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4994 <syver-en-AT-online.no> who both submitted patches for this problem.
5008 <syver-en-AT-online.no> who both submitted patches for this problem.
4995
5009
4996 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5010 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4997 global embedding to make sure that things don't overwrite user
5011 global embedding to make sure that things don't overwrite user
4998 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5012 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4999
5013
5000 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5014 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5001 compatibility. Thanks to Hayden Callow
5015 compatibility. Thanks to Hayden Callow
5002 <h.callow-AT-elec.canterbury.ac.nz>
5016 <h.callow-AT-elec.canterbury.ac.nz>
5003
5017
5004 2002-10-04 Fernando Perez <fperez@colorado.edu>
5018 2002-10-04 Fernando Perez <fperez@colorado.edu>
5005
5019
5006 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5020 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5007 Gnuplot.File objects.
5021 Gnuplot.File objects.
5008
5022
5009 2002-07-23 Fernando Perez <fperez@colorado.edu>
5023 2002-07-23 Fernando Perez <fperez@colorado.edu>
5010
5024
5011 * IPython/genutils.py (timing): Added timings() and timing() for
5025 * IPython/genutils.py (timing): Added timings() and timing() for
5012 quick access to the most commonly needed data, the execution
5026 quick access to the most commonly needed data, the execution
5013 times. Old timing() renamed to timings_out().
5027 times. Old timing() renamed to timings_out().
5014
5028
5015 2002-07-18 Fernando Perez <fperez@colorado.edu>
5029 2002-07-18 Fernando Perez <fperez@colorado.edu>
5016
5030
5017 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5031 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5018 bug with nested instances disrupting the parent's tab completion.
5032 bug with nested instances disrupting the parent's tab completion.
5019
5033
5020 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5034 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5021 all_completions code to begin the emacs integration.
5035 all_completions code to begin the emacs integration.
5022
5036
5023 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5037 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5024 argument to allow titling individual arrays when plotting.
5038 argument to allow titling individual arrays when plotting.
5025
5039
5026 2002-07-15 Fernando Perez <fperez@colorado.edu>
5040 2002-07-15 Fernando Perez <fperez@colorado.edu>
5027
5041
5028 * setup.py (make_shortcut): changed to retrieve the value of
5042 * setup.py (make_shortcut): changed to retrieve the value of
5029 'Program Files' directory from the registry (this value changes in
5043 'Program Files' directory from the registry (this value changes in
5030 non-english versions of Windows). Thanks to Thomas Fanslau
5044 non-english versions of Windows). Thanks to Thomas Fanslau
5031 <tfanslau-AT-gmx.de> for the report.
5045 <tfanslau-AT-gmx.de> for the report.
5032
5046
5033 2002-07-10 Fernando Perez <fperez@colorado.edu>
5047 2002-07-10 Fernando Perez <fperez@colorado.edu>
5034
5048
5035 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5049 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5036 a bug in pdb, which crashes if a line with only whitespace is
5050 a bug in pdb, which crashes if a line with only whitespace is
5037 entered. Bug report submitted to sourceforge.
5051 entered. Bug report submitted to sourceforge.
5038
5052
5039 2002-07-09 Fernando Perez <fperez@colorado.edu>
5053 2002-07-09 Fernando Perez <fperez@colorado.edu>
5040
5054
5041 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5055 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5042 reporting exceptions (it's a bug in inspect.py, I just set a
5056 reporting exceptions (it's a bug in inspect.py, I just set a
5043 workaround).
5057 workaround).
5044
5058
5045 2002-07-08 Fernando Perez <fperez@colorado.edu>
5059 2002-07-08 Fernando Perez <fperez@colorado.edu>
5046
5060
5047 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5061 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5048 __IPYTHON__ in __builtins__ to show up in user_ns.
5062 __IPYTHON__ in __builtins__ to show up in user_ns.
5049
5063
5050 2002-07-03 Fernando Perez <fperez@colorado.edu>
5064 2002-07-03 Fernando Perez <fperez@colorado.edu>
5051
5065
5052 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5066 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5053 name from @gp_set_instance to @gp_set_default.
5067 name from @gp_set_instance to @gp_set_default.
5054
5068
5055 * IPython/ipmaker.py (make_IPython): default editor value set to
5069 * IPython/ipmaker.py (make_IPython): default editor value set to
5056 '0' (a string), to match the rc file. Otherwise will crash when
5070 '0' (a string), to match the rc file. Otherwise will crash when
5057 .strip() is called on it.
5071 .strip() is called on it.
5058
5072
5059
5073
5060 2002-06-28 Fernando Perez <fperez@colorado.edu>
5074 2002-06-28 Fernando Perez <fperez@colorado.edu>
5061
5075
5062 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5076 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5063 of files in current directory when a file is executed via
5077 of files in current directory when a file is executed via
5064 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5078 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5065
5079
5066 * setup.py (manfiles): fix for rpm builds, submitted by RA
5080 * setup.py (manfiles): fix for rpm builds, submitted by RA
5067 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5081 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5068
5082
5069 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5083 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5070 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5084 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5071 string!). A. Schmolck caught this one.
5085 string!). A. Schmolck caught this one.
5072
5086
5073 2002-06-27 Fernando Perez <fperez@colorado.edu>
5087 2002-06-27 Fernando Perez <fperez@colorado.edu>
5074
5088
5075 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5089 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5076 defined files at the cmd line. __name__ wasn't being set to
5090 defined files at the cmd line. __name__ wasn't being set to
5077 __main__.
5091 __main__.
5078
5092
5079 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5093 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5080 regular lists and tuples besides Numeric arrays.
5094 regular lists and tuples besides Numeric arrays.
5081
5095
5082 * IPython/Prompts.py (CachedOutput.__call__): Added output
5096 * IPython/Prompts.py (CachedOutput.__call__): Added output
5083 supression for input ending with ';'. Similar to Mathematica and
5097 supression for input ending with ';'. Similar to Mathematica and
5084 Matlab. The _* vars and Out[] list are still updated, just like
5098 Matlab. The _* vars and Out[] list are still updated, just like
5085 Mathematica behaves.
5099 Mathematica behaves.
5086
5100
5087 2002-06-25 Fernando Perez <fperez@colorado.edu>
5101 2002-06-25 Fernando Perez <fperez@colorado.edu>
5088
5102
5089 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5103 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5090 .ini extensions for profiels under Windows.
5104 .ini extensions for profiels under Windows.
5091
5105
5092 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5106 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5093 string form. Fix contributed by Alexander Schmolck
5107 string form. Fix contributed by Alexander Schmolck
5094 <a.schmolck-AT-gmx.net>
5108 <a.schmolck-AT-gmx.net>
5095
5109
5096 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5110 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5097 pre-configured Gnuplot instance.
5111 pre-configured Gnuplot instance.
5098
5112
5099 2002-06-21 Fernando Perez <fperez@colorado.edu>
5113 2002-06-21 Fernando Perez <fperez@colorado.edu>
5100
5114
5101 * IPython/numutils.py (exp_safe): new function, works around the
5115 * IPython/numutils.py (exp_safe): new function, works around the
5102 underflow problems in Numeric.
5116 underflow problems in Numeric.
5103 (log2): New fn. Safe log in base 2: returns exact integer answer
5117 (log2): New fn. Safe log in base 2: returns exact integer answer
5104 for exact integer powers of 2.
5118 for exact integer powers of 2.
5105
5119
5106 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5120 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5107 properly.
5121 properly.
5108
5122
5109 2002-06-20 Fernando Perez <fperez@colorado.edu>
5123 2002-06-20 Fernando Perez <fperez@colorado.edu>
5110
5124
5111 * IPython/genutils.py (timing): new function like
5125 * IPython/genutils.py (timing): new function like
5112 Mathematica's. Similar to time_test, but returns more info.
5126 Mathematica's. Similar to time_test, but returns more info.
5113
5127
5114 2002-06-18 Fernando Perez <fperez@colorado.edu>
5128 2002-06-18 Fernando Perez <fperez@colorado.edu>
5115
5129
5116 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5130 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5117 according to Mike Heeter's suggestions.
5131 according to Mike Heeter's suggestions.
5118
5132
5119 2002-06-16 Fernando Perez <fperez@colorado.edu>
5133 2002-06-16 Fernando Perez <fperez@colorado.edu>
5120
5134
5121 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5135 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5122 system. GnuplotMagic is gone as a user-directory option. New files
5136 system. GnuplotMagic is gone as a user-directory option. New files
5123 make it easier to use all the gnuplot stuff both from external
5137 make it easier to use all the gnuplot stuff both from external
5124 programs as well as from IPython. Had to rewrite part of
5138 programs as well as from IPython. Had to rewrite part of
5125 hardcopy() b/c of a strange bug: often the ps files simply don't
5139 hardcopy() b/c of a strange bug: often the ps files simply don't
5126 get created, and require a repeat of the command (often several
5140 get created, and require a repeat of the command (often several
5127 times).
5141 times).
5128
5142
5129 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5143 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5130 resolve output channel at call time, so that if sys.stderr has
5144 resolve output channel at call time, so that if sys.stderr has
5131 been redirected by user this gets honored.
5145 been redirected by user this gets honored.
5132
5146
5133 2002-06-13 Fernando Perez <fperez@colorado.edu>
5147 2002-06-13 Fernando Perez <fperez@colorado.edu>
5134
5148
5135 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5149 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5136 IPShell. Kept a copy with the old names to avoid breaking people's
5150 IPShell. Kept a copy with the old names to avoid breaking people's
5137 embedded code.
5151 embedded code.
5138
5152
5139 * IPython/ipython: simplified it to the bare minimum after
5153 * IPython/ipython: simplified it to the bare minimum after
5140 Holger's suggestions. Added info about how to use it in
5154 Holger's suggestions. Added info about how to use it in
5141 PYTHONSTARTUP.
5155 PYTHONSTARTUP.
5142
5156
5143 * IPython/Shell.py (IPythonShell): changed the options passing
5157 * IPython/Shell.py (IPythonShell): changed the options passing
5144 from a string with funky %s replacements to a straight list. Maybe
5158 from a string with funky %s replacements to a straight list. Maybe
5145 a bit more typing, but it follows sys.argv conventions, so there's
5159 a bit more typing, but it follows sys.argv conventions, so there's
5146 less special-casing to remember.
5160 less special-casing to remember.
5147
5161
5148 2002-06-12 Fernando Perez <fperez@colorado.edu>
5162 2002-06-12 Fernando Perez <fperez@colorado.edu>
5149
5163
5150 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5164 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5151 command. Thanks to a suggestion by Mike Heeter.
5165 command. Thanks to a suggestion by Mike Heeter.
5152 (Magic.magic_pfile): added behavior to look at filenames if given
5166 (Magic.magic_pfile): added behavior to look at filenames if given
5153 arg is not a defined object.
5167 arg is not a defined object.
5154 (Magic.magic_save): New @save function to save code snippets. Also
5168 (Magic.magic_save): New @save function to save code snippets. Also
5155 a Mike Heeter idea.
5169 a Mike Heeter idea.
5156
5170
5157 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5171 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5158 plot() and replot(). Much more convenient now, especially for
5172 plot() and replot(). Much more convenient now, especially for
5159 interactive use.
5173 interactive use.
5160
5174
5161 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5175 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5162 filenames.
5176 filenames.
5163
5177
5164 2002-06-02 Fernando Perez <fperez@colorado.edu>
5178 2002-06-02 Fernando Perez <fperez@colorado.edu>
5165
5179
5166 * IPython/Struct.py (Struct.__init__): modified to admit
5180 * IPython/Struct.py (Struct.__init__): modified to admit
5167 initialization via another struct.
5181 initialization via another struct.
5168
5182
5169 * IPython/genutils.py (SystemExec.__init__): New stateful
5183 * IPython/genutils.py (SystemExec.__init__): New stateful
5170 interface to xsys and bq. Useful for writing system scripts.
5184 interface to xsys and bq. Useful for writing system scripts.
5171
5185
5172 2002-05-30 Fernando Perez <fperez@colorado.edu>
5186 2002-05-30 Fernando Perez <fperez@colorado.edu>
5173
5187
5174 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5188 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5175 documents. This will make the user download smaller (it's getting
5189 documents. This will make the user download smaller (it's getting
5176 too big).
5190 too big).
5177
5191
5178 2002-05-29 Fernando Perez <fperez@colorado.edu>
5192 2002-05-29 Fernando Perez <fperez@colorado.edu>
5179
5193
5180 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5194 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5181 fix problems with shelve and pickle. Seems to work, but I don't
5195 fix problems with shelve and pickle. Seems to work, but I don't
5182 know if corner cases break it. Thanks to Mike Heeter
5196 know if corner cases break it. Thanks to Mike Heeter
5183 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5197 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5184
5198
5185 2002-05-24 Fernando Perez <fperez@colorado.edu>
5199 2002-05-24 Fernando Perez <fperez@colorado.edu>
5186
5200
5187 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5201 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5188 macros having broken.
5202 macros having broken.
5189
5203
5190 2002-05-21 Fernando Perez <fperez@colorado.edu>
5204 2002-05-21 Fernando Perez <fperez@colorado.edu>
5191
5205
5192 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5206 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5193 introduced logging bug: all history before logging started was
5207 introduced logging bug: all history before logging started was
5194 being written one character per line! This came from the redesign
5208 being written one character per line! This came from the redesign
5195 of the input history as a special list which slices to strings,
5209 of the input history as a special list which slices to strings,
5196 not to lists.
5210 not to lists.
5197
5211
5198 2002-05-20 Fernando Perez <fperez@colorado.edu>
5212 2002-05-20 Fernando Perez <fperez@colorado.edu>
5199
5213
5200 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5214 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5201 be an attribute of all classes in this module. The design of these
5215 be an attribute of all classes in this module. The design of these
5202 classes needs some serious overhauling.
5216 classes needs some serious overhauling.
5203
5217
5204 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5218 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5205 which was ignoring '_' in option names.
5219 which was ignoring '_' in option names.
5206
5220
5207 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5221 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5208 'Verbose_novars' to 'Context' and made it the new default. It's a
5222 'Verbose_novars' to 'Context' and made it the new default. It's a
5209 bit more readable and also safer than verbose.
5223 bit more readable and also safer than verbose.
5210
5224
5211 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5225 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5212 triple-quoted strings.
5226 triple-quoted strings.
5213
5227
5214 * IPython/OInspect.py (__all__): new module exposing the object
5228 * IPython/OInspect.py (__all__): new module exposing the object
5215 introspection facilities. Now the corresponding magics are dummy
5229 introspection facilities. Now the corresponding magics are dummy
5216 wrappers around this. Having this module will make it much easier
5230 wrappers around this. Having this module will make it much easier
5217 to put these functions into our modified pdb.
5231 to put these functions into our modified pdb.
5218 This new object inspector system uses the new colorizing module,
5232 This new object inspector system uses the new colorizing module,
5219 so source code and other things are nicely syntax highlighted.
5233 so source code and other things are nicely syntax highlighted.
5220
5234
5221 2002-05-18 Fernando Perez <fperez@colorado.edu>
5235 2002-05-18 Fernando Perez <fperez@colorado.edu>
5222
5236
5223 * IPython/ColorANSI.py: Split the coloring tools into a separate
5237 * IPython/ColorANSI.py: Split the coloring tools into a separate
5224 module so I can use them in other code easier (they were part of
5238 module so I can use them in other code easier (they were part of
5225 ultraTB).
5239 ultraTB).
5226
5240
5227 2002-05-17 Fernando Perez <fperez@colorado.edu>
5241 2002-05-17 Fernando Perez <fperez@colorado.edu>
5228
5242
5229 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5243 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5230 fixed it to set the global 'g' also to the called instance, as
5244 fixed it to set the global 'g' also to the called instance, as
5231 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5245 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5232 user's 'g' variables).
5246 user's 'g' variables).
5233
5247
5234 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5248 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5235 global variables (aliases to _ih,_oh) so that users which expect
5249 global variables (aliases to _ih,_oh) so that users which expect
5236 In[5] or Out[7] to work aren't unpleasantly surprised.
5250 In[5] or Out[7] to work aren't unpleasantly surprised.
5237 (InputList.__getslice__): new class to allow executing slices of
5251 (InputList.__getslice__): new class to allow executing slices of
5238 input history directly. Very simple class, complements the use of
5252 input history directly. Very simple class, complements the use of
5239 macros.
5253 macros.
5240
5254
5241 2002-05-16 Fernando Perez <fperez@colorado.edu>
5255 2002-05-16 Fernando Perez <fperez@colorado.edu>
5242
5256
5243 * setup.py (docdirbase): make doc directory be just doc/IPython
5257 * setup.py (docdirbase): make doc directory be just doc/IPython
5244 without version numbers, it will reduce clutter for users.
5258 without version numbers, it will reduce clutter for users.
5245
5259
5246 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5260 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5247 execfile call to prevent possible memory leak. See for details:
5261 execfile call to prevent possible memory leak. See for details:
5248 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5262 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5249
5263
5250 2002-05-15 Fernando Perez <fperez@colorado.edu>
5264 2002-05-15 Fernando Perez <fperez@colorado.edu>
5251
5265
5252 * IPython/Magic.py (Magic.magic_psource): made the object
5266 * IPython/Magic.py (Magic.magic_psource): made the object
5253 introspection names be more standard: pdoc, pdef, pfile and
5267 introspection names be more standard: pdoc, pdef, pfile and
5254 psource. They all print/page their output, and it makes
5268 psource. They all print/page their output, and it makes
5255 remembering them easier. Kept old names for compatibility as
5269 remembering them easier. Kept old names for compatibility as
5256 aliases.
5270 aliases.
5257
5271
5258 2002-05-14 Fernando Perez <fperez@colorado.edu>
5272 2002-05-14 Fernando Perez <fperez@colorado.edu>
5259
5273
5260 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5274 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5261 what the mouse problem was. The trick is to use gnuplot with temp
5275 what the mouse problem was. The trick is to use gnuplot with temp
5262 files and NOT with pipes (for data communication), because having
5276 files and NOT with pipes (for data communication), because having
5263 both pipes and the mouse on is bad news.
5277 both pipes and the mouse on is bad news.
5264
5278
5265 2002-05-13 Fernando Perez <fperez@colorado.edu>
5279 2002-05-13 Fernando Perez <fperez@colorado.edu>
5266
5280
5267 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5281 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5268 bug. Information would be reported about builtins even when
5282 bug. Information would be reported about builtins even when
5269 user-defined functions overrode them.
5283 user-defined functions overrode them.
5270
5284
5271 2002-05-11 Fernando Perez <fperez@colorado.edu>
5285 2002-05-11 Fernando Perez <fperez@colorado.edu>
5272
5286
5273 * IPython/__init__.py (__all__): removed FlexCompleter from
5287 * IPython/__init__.py (__all__): removed FlexCompleter from
5274 __all__ so that things don't fail in platforms without readline.
5288 __all__ so that things don't fail in platforms without readline.
5275
5289
5276 2002-05-10 Fernando Perez <fperez@colorado.edu>
5290 2002-05-10 Fernando Perez <fperez@colorado.edu>
5277
5291
5278 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5292 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5279 it requires Numeric, effectively making Numeric a dependency for
5293 it requires Numeric, effectively making Numeric a dependency for
5280 IPython.
5294 IPython.
5281
5295
5282 * Released 0.2.13
5296 * Released 0.2.13
5283
5297
5284 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5298 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5285 profiler interface. Now all the major options from the profiler
5299 profiler interface. Now all the major options from the profiler
5286 module are directly supported in IPython, both for single
5300 module are directly supported in IPython, both for single
5287 expressions (@prun) and for full programs (@run -p).
5301 expressions (@prun) and for full programs (@run -p).
5288
5302
5289 2002-05-09 Fernando Perez <fperez@colorado.edu>
5303 2002-05-09 Fernando Perez <fperez@colorado.edu>
5290
5304
5291 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5305 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5292 magic properly formatted for screen.
5306 magic properly formatted for screen.
5293
5307
5294 * setup.py (make_shortcut): Changed things to put pdf version in
5308 * setup.py (make_shortcut): Changed things to put pdf version in
5295 doc/ instead of doc/manual (had to change lyxport a bit).
5309 doc/ instead of doc/manual (had to change lyxport a bit).
5296
5310
5297 * IPython/Magic.py (Profile.string_stats): made profile runs go
5311 * IPython/Magic.py (Profile.string_stats): made profile runs go
5298 through pager (they are long and a pager allows searching, saving,
5312 through pager (they are long and a pager allows searching, saving,
5299 etc.)
5313 etc.)
5300
5314
5301 2002-05-08 Fernando Perez <fperez@colorado.edu>
5315 2002-05-08 Fernando Perez <fperez@colorado.edu>
5302
5316
5303 * Released 0.2.12
5317 * Released 0.2.12
5304
5318
5305 2002-05-06 Fernando Perez <fperez@colorado.edu>
5319 2002-05-06 Fernando Perez <fperez@colorado.edu>
5306
5320
5307 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5321 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5308 introduced); 'hist n1 n2' was broken.
5322 introduced); 'hist n1 n2' was broken.
5309 (Magic.magic_pdb): added optional on/off arguments to @pdb
5323 (Magic.magic_pdb): added optional on/off arguments to @pdb
5310 (Magic.magic_run): added option -i to @run, which executes code in
5324 (Magic.magic_run): added option -i to @run, which executes code in
5311 the IPython namespace instead of a clean one. Also added @irun as
5325 the IPython namespace instead of a clean one. Also added @irun as
5312 an alias to @run -i.
5326 an alias to @run -i.
5313
5327
5314 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5328 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5315 fixed (it didn't really do anything, the namespaces were wrong).
5329 fixed (it didn't really do anything, the namespaces were wrong).
5316
5330
5317 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5331 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5318
5332
5319 * IPython/__init__.py (__all__): Fixed package namespace, now
5333 * IPython/__init__.py (__all__): Fixed package namespace, now
5320 'import IPython' does give access to IPython.<all> as
5334 'import IPython' does give access to IPython.<all> as
5321 expected. Also renamed __release__ to Release.
5335 expected. Also renamed __release__ to Release.
5322
5336
5323 * IPython/Debugger.py (__license__): created new Pdb class which
5337 * IPython/Debugger.py (__license__): created new Pdb class which
5324 functions like a drop-in for the normal pdb.Pdb but does NOT
5338 functions like a drop-in for the normal pdb.Pdb but does NOT
5325 import readline by default. This way it doesn't muck up IPython's
5339 import readline by default. This way it doesn't muck up IPython's
5326 readline handling, and now tab-completion finally works in the
5340 readline handling, and now tab-completion finally works in the
5327 debugger -- sort of. It completes things globally visible, but the
5341 debugger -- sort of. It completes things globally visible, but the
5328 completer doesn't track the stack as pdb walks it. That's a bit
5342 completer doesn't track the stack as pdb walks it. That's a bit
5329 tricky, and I'll have to implement it later.
5343 tricky, and I'll have to implement it later.
5330
5344
5331 2002-05-05 Fernando Perez <fperez@colorado.edu>
5345 2002-05-05 Fernando Perez <fperez@colorado.edu>
5332
5346
5333 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5347 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5334 magic docstrings when printed via ? (explicit \'s were being
5348 magic docstrings when printed via ? (explicit \'s were being
5335 printed).
5349 printed).
5336
5350
5337 * IPython/ipmaker.py (make_IPython): fixed namespace
5351 * IPython/ipmaker.py (make_IPython): fixed namespace
5338 identification bug. Now variables loaded via logs or command-line
5352 identification bug. Now variables loaded via logs or command-line
5339 files are recognized in the interactive namespace by @who.
5353 files are recognized in the interactive namespace by @who.
5340
5354
5341 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5355 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5342 log replay system stemming from the string form of Structs.
5356 log replay system stemming from the string form of Structs.
5343
5357
5344 * IPython/Magic.py (Macro.__init__): improved macros to properly
5358 * IPython/Magic.py (Macro.__init__): improved macros to properly
5345 handle magic commands in them.
5359 handle magic commands in them.
5346 (Magic.magic_logstart): usernames are now expanded so 'logstart
5360 (Magic.magic_logstart): usernames are now expanded so 'logstart
5347 ~/mylog' now works.
5361 ~/mylog' now works.
5348
5362
5349 * IPython/iplib.py (complete): fixed bug where paths starting with
5363 * IPython/iplib.py (complete): fixed bug where paths starting with
5350 '/' would be completed as magic names.
5364 '/' would be completed as magic names.
5351
5365
5352 2002-05-04 Fernando Perez <fperez@colorado.edu>
5366 2002-05-04 Fernando Perez <fperez@colorado.edu>
5353
5367
5354 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5368 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5355 allow running full programs under the profiler's control.
5369 allow running full programs under the profiler's control.
5356
5370
5357 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5371 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5358 mode to report exceptions verbosely but without formatting
5372 mode to report exceptions verbosely but without formatting
5359 variables. This addresses the issue of ipython 'freezing' (it's
5373 variables. This addresses the issue of ipython 'freezing' (it's
5360 not frozen, but caught in an expensive formatting loop) when huge
5374 not frozen, but caught in an expensive formatting loop) when huge
5361 variables are in the context of an exception.
5375 variables are in the context of an exception.
5362 (VerboseTB.text): Added '--->' markers at line where exception was
5376 (VerboseTB.text): Added '--->' markers at line where exception was
5363 triggered. Much clearer to read, especially in NoColor modes.
5377 triggered. Much clearer to read, especially in NoColor modes.
5364
5378
5365 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5379 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5366 implemented in reverse when changing to the new parse_options().
5380 implemented in reverse when changing to the new parse_options().
5367
5381
5368 2002-05-03 Fernando Perez <fperez@colorado.edu>
5382 2002-05-03 Fernando Perez <fperez@colorado.edu>
5369
5383
5370 * IPython/Magic.py (Magic.parse_options): new function so that
5384 * IPython/Magic.py (Magic.parse_options): new function so that
5371 magics can parse options easier.
5385 magics can parse options easier.
5372 (Magic.magic_prun): new function similar to profile.run(),
5386 (Magic.magic_prun): new function similar to profile.run(),
5373 suggested by Chris Hart.
5387 suggested by Chris Hart.
5374 (Magic.magic_cd): fixed behavior so that it only changes if
5388 (Magic.magic_cd): fixed behavior so that it only changes if
5375 directory actually is in history.
5389 directory actually is in history.
5376
5390
5377 * IPython/usage.py (__doc__): added information about potential
5391 * IPython/usage.py (__doc__): added information about potential
5378 slowness of Verbose exception mode when there are huge data
5392 slowness of Verbose exception mode when there are huge data
5379 structures to be formatted (thanks to Archie Paulson).
5393 structures to be formatted (thanks to Archie Paulson).
5380
5394
5381 * IPython/ipmaker.py (make_IPython): Changed default logging
5395 * IPython/ipmaker.py (make_IPython): Changed default logging
5382 (when simply called with -log) to use curr_dir/ipython.log in
5396 (when simply called with -log) to use curr_dir/ipython.log in
5383 rotate mode. Fixed crash which was occuring with -log before
5397 rotate mode. Fixed crash which was occuring with -log before
5384 (thanks to Jim Boyle).
5398 (thanks to Jim Boyle).
5385
5399
5386 2002-05-01 Fernando Perez <fperez@colorado.edu>
5400 2002-05-01 Fernando Perez <fperez@colorado.edu>
5387
5401
5388 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5402 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5389 was nasty -- though somewhat of a corner case).
5403 was nasty -- though somewhat of a corner case).
5390
5404
5391 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5405 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5392 text (was a bug).
5406 text (was a bug).
5393
5407
5394 2002-04-30 Fernando Perez <fperez@colorado.edu>
5408 2002-04-30 Fernando Perez <fperez@colorado.edu>
5395
5409
5396 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5410 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5397 a print after ^D or ^C from the user so that the In[] prompt
5411 a print after ^D or ^C from the user so that the In[] prompt
5398 doesn't over-run the gnuplot one.
5412 doesn't over-run the gnuplot one.
5399
5413
5400 2002-04-29 Fernando Perez <fperez@colorado.edu>
5414 2002-04-29 Fernando Perez <fperez@colorado.edu>
5401
5415
5402 * Released 0.2.10
5416 * Released 0.2.10
5403
5417
5404 * IPython/__release__.py (version): get date dynamically.
5418 * IPython/__release__.py (version): get date dynamically.
5405
5419
5406 * Misc. documentation updates thanks to Arnd's comments. Also ran
5420 * Misc. documentation updates thanks to Arnd's comments. Also ran
5407 a full spellcheck on the manual (hadn't been done in a while).
5421 a full spellcheck on the manual (hadn't been done in a while).
5408
5422
5409 2002-04-27 Fernando Perez <fperez@colorado.edu>
5423 2002-04-27 Fernando Perez <fperez@colorado.edu>
5410
5424
5411 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5425 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5412 starting a log in mid-session would reset the input history list.
5426 starting a log in mid-session would reset the input history list.
5413
5427
5414 2002-04-26 Fernando Perez <fperez@colorado.edu>
5428 2002-04-26 Fernando Perez <fperez@colorado.edu>
5415
5429
5416 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5430 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5417 all files were being included in an update. Now anything in
5431 all files were being included in an update. Now anything in
5418 UserConfig that matches [A-Za-z]*.py will go (this excludes
5432 UserConfig that matches [A-Za-z]*.py will go (this excludes
5419 __init__.py)
5433 __init__.py)
5420
5434
5421 2002-04-25 Fernando Perez <fperez@colorado.edu>
5435 2002-04-25 Fernando Perez <fperez@colorado.edu>
5422
5436
5423 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5437 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5424 to __builtins__ so that any form of embedded or imported code can
5438 to __builtins__ so that any form of embedded or imported code can
5425 test for being inside IPython.
5439 test for being inside IPython.
5426
5440
5427 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5441 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5428 changed to GnuplotMagic because it's now an importable module,
5442 changed to GnuplotMagic because it's now an importable module,
5429 this makes the name follow that of the standard Gnuplot module.
5443 this makes the name follow that of the standard Gnuplot module.
5430 GnuplotMagic can now be loaded at any time in mid-session.
5444 GnuplotMagic can now be loaded at any time in mid-session.
5431
5445
5432 2002-04-24 Fernando Perez <fperez@colorado.edu>
5446 2002-04-24 Fernando Perez <fperez@colorado.edu>
5433
5447
5434 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5448 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5435 the globals (IPython has its own namespace) and the
5449 the globals (IPython has its own namespace) and the
5436 PhysicalQuantity stuff is much better anyway.
5450 PhysicalQuantity stuff is much better anyway.
5437
5451
5438 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5452 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5439 embedding example to standard user directory for
5453 embedding example to standard user directory for
5440 distribution. Also put it in the manual.
5454 distribution. Also put it in the manual.
5441
5455
5442 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5456 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5443 instance as first argument (so it doesn't rely on some obscure
5457 instance as first argument (so it doesn't rely on some obscure
5444 hidden global).
5458 hidden global).
5445
5459
5446 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5460 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5447 delimiters. While it prevents ().TAB from working, it allows
5461 delimiters. While it prevents ().TAB from working, it allows
5448 completions in open (... expressions. This is by far a more common
5462 completions in open (... expressions. This is by far a more common
5449 case.
5463 case.
5450
5464
5451 2002-04-23 Fernando Perez <fperez@colorado.edu>
5465 2002-04-23 Fernando Perez <fperez@colorado.edu>
5452
5466
5453 * IPython/Extensions/InterpreterPasteInput.py: new
5467 * IPython/Extensions/InterpreterPasteInput.py: new
5454 syntax-processing module for pasting lines with >>> or ... at the
5468 syntax-processing module for pasting lines with >>> or ... at the
5455 start.
5469 start.
5456
5470
5457 * IPython/Extensions/PhysicalQ_Interactive.py
5471 * IPython/Extensions/PhysicalQ_Interactive.py
5458 (PhysicalQuantityInteractive.__int__): fixed to work with either
5472 (PhysicalQuantityInteractive.__int__): fixed to work with either
5459 Numeric or math.
5473 Numeric or math.
5460
5474
5461 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5475 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5462 provided profiles. Now we have:
5476 provided profiles. Now we have:
5463 -math -> math module as * and cmath with its own namespace.
5477 -math -> math module as * and cmath with its own namespace.
5464 -numeric -> Numeric as *, plus gnuplot & grace
5478 -numeric -> Numeric as *, plus gnuplot & grace
5465 -physics -> same as before
5479 -physics -> same as before
5466
5480
5467 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5481 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5468 user-defined magics wouldn't be found by @magic if they were
5482 user-defined magics wouldn't be found by @magic if they were
5469 defined as class methods. Also cleaned up the namespace search
5483 defined as class methods. Also cleaned up the namespace search
5470 logic and the string building (to use %s instead of many repeated
5484 logic and the string building (to use %s instead of many repeated
5471 string adds).
5485 string adds).
5472
5486
5473 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5487 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5474 of user-defined magics to operate with class methods (cleaner, in
5488 of user-defined magics to operate with class methods (cleaner, in
5475 line with the gnuplot code).
5489 line with the gnuplot code).
5476
5490
5477 2002-04-22 Fernando Perez <fperez@colorado.edu>
5491 2002-04-22 Fernando Perez <fperez@colorado.edu>
5478
5492
5479 * setup.py: updated dependency list so that manual is updated when
5493 * setup.py: updated dependency list so that manual is updated when
5480 all included files change.
5494 all included files change.
5481
5495
5482 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5496 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5483 the delimiter removal option (the fix is ugly right now).
5497 the delimiter removal option (the fix is ugly right now).
5484
5498
5485 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5499 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5486 all of the math profile (quicker loading, no conflict between
5500 all of the math profile (quicker loading, no conflict between
5487 g-9.8 and g-gnuplot).
5501 g-9.8 and g-gnuplot).
5488
5502
5489 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5503 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5490 name of post-mortem files to IPython_crash_report.txt.
5504 name of post-mortem files to IPython_crash_report.txt.
5491
5505
5492 * Cleanup/update of the docs. Added all the new readline info and
5506 * Cleanup/update of the docs. Added all the new readline info and
5493 formatted all lists as 'real lists'.
5507 formatted all lists as 'real lists'.
5494
5508
5495 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5509 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5496 tab-completion options, since the full readline parse_and_bind is
5510 tab-completion options, since the full readline parse_and_bind is
5497 now accessible.
5511 now accessible.
5498
5512
5499 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5513 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5500 handling of readline options. Now users can specify any string to
5514 handling of readline options. Now users can specify any string to
5501 be passed to parse_and_bind(), as well as the delimiters to be
5515 be passed to parse_and_bind(), as well as the delimiters to be
5502 removed.
5516 removed.
5503 (InteractiveShell.__init__): Added __name__ to the global
5517 (InteractiveShell.__init__): Added __name__ to the global
5504 namespace so that things like Itpl which rely on its existence
5518 namespace so that things like Itpl which rely on its existence
5505 don't crash.
5519 don't crash.
5506 (InteractiveShell._prefilter): Defined the default with a _ so
5520 (InteractiveShell._prefilter): Defined the default with a _ so
5507 that prefilter() is easier to override, while the default one
5521 that prefilter() is easier to override, while the default one
5508 remains available.
5522 remains available.
5509
5523
5510 2002-04-18 Fernando Perez <fperez@colorado.edu>
5524 2002-04-18 Fernando Perez <fperez@colorado.edu>
5511
5525
5512 * Added information about pdb in the docs.
5526 * Added information about pdb in the docs.
5513
5527
5514 2002-04-17 Fernando Perez <fperez@colorado.edu>
5528 2002-04-17 Fernando Perez <fperez@colorado.edu>
5515
5529
5516 * IPython/ipmaker.py (make_IPython): added rc_override option to
5530 * IPython/ipmaker.py (make_IPython): added rc_override option to
5517 allow passing config options at creation time which may override
5531 allow passing config options at creation time which may override
5518 anything set in the config files or command line. This is
5532 anything set in the config files or command line. This is
5519 particularly useful for configuring embedded instances.
5533 particularly useful for configuring embedded instances.
5520
5534
5521 2002-04-15 Fernando Perez <fperez@colorado.edu>
5535 2002-04-15 Fernando Perez <fperez@colorado.edu>
5522
5536
5523 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5537 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5524 crash embedded instances because of the input cache falling out of
5538 crash embedded instances because of the input cache falling out of
5525 sync with the output counter.
5539 sync with the output counter.
5526
5540
5527 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5541 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5528 mode which calls pdb after an uncaught exception in IPython itself.
5542 mode which calls pdb after an uncaught exception in IPython itself.
5529
5543
5530 2002-04-14 Fernando Perez <fperez@colorado.edu>
5544 2002-04-14 Fernando Perez <fperez@colorado.edu>
5531
5545
5532 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5546 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5533 readline, fix it back after each call.
5547 readline, fix it back after each call.
5534
5548
5535 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5549 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5536 method to force all access via __call__(), which guarantees that
5550 method to force all access via __call__(), which guarantees that
5537 traceback references are properly deleted.
5551 traceback references are properly deleted.
5538
5552
5539 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5553 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5540 improve printing when pprint is in use.
5554 improve printing when pprint is in use.
5541
5555
5542 2002-04-13 Fernando Perez <fperez@colorado.edu>
5556 2002-04-13 Fernando Perez <fperez@colorado.edu>
5543
5557
5544 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5558 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5545 exceptions aren't caught anymore. If the user triggers one, he
5559 exceptions aren't caught anymore. If the user triggers one, he
5546 should know why he's doing it and it should go all the way up,
5560 should know why he's doing it and it should go all the way up,
5547 just like any other exception. So now @abort will fully kill the
5561 just like any other exception. So now @abort will fully kill the
5548 embedded interpreter and the embedding code (unless that happens
5562 embedded interpreter and the embedding code (unless that happens
5549 to catch SystemExit).
5563 to catch SystemExit).
5550
5564
5551 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5565 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5552 and a debugger() method to invoke the interactive pdb debugger
5566 and a debugger() method to invoke the interactive pdb debugger
5553 after printing exception information. Also added the corresponding
5567 after printing exception information. Also added the corresponding
5554 -pdb option and @pdb magic to control this feature, and updated
5568 -pdb option and @pdb magic to control this feature, and updated
5555 the docs. After a suggestion from Christopher Hart
5569 the docs. After a suggestion from Christopher Hart
5556 (hart-AT-caltech.edu).
5570 (hart-AT-caltech.edu).
5557
5571
5558 2002-04-12 Fernando Perez <fperez@colorado.edu>
5572 2002-04-12 Fernando Perez <fperez@colorado.edu>
5559
5573
5560 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5574 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5561 the exception handlers defined by the user (not the CrashHandler)
5575 the exception handlers defined by the user (not the CrashHandler)
5562 so that user exceptions don't trigger an ipython bug report.
5576 so that user exceptions don't trigger an ipython bug report.
5563
5577
5564 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5578 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5565 configurable (it should have always been so).
5579 configurable (it should have always been so).
5566
5580
5567 2002-03-26 Fernando Perez <fperez@colorado.edu>
5581 2002-03-26 Fernando Perez <fperez@colorado.edu>
5568
5582
5569 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5583 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5570 and there to fix embedding namespace issues. This should all be
5584 and there to fix embedding namespace issues. This should all be
5571 done in a more elegant way.
5585 done in a more elegant way.
5572
5586
5573 2002-03-25 Fernando Perez <fperez@colorado.edu>
5587 2002-03-25 Fernando Perez <fperez@colorado.edu>
5574
5588
5575 * IPython/genutils.py (get_home_dir): Try to make it work under
5589 * IPython/genutils.py (get_home_dir): Try to make it work under
5576 win9x also.
5590 win9x also.
5577
5591
5578 2002-03-20 Fernando Perez <fperez@colorado.edu>
5592 2002-03-20 Fernando Perez <fperez@colorado.edu>
5579
5593
5580 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5594 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5581 sys.displayhook untouched upon __init__.
5595 sys.displayhook untouched upon __init__.
5582
5596
5583 2002-03-19 Fernando Perez <fperez@colorado.edu>
5597 2002-03-19 Fernando Perez <fperez@colorado.edu>
5584
5598
5585 * Released 0.2.9 (for embedding bug, basically).
5599 * Released 0.2.9 (for embedding bug, basically).
5586
5600
5587 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5601 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5588 exceptions so that enclosing shell's state can be restored.
5602 exceptions so that enclosing shell's state can be restored.
5589
5603
5590 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5604 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5591 naming conventions in the .ipython/ dir.
5605 naming conventions in the .ipython/ dir.
5592
5606
5593 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5607 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5594 from delimiters list so filenames with - in them get expanded.
5608 from delimiters list so filenames with - in them get expanded.
5595
5609
5596 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5610 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5597 sys.displayhook not being properly restored after an embedded call.
5611 sys.displayhook not being properly restored after an embedded call.
5598
5612
5599 2002-03-18 Fernando Perez <fperez@colorado.edu>
5613 2002-03-18 Fernando Perez <fperez@colorado.edu>
5600
5614
5601 * Released 0.2.8
5615 * Released 0.2.8
5602
5616
5603 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5617 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5604 some files weren't being included in a -upgrade.
5618 some files weren't being included in a -upgrade.
5605 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5619 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5606 on' so that the first tab completes.
5620 on' so that the first tab completes.
5607 (InteractiveShell.handle_magic): fixed bug with spaces around
5621 (InteractiveShell.handle_magic): fixed bug with spaces around
5608 quotes breaking many magic commands.
5622 quotes breaking many magic commands.
5609
5623
5610 * setup.py: added note about ignoring the syntax error messages at
5624 * setup.py: added note about ignoring the syntax error messages at
5611 installation.
5625 installation.
5612
5626
5613 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5627 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5614 streamlining the gnuplot interface, now there's only one magic @gp.
5628 streamlining the gnuplot interface, now there's only one magic @gp.
5615
5629
5616 2002-03-17 Fernando Perez <fperez@colorado.edu>
5630 2002-03-17 Fernando Perez <fperez@colorado.edu>
5617
5631
5618 * IPython/UserConfig/magic_gnuplot.py: new name for the
5632 * IPython/UserConfig/magic_gnuplot.py: new name for the
5619 example-magic_pm.py file. Much enhanced system, now with a shell
5633 example-magic_pm.py file. Much enhanced system, now with a shell
5620 for communicating directly with gnuplot, one command at a time.
5634 for communicating directly with gnuplot, one command at a time.
5621
5635
5622 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5636 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5623 setting __name__=='__main__'.
5637 setting __name__=='__main__'.
5624
5638
5625 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5639 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5626 mini-shell for accessing gnuplot from inside ipython. Should
5640 mini-shell for accessing gnuplot from inside ipython. Should
5627 extend it later for grace access too. Inspired by Arnd's
5641 extend it later for grace access too. Inspired by Arnd's
5628 suggestion.
5642 suggestion.
5629
5643
5630 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5644 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5631 calling magic functions with () in their arguments. Thanks to Arnd
5645 calling magic functions with () in their arguments. Thanks to Arnd
5632 Baecker for pointing this to me.
5646 Baecker for pointing this to me.
5633
5647
5634 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5648 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5635 infinitely for integer or complex arrays (only worked with floats).
5649 infinitely for integer or complex arrays (only worked with floats).
5636
5650
5637 2002-03-16 Fernando Perez <fperez@colorado.edu>
5651 2002-03-16 Fernando Perez <fperez@colorado.edu>
5638
5652
5639 * setup.py: Merged setup and setup_windows into a single script
5653 * setup.py: Merged setup and setup_windows into a single script
5640 which properly handles things for windows users.
5654 which properly handles things for windows users.
5641
5655
5642 2002-03-15 Fernando Perez <fperez@colorado.edu>
5656 2002-03-15 Fernando Perez <fperez@colorado.edu>
5643
5657
5644 * Big change to the manual: now the magics are all automatically
5658 * Big change to the manual: now the magics are all automatically
5645 documented. This information is generated from their docstrings
5659 documented. This information is generated from their docstrings
5646 and put in a latex file included by the manual lyx file. This way
5660 and put in a latex file included by the manual lyx file. This way
5647 we get always up to date information for the magics. The manual
5661 we get always up to date information for the magics. The manual
5648 now also has proper version information, also auto-synced.
5662 now also has proper version information, also auto-synced.
5649
5663
5650 For this to work, an undocumented --magic_docstrings option was added.
5664 For this to work, an undocumented --magic_docstrings option was added.
5651
5665
5652 2002-03-13 Fernando Perez <fperez@colorado.edu>
5666 2002-03-13 Fernando Perez <fperez@colorado.edu>
5653
5667
5654 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5668 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5655 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5669 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5656
5670
5657 2002-03-12 Fernando Perez <fperez@colorado.edu>
5671 2002-03-12 Fernando Perez <fperez@colorado.edu>
5658
5672
5659 * IPython/ultraTB.py (TermColors): changed color escapes again to
5673 * IPython/ultraTB.py (TermColors): changed color escapes again to
5660 fix the (old, reintroduced) line-wrapping bug. Basically, if
5674 fix the (old, reintroduced) line-wrapping bug. Basically, if
5661 \001..\002 aren't given in the color escapes, lines get wrapped
5675 \001..\002 aren't given in the color escapes, lines get wrapped
5662 weirdly. But giving those screws up old xterms and emacs terms. So
5676 weirdly. But giving those screws up old xterms and emacs terms. So
5663 I added some logic for emacs terms to be ok, but I can't identify old
5677 I added some logic for emacs terms to be ok, but I can't identify old
5664 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5678 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5665
5679
5666 2002-03-10 Fernando Perez <fperez@colorado.edu>
5680 2002-03-10 Fernando Perez <fperez@colorado.edu>
5667
5681
5668 * IPython/usage.py (__doc__): Various documentation cleanups and
5682 * IPython/usage.py (__doc__): Various documentation cleanups and
5669 updates, both in usage docstrings and in the manual.
5683 updates, both in usage docstrings and in the manual.
5670
5684
5671 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5685 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5672 handling of caching. Set minimum acceptabe value for having a
5686 handling of caching. Set minimum acceptabe value for having a
5673 cache at 20 values.
5687 cache at 20 values.
5674
5688
5675 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5689 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5676 install_first_time function to a method, renamed it and added an
5690 install_first_time function to a method, renamed it and added an
5677 'upgrade' mode. Now people can update their config directory with
5691 'upgrade' mode. Now people can update their config directory with
5678 a simple command line switch (-upgrade, also new).
5692 a simple command line switch (-upgrade, also new).
5679
5693
5680 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5694 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5681 @file (convenient for automagic users under Python >= 2.2).
5695 @file (convenient for automagic users under Python >= 2.2).
5682 Removed @files (it seemed more like a plural than an abbrev. of
5696 Removed @files (it seemed more like a plural than an abbrev. of
5683 'file show').
5697 'file show').
5684
5698
5685 * IPython/iplib.py (install_first_time): Fixed crash if there were
5699 * IPython/iplib.py (install_first_time): Fixed crash if there were
5686 backup files ('~') in .ipython/ install directory.
5700 backup files ('~') in .ipython/ install directory.
5687
5701
5688 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5702 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5689 system. Things look fine, but these changes are fairly
5703 system. Things look fine, but these changes are fairly
5690 intrusive. Test them for a few days.
5704 intrusive. Test them for a few days.
5691
5705
5692 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5706 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5693 the prompts system. Now all in/out prompt strings are user
5707 the prompts system. Now all in/out prompt strings are user
5694 controllable. This is particularly useful for embedding, as one
5708 controllable. This is particularly useful for embedding, as one
5695 can tag embedded instances with particular prompts.
5709 can tag embedded instances with particular prompts.
5696
5710
5697 Also removed global use of sys.ps1/2, which now allows nested
5711 Also removed global use of sys.ps1/2, which now allows nested
5698 embeddings without any problems. Added command-line options for
5712 embeddings without any problems. Added command-line options for
5699 the prompt strings.
5713 the prompt strings.
5700
5714
5701 2002-03-08 Fernando Perez <fperez@colorado.edu>
5715 2002-03-08 Fernando Perez <fperez@colorado.edu>
5702
5716
5703 * IPython/UserConfig/example-embed-short.py (ipshell): added
5717 * IPython/UserConfig/example-embed-short.py (ipshell): added
5704 example file with the bare minimum code for embedding.
5718 example file with the bare minimum code for embedding.
5705
5719
5706 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5720 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5707 functionality for the embeddable shell to be activated/deactivated
5721 functionality for the embeddable shell to be activated/deactivated
5708 either globally or at each call.
5722 either globally or at each call.
5709
5723
5710 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5724 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5711 rewriting the prompt with '--->' for auto-inputs with proper
5725 rewriting the prompt with '--->' for auto-inputs with proper
5712 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5726 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5713 this is handled by the prompts class itself, as it should.
5727 this is handled by the prompts class itself, as it should.
5714
5728
5715 2002-03-05 Fernando Perez <fperez@colorado.edu>
5729 2002-03-05 Fernando Perez <fperez@colorado.edu>
5716
5730
5717 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5731 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5718 @logstart to avoid name clashes with the math log function.
5732 @logstart to avoid name clashes with the math log function.
5719
5733
5720 * Big updates to X/Emacs section of the manual.
5734 * Big updates to X/Emacs section of the manual.
5721
5735
5722 * Removed ipython_emacs. Milan explained to me how to pass
5736 * Removed ipython_emacs. Milan explained to me how to pass
5723 arguments to ipython through Emacs. Some day I'm going to end up
5737 arguments to ipython through Emacs. Some day I'm going to end up
5724 learning some lisp...
5738 learning some lisp...
5725
5739
5726 2002-03-04 Fernando Perez <fperez@colorado.edu>
5740 2002-03-04 Fernando Perez <fperez@colorado.edu>
5727
5741
5728 * IPython/ipython_emacs: Created script to be used as the
5742 * IPython/ipython_emacs: Created script to be used as the
5729 py-python-command Emacs variable so we can pass IPython
5743 py-python-command Emacs variable so we can pass IPython
5730 parameters. I can't figure out how to tell Emacs directly to pass
5744 parameters. I can't figure out how to tell Emacs directly to pass
5731 parameters to IPython, so a dummy shell script will do it.
5745 parameters to IPython, so a dummy shell script will do it.
5732
5746
5733 Other enhancements made for things to work better under Emacs'
5747 Other enhancements made for things to work better under Emacs'
5734 various types of terminals. Many thanks to Milan Zamazal
5748 various types of terminals. Many thanks to Milan Zamazal
5735 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5749 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5736
5750
5737 2002-03-01 Fernando Perez <fperez@colorado.edu>
5751 2002-03-01 Fernando Perez <fperez@colorado.edu>
5738
5752
5739 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5753 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5740 that loading of readline is now optional. This gives better
5754 that loading of readline is now optional. This gives better
5741 control to emacs users.
5755 control to emacs users.
5742
5756
5743 * IPython/ultraTB.py (__date__): Modified color escape sequences
5757 * IPython/ultraTB.py (__date__): Modified color escape sequences
5744 and now things work fine under xterm and in Emacs' term buffers
5758 and now things work fine under xterm and in Emacs' term buffers
5745 (though not shell ones). Well, in emacs you get colors, but all
5759 (though not shell ones). Well, in emacs you get colors, but all
5746 seem to be 'light' colors (no difference between dark and light
5760 seem to be 'light' colors (no difference between dark and light
5747 ones). But the garbage chars are gone, and also in xterms. It
5761 ones). But the garbage chars are gone, and also in xterms. It
5748 seems that now I'm using 'cleaner' ansi sequences.
5762 seems that now I'm using 'cleaner' ansi sequences.
5749
5763
5750 2002-02-21 Fernando Perez <fperez@colorado.edu>
5764 2002-02-21 Fernando Perez <fperez@colorado.edu>
5751
5765
5752 * Released 0.2.7 (mainly to publish the scoping fix).
5766 * Released 0.2.7 (mainly to publish the scoping fix).
5753
5767
5754 * IPython/Logger.py (Logger.logstate): added. A corresponding
5768 * IPython/Logger.py (Logger.logstate): added. A corresponding
5755 @logstate magic was created.
5769 @logstate magic was created.
5756
5770
5757 * IPython/Magic.py: fixed nested scoping problem under Python
5771 * IPython/Magic.py: fixed nested scoping problem under Python
5758 2.1.x (automagic wasn't working).
5772 2.1.x (automagic wasn't working).
5759
5773
5760 2002-02-20 Fernando Perez <fperez@colorado.edu>
5774 2002-02-20 Fernando Perez <fperez@colorado.edu>
5761
5775
5762 * Released 0.2.6.
5776 * Released 0.2.6.
5763
5777
5764 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5778 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5765 option so that logs can come out without any headers at all.
5779 option so that logs can come out without any headers at all.
5766
5780
5767 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5781 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5768 SciPy.
5782 SciPy.
5769
5783
5770 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5784 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5771 that embedded IPython calls don't require vars() to be explicitly
5785 that embedded IPython calls don't require vars() to be explicitly
5772 passed. Now they are extracted from the caller's frame (code
5786 passed. Now they are extracted from the caller's frame (code
5773 snatched from Eric Jones' weave). Added better documentation to
5787 snatched from Eric Jones' weave). Added better documentation to
5774 the section on embedding and the example file.
5788 the section on embedding and the example file.
5775
5789
5776 * IPython/genutils.py (page): Changed so that under emacs, it just
5790 * IPython/genutils.py (page): Changed so that under emacs, it just
5777 prints the string. You can then page up and down in the emacs
5791 prints the string. You can then page up and down in the emacs
5778 buffer itself. This is how the builtin help() works.
5792 buffer itself. This is how the builtin help() works.
5779
5793
5780 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5794 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5781 macro scoping: macros need to be executed in the user's namespace
5795 macro scoping: macros need to be executed in the user's namespace
5782 to work as if they had been typed by the user.
5796 to work as if they had been typed by the user.
5783
5797
5784 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5798 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5785 execute automatically (no need to type 'exec...'). They then
5799 execute automatically (no need to type 'exec...'). They then
5786 behave like 'true macros'. The printing system was also modified
5800 behave like 'true macros'. The printing system was also modified
5787 for this to work.
5801 for this to work.
5788
5802
5789 2002-02-19 Fernando Perez <fperez@colorado.edu>
5803 2002-02-19 Fernando Perez <fperez@colorado.edu>
5790
5804
5791 * IPython/genutils.py (page_file): new function for paging files
5805 * IPython/genutils.py (page_file): new function for paging files
5792 in an OS-independent way. Also necessary for file viewing to work
5806 in an OS-independent way. Also necessary for file viewing to work
5793 well inside Emacs buffers.
5807 well inside Emacs buffers.
5794 (page): Added checks for being in an emacs buffer.
5808 (page): Added checks for being in an emacs buffer.
5795 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5809 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5796 same bug in iplib.
5810 same bug in iplib.
5797
5811
5798 2002-02-18 Fernando Perez <fperez@colorado.edu>
5812 2002-02-18 Fernando Perez <fperez@colorado.edu>
5799
5813
5800 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5814 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5801 of readline so that IPython can work inside an Emacs buffer.
5815 of readline so that IPython can work inside an Emacs buffer.
5802
5816
5803 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5817 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5804 method signatures (they weren't really bugs, but it looks cleaner
5818 method signatures (they weren't really bugs, but it looks cleaner
5805 and keeps PyChecker happy).
5819 and keeps PyChecker happy).
5806
5820
5807 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5821 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5808 for implementing various user-defined hooks. Currently only
5822 for implementing various user-defined hooks. Currently only
5809 display is done.
5823 display is done.
5810
5824
5811 * IPython/Prompts.py (CachedOutput._display): changed display
5825 * IPython/Prompts.py (CachedOutput._display): changed display
5812 functions so that they can be dynamically changed by users easily.
5826 functions so that they can be dynamically changed by users easily.
5813
5827
5814 * IPython/Extensions/numeric_formats.py (num_display): added an
5828 * IPython/Extensions/numeric_formats.py (num_display): added an
5815 extension for printing NumPy arrays in flexible manners. It
5829 extension for printing NumPy arrays in flexible manners. It
5816 doesn't do anything yet, but all the structure is in
5830 doesn't do anything yet, but all the structure is in
5817 place. Ultimately the plan is to implement output format control
5831 place. Ultimately the plan is to implement output format control
5818 like in Octave.
5832 like in Octave.
5819
5833
5820 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5834 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5821 methods are found at run-time by all the automatic machinery.
5835 methods are found at run-time by all the automatic machinery.
5822
5836
5823 2002-02-17 Fernando Perez <fperez@colorado.edu>
5837 2002-02-17 Fernando Perez <fperez@colorado.edu>
5824
5838
5825 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5839 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5826 whole file a little.
5840 whole file a little.
5827
5841
5828 * ToDo: closed this document. Now there's a new_design.lyx
5842 * ToDo: closed this document. Now there's a new_design.lyx
5829 document for all new ideas. Added making a pdf of it for the
5843 document for all new ideas. Added making a pdf of it for the
5830 end-user distro.
5844 end-user distro.
5831
5845
5832 * IPython/Logger.py (Logger.switch_log): Created this to replace
5846 * IPython/Logger.py (Logger.switch_log): Created this to replace
5833 logon() and logoff(). It also fixes a nasty crash reported by
5847 logon() and logoff(). It also fixes a nasty crash reported by
5834 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5848 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5835
5849
5836 * IPython/iplib.py (complete): got auto-completion to work with
5850 * IPython/iplib.py (complete): got auto-completion to work with
5837 automagic (I had wanted this for a long time).
5851 automagic (I had wanted this for a long time).
5838
5852
5839 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5853 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5840 to @file, since file() is now a builtin and clashes with automagic
5854 to @file, since file() is now a builtin and clashes with automagic
5841 for @file.
5855 for @file.
5842
5856
5843 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5857 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5844 of this was previously in iplib, which had grown to more than 2000
5858 of this was previously in iplib, which had grown to more than 2000
5845 lines, way too long. No new functionality, but it makes managing
5859 lines, way too long. No new functionality, but it makes managing
5846 the code a bit easier.
5860 the code a bit easier.
5847
5861
5848 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5862 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5849 information to crash reports.
5863 information to crash reports.
5850
5864
5851 2002-02-12 Fernando Perez <fperez@colorado.edu>
5865 2002-02-12 Fernando Perez <fperez@colorado.edu>
5852
5866
5853 * Released 0.2.5.
5867 * Released 0.2.5.
5854
5868
5855 2002-02-11 Fernando Perez <fperez@colorado.edu>
5869 2002-02-11 Fernando Perez <fperez@colorado.edu>
5856
5870
5857 * Wrote a relatively complete Windows installer. It puts
5871 * Wrote a relatively complete Windows installer. It puts
5858 everything in place, creates Start Menu entries and fixes the
5872 everything in place, creates Start Menu entries and fixes the
5859 color issues. Nothing fancy, but it works.
5873 color issues. Nothing fancy, but it works.
5860
5874
5861 2002-02-10 Fernando Perez <fperez@colorado.edu>
5875 2002-02-10 Fernando Perez <fperez@colorado.edu>
5862
5876
5863 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5877 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5864 os.path.expanduser() call so that we can type @run ~/myfile.py and
5878 os.path.expanduser() call so that we can type @run ~/myfile.py and
5865 have thigs work as expected.
5879 have thigs work as expected.
5866
5880
5867 * IPython/genutils.py (page): fixed exception handling so things
5881 * IPython/genutils.py (page): fixed exception handling so things
5868 work both in Unix and Windows correctly. Quitting a pager triggers
5882 work both in Unix and Windows correctly. Quitting a pager triggers
5869 an IOError/broken pipe in Unix, and in windows not finding a pager
5883 an IOError/broken pipe in Unix, and in windows not finding a pager
5870 is also an IOError, so I had to actually look at the return value
5884 is also an IOError, so I had to actually look at the return value
5871 of the exception, not just the exception itself. Should be ok now.
5885 of the exception, not just the exception itself. Should be ok now.
5872
5886
5873 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5887 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5874 modified to allow case-insensitive color scheme changes.
5888 modified to allow case-insensitive color scheme changes.
5875
5889
5876 2002-02-09 Fernando Perez <fperez@colorado.edu>
5890 2002-02-09 Fernando Perez <fperez@colorado.edu>
5877
5891
5878 * IPython/genutils.py (native_line_ends): new function to leave
5892 * IPython/genutils.py (native_line_ends): new function to leave
5879 user config files with os-native line-endings.
5893 user config files with os-native line-endings.
5880
5894
5881 * README and manual updates.
5895 * README and manual updates.
5882
5896
5883 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5897 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5884 instead of StringType to catch Unicode strings.
5898 instead of StringType to catch Unicode strings.
5885
5899
5886 * IPython/genutils.py (filefind): fixed bug for paths with
5900 * IPython/genutils.py (filefind): fixed bug for paths with
5887 embedded spaces (very common in Windows).
5901 embedded spaces (very common in Windows).
5888
5902
5889 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5903 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5890 files under Windows, so that they get automatically associated
5904 files under Windows, so that they get automatically associated
5891 with a text editor. Windows makes it a pain to handle
5905 with a text editor. Windows makes it a pain to handle
5892 extension-less files.
5906 extension-less files.
5893
5907
5894 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5908 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5895 warning about readline only occur for Posix. In Windows there's no
5909 warning about readline only occur for Posix. In Windows there's no
5896 way to get readline, so why bother with the warning.
5910 way to get readline, so why bother with the warning.
5897
5911
5898 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5912 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5899 for __str__ instead of dir(self), since dir() changed in 2.2.
5913 for __str__ instead of dir(self), since dir() changed in 2.2.
5900
5914
5901 * Ported to Windows! Tested on XP, I suspect it should work fine
5915 * Ported to Windows! Tested on XP, I suspect it should work fine
5902 on NT/2000, but I don't think it will work on 98 et al. That
5916 on NT/2000, but I don't think it will work on 98 et al. That
5903 series of Windows is such a piece of junk anyway that I won't try
5917 series of Windows is such a piece of junk anyway that I won't try
5904 porting it there. The XP port was straightforward, showed a few
5918 porting it there. The XP port was straightforward, showed a few
5905 bugs here and there (fixed all), in particular some string
5919 bugs here and there (fixed all), in particular some string
5906 handling stuff which required considering Unicode strings (which
5920 handling stuff which required considering Unicode strings (which
5907 Windows uses). This is good, but hasn't been too tested :) No
5921 Windows uses). This is good, but hasn't been too tested :) No
5908 fancy installer yet, I'll put a note in the manual so people at
5922 fancy installer yet, I'll put a note in the manual so people at
5909 least make manually a shortcut.
5923 least make manually a shortcut.
5910
5924
5911 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5925 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5912 into a single one, "colors". This now controls both prompt and
5926 into a single one, "colors". This now controls both prompt and
5913 exception color schemes, and can be changed both at startup
5927 exception color schemes, and can be changed both at startup
5914 (either via command-line switches or via ipythonrc files) and at
5928 (either via command-line switches or via ipythonrc files) and at
5915 runtime, with @colors.
5929 runtime, with @colors.
5916 (Magic.magic_run): renamed @prun to @run and removed the old
5930 (Magic.magic_run): renamed @prun to @run and removed the old
5917 @run. The two were too similar to warrant keeping both.
5931 @run. The two were too similar to warrant keeping both.
5918
5932
5919 2002-02-03 Fernando Perez <fperez@colorado.edu>
5933 2002-02-03 Fernando Perez <fperez@colorado.edu>
5920
5934
5921 * IPython/iplib.py (install_first_time): Added comment on how to
5935 * IPython/iplib.py (install_first_time): Added comment on how to
5922 configure the color options for first-time users. Put a <return>
5936 configure the color options for first-time users. Put a <return>
5923 request at the end so that small-terminal users get a chance to
5937 request at the end so that small-terminal users get a chance to
5924 read the startup info.
5938 read the startup info.
5925
5939
5926 2002-01-23 Fernando Perez <fperez@colorado.edu>
5940 2002-01-23 Fernando Perez <fperez@colorado.edu>
5927
5941
5928 * IPython/iplib.py (CachedOutput.update): Changed output memory
5942 * IPython/iplib.py (CachedOutput.update): Changed output memory
5929 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5943 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5930 input history we still use _i. Did this b/c these variable are
5944 input history we still use _i. Did this b/c these variable are
5931 very commonly used in interactive work, so the less we need to
5945 very commonly used in interactive work, so the less we need to
5932 type the better off we are.
5946 type the better off we are.
5933 (Magic.magic_prun): updated @prun to better handle the namespaces
5947 (Magic.magic_prun): updated @prun to better handle the namespaces
5934 the file will run in, including a fix for __name__ not being set
5948 the file will run in, including a fix for __name__ not being set
5935 before.
5949 before.
5936
5950
5937 2002-01-20 Fernando Perez <fperez@colorado.edu>
5951 2002-01-20 Fernando Perez <fperez@colorado.edu>
5938
5952
5939 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5953 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5940 extra garbage for Python 2.2. Need to look more carefully into
5954 extra garbage for Python 2.2. Need to look more carefully into
5941 this later.
5955 this later.
5942
5956
5943 2002-01-19 Fernando Perez <fperez@colorado.edu>
5957 2002-01-19 Fernando Perez <fperez@colorado.edu>
5944
5958
5945 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5959 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5946 display SyntaxError exceptions properly formatted when they occur
5960 display SyntaxError exceptions properly formatted when they occur
5947 (they can be triggered by imported code).
5961 (they can be triggered by imported code).
5948
5962
5949 2002-01-18 Fernando Perez <fperez@colorado.edu>
5963 2002-01-18 Fernando Perez <fperez@colorado.edu>
5950
5964
5951 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5965 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5952 SyntaxError exceptions are reported nicely formatted, instead of
5966 SyntaxError exceptions are reported nicely formatted, instead of
5953 spitting out only offset information as before.
5967 spitting out only offset information as before.
5954 (Magic.magic_prun): Added the @prun function for executing
5968 (Magic.magic_prun): Added the @prun function for executing
5955 programs with command line args inside IPython.
5969 programs with command line args inside IPython.
5956
5970
5957 2002-01-16 Fernando Perez <fperez@colorado.edu>
5971 2002-01-16 Fernando Perez <fperez@colorado.edu>
5958
5972
5959 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5973 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5960 to *not* include the last item given in a range. This brings their
5974 to *not* include the last item given in a range. This brings their
5961 behavior in line with Python's slicing:
5975 behavior in line with Python's slicing:
5962 a[n1:n2] -> a[n1]...a[n2-1]
5976 a[n1:n2] -> a[n1]...a[n2-1]
5963 It may be a bit less convenient, but I prefer to stick to Python's
5977 It may be a bit less convenient, but I prefer to stick to Python's
5964 conventions *everywhere*, so users never have to wonder.
5978 conventions *everywhere*, so users never have to wonder.
5965 (Magic.magic_macro): Added @macro function to ease the creation of
5979 (Magic.magic_macro): Added @macro function to ease the creation of
5966 macros.
5980 macros.
5967
5981
5968 2002-01-05 Fernando Perez <fperez@colorado.edu>
5982 2002-01-05 Fernando Perez <fperez@colorado.edu>
5969
5983
5970 * Released 0.2.4.
5984 * Released 0.2.4.
5971
5985
5972 * IPython/iplib.py (Magic.magic_pdef):
5986 * IPython/iplib.py (Magic.magic_pdef):
5973 (InteractiveShell.safe_execfile): report magic lines and error
5987 (InteractiveShell.safe_execfile): report magic lines and error
5974 lines without line numbers so one can easily copy/paste them for
5988 lines without line numbers so one can easily copy/paste them for
5975 re-execution.
5989 re-execution.
5976
5990
5977 * Updated manual with recent changes.
5991 * Updated manual with recent changes.
5978
5992
5979 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5993 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5980 docstring printing when class? is called. Very handy for knowing
5994 docstring printing when class? is called. Very handy for knowing
5981 how to create class instances (as long as __init__ is well
5995 how to create class instances (as long as __init__ is well
5982 documented, of course :)
5996 documented, of course :)
5983 (Magic.magic_doc): print both class and constructor docstrings.
5997 (Magic.magic_doc): print both class and constructor docstrings.
5984 (Magic.magic_pdef): give constructor info if passed a class and
5998 (Magic.magic_pdef): give constructor info if passed a class and
5985 __call__ info for callable object instances.
5999 __call__ info for callable object instances.
5986
6000
5987 2002-01-04 Fernando Perez <fperez@colorado.edu>
6001 2002-01-04 Fernando Perez <fperez@colorado.edu>
5988
6002
5989 * Made deep_reload() off by default. It doesn't always work
6003 * Made deep_reload() off by default. It doesn't always work
5990 exactly as intended, so it's probably safer to have it off. It's
6004 exactly as intended, so it's probably safer to have it off. It's
5991 still available as dreload() anyway, so nothing is lost.
6005 still available as dreload() anyway, so nothing is lost.
5992
6006
5993 2002-01-02 Fernando Perez <fperez@colorado.edu>
6007 2002-01-02 Fernando Perez <fperez@colorado.edu>
5994
6008
5995 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6009 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5996 so I wanted an updated release).
6010 so I wanted an updated release).
5997
6011
5998 2001-12-27 Fernando Perez <fperez@colorado.edu>
6012 2001-12-27 Fernando Perez <fperez@colorado.edu>
5999
6013
6000 * IPython/iplib.py (InteractiveShell.interact): Added the original
6014 * IPython/iplib.py (InteractiveShell.interact): Added the original
6001 code from 'code.py' for this module in order to change the
6015 code from 'code.py' for this module in order to change the
6002 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6016 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6003 the history cache would break when the user hit Ctrl-C, and
6017 the history cache would break when the user hit Ctrl-C, and
6004 interact() offers no way to add any hooks to it.
6018 interact() offers no way to add any hooks to it.
6005
6019
6006 2001-12-23 Fernando Perez <fperez@colorado.edu>
6020 2001-12-23 Fernando Perez <fperez@colorado.edu>
6007
6021
6008 * setup.py: added check for 'MANIFEST' before trying to remove
6022 * setup.py: added check for 'MANIFEST' before trying to remove
6009 it. Thanks to Sean Reifschneider.
6023 it. Thanks to Sean Reifschneider.
6010
6024
6011 2001-12-22 Fernando Perez <fperez@colorado.edu>
6025 2001-12-22 Fernando Perez <fperez@colorado.edu>
6012
6026
6013 * Released 0.2.2.
6027 * Released 0.2.2.
6014
6028
6015 * Finished (reasonably) writing the manual. Later will add the
6029 * Finished (reasonably) writing the manual. Later will add the
6016 python-standard navigation stylesheets, but for the time being
6030 python-standard navigation stylesheets, but for the time being
6017 it's fairly complete. Distribution will include html and pdf
6031 it's fairly complete. Distribution will include html and pdf
6018 versions.
6032 versions.
6019
6033
6020 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6034 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6021 (MayaVi author).
6035 (MayaVi author).
6022
6036
6023 2001-12-21 Fernando Perez <fperez@colorado.edu>
6037 2001-12-21 Fernando Perez <fperez@colorado.edu>
6024
6038
6025 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6039 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6026 good public release, I think (with the manual and the distutils
6040 good public release, I think (with the manual and the distutils
6027 installer). The manual can use some work, but that can go
6041 installer). The manual can use some work, but that can go
6028 slowly. Otherwise I think it's quite nice for end users. Next
6042 slowly. Otherwise I think it's quite nice for end users. Next
6029 summer, rewrite the guts of it...
6043 summer, rewrite the guts of it...
6030
6044
6031 * Changed format of ipythonrc files to use whitespace as the
6045 * Changed format of ipythonrc files to use whitespace as the
6032 separator instead of an explicit '='. Cleaner.
6046 separator instead of an explicit '='. Cleaner.
6033
6047
6034 2001-12-20 Fernando Perez <fperez@colorado.edu>
6048 2001-12-20 Fernando Perez <fperez@colorado.edu>
6035
6049
6036 * Started a manual in LyX. For now it's just a quick merge of the
6050 * Started a manual in LyX. For now it's just a quick merge of the
6037 various internal docstrings and READMEs. Later it may grow into a
6051 various internal docstrings and READMEs. Later it may grow into a
6038 nice, full-blown manual.
6052 nice, full-blown manual.
6039
6053
6040 * Set up a distutils based installer. Installation should now be
6054 * Set up a distutils based installer. Installation should now be
6041 trivially simple for end-users.
6055 trivially simple for end-users.
6042
6056
6043 2001-12-11 Fernando Perez <fperez@colorado.edu>
6057 2001-12-11 Fernando Perez <fperez@colorado.edu>
6044
6058
6045 * Released 0.2.0. First public release, announced it at
6059 * Released 0.2.0. First public release, announced it at
6046 comp.lang.python. From now on, just bugfixes...
6060 comp.lang.python. From now on, just bugfixes...
6047
6061
6048 * Went through all the files, set copyright/license notices and
6062 * Went through all the files, set copyright/license notices and
6049 cleaned up things. Ready for release.
6063 cleaned up things. Ready for release.
6050
6064
6051 2001-12-10 Fernando Perez <fperez@colorado.edu>
6065 2001-12-10 Fernando Perez <fperez@colorado.edu>
6052
6066
6053 * Changed the first-time installer not to use tarfiles. It's more
6067 * Changed the first-time installer not to use tarfiles. It's more
6054 robust now and less unix-dependent. Also makes it easier for
6068 robust now and less unix-dependent. Also makes it easier for
6055 people to later upgrade versions.
6069 people to later upgrade versions.
6056
6070
6057 * Changed @exit to @abort to reflect the fact that it's pretty
6071 * Changed @exit to @abort to reflect the fact that it's pretty
6058 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6072 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6059 becomes significant only when IPyhton is embedded: in that case,
6073 becomes significant only when IPyhton is embedded: in that case,
6060 C-D closes IPython only, but @abort kills the enclosing program
6074 C-D closes IPython only, but @abort kills the enclosing program
6061 too (unless it had called IPython inside a try catching
6075 too (unless it had called IPython inside a try catching
6062 SystemExit).
6076 SystemExit).
6063
6077
6064 * Created Shell module which exposes the actuall IPython Shell
6078 * Created Shell module which exposes the actuall IPython Shell
6065 classes, currently the normal and the embeddable one. This at
6079 classes, currently the normal and the embeddable one. This at
6066 least offers a stable interface we won't need to change when
6080 least offers a stable interface we won't need to change when
6067 (later) the internals are rewritten. That rewrite will be confined
6081 (later) the internals are rewritten. That rewrite will be confined
6068 to iplib and ipmaker, but the Shell interface should remain as is.
6082 to iplib and ipmaker, but the Shell interface should remain as is.
6069
6083
6070 * Added embed module which offers an embeddable IPShell object,
6084 * Added embed module which offers an embeddable IPShell object,
6071 useful to fire up IPython *inside* a running program. Great for
6085 useful to fire up IPython *inside* a running program. Great for
6072 debugging or dynamical data analysis.
6086 debugging or dynamical data analysis.
6073
6087
6074 2001-12-08 Fernando Perez <fperez@colorado.edu>
6088 2001-12-08 Fernando Perez <fperez@colorado.edu>
6075
6089
6076 * Fixed small bug preventing seeing info from methods of defined
6090 * Fixed small bug preventing seeing info from methods of defined
6077 objects (incorrect namespace in _ofind()).
6091 objects (incorrect namespace in _ofind()).
6078
6092
6079 * Documentation cleanup. Moved the main usage docstrings to a
6093 * Documentation cleanup. Moved the main usage docstrings to a
6080 separate file, usage.py (cleaner to maintain, and hopefully in the
6094 separate file, usage.py (cleaner to maintain, and hopefully in the
6081 future some perlpod-like way of producing interactive, man and
6095 future some perlpod-like way of producing interactive, man and
6082 html docs out of it will be found).
6096 html docs out of it will be found).
6083
6097
6084 * Added @profile to see your profile at any time.
6098 * Added @profile to see your profile at any time.
6085
6099
6086 * Added @p as an alias for 'print'. It's especially convenient if
6100 * Added @p as an alias for 'print'. It's especially convenient if
6087 using automagic ('p x' prints x).
6101 using automagic ('p x' prints x).
6088
6102
6089 * Small cleanups and fixes after a pychecker run.
6103 * Small cleanups and fixes after a pychecker run.
6090
6104
6091 * Changed the @cd command to handle @cd - and @cd -<n> for
6105 * Changed the @cd command to handle @cd - and @cd -<n> for
6092 visiting any directory in _dh.
6106 visiting any directory in _dh.
6093
6107
6094 * Introduced _dh, a history of visited directories. @dhist prints
6108 * Introduced _dh, a history of visited directories. @dhist prints
6095 it out with numbers.
6109 it out with numbers.
6096
6110
6097 2001-12-07 Fernando Perez <fperez@colorado.edu>
6111 2001-12-07 Fernando Perez <fperez@colorado.edu>
6098
6112
6099 * Released 0.1.22
6113 * Released 0.1.22
6100
6114
6101 * Made initialization a bit more robust against invalid color
6115 * Made initialization a bit more robust against invalid color
6102 options in user input (exit, not traceback-crash).
6116 options in user input (exit, not traceback-crash).
6103
6117
6104 * Changed the bug crash reporter to write the report only in the
6118 * Changed the bug crash reporter to write the report only in the
6105 user's .ipython directory. That way IPython won't litter people's
6119 user's .ipython directory. That way IPython won't litter people's
6106 hard disks with crash files all over the place. Also print on
6120 hard disks with crash files all over the place. Also print on
6107 screen the necessary mail command.
6121 screen the necessary mail command.
6108
6122
6109 * With the new ultraTB, implemented LightBG color scheme for light
6123 * With the new ultraTB, implemented LightBG color scheme for light
6110 background terminals. A lot of people like white backgrounds, so I
6124 background terminals. A lot of people like white backgrounds, so I
6111 guess we should at least give them something readable.
6125 guess we should at least give them something readable.
6112
6126
6113 2001-12-06 Fernando Perez <fperez@colorado.edu>
6127 2001-12-06 Fernando Perez <fperez@colorado.edu>
6114
6128
6115 * Modified the structure of ultraTB. Now there's a proper class
6129 * Modified the structure of ultraTB. Now there's a proper class
6116 for tables of color schemes which allow adding schemes easily and
6130 for tables of color schemes which allow adding schemes easily and
6117 switching the active scheme without creating a new instance every
6131 switching the active scheme without creating a new instance every
6118 time (which was ridiculous). The syntax for creating new schemes
6132 time (which was ridiculous). The syntax for creating new schemes
6119 is also cleaner. I think ultraTB is finally done, with a clean
6133 is also cleaner. I think ultraTB is finally done, with a clean
6120 class structure. Names are also much cleaner (now there's proper
6134 class structure. Names are also much cleaner (now there's proper
6121 color tables, no need for every variable to also have 'color' in
6135 color tables, no need for every variable to also have 'color' in
6122 its name).
6136 its name).
6123
6137
6124 * Broke down genutils into separate files. Now genutils only
6138 * Broke down genutils into separate files. Now genutils only
6125 contains utility functions, and classes have been moved to their
6139 contains utility functions, and classes have been moved to their
6126 own files (they had enough independent functionality to warrant
6140 own files (they had enough independent functionality to warrant
6127 it): ConfigLoader, OutputTrap, Struct.
6141 it): ConfigLoader, OutputTrap, Struct.
6128
6142
6129 2001-12-05 Fernando Perez <fperez@colorado.edu>
6143 2001-12-05 Fernando Perez <fperez@colorado.edu>
6130
6144
6131 * IPython turns 21! Released version 0.1.21, as a candidate for
6145 * IPython turns 21! Released version 0.1.21, as a candidate for
6132 public consumption. If all goes well, release in a few days.
6146 public consumption. If all goes well, release in a few days.
6133
6147
6134 * Fixed path bug (files in Extensions/ directory wouldn't be found
6148 * Fixed path bug (files in Extensions/ directory wouldn't be found
6135 unless IPython/ was explicitly in sys.path).
6149 unless IPython/ was explicitly in sys.path).
6136
6150
6137 * Extended the FlexCompleter class as MagicCompleter to allow
6151 * Extended the FlexCompleter class as MagicCompleter to allow
6138 completion of @-starting lines.
6152 completion of @-starting lines.
6139
6153
6140 * Created __release__.py file as a central repository for release
6154 * Created __release__.py file as a central repository for release
6141 info that other files can read from.
6155 info that other files can read from.
6142
6156
6143 * Fixed small bug in logging: when logging was turned on in
6157 * Fixed small bug in logging: when logging was turned on in
6144 mid-session, old lines with special meanings (!@?) were being
6158 mid-session, old lines with special meanings (!@?) were being
6145 logged without the prepended comment, which is necessary since
6159 logged without the prepended comment, which is necessary since
6146 they are not truly valid python syntax. This should make session
6160 they are not truly valid python syntax. This should make session
6147 restores produce less errors.
6161 restores produce less errors.
6148
6162
6149 * The namespace cleanup forced me to make a FlexCompleter class
6163 * The namespace cleanup forced me to make a FlexCompleter class
6150 which is nothing but a ripoff of rlcompleter, but with selectable
6164 which is nothing but a ripoff of rlcompleter, but with selectable
6151 namespace (rlcompleter only works in __main__.__dict__). I'll try
6165 namespace (rlcompleter only works in __main__.__dict__). I'll try
6152 to submit a note to the authors to see if this change can be
6166 to submit a note to the authors to see if this change can be
6153 incorporated in future rlcompleter releases (Dec.6: done)
6167 incorporated in future rlcompleter releases (Dec.6: done)
6154
6168
6155 * More fixes to namespace handling. It was a mess! Now all
6169 * More fixes to namespace handling. It was a mess! Now all
6156 explicit references to __main__.__dict__ are gone (except when
6170 explicit references to __main__.__dict__ are gone (except when
6157 really needed) and everything is handled through the namespace
6171 really needed) and everything is handled through the namespace
6158 dicts in the IPython instance. We seem to be getting somewhere
6172 dicts in the IPython instance. We seem to be getting somewhere
6159 with this, finally...
6173 with this, finally...
6160
6174
6161 * Small documentation updates.
6175 * Small documentation updates.
6162
6176
6163 * Created the Extensions directory under IPython (with an
6177 * Created the Extensions directory under IPython (with an
6164 __init__.py). Put the PhysicalQ stuff there. This directory should
6178 __init__.py). Put the PhysicalQ stuff there. This directory should
6165 be used for all special-purpose extensions.
6179 be used for all special-purpose extensions.
6166
6180
6167 * File renaming:
6181 * File renaming:
6168 ipythonlib --> ipmaker
6182 ipythonlib --> ipmaker
6169 ipplib --> iplib
6183 ipplib --> iplib
6170 This makes a bit more sense in terms of what these files actually do.
6184 This makes a bit more sense in terms of what these files actually do.
6171
6185
6172 * Moved all the classes and functions in ipythonlib to ipplib, so
6186 * Moved all the classes and functions in ipythonlib to ipplib, so
6173 now ipythonlib only has make_IPython(). This will ease up its
6187 now ipythonlib only has make_IPython(). This will ease up its
6174 splitting in smaller functional chunks later.
6188 splitting in smaller functional chunks later.
6175
6189
6176 * Cleaned up (done, I think) output of @whos. Better column
6190 * Cleaned up (done, I think) output of @whos. Better column
6177 formatting, and now shows str(var) for as much as it can, which is
6191 formatting, and now shows str(var) for as much as it can, which is
6178 typically what one gets with a 'print var'.
6192 typically what one gets with a 'print var'.
6179
6193
6180 2001-12-04 Fernando Perez <fperez@colorado.edu>
6194 2001-12-04 Fernando Perez <fperez@colorado.edu>
6181
6195
6182 * Fixed namespace problems. Now builtin/IPyhton/user names get
6196 * Fixed namespace problems. Now builtin/IPyhton/user names get
6183 properly reported in their namespace. Internal namespace handling
6197 properly reported in their namespace. Internal namespace handling
6184 is finally getting decent (not perfect yet, but much better than
6198 is finally getting decent (not perfect yet, but much better than
6185 the ad-hoc mess we had).
6199 the ad-hoc mess we had).
6186
6200
6187 * Removed -exit option. If people just want to run a python
6201 * Removed -exit option. If people just want to run a python
6188 script, that's what the normal interpreter is for. Less
6202 script, that's what the normal interpreter is for. Less
6189 unnecessary options, less chances for bugs.
6203 unnecessary options, less chances for bugs.
6190
6204
6191 * Added a crash handler which generates a complete post-mortem if
6205 * Added a crash handler which generates a complete post-mortem if
6192 IPython crashes. This will help a lot in tracking bugs down the
6206 IPython crashes. This will help a lot in tracking bugs down the
6193 road.
6207 road.
6194
6208
6195 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6209 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6196 which were boud to functions being reassigned would bypass the
6210 which were boud to functions being reassigned would bypass the
6197 logger, breaking the sync of _il with the prompt counter. This
6211 logger, breaking the sync of _il with the prompt counter. This
6198 would then crash IPython later when a new line was logged.
6212 would then crash IPython later when a new line was logged.
6199
6213
6200 2001-12-02 Fernando Perez <fperez@colorado.edu>
6214 2001-12-02 Fernando Perez <fperez@colorado.edu>
6201
6215
6202 * Made IPython a package. This means people don't have to clutter
6216 * Made IPython a package. This means people don't have to clutter
6203 their sys.path with yet another directory. Changed the INSTALL
6217 their sys.path with yet another directory. Changed the INSTALL
6204 file accordingly.
6218 file accordingly.
6205
6219
6206 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6220 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6207 sorts its output (so @who shows it sorted) and @whos formats the
6221 sorts its output (so @who shows it sorted) and @whos formats the
6208 table according to the width of the first column. Nicer, easier to
6222 table according to the width of the first column. Nicer, easier to
6209 read. Todo: write a generic table_format() which takes a list of
6223 read. Todo: write a generic table_format() which takes a list of
6210 lists and prints it nicely formatted, with optional row/column
6224 lists and prints it nicely formatted, with optional row/column
6211 separators and proper padding and justification.
6225 separators and proper padding and justification.
6212
6226
6213 * Released 0.1.20
6227 * Released 0.1.20
6214
6228
6215 * Fixed bug in @log which would reverse the inputcache list (a
6229 * Fixed bug in @log which would reverse the inputcache list (a
6216 copy operation was missing).
6230 copy operation was missing).
6217
6231
6218 * Code cleanup. @config was changed to use page(). Better, since
6232 * Code cleanup. @config was changed to use page(). Better, since
6219 its output is always quite long.
6233 its output is always quite long.
6220
6234
6221 * Itpl is back as a dependency. I was having too many problems
6235 * Itpl is back as a dependency. I was having too many problems
6222 getting the parametric aliases to work reliably, and it's just
6236 getting the parametric aliases to work reliably, and it's just
6223 easier to code weird string operations with it than playing %()s
6237 easier to code weird string operations with it than playing %()s
6224 games. It's only ~6k, so I don't think it's too big a deal.
6238 games. It's only ~6k, so I don't think it's too big a deal.
6225
6239
6226 * Found (and fixed) a very nasty bug with history. !lines weren't
6240 * Found (and fixed) a very nasty bug with history. !lines weren't
6227 getting cached, and the out of sync caches would crash
6241 getting cached, and the out of sync caches would crash
6228 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6242 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6229 division of labor a bit better. Bug fixed, cleaner structure.
6243 division of labor a bit better. Bug fixed, cleaner structure.
6230
6244
6231 2001-12-01 Fernando Perez <fperez@colorado.edu>
6245 2001-12-01 Fernando Perez <fperez@colorado.edu>
6232
6246
6233 * Released 0.1.19
6247 * Released 0.1.19
6234
6248
6235 * Added option -n to @hist to prevent line number printing. Much
6249 * Added option -n to @hist to prevent line number printing. Much
6236 easier to copy/paste code this way.
6250 easier to copy/paste code this way.
6237
6251
6238 * Created global _il to hold the input list. Allows easy
6252 * Created global _il to hold the input list. Allows easy
6239 re-execution of blocks of code by slicing it (inspired by Janko's
6253 re-execution of blocks of code by slicing it (inspired by Janko's
6240 comment on 'macros').
6254 comment on 'macros').
6241
6255
6242 * Small fixes and doc updates.
6256 * Small fixes and doc updates.
6243
6257
6244 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6258 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6245 much too fragile with automagic. Handles properly multi-line
6259 much too fragile with automagic. Handles properly multi-line
6246 statements and takes parameters.
6260 statements and takes parameters.
6247
6261
6248 2001-11-30 Fernando Perez <fperez@colorado.edu>
6262 2001-11-30 Fernando Perez <fperez@colorado.edu>
6249
6263
6250 * Version 0.1.18 released.
6264 * Version 0.1.18 released.
6251
6265
6252 * Fixed nasty namespace bug in initial module imports.
6266 * Fixed nasty namespace bug in initial module imports.
6253
6267
6254 * Added copyright/license notes to all code files (except
6268 * Added copyright/license notes to all code files (except
6255 DPyGetOpt). For the time being, LGPL. That could change.
6269 DPyGetOpt). For the time being, LGPL. That could change.
6256
6270
6257 * Rewrote a much nicer README, updated INSTALL, cleaned up
6271 * Rewrote a much nicer README, updated INSTALL, cleaned up
6258 ipythonrc-* samples.
6272 ipythonrc-* samples.
6259
6273
6260 * Overall code/documentation cleanup. Basically ready for
6274 * Overall code/documentation cleanup. Basically ready for
6261 release. Only remaining thing: licence decision (LGPL?).
6275 release. Only remaining thing: licence decision (LGPL?).
6262
6276
6263 * Converted load_config to a class, ConfigLoader. Now recursion
6277 * Converted load_config to a class, ConfigLoader. Now recursion
6264 control is better organized. Doesn't include the same file twice.
6278 control is better organized. Doesn't include the same file twice.
6265
6279
6266 2001-11-29 Fernando Perez <fperez@colorado.edu>
6280 2001-11-29 Fernando Perez <fperez@colorado.edu>
6267
6281
6268 * Got input history working. Changed output history variables from
6282 * Got input history working. Changed output history variables from
6269 _p to _o so that _i is for input and _o for output. Just cleaner
6283 _p to _o so that _i is for input and _o for output. Just cleaner
6270 convention.
6284 convention.
6271
6285
6272 * Implemented parametric aliases. This pretty much allows the
6286 * Implemented parametric aliases. This pretty much allows the
6273 alias system to offer full-blown shell convenience, I think.
6287 alias system to offer full-blown shell convenience, I think.
6274
6288
6275 * Version 0.1.17 released, 0.1.18 opened.
6289 * Version 0.1.17 released, 0.1.18 opened.
6276
6290
6277 * dot_ipython/ipythonrc (alias): added documentation.
6291 * dot_ipython/ipythonrc (alias): added documentation.
6278 (xcolor): Fixed small bug (xcolors -> xcolor)
6292 (xcolor): Fixed small bug (xcolors -> xcolor)
6279
6293
6280 * Changed the alias system. Now alias is a magic command to define
6294 * Changed the alias system. Now alias is a magic command to define
6281 aliases just like the shell. Rationale: the builtin magics should
6295 aliases just like the shell. Rationale: the builtin magics should
6282 be there for things deeply connected to IPython's
6296 be there for things deeply connected to IPython's
6283 architecture. And this is a much lighter system for what I think
6297 architecture. And this is a much lighter system for what I think
6284 is the really important feature: allowing users to define quickly
6298 is the really important feature: allowing users to define quickly
6285 magics that will do shell things for them, so they can customize
6299 magics that will do shell things for them, so they can customize
6286 IPython easily to match their work habits. If someone is really
6300 IPython easily to match their work habits. If someone is really
6287 desperate to have another name for a builtin alias, they can
6301 desperate to have another name for a builtin alias, they can
6288 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6302 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6289 works.
6303 works.
6290
6304
6291 2001-11-28 Fernando Perez <fperez@colorado.edu>
6305 2001-11-28 Fernando Perez <fperez@colorado.edu>
6292
6306
6293 * Changed @file so that it opens the source file at the proper
6307 * Changed @file so that it opens the source file at the proper
6294 line. Since it uses less, if your EDITOR environment is
6308 line. Since it uses less, if your EDITOR environment is
6295 configured, typing v will immediately open your editor of choice
6309 configured, typing v will immediately open your editor of choice
6296 right at the line where the object is defined. Not as quick as
6310 right at the line where the object is defined. Not as quick as
6297 having a direct @edit command, but for all intents and purposes it
6311 having a direct @edit command, but for all intents and purposes it
6298 works. And I don't have to worry about writing @edit to deal with
6312 works. And I don't have to worry about writing @edit to deal with
6299 all the editors, less does that.
6313 all the editors, less does that.
6300
6314
6301 * Version 0.1.16 released, 0.1.17 opened.
6315 * Version 0.1.16 released, 0.1.17 opened.
6302
6316
6303 * Fixed some nasty bugs in the page/page_dumb combo that could
6317 * Fixed some nasty bugs in the page/page_dumb combo that could
6304 crash IPython.
6318 crash IPython.
6305
6319
6306 2001-11-27 Fernando Perez <fperez@colorado.edu>
6320 2001-11-27 Fernando Perez <fperez@colorado.edu>
6307
6321
6308 * Version 0.1.15 released, 0.1.16 opened.
6322 * Version 0.1.15 released, 0.1.16 opened.
6309
6323
6310 * Finally got ? and ?? to work for undefined things: now it's
6324 * Finally got ? and ?? to work for undefined things: now it's
6311 possible to type {}.get? and get information about the get method
6325 possible to type {}.get? and get information about the get method
6312 of dicts, or os.path? even if only os is defined (so technically
6326 of dicts, or os.path? even if only os is defined (so technically
6313 os.path isn't). Works at any level. For example, after import os,
6327 os.path isn't). Works at any level. For example, after import os,
6314 os?, os.path?, os.path.abspath? all work. This is great, took some
6328 os?, os.path?, os.path.abspath? all work. This is great, took some
6315 work in _ofind.
6329 work in _ofind.
6316
6330
6317 * Fixed more bugs with logging. The sanest way to do it was to add
6331 * Fixed more bugs with logging. The sanest way to do it was to add
6318 to @log a 'mode' parameter. Killed two in one shot (this mode
6332 to @log a 'mode' parameter. Killed two in one shot (this mode
6319 option was a request of Janko's). I think it's finally clean
6333 option was a request of Janko's). I think it's finally clean
6320 (famous last words).
6334 (famous last words).
6321
6335
6322 * Added a page_dumb() pager which does a decent job of paging on
6336 * Added a page_dumb() pager which does a decent job of paging on
6323 screen, if better things (like less) aren't available. One less
6337 screen, if better things (like less) aren't available. One less
6324 unix dependency (someday maybe somebody will port this to
6338 unix dependency (someday maybe somebody will port this to
6325 windows).
6339 windows).
6326
6340
6327 * Fixed problem in magic_log: would lock of logging out if log
6341 * Fixed problem in magic_log: would lock of logging out if log
6328 creation failed (because it would still think it had succeeded).
6342 creation failed (because it would still think it had succeeded).
6329
6343
6330 * Improved the page() function using curses to auto-detect screen
6344 * Improved the page() function using curses to auto-detect screen
6331 size. Now it can make a much better decision on whether to print
6345 size. Now it can make a much better decision on whether to print
6332 or page a string. Option screen_length was modified: a value 0
6346 or page a string. Option screen_length was modified: a value 0
6333 means auto-detect, and that's the default now.
6347 means auto-detect, and that's the default now.
6334
6348
6335 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6349 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6336 go out. I'll test it for a few days, then talk to Janko about
6350 go out. I'll test it for a few days, then talk to Janko about
6337 licences and announce it.
6351 licences and announce it.
6338
6352
6339 * Fixed the length of the auto-generated ---> prompt which appears
6353 * Fixed the length of the auto-generated ---> prompt which appears
6340 for auto-parens and auto-quotes. Getting this right isn't trivial,
6354 for auto-parens and auto-quotes. Getting this right isn't trivial,
6341 with all the color escapes, different prompt types and optional
6355 with all the color escapes, different prompt types and optional
6342 separators. But it seems to be working in all the combinations.
6356 separators. But it seems to be working in all the combinations.
6343
6357
6344 2001-11-26 Fernando Perez <fperez@colorado.edu>
6358 2001-11-26 Fernando Perez <fperez@colorado.edu>
6345
6359
6346 * Wrote a regexp filter to get option types from the option names
6360 * Wrote a regexp filter to get option types from the option names
6347 string. This eliminates the need to manually keep two duplicate
6361 string. This eliminates the need to manually keep two duplicate
6348 lists.
6362 lists.
6349
6363
6350 * Removed the unneeded check_option_names. Now options are handled
6364 * Removed the unneeded check_option_names. Now options are handled
6351 in a much saner manner and it's easy to visually check that things
6365 in a much saner manner and it's easy to visually check that things
6352 are ok.
6366 are ok.
6353
6367
6354 * Updated version numbers on all files I modified to carry a
6368 * Updated version numbers on all files I modified to carry a
6355 notice so Janko and Nathan have clear version markers.
6369 notice so Janko and Nathan have clear version markers.
6356
6370
6357 * Updated docstring for ultraTB with my changes. I should send
6371 * Updated docstring for ultraTB with my changes. I should send
6358 this to Nathan.
6372 this to Nathan.
6359
6373
6360 * Lots of small fixes. Ran everything through pychecker again.
6374 * Lots of small fixes. Ran everything through pychecker again.
6361
6375
6362 * Made loading of deep_reload an cmd line option. If it's not too
6376 * Made loading of deep_reload an cmd line option. If it's not too
6363 kosher, now people can just disable it. With -nodeep_reload it's
6377 kosher, now people can just disable it. With -nodeep_reload it's
6364 still available as dreload(), it just won't overwrite reload().
6378 still available as dreload(), it just won't overwrite reload().
6365
6379
6366 * Moved many options to the no| form (-opt and -noopt
6380 * Moved many options to the no| form (-opt and -noopt
6367 accepted). Cleaner.
6381 accepted). Cleaner.
6368
6382
6369 * Changed magic_log so that if called with no parameters, it uses
6383 * Changed magic_log so that if called with no parameters, it uses
6370 'rotate' mode. That way auto-generated logs aren't automatically
6384 'rotate' mode. That way auto-generated logs aren't automatically
6371 over-written. For normal logs, now a backup is made if it exists
6385 over-written. For normal logs, now a backup is made if it exists
6372 (only 1 level of backups). A new 'backup' mode was added to the
6386 (only 1 level of backups). A new 'backup' mode was added to the
6373 Logger class to support this. This was a request by Janko.
6387 Logger class to support this. This was a request by Janko.
6374
6388
6375 * Added @logoff/@logon to stop/restart an active log.
6389 * Added @logoff/@logon to stop/restart an active log.
6376
6390
6377 * Fixed a lot of bugs in log saving/replay. It was pretty
6391 * Fixed a lot of bugs in log saving/replay. It was pretty
6378 broken. Now special lines (!@,/) appear properly in the command
6392 broken. Now special lines (!@,/) appear properly in the command
6379 history after a log replay.
6393 history after a log replay.
6380
6394
6381 * Tried and failed to implement full session saving via pickle. My
6395 * Tried and failed to implement full session saving via pickle. My
6382 idea was to pickle __main__.__dict__, but modules can't be
6396 idea was to pickle __main__.__dict__, but modules can't be
6383 pickled. This would be a better alternative to replaying logs, but
6397 pickled. This would be a better alternative to replaying logs, but
6384 seems quite tricky to get to work. Changed -session to be called
6398 seems quite tricky to get to work. Changed -session to be called
6385 -logplay, which more accurately reflects what it does. And if we
6399 -logplay, which more accurately reflects what it does. And if we
6386 ever get real session saving working, -session is now available.
6400 ever get real session saving working, -session is now available.
6387
6401
6388 * Implemented color schemes for prompts also. As for tracebacks,
6402 * Implemented color schemes for prompts also. As for tracebacks,
6389 currently only NoColor and Linux are supported. But now the
6403 currently only NoColor and Linux are supported. But now the
6390 infrastructure is in place, based on a generic ColorScheme
6404 infrastructure is in place, based on a generic ColorScheme
6391 class. So writing and activating new schemes both for the prompts
6405 class. So writing and activating new schemes both for the prompts
6392 and the tracebacks should be straightforward.
6406 and the tracebacks should be straightforward.
6393
6407
6394 * Version 0.1.13 released, 0.1.14 opened.
6408 * Version 0.1.13 released, 0.1.14 opened.
6395
6409
6396 * Changed handling of options for output cache. Now counter is
6410 * Changed handling of options for output cache. Now counter is
6397 hardwired starting at 1 and one specifies the maximum number of
6411 hardwired starting at 1 and one specifies the maximum number of
6398 entries *in the outcache* (not the max prompt counter). This is
6412 entries *in the outcache* (not the max prompt counter). This is
6399 much better, since many statements won't increase the cache
6413 much better, since many statements won't increase the cache
6400 count. It also eliminated some confusing options, now there's only
6414 count. It also eliminated some confusing options, now there's only
6401 one: cache_size.
6415 one: cache_size.
6402
6416
6403 * Added 'alias' magic function and magic_alias option in the
6417 * Added 'alias' magic function and magic_alias option in the
6404 ipythonrc file. Now the user can easily define whatever names he
6418 ipythonrc file. Now the user can easily define whatever names he
6405 wants for the magic functions without having to play weird
6419 wants for the magic functions without having to play weird
6406 namespace games. This gives IPython a real shell-like feel.
6420 namespace games. This gives IPython a real shell-like feel.
6407
6421
6408 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6422 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6409 @ or not).
6423 @ or not).
6410
6424
6411 This was one of the last remaining 'visible' bugs (that I know
6425 This was one of the last remaining 'visible' bugs (that I know
6412 of). I think if I can clean up the session loading so it works
6426 of). I think if I can clean up the session loading so it works
6413 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6427 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6414 about licensing).
6428 about licensing).
6415
6429
6416 2001-11-25 Fernando Perez <fperez@colorado.edu>
6430 2001-11-25 Fernando Perez <fperez@colorado.edu>
6417
6431
6418 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6432 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6419 there's a cleaner distinction between what ? and ?? show.
6433 there's a cleaner distinction between what ? and ?? show.
6420
6434
6421 * Added screen_length option. Now the user can define his own
6435 * Added screen_length option. Now the user can define his own
6422 screen size for page() operations.
6436 screen size for page() operations.
6423
6437
6424 * Implemented magic shell-like functions with automatic code
6438 * Implemented magic shell-like functions with automatic code
6425 generation. Now adding another function is just a matter of adding
6439 generation. Now adding another function is just a matter of adding
6426 an entry to a dict, and the function is dynamically generated at
6440 an entry to a dict, and the function is dynamically generated at
6427 run-time. Python has some really cool features!
6441 run-time. Python has some really cool features!
6428
6442
6429 * Renamed many options to cleanup conventions a little. Now all
6443 * Renamed many options to cleanup conventions a little. Now all
6430 are lowercase, and only underscores where needed. Also in the code
6444 are lowercase, and only underscores where needed. Also in the code
6431 option name tables are clearer.
6445 option name tables are clearer.
6432
6446
6433 * Changed prompts a little. Now input is 'In [n]:' instead of
6447 * Changed prompts a little. Now input is 'In [n]:' instead of
6434 'In[n]:='. This allows it the numbers to be aligned with the
6448 'In[n]:='. This allows it the numbers to be aligned with the
6435 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6449 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6436 Python (it was a Mathematica thing). The '...' continuation prompt
6450 Python (it was a Mathematica thing). The '...' continuation prompt
6437 was also changed a little to align better.
6451 was also changed a little to align better.
6438
6452
6439 * Fixed bug when flushing output cache. Not all _p<n> variables
6453 * Fixed bug when flushing output cache. Not all _p<n> variables
6440 exist, so their deletion needs to be wrapped in a try:
6454 exist, so their deletion needs to be wrapped in a try:
6441
6455
6442 * Figured out how to properly use inspect.formatargspec() (it
6456 * Figured out how to properly use inspect.formatargspec() (it
6443 requires the args preceded by *). So I removed all the code from
6457 requires the args preceded by *). So I removed all the code from
6444 _get_pdef in Magic, which was just replicating that.
6458 _get_pdef in Magic, which was just replicating that.
6445
6459
6446 * Added test to prefilter to allow redefining magic function names
6460 * Added test to prefilter to allow redefining magic function names
6447 as variables. This is ok, since the @ form is always available,
6461 as variables. This is ok, since the @ form is always available,
6448 but whe should allow the user to define a variable called 'ls' if
6462 but whe should allow the user to define a variable called 'ls' if
6449 he needs it.
6463 he needs it.
6450
6464
6451 * Moved the ToDo information from README into a separate ToDo.
6465 * Moved the ToDo information from README into a separate ToDo.
6452
6466
6453 * General code cleanup and small bugfixes. I think it's close to a
6467 * General code cleanup and small bugfixes. I think it's close to a
6454 state where it can be released, obviously with a big 'beta'
6468 state where it can be released, obviously with a big 'beta'
6455 warning on it.
6469 warning on it.
6456
6470
6457 * Got the magic function split to work. Now all magics are defined
6471 * Got the magic function split to work. Now all magics are defined
6458 in a separate class. It just organizes things a bit, and now
6472 in a separate class. It just organizes things a bit, and now
6459 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6473 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6460 was too long).
6474 was too long).
6461
6475
6462 * Changed @clear to @reset to avoid potential confusions with
6476 * Changed @clear to @reset to avoid potential confusions with
6463 the shell command clear. Also renamed @cl to @clear, which does
6477 the shell command clear. Also renamed @cl to @clear, which does
6464 exactly what people expect it to from their shell experience.
6478 exactly what people expect it to from their shell experience.
6465
6479
6466 Added a check to the @reset command (since it's so
6480 Added a check to the @reset command (since it's so
6467 destructive, it's probably a good idea to ask for confirmation).
6481 destructive, it's probably a good idea to ask for confirmation).
6468 But now reset only works for full namespace resetting. Since the
6482 But now reset only works for full namespace resetting. Since the
6469 del keyword is already there for deleting a few specific
6483 del keyword is already there for deleting a few specific
6470 variables, I don't see the point of having a redundant magic
6484 variables, I don't see the point of having a redundant magic
6471 function for the same task.
6485 function for the same task.
6472
6486
6473 2001-11-24 Fernando Perez <fperez@colorado.edu>
6487 2001-11-24 Fernando Perez <fperez@colorado.edu>
6474
6488
6475 * Updated the builtin docs (esp. the ? ones).
6489 * Updated the builtin docs (esp. the ? ones).
6476
6490
6477 * Ran all the code through pychecker. Not terribly impressed with
6491 * Ran all the code through pychecker. Not terribly impressed with
6478 it: lots of spurious warnings and didn't really find anything of
6492 it: lots of spurious warnings and didn't really find anything of
6479 substance (just a few modules being imported and not used).
6493 substance (just a few modules being imported and not used).
6480
6494
6481 * Implemented the new ultraTB functionality into IPython. New
6495 * Implemented the new ultraTB functionality into IPython. New
6482 option: xcolors. This chooses color scheme. xmode now only selects
6496 option: xcolors. This chooses color scheme. xmode now only selects
6483 between Plain and Verbose. Better orthogonality.
6497 between Plain and Verbose. Better orthogonality.
6484
6498
6485 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6499 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6486 mode and color scheme for the exception handlers. Now it's
6500 mode and color scheme for the exception handlers. Now it's
6487 possible to have the verbose traceback with no coloring.
6501 possible to have the verbose traceback with no coloring.
6488
6502
6489 2001-11-23 Fernando Perez <fperez@colorado.edu>
6503 2001-11-23 Fernando Perez <fperez@colorado.edu>
6490
6504
6491 * Version 0.1.12 released, 0.1.13 opened.
6505 * Version 0.1.12 released, 0.1.13 opened.
6492
6506
6493 * Removed option to set auto-quote and auto-paren escapes by
6507 * Removed option to set auto-quote and auto-paren escapes by
6494 user. The chances of breaking valid syntax are just too high. If
6508 user. The chances of breaking valid syntax are just too high. If
6495 someone *really* wants, they can always dig into the code.
6509 someone *really* wants, they can always dig into the code.
6496
6510
6497 * Made prompt separators configurable.
6511 * Made prompt separators configurable.
6498
6512
6499 2001-11-22 Fernando Perez <fperez@colorado.edu>
6513 2001-11-22 Fernando Perez <fperez@colorado.edu>
6500
6514
6501 * Small bugfixes in many places.
6515 * Small bugfixes in many places.
6502
6516
6503 * Removed the MyCompleter class from ipplib. It seemed redundant
6517 * Removed the MyCompleter class from ipplib. It seemed redundant
6504 with the C-p,C-n history search functionality. Less code to
6518 with the C-p,C-n history search functionality. Less code to
6505 maintain.
6519 maintain.
6506
6520
6507 * Moved all the original ipython.py code into ipythonlib.py. Right
6521 * Moved all the original ipython.py code into ipythonlib.py. Right
6508 now it's just one big dump into a function called make_IPython, so
6522 now it's just one big dump into a function called make_IPython, so
6509 no real modularity has been gained. But at least it makes the
6523 no real modularity has been gained. But at least it makes the
6510 wrapper script tiny, and since ipythonlib is a module, it gets
6524 wrapper script tiny, and since ipythonlib is a module, it gets
6511 compiled and startup is much faster.
6525 compiled and startup is much faster.
6512
6526
6513 This is a reasobably 'deep' change, so we should test it for a
6527 This is a reasobably 'deep' change, so we should test it for a
6514 while without messing too much more with the code.
6528 while without messing too much more with the code.
6515
6529
6516 2001-11-21 Fernando Perez <fperez@colorado.edu>
6530 2001-11-21 Fernando Perez <fperez@colorado.edu>
6517
6531
6518 * Version 0.1.11 released, 0.1.12 opened for further work.
6532 * Version 0.1.11 released, 0.1.12 opened for further work.
6519
6533
6520 * Removed dependency on Itpl. It was only needed in one place. It
6534 * Removed dependency on Itpl. It was only needed in one place. It
6521 would be nice if this became part of python, though. It makes life
6535 would be nice if this became part of python, though. It makes life
6522 *a lot* easier in some cases.
6536 *a lot* easier in some cases.
6523
6537
6524 * Simplified the prefilter code a bit. Now all handlers are
6538 * Simplified the prefilter code a bit. Now all handlers are
6525 expected to explicitly return a value (at least a blank string).
6539 expected to explicitly return a value (at least a blank string).
6526
6540
6527 * Heavy edits in ipplib. Removed the help system altogether. Now
6541 * Heavy edits in ipplib. Removed the help system altogether. Now
6528 obj?/?? is used for inspecting objects, a magic @doc prints
6542 obj?/?? is used for inspecting objects, a magic @doc prints
6529 docstrings, and full-blown Python help is accessed via the 'help'
6543 docstrings, and full-blown Python help is accessed via the 'help'
6530 keyword. This cleans up a lot of code (less to maintain) and does
6544 keyword. This cleans up a lot of code (less to maintain) and does
6531 the job. Since 'help' is now a standard Python component, might as
6545 the job. Since 'help' is now a standard Python component, might as
6532 well use it and remove duplicate functionality.
6546 well use it and remove duplicate functionality.
6533
6547
6534 Also removed the option to use ipplib as a standalone program. By
6548 Also removed the option to use ipplib as a standalone program. By
6535 now it's too dependent on other parts of IPython to function alone.
6549 now it's too dependent on other parts of IPython to function alone.
6536
6550
6537 * Fixed bug in genutils.pager. It would crash if the pager was
6551 * Fixed bug in genutils.pager. It would crash if the pager was
6538 exited immediately after opening (broken pipe).
6552 exited immediately after opening (broken pipe).
6539
6553
6540 * Trimmed down the VerboseTB reporting a little. The header is
6554 * Trimmed down the VerboseTB reporting a little. The header is
6541 much shorter now and the repeated exception arguments at the end
6555 much shorter now and the repeated exception arguments at the end
6542 have been removed. For interactive use the old header seemed a bit
6556 have been removed. For interactive use the old header seemed a bit
6543 excessive.
6557 excessive.
6544
6558
6545 * Fixed small bug in output of @whos for variables with multi-word
6559 * Fixed small bug in output of @whos for variables with multi-word
6546 types (only first word was displayed).
6560 types (only first word was displayed).
6547
6561
6548 2001-11-17 Fernando Perez <fperez@colorado.edu>
6562 2001-11-17 Fernando Perez <fperez@colorado.edu>
6549
6563
6550 * Version 0.1.10 released, 0.1.11 opened for further work.
6564 * Version 0.1.10 released, 0.1.11 opened for further work.
6551
6565
6552 * Modified dirs and friends. dirs now *returns* the stack (not
6566 * Modified dirs and friends. dirs now *returns* the stack (not
6553 prints), so one can manipulate it as a variable. Convenient to
6567 prints), so one can manipulate it as a variable. Convenient to
6554 travel along many directories.
6568 travel along many directories.
6555
6569
6556 * Fixed bug in magic_pdef: would only work with functions with
6570 * Fixed bug in magic_pdef: would only work with functions with
6557 arguments with default values.
6571 arguments with default values.
6558
6572
6559 2001-11-14 Fernando Perez <fperez@colorado.edu>
6573 2001-11-14 Fernando Perez <fperez@colorado.edu>
6560
6574
6561 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6575 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6562 example with IPython. Various other minor fixes and cleanups.
6576 example with IPython. Various other minor fixes and cleanups.
6563
6577
6564 * Version 0.1.9 released, 0.1.10 opened for further work.
6578 * Version 0.1.9 released, 0.1.10 opened for further work.
6565
6579
6566 * Added sys.path to the list of directories searched in the
6580 * Added sys.path to the list of directories searched in the
6567 execfile= option. It used to be the current directory and the
6581 execfile= option. It used to be the current directory and the
6568 user's IPYTHONDIR only.
6582 user's IPYTHONDIR only.
6569
6583
6570 2001-11-13 Fernando Perez <fperez@colorado.edu>
6584 2001-11-13 Fernando Perez <fperez@colorado.edu>
6571
6585
6572 * Reinstated the raw_input/prefilter separation that Janko had
6586 * Reinstated the raw_input/prefilter separation that Janko had
6573 initially. This gives a more convenient setup for extending the
6587 initially. This gives a more convenient setup for extending the
6574 pre-processor from the outside: raw_input always gets a string,
6588 pre-processor from the outside: raw_input always gets a string,
6575 and prefilter has to process it. We can then redefine prefilter
6589 and prefilter has to process it. We can then redefine prefilter
6576 from the outside and implement extensions for special
6590 from the outside and implement extensions for special
6577 purposes.
6591 purposes.
6578
6592
6579 Today I got one for inputting PhysicalQuantity objects
6593 Today I got one for inputting PhysicalQuantity objects
6580 (from Scientific) without needing any function calls at
6594 (from Scientific) without needing any function calls at
6581 all. Extremely convenient, and it's all done as a user-level
6595 all. Extremely convenient, and it's all done as a user-level
6582 extension (no IPython code was touched). Now instead of:
6596 extension (no IPython code was touched). Now instead of:
6583 a = PhysicalQuantity(4.2,'m/s**2')
6597 a = PhysicalQuantity(4.2,'m/s**2')
6584 one can simply say
6598 one can simply say
6585 a = 4.2 m/s**2
6599 a = 4.2 m/s**2
6586 or even
6600 or even
6587 a = 4.2 m/s^2
6601 a = 4.2 m/s^2
6588
6602
6589 I use this, but it's also a proof of concept: IPython really is
6603 I use this, but it's also a proof of concept: IPython really is
6590 fully user-extensible, even at the level of the parsing of the
6604 fully user-extensible, even at the level of the parsing of the
6591 command line. It's not trivial, but it's perfectly doable.
6605 command line. It's not trivial, but it's perfectly doable.
6592
6606
6593 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6607 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6594 the problem of modules being loaded in the inverse order in which
6608 the problem of modules being loaded in the inverse order in which
6595 they were defined in
6609 they were defined in
6596
6610
6597 * Version 0.1.8 released, 0.1.9 opened for further work.
6611 * Version 0.1.8 released, 0.1.9 opened for further work.
6598
6612
6599 * Added magics pdef, source and file. They respectively show the
6613 * Added magics pdef, source and file. They respectively show the
6600 definition line ('prototype' in C), source code and full python
6614 definition line ('prototype' in C), source code and full python
6601 file for any callable object. The object inspector oinfo uses
6615 file for any callable object. The object inspector oinfo uses
6602 these to show the same information.
6616 these to show the same information.
6603
6617
6604 * Version 0.1.7 released, 0.1.8 opened for further work.
6618 * Version 0.1.7 released, 0.1.8 opened for further work.
6605
6619
6606 * Separated all the magic functions into a class called Magic. The
6620 * Separated all the magic functions into a class called Magic. The
6607 InteractiveShell class was becoming too big for Xemacs to handle
6621 InteractiveShell class was becoming too big for Xemacs to handle
6608 (de-indenting a line would lock it up for 10 seconds while it
6622 (de-indenting a line would lock it up for 10 seconds while it
6609 backtracked on the whole class!)
6623 backtracked on the whole class!)
6610
6624
6611 FIXME: didn't work. It can be done, but right now namespaces are
6625 FIXME: didn't work. It can be done, but right now namespaces are
6612 all messed up. Do it later (reverted it for now, so at least
6626 all messed up. Do it later (reverted it for now, so at least
6613 everything works as before).
6627 everything works as before).
6614
6628
6615 * Got the object introspection system (magic_oinfo) working! I
6629 * Got the object introspection system (magic_oinfo) working! I
6616 think this is pretty much ready for release to Janko, so he can
6630 think this is pretty much ready for release to Janko, so he can
6617 test it for a while and then announce it. Pretty much 100% of what
6631 test it for a while and then announce it. Pretty much 100% of what
6618 I wanted for the 'phase 1' release is ready. Happy, tired.
6632 I wanted for the 'phase 1' release is ready. Happy, tired.
6619
6633
6620 2001-11-12 Fernando Perez <fperez@colorado.edu>
6634 2001-11-12 Fernando Perez <fperez@colorado.edu>
6621
6635
6622 * Version 0.1.6 released, 0.1.7 opened for further work.
6636 * Version 0.1.6 released, 0.1.7 opened for further work.
6623
6637
6624 * Fixed bug in printing: it used to test for truth before
6638 * Fixed bug in printing: it used to test for truth before
6625 printing, so 0 wouldn't print. Now checks for None.
6639 printing, so 0 wouldn't print. Now checks for None.
6626
6640
6627 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6641 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6628 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6642 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6629 reaches by hand into the outputcache. Think of a better way to do
6643 reaches by hand into the outputcache. Think of a better way to do
6630 this later.
6644 this later.
6631
6645
6632 * Various small fixes thanks to Nathan's comments.
6646 * Various small fixes thanks to Nathan's comments.
6633
6647
6634 * Changed magic_pprint to magic_Pprint. This way it doesn't
6648 * Changed magic_pprint to magic_Pprint. This way it doesn't
6635 collide with pprint() and the name is consistent with the command
6649 collide with pprint() and the name is consistent with the command
6636 line option.
6650 line option.
6637
6651
6638 * Changed prompt counter behavior to be fully like
6652 * Changed prompt counter behavior to be fully like
6639 Mathematica's. That is, even input that doesn't return a result
6653 Mathematica's. That is, even input that doesn't return a result
6640 raises the prompt counter. The old behavior was kind of confusing
6654 raises the prompt counter. The old behavior was kind of confusing
6641 (getting the same prompt number several times if the operation
6655 (getting the same prompt number several times if the operation
6642 didn't return a result).
6656 didn't return a result).
6643
6657
6644 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6658 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6645
6659
6646 * Fixed -Classic mode (wasn't working anymore).
6660 * Fixed -Classic mode (wasn't working anymore).
6647
6661
6648 * Added colored prompts using Nathan's new code. Colors are
6662 * Added colored prompts using Nathan's new code. Colors are
6649 currently hardwired, they can be user-configurable. For
6663 currently hardwired, they can be user-configurable. For
6650 developers, they can be chosen in file ipythonlib.py, at the
6664 developers, they can be chosen in file ipythonlib.py, at the
6651 beginning of the CachedOutput class def.
6665 beginning of the CachedOutput class def.
6652
6666
6653 2001-11-11 Fernando Perez <fperez@colorado.edu>
6667 2001-11-11 Fernando Perez <fperez@colorado.edu>
6654
6668
6655 * Version 0.1.5 released, 0.1.6 opened for further work.
6669 * Version 0.1.5 released, 0.1.6 opened for further work.
6656
6670
6657 * Changed magic_env to *return* the environment as a dict (not to
6671 * Changed magic_env to *return* the environment as a dict (not to
6658 print it). This way it prints, but it can also be processed.
6672 print it). This way it prints, but it can also be processed.
6659
6673
6660 * Added Verbose exception reporting to interactive
6674 * Added Verbose exception reporting to interactive
6661 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6675 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6662 traceback. Had to make some changes to the ultraTB file. This is
6676 traceback. Had to make some changes to the ultraTB file. This is
6663 probably the last 'big' thing in my mental todo list. This ties
6677 probably the last 'big' thing in my mental todo list. This ties
6664 in with the next entry:
6678 in with the next entry:
6665
6679
6666 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6680 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6667 has to specify is Plain, Color or Verbose for all exception
6681 has to specify is Plain, Color or Verbose for all exception
6668 handling.
6682 handling.
6669
6683
6670 * Removed ShellServices option. All this can really be done via
6684 * Removed ShellServices option. All this can really be done via
6671 the magic system. It's easier to extend, cleaner and has automatic
6685 the magic system. It's easier to extend, cleaner and has automatic
6672 namespace protection and documentation.
6686 namespace protection and documentation.
6673
6687
6674 2001-11-09 Fernando Perez <fperez@colorado.edu>
6688 2001-11-09 Fernando Perez <fperez@colorado.edu>
6675
6689
6676 * Fixed bug in output cache flushing (missing parameter to
6690 * Fixed bug in output cache flushing (missing parameter to
6677 __init__). Other small bugs fixed (found using pychecker).
6691 __init__). Other small bugs fixed (found using pychecker).
6678
6692
6679 * Version 0.1.4 opened for bugfixing.
6693 * Version 0.1.4 opened for bugfixing.
6680
6694
6681 2001-11-07 Fernando Perez <fperez@colorado.edu>
6695 2001-11-07 Fernando Perez <fperez@colorado.edu>
6682
6696
6683 * Version 0.1.3 released, mainly because of the raw_input bug.
6697 * Version 0.1.3 released, mainly because of the raw_input bug.
6684
6698
6685 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6699 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6686 and when testing for whether things were callable, a call could
6700 and when testing for whether things were callable, a call could
6687 actually be made to certain functions. They would get called again
6701 actually be made to certain functions. They would get called again
6688 once 'really' executed, with a resulting double call. A disaster
6702 once 'really' executed, with a resulting double call. A disaster
6689 in many cases (list.reverse() would never work!).
6703 in many cases (list.reverse() would never work!).
6690
6704
6691 * Removed prefilter() function, moved its code to raw_input (which
6705 * Removed prefilter() function, moved its code to raw_input (which
6692 after all was just a near-empty caller for prefilter). This saves
6706 after all was just a near-empty caller for prefilter). This saves
6693 a function call on every prompt, and simplifies the class a tiny bit.
6707 a function call on every prompt, and simplifies the class a tiny bit.
6694
6708
6695 * Fix _ip to __ip name in magic example file.
6709 * Fix _ip to __ip name in magic example file.
6696
6710
6697 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6711 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6698 work with non-gnu versions of tar.
6712 work with non-gnu versions of tar.
6699
6713
6700 2001-11-06 Fernando Perez <fperez@colorado.edu>
6714 2001-11-06 Fernando Perez <fperez@colorado.edu>
6701
6715
6702 * Version 0.1.2. Just to keep track of the recent changes.
6716 * Version 0.1.2. Just to keep track of the recent changes.
6703
6717
6704 * Fixed nasty bug in output prompt routine. It used to check 'if
6718 * Fixed nasty bug in output prompt routine. It used to check 'if
6705 arg != None...'. Problem is, this fails if arg implements a
6719 arg != None...'. Problem is, this fails if arg implements a
6706 special comparison (__cmp__) which disallows comparing to
6720 special comparison (__cmp__) which disallows comparing to
6707 None. Found it when trying to use the PhysicalQuantity module from
6721 None. Found it when trying to use the PhysicalQuantity module from
6708 ScientificPython.
6722 ScientificPython.
6709
6723
6710 2001-11-05 Fernando Perez <fperez@colorado.edu>
6724 2001-11-05 Fernando Perez <fperez@colorado.edu>
6711
6725
6712 * Also added dirs. Now the pushd/popd/dirs family functions
6726 * Also added dirs. Now the pushd/popd/dirs family functions
6713 basically like the shell, with the added convenience of going home
6727 basically like the shell, with the added convenience of going home
6714 when called with no args.
6728 when called with no args.
6715
6729
6716 * pushd/popd slightly modified to mimic shell behavior more
6730 * pushd/popd slightly modified to mimic shell behavior more
6717 closely.
6731 closely.
6718
6732
6719 * Added env,pushd,popd from ShellServices as magic functions. I
6733 * Added env,pushd,popd from ShellServices as magic functions. I
6720 think the cleanest will be to port all desired functions from
6734 think the cleanest will be to port all desired functions from
6721 ShellServices as magics and remove ShellServices altogether. This
6735 ShellServices as magics and remove ShellServices altogether. This
6722 will provide a single, clean way of adding functionality
6736 will provide a single, clean way of adding functionality
6723 (shell-type or otherwise) to IP.
6737 (shell-type or otherwise) to IP.
6724
6738
6725 2001-11-04 Fernando Perez <fperez@colorado.edu>
6739 2001-11-04 Fernando Perez <fperez@colorado.edu>
6726
6740
6727 * Added .ipython/ directory to sys.path. This way users can keep
6741 * Added .ipython/ directory to sys.path. This way users can keep
6728 customizations there and access them via import.
6742 customizations there and access them via import.
6729
6743
6730 2001-11-03 Fernando Perez <fperez@colorado.edu>
6744 2001-11-03 Fernando Perez <fperez@colorado.edu>
6731
6745
6732 * Opened version 0.1.1 for new changes.
6746 * Opened version 0.1.1 for new changes.
6733
6747
6734 * Changed version number to 0.1.0: first 'public' release, sent to
6748 * Changed version number to 0.1.0: first 'public' release, sent to
6735 Nathan and Janko.
6749 Nathan and Janko.
6736
6750
6737 * Lots of small fixes and tweaks.
6751 * Lots of small fixes and tweaks.
6738
6752
6739 * Minor changes to whos format. Now strings are shown, snipped if
6753 * Minor changes to whos format. Now strings are shown, snipped if
6740 too long.
6754 too long.
6741
6755
6742 * Changed ShellServices to work on __main__ so they show up in @who
6756 * Changed ShellServices to work on __main__ so they show up in @who
6743
6757
6744 * Help also works with ? at the end of a line:
6758 * Help also works with ? at the end of a line:
6745 ?sin and sin?
6759 ?sin and sin?
6746 both produce the same effect. This is nice, as often I use the
6760 both produce the same effect. This is nice, as often I use the
6747 tab-complete to find the name of a method, but I used to then have
6761 tab-complete to find the name of a method, but I used to then have
6748 to go to the beginning of the line to put a ? if I wanted more
6762 to go to the beginning of the line to put a ? if I wanted more
6749 info. Now I can just add the ? and hit return. Convenient.
6763 info. Now I can just add the ? and hit return. Convenient.
6750
6764
6751 2001-11-02 Fernando Perez <fperez@colorado.edu>
6765 2001-11-02 Fernando Perez <fperez@colorado.edu>
6752
6766
6753 * Python version check (>=2.1) added.
6767 * Python version check (>=2.1) added.
6754
6768
6755 * Added LazyPython documentation. At this point the docs are quite
6769 * Added LazyPython documentation. At this point the docs are quite
6756 a mess. A cleanup is in order.
6770 a mess. A cleanup is in order.
6757
6771
6758 * Auto-installer created. For some bizarre reason, the zipfiles
6772 * Auto-installer created. For some bizarre reason, the zipfiles
6759 module isn't working on my system. So I made a tar version
6773 module isn't working on my system. So I made a tar version
6760 (hopefully the command line options in various systems won't kill
6774 (hopefully the command line options in various systems won't kill
6761 me).
6775 me).
6762
6776
6763 * Fixes to Struct in genutils. Now all dictionary-like methods are
6777 * Fixes to Struct in genutils. Now all dictionary-like methods are
6764 protected (reasonably).
6778 protected (reasonably).
6765
6779
6766 * Added pager function to genutils and changed ? to print usage
6780 * Added pager function to genutils and changed ? to print usage
6767 note through it (it was too long).
6781 note through it (it was too long).
6768
6782
6769 * Added the LazyPython functionality. Works great! I changed the
6783 * Added the LazyPython functionality. Works great! I changed the
6770 auto-quote escape to ';', it's on home row and next to '. But
6784 auto-quote escape to ';', it's on home row and next to '. But
6771 both auto-quote and auto-paren (still /) escapes are command-line
6785 both auto-quote and auto-paren (still /) escapes are command-line
6772 parameters.
6786 parameters.
6773
6787
6774
6788
6775 2001-11-01 Fernando Perez <fperez@colorado.edu>
6789 2001-11-01 Fernando Perez <fperez@colorado.edu>
6776
6790
6777 * Version changed to 0.0.7. Fairly large change: configuration now
6791 * Version changed to 0.0.7. Fairly large change: configuration now
6778 is all stored in a directory, by default .ipython. There, all
6792 is all stored in a directory, by default .ipython. There, all
6779 config files have normal looking names (not .names)
6793 config files have normal looking names (not .names)
6780
6794
6781 * Version 0.0.6 Released first to Lucas and Archie as a test
6795 * Version 0.0.6 Released first to Lucas and Archie as a test
6782 run. Since it's the first 'semi-public' release, change version to
6796 run. Since it's the first 'semi-public' release, change version to
6783 > 0.0.6 for any changes now.
6797 > 0.0.6 for any changes now.
6784
6798
6785 * Stuff I had put in the ipplib.py changelog:
6799 * Stuff I had put in the ipplib.py changelog:
6786
6800
6787 Changes to InteractiveShell:
6801 Changes to InteractiveShell:
6788
6802
6789 - Made the usage message a parameter.
6803 - Made the usage message a parameter.
6790
6804
6791 - Require the name of the shell variable to be given. It's a bit
6805 - Require the name of the shell variable to be given. It's a bit
6792 of a hack, but allows the name 'shell' not to be hardwired in the
6806 of a hack, but allows the name 'shell' not to be hardwired in the
6793 magic (@) handler, which is problematic b/c it requires
6807 magic (@) handler, which is problematic b/c it requires
6794 polluting the global namespace with 'shell'. This in turn is
6808 polluting the global namespace with 'shell'. This in turn is
6795 fragile: if a user redefines a variable called shell, things
6809 fragile: if a user redefines a variable called shell, things
6796 break.
6810 break.
6797
6811
6798 - magic @: all functions available through @ need to be defined
6812 - magic @: all functions available through @ need to be defined
6799 as magic_<name>, even though they can be called simply as
6813 as magic_<name>, even though they can be called simply as
6800 @<name>. This allows the special command @magic to gather
6814 @<name>. This allows the special command @magic to gather
6801 information automatically about all existing magic functions,
6815 information automatically about all existing magic functions,
6802 even if they are run-time user extensions, by parsing the shell
6816 even if they are run-time user extensions, by parsing the shell
6803 instance __dict__ looking for special magic_ names.
6817 instance __dict__ looking for special magic_ names.
6804
6818
6805 - mainloop: added *two* local namespace parameters. This allows
6819 - mainloop: added *two* local namespace parameters. This allows
6806 the class to differentiate between parameters which were there
6820 the class to differentiate between parameters which were there
6807 before and after command line initialization was processed. This
6821 before and after command line initialization was processed. This
6808 way, later @who can show things loaded at startup by the
6822 way, later @who can show things loaded at startup by the
6809 user. This trick was necessary to make session saving/reloading
6823 user. This trick was necessary to make session saving/reloading
6810 really work: ideally after saving/exiting/reloading a session,
6824 really work: ideally after saving/exiting/reloading a session,
6811 *everything* should look the same, including the output of @who. I
6825 *everything* should look the same, including the output of @who. I
6812 was only able to make this work with this double namespace
6826 was only able to make this work with this double namespace
6813 trick.
6827 trick.
6814
6828
6815 - added a header to the logfile which allows (almost) full
6829 - added a header to the logfile which allows (almost) full
6816 session restoring.
6830 session restoring.
6817
6831
6818 - prepend lines beginning with @ or !, with a and log
6832 - prepend lines beginning with @ or !, with a and log
6819 them. Why? !lines: may be useful to know what you did @lines:
6833 them. Why? !lines: may be useful to know what you did @lines:
6820 they may affect session state. So when restoring a session, at
6834 they may affect session state. So when restoring a session, at
6821 least inform the user of their presence. I couldn't quite get
6835 least inform the user of their presence. I couldn't quite get
6822 them to properly re-execute, but at least the user is warned.
6836 them to properly re-execute, but at least the user is warned.
6823
6837
6824 * Started ChangeLog.
6838 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now