##// END OF EJS Templates
implement callable (i.e. straight python) aliases and _sh shadow namespace
vivainio -
Show More
@@ -0,0 +1,1 b''
1 """ Shadow namespace """ No newline at end of file
@@ -1,548 +1,551 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Tools for inspecting Python objects.
3 3
4 4 Uses syntax highlighting for presenting the various information elements.
5 5
6 6 Similar in spirit to the inspect module, but all calls take a name argument to
7 7 reference the name under which an object is being read.
8 8
9 $Id: OInspect.py 1850 2006-10-28 19:48:13Z fptest $
9 $Id: OInspect.py 2463 2007-06-27 22:51:16Z vivainio $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
14 14 #
15 15 # Distributed under the terms of the BSD License. The full license is in
16 16 # the file COPYING, distributed as part of this software.
17 17 #*****************************************************************************
18 18
19 19 from IPython import Release
20 20 __author__ = '%s <%s>' % Release.authors['Fernando']
21 21 __license__ = Release.license
22 22
23 23 __all__ = ['Inspector','InspectColors']
24 24
25 25 # stdlib modules
26 26 import __builtin__
27 27 import inspect
28 28 import linecache
29 29 import string
30 30 import StringIO
31 31 import types
32 32 import os
33 33 import sys
34 34 # IPython's own
35 35 from IPython import PyColorize
36 36 from IPython.genutils import page,indent,Term,mkdict
37 37 from IPython.Itpl import itpl
38 38 from IPython.wildcard import list_namespace
39 39 from IPython.ColorANSI import *
40 40
41 41 #****************************************************************************
42 42 # HACK!!! This is a crude fix for bugs in python 2.3's inspect module. We
43 43 # simply monkeypatch inspect with code copied from python 2.4.
44 44 if sys.version_info[:2] == (2,3):
45 45 from inspect import ismodule, getabsfile, modulesbyfile
46 46 def getmodule(object):
47 47 """Return the module an object was defined in, or None if not found."""
48 48 if ismodule(object):
49 49 return object
50 50 if hasattr(object, '__module__'):
51 51 return sys.modules.get(object.__module__)
52 52 try:
53 53 file = getabsfile(object)
54 54 except TypeError:
55 55 return None
56 56 if file in modulesbyfile:
57 57 return sys.modules.get(modulesbyfile[file])
58 58 for module in sys.modules.values():
59 59 if hasattr(module, '__file__'):
60 60 modulesbyfile[
61 61 os.path.realpath(
62 62 getabsfile(module))] = module.__name__
63 63 if file in modulesbyfile:
64 64 return sys.modules.get(modulesbyfile[file])
65 65 main = sys.modules['__main__']
66 66 if not hasattr(object, '__name__'):
67 67 return None
68 68 if hasattr(main, object.__name__):
69 69 mainobject = getattr(main, object.__name__)
70 70 if mainobject is object:
71 71 return main
72 72 builtin = sys.modules['__builtin__']
73 73 if hasattr(builtin, object.__name__):
74 74 builtinobject = getattr(builtin, object.__name__)
75 75 if builtinobject is object:
76 76 return builtin
77 77
78 78 inspect.getmodule = getmodule
79 79
80 80 #****************************************************************************
81 81 # Builtin color schemes
82 82
83 83 Colors = TermColors # just a shorthand
84 84
85 85 # Build a few color schemes
86 86 NoColor = ColorScheme(
87 87 'NoColor',{
88 88 'header' : Colors.NoColor,
89 89 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
90 90 } )
91 91
92 92 LinuxColors = ColorScheme(
93 93 'Linux',{
94 94 'header' : Colors.LightRed,
95 95 'normal' : Colors.Normal # color off (usu. Colors.Normal)
96 96 } )
97 97
98 98 LightBGColors = ColorScheme(
99 99 'LightBG',{
100 100 'header' : Colors.Red,
101 101 'normal' : Colors.Normal # color off (usu. Colors.Normal)
102 102 } )
103 103
104 104 # Build table of color schemes (needed by the parser)
105 105 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
106 106 'Linux')
107 107
108 108 #****************************************************************************
109 109 # Auxiliary functions
110 110 def getdoc(obj):
111 111 """Stable wrapper around inspect.getdoc.
112 112
113 113 This can't crash because of attribute problems.
114 114
115 115 It also attempts to call a getdoc() method on the given object. This
116 116 allows objects which provide their docstrings via non-standard mechanisms
117 117 (like Pyro proxies) to still be inspected by ipython's ? system."""
118 118
119 119 ds = None # default return value
120 120 try:
121 121 ds = inspect.getdoc(obj)
122 122 except:
123 123 # Harden against an inspect failure, which can occur with
124 124 # SWIG-wrapped extensions.
125 125 pass
126 126 # Allow objects to offer customized documentation via a getdoc method:
127 127 try:
128 128 ds2 = obj.getdoc()
129 129 except:
130 130 pass
131 131 else:
132 132 # if we get extra info, we add it to the normal docstring.
133 133 if ds is None:
134 134 ds = ds2
135 135 else:
136 136 ds = '%s\n%s' % (ds,ds2)
137 137 return ds
138 138
139 139 def getsource(obj,is_binary=False):
140 140 """Wrapper around inspect.getsource.
141 141
142 142 This can be modified by other projects to provide customized source
143 143 extraction.
144 144
145 145 Inputs:
146 146
147 147 - obj: an object whose source code we will attempt to extract.
148 148
149 149 Optional inputs:
150 150
151 151 - is_binary: whether the object is known to come from a binary source.
152 152 This implementation will skip returning any output for binary objects, but
153 153 custom extractors may know how to meaninfully process them."""
154 154
155 155 if is_binary:
156 156 return None
157 157 else:
158 158 return inspect.getsource(obj)
159 159
160 160 #****************************************************************************
161 161 # Class definitions
162 162
163 163 class myStringIO(StringIO.StringIO):
164 164 """Adds a writeln method to normal StringIO."""
165 165 def writeln(self,*arg,**kw):
166 166 """Does a write() and then a write('\n')"""
167 167 self.write(*arg,**kw)
168 168 self.write('\n')
169 169
170 170 class Inspector:
171 171 def __init__(self,color_table,code_color_table,scheme,
172 172 str_detail_level=0):
173 173 self.color_table = color_table
174 174 self.parser = PyColorize.Parser(code_color_table,out='str')
175 175 self.format = self.parser.format
176 176 self.str_detail_level = str_detail_level
177 177 self.set_active_scheme(scheme)
178 178
179 179 def __getargspec(self,obj):
180 180 """Get the names and default values of a function's arguments.
181 181
182 182 A tuple of four things is returned: (args, varargs, varkw, defaults).
183 183 'args' is a list of the argument names (it may contain nested lists).
184 184 'varargs' and 'varkw' are the names of the * and ** arguments or None.
185 185 'defaults' is an n-tuple of the default values of the last n arguments.
186 186
187 187 Modified version of inspect.getargspec from the Python Standard
188 188 Library."""
189 189
190 190 if inspect.isfunction(obj):
191 191 func_obj = obj
192 192 elif inspect.ismethod(obj):
193 193 func_obj = obj.im_func
194 194 else:
195 195 raise TypeError, 'arg is not a Python function'
196 196 args, varargs, varkw = inspect.getargs(func_obj.func_code)
197 197 return args, varargs, varkw, func_obj.func_defaults
198 198
199 199 def __getdef(self,obj,oname=''):
200 200 """Return the definition header for any callable object.
201 201
202 202 If any exception is generated, None is returned instead and the
203 203 exception is suppressed."""
204 204
205 205 try:
206 206 return oname + inspect.formatargspec(*self.__getargspec(obj))
207 207 except:
208 208 return None
209 209
210 210 def __head(self,h):
211 211 """Return a header string with proper colors."""
212 212 return '%s%s%s' % (self.color_table.active_colors.header,h,
213 213 self.color_table.active_colors.normal)
214 214
215 215 def set_active_scheme(self,scheme):
216 216 self.color_table.set_active_scheme(scheme)
217 217 self.parser.color_table.set_active_scheme(scheme)
218 218
219 219 def noinfo(self,msg,oname):
220 220 """Generic message when no information is found."""
221 221 print 'No %s found' % msg,
222 222 if oname:
223 223 print 'for %s' % oname
224 224 else:
225 225 print
226 226
227 227 def pdef(self,obj,oname=''):
228 228 """Print the definition header for any callable object.
229 229
230 230 If the object is a class, print the constructor information."""
231 231
232 232 if not callable(obj):
233 233 print 'Object is not callable.'
234 234 return
235 235
236 236 header = ''
237 237 if type(obj) is types.ClassType:
238 238 header = self.__head('Class constructor information:\n')
239 239 obj = obj.__init__
240 240 elif type(obj) is types.InstanceType:
241 241 obj = obj.__call__
242 242
243 243 output = self.__getdef(obj,oname)
244 244 if output is None:
245 245 self.noinfo('definition header',oname)
246 246 else:
247 247 print >>Term.cout, header,self.format(output),
248 248
249 249 def pdoc(self,obj,oname='',formatter = None):
250 250 """Print the docstring for any object.
251 251
252 252 Optional:
253 253 -formatter: a function to run the docstring through for specially
254 254 formatted docstrings."""
255 255
256 256 head = self.__head # so that itpl can find it even if private
257 257 ds = getdoc(obj)
258 258 if formatter:
259 259 ds = formatter(ds)
260 260 if type(obj) is types.ClassType:
261 261 init_ds = getdoc(obj.__init__)
262 262 output = itpl('$head("Class Docstring:")\n'
263 263 '$indent(ds)\n'
264 264 '$head("Constructor Docstring"):\n'
265 265 '$indent(init_ds)')
266 266 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
267 267 call_ds = getdoc(obj.__call__)
268 268 if call_ds:
269 269 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
270 270 '$head("Calling Docstring:")\n$indent(call_ds)')
271 271 else:
272 272 output = ds
273 273 else:
274 274 output = ds
275 275 if output is None:
276 276 self.noinfo('documentation',oname)
277 277 return
278 278 page(output)
279 279
280 280 def psource(self,obj,oname=''):
281 281 """Print the source code for an object."""
282 282
283 283 # Flush the source cache because inspect can return out-of-date source
284 284 linecache.checkcache()
285 285 try:
286 286 src = getsource(obj)
287 287 except:
288 288 self.noinfo('source',oname)
289 289 else:
290 290 page(self.format(src))
291 291
292 292 def pfile(self,obj,oname=''):
293 293 """Show the whole file where an object was defined."""
294 294 try:
295 295 sourcelines,lineno = inspect.getsourcelines(obj)
296 296 except:
297 297 self.noinfo('file',oname)
298 298 else:
299 299 # run contents of file through pager starting at line
300 300 # where the object is defined
301 301 ofile = inspect.getabsfile(obj)
302 302
303 303 if (ofile.endswith('.so') or ofile.endswith('.dll')):
304 304 print 'File %r is binary, not printing.' % ofile
305 305 elif not os.path.isfile(ofile):
306 306 print 'File %r does not exist, not printing.' % ofile
307 307 else:
308 308 # Print only text files, not extension binaries.
309 309 page(self.format(open(ofile).read()),lineno)
310 310 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
311 311
312 312 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
313 313 """Show detailed information about an object.
314 314
315 315 Optional arguments:
316 316
317 317 - oname: name of the variable pointing to the object.
318 318
319 319 - formatter: special formatter for docstrings (see pdoc)
320 320
321 321 - info: a structure with some information fields which may have been
322 322 precomputed already.
323 323
324 324 - detail_level: if set to 1, more information is given.
325 325 """
326 326
327 327 obj_type = type(obj)
328 328
329 329 header = self.__head
330 330 if info is None:
331 331 ismagic = 0
332 332 isalias = 0
333 333 ospace = ''
334 334 else:
335 335 ismagic = info.ismagic
336 336 isalias = info.isalias
337 337 ospace = info.namespace
338 338 # Get docstring, special-casing aliases:
339 339 if isalias:
340 if not callable(obj):
340 341 ds = "Alias to the system command:\n %s" % obj[1]
341 342 else:
343 ds = "Alias to " + str(obj)
344 else:
342 345 ds = getdoc(obj)
343 346 if ds is None:
344 347 ds = '<no docstring>'
345 348 if formatter is not None:
346 349 ds = formatter(ds)
347 350
348 351 # store output in a list which gets joined with \n at the end.
349 352 out = myStringIO()
350 353
351 354 string_max = 200 # max size of strings to show (snipped if longer)
352 355 shalf = int((string_max -5)/2)
353 356
354 357 if ismagic:
355 358 obj_type_name = 'Magic function'
356 359 elif isalias:
357 360 obj_type_name = 'System alias'
358 361 else:
359 362 obj_type_name = obj_type.__name__
360 363 out.writeln(header('Type:\t\t')+obj_type_name)
361 364
362 365 try:
363 366 bclass = obj.__class__
364 367 out.writeln(header('Base Class:\t')+str(bclass))
365 368 except: pass
366 369
367 370 # String form, but snip if too long in ? form (full in ??)
368 371 if detail_level >= self.str_detail_level:
369 372 try:
370 373 ostr = str(obj)
371 374 str_head = 'String Form:'
372 375 if not detail_level and len(ostr)>string_max:
373 376 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
374 377 ostr = ("\n" + " " * len(str_head.expandtabs())).\
375 378 join(map(string.strip,ostr.split("\n")))
376 379 if ostr.find('\n') > -1:
377 380 # Print multi-line strings starting at the next line.
378 381 str_sep = '\n'
379 382 else:
380 383 str_sep = '\t'
381 384 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
382 385 except:
383 386 pass
384 387
385 388 if ospace:
386 389 out.writeln(header('Namespace:\t')+ospace)
387 390
388 391 # Length (for strings and lists)
389 392 try:
390 393 length = str(len(obj))
391 394 out.writeln(header('Length:\t\t')+length)
392 395 except: pass
393 396
394 397 # Filename where object was defined
395 398 binary_file = False
396 399 try:
397 400 fname = inspect.getabsfile(obj)
398 401 if fname.endswith('<string>'):
399 402 fname = 'Dynamically generated function. No source code available.'
400 403 if (fname.endswith('.so') or fname.endswith('.dll') or
401 404 not os.path.isfile(fname)):
402 405 binary_file = True
403 406 out.writeln(header('File:\t\t')+fname)
404 407 except:
405 408 # if anything goes wrong, we don't want to show source, so it's as
406 409 # if the file was binary
407 410 binary_file = True
408 411
409 412 # reconstruct the function definition and print it:
410 413 defln = self.__getdef(obj,oname)
411 414 if defln:
412 415 out.write(header('Definition:\t')+self.format(defln))
413 416
414 417 # Docstrings only in detail 0 mode, since source contains them (we
415 418 # avoid repetitions). If source fails, we add them back, see below.
416 419 if ds and detail_level == 0:
417 420 out.writeln(header('Docstring:\n') + indent(ds))
418 421
419 422
420 423 # Original source code for any callable
421 424 if detail_level:
422 425 # Flush the source cache because inspect can return out-of-date source
423 426 linecache.checkcache()
424 427 source_success = False
425 428 try:
426 429 source = self.format(getsource(obj,binary_file))
427 430 if source:
428 431 out.write(header('Source:\n')+source.rstrip())
429 432 source_success = True
430 433 except Exception, msg:
431 434 pass
432 435
433 436 if ds and not source_success:
434 437 out.writeln(header('Docstring [source file open failed]:\n')
435 438 + indent(ds))
436 439
437 440 # Constructor docstring for classes
438 441 if obj_type is types.ClassType:
439 442 # reconstruct the function definition and print it:
440 443 try:
441 444 obj_init = obj.__init__
442 445 except AttributeError:
443 446 init_def = init_ds = None
444 447 else:
445 448 init_def = self.__getdef(obj_init,oname)
446 449 init_ds = getdoc(obj_init)
447 450
448 451 if init_def or init_ds:
449 452 out.writeln(header('\nConstructor information:'))
450 453 if init_def:
451 454 out.write(header('Definition:\t')+ self.format(init_def))
452 455 if init_ds:
453 456 out.writeln(header('Docstring:\n') + indent(init_ds))
454 457 # and class docstring for instances:
455 458 elif obj_type is types.InstanceType:
456 459
457 460 # First, check whether the instance docstring is identical to the
458 461 # class one, and print it separately if they don't coincide. In
459 462 # most cases they will, but it's nice to print all the info for
460 463 # objects which use instance-customized docstrings.
461 464 if ds:
462 465 class_ds = getdoc(obj.__class__)
463 466 if class_ds and ds != class_ds:
464 467 out.writeln(header('Class Docstring:\n') +
465 468 indent(class_ds))
466 469
467 470 # Next, try to show constructor docstrings
468 471 try:
469 472 init_ds = getdoc(obj.__init__)
470 473 except AttributeError:
471 474 init_ds = None
472 475 if init_ds:
473 476 out.writeln(header('Constructor Docstring:\n') +
474 477 indent(init_ds))
475 478
476 479 # Call form docstring for callable instances
477 480 if hasattr(obj,'__call__'):
478 481 out.writeln(header('Callable:\t')+'Yes')
479 482 call_def = self.__getdef(obj.__call__,oname)
480 483 if call_def is None:
481 484 out.write(header('Call def:\t')+
482 485 'Calling definition not available.')
483 486 else:
484 487 out.write(header('Call def:\t')+self.format(call_def))
485 488 call_ds = getdoc(obj.__call__)
486 489 if call_ds:
487 490 out.writeln(header('Call docstring:\n') + indent(call_ds))
488 491
489 492 # Finally send to printer/pager
490 493 output = out.getvalue()
491 494 if output:
492 495 page(output)
493 496 # end pinfo
494 497
495 498 def psearch(self,pattern,ns_table,ns_search=[],
496 499 ignore_case=False,show_all=False):
497 500 """Search namespaces with wildcards for objects.
498 501
499 502 Arguments:
500 503
501 504 - pattern: string containing shell-like wildcards to use in namespace
502 505 searches and optionally a type specification to narrow the search to
503 506 objects of that type.
504 507
505 508 - ns_table: dict of name->namespaces for search.
506 509
507 510 Optional arguments:
508 511
509 512 - ns_search: list of namespace names to include in search.
510 513
511 514 - ignore_case(False): make the search case-insensitive.
512 515
513 516 - show_all(False): show all names, including those starting with
514 517 underscores.
515 518 """
516 519 # defaults
517 520 type_pattern = 'all'
518 521 filter = ''
519 522
520 523 cmds = pattern.split()
521 524 len_cmds = len(cmds)
522 525 if len_cmds == 1:
523 526 # Only filter pattern given
524 527 filter = cmds[0]
525 528 elif len_cmds == 2:
526 529 # Both filter and type specified
527 530 filter,type_pattern = cmds
528 531 else:
529 532 raise ValueError('invalid argument string for psearch: <%s>' %
530 533 pattern)
531 534
532 535 # filter search namespaces
533 536 for name in ns_search:
534 537 if name not in ns_table:
535 538 raise ValueError('invalid namespace <%s>. Valid names: %s' %
536 539 (name,ns_table.keys()))
537 540
538 541 #print 'type_pattern:',type_pattern # dbg
539 542 search_result = []
540 543 for ns_name in ns_search:
541 544 ns = ns_table[ns_name]
542 545 tmp_res = list(list_namespace(ns,type_pattern,filter,
543 546 ignore_case=ignore_case,
544 547 show_all=show_all))
545 548 search_result.extend(tmp_res)
546 549 search_result.sort()
547 550
548 551 page('\n'.join(search_result))
@@ -1,457 +1,463 b''
1 1 ''' IPython customization API
2 2
3 3 Your one-stop module for configuring & extending ipython
4 4
5 5 The API will probably break when ipython 1.0 is released, but so
6 6 will the other configuration method (rc files).
7 7
8 8 All names prefixed by underscores are for internal use, not part
9 9 of the public api.
10 10
11 11 Below is an example that you can just put to a module and import from ipython.
12 12
13 13 A good practice is to install the config script below as e.g.
14 14
15 15 ~/.ipython/my_private_conf.py
16 16
17 17 And do
18 18
19 19 import_mod my_private_conf
20 20
21 21 in ~/.ipython/ipythonrc
22 22
23 23 That way the module is imported at startup and you can have all your
24 24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
25 25 stuff) in there.
26 26
27 27 -----------------------------------------------
28 28 import IPython.ipapi
29 29 ip = IPython.ipapi.get()
30 30
31 31 def ankka_f(self, arg):
32 32 print "Ankka",self,"says uppercase:",arg.upper()
33 33
34 34 ip.expose_magic("ankka",ankka_f)
35 35
36 36 ip.magic('alias sayhi echo "Testing, hi ok"')
37 37 ip.magic('alias helloworld echo "Hello world"')
38 38 ip.system('pwd')
39 39
40 40 ip.ex('import re')
41 41 ip.ex("""
42 42 def funcci(a,b):
43 43 print a+b
44 44 print funcci(3,4)
45 45 """)
46 46 ip.ex("funcci(348,9)")
47 47
48 48 def jed_editor(self,filename, linenum=None):
49 49 print "Calling my own editor, jed ... via hook!"
50 50 import os
51 51 if linenum is None: linenum = 0
52 52 os.system('jed +%d %s' % (linenum, filename))
53 53 print "exiting jed"
54 54
55 55 ip.set_hook('editor',jed_editor)
56 56
57 57 o = ip.options
58 58 o.autocall = 2 # FULL autocall mode
59 59
60 60 print "done!"
61 61 '''
62 62
63 63 # stdlib imports
64 64 import __builtin__
65 65 import sys
66 66
67 67 # our own
68 68 #from IPython.genutils import warn,error
69 69
70 70 class TryNext(Exception):
71 71 """Try next hook exception.
72 72
73 73 Raise this in your hook function to indicate that the next hook handler
74 74 should be used to handle the operation. If you pass arguments to the
75 75 constructor those arguments will be used by the next hook instead of the
76 76 original ones.
77 77 """
78 78
79 79 def __init__(self, *args, **kwargs):
80 80 self.args = args
81 81 self.kwargs = kwargs
82 82
83 83 class IPyAutocall:
84 84 """ Instances of this class are always autocalled
85 85
86 86 This happens regardless of 'autocall' variable state. Use this to
87 87 develop macro-like mechanisms.
88 88 """
89 89
90 90 def set_ip(self,ip):
91 91 """ Will be used to set _ip point to current ipython instance b/f call
92 92
93 93 Override this method if you don't want this to happen.
94 94
95 95 """
96 96 self._ip = ip
97 97
98 98
99 99 # contains the most recently instantiated IPApi
100 100
101 101 class IPythonNotRunning:
102 102 """Dummy do-nothing class.
103 103
104 104 Instances of this class return a dummy attribute on all accesses, which
105 105 can be called and warns. This makes it easier to write scripts which use
106 106 the ipapi.get() object for informational purposes to operate both with and
107 107 without ipython. Obviously code which uses the ipython object for
108 108 computations will not work, but this allows a wider range of code to
109 109 transparently work whether ipython is being used or not."""
110 110
111 111 def __init__(self,warn=True):
112 112 if warn:
113 113 self.dummy = self._dummy_warn
114 114 else:
115 115 self.dummy = self._dummy_silent
116 116
117 117 def __str__(self):
118 118 return "<IPythonNotRunning>"
119 119
120 120 __repr__ = __str__
121 121
122 122 def __getattr__(self,name):
123 123 return self.dummy
124 124
125 125 def _dummy_warn(self,*args,**kw):
126 126 """Dummy function, which doesn't do anything but warn."""
127 127
128 128 print ("IPython is not running, this is a dummy no-op function")
129 129
130 130 def _dummy_silent(self,*args,**kw):
131 131 """Dummy function, which doesn't do anything and emits no warnings."""
132 132 pass
133 133
134 134 _recent = None
135 135
136 136
137 137 def get(allow_dummy=False,dummy_warn=True):
138 138 """Get an IPApi object.
139 139
140 140 If allow_dummy is true, returns an instance of IPythonNotRunning
141 141 instead of None if not running under IPython.
142 142
143 143 If dummy_warn is false, the dummy instance will be completely silent.
144 144
145 145 Running this should be the first thing you do when writing extensions that
146 146 can be imported as normal modules. You can then direct all the
147 147 configuration operations against the returned object.
148 148 """
149 149 global _recent
150 150 if allow_dummy and not _recent:
151 151 _recent = IPythonNotRunning(dummy_warn)
152 152 return _recent
153 153
154 154 class IPApi:
155 155 """ The actual API class for configuring IPython
156 156
157 157 You should do all of the IPython configuration by getting an IPApi object
158 158 with IPython.ipapi.get() and using the attributes and methods of the
159 159 returned object."""
160 160
161 161 def __init__(self,ip):
162 162
163 163 # All attributes exposed here are considered to be the public API of
164 164 # IPython. As needs dictate, some of these may be wrapped as
165 165 # properties.
166 166
167 167 self.magic = ip.ipmagic
168 168
169 169 self.system = ip.system
170 170
171 171 self.set_hook = ip.set_hook
172 172
173 173 self.set_custom_exc = ip.set_custom_exc
174 174
175 175 self.user_ns = ip.user_ns
176 176
177 177 self.set_crash_handler = ip.set_crash_handler
178 178
179 179 # Session-specific data store, which can be used to store
180 180 # data that should persist through the ipython session.
181 181 self.meta = ip.meta
182 182
183 183 # The ipython instance provided
184 184 self.IP = ip
185 185
186 186 self.extensions = {}
187 187 global _recent
188 188 _recent = self
189 189
190 190 # Use a property for some things which are added to the instance very
191 191 # late. I don't have time right now to disentangle the initialization
192 192 # order issues, so a property lets us delay item extraction while
193 193 # providing a normal attribute API.
194 194 def get_db(self):
195 195 """A handle to persistent dict-like database (a PickleShareDB object)"""
196 196 return self.IP.db
197 197
198 198 db = property(get_db,None,None,get_db.__doc__)
199 199
200 200 def get_options(self):
201 201 """All configurable variables."""
202 202
203 203 # catch typos by disabling new attribute creation. If new attr creation
204 204 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
205 205 # for the received rc struct.
206 206
207 207 self.IP.rc.allow_new_attr(False)
208 208 return self.IP.rc
209 209
210 210 options = property(get_options,None,None,get_options.__doc__)
211 211
212 212 def expose_magic(self,magicname, func):
213 213 ''' Expose own function as magic function for ipython
214 214
215 215 def foo_impl(self,parameter_s=''):
216 216 """My very own magic!. (Use docstrings, IPython reads them)."""
217 217 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
218 218 print 'The self object is:',self
219 219
220 220 ipapi.expose_magic("foo",foo_impl)
221 221 '''
222 222
223 223 import new
224 224 im = new.instancemethod(func,self.IP, self.IP.__class__)
225 225 setattr(self.IP, "magic_" + magicname, im)
226 226
227 227 def ex(self,cmd):
228 228 """ Execute a normal python statement in user namespace """
229 229 exec cmd in self.user_ns
230 230
231 231 def ev(self,expr):
232 232 """ Evaluate python expression expr in user namespace
233 233
234 234 Returns the result of evaluation"""
235 235 return eval(expr,self.user_ns)
236 236
237 237 def runlines(self,lines):
238 238 """ Run the specified lines in interpreter, honoring ipython directives.
239 239
240 240 This allows %magic and !shell escape notations.
241 241
242 242 Takes either all lines in one string or list of lines.
243 243 """
244 244 if isinstance(lines,basestring):
245 245 self.IP.runlines(lines)
246 246 else:
247 247 self.IP.runlines('\n'.join(lines))
248 248
249 249 def to_user_ns(self,vars, interactive = True):
250 250 """Inject a group of variables into the IPython user namespace.
251 251
252 252 Inputs:
253 253
254 254 - vars: string with variable names separated by whitespace
255 255
256 256 - interactive: if True (default), the var will be listed with
257 257 %whos et. al.
258 258
259 259 This utility routine is meant to ease interactive debugging work,
260 260 where you want to easily propagate some internal variable in your code
261 261 up to the interactive namespace for further exploration.
262 262
263 263 When you run code via %run, globals in your script become visible at
264 264 the interactive prompt, but this doesn't happen for locals inside your
265 265 own functions and methods. Yet when debugging, it is common to want
266 266 to explore some internal variables further at the interactive propmt.
267 267
268 268 Examples:
269 269
270 270 To use this, you first must obtain a handle on the ipython object as
271 271 indicated above, via:
272 272
273 273 import IPython.ipapi
274 274 ip = IPython.ipapi.get()
275 275
276 276 Once this is done, inside a routine foo() where you want to expose
277 277 variables x and y, you do the following:
278 278
279 279 def foo():
280 280 ...
281 281 x = your_computation()
282 282 y = something_else()
283 283
284 284 # This pushes x and y to the interactive prompt immediately, even
285 285 # if this routine crashes on the next line after:
286 286 ip.to_user_ns('x y')
287 287 ...
288 288 # return
289 289
290 290 If you need to rename variables, just use ip.user_ns with dict
291 291 and update:
292 292
293 293 # exposes variables 'foo' as 'x' and 'bar' as 'y' in IPython
294 294 # user namespace
295 295 ip.user_ns.update(dict(x=foo,y=bar))
296 296 """
297 297
298 298 # print 'vars given:',vars # dbg
299 299 # Get the caller's frame to evaluate the given names in
300 300 cf = sys._getframe(1)
301 301
302 302 user_ns = self.user_ns
303 303 config_ns = self.IP.user_config_ns
304 304 for name in vars.split():
305 305 try:
306 306 val = eval(name,cf.f_globals,cf.f_locals)
307 307 user_ns[name] = val
308 308 if not interactive:
309 309 config_ns[name] = val
310 310 else:
311 311 config_ns.pop(name,None)
312 312 except:
313 313 print ('could not get var. %s from %s' %
314 314 (name,cf.f_code.co_name))
315 315
316 316 def expand_alias(self,line):
317 317 """ Expand an alias in the command line
318 318
319 319 Returns the provided command line, possibly with the first word
320 320 (command) translated according to alias expansion rules.
321 321
322 322 [ipython]|16> _ip.expand_aliases("np myfile.txt")
323 323 <16> 'q:/opt/np/notepad++.exe myfile.txt'
324 324 """
325 325
326 326 pre,fn,rest = self.IP.split_user_input(line)
327 327 res = pre + self.IP.expand_aliases(fn,rest)
328 328 return res
329 329
330 330 def defalias(self, name, cmd):
331 331 """ Define a new alias
332 332
333 333 _ip.defalias('bb','bldmake bldfiles')
334 334
335 335 Creates a new alias named 'bb' in ipython user namespace
336 336 """
337 337
338 if callable(cmd):
339 self.IP.alias_table[name] = cmd
340 import IPython.shawodns
341 setattr(IPython.shadowns, name,cmd)
342 return
343
338 344
339 345 nargs = cmd.count('%s')
340 346 if nargs>0 and cmd.find('%l')>=0:
341 347 raise Exception('The %s and %l specifiers are mutually exclusive '
342 348 'in alias definitions.')
343 349
344 350 else: # all looks OK
345 351 self.IP.alias_table[name] = (nargs,cmd)
346 352
347 353 def defmacro(self, *args):
348 354 """ Define a new macro
349 355
350 356 2 forms of calling:
351 357
352 358 mac = _ip.defmacro('print "hello"\nprint "world"')
353 359
354 360 (doesn't put the created macro on user namespace)
355 361
356 362 _ip.defmacro('build', 'bldmake bldfiles\nabld build winscw udeb')
357 363
358 364 (creates a macro named 'build' in user namespace)
359 365 """
360 366
361 367 import IPython.macro
362 368
363 369 if len(args) == 1:
364 370 return IPython.macro.Macro(args[0])
365 371 elif len(args) == 2:
366 372 self.user_ns[args[0]] = IPython.macro.Macro(args[1])
367 373 else:
368 374 return Exception("_ip.defmacro must be called with 1 or 2 arguments")
369 375
370 376 def set_next_input(self, s):
371 377 """ Sets the 'default' input string for the next command line.
372 378
373 379 Requires readline.
374 380
375 381 Example:
376 382
377 383 [D:\ipython]|1> _ip.set_next_input("Hello Word")
378 384 [D:\ipython]|2> Hello Word_ # cursor is here
379 385 """
380 386
381 387 self.IP.rl_next_input = s
382 388
383 389 def load(self, mod):
384 390 if mod in self.extensions:
385 391 # just to make sure we don't init it twice
386 392 # note that if you 'load' a module that has already been
387 393 # imported, init_ipython gets run anyway
388 394
389 395 return self.extensions[mod]
390 396 __import__(mod)
391 397 m = sys.modules[mod]
392 398 if hasattr(m,'init_ipython'):
393 399 m.init_ipython(self)
394 400 self.extensions[mod] = m
395 401 return m
396 402
397 403
398 404 def launch_new_instance(user_ns = None):
399 405 """ Make and start a new ipython instance.
400 406
401 407 This can be called even without having an already initialized
402 408 ipython session running.
403 409
404 410 This is also used as the egg entry point for the 'ipython' script.
405 411
406 412 """
407 413 ses = make_session(user_ns)
408 414 ses.mainloop()
409 415
410 416
411 417 def make_user_ns(user_ns = None):
412 418 """Return a valid user interactive namespace.
413 419
414 420 This builds a dict with the minimal information needed to operate as a
415 421 valid IPython user namespace, which you can pass to the various embedding
416 422 classes in ipython.
417 423 """
418 424
419 425 if user_ns is None:
420 426 # Set __name__ to __main__ to better match the behavior of the
421 427 # normal interpreter.
422 428 user_ns = {'__name__' :'__main__',
423 429 '__builtins__' : __builtin__,
424 430 }
425 431 else:
426 432 user_ns.setdefault('__name__','__main__')
427 433 user_ns.setdefault('__builtins__',__builtin__)
428 434
429 435 return user_ns
430 436
431 437
432 438 def make_user_global_ns(ns = None):
433 439 """Return a valid user global namespace.
434 440
435 441 Similar to make_user_ns(), but global namespaces are really only needed in
436 442 embedded applications, where there is a distinction between the user's
437 443 interactive namespace and the global one where ipython is running."""
438 444
439 445 if ns is None: ns = {}
440 446 return ns
441 447
442 448
443 449 def make_session(user_ns = None):
444 450 """Makes, but does not launch an IPython session.
445 451
446 452 Later on you can call obj.mainloop() on the returned object.
447 453
448 454 Inputs:
449 455
450 456 - user_ns(None): a dict to be used as the user's namespace with initial
451 457 data.
452 458
453 459 WARNING: This should *not* be run when a session exists already."""
454 460
455 461 import IPython
456 462 return IPython.Shell.start(user_ns)
457 463
@@ -1,2461 +1,2467 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 Requires Python 2.3 or newer.
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 2442 2007-06-14 21:20:10Z vivainio $
9 $Id: iplib.py 2463 2007-06-27 22:51:16Z vivainio $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 15 #
16 16 # Distributed under the terms of the BSD License. The full license is in
17 17 # the file COPYING, distributed as part of this software.
18 18 #
19 19 # Note: this code originally subclassed code.InteractiveConsole from the
20 20 # Python standard library. Over time, all of that class has been copied
21 21 # verbatim here for modifications which could not be accomplished by
22 22 # subclassing. At this point, there are no dependencies at all on the code
23 23 # module anymore (it is not even imported). The Python License (sec. 2)
24 24 # allows for this, but it's always nice to acknowledge credit where credit is
25 25 # due.
26 26 #*****************************************************************************
27 27
28 28 #****************************************************************************
29 29 # Modules and globals
30 30
31 31 from IPython import Release
32 32 __author__ = '%s <%s>\n%s <%s>' % \
33 33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 34 __license__ = Release.license
35 35 __version__ = Release.version
36 36
37 37 # Python standard modules
38 38 import __main__
39 39 import __builtin__
40 40 import StringIO
41 41 import bdb
42 42 import cPickle as pickle
43 43 import codeop
44 44 import exceptions
45 45 import glob
46 46 import inspect
47 47 import keyword
48 48 import new
49 49 import os
50 50 import pydoc
51 51 import re
52 52 import shutil
53 53 import string
54 54 import sys
55 55 import tempfile
56 56 import traceback
57 57 import types
58 58 import pickleshare
59 59 from sets import Set
60 60 from pprint import pprint, pformat
61 61
62 62 # IPython's own modules
63 63 #import IPython
64 64 from IPython import Debugger,OInspect,PyColorize,ultraTB
65 65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 66 from IPython.FakeModule import FakeModule
67 67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 68 from IPython.Logger import Logger
69 69 from IPython.Magic import Magic
70 70 from IPython.Prompts import CachedOutput
71 71 from IPython.ipstruct import Struct
72 72 from IPython.background_jobs import BackgroundJobManager
73 73 from IPython.usage import cmd_line_usage,interactive_usage
74 74 from IPython.genutils import *
75 75 from IPython.strdispatch import StrDispatch
76 76 import IPython.ipapi
77 77 import IPython.history
78 78 import IPython.prefilter as prefilter
79
79 import IPython.shadowns
80 80 # Globals
81 81
82 82 # store the builtin raw_input globally, and use this always, in case user code
83 83 # overwrites it (like wx.py.PyShell does)
84 84 raw_input_original = raw_input
85 85
86 86 # compiled regexps for autoindent management
87 87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88 88
89 89
90 90 #****************************************************************************
91 91 # Some utility function definitions
92 92
93 93 ini_spaces_re = re.compile(r'^(\s+)')
94 94
95 95 def num_ini_spaces(strng):
96 96 """Return the number of initial spaces in a string"""
97 97
98 98 ini_spaces = ini_spaces_re.match(strng)
99 99 if ini_spaces:
100 100 return ini_spaces.end()
101 101 else:
102 102 return 0
103 103
104 104 def softspace(file, newvalue):
105 105 """Copied from code.py, to remove the dependency"""
106 106
107 107 oldvalue = 0
108 108 try:
109 109 oldvalue = file.softspace
110 110 except AttributeError:
111 111 pass
112 112 try:
113 113 file.softspace = newvalue
114 114 except (AttributeError, TypeError):
115 115 # "attribute-less object" or "read-only attributes"
116 116 pass
117 117 return oldvalue
118 118
119 119
120 120 #****************************************************************************
121 121 # Local use exceptions
122 122 class SpaceInInput(exceptions.Exception): pass
123 123
124 124
125 125 #****************************************************************************
126 126 # Local use classes
127 127 class Bunch: pass
128 128
129 129 class Undefined: pass
130 130
131 131 class Quitter(object):
132 132 """Simple class to handle exit, similar to Python 2.5's.
133 133
134 134 It handles exiting in an ipython-safe manner, which the one in Python 2.5
135 135 doesn't do (obviously, since it doesn't know about ipython)."""
136 136
137 137 def __init__(self,shell,name):
138 138 self.shell = shell
139 139 self.name = name
140 140
141 141 def __repr__(self):
142 142 return 'Type %s() to exit.' % self.name
143 143 __str__ = __repr__
144 144
145 145 def __call__(self):
146 146 self.shell.exit()
147 147
148 148 class InputList(list):
149 149 """Class to store user input.
150 150
151 151 It's basically a list, but slices return a string instead of a list, thus
152 152 allowing things like (assuming 'In' is an instance):
153 153
154 154 exec In[4:7]
155 155
156 156 or
157 157
158 158 exec In[5:9] + In[14] + In[21:25]"""
159 159
160 160 def __getslice__(self,i,j):
161 161 return ''.join(list.__getslice__(self,i,j))
162 162
163 163 class SyntaxTB(ultraTB.ListTB):
164 164 """Extension which holds some state: the last exception value"""
165 165
166 166 def __init__(self,color_scheme = 'NoColor'):
167 167 ultraTB.ListTB.__init__(self,color_scheme)
168 168 self.last_syntax_error = None
169 169
170 170 def __call__(self, etype, value, elist):
171 171 self.last_syntax_error = value
172 172 ultraTB.ListTB.__call__(self,etype,value,elist)
173 173
174 174 def clear_err_state(self):
175 175 """Return the current error state and clear it"""
176 176 e = self.last_syntax_error
177 177 self.last_syntax_error = None
178 178 return e
179 179
180 180 #****************************************************************************
181 181 # Main IPython class
182 182
183 183 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
184 184 # until a full rewrite is made. I've cleaned all cross-class uses of
185 185 # attributes and methods, but too much user code out there relies on the
186 186 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
187 187 #
188 188 # But at least now, all the pieces have been separated and we could, in
189 189 # principle, stop using the mixin. This will ease the transition to the
190 190 # chainsaw branch.
191 191
192 192 # For reference, the following is the list of 'self.foo' uses in the Magic
193 193 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
194 194 # class, to prevent clashes.
195 195
196 196 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
197 197 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
198 198 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
199 199 # 'self.value']
200 200
201 201 class InteractiveShell(object,Magic):
202 202 """An enhanced console for Python."""
203 203
204 204 # class attribute to indicate whether the class supports threads or not.
205 205 # Subclasses with thread support should override this as needed.
206 206 isthreaded = False
207 207
208 208 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
209 209 user_ns = None,user_global_ns=None,banner2='',
210 210 custom_exceptions=((),None),embedded=False):
211 211
212 212 # log system
213 213 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
214 214
215 215 # some minimal strict typechecks. For some core data structures, I
216 216 # want actual basic python types, not just anything that looks like
217 217 # one. This is especially true for namespaces.
218 218 for ns in (user_ns,user_global_ns):
219 219 if ns is not None and type(ns) != types.DictType:
220 220 raise TypeError,'namespace must be a dictionary'
221 221
222 222 # Job manager (for jobs run as background threads)
223 223 self.jobs = BackgroundJobManager()
224 224
225 225 # Store the actual shell's name
226 226 self.name = name
227 227
228 228 # We need to know whether the instance is meant for embedding, since
229 229 # global/local namespaces need to be handled differently in that case
230 230 self.embedded = embedded
231 231
232 232 # command compiler
233 233 self.compile = codeop.CommandCompiler()
234 234
235 235 # User input buffer
236 236 self.buffer = []
237 237
238 238 # Default name given in compilation of code
239 239 self.filename = '<ipython console>'
240 240
241 241 # Install our own quitter instead of the builtins. For python2.3-2.4,
242 242 # this brings in behavior like 2.5, and for 2.5 it's identical.
243 243 __builtin__.exit = Quitter(self,'exit')
244 244 __builtin__.quit = Quitter(self,'quit')
245 245
246 246 # Make an empty namespace, which extension writers can rely on both
247 247 # existing and NEVER being used by ipython itself. This gives them a
248 248 # convenient location for storing additional information and state
249 249 # their extensions may require, without fear of collisions with other
250 250 # ipython names that may develop later.
251 251 self.meta = Struct()
252 252
253 253 # Create the namespace where the user will operate. user_ns is
254 254 # normally the only one used, and it is passed to the exec calls as
255 255 # the locals argument. But we do carry a user_global_ns namespace
256 256 # given as the exec 'globals' argument, This is useful in embedding
257 257 # situations where the ipython shell opens in a context where the
258 258 # distinction between locals and globals is meaningful.
259 259
260 260 # FIXME. For some strange reason, __builtins__ is showing up at user
261 261 # level as a dict instead of a module. This is a manual fix, but I
262 262 # should really track down where the problem is coming from. Alex
263 263 # Schmolck reported this problem first.
264 264
265 265 # A useful post by Alex Martelli on this topic:
266 266 # Re: inconsistent value from __builtins__
267 267 # Von: Alex Martelli <aleaxit@yahoo.com>
268 268 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
269 269 # Gruppen: comp.lang.python
270 270
271 271 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
272 272 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
273 273 # > <type 'dict'>
274 274 # > >>> print type(__builtins__)
275 275 # > <type 'module'>
276 276 # > Is this difference in return value intentional?
277 277
278 278 # Well, it's documented that '__builtins__' can be either a dictionary
279 279 # or a module, and it's been that way for a long time. Whether it's
280 280 # intentional (or sensible), I don't know. In any case, the idea is
281 281 # that if you need to access the built-in namespace directly, you
282 282 # should start with "import __builtin__" (note, no 's') which will
283 283 # definitely give you a module. Yeah, it's somewhat confusing:-(.
284 284
285 285 # These routines return properly built dicts as needed by the rest of
286 286 # the code, and can also be used by extension writers to generate
287 287 # properly initialized namespaces.
288 288 user_ns = IPython.ipapi.make_user_ns(user_ns)
289 289 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
290 290
291 291 # Assign namespaces
292 292 # This is the namespace where all normal user variables live
293 293 self.user_ns = user_ns
294 294 # Embedded instances require a separate namespace for globals.
295 295 # Normally this one is unused by non-embedded instances.
296 296 self.user_global_ns = user_global_ns
297 297 # A namespace to keep track of internal data structures to prevent
298 298 # them from cluttering user-visible stuff. Will be updated later
299 299 self.internal_ns = {}
300 300
301 301 # Namespace of system aliases. Each entry in the alias
302 302 # table must be a 2-tuple of the form (N,name), where N is the number
303 303 # of positional arguments of the alias.
304 304 self.alias_table = {}
305 305
306 306 # A table holding all the namespaces IPython deals with, so that
307 307 # introspection facilities can search easily.
308 308 self.ns_table = {'user':user_ns,
309 309 'user_global':user_global_ns,
310 310 'alias':self.alias_table,
311 311 'internal':self.internal_ns,
312 312 'builtin':__builtin__.__dict__
313 313 }
314 314
315 315 # The user namespace MUST have a pointer to the shell itself.
316 316 self.user_ns[name] = self
317 317
318 318 # We need to insert into sys.modules something that looks like a
319 319 # module but which accesses the IPython namespace, for shelve and
320 320 # pickle to work interactively. Normally they rely on getting
321 321 # everything out of __main__, but for embedding purposes each IPython
322 322 # instance has its own private namespace, so we can't go shoving
323 323 # everything into __main__.
324 324
325 325 # note, however, that we should only do this for non-embedded
326 326 # ipythons, which really mimic the __main__.__dict__ with their own
327 327 # namespace. Embedded instances, on the other hand, should not do
328 328 # this because they need to manage the user local/global namespaces
329 329 # only, but they live within a 'normal' __main__ (meaning, they
330 330 # shouldn't overtake the execution environment of the script they're
331 331 # embedded in).
332 332
333 333 if not embedded:
334 334 try:
335 335 main_name = self.user_ns['__name__']
336 336 except KeyError:
337 337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
338 338 else:
339 339 #print "pickle hack in place" # dbg
340 340 #print 'main_name:',main_name # dbg
341 341 sys.modules[main_name] = FakeModule(self.user_ns)
342 342
343 343 # List of input with multi-line handling.
344 344 # Fill its zero entry, user counter starts at 1
345 345 self.input_hist = InputList(['\n'])
346 346 # This one will hold the 'raw' input history, without any
347 347 # pre-processing. This will allow users to retrieve the input just as
348 348 # it was exactly typed in by the user, with %hist -r.
349 349 self.input_hist_raw = InputList(['\n'])
350 350
351 351 # list of visited directories
352 352 try:
353 353 self.dir_hist = [os.getcwd()]
354 354 except OSError:
355 355 self.dir_hist = []
356 356
357 357 # dict of output history
358 358 self.output_hist = {}
359 359
360 360 # Get system encoding at startup time. Certain terminals (like Emacs
361 361 # under Win32 have it set to None, and we need to have a known valid
362 362 # encoding to use in the raw_input() method
363 363 self.stdin_encoding = sys.stdin.encoding or 'ascii'
364 364
365 365 # dict of things NOT to alias (keywords, builtins and some magics)
366 366 no_alias = {}
367 367 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
368 368 for key in keyword.kwlist + no_alias_magics:
369 369 no_alias[key] = 1
370 370 no_alias.update(__builtin__.__dict__)
371 371 self.no_alias = no_alias
372 372
373 373 # make global variables for user access to these
374 374 self.user_ns['_ih'] = self.input_hist
375 375 self.user_ns['_oh'] = self.output_hist
376 376 self.user_ns['_dh'] = self.dir_hist
377 377
378 378 # user aliases to input and output histories
379 379 self.user_ns['In'] = self.input_hist
380 380 self.user_ns['Out'] = self.output_hist
381 381
382 self.user_ns['_sh'] = IPython.shadowns
382 383 # Object variable to store code object waiting execution. This is
383 384 # used mainly by the multithreaded shells, but it can come in handy in
384 385 # other situations. No need to use a Queue here, since it's a single
385 386 # item which gets cleared once run.
386 387 self.code_to_run = None
387 388
388 389 # escapes for automatic behavior on the command line
389 390 self.ESC_SHELL = '!'
390 391 self.ESC_SH_CAP = '!!'
391 392 self.ESC_HELP = '?'
392 393 self.ESC_MAGIC = '%'
393 394 self.ESC_QUOTE = ','
394 395 self.ESC_QUOTE2 = ';'
395 396 self.ESC_PAREN = '/'
396 397
397 398 # And their associated handlers
398 399 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
399 400 self.ESC_QUOTE : self.handle_auto,
400 401 self.ESC_QUOTE2 : self.handle_auto,
401 402 self.ESC_MAGIC : self.handle_magic,
402 403 self.ESC_HELP : self.handle_help,
403 404 self.ESC_SHELL : self.handle_shell_escape,
404 405 self.ESC_SH_CAP : self.handle_shell_escape,
405 406 }
406 407
407 408 # class initializations
408 409 Magic.__init__(self,self)
409 410
410 411 # Python source parser/formatter for syntax highlighting
411 412 pyformat = PyColorize.Parser().format
412 413 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
413 414
414 415 # hooks holds pointers used for user-side customizations
415 416 self.hooks = Struct()
416 417
417 418 self.strdispatchers = {}
418 419
419 420 # Set all default hooks, defined in the IPython.hooks module.
420 421 hooks = IPython.hooks
421 422 for hook_name in hooks.__all__:
422 423 # default hooks have priority 100, i.e. low; user hooks should have
423 424 # 0-100 priority
424 425 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
425 426 #print "bound hook",hook_name
426 427
427 428 # Flag to mark unconditional exit
428 429 self.exit_now = False
429 430
430 431 self.usage_min = """\
431 432 An enhanced console for Python.
432 433 Some of its features are:
433 434 - Readline support if the readline library is present.
434 435 - Tab completion in the local namespace.
435 436 - Logging of input, see command-line options.
436 437 - System shell escape via ! , eg !ls.
437 438 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
438 439 - Keeps track of locally defined variables via %who, %whos.
439 440 - Show object information with a ? eg ?x or x? (use ?? for more info).
440 441 """
441 442 if usage: self.usage = usage
442 443 else: self.usage = self.usage_min
443 444
444 445 # Storage
445 446 self.rc = rc # This will hold all configuration information
446 447 self.pager = 'less'
447 448 # temporary files used for various purposes. Deleted at exit.
448 449 self.tempfiles = []
449 450
450 451 # Keep track of readline usage (later set by init_readline)
451 452 self.has_readline = False
452 453
453 454 # template for logfile headers. It gets resolved at runtime by the
454 455 # logstart method.
455 456 self.loghead_tpl = \
456 457 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
457 458 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
458 459 #log# opts = %s
459 460 #log# args = %s
460 461 #log# It is safe to make manual edits below here.
461 462 #log#-----------------------------------------------------------------------
462 463 """
463 464 # for pushd/popd management
464 465 try:
465 466 self.home_dir = get_home_dir()
466 467 except HomeDirError,msg:
467 468 fatal(msg)
468 469
469 470 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
470 471
471 472 # Functions to call the underlying shell.
472 473
473 474 # The first is similar to os.system, but it doesn't return a value,
474 475 # and it allows interpolation of variables in the user's namespace.
475 476 self.system = lambda cmd: \
476 477 shell(self.var_expand(cmd,depth=2),
477 478 header=self.rc.system_header,
478 479 verbose=self.rc.system_verbose)
479 480
480 481 # These are for getoutput and getoutputerror:
481 482 self.getoutput = lambda cmd: \
482 483 getoutput(self.var_expand(cmd,depth=2),
483 484 header=self.rc.system_header,
484 485 verbose=self.rc.system_verbose)
485 486
486 487 self.getoutputerror = lambda cmd: \
487 488 getoutputerror(self.var_expand(cmd,depth=2),
488 489 header=self.rc.system_header,
489 490 verbose=self.rc.system_verbose)
490 491
491 492
492 493 # keep track of where we started running (mainly for crash post-mortem)
493 494 self.starting_dir = os.getcwd()
494 495
495 496 # Various switches which can be set
496 497 self.CACHELENGTH = 5000 # this is cheap, it's just text
497 498 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
498 499 self.banner2 = banner2
499 500
500 501 # TraceBack handlers:
501 502
502 503 # Syntax error handler.
503 504 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
504 505
505 506 # The interactive one is initialized with an offset, meaning we always
506 507 # want to remove the topmost item in the traceback, which is our own
507 508 # internal code. Valid modes: ['Plain','Context','Verbose']
508 509 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
509 510 color_scheme='NoColor',
510 511 tb_offset = 1)
511 512
512 513 # IPython itself shouldn't crash. This will produce a detailed
513 514 # post-mortem if it does. But we only install the crash handler for
514 515 # non-threaded shells, the threaded ones use a normal verbose reporter
515 516 # and lose the crash handler. This is because exceptions in the main
516 517 # thread (such as in GUI code) propagate directly to sys.excepthook,
517 518 # and there's no point in printing crash dumps for every user exception.
518 519 if self.isthreaded:
519 520 ipCrashHandler = ultraTB.FormattedTB()
520 521 else:
521 522 from IPython import CrashHandler
522 523 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
523 524 self.set_crash_handler(ipCrashHandler)
524 525
525 526 # and add any custom exception handlers the user may have specified
526 527 self.set_custom_exc(*custom_exceptions)
527 528
528 529 # indentation management
529 530 self.autoindent = False
530 531 self.indent_current_nsp = 0
531 532
532 533 # Make some aliases automatically
533 534 # Prepare list of shell aliases to auto-define
534 535 if os.name == 'posix':
535 536 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
536 537 'mv mv -i','rm rm -i','cp cp -i',
537 538 'cat cat','less less','clear clear',
538 539 # a better ls
539 540 'ls ls -F',
540 541 # long ls
541 542 'll ls -lF')
542 543 # Extra ls aliases with color, which need special treatment on BSD
543 544 # variants
544 545 ls_extra = ( # color ls
545 546 'lc ls -F -o --color',
546 547 # ls normal files only
547 548 'lf ls -F -o --color %l | grep ^-',
548 549 # ls symbolic links
549 550 'lk ls -F -o --color %l | grep ^l',
550 551 # directories or links to directories,
551 552 'ldir ls -F -o --color %l | grep /$',
552 553 # things which are executable
553 554 'lx ls -F -o --color %l | grep ^-..x',
554 555 )
555 556 # The BSDs don't ship GNU ls, so they don't understand the
556 557 # --color switch out of the box
557 558 if 'bsd' in sys.platform:
558 559 ls_extra = ( # ls normal files only
559 560 'lf ls -lF | grep ^-',
560 561 # ls symbolic links
561 562 'lk ls -lF | grep ^l',
562 563 # directories or links to directories,
563 564 'ldir ls -lF | grep /$',
564 565 # things which are executable
565 566 'lx ls -lF | grep ^-..x',
566 567 )
567 568 auto_alias = auto_alias + ls_extra
568 569 elif os.name in ['nt','dos']:
569 570 auto_alias = ('dir dir /on', 'ls dir /on',
570 571 'ddir dir /ad /on', 'ldir dir /ad /on',
571 572 'mkdir mkdir','rmdir rmdir','echo echo',
572 573 'ren ren','cls cls','copy copy')
573 574 else:
574 575 auto_alias = ()
575 576 self.auto_alias = [s.split(None,1) for s in auto_alias]
576 577 # Call the actual (public) initializer
577 578 self.init_auto_alias()
578 579
579 580 # Produce a public API instance
580 581 self.api = IPython.ipapi.IPApi(self)
581 582
582 583 # track which builtins we add, so we can clean up later
583 584 self.builtins_added = {}
584 585 # This method will add the necessary builtins for operation, but
585 586 # tracking what it did via the builtins_added dict.
586 587 self.add_builtins()
587 588
588 589 # end __init__
589 590
590 591 def var_expand(self,cmd,depth=0):
591 592 """Expand python variables in a string.
592 593
593 594 The depth argument indicates how many frames above the caller should
594 595 be walked to look for the local namespace where to expand variables.
595 596
596 597 The global namespace for expansion is always the user's interactive
597 598 namespace.
598 599 """
599 600
600 601 return str(ItplNS(cmd.replace('#','\#'),
601 602 self.user_ns, # globals
602 603 # Skip our own frame in searching for locals:
603 604 sys._getframe(depth+1).f_locals # locals
604 605 ))
605 606
606 607 def pre_config_initialization(self):
607 608 """Pre-configuration init method
608 609
609 610 This is called before the configuration files are processed to
610 611 prepare the services the config files might need.
611 612
612 613 self.rc already has reasonable default values at this point.
613 614 """
614 615 rc = self.rc
615 616 try:
616 617 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
617 618 except exceptions.UnicodeDecodeError:
618 619 print "Your ipythondir can't be decoded to unicode!"
619 620 print "Please set HOME environment variable to something that"
620 621 print r"only has ASCII characters, e.g. c:\home"
621 622 print "Now it is",rc.ipythondir
622 623 sys.exit()
623 624 self.shadowhist = IPython.history.ShadowHist(self.db)
624 625
625 626
626 627 def post_config_initialization(self):
627 628 """Post configuration init method
628 629
629 630 This is called after the configuration files have been processed to
630 631 'finalize' the initialization."""
631 632
632 633 rc = self.rc
633 634
634 635 # Object inspector
635 636 self.inspector = OInspect.Inspector(OInspect.InspectColors,
636 637 PyColorize.ANSICodeColors,
637 638 'NoColor',
638 639 rc.object_info_string_level)
639 640
640 641 self.rl_next_input = None
641 642 self.rl_do_indent = False
642 643 # Load readline proper
643 644 if rc.readline:
644 645 self.init_readline()
645 646
646 647
647 648 # local shortcut, this is used a LOT
648 649 self.log = self.logger.log
649 650
650 651 # Initialize cache, set in/out prompts and printing system
651 652 self.outputcache = CachedOutput(self,
652 653 rc.cache_size,
653 654 rc.pprint,
654 655 input_sep = rc.separate_in,
655 656 output_sep = rc.separate_out,
656 657 output_sep2 = rc.separate_out2,
657 658 ps1 = rc.prompt_in1,
658 659 ps2 = rc.prompt_in2,
659 660 ps_out = rc.prompt_out,
660 661 pad_left = rc.prompts_pad_left)
661 662
662 663 # user may have over-ridden the default print hook:
663 664 try:
664 665 self.outputcache.__class__.display = self.hooks.display
665 666 except AttributeError:
666 667 pass
667 668
668 669 # I don't like assigning globally to sys, because it means when
669 670 # embedding instances, each embedded instance overrides the previous
670 671 # choice. But sys.displayhook seems to be called internally by exec,
671 672 # so I don't see a way around it. We first save the original and then
672 673 # overwrite it.
673 674 self.sys_displayhook = sys.displayhook
674 675 sys.displayhook = self.outputcache
675 676
676 677 # Set user colors (don't do it in the constructor above so that it
677 678 # doesn't crash if colors option is invalid)
678 679 self.magic_colors(rc.colors)
679 680
680 681 # Set calling of pdb on exceptions
681 682 self.call_pdb = rc.pdb
682 683
683 684 # Load user aliases
684 685 for alias in rc.alias:
685 686 self.magic_alias(alias)
686 687 self.hooks.late_startup_hook()
687 688
688 689 batchrun = False
689 690 for batchfile in [path(arg) for arg in self.rc.args
690 691 if arg.lower().endswith('.ipy')]:
691 692 if not batchfile.isfile():
692 693 print "No such batch file:", batchfile
693 694 continue
694 695 self.api.runlines(batchfile.text())
695 696 batchrun = True
696 697 if batchrun:
697 698 self.exit_now = True
698 699
699 700 def add_builtins(self):
700 701 """Store ipython references into the builtin namespace.
701 702
702 703 Some parts of ipython operate via builtins injected here, which hold a
703 704 reference to IPython itself."""
704 705
705 706 # TODO: deprecate all except _ip; 'jobs' should be installed
706 707 # by an extension and the rest are under _ip, ipalias is redundant
707 708 builtins_new = dict(__IPYTHON__ = self,
708 709 ip_set_hook = self.set_hook,
709 710 jobs = self.jobs,
710 711 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
711 712 ipalias = wrap_deprecated(self.ipalias),
712 713 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
713 714 _ip = self.api
714 715 )
715 716 for biname,bival in builtins_new.items():
716 717 try:
717 718 # store the orignal value so we can restore it
718 719 self.builtins_added[biname] = __builtin__.__dict__[biname]
719 720 except KeyError:
720 721 # or mark that it wasn't defined, and we'll just delete it at
721 722 # cleanup
722 723 self.builtins_added[biname] = Undefined
723 724 __builtin__.__dict__[biname] = bival
724 725
725 726 # Keep in the builtins a flag for when IPython is active. We set it
726 727 # with setdefault so that multiple nested IPythons don't clobber one
727 728 # another. Each will increase its value by one upon being activated,
728 729 # which also gives us a way to determine the nesting level.
729 730 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
730 731
731 732 def clean_builtins(self):
732 733 """Remove any builtins which might have been added by add_builtins, or
733 734 restore overwritten ones to their previous values."""
734 735 for biname,bival in self.builtins_added.items():
735 736 if bival is Undefined:
736 737 del __builtin__.__dict__[biname]
737 738 else:
738 739 __builtin__.__dict__[biname] = bival
739 740 self.builtins_added.clear()
740 741
741 742 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
742 743 """set_hook(name,hook) -> sets an internal IPython hook.
743 744
744 745 IPython exposes some of its internal API as user-modifiable hooks. By
745 746 adding your function to one of these hooks, you can modify IPython's
746 747 behavior to call at runtime your own routines."""
747 748
748 749 # At some point in the future, this should validate the hook before it
749 750 # accepts it. Probably at least check that the hook takes the number
750 751 # of args it's supposed to.
751 752
752 753 f = new.instancemethod(hook,self,self.__class__)
753 754
754 755 # check if the hook is for strdispatcher first
755 756 if str_key is not None:
756 757 sdp = self.strdispatchers.get(name, StrDispatch())
757 758 sdp.add_s(str_key, f, priority )
758 759 self.strdispatchers[name] = sdp
759 760 return
760 761 if re_key is not None:
761 762 sdp = self.strdispatchers.get(name, StrDispatch())
762 763 sdp.add_re(re.compile(re_key), f, priority )
763 764 self.strdispatchers[name] = sdp
764 765 return
765 766
766 767 dp = getattr(self.hooks, name, None)
767 768 if name not in IPython.hooks.__all__:
768 769 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
769 770 if not dp:
770 771 dp = IPython.hooks.CommandChainDispatcher()
771 772
772 773 try:
773 774 dp.add(f,priority)
774 775 except AttributeError:
775 776 # it was not commandchain, plain old func - replace
776 777 dp = f
777 778
778 779 setattr(self.hooks,name, dp)
779 780
780 781
781 782 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
782 783
783 784 def set_crash_handler(self,crashHandler):
784 785 """Set the IPython crash handler.
785 786
786 787 This must be a callable with a signature suitable for use as
787 788 sys.excepthook."""
788 789
789 790 # Install the given crash handler as the Python exception hook
790 791 sys.excepthook = crashHandler
791 792
792 793 # The instance will store a pointer to this, so that runtime code
793 794 # (such as magics) can access it. This is because during the
794 795 # read-eval loop, it gets temporarily overwritten (to deal with GUI
795 796 # frameworks).
796 797 self.sys_excepthook = sys.excepthook
797 798
798 799
799 800 def set_custom_exc(self,exc_tuple,handler):
800 801 """set_custom_exc(exc_tuple,handler)
801 802
802 803 Set a custom exception handler, which will be called if any of the
803 804 exceptions in exc_tuple occur in the mainloop (specifically, in the
804 805 runcode() method.
805 806
806 807 Inputs:
807 808
808 809 - exc_tuple: a *tuple* of valid exceptions to call the defined
809 810 handler for. It is very important that you use a tuple, and NOT A
810 811 LIST here, because of the way Python's except statement works. If
811 812 you only want to trap a single exception, use a singleton tuple:
812 813
813 814 exc_tuple == (MyCustomException,)
814 815
815 816 - handler: this must be defined as a function with the following
816 817 basic interface: def my_handler(self,etype,value,tb).
817 818
818 819 This will be made into an instance method (via new.instancemethod)
819 820 of IPython itself, and it will be called if any of the exceptions
820 821 listed in the exc_tuple are caught. If the handler is None, an
821 822 internal basic one is used, which just prints basic info.
822 823
823 824 WARNING: by putting in your own exception handler into IPython's main
824 825 execution loop, you run a very good chance of nasty crashes. This
825 826 facility should only be used if you really know what you are doing."""
826 827
827 828 assert type(exc_tuple)==type(()) , \
828 829 "The custom exceptions must be given AS A TUPLE."
829 830
830 831 def dummy_handler(self,etype,value,tb):
831 832 print '*** Simple custom exception handler ***'
832 833 print 'Exception type :',etype
833 834 print 'Exception value:',value
834 835 print 'Traceback :',tb
835 836 print 'Source code :','\n'.join(self.buffer)
836 837
837 838 if handler is None: handler = dummy_handler
838 839
839 840 self.CustomTB = new.instancemethod(handler,self,self.__class__)
840 841 self.custom_exceptions = exc_tuple
841 842
842 843 def set_custom_completer(self,completer,pos=0):
843 844 """set_custom_completer(completer,pos=0)
844 845
845 846 Adds a new custom completer function.
846 847
847 848 The position argument (defaults to 0) is the index in the completers
848 849 list where you want the completer to be inserted."""
849 850
850 851 newcomp = new.instancemethod(completer,self.Completer,
851 852 self.Completer.__class__)
852 853 self.Completer.matchers.insert(pos,newcomp)
853 854
854 855 def set_completer(self):
855 856 """reset readline's completer to be our own."""
856 857 self.readline.set_completer(self.Completer.complete)
857 858
858 859 def _get_call_pdb(self):
859 860 return self._call_pdb
860 861
861 862 def _set_call_pdb(self,val):
862 863
863 864 if val not in (0,1,False,True):
864 865 raise ValueError,'new call_pdb value must be boolean'
865 866
866 867 # store value in instance
867 868 self._call_pdb = val
868 869
869 870 # notify the actual exception handlers
870 871 self.InteractiveTB.call_pdb = val
871 872 if self.isthreaded:
872 873 try:
873 874 self.sys_excepthook.call_pdb = val
874 875 except:
875 876 warn('Failed to activate pdb for threaded exception handler')
876 877
877 878 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
878 879 'Control auto-activation of pdb at exceptions')
879 880
880 881
881 882 # These special functions get installed in the builtin namespace, to
882 883 # provide programmatic (pure python) access to magics, aliases and system
883 884 # calls. This is important for logging, user scripting, and more.
884 885
885 886 # We are basically exposing, via normal python functions, the three
886 887 # mechanisms in which ipython offers special call modes (magics for
887 888 # internal control, aliases for direct system access via pre-selected
888 889 # names, and !cmd for calling arbitrary system commands).
889 890
890 891 def ipmagic(self,arg_s):
891 892 """Call a magic function by name.
892 893
893 894 Input: a string containing the name of the magic function to call and any
894 895 additional arguments to be passed to the magic.
895 896
896 897 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
897 898 prompt:
898 899
899 900 In[1]: %name -opt foo bar
900 901
901 902 To call a magic without arguments, simply use ipmagic('name').
902 903
903 904 This provides a proper Python function to call IPython's magics in any
904 905 valid Python code you can type at the interpreter, including loops and
905 906 compound statements. It is added by IPython to the Python builtin
906 907 namespace upon initialization."""
907 908
908 909 args = arg_s.split(' ',1)
909 910 magic_name = args[0]
910 911 magic_name = magic_name.lstrip(self.ESC_MAGIC)
911 912
912 913 try:
913 914 magic_args = args[1]
914 915 except IndexError:
915 916 magic_args = ''
916 917 fn = getattr(self,'magic_'+magic_name,None)
917 918 if fn is None:
918 919 error("Magic function `%s` not found." % magic_name)
919 920 else:
920 921 magic_args = self.var_expand(magic_args,1)
921 922 return fn(magic_args)
922 923
923 924 def ipalias(self,arg_s):
924 925 """Call an alias by name.
925 926
926 927 Input: a string containing the name of the alias to call and any
927 928 additional arguments to be passed to the magic.
928 929
929 930 ipalias('name -opt foo bar') is equivalent to typing at the ipython
930 931 prompt:
931 932
932 933 In[1]: name -opt foo bar
933 934
934 935 To call an alias without arguments, simply use ipalias('name').
935 936
936 937 This provides a proper Python function to call IPython's aliases in any
937 938 valid Python code you can type at the interpreter, including loops and
938 939 compound statements. It is added by IPython to the Python builtin
939 940 namespace upon initialization."""
940 941
941 942 args = arg_s.split(' ',1)
942 943 alias_name = args[0]
943 944 try:
944 945 alias_args = args[1]
945 946 except IndexError:
946 947 alias_args = ''
947 948 if alias_name in self.alias_table:
948 949 self.call_alias(alias_name,alias_args)
949 950 else:
950 951 error("Alias `%s` not found." % alias_name)
951 952
952 953 def ipsystem(self,arg_s):
953 954 """Make a system call, using IPython."""
954 955
955 956 self.system(arg_s)
956 957
957 958 def complete(self,text):
958 959 """Return a sorted list of all possible completions on text.
959 960
960 961 Inputs:
961 962
962 963 - text: a string of text to be completed on.
963 964
964 965 This is a wrapper around the completion mechanism, similar to what
965 966 readline does at the command line when the TAB key is hit. By
966 967 exposing it as a method, it can be used by other non-readline
967 968 environments (such as GUIs) for text completion.
968 969
969 970 Simple usage example:
970 971
971 972 In [1]: x = 'hello'
972 973
973 974 In [2]: __IP.complete('x.l')
974 975 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
975 976
976 977 complete = self.Completer.complete
977 978 state = 0
978 979 # use a dict so we get unique keys, since ipyhton's multiple
979 980 # completers can return duplicates. When we make 2.4 a requirement,
980 981 # start using sets instead, which are faster.
981 982 comps = {}
982 983 while True:
983 984 newcomp = complete(text,state,line_buffer=text)
984 985 if newcomp is None:
985 986 break
986 987 comps[newcomp] = 1
987 988 state += 1
988 989 outcomps = comps.keys()
989 990 outcomps.sort()
990 991 return outcomps
991 992
992 993 def set_completer_frame(self, frame=None):
993 994 if frame:
994 995 self.Completer.namespace = frame.f_locals
995 996 self.Completer.global_namespace = frame.f_globals
996 997 else:
997 998 self.Completer.namespace = self.user_ns
998 999 self.Completer.global_namespace = self.user_global_ns
999 1000
1000 1001 def init_auto_alias(self):
1001 1002 """Define some aliases automatically.
1002 1003
1003 1004 These are ALL parameter-less aliases"""
1004 1005
1005 1006 for alias,cmd in self.auto_alias:
1006 1007 self.alias_table[alias] = (0,cmd)
1007 1008
1008 1009 def alias_table_validate(self,verbose=0):
1009 1010 """Update information about the alias table.
1010 1011
1011 1012 In particular, make sure no Python keywords/builtins are in it."""
1012 1013
1013 1014 no_alias = self.no_alias
1014 1015 for k in self.alias_table.keys():
1015 1016 if k in no_alias:
1016 1017 del self.alias_table[k]
1017 1018 if verbose:
1018 1019 print ("Deleting alias <%s>, it's a Python "
1019 1020 "keyword or builtin." % k)
1020 1021
1021 1022 def set_autoindent(self,value=None):
1022 1023 """Set the autoindent flag, checking for readline support.
1023 1024
1024 1025 If called with no arguments, it acts as a toggle."""
1025 1026
1026 1027 if not self.has_readline:
1027 1028 if os.name == 'posix':
1028 1029 warn("The auto-indent feature requires the readline library")
1029 1030 self.autoindent = 0
1030 1031 return
1031 1032 if value is None:
1032 1033 self.autoindent = not self.autoindent
1033 1034 else:
1034 1035 self.autoindent = value
1035 1036
1036 1037 def rc_set_toggle(self,rc_field,value=None):
1037 1038 """Set or toggle a field in IPython's rc config. structure.
1038 1039
1039 1040 If called with no arguments, it acts as a toggle.
1040 1041
1041 1042 If called with a non-existent field, the resulting AttributeError
1042 1043 exception will propagate out."""
1043 1044
1044 1045 rc_val = getattr(self.rc,rc_field)
1045 1046 if value is None:
1046 1047 value = not rc_val
1047 1048 setattr(self.rc,rc_field,value)
1048 1049
1049 1050 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1050 1051 """Install the user configuration directory.
1051 1052
1052 1053 Can be called when running for the first time or to upgrade the user's
1053 1054 .ipython/ directory with the mode parameter. Valid modes are 'install'
1054 1055 and 'upgrade'."""
1055 1056
1056 1057 def wait():
1057 1058 try:
1058 1059 raw_input("Please press <RETURN> to start IPython.")
1059 1060 except EOFError:
1060 1061 print >> Term.cout
1061 1062 print '*'*70
1062 1063
1063 1064 cwd = os.getcwd() # remember where we started
1064 1065 glb = glob.glob
1065 1066 print '*'*70
1066 1067 if mode == 'install':
1067 1068 print \
1068 1069 """Welcome to IPython. I will try to create a personal configuration directory
1069 1070 where you can customize many aspects of IPython's functionality in:\n"""
1070 1071 else:
1071 1072 print 'I am going to upgrade your configuration in:'
1072 1073
1073 1074 print ipythondir
1074 1075
1075 1076 rcdirend = os.path.join('IPython','UserConfig')
1076 1077 cfg = lambda d: os.path.join(d,rcdirend)
1077 1078 try:
1078 1079 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1079 1080 except IOError:
1080 1081 warning = """
1081 1082 Installation error. IPython's directory was not found.
1082 1083
1083 1084 Check the following:
1084 1085
1085 1086 The ipython/IPython directory should be in a directory belonging to your
1086 1087 PYTHONPATH environment variable (that is, it should be in a directory
1087 1088 belonging to sys.path). You can copy it explicitly there or just link to it.
1088 1089
1089 1090 IPython will proceed with builtin defaults.
1090 1091 """
1091 1092 warn(warning)
1092 1093 wait()
1093 1094 return
1094 1095
1095 1096 if mode == 'install':
1096 1097 try:
1097 1098 shutil.copytree(rcdir,ipythondir)
1098 1099 os.chdir(ipythondir)
1099 1100 rc_files = glb("ipythonrc*")
1100 1101 for rc_file in rc_files:
1101 1102 os.rename(rc_file,rc_file+rc_suffix)
1102 1103 except:
1103 1104 warning = """
1104 1105
1105 1106 There was a problem with the installation:
1106 1107 %s
1107 1108 Try to correct it or contact the developers if you think it's a bug.
1108 1109 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1109 1110 warn(warning)
1110 1111 wait()
1111 1112 return
1112 1113
1113 1114 elif mode == 'upgrade':
1114 1115 try:
1115 1116 os.chdir(ipythondir)
1116 1117 except:
1117 1118 print """
1118 1119 Can not upgrade: changing to directory %s failed. Details:
1119 1120 %s
1120 1121 """ % (ipythondir,sys.exc_info()[1])
1121 1122 wait()
1122 1123 return
1123 1124 else:
1124 1125 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1125 1126 for new_full_path in sources:
1126 1127 new_filename = os.path.basename(new_full_path)
1127 1128 if new_filename.startswith('ipythonrc'):
1128 1129 new_filename = new_filename + rc_suffix
1129 1130 # The config directory should only contain files, skip any
1130 1131 # directories which may be there (like CVS)
1131 1132 if os.path.isdir(new_full_path):
1132 1133 continue
1133 1134 if os.path.exists(new_filename):
1134 1135 old_file = new_filename+'.old'
1135 1136 if os.path.exists(old_file):
1136 1137 os.remove(old_file)
1137 1138 os.rename(new_filename,old_file)
1138 1139 shutil.copy(new_full_path,new_filename)
1139 1140 else:
1140 1141 raise ValueError,'unrecognized mode for install:',`mode`
1141 1142
1142 1143 # Fix line-endings to those native to each platform in the config
1143 1144 # directory.
1144 1145 try:
1145 1146 os.chdir(ipythondir)
1146 1147 except:
1147 1148 print """
1148 1149 Problem: changing to directory %s failed.
1149 1150 Details:
1150 1151 %s
1151 1152
1152 1153 Some configuration files may have incorrect line endings. This should not
1153 1154 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1154 1155 wait()
1155 1156 else:
1156 1157 for fname in glb('ipythonrc*'):
1157 1158 try:
1158 1159 native_line_ends(fname,backup=0)
1159 1160 except IOError:
1160 1161 pass
1161 1162
1162 1163 if mode == 'install':
1163 1164 print """
1164 1165 Successful installation!
1165 1166
1166 1167 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1167 1168 IPython manual (there are both HTML and PDF versions supplied with the
1168 1169 distribution) to make sure that your system environment is properly configured
1169 1170 to take advantage of IPython's features.
1170 1171
1171 1172 Important note: the configuration system has changed! The old system is
1172 1173 still in place, but its setting may be partly overridden by the settings in
1173 1174 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1174 1175 if some of the new settings bother you.
1175 1176
1176 1177 """
1177 1178 else:
1178 1179 print """
1179 1180 Successful upgrade!
1180 1181
1181 1182 All files in your directory:
1182 1183 %(ipythondir)s
1183 1184 which would have been overwritten by the upgrade were backed up with a .old
1184 1185 extension. If you had made particular customizations in those files you may
1185 1186 want to merge them back into the new files.""" % locals()
1186 1187 wait()
1187 1188 os.chdir(cwd)
1188 1189 # end user_setup()
1189 1190
1190 1191 def atexit_operations(self):
1191 1192 """This will be executed at the time of exit.
1192 1193
1193 1194 Saving of persistent data should be performed here. """
1194 1195
1195 1196 #print '*** IPython exit cleanup ***' # dbg
1196 1197 # input history
1197 1198 self.savehist()
1198 1199
1199 1200 # Cleanup all tempfiles left around
1200 1201 for tfile in self.tempfiles:
1201 1202 try:
1202 1203 os.unlink(tfile)
1203 1204 except OSError:
1204 1205 pass
1205 1206
1206 1207 self.hooks.shutdown_hook()
1207 1208
1208 1209 def savehist(self):
1209 1210 """Save input history to a file (via readline library)."""
1210 1211 try:
1211 1212 self.readline.write_history_file(self.histfile)
1212 1213 except:
1213 1214 print 'Unable to save IPython command history to file: ' + \
1214 1215 `self.histfile`
1215 1216
1216 1217 def reloadhist(self):
1217 1218 """Reload the input history from disk file."""
1218 1219
1219 1220 if self.has_readline:
1220 1221 self.readline.clear_history()
1221 1222 self.readline.read_history_file(self.shell.histfile)
1222 1223
1223 1224 def history_saving_wrapper(self, func):
1224 1225 """ Wrap func for readline history saving
1225 1226
1226 1227 Convert func into callable that saves & restores
1227 1228 history around the call """
1228 1229
1229 1230 if not self.has_readline:
1230 1231 return func
1231 1232
1232 1233 def wrapper():
1233 1234 self.savehist()
1234 1235 try:
1235 1236 func()
1236 1237 finally:
1237 1238 readline.read_history_file(self.histfile)
1238 1239 return wrapper
1239 1240
1240 1241
1241 1242 def pre_readline(self):
1242 1243 """readline hook to be used at the start of each line.
1243 1244
1244 1245 Currently it handles auto-indent only."""
1245 1246
1246 1247 #debugx('self.indent_current_nsp','pre_readline:')
1247 1248
1248 1249 if self.rl_do_indent:
1249 1250 self.readline.insert_text(self.indent_current_str())
1250 1251 if self.rl_next_input is not None:
1251 1252 self.readline.insert_text(self.rl_next_input)
1252 1253 self.rl_next_input = None
1253 1254
1254 1255 def init_readline(self):
1255 1256 """Command history completion/saving/reloading."""
1256 1257
1257 1258 import IPython.rlineimpl as readline
1258 1259 if not readline.have_readline:
1259 1260 self.has_readline = 0
1260 1261 self.readline = None
1261 1262 # no point in bugging windows users with this every time:
1262 1263 warn('Readline services not available on this platform.')
1263 1264 else:
1264 1265 sys.modules['readline'] = readline
1265 1266 import atexit
1266 1267 from IPython.completer import IPCompleter
1267 1268 self.Completer = IPCompleter(self,
1268 1269 self.user_ns,
1269 1270 self.user_global_ns,
1270 1271 self.rc.readline_omit__names,
1271 1272 self.alias_table)
1272 1273 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1273 1274 self.strdispatchers['complete_command'] = sdisp
1274 1275 self.Completer.custom_completers = sdisp
1275 1276 # Platform-specific configuration
1276 1277 if os.name == 'nt':
1277 1278 self.readline_startup_hook = readline.set_pre_input_hook
1278 1279 else:
1279 1280 self.readline_startup_hook = readline.set_startup_hook
1280 1281
1281 1282 # Load user's initrc file (readline config)
1282 1283 inputrc_name = os.environ.get('INPUTRC')
1283 1284 if inputrc_name is None:
1284 1285 home_dir = get_home_dir()
1285 1286 if home_dir is not None:
1286 1287 inputrc_name = os.path.join(home_dir,'.inputrc')
1287 1288 if os.path.isfile(inputrc_name):
1288 1289 try:
1289 1290 readline.read_init_file(inputrc_name)
1290 1291 except:
1291 1292 warn('Problems reading readline initialization file <%s>'
1292 1293 % inputrc_name)
1293 1294
1294 1295 self.has_readline = 1
1295 1296 self.readline = readline
1296 1297 # save this in sys so embedded copies can restore it properly
1297 1298 sys.ipcompleter = self.Completer.complete
1298 1299 self.set_completer()
1299 1300
1300 1301 # Configure readline according to user's prefs
1301 1302 for rlcommand in self.rc.readline_parse_and_bind:
1302 1303 readline.parse_and_bind(rlcommand)
1303 1304
1304 1305 # remove some chars from the delimiters list
1305 1306 delims = readline.get_completer_delims()
1306 1307 delims = delims.translate(string._idmap,
1307 1308 self.rc.readline_remove_delims)
1308 1309 readline.set_completer_delims(delims)
1309 1310 # otherwise we end up with a monster history after a while:
1310 1311 readline.set_history_length(1000)
1311 1312 try:
1312 1313 #print '*** Reading readline history' # dbg
1313 1314 readline.read_history_file(self.histfile)
1314 1315 except IOError:
1315 1316 pass # It doesn't exist yet.
1316 1317
1317 1318 atexit.register(self.atexit_operations)
1318 1319 del atexit
1319 1320
1320 1321 # Configure auto-indent for all platforms
1321 1322 self.set_autoindent(self.rc.autoindent)
1322 1323
1323 1324 def ask_yes_no(self,prompt,default=True):
1324 1325 if self.rc.quiet:
1325 1326 return True
1326 1327 return ask_yes_no(prompt,default)
1327 1328
1328 1329 def _should_recompile(self,e):
1329 1330 """Utility routine for edit_syntax_error"""
1330 1331
1331 1332 if e.filename in ('<ipython console>','<input>','<string>',
1332 1333 '<console>','<BackgroundJob compilation>',
1333 1334 None):
1334 1335
1335 1336 return False
1336 1337 try:
1337 1338 if (self.rc.autoedit_syntax and
1338 1339 not self.ask_yes_no('Return to editor to correct syntax error? '
1339 1340 '[Y/n] ','y')):
1340 1341 return False
1341 1342 except EOFError:
1342 1343 return False
1343 1344
1344 1345 def int0(x):
1345 1346 try:
1346 1347 return int(x)
1347 1348 except TypeError:
1348 1349 return 0
1349 1350 # always pass integer line and offset values to editor hook
1350 1351 self.hooks.fix_error_editor(e.filename,
1351 1352 int0(e.lineno),int0(e.offset),e.msg)
1352 1353 return True
1353 1354
1354 1355 def edit_syntax_error(self):
1355 1356 """The bottom half of the syntax error handler called in the main loop.
1356 1357
1357 1358 Loop until syntax error is fixed or user cancels.
1358 1359 """
1359 1360
1360 1361 while self.SyntaxTB.last_syntax_error:
1361 1362 # copy and clear last_syntax_error
1362 1363 err = self.SyntaxTB.clear_err_state()
1363 1364 if not self._should_recompile(err):
1364 1365 return
1365 1366 try:
1366 1367 # may set last_syntax_error again if a SyntaxError is raised
1367 1368 self.safe_execfile(err.filename,self.user_ns)
1368 1369 except:
1369 1370 self.showtraceback()
1370 1371 else:
1371 1372 try:
1372 1373 f = file(err.filename)
1373 1374 try:
1374 1375 sys.displayhook(f.read())
1375 1376 finally:
1376 1377 f.close()
1377 1378 except:
1378 1379 self.showtraceback()
1379 1380
1380 1381 def showsyntaxerror(self, filename=None):
1381 1382 """Display the syntax error that just occurred.
1382 1383
1383 1384 This doesn't display a stack trace because there isn't one.
1384 1385
1385 1386 If a filename is given, it is stuffed in the exception instead
1386 1387 of what was there before (because Python's parser always uses
1387 1388 "<string>" when reading from a string).
1388 1389 """
1389 1390 etype, value, last_traceback = sys.exc_info()
1390 1391
1391 1392 # See note about these variables in showtraceback() below
1392 1393 sys.last_type = etype
1393 1394 sys.last_value = value
1394 1395 sys.last_traceback = last_traceback
1395 1396
1396 1397 if filename and etype is SyntaxError:
1397 1398 # Work hard to stuff the correct filename in the exception
1398 1399 try:
1399 1400 msg, (dummy_filename, lineno, offset, line) = value
1400 1401 except:
1401 1402 # Not the format we expect; leave it alone
1402 1403 pass
1403 1404 else:
1404 1405 # Stuff in the right filename
1405 1406 try:
1406 1407 # Assume SyntaxError is a class exception
1407 1408 value = SyntaxError(msg, (filename, lineno, offset, line))
1408 1409 except:
1409 1410 # If that failed, assume SyntaxError is a string
1410 1411 value = msg, (filename, lineno, offset, line)
1411 1412 self.SyntaxTB(etype,value,[])
1412 1413
1413 1414 def debugger(self,force=False):
1414 1415 """Call the pydb/pdb debugger.
1415 1416
1416 1417 Keywords:
1417 1418
1418 1419 - force(False): by default, this routine checks the instance call_pdb
1419 1420 flag and does not actually invoke the debugger if the flag is false.
1420 1421 The 'force' option forces the debugger to activate even if the flag
1421 1422 is false.
1422 1423 """
1423 1424
1424 1425 if not (force or self.call_pdb):
1425 1426 return
1426 1427
1427 1428 if not hasattr(sys,'last_traceback'):
1428 1429 error('No traceback has been produced, nothing to debug.')
1429 1430 return
1430 1431
1431 1432 # use pydb if available
1432 1433 if Debugger.has_pydb:
1433 1434 from pydb import pm
1434 1435 else:
1435 1436 # fallback to our internal debugger
1436 1437 pm = lambda : self.InteractiveTB.debugger(force=True)
1437 1438 self.history_saving_wrapper(pm)()
1438 1439
1439 1440 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1440 1441 """Display the exception that just occurred.
1441 1442
1442 1443 If nothing is known about the exception, this is the method which
1443 1444 should be used throughout the code for presenting user tracebacks,
1444 1445 rather than directly invoking the InteractiveTB object.
1445 1446
1446 1447 A specific showsyntaxerror() also exists, but this method can take
1447 1448 care of calling it if needed, so unless you are explicitly catching a
1448 1449 SyntaxError exception, don't try to analyze the stack manually and
1449 1450 simply call this method."""
1450 1451
1451 1452
1452 1453 # Though this won't be called by syntax errors in the input line,
1453 1454 # there may be SyntaxError cases whith imported code.
1454 1455
1455 1456
1456 1457 if exc_tuple is None:
1457 1458 etype, value, tb = sys.exc_info()
1458 1459 else:
1459 1460 etype, value, tb = exc_tuple
1460 1461
1461 1462 if etype is SyntaxError:
1462 1463 self.showsyntaxerror(filename)
1463 1464 else:
1464 1465 # WARNING: these variables are somewhat deprecated and not
1465 1466 # necessarily safe to use in a threaded environment, but tools
1466 1467 # like pdb depend on their existence, so let's set them. If we
1467 1468 # find problems in the field, we'll need to revisit their use.
1468 1469 sys.last_type = etype
1469 1470 sys.last_value = value
1470 1471 sys.last_traceback = tb
1471 1472
1472 1473 if etype in self.custom_exceptions:
1473 1474 self.CustomTB(etype,value,tb)
1474 1475 else:
1475 1476 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1476 1477 if self.InteractiveTB.call_pdb and self.has_readline:
1477 1478 # pdb mucks up readline, fix it back
1478 1479 self.set_completer()
1479 1480
1480 1481
1481 1482 def mainloop(self,banner=None):
1482 1483 """Creates the local namespace and starts the mainloop.
1483 1484
1484 1485 If an optional banner argument is given, it will override the
1485 1486 internally created default banner."""
1486 1487
1487 1488 if self.rc.c: # Emulate Python's -c option
1488 1489 self.exec_init_cmd()
1489 1490 if banner is None:
1490 1491 if not self.rc.banner:
1491 1492 banner = ''
1492 1493 # banner is string? Use it directly!
1493 1494 elif isinstance(self.rc.banner,basestring):
1494 1495 banner = self.rc.banner
1495 1496 else:
1496 1497 banner = self.BANNER+self.banner2
1497 1498
1498 1499 self.interact(banner)
1499 1500
1500 1501 def exec_init_cmd(self):
1501 1502 """Execute a command given at the command line.
1502 1503
1503 1504 This emulates Python's -c option."""
1504 1505
1505 1506 #sys.argv = ['-c']
1506 1507 self.push(self.prefilter(self.rc.c, False))
1507 1508 self.exit_now = True
1508 1509
1509 1510 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1510 1511 """Embeds IPython into a running python program.
1511 1512
1512 1513 Input:
1513 1514
1514 1515 - header: An optional header message can be specified.
1515 1516
1516 1517 - local_ns, global_ns: working namespaces. If given as None, the
1517 1518 IPython-initialized one is updated with __main__.__dict__, so that
1518 1519 program variables become visible but user-specific configuration
1519 1520 remains possible.
1520 1521
1521 1522 - stack_depth: specifies how many levels in the stack to go to
1522 1523 looking for namespaces (when local_ns and global_ns are None). This
1523 1524 allows an intermediate caller to make sure that this function gets
1524 1525 the namespace from the intended level in the stack. By default (0)
1525 1526 it will get its locals and globals from the immediate caller.
1526 1527
1527 1528 Warning: it's possible to use this in a program which is being run by
1528 1529 IPython itself (via %run), but some funny things will happen (a few
1529 1530 globals get overwritten). In the future this will be cleaned up, as
1530 1531 there is no fundamental reason why it can't work perfectly."""
1531 1532
1532 1533 # Get locals and globals from caller
1533 1534 if local_ns is None or global_ns is None:
1534 1535 call_frame = sys._getframe(stack_depth).f_back
1535 1536
1536 1537 if local_ns is None:
1537 1538 local_ns = call_frame.f_locals
1538 1539 if global_ns is None:
1539 1540 global_ns = call_frame.f_globals
1540 1541
1541 1542 # Update namespaces and fire up interpreter
1542 1543
1543 1544 # The global one is easy, we can just throw it in
1544 1545 self.user_global_ns = global_ns
1545 1546
1546 1547 # but the user/local one is tricky: ipython needs it to store internal
1547 1548 # data, but we also need the locals. We'll copy locals in the user
1548 1549 # one, but will track what got copied so we can delete them at exit.
1549 1550 # This is so that a later embedded call doesn't see locals from a
1550 1551 # previous call (which most likely existed in a separate scope).
1551 1552 local_varnames = local_ns.keys()
1552 1553 self.user_ns.update(local_ns)
1553 1554
1554 1555 # Patch for global embedding to make sure that things don't overwrite
1555 1556 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1556 1557 # FIXME. Test this a bit more carefully (the if.. is new)
1557 1558 if local_ns is None and global_ns is None:
1558 1559 self.user_global_ns.update(__main__.__dict__)
1559 1560
1560 1561 # make sure the tab-completer has the correct frame information, so it
1561 1562 # actually completes using the frame's locals/globals
1562 1563 self.set_completer_frame()
1563 1564
1564 1565 # before activating the interactive mode, we need to make sure that
1565 1566 # all names in the builtin namespace needed by ipython point to
1566 1567 # ourselves, and not to other instances.
1567 1568 self.add_builtins()
1568 1569
1569 1570 self.interact(header)
1570 1571
1571 1572 # now, purge out the user namespace from anything we might have added
1572 1573 # from the caller's local namespace
1573 1574 delvar = self.user_ns.pop
1574 1575 for var in local_varnames:
1575 1576 delvar(var,None)
1576 1577 # and clean builtins we may have overridden
1577 1578 self.clean_builtins()
1578 1579
1579 1580 def interact(self, banner=None):
1580 1581 """Closely emulate the interactive Python console.
1581 1582
1582 1583 The optional banner argument specify the banner to print
1583 1584 before the first interaction; by default it prints a banner
1584 1585 similar to the one printed by the real Python interpreter,
1585 1586 followed by the current class name in parentheses (so as not
1586 1587 to confuse this with the real interpreter -- since it's so
1587 1588 close!).
1588 1589
1589 1590 """
1590 1591
1591 1592 if self.exit_now:
1592 1593 # batch run -> do not interact
1593 1594 return
1594 1595 cprt = 'Type "copyright", "credits" or "license" for more information.'
1595 1596 if banner is None:
1596 1597 self.write("Python %s on %s\n%s\n(%s)\n" %
1597 1598 (sys.version, sys.platform, cprt,
1598 1599 self.__class__.__name__))
1599 1600 else:
1600 1601 self.write(banner)
1601 1602
1602 1603 more = 0
1603 1604
1604 1605 # Mark activity in the builtins
1605 1606 __builtin__.__dict__['__IPYTHON__active'] += 1
1606 1607
1607 1608 if readline.have_readline:
1608 1609 self.readline_startup_hook(self.pre_readline)
1609 1610 # exit_now is set by a call to %Exit or %Quit
1610 1611
1611 1612 while not self.exit_now:
1612 1613 if more:
1613 1614 prompt = self.hooks.generate_prompt(True)
1614 1615 if self.autoindent:
1615 1616 self.rl_do_indent = True
1616 1617
1617 1618 else:
1618 1619 prompt = self.hooks.generate_prompt(False)
1619 1620 try:
1620 1621 line = self.raw_input(prompt,more)
1621 1622 if self.exit_now:
1622 1623 # quick exit on sys.std[in|out] close
1623 1624 break
1624 1625 if self.autoindent:
1625 1626 self.rl_do_indent = False
1626 1627
1627 1628 except KeyboardInterrupt:
1628 1629 self.write('\nKeyboardInterrupt\n')
1629 1630 self.resetbuffer()
1630 1631 # keep cache in sync with the prompt counter:
1631 1632 self.outputcache.prompt_count -= 1
1632 1633
1633 1634 if self.autoindent:
1634 1635 self.indent_current_nsp = 0
1635 1636 more = 0
1636 1637 except EOFError:
1637 1638 if self.autoindent:
1638 1639 self.rl_do_indent = False
1639 1640 self.readline_startup_hook(None)
1640 1641 self.write('\n')
1641 1642 self.exit()
1642 1643 except bdb.BdbQuit:
1643 1644 warn('The Python debugger has exited with a BdbQuit exception.\n'
1644 1645 'Because of how pdb handles the stack, it is impossible\n'
1645 1646 'for IPython to properly format this particular exception.\n'
1646 1647 'IPython will resume normal operation.')
1647 1648 except:
1648 1649 # exceptions here are VERY RARE, but they can be triggered
1649 1650 # asynchronously by signal handlers, for example.
1650 1651 self.showtraceback()
1651 1652 else:
1652 1653 more = self.push(line)
1653 1654 if (self.SyntaxTB.last_syntax_error and
1654 1655 self.rc.autoedit_syntax):
1655 1656 self.edit_syntax_error()
1656 1657
1657 1658 # We are off again...
1658 1659 __builtin__.__dict__['__IPYTHON__active'] -= 1
1659 1660
1660 1661 def excepthook(self, etype, value, tb):
1661 1662 """One more defense for GUI apps that call sys.excepthook.
1662 1663
1663 1664 GUI frameworks like wxPython trap exceptions and call
1664 1665 sys.excepthook themselves. I guess this is a feature that
1665 1666 enables them to keep running after exceptions that would
1666 1667 otherwise kill their mainloop. This is a bother for IPython
1667 1668 which excepts to catch all of the program exceptions with a try:
1668 1669 except: statement.
1669 1670
1670 1671 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1671 1672 any app directly invokes sys.excepthook, it will look to the user like
1672 1673 IPython crashed. In order to work around this, we can disable the
1673 1674 CrashHandler and replace it with this excepthook instead, which prints a
1674 1675 regular traceback using our InteractiveTB. In this fashion, apps which
1675 1676 call sys.excepthook will generate a regular-looking exception from
1676 1677 IPython, and the CrashHandler will only be triggered by real IPython
1677 1678 crashes.
1678 1679
1679 1680 This hook should be used sparingly, only in places which are not likely
1680 1681 to be true IPython errors.
1681 1682 """
1682 1683 self.showtraceback((etype,value,tb),tb_offset=0)
1683 1684
1684 1685 def expand_aliases(self,fn,rest):
1685 1686 """ Expand multiple levels of aliases:
1686 1687
1687 1688 if:
1688 1689
1689 1690 alias foo bar /tmp
1690 1691 alias baz foo
1691 1692
1692 1693 then:
1693 1694
1694 1695 baz huhhahhei -> bar /tmp huhhahhei
1695 1696
1696 1697 """
1697 1698 line = fn + " " + rest
1698 1699
1699 1700 done = Set()
1700 1701 while 1:
1701 1702 pre,fn,rest = prefilter.splitUserInput(line,
1702 1703 prefilter.shell_line_split)
1703 1704 if fn in self.alias_table:
1704 1705 if fn in done:
1705 1706 warn("Cyclic alias definition, repeated '%s'" % fn)
1706 1707 return ""
1707 1708 done.add(fn)
1708 1709
1709 1710 l2 = self.transform_alias(fn,rest)
1710 1711 # dir -> dir
1711 1712 # print "alias",line, "->",l2 #dbg
1712 1713 if l2 == line:
1713 1714 break
1714 1715 # ls -> ls -F should not recurse forever
1715 1716 if l2.split(None,1)[0] == line.split(None,1)[0]:
1716 1717 line = l2
1717 1718 break
1718 1719
1719 1720 line=l2
1720 1721
1721 1722
1722 1723 # print "al expand to",line #dbg
1723 1724 else:
1724 1725 break
1725 1726
1726 1727 return line
1727 1728
1728 1729 def transform_alias(self, alias,rest=''):
1729 1730 """ Transform alias to system command string.
1730 1731 """
1731 1732 nargs,cmd = self.alias_table[alias]
1732 1733 if ' ' in cmd and os.path.isfile(cmd):
1733 1734 cmd = '"%s"' % cmd
1734 1735
1735 1736 # Expand the %l special to be the user's input line
1736 1737 if cmd.find('%l') >= 0:
1737 1738 cmd = cmd.replace('%l',rest)
1738 1739 rest = ''
1739 1740 if nargs==0:
1740 1741 # Simple, argument-less aliases
1741 1742 cmd = '%s %s' % (cmd,rest)
1742 1743 else:
1743 1744 # Handle aliases with positional arguments
1744 1745 args = rest.split(None,nargs)
1745 1746 if len(args)< nargs:
1746 1747 error('Alias <%s> requires %s arguments, %s given.' %
1747 1748 (alias,nargs,len(args)))
1748 1749 return None
1749 1750 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1750 1751 # Now call the macro, evaluating in the user's namespace
1751 1752 #print 'new command: <%r>' % cmd # dbg
1752 1753 return cmd
1753 1754
1754 1755 def call_alias(self,alias,rest=''):
1755 1756 """Call an alias given its name and the rest of the line.
1756 1757
1757 1758 This is only used to provide backwards compatibility for users of
1758 1759 ipalias(), use of which is not recommended for anymore."""
1759 1760
1760 1761 # Now call the macro, evaluating in the user's namespace
1761 1762 cmd = self.transform_alias(alias, rest)
1762 1763 try:
1763 1764 self.system(cmd)
1764 1765 except:
1765 1766 self.showtraceback()
1766 1767
1767 1768 def indent_current_str(self):
1768 1769 """return the current level of indentation as a string"""
1769 1770 return self.indent_current_nsp * ' '
1770 1771
1771 1772 def autoindent_update(self,line):
1772 1773 """Keep track of the indent level."""
1773 1774
1774 1775 #debugx('line')
1775 1776 #debugx('self.indent_current_nsp')
1776 1777 if self.autoindent:
1777 1778 if line:
1778 1779 inisp = num_ini_spaces(line)
1779 1780 if inisp < self.indent_current_nsp:
1780 1781 self.indent_current_nsp = inisp
1781 1782
1782 1783 if line[-1] == ':':
1783 1784 self.indent_current_nsp += 4
1784 1785 elif dedent_re.match(line):
1785 1786 self.indent_current_nsp -= 4
1786 1787 else:
1787 1788 self.indent_current_nsp = 0
1788 1789
1789 1790 def runlines(self,lines):
1790 1791 """Run a string of one or more lines of source.
1791 1792
1792 1793 This method is capable of running a string containing multiple source
1793 1794 lines, as if they had been entered at the IPython prompt. Since it
1794 1795 exposes IPython's processing machinery, the given strings can contain
1795 1796 magic calls (%magic), special shell access (!cmd), etc."""
1796 1797
1797 1798 # We must start with a clean buffer, in case this is run from an
1798 1799 # interactive IPython session (via a magic, for example).
1799 1800 self.resetbuffer()
1800 1801 lines = lines.split('\n')
1801 1802 more = 0
1802 1803 for line in lines:
1803 1804 # skip blank lines so we don't mess up the prompt counter, but do
1804 1805 # NOT skip even a blank line if we are in a code block (more is
1805 1806 # true)
1806 1807 if line or more:
1807 1808 more = self.push(self.prefilter(line,more))
1808 1809 # IPython's runsource returns None if there was an error
1809 1810 # compiling the code. This allows us to stop processing right
1810 1811 # away, so the user gets the error message at the right place.
1811 1812 if more is None:
1812 1813 break
1813 1814 # final newline in case the input didn't have it, so that the code
1814 1815 # actually does get executed
1815 1816 if more:
1816 1817 self.push('\n')
1817 1818
1818 1819 def runsource(self, source, filename='<input>', symbol='single'):
1819 1820 """Compile and run some source in the interpreter.
1820 1821
1821 1822 Arguments are as for compile_command().
1822 1823
1823 1824 One several things can happen:
1824 1825
1825 1826 1) The input is incorrect; compile_command() raised an
1826 1827 exception (SyntaxError or OverflowError). A syntax traceback
1827 1828 will be printed by calling the showsyntaxerror() method.
1828 1829
1829 1830 2) The input is incomplete, and more input is required;
1830 1831 compile_command() returned None. Nothing happens.
1831 1832
1832 1833 3) The input is complete; compile_command() returned a code
1833 1834 object. The code is executed by calling self.runcode() (which
1834 1835 also handles run-time exceptions, except for SystemExit).
1835 1836
1836 1837 The return value is:
1837 1838
1838 1839 - True in case 2
1839 1840
1840 1841 - False in the other cases, unless an exception is raised, where
1841 1842 None is returned instead. This can be used by external callers to
1842 1843 know whether to continue feeding input or not.
1843 1844
1844 1845 The return value can be used to decide whether to use sys.ps1 or
1845 1846 sys.ps2 to prompt the next line."""
1846 1847
1847 1848 # if the source code has leading blanks, add 'if 1:\n' to it
1848 1849 # this allows execution of indented pasted code. It is tempting
1849 1850 # to add '\n' at the end of source to run commands like ' a=1'
1850 1851 # directly, but this fails for more complicated scenarios
1851 1852 if source[:1] in [' ', '\t']:
1852 1853 source = 'if 1:\n%s' % source
1853 1854
1854 1855 try:
1855 1856 code = self.compile(source,filename,symbol)
1856 1857 except (OverflowError, SyntaxError, ValueError):
1857 1858 # Case 1
1858 1859 self.showsyntaxerror(filename)
1859 1860 return None
1860 1861
1861 1862 if code is None:
1862 1863 # Case 2
1863 1864 return True
1864 1865
1865 1866 # Case 3
1866 1867 # We store the code object so that threaded shells and
1867 1868 # custom exception handlers can access all this info if needed.
1868 1869 # The source corresponding to this can be obtained from the
1869 1870 # buffer attribute as '\n'.join(self.buffer).
1870 1871 self.code_to_run = code
1871 1872 # now actually execute the code object
1872 1873 if self.runcode(code) == 0:
1873 1874 return False
1874 1875 else:
1875 1876 return None
1876 1877
1877 1878 def runcode(self,code_obj):
1878 1879 """Execute a code object.
1879 1880
1880 1881 When an exception occurs, self.showtraceback() is called to display a
1881 1882 traceback.
1882 1883
1883 1884 Return value: a flag indicating whether the code to be run completed
1884 1885 successfully:
1885 1886
1886 1887 - 0: successful execution.
1887 1888 - 1: an error occurred.
1888 1889 """
1889 1890
1890 1891 # Set our own excepthook in case the user code tries to call it
1891 1892 # directly, so that the IPython crash handler doesn't get triggered
1892 1893 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1893 1894
1894 1895 # we save the original sys.excepthook in the instance, in case config
1895 1896 # code (such as magics) needs access to it.
1896 1897 self.sys_excepthook = old_excepthook
1897 1898 outflag = 1 # happens in more places, so it's easier as default
1898 1899 try:
1899 1900 try:
1900 1901 # Embedded instances require separate global/local namespaces
1901 1902 # so they can see both the surrounding (local) namespace and
1902 1903 # the module-level globals when called inside another function.
1903 1904 if self.embedded:
1904 1905 exec code_obj in self.user_global_ns, self.user_ns
1905 1906 # Normal (non-embedded) instances should only have a single
1906 1907 # namespace for user code execution, otherwise functions won't
1907 1908 # see interactive top-level globals.
1908 1909 else:
1909 1910 exec code_obj in self.user_ns
1910 1911 finally:
1911 1912 # Reset our crash handler in place
1912 1913 sys.excepthook = old_excepthook
1913 1914 except SystemExit:
1914 1915 self.resetbuffer()
1915 1916 self.showtraceback()
1916 1917 warn("Type %exit or %quit to exit IPython "
1917 1918 "(%Exit or %Quit do so unconditionally).",level=1)
1918 1919 except self.custom_exceptions:
1919 1920 etype,value,tb = sys.exc_info()
1920 1921 self.CustomTB(etype,value,tb)
1921 1922 except:
1922 1923 self.showtraceback()
1923 1924 else:
1924 1925 outflag = 0
1925 1926 if softspace(sys.stdout, 0):
1926 1927 print
1927 1928 # Flush out code object which has been run (and source)
1928 1929 self.code_to_run = None
1929 1930 return outflag
1930 1931
1931 1932 def push(self, line):
1932 1933 """Push a line to the interpreter.
1933 1934
1934 1935 The line should not have a trailing newline; it may have
1935 1936 internal newlines. The line is appended to a buffer and the
1936 1937 interpreter's runsource() method is called with the
1937 1938 concatenated contents of the buffer as source. If this
1938 1939 indicates that the command was executed or invalid, the buffer
1939 1940 is reset; otherwise, the command is incomplete, and the buffer
1940 1941 is left as it was after the line was appended. The return
1941 1942 value is 1 if more input is required, 0 if the line was dealt
1942 1943 with in some way (this is the same as runsource()).
1943 1944 """
1944 1945
1945 1946 # autoindent management should be done here, and not in the
1946 1947 # interactive loop, since that one is only seen by keyboard input. We
1947 1948 # need this done correctly even for code run via runlines (which uses
1948 1949 # push).
1949 1950
1950 1951 #print 'push line: <%s>' % line # dbg
1951 1952 for subline in line.splitlines():
1952 1953 self.autoindent_update(subline)
1953 1954 self.buffer.append(line)
1954 1955 more = self.runsource('\n'.join(self.buffer), self.filename)
1955 1956 if not more:
1956 1957 self.resetbuffer()
1957 1958 return more
1958 1959
1959 1960 def split_user_input(self, line):
1960 1961 # This is really a hold-over to support ipapi and some extensions
1961 1962 return prefilter.splitUserInput(line)
1962 1963
1963 1964 def resetbuffer(self):
1964 1965 """Reset the input buffer."""
1965 1966 self.buffer[:] = []
1966 1967
1967 1968 def raw_input(self,prompt='',continue_prompt=False):
1968 1969 """Write a prompt and read a line.
1969 1970
1970 1971 The returned line does not include the trailing newline.
1971 1972 When the user enters the EOF key sequence, EOFError is raised.
1972 1973
1973 1974 Optional inputs:
1974 1975
1975 1976 - prompt(''): a string to be printed to prompt the user.
1976 1977
1977 1978 - continue_prompt(False): whether this line is the first one or a
1978 1979 continuation in a sequence of inputs.
1979 1980 """
1980 1981
1981 1982 # Code run by the user may have modified the readline completer state.
1982 1983 # We must ensure that our completer is back in place.
1983 1984 if self.has_readline:
1984 1985 self.set_completer()
1985 1986
1986 1987 try:
1987 1988 line = raw_input_original(prompt).decode(self.stdin_encoding)
1988 1989 except ValueError:
1989 1990 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
1990 1991 " or sys.stdout.close()!\nExiting IPython!")
1991 1992 self.exit_now = True
1992 1993 return ""
1993 1994
1994 1995 # Try to be reasonably smart about not re-indenting pasted input more
1995 1996 # than necessary. We do this by trimming out the auto-indent initial
1996 1997 # spaces, if the user's actual input started itself with whitespace.
1997 1998 #debugx('self.buffer[-1]')
1998 1999
1999 2000 if self.autoindent:
2000 2001 if num_ini_spaces(line) > self.indent_current_nsp:
2001 2002 line = line[self.indent_current_nsp:]
2002 2003 self.indent_current_nsp = 0
2003 2004
2004 2005 # store the unfiltered input before the user has any chance to modify
2005 2006 # it.
2006 2007 if line.strip():
2007 2008 if continue_prompt:
2008 2009 self.input_hist_raw[-1] += '%s\n' % line
2009 2010 if self.has_readline: # and some config option is set?
2010 2011 try:
2011 2012 histlen = self.readline.get_current_history_length()
2012 2013 newhist = self.input_hist_raw[-1].rstrip()
2013 2014 self.readline.remove_history_item(histlen-1)
2014 2015 self.readline.replace_history_item(histlen-2,newhist)
2015 2016 except AttributeError:
2016 2017 pass # re{move,place}_history_item are new in 2.4.
2017 2018 else:
2018 2019 self.input_hist_raw.append('%s\n' % line)
2019 2020
2020 2021 if line.lstrip() == line:
2021 2022 self.shadowhist.add(line.strip())
2022 2023
2023 2024 try:
2024 2025 lineout = self.prefilter(line,continue_prompt)
2025 2026 except:
2026 2027 # blanket except, in case a user-defined prefilter crashes, so it
2027 2028 # can't take all of ipython with it.
2028 2029 self.showtraceback()
2029 2030 return ''
2030 2031 else:
2031 2032 return lineout
2032 2033
2033 2034 def _prefilter(self, line, continue_prompt):
2034 2035 """Calls different preprocessors, depending on the form of line."""
2035 2036
2036 2037 # All handlers *must* return a value, even if it's blank ('').
2037 2038
2038 2039 # Lines are NOT logged here. Handlers should process the line as
2039 2040 # needed, update the cache AND log it (so that the input cache array
2040 2041 # stays synced).
2041 2042
2042 2043 #.....................................................................
2043 2044 # Code begins
2044 2045
2045 2046 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2046 2047
2047 2048 # save the line away in case we crash, so the post-mortem handler can
2048 2049 # record it
2049 2050 self._last_input_line = line
2050 2051
2051 2052 #print '***line: <%s>' % line # dbg
2052 2053
2053 2054 line_info = prefilter.LineInfo(line, continue_prompt)
2054 2055
2055 2056 # the input history needs to track even empty lines
2056 2057 stripped = line.strip()
2057 2058
2058 2059 if not stripped:
2059 2060 if not continue_prompt:
2060 2061 self.outputcache.prompt_count -= 1
2061 2062 return self.handle_normal(line_info)
2062 2063
2063 2064 # print '***cont',continue_prompt # dbg
2064 2065 # special handlers are only allowed for single line statements
2065 2066 if continue_prompt and not self.rc.multi_line_specials:
2066 2067 return self.handle_normal(line_info)
2067 2068
2068 2069
2069 2070 # See whether any pre-existing handler can take care of it
2070 2071 rewritten = self.hooks.input_prefilter(stripped)
2071 2072 if rewritten != stripped: # ok, some prefilter did something
2072 2073 rewritten = line_info.pre + rewritten # add indentation
2073 2074 return self.handle_normal(prefilter.LineInfo(rewritten,
2074 2075 continue_prompt))
2075 2076
2076 2077 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2077 2078
2078 2079 return prefilter.prefilter(line_info, self)
2079 2080
2080 2081
2081 2082 def _prefilter_dumb(self, line, continue_prompt):
2082 2083 """simple prefilter function, for debugging"""
2083 2084 return self.handle_normal(line,continue_prompt)
2084 2085
2085 2086
2086 2087 def multiline_prefilter(self, line, continue_prompt):
2087 2088 """ Run _prefilter for each line of input
2088 2089
2089 2090 Covers cases where there are multiple lines in the user entry,
2090 2091 which is the case when the user goes back to a multiline history
2091 2092 entry and presses enter.
2092 2093
2093 2094 """
2094 2095 out = []
2095 2096 for l in line.rstrip('\n').split('\n'):
2096 2097 out.append(self._prefilter(l, continue_prompt))
2097 2098 return '\n'.join(out)
2098 2099
2099 2100 # Set the default prefilter() function (this can be user-overridden)
2100 2101 prefilter = multiline_prefilter
2101 2102
2102 2103 def handle_normal(self,line_info):
2103 2104 """Handle normal input lines. Use as a template for handlers."""
2104 2105
2105 2106 # With autoindent on, we need some way to exit the input loop, and I
2106 2107 # don't want to force the user to have to backspace all the way to
2107 2108 # clear the line. The rule will be in this case, that either two
2108 2109 # lines of pure whitespace in a row, or a line of pure whitespace but
2109 2110 # of a size different to the indent level, will exit the input loop.
2110 2111 line = line_info.line
2111 2112 continue_prompt = line_info.continue_prompt
2112 2113
2113 2114 if (continue_prompt and self.autoindent and line.isspace() and
2114 2115 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2115 2116 (self.buffer[-1]).isspace() )):
2116 2117 line = ''
2117 2118
2118 2119 self.log(line,line,continue_prompt)
2119 2120 return line
2120 2121
2121 2122 def handle_alias(self,line_info):
2122 2123 """Handle alias input lines. """
2124 tgt = self.alias_table[line_info.iFun]
2125 # print "=>",tgt #dbg
2126 if callable(tgt):
2127 line_out = "_sh." + line_info.iFun + '(r"""' + line_info.theRest + '""")'
2128 else:
2123 2129 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2124 2130
2125 2131 # pre is needed, because it carries the leading whitespace. Otherwise
2126 2132 # aliases won't work in indented sections.
2127 2133 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2128 2134 make_quoted_expr( transformed ))
2129 2135
2130 2136 self.log(line_info.line,line_out,line_info.continue_prompt)
2131 2137 #print 'line out:',line_out # dbg
2132 2138 return line_out
2133 2139
2134 2140 def handle_shell_escape(self, line_info):
2135 2141 """Execute the line in a shell, empty return value"""
2136 2142 #print 'line in :', `line` # dbg
2137 2143 line = line_info.line
2138 2144 if line.lstrip().startswith('!!'):
2139 2145 # rewrite LineInfo's line, iFun and theRest to properly hold the
2140 2146 # call to %sx and the actual command to be executed, so
2141 2147 # handle_magic can work correctly. Note that this works even if
2142 2148 # the line is indented, so it handles multi_line_specials
2143 2149 # properly.
2144 2150 new_rest = line.lstrip()[2:]
2145 2151 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2146 2152 line_info.iFun = 'sx'
2147 2153 line_info.theRest = new_rest
2148 2154 return self.handle_magic(line_info)
2149 2155 else:
2150 2156 cmd = line.lstrip().lstrip('!')
2151 2157 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2152 2158 make_quoted_expr(cmd))
2153 2159 # update cache/log and return
2154 2160 self.log(line,line_out,line_info.continue_prompt)
2155 2161 return line_out
2156 2162
2157 2163 def handle_magic(self, line_info):
2158 2164 """Execute magic functions."""
2159 2165 iFun = line_info.iFun
2160 2166 theRest = line_info.theRest
2161 2167 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2162 2168 make_quoted_expr(iFun + " " + theRest))
2163 2169 self.log(line_info.line,cmd,line_info.continue_prompt)
2164 2170 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2165 2171 return cmd
2166 2172
2167 2173 def handle_auto(self, line_info):
2168 2174 """Hande lines which can be auto-executed, quoting if requested."""
2169 2175
2170 2176 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2171 2177 line = line_info.line
2172 2178 iFun = line_info.iFun
2173 2179 theRest = line_info.theRest
2174 2180 pre = line_info.pre
2175 2181 continue_prompt = line_info.continue_prompt
2176 2182 obj = line_info.ofind(self)['obj']
2177 2183
2178 2184 # This should only be active for single-line input!
2179 2185 if continue_prompt:
2180 2186 self.log(line,line,continue_prompt)
2181 2187 return line
2182 2188
2183 2189 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2184 2190 auto_rewrite = True
2185 2191
2186 2192 if pre == self.ESC_QUOTE:
2187 2193 # Auto-quote splitting on whitespace
2188 2194 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2189 2195 elif pre == self.ESC_QUOTE2:
2190 2196 # Auto-quote whole string
2191 2197 newcmd = '%s("%s")' % (iFun,theRest)
2192 2198 elif pre == self.ESC_PAREN:
2193 2199 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2194 2200 else:
2195 2201 # Auto-paren.
2196 2202 # We only apply it to argument-less calls if the autocall
2197 2203 # parameter is set to 2. We only need to check that autocall is <
2198 2204 # 2, since this function isn't called unless it's at least 1.
2199 2205 if not theRest and (self.rc.autocall < 2) and not force_auto:
2200 2206 newcmd = '%s %s' % (iFun,theRest)
2201 2207 auto_rewrite = False
2202 2208 else:
2203 2209 if not force_auto and theRest.startswith('['):
2204 2210 if hasattr(obj,'__getitem__'):
2205 2211 # Don't autocall in this case: item access for an object
2206 2212 # which is BOTH callable and implements __getitem__.
2207 2213 newcmd = '%s %s' % (iFun,theRest)
2208 2214 auto_rewrite = False
2209 2215 else:
2210 2216 # if the object doesn't support [] access, go ahead and
2211 2217 # autocall
2212 2218 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2213 2219 elif theRest.endswith(';'):
2214 2220 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2215 2221 else:
2216 2222 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2217 2223
2218 2224 if auto_rewrite:
2219 2225 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2220 2226
2221 2227 try:
2222 2228 # plain ascii works better w/ pyreadline, on some machines, so
2223 2229 # we use it and only print uncolored rewrite if we have unicode
2224 2230 rw = str(rw)
2225 2231 print >>Term.cout, rw
2226 2232 except UnicodeEncodeError:
2227 2233 print "-------------->" + newcmd
2228 2234
2229 2235 # log what is now valid Python, not the actual user input (without the
2230 2236 # final newline)
2231 2237 self.log(line,newcmd,continue_prompt)
2232 2238 return newcmd
2233 2239
2234 2240 def handle_help(self, line_info):
2235 2241 """Try to get some help for the object.
2236 2242
2237 2243 obj? or ?obj -> basic information.
2238 2244 obj?? or ??obj -> more details.
2239 2245 """
2240 2246
2241 2247 line = line_info.line
2242 2248 # We need to make sure that we don't process lines which would be
2243 2249 # otherwise valid python, such as "x=1 # what?"
2244 2250 try:
2245 2251 codeop.compile_command(line)
2246 2252 except SyntaxError:
2247 2253 # We should only handle as help stuff which is NOT valid syntax
2248 2254 if line[0]==self.ESC_HELP:
2249 2255 line = line[1:]
2250 2256 elif line[-1]==self.ESC_HELP:
2251 2257 line = line[:-1]
2252 2258 self.log(line,'#?'+line,line_info.continue_prompt)
2253 2259 if line:
2254 2260 #print 'line:<%r>' % line # dbg
2255 2261 self.magic_pinfo(line)
2256 2262 else:
2257 2263 page(self.usage,screen_lines=self.rc.screen_length)
2258 2264 return '' # Empty string is needed here!
2259 2265 except:
2260 2266 # Pass any other exceptions through to the normal handler
2261 2267 return self.handle_normal(line_info)
2262 2268 else:
2263 2269 # If the code compiles ok, we should handle it normally
2264 2270 return self.handle_normal(line_info)
2265 2271
2266 2272 def getapi(self):
2267 2273 """ Get an IPApi object for this shell instance
2268 2274
2269 2275 Getting an IPApi object is always preferable to accessing the shell
2270 2276 directly, but this holds true especially for extensions.
2271 2277
2272 2278 It should always be possible to implement an extension with IPApi
2273 2279 alone. If not, contact maintainer to request an addition.
2274 2280
2275 2281 """
2276 2282 return self.api
2277 2283
2278 2284 def handle_emacs(self, line_info):
2279 2285 """Handle input lines marked by python-mode."""
2280 2286
2281 2287 # Currently, nothing is done. Later more functionality can be added
2282 2288 # here if needed.
2283 2289
2284 2290 # The input cache shouldn't be updated
2285 2291 return line_info.line
2286 2292
2287 2293
2288 2294 def mktempfile(self,data=None):
2289 2295 """Make a new tempfile and return its filename.
2290 2296
2291 2297 This makes a call to tempfile.mktemp, but it registers the created
2292 2298 filename internally so ipython cleans it up at exit time.
2293 2299
2294 2300 Optional inputs:
2295 2301
2296 2302 - data(None): if data is given, it gets written out to the temp file
2297 2303 immediately, and the file is closed again."""
2298 2304
2299 2305 filename = tempfile.mktemp('.py','ipython_edit_')
2300 2306 self.tempfiles.append(filename)
2301 2307
2302 2308 if data:
2303 2309 tmp_file = open(filename,'w')
2304 2310 tmp_file.write(data)
2305 2311 tmp_file.close()
2306 2312 return filename
2307 2313
2308 2314 def write(self,data):
2309 2315 """Write a string to the default output"""
2310 2316 Term.cout.write(data)
2311 2317
2312 2318 def write_err(self,data):
2313 2319 """Write a string to the default error output"""
2314 2320 Term.cerr.write(data)
2315 2321
2316 2322 def exit(self):
2317 2323 """Handle interactive exit.
2318 2324
2319 2325 This method sets the exit_now attribute."""
2320 2326
2321 2327 if self.rc.confirm_exit:
2322 2328 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2323 2329 self.exit_now = True
2324 2330 else:
2325 2331 self.exit_now = True
2326 2332
2327 2333 def safe_execfile(self,fname,*where,**kw):
2328 2334 """A safe version of the builtin execfile().
2329 2335
2330 2336 This version will never throw an exception, and knows how to handle
2331 2337 ipython logs as well."""
2332 2338
2333 2339 def syspath_cleanup():
2334 2340 """Internal cleanup routine for sys.path."""
2335 2341 if add_dname:
2336 2342 try:
2337 2343 sys.path.remove(dname)
2338 2344 except ValueError:
2339 2345 # For some reason the user has already removed it, ignore.
2340 2346 pass
2341 2347
2342 2348 fname = os.path.expanduser(fname)
2343 2349
2344 2350 # Find things also in current directory. This is needed to mimic the
2345 2351 # behavior of running a script from the system command line, where
2346 2352 # Python inserts the script's directory into sys.path
2347 2353 dname = os.path.dirname(os.path.abspath(fname))
2348 2354 add_dname = False
2349 2355 if dname not in sys.path:
2350 2356 sys.path.insert(0,dname)
2351 2357 add_dname = True
2352 2358
2353 2359 try:
2354 2360 xfile = open(fname)
2355 2361 except:
2356 2362 print >> Term.cerr, \
2357 2363 'Could not open file <%s> for safe execution.' % fname
2358 2364 syspath_cleanup()
2359 2365 return None
2360 2366
2361 2367 kw.setdefault('islog',0)
2362 2368 kw.setdefault('quiet',1)
2363 2369 kw.setdefault('exit_ignore',0)
2364 2370 first = xfile.readline()
2365 2371 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2366 2372 xfile.close()
2367 2373 # line by line execution
2368 2374 if first.startswith(loghead) or kw['islog']:
2369 2375 print 'Loading log file <%s> one line at a time...' % fname
2370 2376 if kw['quiet']:
2371 2377 stdout_save = sys.stdout
2372 2378 sys.stdout = StringIO.StringIO()
2373 2379 try:
2374 2380 globs,locs = where[0:2]
2375 2381 except:
2376 2382 try:
2377 2383 globs = locs = where[0]
2378 2384 except:
2379 2385 globs = locs = globals()
2380 2386 badblocks = []
2381 2387
2382 2388 # we also need to identify indented blocks of code when replaying
2383 2389 # logs and put them together before passing them to an exec
2384 2390 # statement. This takes a bit of regexp and look-ahead work in the
2385 2391 # file. It's easiest if we swallow the whole thing in memory
2386 2392 # first, and manually walk through the lines list moving the
2387 2393 # counter ourselves.
2388 2394 indent_re = re.compile('\s+\S')
2389 2395 xfile = open(fname)
2390 2396 filelines = xfile.readlines()
2391 2397 xfile.close()
2392 2398 nlines = len(filelines)
2393 2399 lnum = 0
2394 2400 while lnum < nlines:
2395 2401 line = filelines[lnum]
2396 2402 lnum += 1
2397 2403 # don't re-insert logger status info into cache
2398 2404 if line.startswith('#log#'):
2399 2405 continue
2400 2406 else:
2401 2407 # build a block of code (maybe a single line) for execution
2402 2408 block = line
2403 2409 try:
2404 2410 next = filelines[lnum] # lnum has already incremented
2405 2411 except:
2406 2412 next = None
2407 2413 while next and indent_re.match(next):
2408 2414 block += next
2409 2415 lnum += 1
2410 2416 try:
2411 2417 next = filelines[lnum]
2412 2418 except:
2413 2419 next = None
2414 2420 # now execute the block of one or more lines
2415 2421 try:
2416 2422 exec block in globs,locs
2417 2423 except SystemExit:
2418 2424 pass
2419 2425 except:
2420 2426 badblocks.append(block.rstrip())
2421 2427 if kw['quiet']: # restore stdout
2422 2428 sys.stdout.close()
2423 2429 sys.stdout = stdout_save
2424 2430 print 'Finished replaying log file <%s>' % fname
2425 2431 if badblocks:
2426 2432 print >> sys.stderr, ('\nThe following lines/blocks in file '
2427 2433 '<%s> reported errors:' % fname)
2428 2434
2429 2435 for badline in badblocks:
2430 2436 print >> sys.stderr, badline
2431 2437 else: # regular file execution
2432 2438 try:
2433 2439 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2434 2440 # Work around a bug in Python for Windows. The bug was
2435 2441 # fixed in in Python 2.5 r54159 and 54158, but that's still
2436 2442 # SVN Python as of March/07. For details, see:
2437 2443 # http://projects.scipy.org/ipython/ipython/ticket/123
2438 2444 try:
2439 2445 globs,locs = where[0:2]
2440 2446 except:
2441 2447 try:
2442 2448 globs = locs = where[0]
2443 2449 except:
2444 2450 globs = locs = globals()
2445 2451 exec file(fname) in globs,locs
2446 2452 else:
2447 2453 execfile(fname,*where)
2448 2454 except SyntaxError:
2449 2455 self.showsyntaxerror()
2450 2456 warn('Failure executing file: <%s>' % fname)
2451 2457 except SystemExit,status:
2452 2458 if not kw['exit_ignore']:
2453 2459 self.showtraceback()
2454 2460 warn('Failure executing file: <%s>' % fname)
2455 2461 except:
2456 2462 self.showtraceback()
2457 2463 warn('Failure executing file: <%s>' % fname)
2458 2464
2459 2465 syspath_cleanup()
2460 2466
2461 2467 #************************* end of file <iplib.py> *****************************
@@ -1,6824 +1,6838 b''
1 2007-06-28 Ville Vainio <vivainio@gmail.com>
2
3 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
4 Implement "shadow" namespace, and callable aliases that reside there.
5 Use them by:
6
7 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
8
9 foo hello world
10 (gets translated to:)
11 _sh.foo(r"""hello world""")
12
13 In practice, this kind of alias can take the role of a magic function
14
1 15 2007-06-14 Ville Vainio <vivainio@gmail.com>
2 16
3 17 * iplib.py (handle_auto): Try to use ascii for printing "--->"
4 18 autocall rewrite indication, becausesometimes unicode fails to print
5 19 properly (and you get ' - - - '). Use plain uncoloured ---> for
6 20 unicode.
7 21
8 22 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
9 23
10 24 . pickleshare 'hash' commands (hget, hset, hcompress,
11 25 hdict) for efficient shadow history storage.
12 26
13 27 2007-06-13 Ville Vainio <vivainio@gmail.com>
14 28
15 29 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
16 30 Added kw arg 'interactive', tell whether vars should be visible
17 31 with %whos.
18 32
19 33 2007-06-11 Ville Vainio <vivainio@gmail.com>
20 34
21 35 * pspersistence.py, Magic.py, iplib.py: directory history now saved
22 36 to db
23 37
24 38 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
25 39 Also, it exits IPython immediately after evaluating the command (just like
26 40 std python)
27 41
28 42 2007-06-05 Walter Doerwald <walter@livinglogic.de>
29 43
30 44 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
31 45 Python string and captures the output. (Idea and original patch by
32 46 St�fan van der Walt)
33 47
34 48 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
35 49
36 50 * IPython/ultraTB.py (VerboseTB.text): update printing of
37 51 exception types for Python 2.5 (now all exceptions in the stdlib
38 52 are new-style classes).
39 53
40 54 2007-05-31 Walter Doerwald <walter@livinglogic.de>
41 55
42 56 * IPython/Extensions/igrid.py: Add new commands refresh and
43 57 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
44 58 the iterator once (refresh) or after every x seconds (refresh_timer).
45 59 Add a working implementation of "searchexpression", where the text
46 60 entered is not the text to search for, but an expression that must
47 61 be true. Added display of shortcuts to the menu. Added commands "pickinput"
48 62 and "pickinputattr" that put the object or attribute under the cursor
49 63 in the input line. Split the statusbar to be able to display the currently
50 64 active refresh interval. (Patch by Nik Tautenhahn)
51 65
52 66 2007-05-29 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
53 67
54 68 * fixing set_term_title to use ctypes as default
55 69
56 70 * fixing set_term_title fallback to work when curent dir
57 71 is on a windows network share
58 72
59 73 2007-05-28 Ville Vainio <vivainio@gmail.com>
60 74
61 75 * %cpaste: strip + with > from left (diffs).
62 76
63 77 * iplib.py: Fix crash when readline not installed
64 78
65 79 2007-05-26 Ville Vainio <vivainio@gmail.com>
66 80
67 81 * generics.py: intruduce easy to extend result_display generic
68 82 function (using simplegeneric.py).
69 83
70 84 * Fixed the append functionality of %set.
71 85
72 86 2007-05-25 Ville Vainio <vivainio@gmail.com>
73 87
74 88 * New magic: %rep (fetch / run old commands from history)
75 89
76 90 * New extension: mglob (%mglob magic), for powerful glob / find /filter
77 91 like functionality
78 92
79 93 % maghistory.py: %hist -g PATTERM greps the history for pattern
80 94
81 95 2007-05-24 Walter Doerwald <walter@livinglogic.de>
82 96
83 97 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
84 98 browse the IPython input history
85 99
86 100 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
87 101 (mapped to "i") can be used to put the object under the curser in the input
88 102 line. pickinputattr (mapped to "I") does the same for the attribute under
89 103 the cursor.
90 104
91 105 2007-05-24 Ville Vainio <vivainio@gmail.com>
92 106
93 107 * Grand magic cleansing (changeset [2380]):
94 108
95 109 * Introduce ipy_legacy.py where the following magics were
96 110 moved:
97 111
98 112 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
99 113
100 114 If you need them, either use default profile or "import ipy_legacy"
101 115 in your ipy_user_conf.py
102 116
103 117 * Move sh and scipy profile to Extensions from UserConfig. this implies
104 118 you should not edit them, but you don't need to run %upgrade when
105 119 upgrading IPython anymore.
106 120
107 121 * %hist/%history now operates in "raw" mode by default. To get the old
108 122 behaviour, run '%hist -n' (native mode).
109 123
110 124 * split ipy_stock_completers.py to ipy_stock_completers.py and
111 125 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
112 126 installed as default.
113 127
114 128 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
115 129 handling.
116 130
117 131 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
118 132 input if readline is available.
119 133
120 134 2007-05-23 Ville Vainio <vivainio@gmail.com>
121 135
122 136 * macro.py: %store uses __getstate__ properly
123 137
124 138 * exesetup.py: added new setup script for creating
125 139 standalone IPython executables with py2exe (i.e.
126 140 no python installation required).
127 141
128 142 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
129 143 its place.
130 144
131 145 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
132 146
133 147 2007-05-21 Ville Vainio <vivainio@gmail.com>
134 148
135 149 * platutil_win32.py (set_term_title): handle
136 150 failure of 'title' system call properly.
137 151
138 152 2007-05-17 Walter Doerwald <walter@livinglogic.de>
139 153
140 154 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
141 155 (Bug detected by Paul Mueller).
142 156
143 157 2007-05-16 Ville Vainio <vivainio@gmail.com>
144 158
145 159 * ipy_profile_sci.py, ipython_win_post_install.py: Create
146 160 new "sci" profile, effectively a modern version of the old
147 161 "scipy" profile (which is now slated for deprecation).
148 162
149 163 2007-05-15 Ville Vainio <vivainio@gmail.com>
150 164
151 165 * pycolorize.py, pycolor.1: Paul Mueller's patches that
152 166 make pycolorize read input from stdin when run without arguments.
153 167
154 168 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
155 169
156 170 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
157 171 it in sh profile (instead of ipy_system_conf.py).
158 172
159 173 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
160 174 aliases are now lower case on windows (MyCommand.exe => mycommand).
161 175
162 176 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
163 177 Macros are now callable objects that inherit from ipapi.IPyAutocall,
164 178 i.e. get autocalled regardless of system autocall setting.
165 179
166 180 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
167 181
168 182 * IPython/rlineimpl.py: check for clear_history in readline and
169 183 make it a dummy no-op if not available. This function isn't
170 184 guaranteed to be in the API and appeared in Python 2.4, so we need
171 185 to check it ourselves. Also, clean up this file quite a bit.
172 186
173 187 * ipython.1: update man page and full manual with information
174 188 about threads (remove outdated warning). Closes #151.
175 189
176 190 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
177 191
178 192 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
179 193 in trunk (note that this made it into the 0.8.1 release already,
180 194 but the changelogs didn't get coordinated). Many thanks to Gael
181 195 Varoquaux <gael.varoquaux-AT-normalesup.org>
182 196
183 197 2007-05-09 *** Released version 0.8.1
184 198
185 199 2007-05-10 Walter Doerwald <walter@livinglogic.de>
186 200
187 201 * IPython/Extensions/igrid.py: Incorporate html help into
188 202 the module, so we don't have to search for the file.
189 203
190 204 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
191 205
192 206 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
193 207
194 208 2007-04-30 Ville Vainio <vivainio@gmail.com>
195 209
196 210 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
197 211 user has illegal (non-ascii) home directory name
198 212
199 213 2007-04-27 Ville Vainio <vivainio@gmail.com>
200 214
201 215 * platutils_win32.py: implement set_term_title for windows
202 216
203 217 * Update version number
204 218
205 219 * ipy_profile_sh.py: more informative prompt (2 dir levels)
206 220
207 221 2007-04-26 Walter Doerwald <walter@livinglogic.de>
208 222
209 223 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
210 224 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
211 225 bug discovered by Ville).
212 226
213 227 2007-04-26 Ville Vainio <vivainio@gmail.com>
214 228
215 229 * Extensions/ipy_completers.py: Olivier's module completer now
216 230 saves the list of root modules if it takes > 4 secs on the first run.
217 231
218 232 * Magic.py (%rehashx): %rehashx now clears the completer cache
219 233
220 234
221 235 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
222 236
223 237 * ipython.el: fix incorrect color scheme, reported by Stefan.
224 238 Closes #149.
225 239
226 240 * IPython/PyColorize.py (Parser.format2): fix state-handling
227 241 logic. I still don't like how that code handles state, but at
228 242 least now it should be correct, if inelegant. Closes #146.
229 243
230 244 2007-04-25 Ville Vainio <vivainio@gmail.com>
231 245
232 246 * Extensions/ipy_which.py: added extension for %which magic, works
233 247 a lot like unix 'which' but also finds and expands aliases, and
234 248 allows wildcards.
235 249
236 250 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
237 251 as opposed to returning nothing.
238 252
239 253 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
240 254 ipy_stock_completers on default profile, do import on sh profile.
241 255
242 256 2007-04-22 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
243 257
244 258 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
245 259 like ipython.py foo.py which raised a IndexError.
246 260
247 261 2007-04-21 Ville Vainio <vivainio@gmail.com>
248 262
249 263 * Extensions/ipy_extutil.py: added extension to manage other ipython
250 264 extensions. Now only supports 'ls' == list extensions.
251 265
252 266 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
253 267
254 268 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
255 269 would prevent use of the exception system outside of a running
256 270 IPython instance.
257 271
258 272 2007-04-20 Ville Vainio <vivainio@gmail.com>
259 273
260 274 * Extensions/ipy_render.py: added extension for easy
261 275 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
262 276 'Iptl' template notation,
263 277
264 278 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
265 279 safer & faster 'import' completer.
266 280
267 281 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
268 282 and _ip.defalias(name, command).
269 283
270 284 * Extensions/ipy_exportdb.py: New extension for exporting all the
271 285 %store'd data in a portable format (normal ipapi calls like
272 286 defmacro() etc.)
273 287
274 288 2007-04-19 Ville Vainio <vivainio@gmail.com>
275 289
276 290 * upgrade_dir.py: skip junk files like *.pyc
277 291
278 292 * Release.py: version number to 0.8.1
279 293
280 294 2007-04-18 Ville Vainio <vivainio@gmail.com>
281 295
282 296 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
283 297 and later on win32.
284 298
285 299 2007-04-16 Ville Vainio <vivainio@gmail.com>
286 300
287 301 * iplib.py (showtraceback): Do not crash when running w/o readline.
288 302
289 303 2007-04-12 Walter Doerwald <walter@livinglogic.de>
290 304
291 305 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
292 306 sorted (case sensitive with files and dirs mixed).
293 307
294 308 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
295 309
296 310 * IPython/Release.py (version): Open trunk for 0.8.1 development.
297 311
298 312 2007-04-10 *** Released version 0.8.0
299 313
300 314 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
301 315
302 316 * Tag 0.8.0 for release.
303 317
304 318 * IPython/iplib.py (reloadhist): add API function to cleanly
305 319 reload the readline history, which was growing inappropriately on
306 320 every %run call.
307 321
308 322 * win32_manual_post_install.py (run): apply last part of Nicolas
309 323 Pernetty's patch (I'd accidentally applied it in a different
310 324 directory and this particular file didn't get patched).
311 325
312 326 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
313 327
314 328 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
315 329 find the main thread id and use the proper API call. Thanks to
316 330 Stefan for the fix.
317 331
318 332 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
319 333 unit tests to reflect fixed ticket #52, and add more tests sent by
320 334 him.
321 335
322 336 * IPython/iplib.py (raw_input): restore the readline completer
323 337 state on every input, in case third-party code messed it up.
324 338 (_prefilter): revert recent addition of early-escape checks which
325 339 prevent many valid alias calls from working.
326 340
327 341 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
328 342 flag for sigint handler so we don't run a full signal() call on
329 343 each runcode access.
330 344
331 345 * IPython/Magic.py (magic_whos): small improvement to diagnostic
332 346 message.
333 347
334 348 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
335 349
336 350 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
337 351 asynchronous exceptions working, i.e., Ctrl-C can actually
338 352 interrupt long-running code in the multithreaded shells.
339 353
340 354 This is using Tomer Filiba's great ctypes-based trick:
341 355 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
342 356 this in the past, but hadn't been able to make it work before. So
343 357 far it looks like it's actually running, but this needs more
344 358 testing. If it really works, I'll be *very* happy, and we'll owe
345 359 a huge thank you to Tomer. My current implementation is ugly,
346 360 hackish and uses nasty globals, but I don't want to try and clean
347 361 anything up until we know if it actually works.
348 362
349 363 NOTE: this feature needs ctypes to work. ctypes is included in
350 364 Python2.5, but 2.4 users will need to manually install it. This
351 365 feature makes multi-threaded shells so much more usable that it's
352 366 a minor price to pay (ctypes is very easy to install, already a
353 367 requirement for win32 and available in major linux distros).
354 368
355 369 2007-04-04 Ville Vainio <vivainio@gmail.com>
356 370
357 371 * Extensions/ipy_completers.py, ipy_stock_completers.py:
358 372 Moved implementations of 'bundled' completers to ipy_completers.py,
359 373 they are only enabled in ipy_stock_completers.py.
360 374
361 375 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
362 376
363 377 * IPython/PyColorize.py (Parser.format2): Fix identation of
364 378 colorzied output and return early if color scheme is NoColor, to
365 379 avoid unnecessary and expensive tokenization. Closes #131.
366 380
367 381 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
368 382
369 383 * IPython/Debugger.py: disable the use of pydb version 1.17. It
370 384 has a critical bug (a missing import that makes post-mortem not
371 385 work at all). Unfortunately as of this time, this is the version
372 386 shipped with Ubuntu Edgy, so quite a few people have this one. I
373 387 hope Edgy will update to a more recent package.
374 388
375 389 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
376 390
377 391 * IPython/iplib.py (_prefilter): close #52, second part of a patch
378 392 set by Stefan (only the first part had been applied before).
379 393
380 394 * IPython/Extensions/ipy_stock_completers.py (module_completer):
381 395 remove usage of the dangerous pkgutil.walk_packages(). See
382 396 details in comments left in the code.
383 397
384 398 * IPython/Magic.py (magic_whos): add support for numpy arrays
385 399 similar to what we had for Numeric.
386 400
387 401 * IPython/completer.py (IPCompleter.complete): extend the
388 402 complete() call API to support completions by other mechanisms
389 403 than readline. Closes #109.
390 404
391 405 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
392 406 protect against a bug in Python's execfile(). Closes #123.
393 407
394 408 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
395 409
396 410 * IPython/iplib.py (split_user_input): ensure that when splitting
397 411 user input, the part that can be treated as a python name is pure
398 412 ascii (Python identifiers MUST be pure ascii). Part of the
399 413 ongoing Unicode support work.
400 414
401 415 * IPython/Prompts.py (prompt_specials_color): Add \N for the
402 416 actual prompt number, without any coloring. This allows users to
403 417 produce numbered prompts with their own colors. Added after a
404 418 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
405 419
406 420 2007-03-31 Walter Doerwald <walter@livinglogic.de>
407 421
408 422 * IPython/Extensions/igrid.py: Map the return key
409 423 to enter() and shift-return to enterattr().
410 424
411 425 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
412 426
413 427 * IPython/Magic.py (magic_psearch): add unicode support by
414 428 encoding to ascii the input, since this routine also only deals
415 429 with valid Python names. Fixes a bug reported by Stefan.
416 430
417 431 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
418 432
419 433 * IPython/Magic.py (_inspect): convert unicode input into ascii
420 434 before trying to evaluate it as a Python identifier. This fixes a
421 435 problem that the new unicode support had introduced when analyzing
422 436 long definition lines for functions.
423 437
424 438 2007-03-24 Walter Doerwald <walter@livinglogic.de>
425 439
426 440 * IPython/Extensions/igrid.py: Fix picking. Using
427 441 igrid with wxPython 2.6 and -wthread should work now.
428 442 igrid.display() simply tries to create a frame without
429 443 an application. Only if this fails an application is created.
430 444
431 445 2007-03-23 Walter Doerwald <walter@livinglogic.de>
432 446
433 447 * IPython/Extensions/path.py: Updated to version 2.2.
434 448
435 449 2007-03-23 Ville Vainio <vivainio@gmail.com>
436 450
437 451 * iplib.py: recursive alias expansion now works better, so that
438 452 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
439 453 doesn't trip up the process, if 'd' has been aliased to 'ls'.
440 454
441 455 * Extensions/ipy_gnuglobal.py added, provides %global magic
442 456 for users of http://www.gnu.org/software/global
443 457
444 458 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
445 459 Closes #52. Patch by Stefan van der Walt.
446 460
447 461 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
448 462
449 463 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
450 464 respect the __file__ attribute when using %run. Thanks to a bug
451 465 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
452 466
453 467 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
454 468
455 469 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
456 470 input. Patch sent by Stefan.
457 471
458 472 2007-03-20 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
459 473 * IPython/Extensions/ipy_stock_completer.py
460 474 shlex_split, fix bug in shlex_split. len function
461 475 call was missing an if statement. Caused shlex_split to
462 476 sometimes return "" as last element.
463 477
464 478 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
465 479
466 480 * IPython/completer.py
467 481 (IPCompleter.file_matches.single_dir_expand): fix a problem
468 482 reported by Stefan, where directories containign a single subdir
469 483 would be completed too early.
470 484
471 485 * IPython/Shell.py (_load_pylab): Make the execution of 'from
472 486 pylab import *' when -pylab is given be optional. A new flag,
473 487 pylab_import_all controls this behavior, the default is True for
474 488 backwards compatibility.
475 489
476 490 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
477 491 modified) R. Bernstein's patch for fully syntax highlighted
478 492 tracebacks. The functionality is also available under ultraTB for
479 493 non-ipython users (someone using ultraTB but outside an ipython
480 494 session). They can select the color scheme by setting the
481 495 module-level global DEFAULT_SCHEME. The highlight functionality
482 496 also works when debugging.
483 497
484 498 * IPython/genutils.py (IOStream.close): small patch by
485 499 R. Bernstein for improved pydb support.
486 500
487 501 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
488 502 DaveS <davls@telus.net> to improve support of debugging under
489 503 NTEmacs, including improved pydb behavior.
490 504
491 505 * IPython/Magic.py (magic_prun): Fix saving of profile info for
492 506 Python 2.5, where the stats object API changed a little. Thanks
493 507 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
494 508
495 509 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
496 510 Pernetty's patch to improve support for (X)Emacs under Win32.
497 511
498 512 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
499 513
500 514 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
501 515 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
502 516 a report by Nik Tautenhahn.
503 517
504 518 2007-03-16 Walter Doerwald <walter@livinglogic.de>
505 519
506 520 * setup.py: Add the igrid help files to the list of data files
507 521 to be installed alongside igrid.
508 522 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
509 523 Show the input object of the igrid browser as the window tile.
510 524 Show the object the cursor is on in the statusbar.
511 525
512 526 2007-03-15 Ville Vainio <vivainio@gmail.com>
513 527
514 528 * Extensions/ipy_stock_completers.py: Fixed exception
515 529 on mismatching quotes in %run completer. Patch by
516 530 J�rgen Stenarson. Closes #127.
517 531
518 532 2007-03-14 Ville Vainio <vivainio@gmail.com>
519 533
520 534 * Extensions/ext_rehashdir.py: Do not do auto_alias
521 535 in %rehashdir, it clobbers %store'd aliases.
522 536
523 537 * UserConfig/ipy_profile_sh.py: envpersist.py extension
524 538 (beefed up %env) imported for sh profile.
525 539
526 540 2007-03-10 Walter Doerwald <walter@livinglogic.de>
527 541
528 542 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
529 543 as the default browser.
530 544 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
531 545 As igrid displays all attributes it ever encounters, fetch() (which has
532 546 been renamed to _fetch()) doesn't have to recalculate the display attributes
533 547 every time a new item is fetched. This should speed up scrolling.
534 548
535 549 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
536 550
537 551 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
538 552 Schmolck's recently reported tab-completion bug (my previous one
539 553 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
540 554
541 555 2007-03-09 Walter Doerwald <walter@livinglogic.de>
542 556
543 557 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
544 558 Close help window if exiting igrid.
545 559
546 560 2007-03-02 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
547 561
548 562 * IPython/Extensions/ipy_defaults.py: Check if readline is available
549 563 before calling functions from readline.
550 564
551 565 2007-03-02 Walter Doerwald <walter@livinglogic.de>
552 566
553 567 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
554 568 igrid is a wxPython-based display object for ipipe. If your system has
555 569 wx installed igrid will be the default display. Without wx ipipe falls
556 570 back to ibrowse (which needs curses). If no curses is installed ipipe
557 571 falls back to idump.
558 572
559 573 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
560 574
561 575 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
562 576 my changes from yesterday, they introduced bugs. Will reactivate
563 577 once I get a correct solution, which will be much easier thanks to
564 578 Dan Milstein's new prefilter test suite.
565 579
566 580 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
567 581
568 582 * IPython/iplib.py (split_user_input): fix input splitting so we
569 583 don't attempt attribute accesses on things that can't possibly be
570 584 valid Python attributes. After a bug report by Alex Schmolck.
571 585 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
572 586 %magic with explicit % prefix.
573 587
574 588 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
575 589
576 590 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
577 591 avoid a DeprecationWarning from GTK.
578 592
579 593 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
580 594
581 595 * IPython/genutils.py (clock): I modified clock() to return total
582 596 time, user+system. This is a more commonly needed metric. I also
583 597 introduced the new clocku/clocks to get only user/system time if
584 598 one wants those instead.
585 599
586 600 ***WARNING: API CHANGE*** clock() used to return only user time,
587 601 so if you want exactly the same results as before, use clocku
588 602 instead.
589 603
590 604 2007-02-22 Ville Vainio <vivainio@gmail.com>
591 605
592 606 * IPython/Extensions/ipy_p4.py: Extension for improved
593 607 p4 (perforce version control system) experience.
594 608 Adds %p4 magic with p4 command completion and
595 609 automatic -G argument (marshall output as python dict)
596 610
597 611 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
598 612
599 613 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
600 614 stop marks.
601 615 (ClearingMixin): a simple mixin to easily make a Demo class clear
602 616 the screen in between blocks and have empty marquees. The
603 617 ClearDemo and ClearIPDemo classes that use it are included.
604 618
605 619 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
606 620
607 621 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
608 622 protect against exceptions at Python shutdown time. Patch
609 623 sumbmitted to upstream.
610 624
611 625 2007-02-14 Walter Doerwald <walter@livinglogic.de>
612 626
613 627 * IPython/Extensions/ibrowse.py: If entering the first object level
614 628 (i.e. the object for which the browser has been started) fails,
615 629 now the error is raised directly (aborting the browser) instead of
616 630 running into an empty levels list later.
617 631
618 632 2007-02-03 Walter Doerwald <walter@livinglogic.de>
619 633
620 634 * IPython/Extensions/ipipe.py: Add an xrepr implementation
621 635 for the noitem object.
622 636
623 637 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
624 638
625 639 * IPython/completer.py (Completer.attr_matches): Fix small
626 640 tab-completion bug with Enthought Traits objects with units.
627 641 Thanks to a bug report by Tom Denniston
628 642 <tom.denniston-AT-alum.dartmouth.org>.
629 643
630 644 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
631 645
632 646 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
633 647 bug where only .ipy or .py would be completed. Once the first
634 648 argument to %run has been given, all completions are valid because
635 649 they are the arguments to the script, which may well be non-python
636 650 filenames.
637 651
638 652 * IPython/irunner.py (InteractiveRunner.run_source): major updates
639 653 to irunner to allow it to correctly support real doctesting of
640 654 out-of-process ipython code.
641 655
642 656 * IPython/Magic.py (magic_cd): Make the setting of the terminal
643 657 title an option (-noterm_title) because it completely breaks
644 658 doctesting.
645 659
646 660 * IPython/demo.py: fix IPythonDemo class that was not actually working.
647 661
648 662 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
649 663
650 664 * IPython/irunner.py (main): fix small bug where extensions were
651 665 not being correctly recognized.
652 666
653 667 2007-01-23 Walter Doerwald <walter@livinglogic.de>
654 668
655 669 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
656 670 a string containing a single line yields the string itself as the
657 671 only item.
658 672
659 673 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
660 674 object if it's the same as the one on the last level (This avoids
661 675 infinite recursion for one line strings).
662 676
663 677 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
664 678
665 679 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
666 680 all output streams before printing tracebacks. This ensures that
667 681 user output doesn't end up interleaved with traceback output.
668 682
669 683 2007-01-10 Ville Vainio <vivainio@gmail.com>
670 684
671 685 * Extensions/envpersist.py: Turbocharged %env that remembers
672 686 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
673 687 "%env VISUAL=jed".
674 688
675 689 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
676 690
677 691 * IPython/iplib.py (showtraceback): ensure that we correctly call
678 692 custom handlers in all cases (some with pdb were slipping through,
679 693 but I'm not exactly sure why).
680 694
681 695 * IPython/Debugger.py (Tracer.__init__): added new class to
682 696 support set_trace-like usage of IPython's enhanced debugger.
683 697
684 698 2006-12-24 Ville Vainio <vivainio@gmail.com>
685 699
686 700 * ipmaker.py: more informative message when ipy_user_conf
687 701 import fails (suggest running %upgrade).
688 702
689 703 * tools/run_ipy_in_profiler.py: Utility to see where
690 704 the time during IPython startup is spent.
691 705
692 706 2006-12-20 Ville Vainio <vivainio@gmail.com>
693 707
694 708 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
695 709
696 710 * ipapi.py: Add new ipapi method, expand_alias.
697 711
698 712 * Release.py: Bump up version to 0.7.4.svn
699 713
700 714 2006-12-17 Ville Vainio <vivainio@gmail.com>
701 715
702 716 * Extensions/jobctrl.py: Fixed &cmd arg arg...
703 717 to work properly on posix too
704 718
705 719 * Release.py: Update revnum (version is still just 0.7.3).
706 720
707 721 2006-12-15 Ville Vainio <vivainio@gmail.com>
708 722
709 723 * scripts/ipython_win_post_install: create ipython.py in
710 724 prefix + "/scripts".
711 725
712 726 * Release.py: Update version to 0.7.3.
713 727
714 728 2006-12-14 Ville Vainio <vivainio@gmail.com>
715 729
716 730 * scripts/ipython_win_post_install: Overwrite old shortcuts
717 731 if they already exist
718 732
719 733 * Release.py: release 0.7.3rc2
720 734
721 735 2006-12-13 Ville Vainio <vivainio@gmail.com>
722 736
723 737 * Branch and update Release.py for 0.7.3rc1
724 738
725 739 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
726 740
727 741 * IPython/Shell.py (IPShellWX): update for current WX naming
728 742 conventions, to avoid a deprecation warning with current WX
729 743 versions. Thanks to a report by Danny Shevitz.
730 744
731 745 2006-12-12 Ville Vainio <vivainio@gmail.com>
732 746
733 747 * ipmaker.py: apply david cournapeau's patch to make
734 748 import_some work properly even when ipythonrc does
735 749 import_some on empty list (it was an old bug!).
736 750
737 751 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
738 752 Add deprecation note to ipythonrc and a url to wiki
739 753 in ipy_user_conf.py
740 754
741 755
742 756 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
743 757 as if it was typed on IPython command prompt, i.e.
744 758 as IPython script.
745 759
746 760 * example-magic.py, magic_grepl.py: remove outdated examples
747 761
748 762 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
749 763
750 764 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
751 765 is called before any exception has occurred.
752 766
753 767 2006-12-08 Ville Vainio <vivainio@gmail.com>
754 768
755 769 * Extensions/ipy_stock_completers.py: fix cd completer
756 770 to translate /'s to \'s again.
757 771
758 772 * completer.py: prevent traceback on file completions w/
759 773 backslash.
760 774
761 775 * Release.py: Update release number to 0.7.3b3 for release
762 776
763 777 2006-12-07 Ville Vainio <vivainio@gmail.com>
764 778
765 779 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
766 780 while executing external code. Provides more shell-like behaviour
767 781 and overall better response to ctrl + C / ctrl + break.
768 782
769 783 * tools/make_tarball.py: new script to create tarball straight from svn
770 784 (setup.py sdist doesn't work on win32).
771 785
772 786 * Extensions/ipy_stock_completers.py: fix cd completer to give up
773 787 on dirnames with spaces and use the default completer instead.
774 788
775 789 * Revision.py: Change version to 0.7.3b2 for release.
776 790
777 791 2006-12-05 Ville Vainio <vivainio@gmail.com>
778 792
779 793 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
780 794 pydb patch 4 (rm debug printing, py 2.5 checking)
781 795
782 796 2006-11-30 Walter Doerwald <walter@livinglogic.de>
783 797 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
784 798 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
785 799 "refreshfind" (mapped to "R") does the same but tries to go back to the same
786 800 object the cursor was on before the refresh. The command "markrange" is
787 801 mapped to "%" now.
788 802 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
789 803
790 804 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
791 805
792 806 * IPython/Magic.py (magic_debug): new %debug magic to activate the
793 807 interactive debugger on the last traceback, without having to call
794 808 %pdb and rerun your code. Made minor changes in various modules,
795 809 should automatically recognize pydb if available.
796 810
797 811 2006-11-28 Ville Vainio <vivainio@gmail.com>
798 812
799 813 * completer.py: If the text start with !, show file completions
800 814 properly. This helps when trying to complete command name
801 815 for shell escapes.
802 816
803 817 2006-11-27 Ville Vainio <vivainio@gmail.com>
804 818
805 819 * ipy_stock_completers.py: bzr completer submitted by Stefan van
806 820 der Walt. Clean up svn and hg completers by using a common
807 821 vcs_completer.
808 822
809 823 2006-11-26 Ville Vainio <vivainio@gmail.com>
810 824
811 825 * Remove ipconfig and %config; you should use _ip.options structure
812 826 directly instead!
813 827
814 828 * genutils.py: add wrap_deprecated function for deprecating callables
815 829
816 830 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
817 831 _ip.system instead. ipalias is redundant.
818 832
819 833 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
820 834 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
821 835 explicit.
822 836
823 837 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
824 838 completer. Try it by entering 'hg ' and pressing tab.
825 839
826 840 * macro.py: Give Macro a useful __repr__ method
827 841
828 842 * Magic.py: %whos abbreviates the typename of Macro for brevity.
829 843
830 844 2006-11-24 Walter Doerwald <walter@livinglogic.de>
831 845 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
832 846 we don't get a duplicate ipipe module, where registration of the xrepr
833 847 implementation for Text is useless.
834 848
835 849 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
836 850
837 851 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
838 852
839 853 2006-11-24 Ville Vainio <vivainio@gmail.com>
840 854
841 855 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
842 856 try to use "cProfile" instead of the slower pure python
843 857 "profile"
844 858
845 859 2006-11-23 Ville Vainio <vivainio@gmail.com>
846 860
847 861 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
848 862 Qt+IPython+Designer link in documentation.
849 863
850 864 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
851 865 correct Pdb object to %pydb.
852 866
853 867
854 868 2006-11-22 Walter Doerwald <walter@livinglogic.de>
855 869 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
856 870 generic xrepr(), otherwise the list implementation would kick in.
857 871
858 872 2006-11-21 Ville Vainio <vivainio@gmail.com>
859 873
860 874 * upgrade_dir.py: Now actually overwrites a nonmodified user file
861 875 with one from UserConfig.
862 876
863 877 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
864 878 it was missing which broke the sh profile.
865 879
866 880 * completer.py: file completer now uses explicit '/' instead
867 881 of os.path.join, expansion of 'foo' was broken on win32
868 882 if there was one directory with name 'foobar'.
869 883
870 884 * A bunch of patches from Kirill Smelkov:
871 885
872 886 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
873 887
874 888 * [patch 7/9] Implement %page -r (page in raw mode) -
875 889
876 890 * [patch 5/9] ScientificPython webpage has moved
877 891
878 892 * [patch 4/9] The manual mentions %ds, should be %dhist
879 893
880 894 * [patch 3/9] Kill old bits from %prun doc.
881 895
882 896 * [patch 1/9] Fix typos here and there.
883 897
884 898 2006-11-08 Ville Vainio <vivainio@gmail.com>
885 899
886 900 * completer.py (attr_matches): catch all exceptions raised
887 901 by eval of expr with dots.
888 902
889 903 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
890 904
891 905 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
892 906 input if it starts with whitespace. This allows you to paste
893 907 indented input from any editor without manually having to type in
894 908 the 'if 1:', which is convenient when working interactively.
895 909 Slightly modifed version of a patch by Bo Peng
896 910 <bpeng-AT-rice.edu>.
897 911
898 912 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
899 913
900 914 * IPython/irunner.py (main): modified irunner so it automatically
901 915 recognizes the right runner to use based on the extension (.py for
902 916 python, .ipy for ipython and .sage for sage).
903 917
904 918 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
905 919 visible in ipapi as ip.config(), to programatically control the
906 920 internal rc object. There's an accompanying %config magic for
907 921 interactive use, which has been enhanced to match the
908 922 funtionality in ipconfig.
909 923
910 924 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
911 925 so it's not just a toggle, it now takes an argument. Add support
912 926 for a customizable header when making system calls, as the new
913 927 system_header variable in the ipythonrc file.
914 928
915 929 2006-11-03 Walter Doerwald <walter@livinglogic.de>
916 930
917 931 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
918 932 generic functions (using Philip J. Eby's simplegeneric package).
919 933 This makes it possible to customize the display of third-party classes
920 934 without having to monkeypatch them. xiter() no longer supports a mode
921 935 argument and the XMode class has been removed. The same functionality can
922 936 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
923 937 One consequence of the switch to generic functions is that xrepr() and
924 938 xattrs() implementation must define the default value for the mode
925 939 argument themselves and xattrs() implementations must return real
926 940 descriptors.
927 941
928 942 * IPython/external: This new subpackage will contain all third-party
929 943 packages that are bundled with IPython. (The first one is simplegeneric).
930 944
931 945 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
932 946 directory which as been dropped in r1703.
933 947
934 948 * IPython/Extensions/ipipe.py (iless): Fixed.
935 949
936 950 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
937 951
938 952 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
939 953
940 954 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
941 955 handling in variable expansion so that shells and magics recognize
942 956 function local scopes correctly. Bug reported by Brian.
943 957
944 958 * scripts/ipython: remove the very first entry in sys.path which
945 959 Python auto-inserts for scripts, so that sys.path under IPython is
946 960 as similar as possible to that under plain Python.
947 961
948 962 * IPython/completer.py (IPCompleter.file_matches): Fix
949 963 tab-completion so that quotes are not closed unless the completion
950 964 is unambiguous. After a request by Stefan. Minor cleanups in
951 965 ipy_stock_completers.
952 966
953 967 2006-11-02 Ville Vainio <vivainio@gmail.com>
954 968
955 969 * ipy_stock_completers.py: Add %run and %cd completers.
956 970
957 971 * completer.py: Try running custom completer for both
958 972 "foo" and "%foo" if the command is just "foo". Ignore case
959 973 when filtering possible completions.
960 974
961 975 * UserConfig/ipy_user_conf.py: install stock completers as default
962 976
963 977 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
964 978 simplified readline history save / restore through a wrapper
965 979 function
966 980
967 981
968 982 2006-10-31 Ville Vainio <vivainio@gmail.com>
969 983
970 984 * strdispatch.py, completer.py, ipy_stock_completers.py:
971 985 Allow str_key ("command") in completer hooks. Implement
972 986 trivial completer for 'import' (stdlib modules only). Rename
973 987 ipy_linux_package_managers.py to ipy_stock_completers.py.
974 988 SVN completer.
975 989
976 990 * Extensions/ledit.py: %magic line editor for easily and
977 991 incrementally manipulating lists of strings. The magic command
978 992 name is %led.
979 993
980 994 2006-10-30 Ville Vainio <vivainio@gmail.com>
981 995
982 996 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
983 997 Bernsteins's patches for pydb integration.
984 998 http://bashdb.sourceforge.net/pydb/
985 999
986 1000 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
987 1001 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
988 1002 custom completer hook to allow the users to implement their own
989 1003 completers. See ipy_linux_package_managers.py for example. The
990 1004 hook name is 'complete_command'.
991 1005
992 1006 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
993 1007
994 1008 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
995 1009 Numeric leftovers.
996 1010
997 1011 * ipython.el (py-execute-region): apply Stefan's patch to fix
998 1012 garbled results if the python shell hasn't been previously started.
999 1013
1000 1014 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1001 1015 pretty generic function and useful for other things.
1002 1016
1003 1017 * IPython/OInspect.py (getsource): Add customizable source
1004 1018 extractor. After a request/patch form W. Stein (SAGE).
1005 1019
1006 1020 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1007 1021 window size to a more reasonable value from what pexpect does,
1008 1022 since their choice causes wrapping bugs with long input lines.
1009 1023
1010 1024 2006-10-28 Ville Vainio <vivainio@gmail.com>
1011 1025
1012 1026 * Magic.py (%run): Save and restore the readline history from
1013 1027 file around %run commands to prevent side effects from
1014 1028 %runned programs that might use readline (e.g. pydb).
1015 1029
1016 1030 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1017 1031 invoking the pydb enhanced debugger.
1018 1032
1019 1033 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1020 1034
1021 1035 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1022 1036 call the base class method and propagate the return value to
1023 1037 ifile. This is now done by path itself.
1024 1038
1025 1039 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1026 1040
1027 1041 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1028 1042 api: set_crash_handler(), to expose the ability to change the
1029 1043 internal crash handler.
1030 1044
1031 1045 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1032 1046 the various parameters of the crash handler so that apps using
1033 1047 IPython as their engine can customize crash handling. Ipmlemented
1034 1048 at the request of SAGE.
1035 1049
1036 1050 2006-10-14 Ville Vainio <vivainio@gmail.com>
1037 1051
1038 1052 * Magic.py, ipython.el: applied first "safe" part of Rocky
1039 1053 Bernstein's patch set for pydb integration.
1040 1054
1041 1055 * Magic.py (%unalias, %alias): %store'd aliases can now be
1042 1056 removed with '%unalias'. %alias w/o args now shows most
1043 1057 interesting (stored / manually defined) aliases last
1044 1058 where they catch the eye w/o scrolling.
1045 1059
1046 1060 * Magic.py (%rehashx), ext_rehashdir.py: files with
1047 1061 'py' extension are always considered executable, even
1048 1062 when not in PATHEXT environment variable.
1049 1063
1050 1064 2006-10-12 Ville Vainio <vivainio@gmail.com>
1051 1065
1052 1066 * jobctrl.py: Add new "jobctrl" extension for spawning background
1053 1067 processes with "&find /". 'import jobctrl' to try it out. Requires
1054 1068 'subprocess' module, standard in python 2.4+.
1055 1069
1056 1070 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1057 1071 so if foo -> bar and bar -> baz, then foo -> baz.
1058 1072
1059 1073 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1060 1074
1061 1075 * IPython/Magic.py (Magic.parse_options): add a new posix option
1062 1076 to allow parsing of input args in magics that doesn't strip quotes
1063 1077 (if posix=False). This also closes %timeit bug reported by
1064 1078 Stefan.
1065 1079
1066 1080 2006-10-03 Ville Vainio <vivainio@gmail.com>
1067 1081
1068 1082 * iplib.py (raw_input, interact): Return ValueError catching for
1069 1083 raw_input. Fixes infinite loop for sys.stdin.close() or
1070 1084 sys.stdout.close().
1071 1085
1072 1086 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1073 1087
1074 1088 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1075 1089 to help in handling doctests. irunner is now pretty useful for
1076 1090 running standalone scripts and simulate a full interactive session
1077 1091 in a format that can be then pasted as a doctest.
1078 1092
1079 1093 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1080 1094 on top of the default (useless) ones. This also fixes the nasty
1081 1095 way in which 2.5's Quitter() exits (reverted [1785]).
1082 1096
1083 1097 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1084 1098 2.5.
1085 1099
1086 1100 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1087 1101 color scheme is updated as well when color scheme is changed
1088 1102 interactively.
1089 1103
1090 1104 2006-09-27 Ville Vainio <vivainio@gmail.com>
1091 1105
1092 1106 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1093 1107 infinite loop and just exit. It's a hack, but will do for a while.
1094 1108
1095 1109 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1096 1110
1097 1111 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1098 1112 the constructor, this makes it possible to get a list of only directories
1099 1113 or only files.
1100 1114
1101 1115 2006-08-12 Ville Vainio <vivainio@gmail.com>
1102 1116
1103 1117 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1104 1118 they broke unittest
1105 1119
1106 1120 2006-08-11 Ville Vainio <vivainio@gmail.com>
1107 1121
1108 1122 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1109 1123 by resolving issue properly, i.e. by inheriting FakeModule
1110 1124 from types.ModuleType. Pickling ipython interactive data
1111 1125 should still work as usual (testing appreciated).
1112 1126
1113 1127 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1114 1128
1115 1129 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1116 1130 running under python 2.3 with code from 2.4 to fix a bug with
1117 1131 help(). Reported by the Debian maintainers, Norbert Tretkowski
1118 1132 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1119 1133 <afayolle-AT-debian.org>.
1120 1134
1121 1135 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1122 1136
1123 1137 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1124 1138 (which was displaying "quit" twice).
1125 1139
1126 1140 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1127 1141
1128 1142 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1129 1143 the mode argument).
1130 1144
1131 1145 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1132 1146
1133 1147 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1134 1148 not running under IPython.
1135 1149
1136 1150 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1137 1151 and make it iterable (iterating over the attribute itself). Add two new
1138 1152 magic strings for __xattrs__(): If the string starts with "-", the attribute
1139 1153 will not be displayed in ibrowse's detail view (but it can still be
1140 1154 iterated over). This makes it possible to add attributes that are large
1141 1155 lists or generator methods to the detail view. Replace magic attribute names
1142 1156 and _attrname() and _getattr() with "descriptors": For each type of magic
1143 1157 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1144 1158 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1145 1159 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1146 1160 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1147 1161 are still supported.
1148 1162
1149 1163 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1150 1164 fails in ibrowse.fetch(), the exception object is added as the last item
1151 1165 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1152 1166 a generator throws an exception midway through execution.
1153 1167
1154 1168 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1155 1169 encoding into methods.
1156 1170
1157 1171 2006-07-26 Ville Vainio <vivainio@gmail.com>
1158 1172
1159 1173 * iplib.py: history now stores multiline input as single
1160 1174 history entries. Patch by Jorgen Cederlof.
1161 1175
1162 1176 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1163 1177
1164 1178 * IPython/Extensions/ibrowse.py: Make cursor visible over
1165 1179 non existing attributes.
1166 1180
1167 1181 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1168 1182
1169 1183 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1170 1184 error output of the running command doesn't mess up the screen.
1171 1185
1172 1186 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1173 1187
1174 1188 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1175 1189 argument. This sorts the items themselves.
1176 1190
1177 1191 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1178 1192
1179 1193 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1180 1194 Compile expression strings into code objects. This should speed
1181 1195 up ifilter and friends somewhat.
1182 1196
1183 1197 2006-07-08 Ville Vainio <vivainio@gmail.com>
1184 1198
1185 1199 * Magic.py: %cpaste now strips > from the beginning of lines
1186 1200 to ease pasting quoted code from emails. Contributed by
1187 1201 Stefan van der Walt.
1188 1202
1189 1203 2006-06-29 Ville Vainio <vivainio@gmail.com>
1190 1204
1191 1205 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1192 1206 mode, patch contributed by Darren Dale. NEEDS TESTING!
1193 1207
1194 1208 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1195 1209
1196 1210 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1197 1211 a blue background. Fix fetching new display rows when the browser
1198 1212 scrolls more than a screenful (e.g. by using the goto command).
1199 1213
1200 1214 2006-06-27 Ville Vainio <vivainio@gmail.com>
1201 1215
1202 1216 * Magic.py (_inspect, _ofind) Apply David Huard's
1203 1217 patch for displaying the correct docstring for 'property'
1204 1218 attributes.
1205 1219
1206 1220 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1207 1221
1208 1222 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1209 1223 commands into the methods implementing them.
1210 1224
1211 1225 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1212 1226
1213 1227 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1214 1228 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1215 1229 autoindent support was authored by Jin Liu.
1216 1230
1217 1231 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1218 1232
1219 1233 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1220 1234 for keymaps with a custom class that simplifies handling.
1221 1235
1222 1236 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1223 1237
1224 1238 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1225 1239 resizing. This requires Python 2.5 to work.
1226 1240
1227 1241 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1228 1242
1229 1243 * IPython/Extensions/ibrowse.py: Add two new commands to
1230 1244 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1231 1245 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1232 1246 attributes again. Remapped the help command to "?". Display
1233 1247 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1234 1248 as keys for the "home" and "end" commands. Add three new commands
1235 1249 to the input mode for "find" and friends: "delend" (CTRL-K)
1236 1250 deletes to the end of line. "incsearchup" searches upwards in the
1237 1251 command history for an input that starts with the text before the cursor.
1238 1252 "incsearchdown" does the same downwards. Removed a bogus mapping of
1239 1253 the x key to "delete".
1240 1254
1241 1255 2006-06-15 Ville Vainio <vivainio@gmail.com>
1242 1256
1243 1257 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1244 1258 used to create prompts dynamically, instead of the "old" way of
1245 1259 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1246 1260 way still works (it's invoked by the default hook), of course.
1247 1261
1248 1262 * Prompts.py: added generate_output_prompt hook for altering output
1249 1263 prompt
1250 1264
1251 1265 * Release.py: Changed version string to 0.7.3.svn.
1252 1266
1253 1267 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1254 1268
1255 1269 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1256 1270 the call to fetch() always tries to fetch enough data for at least one
1257 1271 full screen. This makes it possible to simply call moveto(0,0,True) in
1258 1272 the constructor. Fix typos and removed the obsolete goto attribute.
1259 1273
1260 1274 2006-06-12 Ville Vainio <vivainio@gmail.com>
1261 1275
1262 1276 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1263 1277 allowing $variable interpolation within multiline statements,
1264 1278 though so far only with "sh" profile for a testing period.
1265 1279 The patch also enables splitting long commands with \ but it
1266 1280 doesn't work properly yet.
1267 1281
1268 1282 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1269 1283
1270 1284 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1271 1285 input history and the position of the cursor in the input history for
1272 1286 the find, findbackwards and goto command.
1273 1287
1274 1288 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1275 1289
1276 1290 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1277 1291 implements the basic functionality of browser commands that require
1278 1292 input. Reimplement the goto, find and findbackwards commands as
1279 1293 subclasses of _CommandInput. Add an input history and keymaps to those
1280 1294 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1281 1295 execute commands.
1282 1296
1283 1297 2006-06-07 Ville Vainio <vivainio@gmail.com>
1284 1298
1285 1299 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1286 1300 running the batch files instead of leaving the session open.
1287 1301
1288 1302 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1289 1303
1290 1304 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1291 1305 the original fix was incomplete. Patch submitted by W. Maier.
1292 1306
1293 1307 2006-06-07 Ville Vainio <vivainio@gmail.com>
1294 1308
1295 1309 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1296 1310 Confirmation prompts can be supressed by 'quiet' option.
1297 1311 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1298 1312
1299 1313 2006-06-06 *** Released version 0.7.2
1300 1314
1301 1315 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1302 1316
1303 1317 * IPython/Release.py (version): Made 0.7.2 final for release.
1304 1318 Repo tagged and release cut.
1305 1319
1306 1320 2006-06-05 Ville Vainio <vivainio@gmail.com>
1307 1321
1308 1322 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1309 1323 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1310 1324
1311 1325 * upgrade_dir.py: try import 'path' module a bit harder
1312 1326 (for %upgrade)
1313 1327
1314 1328 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1315 1329
1316 1330 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1317 1331 instead of looping 20 times.
1318 1332
1319 1333 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1320 1334 correctly at initialization time. Bug reported by Krishna Mohan
1321 1335 Gundu <gkmohan-AT-gmail.com> on the user list.
1322 1336
1323 1337 * IPython/Release.py (version): Mark 0.7.2 version to start
1324 1338 testing for release on 06/06.
1325 1339
1326 1340 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1327 1341
1328 1342 * scripts/irunner: thin script interface so users don't have to
1329 1343 find the module and call it as an executable, since modules rarely
1330 1344 live in people's PATH.
1331 1345
1332 1346 * IPython/irunner.py (InteractiveRunner.__init__): added
1333 1347 delaybeforesend attribute to control delays with newer versions of
1334 1348 pexpect. Thanks to detailed help from pexpect's author, Noah
1335 1349 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1336 1350 correctly (it works in NoColor mode).
1337 1351
1338 1352 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1339 1353 SAGE list, from improper log() calls.
1340 1354
1341 1355 2006-05-31 Ville Vainio <vivainio@gmail.com>
1342 1356
1343 1357 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1344 1358 with args in parens to work correctly with dirs that have spaces.
1345 1359
1346 1360 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1347 1361
1348 1362 * IPython/Logger.py (Logger.logstart): add option to log raw input
1349 1363 instead of the processed one. A -r flag was added to the
1350 1364 %logstart magic used for controlling logging.
1351 1365
1352 1366 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1353 1367
1354 1368 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1355 1369 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1356 1370 recognize the option. After a bug report by Will Maier. This
1357 1371 closes #64 (will do it after confirmation from W. Maier).
1358 1372
1359 1373 * IPython/irunner.py: New module to run scripts as if manually
1360 1374 typed into an interactive environment, based on pexpect. After a
1361 1375 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1362 1376 ipython-user list. Simple unittests in the tests/ directory.
1363 1377
1364 1378 * tools/release: add Will Maier, OpenBSD port maintainer, to
1365 1379 recepients list. We are now officially part of the OpenBSD ports:
1366 1380 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1367 1381 work.
1368 1382
1369 1383 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1370 1384
1371 1385 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1372 1386 so that it doesn't break tkinter apps.
1373 1387
1374 1388 * IPython/iplib.py (_prefilter): fix bug where aliases would
1375 1389 shadow variables when autocall was fully off. Reported by SAGE
1376 1390 author William Stein.
1377 1391
1378 1392 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1379 1393 at what detail level strings are computed when foo? is requested.
1380 1394 This allows users to ask for example that the string form of an
1381 1395 object is only computed when foo?? is called, or even never, by
1382 1396 setting the object_info_string_level >= 2 in the configuration
1383 1397 file. This new option has been added and documented. After a
1384 1398 request by SAGE to be able to control the printing of very large
1385 1399 objects more easily.
1386 1400
1387 1401 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1388 1402
1389 1403 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1390 1404 from sys.argv, to be 100% consistent with how Python itself works
1391 1405 (as seen for example with python -i file.py). After a bug report
1392 1406 by Jeffrey Collins.
1393 1407
1394 1408 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1395 1409 nasty bug which was preventing custom namespaces with -pylab,
1396 1410 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1397 1411 compatibility (long gone from mpl).
1398 1412
1399 1413 * IPython/ipapi.py (make_session): name change: create->make. We
1400 1414 use make in other places (ipmaker,...), it's shorter and easier to
1401 1415 type and say, etc. I'm trying to clean things before 0.7.2 so
1402 1416 that I can keep things stable wrt to ipapi in the chainsaw branch.
1403 1417
1404 1418 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1405 1419 python-mode recognizes our debugger mode. Add support for
1406 1420 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1407 1421 <m.liu.jin-AT-gmail.com> originally written by
1408 1422 doxgen-AT-newsmth.net (with minor modifications for xemacs
1409 1423 compatibility)
1410 1424
1411 1425 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1412 1426 tracebacks when walking the stack so that the stack tracking system
1413 1427 in emacs' python-mode can identify the frames correctly.
1414 1428
1415 1429 * IPython/ipmaker.py (make_IPython): make the internal (and
1416 1430 default config) autoedit_syntax value false by default. Too many
1417 1431 users have complained to me (both on and off-list) about problems
1418 1432 with this option being on by default, so I'm making it default to
1419 1433 off. It can still be enabled by anyone via the usual mechanisms.
1420 1434
1421 1435 * IPython/completer.py (Completer.attr_matches): add support for
1422 1436 PyCrust-style _getAttributeNames magic method. Patch contributed
1423 1437 by <mscott-AT-goldenspud.com>. Closes #50.
1424 1438
1425 1439 * IPython/iplib.py (InteractiveShell.__init__): remove the
1426 1440 deletion of exit/quit from __builtin__, which can break
1427 1441 third-party tools like the Zope debugging console. The
1428 1442 %exit/%quit magics remain. In general, it's probably a good idea
1429 1443 not to delete anything from __builtin__, since we never know what
1430 1444 that will break. In any case, python now (for 2.5) will support
1431 1445 'real' exit/quit, so this issue is moot. Closes #55.
1432 1446
1433 1447 * IPython/genutils.py (with_obj): rename the 'with' function to
1434 1448 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1435 1449 becomes a language keyword. Closes #53.
1436 1450
1437 1451 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1438 1452 __file__ attribute to this so it fools more things into thinking
1439 1453 it is a real module. Closes #59.
1440 1454
1441 1455 * IPython/Magic.py (magic_edit): add -n option to open the editor
1442 1456 at a specific line number. After a patch by Stefan van der Walt.
1443 1457
1444 1458 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1445 1459
1446 1460 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1447 1461 reason the file could not be opened. After automatic crash
1448 1462 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1449 1463 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1450 1464 (_should_recompile): Don't fire editor if using %bg, since there
1451 1465 is no file in the first place. From the same report as above.
1452 1466 (raw_input): protect against faulty third-party prefilters. After
1453 1467 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1454 1468 while running under SAGE.
1455 1469
1456 1470 2006-05-23 Ville Vainio <vivainio@gmail.com>
1457 1471
1458 1472 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1459 1473 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1460 1474 now returns None (again), unless dummy is specifically allowed by
1461 1475 ipapi.get(allow_dummy=True).
1462 1476
1463 1477 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1464 1478
1465 1479 * IPython: remove all 2.2-compatibility objects and hacks from
1466 1480 everywhere, since we only support 2.3 at this point. Docs
1467 1481 updated.
1468 1482
1469 1483 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1470 1484 Anything requiring extra validation can be turned into a Python
1471 1485 property in the future. I used a property for the db one b/c
1472 1486 there was a nasty circularity problem with the initialization
1473 1487 order, which right now I don't have time to clean up.
1474 1488
1475 1489 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1476 1490 another locking bug reported by Jorgen. I'm not 100% sure though,
1477 1491 so more testing is needed...
1478 1492
1479 1493 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1480 1494
1481 1495 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1482 1496 local variables from any routine in user code (typically executed
1483 1497 with %run) directly into the interactive namespace. Very useful
1484 1498 when doing complex debugging.
1485 1499 (IPythonNotRunning): Changed the default None object to a dummy
1486 1500 whose attributes can be queried as well as called without
1487 1501 exploding, to ease writing code which works transparently both in
1488 1502 and out of ipython and uses some of this API.
1489 1503
1490 1504 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1491 1505
1492 1506 * IPython/hooks.py (result_display): Fix the fact that our display
1493 1507 hook was using str() instead of repr(), as the default python
1494 1508 console does. This had gone unnoticed b/c it only happened if
1495 1509 %Pprint was off, but the inconsistency was there.
1496 1510
1497 1511 2006-05-15 Ville Vainio <vivainio@gmail.com>
1498 1512
1499 1513 * Oinspect.py: Only show docstring for nonexisting/binary files
1500 1514 when doing object??, closing ticket #62
1501 1515
1502 1516 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1503 1517
1504 1518 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1505 1519 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1506 1520 was being released in a routine which hadn't checked if it had
1507 1521 been the one to acquire it.
1508 1522
1509 1523 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1510 1524
1511 1525 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1512 1526
1513 1527 2006-04-11 Ville Vainio <vivainio@gmail.com>
1514 1528
1515 1529 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1516 1530 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1517 1531 prefilters, allowing stuff like magics and aliases in the file.
1518 1532
1519 1533 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1520 1534 added. Supported now are "%clear in" and "%clear out" (clear input and
1521 1535 output history, respectively). Also fixed CachedOutput.flush to
1522 1536 properly flush the output cache.
1523 1537
1524 1538 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1525 1539 half-success (and fail explicitly).
1526 1540
1527 1541 2006-03-28 Ville Vainio <vivainio@gmail.com>
1528 1542
1529 1543 * iplib.py: Fix quoting of aliases so that only argless ones
1530 1544 are quoted
1531 1545
1532 1546 2006-03-28 Ville Vainio <vivainio@gmail.com>
1533 1547
1534 1548 * iplib.py: Quote aliases with spaces in the name.
1535 1549 "c:\program files\blah\bin" is now legal alias target.
1536 1550
1537 1551 * ext_rehashdir.py: Space no longer allowed as arg
1538 1552 separator, since space is legal in path names.
1539 1553
1540 1554 2006-03-16 Ville Vainio <vivainio@gmail.com>
1541 1555
1542 1556 * upgrade_dir.py: Take path.py from Extensions, correcting
1543 1557 %upgrade magic
1544 1558
1545 1559 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1546 1560
1547 1561 * hooks.py: Only enclose editor binary in quotes if legal and
1548 1562 necessary (space in the name, and is an existing file). Fixes a bug
1549 1563 reported by Zachary Pincus.
1550 1564
1551 1565 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1552 1566
1553 1567 * Manual: thanks to a tip on proper color handling for Emacs, by
1554 1568 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1555 1569
1556 1570 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1557 1571 by applying the provided patch. Thanks to Liu Jin
1558 1572 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1559 1573 XEmacs/Linux, I'm trusting the submitter that it actually helps
1560 1574 under win32/GNU Emacs. Will revisit if any problems are reported.
1561 1575
1562 1576 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1563 1577
1564 1578 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1565 1579 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1566 1580
1567 1581 2006-03-12 Ville Vainio <vivainio@gmail.com>
1568 1582
1569 1583 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1570 1584 Torsten Marek.
1571 1585
1572 1586 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1573 1587
1574 1588 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1575 1589 line ranges works again.
1576 1590
1577 1591 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1578 1592
1579 1593 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1580 1594 and friends, after a discussion with Zach Pincus on ipython-user.
1581 1595 I'm not 100% sure, but after thinking about it quite a bit, it may
1582 1596 be OK. Testing with the multithreaded shells didn't reveal any
1583 1597 problems, but let's keep an eye out.
1584 1598
1585 1599 In the process, I fixed a few things which were calling
1586 1600 self.InteractiveTB() directly (like safe_execfile), which is a
1587 1601 mistake: ALL exception reporting should be done by calling
1588 1602 self.showtraceback(), which handles state and tab-completion and
1589 1603 more.
1590 1604
1591 1605 2006-03-01 Ville Vainio <vivainio@gmail.com>
1592 1606
1593 1607 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1594 1608 To use, do "from ipipe import *".
1595 1609
1596 1610 2006-02-24 Ville Vainio <vivainio@gmail.com>
1597 1611
1598 1612 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1599 1613 "cleanly" and safely than the older upgrade mechanism.
1600 1614
1601 1615 2006-02-21 Ville Vainio <vivainio@gmail.com>
1602 1616
1603 1617 * Magic.py: %save works again.
1604 1618
1605 1619 2006-02-15 Ville Vainio <vivainio@gmail.com>
1606 1620
1607 1621 * Magic.py: %Pprint works again
1608 1622
1609 1623 * Extensions/ipy_sane_defaults.py: Provide everything provided
1610 1624 in default ipythonrc, to make it possible to have a completely empty
1611 1625 ipythonrc (and thus completely rc-file free configuration)
1612 1626
1613 1627 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1614 1628
1615 1629 * IPython/hooks.py (editor): quote the call to the editor command,
1616 1630 to allow commands with spaces in them. Problem noted by watching
1617 1631 Ian Oswald's video about textpad under win32 at
1618 1632 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1619 1633
1620 1634 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1621 1635 describing magics (we haven't used @ for a loong time).
1622 1636
1623 1637 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1624 1638 contributed by marienz to close
1625 1639 http://www.scipy.net/roundup/ipython/issue53.
1626 1640
1627 1641 2006-02-10 Ville Vainio <vivainio@gmail.com>
1628 1642
1629 1643 * genutils.py: getoutput now works in win32 too
1630 1644
1631 1645 * completer.py: alias and magic completion only invoked
1632 1646 at the first "item" in the line, to avoid "cd %store"
1633 1647 nonsense.
1634 1648
1635 1649 2006-02-09 Ville Vainio <vivainio@gmail.com>
1636 1650
1637 1651 * test/*: Added a unit testing framework (finally).
1638 1652 '%run runtests.py' to run test_*.
1639 1653
1640 1654 * ipapi.py: Exposed runlines and set_custom_exc
1641 1655
1642 1656 2006-02-07 Ville Vainio <vivainio@gmail.com>
1643 1657
1644 1658 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1645 1659 instead use "f(1 2)" as before.
1646 1660
1647 1661 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1648 1662
1649 1663 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1650 1664 facilities, for demos processed by the IPython input filter
1651 1665 (IPythonDemo), and for running a script one-line-at-a-time as a
1652 1666 demo, both for pure Python (LineDemo) and for IPython-processed
1653 1667 input (IPythonLineDemo). After a request by Dave Kohel, from the
1654 1668 SAGE team.
1655 1669 (Demo.edit): added an edit() method to the demo objects, to edit
1656 1670 the in-memory copy of the last executed block.
1657 1671
1658 1672 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1659 1673 processing to %edit, %macro and %save. These commands can now be
1660 1674 invoked on the unprocessed input as it was typed by the user
1661 1675 (without any prefilters applied). After requests by the SAGE team
1662 1676 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1663 1677
1664 1678 2006-02-01 Ville Vainio <vivainio@gmail.com>
1665 1679
1666 1680 * setup.py, eggsetup.py: easy_install ipython==dev works
1667 1681 correctly now (on Linux)
1668 1682
1669 1683 * ipy_user_conf,ipmaker: user config changes, removed spurious
1670 1684 warnings
1671 1685
1672 1686 * iplib: if rc.banner is string, use it as is.
1673 1687
1674 1688 * Magic: %pycat accepts a string argument and pages it's contents.
1675 1689
1676 1690
1677 1691 2006-01-30 Ville Vainio <vivainio@gmail.com>
1678 1692
1679 1693 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1680 1694 Now %store and bookmarks work through PickleShare, meaning that
1681 1695 concurrent access is possible and all ipython sessions see the
1682 1696 same database situation all the time, instead of snapshot of
1683 1697 the situation when the session was started. Hence, %bookmark
1684 1698 results are immediately accessible from othes sessions. The database
1685 1699 is also available for use by user extensions. See:
1686 1700 http://www.python.org/pypi/pickleshare
1687 1701
1688 1702 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1689 1703
1690 1704 * aliases can now be %store'd
1691 1705
1692 1706 * path.py moved to Extensions so that pickleshare does not need
1693 1707 IPython-specific import. Extensions added to pythonpath right
1694 1708 at __init__.
1695 1709
1696 1710 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1697 1711 called with _ip.system and the pre-transformed command string.
1698 1712
1699 1713 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1700 1714
1701 1715 * IPython/iplib.py (interact): Fix that we were not catching
1702 1716 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1703 1717 logic here had to change, but it's fixed now.
1704 1718
1705 1719 2006-01-29 Ville Vainio <vivainio@gmail.com>
1706 1720
1707 1721 * iplib.py: Try to import pyreadline on Windows.
1708 1722
1709 1723 2006-01-27 Ville Vainio <vivainio@gmail.com>
1710 1724
1711 1725 * iplib.py: Expose ipapi as _ip in builtin namespace.
1712 1726 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1713 1727 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1714 1728 syntax now produce _ip.* variant of the commands.
1715 1729
1716 1730 * "_ip.options().autoedit_syntax = 2" automatically throws
1717 1731 user to editor for syntax error correction without prompting.
1718 1732
1719 1733 2006-01-27 Ville Vainio <vivainio@gmail.com>
1720 1734
1721 1735 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1722 1736 'ipython' at argv[0]) executed through command line.
1723 1737 NOTE: this DEPRECATES calling ipython with multiple scripts
1724 1738 ("ipython a.py b.py c.py")
1725 1739
1726 1740 * iplib.py, hooks.py: Added configurable input prefilter,
1727 1741 named 'input_prefilter'. See ext_rescapture.py for example
1728 1742 usage.
1729 1743
1730 1744 * ext_rescapture.py, Magic.py: Better system command output capture
1731 1745 through 'var = !ls' (deprecates user-visible %sc). Same notation
1732 1746 applies for magics, 'var = %alias' assigns alias list to var.
1733 1747
1734 1748 * ipapi.py: added meta() for accessing extension-usable data store.
1735 1749
1736 1750 * iplib.py: added InteractiveShell.getapi(). New magics should be
1737 1751 written doing self.getapi() instead of using the shell directly.
1738 1752
1739 1753 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1740 1754 %store foo >> ~/myfoo.txt to store variables to files (in clean
1741 1755 textual form, not a restorable pickle).
1742 1756
1743 1757 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1744 1758
1745 1759 * usage.py, Magic.py: added %quickref
1746 1760
1747 1761 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1748 1762
1749 1763 * GetoptErrors when invoking magics etc. with wrong args
1750 1764 are now more helpful:
1751 1765 GetoptError: option -l not recognized (allowed: "qb" )
1752 1766
1753 1767 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1754 1768
1755 1769 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1756 1770 computationally intensive blocks don't appear to stall the demo.
1757 1771
1758 1772 2006-01-24 Ville Vainio <vivainio@gmail.com>
1759 1773
1760 1774 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1761 1775 value to manipulate resulting history entry.
1762 1776
1763 1777 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1764 1778 to instance methods of IPApi class, to make extending an embedded
1765 1779 IPython feasible. See ext_rehashdir.py for example usage.
1766 1780
1767 1781 * Merged 1071-1076 from branches/0.7.1
1768 1782
1769 1783
1770 1784 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1771 1785
1772 1786 * tools/release (daystamp): Fix build tools to use the new
1773 1787 eggsetup.py script to build lightweight eggs.
1774 1788
1775 1789 * Applied changesets 1062 and 1064 before 0.7.1 release.
1776 1790
1777 1791 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1778 1792 see the raw input history (without conversions like %ls ->
1779 1793 ipmagic("ls")). After a request from W. Stein, SAGE
1780 1794 (http://modular.ucsd.edu/sage) developer. This information is
1781 1795 stored in the input_hist_raw attribute of the IPython instance, so
1782 1796 developers can access it if needed (it's an InputList instance).
1783 1797
1784 1798 * Versionstring = 0.7.2.svn
1785 1799
1786 1800 * eggsetup.py: A separate script for constructing eggs, creates
1787 1801 proper launch scripts even on Windows (an .exe file in
1788 1802 \python24\scripts).
1789 1803
1790 1804 * ipapi.py: launch_new_instance, launch entry point needed for the
1791 1805 egg.
1792 1806
1793 1807 2006-01-23 Ville Vainio <vivainio@gmail.com>
1794 1808
1795 1809 * Added %cpaste magic for pasting python code
1796 1810
1797 1811 2006-01-22 Ville Vainio <vivainio@gmail.com>
1798 1812
1799 1813 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1800 1814
1801 1815 * Versionstring = 0.7.2.svn
1802 1816
1803 1817 * eggsetup.py: A separate script for constructing eggs, creates
1804 1818 proper launch scripts even on Windows (an .exe file in
1805 1819 \python24\scripts).
1806 1820
1807 1821 * ipapi.py: launch_new_instance, launch entry point needed for the
1808 1822 egg.
1809 1823
1810 1824 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1811 1825
1812 1826 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1813 1827 %pfile foo would print the file for foo even if it was a binary.
1814 1828 Now, extensions '.so' and '.dll' are skipped.
1815 1829
1816 1830 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1817 1831 bug, where macros would fail in all threaded modes. I'm not 100%
1818 1832 sure, so I'm going to put out an rc instead of making a release
1819 1833 today, and wait for feedback for at least a few days.
1820 1834
1821 1835 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1822 1836 it...) the handling of pasting external code with autoindent on.
1823 1837 To get out of a multiline input, the rule will appear for most
1824 1838 users unchanged: two blank lines or change the indent level
1825 1839 proposed by IPython. But there is a twist now: you can
1826 1840 add/subtract only *one or two spaces*. If you add/subtract three
1827 1841 or more (unless you completely delete the line), IPython will
1828 1842 accept that line, and you'll need to enter a second one of pure
1829 1843 whitespace. I know it sounds complicated, but I can't find a
1830 1844 different solution that covers all the cases, with the right
1831 1845 heuristics. Hopefully in actual use, nobody will really notice
1832 1846 all these strange rules and things will 'just work'.
1833 1847
1834 1848 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1835 1849
1836 1850 * IPython/iplib.py (interact): catch exceptions which can be
1837 1851 triggered asynchronously by signal handlers. Thanks to an
1838 1852 automatic crash report, submitted by Colin Kingsley
1839 1853 <tercel-AT-gentoo.org>.
1840 1854
1841 1855 2006-01-20 Ville Vainio <vivainio@gmail.com>
1842 1856
1843 1857 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1844 1858 (%rehashdir, very useful, try it out) of how to extend ipython
1845 1859 with new magics. Also added Extensions dir to pythonpath to make
1846 1860 importing extensions easy.
1847 1861
1848 1862 * %store now complains when trying to store interactively declared
1849 1863 classes / instances of those classes.
1850 1864
1851 1865 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1852 1866 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1853 1867 if they exist, and ipy_user_conf.py with some defaults is created for
1854 1868 the user.
1855 1869
1856 1870 * Startup rehashing done by the config file, not InterpreterExec.
1857 1871 This means system commands are available even without selecting the
1858 1872 pysh profile. It's the sensible default after all.
1859 1873
1860 1874 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1861 1875
1862 1876 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1863 1877 multiline code with autoindent on working. But I am really not
1864 1878 sure, so this needs more testing. Will commit a debug-enabled
1865 1879 version for now, while I test it some more, so that Ville and
1866 1880 others may also catch any problems. Also made
1867 1881 self.indent_current_str() a method, to ensure that there's no
1868 1882 chance of the indent space count and the corresponding string
1869 1883 falling out of sync. All code needing the string should just call
1870 1884 the method.
1871 1885
1872 1886 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1873 1887
1874 1888 * IPython/Magic.py (magic_edit): fix check for when users don't
1875 1889 save their output files, the try/except was in the wrong section.
1876 1890
1877 1891 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1878 1892
1879 1893 * IPython/Magic.py (magic_run): fix __file__ global missing from
1880 1894 script's namespace when executed via %run. After a report by
1881 1895 Vivian.
1882 1896
1883 1897 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1884 1898 when using python 2.4. The parent constructor changed in 2.4, and
1885 1899 we need to track it directly (we can't call it, as it messes up
1886 1900 readline and tab-completion inside our pdb would stop working).
1887 1901 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1888 1902
1889 1903 2006-01-16 Ville Vainio <vivainio@gmail.com>
1890 1904
1891 1905 * Ipython/magic.py: Reverted back to old %edit functionality
1892 1906 that returns file contents on exit.
1893 1907
1894 1908 * IPython/path.py: Added Jason Orendorff's "path" module to
1895 1909 IPython tree, http://www.jorendorff.com/articles/python/path/.
1896 1910 You can get path objects conveniently through %sc, and !!, e.g.:
1897 1911 sc files=ls
1898 1912 for p in files.paths: # or files.p
1899 1913 print p,p.mtime
1900 1914
1901 1915 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1902 1916 now work again without considering the exclusion regexp -
1903 1917 hence, things like ',foo my/path' turn to 'foo("my/path")'
1904 1918 instead of syntax error.
1905 1919
1906 1920
1907 1921 2006-01-14 Ville Vainio <vivainio@gmail.com>
1908 1922
1909 1923 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1910 1924 ipapi decorators for python 2.4 users, options() provides access to rc
1911 1925 data.
1912 1926
1913 1927 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1914 1928 as path separators (even on Linux ;-). Space character after
1915 1929 backslash (as yielded by tab completer) is still space;
1916 1930 "%cd long\ name" works as expected.
1917 1931
1918 1932 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1919 1933 as "chain of command", with priority. API stays the same,
1920 1934 TryNext exception raised by a hook function signals that
1921 1935 current hook failed and next hook should try handling it, as
1922 1936 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
1923 1937 requested configurable display hook, which is now implemented.
1924 1938
1925 1939 2006-01-13 Ville Vainio <vivainio@gmail.com>
1926 1940
1927 1941 * IPython/platutils*.py: platform specific utility functions,
1928 1942 so far only set_term_title is implemented (change terminal
1929 1943 label in windowing systems). %cd now changes the title to
1930 1944 current dir.
1931 1945
1932 1946 * IPython/Release.py: Added myself to "authors" list,
1933 1947 had to create new files.
1934 1948
1935 1949 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1936 1950 shell escape; not a known bug but had potential to be one in the
1937 1951 future.
1938 1952
1939 1953 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1940 1954 extension API for IPython! See the module for usage example. Fix
1941 1955 OInspect for docstring-less magic functions.
1942 1956
1943 1957
1944 1958 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1945 1959
1946 1960 * IPython/iplib.py (raw_input): temporarily deactivate all
1947 1961 attempts at allowing pasting of code with autoindent on. It
1948 1962 introduced bugs (reported by Prabhu) and I can't seem to find a
1949 1963 robust combination which works in all cases. Will have to revisit
1950 1964 later.
1951 1965
1952 1966 * IPython/genutils.py: remove isspace() function. We've dropped
1953 1967 2.2 compatibility, so it's OK to use the string method.
1954 1968
1955 1969 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1956 1970
1957 1971 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1958 1972 matching what NOT to autocall on, to include all python binary
1959 1973 operators (including things like 'and', 'or', 'is' and 'in').
1960 1974 Prompted by a bug report on 'foo & bar', but I realized we had
1961 1975 many more potential bug cases with other operators. The regexp is
1962 1976 self.re_exclude_auto, it's fairly commented.
1963 1977
1964 1978 2006-01-12 Ville Vainio <vivainio@gmail.com>
1965 1979
1966 1980 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1967 1981 Prettified and hardened string/backslash quoting with ipsystem(),
1968 1982 ipalias() and ipmagic(). Now even \ characters are passed to
1969 1983 %magics, !shell escapes and aliases exactly as they are in the
1970 1984 ipython command line. Should improve backslash experience,
1971 1985 particularly in Windows (path delimiter for some commands that
1972 1986 won't understand '/'), but Unix benefits as well (regexps). %cd
1973 1987 magic still doesn't support backslash path delimiters, though. Also
1974 1988 deleted all pretense of supporting multiline command strings in
1975 1989 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1976 1990
1977 1991 * doc/build_doc_instructions.txt added. Documentation on how to
1978 1992 use doc/update_manual.py, added yesterday. Both files contributed
1979 1993 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1980 1994 doc/*.sh for deprecation at a later date.
1981 1995
1982 1996 * /ipython.py Added ipython.py to root directory for
1983 1997 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1984 1998 ipython.py) and development convenience (no need to keep doing
1985 1999 "setup.py install" between changes).
1986 2000
1987 2001 * Made ! and !! shell escapes work (again) in multiline expressions:
1988 2002 if 1:
1989 2003 !ls
1990 2004 !!ls
1991 2005
1992 2006 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1993 2007
1994 2008 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1995 2009 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1996 2010 module in case-insensitive installation. Was causing crashes
1997 2011 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1998 2012
1999 2013 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2000 2014 <marienz-AT-gentoo.org>, closes
2001 2015 http://www.scipy.net/roundup/ipython/issue51.
2002 2016
2003 2017 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2004 2018
2005 2019 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2006 2020 problem of excessive CPU usage under *nix and keyboard lag under
2007 2021 win32.
2008 2022
2009 2023 2006-01-10 *** Released version 0.7.0
2010 2024
2011 2025 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2012 2026
2013 2027 * IPython/Release.py (revision): tag version number to 0.7.0,
2014 2028 ready for release.
2015 2029
2016 2030 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2017 2031 it informs the user of the name of the temp. file used. This can
2018 2032 help if you decide later to reuse that same file, so you know
2019 2033 where to copy the info from.
2020 2034
2021 2035 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2022 2036
2023 2037 * setup_bdist_egg.py: little script to build an egg. Added
2024 2038 support in the release tools as well.
2025 2039
2026 2040 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2027 2041
2028 2042 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2029 2043 version selection (new -wxversion command line and ipythonrc
2030 2044 parameter). Patch contributed by Arnd Baecker
2031 2045 <arnd.baecker-AT-web.de>.
2032 2046
2033 2047 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2034 2048 embedded instances, for variables defined at the interactive
2035 2049 prompt of the embedded ipython. Reported by Arnd.
2036 2050
2037 2051 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2038 2052 it can be used as a (stateful) toggle, or with a direct parameter.
2039 2053
2040 2054 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2041 2055 could be triggered in certain cases and cause the traceback
2042 2056 printer not to work.
2043 2057
2044 2058 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2045 2059
2046 2060 * IPython/iplib.py (_should_recompile): Small fix, closes
2047 2061 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2048 2062
2049 2063 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2050 2064
2051 2065 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2052 2066 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2053 2067 Moad for help with tracking it down.
2054 2068
2055 2069 * IPython/iplib.py (handle_auto): fix autocall handling for
2056 2070 objects which support BOTH __getitem__ and __call__ (so that f [x]
2057 2071 is left alone, instead of becoming f([x]) automatically).
2058 2072
2059 2073 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2060 2074 Ville's patch.
2061 2075
2062 2076 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2063 2077
2064 2078 * IPython/iplib.py (handle_auto): changed autocall semantics to
2065 2079 include 'smart' mode, where the autocall transformation is NOT
2066 2080 applied if there are no arguments on the line. This allows you to
2067 2081 just type 'foo' if foo is a callable to see its internal form,
2068 2082 instead of having it called with no arguments (typically a
2069 2083 mistake). The old 'full' autocall still exists: for that, you
2070 2084 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2071 2085
2072 2086 * IPython/completer.py (Completer.attr_matches): add
2073 2087 tab-completion support for Enthoughts' traits. After a report by
2074 2088 Arnd and a patch by Prabhu.
2075 2089
2076 2090 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2077 2091
2078 2092 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2079 2093 Schmolck's patch to fix inspect.getinnerframes().
2080 2094
2081 2095 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2082 2096 for embedded instances, regarding handling of namespaces and items
2083 2097 added to the __builtin__ one. Multiple embedded instances and
2084 2098 recursive embeddings should work better now (though I'm not sure
2085 2099 I've got all the corner cases fixed, that code is a bit of a brain
2086 2100 twister).
2087 2101
2088 2102 * IPython/Magic.py (magic_edit): added support to edit in-memory
2089 2103 macros (automatically creates the necessary temp files). %edit
2090 2104 also doesn't return the file contents anymore, it's just noise.
2091 2105
2092 2106 * IPython/completer.py (Completer.attr_matches): revert change to
2093 2107 complete only on attributes listed in __all__. I realized it
2094 2108 cripples the tab-completion system as a tool for exploring the
2095 2109 internals of unknown libraries (it renders any non-__all__
2096 2110 attribute off-limits). I got bit by this when trying to see
2097 2111 something inside the dis module.
2098 2112
2099 2113 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2100 2114
2101 2115 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2102 2116 namespace for users and extension writers to hold data in. This
2103 2117 follows the discussion in
2104 2118 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2105 2119
2106 2120 * IPython/completer.py (IPCompleter.complete): small patch to help
2107 2121 tab-completion under Emacs, after a suggestion by John Barnard
2108 2122 <barnarj-AT-ccf.org>.
2109 2123
2110 2124 * IPython/Magic.py (Magic.extract_input_slices): added support for
2111 2125 the slice notation in magics to use N-M to represent numbers N...M
2112 2126 (closed endpoints). This is used by %macro and %save.
2113 2127
2114 2128 * IPython/completer.py (Completer.attr_matches): for modules which
2115 2129 define __all__, complete only on those. After a patch by Jeffrey
2116 2130 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2117 2131 speed up this routine.
2118 2132
2119 2133 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2120 2134 don't know if this is the end of it, but the behavior now is
2121 2135 certainly much more correct. Note that coupled with macros,
2122 2136 slightly surprising (at first) behavior may occur: a macro will in
2123 2137 general expand to multiple lines of input, so upon exiting, the
2124 2138 in/out counters will both be bumped by the corresponding amount
2125 2139 (as if the macro's contents had been typed interactively). Typing
2126 2140 %hist will reveal the intermediate (silently processed) lines.
2127 2141
2128 2142 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2129 2143 pickle to fail (%run was overwriting __main__ and not restoring
2130 2144 it, but pickle relies on __main__ to operate).
2131 2145
2132 2146 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2133 2147 using properties, but forgot to make the main InteractiveShell
2134 2148 class a new-style class. Properties fail silently, and
2135 2149 mysteriously, with old-style class (getters work, but
2136 2150 setters don't do anything).
2137 2151
2138 2152 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2139 2153
2140 2154 * IPython/Magic.py (magic_history): fix history reporting bug (I
2141 2155 know some nasties are still there, I just can't seem to find a
2142 2156 reproducible test case to track them down; the input history is
2143 2157 falling out of sync...)
2144 2158
2145 2159 * IPython/iplib.py (handle_shell_escape): fix bug where both
2146 2160 aliases and system accesses where broken for indented code (such
2147 2161 as loops).
2148 2162
2149 2163 * IPython/genutils.py (shell): fix small but critical bug for
2150 2164 win32 system access.
2151 2165
2152 2166 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2153 2167
2154 2168 * IPython/iplib.py (showtraceback): remove use of the
2155 2169 sys.last_{type/value/traceback} structures, which are non
2156 2170 thread-safe.
2157 2171 (_prefilter): change control flow to ensure that we NEVER
2158 2172 introspect objects when autocall is off. This will guarantee that
2159 2173 having an input line of the form 'x.y', where access to attribute
2160 2174 'y' has side effects, doesn't trigger the side effect TWICE. It
2161 2175 is important to note that, with autocall on, these side effects
2162 2176 can still happen.
2163 2177 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2164 2178 trio. IPython offers these three kinds of special calls which are
2165 2179 not python code, and it's a good thing to have their call method
2166 2180 be accessible as pure python functions (not just special syntax at
2167 2181 the command line). It gives us a better internal implementation
2168 2182 structure, as well as exposing these for user scripting more
2169 2183 cleanly.
2170 2184
2171 2185 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2172 2186 file. Now that they'll be more likely to be used with the
2173 2187 persistance system (%store), I want to make sure their module path
2174 2188 doesn't change in the future, so that we don't break things for
2175 2189 users' persisted data.
2176 2190
2177 2191 * IPython/iplib.py (autoindent_update): move indentation
2178 2192 management into the _text_ processing loop, not the keyboard
2179 2193 interactive one. This is necessary to correctly process non-typed
2180 2194 multiline input (such as macros).
2181 2195
2182 2196 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2183 2197 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2184 2198 which was producing problems in the resulting manual.
2185 2199 (magic_whos): improve reporting of instances (show their class,
2186 2200 instead of simply printing 'instance' which isn't terribly
2187 2201 informative).
2188 2202
2189 2203 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2190 2204 (minor mods) to support network shares under win32.
2191 2205
2192 2206 * IPython/winconsole.py (get_console_size): add new winconsole
2193 2207 module and fixes to page_dumb() to improve its behavior under
2194 2208 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2195 2209
2196 2210 * IPython/Magic.py (Macro): simplified Macro class to just
2197 2211 subclass list. We've had only 2.2 compatibility for a very long
2198 2212 time, yet I was still avoiding subclassing the builtin types. No
2199 2213 more (I'm also starting to use properties, though I won't shift to
2200 2214 2.3-specific features quite yet).
2201 2215 (magic_store): added Ville's patch for lightweight variable
2202 2216 persistence, after a request on the user list by Matt Wilkie
2203 2217 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2204 2218 details.
2205 2219
2206 2220 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2207 2221 changed the default logfile name from 'ipython.log' to
2208 2222 'ipython_log.py'. These logs are real python files, and now that
2209 2223 we have much better multiline support, people are more likely to
2210 2224 want to use them as such. Might as well name them correctly.
2211 2225
2212 2226 * IPython/Magic.py: substantial cleanup. While we can't stop
2213 2227 using magics as mixins, due to the existing customizations 'out
2214 2228 there' which rely on the mixin naming conventions, at least I
2215 2229 cleaned out all cross-class name usage. So once we are OK with
2216 2230 breaking compatibility, the two systems can be separated.
2217 2231
2218 2232 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2219 2233 anymore, and the class is a fair bit less hideous as well. New
2220 2234 features were also introduced: timestamping of input, and logging
2221 2235 of output results. These are user-visible with the -t and -o
2222 2236 options to %logstart. Closes
2223 2237 http://www.scipy.net/roundup/ipython/issue11 and a request by
2224 2238 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2225 2239
2226 2240 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2227 2241
2228 2242 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2229 2243 better handle backslashes in paths. See the thread 'More Windows
2230 2244 questions part 2 - \/ characters revisited' on the iypthon user
2231 2245 list:
2232 2246 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2233 2247
2234 2248 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2235 2249
2236 2250 (InteractiveShell.__init__): change threaded shells to not use the
2237 2251 ipython crash handler. This was causing more problems than not,
2238 2252 as exceptions in the main thread (GUI code, typically) would
2239 2253 always show up as a 'crash', when they really weren't.
2240 2254
2241 2255 The colors and exception mode commands (%colors/%xmode) have been
2242 2256 synchronized to also take this into account, so users can get
2243 2257 verbose exceptions for their threaded code as well. I also added
2244 2258 support for activating pdb inside this exception handler as well,
2245 2259 so now GUI authors can use IPython's enhanced pdb at runtime.
2246 2260
2247 2261 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2248 2262 true by default, and add it to the shipped ipythonrc file. Since
2249 2263 this asks the user before proceeding, I think it's OK to make it
2250 2264 true by default.
2251 2265
2252 2266 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2253 2267 of the previous special-casing of input in the eval loop. I think
2254 2268 this is cleaner, as they really are commands and shouldn't have
2255 2269 a special role in the middle of the core code.
2256 2270
2257 2271 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2258 2272
2259 2273 * IPython/iplib.py (edit_syntax_error): added support for
2260 2274 automatically reopening the editor if the file had a syntax error
2261 2275 in it. Thanks to scottt who provided the patch at:
2262 2276 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2263 2277 version committed).
2264 2278
2265 2279 * IPython/iplib.py (handle_normal): add suport for multi-line
2266 2280 input with emtpy lines. This fixes
2267 2281 http://www.scipy.net/roundup/ipython/issue43 and a similar
2268 2282 discussion on the user list.
2269 2283
2270 2284 WARNING: a behavior change is necessarily introduced to support
2271 2285 blank lines: now a single blank line with whitespace does NOT
2272 2286 break the input loop, which means that when autoindent is on, by
2273 2287 default hitting return on the next (indented) line does NOT exit.
2274 2288
2275 2289 Instead, to exit a multiline input you can either have:
2276 2290
2277 2291 - TWO whitespace lines (just hit return again), or
2278 2292 - a single whitespace line of a different length than provided
2279 2293 by the autoindent (add or remove a space).
2280 2294
2281 2295 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2282 2296 module to better organize all readline-related functionality.
2283 2297 I've deleted FlexCompleter and put all completion clases here.
2284 2298
2285 2299 * IPython/iplib.py (raw_input): improve indentation management.
2286 2300 It is now possible to paste indented code with autoindent on, and
2287 2301 the code is interpreted correctly (though it still looks bad on
2288 2302 screen, due to the line-oriented nature of ipython).
2289 2303 (MagicCompleter.complete): change behavior so that a TAB key on an
2290 2304 otherwise empty line actually inserts a tab, instead of completing
2291 2305 on the entire global namespace. This makes it easier to use the
2292 2306 TAB key for indentation. After a request by Hans Meine
2293 2307 <hans_meine-AT-gmx.net>
2294 2308 (_prefilter): add support so that typing plain 'exit' or 'quit'
2295 2309 does a sensible thing. Originally I tried to deviate as little as
2296 2310 possible from the default python behavior, but even that one may
2297 2311 change in this direction (thread on python-dev to that effect).
2298 2312 Regardless, ipython should do the right thing even if CPython's
2299 2313 '>>>' prompt doesn't.
2300 2314 (InteractiveShell): removed subclassing code.InteractiveConsole
2301 2315 class. By now we'd overridden just about all of its methods: I've
2302 2316 copied the remaining two over, and now ipython is a standalone
2303 2317 class. This will provide a clearer picture for the chainsaw
2304 2318 branch refactoring.
2305 2319
2306 2320 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2307 2321
2308 2322 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2309 2323 failures for objects which break when dir() is called on them.
2310 2324
2311 2325 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2312 2326 distinct local and global namespaces in the completer API. This
2313 2327 change allows us to properly handle completion with distinct
2314 2328 scopes, including in embedded instances (this had never really
2315 2329 worked correctly).
2316 2330
2317 2331 Note: this introduces a change in the constructor for
2318 2332 MagicCompleter, as a new global_namespace parameter is now the
2319 2333 second argument (the others were bumped one position).
2320 2334
2321 2335 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2322 2336
2323 2337 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2324 2338 embedded instances (which can be done now thanks to Vivian's
2325 2339 frame-handling fixes for pdb).
2326 2340 (InteractiveShell.__init__): Fix namespace handling problem in
2327 2341 embedded instances. We were overwriting __main__ unconditionally,
2328 2342 and this should only be done for 'full' (non-embedded) IPython;
2329 2343 embedded instances must respect the caller's __main__. Thanks to
2330 2344 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2331 2345
2332 2346 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2333 2347
2334 2348 * setup.py: added download_url to setup(). This registers the
2335 2349 download address at PyPI, which is not only useful to humans
2336 2350 browsing the site, but is also picked up by setuptools (the Eggs
2337 2351 machinery). Thanks to Ville and R. Kern for the info/discussion
2338 2352 on this.
2339 2353
2340 2354 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2341 2355
2342 2356 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2343 2357 This brings a lot of nice functionality to the pdb mode, which now
2344 2358 has tab-completion, syntax highlighting, and better stack handling
2345 2359 than before. Many thanks to Vivian De Smedt
2346 2360 <vivian-AT-vdesmedt.com> for the original patches.
2347 2361
2348 2362 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2349 2363
2350 2364 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2351 2365 sequence to consistently accept the banner argument. The
2352 2366 inconsistency was tripping SAGE, thanks to Gary Zablackis
2353 2367 <gzabl-AT-yahoo.com> for the report.
2354 2368
2355 2369 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2356 2370
2357 2371 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2358 2372 Fix bug where a naked 'alias' call in the ipythonrc file would
2359 2373 cause a crash. Bug reported by Jorgen Stenarson.
2360 2374
2361 2375 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2362 2376
2363 2377 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2364 2378 startup time.
2365 2379
2366 2380 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2367 2381 instances had introduced a bug with globals in normal code. Now
2368 2382 it's working in all cases.
2369 2383
2370 2384 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2371 2385 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2372 2386 has been introduced to set the default case sensitivity of the
2373 2387 searches. Users can still select either mode at runtime on a
2374 2388 per-search basis.
2375 2389
2376 2390 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2377 2391
2378 2392 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2379 2393 attributes in wildcard searches for subclasses. Modified version
2380 2394 of a patch by Jorgen.
2381 2395
2382 2396 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2383 2397
2384 2398 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2385 2399 embedded instances. I added a user_global_ns attribute to the
2386 2400 InteractiveShell class to handle this.
2387 2401
2388 2402 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2389 2403
2390 2404 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2391 2405 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2392 2406 (reported under win32, but may happen also in other platforms).
2393 2407 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2394 2408
2395 2409 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2396 2410
2397 2411 * IPython/Magic.py (magic_psearch): new support for wildcard
2398 2412 patterns. Now, typing ?a*b will list all names which begin with a
2399 2413 and end in b, for example. The %psearch magic has full
2400 2414 docstrings. Many thanks to Jörgen Stenarson
2401 2415 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2402 2416 implementing this functionality.
2403 2417
2404 2418 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2405 2419
2406 2420 * Manual: fixed long-standing annoyance of double-dashes (as in
2407 2421 --prefix=~, for example) being stripped in the HTML version. This
2408 2422 is a latex2html bug, but a workaround was provided. Many thanks
2409 2423 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2410 2424 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2411 2425 rolling. This seemingly small issue had tripped a number of users
2412 2426 when first installing, so I'm glad to see it gone.
2413 2427
2414 2428 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2415 2429
2416 2430 * IPython/Extensions/numeric_formats.py: fix missing import,
2417 2431 reported by Stephen Walton.
2418 2432
2419 2433 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2420 2434
2421 2435 * IPython/demo.py: finish demo module, fully documented now.
2422 2436
2423 2437 * IPython/genutils.py (file_read): simple little utility to read a
2424 2438 file and ensure it's closed afterwards.
2425 2439
2426 2440 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2427 2441
2428 2442 * IPython/demo.py (Demo.__init__): added support for individually
2429 2443 tagging blocks for automatic execution.
2430 2444
2431 2445 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2432 2446 syntax-highlighted python sources, requested by John.
2433 2447
2434 2448 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2435 2449
2436 2450 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2437 2451 finishing.
2438 2452
2439 2453 * IPython/genutils.py (shlex_split): moved from Magic to here,
2440 2454 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2441 2455
2442 2456 * IPython/demo.py (Demo.__init__): added support for silent
2443 2457 blocks, improved marks as regexps, docstrings written.
2444 2458 (Demo.__init__): better docstring, added support for sys.argv.
2445 2459
2446 2460 * IPython/genutils.py (marquee): little utility used by the demo
2447 2461 code, handy in general.
2448 2462
2449 2463 * IPython/demo.py (Demo.__init__): new class for interactive
2450 2464 demos. Not documented yet, I just wrote it in a hurry for
2451 2465 scipy'05. Will docstring later.
2452 2466
2453 2467 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2454 2468
2455 2469 * IPython/Shell.py (sigint_handler): Drastic simplification which
2456 2470 also seems to make Ctrl-C work correctly across threads! This is
2457 2471 so simple, that I can't beleive I'd missed it before. Needs more
2458 2472 testing, though.
2459 2473 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2460 2474 like this before...
2461 2475
2462 2476 * IPython/genutils.py (get_home_dir): add protection against
2463 2477 non-dirs in win32 registry.
2464 2478
2465 2479 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2466 2480 bug where dict was mutated while iterating (pysh crash).
2467 2481
2468 2482 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2469 2483
2470 2484 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2471 2485 spurious newlines added by this routine. After a report by
2472 2486 F. Mantegazza.
2473 2487
2474 2488 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2475 2489
2476 2490 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2477 2491 calls. These were a leftover from the GTK 1.x days, and can cause
2478 2492 problems in certain cases (after a report by John Hunter).
2479 2493
2480 2494 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2481 2495 os.getcwd() fails at init time. Thanks to patch from David Remahl
2482 2496 <chmod007-AT-mac.com>.
2483 2497 (InteractiveShell.__init__): prevent certain special magics from
2484 2498 being shadowed by aliases. Closes
2485 2499 http://www.scipy.net/roundup/ipython/issue41.
2486 2500
2487 2501 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2488 2502
2489 2503 * IPython/iplib.py (InteractiveShell.complete): Added new
2490 2504 top-level completion method to expose the completion mechanism
2491 2505 beyond readline-based environments.
2492 2506
2493 2507 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2494 2508
2495 2509 * tools/ipsvnc (svnversion): fix svnversion capture.
2496 2510
2497 2511 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2498 2512 attribute to self, which was missing. Before, it was set by a
2499 2513 routine which in certain cases wasn't being called, so the
2500 2514 instance could end up missing the attribute. This caused a crash.
2501 2515 Closes http://www.scipy.net/roundup/ipython/issue40.
2502 2516
2503 2517 2005-08-16 Fernando Perez <fperez@colorado.edu>
2504 2518
2505 2519 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2506 2520 contains non-string attribute. Closes
2507 2521 http://www.scipy.net/roundup/ipython/issue38.
2508 2522
2509 2523 2005-08-14 Fernando Perez <fperez@colorado.edu>
2510 2524
2511 2525 * tools/ipsvnc: Minor improvements, to add changeset info.
2512 2526
2513 2527 2005-08-12 Fernando Perez <fperez@colorado.edu>
2514 2528
2515 2529 * IPython/iplib.py (runsource): remove self.code_to_run_src
2516 2530 attribute. I realized this is nothing more than
2517 2531 '\n'.join(self.buffer), and having the same data in two different
2518 2532 places is just asking for synchronization bugs. This may impact
2519 2533 people who have custom exception handlers, so I need to warn
2520 2534 ipython-dev about it (F. Mantegazza may use them).
2521 2535
2522 2536 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2523 2537
2524 2538 * IPython/genutils.py: fix 2.2 compatibility (generators)
2525 2539
2526 2540 2005-07-18 Fernando Perez <fperez@colorado.edu>
2527 2541
2528 2542 * IPython/genutils.py (get_home_dir): fix to help users with
2529 2543 invalid $HOME under win32.
2530 2544
2531 2545 2005-07-17 Fernando Perez <fperez@colorado.edu>
2532 2546
2533 2547 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2534 2548 some old hacks and clean up a bit other routines; code should be
2535 2549 simpler and a bit faster.
2536 2550
2537 2551 * IPython/iplib.py (interact): removed some last-resort attempts
2538 2552 to survive broken stdout/stderr. That code was only making it
2539 2553 harder to abstract out the i/o (necessary for gui integration),
2540 2554 and the crashes it could prevent were extremely rare in practice
2541 2555 (besides being fully user-induced in a pretty violent manner).
2542 2556
2543 2557 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2544 2558 Nothing major yet, but the code is simpler to read; this should
2545 2559 make it easier to do more serious modifications in the future.
2546 2560
2547 2561 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2548 2562 which broke in .15 (thanks to a report by Ville).
2549 2563
2550 2564 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2551 2565 be quite correct, I know next to nothing about unicode). This
2552 2566 will allow unicode strings to be used in prompts, amongst other
2553 2567 cases. It also will prevent ipython from crashing when unicode
2554 2568 shows up unexpectedly in many places. If ascii encoding fails, we
2555 2569 assume utf_8. Currently the encoding is not a user-visible
2556 2570 setting, though it could be made so if there is demand for it.
2557 2571
2558 2572 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2559 2573
2560 2574 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2561 2575
2562 2576 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2563 2577
2564 2578 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2565 2579 code can work transparently for 2.2/2.3.
2566 2580
2567 2581 2005-07-16 Fernando Perez <fperez@colorado.edu>
2568 2582
2569 2583 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2570 2584 out of the color scheme table used for coloring exception
2571 2585 tracebacks. This allows user code to add new schemes at runtime.
2572 2586 This is a minimally modified version of the patch at
2573 2587 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2574 2588 for the contribution.
2575 2589
2576 2590 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2577 2591 slightly modified version of the patch in
2578 2592 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2579 2593 to remove the previous try/except solution (which was costlier).
2580 2594 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2581 2595
2582 2596 2005-06-08 Fernando Perez <fperez@colorado.edu>
2583 2597
2584 2598 * IPython/iplib.py (write/write_err): Add methods to abstract all
2585 2599 I/O a bit more.
2586 2600
2587 2601 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2588 2602 warning, reported by Aric Hagberg, fix by JD Hunter.
2589 2603
2590 2604 2005-06-02 *** Released version 0.6.15
2591 2605
2592 2606 2005-06-01 Fernando Perez <fperez@colorado.edu>
2593 2607
2594 2608 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2595 2609 tab-completion of filenames within open-quoted strings. Note that
2596 2610 this requires that in ~/.ipython/ipythonrc, users change the
2597 2611 readline delimiters configuration to read:
2598 2612
2599 2613 readline_remove_delims -/~
2600 2614
2601 2615
2602 2616 2005-05-31 *** Released version 0.6.14
2603 2617
2604 2618 2005-05-29 Fernando Perez <fperez@colorado.edu>
2605 2619
2606 2620 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2607 2621 with files not on the filesystem. Reported by Eliyahu Sandler
2608 2622 <eli@gondolin.net>
2609 2623
2610 2624 2005-05-22 Fernando Perez <fperez@colorado.edu>
2611 2625
2612 2626 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2613 2627 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2614 2628
2615 2629 2005-05-19 Fernando Perez <fperez@colorado.edu>
2616 2630
2617 2631 * IPython/iplib.py (safe_execfile): close a file which could be
2618 2632 left open (causing problems in win32, which locks open files).
2619 2633 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2620 2634
2621 2635 2005-05-18 Fernando Perez <fperez@colorado.edu>
2622 2636
2623 2637 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2624 2638 keyword arguments correctly to safe_execfile().
2625 2639
2626 2640 2005-05-13 Fernando Perez <fperez@colorado.edu>
2627 2641
2628 2642 * ipython.1: Added info about Qt to manpage, and threads warning
2629 2643 to usage page (invoked with --help).
2630 2644
2631 2645 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2632 2646 new matcher (it goes at the end of the priority list) to do
2633 2647 tab-completion on named function arguments. Submitted by George
2634 2648 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2635 2649 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2636 2650 for more details.
2637 2651
2638 2652 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2639 2653 SystemExit exceptions in the script being run. Thanks to a report
2640 2654 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2641 2655 producing very annoying behavior when running unit tests.
2642 2656
2643 2657 2005-05-12 Fernando Perez <fperez@colorado.edu>
2644 2658
2645 2659 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2646 2660 which I'd broken (again) due to a changed regexp. In the process,
2647 2661 added ';' as an escape to auto-quote the whole line without
2648 2662 splitting its arguments. Thanks to a report by Jerry McRae
2649 2663 <qrs0xyc02-AT-sneakemail.com>.
2650 2664
2651 2665 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2652 2666 possible crashes caused by a TokenError. Reported by Ed Schofield
2653 2667 <schofield-AT-ftw.at>.
2654 2668
2655 2669 2005-05-06 Fernando Perez <fperez@colorado.edu>
2656 2670
2657 2671 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2658 2672
2659 2673 2005-04-29 Fernando Perez <fperez@colorado.edu>
2660 2674
2661 2675 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2662 2676 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2663 2677 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2664 2678 which provides support for Qt interactive usage (similar to the
2665 2679 existing one for WX and GTK). This had been often requested.
2666 2680
2667 2681 2005-04-14 *** Released version 0.6.13
2668 2682
2669 2683 2005-04-08 Fernando Perez <fperez@colorado.edu>
2670 2684
2671 2685 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2672 2686 from _ofind, which gets called on almost every input line. Now,
2673 2687 we only try to get docstrings if they are actually going to be
2674 2688 used (the overhead of fetching unnecessary docstrings can be
2675 2689 noticeable for certain objects, such as Pyro proxies).
2676 2690
2677 2691 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2678 2692 for completers. For some reason I had been passing them the state
2679 2693 variable, which completers never actually need, and was in
2680 2694 conflict with the rlcompleter API. Custom completers ONLY need to
2681 2695 take the text parameter.
2682 2696
2683 2697 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2684 2698 work correctly in pysh. I've also moved all the logic which used
2685 2699 to be in pysh.py here, which will prevent problems with future
2686 2700 upgrades. However, this time I must warn users to update their
2687 2701 pysh profile to include the line
2688 2702
2689 2703 import_all IPython.Extensions.InterpreterExec
2690 2704
2691 2705 because otherwise things won't work for them. They MUST also
2692 2706 delete pysh.py and the line
2693 2707
2694 2708 execfile pysh.py
2695 2709
2696 2710 from their ipythonrc-pysh.
2697 2711
2698 2712 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2699 2713 robust in the face of objects whose dir() returns non-strings
2700 2714 (which it shouldn't, but some broken libs like ITK do). Thanks to
2701 2715 a patch by John Hunter (implemented differently, though). Also
2702 2716 minor improvements by using .extend instead of + on lists.
2703 2717
2704 2718 * pysh.py:
2705 2719
2706 2720 2005-04-06 Fernando Perez <fperez@colorado.edu>
2707 2721
2708 2722 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2709 2723 by default, so that all users benefit from it. Those who don't
2710 2724 want it can still turn it off.
2711 2725
2712 2726 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2713 2727 config file, I'd forgotten about this, so users were getting it
2714 2728 off by default.
2715 2729
2716 2730 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2717 2731 consistency. Now magics can be called in multiline statements,
2718 2732 and python variables can be expanded in magic calls via $var.
2719 2733 This makes the magic system behave just like aliases or !system
2720 2734 calls.
2721 2735
2722 2736 2005-03-28 Fernando Perez <fperez@colorado.edu>
2723 2737
2724 2738 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2725 2739 expensive string additions for building command. Add support for
2726 2740 trailing ';' when autocall is used.
2727 2741
2728 2742 2005-03-26 Fernando Perez <fperez@colorado.edu>
2729 2743
2730 2744 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2731 2745 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2732 2746 ipython.el robust against prompts with any number of spaces
2733 2747 (including 0) after the ':' character.
2734 2748
2735 2749 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2736 2750 continuation prompt, which misled users to think the line was
2737 2751 already indented. Closes debian Bug#300847, reported to me by
2738 2752 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2739 2753
2740 2754 2005-03-23 Fernando Perez <fperez@colorado.edu>
2741 2755
2742 2756 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2743 2757 properly aligned if they have embedded newlines.
2744 2758
2745 2759 * IPython/iplib.py (runlines): Add a public method to expose
2746 2760 IPython's code execution machinery, so that users can run strings
2747 2761 as if they had been typed at the prompt interactively.
2748 2762 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2749 2763 methods which can call the system shell, but with python variable
2750 2764 expansion. The three such methods are: __IPYTHON__.system,
2751 2765 .getoutput and .getoutputerror. These need to be documented in a
2752 2766 'public API' section (to be written) of the manual.
2753 2767
2754 2768 2005-03-20 Fernando Perez <fperez@colorado.edu>
2755 2769
2756 2770 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2757 2771 for custom exception handling. This is quite powerful, and it
2758 2772 allows for user-installable exception handlers which can trap
2759 2773 custom exceptions at runtime and treat them separately from
2760 2774 IPython's default mechanisms. At the request of Frédéric
2761 2775 Mantegazza <mantegazza-AT-ill.fr>.
2762 2776 (InteractiveShell.set_custom_completer): public API function to
2763 2777 add new completers at runtime.
2764 2778
2765 2779 2005-03-19 Fernando Perez <fperez@colorado.edu>
2766 2780
2767 2781 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2768 2782 allow objects which provide their docstrings via non-standard
2769 2783 mechanisms (like Pyro proxies) to still be inspected by ipython's
2770 2784 ? system.
2771 2785
2772 2786 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2773 2787 automatic capture system. I tried quite hard to make it work
2774 2788 reliably, and simply failed. I tried many combinations with the
2775 2789 subprocess module, but eventually nothing worked in all needed
2776 2790 cases (not blocking stdin for the child, duplicating stdout
2777 2791 without blocking, etc). The new %sc/%sx still do capture to these
2778 2792 magical list/string objects which make shell use much more
2779 2793 conveninent, so not all is lost.
2780 2794
2781 2795 XXX - FIX MANUAL for the change above!
2782 2796
2783 2797 (runsource): I copied code.py's runsource() into ipython to modify
2784 2798 it a bit. Now the code object and source to be executed are
2785 2799 stored in ipython. This makes this info accessible to third-party
2786 2800 tools, like custom exception handlers. After a request by Frédéric
2787 2801 Mantegazza <mantegazza-AT-ill.fr>.
2788 2802
2789 2803 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2790 2804 history-search via readline (like C-p/C-n). I'd wanted this for a
2791 2805 long time, but only recently found out how to do it. For users
2792 2806 who already have their ipythonrc files made and want this, just
2793 2807 add:
2794 2808
2795 2809 readline_parse_and_bind "\e[A": history-search-backward
2796 2810 readline_parse_and_bind "\e[B": history-search-forward
2797 2811
2798 2812 2005-03-18 Fernando Perez <fperez@colorado.edu>
2799 2813
2800 2814 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2801 2815 LSString and SList classes which allow transparent conversions
2802 2816 between list mode and whitespace-separated string.
2803 2817 (magic_r): Fix recursion problem in %r.
2804 2818
2805 2819 * IPython/genutils.py (LSString): New class to be used for
2806 2820 automatic storage of the results of all alias/system calls in _o
2807 2821 and _e (stdout/err). These provide a .l/.list attribute which
2808 2822 does automatic splitting on newlines. This means that for most
2809 2823 uses, you'll never need to do capturing of output with %sc/%sx
2810 2824 anymore, since ipython keeps this always done for you. Note that
2811 2825 only the LAST results are stored, the _o/e variables are
2812 2826 overwritten on each call. If you need to save their contents
2813 2827 further, simply bind them to any other name.
2814 2828
2815 2829 2005-03-17 Fernando Perez <fperez@colorado.edu>
2816 2830
2817 2831 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2818 2832 prompt namespace handling.
2819 2833
2820 2834 2005-03-16 Fernando Perez <fperez@colorado.edu>
2821 2835
2822 2836 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2823 2837 classic prompts to be '>>> ' (final space was missing, and it
2824 2838 trips the emacs python mode).
2825 2839 (BasePrompt.__str__): Added safe support for dynamic prompt
2826 2840 strings. Now you can set your prompt string to be '$x', and the
2827 2841 value of x will be printed from your interactive namespace. The
2828 2842 interpolation syntax includes the full Itpl support, so
2829 2843 ${foo()+x+bar()} is a valid prompt string now, and the function
2830 2844 calls will be made at runtime.
2831 2845
2832 2846 2005-03-15 Fernando Perez <fperez@colorado.edu>
2833 2847
2834 2848 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2835 2849 avoid name clashes in pylab. %hist still works, it just forwards
2836 2850 the call to %history.
2837 2851
2838 2852 2005-03-02 *** Released version 0.6.12
2839 2853
2840 2854 2005-03-02 Fernando Perez <fperez@colorado.edu>
2841 2855
2842 2856 * IPython/iplib.py (handle_magic): log magic calls properly as
2843 2857 ipmagic() function calls.
2844 2858
2845 2859 * IPython/Magic.py (magic_time): Improved %time to support
2846 2860 statements and provide wall-clock as well as CPU time.
2847 2861
2848 2862 2005-02-27 Fernando Perez <fperez@colorado.edu>
2849 2863
2850 2864 * IPython/hooks.py: New hooks module, to expose user-modifiable
2851 2865 IPython functionality in a clean manner. For now only the editor
2852 2866 hook is actually written, and other thigns which I intend to turn
2853 2867 into proper hooks aren't yet there. The display and prefilter
2854 2868 stuff, for example, should be hooks. But at least now the
2855 2869 framework is in place, and the rest can be moved here with more
2856 2870 time later. IPython had had a .hooks variable for a long time for
2857 2871 this purpose, but I'd never actually used it for anything.
2858 2872
2859 2873 2005-02-26 Fernando Perez <fperez@colorado.edu>
2860 2874
2861 2875 * IPython/ipmaker.py (make_IPython): make the default ipython
2862 2876 directory be called _ipython under win32, to follow more the
2863 2877 naming peculiarities of that platform (where buggy software like
2864 2878 Visual Sourcesafe breaks with .named directories). Reported by
2865 2879 Ville Vainio.
2866 2880
2867 2881 2005-02-23 Fernando Perez <fperez@colorado.edu>
2868 2882
2869 2883 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2870 2884 auto_aliases for win32 which were causing problems. Users can
2871 2885 define the ones they personally like.
2872 2886
2873 2887 2005-02-21 Fernando Perez <fperez@colorado.edu>
2874 2888
2875 2889 * IPython/Magic.py (magic_time): new magic to time execution of
2876 2890 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2877 2891
2878 2892 2005-02-19 Fernando Perez <fperez@colorado.edu>
2879 2893
2880 2894 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2881 2895 into keys (for prompts, for example).
2882 2896
2883 2897 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2884 2898 prompts in case users want them. This introduces a small behavior
2885 2899 change: ipython does not automatically add a space to all prompts
2886 2900 anymore. To get the old prompts with a space, users should add it
2887 2901 manually to their ipythonrc file, so for example prompt_in1 should
2888 2902 now read 'In [\#]: ' instead of 'In [\#]:'.
2889 2903 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2890 2904 file) to control left-padding of secondary prompts.
2891 2905
2892 2906 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2893 2907 the profiler can't be imported. Fix for Debian, which removed
2894 2908 profile.py because of License issues. I applied a slightly
2895 2909 modified version of the original Debian patch at
2896 2910 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2897 2911
2898 2912 2005-02-17 Fernando Perez <fperez@colorado.edu>
2899 2913
2900 2914 * IPython/genutils.py (native_line_ends): Fix bug which would
2901 2915 cause improper line-ends under win32 b/c I was not opening files
2902 2916 in binary mode. Bug report and fix thanks to Ville.
2903 2917
2904 2918 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2905 2919 trying to catch spurious foo[1] autocalls. My fix actually broke
2906 2920 ',/' autoquote/call with explicit escape (bad regexp).
2907 2921
2908 2922 2005-02-15 *** Released version 0.6.11
2909 2923
2910 2924 2005-02-14 Fernando Perez <fperez@colorado.edu>
2911 2925
2912 2926 * IPython/background_jobs.py: New background job management
2913 2927 subsystem. This is implemented via a new set of classes, and
2914 2928 IPython now provides a builtin 'jobs' object for background job
2915 2929 execution. A convenience %bg magic serves as a lightweight
2916 2930 frontend for starting the more common type of calls. This was
2917 2931 inspired by discussions with B. Granger and the BackgroundCommand
2918 2932 class described in the book Python Scripting for Computational
2919 2933 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2920 2934 (although ultimately no code from this text was used, as IPython's
2921 2935 system is a separate implementation).
2922 2936
2923 2937 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2924 2938 to control the completion of single/double underscore names
2925 2939 separately. As documented in the example ipytonrc file, the
2926 2940 readline_omit__names variable can now be set to 2, to omit even
2927 2941 single underscore names. Thanks to a patch by Brian Wong
2928 2942 <BrianWong-AT-AirgoNetworks.Com>.
2929 2943 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2930 2944 be autocalled as foo([1]) if foo were callable. A problem for
2931 2945 things which are both callable and implement __getitem__.
2932 2946 (init_readline): Fix autoindentation for win32. Thanks to a patch
2933 2947 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2934 2948
2935 2949 2005-02-12 Fernando Perez <fperez@colorado.edu>
2936 2950
2937 2951 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2938 2952 which I had written long ago to sort out user error messages which
2939 2953 may occur during startup. This seemed like a good idea initially,
2940 2954 but it has proven a disaster in retrospect. I don't want to
2941 2955 change much code for now, so my fix is to set the internal 'debug'
2942 2956 flag to true everywhere, whose only job was precisely to control
2943 2957 this subsystem. This closes issue 28 (as well as avoiding all
2944 2958 sorts of strange hangups which occur from time to time).
2945 2959
2946 2960 2005-02-07 Fernando Perez <fperez@colorado.edu>
2947 2961
2948 2962 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2949 2963 previous call produced a syntax error.
2950 2964
2951 2965 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2952 2966 classes without constructor.
2953 2967
2954 2968 2005-02-06 Fernando Perez <fperez@colorado.edu>
2955 2969
2956 2970 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2957 2971 completions with the results of each matcher, so we return results
2958 2972 to the user from all namespaces. This breaks with ipython
2959 2973 tradition, but I think it's a nicer behavior. Now you get all
2960 2974 possible completions listed, from all possible namespaces (python,
2961 2975 filesystem, magics...) After a request by John Hunter
2962 2976 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2963 2977
2964 2978 2005-02-05 Fernando Perez <fperez@colorado.edu>
2965 2979
2966 2980 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2967 2981 the call had quote characters in it (the quotes were stripped).
2968 2982
2969 2983 2005-01-31 Fernando Perez <fperez@colorado.edu>
2970 2984
2971 2985 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2972 2986 Itpl.itpl() to make the code more robust against psyco
2973 2987 optimizations.
2974 2988
2975 2989 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2976 2990 of causing an exception. Quicker, cleaner.
2977 2991
2978 2992 2005-01-28 Fernando Perez <fperez@colorado.edu>
2979 2993
2980 2994 * scripts/ipython_win_post_install.py (install): hardcode
2981 2995 sys.prefix+'python.exe' as the executable path. It turns out that
2982 2996 during the post-installation run, sys.executable resolves to the
2983 2997 name of the binary installer! I should report this as a distutils
2984 2998 bug, I think. I updated the .10 release with this tiny fix, to
2985 2999 avoid annoying the lists further.
2986 3000
2987 3001 2005-01-27 *** Released version 0.6.10
2988 3002
2989 3003 2005-01-27 Fernando Perez <fperez@colorado.edu>
2990 3004
2991 3005 * IPython/numutils.py (norm): Added 'inf' as optional name for
2992 3006 L-infinity norm, included references to mathworld.com for vector
2993 3007 norm definitions.
2994 3008 (amin/amax): added amin/amax for array min/max. Similar to what
2995 3009 pylab ships with after the recent reorganization of names.
2996 3010 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2997 3011
2998 3012 * ipython.el: committed Alex's recent fixes and improvements.
2999 3013 Tested with python-mode from CVS, and it looks excellent. Since
3000 3014 python-mode hasn't released anything in a while, I'm temporarily
3001 3015 putting a copy of today's CVS (v 4.70) of python-mode in:
3002 3016 http://ipython.scipy.org/tmp/python-mode.el
3003 3017
3004 3018 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3005 3019 sys.executable for the executable name, instead of assuming it's
3006 3020 called 'python.exe' (the post-installer would have produced broken
3007 3021 setups on systems with a differently named python binary).
3008 3022
3009 3023 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3010 3024 references to os.linesep, to make the code more
3011 3025 platform-independent. This is also part of the win32 coloring
3012 3026 fixes.
3013 3027
3014 3028 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3015 3029 lines, which actually cause coloring bugs because the length of
3016 3030 the line is very difficult to correctly compute with embedded
3017 3031 escapes. This was the source of all the coloring problems under
3018 3032 Win32. I think that _finally_, Win32 users have a properly
3019 3033 working ipython in all respects. This would never have happened
3020 3034 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3021 3035
3022 3036 2005-01-26 *** Released version 0.6.9
3023 3037
3024 3038 2005-01-25 Fernando Perez <fperez@colorado.edu>
3025 3039
3026 3040 * setup.py: finally, we have a true Windows installer, thanks to
3027 3041 the excellent work of Viktor Ransmayr
3028 3042 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3029 3043 Windows users. The setup routine is quite a bit cleaner thanks to
3030 3044 this, and the post-install script uses the proper functions to
3031 3045 allow a clean de-installation using the standard Windows Control
3032 3046 Panel.
3033 3047
3034 3048 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3035 3049 environment variable under all OSes (including win32) if
3036 3050 available. This will give consistency to win32 users who have set
3037 3051 this variable for any reason. If os.environ['HOME'] fails, the
3038 3052 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3039 3053
3040 3054 2005-01-24 Fernando Perez <fperez@colorado.edu>
3041 3055
3042 3056 * IPython/numutils.py (empty_like): add empty_like(), similar to
3043 3057 zeros_like() but taking advantage of the new empty() Numeric routine.
3044 3058
3045 3059 2005-01-23 *** Released version 0.6.8
3046 3060
3047 3061 2005-01-22 Fernando Perez <fperez@colorado.edu>
3048 3062
3049 3063 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3050 3064 automatic show() calls. After discussing things with JDH, it
3051 3065 turns out there are too many corner cases where this can go wrong.
3052 3066 It's best not to try to be 'too smart', and simply have ipython
3053 3067 reproduce as much as possible the default behavior of a normal
3054 3068 python shell.
3055 3069
3056 3070 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3057 3071 line-splitting regexp and _prefilter() to avoid calling getattr()
3058 3072 on assignments. This closes
3059 3073 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3060 3074 readline uses getattr(), so a simple <TAB> keypress is still
3061 3075 enough to trigger getattr() calls on an object.
3062 3076
3063 3077 2005-01-21 Fernando Perez <fperez@colorado.edu>
3064 3078
3065 3079 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3066 3080 docstring under pylab so it doesn't mask the original.
3067 3081
3068 3082 2005-01-21 *** Released version 0.6.7
3069 3083
3070 3084 2005-01-21 Fernando Perez <fperez@colorado.edu>
3071 3085
3072 3086 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3073 3087 signal handling for win32 users in multithreaded mode.
3074 3088
3075 3089 2005-01-17 Fernando Perez <fperez@colorado.edu>
3076 3090
3077 3091 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3078 3092 instances with no __init__. After a crash report by Norbert Nemec
3079 3093 <Norbert-AT-nemec-online.de>.
3080 3094
3081 3095 2005-01-14 Fernando Perez <fperez@colorado.edu>
3082 3096
3083 3097 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3084 3098 names for verbose exceptions, when multiple dotted names and the
3085 3099 'parent' object were present on the same line.
3086 3100
3087 3101 2005-01-11 Fernando Perez <fperez@colorado.edu>
3088 3102
3089 3103 * IPython/genutils.py (flag_calls): new utility to trap and flag
3090 3104 calls in functions. I need it to clean up matplotlib support.
3091 3105 Also removed some deprecated code in genutils.
3092 3106
3093 3107 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3094 3108 that matplotlib scripts called with %run, which don't call show()
3095 3109 themselves, still have their plotting windows open.
3096 3110
3097 3111 2005-01-05 Fernando Perez <fperez@colorado.edu>
3098 3112
3099 3113 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3100 3114 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3101 3115
3102 3116 2004-12-19 Fernando Perez <fperez@colorado.edu>
3103 3117
3104 3118 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3105 3119 parent_runcode, which was an eyesore. The same result can be
3106 3120 obtained with Python's regular superclass mechanisms.
3107 3121
3108 3122 2004-12-17 Fernando Perez <fperez@colorado.edu>
3109 3123
3110 3124 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3111 3125 reported by Prabhu.
3112 3126 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3113 3127 sys.stderr) instead of explicitly calling sys.stderr. This helps
3114 3128 maintain our I/O abstractions clean, for future GUI embeddings.
3115 3129
3116 3130 * IPython/genutils.py (info): added new utility for sys.stderr
3117 3131 unified info message handling (thin wrapper around warn()).
3118 3132
3119 3133 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3120 3134 composite (dotted) names on verbose exceptions.
3121 3135 (VerboseTB.nullrepr): harden against another kind of errors which
3122 3136 Python's inspect module can trigger, and which were crashing
3123 3137 IPython. Thanks to a report by Marco Lombardi
3124 3138 <mlombard-AT-ma010192.hq.eso.org>.
3125 3139
3126 3140 2004-12-13 *** Released version 0.6.6
3127 3141
3128 3142 2004-12-12 Fernando Perez <fperez@colorado.edu>
3129 3143
3130 3144 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3131 3145 generated by pygtk upon initialization if it was built without
3132 3146 threads (for matplotlib users). After a crash reported by
3133 3147 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3134 3148
3135 3149 * IPython/ipmaker.py (make_IPython): fix small bug in the
3136 3150 import_some parameter for multiple imports.
3137 3151
3138 3152 * IPython/iplib.py (ipmagic): simplified the interface of
3139 3153 ipmagic() to take a single string argument, just as it would be
3140 3154 typed at the IPython cmd line.
3141 3155 (ipalias): Added new ipalias() with an interface identical to
3142 3156 ipmagic(). This completes exposing a pure python interface to the
3143 3157 alias and magic system, which can be used in loops or more complex
3144 3158 code where IPython's automatic line mangling is not active.
3145 3159
3146 3160 * IPython/genutils.py (timing): changed interface of timing to
3147 3161 simply run code once, which is the most common case. timings()
3148 3162 remains unchanged, for the cases where you want multiple runs.
3149 3163
3150 3164 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3151 3165 bug where Python2.2 crashes with exec'ing code which does not end
3152 3166 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3153 3167 before.
3154 3168
3155 3169 2004-12-10 Fernando Perez <fperez@colorado.edu>
3156 3170
3157 3171 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3158 3172 -t to -T, to accomodate the new -t flag in %run (the %run and
3159 3173 %prun options are kind of intermixed, and it's not easy to change
3160 3174 this with the limitations of python's getopt).
3161 3175
3162 3176 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3163 3177 the execution of scripts. It's not as fine-tuned as timeit.py,
3164 3178 but it works from inside ipython (and under 2.2, which lacks
3165 3179 timeit.py). Optionally a number of runs > 1 can be given for
3166 3180 timing very short-running code.
3167 3181
3168 3182 * IPython/genutils.py (uniq_stable): new routine which returns a
3169 3183 list of unique elements in any iterable, but in stable order of
3170 3184 appearance. I needed this for the ultraTB fixes, and it's a handy
3171 3185 utility.
3172 3186
3173 3187 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3174 3188 dotted names in Verbose exceptions. This had been broken since
3175 3189 the very start, now x.y will properly be printed in a Verbose
3176 3190 traceback, instead of x being shown and y appearing always as an
3177 3191 'undefined global'. Getting this to work was a bit tricky,
3178 3192 because by default python tokenizers are stateless. Saved by
3179 3193 python's ability to easily add a bit of state to an arbitrary
3180 3194 function (without needing to build a full-blown callable object).
3181 3195
3182 3196 Also big cleanup of this code, which had horrendous runtime
3183 3197 lookups of zillions of attributes for colorization. Moved all
3184 3198 this code into a few templates, which make it cleaner and quicker.
3185 3199
3186 3200 Printout quality was also improved for Verbose exceptions: one
3187 3201 variable per line, and memory addresses are printed (this can be
3188 3202 quite handy in nasty debugging situations, which is what Verbose
3189 3203 is for).
3190 3204
3191 3205 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3192 3206 the command line as scripts to be loaded by embedded instances.
3193 3207 Doing so has the potential for an infinite recursion if there are
3194 3208 exceptions thrown in the process. This fixes a strange crash
3195 3209 reported by Philippe MULLER <muller-AT-irit.fr>.
3196 3210
3197 3211 2004-12-09 Fernando Perez <fperez@colorado.edu>
3198 3212
3199 3213 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3200 3214 to reflect new names in matplotlib, which now expose the
3201 3215 matlab-compatible interface via a pylab module instead of the
3202 3216 'matlab' name. The new code is backwards compatible, so users of
3203 3217 all matplotlib versions are OK. Patch by J. Hunter.
3204 3218
3205 3219 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3206 3220 of __init__ docstrings for instances (class docstrings are already
3207 3221 automatically printed). Instances with customized docstrings
3208 3222 (indep. of the class) are also recognized and all 3 separate
3209 3223 docstrings are printed (instance, class, constructor). After some
3210 3224 comments/suggestions by J. Hunter.
3211 3225
3212 3226 2004-12-05 Fernando Perez <fperez@colorado.edu>
3213 3227
3214 3228 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3215 3229 warnings when tab-completion fails and triggers an exception.
3216 3230
3217 3231 2004-12-03 Fernando Perez <fperez@colorado.edu>
3218 3232
3219 3233 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3220 3234 be triggered when using 'run -p'. An incorrect option flag was
3221 3235 being set ('d' instead of 'D').
3222 3236 (manpage): fix missing escaped \- sign.
3223 3237
3224 3238 2004-11-30 *** Released version 0.6.5
3225 3239
3226 3240 2004-11-30 Fernando Perez <fperez@colorado.edu>
3227 3241
3228 3242 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3229 3243 setting with -d option.
3230 3244
3231 3245 * setup.py (docfiles): Fix problem where the doc glob I was using
3232 3246 was COMPLETELY BROKEN. It was giving the right files by pure
3233 3247 accident, but failed once I tried to include ipython.el. Note:
3234 3248 glob() does NOT allow you to do exclusion on multiple endings!
3235 3249
3236 3250 2004-11-29 Fernando Perez <fperez@colorado.edu>
3237 3251
3238 3252 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3239 3253 the manpage as the source. Better formatting & consistency.
3240 3254
3241 3255 * IPython/Magic.py (magic_run): Added new -d option, to run
3242 3256 scripts under the control of the python pdb debugger. Note that
3243 3257 this required changing the %prun option -d to -D, to avoid a clash
3244 3258 (since %run must pass options to %prun, and getopt is too dumb to
3245 3259 handle options with string values with embedded spaces). Thanks
3246 3260 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3247 3261 (magic_who_ls): added type matching to %who and %whos, so that one
3248 3262 can filter their output to only include variables of certain
3249 3263 types. Another suggestion by Matthew.
3250 3264 (magic_whos): Added memory summaries in kb and Mb for arrays.
3251 3265 (magic_who): Improve formatting (break lines every 9 vars).
3252 3266
3253 3267 2004-11-28 Fernando Perez <fperez@colorado.edu>
3254 3268
3255 3269 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3256 3270 cache when empty lines were present.
3257 3271
3258 3272 2004-11-24 Fernando Perez <fperez@colorado.edu>
3259 3273
3260 3274 * IPython/usage.py (__doc__): document the re-activated threading
3261 3275 options for WX and GTK.
3262 3276
3263 3277 2004-11-23 Fernando Perez <fperez@colorado.edu>
3264 3278
3265 3279 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3266 3280 the -wthread and -gthread options, along with a new -tk one to try
3267 3281 and coordinate Tk threading with wx/gtk. The tk support is very
3268 3282 platform dependent, since it seems to require Tcl and Tk to be
3269 3283 built with threads (Fedora1/2 appears NOT to have it, but in
3270 3284 Prabhu's Debian boxes it works OK). But even with some Tk
3271 3285 limitations, this is a great improvement.
3272 3286
3273 3287 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3274 3288 info in user prompts. Patch by Prabhu.
3275 3289
3276 3290 2004-11-18 Fernando Perez <fperez@colorado.edu>
3277 3291
3278 3292 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3279 3293 EOFErrors and bail, to avoid infinite loops if a non-terminating
3280 3294 file is fed into ipython. Patch submitted in issue 19 by user,
3281 3295 many thanks.
3282 3296
3283 3297 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3284 3298 autoquote/parens in continuation prompts, which can cause lots of
3285 3299 problems. Closes roundup issue 20.
3286 3300
3287 3301 2004-11-17 Fernando Perez <fperez@colorado.edu>
3288 3302
3289 3303 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3290 3304 reported as debian bug #280505. I'm not sure my local changelog
3291 3305 entry has the proper debian format (Jack?).
3292 3306
3293 3307 2004-11-08 *** Released version 0.6.4
3294 3308
3295 3309 2004-11-08 Fernando Perez <fperez@colorado.edu>
3296 3310
3297 3311 * IPython/iplib.py (init_readline): Fix exit message for Windows
3298 3312 when readline is active. Thanks to a report by Eric Jones
3299 3313 <eric-AT-enthought.com>.
3300 3314
3301 3315 2004-11-07 Fernando Perez <fperez@colorado.edu>
3302 3316
3303 3317 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3304 3318 sometimes seen by win2k/cygwin users.
3305 3319
3306 3320 2004-11-06 Fernando Perez <fperez@colorado.edu>
3307 3321
3308 3322 * IPython/iplib.py (interact): Change the handling of %Exit from
3309 3323 trying to propagate a SystemExit to an internal ipython flag.
3310 3324 This is less elegant than using Python's exception mechanism, but
3311 3325 I can't get that to work reliably with threads, so under -pylab
3312 3326 %Exit was hanging IPython. Cross-thread exception handling is
3313 3327 really a bitch. Thaks to a bug report by Stephen Walton
3314 3328 <stephen.walton-AT-csun.edu>.
3315 3329
3316 3330 2004-11-04 Fernando Perez <fperez@colorado.edu>
3317 3331
3318 3332 * IPython/iplib.py (raw_input_original): store a pointer to the
3319 3333 true raw_input to harden against code which can modify it
3320 3334 (wx.py.PyShell does this and would otherwise crash ipython).
3321 3335 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3322 3336
3323 3337 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3324 3338 Ctrl-C problem, which does not mess up the input line.
3325 3339
3326 3340 2004-11-03 Fernando Perez <fperez@colorado.edu>
3327 3341
3328 3342 * IPython/Release.py: Changed licensing to BSD, in all files.
3329 3343 (name): lowercase name for tarball/RPM release.
3330 3344
3331 3345 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3332 3346 use throughout ipython.
3333 3347
3334 3348 * IPython/Magic.py (Magic._ofind): Switch to using the new
3335 3349 OInspect.getdoc() function.
3336 3350
3337 3351 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3338 3352 of the line currently being canceled via Ctrl-C. It's extremely
3339 3353 ugly, but I don't know how to do it better (the problem is one of
3340 3354 handling cross-thread exceptions).
3341 3355
3342 3356 2004-10-28 Fernando Perez <fperez@colorado.edu>
3343 3357
3344 3358 * IPython/Shell.py (signal_handler): add signal handlers to trap
3345 3359 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3346 3360 report by Francesc Alted.
3347 3361
3348 3362 2004-10-21 Fernando Perez <fperez@colorado.edu>
3349 3363
3350 3364 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3351 3365 to % for pysh syntax extensions.
3352 3366
3353 3367 2004-10-09 Fernando Perez <fperez@colorado.edu>
3354 3368
3355 3369 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3356 3370 arrays to print a more useful summary, without calling str(arr).
3357 3371 This avoids the problem of extremely lengthy computations which
3358 3372 occur if arr is large, and appear to the user as a system lockup
3359 3373 with 100% cpu activity. After a suggestion by Kristian Sandberg
3360 3374 <Kristian.Sandberg@colorado.edu>.
3361 3375 (Magic.__init__): fix bug in global magic escapes not being
3362 3376 correctly set.
3363 3377
3364 3378 2004-10-08 Fernando Perez <fperez@colorado.edu>
3365 3379
3366 3380 * IPython/Magic.py (__license__): change to absolute imports of
3367 3381 ipython's own internal packages, to start adapting to the absolute
3368 3382 import requirement of PEP-328.
3369 3383
3370 3384 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3371 3385 files, and standardize author/license marks through the Release
3372 3386 module instead of having per/file stuff (except for files with
3373 3387 particular licenses, like the MIT/PSF-licensed codes).
3374 3388
3375 3389 * IPython/Debugger.py: remove dead code for python 2.1
3376 3390
3377 3391 2004-10-04 Fernando Perez <fperez@colorado.edu>
3378 3392
3379 3393 * IPython/iplib.py (ipmagic): New function for accessing magics
3380 3394 via a normal python function call.
3381 3395
3382 3396 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3383 3397 from '@' to '%', to accomodate the new @decorator syntax of python
3384 3398 2.4.
3385 3399
3386 3400 2004-09-29 Fernando Perez <fperez@colorado.edu>
3387 3401
3388 3402 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3389 3403 matplotlib.use to prevent running scripts which try to switch
3390 3404 interactive backends from within ipython. This will just crash
3391 3405 the python interpreter, so we can't allow it (but a detailed error
3392 3406 is given to the user).
3393 3407
3394 3408 2004-09-28 Fernando Perez <fperez@colorado.edu>
3395 3409
3396 3410 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3397 3411 matplotlib-related fixes so that using @run with non-matplotlib
3398 3412 scripts doesn't pop up spurious plot windows. This requires
3399 3413 matplotlib >= 0.63, where I had to make some changes as well.
3400 3414
3401 3415 * IPython/ipmaker.py (make_IPython): update version requirement to
3402 3416 python 2.2.
3403 3417
3404 3418 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3405 3419 banner arg for embedded customization.
3406 3420
3407 3421 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3408 3422 explicit uses of __IP as the IPython's instance name. Now things
3409 3423 are properly handled via the shell.name value. The actual code
3410 3424 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3411 3425 is much better than before. I'll clean things completely when the
3412 3426 magic stuff gets a real overhaul.
3413 3427
3414 3428 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3415 3429 minor changes to debian dir.
3416 3430
3417 3431 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3418 3432 pointer to the shell itself in the interactive namespace even when
3419 3433 a user-supplied dict is provided. This is needed for embedding
3420 3434 purposes (found by tests with Michel Sanner).
3421 3435
3422 3436 2004-09-27 Fernando Perez <fperez@colorado.edu>
3423 3437
3424 3438 * IPython/UserConfig/ipythonrc: remove []{} from
3425 3439 readline_remove_delims, so that things like [modname.<TAB> do
3426 3440 proper completion. This disables [].TAB, but that's a less common
3427 3441 case than module names in list comprehensions, for example.
3428 3442 Thanks to a report by Andrea Riciputi.
3429 3443
3430 3444 2004-09-09 Fernando Perez <fperez@colorado.edu>
3431 3445
3432 3446 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3433 3447 blocking problems in win32 and osx. Fix by John.
3434 3448
3435 3449 2004-09-08 Fernando Perez <fperez@colorado.edu>
3436 3450
3437 3451 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3438 3452 for Win32 and OSX. Fix by John Hunter.
3439 3453
3440 3454 2004-08-30 *** Released version 0.6.3
3441 3455
3442 3456 2004-08-30 Fernando Perez <fperez@colorado.edu>
3443 3457
3444 3458 * setup.py (isfile): Add manpages to list of dependent files to be
3445 3459 updated.
3446 3460
3447 3461 2004-08-27 Fernando Perez <fperez@colorado.edu>
3448 3462
3449 3463 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3450 3464 for now. They don't really work with standalone WX/GTK code
3451 3465 (though matplotlib IS working fine with both of those backends).
3452 3466 This will neeed much more testing. I disabled most things with
3453 3467 comments, so turning it back on later should be pretty easy.
3454 3468
3455 3469 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3456 3470 autocalling of expressions like r'foo', by modifying the line
3457 3471 split regexp. Closes
3458 3472 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3459 3473 Riley <ipythonbugs-AT-sabi.net>.
3460 3474 (InteractiveShell.mainloop): honor --nobanner with banner
3461 3475 extensions.
3462 3476
3463 3477 * IPython/Shell.py: Significant refactoring of all classes, so
3464 3478 that we can really support ALL matplotlib backends and threading
3465 3479 models (John spotted a bug with Tk which required this). Now we
3466 3480 should support single-threaded, WX-threads and GTK-threads, both
3467 3481 for generic code and for matplotlib.
3468 3482
3469 3483 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3470 3484 -pylab, to simplify things for users. Will also remove the pylab
3471 3485 profile, since now all of matplotlib configuration is directly
3472 3486 handled here. This also reduces startup time.
3473 3487
3474 3488 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3475 3489 shell wasn't being correctly called. Also in IPShellWX.
3476 3490
3477 3491 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3478 3492 fine-tune banner.
3479 3493
3480 3494 * IPython/numutils.py (spike): Deprecate these spike functions,
3481 3495 delete (long deprecated) gnuplot_exec handler.
3482 3496
3483 3497 2004-08-26 Fernando Perez <fperez@colorado.edu>
3484 3498
3485 3499 * ipython.1: Update for threading options, plus some others which
3486 3500 were missing.
3487 3501
3488 3502 * IPython/ipmaker.py (__call__): Added -wthread option for
3489 3503 wxpython thread handling. Make sure threading options are only
3490 3504 valid at the command line.
3491 3505
3492 3506 * scripts/ipython: moved shell selection into a factory function
3493 3507 in Shell.py, to keep the starter script to a minimum.
3494 3508
3495 3509 2004-08-25 Fernando Perez <fperez@colorado.edu>
3496 3510
3497 3511 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3498 3512 John. Along with some recent changes he made to matplotlib, the
3499 3513 next versions of both systems should work very well together.
3500 3514
3501 3515 2004-08-24 Fernando Perez <fperez@colorado.edu>
3502 3516
3503 3517 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3504 3518 tried to switch the profiling to using hotshot, but I'm getting
3505 3519 strange errors from prof.runctx() there. I may be misreading the
3506 3520 docs, but it looks weird. For now the profiling code will
3507 3521 continue to use the standard profiler.
3508 3522
3509 3523 2004-08-23 Fernando Perez <fperez@colorado.edu>
3510 3524
3511 3525 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3512 3526 threaded shell, by John Hunter. It's not quite ready yet, but
3513 3527 close.
3514 3528
3515 3529 2004-08-22 Fernando Perez <fperez@colorado.edu>
3516 3530
3517 3531 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3518 3532 in Magic and ultraTB.
3519 3533
3520 3534 * ipython.1: document threading options in manpage.
3521 3535
3522 3536 * scripts/ipython: Changed name of -thread option to -gthread,
3523 3537 since this is GTK specific. I want to leave the door open for a
3524 3538 -wthread option for WX, which will most likely be necessary. This
3525 3539 change affects usage and ipmaker as well.
3526 3540
3527 3541 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3528 3542 handle the matplotlib shell issues. Code by John Hunter
3529 3543 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3530 3544 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3531 3545 broken (and disabled for end users) for now, but it puts the
3532 3546 infrastructure in place.
3533 3547
3534 3548 2004-08-21 Fernando Perez <fperez@colorado.edu>
3535 3549
3536 3550 * ipythonrc-pylab: Add matplotlib support.
3537 3551
3538 3552 * matplotlib_config.py: new files for matplotlib support, part of
3539 3553 the pylab profile.
3540 3554
3541 3555 * IPython/usage.py (__doc__): documented the threading options.
3542 3556
3543 3557 2004-08-20 Fernando Perez <fperez@colorado.edu>
3544 3558
3545 3559 * ipython: Modified the main calling routine to handle the -thread
3546 3560 and -mpthread options. This needs to be done as a top-level hack,
3547 3561 because it determines which class to instantiate for IPython
3548 3562 itself.
3549 3563
3550 3564 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3551 3565 classes to support multithreaded GTK operation without blocking,
3552 3566 and matplotlib with all backends. This is a lot of still very
3553 3567 experimental code, and threads are tricky. So it may still have a
3554 3568 few rough edges... This code owes a lot to
3555 3569 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3556 3570 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3557 3571 to John Hunter for all the matplotlib work.
3558 3572
3559 3573 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3560 3574 options for gtk thread and matplotlib support.
3561 3575
3562 3576 2004-08-16 Fernando Perez <fperez@colorado.edu>
3563 3577
3564 3578 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3565 3579 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3566 3580 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3567 3581
3568 3582 2004-08-11 Fernando Perez <fperez@colorado.edu>
3569 3583
3570 3584 * setup.py (isfile): Fix build so documentation gets updated for
3571 3585 rpms (it was only done for .tgz builds).
3572 3586
3573 3587 2004-08-10 Fernando Perez <fperez@colorado.edu>
3574 3588
3575 3589 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3576 3590
3577 3591 * iplib.py : Silence syntax error exceptions in tab-completion.
3578 3592
3579 3593 2004-08-05 Fernando Perez <fperez@colorado.edu>
3580 3594
3581 3595 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3582 3596 'color off' mark for continuation prompts. This was causing long
3583 3597 continuation lines to mis-wrap.
3584 3598
3585 3599 2004-08-01 Fernando Perez <fperez@colorado.edu>
3586 3600
3587 3601 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3588 3602 for building ipython to be a parameter. All this is necessary
3589 3603 right now to have a multithreaded version, but this insane
3590 3604 non-design will be cleaned up soon. For now, it's a hack that
3591 3605 works.
3592 3606
3593 3607 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3594 3608 args in various places. No bugs so far, but it's a dangerous
3595 3609 practice.
3596 3610
3597 3611 2004-07-31 Fernando Perez <fperez@colorado.edu>
3598 3612
3599 3613 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3600 3614 fix completion of files with dots in their names under most
3601 3615 profiles (pysh was OK because the completion order is different).
3602 3616
3603 3617 2004-07-27 Fernando Perez <fperez@colorado.edu>
3604 3618
3605 3619 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3606 3620 keywords manually, b/c the one in keyword.py was removed in python
3607 3621 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3608 3622 This is NOT a bug under python 2.3 and earlier.
3609 3623
3610 3624 2004-07-26 Fernando Perez <fperez@colorado.edu>
3611 3625
3612 3626 * IPython/ultraTB.py (VerboseTB.text): Add another
3613 3627 linecache.checkcache() call to try to prevent inspect.py from
3614 3628 crashing under python 2.3. I think this fixes
3615 3629 http://www.scipy.net/roundup/ipython/issue17.
3616 3630
3617 3631 2004-07-26 *** Released version 0.6.2
3618 3632
3619 3633 2004-07-26 Fernando Perez <fperez@colorado.edu>
3620 3634
3621 3635 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3622 3636 fail for any number.
3623 3637 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3624 3638 empty bookmarks.
3625 3639
3626 3640 2004-07-26 *** Released version 0.6.1
3627 3641
3628 3642 2004-07-26 Fernando Perez <fperez@colorado.edu>
3629 3643
3630 3644 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3631 3645
3632 3646 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3633 3647 escaping '()[]{}' in filenames.
3634 3648
3635 3649 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3636 3650 Python 2.2 users who lack a proper shlex.split.
3637 3651
3638 3652 2004-07-19 Fernando Perez <fperez@colorado.edu>
3639 3653
3640 3654 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3641 3655 for reading readline's init file. I follow the normal chain:
3642 3656 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3643 3657 report by Mike Heeter. This closes
3644 3658 http://www.scipy.net/roundup/ipython/issue16.
3645 3659
3646 3660 2004-07-18 Fernando Perez <fperez@colorado.edu>
3647 3661
3648 3662 * IPython/iplib.py (__init__): Add better handling of '\' under
3649 3663 Win32 for filenames. After a patch by Ville.
3650 3664
3651 3665 2004-07-17 Fernando Perez <fperez@colorado.edu>
3652 3666
3653 3667 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3654 3668 autocalling would be triggered for 'foo is bar' if foo is
3655 3669 callable. I also cleaned up the autocall detection code to use a
3656 3670 regexp, which is faster. Bug reported by Alexander Schmolck.
3657 3671
3658 3672 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3659 3673 '?' in them would confuse the help system. Reported by Alex
3660 3674 Schmolck.
3661 3675
3662 3676 2004-07-16 Fernando Perez <fperez@colorado.edu>
3663 3677
3664 3678 * IPython/GnuplotInteractive.py (__all__): added plot2.
3665 3679
3666 3680 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3667 3681 plotting dictionaries, lists or tuples of 1d arrays.
3668 3682
3669 3683 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3670 3684 optimizations.
3671 3685
3672 3686 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3673 3687 the information which was there from Janko's original IPP code:
3674 3688
3675 3689 03.05.99 20:53 porto.ifm.uni-kiel.de
3676 3690 --Started changelog.
3677 3691 --make clear do what it say it does
3678 3692 --added pretty output of lines from inputcache
3679 3693 --Made Logger a mixin class, simplifies handling of switches
3680 3694 --Added own completer class. .string<TAB> expands to last history
3681 3695 line which starts with string. The new expansion is also present
3682 3696 with Ctrl-r from the readline library. But this shows, who this
3683 3697 can be done for other cases.
3684 3698 --Added convention that all shell functions should accept a
3685 3699 parameter_string This opens the door for different behaviour for
3686 3700 each function. @cd is a good example of this.
3687 3701
3688 3702 04.05.99 12:12 porto.ifm.uni-kiel.de
3689 3703 --added logfile rotation
3690 3704 --added new mainloop method which freezes first the namespace
3691 3705
3692 3706 07.05.99 21:24 porto.ifm.uni-kiel.de
3693 3707 --added the docreader classes. Now there is a help system.
3694 3708 -This is only a first try. Currently it's not easy to put new
3695 3709 stuff in the indices. But this is the way to go. Info would be
3696 3710 better, but HTML is every where and not everybody has an info
3697 3711 system installed and it's not so easy to change html-docs to info.
3698 3712 --added global logfile option
3699 3713 --there is now a hook for object inspection method pinfo needs to
3700 3714 be provided for this. Can be reached by two '??'.
3701 3715
3702 3716 08.05.99 20:51 porto.ifm.uni-kiel.de
3703 3717 --added a README
3704 3718 --bug in rc file. Something has changed so functions in the rc
3705 3719 file need to reference the shell and not self. Not clear if it's a
3706 3720 bug or feature.
3707 3721 --changed rc file for new behavior
3708 3722
3709 3723 2004-07-15 Fernando Perez <fperez@colorado.edu>
3710 3724
3711 3725 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3712 3726 cache was falling out of sync in bizarre manners when multi-line
3713 3727 input was present. Minor optimizations and cleanup.
3714 3728
3715 3729 (Logger): Remove old Changelog info for cleanup. This is the
3716 3730 information which was there from Janko's original code:
3717 3731
3718 3732 Changes to Logger: - made the default log filename a parameter
3719 3733
3720 3734 - put a check for lines beginning with !@? in log(). Needed
3721 3735 (even if the handlers properly log their lines) for mid-session
3722 3736 logging activation to work properly. Without this, lines logged
3723 3737 in mid session, which get read from the cache, would end up
3724 3738 'bare' (with !@? in the open) in the log. Now they are caught
3725 3739 and prepended with a #.
3726 3740
3727 3741 * IPython/iplib.py (InteractiveShell.init_readline): added check
3728 3742 in case MagicCompleter fails to be defined, so we don't crash.
3729 3743
3730 3744 2004-07-13 Fernando Perez <fperez@colorado.edu>
3731 3745
3732 3746 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3733 3747 of EPS if the requested filename ends in '.eps'.
3734 3748
3735 3749 2004-07-04 Fernando Perez <fperez@colorado.edu>
3736 3750
3737 3751 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3738 3752 escaping of quotes when calling the shell.
3739 3753
3740 3754 2004-07-02 Fernando Perez <fperez@colorado.edu>
3741 3755
3742 3756 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3743 3757 gettext not working because we were clobbering '_'. Fixes
3744 3758 http://www.scipy.net/roundup/ipython/issue6.
3745 3759
3746 3760 2004-07-01 Fernando Perez <fperez@colorado.edu>
3747 3761
3748 3762 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3749 3763 into @cd. Patch by Ville.
3750 3764
3751 3765 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3752 3766 new function to store things after ipmaker runs. Patch by Ville.
3753 3767 Eventually this will go away once ipmaker is removed and the class
3754 3768 gets cleaned up, but for now it's ok. Key functionality here is
3755 3769 the addition of the persistent storage mechanism, a dict for
3756 3770 keeping data across sessions (for now just bookmarks, but more can
3757 3771 be implemented later).
3758 3772
3759 3773 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3760 3774 persistent across sections. Patch by Ville, I modified it
3761 3775 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3762 3776 added a '-l' option to list all bookmarks.
3763 3777
3764 3778 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3765 3779 center for cleanup. Registered with atexit.register(). I moved
3766 3780 here the old exit_cleanup(). After a patch by Ville.
3767 3781
3768 3782 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3769 3783 characters in the hacked shlex_split for python 2.2.
3770 3784
3771 3785 * IPython/iplib.py (file_matches): more fixes to filenames with
3772 3786 whitespace in them. It's not perfect, but limitations in python's
3773 3787 readline make it impossible to go further.
3774 3788
3775 3789 2004-06-29 Fernando Perez <fperez@colorado.edu>
3776 3790
3777 3791 * IPython/iplib.py (file_matches): escape whitespace correctly in
3778 3792 filename completions. Bug reported by Ville.
3779 3793
3780 3794 2004-06-28 Fernando Perez <fperez@colorado.edu>
3781 3795
3782 3796 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3783 3797 the history file will be called 'history-PROFNAME' (or just
3784 3798 'history' if no profile is loaded). I was getting annoyed at
3785 3799 getting my Numerical work history clobbered by pysh sessions.
3786 3800
3787 3801 * IPython/iplib.py (InteractiveShell.__init__): Internal
3788 3802 getoutputerror() function so that we can honor the system_verbose
3789 3803 flag for _all_ system calls. I also added escaping of #
3790 3804 characters here to avoid confusing Itpl.
3791 3805
3792 3806 * IPython/Magic.py (shlex_split): removed call to shell in
3793 3807 parse_options and replaced it with shlex.split(). The annoying
3794 3808 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3795 3809 to backport it from 2.3, with several frail hacks (the shlex
3796 3810 module is rather limited in 2.2). Thanks to a suggestion by Ville
3797 3811 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3798 3812 problem.
3799 3813
3800 3814 (Magic.magic_system_verbose): new toggle to print the actual
3801 3815 system calls made by ipython. Mainly for debugging purposes.
3802 3816
3803 3817 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3804 3818 doesn't support persistence. Reported (and fix suggested) by
3805 3819 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3806 3820
3807 3821 2004-06-26 Fernando Perez <fperez@colorado.edu>
3808 3822
3809 3823 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3810 3824 continue prompts.
3811 3825
3812 3826 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3813 3827 function (basically a big docstring) and a few more things here to
3814 3828 speedup startup. pysh.py is now very lightweight. We want because
3815 3829 it gets execfile'd, while InterpreterExec gets imported, so
3816 3830 byte-compilation saves time.
3817 3831
3818 3832 2004-06-25 Fernando Perez <fperez@colorado.edu>
3819 3833
3820 3834 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3821 3835 -NUM', which was recently broken.
3822 3836
3823 3837 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3824 3838 in multi-line input (but not !!, which doesn't make sense there).
3825 3839
3826 3840 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3827 3841 It's just too useful, and people can turn it off in the less
3828 3842 common cases where it's a problem.
3829 3843
3830 3844 2004-06-24 Fernando Perez <fperez@colorado.edu>
3831 3845
3832 3846 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3833 3847 special syntaxes (like alias calling) is now allied in multi-line
3834 3848 input. This is still _very_ experimental, but it's necessary for
3835 3849 efficient shell usage combining python looping syntax with system
3836 3850 calls. For now it's restricted to aliases, I don't think it
3837 3851 really even makes sense to have this for magics.
3838 3852
3839 3853 2004-06-23 Fernando Perez <fperez@colorado.edu>
3840 3854
3841 3855 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3842 3856 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3843 3857
3844 3858 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3845 3859 extensions under Windows (after code sent by Gary Bishop). The
3846 3860 extensions considered 'executable' are stored in IPython's rc
3847 3861 structure as win_exec_ext.
3848 3862
3849 3863 * IPython/genutils.py (shell): new function, like system() but
3850 3864 without return value. Very useful for interactive shell work.
3851 3865
3852 3866 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3853 3867 delete aliases.
3854 3868
3855 3869 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3856 3870 sure that the alias table doesn't contain python keywords.
3857 3871
3858 3872 2004-06-21 Fernando Perez <fperez@colorado.edu>
3859 3873
3860 3874 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3861 3875 non-existent items are found in $PATH. Reported by Thorsten.
3862 3876
3863 3877 2004-06-20 Fernando Perez <fperez@colorado.edu>
3864 3878
3865 3879 * IPython/iplib.py (complete): modified the completer so that the
3866 3880 order of priorities can be easily changed at runtime.
3867 3881
3868 3882 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3869 3883 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3870 3884
3871 3885 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3872 3886 expand Python variables prepended with $ in all system calls. The
3873 3887 same was done to InteractiveShell.handle_shell_escape. Now all
3874 3888 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3875 3889 expansion of python variables and expressions according to the
3876 3890 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3877 3891
3878 3892 Though PEP-215 has been rejected, a similar (but simpler) one
3879 3893 seems like it will go into Python 2.4, PEP-292 -
3880 3894 http://www.python.org/peps/pep-0292.html.
3881 3895
3882 3896 I'll keep the full syntax of PEP-215, since IPython has since the
3883 3897 start used Ka-Ping Yee's reference implementation discussed there
3884 3898 (Itpl), and I actually like the powerful semantics it offers.
3885 3899
3886 3900 In order to access normal shell variables, the $ has to be escaped
3887 3901 via an extra $. For example:
3888 3902
3889 3903 In [7]: PATH='a python variable'
3890 3904
3891 3905 In [8]: !echo $PATH
3892 3906 a python variable
3893 3907
3894 3908 In [9]: !echo $$PATH
3895 3909 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3896 3910
3897 3911 (Magic.parse_options): escape $ so the shell doesn't evaluate
3898 3912 things prematurely.
3899 3913
3900 3914 * IPython/iplib.py (InteractiveShell.call_alias): added the
3901 3915 ability for aliases to expand python variables via $.
3902 3916
3903 3917 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3904 3918 system, now there's a @rehash/@rehashx pair of magics. These work
3905 3919 like the csh rehash command, and can be invoked at any time. They
3906 3920 build a table of aliases to everything in the user's $PATH
3907 3921 (@rehash uses everything, @rehashx is slower but only adds
3908 3922 executable files). With this, the pysh.py-based shell profile can
3909 3923 now simply call rehash upon startup, and full access to all
3910 3924 programs in the user's path is obtained.
3911 3925
3912 3926 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3913 3927 functionality is now fully in place. I removed the old dynamic
3914 3928 code generation based approach, in favor of a much lighter one
3915 3929 based on a simple dict. The advantage is that this allows me to
3916 3930 now have thousands of aliases with negligible cost (unthinkable
3917 3931 with the old system).
3918 3932
3919 3933 2004-06-19 Fernando Perez <fperez@colorado.edu>
3920 3934
3921 3935 * IPython/iplib.py (__init__): extended MagicCompleter class to
3922 3936 also complete (last in priority) on user aliases.
3923 3937
3924 3938 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3925 3939 call to eval.
3926 3940 (ItplNS.__init__): Added a new class which functions like Itpl,
3927 3941 but allows configuring the namespace for the evaluation to occur
3928 3942 in.
3929 3943
3930 3944 2004-06-18 Fernando Perez <fperez@colorado.edu>
3931 3945
3932 3946 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3933 3947 better message when 'exit' or 'quit' are typed (a common newbie
3934 3948 confusion).
3935 3949
3936 3950 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3937 3951 check for Windows users.
3938 3952
3939 3953 * IPython/iplib.py (InteractiveShell.user_setup): removed
3940 3954 disabling of colors for Windows. I'll test at runtime and issue a
3941 3955 warning if Gary's readline isn't found, as to nudge users to
3942 3956 download it.
3943 3957
3944 3958 2004-06-16 Fernando Perez <fperez@colorado.edu>
3945 3959
3946 3960 * IPython/genutils.py (Stream.__init__): changed to print errors
3947 3961 to sys.stderr. I had a circular dependency here. Now it's
3948 3962 possible to run ipython as IDLE's shell (consider this pre-alpha,
3949 3963 since true stdout things end up in the starting terminal instead
3950 3964 of IDLE's out).
3951 3965
3952 3966 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3953 3967 users who haven't # updated their prompt_in2 definitions. Remove
3954 3968 eventually.
3955 3969 (multiple_replace): added credit to original ASPN recipe.
3956 3970
3957 3971 2004-06-15 Fernando Perez <fperez@colorado.edu>
3958 3972
3959 3973 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3960 3974 list of auto-defined aliases.
3961 3975
3962 3976 2004-06-13 Fernando Perez <fperez@colorado.edu>
3963 3977
3964 3978 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3965 3979 install was really requested (so setup.py can be used for other
3966 3980 things under Windows).
3967 3981
3968 3982 2004-06-10 Fernando Perez <fperez@colorado.edu>
3969 3983
3970 3984 * IPython/Logger.py (Logger.create_log): Manually remove any old
3971 3985 backup, since os.remove may fail under Windows. Fixes bug
3972 3986 reported by Thorsten.
3973 3987
3974 3988 2004-06-09 Fernando Perez <fperez@colorado.edu>
3975 3989
3976 3990 * examples/example-embed.py: fixed all references to %n (replaced
3977 3991 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3978 3992 for all examples and the manual as well.
3979 3993
3980 3994 2004-06-08 Fernando Perez <fperez@colorado.edu>
3981 3995
3982 3996 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3983 3997 alignment and color management. All 3 prompt subsystems now
3984 3998 inherit from BasePrompt.
3985 3999
3986 4000 * tools/release: updates for windows installer build and tag rpms
3987 4001 with python version (since paths are fixed).
3988 4002
3989 4003 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3990 4004 which will become eventually obsolete. Also fixed the default
3991 4005 prompt_in2 to use \D, so at least new users start with the correct
3992 4006 defaults.
3993 4007 WARNING: Users with existing ipythonrc files will need to apply
3994 4008 this fix manually!
3995 4009
3996 4010 * setup.py: make windows installer (.exe). This is finally the
3997 4011 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3998 4012 which I hadn't included because it required Python 2.3 (or recent
3999 4013 distutils).
4000 4014
4001 4015 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4002 4016 usage of new '\D' escape.
4003 4017
4004 4018 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4005 4019 lacks os.getuid())
4006 4020 (CachedOutput.set_colors): Added the ability to turn coloring
4007 4021 on/off with @colors even for manually defined prompt colors. It
4008 4022 uses a nasty global, but it works safely and via the generic color
4009 4023 handling mechanism.
4010 4024 (Prompt2.__init__): Introduced new escape '\D' for continuation
4011 4025 prompts. It represents the counter ('\#') as dots.
4012 4026 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4013 4027 need to update their ipythonrc files and replace '%n' with '\D' in
4014 4028 their prompt_in2 settings everywhere. Sorry, but there's
4015 4029 otherwise no clean way to get all prompts to properly align. The
4016 4030 ipythonrc shipped with IPython has been updated.
4017 4031
4018 4032 2004-06-07 Fernando Perez <fperez@colorado.edu>
4019 4033
4020 4034 * setup.py (isfile): Pass local_icons option to latex2html, so the
4021 4035 resulting HTML file is self-contained. Thanks to
4022 4036 dryice-AT-liu.com.cn for the tip.
4023 4037
4024 4038 * pysh.py: I created a new profile 'shell', which implements a
4025 4039 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4026 4040 system shell, nor will it become one anytime soon. It's mainly
4027 4041 meant to illustrate the use of the new flexible bash-like prompts.
4028 4042 I guess it could be used by hardy souls for true shell management,
4029 4043 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4030 4044 profile. This uses the InterpreterExec extension provided by
4031 4045 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4032 4046
4033 4047 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4034 4048 auto-align itself with the length of the previous input prompt
4035 4049 (taking into account the invisible color escapes).
4036 4050 (CachedOutput.__init__): Large restructuring of this class. Now
4037 4051 all three prompts (primary1, primary2, output) are proper objects,
4038 4052 managed by the 'parent' CachedOutput class. The code is still a
4039 4053 bit hackish (all prompts share state via a pointer to the cache),
4040 4054 but it's overall far cleaner than before.
4041 4055
4042 4056 * IPython/genutils.py (getoutputerror): modified to add verbose,
4043 4057 debug and header options. This makes the interface of all getout*
4044 4058 functions uniform.
4045 4059 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4046 4060
4047 4061 * IPython/Magic.py (Magic.default_option): added a function to
4048 4062 allow registering default options for any magic command. This
4049 4063 makes it easy to have profiles which customize the magics globally
4050 4064 for a certain use. The values set through this function are
4051 4065 picked up by the parse_options() method, which all magics should
4052 4066 use to parse their options.
4053 4067
4054 4068 * IPython/genutils.py (warn): modified the warnings framework to
4055 4069 use the Term I/O class. I'm trying to slowly unify all of
4056 4070 IPython's I/O operations to pass through Term.
4057 4071
4058 4072 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4059 4073 the secondary prompt to correctly match the length of the primary
4060 4074 one for any prompt. Now multi-line code will properly line up
4061 4075 even for path dependent prompts, such as the new ones available
4062 4076 via the prompt_specials.
4063 4077
4064 4078 2004-06-06 Fernando Perez <fperez@colorado.edu>
4065 4079
4066 4080 * IPython/Prompts.py (prompt_specials): Added the ability to have
4067 4081 bash-like special sequences in the prompts, which get
4068 4082 automatically expanded. Things like hostname, current working
4069 4083 directory and username are implemented already, but it's easy to
4070 4084 add more in the future. Thanks to a patch by W.J. van der Laan
4071 4085 <gnufnork-AT-hetdigitalegat.nl>
4072 4086 (prompt_specials): Added color support for prompt strings, so
4073 4087 users can define arbitrary color setups for their prompts.
4074 4088
4075 4089 2004-06-05 Fernando Perez <fperez@colorado.edu>
4076 4090
4077 4091 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4078 4092 code to load Gary Bishop's readline and configure it
4079 4093 automatically. Thanks to Gary for help on this.
4080 4094
4081 4095 2004-06-01 Fernando Perez <fperez@colorado.edu>
4082 4096
4083 4097 * IPython/Logger.py (Logger.create_log): fix bug for logging
4084 4098 with no filename (previous fix was incomplete).
4085 4099
4086 4100 2004-05-25 Fernando Perez <fperez@colorado.edu>
4087 4101
4088 4102 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4089 4103 parens would get passed to the shell.
4090 4104
4091 4105 2004-05-20 Fernando Perez <fperez@colorado.edu>
4092 4106
4093 4107 * IPython/Magic.py (Magic.magic_prun): changed default profile
4094 4108 sort order to 'time' (the more common profiling need).
4095 4109
4096 4110 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4097 4111 so that source code shown is guaranteed in sync with the file on
4098 4112 disk (also changed in psource). Similar fix to the one for
4099 4113 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4100 4114 <yann.ledu-AT-noos.fr>.
4101 4115
4102 4116 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4103 4117 with a single option would not be correctly parsed. Closes
4104 4118 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4105 4119 introduced in 0.6.0 (on 2004-05-06).
4106 4120
4107 4121 2004-05-13 *** Released version 0.6.0
4108 4122
4109 4123 2004-05-13 Fernando Perez <fperez@colorado.edu>
4110 4124
4111 4125 * debian/: Added debian/ directory to CVS, so that debian support
4112 4126 is publicly accessible. The debian package is maintained by Jack
4113 4127 Moffit <jack-AT-xiph.org>.
4114 4128
4115 4129 * Documentation: included the notes about an ipython-based system
4116 4130 shell (the hypothetical 'pysh') into the new_design.pdf document,
4117 4131 so that these ideas get distributed to users along with the
4118 4132 official documentation.
4119 4133
4120 4134 2004-05-10 Fernando Perez <fperez@colorado.edu>
4121 4135
4122 4136 * IPython/Logger.py (Logger.create_log): fix recently introduced
4123 4137 bug (misindented line) where logstart would fail when not given an
4124 4138 explicit filename.
4125 4139
4126 4140 2004-05-09 Fernando Perez <fperez@colorado.edu>
4127 4141
4128 4142 * IPython/Magic.py (Magic.parse_options): skip system call when
4129 4143 there are no options to look for. Faster, cleaner for the common
4130 4144 case.
4131 4145
4132 4146 * Documentation: many updates to the manual: describing Windows
4133 4147 support better, Gnuplot updates, credits, misc small stuff. Also
4134 4148 updated the new_design doc a bit.
4135 4149
4136 4150 2004-05-06 *** Released version 0.6.0.rc1
4137 4151
4138 4152 2004-05-06 Fernando Perez <fperez@colorado.edu>
4139 4153
4140 4154 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4141 4155 operations to use the vastly more efficient list/''.join() method.
4142 4156 (FormattedTB.text): Fix
4143 4157 http://www.scipy.net/roundup/ipython/issue12 - exception source
4144 4158 extract not updated after reload. Thanks to Mike Salib
4145 4159 <msalib-AT-mit.edu> for pinning the source of the problem.
4146 4160 Fortunately, the solution works inside ipython and doesn't require
4147 4161 any changes to python proper.
4148 4162
4149 4163 * IPython/Magic.py (Magic.parse_options): Improved to process the
4150 4164 argument list as a true shell would (by actually using the
4151 4165 underlying system shell). This way, all @magics automatically get
4152 4166 shell expansion for variables. Thanks to a comment by Alex
4153 4167 Schmolck.
4154 4168
4155 4169 2004-04-04 Fernando Perez <fperez@colorado.edu>
4156 4170
4157 4171 * IPython/iplib.py (InteractiveShell.interact): Added a special
4158 4172 trap for a debugger quit exception, which is basically impossible
4159 4173 to handle by normal mechanisms, given what pdb does to the stack.
4160 4174 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4161 4175
4162 4176 2004-04-03 Fernando Perez <fperez@colorado.edu>
4163 4177
4164 4178 * IPython/genutils.py (Term): Standardized the names of the Term
4165 4179 class streams to cin/cout/cerr, following C++ naming conventions
4166 4180 (I can't use in/out/err because 'in' is not a valid attribute
4167 4181 name).
4168 4182
4169 4183 * IPython/iplib.py (InteractiveShell.interact): don't increment
4170 4184 the prompt if there's no user input. By Daniel 'Dang' Griffith
4171 4185 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4172 4186 Francois Pinard.
4173 4187
4174 4188 2004-04-02 Fernando Perez <fperez@colorado.edu>
4175 4189
4176 4190 * IPython/genutils.py (Stream.__init__): Modified to survive at
4177 4191 least importing in contexts where stdin/out/err aren't true file
4178 4192 objects, such as PyCrust (they lack fileno() and mode). However,
4179 4193 the recovery facilities which rely on these things existing will
4180 4194 not work.
4181 4195
4182 4196 2004-04-01 Fernando Perez <fperez@colorado.edu>
4183 4197
4184 4198 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4185 4199 use the new getoutputerror() function, so it properly
4186 4200 distinguishes stdout/err.
4187 4201
4188 4202 * IPython/genutils.py (getoutputerror): added a function to
4189 4203 capture separately the standard output and error of a command.
4190 4204 After a comment from dang on the mailing lists. This code is
4191 4205 basically a modified version of commands.getstatusoutput(), from
4192 4206 the standard library.
4193 4207
4194 4208 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4195 4209 '!!' as a special syntax (shorthand) to access @sx.
4196 4210
4197 4211 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4198 4212 command and return its output as a list split on '\n'.
4199 4213
4200 4214 2004-03-31 Fernando Perez <fperez@colorado.edu>
4201 4215
4202 4216 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4203 4217 method to dictionaries used as FakeModule instances if they lack
4204 4218 it. At least pydoc in python2.3 breaks for runtime-defined
4205 4219 functions without this hack. At some point I need to _really_
4206 4220 understand what FakeModule is doing, because it's a gross hack.
4207 4221 But it solves Arnd's problem for now...
4208 4222
4209 4223 2004-02-27 Fernando Perez <fperez@colorado.edu>
4210 4224
4211 4225 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4212 4226 mode would behave erratically. Also increased the number of
4213 4227 possible logs in rotate mod to 999. Thanks to Rod Holland
4214 4228 <rhh@StructureLABS.com> for the report and fixes.
4215 4229
4216 4230 2004-02-26 Fernando Perez <fperez@colorado.edu>
4217 4231
4218 4232 * IPython/genutils.py (page): Check that the curses module really
4219 4233 has the initscr attribute before trying to use it. For some
4220 4234 reason, the Solaris curses module is missing this. I think this
4221 4235 should be considered a Solaris python bug, but I'm not sure.
4222 4236
4223 4237 2004-01-17 Fernando Perez <fperez@colorado.edu>
4224 4238
4225 4239 * IPython/genutils.py (Stream.__init__): Changes to try to make
4226 4240 ipython robust against stdin/out/err being closed by the user.
4227 4241 This is 'user error' (and blocks a normal python session, at least
4228 4242 the stdout case). However, Ipython should be able to survive such
4229 4243 instances of abuse as gracefully as possible. To simplify the
4230 4244 coding and maintain compatibility with Gary Bishop's Term
4231 4245 contributions, I've made use of classmethods for this. I think
4232 4246 this introduces a dependency on python 2.2.
4233 4247
4234 4248 2004-01-13 Fernando Perez <fperez@colorado.edu>
4235 4249
4236 4250 * IPython/numutils.py (exp_safe): simplified the code a bit and
4237 4251 removed the need for importing the kinds module altogether.
4238 4252
4239 4253 2004-01-06 Fernando Perez <fperez@colorado.edu>
4240 4254
4241 4255 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4242 4256 a magic function instead, after some community feedback. No
4243 4257 special syntax will exist for it, but its name is deliberately
4244 4258 very short.
4245 4259
4246 4260 2003-12-20 Fernando Perez <fperez@colorado.edu>
4247 4261
4248 4262 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4249 4263 new functionality, to automagically assign the result of a shell
4250 4264 command to a variable. I'll solicit some community feedback on
4251 4265 this before making it permanent.
4252 4266
4253 4267 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4254 4268 requested about callables for which inspect couldn't obtain a
4255 4269 proper argspec. Thanks to a crash report sent by Etienne
4256 4270 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4257 4271
4258 4272 2003-12-09 Fernando Perez <fperez@colorado.edu>
4259 4273
4260 4274 * IPython/genutils.py (page): patch for the pager to work across
4261 4275 various versions of Windows. By Gary Bishop.
4262 4276
4263 4277 2003-12-04 Fernando Perez <fperez@colorado.edu>
4264 4278
4265 4279 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4266 4280 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4267 4281 While I tested this and it looks ok, there may still be corner
4268 4282 cases I've missed.
4269 4283
4270 4284 2003-12-01 Fernando Perez <fperez@colorado.edu>
4271 4285
4272 4286 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4273 4287 where a line like 'p,q=1,2' would fail because the automagic
4274 4288 system would be triggered for @p.
4275 4289
4276 4290 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4277 4291 cleanups, code unmodified.
4278 4292
4279 4293 * IPython/genutils.py (Term): added a class for IPython to handle
4280 4294 output. In most cases it will just be a proxy for stdout/err, but
4281 4295 having this allows modifications to be made for some platforms,
4282 4296 such as handling color escapes under Windows. All of this code
4283 4297 was contributed by Gary Bishop, with minor modifications by me.
4284 4298 The actual changes affect many files.
4285 4299
4286 4300 2003-11-30 Fernando Perez <fperez@colorado.edu>
4287 4301
4288 4302 * IPython/iplib.py (file_matches): new completion code, courtesy
4289 4303 of Jeff Collins. This enables filename completion again under
4290 4304 python 2.3, which disabled it at the C level.
4291 4305
4292 4306 2003-11-11 Fernando Perez <fperez@colorado.edu>
4293 4307
4294 4308 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4295 4309 for Numeric.array(map(...)), but often convenient.
4296 4310
4297 4311 2003-11-05 Fernando Perez <fperez@colorado.edu>
4298 4312
4299 4313 * IPython/numutils.py (frange): Changed a call from int() to
4300 4314 int(round()) to prevent a problem reported with arange() in the
4301 4315 numpy list.
4302 4316
4303 4317 2003-10-06 Fernando Perez <fperez@colorado.edu>
4304 4318
4305 4319 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4306 4320 prevent crashes if sys lacks an argv attribute (it happens with
4307 4321 embedded interpreters which build a bare-bones sys module).
4308 4322 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4309 4323
4310 4324 2003-09-24 Fernando Perez <fperez@colorado.edu>
4311 4325
4312 4326 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4313 4327 to protect against poorly written user objects where __getattr__
4314 4328 raises exceptions other than AttributeError. Thanks to a bug
4315 4329 report by Oliver Sander <osander-AT-gmx.de>.
4316 4330
4317 4331 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4318 4332 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4319 4333
4320 4334 2003-09-09 Fernando Perez <fperez@colorado.edu>
4321 4335
4322 4336 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4323 4337 unpacking a list whith a callable as first element would
4324 4338 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4325 4339 Collins.
4326 4340
4327 4341 2003-08-25 *** Released version 0.5.0
4328 4342
4329 4343 2003-08-22 Fernando Perez <fperez@colorado.edu>
4330 4344
4331 4345 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4332 4346 improperly defined user exceptions. Thanks to feedback from Mark
4333 4347 Russell <mrussell-AT-verio.net>.
4334 4348
4335 4349 2003-08-20 Fernando Perez <fperez@colorado.edu>
4336 4350
4337 4351 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4338 4352 printing so that it would print multi-line string forms starting
4339 4353 with a new line. This way the formatting is better respected for
4340 4354 objects which work hard to make nice string forms.
4341 4355
4342 4356 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4343 4357 autocall would overtake data access for objects with both
4344 4358 __getitem__ and __call__.
4345 4359
4346 4360 2003-08-19 *** Released version 0.5.0-rc1
4347 4361
4348 4362 2003-08-19 Fernando Perez <fperez@colorado.edu>
4349 4363
4350 4364 * IPython/deep_reload.py (load_tail): single tiny change here
4351 4365 seems to fix the long-standing bug of dreload() failing to work
4352 4366 for dotted names. But this module is pretty tricky, so I may have
4353 4367 missed some subtlety. Needs more testing!.
4354 4368
4355 4369 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4356 4370 exceptions which have badly implemented __str__ methods.
4357 4371 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4358 4372 which I've been getting reports about from Python 2.3 users. I
4359 4373 wish I had a simple test case to reproduce the problem, so I could
4360 4374 either write a cleaner workaround or file a bug report if
4361 4375 necessary.
4362 4376
4363 4377 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4364 4378 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4365 4379 a bug report by Tjabo Kloppenburg.
4366 4380
4367 4381 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4368 4382 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4369 4383 seems rather unstable. Thanks to a bug report by Tjabo
4370 4384 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4371 4385
4372 4386 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4373 4387 this out soon because of the critical fixes in the inner loop for
4374 4388 generators.
4375 4389
4376 4390 * IPython/Magic.py (Magic.getargspec): removed. This (and
4377 4391 _get_def) have been obsoleted by OInspect for a long time, I
4378 4392 hadn't noticed that they were dead code.
4379 4393 (Magic._ofind): restored _ofind functionality for a few literals
4380 4394 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4381 4395 for things like "hello".capitalize?, since that would require a
4382 4396 potentially dangerous eval() again.
4383 4397
4384 4398 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4385 4399 logic a bit more to clean up the escapes handling and minimize the
4386 4400 use of _ofind to only necessary cases. The interactive 'feel' of
4387 4401 IPython should have improved quite a bit with the changes in
4388 4402 _prefilter and _ofind (besides being far safer than before).
4389 4403
4390 4404 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4391 4405 obscure, never reported). Edit would fail to find the object to
4392 4406 edit under some circumstances.
4393 4407 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4394 4408 which were causing double-calling of generators. Those eval calls
4395 4409 were _very_ dangerous, since code with side effects could be
4396 4410 triggered. As they say, 'eval is evil'... These were the
4397 4411 nastiest evals in IPython. Besides, _ofind is now far simpler,
4398 4412 and it should also be quite a bit faster. Its use of inspect is
4399 4413 also safer, so perhaps some of the inspect-related crashes I've
4400 4414 seen lately with Python 2.3 might be taken care of. That will
4401 4415 need more testing.
4402 4416
4403 4417 2003-08-17 Fernando Perez <fperez@colorado.edu>
4404 4418
4405 4419 * IPython/iplib.py (InteractiveShell._prefilter): significant
4406 4420 simplifications to the logic for handling user escapes. Faster
4407 4421 and simpler code.
4408 4422
4409 4423 2003-08-14 Fernando Perez <fperez@colorado.edu>
4410 4424
4411 4425 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4412 4426 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4413 4427 but it should be quite a bit faster. And the recursive version
4414 4428 generated O(log N) intermediate storage for all rank>1 arrays,
4415 4429 even if they were contiguous.
4416 4430 (l1norm): Added this function.
4417 4431 (norm): Added this function for arbitrary norms (including
4418 4432 l-infinity). l1 and l2 are still special cases for convenience
4419 4433 and speed.
4420 4434
4421 4435 2003-08-03 Fernando Perez <fperez@colorado.edu>
4422 4436
4423 4437 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4424 4438 exceptions, which now raise PendingDeprecationWarnings in Python
4425 4439 2.3. There were some in Magic and some in Gnuplot2.
4426 4440
4427 4441 2003-06-30 Fernando Perez <fperez@colorado.edu>
4428 4442
4429 4443 * IPython/genutils.py (page): modified to call curses only for
4430 4444 terminals where TERM=='xterm'. After problems under many other
4431 4445 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4432 4446
4433 4447 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4434 4448 would be triggered when readline was absent. This was just an old
4435 4449 debugging statement I'd forgotten to take out.
4436 4450
4437 4451 2003-06-20 Fernando Perez <fperez@colorado.edu>
4438 4452
4439 4453 * IPython/genutils.py (clock): modified to return only user time
4440 4454 (not counting system time), after a discussion on scipy. While
4441 4455 system time may be a useful quantity occasionally, it may much
4442 4456 more easily be skewed by occasional swapping or other similar
4443 4457 activity.
4444 4458
4445 4459 2003-06-05 Fernando Perez <fperez@colorado.edu>
4446 4460
4447 4461 * IPython/numutils.py (identity): new function, for building
4448 4462 arbitrary rank Kronecker deltas (mostly backwards compatible with
4449 4463 Numeric.identity)
4450 4464
4451 4465 2003-06-03 Fernando Perez <fperez@colorado.edu>
4452 4466
4453 4467 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4454 4468 arguments passed to magics with spaces, to allow trailing '\' to
4455 4469 work normally (mainly for Windows users).
4456 4470
4457 4471 2003-05-29 Fernando Perez <fperez@colorado.edu>
4458 4472
4459 4473 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4460 4474 instead of pydoc.help. This fixes a bizarre behavior where
4461 4475 printing '%s' % locals() would trigger the help system. Now
4462 4476 ipython behaves like normal python does.
4463 4477
4464 4478 Note that if one does 'from pydoc import help', the bizarre
4465 4479 behavior returns, but this will also happen in normal python, so
4466 4480 it's not an ipython bug anymore (it has to do with how pydoc.help
4467 4481 is implemented).
4468 4482
4469 4483 2003-05-22 Fernando Perez <fperez@colorado.edu>
4470 4484
4471 4485 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4472 4486 return [] instead of None when nothing matches, also match to end
4473 4487 of line. Patch by Gary Bishop.
4474 4488
4475 4489 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4476 4490 protection as before, for files passed on the command line. This
4477 4491 prevents the CrashHandler from kicking in if user files call into
4478 4492 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4479 4493 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4480 4494
4481 4495 2003-05-20 *** Released version 0.4.0
4482 4496
4483 4497 2003-05-20 Fernando Perez <fperez@colorado.edu>
4484 4498
4485 4499 * setup.py: added support for manpages. It's a bit hackish b/c of
4486 4500 a bug in the way the bdist_rpm distutils target handles gzipped
4487 4501 manpages, but it works. After a patch by Jack.
4488 4502
4489 4503 2003-05-19 Fernando Perez <fperez@colorado.edu>
4490 4504
4491 4505 * IPython/numutils.py: added a mockup of the kinds module, since
4492 4506 it was recently removed from Numeric. This way, numutils will
4493 4507 work for all users even if they are missing kinds.
4494 4508
4495 4509 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4496 4510 failure, which can occur with SWIG-wrapped extensions. After a
4497 4511 crash report from Prabhu.
4498 4512
4499 4513 2003-05-16 Fernando Perez <fperez@colorado.edu>
4500 4514
4501 4515 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4502 4516 protect ipython from user code which may call directly
4503 4517 sys.excepthook (this looks like an ipython crash to the user, even
4504 4518 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4505 4519 This is especially important to help users of WxWindows, but may
4506 4520 also be useful in other cases.
4507 4521
4508 4522 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4509 4523 an optional tb_offset to be specified, and to preserve exception
4510 4524 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4511 4525
4512 4526 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4513 4527
4514 4528 2003-05-15 Fernando Perez <fperez@colorado.edu>
4515 4529
4516 4530 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4517 4531 installing for a new user under Windows.
4518 4532
4519 4533 2003-05-12 Fernando Perez <fperez@colorado.edu>
4520 4534
4521 4535 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4522 4536 handler for Emacs comint-based lines. Currently it doesn't do
4523 4537 much (but importantly, it doesn't update the history cache). In
4524 4538 the future it may be expanded if Alex needs more functionality
4525 4539 there.
4526 4540
4527 4541 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4528 4542 info to crash reports.
4529 4543
4530 4544 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4531 4545 just like Python's -c. Also fixed crash with invalid -color
4532 4546 option value at startup. Thanks to Will French
4533 4547 <wfrench-AT-bestweb.net> for the bug report.
4534 4548
4535 4549 2003-05-09 Fernando Perez <fperez@colorado.edu>
4536 4550
4537 4551 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4538 4552 to EvalDict (it's a mapping, after all) and simplified its code
4539 4553 quite a bit, after a nice discussion on c.l.py where Gustavo
4540 4554 Córdova <gcordova-AT-sismex.com> suggested the new version.
4541 4555
4542 4556 2003-04-30 Fernando Perez <fperez@colorado.edu>
4543 4557
4544 4558 * IPython/genutils.py (timings_out): modified it to reduce its
4545 4559 overhead in the common reps==1 case.
4546 4560
4547 4561 2003-04-29 Fernando Perez <fperez@colorado.edu>
4548 4562
4549 4563 * IPython/genutils.py (timings_out): Modified to use the resource
4550 4564 module, which avoids the wraparound problems of time.clock().
4551 4565
4552 4566 2003-04-17 *** Released version 0.2.15pre4
4553 4567
4554 4568 2003-04-17 Fernando Perez <fperez@colorado.edu>
4555 4569
4556 4570 * setup.py (scriptfiles): Split windows-specific stuff over to a
4557 4571 separate file, in an attempt to have a Windows GUI installer.
4558 4572 That didn't work, but part of the groundwork is done.
4559 4573
4560 4574 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4561 4575 indent/unindent with 4 spaces. Particularly useful in combination
4562 4576 with the new auto-indent option.
4563 4577
4564 4578 2003-04-16 Fernando Perez <fperez@colorado.edu>
4565 4579
4566 4580 * IPython/Magic.py: various replacements of self.rc for
4567 4581 self.shell.rc. A lot more remains to be done to fully disentangle
4568 4582 this class from the main Shell class.
4569 4583
4570 4584 * IPython/GnuplotRuntime.py: added checks for mouse support so
4571 4585 that we don't try to enable it if the current gnuplot doesn't
4572 4586 really support it. Also added checks so that we don't try to
4573 4587 enable persist under Windows (where Gnuplot doesn't recognize the
4574 4588 option).
4575 4589
4576 4590 * IPython/iplib.py (InteractiveShell.interact): Added optional
4577 4591 auto-indenting code, after a patch by King C. Shu
4578 4592 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4579 4593 get along well with pasting indented code. If I ever figure out
4580 4594 how to make that part go well, it will become on by default.
4581 4595
4582 4596 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4583 4597 crash ipython if there was an unmatched '%' in the user's prompt
4584 4598 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4585 4599
4586 4600 * IPython/iplib.py (InteractiveShell.interact): removed the
4587 4601 ability to ask the user whether he wants to crash or not at the
4588 4602 'last line' exception handler. Calling functions at that point
4589 4603 changes the stack, and the error reports would have incorrect
4590 4604 tracebacks.
4591 4605
4592 4606 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4593 4607 pass through a peger a pretty-printed form of any object. After a
4594 4608 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4595 4609
4596 4610 2003-04-14 Fernando Perez <fperez@colorado.edu>
4597 4611
4598 4612 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4599 4613 all files in ~ would be modified at first install (instead of
4600 4614 ~/.ipython). This could be potentially disastrous, as the
4601 4615 modification (make line-endings native) could damage binary files.
4602 4616
4603 4617 2003-04-10 Fernando Perez <fperez@colorado.edu>
4604 4618
4605 4619 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4606 4620 handle only lines which are invalid python. This now means that
4607 4621 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4608 4622 for the bug report.
4609 4623
4610 4624 2003-04-01 Fernando Perez <fperez@colorado.edu>
4611 4625
4612 4626 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4613 4627 where failing to set sys.last_traceback would crash pdb.pm().
4614 4628 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4615 4629 report.
4616 4630
4617 4631 2003-03-25 Fernando Perez <fperez@colorado.edu>
4618 4632
4619 4633 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4620 4634 before printing it (it had a lot of spurious blank lines at the
4621 4635 end).
4622 4636
4623 4637 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4624 4638 output would be sent 21 times! Obviously people don't use this
4625 4639 too often, or I would have heard about it.
4626 4640
4627 4641 2003-03-24 Fernando Perez <fperez@colorado.edu>
4628 4642
4629 4643 * setup.py (scriptfiles): renamed the data_files parameter from
4630 4644 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4631 4645 for the patch.
4632 4646
4633 4647 2003-03-20 Fernando Perez <fperez@colorado.edu>
4634 4648
4635 4649 * IPython/genutils.py (error): added error() and fatal()
4636 4650 functions.
4637 4651
4638 4652 2003-03-18 *** Released version 0.2.15pre3
4639 4653
4640 4654 2003-03-18 Fernando Perez <fperez@colorado.edu>
4641 4655
4642 4656 * setupext/install_data_ext.py
4643 4657 (install_data_ext.initialize_options): Class contributed by Jack
4644 4658 Moffit for fixing the old distutils hack. He is sending this to
4645 4659 the distutils folks so in the future we may not need it as a
4646 4660 private fix.
4647 4661
4648 4662 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4649 4663 changes for Debian packaging. See his patch for full details.
4650 4664 The old distutils hack of making the ipythonrc* files carry a
4651 4665 bogus .py extension is gone, at last. Examples were moved to a
4652 4666 separate subdir under doc/, and the separate executable scripts
4653 4667 now live in their own directory. Overall a great cleanup. The
4654 4668 manual was updated to use the new files, and setup.py has been
4655 4669 fixed for this setup.
4656 4670
4657 4671 * IPython/PyColorize.py (Parser.usage): made non-executable and
4658 4672 created a pycolor wrapper around it to be included as a script.
4659 4673
4660 4674 2003-03-12 *** Released version 0.2.15pre2
4661 4675
4662 4676 2003-03-12 Fernando Perez <fperez@colorado.edu>
4663 4677
4664 4678 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4665 4679 long-standing problem with garbage characters in some terminals.
4666 4680 The issue was really that the \001 and \002 escapes must _only_ be
4667 4681 passed to input prompts (which call readline), but _never_ to
4668 4682 normal text to be printed on screen. I changed ColorANSI to have
4669 4683 two classes: TermColors and InputTermColors, each with the
4670 4684 appropriate escapes for input prompts or normal text. The code in
4671 4685 Prompts.py got slightly more complicated, but this very old and
4672 4686 annoying bug is finally fixed.
4673 4687
4674 4688 All the credit for nailing down the real origin of this problem
4675 4689 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4676 4690 *Many* thanks to him for spending quite a bit of effort on this.
4677 4691
4678 4692 2003-03-05 *** Released version 0.2.15pre1
4679 4693
4680 4694 2003-03-03 Fernando Perez <fperez@colorado.edu>
4681 4695
4682 4696 * IPython/FakeModule.py: Moved the former _FakeModule to a
4683 4697 separate file, because it's also needed by Magic (to fix a similar
4684 4698 pickle-related issue in @run).
4685 4699
4686 4700 2003-03-02 Fernando Perez <fperez@colorado.edu>
4687 4701
4688 4702 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4689 4703 the autocall option at runtime.
4690 4704 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4691 4705 across Magic.py to start separating Magic from InteractiveShell.
4692 4706 (Magic._ofind): Fixed to return proper namespace for dotted
4693 4707 names. Before, a dotted name would always return 'not currently
4694 4708 defined', because it would find the 'parent'. s.x would be found,
4695 4709 but since 'x' isn't defined by itself, it would get confused.
4696 4710 (Magic.magic_run): Fixed pickling problems reported by Ralf
4697 4711 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4698 4712 that I'd used when Mike Heeter reported similar issues at the
4699 4713 top-level, but now for @run. It boils down to injecting the
4700 4714 namespace where code is being executed with something that looks
4701 4715 enough like a module to fool pickle.dump(). Since a pickle stores
4702 4716 a named reference to the importing module, we need this for
4703 4717 pickles to save something sensible.
4704 4718
4705 4719 * IPython/ipmaker.py (make_IPython): added an autocall option.
4706 4720
4707 4721 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4708 4722 the auto-eval code. Now autocalling is an option, and the code is
4709 4723 also vastly safer. There is no more eval() involved at all.
4710 4724
4711 4725 2003-03-01 Fernando Perez <fperez@colorado.edu>
4712 4726
4713 4727 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4714 4728 dict with named keys instead of a tuple.
4715 4729
4716 4730 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4717 4731
4718 4732 * setup.py (make_shortcut): Fixed message about directories
4719 4733 created during Windows installation (the directories were ok, just
4720 4734 the printed message was misleading). Thanks to Chris Liechti
4721 4735 <cliechti-AT-gmx.net> for the heads up.
4722 4736
4723 4737 2003-02-21 Fernando Perez <fperez@colorado.edu>
4724 4738
4725 4739 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4726 4740 of ValueError exception when checking for auto-execution. This
4727 4741 one is raised by things like Numeric arrays arr.flat when the
4728 4742 array is non-contiguous.
4729 4743
4730 4744 2003-01-31 Fernando Perez <fperez@colorado.edu>
4731 4745
4732 4746 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4733 4747 not return any value at all (even though the command would get
4734 4748 executed).
4735 4749 (xsys): Flush stdout right after printing the command to ensure
4736 4750 proper ordering of commands and command output in the total
4737 4751 output.
4738 4752 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4739 4753 system/getoutput as defaults. The old ones are kept for
4740 4754 compatibility reasons, so no code which uses this library needs
4741 4755 changing.
4742 4756
4743 4757 2003-01-27 *** Released version 0.2.14
4744 4758
4745 4759 2003-01-25 Fernando Perez <fperez@colorado.edu>
4746 4760
4747 4761 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4748 4762 functions defined in previous edit sessions could not be re-edited
4749 4763 (because the temp files were immediately removed). Now temp files
4750 4764 are removed only at IPython's exit.
4751 4765 (Magic.magic_run): Improved @run to perform shell-like expansions
4752 4766 on its arguments (~users and $VARS). With this, @run becomes more
4753 4767 like a normal command-line.
4754 4768
4755 4769 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4756 4770 bugs related to embedding and cleaned up that code. A fairly
4757 4771 important one was the impossibility to access the global namespace
4758 4772 through the embedded IPython (only local variables were visible).
4759 4773
4760 4774 2003-01-14 Fernando Perez <fperez@colorado.edu>
4761 4775
4762 4776 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4763 4777 auto-calling to be a bit more conservative. Now it doesn't get
4764 4778 triggered if any of '!=()<>' are in the rest of the input line, to
4765 4779 allow comparing callables. Thanks to Alex for the heads up.
4766 4780
4767 4781 2003-01-07 Fernando Perez <fperez@colorado.edu>
4768 4782
4769 4783 * IPython/genutils.py (page): fixed estimation of the number of
4770 4784 lines in a string to be paged to simply count newlines. This
4771 4785 prevents over-guessing due to embedded escape sequences. A better
4772 4786 long-term solution would involve stripping out the control chars
4773 4787 for the count, but it's potentially so expensive I just don't
4774 4788 think it's worth doing.
4775 4789
4776 4790 2002-12-19 *** Released version 0.2.14pre50
4777 4791
4778 4792 2002-12-19 Fernando Perez <fperez@colorado.edu>
4779 4793
4780 4794 * tools/release (version): Changed release scripts to inform
4781 4795 Andrea and build a NEWS file with a list of recent changes.
4782 4796
4783 4797 * IPython/ColorANSI.py (__all__): changed terminal detection
4784 4798 code. Seems to work better for xterms without breaking
4785 4799 konsole. Will need more testing to determine if WinXP and Mac OSX
4786 4800 also work ok.
4787 4801
4788 4802 2002-12-18 *** Released version 0.2.14pre49
4789 4803
4790 4804 2002-12-18 Fernando Perez <fperez@colorado.edu>
4791 4805
4792 4806 * Docs: added new info about Mac OSX, from Andrea.
4793 4807
4794 4808 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4795 4809 allow direct plotting of python strings whose format is the same
4796 4810 of gnuplot data files.
4797 4811
4798 4812 2002-12-16 Fernando Perez <fperez@colorado.edu>
4799 4813
4800 4814 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4801 4815 value of exit question to be acknowledged.
4802 4816
4803 4817 2002-12-03 Fernando Perez <fperez@colorado.edu>
4804 4818
4805 4819 * IPython/ipmaker.py: removed generators, which had been added
4806 4820 by mistake in an earlier debugging run. This was causing trouble
4807 4821 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4808 4822 for pointing this out.
4809 4823
4810 4824 2002-11-17 Fernando Perez <fperez@colorado.edu>
4811 4825
4812 4826 * Manual: updated the Gnuplot section.
4813 4827
4814 4828 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4815 4829 a much better split of what goes in Runtime and what goes in
4816 4830 Interactive.
4817 4831
4818 4832 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4819 4833 being imported from iplib.
4820 4834
4821 4835 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4822 4836 for command-passing. Now the global Gnuplot instance is called
4823 4837 'gp' instead of 'g', which was really a far too fragile and
4824 4838 common name.
4825 4839
4826 4840 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4827 4841 bounding boxes generated by Gnuplot for square plots.
4828 4842
4829 4843 * IPython/genutils.py (popkey): new function added. I should
4830 4844 suggest this on c.l.py as a dict method, it seems useful.
4831 4845
4832 4846 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4833 4847 to transparently handle PostScript generation. MUCH better than
4834 4848 the previous plot_eps/replot_eps (which I removed now). The code
4835 4849 is also fairly clean and well documented now (including
4836 4850 docstrings).
4837 4851
4838 4852 2002-11-13 Fernando Perez <fperez@colorado.edu>
4839 4853
4840 4854 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4841 4855 (inconsistent with options).
4842 4856
4843 4857 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4844 4858 manually disabled, I don't know why. Fixed it.
4845 4859 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4846 4860 eps output.
4847 4861
4848 4862 2002-11-12 Fernando Perez <fperez@colorado.edu>
4849 4863
4850 4864 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4851 4865 don't propagate up to caller. Fixes crash reported by François
4852 4866 Pinard.
4853 4867
4854 4868 2002-11-09 Fernando Perez <fperez@colorado.edu>
4855 4869
4856 4870 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4857 4871 history file for new users.
4858 4872 (make_IPython): fixed bug where initial install would leave the
4859 4873 user running in the .ipython dir.
4860 4874 (make_IPython): fixed bug where config dir .ipython would be
4861 4875 created regardless of the given -ipythondir option. Thanks to Cory
4862 4876 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4863 4877
4864 4878 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4865 4879 type confirmations. Will need to use it in all of IPython's code
4866 4880 consistently.
4867 4881
4868 4882 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4869 4883 context to print 31 lines instead of the default 5. This will make
4870 4884 the crash reports extremely detailed in case the problem is in
4871 4885 libraries I don't have access to.
4872 4886
4873 4887 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4874 4888 line of defense' code to still crash, but giving users fair
4875 4889 warning. I don't want internal errors to go unreported: if there's
4876 4890 an internal problem, IPython should crash and generate a full
4877 4891 report.
4878 4892
4879 4893 2002-11-08 Fernando Perez <fperez@colorado.edu>
4880 4894
4881 4895 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4882 4896 otherwise uncaught exceptions which can appear if people set
4883 4897 sys.stdout to something badly broken. Thanks to a crash report
4884 4898 from henni-AT-mail.brainbot.com.
4885 4899
4886 4900 2002-11-04 Fernando Perez <fperez@colorado.edu>
4887 4901
4888 4902 * IPython/iplib.py (InteractiveShell.interact): added
4889 4903 __IPYTHON__active to the builtins. It's a flag which goes on when
4890 4904 the interaction starts and goes off again when it stops. This
4891 4905 allows embedding code to detect being inside IPython. Before this
4892 4906 was done via __IPYTHON__, but that only shows that an IPython
4893 4907 instance has been created.
4894 4908
4895 4909 * IPython/Magic.py (Magic.magic_env): I realized that in a
4896 4910 UserDict, instance.data holds the data as a normal dict. So I
4897 4911 modified @env to return os.environ.data instead of rebuilding a
4898 4912 dict by hand.
4899 4913
4900 4914 2002-11-02 Fernando Perez <fperez@colorado.edu>
4901 4915
4902 4916 * IPython/genutils.py (warn): changed so that level 1 prints no
4903 4917 header. Level 2 is now the default (with 'WARNING' header, as
4904 4918 before). I think I tracked all places where changes were needed in
4905 4919 IPython, but outside code using the old level numbering may have
4906 4920 broken.
4907 4921
4908 4922 * IPython/iplib.py (InteractiveShell.runcode): added this to
4909 4923 handle the tracebacks in SystemExit traps correctly. The previous
4910 4924 code (through interact) was printing more of the stack than
4911 4925 necessary, showing IPython internal code to the user.
4912 4926
4913 4927 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4914 4928 default. Now that the default at the confirmation prompt is yes,
4915 4929 it's not so intrusive. François' argument that ipython sessions
4916 4930 tend to be complex enough not to lose them from an accidental C-d,
4917 4931 is a valid one.
4918 4932
4919 4933 * IPython/iplib.py (InteractiveShell.interact): added a
4920 4934 showtraceback() call to the SystemExit trap, and modified the exit
4921 4935 confirmation to have yes as the default.
4922 4936
4923 4937 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4924 4938 this file. It's been gone from the code for a long time, this was
4925 4939 simply leftover junk.
4926 4940
4927 4941 2002-11-01 Fernando Perez <fperez@colorado.edu>
4928 4942
4929 4943 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4930 4944 added. If set, IPython now traps EOF and asks for
4931 4945 confirmation. After a request by François Pinard.
4932 4946
4933 4947 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4934 4948 of @abort, and with a new (better) mechanism for handling the
4935 4949 exceptions.
4936 4950
4937 4951 2002-10-27 Fernando Perez <fperez@colorado.edu>
4938 4952
4939 4953 * IPython/usage.py (__doc__): updated the --help information and
4940 4954 the ipythonrc file to indicate that -log generates
4941 4955 ./ipython.log. Also fixed the corresponding info in @logstart.
4942 4956 This and several other fixes in the manuals thanks to reports by
4943 4957 François Pinard <pinard-AT-iro.umontreal.ca>.
4944 4958
4945 4959 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4946 4960 refer to @logstart (instead of @log, which doesn't exist).
4947 4961
4948 4962 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4949 4963 AttributeError crash. Thanks to Christopher Armstrong
4950 4964 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4951 4965 introduced recently (in 0.2.14pre37) with the fix to the eval
4952 4966 problem mentioned below.
4953 4967
4954 4968 2002-10-17 Fernando Perez <fperez@colorado.edu>
4955 4969
4956 4970 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4957 4971 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4958 4972
4959 4973 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4960 4974 this function to fix a problem reported by Alex Schmolck. He saw
4961 4975 it with list comprehensions and generators, which were getting
4962 4976 called twice. The real problem was an 'eval' call in testing for
4963 4977 automagic which was evaluating the input line silently.
4964 4978
4965 4979 This is a potentially very nasty bug, if the input has side
4966 4980 effects which must not be repeated. The code is much cleaner now,
4967 4981 without any blanket 'except' left and with a regexp test for
4968 4982 actual function names.
4969 4983
4970 4984 But an eval remains, which I'm not fully comfortable with. I just
4971 4985 don't know how to find out if an expression could be a callable in
4972 4986 the user's namespace without doing an eval on the string. However
4973 4987 that string is now much more strictly checked so that no code
4974 4988 slips by, so the eval should only happen for things that can
4975 4989 really be only function/method names.
4976 4990
4977 4991 2002-10-15 Fernando Perez <fperez@colorado.edu>
4978 4992
4979 4993 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4980 4994 OSX information to main manual, removed README_Mac_OSX file from
4981 4995 distribution. Also updated credits for recent additions.
4982 4996
4983 4997 2002-10-10 Fernando Perez <fperez@colorado.edu>
4984 4998
4985 4999 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4986 5000 terminal-related issues. Many thanks to Andrea Riciputi
4987 5001 <andrea.riciputi-AT-libero.it> for writing it.
4988 5002
4989 5003 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4990 5004 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4991 5005
4992 5006 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4993 5007 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4994 5008 <syver-en-AT-online.no> who both submitted patches for this problem.
4995 5009
4996 5010 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4997 5011 global embedding to make sure that things don't overwrite user
4998 5012 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4999 5013
5000 5014 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5001 5015 compatibility. Thanks to Hayden Callow
5002 5016 <h.callow-AT-elec.canterbury.ac.nz>
5003 5017
5004 5018 2002-10-04 Fernando Perez <fperez@colorado.edu>
5005 5019
5006 5020 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5007 5021 Gnuplot.File objects.
5008 5022
5009 5023 2002-07-23 Fernando Perez <fperez@colorado.edu>
5010 5024
5011 5025 * IPython/genutils.py (timing): Added timings() and timing() for
5012 5026 quick access to the most commonly needed data, the execution
5013 5027 times. Old timing() renamed to timings_out().
5014 5028
5015 5029 2002-07-18 Fernando Perez <fperez@colorado.edu>
5016 5030
5017 5031 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5018 5032 bug with nested instances disrupting the parent's tab completion.
5019 5033
5020 5034 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5021 5035 all_completions code to begin the emacs integration.
5022 5036
5023 5037 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5024 5038 argument to allow titling individual arrays when plotting.
5025 5039
5026 5040 2002-07-15 Fernando Perez <fperez@colorado.edu>
5027 5041
5028 5042 * setup.py (make_shortcut): changed to retrieve the value of
5029 5043 'Program Files' directory from the registry (this value changes in
5030 5044 non-english versions of Windows). Thanks to Thomas Fanslau
5031 5045 <tfanslau-AT-gmx.de> for the report.
5032 5046
5033 5047 2002-07-10 Fernando Perez <fperez@colorado.edu>
5034 5048
5035 5049 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5036 5050 a bug in pdb, which crashes if a line with only whitespace is
5037 5051 entered. Bug report submitted to sourceforge.
5038 5052
5039 5053 2002-07-09 Fernando Perez <fperez@colorado.edu>
5040 5054
5041 5055 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5042 5056 reporting exceptions (it's a bug in inspect.py, I just set a
5043 5057 workaround).
5044 5058
5045 5059 2002-07-08 Fernando Perez <fperez@colorado.edu>
5046 5060
5047 5061 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5048 5062 __IPYTHON__ in __builtins__ to show up in user_ns.
5049 5063
5050 5064 2002-07-03 Fernando Perez <fperez@colorado.edu>
5051 5065
5052 5066 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5053 5067 name from @gp_set_instance to @gp_set_default.
5054 5068
5055 5069 * IPython/ipmaker.py (make_IPython): default editor value set to
5056 5070 '0' (a string), to match the rc file. Otherwise will crash when
5057 5071 .strip() is called on it.
5058 5072
5059 5073
5060 5074 2002-06-28 Fernando Perez <fperez@colorado.edu>
5061 5075
5062 5076 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5063 5077 of files in current directory when a file is executed via
5064 5078 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5065 5079
5066 5080 * setup.py (manfiles): fix for rpm builds, submitted by RA
5067 5081 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5068 5082
5069 5083 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5070 5084 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5071 5085 string!). A. Schmolck caught this one.
5072 5086
5073 5087 2002-06-27 Fernando Perez <fperez@colorado.edu>
5074 5088
5075 5089 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5076 5090 defined files at the cmd line. __name__ wasn't being set to
5077 5091 __main__.
5078 5092
5079 5093 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5080 5094 regular lists and tuples besides Numeric arrays.
5081 5095
5082 5096 * IPython/Prompts.py (CachedOutput.__call__): Added output
5083 5097 supression for input ending with ';'. Similar to Mathematica and
5084 5098 Matlab. The _* vars and Out[] list are still updated, just like
5085 5099 Mathematica behaves.
5086 5100
5087 5101 2002-06-25 Fernando Perez <fperez@colorado.edu>
5088 5102
5089 5103 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5090 5104 .ini extensions for profiels under Windows.
5091 5105
5092 5106 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5093 5107 string form. Fix contributed by Alexander Schmolck
5094 5108 <a.schmolck-AT-gmx.net>
5095 5109
5096 5110 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5097 5111 pre-configured Gnuplot instance.
5098 5112
5099 5113 2002-06-21 Fernando Perez <fperez@colorado.edu>
5100 5114
5101 5115 * IPython/numutils.py (exp_safe): new function, works around the
5102 5116 underflow problems in Numeric.
5103 5117 (log2): New fn. Safe log in base 2: returns exact integer answer
5104 5118 for exact integer powers of 2.
5105 5119
5106 5120 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5107 5121 properly.
5108 5122
5109 5123 2002-06-20 Fernando Perez <fperez@colorado.edu>
5110 5124
5111 5125 * IPython/genutils.py (timing): new function like
5112 5126 Mathematica's. Similar to time_test, but returns more info.
5113 5127
5114 5128 2002-06-18 Fernando Perez <fperez@colorado.edu>
5115 5129
5116 5130 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5117 5131 according to Mike Heeter's suggestions.
5118 5132
5119 5133 2002-06-16 Fernando Perez <fperez@colorado.edu>
5120 5134
5121 5135 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5122 5136 system. GnuplotMagic is gone as a user-directory option. New files
5123 5137 make it easier to use all the gnuplot stuff both from external
5124 5138 programs as well as from IPython. Had to rewrite part of
5125 5139 hardcopy() b/c of a strange bug: often the ps files simply don't
5126 5140 get created, and require a repeat of the command (often several
5127 5141 times).
5128 5142
5129 5143 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5130 5144 resolve output channel at call time, so that if sys.stderr has
5131 5145 been redirected by user this gets honored.
5132 5146
5133 5147 2002-06-13 Fernando Perez <fperez@colorado.edu>
5134 5148
5135 5149 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5136 5150 IPShell. Kept a copy with the old names to avoid breaking people's
5137 5151 embedded code.
5138 5152
5139 5153 * IPython/ipython: simplified it to the bare minimum after
5140 5154 Holger's suggestions. Added info about how to use it in
5141 5155 PYTHONSTARTUP.
5142 5156
5143 5157 * IPython/Shell.py (IPythonShell): changed the options passing
5144 5158 from a string with funky %s replacements to a straight list. Maybe
5145 5159 a bit more typing, but it follows sys.argv conventions, so there's
5146 5160 less special-casing to remember.
5147 5161
5148 5162 2002-06-12 Fernando Perez <fperez@colorado.edu>
5149 5163
5150 5164 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5151 5165 command. Thanks to a suggestion by Mike Heeter.
5152 5166 (Magic.magic_pfile): added behavior to look at filenames if given
5153 5167 arg is not a defined object.
5154 5168 (Magic.magic_save): New @save function to save code snippets. Also
5155 5169 a Mike Heeter idea.
5156 5170
5157 5171 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5158 5172 plot() and replot(). Much more convenient now, especially for
5159 5173 interactive use.
5160 5174
5161 5175 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5162 5176 filenames.
5163 5177
5164 5178 2002-06-02 Fernando Perez <fperez@colorado.edu>
5165 5179
5166 5180 * IPython/Struct.py (Struct.__init__): modified to admit
5167 5181 initialization via another struct.
5168 5182
5169 5183 * IPython/genutils.py (SystemExec.__init__): New stateful
5170 5184 interface to xsys and bq. Useful for writing system scripts.
5171 5185
5172 5186 2002-05-30 Fernando Perez <fperez@colorado.edu>
5173 5187
5174 5188 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5175 5189 documents. This will make the user download smaller (it's getting
5176 5190 too big).
5177 5191
5178 5192 2002-05-29 Fernando Perez <fperez@colorado.edu>
5179 5193
5180 5194 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5181 5195 fix problems with shelve and pickle. Seems to work, but I don't
5182 5196 know if corner cases break it. Thanks to Mike Heeter
5183 5197 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5184 5198
5185 5199 2002-05-24 Fernando Perez <fperez@colorado.edu>
5186 5200
5187 5201 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5188 5202 macros having broken.
5189 5203
5190 5204 2002-05-21 Fernando Perez <fperez@colorado.edu>
5191 5205
5192 5206 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5193 5207 introduced logging bug: all history before logging started was
5194 5208 being written one character per line! This came from the redesign
5195 5209 of the input history as a special list which slices to strings,
5196 5210 not to lists.
5197 5211
5198 5212 2002-05-20 Fernando Perez <fperez@colorado.edu>
5199 5213
5200 5214 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5201 5215 be an attribute of all classes in this module. The design of these
5202 5216 classes needs some serious overhauling.
5203 5217
5204 5218 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5205 5219 which was ignoring '_' in option names.
5206 5220
5207 5221 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5208 5222 'Verbose_novars' to 'Context' and made it the new default. It's a
5209 5223 bit more readable and also safer than verbose.
5210 5224
5211 5225 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5212 5226 triple-quoted strings.
5213 5227
5214 5228 * IPython/OInspect.py (__all__): new module exposing the object
5215 5229 introspection facilities. Now the corresponding magics are dummy
5216 5230 wrappers around this. Having this module will make it much easier
5217 5231 to put these functions into our modified pdb.
5218 5232 This new object inspector system uses the new colorizing module,
5219 5233 so source code and other things are nicely syntax highlighted.
5220 5234
5221 5235 2002-05-18 Fernando Perez <fperez@colorado.edu>
5222 5236
5223 5237 * IPython/ColorANSI.py: Split the coloring tools into a separate
5224 5238 module so I can use them in other code easier (they were part of
5225 5239 ultraTB).
5226 5240
5227 5241 2002-05-17 Fernando Perez <fperez@colorado.edu>
5228 5242
5229 5243 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5230 5244 fixed it to set the global 'g' also to the called instance, as
5231 5245 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5232 5246 user's 'g' variables).
5233 5247
5234 5248 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5235 5249 global variables (aliases to _ih,_oh) so that users which expect
5236 5250 In[5] or Out[7] to work aren't unpleasantly surprised.
5237 5251 (InputList.__getslice__): new class to allow executing slices of
5238 5252 input history directly. Very simple class, complements the use of
5239 5253 macros.
5240 5254
5241 5255 2002-05-16 Fernando Perez <fperez@colorado.edu>
5242 5256
5243 5257 * setup.py (docdirbase): make doc directory be just doc/IPython
5244 5258 without version numbers, it will reduce clutter for users.
5245 5259
5246 5260 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5247 5261 execfile call to prevent possible memory leak. See for details:
5248 5262 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5249 5263
5250 5264 2002-05-15 Fernando Perez <fperez@colorado.edu>
5251 5265
5252 5266 * IPython/Magic.py (Magic.magic_psource): made the object
5253 5267 introspection names be more standard: pdoc, pdef, pfile and
5254 5268 psource. They all print/page their output, and it makes
5255 5269 remembering them easier. Kept old names for compatibility as
5256 5270 aliases.
5257 5271
5258 5272 2002-05-14 Fernando Perez <fperez@colorado.edu>
5259 5273
5260 5274 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5261 5275 what the mouse problem was. The trick is to use gnuplot with temp
5262 5276 files and NOT with pipes (for data communication), because having
5263 5277 both pipes and the mouse on is bad news.
5264 5278
5265 5279 2002-05-13 Fernando Perez <fperez@colorado.edu>
5266 5280
5267 5281 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5268 5282 bug. Information would be reported about builtins even when
5269 5283 user-defined functions overrode them.
5270 5284
5271 5285 2002-05-11 Fernando Perez <fperez@colorado.edu>
5272 5286
5273 5287 * IPython/__init__.py (__all__): removed FlexCompleter from
5274 5288 __all__ so that things don't fail in platforms without readline.
5275 5289
5276 5290 2002-05-10 Fernando Perez <fperez@colorado.edu>
5277 5291
5278 5292 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5279 5293 it requires Numeric, effectively making Numeric a dependency for
5280 5294 IPython.
5281 5295
5282 5296 * Released 0.2.13
5283 5297
5284 5298 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5285 5299 profiler interface. Now all the major options from the profiler
5286 5300 module are directly supported in IPython, both for single
5287 5301 expressions (@prun) and for full programs (@run -p).
5288 5302
5289 5303 2002-05-09 Fernando Perez <fperez@colorado.edu>
5290 5304
5291 5305 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5292 5306 magic properly formatted for screen.
5293 5307
5294 5308 * setup.py (make_shortcut): Changed things to put pdf version in
5295 5309 doc/ instead of doc/manual (had to change lyxport a bit).
5296 5310
5297 5311 * IPython/Magic.py (Profile.string_stats): made profile runs go
5298 5312 through pager (they are long and a pager allows searching, saving,
5299 5313 etc.)
5300 5314
5301 5315 2002-05-08 Fernando Perez <fperez@colorado.edu>
5302 5316
5303 5317 * Released 0.2.12
5304 5318
5305 5319 2002-05-06 Fernando Perez <fperez@colorado.edu>
5306 5320
5307 5321 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5308 5322 introduced); 'hist n1 n2' was broken.
5309 5323 (Magic.magic_pdb): added optional on/off arguments to @pdb
5310 5324 (Magic.magic_run): added option -i to @run, which executes code in
5311 5325 the IPython namespace instead of a clean one. Also added @irun as
5312 5326 an alias to @run -i.
5313 5327
5314 5328 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5315 5329 fixed (it didn't really do anything, the namespaces were wrong).
5316 5330
5317 5331 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5318 5332
5319 5333 * IPython/__init__.py (__all__): Fixed package namespace, now
5320 5334 'import IPython' does give access to IPython.<all> as
5321 5335 expected. Also renamed __release__ to Release.
5322 5336
5323 5337 * IPython/Debugger.py (__license__): created new Pdb class which
5324 5338 functions like a drop-in for the normal pdb.Pdb but does NOT
5325 5339 import readline by default. This way it doesn't muck up IPython's
5326 5340 readline handling, and now tab-completion finally works in the
5327 5341 debugger -- sort of. It completes things globally visible, but the
5328 5342 completer doesn't track the stack as pdb walks it. That's a bit
5329 5343 tricky, and I'll have to implement it later.
5330 5344
5331 5345 2002-05-05 Fernando Perez <fperez@colorado.edu>
5332 5346
5333 5347 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5334 5348 magic docstrings when printed via ? (explicit \'s were being
5335 5349 printed).
5336 5350
5337 5351 * IPython/ipmaker.py (make_IPython): fixed namespace
5338 5352 identification bug. Now variables loaded via logs or command-line
5339 5353 files are recognized in the interactive namespace by @who.
5340 5354
5341 5355 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5342 5356 log replay system stemming from the string form of Structs.
5343 5357
5344 5358 * IPython/Magic.py (Macro.__init__): improved macros to properly
5345 5359 handle magic commands in them.
5346 5360 (Magic.magic_logstart): usernames are now expanded so 'logstart
5347 5361 ~/mylog' now works.
5348 5362
5349 5363 * IPython/iplib.py (complete): fixed bug where paths starting with
5350 5364 '/' would be completed as magic names.
5351 5365
5352 5366 2002-05-04 Fernando Perez <fperez@colorado.edu>
5353 5367
5354 5368 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5355 5369 allow running full programs under the profiler's control.
5356 5370
5357 5371 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5358 5372 mode to report exceptions verbosely but without formatting
5359 5373 variables. This addresses the issue of ipython 'freezing' (it's
5360 5374 not frozen, but caught in an expensive formatting loop) when huge
5361 5375 variables are in the context of an exception.
5362 5376 (VerboseTB.text): Added '--->' markers at line where exception was
5363 5377 triggered. Much clearer to read, especially in NoColor modes.
5364 5378
5365 5379 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5366 5380 implemented in reverse when changing to the new parse_options().
5367 5381
5368 5382 2002-05-03 Fernando Perez <fperez@colorado.edu>
5369 5383
5370 5384 * IPython/Magic.py (Magic.parse_options): new function so that
5371 5385 magics can parse options easier.
5372 5386 (Magic.magic_prun): new function similar to profile.run(),
5373 5387 suggested by Chris Hart.
5374 5388 (Magic.magic_cd): fixed behavior so that it only changes if
5375 5389 directory actually is in history.
5376 5390
5377 5391 * IPython/usage.py (__doc__): added information about potential
5378 5392 slowness of Verbose exception mode when there are huge data
5379 5393 structures to be formatted (thanks to Archie Paulson).
5380 5394
5381 5395 * IPython/ipmaker.py (make_IPython): Changed default logging
5382 5396 (when simply called with -log) to use curr_dir/ipython.log in
5383 5397 rotate mode. Fixed crash which was occuring with -log before
5384 5398 (thanks to Jim Boyle).
5385 5399
5386 5400 2002-05-01 Fernando Perez <fperez@colorado.edu>
5387 5401
5388 5402 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5389 5403 was nasty -- though somewhat of a corner case).
5390 5404
5391 5405 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5392 5406 text (was a bug).
5393 5407
5394 5408 2002-04-30 Fernando Perez <fperez@colorado.edu>
5395 5409
5396 5410 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5397 5411 a print after ^D or ^C from the user so that the In[] prompt
5398 5412 doesn't over-run the gnuplot one.
5399 5413
5400 5414 2002-04-29 Fernando Perez <fperez@colorado.edu>
5401 5415
5402 5416 * Released 0.2.10
5403 5417
5404 5418 * IPython/__release__.py (version): get date dynamically.
5405 5419
5406 5420 * Misc. documentation updates thanks to Arnd's comments. Also ran
5407 5421 a full spellcheck on the manual (hadn't been done in a while).
5408 5422
5409 5423 2002-04-27 Fernando Perez <fperez@colorado.edu>
5410 5424
5411 5425 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5412 5426 starting a log in mid-session would reset the input history list.
5413 5427
5414 5428 2002-04-26 Fernando Perez <fperez@colorado.edu>
5415 5429
5416 5430 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5417 5431 all files were being included in an update. Now anything in
5418 5432 UserConfig that matches [A-Za-z]*.py will go (this excludes
5419 5433 __init__.py)
5420 5434
5421 5435 2002-04-25 Fernando Perez <fperez@colorado.edu>
5422 5436
5423 5437 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5424 5438 to __builtins__ so that any form of embedded or imported code can
5425 5439 test for being inside IPython.
5426 5440
5427 5441 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5428 5442 changed to GnuplotMagic because it's now an importable module,
5429 5443 this makes the name follow that of the standard Gnuplot module.
5430 5444 GnuplotMagic can now be loaded at any time in mid-session.
5431 5445
5432 5446 2002-04-24 Fernando Perez <fperez@colorado.edu>
5433 5447
5434 5448 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5435 5449 the globals (IPython has its own namespace) and the
5436 5450 PhysicalQuantity stuff is much better anyway.
5437 5451
5438 5452 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5439 5453 embedding example to standard user directory for
5440 5454 distribution. Also put it in the manual.
5441 5455
5442 5456 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5443 5457 instance as first argument (so it doesn't rely on some obscure
5444 5458 hidden global).
5445 5459
5446 5460 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5447 5461 delimiters. While it prevents ().TAB from working, it allows
5448 5462 completions in open (... expressions. This is by far a more common
5449 5463 case.
5450 5464
5451 5465 2002-04-23 Fernando Perez <fperez@colorado.edu>
5452 5466
5453 5467 * IPython/Extensions/InterpreterPasteInput.py: new
5454 5468 syntax-processing module for pasting lines with >>> or ... at the
5455 5469 start.
5456 5470
5457 5471 * IPython/Extensions/PhysicalQ_Interactive.py
5458 5472 (PhysicalQuantityInteractive.__int__): fixed to work with either
5459 5473 Numeric or math.
5460 5474
5461 5475 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5462 5476 provided profiles. Now we have:
5463 5477 -math -> math module as * and cmath with its own namespace.
5464 5478 -numeric -> Numeric as *, plus gnuplot & grace
5465 5479 -physics -> same as before
5466 5480
5467 5481 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5468 5482 user-defined magics wouldn't be found by @magic if they were
5469 5483 defined as class methods. Also cleaned up the namespace search
5470 5484 logic and the string building (to use %s instead of many repeated
5471 5485 string adds).
5472 5486
5473 5487 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5474 5488 of user-defined magics to operate with class methods (cleaner, in
5475 5489 line with the gnuplot code).
5476 5490
5477 5491 2002-04-22 Fernando Perez <fperez@colorado.edu>
5478 5492
5479 5493 * setup.py: updated dependency list so that manual is updated when
5480 5494 all included files change.
5481 5495
5482 5496 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5483 5497 the delimiter removal option (the fix is ugly right now).
5484 5498
5485 5499 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5486 5500 all of the math profile (quicker loading, no conflict between
5487 5501 g-9.8 and g-gnuplot).
5488 5502
5489 5503 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5490 5504 name of post-mortem files to IPython_crash_report.txt.
5491 5505
5492 5506 * Cleanup/update of the docs. Added all the new readline info and
5493 5507 formatted all lists as 'real lists'.
5494 5508
5495 5509 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5496 5510 tab-completion options, since the full readline parse_and_bind is
5497 5511 now accessible.
5498 5512
5499 5513 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5500 5514 handling of readline options. Now users can specify any string to
5501 5515 be passed to parse_and_bind(), as well as the delimiters to be
5502 5516 removed.
5503 5517 (InteractiveShell.__init__): Added __name__ to the global
5504 5518 namespace so that things like Itpl which rely on its existence
5505 5519 don't crash.
5506 5520 (InteractiveShell._prefilter): Defined the default with a _ so
5507 5521 that prefilter() is easier to override, while the default one
5508 5522 remains available.
5509 5523
5510 5524 2002-04-18 Fernando Perez <fperez@colorado.edu>
5511 5525
5512 5526 * Added information about pdb in the docs.
5513 5527
5514 5528 2002-04-17 Fernando Perez <fperez@colorado.edu>
5515 5529
5516 5530 * IPython/ipmaker.py (make_IPython): added rc_override option to
5517 5531 allow passing config options at creation time which may override
5518 5532 anything set in the config files or command line. This is
5519 5533 particularly useful for configuring embedded instances.
5520 5534
5521 5535 2002-04-15 Fernando Perez <fperez@colorado.edu>
5522 5536
5523 5537 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5524 5538 crash embedded instances because of the input cache falling out of
5525 5539 sync with the output counter.
5526 5540
5527 5541 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5528 5542 mode which calls pdb after an uncaught exception in IPython itself.
5529 5543
5530 5544 2002-04-14 Fernando Perez <fperez@colorado.edu>
5531 5545
5532 5546 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5533 5547 readline, fix it back after each call.
5534 5548
5535 5549 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5536 5550 method to force all access via __call__(), which guarantees that
5537 5551 traceback references are properly deleted.
5538 5552
5539 5553 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5540 5554 improve printing when pprint is in use.
5541 5555
5542 5556 2002-04-13 Fernando Perez <fperez@colorado.edu>
5543 5557
5544 5558 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5545 5559 exceptions aren't caught anymore. If the user triggers one, he
5546 5560 should know why he's doing it and it should go all the way up,
5547 5561 just like any other exception. So now @abort will fully kill the
5548 5562 embedded interpreter and the embedding code (unless that happens
5549 5563 to catch SystemExit).
5550 5564
5551 5565 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5552 5566 and a debugger() method to invoke the interactive pdb debugger
5553 5567 after printing exception information. Also added the corresponding
5554 5568 -pdb option and @pdb magic to control this feature, and updated
5555 5569 the docs. After a suggestion from Christopher Hart
5556 5570 (hart-AT-caltech.edu).
5557 5571
5558 5572 2002-04-12 Fernando Perez <fperez@colorado.edu>
5559 5573
5560 5574 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5561 5575 the exception handlers defined by the user (not the CrashHandler)
5562 5576 so that user exceptions don't trigger an ipython bug report.
5563 5577
5564 5578 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5565 5579 configurable (it should have always been so).
5566 5580
5567 5581 2002-03-26 Fernando Perez <fperez@colorado.edu>
5568 5582
5569 5583 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5570 5584 and there to fix embedding namespace issues. This should all be
5571 5585 done in a more elegant way.
5572 5586
5573 5587 2002-03-25 Fernando Perez <fperez@colorado.edu>
5574 5588
5575 5589 * IPython/genutils.py (get_home_dir): Try to make it work under
5576 5590 win9x also.
5577 5591
5578 5592 2002-03-20 Fernando Perez <fperez@colorado.edu>
5579 5593
5580 5594 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5581 5595 sys.displayhook untouched upon __init__.
5582 5596
5583 5597 2002-03-19 Fernando Perez <fperez@colorado.edu>
5584 5598
5585 5599 * Released 0.2.9 (for embedding bug, basically).
5586 5600
5587 5601 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5588 5602 exceptions so that enclosing shell's state can be restored.
5589 5603
5590 5604 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5591 5605 naming conventions in the .ipython/ dir.
5592 5606
5593 5607 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5594 5608 from delimiters list so filenames with - in them get expanded.
5595 5609
5596 5610 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5597 5611 sys.displayhook not being properly restored after an embedded call.
5598 5612
5599 5613 2002-03-18 Fernando Perez <fperez@colorado.edu>
5600 5614
5601 5615 * Released 0.2.8
5602 5616
5603 5617 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5604 5618 some files weren't being included in a -upgrade.
5605 5619 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5606 5620 on' so that the first tab completes.
5607 5621 (InteractiveShell.handle_magic): fixed bug with spaces around
5608 5622 quotes breaking many magic commands.
5609 5623
5610 5624 * setup.py: added note about ignoring the syntax error messages at
5611 5625 installation.
5612 5626
5613 5627 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5614 5628 streamlining the gnuplot interface, now there's only one magic @gp.
5615 5629
5616 5630 2002-03-17 Fernando Perez <fperez@colorado.edu>
5617 5631
5618 5632 * IPython/UserConfig/magic_gnuplot.py: new name for the
5619 5633 example-magic_pm.py file. Much enhanced system, now with a shell
5620 5634 for communicating directly with gnuplot, one command at a time.
5621 5635
5622 5636 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5623 5637 setting __name__=='__main__'.
5624 5638
5625 5639 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5626 5640 mini-shell for accessing gnuplot from inside ipython. Should
5627 5641 extend it later for grace access too. Inspired by Arnd's
5628 5642 suggestion.
5629 5643
5630 5644 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5631 5645 calling magic functions with () in their arguments. Thanks to Arnd
5632 5646 Baecker for pointing this to me.
5633 5647
5634 5648 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5635 5649 infinitely for integer or complex arrays (only worked with floats).
5636 5650
5637 5651 2002-03-16 Fernando Perez <fperez@colorado.edu>
5638 5652
5639 5653 * setup.py: Merged setup and setup_windows into a single script
5640 5654 which properly handles things for windows users.
5641 5655
5642 5656 2002-03-15 Fernando Perez <fperez@colorado.edu>
5643 5657
5644 5658 * Big change to the manual: now the magics are all automatically
5645 5659 documented. This information is generated from their docstrings
5646 5660 and put in a latex file included by the manual lyx file. This way
5647 5661 we get always up to date information for the magics. The manual
5648 5662 now also has proper version information, also auto-synced.
5649 5663
5650 5664 For this to work, an undocumented --magic_docstrings option was added.
5651 5665
5652 5666 2002-03-13 Fernando Perez <fperez@colorado.edu>
5653 5667
5654 5668 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5655 5669 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5656 5670
5657 5671 2002-03-12 Fernando Perez <fperez@colorado.edu>
5658 5672
5659 5673 * IPython/ultraTB.py (TermColors): changed color escapes again to
5660 5674 fix the (old, reintroduced) line-wrapping bug. Basically, if
5661 5675 \001..\002 aren't given in the color escapes, lines get wrapped
5662 5676 weirdly. But giving those screws up old xterms and emacs terms. So
5663 5677 I added some logic for emacs terms to be ok, but I can't identify old
5664 5678 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5665 5679
5666 5680 2002-03-10 Fernando Perez <fperez@colorado.edu>
5667 5681
5668 5682 * IPython/usage.py (__doc__): Various documentation cleanups and
5669 5683 updates, both in usage docstrings and in the manual.
5670 5684
5671 5685 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5672 5686 handling of caching. Set minimum acceptabe value for having a
5673 5687 cache at 20 values.
5674 5688
5675 5689 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5676 5690 install_first_time function to a method, renamed it and added an
5677 5691 'upgrade' mode. Now people can update their config directory with
5678 5692 a simple command line switch (-upgrade, also new).
5679 5693
5680 5694 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5681 5695 @file (convenient for automagic users under Python >= 2.2).
5682 5696 Removed @files (it seemed more like a plural than an abbrev. of
5683 5697 'file show').
5684 5698
5685 5699 * IPython/iplib.py (install_first_time): Fixed crash if there were
5686 5700 backup files ('~') in .ipython/ install directory.
5687 5701
5688 5702 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5689 5703 system. Things look fine, but these changes are fairly
5690 5704 intrusive. Test them for a few days.
5691 5705
5692 5706 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5693 5707 the prompts system. Now all in/out prompt strings are user
5694 5708 controllable. This is particularly useful for embedding, as one
5695 5709 can tag embedded instances with particular prompts.
5696 5710
5697 5711 Also removed global use of sys.ps1/2, which now allows nested
5698 5712 embeddings without any problems. Added command-line options for
5699 5713 the prompt strings.
5700 5714
5701 5715 2002-03-08 Fernando Perez <fperez@colorado.edu>
5702 5716
5703 5717 * IPython/UserConfig/example-embed-short.py (ipshell): added
5704 5718 example file with the bare minimum code for embedding.
5705 5719
5706 5720 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5707 5721 functionality for the embeddable shell to be activated/deactivated
5708 5722 either globally or at each call.
5709 5723
5710 5724 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5711 5725 rewriting the prompt with '--->' for auto-inputs with proper
5712 5726 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5713 5727 this is handled by the prompts class itself, as it should.
5714 5728
5715 5729 2002-03-05 Fernando Perez <fperez@colorado.edu>
5716 5730
5717 5731 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5718 5732 @logstart to avoid name clashes with the math log function.
5719 5733
5720 5734 * Big updates to X/Emacs section of the manual.
5721 5735
5722 5736 * Removed ipython_emacs. Milan explained to me how to pass
5723 5737 arguments to ipython through Emacs. Some day I'm going to end up
5724 5738 learning some lisp...
5725 5739
5726 5740 2002-03-04 Fernando Perez <fperez@colorado.edu>
5727 5741
5728 5742 * IPython/ipython_emacs: Created script to be used as the
5729 5743 py-python-command Emacs variable so we can pass IPython
5730 5744 parameters. I can't figure out how to tell Emacs directly to pass
5731 5745 parameters to IPython, so a dummy shell script will do it.
5732 5746
5733 5747 Other enhancements made for things to work better under Emacs'
5734 5748 various types of terminals. Many thanks to Milan Zamazal
5735 5749 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5736 5750
5737 5751 2002-03-01 Fernando Perez <fperez@colorado.edu>
5738 5752
5739 5753 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5740 5754 that loading of readline is now optional. This gives better
5741 5755 control to emacs users.
5742 5756
5743 5757 * IPython/ultraTB.py (__date__): Modified color escape sequences
5744 5758 and now things work fine under xterm and in Emacs' term buffers
5745 5759 (though not shell ones). Well, in emacs you get colors, but all
5746 5760 seem to be 'light' colors (no difference between dark and light
5747 5761 ones). But the garbage chars are gone, and also in xterms. It
5748 5762 seems that now I'm using 'cleaner' ansi sequences.
5749 5763
5750 5764 2002-02-21 Fernando Perez <fperez@colorado.edu>
5751 5765
5752 5766 * Released 0.2.7 (mainly to publish the scoping fix).
5753 5767
5754 5768 * IPython/Logger.py (Logger.logstate): added. A corresponding
5755 5769 @logstate magic was created.
5756 5770
5757 5771 * IPython/Magic.py: fixed nested scoping problem under Python
5758 5772 2.1.x (automagic wasn't working).
5759 5773
5760 5774 2002-02-20 Fernando Perez <fperez@colorado.edu>
5761 5775
5762 5776 * Released 0.2.6.
5763 5777
5764 5778 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5765 5779 option so that logs can come out without any headers at all.
5766 5780
5767 5781 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5768 5782 SciPy.
5769 5783
5770 5784 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5771 5785 that embedded IPython calls don't require vars() to be explicitly
5772 5786 passed. Now they are extracted from the caller's frame (code
5773 5787 snatched from Eric Jones' weave). Added better documentation to
5774 5788 the section on embedding and the example file.
5775 5789
5776 5790 * IPython/genutils.py (page): Changed so that under emacs, it just
5777 5791 prints the string. You can then page up and down in the emacs
5778 5792 buffer itself. This is how the builtin help() works.
5779 5793
5780 5794 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5781 5795 macro scoping: macros need to be executed in the user's namespace
5782 5796 to work as if they had been typed by the user.
5783 5797
5784 5798 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5785 5799 execute automatically (no need to type 'exec...'). They then
5786 5800 behave like 'true macros'. The printing system was also modified
5787 5801 for this to work.
5788 5802
5789 5803 2002-02-19 Fernando Perez <fperez@colorado.edu>
5790 5804
5791 5805 * IPython/genutils.py (page_file): new function for paging files
5792 5806 in an OS-independent way. Also necessary for file viewing to work
5793 5807 well inside Emacs buffers.
5794 5808 (page): Added checks for being in an emacs buffer.
5795 5809 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5796 5810 same bug in iplib.
5797 5811
5798 5812 2002-02-18 Fernando Perez <fperez@colorado.edu>
5799 5813
5800 5814 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5801 5815 of readline so that IPython can work inside an Emacs buffer.
5802 5816
5803 5817 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5804 5818 method signatures (they weren't really bugs, but it looks cleaner
5805 5819 and keeps PyChecker happy).
5806 5820
5807 5821 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5808 5822 for implementing various user-defined hooks. Currently only
5809 5823 display is done.
5810 5824
5811 5825 * IPython/Prompts.py (CachedOutput._display): changed display
5812 5826 functions so that they can be dynamically changed by users easily.
5813 5827
5814 5828 * IPython/Extensions/numeric_formats.py (num_display): added an
5815 5829 extension for printing NumPy arrays in flexible manners. It
5816 5830 doesn't do anything yet, but all the structure is in
5817 5831 place. Ultimately the plan is to implement output format control
5818 5832 like in Octave.
5819 5833
5820 5834 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5821 5835 methods are found at run-time by all the automatic machinery.
5822 5836
5823 5837 2002-02-17 Fernando Perez <fperez@colorado.edu>
5824 5838
5825 5839 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5826 5840 whole file a little.
5827 5841
5828 5842 * ToDo: closed this document. Now there's a new_design.lyx
5829 5843 document for all new ideas. Added making a pdf of it for the
5830 5844 end-user distro.
5831 5845
5832 5846 * IPython/Logger.py (Logger.switch_log): Created this to replace
5833 5847 logon() and logoff(). It also fixes a nasty crash reported by
5834 5848 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5835 5849
5836 5850 * IPython/iplib.py (complete): got auto-completion to work with
5837 5851 automagic (I had wanted this for a long time).
5838 5852
5839 5853 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5840 5854 to @file, since file() is now a builtin and clashes with automagic
5841 5855 for @file.
5842 5856
5843 5857 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5844 5858 of this was previously in iplib, which had grown to more than 2000
5845 5859 lines, way too long. No new functionality, but it makes managing
5846 5860 the code a bit easier.
5847 5861
5848 5862 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5849 5863 information to crash reports.
5850 5864
5851 5865 2002-02-12 Fernando Perez <fperez@colorado.edu>
5852 5866
5853 5867 * Released 0.2.5.
5854 5868
5855 5869 2002-02-11 Fernando Perez <fperez@colorado.edu>
5856 5870
5857 5871 * Wrote a relatively complete Windows installer. It puts
5858 5872 everything in place, creates Start Menu entries and fixes the
5859 5873 color issues. Nothing fancy, but it works.
5860 5874
5861 5875 2002-02-10 Fernando Perez <fperez@colorado.edu>
5862 5876
5863 5877 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5864 5878 os.path.expanduser() call so that we can type @run ~/myfile.py and
5865 5879 have thigs work as expected.
5866 5880
5867 5881 * IPython/genutils.py (page): fixed exception handling so things
5868 5882 work both in Unix and Windows correctly. Quitting a pager triggers
5869 5883 an IOError/broken pipe in Unix, and in windows not finding a pager
5870 5884 is also an IOError, so I had to actually look at the return value
5871 5885 of the exception, not just the exception itself. Should be ok now.
5872 5886
5873 5887 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5874 5888 modified to allow case-insensitive color scheme changes.
5875 5889
5876 5890 2002-02-09 Fernando Perez <fperez@colorado.edu>
5877 5891
5878 5892 * IPython/genutils.py (native_line_ends): new function to leave
5879 5893 user config files with os-native line-endings.
5880 5894
5881 5895 * README and manual updates.
5882 5896
5883 5897 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5884 5898 instead of StringType to catch Unicode strings.
5885 5899
5886 5900 * IPython/genutils.py (filefind): fixed bug for paths with
5887 5901 embedded spaces (very common in Windows).
5888 5902
5889 5903 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5890 5904 files under Windows, so that they get automatically associated
5891 5905 with a text editor. Windows makes it a pain to handle
5892 5906 extension-less files.
5893 5907
5894 5908 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5895 5909 warning about readline only occur for Posix. In Windows there's no
5896 5910 way to get readline, so why bother with the warning.
5897 5911
5898 5912 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5899 5913 for __str__ instead of dir(self), since dir() changed in 2.2.
5900 5914
5901 5915 * Ported to Windows! Tested on XP, I suspect it should work fine
5902 5916 on NT/2000, but I don't think it will work on 98 et al. That
5903 5917 series of Windows is such a piece of junk anyway that I won't try
5904 5918 porting it there. The XP port was straightforward, showed a few
5905 5919 bugs here and there (fixed all), in particular some string
5906 5920 handling stuff which required considering Unicode strings (which
5907 5921 Windows uses). This is good, but hasn't been too tested :) No
5908 5922 fancy installer yet, I'll put a note in the manual so people at
5909 5923 least make manually a shortcut.
5910 5924
5911 5925 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5912 5926 into a single one, "colors". This now controls both prompt and
5913 5927 exception color schemes, and can be changed both at startup
5914 5928 (either via command-line switches or via ipythonrc files) and at
5915 5929 runtime, with @colors.
5916 5930 (Magic.magic_run): renamed @prun to @run and removed the old
5917 5931 @run. The two were too similar to warrant keeping both.
5918 5932
5919 5933 2002-02-03 Fernando Perez <fperez@colorado.edu>
5920 5934
5921 5935 * IPython/iplib.py (install_first_time): Added comment on how to
5922 5936 configure the color options for first-time users. Put a <return>
5923 5937 request at the end so that small-terminal users get a chance to
5924 5938 read the startup info.
5925 5939
5926 5940 2002-01-23 Fernando Perez <fperez@colorado.edu>
5927 5941
5928 5942 * IPython/iplib.py (CachedOutput.update): Changed output memory
5929 5943 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5930 5944 input history we still use _i. Did this b/c these variable are
5931 5945 very commonly used in interactive work, so the less we need to
5932 5946 type the better off we are.
5933 5947 (Magic.magic_prun): updated @prun to better handle the namespaces
5934 5948 the file will run in, including a fix for __name__ not being set
5935 5949 before.
5936 5950
5937 5951 2002-01-20 Fernando Perez <fperez@colorado.edu>
5938 5952
5939 5953 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5940 5954 extra garbage for Python 2.2. Need to look more carefully into
5941 5955 this later.
5942 5956
5943 5957 2002-01-19 Fernando Perez <fperez@colorado.edu>
5944 5958
5945 5959 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5946 5960 display SyntaxError exceptions properly formatted when they occur
5947 5961 (they can be triggered by imported code).
5948 5962
5949 5963 2002-01-18 Fernando Perez <fperez@colorado.edu>
5950 5964
5951 5965 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5952 5966 SyntaxError exceptions are reported nicely formatted, instead of
5953 5967 spitting out only offset information as before.
5954 5968 (Magic.magic_prun): Added the @prun function for executing
5955 5969 programs with command line args inside IPython.
5956 5970
5957 5971 2002-01-16 Fernando Perez <fperez@colorado.edu>
5958 5972
5959 5973 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5960 5974 to *not* include the last item given in a range. This brings their
5961 5975 behavior in line with Python's slicing:
5962 5976 a[n1:n2] -> a[n1]...a[n2-1]
5963 5977 It may be a bit less convenient, but I prefer to stick to Python's
5964 5978 conventions *everywhere*, so users never have to wonder.
5965 5979 (Magic.magic_macro): Added @macro function to ease the creation of
5966 5980 macros.
5967 5981
5968 5982 2002-01-05 Fernando Perez <fperez@colorado.edu>
5969 5983
5970 5984 * Released 0.2.4.
5971 5985
5972 5986 * IPython/iplib.py (Magic.magic_pdef):
5973 5987 (InteractiveShell.safe_execfile): report magic lines and error
5974 5988 lines without line numbers so one can easily copy/paste them for
5975 5989 re-execution.
5976 5990
5977 5991 * Updated manual with recent changes.
5978 5992
5979 5993 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5980 5994 docstring printing when class? is called. Very handy for knowing
5981 5995 how to create class instances (as long as __init__ is well
5982 5996 documented, of course :)
5983 5997 (Magic.magic_doc): print both class and constructor docstrings.
5984 5998 (Magic.magic_pdef): give constructor info if passed a class and
5985 5999 __call__ info for callable object instances.
5986 6000
5987 6001 2002-01-04 Fernando Perez <fperez@colorado.edu>
5988 6002
5989 6003 * Made deep_reload() off by default. It doesn't always work
5990 6004 exactly as intended, so it's probably safer to have it off. It's
5991 6005 still available as dreload() anyway, so nothing is lost.
5992 6006
5993 6007 2002-01-02 Fernando Perez <fperez@colorado.edu>
5994 6008
5995 6009 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5996 6010 so I wanted an updated release).
5997 6011
5998 6012 2001-12-27 Fernando Perez <fperez@colorado.edu>
5999 6013
6000 6014 * IPython/iplib.py (InteractiveShell.interact): Added the original
6001 6015 code from 'code.py' for this module in order to change the
6002 6016 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6003 6017 the history cache would break when the user hit Ctrl-C, and
6004 6018 interact() offers no way to add any hooks to it.
6005 6019
6006 6020 2001-12-23 Fernando Perez <fperez@colorado.edu>
6007 6021
6008 6022 * setup.py: added check for 'MANIFEST' before trying to remove
6009 6023 it. Thanks to Sean Reifschneider.
6010 6024
6011 6025 2001-12-22 Fernando Perez <fperez@colorado.edu>
6012 6026
6013 6027 * Released 0.2.2.
6014 6028
6015 6029 * Finished (reasonably) writing the manual. Later will add the
6016 6030 python-standard navigation stylesheets, but for the time being
6017 6031 it's fairly complete. Distribution will include html and pdf
6018 6032 versions.
6019 6033
6020 6034 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6021 6035 (MayaVi author).
6022 6036
6023 6037 2001-12-21 Fernando Perez <fperez@colorado.edu>
6024 6038
6025 6039 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6026 6040 good public release, I think (with the manual and the distutils
6027 6041 installer). The manual can use some work, but that can go
6028 6042 slowly. Otherwise I think it's quite nice for end users. Next
6029 6043 summer, rewrite the guts of it...
6030 6044
6031 6045 * Changed format of ipythonrc files to use whitespace as the
6032 6046 separator instead of an explicit '='. Cleaner.
6033 6047
6034 6048 2001-12-20 Fernando Perez <fperez@colorado.edu>
6035 6049
6036 6050 * Started a manual in LyX. For now it's just a quick merge of the
6037 6051 various internal docstrings and READMEs. Later it may grow into a
6038 6052 nice, full-blown manual.
6039 6053
6040 6054 * Set up a distutils based installer. Installation should now be
6041 6055 trivially simple for end-users.
6042 6056
6043 6057 2001-12-11 Fernando Perez <fperez@colorado.edu>
6044 6058
6045 6059 * Released 0.2.0. First public release, announced it at
6046 6060 comp.lang.python. From now on, just bugfixes...
6047 6061
6048 6062 * Went through all the files, set copyright/license notices and
6049 6063 cleaned up things. Ready for release.
6050 6064
6051 6065 2001-12-10 Fernando Perez <fperez@colorado.edu>
6052 6066
6053 6067 * Changed the first-time installer not to use tarfiles. It's more
6054 6068 robust now and less unix-dependent. Also makes it easier for
6055 6069 people to later upgrade versions.
6056 6070
6057 6071 * Changed @exit to @abort to reflect the fact that it's pretty
6058 6072 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6059 6073 becomes significant only when IPyhton is embedded: in that case,
6060 6074 C-D closes IPython only, but @abort kills the enclosing program
6061 6075 too (unless it had called IPython inside a try catching
6062 6076 SystemExit).
6063 6077
6064 6078 * Created Shell module which exposes the actuall IPython Shell
6065 6079 classes, currently the normal and the embeddable one. This at
6066 6080 least offers a stable interface we won't need to change when
6067 6081 (later) the internals are rewritten. That rewrite will be confined
6068 6082 to iplib and ipmaker, but the Shell interface should remain as is.
6069 6083
6070 6084 * Added embed module which offers an embeddable IPShell object,
6071 6085 useful to fire up IPython *inside* a running program. Great for
6072 6086 debugging or dynamical data analysis.
6073 6087
6074 6088 2001-12-08 Fernando Perez <fperez@colorado.edu>
6075 6089
6076 6090 * Fixed small bug preventing seeing info from methods of defined
6077 6091 objects (incorrect namespace in _ofind()).
6078 6092
6079 6093 * Documentation cleanup. Moved the main usage docstrings to a
6080 6094 separate file, usage.py (cleaner to maintain, and hopefully in the
6081 6095 future some perlpod-like way of producing interactive, man and
6082 6096 html docs out of it will be found).
6083 6097
6084 6098 * Added @profile to see your profile at any time.
6085 6099
6086 6100 * Added @p as an alias for 'print'. It's especially convenient if
6087 6101 using automagic ('p x' prints x).
6088 6102
6089 6103 * Small cleanups and fixes after a pychecker run.
6090 6104
6091 6105 * Changed the @cd command to handle @cd - and @cd -<n> for
6092 6106 visiting any directory in _dh.
6093 6107
6094 6108 * Introduced _dh, a history of visited directories. @dhist prints
6095 6109 it out with numbers.
6096 6110
6097 6111 2001-12-07 Fernando Perez <fperez@colorado.edu>
6098 6112
6099 6113 * Released 0.1.22
6100 6114
6101 6115 * Made initialization a bit more robust against invalid color
6102 6116 options in user input (exit, not traceback-crash).
6103 6117
6104 6118 * Changed the bug crash reporter to write the report only in the
6105 6119 user's .ipython directory. That way IPython won't litter people's
6106 6120 hard disks with crash files all over the place. Also print on
6107 6121 screen the necessary mail command.
6108 6122
6109 6123 * With the new ultraTB, implemented LightBG color scheme for light
6110 6124 background terminals. A lot of people like white backgrounds, so I
6111 6125 guess we should at least give them something readable.
6112 6126
6113 6127 2001-12-06 Fernando Perez <fperez@colorado.edu>
6114 6128
6115 6129 * Modified the structure of ultraTB. Now there's a proper class
6116 6130 for tables of color schemes which allow adding schemes easily and
6117 6131 switching the active scheme without creating a new instance every
6118 6132 time (which was ridiculous). The syntax for creating new schemes
6119 6133 is also cleaner. I think ultraTB is finally done, with a clean
6120 6134 class structure. Names are also much cleaner (now there's proper
6121 6135 color tables, no need for every variable to also have 'color' in
6122 6136 its name).
6123 6137
6124 6138 * Broke down genutils into separate files. Now genutils only
6125 6139 contains utility functions, and classes have been moved to their
6126 6140 own files (they had enough independent functionality to warrant
6127 6141 it): ConfigLoader, OutputTrap, Struct.
6128 6142
6129 6143 2001-12-05 Fernando Perez <fperez@colorado.edu>
6130 6144
6131 6145 * IPython turns 21! Released version 0.1.21, as a candidate for
6132 6146 public consumption. If all goes well, release in a few days.
6133 6147
6134 6148 * Fixed path bug (files in Extensions/ directory wouldn't be found
6135 6149 unless IPython/ was explicitly in sys.path).
6136 6150
6137 6151 * Extended the FlexCompleter class as MagicCompleter to allow
6138 6152 completion of @-starting lines.
6139 6153
6140 6154 * Created __release__.py file as a central repository for release
6141 6155 info that other files can read from.
6142 6156
6143 6157 * Fixed small bug in logging: when logging was turned on in
6144 6158 mid-session, old lines with special meanings (!@?) were being
6145 6159 logged without the prepended comment, which is necessary since
6146 6160 they are not truly valid python syntax. This should make session
6147 6161 restores produce less errors.
6148 6162
6149 6163 * The namespace cleanup forced me to make a FlexCompleter class
6150 6164 which is nothing but a ripoff of rlcompleter, but with selectable
6151 6165 namespace (rlcompleter only works in __main__.__dict__). I'll try
6152 6166 to submit a note to the authors to see if this change can be
6153 6167 incorporated in future rlcompleter releases (Dec.6: done)
6154 6168
6155 6169 * More fixes to namespace handling. It was a mess! Now all
6156 6170 explicit references to __main__.__dict__ are gone (except when
6157 6171 really needed) and everything is handled through the namespace
6158 6172 dicts in the IPython instance. We seem to be getting somewhere
6159 6173 with this, finally...
6160 6174
6161 6175 * Small documentation updates.
6162 6176
6163 6177 * Created the Extensions directory under IPython (with an
6164 6178 __init__.py). Put the PhysicalQ stuff there. This directory should
6165 6179 be used for all special-purpose extensions.
6166 6180
6167 6181 * File renaming:
6168 6182 ipythonlib --> ipmaker
6169 6183 ipplib --> iplib
6170 6184 This makes a bit more sense in terms of what these files actually do.
6171 6185
6172 6186 * Moved all the classes and functions in ipythonlib to ipplib, so
6173 6187 now ipythonlib only has make_IPython(). This will ease up its
6174 6188 splitting in smaller functional chunks later.
6175 6189
6176 6190 * Cleaned up (done, I think) output of @whos. Better column
6177 6191 formatting, and now shows str(var) for as much as it can, which is
6178 6192 typically what one gets with a 'print var'.
6179 6193
6180 6194 2001-12-04 Fernando Perez <fperez@colorado.edu>
6181 6195
6182 6196 * Fixed namespace problems. Now builtin/IPyhton/user names get
6183 6197 properly reported in their namespace. Internal namespace handling
6184 6198 is finally getting decent (not perfect yet, but much better than
6185 6199 the ad-hoc mess we had).
6186 6200
6187 6201 * Removed -exit option. If people just want to run a python
6188 6202 script, that's what the normal interpreter is for. Less
6189 6203 unnecessary options, less chances for bugs.
6190 6204
6191 6205 * Added a crash handler which generates a complete post-mortem if
6192 6206 IPython crashes. This will help a lot in tracking bugs down the
6193 6207 road.
6194 6208
6195 6209 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6196 6210 which were boud to functions being reassigned would bypass the
6197 6211 logger, breaking the sync of _il with the prompt counter. This
6198 6212 would then crash IPython later when a new line was logged.
6199 6213
6200 6214 2001-12-02 Fernando Perez <fperez@colorado.edu>
6201 6215
6202 6216 * Made IPython a package. This means people don't have to clutter
6203 6217 their sys.path with yet another directory. Changed the INSTALL
6204 6218 file accordingly.
6205 6219
6206 6220 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6207 6221 sorts its output (so @who shows it sorted) and @whos formats the
6208 6222 table according to the width of the first column. Nicer, easier to
6209 6223 read. Todo: write a generic table_format() which takes a list of
6210 6224 lists and prints it nicely formatted, with optional row/column
6211 6225 separators and proper padding and justification.
6212 6226
6213 6227 * Released 0.1.20
6214 6228
6215 6229 * Fixed bug in @log which would reverse the inputcache list (a
6216 6230 copy operation was missing).
6217 6231
6218 6232 * Code cleanup. @config was changed to use page(). Better, since
6219 6233 its output is always quite long.
6220 6234
6221 6235 * Itpl is back as a dependency. I was having too many problems
6222 6236 getting the parametric aliases to work reliably, and it's just
6223 6237 easier to code weird string operations with it than playing %()s
6224 6238 games. It's only ~6k, so I don't think it's too big a deal.
6225 6239
6226 6240 * Found (and fixed) a very nasty bug with history. !lines weren't
6227 6241 getting cached, and the out of sync caches would crash
6228 6242 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6229 6243 division of labor a bit better. Bug fixed, cleaner structure.
6230 6244
6231 6245 2001-12-01 Fernando Perez <fperez@colorado.edu>
6232 6246
6233 6247 * Released 0.1.19
6234 6248
6235 6249 * Added option -n to @hist to prevent line number printing. Much
6236 6250 easier to copy/paste code this way.
6237 6251
6238 6252 * Created global _il to hold the input list. Allows easy
6239 6253 re-execution of blocks of code by slicing it (inspired by Janko's
6240 6254 comment on 'macros').
6241 6255
6242 6256 * Small fixes and doc updates.
6243 6257
6244 6258 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6245 6259 much too fragile with automagic. Handles properly multi-line
6246 6260 statements and takes parameters.
6247 6261
6248 6262 2001-11-30 Fernando Perez <fperez@colorado.edu>
6249 6263
6250 6264 * Version 0.1.18 released.
6251 6265
6252 6266 * Fixed nasty namespace bug in initial module imports.
6253 6267
6254 6268 * Added copyright/license notes to all code files (except
6255 6269 DPyGetOpt). For the time being, LGPL. That could change.
6256 6270
6257 6271 * Rewrote a much nicer README, updated INSTALL, cleaned up
6258 6272 ipythonrc-* samples.
6259 6273
6260 6274 * Overall code/documentation cleanup. Basically ready for
6261 6275 release. Only remaining thing: licence decision (LGPL?).
6262 6276
6263 6277 * Converted load_config to a class, ConfigLoader. Now recursion
6264 6278 control is better organized. Doesn't include the same file twice.
6265 6279
6266 6280 2001-11-29 Fernando Perez <fperez@colorado.edu>
6267 6281
6268 6282 * Got input history working. Changed output history variables from
6269 6283 _p to _o so that _i is for input and _o for output. Just cleaner
6270 6284 convention.
6271 6285
6272 6286 * Implemented parametric aliases. This pretty much allows the
6273 6287 alias system to offer full-blown shell convenience, I think.
6274 6288
6275 6289 * Version 0.1.17 released, 0.1.18 opened.
6276 6290
6277 6291 * dot_ipython/ipythonrc (alias): added documentation.
6278 6292 (xcolor): Fixed small bug (xcolors -> xcolor)
6279 6293
6280 6294 * Changed the alias system. Now alias is a magic command to define
6281 6295 aliases just like the shell. Rationale: the builtin magics should
6282 6296 be there for things deeply connected to IPython's
6283 6297 architecture. And this is a much lighter system for what I think
6284 6298 is the really important feature: allowing users to define quickly
6285 6299 magics that will do shell things for them, so they can customize
6286 6300 IPython easily to match their work habits. If someone is really
6287 6301 desperate to have another name for a builtin alias, they can
6288 6302 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6289 6303 works.
6290 6304
6291 6305 2001-11-28 Fernando Perez <fperez@colorado.edu>
6292 6306
6293 6307 * Changed @file so that it opens the source file at the proper
6294 6308 line. Since it uses less, if your EDITOR environment is
6295 6309 configured, typing v will immediately open your editor of choice
6296 6310 right at the line where the object is defined. Not as quick as
6297 6311 having a direct @edit command, but for all intents and purposes it
6298 6312 works. And I don't have to worry about writing @edit to deal with
6299 6313 all the editors, less does that.
6300 6314
6301 6315 * Version 0.1.16 released, 0.1.17 opened.
6302 6316
6303 6317 * Fixed some nasty bugs in the page/page_dumb combo that could
6304 6318 crash IPython.
6305 6319
6306 6320 2001-11-27 Fernando Perez <fperez@colorado.edu>
6307 6321
6308 6322 * Version 0.1.15 released, 0.1.16 opened.
6309 6323
6310 6324 * Finally got ? and ?? to work for undefined things: now it's
6311 6325 possible to type {}.get? and get information about the get method
6312 6326 of dicts, or os.path? even if only os is defined (so technically
6313 6327 os.path isn't). Works at any level. For example, after import os,
6314 6328 os?, os.path?, os.path.abspath? all work. This is great, took some
6315 6329 work in _ofind.
6316 6330
6317 6331 * Fixed more bugs with logging. The sanest way to do it was to add
6318 6332 to @log a 'mode' parameter. Killed two in one shot (this mode
6319 6333 option was a request of Janko's). I think it's finally clean
6320 6334 (famous last words).
6321 6335
6322 6336 * Added a page_dumb() pager which does a decent job of paging on
6323 6337 screen, if better things (like less) aren't available. One less
6324 6338 unix dependency (someday maybe somebody will port this to
6325 6339 windows).
6326 6340
6327 6341 * Fixed problem in magic_log: would lock of logging out if log
6328 6342 creation failed (because it would still think it had succeeded).
6329 6343
6330 6344 * Improved the page() function using curses to auto-detect screen
6331 6345 size. Now it can make a much better decision on whether to print
6332 6346 or page a string. Option screen_length was modified: a value 0
6333 6347 means auto-detect, and that's the default now.
6334 6348
6335 6349 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6336 6350 go out. I'll test it for a few days, then talk to Janko about
6337 6351 licences and announce it.
6338 6352
6339 6353 * Fixed the length of the auto-generated ---> prompt which appears
6340 6354 for auto-parens and auto-quotes. Getting this right isn't trivial,
6341 6355 with all the color escapes, different prompt types and optional
6342 6356 separators. But it seems to be working in all the combinations.
6343 6357
6344 6358 2001-11-26 Fernando Perez <fperez@colorado.edu>
6345 6359
6346 6360 * Wrote a regexp filter to get option types from the option names
6347 6361 string. This eliminates the need to manually keep two duplicate
6348 6362 lists.
6349 6363
6350 6364 * Removed the unneeded check_option_names. Now options are handled
6351 6365 in a much saner manner and it's easy to visually check that things
6352 6366 are ok.
6353 6367
6354 6368 * Updated version numbers on all files I modified to carry a
6355 6369 notice so Janko and Nathan have clear version markers.
6356 6370
6357 6371 * Updated docstring for ultraTB with my changes. I should send
6358 6372 this to Nathan.
6359 6373
6360 6374 * Lots of small fixes. Ran everything through pychecker again.
6361 6375
6362 6376 * Made loading of deep_reload an cmd line option. If it's not too
6363 6377 kosher, now people can just disable it. With -nodeep_reload it's
6364 6378 still available as dreload(), it just won't overwrite reload().
6365 6379
6366 6380 * Moved many options to the no| form (-opt and -noopt
6367 6381 accepted). Cleaner.
6368 6382
6369 6383 * Changed magic_log so that if called with no parameters, it uses
6370 6384 'rotate' mode. That way auto-generated logs aren't automatically
6371 6385 over-written. For normal logs, now a backup is made if it exists
6372 6386 (only 1 level of backups). A new 'backup' mode was added to the
6373 6387 Logger class to support this. This was a request by Janko.
6374 6388
6375 6389 * Added @logoff/@logon to stop/restart an active log.
6376 6390
6377 6391 * Fixed a lot of bugs in log saving/replay. It was pretty
6378 6392 broken. Now special lines (!@,/) appear properly in the command
6379 6393 history after a log replay.
6380 6394
6381 6395 * Tried and failed to implement full session saving via pickle. My
6382 6396 idea was to pickle __main__.__dict__, but modules can't be
6383 6397 pickled. This would be a better alternative to replaying logs, but
6384 6398 seems quite tricky to get to work. Changed -session to be called
6385 6399 -logplay, which more accurately reflects what it does. And if we
6386 6400 ever get real session saving working, -session is now available.
6387 6401
6388 6402 * Implemented color schemes for prompts also. As for tracebacks,
6389 6403 currently only NoColor and Linux are supported. But now the
6390 6404 infrastructure is in place, based on a generic ColorScheme
6391 6405 class. So writing and activating new schemes both for the prompts
6392 6406 and the tracebacks should be straightforward.
6393 6407
6394 6408 * Version 0.1.13 released, 0.1.14 opened.
6395 6409
6396 6410 * Changed handling of options for output cache. Now counter is
6397 6411 hardwired starting at 1 and one specifies the maximum number of
6398 6412 entries *in the outcache* (not the max prompt counter). This is
6399 6413 much better, since many statements won't increase the cache
6400 6414 count. It also eliminated some confusing options, now there's only
6401 6415 one: cache_size.
6402 6416
6403 6417 * Added 'alias' magic function and magic_alias option in the
6404 6418 ipythonrc file. Now the user can easily define whatever names he
6405 6419 wants for the magic functions without having to play weird
6406 6420 namespace games. This gives IPython a real shell-like feel.
6407 6421
6408 6422 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6409 6423 @ or not).
6410 6424
6411 6425 This was one of the last remaining 'visible' bugs (that I know
6412 6426 of). I think if I can clean up the session loading so it works
6413 6427 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6414 6428 about licensing).
6415 6429
6416 6430 2001-11-25 Fernando Perez <fperez@colorado.edu>
6417 6431
6418 6432 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6419 6433 there's a cleaner distinction between what ? and ?? show.
6420 6434
6421 6435 * Added screen_length option. Now the user can define his own
6422 6436 screen size for page() operations.
6423 6437
6424 6438 * Implemented magic shell-like functions with automatic code
6425 6439 generation. Now adding another function is just a matter of adding
6426 6440 an entry to a dict, and the function is dynamically generated at
6427 6441 run-time. Python has some really cool features!
6428 6442
6429 6443 * Renamed many options to cleanup conventions a little. Now all
6430 6444 are lowercase, and only underscores where needed. Also in the code
6431 6445 option name tables are clearer.
6432 6446
6433 6447 * Changed prompts a little. Now input is 'In [n]:' instead of
6434 6448 'In[n]:='. This allows it the numbers to be aligned with the
6435 6449 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6436 6450 Python (it was a Mathematica thing). The '...' continuation prompt
6437 6451 was also changed a little to align better.
6438 6452
6439 6453 * Fixed bug when flushing output cache. Not all _p<n> variables
6440 6454 exist, so their deletion needs to be wrapped in a try:
6441 6455
6442 6456 * Figured out how to properly use inspect.formatargspec() (it
6443 6457 requires the args preceded by *). So I removed all the code from
6444 6458 _get_pdef in Magic, which was just replicating that.
6445 6459
6446 6460 * Added test to prefilter to allow redefining magic function names
6447 6461 as variables. This is ok, since the @ form is always available,
6448 6462 but whe should allow the user to define a variable called 'ls' if
6449 6463 he needs it.
6450 6464
6451 6465 * Moved the ToDo information from README into a separate ToDo.
6452 6466
6453 6467 * General code cleanup and small bugfixes. I think it's close to a
6454 6468 state where it can be released, obviously with a big 'beta'
6455 6469 warning on it.
6456 6470
6457 6471 * Got the magic function split to work. Now all magics are defined
6458 6472 in a separate class. It just organizes things a bit, and now
6459 6473 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6460 6474 was too long).
6461 6475
6462 6476 * Changed @clear to @reset to avoid potential confusions with
6463 6477 the shell command clear. Also renamed @cl to @clear, which does
6464 6478 exactly what people expect it to from their shell experience.
6465 6479
6466 6480 Added a check to the @reset command (since it's so
6467 6481 destructive, it's probably a good idea to ask for confirmation).
6468 6482 But now reset only works for full namespace resetting. Since the
6469 6483 del keyword is already there for deleting a few specific
6470 6484 variables, I don't see the point of having a redundant magic
6471 6485 function for the same task.
6472 6486
6473 6487 2001-11-24 Fernando Perez <fperez@colorado.edu>
6474 6488
6475 6489 * Updated the builtin docs (esp. the ? ones).
6476 6490
6477 6491 * Ran all the code through pychecker. Not terribly impressed with
6478 6492 it: lots of spurious warnings and didn't really find anything of
6479 6493 substance (just a few modules being imported and not used).
6480 6494
6481 6495 * Implemented the new ultraTB functionality into IPython. New
6482 6496 option: xcolors. This chooses color scheme. xmode now only selects
6483 6497 between Plain and Verbose. Better orthogonality.
6484 6498
6485 6499 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6486 6500 mode and color scheme for the exception handlers. Now it's
6487 6501 possible to have the verbose traceback with no coloring.
6488 6502
6489 6503 2001-11-23 Fernando Perez <fperez@colorado.edu>
6490 6504
6491 6505 * Version 0.1.12 released, 0.1.13 opened.
6492 6506
6493 6507 * Removed option to set auto-quote and auto-paren escapes by
6494 6508 user. The chances of breaking valid syntax are just too high. If
6495 6509 someone *really* wants, they can always dig into the code.
6496 6510
6497 6511 * Made prompt separators configurable.
6498 6512
6499 6513 2001-11-22 Fernando Perez <fperez@colorado.edu>
6500 6514
6501 6515 * Small bugfixes in many places.
6502 6516
6503 6517 * Removed the MyCompleter class from ipplib. It seemed redundant
6504 6518 with the C-p,C-n history search functionality. Less code to
6505 6519 maintain.
6506 6520
6507 6521 * Moved all the original ipython.py code into ipythonlib.py. Right
6508 6522 now it's just one big dump into a function called make_IPython, so
6509 6523 no real modularity has been gained. But at least it makes the
6510 6524 wrapper script tiny, and since ipythonlib is a module, it gets
6511 6525 compiled and startup is much faster.
6512 6526
6513 6527 This is a reasobably 'deep' change, so we should test it for a
6514 6528 while without messing too much more with the code.
6515 6529
6516 6530 2001-11-21 Fernando Perez <fperez@colorado.edu>
6517 6531
6518 6532 * Version 0.1.11 released, 0.1.12 opened for further work.
6519 6533
6520 6534 * Removed dependency on Itpl. It was only needed in one place. It
6521 6535 would be nice if this became part of python, though. It makes life
6522 6536 *a lot* easier in some cases.
6523 6537
6524 6538 * Simplified the prefilter code a bit. Now all handlers are
6525 6539 expected to explicitly return a value (at least a blank string).
6526 6540
6527 6541 * Heavy edits in ipplib. Removed the help system altogether. Now
6528 6542 obj?/?? is used for inspecting objects, a magic @doc prints
6529 6543 docstrings, and full-blown Python help is accessed via the 'help'
6530 6544 keyword. This cleans up a lot of code (less to maintain) and does
6531 6545 the job. Since 'help' is now a standard Python component, might as
6532 6546 well use it and remove duplicate functionality.
6533 6547
6534 6548 Also removed the option to use ipplib as a standalone program. By
6535 6549 now it's too dependent on other parts of IPython to function alone.
6536 6550
6537 6551 * Fixed bug in genutils.pager. It would crash if the pager was
6538 6552 exited immediately after opening (broken pipe).
6539 6553
6540 6554 * Trimmed down the VerboseTB reporting a little. The header is
6541 6555 much shorter now and the repeated exception arguments at the end
6542 6556 have been removed. For interactive use the old header seemed a bit
6543 6557 excessive.
6544 6558
6545 6559 * Fixed small bug in output of @whos for variables with multi-word
6546 6560 types (only first word was displayed).
6547 6561
6548 6562 2001-11-17 Fernando Perez <fperez@colorado.edu>
6549 6563
6550 6564 * Version 0.1.10 released, 0.1.11 opened for further work.
6551 6565
6552 6566 * Modified dirs and friends. dirs now *returns* the stack (not
6553 6567 prints), so one can manipulate it as a variable. Convenient to
6554 6568 travel along many directories.
6555 6569
6556 6570 * Fixed bug in magic_pdef: would only work with functions with
6557 6571 arguments with default values.
6558 6572
6559 6573 2001-11-14 Fernando Perez <fperez@colorado.edu>
6560 6574
6561 6575 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6562 6576 example with IPython. Various other minor fixes and cleanups.
6563 6577
6564 6578 * Version 0.1.9 released, 0.1.10 opened for further work.
6565 6579
6566 6580 * Added sys.path to the list of directories searched in the
6567 6581 execfile= option. It used to be the current directory and the
6568 6582 user's IPYTHONDIR only.
6569 6583
6570 6584 2001-11-13 Fernando Perez <fperez@colorado.edu>
6571 6585
6572 6586 * Reinstated the raw_input/prefilter separation that Janko had
6573 6587 initially. This gives a more convenient setup for extending the
6574 6588 pre-processor from the outside: raw_input always gets a string,
6575 6589 and prefilter has to process it. We can then redefine prefilter
6576 6590 from the outside and implement extensions for special
6577 6591 purposes.
6578 6592
6579 6593 Today I got one for inputting PhysicalQuantity objects
6580 6594 (from Scientific) without needing any function calls at
6581 6595 all. Extremely convenient, and it's all done as a user-level
6582 6596 extension (no IPython code was touched). Now instead of:
6583 6597 a = PhysicalQuantity(4.2,'m/s**2')
6584 6598 one can simply say
6585 6599 a = 4.2 m/s**2
6586 6600 or even
6587 6601 a = 4.2 m/s^2
6588 6602
6589 6603 I use this, but it's also a proof of concept: IPython really is
6590 6604 fully user-extensible, even at the level of the parsing of the
6591 6605 command line. It's not trivial, but it's perfectly doable.
6592 6606
6593 6607 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6594 6608 the problem of modules being loaded in the inverse order in which
6595 6609 they were defined in
6596 6610
6597 6611 * Version 0.1.8 released, 0.1.9 opened for further work.
6598 6612
6599 6613 * Added magics pdef, source and file. They respectively show the
6600 6614 definition line ('prototype' in C), source code and full python
6601 6615 file for any callable object. The object inspector oinfo uses
6602 6616 these to show the same information.
6603 6617
6604 6618 * Version 0.1.7 released, 0.1.8 opened for further work.
6605 6619
6606 6620 * Separated all the magic functions into a class called Magic. The
6607 6621 InteractiveShell class was becoming too big for Xemacs to handle
6608 6622 (de-indenting a line would lock it up for 10 seconds while it
6609 6623 backtracked on the whole class!)
6610 6624
6611 6625 FIXME: didn't work. It can be done, but right now namespaces are
6612 6626 all messed up. Do it later (reverted it for now, so at least
6613 6627 everything works as before).
6614 6628
6615 6629 * Got the object introspection system (magic_oinfo) working! I
6616 6630 think this is pretty much ready for release to Janko, so he can
6617 6631 test it for a while and then announce it. Pretty much 100% of what
6618 6632 I wanted for the 'phase 1' release is ready. Happy, tired.
6619 6633
6620 6634 2001-11-12 Fernando Perez <fperez@colorado.edu>
6621 6635
6622 6636 * Version 0.1.6 released, 0.1.7 opened for further work.
6623 6637
6624 6638 * Fixed bug in printing: it used to test for truth before
6625 6639 printing, so 0 wouldn't print. Now checks for None.
6626 6640
6627 6641 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6628 6642 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6629 6643 reaches by hand into the outputcache. Think of a better way to do
6630 6644 this later.
6631 6645
6632 6646 * Various small fixes thanks to Nathan's comments.
6633 6647
6634 6648 * Changed magic_pprint to magic_Pprint. This way it doesn't
6635 6649 collide with pprint() and the name is consistent with the command
6636 6650 line option.
6637 6651
6638 6652 * Changed prompt counter behavior to be fully like
6639 6653 Mathematica's. That is, even input that doesn't return a result
6640 6654 raises the prompt counter. The old behavior was kind of confusing
6641 6655 (getting the same prompt number several times if the operation
6642 6656 didn't return a result).
6643 6657
6644 6658 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6645 6659
6646 6660 * Fixed -Classic mode (wasn't working anymore).
6647 6661
6648 6662 * Added colored prompts using Nathan's new code. Colors are
6649 6663 currently hardwired, they can be user-configurable. For
6650 6664 developers, they can be chosen in file ipythonlib.py, at the
6651 6665 beginning of the CachedOutput class def.
6652 6666
6653 6667 2001-11-11 Fernando Perez <fperez@colorado.edu>
6654 6668
6655 6669 * Version 0.1.5 released, 0.1.6 opened for further work.
6656 6670
6657 6671 * Changed magic_env to *return* the environment as a dict (not to
6658 6672 print it). This way it prints, but it can also be processed.
6659 6673
6660 6674 * Added Verbose exception reporting to interactive
6661 6675 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6662 6676 traceback. Had to make some changes to the ultraTB file. This is
6663 6677 probably the last 'big' thing in my mental todo list. This ties
6664 6678 in with the next entry:
6665 6679
6666 6680 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6667 6681 has to specify is Plain, Color or Verbose for all exception
6668 6682 handling.
6669 6683
6670 6684 * Removed ShellServices option. All this can really be done via
6671 6685 the magic system. It's easier to extend, cleaner and has automatic
6672 6686 namespace protection and documentation.
6673 6687
6674 6688 2001-11-09 Fernando Perez <fperez@colorado.edu>
6675 6689
6676 6690 * Fixed bug in output cache flushing (missing parameter to
6677 6691 __init__). Other small bugs fixed (found using pychecker).
6678 6692
6679 6693 * Version 0.1.4 opened for bugfixing.
6680 6694
6681 6695 2001-11-07 Fernando Perez <fperez@colorado.edu>
6682 6696
6683 6697 * Version 0.1.3 released, mainly because of the raw_input bug.
6684 6698
6685 6699 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6686 6700 and when testing for whether things were callable, a call could
6687 6701 actually be made to certain functions. They would get called again
6688 6702 once 'really' executed, with a resulting double call. A disaster
6689 6703 in many cases (list.reverse() would never work!).
6690 6704
6691 6705 * Removed prefilter() function, moved its code to raw_input (which
6692 6706 after all was just a near-empty caller for prefilter). This saves
6693 6707 a function call on every prompt, and simplifies the class a tiny bit.
6694 6708
6695 6709 * Fix _ip to __ip name in magic example file.
6696 6710
6697 6711 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6698 6712 work with non-gnu versions of tar.
6699 6713
6700 6714 2001-11-06 Fernando Perez <fperez@colorado.edu>
6701 6715
6702 6716 * Version 0.1.2. Just to keep track of the recent changes.
6703 6717
6704 6718 * Fixed nasty bug in output prompt routine. It used to check 'if
6705 6719 arg != None...'. Problem is, this fails if arg implements a
6706 6720 special comparison (__cmp__) which disallows comparing to
6707 6721 None. Found it when trying to use the PhysicalQuantity module from
6708 6722 ScientificPython.
6709 6723
6710 6724 2001-11-05 Fernando Perez <fperez@colorado.edu>
6711 6725
6712 6726 * Also added dirs. Now the pushd/popd/dirs family functions
6713 6727 basically like the shell, with the added convenience of going home
6714 6728 when called with no args.
6715 6729
6716 6730 * pushd/popd slightly modified to mimic shell behavior more
6717 6731 closely.
6718 6732
6719 6733 * Added env,pushd,popd from ShellServices as magic functions. I
6720 6734 think the cleanest will be to port all desired functions from
6721 6735 ShellServices as magics and remove ShellServices altogether. This
6722 6736 will provide a single, clean way of adding functionality
6723 6737 (shell-type or otherwise) to IP.
6724 6738
6725 6739 2001-11-04 Fernando Perez <fperez@colorado.edu>
6726 6740
6727 6741 * Added .ipython/ directory to sys.path. This way users can keep
6728 6742 customizations there and access them via import.
6729 6743
6730 6744 2001-11-03 Fernando Perez <fperez@colorado.edu>
6731 6745
6732 6746 * Opened version 0.1.1 for new changes.
6733 6747
6734 6748 * Changed version number to 0.1.0: first 'public' release, sent to
6735 6749 Nathan and Janko.
6736 6750
6737 6751 * Lots of small fixes and tweaks.
6738 6752
6739 6753 * Minor changes to whos format. Now strings are shown, snipped if
6740 6754 too long.
6741 6755
6742 6756 * Changed ShellServices to work on __main__ so they show up in @who
6743 6757
6744 6758 * Help also works with ? at the end of a line:
6745 6759 ?sin and sin?
6746 6760 both produce the same effect. This is nice, as often I use the
6747 6761 tab-complete to find the name of a method, but I used to then have
6748 6762 to go to the beginning of the line to put a ? if I wanted more
6749 6763 info. Now I can just add the ? and hit return. Convenient.
6750 6764
6751 6765 2001-11-02 Fernando Perez <fperez@colorado.edu>
6752 6766
6753 6767 * Python version check (>=2.1) added.
6754 6768
6755 6769 * Added LazyPython documentation. At this point the docs are quite
6756 6770 a mess. A cleanup is in order.
6757 6771
6758 6772 * Auto-installer created. For some bizarre reason, the zipfiles
6759 6773 module isn't working on my system. So I made a tar version
6760 6774 (hopefully the command line options in various systems won't kill
6761 6775 me).
6762 6776
6763 6777 * Fixes to Struct in genutils. Now all dictionary-like methods are
6764 6778 protected (reasonably).
6765 6779
6766 6780 * Added pager function to genutils and changed ? to print usage
6767 6781 note through it (it was too long).
6768 6782
6769 6783 * Added the LazyPython functionality. Works great! I changed the
6770 6784 auto-quote escape to ';', it's on home row and next to '. But
6771 6785 both auto-quote and auto-paren (still /) escapes are command-line
6772 6786 parameters.
6773 6787
6774 6788
6775 6789 2001-11-01 Fernando Perez <fperez@colorado.edu>
6776 6790
6777 6791 * Version changed to 0.0.7. Fairly large change: configuration now
6778 6792 is all stored in a directory, by default .ipython. There, all
6779 6793 config files have normal looking names (not .names)
6780 6794
6781 6795 * Version 0.0.6 Released first to Lucas and Archie as a test
6782 6796 run. Since it's the first 'semi-public' release, change version to
6783 6797 > 0.0.6 for any changes now.
6784 6798
6785 6799 * Stuff I had put in the ipplib.py changelog:
6786 6800
6787 6801 Changes to InteractiveShell:
6788 6802
6789 6803 - Made the usage message a parameter.
6790 6804
6791 6805 - Require the name of the shell variable to be given. It's a bit
6792 6806 of a hack, but allows the name 'shell' not to be hardwired in the
6793 6807 magic (@) handler, which is problematic b/c it requires
6794 6808 polluting the global namespace with 'shell'. This in turn is
6795 6809 fragile: if a user redefines a variable called shell, things
6796 6810 break.
6797 6811
6798 6812 - magic @: all functions available through @ need to be defined
6799 6813 as magic_<name>, even though they can be called simply as
6800 6814 @<name>. This allows the special command @magic to gather
6801 6815 information automatically about all existing magic functions,
6802 6816 even if they are run-time user extensions, by parsing the shell
6803 6817 instance __dict__ looking for special magic_ names.
6804 6818
6805 6819 - mainloop: added *two* local namespace parameters. This allows
6806 6820 the class to differentiate between parameters which were there
6807 6821 before and after command line initialization was processed. This
6808 6822 way, later @who can show things loaded at startup by the
6809 6823 user. This trick was necessary to make session saving/reloading
6810 6824 really work: ideally after saving/exiting/reloading a session,
6811 6825 *everything* should look the same, including the output of @who. I
6812 6826 was only able to make this work with this double namespace
6813 6827 trick.
6814 6828
6815 6829 - added a header to the logfile which allows (almost) full
6816 6830 session restoring.
6817 6831
6818 6832 - prepend lines beginning with @ or !, with a and log
6819 6833 them. Why? !lines: may be useful to know what you did @lines:
6820 6834 they may affect session state. So when restoring a session, at
6821 6835 least inform the user of their presence. I couldn't quite get
6822 6836 them to properly re-execute, but at least the user is warned.
6823 6837
6824 6838 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now