##// END OF EJS Templates
- fix bug where aliases would shadow variables when autocall was fully off....
fperez -
Show More
@@ -1,483 +1,486 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 1300 2006-05-15 16:27:36Z vivainio $
9 $Id: OInspect.py 1329 2006-05-26 07:52:45Z fperez $
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 # IPython's own
33 # IPython's own
34 from IPython import PyColorize
34 from IPython import PyColorize
35 from IPython.genutils import page,indent,Term,mkdict
35 from IPython.genutils import page,indent,Term,mkdict
36 from IPython.Itpl import itpl
36 from IPython.Itpl import itpl
37 from IPython.wildcard import list_namespace
37 from IPython.wildcard import list_namespace
38 from IPython.ColorANSI import *
38 from IPython.ColorANSI import *
39
39
40 #****************************************************************************
40 #****************************************************************************
41 # Builtin color schemes
41 # Builtin color schemes
42
42
43 Colors = TermColors # just a shorthand
43 Colors = TermColors # just a shorthand
44
44
45 # Build a few color schemes
45 # Build a few color schemes
46 NoColor = ColorScheme(
46 NoColor = ColorScheme(
47 'NoColor',{
47 'NoColor',{
48 'header' : Colors.NoColor,
48 'header' : Colors.NoColor,
49 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
49 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
50 } )
50 } )
51
51
52 LinuxColors = ColorScheme(
52 LinuxColors = ColorScheme(
53 'Linux',{
53 'Linux',{
54 'header' : Colors.LightRed,
54 'header' : Colors.LightRed,
55 'normal' : Colors.Normal # color off (usu. Colors.Normal)
55 'normal' : Colors.Normal # color off (usu. Colors.Normal)
56 } )
56 } )
57
57
58 LightBGColors = ColorScheme(
58 LightBGColors = ColorScheme(
59 'LightBG',{
59 'LightBG',{
60 'header' : Colors.Red,
60 'header' : Colors.Red,
61 'normal' : Colors.Normal # color off (usu. Colors.Normal)
61 'normal' : Colors.Normal # color off (usu. Colors.Normal)
62 } )
62 } )
63
63
64 # Build table of color schemes (needed by the parser)
64 # Build table of color schemes (needed by the parser)
65 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
65 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
66 'Linux')
66 'Linux')
67
67
68 #****************************************************************************
68 #****************************************************************************
69 # Auxiliary functions
69 # Auxiliary functions
70 def getdoc(obj):
70 def getdoc(obj):
71 """Stable wrapper around inspect.getdoc.
71 """Stable wrapper around inspect.getdoc.
72
72
73 This can't crash because of attribute problems.
73 This can't crash because of attribute problems.
74
74
75 It also attempts to call a getdoc() method on the given object. This
75 It also attempts to call a getdoc() method on the given object. This
76 allows objects which provide their docstrings via non-standard mechanisms
76 allows objects which provide their docstrings via non-standard mechanisms
77 (like Pyro proxies) to still be inspected by ipython's ? system."""
77 (like Pyro proxies) to still be inspected by ipython's ? system."""
78
78
79 ds = None # default return value
79 ds = None # default return value
80 try:
80 try:
81 ds = inspect.getdoc(obj)
81 ds = inspect.getdoc(obj)
82 except:
82 except:
83 # Harden against an inspect failure, which can occur with
83 # Harden against an inspect failure, which can occur with
84 # SWIG-wrapped extensions.
84 # SWIG-wrapped extensions.
85 pass
85 pass
86 # Allow objects to offer customized documentation via a getdoc method:
86 # Allow objects to offer customized documentation via a getdoc method:
87 try:
87 try:
88 ds2 = obj.getdoc()
88 ds2 = obj.getdoc()
89 except:
89 except:
90 pass
90 pass
91 else:
91 else:
92 # if we get extra info, we add it to the normal docstring.
92 # if we get extra info, we add it to the normal docstring.
93 if ds is None:
93 if ds is None:
94 ds = ds2
94 ds = ds2
95 else:
95 else:
96 ds = '%s\n%s' % (ds,ds2)
96 ds = '%s\n%s' % (ds,ds2)
97 return ds
97 return ds
98
98
99 #****************************************************************************
99 #****************************************************************************
100 # Class definitions
100 # Class definitions
101
101
102 class myStringIO(StringIO.StringIO):
102 class myStringIO(StringIO.StringIO):
103 """Adds a writeln method to normal StringIO."""
103 """Adds a writeln method to normal StringIO."""
104 def writeln(self,*arg,**kw):
104 def writeln(self,*arg,**kw):
105 """Does a write() and then a write('\n')"""
105 """Does a write() and then a write('\n')"""
106 self.write(*arg,**kw)
106 self.write(*arg,**kw)
107 self.write('\n')
107 self.write('\n')
108
108
109 class Inspector:
109 class Inspector:
110 def __init__(self,color_table,code_color_table,scheme):
110 def __init__(self,color_table,code_color_table,scheme,
111 str_detail_level=0):
111 self.color_table = color_table
112 self.color_table = color_table
112 self.parser = PyColorize.Parser(code_color_table,out='str')
113 self.parser = PyColorize.Parser(code_color_table,out='str')
113 self.format = self.parser.format
114 self.format = self.parser.format
115 self.str_detail_level = str_detail_level
114 self.set_active_scheme(scheme)
116 self.set_active_scheme(scheme)
115
117
116 def __getargspec(self,obj):
118 def __getargspec(self,obj):
117 """Get the names and default values of a function's arguments.
119 """Get the names and default values of a function's arguments.
118
120
119 A tuple of four things is returned: (args, varargs, varkw, defaults).
121 A tuple of four things is returned: (args, varargs, varkw, defaults).
120 'args' is a list of the argument names (it may contain nested lists).
122 'args' is a list of the argument names (it may contain nested lists).
121 'varargs' and 'varkw' are the names of the * and ** arguments or None.
123 'varargs' and 'varkw' are the names of the * and ** arguments or None.
122 'defaults' is an n-tuple of the default values of the last n arguments.
124 'defaults' is an n-tuple of the default values of the last n arguments.
123
125
124 Modified version of inspect.getargspec from the Python Standard
126 Modified version of inspect.getargspec from the Python Standard
125 Library."""
127 Library."""
126
128
127 if inspect.isfunction(obj):
129 if inspect.isfunction(obj):
128 func_obj = obj
130 func_obj = obj
129 elif inspect.ismethod(obj):
131 elif inspect.ismethod(obj):
130 func_obj = obj.im_func
132 func_obj = obj.im_func
131 else:
133 else:
132 raise TypeError, 'arg is not a Python function'
134 raise TypeError, 'arg is not a Python function'
133 args, varargs, varkw = inspect.getargs(func_obj.func_code)
135 args, varargs, varkw = inspect.getargs(func_obj.func_code)
134 return args, varargs, varkw, func_obj.func_defaults
136 return args, varargs, varkw, func_obj.func_defaults
135
137
136 def __getdef(self,obj,oname=''):
138 def __getdef(self,obj,oname=''):
137 """Return the definition header for any callable object.
139 """Return the definition header for any callable object.
138
140
139 If any exception is generated, None is returned instead and the
141 If any exception is generated, None is returned instead and the
140 exception is suppressed."""
142 exception is suppressed."""
141
143
142 try:
144 try:
143 return oname + inspect.formatargspec(*self.__getargspec(obj))
145 return oname + inspect.formatargspec(*self.__getargspec(obj))
144 except:
146 except:
145 return None
147 return None
146
148
147 def __head(self,h):
149 def __head(self,h):
148 """Return a header string with proper colors."""
150 """Return a header string with proper colors."""
149 return '%s%s%s' % (self.color_table.active_colors.header,h,
151 return '%s%s%s' % (self.color_table.active_colors.header,h,
150 self.color_table.active_colors.normal)
152 self.color_table.active_colors.normal)
151
153
152 def set_active_scheme(self,scheme):
154 def set_active_scheme(self,scheme):
153 self.color_table.set_active_scheme(scheme)
155 self.color_table.set_active_scheme(scheme)
154 self.parser.color_table.set_active_scheme(scheme)
156 self.parser.color_table.set_active_scheme(scheme)
155
157
156 def noinfo(self,msg,oname):
158 def noinfo(self,msg,oname):
157 """Generic message when no information is found."""
159 """Generic message when no information is found."""
158 print 'No %s found' % msg,
160 print 'No %s found' % msg,
159 if oname:
161 if oname:
160 print 'for %s' % oname
162 print 'for %s' % oname
161 else:
163 else:
162 print
164 print
163
165
164 def pdef(self,obj,oname=''):
166 def pdef(self,obj,oname=''):
165 """Print the definition header for any callable object.
167 """Print the definition header for any callable object.
166
168
167 If the object is a class, print the constructor information."""
169 If the object is a class, print the constructor information."""
168
170
169 if not callable(obj):
171 if not callable(obj):
170 print 'Object is not callable.'
172 print 'Object is not callable.'
171 return
173 return
172
174
173 header = ''
175 header = ''
174 if type(obj) is types.ClassType:
176 if type(obj) is types.ClassType:
175 header = self.__head('Class constructor information:\n')
177 header = self.__head('Class constructor information:\n')
176 obj = obj.__init__
178 obj = obj.__init__
177 elif type(obj) is types.InstanceType:
179 elif type(obj) is types.InstanceType:
178 obj = obj.__call__
180 obj = obj.__call__
179
181
180 output = self.__getdef(obj,oname)
182 output = self.__getdef(obj,oname)
181 if output is None:
183 if output is None:
182 self.noinfo('definition header',oname)
184 self.noinfo('definition header',oname)
183 else:
185 else:
184 print >>Term.cout, header,self.format(output),
186 print >>Term.cout, header,self.format(output),
185
187
186 def pdoc(self,obj,oname='',formatter = None):
188 def pdoc(self,obj,oname='',formatter = None):
187 """Print the docstring for any object.
189 """Print the docstring for any object.
188
190
189 Optional:
191 Optional:
190 -formatter: a function to run the docstring through for specially
192 -formatter: a function to run the docstring through for specially
191 formatted docstrings."""
193 formatted docstrings."""
192
194
193 head = self.__head # so that itpl can find it even if private
195 head = self.__head # so that itpl can find it even if private
194 ds = getdoc(obj)
196 ds = getdoc(obj)
195 if formatter:
197 if formatter:
196 ds = formatter(ds)
198 ds = formatter(ds)
197 if type(obj) is types.ClassType:
199 if type(obj) is types.ClassType:
198 init_ds = getdoc(obj.__init__)
200 init_ds = getdoc(obj.__init__)
199 output = itpl('$head("Class Docstring:")\n'
201 output = itpl('$head("Class Docstring:")\n'
200 '$indent(ds)\n'
202 '$indent(ds)\n'
201 '$head("Constructor Docstring"):\n'
203 '$head("Constructor Docstring"):\n'
202 '$indent(init_ds)')
204 '$indent(init_ds)')
203 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
205 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
204 call_ds = getdoc(obj.__call__)
206 call_ds = getdoc(obj.__call__)
205 if call_ds:
207 if call_ds:
206 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
208 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
207 '$head("Calling Docstring:")\n$indent(call_ds)')
209 '$head("Calling Docstring:")\n$indent(call_ds)')
208 else:
210 else:
209 output = ds
211 output = ds
210 else:
212 else:
211 output = ds
213 output = ds
212 if output is None:
214 if output is None:
213 self.noinfo('documentation',oname)
215 self.noinfo('documentation',oname)
214 return
216 return
215 page(output)
217 page(output)
216
218
217 def psource(self,obj,oname=''):
219 def psource(self,obj,oname=''):
218 """Print the source code for an object."""
220 """Print the source code for an object."""
219
221
220 # Flush the source cache because inspect can return out-of-date source
222 # Flush the source cache because inspect can return out-of-date source
221 linecache.checkcache()
223 linecache.checkcache()
222 try:
224 try:
223 src = inspect.getsource(obj)
225 src = inspect.getsource(obj)
224 except:
226 except:
225 self.noinfo('source',oname)
227 self.noinfo('source',oname)
226 else:
228 else:
227 page(self.format(src))
229 page(self.format(src))
228
230
229 def pfile(self,obj,oname=''):
231 def pfile(self,obj,oname=''):
230 """Show the whole file where an object was defined."""
232 """Show the whole file where an object was defined."""
231 try:
233 try:
232 sourcelines,lineno = inspect.getsourcelines(obj)
234 sourcelines,lineno = inspect.getsourcelines(obj)
233 except:
235 except:
234 self.noinfo('file',oname)
236 self.noinfo('file',oname)
235 else:
237 else:
236 # run contents of file through pager starting at line
238 # run contents of file through pager starting at line
237 # where the object is defined
239 # where the object is defined
238 ofile = inspect.getabsfile(obj)
240 ofile = inspect.getabsfile(obj)
239
241
240 if (ofile.endswith('.so') or ofile.endswith('.dll')):
242 if (ofile.endswith('.so') or ofile.endswith('.dll')):
241 print 'File %r is binary, not printing.' % ofile
243 print 'File %r is binary, not printing.' % ofile
242 elif not os.path.isfile(ofile):
244 elif not os.path.isfile(ofile):
243 print 'File %r does not exist, not printing.' % ofile
245 print 'File %r does not exist, not printing.' % ofile
244 else:
246 else:
245 # Print only text files, not extension binaries.
247 # Print only text files, not extension binaries.
246 page(self.format(open(ofile).read()),lineno)
248 page(self.format(open(ofile).read()),lineno)
247 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
249 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
248
250
249 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
251 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
250 """Show detailed information about an object.
252 """Show detailed information about an object.
251
253
252 Optional arguments:
254 Optional arguments:
253
255
254 - oname: name of the variable pointing to the object.
256 - oname: name of the variable pointing to the object.
255
257
256 - formatter: special formatter for docstrings (see pdoc)
258 - formatter: special formatter for docstrings (see pdoc)
257
259
258 - info: a structure with some information fields which may have been
260 - info: a structure with some information fields which may have been
259 precomputed already.
261 precomputed already.
260
262
261 - detail_level: if set to 1, more information is given.
263 - detail_level: if set to 1, more information is given.
262 """
264 """
263
265
264 obj_type = type(obj)
266 obj_type = type(obj)
265
267
266 header = self.__head
268 header = self.__head
267 if info is None:
269 if info is None:
268 ismagic = 0
270 ismagic = 0
269 isalias = 0
271 isalias = 0
270 ospace = ''
272 ospace = ''
271 else:
273 else:
272 ismagic = info.ismagic
274 ismagic = info.ismagic
273 isalias = info.isalias
275 isalias = info.isalias
274 ospace = info.namespace
276 ospace = info.namespace
275 # Get docstring, special-casing aliases:
277 # Get docstring, special-casing aliases:
276 if isalias:
278 if isalias:
277 ds = "Alias to the system command:\n %s" % obj[1]
279 ds = "Alias to the system command:\n %s" % obj[1]
278 else:
280 else:
279 ds = getdoc(obj)
281 ds = getdoc(obj)
280 if ds is None:
282 if ds is None:
281 ds = '<no docstring>'
283 ds = '<no docstring>'
282 if formatter is not None:
284 if formatter is not None:
283 ds = formatter(ds)
285 ds = formatter(ds)
284
286
285 # store output in a list which gets joined with \n at the end.
287 # store output in a list which gets joined with \n at the end.
286 out = myStringIO()
288 out = myStringIO()
287
289
288 string_max = 200 # max size of strings to show (snipped if longer)
290 string_max = 200 # max size of strings to show (snipped if longer)
289 shalf = int((string_max -5)/2)
291 shalf = int((string_max -5)/2)
290
292
291 if ismagic:
293 if ismagic:
292 obj_type_name = 'Magic function'
294 obj_type_name = 'Magic function'
293 elif isalias:
295 elif isalias:
294 obj_type_name = 'System alias'
296 obj_type_name = 'System alias'
295 else:
297 else:
296 obj_type_name = obj_type.__name__
298 obj_type_name = obj_type.__name__
297 out.writeln(header('Type:\t\t')+obj_type_name)
299 out.writeln(header('Type:\t\t')+obj_type_name)
298
300
299 try:
301 try:
300 bclass = obj.__class__
302 bclass = obj.__class__
301 out.writeln(header('Base Class:\t')+str(bclass))
303 out.writeln(header('Base Class:\t')+str(bclass))
302 except: pass
304 except: pass
303
305
304 # String form, but snip if too long in ? form (full in ??)
306 # String form, but snip if too long in ? form (full in ??)
305 try:
307 if detail_level >= self.str_detail_level:
306 ostr = str(obj)
308 try:
307 str_head = 'String Form:'
309 ostr = str(obj)
308 if not detail_level and len(ostr)>string_max:
310 str_head = 'String Form:'
309 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
311 if not detail_level and len(ostr)>string_max:
310 ostr = ("\n" + " " * len(str_head.expandtabs())).\
312 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
311 join(map(string.strip,ostr.split("\n")))
313 ostr = ("\n" + " " * len(str_head.expandtabs())).\
312 if ostr.find('\n') > -1:
314 join(map(string.strip,ostr.split("\n")))
313 # Print multi-line strings starting at the next line.
315 if ostr.find('\n') > -1:
314 str_sep = '\n'
316 # Print multi-line strings starting at the next line.
315 else:
317 str_sep = '\n'
316 str_sep = '\t'
318 else:
317 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
319 str_sep = '\t'
318 except:
320 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
319 pass
321 except:
322 pass
320
323
321 if ospace:
324 if ospace:
322 out.writeln(header('Namespace:\t')+ospace)
325 out.writeln(header('Namespace:\t')+ospace)
323
326
324 # Length (for strings and lists)
327 # Length (for strings and lists)
325 try:
328 try:
326 length = str(len(obj))
329 length = str(len(obj))
327 out.writeln(header('Length:\t\t')+length)
330 out.writeln(header('Length:\t\t')+length)
328 except: pass
331 except: pass
329
332
330 # Filename where object was defined
333 # Filename where object was defined
331 binary_file = False
334 binary_file = False
332 try:
335 try:
333 fname = inspect.getabsfile(obj)
336 fname = inspect.getabsfile(obj)
334 if fname.endswith('<string>'):
337 if fname.endswith('<string>'):
335 fname = 'Dynamically generated function. No source code available.'
338 fname = 'Dynamically generated function. No source code available.'
336 if (fname.endswith('.so') or fname.endswith('.dll') or
339 if (fname.endswith('.so') or fname.endswith('.dll') or
337 not os.path.isfile(fname)):
340 not os.path.isfile(fname)):
338 binary_file = True
341 binary_file = True
339 out.writeln(header('File:\t\t')+fname)
342 out.writeln(header('File:\t\t')+fname)
340 except:
343 except:
341 # if anything goes wrong, we don't want to show source, so it's as
344 # if anything goes wrong, we don't want to show source, so it's as
342 # if the file was binary
345 # if the file was binary
343 binary_file = True
346 binary_file = True
344
347
345 # reconstruct the function definition and print it:
348 # reconstruct the function definition and print it:
346 defln = self.__getdef(obj,oname)
349 defln = self.__getdef(obj,oname)
347 if defln:
350 if defln:
348 out.write(header('Definition:\t')+self.format(defln))
351 out.write(header('Definition:\t')+self.format(defln))
349
352
350 # Docstrings only in detail 0 mode, since source contains them (we
353 # Docstrings only in detail 0 mode, since source contains them (we
351 # avoid repetitions). If source fails, we add them back, see below.
354 # avoid repetitions). If source fails, we add them back, see below.
352 if ds and detail_level == 0:
355 if ds and detail_level == 0:
353 out.writeln(header('Docstring:\n') + indent(ds))
356 out.writeln(header('Docstring:\n') + indent(ds))
354
357
355
358
356 # Original source code for any callable
359 # Original source code for any callable
357 if detail_level:
360 if detail_level:
358 # Flush the source cache because inspect can return out-of-date source
361 # Flush the source cache because inspect can return out-of-date source
359 linecache.checkcache()
362 linecache.checkcache()
360 source_success = False
363 source_success = False
361 try:
364 try:
362 if not binary_file:
365 if not binary_file:
363 source = self.format(inspect.getsource(obj))
366 source = self.format(inspect.getsource(obj))
364 out.write(header('Source:\n')+source.rstrip())
367 out.write(header('Source:\n')+source.rstrip())
365 source_success = True
368 source_success = True
366 except:
369 except:
367 pass
370 pass
368
371
369 if ds and not source_success:
372 if ds and not source_success:
370 out.writeln(header('Docstring [source file open failed]:\n') + indent(ds))
373 out.writeln(header('Docstring [source file open failed]:\n') + indent(ds))
371
374
372 # Constructor docstring for classes
375 # Constructor docstring for classes
373 if obj_type is types.ClassType:
376 if obj_type is types.ClassType:
374 # reconstruct the function definition and print it:
377 # reconstruct the function definition and print it:
375 try:
378 try:
376 obj_init = obj.__init__
379 obj_init = obj.__init__
377 except AttributeError:
380 except AttributeError:
378 init_def = init_ds = None
381 init_def = init_ds = None
379 else:
382 else:
380 init_def = self.__getdef(obj_init,oname)
383 init_def = self.__getdef(obj_init,oname)
381 init_ds = getdoc(obj_init)
384 init_ds = getdoc(obj_init)
382
385
383 if init_def or init_ds:
386 if init_def or init_ds:
384 out.writeln(header('\nConstructor information:'))
387 out.writeln(header('\nConstructor information:'))
385 if init_def:
388 if init_def:
386 out.write(header('Definition:\t')+ self.format(init_def))
389 out.write(header('Definition:\t')+ self.format(init_def))
387 if init_ds:
390 if init_ds:
388 out.writeln(header('Docstring:\n') + indent(init_ds))
391 out.writeln(header('Docstring:\n') + indent(init_ds))
389 # and class docstring for instances:
392 # and class docstring for instances:
390 elif obj_type is types.InstanceType:
393 elif obj_type is types.InstanceType:
391
394
392 # First, check whether the instance docstring is identical to the
395 # First, check whether the instance docstring is identical to the
393 # class one, and print it separately if they don't coincide. In
396 # class one, and print it separately if they don't coincide. In
394 # most cases they will, but it's nice to print all the info for
397 # most cases they will, but it's nice to print all the info for
395 # objects which use instance-customized docstrings.
398 # objects which use instance-customized docstrings.
396 if ds:
399 if ds:
397 class_ds = getdoc(obj.__class__)
400 class_ds = getdoc(obj.__class__)
398 if class_ds and ds != class_ds:
401 if class_ds and ds != class_ds:
399 out.writeln(header('Class Docstring:\n') +
402 out.writeln(header('Class Docstring:\n') +
400 indent(class_ds))
403 indent(class_ds))
401
404
402 # Next, try to show constructor docstrings
405 # Next, try to show constructor docstrings
403 try:
406 try:
404 init_ds = getdoc(obj.__init__)
407 init_ds = getdoc(obj.__init__)
405 except AttributeError:
408 except AttributeError:
406 init_ds = None
409 init_ds = None
407 if init_ds:
410 if init_ds:
408 out.writeln(header('Constructor Docstring:\n') +
411 out.writeln(header('Constructor Docstring:\n') +
409 indent(init_ds))
412 indent(init_ds))
410
413
411 # Call form docstring for callable instances
414 # Call form docstring for callable instances
412 if hasattr(obj,'__call__'):
415 if hasattr(obj,'__call__'):
413 out.writeln(header('Callable:\t')+'Yes')
416 out.writeln(header('Callable:\t')+'Yes')
414 call_def = self.__getdef(obj.__call__,oname)
417 call_def = self.__getdef(obj.__call__,oname)
415 if call_def is None:
418 if call_def is None:
416 out.write(header('Call def:\t')+
419 out.write(header('Call def:\t')+
417 'Calling definition not available.')
420 'Calling definition not available.')
418 else:
421 else:
419 out.write(header('Call def:\t')+self.format(call_def))
422 out.write(header('Call def:\t')+self.format(call_def))
420 call_ds = getdoc(obj.__call__)
423 call_ds = getdoc(obj.__call__)
421 if call_ds:
424 if call_ds:
422 out.writeln(header('Call docstring:\n') + indent(call_ds))
425 out.writeln(header('Call docstring:\n') + indent(call_ds))
423
426
424 # Finally send to printer/pager
427 # Finally send to printer/pager
425 output = out.getvalue()
428 output = out.getvalue()
426 if output:
429 if output:
427 page(output)
430 page(output)
428 # end pinfo
431 # end pinfo
429
432
430 def psearch(self,pattern,ns_table,ns_search=[],
433 def psearch(self,pattern,ns_table,ns_search=[],
431 ignore_case=False,show_all=False):
434 ignore_case=False,show_all=False):
432 """Search namespaces with wildcards for objects.
435 """Search namespaces with wildcards for objects.
433
436
434 Arguments:
437 Arguments:
435
438
436 - pattern: string containing shell-like wildcards to use in namespace
439 - pattern: string containing shell-like wildcards to use in namespace
437 searches and optionally a type specification to narrow the search to
440 searches and optionally a type specification to narrow the search to
438 objects of that type.
441 objects of that type.
439
442
440 - ns_table: dict of name->namespaces for search.
443 - ns_table: dict of name->namespaces for search.
441
444
442 Optional arguments:
445 Optional arguments:
443
446
444 - ns_search: list of namespace names to include in search.
447 - ns_search: list of namespace names to include in search.
445
448
446 - ignore_case(False): make the search case-insensitive.
449 - ignore_case(False): make the search case-insensitive.
447
450
448 - show_all(False): show all names, including those starting with
451 - show_all(False): show all names, including those starting with
449 underscores.
452 underscores.
450 """
453 """
451 # defaults
454 # defaults
452 type_pattern = 'all'
455 type_pattern = 'all'
453 filter = ''
456 filter = ''
454
457
455 cmds = pattern.split()
458 cmds = pattern.split()
456 len_cmds = len(cmds)
459 len_cmds = len(cmds)
457 if len_cmds == 1:
460 if len_cmds == 1:
458 # Only filter pattern given
461 # Only filter pattern given
459 filter = cmds[0]
462 filter = cmds[0]
460 elif len_cmds == 2:
463 elif len_cmds == 2:
461 # Both filter and type specified
464 # Both filter and type specified
462 filter,type_pattern = cmds
465 filter,type_pattern = cmds
463 else:
466 else:
464 raise ValueError('invalid argument string for psearch: <%s>' %
467 raise ValueError('invalid argument string for psearch: <%s>' %
465 pattern)
468 pattern)
466
469
467 # filter search namespaces
470 # filter search namespaces
468 for name in ns_search:
471 for name in ns_search:
469 if name not in ns_table:
472 if name not in ns_table:
470 raise ValueError('invalid namespace <%s>. Valid names: %s' %
473 raise ValueError('invalid namespace <%s>. Valid names: %s' %
471 (name,ns_table.keys()))
474 (name,ns_table.keys()))
472
475
473 #print 'type_pattern:',type_pattern # dbg
476 #print 'type_pattern:',type_pattern # dbg
474 search_result = []
477 search_result = []
475 for ns_name in ns_search:
478 for ns_name in ns_search:
476 ns = ns_table[ns_name]
479 ns = ns_table[ns_name]
477 tmp_res = list(list_namespace(ns,type_pattern,filter,
480 tmp_res = list(list_namespace(ns,type_pattern,filter,
478 ignore_case=ignore_case,
481 ignore_case=ignore_case,
479 show_all=show_all))
482 show_all=show_all))
480 search_result.extend(tmp_res)
483 search_result.extend(tmp_res)
481 search_result.sort()
484 search_result.sort()
482
485
483 page('\n'.join(search_result))
486 page('\n'.join(search_result))
@@ -1,597 +1,607 b''
1 # -*- Mode: Shell-Script -*- Not really, but shows comments correctly
1 # -*- Mode: Shell-Script -*- Not really, but shows comments correctly
2 # $Id: ipythonrc 1324 2006-05-24 20:25:11Z fperez $
2 # $Id: ipythonrc 1329 2006-05-26 07:52:45Z fperez $
3
3
4 #***************************************************************************
4 #***************************************************************************
5 #
5 #
6 # Configuration file for IPython -- ipythonrc format
6 # Configuration file for IPython -- ipythonrc format
7 #
7 #
8 # The format of this file is simply one of 'key value' lines.
8 # The format of this file is simply one of 'key value' lines.
9 # Lines containing only whitespace at the beginning and then a # are ignored
9 # Lines containing only whitespace at the beginning and then a # are ignored
10 # as comments. But comments can NOT be put on lines with data.
10 # as comments. But comments can NOT be put on lines with data.
11
11
12 # The meaning and use of each key are explained below.
12 # The meaning and use of each key are explained below.
13
13
14 #---------------------------------------------------------------------------
14 #---------------------------------------------------------------------------
15 # Section: included files
15 # Section: included files
16
16
17 # Put one or more *config* files (with the syntax of this file) you want to
17 # Put one or more *config* files (with the syntax of this file) you want to
18 # include. For keys with a unique value the outermost file has precedence. For
18 # include. For keys with a unique value the outermost file has precedence. For
19 # keys with multiple values, they all get assembled into a list which then
19 # keys with multiple values, they all get assembled into a list which then
20 # gets loaded by IPython.
20 # gets loaded by IPython.
21
21
22 # In this file, all lists of things should simply be space-separated.
22 # In this file, all lists of things should simply be space-separated.
23
23
24 # This allows you to build hierarchies of files which recursively load
24 # This allows you to build hierarchies of files which recursively load
25 # lower-level services. If this is your main ~/.ipython/ipythonrc file, you
25 # lower-level services. If this is your main ~/.ipython/ipythonrc file, you
26 # should only keep here basic things you always want available. Then you can
26 # should only keep here basic things you always want available. Then you can
27 # include it in every other special-purpose config file you create.
27 # include it in every other special-purpose config file you create.
28 include
28 include
29
29
30 #---------------------------------------------------------------------------
30 #---------------------------------------------------------------------------
31 # Section: startup setup
31 # Section: startup setup
32
32
33 # These are mostly things which parallel a command line option of the same
33 # These are mostly things which parallel a command line option of the same
34 # name.
34 # name.
35
35
36 # Keys in this section should only appear once. If any key from this section
36 # Keys in this section should only appear once. If any key from this section
37 # is encountered more than once, the last value remains, all earlier ones get
37 # is encountered more than once, the last value remains, all earlier ones get
38 # discarded.
38 # discarded.
39
39
40
40
41 # Automatic calling of callable objects. If set to 1 or 2, callable objects
41 # Automatic calling of callable objects. If set to 1 or 2, callable objects
42 # are automatically called when invoked at the command line, even if you don't
42 # are automatically called when invoked at the command line, even if you don't
43 # type parentheses. IPython adds the parentheses for you. For example:
43 # type parentheses. IPython adds the parentheses for you. For example:
44
44
45 #In [1]: str 45
45 #In [1]: str 45
46 #------> str(45)
46 #------> str(45)
47 #Out[1]: '45'
47 #Out[1]: '45'
48
48
49 # IPython reprints your line with '---->' indicating that it added
49 # IPython reprints your line with '---->' indicating that it added
50 # parentheses. While this option is very convenient for interactive use, it
50 # parentheses. While this option is very convenient for interactive use, it
51 # may occasionally cause problems with objects which have side-effects if
51 # may occasionally cause problems with objects which have side-effects if
52 # called unexpectedly.
52 # called unexpectedly.
53
53
54 # The valid values for autocall are:
54 # The valid values for autocall are:
55
55
56 # autocall 0 -> disabled (you can toggle it at runtime with the %autocall magic)
56 # autocall 0 -> disabled (you can toggle it at runtime with the %autocall magic)
57
57
58 # autocall 1 -> active, but do not apply if there are no arguments on the line.
58 # autocall 1 -> active, but do not apply if there are no arguments on the line.
59
59
60 # In this mode, you get:
60 # In this mode, you get:
61
61
62 #In [1]: callable
62 #In [1]: callable
63 #Out[1]: <built-in function callable>
63 #Out[1]: <built-in function callable>
64
64
65 #In [2]: callable 'hello'
65 #In [2]: callable 'hello'
66 #------> callable('hello')
66 #------> callable('hello')
67 #Out[2]: False
67 #Out[2]: False
68
68
69 # 2 -> Active always. Even if no arguments are present, the callable object
69 # 2 -> Active always. Even if no arguments are present, the callable object
70 # is called:
70 # is called:
71
71
72 #In [4]: callable
72 #In [4]: callable
73 #------> callable()
73 #------> callable()
74
74
75 # Note that even with autocall off, you can still use '/' at the start of a
75 # Note that even with autocall off, you can still use '/' at the start of a
76 # line to treat the first argument on the command line as a function and add
76 # line to treat the first argument on the command line as a function and add
77 # parentheses to it:
77 # parentheses to it:
78
78
79 #In [8]: /str 43
79 #In [8]: /str 43
80 #------> str(43)
80 #------> str(43)
81 #Out[8]: '43'
81 #Out[8]: '43'
82
82
83 autocall 1
83 autocall 1
84
84
85 # Auto-edit syntax errors. When you use the %edit magic in ipython to edit
85 # Auto-edit syntax errors. When you use the %edit magic in ipython to edit
86 # source code (see the 'editor' variable below), it is possible that you save
86 # source code (see the 'editor' variable below), it is possible that you save
87 # a file with syntax errors in it. If this variable is true, IPython will ask
87 # a file with syntax errors in it. If this variable is true, IPython will ask
88 # you whether to re-open the editor immediately to correct such an error.
88 # you whether to re-open the editor immediately to correct such an error.
89
89
90 autoedit_syntax 0
90 autoedit_syntax 0
91
91
92 # Auto-indent. IPython can recognize lines ending in ':' and indent the next
92 # Auto-indent. IPython can recognize lines ending in ':' and indent the next
93 # line, while also un-indenting automatically after 'raise' or 'return'.
93 # line, while also un-indenting automatically after 'raise' or 'return'.
94
94
95 # This feature uses the readline library, so it will honor your ~/.inputrc
95 # This feature uses the readline library, so it will honor your ~/.inputrc
96 # configuration (or whatever file your INPUTRC variable points to). Adding
96 # configuration (or whatever file your INPUTRC variable points to). Adding
97 # the following lines to your .inputrc file can make indent/unindenting more
97 # the following lines to your .inputrc file can make indent/unindenting more
98 # convenient (M-i indents, M-u unindents):
98 # convenient (M-i indents, M-u unindents):
99
99
100 # $if Python
100 # $if Python
101 # "\M-i": " "
101 # "\M-i": " "
102 # "\M-u": "\d\d\d\d"
102 # "\M-u": "\d\d\d\d"
103 # $endif
103 # $endif
104
104
105 # The feature is potentially a bit dangerous, because it can cause problems
105 # The feature is potentially a bit dangerous, because it can cause problems
106 # with pasting of indented code (the pasted code gets re-indented on each
106 # with pasting of indented code (the pasted code gets re-indented on each
107 # line). But it's a huge time-saver when working interactively. The magic
107 # line). But it's a huge time-saver when working interactively. The magic
108 # function %autoindent allows you to toggle it on/off at runtime.
108 # function %autoindent allows you to toggle it on/off at runtime.
109
109
110 autoindent 1
110 autoindent 1
111
111
112 # Auto-magic. This gives you access to all the magic functions without having
112 # Auto-magic. This gives you access to all the magic functions without having
113 # to prepend them with an % sign. If you define a variable with the same name
113 # to prepend them with an % sign. If you define a variable with the same name
114 # as a magic function (say who=1), you will need to access the magic function
114 # as a magic function (say who=1), you will need to access the magic function
115 # with % (%who in this example). However, if later you delete your variable
115 # with % (%who in this example). However, if later you delete your variable
116 # (del who), you'll recover the automagic calling form.
116 # (del who), you'll recover the automagic calling form.
117
117
118 # Considering that many magic functions provide a lot of shell-like
118 # Considering that many magic functions provide a lot of shell-like
119 # functionality, automagic gives you something close to a full Python+system
119 # functionality, automagic gives you something close to a full Python+system
120 # shell environment (and you can extend it further if you want).
120 # shell environment (and you can extend it further if you want).
121
121
122 automagic 1
122 automagic 1
123
123
124 # Size of the output cache. After this many entries are stored, the cache will
124 # Size of the output cache. After this many entries are stored, the cache will
125 # get flushed. Depending on the size of your intermediate calculations, you
125 # get flushed. Depending on the size of your intermediate calculations, you
126 # may have memory problems if you make it too big, since keeping things in the
126 # may have memory problems if you make it too big, since keeping things in the
127 # cache prevents Python from reclaiming the memory for old results. Experiment
127 # cache prevents Python from reclaiming the memory for old results. Experiment
128 # with a value that works well for you.
128 # with a value that works well for you.
129
129
130 # If you choose cache_size 0 IPython will revert to python's regular >>>
130 # If you choose cache_size 0 IPython will revert to python's regular >>>
131 # unnumbered prompt. You will still have _, __ and ___ for your last three
131 # unnumbered prompt. You will still have _, __ and ___ for your last three
132 # results, but that will be it. No dynamic _1, _2, etc. will be created. If
132 # results, but that will be it. No dynamic _1, _2, etc. will be created. If
133 # you are running on a slow machine or with very limited memory, this may
133 # you are running on a slow machine or with very limited memory, this may
134 # help.
134 # help.
135
135
136 cache_size 1000
136 cache_size 1000
137
137
138 # Classic mode: Setting 'classic 1' you lose many of IPython niceties,
138 # Classic mode: Setting 'classic 1' you lose many of IPython niceties,
139 # but that's your choice! Classic 1 -> same as IPython -classic.
139 # but that's your choice! Classic 1 -> same as IPython -classic.
140 # Note that this is _not_ the normal python interpreter, it's simply
140 # Note that this is _not_ the normal python interpreter, it's simply
141 # IPython emulating most of the classic interpreter's behavior.
141 # IPython emulating most of the classic interpreter's behavior.
142 classic 0
142 classic 0
143
143
144 # colors - Coloring option for prompts and traceback printouts.
144 # colors - Coloring option for prompts and traceback printouts.
145
145
146 # Currently available schemes: NoColor, Linux, LightBG.
146 # Currently available schemes: NoColor, Linux, LightBG.
147
147
148 # This option allows coloring the prompts and traceback printouts. This
148 # This option allows coloring the prompts and traceback printouts. This
149 # requires a terminal which can properly handle color escape sequences. If you
149 # requires a terminal which can properly handle color escape sequences. If you
150 # are having problems with this, use the NoColor scheme (uses no color escapes
150 # are having problems with this, use the NoColor scheme (uses no color escapes
151 # at all).
151 # at all).
152
152
153 # The Linux option works well in linux console type environments: dark
153 # The Linux option works well in linux console type environments: dark
154 # background with light fonts.
154 # background with light fonts.
155
155
156 # LightBG is similar to Linux but swaps dark/light colors to be more readable
156 # LightBG is similar to Linux but swaps dark/light colors to be more readable
157 # in light background terminals.
157 # in light background terminals.
158
158
159 # keep uncommented only the one you want:
159 # keep uncommented only the one you want:
160 colors Linux
160 colors Linux
161 #colors LightBG
161 #colors LightBG
162 #colors NoColor
162 #colors NoColor
163
163
164 ########################
164 ########################
165 # Note to Windows users
165 # Note to Windows users
166 #
166 #
167 # Color and readline support is avaialble to Windows users via Gary Bishop's
167 # Color and readline support is avaialble to Windows users via Gary Bishop's
168 # readline library. You can find Gary's tools at
168 # readline library. You can find Gary's tools at
169 # http://sourceforge.net/projects/uncpythontools.
169 # http://sourceforge.net/projects/uncpythontools.
170 # Note that his readline module requires in turn the ctypes library, available
170 # Note that his readline module requires in turn the ctypes library, available
171 # at http://starship.python.net/crew/theller/ctypes.
171 # at http://starship.python.net/crew/theller/ctypes.
172 ########################
172 ########################
173
173
174 # color_info: IPython can display information about objects via a set of
174 # color_info: IPython can display information about objects via a set of
175 # functions, and optionally can use colors for this, syntax highlighting
175 # functions, and optionally can use colors for this, syntax highlighting
176 # source code and various other elements. This information is passed through a
176 # source code and various other elements. This information is passed through a
177 # pager (it defaults to 'less' if $PAGER is not set).
177 # pager (it defaults to 'less' if $PAGER is not set).
178
178
179 # If your pager has problems, try to setting it to properly handle escapes
179 # If your pager has problems, try to setting it to properly handle escapes
180 # (see the less manpage for detail), or disable this option. The magic
180 # (see the less manpage for detail), or disable this option. The magic
181 # function %color_info allows you to toggle this interactively for testing.
181 # function %color_info allows you to toggle this interactively for testing.
182
182
183 color_info 1
183 color_info 1
184
184
185 # confirm_exit: set to 1 if you want IPython to confirm when you try to exit
185 # confirm_exit: set to 1 if you want IPython to confirm when you try to exit
186 # with an EOF (Control-d in Unix, Control-Z/Enter in Windows). Note that using
186 # with an EOF (Control-d in Unix, Control-Z/Enter in Windows). Note that using
187 # the magic functions %Exit or %Quit you can force a direct exit, bypassing
187 # the magic functions %Exit or %Quit you can force a direct exit, bypassing
188 # any confirmation.
188 # any confirmation.
189
189
190 confirm_exit 1
190 confirm_exit 1
191
191
192 # Use deep_reload() as a substitute for reload() by default. deep_reload() is
192 # Use deep_reload() as a substitute for reload() by default. deep_reload() is
193 # still available as dreload() and appears as a builtin.
193 # still available as dreload() and appears as a builtin.
194
194
195 deep_reload 0
195 deep_reload 0
196
196
197 # Which editor to use with the %edit command. If you leave this at 0, IPython
197 # Which editor to use with the %edit command. If you leave this at 0, IPython
198 # will honor your EDITOR environment variable. Since this editor is invoked on
198 # will honor your EDITOR environment variable. Since this editor is invoked on
199 # the fly by ipython and is meant for editing small code snippets, you may
199 # the fly by ipython and is meant for editing small code snippets, you may
200 # want to use a small, lightweight editor here.
200 # want to use a small, lightweight editor here.
201
201
202 # For Emacs users, setting up your Emacs server properly as described in the
202 # For Emacs users, setting up your Emacs server properly as described in the
203 # manual is a good idea. An alternative is to use jed, a very light editor
203 # manual is a good idea. An alternative is to use jed, a very light editor
204 # with much of the feel of Emacs (though not as powerful for heavy-duty work).
204 # with much of the feel of Emacs (though not as powerful for heavy-duty work).
205
205
206 editor 0
206 editor 0
207
207
208 # log 1 -> same as ipython -log. This automatically logs to ./ipython.log
208 # log 1 -> same as ipython -log. This automatically logs to ./ipython.log
209 log 0
209 log 0
210
210
211 # Same as ipython -Logfile YourLogfileName.
211 # Same as ipython -Logfile YourLogfileName.
212 # Don't use with log 1 (use one or the other)
212 # Don't use with log 1 (use one or the other)
213 logfile ''
213 logfile ''
214
214
215 # banner 0 -> same as ipython -nobanner
215 # banner 0 -> same as ipython -nobanner
216 banner 1
216 banner 1
217
217
218 # messages 0 -> same as ipython -nomessages
218 # messages 0 -> same as ipython -nomessages
219 messages 1
219 messages 1
220
220
221 # Automatically call the pdb debugger after every uncaught exception. If you
221 # Automatically call the pdb debugger after every uncaught exception. If you
222 # are used to debugging using pdb, this puts you automatically inside of it
222 # are used to debugging using pdb, this puts you automatically inside of it
223 # after any call (either in IPython or in code called by it) which triggers an
223 # after any call (either in IPython or in code called by it) which triggers an
224 # exception which goes uncaught.
224 # exception which goes uncaught.
225 pdb 0
225 pdb 0
226
226
227 # Enable the pprint module for printing. pprint tends to give a more readable
227 # Enable the pprint module for printing. pprint tends to give a more readable
228 # display (than print) for complex nested data structures.
228 # display (than print) for complex nested data structures.
229 pprint 1
229 pprint 1
230
230
231 # Prompt strings
231 # Prompt strings
232
232
233 # Most bash-like escapes can be used to customize IPython's prompts, as well as
233 # Most bash-like escapes can be used to customize IPython's prompts, as well as
234 # a few additional ones which are IPython-specific. All valid prompt escapes
234 # a few additional ones which are IPython-specific. All valid prompt escapes
235 # are described in detail in the Customization section of the IPython HTML/PDF
235 # are described in detail in the Customization section of the IPython HTML/PDF
236 # manual.
236 # manual.
237
237
238 # Use \# to represent the current prompt number, and quote them to protect
238 # Use \# to represent the current prompt number, and quote them to protect
239 # spaces.
239 # spaces.
240 prompt_in1 'In [\#]: '
240 prompt_in1 'In [\#]: '
241
241
242 # \D is replaced by as many dots as there are digits in the
242 # \D is replaced by as many dots as there are digits in the
243 # current value of \#.
243 # current value of \#.
244 prompt_in2 ' .\D.: '
244 prompt_in2 ' .\D.: '
245
245
246 prompt_out 'Out[\#]: '
246 prompt_out 'Out[\#]: '
247
247
248 # Select whether to left-pad the output prompts to match the length of the
248 # Select whether to left-pad the output prompts to match the length of the
249 # input ones. This allows you for example to use a simple '>' as an output
249 # input ones. This allows you for example to use a simple '>' as an output
250 # prompt, and yet have the output line up with the input. If set to false,
250 # prompt, and yet have the output line up with the input. If set to false,
251 # the output prompts will be unpadded (flush left).
251 # the output prompts will be unpadded (flush left).
252 prompts_pad_left 1
252 prompts_pad_left 1
253
253
254 # quick 1 -> same as ipython -quick
254 # quick 1 -> same as ipython -quick
255 quick 0
255 quick 0
256
256
257 # Use the readline library (1) or not (0). Most users will want this on, but
257 # Use the readline library (1) or not (0). Most users will want this on, but
258 # if you experience strange problems with line management (mainly when using
258 # if you experience strange problems with line management (mainly when using
259 # IPython inside Emacs buffers) you may try disabling it. Not having it on
259 # IPython inside Emacs buffers) you may try disabling it. Not having it on
260 # prevents you from getting command history with the arrow keys, searching and
260 # prevents you from getting command history with the arrow keys, searching and
261 # name completion using TAB.
261 # name completion using TAB.
262
262
263 readline 1
263 readline 1
264
264
265 # Screen Length: number of lines of your screen. This is used to control
265 # Screen Length: number of lines of your screen. This is used to control
266 # printing of very long strings. Strings longer than this number of lines will
266 # printing of very long strings. Strings longer than this number of lines will
267 # be paged with the less command instead of directly printed.
267 # be paged with the less command instead of directly printed.
268
268
269 # The default value for this is 0, which means IPython will auto-detect your
269 # The default value for this is 0, which means IPython will auto-detect your
270 # screen size every time it needs to print. If for some reason this isn't
270 # screen size every time it needs to print. If for some reason this isn't
271 # working well (it needs curses support), specify it yourself. Otherwise don't
271 # working well (it needs curses support), specify it yourself. Otherwise don't
272 # change the default.
272 # change the default.
273
273
274 screen_length 0
274 screen_length 0
275
275
276 # Prompt separators for input and output.
276 # Prompt separators for input and output.
277 # Use \n for newline explicitly, without quotes.
277 # Use \n for newline explicitly, without quotes.
278 # Use 0 (like at the cmd line) to turn off a given separator.
278 # Use 0 (like at the cmd line) to turn off a given separator.
279
279
280 # The structure of prompt printing is:
280 # The structure of prompt printing is:
281 # (SeparateIn)Input....
281 # (SeparateIn)Input....
282 # (SeparateOut)Output...
282 # (SeparateOut)Output...
283 # (SeparateOut2), # that is, no newline is printed after Out2
283 # (SeparateOut2), # that is, no newline is printed after Out2
284 # By choosing these you can organize your output any way you want.
284 # By choosing these you can organize your output any way you want.
285
285
286 separate_in \n
286 separate_in \n
287 separate_out 0
287 separate_out 0
288 separate_out2 0
288 separate_out2 0
289
289
290 # 'nosep 1' is a shorthand for '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'.
290 # 'nosep 1' is a shorthand for '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'.
291 # Simply removes all input/output separators, overriding the choices above.
291 # Simply removes all input/output separators, overriding the choices above.
292 nosep 0
292 nosep 0
293
293
294 # Wildcard searches - IPython has a system for searching names using
294 # Wildcard searches - IPython has a system for searching names using
295 # shell-like wildcards; type %psearch? for details. This variables sets
295 # shell-like wildcards; type %psearch? for details. This variables sets
296 # whether by default such searches should be case sensitive or not. You can
296 # whether by default such searches should be case sensitive or not. You can
297 # always override the default at the system command line or the IPython
297 # always override the default at the system command line or the IPython
298 # prompt.
298 # prompt.
299
299
300 wildcards_case_sensitive 1
300 wildcards_case_sensitive 1
301
301
302 # Object information: at what level of detail to display the string form of an
303 # object. If set to 0, ipython will compute the string form of any object X,
304 # by calling str(X), when X? is typed. If set to 1, str(X) will only be
305 # computed when X?? is given, and if set to 2 or higher, it will never be
306 # computed (there is no X??? level of detail). This is mostly of use to
307 # people who frequently manipulate objects whose string representation is
308 # extremely expensive to compute.
309
310 object_info_string_level 0
311
302 # xmode - Exception reporting mode.
312 # xmode - Exception reporting mode.
303
313
304 # Valid modes: Plain, Context and Verbose.
314 # Valid modes: Plain, Context and Verbose.
305
315
306 # Plain: similar to python's normal traceback printing.
316 # Plain: similar to python's normal traceback printing.
307
317
308 # Context: prints 5 lines of context source code around each line in the
318 # Context: prints 5 lines of context source code around each line in the
309 # traceback.
319 # traceback.
310
320
311 # Verbose: similar to Context, but additionally prints the variables currently
321 # Verbose: similar to Context, but additionally prints the variables currently
312 # visible where the exception happened (shortening their strings if too
322 # visible where the exception happened (shortening their strings if too
313 # long). This can potentially be very slow, if you happen to have a huge data
323 # long). This can potentially be very slow, if you happen to have a huge data
314 # structure whose string representation is complex to compute. Your computer
324 # structure whose string representation is complex to compute. Your computer
315 # may appear to freeze for a while with cpu usage at 100%. If this occurs, you
325 # may appear to freeze for a while with cpu usage at 100%. If this occurs, you
316 # can cancel the traceback with Ctrl-C (maybe hitting it more than once).
326 # can cancel the traceback with Ctrl-C (maybe hitting it more than once).
317
327
318 #xmode Plain
328 #xmode Plain
319 xmode Context
329 xmode Context
320 #xmode Verbose
330 #xmode Verbose
321
331
322 # multi_line_specials: if true, allow magics, aliases and shell escapes (via
332 # multi_line_specials: if true, allow magics, aliases and shell escapes (via
323 # !cmd) to be used in multi-line input (like for loops). For example, if you
333 # !cmd) to be used in multi-line input (like for loops). For example, if you
324 # have this active, the following is valid in IPython:
334 # have this active, the following is valid in IPython:
325 #
335 #
326 #In [17]: for i in range(3):
336 #In [17]: for i in range(3):
327 # ....: mkdir $i
337 # ....: mkdir $i
328 # ....: !touch $i/hello
338 # ....: !touch $i/hello
329 # ....: ls -l $i
339 # ....: ls -l $i
330
340
331 multi_line_specials 1
341 multi_line_specials 1
332
342
333 # wxversion: request a specific wxPython version (used for -wthread)
343 # wxversion: request a specific wxPython version (used for -wthread)
334
344
335 # Set this to the value of wxPython you want to use, but note that this
345 # Set this to the value of wxPython you want to use, but note that this
336 # feature requires you to have the wxversion Python module to work. If you
346 # feature requires you to have the wxversion Python module to work. If you
337 # don't have the wxversion module (try 'import wxversion' at the prompt to
347 # don't have the wxversion module (try 'import wxversion' at the prompt to
338 # check) or simply want to leave the system to pick up the default, leave this
348 # check) or simply want to leave the system to pick up the default, leave this
339 # variable at 0.
349 # variable at 0.
340
350
341 wxversion 0
351 wxversion 0
342
352
343 #---------------------------------------------------------------------------
353 #---------------------------------------------------------------------------
344 # Section: Readline configuration (readline is not available for MS-Windows)
354 # Section: Readline configuration (readline is not available for MS-Windows)
345
355
346 # This is done via the following options:
356 # This is done via the following options:
347
357
348 # (i) readline_parse_and_bind: this option can appear as many times as you
358 # (i) readline_parse_and_bind: this option can appear as many times as you
349 # want, each time defining a string to be executed via a
359 # want, each time defining a string to be executed via a
350 # readline.parse_and_bind() command. The syntax for valid commands of this
360 # readline.parse_and_bind() command. The syntax for valid commands of this
351 # kind can be found by reading the documentation for the GNU readline library,
361 # kind can be found by reading the documentation for the GNU readline library,
352 # as these commands are of the kind which readline accepts in its
362 # as these commands are of the kind which readline accepts in its
353 # configuration file.
363 # configuration file.
354
364
355 # The TAB key can be used to complete names at the command line in one of two
365 # The TAB key can be used to complete names at the command line in one of two
356 # ways: 'complete' and 'menu-complete'. The difference is that 'complete' only
366 # ways: 'complete' and 'menu-complete'. The difference is that 'complete' only
357 # completes as much as possible while 'menu-complete' cycles through all
367 # completes as much as possible while 'menu-complete' cycles through all
358 # possible completions. Leave the one you prefer uncommented.
368 # possible completions. Leave the one you prefer uncommented.
359
369
360 readline_parse_and_bind tab: complete
370 readline_parse_and_bind tab: complete
361 #readline_parse_and_bind tab: menu-complete
371 #readline_parse_and_bind tab: menu-complete
362
372
363 # This binds Control-l to printing the list of all possible completions when
373 # This binds Control-l to printing the list of all possible completions when
364 # there is more than one (what 'complete' does when hitting TAB twice, or at
374 # there is more than one (what 'complete' does when hitting TAB twice, or at
365 # the first TAB if show-all-if-ambiguous is on)
375 # the first TAB if show-all-if-ambiguous is on)
366 readline_parse_and_bind "\C-l": possible-completions
376 readline_parse_and_bind "\C-l": possible-completions
367
377
368 # This forces readline to automatically print the above list when tab
378 # This forces readline to automatically print the above list when tab
369 # completion is set to 'complete'. You can still get this list manually by
379 # completion is set to 'complete'. You can still get this list manually by
370 # using the key bound to 'possible-completions' (Control-l by default) or by
380 # using the key bound to 'possible-completions' (Control-l by default) or by
371 # hitting TAB twice. Turning this on makes the printing happen at the first
381 # hitting TAB twice. Turning this on makes the printing happen at the first
372 # TAB.
382 # TAB.
373 readline_parse_and_bind set show-all-if-ambiguous on
383 readline_parse_and_bind set show-all-if-ambiguous on
374
384
375 # If you have TAB set to complete names, you can rebind any key (Control-o by
385 # If you have TAB set to complete names, you can rebind any key (Control-o by
376 # default) to insert a true TAB character.
386 # default) to insert a true TAB character.
377 readline_parse_and_bind "\C-o": tab-insert
387 readline_parse_and_bind "\C-o": tab-insert
378
388
379 # These commands allow you to indent/unindent easily, with the 4-space
389 # These commands allow you to indent/unindent easily, with the 4-space
380 # convention of the Python coding standards. Since IPython's internal
390 # convention of the Python coding standards. Since IPython's internal
381 # auto-indent system also uses 4 spaces, you should not change the number of
391 # auto-indent system also uses 4 spaces, you should not change the number of
382 # spaces in the code below.
392 # spaces in the code below.
383 readline_parse_and_bind "\M-i": " "
393 readline_parse_and_bind "\M-i": " "
384 readline_parse_and_bind "\M-o": "\d\d\d\d"
394 readline_parse_and_bind "\M-o": "\d\d\d\d"
385 readline_parse_and_bind "\M-I": "\d\d\d\d"
395 readline_parse_and_bind "\M-I": "\d\d\d\d"
386
396
387 # Bindings for incremental searches in the history. These searches use the
397 # Bindings for incremental searches in the history. These searches use the
388 # string typed so far on the command line and search anything in the previous
398 # string typed so far on the command line and search anything in the previous
389 # input history containing them.
399 # input history containing them.
390 readline_parse_and_bind "\C-r": reverse-search-history
400 readline_parse_and_bind "\C-r": reverse-search-history
391 readline_parse_and_bind "\C-s": forward-search-history
401 readline_parse_and_bind "\C-s": forward-search-history
392
402
393 # Bindings for completing the current line in the history of previous
403 # Bindings for completing the current line in the history of previous
394 # commands. This allows you to recall any previous command by typing its first
404 # commands. This allows you to recall any previous command by typing its first
395 # few letters and hitting Control-p, bypassing all intermediate commands which
405 # few letters and hitting Control-p, bypassing all intermediate commands which
396 # may be in the history (much faster than hitting up-arrow 50 times!)
406 # may be in the history (much faster than hitting up-arrow 50 times!)
397 readline_parse_and_bind "\C-p": history-search-backward
407 readline_parse_and_bind "\C-p": history-search-backward
398 readline_parse_and_bind "\C-n": history-search-forward
408 readline_parse_and_bind "\C-n": history-search-forward
399
409
400 # I also like to have the same functionality on the plain arrow keys. If you'd
410 # I also like to have the same functionality on the plain arrow keys. If you'd
401 # rather have the arrows use all the history (and not just match what you've
411 # rather have the arrows use all the history (and not just match what you've
402 # typed so far), comment out or delete the next two lines.
412 # typed so far), comment out or delete the next two lines.
403 readline_parse_and_bind "\e[A": history-search-backward
413 readline_parse_and_bind "\e[A": history-search-backward
404 readline_parse_and_bind "\e[B": history-search-forward
414 readline_parse_and_bind "\e[B": history-search-forward
405
415
406 # These are typically on by default under *nix, but not win32.
416 # These are typically on by default under *nix, but not win32.
407 readline_parse_and_bind "\C-k": kill-line
417 readline_parse_and_bind "\C-k": kill-line
408 readline_parse_and_bind "\C-u": unix-line-discard
418 readline_parse_and_bind "\C-u": unix-line-discard
409
419
410 # (ii) readline_remove_delims: a string of characters to be removed from the
420 # (ii) readline_remove_delims: a string of characters to be removed from the
411 # default word-delimiters list used by readline, so that completions may be
421 # default word-delimiters list used by readline, so that completions may be
412 # performed on strings which contain them.
422 # performed on strings which contain them.
413
423
414 readline_remove_delims -/~
424 readline_remove_delims -/~
415
425
416 # (iii) readline_merge_completions: whether to merge the result of all
426 # (iii) readline_merge_completions: whether to merge the result of all
417 # possible completions or not. If true, IPython will complete filenames,
427 # possible completions or not. If true, IPython will complete filenames,
418 # python names and aliases and return all possible completions. If you set it
428 # python names and aliases and return all possible completions. If you set it
419 # to false, each completer is used at a time, and only if it doesn't return
429 # to false, each completer is used at a time, and only if it doesn't return
420 # any completions is the next one used.
430 # any completions is the next one used.
421
431
422 # The default order is: [python_matches, file_matches, alias_matches]
432 # The default order is: [python_matches, file_matches, alias_matches]
423
433
424 readline_merge_completions 1
434 readline_merge_completions 1
425
435
426 # (iv) readline_omit__names: normally hitting <tab> after a '.' in a name
436 # (iv) readline_omit__names: normally hitting <tab> after a '.' in a name
427 # will complete all attributes of an object, including all the special methods
437 # will complete all attributes of an object, including all the special methods
428 # whose names start with single or double underscores (like __getitem__ or
438 # whose names start with single or double underscores (like __getitem__ or
429 # __class__).
439 # __class__).
430
440
431 # This variable allows you to control this completion behavior:
441 # This variable allows you to control this completion behavior:
432
442
433 # readline_omit__names 1 -> completion will omit showing any names starting
443 # readline_omit__names 1 -> completion will omit showing any names starting
434 # with two __, but it will still show names starting with one _.
444 # with two __, but it will still show names starting with one _.
435
445
436 # readline_omit__names 2 -> completion will omit all names beginning with one
446 # readline_omit__names 2 -> completion will omit all names beginning with one
437 # _ (which obviously means filtering out the double __ ones).
447 # _ (which obviously means filtering out the double __ ones).
438
448
439 # Even when this option is set, you can still see those names by explicitly
449 # Even when this option is set, you can still see those names by explicitly
440 # typing a _ after the period and hitting <tab>: 'name._<tab>' will always
450 # typing a _ after the period and hitting <tab>: 'name._<tab>' will always
441 # complete attribute names starting with '_'.
451 # complete attribute names starting with '_'.
442
452
443 # This option is off by default so that new users see all attributes of any
453 # This option is off by default so that new users see all attributes of any
444 # objects they are dealing with.
454 # objects they are dealing with.
445
455
446 readline_omit__names 0
456 readline_omit__names 0
447
457
448 #---------------------------------------------------------------------------
458 #---------------------------------------------------------------------------
449 # Section: modules to be loaded with 'import ...'
459 # Section: modules to be loaded with 'import ...'
450
460
451 # List, separated by spaces, the names of the modules you want to import
461 # List, separated by spaces, the names of the modules you want to import
452
462
453 # Example:
463 # Example:
454 # import_mod sys os
464 # import_mod sys os
455 # will produce internally the statements
465 # will produce internally the statements
456 # import sys
466 # import sys
457 # import os
467 # import os
458
468
459 # Each import is executed in its own try/except block, so if one module
469 # Each import is executed in its own try/except block, so if one module
460 # fails to load the others will still be ok.
470 # fails to load the others will still be ok.
461
471
462 import_mod
472 import_mod
463
473
464 #---------------------------------------------------------------------------
474 #---------------------------------------------------------------------------
465 # Section: modules to import some functions from: 'from ... import ...'
475 # Section: modules to import some functions from: 'from ... import ...'
466
476
467 # List, one per line, the modules for which you want only to import some
477 # List, one per line, the modules for which you want only to import some
468 # functions. Give the module name first and then the name of functions to be
478 # functions. Give the module name first and then the name of functions to be
469 # imported from that module.
479 # imported from that module.
470
480
471 # Example:
481 # Example:
472
482
473 # import_some IPython.genutils timing timings
483 # import_some IPython.genutils timing timings
474 # will produce internally the statement
484 # will produce internally the statement
475 # from IPython.genutils import timing, timings
485 # from IPython.genutils import timing, timings
476
486
477 # timing() and timings() are two IPython utilities for timing the execution of
487 # timing() and timings() are two IPython utilities for timing the execution of
478 # your own functions, which you may find useful. Just commment out the above
488 # your own functions, which you may find useful. Just commment out the above
479 # line if you want to test them.
489 # line if you want to test them.
480
490
481 # If you have more than one modules_some line, each gets its own try/except
491 # If you have more than one modules_some line, each gets its own try/except
482 # block (like modules, see above).
492 # block (like modules, see above).
483
493
484 import_some
494 import_some
485
495
486 #---------------------------------------------------------------------------
496 #---------------------------------------------------------------------------
487 # Section: modules to import all from : 'from ... import *'
497 # Section: modules to import all from : 'from ... import *'
488
498
489 # List (same syntax as import_mod above) those modules for which you want to
499 # List (same syntax as import_mod above) those modules for which you want to
490 # import all functions. Remember, this is a potentially dangerous thing to do,
500 # import all functions. Remember, this is a potentially dangerous thing to do,
491 # since it is very easy to overwrite names of things you need. Use with
501 # since it is very easy to overwrite names of things you need. Use with
492 # caution.
502 # caution.
493
503
494 # Example:
504 # Example:
495 # import_all sys os
505 # import_all sys os
496 # will produce internally the statements
506 # will produce internally the statements
497 # from sys import *
507 # from sys import *
498 # from os import *
508 # from os import *
499
509
500 # As before, each will be called in a separate try/except block.
510 # As before, each will be called in a separate try/except block.
501
511
502 import_all
512 import_all
503
513
504 #---------------------------------------------------------------------------
514 #---------------------------------------------------------------------------
505 # Section: Python code to execute.
515 # Section: Python code to execute.
506
516
507 # Put here code to be explicitly executed (keep it simple!)
517 # Put here code to be explicitly executed (keep it simple!)
508 # Put one line of python code per line. All whitespace is removed (this is a
518 # Put one line of python code per line. All whitespace is removed (this is a
509 # feature, not a bug), so don't get fancy building loops here.
519 # feature, not a bug), so don't get fancy building loops here.
510 # This is just for quick convenient creation of things you want available.
520 # This is just for quick convenient creation of things you want available.
511
521
512 # Example:
522 # Example:
513 # execute x = 1
523 # execute x = 1
514 # execute print 'hello world'; y = z = 'a'
524 # execute print 'hello world'; y = z = 'a'
515 # will produce internally
525 # will produce internally
516 # x = 1
526 # x = 1
517 # print 'hello world'; y = z = 'a'
527 # print 'hello world'; y = z = 'a'
518 # and each *line* (not each statement, we don't do python syntax parsing) is
528 # and each *line* (not each statement, we don't do python syntax parsing) is
519 # executed in its own try/except block.
529 # executed in its own try/except block.
520
530
521 execute
531 execute
522
532
523 # Note for the adventurous: you can use this to define your own names for the
533 # Note for the adventurous: you can use this to define your own names for the
524 # magic functions, by playing some namespace tricks:
534 # magic functions, by playing some namespace tricks:
525
535
526 # execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
536 # execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
527
537
528 # defines %pf as a new name for %profile.
538 # defines %pf as a new name for %profile.
529
539
530 #---------------------------------------------------------------------------
540 #---------------------------------------------------------------------------
531 # Section: Pyhton files to load and execute.
541 # Section: Pyhton files to load and execute.
532
542
533 # Put here the full names of files you want executed with execfile(file). If
543 # Put here the full names of files you want executed with execfile(file). If
534 # you want complicated initialization, just write whatever you want in a
544 # you want complicated initialization, just write whatever you want in a
535 # regular python file and load it from here.
545 # regular python file and load it from here.
536
546
537 # Filenames defined here (which *must* include the extension) are searched for
547 # Filenames defined here (which *must* include the extension) are searched for
538 # through all of sys.path. Since IPython adds your .ipython directory to
548 # through all of sys.path. Since IPython adds your .ipython directory to
539 # sys.path, they can also be placed in your .ipython dir and will be
549 # sys.path, they can also be placed in your .ipython dir and will be
540 # found. Otherwise (if you want to execute things not in .ipyton nor in
550 # found. Otherwise (if you want to execute things not in .ipyton nor in
541 # sys.path) give a full path (you can use ~, it gets expanded)
551 # sys.path) give a full path (you can use ~, it gets expanded)
542
552
543 # Example:
553 # Example:
544 # execfile file1.py ~/file2.py
554 # execfile file1.py ~/file2.py
545 # will generate
555 # will generate
546 # execfile('file1.py')
556 # execfile('file1.py')
547 # execfile('_path_to_your_home/file2.py')
557 # execfile('_path_to_your_home/file2.py')
548
558
549 # As before, each file gets its own try/except block.
559 # As before, each file gets its own try/except block.
550
560
551 execfile
561 execfile
552
562
553 # If you are feeling adventurous, you can even add functionality to IPython
563 # If you are feeling adventurous, you can even add functionality to IPython
554 # through here. IPython works through a global variable called __ip which
564 # through here. IPython works through a global variable called __ip which
555 # exists at the time when these files are read. If you know what you are doing
565 # exists at the time when these files are read. If you know what you are doing
556 # (read the source) you can add functions to __ip in files loaded here.
566 # (read the source) you can add functions to __ip in files loaded here.
557
567
558 # The file example-magic.py contains a simple but correct example. Try it:
568 # The file example-magic.py contains a simple but correct example. Try it:
559
569
560 # execfile example-magic.py
570 # execfile example-magic.py
561
571
562 # Look at the examples in IPython/iplib.py for more details on how these magic
572 # Look at the examples in IPython/iplib.py for more details on how these magic
563 # functions need to process their arguments.
573 # functions need to process their arguments.
564
574
565 #---------------------------------------------------------------------------
575 #---------------------------------------------------------------------------
566 # Section: aliases for system shell commands
576 # Section: aliases for system shell commands
567
577
568 # Here you can define your own names for system commands. The syntax is
578 # Here you can define your own names for system commands. The syntax is
569 # similar to that of the builtin %alias function:
579 # similar to that of the builtin %alias function:
570
580
571 # alias alias_name command_string
581 # alias alias_name command_string
572
582
573 # The resulting aliases are auto-generated magic functions (hence usable as
583 # The resulting aliases are auto-generated magic functions (hence usable as
574 # %alias_name)
584 # %alias_name)
575
585
576 # For example:
586 # For example:
577
587
578 # alias myls ls -la
588 # alias myls ls -la
579
589
580 # will define 'myls' as an alias for executing the system command 'ls -la'.
590 # will define 'myls' as an alias for executing the system command 'ls -la'.
581 # This allows you to customize IPython's environment to have the same aliases
591 # This allows you to customize IPython's environment to have the same aliases
582 # you are accustomed to from your own shell.
592 # you are accustomed to from your own shell.
583
593
584 # You can also define aliases with parameters using %s specifiers (one per
594 # You can also define aliases with parameters using %s specifiers (one per
585 # parameter):
595 # parameter):
586
596
587 # alias parts echo first %s second %s
597 # alias parts echo first %s second %s
588
598
589 # will give you in IPython:
599 # will give you in IPython:
590 # >>> %parts A B
600 # >>> %parts A B
591 # first A second B
601 # first A second B
592
602
593 # Use one 'alias' statement per alias you wish to define.
603 # Use one 'alias' statement per alias you wish to define.
594
604
595 # alias
605 # alias
596
606
597 #************************* end of file <ipythonrc> ************************
607 #************************* end of file <ipythonrc> ************************
@@ -1,2291 +1,2300 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 1326 2006-05-25 02:07:11Z fperez $
9 $Id: iplib.py 1329 2006-05-26 07:52:45Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pdb
50 import pdb
51 import pydoc
51 import pydoc
52 import re
52 import re
53 import shutil
53 import shutil
54 import string
54 import string
55 import sys
55 import sys
56 import tempfile
56 import tempfile
57 import traceback
57 import traceback
58 import types
58 import types
59 import pickleshare
59 import pickleshare
60
60
61 from pprint import pprint, pformat
61 from pprint import pprint, pformat
62
62
63 # IPython's own modules
63 # IPython's own modules
64 import IPython
64 import IPython
65 from IPython import OInspect,PyColorize,ultraTB
65 from IPython import OInspect,PyColorize,ultraTB
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.FakeModule import FakeModule
67 from IPython.FakeModule import FakeModule
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 from IPython.Logger import Logger
69 from IPython.Logger import Logger
70 from IPython.Magic import Magic
70 from IPython.Magic import Magic
71 from IPython.Prompts import CachedOutput
71 from IPython.Prompts import CachedOutput
72 from IPython.ipstruct import Struct
72 from IPython.ipstruct import Struct
73 from IPython.background_jobs import BackgroundJobManager
73 from IPython.background_jobs import BackgroundJobManager
74 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.genutils import *
75 from IPython.genutils import *
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class InputList(list):
129 class InputList(list):
130 """Class to store user input.
130 """Class to store user input.
131
131
132 It's basically a list, but slices return a string instead of a list, thus
132 It's basically a list, but slices return a string instead of a list, thus
133 allowing things like (assuming 'In' is an instance):
133 allowing things like (assuming 'In' is an instance):
134
134
135 exec In[4:7]
135 exec In[4:7]
136
136
137 or
137 or
138
138
139 exec In[5:9] + In[14] + In[21:25]"""
139 exec In[5:9] + In[14] + In[21:25]"""
140
140
141 def __getslice__(self,i,j):
141 def __getslice__(self,i,j):
142 return ''.join(list.__getslice__(self,i,j))
142 return ''.join(list.__getslice__(self,i,j))
143
143
144 class SyntaxTB(ultraTB.ListTB):
144 class SyntaxTB(ultraTB.ListTB):
145 """Extension which holds some state: the last exception value"""
145 """Extension which holds some state: the last exception value"""
146
146
147 def __init__(self,color_scheme = 'NoColor'):
147 def __init__(self,color_scheme = 'NoColor'):
148 ultraTB.ListTB.__init__(self,color_scheme)
148 ultraTB.ListTB.__init__(self,color_scheme)
149 self.last_syntax_error = None
149 self.last_syntax_error = None
150
150
151 def __call__(self, etype, value, elist):
151 def __call__(self, etype, value, elist):
152 self.last_syntax_error = value
152 self.last_syntax_error = value
153 ultraTB.ListTB.__call__(self,etype,value,elist)
153 ultraTB.ListTB.__call__(self,etype,value,elist)
154
154
155 def clear_err_state(self):
155 def clear_err_state(self):
156 """Return the current error state and clear it"""
156 """Return the current error state and clear it"""
157 e = self.last_syntax_error
157 e = self.last_syntax_error
158 self.last_syntax_error = None
158 self.last_syntax_error = None
159 return e
159 return e
160
160
161 #****************************************************************************
161 #****************************************************************************
162 # Main IPython class
162 # Main IPython class
163
163
164 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
164 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
165 # until a full rewrite is made. I've cleaned all cross-class uses of
165 # until a full rewrite is made. I've cleaned all cross-class uses of
166 # attributes and methods, but too much user code out there relies on the
166 # attributes and methods, but too much user code out there relies on the
167 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
167 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
168 #
168 #
169 # But at least now, all the pieces have been separated and we could, in
169 # But at least now, all the pieces have been separated and we could, in
170 # principle, stop using the mixin. This will ease the transition to the
170 # principle, stop using the mixin. This will ease the transition to the
171 # chainsaw branch.
171 # chainsaw branch.
172
172
173 # For reference, the following is the list of 'self.foo' uses in the Magic
173 # For reference, the following is the list of 'self.foo' uses in the Magic
174 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
174 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
175 # class, to prevent clashes.
175 # class, to prevent clashes.
176
176
177 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
177 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
178 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
178 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
179 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
179 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
180 # 'self.value']
180 # 'self.value']
181
181
182 class InteractiveShell(object,Magic):
182 class InteractiveShell(object,Magic):
183 """An enhanced console for Python."""
183 """An enhanced console for Python."""
184
184
185 # class attribute to indicate whether the class supports threads or not.
185 # class attribute to indicate whether the class supports threads or not.
186 # Subclasses with thread support should override this as needed.
186 # Subclasses with thread support should override this as needed.
187 isthreaded = False
187 isthreaded = False
188
188
189 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
189 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
190 user_ns = None,user_global_ns=None,banner2='',
190 user_ns = None,user_global_ns=None,banner2='',
191 custom_exceptions=((),None),embedded=False):
191 custom_exceptions=((),None),embedded=False):
192
192
193
193
194 # log system
194 # log system
195 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
195 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
196
196
197 # some minimal strict typechecks. For some core data structures, I
197 # some minimal strict typechecks. For some core data structures, I
198 # want actual basic python types, not just anything that looks like
198 # want actual basic python types, not just anything that looks like
199 # one. This is especially true for namespaces.
199 # one. This is especially true for namespaces.
200 for ns in (user_ns,user_global_ns):
200 for ns in (user_ns,user_global_ns):
201 if ns is not None and type(ns) != types.DictType:
201 if ns is not None and type(ns) != types.DictType:
202 raise TypeError,'namespace must be a dictionary'
202 raise TypeError,'namespace must be a dictionary'
203
203
204 # Job manager (for jobs run as background threads)
204 # Job manager (for jobs run as background threads)
205 self.jobs = BackgroundJobManager()
205 self.jobs = BackgroundJobManager()
206
206
207 # Store the actual shell's name
207 # Store the actual shell's name
208 self.name = name
208 self.name = name
209
209
210 # We need to know whether the instance is meant for embedding, since
210 # We need to know whether the instance is meant for embedding, since
211 # global/local namespaces need to be handled differently in that case
211 # global/local namespaces need to be handled differently in that case
212 self.embedded = embedded
212 self.embedded = embedded
213
213
214 # command compiler
214 # command compiler
215 self.compile = codeop.CommandCompiler()
215 self.compile = codeop.CommandCompiler()
216
216
217 # User input buffer
217 # User input buffer
218 self.buffer = []
218 self.buffer = []
219
219
220 # Default name given in compilation of code
220 # Default name given in compilation of code
221 self.filename = '<ipython console>'
221 self.filename = '<ipython console>'
222
222
223 # Make an empty namespace, which extension writers can rely on both
223 # Make an empty namespace, which extension writers can rely on both
224 # existing and NEVER being used by ipython itself. This gives them a
224 # existing and NEVER being used by ipython itself. This gives them a
225 # convenient location for storing additional information and state
225 # convenient location for storing additional information and state
226 # their extensions may require, without fear of collisions with other
226 # their extensions may require, without fear of collisions with other
227 # ipython names that may develop later.
227 # ipython names that may develop later.
228 self.meta = Struct()
228 self.meta = Struct()
229
229
230 # Create the namespace where the user will operate. user_ns is
230 # Create the namespace where the user will operate. user_ns is
231 # normally the only one used, and it is passed to the exec calls as
231 # normally the only one used, and it is passed to the exec calls as
232 # the locals argument. But we do carry a user_global_ns namespace
232 # the locals argument. But we do carry a user_global_ns namespace
233 # given as the exec 'globals' argument, This is useful in embedding
233 # given as the exec 'globals' argument, This is useful in embedding
234 # situations where the ipython shell opens in a context where the
234 # situations where the ipython shell opens in a context where the
235 # distinction between locals and globals is meaningful.
235 # distinction between locals and globals is meaningful.
236
236
237 # FIXME. For some strange reason, __builtins__ is showing up at user
237 # FIXME. For some strange reason, __builtins__ is showing up at user
238 # level as a dict instead of a module. This is a manual fix, but I
238 # level as a dict instead of a module. This is a manual fix, but I
239 # should really track down where the problem is coming from. Alex
239 # should really track down where the problem is coming from. Alex
240 # Schmolck reported this problem first.
240 # Schmolck reported this problem first.
241
241
242 # A useful post by Alex Martelli on this topic:
242 # A useful post by Alex Martelli on this topic:
243 # Re: inconsistent value from __builtins__
243 # Re: inconsistent value from __builtins__
244 # Von: Alex Martelli <aleaxit@yahoo.com>
244 # Von: Alex Martelli <aleaxit@yahoo.com>
245 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
245 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
246 # Gruppen: comp.lang.python
246 # Gruppen: comp.lang.python
247
247
248 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
248 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
249 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
249 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
250 # > <type 'dict'>
250 # > <type 'dict'>
251 # > >>> print type(__builtins__)
251 # > >>> print type(__builtins__)
252 # > <type 'module'>
252 # > <type 'module'>
253 # > Is this difference in return value intentional?
253 # > Is this difference in return value intentional?
254
254
255 # Well, it's documented that '__builtins__' can be either a dictionary
255 # Well, it's documented that '__builtins__' can be either a dictionary
256 # or a module, and it's been that way for a long time. Whether it's
256 # or a module, and it's been that way for a long time. Whether it's
257 # intentional (or sensible), I don't know. In any case, the idea is
257 # intentional (or sensible), I don't know. In any case, the idea is
258 # that if you need to access the built-in namespace directly, you
258 # that if you need to access the built-in namespace directly, you
259 # should start with "import __builtin__" (note, no 's') which will
259 # should start with "import __builtin__" (note, no 's') which will
260 # definitely give you a module. Yeah, it's somewhat confusing:-(.
260 # definitely give you a module. Yeah, it's somewhat confusing:-(.
261
261
262 # These routines return properly built dicts as needed by the rest of
262 # These routines return properly built dicts as needed by the rest of
263 # the code, and can also be used by extension writers to generate
263 # the code, and can also be used by extension writers to generate
264 # properly initialized namespaces.
264 # properly initialized namespaces.
265 user_ns = IPython.ipapi.make_user_ns(user_ns)
265 user_ns = IPython.ipapi.make_user_ns(user_ns)
266 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
266 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
267
267
268 # Assign namespaces
268 # Assign namespaces
269 # This is the namespace where all normal user variables live
269 # This is the namespace where all normal user variables live
270 self.user_ns = user_ns
270 self.user_ns = user_ns
271 # Embedded instances require a separate namespace for globals.
271 # Embedded instances require a separate namespace for globals.
272 # Normally this one is unused by non-embedded instances.
272 # Normally this one is unused by non-embedded instances.
273 self.user_global_ns = user_global_ns
273 self.user_global_ns = user_global_ns
274 # A namespace to keep track of internal data structures to prevent
274 # A namespace to keep track of internal data structures to prevent
275 # them from cluttering user-visible stuff. Will be updated later
275 # them from cluttering user-visible stuff. Will be updated later
276 self.internal_ns = {}
276 self.internal_ns = {}
277
277
278 # Namespace of system aliases. Each entry in the alias
278 # Namespace of system aliases. Each entry in the alias
279 # table must be a 2-tuple of the form (N,name), where N is the number
279 # table must be a 2-tuple of the form (N,name), where N is the number
280 # of positional arguments of the alias.
280 # of positional arguments of the alias.
281 self.alias_table = {}
281 self.alias_table = {}
282
282
283 # A table holding all the namespaces IPython deals with, so that
283 # A table holding all the namespaces IPython deals with, so that
284 # introspection facilities can search easily.
284 # introspection facilities can search easily.
285 self.ns_table = {'user':user_ns,
285 self.ns_table = {'user':user_ns,
286 'user_global':user_global_ns,
286 'user_global':user_global_ns,
287 'alias':self.alias_table,
287 'alias':self.alias_table,
288 'internal':self.internal_ns,
288 'internal':self.internal_ns,
289 'builtin':__builtin__.__dict__
289 'builtin':__builtin__.__dict__
290 }
290 }
291
291
292 # The user namespace MUST have a pointer to the shell itself.
292 # The user namespace MUST have a pointer to the shell itself.
293 self.user_ns[name] = self
293 self.user_ns[name] = self
294
294
295 # We need to insert into sys.modules something that looks like a
295 # We need to insert into sys.modules something that looks like a
296 # module but which accesses the IPython namespace, for shelve and
296 # module but which accesses the IPython namespace, for shelve and
297 # pickle to work interactively. Normally they rely on getting
297 # pickle to work interactively. Normally they rely on getting
298 # everything out of __main__, but for embedding purposes each IPython
298 # everything out of __main__, but for embedding purposes each IPython
299 # instance has its own private namespace, so we can't go shoving
299 # instance has its own private namespace, so we can't go shoving
300 # everything into __main__.
300 # everything into __main__.
301
301
302 # note, however, that we should only do this for non-embedded
302 # note, however, that we should only do this for non-embedded
303 # ipythons, which really mimic the __main__.__dict__ with their own
303 # ipythons, which really mimic the __main__.__dict__ with their own
304 # namespace. Embedded instances, on the other hand, should not do
304 # namespace. Embedded instances, on the other hand, should not do
305 # this because they need to manage the user local/global namespaces
305 # this because they need to manage the user local/global namespaces
306 # only, but they live within a 'normal' __main__ (meaning, they
306 # only, but they live within a 'normal' __main__ (meaning, they
307 # shouldn't overtake the execution environment of the script they're
307 # shouldn't overtake the execution environment of the script they're
308 # embedded in).
308 # embedded in).
309
309
310 if not embedded:
310 if not embedded:
311 try:
311 try:
312 main_name = self.user_ns['__name__']
312 main_name = self.user_ns['__name__']
313 except KeyError:
313 except KeyError:
314 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
314 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
315 else:
315 else:
316 #print "pickle hack in place" # dbg
316 #print "pickle hack in place" # dbg
317 #print 'main_name:',main_name # dbg
317 #print 'main_name:',main_name # dbg
318 sys.modules[main_name] = FakeModule(self.user_ns)
318 sys.modules[main_name] = FakeModule(self.user_ns)
319
319
320 # List of input with multi-line handling.
320 # List of input with multi-line handling.
321 # Fill its zero entry, user counter starts at 1
321 # Fill its zero entry, user counter starts at 1
322 self.input_hist = InputList(['\n'])
322 self.input_hist = InputList(['\n'])
323 # This one will hold the 'raw' input history, without any
323 # This one will hold the 'raw' input history, without any
324 # pre-processing. This will allow users to retrieve the input just as
324 # pre-processing. This will allow users to retrieve the input just as
325 # it was exactly typed in by the user, with %hist -r.
325 # it was exactly typed in by the user, with %hist -r.
326 self.input_hist_raw = InputList(['\n'])
326 self.input_hist_raw = InputList(['\n'])
327
327
328 # list of visited directories
328 # list of visited directories
329 try:
329 try:
330 self.dir_hist = [os.getcwd()]
330 self.dir_hist = [os.getcwd()]
331 except IOError, e:
331 except IOError, e:
332 self.dir_hist = []
332 self.dir_hist = []
333
333
334 # dict of output history
334 # dict of output history
335 self.output_hist = {}
335 self.output_hist = {}
336
336
337 # dict of things NOT to alias (keywords, builtins and some magics)
337 # dict of things NOT to alias (keywords, builtins and some magics)
338 no_alias = {}
338 no_alias = {}
339 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
339 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
340 for key in keyword.kwlist + no_alias_magics:
340 for key in keyword.kwlist + no_alias_magics:
341 no_alias[key] = 1
341 no_alias[key] = 1
342 no_alias.update(__builtin__.__dict__)
342 no_alias.update(__builtin__.__dict__)
343 self.no_alias = no_alias
343 self.no_alias = no_alias
344
344
345 # make global variables for user access to these
345 # make global variables for user access to these
346 self.user_ns['_ih'] = self.input_hist
346 self.user_ns['_ih'] = self.input_hist
347 self.user_ns['_oh'] = self.output_hist
347 self.user_ns['_oh'] = self.output_hist
348 self.user_ns['_dh'] = self.dir_hist
348 self.user_ns['_dh'] = self.dir_hist
349
349
350 # user aliases to input and output histories
350 # user aliases to input and output histories
351 self.user_ns['In'] = self.input_hist
351 self.user_ns['In'] = self.input_hist
352 self.user_ns['Out'] = self.output_hist
352 self.user_ns['Out'] = self.output_hist
353
353
354 # Object variable to store code object waiting execution. This is
354 # Object variable to store code object waiting execution. This is
355 # used mainly by the multithreaded shells, but it can come in handy in
355 # used mainly by the multithreaded shells, but it can come in handy in
356 # other situations. No need to use a Queue here, since it's a single
356 # other situations. No need to use a Queue here, since it's a single
357 # item which gets cleared once run.
357 # item which gets cleared once run.
358 self.code_to_run = None
358 self.code_to_run = None
359
359
360 # escapes for automatic behavior on the command line
360 # escapes for automatic behavior on the command line
361 self.ESC_SHELL = '!'
361 self.ESC_SHELL = '!'
362 self.ESC_HELP = '?'
362 self.ESC_HELP = '?'
363 self.ESC_MAGIC = '%'
363 self.ESC_MAGIC = '%'
364 self.ESC_QUOTE = ','
364 self.ESC_QUOTE = ','
365 self.ESC_QUOTE2 = ';'
365 self.ESC_QUOTE2 = ';'
366 self.ESC_PAREN = '/'
366 self.ESC_PAREN = '/'
367
367
368 # And their associated handlers
368 # And their associated handlers
369 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
369 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
370 self.ESC_QUOTE : self.handle_auto,
370 self.ESC_QUOTE : self.handle_auto,
371 self.ESC_QUOTE2 : self.handle_auto,
371 self.ESC_QUOTE2 : self.handle_auto,
372 self.ESC_MAGIC : self.handle_magic,
372 self.ESC_MAGIC : self.handle_magic,
373 self.ESC_HELP : self.handle_help,
373 self.ESC_HELP : self.handle_help,
374 self.ESC_SHELL : self.handle_shell_escape,
374 self.ESC_SHELL : self.handle_shell_escape,
375 }
375 }
376
376
377 # class initializations
377 # class initializations
378 Magic.__init__(self,self)
378 Magic.__init__(self,self)
379
379
380 # Python source parser/formatter for syntax highlighting
380 # Python source parser/formatter for syntax highlighting
381 pyformat = PyColorize.Parser().format
381 pyformat = PyColorize.Parser().format
382 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
382 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
383
383
384 # hooks holds pointers used for user-side customizations
384 # hooks holds pointers used for user-side customizations
385 self.hooks = Struct()
385 self.hooks = Struct()
386
386
387 # Set all default hooks, defined in the IPython.hooks module.
387 # Set all default hooks, defined in the IPython.hooks module.
388 hooks = IPython.hooks
388 hooks = IPython.hooks
389 for hook_name in hooks.__all__:
389 for hook_name in hooks.__all__:
390 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
390 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
391 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
391 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
392 #print "bound hook",hook_name
392 #print "bound hook",hook_name
393
393
394 # Flag to mark unconditional exit
394 # Flag to mark unconditional exit
395 self.exit_now = False
395 self.exit_now = False
396
396
397 self.usage_min = """\
397 self.usage_min = """\
398 An enhanced console for Python.
398 An enhanced console for Python.
399 Some of its features are:
399 Some of its features are:
400 - Readline support if the readline library is present.
400 - Readline support if the readline library is present.
401 - Tab completion in the local namespace.
401 - Tab completion in the local namespace.
402 - Logging of input, see command-line options.
402 - Logging of input, see command-line options.
403 - System shell escape via ! , eg !ls.
403 - System shell escape via ! , eg !ls.
404 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
404 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
405 - Keeps track of locally defined variables via %who, %whos.
405 - Keeps track of locally defined variables via %who, %whos.
406 - Show object information with a ? eg ?x or x? (use ?? for more info).
406 - Show object information with a ? eg ?x or x? (use ?? for more info).
407 """
407 """
408 if usage: self.usage = usage
408 if usage: self.usage = usage
409 else: self.usage = self.usage_min
409 else: self.usage = self.usage_min
410
410
411 # Storage
411 # Storage
412 self.rc = rc # This will hold all configuration information
412 self.rc = rc # This will hold all configuration information
413 self.pager = 'less'
413 self.pager = 'less'
414 # temporary files used for various purposes. Deleted at exit.
414 # temporary files used for various purposes. Deleted at exit.
415 self.tempfiles = []
415 self.tempfiles = []
416
416
417 # Keep track of readline usage (later set by init_readline)
417 # Keep track of readline usage (later set by init_readline)
418 self.has_readline = False
418 self.has_readline = False
419
419
420 # template for logfile headers. It gets resolved at runtime by the
420 # template for logfile headers. It gets resolved at runtime by the
421 # logstart method.
421 # logstart method.
422 self.loghead_tpl = \
422 self.loghead_tpl = \
423 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
423 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
424 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
424 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
425 #log# opts = %s
425 #log# opts = %s
426 #log# args = %s
426 #log# args = %s
427 #log# It is safe to make manual edits below here.
427 #log# It is safe to make manual edits below here.
428 #log#-----------------------------------------------------------------------
428 #log#-----------------------------------------------------------------------
429 """
429 """
430 # for pushd/popd management
430 # for pushd/popd management
431 try:
431 try:
432 self.home_dir = get_home_dir()
432 self.home_dir = get_home_dir()
433 except HomeDirError,msg:
433 except HomeDirError,msg:
434 fatal(msg)
434 fatal(msg)
435
435
436 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
436 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
437
437
438 # Functions to call the underlying shell.
438 # Functions to call the underlying shell.
439
439
440 # utility to expand user variables via Itpl
440 # utility to expand user variables via Itpl
441 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
441 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
442 self.user_ns))
442 self.user_ns))
443 # The first is similar to os.system, but it doesn't return a value,
443 # The first is similar to os.system, but it doesn't return a value,
444 # and it allows interpolation of variables in the user's namespace.
444 # and it allows interpolation of variables in the user's namespace.
445 self.system = lambda cmd: shell(self.var_expand(cmd),
445 self.system = lambda cmd: shell(self.var_expand(cmd),
446 header='IPython system call: ',
446 header='IPython system call: ',
447 verbose=self.rc.system_verbose)
447 verbose=self.rc.system_verbose)
448 # These are for getoutput and getoutputerror:
448 # These are for getoutput and getoutputerror:
449 self.getoutput = lambda cmd: \
449 self.getoutput = lambda cmd: \
450 getoutput(self.var_expand(cmd),
450 getoutput(self.var_expand(cmd),
451 header='IPython system call: ',
451 header='IPython system call: ',
452 verbose=self.rc.system_verbose)
452 verbose=self.rc.system_verbose)
453 self.getoutputerror = lambda cmd: \
453 self.getoutputerror = lambda cmd: \
454 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
454 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
455 self.user_ns)),
455 self.user_ns)),
456 header='IPython system call: ',
456 header='IPython system call: ',
457 verbose=self.rc.system_verbose)
457 verbose=self.rc.system_verbose)
458
458
459 # RegExp for splitting line contents into pre-char//first
459 # RegExp for splitting line contents into pre-char//first
460 # word-method//rest. For clarity, each group in on one line.
460 # word-method//rest. For clarity, each group in on one line.
461
461
462 # WARNING: update the regexp if the above escapes are changed, as they
462 # WARNING: update the regexp if the above escapes are changed, as they
463 # are hardwired in.
463 # are hardwired in.
464
464
465 # Don't get carried away with trying to make the autocalling catch too
465 # Don't get carried away with trying to make the autocalling catch too
466 # much: it's better to be conservative rather than to trigger hidden
466 # much: it's better to be conservative rather than to trigger hidden
467 # evals() somewhere and end up causing side effects.
467 # evals() somewhere and end up causing side effects.
468
468
469 self.line_split = re.compile(r'^([\s*,;/])'
469 self.line_split = re.compile(r'^([\s*,;/])'
470 r'([\?\w\.]+\w*\s*)'
470 r'([\?\w\.]+\w*\s*)'
471 r'(\(?.*$)')
471 r'(\(?.*$)')
472
472
473 # Original re, keep around for a while in case changes break something
473 # Original re, keep around for a while in case changes break something
474 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
474 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
475 # r'(\s*[\?\w\.]+\w*\s*)'
475 # r'(\s*[\?\w\.]+\w*\s*)'
476 # r'(\(?.*$)')
476 # r'(\(?.*$)')
477
477
478 # RegExp to identify potential function names
478 # RegExp to identify potential function names
479 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
479 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
480
480
481 # RegExp to exclude strings with this start from autocalling. In
481 # RegExp to exclude strings with this start from autocalling. In
482 # particular, all binary operators should be excluded, so that if foo
482 # particular, all binary operators should be excluded, so that if foo
483 # is callable, foo OP bar doesn't become foo(OP bar), which is
483 # is callable, foo OP bar doesn't become foo(OP bar), which is
484 # invalid. The characters '!=()' don't need to be checked for, as the
484 # invalid. The characters '!=()' don't need to be checked for, as the
485 # _prefilter routine explicitely does so, to catch direct calls and
485 # _prefilter routine explicitely does so, to catch direct calls and
486 # rebindings of existing names.
486 # rebindings of existing names.
487
487
488 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
488 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
489 # it affects the rest of the group in square brackets.
489 # it affects the rest of the group in square brackets.
490 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
490 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
491 '|^is |^not |^in |^and |^or ')
491 '|^is |^not |^in |^and |^or ')
492
492
493 # try to catch also methods for stuff in lists/tuples/dicts: off
493 # try to catch also methods for stuff in lists/tuples/dicts: off
494 # (experimental). For this to work, the line_split regexp would need
494 # (experimental). For this to work, the line_split regexp would need
495 # to be modified so it wouldn't break things at '['. That line is
495 # to be modified so it wouldn't break things at '['. That line is
496 # nasty enough that I shouldn't change it until I can test it _well_.
496 # nasty enough that I shouldn't change it until I can test it _well_.
497 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
497 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
498
498
499 # keep track of where we started running (mainly for crash post-mortem)
499 # keep track of where we started running (mainly for crash post-mortem)
500 self.starting_dir = os.getcwd()
500 self.starting_dir = os.getcwd()
501
501
502 # Various switches which can be set
502 # Various switches which can be set
503 self.CACHELENGTH = 5000 # this is cheap, it's just text
503 self.CACHELENGTH = 5000 # this is cheap, it's just text
504 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
504 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
505 self.banner2 = banner2
505 self.banner2 = banner2
506
506
507 # TraceBack handlers:
507 # TraceBack handlers:
508
508
509 # Syntax error handler.
509 # Syntax error handler.
510 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
510 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
511
511
512 # The interactive one is initialized with an offset, meaning we always
512 # The interactive one is initialized with an offset, meaning we always
513 # want to remove the topmost item in the traceback, which is our own
513 # want to remove the topmost item in the traceback, which is our own
514 # internal code. Valid modes: ['Plain','Context','Verbose']
514 # internal code. Valid modes: ['Plain','Context','Verbose']
515 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
515 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
516 color_scheme='NoColor',
516 color_scheme='NoColor',
517 tb_offset = 1)
517 tb_offset = 1)
518
518
519 # IPython itself shouldn't crash. This will produce a detailed
519 # IPython itself shouldn't crash. This will produce a detailed
520 # post-mortem if it does. But we only install the crash handler for
520 # post-mortem if it does. But we only install the crash handler for
521 # non-threaded shells, the threaded ones use a normal verbose reporter
521 # non-threaded shells, the threaded ones use a normal verbose reporter
522 # and lose the crash handler. This is because exceptions in the main
522 # and lose the crash handler. This is because exceptions in the main
523 # thread (such as in GUI code) propagate directly to sys.excepthook,
523 # thread (such as in GUI code) propagate directly to sys.excepthook,
524 # and there's no point in printing crash dumps for every user exception.
524 # and there's no point in printing crash dumps for every user exception.
525 if self.isthreaded:
525 if self.isthreaded:
526 sys.excepthook = ultraTB.FormattedTB()
526 sys.excepthook = ultraTB.FormattedTB()
527 else:
527 else:
528 from IPython import CrashHandler
528 from IPython import CrashHandler
529 sys.excepthook = CrashHandler.CrashHandler(self)
529 sys.excepthook = CrashHandler.CrashHandler(self)
530
530
531 # The instance will store a pointer to this, so that runtime code
531 # The instance will store a pointer to this, so that runtime code
532 # (such as magics) can access it. This is because during the
532 # (such as magics) can access it. This is because during the
533 # read-eval loop, it gets temporarily overwritten (to deal with GUI
533 # read-eval loop, it gets temporarily overwritten (to deal with GUI
534 # frameworks).
534 # frameworks).
535 self.sys_excepthook = sys.excepthook
535 self.sys_excepthook = sys.excepthook
536
536
537 # and add any custom exception handlers the user may have specified
537 # and add any custom exception handlers the user may have specified
538 self.set_custom_exc(*custom_exceptions)
538 self.set_custom_exc(*custom_exceptions)
539
539
540 # Object inspector
541 self.inspector = OInspect.Inspector(OInspect.InspectColors,
542 PyColorize.ANSICodeColors,
543 'NoColor')
544 # indentation management
540 # indentation management
545 self.autoindent = False
541 self.autoindent = False
546 self.indent_current_nsp = 0
542 self.indent_current_nsp = 0
547
543
548 # Make some aliases automatically
544 # Make some aliases automatically
549 # Prepare list of shell aliases to auto-define
545 # Prepare list of shell aliases to auto-define
550 if os.name == 'posix':
546 if os.name == 'posix':
551 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
547 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
552 'mv mv -i','rm rm -i','cp cp -i',
548 'mv mv -i','rm rm -i','cp cp -i',
553 'cat cat','less less','clear clear',
549 'cat cat','less less','clear clear',
554 # a better ls
550 # a better ls
555 'ls ls -F',
551 'ls ls -F',
556 # long ls
552 # long ls
557 'll ls -lF',
553 'll ls -lF',
558 # color ls
554 # color ls
559 'lc ls -F -o --color',
555 'lc ls -F -o --color',
560 # ls normal files only
556 # ls normal files only
561 'lf ls -F -o --color %l | grep ^-',
557 'lf ls -F -o --color %l | grep ^-',
562 # ls symbolic links
558 # ls symbolic links
563 'lk ls -F -o --color %l | grep ^l',
559 'lk ls -F -o --color %l | grep ^l',
564 # directories or links to directories,
560 # directories or links to directories,
565 'ldir ls -F -o --color %l | grep /$',
561 'ldir ls -F -o --color %l | grep /$',
566 # things which are executable
562 # things which are executable
567 'lx ls -F -o --color %l | grep ^-..x',
563 'lx ls -F -o --color %l | grep ^-..x',
568 )
564 )
569 elif os.name in ['nt','dos']:
565 elif os.name in ['nt','dos']:
570 auto_alias = ('dir dir /on', 'ls dir /on',
566 auto_alias = ('dir dir /on', 'ls dir /on',
571 'ddir dir /ad /on', 'ldir dir /ad /on',
567 'ddir dir /ad /on', 'ldir dir /ad /on',
572 'mkdir mkdir','rmdir rmdir','echo echo',
568 'mkdir mkdir','rmdir rmdir','echo echo',
573 'ren ren','cls cls','copy copy')
569 'ren ren','cls cls','copy copy')
574 else:
570 else:
575 auto_alias = ()
571 auto_alias = ()
576 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
572 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
577 # Call the actual (public) initializer
573 # Call the actual (public) initializer
578 self.init_auto_alias()
574 self.init_auto_alias()
579
575
580 # Produce a public API instance
576 # Produce a public API instance
581 self.api = IPython.ipapi.IPApi(self)
577 self.api = IPython.ipapi.IPApi(self)
582
578
583 # track which builtins we add, so we can clean up later
579 # track which builtins we add, so we can clean up later
584 self.builtins_added = {}
580 self.builtins_added = {}
585 # This method will add the necessary builtins for operation, but
581 # This method will add the necessary builtins for operation, but
586 # tracking what it did via the builtins_added dict.
582 # tracking what it did via the builtins_added dict.
587 self.add_builtins()
583 self.add_builtins()
588
584
589 # end __init__
585 # end __init__
590
586
591 def pre_config_initialization(self):
587 def pre_config_initialization(self):
592 """Pre-configuration init method
588 """Pre-configuration init method
593
589
594 This is called before the configuration files are processed to
590 This is called before the configuration files are processed to
595 prepare the services the config files might need.
591 prepare the services the config files might need.
596
592
597 self.rc already has reasonable default values at this point.
593 self.rc already has reasonable default values at this point.
598 """
594 """
599 rc = self.rc
595 rc = self.rc
600
596
601 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
597 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
602
598
603 def post_config_initialization(self):
599 def post_config_initialization(self):
604 """Post configuration init method
600 """Post configuration init method
605
601
606 This is called after the configuration files have been processed to
602 This is called after the configuration files have been processed to
607 'finalize' the initialization."""
603 'finalize' the initialization."""
608
604
609 rc = self.rc
605 rc = self.rc
606
607 # Object inspector
608 self.inspector = OInspect.Inspector(OInspect.InspectColors,
609 PyColorize.ANSICodeColors,
610 'NoColor',
611 rc.object_info_string_level)
610
612
611 # Load readline proper
613 # Load readline proper
612 if rc.readline:
614 if rc.readline:
613 self.init_readline()
615 self.init_readline()
614
616
615 # local shortcut, this is used a LOT
617 # local shortcut, this is used a LOT
616 self.log = self.logger.log
618 self.log = self.logger.log
617
619
618 # Initialize cache, set in/out prompts and printing system
620 # Initialize cache, set in/out prompts and printing system
619 self.outputcache = CachedOutput(self,
621 self.outputcache = CachedOutput(self,
620 rc.cache_size,
622 rc.cache_size,
621 rc.pprint,
623 rc.pprint,
622 input_sep = rc.separate_in,
624 input_sep = rc.separate_in,
623 output_sep = rc.separate_out,
625 output_sep = rc.separate_out,
624 output_sep2 = rc.separate_out2,
626 output_sep2 = rc.separate_out2,
625 ps1 = rc.prompt_in1,
627 ps1 = rc.prompt_in1,
626 ps2 = rc.prompt_in2,
628 ps2 = rc.prompt_in2,
627 ps_out = rc.prompt_out,
629 ps_out = rc.prompt_out,
628 pad_left = rc.prompts_pad_left)
630 pad_left = rc.prompts_pad_left)
629
631
630 # user may have over-ridden the default print hook:
632 # user may have over-ridden the default print hook:
631 try:
633 try:
632 self.outputcache.__class__.display = self.hooks.display
634 self.outputcache.__class__.display = self.hooks.display
633 except AttributeError:
635 except AttributeError:
634 pass
636 pass
635
637
636 # I don't like assigning globally to sys, because it means when embedding
638 # I don't like assigning globally to sys, because it means when embedding
637 # instances, each embedded instance overrides the previous choice. But
639 # instances, each embedded instance overrides the previous choice. But
638 # sys.displayhook seems to be called internally by exec, so I don't see a
640 # sys.displayhook seems to be called internally by exec, so I don't see a
639 # way around it.
641 # way around it.
640 sys.displayhook = self.outputcache
642 sys.displayhook = self.outputcache
641
643
642 # Set user colors (don't do it in the constructor above so that it
644 # Set user colors (don't do it in the constructor above so that it
643 # doesn't crash if colors option is invalid)
645 # doesn't crash if colors option is invalid)
644 self.magic_colors(rc.colors)
646 self.magic_colors(rc.colors)
645
647
646 # Set calling of pdb on exceptions
648 # Set calling of pdb on exceptions
647 self.call_pdb = rc.pdb
649 self.call_pdb = rc.pdb
648
650
649 # Load user aliases
651 # Load user aliases
650 for alias in rc.alias:
652 for alias in rc.alias:
651 self.magic_alias(alias)
653 self.magic_alias(alias)
652 self.hooks.late_startup_hook()
654 self.hooks.late_startup_hook()
653
655
654 for batchfile in [path(arg) for arg in self.rc.args
656 for batchfile in [path(arg) for arg in self.rc.args
655 if arg.lower().endswith('.ipy')]:
657 if arg.lower().endswith('.ipy')]:
656 if not batchfile.isfile():
658 if not batchfile.isfile():
657 print "No such batch file:", batchfile
659 print "No such batch file:", batchfile
658 continue
660 continue
659 self.api.runlines(batchfile.text())
661 self.api.runlines(batchfile.text())
660
662
661 def add_builtins(self):
663 def add_builtins(self):
662 """Store ipython references into the builtin namespace.
664 """Store ipython references into the builtin namespace.
663
665
664 Some parts of ipython operate via builtins injected here, which hold a
666 Some parts of ipython operate via builtins injected here, which hold a
665 reference to IPython itself."""
667 reference to IPython itself."""
666
668
667 # TODO: deprecate all except _ip; 'jobs' should be installed
669 # TODO: deprecate all except _ip; 'jobs' should be installed
668 # by an extension and the rest are under _ip, ipalias is redundant
670 # by an extension and the rest are under _ip, ipalias is redundant
669 builtins_new = dict(__IPYTHON__ = self,
671 builtins_new = dict(__IPYTHON__ = self,
670 ip_set_hook = self.set_hook,
672 ip_set_hook = self.set_hook,
671 jobs = self.jobs,
673 jobs = self.jobs,
672 ipmagic = self.ipmagic,
674 ipmagic = self.ipmagic,
673 ipalias = self.ipalias,
675 ipalias = self.ipalias,
674 ipsystem = self.ipsystem,
676 ipsystem = self.ipsystem,
675 _ip = self.api
677 _ip = self.api
676 )
678 )
677 for biname,bival in builtins_new.items():
679 for biname,bival in builtins_new.items():
678 try:
680 try:
679 # store the orignal value so we can restore it
681 # store the orignal value so we can restore it
680 self.builtins_added[biname] = __builtin__.__dict__[biname]
682 self.builtins_added[biname] = __builtin__.__dict__[biname]
681 except KeyError:
683 except KeyError:
682 # or mark that it wasn't defined, and we'll just delete it at
684 # or mark that it wasn't defined, and we'll just delete it at
683 # cleanup
685 # cleanup
684 self.builtins_added[biname] = Undefined
686 self.builtins_added[biname] = Undefined
685 __builtin__.__dict__[biname] = bival
687 __builtin__.__dict__[biname] = bival
686
688
687 # Keep in the builtins a flag for when IPython is active. We set it
689 # Keep in the builtins a flag for when IPython is active. We set it
688 # with setdefault so that multiple nested IPythons don't clobber one
690 # with setdefault so that multiple nested IPythons don't clobber one
689 # another. Each will increase its value by one upon being activated,
691 # another. Each will increase its value by one upon being activated,
690 # which also gives us a way to determine the nesting level.
692 # which also gives us a way to determine the nesting level.
691 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
693 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
692
694
693 def clean_builtins(self):
695 def clean_builtins(self):
694 """Remove any builtins which might have been added by add_builtins, or
696 """Remove any builtins which might have been added by add_builtins, or
695 restore overwritten ones to their previous values."""
697 restore overwritten ones to their previous values."""
696 for biname,bival in self.builtins_added.items():
698 for biname,bival in self.builtins_added.items():
697 if bival is Undefined:
699 if bival is Undefined:
698 del __builtin__.__dict__[biname]
700 del __builtin__.__dict__[biname]
699 else:
701 else:
700 __builtin__.__dict__[biname] = bival
702 __builtin__.__dict__[biname] = bival
701 self.builtins_added.clear()
703 self.builtins_added.clear()
702
704
703 def set_hook(self,name,hook, priority = 50):
705 def set_hook(self,name,hook, priority = 50):
704 """set_hook(name,hook) -> sets an internal IPython hook.
706 """set_hook(name,hook) -> sets an internal IPython hook.
705
707
706 IPython exposes some of its internal API as user-modifiable hooks. By
708 IPython exposes some of its internal API as user-modifiable hooks. By
707 adding your function to one of these hooks, you can modify IPython's
709 adding your function to one of these hooks, you can modify IPython's
708 behavior to call at runtime your own routines."""
710 behavior to call at runtime your own routines."""
709
711
710 # At some point in the future, this should validate the hook before it
712 # At some point in the future, this should validate the hook before it
711 # accepts it. Probably at least check that the hook takes the number
713 # accepts it. Probably at least check that the hook takes the number
712 # of args it's supposed to.
714 # of args it's supposed to.
713 dp = getattr(self.hooks, name, None)
715 dp = getattr(self.hooks, name, None)
714 if name not in IPython.hooks.__all__:
716 if name not in IPython.hooks.__all__:
715 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
717 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
716 if not dp:
718 if not dp:
717 dp = IPython.hooks.CommandChainDispatcher()
719 dp = IPython.hooks.CommandChainDispatcher()
718
720
719 f = new.instancemethod(hook,self,self.__class__)
721 f = new.instancemethod(hook,self,self.__class__)
720 try:
722 try:
721 dp.add(f,priority)
723 dp.add(f,priority)
722 except AttributeError:
724 except AttributeError:
723 # it was not commandchain, plain old func - replace
725 # it was not commandchain, plain old func - replace
724 dp = f
726 dp = f
725
727
726 setattr(self.hooks,name, dp)
728 setattr(self.hooks,name, dp)
727
729
728
730
729 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
731 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
730
732
731 def set_custom_exc(self,exc_tuple,handler):
733 def set_custom_exc(self,exc_tuple,handler):
732 """set_custom_exc(exc_tuple,handler)
734 """set_custom_exc(exc_tuple,handler)
733
735
734 Set a custom exception handler, which will be called if any of the
736 Set a custom exception handler, which will be called if any of the
735 exceptions in exc_tuple occur in the mainloop (specifically, in the
737 exceptions in exc_tuple occur in the mainloop (specifically, in the
736 runcode() method.
738 runcode() method.
737
739
738 Inputs:
740 Inputs:
739
741
740 - exc_tuple: a *tuple* of valid exceptions to call the defined
742 - exc_tuple: a *tuple* of valid exceptions to call the defined
741 handler for. It is very important that you use a tuple, and NOT A
743 handler for. It is very important that you use a tuple, and NOT A
742 LIST here, because of the way Python's except statement works. If
744 LIST here, because of the way Python's except statement works. If
743 you only want to trap a single exception, use a singleton tuple:
745 you only want to trap a single exception, use a singleton tuple:
744
746
745 exc_tuple == (MyCustomException,)
747 exc_tuple == (MyCustomException,)
746
748
747 - handler: this must be defined as a function with the following
749 - handler: this must be defined as a function with the following
748 basic interface: def my_handler(self,etype,value,tb).
750 basic interface: def my_handler(self,etype,value,tb).
749
751
750 This will be made into an instance method (via new.instancemethod)
752 This will be made into an instance method (via new.instancemethod)
751 of IPython itself, and it will be called if any of the exceptions
753 of IPython itself, and it will be called if any of the exceptions
752 listed in the exc_tuple are caught. If the handler is None, an
754 listed in the exc_tuple are caught. If the handler is None, an
753 internal basic one is used, which just prints basic info.
755 internal basic one is used, which just prints basic info.
754
756
755 WARNING: by putting in your own exception handler into IPython's main
757 WARNING: by putting in your own exception handler into IPython's main
756 execution loop, you run a very good chance of nasty crashes. This
758 execution loop, you run a very good chance of nasty crashes. This
757 facility should only be used if you really know what you are doing."""
759 facility should only be used if you really know what you are doing."""
758
760
759 assert type(exc_tuple)==type(()) , \
761 assert type(exc_tuple)==type(()) , \
760 "The custom exceptions must be given AS A TUPLE."
762 "The custom exceptions must be given AS A TUPLE."
761
763
762 def dummy_handler(self,etype,value,tb):
764 def dummy_handler(self,etype,value,tb):
763 print '*** Simple custom exception handler ***'
765 print '*** Simple custom exception handler ***'
764 print 'Exception type :',etype
766 print 'Exception type :',etype
765 print 'Exception value:',value
767 print 'Exception value:',value
766 print 'Traceback :',tb
768 print 'Traceback :',tb
767 print 'Source code :','\n'.join(self.buffer)
769 print 'Source code :','\n'.join(self.buffer)
768
770
769 if handler is None: handler = dummy_handler
771 if handler is None: handler = dummy_handler
770
772
771 self.CustomTB = new.instancemethod(handler,self,self.__class__)
773 self.CustomTB = new.instancemethod(handler,self,self.__class__)
772 self.custom_exceptions = exc_tuple
774 self.custom_exceptions = exc_tuple
773
775
774 def set_custom_completer(self,completer,pos=0):
776 def set_custom_completer(self,completer,pos=0):
775 """set_custom_completer(completer,pos=0)
777 """set_custom_completer(completer,pos=0)
776
778
777 Adds a new custom completer function.
779 Adds a new custom completer function.
778
780
779 The position argument (defaults to 0) is the index in the completers
781 The position argument (defaults to 0) is the index in the completers
780 list where you want the completer to be inserted."""
782 list where you want the completer to be inserted."""
781
783
782 newcomp = new.instancemethod(completer,self.Completer,
784 newcomp = new.instancemethod(completer,self.Completer,
783 self.Completer.__class__)
785 self.Completer.__class__)
784 self.Completer.matchers.insert(pos,newcomp)
786 self.Completer.matchers.insert(pos,newcomp)
785
787
786 def _get_call_pdb(self):
788 def _get_call_pdb(self):
787 return self._call_pdb
789 return self._call_pdb
788
790
789 def _set_call_pdb(self,val):
791 def _set_call_pdb(self,val):
790
792
791 if val not in (0,1,False,True):
793 if val not in (0,1,False,True):
792 raise ValueError,'new call_pdb value must be boolean'
794 raise ValueError,'new call_pdb value must be boolean'
793
795
794 # store value in instance
796 # store value in instance
795 self._call_pdb = val
797 self._call_pdb = val
796
798
797 # notify the actual exception handlers
799 # notify the actual exception handlers
798 self.InteractiveTB.call_pdb = val
800 self.InteractiveTB.call_pdb = val
799 if self.isthreaded:
801 if self.isthreaded:
800 try:
802 try:
801 self.sys_excepthook.call_pdb = val
803 self.sys_excepthook.call_pdb = val
802 except:
804 except:
803 warn('Failed to activate pdb for threaded exception handler')
805 warn('Failed to activate pdb for threaded exception handler')
804
806
805 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
807 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
806 'Control auto-activation of pdb at exceptions')
808 'Control auto-activation of pdb at exceptions')
807
809
808
810
809 # These special functions get installed in the builtin namespace, to
811 # These special functions get installed in the builtin namespace, to
810 # provide programmatic (pure python) access to magics, aliases and system
812 # provide programmatic (pure python) access to magics, aliases and system
811 # calls. This is important for logging, user scripting, and more.
813 # calls. This is important for logging, user scripting, and more.
812
814
813 # We are basically exposing, via normal python functions, the three
815 # We are basically exposing, via normal python functions, the three
814 # mechanisms in which ipython offers special call modes (magics for
816 # mechanisms in which ipython offers special call modes (magics for
815 # internal control, aliases for direct system access via pre-selected
817 # internal control, aliases for direct system access via pre-selected
816 # names, and !cmd for calling arbitrary system commands).
818 # names, and !cmd for calling arbitrary system commands).
817
819
818 def ipmagic(self,arg_s):
820 def ipmagic(self,arg_s):
819 """Call a magic function by name.
821 """Call a magic function by name.
820
822
821 Input: a string containing the name of the magic function to call and any
823 Input: a string containing the name of the magic function to call and any
822 additional arguments to be passed to the magic.
824 additional arguments to be passed to the magic.
823
825
824 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
826 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
825 prompt:
827 prompt:
826
828
827 In[1]: %name -opt foo bar
829 In[1]: %name -opt foo bar
828
830
829 To call a magic without arguments, simply use ipmagic('name').
831 To call a magic without arguments, simply use ipmagic('name').
830
832
831 This provides a proper Python function to call IPython's magics in any
833 This provides a proper Python function to call IPython's magics in any
832 valid Python code you can type at the interpreter, including loops and
834 valid Python code you can type at the interpreter, including loops and
833 compound statements. It is added by IPython to the Python builtin
835 compound statements. It is added by IPython to the Python builtin
834 namespace upon initialization."""
836 namespace upon initialization."""
835
837
836 args = arg_s.split(' ',1)
838 args = arg_s.split(' ',1)
837 magic_name = args[0]
839 magic_name = args[0]
838 magic_name = magic_name.lstrip(self.ESC_MAGIC)
840 magic_name = magic_name.lstrip(self.ESC_MAGIC)
839
841
840 try:
842 try:
841 magic_args = args[1]
843 magic_args = args[1]
842 except IndexError:
844 except IndexError:
843 magic_args = ''
845 magic_args = ''
844 fn = getattr(self,'magic_'+magic_name,None)
846 fn = getattr(self,'magic_'+magic_name,None)
845 if fn is None:
847 if fn is None:
846 error("Magic function `%s` not found." % magic_name)
848 error("Magic function `%s` not found." % magic_name)
847 else:
849 else:
848 magic_args = self.var_expand(magic_args)
850 magic_args = self.var_expand(magic_args)
849 return fn(magic_args)
851 return fn(magic_args)
850
852
851 def ipalias(self,arg_s):
853 def ipalias(self,arg_s):
852 """Call an alias by name.
854 """Call an alias by name.
853
855
854 Input: a string containing the name of the alias to call and any
856 Input: a string containing the name of the alias to call and any
855 additional arguments to be passed to the magic.
857 additional arguments to be passed to the magic.
856
858
857 ipalias('name -opt foo bar') is equivalent to typing at the ipython
859 ipalias('name -opt foo bar') is equivalent to typing at the ipython
858 prompt:
860 prompt:
859
861
860 In[1]: name -opt foo bar
862 In[1]: name -opt foo bar
861
863
862 To call an alias without arguments, simply use ipalias('name').
864 To call an alias without arguments, simply use ipalias('name').
863
865
864 This provides a proper Python function to call IPython's aliases in any
866 This provides a proper Python function to call IPython's aliases in any
865 valid Python code you can type at the interpreter, including loops and
867 valid Python code you can type at the interpreter, including loops and
866 compound statements. It is added by IPython to the Python builtin
868 compound statements. It is added by IPython to the Python builtin
867 namespace upon initialization."""
869 namespace upon initialization."""
868
870
869 args = arg_s.split(' ',1)
871 args = arg_s.split(' ',1)
870 alias_name = args[0]
872 alias_name = args[0]
871 try:
873 try:
872 alias_args = args[1]
874 alias_args = args[1]
873 except IndexError:
875 except IndexError:
874 alias_args = ''
876 alias_args = ''
875 if alias_name in self.alias_table:
877 if alias_name in self.alias_table:
876 self.call_alias(alias_name,alias_args)
878 self.call_alias(alias_name,alias_args)
877 else:
879 else:
878 error("Alias `%s` not found." % alias_name)
880 error("Alias `%s` not found." % alias_name)
879
881
880 def ipsystem(self,arg_s):
882 def ipsystem(self,arg_s):
881 """Make a system call, using IPython."""
883 """Make a system call, using IPython."""
882
884
883 self.system(arg_s)
885 self.system(arg_s)
884
886
885 def complete(self,text):
887 def complete(self,text):
886 """Return a sorted list of all possible completions on text.
888 """Return a sorted list of all possible completions on text.
887
889
888 Inputs:
890 Inputs:
889
891
890 - text: a string of text to be completed on.
892 - text: a string of text to be completed on.
891
893
892 This is a wrapper around the completion mechanism, similar to what
894 This is a wrapper around the completion mechanism, similar to what
893 readline does at the command line when the TAB key is hit. By
895 readline does at the command line when the TAB key is hit. By
894 exposing it as a method, it can be used by other non-readline
896 exposing it as a method, it can be used by other non-readline
895 environments (such as GUIs) for text completion.
897 environments (such as GUIs) for text completion.
896
898
897 Simple usage example:
899 Simple usage example:
898
900
899 In [1]: x = 'hello'
901 In [1]: x = 'hello'
900
902
901 In [2]: __IP.complete('x.l')
903 In [2]: __IP.complete('x.l')
902 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
904 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
903
905
904 complete = self.Completer.complete
906 complete = self.Completer.complete
905 state = 0
907 state = 0
906 # use a dict so we get unique keys, since ipyhton's multiple
908 # use a dict so we get unique keys, since ipyhton's multiple
907 # completers can return duplicates.
909 # completers can return duplicates.
908 comps = {}
910 comps = {}
909 while True:
911 while True:
910 newcomp = complete(text,state)
912 newcomp = complete(text,state)
911 if newcomp is None:
913 if newcomp is None:
912 break
914 break
913 comps[newcomp] = 1
915 comps[newcomp] = 1
914 state += 1
916 state += 1
915 outcomps = comps.keys()
917 outcomps = comps.keys()
916 outcomps.sort()
918 outcomps.sort()
917 return outcomps
919 return outcomps
918
920
919 def set_completer_frame(self, frame=None):
921 def set_completer_frame(self, frame=None):
920 if frame:
922 if frame:
921 self.Completer.namespace = frame.f_locals
923 self.Completer.namespace = frame.f_locals
922 self.Completer.global_namespace = frame.f_globals
924 self.Completer.global_namespace = frame.f_globals
923 else:
925 else:
924 self.Completer.namespace = self.user_ns
926 self.Completer.namespace = self.user_ns
925 self.Completer.global_namespace = self.user_global_ns
927 self.Completer.global_namespace = self.user_global_ns
926
928
927 def init_auto_alias(self):
929 def init_auto_alias(self):
928 """Define some aliases automatically.
930 """Define some aliases automatically.
929
931
930 These are ALL parameter-less aliases"""
932 These are ALL parameter-less aliases"""
931
933
932 for alias,cmd in self.auto_alias:
934 for alias,cmd in self.auto_alias:
933 self.alias_table[alias] = (0,cmd)
935 self.alias_table[alias] = (0,cmd)
934
936
935 def alias_table_validate(self,verbose=0):
937 def alias_table_validate(self,verbose=0):
936 """Update information about the alias table.
938 """Update information about the alias table.
937
939
938 In particular, make sure no Python keywords/builtins are in it."""
940 In particular, make sure no Python keywords/builtins are in it."""
939
941
940 no_alias = self.no_alias
942 no_alias = self.no_alias
941 for k in self.alias_table.keys():
943 for k in self.alias_table.keys():
942 if k in no_alias:
944 if k in no_alias:
943 del self.alias_table[k]
945 del self.alias_table[k]
944 if verbose:
946 if verbose:
945 print ("Deleting alias <%s>, it's a Python "
947 print ("Deleting alias <%s>, it's a Python "
946 "keyword or builtin." % k)
948 "keyword or builtin." % k)
947
949
948 def set_autoindent(self,value=None):
950 def set_autoindent(self,value=None):
949 """Set the autoindent flag, checking for readline support.
951 """Set the autoindent flag, checking for readline support.
950
952
951 If called with no arguments, it acts as a toggle."""
953 If called with no arguments, it acts as a toggle."""
952
954
953 if not self.has_readline:
955 if not self.has_readline:
954 if os.name == 'posix':
956 if os.name == 'posix':
955 warn("The auto-indent feature requires the readline library")
957 warn("The auto-indent feature requires the readline library")
956 self.autoindent = 0
958 self.autoindent = 0
957 return
959 return
958 if value is None:
960 if value is None:
959 self.autoindent = not self.autoindent
961 self.autoindent = not self.autoindent
960 else:
962 else:
961 self.autoindent = value
963 self.autoindent = value
962
964
963 def rc_set_toggle(self,rc_field,value=None):
965 def rc_set_toggle(self,rc_field,value=None):
964 """Set or toggle a field in IPython's rc config. structure.
966 """Set or toggle a field in IPython's rc config. structure.
965
967
966 If called with no arguments, it acts as a toggle.
968 If called with no arguments, it acts as a toggle.
967
969
968 If called with a non-existent field, the resulting AttributeError
970 If called with a non-existent field, the resulting AttributeError
969 exception will propagate out."""
971 exception will propagate out."""
970
972
971 rc_val = getattr(self.rc,rc_field)
973 rc_val = getattr(self.rc,rc_field)
972 if value is None:
974 if value is None:
973 value = not rc_val
975 value = not rc_val
974 setattr(self.rc,rc_field,value)
976 setattr(self.rc,rc_field,value)
975
977
976 def user_setup(self,ipythondir,rc_suffix,mode='install'):
978 def user_setup(self,ipythondir,rc_suffix,mode='install'):
977 """Install the user configuration directory.
979 """Install the user configuration directory.
978
980
979 Can be called when running for the first time or to upgrade the user's
981 Can be called when running for the first time or to upgrade the user's
980 .ipython/ directory with the mode parameter. Valid modes are 'install'
982 .ipython/ directory with the mode parameter. Valid modes are 'install'
981 and 'upgrade'."""
983 and 'upgrade'."""
982
984
983 def wait():
985 def wait():
984 try:
986 try:
985 raw_input("Please press <RETURN> to start IPython.")
987 raw_input("Please press <RETURN> to start IPython.")
986 except EOFError:
988 except EOFError:
987 print >> Term.cout
989 print >> Term.cout
988 print '*'*70
990 print '*'*70
989
991
990 cwd = os.getcwd() # remember where we started
992 cwd = os.getcwd() # remember where we started
991 glb = glob.glob
993 glb = glob.glob
992 print '*'*70
994 print '*'*70
993 if mode == 'install':
995 if mode == 'install':
994 print \
996 print \
995 """Welcome to IPython. I will try to create a personal configuration directory
997 """Welcome to IPython. I will try to create a personal configuration directory
996 where you can customize many aspects of IPython's functionality in:\n"""
998 where you can customize many aspects of IPython's functionality in:\n"""
997 else:
999 else:
998 print 'I am going to upgrade your configuration in:'
1000 print 'I am going to upgrade your configuration in:'
999
1001
1000 print ipythondir
1002 print ipythondir
1001
1003
1002 rcdirend = os.path.join('IPython','UserConfig')
1004 rcdirend = os.path.join('IPython','UserConfig')
1003 cfg = lambda d: os.path.join(d,rcdirend)
1005 cfg = lambda d: os.path.join(d,rcdirend)
1004 try:
1006 try:
1005 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1007 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1006 except IOError:
1008 except IOError:
1007 warning = """
1009 warning = """
1008 Installation error. IPython's directory was not found.
1010 Installation error. IPython's directory was not found.
1009
1011
1010 Check the following:
1012 Check the following:
1011
1013
1012 The ipython/IPython directory should be in a directory belonging to your
1014 The ipython/IPython directory should be in a directory belonging to your
1013 PYTHONPATH environment variable (that is, it should be in a directory
1015 PYTHONPATH environment variable (that is, it should be in a directory
1014 belonging to sys.path). You can copy it explicitly there or just link to it.
1016 belonging to sys.path). You can copy it explicitly there or just link to it.
1015
1017
1016 IPython will proceed with builtin defaults.
1018 IPython will proceed with builtin defaults.
1017 """
1019 """
1018 warn(warning)
1020 warn(warning)
1019 wait()
1021 wait()
1020 return
1022 return
1021
1023
1022 if mode == 'install':
1024 if mode == 'install':
1023 try:
1025 try:
1024 shutil.copytree(rcdir,ipythondir)
1026 shutil.copytree(rcdir,ipythondir)
1025 os.chdir(ipythondir)
1027 os.chdir(ipythondir)
1026 rc_files = glb("ipythonrc*")
1028 rc_files = glb("ipythonrc*")
1027 for rc_file in rc_files:
1029 for rc_file in rc_files:
1028 os.rename(rc_file,rc_file+rc_suffix)
1030 os.rename(rc_file,rc_file+rc_suffix)
1029 except:
1031 except:
1030 warning = """
1032 warning = """
1031
1033
1032 There was a problem with the installation:
1034 There was a problem with the installation:
1033 %s
1035 %s
1034 Try to correct it or contact the developers if you think it's a bug.
1036 Try to correct it or contact the developers if you think it's a bug.
1035 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1037 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1036 warn(warning)
1038 warn(warning)
1037 wait()
1039 wait()
1038 return
1040 return
1039
1041
1040 elif mode == 'upgrade':
1042 elif mode == 'upgrade':
1041 try:
1043 try:
1042 os.chdir(ipythondir)
1044 os.chdir(ipythondir)
1043 except:
1045 except:
1044 print """
1046 print """
1045 Can not upgrade: changing to directory %s failed. Details:
1047 Can not upgrade: changing to directory %s failed. Details:
1046 %s
1048 %s
1047 """ % (ipythondir,sys.exc_info()[1])
1049 """ % (ipythondir,sys.exc_info()[1])
1048 wait()
1050 wait()
1049 return
1051 return
1050 else:
1052 else:
1051 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1053 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1052 for new_full_path in sources:
1054 for new_full_path in sources:
1053 new_filename = os.path.basename(new_full_path)
1055 new_filename = os.path.basename(new_full_path)
1054 if new_filename.startswith('ipythonrc'):
1056 if new_filename.startswith('ipythonrc'):
1055 new_filename = new_filename + rc_suffix
1057 new_filename = new_filename + rc_suffix
1056 # The config directory should only contain files, skip any
1058 # The config directory should only contain files, skip any
1057 # directories which may be there (like CVS)
1059 # directories which may be there (like CVS)
1058 if os.path.isdir(new_full_path):
1060 if os.path.isdir(new_full_path):
1059 continue
1061 continue
1060 if os.path.exists(new_filename):
1062 if os.path.exists(new_filename):
1061 old_file = new_filename+'.old'
1063 old_file = new_filename+'.old'
1062 if os.path.exists(old_file):
1064 if os.path.exists(old_file):
1063 os.remove(old_file)
1065 os.remove(old_file)
1064 os.rename(new_filename,old_file)
1066 os.rename(new_filename,old_file)
1065 shutil.copy(new_full_path,new_filename)
1067 shutil.copy(new_full_path,new_filename)
1066 else:
1068 else:
1067 raise ValueError,'unrecognized mode for install:',`mode`
1069 raise ValueError,'unrecognized mode for install:',`mode`
1068
1070
1069 # Fix line-endings to those native to each platform in the config
1071 # Fix line-endings to those native to each platform in the config
1070 # directory.
1072 # directory.
1071 try:
1073 try:
1072 os.chdir(ipythondir)
1074 os.chdir(ipythondir)
1073 except:
1075 except:
1074 print """
1076 print """
1075 Problem: changing to directory %s failed.
1077 Problem: changing to directory %s failed.
1076 Details:
1078 Details:
1077 %s
1079 %s
1078
1080
1079 Some configuration files may have incorrect line endings. This should not
1081 Some configuration files may have incorrect line endings. This should not
1080 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1082 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1081 wait()
1083 wait()
1082 else:
1084 else:
1083 for fname in glb('ipythonrc*'):
1085 for fname in glb('ipythonrc*'):
1084 try:
1086 try:
1085 native_line_ends(fname,backup=0)
1087 native_line_ends(fname,backup=0)
1086 except IOError:
1088 except IOError:
1087 pass
1089 pass
1088
1090
1089 if mode == 'install':
1091 if mode == 'install':
1090 print """
1092 print """
1091 Successful installation!
1093 Successful installation!
1092
1094
1093 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1095 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1094 IPython manual (there are both HTML and PDF versions supplied with the
1096 IPython manual (there are both HTML and PDF versions supplied with the
1095 distribution) to make sure that your system environment is properly configured
1097 distribution) to make sure that your system environment is properly configured
1096 to take advantage of IPython's features.
1098 to take advantage of IPython's features.
1097
1099
1098 Important note: the configuration system has changed! The old system is
1100 Important note: the configuration system has changed! The old system is
1099 still in place, but its setting may be partly overridden by the settings in
1101 still in place, but its setting may be partly overridden by the settings in
1100 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1102 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1101 if some of the new settings bother you.
1103 if some of the new settings bother you.
1102
1104
1103 """
1105 """
1104 else:
1106 else:
1105 print """
1107 print """
1106 Successful upgrade!
1108 Successful upgrade!
1107
1109
1108 All files in your directory:
1110 All files in your directory:
1109 %(ipythondir)s
1111 %(ipythondir)s
1110 which would have been overwritten by the upgrade were backed up with a .old
1112 which would have been overwritten by the upgrade were backed up with a .old
1111 extension. If you had made particular customizations in those files you may
1113 extension. If you had made particular customizations in those files you may
1112 want to merge them back into the new files.""" % locals()
1114 want to merge them back into the new files.""" % locals()
1113 wait()
1115 wait()
1114 os.chdir(cwd)
1116 os.chdir(cwd)
1115 # end user_setup()
1117 # end user_setup()
1116
1118
1117 def atexit_operations(self):
1119 def atexit_operations(self):
1118 """This will be executed at the time of exit.
1120 """This will be executed at the time of exit.
1119
1121
1120 Saving of persistent data should be performed here. """
1122 Saving of persistent data should be performed here. """
1121
1123
1122 #print '*** IPython exit cleanup ***' # dbg
1124 #print '*** IPython exit cleanup ***' # dbg
1123 # input history
1125 # input history
1124 self.savehist()
1126 self.savehist()
1125
1127
1126 # Cleanup all tempfiles left around
1128 # Cleanup all tempfiles left around
1127 for tfile in self.tempfiles:
1129 for tfile in self.tempfiles:
1128 try:
1130 try:
1129 os.unlink(tfile)
1131 os.unlink(tfile)
1130 except OSError:
1132 except OSError:
1131 pass
1133 pass
1132
1134
1133 # save the "persistent data" catch-all dictionary
1135 # save the "persistent data" catch-all dictionary
1134 self.hooks.shutdown_hook()
1136 self.hooks.shutdown_hook()
1135
1137
1136 def savehist(self):
1138 def savehist(self):
1137 """Save input history to a file (via readline library)."""
1139 """Save input history to a file (via readline library)."""
1138 try:
1140 try:
1139 self.readline.write_history_file(self.histfile)
1141 self.readline.write_history_file(self.histfile)
1140 except:
1142 except:
1141 print 'Unable to save IPython command history to file: ' + \
1143 print 'Unable to save IPython command history to file: ' + \
1142 `self.histfile`
1144 `self.histfile`
1143
1145
1144 def pre_readline(self):
1146 def pre_readline(self):
1145 """readline hook to be used at the start of each line.
1147 """readline hook to be used at the start of each line.
1146
1148
1147 Currently it handles auto-indent only."""
1149 Currently it handles auto-indent only."""
1148
1150
1149 #debugx('self.indent_current_nsp','pre_readline:')
1151 #debugx('self.indent_current_nsp','pre_readline:')
1150 self.readline.insert_text(self.indent_current_str())
1152 self.readline.insert_text(self.indent_current_str())
1151
1153
1152 def init_readline(self):
1154 def init_readline(self):
1153 """Command history completion/saving/reloading."""
1155 """Command history completion/saving/reloading."""
1154
1156
1155 import IPython.rlineimpl as readline
1157 import IPython.rlineimpl as readline
1156 if not readline.have_readline:
1158 if not readline.have_readline:
1157 self.has_readline = 0
1159 self.has_readline = 0
1158 self.readline = None
1160 self.readline = None
1159 # no point in bugging windows users with this every time:
1161 # no point in bugging windows users with this every time:
1160 warn('Readline services not available on this platform.')
1162 warn('Readline services not available on this platform.')
1161 else:
1163 else:
1162 sys.modules['readline'] = readline
1164 sys.modules['readline'] = readline
1163 import atexit
1165 import atexit
1164 from IPython.completer import IPCompleter
1166 from IPython.completer import IPCompleter
1165 self.Completer = IPCompleter(self,
1167 self.Completer = IPCompleter(self,
1166 self.user_ns,
1168 self.user_ns,
1167 self.user_global_ns,
1169 self.user_global_ns,
1168 self.rc.readline_omit__names,
1170 self.rc.readline_omit__names,
1169 self.alias_table)
1171 self.alias_table)
1170
1172
1171 # Platform-specific configuration
1173 # Platform-specific configuration
1172 if os.name == 'nt':
1174 if os.name == 'nt':
1173 self.readline_startup_hook = readline.set_pre_input_hook
1175 self.readline_startup_hook = readline.set_pre_input_hook
1174 else:
1176 else:
1175 self.readline_startup_hook = readline.set_startup_hook
1177 self.readline_startup_hook = readline.set_startup_hook
1176
1178
1177 # Load user's initrc file (readline config)
1179 # Load user's initrc file (readline config)
1178 inputrc_name = os.environ.get('INPUTRC')
1180 inputrc_name = os.environ.get('INPUTRC')
1179 if inputrc_name is None:
1181 if inputrc_name is None:
1180 home_dir = get_home_dir()
1182 home_dir = get_home_dir()
1181 if home_dir is not None:
1183 if home_dir is not None:
1182 inputrc_name = os.path.join(home_dir,'.inputrc')
1184 inputrc_name = os.path.join(home_dir,'.inputrc')
1183 if os.path.isfile(inputrc_name):
1185 if os.path.isfile(inputrc_name):
1184 try:
1186 try:
1185 readline.read_init_file(inputrc_name)
1187 readline.read_init_file(inputrc_name)
1186 except:
1188 except:
1187 warn('Problems reading readline initialization file <%s>'
1189 warn('Problems reading readline initialization file <%s>'
1188 % inputrc_name)
1190 % inputrc_name)
1189
1191
1190 self.has_readline = 1
1192 self.has_readline = 1
1191 self.readline = readline
1193 self.readline = readline
1192 # save this in sys so embedded copies can restore it properly
1194 # save this in sys so embedded copies can restore it properly
1193 sys.ipcompleter = self.Completer.complete
1195 sys.ipcompleter = self.Completer.complete
1194 readline.set_completer(self.Completer.complete)
1196 readline.set_completer(self.Completer.complete)
1195
1197
1196 # Configure readline according to user's prefs
1198 # Configure readline according to user's prefs
1197 for rlcommand in self.rc.readline_parse_and_bind:
1199 for rlcommand in self.rc.readline_parse_and_bind:
1198 readline.parse_and_bind(rlcommand)
1200 readline.parse_and_bind(rlcommand)
1199
1201
1200 # remove some chars from the delimiters list
1202 # remove some chars from the delimiters list
1201 delims = readline.get_completer_delims()
1203 delims = readline.get_completer_delims()
1202 delims = delims.translate(string._idmap,
1204 delims = delims.translate(string._idmap,
1203 self.rc.readline_remove_delims)
1205 self.rc.readline_remove_delims)
1204 readline.set_completer_delims(delims)
1206 readline.set_completer_delims(delims)
1205 # otherwise we end up with a monster history after a while:
1207 # otherwise we end up with a monster history after a while:
1206 readline.set_history_length(1000)
1208 readline.set_history_length(1000)
1207 try:
1209 try:
1208 #print '*** Reading readline history' # dbg
1210 #print '*** Reading readline history' # dbg
1209 readline.read_history_file(self.histfile)
1211 readline.read_history_file(self.histfile)
1210 except IOError:
1212 except IOError:
1211 pass # It doesn't exist yet.
1213 pass # It doesn't exist yet.
1212
1214
1213 atexit.register(self.atexit_operations)
1215 atexit.register(self.atexit_operations)
1214 del atexit
1216 del atexit
1215
1217
1216 # Configure auto-indent for all platforms
1218 # Configure auto-indent for all platforms
1217 self.set_autoindent(self.rc.autoindent)
1219 self.set_autoindent(self.rc.autoindent)
1218
1220
1219 def _should_recompile(self,e):
1221 def _should_recompile(self,e):
1220 """Utility routine for edit_syntax_error"""
1222 """Utility routine for edit_syntax_error"""
1221
1223
1222 if e.filename in ('<ipython console>','<input>','<string>',
1224 if e.filename in ('<ipython console>','<input>','<string>',
1223 '<console>','<BackgroundJob compilation>',
1225 '<console>','<BackgroundJob compilation>',
1224 None):
1226 None):
1225
1227
1226 return False
1228 return False
1227 try:
1229 try:
1228 if (self.rc.autoedit_syntax and
1230 if (self.rc.autoedit_syntax and
1229 not ask_yes_no('Return to editor to correct syntax error? '
1231 not ask_yes_no('Return to editor to correct syntax error? '
1230 '[Y/n] ','y')):
1232 '[Y/n] ','y')):
1231 return False
1233 return False
1232 except EOFError:
1234 except EOFError:
1233 return False
1235 return False
1234
1236
1235 def int0(x):
1237 def int0(x):
1236 try:
1238 try:
1237 return int(x)
1239 return int(x)
1238 except TypeError:
1240 except TypeError:
1239 return 0
1241 return 0
1240 # always pass integer line and offset values to editor hook
1242 # always pass integer line and offset values to editor hook
1241 self.hooks.fix_error_editor(e.filename,
1243 self.hooks.fix_error_editor(e.filename,
1242 int0(e.lineno),int0(e.offset),e.msg)
1244 int0(e.lineno),int0(e.offset),e.msg)
1243 return True
1245 return True
1244
1246
1245 def edit_syntax_error(self):
1247 def edit_syntax_error(self):
1246 """The bottom half of the syntax error handler called in the main loop.
1248 """The bottom half of the syntax error handler called in the main loop.
1247
1249
1248 Loop until syntax error is fixed or user cancels.
1250 Loop until syntax error is fixed or user cancels.
1249 """
1251 """
1250
1252
1251 while self.SyntaxTB.last_syntax_error:
1253 while self.SyntaxTB.last_syntax_error:
1252 # copy and clear last_syntax_error
1254 # copy and clear last_syntax_error
1253 err = self.SyntaxTB.clear_err_state()
1255 err = self.SyntaxTB.clear_err_state()
1254 if not self._should_recompile(err):
1256 if not self._should_recompile(err):
1255 return
1257 return
1256 try:
1258 try:
1257 # may set last_syntax_error again if a SyntaxError is raised
1259 # may set last_syntax_error again if a SyntaxError is raised
1258 self.safe_execfile(err.filename,self.shell.user_ns)
1260 self.safe_execfile(err.filename,self.shell.user_ns)
1259 except:
1261 except:
1260 self.showtraceback()
1262 self.showtraceback()
1261 else:
1263 else:
1262 try:
1264 try:
1263 f = file(err.filename)
1265 f = file(err.filename)
1264 try:
1266 try:
1265 sys.displayhook(f.read())
1267 sys.displayhook(f.read())
1266 finally:
1268 finally:
1267 f.close()
1269 f.close()
1268 except:
1270 except:
1269 self.showtraceback()
1271 self.showtraceback()
1270
1272
1271 def showsyntaxerror(self, filename=None):
1273 def showsyntaxerror(self, filename=None):
1272 """Display the syntax error that just occurred.
1274 """Display the syntax error that just occurred.
1273
1275
1274 This doesn't display a stack trace because there isn't one.
1276 This doesn't display a stack trace because there isn't one.
1275
1277
1276 If a filename is given, it is stuffed in the exception instead
1278 If a filename is given, it is stuffed in the exception instead
1277 of what was there before (because Python's parser always uses
1279 of what was there before (because Python's parser always uses
1278 "<string>" when reading from a string).
1280 "<string>" when reading from a string).
1279 """
1281 """
1280 etype, value, last_traceback = sys.exc_info()
1282 etype, value, last_traceback = sys.exc_info()
1281
1283
1282 # See note about these variables in showtraceback() below
1284 # See note about these variables in showtraceback() below
1283 sys.last_type = etype
1285 sys.last_type = etype
1284 sys.last_value = value
1286 sys.last_value = value
1285 sys.last_traceback = last_traceback
1287 sys.last_traceback = last_traceback
1286
1288
1287 if filename and etype is SyntaxError:
1289 if filename and etype is SyntaxError:
1288 # Work hard to stuff the correct filename in the exception
1290 # Work hard to stuff the correct filename in the exception
1289 try:
1291 try:
1290 msg, (dummy_filename, lineno, offset, line) = value
1292 msg, (dummy_filename, lineno, offset, line) = value
1291 except:
1293 except:
1292 # Not the format we expect; leave it alone
1294 # Not the format we expect; leave it alone
1293 pass
1295 pass
1294 else:
1296 else:
1295 # Stuff in the right filename
1297 # Stuff in the right filename
1296 try:
1298 try:
1297 # Assume SyntaxError is a class exception
1299 # Assume SyntaxError is a class exception
1298 value = SyntaxError(msg, (filename, lineno, offset, line))
1300 value = SyntaxError(msg, (filename, lineno, offset, line))
1299 except:
1301 except:
1300 # If that failed, assume SyntaxError is a string
1302 # If that failed, assume SyntaxError is a string
1301 value = msg, (filename, lineno, offset, line)
1303 value = msg, (filename, lineno, offset, line)
1302 self.SyntaxTB(etype,value,[])
1304 self.SyntaxTB(etype,value,[])
1303
1305
1304 def debugger(self):
1306 def debugger(self):
1305 """Call the pdb debugger."""
1307 """Call the pdb debugger."""
1306
1308
1307 if not self.rc.pdb:
1309 if not self.rc.pdb:
1308 return
1310 return
1309 pdb.pm()
1311 pdb.pm()
1310
1312
1311 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1313 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1312 """Display the exception that just occurred.
1314 """Display the exception that just occurred.
1313
1315
1314 If nothing is known about the exception, this is the method which
1316 If nothing is known about the exception, this is the method which
1315 should be used throughout the code for presenting user tracebacks,
1317 should be used throughout the code for presenting user tracebacks,
1316 rather than directly invoking the InteractiveTB object.
1318 rather than directly invoking the InteractiveTB object.
1317
1319
1318 A specific showsyntaxerror() also exists, but this method can take
1320 A specific showsyntaxerror() also exists, but this method can take
1319 care of calling it if needed, so unless you are explicitly catching a
1321 care of calling it if needed, so unless you are explicitly catching a
1320 SyntaxError exception, don't try to analyze the stack manually and
1322 SyntaxError exception, don't try to analyze the stack manually and
1321 simply call this method."""
1323 simply call this method."""
1322
1324
1323 # Though this won't be called by syntax errors in the input line,
1325 # Though this won't be called by syntax errors in the input line,
1324 # there may be SyntaxError cases whith imported code.
1326 # there may be SyntaxError cases whith imported code.
1325 if exc_tuple is None:
1327 if exc_tuple is None:
1326 etype, value, tb = sys.exc_info()
1328 etype, value, tb = sys.exc_info()
1327 else:
1329 else:
1328 etype, value, tb = exc_tuple
1330 etype, value, tb = exc_tuple
1329 if etype is SyntaxError:
1331 if etype is SyntaxError:
1330 self.showsyntaxerror(filename)
1332 self.showsyntaxerror(filename)
1331 else:
1333 else:
1332 # WARNING: these variables are somewhat deprecated and not
1334 # WARNING: these variables are somewhat deprecated and not
1333 # necessarily safe to use in a threaded environment, but tools
1335 # necessarily safe to use in a threaded environment, but tools
1334 # like pdb depend on their existence, so let's set them. If we
1336 # like pdb depend on their existence, so let's set them. If we
1335 # find problems in the field, we'll need to revisit their use.
1337 # find problems in the field, we'll need to revisit their use.
1336 sys.last_type = etype
1338 sys.last_type = etype
1337 sys.last_value = value
1339 sys.last_value = value
1338 sys.last_traceback = tb
1340 sys.last_traceback = tb
1339
1341
1340 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1342 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1341 if self.InteractiveTB.call_pdb and self.has_readline:
1343 if self.InteractiveTB.call_pdb and self.has_readline:
1342 # pdb mucks up readline, fix it back
1344 # pdb mucks up readline, fix it back
1343 self.readline.set_completer(self.Completer.complete)
1345 self.readline.set_completer(self.Completer.complete)
1344
1346
1345 def mainloop(self,banner=None):
1347 def mainloop(self,banner=None):
1346 """Creates the local namespace and starts the mainloop.
1348 """Creates the local namespace and starts the mainloop.
1347
1349
1348 If an optional banner argument is given, it will override the
1350 If an optional banner argument is given, it will override the
1349 internally created default banner."""
1351 internally created default banner."""
1350
1352
1351 if self.rc.c: # Emulate Python's -c option
1353 if self.rc.c: # Emulate Python's -c option
1352 self.exec_init_cmd()
1354 self.exec_init_cmd()
1353 if banner is None:
1355 if banner is None:
1354 if not self.rc.banner:
1356 if not self.rc.banner:
1355 banner = ''
1357 banner = ''
1356 # banner is string? Use it directly!
1358 # banner is string? Use it directly!
1357 elif isinstance(self.rc.banner,basestring):
1359 elif isinstance(self.rc.banner,basestring):
1358 banner = self.rc.banner
1360 banner = self.rc.banner
1359 else:
1361 else:
1360 banner = self.BANNER+self.banner2
1362 banner = self.BANNER+self.banner2
1361
1363
1362 self.interact(banner)
1364 self.interact(banner)
1363
1365
1364 def exec_init_cmd(self):
1366 def exec_init_cmd(self):
1365 """Execute a command given at the command line.
1367 """Execute a command given at the command line.
1366
1368
1367 This emulates Python's -c option."""
1369 This emulates Python's -c option."""
1368
1370
1369 #sys.argv = ['-c']
1371 #sys.argv = ['-c']
1370 self.push(self.rc.c)
1372 self.push(self.rc.c)
1371
1373
1372 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1374 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1373 """Embeds IPython into a running python program.
1375 """Embeds IPython into a running python program.
1374
1376
1375 Input:
1377 Input:
1376
1378
1377 - header: An optional header message can be specified.
1379 - header: An optional header message can be specified.
1378
1380
1379 - local_ns, global_ns: working namespaces. If given as None, the
1381 - local_ns, global_ns: working namespaces. If given as None, the
1380 IPython-initialized one is updated with __main__.__dict__, so that
1382 IPython-initialized one is updated with __main__.__dict__, so that
1381 program variables become visible but user-specific configuration
1383 program variables become visible but user-specific configuration
1382 remains possible.
1384 remains possible.
1383
1385
1384 - stack_depth: specifies how many levels in the stack to go to
1386 - stack_depth: specifies how many levels in the stack to go to
1385 looking for namespaces (when local_ns and global_ns are None). This
1387 looking for namespaces (when local_ns and global_ns are None). This
1386 allows an intermediate caller to make sure that this function gets
1388 allows an intermediate caller to make sure that this function gets
1387 the namespace from the intended level in the stack. By default (0)
1389 the namespace from the intended level in the stack. By default (0)
1388 it will get its locals and globals from the immediate caller.
1390 it will get its locals and globals from the immediate caller.
1389
1391
1390 Warning: it's possible to use this in a program which is being run by
1392 Warning: it's possible to use this in a program which is being run by
1391 IPython itself (via %run), but some funny things will happen (a few
1393 IPython itself (via %run), but some funny things will happen (a few
1392 globals get overwritten). In the future this will be cleaned up, as
1394 globals get overwritten). In the future this will be cleaned up, as
1393 there is no fundamental reason why it can't work perfectly."""
1395 there is no fundamental reason why it can't work perfectly."""
1394
1396
1395 # Get locals and globals from caller
1397 # Get locals and globals from caller
1396 if local_ns is None or global_ns is None:
1398 if local_ns is None or global_ns is None:
1397 call_frame = sys._getframe(stack_depth).f_back
1399 call_frame = sys._getframe(stack_depth).f_back
1398
1400
1399 if local_ns is None:
1401 if local_ns is None:
1400 local_ns = call_frame.f_locals
1402 local_ns = call_frame.f_locals
1401 if global_ns is None:
1403 if global_ns is None:
1402 global_ns = call_frame.f_globals
1404 global_ns = call_frame.f_globals
1403
1405
1404 # Update namespaces and fire up interpreter
1406 # Update namespaces and fire up interpreter
1405
1407
1406 # The global one is easy, we can just throw it in
1408 # The global one is easy, we can just throw it in
1407 self.user_global_ns = global_ns
1409 self.user_global_ns = global_ns
1408
1410
1409 # but the user/local one is tricky: ipython needs it to store internal
1411 # but the user/local one is tricky: ipython needs it to store internal
1410 # data, but we also need the locals. We'll copy locals in the user
1412 # data, but we also need the locals. We'll copy locals in the user
1411 # one, but will track what got copied so we can delete them at exit.
1413 # one, but will track what got copied so we can delete them at exit.
1412 # This is so that a later embedded call doesn't see locals from a
1414 # This is so that a later embedded call doesn't see locals from a
1413 # previous call (which most likely existed in a separate scope).
1415 # previous call (which most likely existed in a separate scope).
1414 local_varnames = local_ns.keys()
1416 local_varnames = local_ns.keys()
1415 self.user_ns.update(local_ns)
1417 self.user_ns.update(local_ns)
1416
1418
1417 # Patch for global embedding to make sure that things don't overwrite
1419 # Patch for global embedding to make sure that things don't overwrite
1418 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1420 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1419 # FIXME. Test this a bit more carefully (the if.. is new)
1421 # FIXME. Test this a bit more carefully (the if.. is new)
1420 if local_ns is None and global_ns is None:
1422 if local_ns is None and global_ns is None:
1421 self.user_global_ns.update(__main__.__dict__)
1423 self.user_global_ns.update(__main__.__dict__)
1422
1424
1423 # make sure the tab-completer has the correct frame information, so it
1425 # make sure the tab-completer has the correct frame information, so it
1424 # actually completes using the frame's locals/globals
1426 # actually completes using the frame's locals/globals
1425 self.set_completer_frame()
1427 self.set_completer_frame()
1426
1428
1427 # before activating the interactive mode, we need to make sure that
1429 # before activating the interactive mode, we need to make sure that
1428 # all names in the builtin namespace needed by ipython point to
1430 # all names in the builtin namespace needed by ipython point to
1429 # ourselves, and not to other instances.
1431 # ourselves, and not to other instances.
1430 self.add_builtins()
1432 self.add_builtins()
1431
1433
1432 self.interact(header)
1434 self.interact(header)
1433
1435
1434 # now, purge out the user namespace from anything we might have added
1436 # now, purge out the user namespace from anything we might have added
1435 # from the caller's local namespace
1437 # from the caller's local namespace
1436 delvar = self.user_ns.pop
1438 delvar = self.user_ns.pop
1437 for var in local_varnames:
1439 for var in local_varnames:
1438 delvar(var,None)
1440 delvar(var,None)
1439 # and clean builtins we may have overridden
1441 # and clean builtins we may have overridden
1440 self.clean_builtins()
1442 self.clean_builtins()
1441
1443
1442 def interact(self, banner=None):
1444 def interact(self, banner=None):
1443 """Closely emulate the interactive Python console.
1445 """Closely emulate the interactive Python console.
1444
1446
1445 The optional banner argument specify the banner to print
1447 The optional banner argument specify the banner to print
1446 before the first interaction; by default it prints a banner
1448 before the first interaction; by default it prints a banner
1447 similar to the one printed by the real Python interpreter,
1449 similar to the one printed by the real Python interpreter,
1448 followed by the current class name in parentheses (so as not
1450 followed by the current class name in parentheses (so as not
1449 to confuse this with the real interpreter -- since it's so
1451 to confuse this with the real interpreter -- since it's so
1450 close!).
1452 close!).
1451
1453
1452 """
1454 """
1453 cprt = 'Type "copyright", "credits" or "license" for more information.'
1455 cprt = 'Type "copyright", "credits" or "license" for more information.'
1454 if banner is None:
1456 if banner is None:
1455 self.write("Python %s on %s\n%s\n(%s)\n" %
1457 self.write("Python %s on %s\n%s\n(%s)\n" %
1456 (sys.version, sys.platform, cprt,
1458 (sys.version, sys.platform, cprt,
1457 self.__class__.__name__))
1459 self.__class__.__name__))
1458 else:
1460 else:
1459 self.write(banner)
1461 self.write(banner)
1460
1462
1461 more = 0
1463 more = 0
1462
1464
1463 # Mark activity in the builtins
1465 # Mark activity in the builtins
1464 __builtin__.__dict__['__IPYTHON__active'] += 1
1466 __builtin__.__dict__['__IPYTHON__active'] += 1
1465
1467
1466 # exit_now is set by a call to %Exit or %Quit
1468 # exit_now is set by a call to %Exit or %Quit
1467 self.exit_now = False
1469 self.exit_now = False
1468 while not self.exit_now:
1470 while not self.exit_now:
1469 if more:
1471 if more:
1470 prompt = self.outputcache.prompt2
1472 prompt = self.outputcache.prompt2
1471 if self.autoindent:
1473 if self.autoindent:
1472 self.readline_startup_hook(self.pre_readline)
1474 self.readline_startup_hook(self.pre_readline)
1473 else:
1475 else:
1474 prompt = self.outputcache.prompt1
1476 prompt = self.outputcache.prompt1
1475 try:
1477 try:
1476 line = self.raw_input(prompt,more)
1478 line = self.raw_input(prompt,more)
1477 if self.autoindent:
1479 if self.autoindent:
1478 self.readline_startup_hook(None)
1480 self.readline_startup_hook(None)
1479 except KeyboardInterrupt:
1481 except KeyboardInterrupt:
1480 self.write('\nKeyboardInterrupt\n')
1482 self.write('\nKeyboardInterrupt\n')
1481 self.resetbuffer()
1483 self.resetbuffer()
1482 # keep cache in sync with the prompt counter:
1484 # keep cache in sync with the prompt counter:
1483 self.outputcache.prompt_count -= 1
1485 self.outputcache.prompt_count -= 1
1484
1486
1485 if self.autoindent:
1487 if self.autoindent:
1486 self.indent_current_nsp = 0
1488 self.indent_current_nsp = 0
1487 more = 0
1489 more = 0
1488 except EOFError:
1490 except EOFError:
1489 if self.autoindent:
1491 if self.autoindent:
1490 self.readline_startup_hook(None)
1492 self.readline_startup_hook(None)
1491 self.write('\n')
1493 self.write('\n')
1492 self.exit()
1494 self.exit()
1493 except bdb.BdbQuit:
1495 except bdb.BdbQuit:
1494 warn('The Python debugger has exited with a BdbQuit exception.\n'
1496 warn('The Python debugger has exited with a BdbQuit exception.\n'
1495 'Because of how pdb handles the stack, it is impossible\n'
1497 'Because of how pdb handles the stack, it is impossible\n'
1496 'for IPython to properly format this particular exception.\n'
1498 'for IPython to properly format this particular exception.\n'
1497 'IPython will resume normal operation.')
1499 'IPython will resume normal operation.')
1498 except:
1500 except:
1499 # exceptions here are VERY RARE, but they can be triggered
1501 # exceptions here are VERY RARE, but they can be triggered
1500 # asynchronously by signal handlers, for example.
1502 # asynchronously by signal handlers, for example.
1501 self.showtraceback()
1503 self.showtraceback()
1502 else:
1504 else:
1503 more = self.push(line)
1505 more = self.push(line)
1504 if (self.SyntaxTB.last_syntax_error and
1506 if (self.SyntaxTB.last_syntax_error and
1505 self.rc.autoedit_syntax):
1507 self.rc.autoedit_syntax):
1506 self.edit_syntax_error()
1508 self.edit_syntax_error()
1507
1509
1508 # We are off again...
1510 # We are off again...
1509 __builtin__.__dict__['__IPYTHON__active'] -= 1
1511 __builtin__.__dict__['__IPYTHON__active'] -= 1
1510
1512
1511 def excepthook(self, etype, value, tb):
1513 def excepthook(self, etype, value, tb):
1512 """One more defense for GUI apps that call sys.excepthook.
1514 """One more defense for GUI apps that call sys.excepthook.
1513
1515
1514 GUI frameworks like wxPython trap exceptions and call
1516 GUI frameworks like wxPython trap exceptions and call
1515 sys.excepthook themselves. I guess this is a feature that
1517 sys.excepthook themselves. I guess this is a feature that
1516 enables them to keep running after exceptions that would
1518 enables them to keep running after exceptions that would
1517 otherwise kill their mainloop. This is a bother for IPython
1519 otherwise kill their mainloop. This is a bother for IPython
1518 which excepts to catch all of the program exceptions with a try:
1520 which excepts to catch all of the program exceptions with a try:
1519 except: statement.
1521 except: statement.
1520
1522
1521 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1523 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1522 any app directly invokes sys.excepthook, it will look to the user like
1524 any app directly invokes sys.excepthook, it will look to the user like
1523 IPython crashed. In order to work around this, we can disable the
1525 IPython crashed. In order to work around this, we can disable the
1524 CrashHandler and replace it with this excepthook instead, which prints a
1526 CrashHandler and replace it with this excepthook instead, which prints a
1525 regular traceback using our InteractiveTB. In this fashion, apps which
1527 regular traceback using our InteractiveTB. In this fashion, apps which
1526 call sys.excepthook will generate a regular-looking exception from
1528 call sys.excepthook will generate a regular-looking exception from
1527 IPython, and the CrashHandler will only be triggered by real IPython
1529 IPython, and the CrashHandler will only be triggered by real IPython
1528 crashes.
1530 crashes.
1529
1531
1530 This hook should be used sparingly, only in places which are not likely
1532 This hook should be used sparingly, only in places which are not likely
1531 to be true IPython errors.
1533 to be true IPython errors.
1532 """
1534 """
1533 self.showtraceback((etype,value,tb),tb_offset=0)
1535 self.showtraceback((etype,value,tb),tb_offset=0)
1534
1536
1535 def transform_alias(self, alias,rest=''):
1537 def transform_alias(self, alias,rest=''):
1536 """ Transform alias to system command string
1538 """ Transform alias to system command string
1537
1539
1538 """
1540 """
1539 nargs,cmd = self.alias_table[alias]
1541 nargs,cmd = self.alias_table[alias]
1540 if ' ' in cmd and os.path.isfile(cmd):
1542 if ' ' in cmd and os.path.isfile(cmd):
1541 cmd = '"%s"' % cmd
1543 cmd = '"%s"' % cmd
1542
1544
1543 # Expand the %l special to be the user's input line
1545 # Expand the %l special to be the user's input line
1544 if cmd.find('%l') >= 0:
1546 if cmd.find('%l') >= 0:
1545 cmd = cmd.replace('%l',rest)
1547 cmd = cmd.replace('%l',rest)
1546 rest = ''
1548 rest = ''
1547 if nargs==0:
1549 if nargs==0:
1548 # Simple, argument-less aliases
1550 # Simple, argument-less aliases
1549 cmd = '%s %s' % (cmd,rest)
1551 cmd = '%s %s' % (cmd,rest)
1550 else:
1552 else:
1551 # Handle aliases with positional arguments
1553 # Handle aliases with positional arguments
1552 args = rest.split(None,nargs)
1554 args = rest.split(None,nargs)
1553 if len(args)< nargs:
1555 if len(args)< nargs:
1554 error('Alias <%s> requires %s arguments, %s given.' %
1556 error('Alias <%s> requires %s arguments, %s given.' %
1555 (alias,nargs,len(args)))
1557 (alias,nargs,len(args)))
1556 return None
1558 return None
1557 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1559 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1558 # Now call the macro, evaluating in the user's namespace
1560 # Now call the macro, evaluating in the user's namespace
1559
1561
1560 return cmd
1562 return cmd
1561
1563
1562 def call_alias(self,alias,rest=''):
1564 def call_alias(self,alias,rest=''):
1563 """Call an alias given its name and the rest of the line.
1565 """Call an alias given its name and the rest of the line.
1564
1566
1565 This is only used to provide backwards compatibility for users of
1567 This is only used to provide backwards compatibility for users of
1566 ipalias(), use of which is not recommended for anymore."""
1568 ipalias(), use of which is not recommended for anymore."""
1567
1569
1568 # Now call the macro, evaluating in the user's namespace
1570 # Now call the macro, evaluating in the user's namespace
1569 cmd = self.transform_alias(alias, rest)
1571 cmd = self.transform_alias(alias, rest)
1570 try:
1572 try:
1571 self.system(cmd)
1573 self.system(cmd)
1572 except:
1574 except:
1573 self.showtraceback()
1575 self.showtraceback()
1574
1576
1575 def indent_current_str(self):
1577 def indent_current_str(self):
1576 """return the current level of indentation as a string"""
1578 """return the current level of indentation as a string"""
1577 return self.indent_current_nsp * ' '
1579 return self.indent_current_nsp * ' '
1578
1580
1579 def autoindent_update(self,line):
1581 def autoindent_update(self,line):
1580 """Keep track of the indent level."""
1582 """Keep track of the indent level."""
1581
1583
1582 #debugx('line')
1584 #debugx('line')
1583 #debugx('self.indent_current_nsp')
1585 #debugx('self.indent_current_nsp')
1584 if self.autoindent:
1586 if self.autoindent:
1585 if line:
1587 if line:
1586 inisp = num_ini_spaces(line)
1588 inisp = num_ini_spaces(line)
1587 if inisp < self.indent_current_nsp:
1589 if inisp < self.indent_current_nsp:
1588 self.indent_current_nsp = inisp
1590 self.indent_current_nsp = inisp
1589
1591
1590 if line[-1] == ':':
1592 if line[-1] == ':':
1591 self.indent_current_nsp += 4
1593 self.indent_current_nsp += 4
1592 elif dedent_re.match(line):
1594 elif dedent_re.match(line):
1593 self.indent_current_nsp -= 4
1595 self.indent_current_nsp -= 4
1594 else:
1596 else:
1595 self.indent_current_nsp = 0
1597 self.indent_current_nsp = 0
1596
1598
1597 def runlines(self,lines):
1599 def runlines(self,lines):
1598 """Run a string of one or more lines of source.
1600 """Run a string of one or more lines of source.
1599
1601
1600 This method is capable of running a string containing multiple source
1602 This method is capable of running a string containing multiple source
1601 lines, as if they had been entered at the IPython prompt. Since it
1603 lines, as if they had been entered at the IPython prompt. Since it
1602 exposes IPython's processing machinery, the given strings can contain
1604 exposes IPython's processing machinery, the given strings can contain
1603 magic calls (%magic), special shell access (!cmd), etc."""
1605 magic calls (%magic), special shell access (!cmd), etc."""
1604
1606
1605 # We must start with a clean buffer, in case this is run from an
1607 # We must start with a clean buffer, in case this is run from an
1606 # interactive IPython session (via a magic, for example).
1608 # interactive IPython session (via a magic, for example).
1607 self.resetbuffer()
1609 self.resetbuffer()
1608 lines = lines.split('\n')
1610 lines = lines.split('\n')
1609 more = 0
1611 more = 0
1610 for line in lines:
1612 for line in lines:
1611 # skip blank lines so we don't mess up the prompt counter, but do
1613 # skip blank lines so we don't mess up the prompt counter, but do
1612 # NOT skip even a blank line if we are in a code block (more is
1614 # NOT skip even a blank line if we are in a code block (more is
1613 # true)
1615 # true)
1614 if line or more:
1616 if line or more:
1615 more = self.push(self.prefilter(line,more))
1617 more = self.push(self.prefilter(line,more))
1616 # IPython's runsource returns None if there was an error
1618 # IPython's runsource returns None if there was an error
1617 # compiling the code. This allows us to stop processing right
1619 # compiling the code. This allows us to stop processing right
1618 # away, so the user gets the error message at the right place.
1620 # away, so the user gets the error message at the right place.
1619 if more is None:
1621 if more is None:
1620 break
1622 break
1621 # final newline in case the input didn't have it, so that the code
1623 # final newline in case the input didn't have it, so that the code
1622 # actually does get executed
1624 # actually does get executed
1623 if more:
1625 if more:
1624 self.push('\n')
1626 self.push('\n')
1625
1627
1626 def runsource(self, source, filename='<input>', symbol='single'):
1628 def runsource(self, source, filename='<input>', symbol='single'):
1627 """Compile and run some source in the interpreter.
1629 """Compile and run some source in the interpreter.
1628
1630
1629 Arguments are as for compile_command().
1631 Arguments are as for compile_command().
1630
1632
1631 One several things can happen:
1633 One several things can happen:
1632
1634
1633 1) The input is incorrect; compile_command() raised an
1635 1) The input is incorrect; compile_command() raised an
1634 exception (SyntaxError or OverflowError). A syntax traceback
1636 exception (SyntaxError or OverflowError). A syntax traceback
1635 will be printed by calling the showsyntaxerror() method.
1637 will be printed by calling the showsyntaxerror() method.
1636
1638
1637 2) The input is incomplete, and more input is required;
1639 2) The input is incomplete, and more input is required;
1638 compile_command() returned None. Nothing happens.
1640 compile_command() returned None. Nothing happens.
1639
1641
1640 3) The input is complete; compile_command() returned a code
1642 3) The input is complete; compile_command() returned a code
1641 object. The code is executed by calling self.runcode() (which
1643 object. The code is executed by calling self.runcode() (which
1642 also handles run-time exceptions, except for SystemExit).
1644 also handles run-time exceptions, except for SystemExit).
1643
1645
1644 The return value is:
1646 The return value is:
1645
1647
1646 - True in case 2
1648 - True in case 2
1647
1649
1648 - False in the other cases, unless an exception is raised, where
1650 - False in the other cases, unless an exception is raised, where
1649 None is returned instead. This can be used by external callers to
1651 None is returned instead. This can be used by external callers to
1650 know whether to continue feeding input or not.
1652 know whether to continue feeding input or not.
1651
1653
1652 The return value can be used to decide whether to use sys.ps1 or
1654 The return value can be used to decide whether to use sys.ps1 or
1653 sys.ps2 to prompt the next line."""
1655 sys.ps2 to prompt the next line."""
1654
1656
1655 try:
1657 try:
1656 code = self.compile(source,filename,symbol)
1658 code = self.compile(source,filename,symbol)
1657 except (OverflowError, SyntaxError, ValueError):
1659 except (OverflowError, SyntaxError, ValueError):
1658 # Case 1
1660 # Case 1
1659 self.showsyntaxerror(filename)
1661 self.showsyntaxerror(filename)
1660 return None
1662 return None
1661
1663
1662 if code is None:
1664 if code is None:
1663 # Case 2
1665 # Case 2
1664 return True
1666 return True
1665
1667
1666 # Case 3
1668 # Case 3
1667 # We store the code object so that threaded shells and
1669 # We store the code object so that threaded shells and
1668 # custom exception handlers can access all this info if needed.
1670 # custom exception handlers can access all this info if needed.
1669 # The source corresponding to this can be obtained from the
1671 # The source corresponding to this can be obtained from the
1670 # buffer attribute as '\n'.join(self.buffer).
1672 # buffer attribute as '\n'.join(self.buffer).
1671 self.code_to_run = code
1673 self.code_to_run = code
1672 # now actually execute the code object
1674 # now actually execute the code object
1673 if self.runcode(code) == 0:
1675 if self.runcode(code) == 0:
1674 return False
1676 return False
1675 else:
1677 else:
1676 return None
1678 return None
1677
1679
1678 def runcode(self,code_obj):
1680 def runcode(self,code_obj):
1679 """Execute a code object.
1681 """Execute a code object.
1680
1682
1681 When an exception occurs, self.showtraceback() is called to display a
1683 When an exception occurs, self.showtraceback() is called to display a
1682 traceback.
1684 traceback.
1683
1685
1684 Return value: a flag indicating whether the code to be run completed
1686 Return value: a flag indicating whether the code to be run completed
1685 successfully:
1687 successfully:
1686
1688
1687 - 0: successful execution.
1689 - 0: successful execution.
1688 - 1: an error occurred.
1690 - 1: an error occurred.
1689 """
1691 """
1690
1692
1691 # Set our own excepthook in case the user code tries to call it
1693 # Set our own excepthook in case the user code tries to call it
1692 # directly, so that the IPython crash handler doesn't get triggered
1694 # directly, so that the IPython crash handler doesn't get triggered
1693 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1695 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1694
1696
1695 # we save the original sys.excepthook in the instance, in case config
1697 # we save the original sys.excepthook in the instance, in case config
1696 # code (such as magics) needs access to it.
1698 # code (such as magics) needs access to it.
1697 self.sys_excepthook = old_excepthook
1699 self.sys_excepthook = old_excepthook
1698 outflag = 1 # happens in more places, so it's easier as default
1700 outflag = 1 # happens in more places, so it's easier as default
1699 try:
1701 try:
1700 try:
1702 try:
1701 # Embedded instances require separate global/local namespaces
1703 # Embedded instances require separate global/local namespaces
1702 # so they can see both the surrounding (local) namespace and
1704 # so they can see both the surrounding (local) namespace and
1703 # the module-level globals when called inside another function.
1705 # the module-level globals when called inside another function.
1704 if self.embedded:
1706 if self.embedded:
1705 exec code_obj in self.user_global_ns, self.user_ns
1707 exec code_obj in self.user_global_ns, self.user_ns
1706 # Normal (non-embedded) instances should only have a single
1708 # Normal (non-embedded) instances should only have a single
1707 # namespace for user code execution, otherwise functions won't
1709 # namespace for user code execution, otherwise functions won't
1708 # see interactive top-level globals.
1710 # see interactive top-level globals.
1709 else:
1711 else:
1710 exec code_obj in self.user_ns
1712 exec code_obj in self.user_ns
1711 finally:
1713 finally:
1712 # Reset our crash handler in place
1714 # Reset our crash handler in place
1713 sys.excepthook = old_excepthook
1715 sys.excepthook = old_excepthook
1714 except SystemExit:
1716 except SystemExit:
1715 self.resetbuffer()
1717 self.resetbuffer()
1716 self.showtraceback()
1718 self.showtraceback()
1717 warn("Type exit or quit to exit IPython "
1719 warn("Type exit or quit to exit IPython "
1718 "(%Exit or %Quit do so unconditionally).",level=1)
1720 "(%Exit or %Quit do so unconditionally).",level=1)
1719 except self.custom_exceptions:
1721 except self.custom_exceptions:
1720 etype,value,tb = sys.exc_info()
1722 etype,value,tb = sys.exc_info()
1721 self.CustomTB(etype,value,tb)
1723 self.CustomTB(etype,value,tb)
1722 except:
1724 except:
1723 self.showtraceback()
1725 self.showtraceback()
1724 else:
1726 else:
1725 outflag = 0
1727 outflag = 0
1726 if softspace(sys.stdout, 0):
1728 if softspace(sys.stdout, 0):
1727 print
1729 print
1728 # Flush out code object which has been run (and source)
1730 # Flush out code object which has been run (and source)
1729 self.code_to_run = None
1731 self.code_to_run = None
1730 return outflag
1732 return outflag
1731
1733
1732 def push(self, line):
1734 def push(self, line):
1733 """Push a line to the interpreter.
1735 """Push a line to the interpreter.
1734
1736
1735 The line should not have a trailing newline; it may have
1737 The line should not have a trailing newline; it may have
1736 internal newlines. The line is appended to a buffer and the
1738 internal newlines. The line is appended to a buffer and the
1737 interpreter's runsource() method is called with the
1739 interpreter's runsource() method is called with the
1738 concatenated contents of the buffer as source. If this
1740 concatenated contents of the buffer as source. If this
1739 indicates that the command was executed or invalid, the buffer
1741 indicates that the command was executed or invalid, the buffer
1740 is reset; otherwise, the command is incomplete, and the buffer
1742 is reset; otherwise, the command is incomplete, and the buffer
1741 is left as it was after the line was appended. The return
1743 is left as it was after the line was appended. The return
1742 value is 1 if more input is required, 0 if the line was dealt
1744 value is 1 if more input is required, 0 if the line was dealt
1743 with in some way (this is the same as runsource()).
1745 with in some way (this is the same as runsource()).
1744 """
1746 """
1745
1747
1746 # autoindent management should be done here, and not in the
1748 # autoindent management should be done here, and not in the
1747 # interactive loop, since that one is only seen by keyboard input. We
1749 # interactive loop, since that one is only seen by keyboard input. We
1748 # need this done correctly even for code run via runlines (which uses
1750 # need this done correctly even for code run via runlines (which uses
1749 # push).
1751 # push).
1750
1752
1751 #print 'push line: <%s>' % line # dbg
1753 #print 'push line: <%s>' % line # dbg
1752 self.autoindent_update(line)
1754 self.autoindent_update(line)
1753
1755
1754 self.buffer.append(line)
1756 self.buffer.append(line)
1755 more = self.runsource('\n'.join(self.buffer), self.filename)
1757 more = self.runsource('\n'.join(self.buffer), self.filename)
1756 if not more:
1758 if not more:
1757 self.resetbuffer()
1759 self.resetbuffer()
1758 return more
1760 return more
1759
1761
1760 def resetbuffer(self):
1762 def resetbuffer(self):
1761 """Reset the input buffer."""
1763 """Reset the input buffer."""
1762 self.buffer[:] = []
1764 self.buffer[:] = []
1763
1765
1764 def raw_input(self,prompt='',continue_prompt=False):
1766 def raw_input(self,prompt='',continue_prompt=False):
1765 """Write a prompt and read a line.
1767 """Write a prompt and read a line.
1766
1768
1767 The returned line does not include the trailing newline.
1769 The returned line does not include the trailing newline.
1768 When the user enters the EOF key sequence, EOFError is raised.
1770 When the user enters the EOF key sequence, EOFError is raised.
1769
1771
1770 Optional inputs:
1772 Optional inputs:
1771
1773
1772 - prompt(''): a string to be printed to prompt the user.
1774 - prompt(''): a string to be printed to prompt the user.
1773
1775
1774 - continue_prompt(False): whether this line is the first one or a
1776 - continue_prompt(False): whether this line is the first one or a
1775 continuation in a sequence of inputs.
1777 continuation in a sequence of inputs.
1776 """
1778 """
1777
1779
1778 line = raw_input_original(prompt)
1780 line = raw_input_original(prompt)
1779
1781
1780 # Try to be reasonably smart about not re-indenting pasted input more
1782 # Try to be reasonably smart about not re-indenting pasted input more
1781 # than necessary. We do this by trimming out the auto-indent initial
1783 # than necessary. We do this by trimming out the auto-indent initial
1782 # spaces, if the user's actual input started itself with whitespace.
1784 # spaces, if the user's actual input started itself with whitespace.
1783 #debugx('self.buffer[-1]')
1785 #debugx('self.buffer[-1]')
1784
1786
1785 if self.autoindent:
1787 if self.autoindent:
1786 if num_ini_spaces(line) > self.indent_current_nsp:
1788 if num_ini_spaces(line) > self.indent_current_nsp:
1787 line = line[self.indent_current_nsp:]
1789 line = line[self.indent_current_nsp:]
1788 self.indent_current_nsp = 0
1790 self.indent_current_nsp = 0
1789
1791
1790 # store the unfiltered input before the user has any chance to modify
1792 # store the unfiltered input before the user has any chance to modify
1791 # it.
1793 # it.
1792 if line.strip():
1794 if line.strip():
1793 if continue_prompt:
1795 if continue_prompt:
1794 self.input_hist_raw[-1] += '%s\n' % line
1796 self.input_hist_raw[-1] += '%s\n' % line
1795 else:
1797 else:
1796 self.input_hist_raw.append('%s\n' % line)
1798 self.input_hist_raw.append('%s\n' % line)
1797
1799
1798 try:
1800 try:
1799 lineout = self.prefilter(line,continue_prompt)
1801 lineout = self.prefilter(line,continue_prompt)
1800 except:
1802 except:
1801 # blanket except, in case a user-defined prefilter crashes, so it
1803 # blanket except, in case a user-defined prefilter crashes, so it
1802 # can't take all of ipython with it.
1804 # can't take all of ipython with it.
1803 self.showtraceback()
1805 self.showtraceback()
1804 return lineout
1806 return lineout
1805
1807
1806 def split_user_input(self,line):
1808 def split_user_input(self,line):
1807 """Split user input into pre-char, function part and rest."""
1809 """Split user input into pre-char, function part and rest."""
1808
1810
1809 lsplit = self.line_split.match(line)
1811 lsplit = self.line_split.match(line)
1810 if lsplit is None: # no regexp match returns None
1812 if lsplit is None: # no regexp match returns None
1811 try:
1813 try:
1812 iFun,theRest = line.split(None,1)
1814 iFun,theRest = line.split(None,1)
1813 except ValueError:
1815 except ValueError:
1814 iFun,theRest = line,''
1816 iFun,theRest = line,''
1815 pre = re.match('^(\s*)(.*)',line).groups()[0]
1817 pre = re.match('^(\s*)(.*)',line).groups()[0]
1816 else:
1818 else:
1817 pre,iFun,theRest = lsplit.groups()
1819 pre,iFun,theRest = lsplit.groups()
1818
1820
1819 #print 'line:<%s>' % line # dbg
1821 #print 'line:<%s>' % line # dbg
1820 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1822 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1821 return pre,iFun.strip(),theRest
1823 return pre,iFun.strip(),theRest
1822
1824
1823 def _prefilter(self, line, continue_prompt):
1825 def _prefilter(self, line, continue_prompt):
1824 """Calls different preprocessors, depending on the form of line."""
1826 """Calls different preprocessors, depending on the form of line."""
1825
1827
1826 # All handlers *must* return a value, even if it's blank ('').
1828 # All handlers *must* return a value, even if it's blank ('').
1827
1829
1828 # Lines are NOT logged here. Handlers should process the line as
1830 # Lines are NOT logged here. Handlers should process the line as
1829 # needed, update the cache AND log it (so that the input cache array
1831 # needed, update the cache AND log it (so that the input cache array
1830 # stays synced).
1832 # stays synced).
1831
1833
1832 # This function is _very_ delicate, and since it's also the one which
1834 # This function is _very_ delicate, and since it's also the one which
1833 # determines IPython's response to user input, it must be as efficient
1835 # determines IPython's response to user input, it must be as efficient
1834 # as possible. For this reason it has _many_ returns in it, trying
1836 # as possible. For this reason it has _many_ returns in it, trying
1835 # always to exit as quickly as it can figure out what it needs to do.
1837 # always to exit as quickly as it can figure out what it needs to do.
1836
1838
1837 # This function is the main responsible for maintaining IPython's
1839 # This function is the main responsible for maintaining IPython's
1838 # behavior respectful of Python's semantics. So be _very_ careful if
1840 # behavior respectful of Python's semantics. So be _very_ careful if
1839 # making changes to anything here.
1841 # making changes to anything here.
1840
1842
1841 #.....................................................................
1843 #.....................................................................
1842 # Code begins
1844 # Code begins
1843
1845
1844 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1846 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1845
1847
1846 # save the line away in case we crash, so the post-mortem handler can
1848 # save the line away in case we crash, so the post-mortem handler can
1847 # record it
1849 # record it
1848 self._last_input_line = line
1850 self._last_input_line = line
1849
1851
1850 #print '***line: <%s>' % line # dbg
1852 #print '***line: <%s>' % line # dbg
1851
1853
1852 # the input history needs to track even empty lines
1854 # the input history needs to track even empty lines
1853 stripped = line.strip()
1855 stripped = line.strip()
1854
1856
1855 if not stripped:
1857 if not stripped:
1856 if not continue_prompt:
1858 if not continue_prompt:
1857 self.outputcache.prompt_count -= 1
1859 self.outputcache.prompt_count -= 1
1858 return self.handle_normal(line,continue_prompt)
1860 return self.handle_normal(line,continue_prompt)
1859 #return self.handle_normal('',continue_prompt)
1861 #return self.handle_normal('',continue_prompt)
1860
1862
1861 # print '***cont',continue_prompt # dbg
1863 # print '***cont',continue_prompt # dbg
1862 # special handlers are only allowed for single line statements
1864 # special handlers are only allowed for single line statements
1863 if continue_prompt and not self.rc.multi_line_specials:
1865 if continue_prompt and not self.rc.multi_line_specials:
1864 return self.handle_normal(line,continue_prompt)
1866 return self.handle_normal(line,continue_prompt)
1865
1867
1866
1868
1867 # For the rest, we need the structure of the input
1869 # For the rest, we need the structure of the input
1868 pre,iFun,theRest = self.split_user_input(line)
1870 pre,iFun,theRest = self.split_user_input(line)
1869
1871
1870 # See whether any pre-existing handler can take care of it
1872 # See whether any pre-existing handler can take care of it
1871
1873
1872 rewritten = self.hooks.input_prefilter(stripped)
1874 rewritten = self.hooks.input_prefilter(stripped)
1873 if rewritten != stripped: # ok, some prefilter did something
1875 if rewritten != stripped: # ok, some prefilter did something
1874 rewritten = pre + rewritten # add indentation
1876 rewritten = pre + rewritten # add indentation
1875 return self.handle_normal(rewritten)
1877 return self.handle_normal(rewritten)
1876
1878
1877
1878
1879
1880 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1879 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1881
1880
1882 # First check for explicit escapes in the last/first character
1881 # First check for explicit escapes in the last/first character
1883 handler = None
1882 handler = None
1884 if line[-1] == self.ESC_HELP:
1883 if line[-1] == self.ESC_HELP:
1885 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1884 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1886 if handler is None:
1885 if handler is None:
1887 # look at the first character of iFun, NOT of line, so we skip
1886 # look at the first character of iFun, NOT of line, so we skip
1888 # leading whitespace in multiline input
1887 # leading whitespace in multiline input
1889 handler = self.esc_handlers.get(iFun[0:1])
1888 handler = self.esc_handlers.get(iFun[0:1])
1890 if handler is not None:
1889 if handler is not None:
1891 return handler(line,continue_prompt,pre,iFun,theRest)
1890 return handler(line,continue_prompt,pre,iFun,theRest)
1892 # Emacs ipython-mode tags certain input lines
1891 # Emacs ipython-mode tags certain input lines
1893 if line.endswith('# PYTHON-MODE'):
1892 if line.endswith('# PYTHON-MODE'):
1894 return self.handle_emacs(line,continue_prompt)
1893 return self.handle_emacs(line,continue_prompt)
1895
1894
1896 # Next, check if we can automatically execute this thing
1895 # Next, check if we can automatically execute this thing
1897
1896
1898 # Allow ! in multi-line statements if multi_line_specials is on:
1897 # Allow ! in multi-line statements if multi_line_specials is on:
1899 if continue_prompt and self.rc.multi_line_specials and \
1898 if continue_prompt and self.rc.multi_line_specials and \
1900 iFun.startswith(self.ESC_SHELL):
1899 iFun.startswith(self.ESC_SHELL):
1901 return self.handle_shell_escape(line,continue_prompt,
1900 return self.handle_shell_escape(line,continue_prompt,
1902 pre=pre,iFun=iFun,
1901 pre=pre,iFun=iFun,
1903 theRest=theRest)
1902 theRest=theRest)
1904
1903
1905 # Let's try to find if the input line is a magic fn
1904 # Let's try to find if the input line is a magic fn
1906 oinfo = None
1905 oinfo = None
1907 if hasattr(self,'magic_'+iFun):
1906 if hasattr(self,'magic_'+iFun):
1908 # WARNING: _ofind uses getattr(), so it can consume generators and
1907 # WARNING: _ofind uses getattr(), so it can consume generators and
1909 # cause other side effects.
1908 # cause other side effects.
1910 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1909 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1911 if oinfo['ismagic']:
1910 if oinfo['ismagic']:
1912 # Be careful not to call magics when a variable assignment is
1911 # Be careful not to call magics when a variable assignment is
1913 # being made (ls='hi', for example)
1912 # being made (ls='hi', for example)
1914 if self.rc.automagic and \
1913 if self.rc.automagic and \
1915 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1914 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1916 (self.rc.multi_line_specials or not continue_prompt):
1915 (self.rc.multi_line_specials or not continue_prompt):
1917 return self.handle_magic(line,continue_prompt,
1916 return self.handle_magic(line,continue_prompt,
1918 pre,iFun,theRest)
1917 pre,iFun,theRest)
1919 else:
1918 else:
1920 return self.handle_normal(line,continue_prompt)
1919 return self.handle_normal(line,continue_prompt)
1921
1920
1922 # If the rest of the line begins with an (in)equality, assginment or
1921 # If the rest of the line begins with an (in)equality, assginment or
1923 # function call, we should not call _ofind but simply execute it.
1922 # function call, we should not call _ofind but simply execute it.
1924 # This avoids spurious geattr() accesses on objects upon assignment.
1923 # This avoids spurious geattr() accesses on objects upon assignment.
1925 #
1924 #
1926 # It also allows users to assign to either alias or magic names true
1925 # It also allows users to assign to either alias or magic names true
1927 # python variables (the magic/alias systems always take second seat to
1926 # python variables (the magic/alias systems always take second seat to
1928 # true python code).
1927 # true python code).
1929 if theRest and theRest[0] in '!=()':
1928 if theRest and theRest[0] in '!=()':
1930 return self.handle_normal(line,continue_prompt)
1929 return self.handle_normal(line,continue_prompt)
1931
1930
1932 if oinfo is None:
1931 if oinfo is None:
1933 # let's try to ensure that _oinfo is ONLY called when autocall is
1932 # let's try to ensure that _oinfo is ONLY called when autocall is
1934 # on. Since it has inevitable potential side effects, at least
1933 # on. Since it has inevitable potential side effects, at least
1935 # having autocall off should be a guarantee to the user that no
1934 # having autocall off should be a guarantee to the user that no
1936 # weird things will happen.
1935 # weird things will happen.
1937
1936
1938 if self.rc.autocall:
1937 if self.rc.autocall:
1939 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1938 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1940 else:
1939 else:
1941 # in this case, all that's left is either an alias or
1940 # in this case, all that's left is either an alias or
1942 # processing the line normally.
1941 # processing the line normally.
1943 if iFun in self.alias_table:
1942 if iFun in self.alias_table:
1944 return self.handle_alias(line,continue_prompt,
1943 # if autocall is off, by not running _ofind we won't know
1945 pre,iFun,theRest)
1944 # whether the given name may also exist in one of the
1945 # user's namespace. At this point, it's best to do a
1946 # quick check just to be sure that we don't let aliases
1947 # shadow variables.
1948 head = iFun.split('.',1)[0]
1949 if head in self.user_ns or head in self.internal_ns \
1950 or head in __builtin__.__dict__:
1951 return self.handle_normal(line,continue_prompt)
1952 else:
1953 return self.handle_alias(line,continue_prompt,
1954 pre,iFun,theRest)
1946
1955
1947 else:
1956 else:
1948 return self.handle_normal(line,continue_prompt)
1957 return self.handle_normal(line,continue_prompt)
1949
1958
1950 if not oinfo['found']:
1959 if not oinfo['found']:
1951 return self.handle_normal(line,continue_prompt)
1960 return self.handle_normal(line,continue_prompt)
1952 else:
1961 else:
1953 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1962 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1954 if oinfo['isalias']:
1963 if oinfo['isalias']:
1955 return self.handle_alias(line,continue_prompt,
1964 return self.handle_alias(line,continue_prompt,
1956 pre,iFun,theRest)
1965 pre,iFun,theRest)
1957
1966
1958 if (self.rc.autocall
1967 if (self.rc.autocall
1959 and
1968 and
1960 (
1969 (
1961 #only consider exclusion re if not "," or ";" autoquoting
1970 #only consider exclusion re if not "," or ";" autoquoting
1962 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1971 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1963 or pre == self.ESC_PAREN) or
1972 or pre == self.ESC_PAREN) or
1964 (not self.re_exclude_auto.match(theRest)))
1973 (not self.re_exclude_auto.match(theRest)))
1965 and
1974 and
1966 self.re_fun_name.match(iFun) and
1975 self.re_fun_name.match(iFun) and
1967 callable(oinfo['obj'])) :
1976 callable(oinfo['obj'])) :
1968 #print 'going auto' # dbg
1977 #print 'going auto' # dbg
1969 return self.handle_auto(line,continue_prompt,
1978 return self.handle_auto(line,continue_prompt,
1970 pre,iFun,theRest,oinfo['obj'])
1979 pre,iFun,theRest,oinfo['obj'])
1971 else:
1980 else:
1972 #print 'was callable?', callable(oinfo['obj']) # dbg
1981 #print 'was callable?', callable(oinfo['obj']) # dbg
1973 return self.handle_normal(line,continue_prompt)
1982 return self.handle_normal(line,continue_prompt)
1974
1983
1975 # If we get here, we have a normal Python line. Log and return.
1984 # If we get here, we have a normal Python line. Log and return.
1976 return self.handle_normal(line,continue_prompt)
1985 return self.handle_normal(line,continue_prompt)
1977
1986
1978 def _prefilter_dumb(self, line, continue_prompt):
1987 def _prefilter_dumb(self, line, continue_prompt):
1979 """simple prefilter function, for debugging"""
1988 """simple prefilter function, for debugging"""
1980 return self.handle_normal(line,continue_prompt)
1989 return self.handle_normal(line,continue_prompt)
1981
1990
1982 # Set the default prefilter() function (this can be user-overridden)
1991 # Set the default prefilter() function (this can be user-overridden)
1983 prefilter = _prefilter
1992 prefilter = _prefilter
1984
1993
1985 def handle_normal(self,line,continue_prompt=None,
1994 def handle_normal(self,line,continue_prompt=None,
1986 pre=None,iFun=None,theRest=None):
1995 pre=None,iFun=None,theRest=None):
1987 """Handle normal input lines. Use as a template for handlers."""
1996 """Handle normal input lines. Use as a template for handlers."""
1988
1997
1989 # With autoindent on, we need some way to exit the input loop, and I
1998 # With autoindent on, we need some way to exit the input loop, and I
1990 # don't want to force the user to have to backspace all the way to
1999 # don't want to force the user to have to backspace all the way to
1991 # clear the line. The rule will be in this case, that either two
2000 # clear the line. The rule will be in this case, that either two
1992 # lines of pure whitespace in a row, or a line of pure whitespace but
2001 # lines of pure whitespace in a row, or a line of pure whitespace but
1993 # of a size different to the indent level, will exit the input loop.
2002 # of a size different to the indent level, will exit the input loop.
1994
2003
1995 if (continue_prompt and self.autoindent and line.isspace() and
2004 if (continue_prompt and self.autoindent and line.isspace() and
1996 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2005 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1997 (self.buffer[-1]).isspace() )):
2006 (self.buffer[-1]).isspace() )):
1998 line = ''
2007 line = ''
1999
2008
2000 self.log(line,continue_prompt)
2009 self.log(line,continue_prompt)
2001 return line
2010 return line
2002
2011
2003 def handle_alias(self,line,continue_prompt=None,
2012 def handle_alias(self,line,continue_prompt=None,
2004 pre=None,iFun=None,theRest=None):
2013 pre=None,iFun=None,theRest=None):
2005 """Handle alias input lines. """
2014 """Handle alias input lines. """
2006
2015
2007 # pre is needed, because it carries the leading whitespace. Otherwise
2016 # pre is needed, because it carries the leading whitespace. Otherwise
2008 # aliases won't work in indented sections.
2017 # aliases won't work in indented sections.
2009 transformed = self.transform_alias(iFun, theRest)
2018 transformed = self.transform_alias(iFun, theRest)
2010 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2019 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2011 self.log(line_out,continue_prompt)
2020 self.log(line_out,continue_prompt)
2012 return line_out
2021 return line_out
2013
2022
2014 def handle_shell_escape(self, line, continue_prompt=None,
2023 def handle_shell_escape(self, line, continue_prompt=None,
2015 pre=None,iFun=None,theRest=None):
2024 pre=None,iFun=None,theRest=None):
2016 """Execute the line in a shell, empty return value"""
2025 """Execute the line in a shell, empty return value"""
2017
2026
2018 #print 'line in :', `line` # dbg
2027 #print 'line in :', `line` # dbg
2019 # Example of a special handler. Others follow a similar pattern.
2028 # Example of a special handler. Others follow a similar pattern.
2020 if line.lstrip().startswith('!!'):
2029 if line.lstrip().startswith('!!'):
2021 # rewrite iFun/theRest to properly hold the call to %sx and
2030 # rewrite iFun/theRest to properly hold the call to %sx and
2022 # the actual command to be executed, so handle_magic can work
2031 # the actual command to be executed, so handle_magic can work
2023 # correctly
2032 # correctly
2024 theRest = '%s %s' % (iFun[2:],theRest)
2033 theRest = '%s %s' % (iFun[2:],theRest)
2025 iFun = 'sx'
2034 iFun = 'sx'
2026 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2035 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2027 line.lstrip()[2:]),
2036 line.lstrip()[2:]),
2028 continue_prompt,pre,iFun,theRest)
2037 continue_prompt,pre,iFun,theRest)
2029 else:
2038 else:
2030 cmd=line.lstrip().lstrip('!')
2039 cmd=line.lstrip().lstrip('!')
2031 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2040 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2032 # update cache/log and return
2041 # update cache/log and return
2033 self.log(line_out,continue_prompt)
2042 self.log(line_out,continue_prompt)
2034 return line_out
2043 return line_out
2035
2044
2036 def handle_magic(self, line, continue_prompt=None,
2045 def handle_magic(self, line, continue_prompt=None,
2037 pre=None,iFun=None,theRest=None):
2046 pre=None,iFun=None,theRest=None):
2038 """Execute magic functions."""
2047 """Execute magic functions."""
2039
2048
2040
2049
2041 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2050 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2042 self.log(cmd,continue_prompt)
2051 self.log(cmd,continue_prompt)
2043 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2052 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2044 return cmd
2053 return cmd
2045
2054
2046 def handle_auto(self, line, continue_prompt=None,
2055 def handle_auto(self, line, continue_prompt=None,
2047 pre=None,iFun=None,theRest=None,obj=None):
2056 pre=None,iFun=None,theRest=None,obj=None):
2048 """Hande lines which can be auto-executed, quoting if requested."""
2057 """Hande lines which can be auto-executed, quoting if requested."""
2049
2058
2050 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2059 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2051
2060
2052 # This should only be active for single-line input!
2061 # This should only be active for single-line input!
2053 if continue_prompt:
2062 if continue_prompt:
2054 self.log(line,continue_prompt)
2063 self.log(line,continue_prompt)
2055 return line
2064 return line
2056
2065
2057 auto_rewrite = True
2066 auto_rewrite = True
2058
2067
2059 if pre == self.ESC_QUOTE:
2068 if pre == self.ESC_QUOTE:
2060 # Auto-quote splitting on whitespace
2069 # Auto-quote splitting on whitespace
2061 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2070 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2062 elif pre == self.ESC_QUOTE2:
2071 elif pre == self.ESC_QUOTE2:
2063 # Auto-quote whole string
2072 # Auto-quote whole string
2064 newcmd = '%s("%s")' % (iFun,theRest)
2073 newcmd = '%s("%s")' % (iFun,theRest)
2065 elif pre == self.ESC_PAREN:
2074 elif pre == self.ESC_PAREN:
2066 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2075 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2067 else:
2076 else:
2068 # Auto-paren.
2077 # Auto-paren.
2069 # We only apply it to argument-less calls if the autocall
2078 # We only apply it to argument-less calls if the autocall
2070 # parameter is set to 2. We only need to check that autocall is <
2079 # parameter is set to 2. We only need to check that autocall is <
2071 # 2, since this function isn't called unless it's at least 1.
2080 # 2, since this function isn't called unless it's at least 1.
2072 if not theRest and (self.rc.autocall < 2):
2081 if not theRest and (self.rc.autocall < 2):
2073 newcmd = '%s %s' % (iFun,theRest)
2082 newcmd = '%s %s' % (iFun,theRest)
2074 auto_rewrite = False
2083 auto_rewrite = False
2075 else:
2084 else:
2076 if theRest.startswith('['):
2085 if theRest.startswith('['):
2077 if hasattr(obj,'__getitem__'):
2086 if hasattr(obj,'__getitem__'):
2078 # Don't autocall in this case: item access for an object
2087 # Don't autocall in this case: item access for an object
2079 # which is BOTH callable and implements __getitem__.
2088 # which is BOTH callable and implements __getitem__.
2080 newcmd = '%s %s' % (iFun,theRest)
2089 newcmd = '%s %s' % (iFun,theRest)
2081 auto_rewrite = False
2090 auto_rewrite = False
2082 else:
2091 else:
2083 # if the object doesn't support [] access, go ahead and
2092 # if the object doesn't support [] access, go ahead and
2084 # autocall
2093 # autocall
2085 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2094 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2086 elif theRest.endswith(';'):
2095 elif theRest.endswith(';'):
2087 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2096 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2088 else:
2097 else:
2089 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2098 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2090
2099
2091 if auto_rewrite:
2100 if auto_rewrite:
2092 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2101 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2093 # log what is now valid Python, not the actual user input (without the
2102 # log what is now valid Python, not the actual user input (without the
2094 # final newline)
2103 # final newline)
2095 self.log(newcmd,continue_prompt)
2104 self.log(newcmd,continue_prompt)
2096 return newcmd
2105 return newcmd
2097
2106
2098 def handle_help(self, line, continue_prompt=None,
2107 def handle_help(self, line, continue_prompt=None,
2099 pre=None,iFun=None,theRest=None):
2108 pre=None,iFun=None,theRest=None):
2100 """Try to get some help for the object.
2109 """Try to get some help for the object.
2101
2110
2102 obj? or ?obj -> basic information.
2111 obj? or ?obj -> basic information.
2103 obj?? or ??obj -> more details.
2112 obj?? or ??obj -> more details.
2104 """
2113 """
2105
2114
2106 # We need to make sure that we don't process lines which would be
2115 # We need to make sure that we don't process lines which would be
2107 # otherwise valid python, such as "x=1 # what?"
2116 # otherwise valid python, such as "x=1 # what?"
2108 try:
2117 try:
2109 codeop.compile_command(line)
2118 codeop.compile_command(line)
2110 except SyntaxError:
2119 except SyntaxError:
2111 # We should only handle as help stuff which is NOT valid syntax
2120 # We should only handle as help stuff which is NOT valid syntax
2112 if line[0]==self.ESC_HELP:
2121 if line[0]==self.ESC_HELP:
2113 line = line[1:]
2122 line = line[1:]
2114 elif line[-1]==self.ESC_HELP:
2123 elif line[-1]==self.ESC_HELP:
2115 line = line[:-1]
2124 line = line[:-1]
2116 self.log('#?'+line)
2125 self.log('#?'+line)
2117 if line:
2126 if line:
2118 self.magic_pinfo(line)
2127 self.magic_pinfo(line)
2119 else:
2128 else:
2120 page(self.usage,screen_lines=self.rc.screen_length)
2129 page(self.usage,screen_lines=self.rc.screen_length)
2121 return '' # Empty string is needed here!
2130 return '' # Empty string is needed here!
2122 except:
2131 except:
2123 # Pass any other exceptions through to the normal handler
2132 # Pass any other exceptions through to the normal handler
2124 return self.handle_normal(line,continue_prompt)
2133 return self.handle_normal(line,continue_prompt)
2125 else:
2134 else:
2126 # If the code compiles ok, we should handle it normally
2135 # If the code compiles ok, we should handle it normally
2127 return self.handle_normal(line,continue_prompt)
2136 return self.handle_normal(line,continue_prompt)
2128
2137
2129 def getapi(self):
2138 def getapi(self):
2130 """ Get an IPApi object for this shell instance
2139 """ Get an IPApi object for this shell instance
2131
2140
2132 Getting an IPApi object is always preferable to accessing the shell
2141 Getting an IPApi object is always preferable to accessing the shell
2133 directly, but this holds true especially for extensions.
2142 directly, but this holds true especially for extensions.
2134
2143
2135 It should always be possible to implement an extension with IPApi
2144 It should always be possible to implement an extension with IPApi
2136 alone. If not, contact maintainer to request an addition.
2145 alone. If not, contact maintainer to request an addition.
2137
2146
2138 """
2147 """
2139 return self.api
2148 return self.api
2140
2149
2141 def handle_emacs(self,line,continue_prompt=None,
2150 def handle_emacs(self,line,continue_prompt=None,
2142 pre=None,iFun=None,theRest=None):
2151 pre=None,iFun=None,theRest=None):
2143 """Handle input lines marked by python-mode."""
2152 """Handle input lines marked by python-mode."""
2144
2153
2145 # Currently, nothing is done. Later more functionality can be added
2154 # Currently, nothing is done. Later more functionality can be added
2146 # here if needed.
2155 # here if needed.
2147
2156
2148 # The input cache shouldn't be updated
2157 # The input cache shouldn't be updated
2149
2158
2150 return line
2159 return line
2151
2160
2152 def mktempfile(self,data=None):
2161 def mktempfile(self,data=None):
2153 """Make a new tempfile and return its filename.
2162 """Make a new tempfile and return its filename.
2154
2163
2155 This makes a call to tempfile.mktemp, but it registers the created
2164 This makes a call to tempfile.mktemp, but it registers the created
2156 filename internally so ipython cleans it up at exit time.
2165 filename internally so ipython cleans it up at exit time.
2157
2166
2158 Optional inputs:
2167 Optional inputs:
2159
2168
2160 - data(None): if data is given, it gets written out to the temp file
2169 - data(None): if data is given, it gets written out to the temp file
2161 immediately, and the file is closed again."""
2170 immediately, and the file is closed again."""
2162
2171
2163 filename = tempfile.mktemp('.py','ipython_edit_')
2172 filename = tempfile.mktemp('.py','ipython_edit_')
2164 self.tempfiles.append(filename)
2173 self.tempfiles.append(filename)
2165
2174
2166 if data:
2175 if data:
2167 tmp_file = open(filename,'w')
2176 tmp_file = open(filename,'w')
2168 tmp_file.write(data)
2177 tmp_file.write(data)
2169 tmp_file.close()
2178 tmp_file.close()
2170 return filename
2179 return filename
2171
2180
2172 def write(self,data):
2181 def write(self,data):
2173 """Write a string to the default output"""
2182 """Write a string to the default output"""
2174 Term.cout.write(data)
2183 Term.cout.write(data)
2175
2184
2176 def write_err(self,data):
2185 def write_err(self,data):
2177 """Write a string to the default error output"""
2186 """Write a string to the default error output"""
2178 Term.cerr.write(data)
2187 Term.cerr.write(data)
2179
2188
2180 def exit(self):
2189 def exit(self):
2181 """Handle interactive exit.
2190 """Handle interactive exit.
2182
2191
2183 This method sets the exit_now attribute."""
2192 This method sets the exit_now attribute."""
2184
2193
2185 if self.rc.confirm_exit:
2194 if self.rc.confirm_exit:
2186 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2195 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2187 self.exit_now = True
2196 self.exit_now = True
2188 else:
2197 else:
2189 self.exit_now = True
2198 self.exit_now = True
2190 return self.exit_now
2199 return self.exit_now
2191
2200
2192 def safe_execfile(self,fname,*where,**kw):
2201 def safe_execfile(self,fname,*where,**kw):
2193 fname = os.path.expanduser(fname)
2202 fname = os.path.expanduser(fname)
2194
2203
2195 # find things also in current directory
2204 # find things also in current directory
2196 dname = os.path.dirname(fname)
2205 dname = os.path.dirname(fname)
2197 if not sys.path.count(dname):
2206 if not sys.path.count(dname):
2198 sys.path.append(dname)
2207 sys.path.append(dname)
2199
2208
2200 try:
2209 try:
2201 xfile = open(fname)
2210 xfile = open(fname)
2202 except:
2211 except:
2203 print >> Term.cerr, \
2212 print >> Term.cerr, \
2204 'Could not open file <%s> for safe execution.' % fname
2213 'Could not open file <%s> for safe execution.' % fname
2205 return None
2214 return None
2206
2215
2207 kw.setdefault('islog',0)
2216 kw.setdefault('islog',0)
2208 kw.setdefault('quiet',1)
2217 kw.setdefault('quiet',1)
2209 kw.setdefault('exit_ignore',0)
2218 kw.setdefault('exit_ignore',0)
2210 first = xfile.readline()
2219 first = xfile.readline()
2211 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2220 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2212 xfile.close()
2221 xfile.close()
2213 # line by line execution
2222 # line by line execution
2214 if first.startswith(loghead) or kw['islog']:
2223 if first.startswith(loghead) or kw['islog']:
2215 print 'Loading log file <%s> one line at a time...' % fname
2224 print 'Loading log file <%s> one line at a time...' % fname
2216 if kw['quiet']:
2225 if kw['quiet']:
2217 stdout_save = sys.stdout
2226 stdout_save = sys.stdout
2218 sys.stdout = StringIO.StringIO()
2227 sys.stdout = StringIO.StringIO()
2219 try:
2228 try:
2220 globs,locs = where[0:2]
2229 globs,locs = where[0:2]
2221 except:
2230 except:
2222 try:
2231 try:
2223 globs = locs = where[0]
2232 globs = locs = where[0]
2224 except:
2233 except:
2225 globs = locs = globals()
2234 globs = locs = globals()
2226 badblocks = []
2235 badblocks = []
2227
2236
2228 # we also need to identify indented blocks of code when replaying
2237 # we also need to identify indented blocks of code when replaying
2229 # logs and put them together before passing them to an exec
2238 # logs and put them together before passing them to an exec
2230 # statement. This takes a bit of regexp and look-ahead work in the
2239 # statement. This takes a bit of regexp and look-ahead work in the
2231 # file. It's easiest if we swallow the whole thing in memory
2240 # file. It's easiest if we swallow the whole thing in memory
2232 # first, and manually walk through the lines list moving the
2241 # first, and manually walk through the lines list moving the
2233 # counter ourselves.
2242 # counter ourselves.
2234 indent_re = re.compile('\s+\S')
2243 indent_re = re.compile('\s+\S')
2235 xfile = open(fname)
2244 xfile = open(fname)
2236 filelines = xfile.readlines()
2245 filelines = xfile.readlines()
2237 xfile.close()
2246 xfile.close()
2238 nlines = len(filelines)
2247 nlines = len(filelines)
2239 lnum = 0
2248 lnum = 0
2240 while lnum < nlines:
2249 while lnum < nlines:
2241 line = filelines[lnum]
2250 line = filelines[lnum]
2242 lnum += 1
2251 lnum += 1
2243 # don't re-insert logger status info into cache
2252 # don't re-insert logger status info into cache
2244 if line.startswith('#log#'):
2253 if line.startswith('#log#'):
2245 continue
2254 continue
2246 else:
2255 else:
2247 # build a block of code (maybe a single line) for execution
2256 # build a block of code (maybe a single line) for execution
2248 block = line
2257 block = line
2249 try:
2258 try:
2250 next = filelines[lnum] # lnum has already incremented
2259 next = filelines[lnum] # lnum has already incremented
2251 except:
2260 except:
2252 next = None
2261 next = None
2253 while next and indent_re.match(next):
2262 while next and indent_re.match(next):
2254 block += next
2263 block += next
2255 lnum += 1
2264 lnum += 1
2256 try:
2265 try:
2257 next = filelines[lnum]
2266 next = filelines[lnum]
2258 except:
2267 except:
2259 next = None
2268 next = None
2260 # now execute the block of one or more lines
2269 # now execute the block of one or more lines
2261 try:
2270 try:
2262 exec block in globs,locs
2271 exec block in globs,locs
2263 except SystemExit:
2272 except SystemExit:
2264 pass
2273 pass
2265 except:
2274 except:
2266 badblocks.append(block.rstrip())
2275 badblocks.append(block.rstrip())
2267 if kw['quiet']: # restore stdout
2276 if kw['quiet']: # restore stdout
2268 sys.stdout.close()
2277 sys.stdout.close()
2269 sys.stdout = stdout_save
2278 sys.stdout = stdout_save
2270 print 'Finished replaying log file <%s>' % fname
2279 print 'Finished replaying log file <%s>' % fname
2271 if badblocks:
2280 if badblocks:
2272 print >> sys.stderr, ('\nThe following lines/blocks in file '
2281 print >> sys.stderr, ('\nThe following lines/blocks in file '
2273 '<%s> reported errors:' % fname)
2282 '<%s> reported errors:' % fname)
2274
2283
2275 for badline in badblocks:
2284 for badline in badblocks:
2276 print >> sys.stderr, badline
2285 print >> sys.stderr, badline
2277 else: # regular file execution
2286 else: # regular file execution
2278 try:
2287 try:
2279 execfile(fname,*where)
2288 execfile(fname,*where)
2280 except SyntaxError:
2289 except SyntaxError:
2281 self.showsyntaxerror()
2290 self.showsyntaxerror()
2282 warn('Failure executing file: <%s>' % fname)
2291 warn('Failure executing file: <%s>' % fname)
2283 except SystemExit,status:
2292 except SystemExit,status:
2284 if not kw['exit_ignore']:
2293 if not kw['exit_ignore']:
2285 self.showtraceback()
2294 self.showtraceback()
2286 warn('Failure executing file: <%s>' % fname)
2295 warn('Failure executing file: <%s>' % fname)
2287 except:
2296 except:
2288 self.showtraceback()
2297 self.showtraceback()
2289 warn('Failure executing file: <%s>' % fname)
2298 warn('Failure executing file: <%s>' % fname)
2290
2299
2291 #************************* end of file <iplib.py> *****************************
2300 #************************* end of file <iplib.py> *****************************
@@ -1,755 +1,757 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.1 or better.
5 Requires Python 2.1 or better.
6
6
7 This file contains the main make_IPython() starter function.
7 This file contains the main make_IPython() starter function.
8
8
9 $Id: ipmaker.py 1328 2006-05-25 07:47:56Z fperez $"""
9 $Id: ipmaker.py 1329 2006-05-26 07:52:45Z fperez $"""
10
10
11 #*****************************************************************************
11 #*****************************************************************************
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
13 #
13 #
14 # Distributed under the terms of the BSD License. The full license is in
14 # Distributed under the terms of the BSD License. The full license is in
15 # the file COPYING, distributed as part of this software.
15 # the file COPYING, distributed as part of this software.
16 #*****************************************************************************
16 #*****************************************************************************
17
17
18 from IPython import Release
18 from IPython import Release
19 __author__ = '%s <%s>' % Release.authors['Fernando']
19 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __license__ = Release.license
20 __license__ = Release.license
21 __version__ = Release.version
21 __version__ = Release.version
22
22
23 credits._Printer__data = """
23 credits._Printer__data = """
24 Python: %s
24 Python: %s
25
25
26 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
26 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
27 See http://ipython.scipy.org for more information.""" \
27 See http://ipython.scipy.org for more information.""" \
28 % credits._Printer__data
28 % credits._Printer__data
29
29
30 copyright._Printer__data += """
30 copyright._Printer__data += """
31
31
32 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
32 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
33 All Rights Reserved."""
33 All Rights Reserved."""
34
34
35 #****************************************************************************
35 #****************************************************************************
36 # Required modules
36 # Required modules
37
37
38 # From the standard library
38 # From the standard library
39 import __main__
39 import __main__
40 import __builtin__
40 import __builtin__
41 import os
41 import os
42 import re
42 import re
43 import sys
43 import sys
44 import types
44 import types
45 from pprint import pprint,pformat
45 from pprint import pprint,pformat
46
46
47 # Our own
47 # Our own
48 from IPython import DPyGetOpt
48 from IPython import DPyGetOpt
49 from IPython.ipstruct import Struct
49 from IPython.ipstruct import Struct
50 from IPython.OutputTrap import OutputTrap
50 from IPython.OutputTrap import OutputTrap
51 from IPython.ConfigLoader import ConfigLoader
51 from IPython.ConfigLoader import ConfigLoader
52 from IPython.iplib import InteractiveShell
52 from IPython.iplib import InteractiveShell
53 from IPython.usage import cmd_line_usage,interactive_usage
53 from IPython.usage import cmd_line_usage,interactive_usage
54 from IPython.genutils import *
54 from IPython.genutils import *
55
55
56 #-----------------------------------------------------------------------------
56 #-----------------------------------------------------------------------------
57 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
57 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
58 rc_override=None,shell_class=InteractiveShell,
58 rc_override=None,shell_class=InteractiveShell,
59 embedded=False,**kw):
59 embedded=False,**kw):
60 """This is a dump of IPython into a single function.
60 """This is a dump of IPython into a single function.
61
61
62 Later it will have to be broken up in a sensible manner.
62 Later it will have to be broken up in a sensible manner.
63
63
64 Arguments:
64 Arguments:
65
65
66 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
66 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
67 script name, b/c DPyGetOpt strips the first argument only for the real
67 script name, b/c DPyGetOpt strips the first argument only for the real
68 sys.argv.
68 sys.argv.
69
69
70 - user_ns: a dict to be used as the user's namespace."""
70 - user_ns: a dict to be used as the user's namespace."""
71
71
72 #----------------------------------------------------------------------
72 #----------------------------------------------------------------------
73 # Defaults and initialization
73 # Defaults and initialization
74
74
75 # For developer debugging, deactivates crash handler and uses pdb.
75 # For developer debugging, deactivates crash handler and uses pdb.
76 DEVDEBUG = False
76 DEVDEBUG = False
77
77
78 if argv is None:
78 if argv is None:
79 argv = sys.argv
79 argv = sys.argv
80
80
81 # __IP is the main global that lives throughout and represents the whole
81 # __IP is the main global that lives throughout and represents the whole
82 # application. If the user redefines it, all bets are off as to what
82 # application. If the user redefines it, all bets are off as to what
83 # happens.
83 # happens.
84
84
85 # __IP is the name of he global which the caller will have accessible as
85 # __IP is the name of he global which the caller will have accessible as
86 # __IP.name. We set its name via the first parameter passed to
86 # __IP.name. We set its name via the first parameter passed to
87 # InteractiveShell:
87 # InteractiveShell:
88
88
89 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
89 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
90 embedded=embedded,**kw)
90 embedded=embedded,**kw)
91
91
92 # Put 'help' in the user namespace
92 # Put 'help' in the user namespace
93 from site import _Helper
93 from site import _Helper
94 IP.user_ns['help'] = _Helper()
94 IP.user_ns['help'] = _Helper()
95
95
96
96
97 if DEVDEBUG:
97 if DEVDEBUG:
98 # For developer debugging only (global flag)
98 # For developer debugging only (global flag)
99 from IPython import ultraTB
99 from IPython import ultraTB
100 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
100 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
101
101
102 IP.BANNER_PARTS = ['Python %s\n'
102 IP.BANNER_PARTS = ['Python %s\n'
103 'Type "copyright", "credits" or "license" '
103 'Type "copyright", "credits" or "license" '
104 'for more information.\n'
104 'for more information.\n'
105 % (sys.version.split('\n')[0],),
105 % (sys.version.split('\n')[0],),
106 "IPython %s -- An enhanced Interactive Python."
106 "IPython %s -- An enhanced Interactive Python."
107 % (__version__,),
107 % (__version__,),
108 """? -> Introduction to IPython's features.
108 """? -> Introduction to IPython's features.
109 %magic -> Information about IPython's 'magic' % functions.
109 %magic -> Information about IPython's 'magic' % functions.
110 help -> Python's own help system.
110 help -> Python's own help system.
111 object? -> Details about 'object'. ?object also works, ?? prints more.
111 object? -> Details about 'object'. ?object also works, ?? prints more.
112 """ ]
112 """ ]
113
113
114 IP.usage = interactive_usage
114 IP.usage = interactive_usage
115
115
116 # Platform-dependent suffix and directory names. We use _ipython instead
116 # Platform-dependent suffix and directory names. We use _ipython instead
117 # of .ipython under win32 b/c there's software that breaks with .named
117 # of .ipython under win32 b/c there's software that breaks with .named
118 # directories on that platform.
118 # directories on that platform.
119 if os.name == 'posix':
119 if os.name == 'posix':
120 rc_suffix = ''
120 rc_suffix = ''
121 ipdir_def = '.ipython'
121 ipdir_def = '.ipython'
122 else:
122 else:
123 rc_suffix = '.ini'
123 rc_suffix = '.ini'
124 ipdir_def = '_ipython'
124 ipdir_def = '_ipython'
125
125
126 # default directory for configuration
126 # default directory for configuration
127 ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR',
127 ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR',
128 os.path.join(IP.home_dir,ipdir_def)))
128 os.path.join(IP.home_dir,ipdir_def)))
129
129
130 # add personal .ipython dir to sys.path so that users can put things in
130 # add personal .ipython dir to sys.path so that users can put things in
131 # there for customization
131 # there for customization
132 sys.path.append(ipythondir)
132 sys.path.append(ipythondir)
133
133
134 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
134 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
135
135
136 # we need the directory where IPython itself is installed
136 # we need the directory where IPython itself is installed
137 import IPython
137 import IPython
138 IPython_dir = os.path.dirname(IPython.__file__)
138 IPython_dir = os.path.dirname(IPython.__file__)
139 del IPython
139 del IPython
140
140
141 #-------------------------------------------------------------------------
141 #-------------------------------------------------------------------------
142 # Command line handling
142 # Command line handling
143
143
144 # Valid command line options (uses DPyGetOpt syntax, like Perl's
144 # Valid command line options (uses DPyGetOpt syntax, like Perl's
145 # GetOpt::Long)
145 # GetOpt::Long)
146
146
147 # Any key not listed here gets deleted even if in the file (like session
147 # Any key not listed here gets deleted even if in the file (like session
148 # or profile). That's deliberate, to maintain the rc namespace clean.
148 # or profile). That's deliberate, to maintain the rc namespace clean.
149
149
150 # Each set of options appears twice: under _conv only the names are
150 # Each set of options appears twice: under _conv only the names are
151 # listed, indicating which type they must be converted to when reading the
151 # listed, indicating which type they must be converted to when reading the
152 # ipythonrc file. And under DPyGetOpt they are listed with the regular
152 # ipythonrc file. And under DPyGetOpt they are listed with the regular
153 # DPyGetOpt syntax (=s,=i,:f,etc).
153 # DPyGetOpt syntax (=s,=i,:f,etc).
154
154
155 # Make sure there's a space before each end of line (they get auto-joined!)
155 # Make sure there's a space before each end of line (they get auto-joined!)
156 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
156 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
157 'c=s classic|cl color_info! colors=s confirm_exit! '
157 'c=s classic|cl color_info! colors=s confirm_exit! '
158 'debug! deep_reload! editor=s log|l messages! nosep pdb! '
158 'debug! deep_reload! editor=s log|l messages! nosep '
159 'object_info_string_level=i pdb! '
159 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
160 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
160 'quick screen_length|sl=i prompts_pad_left=i '
161 'quick screen_length|sl=i prompts_pad_left=i '
161 'logfile|lf=s logplay|lp=s profile|p=s '
162 'logfile|lf=s logplay|lp=s profile|p=s '
162 'readline! readline_merge_completions! '
163 'readline! readline_merge_completions! '
163 'readline_omit__names! '
164 'readline_omit__names! '
164 'rcfile=s separate_in|si=s separate_out|so=s '
165 'rcfile=s separate_in|si=s separate_out|so=s '
165 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
166 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
166 'magic_docstrings system_verbose! '
167 'magic_docstrings system_verbose! '
167 'multi_line_specials! '
168 'multi_line_specials! '
168 'wxversion=s '
169 'wxversion=s '
169 'autoedit_syntax!')
170 'autoedit_syntax!')
170
171
171 # Options that can *only* appear at the cmd line (not in rcfiles).
172 # Options that can *only* appear at the cmd line (not in rcfiles).
172
173
173 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
174 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
174 # the 'C-c !' command in emacs automatically appends a -i option at the end.
175 # the 'C-c !' command in emacs automatically appends a -i option at the end.
175 cmdline_only = ('help ignore|i ipythondir=s Version upgrade '
176 cmdline_only = ('help ignore|i ipythondir=s Version upgrade '
176 'gthread! qthread! wthread! pylab! tk!')
177 'gthread! qthread! wthread! pylab! tk!')
177
178
178 # Build the actual name list to be used by DPyGetOpt
179 # Build the actual name list to be used by DPyGetOpt
179 opts_names = qw(cmdline_opts) + qw(cmdline_only)
180 opts_names = qw(cmdline_opts) + qw(cmdline_only)
180
181
181 # Set sensible command line defaults.
182 # Set sensible command line defaults.
182 # This should have everything from cmdline_opts and cmdline_only
183 # This should have everything from cmdline_opts and cmdline_only
183 opts_def = Struct(autocall = 1,
184 opts_def = Struct(autocall = 1,
184 autoedit_syntax = 0,
185 autoedit_syntax = 0,
185 autoindent = 0,
186 autoindent = 0,
186 automagic = 1,
187 automagic = 1,
187 banner = 1,
188 banner = 1,
188 cache_size = 1000,
189 cache_size = 1000,
189 c = '',
190 c = '',
190 classic = 0,
191 classic = 0,
191 colors = 'NoColor',
192 colors = 'NoColor',
192 color_info = 0,
193 color_info = 0,
193 confirm_exit = 1,
194 confirm_exit = 1,
194 debug = 0,
195 debug = 0,
195 deep_reload = 0,
196 deep_reload = 0,
196 editor = '0',
197 editor = '0',
197 help = 0,
198 help = 0,
198 ignore = 0,
199 ignore = 0,
199 ipythondir = ipythondir,
200 ipythondir = ipythondir,
200 log = 0,
201 log = 0,
201 logfile = '',
202 logfile = '',
202 logplay = '',
203 logplay = '',
203 multi_line_specials = 1,
204 multi_line_specials = 1,
204 messages = 1,
205 messages = 1,
206 object_info_string_level = 0,
205 nosep = 0,
207 nosep = 0,
206 pdb = 0,
208 pdb = 0,
207 pprint = 0,
209 pprint = 0,
208 profile = '',
210 profile = '',
209 prompt_in1 = 'In [\\#]: ',
211 prompt_in1 = 'In [\\#]: ',
210 prompt_in2 = ' .\\D.: ',
212 prompt_in2 = ' .\\D.: ',
211 prompt_out = 'Out[\\#]: ',
213 prompt_out = 'Out[\\#]: ',
212 prompts_pad_left = 1,
214 prompts_pad_left = 1,
213 quick = 0,
215 quick = 0,
214 readline = 1,
216 readline = 1,
215 readline_merge_completions = 1,
217 readline_merge_completions = 1,
216 readline_omit__names = 0,
218 readline_omit__names = 0,
217 rcfile = 'ipythonrc' + rc_suffix,
219 rcfile = 'ipythonrc' + rc_suffix,
218 screen_length = 0,
220 screen_length = 0,
219 separate_in = '\n',
221 separate_in = '\n',
220 separate_out = '\n',
222 separate_out = '\n',
221 separate_out2 = '',
223 separate_out2 = '',
222 system_verbose = 0,
224 system_verbose = 0,
223 gthread = 0,
225 gthread = 0,
224 qthread = 0,
226 qthread = 0,
225 wthread = 0,
227 wthread = 0,
226 pylab = 0,
228 pylab = 0,
227 tk = 0,
229 tk = 0,
228 upgrade = 0,
230 upgrade = 0,
229 Version = 0,
231 Version = 0,
230 xmode = 'Verbose',
232 xmode = 'Verbose',
231 wildcards_case_sensitive = 1,
233 wildcards_case_sensitive = 1,
232 wxversion = '0',
234 wxversion = '0',
233 magic_docstrings = 0, # undocumented, for doc generation
235 magic_docstrings = 0, # undocumented, for doc generation
234 )
236 )
235
237
236 # Things that will *only* appear in rcfiles (not at the command line).
238 # Things that will *only* appear in rcfiles (not at the command line).
237 # Make sure there's a space before each end of line (they get auto-joined!)
239 # Make sure there's a space before each end of line (they get auto-joined!)
238 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
240 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
239 qw_lol: 'import_some ',
241 qw_lol: 'import_some ',
240 # for things with embedded whitespace:
242 # for things with embedded whitespace:
241 list_strings:'execute alias readline_parse_and_bind ',
243 list_strings:'execute alias readline_parse_and_bind ',
242 # Regular strings need no conversion:
244 # Regular strings need no conversion:
243 None:'readline_remove_delims ',
245 None:'readline_remove_delims ',
244 }
246 }
245 # Default values for these
247 # Default values for these
246 rc_def = Struct(include = [],
248 rc_def = Struct(include = [],
247 import_mod = [],
249 import_mod = [],
248 import_all = [],
250 import_all = [],
249 import_some = [[]],
251 import_some = [[]],
250 execute = [],
252 execute = [],
251 execfile = [],
253 execfile = [],
252 alias = [],
254 alias = [],
253 readline_parse_and_bind = [],
255 readline_parse_and_bind = [],
254 readline_remove_delims = '',
256 readline_remove_delims = '',
255 )
257 )
256
258
257 # Build the type conversion dictionary from the above tables:
259 # Build the type conversion dictionary from the above tables:
258 typeconv = rcfile_opts.copy()
260 typeconv = rcfile_opts.copy()
259 typeconv.update(optstr2types(cmdline_opts))
261 typeconv.update(optstr2types(cmdline_opts))
260
262
261 # FIXME: the None key appears in both, put that back together by hand. Ugly!
263 # FIXME: the None key appears in both, put that back together by hand. Ugly!
262 typeconv[None] += ' ' + rcfile_opts[None]
264 typeconv[None] += ' ' + rcfile_opts[None]
263
265
264 # Remove quotes at ends of all strings (used to protect spaces)
266 # Remove quotes at ends of all strings (used to protect spaces)
265 typeconv[unquote_ends] = typeconv[None]
267 typeconv[unquote_ends] = typeconv[None]
266 del typeconv[None]
268 del typeconv[None]
267
269
268 # Build the list we'll use to make all config decisions with defaults:
270 # Build the list we'll use to make all config decisions with defaults:
269 opts_all = opts_def.copy()
271 opts_all = opts_def.copy()
270 opts_all.update(rc_def)
272 opts_all.update(rc_def)
271
273
272 # Build conflict resolver for recursive loading of config files:
274 # Build conflict resolver for recursive loading of config files:
273 # - preserve means the outermost file maintains the value, it is not
275 # - preserve means the outermost file maintains the value, it is not
274 # overwritten if an included file has the same key.
276 # overwritten if an included file has the same key.
275 # - add_flip applies + to the two values, so it better make sense to add
277 # - add_flip applies + to the two values, so it better make sense to add
276 # those types of keys. But it flips them first so that things loaded
278 # those types of keys. But it flips them first so that things loaded
277 # deeper in the inclusion chain have lower precedence.
279 # deeper in the inclusion chain have lower precedence.
278 conflict = {'preserve': ' '.join([ typeconv[int],
280 conflict = {'preserve': ' '.join([ typeconv[int],
279 typeconv[unquote_ends] ]),
281 typeconv[unquote_ends] ]),
280 'add_flip': ' '.join([ typeconv[qwflat],
282 'add_flip': ' '.join([ typeconv[qwflat],
281 typeconv[qw_lol],
283 typeconv[qw_lol],
282 typeconv[list_strings] ])
284 typeconv[list_strings] ])
283 }
285 }
284
286
285 # Now actually process the command line
287 # Now actually process the command line
286 getopt = DPyGetOpt.DPyGetOpt()
288 getopt = DPyGetOpt.DPyGetOpt()
287 getopt.setIgnoreCase(0)
289 getopt.setIgnoreCase(0)
288
290
289 getopt.parseConfiguration(opts_names)
291 getopt.parseConfiguration(opts_names)
290
292
291 try:
293 try:
292 getopt.processArguments(argv)
294 getopt.processArguments(argv)
293 except:
295 except:
294 print cmd_line_usage
296 print cmd_line_usage
295 warn('\nError in Arguments: ' + `sys.exc_value`)
297 warn('\nError in Arguments: ' + `sys.exc_value`)
296 sys.exit(1)
298 sys.exit(1)
297
299
298 # convert the options dict to a struct for much lighter syntax later
300 # convert the options dict to a struct for much lighter syntax later
299 opts = Struct(getopt.optionValues)
301 opts = Struct(getopt.optionValues)
300 args = getopt.freeValues
302 args = getopt.freeValues
301
303
302 # this is the struct (which has default values at this point) with which
304 # this is the struct (which has default values at this point) with which
303 # we make all decisions:
305 # we make all decisions:
304 opts_all.update(opts)
306 opts_all.update(opts)
305
307
306 # Options that force an immediate exit
308 # Options that force an immediate exit
307 if opts_all.help:
309 if opts_all.help:
308 page(cmd_line_usage)
310 page(cmd_line_usage)
309 sys.exit()
311 sys.exit()
310
312
311 if opts_all.Version:
313 if opts_all.Version:
312 print __version__
314 print __version__
313 sys.exit()
315 sys.exit()
314
316
315 if opts_all.magic_docstrings:
317 if opts_all.magic_docstrings:
316 IP.magic_magic('-latex')
318 IP.magic_magic('-latex')
317 sys.exit()
319 sys.exit()
318
320
319 # Create user config directory if it doesn't exist. This must be done
321 # Create user config directory if it doesn't exist. This must be done
320 # *after* getting the cmd line options.
322 # *after* getting the cmd line options.
321 if not os.path.isdir(opts_all.ipythondir):
323 if not os.path.isdir(opts_all.ipythondir):
322 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
324 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
323
325
324 # upgrade user config files while preserving a copy of the originals
326 # upgrade user config files while preserving a copy of the originals
325 if opts_all.upgrade:
327 if opts_all.upgrade:
326 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
328 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
327
329
328 # check mutually exclusive options in the *original* command line
330 # check mutually exclusive options in the *original* command line
329 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
331 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
330 qw('classic profile'),qw('classic rcfile')])
332 qw('classic profile'),qw('classic rcfile')])
331
333
332 # Fix up sys.argv to omit the ipython call, for consistency with how
334 # Fix up sys.argv to omit the ipython call, for consistency with how
333 # Python itself operates (the inconsistency can break user scripts which
335 # Python itself operates (the inconsistency can break user scripts which
334 # rely on the Python behavior when run under ipython).
336 # rely on the Python behavior when run under ipython).
335 sys.argv[:] = sys.argv[1:]
337 sys.argv[:] = sys.argv[1:]
336
338
337 #---------------------------------------------------------------------------
339 #---------------------------------------------------------------------------
338 # Log replay
340 # Log replay
339
341
340 # if -logplay, we need to 'become' the other session. That basically means
342 # if -logplay, we need to 'become' the other session. That basically means
341 # replacing the current command line environment with that of the old
343 # replacing the current command line environment with that of the old
342 # session and moving on.
344 # session and moving on.
343
345
344 # this is needed so that later we know we're in session reload mode, as
346 # this is needed so that later we know we're in session reload mode, as
345 # opts_all will get overwritten:
347 # opts_all will get overwritten:
346 load_logplay = 0
348 load_logplay = 0
347
349
348 if opts_all.logplay:
350 if opts_all.logplay:
349 load_logplay = opts_all.logplay
351 load_logplay = opts_all.logplay
350 opts_debug_save = opts_all.debug
352 opts_debug_save = opts_all.debug
351 try:
353 try:
352 logplay = open(opts_all.logplay)
354 logplay = open(opts_all.logplay)
353 except IOError:
355 except IOError:
354 if opts_all.debug: IP.InteractiveTB()
356 if opts_all.debug: IP.InteractiveTB()
355 warn('Could not open logplay file '+`opts_all.logplay`)
357 warn('Could not open logplay file '+`opts_all.logplay`)
356 # restore state as if nothing had happened and move on, but make
358 # restore state as if nothing had happened and move on, but make
357 # sure that later we don't try to actually load the session file
359 # sure that later we don't try to actually load the session file
358 logplay = None
360 logplay = None
359 load_logplay = 0
361 load_logplay = 0
360 del opts_all.logplay
362 del opts_all.logplay
361 else:
363 else:
362 try:
364 try:
363 logplay.readline()
365 logplay.readline()
364 logplay.readline();
366 logplay.readline();
365 # this reloads that session's command line
367 # this reloads that session's command line
366 cmd = logplay.readline()[6:]
368 cmd = logplay.readline()[6:]
367 exec cmd
369 exec cmd
368 # restore the true debug flag given so that the process of
370 # restore the true debug flag given so that the process of
369 # session loading itself can be monitored.
371 # session loading itself can be monitored.
370 opts.debug = opts_debug_save
372 opts.debug = opts_debug_save
371 # save the logplay flag so later we don't overwrite the log
373 # save the logplay flag so later we don't overwrite the log
372 opts.logplay = load_logplay
374 opts.logplay = load_logplay
373 # now we must update our own structure with defaults
375 # now we must update our own structure with defaults
374 opts_all.update(opts)
376 opts_all.update(opts)
375 # now load args
377 # now load args
376 cmd = logplay.readline()[6:]
378 cmd = logplay.readline()[6:]
377 exec cmd
379 exec cmd
378 logplay.close()
380 logplay.close()
379 except:
381 except:
380 logplay.close()
382 logplay.close()
381 if opts_all.debug: IP.InteractiveTB()
383 if opts_all.debug: IP.InteractiveTB()
382 warn("Logplay file lacking full configuration information.\n"
384 warn("Logplay file lacking full configuration information.\n"
383 "I'll try to read it, but some things may not work.")
385 "I'll try to read it, but some things may not work.")
384
386
385 #-------------------------------------------------------------------------
387 #-------------------------------------------------------------------------
386 # set up output traps: catch all output from files, being run, modules
388 # set up output traps: catch all output from files, being run, modules
387 # loaded, etc. Then give it to the user in a clean form at the end.
389 # loaded, etc. Then give it to the user in a clean form at the end.
388
390
389 msg_out = 'Output messages. '
391 msg_out = 'Output messages. '
390 msg_err = 'Error messages. '
392 msg_err = 'Error messages. '
391 msg_sep = '\n'
393 msg_sep = '\n'
392 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
394 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
393 msg_err,msg_sep,debug,
395 msg_err,msg_sep,debug,
394 quiet_out=1),
396 quiet_out=1),
395 user_exec = OutputTrap('User File Execution',msg_out,
397 user_exec = OutputTrap('User File Execution',msg_out,
396 msg_err,msg_sep,debug),
398 msg_err,msg_sep,debug),
397 logplay = OutputTrap('Log Loader',msg_out,
399 logplay = OutputTrap('Log Loader',msg_out,
398 msg_err,msg_sep,debug),
400 msg_err,msg_sep,debug),
399 summary = ''
401 summary = ''
400 )
402 )
401
403
402 #-------------------------------------------------------------------------
404 #-------------------------------------------------------------------------
403 # Process user ipythonrc-type configuration files
405 # Process user ipythonrc-type configuration files
404
406
405 # turn on output trapping and log to msg.config
407 # turn on output trapping and log to msg.config
406 # remember that with debug on, trapping is actually disabled
408 # remember that with debug on, trapping is actually disabled
407 msg.config.trap_all()
409 msg.config.trap_all()
408
410
409 # look for rcfile in current or default directory
411 # look for rcfile in current or default directory
410 try:
412 try:
411 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
413 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
412 except IOError:
414 except IOError:
413 if opts_all.debug: IP.InteractiveTB()
415 if opts_all.debug: IP.InteractiveTB()
414 warn('Configuration file %s not found. Ignoring request.'
416 warn('Configuration file %s not found. Ignoring request.'
415 % (opts_all.rcfile) )
417 % (opts_all.rcfile) )
416
418
417 # 'profiles' are a shorthand notation for config filenames
419 # 'profiles' are a shorthand notation for config filenames
418 if opts_all.profile:
420 if opts_all.profile:
419
421
420 try:
422 try:
421 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
423 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
422 + rc_suffix,
424 + rc_suffix,
423 opts_all.ipythondir)
425 opts_all.ipythondir)
424 except IOError:
426 except IOError:
425 if opts_all.debug: IP.InteractiveTB()
427 if opts_all.debug: IP.InteractiveTB()
426 opts.profile = '' # remove profile from options if invalid
428 opts.profile = '' # remove profile from options if invalid
427 # We won't warn anymore, primary method is ipy_profile_PROFNAME
429 # We won't warn anymore, primary method is ipy_profile_PROFNAME
428 # which does trigger a warning.
430 # which does trigger a warning.
429
431
430 # load the config file
432 # load the config file
431 rcfiledata = None
433 rcfiledata = None
432 if opts_all.quick:
434 if opts_all.quick:
433 print 'Launching IPython in quick mode. No config file read.'
435 print 'Launching IPython in quick mode. No config file read.'
434 elif opts_all.classic:
436 elif opts_all.classic:
435 print 'Launching IPython in classic mode. No config file read.'
437 print 'Launching IPython in classic mode. No config file read.'
436 elif opts_all.rcfile:
438 elif opts_all.rcfile:
437 try:
439 try:
438 cfg_loader = ConfigLoader(conflict)
440 cfg_loader = ConfigLoader(conflict)
439 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
441 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
440 'include',opts_all.ipythondir,
442 'include',opts_all.ipythondir,
441 purge = 1,
443 purge = 1,
442 unique = conflict['preserve'])
444 unique = conflict['preserve'])
443 except:
445 except:
444 IP.InteractiveTB()
446 IP.InteractiveTB()
445 warn('Problems loading configuration file '+
447 warn('Problems loading configuration file '+
446 `opts_all.rcfile`+
448 `opts_all.rcfile`+
447 '\nStarting with default -bare bones- configuration.')
449 '\nStarting with default -bare bones- configuration.')
448 else:
450 else:
449 warn('No valid configuration file found in either currrent directory\n'+
451 warn('No valid configuration file found in either currrent directory\n'+
450 'or in the IPython config. directory: '+`opts_all.ipythondir`+
452 'or in the IPython config. directory: '+`opts_all.ipythondir`+
451 '\nProceeding with internal defaults.')
453 '\nProceeding with internal defaults.')
452
454
453 #------------------------------------------------------------------------
455 #------------------------------------------------------------------------
454 # Set exception handlers in mode requested by user.
456 # Set exception handlers in mode requested by user.
455 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
457 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
456 IP.magic_xmode(opts_all.xmode)
458 IP.magic_xmode(opts_all.xmode)
457 otrap.release_out()
459 otrap.release_out()
458
460
459 #------------------------------------------------------------------------
461 #------------------------------------------------------------------------
460 # Execute user config
462 # Execute user config
461
463
462 # Create a valid config structure with the right precedence order:
464 # Create a valid config structure with the right precedence order:
463 # defaults < rcfile < command line. This needs to be in the instance, so
465 # defaults < rcfile < command line. This needs to be in the instance, so
464 # that method calls below that rely on it find it.
466 # that method calls below that rely on it find it.
465 IP.rc = rc_def.copy()
467 IP.rc = rc_def.copy()
466
468
467 # Work with a local alias inside this routine to avoid unnecessary
469 # Work with a local alias inside this routine to avoid unnecessary
468 # attribute lookups.
470 # attribute lookups.
469 IP_rc = IP.rc
471 IP_rc = IP.rc
470
472
471 IP_rc.update(opts_def)
473 IP_rc.update(opts_def)
472 if rcfiledata:
474 if rcfiledata:
473 # now we can update
475 # now we can update
474 IP_rc.update(rcfiledata)
476 IP_rc.update(rcfiledata)
475 IP_rc.update(opts)
477 IP_rc.update(opts)
476 IP_rc.update(rc_override)
478 IP_rc.update(rc_override)
477
479
478 # Store the original cmd line for reference:
480 # Store the original cmd line for reference:
479 IP_rc.opts = opts
481 IP_rc.opts = opts
480 IP_rc.args = args
482 IP_rc.args = args
481
483
482 # create a *runtime* Struct like rc for holding parameters which may be
484 # create a *runtime* Struct like rc for holding parameters which may be
483 # created and/or modified by runtime user extensions.
485 # created and/or modified by runtime user extensions.
484 IP.runtime_rc = Struct()
486 IP.runtime_rc = Struct()
485
487
486 # from this point on, all config should be handled through IP_rc,
488 # from this point on, all config should be handled through IP_rc,
487 # opts* shouldn't be used anymore.
489 # opts* shouldn't be used anymore.
488
490
489
491
490 # update IP_rc with some special things that need manual
492 # update IP_rc with some special things that need manual
491 # tweaks. Basically options which affect other options. I guess this
493 # tweaks. Basically options which affect other options. I guess this
492 # should just be written so that options are fully orthogonal and we
494 # should just be written so that options are fully orthogonal and we
493 # wouldn't worry about this stuff!
495 # wouldn't worry about this stuff!
494
496
495 if IP_rc.classic:
497 if IP_rc.classic:
496 IP_rc.quick = 1
498 IP_rc.quick = 1
497 IP_rc.cache_size = 0
499 IP_rc.cache_size = 0
498 IP_rc.pprint = 0
500 IP_rc.pprint = 0
499 IP_rc.prompt_in1 = '>>> '
501 IP_rc.prompt_in1 = '>>> '
500 IP_rc.prompt_in2 = '... '
502 IP_rc.prompt_in2 = '... '
501 IP_rc.prompt_out = ''
503 IP_rc.prompt_out = ''
502 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
504 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
503 IP_rc.colors = 'NoColor'
505 IP_rc.colors = 'NoColor'
504 IP_rc.xmode = 'Plain'
506 IP_rc.xmode = 'Plain'
505
507
506 IP.pre_config_initialization()
508 IP.pre_config_initialization()
507 # configure readline
509 # configure readline
508 # Define the history file for saving commands in between sessions
510 # Define the history file for saving commands in between sessions
509 if IP_rc.profile:
511 if IP_rc.profile:
510 histfname = 'history-%s' % IP_rc.profile
512 histfname = 'history-%s' % IP_rc.profile
511 else:
513 else:
512 histfname = 'history'
514 histfname = 'history'
513 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
515 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
514
516
515 # update exception handlers with rc file status
517 # update exception handlers with rc file status
516 otrap.trap_out() # I don't want these messages ever.
518 otrap.trap_out() # I don't want these messages ever.
517 IP.magic_xmode(IP_rc.xmode)
519 IP.magic_xmode(IP_rc.xmode)
518 otrap.release_out()
520 otrap.release_out()
519
521
520 # activate logging if requested and not reloading a log
522 # activate logging if requested and not reloading a log
521 if IP_rc.logplay:
523 if IP_rc.logplay:
522 IP.magic_logstart(IP_rc.logplay + ' append')
524 IP.magic_logstart(IP_rc.logplay + ' append')
523 elif IP_rc.logfile:
525 elif IP_rc.logfile:
524 IP.magic_logstart(IP_rc.logfile)
526 IP.magic_logstart(IP_rc.logfile)
525 elif IP_rc.log:
527 elif IP_rc.log:
526 IP.magic_logstart()
528 IP.magic_logstart()
527
529
528 # find user editor so that it we don't have to look it up constantly
530 # find user editor so that it we don't have to look it up constantly
529 if IP_rc.editor.strip()=='0':
531 if IP_rc.editor.strip()=='0':
530 try:
532 try:
531 ed = os.environ['EDITOR']
533 ed = os.environ['EDITOR']
532 except KeyError:
534 except KeyError:
533 if os.name == 'posix':
535 if os.name == 'posix':
534 ed = 'vi' # the only one guaranteed to be there!
536 ed = 'vi' # the only one guaranteed to be there!
535 else:
537 else:
536 ed = 'notepad' # same in Windows!
538 ed = 'notepad' # same in Windows!
537 IP_rc.editor = ed
539 IP_rc.editor = ed
538
540
539 # Keep track of whether this is an embedded instance or not (useful for
541 # Keep track of whether this is an embedded instance or not (useful for
540 # post-mortems).
542 # post-mortems).
541 IP_rc.embedded = IP.embedded
543 IP_rc.embedded = IP.embedded
542
544
543 # Recursive reload
545 # Recursive reload
544 try:
546 try:
545 from IPython import deep_reload
547 from IPython import deep_reload
546 if IP_rc.deep_reload:
548 if IP_rc.deep_reload:
547 __builtin__.reload = deep_reload.reload
549 __builtin__.reload = deep_reload.reload
548 else:
550 else:
549 __builtin__.dreload = deep_reload.reload
551 __builtin__.dreload = deep_reload.reload
550 del deep_reload
552 del deep_reload
551 except ImportError:
553 except ImportError:
552 pass
554 pass
553
555
554 # Save the current state of our namespace so that the interactive shell
556 # Save the current state of our namespace so that the interactive shell
555 # can later know which variables have been created by us from config files
557 # can later know which variables have been created by us from config files
556 # and loading. This way, loading a file (in any way) is treated just like
558 # and loading. This way, loading a file (in any way) is treated just like
557 # defining things on the command line, and %who works as expected.
559 # defining things on the command line, and %who works as expected.
558
560
559 # DON'T do anything that affects the namespace beyond this point!
561 # DON'T do anything that affects the namespace beyond this point!
560 IP.internal_ns.update(__main__.__dict__)
562 IP.internal_ns.update(__main__.__dict__)
561
563
562 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
564 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
563
565
564 # Now run through the different sections of the users's config
566 # Now run through the different sections of the users's config
565 if IP_rc.debug:
567 if IP_rc.debug:
566 print 'Trying to execute the following configuration structure:'
568 print 'Trying to execute the following configuration structure:'
567 print '(Things listed first are deeper in the inclusion tree and get'
569 print '(Things listed first are deeper in the inclusion tree and get'
568 print 'loaded first).\n'
570 print 'loaded first).\n'
569 pprint(IP_rc.__dict__)
571 pprint(IP_rc.__dict__)
570
572
571 for mod in IP_rc.import_mod:
573 for mod in IP_rc.import_mod:
572 try:
574 try:
573 exec 'import '+mod in IP.user_ns
575 exec 'import '+mod in IP.user_ns
574 except :
576 except :
575 IP.InteractiveTB()
577 IP.InteractiveTB()
576 import_fail_info(mod)
578 import_fail_info(mod)
577
579
578 for mod_fn in IP_rc.import_some:
580 for mod_fn in IP_rc.import_some:
579 if mod_fn == []: break
581 if mod_fn == []: break
580 mod,fn = mod_fn[0],','.join(mod_fn[1:])
582 mod,fn = mod_fn[0],','.join(mod_fn[1:])
581 try:
583 try:
582 exec 'from '+mod+' import '+fn in IP.user_ns
584 exec 'from '+mod+' import '+fn in IP.user_ns
583 except :
585 except :
584 IP.InteractiveTB()
586 IP.InteractiveTB()
585 import_fail_info(mod,fn)
587 import_fail_info(mod,fn)
586
588
587 for mod in IP_rc.import_all:
589 for mod in IP_rc.import_all:
588 try:
590 try:
589 exec 'from '+mod+' import *' in IP.user_ns
591 exec 'from '+mod+' import *' in IP.user_ns
590 except :
592 except :
591 IP.InteractiveTB()
593 IP.InteractiveTB()
592 import_fail_info(mod)
594 import_fail_info(mod)
593
595
594 for code in IP_rc.execute:
596 for code in IP_rc.execute:
595 try:
597 try:
596 exec code in IP.user_ns
598 exec code in IP.user_ns
597 except:
599 except:
598 IP.InteractiveTB()
600 IP.InteractiveTB()
599 warn('Failure executing code: ' + `code`)
601 warn('Failure executing code: ' + `code`)
600
602
601 # Execute the files the user wants in ipythonrc
603 # Execute the files the user wants in ipythonrc
602 for file in IP_rc.execfile:
604 for file in IP_rc.execfile:
603 try:
605 try:
604 file = filefind(file,sys.path+[IPython_dir])
606 file = filefind(file,sys.path+[IPython_dir])
605 except IOError:
607 except IOError:
606 warn(itpl('File $file not found. Skipping it.'))
608 warn(itpl('File $file not found. Skipping it.'))
607 else:
609 else:
608 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
610 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
609
611
610 # finally, try importing ipy_*_conf for final configuration
612 # finally, try importing ipy_*_conf for final configuration
611 try:
613 try:
612 import ipy_system_conf
614 import ipy_system_conf
613 except ImportError:
615 except ImportError:
614 if opts_all.debug: IP.InteractiveTB()
616 if opts_all.debug: IP.InteractiveTB()
615 warn("Could not import 'ipy_system_conf'")
617 warn("Could not import 'ipy_system_conf'")
616 except:
618 except:
617 IP.InteractiveTB()
619 IP.InteractiveTB()
618 import_fail_info('ipy_system_conf')
620 import_fail_info('ipy_system_conf')
619
621
620 if opts_all.profile:
622 if opts_all.profile:
621 profmodname = 'ipy_profile_' + opts_all.profile
623 profmodname = 'ipy_profile_' + opts_all.profile
622 try:
624 try:
623 __import__(profmodname)
625 __import__(profmodname)
624 except ImportError:
626 except ImportError:
625 # only warn if ipythonrc-PROFNAME didn't exist
627 # only warn if ipythonrc-PROFNAME didn't exist
626 if opts.profile =='':
628 if opts.profile =='':
627 warn("Could not start with profile '%s'!\n ('%s/%s.py' does not exist? run '%%upgrade')" % (
629 warn("Could not start with profile '%s'!\n ('%s/%s.py' does not exist? run '%%upgrade')" % (
628 opts_all.profile, ipythondir, profmodname)
630 opts_all.profile, ipythondir, profmodname)
629
631
630 )
632 )
631 except:
633 except:
632 print "Error importing",profmodname
634 print "Error importing",profmodname
633 IP.InteractiveTB()
635 IP.InteractiveTB()
634 import_fail_info(profmodname)
636 import_fail_info(profmodname)
635
637
636 try:
638 try:
637 import ipy_user_conf
639 import ipy_user_conf
638 except ImportError:
640 except ImportError:
639 if opts_all.debug: IP.InteractiveTB()
641 if opts_all.debug: IP.InteractiveTB()
640 warn("Could not import user config!\n ('%s/ipy_user_conf.py' does not exist? Please run '%%upgrade')\n" %
642 warn("Could not import user config!\n ('%s/ipy_user_conf.py' does not exist? Please run '%%upgrade')\n" %
641 ipythondir)
643 ipythondir)
642 except:
644 except:
643 print "Error importing ipy_user_conf"
645 print "Error importing ipy_user_conf"
644 IP.InteractiveTB()
646 IP.InteractiveTB()
645 import_fail_info("ipy_user_conf")
647 import_fail_info("ipy_user_conf")
646
648
647
649
648 # release stdout and stderr and save config log into a global summary
650 # release stdout and stderr and save config log into a global summary
649 msg.config.release_all()
651 msg.config.release_all()
650 if IP_rc.messages:
652 if IP_rc.messages:
651 msg.summary += msg.config.summary_all()
653 msg.summary += msg.config.summary_all()
652
654
653 #------------------------------------------------------------------------
655 #------------------------------------------------------------------------
654 # Setup interactive session
656 # Setup interactive session
655
657
656 # Now we should be fully configured. We can then execute files or load
658 # Now we should be fully configured. We can then execute files or load
657 # things only needed for interactive use. Then we'll open the shell.
659 # things only needed for interactive use. Then we'll open the shell.
658
660
659 # Take a snapshot of the user namespace before opening the shell. That way
661 # Take a snapshot of the user namespace before opening the shell. That way
660 # we'll be able to identify which things were interactively defined and
662 # we'll be able to identify which things were interactively defined and
661 # which were defined through config files.
663 # which were defined through config files.
662 IP.user_config_ns = IP.user_ns.copy()
664 IP.user_config_ns = IP.user_ns.copy()
663
665
664 # Force reading a file as if it were a session log. Slower but safer.
666 # Force reading a file as if it were a session log. Slower but safer.
665 if load_logplay:
667 if load_logplay:
666 print 'Replaying log...'
668 print 'Replaying log...'
667 try:
669 try:
668 if IP_rc.debug:
670 if IP_rc.debug:
669 logplay_quiet = 0
671 logplay_quiet = 0
670 else:
672 else:
671 logplay_quiet = 1
673 logplay_quiet = 1
672
674
673 msg.logplay.trap_all()
675 msg.logplay.trap_all()
674 IP.safe_execfile(load_logplay,IP.user_ns,
676 IP.safe_execfile(load_logplay,IP.user_ns,
675 islog = 1, quiet = logplay_quiet)
677 islog = 1, quiet = logplay_quiet)
676 msg.logplay.release_all()
678 msg.logplay.release_all()
677 if IP_rc.messages:
679 if IP_rc.messages:
678 msg.summary += msg.logplay.summary_all()
680 msg.summary += msg.logplay.summary_all()
679 except:
681 except:
680 warn('Problems replaying logfile %s.' % load_logplay)
682 warn('Problems replaying logfile %s.' % load_logplay)
681 IP.InteractiveTB()
683 IP.InteractiveTB()
682
684
683 # Load remaining files in command line
685 # Load remaining files in command line
684 msg.user_exec.trap_all()
686 msg.user_exec.trap_all()
685
687
686 # Do NOT execute files named in the command line as scripts to be loaded
688 # Do NOT execute files named in the command line as scripts to be loaded
687 # by embedded instances. Doing so has the potential for an infinite
689 # by embedded instances. Doing so has the potential for an infinite
688 # recursion if there are exceptions thrown in the process.
690 # recursion if there are exceptions thrown in the process.
689
691
690 # XXX FIXME: the execution of user files should be moved out to after
692 # XXX FIXME: the execution of user files should be moved out to after
691 # ipython is fully initialized, just as if they were run via %run at the
693 # ipython is fully initialized, just as if they were run via %run at the
692 # ipython prompt. This would also give them the benefit of ipython's
694 # ipython prompt. This would also give them the benefit of ipython's
693 # nice tracebacks.
695 # nice tracebacks.
694
696
695 if (not embedded and IP_rc.args and
697 if (not embedded and IP_rc.args and
696 not IP_rc.args[0].lower().endswith('.ipy')):
698 not IP_rc.args[0].lower().endswith('.ipy')):
697 name_save = IP.user_ns['__name__']
699 name_save = IP.user_ns['__name__']
698 IP.user_ns['__name__'] = '__main__'
700 IP.user_ns['__name__'] = '__main__'
699 # Set our own excepthook in case the user code tries to call it
701 # Set our own excepthook in case the user code tries to call it
700 # directly. This prevents triggering the IPython crash handler.
702 # directly. This prevents triggering the IPython crash handler.
701 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
703 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
702
704
703 save_argv = sys.argv[:] # save it for later restoring
705 save_argv = sys.argv[:] # save it for later restoring
704
706
705 sys.argv = args
707 sys.argv = args
706
708
707 try:
709 try:
708 IP.safe_execfile(args[0], IP.user_ns)
710 IP.safe_execfile(args[0], IP.user_ns)
709 finally:
711 finally:
710 # Reset our crash handler in place
712 # Reset our crash handler in place
711 sys.excepthook = old_excepthook
713 sys.excepthook = old_excepthook
712 sys.argv = save_argv
714 sys.argv = save_argv
713 IP.user_ns['__name__'] = name_save
715 IP.user_ns['__name__'] = name_save
714
716
715 msg.user_exec.release_all()
717 msg.user_exec.release_all()
716 if IP_rc.messages:
718 if IP_rc.messages:
717 msg.summary += msg.user_exec.summary_all()
719 msg.summary += msg.user_exec.summary_all()
718
720
719 # since we can't specify a null string on the cmd line, 0 is the equivalent:
721 # since we can't specify a null string on the cmd line, 0 is the equivalent:
720 if IP_rc.nosep:
722 if IP_rc.nosep:
721 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
723 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
722 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
724 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
723 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
725 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
724 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
726 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
725 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
727 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
726 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
728 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
727 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
729 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
728
730
729 # Determine how many lines at the bottom of the screen are needed for
731 # Determine how many lines at the bottom of the screen are needed for
730 # showing prompts, so we can know wheter long strings are to be printed or
732 # showing prompts, so we can know wheter long strings are to be printed or
731 # paged:
733 # paged:
732 num_lines_bot = IP_rc.separate_in.count('\n')+1
734 num_lines_bot = IP_rc.separate_in.count('\n')+1
733 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
735 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
734
736
735 # configure startup banner
737 # configure startup banner
736 if IP_rc.c: # regular python doesn't print the banner with -c
738 if IP_rc.c: # regular python doesn't print the banner with -c
737 IP_rc.banner = 0
739 IP_rc.banner = 0
738 if IP_rc.banner:
740 if IP_rc.banner:
739 BANN_P = IP.BANNER_PARTS
741 BANN_P = IP.BANNER_PARTS
740 else:
742 else:
741 BANN_P = []
743 BANN_P = []
742
744
743 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
745 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
744
746
745 # add message log (possibly empty)
747 # add message log (possibly empty)
746 if msg.summary: BANN_P.append(msg.summary)
748 if msg.summary: BANN_P.append(msg.summary)
747 # Final banner is a string
749 # Final banner is a string
748 IP.BANNER = '\n'.join(BANN_P)
750 IP.BANNER = '\n'.join(BANN_P)
749
751
750 # Finalize the IPython instance. This assumes the rc structure is fully
752 # Finalize the IPython instance. This assumes the rc structure is fully
751 # in place.
753 # in place.
752 IP.post_config_initialization()
754 IP.post_config_initialization()
753
755
754 return IP
756 return IP
755 #************************ end of file <ipmaker.py> **************************
757 #************************ end of file <ipmaker.py> **************************
@@ -1,5439 +1,5454 b''
1 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (_prefilter): fix bug where aliases would
4 shadow variables when autocall was fully off. Reported by SAGE
5 author William Stein.
6
7 * IPython/OInspect.py (Inspector.__init__): add a flag to control
8 at what detail level strings are computed when foo? is requested.
9 This allows users to ask for example that the string form of an
10 object is only computed when foo?? is called, or even never, by
11 setting the object_info_string_level >= 2 in the configuration
12 file. This new option has been added and documented. After a
13 request by SAGE to be able to control the printing of very large
14 objects more easily.
15
1 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
16 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
2
17
3 * IPython/ipmaker.py (make_IPython): remove the ipython call path
18 * IPython/ipmaker.py (make_IPython): remove the ipython call path
4 from sys.argv, to be 100% consistent with how Python itself works
19 from sys.argv, to be 100% consistent with how Python itself works
5 (as seen for example with python -i file.py). After a bug report
20 (as seen for example with python -i file.py). After a bug report
6 by Jeffrey Collins.
21 by Jeffrey Collins.
7
22
8 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
23 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
9 nasty bug which was preventing custom namespaces with -pylab,
24 nasty bug which was preventing custom namespaces with -pylab,
10 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
25 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
11 compatibility (long gone from mpl).
26 compatibility (long gone from mpl).
12
27
13 * IPython/ipapi.py (make_session): name change: create->make. We
28 * IPython/ipapi.py (make_session): name change: create->make. We
14 use make in other places (ipmaker,...), it's shorter and easier to
29 use make in other places (ipmaker,...), it's shorter and easier to
15 type and say, etc. I'm trying to clean things before 0.7.2 so
30 type and say, etc. I'm trying to clean things before 0.7.2 so
16 that I can keep things stable wrt to ipapi in the chainsaw branch.
31 that I can keep things stable wrt to ipapi in the chainsaw branch.
17
32
18 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
33 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
19 python-mode recognizes our debugger mode. Add support for
34 python-mode recognizes our debugger mode. Add support for
20 autoindent inside (X)emacs. After a patch sent in by Jin Liu
35 autoindent inside (X)emacs. After a patch sent in by Jin Liu
21 <m.liu.jin-AT-gmail.com> originally written by
36 <m.liu.jin-AT-gmail.com> originally written by
22 doxgen-AT-newsmth.net (with minor modifications for xemacs
37 doxgen-AT-newsmth.net (with minor modifications for xemacs
23 compatibility)
38 compatibility)
24
39
25 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
40 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
26 tracebacks when walking the stack so that the stack tracking system
41 tracebacks when walking the stack so that the stack tracking system
27 in emacs' python-mode can identify the frames correctly.
42 in emacs' python-mode can identify the frames correctly.
28
43
29 * IPython/ipmaker.py (make_IPython): make the internal (and
44 * IPython/ipmaker.py (make_IPython): make the internal (and
30 default config) autoedit_syntax value false by default. Too many
45 default config) autoedit_syntax value false by default. Too many
31 users have complained to me (both on and off-list) about problems
46 users have complained to me (both on and off-list) about problems
32 with this option being on by default, so I'm making it default to
47 with this option being on by default, so I'm making it default to
33 off. It can still be enabled by anyone via the usual mechanisms.
48 off. It can still be enabled by anyone via the usual mechanisms.
34
49
35 * IPython/completer.py (Completer.attr_matches): add support for
50 * IPython/completer.py (Completer.attr_matches): add support for
36 PyCrust-style _getAttributeNames magic method. Patch contributed
51 PyCrust-style _getAttributeNames magic method. Patch contributed
37 by <mscott-AT-goldenspud.com>. Closes #50.
52 by <mscott-AT-goldenspud.com>. Closes #50.
38
53
39 * IPython/iplib.py (InteractiveShell.__init__): remove the
54 * IPython/iplib.py (InteractiveShell.__init__): remove the
40 deletion of exit/quit from __builtin__, which can break
55 deletion of exit/quit from __builtin__, which can break
41 third-party tools like the Zope debugging console. The
56 third-party tools like the Zope debugging console. The
42 %exit/%quit magics remain. In general, it's probably a good idea
57 %exit/%quit magics remain. In general, it's probably a good idea
43 not to delete anything from __builtin__, since we never know what
58 not to delete anything from __builtin__, since we never know what
44 that will break. In any case, python now (for 2.5) will support
59 that will break. In any case, python now (for 2.5) will support
45 'real' exit/quit, so this issue is moot. Closes #55.
60 'real' exit/quit, so this issue is moot. Closes #55.
46
61
47 * IPython/genutils.py (with_obj): rename the 'with' function to
62 * IPython/genutils.py (with_obj): rename the 'with' function to
48 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
63 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
49 becomes a language keyword. Closes #53.
64 becomes a language keyword. Closes #53.
50
65
51 * IPython/FakeModule.py (FakeModule.__init__): add a proper
66 * IPython/FakeModule.py (FakeModule.__init__): add a proper
52 __file__ attribute to this so it fools more things into thinking
67 __file__ attribute to this so it fools more things into thinking
53 it is a real module. Closes #59.
68 it is a real module. Closes #59.
54
69
55 * IPython/Magic.py (magic_edit): add -n option to open the editor
70 * IPython/Magic.py (magic_edit): add -n option to open the editor
56 at a specific line number. After a patch by Stefan van der Walt.
71 at a specific line number. After a patch by Stefan van der Walt.
57
72
58 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
73 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
59
74
60 * IPython/iplib.py (edit_syntax_error): fix crash when for some
75 * IPython/iplib.py (edit_syntax_error): fix crash when for some
61 reason the file could not be opened. After automatic crash
76 reason the file could not be opened. After automatic crash
62 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
77 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
63 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
78 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
64 (_should_recompile): Don't fire editor if using %bg, since there
79 (_should_recompile): Don't fire editor if using %bg, since there
65 is no file in the first place. From the same report as above.
80 is no file in the first place. From the same report as above.
66 (raw_input): protect against faulty third-party prefilters. After
81 (raw_input): protect against faulty third-party prefilters. After
67 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
82 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
68 while running under SAGE.
83 while running under SAGE.
69
84
70 2006-05-23 Ville Vainio <vivainio@gmail.com>
85 2006-05-23 Ville Vainio <vivainio@gmail.com>
71
86
72 * ipapi.py: Stripped down ip.to_user_ns() to work only as
87 * ipapi.py: Stripped down ip.to_user_ns() to work only as
73 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
88 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
74 now returns None (again), unless dummy is specifically allowed by
89 now returns None (again), unless dummy is specifically allowed by
75 ipapi.get(allow_dummy=True).
90 ipapi.get(allow_dummy=True).
76
91
77 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
92 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
78
93
79 * IPython: remove all 2.2-compatibility objects and hacks from
94 * IPython: remove all 2.2-compatibility objects and hacks from
80 everywhere, since we only support 2.3 at this point. Docs
95 everywhere, since we only support 2.3 at this point. Docs
81 updated.
96 updated.
82
97
83 * IPython/ipapi.py (IPApi.__init__): Clean up of all getters.
98 * IPython/ipapi.py (IPApi.__init__): Clean up of all getters.
84 Anything requiring extra validation can be turned into a Python
99 Anything requiring extra validation can be turned into a Python
85 property in the future. I used a property for the db one b/c
100 property in the future. I used a property for the db one b/c
86 there was a nasty circularity problem with the initialization
101 there was a nasty circularity problem with the initialization
87 order, which right now I don't have time to clean up.
102 order, which right now I don't have time to clean up.
88
103
89 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
104 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
90 another locking bug reported by Jorgen. I'm not 100% sure though,
105 another locking bug reported by Jorgen. I'm not 100% sure though,
91 so more testing is needed...
106 so more testing is needed...
92
107
93 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
108 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
94
109
95 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
110 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
96 local variables from any routine in user code (typically executed
111 local variables from any routine in user code (typically executed
97 with %run) directly into the interactive namespace. Very useful
112 with %run) directly into the interactive namespace. Very useful
98 when doing complex debugging.
113 when doing complex debugging.
99 (IPythonNotRunning): Changed the default None object to a dummy
114 (IPythonNotRunning): Changed the default None object to a dummy
100 whose attributes can be queried as well as called without
115 whose attributes can be queried as well as called without
101 exploding, to ease writing code which works transparently both in
116 exploding, to ease writing code which works transparently both in
102 and out of ipython and uses some of this API.
117 and out of ipython and uses some of this API.
103
118
104 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
119 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
105
120
106 * IPython/hooks.py (result_display): Fix the fact that our display
121 * IPython/hooks.py (result_display): Fix the fact that our display
107 hook was using str() instead of repr(), as the default python
122 hook was using str() instead of repr(), as the default python
108 console does. This had gone unnoticed b/c it only happened if
123 console does. This had gone unnoticed b/c it only happened if
109 %Pprint was off, but the inconsistency was there.
124 %Pprint was off, but the inconsistency was there.
110
125
111 2006-05-15 Ville Vainio <vivainio@gmail.com>
126 2006-05-15 Ville Vainio <vivainio@gmail.com>
112
127
113 * Oinspect.py: Only show docstring for nonexisting/binary files
128 * Oinspect.py: Only show docstring for nonexisting/binary files
114 when doing object??, closing ticket #62
129 when doing object??, closing ticket #62
115
130
116 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
131 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
117
132
118 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
133 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
119 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
134 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
120 was being released in a routine which hadn't checked if it had
135 was being released in a routine which hadn't checked if it had
121 been the one to acquire it.
136 been the one to acquire it.
122
137
123 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
138 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
124
139
125 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
140 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
126
141
127 2006-04-11 Ville Vainio <vivainio@gmail.com>
142 2006-04-11 Ville Vainio <vivainio@gmail.com>
128
143
129 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
144 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
130 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
145 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
131 prefilters, allowing stuff like magics and aliases in the file.
146 prefilters, allowing stuff like magics and aliases in the file.
132
147
133 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
148 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
134 added. Supported now are "%clear in" and "%clear out" (clear input and
149 added. Supported now are "%clear in" and "%clear out" (clear input and
135 output history, respectively). Also fixed CachedOutput.flush to
150 output history, respectively). Also fixed CachedOutput.flush to
136 properly flush the output cache.
151 properly flush the output cache.
137
152
138 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
153 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
139 half-success (and fail explicitly).
154 half-success (and fail explicitly).
140
155
141 2006-03-28 Ville Vainio <vivainio@gmail.com>
156 2006-03-28 Ville Vainio <vivainio@gmail.com>
142
157
143 * iplib.py: Fix quoting of aliases so that only argless ones
158 * iplib.py: Fix quoting of aliases so that only argless ones
144 are quoted
159 are quoted
145
160
146 2006-03-28 Ville Vainio <vivainio@gmail.com>
161 2006-03-28 Ville Vainio <vivainio@gmail.com>
147
162
148 * iplib.py: Quote aliases with spaces in the name.
163 * iplib.py: Quote aliases with spaces in the name.
149 "c:\program files\blah\bin" is now legal alias target.
164 "c:\program files\blah\bin" is now legal alias target.
150
165
151 * ext_rehashdir.py: Space no longer allowed as arg
166 * ext_rehashdir.py: Space no longer allowed as arg
152 separator, since space is legal in path names.
167 separator, since space is legal in path names.
153
168
154 2006-03-16 Ville Vainio <vivainio@gmail.com>
169 2006-03-16 Ville Vainio <vivainio@gmail.com>
155
170
156 * upgrade_dir.py: Take path.py from Extensions, correcting
171 * upgrade_dir.py: Take path.py from Extensions, correcting
157 %upgrade magic
172 %upgrade magic
158
173
159 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
174 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
160
175
161 * hooks.py: Only enclose editor binary in quotes if legal and
176 * hooks.py: Only enclose editor binary in quotes if legal and
162 necessary (space in the name, and is an existing file). Fixes a bug
177 necessary (space in the name, and is an existing file). Fixes a bug
163 reported by Zachary Pincus.
178 reported by Zachary Pincus.
164
179
165 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
180 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
166
181
167 * Manual: thanks to a tip on proper color handling for Emacs, by
182 * Manual: thanks to a tip on proper color handling for Emacs, by
168 Eric J Haywiser <ejh1-AT-MIT.EDU>.
183 Eric J Haywiser <ejh1-AT-MIT.EDU>.
169
184
170 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
185 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
171 by applying the provided patch. Thanks to Liu Jin
186 by applying the provided patch. Thanks to Liu Jin
172 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
187 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
173 XEmacs/Linux, I'm trusting the submitter that it actually helps
188 XEmacs/Linux, I'm trusting the submitter that it actually helps
174 under win32/GNU Emacs. Will revisit if any problems are reported.
189 under win32/GNU Emacs. Will revisit if any problems are reported.
175
190
176 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
191 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
177
192
178 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
193 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
179 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
194 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
180
195
181 2006-03-12 Ville Vainio <vivainio@gmail.com>
196 2006-03-12 Ville Vainio <vivainio@gmail.com>
182
197
183 * Magic.py (magic_timeit): Added %timeit magic, contributed by
198 * Magic.py (magic_timeit): Added %timeit magic, contributed by
184 Torsten Marek.
199 Torsten Marek.
185
200
186 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
201 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
187
202
188 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
203 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
189 line ranges works again.
204 line ranges works again.
190
205
191 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
206 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
192
207
193 * IPython/iplib.py (showtraceback): add back sys.last_traceback
208 * IPython/iplib.py (showtraceback): add back sys.last_traceback
194 and friends, after a discussion with Zach Pincus on ipython-user.
209 and friends, after a discussion with Zach Pincus on ipython-user.
195 I'm not 100% sure, but after thinking aobut it quite a bit, it may
210 I'm not 100% sure, but after thinking aobut it quite a bit, it may
196 be OK. Testing with the multithreaded shells didn't reveal any
211 be OK. Testing with the multithreaded shells didn't reveal any
197 problems, but let's keep an eye out.
212 problems, but let's keep an eye out.
198
213
199 In the process, I fixed a few things which were calling
214 In the process, I fixed a few things which were calling
200 self.InteractiveTB() directly (like safe_execfile), which is a
215 self.InteractiveTB() directly (like safe_execfile), which is a
201 mistake: ALL exception reporting should be done by calling
216 mistake: ALL exception reporting should be done by calling
202 self.showtraceback(), which handles state and tab-completion and
217 self.showtraceback(), which handles state and tab-completion and
203 more.
218 more.
204
219
205 2006-03-01 Ville Vainio <vivainio@gmail.com>
220 2006-03-01 Ville Vainio <vivainio@gmail.com>
206
221
207 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
222 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
208 To use, do "from ipipe import *".
223 To use, do "from ipipe import *".
209
224
210 2006-02-24 Ville Vainio <vivainio@gmail.com>
225 2006-02-24 Ville Vainio <vivainio@gmail.com>
211
226
212 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
227 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
213 "cleanly" and safely than the older upgrade mechanism.
228 "cleanly" and safely than the older upgrade mechanism.
214
229
215 2006-02-21 Ville Vainio <vivainio@gmail.com>
230 2006-02-21 Ville Vainio <vivainio@gmail.com>
216
231
217 * Magic.py: %save works again.
232 * Magic.py: %save works again.
218
233
219 2006-02-15 Ville Vainio <vivainio@gmail.com>
234 2006-02-15 Ville Vainio <vivainio@gmail.com>
220
235
221 * Magic.py: %Pprint works again
236 * Magic.py: %Pprint works again
222
237
223 * Extensions/ipy_sane_defaults.py: Provide everything provided
238 * Extensions/ipy_sane_defaults.py: Provide everything provided
224 in default ipythonrc, to make it possible to have a completely empty
239 in default ipythonrc, to make it possible to have a completely empty
225 ipythonrc (and thus completely rc-file free configuration)
240 ipythonrc (and thus completely rc-file free configuration)
226
241
227
242
228 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
243 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
229
244
230 * IPython/hooks.py (editor): quote the call to the editor command,
245 * IPython/hooks.py (editor): quote the call to the editor command,
231 to allow commands with spaces in them. Problem noted by watching
246 to allow commands with spaces in them. Problem noted by watching
232 Ian Oswald's video about textpad under win32 at
247 Ian Oswald's video about textpad under win32 at
233 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
248 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
234
249
235 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
250 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
236 describing magics (we haven't used @ for a loong time).
251 describing magics (we haven't used @ for a loong time).
237
252
238 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
253 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
239 contributed by marienz to close
254 contributed by marienz to close
240 http://www.scipy.net/roundup/ipython/issue53.
255 http://www.scipy.net/roundup/ipython/issue53.
241
256
242 2006-02-10 Ville Vainio <vivainio@gmail.com>
257 2006-02-10 Ville Vainio <vivainio@gmail.com>
243
258
244 * genutils.py: getoutput now works in win32 too
259 * genutils.py: getoutput now works in win32 too
245
260
246 * completer.py: alias and magic completion only invoked
261 * completer.py: alias and magic completion only invoked
247 at the first "item" in the line, to avoid "cd %store"
262 at the first "item" in the line, to avoid "cd %store"
248 nonsense.
263 nonsense.
249
264
250 2006-02-09 Ville Vainio <vivainio@gmail.com>
265 2006-02-09 Ville Vainio <vivainio@gmail.com>
251
266
252 * test/*: Added a unit testing framework (finally).
267 * test/*: Added a unit testing framework (finally).
253 '%run runtests.py' to run test_*.
268 '%run runtests.py' to run test_*.
254
269
255 * ipapi.py: Exposed runlines and set_custom_exc
270 * ipapi.py: Exposed runlines and set_custom_exc
256
271
257 2006-02-07 Ville Vainio <vivainio@gmail.com>
272 2006-02-07 Ville Vainio <vivainio@gmail.com>
258
273
259 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
274 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
260 instead use "f(1 2)" as before.
275 instead use "f(1 2)" as before.
261
276
262 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
277 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
263
278
264 * IPython/demo.py (IPythonDemo): Add new classes to the demo
279 * IPython/demo.py (IPythonDemo): Add new classes to the demo
265 facilities, for demos processed by the IPython input filter
280 facilities, for demos processed by the IPython input filter
266 (IPythonDemo), and for running a script one-line-at-a-time as a
281 (IPythonDemo), and for running a script one-line-at-a-time as a
267 demo, both for pure Python (LineDemo) and for IPython-processed
282 demo, both for pure Python (LineDemo) and for IPython-processed
268 input (IPythonLineDemo). After a request by Dave Kohel, from the
283 input (IPythonLineDemo). After a request by Dave Kohel, from the
269 SAGE team.
284 SAGE team.
270 (Demo.edit): added and edit() method to the demo objects, to edit
285 (Demo.edit): added and edit() method to the demo objects, to edit
271 the in-memory copy of the last executed block.
286 the in-memory copy of the last executed block.
272
287
273 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
288 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
274 processing to %edit, %macro and %save. These commands can now be
289 processing to %edit, %macro and %save. These commands can now be
275 invoked on the unprocessed input as it was typed by the user
290 invoked on the unprocessed input as it was typed by the user
276 (without any prefilters applied). After requests by the SAGE team
291 (without any prefilters applied). After requests by the SAGE team
277 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
292 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
278
293
279 2006-02-01 Ville Vainio <vivainio@gmail.com>
294 2006-02-01 Ville Vainio <vivainio@gmail.com>
280
295
281 * setup.py, eggsetup.py: easy_install ipython==dev works
296 * setup.py, eggsetup.py: easy_install ipython==dev works
282 correctly now (on Linux)
297 correctly now (on Linux)
283
298
284 * ipy_user_conf,ipmaker: user config changes, removed spurious
299 * ipy_user_conf,ipmaker: user config changes, removed spurious
285 warnings
300 warnings
286
301
287 * iplib: if rc.banner is string, use it as is.
302 * iplib: if rc.banner is string, use it as is.
288
303
289 * Magic: %pycat accepts a string argument and pages it's contents.
304 * Magic: %pycat accepts a string argument and pages it's contents.
290
305
291
306
292 2006-01-30 Ville Vainio <vivainio@gmail.com>
307 2006-01-30 Ville Vainio <vivainio@gmail.com>
293
308
294 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
309 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
295 Now %store and bookmarks work through PickleShare, meaning that
310 Now %store and bookmarks work through PickleShare, meaning that
296 concurrent access is possible and all ipython sessions see the
311 concurrent access is possible and all ipython sessions see the
297 same database situation all the time, instead of snapshot of
312 same database situation all the time, instead of snapshot of
298 the situation when the session was started. Hence, %bookmark
313 the situation when the session was started. Hence, %bookmark
299 results are immediately accessible from othes sessions. The database
314 results are immediately accessible from othes sessions. The database
300 is also available for use by user extensions. See:
315 is also available for use by user extensions. See:
301 http://www.python.org/pypi/pickleshare
316 http://www.python.org/pypi/pickleshare
302
317
303 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
318 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
304
319
305 * aliases can now be %store'd
320 * aliases can now be %store'd
306
321
307 * path.py move to Extensions so that pickleshare does not need
322 * path.py move to Extensions so that pickleshare does not need
308 IPython-specific import. Extensions added to pythonpath right
323 IPython-specific import. Extensions added to pythonpath right
309 at __init__.
324 at __init__.
310
325
311 * iplib.py: ipalias deprecated/redundant; aliases are converted and
326 * iplib.py: ipalias deprecated/redundant; aliases are converted and
312 called with _ip.system and the pre-transformed command string.
327 called with _ip.system and the pre-transformed command string.
313
328
314 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
329 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
315
330
316 * IPython/iplib.py (interact): Fix that we were not catching
331 * IPython/iplib.py (interact): Fix that we were not catching
317 KeyboardInterrupt exceptions properly. I'm not quite sure why the
332 KeyboardInterrupt exceptions properly. I'm not quite sure why the
318 logic here had to change, but it's fixed now.
333 logic here had to change, but it's fixed now.
319
334
320 2006-01-29 Ville Vainio <vivainio@gmail.com>
335 2006-01-29 Ville Vainio <vivainio@gmail.com>
321
336
322 * iplib.py: Try to import pyreadline on Windows.
337 * iplib.py: Try to import pyreadline on Windows.
323
338
324 2006-01-27 Ville Vainio <vivainio@gmail.com>
339 2006-01-27 Ville Vainio <vivainio@gmail.com>
325
340
326 * iplib.py: Expose ipapi as _ip in builtin namespace.
341 * iplib.py: Expose ipapi as _ip in builtin namespace.
327 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
342 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
328 and ip_set_hook (-> _ip.set_hook) redundant. % and !
343 and ip_set_hook (-> _ip.set_hook) redundant. % and !
329 syntax now produce _ip.* variant of the commands.
344 syntax now produce _ip.* variant of the commands.
330
345
331 * "_ip.options().autoedit_syntax = 2" automatically throws
346 * "_ip.options().autoedit_syntax = 2" automatically throws
332 user to editor for syntax error correction without prompting.
347 user to editor for syntax error correction without prompting.
333
348
334 2006-01-27 Ville Vainio <vivainio@gmail.com>
349 2006-01-27 Ville Vainio <vivainio@gmail.com>
335
350
336 * ipmaker.py: Give "realistic" sys.argv for scripts (without
351 * ipmaker.py: Give "realistic" sys.argv for scripts (without
337 'ipython' at argv[0]) executed through command line.
352 'ipython' at argv[0]) executed through command line.
338 NOTE: this DEPRECATES calling ipython with multiple scripts
353 NOTE: this DEPRECATES calling ipython with multiple scripts
339 ("ipython a.py b.py c.py")
354 ("ipython a.py b.py c.py")
340
355
341 * iplib.py, hooks.py: Added configurable input prefilter,
356 * iplib.py, hooks.py: Added configurable input prefilter,
342 named 'input_prefilter'. See ext_rescapture.py for example
357 named 'input_prefilter'. See ext_rescapture.py for example
343 usage.
358 usage.
344
359
345 * ext_rescapture.py, Magic.py: Better system command output capture
360 * ext_rescapture.py, Magic.py: Better system command output capture
346 through 'var = !ls' (deprecates user-visible %sc). Same notation
361 through 'var = !ls' (deprecates user-visible %sc). Same notation
347 applies for magics, 'var = %alias' assigns alias list to var.
362 applies for magics, 'var = %alias' assigns alias list to var.
348
363
349 * ipapi.py: added meta() for accessing extension-usable data store.
364 * ipapi.py: added meta() for accessing extension-usable data store.
350
365
351 * iplib.py: added InteractiveShell.getapi(). New magics should be
366 * iplib.py: added InteractiveShell.getapi(). New magics should be
352 written doing self.getapi() instead of using the shell directly.
367 written doing self.getapi() instead of using the shell directly.
353
368
354 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
369 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
355 %store foo >> ~/myfoo.txt to store variables to files (in clean
370 %store foo >> ~/myfoo.txt to store variables to files (in clean
356 textual form, not a restorable pickle).
371 textual form, not a restorable pickle).
357
372
358 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
373 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
359
374
360 * usage.py, Magic.py: added %quickref
375 * usage.py, Magic.py: added %quickref
361
376
362 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
377 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
363
378
364 * GetoptErrors when invoking magics etc. with wrong args
379 * GetoptErrors when invoking magics etc. with wrong args
365 are now more helpful:
380 are now more helpful:
366 GetoptError: option -l not recognized (allowed: "qb" )
381 GetoptError: option -l not recognized (allowed: "qb" )
367
382
368 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
383 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
369
384
370 * IPython/demo.py (Demo.show): Flush stdout after each block, so
385 * IPython/demo.py (Demo.show): Flush stdout after each block, so
371 computationally intensive blocks don't appear to stall the demo.
386 computationally intensive blocks don't appear to stall the demo.
372
387
373 2006-01-24 Ville Vainio <vivainio@gmail.com>
388 2006-01-24 Ville Vainio <vivainio@gmail.com>
374
389
375 * iplib.py, hooks.py: 'result_display' hook can return a non-None
390 * iplib.py, hooks.py: 'result_display' hook can return a non-None
376 value to manipulate resulting history entry.
391 value to manipulate resulting history entry.
377
392
378 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
393 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
379 to instance methods of IPApi class, to make extending an embedded
394 to instance methods of IPApi class, to make extending an embedded
380 IPython feasible. See ext_rehashdir.py for example usage.
395 IPython feasible. See ext_rehashdir.py for example usage.
381
396
382 * Merged 1071-1076 from banches/0.7.1
397 * Merged 1071-1076 from banches/0.7.1
383
398
384
399
385 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
400 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
386
401
387 * tools/release (daystamp): Fix build tools to use the new
402 * tools/release (daystamp): Fix build tools to use the new
388 eggsetup.py script to build lightweight eggs.
403 eggsetup.py script to build lightweight eggs.
389
404
390 * Applied changesets 1062 and 1064 before 0.7.1 release.
405 * Applied changesets 1062 and 1064 before 0.7.1 release.
391
406
392 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
407 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
393 see the raw input history (without conversions like %ls ->
408 see the raw input history (without conversions like %ls ->
394 ipmagic("ls")). After a request from W. Stein, SAGE
409 ipmagic("ls")). After a request from W. Stein, SAGE
395 (http://modular.ucsd.edu/sage) developer. This information is
410 (http://modular.ucsd.edu/sage) developer. This information is
396 stored in the input_hist_raw attribute of the IPython instance, so
411 stored in the input_hist_raw attribute of the IPython instance, so
397 developers can access it if needed (it's an InputList instance).
412 developers can access it if needed (it's an InputList instance).
398
413
399 * Versionstring = 0.7.2.svn
414 * Versionstring = 0.7.2.svn
400
415
401 * eggsetup.py: A separate script for constructing eggs, creates
416 * eggsetup.py: A separate script for constructing eggs, creates
402 proper launch scripts even on Windows (an .exe file in
417 proper launch scripts even on Windows (an .exe file in
403 \python24\scripts).
418 \python24\scripts).
404
419
405 * ipapi.py: launch_new_instance, launch entry point needed for the
420 * ipapi.py: launch_new_instance, launch entry point needed for the
406 egg.
421 egg.
407
422
408 2006-01-23 Ville Vainio <vivainio@gmail.com>
423 2006-01-23 Ville Vainio <vivainio@gmail.com>
409
424
410 * Added %cpaste magic for pasting python code
425 * Added %cpaste magic for pasting python code
411
426
412 2006-01-22 Ville Vainio <vivainio@gmail.com>
427 2006-01-22 Ville Vainio <vivainio@gmail.com>
413
428
414 * Merge from branches/0.7.1 into trunk, revs 1052-1057
429 * Merge from branches/0.7.1 into trunk, revs 1052-1057
415
430
416 * Versionstring = 0.7.2.svn
431 * Versionstring = 0.7.2.svn
417
432
418 * eggsetup.py: A separate script for constructing eggs, creates
433 * eggsetup.py: A separate script for constructing eggs, creates
419 proper launch scripts even on Windows (an .exe file in
434 proper launch scripts even on Windows (an .exe file in
420 \python24\scripts).
435 \python24\scripts).
421
436
422 * ipapi.py: launch_new_instance, launch entry point needed for the
437 * ipapi.py: launch_new_instance, launch entry point needed for the
423 egg.
438 egg.
424
439
425 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
440 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
426
441
427 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
442 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
428 %pfile foo would print the file for foo even if it was a binary.
443 %pfile foo would print the file for foo even if it was a binary.
429 Now, extensions '.so' and '.dll' are skipped.
444 Now, extensions '.so' and '.dll' are skipped.
430
445
431 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
446 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
432 bug, where macros would fail in all threaded modes. I'm not 100%
447 bug, where macros would fail in all threaded modes. I'm not 100%
433 sure, so I'm going to put out an rc instead of making a release
448 sure, so I'm going to put out an rc instead of making a release
434 today, and wait for feedback for at least a few days.
449 today, and wait for feedback for at least a few days.
435
450
436 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
451 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
437 it...) the handling of pasting external code with autoindent on.
452 it...) the handling of pasting external code with autoindent on.
438 To get out of a multiline input, the rule will appear for most
453 To get out of a multiline input, the rule will appear for most
439 users unchanged: two blank lines or change the indent level
454 users unchanged: two blank lines or change the indent level
440 proposed by IPython. But there is a twist now: you can
455 proposed by IPython. But there is a twist now: you can
441 add/subtract only *one or two spaces*. If you add/subtract three
456 add/subtract only *one or two spaces*. If you add/subtract three
442 or more (unless you completely delete the line), IPython will
457 or more (unless you completely delete the line), IPython will
443 accept that line, and you'll need to enter a second one of pure
458 accept that line, and you'll need to enter a second one of pure
444 whitespace. I know it sounds complicated, but I can't find a
459 whitespace. I know it sounds complicated, but I can't find a
445 different solution that covers all the cases, with the right
460 different solution that covers all the cases, with the right
446 heuristics. Hopefully in actual use, nobody will really notice
461 heuristics. Hopefully in actual use, nobody will really notice
447 all these strange rules and things will 'just work'.
462 all these strange rules and things will 'just work'.
448
463
449 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
464 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
450
465
451 * IPython/iplib.py (interact): catch exceptions which can be
466 * IPython/iplib.py (interact): catch exceptions which can be
452 triggered asynchronously by signal handlers. Thanks to an
467 triggered asynchronously by signal handlers. Thanks to an
453 automatic crash report, submitted by Colin Kingsley
468 automatic crash report, submitted by Colin Kingsley
454 <tercel-AT-gentoo.org>.
469 <tercel-AT-gentoo.org>.
455
470
456 2006-01-20 Ville Vainio <vivainio@gmail.com>
471 2006-01-20 Ville Vainio <vivainio@gmail.com>
457
472
458 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
473 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
459 (%rehashdir, very useful, try it out) of how to extend ipython
474 (%rehashdir, very useful, try it out) of how to extend ipython
460 with new magics. Also added Extensions dir to pythonpath to make
475 with new magics. Also added Extensions dir to pythonpath to make
461 importing extensions easy.
476 importing extensions easy.
462
477
463 * %store now complains when trying to store interactively declared
478 * %store now complains when trying to store interactively declared
464 classes / instances of those classes.
479 classes / instances of those classes.
465
480
466 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
481 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
467 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
482 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
468 if they exist, and ipy_user_conf.py with some defaults is created for
483 if they exist, and ipy_user_conf.py with some defaults is created for
469 the user.
484 the user.
470
485
471 * Startup rehashing done by the config file, not InterpreterExec.
486 * Startup rehashing done by the config file, not InterpreterExec.
472 This means system commands are available even without selecting the
487 This means system commands are available even without selecting the
473 pysh profile. It's the sensible default after all.
488 pysh profile. It's the sensible default after all.
474
489
475 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
490 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
476
491
477 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
492 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
478 multiline code with autoindent on working. But I am really not
493 multiline code with autoindent on working. But I am really not
479 sure, so this needs more testing. Will commit a debug-enabled
494 sure, so this needs more testing. Will commit a debug-enabled
480 version for now, while I test it some more, so that Ville and
495 version for now, while I test it some more, so that Ville and
481 others may also catch any problems. Also made
496 others may also catch any problems. Also made
482 self.indent_current_str() a method, to ensure that there's no
497 self.indent_current_str() a method, to ensure that there's no
483 chance of the indent space count and the corresponding string
498 chance of the indent space count and the corresponding string
484 falling out of sync. All code needing the string should just call
499 falling out of sync. All code needing the string should just call
485 the method.
500 the method.
486
501
487 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
502 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
488
503
489 * IPython/Magic.py (magic_edit): fix check for when users don't
504 * IPython/Magic.py (magic_edit): fix check for when users don't
490 save their output files, the try/except was in the wrong section.
505 save their output files, the try/except was in the wrong section.
491
506
492 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
507 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
493
508
494 * IPython/Magic.py (magic_run): fix __file__ global missing from
509 * IPython/Magic.py (magic_run): fix __file__ global missing from
495 script's namespace when executed via %run. After a report by
510 script's namespace when executed via %run. After a report by
496 Vivian.
511 Vivian.
497
512
498 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
513 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
499 when using python 2.4. The parent constructor changed in 2.4, and
514 when using python 2.4. The parent constructor changed in 2.4, and
500 we need to track it directly (we can't call it, as it messes up
515 we need to track it directly (we can't call it, as it messes up
501 readline and tab-completion inside our pdb would stop working).
516 readline and tab-completion inside our pdb would stop working).
502 After a bug report by R. Bernstein <rocky-AT-panix.com>.
517 After a bug report by R. Bernstein <rocky-AT-panix.com>.
503
518
504 2006-01-16 Ville Vainio <vivainio@gmail.com>
519 2006-01-16 Ville Vainio <vivainio@gmail.com>
505
520
506 * Ipython/magic.py:Reverted back to old %edit functionality
521 * Ipython/magic.py:Reverted back to old %edit functionality
507 that returns file contents on exit.
522 that returns file contents on exit.
508
523
509 * IPython/path.py: Added Jason Orendorff's "path" module to
524 * IPython/path.py: Added Jason Orendorff's "path" module to
510 IPython tree, http://www.jorendorff.com/articles/python/path/.
525 IPython tree, http://www.jorendorff.com/articles/python/path/.
511 You can get path objects conveniently through %sc, and !!, e.g.:
526 You can get path objects conveniently through %sc, and !!, e.g.:
512 sc files=ls
527 sc files=ls
513 for p in files.paths: # or files.p
528 for p in files.paths: # or files.p
514 print p,p.mtime
529 print p,p.mtime
515
530
516 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
531 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
517 now work again without considering the exclusion regexp -
532 now work again without considering the exclusion regexp -
518 hence, things like ',foo my/path' turn to 'foo("my/path")'
533 hence, things like ',foo my/path' turn to 'foo("my/path")'
519 instead of syntax error.
534 instead of syntax error.
520
535
521
536
522 2006-01-14 Ville Vainio <vivainio@gmail.com>
537 2006-01-14 Ville Vainio <vivainio@gmail.com>
523
538
524 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
539 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
525 ipapi decorators for python 2.4 users, options() provides access to rc
540 ipapi decorators for python 2.4 users, options() provides access to rc
526 data.
541 data.
527
542
528 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
543 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
529 as path separators (even on Linux ;-). Space character after
544 as path separators (even on Linux ;-). Space character after
530 backslash (as yielded by tab completer) is still space;
545 backslash (as yielded by tab completer) is still space;
531 "%cd long\ name" works as expected.
546 "%cd long\ name" works as expected.
532
547
533 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
548 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
534 as "chain of command", with priority. API stays the same,
549 as "chain of command", with priority. API stays the same,
535 TryNext exception raised by a hook function signals that
550 TryNext exception raised by a hook function signals that
536 current hook failed and next hook should try handling it, as
551 current hook failed and next hook should try handling it, as
537 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
552 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
538 requested configurable display hook, which is now implemented.
553 requested configurable display hook, which is now implemented.
539
554
540 2006-01-13 Ville Vainio <vivainio@gmail.com>
555 2006-01-13 Ville Vainio <vivainio@gmail.com>
541
556
542 * IPython/platutils*.py: platform specific utility functions,
557 * IPython/platutils*.py: platform specific utility functions,
543 so far only set_term_title is implemented (change terminal
558 so far only set_term_title is implemented (change terminal
544 label in windowing systems). %cd now changes the title to
559 label in windowing systems). %cd now changes the title to
545 current dir.
560 current dir.
546
561
547 * IPython/Release.py: Added myself to "authors" list,
562 * IPython/Release.py: Added myself to "authors" list,
548 had to create new files.
563 had to create new files.
549
564
550 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
565 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
551 shell escape; not a known bug but had potential to be one in the
566 shell escape; not a known bug but had potential to be one in the
552 future.
567 future.
553
568
554 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
569 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
555 extension API for IPython! See the module for usage example. Fix
570 extension API for IPython! See the module for usage example. Fix
556 OInspect for docstring-less magic functions.
571 OInspect for docstring-less magic functions.
557
572
558
573
559 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
574 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
560
575
561 * IPython/iplib.py (raw_input): temporarily deactivate all
576 * IPython/iplib.py (raw_input): temporarily deactivate all
562 attempts at allowing pasting of code with autoindent on. It
577 attempts at allowing pasting of code with autoindent on. It
563 introduced bugs (reported by Prabhu) and I can't seem to find a
578 introduced bugs (reported by Prabhu) and I can't seem to find a
564 robust combination which works in all cases. Will have to revisit
579 robust combination which works in all cases. Will have to revisit
565 later.
580 later.
566
581
567 * IPython/genutils.py: remove isspace() function. We've dropped
582 * IPython/genutils.py: remove isspace() function. We've dropped
568 2.2 compatibility, so it's OK to use the string method.
583 2.2 compatibility, so it's OK to use the string method.
569
584
570 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
585 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
571
586
572 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
587 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
573 matching what NOT to autocall on, to include all python binary
588 matching what NOT to autocall on, to include all python binary
574 operators (including things like 'and', 'or', 'is' and 'in').
589 operators (including things like 'and', 'or', 'is' and 'in').
575 Prompted by a bug report on 'foo & bar', but I realized we had
590 Prompted by a bug report on 'foo & bar', but I realized we had
576 many more potential bug cases with other operators. The regexp is
591 many more potential bug cases with other operators. The regexp is
577 self.re_exclude_auto, it's fairly commented.
592 self.re_exclude_auto, it's fairly commented.
578
593
579 2006-01-12 Ville Vainio <vivainio@gmail.com>
594 2006-01-12 Ville Vainio <vivainio@gmail.com>
580
595
581 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
596 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
582 Prettified and hardened string/backslash quoting with ipsystem(),
597 Prettified and hardened string/backslash quoting with ipsystem(),
583 ipalias() and ipmagic(). Now even \ characters are passed to
598 ipalias() and ipmagic(). Now even \ characters are passed to
584 %magics, !shell escapes and aliases exactly as they are in the
599 %magics, !shell escapes and aliases exactly as they are in the
585 ipython command line. Should improve backslash experience,
600 ipython command line. Should improve backslash experience,
586 particularly in Windows (path delimiter for some commands that
601 particularly in Windows (path delimiter for some commands that
587 won't understand '/'), but Unix benefits as well (regexps). %cd
602 won't understand '/'), but Unix benefits as well (regexps). %cd
588 magic still doesn't support backslash path delimiters, though. Also
603 magic still doesn't support backslash path delimiters, though. Also
589 deleted all pretense of supporting multiline command strings in
604 deleted all pretense of supporting multiline command strings in
590 !system or %magic commands. Thanks to Jerry McRae for suggestions.
605 !system or %magic commands. Thanks to Jerry McRae for suggestions.
591
606
592 * doc/build_doc_instructions.txt added. Documentation on how to
607 * doc/build_doc_instructions.txt added. Documentation on how to
593 use doc/update_manual.py, added yesterday. Both files contributed
608 use doc/update_manual.py, added yesterday. Both files contributed
594 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
609 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
595 doc/*.sh for deprecation at a later date.
610 doc/*.sh for deprecation at a later date.
596
611
597 * /ipython.py Added ipython.py to root directory for
612 * /ipython.py Added ipython.py to root directory for
598 zero-installation (tar xzvf ipython.tgz; cd ipython; python
613 zero-installation (tar xzvf ipython.tgz; cd ipython; python
599 ipython.py) and development convenience (no need to kee doing
614 ipython.py) and development convenience (no need to kee doing
600 "setup.py install" between changes).
615 "setup.py install" between changes).
601
616
602 * Made ! and !! shell escapes work (again) in multiline expressions:
617 * Made ! and !! shell escapes work (again) in multiline expressions:
603 if 1:
618 if 1:
604 !ls
619 !ls
605 !!ls
620 !!ls
606
621
607 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
622 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
608
623
609 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
624 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
610 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
625 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
611 module in case-insensitive installation. Was causing crashes
626 module in case-insensitive installation. Was causing crashes
612 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
627 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
613
628
614 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
629 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
615 <marienz-AT-gentoo.org>, closes
630 <marienz-AT-gentoo.org>, closes
616 http://www.scipy.net/roundup/ipython/issue51.
631 http://www.scipy.net/roundup/ipython/issue51.
617
632
618 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
633 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
619
634
620 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
635 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
621 problem of excessive CPU usage under *nix and keyboard lag under
636 problem of excessive CPU usage under *nix and keyboard lag under
622 win32.
637 win32.
623
638
624 2006-01-10 *** Released version 0.7.0
639 2006-01-10 *** Released version 0.7.0
625
640
626 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
641 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
627
642
628 * IPython/Release.py (revision): tag version number to 0.7.0,
643 * IPython/Release.py (revision): tag version number to 0.7.0,
629 ready for release.
644 ready for release.
630
645
631 * IPython/Magic.py (magic_edit): Add print statement to %edit so
646 * IPython/Magic.py (magic_edit): Add print statement to %edit so
632 it informs the user of the name of the temp. file used. This can
647 it informs the user of the name of the temp. file used. This can
633 help if you decide later to reuse that same file, so you know
648 help if you decide later to reuse that same file, so you know
634 where to copy the info from.
649 where to copy the info from.
635
650
636 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
651 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
637
652
638 * setup_bdist_egg.py: little script to build an egg. Added
653 * setup_bdist_egg.py: little script to build an egg. Added
639 support in the release tools as well.
654 support in the release tools as well.
640
655
641 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
656 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
642
657
643 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
658 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
644 version selection (new -wxversion command line and ipythonrc
659 version selection (new -wxversion command line and ipythonrc
645 parameter). Patch contributed by Arnd Baecker
660 parameter). Patch contributed by Arnd Baecker
646 <arnd.baecker-AT-web.de>.
661 <arnd.baecker-AT-web.de>.
647
662
648 * IPython/iplib.py (embed_mainloop): fix tab-completion in
663 * IPython/iplib.py (embed_mainloop): fix tab-completion in
649 embedded instances, for variables defined at the interactive
664 embedded instances, for variables defined at the interactive
650 prompt of the embedded ipython. Reported by Arnd.
665 prompt of the embedded ipython. Reported by Arnd.
651
666
652 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
667 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
653 it can be used as a (stateful) toggle, or with a direct parameter.
668 it can be used as a (stateful) toggle, or with a direct parameter.
654
669
655 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
670 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
656 could be triggered in certain cases and cause the traceback
671 could be triggered in certain cases and cause the traceback
657 printer not to work.
672 printer not to work.
658
673
659 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
674 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
660
675
661 * IPython/iplib.py (_should_recompile): Small fix, closes
676 * IPython/iplib.py (_should_recompile): Small fix, closes
662 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
677 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
663
678
664 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
679 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
665
680
666 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
681 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
667 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
682 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
668 Moad for help with tracking it down.
683 Moad for help with tracking it down.
669
684
670 * IPython/iplib.py (handle_auto): fix autocall handling for
685 * IPython/iplib.py (handle_auto): fix autocall handling for
671 objects which support BOTH __getitem__ and __call__ (so that f [x]
686 objects which support BOTH __getitem__ and __call__ (so that f [x]
672 is left alone, instead of becoming f([x]) automatically).
687 is left alone, instead of becoming f([x]) automatically).
673
688
674 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
689 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
675 Ville's patch.
690 Ville's patch.
676
691
677 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
692 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
678
693
679 * IPython/iplib.py (handle_auto): changed autocall semantics to
694 * IPython/iplib.py (handle_auto): changed autocall semantics to
680 include 'smart' mode, where the autocall transformation is NOT
695 include 'smart' mode, where the autocall transformation is NOT
681 applied if there are no arguments on the line. This allows you to
696 applied if there are no arguments on the line. This allows you to
682 just type 'foo' if foo is a callable to see its internal form,
697 just type 'foo' if foo is a callable to see its internal form,
683 instead of having it called with no arguments (typically a
698 instead of having it called with no arguments (typically a
684 mistake). The old 'full' autocall still exists: for that, you
699 mistake). The old 'full' autocall still exists: for that, you
685 need to set the 'autocall' parameter to 2 in your ipythonrc file.
700 need to set the 'autocall' parameter to 2 in your ipythonrc file.
686
701
687 * IPython/completer.py (Completer.attr_matches): add
702 * IPython/completer.py (Completer.attr_matches): add
688 tab-completion support for Enthoughts' traits. After a report by
703 tab-completion support for Enthoughts' traits. After a report by
689 Arnd and a patch by Prabhu.
704 Arnd and a patch by Prabhu.
690
705
691 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
706 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
692
707
693 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
708 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
694 Schmolck's patch to fix inspect.getinnerframes().
709 Schmolck's patch to fix inspect.getinnerframes().
695
710
696 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
711 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
697 for embedded instances, regarding handling of namespaces and items
712 for embedded instances, regarding handling of namespaces and items
698 added to the __builtin__ one. Multiple embedded instances and
713 added to the __builtin__ one. Multiple embedded instances and
699 recursive embeddings should work better now (though I'm not sure
714 recursive embeddings should work better now (though I'm not sure
700 I've got all the corner cases fixed, that code is a bit of a brain
715 I've got all the corner cases fixed, that code is a bit of a brain
701 twister).
716 twister).
702
717
703 * IPython/Magic.py (magic_edit): added support to edit in-memory
718 * IPython/Magic.py (magic_edit): added support to edit in-memory
704 macros (automatically creates the necessary temp files). %edit
719 macros (automatically creates the necessary temp files). %edit
705 also doesn't return the file contents anymore, it's just noise.
720 also doesn't return the file contents anymore, it's just noise.
706
721
707 * IPython/completer.py (Completer.attr_matches): revert change to
722 * IPython/completer.py (Completer.attr_matches): revert change to
708 complete only on attributes listed in __all__. I realized it
723 complete only on attributes listed in __all__. I realized it
709 cripples the tab-completion system as a tool for exploring the
724 cripples the tab-completion system as a tool for exploring the
710 internals of unknown libraries (it renders any non-__all__
725 internals of unknown libraries (it renders any non-__all__
711 attribute off-limits). I got bit by this when trying to see
726 attribute off-limits). I got bit by this when trying to see
712 something inside the dis module.
727 something inside the dis module.
713
728
714 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
729 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
715
730
716 * IPython/iplib.py (InteractiveShell.__init__): add .meta
731 * IPython/iplib.py (InteractiveShell.__init__): add .meta
717 namespace for users and extension writers to hold data in. This
732 namespace for users and extension writers to hold data in. This
718 follows the discussion in
733 follows the discussion in
719 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
734 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
720
735
721 * IPython/completer.py (IPCompleter.complete): small patch to help
736 * IPython/completer.py (IPCompleter.complete): small patch to help
722 tab-completion under Emacs, after a suggestion by John Barnard
737 tab-completion under Emacs, after a suggestion by John Barnard
723 <barnarj-AT-ccf.org>.
738 <barnarj-AT-ccf.org>.
724
739
725 * IPython/Magic.py (Magic.extract_input_slices): added support for
740 * IPython/Magic.py (Magic.extract_input_slices): added support for
726 the slice notation in magics to use N-M to represent numbers N...M
741 the slice notation in magics to use N-M to represent numbers N...M
727 (closed endpoints). This is used by %macro and %save.
742 (closed endpoints). This is used by %macro and %save.
728
743
729 * IPython/completer.py (Completer.attr_matches): for modules which
744 * IPython/completer.py (Completer.attr_matches): for modules which
730 define __all__, complete only on those. After a patch by Jeffrey
745 define __all__, complete only on those. After a patch by Jeffrey
731 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
746 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
732 speed up this routine.
747 speed up this routine.
733
748
734 * IPython/Logger.py (Logger.log): fix a history handling bug. I
749 * IPython/Logger.py (Logger.log): fix a history handling bug. I
735 don't know if this is the end of it, but the behavior now is
750 don't know if this is the end of it, but the behavior now is
736 certainly much more correct. Note that coupled with macros,
751 certainly much more correct. Note that coupled with macros,
737 slightly surprising (at first) behavior may occur: a macro will in
752 slightly surprising (at first) behavior may occur: a macro will in
738 general expand to multiple lines of input, so upon exiting, the
753 general expand to multiple lines of input, so upon exiting, the
739 in/out counters will both be bumped by the corresponding amount
754 in/out counters will both be bumped by the corresponding amount
740 (as if the macro's contents had been typed interactively). Typing
755 (as if the macro's contents had been typed interactively). Typing
741 %hist will reveal the intermediate (silently processed) lines.
756 %hist will reveal the intermediate (silently processed) lines.
742
757
743 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
758 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
744 pickle to fail (%run was overwriting __main__ and not restoring
759 pickle to fail (%run was overwriting __main__ and not restoring
745 it, but pickle relies on __main__ to operate).
760 it, but pickle relies on __main__ to operate).
746
761
747 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
762 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
748 using properties, but forgot to make the main InteractiveShell
763 using properties, but forgot to make the main InteractiveShell
749 class a new-style class. Properties fail silently, and
764 class a new-style class. Properties fail silently, and
750 misteriously, with old-style class (getters work, but
765 misteriously, with old-style class (getters work, but
751 setters don't do anything).
766 setters don't do anything).
752
767
753 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
768 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
754
769
755 * IPython/Magic.py (magic_history): fix history reporting bug (I
770 * IPython/Magic.py (magic_history): fix history reporting bug (I
756 know some nasties are still there, I just can't seem to find a
771 know some nasties are still there, I just can't seem to find a
757 reproducible test case to track them down; the input history is
772 reproducible test case to track them down; the input history is
758 falling out of sync...)
773 falling out of sync...)
759
774
760 * IPython/iplib.py (handle_shell_escape): fix bug where both
775 * IPython/iplib.py (handle_shell_escape): fix bug where both
761 aliases and system accesses where broken for indented code (such
776 aliases and system accesses where broken for indented code (such
762 as loops).
777 as loops).
763
778
764 * IPython/genutils.py (shell): fix small but critical bug for
779 * IPython/genutils.py (shell): fix small but critical bug for
765 win32 system access.
780 win32 system access.
766
781
767 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
782 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
768
783
769 * IPython/iplib.py (showtraceback): remove use of the
784 * IPython/iplib.py (showtraceback): remove use of the
770 sys.last_{type/value/traceback} structures, which are non
785 sys.last_{type/value/traceback} structures, which are non
771 thread-safe.
786 thread-safe.
772 (_prefilter): change control flow to ensure that we NEVER
787 (_prefilter): change control flow to ensure that we NEVER
773 introspect objects when autocall is off. This will guarantee that
788 introspect objects when autocall is off. This will guarantee that
774 having an input line of the form 'x.y', where access to attribute
789 having an input line of the form 'x.y', where access to attribute
775 'y' has side effects, doesn't trigger the side effect TWICE. It
790 'y' has side effects, doesn't trigger the side effect TWICE. It
776 is important to note that, with autocall on, these side effects
791 is important to note that, with autocall on, these side effects
777 can still happen.
792 can still happen.
778 (ipsystem): new builtin, to complete the ip{magic/alias/system}
793 (ipsystem): new builtin, to complete the ip{magic/alias/system}
779 trio. IPython offers these three kinds of special calls which are
794 trio. IPython offers these three kinds of special calls which are
780 not python code, and it's a good thing to have their call method
795 not python code, and it's a good thing to have their call method
781 be accessible as pure python functions (not just special syntax at
796 be accessible as pure python functions (not just special syntax at
782 the command line). It gives us a better internal implementation
797 the command line). It gives us a better internal implementation
783 structure, as well as exposing these for user scripting more
798 structure, as well as exposing these for user scripting more
784 cleanly.
799 cleanly.
785
800
786 * IPython/macro.py (Macro.__init__): moved macros to a standalone
801 * IPython/macro.py (Macro.__init__): moved macros to a standalone
787 file. Now that they'll be more likely to be used with the
802 file. Now that they'll be more likely to be used with the
788 persistance system (%store), I want to make sure their module path
803 persistance system (%store), I want to make sure their module path
789 doesn't change in the future, so that we don't break things for
804 doesn't change in the future, so that we don't break things for
790 users' persisted data.
805 users' persisted data.
791
806
792 * IPython/iplib.py (autoindent_update): move indentation
807 * IPython/iplib.py (autoindent_update): move indentation
793 management into the _text_ processing loop, not the keyboard
808 management into the _text_ processing loop, not the keyboard
794 interactive one. This is necessary to correctly process non-typed
809 interactive one. This is necessary to correctly process non-typed
795 multiline input (such as macros).
810 multiline input (such as macros).
796
811
797 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
812 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
798 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
813 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
799 which was producing problems in the resulting manual.
814 which was producing problems in the resulting manual.
800 (magic_whos): improve reporting of instances (show their class,
815 (magic_whos): improve reporting of instances (show their class,
801 instead of simply printing 'instance' which isn't terribly
816 instead of simply printing 'instance' which isn't terribly
802 informative).
817 informative).
803
818
804 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
819 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
805 (minor mods) to support network shares under win32.
820 (minor mods) to support network shares under win32.
806
821
807 * IPython/winconsole.py (get_console_size): add new winconsole
822 * IPython/winconsole.py (get_console_size): add new winconsole
808 module and fixes to page_dumb() to improve its behavior under
823 module and fixes to page_dumb() to improve its behavior under
809 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
824 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
810
825
811 * IPython/Magic.py (Macro): simplified Macro class to just
826 * IPython/Magic.py (Macro): simplified Macro class to just
812 subclass list. We've had only 2.2 compatibility for a very long
827 subclass list. We've had only 2.2 compatibility for a very long
813 time, yet I was still avoiding subclassing the builtin types. No
828 time, yet I was still avoiding subclassing the builtin types. No
814 more (I'm also starting to use properties, though I won't shift to
829 more (I'm also starting to use properties, though I won't shift to
815 2.3-specific features quite yet).
830 2.3-specific features quite yet).
816 (magic_store): added Ville's patch for lightweight variable
831 (magic_store): added Ville's patch for lightweight variable
817 persistence, after a request on the user list by Matt Wilkie
832 persistence, after a request on the user list by Matt Wilkie
818 <maphew-AT-gmail.com>. The new %store magic's docstring has full
833 <maphew-AT-gmail.com>. The new %store magic's docstring has full
819 details.
834 details.
820
835
821 * IPython/iplib.py (InteractiveShell.post_config_initialization):
836 * IPython/iplib.py (InteractiveShell.post_config_initialization):
822 changed the default logfile name from 'ipython.log' to
837 changed the default logfile name from 'ipython.log' to
823 'ipython_log.py'. These logs are real python files, and now that
838 'ipython_log.py'. These logs are real python files, and now that
824 we have much better multiline support, people are more likely to
839 we have much better multiline support, people are more likely to
825 want to use them as such. Might as well name them correctly.
840 want to use them as such. Might as well name them correctly.
826
841
827 * IPython/Magic.py: substantial cleanup. While we can't stop
842 * IPython/Magic.py: substantial cleanup. While we can't stop
828 using magics as mixins, due to the existing customizations 'out
843 using magics as mixins, due to the existing customizations 'out
829 there' which rely on the mixin naming conventions, at least I
844 there' which rely on the mixin naming conventions, at least I
830 cleaned out all cross-class name usage. So once we are OK with
845 cleaned out all cross-class name usage. So once we are OK with
831 breaking compatibility, the two systems can be separated.
846 breaking compatibility, the two systems can be separated.
832
847
833 * IPython/Logger.py: major cleanup. This one is NOT a mixin
848 * IPython/Logger.py: major cleanup. This one is NOT a mixin
834 anymore, and the class is a fair bit less hideous as well. New
849 anymore, and the class is a fair bit less hideous as well. New
835 features were also introduced: timestamping of input, and logging
850 features were also introduced: timestamping of input, and logging
836 of output results. These are user-visible with the -t and -o
851 of output results. These are user-visible with the -t and -o
837 options to %logstart. Closes
852 options to %logstart. Closes
838 http://www.scipy.net/roundup/ipython/issue11 and a request by
853 http://www.scipy.net/roundup/ipython/issue11 and a request by
839 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
854 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
840
855
841 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
856 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
842
857
843 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
858 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
844 better hadnle backslashes in paths. See the thread 'More Windows
859 better hadnle backslashes in paths. See the thread 'More Windows
845 questions part 2 - \/ characters revisited' on the iypthon user
860 questions part 2 - \/ characters revisited' on the iypthon user
846 list:
861 list:
847 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
862 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
848
863
849 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
864 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
850
865
851 (InteractiveShell.__init__): change threaded shells to not use the
866 (InteractiveShell.__init__): change threaded shells to not use the
852 ipython crash handler. This was causing more problems than not,
867 ipython crash handler. This was causing more problems than not,
853 as exceptions in the main thread (GUI code, typically) would
868 as exceptions in the main thread (GUI code, typically) would
854 always show up as a 'crash', when they really weren't.
869 always show up as a 'crash', when they really weren't.
855
870
856 The colors and exception mode commands (%colors/%xmode) have been
871 The colors and exception mode commands (%colors/%xmode) have been
857 synchronized to also take this into account, so users can get
872 synchronized to also take this into account, so users can get
858 verbose exceptions for their threaded code as well. I also added
873 verbose exceptions for their threaded code as well. I also added
859 support for activating pdb inside this exception handler as well,
874 support for activating pdb inside this exception handler as well,
860 so now GUI authors can use IPython's enhanced pdb at runtime.
875 so now GUI authors can use IPython's enhanced pdb at runtime.
861
876
862 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
877 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
863 true by default, and add it to the shipped ipythonrc file. Since
878 true by default, and add it to the shipped ipythonrc file. Since
864 this asks the user before proceeding, I think it's OK to make it
879 this asks the user before proceeding, I think it's OK to make it
865 true by default.
880 true by default.
866
881
867 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
882 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
868 of the previous special-casing of input in the eval loop. I think
883 of the previous special-casing of input in the eval loop. I think
869 this is cleaner, as they really are commands and shouldn't have
884 this is cleaner, as they really are commands and shouldn't have
870 a special role in the middle of the core code.
885 a special role in the middle of the core code.
871
886
872 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
887 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
873
888
874 * IPython/iplib.py (edit_syntax_error): added support for
889 * IPython/iplib.py (edit_syntax_error): added support for
875 automatically reopening the editor if the file had a syntax error
890 automatically reopening the editor if the file had a syntax error
876 in it. Thanks to scottt who provided the patch at:
891 in it. Thanks to scottt who provided the patch at:
877 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
892 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
878 version committed).
893 version committed).
879
894
880 * IPython/iplib.py (handle_normal): add suport for multi-line
895 * IPython/iplib.py (handle_normal): add suport for multi-line
881 input with emtpy lines. This fixes
896 input with emtpy lines. This fixes
882 http://www.scipy.net/roundup/ipython/issue43 and a similar
897 http://www.scipy.net/roundup/ipython/issue43 and a similar
883 discussion on the user list.
898 discussion on the user list.
884
899
885 WARNING: a behavior change is necessarily introduced to support
900 WARNING: a behavior change is necessarily introduced to support
886 blank lines: now a single blank line with whitespace does NOT
901 blank lines: now a single blank line with whitespace does NOT
887 break the input loop, which means that when autoindent is on, by
902 break the input loop, which means that when autoindent is on, by
888 default hitting return on the next (indented) line does NOT exit.
903 default hitting return on the next (indented) line does NOT exit.
889
904
890 Instead, to exit a multiline input you can either have:
905 Instead, to exit a multiline input you can either have:
891
906
892 - TWO whitespace lines (just hit return again), or
907 - TWO whitespace lines (just hit return again), or
893 - a single whitespace line of a different length than provided
908 - a single whitespace line of a different length than provided
894 by the autoindent (add or remove a space).
909 by the autoindent (add or remove a space).
895
910
896 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
911 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
897 module to better organize all readline-related functionality.
912 module to better organize all readline-related functionality.
898 I've deleted FlexCompleter and put all completion clases here.
913 I've deleted FlexCompleter and put all completion clases here.
899
914
900 * IPython/iplib.py (raw_input): improve indentation management.
915 * IPython/iplib.py (raw_input): improve indentation management.
901 It is now possible to paste indented code with autoindent on, and
916 It is now possible to paste indented code with autoindent on, and
902 the code is interpreted correctly (though it still looks bad on
917 the code is interpreted correctly (though it still looks bad on
903 screen, due to the line-oriented nature of ipython).
918 screen, due to the line-oriented nature of ipython).
904 (MagicCompleter.complete): change behavior so that a TAB key on an
919 (MagicCompleter.complete): change behavior so that a TAB key on an
905 otherwise empty line actually inserts a tab, instead of completing
920 otherwise empty line actually inserts a tab, instead of completing
906 on the entire global namespace. This makes it easier to use the
921 on the entire global namespace. This makes it easier to use the
907 TAB key for indentation. After a request by Hans Meine
922 TAB key for indentation. After a request by Hans Meine
908 <hans_meine-AT-gmx.net>
923 <hans_meine-AT-gmx.net>
909 (_prefilter): add support so that typing plain 'exit' or 'quit'
924 (_prefilter): add support so that typing plain 'exit' or 'quit'
910 does a sensible thing. Originally I tried to deviate as little as
925 does a sensible thing. Originally I tried to deviate as little as
911 possible from the default python behavior, but even that one may
926 possible from the default python behavior, but even that one may
912 change in this direction (thread on python-dev to that effect).
927 change in this direction (thread on python-dev to that effect).
913 Regardless, ipython should do the right thing even if CPython's
928 Regardless, ipython should do the right thing even if CPython's
914 '>>>' prompt doesn't.
929 '>>>' prompt doesn't.
915 (InteractiveShell): removed subclassing code.InteractiveConsole
930 (InteractiveShell): removed subclassing code.InteractiveConsole
916 class. By now we'd overridden just about all of its methods: I've
931 class. By now we'd overridden just about all of its methods: I've
917 copied the remaining two over, and now ipython is a standalone
932 copied the remaining two over, and now ipython is a standalone
918 class. This will provide a clearer picture for the chainsaw
933 class. This will provide a clearer picture for the chainsaw
919 branch refactoring.
934 branch refactoring.
920
935
921 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
936 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
922
937
923 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
938 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
924 failures for objects which break when dir() is called on them.
939 failures for objects which break when dir() is called on them.
925
940
926 * IPython/FlexCompleter.py (Completer.__init__): Added support for
941 * IPython/FlexCompleter.py (Completer.__init__): Added support for
927 distinct local and global namespaces in the completer API. This
942 distinct local and global namespaces in the completer API. This
928 change allows us top properly handle completion with distinct
943 change allows us top properly handle completion with distinct
929 scopes, including in embedded instances (this had never really
944 scopes, including in embedded instances (this had never really
930 worked correctly).
945 worked correctly).
931
946
932 Note: this introduces a change in the constructor for
947 Note: this introduces a change in the constructor for
933 MagicCompleter, as a new global_namespace parameter is now the
948 MagicCompleter, as a new global_namespace parameter is now the
934 second argument (the others were bumped one position).
949 second argument (the others were bumped one position).
935
950
936 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
951 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
937
952
938 * IPython/iplib.py (embed_mainloop): fix tab-completion in
953 * IPython/iplib.py (embed_mainloop): fix tab-completion in
939 embedded instances (which can be done now thanks to Vivian's
954 embedded instances (which can be done now thanks to Vivian's
940 frame-handling fixes for pdb).
955 frame-handling fixes for pdb).
941 (InteractiveShell.__init__): Fix namespace handling problem in
956 (InteractiveShell.__init__): Fix namespace handling problem in
942 embedded instances. We were overwriting __main__ unconditionally,
957 embedded instances. We were overwriting __main__ unconditionally,
943 and this should only be done for 'full' (non-embedded) IPython;
958 and this should only be done for 'full' (non-embedded) IPython;
944 embedded instances must respect the caller's __main__. Thanks to
959 embedded instances must respect the caller's __main__. Thanks to
945 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
960 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
946
961
947 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
962 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
948
963
949 * setup.py: added download_url to setup(). This registers the
964 * setup.py: added download_url to setup(). This registers the
950 download address at PyPI, which is not only useful to humans
965 download address at PyPI, which is not only useful to humans
951 browsing the site, but is also picked up by setuptools (the Eggs
966 browsing the site, but is also picked up by setuptools (the Eggs
952 machinery). Thanks to Ville and R. Kern for the info/discussion
967 machinery). Thanks to Ville and R. Kern for the info/discussion
953 on this.
968 on this.
954
969
955 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
970 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
956
971
957 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
972 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
958 This brings a lot of nice functionality to the pdb mode, which now
973 This brings a lot of nice functionality to the pdb mode, which now
959 has tab-completion, syntax highlighting, and better stack handling
974 has tab-completion, syntax highlighting, and better stack handling
960 than before. Many thanks to Vivian De Smedt
975 than before. Many thanks to Vivian De Smedt
961 <vivian-AT-vdesmedt.com> for the original patches.
976 <vivian-AT-vdesmedt.com> for the original patches.
962
977
963 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
978 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
964
979
965 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
980 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
966 sequence to consistently accept the banner argument. The
981 sequence to consistently accept the banner argument. The
967 inconsistency was tripping SAGE, thanks to Gary Zablackis
982 inconsistency was tripping SAGE, thanks to Gary Zablackis
968 <gzabl-AT-yahoo.com> for the report.
983 <gzabl-AT-yahoo.com> for the report.
969
984
970 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
985 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
971
986
972 * IPython/iplib.py (InteractiveShell.post_config_initialization):
987 * IPython/iplib.py (InteractiveShell.post_config_initialization):
973 Fix bug where a naked 'alias' call in the ipythonrc file would
988 Fix bug where a naked 'alias' call in the ipythonrc file would
974 cause a crash. Bug reported by Jorgen Stenarson.
989 cause a crash. Bug reported by Jorgen Stenarson.
975
990
976 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
991 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
977
992
978 * IPython/ipmaker.py (make_IPython): cleanups which should improve
993 * IPython/ipmaker.py (make_IPython): cleanups which should improve
979 startup time.
994 startup time.
980
995
981 * IPython/iplib.py (runcode): my globals 'fix' for embedded
996 * IPython/iplib.py (runcode): my globals 'fix' for embedded
982 instances had introduced a bug with globals in normal code. Now
997 instances had introduced a bug with globals in normal code. Now
983 it's working in all cases.
998 it's working in all cases.
984
999
985 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1000 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
986 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1001 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
987 has been introduced to set the default case sensitivity of the
1002 has been introduced to set the default case sensitivity of the
988 searches. Users can still select either mode at runtime on a
1003 searches. Users can still select either mode at runtime on a
989 per-search basis.
1004 per-search basis.
990
1005
991 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1006 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
992
1007
993 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1008 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
994 attributes in wildcard searches for subclasses. Modified version
1009 attributes in wildcard searches for subclasses. Modified version
995 of a patch by Jorgen.
1010 of a patch by Jorgen.
996
1011
997 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1012 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
998
1013
999 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1014 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1000 embedded instances. I added a user_global_ns attribute to the
1015 embedded instances. I added a user_global_ns attribute to the
1001 InteractiveShell class to handle this.
1016 InteractiveShell class to handle this.
1002
1017
1003 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1018 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1004
1019
1005 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1020 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1006 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1021 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1007 (reported under win32, but may happen also in other platforms).
1022 (reported under win32, but may happen also in other platforms).
1008 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1023 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1009
1024
1010 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1025 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1011
1026
1012 * IPython/Magic.py (magic_psearch): new support for wildcard
1027 * IPython/Magic.py (magic_psearch): new support for wildcard
1013 patterns. Now, typing ?a*b will list all names which begin with a
1028 patterns. Now, typing ?a*b will list all names which begin with a
1014 and end in b, for example. The %psearch magic has full
1029 and end in b, for example. The %psearch magic has full
1015 docstrings. Many thanks to JΓΆrgen Stenarson
1030 docstrings. Many thanks to JΓΆrgen Stenarson
1016 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1031 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1017 implementing this functionality.
1032 implementing this functionality.
1018
1033
1019 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1034 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1020
1035
1021 * Manual: fixed long-standing annoyance of double-dashes (as in
1036 * Manual: fixed long-standing annoyance of double-dashes (as in
1022 --prefix=~, for example) being stripped in the HTML version. This
1037 --prefix=~, for example) being stripped in the HTML version. This
1023 is a latex2html bug, but a workaround was provided. Many thanks
1038 is a latex2html bug, but a workaround was provided. Many thanks
1024 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1039 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1025 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1040 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1026 rolling. This seemingly small issue had tripped a number of users
1041 rolling. This seemingly small issue had tripped a number of users
1027 when first installing, so I'm glad to see it gone.
1042 when first installing, so I'm glad to see it gone.
1028
1043
1029 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1044 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1030
1045
1031 * IPython/Extensions/numeric_formats.py: fix missing import,
1046 * IPython/Extensions/numeric_formats.py: fix missing import,
1032 reported by Stephen Walton.
1047 reported by Stephen Walton.
1033
1048
1034 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1049 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1035
1050
1036 * IPython/demo.py: finish demo module, fully documented now.
1051 * IPython/demo.py: finish demo module, fully documented now.
1037
1052
1038 * IPython/genutils.py (file_read): simple little utility to read a
1053 * IPython/genutils.py (file_read): simple little utility to read a
1039 file and ensure it's closed afterwards.
1054 file and ensure it's closed afterwards.
1040
1055
1041 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1056 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1042
1057
1043 * IPython/demo.py (Demo.__init__): added support for individually
1058 * IPython/demo.py (Demo.__init__): added support for individually
1044 tagging blocks for automatic execution.
1059 tagging blocks for automatic execution.
1045
1060
1046 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1061 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1047 syntax-highlighted python sources, requested by John.
1062 syntax-highlighted python sources, requested by John.
1048
1063
1049 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1064 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1050
1065
1051 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1066 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1052 finishing.
1067 finishing.
1053
1068
1054 * IPython/genutils.py (shlex_split): moved from Magic to here,
1069 * IPython/genutils.py (shlex_split): moved from Magic to here,
1055 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1070 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1056
1071
1057 * IPython/demo.py (Demo.__init__): added support for silent
1072 * IPython/demo.py (Demo.__init__): added support for silent
1058 blocks, improved marks as regexps, docstrings written.
1073 blocks, improved marks as regexps, docstrings written.
1059 (Demo.__init__): better docstring, added support for sys.argv.
1074 (Demo.__init__): better docstring, added support for sys.argv.
1060
1075
1061 * IPython/genutils.py (marquee): little utility used by the demo
1076 * IPython/genutils.py (marquee): little utility used by the demo
1062 code, handy in general.
1077 code, handy in general.
1063
1078
1064 * IPython/demo.py (Demo.__init__): new class for interactive
1079 * IPython/demo.py (Demo.__init__): new class for interactive
1065 demos. Not documented yet, I just wrote it in a hurry for
1080 demos. Not documented yet, I just wrote it in a hurry for
1066 scipy'05. Will docstring later.
1081 scipy'05. Will docstring later.
1067
1082
1068 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1083 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1069
1084
1070 * IPython/Shell.py (sigint_handler): Drastic simplification which
1085 * IPython/Shell.py (sigint_handler): Drastic simplification which
1071 also seems to make Ctrl-C work correctly across threads! This is
1086 also seems to make Ctrl-C work correctly across threads! This is
1072 so simple, that I can't beleive I'd missed it before. Needs more
1087 so simple, that I can't beleive I'd missed it before. Needs more
1073 testing, though.
1088 testing, though.
1074 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1089 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1075 like this before...
1090 like this before...
1076
1091
1077 * IPython/genutils.py (get_home_dir): add protection against
1092 * IPython/genutils.py (get_home_dir): add protection against
1078 non-dirs in win32 registry.
1093 non-dirs in win32 registry.
1079
1094
1080 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1095 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1081 bug where dict was mutated while iterating (pysh crash).
1096 bug where dict was mutated while iterating (pysh crash).
1082
1097
1083 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1098 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1084
1099
1085 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1100 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1086 spurious newlines added by this routine. After a report by
1101 spurious newlines added by this routine. After a report by
1087 F. Mantegazza.
1102 F. Mantegazza.
1088
1103
1089 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1104 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1090
1105
1091 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1106 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1092 calls. These were a leftover from the GTK 1.x days, and can cause
1107 calls. These were a leftover from the GTK 1.x days, and can cause
1093 problems in certain cases (after a report by John Hunter).
1108 problems in certain cases (after a report by John Hunter).
1094
1109
1095 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1110 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1096 os.getcwd() fails at init time. Thanks to patch from David Remahl
1111 os.getcwd() fails at init time. Thanks to patch from David Remahl
1097 <chmod007-AT-mac.com>.
1112 <chmod007-AT-mac.com>.
1098 (InteractiveShell.__init__): prevent certain special magics from
1113 (InteractiveShell.__init__): prevent certain special magics from
1099 being shadowed by aliases. Closes
1114 being shadowed by aliases. Closes
1100 http://www.scipy.net/roundup/ipython/issue41.
1115 http://www.scipy.net/roundup/ipython/issue41.
1101
1116
1102 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1117 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1103
1118
1104 * IPython/iplib.py (InteractiveShell.complete): Added new
1119 * IPython/iplib.py (InteractiveShell.complete): Added new
1105 top-level completion method to expose the completion mechanism
1120 top-level completion method to expose the completion mechanism
1106 beyond readline-based environments.
1121 beyond readline-based environments.
1107
1122
1108 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1123 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1109
1124
1110 * tools/ipsvnc (svnversion): fix svnversion capture.
1125 * tools/ipsvnc (svnversion): fix svnversion capture.
1111
1126
1112 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1127 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1113 attribute to self, which was missing. Before, it was set by a
1128 attribute to self, which was missing. Before, it was set by a
1114 routine which in certain cases wasn't being called, so the
1129 routine which in certain cases wasn't being called, so the
1115 instance could end up missing the attribute. This caused a crash.
1130 instance could end up missing the attribute. This caused a crash.
1116 Closes http://www.scipy.net/roundup/ipython/issue40.
1131 Closes http://www.scipy.net/roundup/ipython/issue40.
1117
1132
1118 2005-08-16 Fernando Perez <fperez@colorado.edu>
1133 2005-08-16 Fernando Perez <fperez@colorado.edu>
1119
1134
1120 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1135 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1121 contains non-string attribute. Closes
1136 contains non-string attribute. Closes
1122 http://www.scipy.net/roundup/ipython/issue38.
1137 http://www.scipy.net/roundup/ipython/issue38.
1123
1138
1124 2005-08-14 Fernando Perez <fperez@colorado.edu>
1139 2005-08-14 Fernando Perez <fperez@colorado.edu>
1125
1140
1126 * tools/ipsvnc: Minor improvements, to add changeset info.
1141 * tools/ipsvnc: Minor improvements, to add changeset info.
1127
1142
1128 2005-08-12 Fernando Perez <fperez@colorado.edu>
1143 2005-08-12 Fernando Perez <fperez@colorado.edu>
1129
1144
1130 * IPython/iplib.py (runsource): remove self.code_to_run_src
1145 * IPython/iplib.py (runsource): remove self.code_to_run_src
1131 attribute. I realized this is nothing more than
1146 attribute. I realized this is nothing more than
1132 '\n'.join(self.buffer), and having the same data in two different
1147 '\n'.join(self.buffer), and having the same data in two different
1133 places is just asking for synchronization bugs. This may impact
1148 places is just asking for synchronization bugs. This may impact
1134 people who have custom exception handlers, so I need to warn
1149 people who have custom exception handlers, so I need to warn
1135 ipython-dev about it (F. Mantegazza may use them).
1150 ipython-dev about it (F. Mantegazza may use them).
1136
1151
1137 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1152 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1138
1153
1139 * IPython/genutils.py: fix 2.2 compatibility (generators)
1154 * IPython/genutils.py: fix 2.2 compatibility (generators)
1140
1155
1141 2005-07-18 Fernando Perez <fperez@colorado.edu>
1156 2005-07-18 Fernando Perez <fperez@colorado.edu>
1142
1157
1143 * IPython/genutils.py (get_home_dir): fix to help users with
1158 * IPython/genutils.py (get_home_dir): fix to help users with
1144 invalid $HOME under win32.
1159 invalid $HOME under win32.
1145
1160
1146 2005-07-17 Fernando Perez <fperez@colorado.edu>
1161 2005-07-17 Fernando Perez <fperez@colorado.edu>
1147
1162
1148 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1163 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1149 some old hacks and clean up a bit other routines; code should be
1164 some old hacks and clean up a bit other routines; code should be
1150 simpler and a bit faster.
1165 simpler and a bit faster.
1151
1166
1152 * IPython/iplib.py (interact): removed some last-resort attempts
1167 * IPython/iplib.py (interact): removed some last-resort attempts
1153 to survive broken stdout/stderr. That code was only making it
1168 to survive broken stdout/stderr. That code was only making it
1154 harder to abstract out the i/o (necessary for gui integration),
1169 harder to abstract out the i/o (necessary for gui integration),
1155 and the crashes it could prevent were extremely rare in practice
1170 and the crashes it could prevent were extremely rare in practice
1156 (besides being fully user-induced in a pretty violent manner).
1171 (besides being fully user-induced in a pretty violent manner).
1157
1172
1158 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1173 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1159 Nothing major yet, but the code is simpler to read; this should
1174 Nothing major yet, but the code is simpler to read; this should
1160 make it easier to do more serious modifications in the future.
1175 make it easier to do more serious modifications in the future.
1161
1176
1162 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1177 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1163 which broke in .15 (thanks to a report by Ville).
1178 which broke in .15 (thanks to a report by Ville).
1164
1179
1165 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1180 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1166 be quite correct, I know next to nothing about unicode). This
1181 be quite correct, I know next to nothing about unicode). This
1167 will allow unicode strings to be used in prompts, amongst other
1182 will allow unicode strings to be used in prompts, amongst other
1168 cases. It also will prevent ipython from crashing when unicode
1183 cases. It also will prevent ipython from crashing when unicode
1169 shows up unexpectedly in many places. If ascii encoding fails, we
1184 shows up unexpectedly in many places. If ascii encoding fails, we
1170 assume utf_8. Currently the encoding is not a user-visible
1185 assume utf_8. Currently the encoding is not a user-visible
1171 setting, though it could be made so if there is demand for it.
1186 setting, though it could be made so if there is demand for it.
1172
1187
1173 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1188 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1174
1189
1175 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1190 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1176
1191
1177 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1192 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1178
1193
1179 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1194 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1180 code can work transparently for 2.2/2.3.
1195 code can work transparently for 2.2/2.3.
1181
1196
1182 2005-07-16 Fernando Perez <fperez@colorado.edu>
1197 2005-07-16 Fernando Perez <fperez@colorado.edu>
1183
1198
1184 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1199 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1185 out of the color scheme table used for coloring exception
1200 out of the color scheme table used for coloring exception
1186 tracebacks. This allows user code to add new schemes at runtime.
1201 tracebacks. This allows user code to add new schemes at runtime.
1187 This is a minimally modified version of the patch at
1202 This is a minimally modified version of the patch at
1188 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1203 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1189 for the contribution.
1204 for the contribution.
1190
1205
1191 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1206 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1192 slightly modified version of the patch in
1207 slightly modified version of the patch in
1193 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1208 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1194 to remove the previous try/except solution (which was costlier).
1209 to remove the previous try/except solution (which was costlier).
1195 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1210 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1196
1211
1197 2005-06-08 Fernando Perez <fperez@colorado.edu>
1212 2005-06-08 Fernando Perez <fperez@colorado.edu>
1198
1213
1199 * IPython/iplib.py (write/write_err): Add methods to abstract all
1214 * IPython/iplib.py (write/write_err): Add methods to abstract all
1200 I/O a bit more.
1215 I/O a bit more.
1201
1216
1202 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1217 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1203 warning, reported by Aric Hagberg, fix by JD Hunter.
1218 warning, reported by Aric Hagberg, fix by JD Hunter.
1204
1219
1205 2005-06-02 *** Released version 0.6.15
1220 2005-06-02 *** Released version 0.6.15
1206
1221
1207 2005-06-01 Fernando Perez <fperez@colorado.edu>
1222 2005-06-01 Fernando Perez <fperez@colorado.edu>
1208
1223
1209 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1224 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1210 tab-completion of filenames within open-quoted strings. Note that
1225 tab-completion of filenames within open-quoted strings. Note that
1211 this requires that in ~/.ipython/ipythonrc, users change the
1226 this requires that in ~/.ipython/ipythonrc, users change the
1212 readline delimiters configuration to read:
1227 readline delimiters configuration to read:
1213
1228
1214 readline_remove_delims -/~
1229 readline_remove_delims -/~
1215
1230
1216
1231
1217 2005-05-31 *** Released version 0.6.14
1232 2005-05-31 *** Released version 0.6.14
1218
1233
1219 2005-05-29 Fernando Perez <fperez@colorado.edu>
1234 2005-05-29 Fernando Perez <fperez@colorado.edu>
1220
1235
1221 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1236 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1222 with files not on the filesystem. Reported by Eliyahu Sandler
1237 with files not on the filesystem. Reported by Eliyahu Sandler
1223 <eli@gondolin.net>
1238 <eli@gondolin.net>
1224
1239
1225 2005-05-22 Fernando Perez <fperez@colorado.edu>
1240 2005-05-22 Fernando Perez <fperez@colorado.edu>
1226
1241
1227 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1242 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1228 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1243 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1229
1244
1230 2005-05-19 Fernando Perez <fperez@colorado.edu>
1245 2005-05-19 Fernando Perez <fperez@colorado.edu>
1231
1246
1232 * IPython/iplib.py (safe_execfile): close a file which could be
1247 * IPython/iplib.py (safe_execfile): close a file which could be
1233 left open (causing problems in win32, which locks open files).
1248 left open (causing problems in win32, which locks open files).
1234 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1249 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1235
1250
1236 2005-05-18 Fernando Perez <fperez@colorado.edu>
1251 2005-05-18 Fernando Perez <fperez@colorado.edu>
1237
1252
1238 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1253 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1239 keyword arguments correctly to safe_execfile().
1254 keyword arguments correctly to safe_execfile().
1240
1255
1241 2005-05-13 Fernando Perez <fperez@colorado.edu>
1256 2005-05-13 Fernando Perez <fperez@colorado.edu>
1242
1257
1243 * ipython.1: Added info about Qt to manpage, and threads warning
1258 * ipython.1: Added info about Qt to manpage, and threads warning
1244 to usage page (invoked with --help).
1259 to usage page (invoked with --help).
1245
1260
1246 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1261 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1247 new matcher (it goes at the end of the priority list) to do
1262 new matcher (it goes at the end of the priority list) to do
1248 tab-completion on named function arguments. Submitted by George
1263 tab-completion on named function arguments. Submitted by George
1249 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1264 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1250 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1265 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1251 for more details.
1266 for more details.
1252
1267
1253 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1268 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1254 SystemExit exceptions in the script being run. Thanks to a report
1269 SystemExit exceptions in the script being run. Thanks to a report
1255 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1270 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1256 producing very annoying behavior when running unit tests.
1271 producing very annoying behavior when running unit tests.
1257
1272
1258 2005-05-12 Fernando Perez <fperez@colorado.edu>
1273 2005-05-12 Fernando Perez <fperez@colorado.edu>
1259
1274
1260 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1275 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1261 which I'd broken (again) due to a changed regexp. In the process,
1276 which I'd broken (again) due to a changed regexp. In the process,
1262 added ';' as an escape to auto-quote the whole line without
1277 added ';' as an escape to auto-quote the whole line without
1263 splitting its arguments. Thanks to a report by Jerry McRae
1278 splitting its arguments. Thanks to a report by Jerry McRae
1264 <qrs0xyc02-AT-sneakemail.com>.
1279 <qrs0xyc02-AT-sneakemail.com>.
1265
1280
1266 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1281 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1267 possible crashes caused by a TokenError. Reported by Ed Schofield
1282 possible crashes caused by a TokenError. Reported by Ed Schofield
1268 <schofield-AT-ftw.at>.
1283 <schofield-AT-ftw.at>.
1269
1284
1270 2005-05-06 Fernando Perez <fperez@colorado.edu>
1285 2005-05-06 Fernando Perez <fperez@colorado.edu>
1271
1286
1272 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1287 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1273
1288
1274 2005-04-29 Fernando Perez <fperez@colorado.edu>
1289 2005-04-29 Fernando Perez <fperez@colorado.edu>
1275
1290
1276 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1291 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1277 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1292 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1278 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1293 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1279 which provides support for Qt interactive usage (similar to the
1294 which provides support for Qt interactive usage (similar to the
1280 existing one for WX and GTK). This had been often requested.
1295 existing one for WX and GTK). This had been often requested.
1281
1296
1282 2005-04-14 *** Released version 0.6.13
1297 2005-04-14 *** Released version 0.6.13
1283
1298
1284 2005-04-08 Fernando Perez <fperez@colorado.edu>
1299 2005-04-08 Fernando Perez <fperez@colorado.edu>
1285
1300
1286 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1301 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1287 from _ofind, which gets called on almost every input line. Now,
1302 from _ofind, which gets called on almost every input line. Now,
1288 we only try to get docstrings if they are actually going to be
1303 we only try to get docstrings if they are actually going to be
1289 used (the overhead of fetching unnecessary docstrings can be
1304 used (the overhead of fetching unnecessary docstrings can be
1290 noticeable for certain objects, such as Pyro proxies).
1305 noticeable for certain objects, such as Pyro proxies).
1291
1306
1292 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1307 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1293 for completers. For some reason I had been passing them the state
1308 for completers. For some reason I had been passing them the state
1294 variable, which completers never actually need, and was in
1309 variable, which completers never actually need, and was in
1295 conflict with the rlcompleter API. Custom completers ONLY need to
1310 conflict with the rlcompleter API. Custom completers ONLY need to
1296 take the text parameter.
1311 take the text parameter.
1297
1312
1298 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1313 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1299 work correctly in pysh. I've also moved all the logic which used
1314 work correctly in pysh. I've also moved all the logic which used
1300 to be in pysh.py here, which will prevent problems with future
1315 to be in pysh.py here, which will prevent problems with future
1301 upgrades. However, this time I must warn users to update their
1316 upgrades. However, this time I must warn users to update their
1302 pysh profile to include the line
1317 pysh profile to include the line
1303
1318
1304 import_all IPython.Extensions.InterpreterExec
1319 import_all IPython.Extensions.InterpreterExec
1305
1320
1306 because otherwise things won't work for them. They MUST also
1321 because otherwise things won't work for them. They MUST also
1307 delete pysh.py and the line
1322 delete pysh.py and the line
1308
1323
1309 execfile pysh.py
1324 execfile pysh.py
1310
1325
1311 from their ipythonrc-pysh.
1326 from their ipythonrc-pysh.
1312
1327
1313 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1328 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1314 robust in the face of objects whose dir() returns non-strings
1329 robust in the face of objects whose dir() returns non-strings
1315 (which it shouldn't, but some broken libs like ITK do). Thanks to
1330 (which it shouldn't, but some broken libs like ITK do). Thanks to
1316 a patch by John Hunter (implemented differently, though). Also
1331 a patch by John Hunter (implemented differently, though). Also
1317 minor improvements by using .extend instead of + on lists.
1332 minor improvements by using .extend instead of + on lists.
1318
1333
1319 * pysh.py:
1334 * pysh.py:
1320
1335
1321 2005-04-06 Fernando Perez <fperez@colorado.edu>
1336 2005-04-06 Fernando Perez <fperez@colorado.edu>
1322
1337
1323 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1338 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1324 by default, so that all users benefit from it. Those who don't
1339 by default, so that all users benefit from it. Those who don't
1325 want it can still turn it off.
1340 want it can still turn it off.
1326
1341
1327 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1342 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1328 config file, I'd forgotten about this, so users were getting it
1343 config file, I'd forgotten about this, so users were getting it
1329 off by default.
1344 off by default.
1330
1345
1331 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1346 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1332 consistency. Now magics can be called in multiline statements,
1347 consistency. Now magics can be called in multiline statements,
1333 and python variables can be expanded in magic calls via $var.
1348 and python variables can be expanded in magic calls via $var.
1334 This makes the magic system behave just like aliases or !system
1349 This makes the magic system behave just like aliases or !system
1335 calls.
1350 calls.
1336
1351
1337 2005-03-28 Fernando Perez <fperez@colorado.edu>
1352 2005-03-28 Fernando Perez <fperez@colorado.edu>
1338
1353
1339 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1354 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1340 expensive string additions for building command. Add support for
1355 expensive string additions for building command. Add support for
1341 trailing ';' when autocall is used.
1356 trailing ';' when autocall is used.
1342
1357
1343 2005-03-26 Fernando Perez <fperez@colorado.edu>
1358 2005-03-26 Fernando Perez <fperez@colorado.edu>
1344
1359
1345 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1360 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1346 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1361 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1347 ipython.el robust against prompts with any number of spaces
1362 ipython.el robust against prompts with any number of spaces
1348 (including 0) after the ':' character.
1363 (including 0) after the ':' character.
1349
1364
1350 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1365 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1351 continuation prompt, which misled users to think the line was
1366 continuation prompt, which misled users to think the line was
1352 already indented. Closes debian Bug#300847, reported to me by
1367 already indented. Closes debian Bug#300847, reported to me by
1353 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1368 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1354
1369
1355 2005-03-23 Fernando Perez <fperez@colorado.edu>
1370 2005-03-23 Fernando Perez <fperez@colorado.edu>
1356
1371
1357 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1372 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1358 properly aligned if they have embedded newlines.
1373 properly aligned if they have embedded newlines.
1359
1374
1360 * IPython/iplib.py (runlines): Add a public method to expose
1375 * IPython/iplib.py (runlines): Add a public method to expose
1361 IPython's code execution machinery, so that users can run strings
1376 IPython's code execution machinery, so that users can run strings
1362 as if they had been typed at the prompt interactively.
1377 as if they had been typed at the prompt interactively.
1363 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1378 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1364 methods which can call the system shell, but with python variable
1379 methods which can call the system shell, but with python variable
1365 expansion. The three such methods are: __IPYTHON__.system,
1380 expansion. The three such methods are: __IPYTHON__.system,
1366 .getoutput and .getoutputerror. These need to be documented in a
1381 .getoutput and .getoutputerror. These need to be documented in a
1367 'public API' section (to be written) of the manual.
1382 'public API' section (to be written) of the manual.
1368
1383
1369 2005-03-20 Fernando Perez <fperez@colorado.edu>
1384 2005-03-20 Fernando Perez <fperez@colorado.edu>
1370
1385
1371 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1386 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1372 for custom exception handling. This is quite powerful, and it
1387 for custom exception handling. This is quite powerful, and it
1373 allows for user-installable exception handlers which can trap
1388 allows for user-installable exception handlers which can trap
1374 custom exceptions at runtime and treat them separately from
1389 custom exceptions at runtime and treat them separately from
1375 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1390 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1376 Mantegazza <mantegazza-AT-ill.fr>.
1391 Mantegazza <mantegazza-AT-ill.fr>.
1377 (InteractiveShell.set_custom_completer): public API function to
1392 (InteractiveShell.set_custom_completer): public API function to
1378 add new completers at runtime.
1393 add new completers at runtime.
1379
1394
1380 2005-03-19 Fernando Perez <fperez@colorado.edu>
1395 2005-03-19 Fernando Perez <fperez@colorado.edu>
1381
1396
1382 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1397 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1383 allow objects which provide their docstrings via non-standard
1398 allow objects which provide their docstrings via non-standard
1384 mechanisms (like Pyro proxies) to still be inspected by ipython's
1399 mechanisms (like Pyro proxies) to still be inspected by ipython's
1385 ? system.
1400 ? system.
1386
1401
1387 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1402 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1388 automatic capture system. I tried quite hard to make it work
1403 automatic capture system. I tried quite hard to make it work
1389 reliably, and simply failed. I tried many combinations with the
1404 reliably, and simply failed. I tried many combinations with the
1390 subprocess module, but eventually nothing worked in all needed
1405 subprocess module, but eventually nothing worked in all needed
1391 cases (not blocking stdin for the child, duplicating stdout
1406 cases (not blocking stdin for the child, duplicating stdout
1392 without blocking, etc). The new %sc/%sx still do capture to these
1407 without blocking, etc). The new %sc/%sx still do capture to these
1393 magical list/string objects which make shell use much more
1408 magical list/string objects which make shell use much more
1394 conveninent, so not all is lost.
1409 conveninent, so not all is lost.
1395
1410
1396 XXX - FIX MANUAL for the change above!
1411 XXX - FIX MANUAL for the change above!
1397
1412
1398 (runsource): I copied code.py's runsource() into ipython to modify
1413 (runsource): I copied code.py's runsource() into ipython to modify
1399 it a bit. Now the code object and source to be executed are
1414 it a bit. Now the code object and source to be executed are
1400 stored in ipython. This makes this info accessible to third-party
1415 stored in ipython. This makes this info accessible to third-party
1401 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1416 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1402 Mantegazza <mantegazza-AT-ill.fr>.
1417 Mantegazza <mantegazza-AT-ill.fr>.
1403
1418
1404 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1419 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1405 history-search via readline (like C-p/C-n). I'd wanted this for a
1420 history-search via readline (like C-p/C-n). I'd wanted this for a
1406 long time, but only recently found out how to do it. For users
1421 long time, but only recently found out how to do it. For users
1407 who already have their ipythonrc files made and want this, just
1422 who already have their ipythonrc files made and want this, just
1408 add:
1423 add:
1409
1424
1410 readline_parse_and_bind "\e[A": history-search-backward
1425 readline_parse_and_bind "\e[A": history-search-backward
1411 readline_parse_and_bind "\e[B": history-search-forward
1426 readline_parse_and_bind "\e[B": history-search-forward
1412
1427
1413 2005-03-18 Fernando Perez <fperez@colorado.edu>
1428 2005-03-18 Fernando Perez <fperez@colorado.edu>
1414
1429
1415 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1430 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1416 LSString and SList classes which allow transparent conversions
1431 LSString and SList classes which allow transparent conversions
1417 between list mode and whitespace-separated string.
1432 between list mode and whitespace-separated string.
1418 (magic_r): Fix recursion problem in %r.
1433 (magic_r): Fix recursion problem in %r.
1419
1434
1420 * IPython/genutils.py (LSString): New class to be used for
1435 * IPython/genutils.py (LSString): New class to be used for
1421 automatic storage of the results of all alias/system calls in _o
1436 automatic storage of the results of all alias/system calls in _o
1422 and _e (stdout/err). These provide a .l/.list attribute which
1437 and _e (stdout/err). These provide a .l/.list attribute which
1423 does automatic splitting on newlines. This means that for most
1438 does automatic splitting on newlines. This means that for most
1424 uses, you'll never need to do capturing of output with %sc/%sx
1439 uses, you'll never need to do capturing of output with %sc/%sx
1425 anymore, since ipython keeps this always done for you. Note that
1440 anymore, since ipython keeps this always done for you. Note that
1426 only the LAST results are stored, the _o/e variables are
1441 only the LAST results are stored, the _o/e variables are
1427 overwritten on each call. If you need to save their contents
1442 overwritten on each call. If you need to save their contents
1428 further, simply bind them to any other name.
1443 further, simply bind them to any other name.
1429
1444
1430 2005-03-17 Fernando Perez <fperez@colorado.edu>
1445 2005-03-17 Fernando Perez <fperez@colorado.edu>
1431
1446
1432 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1447 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1433 prompt namespace handling.
1448 prompt namespace handling.
1434
1449
1435 2005-03-16 Fernando Perez <fperez@colorado.edu>
1450 2005-03-16 Fernando Perez <fperez@colorado.edu>
1436
1451
1437 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1452 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1438 classic prompts to be '>>> ' (final space was missing, and it
1453 classic prompts to be '>>> ' (final space was missing, and it
1439 trips the emacs python mode).
1454 trips the emacs python mode).
1440 (BasePrompt.__str__): Added safe support for dynamic prompt
1455 (BasePrompt.__str__): Added safe support for dynamic prompt
1441 strings. Now you can set your prompt string to be '$x', and the
1456 strings. Now you can set your prompt string to be '$x', and the
1442 value of x will be printed from your interactive namespace. The
1457 value of x will be printed from your interactive namespace. The
1443 interpolation syntax includes the full Itpl support, so
1458 interpolation syntax includes the full Itpl support, so
1444 ${foo()+x+bar()} is a valid prompt string now, and the function
1459 ${foo()+x+bar()} is a valid prompt string now, and the function
1445 calls will be made at runtime.
1460 calls will be made at runtime.
1446
1461
1447 2005-03-15 Fernando Perez <fperez@colorado.edu>
1462 2005-03-15 Fernando Perez <fperez@colorado.edu>
1448
1463
1449 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1464 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1450 avoid name clashes in pylab. %hist still works, it just forwards
1465 avoid name clashes in pylab. %hist still works, it just forwards
1451 the call to %history.
1466 the call to %history.
1452
1467
1453 2005-03-02 *** Released version 0.6.12
1468 2005-03-02 *** Released version 0.6.12
1454
1469
1455 2005-03-02 Fernando Perez <fperez@colorado.edu>
1470 2005-03-02 Fernando Perez <fperez@colorado.edu>
1456
1471
1457 * IPython/iplib.py (handle_magic): log magic calls properly as
1472 * IPython/iplib.py (handle_magic): log magic calls properly as
1458 ipmagic() function calls.
1473 ipmagic() function calls.
1459
1474
1460 * IPython/Magic.py (magic_time): Improved %time to support
1475 * IPython/Magic.py (magic_time): Improved %time to support
1461 statements and provide wall-clock as well as CPU time.
1476 statements and provide wall-clock as well as CPU time.
1462
1477
1463 2005-02-27 Fernando Perez <fperez@colorado.edu>
1478 2005-02-27 Fernando Perez <fperez@colorado.edu>
1464
1479
1465 * IPython/hooks.py: New hooks module, to expose user-modifiable
1480 * IPython/hooks.py: New hooks module, to expose user-modifiable
1466 IPython functionality in a clean manner. For now only the editor
1481 IPython functionality in a clean manner. For now only the editor
1467 hook is actually written, and other thigns which I intend to turn
1482 hook is actually written, and other thigns which I intend to turn
1468 into proper hooks aren't yet there. The display and prefilter
1483 into proper hooks aren't yet there. The display and prefilter
1469 stuff, for example, should be hooks. But at least now the
1484 stuff, for example, should be hooks. But at least now the
1470 framework is in place, and the rest can be moved here with more
1485 framework is in place, and the rest can be moved here with more
1471 time later. IPython had had a .hooks variable for a long time for
1486 time later. IPython had had a .hooks variable for a long time for
1472 this purpose, but I'd never actually used it for anything.
1487 this purpose, but I'd never actually used it for anything.
1473
1488
1474 2005-02-26 Fernando Perez <fperez@colorado.edu>
1489 2005-02-26 Fernando Perez <fperez@colorado.edu>
1475
1490
1476 * IPython/ipmaker.py (make_IPython): make the default ipython
1491 * IPython/ipmaker.py (make_IPython): make the default ipython
1477 directory be called _ipython under win32, to follow more the
1492 directory be called _ipython under win32, to follow more the
1478 naming peculiarities of that platform (where buggy software like
1493 naming peculiarities of that platform (where buggy software like
1479 Visual Sourcesafe breaks with .named directories). Reported by
1494 Visual Sourcesafe breaks with .named directories). Reported by
1480 Ville Vainio.
1495 Ville Vainio.
1481
1496
1482 2005-02-23 Fernando Perez <fperez@colorado.edu>
1497 2005-02-23 Fernando Perez <fperez@colorado.edu>
1483
1498
1484 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1499 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1485 auto_aliases for win32 which were causing problems. Users can
1500 auto_aliases for win32 which were causing problems. Users can
1486 define the ones they personally like.
1501 define the ones they personally like.
1487
1502
1488 2005-02-21 Fernando Perez <fperez@colorado.edu>
1503 2005-02-21 Fernando Perez <fperez@colorado.edu>
1489
1504
1490 * IPython/Magic.py (magic_time): new magic to time execution of
1505 * IPython/Magic.py (magic_time): new magic to time execution of
1491 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1506 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1492
1507
1493 2005-02-19 Fernando Perez <fperez@colorado.edu>
1508 2005-02-19 Fernando Perez <fperez@colorado.edu>
1494
1509
1495 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1510 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1496 into keys (for prompts, for example).
1511 into keys (for prompts, for example).
1497
1512
1498 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1513 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1499 prompts in case users want them. This introduces a small behavior
1514 prompts in case users want them. This introduces a small behavior
1500 change: ipython does not automatically add a space to all prompts
1515 change: ipython does not automatically add a space to all prompts
1501 anymore. To get the old prompts with a space, users should add it
1516 anymore. To get the old prompts with a space, users should add it
1502 manually to their ipythonrc file, so for example prompt_in1 should
1517 manually to their ipythonrc file, so for example prompt_in1 should
1503 now read 'In [\#]: ' instead of 'In [\#]:'.
1518 now read 'In [\#]: ' instead of 'In [\#]:'.
1504 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1519 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1505 file) to control left-padding of secondary prompts.
1520 file) to control left-padding of secondary prompts.
1506
1521
1507 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1522 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1508 the profiler can't be imported. Fix for Debian, which removed
1523 the profiler can't be imported. Fix for Debian, which removed
1509 profile.py because of License issues. I applied a slightly
1524 profile.py because of License issues. I applied a slightly
1510 modified version of the original Debian patch at
1525 modified version of the original Debian patch at
1511 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1526 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1512
1527
1513 2005-02-17 Fernando Perez <fperez@colorado.edu>
1528 2005-02-17 Fernando Perez <fperez@colorado.edu>
1514
1529
1515 * IPython/genutils.py (native_line_ends): Fix bug which would
1530 * IPython/genutils.py (native_line_ends): Fix bug which would
1516 cause improper line-ends under win32 b/c I was not opening files
1531 cause improper line-ends under win32 b/c I was not opening files
1517 in binary mode. Bug report and fix thanks to Ville.
1532 in binary mode. Bug report and fix thanks to Ville.
1518
1533
1519 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1534 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1520 trying to catch spurious foo[1] autocalls. My fix actually broke
1535 trying to catch spurious foo[1] autocalls. My fix actually broke
1521 ',/' autoquote/call with explicit escape (bad regexp).
1536 ',/' autoquote/call with explicit escape (bad regexp).
1522
1537
1523 2005-02-15 *** Released version 0.6.11
1538 2005-02-15 *** Released version 0.6.11
1524
1539
1525 2005-02-14 Fernando Perez <fperez@colorado.edu>
1540 2005-02-14 Fernando Perez <fperez@colorado.edu>
1526
1541
1527 * IPython/background_jobs.py: New background job management
1542 * IPython/background_jobs.py: New background job management
1528 subsystem. This is implemented via a new set of classes, and
1543 subsystem. This is implemented via a new set of classes, and
1529 IPython now provides a builtin 'jobs' object for background job
1544 IPython now provides a builtin 'jobs' object for background job
1530 execution. A convenience %bg magic serves as a lightweight
1545 execution. A convenience %bg magic serves as a lightweight
1531 frontend for starting the more common type of calls. This was
1546 frontend for starting the more common type of calls. This was
1532 inspired by discussions with B. Granger and the BackgroundCommand
1547 inspired by discussions with B. Granger and the BackgroundCommand
1533 class described in the book Python Scripting for Computational
1548 class described in the book Python Scripting for Computational
1534 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1549 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1535 (although ultimately no code from this text was used, as IPython's
1550 (although ultimately no code from this text was used, as IPython's
1536 system is a separate implementation).
1551 system is a separate implementation).
1537
1552
1538 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1553 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1539 to control the completion of single/double underscore names
1554 to control the completion of single/double underscore names
1540 separately. As documented in the example ipytonrc file, the
1555 separately. As documented in the example ipytonrc file, the
1541 readline_omit__names variable can now be set to 2, to omit even
1556 readline_omit__names variable can now be set to 2, to omit even
1542 single underscore names. Thanks to a patch by Brian Wong
1557 single underscore names. Thanks to a patch by Brian Wong
1543 <BrianWong-AT-AirgoNetworks.Com>.
1558 <BrianWong-AT-AirgoNetworks.Com>.
1544 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1559 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1545 be autocalled as foo([1]) if foo were callable. A problem for
1560 be autocalled as foo([1]) if foo were callable. A problem for
1546 things which are both callable and implement __getitem__.
1561 things which are both callable and implement __getitem__.
1547 (init_readline): Fix autoindentation for win32. Thanks to a patch
1562 (init_readline): Fix autoindentation for win32. Thanks to a patch
1548 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1563 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1549
1564
1550 2005-02-12 Fernando Perez <fperez@colorado.edu>
1565 2005-02-12 Fernando Perez <fperez@colorado.edu>
1551
1566
1552 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1567 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1553 which I had written long ago to sort out user error messages which
1568 which I had written long ago to sort out user error messages which
1554 may occur during startup. This seemed like a good idea initially,
1569 may occur during startup. This seemed like a good idea initially,
1555 but it has proven a disaster in retrospect. I don't want to
1570 but it has proven a disaster in retrospect. I don't want to
1556 change much code for now, so my fix is to set the internal 'debug'
1571 change much code for now, so my fix is to set the internal 'debug'
1557 flag to true everywhere, whose only job was precisely to control
1572 flag to true everywhere, whose only job was precisely to control
1558 this subsystem. This closes issue 28 (as well as avoiding all
1573 this subsystem. This closes issue 28 (as well as avoiding all
1559 sorts of strange hangups which occur from time to time).
1574 sorts of strange hangups which occur from time to time).
1560
1575
1561 2005-02-07 Fernando Perez <fperez@colorado.edu>
1576 2005-02-07 Fernando Perez <fperez@colorado.edu>
1562
1577
1563 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1578 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1564 previous call produced a syntax error.
1579 previous call produced a syntax error.
1565
1580
1566 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1581 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1567 classes without constructor.
1582 classes without constructor.
1568
1583
1569 2005-02-06 Fernando Perez <fperez@colorado.edu>
1584 2005-02-06 Fernando Perez <fperez@colorado.edu>
1570
1585
1571 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1586 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1572 completions with the results of each matcher, so we return results
1587 completions with the results of each matcher, so we return results
1573 to the user from all namespaces. This breaks with ipython
1588 to the user from all namespaces. This breaks with ipython
1574 tradition, but I think it's a nicer behavior. Now you get all
1589 tradition, but I think it's a nicer behavior. Now you get all
1575 possible completions listed, from all possible namespaces (python,
1590 possible completions listed, from all possible namespaces (python,
1576 filesystem, magics...) After a request by John Hunter
1591 filesystem, magics...) After a request by John Hunter
1577 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1592 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1578
1593
1579 2005-02-05 Fernando Perez <fperez@colorado.edu>
1594 2005-02-05 Fernando Perez <fperez@colorado.edu>
1580
1595
1581 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1596 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1582 the call had quote characters in it (the quotes were stripped).
1597 the call had quote characters in it (the quotes were stripped).
1583
1598
1584 2005-01-31 Fernando Perez <fperez@colorado.edu>
1599 2005-01-31 Fernando Perez <fperez@colorado.edu>
1585
1600
1586 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1601 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1587 Itpl.itpl() to make the code more robust against psyco
1602 Itpl.itpl() to make the code more robust against psyco
1588 optimizations.
1603 optimizations.
1589
1604
1590 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1605 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1591 of causing an exception. Quicker, cleaner.
1606 of causing an exception. Quicker, cleaner.
1592
1607
1593 2005-01-28 Fernando Perez <fperez@colorado.edu>
1608 2005-01-28 Fernando Perez <fperez@colorado.edu>
1594
1609
1595 * scripts/ipython_win_post_install.py (install): hardcode
1610 * scripts/ipython_win_post_install.py (install): hardcode
1596 sys.prefix+'python.exe' as the executable path. It turns out that
1611 sys.prefix+'python.exe' as the executable path. It turns out that
1597 during the post-installation run, sys.executable resolves to the
1612 during the post-installation run, sys.executable resolves to the
1598 name of the binary installer! I should report this as a distutils
1613 name of the binary installer! I should report this as a distutils
1599 bug, I think. I updated the .10 release with this tiny fix, to
1614 bug, I think. I updated the .10 release with this tiny fix, to
1600 avoid annoying the lists further.
1615 avoid annoying the lists further.
1601
1616
1602 2005-01-27 *** Released version 0.6.10
1617 2005-01-27 *** Released version 0.6.10
1603
1618
1604 2005-01-27 Fernando Perez <fperez@colorado.edu>
1619 2005-01-27 Fernando Perez <fperez@colorado.edu>
1605
1620
1606 * IPython/numutils.py (norm): Added 'inf' as optional name for
1621 * IPython/numutils.py (norm): Added 'inf' as optional name for
1607 L-infinity norm, included references to mathworld.com for vector
1622 L-infinity norm, included references to mathworld.com for vector
1608 norm definitions.
1623 norm definitions.
1609 (amin/amax): added amin/amax for array min/max. Similar to what
1624 (amin/amax): added amin/amax for array min/max. Similar to what
1610 pylab ships with after the recent reorganization of names.
1625 pylab ships with after the recent reorganization of names.
1611 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1626 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1612
1627
1613 * ipython.el: committed Alex's recent fixes and improvements.
1628 * ipython.el: committed Alex's recent fixes and improvements.
1614 Tested with python-mode from CVS, and it looks excellent. Since
1629 Tested with python-mode from CVS, and it looks excellent. Since
1615 python-mode hasn't released anything in a while, I'm temporarily
1630 python-mode hasn't released anything in a while, I'm temporarily
1616 putting a copy of today's CVS (v 4.70) of python-mode in:
1631 putting a copy of today's CVS (v 4.70) of python-mode in:
1617 http://ipython.scipy.org/tmp/python-mode.el
1632 http://ipython.scipy.org/tmp/python-mode.el
1618
1633
1619 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1634 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1620 sys.executable for the executable name, instead of assuming it's
1635 sys.executable for the executable name, instead of assuming it's
1621 called 'python.exe' (the post-installer would have produced broken
1636 called 'python.exe' (the post-installer would have produced broken
1622 setups on systems with a differently named python binary).
1637 setups on systems with a differently named python binary).
1623
1638
1624 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1639 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1625 references to os.linesep, to make the code more
1640 references to os.linesep, to make the code more
1626 platform-independent. This is also part of the win32 coloring
1641 platform-independent. This is also part of the win32 coloring
1627 fixes.
1642 fixes.
1628
1643
1629 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1644 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1630 lines, which actually cause coloring bugs because the length of
1645 lines, which actually cause coloring bugs because the length of
1631 the line is very difficult to correctly compute with embedded
1646 the line is very difficult to correctly compute with embedded
1632 escapes. This was the source of all the coloring problems under
1647 escapes. This was the source of all the coloring problems under
1633 Win32. I think that _finally_, Win32 users have a properly
1648 Win32. I think that _finally_, Win32 users have a properly
1634 working ipython in all respects. This would never have happened
1649 working ipython in all respects. This would never have happened
1635 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1650 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1636
1651
1637 2005-01-26 *** Released version 0.6.9
1652 2005-01-26 *** Released version 0.6.9
1638
1653
1639 2005-01-25 Fernando Perez <fperez@colorado.edu>
1654 2005-01-25 Fernando Perez <fperez@colorado.edu>
1640
1655
1641 * setup.py: finally, we have a true Windows installer, thanks to
1656 * setup.py: finally, we have a true Windows installer, thanks to
1642 the excellent work of Viktor Ransmayr
1657 the excellent work of Viktor Ransmayr
1643 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1658 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1644 Windows users. The setup routine is quite a bit cleaner thanks to
1659 Windows users. The setup routine is quite a bit cleaner thanks to
1645 this, and the post-install script uses the proper functions to
1660 this, and the post-install script uses the proper functions to
1646 allow a clean de-installation using the standard Windows Control
1661 allow a clean de-installation using the standard Windows Control
1647 Panel.
1662 Panel.
1648
1663
1649 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1664 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1650 environment variable under all OSes (including win32) if
1665 environment variable under all OSes (including win32) if
1651 available. This will give consistency to win32 users who have set
1666 available. This will give consistency to win32 users who have set
1652 this variable for any reason. If os.environ['HOME'] fails, the
1667 this variable for any reason. If os.environ['HOME'] fails, the
1653 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1668 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1654
1669
1655 2005-01-24 Fernando Perez <fperez@colorado.edu>
1670 2005-01-24 Fernando Perez <fperez@colorado.edu>
1656
1671
1657 * IPython/numutils.py (empty_like): add empty_like(), similar to
1672 * IPython/numutils.py (empty_like): add empty_like(), similar to
1658 zeros_like() but taking advantage of the new empty() Numeric routine.
1673 zeros_like() but taking advantage of the new empty() Numeric routine.
1659
1674
1660 2005-01-23 *** Released version 0.6.8
1675 2005-01-23 *** Released version 0.6.8
1661
1676
1662 2005-01-22 Fernando Perez <fperez@colorado.edu>
1677 2005-01-22 Fernando Perez <fperez@colorado.edu>
1663
1678
1664 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1679 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1665 automatic show() calls. After discussing things with JDH, it
1680 automatic show() calls. After discussing things with JDH, it
1666 turns out there are too many corner cases where this can go wrong.
1681 turns out there are too many corner cases where this can go wrong.
1667 It's best not to try to be 'too smart', and simply have ipython
1682 It's best not to try to be 'too smart', and simply have ipython
1668 reproduce as much as possible the default behavior of a normal
1683 reproduce as much as possible the default behavior of a normal
1669 python shell.
1684 python shell.
1670
1685
1671 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1686 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1672 line-splitting regexp and _prefilter() to avoid calling getattr()
1687 line-splitting regexp and _prefilter() to avoid calling getattr()
1673 on assignments. This closes
1688 on assignments. This closes
1674 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1689 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1675 readline uses getattr(), so a simple <TAB> keypress is still
1690 readline uses getattr(), so a simple <TAB> keypress is still
1676 enough to trigger getattr() calls on an object.
1691 enough to trigger getattr() calls on an object.
1677
1692
1678 2005-01-21 Fernando Perez <fperez@colorado.edu>
1693 2005-01-21 Fernando Perez <fperez@colorado.edu>
1679
1694
1680 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1695 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1681 docstring under pylab so it doesn't mask the original.
1696 docstring under pylab so it doesn't mask the original.
1682
1697
1683 2005-01-21 *** Released version 0.6.7
1698 2005-01-21 *** Released version 0.6.7
1684
1699
1685 2005-01-21 Fernando Perez <fperez@colorado.edu>
1700 2005-01-21 Fernando Perez <fperez@colorado.edu>
1686
1701
1687 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1702 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1688 signal handling for win32 users in multithreaded mode.
1703 signal handling for win32 users in multithreaded mode.
1689
1704
1690 2005-01-17 Fernando Perez <fperez@colorado.edu>
1705 2005-01-17 Fernando Perez <fperez@colorado.edu>
1691
1706
1692 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1707 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1693 instances with no __init__. After a crash report by Norbert Nemec
1708 instances with no __init__. After a crash report by Norbert Nemec
1694 <Norbert-AT-nemec-online.de>.
1709 <Norbert-AT-nemec-online.de>.
1695
1710
1696 2005-01-14 Fernando Perez <fperez@colorado.edu>
1711 2005-01-14 Fernando Perez <fperez@colorado.edu>
1697
1712
1698 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1713 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1699 names for verbose exceptions, when multiple dotted names and the
1714 names for verbose exceptions, when multiple dotted names and the
1700 'parent' object were present on the same line.
1715 'parent' object were present on the same line.
1701
1716
1702 2005-01-11 Fernando Perez <fperez@colorado.edu>
1717 2005-01-11 Fernando Perez <fperez@colorado.edu>
1703
1718
1704 * IPython/genutils.py (flag_calls): new utility to trap and flag
1719 * IPython/genutils.py (flag_calls): new utility to trap and flag
1705 calls in functions. I need it to clean up matplotlib support.
1720 calls in functions. I need it to clean up matplotlib support.
1706 Also removed some deprecated code in genutils.
1721 Also removed some deprecated code in genutils.
1707
1722
1708 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1723 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1709 that matplotlib scripts called with %run, which don't call show()
1724 that matplotlib scripts called with %run, which don't call show()
1710 themselves, still have their plotting windows open.
1725 themselves, still have their plotting windows open.
1711
1726
1712 2005-01-05 Fernando Perez <fperez@colorado.edu>
1727 2005-01-05 Fernando Perez <fperez@colorado.edu>
1713
1728
1714 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1729 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1715 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1730 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1716
1731
1717 2004-12-19 Fernando Perez <fperez@colorado.edu>
1732 2004-12-19 Fernando Perez <fperez@colorado.edu>
1718
1733
1719 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1734 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1720 parent_runcode, which was an eyesore. The same result can be
1735 parent_runcode, which was an eyesore. The same result can be
1721 obtained with Python's regular superclass mechanisms.
1736 obtained with Python's regular superclass mechanisms.
1722
1737
1723 2004-12-17 Fernando Perez <fperez@colorado.edu>
1738 2004-12-17 Fernando Perez <fperez@colorado.edu>
1724
1739
1725 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1740 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1726 reported by Prabhu.
1741 reported by Prabhu.
1727 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1742 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1728 sys.stderr) instead of explicitly calling sys.stderr. This helps
1743 sys.stderr) instead of explicitly calling sys.stderr. This helps
1729 maintain our I/O abstractions clean, for future GUI embeddings.
1744 maintain our I/O abstractions clean, for future GUI embeddings.
1730
1745
1731 * IPython/genutils.py (info): added new utility for sys.stderr
1746 * IPython/genutils.py (info): added new utility for sys.stderr
1732 unified info message handling (thin wrapper around warn()).
1747 unified info message handling (thin wrapper around warn()).
1733
1748
1734 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1749 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1735 composite (dotted) names on verbose exceptions.
1750 composite (dotted) names on verbose exceptions.
1736 (VerboseTB.nullrepr): harden against another kind of errors which
1751 (VerboseTB.nullrepr): harden against another kind of errors which
1737 Python's inspect module can trigger, and which were crashing
1752 Python's inspect module can trigger, and which were crashing
1738 IPython. Thanks to a report by Marco Lombardi
1753 IPython. Thanks to a report by Marco Lombardi
1739 <mlombard-AT-ma010192.hq.eso.org>.
1754 <mlombard-AT-ma010192.hq.eso.org>.
1740
1755
1741 2004-12-13 *** Released version 0.6.6
1756 2004-12-13 *** Released version 0.6.6
1742
1757
1743 2004-12-12 Fernando Perez <fperez@colorado.edu>
1758 2004-12-12 Fernando Perez <fperez@colorado.edu>
1744
1759
1745 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1760 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1746 generated by pygtk upon initialization if it was built without
1761 generated by pygtk upon initialization if it was built without
1747 threads (for matplotlib users). After a crash reported by
1762 threads (for matplotlib users). After a crash reported by
1748 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1763 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1749
1764
1750 * IPython/ipmaker.py (make_IPython): fix small bug in the
1765 * IPython/ipmaker.py (make_IPython): fix small bug in the
1751 import_some parameter for multiple imports.
1766 import_some parameter for multiple imports.
1752
1767
1753 * IPython/iplib.py (ipmagic): simplified the interface of
1768 * IPython/iplib.py (ipmagic): simplified the interface of
1754 ipmagic() to take a single string argument, just as it would be
1769 ipmagic() to take a single string argument, just as it would be
1755 typed at the IPython cmd line.
1770 typed at the IPython cmd line.
1756 (ipalias): Added new ipalias() with an interface identical to
1771 (ipalias): Added new ipalias() with an interface identical to
1757 ipmagic(). This completes exposing a pure python interface to the
1772 ipmagic(). This completes exposing a pure python interface to the
1758 alias and magic system, which can be used in loops or more complex
1773 alias and magic system, which can be used in loops or more complex
1759 code where IPython's automatic line mangling is not active.
1774 code where IPython's automatic line mangling is not active.
1760
1775
1761 * IPython/genutils.py (timing): changed interface of timing to
1776 * IPython/genutils.py (timing): changed interface of timing to
1762 simply run code once, which is the most common case. timings()
1777 simply run code once, which is the most common case. timings()
1763 remains unchanged, for the cases where you want multiple runs.
1778 remains unchanged, for the cases where you want multiple runs.
1764
1779
1765 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1780 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1766 bug where Python2.2 crashes with exec'ing code which does not end
1781 bug where Python2.2 crashes with exec'ing code which does not end
1767 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1782 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1768 before.
1783 before.
1769
1784
1770 2004-12-10 Fernando Perez <fperez@colorado.edu>
1785 2004-12-10 Fernando Perez <fperez@colorado.edu>
1771
1786
1772 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1787 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1773 -t to -T, to accomodate the new -t flag in %run (the %run and
1788 -t to -T, to accomodate the new -t flag in %run (the %run and
1774 %prun options are kind of intermixed, and it's not easy to change
1789 %prun options are kind of intermixed, and it's not easy to change
1775 this with the limitations of python's getopt).
1790 this with the limitations of python's getopt).
1776
1791
1777 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1792 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1778 the execution of scripts. It's not as fine-tuned as timeit.py,
1793 the execution of scripts. It's not as fine-tuned as timeit.py,
1779 but it works from inside ipython (and under 2.2, which lacks
1794 but it works from inside ipython (and under 2.2, which lacks
1780 timeit.py). Optionally a number of runs > 1 can be given for
1795 timeit.py). Optionally a number of runs > 1 can be given for
1781 timing very short-running code.
1796 timing very short-running code.
1782
1797
1783 * IPython/genutils.py (uniq_stable): new routine which returns a
1798 * IPython/genutils.py (uniq_stable): new routine which returns a
1784 list of unique elements in any iterable, but in stable order of
1799 list of unique elements in any iterable, but in stable order of
1785 appearance. I needed this for the ultraTB fixes, and it's a handy
1800 appearance. I needed this for the ultraTB fixes, and it's a handy
1786 utility.
1801 utility.
1787
1802
1788 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1803 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1789 dotted names in Verbose exceptions. This had been broken since
1804 dotted names in Verbose exceptions. This had been broken since
1790 the very start, now x.y will properly be printed in a Verbose
1805 the very start, now x.y will properly be printed in a Verbose
1791 traceback, instead of x being shown and y appearing always as an
1806 traceback, instead of x being shown and y appearing always as an
1792 'undefined global'. Getting this to work was a bit tricky,
1807 'undefined global'. Getting this to work was a bit tricky,
1793 because by default python tokenizers are stateless. Saved by
1808 because by default python tokenizers are stateless. Saved by
1794 python's ability to easily add a bit of state to an arbitrary
1809 python's ability to easily add a bit of state to an arbitrary
1795 function (without needing to build a full-blown callable object).
1810 function (without needing to build a full-blown callable object).
1796
1811
1797 Also big cleanup of this code, which had horrendous runtime
1812 Also big cleanup of this code, which had horrendous runtime
1798 lookups of zillions of attributes for colorization. Moved all
1813 lookups of zillions of attributes for colorization. Moved all
1799 this code into a few templates, which make it cleaner and quicker.
1814 this code into a few templates, which make it cleaner and quicker.
1800
1815
1801 Printout quality was also improved for Verbose exceptions: one
1816 Printout quality was also improved for Verbose exceptions: one
1802 variable per line, and memory addresses are printed (this can be
1817 variable per line, and memory addresses are printed (this can be
1803 quite handy in nasty debugging situations, which is what Verbose
1818 quite handy in nasty debugging situations, which is what Verbose
1804 is for).
1819 is for).
1805
1820
1806 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1821 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1807 the command line as scripts to be loaded by embedded instances.
1822 the command line as scripts to be loaded by embedded instances.
1808 Doing so has the potential for an infinite recursion if there are
1823 Doing so has the potential for an infinite recursion if there are
1809 exceptions thrown in the process. This fixes a strange crash
1824 exceptions thrown in the process. This fixes a strange crash
1810 reported by Philippe MULLER <muller-AT-irit.fr>.
1825 reported by Philippe MULLER <muller-AT-irit.fr>.
1811
1826
1812 2004-12-09 Fernando Perez <fperez@colorado.edu>
1827 2004-12-09 Fernando Perez <fperez@colorado.edu>
1813
1828
1814 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1829 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1815 to reflect new names in matplotlib, which now expose the
1830 to reflect new names in matplotlib, which now expose the
1816 matlab-compatible interface via a pylab module instead of the
1831 matlab-compatible interface via a pylab module instead of the
1817 'matlab' name. The new code is backwards compatible, so users of
1832 'matlab' name. The new code is backwards compatible, so users of
1818 all matplotlib versions are OK. Patch by J. Hunter.
1833 all matplotlib versions are OK. Patch by J. Hunter.
1819
1834
1820 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1835 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1821 of __init__ docstrings for instances (class docstrings are already
1836 of __init__ docstrings for instances (class docstrings are already
1822 automatically printed). Instances with customized docstrings
1837 automatically printed). Instances with customized docstrings
1823 (indep. of the class) are also recognized and all 3 separate
1838 (indep. of the class) are also recognized and all 3 separate
1824 docstrings are printed (instance, class, constructor). After some
1839 docstrings are printed (instance, class, constructor). After some
1825 comments/suggestions by J. Hunter.
1840 comments/suggestions by J. Hunter.
1826
1841
1827 2004-12-05 Fernando Perez <fperez@colorado.edu>
1842 2004-12-05 Fernando Perez <fperez@colorado.edu>
1828
1843
1829 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1844 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1830 warnings when tab-completion fails and triggers an exception.
1845 warnings when tab-completion fails and triggers an exception.
1831
1846
1832 2004-12-03 Fernando Perez <fperez@colorado.edu>
1847 2004-12-03 Fernando Perez <fperez@colorado.edu>
1833
1848
1834 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1849 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1835 be triggered when using 'run -p'. An incorrect option flag was
1850 be triggered when using 'run -p'. An incorrect option flag was
1836 being set ('d' instead of 'D').
1851 being set ('d' instead of 'D').
1837 (manpage): fix missing escaped \- sign.
1852 (manpage): fix missing escaped \- sign.
1838
1853
1839 2004-11-30 *** Released version 0.6.5
1854 2004-11-30 *** Released version 0.6.5
1840
1855
1841 2004-11-30 Fernando Perez <fperez@colorado.edu>
1856 2004-11-30 Fernando Perez <fperez@colorado.edu>
1842
1857
1843 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1858 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1844 setting with -d option.
1859 setting with -d option.
1845
1860
1846 * setup.py (docfiles): Fix problem where the doc glob I was using
1861 * setup.py (docfiles): Fix problem where the doc glob I was using
1847 was COMPLETELY BROKEN. It was giving the right files by pure
1862 was COMPLETELY BROKEN. It was giving the right files by pure
1848 accident, but failed once I tried to include ipython.el. Note:
1863 accident, but failed once I tried to include ipython.el. Note:
1849 glob() does NOT allow you to do exclusion on multiple endings!
1864 glob() does NOT allow you to do exclusion on multiple endings!
1850
1865
1851 2004-11-29 Fernando Perez <fperez@colorado.edu>
1866 2004-11-29 Fernando Perez <fperez@colorado.edu>
1852
1867
1853 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1868 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1854 the manpage as the source. Better formatting & consistency.
1869 the manpage as the source. Better formatting & consistency.
1855
1870
1856 * IPython/Magic.py (magic_run): Added new -d option, to run
1871 * IPython/Magic.py (magic_run): Added new -d option, to run
1857 scripts under the control of the python pdb debugger. Note that
1872 scripts under the control of the python pdb debugger. Note that
1858 this required changing the %prun option -d to -D, to avoid a clash
1873 this required changing the %prun option -d to -D, to avoid a clash
1859 (since %run must pass options to %prun, and getopt is too dumb to
1874 (since %run must pass options to %prun, and getopt is too dumb to
1860 handle options with string values with embedded spaces). Thanks
1875 handle options with string values with embedded spaces). Thanks
1861 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1876 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1862 (magic_who_ls): added type matching to %who and %whos, so that one
1877 (magic_who_ls): added type matching to %who and %whos, so that one
1863 can filter their output to only include variables of certain
1878 can filter their output to only include variables of certain
1864 types. Another suggestion by Matthew.
1879 types. Another suggestion by Matthew.
1865 (magic_whos): Added memory summaries in kb and Mb for arrays.
1880 (magic_whos): Added memory summaries in kb and Mb for arrays.
1866 (magic_who): Improve formatting (break lines every 9 vars).
1881 (magic_who): Improve formatting (break lines every 9 vars).
1867
1882
1868 2004-11-28 Fernando Perez <fperez@colorado.edu>
1883 2004-11-28 Fernando Perez <fperez@colorado.edu>
1869
1884
1870 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1885 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1871 cache when empty lines were present.
1886 cache when empty lines were present.
1872
1887
1873 2004-11-24 Fernando Perez <fperez@colorado.edu>
1888 2004-11-24 Fernando Perez <fperez@colorado.edu>
1874
1889
1875 * IPython/usage.py (__doc__): document the re-activated threading
1890 * IPython/usage.py (__doc__): document the re-activated threading
1876 options for WX and GTK.
1891 options for WX and GTK.
1877
1892
1878 2004-11-23 Fernando Perez <fperez@colorado.edu>
1893 2004-11-23 Fernando Perez <fperez@colorado.edu>
1879
1894
1880 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1895 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1881 the -wthread and -gthread options, along with a new -tk one to try
1896 the -wthread and -gthread options, along with a new -tk one to try
1882 and coordinate Tk threading with wx/gtk. The tk support is very
1897 and coordinate Tk threading with wx/gtk. The tk support is very
1883 platform dependent, since it seems to require Tcl and Tk to be
1898 platform dependent, since it seems to require Tcl and Tk to be
1884 built with threads (Fedora1/2 appears NOT to have it, but in
1899 built with threads (Fedora1/2 appears NOT to have it, but in
1885 Prabhu's Debian boxes it works OK). But even with some Tk
1900 Prabhu's Debian boxes it works OK). But even with some Tk
1886 limitations, this is a great improvement.
1901 limitations, this is a great improvement.
1887
1902
1888 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1903 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1889 info in user prompts. Patch by Prabhu.
1904 info in user prompts. Patch by Prabhu.
1890
1905
1891 2004-11-18 Fernando Perez <fperez@colorado.edu>
1906 2004-11-18 Fernando Perez <fperez@colorado.edu>
1892
1907
1893 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1908 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1894 EOFErrors and bail, to avoid infinite loops if a non-terminating
1909 EOFErrors and bail, to avoid infinite loops if a non-terminating
1895 file is fed into ipython. Patch submitted in issue 19 by user,
1910 file is fed into ipython. Patch submitted in issue 19 by user,
1896 many thanks.
1911 many thanks.
1897
1912
1898 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1913 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1899 autoquote/parens in continuation prompts, which can cause lots of
1914 autoquote/parens in continuation prompts, which can cause lots of
1900 problems. Closes roundup issue 20.
1915 problems. Closes roundup issue 20.
1901
1916
1902 2004-11-17 Fernando Perez <fperez@colorado.edu>
1917 2004-11-17 Fernando Perez <fperez@colorado.edu>
1903
1918
1904 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1919 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1905 reported as debian bug #280505. I'm not sure my local changelog
1920 reported as debian bug #280505. I'm not sure my local changelog
1906 entry has the proper debian format (Jack?).
1921 entry has the proper debian format (Jack?).
1907
1922
1908 2004-11-08 *** Released version 0.6.4
1923 2004-11-08 *** Released version 0.6.4
1909
1924
1910 2004-11-08 Fernando Perez <fperez@colorado.edu>
1925 2004-11-08 Fernando Perez <fperez@colorado.edu>
1911
1926
1912 * IPython/iplib.py (init_readline): Fix exit message for Windows
1927 * IPython/iplib.py (init_readline): Fix exit message for Windows
1913 when readline is active. Thanks to a report by Eric Jones
1928 when readline is active. Thanks to a report by Eric Jones
1914 <eric-AT-enthought.com>.
1929 <eric-AT-enthought.com>.
1915
1930
1916 2004-11-07 Fernando Perez <fperez@colorado.edu>
1931 2004-11-07 Fernando Perez <fperez@colorado.edu>
1917
1932
1918 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1933 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1919 sometimes seen by win2k/cygwin users.
1934 sometimes seen by win2k/cygwin users.
1920
1935
1921 2004-11-06 Fernando Perez <fperez@colorado.edu>
1936 2004-11-06 Fernando Perez <fperez@colorado.edu>
1922
1937
1923 * IPython/iplib.py (interact): Change the handling of %Exit from
1938 * IPython/iplib.py (interact): Change the handling of %Exit from
1924 trying to propagate a SystemExit to an internal ipython flag.
1939 trying to propagate a SystemExit to an internal ipython flag.
1925 This is less elegant than using Python's exception mechanism, but
1940 This is less elegant than using Python's exception mechanism, but
1926 I can't get that to work reliably with threads, so under -pylab
1941 I can't get that to work reliably with threads, so under -pylab
1927 %Exit was hanging IPython. Cross-thread exception handling is
1942 %Exit was hanging IPython. Cross-thread exception handling is
1928 really a bitch. Thaks to a bug report by Stephen Walton
1943 really a bitch. Thaks to a bug report by Stephen Walton
1929 <stephen.walton-AT-csun.edu>.
1944 <stephen.walton-AT-csun.edu>.
1930
1945
1931 2004-11-04 Fernando Perez <fperez@colorado.edu>
1946 2004-11-04 Fernando Perez <fperez@colorado.edu>
1932
1947
1933 * IPython/iplib.py (raw_input_original): store a pointer to the
1948 * IPython/iplib.py (raw_input_original): store a pointer to the
1934 true raw_input to harden against code which can modify it
1949 true raw_input to harden against code which can modify it
1935 (wx.py.PyShell does this and would otherwise crash ipython).
1950 (wx.py.PyShell does this and would otherwise crash ipython).
1936 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1951 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1937
1952
1938 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1953 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1939 Ctrl-C problem, which does not mess up the input line.
1954 Ctrl-C problem, which does not mess up the input line.
1940
1955
1941 2004-11-03 Fernando Perez <fperez@colorado.edu>
1956 2004-11-03 Fernando Perez <fperez@colorado.edu>
1942
1957
1943 * IPython/Release.py: Changed licensing to BSD, in all files.
1958 * IPython/Release.py: Changed licensing to BSD, in all files.
1944 (name): lowercase name for tarball/RPM release.
1959 (name): lowercase name for tarball/RPM release.
1945
1960
1946 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1961 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1947 use throughout ipython.
1962 use throughout ipython.
1948
1963
1949 * IPython/Magic.py (Magic._ofind): Switch to using the new
1964 * IPython/Magic.py (Magic._ofind): Switch to using the new
1950 OInspect.getdoc() function.
1965 OInspect.getdoc() function.
1951
1966
1952 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1967 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1953 of the line currently being canceled via Ctrl-C. It's extremely
1968 of the line currently being canceled via Ctrl-C. It's extremely
1954 ugly, but I don't know how to do it better (the problem is one of
1969 ugly, but I don't know how to do it better (the problem is one of
1955 handling cross-thread exceptions).
1970 handling cross-thread exceptions).
1956
1971
1957 2004-10-28 Fernando Perez <fperez@colorado.edu>
1972 2004-10-28 Fernando Perez <fperez@colorado.edu>
1958
1973
1959 * IPython/Shell.py (signal_handler): add signal handlers to trap
1974 * IPython/Shell.py (signal_handler): add signal handlers to trap
1960 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1975 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1961 report by Francesc Alted.
1976 report by Francesc Alted.
1962
1977
1963 2004-10-21 Fernando Perez <fperez@colorado.edu>
1978 2004-10-21 Fernando Perez <fperez@colorado.edu>
1964
1979
1965 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1980 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1966 to % for pysh syntax extensions.
1981 to % for pysh syntax extensions.
1967
1982
1968 2004-10-09 Fernando Perez <fperez@colorado.edu>
1983 2004-10-09 Fernando Perez <fperez@colorado.edu>
1969
1984
1970 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1985 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1971 arrays to print a more useful summary, without calling str(arr).
1986 arrays to print a more useful summary, without calling str(arr).
1972 This avoids the problem of extremely lengthy computations which
1987 This avoids the problem of extremely lengthy computations which
1973 occur if arr is large, and appear to the user as a system lockup
1988 occur if arr is large, and appear to the user as a system lockup
1974 with 100% cpu activity. After a suggestion by Kristian Sandberg
1989 with 100% cpu activity. After a suggestion by Kristian Sandberg
1975 <Kristian.Sandberg@colorado.edu>.
1990 <Kristian.Sandberg@colorado.edu>.
1976 (Magic.__init__): fix bug in global magic escapes not being
1991 (Magic.__init__): fix bug in global magic escapes not being
1977 correctly set.
1992 correctly set.
1978
1993
1979 2004-10-08 Fernando Perez <fperez@colorado.edu>
1994 2004-10-08 Fernando Perez <fperez@colorado.edu>
1980
1995
1981 * IPython/Magic.py (__license__): change to absolute imports of
1996 * IPython/Magic.py (__license__): change to absolute imports of
1982 ipython's own internal packages, to start adapting to the absolute
1997 ipython's own internal packages, to start adapting to the absolute
1983 import requirement of PEP-328.
1998 import requirement of PEP-328.
1984
1999
1985 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2000 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1986 files, and standardize author/license marks through the Release
2001 files, and standardize author/license marks through the Release
1987 module instead of having per/file stuff (except for files with
2002 module instead of having per/file stuff (except for files with
1988 particular licenses, like the MIT/PSF-licensed codes).
2003 particular licenses, like the MIT/PSF-licensed codes).
1989
2004
1990 * IPython/Debugger.py: remove dead code for python 2.1
2005 * IPython/Debugger.py: remove dead code for python 2.1
1991
2006
1992 2004-10-04 Fernando Perez <fperez@colorado.edu>
2007 2004-10-04 Fernando Perez <fperez@colorado.edu>
1993
2008
1994 * IPython/iplib.py (ipmagic): New function for accessing magics
2009 * IPython/iplib.py (ipmagic): New function for accessing magics
1995 via a normal python function call.
2010 via a normal python function call.
1996
2011
1997 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2012 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1998 from '@' to '%', to accomodate the new @decorator syntax of python
2013 from '@' to '%', to accomodate the new @decorator syntax of python
1999 2.4.
2014 2.4.
2000
2015
2001 2004-09-29 Fernando Perez <fperez@colorado.edu>
2016 2004-09-29 Fernando Perez <fperez@colorado.edu>
2002
2017
2003 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2018 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2004 matplotlib.use to prevent running scripts which try to switch
2019 matplotlib.use to prevent running scripts which try to switch
2005 interactive backends from within ipython. This will just crash
2020 interactive backends from within ipython. This will just crash
2006 the python interpreter, so we can't allow it (but a detailed error
2021 the python interpreter, so we can't allow it (but a detailed error
2007 is given to the user).
2022 is given to the user).
2008
2023
2009 2004-09-28 Fernando Perez <fperez@colorado.edu>
2024 2004-09-28 Fernando Perez <fperez@colorado.edu>
2010
2025
2011 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2026 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2012 matplotlib-related fixes so that using @run with non-matplotlib
2027 matplotlib-related fixes so that using @run with non-matplotlib
2013 scripts doesn't pop up spurious plot windows. This requires
2028 scripts doesn't pop up spurious plot windows. This requires
2014 matplotlib >= 0.63, where I had to make some changes as well.
2029 matplotlib >= 0.63, where I had to make some changes as well.
2015
2030
2016 * IPython/ipmaker.py (make_IPython): update version requirement to
2031 * IPython/ipmaker.py (make_IPython): update version requirement to
2017 python 2.2.
2032 python 2.2.
2018
2033
2019 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2034 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2020 banner arg for embedded customization.
2035 banner arg for embedded customization.
2021
2036
2022 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2037 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2023 explicit uses of __IP as the IPython's instance name. Now things
2038 explicit uses of __IP as the IPython's instance name. Now things
2024 are properly handled via the shell.name value. The actual code
2039 are properly handled via the shell.name value. The actual code
2025 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2040 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2026 is much better than before. I'll clean things completely when the
2041 is much better than before. I'll clean things completely when the
2027 magic stuff gets a real overhaul.
2042 magic stuff gets a real overhaul.
2028
2043
2029 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2044 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2030 minor changes to debian dir.
2045 minor changes to debian dir.
2031
2046
2032 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2047 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2033 pointer to the shell itself in the interactive namespace even when
2048 pointer to the shell itself in the interactive namespace even when
2034 a user-supplied dict is provided. This is needed for embedding
2049 a user-supplied dict is provided. This is needed for embedding
2035 purposes (found by tests with Michel Sanner).
2050 purposes (found by tests with Michel Sanner).
2036
2051
2037 2004-09-27 Fernando Perez <fperez@colorado.edu>
2052 2004-09-27 Fernando Perez <fperez@colorado.edu>
2038
2053
2039 * IPython/UserConfig/ipythonrc: remove []{} from
2054 * IPython/UserConfig/ipythonrc: remove []{} from
2040 readline_remove_delims, so that things like [modname.<TAB> do
2055 readline_remove_delims, so that things like [modname.<TAB> do
2041 proper completion. This disables [].TAB, but that's a less common
2056 proper completion. This disables [].TAB, but that's a less common
2042 case than module names in list comprehensions, for example.
2057 case than module names in list comprehensions, for example.
2043 Thanks to a report by Andrea Riciputi.
2058 Thanks to a report by Andrea Riciputi.
2044
2059
2045 2004-09-09 Fernando Perez <fperez@colorado.edu>
2060 2004-09-09 Fernando Perez <fperez@colorado.edu>
2046
2061
2047 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2062 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2048 blocking problems in win32 and osx. Fix by John.
2063 blocking problems in win32 and osx. Fix by John.
2049
2064
2050 2004-09-08 Fernando Perez <fperez@colorado.edu>
2065 2004-09-08 Fernando Perez <fperez@colorado.edu>
2051
2066
2052 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2067 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2053 for Win32 and OSX. Fix by John Hunter.
2068 for Win32 and OSX. Fix by John Hunter.
2054
2069
2055 2004-08-30 *** Released version 0.6.3
2070 2004-08-30 *** Released version 0.6.3
2056
2071
2057 2004-08-30 Fernando Perez <fperez@colorado.edu>
2072 2004-08-30 Fernando Perez <fperez@colorado.edu>
2058
2073
2059 * setup.py (isfile): Add manpages to list of dependent files to be
2074 * setup.py (isfile): Add manpages to list of dependent files to be
2060 updated.
2075 updated.
2061
2076
2062 2004-08-27 Fernando Perez <fperez@colorado.edu>
2077 2004-08-27 Fernando Perez <fperez@colorado.edu>
2063
2078
2064 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2079 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2065 for now. They don't really work with standalone WX/GTK code
2080 for now. They don't really work with standalone WX/GTK code
2066 (though matplotlib IS working fine with both of those backends).
2081 (though matplotlib IS working fine with both of those backends).
2067 This will neeed much more testing. I disabled most things with
2082 This will neeed much more testing. I disabled most things with
2068 comments, so turning it back on later should be pretty easy.
2083 comments, so turning it back on later should be pretty easy.
2069
2084
2070 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2085 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2071 autocalling of expressions like r'foo', by modifying the line
2086 autocalling of expressions like r'foo', by modifying the line
2072 split regexp. Closes
2087 split regexp. Closes
2073 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2088 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2074 Riley <ipythonbugs-AT-sabi.net>.
2089 Riley <ipythonbugs-AT-sabi.net>.
2075 (InteractiveShell.mainloop): honor --nobanner with banner
2090 (InteractiveShell.mainloop): honor --nobanner with banner
2076 extensions.
2091 extensions.
2077
2092
2078 * IPython/Shell.py: Significant refactoring of all classes, so
2093 * IPython/Shell.py: Significant refactoring of all classes, so
2079 that we can really support ALL matplotlib backends and threading
2094 that we can really support ALL matplotlib backends and threading
2080 models (John spotted a bug with Tk which required this). Now we
2095 models (John spotted a bug with Tk which required this). Now we
2081 should support single-threaded, WX-threads and GTK-threads, both
2096 should support single-threaded, WX-threads and GTK-threads, both
2082 for generic code and for matplotlib.
2097 for generic code and for matplotlib.
2083
2098
2084 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2099 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2085 -pylab, to simplify things for users. Will also remove the pylab
2100 -pylab, to simplify things for users. Will also remove the pylab
2086 profile, since now all of matplotlib configuration is directly
2101 profile, since now all of matplotlib configuration is directly
2087 handled here. This also reduces startup time.
2102 handled here. This also reduces startup time.
2088
2103
2089 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2104 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2090 shell wasn't being correctly called. Also in IPShellWX.
2105 shell wasn't being correctly called. Also in IPShellWX.
2091
2106
2092 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2107 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2093 fine-tune banner.
2108 fine-tune banner.
2094
2109
2095 * IPython/numutils.py (spike): Deprecate these spike functions,
2110 * IPython/numutils.py (spike): Deprecate these spike functions,
2096 delete (long deprecated) gnuplot_exec handler.
2111 delete (long deprecated) gnuplot_exec handler.
2097
2112
2098 2004-08-26 Fernando Perez <fperez@colorado.edu>
2113 2004-08-26 Fernando Perez <fperez@colorado.edu>
2099
2114
2100 * ipython.1: Update for threading options, plus some others which
2115 * ipython.1: Update for threading options, plus some others which
2101 were missing.
2116 were missing.
2102
2117
2103 * IPython/ipmaker.py (__call__): Added -wthread option for
2118 * IPython/ipmaker.py (__call__): Added -wthread option for
2104 wxpython thread handling. Make sure threading options are only
2119 wxpython thread handling. Make sure threading options are only
2105 valid at the command line.
2120 valid at the command line.
2106
2121
2107 * scripts/ipython: moved shell selection into a factory function
2122 * scripts/ipython: moved shell selection into a factory function
2108 in Shell.py, to keep the starter script to a minimum.
2123 in Shell.py, to keep the starter script to a minimum.
2109
2124
2110 2004-08-25 Fernando Perez <fperez@colorado.edu>
2125 2004-08-25 Fernando Perez <fperez@colorado.edu>
2111
2126
2112 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2127 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2113 John. Along with some recent changes he made to matplotlib, the
2128 John. Along with some recent changes he made to matplotlib, the
2114 next versions of both systems should work very well together.
2129 next versions of both systems should work very well together.
2115
2130
2116 2004-08-24 Fernando Perez <fperez@colorado.edu>
2131 2004-08-24 Fernando Perez <fperez@colorado.edu>
2117
2132
2118 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2133 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2119 tried to switch the profiling to using hotshot, but I'm getting
2134 tried to switch the profiling to using hotshot, but I'm getting
2120 strange errors from prof.runctx() there. I may be misreading the
2135 strange errors from prof.runctx() there. I may be misreading the
2121 docs, but it looks weird. For now the profiling code will
2136 docs, but it looks weird. For now the profiling code will
2122 continue to use the standard profiler.
2137 continue to use the standard profiler.
2123
2138
2124 2004-08-23 Fernando Perez <fperez@colorado.edu>
2139 2004-08-23 Fernando Perez <fperez@colorado.edu>
2125
2140
2126 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2141 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2127 threaded shell, by John Hunter. It's not quite ready yet, but
2142 threaded shell, by John Hunter. It's not quite ready yet, but
2128 close.
2143 close.
2129
2144
2130 2004-08-22 Fernando Perez <fperez@colorado.edu>
2145 2004-08-22 Fernando Perez <fperez@colorado.edu>
2131
2146
2132 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2147 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2133 in Magic and ultraTB.
2148 in Magic and ultraTB.
2134
2149
2135 * ipython.1: document threading options in manpage.
2150 * ipython.1: document threading options in manpage.
2136
2151
2137 * scripts/ipython: Changed name of -thread option to -gthread,
2152 * scripts/ipython: Changed name of -thread option to -gthread,
2138 since this is GTK specific. I want to leave the door open for a
2153 since this is GTK specific. I want to leave the door open for a
2139 -wthread option for WX, which will most likely be necessary. This
2154 -wthread option for WX, which will most likely be necessary. This
2140 change affects usage and ipmaker as well.
2155 change affects usage and ipmaker as well.
2141
2156
2142 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2157 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2143 handle the matplotlib shell issues. Code by John Hunter
2158 handle the matplotlib shell issues. Code by John Hunter
2144 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2159 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2145 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2160 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2146 broken (and disabled for end users) for now, but it puts the
2161 broken (and disabled for end users) for now, but it puts the
2147 infrastructure in place.
2162 infrastructure in place.
2148
2163
2149 2004-08-21 Fernando Perez <fperez@colorado.edu>
2164 2004-08-21 Fernando Perez <fperez@colorado.edu>
2150
2165
2151 * ipythonrc-pylab: Add matplotlib support.
2166 * ipythonrc-pylab: Add matplotlib support.
2152
2167
2153 * matplotlib_config.py: new files for matplotlib support, part of
2168 * matplotlib_config.py: new files for matplotlib support, part of
2154 the pylab profile.
2169 the pylab profile.
2155
2170
2156 * IPython/usage.py (__doc__): documented the threading options.
2171 * IPython/usage.py (__doc__): documented the threading options.
2157
2172
2158 2004-08-20 Fernando Perez <fperez@colorado.edu>
2173 2004-08-20 Fernando Perez <fperez@colorado.edu>
2159
2174
2160 * ipython: Modified the main calling routine to handle the -thread
2175 * ipython: Modified the main calling routine to handle the -thread
2161 and -mpthread options. This needs to be done as a top-level hack,
2176 and -mpthread options. This needs to be done as a top-level hack,
2162 because it determines which class to instantiate for IPython
2177 because it determines which class to instantiate for IPython
2163 itself.
2178 itself.
2164
2179
2165 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2180 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2166 classes to support multithreaded GTK operation without blocking,
2181 classes to support multithreaded GTK operation without blocking,
2167 and matplotlib with all backends. This is a lot of still very
2182 and matplotlib with all backends. This is a lot of still very
2168 experimental code, and threads are tricky. So it may still have a
2183 experimental code, and threads are tricky. So it may still have a
2169 few rough edges... This code owes a lot to
2184 few rough edges... This code owes a lot to
2170 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2185 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2171 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2186 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2172 to John Hunter for all the matplotlib work.
2187 to John Hunter for all the matplotlib work.
2173
2188
2174 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2189 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2175 options for gtk thread and matplotlib support.
2190 options for gtk thread and matplotlib support.
2176
2191
2177 2004-08-16 Fernando Perez <fperez@colorado.edu>
2192 2004-08-16 Fernando Perez <fperez@colorado.edu>
2178
2193
2179 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2194 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2180 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2195 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2181 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2196 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2182
2197
2183 2004-08-11 Fernando Perez <fperez@colorado.edu>
2198 2004-08-11 Fernando Perez <fperez@colorado.edu>
2184
2199
2185 * setup.py (isfile): Fix build so documentation gets updated for
2200 * setup.py (isfile): Fix build so documentation gets updated for
2186 rpms (it was only done for .tgz builds).
2201 rpms (it was only done for .tgz builds).
2187
2202
2188 2004-08-10 Fernando Perez <fperez@colorado.edu>
2203 2004-08-10 Fernando Perez <fperez@colorado.edu>
2189
2204
2190 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2205 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2191
2206
2192 * iplib.py : Silence syntax error exceptions in tab-completion.
2207 * iplib.py : Silence syntax error exceptions in tab-completion.
2193
2208
2194 2004-08-05 Fernando Perez <fperez@colorado.edu>
2209 2004-08-05 Fernando Perez <fperez@colorado.edu>
2195
2210
2196 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2211 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2197 'color off' mark for continuation prompts. This was causing long
2212 'color off' mark for continuation prompts. This was causing long
2198 continuation lines to mis-wrap.
2213 continuation lines to mis-wrap.
2199
2214
2200 2004-08-01 Fernando Perez <fperez@colorado.edu>
2215 2004-08-01 Fernando Perez <fperez@colorado.edu>
2201
2216
2202 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2217 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2203 for building ipython to be a parameter. All this is necessary
2218 for building ipython to be a parameter. All this is necessary
2204 right now to have a multithreaded version, but this insane
2219 right now to have a multithreaded version, but this insane
2205 non-design will be cleaned up soon. For now, it's a hack that
2220 non-design will be cleaned up soon. For now, it's a hack that
2206 works.
2221 works.
2207
2222
2208 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2223 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2209 args in various places. No bugs so far, but it's a dangerous
2224 args in various places. No bugs so far, but it's a dangerous
2210 practice.
2225 practice.
2211
2226
2212 2004-07-31 Fernando Perez <fperez@colorado.edu>
2227 2004-07-31 Fernando Perez <fperez@colorado.edu>
2213
2228
2214 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2229 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2215 fix completion of files with dots in their names under most
2230 fix completion of files with dots in their names under most
2216 profiles (pysh was OK because the completion order is different).
2231 profiles (pysh was OK because the completion order is different).
2217
2232
2218 2004-07-27 Fernando Perez <fperez@colorado.edu>
2233 2004-07-27 Fernando Perez <fperez@colorado.edu>
2219
2234
2220 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2235 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2221 keywords manually, b/c the one in keyword.py was removed in python
2236 keywords manually, b/c the one in keyword.py was removed in python
2222 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2237 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2223 This is NOT a bug under python 2.3 and earlier.
2238 This is NOT a bug under python 2.3 and earlier.
2224
2239
2225 2004-07-26 Fernando Perez <fperez@colorado.edu>
2240 2004-07-26 Fernando Perez <fperez@colorado.edu>
2226
2241
2227 * IPython/ultraTB.py (VerboseTB.text): Add another
2242 * IPython/ultraTB.py (VerboseTB.text): Add another
2228 linecache.checkcache() call to try to prevent inspect.py from
2243 linecache.checkcache() call to try to prevent inspect.py from
2229 crashing under python 2.3. I think this fixes
2244 crashing under python 2.3. I think this fixes
2230 http://www.scipy.net/roundup/ipython/issue17.
2245 http://www.scipy.net/roundup/ipython/issue17.
2231
2246
2232 2004-07-26 *** Released version 0.6.2
2247 2004-07-26 *** Released version 0.6.2
2233
2248
2234 2004-07-26 Fernando Perez <fperez@colorado.edu>
2249 2004-07-26 Fernando Perez <fperez@colorado.edu>
2235
2250
2236 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2251 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2237 fail for any number.
2252 fail for any number.
2238 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2253 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2239 empty bookmarks.
2254 empty bookmarks.
2240
2255
2241 2004-07-26 *** Released version 0.6.1
2256 2004-07-26 *** Released version 0.6.1
2242
2257
2243 2004-07-26 Fernando Perez <fperez@colorado.edu>
2258 2004-07-26 Fernando Perez <fperez@colorado.edu>
2244
2259
2245 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2260 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2246
2261
2247 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2262 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2248 escaping '()[]{}' in filenames.
2263 escaping '()[]{}' in filenames.
2249
2264
2250 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2265 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2251 Python 2.2 users who lack a proper shlex.split.
2266 Python 2.2 users who lack a proper shlex.split.
2252
2267
2253 2004-07-19 Fernando Perez <fperez@colorado.edu>
2268 2004-07-19 Fernando Perez <fperez@colorado.edu>
2254
2269
2255 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2270 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2256 for reading readline's init file. I follow the normal chain:
2271 for reading readline's init file. I follow the normal chain:
2257 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2272 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2258 report by Mike Heeter. This closes
2273 report by Mike Heeter. This closes
2259 http://www.scipy.net/roundup/ipython/issue16.
2274 http://www.scipy.net/roundup/ipython/issue16.
2260
2275
2261 2004-07-18 Fernando Perez <fperez@colorado.edu>
2276 2004-07-18 Fernando Perez <fperez@colorado.edu>
2262
2277
2263 * IPython/iplib.py (__init__): Add better handling of '\' under
2278 * IPython/iplib.py (__init__): Add better handling of '\' under
2264 Win32 for filenames. After a patch by Ville.
2279 Win32 for filenames. After a patch by Ville.
2265
2280
2266 2004-07-17 Fernando Perez <fperez@colorado.edu>
2281 2004-07-17 Fernando Perez <fperez@colorado.edu>
2267
2282
2268 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2283 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2269 autocalling would be triggered for 'foo is bar' if foo is
2284 autocalling would be triggered for 'foo is bar' if foo is
2270 callable. I also cleaned up the autocall detection code to use a
2285 callable. I also cleaned up the autocall detection code to use a
2271 regexp, which is faster. Bug reported by Alexander Schmolck.
2286 regexp, which is faster. Bug reported by Alexander Schmolck.
2272
2287
2273 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2288 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2274 '?' in them would confuse the help system. Reported by Alex
2289 '?' in them would confuse the help system. Reported by Alex
2275 Schmolck.
2290 Schmolck.
2276
2291
2277 2004-07-16 Fernando Perez <fperez@colorado.edu>
2292 2004-07-16 Fernando Perez <fperez@colorado.edu>
2278
2293
2279 * IPython/GnuplotInteractive.py (__all__): added plot2.
2294 * IPython/GnuplotInteractive.py (__all__): added plot2.
2280
2295
2281 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2296 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2282 plotting dictionaries, lists or tuples of 1d arrays.
2297 plotting dictionaries, lists or tuples of 1d arrays.
2283
2298
2284 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2299 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2285 optimizations.
2300 optimizations.
2286
2301
2287 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2302 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2288 the information which was there from Janko's original IPP code:
2303 the information which was there from Janko's original IPP code:
2289
2304
2290 03.05.99 20:53 porto.ifm.uni-kiel.de
2305 03.05.99 20:53 porto.ifm.uni-kiel.de
2291 --Started changelog.
2306 --Started changelog.
2292 --make clear do what it say it does
2307 --make clear do what it say it does
2293 --added pretty output of lines from inputcache
2308 --added pretty output of lines from inputcache
2294 --Made Logger a mixin class, simplifies handling of switches
2309 --Made Logger a mixin class, simplifies handling of switches
2295 --Added own completer class. .string<TAB> expands to last history
2310 --Added own completer class. .string<TAB> expands to last history
2296 line which starts with string. The new expansion is also present
2311 line which starts with string. The new expansion is also present
2297 with Ctrl-r from the readline library. But this shows, who this
2312 with Ctrl-r from the readline library. But this shows, who this
2298 can be done for other cases.
2313 can be done for other cases.
2299 --Added convention that all shell functions should accept a
2314 --Added convention that all shell functions should accept a
2300 parameter_string This opens the door for different behaviour for
2315 parameter_string This opens the door for different behaviour for
2301 each function. @cd is a good example of this.
2316 each function. @cd is a good example of this.
2302
2317
2303 04.05.99 12:12 porto.ifm.uni-kiel.de
2318 04.05.99 12:12 porto.ifm.uni-kiel.de
2304 --added logfile rotation
2319 --added logfile rotation
2305 --added new mainloop method which freezes first the namespace
2320 --added new mainloop method which freezes first the namespace
2306
2321
2307 07.05.99 21:24 porto.ifm.uni-kiel.de
2322 07.05.99 21:24 porto.ifm.uni-kiel.de
2308 --added the docreader classes. Now there is a help system.
2323 --added the docreader classes. Now there is a help system.
2309 -This is only a first try. Currently it's not easy to put new
2324 -This is only a first try. Currently it's not easy to put new
2310 stuff in the indices. But this is the way to go. Info would be
2325 stuff in the indices. But this is the way to go. Info would be
2311 better, but HTML is every where and not everybody has an info
2326 better, but HTML is every where and not everybody has an info
2312 system installed and it's not so easy to change html-docs to info.
2327 system installed and it's not so easy to change html-docs to info.
2313 --added global logfile option
2328 --added global logfile option
2314 --there is now a hook for object inspection method pinfo needs to
2329 --there is now a hook for object inspection method pinfo needs to
2315 be provided for this. Can be reached by two '??'.
2330 be provided for this. Can be reached by two '??'.
2316
2331
2317 08.05.99 20:51 porto.ifm.uni-kiel.de
2332 08.05.99 20:51 porto.ifm.uni-kiel.de
2318 --added a README
2333 --added a README
2319 --bug in rc file. Something has changed so functions in the rc
2334 --bug in rc file. Something has changed so functions in the rc
2320 file need to reference the shell and not self. Not clear if it's a
2335 file need to reference the shell and not self. Not clear if it's a
2321 bug or feature.
2336 bug or feature.
2322 --changed rc file for new behavior
2337 --changed rc file for new behavior
2323
2338
2324 2004-07-15 Fernando Perez <fperez@colorado.edu>
2339 2004-07-15 Fernando Perez <fperez@colorado.edu>
2325
2340
2326 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2341 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2327 cache was falling out of sync in bizarre manners when multi-line
2342 cache was falling out of sync in bizarre manners when multi-line
2328 input was present. Minor optimizations and cleanup.
2343 input was present. Minor optimizations and cleanup.
2329
2344
2330 (Logger): Remove old Changelog info for cleanup. This is the
2345 (Logger): Remove old Changelog info for cleanup. This is the
2331 information which was there from Janko's original code:
2346 information which was there from Janko's original code:
2332
2347
2333 Changes to Logger: - made the default log filename a parameter
2348 Changes to Logger: - made the default log filename a parameter
2334
2349
2335 - put a check for lines beginning with !@? in log(). Needed
2350 - put a check for lines beginning with !@? in log(). Needed
2336 (even if the handlers properly log their lines) for mid-session
2351 (even if the handlers properly log their lines) for mid-session
2337 logging activation to work properly. Without this, lines logged
2352 logging activation to work properly. Without this, lines logged
2338 in mid session, which get read from the cache, would end up
2353 in mid session, which get read from the cache, would end up
2339 'bare' (with !@? in the open) in the log. Now they are caught
2354 'bare' (with !@? in the open) in the log. Now they are caught
2340 and prepended with a #.
2355 and prepended with a #.
2341
2356
2342 * IPython/iplib.py (InteractiveShell.init_readline): added check
2357 * IPython/iplib.py (InteractiveShell.init_readline): added check
2343 in case MagicCompleter fails to be defined, so we don't crash.
2358 in case MagicCompleter fails to be defined, so we don't crash.
2344
2359
2345 2004-07-13 Fernando Perez <fperez@colorado.edu>
2360 2004-07-13 Fernando Perez <fperez@colorado.edu>
2346
2361
2347 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2362 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2348 of EPS if the requested filename ends in '.eps'.
2363 of EPS if the requested filename ends in '.eps'.
2349
2364
2350 2004-07-04 Fernando Perez <fperez@colorado.edu>
2365 2004-07-04 Fernando Perez <fperez@colorado.edu>
2351
2366
2352 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2367 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2353 escaping of quotes when calling the shell.
2368 escaping of quotes when calling the shell.
2354
2369
2355 2004-07-02 Fernando Perez <fperez@colorado.edu>
2370 2004-07-02 Fernando Perez <fperez@colorado.edu>
2356
2371
2357 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2372 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2358 gettext not working because we were clobbering '_'. Fixes
2373 gettext not working because we were clobbering '_'. Fixes
2359 http://www.scipy.net/roundup/ipython/issue6.
2374 http://www.scipy.net/roundup/ipython/issue6.
2360
2375
2361 2004-07-01 Fernando Perez <fperez@colorado.edu>
2376 2004-07-01 Fernando Perez <fperez@colorado.edu>
2362
2377
2363 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2378 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2364 into @cd. Patch by Ville.
2379 into @cd. Patch by Ville.
2365
2380
2366 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2381 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2367 new function to store things after ipmaker runs. Patch by Ville.
2382 new function to store things after ipmaker runs. Patch by Ville.
2368 Eventually this will go away once ipmaker is removed and the class
2383 Eventually this will go away once ipmaker is removed and the class
2369 gets cleaned up, but for now it's ok. Key functionality here is
2384 gets cleaned up, but for now it's ok. Key functionality here is
2370 the addition of the persistent storage mechanism, a dict for
2385 the addition of the persistent storage mechanism, a dict for
2371 keeping data across sessions (for now just bookmarks, but more can
2386 keeping data across sessions (for now just bookmarks, but more can
2372 be implemented later).
2387 be implemented later).
2373
2388
2374 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2389 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2375 persistent across sections. Patch by Ville, I modified it
2390 persistent across sections. Patch by Ville, I modified it
2376 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2391 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2377 added a '-l' option to list all bookmarks.
2392 added a '-l' option to list all bookmarks.
2378
2393
2379 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2394 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2380 center for cleanup. Registered with atexit.register(). I moved
2395 center for cleanup. Registered with atexit.register(). I moved
2381 here the old exit_cleanup(). After a patch by Ville.
2396 here the old exit_cleanup(). After a patch by Ville.
2382
2397
2383 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2398 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2384 characters in the hacked shlex_split for python 2.2.
2399 characters in the hacked shlex_split for python 2.2.
2385
2400
2386 * IPython/iplib.py (file_matches): more fixes to filenames with
2401 * IPython/iplib.py (file_matches): more fixes to filenames with
2387 whitespace in them. It's not perfect, but limitations in python's
2402 whitespace in them. It's not perfect, but limitations in python's
2388 readline make it impossible to go further.
2403 readline make it impossible to go further.
2389
2404
2390 2004-06-29 Fernando Perez <fperez@colorado.edu>
2405 2004-06-29 Fernando Perez <fperez@colorado.edu>
2391
2406
2392 * IPython/iplib.py (file_matches): escape whitespace correctly in
2407 * IPython/iplib.py (file_matches): escape whitespace correctly in
2393 filename completions. Bug reported by Ville.
2408 filename completions. Bug reported by Ville.
2394
2409
2395 2004-06-28 Fernando Perez <fperez@colorado.edu>
2410 2004-06-28 Fernando Perez <fperez@colorado.edu>
2396
2411
2397 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2412 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2398 the history file will be called 'history-PROFNAME' (or just
2413 the history file will be called 'history-PROFNAME' (or just
2399 'history' if no profile is loaded). I was getting annoyed at
2414 'history' if no profile is loaded). I was getting annoyed at
2400 getting my Numerical work history clobbered by pysh sessions.
2415 getting my Numerical work history clobbered by pysh sessions.
2401
2416
2402 * IPython/iplib.py (InteractiveShell.__init__): Internal
2417 * IPython/iplib.py (InteractiveShell.__init__): Internal
2403 getoutputerror() function so that we can honor the system_verbose
2418 getoutputerror() function so that we can honor the system_verbose
2404 flag for _all_ system calls. I also added escaping of #
2419 flag for _all_ system calls. I also added escaping of #
2405 characters here to avoid confusing Itpl.
2420 characters here to avoid confusing Itpl.
2406
2421
2407 * IPython/Magic.py (shlex_split): removed call to shell in
2422 * IPython/Magic.py (shlex_split): removed call to shell in
2408 parse_options and replaced it with shlex.split(). The annoying
2423 parse_options and replaced it with shlex.split(). The annoying
2409 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2424 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2410 to backport it from 2.3, with several frail hacks (the shlex
2425 to backport it from 2.3, with several frail hacks (the shlex
2411 module is rather limited in 2.2). Thanks to a suggestion by Ville
2426 module is rather limited in 2.2). Thanks to a suggestion by Ville
2412 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2427 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2413 problem.
2428 problem.
2414
2429
2415 (Magic.magic_system_verbose): new toggle to print the actual
2430 (Magic.magic_system_verbose): new toggle to print the actual
2416 system calls made by ipython. Mainly for debugging purposes.
2431 system calls made by ipython. Mainly for debugging purposes.
2417
2432
2418 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2433 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2419 doesn't support persistence. Reported (and fix suggested) by
2434 doesn't support persistence. Reported (and fix suggested) by
2420 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2435 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2421
2436
2422 2004-06-26 Fernando Perez <fperez@colorado.edu>
2437 2004-06-26 Fernando Perez <fperez@colorado.edu>
2423
2438
2424 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2439 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2425 continue prompts.
2440 continue prompts.
2426
2441
2427 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2442 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2428 function (basically a big docstring) and a few more things here to
2443 function (basically a big docstring) and a few more things here to
2429 speedup startup. pysh.py is now very lightweight. We want because
2444 speedup startup. pysh.py is now very lightweight. We want because
2430 it gets execfile'd, while InterpreterExec gets imported, so
2445 it gets execfile'd, while InterpreterExec gets imported, so
2431 byte-compilation saves time.
2446 byte-compilation saves time.
2432
2447
2433 2004-06-25 Fernando Perez <fperez@colorado.edu>
2448 2004-06-25 Fernando Perez <fperez@colorado.edu>
2434
2449
2435 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2450 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2436 -NUM', which was recently broken.
2451 -NUM', which was recently broken.
2437
2452
2438 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2453 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2439 in multi-line input (but not !!, which doesn't make sense there).
2454 in multi-line input (but not !!, which doesn't make sense there).
2440
2455
2441 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2456 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2442 It's just too useful, and people can turn it off in the less
2457 It's just too useful, and people can turn it off in the less
2443 common cases where it's a problem.
2458 common cases where it's a problem.
2444
2459
2445 2004-06-24 Fernando Perez <fperez@colorado.edu>
2460 2004-06-24 Fernando Perez <fperez@colorado.edu>
2446
2461
2447 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2462 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2448 special syntaxes (like alias calling) is now allied in multi-line
2463 special syntaxes (like alias calling) is now allied in multi-line
2449 input. This is still _very_ experimental, but it's necessary for
2464 input. This is still _very_ experimental, but it's necessary for
2450 efficient shell usage combining python looping syntax with system
2465 efficient shell usage combining python looping syntax with system
2451 calls. For now it's restricted to aliases, I don't think it
2466 calls. For now it's restricted to aliases, I don't think it
2452 really even makes sense to have this for magics.
2467 really even makes sense to have this for magics.
2453
2468
2454 2004-06-23 Fernando Perez <fperez@colorado.edu>
2469 2004-06-23 Fernando Perez <fperez@colorado.edu>
2455
2470
2456 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2471 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2457 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2472 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2458
2473
2459 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2474 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2460 extensions under Windows (after code sent by Gary Bishop). The
2475 extensions under Windows (after code sent by Gary Bishop). The
2461 extensions considered 'executable' are stored in IPython's rc
2476 extensions considered 'executable' are stored in IPython's rc
2462 structure as win_exec_ext.
2477 structure as win_exec_ext.
2463
2478
2464 * IPython/genutils.py (shell): new function, like system() but
2479 * IPython/genutils.py (shell): new function, like system() but
2465 without return value. Very useful for interactive shell work.
2480 without return value. Very useful for interactive shell work.
2466
2481
2467 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2482 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2468 delete aliases.
2483 delete aliases.
2469
2484
2470 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2485 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2471 sure that the alias table doesn't contain python keywords.
2486 sure that the alias table doesn't contain python keywords.
2472
2487
2473 2004-06-21 Fernando Perez <fperez@colorado.edu>
2488 2004-06-21 Fernando Perez <fperez@colorado.edu>
2474
2489
2475 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2490 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2476 non-existent items are found in $PATH. Reported by Thorsten.
2491 non-existent items are found in $PATH. Reported by Thorsten.
2477
2492
2478 2004-06-20 Fernando Perez <fperez@colorado.edu>
2493 2004-06-20 Fernando Perez <fperez@colorado.edu>
2479
2494
2480 * IPython/iplib.py (complete): modified the completer so that the
2495 * IPython/iplib.py (complete): modified the completer so that the
2481 order of priorities can be easily changed at runtime.
2496 order of priorities can be easily changed at runtime.
2482
2497
2483 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2498 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2484 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2499 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2485
2500
2486 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2501 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2487 expand Python variables prepended with $ in all system calls. The
2502 expand Python variables prepended with $ in all system calls. The
2488 same was done to InteractiveShell.handle_shell_escape. Now all
2503 same was done to InteractiveShell.handle_shell_escape. Now all
2489 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2504 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2490 expansion of python variables and expressions according to the
2505 expansion of python variables and expressions according to the
2491 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2506 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2492
2507
2493 Though PEP-215 has been rejected, a similar (but simpler) one
2508 Though PEP-215 has been rejected, a similar (but simpler) one
2494 seems like it will go into Python 2.4, PEP-292 -
2509 seems like it will go into Python 2.4, PEP-292 -
2495 http://www.python.org/peps/pep-0292.html.
2510 http://www.python.org/peps/pep-0292.html.
2496
2511
2497 I'll keep the full syntax of PEP-215, since IPython has since the
2512 I'll keep the full syntax of PEP-215, since IPython has since the
2498 start used Ka-Ping Yee's reference implementation discussed there
2513 start used Ka-Ping Yee's reference implementation discussed there
2499 (Itpl), and I actually like the powerful semantics it offers.
2514 (Itpl), and I actually like the powerful semantics it offers.
2500
2515
2501 In order to access normal shell variables, the $ has to be escaped
2516 In order to access normal shell variables, the $ has to be escaped
2502 via an extra $. For example:
2517 via an extra $. For example:
2503
2518
2504 In [7]: PATH='a python variable'
2519 In [7]: PATH='a python variable'
2505
2520
2506 In [8]: !echo $PATH
2521 In [8]: !echo $PATH
2507 a python variable
2522 a python variable
2508
2523
2509 In [9]: !echo $$PATH
2524 In [9]: !echo $$PATH
2510 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2525 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2511
2526
2512 (Magic.parse_options): escape $ so the shell doesn't evaluate
2527 (Magic.parse_options): escape $ so the shell doesn't evaluate
2513 things prematurely.
2528 things prematurely.
2514
2529
2515 * IPython/iplib.py (InteractiveShell.call_alias): added the
2530 * IPython/iplib.py (InteractiveShell.call_alias): added the
2516 ability for aliases to expand python variables via $.
2531 ability for aliases to expand python variables via $.
2517
2532
2518 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2533 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2519 system, now there's a @rehash/@rehashx pair of magics. These work
2534 system, now there's a @rehash/@rehashx pair of magics. These work
2520 like the csh rehash command, and can be invoked at any time. They
2535 like the csh rehash command, and can be invoked at any time. They
2521 build a table of aliases to everything in the user's $PATH
2536 build a table of aliases to everything in the user's $PATH
2522 (@rehash uses everything, @rehashx is slower but only adds
2537 (@rehash uses everything, @rehashx is slower but only adds
2523 executable files). With this, the pysh.py-based shell profile can
2538 executable files). With this, the pysh.py-based shell profile can
2524 now simply call rehash upon startup, and full access to all
2539 now simply call rehash upon startup, and full access to all
2525 programs in the user's path is obtained.
2540 programs in the user's path is obtained.
2526
2541
2527 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2542 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2528 functionality is now fully in place. I removed the old dynamic
2543 functionality is now fully in place. I removed the old dynamic
2529 code generation based approach, in favor of a much lighter one
2544 code generation based approach, in favor of a much lighter one
2530 based on a simple dict. The advantage is that this allows me to
2545 based on a simple dict. The advantage is that this allows me to
2531 now have thousands of aliases with negligible cost (unthinkable
2546 now have thousands of aliases with negligible cost (unthinkable
2532 with the old system).
2547 with the old system).
2533
2548
2534 2004-06-19 Fernando Perez <fperez@colorado.edu>
2549 2004-06-19 Fernando Perez <fperez@colorado.edu>
2535
2550
2536 * IPython/iplib.py (__init__): extended MagicCompleter class to
2551 * IPython/iplib.py (__init__): extended MagicCompleter class to
2537 also complete (last in priority) on user aliases.
2552 also complete (last in priority) on user aliases.
2538
2553
2539 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2554 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2540 call to eval.
2555 call to eval.
2541 (ItplNS.__init__): Added a new class which functions like Itpl,
2556 (ItplNS.__init__): Added a new class which functions like Itpl,
2542 but allows configuring the namespace for the evaluation to occur
2557 but allows configuring the namespace for the evaluation to occur
2543 in.
2558 in.
2544
2559
2545 2004-06-18 Fernando Perez <fperez@colorado.edu>
2560 2004-06-18 Fernando Perez <fperez@colorado.edu>
2546
2561
2547 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2562 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2548 better message when 'exit' or 'quit' are typed (a common newbie
2563 better message when 'exit' or 'quit' are typed (a common newbie
2549 confusion).
2564 confusion).
2550
2565
2551 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2566 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2552 check for Windows users.
2567 check for Windows users.
2553
2568
2554 * IPython/iplib.py (InteractiveShell.user_setup): removed
2569 * IPython/iplib.py (InteractiveShell.user_setup): removed
2555 disabling of colors for Windows. I'll test at runtime and issue a
2570 disabling of colors for Windows. I'll test at runtime and issue a
2556 warning if Gary's readline isn't found, as to nudge users to
2571 warning if Gary's readline isn't found, as to nudge users to
2557 download it.
2572 download it.
2558
2573
2559 2004-06-16 Fernando Perez <fperez@colorado.edu>
2574 2004-06-16 Fernando Perez <fperez@colorado.edu>
2560
2575
2561 * IPython/genutils.py (Stream.__init__): changed to print errors
2576 * IPython/genutils.py (Stream.__init__): changed to print errors
2562 to sys.stderr. I had a circular dependency here. Now it's
2577 to sys.stderr. I had a circular dependency here. Now it's
2563 possible to run ipython as IDLE's shell (consider this pre-alpha,
2578 possible to run ipython as IDLE's shell (consider this pre-alpha,
2564 since true stdout things end up in the starting terminal instead
2579 since true stdout things end up in the starting terminal instead
2565 of IDLE's out).
2580 of IDLE's out).
2566
2581
2567 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2582 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2568 users who haven't # updated their prompt_in2 definitions. Remove
2583 users who haven't # updated their prompt_in2 definitions. Remove
2569 eventually.
2584 eventually.
2570 (multiple_replace): added credit to original ASPN recipe.
2585 (multiple_replace): added credit to original ASPN recipe.
2571
2586
2572 2004-06-15 Fernando Perez <fperez@colorado.edu>
2587 2004-06-15 Fernando Perez <fperez@colorado.edu>
2573
2588
2574 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2589 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2575 list of auto-defined aliases.
2590 list of auto-defined aliases.
2576
2591
2577 2004-06-13 Fernando Perez <fperez@colorado.edu>
2592 2004-06-13 Fernando Perez <fperez@colorado.edu>
2578
2593
2579 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2594 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2580 install was really requested (so setup.py can be used for other
2595 install was really requested (so setup.py can be used for other
2581 things under Windows).
2596 things under Windows).
2582
2597
2583 2004-06-10 Fernando Perez <fperez@colorado.edu>
2598 2004-06-10 Fernando Perez <fperez@colorado.edu>
2584
2599
2585 * IPython/Logger.py (Logger.create_log): Manually remove any old
2600 * IPython/Logger.py (Logger.create_log): Manually remove any old
2586 backup, since os.remove may fail under Windows. Fixes bug
2601 backup, since os.remove may fail under Windows. Fixes bug
2587 reported by Thorsten.
2602 reported by Thorsten.
2588
2603
2589 2004-06-09 Fernando Perez <fperez@colorado.edu>
2604 2004-06-09 Fernando Perez <fperez@colorado.edu>
2590
2605
2591 * examples/example-embed.py: fixed all references to %n (replaced
2606 * examples/example-embed.py: fixed all references to %n (replaced
2592 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2607 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2593 for all examples and the manual as well.
2608 for all examples and the manual as well.
2594
2609
2595 2004-06-08 Fernando Perez <fperez@colorado.edu>
2610 2004-06-08 Fernando Perez <fperez@colorado.edu>
2596
2611
2597 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2612 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2598 alignment and color management. All 3 prompt subsystems now
2613 alignment and color management. All 3 prompt subsystems now
2599 inherit from BasePrompt.
2614 inherit from BasePrompt.
2600
2615
2601 * tools/release: updates for windows installer build and tag rpms
2616 * tools/release: updates for windows installer build and tag rpms
2602 with python version (since paths are fixed).
2617 with python version (since paths are fixed).
2603
2618
2604 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2619 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2605 which will become eventually obsolete. Also fixed the default
2620 which will become eventually obsolete. Also fixed the default
2606 prompt_in2 to use \D, so at least new users start with the correct
2621 prompt_in2 to use \D, so at least new users start with the correct
2607 defaults.
2622 defaults.
2608 WARNING: Users with existing ipythonrc files will need to apply
2623 WARNING: Users with existing ipythonrc files will need to apply
2609 this fix manually!
2624 this fix manually!
2610
2625
2611 * setup.py: make windows installer (.exe). This is finally the
2626 * setup.py: make windows installer (.exe). This is finally the
2612 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2627 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2613 which I hadn't included because it required Python 2.3 (or recent
2628 which I hadn't included because it required Python 2.3 (or recent
2614 distutils).
2629 distutils).
2615
2630
2616 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2631 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2617 usage of new '\D' escape.
2632 usage of new '\D' escape.
2618
2633
2619 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2634 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2620 lacks os.getuid())
2635 lacks os.getuid())
2621 (CachedOutput.set_colors): Added the ability to turn coloring
2636 (CachedOutput.set_colors): Added the ability to turn coloring
2622 on/off with @colors even for manually defined prompt colors. It
2637 on/off with @colors even for manually defined prompt colors. It
2623 uses a nasty global, but it works safely and via the generic color
2638 uses a nasty global, but it works safely and via the generic color
2624 handling mechanism.
2639 handling mechanism.
2625 (Prompt2.__init__): Introduced new escape '\D' for continuation
2640 (Prompt2.__init__): Introduced new escape '\D' for continuation
2626 prompts. It represents the counter ('\#') as dots.
2641 prompts. It represents the counter ('\#') as dots.
2627 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2642 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2628 need to update their ipythonrc files and replace '%n' with '\D' in
2643 need to update their ipythonrc files and replace '%n' with '\D' in
2629 their prompt_in2 settings everywhere. Sorry, but there's
2644 their prompt_in2 settings everywhere. Sorry, but there's
2630 otherwise no clean way to get all prompts to properly align. The
2645 otherwise no clean way to get all prompts to properly align. The
2631 ipythonrc shipped with IPython has been updated.
2646 ipythonrc shipped with IPython has been updated.
2632
2647
2633 2004-06-07 Fernando Perez <fperez@colorado.edu>
2648 2004-06-07 Fernando Perez <fperez@colorado.edu>
2634
2649
2635 * setup.py (isfile): Pass local_icons option to latex2html, so the
2650 * setup.py (isfile): Pass local_icons option to latex2html, so the
2636 resulting HTML file is self-contained. Thanks to
2651 resulting HTML file is self-contained. Thanks to
2637 dryice-AT-liu.com.cn for the tip.
2652 dryice-AT-liu.com.cn for the tip.
2638
2653
2639 * pysh.py: I created a new profile 'shell', which implements a
2654 * pysh.py: I created a new profile 'shell', which implements a
2640 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2655 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2641 system shell, nor will it become one anytime soon. It's mainly
2656 system shell, nor will it become one anytime soon. It's mainly
2642 meant to illustrate the use of the new flexible bash-like prompts.
2657 meant to illustrate the use of the new flexible bash-like prompts.
2643 I guess it could be used by hardy souls for true shell management,
2658 I guess it could be used by hardy souls for true shell management,
2644 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2659 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2645 profile. This uses the InterpreterExec extension provided by
2660 profile. This uses the InterpreterExec extension provided by
2646 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2661 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2647
2662
2648 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2663 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2649 auto-align itself with the length of the previous input prompt
2664 auto-align itself with the length of the previous input prompt
2650 (taking into account the invisible color escapes).
2665 (taking into account the invisible color escapes).
2651 (CachedOutput.__init__): Large restructuring of this class. Now
2666 (CachedOutput.__init__): Large restructuring of this class. Now
2652 all three prompts (primary1, primary2, output) are proper objects,
2667 all three prompts (primary1, primary2, output) are proper objects,
2653 managed by the 'parent' CachedOutput class. The code is still a
2668 managed by the 'parent' CachedOutput class. The code is still a
2654 bit hackish (all prompts share state via a pointer to the cache),
2669 bit hackish (all prompts share state via a pointer to the cache),
2655 but it's overall far cleaner than before.
2670 but it's overall far cleaner than before.
2656
2671
2657 * IPython/genutils.py (getoutputerror): modified to add verbose,
2672 * IPython/genutils.py (getoutputerror): modified to add verbose,
2658 debug and header options. This makes the interface of all getout*
2673 debug and header options. This makes the interface of all getout*
2659 functions uniform.
2674 functions uniform.
2660 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2675 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2661
2676
2662 * IPython/Magic.py (Magic.default_option): added a function to
2677 * IPython/Magic.py (Magic.default_option): added a function to
2663 allow registering default options for any magic command. This
2678 allow registering default options for any magic command. This
2664 makes it easy to have profiles which customize the magics globally
2679 makes it easy to have profiles which customize the magics globally
2665 for a certain use. The values set through this function are
2680 for a certain use. The values set through this function are
2666 picked up by the parse_options() method, which all magics should
2681 picked up by the parse_options() method, which all magics should
2667 use to parse their options.
2682 use to parse their options.
2668
2683
2669 * IPython/genutils.py (warn): modified the warnings framework to
2684 * IPython/genutils.py (warn): modified the warnings framework to
2670 use the Term I/O class. I'm trying to slowly unify all of
2685 use the Term I/O class. I'm trying to slowly unify all of
2671 IPython's I/O operations to pass through Term.
2686 IPython's I/O operations to pass through Term.
2672
2687
2673 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2688 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2674 the secondary prompt to correctly match the length of the primary
2689 the secondary prompt to correctly match the length of the primary
2675 one for any prompt. Now multi-line code will properly line up
2690 one for any prompt. Now multi-line code will properly line up
2676 even for path dependent prompts, such as the new ones available
2691 even for path dependent prompts, such as the new ones available
2677 via the prompt_specials.
2692 via the prompt_specials.
2678
2693
2679 2004-06-06 Fernando Perez <fperez@colorado.edu>
2694 2004-06-06 Fernando Perez <fperez@colorado.edu>
2680
2695
2681 * IPython/Prompts.py (prompt_specials): Added the ability to have
2696 * IPython/Prompts.py (prompt_specials): Added the ability to have
2682 bash-like special sequences in the prompts, which get
2697 bash-like special sequences in the prompts, which get
2683 automatically expanded. Things like hostname, current working
2698 automatically expanded. Things like hostname, current working
2684 directory and username are implemented already, but it's easy to
2699 directory and username are implemented already, but it's easy to
2685 add more in the future. Thanks to a patch by W.J. van der Laan
2700 add more in the future. Thanks to a patch by W.J. van der Laan
2686 <gnufnork-AT-hetdigitalegat.nl>
2701 <gnufnork-AT-hetdigitalegat.nl>
2687 (prompt_specials): Added color support for prompt strings, so
2702 (prompt_specials): Added color support for prompt strings, so
2688 users can define arbitrary color setups for their prompts.
2703 users can define arbitrary color setups for their prompts.
2689
2704
2690 2004-06-05 Fernando Perez <fperez@colorado.edu>
2705 2004-06-05 Fernando Perez <fperez@colorado.edu>
2691
2706
2692 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2707 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2693 code to load Gary Bishop's readline and configure it
2708 code to load Gary Bishop's readline and configure it
2694 automatically. Thanks to Gary for help on this.
2709 automatically. Thanks to Gary for help on this.
2695
2710
2696 2004-06-01 Fernando Perez <fperez@colorado.edu>
2711 2004-06-01 Fernando Perez <fperez@colorado.edu>
2697
2712
2698 * IPython/Logger.py (Logger.create_log): fix bug for logging
2713 * IPython/Logger.py (Logger.create_log): fix bug for logging
2699 with no filename (previous fix was incomplete).
2714 with no filename (previous fix was incomplete).
2700
2715
2701 2004-05-25 Fernando Perez <fperez@colorado.edu>
2716 2004-05-25 Fernando Perez <fperez@colorado.edu>
2702
2717
2703 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2718 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2704 parens would get passed to the shell.
2719 parens would get passed to the shell.
2705
2720
2706 2004-05-20 Fernando Perez <fperez@colorado.edu>
2721 2004-05-20 Fernando Perez <fperez@colorado.edu>
2707
2722
2708 * IPython/Magic.py (Magic.magic_prun): changed default profile
2723 * IPython/Magic.py (Magic.magic_prun): changed default profile
2709 sort order to 'time' (the more common profiling need).
2724 sort order to 'time' (the more common profiling need).
2710
2725
2711 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2726 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2712 so that source code shown is guaranteed in sync with the file on
2727 so that source code shown is guaranteed in sync with the file on
2713 disk (also changed in psource). Similar fix to the one for
2728 disk (also changed in psource). Similar fix to the one for
2714 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2729 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2715 <yann.ledu-AT-noos.fr>.
2730 <yann.ledu-AT-noos.fr>.
2716
2731
2717 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2732 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2718 with a single option would not be correctly parsed. Closes
2733 with a single option would not be correctly parsed. Closes
2719 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2734 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2720 introduced in 0.6.0 (on 2004-05-06).
2735 introduced in 0.6.0 (on 2004-05-06).
2721
2736
2722 2004-05-13 *** Released version 0.6.0
2737 2004-05-13 *** Released version 0.6.0
2723
2738
2724 2004-05-13 Fernando Perez <fperez@colorado.edu>
2739 2004-05-13 Fernando Perez <fperez@colorado.edu>
2725
2740
2726 * debian/: Added debian/ directory to CVS, so that debian support
2741 * debian/: Added debian/ directory to CVS, so that debian support
2727 is publicly accessible. The debian package is maintained by Jack
2742 is publicly accessible. The debian package is maintained by Jack
2728 Moffit <jack-AT-xiph.org>.
2743 Moffit <jack-AT-xiph.org>.
2729
2744
2730 * Documentation: included the notes about an ipython-based system
2745 * Documentation: included the notes about an ipython-based system
2731 shell (the hypothetical 'pysh') into the new_design.pdf document,
2746 shell (the hypothetical 'pysh') into the new_design.pdf document,
2732 so that these ideas get distributed to users along with the
2747 so that these ideas get distributed to users along with the
2733 official documentation.
2748 official documentation.
2734
2749
2735 2004-05-10 Fernando Perez <fperez@colorado.edu>
2750 2004-05-10 Fernando Perez <fperez@colorado.edu>
2736
2751
2737 * IPython/Logger.py (Logger.create_log): fix recently introduced
2752 * IPython/Logger.py (Logger.create_log): fix recently introduced
2738 bug (misindented line) where logstart would fail when not given an
2753 bug (misindented line) where logstart would fail when not given an
2739 explicit filename.
2754 explicit filename.
2740
2755
2741 2004-05-09 Fernando Perez <fperez@colorado.edu>
2756 2004-05-09 Fernando Perez <fperez@colorado.edu>
2742
2757
2743 * IPython/Magic.py (Magic.parse_options): skip system call when
2758 * IPython/Magic.py (Magic.parse_options): skip system call when
2744 there are no options to look for. Faster, cleaner for the common
2759 there are no options to look for. Faster, cleaner for the common
2745 case.
2760 case.
2746
2761
2747 * Documentation: many updates to the manual: describing Windows
2762 * Documentation: many updates to the manual: describing Windows
2748 support better, Gnuplot updates, credits, misc small stuff. Also
2763 support better, Gnuplot updates, credits, misc small stuff. Also
2749 updated the new_design doc a bit.
2764 updated the new_design doc a bit.
2750
2765
2751 2004-05-06 *** Released version 0.6.0.rc1
2766 2004-05-06 *** Released version 0.6.0.rc1
2752
2767
2753 2004-05-06 Fernando Perez <fperez@colorado.edu>
2768 2004-05-06 Fernando Perez <fperez@colorado.edu>
2754
2769
2755 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2770 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2756 operations to use the vastly more efficient list/''.join() method.
2771 operations to use the vastly more efficient list/''.join() method.
2757 (FormattedTB.text): Fix
2772 (FormattedTB.text): Fix
2758 http://www.scipy.net/roundup/ipython/issue12 - exception source
2773 http://www.scipy.net/roundup/ipython/issue12 - exception source
2759 extract not updated after reload. Thanks to Mike Salib
2774 extract not updated after reload. Thanks to Mike Salib
2760 <msalib-AT-mit.edu> for pinning the source of the problem.
2775 <msalib-AT-mit.edu> for pinning the source of the problem.
2761 Fortunately, the solution works inside ipython and doesn't require
2776 Fortunately, the solution works inside ipython and doesn't require
2762 any changes to python proper.
2777 any changes to python proper.
2763
2778
2764 * IPython/Magic.py (Magic.parse_options): Improved to process the
2779 * IPython/Magic.py (Magic.parse_options): Improved to process the
2765 argument list as a true shell would (by actually using the
2780 argument list as a true shell would (by actually using the
2766 underlying system shell). This way, all @magics automatically get
2781 underlying system shell). This way, all @magics automatically get
2767 shell expansion for variables. Thanks to a comment by Alex
2782 shell expansion for variables. Thanks to a comment by Alex
2768 Schmolck.
2783 Schmolck.
2769
2784
2770 2004-04-04 Fernando Perez <fperez@colorado.edu>
2785 2004-04-04 Fernando Perez <fperez@colorado.edu>
2771
2786
2772 * IPython/iplib.py (InteractiveShell.interact): Added a special
2787 * IPython/iplib.py (InteractiveShell.interact): Added a special
2773 trap for a debugger quit exception, which is basically impossible
2788 trap for a debugger quit exception, which is basically impossible
2774 to handle by normal mechanisms, given what pdb does to the stack.
2789 to handle by normal mechanisms, given what pdb does to the stack.
2775 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2790 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2776
2791
2777 2004-04-03 Fernando Perez <fperez@colorado.edu>
2792 2004-04-03 Fernando Perez <fperez@colorado.edu>
2778
2793
2779 * IPython/genutils.py (Term): Standardized the names of the Term
2794 * IPython/genutils.py (Term): Standardized the names of the Term
2780 class streams to cin/cout/cerr, following C++ naming conventions
2795 class streams to cin/cout/cerr, following C++ naming conventions
2781 (I can't use in/out/err because 'in' is not a valid attribute
2796 (I can't use in/out/err because 'in' is not a valid attribute
2782 name).
2797 name).
2783
2798
2784 * IPython/iplib.py (InteractiveShell.interact): don't increment
2799 * IPython/iplib.py (InteractiveShell.interact): don't increment
2785 the prompt if there's no user input. By Daniel 'Dang' Griffith
2800 the prompt if there's no user input. By Daniel 'Dang' Griffith
2786 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2801 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2787 Francois Pinard.
2802 Francois Pinard.
2788
2803
2789 2004-04-02 Fernando Perez <fperez@colorado.edu>
2804 2004-04-02 Fernando Perez <fperez@colorado.edu>
2790
2805
2791 * IPython/genutils.py (Stream.__init__): Modified to survive at
2806 * IPython/genutils.py (Stream.__init__): Modified to survive at
2792 least importing in contexts where stdin/out/err aren't true file
2807 least importing in contexts where stdin/out/err aren't true file
2793 objects, such as PyCrust (they lack fileno() and mode). However,
2808 objects, such as PyCrust (they lack fileno() and mode). However,
2794 the recovery facilities which rely on these things existing will
2809 the recovery facilities which rely on these things existing will
2795 not work.
2810 not work.
2796
2811
2797 2004-04-01 Fernando Perez <fperez@colorado.edu>
2812 2004-04-01 Fernando Perez <fperez@colorado.edu>
2798
2813
2799 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2814 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2800 use the new getoutputerror() function, so it properly
2815 use the new getoutputerror() function, so it properly
2801 distinguishes stdout/err.
2816 distinguishes stdout/err.
2802
2817
2803 * IPython/genutils.py (getoutputerror): added a function to
2818 * IPython/genutils.py (getoutputerror): added a function to
2804 capture separately the standard output and error of a command.
2819 capture separately the standard output and error of a command.
2805 After a comment from dang on the mailing lists. This code is
2820 After a comment from dang on the mailing lists. This code is
2806 basically a modified version of commands.getstatusoutput(), from
2821 basically a modified version of commands.getstatusoutput(), from
2807 the standard library.
2822 the standard library.
2808
2823
2809 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2824 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2810 '!!' as a special syntax (shorthand) to access @sx.
2825 '!!' as a special syntax (shorthand) to access @sx.
2811
2826
2812 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2827 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2813 command and return its output as a list split on '\n'.
2828 command and return its output as a list split on '\n'.
2814
2829
2815 2004-03-31 Fernando Perez <fperez@colorado.edu>
2830 2004-03-31 Fernando Perez <fperez@colorado.edu>
2816
2831
2817 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2832 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2818 method to dictionaries used as FakeModule instances if they lack
2833 method to dictionaries used as FakeModule instances if they lack
2819 it. At least pydoc in python2.3 breaks for runtime-defined
2834 it. At least pydoc in python2.3 breaks for runtime-defined
2820 functions without this hack. At some point I need to _really_
2835 functions without this hack. At some point I need to _really_
2821 understand what FakeModule is doing, because it's a gross hack.
2836 understand what FakeModule is doing, because it's a gross hack.
2822 But it solves Arnd's problem for now...
2837 But it solves Arnd's problem for now...
2823
2838
2824 2004-02-27 Fernando Perez <fperez@colorado.edu>
2839 2004-02-27 Fernando Perez <fperez@colorado.edu>
2825
2840
2826 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2841 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2827 mode would behave erratically. Also increased the number of
2842 mode would behave erratically. Also increased the number of
2828 possible logs in rotate mod to 999. Thanks to Rod Holland
2843 possible logs in rotate mod to 999. Thanks to Rod Holland
2829 <rhh@StructureLABS.com> for the report and fixes.
2844 <rhh@StructureLABS.com> for the report and fixes.
2830
2845
2831 2004-02-26 Fernando Perez <fperez@colorado.edu>
2846 2004-02-26 Fernando Perez <fperez@colorado.edu>
2832
2847
2833 * IPython/genutils.py (page): Check that the curses module really
2848 * IPython/genutils.py (page): Check that the curses module really
2834 has the initscr attribute before trying to use it. For some
2849 has the initscr attribute before trying to use it. For some
2835 reason, the Solaris curses module is missing this. I think this
2850 reason, the Solaris curses module is missing this. I think this
2836 should be considered a Solaris python bug, but I'm not sure.
2851 should be considered a Solaris python bug, but I'm not sure.
2837
2852
2838 2004-01-17 Fernando Perez <fperez@colorado.edu>
2853 2004-01-17 Fernando Perez <fperez@colorado.edu>
2839
2854
2840 * IPython/genutils.py (Stream.__init__): Changes to try to make
2855 * IPython/genutils.py (Stream.__init__): Changes to try to make
2841 ipython robust against stdin/out/err being closed by the user.
2856 ipython robust against stdin/out/err being closed by the user.
2842 This is 'user error' (and blocks a normal python session, at least
2857 This is 'user error' (and blocks a normal python session, at least
2843 the stdout case). However, Ipython should be able to survive such
2858 the stdout case). However, Ipython should be able to survive such
2844 instances of abuse as gracefully as possible. To simplify the
2859 instances of abuse as gracefully as possible. To simplify the
2845 coding and maintain compatibility with Gary Bishop's Term
2860 coding and maintain compatibility with Gary Bishop's Term
2846 contributions, I've made use of classmethods for this. I think
2861 contributions, I've made use of classmethods for this. I think
2847 this introduces a dependency on python 2.2.
2862 this introduces a dependency on python 2.2.
2848
2863
2849 2004-01-13 Fernando Perez <fperez@colorado.edu>
2864 2004-01-13 Fernando Perez <fperez@colorado.edu>
2850
2865
2851 * IPython/numutils.py (exp_safe): simplified the code a bit and
2866 * IPython/numutils.py (exp_safe): simplified the code a bit and
2852 removed the need for importing the kinds module altogether.
2867 removed the need for importing the kinds module altogether.
2853
2868
2854 2004-01-06 Fernando Perez <fperez@colorado.edu>
2869 2004-01-06 Fernando Perez <fperez@colorado.edu>
2855
2870
2856 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2871 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2857 a magic function instead, after some community feedback. No
2872 a magic function instead, after some community feedback. No
2858 special syntax will exist for it, but its name is deliberately
2873 special syntax will exist for it, but its name is deliberately
2859 very short.
2874 very short.
2860
2875
2861 2003-12-20 Fernando Perez <fperez@colorado.edu>
2876 2003-12-20 Fernando Perez <fperez@colorado.edu>
2862
2877
2863 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2878 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2864 new functionality, to automagically assign the result of a shell
2879 new functionality, to automagically assign the result of a shell
2865 command to a variable. I'll solicit some community feedback on
2880 command to a variable. I'll solicit some community feedback on
2866 this before making it permanent.
2881 this before making it permanent.
2867
2882
2868 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2883 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2869 requested about callables for which inspect couldn't obtain a
2884 requested about callables for which inspect couldn't obtain a
2870 proper argspec. Thanks to a crash report sent by Etienne
2885 proper argspec. Thanks to a crash report sent by Etienne
2871 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2886 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2872
2887
2873 2003-12-09 Fernando Perez <fperez@colorado.edu>
2888 2003-12-09 Fernando Perez <fperez@colorado.edu>
2874
2889
2875 * IPython/genutils.py (page): patch for the pager to work across
2890 * IPython/genutils.py (page): patch for the pager to work across
2876 various versions of Windows. By Gary Bishop.
2891 various versions of Windows. By Gary Bishop.
2877
2892
2878 2003-12-04 Fernando Perez <fperez@colorado.edu>
2893 2003-12-04 Fernando Perez <fperez@colorado.edu>
2879
2894
2880 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2895 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2881 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2896 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2882 While I tested this and it looks ok, there may still be corner
2897 While I tested this and it looks ok, there may still be corner
2883 cases I've missed.
2898 cases I've missed.
2884
2899
2885 2003-12-01 Fernando Perez <fperez@colorado.edu>
2900 2003-12-01 Fernando Perez <fperez@colorado.edu>
2886
2901
2887 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2902 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2888 where a line like 'p,q=1,2' would fail because the automagic
2903 where a line like 'p,q=1,2' would fail because the automagic
2889 system would be triggered for @p.
2904 system would be triggered for @p.
2890
2905
2891 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2906 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2892 cleanups, code unmodified.
2907 cleanups, code unmodified.
2893
2908
2894 * IPython/genutils.py (Term): added a class for IPython to handle
2909 * IPython/genutils.py (Term): added a class for IPython to handle
2895 output. In most cases it will just be a proxy for stdout/err, but
2910 output. In most cases it will just be a proxy for stdout/err, but
2896 having this allows modifications to be made for some platforms,
2911 having this allows modifications to be made for some platforms,
2897 such as handling color escapes under Windows. All of this code
2912 such as handling color escapes under Windows. All of this code
2898 was contributed by Gary Bishop, with minor modifications by me.
2913 was contributed by Gary Bishop, with minor modifications by me.
2899 The actual changes affect many files.
2914 The actual changes affect many files.
2900
2915
2901 2003-11-30 Fernando Perez <fperez@colorado.edu>
2916 2003-11-30 Fernando Perez <fperez@colorado.edu>
2902
2917
2903 * IPython/iplib.py (file_matches): new completion code, courtesy
2918 * IPython/iplib.py (file_matches): new completion code, courtesy
2904 of Jeff Collins. This enables filename completion again under
2919 of Jeff Collins. This enables filename completion again under
2905 python 2.3, which disabled it at the C level.
2920 python 2.3, which disabled it at the C level.
2906
2921
2907 2003-11-11 Fernando Perez <fperez@colorado.edu>
2922 2003-11-11 Fernando Perez <fperez@colorado.edu>
2908
2923
2909 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2924 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2910 for Numeric.array(map(...)), but often convenient.
2925 for Numeric.array(map(...)), but often convenient.
2911
2926
2912 2003-11-05 Fernando Perez <fperez@colorado.edu>
2927 2003-11-05 Fernando Perez <fperez@colorado.edu>
2913
2928
2914 * IPython/numutils.py (frange): Changed a call from int() to
2929 * IPython/numutils.py (frange): Changed a call from int() to
2915 int(round()) to prevent a problem reported with arange() in the
2930 int(round()) to prevent a problem reported with arange() in the
2916 numpy list.
2931 numpy list.
2917
2932
2918 2003-10-06 Fernando Perez <fperez@colorado.edu>
2933 2003-10-06 Fernando Perez <fperez@colorado.edu>
2919
2934
2920 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2935 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2921 prevent crashes if sys lacks an argv attribute (it happens with
2936 prevent crashes if sys lacks an argv attribute (it happens with
2922 embedded interpreters which build a bare-bones sys module).
2937 embedded interpreters which build a bare-bones sys module).
2923 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2938 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2924
2939
2925 2003-09-24 Fernando Perez <fperez@colorado.edu>
2940 2003-09-24 Fernando Perez <fperez@colorado.edu>
2926
2941
2927 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2942 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2928 to protect against poorly written user objects where __getattr__
2943 to protect against poorly written user objects where __getattr__
2929 raises exceptions other than AttributeError. Thanks to a bug
2944 raises exceptions other than AttributeError. Thanks to a bug
2930 report by Oliver Sander <osander-AT-gmx.de>.
2945 report by Oliver Sander <osander-AT-gmx.de>.
2931
2946
2932 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2947 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2933 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2948 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2934
2949
2935 2003-09-09 Fernando Perez <fperez@colorado.edu>
2950 2003-09-09 Fernando Perez <fperez@colorado.edu>
2936
2951
2937 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2952 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2938 unpacking a list whith a callable as first element would
2953 unpacking a list whith a callable as first element would
2939 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2954 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2940 Collins.
2955 Collins.
2941
2956
2942 2003-08-25 *** Released version 0.5.0
2957 2003-08-25 *** Released version 0.5.0
2943
2958
2944 2003-08-22 Fernando Perez <fperez@colorado.edu>
2959 2003-08-22 Fernando Perez <fperez@colorado.edu>
2945
2960
2946 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2961 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2947 improperly defined user exceptions. Thanks to feedback from Mark
2962 improperly defined user exceptions. Thanks to feedback from Mark
2948 Russell <mrussell-AT-verio.net>.
2963 Russell <mrussell-AT-verio.net>.
2949
2964
2950 2003-08-20 Fernando Perez <fperez@colorado.edu>
2965 2003-08-20 Fernando Perez <fperez@colorado.edu>
2951
2966
2952 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2967 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2953 printing so that it would print multi-line string forms starting
2968 printing so that it would print multi-line string forms starting
2954 with a new line. This way the formatting is better respected for
2969 with a new line. This way the formatting is better respected for
2955 objects which work hard to make nice string forms.
2970 objects which work hard to make nice string forms.
2956
2971
2957 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2972 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2958 autocall would overtake data access for objects with both
2973 autocall would overtake data access for objects with both
2959 __getitem__ and __call__.
2974 __getitem__ and __call__.
2960
2975
2961 2003-08-19 *** Released version 0.5.0-rc1
2976 2003-08-19 *** Released version 0.5.0-rc1
2962
2977
2963 2003-08-19 Fernando Perez <fperez@colorado.edu>
2978 2003-08-19 Fernando Perez <fperez@colorado.edu>
2964
2979
2965 * IPython/deep_reload.py (load_tail): single tiny change here
2980 * IPython/deep_reload.py (load_tail): single tiny change here
2966 seems to fix the long-standing bug of dreload() failing to work
2981 seems to fix the long-standing bug of dreload() failing to work
2967 for dotted names. But this module is pretty tricky, so I may have
2982 for dotted names. But this module is pretty tricky, so I may have
2968 missed some subtlety. Needs more testing!.
2983 missed some subtlety. Needs more testing!.
2969
2984
2970 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2985 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2971 exceptions which have badly implemented __str__ methods.
2986 exceptions which have badly implemented __str__ methods.
2972 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2987 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2973 which I've been getting reports about from Python 2.3 users. I
2988 which I've been getting reports about from Python 2.3 users. I
2974 wish I had a simple test case to reproduce the problem, so I could
2989 wish I had a simple test case to reproduce the problem, so I could
2975 either write a cleaner workaround or file a bug report if
2990 either write a cleaner workaround or file a bug report if
2976 necessary.
2991 necessary.
2977
2992
2978 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2993 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2979 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2994 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2980 a bug report by Tjabo Kloppenburg.
2995 a bug report by Tjabo Kloppenburg.
2981
2996
2982 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2997 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2983 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2998 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2984 seems rather unstable. Thanks to a bug report by Tjabo
2999 seems rather unstable. Thanks to a bug report by Tjabo
2985 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3000 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2986
3001
2987 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3002 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2988 this out soon because of the critical fixes in the inner loop for
3003 this out soon because of the critical fixes in the inner loop for
2989 generators.
3004 generators.
2990
3005
2991 * IPython/Magic.py (Magic.getargspec): removed. This (and
3006 * IPython/Magic.py (Magic.getargspec): removed. This (and
2992 _get_def) have been obsoleted by OInspect for a long time, I
3007 _get_def) have been obsoleted by OInspect for a long time, I
2993 hadn't noticed that they were dead code.
3008 hadn't noticed that they were dead code.
2994 (Magic._ofind): restored _ofind functionality for a few literals
3009 (Magic._ofind): restored _ofind functionality for a few literals
2995 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3010 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2996 for things like "hello".capitalize?, since that would require a
3011 for things like "hello".capitalize?, since that would require a
2997 potentially dangerous eval() again.
3012 potentially dangerous eval() again.
2998
3013
2999 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3014 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3000 logic a bit more to clean up the escapes handling and minimize the
3015 logic a bit more to clean up the escapes handling and minimize the
3001 use of _ofind to only necessary cases. The interactive 'feel' of
3016 use of _ofind to only necessary cases. The interactive 'feel' of
3002 IPython should have improved quite a bit with the changes in
3017 IPython should have improved quite a bit with the changes in
3003 _prefilter and _ofind (besides being far safer than before).
3018 _prefilter and _ofind (besides being far safer than before).
3004
3019
3005 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3020 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3006 obscure, never reported). Edit would fail to find the object to
3021 obscure, never reported). Edit would fail to find the object to
3007 edit under some circumstances.
3022 edit under some circumstances.
3008 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3023 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3009 which were causing double-calling of generators. Those eval calls
3024 which were causing double-calling of generators. Those eval calls
3010 were _very_ dangerous, since code with side effects could be
3025 were _very_ dangerous, since code with side effects could be
3011 triggered. As they say, 'eval is evil'... These were the
3026 triggered. As they say, 'eval is evil'... These were the
3012 nastiest evals in IPython. Besides, _ofind is now far simpler,
3027 nastiest evals in IPython. Besides, _ofind is now far simpler,
3013 and it should also be quite a bit faster. Its use of inspect is
3028 and it should also be quite a bit faster. Its use of inspect is
3014 also safer, so perhaps some of the inspect-related crashes I've
3029 also safer, so perhaps some of the inspect-related crashes I've
3015 seen lately with Python 2.3 might be taken care of. That will
3030 seen lately with Python 2.3 might be taken care of. That will
3016 need more testing.
3031 need more testing.
3017
3032
3018 2003-08-17 Fernando Perez <fperez@colorado.edu>
3033 2003-08-17 Fernando Perez <fperez@colorado.edu>
3019
3034
3020 * IPython/iplib.py (InteractiveShell._prefilter): significant
3035 * IPython/iplib.py (InteractiveShell._prefilter): significant
3021 simplifications to the logic for handling user escapes. Faster
3036 simplifications to the logic for handling user escapes. Faster
3022 and simpler code.
3037 and simpler code.
3023
3038
3024 2003-08-14 Fernando Perez <fperez@colorado.edu>
3039 2003-08-14 Fernando Perez <fperez@colorado.edu>
3025
3040
3026 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3041 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3027 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3042 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3028 but it should be quite a bit faster. And the recursive version
3043 but it should be quite a bit faster. And the recursive version
3029 generated O(log N) intermediate storage for all rank>1 arrays,
3044 generated O(log N) intermediate storage for all rank>1 arrays,
3030 even if they were contiguous.
3045 even if they were contiguous.
3031 (l1norm): Added this function.
3046 (l1norm): Added this function.
3032 (norm): Added this function for arbitrary norms (including
3047 (norm): Added this function for arbitrary norms (including
3033 l-infinity). l1 and l2 are still special cases for convenience
3048 l-infinity). l1 and l2 are still special cases for convenience
3034 and speed.
3049 and speed.
3035
3050
3036 2003-08-03 Fernando Perez <fperez@colorado.edu>
3051 2003-08-03 Fernando Perez <fperez@colorado.edu>
3037
3052
3038 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3053 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3039 exceptions, which now raise PendingDeprecationWarnings in Python
3054 exceptions, which now raise PendingDeprecationWarnings in Python
3040 2.3. There were some in Magic and some in Gnuplot2.
3055 2.3. There were some in Magic and some in Gnuplot2.
3041
3056
3042 2003-06-30 Fernando Perez <fperez@colorado.edu>
3057 2003-06-30 Fernando Perez <fperez@colorado.edu>
3043
3058
3044 * IPython/genutils.py (page): modified to call curses only for
3059 * IPython/genutils.py (page): modified to call curses only for
3045 terminals where TERM=='xterm'. After problems under many other
3060 terminals where TERM=='xterm'. After problems under many other
3046 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3061 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3047
3062
3048 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3063 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3049 would be triggered when readline was absent. This was just an old
3064 would be triggered when readline was absent. This was just an old
3050 debugging statement I'd forgotten to take out.
3065 debugging statement I'd forgotten to take out.
3051
3066
3052 2003-06-20 Fernando Perez <fperez@colorado.edu>
3067 2003-06-20 Fernando Perez <fperez@colorado.edu>
3053
3068
3054 * IPython/genutils.py (clock): modified to return only user time
3069 * IPython/genutils.py (clock): modified to return only user time
3055 (not counting system time), after a discussion on scipy. While
3070 (not counting system time), after a discussion on scipy. While
3056 system time may be a useful quantity occasionally, it may much
3071 system time may be a useful quantity occasionally, it may much
3057 more easily be skewed by occasional swapping or other similar
3072 more easily be skewed by occasional swapping or other similar
3058 activity.
3073 activity.
3059
3074
3060 2003-06-05 Fernando Perez <fperez@colorado.edu>
3075 2003-06-05 Fernando Perez <fperez@colorado.edu>
3061
3076
3062 * IPython/numutils.py (identity): new function, for building
3077 * IPython/numutils.py (identity): new function, for building
3063 arbitrary rank Kronecker deltas (mostly backwards compatible with
3078 arbitrary rank Kronecker deltas (mostly backwards compatible with
3064 Numeric.identity)
3079 Numeric.identity)
3065
3080
3066 2003-06-03 Fernando Perez <fperez@colorado.edu>
3081 2003-06-03 Fernando Perez <fperez@colorado.edu>
3067
3082
3068 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3083 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3069 arguments passed to magics with spaces, to allow trailing '\' to
3084 arguments passed to magics with spaces, to allow trailing '\' to
3070 work normally (mainly for Windows users).
3085 work normally (mainly for Windows users).
3071
3086
3072 2003-05-29 Fernando Perez <fperez@colorado.edu>
3087 2003-05-29 Fernando Perez <fperez@colorado.edu>
3073
3088
3074 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3089 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3075 instead of pydoc.help. This fixes a bizarre behavior where
3090 instead of pydoc.help. This fixes a bizarre behavior where
3076 printing '%s' % locals() would trigger the help system. Now
3091 printing '%s' % locals() would trigger the help system. Now
3077 ipython behaves like normal python does.
3092 ipython behaves like normal python does.
3078
3093
3079 Note that if one does 'from pydoc import help', the bizarre
3094 Note that if one does 'from pydoc import help', the bizarre
3080 behavior returns, but this will also happen in normal python, so
3095 behavior returns, but this will also happen in normal python, so
3081 it's not an ipython bug anymore (it has to do with how pydoc.help
3096 it's not an ipython bug anymore (it has to do with how pydoc.help
3082 is implemented).
3097 is implemented).
3083
3098
3084 2003-05-22 Fernando Perez <fperez@colorado.edu>
3099 2003-05-22 Fernando Perez <fperez@colorado.edu>
3085
3100
3086 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3101 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3087 return [] instead of None when nothing matches, also match to end
3102 return [] instead of None when nothing matches, also match to end
3088 of line. Patch by Gary Bishop.
3103 of line. Patch by Gary Bishop.
3089
3104
3090 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3105 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3091 protection as before, for files passed on the command line. This
3106 protection as before, for files passed on the command line. This
3092 prevents the CrashHandler from kicking in if user files call into
3107 prevents the CrashHandler from kicking in if user files call into
3093 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3108 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3094 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3109 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3095
3110
3096 2003-05-20 *** Released version 0.4.0
3111 2003-05-20 *** Released version 0.4.0
3097
3112
3098 2003-05-20 Fernando Perez <fperez@colorado.edu>
3113 2003-05-20 Fernando Perez <fperez@colorado.edu>
3099
3114
3100 * setup.py: added support for manpages. It's a bit hackish b/c of
3115 * setup.py: added support for manpages. It's a bit hackish b/c of
3101 a bug in the way the bdist_rpm distutils target handles gzipped
3116 a bug in the way the bdist_rpm distutils target handles gzipped
3102 manpages, but it works. After a patch by Jack.
3117 manpages, but it works. After a patch by Jack.
3103
3118
3104 2003-05-19 Fernando Perez <fperez@colorado.edu>
3119 2003-05-19 Fernando Perez <fperez@colorado.edu>
3105
3120
3106 * IPython/numutils.py: added a mockup of the kinds module, since
3121 * IPython/numutils.py: added a mockup of the kinds module, since
3107 it was recently removed from Numeric. This way, numutils will
3122 it was recently removed from Numeric. This way, numutils will
3108 work for all users even if they are missing kinds.
3123 work for all users even if they are missing kinds.
3109
3124
3110 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3125 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3111 failure, which can occur with SWIG-wrapped extensions. After a
3126 failure, which can occur with SWIG-wrapped extensions. After a
3112 crash report from Prabhu.
3127 crash report from Prabhu.
3113
3128
3114 2003-05-16 Fernando Perez <fperez@colorado.edu>
3129 2003-05-16 Fernando Perez <fperez@colorado.edu>
3115
3130
3116 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3131 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3117 protect ipython from user code which may call directly
3132 protect ipython from user code which may call directly
3118 sys.excepthook (this looks like an ipython crash to the user, even
3133 sys.excepthook (this looks like an ipython crash to the user, even
3119 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3134 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3120 This is especially important to help users of WxWindows, but may
3135 This is especially important to help users of WxWindows, but may
3121 also be useful in other cases.
3136 also be useful in other cases.
3122
3137
3123 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3138 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3124 an optional tb_offset to be specified, and to preserve exception
3139 an optional tb_offset to be specified, and to preserve exception
3125 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3140 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3126
3141
3127 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3142 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3128
3143
3129 2003-05-15 Fernando Perez <fperez@colorado.edu>
3144 2003-05-15 Fernando Perez <fperez@colorado.edu>
3130
3145
3131 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3146 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3132 installing for a new user under Windows.
3147 installing for a new user under Windows.
3133
3148
3134 2003-05-12 Fernando Perez <fperez@colorado.edu>
3149 2003-05-12 Fernando Perez <fperez@colorado.edu>
3135
3150
3136 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3151 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3137 handler for Emacs comint-based lines. Currently it doesn't do
3152 handler for Emacs comint-based lines. Currently it doesn't do
3138 much (but importantly, it doesn't update the history cache). In
3153 much (but importantly, it doesn't update the history cache). In
3139 the future it may be expanded if Alex needs more functionality
3154 the future it may be expanded if Alex needs more functionality
3140 there.
3155 there.
3141
3156
3142 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3157 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3143 info to crash reports.
3158 info to crash reports.
3144
3159
3145 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3160 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3146 just like Python's -c. Also fixed crash with invalid -color
3161 just like Python's -c. Also fixed crash with invalid -color
3147 option value at startup. Thanks to Will French
3162 option value at startup. Thanks to Will French
3148 <wfrench-AT-bestweb.net> for the bug report.
3163 <wfrench-AT-bestweb.net> for the bug report.
3149
3164
3150 2003-05-09 Fernando Perez <fperez@colorado.edu>
3165 2003-05-09 Fernando Perez <fperez@colorado.edu>
3151
3166
3152 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3167 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3153 to EvalDict (it's a mapping, after all) and simplified its code
3168 to EvalDict (it's a mapping, after all) and simplified its code
3154 quite a bit, after a nice discussion on c.l.py where Gustavo
3169 quite a bit, after a nice discussion on c.l.py where Gustavo
3155 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3170 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3156
3171
3157 2003-04-30 Fernando Perez <fperez@colorado.edu>
3172 2003-04-30 Fernando Perez <fperez@colorado.edu>
3158
3173
3159 * IPython/genutils.py (timings_out): modified it to reduce its
3174 * IPython/genutils.py (timings_out): modified it to reduce its
3160 overhead in the common reps==1 case.
3175 overhead in the common reps==1 case.
3161
3176
3162 2003-04-29 Fernando Perez <fperez@colorado.edu>
3177 2003-04-29 Fernando Perez <fperez@colorado.edu>
3163
3178
3164 * IPython/genutils.py (timings_out): Modified to use the resource
3179 * IPython/genutils.py (timings_out): Modified to use the resource
3165 module, which avoids the wraparound problems of time.clock().
3180 module, which avoids the wraparound problems of time.clock().
3166
3181
3167 2003-04-17 *** Released version 0.2.15pre4
3182 2003-04-17 *** Released version 0.2.15pre4
3168
3183
3169 2003-04-17 Fernando Perez <fperez@colorado.edu>
3184 2003-04-17 Fernando Perez <fperez@colorado.edu>
3170
3185
3171 * setup.py (scriptfiles): Split windows-specific stuff over to a
3186 * setup.py (scriptfiles): Split windows-specific stuff over to a
3172 separate file, in an attempt to have a Windows GUI installer.
3187 separate file, in an attempt to have a Windows GUI installer.
3173 That didn't work, but part of the groundwork is done.
3188 That didn't work, but part of the groundwork is done.
3174
3189
3175 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3190 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3176 indent/unindent with 4 spaces. Particularly useful in combination
3191 indent/unindent with 4 spaces. Particularly useful in combination
3177 with the new auto-indent option.
3192 with the new auto-indent option.
3178
3193
3179 2003-04-16 Fernando Perez <fperez@colorado.edu>
3194 2003-04-16 Fernando Perez <fperez@colorado.edu>
3180
3195
3181 * IPython/Magic.py: various replacements of self.rc for
3196 * IPython/Magic.py: various replacements of self.rc for
3182 self.shell.rc. A lot more remains to be done to fully disentangle
3197 self.shell.rc. A lot more remains to be done to fully disentangle
3183 this class from the main Shell class.
3198 this class from the main Shell class.
3184
3199
3185 * IPython/GnuplotRuntime.py: added checks for mouse support so
3200 * IPython/GnuplotRuntime.py: added checks for mouse support so
3186 that we don't try to enable it if the current gnuplot doesn't
3201 that we don't try to enable it if the current gnuplot doesn't
3187 really support it. Also added checks so that we don't try to
3202 really support it. Also added checks so that we don't try to
3188 enable persist under Windows (where Gnuplot doesn't recognize the
3203 enable persist under Windows (where Gnuplot doesn't recognize the
3189 option).
3204 option).
3190
3205
3191 * IPython/iplib.py (InteractiveShell.interact): Added optional
3206 * IPython/iplib.py (InteractiveShell.interact): Added optional
3192 auto-indenting code, after a patch by King C. Shu
3207 auto-indenting code, after a patch by King C. Shu
3193 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3208 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3194 get along well with pasting indented code. If I ever figure out
3209 get along well with pasting indented code. If I ever figure out
3195 how to make that part go well, it will become on by default.
3210 how to make that part go well, it will become on by default.
3196
3211
3197 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3212 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3198 crash ipython if there was an unmatched '%' in the user's prompt
3213 crash ipython if there was an unmatched '%' in the user's prompt
3199 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3214 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3200
3215
3201 * IPython/iplib.py (InteractiveShell.interact): removed the
3216 * IPython/iplib.py (InteractiveShell.interact): removed the
3202 ability to ask the user whether he wants to crash or not at the
3217 ability to ask the user whether he wants to crash or not at the
3203 'last line' exception handler. Calling functions at that point
3218 'last line' exception handler. Calling functions at that point
3204 changes the stack, and the error reports would have incorrect
3219 changes the stack, and the error reports would have incorrect
3205 tracebacks.
3220 tracebacks.
3206
3221
3207 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3222 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3208 pass through a peger a pretty-printed form of any object. After a
3223 pass through a peger a pretty-printed form of any object. After a
3209 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3224 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3210
3225
3211 2003-04-14 Fernando Perez <fperez@colorado.edu>
3226 2003-04-14 Fernando Perez <fperez@colorado.edu>
3212
3227
3213 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3228 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3214 all files in ~ would be modified at first install (instead of
3229 all files in ~ would be modified at first install (instead of
3215 ~/.ipython). This could be potentially disastrous, as the
3230 ~/.ipython). This could be potentially disastrous, as the
3216 modification (make line-endings native) could damage binary files.
3231 modification (make line-endings native) could damage binary files.
3217
3232
3218 2003-04-10 Fernando Perez <fperez@colorado.edu>
3233 2003-04-10 Fernando Perez <fperez@colorado.edu>
3219
3234
3220 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3235 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3221 handle only lines which are invalid python. This now means that
3236 handle only lines which are invalid python. This now means that
3222 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3237 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3223 for the bug report.
3238 for the bug report.
3224
3239
3225 2003-04-01 Fernando Perez <fperez@colorado.edu>
3240 2003-04-01 Fernando Perez <fperez@colorado.edu>
3226
3241
3227 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3242 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3228 where failing to set sys.last_traceback would crash pdb.pm().
3243 where failing to set sys.last_traceback would crash pdb.pm().
3229 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3244 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3230 report.
3245 report.
3231
3246
3232 2003-03-25 Fernando Perez <fperez@colorado.edu>
3247 2003-03-25 Fernando Perez <fperez@colorado.edu>
3233
3248
3234 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3249 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3235 before printing it (it had a lot of spurious blank lines at the
3250 before printing it (it had a lot of spurious blank lines at the
3236 end).
3251 end).
3237
3252
3238 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3253 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3239 output would be sent 21 times! Obviously people don't use this
3254 output would be sent 21 times! Obviously people don't use this
3240 too often, or I would have heard about it.
3255 too often, or I would have heard about it.
3241
3256
3242 2003-03-24 Fernando Perez <fperez@colorado.edu>
3257 2003-03-24 Fernando Perez <fperez@colorado.edu>
3243
3258
3244 * setup.py (scriptfiles): renamed the data_files parameter from
3259 * setup.py (scriptfiles): renamed the data_files parameter from
3245 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3260 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3246 for the patch.
3261 for the patch.
3247
3262
3248 2003-03-20 Fernando Perez <fperez@colorado.edu>
3263 2003-03-20 Fernando Perez <fperez@colorado.edu>
3249
3264
3250 * IPython/genutils.py (error): added error() and fatal()
3265 * IPython/genutils.py (error): added error() and fatal()
3251 functions.
3266 functions.
3252
3267
3253 2003-03-18 *** Released version 0.2.15pre3
3268 2003-03-18 *** Released version 0.2.15pre3
3254
3269
3255 2003-03-18 Fernando Perez <fperez@colorado.edu>
3270 2003-03-18 Fernando Perez <fperez@colorado.edu>
3256
3271
3257 * setupext/install_data_ext.py
3272 * setupext/install_data_ext.py
3258 (install_data_ext.initialize_options): Class contributed by Jack
3273 (install_data_ext.initialize_options): Class contributed by Jack
3259 Moffit for fixing the old distutils hack. He is sending this to
3274 Moffit for fixing the old distutils hack. He is sending this to
3260 the distutils folks so in the future we may not need it as a
3275 the distutils folks so in the future we may not need it as a
3261 private fix.
3276 private fix.
3262
3277
3263 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3278 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3264 changes for Debian packaging. See his patch for full details.
3279 changes for Debian packaging. See his patch for full details.
3265 The old distutils hack of making the ipythonrc* files carry a
3280 The old distutils hack of making the ipythonrc* files carry a
3266 bogus .py extension is gone, at last. Examples were moved to a
3281 bogus .py extension is gone, at last. Examples were moved to a
3267 separate subdir under doc/, and the separate executable scripts
3282 separate subdir under doc/, and the separate executable scripts
3268 now live in their own directory. Overall a great cleanup. The
3283 now live in their own directory. Overall a great cleanup. The
3269 manual was updated to use the new files, and setup.py has been
3284 manual was updated to use the new files, and setup.py has been
3270 fixed for this setup.
3285 fixed for this setup.
3271
3286
3272 * IPython/PyColorize.py (Parser.usage): made non-executable and
3287 * IPython/PyColorize.py (Parser.usage): made non-executable and
3273 created a pycolor wrapper around it to be included as a script.
3288 created a pycolor wrapper around it to be included as a script.
3274
3289
3275 2003-03-12 *** Released version 0.2.15pre2
3290 2003-03-12 *** Released version 0.2.15pre2
3276
3291
3277 2003-03-12 Fernando Perez <fperez@colorado.edu>
3292 2003-03-12 Fernando Perez <fperez@colorado.edu>
3278
3293
3279 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3294 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3280 long-standing problem with garbage characters in some terminals.
3295 long-standing problem with garbage characters in some terminals.
3281 The issue was really that the \001 and \002 escapes must _only_ be
3296 The issue was really that the \001 and \002 escapes must _only_ be
3282 passed to input prompts (which call readline), but _never_ to
3297 passed to input prompts (which call readline), but _never_ to
3283 normal text to be printed on screen. I changed ColorANSI to have
3298 normal text to be printed on screen. I changed ColorANSI to have
3284 two classes: TermColors and InputTermColors, each with the
3299 two classes: TermColors and InputTermColors, each with the
3285 appropriate escapes for input prompts or normal text. The code in
3300 appropriate escapes for input prompts or normal text. The code in
3286 Prompts.py got slightly more complicated, but this very old and
3301 Prompts.py got slightly more complicated, but this very old and
3287 annoying bug is finally fixed.
3302 annoying bug is finally fixed.
3288
3303
3289 All the credit for nailing down the real origin of this problem
3304 All the credit for nailing down the real origin of this problem
3290 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3305 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3291 *Many* thanks to him for spending quite a bit of effort on this.
3306 *Many* thanks to him for spending quite a bit of effort on this.
3292
3307
3293 2003-03-05 *** Released version 0.2.15pre1
3308 2003-03-05 *** Released version 0.2.15pre1
3294
3309
3295 2003-03-03 Fernando Perez <fperez@colorado.edu>
3310 2003-03-03 Fernando Perez <fperez@colorado.edu>
3296
3311
3297 * IPython/FakeModule.py: Moved the former _FakeModule to a
3312 * IPython/FakeModule.py: Moved the former _FakeModule to a
3298 separate file, because it's also needed by Magic (to fix a similar
3313 separate file, because it's also needed by Magic (to fix a similar
3299 pickle-related issue in @run).
3314 pickle-related issue in @run).
3300
3315
3301 2003-03-02 Fernando Perez <fperez@colorado.edu>
3316 2003-03-02 Fernando Perez <fperez@colorado.edu>
3302
3317
3303 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3318 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3304 the autocall option at runtime.
3319 the autocall option at runtime.
3305 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3320 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3306 across Magic.py to start separating Magic from InteractiveShell.
3321 across Magic.py to start separating Magic from InteractiveShell.
3307 (Magic._ofind): Fixed to return proper namespace for dotted
3322 (Magic._ofind): Fixed to return proper namespace for dotted
3308 names. Before, a dotted name would always return 'not currently
3323 names. Before, a dotted name would always return 'not currently
3309 defined', because it would find the 'parent'. s.x would be found,
3324 defined', because it would find the 'parent'. s.x would be found,
3310 but since 'x' isn't defined by itself, it would get confused.
3325 but since 'x' isn't defined by itself, it would get confused.
3311 (Magic.magic_run): Fixed pickling problems reported by Ralf
3326 (Magic.magic_run): Fixed pickling problems reported by Ralf
3312 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3327 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3313 that I'd used when Mike Heeter reported similar issues at the
3328 that I'd used when Mike Heeter reported similar issues at the
3314 top-level, but now for @run. It boils down to injecting the
3329 top-level, but now for @run. It boils down to injecting the
3315 namespace where code is being executed with something that looks
3330 namespace where code is being executed with something that looks
3316 enough like a module to fool pickle.dump(). Since a pickle stores
3331 enough like a module to fool pickle.dump(). Since a pickle stores
3317 a named reference to the importing module, we need this for
3332 a named reference to the importing module, we need this for
3318 pickles to save something sensible.
3333 pickles to save something sensible.
3319
3334
3320 * IPython/ipmaker.py (make_IPython): added an autocall option.
3335 * IPython/ipmaker.py (make_IPython): added an autocall option.
3321
3336
3322 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3337 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3323 the auto-eval code. Now autocalling is an option, and the code is
3338 the auto-eval code. Now autocalling is an option, and the code is
3324 also vastly safer. There is no more eval() involved at all.
3339 also vastly safer. There is no more eval() involved at all.
3325
3340
3326 2003-03-01 Fernando Perez <fperez@colorado.edu>
3341 2003-03-01 Fernando Perez <fperez@colorado.edu>
3327
3342
3328 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3343 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3329 dict with named keys instead of a tuple.
3344 dict with named keys instead of a tuple.
3330
3345
3331 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3346 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3332
3347
3333 * setup.py (make_shortcut): Fixed message about directories
3348 * setup.py (make_shortcut): Fixed message about directories
3334 created during Windows installation (the directories were ok, just
3349 created during Windows installation (the directories were ok, just
3335 the printed message was misleading). Thanks to Chris Liechti
3350 the printed message was misleading). Thanks to Chris Liechti
3336 <cliechti-AT-gmx.net> for the heads up.
3351 <cliechti-AT-gmx.net> for the heads up.
3337
3352
3338 2003-02-21 Fernando Perez <fperez@colorado.edu>
3353 2003-02-21 Fernando Perez <fperez@colorado.edu>
3339
3354
3340 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3355 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3341 of ValueError exception when checking for auto-execution. This
3356 of ValueError exception when checking for auto-execution. This
3342 one is raised by things like Numeric arrays arr.flat when the
3357 one is raised by things like Numeric arrays arr.flat when the
3343 array is non-contiguous.
3358 array is non-contiguous.
3344
3359
3345 2003-01-31 Fernando Perez <fperez@colorado.edu>
3360 2003-01-31 Fernando Perez <fperez@colorado.edu>
3346
3361
3347 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3362 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3348 not return any value at all (even though the command would get
3363 not return any value at all (even though the command would get
3349 executed).
3364 executed).
3350 (xsys): Flush stdout right after printing the command to ensure
3365 (xsys): Flush stdout right after printing the command to ensure
3351 proper ordering of commands and command output in the total
3366 proper ordering of commands and command output in the total
3352 output.
3367 output.
3353 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3368 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3354 system/getoutput as defaults. The old ones are kept for
3369 system/getoutput as defaults. The old ones are kept for
3355 compatibility reasons, so no code which uses this library needs
3370 compatibility reasons, so no code which uses this library needs
3356 changing.
3371 changing.
3357
3372
3358 2003-01-27 *** Released version 0.2.14
3373 2003-01-27 *** Released version 0.2.14
3359
3374
3360 2003-01-25 Fernando Perez <fperez@colorado.edu>
3375 2003-01-25 Fernando Perez <fperez@colorado.edu>
3361
3376
3362 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3377 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3363 functions defined in previous edit sessions could not be re-edited
3378 functions defined in previous edit sessions could not be re-edited
3364 (because the temp files were immediately removed). Now temp files
3379 (because the temp files were immediately removed). Now temp files
3365 are removed only at IPython's exit.
3380 are removed only at IPython's exit.
3366 (Magic.magic_run): Improved @run to perform shell-like expansions
3381 (Magic.magic_run): Improved @run to perform shell-like expansions
3367 on its arguments (~users and $VARS). With this, @run becomes more
3382 on its arguments (~users and $VARS). With this, @run becomes more
3368 like a normal command-line.
3383 like a normal command-line.
3369
3384
3370 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3385 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3371 bugs related to embedding and cleaned up that code. A fairly
3386 bugs related to embedding and cleaned up that code. A fairly
3372 important one was the impossibility to access the global namespace
3387 important one was the impossibility to access the global namespace
3373 through the embedded IPython (only local variables were visible).
3388 through the embedded IPython (only local variables were visible).
3374
3389
3375 2003-01-14 Fernando Perez <fperez@colorado.edu>
3390 2003-01-14 Fernando Perez <fperez@colorado.edu>
3376
3391
3377 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3392 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3378 auto-calling to be a bit more conservative. Now it doesn't get
3393 auto-calling to be a bit more conservative. Now it doesn't get
3379 triggered if any of '!=()<>' are in the rest of the input line, to
3394 triggered if any of '!=()<>' are in the rest of the input line, to
3380 allow comparing callables. Thanks to Alex for the heads up.
3395 allow comparing callables. Thanks to Alex for the heads up.
3381
3396
3382 2003-01-07 Fernando Perez <fperez@colorado.edu>
3397 2003-01-07 Fernando Perez <fperez@colorado.edu>
3383
3398
3384 * IPython/genutils.py (page): fixed estimation of the number of
3399 * IPython/genutils.py (page): fixed estimation of the number of
3385 lines in a string to be paged to simply count newlines. This
3400 lines in a string to be paged to simply count newlines. This
3386 prevents over-guessing due to embedded escape sequences. A better
3401 prevents over-guessing due to embedded escape sequences. A better
3387 long-term solution would involve stripping out the control chars
3402 long-term solution would involve stripping out the control chars
3388 for the count, but it's potentially so expensive I just don't
3403 for the count, but it's potentially so expensive I just don't
3389 think it's worth doing.
3404 think it's worth doing.
3390
3405
3391 2002-12-19 *** Released version 0.2.14pre50
3406 2002-12-19 *** Released version 0.2.14pre50
3392
3407
3393 2002-12-19 Fernando Perez <fperez@colorado.edu>
3408 2002-12-19 Fernando Perez <fperez@colorado.edu>
3394
3409
3395 * tools/release (version): Changed release scripts to inform
3410 * tools/release (version): Changed release scripts to inform
3396 Andrea and build a NEWS file with a list of recent changes.
3411 Andrea and build a NEWS file with a list of recent changes.
3397
3412
3398 * IPython/ColorANSI.py (__all__): changed terminal detection
3413 * IPython/ColorANSI.py (__all__): changed terminal detection
3399 code. Seems to work better for xterms without breaking
3414 code. Seems to work better for xterms without breaking
3400 konsole. Will need more testing to determine if WinXP and Mac OSX
3415 konsole. Will need more testing to determine if WinXP and Mac OSX
3401 also work ok.
3416 also work ok.
3402
3417
3403 2002-12-18 *** Released version 0.2.14pre49
3418 2002-12-18 *** Released version 0.2.14pre49
3404
3419
3405 2002-12-18 Fernando Perez <fperez@colorado.edu>
3420 2002-12-18 Fernando Perez <fperez@colorado.edu>
3406
3421
3407 * Docs: added new info about Mac OSX, from Andrea.
3422 * Docs: added new info about Mac OSX, from Andrea.
3408
3423
3409 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3424 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3410 allow direct plotting of python strings whose format is the same
3425 allow direct plotting of python strings whose format is the same
3411 of gnuplot data files.
3426 of gnuplot data files.
3412
3427
3413 2002-12-16 Fernando Perez <fperez@colorado.edu>
3428 2002-12-16 Fernando Perez <fperez@colorado.edu>
3414
3429
3415 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3430 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3416 value of exit question to be acknowledged.
3431 value of exit question to be acknowledged.
3417
3432
3418 2002-12-03 Fernando Perez <fperez@colorado.edu>
3433 2002-12-03 Fernando Perez <fperez@colorado.edu>
3419
3434
3420 * IPython/ipmaker.py: removed generators, which had been added
3435 * IPython/ipmaker.py: removed generators, which had been added
3421 by mistake in an earlier debugging run. This was causing trouble
3436 by mistake in an earlier debugging run. This was causing trouble
3422 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3437 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3423 for pointing this out.
3438 for pointing this out.
3424
3439
3425 2002-11-17 Fernando Perez <fperez@colorado.edu>
3440 2002-11-17 Fernando Perez <fperez@colorado.edu>
3426
3441
3427 * Manual: updated the Gnuplot section.
3442 * Manual: updated the Gnuplot section.
3428
3443
3429 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3444 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3430 a much better split of what goes in Runtime and what goes in
3445 a much better split of what goes in Runtime and what goes in
3431 Interactive.
3446 Interactive.
3432
3447
3433 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3448 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3434 being imported from iplib.
3449 being imported from iplib.
3435
3450
3436 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3451 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3437 for command-passing. Now the global Gnuplot instance is called
3452 for command-passing. Now the global Gnuplot instance is called
3438 'gp' instead of 'g', which was really a far too fragile and
3453 'gp' instead of 'g', which was really a far too fragile and
3439 common name.
3454 common name.
3440
3455
3441 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3456 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3442 bounding boxes generated by Gnuplot for square plots.
3457 bounding boxes generated by Gnuplot for square plots.
3443
3458
3444 * IPython/genutils.py (popkey): new function added. I should
3459 * IPython/genutils.py (popkey): new function added. I should
3445 suggest this on c.l.py as a dict method, it seems useful.
3460 suggest this on c.l.py as a dict method, it seems useful.
3446
3461
3447 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3462 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3448 to transparently handle PostScript generation. MUCH better than
3463 to transparently handle PostScript generation. MUCH better than
3449 the previous plot_eps/replot_eps (which I removed now). The code
3464 the previous plot_eps/replot_eps (which I removed now). The code
3450 is also fairly clean and well documented now (including
3465 is also fairly clean and well documented now (including
3451 docstrings).
3466 docstrings).
3452
3467
3453 2002-11-13 Fernando Perez <fperez@colorado.edu>
3468 2002-11-13 Fernando Perez <fperez@colorado.edu>
3454
3469
3455 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3470 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3456 (inconsistent with options).
3471 (inconsistent with options).
3457
3472
3458 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3473 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3459 manually disabled, I don't know why. Fixed it.
3474 manually disabled, I don't know why. Fixed it.
3460 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3475 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3461 eps output.
3476 eps output.
3462
3477
3463 2002-11-12 Fernando Perez <fperez@colorado.edu>
3478 2002-11-12 Fernando Perez <fperez@colorado.edu>
3464
3479
3465 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3480 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3466 don't propagate up to caller. Fixes crash reported by François
3481 don't propagate up to caller. Fixes crash reported by François
3467 Pinard.
3482 Pinard.
3468
3483
3469 2002-11-09 Fernando Perez <fperez@colorado.edu>
3484 2002-11-09 Fernando Perez <fperez@colorado.edu>
3470
3485
3471 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3486 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3472 history file for new users.
3487 history file for new users.
3473 (make_IPython): fixed bug where initial install would leave the
3488 (make_IPython): fixed bug where initial install would leave the
3474 user running in the .ipython dir.
3489 user running in the .ipython dir.
3475 (make_IPython): fixed bug where config dir .ipython would be
3490 (make_IPython): fixed bug where config dir .ipython would be
3476 created regardless of the given -ipythondir option. Thanks to Cory
3491 created regardless of the given -ipythondir option. Thanks to Cory
3477 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3492 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3478
3493
3479 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3494 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3480 type confirmations. Will need to use it in all of IPython's code
3495 type confirmations. Will need to use it in all of IPython's code
3481 consistently.
3496 consistently.
3482
3497
3483 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3498 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3484 context to print 31 lines instead of the default 5. This will make
3499 context to print 31 lines instead of the default 5. This will make
3485 the crash reports extremely detailed in case the problem is in
3500 the crash reports extremely detailed in case the problem is in
3486 libraries I don't have access to.
3501 libraries I don't have access to.
3487
3502
3488 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3503 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3489 line of defense' code to still crash, but giving users fair
3504 line of defense' code to still crash, but giving users fair
3490 warning. I don't want internal errors to go unreported: if there's
3505 warning. I don't want internal errors to go unreported: if there's
3491 an internal problem, IPython should crash and generate a full
3506 an internal problem, IPython should crash and generate a full
3492 report.
3507 report.
3493
3508
3494 2002-11-08 Fernando Perez <fperez@colorado.edu>
3509 2002-11-08 Fernando Perez <fperez@colorado.edu>
3495
3510
3496 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3511 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3497 otherwise uncaught exceptions which can appear if people set
3512 otherwise uncaught exceptions which can appear if people set
3498 sys.stdout to something badly broken. Thanks to a crash report
3513 sys.stdout to something badly broken. Thanks to a crash report
3499 from henni-AT-mail.brainbot.com.
3514 from henni-AT-mail.brainbot.com.
3500
3515
3501 2002-11-04 Fernando Perez <fperez@colorado.edu>
3516 2002-11-04 Fernando Perez <fperez@colorado.edu>
3502
3517
3503 * IPython/iplib.py (InteractiveShell.interact): added
3518 * IPython/iplib.py (InteractiveShell.interact): added
3504 __IPYTHON__active to the builtins. It's a flag which goes on when
3519 __IPYTHON__active to the builtins. It's a flag which goes on when
3505 the interaction starts and goes off again when it stops. This
3520 the interaction starts and goes off again when it stops. This
3506 allows embedding code to detect being inside IPython. Before this
3521 allows embedding code to detect being inside IPython. Before this
3507 was done via __IPYTHON__, but that only shows that an IPython
3522 was done via __IPYTHON__, but that only shows that an IPython
3508 instance has been created.
3523 instance has been created.
3509
3524
3510 * IPython/Magic.py (Magic.magic_env): I realized that in a
3525 * IPython/Magic.py (Magic.magic_env): I realized that in a
3511 UserDict, instance.data holds the data as a normal dict. So I
3526 UserDict, instance.data holds the data as a normal dict. So I
3512 modified @env to return os.environ.data instead of rebuilding a
3527 modified @env to return os.environ.data instead of rebuilding a
3513 dict by hand.
3528 dict by hand.
3514
3529
3515 2002-11-02 Fernando Perez <fperez@colorado.edu>
3530 2002-11-02 Fernando Perez <fperez@colorado.edu>
3516
3531
3517 * IPython/genutils.py (warn): changed so that level 1 prints no
3532 * IPython/genutils.py (warn): changed so that level 1 prints no
3518 header. Level 2 is now the default (with 'WARNING' header, as
3533 header. Level 2 is now the default (with 'WARNING' header, as
3519 before). I think I tracked all places where changes were needed in
3534 before). I think I tracked all places where changes were needed in
3520 IPython, but outside code using the old level numbering may have
3535 IPython, but outside code using the old level numbering may have
3521 broken.
3536 broken.
3522
3537
3523 * IPython/iplib.py (InteractiveShell.runcode): added this to
3538 * IPython/iplib.py (InteractiveShell.runcode): added this to
3524 handle the tracebacks in SystemExit traps correctly. The previous
3539 handle the tracebacks in SystemExit traps correctly. The previous
3525 code (through interact) was printing more of the stack than
3540 code (through interact) was printing more of the stack than
3526 necessary, showing IPython internal code to the user.
3541 necessary, showing IPython internal code to the user.
3527
3542
3528 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3543 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3529 default. Now that the default at the confirmation prompt is yes,
3544 default. Now that the default at the confirmation prompt is yes,
3530 it's not so intrusive. François' argument that ipython sessions
3545 it's not so intrusive. François' argument that ipython sessions
3531 tend to be complex enough not to lose them from an accidental C-d,
3546 tend to be complex enough not to lose them from an accidental C-d,
3532 is a valid one.
3547 is a valid one.
3533
3548
3534 * IPython/iplib.py (InteractiveShell.interact): added a
3549 * IPython/iplib.py (InteractiveShell.interact): added a
3535 showtraceback() call to the SystemExit trap, and modified the exit
3550 showtraceback() call to the SystemExit trap, and modified the exit
3536 confirmation to have yes as the default.
3551 confirmation to have yes as the default.
3537
3552
3538 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3553 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3539 this file. It's been gone from the code for a long time, this was
3554 this file. It's been gone from the code for a long time, this was
3540 simply leftover junk.
3555 simply leftover junk.
3541
3556
3542 2002-11-01 Fernando Perez <fperez@colorado.edu>
3557 2002-11-01 Fernando Perez <fperez@colorado.edu>
3543
3558
3544 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3559 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3545 added. If set, IPython now traps EOF and asks for
3560 added. If set, IPython now traps EOF and asks for
3546 confirmation. After a request by François Pinard.
3561 confirmation. After a request by François Pinard.
3547
3562
3548 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3563 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3549 of @abort, and with a new (better) mechanism for handling the
3564 of @abort, and with a new (better) mechanism for handling the
3550 exceptions.
3565 exceptions.
3551
3566
3552 2002-10-27 Fernando Perez <fperez@colorado.edu>
3567 2002-10-27 Fernando Perez <fperez@colorado.edu>
3553
3568
3554 * IPython/usage.py (__doc__): updated the --help information and
3569 * IPython/usage.py (__doc__): updated the --help information and
3555 the ipythonrc file to indicate that -log generates
3570 the ipythonrc file to indicate that -log generates
3556 ./ipython.log. Also fixed the corresponding info in @logstart.
3571 ./ipython.log. Also fixed the corresponding info in @logstart.
3557 This and several other fixes in the manuals thanks to reports by
3572 This and several other fixes in the manuals thanks to reports by
3558 François Pinard <pinard-AT-iro.umontreal.ca>.
3573 François Pinard <pinard-AT-iro.umontreal.ca>.
3559
3574
3560 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3575 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3561 refer to @logstart (instead of @log, which doesn't exist).
3576 refer to @logstart (instead of @log, which doesn't exist).
3562
3577
3563 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3578 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3564 AttributeError crash. Thanks to Christopher Armstrong
3579 AttributeError crash. Thanks to Christopher Armstrong
3565 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3580 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3566 introduced recently (in 0.2.14pre37) with the fix to the eval
3581 introduced recently (in 0.2.14pre37) with the fix to the eval
3567 problem mentioned below.
3582 problem mentioned below.
3568
3583
3569 2002-10-17 Fernando Perez <fperez@colorado.edu>
3584 2002-10-17 Fernando Perez <fperez@colorado.edu>
3570
3585
3571 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3586 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3572 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3587 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3573
3588
3574 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3589 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3575 this function to fix a problem reported by Alex Schmolck. He saw
3590 this function to fix a problem reported by Alex Schmolck. He saw
3576 it with list comprehensions and generators, which were getting
3591 it with list comprehensions and generators, which were getting
3577 called twice. The real problem was an 'eval' call in testing for
3592 called twice. The real problem was an 'eval' call in testing for
3578 automagic which was evaluating the input line silently.
3593 automagic which was evaluating the input line silently.
3579
3594
3580 This is a potentially very nasty bug, if the input has side
3595 This is a potentially very nasty bug, if the input has side
3581 effects which must not be repeated. The code is much cleaner now,
3596 effects which must not be repeated. The code is much cleaner now,
3582 without any blanket 'except' left and with a regexp test for
3597 without any blanket 'except' left and with a regexp test for
3583 actual function names.
3598 actual function names.
3584
3599
3585 But an eval remains, which I'm not fully comfortable with. I just
3600 But an eval remains, which I'm not fully comfortable with. I just
3586 don't know how to find out if an expression could be a callable in
3601 don't know how to find out if an expression could be a callable in
3587 the user's namespace without doing an eval on the string. However
3602 the user's namespace without doing an eval on the string. However
3588 that string is now much more strictly checked so that no code
3603 that string is now much more strictly checked so that no code
3589 slips by, so the eval should only happen for things that can
3604 slips by, so the eval should only happen for things that can
3590 really be only function/method names.
3605 really be only function/method names.
3591
3606
3592 2002-10-15 Fernando Perez <fperez@colorado.edu>
3607 2002-10-15 Fernando Perez <fperez@colorado.edu>
3593
3608
3594 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3609 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3595 OSX information to main manual, removed README_Mac_OSX file from
3610 OSX information to main manual, removed README_Mac_OSX file from
3596 distribution. Also updated credits for recent additions.
3611 distribution. Also updated credits for recent additions.
3597
3612
3598 2002-10-10 Fernando Perez <fperez@colorado.edu>
3613 2002-10-10 Fernando Perez <fperez@colorado.edu>
3599
3614
3600 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3615 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3601 terminal-related issues. Many thanks to Andrea Riciputi
3616 terminal-related issues. Many thanks to Andrea Riciputi
3602 <andrea.riciputi-AT-libero.it> for writing it.
3617 <andrea.riciputi-AT-libero.it> for writing it.
3603
3618
3604 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3619 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3605 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3620 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3606
3621
3607 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3622 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3608 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3623 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3609 <syver-en-AT-online.no> who both submitted patches for this problem.
3624 <syver-en-AT-online.no> who both submitted patches for this problem.
3610
3625
3611 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3626 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3612 global embedding to make sure that things don't overwrite user
3627 global embedding to make sure that things don't overwrite user
3613 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3628 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3614
3629
3615 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3630 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3616 compatibility. Thanks to Hayden Callow
3631 compatibility. Thanks to Hayden Callow
3617 <h.callow-AT-elec.canterbury.ac.nz>
3632 <h.callow-AT-elec.canterbury.ac.nz>
3618
3633
3619 2002-10-04 Fernando Perez <fperez@colorado.edu>
3634 2002-10-04 Fernando Perez <fperez@colorado.edu>
3620
3635
3621 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3636 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3622 Gnuplot.File objects.
3637 Gnuplot.File objects.
3623
3638
3624 2002-07-23 Fernando Perez <fperez@colorado.edu>
3639 2002-07-23 Fernando Perez <fperez@colorado.edu>
3625
3640
3626 * IPython/genutils.py (timing): Added timings() and timing() for
3641 * IPython/genutils.py (timing): Added timings() and timing() for
3627 quick access to the most commonly needed data, the execution
3642 quick access to the most commonly needed data, the execution
3628 times. Old timing() renamed to timings_out().
3643 times. Old timing() renamed to timings_out().
3629
3644
3630 2002-07-18 Fernando Perez <fperez@colorado.edu>
3645 2002-07-18 Fernando Perez <fperez@colorado.edu>
3631
3646
3632 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3647 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3633 bug with nested instances disrupting the parent's tab completion.
3648 bug with nested instances disrupting the parent's tab completion.
3634
3649
3635 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3650 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3636 all_completions code to begin the emacs integration.
3651 all_completions code to begin the emacs integration.
3637
3652
3638 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3653 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3639 argument to allow titling individual arrays when plotting.
3654 argument to allow titling individual arrays when plotting.
3640
3655
3641 2002-07-15 Fernando Perez <fperez@colorado.edu>
3656 2002-07-15 Fernando Perez <fperez@colorado.edu>
3642
3657
3643 * setup.py (make_shortcut): changed to retrieve the value of
3658 * setup.py (make_shortcut): changed to retrieve the value of
3644 'Program Files' directory from the registry (this value changes in
3659 'Program Files' directory from the registry (this value changes in
3645 non-english versions of Windows). Thanks to Thomas Fanslau
3660 non-english versions of Windows). Thanks to Thomas Fanslau
3646 <tfanslau-AT-gmx.de> for the report.
3661 <tfanslau-AT-gmx.de> for the report.
3647
3662
3648 2002-07-10 Fernando Perez <fperez@colorado.edu>
3663 2002-07-10 Fernando Perez <fperez@colorado.edu>
3649
3664
3650 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3665 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3651 a bug in pdb, which crashes if a line with only whitespace is
3666 a bug in pdb, which crashes if a line with only whitespace is
3652 entered. Bug report submitted to sourceforge.
3667 entered. Bug report submitted to sourceforge.
3653
3668
3654 2002-07-09 Fernando Perez <fperez@colorado.edu>
3669 2002-07-09 Fernando Perez <fperez@colorado.edu>
3655
3670
3656 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3671 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3657 reporting exceptions (it's a bug in inspect.py, I just set a
3672 reporting exceptions (it's a bug in inspect.py, I just set a
3658 workaround).
3673 workaround).
3659
3674
3660 2002-07-08 Fernando Perez <fperez@colorado.edu>
3675 2002-07-08 Fernando Perez <fperez@colorado.edu>
3661
3676
3662 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3677 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3663 __IPYTHON__ in __builtins__ to show up in user_ns.
3678 __IPYTHON__ in __builtins__ to show up in user_ns.
3664
3679
3665 2002-07-03 Fernando Perez <fperez@colorado.edu>
3680 2002-07-03 Fernando Perez <fperez@colorado.edu>
3666
3681
3667 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3682 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3668 name from @gp_set_instance to @gp_set_default.
3683 name from @gp_set_instance to @gp_set_default.
3669
3684
3670 * IPython/ipmaker.py (make_IPython): default editor value set to
3685 * IPython/ipmaker.py (make_IPython): default editor value set to
3671 '0' (a string), to match the rc file. Otherwise will crash when
3686 '0' (a string), to match the rc file. Otherwise will crash when
3672 .strip() is called on it.
3687 .strip() is called on it.
3673
3688
3674
3689
3675 2002-06-28 Fernando Perez <fperez@colorado.edu>
3690 2002-06-28 Fernando Perez <fperez@colorado.edu>
3676
3691
3677 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3692 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3678 of files in current directory when a file is executed via
3693 of files in current directory when a file is executed via
3679 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3694 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3680
3695
3681 * setup.py (manfiles): fix for rpm builds, submitted by RA
3696 * setup.py (manfiles): fix for rpm builds, submitted by RA
3682 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3697 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3683
3698
3684 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3699 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3685 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3700 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3686 string!). A. Schmolck caught this one.
3701 string!). A. Schmolck caught this one.
3687
3702
3688 2002-06-27 Fernando Perez <fperez@colorado.edu>
3703 2002-06-27 Fernando Perez <fperez@colorado.edu>
3689
3704
3690 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3705 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3691 defined files at the cmd line. __name__ wasn't being set to
3706 defined files at the cmd line. __name__ wasn't being set to
3692 __main__.
3707 __main__.
3693
3708
3694 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3709 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3695 regular lists and tuples besides Numeric arrays.
3710 regular lists and tuples besides Numeric arrays.
3696
3711
3697 * IPython/Prompts.py (CachedOutput.__call__): Added output
3712 * IPython/Prompts.py (CachedOutput.__call__): Added output
3698 supression for input ending with ';'. Similar to Mathematica and
3713 supression for input ending with ';'. Similar to Mathematica and
3699 Matlab. The _* vars and Out[] list are still updated, just like
3714 Matlab. The _* vars and Out[] list are still updated, just like
3700 Mathematica behaves.
3715 Mathematica behaves.
3701
3716
3702 2002-06-25 Fernando Perez <fperez@colorado.edu>
3717 2002-06-25 Fernando Perez <fperez@colorado.edu>
3703
3718
3704 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3719 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3705 .ini extensions for profiels under Windows.
3720 .ini extensions for profiels under Windows.
3706
3721
3707 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3722 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3708 string form. Fix contributed by Alexander Schmolck
3723 string form. Fix contributed by Alexander Schmolck
3709 <a.schmolck-AT-gmx.net>
3724 <a.schmolck-AT-gmx.net>
3710
3725
3711 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3726 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3712 pre-configured Gnuplot instance.
3727 pre-configured Gnuplot instance.
3713
3728
3714 2002-06-21 Fernando Perez <fperez@colorado.edu>
3729 2002-06-21 Fernando Perez <fperez@colorado.edu>
3715
3730
3716 * IPython/numutils.py (exp_safe): new function, works around the
3731 * IPython/numutils.py (exp_safe): new function, works around the
3717 underflow problems in Numeric.
3732 underflow problems in Numeric.
3718 (log2): New fn. Safe log in base 2: returns exact integer answer
3733 (log2): New fn. Safe log in base 2: returns exact integer answer
3719 for exact integer powers of 2.
3734 for exact integer powers of 2.
3720
3735
3721 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3736 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3722 properly.
3737 properly.
3723
3738
3724 2002-06-20 Fernando Perez <fperez@colorado.edu>
3739 2002-06-20 Fernando Perez <fperez@colorado.edu>
3725
3740
3726 * IPython/genutils.py (timing): new function like
3741 * IPython/genutils.py (timing): new function like
3727 Mathematica's. Similar to time_test, but returns more info.
3742 Mathematica's. Similar to time_test, but returns more info.
3728
3743
3729 2002-06-18 Fernando Perez <fperez@colorado.edu>
3744 2002-06-18 Fernando Perez <fperez@colorado.edu>
3730
3745
3731 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3746 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3732 according to Mike Heeter's suggestions.
3747 according to Mike Heeter's suggestions.
3733
3748
3734 2002-06-16 Fernando Perez <fperez@colorado.edu>
3749 2002-06-16 Fernando Perez <fperez@colorado.edu>
3735
3750
3736 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3751 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3737 system. GnuplotMagic is gone as a user-directory option. New files
3752 system. GnuplotMagic is gone as a user-directory option. New files
3738 make it easier to use all the gnuplot stuff both from external
3753 make it easier to use all the gnuplot stuff both from external
3739 programs as well as from IPython. Had to rewrite part of
3754 programs as well as from IPython. Had to rewrite part of
3740 hardcopy() b/c of a strange bug: often the ps files simply don't
3755 hardcopy() b/c of a strange bug: often the ps files simply don't
3741 get created, and require a repeat of the command (often several
3756 get created, and require a repeat of the command (often several
3742 times).
3757 times).
3743
3758
3744 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3759 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3745 resolve output channel at call time, so that if sys.stderr has
3760 resolve output channel at call time, so that if sys.stderr has
3746 been redirected by user this gets honored.
3761 been redirected by user this gets honored.
3747
3762
3748 2002-06-13 Fernando Perez <fperez@colorado.edu>
3763 2002-06-13 Fernando Perez <fperez@colorado.edu>
3749
3764
3750 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3765 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3751 IPShell. Kept a copy with the old names to avoid breaking people's
3766 IPShell. Kept a copy with the old names to avoid breaking people's
3752 embedded code.
3767 embedded code.
3753
3768
3754 * IPython/ipython: simplified it to the bare minimum after
3769 * IPython/ipython: simplified it to the bare minimum after
3755 Holger's suggestions. Added info about how to use it in
3770 Holger's suggestions. Added info about how to use it in
3756 PYTHONSTARTUP.
3771 PYTHONSTARTUP.
3757
3772
3758 * IPython/Shell.py (IPythonShell): changed the options passing
3773 * IPython/Shell.py (IPythonShell): changed the options passing
3759 from a string with funky %s replacements to a straight list. Maybe
3774 from a string with funky %s replacements to a straight list. Maybe
3760 a bit more typing, but it follows sys.argv conventions, so there's
3775 a bit more typing, but it follows sys.argv conventions, so there's
3761 less special-casing to remember.
3776 less special-casing to remember.
3762
3777
3763 2002-06-12 Fernando Perez <fperez@colorado.edu>
3778 2002-06-12 Fernando Perez <fperez@colorado.edu>
3764
3779
3765 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3780 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3766 command. Thanks to a suggestion by Mike Heeter.
3781 command. Thanks to a suggestion by Mike Heeter.
3767 (Magic.magic_pfile): added behavior to look at filenames if given
3782 (Magic.magic_pfile): added behavior to look at filenames if given
3768 arg is not a defined object.
3783 arg is not a defined object.
3769 (Magic.magic_save): New @save function to save code snippets. Also
3784 (Magic.magic_save): New @save function to save code snippets. Also
3770 a Mike Heeter idea.
3785 a Mike Heeter idea.
3771
3786
3772 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3787 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3773 plot() and replot(). Much more convenient now, especially for
3788 plot() and replot(). Much more convenient now, especially for
3774 interactive use.
3789 interactive use.
3775
3790
3776 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3791 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3777 filenames.
3792 filenames.
3778
3793
3779 2002-06-02 Fernando Perez <fperez@colorado.edu>
3794 2002-06-02 Fernando Perez <fperez@colorado.edu>
3780
3795
3781 * IPython/Struct.py (Struct.__init__): modified to admit
3796 * IPython/Struct.py (Struct.__init__): modified to admit
3782 initialization via another struct.
3797 initialization via another struct.
3783
3798
3784 * IPython/genutils.py (SystemExec.__init__): New stateful
3799 * IPython/genutils.py (SystemExec.__init__): New stateful
3785 interface to xsys and bq. Useful for writing system scripts.
3800 interface to xsys and bq. Useful for writing system scripts.
3786
3801
3787 2002-05-30 Fernando Perez <fperez@colorado.edu>
3802 2002-05-30 Fernando Perez <fperez@colorado.edu>
3788
3803
3789 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3804 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3790 documents. This will make the user download smaller (it's getting
3805 documents. This will make the user download smaller (it's getting
3791 too big).
3806 too big).
3792
3807
3793 2002-05-29 Fernando Perez <fperez@colorado.edu>
3808 2002-05-29 Fernando Perez <fperez@colorado.edu>
3794
3809
3795 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3810 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3796 fix problems with shelve and pickle. Seems to work, but I don't
3811 fix problems with shelve and pickle. Seems to work, but I don't
3797 know if corner cases break it. Thanks to Mike Heeter
3812 know if corner cases break it. Thanks to Mike Heeter
3798 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3813 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3799
3814
3800 2002-05-24 Fernando Perez <fperez@colorado.edu>
3815 2002-05-24 Fernando Perez <fperez@colorado.edu>
3801
3816
3802 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3817 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3803 macros having broken.
3818 macros having broken.
3804
3819
3805 2002-05-21 Fernando Perez <fperez@colorado.edu>
3820 2002-05-21 Fernando Perez <fperez@colorado.edu>
3806
3821
3807 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3822 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3808 introduced logging bug: all history before logging started was
3823 introduced logging bug: all history before logging started was
3809 being written one character per line! This came from the redesign
3824 being written one character per line! This came from the redesign
3810 of the input history as a special list which slices to strings,
3825 of the input history as a special list which slices to strings,
3811 not to lists.
3826 not to lists.
3812
3827
3813 2002-05-20 Fernando Perez <fperez@colorado.edu>
3828 2002-05-20 Fernando Perez <fperez@colorado.edu>
3814
3829
3815 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3830 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3816 be an attribute of all classes in this module. The design of these
3831 be an attribute of all classes in this module. The design of these
3817 classes needs some serious overhauling.
3832 classes needs some serious overhauling.
3818
3833
3819 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3834 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3820 which was ignoring '_' in option names.
3835 which was ignoring '_' in option names.
3821
3836
3822 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3837 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3823 'Verbose_novars' to 'Context' and made it the new default. It's a
3838 'Verbose_novars' to 'Context' and made it the new default. It's a
3824 bit more readable and also safer than verbose.
3839 bit more readable and also safer than verbose.
3825
3840
3826 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3841 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3827 triple-quoted strings.
3842 triple-quoted strings.
3828
3843
3829 * IPython/OInspect.py (__all__): new module exposing the object
3844 * IPython/OInspect.py (__all__): new module exposing the object
3830 introspection facilities. Now the corresponding magics are dummy
3845 introspection facilities. Now the corresponding magics are dummy
3831 wrappers around this. Having this module will make it much easier
3846 wrappers around this. Having this module will make it much easier
3832 to put these functions into our modified pdb.
3847 to put these functions into our modified pdb.
3833 This new object inspector system uses the new colorizing module,
3848 This new object inspector system uses the new colorizing module,
3834 so source code and other things are nicely syntax highlighted.
3849 so source code and other things are nicely syntax highlighted.
3835
3850
3836 2002-05-18 Fernando Perez <fperez@colorado.edu>
3851 2002-05-18 Fernando Perez <fperez@colorado.edu>
3837
3852
3838 * IPython/ColorANSI.py: Split the coloring tools into a separate
3853 * IPython/ColorANSI.py: Split the coloring tools into a separate
3839 module so I can use them in other code easier (they were part of
3854 module so I can use them in other code easier (they were part of
3840 ultraTB).
3855 ultraTB).
3841
3856
3842 2002-05-17 Fernando Perez <fperez@colorado.edu>
3857 2002-05-17 Fernando Perez <fperez@colorado.edu>
3843
3858
3844 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3859 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3845 fixed it to set the global 'g' also to the called instance, as
3860 fixed it to set the global 'g' also to the called instance, as
3846 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3861 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3847 user's 'g' variables).
3862 user's 'g' variables).
3848
3863
3849 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3864 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3850 global variables (aliases to _ih,_oh) so that users which expect
3865 global variables (aliases to _ih,_oh) so that users which expect
3851 In[5] or Out[7] to work aren't unpleasantly surprised.
3866 In[5] or Out[7] to work aren't unpleasantly surprised.
3852 (InputList.__getslice__): new class to allow executing slices of
3867 (InputList.__getslice__): new class to allow executing slices of
3853 input history directly. Very simple class, complements the use of
3868 input history directly. Very simple class, complements the use of
3854 macros.
3869 macros.
3855
3870
3856 2002-05-16 Fernando Perez <fperez@colorado.edu>
3871 2002-05-16 Fernando Perez <fperez@colorado.edu>
3857
3872
3858 * setup.py (docdirbase): make doc directory be just doc/IPython
3873 * setup.py (docdirbase): make doc directory be just doc/IPython
3859 without version numbers, it will reduce clutter for users.
3874 without version numbers, it will reduce clutter for users.
3860
3875
3861 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3876 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3862 execfile call to prevent possible memory leak. See for details:
3877 execfile call to prevent possible memory leak. See for details:
3863 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3878 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3864
3879
3865 2002-05-15 Fernando Perez <fperez@colorado.edu>
3880 2002-05-15 Fernando Perez <fperez@colorado.edu>
3866
3881
3867 * IPython/Magic.py (Magic.magic_psource): made the object
3882 * IPython/Magic.py (Magic.magic_psource): made the object
3868 introspection names be more standard: pdoc, pdef, pfile and
3883 introspection names be more standard: pdoc, pdef, pfile and
3869 psource. They all print/page their output, and it makes
3884 psource. They all print/page their output, and it makes
3870 remembering them easier. Kept old names for compatibility as
3885 remembering them easier. Kept old names for compatibility as
3871 aliases.
3886 aliases.
3872
3887
3873 2002-05-14 Fernando Perez <fperez@colorado.edu>
3888 2002-05-14 Fernando Perez <fperez@colorado.edu>
3874
3889
3875 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3890 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3876 what the mouse problem was. The trick is to use gnuplot with temp
3891 what the mouse problem was. The trick is to use gnuplot with temp
3877 files and NOT with pipes (for data communication), because having
3892 files and NOT with pipes (for data communication), because having
3878 both pipes and the mouse on is bad news.
3893 both pipes and the mouse on is bad news.
3879
3894
3880 2002-05-13 Fernando Perez <fperez@colorado.edu>
3895 2002-05-13 Fernando Perez <fperez@colorado.edu>
3881
3896
3882 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3897 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3883 bug. Information would be reported about builtins even when
3898 bug. Information would be reported about builtins even when
3884 user-defined functions overrode them.
3899 user-defined functions overrode them.
3885
3900
3886 2002-05-11 Fernando Perez <fperez@colorado.edu>
3901 2002-05-11 Fernando Perez <fperez@colorado.edu>
3887
3902
3888 * IPython/__init__.py (__all__): removed FlexCompleter from
3903 * IPython/__init__.py (__all__): removed FlexCompleter from
3889 __all__ so that things don't fail in platforms without readline.
3904 __all__ so that things don't fail in platforms without readline.
3890
3905
3891 2002-05-10 Fernando Perez <fperez@colorado.edu>
3906 2002-05-10 Fernando Perez <fperez@colorado.edu>
3892
3907
3893 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3908 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3894 it requires Numeric, effectively making Numeric a dependency for
3909 it requires Numeric, effectively making Numeric a dependency for
3895 IPython.
3910 IPython.
3896
3911
3897 * Released 0.2.13
3912 * Released 0.2.13
3898
3913
3899 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3914 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3900 profiler interface. Now all the major options from the profiler
3915 profiler interface. Now all the major options from the profiler
3901 module are directly supported in IPython, both for single
3916 module are directly supported in IPython, both for single
3902 expressions (@prun) and for full programs (@run -p).
3917 expressions (@prun) and for full programs (@run -p).
3903
3918
3904 2002-05-09 Fernando Perez <fperez@colorado.edu>
3919 2002-05-09 Fernando Perez <fperez@colorado.edu>
3905
3920
3906 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3921 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3907 magic properly formatted for screen.
3922 magic properly formatted for screen.
3908
3923
3909 * setup.py (make_shortcut): Changed things to put pdf version in
3924 * setup.py (make_shortcut): Changed things to put pdf version in
3910 doc/ instead of doc/manual (had to change lyxport a bit).
3925 doc/ instead of doc/manual (had to change lyxport a bit).
3911
3926
3912 * IPython/Magic.py (Profile.string_stats): made profile runs go
3927 * IPython/Magic.py (Profile.string_stats): made profile runs go
3913 through pager (they are long and a pager allows searching, saving,
3928 through pager (they are long and a pager allows searching, saving,
3914 etc.)
3929 etc.)
3915
3930
3916 2002-05-08 Fernando Perez <fperez@colorado.edu>
3931 2002-05-08 Fernando Perez <fperez@colorado.edu>
3917
3932
3918 * Released 0.2.12
3933 * Released 0.2.12
3919
3934
3920 2002-05-06 Fernando Perez <fperez@colorado.edu>
3935 2002-05-06 Fernando Perez <fperez@colorado.edu>
3921
3936
3922 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3937 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3923 introduced); 'hist n1 n2' was broken.
3938 introduced); 'hist n1 n2' was broken.
3924 (Magic.magic_pdb): added optional on/off arguments to @pdb
3939 (Magic.magic_pdb): added optional on/off arguments to @pdb
3925 (Magic.magic_run): added option -i to @run, which executes code in
3940 (Magic.magic_run): added option -i to @run, which executes code in
3926 the IPython namespace instead of a clean one. Also added @irun as
3941 the IPython namespace instead of a clean one. Also added @irun as
3927 an alias to @run -i.
3942 an alias to @run -i.
3928
3943
3929 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3944 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3930 fixed (it didn't really do anything, the namespaces were wrong).
3945 fixed (it didn't really do anything, the namespaces were wrong).
3931
3946
3932 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3947 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3933
3948
3934 * IPython/__init__.py (__all__): Fixed package namespace, now
3949 * IPython/__init__.py (__all__): Fixed package namespace, now
3935 'import IPython' does give access to IPython.<all> as
3950 'import IPython' does give access to IPython.<all> as
3936 expected. Also renamed __release__ to Release.
3951 expected. Also renamed __release__ to Release.
3937
3952
3938 * IPython/Debugger.py (__license__): created new Pdb class which
3953 * IPython/Debugger.py (__license__): created new Pdb class which
3939 functions like a drop-in for the normal pdb.Pdb but does NOT
3954 functions like a drop-in for the normal pdb.Pdb but does NOT
3940 import readline by default. This way it doesn't muck up IPython's
3955 import readline by default. This way it doesn't muck up IPython's
3941 readline handling, and now tab-completion finally works in the
3956 readline handling, and now tab-completion finally works in the
3942 debugger -- sort of. It completes things globally visible, but the
3957 debugger -- sort of. It completes things globally visible, but the
3943 completer doesn't track the stack as pdb walks it. That's a bit
3958 completer doesn't track the stack as pdb walks it. That's a bit
3944 tricky, and I'll have to implement it later.
3959 tricky, and I'll have to implement it later.
3945
3960
3946 2002-05-05 Fernando Perez <fperez@colorado.edu>
3961 2002-05-05 Fernando Perez <fperez@colorado.edu>
3947
3962
3948 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3963 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3949 magic docstrings when printed via ? (explicit \'s were being
3964 magic docstrings when printed via ? (explicit \'s were being
3950 printed).
3965 printed).
3951
3966
3952 * IPython/ipmaker.py (make_IPython): fixed namespace
3967 * IPython/ipmaker.py (make_IPython): fixed namespace
3953 identification bug. Now variables loaded via logs or command-line
3968 identification bug. Now variables loaded via logs or command-line
3954 files are recognized in the interactive namespace by @who.
3969 files are recognized in the interactive namespace by @who.
3955
3970
3956 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3971 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3957 log replay system stemming from the string form of Structs.
3972 log replay system stemming from the string form of Structs.
3958
3973
3959 * IPython/Magic.py (Macro.__init__): improved macros to properly
3974 * IPython/Magic.py (Macro.__init__): improved macros to properly
3960 handle magic commands in them.
3975 handle magic commands in them.
3961 (Magic.magic_logstart): usernames are now expanded so 'logstart
3976 (Magic.magic_logstart): usernames are now expanded so 'logstart
3962 ~/mylog' now works.
3977 ~/mylog' now works.
3963
3978
3964 * IPython/iplib.py (complete): fixed bug where paths starting with
3979 * IPython/iplib.py (complete): fixed bug where paths starting with
3965 '/' would be completed as magic names.
3980 '/' would be completed as magic names.
3966
3981
3967 2002-05-04 Fernando Perez <fperez@colorado.edu>
3982 2002-05-04 Fernando Perez <fperez@colorado.edu>
3968
3983
3969 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3984 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3970 allow running full programs under the profiler's control.
3985 allow running full programs under the profiler's control.
3971
3986
3972 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3987 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3973 mode to report exceptions verbosely but without formatting
3988 mode to report exceptions verbosely but without formatting
3974 variables. This addresses the issue of ipython 'freezing' (it's
3989 variables. This addresses the issue of ipython 'freezing' (it's
3975 not frozen, but caught in an expensive formatting loop) when huge
3990 not frozen, but caught in an expensive formatting loop) when huge
3976 variables are in the context of an exception.
3991 variables are in the context of an exception.
3977 (VerboseTB.text): Added '--->' markers at line where exception was
3992 (VerboseTB.text): Added '--->' markers at line where exception was
3978 triggered. Much clearer to read, especially in NoColor modes.
3993 triggered. Much clearer to read, especially in NoColor modes.
3979
3994
3980 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3995 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3981 implemented in reverse when changing to the new parse_options().
3996 implemented in reverse when changing to the new parse_options().
3982
3997
3983 2002-05-03 Fernando Perez <fperez@colorado.edu>
3998 2002-05-03 Fernando Perez <fperez@colorado.edu>
3984
3999
3985 * IPython/Magic.py (Magic.parse_options): new function so that
4000 * IPython/Magic.py (Magic.parse_options): new function so that
3986 magics can parse options easier.
4001 magics can parse options easier.
3987 (Magic.magic_prun): new function similar to profile.run(),
4002 (Magic.magic_prun): new function similar to profile.run(),
3988 suggested by Chris Hart.
4003 suggested by Chris Hart.
3989 (Magic.magic_cd): fixed behavior so that it only changes if
4004 (Magic.magic_cd): fixed behavior so that it only changes if
3990 directory actually is in history.
4005 directory actually is in history.
3991
4006
3992 * IPython/usage.py (__doc__): added information about potential
4007 * IPython/usage.py (__doc__): added information about potential
3993 slowness of Verbose exception mode when there are huge data
4008 slowness of Verbose exception mode when there are huge data
3994 structures to be formatted (thanks to Archie Paulson).
4009 structures to be formatted (thanks to Archie Paulson).
3995
4010
3996 * IPython/ipmaker.py (make_IPython): Changed default logging
4011 * IPython/ipmaker.py (make_IPython): Changed default logging
3997 (when simply called with -log) to use curr_dir/ipython.log in
4012 (when simply called with -log) to use curr_dir/ipython.log in
3998 rotate mode. Fixed crash which was occuring with -log before
4013 rotate mode. Fixed crash which was occuring with -log before
3999 (thanks to Jim Boyle).
4014 (thanks to Jim Boyle).
4000
4015
4001 2002-05-01 Fernando Perez <fperez@colorado.edu>
4016 2002-05-01 Fernando Perez <fperez@colorado.edu>
4002
4017
4003 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4018 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4004 was nasty -- though somewhat of a corner case).
4019 was nasty -- though somewhat of a corner case).
4005
4020
4006 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4021 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4007 text (was a bug).
4022 text (was a bug).
4008
4023
4009 2002-04-30 Fernando Perez <fperez@colorado.edu>
4024 2002-04-30 Fernando Perez <fperez@colorado.edu>
4010
4025
4011 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4026 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4012 a print after ^D or ^C from the user so that the In[] prompt
4027 a print after ^D or ^C from the user so that the In[] prompt
4013 doesn't over-run the gnuplot one.
4028 doesn't over-run the gnuplot one.
4014
4029
4015 2002-04-29 Fernando Perez <fperez@colorado.edu>
4030 2002-04-29 Fernando Perez <fperez@colorado.edu>
4016
4031
4017 * Released 0.2.10
4032 * Released 0.2.10
4018
4033
4019 * IPython/__release__.py (version): get date dynamically.
4034 * IPython/__release__.py (version): get date dynamically.
4020
4035
4021 * Misc. documentation updates thanks to Arnd's comments. Also ran
4036 * Misc. documentation updates thanks to Arnd's comments. Also ran
4022 a full spellcheck on the manual (hadn't been done in a while).
4037 a full spellcheck on the manual (hadn't been done in a while).
4023
4038
4024 2002-04-27 Fernando Perez <fperez@colorado.edu>
4039 2002-04-27 Fernando Perez <fperez@colorado.edu>
4025
4040
4026 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4041 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4027 starting a log in mid-session would reset the input history list.
4042 starting a log in mid-session would reset the input history list.
4028
4043
4029 2002-04-26 Fernando Perez <fperez@colorado.edu>
4044 2002-04-26 Fernando Perez <fperez@colorado.edu>
4030
4045
4031 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4046 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4032 all files were being included in an update. Now anything in
4047 all files were being included in an update. Now anything in
4033 UserConfig that matches [A-Za-z]*.py will go (this excludes
4048 UserConfig that matches [A-Za-z]*.py will go (this excludes
4034 __init__.py)
4049 __init__.py)
4035
4050
4036 2002-04-25 Fernando Perez <fperez@colorado.edu>
4051 2002-04-25 Fernando Perez <fperez@colorado.edu>
4037
4052
4038 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4053 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4039 to __builtins__ so that any form of embedded or imported code can
4054 to __builtins__ so that any form of embedded or imported code can
4040 test for being inside IPython.
4055 test for being inside IPython.
4041
4056
4042 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4057 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4043 changed to GnuplotMagic because it's now an importable module,
4058 changed to GnuplotMagic because it's now an importable module,
4044 this makes the name follow that of the standard Gnuplot module.
4059 this makes the name follow that of the standard Gnuplot module.
4045 GnuplotMagic can now be loaded at any time in mid-session.
4060 GnuplotMagic can now be loaded at any time in mid-session.
4046
4061
4047 2002-04-24 Fernando Perez <fperez@colorado.edu>
4062 2002-04-24 Fernando Perez <fperez@colorado.edu>
4048
4063
4049 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4064 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4050 the globals (IPython has its own namespace) and the
4065 the globals (IPython has its own namespace) and the
4051 PhysicalQuantity stuff is much better anyway.
4066 PhysicalQuantity stuff is much better anyway.
4052
4067
4053 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4068 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4054 embedding example to standard user directory for
4069 embedding example to standard user directory for
4055 distribution. Also put it in the manual.
4070 distribution. Also put it in the manual.
4056
4071
4057 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4072 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4058 instance as first argument (so it doesn't rely on some obscure
4073 instance as first argument (so it doesn't rely on some obscure
4059 hidden global).
4074 hidden global).
4060
4075
4061 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4076 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4062 delimiters. While it prevents ().TAB from working, it allows
4077 delimiters. While it prevents ().TAB from working, it allows
4063 completions in open (... expressions. This is by far a more common
4078 completions in open (... expressions. This is by far a more common
4064 case.
4079 case.
4065
4080
4066 2002-04-23 Fernando Perez <fperez@colorado.edu>
4081 2002-04-23 Fernando Perez <fperez@colorado.edu>
4067
4082
4068 * IPython/Extensions/InterpreterPasteInput.py: new
4083 * IPython/Extensions/InterpreterPasteInput.py: new
4069 syntax-processing module for pasting lines with >>> or ... at the
4084 syntax-processing module for pasting lines with >>> or ... at the
4070 start.
4085 start.
4071
4086
4072 * IPython/Extensions/PhysicalQ_Interactive.py
4087 * IPython/Extensions/PhysicalQ_Interactive.py
4073 (PhysicalQuantityInteractive.__int__): fixed to work with either
4088 (PhysicalQuantityInteractive.__int__): fixed to work with either
4074 Numeric or math.
4089 Numeric or math.
4075
4090
4076 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4091 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4077 provided profiles. Now we have:
4092 provided profiles. Now we have:
4078 -math -> math module as * and cmath with its own namespace.
4093 -math -> math module as * and cmath with its own namespace.
4079 -numeric -> Numeric as *, plus gnuplot & grace
4094 -numeric -> Numeric as *, plus gnuplot & grace
4080 -physics -> same as before
4095 -physics -> same as before
4081
4096
4082 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4097 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4083 user-defined magics wouldn't be found by @magic if they were
4098 user-defined magics wouldn't be found by @magic if they were
4084 defined as class methods. Also cleaned up the namespace search
4099 defined as class methods. Also cleaned up the namespace search
4085 logic and the string building (to use %s instead of many repeated
4100 logic and the string building (to use %s instead of many repeated
4086 string adds).
4101 string adds).
4087
4102
4088 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4103 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4089 of user-defined magics to operate with class methods (cleaner, in
4104 of user-defined magics to operate with class methods (cleaner, in
4090 line with the gnuplot code).
4105 line with the gnuplot code).
4091
4106
4092 2002-04-22 Fernando Perez <fperez@colorado.edu>
4107 2002-04-22 Fernando Perez <fperez@colorado.edu>
4093
4108
4094 * setup.py: updated dependency list so that manual is updated when
4109 * setup.py: updated dependency list so that manual is updated when
4095 all included files change.
4110 all included files change.
4096
4111
4097 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4112 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4098 the delimiter removal option (the fix is ugly right now).
4113 the delimiter removal option (the fix is ugly right now).
4099
4114
4100 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4115 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4101 all of the math profile (quicker loading, no conflict between
4116 all of the math profile (quicker loading, no conflict between
4102 g-9.8 and g-gnuplot).
4117 g-9.8 and g-gnuplot).
4103
4118
4104 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4119 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4105 name of post-mortem files to IPython_crash_report.txt.
4120 name of post-mortem files to IPython_crash_report.txt.
4106
4121
4107 * Cleanup/update of the docs. Added all the new readline info and
4122 * Cleanup/update of the docs. Added all the new readline info and
4108 formatted all lists as 'real lists'.
4123 formatted all lists as 'real lists'.
4109
4124
4110 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4125 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4111 tab-completion options, since the full readline parse_and_bind is
4126 tab-completion options, since the full readline parse_and_bind is
4112 now accessible.
4127 now accessible.
4113
4128
4114 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4129 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4115 handling of readline options. Now users can specify any string to
4130 handling of readline options. Now users can specify any string to
4116 be passed to parse_and_bind(), as well as the delimiters to be
4131 be passed to parse_and_bind(), as well as the delimiters to be
4117 removed.
4132 removed.
4118 (InteractiveShell.__init__): Added __name__ to the global
4133 (InteractiveShell.__init__): Added __name__ to the global
4119 namespace so that things like Itpl which rely on its existence
4134 namespace so that things like Itpl which rely on its existence
4120 don't crash.
4135 don't crash.
4121 (InteractiveShell._prefilter): Defined the default with a _ so
4136 (InteractiveShell._prefilter): Defined the default with a _ so
4122 that prefilter() is easier to override, while the default one
4137 that prefilter() is easier to override, while the default one
4123 remains available.
4138 remains available.
4124
4139
4125 2002-04-18 Fernando Perez <fperez@colorado.edu>
4140 2002-04-18 Fernando Perez <fperez@colorado.edu>
4126
4141
4127 * Added information about pdb in the docs.
4142 * Added information about pdb in the docs.
4128
4143
4129 2002-04-17 Fernando Perez <fperez@colorado.edu>
4144 2002-04-17 Fernando Perez <fperez@colorado.edu>
4130
4145
4131 * IPython/ipmaker.py (make_IPython): added rc_override option to
4146 * IPython/ipmaker.py (make_IPython): added rc_override option to
4132 allow passing config options at creation time which may override
4147 allow passing config options at creation time which may override
4133 anything set in the config files or command line. This is
4148 anything set in the config files or command line. This is
4134 particularly useful for configuring embedded instances.
4149 particularly useful for configuring embedded instances.
4135
4150
4136 2002-04-15 Fernando Perez <fperez@colorado.edu>
4151 2002-04-15 Fernando Perez <fperez@colorado.edu>
4137
4152
4138 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4153 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4139 crash embedded instances because of the input cache falling out of
4154 crash embedded instances because of the input cache falling out of
4140 sync with the output counter.
4155 sync with the output counter.
4141
4156
4142 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4157 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4143 mode which calls pdb after an uncaught exception in IPython itself.
4158 mode which calls pdb after an uncaught exception in IPython itself.
4144
4159
4145 2002-04-14 Fernando Perez <fperez@colorado.edu>
4160 2002-04-14 Fernando Perez <fperez@colorado.edu>
4146
4161
4147 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4162 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4148 readline, fix it back after each call.
4163 readline, fix it back after each call.
4149
4164
4150 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4165 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4151 method to force all access via __call__(), which guarantees that
4166 method to force all access via __call__(), which guarantees that
4152 traceback references are properly deleted.
4167 traceback references are properly deleted.
4153
4168
4154 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4169 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4155 improve printing when pprint is in use.
4170 improve printing when pprint is in use.
4156
4171
4157 2002-04-13 Fernando Perez <fperez@colorado.edu>
4172 2002-04-13 Fernando Perez <fperez@colorado.edu>
4158
4173
4159 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4174 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4160 exceptions aren't caught anymore. If the user triggers one, he
4175 exceptions aren't caught anymore. If the user triggers one, he
4161 should know why he's doing it and it should go all the way up,
4176 should know why he's doing it and it should go all the way up,
4162 just like any other exception. So now @abort will fully kill the
4177 just like any other exception. So now @abort will fully kill the
4163 embedded interpreter and the embedding code (unless that happens
4178 embedded interpreter and the embedding code (unless that happens
4164 to catch SystemExit).
4179 to catch SystemExit).
4165
4180
4166 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4181 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4167 and a debugger() method to invoke the interactive pdb debugger
4182 and a debugger() method to invoke the interactive pdb debugger
4168 after printing exception information. Also added the corresponding
4183 after printing exception information. Also added the corresponding
4169 -pdb option and @pdb magic to control this feature, and updated
4184 -pdb option and @pdb magic to control this feature, and updated
4170 the docs. After a suggestion from Christopher Hart
4185 the docs. After a suggestion from Christopher Hart
4171 (hart-AT-caltech.edu).
4186 (hart-AT-caltech.edu).
4172
4187
4173 2002-04-12 Fernando Perez <fperez@colorado.edu>
4188 2002-04-12 Fernando Perez <fperez@colorado.edu>
4174
4189
4175 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4190 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4176 the exception handlers defined by the user (not the CrashHandler)
4191 the exception handlers defined by the user (not the CrashHandler)
4177 so that user exceptions don't trigger an ipython bug report.
4192 so that user exceptions don't trigger an ipython bug report.
4178
4193
4179 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4194 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4180 configurable (it should have always been so).
4195 configurable (it should have always been so).
4181
4196
4182 2002-03-26 Fernando Perez <fperez@colorado.edu>
4197 2002-03-26 Fernando Perez <fperez@colorado.edu>
4183
4198
4184 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4199 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4185 and there to fix embedding namespace issues. This should all be
4200 and there to fix embedding namespace issues. This should all be
4186 done in a more elegant way.
4201 done in a more elegant way.
4187
4202
4188 2002-03-25 Fernando Perez <fperez@colorado.edu>
4203 2002-03-25 Fernando Perez <fperez@colorado.edu>
4189
4204
4190 * IPython/genutils.py (get_home_dir): Try to make it work under
4205 * IPython/genutils.py (get_home_dir): Try to make it work under
4191 win9x also.
4206 win9x also.
4192
4207
4193 2002-03-20 Fernando Perez <fperez@colorado.edu>
4208 2002-03-20 Fernando Perez <fperez@colorado.edu>
4194
4209
4195 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4210 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4196 sys.displayhook untouched upon __init__.
4211 sys.displayhook untouched upon __init__.
4197
4212
4198 2002-03-19 Fernando Perez <fperez@colorado.edu>
4213 2002-03-19 Fernando Perez <fperez@colorado.edu>
4199
4214
4200 * Released 0.2.9 (for embedding bug, basically).
4215 * Released 0.2.9 (for embedding bug, basically).
4201
4216
4202 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4217 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4203 exceptions so that enclosing shell's state can be restored.
4218 exceptions so that enclosing shell's state can be restored.
4204
4219
4205 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4220 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4206 naming conventions in the .ipython/ dir.
4221 naming conventions in the .ipython/ dir.
4207
4222
4208 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4223 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4209 from delimiters list so filenames with - in them get expanded.
4224 from delimiters list so filenames with - in them get expanded.
4210
4225
4211 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4226 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4212 sys.displayhook not being properly restored after an embedded call.
4227 sys.displayhook not being properly restored after an embedded call.
4213
4228
4214 2002-03-18 Fernando Perez <fperez@colorado.edu>
4229 2002-03-18 Fernando Perez <fperez@colorado.edu>
4215
4230
4216 * Released 0.2.8
4231 * Released 0.2.8
4217
4232
4218 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4233 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4219 some files weren't being included in a -upgrade.
4234 some files weren't being included in a -upgrade.
4220 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4235 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4221 on' so that the first tab completes.
4236 on' so that the first tab completes.
4222 (InteractiveShell.handle_magic): fixed bug with spaces around
4237 (InteractiveShell.handle_magic): fixed bug with spaces around
4223 quotes breaking many magic commands.
4238 quotes breaking many magic commands.
4224
4239
4225 * setup.py: added note about ignoring the syntax error messages at
4240 * setup.py: added note about ignoring the syntax error messages at
4226 installation.
4241 installation.
4227
4242
4228 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4243 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4229 streamlining the gnuplot interface, now there's only one magic @gp.
4244 streamlining the gnuplot interface, now there's only one magic @gp.
4230
4245
4231 2002-03-17 Fernando Perez <fperez@colorado.edu>
4246 2002-03-17 Fernando Perez <fperez@colorado.edu>
4232
4247
4233 * IPython/UserConfig/magic_gnuplot.py: new name for the
4248 * IPython/UserConfig/magic_gnuplot.py: new name for the
4234 example-magic_pm.py file. Much enhanced system, now with a shell
4249 example-magic_pm.py file. Much enhanced system, now with a shell
4235 for communicating directly with gnuplot, one command at a time.
4250 for communicating directly with gnuplot, one command at a time.
4236
4251
4237 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4252 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4238 setting __name__=='__main__'.
4253 setting __name__=='__main__'.
4239
4254
4240 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4255 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4241 mini-shell for accessing gnuplot from inside ipython. Should
4256 mini-shell for accessing gnuplot from inside ipython. Should
4242 extend it later for grace access too. Inspired by Arnd's
4257 extend it later for grace access too. Inspired by Arnd's
4243 suggestion.
4258 suggestion.
4244
4259
4245 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4260 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4246 calling magic functions with () in their arguments. Thanks to Arnd
4261 calling magic functions with () in their arguments. Thanks to Arnd
4247 Baecker for pointing this to me.
4262 Baecker for pointing this to me.
4248
4263
4249 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4264 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4250 infinitely for integer or complex arrays (only worked with floats).
4265 infinitely for integer or complex arrays (only worked with floats).
4251
4266
4252 2002-03-16 Fernando Perez <fperez@colorado.edu>
4267 2002-03-16 Fernando Perez <fperez@colorado.edu>
4253
4268
4254 * setup.py: Merged setup and setup_windows into a single script
4269 * setup.py: Merged setup and setup_windows into a single script
4255 which properly handles things for windows users.
4270 which properly handles things for windows users.
4256
4271
4257 2002-03-15 Fernando Perez <fperez@colorado.edu>
4272 2002-03-15 Fernando Perez <fperez@colorado.edu>
4258
4273
4259 * Big change to the manual: now the magics are all automatically
4274 * Big change to the manual: now the magics are all automatically
4260 documented. This information is generated from their docstrings
4275 documented. This information is generated from their docstrings
4261 and put in a latex file included by the manual lyx file. This way
4276 and put in a latex file included by the manual lyx file. This way
4262 we get always up to date information for the magics. The manual
4277 we get always up to date information for the magics. The manual
4263 now also has proper version information, also auto-synced.
4278 now also has proper version information, also auto-synced.
4264
4279
4265 For this to work, an undocumented --magic_docstrings option was added.
4280 For this to work, an undocumented --magic_docstrings option was added.
4266
4281
4267 2002-03-13 Fernando Perez <fperez@colorado.edu>
4282 2002-03-13 Fernando Perez <fperez@colorado.edu>
4268
4283
4269 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4284 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4270 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4285 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4271
4286
4272 2002-03-12 Fernando Perez <fperez@colorado.edu>
4287 2002-03-12 Fernando Perez <fperez@colorado.edu>
4273
4288
4274 * IPython/ultraTB.py (TermColors): changed color escapes again to
4289 * IPython/ultraTB.py (TermColors): changed color escapes again to
4275 fix the (old, reintroduced) line-wrapping bug. Basically, if
4290 fix the (old, reintroduced) line-wrapping bug. Basically, if
4276 \001..\002 aren't given in the color escapes, lines get wrapped
4291 \001..\002 aren't given in the color escapes, lines get wrapped
4277 weirdly. But giving those screws up old xterms and emacs terms. So
4292 weirdly. But giving those screws up old xterms and emacs terms. So
4278 I added some logic for emacs terms to be ok, but I can't identify old
4293 I added some logic for emacs terms to be ok, but I can't identify old
4279 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4294 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4280
4295
4281 2002-03-10 Fernando Perez <fperez@colorado.edu>
4296 2002-03-10 Fernando Perez <fperez@colorado.edu>
4282
4297
4283 * IPython/usage.py (__doc__): Various documentation cleanups and
4298 * IPython/usage.py (__doc__): Various documentation cleanups and
4284 updates, both in usage docstrings and in the manual.
4299 updates, both in usage docstrings and in the manual.
4285
4300
4286 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4301 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4287 handling of caching. Set minimum acceptabe value for having a
4302 handling of caching. Set minimum acceptabe value for having a
4288 cache at 20 values.
4303 cache at 20 values.
4289
4304
4290 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4305 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4291 install_first_time function to a method, renamed it and added an
4306 install_first_time function to a method, renamed it and added an
4292 'upgrade' mode. Now people can update their config directory with
4307 'upgrade' mode. Now people can update their config directory with
4293 a simple command line switch (-upgrade, also new).
4308 a simple command line switch (-upgrade, also new).
4294
4309
4295 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4310 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4296 @file (convenient for automagic users under Python >= 2.2).
4311 @file (convenient for automagic users under Python >= 2.2).
4297 Removed @files (it seemed more like a plural than an abbrev. of
4312 Removed @files (it seemed more like a plural than an abbrev. of
4298 'file show').
4313 'file show').
4299
4314
4300 * IPython/iplib.py (install_first_time): Fixed crash if there were
4315 * IPython/iplib.py (install_first_time): Fixed crash if there were
4301 backup files ('~') in .ipython/ install directory.
4316 backup files ('~') in .ipython/ install directory.
4302
4317
4303 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4318 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4304 system. Things look fine, but these changes are fairly
4319 system. Things look fine, but these changes are fairly
4305 intrusive. Test them for a few days.
4320 intrusive. Test them for a few days.
4306
4321
4307 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4322 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4308 the prompts system. Now all in/out prompt strings are user
4323 the prompts system. Now all in/out prompt strings are user
4309 controllable. This is particularly useful for embedding, as one
4324 controllable. This is particularly useful for embedding, as one
4310 can tag embedded instances with particular prompts.
4325 can tag embedded instances with particular prompts.
4311
4326
4312 Also removed global use of sys.ps1/2, which now allows nested
4327 Also removed global use of sys.ps1/2, which now allows nested
4313 embeddings without any problems. Added command-line options for
4328 embeddings without any problems. Added command-line options for
4314 the prompt strings.
4329 the prompt strings.
4315
4330
4316 2002-03-08 Fernando Perez <fperez@colorado.edu>
4331 2002-03-08 Fernando Perez <fperez@colorado.edu>
4317
4332
4318 * IPython/UserConfig/example-embed-short.py (ipshell): added
4333 * IPython/UserConfig/example-embed-short.py (ipshell): added
4319 example file with the bare minimum code for embedding.
4334 example file with the bare minimum code for embedding.
4320
4335
4321 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4336 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4322 functionality for the embeddable shell to be activated/deactivated
4337 functionality for the embeddable shell to be activated/deactivated
4323 either globally or at each call.
4338 either globally or at each call.
4324
4339
4325 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4340 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4326 rewriting the prompt with '--->' for auto-inputs with proper
4341 rewriting the prompt with '--->' for auto-inputs with proper
4327 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4342 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4328 this is handled by the prompts class itself, as it should.
4343 this is handled by the prompts class itself, as it should.
4329
4344
4330 2002-03-05 Fernando Perez <fperez@colorado.edu>
4345 2002-03-05 Fernando Perez <fperez@colorado.edu>
4331
4346
4332 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4347 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4333 @logstart to avoid name clashes with the math log function.
4348 @logstart to avoid name clashes with the math log function.
4334
4349
4335 * Big updates to X/Emacs section of the manual.
4350 * Big updates to X/Emacs section of the manual.
4336
4351
4337 * Removed ipython_emacs. Milan explained to me how to pass
4352 * Removed ipython_emacs. Milan explained to me how to pass
4338 arguments to ipython through Emacs. Some day I'm going to end up
4353 arguments to ipython through Emacs. Some day I'm going to end up
4339 learning some lisp...
4354 learning some lisp...
4340
4355
4341 2002-03-04 Fernando Perez <fperez@colorado.edu>
4356 2002-03-04 Fernando Perez <fperez@colorado.edu>
4342
4357
4343 * IPython/ipython_emacs: Created script to be used as the
4358 * IPython/ipython_emacs: Created script to be used as the
4344 py-python-command Emacs variable so we can pass IPython
4359 py-python-command Emacs variable so we can pass IPython
4345 parameters. I can't figure out how to tell Emacs directly to pass
4360 parameters. I can't figure out how to tell Emacs directly to pass
4346 parameters to IPython, so a dummy shell script will do it.
4361 parameters to IPython, so a dummy shell script will do it.
4347
4362
4348 Other enhancements made for things to work better under Emacs'
4363 Other enhancements made for things to work better under Emacs'
4349 various types of terminals. Many thanks to Milan Zamazal
4364 various types of terminals. Many thanks to Milan Zamazal
4350 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4365 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4351
4366
4352 2002-03-01 Fernando Perez <fperez@colorado.edu>
4367 2002-03-01 Fernando Perez <fperez@colorado.edu>
4353
4368
4354 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4369 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4355 that loading of readline is now optional. This gives better
4370 that loading of readline is now optional. This gives better
4356 control to emacs users.
4371 control to emacs users.
4357
4372
4358 * IPython/ultraTB.py (__date__): Modified color escape sequences
4373 * IPython/ultraTB.py (__date__): Modified color escape sequences
4359 and now things work fine under xterm and in Emacs' term buffers
4374 and now things work fine under xterm and in Emacs' term buffers
4360 (though not shell ones). Well, in emacs you get colors, but all
4375 (though not shell ones). Well, in emacs you get colors, but all
4361 seem to be 'light' colors (no difference between dark and light
4376 seem to be 'light' colors (no difference between dark and light
4362 ones). But the garbage chars are gone, and also in xterms. It
4377 ones). But the garbage chars are gone, and also in xterms. It
4363 seems that now I'm using 'cleaner' ansi sequences.
4378 seems that now I'm using 'cleaner' ansi sequences.
4364
4379
4365 2002-02-21 Fernando Perez <fperez@colorado.edu>
4380 2002-02-21 Fernando Perez <fperez@colorado.edu>
4366
4381
4367 * Released 0.2.7 (mainly to publish the scoping fix).
4382 * Released 0.2.7 (mainly to publish the scoping fix).
4368
4383
4369 * IPython/Logger.py (Logger.logstate): added. A corresponding
4384 * IPython/Logger.py (Logger.logstate): added. A corresponding
4370 @logstate magic was created.
4385 @logstate magic was created.
4371
4386
4372 * IPython/Magic.py: fixed nested scoping problem under Python
4387 * IPython/Magic.py: fixed nested scoping problem under Python
4373 2.1.x (automagic wasn't working).
4388 2.1.x (automagic wasn't working).
4374
4389
4375 2002-02-20 Fernando Perez <fperez@colorado.edu>
4390 2002-02-20 Fernando Perez <fperez@colorado.edu>
4376
4391
4377 * Released 0.2.6.
4392 * Released 0.2.6.
4378
4393
4379 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4394 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4380 option so that logs can come out without any headers at all.
4395 option so that logs can come out without any headers at all.
4381
4396
4382 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4397 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4383 SciPy.
4398 SciPy.
4384
4399
4385 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4400 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4386 that embedded IPython calls don't require vars() to be explicitly
4401 that embedded IPython calls don't require vars() to be explicitly
4387 passed. Now they are extracted from the caller's frame (code
4402 passed. Now they are extracted from the caller's frame (code
4388 snatched from Eric Jones' weave). Added better documentation to
4403 snatched from Eric Jones' weave). Added better documentation to
4389 the section on embedding and the example file.
4404 the section on embedding and the example file.
4390
4405
4391 * IPython/genutils.py (page): Changed so that under emacs, it just
4406 * IPython/genutils.py (page): Changed so that under emacs, it just
4392 prints the string. You can then page up and down in the emacs
4407 prints the string. You can then page up and down in the emacs
4393 buffer itself. This is how the builtin help() works.
4408 buffer itself. This is how the builtin help() works.
4394
4409
4395 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4410 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4396 macro scoping: macros need to be executed in the user's namespace
4411 macro scoping: macros need to be executed in the user's namespace
4397 to work as if they had been typed by the user.
4412 to work as if they had been typed by the user.
4398
4413
4399 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4414 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4400 execute automatically (no need to type 'exec...'). They then
4415 execute automatically (no need to type 'exec...'). They then
4401 behave like 'true macros'. The printing system was also modified
4416 behave like 'true macros'. The printing system was also modified
4402 for this to work.
4417 for this to work.
4403
4418
4404 2002-02-19 Fernando Perez <fperez@colorado.edu>
4419 2002-02-19 Fernando Perez <fperez@colorado.edu>
4405
4420
4406 * IPython/genutils.py (page_file): new function for paging files
4421 * IPython/genutils.py (page_file): new function for paging files
4407 in an OS-independent way. Also necessary for file viewing to work
4422 in an OS-independent way. Also necessary for file viewing to work
4408 well inside Emacs buffers.
4423 well inside Emacs buffers.
4409 (page): Added checks for being in an emacs buffer.
4424 (page): Added checks for being in an emacs buffer.
4410 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4425 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4411 same bug in iplib.
4426 same bug in iplib.
4412
4427
4413 2002-02-18 Fernando Perez <fperez@colorado.edu>
4428 2002-02-18 Fernando Perez <fperez@colorado.edu>
4414
4429
4415 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4430 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4416 of readline so that IPython can work inside an Emacs buffer.
4431 of readline so that IPython can work inside an Emacs buffer.
4417
4432
4418 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4433 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4419 method signatures (they weren't really bugs, but it looks cleaner
4434 method signatures (they weren't really bugs, but it looks cleaner
4420 and keeps PyChecker happy).
4435 and keeps PyChecker happy).
4421
4436
4422 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4437 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4423 for implementing various user-defined hooks. Currently only
4438 for implementing various user-defined hooks. Currently only
4424 display is done.
4439 display is done.
4425
4440
4426 * IPython/Prompts.py (CachedOutput._display): changed display
4441 * IPython/Prompts.py (CachedOutput._display): changed display
4427 functions so that they can be dynamically changed by users easily.
4442 functions so that they can be dynamically changed by users easily.
4428
4443
4429 * IPython/Extensions/numeric_formats.py (num_display): added an
4444 * IPython/Extensions/numeric_formats.py (num_display): added an
4430 extension for printing NumPy arrays in flexible manners. It
4445 extension for printing NumPy arrays in flexible manners. It
4431 doesn't do anything yet, but all the structure is in
4446 doesn't do anything yet, but all the structure is in
4432 place. Ultimately the plan is to implement output format control
4447 place. Ultimately the plan is to implement output format control
4433 like in Octave.
4448 like in Octave.
4434
4449
4435 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4450 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4436 methods are found at run-time by all the automatic machinery.
4451 methods are found at run-time by all the automatic machinery.
4437
4452
4438 2002-02-17 Fernando Perez <fperez@colorado.edu>
4453 2002-02-17 Fernando Perez <fperez@colorado.edu>
4439
4454
4440 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4455 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4441 whole file a little.
4456 whole file a little.
4442
4457
4443 * ToDo: closed this document. Now there's a new_design.lyx
4458 * ToDo: closed this document. Now there's a new_design.lyx
4444 document for all new ideas. Added making a pdf of it for the
4459 document for all new ideas. Added making a pdf of it for the
4445 end-user distro.
4460 end-user distro.
4446
4461
4447 * IPython/Logger.py (Logger.switch_log): Created this to replace
4462 * IPython/Logger.py (Logger.switch_log): Created this to replace
4448 logon() and logoff(). It also fixes a nasty crash reported by
4463 logon() and logoff(). It also fixes a nasty crash reported by
4449 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4464 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4450
4465
4451 * IPython/iplib.py (complete): got auto-completion to work with
4466 * IPython/iplib.py (complete): got auto-completion to work with
4452 automagic (I had wanted this for a long time).
4467 automagic (I had wanted this for a long time).
4453
4468
4454 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4469 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4455 to @file, since file() is now a builtin and clashes with automagic
4470 to @file, since file() is now a builtin and clashes with automagic
4456 for @file.
4471 for @file.
4457
4472
4458 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4473 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4459 of this was previously in iplib, which had grown to more than 2000
4474 of this was previously in iplib, which had grown to more than 2000
4460 lines, way too long. No new functionality, but it makes managing
4475 lines, way too long. No new functionality, but it makes managing
4461 the code a bit easier.
4476 the code a bit easier.
4462
4477
4463 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4478 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4464 information to crash reports.
4479 information to crash reports.
4465
4480
4466 2002-02-12 Fernando Perez <fperez@colorado.edu>
4481 2002-02-12 Fernando Perez <fperez@colorado.edu>
4467
4482
4468 * Released 0.2.5.
4483 * Released 0.2.5.
4469
4484
4470 2002-02-11 Fernando Perez <fperez@colorado.edu>
4485 2002-02-11 Fernando Perez <fperez@colorado.edu>
4471
4486
4472 * Wrote a relatively complete Windows installer. It puts
4487 * Wrote a relatively complete Windows installer. It puts
4473 everything in place, creates Start Menu entries and fixes the
4488 everything in place, creates Start Menu entries and fixes the
4474 color issues. Nothing fancy, but it works.
4489 color issues. Nothing fancy, but it works.
4475
4490
4476 2002-02-10 Fernando Perez <fperez@colorado.edu>
4491 2002-02-10 Fernando Perez <fperez@colorado.edu>
4477
4492
4478 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4493 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4479 os.path.expanduser() call so that we can type @run ~/myfile.py and
4494 os.path.expanduser() call so that we can type @run ~/myfile.py and
4480 have thigs work as expected.
4495 have thigs work as expected.
4481
4496
4482 * IPython/genutils.py (page): fixed exception handling so things
4497 * IPython/genutils.py (page): fixed exception handling so things
4483 work both in Unix and Windows correctly. Quitting a pager triggers
4498 work both in Unix and Windows correctly. Quitting a pager triggers
4484 an IOError/broken pipe in Unix, and in windows not finding a pager
4499 an IOError/broken pipe in Unix, and in windows not finding a pager
4485 is also an IOError, so I had to actually look at the return value
4500 is also an IOError, so I had to actually look at the return value
4486 of the exception, not just the exception itself. Should be ok now.
4501 of the exception, not just the exception itself. Should be ok now.
4487
4502
4488 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4503 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4489 modified to allow case-insensitive color scheme changes.
4504 modified to allow case-insensitive color scheme changes.
4490
4505
4491 2002-02-09 Fernando Perez <fperez@colorado.edu>
4506 2002-02-09 Fernando Perez <fperez@colorado.edu>
4492
4507
4493 * IPython/genutils.py (native_line_ends): new function to leave
4508 * IPython/genutils.py (native_line_ends): new function to leave
4494 user config files with os-native line-endings.
4509 user config files with os-native line-endings.
4495
4510
4496 * README and manual updates.
4511 * README and manual updates.
4497
4512
4498 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4513 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4499 instead of StringType to catch Unicode strings.
4514 instead of StringType to catch Unicode strings.
4500
4515
4501 * IPython/genutils.py (filefind): fixed bug for paths with
4516 * IPython/genutils.py (filefind): fixed bug for paths with
4502 embedded spaces (very common in Windows).
4517 embedded spaces (very common in Windows).
4503
4518
4504 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4519 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4505 files under Windows, so that they get automatically associated
4520 files under Windows, so that they get automatically associated
4506 with a text editor. Windows makes it a pain to handle
4521 with a text editor. Windows makes it a pain to handle
4507 extension-less files.
4522 extension-less files.
4508
4523
4509 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4524 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4510 warning about readline only occur for Posix. In Windows there's no
4525 warning about readline only occur for Posix. In Windows there's no
4511 way to get readline, so why bother with the warning.
4526 way to get readline, so why bother with the warning.
4512
4527
4513 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4528 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4514 for __str__ instead of dir(self), since dir() changed in 2.2.
4529 for __str__ instead of dir(self), since dir() changed in 2.2.
4515
4530
4516 * Ported to Windows! Tested on XP, I suspect it should work fine
4531 * Ported to Windows! Tested on XP, I suspect it should work fine
4517 on NT/2000, but I don't think it will work on 98 et al. That
4532 on NT/2000, but I don't think it will work on 98 et al. That
4518 series of Windows is such a piece of junk anyway that I won't try
4533 series of Windows is such a piece of junk anyway that I won't try
4519 porting it there. The XP port was straightforward, showed a few
4534 porting it there. The XP port was straightforward, showed a few
4520 bugs here and there (fixed all), in particular some string
4535 bugs here and there (fixed all), in particular some string
4521 handling stuff which required considering Unicode strings (which
4536 handling stuff which required considering Unicode strings (which
4522 Windows uses). This is good, but hasn't been too tested :) No
4537 Windows uses). This is good, but hasn't been too tested :) No
4523 fancy installer yet, I'll put a note in the manual so people at
4538 fancy installer yet, I'll put a note in the manual so people at
4524 least make manually a shortcut.
4539 least make manually a shortcut.
4525
4540
4526 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4541 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4527 into a single one, "colors". This now controls both prompt and
4542 into a single one, "colors". This now controls both prompt and
4528 exception color schemes, and can be changed both at startup
4543 exception color schemes, and can be changed both at startup
4529 (either via command-line switches or via ipythonrc files) and at
4544 (either via command-line switches or via ipythonrc files) and at
4530 runtime, with @colors.
4545 runtime, with @colors.
4531 (Magic.magic_run): renamed @prun to @run and removed the old
4546 (Magic.magic_run): renamed @prun to @run and removed the old
4532 @run. The two were too similar to warrant keeping both.
4547 @run. The two were too similar to warrant keeping both.
4533
4548
4534 2002-02-03 Fernando Perez <fperez@colorado.edu>
4549 2002-02-03 Fernando Perez <fperez@colorado.edu>
4535
4550
4536 * IPython/iplib.py (install_first_time): Added comment on how to
4551 * IPython/iplib.py (install_first_time): Added comment on how to
4537 configure the color options for first-time users. Put a <return>
4552 configure the color options for first-time users. Put a <return>
4538 request at the end so that small-terminal users get a chance to
4553 request at the end so that small-terminal users get a chance to
4539 read the startup info.
4554 read the startup info.
4540
4555
4541 2002-01-23 Fernando Perez <fperez@colorado.edu>
4556 2002-01-23 Fernando Perez <fperez@colorado.edu>
4542
4557
4543 * IPython/iplib.py (CachedOutput.update): Changed output memory
4558 * IPython/iplib.py (CachedOutput.update): Changed output memory
4544 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4559 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4545 input history we still use _i. Did this b/c these variable are
4560 input history we still use _i. Did this b/c these variable are
4546 very commonly used in interactive work, so the less we need to
4561 very commonly used in interactive work, so the less we need to
4547 type the better off we are.
4562 type the better off we are.
4548 (Magic.magic_prun): updated @prun to better handle the namespaces
4563 (Magic.magic_prun): updated @prun to better handle the namespaces
4549 the file will run in, including a fix for __name__ not being set
4564 the file will run in, including a fix for __name__ not being set
4550 before.
4565 before.
4551
4566
4552 2002-01-20 Fernando Perez <fperez@colorado.edu>
4567 2002-01-20 Fernando Perez <fperez@colorado.edu>
4553
4568
4554 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4569 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4555 extra garbage for Python 2.2. Need to look more carefully into
4570 extra garbage for Python 2.2. Need to look more carefully into
4556 this later.
4571 this later.
4557
4572
4558 2002-01-19 Fernando Perez <fperez@colorado.edu>
4573 2002-01-19 Fernando Perez <fperez@colorado.edu>
4559
4574
4560 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4575 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4561 display SyntaxError exceptions properly formatted when they occur
4576 display SyntaxError exceptions properly formatted when they occur
4562 (they can be triggered by imported code).
4577 (they can be triggered by imported code).
4563
4578
4564 2002-01-18 Fernando Perez <fperez@colorado.edu>
4579 2002-01-18 Fernando Perez <fperez@colorado.edu>
4565
4580
4566 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4581 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4567 SyntaxError exceptions are reported nicely formatted, instead of
4582 SyntaxError exceptions are reported nicely formatted, instead of
4568 spitting out only offset information as before.
4583 spitting out only offset information as before.
4569 (Magic.magic_prun): Added the @prun function for executing
4584 (Magic.magic_prun): Added the @prun function for executing
4570 programs with command line args inside IPython.
4585 programs with command line args inside IPython.
4571
4586
4572 2002-01-16 Fernando Perez <fperez@colorado.edu>
4587 2002-01-16 Fernando Perez <fperez@colorado.edu>
4573
4588
4574 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4589 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4575 to *not* include the last item given in a range. This brings their
4590 to *not* include the last item given in a range. This brings their
4576 behavior in line with Python's slicing:
4591 behavior in line with Python's slicing:
4577 a[n1:n2] -> a[n1]...a[n2-1]
4592 a[n1:n2] -> a[n1]...a[n2-1]
4578 It may be a bit less convenient, but I prefer to stick to Python's
4593 It may be a bit less convenient, but I prefer to stick to Python's
4579 conventions *everywhere*, so users never have to wonder.
4594 conventions *everywhere*, so users never have to wonder.
4580 (Magic.magic_macro): Added @macro function to ease the creation of
4595 (Magic.magic_macro): Added @macro function to ease the creation of
4581 macros.
4596 macros.
4582
4597
4583 2002-01-05 Fernando Perez <fperez@colorado.edu>
4598 2002-01-05 Fernando Perez <fperez@colorado.edu>
4584
4599
4585 * Released 0.2.4.
4600 * Released 0.2.4.
4586
4601
4587 * IPython/iplib.py (Magic.magic_pdef):
4602 * IPython/iplib.py (Magic.magic_pdef):
4588 (InteractiveShell.safe_execfile): report magic lines and error
4603 (InteractiveShell.safe_execfile): report magic lines and error
4589 lines without line numbers so one can easily copy/paste them for
4604 lines without line numbers so one can easily copy/paste them for
4590 re-execution.
4605 re-execution.
4591
4606
4592 * Updated manual with recent changes.
4607 * Updated manual with recent changes.
4593
4608
4594 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4609 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4595 docstring printing when class? is called. Very handy for knowing
4610 docstring printing when class? is called. Very handy for knowing
4596 how to create class instances (as long as __init__ is well
4611 how to create class instances (as long as __init__ is well
4597 documented, of course :)
4612 documented, of course :)
4598 (Magic.magic_doc): print both class and constructor docstrings.
4613 (Magic.magic_doc): print both class and constructor docstrings.
4599 (Magic.magic_pdef): give constructor info if passed a class and
4614 (Magic.magic_pdef): give constructor info if passed a class and
4600 __call__ info for callable object instances.
4615 __call__ info for callable object instances.
4601
4616
4602 2002-01-04 Fernando Perez <fperez@colorado.edu>
4617 2002-01-04 Fernando Perez <fperez@colorado.edu>
4603
4618
4604 * Made deep_reload() off by default. It doesn't always work
4619 * Made deep_reload() off by default. It doesn't always work
4605 exactly as intended, so it's probably safer to have it off. It's
4620 exactly as intended, so it's probably safer to have it off. It's
4606 still available as dreload() anyway, so nothing is lost.
4621 still available as dreload() anyway, so nothing is lost.
4607
4622
4608 2002-01-02 Fernando Perez <fperez@colorado.edu>
4623 2002-01-02 Fernando Perez <fperez@colorado.edu>
4609
4624
4610 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4625 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4611 so I wanted an updated release).
4626 so I wanted an updated release).
4612
4627
4613 2001-12-27 Fernando Perez <fperez@colorado.edu>
4628 2001-12-27 Fernando Perez <fperez@colorado.edu>
4614
4629
4615 * IPython/iplib.py (InteractiveShell.interact): Added the original
4630 * IPython/iplib.py (InteractiveShell.interact): Added the original
4616 code from 'code.py' for this module in order to change the
4631 code from 'code.py' for this module in order to change the
4617 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4632 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4618 the history cache would break when the user hit Ctrl-C, and
4633 the history cache would break when the user hit Ctrl-C, and
4619 interact() offers no way to add any hooks to it.
4634 interact() offers no way to add any hooks to it.
4620
4635
4621 2001-12-23 Fernando Perez <fperez@colorado.edu>
4636 2001-12-23 Fernando Perez <fperez@colorado.edu>
4622
4637
4623 * setup.py: added check for 'MANIFEST' before trying to remove
4638 * setup.py: added check for 'MANIFEST' before trying to remove
4624 it. Thanks to Sean Reifschneider.
4639 it. Thanks to Sean Reifschneider.
4625
4640
4626 2001-12-22 Fernando Perez <fperez@colorado.edu>
4641 2001-12-22 Fernando Perez <fperez@colorado.edu>
4627
4642
4628 * Released 0.2.2.
4643 * Released 0.2.2.
4629
4644
4630 * Finished (reasonably) writing the manual. Later will add the
4645 * Finished (reasonably) writing the manual. Later will add the
4631 python-standard navigation stylesheets, but for the time being
4646 python-standard navigation stylesheets, but for the time being
4632 it's fairly complete. Distribution will include html and pdf
4647 it's fairly complete. Distribution will include html and pdf
4633 versions.
4648 versions.
4634
4649
4635 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4650 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4636 (MayaVi author).
4651 (MayaVi author).
4637
4652
4638 2001-12-21 Fernando Perez <fperez@colorado.edu>
4653 2001-12-21 Fernando Perez <fperez@colorado.edu>
4639
4654
4640 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4655 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4641 good public release, I think (with the manual and the distutils
4656 good public release, I think (with the manual and the distutils
4642 installer). The manual can use some work, but that can go
4657 installer). The manual can use some work, but that can go
4643 slowly. Otherwise I think it's quite nice for end users. Next
4658 slowly. Otherwise I think it's quite nice for end users. Next
4644 summer, rewrite the guts of it...
4659 summer, rewrite the guts of it...
4645
4660
4646 * Changed format of ipythonrc files to use whitespace as the
4661 * Changed format of ipythonrc files to use whitespace as the
4647 separator instead of an explicit '='. Cleaner.
4662 separator instead of an explicit '='. Cleaner.
4648
4663
4649 2001-12-20 Fernando Perez <fperez@colorado.edu>
4664 2001-12-20 Fernando Perez <fperez@colorado.edu>
4650
4665
4651 * Started a manual in LyX. For now it's just a quick merge of the
4666 * Started a manual in LyX. For now it's just a quick merge of the
4652 various internal docstrings and READMEs. Later it may grow into a
4667 various internal docstrings and READMEs. Later it may grow into a
4653 nice, full-blown manual.
4668 nice, full-blown manual.
4654
4669
4655 * Set up a distutils based installer. Installation should now be
4670 * Set up a distutils based installer. Installation should now be
4656 trivially simple for end-users.
4671 trivially simple for end-users.
4657
4672
4658 2001-12-11 Fernando Perez <fperez@colorado.edu>
4673 2001-12-11 Fernando Perez <fperez@colorado.edu>
4659
4674
4660 * Released 0.2.0. First public release, announced it at
4675 * Released 0.2.0. First public release, announced it at
4661 comp.lang.python. From now on, just bugfixes...
4676 comp.lang.python. From now on, just bugfixes...
4662
4677
4663 * Went through all the files, set copyright/license notices and
4678 * Went through all the files, set copyright/license notices and
4664 cleaned up things. Ready for release.
4679 cleaned up things. Ready for release.
4665
4680
4666 2001-12-10 Fernando Perez <fperez@colorado.edu>
4681 2001-12-10 Fernando Perez <fperez@colorado.edu>
4667
4682
4668 * Changed the first-time installer not to use tarfiles. It's more
4683 * Changed the first-time installer not to use tarfiles. It's more
4669 robust now and less unix-dependent. Also makes it easier for
4684 robust now and less unix-dependent. Also makes it easier for
4670 people to later upgrade versions.
4685 people to later upgrade versions.
4671
4686
4672 * Changed @exit to @abort to reflect the fact that it's pretty
4687 * Changed @exit to @abort to reflect the fact that it's pretty
4673 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4688 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4674 becomes significant only when IPyhton is embedded: in that case,
4689 becomes significant only when IPyhton is embedded: in that case,
4675 C-D closes IPython only, but @abort kills the enclosing program
4690 C-D closes IPython only, but @abort kills the enclosing program
4676 too (unless it had called IPython inside a try catching
4691 too (unless it had called IPython inside a try catching
4677 SystemExit).
4692 SystemExit).
4678
4693
4679 * Created Shell module which exposes the actuall IPython Shell
4694 * Created Shell module which exposes the actuall IPython Shell
4680 classes, currently the normal and the embeddable one. This at
4695 classes, currently the normal and the embeddable one. This at
4681 least offers a stable interface we won't need to change when
4696 least offers a stable interface we won't need to change when
4682 (later) the internals are rewritten. That rewrite will be confined
4697 (later) the internals are rewritten. That rewrite will be confined
4683 to iplib and ipmaker, but the Shell interface should remain as is.
4698 to iplib and ipmaker, but the Shell interface should remain as is.
4684
4699
4685 * Added embed module which offers an embeddable IPShell object,
4700 * Added embed module which offers an embeddable IPShell object,
4686 useful to fire up IPython *inside* a running program. Great for
4701 useful to fire up IPython *inside* a running program. Great for
4687 debugging or dynamical data analysis.
4702 debugging or dynamical data analysis.
4688
4703
4689 2001-12-08 Fernando Perez <fperez@colorado.edu>
4704 2001-12-08 Fernando Perez <fperez@colorado.edu>
4690
4705
4691 * Fixed small bug preventing seeing info from methods of defined
4706 * Fixed small bug preventing seeing info from methods of defined
4692 objects (incorrect namespace in _ofind()).
4707 objects (incorrect namespace in _ofind()).
4693
4708
4694 * Documentation cleanup. Moved the main usage docstrings to a
4709 * Documentation cleanup. Moved the main usage docstrings to a
4695 separate file, usage.py (cleaner to maintain, and hopefully in the
4710 separate file, usage.py (cleaner to maintain, and hopefully in the
4696 future some perlpod-like way of producing interactive, man and
4711 future some perlpod-like way of producing interactive, man and
4697 html docs out of it will be found).
4712 html docs out of it will be found).
4698
4713
4699 * Added @profile to see your profile at any time.
4714 * Added @profile to see your profile at any time.
4700
4715
4701 * Added @p as an alias for 'print'. It's especially convenient if
4716 * Added @p as an alias for 'print'. It's especially convenient if
4702 using automagic ('p x' prints x).
4717 using automagic ('p x' prints x).
4703
4718
4704 * Small cleanups and fixes after a pychecker run.
4719 * Small cleanups and fixes after a pychecker run.
4705
4720
4706 * Changed the @cd command to handle @cd - and @cd -<n> for
4721 * Changed the @cd command to handle @cd - and @cd -<n> for
4707 visiting any directory in _dh.
4722 visiting any directory in _dh.
4708
4723
4709 * Introduced _dh, a history of visited directories. @dhist prints
4724 * Introduced _dh, a history of visited directories. @dhist prints
4710 it out with numbers.
4725 it out with numbers.
4711
4726
4712 2001-12-07 Fernando Perez <fperez@colorado.edu>
4727 2001-12-07 Fernando Perez <fperez@colorado.edu>
4713
4728
4714 * Released 0.1.22
4729 * Released 0.1.22
4715
4730
4716 * Made initialization a bit more robust against invalid color
4731 * Made initialization a bit more robust against invalid color
4717 options in user input (exit, not traceback-crash).
4732 options in user input (exit, not traceback-crash).
4718
4733
4719 * Changed the bug crash reporter to write the report only in the
4734 * Changed the bug crash reporter to write the report only in the
4720 user's .ipython directory. That way IPython won't litter people's
4735 user's .ipython directory. That way IPython won't litter people's
4721 hard disks with crash files all over the place. Also print on
4736 hard disks with crash files all over the place. Also print on
4722 screen the necessary mail command.
4737 screen the necessary mail command.
4723
4738
4724 * With the new ultraTB, implemented LightBG color scheme for light
4739 * With the new ultraTB, implemented LightBG color scheme for light
4725 background terminals. A lot of people like white backgrounds, so I
4740 background terminals. A lot of people like white backgrounds, so I
4726 guess we should at least give them something readable.
4741 guess we should at least give them something readable.
4727
4742
4728 2001-12-06 Fernando Perez <fperez@colorado.edu>
4743 2001-12-06 Fernando Perez <fperez@colorado.edu>
4729
4744
4730 * Modified the structure of ultraTB. Now there's a proper class
4745 * Modified the structure of ultraTB. Now there's a proper class
4731 for tables of color schemes which allow adding schemes easily and
4746 for tables of color schemes which allow adding schemes easily and
4732 switching the active scheme without creating a new instance every
4747 switching the active scheme without creating a new instance every
4733 time (which was ridiculous). The syntax for creating new schemes
4748 time (which was ridiculous). The syntax for creating new schemes
4734 is also cleaner. I think ultraTB is finally done, with a clean
4749 is also cleaner. I think ultraTB is finally done, with a clean
4735 class structure. Names are also much cleaner (now there's proper
4750 class structure. Names are also much cleaner (now there's proper
4736 color tables, no need for every variable to also have 'color' in
4751 color tables, no need for every variable to also have 'color' in
4737 its name).
4752 its name).
4738
4753
4739 * Broke down genutils into separate files. Now genutils only
4754 * Broke down genutils into separate files. Now genutils only
4740 contains utility functions, and classes have been moved to their
4755 contains utility functions, and classes have been moved to their
4741 own files (they had enough independent functionality to warrant
4756 own files (they had enough independent functionality to warrant
4742 it): ConfigLoader, OutputTrap, Struct.
4757 it): ConfigLoader, OutputTrap, Struct.
4743
4758
4744 2001-12-05 Fernando Perez <fperez@colorado.edu>
4759 2001-12-05 Fernando Perez <fperez@colorado.edu>
4745
4760
4746 * IPython turns 21! Released version 0.1.21, as a candidate for
4761 * IPython turns 21! Released version 0.1.21, as a candidate for
4747 public consumption. If all goes well, release in a few days.
4762 public consumption. If all goes well, release in a few days.
4748
4763
4749 * Fixed path bug (files in Extensions/ directory wouldn't be found
4764 * Fixed path bug (files in Extensions/ directory wouldn't be found
4750 unless IPython/ was explicitly in sys.path).
4765 unless IPython/ was explicitly in sys.path).
4751
4766
4752 * Extended the FlexCompleter class as MagicCompleter to allow
4767 * Extended the FlexCompleter class as MagicCompleter to allow
4753 completion of @-starting lines.
4768 completion of @-starting lines.
4754
4769
4755 * Created __release__.py file as a central repository for release
4770 * Created __release__.py file as a central repository for release
4756 info that other files can read from.
4771 info that other files can read from.
4757
4772
4758 * Fixed small bug in logging: when logging was turned on in
4773 * Fixed small bug in logging: when logging was turned on in
4759 mid-session, old lines with special meanings (!@?) were being
4774 mid-session, old lines with special meanings (!@?) were being
4760 logged without the prepended comment, which is necessary since
4775 logged without the prepended comment, which is necessary since
4761 they are not truly valid python syntax. This should make session
4776 they are not truly valid python syntax. This should make session
4762 restores produce less errors.
4777 restores produce less errors.
4763
4778
4764 * The namespace cleanup forced me to make a FlexCompleter class
4779 * The namespace cleanup forced me to make a FlexCompleter class
4765 which is nothing but a ripoff of rlcompleter, but with selectable
4780 which is nothing but a ripoff of rlcompleter, but with selectable
4766 namespace (rlcompleter only works in __main__.__dict__). I'll try
4781 namespace (rlcompleter only works in __main__.__dict__). I'll try
4767 to submit a note to the authors to see if this change can be
4782 to submit a note to the authors to see if this change can be
4768 incorporated in future rlcompleter releases (Dec.6: done)
4783 incorporated in future rlcompleter releases (Dec.6: done)
4769
4784
4770 * More fixes to namespace handling. It was a mess! Now all
4785 * More fixes to namespace handling. It was a mess! Now all
4771 explicit references to __main__.__dict__ are gone (except when
4786 explicit references to __main__.__dict__ are gone (except when
4772 really needed) and everything is handled through the namespace
4787 really needed) and everything is handled through the namespace
4773 dicts in the IPython instance. We seem to be getting somewhere
4788 dicts in the IPython instance. We seem to be getting somewhere
4774 with this, finally...
4789 with this, finally...
4775
4790
4776 * Small documentation updates.
4791 * Small documentation updates.
4777
4792
4778 * Created the Extensions directory under IPython (with an
4793 * Created the Extensions directory under IPython (with an
4779 __init__.py). Put the PhysicalQ stuff there. This directory should
4794 __init__.py). Put the PhysicalQ stuff there. This directory should
4780 be used for all special-purpose extensions.
4795 be used for all special-purpose extensions.
4781
4796
4782 * File renaming:
4797 * File renaming:
4783 ipythonlib --> ipmaker
4798 ipythonlib --> ipmaker
4784 ipplib --> iplib
4799 ipplib --> iplib
4785 This makes a bit more sense in terms of what these files actually do.
4800 This makes a bit more sense in terms of what these files actually do.
4786
4801
4787 * Moved all the classes and functions in ipythonlib to ipplib, so
4802 * Moved all the classes and functions in ipythonlib to ipplib, so
4788 now ipythonlib only has make_IPython(). This will ease up its
4803 now ipythonlib only has make_IPython(). This will ease up its
4789 splitting in smaller functional chunks later.
4804 splitting in smaller functional chunks later.
4790
4805
4791 * Cleaned up (done, I think) output of @whos. Better column
4806 * Cleaned up (done, I think) output of @whos. Better column
4792 formatting, and now shows str(var) for as much as it can, which is
4807 formatting, and now shows str(var) for as much as it can, which is
4793 typically what one gets with a 'print var'.
4808 typically what one gets with a 'print var'.
4794
4809
4795 2001-12-04 Fernando Perez <fperez@colorado.edu>
4810 2001-12-04 Fernando Perez <fperez@colorado.edu>
4796
4811
4797 * Fixed namespace problems. Now builtin/IPyhton/user names get
4812 * Fixed namespace problems. Now builtin/IPyhton/user names get
4798 properly reported in their namespace. Internal namespace handling
4813 properly reported in their namespace. Internal namespace handling
4799 is finally getting decent (not perfect yet, but much better than
4814 is finally getting decent (not perfect yet, but much better than
4800 the ad-hoc mess we had).
4815 the ad-hoc mess we had).
4801
4816
4802 * Removed -exit option. If people just want to run a python
4817 * Removed -exit option. If people just want to run a python
4803 script, that's what the normal interpreter is for. Less
4818 script, that's what the normal interpreter is for. Less
4804 unnecessary options, less chances for bugs.
4819 unnecessary options, less chances for bugs.
4805
4820
4806 * Added a crash handler which generates a complete post-mortem if
4821 * Added a crash handler which generates a complete post-mortem if
4807 IPython crashes. This will help a lot in tracking bugs down the
4822 IPython crashes. This will help a lot in tracking bugs down the
4808 road.
4823 road.
4809
4824
4810 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4825 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4811 which were boud to functions being reassigned would bypass the
4826 which were boud to functions being reassigned would bypass the
4812 logger, breaking the sync of _il with the prompt counter. This
4827 logger, breaking the sync of _il with the prompt counter. This
4813 would then crash IPython later when a new line was logged.
4828 would then crash IPython later when a new line was logged.
4814
4829
4815 2001-12-02 Fernando Perez <fperez@colorado.edu>
4830 2001-12-02 Fernando Perez <fperez@colorado.edu>
4816
4831
4817 * Made IPython a package. This means people don't have to clutter
4832 * Made IPython a package. This means people don't have to clutter
4818 their sys.path with yet another directory. Changed the INSTALL
4833 their sys.path with yet another directory. Changed the INSTALL
4819 file accordingly.
4834 file accordingly.
4820
4835
4821 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4836 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4822 sorts its output (so @who shows it sorted) and @whos formats the
4837 sorts its output (so @who shows it sorted) and @whos formats the
4823 table according to the width of the first column. Nicer, easier to
4838 table according to the width of the first column. Nicer, easier to
4824 read. Todo: write a generic table_format() which takes a list of
4839 read. Todo: write a generic table_format() which takes a list of
4825 lists and prints it nicely formatted, with optional row/column
4840 lists and prints it nicely formatted, with optional row/column
4826 separators and proper padding and justification.
4841 separators and proper padding and justification.
4827
4842
4828 * Released 0.1.20
4843 * Released 0.1.20
4829
4844
4830 * Fixed bug in @log which would reverse the inputcache list (a
4845 * Fixed bug in @log which would reverse the inputcache list (a
4831 copy operation was missing).
4846 copy operation was missing).
4832
4847
4833 * Code cleanup. @config was changed to use page(). Better, since
4848 * Code cleanup. @config was changed to use page(). Better, since
4834 its output is always quite long.
4849 its output is always quite long.
4835
4850
4836 * Itpl is back as a dependency. I was having too many problems
4851 * Itpl is back as a dependency. I was having too many problems
4837 getting the parametric aliases to work reliably, and it's just
4852 getting the parametric aliases to work reliably, and it's just
4838 easier to code weird string operations with it than playing %()s
4853 easier to code weird string operations with it than playing %()s
4839 games. It's only ~6k, so I don't think it's too big a deal.
4854 games. It's only ~6k, so I don't think it's too big a deal.
4840
4855
4841 * Found (and fixed) a very nasty bug with history. !lines weren't
4856 * Found (and fixed) a very nasty bug with history. !lines weren't
4842 getting cached, and the out of sync caches would crash
4857 getting cached, and the out of sync caches would crash
4843 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4858 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4844 division of labor a bit better. Bug fixed, cleaner structure.
4859 division of labor a bit better. Bug fixed, cleaner structure.
4845
4860
4846 2001-12-01 Fernando Perez <fperez@colorado.edu>
4861 2001-12-01 Fernando Perez <fperez@colorado.edu>
4847
4862
4848 * Released 0.1.19
4863 * Released 0.1.19
4849
4864
4850 * Added option -n to @hist to prevent line number printing. Much
4865 * Added option -n to @hist to prevent line number printing. Much
4851 easier to copy/paste code this way.
4866 easier to copy/paste code this way.
4852
4867
4853 * Created global _il to hold the input list. Allows easy
4868 * Created global _il to hold the input list. Allows easy
4854 re-execution of blocks of code by slicing it (inspired by Janko's
4869 re-execution of blocks of code by slicing it (inspired by Janko's
4855 comment on 'macros').
4870 comment on 'macros').
4856
4871
4857 * Small fixes and doc updates.
4872 * Small fixes and doc updates.
4858
4873
4859 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4874 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4860 much too fragile with automagic. Handles properly multi-line
4875 much too fragile with automagic. Handles properly multi-line
4861 statements and takes parameters.
4876 statements and takes parameters.
4862
4877
4863 2001-11-30 Fernando Perez <fperez@colorado.edu>
4878 2001-11-30 Fernando Perez <fperez@colorado.edu>
4864
4879
4865 * Version 0.1.18 released.
4880 * Version 0.1.18 released.
4866
4881
4867 * Fixed nasty namespace bug in initial module imports.
4882 * Fixed nasty namespace bug in initial module imports.
4868
4883
4869 * Added copyright/license notes to all code files (except
4884 * Added copyright/license notes to all code files (except
4870 DPyGetOpt). For the time being, LGPL. That could change.
4885 DPyGetOpt). For the time being, LGPL. That could change.
4871
4886
4872 * Rewrote a much nicer README, updated INSTALL, cleaned up
4887 * Rewrote a much nicer README, updated INSTALL, cleaned up
4873 ipythonrc-* samples.
4888 ipythonrc-* samples.
4874
4889
4875 * Overall code/documentation cleanup. Basically ready for
4890 * Overall code/documentation cleanup. Basically ready for
4876 release. Only remaining thing: licence decision (LGPL?).
4891 release. Only remaining thing: licence decision (LGPL?).
4877
4892
4878 * Converted load_config to a class, ConfigLoader. Now recursion
4893 * Converted load_config to a class, ConfigLoader. Now recursion
4879 control is better organized. Doesn't include the same file twice.
4894 control is better organized. Doesn't include the same file twice.
4880
4895
4881 2001-11-29 Fernando Perez <fperez@colorado.edu>
4896 2001-11-29 Fernando Perez <fperez@colorado.edu>
4882
4897
4883 * Got input history working. Changed output history variables from
4898 * Got input history working. Changed output history variables from
4884 _p to _o so that _i is for input and _o for output. Just cleaner
4899 _p to _o so that _i is for input and _o for output. Just cleaner
4885 convention.
4900 convention.
4886
4901
4887 * Implemented parametric aliases. This pretty much allows the
4902 * Implemented parametric aliases. This pretty much allows the
4888 alias system to offer full-blown shell convenience, I think.
4903 alias system to offer full-blown shell convenience, I think.
4889
4904
4890 * Version 0.1.17 released, 0.1.18 opened.
4905 * Version 0.1.17 released, 0.1.18 opened.
4891
4906
4892 * dot_ipython/ipythonrc (alias): added documentation.
4907 * dot_ipython/ipythonrc (alias): added documentation.
4893 (xcolor): Fixed small bug (xcolors -> xcolor)
4908 (xcolor): Fixed small bug (xcolors -> xcolor)
4894
4909
4895 * Changed the alias system. Now alias is a magic command to define
4910 * Changed the alias system. Now alias is a magic command to define
4896 aliases just like the shell. Rationale: the builtin magics should
4911 aliases just like the shell. Rationale: the builtin magics should
4897 be there for things deeply connected to IPython's
4912 be there for things deeply connected to IPython's
4898 architecture. And this is a much lighter system for what I think
4913 architecture. And this is a much lighter system for what I think
4899 is the really important feature: allowing users to define quickly
4914 is the really important feature: allowing users to define quickly
4900 magics that will do shell things for them, so they can customize
4915 magics that will do shell things for them, so they can customize
4901 IPython easily to match their work habits. If someone is really
4916 IPython easily to match their work habits. If someone is really
4902 desperate to have another name for a builtin alias, they can
4917 desperate to have another name for a builtin alias, they can
4903 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4918 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4904 works.
4919 works.
4905
4920
4906 2001-11-28 Fernando Perez <fperez@colorado.edu>
4921 2001-11-28 Fernando Perez <fperez@colorado.edu>
4907
4922
4908 * Changed @file so that it opens the source file at the proper
4923 * Changed @file so that it opens the source file at the proper
4909 line. Since it uses less, if your EDITOR environment is
4924 line. Since it uses less, if your EDITOR environment is
4910 configured, typing v will immediately open your editor of choice
4925 configured, typing v will immediately open your editor of choice
4911 right at the line where the object is defined. Not as quick as
4926 right at the line where the object is defined. Not as quick as
4912 having a direct @edit command, but for all intents and purposes it
4927 having a direct @edit command, but for all intents and purposes it
4913 works. And I don't have to worry about writing @edit to deal with
4928 works. And I don't have to worry about writing @edit to deal with
4914 all the editors, less does that.
4929 all the editors, less does that.
4915
4930
4916 * Version 0.1.16 released, 0.1.17 opened.
4931 * Version 0.1.16 released, 0.1.17 opened.
4917
4932
4918 * Fixed some nasty bugs in the page/page_dumb combo that could
4933 * Fixed some nasty bugs in the page/page_dumb combo that could
4919 crash IPython.
4934 crash IPython.
4920
4935
4921 2001-11-27 Fernando Perez <fperez@colorado.edu>
4936 2001-11-27 Fernando Perez <fperez@colorado.edu>
4922
4937
4923 * Version 0.1.15 released, 0.1.16 opened.
4938 * Version 0.1.15 released, 0.1.16 opened.
4924
4939
4925 * Finally got ? and ?? to work for undefined things: now it's
4940 * Finally got ? and ?? to work for undefined things: now it's
4926 possible to type {}.get? and get information about the get method
4941 possible to type {}.get? and get information about the get method
4927 of dicts, or os.path? even if only os is defined (so technically
4942 of dicts, or os.path? even if only os is defined (so technically
4928 os.path isn't). Works at any level. For example, after import os,
4943 os.path isn't). Works at any level. For example, after import os,
4929 os?, os.path?, os.path.abspath? all work. This is great, took some
4944 os?, os.path?, os.path.abspath? all work. This is great, took some
4930 work in _ofind.
4945 work in _ofind.
4931
4946
4932 * Fixed more bugs with logging. The sanest way to do it was to add
4947 * Fixed more bugs with logging. The sanest way to do it was to add
4933 to @log a 'mode' parameter. Killed two in one shot (this mode
4948 to @log a 'mode' parameter. Killed two in one shot (this mode
4934 option was a request of Janko's). I think it's finally clean
4949 option was a request of Janko's). I think it's finally clean
4935 (famous last words).
4950 (famous last words).
4936
4951
4937 * Added a page_dumb() pager which does a decent job of paging on
4952 * Added a page_dumb() pager which does a decent job of paging on
4938 screen, if better things (like less) aren't available. One less
4953 screen, if better things (like less) aren't available. One less
4939 unix dependency (someday maybe somebody will port this to
4954 unix dependency (someday maybe somebody will port this to
4940 windows).
4955 windows).
4941
4956
4942 * Fixed problem in magic_log: would lock of logging out if log
4957 * Fixed problem in magic_log: would lock of logging out if log
4943 creation failed (because it would still think it had succeeded).
4958 creation failed (because it would still think it had succeeded).
4944
4959
4945 * Improved the page() function using curses to auto-detect screen
4960 * Improved the page() function using curses to auto-detect screen
4946 size. Now it can make a much better decision on whether to print
4961 size. Now it can make a much better decision on whether to print
4947 or page a string. Option screen_length was modified: a value 0
4962 or page a string. Option screen_length was modified: a value 0
4948 means auto-detect, and that's the default now.
4963 means auto-detect, and that's the default now.
4949
4964
4950 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4965 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4951 go out. I'll test it for a few days, then talk to Janko about
4966 go out. I'll test it for a few days, then talk to Janko about
4952 licences and announce it.
4967 licences and announce it.
4953
4968
4954 * Fixed the length of the auto-generated ---> prompt which appears
4969 * Fixed the length of the auto-generated ---> prompt which appears
4955 for auto-parens and auto-quotes. Getting this right isn't trivial,
4970 for auto-parens and auto-quotes. Getting this right isn't trivial,
4956 with all the color escapes, different prompt types and optional
4971 with all the color escapes, different prompt types and optional
4957 separators. But it seems to be working in all the combinations.
4972 separators. But it seems to be working in all the combinations.
4958
4973
4959 2001-11-26 Fernando Perez <fperez@colorado.edu>
4974 2001-11-26 Fernando Perez <fperez@colorado.edu>
4960
4975
4961 * Wrote a regexp filter to get option types from the option names
4976 * Wrote a regexp filter to get option types from the option names
4962 string. This eliminates the need to manually keep two duplicate
4977 string. This eliminates the need to manually keep two duplicate
4963 lists.
4978 lists.
4964
4979
4965 * Removed the unneeded check_option_names. Now options are handled
4980 * Removed the unneeded check_option_names. Now options are handled
4966 in a much saner manner and it's easy to visually check that things
4981 in a much saner manner and it's easy to visually check that things
4967 are ok.
4982 are ok.
4968
4983
4969 * Updated version numbers on all files I modified to carry a
4984 * Updated version numbers on all files I modified to carry a
4970 notice so Janko and Nathan have clear version markers.
4985 notice so Janko and Nathan have clear version markers.
4971
4986
4972 * Updated docstring for ultraTB with my changes. I should send
4987 * Updated docstring for ultraTB with my changes. I should send
4973 this to Nathan.
4988 this to Nathan.
4974
4989
4975 * Lots of small fixes. Ran everything through pychecker again.
4990 * Lots of small fixes. Ran everything through pychecker again.
4976
4991
4977 * Made loading of deep_reload an cmd line option. If it's not too
4992 * Made loading of deep_reload an cmd line option. If it's not too
4978 kosher, now people can just disable it. With -nodeep_reload it's
4993 kosher, now people can just disable it. With -nodeep_reload it's
4979 still available as dreload(), it just won't overwrite reload().
4994 still available as dreload(), it just won't overwrite reload().
4980
4995
4981 * Moved many options to the no| form (-opt and -noopt
4996 * Moved many options to the no| form (-opt and -noopt
4982 accepted). Cleaner.
4997 accepted). Cleaner.
4983
4998
4984 * Changed magic_log so that if called with no parameters, it uses
4999 * Changed magic_log so that if called with no parameters, it uses
4985 'rotate' mode. That way auto-generated logs aren't automatically
5000 'rotate' mode. That way auto-generated logs aren't automatically
4986 over-written. For normal logs, now a backup is made if it exists
5001 over-written. For normal logs, now a backup is made if it exists
4987 (only 1 level of backups). A new 'backup' mode was added to the
5002 (only 1 level of backups). A new 'backup' mode was added to the
4988 Logger class to support this. This was a request by Janko.
5003 Logger class to support this. This was a request by Janko.
4989
5004
4990 * Added @logoff/@logon to stop/restart an active log.
5005 * Added @logoff/@logon to stop/restart an active log.
4991
5006
4992 * Fixed a lot of bugs in log saving/replay. It was pretty
5007 * Fixed a lot of bugs in log saving/replay. It was pretty
4993 broken. Now special lines (!@,/) appear properly in the command
5008 broken. Now special lines (!@,/) appear properly in the command
4994 history after a log replay.
5009 history after a log replay.
4995
5010
4996 * Tried and failed to implement full session saving via pickle. My
5011 * Tried and failed to implement full session saving via pickle. My
4997 idea was to pickle __main__.__dict__, but modules can't be
5012 idea was to pickle __main__.__dict__, but modules can't be
4998 pickled. This would be a better alternative to replaying logs, but
5013 pickled. This would be a better alternative to replaying logs, but
4999 seems quite tricky to get to work. Changed -session to be called
5014 seems quite tricky to get to work. Changed -session to be called
5000 -logplay, which more accurately reflects what it does. And if we
5015 -logplay, which more accurately reflects what it does. And if we
5001 ever get real session saving working, -session is now available.
5016 ever get real session saving working, -session is now available.
5002
5017
5003 * Implemented color schemes for prompts also. As for tracebacks,
5018 * Implemented color schemes for prompts also. As for tracebacks,
5004 currently only NoColor and Linux are supported. But now the
5019 currently only NoColor and Linux are supported. But now the
5005 infrastructure is in place, based on a generic ColorScheme
5020 infrastructure is in place, based on a generic ColorScheme
5006 class. So writing and activating new schemes both for the prompts
5021 class. So writing and activating new schemes both for the prompts
5007 and the tracebacks should be straightforward.
5022 and the tracebacks should be straightforward.
5008
5023
5009 * Version 0.1.13 released, 0.1.14 opened.
5024 * Version 0.1.13 released, 0.1.14 opened.
5010
5025
5011 * Changed handling of options for output cache. Now counter is
5026 * Changed handling of options for output cache. Now counter is
5012 hardwired starting at 1 and one specifies the maximum number of
5027 hardwired starting at 1 and one specifies the maximum number of
5013 entries *in the outcache* (not the max prompt counter). This is
5028 entries *in the outcache* (not the max prompt counter). This is
5014 much better, since many statements won't increase the cache
5029 much better, since many statements won't increase the cache
5015 count. It also eliminated some confusing options, now there's only
5030 count. It also eliminated some confusing options, now there's only
5016 one: cache_size.
5031 one: cache_size.
5017
5032
5018 * Added 'alias' magic function and magic_alias option in the
5033 * Added 'alias' magic function and magic_alias option in the
5019 ipythonrc file. Now the user can easily define whatever names he
5034 ipythonrc file. Now the user can easily define whatever names he
5020 wants for the magic functions without having to play weird
5035 wants for the magic functions without having to play weird
5021 namespace games. This gives IPython a real shell-like feel.
5036 namespace games. This gives IPython a real shell-like feel.
5022
5037
5023 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5038 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5024 @ or not).
5039 @ or not).
5025
5040
5026 This was one of the last remaining 'visible' bugs (that I know
5041 This was one of the last remaining 'visible' bugs (that I know
5027 of). I think if I can clean up the session loading so it works
5042 of). I think if I can clean up the session loading so it works
5028 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5043 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5029 about licensing).
5044 about licensing).
5030
5045
5031 2001-11-25 Fernando Perez <fperez@colorado.edu>
5046 2001-11-25 Fernando Perez <fperez@colorado.edu>
5032
5047
5033 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5048 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5034 there's a cleaner distinction between what ? and ?? show.
5049 there's a cleaner distinction between what ? and ?? show.
5035
5050
5036 * Added screen_length option. Now the user can define his own
5051 * Added screen_length option. Now the user can define his own
5037 screen size for page() operations.
5052 screen size for page() operations.
5038
5053
5039 * Implemented magic shell-like functions with automatic code
5054 * Implemented magic shell-like functions with automatic code
5040 generation. Now adding another function is just a matter of adding
5055 generation. Now adding another function is just a matter of adding
5041 an entry to a dict, and the function is dynamically generated at
5056 an entry to a dict, and the function is dynamically generated at
5042 run-time. Python has some really cool features!
5057 run-time. Python has some really cool features!
5043
5058
5044 * Renamed many options to cleanup conventions a little. Now all
5059 * Renamed many options to cleanup conventions a little. Now all
5045 are lowercase, and only underscores where needed. Also in the code
5060 are lowercase, and only underscores where needed. Also in the code
5046 option name tables are clearer.
5061 option name tables are clearer.
5047
5062
5048 * Changed prompts a little. Now input is 'In [n]:' instead of
5063 * Changed prompts a little. Now input is 'In [n]:' instead of
5049 'In[n]:='. This allows it the numbers to be aligned with the
5064 'In[n]:='. This allows it the numbers to be aligned with the
5050 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5065 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5051 Python (it was a Mathematica thing). The '...' continuation prompt
5066 Python (it was a Mathematica thing). The '...' continuation prompt
5052 was also changed a little to align better.
5067 was also changed a little to align better.
5053
5068
5054 * Fixed bug when flushing output cache. Not all _p<n> variables
5069 * Fixed bug when flushing output cache. Not all _p<n> variables
5055 exist, so their deletion needs to be wrapped in a try:
5070 exist, so their deletion needs to be wrapped in a try:
5056
5071
5057 * Figured out how to properly use inspect.formatargspec() (it
5072 * Figured out how to properly use inspect.formatargspec() (it
5058 requires the args preceded by *). So I removed all the code from
5073 requires the args preceded by *). So I removed all the code from
5059 _get_pdef in Magic, which was just replicating that.
5074 _get_pdef in Magic, which was just replicating that.
5060
5075
5061 * Added test to prefilter to allow redefining magic function names
5076 * Added test to prefilter to allow redefining magic function names
5062 as variables. This is ok, since the @ form is always available,
5077 as variables. This is ok, since the @ form is always available,
5063 but whe should allow the user to define a variable called 'ls' if
5078 but whe should allow the user to define a variable called 'ls' if
5064 he needs it.
5079 he needs it.
5065
5080
5066 * Moved the ToDo information from README into a separate ToDo.
5081 * Moved the ToDo information from README into a separate ToDo.
5067
5082
5068 * General code cleanup and small bugfixes. I think it's close to a
5083 * General code cleanup and small bugfixes. I think it's close to a
5069 state where it can be released, obviously with a big 'beta'
5084 state where it can be released, obviously with a big 'beta'
5070 warning on it.
5085 warning on it.
5071
5086
5072 * Got the magic function split to work. Now all magics are defined
5087 * Got the magic function split to work. Now all magics are defined
5073 in a separate class. It just organizes things a bit, and now
5088 in a separate class. It just organizes things a bit, and now
5074 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5089 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5075 was too long).
5090 was too long).
5076
5091
5077 * Changed @clear to @reset to avoid potential confusions with
5092 * Changed @clear to @reset to avoid potential confusions with
5078 the shell command clear. Also renamed @cl to @clear, which does
5093 the shell command clear. Also renamed @cl to @clear, which does
5079 exactly what people expect it to from their shell experience.
5094 exactly what people expect it to from their shell experience.
5080
5095
5081 Added a check to the @reset command (since it's so
5096 Added a check to the @reset command (since it's so
5082 destructive, it's probably a good idea to ask for confirmation).
5097 destructive, it's probably a good idea to ask for confirmation).
5083 But now reset only works for full namespace resetting. Since the
5098 But now reset only works for full namespace resetting. Since the
5084 del keyword is already there for deleting a few specific
5099 del keyword is already there for deleting a few specific
5085 variables, I don't see the point of having a redundant magic
5100 variables, I don't see the point of having a redundant magic
5086 function for the same task.
5101 function for the same task.
5087
5102
5088 2001-11-24 Fernando Perez <fperez@colorado.edu>
5103 2001-11-24 Fernando Perez <fperez@colorado.edu>
5089
5104
5090 * Updated the builtin docs (esp. the ? ones).
5105 * Updated the builtin docs (esp. the ? ones).
5091
5106
5092 * Ran all the code through pychecker. Not terribly impressed with
5107 * Ran all the code through pychecker. Not terribly impressed with
5093 it: lots of spurious warnings and didn't really find anything of
5108 it: lots of spurious warnings and didn't really find anything of
5094 substance (just a few modules being imported and not used).
5109 substance (just a few modules being imported and not used).
5095
5110
5096 * Implemented the new ultraTB functionality into IPython. New
5111 * Implemented the new ultraTB functionality into IPython. New
5097 option: xcolors. This chooses color scheme. xmode now only selects
5112 option: xcolors. This chooses color scheme. xmode now only selects
5098 between Plain and Verbose. Better orthogonality.
5113 between Plain and Verbose. Better orthogonality.
5099
5114
5100 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5115 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5101 mode and color scheme for the exception handlers. Now it's
5116 mode and color scheme for the exception handlers. Now it's
5102 possible to have the verbose traceback with no coloring.
5117 possible to have the verbose traceback with no coloring.
5103
5118
5104 2001-11-23 Fernando Perez <fperez@colorado.edu>
5119 2001-11-23 Fernando Perez <fperez@colorado.edu>
5105
5120
5106 * Version 0.1.12 released, 0.1.13 opened.
5121 * Version 0.1.12 released, 0.1.13 opened.
5107
5122
5108 * Removed option to set auto-quote and auto-paren escapes by
5123 * Removed option to set auto-quote and auto-paren escapes by
5109 user. The chances of breaking valid syntax are just too high. If
5124 user. The chances of breaking valid syntax are just too high. If
5110 someone *really* wants, they can always dig into the code.
5125 someone *really* wants, they can always dig into the code.
5111
5126
5112 * Made prompt separators configurable.
5127 * Made prompt separators configurable.
5113
5128
5114 2001-11-22 Fernando Perez <fperez@colorado.edu>
5129 2001-11-22 Fernando Perez <fperez@colorado.edu>
5115
5130
5116 * Small bugfixes in many places.
5131 * Small bugfixes in many places.
5117
5132
5118 * Removed the MyCompleter class from ipplib. It seemed redundant
5133 * Removed the MyCompleter class from ipplib. It seemed redundant
5119 with the C-p,C-n history search functionality. Less code to
5134 with the C-p,C-n history search functionality. Less code to
5120 maintain.
5135 maintain.
5121
5136
5122 * Moved all the original ipython.py code into ipythonlib.py. Right
5137 * Moved all the original ipython.py code into ipythonlib.py. Right
5123 now it's just one big dump into a function called make_IPython, so
5138 now it's just one big dump into a function called make_IPython, so
5124 no real modularity has been gained. But at least it makes the
5139 no real modularity has been gained. But at least it makes the
5125 wrapper script tiny, and since ipythonlib is a module, it gets
5140 wrapper script tiny, and since ipythonlib is a module, it gets
5126 compiled and startup is much faster.
5141 compiled and startup is much faster.
5127
5142
5128 This is a reasobably 'deep' change, so we should test it for a
5143 This is a reasobably 'deep' change, so we should test it for a
5129 while without messing too much more with the code.
5144 while without messing too much more with the code.
5130
5145
5131 2001-11-21 Fernando Perez <fperez@colorado.edu>
5146 2001-11-21 Fernando Perez <fperez@colorado.edu>
5132
5147
5133 * Version 0.1.11 released, 0.1.12 opened for further work.
5148 * Version 0.1.11 released, 0.1.12 opened for further work.
5134
5149
5135 * Removed dependency on Itpl. It was only needed in one place. It
5150 * Removed dependency on Itpl. It was only needed in one place. It
5136 would be nice if this became part of python, though. It makes life
5151 would be nice if this became part of python, though. It makes life
5137 *a lot* easier in some cases.
5152 *a lot* easier in some cases.
5138
5153
5139 * Simplified the prefilter code a bit. Now all handlers are
5154 * Simplified the prefilter code a bit. Now all handlers are
5140 expected to explicitly return a value (at least a blank string).
5155 expected to explicitly return a value (at least a blank string).
5141
5156
5142 * Heavy edits in ipplib. Removed the help system altogether. Now
5157 * Heavy edits in ipplib. Removed the help system altogether. Now
5143 obj?/?? is used for inspecting objects, a magic @doc prints
5158 obj?/?? is used for inspecting objects, a magic @doc prints
5144 docstrings, and full-blown Python help is accessed via the 'help'
5159 docstrings, and full-blown Python help is accessed via the 'help'
5145 keyword. This cleans up a lot of code (less to maintain) and does
5160 keyword. This cleans up a lot of code (less to maintain) and does
5146 the job. Since 'help' is now a standard Python component, might as
5161 the job. Since 'help' is now a standard Python component, might as
5147 well use it and remove duplicate functionality.
5162 well use it and remove duplicate functionality.
5148
5163
5149 Also removed the option to use ipplib as a standalone program. By
5164 Also removed the option to use ipplib as a standalone program. By
5150 now it's too dependent on other parts of IPython to function alone.
5165 now it's too dependent on other parts of IPython to function alone.
5151
5166
5152 * Fixed bug in genutils.pager. It would crash if the pager was
5167 * Fixed bug in genutils.pager. It would crash if the pager was
5153 exited immediately after opening (broken pipe).
5168 exited immediately after opening (broken pipe).
5154
5169
5155 * Trimmed down the VerboseTB reporting a little. The header is
5170 * Trimmed down the VerboseTB reporting a little. The header is
5156 much shorter now and the repeated exception arguments at the end
5171 much shorter now and the repeated exception arguments at the end
5157 have been removed. For interactive use the old header seemed a bit
5172 have been removed. For interactive use the old header seemed a bit
5158 excessive.
5173 excessive.
5159
5174
5160 * Fixed small bug in output of @whos for variables with multi-word
5175 * Fixed small bug in output of @whos for variables with multi-word
5161 types (only first word was displayed).
5176 types (only first word was displayed).
5162
5177
5163 2001-11-17 Fernando Perez <fperez@colorado.edu>
5178 2001-11-17 Fernando Perez <fperez@colorado.edu>
5164
5179
5165 * Version 0.1.10 released, 0.1.11 opened for further work.
5180 * Version 0.1.10 released, 0.1.11 opened for further work.
5166
5181
5167 * Modified dirs and friends. dirs now *returns* the stack (not
5182 * Modified dirs and friends. dirs now *returns* the stack (not
5168 prints), so one can manipulate it as a variable. Convenient to
5183 prints), so one can manipulate it as a variable. Convenient to
5169 travel along many directories.
5184 travel along many directories.
5170
5185
5171 * Fixed bug in magic_pdef: would only work with functions with
5186 * Fixed bug in magic_pdef: would only work with functions with
5172 arguments with default values.
5187 arguments with default values.
5173
5188
5174 2001-11-14 Fernando Perez <fperez@colorado.edu>
5189 2001-11-14 Fernando Perez <fperez@colorado.edu>
5175
5190
5176 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5191 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5177 example with IPython. Various other minor fixes and cleanups.
5192 example with IPython. Various other minor fixes and cleanups.
5178
5193
5179 * Version 0.1.9 released, 0.1.10 opened for further work.
5194 * Version 0.1.9 released, 0.1.10 opened for further work.
5180
5195
5181 * Added sys.path to the list of directories searched in the
5196 * Added sys.path to the list of directories searched in the
5182 execfile= option. It used to be the current directory and the
5197 execfile= option. It used to be the current directory and the
5183 user's IPYTHONDIR only.
5198 user's IPYTHONDIR only.
5184
5199
5185 2001-11-13 Fernando Perez <fperez@colorado.edu>
5200 2001-11-13 Fernando Perez <fperez@colorado.edu>
5186
5201
5187 * Reinstated the raw_input/prefilter separation that Janko had
5202 * Reinstated the raw_input/prefilter separation that Janko had
5188 initially. This gives a more convenient setup for extending the
5203 initially. This gives a more convenient setup for extending the
5189 pre-processor from the outside: raw_input always gets a string,
5204 pre-processor from the outside: raw_input always gets a string,
5190 and prefilter has to process it. We can then redefine prefilter
5205 and prefilter has to process it. We can then redefine prefilter
5191 from the outside and implement extensions for special
5206 from the outside and implement extensions for special
5192 purposes.
5207 purposes.
5193
5208
5194 Today I got one for inputting PhysicalQuantity objects
5209 Today I got one for inputting PhysicalQuantity objects
5195 (from Scientific) without needing any function calls at
5210 (from Scientific) without needing any function calls at
5196 all. Extremely convenient, and it's all done as a user-level
5211 all. Extremely convenient, and it's all done as a user-level
5197 extension (no IPython code was touched). Now instead of:
5212 extension (no IPython code was touched). Now instead of:
5198 a = PhysicalQuantity(4.2,'m/s**2')
5213 a = PhysicalQuantity(4.2,'m/s**2')
5199 one can simply say
5214 one can simply say
5200 a = 4.2 m/s**2
5215 a = 4.2 m/s**2
5201 or even
5216 or even
5202 a = 4.2 m/s^2
5217 a = 4.2 m/s^2
5203
5218
5204 I use this, but it's also a proof of concept: IPython really is
5219 I use this, but it's also a proof of concept: IPython really is
5205 fully user-extensible, even at the level of the parsing of the
5220 fully user-extensible, even at the level of the parsing of the
5206 command line. It's not trivial, but it's perfectly doable.
5221 command line. It's not trivial, but it's perfectly doable.
5207
5222
5208 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5223 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5209 the problem of modules being loaded in the inverse order in which
5224 the problem of modules being loaded in the inverse order in which
5210 they were defined in
5225 they were defined in
5211
5226
5212 * Version 0.1.8 released, 0.1.9 opened for further work.
5227 * Version 0.1.8 released, 0.1.9 opened for further work.
5213
5228
5214 * Added magics pdef, source and file. They respectively show the
5229 * Added magics pdef, source and file. They respectively show the
5215 definition line ('prototype' in C), source code and full python
5230 definition line ('prototype' in C), source code and full python
5216 file for any callable object. The object inspector oinfo uses
5231 file for any callable object. The object inspector oinfo uses
5217 these to show the same information.
5232 these to show the same information.
5218
5233
5219 * Version 0.1.7 released, 0.1.8 opened for further work.
5234 * Version 0.1.7 released, 0.1.8 opened for further work.
5220
5235
5221 * Separated all the magic functions into a class called Magic. The
5236 * Separated all the magic functions into a class called Magic. The
5222 InteractiveShell class was becoming too big for Xemacs to handle
5237 InteractiveShell class was becoming too big for Xemacs to handle
5223 (de-indenting a line would lock it up for 10 seconds while it
5238 (de-indenting a line would lock it up for 10 seconds while it
5224 backtracked on the whole class!)
5239 backtracked on the whole class!)
5225
5240
5226 FIXME: didn't work. It can be done, but right now namespaces are
5241 FIXME: didn't work. It can be done, but right now namespaces are
5227 all messed up. Do it later (reverted it for now, so at least
5242 all messed up. Do it later (reverted it for now, so at least
5228 everything works as before).
5243 everything works as before).
5229
5244
5230 * Got the object introspection system (magic_oinfo) working! I
5245 * Got the object introspection system (magic_oinfo) working! I
5231 think this is pretty much ready for release to Janko, so he can
5246 think this is pretty much ready for release to Janko, so he can
5232 test it for a while and then announce it. Pretty much 100% of what
5247 test it for a while and then announce it. Pretty much 100% of what
5233 I wanted for the 'phase 1' release is ready. Happy, tired.
5248 I wanted for the 'phase 1' release is ready. Happy, tired.
5234
5249
5235 2001-11-12 Fernando Perez <fperez@colorado.edu>
5250 2001-11-12 Fernando Perez <fperez@colorado.edu>
5236
5251
5237 * Version 0.1.6 released, 0.1.7 opened for further work.
5252 * Version 0.1.6 released, 0.1.7 opened for further work.
5238
5253
5239 * Fixed bug in printing: it used to test for truth before
5254 * Fixed bug in printing: it used to test for truth before
5240 printing, so 0 wouldn't print. Now checks for None.
5255 printing, so 0 wouldn't print. Now checks for None.
5241
5256
5242 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5257 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5243 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5258 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5244 reaches by hand into the outputcache. Think of a better way to do
5259 reaches by hand into the outputcache. Think of a better way to do
5245 this later.
5260 this later.
5246
5261
5247 * Various small fixes thanks to Nathan's comments.
5262 * Various small fixes thanks to Nathan's comments.
5248
5263
5249 * Changed magic_pprint to magic_Pprint. This way it doesn't
5264 * Changed magic_pprint to magic_Pprint. This way it doesn't
5250 collide with pprint() and the name is consistent with the command
5265 collide with pprint() and the name is consistent with the command
5251 line option.
5266 line option.
5252
5267
5253 * Changed prompt counter behavior to be fully like
5268 * Changed prompt counter behavior to be fully like
5254 Mathematica's. That is, even input that doesn't return a result
5269 Mathematica's. That is, even input that doesn't return a result
5255 raises the prompt counter. The old behavior was kind of confusing
5270 raises the prompt counter. The old behavior was kind of confusing
5256 (getting the same prompt number several times if the operation
5271 (getting the same prompt number several times if the operation
5257 didn't return a result).
5272 didn't return a result).
5258
5273
5259 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5274 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5260
5275
5261 * Fixed -Classic mode (wasn't working anymore).
5276 * Fixed -Classic mode (wasn't working anymore).
5262
5277
5263 * Added colored prompts using Nathan's new code. Colors are
5278 * Added colored prompts using Nathan's new code. Colors are
5264 currently hardwired, they can be user-configurable. For
5279 currently hardwired, they can be user-configurable. For
5265 developers, they can be chosen in file ipythonlib.py, at the
5280 developers, they can be chosen in file ipythonlib.py, at the
5266 beginning of the CachedOutput class def.
5281 beginning of the CachedOutput class def.
5267
5282
5268 2001-11-11 Fernando Perez <fperez@colorado.edu>
5283 2001-11-11 Fernando Perez <fperez@colorado.edu>
5269
5284
5270 * Version 0.1.5 released, 0.1.6 opened for further work.
5285 * Version 0.1.5 released, 0.1.6 opened for further work.
5271
5286
5272 * Changed magic_env to *return* the environment as a dict (not to
5287 * Changed magic_env to *return* the environment as a dict (not to
5273 print it). This way it prints, but it can also be processed.
5288 print it). This way it prints, but it can also be processed.
5274
5289
5275 * Added Verbose exception reporting to interactive
5290 * Added Verbose exception reporting to interactive
5276 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5291 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5277 traceback. Had to make some changes to the ultraTB file. This is
5292 traceback. Had to make some changes to the ultraTB file. This is
5278 probably the last 'big' thing in my mental todo list. This ties
5293 probably the last 'big' thing in my mental todo list. This ties
5279 in with the next entry:
5294 in with the next entry:
5280
5295
5281 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5296 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5282 has to specify is Plain, Color or Verbose for all exception
5297 has to specify is Plain, Color or Verbose for all exception
5283 handling.
5298 handling.
5284
5299
5285 * Removed ShellServices option. All this can really be done via
5300 * Removed ShellServices option. All this can really be done via
5286 the magic system. It's easier to extend, cleaner and has automatic
5301 the magic system. It's easier to extend, cleaner and has automatic
5287 namespace protection and documentation.
5302 namespace protection and documentation.
5288
5303
5289 2001-11-09 Fernando Perez <fperez@colorado.edu>
5304 2001-11-09 Fernando Perez <fperez@colorado.edu>
5290
5305
5291 * Fixed bug in output cache flushing (missing parameter to
5306 * Fixed bug in output cache flushing (missing parameter to
5292 __init__). Other small bugs fixed (found using pychecker).
5307 __init__). Other small bugs fixed (found using pychecker).
5293
5308
5294 * Version 0.1.4 opened for bugfixing.
5309 * Version 0.1.4 opened for bugfixing.
5295
5310
5296 2001-11-07 Fernando Perez <fperez@colorado.edu>
5311 2001-11-07 Fernando Perez <fperez@colorado.edu>
5297
5312
5298 * Version 0.1.3 released, mainly because of the raw_input bug.
5313 * Version 0.1.3 released, mainly because of the raw_input bug.
5299
5314
5300 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5315 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5301 and when testing for whether things were callable, a call could
5316 and when testing for whether things were callable, a call could
5302 actually be made to certain functions. They would get called again
5317 actually be made to certain functions. They would get called again
5303 once 'really' executed, with a resulting double call. A disaster
5318 once 'really' executed, with a resulting double call. A disaster
5304 in many cases (list.reverse() would never work!).
5319 in many cases (list.reverse() would never work!).
5305
5320
5306 * Removed prefilter() function, moved its code to raw_input (which
5321 * Removed prefilter() function, moved its code to raw_input (which
5307 after all was just a near-empty caller for prefilter). This saves
5322 after all was just a near-empty caller for prefilter). This saves
5308 a function call on every prompt, and simplifies the class a tiny bit.
5323 a function call on every prompt, and simplifies the class a tiny bit.
5309
5324
5310 * Fix _ip to __ip name in magic example file.
5325 * Fix _ip to __ip name in magic example file.
5311
5326
5312 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5327 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5313 work with non-gnu versions of tar.
5328 work with non-gnu versions of tar.
5314
5329
5315 2001-11-06 Fernando Perez <fperez@colorado.edu>
5330 2001-11-06 Fernando Perez <fperez@colorado.edu>
5316
5331
5317 * Version 0.1.2. Just to keep track of the recent changes.
5332 * Version 0.1.2. Just to keep track of the recent changes.
5318
5333
5319 * Fixed nasty bug in output prompt routine. It used to check 'if
5334 * Fixed nasty bug in output prompt routine. It used to check 'if
5320 arg != None...'. Problem is, this fails if arg implements a
5335 arg != None...'. Problem is, this fails if arg implements a
5321 special comparison (__cmp__) which disallows comparing to
5336 special comparison (__cmp__) which disallows comparing to
5322 None. Found it when trying to use the PhysicalQuantity module from
5337 None. Found it when trying to use the PhysicalQuantity module from
5323 ScientificPython.
5338 ScientificPython.
5324
5339
5325 2001-11-05 Fernando Perez <fperez@colorado.edu>
5340 2001-11-05 Fernando Perez <fperez@colorado.edu>
5326
5341
5327 * Also added dirs. Now the pushd/popd/dirs family functions
5342 * Also added dirs. Now the pushd/popd/dirs family functions
5328 basically like the shell, with the added convenience of going home
5343 basically like the shell, with the added convenience of going home
5329 when called with no args.
5344 when called with no args.
5330
5345
5331 * pushd/popd slightly modified to mimic shell behavior more
5346 * pushd/popd slightly modified to mimic shell behavior more
5332 closely.
5347 closely.
5333
5348
5334 * Added env,pushd,popd from ShellServices as magic functions. I
5349 * Added env,pushd,popd from ShellServices as magic functions. I
5335 think the cleanest will be to port all desired functions from
5350 think the cleanest will be to port all desired functions from
5336 ShellServices as magics and remove ShellServices altogether. This
5351 ShellServices as magics and remove ShellServices altogether. This
5337 will provide a single, clean way of adding functionality
5352 will provide a single, clean way of adding functionality
5338 (shell-type or otherwise) to IP.
5353 (shell-type or otherwise) to IP.
5339
5354
5340 2001-11-04 Fernando Perez <fperez@colorado.edu>
5355 2001-11-04 Fernando Perez <fperez@colorado.edu>
5341
5356
5342 * Added .ipython/ directory to sys.path. This way users can keep
5357 * Added .ipython/ directory to sys.path. This way users can keep
5343 customizations there and access them via import.
5358 customizations there and access them via import.
5344
5359
5345 2001-11-03 Fernando Perez <fperez@colorado.edu>
5360 2001-11-03 Fernando Perez <fperez@colorado.edu>
5346
5361
5347 * Opened version 0.1.1 for new changes.
5362 * Opened version 0.1.1 for new changes.
5348
5363
5349 * Changed version number to 0.1.0: first 'public' release, sent to
5364 * Changed version number to 0.1.0: first 'public' release, sent to
5350 Nathan and Janko.
5365 Nathan and Janko.
5351
5366
5352 * Lots of small fixes and tweaks.
5367 * Lots of small fixes and tweaks.
5353
5368
5354 * Minor changes to whos format. Now strings are shown, snipped if
5369 * Minor changes to whos format. Now strings are shown, snipped if
5355 too long.
5370 too long.
5356
5371
5357 * Changed ShellServices to work on __main__ so they show up in @who
5372 * Changed ShellServices to work on __main__ so they show up in @who
5358
5373
5359 * Help also works with ? at the end of a line:
5374 * Help also works with ? at the end of a line:
5360 ?sin and sin?
5375 ?sin and sin?
5361 both produce the same effect. This is nice, as often I use the
5376 both produce the same effect. This is nice, as often I use the
5362 tab-complete to find the name of a method, but I used to then have
5377 tab-complete to find the name of a method, but I used to then have
5363 to go to the beginning of the line to put a ? if I wanted more
5378 to go to the beginning of the line to put a ? if I wanted more
5364 info. Now I can just add the ? and hit return. Convenient.
5379 info. Now I can just add the ? and hit return. Convenient.
5365
5380
5366 2001-11-02 Fernando Perez <fperez@colorado.edu>
5381 2001-11-02 Fernando Perez <fperez@colorado.edu>
5367
5382
5368 * Python version check (>=2.1) added.
5383 * Python version check (>=2.1) added.
5369
5384
5370 * Added LazyPython documentation. At this point the docs are quite
5385 * Added LazyPython documentation. At this point the docs are quite
5371 a mess. A cleanup is in order.
5386 a mess. A cleanup is in order.
5372
5387
5373 * Auto-installer created. For some bizarre reason, the zipfiles
5388 * Auto-installer created. For some bizarre reason, the zipfiles
5374 module isn't working on my system. So I made a tar version
5389 module isn't working on my system. So I made a tar version
5375 (hopefully the command line options in various systems won't kill
5390 (hopefully the command line options in various systems won't kill
5376 me).
5391 me).
5377
5392
5378 * Fixes to Struct in genutils. Now all dictionary-like methods are
5393 * Fixes to Struct in genutils. Now all dictionary-like methods are
5379 protected (reasonably).
5394 protected (reasonably).
5380
5395
5381 * Added pager function to genutils and changed ? to print usage
5396 * Added pager function to genutils and changed ? to print usage
5382 note through it (it was too long).
5397 note through it (it was too long).
5383
5398
5384 * Added the LazyPython functionality. Works great! I changed the
5399 * Added the LazyPython functionality. Works great! I changed the
5385 auto-quote escape to ';', it's on home row and next to '. But
5400 auto-quote escape to ';', it's on home row and next to '. But
5386 both auto-quote and auto-paren (still /) escapes are command-line
5401 both auto-quote and auto-paren (still /) escapes are command-line
5387 parameters.
5402 parameters.
5388
5403
5389
5404
5390 2001-11-01 Fernando Perez <fperez@colorado.edu>
5405 2001-11-01 Fernando Perez <fperez@colorado.edu>
5391
5406
5392 * Version changed to 0.0.7. Fairly large change: configuration now
5407 * Version changed to 0.0.7. Fairly large change: configuration now
5393 is all stored in a directory, by default .ipython. There, all
5408 is all stored in a directory, by default .ipython. There, all
5394 config files have normal looking names (not .names)
5409 config files have normal looking names (not .names)
5395
5410
5396 * Version 0.0.6 Released first to Lucas and Archie as a test
5411 * Version 0.0.6 Released first to Lucas and Archie as a test
5397 run. Since it's the first 'semi-public' release, change version to
5412 run. Since it's the first 'semi-public' release, change version to
5398 > 0.0.6 for any changes now.
5413 > 0.0.6 for any changes now.
5399
5414
5400 * Stuff I had put in the ipplib.py changelog:
5415 * Stuff I had put in the ipplib.py changelog:
5401
5416
5402 Changes to InteractiveShell:
5417 Changes to InteractiveShell:
5403
5418
5404 - Made the usage message a parameter.
5419 - Made the usage message a parameter.
5405
5420
5406 - Require the name of the shell variable to be given. It's a bit
5421 - Require the name of the shell variable to be given. It's a bit
5407 of a hack, but allows the name 'shell' not to be hardwire in the
5422 of a hack, but allows the name 'shell' not to be hardwire in the
5408 magic (@) handler, which is problematic b/c it requires
5423 magic (@) handler, which is problematic b/c it requires
5409 polluting the global namespace with 'shell'. This in turn is
5424 polluting the global namespace with 'shell'. This in turn is
5410 fragile: if a user redefines a variable called shell, things
5425 fragile: if a user redefines a variable called shell, things
5411 break.
5426 break.
5412
5427
5413 - magic @: all functions available through @ need to be defined
5428 - magic @: all functions available through @ need to be defined
5414 as magic_<name>, even though they can be called simply as
5429 as magic_<name>, even though they can be called simply as
5415 @<name>. This allows the special command @magic to gather
5430 @<name>. This allows the special command @magic to gather
5416 information automatically about all existing magic functions,
5431 information automatically about all existing magic functions,
5417 even if they are run-time user extensions, by parsing the shell
5432 even if they are run-time user extensions, by parsing the shell
5418 instance __dict__ looking for special magic_ names.
5433 instance __dict__ looking for special magic_ names.
5419
5434
5420 - mainloop: added *two* local namespace parameters. This allows
5435 - mainloop: added *two* local namespace parameters. This allows
5421 the class to differentiate between parameters which were there
5436 the class to differentiate between parameters which were there
5422 before and after command line initialization was processed. This
5437 before and after command line initialization was processed. This
5423 way, later @who can show things loaded at startup by the
5438 way, later @who can show things loaded at startup by the
5424 user. This trick was necessary to make session saving/reloading
5439 user. This trick was necessary to make session saving/reloading
5425 really work: ideally after saving/exiting/reloading a session,
5440 really work: ideally after saving/exiting/reloading a session,
5426 *everythin* should look the same, including the output of @who. I
5441 *everythin* should look the same, including the output of @who. I
5427 was only able to make this work with this double namespace
5442 was only able to make this work with this double namespace
5428 trick.
5443 trick.
5429
5444
5430 - added a header to the logfile which allows (almost) full
5445 - added a header to the logfile which allows (almost) full
5431 session restoring.
5446 session restoring.
5432
5447
5433 - prepend lines beginning with @ or !, with a and log
5448 - prepend lines beginning with @ or !, with a and log
5434 them. Why? !lines: may be useful to know what you did @lines:
5449 them. Why? !lines: may be useful to know what you did @lines:
5435 they may affect session state. So when restoring a session, at
5450 they may affect session state. So when restoring a session, at
5436 least inform the user of their presence. I couldn't quite get
5451 least inform the user of their presence. I couldn't quite get
5437 them to properly re-execute, but at least the user is warned.
5452 them to properly re-execute, but at least the user is warned.
5438
5453
5439 * Started ChangeLog.
5454 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now