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