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