##// END OF EJS Templates
fix to help users with invalid $HOME under win32.
fperez -
r6:396feddb
parent child Browse files
Show More
@@ -1,1508 +1,1520 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 General purpose utilities.
4 4
5 5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 6 these things are also convenient when working at the command line.
7 7
8 $Id: genutils.py 638 2005-07-18 03:01:41Z fperez $"""
8 $Id: genutils.py 645 2005-07-19 01:59:26Z fperez $"""
9 9
10 10 #*****************************************************************************
11 11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
12 12 #
13 13 # Distributed under the terms of the BSD License. The full license is in
14 14 # the file COPYING, distributed as part of this software.
15 15 #*****************************************************************************
16 16
17 17 from IPython import Release
18 18 __author__ = '%s <%s>' % Release.authors['Fernando']
19 19 __license__ = Release.license
20 20
21 21 #****************************************************************************
22 22 # required modules
23 23 import __main__
24 24 import types,commands,time,sys,os,re,shutil
25 25 import tempfile
26 26 import codecs
27 27 from IPython.Itpl import Itpl,itpl,printpl
28 28 from IPython import DPyGetOpt
29 29
30 30 # Build objects which appeared in Python 2.3 for 2.2, to make ipython
31 31 # 2.2-friendly
32 32 try:
33 33 basestring
34 34 except NameError:
35 35 import types
36 36 basestring = (types.StringType, types.UnicodeType)
37 37 True = 1==1
38 38 False = 1==0
39 39
40 40 def enumerate(obj):
41 41 i = -1
42 42 for item in obj:
43 43 i += 1
44 44 yield i, item
45 45
46 46 # add these to the builtin namespace, so that all modules find them
47 47 import __builtin__
48 48 __builtin__.basestring = basestring
49 49 __builtin__.True = True
50 50 __builtin__.False = False
51 51 __builtin__.enumerate = enumerate
52 52
53 53 #****************************************************************************
54 54 # Exceptions
55 55 class Error(Exception):
56 56 """Base class for exceptions in this module."""
57 57 pass
58 58
59 59 #----------------------------------------------------------------------------
60 60 class IOStream:
61 61 def __init__(self,stream,fallback):
62 62 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
63 63 stream = fallback
64 64 self.stream = stream
65 65 self._swrite = stream.write
66 66 self.flush = stream.flush
67 67
68 68 def write(self,data):
69 69 try:
70 70 self._swrite(data)
71 71 except:
72 72 try:
73 73 # print handles some unicode issues which may trip a plain
74 74 # write() call. Attempt to emulate write() by using a
75 75 # trailing comma
76 76 print >> self.stream, data,
77 77 except:
78 78 # if we get here, something is seriously broken.
79 79 print >> sys.stderr, \
80 80 'ERROR - failed to write data to stream:', stream
81 81
82 82 class IOTerm:
83 83 """ Term holds the file or file-like objects for handling I/O operations.
84 84
85 85 These are normally just sys.stdin, sys.stdout and sys.stderr but for
86 86 Windows they can can replaced to allow editing the strings before they are
87 87 displayed."""
88 88
89 89 # In the future, having IPython channel all its I/O operations through
90 90 # this class will make it easier to embed it into other environments which
91 91 # are not a normal terminal (such as a GUI-based shell)
92 92 def __init__(self,cin=None,cout=None,cerr=None):
93 93 self.cin = IOStream(cin,sys.stdin)
94 94 self.cout = IOStream(cout,sys.stdout)
95 95 self.cerr = IOStream(cerr,sys.stderr)
96 96
97 97 # Global variable to be used for all I/O
98 98 Term = IOTerm()
99 99
100 100 # Windows-specific code to load Gary Bishop's readline and configure it
101 101 # automatically for the users
102 102 # Note: os.name on cygwin returns posix, so this should only pick up 'native'
103 103 # windows. Cygwin returns 'cygwin' for sys.platform.
104 104 if os.name == 'nt':
105 105 try:
106 106 import readline
107 107 except ImportError:
108 108 pass
109 109 else:
110 110 try:
111 111 _out = readline.GetOutputFile()
112 112 except AttributeError:
113 113 pass
114 114 else:
115 115 # Remake Term to use the readline i/o facilities
116 116 Term = IOTerm(cout=_out,cerr=_out)
117 117 del _out
118 118
119 119 #****************************************************************************
120 120 # Generic warning/error printer, used by everything else
121 121 def warn(msg,level=2,exit_val=1):
122 122 """Standard warning printer. Gives formatting consistency.
123 123
124 124 Output is sent to Term.cerr (sys.stderr by default).
125 125
126 126 Options:
127 127
128 128 -level(2): allows finer control:
129 129 0 -> Do nothing, dummy function.
130 130 1 -> Print message.
131 131 2 -> Print 'WARNING:' + message. (Default level).
132 132 3 -> Print 'ERROR:' + message.
133 133 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
134 134
135 135 -exit_val (1): exit value returned by sys.exit() for a level 4
136 136 warning. Ignored for all other levels."""
137 137
138 138 if level>0:
139 139 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
140 140 print >> Term.cerr, '%s%s' % (header[level],msg)
141 141 if level == 4:
142 142 print >> Term.cerr,'Exiting.\n'
143 143 sys.exit(exit_val)
144 144
145 145 def info(msg):
146 146 """Equivalent to warn(msg,level=1)."""
147 147
148 148 warn(msg,level=1)
149 149
150 150 def error(msg):
151 151 """Equivalent to warn(msg,level=3)."""
152 152
153 153 warn(msg,level=3)
154 154
155 155 def fatal(msg,exit_val=1):
156 156 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
157 157
158 158 warn(msg,exit_val=exit_val,level=4)
159 159
160 160 #----------------------------------------------------------------------------
161 161 StringTypes = types.StringTypes
162 162
163 163 # Basic timing functionality
164 164
165 165 # If possible (Unix), use the resource module instead of time.clock()
166 166 try:
167 167 import resource
168 168 def clock():
169 169 """clock() -> floating point number
170 170
171 171 Return the CPU time in seconds (user time only, system time is
172 172 ignored) since the start of the process. This is done via a call to
173 173 resource.getrusage, so it avoids the wraparound problems in
174 174 time.clock()."""
175 175
176 176 return resource.getrusage(resource.RUSAGE_SELF)[0]
177 177
178 178 def clock2():
179 179 """clock2() -> (t_user,t_system)
180 180
181 181 Similar to clock(), but return a tuple of user/system times."""
182 182 return resource.getrusage(resource.RUSAGE_SELF)[:2]
183 183
184 184 except ImportError:
185 185 clock = time.clock
186 186 def clock2():
187 187 """Under windows, system CPU time can't be measured.
188 188
189 189 This just returns clock() and zero."""
190 190 return time.clock(),0.0
191 191
192 192 def timings_out(reps,func,*args,**kw):
193 193 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
194 194
195 195 Execute a function reps times, return a tuple with the elapsed total
196 196 CPU time in seconds, the time per call and the function's output.
197 197
198 198 Under Unix, the return value is the sum of user+system time consumed by
199 199 the process, computed via the resource module. This prevents problems
200 200 related to the wraparound effect which the time.clock() function has.
201 201
202 202 Under Windows the return value is in wall clock seconds. See the
203 203 documentation for the time module for more details."""
204 204
205 205 reps = int(reps)
206 206 assert reps >=1, 'reps must be >= 1'
207 207 if reps==1:
208 208 start = clock()
209 209 out = func(*args,**kw)
210 210 tot_time = clock()-start
211 211 else:
212 212 rng = xrange(reps-1) # the last time is executed separately to store output
213 213 start = clock()
214 214 for dummy in rng: func(*args,**kw)
215 215 out = func(*args,**kw) # one last time
216 216 tot_time = clock()-start
217 217 av_time = tot_time / reps
218 218 return tot_time,av_time,out
219 219
220 220 def timings(reps,func,*args,**kw):
221 221 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
222 222
223 223 Execute a function reps times, return a tuple with the elapsed total CPU
224 224 time in seconds and the time per call. These are just the first two values
225 225 in timings_out()."""
226 226
227 227 return timings_out(reps,func,*args,**kw)[0:2]
228 228
229 229 def timing(func,*args,**kw):
230 230 """timing(func,*args,**kw) -> t_total
231 231
232 232 Execute a function once, return the elapsed total CPU time in
233 233 seconds. This is just the first value in timings_out()."""
234 234
235 235 return timings_out(1,func,*args,**kw)[0]
236 236
237 237 #****************************************************************************
238 238 # file and system
239 239
240 240 def system(cmd,verbose=0,debug=0,header=''):
241 241 """Execute a system command, return its exit status.
242 242
243 243 Options:
244 244
245 245 - verbose (0): print the command to be executed.
246 246
247 247 - debug (0): only print, do not actually execute.
248 248
249 249 - header (''): Header to print on screen prior to the executed command (it
250 250 is only prepended to the command, no newlines are added).
251 251
252 252 Note: a stateful version of this function is available through the
253 253 SystemExec class."""
254 254
255 255 stat = 0
256 256 if verbose or debug: print header+cmd
257 257 sys.stdout.flush()
258 258 if not debug: stat = os.system(cmd)
259 259 return stat
260 260
261 261 def shell(cmd,verbose=0,debug=0,header=''):
262 262 """Execute a command in the system shell, always return None.
263 263
264 264 Options:
265 265
266 266 - verbose (0): print the command to be executed.
267 267
268 268 - debug (0): only print, do not actually execute.
269 269
270 270 - header (''): Header to print on screen prior to the executed command (it
271 271 is only prepended to the command, no newlines are added).
272 272
273 273 Note: this is similar to genutils.system(), but it returns None so it can
274 274 be conveniently used in interactive loops without getting the return value
275 275 (typically 0) printed many times."""
276 276
277 277 stat = 0
278 278 if verbose or debug: print header+cmd
279 279 # flush stdout so we don't mangle python's buffering
280 280 sys.stdout.flush()
281 281 if not debug:
282 282 os.system(cmd)
283 283
284 284 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
285 285 """Dummy substitute for perl's backquotes.
286 286
287 287 Executes a command and returns the output.
288 288
289 289 Accepts the same arguments as system(), plus:
290 290
291 291 - split(0): if true, the output is returned as a list split on newlines.
292 292
293 293 Note: a stateful version of this function is available through the
294 294 SystemExec class."""
295 295
296 296 if verbose or debug: print header+cmd
297 297 if not debug:
298 298 output = commands.getoutput(cmd)
299 299 if split:
300 300 return output.split('\n')
301 301 else:
302 302 return output
303 303
304 304 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
305 305 """Return (standard output,standard error) of executing cmd in a shell.
306 306
307 307 Accepts the same arguments as system(), plus:
308 308
309 309 - split(0): if true, each of stdout/err is returned as a list split on
310 310 newlines.
311 311
312 312 Note: a stateful version of this function is available through the
313 313 SystemExec class."""
314 314
315 315 if verbose or debug: print header+cmd
316 316 if not cmd:
317 317 if split:
318 318 return [],[]
319 319 else:
320 320 return '',''
321 321 if not debug:
322 322 pin,pout,perr = os.popen3(cmd)
323 323 tout = pout.read().rstrip()
324 324 terr = perr.read().rstrip()
325 325 pin.close()
326 326 pout.close()
327 327 perr.close()
328 328 if split:
329 329 return tout.split('\n'),terr.split('\n')
330 330 else:
331 331 return tout,terr
332 332
333 333 # for compatibility with older naming conventions
334 334 xsys = system
335 335 bq = getoutput
336 336
337 337 class SystemExec:
338 338 """Access the system and getoutput functions through a stateful interface.
339 339
340 340 Note: here we refer to the system and getoutput functions from this
341 341 library, not the ones from the standard python library.
342 342
343 343 This class offers the system and getoutput functions as methods, but the
344 344 verbose, debug and header parameters can be set for the instance (at
345 345 creation time or later) so that they don't need to be specified on each
346 346 call.
347 347
348 348 For efficiency reasons, there's no way to override the parameters on a
349 349 per-call basis other than by setting instance attributes. If you need
350 350 local overrides, it's best to directly call system() or getoutput().
351 351
352 352 The following names are provided as alternate options:
353 353 - xsys: alias to system
354 354 - bq: alias to getoutput
355 355
356 356 An instance can then be created as:
357 357 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
358 358
359 359 And used as:
360 360 >>> sysexec.xsys('pwd')
361 361 >>> dirlist = sysexec.bq('ls -l')
362 362 """
363 363
364 364 def __init__(self,verbose=0,debug=0,header='',split=0):
365 365 """Specify the instance's values for verbose, debug and header."""
366 366 setattr_list(self,'verbose debug header split')
367 367
368 368 def system(self,cmd):
369 369 """Stateful interface to system(), with the same keyword parameters."""
370 370
371 371 system(cmd,self.verbose,self.debug,self.header)
372 372
373 373 def shell(self,cmd):
374 374 """Stateful interface to shell(), with the same keyword parameters."""
375 375
376 376 shell(cmd,self.verbose,self.debug,self.header)
377 377
378 378 xsys = system # alias
379 379
380 380 def getoutput(self,cmd):
381 381 """Stateful interface to getoutput()."""
382 382
383 383 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
384 384
385 385 def getoutputerror(self,cmd):
386 386 """Stateful interface to getoutputerror()."""
387 387
388 388 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
389 389
390 390 bq = getoutput # alias
391 391
392 392 #-----------------------------------------------------------------------------
393 393 def mutex_opts(dict,ex_op):
394 394 """Check for presence of mutually exclusive keys in a dict.
395 395
396 396 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
397 397 for op1,op2 in ex_op:
398 398 if op1 in dict and op2 in dict:
399 399 raise ValueError,'\n*** ERROR in Arguments *** '\
400 400 'Options '+op1+' and '+op2+' are mutually exclusive.'
401 401
402 402 #-----------------------------------------------------------------------------
403 403 def filefind(fname,alt_dirs = None):
404 404 """Return the given filename either in the current directory, if it
405 405 exists, or in a specified list of directories.
406 406
407 407 ~ expansion is done on all file and directory names.
408 408
409 409 Upon an unsuccessful search, raise an IOError exception."""
410 410
411 411 if alt_dirs is None:
412 412 try:
413 413 alt_dirs = get_home_dir()
414 414 except HomeDirError:
415 415 alt_dirs = os.getcwd()
416 416 search = [fname] + list_strings(alt_dirs)
417 417 search = map(os.path.expanduser,search)
418 418 #print 'search list for',fname,'list:',search # dbg
419 419 fname = search[0]
420 420 if os.path.isfile(fname):
421 421 return fname
422 422 for direc in search[1:]:
423 423 testname = os.path.join(direc,fname)
424 424 #print 'testname',testname # dbg
425 425 if os.path.isfile(testname):
426 426 return testname
427 427 raise IOError,'File' + `fname` + \
428 428 ' not found in current or supplied directories:' + `alt_dirs`
429 429
430 430 #----------------------------------------------------------------------------
431 431 def target_outdated(target,deps):
432 432 """Determine whether a target is out of date.
433 433
434 434 target_outdated(target,deps) -> 1/0
435 435
436 436 deps: list of filenames which MUST exist.
437 437 target: single filename which may or may not exist.
438 438
439 439 If target doesn't exist or is older than any file listed in deps, return
440 440 true, otherwise return false.
441 441 """
442 442 try:
443 443 target_time = os.path.getmtime(target)
444 444 except os.error:
445 445 return 1
446 446 for dep in deps:
447 447 dep_time = os.path.getmtime(dep)
448 448 if dep_time > target_time:
449 449 #print "For target",target,"Dep failed:",dep # dbg
450 450 #print "times (dep,tar):",dep_time,target_time # dbg
451 451 return 1
452 452 return 0
453 453
454 454 #-----------------------------------------------------------------------------
455 455 def target_update(target,deps,cmd):
456 456 """Update a target with a given command given a list of dependencies.
457 457
458 458 target_update(target,deps,cmd) -> runs cmd if target is outdated.
459 459
460 460 This is just a wrapper around target_outdated() which calls the given
461 461 command if target is outdated."""
462 462
463 463 if target_outdated(target,deps):
464 464 xsys(cmd)
465 465
466 466 #----------------------------------------------------------------------------
467 467 def unquote_ends(istr):
468 468 """Remove a single pair of quotes from the endpoints of a string."""
469 469
470 470 if not istr:
471 471 return istr
472 472 if (istr[0]=="'" and istr[-1]=="'") or \
473 473 (istr[0]=='"' and istr[-1]=='"'):
474 474 return istr[1:-1]
475 475 else:
476 476 return istr
477 477
478 478 #----------------------------------------------------------------------------
479 479 def process_cmdline(argv,names=[],defaults={},usage=''):
480 480 """ Process command-line options and arguments.
481 481
482 482 Arguments:
483 483
484 484 - argv: list of arguments, typically sys.argv.
485 485
486 486 - names: list of option names. See DPyGetOpt docs for details on options
487 487 syntax.
488 488
489 489 - defaults: dict of default values.
490 490
491 491 - usage: optional usage notice to print if a wrong argument is passed.
492 492
493 493 Return a dict of options and a list of free arguments."""
494 494
495 495 getopt = DPyGetOpt.DPyGetOpt()
496 496 getopt.setIgnoreCase(0)
497 497 getopt.parseConfiguration(names)
498 498
499 499 try:
500 500 getopt.processArguments(argv)
501 501 except:
502 502 print usage
503 503 warn(`sys.exc_value`,level=4)
504 504
505 505 defaults.update(getopt.optionValues)
506 506 args = getopt.freeValues
507 507
508 508 return defaults,args
509 509
510 510 #----------------------------------------------------------------------------
511 511 def optstr2types(ostr):
512 512 """Convert a string of option names to a dict of type mappings.
513 513
514 514 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
515 515
516 516 This is used to get the types of all the options in a string formatted
517 517 with the conventions of DPyGetOpt. The 'type' None is used for options
518 518 which are strings (they need no further conversion). This function's main
519 519 use is to get a typemap for use with read_dict().
520 520 """
521 521
522 522 typeconv = {None:'',int:'',float:''}
523 523 typemap = {'s':None,'i':int,'f':float}
524 524 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
525 525
526 526 for w in ostr.split():
527 527 oname,alias,otype = opt_re.match(w).groups()
528 528 if otype == '' or alias == '!': # simple switches are integers too
529 529 otype = 'i'
530 530 typeconv[typemap[otype]] += oname + ' '
531 531 return typeconv
532 532
533 533 #----------------------------------------------------------------------------
534 534 def read_dict(filename,type_conv=None,**opt):
535 535
536 536 """Read a dictionary of key=value pairs from an input file, optionally
537 537 performing conversions on the resulting values.
538 538
539 539 read_dict(filename,type_conv,**opt) -> dict
540 540
541 541 Only one value per line is accepted, the format should be
542 542 # optional comments are ignored
543 543 key value\n
544 544
545 545 Args:
546 546
547 547 - type_conv: A dictionary specifying which keys need to be converted to
548 548 which types. By default all keys are read as strings. This dictionary
549 549 should have as its keys valid conversion functions for strings
550 550 (int,long,float,complex, or your own). The value for each key
551 551 (converter) should be a whitespace separated string containing the names
552 552 of all the entries in the file to be converted using that function. For
553 553 keys to be left alone, use None as the conversion function (only needed
554 554 with purge=1, see below).
555 555
556 556 - opt: dictionary with extra options as below (default in parens)
557 557
558 558 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
559 559 of the dictionary to be returned. If purge is going to be used, the
560 560 set of keys to be left as strings also has to be explicitly specified
561 561 using the (non-existent) conversion function None.
562 562
563 563 fs(None): field separator. This is the key/value separator to be used
564 564 when parsing the file. The None default means any whitespace [behavior
565 565 of string.split()].
566 566
567 567 strip(0): if 1, strip string values of leading/trailinig whitespace.
568 568
569 569 warn(1): warning level if requested keys are not found in file.
570 570 - 0: silently ignore.
571 571 - 1: inform but proceed.
572 572 - 2: raise KeyError exception.
573 573
574 574 no_empty(0): if 1, remove keys with whitespace strings as a value.
575 575
576 576 unique([]): list of keys (or space separated string) which can't be
577 577 repeated. If one such key is found in the file, each new instance
578 578 overwrites the previous one. For keys not listed here, the behavior is
579 579 to make a list of all appearances.
580 580
581 581 Example:
582 582 If the input file test.ini has:
583 583 i 3
584 584 x 4.5
585 585 y 5.5
586 586 s hi ho
587 587 Then:
588 588
589 589 >>> type_conv={int:'i',float:'x',None:'s'}
590 590 >>> read_dict('test.ini')
591 591 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
592 592 >>> read_dict('test.ini',type_conv)
593 593 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
594 594 >>> read_dict('test.ini',type_conv,purge=1)
595 595 {'i': 3, 's': 'hi ho', 'x': 4.5}
596 596 """
597 597
598 598 # starting config
599 599 opt.setdefault('purge',0)
600 600 opt.setdefault('fs',None) # field sep defaults to any whitespace
601 601 opt.setdefault('strip',0)
602 602 opt.setdefault('warn',1)
603 603 opt.setdefault('no_empty',0)
604 604 opt.setdefault('unique','')
605 605 if type(opt['unique']) in StringTypes:
606 606 unique_keys = qw(opt['unique'])
607 607 elif type(opt['unique']) in (types.TupleType,types.ListType):
608 608 unique_keys = opt['unique']
609 609 else:
610 610 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
611 611
612 612 dict = {}
613 613 # first read in table of values as strings
614 614 file = open(filename,'r')
615 615 for line in file.readlines():
616 616 line = line.strip()
617 617 if len(line) and line[0]=='#': continue
618 618 if len(line)>0:
619 619 lsplit = line.split(opt['fs'],1)
620 620 try:
621 621 key,val = lsplit
622 622 except ValueError:
623 623 key,val = lsplit[0],''
624 624 key = key.strip()
625 625 if opt['strip']: val = val.strip()
626 626 if val == "''" or val == '""': val = ''
627 627 if opt['no_empty'] and (val=='' or val.isspace()):
628 628 continue
629 629 # if a key is found more than once in the file, build a list
630 630 # unless it's in the 'unique' list. In that case, last found in file
631 631 # takes precedence. User beware.
632 632 try:
633 633 if dict[key] and key in unique_keys:
634 634 dict[key] = val
635 635 elif type(dict[key]) is types.ListType:
636 636 dict[key].append(val)
637 637 else:
638 638 dict[key] = [dict[key],val]
639 639 except KeyError:
640 640 dict[key] = val
641 641 # purge if requested
642 642 if opt['purge']:
643 643 accepted_keys = qwflat(type_conv.values())
644 644 for key in dict.keys():
645 645 if key in accepted_keys: continue
646 646 del(dict[key])
647 647 # now convert if requested
648 648 if type_conv==None: return dict
649 649 conversions = type_conv.keys()
650 650 try: conversions.remove(None)
651 651 except: pass
652 652 for convert in conversions:
653 653 for val in qw(type_conv[convert]):
654 654 try:
655 655 dict[val] = convert(dict[val])
656 656 except KeyError,e:
657 657 if opt['warn'] == 0:
658 658 pass
659 659 elif opt['warn'] == 1:
660 660 print >>sys.stderr, 'Warning: key',val,\
661 661 'not found in file',filename
662 662 elif opt['warn'] == 2:
663 663 raise KeyError,e
664 664 else:
665 665 raise ValueError,'Warning level must be 0,1 or 2'
666 666
667 667 return dict
668 668
669 669 #----------------------------------------------------------------------------
670 670 def flag_calls(func):
671 671 """Wrap a function to detect and flag when it gets called.
672 672
673 673 This is a decorator which takes a function and wraps it in a function with
674 674 a 'called' attribute. wrapper.called is initialized to False.
675 675
676 676 The wrapper.called attribute is set to False right before each call to the
677 677 wrapped function, so if the call fails it remains False. After the call
678 678 completes, wrapper.called is set to True and the output is returned.
679 679
680 680 Testing for truth in wrapper.called allows you to determine if a call to
681 681 func() was attempted and succeeded."""
682 682
683 683 def wrapper(*args,**kw):
684 684 wrapper.called = False
685 685 out = func(*args,**kw)
686 686 wrapper.called = True
687 687 return out
688 688
689 689 wrapper.called = False
690 690 wrapper.__doc__ = func.__doc__
691 691 return wrapper
692 692
693 693 #----------------------------------------------------------------------------
694 694 class HomeDirError(Error):
695 695 pass
696 696
697 697 def get_home_dir():
698 698 """Return the closest possible equivalent to a 'home' directory.
699 699
700 700 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
701 701
702 702 Currently only Posix and NT are implemented, a HomeDirError exception is
703 703 raised for all other OSes. """
704 704
705 isdir = os.path.isdir
706 env = os.environ
705 707 try:
706 return os.environ['HOME']
708 homedir = env['HOME']
709 if not isdir(homedir):
710 # in case a user stuck some string which does NOT resolve to a
711 # valid path, it's as good as if we hadn't foud it
712 raise KeyError
713 return homedir
707 714 except KeyError:
708 715 if os.name == 'posix':
709 716 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
710 717 elif os.name == 'nt':
711 718 # For some strange reason, win9x returns 'nt' for os.name.
712 719 try:
713 return os.path.join(os.environ['HOMEDRIVE'],os.environ['HOMEPATH'])
720 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
721 if not isdir(homedir):
722 homedir = os.path.join(env['USERPROFILE'])
723 if not isdir(homedir):
724 raise HomeDirError
725 return homedir
714 726 except:
715 727 try:
716 728 # Use the registry to get the 'My Documents' folder.
717 729 import _winreg as wreg
718 730 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
719 731 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
720 732 homedir = wreg.QueryValueEx(key,'Personal')[0]
721 733 key.Close()
722 734 return homedir
723 735 except:
724 736 return 'C:\\'
725 737 elif os.name == 'dos':
726 738 # Desperate, may do absurd things in classic MacOS. May work under DOS.
727 739 return 'C:\\'
728 740 else:
729 741 raise HomeDirError,'support for your operating system not implemented.'
730 742
731 743 #****************************************************************************
732 744 # strings and text
733 745
734 746 class LSString(str):
735 747 """String derivative with a special access attributes.
736 748
737 749 These are normal strings, but with the special attributes:
738 750
739 751 .l (or .list) : value as list (split on newlines).
740 752 .n (or .nlstr): original value (the string itself).
741 753 .s (or .spstr): value as whitespace-separated string.
742 754
743 755 Any values which require transformations are computed only once and
744 756 cached.
745 757
746 758 Such strings are very useful to efficiently interact with the shell, which
747 759 typically only understands whitespace-separated options for commands."""
748 760
749 761 def get_list(self):
750 762 try:
751 763 return self.__list
752 764 except AttributeError:
753 765 self.__list = self.split('\n')
754 766 return self.__list
755 767
756 768 l = list = property(get_list)
757 769
758 770 def get_spstr(self):
759 771 try:
760 772 return self.__spstr
761 773 except AttributeError:
762 774 self.__spstr = self.replace('\n',' ')
763 775 return self.__spstr
764 776
765 777 s = spstr = property(get_spstr)
766 778
767 779 def get_nlstr(self):
768 780 return self
769 781
770 782 n = nlstr = property(get_nlstr)
771 783
772 784 class SList(list):
773 785 """List derivative with a special access attributes.
774 786
775 787 These are normal lists, but with the special attributes:
776 788
777 789 .l (or .list) : value as list (the list itself).
778 790 .n (or .nlstr): value as a string, joined on newlines.
779 791 .s (or .spstr): value as a string, joined on spaces.
780 792
781 793 Any values which require transformations are computed only once and
782 794 cached."""
783 795
784 796 def get_list(self):
785 797 return self
786 798
787 799 l = list = property(get_list)
788 800
789 801 def get_spstr(self):
790 802 try:
791 803 return self.__spstr
792 804 except AttributeError:
793 805 self.__spstr = ' '.join(self)
794 806 return self.__spstr
795 807
796 808 s = spstr = property(get_spstr)
797 809
798 810 def get_nlstr(self):
799 811 try:
800 812 return self.__nlstr
801 813 except AttributeError:
802 814 self.__nlstr = '\n'.join(self)
803 815 return self.__nlstr
804 816
805 817 n = nlstr = property(get_nlstr)
806 818
807 819 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
808 820 """Take multiple lines of input.
809 821
810 822 A list with each line of input as a separate element is returned when a
811 823 termination string is entered (defaults to a single '.'). Input can also
812 824 terminate via EOF (^D in Unix, ^Z-RET in Windows).
813 825
814 826 Lines of input which end in \\ are joined into single entries (and a
815 827 secondary continuation prompt is issued as long as the user terminates
816 828 lines with \\). This allows entering very long strings which are still
817 829 meant to be treated as single entities.
818 830 """
819 831
820 832 try:
821 833 if header:
822 834 header += '\n'
823 835 lines = [raw_input(header + ps1)]
824 836 except EOFError:
825 837 return []
826 838 terminate = [terminate_str]
827 839 try:
828 840 while lines[-1:] != terminate:
829 841 new_line = raw_input(ps1)
830 842 while new_line.endswith('\\'):
831 843 new_line = new_line[:-1] + raw_input(ps2)
832 844 lines.append(new_line)
833 845
834 846 return lines[:-1] # don't return the termination command
835 847 except EOFError:
836 848 print
837 849 return lines
838 850
839 851 #----------------------------------------------------------------------------
840 852 def raw_input_ext(prompt='', ps2='... '):
841 853 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
842 854
843 855 line = raw_input(prompt)
844 856 while line.endswith('\\'):
845 857 line = line[:-1] + raw_input(ps2)
846 858 return line
847 859
848 860 #----------------------------------------------------------------------------
849 861 def ask_yes_no(prompt,default=None):
850 862 """Asks a question and returns an integer 1/0 (y/n) answer.
851 863
852 864 If default is given (one of 'y','n'), it is used if the user input is
853 865 empty. Otherwise the question is repeated until an answer is given.
854 866 If EOF occurs 20 times consecutively, the default answer is assumed,
855 867 or if there is no default, an exception is raised to prevent infinite
856 868 loops.
857 869
858 870 Valid answers are: y/yes/n/no (match is not case sensitive)."""
859 871
860 872 answers = {'y':1,'n':0,'yes':1,'no':0}
861 873 ans = None
862 874 eofs, max_eofs = 0, 20
863 875 while ans not in answers.keys():
864 876 try:
865 877 ans = raw_input(prompt+' ').lower()
866 878 if not ans: # response was an empty string
867 879 ans = default
868 880 eofs = 0
869 881 except (EOFError,KeyboardInterrupt):
870 882 eofs = eofs + 1
871 883 if eofs >= max_eofs:
872 884 if default in answers.keys():
873 885 ans = default
874 886 else:
875 887 raise
876 888
877 889 return answers[ans]
878 890
879 891 #----------------------------------------------------------------------------
880 892 class EvalDict:
881 893 """
882 894 Emulate a dict which evaluates its contents in the caller's frame.
883 895
884 896 Usage:
885 897 >>>number = 19
886 898 >>>text = "python"
887 899 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
888 900 """
889 901
890 902 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
891 903 # modified (shorter) version of:
892 904 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
893 905 # Skip Montanaro (skip@pobox.com).
894 906
895 907 def __getitem__(self, name):
896 908 frame = sys._getframe(1)
897 909 return eval(name, frame.f_globals, frame.f_locals)
898 910
899 911 EvalString = EvalDict # for backwards compatibility
900 912 #----------------------------------------------------------------------------
901 913 def qw(words,flat=0,sep=None,maxsplit=-1):
902 914 """Similar to Perl's qw() operator, but with some more options.
903 915
904 916 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
905 917
906 918 words can also be a list itself, and with flat=1, the output will be
907 919 recursively flattened. Examples:
908 920
909 921 >>> qw('1 2')
910 922 ['1', '2']
911 923 >>> qw(['a b','1 2',['m n','p q']])
912 924 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
913 925 >>> qw(['a b','1 2',['m n','p q']],flat=1)
914 926 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
915 927
916 928 if type(words) in StringTypes:
917 929 return [word.strip() for word in words.split(sep,maxsplit)
918 930 if word and not word.isspace() ]
919 931 if flat:
920 932 return flatten(map(qw,words,[1]*len(words)))
921 933 return map(qw,words)
922 934
923 935 #----------------------------------------------------------------------------
924 936 def qwflat(words,sep=None,maxsplit=-1):
925 937 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
926 938 return qw(words,1,sep,maxsplit)
927 939
928 940 #-----------------------------------------------------------------------------
929 941 def list_strings(arg):
930 942 """Always return a list of strings, given a string or list of strings
931 943 as input."""
932 944
933 945 if type(arg) in StringTypes: return [arg]
934 946 else: return arg
935 947
936 948 #----------------------------------------------------------------------------
937 949 def grep(pat,list,case=1):
938 950 """Simple minded grep-like function.
939 951 grep(pat,list) returns occurrences of pat in list, None on failure.
940 952
941 953 It only does simple string matching, with no support for regexps. Use the
942 954 option case=0 for case-insensitive matching."""
943 955
944 956 # This is pretty crude. At least it should implement copying only references
945 957 # to the original data in case it's big. Now it copies the data for output.
946 958 out=[]
947 959 if case:
948 960 for term in list:
949 961 if term.find(pat)>-1: out.append(term)
950 962 else:
951 963 lpat=pat.lower()
952 964 for term in list:
953 965 if term.lower().find(lpat)>-1: out.append(term)
954 966
955 967 if len(out): return out
956 968 else: return None
957 969
958 970 #----------------------------------------------------------------------------
959 971 def dgrep(pat,*opts):
960 972 """Return grep() on dir()+dir(__builtins__).
961 973
962 974 A very common use of grep() when working interactively."""
963 975
964 976 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
965 977
966 978 #----------------------------------------------------------------------------
967 979 def idgrep(pat):
968 980 """Case-insensitive dgrep()"""
969 981
970 982 return dgrep(pat,0)
971 983
972 984 #----------------------------------------------------------------------------
973 985 def igrep(pat,list):
974 986 """Synonym for case-insensitive grep."""
975 987
976 988 return grep(pat,list,case=0)
977 989
978 990 #----------------------------------------------------------------------------
979 991 def indent(str,nspaces=4,ntabs=0):
980 992 """Indent a string a given number of spaces or tabstops.
981 993
982 994 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
983 995 """
984 996 if str is None:
985 997 return
986 998 ind = '\t'*ntabs+' '*nspaces
987 999 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
988 1000 if outstr.endswith(os.linesep+ind):
989 1001 return outstr[:-len(ind)]
990 1002 else:
991 1003 return outstr
992 1004
993 1005 #-----------------------------------------------------------------------------
994 1006 def native_line_ends(filename,backup=1):
995 1007 """Convert (in-place) a file to line-ends native to the current OS.
996 1008
997 1009 If the optional backup argument is given as false, no backup of the
998 1010 original file is left. """
999 1011
1000 1012 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1001 1013
1002 1014 bak_filename = filename + backup_suffixes[os.name]
1003 1015
1004 1016 original = open(filename).read()
1005 1017 shutil.copy2(filename,bak_filename)
1006 1018 try:
1007 1019 new = open(filename,'wb')
1008 1020 new.write(os.linesep.join(original.splitlines()))
1009 1021 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1010 1022 new.close()
1011 1023 except:
1012 1024 os.rename(bak_filename,filename)
1013 1025 if not backup:
1014 1026 try:
1015 1027 os.remove(bak_filename)
1016 1028 except:
1017 1029 pass
1018 1030
1019 1031 #----------------------------------------------------------------------------
1020 1032 def get_pager_cmd(pager_cmd = None):
1021 1033 """Return a pager command.
1022 1034
1023 1035 Makes some attempts at finding an OS-correct one."""
1024 1036
1025 1037 if os.name == 'posix':
1026 1038 default_pager_cmd = 'less -r' # -r for color control sequences
1027 1039 elif os.name in ['nt','dos']:
1028 1040 default_pager_cmd = 'type'
1029 1041
1030 1042 if pager_cmd is None:
1031 1043 try:
1032 1044 pager_cmd = os.environ['PAGER']
1033 1045 except:
1034 1046 pager_cmd = default_pager_cmd
1035 1047 return pager_cmd
1036 1048
1037 1049 #-----------------------------------------------------------------------------
1038 1050 def get_pager_start(pager,start):
1039 1051 """Return the string for paging files with an offset.
1040 1052
1041 1053 This is the '+N' argument which less and more (under Unix) accept.
1042 1054 """
1043 1055
1044 1056 if pager in ['less','more']:
1045 1057 if start:
1046 1058 start_string = '+' + str(start)
1047 1059 else:
1048 1060 start_string = ''
1049 1061 else:
1050 1062 start_string = ''
1051 1063 return start_string
1052 1064
1053 1065 #----------------------------------------------------------------------------
1054 1066 def page_dumb(strng,start=0,screen_lines=25):
1055 1067 """Very dumb 'pager' in Python, for when nothing else works.
1056 1068
1057 1069 Only moves forward, same interface as page(), except for pager_cmd and
1058 1070 mode."""
1059 1071
1060 1072 out_ln = strng.splitlines()[start:]
1061 1073 screens = chop(out_ln,screen_lines-1)
1062 1074 if len(screens) == 1:
1063 1075 print >>Term.cout, os.linesep.join(screens[0])
1064 1076 else:
1065 1077 for scr in screens[0:-1]:
1066 1078 print >>Term.cout, os.linesep.join(scr)
1067 1079 ans = raw_input('---Return to continue, q to quit--- ')
1068 1080 if ans.lower().startswith('q'):
1069 1081 return
1070 1082 print >>Term.cout, os.linesep.join(screens[-1])
1071 1083
1072 1084 #----------------------------------------------------------------------------
1073 1085 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1074 1086 """Print a string, piping through a pager after a certain length.
1075 1087
1076 1088 The screen_lines parameter specifies the number of *usable* lines of your
1077 1089 terminal screen (total lines minus lines you need to reserve to show other
1078 1090 information).
1079 1091
1080 1092 If you set screen_lines to a number <=0, page() will try to auto-determine
1081 1093 your screen size and will only use up to (screen_size+screen_lines) for
1082 1094 printing, paging after that. That is, if you want auto-detection but need
1083 1095 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1084 1096 auto-detection without any lines reserved simply use screen_lines = 0.
1085 1097
1086 1098 If a string won't fit in the allowed lines, it is sent through the
1087 1099 specified pager command. If none given, look for PAGER in the environment,
1088 1100 and ultimately default to less.
1089 1101
1090 1102 If no system pager works, the string is sent through a 'dumb pager'
1091 1103 written in python, very simplistic.
1092 1104 """
1093 1105
1094 1106 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1095 1107 TERM = os.environ.get('TERM','dumb')
1096 1108 if TERM in ['dumb','emacs'] and os.name != 'nt':
1097 1109 print strng
1098 1110 return
1099 1111 # chop off the topmost part of the string we don't want to see
1100 1112 str_lines = strng.split(os.linesep)[start:]
1101 1113 str_toprint = os.linesep.join(str_lines)
1102 1114 num_newlines = len(str_lines)
1103 1115 len_str = len(str_toprint)
1104 1116
1105 1117 # Dumb heuristics to guesstimate number of on-screen lines the string
1106 1118 # takes. Very basic, but good enough for docstrings in reasonable
1107 1119 # terminals. If someone later feels like refining it, it's not hard.
1108 1120 numlines = max(num_newlines,int(len_str/80)+1)
1109 1121
1110 1122 screen_lines_def = 25 # default value if we can't auto-determine
1111 1123
1112 1124 # auto-determine screen size
1113 1125 if screen_lines <= 0:
1114 1126 if TERM=='xterm':
1115 1127 try:
1116 1128 import curses
1117 1129 if hasattr(curses,'initscr'):
1118 1130 use_curses = 1
1119 1131 else:
1120 1132 use_curses = 0
1121 1133 except ImportError:
1122 1134 use_curses = 0
1123 1135 else:
1124 1136 # curses causes problems on many terminals other than xterm.
1125 1137 use_curses = 0
1126 1138 if use_curses:
1127 1139 scr = curses.initscr()
1128 1140 screen_lines_real,screen_cols = scr.getmaxyx()
1129 1141 curses.endwin()
1130 1142 screen_lines += screen_lines_real
1131 1143 #print '***Screen size:',screen_lines_real,'lines x',\
1132 1144 #screen_cols,'columns.' # dbg
1133 1145 else:
1134 1146 screen_lines += screen_lines_def
1135 1147
1136 1148 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1137 1149 if numlines <= screen_lines :
1138 1150 #print '*** normal print' # dbg
1139 1151 print >>Term.cout, str_toprint
1140 1152 else:
1141 1153 # Try to open pager and default to internal one if that fails.
1142 1154 # All failure modes are tagged as 'retval=1', to match the return
1143 1155 # value of a failed system command. If any intermediate attempt
1144 1156 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1145 1157 pager_cmd = get_pager_cmd(pager_cmd)
1146 1158 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1147 1159 if os.name == 'nt':
1148 1160 if pager_cmd.startswith('type'):
1149 1161 # The default WinXP 'type' command is failing on complex strings.
1150 1162 retval = 1
1151 1163 else:
1152 1164 tmpname = tempfile.mktemp('.txt')
1153 1165 tmpfile = file(tmpname,'wt')
1154 1166 tmpfile.write(strng)
1155 1167 tmpfile.close()
1156 1168 cmd = "%s < %s" % (pager_cmd,tmpname)
1157 1169 if os.system(cmd):
1158 1170 retval = 1
1159 1171 else:
1160 1172 retval = None
1161 1173 os.remove(tmpname)
1162 1174 else:
1163 1175 try:
1164 1176 retval = None
1165 1177 # if I use popen4, things hang. No idea why.
1166 1178 #pager,shell_out = os.popen4(pager_cmd)
1167 1179 pager = os.popen(pager_cmd,'w')
1168 1180 pager.write(strng)
1169 1181 pager.close()
1170 1182 retval = pager.close() # success returns None
1171 1183 except IOError,msg: # broken pipe when user quits
1172 1184 if msg.args == (32,'Broken pipe'):
1173 1185 retval = None
1174 1186 else:
1175 1187 retval = 1
1176 1188 except OSError:
1177 1189 # Other strange problems, sometimes seen in Win2k/cygwin
1178 1190 retval = 1
1179 1191 if retval is not None:
1180 1192 page_dumb(strng,screen_lines=screen_lines)
1181 1193
1182 1194 #----------------------------------------------------------------------------
1183 1195 def page_file(fname,start = 0, pager_cmd = None):
1184 1196 """Page a file, using an optional pager command and starting line.
1185 1197 """
1186 1198
1187 1199 pager_cmd = get_pager_cmd(pager_cmd)
1188 1200 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1189 1201
1190 1202 try:
1191 1203 if os.environ['TERM'] in ['emacs','dumb']:
1192 1204 raise EnvironmentError
1193 1205 xsys(pager_cmd + ' ' + fname)
1194 1206 except:
1195 1207 try:
1196 1208 if start > 0:
1197 1209 start -= 1
1198 1210 page(open(fname).read(),start)
1199 1211 except:
1200 1212 print 'Unable to show file',`fname`
1201 1213
1202 1214 #----------------------------------------------------------------------------
1203 1215 def snip_print(str,width = 75,print_full = 0,header = ''):
1204 1216 """Print a string snipping the midsection to fit in width.
1205 1217
1206 1218 print_full: mode control:
1207 1219 - 0: only snip long strings
1208 1220 - 1: send to page() directly.
1209 1221 - 2: snip long strings and ask for full length viewing with page()
1210 1222 Return 1 if snipping was necessary, 0 otherwise."""
1211 1223
1212 1224 if print_full == 1:
1213 1225 page(header+str)
1214 1226 return 0
1215 1227
1216 1228 print header,
1217 1229 if len(str) < width:
1218 1230 print str
1219 1231 snip = 0
1220 1232 else:
1221 1233 whalf = int((width -5)/2)
1222 1234 print str[:whalf] + ' <...> ' + str[-whalf:]
1223 1235 snip = 1
1224 1236 if snip and print_full == 2:
1225 1237 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1226 1238 page(str)
1227 1239 return snip
1228 1240
1229 1241 #****************************************************************************
1230 1242 # lists, dicts and structures
1231 1243
1232 1244 def belong(candidates,checklist):
1233 1245 """Check whether a list of items appear in a given list of options.
1234 1246
1235 1247 Returns a list of 1 and 0, one for each candidate given."""
1236 1248
1237 1249 return [x in checklist for x in candidates]
1238 1250
1239 1251 #----------------------------------------------------------------------------
1240 1252 def uniq_stable(elems):
1241 1253 """uniq_stable(elems) -> list
1242 1254
1243 1255 Return from an iterable, a list of all the unique elements in the input,
1244 1256 but maintaining the order in which they first appear.
1245 1257
1246 1258 A naive solution to this problem which just makes a dictionary with the
1247 1259 elements as keys fails to respect the stability condition, since
1248 1260 dictionaries are unsorted by nature.
1249 1261
1250 1262 Note: All elements in the input must be valid dictionary keys for this
1251 1263 routine to work, as it internally uses a dictionary for efficiency
1252 1264 reasons."""
1253 1265
1254 1266 unique = []
1255 1267 unique_dict = {}
1256 1268 for nn in elems:
1257 1269 if nn not in unique_dict:
1258 1270 unique.append(nn)
1259 1271 unique_dict[nn] = None
1260 1272 return unique
1261 1273
1262 1274 #----------------------------------------------------------------------------
1263 1275 class NLprinter:
1264 1276 """Print an arbitrarily nested list, indicating index numbers.
1265 1277
1266 1278 An instance of this class called nlprint is available and callable as a
1267 1279 function.
1268 1280
1269 1281 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1270 1282 and using 'sep' to separate the index from the value. """
1271 1283
1272 1284 def __init__(self):
1273 1285 self.depth = 0
1274 1286
1275 1287 def __call__(self,lst,pos='',**kw):
1276 1288 """Prints the nested list numbering levels."""
1277 1289 kw.setdefault('indent',' ')
1278 1290 kw.setdefault('sep',': ')
1279 1291 kw.setdefault('start',0)
1280 1292 kw.setdefault('stop',len(lst))
1281 1293 # we need to remove start and stop from kw so they don't propagate
1282 1294 # into a recursive call for a nested list.
1283 1295 start = kw['start']; del kw['start']
1284 1296 stop = kw['stop']; del kw['stop']
1285 1297 if self.depth == 0 and 'header' in kw.keys():
1286 1298 print kw['header']
1287 1299
1288 1300 for idx in range(start,stop):
1289 1301 elem = lst[idx]
1290 1302 if type(elem)==type([]):
1291 1303 self.depth += 1
1292 1304 self.__call__(elem,itpl('$pos$idx,'),**kw)
1293 1305 self.depth -= 1
1294 1306 else:
1295 1307 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1296 1308
1297 1309 nlprint = NLprinter()
1298 1310 #----------------------------------------------------------------------------
1299 1311 def all_belong(candidates,checklist):
1300 1312 """Check whether a list of items ALL appear in a given list of options.
1301 1313
1302 1314 Returns a single 1 or 0 value."""
1303 1315
1304 1316 return 1-(0 in [x in checklist for x in candidates])
1305 1317
1306 1318 #----------------------------------------------------------------------------
1307 1319 def sort_compare(lst1,lst2,inplace = 1):
1308 1320 """Sort and compare two lists.
1309 1321
1310 1322 By default it does it in place, thus modifying the lists. Use inplace = 0
1311 1323 to avoid that (at the cost of temporary copy creation)."""
1312 1324 if not inplace:
1313 1325 lst1 = lst1[:]
1314 1326 lst2 = lst2[:]
1315 1327 lst1.sort(); lst2.sort()
1316 1328 return lst1 == lst2
1317 1329
1318 1330 #----------------------------------------------------------------------------
1319 1331 def mkdict(**kwargs):
1320 1332 """Return a dict from a keyword list.
1321 1333
1322 1334 It's just syntactic sugar for making ditcionary creation more convenient:
1323 1335 # the standard way
1324 1336 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1325 1337 # a cleaner way
1326 1338 >>>data = dict(red=1, green=2, blue=3)
1327 1339
1328 1340 If you need more than this, look at the Struct() class."""
1329 1341
1330 1342 return kwargs
1331 1343
1332 1344 #----------------------------------------------------------------------------
1333 1345 def list2dict(lst):
1334 1346 """Takes a list of (key,value) pairs and turns it into a dict."""
1335 1347
1336 1348 dic = {}
1337 1349 for k,v in lst: dic[k] = v
1338 1350 return dic
1339 1351
1340 1352 #----------------------------------------------------------------------------
1341 1353 def list2dict2(lst,default=''):
1342 1354 """Takes a list and turns it into a dict.
1343 1355 Much slower than list2dict, but more versatile. This version can take
1344 1356 lists with sublists of arbitrary length (including sclars)."""
1345 1357
1346 1358 dic = {}
1347 1359 for elem in lst:
1348 1360 if type(elem) in (types.ListType,types.TupleType):
1349 1361 size = len(elem)
1350 1362 if size == 0:
1351 1363 pass
1352 1364 elif size == 1:
1353 1365 dic[elem] = default
1354 1366 else:
1355 1367 k,v = elem[0], elem[1:]
1356 1368 if len(v) == 1: v = v[0]
1357 1369 dic[k] = v
1358 1370 else:
1359 1371 dic[elem] = default
1360 1372 return dic
1361 1373
1362 1374 #----------------------------------------------------------------------------
1363 1375 def flatten(seq):
1364 1376 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1365 1377
1366 1378 # bug in python??? (YES. Fixed in 2.2, let's leave the kludgy fix in).
1367 1379
1368 1380 # if the x=0 isn't made, a *global* variable x is left over after calling
1369 1381 # this function, with the value of the last element in the return
1370 1382 # list. This does seem like a bug big time to me.
1371 1383
1372 1384 # the problem is fixed with the x=0, which seems to force the creation of
1373 1385 # a local name
1374 1386
1375 1387 x = 0
1376 1388 return [x for subseq in seq for x in subseq]
1377 1389
1378 1390 #----------------------------------------------------------------------------
1379 1391 def get_slice(seq,start=0,stop=None,step=1):
1380 1392 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1381 1393 if stop == None:
1382 1394 stop = len(seq)
1383 1395 item = lambda i: seq[i]
1384 1396 return map(item,xrange(start,stop,step))
1385 1397
1386 1398 #----------------------------------------------------------------------------
1387 1399 def chop(seq,size):
1388 1400 """Chop a sequence into chunks of the given size."""
1389 1401 chunk = lambda i: seq[i:i+size]
1390 1402 return map(chunk,xrange(0,len(seq),size))
1391 1403
1392 1404 #----------------------------------------------------------------------------
1393 1405 def with(object, **args):
1394 1406 """Set multiple attributes for an object, similar to Pascal's with.
1395 1407
1396 1408 Example:
1397 1409 with(jim,
1398 1410 born = 1960,
1399 1411 haircolour = 'Brown',
1400 1412 eyecolour = 'Green')
1401 1413
1402 1414 Credit: Greg Ewing, in
1403 1415 http://mail.python.org/pipermail/python-list/2001-May/040703.html"""
1404 1416
1405 1417 object.__dict__.update(args)
1406 1418
1407 1419 #----------------------------------------------------------------------------
1408 1420 def setattr_list(obj,alist,nspace = None):
1409 1421 """Set a list of attributes for an object taken from a namespace.
1410 1422
1411 1423 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1412 1424 alist with their values taken from nspace, which must be a dict (something
1413 1425 like locals() will often do) If nspace isn't given, locals() of the
1414 1426 *caller* is used, so in most cases you can omit it.
1415 1427
1416 1428 Note that alist can be given as a string, which will be automatically
1417 1429 split into a list on whitespace. If given as a list, it must be a list of
1418 1430 *strings* (the variable names themselves), not of variables."""
1419 1431
1420 1432 # this grabs the local variables from the *previous* call frame -- that is
1421 1433 # the locals from the function that called setattr_list().
1422 1434 # - snipped from weave.inline()
1423 1435 if nspace is None:
1424 1436 call_frame = sys._getframe().f_back
1425 1437 nspace = call_frame.f_locals
1426 1438
1427 1439 if type(alist) in StringTypes:
1428 1440 alist = alist.split()
1429 1441 for attr in alist:
1430 1442 val = eval(attr,nspace)
1431 1443 setattr(obj,attr,val)
1432 1444
1433 1445 #----------------------------------------------------------------------------
1434 1446 def getattr_list(obj,alist,*args):
1435 1447 """getattr_list(obj,alist[, default]) -> attribute list.
1436 1448
1437 1449 Get a list of named attributes for an object. When a default argument is
1438 1450 given, it is returned when the attribute doesn't exist; without it, an
1439 1451 exception is raised in that case.
1440 1452
1441 1453 Note that alist can be given as a string, which will be automatically
1442 1454 split into a list on whitespace. If given as a list, it must be a list of
1443 1455 *strings* (the variable names themselves), not of variables."""
1444 1456
1445 1457 if type(alist) in StringTypes:
1446 1458 alist = alist.split()
1447 1459 if args:
1448 1460 if len(args)==1:
1449 1461 default = args[0]
1450 1462 return map(lambda attr: getattr(obj,attr,default),alist)
1451 1463 else:
1452 1464 raise ValueError,'getattr_list() takes only one optional argument'
1453 1465 else:
1454 1466 return map(lambda attr: getattr(obj,attr),alist)
1455 1467
1456 1468 #----------------------------------------------------------------------------
1457 1469 def map_method(method,object_list,*argseq,**kw):
1458 1470 """map_method(method,object_list,*args,**kw) -> list
1459 1471
1460 1472 Return a list of the results of applying the methods to the items of the
1461 1473 argument sequence(s). If more than one sequence is given, the method is
1462 1474 called with an argument list consisting of the corresponding item of each
1463 1475 sequence. All sequences must be of the same length.
1464 1476
1465 1477 Keyword arguments are passed verbatim to all objects called.
1466 1478
1467 1479 This is Python code, so it's not nearly as fast as the builtin map()."""
1468 1480
1469 1481 out_list = []
1470 1482 idx = 0
1471 1483 for object in object_list:
1472 1484 try:
1473 1485 handler = getattr(object, method)
1474 1486 except AttributeError:
1475 1487 out_list.append(None)
1476 1488 else:
1477 1489 if argseq:
1478 1490 args = map(lambda lst:lst[idx],argseq)
1479 1491 #print 'ob',object,'hand',handler,'ar',args # dbg
1480 1492 out_list.append(handler(args,**kw))
1481 1493 else:
1482 1494 out_list.append(handler(**kw))
1483 1495 idx += 1
1484 1496 return out_list
1485 1497
1486 1498 #----------------------------------------------------------------------------
1487 1499 # Proposed popitem() extension, written as a method
1488 1500
1489 1501 class NotGiven: pass
1490 1502
1491 1503 def popkey(dct,key,default=NotGiven):
1492 1504 """Return dct[key] and delete dct[key].
1493 1505
1494 1506 If default is given, return it if dct[key] doesn't exist, otherwise raise
1495 1507 KeyError. """
1496 1508
1497 1509 try:
1498 1510 val = dct[key]
1499 1511 except KeyError:
1500 1512 if default is NotGiven:
1501 1513 raise
1502 1514 else:
1503 1515 return default
1504 1516 else:
1505 1517 del dct[key]
1506 1518 return val
1507 1519 #*************************** end of file <genutils.py> **********************
1508 1520
@@ -1,4294 +1,4299 b''
1 2005-07-18 Fernando Perez <fperez@colorado.edu>
2
3 * IPython/genutils.py (get_home_dir): fix to help users with
4 invalid $HOME under win32.
5
1 6 2005-07-17 Fernando Perez <fperez@colorado.edu>
2 7
3 8 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
4 9 some old hacks and clean up a bit other routines; code should be
5 10 simpler and a bit faster.
6 11
7 12 * IPython/iplib.py (interact): removed some last-resort attempts
8 13 to survive broken stdout/stderr. That code was only making it
9 14 harder to abstract out the i/o (necessary for gui integration),
10 15 and the crashes it could prevent were extremely rare in practice
11 16 (besides being fully user-induced in a pretty violent manner).
12 17
13 18 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
14 19 Nothing major yet, but the code is simpler to read; this should
15 20 make it easier to do more serious modifications in the future.
16 21
17 22 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
18 23 which broke in .15 (thanks to a report by Ville).
19 24
20 25 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
21 26 be quite correct, I know next to nothing about unicode). This
22 27 will allow unicode strings to be used in prompts, amongst other
23 28 cases. It also will prevent ipython from crashing when unicode
24 29 shows up unexpectedly in many places. If ascii encoding fails, we
25 30 assume utf_8. Currently the encoding is not a user-visible
26 31 setting, though it could be made so if there is demand for it.
27 32
28 33 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
29 34
30 35 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
31 36
32 37 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
33 38
34 39 * IPython/genutils.py: Add 2.2 compatibility here, so all other
35 40 code can work transparently for 2.2/2.3.
36 41
37 42 2005-07-16 Fernando Perez <fperez@colorado.edu>
38 43
39 44 * IPython/ultraTB.py (ExceptionColors): Make a global variable
40 45 out of the color scheme table used for coloring exception
41 46 tracebacks. This allows user code to add new schemes at runtime.
42 47 This is a minimally modified version of the patch at
43 48 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
44 49 for the contribution.
45 50
46 51 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
47 52 slightly modified version of the patch in
48 53 http://www.scipy.net/roundup/ipython/issue34, which also allows me
49 54 to remove the previous try/except solution (which was costlier).
50 55 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
51 56
52 57 2005-06-08 Fernando Perez <fperez@colorado.edu>
53 58
54 59 * IPython/iplib.py (write/write_err): Add methods to abstract all
55 60 I/O a bit more.
56 61
57 62 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
58 63 warning, reported by Aric Hagberg, fix by JD Hunter.
59 64
60 65 2005-06-02 *** Released version 0.6.15
61 66
62 67 2005-06-01 Fernando Perez <fperez@colorado.edu>
63 68
64 69 * IPython/iplib.py (MagicCompleter.file_matches): Fix
65 70 tab-completion of filenames within open-quoted strings. Note that
66 71 this requires that in ~/.ipython/ipythonrc, users change the
67 72 readline delimiters configuration to read:
68 73
69 74 readline_remove_delims -/~
70 75
71 76
72 77 2005-05-31 *** Released version 0.6.14
73 78
74 79 2005-05-29 Fernando Perez <fperez@colorado.edu>
75 80
76 81 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
77 82 with files not on the filesystem. Reported by Eliyahu Sandler
78 83 <eli@gondolin.net>
79 84
80 85 2005-05-22 Fernando Perez <fperez@colorado.edu>
81 86
82 87 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
83 88 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
84 89
85 90 2005-05-19 Fernando Perez <fperez@colorado.edu>
86 91
87 92 * IPython/iplib.py (safe_execfile): close a file which could be
88 93 left open (causing problems in win32, which locks open files).
89 94 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
90 95
91 96 2005-05-18 Fernando Perez <fperez@colorado.edu>
92 97
93 98 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
94 99 keyword arguments correctly to safe_execfile().
95 100
96 101 2005-05-13 Fernando Perez <fperez@colorado.edu>
97 102
98 103 * ipython.1: Added info about Qt to manpage, and threads warning
99 104 to usage page (invoked with --help).
100 105
101 106 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
102 107 new matcher (it goes at the end of the priority list) to do
103 108 tab-completion on named function arguments. Submitted by George
104 109 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
105 110 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
106 111 for more details.
107 112
108 113 * IPython/Magic.py (magic_run): Added new -e flag to ignore
109 114 SystemExit exceptions in the script being run. Thanks to a report
110 115 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
111 116 producing very annoying behavior when running unit tests.
112 117
113 118 2005-05-12 Fernando Perez <fperez@colorado.edu>
114 119
115 120 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
116 121 which I'd broken (again) due to a changed regexp. In the process,
117 122 added ';' as an escape to auto-quote the whole line without
118 123 splitting its arguments. Thanks to a report by Jerry McRae
119 124 <qrs0xyc02-AT-sneakemail.com>.
120 125
121 126 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
122 127 possible crashes caused by a TokenError. Reported by Ed Schofield
123 128 <schofield-AT-ftw.at>.
124 129
125 130 2005-05-06 Fernando Perez <fperez@colorado.edu>
126 131
127 132 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
128 133
129 134 2005-04-29 Fernando Perez <fperez@colorado.edu>
130 135
131 136 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
132 137 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
133 138 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
134 139 which provides support for Qt interactive usage (similar to the
135 140 existing one for WX and GTK). This had been often requested.
136 141
137 142 2005-04-14 *** Released version 0.6.13
138 143
139 144 2005-04-08 Fernando Perez <fperez@colorado.edu>
140 145
141 146 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
142 147 from _ofind, which gets called on almost every input line. Now,
143 148 we only try to get docstrings if they are actually going to be
144 149 used (the overhead of fetching unnecessary docstrings can be
145 150 noticeable for certain objects, such as Pyro proxies).
146 151
147 152 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
148 153 for completers. For some reason I had been passing them the state
149 154 variable, which completers never actually need, and was in
150 155 conflict with the rlcompleter API. Custom completers ONLY need to
151 156 take the text parameter.
152 157
153 158 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
154 159 work correctly in pysh. I've also moved all the logic which used
155 160 to be in pysh.py here, which will prevent problems with future
156 161 upgrades. However, this time I must warn users to update their
157 162 pysh profile to include the line
158 163
159 164 import_all IPython.Extensions.InterpreterExec
160 165
161 166 because otherwise things won't work for them. They MUST also
162 167 delete pysh.py and the line
163 168
164 169 execfile pysh.py
165 170
166 171 from their ipythonrc-pysh.
167 172
168 173 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
169 174 robust in the face of objects whose dir() returns non-strings
170 175 (which it shouldn't, but some broken libs like ITK do). Thanks to
171 176 a patch by John Hunter (implemented differently, though). Also
172 177 minor improvements by using .extend instead of + on lists.
173 178
174 179 * pysh.py:
175 180
176 181 2005-04-06 Fernando Perez <fperez@colorado.edu>
177 182
178 183 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
179 184 by default, so that all users benefit from it. Those who don't
180 185 want it can still turn it off.
181 186
182 187 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
183 188 config file, I'd forgotten about this, so users were getting it
184 189 off by default.
185 190
186 191 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
187 192 consistency. Now magics can be called in multiline statements,
188 193 and python variables can be expanded in magic calls via $var.
189 194 This makes the magic system behave just like aliases or !system
190 195 calls.
191 196
192 197 2005-03-28 Fernando Perez <fperez@colorado.edu>
193 198
194 199 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
195 200 expensive string additions for building command. Add support for
196 201 trailing ';' when autocall is used.
197 202
198 203 2005-03-26 Fernando Perez <fperez@colorado.edu>
199 204
200 205 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
201 206 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
202 207 ipython.el robust against prompts with any number of spaces
203 208 (including 0) after the ':' character.
204 209
205 210 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
206 211 continuation prompt, which misled users to think the line was
207 212 already indented. Closes debian Bug#300847, reported to me by
208 213 Norbert Tretkowski <tretkowski-AT-inittab.de>.
209 214
210 215 2005-03-23 Fernando Perez <fperez@colorado.edu>
211 216
212 217 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
213 218 properly aligned if they have embedded newlines.
214 219
215 220 * IPython/iplib.py (runlines): Add a public method to expose
216 221 IPython's code execution machinery, so that users can run strings
217 222 as if they had been typed at the prompt interactively.
218 223 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
219 224 methods which can call the system shell, but with python variable
220 225 expansion. The three such methods are: __IPYTHON__.system,
221 226 .getoutput and .getoutputerror. These need to be documented in a
222 227 'public API' section (to be written) of the manual.
223 228
224 229 2005-03-20 Fernando Perez <fperez@colorado.edu>
225 230
226 231 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
227 232 for custom exception handling. This is quite powerful, and it
228 233 allows for user-installable exception handlers which can trap
229 234 custom exceptions at runtime and treat them separately from
230 235 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
231 236 Mantegazza <mantegazza-AT-ill.fr>.
232 237 (InteractiveShell.set_custom_completer): public API function to
233 238 add new completers at runtime.
234 239
235 240 2005-03-19 Fernando Perez <fperez@colorado.edu>
236 241
237 242 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
238 243 allow objects which provide their docstrings via non-standard
239 244 mechanisms (like Pyro proxies) to still be inspected by ipython's
240 245 ? system.
241 246
242 247 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
243 248 automatic capture system. I tried quite hard to make it work
244 249 reliably, and simply failed. I tried many combinations with the
245 250 subprocess module, but eventually nothing worked in all needed
246 251 cases (not blocking stdin for the child, duplicating stdout
247 252 without blocking, etc). The new %sc/%sx still do capture to these
248 253 magical list/string objects which make shell use much more
249 254 conveninent, so not all is lost.
250 255
251 256 XXX - FIX MANUAL for the change above!
252 257
253 258 (runsource): I copied code.py's runsource() into ipython to modify
254 259 it a bit. Now the code object and source to be executed are
255 260 stored in ipython. This makes this info accessible to third-party
256 261 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
257 262 Mantegazza <mantegazza-AT-ill.fr>.
258 263
259 264 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
260 265 history-search via readline (like C-p/C-n). I'd wanted this for a
261 266 long time, but only recently found out how to do it. For users
262 267 who already have their ipythonrc files made and want this, just
263 268 add:
264 269
265 270 readline_parse_and_bind "\e[A": history-search-backward
266 271 readline_parse_and_bind "\e[B": history-search-forward
267 272
268 273 2005-03-18 Fernando Perez <fperez@colorado.edu>
269 274
270 275 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
271 276 LSString and SList classes which allow transparent conversions
272 277 between list mode and whitespace-separated string.
273 278 (magic_r): Fix recursion problem in %r.
274 279
275 280 * IPython/genutils.py (LSString): New class to be used for
276 281 automatic storage of the results of all alias/system calls in _o
277 282 and _e (stdout/err). These provide a .l/.list attribute which
278 283 does automatic splitting on newlines. This means that for most
279 284 uses, you'll never need to do capturing of output with %sc/%sx
280 285 anymore, since ipython keeps this always done for you. Note that
281 286 only the LAST results are stored, the _o/e variables are
282 287 overwritten on each call. If you need to save their contents
283 288 further, simply bind them to any other name.
284 289
285 290 2005-03-17 Fernando Perez <fperez@colorado.edu>
286 291
287 292 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
288 293 prompt namespace handling.
289 294
290 295 2005-03-16 Fernando Perez <fperez@colorado.edu>
291 296
292 297 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
293 298 classic prompts to be '>>> ' (final space was missing, and it
294 299 trips the emacs python mode).
295 300 (BasePrompt.__str__): Added safe support for dynamic prompt
296 301 strings. Now you can set your prompt string to be '$x', and the
297 302 value of x will be printed from your interactive namespace. The
298 303 interpolation syntax includes the full Itpl support, so
299 304 ${foo()+x+bar()} is a valid prompt string now, and the function
300 305 calls will be made at runtime.
301 306
302 307 2005-03-15 Fernando Perez <fperez@colorado.edu>
303 308
304 309 * IPython/Magic.py (magic_history): renamed %hist to %history, to
305 310 avoid name clashes in pylab. %hist still works, it just forwards
306 311 the call to %history.
307 312
308 313 2005-03-02 *** Released version 0.6.12
309 314
310 315 2005-03-02 Fernando Perez <fperez@colorado.edu>
311 316
312 317 * IPython/iplib.py (handle_magic): log magic calls properly as
313 318 ipmagic() function calls.
314 319
315 320 * IPython/Magic.py (magic_time): Improved %time to support
316 321 statements and provide wall-clock as well as CPU time.
317 322
318 323 2005-02-27 Fernando Perez <fperez@colorado.edu>
319 324
320 325 * IPython/hooks.py: New hooks module, to expose user-modifiable
321 326 IPython functionality in a clean manner. For now only the editor
322 327 hook is actually written, and other thigns which I intend to turn
323 328 into proper hooks aren't yet there. The display and prefilter
324 329 stuff, for example, should be hooks. But at least now the
325 330 framework is in place, and the rest can be moved here with more
326 331 time later. IPython had had a .hooks variable for a long time for
327 332 this purpose, but I'd never actually used it for anything.
328 333
329 334 2005-02-26 Fernando Perez <fperez@colorado.edu>
330 335
331 336 * IPython/ipmaker.py (make_IPython): make the default ipython
332 337 directory be called _ipython under win32, to follow more the
333 338 naming peculiarities of that platform (where buggy software like
334 339 Visual Sourcesafe breaks with .named directories). Reported by
335 340 Ville Vainio.
336 341
337 342 2005-02-23 Fernando Perez <fperez@colorado.edu>
338 343
339 344 * IPython/iplib.py (InteractiveShell.__init__): removed a few
340 345 auto_aliases for win32 which were causing problems. Users can
341 346 define the ones they personally like.
342 347
343 348 2005-02-21 Fernando Perez <fperez@colorado.edu>
344 349
345 350 * IPython/Magic.py (magic_time): new magic to time execution of
346 351 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
347 352
348 353 2005-02-19 Fernando Perez <fperez@colorado.edu>
349 354
350 355 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
351 356 into keys (for prompts, for example).
352 357
353 358 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
354 359 prompts in case users want them. This introduces a small behavior
355 360 change: ipython does not automatically add a space to all prompts
356 361 anymore. To get the old prompts with a space, users should add it
357 362 manually to their ipythonrc file, so for example prompt_in1 should
358 363 now read 'In [\#]: ' instead of 'In [\#]:'.
359 364 (BasePrompt.__init__): New option prompts_pad_left (only in rc
360 365 file) to control left-padding of secondary prompts.
361 366
362 367 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
363 368 the profiler can't be imported. Fix for Debian, which removed
364 369 profile.py because of License issues. I applied a slightly
365 370 modified version of the original Debian patch at
366 371 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
367 372
368 373 2005-02-17 Fernando Perez <fperez@colorado.edu>
369 374
370 375 * IPython/genutils.py (native_line_ends): Fix bug which would
371 376 cause improper line-ends under win32 b/c I was not opening files
372 377 in binary mode. Bug report and fix thanks to Ville.
373 378
374 379 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
375 380 trying to catch spurious foo[1] autocalls. My fix actually broke
376 381 ',/' autoquote/call with explicit escape (bad regexp).
377 382
378 383 2005-02-15 *** Released version 0.6.11
379 384
380 385 2005-02-14 Fernando Perez <fperez@colorado.edu>
381 386
382 387 * IPython/background_jobs.py: New background job management
383 388 subsystem. This is implemented via a new set of classes, and
384 389 IPython now provides a builtin 'jobs' object for background job
385 390 execution. A convenience %bg magic serves as a lightweight
386 391 frontend for starting the more common type of calls. This was
387 392 inspired by discussions with B. Granger and the BackgroundCommand
388 393 class described in the book Python Scripting for Computational
389 394 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
390 395 (although ultimately no code from this text was used, as IPython's
391 396 system is a separate implementation).
392 397
393 398 * IPython/iplib.py (MagicCompleter.python_matches): add new option
394 399 to control the completion of single/double underscore names
395 400 separately. As documented in the example ipytonrc file, the
396 401 readline_omit__names variable can now be set to 2, to omit even
397 402 single underscore names. Thanks to a patch by Brian Wong
398 403 <BrianWong-AT-AirgoNetworks.Com>.
399 404 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
400 405 be autocalled as foo([1]) if foo were callable. A problem for
401 406 things which are both callable and implement __getitem__.
402 407 (init_readline): Fix autoindentation for win32. Thanks to a patch
403 408 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
404 409
405 410 2005-02-12 Fernando Perez <fperez@colorado.edu>
406 411
407 412 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
408 413 which I had written long ago to sort out user error messages which
409 414 may occur during startup. This seemed like a good idea initially,
410 415 but it has proven a disaster in retrospect. I don't want to
411 416 change much code for now, so my fix is to set the internal 'debug'
412 417 flag to true everywhere, whose only job was precisely to control
413 418 this subsystem. This closes issue 28 (as well as avoiding all
414 419 sorts of strange hangups which occur from time to time).
415 420
416 421 2005-02-07 Fernando Perez <fperez@colorado.edu>
417 422
418 423 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
419 424 previous call produced a syntax error.
420 425
421 426 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
422 427 classes without constructor.
423 428
424 429 2005-02-06 Fernando Perez <fperez@colorado.edu>
425 430
426 431 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
427 432 completions with the results of each matcher, so we return results
428 433 to the user from all namespaces. This breaks with ipython
429 434 tradition, but I think it's a nicer behavior. Now you get all
430 435 possible completions listed, from all possible namespaces (python,
431 436 filesystem, magics...) After a request by John Hunter
432 437 <jdhunter-AT-nitace.bsd.uchicago.edu>.
433 438
434 439 2005-02-05 Fernando Perez <fperez@colorado.edu>
435 440
436 441 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
437 442 the call had quote characters in it (the quotes were stripped).
438 443
439 444 2005-01-31 Fernando Perez <fperez@colorado.edu>
440 445
441 446 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
442 447 Itpl.itpl() to make the code more robust against psyco
443 448 optimizations.
444 449
445 450 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
446 451 of causing an exception. Quicker, cleaner.
447 452
448 453 2005-01-28 Fernando Perez <fperez@colorado.edu>
449 454
450 455 * scripts/ipython_win_post_install.py (install): hardcode
451 456 sys.prefix+'python.exe' as the executable path. It turns out that
452 457 during the post-installation run, sys.executable resolves to the
453 458 name of the binary installer! I should report this as a distutils
454 459 bug, I think. I updated the .10 release with this tiny fix, to
455 460 avoid annoying the lists further.
456 461
457 462 2005-01-27 *** Released version 0.6.10
458 463
459 464 2005-01-27 Fernando Perez <fperez@colorado.edu>
460 465
461 466 * IPython/numutils.py (norm): Added 'inf' as optional name for
462 467 L-infinity norm, included references to mathworld.com for vector
463 468 norm definitions.
464 469 (amin/amax): added amin/amax for array min/max. Similar to what
465 470 pylab ships with after the recent reorganization of names.
466 471 (spike/spike_odd): removed deprecated spike/spike_odd functions.
467 472
468 473 * ipython.el: committed Alex's recent fixes and improvements.
469 474 Tested with python-mode from CVS, and it looks excellent. Since
470 475 python-mode hasn't released anything in a while, I'm temporarily
471 476 putting a copy of today's CVS (v 4.70) of python-mode in:
472 477 http://ipython.scipy.org/tmp/python-mode.el
473 478
474 479 * scripts/ipython_win_post_install.py (install): Win32 fix to use
475 480 sys.executable for the executable name, instead of assuming it's
476 481 called 'python.exe' (the post-installer would have produced broken
477 482 setups on systems with a differently named python binary).
478 483
479 484 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
480 485 references to os.linesep, to make the code more
481 486 platform-independent. This is also part of the win32 coloring
482 487 fixes.
483 488
484 489 * IPython/genutils.py (page_dumb): Remove attempts to chop long
485 490 lines, which actually cause coloring bugs because the length of
486 491 the line is very difficult to correctly compute with embedded
487 492 escapes. This was the source of all the coloring problems under
488 493 Win32. I think that _finally_, Win32 users have a properly
489 494 working ipython in all respects. This would never have happened
490 495 if not for Gary Bishop and Viktor Ransmayr's great help and work.
491 496
492 497 2005-01-26 *** Released version 0.6.9
493 498
494 499 2005-01-25 Fernando Perez <fperez@colorado.edu>
495 500
496 501 * setup.py: finally, we have a true Windows installer, thanks to
497 502 the excellent work of Viktor Ransmayr
498 503 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
499 504 Windows users. The setup routine is quite a bit cleaner thanks to
500 505 this, and the post-install script uses the proper functions to
501 506 allow a clean de-installation using the standard Windows Control
502 507 Panel.
503 508
504 509 * IPython/genutils.py (get_home_dir): changed to use the $HOME
505 510 environment variable under all OSes (including win32) if
506 511 available. This will give consistency to win32 users who have set
507 512 this variable for any reason. If os.environ['HOME'] fails, the
508 513 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
509 514
510 515 2005-01-24 Fernando Perez <fperez@colorado.edu>
511 516
512 517 * IPython/numutils.py (empty_like): add empty_like(), similar to
513 518 zeros_like() but taking advantage of the new empty() Numeric routine.
514 519
515 520 2005-01-23 *** Released version 0.6.8
516 521
517 522 2005-01-22 Fernando Perez <fperez@colorado.edu>
518 523
519 524 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
520 525 automatic show() calls. After discussing things with JDH, it
521 526 turns out there are too many corner cases where this can go wrong.
522 527 It's best not to try to be 'too smart', and simply have ipython
523 528 reproduce as much as possible the default behavior of a normal
524 529 python shell.
525 530
526 531 * IPython/iplib.py (InteractiveShell.__init__): Modified the
527 532 line-splitting regexp and _prefilter() to avoid calling getattr()
528 533 on assignments. This closes
529 534 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
530 535 readline uses getattr(), so a simple <TAB> keypress is still
531 536 enough to trigger getattr() calls on an object.
532 537
533 538 2005-01-21 Fernando Perez <fperez@colorado.edu>
534 539
535 540 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
536 541 docstring under pylab so it doesn't mask the original.
537 542
538 543 2005-01-21 *** Released version 0.6.7
539 544
540 545 2005-01-21 Fernando Perez <fperez@colorado.edu>
541 546
542 547 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
543 548 signal handling for win32 users in multithreaded mode.
544 549
545 550 2005-01-17 Fernando Perez <fperez@colorado.edu>
546 551
547 552 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
548 553 instances with no __init__. After a crash report by Norbert Nemec
549 554 <Norbert-AT-nemec-online.de>.
550 555
551 556 2005-01-14 Fernando Perez <fperez@colorado.edu>
552 557
553 558 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
554 559 names for verbose exceptions, when multiple dotted names and the
555 560 'parent' object were present on the same line.
556 561
557 562 2005-01-11 Fernando Perez <fperez@colorado.edu>
558 563
559 564 * IPython/genutils.py (flag_calls): new utility to trap and flag
560 565 calls in functions. I need it to clean up matplotlib support.
561 566 Also removed some deprecated code in genutils.
562 567
563 568 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
564 569 that matplotlib scripts called with %run, which don't call show()
565 570 themselves, still have their plotting windows open.
566 571
567 572 2005-01-05 Fernando Perez <fperez@colorado.edu>
568 573
569 574 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
570 575 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
571 576
572 577 2004-12-19 Fernando Perez <fperez@colorado.edu>
573 578
574 579 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
575 580 parent_runcode, which was an eyesore. The same result can be
576 581 obtained with Python's regular superclass mechanisms.
577 582
578 583 2004-12-17 Fernando Perez <fperez@colorado.edu>
579 584
580 585 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
581 586 reported by Prabhu.
582 587 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
583 588 sys.stderr) instead of explicitly calling sys.stderr. This helps
584 589 maintain our I/O abstractions clean, for future GUI embeddings.
585 590
586 591 * IPython/genutils.py (info): added new utility for sys.stderr
587 592 unified info message handling (thin wrapper around warn()).
588 593
589 594 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
590 595 composite (dotted) names on verbose exceptions.
591 596 (VerboseTB.nullrepr): harden against another kind of errors which
592 597 Python's inspect module can trigger, and which were crashing
593 598 IPython. Thanks to a report by Marco Lombardi
594 599 <mlombard-AT-ma010192.hq.eso.org>.
595 600
596 601 2004-12-13 *** Released version 0.6.6
597 602
598 603 2004-12-12 Fernando Perez <fperez@colorado.edu>
599 604
600 605 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
601 606 generated by pygtk upon initialization if it was built without
602 607 threads (for matplotlib users). After a crash reported by
603 608 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
604 609
605 610 * IPython/ipmaker.py (make_IPython): fix small bug in the
606 611 import_some parameter for multiple imports.
607 612
608 613 * IPython/iplib.py (ipmagic): simplified the interface of
609 614 ipmagic() to take a single string argument, just as it would be
610 615 typed at the IPython cmd line.
611 616 (ipalias): Added new ipalias() with an interface identical to
612 617 ipmagic(). This completes exposing a pure python interface to the
613 618 alias and magic system, which can be used in loops or more complex
614 619 code where IPython's automatic line mangling is not active.
615 620
616 621 * IPython/genutils.py (timing): changed interface of timing to
617 622 simply run code once, which is the most common case. timings()
618 623 remains unchanged, for the cases where you want multiple runs.
619 624
620 625 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
621 626 bug where Python2.2 crashes with exec'ing code which does not end
622 627 in a single newline. Python 2.3 is OK, so I hadn't noticed this
623 628 before.
624 629
625 630 2004-12-10 Fernando Perez <fperez@colorado.edu>
626 631
627 632 * IPython/Magic.py (Magic.magic_prun): changed name of option from
628 633 -t to -T, to accomodate the new -t flag in %run (the %run and
629 634 %prun options are kind of intermixed, and it's not easy to change
630 635 this with the limitations of python's getopt).
631 636
632 637 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
633 638 the execution of scripts. It's not as fine-tuned as timeit.py,
634 639 but it works from inside ipython (and under 2.2, which lacks
635 640 timeit.py). Optionally a number of runs > 1 can be given for
636 641 timing very short-running code.
637 642
638 643 * IPython/genutils.py (uniq_stable): new routine which returns a
639 644 list of unique elements in any iterable, but in stable order of
640 645 appearance. I needed this for the ultraTB fixes, and it's a handy
641 646 utility.
642 647
643 648 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
644 649 dotted names in Verbose exceptions. This had been broken since
645 650 the very start, now x.y will properly be printed in a Verbose
646 651 traceback, instead of x being shown and y appearing always as an
647 652 'undefined global'. Getting this to work was a bit tricky,
648 653 because by default python tokenizers are stateless. Saved by
649 654 python's ability to easily add a bit of state to an arbitrary
650 655 function (without needing to build a full-blown callable object).
651 656
652 657 Also big cleanup of this code, which had horrendous runtime
653 658 lookups of zillions of attributes for colorization. Moved all
654 659 this code into a few templates, which make it cleaner and quicker.
655 660
656 661 Printout quality was also improved for Verbose exceptions: one
657 662 variable per line, and memory addresses are printed (this can be
658 663 quite handy in nasty debugging situations, which is what Verbose
659 664 is for).
660 665
661 666 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
662 667 the command line as scripts to be loaded by embedded instances.
663 668 Doing so has the potential for an infinite recursion if there are
664 669 exceptions thrown in the process. This fixes a strange crash
665 670 reported by Philippe MULLER <muller-AT-irit.fr>.
666 671
667 672 2004-12-09 Fernando Perez <fperez@colorado.edu>
668 673
669 674 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
670 675 to reflect new names in matplotlib, which now expose the
671 676 matlab-compatible interface via a pylab module instead of the
672 677 'matlab' name. The new code is backwards compatible, so users of
673 678 all matplotlib versions are OK. Patch by J. Hunter.
674 679
675 680 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
676 681 of __init__ docstrings for instances (class docstrings are already
677 682 automatically printed). Instances with customized docstrings
678 683 (indep. of the class) are also recognized and all 3 separate
679 684 docstrings are printed (instance, class, constructor). After some
680 685 comments/suggestions by J. Hunter.
681 686
682 687 2004-12-05 Fernando Perez <fperez@colorado.edu>
683 688
684 689 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
685 690 warnings when tab-completion fails and triggers an exception.
686 691
687 692 2004-12-03 Fernando Perez <fperez@colorado.edu>
688 693
689 694 * IPython/Magic.py (magic_prun): Fix bug where an exception would
690 695 be triggered when using 'run -p'. An incorrect option flag was
691 696 being set ('d' instead of 'D').
692 697 (manpage): fix missing escaped \- sign.
693 698
694 699 2004-11-30 *** Released version 0.6.5
695 700
696 701 2004-11-30 Fernando Perez <fperez@colorado.edu>
697 702
698 703 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
699 704 setting with -d option.
700 705
701 706 * setup.py (docfiles): Fix problem where the doc glob I was using
702 707 was COMPLETELY BROKEN. It was giving the right files by pure
703 708 accident, but failed once I tried to include ipython.el. Note:
704 709 glob() does NOT allow you to do exclusion on multiple endings!
705 710
706 711 2004-11-29 Fernando Perez <fperez@colorado.edu>
707 712
708 713 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
709 714 the manpage as the source. Better formatting & consistency.
710 715
711 716 * IPython/Magic.py (magic_run): Added new -d option, to run
712 717 scripts under the control of the python pdb debugger. Note that
713 718 this required changing the %prun option -d to -D, to avoid a clash
714 719 (since %run must pass options to %prun, and getopt is too dumb to
715 720 handle options with string values with embedded spaces). Thanks
716 721 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
717 722 (magic_who_ls): added type matching to %who and %whos, so that one
718 723 can filter their output to only include variables of certain
719 724 types. Another suggestion by Matthew.
720 725 (magic_whos): Added memory summaries in kb and Mb for arrays.
721 726 (magic_who): Improve formatting (break lines every 9 vars).
722 727
723 728 2004-11-28 Fernando Perez <fperez@colorado.edu>
724 729
725 730 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
726 731 cache when empty lines were present.
727 732
728 733 2004-11-24 Fernando Perez <fperez@colorado.edu>
729 734
730 735 * IPython/usage.py (__doc__): document the re-activated threading
731 736 options for WX and GTK.
732 737
733 738 2004-11-23 Fernando Perez <fperez@colorado.edu>
734 739
735 740 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
736 741 the -wthread and -gthread options, along with a new -tk one to try
737 742 and coordinate Tk threading with wx/gtk. The tk support is very
738 743 platform dependent, since it seems to require Tcl and Tk to be
739 744 built with threads (Fedora1/2 appears NOT to have it, but in
740 745 Prabhu's Debian boxes it works OK). But even with some Tk
741 746 limitations, this is a great improvement.
742 747
743 748 * IPython/Prompts.py (prompt_specials_color): Added \t for time
744 749 info in user prompts. Patch by Prabhu.
745 750
746 751 2004-11-18 Fernando Perez <fperez@colorado.edu>
747 752
748 753 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
749 754 EOFErrors and bail, to avoid infinite loops if a non-terminating
750 755 file is fed into ipython. Patch submitted in issue 19 by user,
751 756 many thanks.
752 757
753 758 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
754 759 autoquote/parens in continuation prompts, which can cause lots of
755 760 problems. Closes roundup issue 20.
756 761
757 762 2004-11-17 Fernando Perez <fperez@colorado.edu>
758 763
759 764 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
760 765 reported as debian bug #280505. I'm not sure my local changelog
761 766 entry has the proper debian format (Jack?).
762 767
763 768 2004-11-08 *** Released version 0.6.4
764 769
765 770 2004-11-08 Fernando Perez <fperez@colorado.edu>
766 771
767 772 * IPython/iplib.py (init_readline): Fix exit message for Windows
768 773 when readline is active. Thanks to a report by Eric Jones
769 774 <eric-AT-enthought.com>.
770 775
771 776 2004-11-07 Fernando Perez <fperez@colorado.edu>
772 777
773 778 * IPython/genutils.py (page): Add a trap for OSError exceptions,
774 779 sometimes seen by win2k/cygwin users.
775 780
776 781 2004-11-06 Fernando Perez <fperez@colorado.edu>
777 782
778 783 * IPython/iplib.py (interact): Change the handling of %Exit from
779 784 trying to propagate a SystemExit to an internal ipython flag.
780 785 This is less elegant than using Python's exception mechanism, but
781 786 I can't get that to work reliably with threads, so under -pylab
782 787 %Exit was hanging IPython. Cross-thread exception handling is
783 788 really a bitch. Thaks to a bug report by Stephen Walton
784 789 <stephen.walton-AT-csun.edu>.
785 790
786 791 2004-11-04 Fernando Perez <fperez@colorado.edu>
787 792
788 793 * IPython/iplib.py (raw_input_original): store a pointer to the
789 794 true raw_input to harden against code which can modify it
790 795 (wx.py.PyShell does this and would otherwise crash ipython).
791 796 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
792 797
793 798 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
794 799 Ctrl-C problem, which does not mess up the input line.
795 800
796 801 2004-11-03 Fernando Perez <fperez@colorado.edu>
797 802
798 803 * IPython/Release.py: Changed licensing to BSD, in all files.
799 804 (name): lowercase name for tarball/RPM release.
800 805
801 806 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
802 807 use throughout ipython.
803 808
804 809 * IPython/Magic.py (Magic._ofind): Switch to using the new
805 810 OInspect.getdoc() function.
806 811
807 812 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
808 813 of the line currently being canceled via Ctrl-C. It's extremely
809 814 ugly, but I don't know how to do it better (the problem is one of
810 815 handling cross-thread exceptions).
811 816
812 817 2004-10-28 Fernando Perez <fperez@colorado.edu>
813 818
814 819 * IPython/Shell.py (signal_handler): add signal handlers to trap
815 820 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
816 821 report by Francesc Alted.
817 822
818 823 2004-10-21 Fernando Perez <fperez@colorado.edu>
819 824
820 825 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
821 826 to % for pysh syntax extensions.
822 827
823 828 2004-10-09 Fernando Perez <fperez@colorado.edu>
824 829
825 830 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
826 831 arrays to print a more useful summary, without calling str(arr).
827 832 This avoids the problem of extremely lengthy computations which
828 833 occur if arr is large, and appear to the user as a system lockup
829 834 with 100% cpu activity. After a suggestion by Kristian Sandberg
830 835 <Kristian.Sandberg@colorado.edu>.
831 836 (Magic.__init__): fix bug in global magic escapes not being
832 837 correctly set.
833 838
834 839 2004-10-08 Fernando Perez <fperez@colorado.edu>
835 840
836 841 * IPython/Magic.py (__license__): change to absolute imports of
837 842 ipython's own internal packages, to start adapting to the absolute
838 843 import requirement of PEP-328.
839 844
840 845 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
841 846 files, and standardize author/license marks through the Release
842 847 module instead of having per/file stuff (except for files with
843 848 particular licenses, like the MIT/PSF-licensed codes).
844 849
845 850 * IPython/Debugger.py: remove dead code for python 2.1
846 851
847 852 2004-10-04 Fernando Perez <fperez@colorado.edu>
848 853
849 854 * IPython/iplib.py (ipmagic): New function for accessing magics
850 855 via a normal python function call.
851 856
852 857 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
853 858 from '@' to '%', to accomodate the new @decorator syntax of python
854 859 2.4.
855 860
856 861 2004-09-29 Fernando Perez <fperez@colorado.edu>
857 862
858 863 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
859 864 matplotlib.use to prevent running scripts which try to switch
860 865 interactive backends from within ipython. This will just crash
861 866 the python interpreter, so we can't allow it (but a detailed error
862 867 is given to the user).
863 868
864 869 2004-09-28 Fernando Perez <fperez@colorado.edu>
865 870
866 871 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
867 872 matplotlib-related fixes so that using @run with non-matplotlib
868 873 scripts doesn't pop up spurious plot windows. This requires
869 874 matplotlib >= 0.63, where I had to make some changes as well.
870 875
871 876 * IPython/ipmaker.py (make_IPython): update version requirement to
872 877 python 2.2.
873 878
874 879 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
875 880 banner arg for embedded customization.
876 881
877 882 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
878 883 explicit uses of __IP as the IPython's instance name. Now things
879 884 are properly handled via the shell.name value. The actual code
880 885 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
881 886 is much better than before. I'll clean things completely when the
882 887 magic stuff gets a real overhaul.
883 888
884 889 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
885 890 minor changes to debian dir.
886 891
887 892 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
888 893 pointer to the shell itself in the interactive namespace even when
889 894 a user-supplied dict is provided. This is needed for embedding
890 895 purposes (found by tests with Michel Sanner).
891 896
892 897 2004-09-27 Fernando Perez <fperez@colorado.edu>
893 898
894 899 * IPython/UserConfig/ipythonrc: remove []{} from
895 900 readline_remove_delims, so that things like [modname.<TAB> do
896 901 proper completion. This disables [].TAB, but that's a less common
897 902 case than module names in list comprehensions, for example.
898 903 Thanks to a report by Andrea Riciputi.
899 904
900 905 2004-09-09 Fernando Perez <fperez@colorado.edu>
901 906
902 907 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
903 908 blocking problems in win32 and osx. Fix by John.
904 909
905 910 2004-09-08 Fernando Perez <fperez@colorado.edu>
906 911
907 912 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
908 913 for Win32 and OSX. Fix by John Hunter.
909 914
910 915 2004-08-30 *** Released version 0.6.3
911 916
912 917 2004-08-30 Fernando Perez <fperez@colorado.edu>
913 918
914 919 * setup.py (isfile): Add manpages to list of dependent files to be
915 920 updated.
916 921
917 922 2004-08-27 Fernando Perez <fperez@colorado.edu>
918 923
919 924 * IPython/Shell.py (start): I've disabled -wthread and -gthread
920 925 for now. They don't really work with standalone WX/GTK code
921 926 (though matplotlib IS working fine with both of those backends).
922 927 This will neeed much more testing. I disabled most things with
923 928 comments, so turning it back on later should be pretty easy.
924 929
925 930 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
926 931 autocalling of expressions like r'foo', by modifying the line
927 932 split regexp. Closes
928 933 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
929 934 Riley <ipythonbugs-AT-sabi.net>.
930 935 (InteractiveShell.mainloop): honor --nobanner with banner
931 936 extensions.
932 937
933 938 * IPython/Shell.py: Significant refactoring of all classes, so
934 939 that we can really support ALL matplotlib backends and threading
935 940 models (John spotted a bug with Tk which required this). Now we
936 941 should support single-threaded, WX-threads and GTK-threads, both
937 942 for generic code and for matplotlib.
938 943
939 944 * IPython/ipmaker.py (__call__): Changed -mpthread option to
940 945 -pylab, to simplify things for users. Will also remove the pylab
941 946 profile, since now all of matplotlib configuration is directly
942 947 handled here. This also reduces startup time.
943 948
944 949 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
945 950 shell wasn't being correctly called. Also in IPShellWX.
946 951
947 952 * IPython/iplib.py (InteractiveShell.__init__): Added option to
948 953 fine-tune banner.
949 954
950 955 * IPython/numutils.py (spike): Deprecate these spike functions,
951 956 delete (long deprecated) gnuplot_exec handler.
952 957
953 958 2004-08-26 Fernando Perez <fperez@colorado.edu>
954 959
955 960 * ipython.1: Update for threading options, plus some others which
956 961 were missing.
957 962
958 963 * IPython/ipmaker.py (__call__): Added -wthread option for
959 964 wxpython thread handling. Make sure threading options are only
960 965 valid at the command line.
961 966
962 967 * scripts/ipython: moved shell selection into a factory function
963 968 in Shell.py, to keep the starter script to a minimum.
964 969
965 970 2004-08-25 Fernando Perez <fperez@colorado.edu>
966 971
967 972 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
968 973 John. Along with some recent changes he made to matplotlib, the
969 974 next versions of both systems should work very well together.
970 975
971 976 2004-08-24 Fernando Perez <fperez@colorado.edu>
972 977
973 978 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
974 979 tried to switch the profiling to using hotshot, but I'm getting
975 980 strange errors from prof.runctx() there. I may be misreading the
976 981 docs, but it looks weird. For now the profiling code will
977 982 continue to use the standard profiler.
978 983
979 984 2004-08-23 Fernando Perez <fperez@colorado.edu>
980 985
981 986 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
982 987 threaded shell, by John Hunter. It's not quite ready yet, but
983 988 close.
984 989
985 990 2004-08-22 Fernando Perez <fperez@colorado.edu>
986 991
987 992 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
988 993 in Magic and ultraTB.
989 994
990 995 * ipython.1: document threading options in manpage.
991 996
992 997 * scripts/ipython: Changed name of -thread option to -gthread,
993 998 since this is GTK specific. I want to leave the door open for a
994 999 -wthread option for WX, which will most likely be necessary. This
995 1000 change affects usage and ipmaker as well.
996 1001
997 1002 * IPython/Shell.py (matplotlib_shell): Add a factory function to
998 1003 handle the matplotlib shell issues. Code by John Hunter
999 1004 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1000 1005 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1001 1006 broken (and disabled for end users) for now, but it puts the
1002 1007 infrastructure in place.
1003 1008
1004 1009 2004-08-21 Fernando Perez <fperez@colorado.edu>
1005 1010
1006 1011 * ipythonrc-pylab: Add matplotlib support.
1007 1012
1008 1013 * matplotlib_config.py: new files for matplotlib support, part of
1009 1014 the pylab profile.
1010 1015
1011 1016 * IPython/usage.py (__doc__): documented the threading options.
1012 1017
1013 1018 2004-08-20 Fernando Perez <fperez@colorado.edu>
1014 1019
1015 1020 * ipython: Modified the main calling routine to handle the -thread
1016 1021 and -mpthread options. This needs to be done as a top-level hack,
1017 1022 because it determines which class to instantiate for IPython
1018 1023 itself.
1019 1024
1020 1025 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1021 1026 classes to support multithreaded GTK operation without blocking,
1022 1027 and matplotlib with all backends. This is a lot of still very
1023 1028 experimental code, and threads are tricky. So it may still have a
1024 1029 few rough edges... This code owes a lot to
1025 1030 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1026 1031 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1027 1032 to John Hunter for all the matplotlib work.
1028 1033
1029 1034 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1030 1035 options for gtk thread and matplotlib support.
1031 1036
1032 1037 2004-08-16 Fernando Perez <fperez@colorado.edu>
1033 1038
1034 1039 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1035 1040 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1036 1041 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1037 1042
1038 1043 2004-08-11 Fernando Perez <fperez@colorado.edu>
1039 1044
1040 1045 * setup.py (isfile): Fix build so documentation gets updated for
1041 1046 rpms (it was only done for .tgz builds).
1042 1047
1043 1048 2004-08-10 Fernando Perez <fperez@colorado.edu>
1044 1049
1045 1050 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1046 1051
1047 1052 * iplib.py : Silence syntax error exceptions in tab-completion.
1048 1053
1049 1054 2004-08-05 Fernando Perez <fperez@colorado.edu>
1050 1055
1051 1056 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1052 1057 'color off' mark for continuation prompts. This was causing long
1053 1058 continuation lines to mis-wrap.
1054 1059
1055 1060 2004-08-01 Fernando Perez <fperez@colorado.edu>
1056 1061
1057 1062 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1058 1063 for building ipython to be a parameter. All this is necessary
1059 1064 right now to have a multithreaded version, but this insane
1060 1065 non-design will be cleaned up soon. For now, it's a hack that
1061 1066 works.
1062 1067
1063 1068 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1064 1069 args in various places. No bugs so far, but it's a dangerous
1065 1070 practice.
1066 1071
1067 1072 2004-07-31 Fernando Perez <fperez@colorado.edu>
1068 1073
1069 1074 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1070 1075 fix completion of files with dots in their names under most
1071 1076 profiles (pysh was OK because the completion order is different).
1072 1077
1073 1078 2004-07-27 Fernando Perez <fperez@colorado.edu>
1074 1079
1075 1080 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1076 1081 keywords manually, b/c the one in keyword.py was removed in python
1077 1082 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1078 1083 This is NOT a bug under python 2.3 and earlier.
1079 1084
1080 1085 2004-07-26 Fernando Perez <fperez@colorado.edu>
1081 1086
1082 1087 * IPython/ultraTB.py (VerboseTB.text): Add another
1083 1088 linecache.checkcache() call to try to prevent inspect.py from
1084 1089 crashing under python 2.3. I think this fixes
1085 1090 http://www.scipy.net/roundup/ipython/issue17.
1086 1091
1087 1092 2004-07-26 *** Released version 0.6.2
1088 1093
1089 1094 2004-07-26 Fernando Perez <fperez@colorado.edu>
1090 1095
1091 1096 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1092 1097 fail for any number.
1093 1098 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1094 1099 empty bookmarks.
1095 1100
1096 1101 2004-07-26 *** Released version 0.6.1
1097 1102
1098 1103 2004-07-26 Fernando Perez <fperez@colorado.edu>
1099 1104
1100 1105 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1101 1106
1102 1107 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1103 1108 escaping '()[]{}' in filenames.
1104 1109
1105 1110 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1106 1111 Python 2.2 users who lack a proper shlex.split.
1107 1112
1108 1113 2004-07-19 Fernando Perez <fperez@colorado.edu>
1109 1114
1110 1115 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1111 1116 for reading readline's init file. I follow the normal chain:
1112 1117 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1113 1118 report by Mike Heeter. This closes
1114 1119 http://www.scipy.net/roundup/ipython/issue16.
1115 1120
1116 1121 2004-07-18 Fernando Perez <fperez@colorado.edu>
1117 1122
1118 1123 * IPython/iplib.py (__init__): Add better handling of '\' under
1119 1124 Win32 for filenames. After a patch by Ville.
1120 1125
1121 1126 2004-07-17 Fernando Perez <fperez@colorado.edu>
1122 1127
1123 1128 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1124 1129 autocalling would be triggered for 'foo is bar' if foo is
1125 1130 callable. I also cleaned up the autocall detection code to use a
1126 1131 regexp, which is faster. Bug reported by Alexander Schmolck.
1127 1132
1128 1133 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1129 1134 '?' in them would confuse the help system. Reported by Alex
1130 1135 Schmolck.
1131 1136
1132 1137 2004-07-16 Fernando Perez <fperez@colorado.edu>
1133 1138
1134 1139 * IPython/GnuplotInteractive.py (__all__): added plot2.
1135 1140
1136 1141 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1137 1142 plotting dictionaries, lists or tuples of 1d arrays.
1138 1143
1139 1144 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1140 1145 optimizations.
1141 1146
1142 1147 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1143 1148 the information which was there from Janko's original IPP code:
1144 1149
1145 1150 03.05.99 20:53 porto.ifm.uni-kiel.de
1146 1151 --Started changelog.
1147 1152 --make clear do what it say it does
1148 1153 --added pretty output of lines from inputcache
1149 1154 --Made Logger a mixin class, simplifies handling of switches
1150 1155 --Added own completer class. .string<TAB> expands to last history
1151 1156 line which starts with string. The new expansion is also present
1152 1157 with Ctrl-r from the readline library. But this shows, who this
1153 1158 can be done for other cases.
1154 1159 --Added convention that all shell functions should accept a
1155 1160 parameter_string This opens the door for different behaviour for
1156 1161 each function. @cd is a good example of this.
1157 1162
1158 1163 04.05.99 12:12 porto.ifm.uni-kiel.de
1159 1164 --added logfile rotation
1160 1165 --added new mainloop method which freezes first the namespace
1161 1166
1162 1167 07.05.99 21:24 porto.ifm.uni-kiel.de
1163 1168 --added the docreader classes. Now there is a help system.
1164 1169 -This is only a first try. Currently it's not easy to put new
1165 1170 stuff in the indices. But this is the way to go. Info would be
1166 1171 better, but HTML is every where and not everybody has an info
1167 1172 system installed and it's not so easy to change html-docs to info.
1168 1173 --added global logfile option
1169 1174 --there is now a hook for object inspection method pinfo needs to
1170 1175 be provided for this. Can be reached by two '??'.
1171 1176
1172 1177 08.05.99 20:51 porto.ifm.uni-kiel.de
1173 1178 --added a README
1174 1179 --bug in rc file. Something has changed so functions in the rc
1175 1180 file need to reference the shell and not self. Not clear if it's a
1176 1181 bug or feature.
1177 1182 --changed rc file for new behavior
1178 1183
1179 1184 2004-07-15 Fernando Perez <fperez@colorado.edu>
1180 1185
1181 1186 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1182 1187 cache was falling out of sync in bizarre manners when multi-line
1183 1188 input was present. Minor optimizations and cleanup.
1184 1189
1185 1190 (Logger): Remove old Changelog info for cleanup. This is the
1186 1191 information which was there from Janko's original code:
1187 1192
1188 1193 Changes to Logger: - made the default log filename a parameter
1189 1194
1190 1195 - put a check for lines beginning with !@? in log(). Needed
1191 1196 (even if the handlers properly log their lines) for mid-session
1192 1197 logging activation to work properly. Without this, lines logged
1193 1198 in mid session, which get read from the cache, would end up
1194 1199 'bare' (with !@? in the open) in the log. Now they are caught
1195 1200 and prepended with a #.
1196 1201
1197 1202 * IPython/iplib.py (InteractiveShell.init_readline): added check
1198 1203 in case MagicCompleter fails to be defined, so we don't crash.
1199 1204
1200 1205 2004-07-13 Fernando Perez <fperez@colorado.edu>
1201 1206
1202 1207 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1203 1208 of EPS if the requested filename ends in '.eps'.
1204 1209
1205 1210 2004-07-04 Fernando Perez <fperez@colorado.edu>
1206 1211
1207 1212 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1208 1213 escaping of quotes when calling the shell.
1209 1214
1210 1215 2004-07-02 Fernando Perez <fperez@colorado.edu>
1211 1216
1212 1217 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1213 1218 gettext not working because we were clobbering '_'. Fixes
1214 1219 http://www.scipy.net/roundup/ipython/issue6.
1215 1220
1216 1221 2004-07-01 Fernando Perez <fperez@colorado.edu>
1217 1222
1218 1223 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1219 1224 into @cd. Patch by Ville.
1220 1225
1221 1226 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1222 1227 new function to store things after ipmaker runs. Patch by Ville.
1223 1228 Eventually this will go away once ipmaker is removed and the class
1224 1229 gets cleaned up, but for now it's ok. Key functionality here is
1225 1230 the addition of the persistent storage mechanism, a dict for
1226 1231 keeping data across sessions (for now just bookmarks, but more can
1227 1232 be implemented later).
1228 1233
1229 1234 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1230 1235 persistent across sections. Patch by Ville, I modified it
1231 1236 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1232 1237 added a '-l' option to list all bookmarks.
1233 1238
1234 1239 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1235 1240 center for cleanup. Registered with atexit.register(). I moved
1236 1241 here the old exit_cleanup(). After a patch by Ville.
1237 1242
1238 1243 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1239 1244 characters in the hacked shlex_split for python 2.2.
1240 1245
1241 1246 * IPython/iplib.py (file_matches): more fixes to filenames with
1242 1247 whitespace in them. It's not perfect, but limitations in python's
1243 1248 readline make it impossible to go further.
1244 1249
1245 1250 2004-06-29 Fernando Perez <fperez@colorado.edu>
1246 1251
1247 1252 * IPython/iplib.py (file_matches): escape whitespace correctly in
1248 1253 filename completions. Bug reported by Ville.
1249 1254
1250 1255 2004-06-28 Fernando Perez <fperez@colorado.edu>
1251 1256
1252 1257 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1253 1258 the history file will be called 'history-PROFNAME' (or just
1254 1259 'history' if no profile is loaded). I was getting annoyed at
1255 1260 getting my Numerical work history clobbered by pysh sessions.
1256 1261
1257 1262 * IPython/iplib.py (InteractiveShell.__init__): Internal
1258 1263 getoutputerror() function so that we can honor the system_verbose
1259 1264 flag for _all_ system calls. I also added escaping of #
1260 1265 characters here to avoid confusing Itpl.
1261 1266
1262 1267 * IPython/Magic.py (shlex_split): removed call to shell in
1263 1268 parse_options and replaced it with shlex.split(). The annoying
1264 1269 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1265 1270 to backport it from 2.3, with several frail hacks (the shlex
1266 1271 module is rather limited in 2.2). Thanks to a suggestion by Ville
1267 1272 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1268 1273 problem.
1269 1274
1270 1275 (Magic.magic_system_verbose): new toggle to print the actual
1271 1276 system calls made by ipython. Mainly for debugging purposes.
1272 1277
1273 1278 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1274 1279 doesn't support persistence. Reported (and fix suggested) by
1275 1280 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1276 1281
1277 1282 2004-06-26 Fernando Perez <fperez@colorado.edu>
1278 1283
1279 1284 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1280 1285 continue prompts.
1281 1286
1282 1287 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1283 1288 function (basically a big docstring) and a few more things here to
1284 1289 speedup startup. pysh.py is now very lightweight. We want because
1285 1290 it gets execfile'd, while InterpreterExec gets imported, so
1286 1291 byte-compilation saves time.
1287 1292
1288 1293 2004-06-25 Fernando Perez <fperez@colorado.edu>
1289 1294
1290 1295 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1291 1296 -NUM', which was recently broken.
1292 1297
1293 1298 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1294 1299 in multi-line input (but not !!, which doesn't make sense there).
1295 1300
1296 1301 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1297 1302 It's just too useful, and people can turn it off in the less
1298 1303 common cases where it's a problem.
1299 1304
1300 1305 2004-06-24 Fernando Perez <fperez@colorado.edu>
1301 1306
1302 1307 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1303 1308 special syntaxes (like alias calling) is now allied in multi-line
1304 1309 input. This is still _very_ experimental, but it's necessary for
1305 1310 efficient shell usage combining python looping syntax with system
1306 1311 calls. For now it's restricted to aliases, I don't think it
1307 1312 really even makes sense to have this for magics.
1308 1313
1309 1314 2004-06-23 Fernando Perez <fperez@colorado.edu>
1310 1315
1311 1316 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1312 1317 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1313 1318
1314 1319 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1315 1320 extensions under Windows (after code sent by Gary Bishop). The
1316 1321 extensions considered 'executable' are stored in IPython's rc
1317 1322 structure as win_exec_ext.
1318 1323
1319 1324 * IPython/genutils.py (shell): new function, like system() but
1320 1325 without return value. Very useful for interactive shell work.
1321 1326
1322 1327 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1323 1328 delete aliases.
1324 1329
1325 1330 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1326 1331 sure that the alias table doesn't contain python keywords.
1327 1332
1328 1333 2004-06-21 Fernando Perez <fperez@colorado.edu>
1329 1334
1330 1335 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1331 1336 non-existent items are found in $PATH. Reported by Thorsten.
1332 1337
1333 1338 2004-06-20 Fernando Perez <fperez@colorado.edu>
1334 1339
1335 1340 * IPython/iplib.py (complete): modified the completer so that the
1336 1341 order of priorities can be easily changed at runtime.
1337 1342
1338 1343 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1339 1344 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1340 1345
1341 1346 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1342 1347 expand Python variables prepended with $ in all system calls. The
1343 1348 same was done to InteractiveShell.handle_shell_escape. Now all
1344 1349 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1345 1350 expansion of python variables and expressions according to the
1346 1351 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1347 1352
1348 1353 Though PEP-215 has been rejected, a similar (but simpler) one
1349 1354 seems like it will go into Python 2.4, PEP-292 -
1350 1355 http://www.python.org/peps/pep-0292.html.
1351 1356
1352 1357 I'll keep the full syntax of PEP-215, since IPython has since the
1353 1358 start used Ka-Ping Yee's reference implementation discussed there
1354 1359 (Itpl), and I actually like the powerful semantics it offers.
1355 1360
1356 1361 In order to access normal shell variables, the $ has to be escaped
1357 1362 via an extra $. For example:
1358 1363
1359 1364 In [7]: PATH='a python variable'
1360 1365
1361 1366 In [8]: !echo $PATH
1362 1367 a python variable
1363 1368
1364 1369 In [9]: !echo $$PATH
1365 1370 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1366 1371
1367 1372 (Magic.parse_options): escape $ so the shell doesn't evaluate
1368 1373 things prematurely.
1369 1374
1370 1375 * IPython/iplib.py (InteractiveShell.call_alias): added the
1371 1376 ability for aliases to expand python variables via $.
1372 1377
1373 1378 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1374 1379 system, now there's a @rehash/@rehashx pair of magics. These work
1375 1380 like the csh rehash command, and can be invoked at any time. They
1376 1381 build a table of aliases to everything in the user's $PATH
1377 1382 (@rehash uses everything, @rehashx is slower but only adds
1378 1383 executable files). With this, the pysh.py-based shell profile can
1379 1384 now simply call rehash upon startup, and full access to all
1380 1385 programs in the user's path is obtained.
1381 1386
1382 1387 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1383 1388 functionality is now fully in place. I removed the old dynamic
1384 1389 code generation based approach, in favor of a much lighter one
1385 1390 based on a simple dict. The advantage is that this allows me to
1386 1391 now have thousands of aliases with negligible cost (unthinkable
1387 1392 with the old system).
1388 1393
1389 1394 2004-06-19 Fernando Perez <fperez@colorado.edu>
1390 1395
1391 1396 * IPython/iplib.py (__init__): extended MagicCompleter class to
1392 1397 also complete (last in priority) on user aliases.
1393 1398
1394 1399 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1395 1400 call to eval.
1396 1401 (ItplNS.__init__): Added a new class which functions like Itpl,
1397 1402 but allows configuring the namespace for the evaluation to occur
1398 1403 in.
1399 1404
1400 1405 2004-06-18 Fernando Perez <fperez@colorado.edu>
1401 1406
1402 1407 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1403 1408 better message when 'exit' or 'quit' are typed (a common newbie
1404 1409 confusion).
1405 1410
1406 1411 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1407 1412 check for Windows users.
1408 1413
1409 1414 * IPython/iplib.py (InteractiveShell.user_setup): removed
1410 1415 disabling of colors for Windows. I'll test at runtime and issue a
1411 1416 warning if Gary's readline isn't found, as to nudge users to
1412 1417 download it.
1413 1418
1414 1419 2004-06-16 Fernando Perez <fperez@colorado.edu>
1415 1420
1416 1421 * IPython/genutils.py (Stream.__init__): changed to print errors
1417 1422 to sys.stderr. I had a circular dependency here. Now it's
1418 1423 possible to run ipython as IDLE's shell (consider this pre-alpha,
1419 1424 since true stdout things end up in the starting terminal instead
1420 1425 of IDLE's out).
1421 1426
1422 1427 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1423 1428 users who haven't # updated their prompt_in2 definitions. Remove
1424 1429 eventually.
1425 1430 (multiple_replace): added credit to original ASPN recipe.
1426 1431
1427 1432 2004-06-15 Fernando Perez <fperez@colorado.edu>
1428 1433
1429 1434 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1430 1435 list of auto-defined aliases.
1431 1436
1432 1437 2004-06-13 Fernando Perez <fperez@colorado.edu>
1433 1438
1434 1439 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1435 1440 install was really requested (so setup.py can be used for other
1436 1441 things under Windows).
1437 1442
1438 1443 2004-06-10 Fernando Perez <fperez@colorado.edu>
1439 1444
1440 1445 * IPython/Logger.py (Logger.create_log): Manually remove any old
1441 1446 backup, since os.remove may fail under Windows. Fixes bug
1442 1447 reported by Thorsten.
1443 1448
1444 1449 2004-06-09 Fernando Perez <fperez@colorado.edu>
1445 1450
1446 1451 * examples/example-embed.py: fixed all references to %n (replaced
1447 1452 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1448 1453 for all examples and the manual as well.
1449 1454
1450 1455 2004-06-08 Fernando Perez <fperez@colorado.edu>
1451 1456
1452 1457 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1453 1458 alignment and color management. All 3 prompt subsystems now
1454 1459 inherit from BasePrompt.
1455 1460
1456 1461 * tools/release: updates for windows installer build and tag rpms
1457 1462 with python version (since paths are fixed).
1458 1463
1459 1464 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1460 1465 which will become eventually obsolete. Also fixed the default
1461 1466 prompt_in2 to use \D, so at least new users start with the correct
1462 1467 defaults.
1463 1468 WARNING: Users with existing ipythonrc files will need to apply
1464 1469 this fix manually!
1465 1470
1466 1471 * setup.py: make windows installer (.exe). This is finally the
1467 1472 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1468 1473 which I hadn't included because it required Python 2.3 (or recent
1469 1474 distutils).
1470 1475
1471 1476 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1472 1477 usage of new '\D' escape.
1473 1478
1474 1479 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1475 1480 lacks os.getuid())
1476 1481 (CachedOutput.set_colors): Added the ability to turn coloring
1477 1482 on/off with @colors even for manually defined prompt colors. It
1478 1483 uses a nasty global, but it works safely and via the generic color
1479 1484 handling mechanism.
1480 1485 (Prompt2.__init__): Introduced new escape '\D' for continuation
1481 1486 prompts. It represents the counter ('\#') as dots.
1482 1487 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1483 1488 need to update their ipythonrc files and replace '%n' with '\D' in
1484 1489 their prompt_in2 settings everywhere. Sorry, but there's
1485 1490 otherwise no clean way to get all prompts to properly align. The
1486 1491 ipythonrc shipped with IPython has been updated.
1487 1492
1488 1493 2004-06-07 Fernando Perez <fperez@colorado.edu>
1489 1494
1490 1495 * setup.py (isfile): Pass local_icons option to latex2html, so the
1491 1496 resulting HTML file is self-contained. Thanks to
1492 1497 dryice-AT-liu.com.cn for the tip.
1493 1498
1494 1499 * pysh.py: I created a new profile 'shell', which implements a
1495 1500 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1496 1501 system shell, nor will it become one anytime soon. It's mainly
1497 1502 meant to illustrate the use of the new flexible bash-like prompts.
1498 1503 I guess it could be used by hardy souls for true shell management,
1499 1504 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1500 1505 profile. This uses the InterpreterExec extension provided by
1501 1506 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1502 1507
1503 1508 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1504 1509 auto-align itself with the length of the previous input prompt
1505 1510 (taking into account the invisible color escapes).
1506 1511 (CachedOutput.__init__): Large restructuring of this class. Now
1507 1512 all three prompts (primary1, primary2, output) are proper objects,
1508 1513 managed by the 'parent' CachedOutput class. The code is still a
1509 1514 bit hackish (all prompts share state via a pointer to the cache),
1510 1515 but it's overall far cleaner than before.
1511 1516
1512 1517 * IPython/genutils.py (getoutputerror): modified to add verbose,
1513 1518 debug and header options. This makes the interface of all getout*
1514 1519 functions uniform.
1515 1520 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1516 1521
1517 1522 * IPython/Magic.py (Magic.default_option): added a function to
1518 1523 allow registering default options for any magic command. This
1519 1524 makes it easy to have profiles which customize the magics globally
1520 1525 for a certain use. The values set through this function are
1521 1526 picked up by the parse_options() method, which all magics should
1522 1527 use to parse their options.
1523 1528
1524 1529 * IPython/genutils.py (warn): modified the warnings framework to
1525 1530 use the Term I/O class. I'm trying to slowly unify all of
1526 1531 IPython's I/O operations to pass through Term.
1527 1532
1528 1533 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1529 1534 the secondary prompt to correctly match the length of the primary
1530 1535 one for any prompt. Now multi-line code will properly line up
1531 1536 even for path dependent prompts, such as the new ones available
1532 1537 via the prompt_specials.
1533 1538
1534 1539 2004-06-06 Fernando Perez <fperez@colorado.edu>
1535 1540
1536 1541 * IPython/Prompts.py (prompt_specials): Added the ability to have
1537 1542 bash-like special sequences in the prompts, which get
1538 1543 automatically expanded. Things like hostname, current working
1539 1544 directory and username are implemented already, but it's easy to
1540 1545 add more in the future. Thanks to a patch by W.J. van der Laan
1541 1546 <gnufnork-AT-hetdigitalegat.nl>
1542 1547 (prompt_specials): Added color support for prompt strings, so
1543 1548 users can define arbitrary color setups for their prompts.
1544 1549
1545 1550 2004-06-05 Fernando Perez <fperez@colorado.edu>
1546 1551
1547 1552 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1548 1553 code to load Gary Bishop's readline and configure it
1549 1554 automatically. Thanks to Gary for help on this.
1550 1555
1551 1556 2004-06-01 Fernando Perez <fperez@colorado.edu>
1552 1557
1553 1558 * IPython/Logger.py (Logger.create_log): fix bug for logging
1554 1559 with no filename (previous fix was incomplete).
1555 1560
1556 1561 2004-05-25 Fernando Perez <fperez@colorado.edu>
1557 1562
1558 1563 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1559 1564 parens would get passed to the shell.
1560 1565
1561 1566 2004-05-20 Fernando Perez <fperez@colorado.edu>
1562 1567
1563 1568 * IPython/Magic.py (Magic.magic_prun): changed default profile
1564 1569 sort order to 'time' (the more common profiling need).
1565 1570
1566 1571 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1567 1572 so that source code shown is guaranteed in sync with the file on
1568 1573 disk (also changed in psource). Similar fix to the one for
1569 1574 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1570 1575 <yann.ledu-AT-noos.fr>.
1571 1576
1572 1577 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1573 1578 with a single option would not be correctly parsed. Closes
1574 1579 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1575 1580 introduced in 0.6.0 (on 2004-05-06).
1576 1581
1577 1582 2004-05-13 *** Released version 0.6.0
1578 1583
1579 1584 2004-05-13 Fernando Perez <fperez@colorado.edu>
1580 1585
1581 1586 * debian/: Added debian/ directory to CVS, so that debian support
1582 1587 is publicly accessible. The debian package is maintained by Jack
1583 1588 Moffit <jack-AT-xiph.org>.
1584 1589
1585 1590 * Documentation: included the notes about an ipython-based system
1586 1591 shell (the hypothetical 'pysh') into the new_design.pdf document,
1587 1592 so that these ideas get distributed to users along with the
1588 1593 official documentation.
1589 1594
1590 1595 2004-05-10 Fernando Perez <fperez@colorado.edu>
1591 1596
1592 1597 * IPython/Logger.py (Logger.create_log): fix recently introduced
1593 1598 bug (misindented line) where logstart would fail when not given an
1594 1599 explicit filename.
1595 1600
1596 1601 2004-05-09 Fernando Perez <fperez@colorado.edu>
1597 1602
1598 1603 * IPython/Magic.py (Magic.parse_options): skip system call when
1599 1604 there are no options to look for. Faster, cleaner for the common
1600 1605 case.
1601 1606
1602 1607 * Documentation: many updates to the manual: describing Windows
1603 1608 support better, Gnuplot updates, credits, misc small stuff. Also
1604 1609 updated the new_design doc a bit.
1605 1610
1606 1611 2004-05-06 *** Released version 0.6.0.rc1
1607 1612
1608 1613 2004-05-06 Fernando Perez <fperez@colorado.edu>
1609 1614
1610 1615 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1611 1616 operations to use the vastly more efficient list/''.join() method.
1612 1617 (FormattedTB.text): Fix
1613 1618 http://www.scipy.net/roundup/ipython/issue12 - exception source
1614 1619 extract not updated after reload. Thanks to Mike Salib
1615 1620 <msalib-AT-mit.edu> for pinning the source of the problem.
1616 1621 Fortunately, the solution works inside ipython and doesn't require
1617 1622 any changes to python proper.
1618 1623
1619 1624 * IPython/Magic.py (Magic.parse_options): Improved to process the
1620 1625 argument list as a true shell would (by actually using the
1621 1626 underlying system shell). This way, all @magics automatically get
1622 1627 shell expansion for variables. Thanks to a comment by Alex
1623 1628 Schmolck.
1624 1629
1625 1630 2004-04-04 Fernando Perez <fperez@colorado.edu>
1626 1631
1627 1632 * IPython/iplib.py (InteractiveShell.interact): Added a special
1628 1633 trap for a debugger quit exception, which is basically impossible
1629 1634 to handle by normal mechanisms, given what pdb does to the stack.
1630 1635 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1631 1636
1632 1637 2004-04-03 Fernando Perez <fperez@colorado.edu>
1633 1638
1634 1639 * IPython/genutils.py (Term): Standardized the names of the Term
1635 1640 class streams to cin/cout/cerr, following C++ naming conventions
1636 1641 (I can't use in/out/err because 'in' is not a valid attribute
1637 1642 name).
1638 1643
1639 1644 * IPython/iplib.py (InteractiveShell.interact): don't increment
1640 1645 the prompt if there's no user input. By Daniel 'Dang' Griffith
1641 1646 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1642 1647 Francois Pinard.
1643 1648
1644 1649 2004-04-02 Fernando Perez <fperez@colorado.edu>
1645 1650
1646 1651 * IPython/genutils.py (Stream.__init__): Modified to survive at
1647 1652 least importing in contexts where stdin/out/err aren't true file
1648 1653 objects, such as PyCrust (they lack fileno() and mode). However,
1649 1654 the recovery facilities which rely on these things existing will
1650 1655 not work.
1651 1656
1652 1657 2004-04-01 Fernando Perez <fperez@colorado.edu>
1653 1658
1654 1659 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1655 1660 use the new getoutputerror() function, so it properly
1656 1661 distinguishes stdout/err.
1657 1662
1658 1663 * IPython/genutils.py (getoutputerror): added a function to
1659 1664 capture separately the standard output and error of a command.
1660 1665 After a comment from dang on the mailing lists. This code is
1661 1666 basically a modified version of commands.getstatusoutput(), from
1662 1667 the standard library.
1663 1668
1664 1669 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1665 1670 '!!' as a special syntax (shorthand) to access @sx.
1666 1671
1667 1672 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1668 1673 command and return its output as a list split on '\n'.
1669 1674
1670 1675 2004-03-31 Fernando Perez <fperez@colorado.edu>
1671 1676
1672 1677 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1673 1678 method to dictionaries used as FakeModule instances if they lack
1674 1679 it. At least pydoc in python2.3 breaks for runtime-defined
1675 1680 functions without this hack. At some point I need to _really_
1676 1681 understand what FakeModule is doing, because it's a gross hack.
1677 1682 But it solves Arnd's problem for now...
1678 1683
1679 1684 2004-02-27 Fernando Perez <fperez@colorado.edu>
1680 1685
1681 1686 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1682 1687 mode would behave erratically. Also increased the number of
1683 1688 possible logs in rotate mod to 999. Thanks to Rod Holland
1684 1689 <rhh@StructureLABS.com> for the report and fixes.
1685 1690
1686 1691 2004-02-26 Fernando Perez <fperez@colorado.edu>
1687 1692
1688 1693 * IPython/genutils.py (page): Check that the curses module really
1689 1694 has the initscr attribute before trying to use it. For some
1690 1695 reason, the Solaris curses module is missing this. I think this
1691 1696 should be considered a Solaris python bug, but I'm not sure.
1692 1697
1693 1698 2004-01-17 Fernando Perez <fperez@colorado.edu>
1694 1699
1695 1700 * IPython/genutils.py (Stream.__init__): Changes to try to make
1696 1701 ipython robust against stdin/out/err being closed by the user.
1697 1702 This is 'user error' (and blocks a normal python session, at least
1698 1703 the stdout case). However, Ipython should be able to survive such
1699 1704 instances of abuse as gracefully as possible. To simplify the
1700 1705 coding and maintain compatibility with Gary Bishop's Term
1701 1706 contributions, I've made use of classmethods for this. I think
1702 1707 this introduces a dependency on python 2.2.
1703 1708
1704 1709 2004-01-13 Fernando Perez <fperez@colorado.edu>
1705 1710
1706 1711 * IPython/numutils.py (exp_safe): simplified the code a bit and
1707 1712 removed the need for importing the kinds module altogether.
1708 1713
1709 1714 2004-01-06 Fernando Perez <fperez@colorado.edu>
1710 1715
1711 1716 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1712 1717 a magic function instead, after some community feedback. No
1713 1718 special syntax will exist for it, but its name is deliberately
1714 1719 very short.
1715 1720
1716 1721 2003-12-20 Fernando Perez <fperez@colorado.edu>
1717 1722
1718 1723 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1719 1724 new functionality, to automagically assign the result of a shell
1720 1725 command to a variable. I'll solicit some community feedback on
1721 1726 this before making it permanent.
1722 1727
1723 1728 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1724 1729 requested about callables for which inspect couldn't obtain a
1725 1730 proper argspec. Thanks to a crash report sent by Etienne
1726 1731 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1727 1732
1728 1733 2003-12-09 Fernando Perez <fperez@colorado.edu>
1729 1734
1730 1735 * IPython/genutils.py (page): patch for the pager to work across
1731 1736 various versions of Windows. By Gary Bishop.
1732 1737
1733 1738 2003-12-04 Fernando Perez <fperez@colorado.edu>
1734 1739
1735 1740 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1736 1741 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1737 1742 While I tested this and it looks ok, there may still be corner
1738 1743 cases I've missed.
1739 1744
1740 1745 2003-12-01 Fernando Perez <fperez@colorado.edu>
1741 1746
1742 1747 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1743 1748 where a line like 'p,q=1,2' would fail because the automagic
1744 1749 system would be triggered for @p.
1745 1750
1746 1751 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1747 1752 cleanups, code unmodified.
1748 1753
1749 1754 * IPython/genutils.py (Term): added a class for IPython to handle
1750 1755 output. In most cases it will just be a proxy for stdout/err, but
1751 1756 having this allows modifications to be made for some platforms,
1752 1757 such as handling color escapes under Windows. All of this code
1753 1758 was contributed by Gary Bishop, with minor modifications by me.
1754 1759 The actual changes affect many files.
1755 1760
1756 1761 2003-11-30 Fernando Perez <fperez@colorado.edu>
1757 1762
1758 1763 * IPython/iplib.py (file_matches): new completion code, courtesy
1759 1764 of Jeff Collins. This enables filename completion again under
1760 1765 python 2.3, which disabled it at the C level.
1761 1766
1762 1767 2003-11-11 Fernando Perez <fperez@colorado.edu>
1763 1768
1764 1769 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1765 1770 for Numeric.array(map(...)), but often convenient.
1766 1771
1767 1772 2003-11-05 Fernando Perez <fperez@colorado.edu>
1768 1773
1769 1774 * IPython/numutils.py (frange): Changed a call from int() to
1770 1775 int(round()) to prevent a problem reported with arange() in the
1771 1776 numpy list.
1772 1777
1773 1778 2003-10-06 Fernando Perez <fperez@colorado.edu>
1774 1779
1775 1780 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1776 1781 prevent crashes if sys lacks an argv attribute (it happens with
1777 1782 embedded interpreters which build a bare-bones sys module).
1778 1783 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1779 1784
1780 1785 2003-09-24 Fernando Perez <fperez@colorado.edu>
1781 1786
1782 1787 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1783 1788 to protect against poorly written user objects where __getattr__
1784 1789 raises exceptions other than AttributeError. Thanks to a bug
1785 1790 report by Oliver Sander <osander-AT-gmx.de>.
1786 1791
1787 1792 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1788 1793 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1789 1794
1790 1795 2003-09-09 Fernando Perez <fperez@colorado.edu>
1791 1796
1792 1797 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1793 1798 unpacking a list whith a callable as first element would
1794 1799 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1795 1800 Collins.
1796 1801
1797 1802 2003-08-25 *** Released version 0.5.0
1798 1803
1799 1804 2003-08-22 Fernando Perez <fperez@colorado.edu>
1800 1805
1801 1806 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1802 1807 improperly defined user exceptions. Thanks to feedback from Mark
1803 1808 Russell <mrussell-AT-verio.net>.
1804 1809
1805 1810 2003-08-20 Fernando Perez <fperez@colorado.edu>
1806 1811
1807 1812 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1808 1813 printing so that it would print multi-line string forms starting
1809 1814 with a new line. This way the formatting is better respected for
1810 1815 objects which work hard to make nice string forms.
1811 1816
1812 1817 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1813 1818 autocall would overtake data access for objects with both
1814 1819 __getitem__ and __call__.
1815 1820
1816 1821 2003-08-19 *** Released version 0.5.0-rc1
1817 1822
1818 1823 2003-08-19 Fernando Perez <fperez@colorado.edu>
1819 1824
1820 1825 * IPython/deep_reload.py (load_tail): single tiny change here
1821 1826 seems to fix the long-standing bug of dreload() failing to work
1822 1827 for dotted names. But this module is pretty tricky, so I may have
1823 1828 missed some subtlety. Needs more testing!.
1824 1829
1825 1830 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1826 1831 exceptions which have badly implemented __str__ methods.
1827 1832 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1828 1833 which I've been getting reports about from Python 2.3 users. I
1829 1834 wish I had a simple test case to reproduce the problem, so I could
1830 1835 either write a cleaner workaround or file a bug report if
1831 1836 necessary.
1832 1837
1833 1838 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1834 1839 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1835 1840 a bug report by Tjabo Kloppenburg.
1836 1841
1837 1842 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1838 1843 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1839 1844 seems rather unstable. Thanks to a bug report by Tjabo
1840 1845 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1841 1846
1842 1847 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1843 1848 this out soon because of the critical fixes in the inner loop for
1844 1849 generators.
1845 1850
1846 1851 * IPython/Magic.py (Magic.getargspec): removed. This (and
1847 1852 _get_def) have been obsoleted by OInspect for a long time, I
1848 1853 hadn't noticed that they were dead code.
1849 1854 (Magic._ofind): restored _ofind functionality for a few literals
1850 1855 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1851 1856 for things like "hello".capitalize?, since that would require a
1852 1857 potentially dangerous eval() again.
1853 1858
1854 1859 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1855 1860 logic a bit more to clean up the escapes handling and minimize the
1856 1861 use of _ofind to only necessary cases. The interactive 'feel' of
1857 1862 IPython should have improved quite a bit with the changes in
1858 1863 _prefilter and _ofind (besides being far safer than before).
1859 1864
1860 1865 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1861 1866 obscure, never reported). Edit would fail to find the object to
1862 1867 edit under some circumstances.
1863 1868 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1864 1869 which were causing double-calling of generators. Those eval calls
1865 1870 were _very_ dangerous, since code with side effects could be
1866 1871 triggered. As they say, 'eval is evil'... These were the
1867 1872 nastiest evals in IPython. Besides, _ofind is now far simpler,
1868 1873 and it should also be quite a bit faster. Its use of inspect is
1869 1874 also safer, so perhaps some of the inspect-related crashes I've
1870 1875 seen lately with Python 2.3 might be taken care of. That will
1871 1876 need more testing.
1872 1877
1873 1878 2003-08-17 Fernando Perez <fperez@colorado.edu>
1874 1879
1875 1880 * IPython/iplib.py (InteractiveShell._prefilter): significant
1876 1881 simplifications to the logic for handling user escapes. Faster
1877 1882 and simpler code.
1878 1883
1879 1884 2003-08-14 Fernando Perez <fperez@colorado.edu>
1880 1885
1881 1886 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
1882 1887 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
1883 1888 but it should be quite a bit faster. And the recursive version
1884 1889 generated O(log N) intermediate storage for all rank>1 arrays,
1885 1890 even if they were contiguous.
1886 1891 (l1norm): Added this function.
1887 1892 (norm): Added this function for arbitrary norms (including
1888 1893 l-infinity). l1 and l2 are still special cases for convenience
1889 1894 and speed.
1890 1895
1891 1896 2003-08-03 Fernando Perez <fperez@colorado.edu>
1892 1897
1893 1898 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
1894 1899 exceptions, which now raise PendingDeprecationWarnings in Python
1895 1900 2.3. There were some in Magic and some in Gnuplot2.
1896 1901
1897 1902 2003-06-30 Fernando Perez <fperez@colorado.edu>
1898 1903
1899 1904 * IPython/genutils.py (page): modified to call curses only for
1900 1905 terminals where TERM=='xterm'. After problems under many other
1901 1906 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
1902 1907
1903 1908 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
1904 1909 would be triggered when readline was absent. This was just an old
1905 1910 debugging statement I'd forgotten to take out.
1906 1911
1907 1912 2003-06-20 Fernando Perez <fperez@colorado.edu>
1908 1913
1909 1914 * IPython/genutils.py (clock): modified to return only user time
1910 1915 (not counting system time), after a discussion on scipy. While
1911 1916 system time may be a useful quantity occasionally, it may much
1912 1917 more easily be skewed by occasional swapping or other similar
1913 1918 activity.
1914 1919
1915 1920 2003-06-05 Fernando Perez <fperez@colorado.edu>
1916 1921
1917 1922 * IPython/numutils.py (identity): new function, for building
1918 1923 arbitrary rank Kronecker deltas (mostly backwards compatible with
1919 1924 Numeric.identity)
1920 1925
1921 1926 2003-06-03 Fernando Perez <fperez@colorado.edu>
1922 1927
1923 1928 * IPython/iplib.py (InteractiveShell.handle_magic): protect
1924 1929 arguments passed to magics with spaces, to allow trailing '\' to
1925 1930 work normally (mainly for Windows users).
1926 1931
1927 1932 2003-05-29 Fernando Perez <fperez@colorado.edu>
1928 1933
1929 1934 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
1930 1935 instead of pydoc.help. This fixes a bizarre behavior where
1931 1936 printing '%s' % locals() would trigger the help system. Now
1932 1937 ipython behaves like normal python does.
1933 1938
1934 1939 Note that if one does 'from pydoc import help', the bizarre
1935 1940 behavior returns, but this will also happen in normal python, so
1936 1941 it's not an ipython bug anymore (it has to do with how pydoc.help
1937 1942 is implemented).
1938 1943
1939 1944 2003-05-22 Fernando Perez <fperez@colorado.edu>
1940 1945
1941 1946 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
1942 1947 return [] instead of None when nothing matches, also match to end
1943 1948 of line. Patch by Gary Bishop.
1944 1949
1945 1950 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
1946 1951 protection as before, for files passed on the command line. This
1947 1952 prevents the CrashHandler from kicking in if user files call into
1948 1953 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
1949 1954 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
1950 1955
1951 1956 2003-05-20 *** Released version 0.4.0
1952 1957
1953 1958 2003-05-20 Fernando Perez <fperez@colorado.edu>
1954 1959
1955 1960 * setup.py: added support for manpages. It's a bit hackish b/c of
1956 1961 a bug in the way the bdist_rpm distutils target handles gzipped
1957 1962 manpages, but it works. After a patch by Jack.
1958 1963
1959 1964 2003-05-19 Fernando Perez <fperez@colorado.edu>
1960 1965
1961 1966 * IPython/numutils.py: added a mockup of the kinds module, since
1962 1967 it was recently removed from Numeric. This way, numutils will
1963 1968 work for all users even if they are missing kinds.
1964 1969
1965 1970 * IPython/Magic.py (Magic._ofind): Harden against an inspect
1966 1971 failure, which can occur with SWIG-wrapped extensions. After a
1967 1972 crash report from Prabhu.
1968 1973
1969 1974 2003-05-16 Fernando Perez <fperez@colorado.edu>
1970 1975
1971 1976 * IPython/iplib.py (InteractiveShell.excepthook): New method to
1972 1977 protect ipython from user code which may call directly
1973 1978 sys.excepthook (this looks like an ipython crash to the user, even
1974 1979 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
1975 1980 This is especially important to help users of WxWindows, but may
1976 1981 also be useful in other cases.
1977 1982
1978 1983 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
1979 1984 an optional tb_offset to be specified, and to preserve exception
1980 1985 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
1981 1986
1982 1987 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
1983 1988
1984 1989 2003-05-15 Fernando Perez <fperez@colorado.edu>
1985 1990
1986 1991 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
1987 1992 installing for a new user under Windows.
1988 1993
1989 1994 2003-05-12 Fernando Perez <fperez@colorado.edu>
1990 1995
1991 1996 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
1992 1997 handler for Emacs comint-based lines. Currently it doesn't do
1993 1998 much (but importantly, it doesn't update the history cache). In
1994 1999 the future it may be expanded if Alex needs more functionality
1995 2000 there.
1996 2001
1997 2002 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
1998 2003 info to crash reports.
1999 2004
2000 2005 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2001 2006 just like Python's -c. Also fixed crash with invalid -color
2002 2007 option value at startup. Thanks to Will French
2003 2008 <wfrench-AT-bestweb.net> for the bug report.
2004 2009
2005 2010 2003-05-09 Fernando Perez <fperez@colorado.edu>
2006 2011
2007 2012 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2008 2013 to EvalDict (it's a mapping, after all) and simplified its code
2009 2014 quite a bit, after a nice discussion on c.l.py where Gustavo
2010 2015 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2011 2016
2012 2017 2003-04-30 Fernando Perez <fperez@colorado.edu>
2013 2018
2014 2019 * IPython/genutils.py (timings_out): modified it to reduce its
2015 2020 overhead in the common reps==1 case.
2016 2021
2017 2022 2003-04-29 Fernando Perez <fperez@colorado.edu>
2018 2023
2019 2024 * IPython/genutils.py (timings_out): Modified to use the resource
2020 2025 module, which avoids the wraparound problems of time.clock().
2021 2026
2022 2027 2003-04-17 *** Released version 0.2.15pre4
2023 2028
2024 2029 2003-04-17 Fernando Perez <fperez@colorado.edu>
2025 2030
2026 2031 * setup.py (scriptfiles): Split windows-specific stuff over to a
2027 2032 separate file, in an attempt to have a Windows GUI installer.
2028 2033 That didn't work, but part of the groundwork is done.
2029 2034
2030 2035 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2031 2036 indent/unindent with 4 spaces. Particularly useful in combination
2032 2037 with the new auto-indent option.
2033 2038
2034 2039 2003-04-16 Fernando Perez <fperez@colorado.edu>
2035 2040
2036 2041 * IPython/Magic.py: various replacements of self.rc for
2037 2042 self.shell.rc. A lot more remains to be done to fully disentangle
2038 2043 this class from the main Shell class.
2039 2044
2040 2045 * IPython/GnuplotRuntime.py: added checks for mouse support so
2041 2046 that we don't try to enable it if the current gnuplot doesn't
2042 2047 really support it. Also added checks so that we don't try to
2043 2048 enable persist under Windows (where Gnuplot doesn't recognize the
2044 2049 option).
2045 2050
2046 2051 * IPython/iplib.py (InteractiveShell.interact): Added optional
2047 2052 auto-indenting code, after a patch by King C. Shu
2048 2053 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2049 2054 get along well with pasting indented code. If I ever figure out
2050 2055 how to make that part go well, it will become on by default.
2051 2056
2052 2057 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2053 2058 crash ipython if there was an unmatched '%' in the user's prompt
2054 2059 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2055 2060
2056 2061 * IPython/iplib.py (InteractiveShell.interact): removed the
2057 2062 ability to ask the user whether he wants to crash or not at the
2058 2063 'last line' exception handler. Calling functions at that point
2059 2064 changes the stack, and the error reports would have incorrect
2060 2065 tracebacks.
2061 2066
2062 2067 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2063 2068 pass through a peger a pretty-printed form of any object. After a
2064 2069 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2065 2070
2066 2071 2003-04-14 Fernando Perez <fperez@colorado.edu>
2067 2072
2068 2073 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2069 2074 all files in ~ would be modified at first install (instead of
2070 2075 ~/.ipython). This could be potentially disastrous, as the
2071 2076 modification (make line-endings native) could damage binary files.
2072 2077
2073 2078 2003-04-10 Fernando Perez <fperez@colorado.edu>
2074 2079
2075 2080 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2076 2081 handle only lines which are invalid python. This now means that
2077 2082 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2078 2083 for the bug report.
2079 2084
2080 2085 2003-04-01 Fernando Perez <fperez@colorado.edu>
2081 2086
2082 2087 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2083 2088 where failing to set sys.last_traceback would crash pdb.pm().
2084 2089 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2085 2090 report.
2086 2091
2087 2092 2003-03-25 Fernando Perez <fperez@colorado.edu>
2088 2093
2089 2094 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2090 2095 before printing it (it had a lot of spurious blank lines at the
2091 2096 end).
2092 2097
2093 2098 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2094 2099 output would be sent 21 times! Obviously people don't use this
2095 2100 too often, or I would have heard about it.
2096 2101
2097 2102 2003-03-24 Fernando Perez <fperez@colorado.edu>
2098 2103
2099 2104 * setup.py (scriptfiles): renamed the data_files parameter from
2100 2105 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2101 2106 for the patch.
2102 2107
2103 2108 2003-03-20 Fernando Perez <fperez@colorado.edu>
2104 2109
2105 2110 * IPython/genutils.py (error): added error() and fatal()
2106 2111 functions.
2107 2112
2108 2113 2003-03-18 *** Released version 0.2.15pre3
2109 2114
2110 2115 2003-03-18 Fernando Perez <fperez@colorado.edu>
2111 2116
2112 2117 * setupext/install_data_ext.py
2113 2118 (install_data_ext.initialize_options): Class contributed by Jack
2114 2119 Moffit for fixing the old distutils hack. He is sending this to
2115 2120 the distutils folks so in the future we may not need it as a
2116 2121 private fix.
2117 2122
2118 2123 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2119 2124 changes for Debian packaging. See his patch for full details.
2120 2125 The old distutils hack of making the ipythonrc* files carry a
2121 2126 bogus .py extension is gone, at last. Examples were moved to a
2122 2127 separate subdir under doc/, and the separate executable scripts
2123 2128 now live in their own directory. Overall a great cleanup. The
2124 2129 manual was updated to use the new files, and setup.py has been
2125 2130 fixed for this setup.
2126 2131
2127 2132 * IPython/PyColorize.py (Parser.usage): made non-executable and
2128 2133 created a pycolor wrapper around it to be included as a script.
2129 2134
2130 2135 2003-03-12 *** Released version 0.2.15pre2
2131 2136
2132 2137 2003-03-12 Fernando Perez <fperez@colorado.edu>
2133 2138
2134 2139 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2135 2140 long-standing problem with garbage characters in some terminals.
2136 2141 The issue was really that the \001 and \002 escapes must _only_ be
2137 2142 passed to input prompts (which call readline), but _never_ to
2138 2143 normal text to be printed on screen. I changed ColorANSI to have
2139 2144 two classes: TermColors and InputTermColors, each with the
2140 2145 appropriate escapes for input prompts or normal text. The code in
2141 2146 Prompts.py got slightly more complicated, but this very old and
2142 2147 annoying bug is finally fixed.
2143 2148
2144 2149 All the credit for nailing down the real origin of this problem
2145 2150 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2146 2151 *Many* thanks to him for spending quite a bit of effort on this.
2147 2152
2148 2153 2003-03-05 *** Released version 0.2.15pre1
2149 2154
2150 2155 2003-03-03 Fernando Perez <fperez@colorado.edu>
2151 2156
2152 2157 * IPython/FakeModule.py: Moved the former _FakeModule to a
2153 2158 separate file, because it's also needed by Magic (to fix a similar
2154 2159 pickle-related issue in @run).
2155 2160
2156 2161 2003-03-02 Fernando Perez <fperez@colorado.edu>
2157 2162
2158 2163 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2159 2164 the autocall option at runtime.
2160 2165 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2161 2166 across Magic.py to start separating Magic from InteractiveShell.
2162 2167 (Magic._ofind): Fixed to return proper namespace for dotted
2163 2168 names. Before, a dotted name would always return 'not currently
2164 2169 defined', because it would find the 'parent'. s.x would be found,
2165 2170 but since 'x' isn't defined by itself, it would get confused.
2166 2171 (Magic.magic_run): Fixed pickling problems reported by Ralf
2167 2172 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2168 2173 that I'd used when Mike Heeter reported similar issues at the
2169 2174 top-level, but now for @run. It boils down to injecting the
2170 2175 namespace where code is being executed with something that looks
2171 2176 enough like a module to fool pickle.dump(). Since a pickle stores
2172 2177 a named reference to the importing module, we need this for
2173 2178 pickles to save something sensible.
2174 2179
2175 2180 * IPython/ipmaker.py (make_IPython): added an autocall option.
2176 2181
2177 2182 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2178 2183 the auto-eval code. Now autocalling is an option, and the code is
2179 2184 also vastly safer. There is no more eval() involved at all.
2180 2185
2181 2186 2003-03-01 Fernando Perez <fperez@colorado.edu>
2182 2187
2183 2188 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2184 2189 dict with named keys instead of a tuple.
2185 2190
2186 2191 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2187 2192
2188 2193 * setup.py (make_shortcut): Fixed message about directories
2189 2194 created during Windows installation (the directories were ok, just
2190 2195 the printed message was misleading). Thanks to Chris Liechti
2191 2196 <cliechti-AT-gmx.net> for the heads up.
2192 2197
2193 2198 2003-02-21 Fernando Perez <fperez@colorado.edu>
2194 2199
2195 2200 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2196 2201 of ValueError exception when checking for auto-execution. This
2197 2202 one is raised by things like Numeric arrays arr.flat when the
2198 2203 array is non-contiguous.
2199 2204
2200 2205 2003-01-31 Fernando Perez <fperez@colorado.edu>
2201 2206
2202 2207 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2203 2208 not return any value at all (even though the command would get
2204 2209 executed).
2205 2210 (xsys): Flush stdout right after printing the command to ensure
2206 2211 proper ordering of commands and command output in the total
2207 2212 output.
2208 2213 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2209 2214 system/getoutput as defaults. The old ones are kept for
2210 2215 compatibility reasons, so no code which uses this library needs
2211 2216 changing.
2212 2217
2213 2218 2003-01-27 *** Released version 0.2.14
2214 2219
2215 2220 2003-01-25 Fernando Perez <fperez@colorado.edu>
2216 2221
2217 2222 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2218 2223 functions defined in previous edit sessions could not be re-edited
2219 2224 (because the temp files were immediately removed). Now temp files
2220 2225 are removed only at IPython's exit.
2221 2226 (Magic.magic_run): Improved @run to perform shell-like expansions
2222 2227 on its arguments (~users and $VARS). With this, @run becomes more
2223 2228 like a normal command-line.
2224 2229
2225 2230 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2226 2231 bugs related to embedding and cleaned up that code. A fairly
2227 2232 important one was the impossibility to access the global namespace
2228 2233 through the embedded IPython (only local variables were visible).
2229 2234
2230 2235 2003-01-14 Fernando Perez <fperez@colorado.edu>
2231 2236
2232 2237 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2233 2238 auto-calling to be a bit more conservative. Now it doesn't get
2234 2239 triggered if any of '!=()<>' are in the rest of the input line, to
2235 2240 allow comparing callables. Thanks to Alex for the heads up.
2236 2241
2237 2242 2003-01-07 Fernando Perez <fperez@colorado.edu>
2238 2243
2239 2244 * IPython/genutils.py (page): fixed estimation of the number of
2240 2245 lines in a string to be paged to simply count newlines. This
2241 2246 prevents over-guessing due to embedded escape sequences. A better
2242 2247 long-term solution would involve stripping out the control chars
2243 2248 for the count, but it's potentially so expensive I just don't
2244 2249 think it's worth doing.
2245 2250
2246 2251 2002-12-19 *** Released version 0.2.14pre50
2247 2252
2248 2253 2002-12-19 Fernando Perez <fperez@colorado.edu>
2249 2254
2250 2255 * tools/release (version): Changed release scripts to inform
2251 2256 Andrea and build a NEWS file with a list of recent changes.
2252 2257
2253 2258 * IPython/ColorANSI.py (__all__): changed terminal detection
2254 2259 code. Seems to work better for xterms without breaking
2255 2260 konsole. Will need more testing to determine if WinXP and Mac OSX
2256 2261 also work ok.
2257 2262
2258 2263 2002-12-18 *** Released version 0.2.14pre49
2259 2264
2260 2265 2002-12-18 Fernando Perez <fperez@colorado.edu>
2261 2266
2262 2267 * Docs: added new info about Mac OSX, from Andrea.
2263 2268
2264 2269 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2265 2270 allow direct plotting of python strings whose format is the same
2266 2271 of gnuplot data files.
2267 2272
2268 2273 2002-12-16 Fernando Perez <fperez@colorado.edu>
2269 2274
2270 2275 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2271 2276 value of exit question to be acknowledged.
2272 2277
2273 2278 2002-12-03 Fernando Perez <fperez@colorado.edu>
2274 2279
2275 2280 * IPython/ipmaker.py: removed generators, which had been added
2276 2281 by mistake in an earlier debugging run. This was causing trouble
2277 2282 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2278 2283 for pointing this out.
2279 2284
2280 2285 2002-11-17 Fernando Perez <fperez@colorado.edu>
2281 2286
2282 2287 * Manual: updated the Gnuplot section.
2283 2288
2284 2289 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2285 2290 a much better split of what goes in Runtime and what goes in
2286 2291 Interactive.
2287 2292
2288 2293 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2289 2294 being imported from iplib.
2290 2295
2291 2296 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2292 2297 for command-passing. Now the global Gnuplot instance is called
2293 2298 'gp' instead of 'g', which was really a far too fragile and
2294 2299 common name.
2295 2300
2296 2301 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2297 2302 bounding boxes generated by Gnuplot for square plots.
2298 2303
2299 2304 * IPython/genutils.py (popkey): new function added. I should
2300 2305 suggest this on c.l.py as a dict method, it seems useful.
2301 2306
2302 2307 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2303 2308 to transparently handle PostScript generation. MUCH better than
2304 2309 the previous plot_eps/replot_eps (which I removed now). The code
2305 2310 is also fairly clean and well documented now (including
2306 2311 docstrings).
2307 2312
2308 2313 2002-11-13 Fernando Perez <fperez@colorado.edu>
2309 2314
2310 2315 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2311 2316 (inconsistent with options).
2312 2317
2313 2318 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2314 2319 manually disabled, I don't know why. Fixed it.
2315 2320 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2316 2321 eps output.
2317 2322
2318 2323 2002-11-12 Fernando Perez <fperez@colorado.edu>
2319 2324
2320 2325 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2321 2326 don't propagate up to caller. Fixes crash reported by François
2322 2327 Pinard.
2323 2328
2324 2329 2002-11-09 Fernando Perez <fperez@colorado.edu>
2325 2330
2326 2331 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2327 2332 history file for new users.
2328 2333 (make_IPython): fixed bug where initial install would leave the
2329 2334 user running in the .ipython dir.
2330 2335 (make_IPython): fixed bug where config dir .ipython would be
2331 2336 created regardless of the given -ipythondir option. Thanks to Cory
2332 2337 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2333 2338
2334 2339 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2335 2340 type confirmations. Will need to use it in all of IPython's code
2336 2341 consistently.
2337 2342
2338 2343 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2339 2344 context to print 31 lines instead of the default 5. This will make
2340 2345 the crash reports extremely detailed in case the problem is in
2341 2346 libraries I don't have access to.
2342 2347
2343 2348 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2344 2349 line of defense' code to still crash, but giving users fair
2345 2350 warning. I don't want internal errors to go unreported: if there's
2346 2351 an internal problem, IPython should crash and generate a full
2347 2352 report.
2348 2353
2349 2354 2002-11-08 Fernando Perez <fperez@colorado.edu>
2350 2355
2351 2356 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2352 2357 otherwise uncaught exceptions which can appear if people set
2353 2358 sys.stdout to something badly broken. Thanks to a crash report
2354 2359 from henni-AT-mail.brainbot.com.
2355 2360
2356 2361 2002-11-04 Fernando Perez <fperez@colorado.edu>
2357 2362
2358 2363 * IPython/iplib.py (InteractiveShell.interact): added
2359 2364 __IPYTHON__active to the builtins. It's a flag which goes on when
2360 2365 the interaction starts and goes off again when it stops. This
2361 2366 allows embedding code to detect being inside IPython. Before this
2362 2367 was done via __IPYTHON__, but that only shows that an IPython
2363 2368 instance has been created.
2364 2369
2365 2370 * IPython/Magic.py (Magic.magic_env): I realized that in a
2366 2371 UserDict, instance.data holds the data as a normal dict. So I
2367 2372 modified @env to return os.environ.data instead of rebuilding a
2368 2373 dict by hand.
2369 2374
2370 2375 2002-11-02 Fernando Perez <fperez@colorado.edu>
2371 2376
2372 2377 * IPython/genutils.py (warn): changed so that level 1 prints no
2373 2378 header. Level 2 is now the default (with 'WARNING' header, as
2374 2379 before). I think I tracked all places where changes were needed in
2375 2380 IPython, but outside code using the old level numbering may have
2376 2381 broken.
2377 2382
2378 2383 * IPython/iplib.py (InteractiveShell.runcode): added this to
2379 2384 handle the tracebacks in SystemExit traps correctly. The previous
2380 2385 code (through interact) was printing more of the stack than
2381 2386 necessary, showing IPython internal code to the user.
2382 2387
2383 2388 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2384 2389 default. Now that the default at the confirmation prompt is yes,
2385 2390 it's not so intrusive. François' argument that ipython sessions
2386 2391 tend to be complex enough not to lose them from an accidental C-d,
2387 2392 is a valid one.
2388 2393
2389 2394 * IPython/iplib.py (InteractiveShell.interact): added a
2390 2395 showtraceback() call to the SystemExit trap, and modified the exit
2391 2396 confirmation to have yes as the default.
2392 2397
2393 2398 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2394 2399 this file. It's been gone from the code for a long time, this was
2395 2400 simply leftover junk.
2396 2401
2397 2402 2002-11-01 Fernando Perez <fperez@colorado.edu>
2398 2403
2399 2404 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2400 2405 added. If set, IPython now traps EOF and asks for
2401 2406 confirmation. After a request by François Pinard.
2402 2407
2403 2408 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2404 2409 of @abort, and with a new (better) mechanism for handling the
2405 2410 exceptions.
2406 2411
2407 2412 2002-10-27 Fernando Perez <fperez@colorado.edu>
2408 2413
2409 2414 * IPython/usage.py (__doc__): updated the --help information and
2410 2415 the ipythonrc file to indicate that -log generates
2411 2416 ./ipython.log. Also fixed the corresponding info in @logstart.
2412 2417 This and several other fixes in the manuals thanks to reports by
2413 2418 François Pinard <pinard-AT-iro.umontreal.ca>.
2414 2419
2415 2420 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2416 2421 refer to @logstart (instead of @log, which doesn't exist).
2417 2422
2418 2423 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2419 2424 AttributeError crash. Thanks to Christopher Armstrong
2420 2425 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2421 2426 introduced recently (in 0.2.14pre37) with the fix to the eval
2422 2427 problem mentioned below.
2423 2428
2424 2429 2002-10-17 Fernando Perez <fperez@colorado.edu>
2425 2430
2426 2431 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2427 2432 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2428 2433
2429 2434 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2430 2435 this function to fix a problem reported by Alex Schmolck. He saw
2431 2436 it with list comprehensions and generators, which were getting
2432 2437 called twice. The real problem was an 'eval' call in testing for
2433 2438 automagic which was evaluating the input line silently.
2434 2439
2435 2440 This is a potentially very nasty bug, if the input has side
2436 2441 effects which must not be repeated. The code is much cleaner now,
2437 2442 without any blanket 'except' left and with a regexp test for
2438 2443 actual function names.
2439 2444
2440 2445 But an eval remains, which I'm not fully comfortable with. I just
2441 2446 don't know how to find out if an expression could be a callable in
2442 2447 the user's namespace without doing an eval on the string. However
2443 2448 that string is now much more strictly checked so that no code
2444 2449 slips by, so the eval should only happen for things that can
2445 2450 really be only function/method names.
2446 2451
2447 2452 2002-10-15 Fernando Perez <fperez@colorado.edu>
2448 2453
2449 2454 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2450 2455 OSX information to main manual, removed README_Mac_OSX file from
2451 2456 distribution. Also updated credits for recent additions.
2452 2457
2453 2458 2002-10-10 Fernando Perez <fperez@colorado.edu>
2454 2459
2455 2460 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2456 2461 terminal-related issues. Many thanks to Andrea Riciputi
2457 2462 <andrea.riciputi-AT-libero.it> for writing it.
2458 2463
2459 2464 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2460 2465 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2461 2466
2462 2467 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2463 2468 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2464 2469 <syver-en-AT-online.no> who both submitted patches for this problem.
2465 2470
2466 2471 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2467 2472 global embedding to make sure that things don't overwrite user
2468 2473 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2469 2474
2470 2475 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2471 2476 compatibility. Thanks to Hayden Callow
2472 2477 <h.callow-AT-elec.canterbury.ac.nz>
2473 2478
2474 2479 2002-10-04 Fernando Perez <fperez@colorado.edu>
2475 2480
2476 2481 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2477 2482 Gnuplot.File objects.
2478 2483
2479 2484 2002-07-23 Fernando Perez <fperez@colorado.edu>
2480 2485
2481 2486 * IPython/genutils.py (timing): Added timings() and timing() for
2482 2487 quick access to the most commonly needed data, the execution
2483 2488 times. Old timing() renamed to timings_out().
2484 2489
2485 2490 2002-07-18 Fernando Perez <fperez@colorado.edu>
2486 2491
2487 2492 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2488 2493 bug with nested instances disrupting the parent's tab completion.
2489 2494
2490 2495 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2491 2496 all_completions code to begin the emacs integration.
2492 2497
2493 2498 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2494 2499 argument to allow titling individual arrays when plotting.
2495 2500
2496 2501 2002-07-15 Fernando Perez <fperez@colorado.edu>
2497 2502
2498 2503 * setup.py (make_shortcut): changed to retrieve the value of
2499 2504 'Program Files' directory from the registry (this value changes in
2500 2505 non-english versions of Windows). Thanks to Thomas Fanslau
2501 2506 <tfanslau-AT-gmx.de> for the report.
2502 2507
2503 2508 2002-07-10 Fernando Perez <fperez@colorado.edu>
2504 2509
2505 2510 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2506 2511 a bug in pdb, which crashes if a line with only whitespace is
2507 2512 entered. Bug report submitted to sourceforge.
2508 2513
2509 2514 2002-07-09 Fernando Perez <fperez@colorado.edu>
2510 2515
2511 2516 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2512 2517 reporting exceptions (it's a bug in inspect.py, I just set a
2513 2518 workaround).
2514 2519
2515 2520 2002-07-08 Fernando Perez <fperez@colorado.edu>
2516 2521
2517 2522 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2518 2523 __IPYTHON__ in __builtins__ to show up in user_ns.
2519 2524
2520 2525 2002-07-03 Fernando Perez <fperez@colorado.edu>
2521 2526
2522 2527 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2523 2528 name from @gp_set_instance to @gp_set_default.
2524 2529
2525 2530 * IPython/ipmaker.py (make_IPython): default editor value set to
2526 2531 '0' (a string), to match the rc file. Otherwise will crash when
2527 2532 .strip() is called on it.
2528 2533
2529 2534
2530 2535 2002-06-28 Fernando Perez <fperez@colorado.edu>
2531 2536
2532 2537 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2533 2538 of files in current directory when a file is executed via
2534 2539 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2535 2540
2536 2541 * setup.py (manfiles): fix for rpm builds, submitted by RA
2537 2542 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2538 2543
2539 2544 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2540 2545 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2541 2546 string!). A. Schmolck caught this one.
2542 2547
2543 2548 2002-06-27 Fernando Perez <fperez@colorado.edu>
2544 2549
2545 2550 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2546 2551 defined files at the cmd line. __name__ wasn't being set to
2547 2552 __main__.
2548 2553
2549 2554 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2550 2555 regular lists and tuples besides Numeric arrays.
2551 2556
2552 2557 * IPython/Prompts.py (CachedOutput.__call__): Added output
2553 2558 supression for input ending with ';'. Similar to Mathematica and
2554 2559 Matlab. The _* vars and Out[] list are still updated, just like
2555 2560 Mathematica behaves.
2556 2561
2557 2562 2002-06-25 Fernando Perez <fperez@colorado.edu>
2558 2563
2559 2564 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2560 2565 .ini extensions for profiels under Windows.
2561 2566
2562 2567 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2563 2568 string form. Fix contributed by Alexander Schmolck
2564 2569 <a.schmolck-AT-gmx.net>
2565 2570
2566 2571 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2567 2572 pre-configured Gnuplot instance.
2568 2573
2569 2574 2002-06-21 Fernando Perez <fperez@colorado.edu>
2570 2575
2571 2576 * IPython/numutils.py (exp_safe): new function, works around the
2572 2577 underflow problems in Numeric.
2573 2578 (log2): New fn. Safe log in base 2: returns exact integer answer
2574 2579 for exact integer powers of 2.
2575 2580
2576 2581 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2577 2582 properly.
2578 2583
2579 2584 2002-06-20 Fernando Perez <fperez@colorado.edu>
2580 2585
2581 2586 * IPython/genutils.py (timing): new function like
2582 2587 Mathematica's. Similar to time_test, but returns more info.
2583 2588
2584 2589 2002-06-18 Fernando Perez <fperez@colorado.edu>
2585 2590
2586 2591 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2587 2592 according to Mike Heeter's suggestions.
2588 2593
2589 2594 2002-06-16 Fernando Perez <fperez@colorado.edu>
2590 2595
2591 2596 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2592 2597 system. GnuplotMagic is gone as a user-directory option. New files
2593 2598 make it easier to use all the gnuplot stuff both from external
2594 2599 programs as well as from IPython. Had to rewrite part of
2595 2600 hardcopy() b/c of a strange bug: often the ps files simply don't
2596 2601 get created, and require a repeat of the command (often several
2597 2602 times).
2598 2603
2599 2604 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2600 2605 resolve output channel at call time, so that if sys.stderr has
2601 2606 been redirected by user this gets honored.
2602 2607
2603 2608 2002-06-13 Fernando Perez <fperez@colorado.edu>
2604 2609
2605 2610 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2606 2611 IPShell. Kept a copy with the old names to avoid breaking people's
2607 2612 embedded code.
2608 2613
2609 2614 * IPython/ipython: simplified it to the bare minimum after
2610 2615 Holger's suggestions. Added info about how to use it in
2611 2616 PYTHONSTARTUP.
2612 2617
2613 2618 * IPython/Shell.py (IPythonShell): changed the options passing
2614 2619 from a string with funky %s replacements to a straight list. Maybe
2615 2620 a bit more typing, but it follows sys.argv conventions, so there's
2616 2621 less special-casing to remember.
2617 2622
2618 2623 2002-06-12 Fernando Perez <fperez@colorado.edu>
2619 2624
2620 2625 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2621 2626 command. Thanks to a suggestion by Mike Heeter.
2622 2627 (Magic.magic_pfile): added behavior to look at filenames if given
2623 2628 arg is not a defined object.
2624 2629 (Magic.magic_save): New @save function to save code snippets. Also
2625 2630 a Mike Heeter idea.
2626 2631
2627 2632 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2628 2633 plot() and replot(). Much more convenient now, especially for
2629 2634 interactive use.
2630 2635
2631 2636 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2632 2637 filenames.
2633 2638
2634 2639 2002-06-02 Fernando Perez <fperez@colorado.edu>
2635 2640
2636 2641 * IPython/Struct.py (Struct.__init__): modified to admit
2637 2642 initialization via another struct.
2638 2643
2639 2644 * IPython/genutils.py (SystemExec.__init__): New stateful
2640 2645 interface to xsys and bq. Useful for writing system scripts.
2641 2646
2642 2647 2002-05-30 Fernando Perez <fperez@colorado.edu>
2643 2648
2644 2649 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2645 2650 documents. This will make the user download smaller (it's getting
2646 2651 too big).
2647 2652
2648 2653 2002-05-29 Fernando Perez <fperez@colorado.edu>
2649 2654
2650 2655 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2651 2656 fix problems with shelve and pickle. Seems to work, but I don't
2652 2657 know if corner cases break it. Thanks to Mike Heeter
2653 2658 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2654 2659
2655 2660 2002-05-24 Fernando Perez <fperez@colorado.edu>
2656 2661
2657 2662 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2658 2663 macros having broken.
2659 2664
2660 2665 2002-05-21 Fernando Perez <fperez@colorado.edu>
2661 2666
2662 2667 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2663 2668 introduced logging bug: all history before logging started was
2664 2669 being written one character per line! This came from the redesign
2665 2670 of the input history as a special list which slices to strings,
2666 2671 not to lists.
2667 2672
2668 2673 2002-05-20 Fernando Perez <fperez@colorado.edu>
2669 2674
2670 2675 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2671 2676 be an attribute of all classes in this module. The design of these
2672 2677 classes needs some serious overhauling.
2673 2678
2674 2679 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2675 2680 which was ignoring '_' in option names.
2676 2681
2677 2682 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2678 2683 'Verbose_novars' to 'Context' and made it the new default. It's a
2679 2684 bit more readable and also safer than verbose.
2680 2685
2681 2686 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2682 2687 triple-quoted strings.
2683 2688
2684 2689 * IPython/OInspect.py (__all__): new module exposing the object
2685 2690 introspection facilities. Now the corresponding magics are dummy
2686 2691 wrappers around this. Having this module will make it much easier
2687 2692 to put these functions into our modified pdb.
2688 2693 This new object inspector system uses the new colorizing module,
2689 2694 so source code and other things are nicely syntax highlighted.
2690 2695
2691 2696 2002-05-18 Fernando Perez <fperez@colorado.edu>
2692 2697
2693 2698 * IPython/ColorANSI.py: Split the coloring tools into a separate
2694 2699 module so I can use them in other code easier (they were part of
2695 2700 ultraTB).
2696 2701
2697 2702 2002-05-17 Fernando Perez <fperez@colorado.edu>
2698 2703
2699 2704 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2700 2705 fixed it to set the global 'g' also to the called instance, as
2701 2706 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2702 2707 user's 'g' variables).
2703 2708
2704 2709 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2705 2710 global variables (aliases to _ih,_oh) so that users which expect
2706 2711 In[5] or Out[7] to work aren't unpleasantly surprised.
2707 2712 (InputList.__getslice__): new class to allow executing slices of
2708 2713 input history directly. Very simple class, complements the use of
2709 2714 macros.
2710 2715
2711 2716 2002-05-16 Fernando Perez <fperez@colorado.edu>
2712 2717
2713 2718 * setup.py (docdirbase): make doc directory be just doc/IPython
2714 2719 without version numbers, it will reduce clutter for users.
2715 2720
2716 2721 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2717 2722 execfile call to prevent possible memory leak. See for details:
2718 2723 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2719 2724
2720 2725 2002-05-15 Fernando Perez <fperez@colorado.edu>
2721 2726
2722 2727 * IPython/Magic.py (Magic.magic_psource): made the object
2723 2728 introspection names be more standard: pdoc, pdef, pfile and
2724 2729 psource. They all print/page their output, and it makes
2725 2730 remembering them easier. Kept old names for compatibility as
2726 2731 aliases.
2727 2732
2728 2733 2002-05-14 Fernando Perez <fperez@colorado.edu>
2729 2734
2730 2735 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2731 2736 what the mouse problem was. The trick is to use gnuplot with temp
2732 2737 files and NOT with pipes (for data communication), because having
2733 2738 both pipes and the mouse on is bad news.
2734 2739
2735 2740 2002-05-13 Fernando Perez <fperez@colorado.edu>
2736 2741
2737 2742 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2738 2743 bug. Information would be reported about builtins even when
2739 2744 user-defined functions overrode them.
2740 2745
2741 2746 2002-05-11 Fernando Perez <fperez@colorado.edu>
2742 2747
2743 2748 * IPython/__init__.py (__all__): removed FlexCompleter from
2744 2749 __all__ so that things don't fail in platforms without readline.
2745 2750
2746 2751 2002-05-10 Fernando Perez <fperez@colorado.edu>
2747 2752
2748 2753 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2749 2754 it requires Numeric, effectively making Numeric a dependency for
2750 2755 IPython.
2751 2756
2752 2757 * Released 0.2.13
2753 2758
2754 2759 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2755 2760 profiler interface. Now all the major options from the profiler
2756 2761 module are directly supported in IPython, both for single
2757 2762 expressions (@prun) and for full programs (@run -p).
2758 2763
2759 2764 2002-05-09 Fernando Perez <fperez@colorado.edu>
2760 2765
2761 2766 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2762 2767 magic properly formatted for screen.
2763 2768
2764 2769 * setup.py (make_shortcut): Changed things to put pdf version in
2765 2770 doc/ instead of doc/manual (had to change lyxport a bit).
2766 2771
2767 2772 * IPython/Magic.py (Profile.string_stats): made profile runs go
2768 2773 through pager (they are long and a pager allows searching, saving,
2769 2774 etc.)
2770 2775
2771 2776 2002-05-08 Fernando Perez <fperez@colorado.edu>
2772 2777
2773 2778 * Released 0.2.12
2774 2779
2775 2780 2002-05-06 Fernando Perez <fperez@colorado.edu>
2776 2781
2777 2782 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2778 2783 introduced); 'hist n1 n2' was broken.
2779 2784 (Magic.magic_pdb): added optional on/off arguments to @pdb
2780 2785 (Magic.magic_run): added option -i to @run, which executes code in
2781 2786 the IPython namespace instead of a clean one. Also added @irun as
2782 2787 an alias to @run -i.
2783 2788
2784 2789 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2785 2790 fixed (it didn't really do anything, the namespaces were wrong).
2786 2791
2787 2792 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2788 2793
2789 2794 * IPython/__init__.py (__all__): Fixed package namespace, now
2790 2795 'import IPython' does give access to IPython.<all> as
2791 2796 expected. Also renamed __release__ to Release.
2792 2797
2793 2798 * IPython/Debugger.py (__license__): created new Pdb class which
2794 2799 functions like a drop-in for the normal pdb.Pdb but does NOT
2795 2800 import readline by default. This way it doesn't muck up IPython's
2796 2801 readline handling, and now tab-completion finally works in the
2797 2802 debugger -- sort of. It completes things globally visible, but the
2798 2803 completer doesn't track the stack as pdb walks it. That's a bit
2799 2804 tricky, and I'll have to implement it later.
2800 2805
2801 2806 2002-05-05 Fernando Perez <fperez@colorado.edu>
2802 2807
2803 2808 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2804 2809 magic docstrings when printed via ? (explicit \'s were being
2805 2810 printed).
2806 2811
2807 2812 * IPython/ipmaker.py (make_IPython): fixed namespace
2808 2813 identification bug. Now variables loaded via logs or command-line
2809 2814 files are recognized in the interactive namespace by @who.
2810 2815
2811 2816 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2812 2817 log replay system stemming from the string form of Structs.
2813 2818
2814 2819 * IPython/Magic.py (Macro.__init__): improved macros to properly
2815 2820 handle magic commands in them.
2816 2821 (Magic.magic_logstart): usernames are now expanded so 'logstart
2817 2822 ~/mylog' now works.
2818 2823
2819 2824 * IPython/iplib.py (complete): fixed bug where paths starting with
2820 2825 '/' would be completed as magic names.
2821 2826
2822 2827 2002-05-04 Fernando Perez <fperez@colorado.edu>
2823 2828
2824 2829 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2825 2830 allow running full programs under the profiler's control.
2826 2831
2827 2832 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2828 2833 mode to report exceptions verbosely but without formatting
2829 2834 variables. This addresses the issue of ipython 'freezing' (it's
2830 2835 not frozen, but caught in an expensive formatting loop) when huge
2831 2836 variables are in the context of an exception.
2832 2837 (VerboseTB.text): Added '--->' markers at line where exception was
2833 2838 triggered. Much clearer to read, especially in NoColor modes.
2834 2839
2835 2840 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2836 2841 implemented in reverse when changing to the new parse_options().
2837 2842
2838 2843 2002-05-03 Fernando Perez <fperez@colorado.edu>
2839 2844
2840 2845 * IPython/Magic.py (Magic.parse_options): new function so that
2841 2846 magics can parse options easier.
2842 2847 (Magic.magic_prun): new function similar to profile.run(),
2843 2848 suggested by Chris Hart.
2844 2849 (Magic.magic_cd): fixed behavior so that it only changes if
2845 2850 directory actually is in history.
2846 2851
2847 2852 * IPython/usage.py (__doc__): added information about potential
2848 2853 slowness of Verbose exception mode when there are huge data
2849 2854 structures to be formatted (thanks to Archie Paulson).
2850 2855
2851 2856 * IPython/ipmaker.py (make_IPython): Changed default logging
2852 2857 (when simply called with -log) to use curr_dir/ipython.log in
2853 2858 rotate mode. Fixed crash which was occuring with -log before
2854 2859 (thanks to Jim Boyle).
2855 2860
2856 2861 2002-05-01 Fernando Perez <fperez@colorado.edu>
2857 2862
2858 2863 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2859 2864 was nasty -- though somewhat of a corner case).
2860 2865
2861 2866 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2862 2867 text (was a bug).
2863 2868
2864 2869 2002-04-30 Fernando Perez <fperez@colorado.edu>
2865 2870
2866 2871 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2867 2872 a print after ^D or ^C from the user so that the In[] prompt
2868 2873 doesn't over-run the gnuplot one.
2869 2874
2870 2875 2002-04-29 Fernando Perez <fperez@colorado.edu>
2871 2876
2872 2877 * Released 0.2.10
2873 2878
2874 2879 * IPython/__release__.py (version): get date dynamically.
2875 2880
2876 2881 * Misc. documentation updates thanks to Arnd's comments. Also ran
2877 2882 a full spellcheck on the manual (hadn't been done in a while).
2878 2883
2879 2884 2002-04-27 Fernando Perez <fperez@colorado.edu>
2880 2885
2881 2886 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
2882 2887 starting a log in mid-session would reset the input history list.
2883 2888
2884 2889 2002-04-26 Fernando Perez <fperez@colorado.edu>
2885 2890
2886 2891 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
2887 2892 all files were being included in an update. Now anything in
2888 2893 UserConfig that matches [A-Za-z]*.py will go (this excludes
2889 2894 __init__.py)
2890 2895
2891 2896 2002-04-25 Fernando Perez <fperez@colorado.edu>
2892 2897
2893 2898 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
2894 2899 to __builtins__ so that any form of embedded or imported code can
2895 2900 test for being inside IPython.
2896 2901
2897 2902 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
2898 2903 changed to GnuplotMagic because it's now an importable module,
2899 2904 this makes the name follow that of the standard Gnuplot module.
2900 2905 GnuplotMagic can now be loaded at any time in mid-session.
2901 2906
2902 2907 2002-04-24 Fernando Perez <fperez@colorado.edu>
2903 2908
2904 2909 * IPython/numutils.py: removed SIUnits. It doesn't properly set
2905 2910 the globals (IPython has its own namespace) and the
2906 2911 PhysicalQuantity stuff is much better anyway.
2907 2912
2908 2913 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
2909 2914 embedding example to standard user directory for
2910 2915 distribution. Also put it in the manual.
2911 2916
2912 2917 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
2913 2918 instance as first argument (so it doesn't rely on some obscure
2914 2919 hidden global).
2915 2920
2916 2921 * IPython/UserConfig/ipythonrc.py: put () back in accepted
2917 2922 delimiters. While it prevents ().TAB from working, it allows
2918 2923 completions in open (... expressions. This is by far a more common
2919 2924 case.
2920 2925
2921 2926 2002-04-23 Fernando Perez <fperez@colorado.edu>
2922 2927
2923 2928 * IPython/Extensions/InterpreterPasteInput.py: new
2924 2929 syntax-processing module for pasting lines with >>> or ... at the
2925 2930 start.
2926 2931
2927 2932 * IPython/Extensions/PhysicalQ_Interactive.py
2928 2933 (PhysicalQuantityInteractive.__int__): fixed to work with either
2929 2934 Numeric or math.
2930 2935
2931 2936 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
2932 2937 provided profiles. Now we have:
2933 2938 -math -> math module as * and cmath with its own namespace.
2934 2939 -numeric -> Numeric as *, plus gnuplot & grace
2935 2940 -physics -> same as before
2936 2941
2937 2942 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
2938 2943 user-defined magics wouldn't be found by @magic if they were
2939 2944 defined as class methods. Also cleaned up the namespace search
2940 2945 logic and the string building (to use %s instead of many repeated
2941 2946 string adds).
2942 2947
2943 2948 * IPython/UserConfig/example-magic.py (magic_foo): updated example
2944 2949 of user-defined magics to operate with class methods (cleaner, in
2945 2950 line with the gnuplot code).
2946 2951
2947 2952 2002-04-22 Fernando Perez <fperez@colorado.edu>
2948 2953
2949 2954 * setup.py: updated dependency list so that manual is updated when
2950 2955 all included files change.
2951 2956
2952 2957 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
2953 2958 the delimiter removal option (the fix is ugly right now).
2954 2959
2955 2960 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
2956 2961 all of the math profile (quicker loading, no conflict between
2957 2962 g-9.8 and g-gnuplot).
2958 2963
2959 2964 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
2960 2965 name of post-mortem files to IPython_crash_report.txt.
2961 2966
2962 2967 * Cleanup/update of the docs. Added all the new readline info and
2963 2968 formatted all lists as 'real lists'.
2964 2969
2965 2970 * IPython/ipmaker.py (make_IPython): removed now-obsolete
2966 2971 tab-completion options, since the full readline parse_and_bind is
2967 2972 now accessible.
2968 2973
2969 2974 * IPython/iplib.py (InteractiveShell.init_readline): Changed
2970 2975 handling of readline options. Now users can specify any string to
2971 2976 be passed to parse_and_bind(), as well as the delimiters to be
2972 2977 removed.
2973 2978 (InteractiveShell.__init__): Added __name__ to the global
2974 2979 namespace so that things like Itpl which rely on its existence
2975 2980 don't crash.
2976 2981 (InteractiveShell._prefilter): Defined the default with a _ so
2977 2982 that prefilter() is easier to override, while the default one
2978 2983 remains available.
2979 2984
2980 2985 2002-04-18 Fernando Perez <fperez@colorado.edu>
2981 2986
2982 2987 * Added information about pdb in the docs.
2983 2988
2984 2989 2002-04-17 Fernando Perez <fperez@colorado.edu>
2985 2990
2986 2991 * IPython/ipmaker.py (make_IPython): added rc_override option to
2987 2992 allow passing config options at creation time which may override
2988 2993 anything set in the config files or command line. This is
2989 2994 particularly useful for configuring embedded instances.
2990 2995
2991 2996 2002-04-15 Fernando Perez <fperez@colorado.edu>
2992 2997
2993 2998 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
2994 2999 crash embedded instances because of the input cache falling out of
2995 3000 sync with the output counter.
2996 3001
2997 3002 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
2998 3003 mode which calls pdb after an uncaught exception in IPython itself.
2999 3004
3000 3005 2002-04-14 Fernando Perez <fperez@colorado.edu>
3001 3006
3002 3007 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3003 3008 readline, fix it back after each call.
3004 3009
3005 3010 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3006 3011 method to force all access via __call__(), which guarantees that
3007 3012 traceback references are properly deleted.
3008 3013
3009 3014 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3010 3015 improve printing when pprint is in use.
3011 3016
3012 3017 2002-04-13 Fernando Perez <fperez@colorado.edu>
3013 3018
3014 3019 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3015 3020 exceptions aren't caught anymore. If the user triggers one, he
3016 3021 should know why he's doing it and it should go all the way up,
3017 3022 just like any other exception. So now @abort will fully kill the
3018 3023 embedded interpreter and the embedding code (unless that happens
3019 3024 to catch SystemExit).
3020 3025
3021 3026 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3022 3027 and a debugger() method to invoke the interactive pdb debugger
3023 3028 after printing exception information. Also added the corresponding
3024 3029 -pdb option and @pdb magic to control this feature, and updated
3025 3030 the docs. After a suggestion from Christopher Hart
3026 3031 (hart-AT-caltech.edu).
3027 3032
3028 3033 2002-04-12 Fernando Perez <fperez@colorado.edu>
3029 3034
3030 3035 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3031 3036 the exception handlers defined by the user (not the CrashHandler)
3032 3037 so that user exceptions don't trigger an ipython bug report.
3033 3038
3034 3039 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3035 3040 configurable (it should have always been so).
3036 3041
3037 3042 2002-03-26 Fernando Perez <fperez@colorado.edu>
3038 3043
3039 3044 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3040 3045 and there to fix embedding namespace issues. This should all be
3041 3046 done in a more elegant way.
3042 3047
3043 3048 2002-03-25 Fernando Perez <fperez@colorado.edu>
3044 3049
3045 3050 * IPython/genutils.py (get_home_dir): Try to make it work under
3046 3051 win9x also.
3047 3052
3048 3053 2002-03-20 Fernando Perez <fperez@colorado.edu>
3049 3054
3050 3055 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3051 3056 sys.displayhook untouched upon __init__.
3052 3057
3053 3058 2002-03-19 Fernando Perez <fperez@colorado.edu>
3054 3059
3055 3060 * Released 0.2.9 (for embedding bug, basically).
3056 3061
3057 3062 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3058 3063 exceptions so that enclosing shell's state can be restored.
3059 3064
3060 3065 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3061 3066 naming conventions in the .ipython/ dir.
3062 3067
3063 3068 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3064 3069 from delimiters list so filenames with - in them get expanded.
3065 3070
3066 3071 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3067 3072 sys.displayhook not being properly restored after an embedded call.
3068 3073
3069 3074 2002-03-18 Fernando Perez <fperez@colorado.edu>
3070 3075
3071 3076 * Released 0.2.8
3072 3077
3073 3078 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3074 3079 some files weren't being included in a -upgrade.
3075 3080 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3076 3081 on' so that the first tab completes.
3077 3082 (InteractiveShell.handle_magic): fixed bug with spaces around
3078 3083 quotes breaking many magic commands.
3079 3084
3080 3085 * setup.py: added note about ignoring the syntax error messages at
3081 3086 installation.
3082 3087
3083 3088 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3084 3089 streamlining the gnuplot interface, now there's only one magic @gp.
3085 3090
3086 3091 2002-03-17 Fernando Perez <fperez@colorado.edu>
3087 3092
3088 3093 * IPython/UserConfig/magic_gnuplot.py: new name for the
3089 3094 example-magic_pm.py file. Much enhanced system, now with a shell
3090 3095 for communicating directly with gnuplot, one command at a time.
3091 3096
3092 3097 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3093 3098 setting __name__=='__main__'.
3094 3099
3095 3100 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3096 3101 mini-shell for accessing gnuplot from inside ipython. Should
3097 3102 extend it later for grace access too. Inspired by Arnd's
3098 3103 suggestion.
3099 3104
3100 3105 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3101 3106 calling magic functions with () in their arguments. Thanks to Arnd
3102 3107 Baecker for pointing this to me.
3103 3108
3104 3109 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3105 3110 infinitely for integer or complex arrays (only worked with floats).
3106 3111
3107 3112 2002-03-16 Fernando Perez <fperez@colorado.edu>
3108 3113
3109 3114 * setup.py: Merged setup and setup_windows into a single script
3110 3115 which properly handles things for windows users.
3111 3116
3112 3117 2002-03-15 Fernando Perez <fperez@colorado.edu>
3113 3118
3114 3119 * Big change to the manual: now the magics are all automatically
3115 3120 documented. This information is generated from their docstrings
3116 3121 and put in a latex file included by the manual lyx file. This way
3117 3122 we get always up to date information for the magics. The manual
3118 3123 now also has proper version information, also auto-synced.
3119 3124
3120 3125 For this to work, an undocumented --magic_docstrings option was added.
3121 3126
3122 3127 2002-03-13 Fernando Perez <fperez@colorado.edu>
3123 3128
3124 3129 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3125 3130 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3126 3131
3127 3132 2002-03-12 Fernando Perez <fperez@colorado.edu>
3128 3133
3129 3134 * IPython/ultraTB.py (TermColors): changed color escapes again to
3130 3135 fix the (old, reintroduced) line-wrapping bug. Basically, if
3131 3136 \001..\002 aren't given in the color escapes, lines get wrapped
3132 3137 weirdly. But giving those screws up old xterms and emacs terms. So
3133 3138 I added some logic for emacs terms to be ok, but I can't identify old
3134 3139 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3135 3140
3136 3141 2002-03-10 Fernando Perez <fperez@colorado.edu>
3137 3142
3138 3143 * IPython/usage.py (__doc__): Various documentation cleanups and
3139 3144 updates, both in usage docstrings and in the manual.
3140 3145
3141 3146 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3142 3147 handling of caching. Set minimum acceptabe value for having a
3143 3148 cache at 20 values.
3144 3149
3145 3150 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3146 3151 install_first_time function to a method, renamed it and added an
3147 3152 'upgrade' mode. Now people can update their config directory with
3148 3153 a simple command line switch (-upgrade, also new).
3149 3154
3150 3155 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3151 3156 @file (convenient for automagic users under Python >= 2.2).
3152 3157 Removed @files (it seemed more like a plural than an abbrev. of
3153 3158 'file show').
3154 3159
3155 3160 * IPython/iplib.py (install_first_time): Fixed crash if there were
3156 3161 backup files ('~') in .ipython/ install directory.
3157 3162
3158 3163 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3159 3164 system. Things look fine, but these changes are fairly
3160 3165 intrusive. Test them for a few days.
3161 3166
3162 3167 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3163 3168 the prompts system. Now all in/out prompt strings are user
3164 3169 controllable. This is particularly useful for embedding, as one
3165 3170 can tag embedded instances with particular prompts.
3166 3171
3167 3172 Also removed global use of sys.ps1/2, which now allows nested
3168 3173 embeddings without any problems. Added command-line options for
3169 3174 the prompt strings.
3170 3175
3171 3176 2002-03-08 Fernando Perez <fperez@colorado.edu>
3172 3177
3173 3178 * IPython/UserConfig/example-embed-short.py (ipshell): added
3174 3179 example file with the bare minimum code for embedding.
3175 3180
3176 3181 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3177 3182 functionality for the embeddable shell to be activated/deactivated
3178 3183 either globally or at each call.
3179 3184
3180 3185 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3181 3186 rewriting the prompt with '--->' for auto-inputs with proper
3182 3187 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3183 3188 this is handled by the prompts class itself, as it should.
3184 3189
3185 3190 2002-03-05 Fernando Perez <fperez@colorado.edu>
3186 3191
3187 3192 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3188 3193 @logstart to avoid name clashes with the math log function.
3189 3194
3190 3195 * Big updates to X/Emacs section of the manual.
3191 3196
3192 3197 * Removed ipython_emacs. Milan explained to me how to pass
3193 3198 arguments to ipython through Emacs. Some day I'm going to end up
3194 3199 learning some lisp...
3195 3200
3196 3201 2002-03-04 Fernando Perez <fperez@colorado.edu>
3197 3202
3198 3203 * IPython/ipython_emacs: Created script to be used as the
3199 3204 py-python-command Emacs variable so we can pass IPython
3200 3205 parameters. I can't figure out how to tell Emacs directly to pass
3201 3206 parameters to IPython, so a dummy shell script will do it.
3202 3207
3203 3208 Other enhancements made for things to work better under Emacs'
3204 3209 various types of terminals. Many thanks to Milan Zamazal
3205 3210 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3206 3211
3207 3212 2002-03-01 Fernando Perez <fperez@colorado.edu>
3208 3213
3209 3214 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3210 3215 that loading of readline is now optional. This gives better
3211 3216 control to emacs users.
3212 3217
3213 3218 * IPython/ultraTB.py (__date__): Modified color escape sequences
3214 3219 and now things work fine under xterm and in Emacs' term buffers
3215 3220 (though not shell ones). Well, in emacs you get colors, but all
3216 3221 seem to be 'light' colors (no difference between dark and light
3217 3222 ones). But the garbage chars are gone, and also in xterms. It
3218 3223 seems that now I'm using 'cleaner' ansi sequences.
3219 3224
3220 3225 2002-02-21 Fernando Perez <fperez@colorado.edu>
3221 3226
3222 3227 * Released 0.2.7 (mainly to publish the scoping fix).
3223 3228
3224 3229 * IPython/Logger.py (Logger.logstate): added. A corresponding
3225 3230 @logstate magic was created.
3226 3231
3227 3232 * IPython/Magic.py: fixed nested scoping problem under Python
3228 3233 2.1.x (automagic wasn't working).
3229 3234
3230 3235 2002-02-20 Fernando Perez <fperez@colorado.edu>
3231 3236
3232 3237 * Released 0.2.6.
3233 3238
3234 3239 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3235 3240 option so that logs can come out without any headers at all.
3236 3241
3237 3242 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3238 3243 SciPy.
3239 3244
3240 3245 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3241 3246 that embedded IPython calls don't require vars() to be explicitly
3242 3247 passed. Now they are extracted from the caller's frame (code
3243 3248 snatched from Eric Jones' weave). Added better documentation to
3244 3249 the section on embedding and the example file.
3245 3250
3246 3251 * IPython/genutils.py (page): Changed so that under emacs, it just
3247 3252 prints the string. You can then page up and down in the emacs
3248 3253 buffer itself. This is how the builtin help() works.
3249 3254
3250 3255 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3251 3256 macro scoping: macros need to be executed in the user's namespace
3252 3257 to work as if they had been typed by the user.
3253 3258
3254 3259 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3255 3260 execute automatically (no need to type 'exec...'). They then
3256 3261 behave like 'true macros'. The printing system was also modified
3257 3262 for this to work.
3258 3263
3259 3264 2002-02-19 Fernando Perez <fperez@colorado.edu>
3260 3265
3261 3266 * IPython/genutils.py (page_file): new function for paging files
3262 3267 in an OS-independent way. Also necessary for file viewing to work
3263 3268 well inside Emacs buffers.
3264 3269 (page): Added checks for being in an emacs buffer.
3265 3270 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3266 3271 same bug in iplib.
3267 3272
3268 3273 2002-02-18 Fernando Perez <fperez@colorado.edu>
3269 3274
3270 3275 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3271 3276 of readline so that IPython can work inside an Emacs buffer.
3272 3277
3273 3278 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3274 3279 method signatures (they weren't really bugs, but it looks cleaner
3275 3280 and keeps PyChecker happy).
3276 3281
3277 3282 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3278 3283 for implementing various user-defined hooks. Currently only
3279 3284 display is done.
3280 3285
3281 3286 * IPython/Prompts.py (CachedOutput._display): changed display
3282 3287 functions so that they can be dynamically changed by users easily.
3283 3288
3284 3289 * IPython/Extensions/numeric_formats.py (num_display): added an
3285 3290 extension for printing NumPy arrays in flexible manners. It
3286 3291 doesn't do anything yet, but all the structure is in
3287 3292 place. Ultimately the plan is to implement output format control
3288 3293 like in Octave.
3289 3294
3290 3295 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3291 3296 methods are found at run-time by all the automatic machinery.
3292 3297
3293 3298 2002-02-17 Fernando Perez <fperez@colorado.edu>
3294 3299
3295 3300 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3296 3301 whole file a little.
3297 3302
3298 3303 * ToDo: closed this document. Now there's a new_design.lyx
3299 3304 document for all new ideas. Added making a pdf of it for the
3300 3305 end-user distro.
3301 3306
3302 3307 * IPython/Logger.py (Logger.switch_log): Created this to replace
3303 3308 logon() and logoff(). It also fixes a nasty crash reported by
3304 3309 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3305 3310
3306 3311 * IPython/iplib.py (complete): got auto-completion to work with
3307 3312 automagic (I had wanted this for a long time).
3308 3313
3309 3314 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3310 3315 to @file, since file() is now a builtin and clashes with automagic
3311 3316 for @file.
3312 3317
3313 3318 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3314 3319 of this was previously in iplib, which had grown to more than 2000
3315 3320 lines, way too long. No new functionality, but it makes managing
3316 3321 the code a bit easier.
3317 3322
3318 3323 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3319 3324 information to crash reports.
3320 3325
3321 3326 2002-02-12 Fernando Perez <fperez@colorado.edu>
3322 3327
3323 3328 * Released 0.2.5.
3324 3329
3325 3330 2002-02-11 Fernando Perez <fperez@colorado.edu>
3326 3331
3327 3332 * Wrote a relatively complete Windows installer. It puts
3328 3333 everything in place, creates Start Menu entries and fixes the
3329 3334 color issues. Nothing fancy, but it works.
3330 3335
3331 3336 2002-02-10 Fernando Perez <fperez@colorado.edu>
3332 3337
3333 3338 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3334 3339 os.path.expanduser() call so that we can type @run ~/myfile.py and
3335 3340 have thigs work as expected.
3336 3341
3337 3342 * IPython/genutils.py (page): fixed exception handling so things
3338 3343 work both in Unix and Windows correctly. Quitting a pager triggers
3339 3344 an IOError/broken pipe in Unix, and in windows not finding a pager
3340 3345 is also an IOError, so I had to actually look at the return value
3341 3346 of the exception, not just the exception itself. Should be ok now.
3342 3347
3343 3348 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3344 3349 modified to allow case-insensitive color scheme changes.
3345 3350
3346 3351 2002-02-09 Fernando Perez <fperez@colorado.edu>
3347 3352
3348 3353 * IPython/genutils.py (native_line_ends): new function to leave
3349 3354 user config files with os-native line-endings.
3350 3355
3351 3356 * README and manual updates.
3352 3357
3353 3358 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3354 3359 instead of StringType to catch Unicode strings.
3355 3360
3356 3361 * IPython/genutils.py (filefind): fixed bug for paths with
3357 3362 embedded spaces (very common in Windows).
3358 3363
3359 3364 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3360 3365 files under Windows, so that they get automatically associated
3361 3366 with a text editor. Windows makes it a pain to handle
3362 3367 extension-less files.
3363 3368
3364 3369 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3365 3370 warning about readline only occur for Posix. In Windows there's no
3366 3371 way to get readline, so why bother with the warning.
3367 3372
3368 3373 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3369 3374 for __str__ instead of dir(self), since dir() changed in 2.2.
3370 3375
3371 3376 * Ported to Windows! Tested on XP, I suspect it should work fine
3372 3377 on NT/2000, but I don't think it will work on 98 et al. That
3373 3378 series of Windows is such a piece of junk anyway that I won't try
3374 3379 porting it there. The XP port was straightforward, showed a few
3375 3380 bugs here and there (fixed all), in particular some string
3376 3381 handling stuff which required considering Unicode strings (which
3377 3382 Windows uses). This is good, but hasn't been too tested :) No
3378 3383 fancy installer yet, I'll put a note in the manual so people at
3379 3384 least make manually a shortcut.
3380 3385
3381 3386 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3382 3387 into a single one, "colors". This now controls both prompt and
3383 3388 exception color schemes, and can be changed both at startup
3384 3389 (either via command-line switches or via ipythonrc files) and at
3385 3390 runtime, with @colors.
3386 3391 (Magic.magic_run): renamed @prun to @run and removed the old
3387 3392 @run. The two were too similar to warrant keeping both.
3388 3393
3389 3394 2002-02-03 Fernando Perez <fperez@colorado.edu>
3390 3395
3391 3396 * IPython/iplib.py (install_first_time): Added comment on how to
3392 3397 configure the color options for first-time users. Put a <return>
3393 3398 request at the end so that small-terminal users get a chance to
3394 3399 read the startup info.
3395 3400
3396 3401 2002-01-23 Fernando Perez <fperez@colorado.edu>
3397 3402
3398 3403 * IPython/iplib.py (CachedOutput.update): Changed output memory
3399 3404 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3400 3405 input history we still use _i. Did this b/c these variable are
3401 3406 very commonly used in interactive work, so the less we need to
3402 3407 type the better off we are.
3403 3408 (Magic.magic_prun): updated @prun to better handle the namespaces
3404 3409 the file will run in, including a fix for __name__ not being set
3405 3410 before.
3406 3411
3407 3412 2002-01-20 Fernando Perez <fperez@colorado.edu>
3408 3413
3409 3414 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3410 3415 extra garbage for Python 2.2. Need to look more carefully into
3411 3416 this later.
3412 3417
3413 3418 2002-01-19 Fernando Perez <fperez@colorado.edu>
3414 3419
3415 3420 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3416 3421 display SyntaxError exceptions properly formatted when they occur
3417 3422 (they can be triggered by imported code).
3418 3423
3419 3424 2002-01-18 Fernando Perez <fperez@colorado.edu>
3420 3425
3421 3426 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3422 3427 SyntaxError exceptions are reported nicely formatted, instead of
3423 3428 spitting out only offset information as before.
3424 3429 (Magic.magic_prun): Added the @prun function for executing
3425 3430 programs with command line args inside IPython.
3426 3431
3427 3432 2002-01-16 Fernando Perez <fperez@colorado.edu>
3428 3433
3429 3434 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3430 3435 to *not* include the last item given in a range. This brings their
3431 3436 behavior in line with Python's slicing:
3432 3437 a[n1:n2] -> a[n1]...a[n2-1]
3433 3438 It may be a bit less convenient, but I prefer to stick to Python's
3434 3439 conventions *everywhere*, so users never have to wonder.
3435 3440 (Magic.magic_macro): Added @macro function to ease the creation of
3436 3441 macros.
3437 3442
3438 3443 2002-01-05 Fernando Perez <fperez@colorado.edu>
3439 3444
3440 3445 * Released 0.2.4.
3441 3446
3442 3447 * IPython/iplib.py (Magic.magic_pdef):
3443 3448 (InteractiveShell.safe_execfile): report magic lines and error
3444 3449 lines without line numbers so one can easily copy/paste them for
3445 3450 re-execution.
3446 3451
3447 3452 * Updated manual with recent changes.
3448 3453
3449 3454 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3450 3455 docstring printing when class? is called. Very handy for knowing
3451 3456 how to create class instances (as long as __init__ is well
3452 3457 documented, of course :)
3453 3458 (Magic.magic_doc): print both class and constructor docstrings.
3454 3459 (Magic.magic_pdef): give constructor info if passed a class and
3455 3460 __call__ info for callable object instances.
3456 3461
3457 3462 2002-01-04 Fernando Perez <fperez@colorado.edu>
3458 3463
3459 3464 * Made deep_reload() off by default. It doesn't always work
3460 3465 exactly as intended, so it's probably safer to have it off. It's
3461 3466 still available as dreload() anyway, so nothing is lost.
3462 3467
3463 3468 2002-01-02 Fernando Perez <fperez@colorado.edu>
3464 3469
3465 3470 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3466 3471 so I wanted an updated release).
3467 3472
3468 3473 2001-12-27 Fernando Perez <fperez@colorado.edu>
3469 3474
3470 3475 * IPython/iplib.py (InteractiveShell.interact): Added the original
3471 3476 code from 'code.py' for this module in order to change the
3472 3477 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3473 3478 the history cache would break when the user hit Ctrl-C, and
3474 3479 interact() offers no way to add any hooks to it.
3475 3480
3476 3481 2001-12-23 Fernando Perez <fperez@colorado.edu>
3477 3482
3478 3483 * setup.py: added check for 'MANIFEST' before trying to remove
3479 3484 it. Thanks to Sean Reifschneider.
3480 3485
3481 3486 2001-12-22 Fernando Perez <fperez@colorado.edu>
3482 3487
3483 3488 * Released 0.2.2.
3484 3489
3485 3490 * Finished (reasonably) writing the manual. Later will add the
3486 3491 python-standard navigation stylesheets, but for the time being
3487 3492 it's fairly complete. Distribution will include html and pdf
3488 3493 versions.
3489 3494
3490 3495 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3491 3496 (MayaVi author).
3492 3497
3493 3498 2001-12-21 Fernando Perez <fperez@colorado.edu>
3494 3499
3495 3500 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3496 3501 good public release, I think (with the manual and the distutils
3497 3502 installer). The manual can use some work, but that can go
3498 3503 slowly. Otherwise I think it's quite nice for end users. Next
3499 3504 summer, rewrite the guts of it...
3500 3505
3501 3506 * Changed format of ipythonrc files to use whitespace as the
3502 3507 separator instead of an explicit '='. Cleaner.
3503 3508
3504 3509 2001-12-20 Fernando Perez <fperez@colorado.edu>
3505 3510
3506 3511 * Started a manual in LyX. For now it's just a quick merge of the
3507 3512 various internal docstrings and READMEs. Later it may grow into a
3508 3513 nice, full-blown manual.
3509 3514
3510 3515 * Set up a distutils based installer. Installation should now be
3511 3516 trivially simple for end-users.
3512 3517
3513 3518 2001-12-11 Fernando Perez <fperez@colorado.edu>
3514 3519
3515 3520 * Released 0.2.0. First public release, announced it at
3516 3521 comp.lang.python. From now on, just bugfixes...
3517 3522
3518 3523 * Went through all the files, set copyright/license notices and
3519 3524 cleaned up things. Ready for release.
3520 3525
3521 3526 2001-12-10 Fernando Perez <fperez@colorado.edu>
3522 3527
3523 3528 * Changed the first-time installer not to use tarfiles. It's more
3524 3529 robust now and less unix-dependent. Also makes it easier for
3525 3530 people to later upgrade versions.
3526 3531
3527 3532 * Changed @exit to @abort to reflect the fact that it's pretty
3528 3533 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3529 3534 becomes significant only when IPyhton is embedded: in that case,
3530 3535 C-D closes IPython only, but @abort kills the enclosing program
3531 3536 too (unless it had called IPython inside a try catching
3532 3537 SystemExit).
3533 3538
3534 3539 * Created Shell module which exposes the actuall IPython Shell
3535 3540 classes, currently the normal and the embeddable one. This at
3536 3541 least offers a stable interface we won't need to change when
3537 3542 (later) the internals are rewritten. That rewrite will be confined
3538 3543 to iplib and ipmaker, but the Shell interface should remain as is.
3539 3544
3540 3545 * Added embed module which offers an embeddable IPShell object,
3541 3546 useful to fire up IPython *inside* a running program. Great for
3542 3547 debugging or dynamical data analysis.
3543 3548
3544 3549 2001-12-08 Fernando Perez <fperez@colorado.edu>
3545 3550
3546 3551 * Fixed small bug preventing seeing info from methods of defined
3547 3552 objects (incorrect namespace in _ofind()).
3548 3553
3549 3554 * Documentation cleanup. Moved the main usage docstrings to a
3550 3555 separate file, usage.py (cleaner to maintain, and hopefully in the
3551 3556 future some perlpod-like way of producing interactive, man and
3552 3557 html docs out of it will be found).
3553 3558
3554 3559 * Added @profile to see your profile at any time.
3555 3560
3556 3561 * Added @p as an alias for 'print'. It's especially convenient if
3557 3562 using automagic ('p x' prints x).
3558 3563
3559 3564 * Small cleanups and fixes after a pychecker run.
3560 3565
3561 3566 * Changed the @cd command to handle @cd - and @cd -<n> for
3562 3567 visiting any directory in _dh.
3563 3568
3564 3569 * Introduced _dh, a history of visited directories. @dhist prints
3565 3570 it out with numbers.
3566 3571
3567 3572 2001-12-07 Fernando Perez <fperez@colorado.edu>
3568 3573
3569 3574 * Released 0.1.22
3570 3575
3571 3576 * Made initialization a bit more robust against invalid color
3572 3577 options in user input (exit, not traceback-crash).
3573 3578
3574 3579 * Changed the bug crash reporter to write the report only in the
3575 3580 user's .ipython directory. That way IPython won't litter people's
3576 3581 hard disks with crash files all over the place. Also print on
3577 3582 screen the necessary mail command.
3578 3583
3579 3584 * With the new ultraTB, implemented LightBG color scheme for light
3580 3585 background terminals. A lot of people like white backgrounds, so I
3581 3586 guess we should at least give them something readable.
3582 3587
3583 3588 2001-12-06 Fernando Perez <fperez@colorado.edu>
3584 3589
3585 3590 * Modified the structure of ultraTB. Now there's a proper class
3586 3591 for tables of color schemes which allow adding schemes easily and
3587 3592 switching the active scheme without creating a new instance every
3588 3593 time (which was ridiculous). The syntax for creating new schemes
3589 3594 is also cleaner. I think ultraTB is finally done, with a clean
3590 3595 class structure. Names are also much cleaner (now there's proper
3591 3596 color tables, no need for every variable to also have 'color' in
3592 3597 its name).
3593 3598
3594 3599 * Broke down genutils into separate files. Now genutils only
3595 3600 contains utility functions, and classes have been moved to their
3596 3601 own files (they had enough independent functionality to warrant
3597 3602 it): ConfigLoader, OutputTrap, Struct.
3598 3603
3599 3604 2001-12-05 Fernando Perez <fperez@colorado.edu>
3600 3605
3601 3606 * IPython turns 21! Released version 0.1.21, as a candidate for
3602 3607 public consumption. If all goes well, release in a few days.
3603 3608
3604 3609 * Fixed path bug (files in Extensions/ directory wouldn't be found
3605 3610 unless IPython/ was explicitly in sys.path).
3606 3611
3607 3612 * Extended the FlexCompleter class as MagicCompleter to allow
3608 3613 completion of @-starting lines.
3609 3614
3610 3615 * Created __release__.py file as a central repository for release
3611 3616 info that other files can read from.
3612 3617
3613 3618 * Fixed small bug in logging: when logging was turned on in
3614 3619 mid-session, old lines with special meanings (!@?) were being
3615 3620 logged without the prepended comment, which is necessary since
3616 3621 they are not truly valid python syntax. This should make session
3617 3622 restores produce less errors.
3618 3623
3619 3624 * The namespace cleanup forced me to make a FlexCompleter class
3620 3625 which is nothing but a ripoff of rlcompleter, but with selectable
3621 3626 namespace (rlcompleter only works in __main__.__dict__). I'll try
3622 3627 to submit a note to the authors to see if this change can be
3623 3628 incorporated in future rlcompleter releases (Dec.6: done)
3624 3629
3625 3630 * More fixes to namespace handling. It was a mess! Now all
3626 3631 explicit references to __main__.__dict__ are gone (except when
3627 3632 really needed) and everything is handled through the namespace
3628 3633 dicts in the IPython instance. We seem to be getting somewhere
3629 3634 with this, finally...
3630 3635
3631 3636 * Small documentation updates.
3632 3637
3633 3638 * Created the Extensions directory under IPython (with an
3634 3639 __init__.py). Put the PhysicalQ stuff there. This directory should
3635 3640 be used for all special-purpose extensions.
3636 3641
3637 3642 * File renaming:
3638 3643 ipythonlib --> ipmaker
3639 3644 ipplib --> iplib
3640 3645 This makes a bit more sense in terms of what these files actually do.
3641 3646
3642 3647 * Moved all the classes and functions in ipythonlib to ipplib, so
3643 3648 now ipythonlib only has make_IPython(). This will ease up its
3644 3649 splitting in smaller functional chunks later.
3645 3650
3646 3651 * Cleaned up (done, I think) output of @whos. Better column
3647 3652 formatting, and now shows str(var) for as much as it can, which is
3648 3653 typically what one gets with a 'print var'.
3649 3654
3650 3655 2001-12-04 Fernando Perez <fperez@colorado.edu>
3651 3656
3652 3657 * Fixed namespace problems. Now builtin/IPyhton/user names get
3653 3658 properly reported in their namespace. Internal namespace handling
3654 3659 is finally getting decent (not perfect yet, but much better than
3655 3660 the ad-hoc mess we had).
3656 3661
3657 3662 * Removed -exit option. If people just want to run a python
3658 3663 script, that's what the normal interpreter is for. Less
3659 3664 unnecessary options, less chances for bugs.
3660 3665
3661 3666 * Added a crash handler which generates a complete post-mortem if
3662 3667 IPython crashes. This will help a lot in tracking bugs down the
3663 3668 road.
3664 3669
3665 3670 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3666 3671 which were boud to functions being reassigned would bypass the
3667 3672 logger, breaking the sync of _il with the prompt counter. This
3668 3673 would then crash IPython later when a new line was logged.
3669 3674
3670 3675 2001-12-02 Fernando Perez <fperez@colorado.edu>
3671 3676
3672 3677 * Made IPython a package. This means people don't have to clutter
3673 3678 their sys.path with yet another directory. Changed the INSTALL
3674 3679 file accordingly.
3675 3680
3676 3681 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3677 3682 sorts its output (so @who shows it sorted) and @whos formats the
3678 3683 table according to the width of the first column. Nicer, easier to
3679 3684 read. Todo: write a generic table_format() which takes a list of
3680 3685 lists and prints it nicely formatted, with optional row/column
3681 3686 separators and proper padding and justification.
3682 3687
3683 3688 * Released 0.1.20
3684 3689
3685 3690 * Fixed bug in @log which would reverse the inputcache list (a
3686 3691 copy operation was missing).
3687 3692
3688 3693 * Code cleanup. @config was changed to use page(). Better, since
3689 3694 its output is always quite long.
3690 3695
3691 3696 * Itpl is back as a dependency. I was having too many problems
3692 3697 getting the parametric aliases to work reliably, and it's just
3693 3698 easier to code weird string operations with it than playing %()s
3694 3699 games. It's only ~6k, so I don't think it's too big a deal.
3695 3700
3696 3701 * Found (and fixed) a very nasty bug with history. !lines weren't
3697 3702 getting cached, and the out of sync caches would crash
3698 3703 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3699 3704 division of labor a bit better. Bug fixed, cleaner structure.
3700 3705
3701 3706 2001-12-01 Fernando Perez <fperez@colorado.edu>
3702 3707
3703 3708 * Released 0.1.19
3704 3709
3705 3710 * Added option -n to @hist to prevent line number printing. Much
3706 3711 easier to copy/paste code this way.
3707 3712
3708 3713 * Created global _il to hold the input list. Allows easy
3709 3714 re-execution of blocks of code by slicing it (inspired by Janko's
3710 3715 comment on 'macros').
3711 3716
3712 3717 * Small fixes and doc updates.
3713 3718
3714 3719 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3715 3720 much too fragile with automagic. Handles properly multi-line
3716 3721 statements and takes parameters.
3717 3722
3718 3723 2001-11-30 Fernando Perez <fperez@colorado.edu>
3719 3724
3720 3725 * Version 0.1.18 released.
3721 3726
3722 3727 * Fixed nasty namespace bug in initial module imports.
3723 3728
3724 3729 * Added copyright/license notes to all code files (except
3725 3730 DPyGetOpt). For the time being, LGPL. That could change.
3726 3731
3727 3732 * Rewrote a much nicer README, updated INSTALL, cleaned up
3728 3733 ipythonrc-* samples.
3729 3734
3730 3735 * Overall code/documentation cleanup. Basically ready for
3731 3736 release. Only remaining thing: licence decision (LGPL?).
3732 3737
3733 3738 * Converted load_config to a class, ConfigLoader. Now recursion
3734 3739 control is better organized. Doesn't include the same file twice.
3735 3740
3736 3741 2001-11-29 Fernando Perez <fperez@colorado.edu>
3737 3742
3738 3743 * Got input history working. Changed output history variables from
3739 3744 _p to _o so that _i is for input and _o for output. Just cleaner
3740 3745 convention.
3741 3746
3742 3747 * Implemented parametric aliases. This pretty much allows the
3743 3748 alias system to offer full-blown shell convenience, I think.
3744 3749
3745 3750 * Version 0.1.17 released, 0.1.18 opened.
3746 3751
3747 3752 * dot_ipython/ipythonrc (alias): added documentation.
3748 3753 (xcolor): Fixed small bug (xcolors -> xcolor)
3749 3754
3750 3755 * Changed the alias system. Now alias is a magic command to define
3751 3756 aliases just like the shell. Rationale: the builtin magics should
3752 3757 be there for things deeply connected to IPython's
3753 3758 architecture. And this is a much lighter system for what I think
3754 3759 is the really important feature: allowing users to define quickly
3755 3760 magics that will do shell things for them, so they can customize
3756 3761 IPython easily to match their work habits. If someone is really
3757 3762 desperate to have another name for a builtin alias, they can
3758 3763 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3759 3764 works.
3760 3765
3761 3766 2001-11-28 Fernando Perez <fperez@colorado.edu>
3762 3767
3763 3768 * Changed @file so that it opens the source file at the proper
3764 3769 line. Since it uses less, if your EDITOR environment is
3765 3770 configured, typing v will immediately open your editor of choice
3766 3771 right at the line where the object is defined. Not as quick as
3767 3772 having a direct @edit command, but for all intents and purposes it
3768 3773 works. And I don't have to worry about writing @edit to deal with
3769 3774 all the editors, less does that.
3770 3775
3771 3776 * Version 0.1.16 released, 0.1.17 opened.
3772 3777
3773 3778 * Fixed some nasty bugs in the page/page_dumb combo that could
3774 3779 crash IPython.
3775 3780
3776 3781 2001-11-27 Fernando Perez <fperez@colorado.edu>
3777 3782
3778 3783 * Version 0.1.15 released, 0.1.16 opened.
3779 3784
3780 3785 * Finally got ? and ?? to work for undefined things: now it's
3781 3786 possible to type {}.get? and get information about the get method
3782 3787 of dicts, or os.path? even if only os is defined (so technically
3783 3788 os.path isn't). Works at any level. For example, after import os,
3784 3789 os?, os.path?, os.path.abspath? all work. This is great, took some
3785 3790 work in _ofind.
3786 3791
3787 3792 * Fixed more bugs with logging. The sanest way to do it was to add
3788 3793 to @log a 'mode' parameter. Killed two in one shot (this mode
3789 3794 option was a request of Janko's). I think it's finally clean
3790 3795 (famous last words).
3791 3796
3792 3797 * Added a page_dumb() pager which does a decent job of paging on
3793 3798 screen, if better things (like less) aren't available. One less
3794 3799 unix dependency (someday maybe somebody will port this to
3795 3800 windows).
3796 3801
3797 3802 * Fixed problem in magic_log: would lock of logging out if log
3798 3803 creation failed (because it would still think it had succeeded).
3799 3804
3800 3805 * Improved the page() function using curses to auto-detect screen
3801 3806 size. Now it can make a much better decision on whether to print
3802 3807 or page a string. Option screen_length was modified: a value 0
3803 3808 means auto-detect, and that's the default now.
3804 3809
3805 3810 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3806 3811 go out. I'll test it for a few days, then talk to Janko about
3807 3812 licences and announce it.
3808 3813
3809 3814 * Fixed the length of the auto-generated ---> prompt which appears
3810 3815 for auto-parens and auto-quotes. Getting this right isn't trivial,
3811 3816 with all the color escapes, different prompt types and optional
3812 3817 separators. But it seems to be working in all the combinations.
3813 3818
3814 3819 2001-11-26 Fernando Perez <fperez@colorado.edu>
3815 3820
3816 3821 * Wrote a regexp filter to get option types from the option names
3817 3822 string. This eliminates the need to manually keep two duplicate
3818 3823 lists.
3819 3824
3820 3825 * Removed the unneeded check_option_names. Now options are handled
3821 3826 in a much saner manner and it's easy to visually check that things
3822 3827 are ok.
3823 3828
3824 3829 * Updated version numbers on all files I modified to carry a
3825 3830 notice so Janko and Nathan have clear version markers.
3826 3831
3827 3832 * Updated docstring for ultraTB with my changes. I should send
3828 3833 this to Nathan.
3829 3834
3830 3835 * Lots of small fixes. Ran everything through pychecker again.
3831 3836
3832 3837 * Made loading of deep_reload an cmd line option. If it's not too
3833 3838 kosher, now people can just disable it. With -nodeep_reload it's
3834 3839 still available as dreload(), it just won't overwrite reload().
3835 3840
3836 3841 * Moved many options to the no| form (-opt and -noopt
3837 3842 accepted). Cleaner.
3838 3843
3839 3844 * Changed magic_log so that if called with no parameters, it uses
3840 3845 'rotate' mode. That way auto-generated logs aren't automatically
3841 3846 over-written. For normal logs, now a backup is made if it exists
3842 3847 (only 1 level of backups). A new 'backup' mode was added to the
3843 3848 Logger class to support this. This was a request by Janko.
3844 3849
3845 3850 * Added @logoff/@logon to stop/restart an active log.
3846 3851
3847 3852 * Fixed a lot of bugs in log saving/replay. It was pretty
3848 3853 broken. Now special lines (!@,/) appear properly in the command
3849 3854 history after a log replay.
3850 3855
3851 3856 * Tried and failed to implement full session saving via pickle. My
3852 3857 idea was to pickle __main__.__dict__, but modules can't be
3853 3858 pickled. This would be a better alternative to replaying logs, but
3854 3859 seems quite tricky to get to work. Changed -session to be called
3855 3860 -logplay, which more accurately reflects what it does. And if we
3856 3861 ever get real session saving working, -session is now available.
3857 3862
3858 3863 * Implemented color schemes for prompts also. As for tracebacks,
3859 3864 currently only NoColor and Linux are supported. But now the
3860 3865 infrastructure is in place, based on a generic ColorScheme
3861 3866 class. So writing and activating new schemes both for the prompts
3862 3867 and the tracebacks should be straightforward.
3863 3868
3864 3869 * Version 0.1.13 released, 0.1.14 opened.
3865 3870
3866 3871 * Changed handling of options for output cache. Now counter is
3867 3872 hardwired starting at 1 and one specifies the maximum number of
3868 3873 entries *in the outcache* (not the max prompt counter). This is
3869 3874 much better, since many statements won't increase the cache
3870 3875 count. It also eliminated some confusing options, now there's only
3871 3876 one: cache_size.
3872 3877
3873 3878 * Added 'alias' magic function and magic_alias option in the
3874 3879 ipythonrc file. Now the user can easily define whatever names he
3875 3880 wants for the magic functions without having to play weird
3876 3881 namespace games. This gives IPython a real shell-like feel.
3877 3882
3878 3883 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
3879 3884 @ or not).
3880 3885
3881 3886 This was one of the last remaining 'visible' bugs (that I know
3882 3887 of). I think if I can clean up the session loading so it works
3883 3888 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
3884 3889 about licensing).
3885 3890
3886 3891 2001-11-25 Fernando Perez <fperez@colorado.edu>
3887 3892
3888 3893 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
3889 3894 there's a cleaner distinction between what ? and ?? show.
3890 3895
3891 3896 * Added screen_length option. Now the user can define his own
3892 3897 screen size for page() operations.
3893 3898
3894 3899 * Implemented magic shell-like functions with automatic code
3895 3900 generation. Now adding another function is just a matter of adding
3896 3901 an entry to a dict, and the function is dynamically generated at
3897 3902 run-time. Python has some really cool features!
3898 3903
3899 3904 * Renamed many options to cleanup conventions a little. Now all
3900 3905 are lowercase, and only underscores where needed. Also in the code
3901 3906 option name tables are clearer.
3902 3907
3903 3908 * Changed prompts a little. Now input is 'In [n]:' instead of
3904 3909 'In[n]:='. This allows it the numbers to be aligned with the
3905 3910 Out[n] numbers, and removes usage of ':=' which doesn't exist in
3906 3911 Python (it was a Mathematica thing). The '...' continuation prompt
3907 3912 was also changed a little to align better.
3908 3913
3909 3914 * Fixed bug when flushing output cache. Not all _p<n> variables
3910 3915 exist, so their deletion needs to be wrapped in a try:
3911 3916
3912 3917 * Figured out how to properly use inspect.formatargspec() (it
3913 3918 requires the args preceded by *). So I removed all the code from
3914 3919 _get_pdef in Magic, which was just replicating that.
3915 3920
3916 3921 * Added test to prefilter to allow redefining magic function names
3917 3922 as variables. This is ok, since the @ form is always available,
3918 3923 but whe should allow the user to define a variable called 'ls' if
3919 3924 he needs it.
3920 3925
3921 3926 * Moved the ToDo information from README into a separate ToDo.
3922 3927
3923 3928 * General code cleanup and small bugfixes. I think it's close to a
3924 3929 state where it can be released, obviously with a big 'beta'
3925 3930 warning on it.
3926 3931
3927 3932 * Got the magic function split to work. Now all magics are defined
3928 3933 in a separate class. It just organizes things a bit, and now
3929 3934 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
3930 3935 was too long).
3931 3936
3932 3937 * Changed @clear to @reset to avoid potential confusions with
3933 3938 the shell command clear. Also renamed @cl to @clear, which does
3934 3939 exactly what people expect it to from their shell experience.
3935 3940
3936 3941 Added a check to the @reset command (since it's so
3937 3942 destructive, it's probably a good idea to ask for confirmation).
3938 3943 But now reset only works for full namespace resetting. Since the
3939 3944 del keyword is already there for deleting a few specific
3940 3945 variables, I don't see the point of having a redundant magic
3941 3946 function for the same task.
3942 3947
3943 3948 2001-11-24 Fernando Perez <fperez@colorado.edu>
3944 3949
3945 3950 * Updated the builtin docs (esp. the ? ones).
3946 3951
3947 3952 * Ran all the code through pychecker. Not terribly impressed with
3948 3953 it: lots of spurious warnings and didn't really find anything of
3949 3954 substance (just a few modules being imported and not used).
3950 3955
3951 3956 * Implemented the new ultraTB functionality into IPython. New
3952 3957 option: xcolors. This chooses color scheme. xmode now only selects
3953 3958 between Plain and Verbose. Better orthogonality.
3954 3959
3955 3960 * Large rewrite of ultraTB. Much cleaner now, with a separation of
3956 3961 mode and color scheme for the exception handlers. Now it's
3957 3962 possible to have the verbose traceback with no coloring.
3958 3963
3959 3964 2001-11-23 Fernando Perez <fperez@colorado.edu>
3960 3965
3961 3966 * Version 0.1.12 released, 0.1.13 opened.
3962 3967
3963 3968 * Removed option to set auto-quote and auto-paren escapes by
3964 3969 user. The chances of breaking valid syntax are just too high. If
3965 3970 someone *really* wants, they can always dig into the code.
3966 3971
3967 3972 * Made prompt separators configurable.
3968 3973
3969 3974 2001-11-22 Fernando Perez <fperez@colorado.edu>
3970 3975
3971 3976 * Small bugfixes in many places.
3972 3977
3973 3978 * Removed the MyCompleter class from ipplib. It seemed redundant
3974 3979 with the C-p,C-n history search functionality. Less code to
3975 3980 maintain.
3976 3981
3977 3982 * Moved all the original ipython.py code into ipythonlib.py. Right
3978 3983 now it's just one big dump into a function called make_IPython, so
3979 3984 no real modularity has been gained. But at least it makes the
3980 3985 wrapper script tiny, and since ipythonlib is a module, it gets
3981 3986 compiled and startup is much faster.
3982 3987
3983 3988 This is a reasobably 'deep' change, so we should test it for a
3984 3989 while without messing too much more with the code.
3985 3990
3986 3991 2001-11-21 Fernando Perez <fperez@colorado.edu>
3987 3992
3988 3993 * Version 0.1.11 released, 0.1.12 opened for further work.
3989 3994
3990 3995 * Removed dependency on Itpl. It was only needed in one place. It
3991 3996 would be nice if this became part of python, though. It makes life
3992 3997 *a lot* easier in some cases.
3993 3998
3994 3999 * Simplified the prefilter code a bit. Now all handlers are
3995 4000 expected to explicitly return a value (at least a blank string).
3996 4001
3997 4002 * Heavy edits in ipplib. Removed the help system altogether. Now
3998 4003 obj?/?? is used for inspecting objects, a magic @doc prints
3999 4004 docstrings, and full-blown Python help is accessed via the 'help'
4000 4005 keyword. This cleans up a lot of code (less to maintain) and does
4001 4006 the job. Since 'help' is now a standard Python component, might as
4002 4007 well use it and remove duplicate functionality.
4003 4008
4004 4009 Also removed the option to use ipplib as a standalone program. By
4005 4010 now it's too dependent on other parts of IPython to function alone.
4006 4011
4007 4012 * Fixed bug in genutils.pager. It would crash if the pager was
4008 4013 exited immediately after opening (broken pipe).
4009 4014
4010 4015 * Trimmed down the VerboseTB reporting a little. The header is
4011 4016 much shorter now and the repeated exception arguments at the end
4012 4017 have been removed. For interactive use the old header seemed a bit
4013 4018 excessive.
4014 4019
4015 4020 * Fixed small bug in output of @whos for variables with multi-word
4016 4021 types (only first word was displayed).
4017 4022
4018 4023 2001-11-17 Fernando Perez <fperez@colorado.edu>
4019 4024
4020 4025 * Version 0.1.10 released, 0.1.11 opened for further work.
4021 4026
4022 4027 * Modified dirs and friends. dirs now *returns* the stack (not
4023 4028 prints), so one can manipulate it as a variable. Convenient to
4024 4029 travel along many directories.
4025 4030
4026 4031 * Fixed bug in magic_pdef: would only work with functions with
4027 4032 arguments with default values.
4028 4033
4029 4034 2001-11-14 Fernando Perez <fperez@colorado.edu>
4030 4035
4031 4036 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4032 4037 example with IPython. Various other minor fixes and cleanups.
4033 4038
4034 4039 * Version 0.1.9 released, 0.1.10 opened for further work.
4035 4040
4036 4041 * Added sys.path to the list of directories searched in the
4037 4042 execfile= option. It used to be the current directory and the
4038 4043 user's IPYTHONDIR only.
4039 4044
4040 4045 2001-11-13 Fernando Perez <fperez@colorado.edu>
4041 4046
4042 4047 * Reinstated the raw_input/prefilter separation that Janko had
4043 4048 initially. This gives a more convenient setup for extending the
4044 4049 pre-processor from the outside: raw_input always gets a string,
4045 4050 and prefilter has to process it. We can then redefine prefilter
4046 4051 from the outside and implement extensions for special
4047 4052 purposes.
4048 4053
4049 4054 Today I got one for inputting PhysicalQuantity objects
4050 4055 (from Scientific) without needing any function calls at
4051 4056 all. Extremely convenient, and it's all done as a user-level
4052 4057 extension (no IPython code was touched). Now instead of:
4053 4058 a = PhysicalQuantity(4.2,'m/s**2')
4054 4059 one can simply say
4055 4060 a = 4.2 m/s**2
4056 4061 or even
4057 4062 a = 4.2 m/s^2
4058 4063
4059 4064 I use this, but it's also a proof of concept: IPython really is
4060 4065 fully user-extensible, even at the level of the parsing of the
4061 4066 command line. It's not trivial, but it's perfectly doable.
4062 4067
4063 4068 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4064 4069 the problem of modules being loaded in the inverse order in which
4065 4070 they were defined in
4066 4071
4067 4072 * Version 0.1.8 released, 0.1.9 opened for further work.
4068 4073
4069 4074 * Added magics pdef, source and file. They respectively show the
4070 4075 definition line ('prototype' in C), source code and full python
4071 4076 file for any callable object. The object inspector oinfo uses
4072 4077 these to show the same information.
4073 4078
4074 4079 * Version 0.1.7 released, 0.1.8 opened for further work.
4075 4080
4076 4081 * Separated all the magic functions into a class called Magic. The
4077 4082 InteractiveShell class was becoming too big for Xemacs to handle
4078 4083 (de-indenting a line would lock it up for 10 seconds while it
4079 4084 backtracked on the whole class!)
4080 4085
4081 4086 FIXME: didn't work. It can be done, but right now namespaces are
4082 4087 all messed up. Do it later (reverted it for now, so at least
4083 4088 everything works as before).
4084 4089
4085 4090 * Got the object introspection system (magic_oinfo) working! I
4086 4091 think this is pretty much ready for release to Janko, so he can
4087 4092 test it for a while and then announce it. Pretty much 100% of what
4088 4093 I wanted for the 'phase 1' release is ready. Happy, tired.
4089 4094
4090 4095 2001-11-12 Fernando Perez <fperez@colorado.edu>
4091 4096
4092 4097 * Version 0.1.6 released, 0.1.7 opened for further work.
4093 4098
4094 4099 * Fixed bug in printing: it used to test for truth before
4095 4100 printing, so 0 wouldn't print. Now checks for None.
4096 4101
4097 4102 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4098 4103 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4099 4104 reaches by hand into the outputcache. Think of a better way to do
4100 4105 this later.
4101 4106
4102 4107 * Various small fixes thanks to Nathan's comments.
4103 4108
4104 4109 * Changed magic_pprint to magic_Pprint. This way it doesn't
4105 4110 collide with pprint() and the name is consistent with the command
4106 4111 line option.
4107 4112
4108 4113 * Changed prompt counter behavior to be fully like
4109 4114 Mathematica's. That is, even input that doesn't return a result
4110 4115 raises the prompt counter. The old behavior was kind of confusing
4111 4116 (getting the same prompt number several times if the operation
4112 4117 didn't return a result).
4113 4118
4114 4119 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4115 4120
4116 4121 * Fixed -Classic mode (wasn't working anymore).
4117 4122
4118 4123 * Added colored prompts using Nathan's new code. Colors are
4119 4124 currently hardwired, they can be user-configurable. For
4120 4125 developers, they can be chosen in file ipythonlib.py, at the
4121 4126 beginning of the CachedOutput class def.
4122 4127
4123 4128 2001-11-11 Fernando Perez <fperez@colorado.edu>
4124 4129
4125 4130 * Version 0.1.5 released, 0.1.6 opened for further work.
4126 4131
4127 4132 * Changed magic_env to *return* the environment as a dict (not to
4128 4133 print it). This way it prints, but it can also be processed.
4129 4134
4130 4135 * Added Verbose exception reporting to interactive
4131 4136 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4132 4137 traceback. Had to make some changes to the ultraTB file. This is
4133 4138 probably the last 'big' thing in my mental todo list. This ties
4134 4139 in with the next entry:
4135 4140
4136 4141 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4137 4142 has to specify is Plain, Color or Verbose for all exception
4138 4143 handling.
4139 4144
4140 4145 * Removed ShellServices option. All this can really be done via
4141 4146 the magic system. It's easier to extend, cleaner and has automatic
4142 4147 namespace protection and documentation.
4143 4148
4144 4149 2001-11-09 Fernando Perez <fperez@colorado.edu>
4145 4150
4146 4151 * Fixed bug in output cache flushing (missing parameter to
4147 4152 __init__). Other small bugs fixed (found using pychecker).
4148 4153
4149 4154 * Version 0.1.4 opened for bugfixing.
4150 4155
4151 4156 2001-11-07 Fernando Perez <fperez@colorado.edu>
4152 4157
4153 4158 * Version 0.1.3 released, mainly because of the raw_input bug.
4154 4159
4155 4160 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4156 4161 and when testing for whether things were callable, a call could
4157 4162 actually be made to certain functions. They would get called again
4158 4163 once 'really' executed, with a resulting double call. A disaster
4159 4164 in many cases (list.reverse() would never work!).
4160 4165
4161 4166 * Removed prefilter() function, moved its code to raw_input (which
4162 4167 after all was just a near-empty caller for prefilter). This saves
4163 4168 a function call on every prompt, and simplifies the class a tiny bit.
4164 4169
4165 4170 * Fix _ip to __ip name in magic example file.
4166 4171
4167 4172 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4168 4173 work with non-gnu versions of tar.
4169 4174
4170 4175 2001-11-06 Fernando Perez <fperez@colorado.edu>
4171 4176
4172 4177 * Version 0.1.2. Just to keep track of the recent changes.
4173 4178
4174 4179 * Fixed nasty bug in output prompt routine. It used to check 'if
4175 4180 arg != None...'. Problem is, this fails if arg implements a
4176 4181 special comparison (__cmp__) which disallows comparing to
4177 4182 None. Found it when trying to use the PhysicalQuantity module from
4178 4183 ScientificPython.
4179 4184
4180 4185 2001-11-05 Fernando Perez <fperez@colorado.edu>
4181 4186
4182 4187 * Also added dirs. Now the pushd/popd/dirs family functions
4183 4188 basically like the shell, with the added convenience of going home
4184 4189 when called with no args.
4185 4190
4186 4191 * pushd/popd slightly modified to mimic shell behavior more
4187 4192 closely.
4188 4193
4189 4194 * Added env,pushd,popd from ShellServices as magic functions. I
4190 4195 think the cleanest will be to port all desired functions from
4191 4196 ShellServices as magics and remove ShellServices altogether. This
4192 4197 will provide a single, clean way of adding functionality
4193 4198 (shell-type or otherwise) to IP.
4194 4199
4195 4200 2001-11-04 Fernando Perez <fperez@colorado.edu>
4196 4201
4197 4202 * Added .ipython/ directory to sys.path. This way users can keep
4198 4203 customizations there and access them via import.
4199 4204
4200 4205 2001-11-03 Fernando Perez <fperez@colorado.edu>
4201 4206
4202 4207 * Opened version 0.1.1 for new changes.
4203 4208
4204 4209 * Changed version number to 0.1.0: first 'public' release, sent to
4205 4210 Nathan and Janko.
4206 4211
4207 4212 * Lots of small fixes and tweaks.
4208 4213
4209 4214 * Minor changes to whos format. Now strings are shown, snipped if
4210 4215 too long.
4211 4216
4212 4217 * Changed ShellServices to work on __main__ so they show up in @who
4213 4218
4214 4219 * Help also works with ? at the end of a line:
4215 4220 ?sin and sin?
4216 4221 both produce the same effect. This is nice, as often I use the
4217 4222 tab-complete to find the name of a method, but I used to then have
4218 4223 to go to the beginning of the line to put a ? if I wanted more
4219 4224 info. Now I can just add the ? and hit return. Convenient.
4220 4225
4221 4226 2001-11-02 Fernando Perez <fperez@colorado.edu>
4222 4227
4223 4228 * Python version check (>=2.1) added.
4224 4229
4225 4230 * Added LazyPython documentation. At this point the docs are quite
4226 4231 a mess. A cleanup is in order.
4227 4232
4228 4233 * Auto-installer created. For some bizarre reason, the zipfiles
4229 4234 module isn't working on my system. So I made a tar version
4230 4235 (hopefully the command line options in various systems won't kill
4231 4236 me).
4232 4237
4233 4238 * Fixes to Struct in genutils. Now all dictionary-like methods are
4234 4239 protected (reasonably).
4235 4240
4236 4241 * Added pager function to genutils and changed ? to print usage
4237 4242 note through it (it was too long).
4238 4243
4239 4244 * Added the LazyPython functionality. Works great! I changed the
4240 4245 auto-quote escape to ';', it's on home row and next to '. But
4241 4246 both auto-quote and auto-paren (still /) escapes are command-line
4242 4247 parameters.
4243 4248
4244 4249
4245 4250 2001-11-01 Fernando Perez <fperez@colorado.edu>
4246 4251
4247 4252 * Version changed to 0.0.7. Fairly large change: configuration now
4248 4253 is all stored in a directory, by default .ipython. There, all
4249 4254 config files have normal looking names (not .names)
4250 4255
4251 4256 * Version 0.0.6 Released first to Lucas and Archie as a test
4252 4257 run. Since it's the first 'semi-public' release, change version to
4253 4258 > 0.0.6 for any changes now.
4254 4259
4255 4260 * Stuff I had put in the ipplib.py changelog:
4256 4261
4257 4262 Changes to InteractiveShell:
4258 4263
4259 4264 - Made the usage message a parameter.
4260 4265
4261 4266 - Require the name of the shell variable to be given. It's a bit
4262 4267 of a hack, but allows the name 'shell' not to be hardwire in the
4263 4268 magic (@) handler, which is problematic b/c it requires
4264 4269 polluting the global namespace with 'shell'. This in turn is
4265 4270 fragile: if a user redefines a variable called shell, things
4266 4271 break.
4267 4272
4268 4273 - magic @: all functions available through @ need to be defined
4269 4274 as magic_<name>, even though they can be called simply as
4270 4275 @<name>. This allows the special command @magic to gather
4271 4276 information automatically about all existing magic functions,
4272 4277 even if they are run-time user extensions, by parsing the shell
4273 4278 instance __dict__ looking for special magic_ names.
4274 4279
4275 4280 - mainloop: added *two* local namespace parameters. This allows
4276 4281 the class to differentiate between parameters which were there
4277 4282 before and after command line initialization was processed. This
4278 4283 way, later @who can show things loaded at startup by the
4279 4284 user. This trick was necessary to make session saving/reloading
4280 4285 really work: ideally after saving/exiting/reloading a session,
4281 4286 *everythin* should look the same, including the output of @who. I
4282 4287 was only able to make this work with this double namespace
4283 4288 trick.
4284 4289
4285 4290 - added a header to the logfile which allows (almost) full
4286 4291 session restoring.
4287 4292
4288 4293 - prepend lines beginning with @ or !, with a and log
4289 4294 them. Why? !lines: may be useful to know what you did @lines:
4290 4295 they may affect session state. So when restoring a session, at
4291 4296 least inform the user of their presence. I couldn't quite get
4292 4297 them to properly re-execute, but at least the user is warned.
4293 4298
4294 4299 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now