##// END OF EJS Templates
%cpaste: strip whitespace before >>> in regex to allow pasting doctests
vivainio2 -
Show More
@@ -1,3311 +1,3311 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 4 $Id: Magic.py 2996 2008-01-30 06:31:39Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 9 #
10 10 # Distributed under the terms of the BSD License. The full license is in
11 11 # the file COPYING, distributed as part of this software.
12 12 #*****************************************************************************
13 13
14 14 #****************************************************************************
15 15 # Modules and globals
16 16
17 17 from IPython import Release
18 18 __author__ = '%s <%s>\n%s <%s>' % \
19 19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
20 20 __license__ = Release.license
21 21
22 22 # Python standard modules
23 23 import __builtin__
24 24 import bdb
25 25 import inspect
26 26 import os
27 27 import pdb
28 28 import pydoc
29 29 import sys
30 30 import re
31 31 import tempfile
32 32 import time
33 33 import cPickle as pickle
34 34 import textwrap
35 35 from cStringIO import StringIO
36 36 from getopt import getopt,GetoptError
37 37 from pprint import pprint, pformat
38 38 from sets import Set
39 39
40 40 # cProfile was added in Python2.5
41 41 try:
42 42 import cProfile as profile
43 43 import pstats
44 44 except ImportError:
45 45 # profile isn't bundled by default in Debian for license reasons
46 46 try:
47 47 import profile,pstats
48 48 except ImportError:
49 49 profile = pstats = None
50 50
51 51 # Homebrewed
52 52 import IPython
53 53 from IPython import Debugger, OInspect, wildcard
54 54 from IPython.FakeModule import FakeModule
55 55 from IPython.Itpl import Itpl, itpl, printpl,itplns
56 56 from IPython.PyColorize import Parser
57 57 from IPython.ipstruct import Struct
58 58 from IPython.macro import Macro
59 59 from IPython.genutils import *
60 60 from IPython import platutils
61 61 import IPython.generics
62 62 import IPython.ipapi
63 63 from IPython.ipapi import UsageError
64 64 #***************************************************************************
65 65 # Utility functions
66 66 def on_off(tag):
67 67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
68 68 return ['OFF','ON'][tag]
69 69
70 70 class Bunch: pass
71 71
72 72 def compress_dhist(dh):
73 73 head, tail = dh[:-10], dh[-10:]
74 74
75 75 newhead = []
76 76 done = Set()
77 77 for h in head:
78 78 if h in done:
79 79 continue
80 80 newhead.append(h)
81 81 done.add(h)
82 82
83 83 return newhead + tail
84 84
85 85
86 86 #***************************************************************************
87 87 # Main class implementing Magic functionality
88 88 class Magic:
89 89 """Magic functions for InteractiveShell.
90 90
91 91 Shell functions which can be reached as %function_name. All magic
92 92 functions should accept a string, which they can parse for their own
93 93 needs. This can make some functions easier to type, eg `%cd ../`
94 94 vs. `%cd("../")`
95 95
96 96 ALL definitions MUST begin with the prefix magic_. The user won't need it
97 97 at the command line, but it is is needed in the definition. """
98 98
99 99 # class globals
100 100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
101 101 'Automagic is ON, % prefix NOT needed for magic functions.']
102 102
103 103 #......................................................................
104 104 # some utility functions
105 105
106 106 def __init__(self,shell):
107 107
108 108 self.options_table = {}
109 109 if profile is None:
110 110 self.magic_prun = self.profile_missing_notice
111 111 self.shell = shell
112 112
113 113 # namespace for holding state we may need
114 114 self._magic_state = Bunch()
115 115
116 116 def profile_missing_notice(self, *args, **kwargs):
117 117 error("""\
118 118 The profile module could not be found. It has been removed from the standard
119 119 python packages because of its non-free license. To use profiling, install the
120 120 python-profiler package from non-free.""")
121 121
122 122 def default_option(self,fn,optstr):
123 123 """Make an entry in the options_table for fn, with value optstr"""
124 124
125 125 if fn not in self.lsmagic():
126 126 error("%s is not a magic function" % fn)
127 127 self.options_table[fn] = optstr
128 128
129 129 def lsmagic(self):
130 130 """Return a list of currently available magic functions.
131 131
132 132 Gives a list of the bare names after mangling (['ls','cd', ...], not
133 133 ['magic_ls','magic_cd',...]"""
134 134
135 135 # FIXME. This needs a cleanup, in the way the magics list is built.
136 136
137 137 # magics in class definition
138 138 class_magic = lambda fn: fn.startswith('magic_') and \
139 139 callable(Magic.__dict__[fn])
140 140 # in instance namespace (run-time user additions)
141 141 inst_magic = lambda fn: fn.startswith('magic_') and \
142 142 callable(self.__dict__[fn])
143 143 # and bound magics by user (so they can access self):
144 144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
145 145 callable(self.__class__.__dict__[fn])
146 146 magics = filter(class_magic,Magic.__dict__.keys()) + \
147 147 filter(inst_magic,self.__dict__.keys()) + \
148 148 filter(inst_bound_magic,self.__class__.__dict__.keys())
149 149 out = []
150 150 for fn in Set(magics):
151 151 out.append(fn.replace('magic_','',1))
152 152 out.sort()
153 153 return out
154 154
155 155 def extract_input_slices(self,slices,raw=False):
156 156 """Return as a string a set of input history slices.
157 157
158 158 Inputs:
159 159
160 160 - slices: the set of slices is given as a list of strings (like
161 161 ['1','4:8','9'], since this function is for use by magic functions
162 162 which get their arguments as strings.
163 163
164 164 Optional inputs:
165 165
166 166 - raw(False): by default, the processed input is used. If this is
167 167 true, the raw input history is used instead.
168 168
169 169 Note that slices can be called with two notations:
170 170
171 171 N:M -> standard python form, means including items N...(M-1).
172 172
173 173 N-M -> include items N..M (closed endpoint)."""
174 174
175 175 if raw:
176 176 hist = self.shell.input_hist_raw
177 177 else:
178 178 hist = self.shell.input_hist
179 179
180 180 cmds = []
181 181 for chunk in slices:
182 182 if ':' in chunk:
183 183 ini,fin = map(int,chunk.split(':'))
184 184 elif '-' in chunk:
185 185 ini,fin = map(int,chunk.split('-'))
186 186 fin += 1
187 187 else:
188 188 ini = int(chunk)
189 189 fin = ini+1
190 190 cmds.append(hist[ini:fin])
191 191 return cmds
192 192
193 193 def _ofind(self, oname, namespaces=None):
194 194 """Find an object in the available namespaces.
195 195
196 196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
197 197
198 198 Has special code to detect magic functions.
199 199 """
200 200
201 201 oname = oname.strip()
202 202
203 203 alias_ns = None
204 204 if namespaces is None:
205 205 # Namespaces to search in:
206 206 # Put them in a list. The order is important so that we
207 207 # find things in the same order that Python finds them.
208 208 namespaces = [ ('Interactive', self.shell.user_ns),
209 209 ('IPython internal', self.shell.internal_ns),
210 210 ('Python builtin', __builtin__.__dict__),
211 211 ('Alias', self.shell.alias_table),
212 212 ]
213 213 alias_ns = self.shell.alias_table
214 214
215 215 # initialize results to 'null'
216 216 found = 0; obj = None; ospace = None; ds = None;
217 217 ismagic = 0; isalias = 0; parent = None
218 218
219 219 # Look for the given name by splitting it in parts. If the head is
220 220 # found, then we look for all the remaining parts as members, and only
221 221 # declare success if we can find them all.
222 222 oname_parts = oname.split('.')
223 223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
224 224 for nsname,ns in namespaces:
225 225 try:
226 226 obj = ns[oname_head]
227 227 except KeyError:
228 228 continue
229 229 else:
230 230 #print 'oname_rest:', oname_rest # dbg
231 231 for part in oname_rest:
232 232 try:
233 233 parent = obj
234 234 obj = getattr(obj,part)
235 235 except:
236 236 # Blanket except b/c some badly implemented objects
237 237 # allow __getattr__ to raise exceptions other than
238 238 # AttributeError, which then crashes IPython.
239 239 break
240 240 else:
241 241 # If we finish the for loop (no break), we got all members
242 242 found = 1
243 243 ospace = nsname
244 244 if ns == alias_ns:
245 245 isalias = 1
246 246 break # namespace loop
247 247
248 248 # Try to see if it's magic
249 249 if not found:
250 250 if oname.startswith(self.shell.ESC_MAGIC):
251 251 oname = oname[1:]
252 252 obj = getattr(self,'magic_'+oname,None)
253 253 if obj is not None:
254 254 found = 1
255 255 ospace = 'IPython internal'
256 256 ismagic = 1
257 257
258 258 # Last try: special-case some literals like '', [], {}, etc:
259 259 if not found and oname_head in ["''",'""','[]','{}','()']:
260 260 obj = eval(oname_head)
261 261 found = 1
262 262 ospace = 'Interactive'
263 263
264 264 return {'found':found, 'obj':obj, 'namespace':ospace,
265 265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
266 266
267 267 def arg_err(self,func):
268 268 """Print docstring if incorrect arguments were passed"""
269 269 print 'Error in arguments:'
270 270 print OInspect.getdoc(func)
271 271
272 272 def format_latex(self,strng):
273 273 """Format a string for latex inclusion."""
274 274
275 275 # Characters that need to be escaped for latex:
276 276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
277 277 # Magic command names as headers:
278 278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
279 279 re.MULTILINE)
280 280 # Magic commands
281 281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
282 282 re.MULTILINE)
283 283 # Paragraph continue
284 284 par_re = re.compile(r'\\$',re.MULTILINE)
285 285
286 286 # The "\n" symbol
287 287 newline_re = re.compile(r'\\n')
288 288
289 289 # Now build the string for output:
290 290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
291 291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
292 292 strng)
293 293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
294 294 strng = par_re.sub(r'\\\\',strng)
295 295 strng = escape_re.sub(r'\\\1',strng)
296 296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
297 297 return strng
298 298
299 299 def format_screen(self,strng):
300 300 """Format a string for screen printing.
301 301
302 302 This removes some latex-type format codes."""
303 303 # Paragraph continue
304 304 par_re = re.compile(r'\\$',re.MULTILINE)
305 305 strng = par_re.sub('',strng)
306 306 return strng
307 307
308 308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
309 309 """Parse options passed to an argument string.
310 310
311 311 The interface is similar to that of getopt(), but it returns back a
312 312 Struct with the options as keys and the stripped argument string still
313 313 as a string.
314 314
315 315 arg_str is quoted as a true sys.argv vector by using shlex.split.
316 316 This allows us to easily expand variables, glob files, quote
317 317 arguments, etc.
318 318
319 319 Options:
320 320 -mode: default 'string'. If given as 'list', the argument string is
321 321 returned as a list (split on whitespace) instead of a string.
322 322
323 323 -list_all: put all option values in lists. Normally only options
324 324 appearing more than once are put in a list.
325 325
326 326 -posix (True): whether to split the input line in POSIX mode or not,
327 327 as per the conventions outlined in the shlex module from the
328 328 standard library."""
329 329
330 330 # inject default options at the beginning of the input line
331 331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
332 332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
333 333
334 334 mode = kw.get('mode','string')
335 335 if mode not in ['string','list']:
336 336 raise ValueError,'incorrect mode given: %s' % mode
337 337 # Get options
338 338 list_all = kw.get('list_all',0)
339 339 posix = kw.get('posix',True)
340 340
341 341 # Check if we have more than one argument to warrant extra processing:
342 342 odict = {} # Dictionary with options
343 343 args = arg_str.split()
344 344 if len(args) >= 1:
345 345 # If the list of inputs only has 0 or 1 thing in it, there's no
346 346 # need to look for options
347 347 argv = arg_split(arg_str,posix)
348 348 # Do regular option processing
349 349 try:
350 350 opts,args = getopt(argv,opt_str,*long_opts)
351 351 except GetoptError,e:
352 352 raise UsageError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
353 353 " ".join(long_opts)))
354 354 for o,a in opts:
355 355 if o.startswith('--'):
356 356 o = o[2:]
357 357 else:
358 358 o = o[1:]
359 359 try:
360 360 odict[o].append(a)
361 361 except AttributeError:
362 362 odict[o] = [odict[o],a]
363 363 except KeyError:
364 364 if list_all:
365 365 odict[o] = [a]
366 366 else:
367 367 odict[o] = a
368 368
369 369 # Prepare opts,args for return
370 370 opts = Struct(odict)
371 371 if mode == 'string':
372 372 args = ' '.join(args)
373 373
374 374 return opts,args
375 375
376 376 #......................................................................
377 377 # And now the actual magic functions
378 378
379 379 # Functions for IPython shell work (vars,funcs, config, etc)
380 380 def magic_lsmagic(self, parameter_s = ''):
381 381 """List currently available magic functions."""
382 382 mesc = self.shell.ESC_MAGIC
383 383 print 'Available magic functions:\n'+mesc+\
384 384 (' '+mesc).join(self.lsmagic())
385 385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
386 386 return None
387 387
388 388 def magic_magic(self, parameter_s = ''):
389 389 """Print information about the magic function system.
390 390
391 391 Supported formats: -latex, -brief, -rest
392 392 """
393 393
394 394 mode = ''
395 395 try:
396 396 if parameter_s.split()[0] == '-latex':
397 397 mode = 'latex'
398 398 if parameter_s.split()[0] == '-brief':
399 399 mode = 'brief'
400 400 if parameter_s.split()[0] == '-rest':
401 401 mode = 'rest'
402 402 rest_docs = []
403 403 except:
404 404 pass
405 405
406 406 magic_docs = []
407 407 for fname in self.lsmagic():
408 408 mname = 'magic_' + fname
409 409 for space in (Magic,self,self.__class__):
410 410 try:
411 411 fn = space.__dict__[mname]
412 412 except KeyError:
413 413 pass
414 414 else:
415 415 break
416 416 if mode == 'brief':
417 417 # only first line
418 418 if fn.__doc__:
419 419 fndoc = fn.__doc__.split('\n',1)[0]
420 420 else:
421 421 fndoc = 'No documentation'
422 422 else:
423 423 fndoc = fn.__doc__.rstrip()
424 424
425 425 if mode == 'rest':
426 426 rest_docs.append('**%s%s**::\n\n\t%s\n\n' %(self.shell.ESC_MAGIC,
427 427 fname,fndoc))
428 428
429 429 else:
430 430 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
431 431 fname,fndoc))
432 432
433 433 magic_docs = ''.join(magic_docs)
434 434
435 435 if mode == 'rest':
436 436 return "".join(rest_docs)
437 437
438 438 if mode == 'latex':
439 439 print self.format_latex(magic_docs)
440 440 return
441 441 else:
442 442 magic_docs = self.format_screen(magic_docs)
443 443 if mode == 'brief':
444 444 return magic_docs
445 445
446 446 outmsg = """
447 447 IPython's 'magic' functions
448 448 ===========================
449 449
450 450 The magic function system provides a series of functions which allow you to
451 451 control the behavior of IPython itself, plus a lot of system-type
452 452 features. All these functions are prefixed with a % character, but parameters
453 453 are given without parentheses or quotes.
454 454
455 455 NOTE: If you have 'automagic' enabled (via the command line option or with the
456 456 %automagic function), you don't need to type in the % explicitly. By default,
457 457 IPython ships with automagic on, so you should only rarely need the % escape.
458 458
459 459 Example: typing '%cd mydir' (without the quotes) changes you working directory
460 460 to 'mydir', if it exists.
461 461
462 462 You can define your own magic functions to extend the system. See the supplied
463 463 ipythonrc and example-magic.py files for details (in your ipython
464 464 configuration directory, typically $HOME/.ipython/).
465 465
466 466 You can also define your own aliased names for magic functions. In your
467 467 ipythonrc file, placing a line like:
468 468
469 469 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
470 470
471 471 will define %pf as a new name for %profile.
472 472
473 473 You can also call magics in code using the ipmagic() function, which IPython
474 474 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
475 475
476 476 For a list of the available magic functions, use %lsmagic. For a description
477 477 of any of them, type %magic_name?, e.g. '%cd?'.
478 478
479 479 Currently the magic system has the following functions:\n"""
480 480
481 481 mesc = self.shell.ESC_MAGIC
482 482 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
483 483 "\n\n%s%s\n\n%s" % (outmsg,
484 484 magic_docs,mesc,mesc,
485 485 (' '+mesc).join(self.lsmagic()),
486 486 Magic.auto_status[self.shell.rc.automagic] ) )
487 487
488 488 page(outmsg,screen_lines=self.shell.rc.screen_length)
489 489
490 490
491 491 def magic_autoindent(self, parameter_s = ''):
492 492 """Toggle autoindent on/off (if available)."""
493 493
494 494 self.shell.set_autoindent()
495 495 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
496 496
497 497
498 498 def magic_automagic(self, parameter_s = ''):
499 499 """Make magic functions callable without having to type the initial %.
500 500
501 501 Without argumentsl toggles on/off (when off, you must call it as
502 502 %automagic, of course). With arguments it sets the value, and you can
503 503 use any of (case insensitive):
504 504
505 505 - on,1,True: to activate
506 506
507 507 - off,0,False: to deactivate.
508 508
509 509 Note that magic functions have lowest priority, so if there's a
510 510 variable whose name collides with that of a magic fn, automagic won't
511 511 work for that function (you get the variable instead). However, if you
512 512 delete the variable (del var), the previously shadowed magic function
513 513 becomes visible to automagic again."""
514 514
515 515 rc = self.shell.rc
516 516 arg = parameter_s.lower()
517 517 if parameter_s in ('on','1','true'):
518 518 rc.automagic = True
519 519 elif parameter_s in ('off','0','false'):
520 520 rc.automagic = False
521 521 else:
522 522 rc.automagic = not rc.automagic
523 523 print '\n' + Magic.auto_status[rc.automagic]
524 524
525 525
526 526 def magic_autocall(self, parameter_s = ''):
527 527 """Make functions callable without having to type parentheses.
528 528
529 529 Usage:
530 530
531 531 %autocall [mode]
532 532
533 533 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
534 534 value is toggled on and off (remembering the previous state).
535 535
536 536 In more detail, these values mean:
537 537
538 538 0 -> fully disabled
539 539
540 540 1 -> active, but do not apply if there are no arguments on the line.
541 541
542 542 In this mode, you get:
543 543
544 544 In [1]: callable
545 545 Out[1]: <built-in function callable>
546 546
547 547 In [2]: callable 'hello'
548 548 ------> callable('hello')
549 549 Out[2]: False
550 550
551 551 2 -> Active always. Even if no arguments are present, the callable
552 552 object is called:
553 553
554 554 In [4]: callable
555 555 ------> callable()
556 556
557 557 Note that even with autocall off, you can still use '/' at the start of
558 558 a line to treat the first argument on the command line as a function
559 559 and add parentheses to it:
560 560
561 561 In [8]: /str 43
562 562 ------> str(43)
563 563 Out[8]: '43'
564 564 """
565 565
566 566 rc = self.shell.rc
567 567
568 568 if parameter_s:
569 569 arg = int(parameter_s)
570 570 else:
571 571 arg = 'toggle'
572 572
573 573 if not arg in (0,1,2,'toggle'):
574 574 error('Valid modes: (0->Off, 1->Smart, 2->Full')
575 575 return
576 576
577 577 if arg in (0,1,2):
578 578 rc.autocall = arg
579 579 else: # toggle
580 580 if rc.autocall:
581 581 self._magic_state.autocall_save = rc.autocall
582 582 rc.autocall = 0
583 583 else:
584 584 try:
585 585 rc.autocall = self._magic_state.autocall_save
586 586 except AttributeError:
587 587 rc.autocall = self._magic_state.autocall_save = 1
588 588
589 589 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
590 590
591 591 def magic_system_verbose(self, parameter_s = ''):
592 592 """Set verbose printing of system calls.
593 593
594 594 If called without an argument, act as a toggle"""
595 595
596 596 if parameter_s:
597 597 val = bool(eval(parameter_s))
598 598 else:
599 599 val = None
600 600
601 601 self.shell.rc_set_toggle('system_verbose',val)
602 602 print "System verbose printing is:",\
603 603 ['OFF','ON'][self.shell.rc.system_verbose]
604 604
605 605
606 606 def magic_page(self, parameter_s=''):
607 607 """Pretty print the object and display it through a pager.
608 608
609 609 %page [options] OBJECT
610 610
611 611 If no object is given, use _ (last output).
612 612
613 613 Options:
614 614
615 615 -r: page str(object), don't pretty-print it."""
616 616
617 617 # After a function contributed by Olivier Aubert, slightly modified.
618 618
619 619 # Process options/args
620 620 opts,args = self.parse_options(parameter_s,'r')
621 621 raw = 'r' in opts
622 622
623 623 oname = args and args or '_'
624 624 info = self._ofind(oname)
625 625 if info['found']:
626 626 txt = (raw and str or pformat)( info['obj'] )
627 627 page(txt)
628 628 else:
629 629 print 'Object `%s` not found' % oname
630 630
631 631 def magic_profile(self, parameter_s=''):
632 632 """Print your currently active IPyhton profile."""
633 633 if self.shell.rc.profile:
634 634 printpl('Current IPython profile: $self.shell.rc.profile.')
635 635 else:
636 636 print 'No profile active.'
637 637
638 638 def magic_pinfo(self, parameter_s='', namespaces=None):
639 639 """Provide detailed information about an object.
640 640
641 641 '%pinfo object' is just a synonym for object? or ?object."""
642 642
643 643 #print 'pinfo par: <%s>' % parameter_s # dbg
644 644
645 645
646 646 # detail_level: 0 -> obj? , 1 -> obj??
647 647 detail_level = 0
648 648 # We need to detect if we got called as 'pinfo pinfo foo', which can
649 649 # happen if the user types 'pinfo foo?' at the cmd line.
650 650 pinfo,qmark1,oname,qmark2 = \
651 651 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
652 652 if pinfo or qmark1 or qmark2:
653 653 detail_level = 1
654 654 if "*" in oname:
655 655 self.magic_psearch(oname)
656 656 else:
657 657 self._inspect('pinfo', oname, detail_level=detail_level,
658 658 namespaces=namespaces)
659 659
660 660 def magic_pdef(self, parameter_s='', namespaces=None):
661 661 """Print the definition header for any callable object.
662 662
663 663 If the object is a class, print the constructor information."""
664 664 self._inspect('pdef',parameter_s, namespaces)
665 665
666 666 def magic_pdoc(self, parameter_s='', namespaces=None):
667 667 """Print the docstring for an object.
668 668
669 669 If the given object is a class, it will print both the class and the
670 670 constructor docstrings."""
671 671 self._inspect('pdoc',parameter_s, namespaces)
672 672
673 673 def magic_psource(self, parameter_s='', namespaces=None):
674 674 """Print (or run through pager) the source code for an object."""
675 675 self._inspect('psource',parameter_s, namespaces)
676 676
677 677 def magic_pfile(self, parameter_s=''):
678 678 """Print (or run through pager) the file where an object is defined.
679 679
680 680 The file opens at the line where the object definition begins. IPython
681 681 will honor the environment variable PAGER if set, and otherwise will
682 682 do its best to print the file in a convenient form.
683 683
684 684 If the given argument is not an object currently defined, IPython will
685 685 try to interpret it as a filename (automatically adding a .py extension
686 686 if needed). You can thus use %pfile as a syntax highlighting code
687 687 viewer."""
688 688
689 689 # first interpret argument as an object name
690 690 out = self._inspect('pfile',parameter_s)
691 691 # if not, try the input as a filename
692 692 if out == 'not found':
693 693 try:
694 694 filename = get_py_filename(parameter_s)
695 695 except IOError,msg:
696 696 print msg
697 697 return
698 698 page(self.shell.inspector.format(file(filename).read()))
699 699
700 700 def _inspect(self,meth,oname,namespaces=None,**kw):
701 701 """Generic interface to the inspector system.
702 702
703 703 This function is meant to be called by pdef, pdoc & friends."""
704 704
705 705 #oname = oname.strip()
706 706 #print '1- oname: <%r>' % oname # dbg
707 707 try:
708 708 oname = oname.strip().encode('ascii')
709 709 #print '2- oname: <%r>' % oname # dbg
710 710 except UnicodeEncodeError:
711 711 print 'Python identifiers can only contain ascii characters.'
712 712 return 'not found'
713 713
714 714 info = Struct(self._ofind(oname, namespaces))
715 715
716 716 if info.found:
717 717 try:
718 718 IPython.generics.inspect_object(info.obj)
719 719 return
720 720 except IPython.ipapi.TryNext:
721 721 pass
722 722 # Get the docstring of the class property if it exists.
723 723 path = oname.split('.')
724 724 root = '.'.join(path[:-1])
725 725 if info.parent is not None:
726 726 try:
727 727 target = getattr(info.parent, '__class__')
728 728 # The object belongs to a class instance.
729 729 try:
730 730 target = getattr(target, path[-1])
731 731 # The class defines the object.
732 732 if isinstance(target, property):
733 733 oname = root + '.__class__.' + path[-1]
734 734 info = Struct(self._ofind(oname))
735 735 except AttributeError: pass
736 736 except AttributeError: pass
737 737
738 738 pmethod = getattr(self.shell.inspector,meth)
739 739 formatter = info.ismagic and self.format_screen or None
740 740 if meth == 'pdoc':
741 741 pmethod(info.obj,oname,formatter)
742 742 elif meth == 'pinfo':
743 743 pmethod(info.obj,oname,formatter,info,**kw)
744 744 else:
745 745 pmethod(info.obj,oname)
746 746 else:
747 747 print 'Object `%s` not found.' % oname
748 748 return 'not found' # so callers can take other action
749 749
750 750 def magic_psearch(self, parameter_s=''):
751 751 """Search for object in namespaces by wildcard.
752 752
753 753 %psearch [options] PATTERN [OBJECT TYPE]
754 754
755 755 Note: ? can be used as a synonym for %psearch, at the beginning or at
756 756 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
757 757 rest of the command line must be unchanged (options come first), so
758 758 for example the following forms are equivalent
759 759
760 760 %psearch -i a* function
761 761 -i a* function?
762 762 ?-i a* function
763 763
764 764 Arguments:
765 765
766 766 PATTERN
767 767
768 768 where PATTERN is a string containing * as a wildcard similar to its
769 769 use in a shell. The pattern is matched in all namespaces on the
770 770 search path. By default objects starting with a single _ are not
771 771 matched, many IPython generated objects have a single
772 772 underscore. The default is case insensitive matching. Matching is
773 773 also done on the attributes of objects and not only on the objects
774 774 in a module.
775 775
776 776 [OBJECT TYPE]
777 777
778 778 Is the name of a python type from the types module. The name is
779 779 given in lowercase without the ending type, ex. StringType is
780 780 written string. By adding a type here only objects matching the
781 781 given type are matched. Using all here makes the pattern match all
782 782 types (this is the default).
783 783
784 784 Options:
785 785
786 786 -a: makes the pattern match even objects whose names start with a
787 787 single underscore. These names are normally ommitted from the
788 788 search.
789 789
790 790 -i/-c: make the pattern case insensitive/sensitive. If neither of
791 791 these options is given, the default is read from your ipythonrc
792 792 file. The option name which sets this value is
793 793 'wildcards_case_sensitive'. If this option is not specified in your
794 794 ipythonrc file, IPython's internal default is to do a case sensitive
795 795 search.
796 796
797 797 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
798 798 specifiy can be searched in any of the following namespaces:
799 799 'builtin', 'user', 'user_global','internal', 'alias', where
800 800 'builtin' and 'user' are the search defaults. Note that you should
801 801 not use quotes when specifying namespaces.
802 802
803 803 'Builtin' contains the python module builtin, 'user' contains all
804 804 user data, 'alias' only contain the shell aliases and no python
805 805 objects, 'internal' contains objects used by IPython. The
806 806 'user_global' namespace is only used by embedded IPython instances,
807 807 and it contains module-level globals. You can add namespaces to the
808 808 search with -s or exclude them with -e (these options can be given
809 809 more than once).
810 810
811 811 Examples:
812 812
813 813 %psearch a* -> objects beginning with an a
814 814 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
815 815 %psearch a* function -> all functions beginning with an a
816 816 %psearch re.e* -> objects beginning with an e in module re
817 817 %psearch r*.e* -> objects that start with e in modules starting in r
818 818 %psearch r*.* string -> all strings in modules beginning with r
819 819
820 820 Case sensitve search:
821 821
822 822 %psearch -c a* list all object beginning with lower case a
823 823
824 824 Show objects beginning with a single _:
825 825
826 826 %psearch -a _* list objects beginning with a single underscore"""
827 827 try:
828 828 parameter_s = parameter_s.encode('ascii')
829 829 except UnicodeEncodeError:
830 830 print 'Python identifiers can only contain ascii characters.'
831 831 return
832 832
833 833 # default namespaces to be searched
834 834 def_search = ['user','builtin']
835 835
836 836 # Process options/args
837 837 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
838 838 opt = opts.get
839 839 shell = self.shell
840 840 psearch = shell.inspector.psearch
841 841
842 842 # select case options
843 843 if opts.has_key('i'):
844 844 ignore_case = True
845 845 elif opts.has_key('c'):
846 846 ignore_case = False
847 847 else:
848 848 ignore_case = not shell.rc.wildcards_case_sensitive
849 849
850 850 # Build list of namespaces to search from user options
851 851 def_search.extend(opt('s',[]))
852 852 ns_exclude = ns_exclude=opt('e',[])
853 853 ns_search = [nm for nm in def_search if nm not in ns_exclude]
854 854
855 855 # Call the actual search
856 856 try:
857 857 psearch(args,shell.ns_table,ns_search,
858 858 show_all=opt('a'),ignore_case=ignore_case)
859 859 except:
860 860 shell.showtraceback()
861 861
862 862 def magic_who_ls(self, parameter_s=''):
863 863 """Return a sorted list of all interactive variables.
864 864
865 865 If arguments are given, only variables of types matching these
866 866 arguments are returned."""
867 867
868 868 user_ns = self.shell.user_ns
869 869 internal_ns = self.shell.internal_ns
870 870 user_config_ns = self.shell.user_config_ns
871 871 out = []
872 872 typelist = parameter_s.split()
873 873
874 874 for i in user_ns:
875 875 if not (i.startswith('_') or i.startswith('_i')) \
876 876 and not (i in internal_ns or i in user_config_ns):
877 877 if typelist:
878 878 if type(user_ns[i]).__name__ in typelist:
879 879 out.append(i)
880 880 else:
881 881 out.append(i)
882 882 out.sort()
883 883 return out
884 884
885 885 def magic_who(self, parameter_s=''):
886 886 """Print all interactive variables, with some minimal formatting.
887 887
888 888 If any arguments are given, only variables whose type matches one of
889 889 these are printed. For example:
890 890
891 891 %who function str
892 892
893 893 will only list functions and strings, excluding all other types of
894 894 variables. To find the proper type names, simply use type(var) at a
895 895 command line to see how python prints type names. For example:
896 896
897 897 In [1]: type('hello')\\
898 898 Out[1]: <type 'str'>
899 899
900 900 indicates that the type name for strings is 'str'.
901 901
902 902 %who always excludes executed names loaded through your configuration
903 903 file and things which are internal to IPython.
904 904
905 905 This is deliberate, as typically you may load many modules and the
906 906 purpose of %who is to show you only what you've manually defined."""
907 907
908 908 varlist = self.magic_who_ls(parameter_s)
909 909 if not varlist:
910 910 if parameter_s:
911 911 print 'No variables match your requested type.'
912 912 else:
913 913 print 'Interactive namespace is empty.'
914 914 return
915 915
916 916 # if we have variables, move on...
917 917 count = 0
918 918 for i in varlist:
919 919 print i+'\t',
920 920 count += 1
921 921 if count > 8:
922 922 count = 0
923 923 print
924 924 print
925 925
926 926 def magic_whos(self, parameter_s=''):
927 927 """Like %who, but gives some extra information about each variable.
928 928
929 929 The same type filtering of %who can be applied here.
930 930
931 931 For all variables, the type is printed. Additionally it prints:
932 932
933 933 - For {},[],(): their length.
934 934
935 935 - For numpy and Numeric arrays, a summary with shape, number of
936 936 elements, typecode and size in memory.
937 937
938 938 - Everything else: a string representation, snipping their middle if
939 939 too long."""
940 940
941 941 varnames = self.magic_who_ls(parameter_s)
942 942 if not varnames:
943 943 if parameter_s:
944 944 print 'No variables match your requested type.'
945 945 else:
946 946 print 'Interactive namespace is empty.'
947 947 return
948 948
949 949 # if we have variables, move on...
950 950
951 951 # for these types, show len() instead of data:
952 952 seq_types = [types.DictType,types.ListType,types.TupleType]
953 953
954 954 # for numpy/Numeric arrays, display summary info
955 955 try:
956 956 import numpy
957 957 except ImportError:
958 958 ndarray_type = None
959 959 else:
960 960 ndarray_type = numpy.ndarray.__name__
961 961 try:
962 962 import Numeric
963 963 except ImportError:
964 964 array_type = None
965 965 else:
966 966 array_type = Numeric.ArrayType.__name__
967 967
968 968 # Find all variable names and types so we can figure out column sizes
969 969 def get_vars(i):
970 970 return self.shell.user_ns[i]
971 971
972 972 # some types are well known and can be shorter
973 973 abbrevs = {'IPython.macro.Macro' : 'Macro'}
974 974 def type_name(v):
975 975 tn = type(v).__name__
976 976 return abbrevs.get(tn,tn)
977 977
978 978 varlist = map(get_vars,varnames)
979 979
980 980 typelist = []
981 981 for vv in varlist:
982 982 tt = type_name(vv)
983 983
984 984 if tt=='instance':
985 985 typelist.append( abbrevs.get(str(vv.__class__),
986 986 str(vv.__class__)))
987 987 else:
988 988 typelist.append(tt)
989 989
990 990 # column labels and # of spaces as separator
991 991 varlabel = 'Variable'
992 992 typelabel = 'Type'
993 993 datalabel = 'Data/Info'
994 994 colsep = 3
995 995 # variable format strings
996 996 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
997 997 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
998 998 aformat = "%s: %s elems, type `%s`, %s bytes"
999 999 # find the size of the columns to format the output nicely
1000 1000 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
1001 1001 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
1002 1002 # table header
1003 1003 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
1004 1004 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
1005 1005 # and the table itself
1006 1006 kb = 1024
1007 1007 Mb = 1048576 # kb**2
1008 1008 for vname,var,vtype in zip(varnames,varlist,typelist):
1009 1009 print itpl(vformat),
1010 1010 if vtype in seq_types:
1011 1011 print len(var)
1012 1012 elif vtype in [array_type,ndarray_type]:
1013 1013 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1014 1014 if vtype==ndarray_type:
1015 1015 # numpy
1016 1016 vsize = var.size
1017 1017 vbytes = vsize*var.itemsize
1018 1018 vdtype = var.dtype
1019 1019 else:
1020 1020 # Numeric
1021 1021 vsize = Numeric.size(var)
1022 1022 vbytes = vsize*var.itemsize()
1023 1023 vdtype = var.typecode()
1024 1024
1025 1025 if vbytes < 100000:
1026 1026 print aformat % (vshape,vsize,vdtype,vbytes)
1027 1027 else:
1028 1028 print aformat % (vshape,vsize,vdtype,vbytes),
1029 1029 if vbytes < Mb:
1030 1030 print '(%s kb)' % (vbytes/kb,)
1031 1031 else:
1032 1032 print '(%s Mb)' % (vbytes/Mb,)
1033 1033 else:
1034 1034 try:
1035 1035 vstr = str(var)
1036 1036 except UnicodeEncodeError:
1037 1037 vstr = unicode(var).encode(sys.getdefaultencoding(),
1038 1038 'backslashreplace')
1039 1039 vstr = vstr.replace('\n','\\n')
1040 1040 if len(vstr) < 50:
1041 1041 print vstr
1042 1042 else:
1043 1043 printpl(vfmt_short)
1044 1044
1045 1045 def magic_reset(self, parameter_s=''):
1046 1046 """Resets the namespace by removing all names defined by the user.
1047 1047
1048 1048 Input/Output history are left around in case you need them."""
1049 1049
1050 1050 ans = self.shell.ask_yes_no(
1051 1051 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1052 1052 if not ans:
1053 1053 print 'Nothing done.'
1054 1054 return
1055 1055 user_ns = self.shell.user_ns
1056 1056 for i in self.magic_who_ls():
1057 1057 del(user_ns[i])
1058 1058
1059 1059 # Also flush the private list of module references kept for script
1060 1060 # execution protection
1061 1061 self.shell._user_main_modules[:] = []
1062 1062
1063 1063 def magic_logstart(self,parameter_s=''):
1064 1064 """Start logging anywhere in a session.
1065 1065
1066 1066 %logstart [-o|-r|-t] [log_name [log_mode]]
1067 1067
1068 1068 If no name is given, it defaults to a file named 'ipython_log.py' in your
1069 1069 current directory, in 'rotate' mode (see below).
1070 1070
1071 1071 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1072 1072 history up to that point and then continues logging.
1073 1073
1074 1074 %logstart takes a second optional parameter: logging mode. This can be one
1075 1075 of (note that the modes are given unquoted):\\
1076 1076 append: well, that says it.\\
1077 1077 backup: rename (if exists) to name~ and start name.\\
1078 1078 global: single logfile in your home dir, appended to.\\
1079 1079 over : overwrite existing log.\\
1080 1080 rotate: create rotating logs name.1~, name.2~, etc.
1081 1081
1082 1082 Options:
1083 1083
1084 1084 -o: log also IPython's output. In this mode, all commands which
1085 1085 generate an Out[NN] prompt are recorded to the logfile, right after
1086 1086 their corresponding input line. The output lines are always
1087 1087 prepended with a '#[Out]# ' marker, so that the log remains valid
1088 1088 Python code.
1089 1089
1090 1090 Since this marker is always the same, filtering only the output from
1091 1091 a log is very easy, using for example a simple awk call:
1092 1092
1093 1093 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1094 1094
1095 1095 -r: log 'raw' input. Normally, IPython's logs contain the processed
1096 1096 input, so that user lines are logged in their final form, converted
1097 1097 into valid Python. For example, %Exit is logged as
1098 1098 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1099 1099 exactly as typed, with no transformations applied.
1100 1100
1101 1101 -t: put timestamps before each input line logged (these are put in
1102 1102 comments)."""
1103 1103
1104 1104 opts,par = self.parse_options(parameter_s,'ort')
1105 1105 log_output = 'o' in opts
1106 1106 log_raw_input = 'r' in opts
1107 1107 timestamp = 't' in opts
1108 1108
1109 1109 rc = self.shell.rc
1110 1110 logger = self.shell.logger
1111 1111
1112 1112 # if no args are given, the defaults set in the logger constructor by
1113 1113 # ipytohn remain valid
1114 1114 if par:
1115 1115 try:
1116 1116 logfname,logmode = par.split()
1117 1117 except:
1118 1118 logfname = par
1119 1119 logmode = 'backup'
1120 1120 else:
1121 1121 logfname = logger.logfname
1122 1122 logmode = logger.logmode
1123 1123 # put logfname into rc struct as if it had been called on the command
1124 1124 # line, so it ends up saved in the log header Save it in case we need
1125 1125 # to restore it...
1126 1126 old_logfile = rc.opts.get('logfile','')
1127 1127 if logfname:
1128 1128 logfname = os.path.expanduser(logfname)
1129 1129 rc.opts.logfile = logfname
1130 1130 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1131 1131 try:
1132 1132 started = logger.logstart(logfname,loghead,logmode,
1133 1133 log_output,timestamp,log_raw_input)
1134 1134 except:
1135 1135 rc.opts.logfile = old_logfile
1136 1136 warn("Couldn't start log: %s" % sys.exc_info()[1])
1137 1137 else:
1138 1138 # log input history up to this point, optionally interleaving
1139 1139 # output if requested
1140 1140
1141 1141 if timestamp:
1142 1142 # disable timestamping for the previous history, since we've
1143 1143 # lost those already (no time machine here).
1144 1144 logger.timestamp = False
1145 1145
1146 1146 if log_raw_input:
1147 1147 input_hist = self.shell.input_hist_raw
1148 1148 else:
1149 1149 input_hist = self.shell.input_hist
1150 1150
1151 1151 if log_output:
1152 1152 log_write = logger.log_write
1153 1153 output_hist = self.shell.output_hist
1154 1154 for n in range(1,len(input_hist)-1):
1155 1155 log_write(input_hist[n].rstrip())
1156 1156 if n in output_hist:
1157 1157 log_write(repr(output_hist[n]),'output')
1158 1158 else:
1159 1159 logger.log_write(input_hist[1:])
1160 1160 if timestamp:
1161 1161 # re-enable timestamping
1162 1162 logger.timestamp = True
1163 1163
1164 1164 print ('Activating auto-logging. '
1165 1165 'Current session state plus future input saved.')
1166 1166 logger.logstate()
1167 1167
1168 1168 def magic_logstop(self,parameter_s=''):
1169 1169 """Fully stop logging and close log file.
1170 1170
1171 1171 In order to start logging again, a new %logstart call needs to be made,
1172 1172 possibly (though not necessarily) with a new filename, mode and other
1173 1173 options."""
1174 1174 self.logger.logstop()
1175 1175
1176 1176 def magic_logoff(self,parameter_s=''):
1177 1177 """Temporarily stop logging.
1178 1178
1179 1179 You must have previously started logging."""
1180 1180 self.shell.logger.switch_log(0)
1181 1181
1182 1182 def magic_logon(self,parameter_s=''):
1183 1183 """Restart logging.
1184 1184
1185 1185 This function is for restarting logging which you've temporarily
1186 1186 stopped with %logoff. For starting logging for the first time, you
1187 1187 must use the %logstart function, which allows you to specify an
1188 1188 optional log filename."""
1189 1189
1190 1190 self.shell.logger.switch_log(1)
1191 1191
1192 1192 def magic_logstate(self,parameter_s=''):
1193 1193 """Print the status of the logging system."""
1194 1194
1195 1195 self.shell.logger.logstate()
1196 1196
1197 1197 def magic_pdb(self, parameter_s=''):
1198 1198 """Control the automatic calling of the pdb interactive debugger.
1199 1199
1200 1200 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1201 1201 argument it works as a toggle.
1202 1202
1203 1203 When an exception is triggered, IPython can optionally call the
1204 1204 interactive pdb debugger after the traceback printout. %pdb toggles
1205 1205 this feature on and off.
1206 1206
1207 1207 The initial state of this feature is set in your ipythonrc
1208 1208 configuration file (the variable is called 'pdb').
1209 1209
1210 1210 If you want to just activate the debugger AFTER an exception has fired,
1211 1211 without having to type '%pdb on' and rerunning your code, you can use
1212 1212 the %debug magic."""
1213 1213
1214 1214 par = parameter_s.strip().lower()
1215 1215
1216 1216 if par:
1217 1217 try:
1218 1218 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1219 1219 except KeyError:
1220 1220 print ('Incorrect argument. Use on/1, off/0, '
1221 1221 'or nothing for a toggle.')
1222 1222 return
1223 1223 else:
1224 1224 # toggle
1225 1225 new_pdb = not self.shell.call_pdb
1226 1226
1227 1227 # set on the shell
1228 1228 self.shell.call_pdb = new_pdb
1229 1229 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1230 1230
1231 1231 def magic_debug(self, parameter_s=''):
1232 1232 """Activate the interactive debugger in post-mortem mode.
1233 1233
1234 1234 If an exception has just occurred, this lets you inspect its stack
1235 1235 frames interactively. Note that this will always work only on the last
1236 1236 traceback that occurred, so you must call this quickly after an
1237 1237 exception that you wish to inspect has fired, because if another one
1238 1238 occurs, it clobbers the previous one.
1239 1239
1240 1240 If you want IPython to automatically do this on every exception, see
1241 1241 the %pdb magic for more details.
1242 1242 """
1243 1243
1244 1244 self.shell.debugger(force=True)
1245 1245
1246 1246 def magic_prun(self, parameter_s ='',user_mode=1,
1247 1247 opts=None,arg_lst=None,prog_ns=None):
1248 1248
1249 1249 """Run a statement through the python code profiler.
1250 1250
1251 1251 Usage:\\
1252 1252 %prun [options] statement
1253 1253
1254 1254 The given statement (which doesn't require quote marks) is run via the
1255 1255 python profiler in a manner similar to the profile.run() function.
1256 1256 Namespaces are internally managed to work correctly; profile.run
1257 1257 cannot be used in IPython because it makes certain assumptions about
1258 1258 namespaces which do not hold under IPython.
1259 1259
1260 1260 Options:
1261 1261
1262 1262 -l <limit>: you can place restrictions on what or how much of the
1263 1263 profile gets printed. The limit value can be:
1264 1264
1265 1265 * A string: only information for function names containing this string
1266 1266 is printed.
1267 1267
1268 1268 * An integer: only these many lines are printed.
1269 1269
1270 1270 * A float (between 0 and 1): this fraction of the report is printed
1271 1271 (for example, use a limit of 0.4 to see the topmost 40% only).
1272 1272
1273 1273 You can combine several limits with repeated use of the option. For
1274 1274 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1275 1275 information about class constructors.
1276 1276
1277 1277 -r: return the pstats.Stats object generated by the profiling. This
1278 1278 object has all the information about the profile in it, and you can
1279 1279 later use it for further analysis or in other functions.
1280 1280
1281 1281 -s <key>: sort profile by given key. You can provide more than one key
1282 1282 by using the option several times: '-s key1 -s key2 -s key3...'. The
1283 1283 default sorting key is 'time'.
1284 1284
1285 1285 The following is copied verbatim from the profile documentation
1286 1286 referenced below:
1287 1287
1288 1288 When more than one key is provided, additional keys are used as
1289 1289 secondary criteria when the there is equality in all keys selected
1290 1290 before them.
1291 1291
1292 1292 Abbreviations can be used for any key names, as long as the
1293 1293 abbreviation is unambiguous. The following are the keys currently
1294 1294 defined:
1295 1295
1296 1296 Valid Arg Meaning\\
1297 1297 "calls" call count\\
1298 1298 "cumulative" cumulative time\\
1299 1299 "file" file name\\
1300 1300 "module" file name\\
1301 1301 "pcalls" primitive call count\\
1302 1302 "line" line number\\
1303 1303 "name" function name\\
1304 1304 "nfl" name/file/line\\
1305 1305 "stdname" standard name\\
1306 1306 "time" internal time
1307 1307
1308 1308 Note that all sorts on statistics are in descending order (placing
1309 1309 most time consuming items first), where as name, file, and line number
1310 1310 searches are in ascending order (i.e., alphabetical). The subtle
1311 1311 distinction between "nfl" and "stdname" is that the standard name is a
1312 1312 sort of the name as printed, which means that the embedded line
1313 1313 numbers get compared in an odd way. For example, lines 3, 20, and 40
1314 1314 would (if the file names were the same) appear in the string order
1315 1315 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1316 1316 line numbers. In fact, sort_stats("nfl") is the same as
1317 1317 sort_stats("name", "file", "line").
1318 1318
1319 1319 -T <filename>: save profile results as shown on screen to a text
1320 1320 file. The profile is still shown on screen.
1321 1321
1322 1322 -D <filename>: save (via dump_stats) profile statistics to given
1323 1323 filename. This data is in a format understod by the pstats module, and
1324 1324 is generated by a call to the dump_stats() method of profile
1325 1325 objects. The profile is still shown on screen.
1326 1326
1327 1327 If you want to run complete programs under the profiler's control, use
1328 1328 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1329 1329 contains profiler specific options as described here.
1330 1330
1331 1331 You can read the complete documentation for the profile module with:\\
1332 1332 In [1]: import profile; profile.help() """
1333 1333
1334 1334 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1335 1335 # protect user quote marks
1336 1336 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1337 1337
1338 1338 if user_mode: # regular user call
1339 1339 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1340 1340 list_all=1)
1341 1341 namespace = self.shell.user_ns
1342 1342 else: # called to run a program by %run -p
1343 1343 try:
1344 1344 filename = get_py_filename(arg_lst[0])
1345 1345 except IOError,msg:
1346 1346 error(msg)
1347 1347 return
1348 1348
1349 1349 arg_str = 'execfile(filename,prog_ns)'
1350 1350 namespace = locals()
1351 1351
1352 1352 opts.merge(opts_def)
1353 1353
1354 1354 prof = profile.Profile()
1355 1355 try:
1356 1356 prof = prof.runctx(arg_str,namespace,namespace)
1357 1357 sys_exit = ''
1358 1358 except SystemExit:
1359 1359 sys_exit = """*** SystemExit exception caught in code being profiled."""
1360 1360
1361 1361 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1362 1362
1363 1363 lims = opts.l
1364 1364 if lims:
1365 1365 lims = [] # rebuild lims with ints/floats/strings
1366 1366 for lim in opts.l:
1367 1367 try:
1368 1368 lims.append(int(lim))
1369 1369 except ValueError:
1370 1370 try:
1371 1371 lims.append(float(lim))
1372 1372 except ValueError:
1373 1373 lims.append(lim)
1374 1374
1375 1375 # Trap output.
1376 1376 stdout_trap = StringIO()
1377 1377
1378 1378 if hasattr(stats,'stream'):
1379 1379 # In newer versions of python, the stats object has a 'stream'
1380 1380 # attribute to write into.
1381 1381 stats.stream = stdout_trap
1382 1382 stats.print_stats(*lims)
1383 1383 else:
1384 1384 # For older versions, we manually redirect stdout during printing
1385 1385 sys_stdout = sys.stdout
1386 1386 try:
1387 1387 sys.stdout = stdout_trap
1388 1388 stats.print_stats(*lims)
1389 1389 finally:
1390 1390 sys.stdout = sys_stdout
1391 1391
1392 1392 output = stdout_trap.getvalue()
1393 1393 output = output.rstrip()
1394 1394
1395 1395 page(output,screen_lines=self.shell.rc.screen_length)
1396 1396 print sys_exit,
1397 1397
1398 1398 dump_file = opts.D[0]
1399 1399 text_file = opts.T[0]
1400 1400 if dump_file:
1401 1401 prof.dump_stats(dump_file)
1402 1402 print '\n*** Profile stats marshalled to file',\
1403 1403 `dump_file`+'.',sys_exit
1404 1404 if text_file:
1405 1405 pfile = file(text_file,'w')
1406 1406 pfile.write(output)
1407 1407 pfile.close()
1408 1408 print '\n*** Profile printout saved to text file',\
1409 1409 `text_file`+'.',sys_exit
1410 1410
1411 1411 if opts.has_key('r'):
1412 1412 return stats
1413 1413 else:
1414 1414 return None
1415 1415
1416 1416 def magic_run(self, parameter_s ='',runner=None):
1417 1417 """Run the named file inside IPython as a program.
1418 1418
1419 1419 Usage:\\
1420 1420 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1421 1421
1422 1422 Parameters after the filename are passed as command-line arguments to
1423 1423 the program (put in sys.argv). Then, control returns to IPython's
1424 1424 prompt.
1425 1425
1426 1426 This is similar to running at a system prompt:\\
1427 1427 $ python file args\\
1428 1428 but with the advantage of giving you IPython's tracebacks, and of
1429 1429 loading all variables into your interactive namespace for further use
1430 1430 (unless -p is used, see below).
1431 1431
1432 1432 The file is executed in a namespace initially consisting only of
1433 1433 __name__=='__main__' and sys.argv constructed as indicated. It thus
1434 1434 sees its environment as if it were being run as a stand-alone program
1435 1435 (except for sharing global objects such as previously imported
1436 1436 modules). But after execution, the IPython interactive namespace gets
1437 1437 updated with all variables defined in the program (except for __name__
1438 1438 and sys.argv). This allows for very convenient loading of code for
1439 1439 interactive work, while giving each program a 'clean sheet' to run in.
1440 1440
1441 1441 Options:
1442 1442
1443 1443 -n: __name__ is NOT set to '__main__', but to the running file's name
1444 1444 without extension (as python does under import). This allows running
1445 1445 scripts and reloading the definitions in them without calling code
1446 1446 protected by an ' if __name__ == "__main__" ' clause.
1447 1447
1448 1448 -i: run the file in IPython's namespace instead of an empty one. This
1449 1449 is useful if you are experimenting with code written in a text editor
1450 1450 which depends on variables defined interactively.
1451 1451
1452 1452 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1453 1453 being run. This is particularly useful if IPython is being used to
1454 1454 run unittests, which always exit with a sys.exit() call. In such
1455 1455 cases you are interested in the output of the test results, not in
1456 1456 seeing a traceback of the unittest module.
1457 1457
1458 1458 -t: print timing information at the end of the run. IPython will give
1459 1459 you an estimated CPU time consumption for your script, which under
1460 1460 Unix uses the resource module to avoid the wraparound problems of
1461 1461 time.clock(). Under Unix, an estimate of time spent on system tasks
1462 1462 is also given (for Windows platforms this is reported as 0.0).
1463 1463
1464 1464 If -t is given, an additional -N<N> option can be given, where <N>
1465 1465 must be an integer indicating how many times you want the script to
1466 1466 run. The final timing report will include total and per run results.
1467 1467
1468 1468 For example (testing the script uniq_stable.py):
1469 1469
1470 1470 In [1]: run -t uniq_stable
1471 1471
1472 1472 IPython CPU timings (estimated):\\
1473 1473 User : 0.19597 s.\\
1474 1474 System: 0.0 s.\\
1475 1475
1476 1476 In [2]: run -t -N5 uniq_stable
1477 1477
1478 1478 IPython CPU timings (estimated):\\
1479 1479 Total runs performed: 5\\
1480 1480 Times : Total Per run\\
1481 1481 User : 0.910862 s, 0.1821724 s.\\
1482 1482 System: 0.0 s, 0.0 s.
1483 1483
1484 1484 -d: run your program under the control of pdb, the Python debugger.
1485 1485 This allows you to execute your program step by step, watch variables,
1486 1486 etc. Internally, what IPython does is similar to calling:
1487 1487
1488 1488 pdb.run('execfile("YOURFILENAME")')
1489 1489
1490 1490 with a breakpoint set on line 1 of your file. You can change the line
1491 1491 number for this automatic breakpoint to be <N> by using the -bN option
1492 1492 (where N must be an integer). For example:
1493 1493
1494 1494 %run -d -b40 myscript
1495 1495
1496 1496 will set the first breakpoint at line 40 in myscript.py. Note that
1497 1497 the first breakpoint must be set on a line which actually does
1498 1498 something (not a comment or docstring) for it to stop execution.
1499 1499
1500 1500 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1501 1501 first enter 'c' (without qoutes) to start execution up to the first
1502 1502 breakpoint.
1503 1503
1504 1504 Entering 'help' gives information about the use of the debugger. You
1505 1505 can easily see pdb's full documentation with "import pdb;pdb.help()"
1506 1506 at a prompt.
1507 1507
1508 1508 -p: run program under the control of the Python profiler module (which
1509 1509 prints a detailed report of execution times, function calls, etc).
1510 1510
1511 1511 You can pass other options after -p which affect the behavior of the
1512 1512 profiler itself. See the docs for %prun for details.
1513 1513
1514 1514 In this mode, the program's variables do NOT propagate back to the
1515 1515 IPython interactive namespace (because they remain in the namespace
1516 1516 where the profiler executes them).
1517 1517
1518 1518 Internally this triggers a call to %prun, see its documentation for
1519 1519 details on the options available specifically for profiling.
1520 1520
1521 1521 There is one special usage for which the text above doesn't apply:
1522 1522 if the filename ends with .ipy, the file is run as ipython script,
1523 1523 just as if the commands were written on IPython prompt.
1524 1524 """
1525 1525
1526 1526 # get arguments and set sys.argv for program to be run.
1527 1527 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1528 1528 mode='list',list_all=1)
1529 1529
1530 1530 try:
1531 1531 filename = get_py_filename(arg_lst[0])
1532 1532 except IndexError:
1533 1533 warn('you must provide at least a filename.')
1534 1534 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1535 1535 return
1536 1536 except IOError,msg:
1537 1537 error(msg)
1538 1538 return
1539 1539
1540 1540 if filename.lower().endswith('.ipy'):
1541 1541 self.api.runlines(open(filename).read())
1542 1542 return
1543 1543
1544 1544 # Control the response to exit() calls made by the script being run
1545 1545 exit_ignore = opts.has_key('e')
1546 1546
1547 1547 # Make sure that the running script gets a proper sys.argv as if it
1548 1548 # were run from a system shell.
1549 1549 save_argv = sys.argv # save it for later restoring
1550 1550 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1551 1551
1552 1552 if opts.has_key('i'):
1553 1553 # Run in user's interactive namespace
1554 1554 prog_ns = self.shell.user_ns
1555 1555 __name__save = self.shell.user_ns['__name__']
1556 1556 prog_ns['__name__'] = '__main__'
1557 1557 main_mod = FakeModule(prog_ns)
1558 1558 else:
1559 1559 # Run in a fresh, empty namespace
1560 1560 if opts.has_key('n'):
1561 1561 name = os.path.splitext(os.path.basename(filename))[0]
1562 1562 else:
1563 1563 name = '__main__'
1564 1564 main_mod = FakeModule()
1565 1565 prog_ns = main_mod.__dict__
1566 1566 prog_ns['__name__'] = name
1567 1567 # The shell MUST hold a reference to main_mod so after %run exits,
1568 1568 # the python deletion mechanism doesn't zero it out (leaving
1569 1569 # dangling references)
1570 1570 self.shell._user_main_modules.append(main_mod)
1571 1571
1572 1572 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1573 1573 # set the __file__ global in the script's namespace
1574 1574 prog_ns['__file__'] = filename
1575 1575
1576 1576 # pickle fix. See iplib for an explanation. But we need to make sure
1577 1577 # that, if we overwrite __main__, we replace it at the end
1578 1578 if prog_ns['__name__'] == '__main__':
1579 1579 restore_main = sys.modules['__main__']
1580 1580 else:
1581 1581 restore_main = False
1582 1582
1583 1583 sys.modules[prog_ns['__name__']] = main_mod
1584 1584
1585 1585 stats = None
1586 1586 try:
1587 1587 self.shell.savehist()
1588 1588
1589 1589 if opts.has_key('p'):
1590 1590 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1591 1591 else:
1592 1592 if opts.has_key('d'):
1593 1593 deb = Debugger.Pdb(self.shell.rc.colors)
1594 1594 # reset Breakpoint state, which is moronically kept
1595 1595 # in a class
1596 1596 bdb.Breakpoint.next = 1
1597 1597 bdb.Breakpoint.bplist = {}
1598 1598 bdb.Breakpoint.bpbynumber = [None]
1599 1599 # Set an initial breakpoint to stop execution
1600 1600 maxtries = 10
1601 1601 bp = int(opts.get('b',[1])[0])
1602 1602 checkline = deb.checkline(filename,bp)
1603 1603 if not checkline:
1604 1604 for bp in range(bp+1,bp+maxtries+1):
1605 1605 if deb.checkline(filename,bp):
1606 1606 break
1607 1607 else:
1608 1608 msg = ("\nI failed to find a valid line to set "
1609 1609 "a breakpoint\n"
1610 1610 "after trying up to line: %s.\n"
1611 1611 "Please set a valid breakpoint manually "
1612 1612 "with the -b option." % bp)
1613 1613 error(msg)
1614 1614 return
1615 1615 # if we find a good linenumber, set the breakpoint
1616 1616 deb.do_break('%s:%s' % (filename,bp))
1617 1617 # Start file run
1618 1618 print "NOTE: Enter 'c' at the",
1619 1619 print "%s prompt to start your script." % deb.prompt
1620 1620 try:
1621 1621 deb.run('execfile("%s")' % filename,prog_ns)
1622 1622
1623 1623 except:
1624 1624 etype, value, tb = sys.exc_info()
1625 1625 # Skip three frames in the traceback: the %run one,
1626 1626 # one inside bdb.py, and the command-line typed by the
1627 1627 # user (run by exec in pdb itself).
1628 1628 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1629 1629 else:
1630 1630 if runner is None:
1631 1631 runner = self.shell.safe_execfile
1632 1632 if opts.has_key('t'):
1633 1633 # timed execution
1634 1634 try:
1635 1635 nruns = int(opts['N'][0])
1636 1636 if nruns < 1:
1637 1637 error('Number of runs must be >=1')
1638 1638 return
1639 1639 except (KeyError):
1640 1640 nruns = 1
1641 1641 if nruns == 1:
1642 1642 t0 = clock2()
1643 1643 runner(filename,prog_ns,prog_ns,
1644 1644 exit_ignore=exit_ignore)
1645 1645 t1 = clock2()
1646 1646 t_usr = t1[0]-t0[0]
1647 1647 t_sys = t1[1]-t1[1]
1648 1648 print "\nIPython CPU timings (estimated):"
1649 1649 print " User : %10s s." % t_usr
1650 1650 print " System: %10s s." % t_sys
1651 1651 else:
1652 1652 runs = range(nruns)
1653 1653 t0 = clock2()
1654 1654 for nr in runs:
1655 1655 runner(filename,prog_ns,prog_ns,
1656 1656 exit_ignore=exit_ignore)
1657 1657 t1 = clock2()
1658 1658 t_usr = t1[0]-t0[0]
1659 1659 t_sys = t1[1]-t1[1]
1660 1660 print "\nIPython CPU timings (estimated):"
1661 1661 print "Total runs performed:",nruns
1662 1662 print " Times : %10s %10s" % ('Total','Per run')
1663 1663 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1664 1664 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1665 1665
1666 1666 else:
1667 1667 # regular execution
1668 1668 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1669 1669 if opts.has_key('i'):
1670 1670 self.shell.user_ns['__name__'] = __name__save
1671 1671 else:
1672 1672 # update IPython interactive namespace
1673 1673 del prog_ns['__name__']
1674 1674 self.shell.user_ns.update(prog_ns)
1675 1675 finally:
1676 1676 sys.argv = save_argv
1677 1677 if restore_main:
1678 1678 sys.modules['__main__'] = restore_main
1679 1679 self.shell.reloadhist()
1680 1680
1681 1681 return stats
1682 1682
1683 1683 def magic_runlog(self, parameter_s =''):
1684 1684 """Run files as logs.
1685 1685
1686 1686 Usage:\\
1687 1687 %runlog file1 file2 ...
1688 1688
1689 1689 Run the named files (treating them as log files) in sequence inside
1690 1690 the interpreter, and return to the prompt. This is much slower than
1691 1691 %run because each line is executed in a try/except block, but it
1692 1692 allows running files with syntax errors in them.
1693 1693
1694 1694 Normally IPython will guess when a file is one of its own logfiles, so
1695 1695 you can typically use %run even for logs. This shorthand allows you to
1696 1696 force any file to be treated as a log file."""
1697 1697
1698 1698 for f in parameter_s.split():
1699 1699 self.shell.safe_execfile(f,self.shell.user_ns,
1700 1700 self.shell.user_ns,islog=1)
1701 1701
1702 1702 def magic_timeit(self, parameter_s =''):
1703 1703 """Time execution of a Python statement or expression
1704 1704
1705 1705 Usage:\\
1706 1706 %timeit [-n<N> -r<R> [-t|-c]] statement
1707 1707
1708 1708 Time execution of a Python statement or expression using the timeit
1709 1709 module.
1710 1710
1711 1711 Options:
1712 1712 -n<N>: execute the given statement <N> times in a loop. If this value
1713 1713 is not given, a fitting value is chosen.
1714 1714
1715 1715 -r<R>: repeat the loop iteration <R> times and take the best result.
1716 1716 Default: 3
1717 1717
1718 1718 -t: use time.time to measure the time, which is the default on Unix.
1719 1719 This function measures wall time.
1720 1720
1721 1721 -c: use time.clock to measure the time, which is the default on
1722 1722 Windows and measures wall time. On Unix, resource.getrusage is used
1723 1723 instead and returns the CPU user time.
1724 1724
1725 1725 -p<P>: use a precision of <P> digits to display the timing result.
1726 1726 Default: 3
1727 1727
1728 1728
1729 1729 Examples:\\
1730 1730 In [1]: %timeit pass
1731 1731 10000000 loops, best of 3: 53.3 ns per loop
1732 1732
1733 1733 In [2]: u = None
1734 1734
1735 1735 In [3]: %timeit u is None
1736 1736 10000000 loops, best of 3: 184 ns per loop
1737 1737
1738 1738 In [4]: %timeit -r 4 u == None
1739 1739 1000000 loops, best of 4: 242 ns per loop
1740 1740
1741 1741 In [5]: import time
1742 1742
1743 1743 In [6]: %timeit -n1 time.sleep(2)
1744 1744 1 loops, best of 3: 2 s per loop
1745 1745
1746 1746
1747 1747 The times reported by %timeit will be slightly higher than those
1748 1748 reported by the timeit.py script when variables are accessed. This is
1749 1749 due to the fact that %timeit executes the statement in the namespace
1750 1750 of the shell, compared with timeit.py, which uses a single setup
1751 1751 statement to import function or create variables. Generally, the bias
1752 1752 does not matter as long as results from timeit.py are not mixed with
1753 1753 those from %timeit."""
1754 1754
1755 1755 import timeit
1756 1756 import math
1757 1757
1758 1758 units = ["s", "ms", "\xc2\xb5s", "ns"]
1759 1759 scaling = [1, 1e3, 1e6, 1e9]
1760 1760
1761 1761 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1762 1762 posix=False)
1763 1763 if stmt == "":
1764 1764 return
1765 1765 timefunc = timeit.default_timer
1766 1766 number = int(getattr(opts, "n", 0))
1767 1767 repeat = int(getattr(opts, "r", timeit.default_repeat))
1768 1768 precision = int(getattr(opts, "p", 3))
1769 1769 if hasattr(opts, "t"):
1770 1770 timefunc = time.time
1771 1771 if hasattr(opts, "c"):
1772 1772 timefunc = clock
1773 1773
1774 1774 timer = timeit.Timer(timer=timefunc)
1775 1775 # this code has tight coupling to the inner workings of timeit.Timer,
1776 1776 # but is there a better way to achieve that the code stmt has access
1777 1777 # to the shell namespace?
1778 1778
1779 1779 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1780 1780 'setup': "pass"}
1781 1781 # Track compilation time so it can be reported if too long
1782 1782 # Minimum time above which compilation time will be reported
1783 1783 tc_min = 0.1
1784 1784
1785 1785 t0 = clock()
1786 1786 code = compile(src, "<magic-timeit>", "exec")
1787 1787 tc = clock()-t0
1788 1788
1789 1789 ns = {}
1790 1790 exec code in self.shell.user_ns, ns
1791 1791 timer.inner = ns["inner"]
1792 1792
1793 1793 if number == 0:
1794 1794 # determine number so that 0.2 <= total time < 2.0
1795 1795 number = 1
1796 1796 for i in range(1, 10):
1797 1797 number *= 10
1798 1798 if timer.timeit(number) >= 0.2:
1799 1799 break
1800 1800
1801 1801 best = min(timer.repeat(repeat, number)) / number
1802 1802
1803 1803 if best > 0.0:
1804 1804 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1805 1805 else:
1806 1806 order = 3
1807 1807 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1808 1808 precision,
1809 1809 best * scaling[order],
1810 1810 units[order])
1811 1811 if tc > tc_min:
1812 1812 print "Compiler time: %.2f s" % tc
1813 1813
1814 1814 def magic_time(self,parameter_s = ''):
1815 1815 """Time execution of a Python statement or expression.
1816 1816
1817 1817 The CPU and wall clock times are printed, and the value of the
1818 1818 expression (if any) is returned. Note that under Win32, system time
1819 1819 is always reported as 0, since it can not be measured.
1820 1820
1821 1821 This function provides very basic timing functionality. In Python
1822 1822 2.3, the timeit module offers more control and sophistication, so this
1823 1823 could be rewritten to use it (patches welcome).
1824 1824
1825 1825 Some examples:
1826 1826
1827 1827 In [1]: time 2**128
1828 1828 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1829 1829 Wall time: 0.00
1830 1830 Out[1]: 340282366920938463463374607431768211456L
1831 1831
1832 1832 In [2]: n = 1000000
1833 1833
1834 1834 In [3]: time sum(range(n))
1835 1835 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1836 1836 Wall time: 1.37
1837 1837 Out[3]: 499999500000L
1838 1838
1839 1839 In [4]: time print 'hello world'
1840 1840 hello world
1841 1841 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1842 1842 Wall time: 0.00
1843 1843
1844 1844 Note that the time needed by Python to compile the given expression
1845 1845 will be reported if it is more than 0.1s. In this example, the
1846 1846 actual exponentiation is done by Python at compilation time, so while
1847 1847 the expression can take a noticeable amount of time to compute, that
1848 1848 time is purely due to the compilation:
1849 1849
1850 1850 In [5]: time 3**9999;
1851 1851 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1852 1852 Wall time: 0.00 s
1853 1853
1854 1854 In [6]: time 3**999999;
1855 1855 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1856 1856 Wall time: 0.00 s
1857 1857 Compiler : 0.78 s
1858 1858 """
1859 1859
1860 1860 # fail immediately if the given expression can't be compiled
1861 1861
1862 1862 expr = self.shell.prefilter(parameter_s,False)
1863 1863
1864 1864 # Minimum time above which compilation time will be reported
1865 1865 tc_min = 0.1
1866 1866
1867 1867 try:
1868 1868 mode = 'eval'
1869 1869 t0 = clock()
1870 1870 code = compile(expr,'<timed eval>',mode)
1871 1871 tc = clock()-t0
1872 1872 except SyntaxError:
1873 1873 mode = 'exec'
1874 1874 t0 = clock()
1875 1875 code = compile(expr,'<timed exec>',mode)
1876 1876 tc = clock()-t0
1877 1877 # skew measurement as little as possible
1878 1878 glob = self.shell.user_ns
1879 1879 clk = clock2
1880 1880 wtime = time.time
1881 1881 # time execution
1882 1882 wall_st = wtime()
1883 1883 if mode=='eval':
1884 1884 st = clk()
1885 1885 out = eval(code,glob)
1886 1886 end = clk()
1887 1887 else:
1888 1888 st = clk()
1889 1889 exec code in glob
1890 1890 end = clk()
1891 1891 out = None
1892 1892 wall_end = wtime()
1893 1893 # Compute actual times and report
1894 1894 wall_time = wall_end-wall_st
1895 1895 cpu_user = end[0]-st[0]
1896 1896 cpu_sys = end[1]-st[1]
1897 1897 cpu_tot = cpu_user+cpu_sys
1898 1898 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1899 1899 (cpu_user,cpu_sys,cpu_tot)
1900 1900 print "Wall time: %.2f s" % wall_time
1901 1901 if tc > tc_min:
1902 1902 print "Compiler : %.2f s" % tc
1903 1903 return out
1904 1904
1905 1905 def magic_macro(self,parameter_s = ''):
1906 1906 """Define a set of input lines as a macro for future re-execution.
1907 1907
1908 1908 Usage:\\
1909 1909 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1910 1910
1911 1911 Options:
1912 1912
1913 1913 -r: use 'raw' input. By default, the 'processed' history is used,
1914 1914 so that magics are loaded in their transformed version to valid
1915 1915 Python. If this option is given, the raw input as typed as the
1916 1916 command line is used instead.
1917 1917
1918 1918 This will define a global variable called `name` which is a string
1919 1919 made of joining the slices and lines you specify (n1,n2,... numbers
1920 1920 above) from your input history into a single string. This variable
1921 1921 acts like an automatic function which re-executes those lines as if
1922 1922 you had typed them. You just type 'name' at the prompt and the code
1923 1923 executes.
1924 1924
1925 1925 The notation for indicating number ranges is: n1-n2 means 'use line
1926 1926 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1927 1927 using the lines numbered 5,6 and 7.
1928 1928
1929 1929 Note: as a 'hidden' feature, you can also use traditional python slice
1930 1930 notation, where N:M means numbers N through M-1.
1931 1931
1932 1932 For example, if your history contains (%hist prints it):
1933 1933
1934 1934 44: x=1\\
1935 1935 45: y=3\\
1936 1936 46: z=x+y\\
1937 1937 47: print x\\
1938 1938 48: a=5\\
1939 1939 49: print 'x',x,'y',y\\
1940 1940
1941 1941 you can create a macro with lines 44 through 47 (included) and line 49
1942 1942 called my_macro with:
1943 1943
1944 1944 In [51]: %macro my_macro 44-47 49
1945 1945
1946 1946 Now, typing `my_macro` (without quotes) will re-execute all this code
1947 1947 in one pass.
1948 1948
1949 1949 You don't need to give the line-numbers in order, and any given line
1950 1950 number can appear multiple times. You can assemble macros with any
1951 1951 lines from your input history in any order.
1952 1952
1953 1953 The macro is a simple object which holds its value in an attribute,
1954 1954 but IPython's display system checks for macros and executes them as
1955 1955 code instead of printing them when you type their name.
1956 1956
1957 1957 You can view a macro's contents by explicitly printing it with:
1958 1958
1959 1959 'print macro_name'.
1960 1960
1961 1961 For one-off cases which DON'T contain magic function calls in them you
1962 1962 can obtain similar results by explicitly executing slices from your
1963 1963 input history with:
1964 1964
1965 1965 In [60]: exec In[44:48]+In[49]"""
1966 1966
1967 1967 opts,args = self.parse_options(parameter_s,'r',mode='list')
1968 1968 if not args:
1969 1969 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1970 1970 macs.sort()
1971 1971 return macs
1972 1972 if len(args) == 1:
1973 1973 raise UsageError(
1974 1974 "%macro insufficient args; usage '%macro name n1-n2 n3-4...")
1975 1975 name,ranges = args[0], args[1:]
1976 1976
1977 1977 #print 'rng',ranges # dbg
1978 1978 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1979 1979 macro = Macro(lines)
1980 1980 self.shell.user_ns.update({name:macro})
1981 1981 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1982 1982 print 'Macro contents:'
1983 1983 print macro,
1984 1984
1985 1985 def magic_save(self,parameter_s = ''):
1986 1986 """Save a set of lines to a given filename.
1987 1987
1988 1988 Usage:\\
1989 1989 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1990 1990
1991 1991 Options:
1992 1992
1993 1993 -r: use 'raw' input. By default, the 'processed' history is used,
1994 1994 so that magics are loaded in their transformed version to valid
1995 1995 Python. If this option is given, the raw input as typed as the
1996 1996 command line is used instead.
1997 1997
1998 1998 This function uses the same syntax as %macro for line extraction, but
1999 1999 instead of creating a macro it saves the resulting string to the
2000 2000 filename you specify.
2001 2001
2002 2002 It adds a '.py' extension to the file if you don't do so yourself, and
2003 2003 it asks for confirmation before overwriting existing files."""
2004 2004
2005 2005 opts,args = self.parse_options(parameter_s,'r',mode='list')
2006 2006 fname,ranges = args[0], args[1:]
2007 2007 if not fname.endswith('.py'):
2008 2008 fname += '.py'
2009 2009 if os.path.isfile(fname):
2010 2010 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
2011 2011 if ans.lower() not in ['y','yes']:
2012 2012 print 'Operation cancelled.'
2013 2013 return
2014 2014 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
2015 2015 f = file(fname,'w')
2016 2016 f.write(cmds)
2017 2017 f.close()
2018 2018 print 'The following commands were written to file `%s`:' % fname
2019 2019 print cmds
2020 2020
2021 2021 def _edit_macro(self,mname,macro):
2022 2022 """open an editor with the macro data in a file"""
2023 2023 filename = self.shell.mktempfile(macro.value)
2024 2024 self.shell.hooks.editor(filename)
2025 2025
2026 2026 # and make a new macro object, to replace the old one
2027 2027 mfile = open(filename)
2028 2028 mvalue = mfile.read()
2029 2029 mfile.close()
2030 2030 self.shell.user_ns[mname] = Macro(mvalue)
2031 2031
2032 2032 def magic_ed(self,parameter_s=''):
2033 2033 """Alias to %edit."""
2034 2034 return self.magic_edit(parameter_s)
2035 2035
2036 2036 def magic_edit(self,parameter_s='',last_call=['','']):
2037 2037 """Bring up an editor and execute the resulting code.
2038 2038
2039 2039 Usage:
2040 2040 %edit [options] [args]
2041 2041
2042 2042 %edit runs IPython's editor hook. The default version of this hook is
2043 2043 set to call the __IPYTHON__.rc.editor command. This is read from your
2044 2044 environment variable $EDITOR. If this isn't found, it will default to
2045 2045 vi under Linux/Unix and to notepad under Windows. See the end of this
2046 2046 docstring for how to change the editor hook.
2047 2047
2048 2048 You can also set the value of this editor via the command line option
2049 2049 '-editor' or in your ipythonrc file. This is useful if you wish to use
2050 2050 specifically for IPython an editor different from your typical default
2051 2051 (and for Windows users who typically don't set environment variables).
2052 2052
2053 2053 This command allows you to conveniently edit multi-line code right in
2054 2054 your IPython session.
2055 2055
2056 2056 If called without arguments, %edit opens up an empty editor with a
2057 2057 temporary file and will execute the contents of this file when you
2058 2058 close it (don't forget to save it!).
2059 2059
2060 2060
2061 2061 Options:
2062 2062
2063 2063 -n <number>: open the editor at a specified line number. By default,
2064 2064 the IPython editor hook uses the unix syntax 'editor +N filename', but
2065 2065 you can configure this by providing your own modified hook if your
2066 2066 favorite editor supports line-number specifications with a different
2067 2067 syntax.
2068 2068
2069 2069 -p: this will call the editor with the same data as the previous time
2070 2070 it was used, regardless of how long ago (in your current session) it
2071 2071 was.
2072 2072
2073 2073 -r: use 'raw' input. This option only applies to input taken from the
2074 2074 user's history. By default, the 'processed' history is used, so that
2075 2075 magics are loaded in their transformed version to valid Python. If
2076 2076 this option is given, the raw input as typed as the command line is
2077 2077 used instead. When you exit the editor, it will be executed by
2078 2078 IPython's own processor.
2079 2079
2080 2080 -x: do not execute the edited code immediately upon exit. This is
2081 2081 mainly useful if you are editing programs which need to be called with
2082 2082 command line arguments, which you can then do using %run.
2083 2083
2084 2084
2085 2085 Arguments:
2086 2086
2087 2087 If arguments are given, the following possibilites exist:
2088 2088
2089 2089 - The arguments are numbers or pairs of colon-separated numbers (like
2090 2090 1 4:8 9). These are interpreted as lines of previous input to be
2091 2091 loaded into the editor. The syntax is the same of the %macro command.
2092 2092
2093 2093 - If the argument doesn't start with a number, it is evaluated as a
2094 2094 variable and its contents loaded into the editor. You can thus edit
2095 2095 any string which contains python code (including the result of
2096 2096 previous edits).
2097 2097
2098 2098 - If the argument is the name of an object (other than a string),
2099 2099 IPython will try to locate the file where it was defined and open the
2100 2100 editor at the point where it is defined. You can use `%edit function`
2101 2101 to load an editor exactly at the point where 'function' is defined,
2102 2102 edit it and have the file be executed automatically.
2103 2103
2104 2104 If the object is a macro (see %macro for details), this opens up your
2105 2105 specified editor with a temporary file containing the macro's data.
2106 2106 Upon exit, the macro is reloaded with the contents of the file.
2107 2107
2108 2108 Note: opening at an exact line is only supported under Unix, and some
2109 2109 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2110 2110 '+NUMBER' parameter necessary for this feature. Good editors like
2111 2111 (X)Emacs, vi, jed, pico and joe all do.
2112 2112
2113 2113 - If the argument is not found as a variable, IPython will look for a
2114 2114 file with that name (adding .py if necessary) and load it into the
2115 2115 editor. It will execute its contents with execfile() when you exit,
2116 2116 loading any code in the file into your interactive namespace.
2117 2117
2118 2118 After executing your code, %edit will return as output the code you
2119 2119 typed in the editor (except when it was an existing file). This way
2120 2120 you can reload the code in further invocations of %edit as a variable,
2121 2121 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2122 2122 the output.
2123 2123
2124 2124 Note that %edit is also available through the alias %ed.
2125 2125
2126 2126 This is an example of creating a simple function inside the editor and
2127 2127 then modifying it. First, start up the editor:
2128 2128
2129 2129 In [1]: ed\\
2130 2130 Editing... done. Executing edited code...\\
2131 2131 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2132 2132
2133 2133 We can then call the function foo():
2134 2134
2135 2135 In [2]: foo()\\
2136 2136 foo() was defined in an editing session
2137 2137
2138 2138 Now we edit foo. IPython automatically loads the editor with the
2139 2139 (temporary) file where foo() was previously defined:
2140 2140
2141 2141 In [3]: ed foo\\
2142 2142 Editing... done. Executing edited code...
2143 2143
2144 2144 And if we call foo() again we get the modified version:
2145 2145
2146 2146 In [4]: foo()\\
2147 2147 foo() has now been changed!
2148 2148
2149 2149 Here is an example of how to edit a code snippet successive
2150 2150 times. First we call the editor:
2151 2151
2152 2152 In [8]: ed\\
2153 2153 Editing... done. Executing edited code...\\
2154 2154 hello\\
2155 2155 Out[8]: "print 'hello'\\n"
2156 2156
2157 2157 Now we call it again with the previous output (stored in _):
2158 2158
2159 2159 In [9]: ed _\\
2160 2160 Editing... done. Executing edited code...\\
2161 2161 hello world\\
2162 2162 Out[9]: "print 'hello world'\\n"
2163 2163
2164 2164 Now we call it with the output #8 (stored in _8, also as Out[8]):
2165 2165
2166 2166 In [10]: ed _8\\
2167 2167 Editing... done. Executing edited code...\\
2168 2168 hello again\\
2169 2169 Out[10]: "print 'hello again'\\n"
2170 2170
2171 2171
2172 2172 Changing the default editor hook:
2173 2173
2174 2174 If you wish to write your own editor hook, you can put it in a
2175 2175 configuration file which you load at startup time. The default hook
2176 2176 is defined in the IPython.hooks module, and you can use that as a
2177 2177 starting example for further modifications. That file also has
2178 2178 general instructions on how to set a new hook for use once you've
2179 2179 defined it."""
2180 2180
2181 2181 # FIXME: This function has become a convoluted mess. It needs a
2182 2182 # ground-up rewrite with clean, simple logic.
2183 2183
2184 2184 def make_filename(arg):
2185 2185 "Make a filename from the given args"
2186 2186 try:
2187 2187 filename = get_py_filename(arg)
2188 2188 except IOError:
2189 2189 if args.endswith('.py'):
2190 2190 filename = arg
2191 2191 else:
2192 2192 filename = None
2193 2193 return filename
2194 2194
2195 2195 # custom exceptions
2196 2196 class DataIsObject(Exception): pass
2197 2197
2198 2198 opts,args = self.parse_options(parameter_s,'prxn:')
2199 2199 # Set a few locals from the options for convenience:
2200 2200 opts_p = opts.has_key('p')
2201 2201 opts_r = opts.has_key('r')
2202 2202
2203 2203 # Default line number value
2204 2204 lineno = opts.get('n',None)
2205 2205
2206 2206 if opts_p:
2207 2207 args = '_%s' % last_call[0]
2208 2208 if not self.shell.user_ns.has_key(args):
2209 2209 args = last_call[1]
2210 2210
2211 2211 # use last_call to remember the state of the previous call, but don't
2212 2212 # let it be clobbered by successive '-p' calls.
2213 2213 try:
2214 2214 last_call[0] = self.shell.outputcache.prompt_count
2215 2215 if not opts_p:
2216 2216 last_call[1] = parameter_s
2217 2217 except:
2218 2218 pass
2219 2219
2220 2220 # by default this is done with temp files, except when the given
2221 2221 # arg is a filename
2222 2222 use_temp = 1
2223 2223
2224 2224 if re.match(r'\d',args):
2225 2225 # Mode where user specifies ranges of lines, like in %macro.
2226 2226 # This means that you can't edit files whose names begin with
2227 2227 # numbers this way. Tough.
2228 2228 ranges = args.split()
2229 2229 data = ''.join(self.extract_input_slices(ranges,opts_r))
2230 2230 elif args.endswith('.py'):
2231 2231 filename = make_filename(args)
2232 2232 data = ''
2233 2233 use_temp = 0
2234 2234 elif args:
2235 2235 try:
2236 2236 # Load the parameter given as a variable. If not a string,
2237 2237 # process it as an object instead (below)
2238 2238
2239 2239 #print '*** args',args,'type',type(args) # dbg
2240 2240 data = eval(args,self.shell.user_ns)
2241 2241 if not type(data) in StringTypes:
2242 2242 raise DataIsObject
2243 2243
2244 2244 except (NameError,SyntaxError):
2245 2245 # given argument is not a variable, try as a filename
2246 2246 filename = make_filename(args)
2247 2247 if filename is None:
2248 2248 warn("Argument given (%s) can't be found as a variable "
2249 2249 "or as a filename." % args)
2250 2250 return
2251 2251
2252 2252 data = ''
2253 2253 use_temp = 0
2254 2254 except DataIsObject:
2255 2255
2256 2256 # macros have a special edit function
2257 2257 if isinstance(data,Macro):
2258 2258 self._edit_macro(args,data)
2259 2259 return
2260 2260
2261 2261 # For objects, try to edit the file where they are defined
2262 2262 try:
2263 2263 filename = inspect.getabsfile(data)
2264 2264 if 'fakemodule' in filename.lower() and inspect.isclass(data):
2265 2265 # class created by %edit? Try to find source
2266 2266 # by looking for method definitions instead, the
2267 2267 # __module__ in those classes is FakeModule.
2268 2268 attrs = [getattr(data, aname) for aname in dir(data)]
2269 2269 for attr in attrs:
2270 2270 if not inspect.ismethod(attr):
2271 2271 continue
2272 2272 filename = inspect.getabsfile(attr)
2273 2273 if filename and 'fakemodule' not in filename.lower():
2274 2274 # change the attribute to be the edit target instead
2275 2275 data = attr
2276 2276 break
2277 2277
2278 2278 datafile = 1
2279 2279 except TypeError:
2280 2280 filename = make_filename(args)
2281 2281 datafile = 1
2282 2282 warn('Could not find file where `%s` is defined.\n'
2283 2283 'Opening a file named `%s`' % (args,filename))
2284 2284 # Now, make sure we can actually read the source (if it was in
2285 2285 # a temp file it's gone by now).
2286 2286 if datafile:
2287 2287 try:
2288 2288 if lineno is None:
2289 2289 lineno = inspect.getsourcelines(data)[1]
2290 2290 except IOError:
2291 2291 filename = make_filename(args)
2292 2292 if filename is None:
2293 2293 warn('The file `%s` where `%s` was defined cannot '
2294 2294 'be read.' % (filename,data))
2295 2295 return
2296 2296 use_temp = 0
2297 2297 else:
2298 2298 data = ''
2299 2299
2300 2300 if use_temp:
2301 2301 filename = self.shell.mktempfile(data)
2302 2302 print 'IPython will make a temporary file named:',filename
2303 2303
2304 2304 # do actual editing here
2305 2305 print 'Editing...',
2306 2306 sys.stdout.flush()
2307 2307 self.shell.hooks.editor(filename,lineno)
2308 2308 if opts.has_key('x'): # -x prevents actual execution
2309 2309 print
2310 2310 else:
2311 2311 print 'done. Executing edited code...'
2312 2312 if opts_r:
2313 2313 self.shell.runlines(file_read(filename))
2314 2314 else:
2315 2315 self.shell.safe_execfile(filename,self.shell.user_ns,
2316 2316 self.shell.user_ns)
2317 2317 if use_temp:
2318 2318 try:
2319 2319 return open(filename).read()
2320 2320 except IOError,msg:
2321 2321 if msg.filename == filename:
2322 2322 warn('File not found. Did you forget to save?')
2323 2323 return
2324 2324 else:
2325 2325 self.shell.showtraceback()
2326 2326
2327 2327 def magic_xmode(self,parameter_s = ''):
2328 2328 """Switch modes for the exception handlers.
2329 2329
2330 2330 Valid modes: Plain, Context and Verbose.
2331 2331
2332 2332 If called without arguments, acts as a toggle."""
2333 2333
2334 2334 def xmode_switch_err(name):
2335 2335 warn('Error changing %s exception modes.\n%s' %
2336 2336 (name,sys.exc_info()[1]))
2337 2337
2338 2338 shell = self.shell
2339 2339 new_mode = parameter_s.strip().capitalize()
2340 2340 try:
2341 2341 shell.InteractiveTB.set_mode(mode=new_mode)
2342 2342 print 'Exception reporting mode:',shell.InteractiveTB.mode
2343 2343 except:
2344 2344 xmode_switch_err('user')
2345 2345
2346 2346 # threaded shells use a special handler in sys.excepthook
2347 2347 if shell.isthreaded:
2348 2348 try:
2349 2349 shell.sys_excepthook.set_mode(mode=new_mode)
2350 2350 except:
2351 2351 xmode_switch_err('threaded')
2352 2352
2353 2353 def magic_colors(self,parameter_s = ''):
2354 2354 """Switch color scheme for prompts, info system and exception handlers.
2355 2355
2356 2356 Currently implemented schemes: NoColor, Linux, LightBG.
2357 2357
2358 2358 Color scheme names are not case-sensitive."""
2359 2359
2360 2360 def color_switch_err(name):
2361 2361 warn('Error changing %s color schemes.\n%s' %
2362 2362 (name,sys.exc_info()[1]))
2363 2363
2364 2364
2365 2365 new_scheme = parameter_s.strip()
2366 2366 if not new_scheme:
2367 2367 raise UsageError(
2368 2368 "%colors: you must specify a color scheme. See '%colors?'")
2369 2369 return
2370 2370 # local shortcut
2371 2371 shell = self.shell
2372 2372
2373 2373 import IPython.rlineimpl as readline
2374 2374
2375 2375 if not readline.have_readline and sys.platform == "win32":
2376 2376 msg = """\
2377 2377 Proper color support under MS Windows requires the pyreadline library.
2378 2378 You can find it at:
2379 2379 http://ipython.scipy.org/moin/PyReadline/Intro
2380 2380 Gary's readline needs the ctypes module, from:
2381 2381 http://starship.python.net/crew/theller/ctypes
2382 2382 (Note that ctypes is already part of Python versions 2.5 and newer).
2383 2383
2384 2384 Defaulting color scheme to 'NoColor'"""
2385 2385 new_scheme = 'NoColor'
2386 2386 warn(msg)
2387 2387
2388 2388 # readline option is 0
2389 2389 if not shell.has_readline:
2390 2390 new_scheme = 'NoColor'
2391 2391
2392 2392 # Set prompt colors
2393 2393 try:
2394 2394 shell.outputcache.set_colors(new_scheme)
2395 2395 except:
2396 2396 color_switch_err('prompt')
2397 2397 else:
2398 2398 shell.rc.colors = \
2399 2399 shell.outputcache.color_table.active_scheme_name
2400 2400 # Set exception colors
2401 2401 try:
2402 2402 shell.InteractiveTB.set_colors(scheme = new_scheme)
2403 2403 shell.SyntaxTB.set_colors(scheme = new_scheme)
2404 2404 except:
2405 2405 color_switch_err('exception')
2406 2406
2407 2407 # threaded shells use a verbose traceback in sys.excepthook
2408 2408 if shell.isthreaded:
2409 2409 try:
2410 2410 shell.sys_excepthook.set_colors(scheme=new_scheme)
2411 2411 except:
2412 2412 color_switch_err('system exception handler')
2413 2413
2414 2414 # Set info (for 'object?') colors
2415 2415 if shell.rc.color_info:
2416 2416 try:
2417 2417 shell.inspector.set_active_scheme(new_scheme)
2418 2418 except:
2419 2419 color_switch_err('object inspector')
2420 2420 else:
2421 2421 shell.inspector.set_active_scheme('NoColor')
2422 2422
2423 2423 def magic_color_info(self,parameter_s = ''):
2424 2424 """Toggle color_info.
2425 2425
2426 2426 The color_info configuration parameter controls whether colors are
2427 2427 used for displaying object details (by things like %psource, %pfile or
2428 2428 the '?' system). This function toggles this value with each call.
2429 2429
2430 2430 Note that unless you have a fairly recent pager (less works better
2431 2431 than more) in your system, using colored object information displays
2432 2432 will not work properly. Test it and see."""
2433 2433
2434 2434 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2435 2435 self.magic_colors(self.shell.rc.colors)
2436 2436 print 'Object introspection functions have now coloring:',
2437 2437 print ['OFF','ON'][self.shell.rc.color_info]
2438 2438
2439 2439 def magic_Pprint(self, parameter_s=''):
2440 2440 """Toggle pretty printing on/off."""
2441 2441
2442 2442 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2443 2443 print 'Pretty printing has been turned', \
2444 2444 ['OFF','ON'][self.shell.rc.pprint]
2445 2445
2446 2446 def magic_exit(self, parameter_s=''):
2447 2447 """Exit IPython, confirming if configured to do so.
2448 2448
2449 2449 You can configure whether IPython asks for confirmation upon exit by
2450 2450 setting the confirm_exit flag in the ipythonrc file."""
2451 2451
2452 2452 self.shell.exit()
2453 2453
2454 2454 def magic_quit(self, parameter_s=''):
2455 2455 """Exit IPython, confirming if configured to do so (like %exit)"""
2456 2456
2457 2457 self.shell.exit()
2458 2458
2459 2459 def magic_Exit(self, parameter_s=''):
2460 2460 """Exit IPython without confirmation."""
2461 2461
2462 2462 self.shell.exit_now = True
2463 2463
2464 2464 #......................................................................
2465 2465 # Functions to implement unix shell-type things
2466 2466
2467 2467 def magic_alias(self, parameter_s = ''):
2468 2468 """Define an alias for a system command.
2469 2469
2470 2470 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2471 2471
2472 2472 Then, typing 'alias_name params' will execute the system command 'cmd
2473 2473 params' (from your underlying operating system).
2474 2474
2475 2475 Aliases have lower precedence than magic functions and Python normal
2476 2476 variables, so if 'foo' is both a Python variable and an alias, the
2477 2477 alias can not be executed until 'del foo' removes the Python variable.
2478 2478
2479 2479 You can use the %l specifier in an alias definition to represent the
2480 2480 whole line when the alias is called. For example:
2481 2481
2482 2482 In [2]: alias all echo "Input in brackets: <%l>"\\
2483 2483 In [3]: all hello world\\
2484 2484 Input in brackets: <hello world>
2485 2485
2486 2486 You can also define aliases with parameters using %s specifiers (one
2487 2487 per parameter):
2488 2488
2489 2489 In [1]: alias parts echo first %s second %s\\
2490 2490 In [2]: %parts A B\\
2491 2491 first A second B\\
2492 2492 In [3]: %parts A\\
2493 2493 Incorrect number of arguments: 2 expected.\\
2494 2494 parts is an alias to: 'echo first %s second %s'
2495 2495
2496 2496 Note that %l and %s are mutually exclusive. You can only use one or
2497 2497 the other in your aliases.
2498 2498
2499 2499 Aliases expand Python variables just like system calls using ! or !!
2500 2500 do: all expressions prefixed with '$' get expanded. For details of
2501 2501 the semantic rules, see PEP-215:
2502 2502 http://www.python.org/peps/pep-0215.html. This is the library used by
2503 2503 IPython for variable expansion. If you want to access a true shell
2504 2504 variable, an extra $ is necessary to prevent its expansion by IPython:
2505 2505
2506 2506 In [6]: alias show echo\\
2507 2507 In [7]: PATH='A Python string'\\
2508 2508 In [8]: show $PATH\\
2509 2509 A Python string\\
2510 2510 In [9]: show $$PATH\\
2511 2511 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2512 2512
2513 2513 You can use the alias facility to acess all of $PATH. See the %rehash
2514 2514 and %rehashx functions, which automatically create aliases for the
2515 2515 contents of your $PATH.
2516 2516
2517 2517 If called with no parameters, %alias prints the current alias table."""
2518 2518
2519 2519 par = parameter_s.strip()
2520 2520 if not par:
2521 2521 stored = self.db.get('stored_aliases', {} )
2522 2522 atab = self.shell.alias_table
2523 2523 aliases = atab.keys()
2524 2524 aliases.sort()
2525 2525 res = []
2526 2526 showlast = []
2527 2527 for alias in aliases:
2528 2528 special = False
2529 2529 try:
2530 2530 tgt = atab[alias][1]
2531 2531 except (TypeError, AttributeError):
2532 2532 # unsubscriptable? probably a callable
2533 2533 tgt = atab[alias]
2534 2534 special = True
2535 2535 # 'interesting' aliases
2536 2536 if (alias in stored or
2537 2537 special or
2538 2538 alias.lower() != os.path.splitext(tgt)[0].lower() or
2539 2539 ' ' in tgt):
2540 2540 showlast.append((alias, tgt))
2541 2541 else:
2542 2542 res.append((alias, tgt ))
2543 2543
2544 2544 # show most interesting aliases last
2545 2545 res.extend(showlast)
2546 2546 print "Total number of aliases:",len(aliases)
2547 2547 return res
2548 2548 try:
2549 2549 alias,cmd = par.split(None,1)
2550 2550 except:
2551 2551 print OInspect.getdoc(self.magic_alias)
2552 2552 else:
2553 2553 nargs = cmd.count('%s')
2554 2554 if nargs>0 and cmd.find('%l')>=0:
2555 2555 error('The %s and %l specifiers are mutually exclusive '
2556 2556 'in alias definitions.')
2557 2557 else: # all looks OK
2558 2558 self.shell.alias_table[alias] = (nargs,cmd)
2559 2559 self.shell.alias_table_validate(verbose=0)
2560 2560 # end magic_alias
2561 2561
2562 2562 def magic_unalias(self, parameter_s = ''):
2563 2563 """Remove an alias"""
2564 2564
2565 2565 aname = parameter_s.strip()
2566 2566 if aname in self.shell.alias_table:
2567 2567 del self.shell.alias_table[aname]
2568 2568 stored = self.db.get('stored_aliases', {} )
2569 2569 if aname in stored:
2570 2570 print "Removing %stored alias",aname
2571 2571 del stored[aname]
2572 2572 self.db['stored_aliases'] = stored
2573 2573
2574 2574
2575 2575 def magic_rehashx(self, parameter_s = ''):
2576 2576 """Update the alias table with all executable files in $PATH.
2577 2577
2578 2578 This version explicitly checks that every entry in $PATH is a file
2579 2579 with execute access (os.X_OK), so it is much slower than %rehash.
2580 2580
2581 2581 Under Windows, it checks executability as a match agains a
2582 2582 '|'-separated string of extensions, stored in the IPython config
2583 2583 variable win_exec_ext. This defaults to 'exe|com|bat'.
2584 2584
2585 2585 This function also resets the root module cache of module completer,
2586 2586 used on slow filesystems.
2587 2587 """
2588 2588
2589 2589
2590 2590 ip = self.api
2591 2591
2592 2592 # for the benefit of module completer in ipy_completers.py
2593 2593 del ip.db['rootmodules']
2594 2594
2595 2595 path = [os.path.abspath(os.path.expanduser(p)) for p in
2596 2596 os.environ.get('PATH','').split(os.pathsep)]
2597 2597 path = filter(os.path.isdir,path)
2598 2598
2599 2599 alias_table = self.shell.alias_table
2600 2600 syscmdlist = []
2601 2601 if os.name == 'posix':
2602 2602 isexec = lambda fname:os.path.isfile(fname) and \
2603 2603 os.access(fname,os.X_OK)
2604 2604 else:
2605 2605
2606 2606 try:
2607 2607 winext = os.environ['pathext'].replace(';','|').replace('.','')
2608 2608 except KeyError:
2609 2609 winext = 'exe|com|bat|py'
2610 2610 if 'py' not in winext:
2611 2611 winext += '|py'
2612 2612 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2613 2613 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2614 2614 savedir = os.getcwd()
2615 2615 try:
2616 2616 # write the whole loop for posix/Windows so we don't have an if in
2617 2617 # the innermost part
2618 2618 if os.name == 'posix':
2619 2619 for pdir in path:
2620 2620 os.chdir(pdir)
2621 2621 for ff in os.listdir(pdir):
2622 2622 if isexec(ff) and ff not in self.shell.no_alias:
2623 2623 # each entry in the alias table must be (N,name),
2624 2624 # where N is the number of positional arguments of the
2625 2625 # alias.
2626 2626 alias_table[ff] = (0,ff)
2627 2627 syscmdlist.append(ff)
2628 2628 else:
2629 2629 for pdir in path:
2630 2630 os.chdir(pdir)
2631 2631 for ff in os.listdir(pdir):
2632 2632 base, ext = os.path.splitext(ff)
2633 2633 if isexec(ff) and base.lower() not in self.shell.no_alias:
2634 2634 if ext.lower() == '.exe':
2635 2635 ff = base
2636 2636 alias_table[base.lower()] = (0,ff)
2637 2637 syscmdlist.append(ff)
2638 2638 # Make sure the alias table doesn't contain keywords or builtins
2639 2639 self.shell.alias_table_validate()
2640 2640 # Call again init_auto_alias() so we get 'rm -i' and other
2641 2641 # modified aliases since %rehashx will probably clobber them
2642 2642
2643 2643 # no, we don't want them. if %rehashx clobbers them, good,
2644 2644 # we'll probably get better versions
2645 2645 # self.shell.init_auto_alias()
2646 2646 db = ip.db
2647 2647 db['syscmdlist'] = syscmdlist
2648 2648 finally:
2649 2649 os.chdir(savedir)
2650 2650
2651 2651 def magic_pwd(self, parameter_s = ''):
2652 2652 """Return the current working directory path."""
2653 2653 return os.getcwd()
2654 2654
2655 2655 def magic_cd(self, parameter_s=''):
2656 2656 """Change the current working directory.
2657 2657
2658 2658 This command automatically maintains an internal list of directories
2659 2659 you visit during your IPython session, in the variable _dh. The
2660 2660 command %dhist shows this history nicely formatted. You can also
2661 2661 do 'cd -<tab>' to see directory history conveniently.
2662 2662
2663 2663 Usage:
2664 2664
2665 2665 cd 'dir': changes to directory 'dir'.
2666 2666
2667 2667 cd -: changes to the last visited directory.
2668 2668
2669 2669 cd -<n>: changes to the n-th directory in the directory history.
2670 2670
2671 2671 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2672 2672 (note: cd <bookmark_name> is enough if there is no
2673 2673 directory <bookmark_name>, but a bookmark with the name exists.)
2674 2674 'cd -b <tab>' allows you to tab-complete bookmark names.
2675 2675
2676 2676 Options:
2677 2677
2678 2678 -q: quiet. Do not print the working directory after the cd command is
2679 2679 executed. By default IPython's cd command does print this directory,
2680 2680 since the default prompts do not display path information.
2681 2681
2682 2682 Note that !cd doesn't work for this purpose because the shell where
2683 2683 !command runs is immediately discarded after executing 'command'."""
2684 2684
2685 2685 parameter_s = parameter_s.strip()
2686 2686 #bkms = self.shell.persist.get("bookmarks",{})
2687 2687
2688 2688 oldcwd = os.getcwd()
2689 2689 numcd = re.match(r'(-)(\d+)$',parameter_s)
2690 2690 # jump in directory history by number
2691 2691 if numcd:
2692 2692 nn = int(numcd.group(2))
2693 2693 try:
2694 2694 ps = self.shell.user_ns['_dh'][nn]
2695 2695 except IndexError:
2696 2696 print 'The requested directory does not exist in history.'
2697 2697 return
2698 2698 else:
2699 2699 opts = {}
2700 2700 else:
2701 2701 #turn all non-space-escaping backslashes to slashes,
2702 2702 # for c:\windows\directory\names\
2703 2703 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2704 2704 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2705 2705 # jump to previous
2706 2706 if ps == '-':
2707 2707 try:
2708 2708 ps = self.shell.user_ns['_dh'][-2]
2709 2709 except IndexError:
2710 2710 raise UsageError('%cd -: No previous directory to change to.')
2711 2711 # jump to bookmark if needed
2712 2712 else:
2713 2713 if not os.path.isdir(ps) or opts.has_key('b'):
2714 2714 bkms = self.db.get('bookmarks', {})
2715 2715
2716 2716 if bkms.has_key(ps):
2717 2717 target = bkms[ps]
2718 2718 print '(bookmark:%s) -> %s' % (ps,target)
2719 2719 ps = target
2720 2720 else:
2721 2721 if opts.has_key('b'):
2722 2722 raise UsageError("Bookmark '%s' not found. "
2723 2723 "Use '%%bookmark -l' to see your bookmarks." % ps)
2724 2724
2725 2725 # at this point ps should point to the target dir
2726 2726 if ps:
2727 2727 try:
2728 2728 os.chdir(os.path.expanduser(ps))
2729 2729 if self.shell.rc.term_title:
2730 2730 #print 'set term title:',self.shell.rc.term_title # dbg
2731 2731 ttitle = 'IPy ' + abbrev_cwd()
2732 2732 platutils.set_term_title(ttitle)
2733 2733 except OSError:
2734 2734 print sys.exc_info()[1]
2735 2735 else:
2736 2736 cwd = os.getcwd()
2737 2737 dhist = self.shell.user_ns['_dh']
2738 2738 if oldcwd != cwd:
2739 2739 dhist.append(cwd)
2740 2740 self.db['dhist'] = compress_dhist(dhist)[-100:]
2741 2741
2742 2742 else:
2743 2743 os.chdir(self.shell.home_dir)
2744 2744 if self.shell.rc.term_title:
2745 2745 platutils.set_term_title("IPy ~")
2746 2746 cwd = os.getcwd()
2747 2747 dhist = self.shell.user_ns['_dh']
2748 2748
2749 2749 if oldcwd != cwd:
2750 2750 dhist.append(cwd)
2751 2751 self.db['dhist'] = compress_dhist(dhist)[-100:]
2752 2752 if not 'q' in opts and self.shell.user_ns['_dh']:
2753 2753 print self.shell.user_ns['_dh'][-1]
2754 2754
2755 2755
2756 2756 def magic_env(self, parameter_s=''):
2757 2757 """List environment variables."""
2758 2758
2759 2759 return os.environ.data
2760 2760
2761 2761 def magic_pushd(self, parameter_s=''):
2762 2762 """Place the current dir on stack and change directory.
2763 2763
2764 2764 Usage:\\
2765 2765 %pushd ['dirname']
2766 2766 """
2767 2767
2768 2768 dir_s = self.shell.dir_stack
2769 2769 tgt = os.path.expanduser(parameter_s)
2770 2770 cwd = os.getcwd().replace(self.home_dir,'~')
2771 2771 if tgt:
2772 2772 self.magic_cd(parameter_s)
2773 2773 dir_s.insert(0,cwd)
2774 2774 return self.magic_dirs()
2775 2775
2776 2776 def magic_popd(self, parameter_s=''):
2777 2777 """Change to directory popped off the top of the stack.
2778 2778 """
2779 2779 if not self.shell.dir_stack:
2780 2780 raise UsageError("%popd on empty stack")
2781 2781 top = self.shell.dir_stack.pop(0)
2782 2782 self.magic_cd(top)
2783 2783 print "popd ->",top
2784 2784
2785 2785 def magic_dirs(self, parameter_s=''):
2786 2786 """Return the current directory stack."""
2787 2787
2788 2788 return self.shell.dir_stack
2789 2789
2790 2790 def magic_dhist(self, parameter_s=''):
2791 2791 """Print your history of visited directories.
2792 2792
2793 2793 %dhist -> print full history\\
2794 2794 %dhist n -> print last n entries only\\
2795 2795 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2796 2796
2797 2797 This history is automatically maintained by the %cd command, and
2798 2798 always available as the global list variable _dh. You can use %cd -<n>
2799 2799 to go to directory number <n>.
2800 2800
2801 2801 Note that most of time, you should view directory history by entering
2802 2802 cd -<TAB>.
2803 2803
2804 2804 """
2805 2805
2806 2806 dh = self.shell.user_ns['_dh']
2807 2807 if parameter_s:
2808 2808 try:
2809 2809 args = map(int,parameter_s.split())
2810 2810 except:
2811 2811 self.arg_err(Magic.magic_dhist)
2812 2812 return
2813 2813 if len(args) == 1:
2814 2814 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2815 2815 elif len(args) == 2:
2816 2816 ini,fin = args
2817 2817 else:
2818 2818 self.arg_err(Magic.magic_dhist)
2819 2819 return
2820 2820 else:
2821 2821 ini,fin = 0,len(dh)
2822 2822 nlprint(dh,
2823 2823 header = 'Directory history (kept in _dh)',
2824 2824 start=ini,stop=fin)
2825 2825
2826 2826
2827 2827 def magic_sc(self, parameter_s=''):
2828 2828 """Shell capture - execute a shell command and capture its output.
2829 2829
2830 2830 DEPRECATED. Suboptimal, retained for backwards compatibility.
2831 2831
2832 2832 You should use the form 'var = !command' instead. Example:
2833 2833
2834 2834 "%sc -l myfiles = ls ~" should now be written as
2835 2835
2836 2836 "myfiles = !ls ~"
2837 2837
2838 2838 myfiles.s, myfiles.l and myfiles.n still apply as documented
2839 2839 below.
2840 2840
2841 2841 --
2842 2842 %sc [options] varname=command
2843 2843
2844 2844 IPython will run the given command using commands.getoutput(), and
2845 2845 will then update the user's interactive namespace with a variable
2846 2846 called varname, containing the value of the call. Your command can
2847 2847 contain shell wildcards, pipes, etc.
2848 2848
2849 2849 The '=' sign in the syntax is mandatory, and the variable name you
2850 2850 supply must follow Python's standard conventions for valid names.
2851 2851
2852 2852 (A special format without variable name exists for internal use)
2853 2853
2854 2854 Options:
2855 2855
2856 2856 -l: list output. Split the output on newlines into a list before
2857 2857 assigning it to the given variable. By default the output is stored
2858 2858 as a single string.
2859 2859
2860 2860 -v: verbose. Print the contents of the variable.
2861 2861
2862 2862 In most cases you should not need to split as a list, because the
2863 2863 returned value is a special type of string which can automatically
2864 2864 provide its contents either as a list (split on newlines) or as a
2865 2865 space-separated string. These are convenient, respectively, either
2866 2866 for sequential processing or to be passed to a shell command.
2867 2867
2868 2868 For example:
2869 2869
2870 2870 # Capture into variable a
2871 2871 In [9]: sc a=ls *py
2872 2872
2873 2873 # a is a string with embedded newlines
2874 2874 In [10]: a
2875 2875 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2876 2876
2877 2877 # which can be seen as a list:
2878 2878 In [11]: a.l
2879 2879 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2880 2880
2881 2881 # or as a whitespace-separated string:
2882 2882 In [12]: a.s
2883 2883 Out[12]: 'setup.py win32_manual_post_install.py'
2884 2884
2885 2885 # a.s is useful to pass as a single command line:
2886 2886 In [13]: !wc -l $a.s
2887 2887 146 setup.py
2888 2888 130 win32_manual_post_install.py
2889 2889 276 total
2890 2890
2891 2891 # while the list form is useful to loop over:
2892 2892 In [14]: for f in a.l:
2893 2893 ....: !wc -l $f
2894 2894 ....:
2895 2895 146 setup.py
2896 2896 130 win32_manual_post_install.py
2897 2897
2898 2898 Similiarly, the lists returned by the -l option are also special, in
2899 2899 the sense that you can equally invoke the .s attribute on them to
2900 2900 automatically get a whitespace-separated string from their contents:
2901 2901
2902 2902 In [1]: sc -l b=ls *py
2903 2903
2904 2904 In [2]: b
2905 2905 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2906 2906
2907 2907 In [3]: b.s
2908 2908 Out[3]: 'setup.py win32_manual_post_install.py'
2909 2909
2910 2910 In summary, both the lists and strings used for ouptut capture have
2911 2911 the following special attributes:
2912 2912
2913 2913 .l (or .list) : value as list.
2914 2914 .n (or .nlstr): value as newline-separated string.
2915 2915 .s (or .spstr): value as space-separated string.
2916 2916 """
2917 2917
2918 2918 opts,args = self.parse_options(parameter_s,'lv')
2919 2919 # Try to get a variable name and command to run
2920 2920 try:
2921 2921 # the variable name must be obtained from the parse_options
2922 2922 # output, which uses shlex.split to strip options out.
2923 2923 var,_ = args.split('=',1)
2924 2924 var = var.strip()
2925 2925 # But the the command has to be extracted from the original input
2926 2926 # parameter_s, not on what parse_options returns, to avoid the
2927 2927 # quote stripping which shlex.split performs on it.
2928 2928 _,cmd = parameter_s.split('=',1)
2929 2929 except ValueError:
2930 2930 var,cmd = '',''
2931 2931 # If all looks ok, proceed
2932 2932 out,err = self.shell.getoutputerror(cmd)
2933 2933 if err:
2934 2934 print >> Term.cerr,err
2935 2935 if opts.has_key('l'):
2936 2936 out = SList(out.split('\n'))
2937 2937 else:
2938 2938 out = LSString(out)
2939 2939 if opts.has_key('v'):
2940 2940 print '%s ==\n%s' % (var,pformat(out))
2941 2941 if var:
2942 2942 self.shell.user_ns.update({var:out})
2943 2943 else:
2944 2944 return out
2945 2945
2946 2946 def magic_sx(self, parameter_s=''):
2947 2947 """Shell execute - run a shell command and capture its output.
2948 2948
2949 2949 %sx command
2950 2950
2951 2951 IPython will run the given command using commands.getoutput(), and
2952 2952 return the result formatted as a list (split on '\\n'). Since the
2953 2953 output is _returned_, it will be stored in ipython's regular output
2954 2954 cache Out[N] and in the '_N' automatic variables.
2955 2955
2956 2956 Notes:
2957 2957
2958 2958 1) If an input line begins with '!!', then %sx is automatically
2959 2959 invoked. That is, while:
2960 2960 !ls
2961 2961 causes ipython to simply issue system('ls'), typing
2962 2962 !!ls
2963 2963 is a shorthand equivalent to:
2964 2964 %sx ls
2965 2965
2966 2966 2) %sx differs from %sc in that %sx automatically splits into a list,
2967 2967 like '%sc -l'. The reason for this is to make it as easy as possible
2968 2968 to process line-oriented shell output via further python commands.
2969 2969 %sc is meant to provide much finer control, but requires more
2970 2970 typing.
2971 2971
2972 2972 3) Just like %sc -l, this is a list with special attributes:
2973 2973
2974 2974 .l (or .list) : value as list.
2975 2975 .n (or .nlstr): value as newline-separated string.
2976 2976 .s (or .spstr): value as whitespace-separated string.
2977 2977
2978 2978 This is very useful when trying to use such lists as arguments to
2979 2979 system commands."""
2980 2980
2981 2981 if parameter_s:
2982 2982 out,err = self.shell.getoutputerror(parameter_s)
2983 2983 if err:
2984 2984 print >> Term.cerr,err
2985 2985 return SList(out.split('\n'))
2986 2986
2987 2987 def magic_bg(self, parameter_s=''):
2988 2988 """Run a job in the background, in a separate thread.
2989 2989
2990 2990 For example,
2991 2991
2992 2992 %bg myfunc(x,y,z=1)
2993 2993
2994 2994 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2995 2995 execution starts, a message will be printed indicating the job
2996 2996 number. If your job number is 5, you can use
2997 2997
2998 2998 myvar = jobs.result(5) or myvar = jobs[5].result
2999 2999
3000 3000 to assign this result to variable 'myvar'.
3001 3001
3002 3002 IPython has a job manager, accessible via the 'jobs' object. You can
3003 3003 type jobs? to get more information about it, and use jobs.<TAB> to see
3004 3004 its attributes. All attributes not starting with an underscore are
3005 3005 meant for public use.
3006 3006
3007 3007 In particular, look at the jobs.new() method, which is used to create
3008 3008 new jobs. This magic %bg function is just a convenience wrapper
3009 3009 around jobs.new(), for expression-based jobs. If you want to create a
3010 3010 new job with an explicit function object and arguments, you must call
3011 3011 jobs.new() directly.
3012 3012
3013 3013 The jobs.new docstring also describes in detail several important
3014 3014 caveats associated with a thread-based model for background job
3015 3015 execution. Type jobs.new? for details.
3016 3016
3017 3017 You can check the status of all jobs with jobs.status().
3018 3018
3019 3019 The jobs variable is set by IPython into the Python builtin namespace.
3020 3020 If you ever declare a variable named 'jobs', you will shadow this
3021 3021 name. You can either delete your global jobs variable to regain
3022 3022 access to the job manager, or make a new name and assign it manually
3023 3023 to the manager (stored in IPython's namespace). For example, to
3024 3024 assign the job manager to the Jobs name, use:
3025 3025
3026 3026 Jobs = __builtins__.jobs"""
3027 3027
3028 3028 self.shell.jobs.new(parameter_s,self.shell.user_ns)
3029 3029
3030 3030 def magic_r(self, parameter_s=''):
3031 3031 """Repeat previous input.
3032 3032
3033 3033 Note: Consider using the more powerfull %rep instead!
3034 3034
3035 3035 If given an argument, repeats the previous command which starts with
3036 3036 the same string, otherwise it just repeats the previous input.
3037 3037
3038 3038 Shell escaped commands (with ! as first character) are not recognized
3039 3039 by this system, only pure python code and magic commands.
3040 3040 """
3041 3041
3042 3042 start = parameter_s.strip()
3043 3043 esc_magic = self.shell.ESC_MAGIC
3044 3044 # Identify magic commands even if automagic is on (which means
3045 3045 # the in-memory version is different from that typed by the user).
3046 3046 if self.shell.rc.automagic:
3047 3047 start_magic = esc_magic+start
3048 3048 else:
3049 3049 start_magic = start
3050 3050 # Look through the input history in reverse
3051 3051 for n in range(len(self.shell.input_hist)-2,0,-1):
3052 3052 input = self.shell.input_hist[n]
3053 3053 # skip plain 'r' lines so we don't recurse to infinity
3054 3054 if input != '_ip.magic("r")\n' and \
3055 3055 (input.startswith(start) or input.startswith(start_magic)):
3056 3056 #print 'match',`input` # dbg
3057 3057 print 'Executing:',input,
3058 3058 self.shell.runlines(input)
3059 3059 return
3060 3060 print 'No previous input matching `%s` found.' % start
3061 3061
3062 3062
3063 3063 def magic_bookmark(self, parameter_s=''):
3064 3064 """Manage IPython's bookmark system.
3065 3065
3066 3066 %bookmark <name> - set bookmark to current dir
3067 3067 %bookmark <name> <dir> - set bookmark to <dir>
3068 3068 %bookmark -l - list all bookmarks
3069 3069 %bookmark -d <name> - remove bookmark
3070 3070 %bookmark -r - remove all bookmarks
3071 3071
3072 3072 You can later on access a bookmarked folder with:
3073 3073 %cd -b <name>
3074 3074 or simply '%cd <name>' if there is no directory called <name> AND
3075 3075 there is such a bookmark defined.
3076 3076
3077 3077 Your bookmarks persist through IPython sessions, but they are
3078 3078 associated with each profile."""
3079 3079
3080 3080 opts,args = self.parse_options(parameter_s,'drl',mode='list')
3081 3081 if len(args) > 2:
3082 3082 raise UsageError("%bookmark: too many arguments")
3083 3083
3084 3084 bkms = self.db.get('bookmarks',{})
3085 3085
3086 3086 if opts.has_key('d'):
3087 3087 try:
3088 3088 todel = args[0]
3089 3089 except IndexError:
3090 3090 raise UsageError(
3091 3091 "%bookmark -d: must provide a bookmark to delete")
3092 3092 else:
3093 3093 try:
3094 3094 del bkms[todel]
3095 3095 except KeyError:
3096 3096 raise UsageError(
3097 3097 "%%bookmark -d: Can't delete bookmark '%s'" % todel)
3098 3098
3099 3099 elif opts.has_key('r'):
3100 3100 bkms = {}
3101 3101 elif opts.has_key('l'):
3102 3102 bks = bkms.keys()
3103 3103 bks.sort()
3104 3104 if bks:
3105 3105 size = max(map(len,bks))
3106 3106 else:
3107 3107 size = 0
3108 3108 fmt = '%-'+str(size)+'s -> %s'
3109 3109 print 'Current bookmarks:'
3110 3110 for bk in bks:
3111 3111 print fmt % (bk,bkms[bk])
3112 3112 else:
3113 3113 if not args:
3114 3114 raise UsageError("%bookmark: You must specify the bookmark name")
3115 3115 elif len(args)==1:
3116 3116 bkms[args[0]] = os.getcwd()
3117 3117 elif len(args)==2:
3118 3118 bkms[args[0]] = args[1]
3119 3119 self.db['bookmarks'] = bkms
3120 3120
3121 3121 def magic_pycat(self, parameter_s=''):
3122 3122 """Show a syntax-highlighted file through a pager.
3123 3123
3124 3124 This magic is similar to the cat utility, but it will assume the file
3125 3125 to be Python source and will show it with syntax highlighting. """
3126 3126
3127 3127 try:
3128 3128 filename = get_py_filename(parameter_s)
3129 3129 cont = file_read(filename)
3130 3130 except IOError:
3131 3131 try:
3132 3132 cont = eval(parameter_s,self.user_ns)
3133 3133 except NameError:
3134 3134 cont = None
3135 3135 if cont is None:
3136 3136 print "Error: no such file or variable"
3137 3137 return
3138 3138
3139 3139 page(self.shell.pycolorize(cont),
3140 3140 screen_lines=self.shell.rc.screen_length)
3141 3141
3142 3142 def magic_cpaste(self, parameter_s=''):
3143 3143 """Allows you to paste & execute a pre-formatted code block from clipboard
3144 3144
3145 3145 You must terminate the block with '--' (two minus-signs) alone on the
3146 3146 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3147 3147 is the new sentinel for this operation)
3148 3148
3149 3149 The block is dedented prior to execution to enable execution of method
3150 3150 definitions. '>' and '+' characters at the beginning of a line are
3151 3151 ignored, to allow pasting directly from e-mails or diff files. The
3152 3152 executed block is also assigned to variable named 'pasted_block' for
3153 3153 later editing with '%edit pasted_block'.
3154 3154
3155 3155 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3156 3156 This assigns the pasted block to variable 'foo' as string, without
3157 3157 dedenting or executing it.
3158 3158
3159 3159 Do not be alarmed by garbled output on Windows (it's a readline bug).
3160 3160 Just press enter and type -- (and press enter again) and the block
3161 3161 will be what was just pasted.
3162 3162
3163 3163 IPython statements (magics, shell escapes) are not supported (yet).
3164 3164 """
3165 3165 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3166 3166 par = args.strip()
3167 3167 sentinel = opts.get('s','--')
3168 3168
3169 3169 strip_from_start = [re.compile(e) for e in
3170 ['^(.?>)+','^In \[\d+\]:','^\++']]
3170 [r'^\s*(\s?>)+',r'^\s*In \[\d+\]:',r'^\++']]
3171 3171 from IPython import iplib
3172 3172 lines = []
3173 3173 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3174 3174 while 1:
3175 3175 l = iplib.raw_input_original(':')
3176 3176 if l ==sentinel:
3177 3177 break
3178 3178
3179 3179 for pat in strip_from_start:
3180 3180 l = pat.sub('',l)
3181 3181 lines.append(l)
3182 3182
3183 3183 block = "\n".join(lines) + '\n'
3184 3184 #print "block:\n",block
3185 3185 if not par:
3186 3186 b = textwrap.dedent(block)
3187 3187 exec b in self.user_ns
3188 3188 self.user_ns['pasted_block'] = b
3189 3189 else:
3190 3190 self.user_ns[par] = block
3191 3191 print "Block assigned to '%s'" % par
3192 3192
3193 3193 def magic_quickref(self,arg):
3194 3194 """ Show a quick reference sheet """
3195 3195 import IPython.usage
3196 3196 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3197 3197
3198 3198 page(qr)
3199 3199
3200 3200 def magic_upgrade(self,arg):
3201 3201 """ Upgrade your IPython installation
3202 3202
3203 3203 This will copy the config files that don't yet exist in your
3204 3204 ipython dir from the system config dir. Use this after upgrading
3205 3205 IPython if you don't wish to delete your .ipython dir.
3206 3206
3207 3207 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3208 3208 new users)
3209 3209
3210 3210 """
3211 3211 ip = self.getapi()
3212 3212 ipinstallation = path(IPython.__file__).dirname()
3213 3213 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3214 3214 src_config = ipinstallation / 'UserConfig'
3215 3215 userdir = path(ip.options.ipythondir)
3216 3216 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3217 3217 print ">",cmd
3218 3218 shell(cmd)
3219 3219 if arg == '-nolegacy':
3220 3220 legacy = userdir.files('ipythonrc*')
3221 3221 print "Nuking legacy files:",legacy
3222 3222
3223 3223 [p.remove() for p in legacy]
3224 3224 suffix = (sys.platform == 'win32' and '.ini' or '')
3225 3225 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3226 3226
3227 3227
3228 3228 def magic_doctest_mode(self,parameter_s=''):
3229 3229 """Toggle doctest mode on and off.
3230 3230
3231 3231 This mode allows you to toggle the prompt behavior between normal
3232 3232 IPython prompts and ones that are as similar to the default IPython
3233 3233 interpreter as possible.
3234 3234
3235 3235 It also supports the pasting of code snippets that have leading '>>>'
3236 3236 and '...' prompts in them. This means that you can paste doctests from
3237 3237 files or docstrings (even if they have leading whitespace), and the
3238 3238 code will execute correctly. You can then use '%history -tn' to see
3239 3239 the translated history without line numbers; this will give you the
3240 3240 input after removal of all the leading prompts and whitespace, which
3241 3241 can be pasted back into an editor.
3242 3242
3243 3243 With these features, you can switch into this mode easily whenever you
3244 3244 need to do testing and changes to doctests, without having to leave
3245 3245 your existing IPython session.
3246 3246 """
3247 3247
3248 3248 # XXX - Fix this to have cleaner activate/deactivate calls.
3249 3249 from IPython.Extensions import InterpreterPasteInput as ipaste
3250 3250 from IPython.ipstruct import Struct
3251 3251
3252 3252 # Shorthands
3253 3253 shell = self.shell
3254 3254 oc = shell.outputcache
3255 3255 rc = shell.rc
3256 3256 meta = shell.meta
3257 3257 # dstore is a data store kept in the instance metadata bag to track any
3258 3258 # changes we make, so we can undo them later.
3259 3259 dstore = meta.setdefault('doctest_mode',Struct())
3260 3260 save_dstore = dstore.setdefault
3261 3261
3262 3262 # save a few values we'll need to recover later
3263 3263 mode = save_dstore('mode',False)
3264 3264 save_dstore('rc_pprint',rc.pprint)
3265 3265 save_dstore('xmode',shell.InteractiveTB.mode)
3266 3266 save_dstore('rc_separate_out',rc.separate_out)
3267 3267 save_dstore('rc_separate_out2',rc.separate_out2)
3268 3268 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
3269 3269
3270 3270 if mode == False:
3271 3271 # turn on
3272 3272 ipaste.activate_prefilter()
3273 3273
3274 3274 oc.prompt1.p_template = '>>> '
3275 3275 oc.prompt2.p_template = '... '
3276 3276 oc.prompt_out.p_template = ''
3277 3277
3278 3278 oc.output_sep = ''
3279 3279 oc.output_sep2 = ''
3280 3280
3281 3281 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3282 3282 oc.prompt_out.pad_left = False
3283 3283
3284 3284 rc.pprint = False
3285 3285
3286 3286 shell.magic_xmode('Plain')
3287 3287
3288 3288 else:
3289 3289 # turn off
3290 3290 ipaste.deactivate_prefilter()
3291 3291
3292 3292 oc.prompt1.p_template = rc.prompt_in1
3293 3293 oc.prompt2.p_template = rc.prompt_in2
3294 3294 oc.prompt_out.p_template = rc.prompt_out
3295 3295
3296 3296 oc.output_sep = dstore.rc_separate_out
3297 3297 oc.output_sep2 = dstore.rc_separate_out2
3298 3298
3299 3299 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3300 3300 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
3301 3301
3302 3302 rc.pprint = dstore.rc_pprint
3303 3303
3304 3304 shell.magic_xmode(dstore.xmode)
3305 3305
3306 3306 # Store new mode and inform
3307 3307 dstore.mode = bool(1-int(mode))
3308 3308 print 'Doctest mode is:',
3309 3309 print ['OFF','ON'][dstore.mode]
3310 3310
3311 3311 # end Magic
@@ -1,7607 +1,7608 b''
1 1 2008-05-27 Ville Vainio <vivainio@gmail.com>
2 2
3 3 * iplib.py, ipmaker.py: survive lack of doctest and site._Helper
4 4 for minimal environments (e.g. Maemo sdk python)
5 5
6 * Branch for 0.8.3
6 * Magic.py: cpaste strips whitespace before >>> (allow pasting
7 doctests)
7 8
8 9 2008-05-14 Ville Vainio <vivainio@gmail.com>
9 10
10 11 * Extensions/ipy_greedycompleter.py:
11 12 New extension that enables a bit more "relaxed" tab
12 13 completer that evaluates code without safety checks
13 14 (i.e. there can be side effects like function calls)
14 15
15 16 2008-04-20 Ville Vainio <vivainio@gmail.com>
16 17
17 18 * Extensions/ipy_lookfor.py: add %lookfor magic command
18 19 (search docstrings for words) by Pauli Virtanen. Close #245.
19 20
20 21 * Extension/ipy_jot.py: %jot and %read magics, analogous
21 22 to %store but you can specify some notes. Not read
22 23 in automatically on startup, you need %read.
23 24 Contributed by Yichun Wei.
24 25
25 26 2008-04-18 Fernando Perez <Fernando.Perez@berkeley.edu>
26 27
27 28 * IPython/genutils.py (page): apply workaround to curses bug that
28 29 can leave terminal corrupted after a call to initscr().
29 30
30 31 2008-04-15 Ville Vainio <vivainio@gmail.com>
31 32
32 33 * genutils.py: SList.grep supports 'field' argument
33 34
34 35 * ipy_completers.py: module completer looks inside
35 36 .egg zip files (patch by mc). Close #196.
36 37
37 38 2008-04-09 Ville Vainio <vivainio@gmail.com>
38 39
39 40 * deep_reload.py: do not crash on from __future__ import
40 41 absolute_import. Close #244.
41 42
42 43 2008-04-02 Ville Vainio <vivainio@gmail.com>
43 44
44 45 * ipy_winpdb.py: New extension for winpdb integration. %wdb
45 46 test.py is winpdb equivalent of %run -d test.py. winpdb is a
46 47 crossplatform remote GUI debugger based on wxpython.
47 48
48 49 2008-03-29 Ville Vainio <vivainio@gmail.com>
49 50
50 51 * ipython.rst, do_sphinx.py: New documentation base, based on
51 52 reStucturedText and Sphinx (html/pdf generation). The old Lyx
52 53 based documentation will not be updated anymore.
53 54
54 55 * jobctrl.py: Use shell in Popen for 'start' command (in windows).
55 56
56 57 2008-03-24 Ville Vainio <vivainio@gmail.com>
57 58
58 59 * ipython.rst, do_sphinx.py: New documentation base, based on
59 60 reStucturedText and Sphinx (html/pdf generation). The old Lyx
60 61 based documentation will not be updated anymore.
61 62
62 63 ipython.rst has up to date documentation on matters that were not
63 64 documented at all, and it also removes various
64 65 misdocumented/deprecated features.
65 66
66 67 2008-03-22 Ville Vainio <vivainio@gmail.com>
67 68
68 69 * Shell.py: Merge mtexp branch:
69 70 https://code.launchpad.net/~ipython/ipython/mtexp
70 71
71 72 Privides simpler and more robust MTInteractiveShell that won't
72 73 deadlock, even when the worker thread (GUI) stops doing runcode()
73 74 regularly. r71.
74 75
75 76 2008-03-20 Ville Vainio <vivainio@gmail.com>
76 77
77 78 * twshell.py: New shell that runs IPython code in Twisted reactor.
78 79 Launch by doing ipython -twisted. r67.
79 80
80 81 2008-03-19 Ville Vainio <vivainio@gmail.com>
81 82
82 83 * Magic.py: %rehashx works correctly when shadowed system commands
83 84 have upper case characters (e.g. Print.exe). r64.
84 85
85 86 * ipy_bzr.py, ipy_app_completers.py: new bzr completer that also
86 87 knows options to commands, based on bzrtools. Uses bzrlib
87 88 directly. r66.
88 89
89 90 2008-03-16 Ville Vainio <vivainio@gmail.com>
90 91
91 92 * make_tarball.py: Fixed for bzr.
92 93
93 94 * ipapi.py: Better _ip.runlines() script cleanup. r56,r79.
94 95
95 96 * ipy_vimserver.py, ipy.vim: New extension for vim server mode,
96 97 by Erich Heine.
97 98
98 99 2008-03-12 Ville Vainio <vivainio@gmail.com>
99 100
100 101 * ipmaker.py: Force (reload?) import of ipy_user_conf and
101 102 ipy_profile_foo, so that embedded instances can be relaunched and
102 103 configuration is still done. r50
103 104
104 105 * ipapi.py, test_embed.py: Allow specifying shell class in
105 106 launch_new_instance & make_new instance. Use this in
106 107 test_embed.py. r51.
107 108
108 109 test_embed.py is also a good and simple demo of embedding IPython.
109 110
110 111
111 112 2008-03-10 Ville Vainio <vivainio@gmail.com>
112 113
113 114 * tool/update_revnum.py: Change to bzr revisioning scheme in
114 115 revision numbers.
115 116
116 117 * Shell.py: Threading improvements:
117 118
118 119 In multithreaded shells, do not hang on macros and o.autoexec
119 120 commands (or anything executed with _ip.runlines()) anymore. Allow
120 121 recursive execution of IPython code in
121 122 MTInteractiveShell.runsource by checking if we are already in
122 123 worker thread, and execute code directly if we are. r48.
123 124
124 125 MTInteractiveShell.runsource: execute code directly if worker
125 126 thread is not running yet (this is the case in config files). r49.
126 127
127 128 2008-03-09 Ville Vainio <vivainio@gmail.com>
128 129
129 130 * ipy_profile_sh.py: You can now use $LA or LA() to refer to last
130 131 argument of previous command in sh profile. Similar to bash '!$'.
131 132 LA(3) or $LA(3) stands for last argument of input history command
132 133 3.
133 134
134 135 * Shell.py: -pylab names don't clutter %whos listing.
135 136
136 137 2008-03-07 Ville Vainio <vivainio@gmail.com>
137 138
138 139 * ipy_autoreload.py: new extension (by Pauli Virtanen) for
139 140 autoreloading modules; try %autoreload and %aimport. Close #154.
140 141 Uses the new pre_runcode_hook.
141 142
142 143 2008-02-24 Ville Vainio <vivainio@gmail.com>
143 144
144 145 * platutils_posix.py: freeze_term_title works
145 146
146 147 2008-02-21 Ville Vainio <vivainio@gmail.com>
147 148
148 149 * Magic.py: %quickref does not crash with empty docstring
149 150
150 151 2008-02-20 Ville Vainio <vivainio@gmail.com>
151 152
152 153 * completer.py: do not treat [](){} as protectable chars anymore,
153 154 close #233.
154 155
155 156 * completer.py: do not treat [](){} as protectable chars anymore
156 157
157 158 * magic.py, test_cpaste.py: Allow different prefix for pasting
158 159 from email
159 160
160 161 2008-02-17 Ville Vainio <vivainio@gmail.com>
161 162
162 163 * Switched over to Launchpad/bzr as primary VCS.
163 164
164 165 2008-02-14 Ville Vainio <vivainio@gmail.com>
165 166
166 167 * ipapi.py: _ip.runlines() is now much more liberal about
167 168 indentation - it cleans up the scripts it gets
168 169
169 170 2008-02-14 Ville Vainio <vivainio@gmail.com>
170 171
171 172 * Extensions/ipy_leo.py: created 'ILeo' IPython-Leo bridge.
172 173 Changes to it (later on) are too numerous to list in ChangeLog
173 174 until it stabilizes
174 175
175 176 2008-02-07 Darren Dale <darren.dale@cornell.edu>
176 177
177 178 * IPython/Shell.py: Call QtCore.pyqtRemoveInputHook() when creating
178 179 an IPShellQt4. PyQt4-4.2.1 and later uses PyOS_InputHook to improve
179 180 interaction in the interpreter (like Tkinter does), but it seems to
180 181 partially interfere with the IPython implementation and exec_()
181 182 still seems to block. So we disable the PyQt implementation and
182 183 stick with the IPython one for now.
183 184
184 185 2008-02-02 Walter Doerwald <walter@livinglogic.de>
185 186
186 187 * ipipe.py: A new ipipe table has been added: ialias produces all
187 188 entries from IPython's alias table.
188 189
189 190 2008-02-01 Fernando Perez <Fernando.Perez@colorado.edu>
190 191
191 192 * IPython/Shell.py (MTInteractiveShell.runcode): Improve handling
192 193 of KBINT in threaded shells. After code provided by Marc in #212.
193 194
194 195 2008-01-30 Fernando Perez <Fernando.Perez@colorado.edu>
195 196
196 197 * IPython/Shell.py (MTInteractiveShell.__init__): Fixed deadlock
197 198 that could occur due to a race condition in threaded shells.
198 199 Thanks to code provided by Marc, as #210.
199 200
200 201 2008-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
201 202
202 203 * IPython/Magic.py (magic_doctest_mode): respect the user's
203 204 settings for input separators rather than overriding them. After
204 205 a report by Jeff Kowalczyk <jtk-AT-yahoo.com>
205 206
206 207 * IPython/history.py (magic_history): Add support for declaring an
207 208 output file directly from the history command.
208 209
209 210 2008-01-21 Walter Doerwald <walter@livinglogic.de>
210 211
211 212 * ipipe.py: Register ipipe's displayhooks via the generic function
212 213 generics.result_display() instead of using ipapi.set_hook().
213 214
214 215 2008-01-19 Walter Doerwald <walter@livinglogic.de>
215 216
216 217 * ibrowse.py, igrid.py, ipipe.py:
217 218 The input object can now be passed to the constructor of the display classes.
218 219 This makes it possible to use them with objects that implement __or__.
219 220 Use this constructor in the displayhook instead of piping.
220 221
221 222 * ipipe.py: Importing astyle.py is done as late as possible to
222 223 avoid problems with circular imports.
223 224
224 225 2008-01-19 Ville Vainio <vivainio@gmail.com>
225 226
226 227 * hooks.py, iplib.py: Added 'shell_hook' to customize how
227 228 IPython calls shell.
228 229
229 230 * hooks.py, iplib.py: Added 'show_in_pager' hook to specify
230 231 how IPython pages text (%page, %pycat, %pdoc etc.)
231 232
232 233 * Extensions/jobctrl.py: Use shell_hook. New magics: '%tasks'
233 234 and '%kill' to kill hanging processes that won't obey ctrl+C.
234 235
235 236 2008-01-16 Ville Vainio <vivainio@gmail.com>
236 237
237 238 * ipy_completers.py: pyw extension support for %run completer.
238 239
239 240 2008-01-11 Ville Vainio <vivainio@gmail.com>
240 241
241 242 * iplib.py, ipmaker.py: new rc option - autoexec. It's a list
242 243 of ipython commands to be run when IPython has started up
243 244 (just before running the scripts and -c arg on command line).
244 245
245 246 * ipy_user_conf.py: Added an example on how to change term
246 247 colors in config file (through using autoexec).
247 248
248 249 * completer.py, test_completer.py: Ability to specify custom
249 250 get_endidx to replace readline.get_endidx. For emacs users.
250 251
251 252 2008-01-10 Ville Vainio <vivainio@gmail.com>
252 253
253 254 * Prompts.py (set_p_str): do not crash on illegal prompt strings
254 255
255 256 2008-01-08 Ville Vainio <vivainio@gmail.com>
256 257
257 258 * '%macro -r' (raw mode) is now default in sh profile.
258 259
259 260 2007-12-31 Ville Vainio <vivainio@gmail.com>
260 261
261 262 * completer.py: custom completer matching is now case sensitive
262 263 (#207).
263 264
264 265 * ultraTB.py, iplib.py: Add some KeyboardInterrupt catching in
265 266 an attempt to prevent occasional crashes.
266 267
267 268 * CrashHandler.py: Crash log dump now asks user to press enter
268 269 before exiting.
269 270
270 271 * Store _ip in user_ns instead of __builtin__, enabling safer
271 272 coexistence of multiple IPython instances in the same python
272 273 interpreter (#197).
273 274
274 275 * Debugger.py, ipmaker.py: Need to add '-pydb' command line
275 276 switch to enable pydb in post-mortem debugging and %run -d.
276 277
277 278 2007-12-28 Ville Vainio <vivainio@gmail.com>
278 279
279 280 * ipy_server.py: TCP socket server for "remote control" of an IPython
280 281 instance.
281 282
282 283 * Debugger.py: Change to PSF license
283 284
284 285 * simplegeneric.py: Add license & author notes.
285 286
286 287 * ipy_fsops.py: Added PathObj and FileObj, an object-oriented way
287 288 to navigate file system with a custom completer. Run
288 289 ipy_fsops.test_pathobj() to play with it.
289 290
290 291 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
291 292
292 293 * IPython/dtutils.py: Add utilities for interactively running
293 294 doctests. Still needs work to more easily handle the namespace of
294 295 the package one may be working on, but the basics are in place.
295 296
296 297 2007-12-27 Ville Vainio <vivainio@gmail.com>
297 298
298 299 * ipy_completers.py: Applied arno's patch to get proper list of
299 300 packages in import completer. Closes #196.
300 301
301 302 2007-12-20 Ville Vainio <vivainio@gmail.com>
302 303
303 304 * completer.py, generics.py(complete_object): Allow
304 305 custom complers based on python objects via simplegeneric.
305 306 See generics.py / my_demo_complete_object
306 307
307 308 2007-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
308 309
309 310 * IPython/Prompts.py (BasePrompt.__nonzero__): add proper boolean
310 311 behavior to prompt objects, useful for display hooks to adjust
311 312 themselves depending on whether prompts will be there or not.
312 313
313 314 2007-12-13 Ville Vainio <vivainio@gmail.com>
314 315
315 316 * iplib.py(raw_input): unix readline does not allow unicode in
316 317 history, encode to normal string. After patch by Tiago.
317 318 Close #201
318 319
319 320 2007-12-12 Ville Vainio <vivainio@gmail.com>
320 321
321 322 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of
322 323 current directory.
323 324
324 325 2007-12-12 Fernando Perez <Fernando.Perez@colorado.edu>
325 326
326 327 * IPython/Shell.py (_select_shell): add support for controlling
327 328 the pylab threading mode directly at the command line, without
328 329 having to modify MPL config files. Added unit tests for this
329 330 feature, though manual/docs update is still pending, will do later.
330 331
331 332 2007-12-11 Ville Vainio <vivainio@gmail.com>
332 333
333 334 * ext_rescapture.py: var = !cmd is no longer verbose (to facilitate
334 335 use in scripts)
335 336
336 337 2007-12-07 Ville Vainio <vivainio@gmail.com>
337 338
338 339 * iplib.py, ipy_profile_sh.py: Do not escape # on command lines
339 340 anymore (to \#) - even if it is a comment char that is implicitly
340 341 escaped in some unix shells in interactive mode, it is ok to leave
341 342 it in IPython as such.
342 343
343 344
344 345 2007-12-01 Robert Kern <robert.kern@gmail.com>
345 346
346 347 * IPython/ultraTB.py (findsource): Improve the monkeypatch to
347 348 inspect.findsource(). It can now find source lines inside zipped
348 349 packages.
349 350
350 351 * IPython/ultraTB.py: When constructing tracebacks, try to use __file__
351 352 in the frame's namespace before trusting the filename in the code object
352 353 which created the frame.
353 354
354 355 2007-11-29 *** Released version 0.8.2
355 356
356 357 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
357 358
358 359 * IPython/Logger.py (Logger.logstop): add a proper logstop()
359 360 method to fully stop the logger, along with a corresponding
360 361 %logstop magic for interactive use.
361 362
362 363 * IPython/Extensions/ipy_host_completers.py: added new host
363 364 completers functionality, contributed by Gael Pasgrimaud
364 365 <gawel-AT-afpy.org>.
365 366
366 367 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
367 368
368 369 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
369 370 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
370 371 options handling. Unicode fix in %whos (committed a while ago)
371 372 was also contributed by Paul.
372 373
373 374 2007-11-23 Darren Dale <darren.dale@cornell.edu>
374 375 * ipy_traits_completer.py: let traits_completer respect the user's
375 376 readline_omit__names setting.
376 377
377 378 2007-11-08 Ville Vainio <vivainio@gmail.com>
378 379
379 380 * ipy_completers.py (import completer): assume 'xml' module exists.
380 381 Do not add every module twice anymore. Closes #196.
381 382
382 383 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
383 384 completer that uses apt-cache to search for existing packages.
384 385
385 386 2007-11-06 Ville Vainio <vivainio@gmail.com>
386 387
387 388 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
388 389 true. Closes #194.
389 390
390 391 2007-11-01 Brian Granger <ellisonbg@gmail.com>
391 392
392 393 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
393 394 working with OS X 10.5 libedit implementation of readline.
394 395
395 396 2007-10-24 Ville Vainio <vivainio@gmail.com>
396 397
397 398 * iplib.py(user_setup): To route around buggy installations where
398 399 UserConfig is not available, create a minimal _ipython.
399 400
400 401 * iplib.py: Unicode fixes from Jorgen.
401 402
402 403 * genutils.py: Slist now has new method 'fields()' for extraction of
403 404 whitespace-separated fields from line-oriented data.
404 405
405 406 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
406 407
407 408 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
408 409 when querying objects with no __class__ attribute (such as
409 410 f2py-generated modules).
410 411
411 412 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
412 413
413 414 * IPython/Magic.py (magic_time): track compilation time and report
414 415 it if longer than 0.1s (fix done to %time and %timeit). After a
415 416 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
416 417
417 418 2007-09-18 Ville Vainio <vivainio@gmail.com>
418 419
419 420 * genutils.py(make_quoted_expr): Do not use Itpl, it does
420 421 not support unicode at the moment. Fixes (many) magic calls with
421 422 special characters.
422 423
423 424 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
424 425
425 426 * IPython/genutils.py (doctest_reload): expose the doctest
426 427 reloader to the user so that people can easily reset doctest while
427 428 using it interactively. Fixes a problem reported by Jorgen.
428 429
429 430 * IPython/iplib.py (InteractiveShell.__init__): protect the
430 431 FakeModule instances used for __main__ in %run calls from
431 432 deletion, so that user code defined in them isn't left with
432 433 dangling references due to the Python module deletion machinery.
433 434 This should fix the problems reported by Darren.
434 435
435 436 2007-09-10 Darren Dale <dd55@cornell.edu>
436 437
437 438 * Cleanup of IPShellQt and IPShellQt4
438 439
439 440 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
440 441
441 442 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
442 443 doctest support.
443 444
444 445 * IPython/iplib.py (safe_execfile): minor docstring improvements.
445 446
446 447 2007-09-08 Ville Vainio <vivainio@gmail.com>
447 448
448 449 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
449 450 directory, not the target directory.
450 451
451 452 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
452 453 exception that won't print the tracebacks. Switched many magics to
453 454 raise them on error situations, also GetoptError is not printed
454 455 anymore.
455 456
456 457 2007-09-07 Ville Vainio <vivainio@gmail.com>
457 458
458 459 * iplib.py: do not auto-alias "dir", it screws up other dir auto
459 460 aliases.
460 461
461 462 * genutils.py: SList.grep() implemented.
462 463
463 464 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
464 465 for easy "out of the box" setup of several common editors, so that
465 466 e.g. '%edit os.path.isfile' will jump to the correct line
466 467 automatically. Contributions for command lines of your favourite
467 468 editors welcome.
468 469
469 470 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
470 471
471 472 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
472 473 preventing source display in certain cases. In reality I think
473 474 the problem is with Ubuntu's Python build, but this change works
474 475 around the issue in some cases (not in all, unfortunately). I'd
475 476 filed a Python bug on this with more details, but in the change of
476 477 bug trackers it seems to have been lost.
477 478
478 479 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
479 480 not the same, it's not self-documenting, doesn't allow range
480 481 selection, and sorts alphabetically instead of numerically.
481 482 (magic_r): restore %r. No, "up + enter. One char magic" is not
482 483 the same thing, since %r takes parameters to allow fast retrieval
483 484 of old commands. I've received emails from users who use this a
484 485 LOT, so it stays.
485 486 (magic_automagic): restore %automagic. "use _ip.option.automagic"
486 487 is not a valid replacement b/c it doesn't provide an complete
487 488 explanation (which the automagic docstring does).
488 489 (magic_autocall): restore %autocall, with improved docstring.
489 490 Same argument as for others, "use _ip.options.autocall" is not a
490 491 valid replacement.
491 492 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
492 493 tutorials and online docs.
493 494
494 495 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
495 496
496 497 * IPython/usage.py (quick_reference): mention magics in quickref,
497 498 modified main banner to mention %quickref.
498 499
499 500 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
500 501
501 502 2007-09-06 Ville Vainio <vivainio@gmail.com>
502 503
503 504 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
504 505 Callable aliases now pass the _ip as first arg. This breaks
505 506 compatibility with earlier 0.8.2.svn series! (though they should
506 507 not have been in use yet outside these few extensions)
507 508
508 509 2007-09-05 Ville Vainio <vivainio@gmail.com>
509 510
510 511 * external/mglob.py: expand('dirname') => ['dirname'], instead
511 512 of ['dirname/foo','dirname/bar', ...].
512 513
513 514 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
514 515 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
515 516 is useful for others as well).
516 517
517 518 * iplib.py: on callable aliases (as opposed to old style aliases),
518 519 do var_expand() immediately, and use make_quoted_expr instead
519 520 of hardcoded r"""
520 521
521 522 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
522 523 if not available load ipy_fsops.py for cp, mv, etc. replacements
523 524
524 525 * OInspect.py, ipy_which.py: improve %which and obj? for callable
525 526 aliases
526 527
527 528 2007-09-04 Ville Vainio <vivainio@gmail.com>
528 529
529 530 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
530 531 Relicensed under BSD with the authors approval.
531 532
532 533 * ipmaker.py, usage.py: Remove %magic from default banner, improve
533 534 %quickref
534 535
535 536 2007-09-03 Ville Vainio <vivainio@gmail.com>
536 537
537 538 * Magic.py: %time now passes expression through prefilter,
538 539 allowing IPython syntax.
539 540
540 541 2007-09-01 Ville Vainio <vivainio@gmail.com>
541 542
542 543 * ipmaker.py: Always show full traceback when newstyle config fails
543 544
544 545 2007-08-27 Ville Vainio <vivainio@gmail.com>
545 546
546 547 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
547 548
548 549 2007-08-26 Ville Vainio <vivainio@gmail.com>
549 550
550 551 * ipmaker.py: Command line args have the highest priority again
551 552
552 553 * iplib.py, ipmaker.py: -i command line argument now behaves as in
553 554 normal python, i.e. leaves the IPython session running after -c
554 555 command or running a batch file from command line.
555 556
556 557 2007-08-22 Ville Vainio <vivainio@gmail.com>
557 558
558 559 * iplib.py: no extra empty (last) line in raw hist w/ multiline
559 560 statements
560 561
561 562 * logger.py: Fix bug where blank lines in history were not
562 563 added until AFTER adding the current line; translated and raw
563 564 history should finally be in sync with prompt now.
564 565
565 566 * ipy_completers.py: quick_completer now makes it easy to create
566 567 trivial custom completers
567 568
568 569 * clearcmd.py: shadow history compression & erasing, fixed input hist
569 570 clearing.
570 571
571 572 * envpersist.py, history.py: %env (sh profile only), %hist completers
572 573
573 574 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
574 575 term title now include the drive letter, and always use / instead of
575 576 os.sep (as per recommended approach for win32 ipython in general).
576 577
577 578 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
578 579 plain python scripts from ipykit command line by running
579 580 "py myscript.py", even w/o installed python.
580 581
581 582 2007-08-21 Ville Vainio <vivainio@gmail.com>
582 583
583 584 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
584 585 (for backwards compatibility)
585 586
586 587 * history.py: switch back to %hist -t from %hist -r as default.
587 588 At least until raw history is fixed for good.
588 589
589 590 2007-08-20 Ville Vainio <vivainio@gmail.com>
590 591
591 592 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
592 593 locate alias redeclarations etc. Also, avoid handling
593 594 _ip.IP.alias_table directly, prefer using _ip.defalias.
594 595
595 596
596 597 2007-08-15 Ville Vainio <vivainio@gmail.com>
597 598
598 599 * prefilter.py: ! is now always served first
599 600
600 601 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
601 602
602 603 * IPython/iplib.py (safe_execfile): fix the SystemExit
603 604 auto-suppression code to work in Python2.4 (the internal structure
604 605 of that exception changed and I'd only tested the code with 2.5).
605 606 Bug reported by a SciPy attendee.
606 607
607 608 2007-08-13 Ville Vainio <vivainio@gmail.com>
608 609
609 610 * prefilter.py: reverted !c:/bin/foo fix, made % in
610 611 multiline specials work again
611 612
612 613 2007-08-13 Ville Vainio <vivainio@gmail.com>
613 614
614 615 * prefilter.py: Take more care to special-case !, so that
615 616 !c:/bin/foo.exe works.
616 617
617 618 * setup.py: if we are building eggs, strip all docs and
618 619 examples (it doesn't make sense to bytecompile examples,
619 620 and docs would be in an awkward place anyway).
620 621
621 622 * Ryan Krauss' patch fixes start menu shortcuts when IPython
622 623 is installed into a directory that has spaces in the name.
623 624
624 625 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
625 626
626 627 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
627 628 doctest profile and %doctest_mode, so they actually generate the
628 629 blank lines needed by doctest to separate individual tests.
629 630
630 631 * IPython/iplib.py (safe_execfile): modify so that running code
631 632 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
632 633 doesn't get a printed traceback. Any other value in sys.exit(),
633 634 including the empty call, still generates a traceback. This
634 635 enables use of %run without having to pass '-e' for codes that
635 636 correctly set the exit status flag.
636 637
637 638 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
638 639
639 640 * IPython/iplib.py (InteractiveShell.post_config_initialization):
640 641 fix problems with doctests failing when run inside IPython due to
641 642 IPython's modifications of sys.displayhook.
642 643
643 644 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
644 645
645 646 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
646 647 a string with names.
647 648
648 649 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
649 650
650 651 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
651 652 magic to toggle on/off the doctest pasting support without having
652 653 to leave a session to switch to a separate profile.
653 654
654 655 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
655 656
656 657 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
657 658 introduce a blank line between inputs, to conform to doctest
658 659 requirements.
659 660
660 661 * IPython/OInspect.py (Inspector.pinfo): fix another part where
661 662 auto-generated docstrings for new-style classes were showing up.
662 663
663 664 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
664 665
665 666 * api_changes: Add new file to track backward-incompatible
666 667 user-visible changes.
667 668
668 669 2007-08-06 Ville Vainio <vivainio@gmail.com>
669 670
670 671 * ipmaker.py: fix bug where user_config_ns didn't exist at all
671 672 before all the config files were handled.
672 673
673 674 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
674 675
675 676 * IPython/irunner.py (RunnerFactory): Add new factory class for
676 677 creating reusable runners based on filenames.
677 678
678 679 * IPython/Extensions/ipy_profile_doctest.py: New profile for
679 680 doctest support. It sets prompts/exceptions as similar to
680 681 standard Python as possible, so that ipython sessions in this
681 682 profile can be easily pasted as doctests with minimal
682 683 modifications. It also enables pasting of doctests from external
683 684 sources (even if they have leading whitespace), so that you can
684 685 rerun doctests from existing sources.
685 686
686 687 * IPython/iplib.py (_prefilter): fix a buglet where after entering
687 688 some whitespace, the prompt would become a continuation prompt
688 689 with no way of exiting it other than Ctrl-C. This fix brings us
689 690 into conformity with how the default python prompt works.
690 691
691 692 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
692 693 Add support for pasting not only lines that start with '>>>', but
693 694 also with ' >>>'. That is, arbitrary whitespace can now precede
694 695 the prompts. This makes the system useful for pasting doctests
695 696 from docstrings back into a normal session.
696 697
697 698 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
698 699
699 700 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
700 701 r1357, which had killed multiple invocations of an embedded
701 702 ipython (this means that example-embed has been broken for over 1
702 703 year!!!). Rather than possibly breaking the batch stuff for which
703 704 the code in iplib.py/interact was introduced, I worked around the
704 705 problem in the embedding class in Shell.py. We really need a
705 706 bloody test suite for this code, I'm sick of finding stuff that
706 707 used to work breaking left and right every time I use an old
707 708 feature I hadn't touched in a few months.
708 709 (kill_embedded): Add a new magic that only shows up in embedded
709 710 mode, to allow users to permanently deactivate an embedded instance.
710 711
711 712 2007-08-01 Ville Vainio <vivainio@gmail.com>
712 713
713 714 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
714 715 history gets out of sync on runlines (e.g. when running macros).
715 716
716 717 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
717 718
718 719 * IPython/Magic.py (magic_colors): fix win32-related error message
719 720 that could appear under *nix when readline was missing. Patch by
720 721 Scott Jackson, closes #175.
721 722
722 723 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
723 724
724 725 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
725 726 completer that it traits-aware, so that traits objects don't show
726 727 all of their internal attributes all the time.
727 728
728 729 * IPython/genutils.py (dir2): moved this code from inside
729 730 completer.py to expose it publicly, so I could use it in the
730 731 wildcards bugfix.
731 732
732 733 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
733 734 Stefan with Traits.
734 735
735 736 * IPython/completer.py (Completer.attr_matches): change internal
736 737 var name from 'object' to 'obj', since 'object' is now a builtin
737 738 and this can lead to weird bugs if reusing this code elsewhere.
738 739
739 740 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
740 741
741 742 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
742 743 'foo?' and update the code to prevent printing of default
743 744 docstrings that started appearing after I added support for
744 745 new-style classes. The approach I'm using isn't ideal (I just
745 746 special-case those strings) but I'm not sure how to more robustly
746 747 differentiate between truly user-written strings and Python's
747 748 automatic ones.
748 749
749 750 2007-07-09 Ville Vainio <vivainio@gmail.com>
750 751
751 752 * completer.py: Applied Matthew Neeley's patch:
752 753 Dynamic attributes from trait_names and _getAttributeNames are added
753 754 to the list of tab completions, but when this happens, the attribute
754 755 list is turned into a set, so the attributes are unordered when
755 756 printed, which makes it hard to find the right completion. This patch
756 757 turns this set back into a list and sort it.
757 758
758 759 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
759 760
760 761 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
761 762 classes in various inspector functions.
762 763
763 764 2007-06-28 Ville Vainio <vivainio@gmail.com>
764 765
765 766 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
766 767 Implement "shadow" namespace, and callable aliases that reside there.
767 768 Use them by:
768 769
769 770 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
770 771
771 772 foo hello world
772 773 (gets translated to:)
773 774 _sh.foo(r"""hello world""")
774 775
775 776 In practice, this kind of alias can take the role of a magic function
776 777
777 778 * New generic inspect_object, called on obj? and obj??
778 779
779 780 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
780 781
781 782 * IPython/ultraTB.py (findsource): fix a problem with
782 783 inspect.getfile that can cause crashes during traceback construction.
783 784
784 785 2007-06-14 Ville Vainio <vivainio@gmail.com>
785 786
786 787 * iplib.py (handle_auto): Try to use ascii for printing "--->"
787 788 autocall rewrite indication, becausesometimes unicode fails to print
788 789 properly (and you get ' - - - '). Use plain uncoloured ---> for
789 790 unicode.
790 791
791 792 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
792 793
793 794 . pickleshare 'hash' commands (hget, hset, hcompress,
794 795 hdict) for efficient shadow history storage.
795 796
796 797 2007-06-13 Ville Vainio <vivainio@gmail.com>
797 798
798 799 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
799 800 Added kw arg 'interactive', tell whether vars should be visible
800 801 with %whos.
801 802
802 803 2007-06-11 Ville Vainio <vivainio@gmail.com>
803 804
804 805 * pspersistence.py, Magic.py, iplib.py: directory history now saved
805 806 to db
806 807
807 808 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
808 809 Also, it exits IPython immediately after evaluating the command (just like
809 810 std python)
810 811
811 812 2007-06-05 Walter Doerwald <walter@livinglogic.de>
812 813
813 814 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
814 815 Python string and captures the output. (Idea and original patch by
815 816 Stefan van der Walt)
816 817
817 818 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
818 819
819 820 * IPython/ultraTB.py (VerboseTB.text): update printing of
820 821 exception types for Python 2.5 (now all exceptions in the stdlib
821 822 are new-style classes).
822 823
823 824 2007-05-31 Walter Doerwald <walter@livinglogic.de>
824 825
825 826 * IPython/Extensions/igrid.py: Add new commands refresh and
826 827 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
827 828 the iterator once (refresh) or after every x seconds (refresh_timer).
828 829 Add a working implementation of "searchexpression", where the text
829 830 entered is not the text to search for, but an expression that must
830 831 be true. Added display of shortcuts to the menu. Added commands "pickinput"
831 832 and "pickinputattr" that put the object or attribute under the cursor
832 833 in the input line. Split the statusbar to be able to display the currently
833 834 active refresh interval. (Patch by Nik Tautenhahn)
834 835
835 836 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
836 837
837 838 * fixing set_term_title to use ctypes as default
838 839
839 840 * fixing set_term_title fallback to work when curent dir
840 841 is on a windows network share
841 842
842 843 2007-05-28 Ville Vainio <vivainio@gmail.com>
843 844
844 845 * %cpaste: strip + with > from left (diffs).
845 846
846 847 * iplib.py: Fix crash when readline not installed
847 848
848 849 2007-05-26 Ville Vainio <vivainio@gmail.com>
849 850
850 851 * generics.py: introduce easy to extend result_display generic
851 852 function (using simplegeneric.py).
852 853
853 854 * Fixed the append functionality of %set.
854 855
855 856 2007-05-25 Ville Vainio <vivainio@gmail.com>
856 857
857 858 * New magic: %rep (fetch / run old commands from history)
858 859
859 860 * New extension: mglob (%mglob magic), for powerful glob / find /filter
860 861 like functionality
861 862
862 863 % maghistory.py: %hist -g PATTERM greps the history for pattern
863 864
864 865 2007-05-24 Walter Doerwald <walter@livinglogic.de>
865 866
866 867 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
867 868 browse the IPython input history
868 869
869 870 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
870 871 (mapped to "i") can be used to put the object under the curser in the input
871 872 line. pickinputattr (mapped to "I") does the same for the attribute under
872 873 the cursor.
873 874
874 875 2007-05-24 Ville Vainio <vivainio@gmail.com>
875 876
876 877 * Grand magic cleansing (changeset [2380]):
877 878
878 879 * Introduce ipy_legacy.py where the following magics were
879 880 moved:
880 881
881 882 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
882 883
883 884 If you need them, either use default profile or "import ipy_legacy"
884 885 in your ipy_user_conf.py
885 886
886 887 * Move sh and scipy profile to Extensions from UserConfig. this implies
887 888 you should not edit them, but you don't need to run %upgrade when
888 889 upgrading IPython anymore.
889 890
890 891 * %hist/%history now operates in "raw" mode by default. To get the old
891 892 behaviour, run '%hist -n' (native mode).
892 893
893 894 * split ipy_stock_completers.py to ipy_stock_completers.py and
894 895 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
895 896 installed as default.
896 897
897 898 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
898 899 handling.
899 900
900 901 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
901 902 input if readline is available.
902 903
903 904 2007-05-23 Ville Vainio <vivainio@gmail.com>
904 905
905 906 * macro.py: %store uses __getstate__ properly
906 907
907 908 * exesetup.py: added new setup script for creating
908 909 standalone IPython executables with py2exe (i.e.
909 910 no python installation required).
910 911
911 912 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
912 913 its place.
913 914
914 915 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
915 916
916 917 2007-05-21 Ville Vainio <vivainio@gmail.com>
917 918
918 919 * platutil_win32.py (set_term_title): handle
919 920 failure of 'title' system call properly.
920 921
921 922 2007-05-17 Walter Doerwald <walter@livinglogic.de>
922 923
923 924 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
924 925 (Bug detected by Paul Mueller).
925 926
926 927 2007-05-16 Ville Vainio <vivainio@gmail.com>
927 928
928 929 * ipy_profile_sci.py, ipython_win_post_install.py: Create
929 930 new "sci" profile, effectively a modern version of the old
930 931 "scipy" profile (which is now slated for deprecation).
931 932
932 933 2007-05-15 Ville Vainio <vivainio@gmail.com>
933 934
934 935 * pycolorize.py, pycolor.1: Paul Mueller's patches that
935 936 make pycolorize read input from stdin when run without arguments.
936 937
937 938 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
938 939
939 940 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
940 941 it in sh profile (instead of ipy_system_conf.py).
941 942
942 943 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
943 944 aliases are now lower case on windows (MyCommand.exe => mycommand).
944 945
945 946 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
946 947 Macros are now callable objects that inherit from ipapi.IPyAutocall,
947 948 i.e. get autocalled regardless of system autocall setting.
948 949
949 950 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
950 951
951 952 * IPython/rlineimpl.py: check for clear_history in readline and
952 953 make it a dummy no-op if not available. This function isn't
953 954 guaranteed to be in the API and appeared in Python 2.4, so we need
954 955 to check it ourselves. Also, clean up this file quite a bit.
955 956
956 957 * ipython.1: update man page and full manual with information
957 958 about threads (remove outdated warning). Closes #151.
958 959
959 960 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
960 961
961 962 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
962 963 in trunk (note that this made it into the 0.8.1 release already,
963 964 but the changelogs didn't get coordinated). Many thanks to Gael
964 965 Varoquaux <gael.varoquaux-AT-normalesup.org>
965 966
966 967 2007-05-09 *** Released version 0.8.1
967 968
968 969 2007-05-10 Walter Doerwald <walter@livinglogic.de>
969 970
970 971 * IPython/Extensions/igrid.py: Incorporate html help into
971 972 the module, so we don't have to search for the file.
972 973
973 974 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
974 975
975 976 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
976 977
977 978 2007-04-30 Ville Vainio <vivainio@gmail.com>
978 979
979 980 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
980 981 user has illegal (non-ascii) home directory name
981 982
982 983 2007-04-27 Ville Vainio <vivainio@gmail.com>
983 984
984 985 * platutils_win32.py: implement set_term_title for windows
985 986
986 987 * Update version number
987 988
988 989 * ipy_profile_sh.py: more informative prompt (2 dir levels)
989 990
990 991 2007-04-26 Walter Doerwald <walter@livinglogic.de>
991 992
992 993 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
993 994 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
994 995 bug discovered by Ville).
995 996
996 997 2007-04-26 Ville Vainio <vivainio@gmail.com>
997 998
998 999 * Extensions/ipy_completers.py: Olivier's module completer now
999 1000 saves the list of root modules if it takes > 4 secs on the first run.
1000 1001
1001 1002 * Magic.py (%rehashx): %rehashx now clears the completer cache
1002 1003
1003 1004
1004 1005 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
1005 1006
1006 1007 * ipython.el: fix incorrect color scheme, reported by Stefan.
1007 1008 Closes #149.
1008 1009
1009 1010 * IPython/PyColorize.py (Parser.format2): fix state-handling
1010 1011 logic. I still don't like how that code handles state, but at
1011 1012 least now it should be correct, if inelegant. Closes #146.
1012 1013
1013 1014 2007-04-25 Ville Vainio <vivainio@gmail.com>
1014 1015
1015 1016 * Extensions/ipy_which.py: added extension for %which magic, works
1016 1017 a lot like unix 'which' but also finds and expands aliases, and
1017 1018 allows wildcards.
1018 1019
1019 1020 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
1020 1021 as opposed to returning nothing.
1021 1022
1022 1023 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
1023 1024 ipy_stock_completers on default profile, do import on sh profile.
1024 1025
1025 1026 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1026 1027
1027 1028 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
1028 1029 like ipython.py foo.py which raised a IndexError.
1029 1030
1030 1031 2007-04-21 Ville Vainio <vivainio@gmail.com>
1031 1032
1032 1033 * Extensions/ipy_extutil.py: added extension to manage other ipython
1033 1034 extensions. Now only supports 'ls' == list extensions.
1034 1035
1035 1036 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
1036 1037
1037 1038 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
1038 1039 would prevent use of the exception system outside of a running
1039 1040 IPython instance.
1040 1041
1041 1042 2007-04-20 Ville Vainio <vivainio@gmail.com>
1042 1043
1043 1044 * Extensions/ipy_render.py: added extension for easy
1044 1045 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
1045 1046 'Iptl' template notation,
1046 1047
1047 1048 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
1048 1049 safer & faster 'import' completer.
1049 1050
1050 1051 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
1051 1052 and _ip.defalias(name, command).
1052 1053
1053 1054 * Extensions/ipy_exportdb.py: New extension for exporting all the
1054 1055 %store'd data in a portable format (normal ipapi calls like
1055 1056 defmacro() etc.)
1056 1057
1057 1058 2007-04-19 Ville Vainio <vivainio@gmail.com>
1058 1059
1059 1060 * upgrade_dir.py: skip junk files like *.pyc
1060 1061
1061 1062 * Release.py: version number to 0.8.1
1062 1063
1063 1064 2007-04-18 Ville Vainio <vivainio@gmail.com>
1064 1065
1065 1066 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
1066 1067 and later on win32.
1067 1068
1068 1069 2007-04-16 Ville Vainio <vivainio@gmail.com>
1069 1070
1070 1071 * iplib.py (showtraceback): Do not crash when running w/o readline.
1071 1072
1072 1073 2007-04-12 Walter Doerwald <walter@livinglogic.de>
1073 1074
1074 1075 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
1075 1076 sorted (case sensitive with files and dirs mixed).
1076 1077
1077 1078 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
1078 1079
1079 1080 * IPython/Release.py (version): Open trunk for 0.8.1 development.
1080 1081
1081 1082 2007-04-10 *** Released version 0.8.0
1082 1083
1083 1084 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
1084 1085
1085 1086 * Tag 0.8.0 for release.
1086 1087
1087 1088 * IPython/iplib.py (reloadhist): add API function to cleanly
1088 1089 reload the readline history, which was growing inappropriately on
1089 1090 every %run call.
1090 1091
1091 1092 * win32_manual_post_install.py (run): apply last part of Nicolas
1092 1093 Pernetty's patch (I'd accidentally applied it in a different
1093 1094 directory and this particular file didn't get patched).
1094 1095
1095 1096 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
1096 1097
1097 1098 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
1098 1099 find the main thread id and use the proper API call. Thanks to
1099 1100 Stefan for the fix.
1100 1101
1101 1102 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
1102 1103 unit tests to reflect fixed ticket #52, and add more tests sent by
1103 1104 him.
1104 1105
1105 1106 * IPython/iplib.py (raw_input): restore the readline completer
1106 1107 state on every input, in case third-party code messed it up.
1107 1108 (_prefilter): revert recent addition of early-escape checks which
1108 1109 prevent many valid alias calls from working.
1109 1110
1110 1111 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
1111 1112 flag for sigint handler so we don't run a full signal() call on
1112 1113 each runcode access.
1113 1114
1114 1115 * IPython/Magic.py (magic_whos): small improvement to diagnostic
1115 1116 message.
1116 1117
1117 1118 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
1118 1119
1119 1120 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
1120 1121 asynchronous exceptions working, i.e., Ctrl-C can actually
1121 1122 interrupt long-running code in the multithreaded shells.
1122 1123
1123 1124 This is using Tomer Filiba's great ctypes-based trick:
1124 1125 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
1125 1126 this in the past, but hadn't been able to make it work before. So
1126 1127 far it looks like it's actually running, but this needs more
1127 1128 testing. If it really works, I'll be *very* happy, and we'll owe
1128 1129 a huge thank you to Tomer. My current implementation is ugly,
1129 1130 hackish and uses nasty globals, but I don't want to try and clean
1130 1131 anything up until we know if it actually works.
1131 1132
1132 1133 NOTE: this feature needs ctypes to work. ctypes is included in
1133 1134 Python2.5, but 2.4 users will need to manually install it. This
1134 1135 feature makes multi-threaded shells so much more usable that it's
1135 1136 a minor price to pay (ctypes is very easy to install, already a
1136 1137 requirement for win32 and available in major linux distros).
1137 1138
1138 1139 2007-04-04 Ville Vainio <vivainio@gmail.com>
1139 1140
1140 1141 * Extensions/ipy_completers.py, ipy_stock_completers.py:
1141 1142 Moved implementations of 'bundled' completers to ipy_completers.py,
1142 1143 they are only enabled in ipy_stock_completers.py.
1143 1144
1144 1145 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
1145 1146
1146 1147 * IPython/PyColorize.py (Parser.format2): Fix identation of
1147 1148 colorzied output and return early if color scheme is NoColor, to
1148 1149 avoid unnecessary and expensive tokenization. Closes #131.
1149 1150
1150 1151 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
1151 1152
1152 1153 * IPython/Debugger.py: disable the use of pydb version 1.17. It
1153 1154 has a critical bug (a missing import that makes post-mortem not
1154 1155 work at all). Unfortunately as of this time, this is the version
1155 1156 shipped with Ubuntu Edgy, so quite a few people have this one. I
1156 1157 hope Edgy will update to a more recent package.
1157 1158
1158 1159 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
1159 1160
1160 1161 * IPython/iplib.py (_prefilter): close #52, second part of a patch
1161 1162 set by Stefan (only the first part had been applied before).
1162 1163
1163 1164 * IPython/Extensions/ipy_stock_completers.py (module_completer):
1164 1165 remove usage of the dangerous pkgutil.walk_packages(). See
1165 1166 details in comments left in the code.
1166 1167
1167 1168 * IPython/Magic.py (magic_whos): add support for numpy arrays
1168 1169 similar to what we had for Numeric.
1169 1170
1170 1171 * IPython/completer.py (IPCompleter.complete): extend the
1171 1172 complete() call API to support completions by other mechanisms
1172 1173 than readline. Closes #109.
1173 1174
1174 1175 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
1175 1176 protect against a bug in Python's execfile(). Closes #123.
1176 1177
1177 1178 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
1178 1179
1179 1180 * IPython/iplib.py (split_user_input): ensure that when splitting
1180 1181 user input, the part that can be treated as a python name is pure
1181 1182 ascii (Python identifiers MUST be pure ascii). Part of the
1182 1183 ongoing Unicode support work.
1183 1184
1184 1185 * IPython/Prompts.py (prompt_specials_color): Add \N for the
1185 1186 actual prompt number, without any coloring. This allows users to
1186 1187 produce numbered prompts with their own colors. Added after a
1187 1188 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
1188 1189
1189 1190 2007-03-31 Walter Doerwald <walter@livinglogic.de>
1190 1191
1191 1192 * IPython/Extensions/igrid.py: Map the return key
1192 1193 to enter() and shift-return to enterattr().
1193 1194
1194 1195 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
1195 1196
1196 1197 * IPython/Magic.py (magic_psearch): add unicode support by
1197 1198 encoding to ascii the input, since this routine also only deals
1198 1199 with valid Python names. Fixes a bug reported by Stefan.
1199 1200
1200 1201 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
1201 1202
1202 1203 * IPython/Magic.py (_inspect): convert unicode input into ascii
1203 1204 before trying to evaluate it as a Python identifier. This fixes a
1204 1205 problem that the new unicode support had introduced when analyzing
1205 1206 long definition lines for functions.
1206 1207
1207 1208 2007-03-24 Walter Doerwald <walter@livinglogic.de>
1208 1209
1209 1210 * IPython/Extensions/igrid.py: Fix picking. Using
1210 1211 igrid with wxPython 2.6 and -wthread should work now.
1211 1212 igrid.display() simply tries to create a frame without
1212 1213 an application. Only if this fails an application is created.
1213 1214
1214 1215 2007-03-23 Walter Doerwald <walter@livinglogic.de>
1215 1216
1216 1217 * IPython/Extensions/path.py: Updated to version 2.2.
1217 1218
1218 1219 2007-03-23 Ville Vainio <vivainio@gmail.com>
1219 1220
1220 1221 * iplib.py: recursive alias expansion now works better, so that
1221 1222 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
1222 1223 doesn't trip up the process, if 'd' has been aliased to 'ls'.
1223 1224
1224 1225 * Extensions/ipy_gnuglobal.py added, provides %global magic
1225 1226 for users of http://www.gnu.org/software/global
1226 1227
1227 1228 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
1228 1229 Closes #52. Patch by Stefan van der Walt.
1229 1230
1230 1231 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
1231 1232
1232 1233 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
1233 1234 respect the __file__ attribute when using %run. Thanks to a bug
1234 1235 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
1235 1236
1236 1237 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
1237 1238
1238 1239 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
1239 1240 input. Patch sent by Stefan.
1240 1241
1241 1242 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1242 1243 * IPython/Extensions/ipy_stock_completer.py
1243 1244 shlex_split, fix bug in shlex_split. len function
1244 1245 call was missing an if statement. Caused shlex_split to
1245 1246 sometimes return "" as last element.
1246 1247
1247 1248 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
1248 1249
1249 1250 * IPython/completer.py
1250 1251 (IPCompleter.file_matches.single_dir_expand): fix a problem
1251 1252 reported by Stefan, where directories containign a single subdir
1252 1253 would be completed too early.
1253 1254
1254 1255 * IPython/Shell.py (_load_pylab): Make the execution of 'from
1255 1256 pylab import *' when -pylab is given be optional. A new flag,
1256 1257 pylab_import_all controls this behavior, the default is True for
1257 1258 backwards compatibility.
1258 1259
1259 1260 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
1260 1261 modified) R. Bernstein's patch for fully syntax highlighted
1261 1262 tracebacks. The functionality is also available under ultraTB for
1262 1263 non-ipython users (someone using ultraTB but outside an ipython
1263 1264 session). They can select the color scheme by setting the
1264 1265 module-level global DEFAULT_SCHEME. The highlight functionality
1265 1266 also works when debugging.
1266 1267
1267 1268 * IPython/genutils.py (IOStream.close): small patch by
1268 1269 R. Bernstein for improved pydb support.
1269 1270
1270 1271 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
1271 1272 DaveS <davls@telus.net> to improve support of debugging under
1272 1273 NTEmacs, including improved pydb behavior.
1273 1274
1274 1275 * IPython/Magic.py (magic_prun): Fix saving of profile info for
1275 1276 Python 2.5, where the stats object API changed a little. Thanks
1276 1277 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
1277 1278
1278 1279 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
1279 1280 Pernetty's patch to improve support for (X)Emacs under Win32.
1280 1281
1281 1282 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
1282 1283
1283 1284 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
1284 1285 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
1285 1286 a report by Nik Tautenhahn.
1286 1287
1287 1288 2007-03-16 Walter Doerwald <walter@livinglogic.de>
1288 1289
1289 1290 * setup.py: Add the igrid help files to the list of data files
1290 1291 to be installed alongside igrid.
1291 1292 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
1292 1293 Show the input object of the igrid browser as the window tile.
1293 1294 Show the object the cursor is on in the statusbar.
1294 1295
1295 1296 2007-03-15 Ville Vainio <vivainio@gmail.com>
1296 1297
1297 1298 * Extensions/ipy_stock_completers.py: Fixed exception
1298 1299 on mismatching quotes in %run completer. Patch by
1299 1300 Jorgen Stenarson. Closes #127.
1300 1301
1301 1302 2007-03-14 Ville Vainio <vivainio@gmail.com>
1302 1303
1303 1304 * Extensions/ext_rehashdir.py: Do not do auto_alias
1304 1305 in %rehashdir, it clobbers %store'd aliases.
1305 1306
1306 1307 * UserConfig/ipy_profile_sh.py: envpersist.py extension
1307 1308 (beefed up %env) imported for sh profile.
1308 1309
1309 1310 2007-03-10 Walter Doerwald <walter@livinglogic.de>
1310 1311
1311 1312 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
1312 1313 as the default browser.
1313 1314 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
1314 1315 As igrid displays all attributes it ever encounters, fetch() (which has
1315 1316 been renamed to _fetch()) doesn't have to recalculate the display attributes
1316 1317 every time a new item is fetched. This should speed up scrolling.
1317 1318
1318 1319 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
1319 1320
1320 1321 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
1321 1322 Schmolck's recently reported tab-completion bug (my previous one
1322 1323 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
1323 1324
1324 1325 2007-03-09 Walter Doerwald <walter@livinglogic.de>
1325 1326
1326 1327 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
1327 1328 Close help window if exiting igrid.
1328 1329
1329 1330 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1330 1331
1331 1332 * IPython/Extensions/ipy_defaults.py: Check if readline is available
1332 1333 before calling functions from readline.
1333 1334
1334 1335 2007-03-02 Walter Doerwald <walter@livinglogic.de>
1335 1336
1336 1337 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
1337 1338 igrid is a wxPython-based display object for ipipe. If your system has
1338 1339 wx installed igrid will be the default display. Without wx ipipe falls
1339 1340 back to ibrowse (which needs curses). If no curses is installed ipipe
1340 1341 falls back to idump.
1341 1342
1342 1343 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
1343 1344
1344 1345 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
1345 1346 my changes from yesterday, they introduced bugs. Will reactivate
1346 1347 once I get a correct solution, which will be much easier thanks to
1347 1348 Dan Milstein's new prefilter test suite.
1348 1349
1349 1350 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
1350 1351
1351 1352 * IPython/iplib.py (split_user_input): fix input splitting so we
1352 1353 don't attempt attribute accesses on things that can't possibly be
1353 1354 valid Python attributes. After a bug report by Alex Schmolck.
1354 1355 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
1355 1356 %magic with explicit % prefix.
1356 1357
1357 1358 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
1358 1359
1359 1360 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
1360 1361 avoid a DeprecationWarning from GTK.
1361 1362
1362 1363 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
1363 1364
1364 1365 * IPython/genutils.py (clock): I modified clock() to return total
1365 1366 time, user+system. This is a more commonly needed metric. I also
1366 1367 introduced the new clocku/clocks to get only user/system time if
1367 1368 one wants those instead.
1368 1369
1369 1370 ***WARNING: API CHANGE*** clock() used to return only user time,
1370 1371 so if you want exactly the same results as before, use clocku
1371 1372 instead.
1372 1373
1373 1374 2007-02-22 Ville Vainio <vivainio@gmail.com>
1374 1375
1375 1376 * IPython/Extensions/ipy_p4.py: Extension for improved
1376 1377 p4 (perforce version control system) experience.
1377 1378 Adds %p4 magic with p4 command completion and
1378 1379 automatic -G argument (marshall output as python dict)
1379 1380
1380 1381 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1381 1382
1382 1383 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1383 1384 stop marks.
1384 1385 (ClearingMixin): a simple mixin to easily make a Demo class clear
1385 1386 the screen in between blocks and have empty marquees. The
1386 1387 ClearDemo and ClearIPDemo classes that use it are included.
1387 1388
1388 1389 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1389 1390
1390 1391 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1391 1392 protect against exceptions at Python shutdown time. Patch
1392 1393 sumbmitted to upstream.
1393 1394
1394 1395 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1395 1396
1396 1397 * IPython/Extensions/ibrowse.py: If entering the first object level
1397 1398 (i.e. the object for which the browser has been started) fails,
1398 1399 now the error is raised directly (aborting the browser) instead of
1399 1400 running into an empty levels list later.
1400 1401
1401 1402 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1402 1403
1403 1404 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1404 1405 for the noitem object.
1405 1406
1406 1407 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1407 1408
1408 1409 * IPython/completer.py (Completer.attr_matches): Fix small
1409 1410 tab-completion bug with Enthought Traits objects with units.
1410 1411 Thanks to a bug report by Tom Denniston
1411 1412 <tom.denniston-AT-alum.dartmouth.org>.
1412 1413
1413 1414 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1414 1415
1415 1416 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1416 1417 bug where only .ipy or .py would be completed. Once the first
1417 1418 argument to %run has been given, all completions are valid because
1418 1419 they are the arguments to the script, which may well be non-python
1419 1420 filenames.
1420 1421
1421 1422 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1422 1423 to irunner to allow it to correctly support real doctesting of
1423 1424 out-of-process ipython code.
1424 1425
1425 1426 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1426 1427 title an option (-noterm_title) because it completely breaks
1427 1428 doctesting.
1428 1429
1429 1430 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1430 1431
1431 1432 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1432 1433
1433 1434 * IPython/irunner.py (main): fix small bug where extensions were
1434 1435 not being correctly recognized.
1435 1436
1436 1437 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1437 1438
1438 1439 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1439 1440 a string containing a single line yields the string itself as the
1440 1441 only item.
1441 1442
1442 1443 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1443 1444 object if it's the same as the one on the last level (This avoids
1444 1445 infinite recursion for one line strings).
1445 1446
1446 1447 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1447 1448
1448 1449 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1449 1450 all output streams before printing tracebacks. This ensures that
1450 1451 user output doesn't end up interleaved with traceback output.
1451 1452
1452 1453 2007-01-10 Ville Vainio <vivainio@gmail.com>
1453 1454
1454 1455 * Extensions/envpersist.py: Turbocharged %env that remembers
1455 1456 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1456 1457 "%env VISUAL=jed".
1457 1458
1458 1459 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1459 1460
1460 1461 * IPython/iplib.py (showtraceback): ensure that we correctly call
1461 1462 custom handlers in all cases (some with pdb were slipping through,
1462 1463 but I'm not exactly sure why).
1463 1464
1464 1465 * IPython/Debugger.py (Tracer.__init__): added new class to
1465 1466 support set_trace-like usage of IPython's enhanced debugger.
1466 1467
1467 1468 2006-12-24 Ville Vainio <vivainio@gmail.com>
1468 1469
1469 1470 * ipmaker.py: more informative message when ipy_user_conf
1470 1471 import fails (suggest running %upgrade).
1471 1472
1472 1473 * tools/run_ipy_in_profiler.py: Utility to see where
1473 1474 the time during IPython startup is spent.
1474 1475
1475 1476 2006-12-20 Ville Vainio <vivainio@gmail.com>
1476 1477
1477 1478 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1478 1479
1479 1480 * ipapi.py: Add new ipapi method, expand_alias.
1480 1481
1481 1482 * Release.py: Bump up version to 0.7.4.svn
1482 1483
1483 1484 2006-12-17 Ville Vainio <vivainio@gmail.com>
1484 1485
1485 1486 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1486 1487 to work properly on posix too
1487 1488
1488 1489 * Release.py: Update revnum (version is still just 0.7.3).
1489 1490
1490 1491 2006-12-15 Ville Vainio <vivainio@gmail.com>
1491 1492
1492 1493 * scripts/ipython_win_post_install: create ipython.py in
1493 1494 prefix + "/scripts".
1494 1495
1495 1496 * Release.py: Update version to 0.7.3.
1496 1497
1497 1498 2006-12-14 Ville Vainio <vivainio@gmail.com>
1498 1499
1499 1500 * scripts/ipython_win_post_install: Overwrite old shortcuts
1500 1501 if they already exist
1501 1502
1502 1503 * Release.py: release 0.7.3rc2
1503 1504
1504 1505 2006-12-13 Ville Vainio <vivainio@gmail.com>
1505 1506
1506 1507 * Branch and update Release.py for 0.7.3rc1
1507 1508
1508 1509 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1509 1510
1510 1511 * IPython/Shell.py (IPShellWX): update for current WX naming
1511 1512 conventions, to avoid a deprecation warning with current WX
1512 1513 versions. Thanks to a report by Danny Shevitz.
1513 1514
1514 1515 2006-12-12 Ville Vainio <vivainio@gmail.com>
1515 1516
1516 1517 * ipmaker.py: apply david cournapeau's patch to make
1517 1518 import_some work properly even when ipythonrc does
1518 1519 import_some on empty list (it was an old bug!).
1519 1520
1520 1521 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1521 1522 Add deprecation note to ipythonrc and a url to wiki
1522 1523 in ipy_user_conf.py
1523 1524
1524 1525
1525 1526 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1526 1527 as if it was typed on IPython command prompt, i.e.
1527 1528 as IPython script.
1528 1529
1529 1530 * example-magic.py, magic_grepl.py: remove outdated examples
1530 1531
1531 1532 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1532 1533
1533 1534 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1534 1535 is called before any exception has occurred.
1535 1536
1536 1537 2006-12-08 Ville Vainio <vivainio@gmail.com>
1537 1538
1538 1539 * Extensions/ipy_stock_completers.py: fix cd completer
1539 1540 to translate /'s to \'s again.
1540 1541
1541 1542 * completer.py: prevent traceback on file completions w/
1542 1543 backslash.
1543 1544
1544 1545 * Release.py: Update release number to 0.7.3b3 for release
1545 1546
1546 1547 2006-12-07 Ville Vainio <vivainio@gmail.com>
1547 1548
1548 1549 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1549 1550 while executing external code. Provides more shell-like behaviour
1550 1551 and overall better response to ctrl + C / ctrl + break.
1551 1552
1552 1553 * tools/make_tarball.py: new script to create tarball straight from svn
1553 1554 (setup.py sdist doesn't work on win32).
1554 1555
1555 1556 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1556 1557 on dirnames with spaces and use the default completer instead.
1557 1558
1558 1559 * Revision.py: Change version to 0.7.3b2 for release.
1559 1560
1560 1561 2006-12-05 Ville Vainio <vivainio@gmail.com>
1561 1562
1562 1563 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1563 1564 pydb patch 4 (rm debug printing, py 2.5 checking)
1564 1565
1565 1566 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1566 1567 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1567 1568 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1568 1569 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1569 1570 object the cursor was on before the refresh. The command "markrange" is
1570 1571 mapped to "%" now.
1571 1572 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1572 1573
1573 1574 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1574 1575
1575 1576 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1576 1577 interactive debugger on the last traceback, without having to call
1577 1578 %pdb and rerun your code. Made minor changes in various modules,
1578 1579 should automatically recognize pydb if available.
1579 1580
1580 1581 2006-11-28 Ville Vainio <vivainio@gmail.com>
1581 1582
1582 1583 * completer.py: If the text start with !, show file completions
1583 1584 properly. This helps when trying to complete command name
1584 1585 for shell escapes.
1585 1586
1586 1587 2006-11-27 Ville Vainio <vivainio@gmail.com>
1587 1588
1588 1589 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1589 1590 der Walt. Clean up svn and hg completers by using a common
1590 1591 vcs_completer.
1591 1592
1592 1593 2006-11-26 Ville Vainio <vivainio@gmail.com>
1593 1594
1594 1595 * Remove ipconfig and %config; you should use _ip.options structure
1595 1596 directly instead!
1596 1597
1597 1598 * genutils.py: add wrap_deprecated function for deprecating callables
1598 1599
1599 1600 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1600 1601 _ip.system instead. ipalias is redundant.
1601 1602
1602 1603 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1603 1604 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1604 1605 explicit.
1605 1606
1606 1607 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1607 1608 completer. Try it by entering 'hg ' and pressing tab.
1608 1609
1609 1610 * macro.py: Give Macro a useful __repr__ method
1610 1611
1611 1612 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1612 1613
1613 1614 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1614 1615 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1615 1616 we don't get a duplicate ipipe module, where registration of the xrepr
1616 1617 implementation for Text is useless.
1617 1618
1618 1619 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1619 1620
1620 1621 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1621 1622
1622 1623 2006-11-24 Ville Vainio <vivainio@gmail.com>
1623 1624
1624 1625 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1625 1626 try to use "cProfile" instead of the slower pure python
1626 1627 "profile"
1627 1628
1628 1629 2006-11-23 Ville Vainio <vivainio@gmail.com>
1629 1630
1630 1631 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1631 1632 Qt+IPython+Designer link in documentation.
1632 1633
1633 1634 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1634 1635 correct Pdb object to %pydb.
1635 1636
1636 1637
1637 1638 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1638 1639 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1639 1640 generic xrepr(), otherwise the list implementation would kick in.
1640 1641
1641 1642 2006-11-21 Ville Vainio <vivainio@gmail.com>
1642 1643
1643 1644 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1644 1645 with one from UserConfig.
1645 1646
1646 1647 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1647 1648 it was missing which broke the sh profile.
1648 1649
1649 1650 * completer.py: file completer now uses explicit '/' instead
1650 1651 of os.path.join, expansion of 'foo' was broken on win32
1651 1652 if there was one directory with name 'foobar'.
1652 1653
1653 1654 * A bunch of patches from Kirill Smelkov:
1654 1655
1655 1656 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1656 1657
1657 1658 * [patch 7/9] Implement %page -r (page in raw mode) -
1658 1659
1659 1660 * [patch 5/9] ScientificPython webpage has moved
1660 1661
1661 1662 * [patch 4/9] The manual mentions %ds, should be %dhist
1662 1663
1663 1664 * [patch 3/9] Kill old bits from %prun doc.
1664 1665
1665 1666 * [patch 1/9] Fix typos here and there.
1666 1667
1667 1668 2006-11-08 Ville Vainio <vivainio@gmail.com>
1668 1669
1669 1670 * completer.py (attr_matches): catch all exceptions raised
1670 1671 by eval of expr with dots.
1671 1672
1672 1673 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1673 1674
1674 1675 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1675 1676 input if it starts with whitespace. This allows you to paste
1676 1677 indented input from any editor without manually having to type in
1677 1678 the 'if 1:', which is convenient when working interactively.
1678 1679 Slightly modifed version of a patch by Bo Peng
1679 1680 <bpeng-AT-rice.edu>.
1680 1681
1681 1682 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1682 1683
1683 1684 * IPython/irunner.py (main): modified irunner so it automatically
1684 1685 recognizes the right runner to use based on the extension (.py for
1685 1686 python, .ipy for ipython and .sage for sage).
1686 1687
1687 1688 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1688 1689 visible in ipapi as ip.config(), to programatically control the
1689 1690 internal rc object. There's an accompanying %config magic for
1690 1691 interactive use, which has been enhanced to match the
1691 1692 funtionality in ipconfig.
1692 1693
1693 1694 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1694 1695 so it's not just a toggle, it now takes an argument. Add support
1695 1696 for a customizable header when making system calls, as the new
1696 1697 system_header variable in the ipythonrc file.
1697 1698
1698 1699 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1699 1700
1700 1701 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1701 1702 generic functions (using Philip J. Eby's simplegeneric package).
1702 1703 This makes it possible to customize the display of third-party classes
1703 1704 without having to monkeypatch them. xiter() no longer supports a mode
1704 1705 argument and the XMode class has been removed. The same functionality can
1705 1706 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1706 1707 One consequence of the switch to generic functions is that xrepr() and
1707 1708 xattrs() implementation must define the default value for the mode
1708 1709 argument themselves and xattrs() implementations must return real
1709 1710 descriptors.
1710 1711
1711 1712 * IPython/external: This new subpackage will contain all third-party
1712 1713 packages that are bundled with IPython. (The first one is simplegeneric).
1713 1714
1714 1715 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1715 1716 directory which as been dropped in r1703.
1716 1717
1717 1718 * IPython/Extensions/ipipe.py (iless): Fixed.
1718 1719
1719 1720 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1720 1721
1721 1722 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1722 1723
1723 1724 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1724 1725 handling in variable expansion so that shells and magics recognize
1725 1726 function local scopes correctly. Bug reported by Brian.
1726 1727
1727 1728 * scripts/ipython: remove the very first entry in sys.path which
1728 1729 Python auto-inserts for scripts, so that sys.path under IPython is
1729 1730 as similar as possible to that under plain Python.
1730 1731
1731 1732 * IPython/completer.py (IPCompleter.file_matches): Fix
1732 1733 tab-completion so that quotes are not closed unless the completion
1733 1734 is unambiguous. After a request by Stefan. Minor cleanups in
1734 1735 ipy_stock_completers.
1735 1736
1736 1737 2006-11-02 Ville Vainio <vivainio@gmail.com>
1737 1738
1738 1739 * ipy_stock_completers.py: Add %run and %cd completers.
1739 1740
1740 1741 * completer.py: Try running custom completer for both
1741 1742 "foo" and "%foo" if the command is just "foo". Ignore case
1742 1743 when filtering possible completions.
1743 1744
1744 1745 * UserConfig/ipy_user_conf.py: install stock completers as default
1745 1746
1746 1747 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1747 1748 simplified readline history save / restore through a wrapper
1748 1749 function
1749 1750
1750 1751
1751 1752 2006-10-31 Ville Vainio <vivainio@gmail.com>
1752 1753
1753 1754 * strdispatch.py, completer.py, ipy_stock_completers.py:
1754 1755 Allow str_key ("command") in completer hooks. Implement
1755 1756 trivial completer for 'import' (stdlib modules only). Rename
1756 1757 ipy_linux_package_managers.py to ipy_stock_completers.py.
1757 1758 SVN completer.
1758 1759
1759 1760 * Extensions/ledit.py: %magic line editor for easily and
1760 1761 incrementally manipulating lists of strings. The magic command
1761 1762 name is %led.
1762 1763
1763 1764 2006-10-30 Ville Vainio <vivainio@gmail.com>
1764 1765
1765 1766 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1766 1767 Bernsteins's patches for pydb integration.
1767 1768 http://bashdb.sourceforge.net/pydb/
1768 1769
1769 1770 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1770 1771 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1771 1772 custom completer hook to allow the users to implement their own
1772 1773 completers. See ipy_linux_package_managers.py for example. The
1773 1774 hook name is 'complete_command'.
1774 1775
1775 1776 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1776 1777
1777 1778 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1778 1779 Numeric leftovers.
1779 1780
1780 1781 * ipython.el (py-execute-region): apply Stefan's patch to fix
1781 1782 garbled results if the python shell hasn't been previously started.
1782 1783
1783 1784 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1784 1785 pretty generic function and useful for other things.
1785 1786
1786 1787 * IPython/OInspect.py (getsource): Add customizable source
1787 1788 extractor. After a request/patch form W. Stein (SAGE).
1788 1789
1789 1790 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1790 1791 window size to a more reasonable value from what pexpect does,
1791 1792 since their choice causes wrapping bugs with long input lines.
1792 1793
1793 1794 2006-10-28 Ville Vainio <vivainio@gmail.com>
1794 1795
1795 1796 * Magic.py (%run): Save and restore the readline history from
1796 1797 file around %run commands to prevent side effects from
1797 1798 %runned programs that might use readline (e.g. pydb).
1798 1799
1799 1800 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1800 1801 invoking the pydb enhanced debugger.
1801 1802
1802 1803 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1803 1804
1804 1805 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1805 1806 call the base class method and propagate the return value to
1806 1807 ifile. This is now done by path itself.
1807 1808
1808 1809 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1809 1810
1810 1811 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1811 1812 api: set_crash_handler(), to expose the ability to change the
1812 1813 internal crash handler.
1813 1814
1814 1815 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1815 1816 the various parameters of the crash handler so that apps using
1816 1817 IPython as their engine can customize crash handling. Ipmlemented
1817 1818 at the request of SAGE.
1818 1819
1819 1820 2006-10-14 Ville Vainio <vivainio@gmail.com>
1820 1821
1821 1822 * Magic.py, ipython.el: applied first "safe" part of Rocky
1822 1823 Bernstein's patch set for pydb integration.
1823 1824
1824 1825 * Magic.py (%unalias, %alias): %store'd aliases can now be
1825 1826 removed with '%unalias'. %alias w/o args now shows most
1826 1827 interesting (stored / manually defined) aliases last
1827 1828 where they catch the eye w/o scrolling.
1828 1829
1829 1830 * Magic.py (%rehashx), ext_rehashdir.py: files with
1830 1831 'py' extension are always considered executable, even
1831 1832 when not in PATHEXT environment variable.
1832 1833
1833 1834 2006-10-12 Ville Vainio <vivainio@gmail.com>
1834 1835
1835 1836 * jobctrl.py: Add new "jobctrl" extension for spawning background
1836 1837 processes with "&find /". 'import jobctrl' to try it out. Requires
1837 1838 'subprocess' module, standard in python 2.4+.
1838 1839
1839 1840 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1840 1841 so if foo -> bar and bar -> baz, then foo -> baz.
1841 1842
1842 1843 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1843 1844
1844 1845 * IPython/Magic.py (Magic.parse_options): add a new posix option
1845 1846 to allow parsing of input args in magics that doesn't strip quotes
1846 1847 (if posix=False). This also closes %timeit bug reported by
1847 1848 Stefan.
1848 1849
1849 1850 2006-10-03 Ville Vainio <vivainio@gmail.com>
1850 1851
1851 1852 * iplib.py (raw_input, interact): Return ValueError catching for
1852 1853 raw_input. Fixes infinite loop for sys.stdin.close() or
1853 1854 sys.stdout.close().
1854 1855
1855 1856 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1856 1857
1857 1858 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1858 1859 to help in handling doctests. irunner is now pretty useful for
1859 1860 running standalone scripts and simulate a full interactive session
1860 1861 in a format that can be then pasted as a doctest.
1861 1862
1862 1863 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1863 1864 on top of the default (useless) ones. This also fixes the nasty
1864 1865 way in which 2.5's Quitter() exits (reverted [1785]).
1865 1866
1866 1867 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1867 1868 2.5.
1868 1869
1869 1870 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1870 1871 color scheme is updated as well when color scheme is changed
1871 1872 interactively.
1872 1873
1873 1874 2006-09-27 Ville Vainio <vivainio@gmail.com>
1874 1875
1875 1876 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1876 1877 infinite loop and just exit. It's a hack, but will do for a while.
1877 1878
1878 1879 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1879 1880
1880 1881 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1881 1882 the constructor, this makes it possible to get a list of only directories
1882 1883 or only files.
1883 1884
1884 1885 2006-08-12 Ville Vainio <vivainio@gmail.com>
1885 1886
1886 1887 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1887 1888 they broke unittest
1888 1889
1889 1890 2006-08-11 Ville Vainio <vivainio@gmail.com>
1890 1891
1891 1892 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1892 1893 by resolving issue properly, i.e. by inheriting FakeModule
1893 1894 from types.ModuleType. Pickling ipython interactive data
1894 1895 should still work as usual (testing appreciated).
1895 1896
1896 1897 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1897 1898
1898 1899 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1899 1900 running under python 2.3 with code from 2.4 to fix a bug with
1900 1901 help(). Reported by the Debian maintainers, Norbert Tretkowski
1901 1902 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1902 1903 <afayolle-AT-debian.org>.
1903 1904
1904 1905 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1905 1906
1906 1907 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1907 1908 (which was displaying "quit" twice).
1908 1909
1909 1910 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1910 1911
1911 1912 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1912 1913 the mode argument).
1913 1914
1914 1915 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1915 1916
1916 1917 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1917 1918 not running under IPython.
1918 1919
1919 1920 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1920 1921 and make it iterable (iterating over the attribute itself). Add two new
1921 1922 magic strings for __xattrs__(): If the string starts with "-", the attribute
1922 1923 will not be displayed in ibrowse's detail view (but it can still be
1923 1924 iterated over). This makes it possible to add attributes that are large
1924 1925 lists or generator methods to the detail view. Replace magic attribute names
1925 1926 and _attrname() and _getattr() with "descriptors": For each type of magic
1926 1927 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1927 1928 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1928 1929 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1929 1930 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1930 1931 are still supported.
1931 1932
1932 1933 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1933 1934 fails in ibrowse.fetch(), the exception object is added as the last item
1934 1935 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1935 1936 a generator throws an exception midway through execution.
1936 1937
1937 1938 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1938 1939 encoding into methods.
1939 1940
1940 1941 2006-07-26 Ville Vainio <vivainio@gmail.com>
1941 1942
1942 1943 * iplib.py: history now stores multiline input as single
1943 1944 history entries. Patch by Jorgen Cederlof.
1944 1945
1945 1946 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1946 1947
1947 1948 * IPython/Extensions/ibrowse.py: Make cursor visible over
1948 1949 non existing attributes.
1949 1950
1950 1951 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1951 1952
1952 1953 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1953 1954 error output of the running command doesn't mess up the screen.
1954 1955
1955 1956 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1956 1957
1957 1958 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1958 1959 argument. This sorts the items themselves.
1959 1960
1960 1961 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1961 1962
1962 1963 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1963 1964 Compile expression strings into code objects. This should speed
1964 1965 up ifilter and friends somewhat.
1965 1966
1966 1967 2006-07-08 Ville Vainio <vivainio@gmail.com>
1967 1968
1968 1969 * Magic.py: %cpaste now strips > from the beginning of lines
1969 1970 to ease pasting quoted code from emails. Contributed by
1970 1971 Stefan van der Walt.
1971 1972
1972 1973 2006-06-29 Ville Vainio <vivainio@gmail.com>
1973 1974
1974 1975 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1975 1976 mode, patch contributed by Darren Dale. NEEDS TESTING!
1976 1977
1977 1978 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1978 1979
1979 1980 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1980 1981 a blue background. Fix fetching new display rows when the browser
1981 1982 scrolls more than a screenful (e.g. by using the goto command).
1982 1983
1983 1984 2006-06-27 Ville Vainio <vivainio@gmail.com>
1984 1985
1985 1986 * Magic.py (_inspect, _ofind) Apply David Huard's
1986 1987 patch for displaying the correct docstring for 'property'
1987 1988 attributes.
1988 1989
1989 1990 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1990 1991
1991 1992 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1992 1993 commands into the methods implementing them.
1993 1994
1994 1995 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1995 1996
1996 1997 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1997 1998 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1998 1999 autoindent support was authored by Jin Liu.
1999 2000
2000 2001 2006-06-22 Walter Doerwald <walter@livinglogic.de>
2001 2002
2002 2003 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
2003 2004 for keymaps with a custom class that simplifies handling.
2004 2005
2005 2006 2006-06-19 Walter Doerwald <walter@livinglogic.de>
2006 2007
2007 2008 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
2008 2009 resizing. This requires Python 2.5 to work.
2009 2010
2010 2011 2006-06-16 Walter Doerwald <walter@livinglogic.de>
2011 2012
2012 2013 * IPython/Extensions/ibrowse.py: Add two new commands to
2013 2014 ibrowse: "hideattr" (mapped to "h") hides the attribute under
2014 2015 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
2015 2016 attributes again. Remapped the help command to "?". Display
2016 2017 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
2017 2018 as keys for the "home" and "end" commands. Add three new commands
2018 2019 to the input mode for "find" and friends: "delend" (CTRL-K)
2019 2020 deletes to the end of line. "incsearchup" searches upwards in the
2020 2021 command history for an input that starts with the text before the cursor.
2021 2022 "incsearchdown" does the same downwards. Removed a bogus mapping of
2022 2023 the x key to "delete".
2023 2024
2024 2025 2006-06-15 Ville Vainio <vivainio@gmail.com>
2025 2026
2026 2027 * iplib.py, hooks.py: Added new generate_prompt hook that can be
2027 2028 used to create prompts dynamically, instead of the "old" way of
2028 2029 assigning "magic" strings to prompt_in1 and prompt_in2. The old
2029 2030 way still works (it's invoked by the default hook), of course.
2030 2031
2031 2032 * Prompts.py: added generate_output_prompt hook for altering output
2032 2033 prompt
2033 2034
2034 2035 * Release.py: Changed version string to 0.7.3.svn.
2035 2036
2036 2037 2006-06-15 Walter Doerwald <walter@livinglogic.de>
2037 2038
2038 2039 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
2039 2040 the call to fetch() always tries to fetch enough data for at least one
2040 2041 full screen. This makes it possible to simply call moveto(0,0,True) in
2041 2042 the constructor. Fix typos and removed the obsolete goto attribute.
2042 2043
2043 2044 2006-06-12 Ville Vainio <vivainio@gmail.com>
2044 2045
2045 2046 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
2046 2047 allowing $variable interpolation within multiline statements,
2047 2048 though so far only with "sh" profile for a testing period.
2048 2049 The patch also enables splitting long commands with \ but it
2049 2050 doesn't work properly yet.
2050 2051
2051 2052 2006-06-12 Walter Doerwald <walter@livinglogic.de>
2052 2053
2053 2054 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
2054 2055 input history and the position of the cursor in the input history for
2055 2056 the find, findbackwards and goto command.
2056 2057
2057 2058 2006-06-10 Walter Doerwald <walter@livinglogic.de>
2058 2059
2059 2060 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
2060 2061 implements the basic functionality of browser commands that require
2061 2062 input. Reimplement the goto, find and findbackwards commands as
2062 2063 subclasses of _CommandInput. Add an input history and keymaps to those
2063 2064 commands. Add "\r" as a keyboard shortcut for the enterdefault and
2064 2065 execute commands.
2065 2066
2066 2067 2006-06-07 Ville Vainio <vivainio@gmail.com>
2067 2068
2068 2069 * iplib.py: ipython mybatch.ipy exits ipython immediately after
2069 2070 running the batch files instead of leaving the session open.
2070 2071
2071 2072 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
2072 2073
2073 2074 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
2074 2075 the original fix was incomplete. Patch submitted by W. Maier.
2075 2076
2076 2077 2006-06-07 Ville Vainio <vivainio@gmail.com>
2077 2078
2078 2079 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
2079 2080 Confirmation prompts can be supressed by 'quiet' option.
2080 2081 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
2081 2082
2082 2083 2006-06-06 *** Released version 0.7.2
2083 2084
2084 2085 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
2085 2086
2086 2087 * IPython/Release.py (version): Made 0.7.2 final for release.
2087 2088 Repo tagged and release cut.
2088 2089
2089 2090 2006-06-05 Ville Vainio <vivainio@gmail.com>
2090 2091
2091 2092 * Magic.py (magic_rehashx): Honor no_alias list earlier in
2092 2093 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
2093 2094
2094 2095 * upgrade_dir.py: try import 'path' module a bit harder
2095 2096 (for %upgrade)
2096 2097
2097 2098 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
2098 2099
2099 2100 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
2100 2101 instead of looping 20 times.
2101 2102
2102 2103 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
2103 2104 correctly at initialization time. Bug reported by Krishna Mohan
2104 2105 Gundu <gkmohan-AT-gmail.com> on the user list.
2105 2106
2106 2107 * IPython/Release.py (version): Mark 0.7.2 version to start
2107 2108 testing for release on 06/06.
2108 2109
2109 2110 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
2110 2111
2111 2112 * scripts/irunner: thin script interface so users don't have to
2112 2113 find the module and call it as an executable, since modules rarely
2113 2114 live in people's PATH.
2114 2115
2115 2116 * IPython/irunner.py (InteractiveRunner.__init__): added
2116 2117 delaybeforesend attribute to control delays with newer versions of
2117 2118 pexpect. Thanks to detailed help from pexpect's author, Noah
2118 2119 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
2119 2120 correctly (it works in NoColor mode).
2120 2121
2121 2122 * IPython/iplib.py (handle_normal): fix nasty crash reported on
2122 2123 SAGE list, from improper log() calls.
2123 2124
2124 2125 2006-05-31 Ville Vainio <vivainio@gmail.com>
2125 2126
2126 2127 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
2127 2128 with args in parens to work correctly with dirs that have spaces.
2128 2129
2129 2130 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
2130 2131
2131 2132 * IPython/Logger.py (Logger.logstart): add option to log raw input
2132 2133 instead of the processed one. A -r flag was added to the
2133 2134 %logstart magic used for controlling logging.
2134 2135
2135 2136 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
2136 2137
2137 2138 * IPython/iplib.py (InteractiveShell.__init__): add check for the
2138 2139 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
2139 2140 recognize the option. After a bug report by Will Maier. This
2140 2141 closes #64 (will do it after confirmation from W. Maier).
2141 2142
2142 2143 * IPython/irunner.py: New module to run scripts as if manually
2143 2144 typed into an interactive environment, based on pexpect. After a
2144 2145 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
2145 2146 ipython-user list. Simple unittests in the tests/ directory.
2146 2147
2147 2148 * tools/release: add Will Maier, OpenBSD port maintainer, to
2148 2149 recepients list. We are now officially part of the OpenBSD ports:
2149 2150 http://www.openbsd.org/ports.html ! Many thanks to Will for the
2150 2151 work.
2151 2152
2152 2153 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
2153 2154
2154 2155 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
2155 2156 so that it doesn't break tkinter apps.
2156 2157
2157 2158 * IPython/iplib.py (_prefilter): fix bug where aliases would
2158 2159 shadow variables when autocall was fully off. Reported by SAGE
2159 2160 author William Stein.
2160 2161
2161 2162 * IPython/OInspect.py (Inspector.__init__): add a flag to control
2162 2163 at what detail level strings are computed when foo? is requested.
2163 2164 This allows users to ask for example that the string form of an
2164 2165 object is only computed when foo?? is called, or even never, by
2165 2166 setting the object_info_string_level >= 2 in the configuration
2166 2167 file. This new option has been added and documented. After a
2167 2168 request by SAGE to be able to control the printing of very large
2168 2169 objects more easily.
2169 2170
2170 2171 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
2171 2172
2172 2173 * IPython/ipmaker.py (make_IPython): remove the ipython call path
2173 2174 from sys.argv, to be 100% consistent with how Python itself works
2174 2175 (as seen for example with python -i file.py). After a bug report
2175 2176 by Jeffrey Collins.
2176 2177
2177 2178 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
2178 2179 nasty bug which was preventing custom namespaces with -pylab,
2179 2180 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
2180 2181 compatibility (long gone from mpl).
2181 2182
2182 2183 * IPython/ipapi.py (make_session): name change: create->make. We
2183 2184 use make in other places (ipmaker,...), it's shorter and easier to
2184 2185 type and say, etc. I'm trying to clean things before 0.7.2 so
2185 2186 that I can keep things stable wrt to ipapi in the chainsaw branch.
2186 2187
2187 2188 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
2188 2189 python-mode recognizes our debugger mode. Add support for
2189 2190 autoindent inside (X)emacs. After a patch sent in by Jin Liu
2190 2191 <m.liu.jin-AT-gmail.com> originally written by
2191 2192 doxgen-AT-newsmth.net (with minor modifications for xemacs
2192 2193 compatibility)
2193 2194
2194 2195 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
2195 2196 tracebacks when walking the stack so that the stack tracking system
2196 2197 in emacs' python-mode can identify the frames correctly.
2197 2198
2198 2199 * IPython/ipmaker.py (make_IPython): make the internal (and
2199 2200 default config) autoedit_syntax value false by default. Too many
2200 2201 users have complained to me (both on and off-list) about problems
2201 2202 with this option being on by default, so I'm making it default to
2202 2203 off. It can still be enabled by anyone via the usual mechanisms.
2203 2204
2204 2205 * IPython/completer.py (Completer.attr_matches): add support for
2205 2206 PyCrust-style _getAttributeNames magic method. Patch contributed
2206 2207 by <mscott-AT-goldenspud.com>. Closes #50.
2207 2208
2208 2209 * IPython/iplib.py (InteractiveShell.__init__): remove the
2209 2210 deletion of exit/quit from __builtin__, which can break
2210 2211 third-party tools like the Zope debugging console. The
2211 2212 %exit/%quit magics remain. In general, it's probably a good idea
2212 2213 not to delete anything from __builtin__, since we never know what
2213 2214 that will break. In any case, python now (for 2.5) will support
2214 2215 'real' exit/quit, so this issue is moot. Closes #55.
2215 2216
2216 2217 * IPython/genutils.py (with_obj): rename the 'with' function to
2217 2218 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
2218 2219 becomes a language keyword. Closes #53.
2219 2220
2220 2221 * IPython/FakeModule.py (FakeModule.__init__): add a proper
2221 2222 __file__ attribute to this so it fools more things into thinking
2222 2223 it is a real module. Closes #59.
2223 2224
2224 2225 * IPython/Magic.py (magic_edit): add -n option to open the editor
2225 2226 at a specific line number. After a patch by Stefan van der Walt.
2226 2227
2227 2228 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
2228 2229
2229 2230 * IPython/iplib.py (edit_syntax_error): fix crash when for some
2230 2231 reason the file could not be opened. After automatic crash
2231 2232 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
2232 2233 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
2233 2234 (_should_recompile): Don't fire editor if using %bg, since there
2234 2235 is no file in the first place. From the same report as above.
2235 2236 (raw_input): protect against faulty third-party prefilters. After
2236 2237 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
2237 2238 while running under SAGE.
2238 2239
2239 2240 2006-05-23 Ville Vainio <vivainio@gmail.com>
2240 2241
2241 2242 * ipapi.py: Stripped down ip.to_user_ns() to work only as
2242 2243 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
2243 2244 now returns None (again), unless dummy is specifically allowed by
2244 2245 ipapi.get(allow_dummy=True).
2245 2246
2246 2247 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
2247 2248
2248 2249 * IPython: remove all 2.2-compatibility objects and hacks from
2249 2250 everywhere, since we only support 2.3 at this point. Docs
2250 2251 updated.
2251 2252
2252 2253 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
2253 2254 Anything requiring extra validation can be turned into a Python
2254 2255 property in the future. I used a property for the db one b/c
2255 2256 there was a nasty circularity problem with the initialization
2256 2257 order, which right now I don't have time to clean up.
2257 2258
2258 2259 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
2259 2260 another locking bug reported by Jorgen. I'm not 100% sure though,
2260 2261 so more testing is needed...
2261 2262
2262 2263 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
2263 2264
2264 2265 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
2265 2266 local variables from any routine in user code (typically executed
2266 2267 with %run) directly into the interactive namespace. Very useful
2267 2268 when doing complex debugging.
2268 2269 (IPythonNotRunning): Changed the default None object to a dummy
2269 2270 whose attributes can be queried as well as called without
2270 2271 exploding, to ease writing code which works transparently both in
2271 2272 and out of ipython and uses some of this API.
2272 2273
2273 2274 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
2274 2275
2275 2276 * IPython/hooks.py (result_display): Fix the fact that our display
2276 2277 hook was using str() instead of repr(), as the default python
2277 2278 console does. This had gone unnoticed b/c it only happened if
2278 2279 %Pprint was off, but the inconsistency was there.
2279 2280
2280 2281 2006-05-15 Ville Vainio <vivainio@gmail.com>
2281 2282
2282 2283 * Oinspect.py: Only show docstring for nonexisting/binary files
2283 2284 when doing object??, closing ticket #62
2284 2285
2285 2286 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
2286 2287
2287 2288 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
2288 2289 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
2289 2290 was being released in a routine which hadn't checked if it had
2290 2291 been the one to acquire it.
2291 2292
2292 2293 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
2293 2294
2294 2295 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
2295 2296
2296 2297 2006-04-11 Ville Vainio <vivainio@gmail.com>
2297 2298
2298 2299 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
2299 2300 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
2300 2301 prefilters, allowing stuff like magics and aliases in the file.
2301 2302
2302 2303 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
2303 2304 added. Supported now are "%clear in" and "%clear out" (clear input and
2304 2305 output history, respectively). Also fixed CachedOutput.flush to
2305 2306 properly flush the output cache.
2306 2307
2307 2308 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
2308 2309 half-success (and fail explicitly).
2309 2310
2310 2311 2006-03-28 Ville Vainio <vivainio@gmail.com>
2311 2312
2312 2313 * iplib.py: Fix quoting of aliases so that only argless ones
2313 2314 are quoted
2314 2315
2315 2316 2006-03-28 Ville Vainio <vivainio@gmail.com>
2316 2317
2317 2318 * iplib.py: Quote aliases with spaces in the name.
2318 2319 "c:\program files\blah\bin" is now legal alias target.
2319 2320
2320 2321 * ext_rehashdir.py: Space no longer allowed as arg
2321 2322 separator, since space is legal in path names.
2322 2323
2323 2324 2006-03-16 Ville Vainio <vivainio@gmail.com>
2324 2325
2325 2326 * upgrade_dir.py: Take path.py from Extensions, correcting
2326 2327 %upgrade magic
2327 2328
2328 2329 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
2329 2330
2330 2331 * hooks.py: Only enclose editor binary in quotes if legal and
2331 2332 necessary (space in the name, and is an existing file). Fixes a bug
2332 2333 reported by Zachary Pincus.
2333 2334
2334 2335 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2335 2336
2336 2337 * Manual: thanks to a tip on proper color handling for Emacs, by
2337 2338 Eric J Haywiser <ejh1-AT-MIT.EDU>.
2338 2339
2339 2340 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
2340 2341 by applying the provided patch. Thanks to Liu Jin
2341 2342 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
2342 2343 XEmacs/Linux, I'm trusting the submitter that it actually helps
2343 2344 under win32/GNU Emacs. Will revisit if any problems are reported.
2344 2345
2345 2346 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2346 2347
2347 2348 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
2348 2349 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
2349 2350
2350 2351 2006-03-12 Ville Vainio <vivainio@gmail.com>
2351 2352
2352 2353 * Magic.py (magic_timeit): Added %timeit magic, contributed by
2353 2354 Torsten Marek.
2354 2355
2355 2356 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2356 2357
2357 2358 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
2358 2359 line ranges works again.
2359 2360
2360 2361 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2361 2362
2362 2363 * IPython/iplib.py (showtraceback): add back sys.last_traceback
2363 2364 and friends, after a discussion with Zach Pincus on ipython-user.
2364 2365 I'm not 100% sure, but after thinking about it quite a bit, it may
2365 2366 be OK. Testing with the multithreaded shells didn't reveal any
2366 2367 problems, but let's keep an eye out.
2367 2368
2368 2369 In the process, I fixed a few things which were calling
2369 2370 self.InteractiveTB() directly (like safe_execfile), which is a
2370 2371 mistake: ALL exception reporting should be done by calling
2371 2372 self.showtraceback(), which handles state and tab-completion and
2372 2373 more.
2373 2374
2374 2375 2006-03-01 Ville Vainio <vivainio@gmail.com>
2375 2376
2376 2377 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2377 2378 To use, do "from ipipe import *".
2378 2379
2379 2380 2006-02-24 Ville Vainio <vivainio@gmail.com>
2380 2381
2381 2382 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2382 2383 "cleanly" and safely than the older upgrade mechanism.
2383 2384
2384 2385 2006-02-21 Ville Vainio <vivainio@gmail.com>
2385 2386
2386 2387 * Magic.py: %save works again.
2387 2388
2388 2389 2006-02-15 Ville Vainio <vivainio@gmail.com>
2389 2390
2390 2391 * Magic.py: %Pprint works again
2391 2392
2392 2393 * Extensions/ipy_sane_defaults.py: Provide everything provided
2393 2394 in default ipythonrc, to make it possible to have a completely empty
2394 2395 ipythonrc (and thus completely rc-file free configuration)
2395 2396
2396 2397 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2397 2398
2398 2399 * IPython/hooks.py (editor): quote the call to the editor command,
2399 2400 to allow commands with spaces in them. Problem noted by watching
2400 2401 Ian Oswald's video about textpad under win32 at
2401 2402 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2402 2403
2403 2404 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2404 2405 describing magics (we haven't used @ for a loong time).
2405 2406
2406 2407 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2407 2408 contributed by marienz to close
2408 2409 http://www.scipy.net/roundup/ipython/issue53.
2409 2410
2410 2411 2006-02-10 Ville Vainio <vivainio@gmail.com>
2411 2412
2412 2413 * genutils.py: getoutput now works in win32 too
2413 2414
2414 2415 * completer.py: alias and magic completion only invoked
2415 2416 at the first "item" in the line, to avoid "cd %store"
2416 2417 nonsense.
2417 2418
2418 2419 2006-02-09 Ville Vainio <vivainio@gmail.com>
2419 2420
2420 2421 * test/*: Added a unit testing framework (finally).
2421 2422 '%run runtests.py' to run test_*.
2422 2423
2423 2424 * ipapi.py: Exposed runlines and set_custom_exc
2424 2425
2425 2426 2006-02-07 Ville Vainio <vivainio@gmail.com>
2426 2427
2427 2428 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2428 2429 instead use "f(1 2)" as before.
2429 2430
2430 2431 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2431 2432
2432 2433 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2433 2434 facilities, for demos processed by the IPython input filter
2434 2435 (IPythonDemo), and for running a script one-line-at-a-time as a
2435 2436 demo, both for pure Python (LineDemo) and for IPython-processed
2436 2437 input (IPythonLineDemo). After a request by Dave Kohel, from the
2437 2438 SAGE team.
2438 2439 (Demo.edit): added an edit() method to the demo objects, to edit
2439 2440 the in-memory copy of the last executed block.
2440 2441
2441 2442 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2442 2443 processing to %edit, %macro and %save. These commands can now be
2443 2444 invoked on the unprocessed input as it was typed by the user
2444 2445 (without any prefilters applied). After requests by the SAGE team
2445 2446 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2446 2447
2447 2448 2006-02-01 Ville Vainio <vivainio@gmail.com>
2448 2449
2449 2450 * setup.py, eggsetup.py: easy_install ipython==dev works
2450 2451 correctly now (on Linux)
2451 2452
2452 2453 * ipy_user_conf,ipmaker: user config changes, removed spurious
2453 2454 warnings
2454 2455
2455 2456 * iplib: if rc.banner is string, use it as is.
2456 2457
2457 2458 * Magic: %pycat accepts a string argument and pages it's contents.
2458 2459
2459 2460
2460 2461 2006-01-30 Ville Vainio <vivainio@gmail.com>
2461 2462
2462 2463 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2463 2464 Now %store and bookmarks work through PickleShare, meaning that
2464 2465 concurrent access is possible and all ipython sessions see the
2465 2466 same database situation all the time, instead of snapshot of
2466 2467 the situation when the session was started. Hence, %bookmark
2467 2468 results are immediately accessible from othes sessions. The database
2468 2469 is also available for use by user extensions. See:
2469 2470 http://www.python.org/pypi/pickleshare
2470 2471
2471 2472 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2472 2473
2473 2474 * aliases can now be %store'd
2474 2475
2475 2476 * path.py moved to Extensions so that pickleshare does not need
2476 2477 IPython-specific import. Extensions added to pythonpath right
2477 2478 at __init__.
2478 2479
2479 2480 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2480 2481 called with _ip.system and the pre-transformed command string.
2481 2482
2482 2483 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2483 2484
2484 2485 * IPython/iplib.py (interact): Fix that we were not catching
2485 2486 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2486 2487 logic here had to change, but it's fixed now.
2487 2488
2488 2489 2006-01-29 Ville Vainio <vivainio@gmail.com>
2489 2490
2490 2491 * iplib.py: Try to import pyreadline on Windows.
2491 2492
2492 2493 2006-01-27 Ville Vainio <vivainio@gmail.com>
2493 2494
2494 2495 * iplib.py: Expose ipapi as _ip in builtin namespace.
2495 2496 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2496 2497 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2497 2498 syntax now produce _ip.* variant of the commands.
2498 2499
2499 2500 * "_ip.options().autoedit_syntax = 2" automatically throws
2500 2501 user to editor for syntax error correction without prompting.
2501 2502
2502 2503 2006-01-27 Ville Vainio <vivainio@gmail.com>
2503 2504
2504 2505 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2505 2506 'ipython' at argv[0]) executed through command line.
2506 2507 NOTE: this DEPRECATES calling ipython with multiple scripts
2507 2508 ("ipython a.py b.py c.py")
2508 2509
2509 2510 * iplib.py, hooks.py: Added configurable input prefilter,
2510 2511 named 'input_prefilter'. See ext_rescapture.py for example
2511 2512 usage.
2512 2513
2513 2514 * ext_rescapture.py, Magic.py: Better system command output capture
2514 2515 through 'var = !ls' (deprecates user-visible %sc). Same notation
2515 2516 applies for magics, 'var = %alias' assigns alias list to var.
2516 2517
2517 2518 * ipapi.py: added meta() for accessing extension-usable data store.
2518 2519
2519 2520 * iplib.py: added InteractiveShell.getapi(). New magics should be
2520 2521 written doing self.getapi() instead of using the shell directly.
2521 2522
2522 2523 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2523 2524 %store foo >> ~/myfoo.txt to store variables to files (in clean
2524 2525 textual form, not a restorable pickle).
2525 2526
2526 2527 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2527 2528
2528 2529 * usage.py, Magic.py: added %quickref
2529 2530
2530 2531 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2531 2532
2532 2533 * GetoptErrors when invoking magics etc. with wrong args
2533 2534 are now more helpful:
2534 2535 GetoptError: option -l not recognized (allowed: "qb" )
2535 2536
2536 2537 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2537 2538
2538 2539 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2539 2540 computationally intensive blocks don't appear to stall the demo.
2540 2541
2541 2542 2006-01-24 Ville Vainio <vivainio@gmail.com>
2542 2543
2543 2544 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2544 2545 value to manipulate resulting history entry.
2545 2546
2546 2547 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2547 2548 to instance methods of IPApi class, to make extending an embedded
2548 2549 IPython feasible. See ext_rehashdir.py for example usage.
2549 2550
2550 2551 * Merged 1071-1076 from branches/0.7.1
2551 2552
2552 2553
2553 2554 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2554 2555
2555 2556 * tools/release (daystamp): Fix build tools to use the new
2556 2557 eggsetup.py script to build lightweight eggs.
2557 2558
2558 2559 * Applied changesets 1062 and 1064 before 0.7.1 release.
2559 2560
2560 2561 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2561 2562 see the raw input history (without conversions like %ls ->
2562 2563 ipmagic("ls")). After a request from W. Stein, SAGE
2563 2564 (http://modular.ucsd.edu/sage) developer. This information is
2564 2565 stored in the input_hist_raw attribute of the IPython instance, so
2565 2566 developers can access it if needed (it's an InputList instance).
2566 2567
2567 2568 * Versionstring = 0.7.2.svn
2568 2569
2569 2570 * eggsetup.py: A separate script for constructing eggs, creates
2570 2571 proper launch scripts even on Windows (an .exe file in
2571 2572 \python24\scripts).
2572 2573
2573 2574 * ipapi.py: launch_new_instance, launch entry point needed for the
2574 2575 egg.
2575 2576
2576 2577 2006-01-23 Ville Vainio <vivainio@gmail.com>
2577 2578
2578 2579 * Added %cpaste magic for pasting python code
2579 2580
2580 2581 2006-01-22 Ville Vainio <vivainio@gmail.com>
2581 2582
2582 2583 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2583 2584
2584 2585 * Versionstring = 0.7.2.svn
2585 2586
2586 2587 * eggsetup.py: A separate script for constructing eggs, creates
2587 2588 proper launch scripts even on Windows (an .exe file in
2588 2589 \python24\scripts).
2589 2590
2590 2591 * ipapi.py: launch_new_instance, launch entry point needed for the
2591 2592 egg.
2592 2593
2593 2594 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2594 2595
2595 2596 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2596 2597 %pfile foo would print the file for foo even if it was a binary.
2597 2598 Now, extensions '.so' and '.dll' are skipped.
2598 2599
2599 2600 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2600 2601 bug, where macros would fail in all threaded modes. I'm not 100%
2601 2602 sure, so I'm going to put out an rc instead of making a release
2602 2603 today, and wait for feedback for at least a few days.
2603 2604
2604 2605 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2605 2606 it...) the handling of pasting external code with autoindent on.
2606 2607 To get out of a multiline input, the rule will appear for most
2607 2608 users unchanged: two blank lines or change the indent level
2608 2609 proposed by IPython. But there is a twist now: you can
2609 2610 add/subtract only *one or two spaces*. If you add/subtract three
2610 2611 or more (unless you completely delete the line), IPython will
2611 2612 accept that line, and you'll need to enter a second one of pure
2612 2613 whitespace. I know it sounds complicated, but I can't find a
2613 2614 different solution that covers all the cases, with the right
2614 2615 heuristics. Hopefully in actual use, nobody will really notice
2615 2616 all these strange rules and things will 'just work'.
2616 2617
2617 2618 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2618 2619
2619 2620 * IPython/iplib.py (interact): catch exceptions which can be
2620 2621 triggered asynchronously by signal handlers. Thanks to an
2621 2622 automatic crash report, submitted by Colin Kingsley
2622 2623 <tercel-AT-gentoo.org>.
2623 2624
2624 2625 2006-01-20 Ville Vainio <vivainio@gmail.com>
2625 2626
2626 2627 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2627 2628 (%rehashdir, very useful, try it out) of how to extend ipython
2628 2629 with new magics. Also added Extensions dir to pythonpath to make
2629 2630 importing extensions easy.
2630 2631
2631 2632 * %store now complains when trying to store interactively declared
2632 2633 classes / instances of those classes.
2633 2634
2634 2635 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2635 2636 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2636 2637 if they exist, and ipy_user_conf.py with some defaults is created for
2637 2638 the user.
2638 2639
2639 2640 * Startup rehashing done by the config file, not InterpreterExec.
2640 2641 This means system commands are available even without selecting the
2641 2642 pysh profile. It's the sensible default after all.
2642 2643
2643 2644 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2644 2645
2645 2646 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2646 2647 multiline code with autoindent on working. But I am really not
2647 2648 sure, so this needs more testing. Will commit a debug-enabled
2648 2649 version for now, while I test it some more, so that Ville and
2649 2650 others may also catch any problems. Also made
2650 2651 self.indent_current_str() a method, to ensure that there's no
2651 2652 chance of the indent space count and the corresponding string
2652 2653 falling out of sync. All code needing the string should just call
2653 2654 the method.
2654 2655
2655 2656 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2656 2657
2657 2658 * IPython/Magic.py (magic_edit): fix check for when users don't
2658 2659 save their output files, the try/except was in the wrong section.
2659 2660
2660 2661 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2661 2662
2662 2663 * IPython/Magic.py (magic_run): fix __file__ global missing from
2663 2664 script's namespace when executed via %run. After a report by
2664 2665 Vivian.
2665 2666
2666 2667 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2667 2668 when using python 2.4. The parent constructor changed in 2.4, and
2668 2669 we need to track it directly (we can't call it, as it messes up
2669 2670 readline and tab-completion inside our pdb would stop working).
2670 2671 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2671 2672
2672 2673 2006-01-16 Ville Vainio <vivainio@gmail.com>
2673 2674
2674 2675 * Ipython/magic.py: Reverted back to old %edit functionality
2675 2676 that returns file contents on exit.
2676 2677
2677 2678 * IPython/path.py: Added Jason Orendorff's "path" module to
2678 2679 IPython tree, http://www.jorendorff.com/articles/python/path/.
2679 2680 You can get path objects conveniently through %sc, and !!, e.g.:
2680 2681 sc files=ls
2681 2682 for p in files.paths: # or files.p
2682 2683 print p,p.mtime
2683 2684
2684 2685 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2685 2686 now work again without considering the exclusion regexp -
2686 2687 hence, things like ',foo my/path' turn to 'foo("my/path")'
2687 2688 instead of syntax error.
2688 2689
2689 2690
2690 2691 2006-01-14 Ville Vainio <vivainio@gmail.com>
2691 2692
2692 2693 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2693 2694 ipapi decorators for python 2.4 users, options() provides access to rc
2694 2695 data.
2695 2696
2696 2697 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2697 2698 as path separators (even on Linux ;-). Space character after
2698 2699 backslash (as yielded by tab completer) is still space;
2699 2700 "%cd long\ name" works as expected.
2700 2701
2701 2702 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2702 2703 as "chain of command", with priority. API stays the same,
2703 2704 TryNext exception raised by a hook function signals that
2704 2705 current hook failed and next hook should try handling it, as
2705 2706 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2706 2707 requested configurable display hook, which is now implemented.
2707 2708
2708 2709 2006-01-13 Ville Vainio <vivainio@gmail.com>
2709 2710
2710 2711 * IPython/platutils*.py: platform specific utility functions,
2711 2712 so far only set_term_title is implemented (change terminal
2712 2713 label in windowing systems). %cd now changes the title to
2713 2714 current dir.
2714 2715
2715 2716 * IPython/Release.py: Added myself to "authors" list,
2716 2717 had to create new files.
2717 2718
2718 2719 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2719 2720 shell escape; not a known bug but had potential to be one in the
2720 2721 future.
2721 2722
2722 2723 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2723 2724 extension API for IPython! See the module for usage example. Fix
2724 2725 OInspect for docstring-less magic functions.
2725 2726
2726 2727
2727 2728 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2728 2729
2729 2730 * IPython/iplib.py (raw_input): temporarily deactivate all
2730 2731 attempts at allowing pasting of code with autoindent on. It
2731 2732 introduced bugs (reported by Prabhu) and I can't seem to find a
2732 2733 robust combination which works in all cases. Will have to revisit
2733 2734 later.
2734 2735
2735 2736 * IPython/genutils.py: remove isspace() function. We've dropped
2736 2737 2.2 compatibility, so it's OK to use the string method.
2737 2738
2738 2739 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2739 2740
2740 2741 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2741 2742 matching what NOT to autocall on, to include all python binary
2742 2743 operators (including things like 'and', 'or', 'is' and 'in').
2743 2744 Prompted by a bug report on 'foo & bar', but I realized we had
2744 2745 many more potential bug cases with other operators. The regexp is
2745 2746 self.re_exclude_auto, it's fairly commented.
2746 2747
2747 2748 2006-01-12 Ville Vainio <vivainio@gmail.com>
2748 2749
2749 2750 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2750 2751 Prettified and hardened string/backslash quoting with ipsystem(),
2751 2752 ipalias() and ipmagic(). Now even \ characters are passed to
2752 2753 %magics, !shell escapes and aliases exactly as they are in the
2753 2754 ipython command line. Should improve backslash experience,
2754 2755 particularly in Windows (path delimiter for some commands that
2755 2756 won't understand '/'), but Unix benefits as well (regexps). %cd
2756 2757 magic still doesn't support backslash path delimiters, though. Also
2757 2758 deleted all pretense of supporting multiline command strings in
2758 2759 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2759 2760
2760 2761 * doc/build_doc_instructions.txt added. Documentation on how to
2761 2762 use doc/update_manual.py, added yesterday. Both files contributed
2762 2763 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2763 2764 doc/*.sh for deprecation at a later date.
2764 2765
2765 2766 * /ipython.py Added ipython.py to root directory for
2766 2767 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2767 2768 ipython.py) and development convenience (no need to keep doing
2768 2769 "setup.py install" between changes).
2769 2770
2770 2771 * Made ! and !! shell escapes work (again) in multiline expressions:
2771 2772 if 1:
2772 2773 !ls
2773 2774 !!ls
2774 2775
2775 2776 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2776 2777
2777 2778 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2778 2779 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2779 2780 module in case-insensitive installation. Was causing crashes
2780 2781 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2781 2782
2782 2783 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2783 2784 <marienz-AT-gentoo.org>, closes
2784 2785 http://www.scipy.net/roundup/ipython/issue51.
2785 2786
2786 2787 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2787 2788
2788 2789 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2789 2790 problem of excessive CPU usage under *nix and keyboard lag under
2790 2791 win32.
2791 2792
2792 2793 2006-01-10 *** Released version 0.7.0
2793 2794
2794 2795 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2795 2796
2796 2797 * IPython/Release.py (revision): tag version number to 0.7.0,
2797 2798 ready for release.
2798 2799
2799 2800 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2800 2801 it informs the user of the name of the temp. file used. This can
2801 2802 help if you decide later to reuse that same file, so you know
2802 2803 where to copy the info from.
2803 2804
2804 2805 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2805 2806
2806 2807 * setup_bdist_egg.py: little script to build an egg. Added
2807 2808 support in the release tools as well.
2808 2809
2809 2810 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2810 2811
2811 2812 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2812 2813 version selection (new -wxversion command line and ipythonrc
2813 2814 parameter). Patch contributed by Arnd Baecker
2814 2815 <arnd.baecker-AT-web.de>.
2815 2816
2816 2817 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2817 2818 embedded instances, for variables defined at the interactive
2818 2819 prompt of the embedded ipython. Reported by Arnd.
2819 2820
2820 2821 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2821 2822 it can be used as a (stateful) toggle, or with a direct parameter.
2822 2823
2823 2824 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2824 2825 could be triggered in certain cases and cause the traceback
2825 2826 printer not to work.
2826 2827
2827 2828 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2828 2829
2829 2830 * IPython/iplib.py (_should_recompile): Small fix, closes
2830 2831 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2831 2832
2832 2833 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2833 2834
2834 2835 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2835 2836 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2836 2837 Moad for help with tracking it down.
2837 2838
2838 2839 * IPython/iplib.py (handle_auto): fix autocall handling for
2839 2840 objects which support BOTH __getitem__ and __call__ (so that f [x]
2840 2841 is left alone, instead of becoming f([x]) automatically).
2841 2842
2842 2843 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2843 2844 Ville's patch.
2844 2845
2845 2846 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2846 2847
2847 2848 * IPython/iplib.py (handle_auto): changed autocall semantics to
2848 2849 include 'smart' mode, where the autocall transformation is NOT
2849 2850 applied if there are no arguments on the line. This allows you to
2850 2851 just type 'foo' if foo is a callable to see its internal form,
2851 2852 instead of having it called with no arguments (typically a
2852 2853 mistake). The old 'full' autocall still exists: for that, you
2853 2854 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2854 2855
2855 2856 * IPython/completer.py (Completer.attr_matches): add
2856 2857 tab-completion support for Enthoughts' traits. After a report by
2857 2858 Arnd and a patch by Prabhu.
2858 2859
2859 2860 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2860 2861
2861 2862 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2862 2863 Schmolck's patch to fix inspect.getinnerframes().
2863 2864
2864 2865 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2865 2866 for embedded instances, regarding handling of namespaces and items
2866 2867 added to the __builtin__ one. Multiple embedded instances and
2867 2868 recursive embeddings should work better now (though I'm not sure
2868 2869 I've got all the corner cases fixed, that code is a bit of a brain
2869 2870 twister).
2870 2871
2871 2872 * IPython/Magic.py (magic_edit): added support to edit in-memory
2872 2873 macros (automatically creates the necessary temp files). %edit
2873 2874 also doesn't return the file contents anymore, it's just noise.
2874 2875
2875 2876 * IPython/completer.py (Completer.attr_matches): revert change to
2876 2877 complete only on attributes listed in __all__. I realized it
2877 2878 cripples the tab-completion system as a tool for exploring the
2878 2879 internals of unknown libraries (it renders any non-__all__
2879 2880 attribute off-limits). I got bit by this when trying to see
2880 2881 something inside the dis module.
2881 2882
2882 2883 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2883 2884
2884 2885 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2885 2886 namespace for users and extension writers to hold data in. This
2886 2887 follows the discussion in
2887 2888 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2888 2889
2889 2890 * IPython/completer.py (IPCompleter.complete): small patch to help
2890 2891 tab-completion under Emacs, after a suggestion by John Barnard
2891 2892 <barnarj-AT-ccf.org>.
2892 2893
2893 2894 * IPython/Magic.py (Magic.extract_input_slices): added support for
2894 2895 the slice notation in magics to use N-M to represent numbers N...M
2895 2896 (closed endpoints). This is used by %macro and %save.
2896 2897
2897 2898 * IPython/completer.py (Completer.attr_matches): for modules which
2898 2899 define __all__, complete only on those. After a patch by Jeffrey
2899 2900 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2900 2901 speed up this routine.
2901 2902
2902 2903 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2903 2904 don't know if this is the end of it, but the behavior now is
2904 2905 certainly much more correct. Note that coupled with macros,
2905 2906 slightly surprising (at first) behavior may occur: a macro will in
2906 2907 general expand to multiple lines of input, so upon exiting, the
2907 2908 in/out counters will both be bumped by the corresponding amount
2908 2909 (as if the macro's contents had been typed interactively). Typing
2909 2910 %hist will reveal the intermediate (silently processed) lines.
2910 2911
2911 2912 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2912 2913 pickle to fail (%run was overwriting __main__ and not restoring
2913 2914 it, but pickle relies on __main__ to operate).
2914 2915
2915 2916 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2916 2917 using properties, but forgot to make the main InteractiveShell
2917 2918 class a new-style class. Properties fail silently, and
2918 2919 mysteriously, with old-style class (getters work, but
2919 2920 setters don't do anything).
2920 2921
2921 2922 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2922 2923
2923 2924 * IPython/Magic.py (magic_history): fix history reporting bug (I
2924 2925 know some nasties are still there, I just can't seem to find a
2925 2926 reproducible test case to track them down; the input history is
2926 2927 falling out of sync...)
2927 2928
2928 2929 * IPython/iplib.py (handle_shell_escape): fix bug where both
2929 2930 aliases and system accesses where broken for indented code (such
2930 2931 as loops).
2931 2932
2932 2933 * IPython/genutils.py (shell): fix small but critical bug for
2933 2934 win32 system access.
2934 2935
2935 2936 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2936 2937
2937 2938 * IPython/iplib.py (showtraceback): remove use of the
2938 2939 sys.last_{type/value/traceback} structures, which are non
2939 2940 thread-safe.
2940 2941 (_prefilter): change control flow to ensure that we NEVER
2941 2942 introspect objects when autocall is off. This will guarantee that
2942 2943 having an input line of the form 'x.y', where access to attribute
2943 2944 'y' has side effects, doesn't trigger the side effect TWICE. It
2944 2945 is important to note that, with autocall on, these side effects
2945 2946 can still happen.
2946 2947 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2947 2948 trio. IPython offers these three kinds of special calls which are
2948 2949 not python code, and it's a good thing to have their call method
2949 2950 be accessible as pure python functions (not just special syntax at
2950 2951 the command line). It gives us a better internal implementation
2951 2952 structure, as well as exposing these for user scripting more
2952 2953 cleanly.
2953 2954
2954 2955 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2955 2956 file. Now that they'll be more likely to be used with the
2956 2957 persistance system (%store), I want to make sure their module path
2957 2958 doesn't change in the future, so that we don't break things for
2958 2959 users' persisted data.
2959 2960
2960 2961 * IPython/iplib.py (autoindent_update): move indentation
2961 2962 management into the _text_ processing loop, not the keyboard
2962 2963 interactive one. This is necessary to correctly process non-typed
2963 2964 multiline input (such as macros).
2964 2965
2965 2966 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2966 2967 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2967 2968 which was producing problems in the resulting manual.
2968 2969 (magic_whos): improve reporting of instances (show their class,
2969 2970 instead of simply printing 'instance' which isn't terribly
2970 2971 informative).
2971 2972
2972 2973 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2973 2974 (minor mods) to support network shares under win32.
2974 2975
2975 2976 * IPython/winconsole.py (get_console_size): add new winconsole
2976 2977 module and fixes to page_dumb() to improve its behavior under
2977 2978 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2978 2979
2979 2980 * IPython/Magic.py (Macro): simplified Macro class to just
2980 2981 subclass list. We've had only 2.2 compatibility for a very long
2981 2982 time, yet I was still avoiding subclassing the builtin types. No
2982 2983 more (I'm also starting to use properties, though I won't shift to
2983 2984 2.3-specific features quite yet).
2984 2985 (magic_store): added Ville's patch for lightweight variable
2985 2986 persistence, after a request on the user list by Matt Wilkie
2986 2987 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2987 2988 details.
2988 2989
2989 2990 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2990 2991 changed the default logfile name from 'ipython.log' to
2991 2992 'ipython_log.py'. These logs are real python files, and now that
2992 2993 we have much better multiline support, people are more likely to
2993 2994 want to use them as such. Might as well name them correctly.
2994 2995
2995 2996 * IPython/Magic.py: substantial cleanup. While we can't stop
2996 2997 using magics as mixins, due to the existing customizations 'out
2997 2998 there' which rely on the mixin naming conventions, at least I
2998 2999 cleaned out all cross-class name usage. So once we are OK with
2999 3000 breaking compatibility, the two systems can be separated.
3000 3001
3001 3002 * IPython/Logger.py: major cleanup. This one is NOT a mixin
3002 3003 anymore, and the class is a fair bit less hideous as well. New
3003 3004 features were also introduced: timestamping of input, and logging
3004 3005 of output results. These are user-visible with the -t and -o
3005 3006 options to %logstart. Closes
3006 3007 http://www.scipy.net/roundup/ipython/issue11 and a request by
3007 3008 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
3008 3009
3009 3010 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
3010 3011
3011 3012 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
3012 3013 better handle backslashes in paths. See the thread 'More Windows
3013 3014 questions part 2 - \/ characters revisited' on the iypthon user
3014 3015 list:
3015 3016 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
3016 3017
3017 3018 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
3018 3019
3019 3020 (InteractiveShell.__init__): change threaded shells to not use the
3020 3021 ipython crash handler. This was causing more problems than not,
3021 3022 as exceptions in the main thread (GUI code, typically) would
3022 3023 always show up as a 'crash', when they really weren't.
3023 3024
3024 3025 The colors and exception mode commands (%colors/%xmode) have been
3025 3026 synchronized to also take this into account, so users can get
3026 3027 verbose exceptions for their threaded code as well. I also added
3027 3028 support for activating pdb inside this exception handler as well,
3028 3029 so now GUI authors can use IPython's enhanced pdb at runtime.
3029 3030
3030 3031 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
3031 3032 true by default, and add it to the shipped ipythonrc file. Since
3032 3033 this asks the user before proceeding, I think it's OK to make it
3033 3034 true by default.
3034 3035
3035 3036 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
3036 3037 of the previous special-casing of input in the eval loop. I think
3037 3038 this is cleaner, as they really are commands and shouldn't have
3038 3039 a special role in the middle of the core code.
3039 3040
3040 3041 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
3041 3042
3042 3043 * IPython/iplib.py (edit_syntax_error): added support for
3043 3044 automatically reopening the editor if the file had a syntax error
3044 3045 in it. Thanks to scottt who provided the patch at:
3045 3046 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
3046 3047 version committed).
3047 3048
3048 3049 * IPython/iplib.py (handle_normal): add suport for multi-line
3049 3050 input with emtpy lines. This fixes
3050 3051 http://www.scipy.net/roundup/ipython/issue43 and a similar
3051 3052 discussion on the user list.
3052 3053
3053 3054 WARNING: a behavior change is necessarily introduced to support
3054 3055 blank lines: now a single blank line with whitespace does NOT
3055 3056 break the input loop, which means that when autoindent is on, by
3056 3057 default hitting return on the next (indented) line does NOT exit.
3057 3058
3058 3059 Instead, to exit a multiline input you can either have:
3059 3060
3060 3061 - TWO whitespace lines (just hit return again), or
3061 3062 - a single whitespace line of a different length than provided
3062 3063 by the autoindent (add or remove a space).
3063 3064
3064 3065 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
3065 3066 module to better organize all readline-related functionality.
3066 3067 I've deleted FlexCompleter and put all completion clases here.
3067 3068
3068 3069 * IPython/iplib.py (raw_input): improve indentation management.
3069 3070 It is now possible to paste indented code with autoindent on, and
3070 3071 the code is interpreted correctly (though it still looks bad on
3071 3072 screen, due to the line-oriented nature of ipython).
3072 3073 (MagicCompleter.complete): change behavior so that a TAB key on an
3073 3074 otherwise empty line actually inserts a tab, instead of completing
3074 3075 on the entire global namespace. This makes it easier to use the
3075 3076 TAB key for indentation. After a request by Hans Meine
3076 3077 <hans_meine-AT-gmx.net>
3077 3078 (_prefilter): add support so that typing plain 'exit' or 'quit'
3078 3079 does a sensible thing. Originally I tried to deviate as little as
3079 3080 possible from the default python behavior, but even that one may
3080 3081 change in this direction (thread on python-dev to that effect).
3081 3082 Regardless, ipython should do the right thing even if CPython's
3082 3083 '>>>' prompt doesn't.
3083 3084 (InteractiveShell): removed subclassing code.InteractiveConsole
3084 3085 class. By now we'd overridden just about all of its methods: I've
3085 3086 copied the remaining two over, and now ipython is a standalone
3086 3087 class. This will provide a clearer picture for the chainsaw
3087 3088 branch refactoring.
3088 3089
3089 3090 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
3090 3091
3091 3092 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
3092 3093 failures for objects which break when dir() is called on them.
3093 3094
3094 3095 * IPython/FlexCompleter.py (Completer.__init__): Added support for
3095 3096 distinct local and global namespaces in the completer API. This
3096 3097 change allows us to properly handle completion with distinct
3097 3098 scopes, including in embedded instances (this had never really
3098 3099 worked correctly).
3099 3100
3100 3101 Note: this introduces a change in the constructor for
3101 3102 MagicCompleter, as a new global_namespace parameter is now the
3102 3103 second argument (the others were bumped one position).
3103 3104
3104 3105 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
3105 3106
3106 3107 * IPython/iplib.py (embed_mainloop): fix tab-completion in
3107 3108 embedded instances (which can be done now thanks to Vivian's
3108 3109 frame-handling fixes for pdb).
3109 3110 (InteractiveShell.__init__): Fix namespace handling problem in
3110 3111 embedded instances. We were overwriting __main__ unconditionally,
3111 3112 and this should only be done for 'full' (non-embedded) IPython;
3112 3113 embedded instances must respect the caller's __main__. Thanks to
3113 3114 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
3114 3115
3115 3116 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
3116 3117
3117 3118 * setup.py: added download_url to setup(). This registers the
3118 3119 download address at PyPI, which is not only useful to humans
3119 3120 browsing the site, but is also picked up by setuptools (the Eggs
3120 3121 machinery). Thanks to Ville and R. Kern for the info/discussion
3121 3122 on this.
3122 3123
3123 3124 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
3124 3125
3125 3126 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
3126 3127 This brings a lot of nice functionality to the pdb mode, which now
3127 3128 has tab-completion, syntax highlighting, and better stack handling
3128 3129 than before. Many thanks to Vivian De Smedt
3129 3130 <vivian-AT-vdesmedt.com> for the original patches.
3130 3131
3131 3132 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
3132 3133
3133 3134 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
3134 3135 sequence to consistently accept the banner argument. The
3135 3136 inconsistency was tripping SAGE, thanks to Gary Zablackis
3136 3137 <gzabl-AT-yahoo.com> for the report.
3137 3138
3138 3139 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
3139 3140
3140 3141 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3141 3142 Fix bug where a naked 'alias' call in the ipythonrc file would
3142 3143 cause a crash. Bug reported by Jorgen Stenarson.
3143 3144
3144 3145 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
3145 3146
3146 3147 * IPython/ipmaker.py (make_IPython): cleanups which should improve
3147 3148 startup time.
3148 3149
3149 3150 * IPython/iplib.py (runcode): my globals 'fix' for embedded
3150 3151 instances had introduced a bug with globals in normal code. Now
3151 3152 it's working in all cases.
3152 3153
3153 3154 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
3154 3155 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
3155 3156 has been introduced to set the default case sensitivity of the
3156 3157 searches. Users can still select either mode at runtime on a
3157 3158 per-search basis.
3158 3159
3159 3160 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
3160 3161
3161 3162 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
3162 3163 attributes in wildcard searches for subclasses. Modified version
3163 3164 of a patch by Jorgen.
3164 3165
3165 3166 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
3166 3167
3167 3168 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
3168 3169 embedded instances. I added a user_global_ns attribute to the
3169 3170 InteractiveShell class to handle this.
3170 3171
3171 3172 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
3172 3173
3173 3174 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
3174 3175 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
3175 3176 (reported under win32, but may happen also in other platforms).
3176 3177 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
3177 3178
3178 3179 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
3179 3180
3180 3181 * IPython/Magic.py (magic_psearch): new support for wildcard
3181 3182 patterns. Now, typing ?a*b will list all names which begin with a
3182 3183 and end in b, for example. The %psearch magic has full
3183 3184 docstrings. Many thanks to JΓΆrgen Stenarson
3184 3185 <jorgen.stenarson-AT-bostream.nu>, author of the patches
3185 3186 implementing this functionality.
3186 3187
3187 3188 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
3188 3189
3189 3190 * Manual: fixed long-standing annoyance of double-dashes (as in
3190 3191 --prefix=~, for example) being stripped in the HTML version. This
3191 3192 is a latex2html bug, but a workaround was provided. Many thanks
3192 3193 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
3193 3194 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
3194 3195 rolling. This seemingly small issue had tripped a number of users
3195 3196 when first installing, so I'm glad to see it gone.
3196 3197
3197 3198 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
3198 3199
3199 3200 * IPython/Extensions/numeric_formats.py: fix missing import,
3200 3201 reported by Stephen Walton.
3201 3202
3202 3203 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
3203 3204
3204 3205 * IPython/demo.py: finish demo module, fully documented now.
3205 3206
3206 3207 * IPython/genutils.py (file_read): simple little utility to read a
3207 3208 file and ensure it's closed afterwards.
3208 3209
3209 3210 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
3210 3211
3211 3212 * IPython/demo.py (Demo.__init__): added support for individually
3212 3213 tagging blocks for automatic execution.
3213 3214
3214 3215 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
3215 3216 syntax-highlighted python sources, requested by John.
3216 3217
3217 3218 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
3218 3219
3219 3220 * IPython/demo.py (Demo.again): fix bug where again() blocks after
3220 3221 finishing.
3221 3222
3222 3223 * IPython/genutils.py (shlex_split): moved from Magic to here,
3223 3224 where all 2.2 compatibility stuff lives. I needed it for demo.py.
3224 3225
3225 3226 * IPython/demo.py (Demo.__init__): added support for silent
3226 3227 blocks, improved marks as regexps, docstrings written.
3227 3228 (Demo.__init__): better docstring, added support for sys.argv.
3228 3229
3229 3230 * IPython/genutils.py (marquee): little utility used by the demo
3230 3231 code, handy in general.
3231 3232
3232 3233 * IPython/demo.py (Demo.__init__): new class for interactive
3233 3234 demos. Not documented yet, I just wrote it in a hurry for
3234 3235 scipy'05. Will docstring later.
3235 3236
3236 3237 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
3237 3238
3238 3239 * IPython/Shell.py (sigint_handler): Drastic simplification which
3239 3240 also seems to make Ctrl-C work correctly across threads! This is
3240 3241 so simple, that I can't beleive I'd missed it before. Needs more
3241 3242 testing, though.
3242 3243 (KBINT): Never mind, revert changes. I'm sure I'd tried something
3243 3244 like this before...
3244 3245
3245 3246 * IPython/genutils.py (get_home_dir): add protection against
3246 3247 non-dirs in win32 registry.
3247 3248
3248 3249 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
3249 3250 bug where dict was mutated while iterating (pysh crash).
3250 3251
3251 3252 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
3252 3253
3253 3254 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
3254 3255 spurious newlines added by this routine. After a report by
3255 3256 F. Mantegazza.
3256 3257
3257 3258 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
3258 3259
3259 3260 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
3260 3261 calls. These were a leftover from the GTK 1.x days, and can cause
3261 3262 problems in certain cases (after a report by John Hunter).
3262 3263
3263 3264 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
3264 3265 os.getcwd() fails at init time. Thanks to patch from David Remahl
3265 3266 <chmod007-AT-mac.com>.
3266 3267 (InteractiveShell.__init__): prevent certain special magics from
3267 3268 being shadowed by aliases. Closes
3268 3269 http://www.scipy.net/roundup/ipython/issue41.
3269 3270
3270 3271 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
3271 3272
3272 3273 * IPython/iplib.py (InteractiveShell.complete): Added new
3273 3274 top-level completion method to expose the completion mechanism
3274 3275 beyond readline-based environments.
3275 3276
3276 3277 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
3277 3278
3278 3279 * tools/ipsvnc (svnversion): fix svnversion capture.
3279 3280
3280 3281 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
3281 3282 attribute to self, which was missing. Before, it was set by a
3282 3283 routine which in certain cases wasn't being called, so the
3283 3284 instance could end up missing the attribute. This caused a crash.
3284 3285 Closes http://www.scipy.net/roundup/ipython/issue40.
3285 3286
3286 3287 2005-08-16 Fernando Perez <fperez@colorado.edu>
3287 3288
3288 3289 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
3289 3290 contains non-string attribute. Closes
3290 3291 http://www.scipy.net/roundup/ipython/issue38.
3291 3292
3292 3293 2005-08-14 Fernando Perez <fperez@colorado.edu>
3293 3294
3294 3295 * tools/ipsvnc: Minor improvements, to add changeset info.
3295 3296
3296 3297 2005-08-12 Fernando Perez <fperez@colorado.edu>
3297 3298
3298 3299 * IPython/iplib.py (runsource): remove self.code_to_run_src
3299 3300 attribute. I realized this is nothing more than
3300 3301 '\n'.join(self.buffer), and having the same data in two different
3301 3302 places is just asking for synchronization bugs. This may impact
3302 3303 people who have custom exception handlers, so I need to warn
3303 3304 ipython-dev about it (F. Mantegazza may use them).
3304 3305
3305 3306 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
3306 3307
3307 3308 * IPython/genutils.py: fix 2.2 compatibility (generators)
3308 3309
3309 3310 2005-07-18 Fernando Perez <fperez@colorado.edu>
3310 3311
3311 3312 * IPython/genutils.py (get_home_dir): fix to help users with
3312 3313 invalid $HOME under win32.
3313 3314
3314 3315 2005-07-17 Fernando Perez <fperez@colorado.edu>
3315 3316
3316 3317 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
3317 3318 some old hacks and clean up a bit other routines; code should be
3318 3319 simpler and a bit faster.
3319 3320
3320 3321 * IPython/iplib.py (interact): removed some last-resort attempts
3321 3322 to survive broken stdout/stderr. That code was only making it
3322 3323 harder to abstract out the i/o (necessary for gui integration),
3323 3324 and the crashes it could prevent were extremely rare in practice
3324 3325 (besides being fully user-induced in a pretty violent manner).
3325 3326
3326 3327 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
3327 3328 Nothing major yet, but the code is simpler to read; this should
3328 3329 make it easier to do more serious modifications in the future.
3329 3330
3330 3331 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
3331 3332 which broke in .15 (thanks to a report by Ville).
3332 3333
3333 3334 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
3334 3335 be quite correct, I know next to nothing about unicode). This
3335 3336 will allow unicode strings to be used in prompts, amongst other
3336 3337 cases. It also will prevent ipython from crashing when unicode
3337 3338 shows up unexpectedly in many places. If ascii encoding fails, we
3338 3339 assume utf_8. Currently the encoding is not a user-visible
3339 3340 setting, though it could be made so if there is demand for it.
3340 3341
3341 3342 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
3342 3343
3343 3344 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
3344 3345
3345 3346 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
3346 3347
3347 3348 * IPython/genutils.py: Add 2.2 compatibility here, so all other
3348 3349 code can work transparently for 2.2/2.3.
3349 3350
3350 3351 2005-07-16 Fernando Perez <fperez@colorado.edu>
3351 3352
3352 3353 * IPython/ultraTB.py (ExceptionColors): Make a global variable
3353 3354 out of the color scheme table used for coloring exception
3354 3355 tracebacks. This allows user code to add new schemes at runtime.
3355 3356 This is a minimally modified version of the patch at
3356 3357 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
3357 3358 for the contribution.
3358 3359
3359 3360 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
3360 3361 slightly modified version of the patch in
3361 3362 http://www.scipy.net/roundup/ipython/issue34, which also allows me
3362 3363 to remove the previous try/except solution (which was costlier).
3363 3364 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
3364 3365
3365 3366 2005-06-08 Fernando Perez <fperez@colorado.edu>
3366 3367
3367 3368 * IPython/iplib.py (write/write_err): Add methods to abstract all
3368 3369 I/O a bit more.
3369 3370
3370 3371 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3371 3372 warning, reported by Aric Hagberg, fix by JD Hunter.
3372 3373
3373 3374 2005-06-02 *** Released version 0.6.15
3374 3375
3375 3376 2005-06-01 Fernando Perez <fperez@colorado.edu>
3376 3377
3377 3378 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3378 3379 tab-completion of filenames within open-quoted strings. Note that
3379 3380 this requires that in ~/.ipython/ipythonrc, users change the
3380 3381 readline delimiters configuration to read:
3381 3382
3382 3383 readline_remove_delims -/~
3383 3384
3384 3385
3385 3386 2005-05-31 *** Released version 0.6.14
3386 3387
3387 3388 2005-05-29 Fernando Perez <fperez@colorado.edu>
3388 3389
3389 3390 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3390 3391 with files not on the filesystem. Reported by Eliyahu Sandler
3391 3392 <eli@gondolin.net>
3392 3393
3393 3394 2005-05-22 Fernando Perez <fperez@colorado.edu>
3394 3395
3395 3396 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3396 3397 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3397 3398
3398 3399 2005-05-19 Fernando Perez <fperez@colorado.edu>
3399 3400
3400 3401 * IPython/iplib.py (safe_execfile): close a file which could be
3401 3402 left open (causing problems in win32, which locks open files).
3402 3403 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3403 3404
3404 3405 2005-05-18 Fernando Perez <fperez@colorado.edu>
3405 3406
3406 3407 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3407 3408 keyword arguments correctly to safe_execfile().
3408 3409
3409 3410 2005-05-13 Fernando Perez <fperez@colorado.edu>
3410 3411
3411 3412 * ipython.1: Added info about Qt to manpage, and threads warning
3412 3413 to usage page (invoked with --help).
3413 3414
3414 3415 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3415 3416 new matcher (it goes at the end of the priority list) to do
3416 3417 tab-completion on named function arguments. Submitted by George
3417 3418 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3418 3419 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3419 3420 for more details.
3420 3421
3421 3422 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3422 3423 SystemExit exceptions in the script being run. Thanks to a report
3423 3424 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3424 3425 producing very annoying behavior when running unit tests.
3425 3426
3426 3427 2005-05-12 Fernando Perez <fperez@colorado.edu>
3427 3428
3428 3429 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3429 3430 which I'd broken (again) due to a changed regexp. In the process,
3430 3431 added ';' as an escape to auto-quote the whole line without
3431 3432 splitting its arguments. Thanks to a report by Jerry McRae
3432 3433 <qrs0xyc02-AT-sneakemail.com>.
3433 3434
3434 3435 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3435 3436 possible crashes caused by a TokenError. Reported by Ed Schofield
3436 3437 <schofield-AT-ftw.at>.
3437 3438
3438 3439 2005-05-06 Fernando Perez <fperez@colorado.edu>
3439 3440
3440 3441 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3441 3442
3442 3443 2005-04-29 Fernando Perez <fperez@colorado.edu>
3443 3444
3444 3445 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3445 3446 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3446 3447 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3447 3448 which provides support for Qt interactive usage (similar to the
3448 3449 existing one for WX and GTK). This had been often requested.
3449 3450
3450 3451 2005-04-14 *** Released version 0.6.13
3451 3452
3452 3453 2005-04-08 Fernando Perez <fperez@colorado.edu>
3453 3454
3454 3455 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3455 3456 from _ofind, which gets called on almost every input line. Now,
3456 3457 we only try to get docstrings if they are actually going to be
3457 3458 used (the overhead of fetching unnecessary docstrings can be
3458 3459 noticeable for certain objects, such as Pyro proxies).
3459 3460
3460 3461 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3461 3462 for completers. For some reason I had been passing them the state
3462 3463 variable, which completers never actually need, and was in
3463 3464 conflict with the rlcompleter API. Custom completers ONLY need to
3464 3465 take the text parameter.
3465 3466
3466 3467 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3467 3468 work correctly in pysh. I've also moved all the logic which used
3468 3469 to be in pysh.py here, which will prevent problems with future
3469 3470 upgrades. However, this time I must warn users to update their
3470 3471 pysh profile to include the line
3471 3472
3472 3473 import_all IPython.Extensions.InterpreterExec
3473 3474
3474 3475 because otherwise things won't work for them. They MUST also
3475 3476 delete pysh.py and the line
3476 3477
3477 3478 execfile pysh.py
3478 3479
3479 3480 from their ipythonrc-pysh.
3480 3481
3481 3482 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3482 3483 robust in the face of objects whose dir() returns non-strings
3483 3484 (which it shouldn't, but some broken libs like ITK do). Thanks to
3484 3485 a patch by John Hunter (implemented differently, though). Also
3485 3486 minor improvements by using .extend instead of + on lists.
3486 3487
3487 3488 * pysh.py:
3488 3489
3489 3490 2005-04-06 Fernando Perez <fperez@colorado.edu>
3490 3491
3491 3492 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3492 3493 by default, so that all users benefit from it. Those who don't
3493 3494 want it can still turn it off.
3494 3495
3495 3496 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3496 3497 config file, I'd forgotten about this, so users were getting it
3497 3498 off by default.
3498 3499
3499 3500 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3500 3501 consistency. Now magics can be called in multiline statements,
3501 3502 and python variables can be expanded in magic calls via $var.
3502 3503 This makes the magic system behave just like aliases or !system
3503 3504 calls.
3504 3505
3505 3506 2005-03-28 Fernando Perez <fperez@colorado.edu>
3506 3507
3507 3508 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3508 3509 expensive string additions for building command. Add support for
3509 3510 trailing ';' when autocall is used.
3510 3511
3511 3512 2005-03-26 Fernando Perez <fperez@colorado.edu>
3512 3513
3513 3514 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3514 3515 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3515 3516 ipython.el robust against prompts with any number of spaces
3516 3517 (including 0) after the ':' character.
3517 3518
3518 3519 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3519 3520 continuation prompt, which misled users to think the line was
3520 3521 already indented. Closes debian Bug#300847, reported to me by
3521 3522 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3522 3523
3523 3524 2005-03-23 Fernando Perez <fperez@colorado.edu>
3524 3525
3525 3526 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3526 3527 properly aligned if they have embedded newlines.
3527 3528
3528 3529 * IPython/iplib.py (runlines): Add a public method to expose
3529 3530 IPython's code execution machinery, so that users can run strings
3530 3531 as if they had been typed at the prompt interactively.
3531 3532 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3532 3533 methods which can call the system shell, but with python variable
3533 3534 expansion. The three such methods are: __IPYTHON__.system,
3534 3535 .getoutput and .getoutputerror. These need to be documented in a
3535 3536 'public API' section (to be written) of the manual.
3536 3537
3537 3538 2005-03-20 Fernando Perez <fperez@colorado.edu>
3538 3539
3539 3540 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3540 3541 for custom exception handling. This is quite powerful, and it
3541 3542 allows for user-installable exception handlers which can trap
3542 3543 custom exceptions at runtime and treat them separately from
3543 3544 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3544 3545 Mantegazza <mantegazza-AT-ill.fr>.
3545 3546 (InteractiveShell.set_custom_completer): public API function to
3546 3547 add new completers at runtime.
3547 3548
3548 3549 2005-03-19 Fernando Perez <fperez@colorado.edu>
3549 3550
3550 3551 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3551 3552 allow objects which provide their docstrings via non-standard
3552 3553 mechanisms (like Pyro proxies) to still be inspected by ipython's
3553 3554 ? system.
3554 3555
3555 3556 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3556 3557 automatic capture system. I tried quite hard to make it work
3557 3558 reliably, and simply failed. I tried many combinations with the
3558 3559 subprocess module, but eventually nothing worked in all needed
3559 3560 cases (not blocking stdin for the child, duplicating stdout
3560 3561 without blocking, etc). The new %sc/%sx still do capture to these
3561 3562 magical list/string objects which make shell use much more
3562 3563 conveninent, so not all is lost.
3563 3564
3564 3565 XXX - FIX MANUAL for the change above!
3565 3566
3566 3567 (runsource): I copied code.py's runsource() into ipython to modify
3567 3568 it a bit. Now the code object and source to be executed are
3568 3569 stored in ipython. This makes this info accessible to third-party
3569 3570 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3570 3571 Mantegazza <mantegazza-AT-ill.fr>.
3571 3572
3572 3573 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3573 3574 history-search via readline (like C-p/C-n). I'd wanted this for a
3574 3575 long time, but only recently found out how to do it. For users
3575 3576 who already have their ipythonrc files made and want this, just
3576 3577 add:
3577 3578
3578 3579 readline_parse_and_bind "\e[A": history-search-backward
3579 3580 readline_parse_and_bind "\e[B": history-search-forward
3580 3581
3581 3582 2005-03-18 Fernando Perez <fperez@colorado.edu>
3582 3583
3583 3584 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3584 3585 LSString and SList classes which allow transparent conversions
3585 3586 between list mode and whitespace-separated string.
3586 3587 (magic_r): Fix recursion problem in %r.
3587 3588
3588 3589 * IPython/genutils.py (LSString): New class to be used for
3589 3590 automatic storage of the results of all alias/system calls in _o
3590 3591 and _e (stdout/err). These provide a .l/.list attribute which
3591 3592 does automatic splitting on newlines. This means that for most
3592 3593 uses, you'll never need to do capturing of output with %sc/%sx
3593 3594 anymore, since ipython keeps this always done for you. Note that
3594 3595 only the LAST results are stored, the _o/e variables are
3595 3596 overwritten on each call. If you need to save their contents
3596 3597 further, simply bind them to any other name.
3597 3598
3598 3599 2005-03-17 Fernando Perez <fperez@colorado.edu>
3599 3600
3600 3601 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3601 3602 prompt namespace handling.
3602 3603
3603 3604 2005-03-16 Fernando Perez <fperez@colorado.edu>
3604 3605
3605 3606 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3606 3607 classic prompts to be '>>> ' (final space was missing, and it
3607 3608 trips the emacs python mode).
3608 3609 (BasePrompt.__str__): Added safe support for dynamic prompt
3609 3610 strings. Now you can set your prompt string to be '$x', and the
3610 3611 value of x will be printed from your interactive namespace. The
3611 3612 interpolation syntax includes the full Itpl support, so
3612 3613 ${foo()+x+bar()} is a valid prompt string now, and the function
3613 3614 calls will be made at runtime.
3614 3615
3615 3616 2005-03-15 Fernando Perez <fperez@colorado.edu>
3616 3617
3617 3618 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3618 3619 avoid name clashes in pylab. %hist still works, it just forwards
3619 3620 the call to %history.
3620 3621
3621 3622 2005-03-02 *** Released version 0.6.12
3622 3623
3623 3624 2005-03-02 Fernando Perez <fperez@colorado.edu>
3624 3625
3625 3626 * IPython/iplib.py (handle_magic): log magic calls properly as
3626 3627 ipmagic() function calls.
3627 3628
3628 3629 * IPython/Magic.py (magic_time): Improved %time to support
3629 3630 statements and provide wall-clock as well as CPU time.
3630 3631
3631 3632 2005-02-27 Fernando Perez <fperez@colorado.edu>
3632 3633
3633 3634 * IPython/hooks.py: New hooks module, to expose user-modifiable
3634 3635 IPython functionality in a clean manner. For now only the editor
3635 3636 hook is actually written, and other thigns which I intend to turn
3636 3637 into proper hooks aren't yet there. The display and prefilter
3637 3638 stuff, for example, should be hooks. But at least now the
3638 3639 framework is in place, and the rest can be moved here with more
3639 3640 time later. IPython had had a .hooks variable for a long time for
3640 3641 this purpose, but I'd never actually used it for anything.
3641 3642
3642 3643 2005-02-26 Fernando Perez <fperez@colorado.edu>
3643 3644
3644 3645 * IPython/ipmaker.py (make_IPython): make the default ipython
3645 3646 directory be called _ipython under win32, to follow more the
3646 3647 naming peculiarities of that platform (where buggy software like
3647 3648 Visual Sourcesafe breaks with .named directories). Reported by
3648 3649 Ville Vainio.
3649 3650
3650 3651 2005-02-23 Fernando Perez <fperez@colorado.edu>
3651 3652
3652 3653 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3653 3654 auto_aliases for win32 which were causing problems. Users can
3654 3655 define the ones they personally like.
3655 3656
3656 3657 2005-02-21 Fernando Perez <fperez@colorado.edu>
3657 3658
3658 3659 * IPython/Magic.py (magic_time): new magic to time execution of
3659 3660 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3660 3661
3661 3662 2005-02-19 Fernando Perez <fperez@colorado.edu>
3662 3663
3663 3664 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3664 3665 into keys (for prompts, for example).
3665 3666
3666 3667 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3667 3668 prompts in case users want them. This introduces a small behavior
3668 3669 change: ipython does not automatically add a space to all prompts
3669 3670 anymore. To get the old prompts with a space, users should add it
3670 3671 manually to their ipythonrc file, so for example prompt_in1 should
3671 3672 now read 'In [\#]: ' instead of 'In [\#]:'.
3672 3673 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3673 3674 file) to control left-padding of secondary prompts.
3674 3675
3675 3676 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3676 3677 the profiler can't be imported. Fix for Debian, which removed
3677 3678 profile.py because of License issues. I applied a slightly
3678 3679 modified version of the original Debian patch at
3679 3680 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3680 3681
3681 3682 2005-02-17 Fernando Perez <fperez@colorado.edu>
3682 3683
3683 3684 * IPython/genutils.py (native_line_ends): Fix bug which would
3684 3685 cause improper line-ends under win32 b/c I was not opening files
3685 3686 in binary mode. Bug report and fix thanks to Ville.
3686 3687
3687 3688 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3688 3689 trying to catch spurious foo[1] autocalls. My fix actually broke
3689 3690 ',/' autoquote/call with explicit escape (bad regexp).
3690 3691
3691 3692 2005-02-15 *** Released version 0.6.11
3692 3693
3693 3694 2005-02-14 Fernando Perez <fperez@colorado.edu>
3694 3695
3695 3696 * IPython/background_jobs.py: New background job management
3696 3697 subsystem. This is implemented via a new set of classes, and
3697 3698 IPython now provides a builtin 'jobs' object for background job
3698 3699 execution. A convenience %bg magic serves as a lightweight
3699 3700 frontend for starting the more common type of calls. This was
3700 3701 inspired by discussions with B. Granger and the BackgroundCommand
3701 3702 class described in the book Python Scripting for Computational
3702 3703 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3703 3704 (although ultimately no code from this text was used, as IPython's
3704 3705 system is a separate implementation).
3705 3706
3706 3707 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3707 3708 to control the completion of single/double underscore names
3708 3709 separately. As documented in the example ipytonrc file, the
3709 3710 readline_omit__names variable can now be set to 2, to omit even
3710 3711 single underscore names. Thanks to a patch by Brian Wong
3711 3712 <BrianWong-AT-AirgoNetworks.Com>.
3712 3713 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3713 3714 be autocalled as foo([1]) if foo were callable. A problem for
3714 3715 things which are both callable and implement __getitem__.
3715 3716 (init_readline): Fix autoindentation for win32. Thanks to a patch
3716 3717 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3717 3718
3718 3719 2005-02-12 Fernando Perez <fperez@colorado.edu>
3719 3720
3720 3721 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3721 3722 which I had written long ago to sort out user error messages which
3722 3723 may occur during startup. This seemed like a good idea initially,
3723 3724 but it has proven a disaster in retrospect. I don't want to
3724 3725 change much code for now, so my fix is to set the internal 'debug'
3725 3726 flag to true everywhere, whose only job was precisely to control
3726 3727 this subsystem. This closes issue 28 (as well as avoiding all
3727 3728 sorts of strange hangups which occur from time to time).
3728 3729
3729 3730 2005-02-07 Fernando Perez <fperez@colorado.edu>
3730 3731
3731 3732 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3732 3733 previous call produced a syntax error.
3733 3734
3734 3735 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3735 3736 classes without constructor.
3736 3737
3737 3738 2005-02-06 Fernando Perez <fperez@colorado.edu>
3738 3739
3739 3740 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3740 3741 completions with the results of each matcher, so we return results
3741 3742 to the user from all namespaces. This breaks with ipython
3742 3743 tradition, but I think it's a nicer behavior. Now you get all
3743 3744 possible completions listed, from all possible namespaces (python,
3744 3745 filesystem, magics...) After a request by John Hunter
3745 3746 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3746 3747
3747 3748 2005-02-05 Fernando Perez <fperez@colorado.edu>
3748 3749
3749 3750 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3750 3751 the call had quote characters in it (the quotes were stripped).
3751 3752
3752 3753 2005-01-31 Fernando Perez <fperez@colorado.edu>
3753 3754
3754 3755 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3755 3756 Itpl.itpl() to make the code more robust against psyco
3756 3757 optimizations.
3757 3758
3758 3759 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3759 3760 of causing an exception. Quicker, cleaner.
3760 3761
3761 3762 2005-01-28 Fernando Perez <fperez@colorado.edu>
3762 3763
3763 3764 * scripts/ipython_win_post_install.py (install): hardcode
3764 3765 sys.prefix+'python.exe' as the executable path. It turns out that
3765 3766 during the post-installation run, sys.executable resolves to the
3766 3767 name of the binary installer! I should report this as a distutils
3767 3768 bug, I think. I updated the .10 release with this tiny fix, to
3768 3769 avoid annoying the lists further.
3769 3770
3770 3771 2005-01-27 *** Released version 0.6.10
3771 3772
3772 3773 2005-01-27 Fernando Perez <fperez@colorado.edu>
3773 3774
3774 3775 * IPython/numutils.py (norm): Added 'inf' as optional name for
3775 3776 L-infinity norm, included references to mathworld.com for vector
3776 3777 norm definitions.
3777 3778 (amin/amax): added amin/amax for array min/max. Similar to what
3778 3779 pylab ships with after the recent reorganization of names.
3779 3780 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3780 3781
3781 3782 * ipython.el: committed Alex's recent fixes and improvements.
3782 3783 Tested with python-mode from CVS, and it looks excellent. Since
3783 3784 python-mode hasn't released anything in a while, I'm temporarily
3784 3785 putting a copy of today's CVS (v 4.70) of python-mode in:
3785 3786 http://ipython.scipy.org/tmp/python-mode.el
3786 3787
3787 3788 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3788 3789 sys.executable for the executable name, instead of assuming it's
3789 3790 called 'python.exe' (the post-installer would have produced broken
3790 3791 setups on systems with a differently named python binary).
3791 3792
3792 3793 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3793 3794 references to os.linesep, to make the code more
3794 3795 platform-independent. This is also part of the win32 coloring
3795 3796 fixes.
3796 3797
3797 3798 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3798 3799 lines, which actually cause coloring bugs because the length of
3799 3800 the line is very difficult to correctly compute with embedded
3800 3801 escapes. This was the source of all the coloring problems under
3801 3802 Win32. I think that _finally_, Win32 users have a properly
3802 3803 working ipython in all respects. This would never have happened
3803 3804 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3804 3805
3805 3806 2005-01-26 *** Released version 0.6.9
3806 3807
3807 3808 2005-01-25 Fernando Perez <fperez@colorado.edu>
3808 3809
3809 3810 * setup.py: finally, we have a true Windows installer, thanks to
3810 3811 the excellent work of Viktor Ransmayr
3811 3812 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3812 3813 Windows users. The setup routine is quite a bit cleaner thanks to
3813 3814 this, and the post-install script uses the proper functions to
3814 3815 allow a clean de-installation using the standard Windows Control
3815 3816 Panel.
3816 3817
3817 3818 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3818 3819 environment variable under all OSes (including win32) if
3819 3820 available. This will give consistency to win32 users who have set
3820 3821 this variable for any reason. If os.environ['HOME'] fails, the
3821 3822 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3822 3823
3823 3824 2005-01-24 Fernando Perez <fperez@colorado.edu>
3824 3825
3825 3826 * IPython/numutils.py (empty_like): add empty_like(), similar to
3826 3827 zeros_like() but taking advantage of the new empty() Numeric routine.
3827 3828
3828 3829 2005-01-23 *** Released version 0.6.8
3829 3830
3830 3831 2005-01-22 Fernando Perez <fperez@colorado.edu>
3831 3832
3832 3833 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3833 3834 automatic show() calls. After discussing things with JDH, it
3834 3835 turns out there are too many corner cases where this can go wrong.
3835 3836 It's best not to try to be 'too smart', and simply have ipython
3836 3837 reproduce as much as possible the default behavior of a normal
3837 3838 python shell.
3838 3839
3839 3840 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3840 3841 line-splitting regexp and _prefilter() to avoid calling getattr()
3841 3842 on assignments. This closes
3842 3843 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3843 3844 readline uses getattr(), so a simple <TAB> keypress is still
3844 3845 enough to trigger getattr() calls on an object.
3845 3846
3846 3847 2005-01-21 Fernando Perez <fperez@colorado.edu>
3847 3848
3848 3849 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3849 3850 docstring under pylab so it doesn't mask the original.
3850 3851
3851 3852 2005-01-21 *** Released version 0.6.7
3852 3853
3853 3854 2005-01-21 Fernando Perez <fperez@colorado.edu>
3854 3855
3855 3856 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3856 3857 signal handling for win32 users in multithreaded mode.
3857 3858
3858 3859 2005-01-17 Fernando Perez <fperez@colorado.edu>
3859 3860
3860 3861 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3861 3862 instances with no __init__. After a crash report by Norbert Nemec
3862 3863 <Norbert-AT-nemec-online.de>.
3863 3864
3864 3865 2005-01-14 Fernando Perez <fperez@colorado.edu>
3865 3866
3866 3867 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3867 3868 names for verbose exceptions, when multiple dotted names and the
3868 3869 'parent' object were present on the same line.
3869 3870
3870 3871 2005-01-11 Fernando Perez <fperez@colorado.edu>
3871 3872
3872 3873 * IPython/genutils.py (flag_calls): new utility to trap and flag
3873 3874 calls in functions. I need it to clean up matplotlib support.
3874 3875 Also removed some deprecated code in genutils.
3875 3876
3876 3877 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3877 3878 that matplotlib scripts called with %run, which don't call show()
3878 3879 themselves, still have their plotting windows open.
3879 3880
3880 3881 2005-01-05 Fernando Perez <fperez@colorado.edu>
3881 3882
3882 3883 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3883 3884 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3884 3885
3885 3886 2004-12-19 Fernando Perez <fperez@colorado.edu>
3886 3887
3887 3888 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3888 3889 parent_runcode, which was an eyesore. The same result can be
3889 3890 obtained with Python's regular superclass mechanisms.
3890 3891
3891 3892 2004-12-17 Fernando Perez <fperez@colorado.edu>
3892 3893
3893 3894 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3894 3895 reported by Prabhu.
3895 3896 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3896 3897 sys.stderr) instead of explicitly calling sys.stderr. This helps
3897 3898 maintain our I/O abstractions clean, for future GUI embeddings.
3898 3899
3899 3900 * IPython/genutils.py (info): added new utility for sys.stderr
3900 3901 unified info message handling (thin wrapper around warn()).
3901 3902
3902 3903 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3903 3904 composite (dotted) names on verbose exceptions.
3904 3905 (VerboseTB.nullrepr): harden against another kind of errors which
3905 3906 Python's inspect module can trigger, and which were crashing
3906 3907 IPython. Thanks to a report by Marco Lombardi
3907 3908 <mlombard-AT-ma010192.hq.eso.org>.
3908 3909
3909 3910 2004-12-13 *** Released version 0.6.6
3910 3911
3911 3912 2004-12-12 Fernando Perez <fperez@colorado.edu>
3912 3913
3913 3914 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3914 3915 generated by pygtk upon initialization if it was built without
3915 3916 threads (for matplotlib users). After a crash reported by
3916 3917 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3917 3918
3918 3919 * IPython/ipmaker.py (make_IPython): fix small bug in the
3919 3920 import_some parameter for multiple imports.
3920 3921
3921 3922 * IPython/iplib.py (ipmagic): simplified the interface of
3922 3923 ipmagic() to take a single string argument, just as it would be
3923 3924 typed at the IPython cmd line.
3924 3925 (ipalias): Added new ipalias() with an interface identical to
3925 3926 ipmagic(). This completes exposing a pure python interface to the
3926 3927 alias and magic system, which can be used in loops or more complex
3927 3928 code where IPython's automatic line mangling is not active.
3928 3929
3929 3930 * IPython/genutils.py (timing): changed interface of timing to
3930 3931 simply run code once, which is the most common case. timings()
3931 3932 remains unchanged, for the cases where you want multiple runs.
3932 3933
3933 3934 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3934 3935 bug where Python2.2 crashes with exec'ing code which does not end
3935 3936 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3936 3937 before.
3937 3938
3938 3939 2004-12-10 Fernando Perez <fperez@colorado.edu>
3939 3940
3940 3941 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3941 3942 -t to -T, to accomodate the new -t flag in %run (the %run and
3942 3943 %prun options are kind of intermixed, and it's not easy to change
3943 3944 this with the limitations of python's getopt).
3944 3945
3945 3946 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3946 3947 the execution of scripts. It's not as fine-tuned as timeit.py,
3947 3948 but it works from inside ipython (and under 2.2, which lacks
3948 3949 timeit.py). Optionally a number of runs > 1 can be given for
3949 3950 timing very short-running code.
3950 3951
3951 3952 * IPython/genutils.py (uniq_stable): new routine which returns a
3952 3953 list of unique elements in any iterable, but in stable order of
3953 3954 appearance. I needed this for the ultraTB fixes, and it's a handy
3954 3955 utility.
3955 3956
3956 3957 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3957 3958 dotted names in Verbose exceptions. This had been broken since
3958 3959 the very start, now x.y will properly be printed in a Verbose
3959 3960 traceback, instead of x being shown and y appearing always as an
3960 3961 'undefined global'. Getting this to work was a bit tricky,
3961 3962 because by default python tokenizers are stateless. Saved by
3962 3963 python's ability to easily add a bit of state to an arbitrary
3963 3964 function (without needing to build a full-blown callable object).
3964 3965
3965 3966 Also big cleanup of this code, which had horrendous runtime
3966 3967 lookups of zillions of attributes for colorization. Moved all
3967 3968 this code into a few templates, which make it cleaner and quicker.
3968 3969
3969 3970 Printout quality was also improved for Verbose exceptions: one
3970 3971 variable per line, and memory addresses are printed (this can be
3971 3972 quite handy in nasty debugging situations, which is what Verbose
3972 3973 is for).
3973 3974
3974 3975 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3975 3976 the command line as scripts to be loaded by embedded instances.
3976 3977 Doing so has the potential for an infinite recursion if there are
3977 3978 exceptions thrown in the process. This fixes a strange crash
3978 3979 reported by Philippe MULLER <muller-AT-irit.fr>.
3979 3980
3980 3981 2004-12-09 Fernando Perez <fperez@colorado.edu>
3981 3982
3982 3983 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3983 3984 to reflect new names in matplotlib, which now expose the
3984 3985 matlab-compatible interface via a pylab module instead of the
3985 3986 'matlab' name. The new code is backwards compatible, so users of
3986 3987 all matplotlib versions are OK. Patch by J. Hunter.
3987 3988
3988 3989 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3989 3990 of __init__ docstrings for instances (class docstrings are already
3990 3991 automatically printed). Instances with customized docstrings
3991 3992 (indep. of the class) are also recognized and all 3 separate
3992 3993 docstrings are printed (instance, class, constructor). After some
3993 3994 comments/suggestions by J. Hunter.
3994 3995
3995 3996 2004-12-05 Fernando Perez <fperez@colorado.edu>
3996 3997
3997 3998 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3998 3999 warnings when tab-completion fails and triggers an exception.
3999 4000
4000 4001 2004-12-03 Fernando Perez <fperez@colorado.edu>
4001 4002
4002 4003 * IPython/Magic.py (magic_prun): Fix bug where an exception would
4003 4004 be triggered when using 'run -p'. An incorrect option flag was
4004 4005 being set ('d' instead of 'D').
4005 4006 (manpage): fix missing escaped \- sign.
4006 4007
4007 4008 2004-11-30 *** Released version 0.6.5
4008 4009
4009 4010 2004-11-30 Fernando Perez <fperez@colorado.edu>
4010 4011
4011 4012 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
4012 4013 setting with -d option.
4013 4014
4014 4015 * setup.py (docfiles): Fix problem where the doc glob I was using
4015 4016 was COMPLETELY BROKEN. It was giving the right files by pure
4016 4017 accident, but failed once I tried to include ipython.el. Note:
4017 4018 glob() does NOT allow you to do exclusion on multiple endings!
4018 4019
4019 4020 2004-11-29 Fernando Perez <fperez@colorado.edu>
4020 4021
4021 4022 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
4022 4023 the manpage as the source. Better formatting & consistency.
4023 4024
4024 4025 * IPython/Magic.py (magic_run): Added new -d option, to run
4025 4026 scripts under the control of the python pdb debugger. Note that
4026 4027 this required changing the %prun option -d to -D, to avoid a clash
4027 4028 (since %run must pass options to %prun, and getopt is too dumb to
4028 4029 handle options with string values with embedded spaces). Thanks
4029 4030 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
4030 4031 (magic_who_ls): added type matching to %who and %whos, so that one
4031 4032 can filter their output to only include variables of certain
4032 4033 types. Another suggestion by Matthew.
4033 4034 (magic_whos): Added memory summaries in kb and Mb for arrays.
4034 4035 (magic_who): Improve formatting (break lines every 9 vars).
4035 4036
4036 4037 2004-11-28 Fernando Perez <fperez@colorado.edu>
4037 4038
4038 4039 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
4039 4040 cache when empty lines were present.
4040 4041
4041 4042 2004-11-24 Fernando Perez <fperez@colorado.edu>
4042 4043
4043 4044 * IPython/usage.py (__doc__): document the re-activated threading
4044 4045 options for WX and GTK.
4045 4046
4046 4047 2004-11-23 Fernando Perez <fperez@colorado.edu>
4047 4048
4048 4049 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
4049 4050 the -wthread and -gthread options, along with a new -tk one to try
4050 4051 and coordinate Tk threading with wx/gtk. The tk support is very
4051 4052 platform dependent, since it seems to require Tcl and Tk to be
4052 4053 built with threads (Fedora1/2 appears NOT to have it, but in
4053 4054 Prabhu's Debian boxes it works OK). But even with some Tk
4054 4055 limitations, this is a great improvement.
4055 4056
4056 4057 * IPython/Prompts.py (prompt_specials_color): Added \t for time
4057 4058 info in user prompts. Patch by Prabhu.
4058 4059
4059 4060 2004-11-18 Fernando Perez <fperez@colorado.edu>
4060 4061
4061 4062 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
4062 4063 EOFErrors and bail, to avoid infinite loops if a non-terminating
4063 4064 file is fed into ipython. Patch submitted in issue 19 by user,
4064 4065 many thanks.
4065 4066
4066 4067 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
4067 4068 autoquote/parens in continuation prompts, which can cause lots of
4068 4069 problems. Closes roundup issue 20.
4069 4070
4070 4071 2004-11-17 Fernando Perez <fperez@colorado.edu>
4071 4072
4072 4073 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
4073 4074 reported as debian bug #280505. I'm not sure my local changelog
4074 4075 entry has the proper debian format (Jack?).
4075 4076
4076 4077 2004-11-08 *** Released version 0.6.4
4077 4078
4078 4079 2004-11-08 Fernando Perez <fperez@colorado.edu>
4079 4080
4080 4081 * IPython/iplib.py (init_readline): Fix exit message for Windows
4081 4082 when readline is active. Thanks to a report by Eric Jones
4082 4083 <eric-AT-enthought.com>.
4083 4084
4084 4085 2004-11-07 Fernando Perez <fperez@colorado.edu>
4085 4086
4086 4087 * IPython/genutils.py (page): Add a trap for OSError exceptions,
4087 4088 sometimes seen by win2k/cygwin users.
4088 4089
4089 4090 2004-11-06 Fernando Perez <fperez@colorado.edu>
4090 4091
4091 4092 * IPython/iplib.py (interact): Change the handling of %Exit from
4092 4093 trying to propagate a SystemExit to an internal ipython flag.
4093 4094 This is less elegant than using Python's exception mechanism, but
4094 4095 I can't get that to work reliably with threads, so under -pylab
4095 4096 %Exit was hanging IPython. Cross-thread exception handling is
4096 4097 really a bitch. Thaks to a bug report by Stephen Walton
4097 4098 <stephen.walton-AT-csun.edu>.
4098 4099
4099 4100 2004-11-04 Fernando Perez <fperez@colorado.edu>
4100 4101
4101 4102 * IPython/iplib.py (raw_input_original): store a pointer to the
4102 4103 true raw_input to harden against code which can modify it
4103 4104 (wx.py.PyShell does this and would otherwise crash ipython).
4104 4105 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
4105 4106
4106 4107 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
4107 4108 Ctrl-C problem, which does not mess up the input line.
4108 4109
4109 4110 2004-11-03 Fernando Perez <fperez@colorado.edu>
4110 4111
4111 4112 * IPython/Release.py: Changed licensing to BSD, in all files.
4112 4113 (name): lowercase name for tarball/RPM release.
4113 4114
4114 4115 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
4115 4116 use throughout ipython.
4116 4117
4117 4118 * IPython/Magic.py (Magic._ofind): Switch to using the new
4118 4119 OInspect.getdoc() function.
4119 4120
4120 4121 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
4121 4122 of the line currently being canceled via Ctrl-C. It's extremely
4122 4123 ugly, but I don't know how to do it better (the problem is one of
4123 4124 handling cross-thread exceptions).
4124 4125
4125 4126 2004-10-28 Fernando Perez <fperez@colorado.edu>
4126 4127
4127 4128 * IPython/Shell.py (signal_handler): add signal handlers to trap
4128 4129 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
4129 4130 report by Francesc Alted.
4130 4131
4131 4132 2004-10-21 Fernando Perez <fperez@colorado.edu>
4132 4133
4133 4134 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
4134 4135 to % for pysh syntax extensions.
4135 4136
4136 4137 2004-10-09 Fernando Perez <fperez@colorado.edu>
4137 4138
4138 4139 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
4139 4140 arrays to print a more useful summary, without calling str(arr).
4140 4141 This avoids the problem of extremely lengthy computations which
4141 4142 occur if arr is large, and appear to the user as a system lockup
4142 4143 with 100% cpu activity. After a suggestion by Kristian Sandberg
4143 4144 <Kristian.Sandberg@colorado.edu>.
4144 4145 (Magic.__init__): fix bug in global magic escapes not being
4145 4146 correctly set.
4146 4147
4147 4148 2004-10-08 Fernando Perez <fperez@colorado.edu>
4148 4149
4149 4150 * IPython/Magic.py (__license__): change to absolute imports of
4150 4151 ipython's own internal packages, to start adapting to the absolute
4151 4152 import requirement of PEP-328.
4152 4153
4153 4154 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
4154 4155 files, and standardize author/license marks through the Release
4155 4156 module instead of having per/file stuff (except for files with
4156 4157 particular licenses, like the MIT/PSF-licensed codes).
4157 4158
4158 4159 * IPython/Debugger.py: remove dead code for python 2.1
4159 4160
4160 4161 2004-10-04 Fernando Perez <fperez@colorado.edu>
4161 4162
4162 4163 * IPython/iplib.py (ipmagic): New function for accessing magics
4163 4164 via a normal python function call.
4164 4165
4165 4166 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
4166 4167 from '@' to '%', to accomodate the new @decorator syntax of python
4167 4168 2.4.
4168 4169
4169 4170 2004-09-29 Fernando Perez <fperez@colorado.edu>
4170 4171
4171 4172 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
4172 4173 matplotlib.use to prevent running scripts which try to switch
4173 4174 interactive backends from within ipython. This will just crash
4174 4175 the python interpreter, so we can't allow it (but a detailed error
4175 4176 is given to the user).
4176 4177
4177 4178 2004-09-28 Fernando Perez <fperez@colorado.edu>
4178 4179
4179 4180 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
4180 4181 matplotlib-related fixes so that using @run with non-matplotlib
4181 4182 scripts doesn't pop up spurious plot windows. This requires
4182 4183 matplotlib >= 0.63, where I had to make some changes as well.
4183 4184
4184 4185 * IPython/ipmaker.py (make_IPython): update version requirement to
4185 4186 python 2.2.
4186 4187
4187 4188 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
4188 4189 banner arg for embedded customization.
4189 4190
4190 4191 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
4191 4192 explicit uses of __IP as the IPython's instance name. Now things
4192 4193 are properly handled via the shell.name value. The actual code
4193 4194 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
4194 4195 is much better than before. I'll clean things completely when the
4195 4196 magic stuff gets a real overhaul.
4196 4197
4197 4198 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
4198 4199 minor changes to debian dir.
4199 4200
4200 4201 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
4201 4202 pointer to the shell itself in the interactive namespace even when
4202 4203 a user-supplied dict is provided. This is needed for embedding
4203 4204 purposes (found by tests with Michel Sanner).
4204 4205
4205 4206 2004-09-27 Fernando Perez <fperez@colorado.edu>
4206 4207
4207 4208 * IPython/UserConfig/ipythonrc: remove []{} from
4208 4209 readline_remove_delims, so that things like [modname.<TAB> do
4209 4210 proper completion. This disables [].TAB, but that's a less common
4210 4211 case than module names in list comprehensions, for example.
4211 4212 Thanks to a report by Andrea Riciputi.
4212 4213
4213 4214 2004-09-09 Fernando Perez <fperez@colorado.edu>
4214 4215
4215 4216 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
4216 4217 blocking problems in win32 and osx. Fix by John.
4217 4218
4218 4219 2004-09-08 Fernando Perez <fperez@colorado.edu>
4219 4220
4220 4221 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
4221 4222 for Win32 and OSX. Fix by John Hunter.
4222 4223
4223 4224 2004-08-30 *** Released version 0.6.3
4224 4225
4225 4226 2004-08-30 Fernando Perez <fperez@colorado.edu>
4226 4227
4227 4228 * setup.py (isfile): Add manpages to list of dependent files to be
4228 4229 updated.
4229 4230
4230 4231 2004-08-27 Fernando Perez <fperez@colorado.edu>
4231 4232
4232 4233 * IPython/Shell.py (start): I've disabled -wthread and -gthread
4233 4234 for now. They don't really work with standalone WX/GTK code
4234 4235 (though matplotlib IS working fine with both of those backends).
4235 4236 This will neeed much more testing. I disabled most things with
4236 4237 comments, so turning it back on later should be pretty easy.
4237 4238
4238 4239 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
4239 4240 autocalling of expressions like r'foo', by modifying the line
4240 4241 split regexp. Closes
4241 4242 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
4242 4243 Riley <ipythonbugs-AT-sabi.net>.
4243 4244 (InteractiveShell.mainloop): honor --nobanner with banner
4244 4245 extensions.
4245 4246
4246 4247 * IPython/Shell.py: Significant refactoring of all classes, so
4247 4248 that we can really support ALL matplotlib backends and threading
4248 4249 models (John spotted a bug with Tk which required this). Now we
4249 4250 should support single-threaded, WX-threads and GTK-threads, both
4250 4251 for generic code and for matplotlib.
4251 4252
4252 4253 * IPython/ipmaker.py (__call__): Changed -mpthread option to
4253 4254 -pylab, to simplify things for users. Will also remove the pylab
4254 4255 profile, since now all of matplotlib configuration is directly
4255 4256 handled here. This also reduces startup time.
4256 4257
4257 4258 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
4258 4259 shell wasn't being correctly called. Also in IPShellWX.
4259 4260
4260 4261 * IPython/iplib.py (InteractiveShell.__init__): Added option to
4261 4262 fine-tune banner.
4262 4263
4263 4264 * IPython/numutils.py (spike): Deprecate these spike functions,
4264 4265 delete (long deprecated) gnuplot_exec handler.
4265 4266
4266 4267 2004-08-26 Fernando Perez <fperez@colorado.edu>
4267 4268
4268 4269 * ipython.1: Update for threading options, plus some others which
4269 4270 were missing.
4270 4271
4271 4272 * IPython/ipmaker.py (__call__): Added -wthread option for
4272 4273 wxpython thread handling. Make sure threading options are only
4273 4274 valid at the command line.
4274 4275
4275 4276 * scripts/ipython: moved shell selection into a factory function
4276 4277 in Shell.py, to keep the starter script to a minimum.
4277 4278
4278 4279 2004-08-25 Fernando Perez <fperez@colorado.edu>
4279 4280
4280 4281 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
4281 4282 John. Along with some recent changes he made to matplotlib, the
4282 4283 next versions of both systems should work very well together.
4283 4284
4284 4285 2004-08-24 Fernando Perez <fperez@colorado.edu>
4285 4286
4286 4287 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
4287 4288 tried to switch the profiling to using hotshot, but I'm getting
4288 4289 strange errors from prof.runctx() there. I may be misreading the
4289 4290 docs, but it looks weird. For now the profiling code will
4290 4291 continue to use the standard profiler.
4291 4292
4292 4293 2004-08-23 Fernando Perez <fperez@colorado.edu>
4293 4294
4294 4295 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
4295 4296 threaded shell, by John Hunter. It's not quite ready yet, but
4296 4297 close.
4297 4298
4298 4299 2004-08-22 Fernando Perez <fperez@colorado.edu>
4299 4300
4300 4301 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
4301 4302 in Magic and ultraTB.
4302 4303
4303 4304 * ipython.1: document threading options in manpage.
4304 4305
4305 4306 * scripts/ipython: Changed name of -thread option to -gthread,
4306 4307 since this is GTK specific. I want to leave the door open for a
4307 4308 -wthread option for WX, which will most likely be necessary. This
4308 4309 change affects usage and ipmaker as well.
4309 4310
4310 4311 * IPython/Shell.py (matplotlib_shell): Add a factory function to
4311 4312 handle the matplotlib shell issues. Code by John Hunter
4312 4313 <jdhunter-AT-nitace.bsd.uchicago.edu>.
4313 4314 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
4314 4315 broken (and disabled for end users) for now, but it puts the
4315 4316 infrastructure in place.
4316 4317
4317 4318 2004-08-21 Fernando Perez <fperez@colorado.edu>
4318 4319
4319 4320 * ipythonrc-pylab: Add matplotlib support.
4320 4321
4321 4322 * matplotlib_config.py: new files for matplotlib support, part of
4322 4323 the pylab profile.
4323 4324
4324 4325 * IPython/usage.py (__doc__): documented the threading options.
4325 4326
4326 4327 2004-08-20 Fernando Perez <fperez@colorado.edu>
4327 4328
4328 4329 * ipython: Modified the main calling routine to handle the -thread
4329 4330 and -mpthread options. This needs to be done as a top-level hack,
4330 4331 because it determines which class to instantiate for IPython
4331 4332 itself.
4332 4333
4333 4334 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
4334 4335 classes to support multithreaded GTK operation without blocking,
4335 4336 and matplotlib with all backends. This is a lot of still very
4336 4337 experimental code, and threads are tricky. So it may still have a
4337 4338 few rough edges... This code owes a lot to
4338 4339 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
4339 4340 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
4340 4341 to John Hunter for all the matplotlib work.
4341 4342
4342 4343 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
4343 4344 options for gtk thread and matplotlib support.
4344 4345
4345 4346 2004-08-16 Fernando Perez <fperez@colorado.edu>
4346 4347
4347 4348 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
4348 4349 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
4349 4350 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
4350 4351
4351 4352 2004-08-11 Fernando Perez <fperez@colorado.edu>
4352 4353
4353 4354 * setup.py (isfile): Fix build so documentation gets updated for
4354 4355 rpms (it was only done for .tgz builds).
4355 4356
4356 4357 2004-08-10 Fernando Perez <fperez@colorado.edu>
4357 4358
4358 4359 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
4359 4360
4360 4361 * iplib.py : Silence syntax error exceptions in tab-completion.
4361 4362
4362 4363 2004-08-05 Fernando Perez <fperez@colorado.edu>
4363 4364
4364 4365 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
4365 4366 'color off' mark for continuation prompts. This was causing long
4366 4367 continuation lines to mis-wrap.
4367 4368
4368 4369 2004-08-01 Fernando Perez <fperez@colorado.edu>
4369 4370
4370 4371 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4371 4372 for building ipython to be a parameter. All this is necessary
4372 4373 right now to have a multithreaded version, but this insane
4373 4374 non-design will be cleaned up soon. For now, it's a hack that
4374 4375 works.
4375 4376
4376 4377 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4377 4378 args in various places. No bugs so far, but it's a dangerous
4378 4379 practice.
4379 4380
4380 4381 2004-07-31 Fernando Perez <fperez@colorado.edu>
4381 4382
4382 4383 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4383 4384 fix completion of files with dots in their names under most
4384 4385 profiles (pysh was OK because the completion order is different).
4385 4386
4386 4387 2004-07-27 Fernando Perez <fperez@colorado.edu>
4387 4388
4388 4389 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4389 4390 keywords manually, b/c the one in keyword.py was removed in python
4390 4391 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4391 4392 This is NOT a bug under python 2.3 and earlier.
4392 4393
4393 4394 2004-07-26 Fernando Perez <fperez@colorado.edu>
4394 4395
4395 4396 * IPython/ultraTB.py (VerboseTB.text): Add another
4396 4397 linecache.checkcache() call to try to prevent inspect.py from
4397 4398 crashing under python 2.3. I think this fixes
4398 4399 http://www.scipy.net/roundup/ipython/issue17.
4399 4400
4400 4401 2004-07-26 *** Released version 0.6.2
4401 4402
4402 4403 2004-07-26 Fernando Perez <fperez@colorado.edu>
4403 4404
4404 4405 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4405 4406 fail for any number.
4406 4407 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4407 4408 empty bookmarks.
4408 4409
4409 4410 2004-07-26 *** Released version 0.6.1
4410 4411
4411 4412 2004-07-26 Fernando Perez <fperez@colorado.edu>
4412 4413
4413 4414 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4414 4415
4415 4416 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4416 4417 escaping '()[]{}' in filenames.
4417 4418
4418 4419 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4419 4420 Python 2.2 users who lack a proper shlex.split.
4420 4421
4421 4422 2004-07-19 Fernando Perez <fperez@colorado.edu>
4422 4423
4423 4424 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4424 4425 for reading readline's init file. I follow the normal chain:
4425 4426 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4426 4427 report by Mike Heeter. This closes
4427 4428 http://www.scipy.net/roundup/ipython/issue16.
4428 4429
4429 4430 2004-07-18 Fernando Perez <fperez@colorado.edu>
4430 4431
4431 4432 * IPython/iplib.py (__init__): Add better handling of '\' under
4432 4433 Win32 for filenames. After a patch by Ville.
4433 4434
4434 4435 2004-07-17 Fernando Perez <fperez@colorado.edu>
4435 4436
4436 4437 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4437 4438 autocalling would be triggered for 'foo is bar' if foo is
4438 4439 callable. I also cleaned up the autocall detection code to use a
4439 4440 regexp, which is faster. Bug reported by Alexander Schmolck.
4440 4441
4441 4442 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4442 4443 '?' in them would confuse the help system. Reported by Alex
4443 4444 Schmolck.
4444 4445
4445 4446 2004-07-16 Fernando Perez <fperez@colorado.edu>
4446 4447
4447 4448 * IPython/GnuplotInteractive.py (__all__): added plot2.
4448 4449
4449 4450 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4450 4451 plotting dictionaries, lists or tuples of 1d arrays.
4451 4452
4452 4453 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4453 4454 optimizations.
4454 4455
4455 4456 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4456 4457 the information which was there from Janko's original IPP code:
4457 4458
4458 4459 03.05.99 20:53 porto.ifm.uni-kiel.de
4459 4460 --Started changelog.
4460 4461 --make clear do what it say it does
4461 4462 --added pretty output of lines from inputcache
4462 4463 --Made Logger a mixin class, simplifies handling of switches
4463 4464 --Added own completer class. .string<TAB> expands to last history
4464 4465 line which starts with string. The new expansion is also present
4465 4466 with Ctrl-r from the readline library. But this shows, who this
4466 4467 can be done for other cases.
4467 4468 --Added convention that all shell functions should accept a
4468 4469 parameter_string This opens the door for different behaviour for
4469 4470 each function. @cd is a good example of this.
4470 4471
4471 4472 04.05.99 12:12 porto.ifm.uni-kiel.de
4472 4473 --added logfile rotation
4473 4474 --added new mainloop method which freezes first the namespace
4474 4475
4475 4476 07.05.99 21:24 porto.ifm.uni-kiel.de
4476 4477 --added the docreader classes. Now there is a help system.
4477 4478 -This is only a first try. Currently it's not easy to put new
4478 4479 stuff in the indices. But this is the way to go. Info would be
4479 4480 better, but HTML is every where and not everybody has an info
4480 4481 system installed and it's not so easy to change html-docs to info.
4481 4482 --added global logfile option
4482 4483 --there is now a hook for object inspection method pinfo needs to
4483 4484 be provided for this. Can be reached by two '??'.
4484 4485
4485 4486 08.05.99 20:51 porto.ifm.uni-kiel.de
4486 4487 --added a README
4487 4488 --bug in rc file. Something has changed so functions in the rc
4488 4489 file need to reference the shell and not self. Not clear if it's a
4489 4490 bug or feature.
4490 4491 --changed rc file for new behavior
4491 4492
4492 4493 2004-07-15 Fernando Perez <fperez@colorado.edu>
4493 4494
4494 4495 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4495 4496 cache was falling out of sync in bizarre manners when multi-line
4496 4497 input was present. Minor optimizations and cleanup.
4497 4498
4498 4499 (Logger): Remove old Changelog info for cleanup. This is the
4499 4500 information which was there from Janko's original code:
4500 4501
4501 4502 Changes to Logger: - made the default log filename a parameter
4502 4503
4503 4504 - put a check for lines beginning with !@? in log(). Needed
4504 4505 (even if the handlers properly log their lines) for mid-session
4505 4506 logging activation to work properly. Without this, lines logged
4506 4507 in mid session, which get read from the cache, would end up
4507 4508 'bare' (with !@? in the open) in the log. Now they are caught
4508 4509 and prepended with a #.
4509 4510
4510 4511 * IPython/iplib.py (InteractiveShell.init_readline): added check
4511 4512 in case MagicCompleter fails to be defined, so we don't crash.
4512 4513
4513 4514 2004-07-13 Fernando Perez <fperez@colorado.edu>
4514 4515
4515 4516 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4516 4517 of EPS if the requested filename ends in '.eps'.
4517 4518
4518 4519 2004-07-04 Fernando Perez <fperez@colorado.edu>
4519 4520
4520 4521 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4521 4522 escaping of quotes when calling the shell.
4522 4523
4523 4524 2004-07-02 Fernando Perez <fperez@colorado.edu>
4524 4525
4525 4526 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4526 4527 gettext not working because we were clobbering '_'. Fixes
4527 4528 http://www.scipy.net/roundup/ipython/issue6.
4528 4529
4529 4530 2004-07-01 Fernando Perez <fperez@colorado.edu>
4530 4531
4531 4532 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4532 4533 into @cd. Patch by Ville.
4533 4534
4534 4535 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4535 4536 new function to store things after ipmaker runs. Patch by Ville.
4536 4537 Eventually this will go away once ipmaker is removed and the class
4537 4538 gets cleaned up, but for now it's ok. Key functionality here is
4538 4539 the addition of the persistent storage mechanism, a dict for
4539 4540 keeping data across sessions (for now just bookmarks, but more can
4540 4541 be implemented later).
4541 4542
4542 4543 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4543 4544 persistent across sections. Patch by Ville, I modified it
4544 4545 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4545 4546 added a '-l' option to list all bookmarks.
4546 4547
4547 4548 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4548 4549 center for cleanup. Registered with atexit.register(). I moved
4549 4550 here the old exit_cleanup(). After a patch by Ville.
4550 4551
4551 4552 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4552 4553 characters in the hacked shlex_split for python 2.2.
4553 4554
4554 4555 * IPython/iplib.py (file_matches): more fixes to filenames with
4555 4556 whitespace in them. It's not perfect, but limitations in python's
4556 4557 readline make it impossible to go further.
4557 4558
4558 4559 2004-06-29 Fernando Perez <fperez@colorado.edu>
4559 4560
4560 4561 * IPython/iplib.py (file_matches): escape whitespace correctly in
4561 4562 filename completions. Bug reported by Ville.
4562 4563
4563 4564 2004-06-28 Fernando Perez <fperez@colorado.edu>
4564 4565
4565 4566 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4566 4567 the history file will be called 'history-PROFNAME' (or just
4567 4568 'history' if no profile is loaded). I was getting annoyed at
4568 4569 getting my Numerical work history clobbered by pysh sessions.
4569 4570
4570 4571 * IPython/iplib.py (InteractiveShell.__init__): Internal
4571 4572 getoutputerror() function so that we can honor the system_verbose
4572 4573 flag for _all_ system calls. I also added escaping of #
4573 4574 characters here to avoid confusing Itpl.
4574 4575
4575 4576 * IPython/Magic.py (shlex_split): removed call to shell in
4576 4577 parse_options and replaced it with shlex.split(). The annoying
4577 4578 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4578 4579 to backport it from 2.3, with several frail hacks (the shlex
4579 4580 module is rather limited in 2.2). Thanks to a suggestion by Ville
4580 4581 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4581 4582 problem.
4582 4583
4583 4584 (Magic.magic_system_verbose): new toggle to print the actual
4584 4585 system calls made by ipython. Mainly for debugging purposes.
4585 4586
4586 4587 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4587 4588 doesn't support persistence. Reported (and fix suggested) by
4588 4589 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4589 4590
4590 4591 2004-06-26 Fernando Perez <fperez@colorado.edu>
4591 4592
4592 4593 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4593 4594 continue prompts.
4594 4595
4595 4596 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4596 4597 function (basically a big docstring) and a few more things here to
4597 4598 speedup startup. pysh.py is now very lightweight. We want because
4598 4599 it gets execfile'd, while InterpreterExec gets imported, so
4599 4600 byte-compilation saves time.
4600 4601
4601 4602 2004-06-25 Fernando Perez <fperez@colorado.edu>
4602 4603
4603 4604 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4604 4605 -NUM', which was recently broken.
4605 4606
4606 4607 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4607 4608 in multi-line input (but not !!, which doesn't make sense there).
4608 4609
4609 4610 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4610 4611 It's just too useful, and people can turn it off in the less
4611 4612 common cases where it's a problem.
4612 4613
4613 4614 2004-06-24 Fernando Perez <fperez@colorado.edu>
4614 4615
4615 4616 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4616 4617 special syntaxes (like alias calling) is now allied in multi-line
4617 4618 input. This is still _very_ experimental, but it's necessary for
4618 4619 efficient shell usage combining python looping syntax with system
4619 4620 calls. For now it's restricted to aliases, I don't think it
4620 4621 really even makes sense to have this for magics.
4621 4622
4622 4623 2004-06-23 Fernando Perez <fperez@colorado.edu>
4623 4624
4624 4625 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4625 4626 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4626 4627
4627 4628 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4628 4629 extensions under Windows (after code sent by Gary Bishop). The
4629 4630 extensions considered 'executable' are stored in IPython's rc
4630 4631 structure as win_exec_ext.
4631 4632
4632 4633 * IPython/genutils.py (shell): new function, like system() but
4633 4634 without return value. Very useful for interactive shell work.
4634 4635
4635 4636 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4636 4637 delete aliases.
4637 4638
4638 4639 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4639 4640 sure that the alias table doesn't contain python keywords.
4640 4641
4641 4642 2004-06-21 Fernando Perez <fperez@colorado.edu>
4642 4643
4643 4644 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4644 4645 non-existent items are found in $PATH. Reported by Thorsten.
4645 4646
4646 4647 2004-06-20 Fernando Perez <fperez@colorado.edu>
4647 4648
4648 4649 * IPython/iplib.py (complete): modified the completer so that the
4649 4650 order of priorities can be easily changed at runtime.
4650 4651
4651 4652 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4652 4653 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4653 4654
4654 4655 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4655 4656 expand Python variables prepended with $ in all system calls. The
4656 4657 same was done to InteractiveShell.handle_shell_escape. Now all
4657 4658 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4658 4659 expansion of python variables and expressions according to the
4659 4660 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4660 4661
4661 4662 Though PEP-215 has been rejected, a similar (but simpler) one
4662 4663 seems like it will go into Python 2.4, PEP-292 -
4663 4664 http://www.python.org/peps/pep-0292.html.
4664 4665
4665 4666 I'll keep the full syntax of PEP-215, since IPython has since the
4666 4667 start used Ka-Ping Yee's reference implementation discussed there
4667 4668 (Itpl), and I actually like the powerful semantics it offers.
4668 4669
4669 4670 In order to access normal shell variables, the $ has to be escaped
4670 4671 via an extra $. For example:
4671 4672
4672 4673 In [7]: PATH='a python variable'
4673 4674
4674 4675 In [8]: !echo $PATH
4675 4676 a python variable
4676 4677
4677 4678 In [9]: !echo $$PATH
4678 4679 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4679 4680
4680 4681 (Magic.parse_options): escape $ so the shell doesn't evaluate
4681 4682 things prematurely.
4682 4683
4683 4684 * IPython/iplib.py (InteractiveShell.call_alias): added the
4684 4685 ability for aliases to expand python variables via $.
4685 4686
4686 4687 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4687 4688 system, now there's a @rehash/@rehashx pair of magics. These work
4688 4689 like the csh rehash command, and can be invoked at any time. They
4689 4690 build a table of aliases to everything in the user's $PATH
4690 4691 (@rehash uses everything, @rehashx is slower but only adds
4691 4692 executable files). With this, the pysh.py-based shell profile can
4692 4693 now simply call rehash upon startup, and full access to all
4693 4694 programs in the user's path is obtained.
4694 4695
4695 4696 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4696 4697 functionality is now fully in place. I removed the old dynamic
4697 4698 code generation based approach, in favor of a much lighter one
4698 4699 based on a simple dict. The advantage is that this allows me to
4699 4700 now have thousands of aliases with negligible cost (unthinkable
4700 4701 with the old system).
4701 4702
4702 4703 2004-06-19 Fernando Perez <fperez@colorado.edu>
4703 4704
4704 4705 * IPython/iplib.py (__init__): extended MagicCompleter class to
4705 4706 also complete (last in priority) on user aliases.
4706 4707
4707 4708 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4708 4709 call to eval.
4709 4710 (ItplNS.__init__): Added a new class which functions like Itpl,
4710 4711 but allows configuring the namespace for the evaluation to occur
4711 4712 in.
4712 4713
4713 4714 2004-06-18 Fernando Perez <fperez@colorado.edu>
4714 4715
4715 4716 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4716 4717 better message when 'exit' or 'quit' are typed (a common newbie
4717 4718 confusion).
4718 4719
4719 4720 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4720 4721 check for Windows users.
4721 4722
4722 4723 * IPython/iplib.py (InteractiveShell.user_setup): removed
4723 4724 disabling of colors for Windows. I'll test at runtime and issue a
4724 4725 warning if Gary's readline isn't found, as to nudge users to
4725 4726 download it.
4726 4727
4727 4728 2004-06-16 Fernando Perez <fperez@colorado.edu>
4728 4729
4729 4730 * IPython/genutils.py (Stream.__init__): changed to print errors
4730 4731 to sys.stderr. I had a circular dependency here. Now it's
4731 4732 possible to run ipython as IDLE's shell (consider this pre-alpha,
4732 4733 since true stdout things end up in the starting terminal instead
4733 4734 of IDLE's out).
4734 4735
4735 4736 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4736 4737 users who haven't # updated their prompt_in2 definitions. Remove
4737 4738 eventually.
4738 4739 (multiple_replace): added credit to original ASPN recipe.
4739 4740
4740 4741 2004-06-15 Fernando Perez <fperez@colorado.edu>
4741 4742
4742 4743 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4743 4744 list of auto-defined aliases.
4744 4745
4745 4746 2004-06-13 Fernando Perez <fperez@colorado.edu>
4746 4747
4747 4748 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4748 4749 install was really requested (so setup.py can be used for other
4749 4750 things under Windows).
4750 4751
4751 4752 2004-06-10 Fernando Perez <fperez@colorado.edu>
4752 4753
4753 4754 * IPython/Logger.py (Logger.create_log): Manually remove any old
4754 4755 backup, since os.remove may fail under Windows. Fixes bug
4755 4756 reported by Thorsten.
4756 4757
4757 4758 2004-06-09 Fernando Perez <fperez@colorado.edu>
4758 4759
4759 4760 * examples/example-embed.py: fixed all references to %n (replaced
4760 4761 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4761 4762 for all examples and the manual as well.
4762 4763
4763 4764 2004-06-08 Fernando Perez <fperez@colorado.edu>
4764 4765
4765 4766 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4766 4767 alignment and color management. All 3 prompt subsystems now
4767 4768 inherit from BasePrompt.
4768 4769
4769 4770 * tools/release: updates for windows installer build and tag rpms
4770 4771 with python version (since paths are fixed).
4771 4772
4772 4773 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4773 4774 which will become eventually obsolete. Also fixed the default
4774 4775 prompt_in2 to use \D, so at least new users start with the correct
4775 4776 defaults.
4776 4777 WARNING: Users with existing ipythonrc files will need to apply
4777 4778 this fix manually!
4778 4779
4779 4780 * setup.py: make windows installer (.exe). This is finally the
4780 4781 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4781 4782 which I hadn't included because it required Python 2.3 (or recent
4782 4783 distutils).
4783 4784
4784 4785 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4785 4786 usage of new '\D' escape.
4786 4787
4787 4788 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4788 4789 lacks os.getuid())
4789 4790 (CachedOutput.set_colors): Added the ability to turn coloring
4790 4791 on/off with @colors even for manually defined prompt colors. It
4791 4792 uses a nasty global, but it works safely and via the generic color
4792 4793 handling mechanism.
4793 4794 (Prompt2.__init__): Introduced new escape '\D' for continuation
4794 4795 prompts. It represents the counter ('\#') as dots.
4795 4796 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4796 4797 need to update their ipythonrc files and replace '%n' with '\D' in
4797 4798 their prompt_in2 settings everywhere. Sorry, but there's
4798 4799 otherwise no clean way to get all prompts to properly align. The
4799 4800 ipythonrc shipped with IPython has been updated.
4800 4801
4801 4802 2004-06-07 Fernando Perez <fperez@colorado.edu>
4802 4803
4803 4804 * setup.py (isfile): Pass local_icons option to latex2html, so the
4804 4805 resulting HTML file is self-contained. Thanks to
4805 4806 dryice-AT-liu.com.cn for the tip.
4806 4807
4807 4808 * pysh.py: I created a new profile 'shell', which implements a
4808 4809 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4809 4810 system shell, nor will it become one anytime soon. It's mainly
4810 4811 meant to illustrate the use of the new flexible bash-like prompts.
4811 4812 I guess it could be used by hardy souls for true shell management,
4812 4813 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4813 4814 profile. This uses the InterpreterExec extension provided by
4814 4815 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4815 4816
4816 4817 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4817 4818 auto-align itself with the length of the previous input prompt
4818 4819 (taking into account the invisible color escapes).
4819 4820 (CachedOutput.__init__): Large restructuring of this class. Now
4820 4821 all three prompts (primary1, primary2, output) are proper objects,
4821 4822 managed by the 'parent' CachedOutput class. The code is still a
4822 4823 bit hackish (all prompts share state via a pointer to the cache),
4823 4824 but it's overall far cleaner than before.
4824 4825
4825 4826 * IPython/genutils.py (getoutputerror): modified to add verbose,
4826 4827 debug and header options. This makes the interface of all getout*
4827 4828 functions uniform.
4828 4829 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4829 4830
4830 4831 * IPython/Magic.py (Magic.default_option): added a function to
4831 4832 allow registering default options for any magic command. This
4832 4833 makes it easy to have profiles which customize the magics globally
4833 4834 for a certain use. The values set through this function are
4834 4835 picked up by the parse_options() method, which all magics should
4835 4836 use to parse their options.
4836 4837
4837 4838 * IPython/genutils.py (warn): modified the warnings framework to
4838 4839 use the Term I/O class. I'm trying to slowly unify all of
4839 4840 IPython's I/O operations to pass through Term.
4840 4841
4841 4842 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4842 4843 the secondary prompt to correctly match the length of the primary
4843 4844 one for any prompt. Now multi-line code will properly line up
4844 4845 even for path dependent prompts, such as the new ones available
4845 4846 via the prompt_specials.
4846 4847
4847 4848 2004-06-06 Fernando Perez <fperez@colorado.edu>
4848 4849
4849 4850 * IPython/Prompts.py (prompt_specials): Added the ability to have
4850 4851 bash-like special sequences in the prompts, which get
4851 4852 automatically expanded. Things like hostname, current working
4852 4853 directory and username are implemented already, but it's easy to
4853 4854 add more in the future. Thanks to a patch by W.J. van der Laan
4854 4855 <gnufnork-AT-hetdigitalegat.nl>
4855 4856 (prompt_specials): Added color support for prompt strings, so
4856 4857 users can define arbitrary color setups for their prompts.
4857 4858
4858 4859 2004-06-05 Fernando Perez <fperez@colorado.edu>
4859 4860
4860 4861 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4861 4862 code to load Gary Bishop's readline and configure it
4862 4863 automatically. Thanks to Gary for help on this.
4863 4864
4864 4865 2004-06-01 Fernando Perez <fperez@colorado.edu>
4865 4866
4866 4867 * IPython/Logger.py (Logger.create_log): fix bug for logging
4867 4868 with no filename (previous fix was incomplete).
4868 4869
4869 4870 2004-05-25 Fernando Perez <fperez@colorado.edu>
4870 4871
4871 4872 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4872 4873 parens would get passed to the shell.
4873 4874
4874 4875 2004-05-20 Fernando Perez <fperez@colorado.edu>
4875 4876
4876 4877 * IPython/Magic.py (Magic.magic_prun): changed default profile
4877 4878 sort order to 'time' (the more common profiling need).
4878 4879
4879 4880 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4880 4881 so that source code shown is guaranteed in sync with the file on
4881 4882 disk (also changed in psource). Similar fix to the one for
4882 4883 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4883 4884 <yann.ledu-AT-noos.fr>.
4884 4885
4885 4886 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4886 4887 with a single option would not be correctly parsed. Closes
4887 4888 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4888 4889 introduced in 0.6.0 (on 2004-05-06).
4889 4890
4890 4891 2004-05-13 *** Released version 0.6.0
4891 4892
4892 4893 2004-05-13 Fernando Perez <fperez@colorado.edu>
4893 4894
4894 4895 * debian/: Added debian/ directory to CVS, so that debian support
4895 4896 is publicly accessible. The debian package is maintained by Jack
4896 4897 Moffit <jack-AT-xiph.org>.
4897 4898
4898 4899 * Documentation: included the notes about an ipython-based system
4899 4900 shell (the hypothetical 'pysh') into the new_design.pdf document,
4900 4901 so that these ideas get distributed to users along with the
4901 4902 official documentation.
4902 4903
4903 4904 2004-05-10 Fernando Perez <fperez@colorado.edu>
4904 4905
4905 4906 * IPython/Logger.py (Logger.create_log): fix recently introduced
4906 4907 bug (misindented line) where logstart would fail when not given an
4907 4908 explicit filename.
4908 4909
4909 4910 2004-05-09 Fernando Perez <fperez@colorado.edu>
4910 4911
4911 4912 * IPython/Magic.py (Magic.parse_options): skip system call when
4912 4913 there are no options to look for. Faster, cleaner for the common
4913 4914 case.
4914 4915
4915 4916 * Documentation: many updates to the manual: describing Windows
4916 4917 support better, Gnuplot updates, credits, misc small stuff. Also
4917 4918 updated the new_design doc a bit.
4918 4919
4919 4920 2004-05-06 *** Released version 0.6.0.rc1
4920 4921
4921 4922 2004-05-06 Fernando Perez <fperez@colorado.edu>
4922 4923
4923 4924 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4924 4925 operations to use the vastly more efficient list/''.join() method.
4925 4926 (FormattedTB.text): Fix
4926 4927 http://www.scipy.net/roundup/ipython/issue12 - exception source
4927 4928 extract not updated after reload. Thanks to Mike Salib
4928 4929 <msalib-AT-mit.edu> for pinning the source of the problem.
4929 4930 Fortunately, the solution works inside ipython and doesn't require
4930 4931 any changes to python proper.
4931 4932
4932 4933 * IPython/Magic.py (Magic.parse_options): Improved to process the
4933 4934 argument list as a true shell would (by actually using the
4934 4935 underlying system shell). This way, all @magics automatically get
4935 4936 shell expansion for variables. Thanks to a comment by Alex
4936 4937 Schmolck.
4937 4938
4938 4939 2004-04-04 Fernando Perez <fperez@colorado.edu>
4939 4940
4940 4941 * IPython/iplib.py (InteractiveShell.interact): Added a special
4941 4942 trap for a debugger quit exception, which is basically impossible
4942 4943 to handle by normal mechanisms, given what pdb does to the stack.
4943 4944 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4944 4945
4945 4946 2004-04-03 Fernando Perez <fperez@colorado.edu>
4946 4947
4947 4948 * IPython/genutils.py (Term): Standardized the names of the Term
4948 4949 class streams to cin/cout/cerr, following C++ naming conventions
4949 4950 (I can't use in/out/err because 'in' is not a valid attribute
4950 4951 name).
4951 4952
4952 4953 * IPython/iplib.py (InteractiveShell.interact): don't increment
4953 4954 the prompt if there's no user input. By Daniel 'Dang' Griffith
4954 4955 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4955 4956 Francois Pinard.
4956 4957
4957 4958 2004-04-02 Fernando Perez <fperez@colorado.edu>
4958 4959
4959 4960 * IPython/genutils.py (Stream.__init__): Modified to survive at
4960 4961 least importing in contexts where stdin/out/err aren't true file
4961 4962 objects, such as PyCrust (they lack fileno() and mode). However,
4962 4963 the recovery facilities which rely on these things existing will
4963 4964 not work.
4964 4965
4965 4966 2004-04-01 Fernando Perez <fperez@colorado.edu>
4966 4967
4967 4968 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4968 4969 use the new getoutputerror() function, so it properly
4969 4970 distinguishes stdout/err.
4970 4971
4971 4972 * IPython/genutils.py (getoutputerror): added a function to
4972 4973 capture separately the standard output and error of a command.
4973 4974 After a comment from dang on the mailing lists. This code is
4974 4975 basically a modified version of commands.getstatusoutput(), from
4975 4976 the standard library.
4976 4977
4977 4978 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4978 4979 '!!' as a special syntax (shorthand) to access @sx.
4979 4980
4980 4981 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4981 4982 command and return its output as a list split on '\n'.
4982 4983
4983 4984 2004-03-31 Fernando Perez <fperez@colorado.edu>
4984 4985
4985 4986 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4986 4987 method to dictionaries used as FakeModule instances if they lack
4987 4988 it. At least pydoc in python2.3 breaks for runtime-defined
4988 4989 functions without this hack. At some point I need to _really_
4989 4990 understand what FakeModule is doing, because it's a gross hack.
4990 4991 But it solves Arnd's problem for now...
4991 4992
4992 4993 2004-02-27 Fernando Perez <fperez@colorado.edu>
4993 4994
4994 4995 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4995 4996 mode would behave erratically. Also increased the number of
4996 4997 possible logs in rotate mod to 999. Thanks to Rod Holland
4997 4998 <rhh@StructureLABS.com> for the report and fixes.
4998 4999
4999 5000 2004-02-26 Fernando Perez <fperez@colorado.edu>
5000 5001
5001 5002 * IPython/genutils.py (page): Check that the curses module really
5002 5003 has the initscr attribute before trying to use it. For some
5003 5004 reason, the Solaris curses module is missing this. I think this
5004 5005 should be considered a Solaris python bug, but I'm not sure.
5005 5006
5006 5007 2004-01-17 Fernando Perez <fperez@colorado.edu>
5007 5008
5008 5009 * IPython/genutils.py (Stream.__init__): Changes to try to make
5009 5010 ipython robust against stdin/out/err being closed by the user.
5010 5011 This is 'user error' (and blocks a normal python session, at least
5011 5012 the stdout case). However, Ipython should be able to survive such
5012 5013 instances of abuse as gracefully as possible. To simplify the
5013 5014 coding and maintain compatibility with Gary Bishop's Term
5014 5015 contributions, I've made use of classmethods for this. I think
5015 5016 this introduces a dependency on python 2.2.
5016 5017
5017 5018 2004-01-13 Fernando Perez <fperez@colorado.edu>
5018 5019
5019 5020 * IPython/numutils.py (exp_safe): simplified the code a bit and
5020 5021 removed the need for importing the kinds module altogether.
5021 5022
5022 5023 2004-01-06 Fernando Perez <fperez@colorado.edu>
5023 5024
5024 5025 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
5025 5026 a magic function instead, after some community feedback. No
5026 5027 special syntax will exist for it, but its name is deliberately
5027 5028 very short.
5028 5029
5029 5030 2003-12-20 Fernando Perez <fperez@colorado.edu>
5030 5031
5031 5032 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
5032 5033 new functionality, to automagically assign the result of a shell
5033 5034 command to a variable. I'll solicit some community feedback on
5034 5035 this before making it permanent.
5035 5036
5036 5037 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
5037 5038 requested about callables for which inspect couldn't obtain a
5038 5039 proper argspec. Thanks to a crash report sent by Etienne
5039 5040 Posthumus <etienne-AT-apple01.cs.vu.nl>.
5040 5041
5041 5042 2003-12-09 Fernando Perez <fperez@colorado.edu>
5042 5043
5043 5044 * IPython/genutils.py (page): patch for the pager to work across
5044 5045 various versions of Windows. By Gary Bishop.
5045 5046
5046 5047 2003-12-04 Fernando Perez <fperez@colorado.edu>
5047 5048
5048 5049 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
5049 5050 Gnuplot.py version 1.7, whose internal names changed quite a bit.
5050 5051 While I tested this and it looks ok, there may still be corner
5051 5052 cases I've missed.
5052 5053
5053 5054 2003-12-01 Fernando Perez <fperez@colorado.edu>
5054 5055
5055 5056 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
5056 5057 where a line like 'p,q=1,2' would fail because the automagic
5057 5058 system would be triggered for @p.
5058 5059
5059 5060 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
5060 5061 cleanups, code unmodified.
5061 5062
5062 5063 * IPython/genutils.py (Term): added a class for IPython to handle
5063 5064 output. In most cases it will just be a proxy for stdout/err, but
5064 5065 having this allows modifications to be made for some platforms,
5065 5066 such as handling color escapes under Windows. All of this code
5066 5067 was contributed by Gary Bishop, with minor modifications by me.
5067 5068 The actual changes affect many files.
5068 5069
5069 5070 2003-11-30 Fernando Perez <fperez@colorado.edu>
5070 5071
5071 5072 * IPython/iplib.py (file_matches): new completion code, courtesy
5072 5073 of Jeff Collins. This enables filename completion again under
5073 5074 python 2.3, which disabled it at the C level.
5074 5075
5075 5076 2003-11-11 Fernando Perez <fperez@colorado.edu>
5076 5077
5077 5078 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
5078 5079 for Numeric.array(map(...)), but often convenient.
5079 5080
5080 5081 2003-11-05 Fernando Perez <fperez@colorado.edu>
5081 5082
5082 5083 * IPython/numutils.py (frange): Changed a call from int() to
5083 5084 int(round()) to prevent a problem reported with arange() in the
5084 5085 numpy list.
5085 5086
5086 5087 2003-10-06 Fernando Perez <fperez@colorado.edu>
5087 5088
5088 5089 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
5089 5090 prevent crashes if sys lacks an argv attribute (it happens with
5090 5091 embedded interpreters which build a bare-bones sys module).
5091 5092 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
5092 5093
5093 5094 2003-09-24 Fernando Perez <fperez@colorado.edu>
5094 5095
5095 5096 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
5096 5097 to protect against poorly written user objects where __getattr__
5097 5098 raises exceptions other than AttributeError. Thanks to a bug
5098 5099 report by Oliver Sander <osander-AT-gmx.de>.
5099 5100
5100 5101 * IPython/FakeModule.py (FakeModule.__repr__): this method was
5101 5102 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
5102 5103
5103 5104 2003-09-09 Fernando Perez <fperez@colorado.edu>
5104 5105
5105 5106 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
5106 5107 unpacking a list whith a callable as first element would
5107 5108 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
5108 5109 Collins.
5109 5110
5110 5111 2003-08-25 *** Released version 0.5.0
5111 5112
5112 5113 2003-08-22 Fernando Perez <fperez@colorado.edu>
5113 5114
5114 5115 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
5115 5116 improperly defined user exceptions. Thanks to feedback from Mark
5116 5117 Russell <mrussell-AT-verio.net>.
5117 5118
5118 5119 2003-08-20 Fernando Perez <fperez@colorado.edu>
5119 5120
5120 5121 * IPython/OInspect.py (Inspector.pinfo): changed String Form
5121 5122 printing so that it would print multi-line string forms starting
5122 5123 with a new line. This way the formatting is better respected for
5123 5124 objects which work hard to make nice string forms.
5124 5125
5125 5126 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
5126 5127 autocall would overtake data access for objects with both
5127 5128 __getitem__ and __call__.
5128 5129
5129 5130 2003-08-19 *** Released version 0.5.0-rc1
5130 5131
5131 5132 2003-08-19 Fernando Perez <fperez@colorado.edu>
5132 5133
5133 5134 * IPython/deep_reload.py (load_tail): single tiny change here
5134 5135 seems to fix the long-standing bug of dreload() failing to work
5135 5136 for dotted names. But this module is pretty tricky, so I may have
5136 5137 missed some subtlety. Needs more testing!.
5137 5138
5138 5139 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
5139 5140 exceptions which have badly implemented __str__ methods.
5140 5141 (VerboseTB.text): harden against inspect.getinnerframes crashing,
5141 5142 which I've been getting reports about from Python 2.3 users. I
5142 5143 wish I had a simple test case to reproduce the problem, so I could
5143 5144 either write a cleaner workaround or file a bug report if
5144 5145 necessary.
5145 5146
5146 5147 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
5147 5148 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
5148 5149 a bug report by Tjabo Kloppenburg.
5149 5150
5150 5151 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
5151 5152 crashes. Wrapped the pdb call in a blanket try/except, since pdb
5152 5153 seems rather unstable. Thanks to a bug report by Tjabo
5153 5154 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
5154 5155
5155 5156 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
5156 5157 this out soon because of the critical fixes in the inner loop for
5157 5158 generators.
5158 5159
5159 5160 * IPython/Magic.py (Magic.getargspec): removed. This (and
5160 5161 _get_def) have been obsoleted by OInspect for a long time, I
5161 5162 hadn't noticed that they were dead code.
5162 5163 (Magic._ofind): restored _ofind functionality for a few literals
5163 5164 (those in ["''",'""','[]','{}','()']). But it won't work anymore
5164 5165 for things like "hello".capitalize?, since that would require a
5165 5166 potentially dangerous eval() again.
5166 5167
5167 5168 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
5168 5169 logic a bit more to clean up the escapes handling and minimize the
5169 5170 use of _ofind to only necessary cases. The interactive 'feel' of
5170 5171 IPython should have improved quite a bit with the changes in
5171 5172 _prefilter and _ofind (besides being far safer than before).
5172 5173
5173 5174 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
5174 5175 obscure, never reported). Edit would fail to find the object to
5175 5176 edit under some circumstances.
5176 5177 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
5177 5178 which were causing double-calling of generators. Those eval calls
5178 5179 were _very_ dangerous, since code with side effects could be
5179 5180 triggered. As they say, 'eval is evil'... These were the
5180 5181 nastiest evals in IPython. Besides, _ofind is now far simpler,
5181 5182 and it should also be quite a bit faster. Its use of inspect is
5182 5183 also safer, so perhaps some of the inspect-related crashes I've
5183 5184 seen lately with Python 2.3 might be taken care of. That will
5184 5185 need more testing.
5185 5186
5186 5187 2003-08-17 Fernando Perez <fperez@colorado.edu>
5187 5188
5188 5189 * IPython/iplib.py (InteractiveShell._prefilter): significant
5189 5190 simplifications to the logic for handling user escapes. Faster
5190 5191 and simpler code.
5191 5192
5192 5193 2003-08-14 Fernando Perez <fperez@colorado.edu>
5193 5194
5194 5195 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
5195 5196 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
5196 5197 but it should be quite a bit faster. And the recursive version
5197 5198 generated O(log N) intermediate storage for all rank>1 arrays,
5198 5199 even if they were contiguous.
5199 5200 (l1norm): Added this function.
5200 5201 (norm): Added this function for arbitrary norms (including
5201 5202 l-infinity). l1 and l2 are still special cases for convenience
5202 5203 and speed.
5203 5204
5204 5205 2003-08-03 Fernando Perez <fperez@colorado.edu>
5205 5206
5206 5207 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
5207 5208 exceptions, which now raise PendingDeprecationWarnings in Python
5208 5209 2.3. There were some in Magic and some in Gnuplot2.
5209 5210
5210 5211 2003-06-30 Fernando Perez <fperez@colorado.edu>
5211 5212
5212 5213 * IPython/genutils.py (page): modified to call curses only for
5213 5214 terminals where TERM=='xterm'. After problems under many other
5214 5215 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
5215 5216
5216 5217 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
5217 5218 would be triggered when readline was absent. This was just an old
5218 5219 debugging statement I'd forgotten to take out.
5219 5220
5220 5221 2003-06-20 Fernando Perez <fperez@colorado.edu>
5221 5222
5222 5223 * IPython/genutils.py (clock): modified to return only user time
5223 5224 (not counting system time), after a discussion on scipy. While
5224 5225 system time may be a useful quantity occasionally, it may much
5225 5226 more easily be skewed by occasional swapping or other similar
5226 5227 activity.
5227 5228
5228 5229 2003-06-05 Fernando Perez <fperez@colorado.edu>
5229 5230
5230 5231 * IPython/numutils.py (identity): new function, for building
5231 5232 arbitrary rank Kronecker deltas (mostly backwards compatible with
5232 5233 Numeric.identity)
5233 5234
5234 5235 2003-06-03 Fernando Perez <fperez@colorado.edu>
5235 5236
5236 5237 * IPython/iplib.py (InteractiveShell.handle_magic): protect
5237 5238 arguments passed to magics with spaces, to allow trailing '\' to
5238 5239 work normally (mainly for Windows users).
5239 5240
5240 5241 2003-05-29 Fernando Perez <fperez@colorado.edu>
5241 5242
5242 5243 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
5243 5244 instead of pydoc.help. This fixes a bizarre behavior where
5244 5245 printing '%s' % locals() would trigger the help system. Now
5245 5246 ipython behaves like normal python does.
5246 5247
5247 5248 Note that if one does 'from pydoc import help', the bizarre
5248 5249 behavior returns, but this will also happen in normal python, so
5249 5250 it's not an ipython bug anymore (it has to do with how pydoc.help
5250 5251 is implemented).
5251 5252
5252 5253 2003-05-22 Fernando Perez <fperez@colorado.edu>
5253 5254
5254 5255 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
5255 5256 return [] instead of None when nothing matches, also match to end
5256 5257 of line. Patch by Gary Bishop.
5257 5258
5258 5259 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
5259 5260 protection as before, for files passed on the command line. This
5260 5261 prevents the CrashHandler from kicking in if user files call into
5261 5262 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
5262 5263 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
5263 5264
5264 5265 2003-05-20 *** Released version 0.4.0
5265 5266
5266 5267 2003-05-20 Fernando Perez <fperez@colorado.edu>
5267 5268
5268 5269 * setup.py: added support for manpages. It's a bit hackish b/c of
5269 5270 a bug in the way the bdist_rpm distutils target handles gzipped
5270 5271 manpages, but it works. After a patch by Jack.
5271 5272
5272 5273 2003-05-19 Fernando Perez <fperez@colorado.edu>
5273 5274
5274 5275 * IPython/numutils.py: added a mockup of the kinds module, since
5275 5276 it was recently removed from Numeric. This way, numutils will
5276 5277 work for all users even if they are missing kinds.
5277 5278
5278 5279 * IPython/Magic.py (Magic._ofind): Harden against an inspect
5279 5280 failure, which can occur with SWIG-wrapped extensions. After a
5280 5281 crash report from Prabhu.
5281 5282
5282 5283 2003-05-16 Fernando Perez <fperez@colorado.edu>
5283 5284
5284 5285 * IPython/iplib.py (InteractiveShell.excepthook): New method to
5285 5286 protect ipython from user code which may call directly
5286 5287 sys.excepthook (this looks like an ipython crash to the user, even
5287 5288 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5288 5289 This is especially important to help users of WxWindows, but may
5289 5290 also be useful in other cases.
5290 5291
5291 5292 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
5292 5293 an optional tb_offset to be specified, and to preserve exception
5293 5294 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5294 5295
5295 5296 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
5296 5297
5297 5298 2003-05-15 Fernando Perez <fperez@colorado.edu>
5298 5299
5299 5300 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
5300 5301 installing for a new user under Windows.
5301 5302
5302 5303 2003-05-12 Fernando Perez <fperez@colorado.edu>
5303 5304
5304 5305 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
5305 5306 handler for Emacs comint-based lines. Currently it doesn't do
5306 5307 much (but importantly, it doesn't update the history cache). In
5307 5308 the future it may be expanded if Alex needs more functionality
5308 5309 there.
5309 5310
5310 5311 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
5311 5312 info to crash reports.
5312 5313
5313 5314 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
5314 5315 just like Python's -c. Also fixed crash with invalid -color
5315 5316 option value at startup. Thanks to Will French
5316 5317 <wfrench-AT-bestweb.net> for the bug report.
5317 5318
5318 5319 2003-05-09 Fernando Perez <fperez@colorado.edu>
5319 5320
5320 5321 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
5321 5322 to EvalDict (it's a mapping, after all) and simplified its code
5322 5323 quite a bit, after a nice discussion on c.l.py where Gustavo
5323 5324 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
5324 5325
5325 5326 2003-04-30 Fernando Perez <fperez@colorado.edu>
5326 5327
5327 5328 * IPython/genutils.py (timings_out): modified it to reduce its
5328 5329 overhead in the common reps==1 case.
5329 5330
5330 5331 2003-04-29 Fernando Perez <fperez@colorado.edu>
5331 5332
5332 5333 * IPython/genutils.py (timings_out): Modified to use the resource
5333 5334 module, which avoids the wraparound problems of time.clock().
5334 5335
5335 5336 2003-04-17 *** Released version 0.2.15pre4
5336 5337
5337 5338 2003-04-17 Fernando Perez <fperez@colorado.edu>
5338 5339
5339 5340 * setup.py (scriptfiles): Split windows-specific stuff over to a
5340 5341 separate file, in an attempt to have a Windows GUI installer.
5341 5342 That didn't work, but part of the groundwork is done.
5342 5343
5343 5344 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
5344 5345 indent/unindent with 4 spaces. Particularly useful in combination
5345 5346 with the new auto-indent option.
5346 5347
5347 5348 2003-04-16 Fernando Perez <fperez@colorado.edu>
5348 5349
5349 5350 * IPython/Magic.py: various replacements of self.rc for
5350 5351 self.shell.rc. A lot more remains to be done to fully disentangle
5351 5352 this class from the main Shell class.
5352 5353
5353 5354 * IPython/GnuplotRuntime.py: added checks for mouse support so
5354 5355 that we don't try to enable it if the current gnuplot doesn't
5355 5356 really support it. Also added checks so that we don't try to
5356 5357 enable persist under Windows (where Gnuplot doesn't recognize the
5357 5358 option).
5358 5359
5359 5360 * IPython/iplib.py (InteractiveShell.interact): Added optional
5360 5361 auto-indenting code, after a patch by King C. Shu
5361 5362 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
5362 5363 get along well with pasting indented code. If I ever figure out
5363 5364 how to make that part go well, it will become on by default.
5364 5365
5365 5366 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5366 5367 crash ipython if there was an unmatched '%' in the user's prompt
5367 5368 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5368 5369
5369 5370 * IPython/iplib.py (InteractiveShell.interact): removed the
5370 5371 ability to ask the user whether he wants to crash or not at the
5371 5372 'last line' exception handler. Calling functions at that point
5372 5373 changes the stack, and the error reports would have incorrect
5373 5374 tracebacks.
5374 5375
5375 5376 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5376 5377 pass through a peger a pretty-printed form of any object. After a
5377 5378 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5378 5379
5379 5380 2003-04-14 Fernando Perez <fperez@colorado.edu>
5380 5381
5381 5382 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5382 5383 all files in ~ would be modified at first install (instead of
5383 5384 ~/.ipython). This could be potentially disastrous, as the
5384 5385 modification (make line-endings native) could damage binary files.
5385 5386
5386 5387 2003-04-10 Fernando Perez <fperez@colorado.edu>
5387 5388
5388 5389 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5389 5390 handle only lines which are invalid python. This now means that
5390 5391 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5391 5392 for the bug report.
5392 5393
5393 5394 2003-04-01 Fernando Perez <fperez@colorado.edu>
5394 5395
5395 5396 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5396 5397 where failing to set sys.last_traceback would crash pdb.pm().
5397 5398 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5398 5399 report.
5399 5400
5400 5401 2003-03-25 Fernando Perez <fperez@colorado.edu>
5401 5402
5402 5403 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5403 5404 before printing it (it had a lot of spurious blank lines at the
5404 5405 end).
5405 5406
5406 5407 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5407 5408 output would be sent 21 times! Obviously people don't use this
5408 5409 too often, or I would have heard about it.
5409 5410
5410 5411 2003-03-24 Fernando Perez <fperez@colorado.edu>
5411 5412
5412 5413 * setup.py (scriptfiles): renamed the data_files parameter from
5413 5414 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5414 5415 for the patch.
5415 5416
5416 5417 2003-03-20 Fernando Perez <fperez@colorado.edu>
5417 5418
5418 5419 * IPython/genutils.py (error): added error() and fatal()
5419 5420 functions.
5420 5421
5421 5422 2003-03-18 *** Released version 0.2.15pre3
5422 5423
5423 5424 2003-03-18 Fernando Perez <fperez@colorado.edu>
5424 5425
5425 5426 * setupext/install_data_ext.py
5426 5427 (install_data_ext.initialize_options): Class contributed by Jack
5427 5428 Moffit for fixing the old distutils hack. He is sending this to
5428 5429 the distutils folks so in the future we may not need it as a
5429 5430 private fix.
5430 5431
5431 5432 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5432 5433 changes for Debian packaging. See his patch for full details.
5433 5434 The old distutils hack of making the ipythonrc* files carry a
5434 5435 bogus .py extension is gone, at last. Examples were moved to a
5435 5436 separate subdir under doc/, and the separate executable scripts
5436 5437 now live in their own directory. Overall a great cleanup. The
5437 5438 manual was updated to use the new files, and setup.py has been
5438 5439 fixed for this setup.
5439 5440
5440 5441 * IPython/PyColorize.py (Parser.usage): made non-executable and
5441 5442 created a pycolor wrapper around it to be included as a script.
5442 5443
5443 5444 2003-03-12 *** Released version 0.2.15pre2
5444 5445
5445 5446 2003-03-12 Fernando Perez <fperez@colorado.edu>
5446 5447
5447 5448 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5448 5449 long-standing problem with garbage characters in some terminals.
5449 5450 The issue was really that the \001 and \002 escapes must _only_ be
5450 5451 passed to input prompts (which call readline), but _never_ to
5451 5452 normal text to be printed on screen. I changed ColorANSI to have
5452 5453 two classes: TermColors and InputTermColors, each with the
5453 5454 appropriate escapes for input prompts or normal text. The code in
5454 5455 Prompts.py got slightly more complicated, but this very old and
5455 5456 annoying bug is finally fixed.
5456 5457
5457 5458 All the credit for nailing down the real origin of this problem
5458 5459 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5459 5460 *Many* thanks to him for spending quite a bit of effort on this.
5460 5461
5461 5462 2003-03-05 *** Released version 0.2.15pre1
5462 5463
5463 5464 2003-03-03 Fernando Perez <fperez@colorado.edu>
5464 5465
5465 5466 * IPython/FakeModule.py: Moved the former _FakeModule to a
5466 5467 separate file, because it's also needed by Magic (to fix a similar
5467 5468 pickle-related issue in @run).
5468 5469
5469 5470 2003-03-02 Fernando Perez <fperez@colorado.edu>
5470 5471
5471 5472 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5472 5473 the autocall option at runtime.
5473 5474 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5474 5475 across Magic.py to start separating Magic from InteractiveShell.
5475 5476 (Magic._ofind): Fixed to return proper namespace for dotted
5476 5477 names. Before, a dotted name would always return 'not currently
5477 5478 defined', because it would find the 'parent'. s.x would be found,
5478 5479 but since 'x' isn't defined by itself, it would get confused.
5479 5480 (Magic.magic_run): Fixed pickling problems reported by Ralf
5480 5481 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5481 5482 that I'd used when Mike Heeter reported similar issues at the
5482 5483 top-level, but now for @run. It boils down to injecting the
5483 5484 namespace where code is being executed with something that looks
5484 5485 enough like a module to fool pickle.dump(). Since a pickle stores
5485 5486 a named reference to the importing module, we need this for
5486 5487 pickles to save something sensible.
5487 5488
5488 5489 * IPython/ipmaker.py (make_IPython): added an autocall option.
5489 5490
5490 5491 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5491 5492 the auto-eval code. Now autocalling is an option, and the code is
5492 5493 also vastly safer. There is no more eval() involved at all.
5493 5494
5494 5495 2003-03-01 Fernando Perez <fperez@colorado.edu>
5495 5496
5496 5497 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5497 5498 dict with named keys instead of a tuple.
5498 5499
5499 5500 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5500 5501
5501 5502 * setup.py (make_shortcut): Fixed message about directories
5502 5503 created during Windows installation (the directories were ok, just
5503 5504 the printed message was misleading). Thanks to Chris Liechti
5504 5505 <cliechti-AT-gmx.net> for the heads up.
5505 5506
5506 5507 2003-02-21 Fernando Perez <fperez@colorado.edu>
5507 5508
5508 5509 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5509 5510 of ValueError exception when checking for auto-execution. This
5510 5511 one is raised by things like Numeric arrays arr.flat when the
5511 5512 array is non-contiguous.
5512 5513
5513 5514 2003-01-31 Fernando Perez <fperez@colorado.edu>
5514 5515
5515 5516 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5516 5517 not return any value at all (even though the command would get
5517 5518 executed).
5518 5519 (xsys): Flush stdout right after printing the command to ensure
5519 5520 proper ordering of commands and command output in the total
5520 5521 output.
5521 5522 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5522 5523 system/getoutput as defaults. The old ones are kept for
5523 5524 compatibility reasons, so no code which uses this library needs
5524 5525 changing.
5525 5526
5526 5527 2003-01-27 *** Released version 0.2.14
5527 5528
5528 5529 2003-01-25 Fernando Perez <fperez@colorado.edu>
5529 5530
5530 5531 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5531 5532 functions defined in previous edit sessions could not be re-edited
5532 5533 (because the temp files were immediately removed). Now temp files
5533 5534 are removed only at IPython's exit.
5534 5535 (Magic.magic_run): Improved @run to perform shell-like expansions
5535 5536 on its arguments (~users and $VARS). With this, @run becomes more
5536 5537 like a normal command-line.
5537 5538
5538 5539 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5539 5540 bugs related to embedding and cleaned up that code. A fairly
5540 5541 important one was the impossibility to access the global namespace
5541 5542 through the embedded IPython (only local variables were visible).
5542 5543
5543 5544 2003-01-14 Fernando Perez <fperez@colorado.edu>
5544 5545
5545 5546 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5546 5547 auto-calling to be a bit more conservative. Now it doesn't get
5547 5548 triggered if any of '!=()<>' are in the rest of the input line, to
5548 5549 allow comparing callables. Thanks to Alex for the heads up.
5549 5550
5550 5551 2003-01-07 Fernando Perez <fperez@colorado.edu>
5551 5552
5552 5553 * IPython/genutils.py (page): fixed estimation of the number of
5553 5554 lines in a string to be paged to simply count newlines. This
5554 5555 prevents over-guessing due to embedded escape sequences. A better
5555 5556 long-term solution would involve stripping out the control chars
5556 5557 for the count, but it's potentially so expensive I just don't
5557 5558 think it's worth doing.
5558 5559
5559 5560 2002-12-19 *** Released version 0.2.14pre50
5560 5561
5561 5562 2002-12-19 Fernando Perez <fperez@colorado.edu>
5562 5563
5563 5564 * tools/release (version): Changed release scripts to inform
5564 5565 Andrea and build a NEWS file with a list of recent changes.
5565 5566
5566 5567 * IPython/ColorANSI.py (__all__): changed terminal detection
5567 5568 code. Seems to work better for xterms without breaking
5568 5569 konsole. Will need more testing to determine if WinXP and Mac OSX
5569 5570 also work ok.
5570 5571
5571 5572 2002-12-18 *** Released version 0.2.14pre49
5572 5573
5573 5574 2002-12-18 Fernando Perez <fperez@colorado.edu>
5574 5575
5575 5576 * Docs: added new info about Mac OSX, from Andrea.
5576 5577
5577 5578 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5578 5579 allow direct plotting of python strings whose format is the same
5579 5580 of gnuplot data files.
5580 5581
5581 5582 2002-12-16 Fernando Perez <fperez@colorado.edu>
5582 5583
5583 5584 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5584 5585 value of exit question to be acknowledged.
5585 5586
5586 5587 2002-12-03 Fernando Perez <fperez@colorado.edu>
5587 5588
5588 5589 * IPython/ipmaker.py: removed generators, which had been added
5589 5590 by mistake in an earlier debugging run. This was causing trouble
5590 5591 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5591 5592 for pointing this out.
5592 5593
5593 5594 2002-11-17 Fernando Perez <fperez@colorado.edu>
5594 5595
5595 5596 * Manual: updated the Gnuplot section.
5596 5597
5597 5598 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5598 5599 a much better split of what goes in Runtime and what goes in
5599 5600 Interactive.
5600 5601
5601 5602 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5602 5603 being imported from iplib.
5603 5604
5604 5605 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5605 5606 for command-passing. Now the global Gnuplot instance is called
5606 5607 'gp' instead of 'g', which was really a far too fragile and
5607 5608 common name.
5608 5609
5609 5610 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5610 5611 bounding boxes generated by Gnuplot for square plots.
5611 5612
5612 5613 * IPython/genutils.py (popkey): new function added. I should
5613 5614 suggest this on c.l.py as a dict method, it seems useful.
5614 5615
5615 5616 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5616 5617 to transparently handle PostScript generation. MUCH better than
5617 5618 the previous plot_eps/replot_eps (which I removed now). The code
5618 5619 is also fairly clean and well documented now (including
5619 5620 docstrings).
5620 5621
5621 5622 2002-11-13 Fernando Perez <fperez@colorado.edu>
5622 5623
5623 5624 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5624 5625 (inconsistent with options).
5625 5626
5626 5627 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5627 5628 manually disabled, I don't know why. Fixed it.
5628 5629 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5629 5630 eps output.
5630 5631
5631 5632 2002-11-12 Fernando Perez <fperez@colorado.edu>
5632 5633
5633 5634 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5634 5635 don't propagate up to caller. Fixes crash reported by François
5635 5636 Pinard.
5636 5637
5637 5638 2002-11-09 Fernando Perez <fperez@colorado.edu>
5638 5639
5639 5640 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5640 5641 history file for new users.
5641 5642 (make_IPython): fixed bug where initial install would leave the
5642 5643 user running in the .ipython dir.
5643 5644 (make_IPython): fixed bug where config dir .ipython would be
5644 5645 created regardless of the given -ipythondir option. Thanks to Cory
5645 5646 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5646 5647
5647 5648 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5648 5649 type confirmations. Will need to use it in all of IPython's code
5649 5650 consistently.
5650 5651
5651 5652 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5652 5653 context to print 31 lines instead of the default 5. This will make
5653 5654 the crash reports extremely detailed in case the problem is in
5654 5655 libraries I don't have access to.
5655 5656
5656 5657 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5657 5658 line of defense' code to still crash, but giving users fair
5658 5659 warning. I don't want internal errors to go unreported: if there's
5659 5660 an internal problem, IPython should crash and generate a full
5660 5661 report.
5661 5662
5662 5663 2002-11-08 Fernando Perez <fperez@colorado.edu>
5663 5664
5664 5665 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5665 5666 otherwise uncaught exceptions which can appear if people set
5666 5667 sys.stdout to something badly broken. Thanks to a crash report
5667 5668 from henni-AT-mail.brainbot.com.
5668 5669
5669 5670 2002-11-04 Fernando Perez <fperez@colorado.edu>
5670 5671
5671 5672 * IPython/iplib.py (InteractiveShell.interact): added
5672 5673 __IPYTHON__active to the builtins. It's a flag which goes on when
5673 5674 the interaction starts and goes off again when it stops. This
5674 5675 allows embedding code to detect being inside IPython. Before this
5675 5676 was done via __IPYTHON__, but that only shows that an IPython
5676 5677 instance has been created.
5677 5678
5678 5679 * IPython/Magic.py (Magic.magic_env): I realized that in a
5679 5680 UserDict, instance.data holds the data as a normal dict. So I
5680 5681 modified @env to return os.environ.data instead of rebuilding a
5681 5682 dict by hand.
5682 5683
5683 5684 2002-11-02 Fernando Perez <fperez@colorado.edu>
5684 5685
5685 5686 * IPython/genutils.py (warn): changed so that level 1 prints no
5686 5687 header. Level 2 is now the default (with 'WARNING' header, as
5687 5688 before). I think I tracked all places where changes were needed in
5688 5689 IPython, but outside code using the old level numbering may have
5689 5690 broken.
5690 5691
5691 5692 * IPython/iplib.py (InteractiveShell.runcode): added this to
5692 5693 handle the tracebacks in SystemExit traps correctly. The previous
5693 5694 code (through interact) was printing more of the stack than
5694 5695 necessary, showing IPython internal code to the user.
5695 5696
5696 5697 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5697 5698 default. Now that the default at the confirmation prompt is yes,
5698 5699 it's not so intrusive. François' argument that ipython sessions
5699 5700 tend to be complex enough not to lose them from an accidental C-d,
5700 5701 is a valid one.
5701 5702
5702 5703 * IPython/iplib.py (InteractiveShell.interact): added a
5703 5704 showtraceback() call to the SystemExit trap, and modified the exit
5704 5705 confirmation to have yes as the default.
5705 5706
5706 5707 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5707 5708 this file. It's been gone from the code for a long time, this was
5708 5709 simply leftover junk.
5709 5710
5710 5711 2002-11-01 Fernando Perez <fperez@colorado.edu>
5711 5712
5712 5713 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5713 5714 added. If set, IPython now traps EOF and asks for
5714 5715 confirmation. After a request by François Pinard.
5715 5716
5716 5717 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5717 5718 of @abort, and with a new (better) mechanism for handling the
5718 5719 exceptions.
5719 5720
5720 5721 2002-10-27 Fernando Perez <fperez@colorado.edu>
5721 5722
5722 5723 * IPython/usage.py (__doc__): updated the --help information and
5723 5724 the ipythonrc file to indicate that -log generates
5724 5725 ./ipython.log. Also fixed the corresponding info in @logstart.
5725 5726 This and several other fixes in the manuals thanks to reports by
5726 5727 François Pinard <pinard-AT-iro.umontreal.ca>.
5727 5728
5728 5729 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5729 5730 refer to @logstart (instead of @log, which doesn't exist).
5730 5731
5731 5732 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5732 5733 AttributeError crash. Thanks to Christopher Armstrong
5733 5734 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5734 5735 introduced recently (in 0.2.14pre37) with the fix to the eval
5735 5736 problem mentioned below.
5736 5737
5737 5738 2002-10-17 Fernando Perez <fperez@colorado.edu>
5738 5739
5739 5740 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5740 5741 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5741 5742
5742 5743 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5743 5744 this function to fix a problem reported by Alex Schmolck. He saw
5744 5745 it with list comprehensions and generators, which were getting
5745 5746 called twice. The real problem was an 'eval' call in testing for
5746 5747 automagic which was evaluating the input line silently.
5747 5748
5748 5749 This is a potentially very nasty bug, if the input has side
5749 5750 effects which must not be repeated. The code is much cleaner now,
5750 5751 without any blanket 'except' left and with a regexp test for
5751 5752 actual function names.
5752 5753
5753 5754 But an eval remains, which I'm not fully comfortable with. I just
5754 5755 don't know how to find out if an expression could be a callable in
5755 5756 the user's namespace without doing an eval on the string. However
5756 5757 that string is now much more strictly checked so that no code
5757 5758 slips by, so the eval should only happen for things that can
5758 5759 really be only function/method names.
5759 5760
5760 5761 2002-10-15 Fernando Perez <fperez@colorado.edu>
5761 5762
5762 5763 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5763 5764 OSX information to main manual, removed README_Mac_OSX file from
5764 5765 distribution. Also updated credits for recent additions.
5765 5766
5766 5767 2002-10-10 Fernando Perez <fperez@colorado.edu>
5767 5768
5768 5769 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5769 5770 terminal-related issues. Many thanks to Andrea Riciputi
5770 5771 <andrea.riciputi-AT-libero.it> for writing it.
5771 5772
5772 5773 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5773 5774 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5774 5775
5775 5776 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5776 5777 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5777 5778 <syver-en-AT-online.no> who both submitted patches for this problem.
5778 5779
5779 5780 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5780 5781 global embedding to make sure that things don't overwrite user
5781 5782 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5782 5783
5783 5784 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5784 5785 compatibility. Thanks to Hayden Callow
5785 5786 <h.callow-AT-elec.canterbury.ac.nz>
5786 5787
5787 5788 2002-10-04 Fernando Perez <fperez@colorado.edu>
5788 5789
5789 5790 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5790 5791 Gnuplot.File objects.
5791 5792
5792 5793 2002-07-23 Fernando Perez <fperez@colorado.edu>
5793 5794
5794 5795 * IPython/genutils.py (timing): Added timings() and timing() for
5795 5796 quick access to the most commonly needed data, the execution
5796 5797 times. Old timing() renamed to timings_out().
5797 5798
5798 5799 2002-07-18 Fernando Perez <fperez@colorado.edu>
5799 5800
5800 5801 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5801 5802 bug with nested instances disrupting the parent's tab completion.
5802 5803
5803 5804 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5804 5805 all_completions code to begin the emacs integration.
5805 5806
5806 5807 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5807 5808 argument to allow titling individual arrays when plotting.
5808 5809
5809 5810 2002-07-15 Fernando Perez <fperez@colorado.edu>
5810 5811
5811 5812 * setup.py (make_shortcut): changed to retrieve the value of
5812 5813 'Program Files' directory from the registry (this value changes in
5813 5814 non-english versions of Windows). Thanks to Thomas Fanslau
5814 5815 <tfanslau-AT-gmx.de> for the report.
5815 5816
5816 5817 2002-07-10 Fernando Perez <fperez@colorado.edu>
5817 5818
5818 5819 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5819 5820 a bug in pdb, which crashes if a line with only whitespace is
5820 5821 entered. Bug report submitted to sourceforge.
5821 5822
5822 5823 2002-07-09 Fernando Perez <fperez@colorado.edu>
5823 5824
5824 5825 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5825 5826 reporting exceptions (it's a bug in inspect.py, I just set a
5826 5827 workaround).
5827 5828
5828 5829 2002-07-08 Fernando Perez <fperez@colorado.edu>
5829 5830
5830 5831 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5831 5832 __IPYTHON__ in __builtins__ to show up in user_ns.
5832 5833
5833 5834 2002-07-03 Fernando Perez <fperez@colorado.edu>
5834 5835
5835 5836 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5836 5837 name from @gp_set_instance to @gp_set_default.
5837 5838
5838 5839 * IPython/ipmaker.py (make_IPython): default editor value set to
5839 5840 '0' (a string), to match the rc file. Otherwise will crash when
5840 5841 .strip() is called on it.
5841 5842
5842 5843
5843 5844 2002-06-28 Fernando Perez <fperez@colorado.edu>
5844 5845
5845 5846 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5846 5847 of files in current directory when a file is executed via
5847 5848 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5848 5849
5849 5850 * setup.py (manfiles): fix for rpm builds, submitted by RA
5850 5851 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5851 5852
5852 5853 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5853 5854 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5854 5855 string!). A. Schmolck caught this one.
5855 5856
5856 5857 2002-06-27 Fernando Perez <fperez@colorado.edu>
5857 5858
5858 5859 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5859 5860 defined files at the cmd line. __name__ wasn't being set to
5860 5861 __main__.
5861 5862
5862 5863 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5863 5864 regular lists and tuples besides Numeric arrays.
5864 5865
5865 5866 * IPython/Prompts.py (CachedOutput.__call__): Added output
5866 5867 supression for input ending with ';'. Similar to Mathematica and
5867 5868 Matlab. The _* vars and Out[] list are still updated, just like
5868 5869 Mathematica behaves.
5869 5870
5870 5871 2002-06-25 Fernando Perez <fperez@colorado.edu>
5871 5872
5872 5873 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5873 5874 .ini extensions for profiels under Windows.
5874 5875
5875 5876 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5876 5877 string form. Fix contributed by Alexander Schmolck
5877 5878 <a.schmolck-AT-gmx.net>
5878 5879
5879 5880 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5880 5881 pre-configured Gnuplot instance.
5881 5882
5882 5883 2002-06-21 Fernando Perez <fperez@colorado.edu>
5883 5884
5884 5885 * IPython/numutils.py (exp_safe): new function, works around the
5885 5886 underflow problems in Numeric.
5886 5887 (log2): New fn. Safe log in base 2: returns exact integer answer
5887 5888 for exact integer powers of 2.
5888 5889
5889 5890 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5890 5891 properly.
5891 5892
5892 5893 2002-06-20 Fernando Perez <fperez@colorado.edu>
5893 5894
5894 5895 * IPython/genutils.py (timing): new function like
5895 5896 Mathematica's. Similar to time_test, but returns more info.
5896 5897
5897 5898 2002-06-18 Fernando Perez <fperez@colorado.edu>
5898 5899
5899 5900 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5900 5901 according to Mike Heeter's suggestions.
5901 5902
5902 5903 2002-06-16 Fernando Perez <fperez@colorado.edu>
5903 5904
5904 5905 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5905 5906 system. GnuplotMagic is gone as a user-directory option. New files
5906 5907 make it easier to use all the gnuplot stuff both from external
5907 5908 programs as well as from IPython. Had to rewrite part of
5908 5909 hardcopy() b/c of a strange bug: often the ps files simply don't
5909 5910 get created, and require a repeat of the command (often several
5910 5911 times).
5911 5912
5912 5913 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5913 5914 resolve output channel at call time, so that if sys.stderr has
5914 5915 been redirected by user this gets honored.
5915 5916
5916 5917 2002-06-13 Fernando Perez <fperez@colorado.edu>
5917 5918
5918 5919 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5919 5920 IPShell. Kept a copy with the old names to avoid breaking people's
5920 5921 embedded code.
5921 5922
5922 5923 * IPython/ipython: simplified it to the bare minimum after
5923 5924 Holger's suggestions. Added info about how to use it in
5924 5925 PYTHONSTARTUP.
5925 5926
5926 5927 * IPython/Shell.py (IPythonShell): changed the options passing
5927 5928 from a string with funky %s replacements to a straight list. Maybe
5928 5929 a bit more typing, but it follows sys.argv conventions, so there's
5929 5930 less special-casing to remember.
5930 5931
5931 5932 2002-06-12 Fernando Perez <fperez@colorado.edu>
5932 5933
5933 5934 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5934 5935 command. Thanks to a suggestion by Mike Heeter.
5935 5936 (Magic.magic_pfile): added behavior to look at filenames if given
5936 5937 arg is not a defined object.
5937 5938 (Magic.magic_save): New @save function to save code snippets. Also
5938 5939 a Mike Heeter idea.
5939 5940
5940 5941 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5941 5942 plot() and replot(). Much more convenient now, especially for
5942 5943 interactive use.
5943 5944
5944 5945 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5945 5946 filenames.
5946 5947
5947 5948 2002-06-02 Fernando Perez <fperez@colorado.edu>
5948 5949
5949 5950 * IPython/Struct.py (Struct.__init__): modified to admit
5950 5951 initialization via another struct.
5951 5952
5952 5953 * IPython/genutils.py (SystemExec.__init__): New stateful
5953 5954 interface to xsys and bq. Useful for writing system scripts.
5954 5955
5955 5956 2002-05-30 Fernando Perez <fperez@colorado.edu>
5956 5957
5957 5958 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5958 5959 documents. This will make the user download smaller (it's getting
5959 5960 too big).
5960 5961
5961 5962 2002-05-29 Fernando Perez <fperez@colorado.edu>
5962 5963
5963 5964 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5964 5965 fix problems with shelve and pickle. Seems to work, but I don't
5965 5966 know if corner cases break it. Thanks to Mike Heeter
5966 5967 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5967 5968
5968 5969 2002-05-24 Fernando Perez <fperez@colorado.edu>
5969 5970
5970 5971 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5971 5972 macros having broken.
5972 5973
5973 5974 2002-05-21 Fernando Perez <fperez@colorado.edu>
5974 5975
5975 5976 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5976 5977 introduced logging bug: all history before logging started was
5977 5978 being written one character per line! This came from the redesign
5978 5979 of the input history as a special list which slices to strings,
5979 5980 not to lists.
5980 5981
5981 5982 2002-05-20 Fernando Perez <fperez@colorado.edu>
5982 5983
5983 5984 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5984 5985 be an attribute of all classes in this module. The design of these
5985 5986 classes needs some serious overhauling.
5986 5987
5987 5988 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5988 5989 which was ignoring '_' in option names.
5989 5990
5990 5991 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5991 5992 'Verbose_novars' to 'Context' and made it the new default. It's a
5992 5993 bit more readable and also safer than verbose.
5993 5994
5994 5995 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5995 5996 triple-quoted strings.
5996 5997
5997 5998 * IPython/OInspect.py (__all__): new module exposing the object
5998 5999 introspection facilities. Now the corresponding magics are dummy
5999 6000 wrappers around this. Having this module will make it much easier
6000 6001 to put these functions into our modified pdb.
6001 6002 This new object inspector system uses the new colorizing module,
6002 6003 so source code and other things are nicely syntax highlighted.
6003 6004
6004 6005 2002-05-18 Fernando Perez <fperez@colorado.edu>
6005 6006
6006 6007 * IPython/ColorANSI.py: Split the coloring tools into a separate
6007 6008 module so I can use them in other code easier (they were part of
6008 6009 ultraTB).
6009 6010
6010 6011 2002-05-17 Fernando Perez <fperez@colorado.edu>
6011 6012
6012 6013 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
6013 6014 fixed it to set the global 'g' also to the called instance, as
6014 6015 long as 'g' was still a gnuplot instance (so it doesn't overwrite
6015 6016 user's 'g' variables).
6016 6017
6017 6018 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
6018 6019 global variables (aliases to _ih,_oh) so that users which expect
6019 6020 In[5] or Out[7] to work aren't unpleasantly surprised.
6020 6021 (InputList.__getslice__): new class to allow executing slices of
6021 6022 input history directly. Very simple class, complements the use of
6022 6023 macros.
6023 6024
6024 6025 2002-05-16 Fernando Perez <fperez@colorado.edu>
6025 6026
6026 6027 * setup.py (docdirbase): make doc directory be just doc/IPython
6027 6028 without version numbers, it will reduce clutter for users.
6028 6029
6029 6030 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
6030 6031 execfile call to prevent possible memory leak. See for details:
6031 6032 http://mail.python.org/pipermail/python-list/2002-February/088476.html
6032 6033
6033 6034 2002-05-15 Fernando Perez <fperez@colorado.edu>
6034 6035
6035 6036 * IPython/Magic.py (Magic.magic_psource): made the object
6036 6037 introspection names be more standard: pdoc, pdef, pfile and
6037 6038 psource. They all print/page their output, and it makes
6038 6039 remembering them easier. Kept old names for compatibility as
6039 6040 aliases.
6040 6041
6041 6042 2002-05-14 Fernando Perez <fperez@colorado.edu>
6042 6043
6043 6044 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
6044 6045 what the mouse problem was. The trick is to use gnuplot with temp
6045 6046 files and NOT with pipes (for data communication), because having
6046 6047 both pipes and the mouse on is bad news.
6047 6048
6048 6049 2002-05-13 Fernando Perez <fperez@colorado.edu>
6049 6050
6050 6051 * IPython/Magic.py (Magic._ofind): fixed namespace order search
6051 6052 bug. Information would be reported about builtins even when
6052 6053 user-defined functions overrode them.
6053 6054
6054 6055 2002-05-11 Fernando Perez <fperez@colorado.edu>
6055 6056
6056 6057 * IPython/__init__.py (__all__): removed FlexCompleter from
6057 6058 __all__ so that things don't fail in platforms without readline.
6058 6059
6059 6060 2002-05-10 Fernando Perez <fperez@colorado.edu>
6060 6061
6061 6062 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
6062 6063 it requires Numeric, effectively making Numeric a dependency for
6063 6064 IPython.
6064 6065
6065 6066 * Released 0.2.13
6066 6067
6067 6068 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
6068 6069 profiler interface. Now all the major options from the profiler
6069 6070 module are directly supported in IPython, both for single
6070 6071 expressions (@prun) and for full programs (@run -p).
6071 6072
6072 6073 2002-05-09 Fernando Perez <fperez@colorado.edu>
6073 6074
6074 6075 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
6075 6076 magic properly formatted for screen.
6076 6077
6077 6078 * setup.py (make_shortcut): Changed things to put pdf version in
6078 6079 doc/ instead of doc/manual (had to change lyxport a bit).
6079 6080
6080 6081 * IPython/Magic.py (Profile.string_stats): made profile runs go
6081 6082 through pager (they are long and a pager allows searching, saving,
6082 6083 etc.)
6083 6084
6084 6085 2002-05-08 Fernando Perez <fperez@colorado.edu>
6085 6086
6086 6087 * Released 0.2.12
6087 6088
6088 6089 2002-05-06 Fernando Perez <fperez@colorado.edu>
6089 6090
6090 6091 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
6091 6092 introduced); 'hist n1 n2' was broken.
6092 6093 (Magic.magic_pdb): added optional on/off arguments to @pdb
6093 6094 (Magic.magic_run): added option -i to @run, which executes code in
6094 6095 the IPython namespace instead of a clean one. Also added @irun as
6095 6096 an alias to @run -i.
6096 6097
6097 6098 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
6098 6099 fixed (it didn't really do anything, the namespaces were wrong).
6099 6100
6100 6101 * IPython/Debugger.py (__init__): Added workaround for python 2.1
6101 6102
6102 6103 * IPython/__init__.py (__all__): Fixed package namespace, now
6103 6104 'import IPython' does give access to IPython.<all> as
6104 6105 expected. Also renamed __release__ to Release.
6105 6106
6106 6107 * IPython/Debugger.py (__license__): created new Pdb class which
6107 6108 functions like a drop-in for the normal pdb.Pdb but does NOT
6108 6109 import readline by default. This way it doesn't muck up IPython's
6109 6110 readline handling, and now tab-completion finally works in the
6110 6111 debugger -- sort of. It completes things globally visible, but the
6111 6112 completer doesn't track the stack as pdb walks it. That's a bit
6112 6113 tricky, and I'll have to implement it later.
6113 6114
6114 6115 2002-05-05 Fernando Perez <fperez@colorado.edu>
6115 6116
6116 6117 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
6117 6118 magic docstrings when printed via ? (explicit \'s were being
6118 6119 printed).
6119 6120
6120 6121 * IPython/ipmaker.py (make_IPython): fixed namespace
6121 6122 identification bug. Now variables loaded via logs or command-line
6122 6123 files are recognized in the interactive namespace by @who.
6123 6124
6124 6125 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
6125 6126 log replay system stemming from the string form of Structs.
6126 6127
6127 6128 * IPython/Magic.py (Macro.__init__): improved macros to properly
6128 6129 handle magic commands in them.
6129 6130 (Magic.magic_logstart): usernames are now expanded so 'logstart
6130 6131 ~/mylog' now works.
6131 6132
6132 6133 * IPython/iplib.py (complete): fixed bug where paths starting with
6133 6134 '/' would be completed as magic names.
6134 6135
6135 6136 2002-05-04 Fernando Perez <fperez@colorado.edu>
6136 6137
6137 6138 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
6138 6139 allow running full programs under the profiler's control.
6139 6140
6140 6141 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
6141 6142 mode to report exceptions verbosely but without formatting
6142 6143 variables. This addresses the issue of ipython 'freezing' (it's
6143 6144 not frozen, but caught in an expensive formatting loop) when huge
6144 6145 variables are in the context of an exception.
6145 6146 (VerboseTB.text): Added '--->' markers at line where exception was
6146 6147 triggered. Much clearer to read, especially in NoColor modes.
6147 6148
6148 6149 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
6149 6150 implemented in reverse when changing to the new parse_options().
6150 6151
6151 6152 2002-05-03 Fernando Perez <fperez@colorado.edu>
6152 6153
6153 6154 * IPython/Magic.py (Magic.parse_options): new function so that
6154 6155 magics can parse options easier.
6155 6156 (Magic.magic_prun): new function similar to profile.run(),
6156 6157 suggested by Chris Hart.
6157 6158 (Magic.magic_cd): fixed behavior so that it only changes if
6158 6159 directory actually is in history.
6159 6160
6160 6161 * IPython/usage.py (__doc__): added information about potential
6161 6162 slowness of Verbose exception mode when there are huge data
6162 6163 structures to be formatted (thanks to Archie Paulson).
6163 6164
6164 6165 * IPython/ipmaker.py (make_IPython): Changed default logging
6165 6166 (when simply called with -log) to use curr_dir/ipython.log in
6166 6167 rotate mode. Fixed crash which was occuring with -log before
6167 6168 (thanks to Jim Boyle).
6168 6169
6169 6170 2002-05-01 Fernando Perez <fperez@colorado.edu>
6170 6171
6171 6172 * Released 0.2.11 for these fixes (mainly the ultraTB one which
6172 6173 was nasty -- though somewhat of a corner case).
6173 6174
6174 6175 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
6175 6176 text (was a bug).
6176 6177
6177 6178 2002-04-30 Fernando Perez <fperez@colorado.edu>
6178 6179
6179 6180 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
6180 6181 a print after ^D or ^C from the user so that the In[] prompt
6181 6182 doesn't over-run the gnuplot one.
6182 6183
6183 6184 2002-04-29 Fernando Perez <fperez@colorado.edu>
6184 6185
6185 6186 * Released 0.2.10
6186 6187
6187 6188 * IPython/__release__.py (version): get date dynamically.
6188 6189
6189 6190 * Misc. documentation updates thanks to Arnd's comments. Also ran
6190 6191 a full spellcheck on the manual (hadn't been done in a while).
6191 6192
6192 6193 2002-04-27 Fernando Perez <fperez@colorado.edu>
6193 6194
6194 6195 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
6195 6196 starting a log in mid-session would reset the input history list.
6196 6197
6197 6198 2002-04-26 Fernando Perez <fperez@colorado.edu>
6198 6199
6199 6200 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
6200 6201 all files were being included in an update. Now anything in
6201 6202 UserConfig that matches [A-Za-z]*.py will go (this excludes
6202 6203 __init__.py)
6203 6204
6204 6205 2002-04-25 Fernando Perez <fperez@colorado.edu>
6205 6206
6206 6207 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
6207 6208 to __builtins__ so that any form of embedded or imported code can
6208 6209 test for being inside IPython.
6209 6210
6210 6211 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
6211 6212 changed to GnuplotMagic because it's now an importable module,
6212 6213 this makes the name follow that of the standard Gnuplot module.
6213 6214 GnuplotMagic can now be loaded at any time in mid-session.
6214 6215
6215 6216 2002-04-24 Fernando Perez <fperez@colorado.edu>
6216 6217
6217 6218 * IPython/numutils.py: removed SIUnits. It doesn't properly set
6218 6219 the globals (IPython has its own namespace) and the
6219 6220 PhysicalQuantity stuff is much better anyway.
6220 6221
6221 6222 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
6222 6223 embedding example to standard user directory for
6223 6224 distribution. Also put it in the manual.
6224 6225
6225 6226 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
6226 6227 instance as first argument (so it doesn't rely on some obscure
6227 6228 hidden global).
6228 6229
6229 6230 * IPython/UserConfig/ipythonrc.py: put () back in accepted
6230 6231 delimiters. While it prevents ().TAB from working, it allows
6231 6232 completions in open (... expressions. This is by far a more common
6232 6233 case.
6233 6234
6234 6235 2002-04-23 Fernando Perez <fperez@colorado.edu>
6235 6236
6236 6237 * IPython/Extensions/InterpreterPasteInput.py: new
6237 6238 syntax-processing module for pasting lines with >>> or ... at the
6238 6239 start.
6239 6240
6240 6241 * IPython/Extensions/PhysicalQ_Interactive.py
6241 6242 (PhysicalQuantityInteractive.__int__): fixed to work with either
6242 6243 Numeric or math.
6243 6244
6244 6245 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
6245 6246 provided profiles. Now we have:
6246 6247 -math -> math module as * and cmath with its own namespace.
6247 6248 -numeric -> Numeric as *, plus gnuplot & grace
6248 6249 -physics -> same as before
6249 6250
6250 6251 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
6251 6252 user-defined magics wouldn't be found by @magic if they were
6252 6253 defined as class methods. Also cleaned up the namespace search
6253 6254 logic and the string building (to use %s instead of many repeated
6254 6255 string adds).
6255 6256
6256 6257 * IPython/UserConfig/example-magic.py (magic_foo): updated example
6257 6258 of user-defined magics to operate with class methods (cleaner, in
6258 6259 line with the gnuplot code).
6259 6260
6260 6261 2002-04-22 Fernando Perez <fperez@colorado.edu>
6261 6262
6262 6263 * setup.py: updated dependency list so that manual is updated when
6263 6264 all included files change.
6264 6265
6265 6266 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
6266 6267 the delimiter removal option (the fix is ugly right now).
6267 6268
6268 6269 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
6269 6270 all of the math profile (quicker loading, no conflict between
6270 6271 g-9.8 and g-gnuplot).
6271 6272
6272 6273 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
6273 6274 name of post-mortem files to IPython_crash_report.txt.
6274 6275
6275 6276 * Cleanup/update of the docs. Added all the new readline info and
6276 6277 formatted all lists as 'real lists'.
6277 6278
6278 6279 * IPython/ipmaker.py (make_IPython): removed now-obsolete
6279 6280 tab-completion options, since the full readline parse_and_bind is
6280 6281 now accessible.
6281 6282
6282 6283 * IPython/iplib.py (InteractiveShell.init_readline): Changed
6283 6284 handling of readline options. Now users can specify any string to
6284 6285 be passed to parse_and_bind(), as well as the delimiters to be
6285 6286 removed.
6286 6287 (InteractiveShell.__init__): Added __name__ to the global
6287 6288 namespace so that things like Itpl which rely on its existence
6288 6289 don't crash.
6289 6290 (InteractiveShell._prefilter): Defined the default with a _ so
6290 6291 that prefilter() is easier to override, while the default one
6291 6292 remains available.
6292 6293
6293 6294 2002-04-18 Fernando Perez <fperez@colorado.edu>
6294 6295
6295 6296 * Added information about pdb in the docs.
6296 6297
6297 6298 2002-04-17 Fernando Perez <fperez@colorado.edu>
6298 6299
6299 6300 * IPython/ipmaker.py (make_IPython): added rc_override option to
6300 6301 allow passing config options at creation time which may override
6301 6302 anything set in the config files or command line. This is
6302 6303 particularly useful for configuring embedded instances.
6303 6304
6304 6305 2002-04-15 Fernando Perez <fperez@colorado.edu>
6305 6306
6306 6307 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
6307 6308 crash embedded instances because of the input cache falling out of
6308 6309 sync with the output counter.
6309 6310
6310 6311 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
6311 6312 mode which calls pdb after an uncaught exception in IPython itself.
6312 6313
6313 6314 2002-04-14 Fernando Perez <fperez@colorado.edu>
6314 6315
6315 6316 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
6316 6317 readline, fix it back after each call.
6317 6318
6318 6319 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
6319 6320 method to force all access via __call__(), which guarantees that
6320 6321 traceback references are properly deleted.
6321 6322
6322 6323 * IPython/Prompts.py (CachedOutput._display): minor fixes to
6323 6324 improve printing when pprint is in use.
6324 6325
6325 6326 2002-04-13 Fernando Perez <fperez@colorado.edu>
6326 6327
6327 6328 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
6328 6329 exceptions aren't caught anymore. If the user triggers one, he
6329 6330 should know why he's doing it and it should go all the way up,
6330 6331 just like any other exception. So now @abort will fully kill the
6331 6332 embedded interpreter and the embedding code (unless that happens
6332 6333 to catch SystemExit).
6333 6334
6334 6335 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
6335 6336 and a debugger() method to invoke the interactive pdb debugger
6336 6337 after printing exception information. Also added the corresponding
6337 6338 -pdb option and @pdb magic to control this feature, and updated
6338 6339 the docs. After a suggestion from Christopher Hart
6339 6340 (hart-AT-caltech.edu).
6340 6341
6341 6342 2002-04-12 Fernando Perez <fperez@colorado.edu>
6342 6343
6343 6344 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
6344 6345 the exception handlers defined by the user (not the CrashHandler)
6345 6346 so that user exceptions don't trigger an ipython bug report.
6346 6347
6347 6348 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
6348 6349 configurable (it should have always been so).
6349 6350
6350 6351 2002-03-26 Fernando Perez <fperez@colorado.edu>
6351 6352
6352 6353 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
6353 6354 and there to fix embedding namespace issues. This should all be
6354 6355 done in a more elegant way.
6355 6356
6356 6357 2002-03-25 Fernando Perez <fperez@colorado.edu>
6357 6358
6358 6359 * IPython/genutils.py (get_home_dir): Try to make it work under
6359 6360 win9x also.
6360 6361
6361 6362 2002-03-20 Fernando Perez <fperez@colorado.edu>
6362 6363
6363 6364 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
6364 6365 sys.displayhook untouched upon __init__.
6365 6366
6366 6367 2002-03-19 Fernando Perez <fperez@colorado.edu>
6367 6368
6368 6369 * Released 0.2.9 (for embedding bug, basically).
6369 6370
6370 6371 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6371 6372 exceptions so that enclosing shell's state can be restored.
6372 6373
6373 6374 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6374 6375 naming conventions in the .ipython/ dir.
6375 6376
6376 6377 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6377 6378 from delimiters list so filenames with - in them get expanded.
6378 6379
6379 6380 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6380 6381 sys.displayhook not being properly restored after an embedded call.
6381 6382
6382 6383 2002-03-18 Fernando Perez <fperez@colorado.edu>
6383 6384
6384 6385 * Released 0.2.8
6385 6386
6386 6387 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6387 6388 some files weren't being included in a -upgrade.
6388 6389 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6389 6390 on' so that the first tab completes.
6390 6391 (InteractiveShell.handle_magic): fixed bug with spaces around
6391 6392 quotes breaking many magic commands.
6392 6393
6393 6394 * setup.py: added note about ignoring the syntax error messages at
6394 6395 installation.
6395 6396
6396 6397 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6397 6398 streamlining the gnuplot interface, now there's only one magic @gp.
6398 6399
6399 6400 2002-03-17 Fernando Perez <fperez@colorado.edu>
6400 6401
6401 6402 * IPython/UserConfig/magic_gnuplot.py: new name for the
6402 6403 example-magic_pm.py file. Much enhanced system, now with a shell
6403 6404 for communicating directly with gnuplot, one command at a time.
6404 6405
6405 6406 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6406 6407 setting __name__=='__main__'.
6407 6408
6408 6409 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6409 6410 mini-shell for accessing gnuplot from inside ipython. Should
6410 6411 extend it later for grace access too. Inspired by Arnd's
6411 6412 suggestion.
6412 6413
6413 6414 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6414 6415 calling magic functions with () in their arguments. Thanks to Arnd
6415 6416 Baecker for pointing this to me.
6416 6417
6417 6418 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6418 6419 infinitely for integer or complex arrays (only worked with floats).
6419 6420
6420 6421 2002-03-16 Fernando Perez <fperez@colorado.edu>
6421 6422
6422 6423 * setup.py: Merged setup and setup_windows into a single script
6423 6424 which properly handles things for windows users.
6424 6425
6425 6426 2002-03-15 Fernando Perez <fperez@colorado.edu>
6426 6427
6427 6428 * Big change to the manual: now the magics are all automatically
6428 6429 documented. This information is generated from their docstrings
6429 6430 and put in a latex file included by the manual lyx file. This way
6430 6431 we get always up to date information for the magics. The manual
6431 6432 now also has proper version information, also auto-synced.
6432 6433
6433 6434 For this to work, an undocumented --magic_docstrings option was added.
6434 6435
6435 6436 2002-03-13 Fernando Perez <fperez@colorado.edu>
6436 6437
6437 6438 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6438 6439 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6439 6440
6440 6441 2002-03-12 Fernando Perez <fperez@colorado.edu>
6441 6442
6442 6443 * IPython/ultraTB.py (TermColors): changed color escapes again to
6443 6444 fix the (old, reintroduced) line-wrapping bug. Basically, if
6444 6445 \001..\002 aren't given in the color escapes, lines get wrapped
6445 6446 weirdly. But giving those screws up old xterms and emacs terms. So
6446 6447 I added some logic for emacs terms to be ok, but I can't identify old
6447 6448 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6448 6449
6449 6450 2002-03-10 Fernando Perez <fperez@colorado.edu>
6450 6451
6451 6452 * IPython/usage.py (__doc__): Various documentation cleanups and
6452 6453 updates, both in usage docstrings and in the manual.
6453 6454
6454 6455 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6455 6456 handling of caching. Set minimum acceptabe value for having a
6456 6457 cache at 20 values.
6457 6458
6458 6459 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6459 6460 install_first_time function to a method, renamed it and added an
6460 6461 'upgrade' mode. Now people can update their config directory with
6461 6462 a simple command line switch (-upgrade, also new).
6462 6463
6463 6464 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6464 6465 @file (convenient for automagic users under Python >= 2.2).
6465 6466 Removed @files (it seemed more like a plural than an abbrev. of
6466 6467 'file show').
6467 6468
6468 6469 * IPython/iplib.py (install_first_time): Fixed crash if there were
6469 6470 backup files ('~') in .ipython/ install directory.
6470 6471
6471 6472 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6472 6473 system. Things look fine, but these changes are fairly
6473 6474 intrusive. Test them for a few days.
6474 6475
6475 6476 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6476 6477 the prompts system. Now all in/out prompt strings are user
6477 6478 controllable. This is particularly useful for embedding, as one
6478 6479 can tag embedded instances with particular prompts.
6479 6480
6480 6481 Also removed global use of sys.ps1/2, which now allows nested
6481 6482 embeddings without any problems. Added command-line options for
6482 6483 the prompt strings.
6483 6484
6484 6485 2002-03-08 Fernando Perez <fperez@colorado.edu>
6485 6486
6486 6487 * IPython/UserConfig/example-embed-short.py (ipshell): added
6487 6488 example file with the bare minimum code for embedding.
6488 6489
6489 6490 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6490 6491 functionality for the embeddable shell to be activated/deactivated
6491 6492 either globally or at each call.
6492 6493
6493 6494 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6494 6495 rewriting the prompt with '--->' for auto-inputs with proper
6495 6496 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6496 6497 this is handled by the prompts class itself, as it should.
6497 6498
6498 6499 2002-03-05 Fernando Perez <fperez@colorado.edu>
6499 6500
6500 6501 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6501 6502 @logstart to avoid name clashes with the math log function.
6502 6503
6503 6504 * Big updates to X/Emacs section of the manual.
6504 6505
6505 6506 * Removed ipython_emacs. Milan explained to me how to pass
6506 6507 arguments to ipython through Emacs. Some day I'm going to end up
6507 6508 learning some lisp...
6508 6509
6509 6510 2002-03-04 Fernando Perez <fperez@colorado.edu>
6510 6511
6511 6512 * IPython/ipython_emacs: Created script to be used as the
6512 6513 py-python-command Emacs variable so we can pass IPython
6513 6514 parameters. I can't figure out how to tell Emacs directly to pass
6514 6515 parameters to IPython, so a dummy shell script will do it.
6515 6516
6516 6517 Other enhancements made for things to work better under Emacs'
6517 6518 various types of terminals. Many thanks to Milan Zamazal
6518 6519 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6519 6520
6520 6521 2002-03-01 Fernando Perez <fperez@colorado.edu>
6521 6522
6522 6523 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6523 6524 that loading of readline is now optional. This gives better
6524 6525 control to emacs users.
6525 6526
6526 6527 * IPython/ultraTB.py (__date__): Modified color escape sequences
6527 6528 and now things work fine under xterm and in Emacs' term buffers
6528 6529 (though not shell ones). Well, in emacs you get colors, but all
6529 6530 seem to be 'light' colors (no difference between dark and light
6530 6531 ones). But the garbage chars are gone, and also in xterms. It
6531 6532 seems that now I'm using 'cleaner' ansi sequences.
6532 6533
6533 6534 2002-02-21 Fernando Perez <fperez@colorado.edu>
6534 6535
6535 6536 * Released 0.2.7 (mainly to publish the scoping fix).
6536 6537
6537 6538 * IPython/Logger.py (Logger.logstate): added. A corresponding
6538 6539 @logstate magic was created.
6539 6540
6540 6541 * IPython/Magic.py: fixed nested scoping problem under Python
6541 6542 2.1.x (automagic wasn't working).
6542 6543
6543 6544 2002-02-20 Fernando Perez <fperez@colorado.edu>
6544 6545
6545 6546 * Released 0.2.6.
6546 6547
6547 6548 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6548 6549 option so that logs can come out without any headers at all.
6549 6550
6550 6551 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6551 6552 SciPy.
6552 6553
6553 6554 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6554 6555 that embedded IPython calls don't require vars() to be explicitly
6555 6556 passed. Now they are extracted from the caller's frame (code
6556 6557 snatched from Eric Jones' weave). Added better documentation to
6557 6558 the section on embedding and the example file.
6558 6559
6559 6560 * IPython/genutils.py (page): Changed so that under emacs, it just
6560 6561 prints the string. You can then page up and down in the emacs
6561 6562 buffer itself. This is how the builtin help() works.
6562 6563
6563 6564 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6564 6565 macro scoping: macros need to be executed in the user's namespace
6565 6566 to work as if they had been typed by the user.
6566 6567
6567 6568 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6568 6569 execute automatically (no need to type 'exec...'). They then
6569 6570 behave like 'true macros'. The printing system was also modified
6570 6571 for this to work.
6571 6572
6572 6573 2002-02-19 Fernando Perez <fperez@colorado.edu>
6573 6574
6574 6575 * IPython/genutils.py (page_file): new function for paging files
6575 6576 in an OS-independent way. Also necessary for file viewing to work
6576 6577 well inside Emacs buffers.
6577 6578 (page): Added checks for being in an emacs buffer.
6578 6579 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6579 6580 same bug in iplib.
6580 6581
6581 6582 2002-02-18 Fernando Perez <fperez@colorado.edu>
6582 6583
6583 6584 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6584 6585 of readline so that IPython can work inside an Emacs buffer.
6585 6586
6586 6587 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6587 6588 method signatures (they weren't really bugs, but it looks cleaner
6588 6589 and keeps PyChecker happy).
6589 6590
6590 6591 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6591 6592 for implementing various user-defined hooks. Currently only
6592 6593 display is done.
6593 6594
6594 6595 * IPython/Prompts.py (CachedOutput._display): changed display
6595 6596 functions so that they can be dynamically changed by users easily.
6596 6597
6597 6598 * IPython/Extensions/numeric_formats.py (num_display): added an
6598 6599 extension for printing NumPy arrays in flexible manners. It
6599 6600 doesn't do anything yet, but all the structure is in
6600 6601 place. Ultimately the plan is to implement output format control
6601 6602 like in Octave.
6602 6603
6603 6604 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6604 6605 methods are found at run-time by all the automatic machinery.
6605 6606
6606 6607 2002-02-17 Fernando Perez <fperez@colorado.edu>
6607 6608
6608 6609 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6609 6610 whole file a little.
6610 6611
6611 6612 * ToDo: closed this document. Now there's a new_design.lyx
6612 6613 document for all new ideas. Added making a pdf of it for the
6613 6614 end-user distro.
6614 6615
6615 6616 * IPython/Logger.py (Logger.switch_log): Created this to replace
6616 6617 logon() and logoff(). It also fixes a nasty crash reported by
6617 6618 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6618 6619
6619 6620 * IPython/iplib.py (complete): got auto-completion to work with
6620 6621 automagic (I had wanted this for a long time).
6621 6622
6622 6623 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6623 6624 to @file, since file() is now a builtin and clashes with automagic
6624 6625 for @file.
6625 6626
6626 6627 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6627 6628 of this was previously in iplib, which had grown to more than 2000
6628 6629 lines, way too long. No new functionality, but it makes managing
6629 6630 the code a bit easier.
6630 6631
6631 6632 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6632 6633 information to crash reports.
6633 6634
6634 6635 2002-02-12 Fernando Perez <fperez@colorado.edu>
6635 6636
6636 6637 * Released 0.2.5.
6637 6638
6638 6639 2002-02-11 Fernando Perez <fperez@colorado.edu>
6639 6640
6640 6641 * Wrote a relatively complete Windows installer. It puts
6641 6642 everything in place, creates Start Menu entries and fixes the
6642 6643 color issues. Nothing fancy, but it works.
6643 6644
6644 6645 2002-02-10 Fernando Perez <fperez@colorado.edu>
6645 6646
6646 6647 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6647 6648 os.path.expanduser() call so that we can type @run ~/myfile.py and
6648 6649 have thigs work as expected.
6649 6650
6650 6651 * IPython/genutils.py (page): fixed exception handling so things
6651 6652 work both in Unix and Windows correctly. Quitting a pager triggers
6652 6653 an IOError/broken pipe in Unix, and in windows not finding a pager
6653 6654 is also an IOError, so I had to actually look at the return value
6654 6655 of the exception, not just the exception itself. Should be ok now.
6655 6656
6656 6657 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6657 6658 modified to allow case-insensitive color scheme changes.
6658 6659
6659 6660 2002-02-09 Fernando Perez <fperez@colorado.edu>
6660 6661
6661 6662 * IPython/genutils.py (native_line_ends): new function to leave
6662 6663 user config files with os-native line-endings.
6663 6664
6664 6665 * README and manual updates.
6665 6666
6666 6667 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6667 6668 instead of StringType to catch Unicode strings.
6668 6669
6669 6670 * IPython/genutils.py (filefind): fixed bug for paths with
6670 6671 embedded spaces (very common in Windows).
6671 6672
6672 6673 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6673 6674 files under Windows, so that they get automatically associated
6674 6675 with a text editor. Windows makes it a pain to handle
6675 6676 extension-less files.
6676 6677
6677 6678 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6678 6679 warning about readline only occur for Posix. In Windows there's no
6679 6680 way to get readline, so why bother with the warning.
6680 6681
6681 6682 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6682 6683 for __str__ instead of dir(self), since dir() changed in 2.2.
6683 6684
6684 6685 * Ported to Windows! Tested on XP, I suspect it should work fine
6685 6686 on NT/2000, but I don't think it will work on 98 et al. That
6686 6687 series of Windows is such a piece of junk anyway that I won't try
6687 6688 porting it there. The XP port was straightforward, showed a few
6688 6689 bugs here and there (fixed all), in particular some string
6689 6690 handling stuff which required considering Unicode strings (which
6690 6691 Windows uses). This is good, but hasn't been too tested :) No
6691 6692 fancy installer yet, I'll put a note in the manual so people at
6692 6693 least make manually a shortcut.
6693 6694
6694 6695 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6695 6696 into a single one, "colors". This now controls both prompt and
6696 6697 exception color schemes, and can be changed both at startup
6697 6698 (either via command-line switches or via ipythonrc files) and at
6698 6699 runtime, with @colors.
6699 6700 (Magic.magic_run): renamed @prun to @run and removed the old
6700 6701 @run. The two were too similar to warrant keeping both.
6701 6702
6702 6703 2002-02-03 Fernando Perez <fperez@colorado.edu>
6703 6704
6704 6705 * IPython/iplib.py (install_first_time): Added comment on how to
6705 6706 configure the color options for first-time users. Put a <return>
6706 6707 request at the end so that small-terminal users get a chance to
6707 6708 read the startup info.
6708 6709
6709 6710 2002-01-23 Fernando Perez <fperez@colorado.edu>
6710 6711
6711 6712 * IPython/iplib.py (CachedOutput.update): Changed output memory
6712 6713 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6713 6714 input history we still use _i. Did this b/c these variable are
6714 6715 very commonly used in interactive work, so the less we need to
6715 6716 type the better off we are.
6716 6717 (Magic.magic_prun): updated @prun to better handle the namespaces
6717 6718 the file will run in, including a fix for __name__ not being set
6718 6719 before.
6719 6720
6720 6721 2002-01-20 Fernando Perez <fperez@colorado.edu>
6721 6722
6722 6723 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6723 6724 extra garbage for Python 2.2. Need to look more carefully into
6724 6725 this later.
6725 6726
6726 6727 2002-01-19 Fernando Perez <fperez@colorado.edu>
6727 6728
6728 6729 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6729 6730 display SyntaxError exceptions properly formatted when they occur
6730 6731 (they can be triggered by imported code).
6731 6732
6732 6733 2002-01-18 Fernando Perez <fperez@colorado.edu>
6733 6734
6734 6735 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6735 6736 SyntaxError exceptions are reported nicely formatted, instead of
6736 6737 spitting out only offset information as before.
6737 6738 (Magic.magic_prun): Added the @prun function for executing
6738 6739 programs with command line args inside IPython.
6739 6740
6740 6741 2002-01-16 Fernando Perez <fperez@colorado.edu>
6741 6742
6742 6743 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6743 6744 to *not* include the last item given in a range. This brings their
6744 6745 behavior in line with Python's slicing:
6745 6746 a[n1:n2] -> a[n1]...a[n2-1]
6746 6747 It may be a bit less convenient, but I prefer to stick to Python's
6747 6748 conventions *everywhere*, so users never have to wonder.
6748 6749 (Magic.magic_macro): Added @macro function to ease the creation of
6749 6750 macros.
6750 6751
6751 6752 2002-01-05 Fernando Perez <fperez@colorado.edu>
6752 6753
6753 6754 * Released 0.2.4.
6754 6755
6755 6756 * IPython/iplib.py (Magic.magic_pdef):
6756 6757 (InteractiveShell.safe_execfile): report magic lines and error
6757 6758 lines without line numbers so one can easily copy/paste them for
6758 6759 re-execution.
6759 6760
6760 6761 * Updated manual with recent changes.
6761 6762
6762 6763 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6763 6764 docstring printing when class? is called. Very handy for knowing
6764 6765 how to create class instances (as long as __init__ is well
6765 6766 documented, of course :)
6766 6767 (Magic.magic_doc): print both class and constructor docstrings.
6767 6768 (Magic.magic_pdef): give constructor info if passed a class and
6768 6769 __call__ info for callable object instances.
6769 6770
6770 6771 2002-01-04 Fernando Perez <fperez@colorado.edu>
6771 6772
6772 6773 * Made deep_reload() off by default. It doesn't always work
6773 6774 exactly as intended, so it's probably safer to have it off. It's
6774 6775 still available as dreload() anyway, so nothing is lost.
6775 6776
6776 6777 2002-01-02 Fernando Perez <fperez@colorado.edu>
6777 6778
6778 6779 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6779 6780 so I wanted an updated release).
6780 6781
6781 6782 2001-12-27 Fernando Perez <fperez@colorado.edu>
6782 6783
6783 6784 * IPython/iplib.py (InteractiveShell.interact): Added the original
6784 6785 code from 'code.py' for this module in order to change the
6785 6786 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6786 6787 the history cache would break when the user hit Ctrl-C, and
6787 6788 interact() offers no way to add any hooks to it.
6788 6789
6789 6790 2001-12-23 Fernando Perez <fperez@colorado.edu>
6790 6791
6791 6792 * setup.py: added check for 'MANIFEST' before trying to remove
6792 6793 it. Thanks to Sean Reifschneider.
6793 6794
6794 6795 2001-12-22 Fernando Perez <fperez@colorado.edu>
6795 6796
6796 6797 * Released 0.2.2.
6797 6798
6798 6799 * Finished (reasonably) writing the manual. Later will add the
6799 6800 python-standard navigation stylesheets, but for the time being
6800 6801 it's fairly complete. Distribution will include html and pdf
6801 6802 versions.
6802 6803
6803 6804 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6804 6805 (MayaVi author).
6805 6806
6806 6807 2001-12-21 Fernando Perez <fperez@colorado.edu>
6807 6808
6808 6809 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6809 6810 good public release, I think (with the manual and the distutils
6810 6811 installer). The manual can use some work, but that can go
6811 6812 slowly. Otherwise I think it's quite nice for end users. Next
6812 6813 summer, rewrite the guts of it...
6813 6814
6814 6815 * Changed format of ipythonrc files to use whitespace as the
6815 6816 separator instead of an explicit '='. Cleaner.
6816 6817
6817 6818 2001-12-20 Fernando Perez <fperez@colorado.edu>
6818 6819
6819 6820 * Started a manual in LyX. For now it's just a quick merge of the
6820 6821 various internal docstrings and READMEs. Later it may grow into a
6821 6822 nice, full-blown manual.
6822 6823
6823 6824 * Set up a distutils based installer. Installation should now be
6824 6825 trivially simple for end-users.
6825 6826
6826 6827 2001-12-11 Fernando Perez <fperez@colorado.edu>
6827 6828
6828 6829 * Released 0.2.0. First public release, announced it at
6829 6830 comp.lang.python. From now on, just bugfixes...
6830 6831
6831 6832 * Went through all the files, set copyright/license notices and
6832 6833 cleaned up things. Ready for release.
6833 6834
6834 6835 2001-12-10 Fernando Perez <fperez@colorado.edu>
6835 6836
6836 6837 * Changed the first-time installer not to use tarfiles. It's more
6837 6838 robust now and less unix-dependent. Also makes it easier for
6838 6839 people to later upgrade versions.
6839 6840
6840 6841 * Changed @exit to @abort to reflect the fact that it's pretty
6841 6842 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6842 6843 becomes significant only when IPyhton is embedded: in that case,
6843 6844 C-D closes IPython only, but @abort kills the enclosing program
6844 6845 too (unless it had called IPython inside a try catching
6845 6846 SystemExit).
6846 6847
6847 6848 * Created Shell module which exposes the actuall IPython Shell
6848 6849 classes, currently the normal and the embeddable one. This at
6849 6850 least offers a stable interface we won't need to change when
6850 6851 (later) the internals are rewritten. That rewrite will be confined
6851 6852 to iplib and ipmaker, but the Shell interface should remain as is.
6852 6853
6853 6854 * Added embed module which offers an embeddable IPShell object,
6854 6855 useful to fire up IPython *inside* a running program. Great for
6855 6856 debugging or dynamical data analysis.
6856 6857
6857 6858 2001-12-08 Fernando Perez <fperez@colorado.edu>
6858 6859
6859 6860 * Fixed small bug preventing seeing info from methods of defined
6860 6861 objects (incorrect namespace in _ofind()).
6861 6862
6862 6863 * Documentation cleanup. Moved the main usage docstrings to a
6863 6864 separate file, usage.py (cleaner to maintain, and hopefully in the
6864 6865 future some perlpod-like way of producing interactive, man and
6865 6866 html docs out of it will be found).
6866 6867
6867 6868 * Added @profile to see your profile at any time.
6868 6869
6869 6870 * Added @p as an alias for 'print'. It's especially convenient if
6870 6871 using automagic ('p x' prints x).
6871 6872
6872 6873 * Small cleanups and fixes after a pychecker run.
6873 6874
6874 6875 * Changed the @cd command to handle @cd - and @cd -<n> for
6875 6876 visiting any directory in _dh.
6876 6877
6877 6878 * Introduced _dh, a history of visited directories. @dhist prints
6878 6879 it out with numbers.
6879 6880
6880 6881 2001-12-07 Fernando Perez <fperez@colorado.edu>
6881 6882
6882 6883 * Released 0.1.22
6883 6884
6884 6885 * Made initialization a bit more robust against invalid color
6885 6886 options in user input (exit, not traceback-crash).
6886 6887
6887 6888 * Changed the bug crash reporter to write the report only in the
6888 6889 user's .ipython directory. That way IPython won't litter people's
6889 6890 hard disks with crash files all over the place. Also print on
6890 6891 screen the necessary mail command.
6891 6892
6892 6893 * With the new ultraTB, implemented LightBG color scheme for light
6893 6894 background terminals. A lot of people like white backgrounds, so I
6894 6895 guess we should at least give them something readable.
6895 6896
6896 6897 2001-12-06 Fernando Perez <fperez@colorado.edu>
6897 6898
6898 6899 * Modified the structure of ultraTB. Now there's a proper class
6899 6900 for tables of color schemes which allow adding schemes easily and
6900 6901 switching the active scheme without creating a new instance every
6901 6902 time (which was ridiculous). The syntax for creating new schemes
6902 6903 is also cleaner. I think ultraTB is finally done, with a clean
6903 6904 class structure. Names are also much cleaner (now there's proper
6904 6905 color tables, no need for every variable to also have 'color' in
6905 6906 its name).
6906 6907
6907 6908 * Broke down genutils into separate files. Now genutils only
6908 6909 contains utility functions, and classes have been moved to their
6909 6910 own files (they had enough independent functionality to warrant
6910 6911 it): ConfigLoader, OutputTrap, Struct.
6911 6912
6912 6913 2001-12-05 Fernando Perez <fperez@colorado.edu>
6913 6914
6914 6915 * IPython turns 21! Released version 0.1.21, as a candidate for
6915 6916 public consumption. If all goes well, release in a few days.
6916 6917
6917 6918 * Fixed path bug (files in Extensions/ directory wouldn't be found
6918 6919 unless IPython/ was explicitly in sys.path).
6919 6920
6920 6921 * Extended the FlexCompleter class as MagicCompleter to allow
6921 6922 completion of @-starting lines.
6922 6923
6923 6924 * Created __release__.py file as a central repository for release
6924 6925 info that other files can read from.
6925 6926
6926 6927 * Fixed small bug in logging: when logging was turned on in
6927 6928 mid-session, old lines with special meanings (!@?) were being
6928 6929 logged without the prepended comment, which is necessary since
6929 6930 they are not truly valid python syntax. This should make session
6930 6931 restores produce less errors.
6931 6932
6932 6933 * The namespace cleanup forced me to make a FlexCompleter class
6933 6934 which is nothing but a ripoff of rlcompleter, but with selectable
6934 6935 namespace (rlcompleter only works in __main__.__dict__). I'll try
6935 6936 to submit a note to the authors to see if this change can be
6936 6937 incorporated in future rlcompleter releases (Dec.6: done)
6937 6938
6938 6939 * More fixes to namespace handling. It was a mess! Now all
6939 6940 explicit references to __main__.__dict__ are gone (except when
6940 6941 really needed) and everything is handled through the namespace
6941 6942 dicts in the IPython instance. We seem to be getting somewhere
6942 6943 with this, finally...
6943 6944
6944 6945 * Small documentation updates.
6945 6946
6946 6947 * Created the Extensions directory under IPython (with an
6947 6948 __init__.py). Put the PhysicalQ stuff there. This directory should
6948 6949 be used for all special-purpose extensions.
6949 6950
6950 6951 * File renaming:
6951 6952 ipythonlib --> ipmaker
6952 6953 ipplib --> iplib
6953 6954 This makes a bit more sense in terms of what these files actually do.
6954 6955
6955 6956 * Moved all the classes and functions in ipythonlib to ipplib, so
6956 6957 now ipythonlib only has make_IPython(). This will ease up its
6957 6958 splitting in smaller functional chunks later.
6958 6959
6959 6960 * Cleaned up (done, I think) output of @whos. Better column
6960 6961 formatting, and now shows str(var) for as much as it can, which is
6961 6962 typically what one gets with a 'print var'.
6962 6963
6963 6964 2001-12-04 Fernando Perez <fperez@colorado.edu>
6964 6965
6965 6966 * Fixed namespace problems. Now builtin/IPyhton/user names get
6966 6967 properly reported in their namespace. Internal namespace handling
6967 6968 is finally getting decent (not perfect yet, but much better than
6968 6969 the ad-hoc mess we had).
6969 6970
6970 6971 * Removed -exit option. If people just want to run a python
6971 6972 script, that's what the normal interpreter is for. Less
6972 6973 unnecessary options, less chances for bugs.
6973 6974
6974 6975 * Added a crash handler which generates a complete post-mortem if
6975 6976 IPython crashes. This will help a lot in tracking bugs down the
6976 6977 road.
6977 6978
6978 6979 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6979 6980 which were boud to functions being reassigned would bypass the
6980 6981 logger, breaking the sync of _il with the prompt counter. This
6981 6982 would then crash IPython later when a new line was logged.
6982 6983
6983 6984 2001-12-02 Fernando Perez <fperez@colorado.edu>
6984 6985
6985 6986 * Made IPython a package. This means people don't have to clutter
6986 6987 their sys.path with yet another directory. Changed the INSTALL
6987 6988 file accordingly.
6988 6989
6989 6990 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6990 6991 sorts its output (so @who shows it sorted) and @whos formats the
6991 6992 table according to the width of the first column. Nicer, easier to
6992 6993 read. Todo: write a generic table_format() which takes a list of
6993 6994 lists and prints it nicely formatted, with optional row/column
6994 6995 separators and proper padding and justification.
6995 6996
6996 6997 * Released 0.1.20
6997 6998
6998 6999 * Fixed bug in @log which would reverse the inputcache list (a
6999 7000 copy operation was missing).
7000 7001
7001 7002 * Code cleanup. @config was changed to use page(). Better, since
7002 7003 its output is always quite long.
7003 7004
7004 7005 * Itpl is back as a dependency. I was having too many problems
7005 7006 getting the parametric aliases to work reliably, and it's just
7006 7007 easier to code weird string operations with it than playing %()s
7007 7008 games. It's only ~6k, so I don't think it's too big a deal.
7008 7009
7009 7010 * Found (and fixed) a very nasty bug with history. !lines weren't
7010 7011 getting cached, and the out of sync caches would crash
7011 7012 IPython. Fixed it by reorganizing the prefilter/handlers/logger
7012 7013 division of labor a bit better. Bug fixed, cleaner structure.
7013 7014
7014 7015 2001-12-01 Fernando Perez <fperez@colorado.edu>
7015 7016
7016 7017 * Released 0.1.19
7017 7018
7018 7019 * Added option -n to @hist to prevent line number printing. Much
7019 7020 easier to copy/paste code this way.
7020 7021
7021 7022 * Created global _il to hold the input list. Allows easy
7022 7023 re-execution of blocks of code by slicing it (inspired by Janko's
7023 7024 comment on 'macros').
7024 7025
7025 7026 * Small fixes and doc updates.
7026 7027
7027 7028 * Rewrote @history function (was @h). Renamed it to @hist, @h is
7028 7029 much too fragile with automagic. Handles properly multi-line
7029 7030 statements and takes parameters.
7030 7031
7031 7032 2001-11-30 Fernando Perez <fperez@colorado.edu>
7032 7033
7033 7034 * Version 0.1.18 released.
7034 7035
7035 7036 * Fixed nasty namespace bug in initial module imports.
7036 7037
7037 7038 * Added copyright/license notes to all code files (except
7038 7039 DPyGetOpt). For the time being, LGPL. That could change.
7039 7040
7040 7041 * Rewrote a much nicer README, updated INSTALL, cleaned up
7041 7042 ipythonrc-* samples.
7042 7043
7043 7044 * Overall code/documentation cleanup. Basically ready for
7044 7045 release. Only remaining thing: licence decision (LGPL?).
7045 7046
7046 7047 * Converted load_config to a class, ConfigLoader. Now recursion
7047 7048 control is better organized. Doesn't include the same file twice.
7048 7049
7049 7050 2001-11-29 Fernando Perez <fperez@colorado.edu>
7050 7051
7051 7052 * Got input history working. Changed output history variables from
7052 7053 _p to _o so that _i is for input and _o for output. Just cleaner
7053 7054 convention.
7054 7055
7055 7056 * Implemented parametric aliases. This pretty much allows the
7056 7057 alias system to offer full-blown shell convenience, I think.
7057 7058
7058 7059 * Version 0.1.17 released, 0.1.18 opened.
7059 7060
7060 7061 * dot_ipython/ipythonrc (alias): added documentation.
7061 7062 (xcolor): Fixed small bug (xcolors -> xcolor)
7062 7063
7063 7064 * Changed the alias system. Now alias is a magic command to define
7064 7065 aliases just like the shell. Rationale: the builtin magics should
7065 7066 be there for things deeply connected to IPython's
7066 7067 architecture. And this is a much lighter system for what I think
7067 7068 is the really important feature: allowing users to define quickly
7068 7069 magics that will do shell things for them, so they can customize
7069 7070 IPython easily to match their work habits. If someone is really
7070 7071 desperate to have another name for a builtin alias, they can
7071 7072 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
7072 7073 works.
7073 7074
7074 7075 2001-11-28 Fernando Perez <fperez@colorado.edu>
7075 7076
7076 7077 * Changed @file so that it opens the source file at the proper
7077 7078 line. Since it uses less, if your EDITOR environment is
7078 7079 configured, typing v will immediately open your editor of choice
7079 7080 right at the line where the object is defined. Not as quick as
7080 7081 having a direct @edit command, but for all intents and purposes it
7081 7082 works. And I don't have to worry about writing @edit to deal with
7082 7083 all the editors, less does that.
7083 7084
7084 7085 * Version 0.1.16 released, 0.1.17 opened.
7085 7086
7086 7087 * Fixed some nasty bugs in the page/page_dumb combo that could
7087 7088 crash IPython.
7088 7089
7089 7090 2001-11-27 Fernando Perez <fperez@colorado.edu>
7090 7091
7091 7092 * Version 0.1.15 released, 0.1.16 opened.
7092 7093
7093 7094 * Finally got ? and ?? to work for undefined things: now it's
7094 7095 possible to type {}.get? and get information about the get method
7095 7096 of dicts, or os.path? even if only os is defined (so technically
7096 7097 os.path isn't). Works at any level. For example, after import os,
7097 7098 os?, os.path?, os.path.abspath? all work. This is great, took some
7098 7099 work in _ofind.
7099 7100
7100 7101 * Fixed more bugs with logging. The sanest way to do it was to add
7101 7102 to @log a 'mode' parameter. Killed two in one shot (this mode
7102 7103 option was a request of Janko's). I think it's finally clean
7103 7104 (famous last words).
7104 7105
7105 7106 * Added a page_dumb() pager which does a decent job of paging on
7106 7107 screen, if better things (like less) aren't available. One less
7107 7108 unix dependency (someday maybe somebody will port this to
7108 7109 windows).
7109 7110
7110 7111 * Fixed problem in magic_log: would lock of logging out if log
7111 7112 creation failed (because it would still think it had succeeded).
7112 7113
7113 7114 * Improved the page() function using curses to auto-detect screen
7114 7115 size. Now it can make a much better decision on whether to print
7115 7116 or page a string. Option screen_length was modified: a value 0
7116 7117 means auto-detect, and that's the default now.
7117 7118
7118 7119 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
7119 7120 go out. I'll test it for a few days, then talk to Janko about
7120 7121 licences and announce it.
7121 7122
7122 7123 * Fixed the length of the auto-generated ---> prompt which appears
7123 7124 for auto-parens and auto-quotes. Getting this right isn't trivial,
7124 7125 with all the color escapes, different prompt types and optional
7125 7126 separators. But it seems to be working in all the combinations.
7126 7127
7127 7128 2001-11-26 Fernando Perez <fperez@colorado.edu>
7128 7129
7129 7130 * Wrote a regexp filter to get option types from the option names
7130 7131 string. This eliminates the need to manually keep two duplicate
7131 7132 lists.
7132 7133
7133 7134 * Removed the unneeded check_option_names. Now options are handled
7134 7135 in a much saner manner and it's easy to visually check that things
7135 7136 are ok.
7136 7137
7137 7138 * Updated version numbers on all files I modified to carry a
7138 7139 notice so Janko and Nathan have clear version markers.
7139 7140
7140 7141 * Updated docstring for ultraTB with my changes. I should send
7141 7142 this to Nathan.
7142 7143
7143 7144 * Lots of small fixes. Ran everything through pychecker again.
7144 7145
7145 7146 * Made loading of deep_reload an cmd line option. If it's not too
7146 7147 kosher, now people can just disable it. With -nodeep_reload it's
7147 7148 still available as dreload(), it just won't overwrite reload().
7148 7149
7149 7150 * Moved many options to the no| form (-opt and -noopt
7150 7151 accepted). Cleaner.
7151 7152
7152 7153 * Changed magic_log so that if called with no parameters, it uses
7153 7154 'rotate' mode. That way auto-generated logs aren't automatically
7154 7155 over-written. For normal logs, now a backup is made if it exists
7155 7156 (only 1 level of backups). A new 'backup' mode was added to the
7156 7157 Logger class to support this. This was a request by Janko.
7157 7158
7158 7159 * Added @logoff/@logon to stop/restart an active log.
7159 7160
7160 7161 * Fixed a lot of bugs in log saving/replay. It was pretty
7161 7162 broken. Now special lines (!@,/) appear properly in the command
7162 7163 history after a log replay.
7163 7164
7164 7165 * Tried and failed to implement full session saving via pickle. My
7165 7166 idea was to pickle __main__.__dict__, but modules can't be
7166 7167 pickled. This would be a better alternative to replaying logs, but
7167 7168 seems quite tricky to get to work. Changed -session to be called
7168 7169 -logplay, which more accurately reflects what it does. And if we
7169 7170 ever get real session saving working, -session is now available.
7170 7171
7171 7172 * Implemented color schemes for prompts also. As for tracebacks,
7172 7173 currently only NoColor and Linux are supported. But now the
7173 7174 infrastructure is in place, based on a generic ColorScheme
7174 7175 class. So writing and activating new schemes both for the prompts
7175 7176 and the tracebacks should be straightforward.
7176 7177
7177 7178 * Version 0.1.13 released, 0.1.14 opened.
7178 7179
7179 7180 * Changed handling of options for output cache. Now counter is
7180 7181 hardwired starting at 1 and one specifies the maximum number of
7181 7182 entries *in the outcache* (not the max prompt counter). This is
7182 7183 much better, since many statements won't increase the cache
7183 7184 count. It also eliminated some confusing options, now there's only
7184 7185 one: cache_size.
7185 7186
7186 7187 * Added 'alias' magic function and magic_alias option in the
7187 7188 ipythonrc file. Now the user can easily define whatever names he
7188 7189 wants for the magic functions without having to play weird
7189 7190 namespace games. This gives IPython a real shell-like feel.
7190 7191
7191 7192 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
7192 7193 @ or not).
7193 7194
7194 7195 This was one of the last remaining 'visible' bugs (that I know
7195 7196 of). I think if I can clean up the session loading so it works
7196 7197 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
7197 7198 about licensing).
7198 7199
7199 7200 2001-11-25 Fernando Perez <fperez@colorado.edu>
7200 7201
7201 7202 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
7202 7203 there's a cleaner distinction between what ? and ?? show.
7203 7204
7204 7205 * Added screen_length option. Now the user can define his own
7205 7206 screen size for page() operations.
7206 7207
7207 7208 * Implemented magic shell-like functions with automatic code
7208 7209 generation. Now adding another function is just a matter of adding
7209 7210 an entry to a dict, and the function is dynamically generated at
7210 7211 run-time. Python has some really cool features!
7211 7212
7212 7213 * Renamed many options to cleanup conventions a little. Now all
7213 7214 are lowercase, and only underscores where needed. Also in the code
7214 7215 option name tables are clearer.
7215 7216
7216 7217 * Changed prompts a little. Now input is 'In [n]:' instead of
7217 7218 'In[n]:='. This allows it the numbers to be aligned with the
7218 7219 Out[n] numbers, and removes usage of ':=' which doesn't exist in
7219 7220 Python (it was a Mathematica thing). The '...' continuation prompt
7220 7221 was also changed a little to align better.
7221 7222
7222 7223 * Fixed bug when flushing output cache. Not all _p<n> variables
7223 7224 exist, so their deletion needs to be wrapped in a try:
7224 7225
7225 7226 * Figured out how to properly use inspect.formatargspec() (it
7226 7227 requires the args preceded by *). So I removed all the code from
7227 7228 _get_pdef in Magic, which was just replicating that.
7228 7229
7229 7230 * Added test to prefilter to allow redefining magic function names
7230 7231 as variables. This is ok, since the @ form is always available,
7231 7232 but whe should allow the user to define a variable called 'ls' if
7232 7233 he needs it.
7233 7234
7234 7235 * Moved the ToDo information from README into a separate ToDo.
7235 7236
7236 7237 * General code cleanup and small bugfixes. I think it's close to a
7237 7238 state where it can be released, obviously with a big 'beta'
7238 7239 warning on it.
7239 7240
7240 7241 * Got the magic function split to work. Now all magics are defined
7241 7242 in a separate class. It just organizes things a bit, and now
7242 7243 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
7243 7244 was too long).
7244 7245
7245 7246 * Changed @clear to @reset to avoid potential confusions with
7246 7247 the shell command clear. Also renamed @cl to @clear, which does
7247 7248 exactly what people expect it to from their shell experience.
7248 7249
7249 7250 Added a check to the @reset command (since it's so
7250 7251 destructive, it's probably a good idea to ask for confirmation).
7251 7252 But now reset only works for full namespace resetting. Since the
7252 7253 del keyword is already there for deleting a few specific
7253 7254 variables, I don't see the point of having a redundant magic
7254 7255 function for the same task.
7255 7256
7256 7257 2001-11-24 Fernando Perez <fperez@colorado.edu>
7257 7258
7258 7259 * Updated the builtin docs (esp. the ? ones).
7259 7260
7260 7261 * Ran all the code through pychecker. Not terribly impressed with
7261 7262 it: lots of spurious warnings and didn't really find anything of
7262 7263 substance (just a few modules being imported and not used).
7263 7264
7264 7265 * Implemented the new ultraTB functionality into IPython. New
7265 7266 option: xcolors. This chooses color scheme. xmode now only selects
7266 7267 between Plain and Verbose. Better orthogonality.
7267 7268
7268 7269 * Large rewrite of ultraTB. Much cleaner now, with a separation of
7269 7270 mode and color scheme for the exception handlers. Now it's
7270 7271 possible to have the verbose traceback with no coloring.
7271 7272
7272 7273 2001-11-23 Fernando Perez <fperez@colorado.edu>
7273 7274
7274 7275 * Version 0.1.12 released, 0.1.13 opened.
7275 7276
7276 7277 * Removed option to set auto-quote and auto-paren escapes by
7277 7278 user. The chances of breaking valid syntax are just too high. If
7278 7279 someone *really* wants, they can always dig into the code.
7279 7280
7280 7281 * Made prompt separators configurable.
7281 7282
7282 7283 2001-11-22 Fernando Perez <fperez@colorado.edu>
7283 7284
7284 7285 * Small bugfixes in many places.
7285 7286
7286 7287 * Removed the MyCompleter class from ipplib. It seemed redundant
7287 7288 with the C-p,C-n history search functionality. Less code to
7288 7289 maintain.
7289 7290
7290 7291 * Moved all the original ipython.py code into ipythonlib.py. Right
7291 7292 now it's just one big dump into a function called make_IPython, so
7292 7293 no real modularity has been gained. But at least it makes the
7293 7294 wrapper script tiny, and since ipythonlib is a module, it gets
7294 7295 compiled and startup is much faster.
7295 7296
7296 7297 This is a reasobably 'deep' change, so we should test it for a
7297 7298 while without messing too much more with the code.
7298 7299
7299 7300 2001-11-21 Fernando Perez <fperez@colorado.edu>
7300 7301
7301 7302 * Version 0.1.11 released, 0.1.12 opened for further work.
7302 7303
7303 7304 * Removed dependency on Itpl. It was only needed in one place. It
7304 7305 would be nice if this became part of python, though. It makes life
7305 7306 *a lot* easier in some cases.
7306 7307
7307 7308 * Simplified the prefilter code a bit. Now all handlers are
7308 7309 expected to explicitly return a value (at least a blank string).
7309 7310
7310 7311 * Heavy edits in ipplib. Removed the help system altogether. Now
7311 7312 obj?/?? is used for inspecting objects, a magic @doc prints
7312 7313 docstrings, and full-blown Python help is accessed via the 'help'
7313 7314 keyword. This cleans up a lot of code (less to maintain) and does
7314 7315 the job. Since 'help' is now a standard Python component, might as
7315 7316 well use it and remove duplicate functionality.
7316 7317
7317 7318 Also removed the option to use ipplib as a standalone program. By
7318 7319 now it's too dependent on other parts of IPython to function alone.
7319 7320
7320 7321 * Fixed bug in genutils.pager. It would crash if the pager was
7321 7322 exited immediately after opening (broken pipe).
7322 7323
7323 7324 * Trimmed down the VerboseTB reporting a little. The header is
7324 7325 much shorter now and the repeated exception arguments at the end
7325 7326 have been removed. For interactive use the old header seemed a bit
7326 7327 excessive.
7327 7328
7328 7329 * Fixed small bug in output of @whos for variables with multi-word
7329 7330 types (only first word was displayed).
7330 7331
7331 7332 2001-11-17 Fernando Perez <fperez@colorado.edu>
7332 7333
7333 7334 * Version 0.1.10 released, 0.1.11 opened for further work.
7334 7335
7335 7336 * Modified dirs and friends. dirs now *returns* the stack (not
7336 7337 prints), so one can manipulate it as a variable. Convenient to
7337 7338 travel along many directories.
7338 7339
7339 7340 * Fixed bug in magic_pdef: would only work with functions with
7340 7341 arguments with default values.
7341 7342
7342 7343 2001-11-14 Fernando Perez <fperez@colorado.edu>
7343 7344
7344 7345 * Added the PhysicsInput stuff to dot_ipython so it ships as an
7345 7346 example with IPython. Various other minor fixes and cleanups.
7346 7347
7347 7348 * Version 0.1.9 released, 0.1.10 opened for further work.
7348 7349
7349 7350 * Added sys.path to the list of directories searched in the
7350 7351 execfile= option. It used to be the current directory and the
7351 7352 user's IPYTHONDIR only.
7352 7353
7353 7354 2001-11-13 Fernando Perez <fperez@colorado.edu>
7354 7355
7355 7356 * Reinstated the raw_input/prefilter separation that Janko had
7356 7357 initially. This gives a more convenient setup for extending the
7357 7358 pre-processor from the outside: raw_input always gets a string,
7358 7359 and prefilter has to process it. We can then redefine prefilter
7359 7360 from the outside and implement extensions for special
7360 7361 purposes.
7361 7362
7362 7363 Today I got one for inputting PhysicalQuantity objects
7363 7364 (from Scientific) without needing any function calls at
7364 7365 all. Extremely convenient, and it's all done as a user-level
7365 7366 extension (no IPython code was touched). Now instead of:
7366 7367 a = PhysicalQuantity(4.2,'m/s**2')
7367 7368 one can simply say
7368 7369 a = 4.2 m/s**2
7369 7370 or even
7370 7371 a = 4.2 m/s^2
7371 7372
7372 7373 I use this, but it's also a proof of concept: IPython really is
7373 7374 fully user-extensible, even at the level of the parsing of the
7374 7375 command line. It's not trivial, but it's perfectly doable.
7375 7376
7376 7377 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7377 7378 the problem of modules being loaded in the inverse order in which
7378 7379 they were defined in
7379 7380
7380 7381 * Version 0.1.8 released, 0.1.9 opened for further work.
7381 7382
7382 7383 * Added magics pdef, source and file. They respectively show the
7383 7384 definition line ('prototype' in C), source code and full python
7384 7385 file for any callable object. The object inspector oinfo uses
7385 7386 these to show the same information.
7386 7387
7387 7388 * Version 0.1.7 released, 0.1.8 opened for further work.
7388 7389
7389 7390 * Separated all the magic functions into a class called Magic. The
7390 7391 InteractiveShell class was becoming too big for Xemacs to handle
7391 7392 (de-indenting a line would lock it up for 10 seconds while it
7392 7393 backtracked on the whole class!)
7393 7394
7394 7395 FIXME: didn't work. It can be done, but right now namespaces are
7395 7396 all messed up. Do it later (reverted it for now, so at least
7396 7397 everything works as before).
7397 7398
7398 7399 * Got the object introspection system (magic_oinfo) working! I
7399 7400 think this is pretty much ready for release to Janko, so he can
7400 7401 test it for a while and then announce it. Pretty much 100% of what
7401 7402 I wanted for the 'phase 1' release is ready. Happy, tired.
7402 7403
7403 7404 2001-11-12 Fernando Perez <fperez@colorado.edu>
7404 7405
7405 7406 * Version 0.1.6 released, 0.1.7 opened for further work.
7406 7407
7407 7408 * Fixed bug in printing: it used to test for truth before
7408 7409 printing, so 0 wouldn't print. Now checks for None.
7409 7410
7410 7411 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7411 7412 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7412 7413 reaches by hand into the outputcache. Think of a better way to do
7413 7414 this later.
7414 7415
7415 7416 * Various small fixes thanks to Nathan's comments.
7416 7417
7417 7418 * Changed magic_pprint to magic_Pprint. This way it doesn't
7418 7419 collide with pprint() and the name is consistent with the command
7419 7420 line option.
7420 7421
7421 7422 * Changed prompt counter behavior to be fully like
7422 7423 Mathematica's. That is, even input that doesn't return a result
7423 7424 raises the prompt counter. The old behavior was kind of confusing
7424 7425 (getting the same prompt number several times if the operation
7425 7426 didn't return a result).
7426 7427
7427 7428 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7428 7429
7429 7430 * Fixed -Classic mode (wasn't working anymore).
7430 7431
7431 7432 * Added colored prompts using Nathan's new code. Colors are
7432 7433 currently hardwired, they can be user-configurable. For
7433 7434 developers, they can be chosen in file ipythonlib.py, at the
7434 7435 beginning of the CachedOutput class def.
7435 7436
7436 7437 2001-11-11 Fernando Perez <fperez@colorado.edu>
7437 7438
7438 7439 * Version 0.1.5 released, 0.1.6 opened for further work.
7439 7440
7440 7441 * Changed magic_env to *return* the environment as a dict (not to
7441 7442 print it). This way it prints, but it can also be processed.
7442 7443
7443 7444 * Added Verbose exception reporting to interactive
7444 7445 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7445 7446 traceback. Had to make some changes to the ultraTB file. This is
7446 7447 probably the last 'big' thing in my mental todo list. This ties
7447 7448 in with the next entry:
7448 7449
7449 7450 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7450 7451 has to specify is Plain, Color or Verbose for all exception
7451 7452 handling.
7452 7453
7453 7454 * Removed ShellServices option. All this can really be done via
7454 7455 the magic system. It's easier to extend, cleaner and has automatic
7455 7456 namespace protection and documentation.
7456 7457
7457 7458 2001-11-09 Fernando Perez <fperez@colorado.edu>
7458 7459
7459 7460 * Fixed bug in output cache flushing (missing parameter to
7460 7461 __init__). Other small bugs fixed (found using pychecker).
7461 7462
7462 7463 * Version 0.1.4 opened for bugfixing.
7463 7464
7464 7465 2001-11-07 Fernando Perez <fperez@colorado.edu>
7465 7466
7466 7467 * Version 0.1.3 released, mainly because of the raw_input bug.
7467 7468
7468 7469 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7469 7470 and when testing for whether things were callable, a call could
7470 7471 actually be made to certain functions. They would get called again
7471 7472 once 'really' executed, with a resulting double call. A disaster
7472 7473 in many cases (list.reverse() would never work!).
7473 7474
7474 7475 * Removed prefilter() function, moved its code to raw_input (which
7475 7476 after all was just a near-empty caller for prefilter). This saves
7476 7477 a function call on every prompt, and simplifies the class a tiny bit.
7477 7478
7478 7479 * Fix _ip to __ip name in magic example file.
7479 7480
7480 7481 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7481 7482 work with non-gnu versions of tar.
7482 7483
7483 7484 2001-11-06 Fernando Perez <fperez@colorado.edu>
7484 7485
7485 7486 * Version 0.1.2. Just to keep track of the recent changes.
7486 7487
7487 7488 * Fixed nasty bug in output prompt routine. It used to check 'if
7488 7489 arg != None...'. Problem is, this fails if arg implements a
7489 7490 special comparison (__cmp__) which disallows comparing to
7490 7491 None. Found it when trying to use the PhysicalQuantity module from
7491 7492 ScientificPython.
7492 7493
7493 7494 2001-11-05 Fernando Perez <fperez@colorado.edu>
7494 7495
7495 7496 * Also added dirs. Now the pushd/popd/dirs family functions
7496 7497 basically like the shell, with the added convenience of going home
7497 7498 when called with no args.
7498 7499
7499 7500 * pushd/popd slightly modified to mimic shell behavior more
7500 7501 closely.
7501 7502
7502 7503 * Added env,pushd,popd from ShellServices as magic functions. I
7503 7504 think the cleanest will be to port all desired functions from
7504 7505 ShellServices as magics and remove ShellServices altogether. This
7505 7506 will provide a single, clean way of adding functionality
7506 7507 (shell-type or otherwise) to IP.
7507 7508
7508 7509 2001-11-04 Fernando Perez <fperez@colorado.edu>
7509 7510
7510 7511 * Added .ipython/ directory to sys.path. This way users can keep
7511 7512 customizations there and access them via import.
7512 7513
7513 7514 2001-11-03 Fernando Perez <fperez@colorado.edu>
7514 7515
7515 7516 * Opened version 0.1.1 for new changes.
7516 7517
7517 7518 * Changed version number to 0.1.0: first 'public' release, sent to
7518 7519 Nathan and Janko.
7519 7520
7520 7521 * Lots of small fixes and tweaks.
7521 7522
7522 7523 * Minor changes to whos format. Now strings are shown, snipped if
7523 7524 too long.
7524 7525
7525 7526 * Changed ShellServices to work on __main__ so they show up in @who
7526 7527
7527 7528 * Help also works with ? at the end of a line:
7528 7529 ?sin and sin?
7529 7530 both produce the same effect. This is nice, as often I use the
7530 7531 tab-complete to find the name of a method, but I used to then have
7531 7532 to go to the beginning of the line to put a ? if I wanted more
7532 7533 info. Now I can just add the ? and hit return. Convenient.
7533 7534
7534 7535 2001-11-02 Fernando Perez <fperez@colorado.edu>
7535 7536
7536 7537 * Python version check (>=2.1) added.
7537 7538
7538 7539 * Added LazyPython documentation. At this point the docs are quite
7539 7540 a mess. A cleanup is in order.
7540 7541
7541 7542 * Auto-installer created. For some bizarre reason, the zipfiles
7542 7543 module isn't working on my system. So I made a tar version
7543 7544 (hopefully the command line options in various systems won't kill
7544 7545 me).
7545 7546
7546 7547 * Fixes to Struct in genutils. Now all dictionary-like methods are
7547 7548 protected (reasonably).
7548 7549
7549 7550 * Added pager function to genutils and changed ? to print usage
7550 7551 note through it (it was too long).
7551 7552
7552 7553 * Added the LazyPython functionality. Works great! I changed the
7553 7554 auto-quote escape to ';', it's on home row and next to '. But
7554 7555 both auto-quote and auto-paren (still /) escapes are command-line
7555 7556 parameters.
7556 7557
7557 7558
7558 7559 2001-11-01 Fernando Perez <fperez@colorado.edu>
7559 7560
7560 7561 * Version changed to 0.0.7. Fairly large change: configuration now
7561 7562 is all stored in a directory, by default .ipython. There, all
7562 7563 config files have normal looking names (not .names)
7563 7564
7564 7565 * Version 0.0.6 Released first to Lucas and Archie as a test
7565 7566 run. Since it's the first 'semi-public' release, change version to
7566 7567 > 0.0.6 for any changes now.
7567 7568
7568 7569 * Stuff I had put in the ipplib.py changelog:
7569 7570
7570 7571 Changes to InteractiveShell:
7571 7572
7572 7573 - Made the usage message a parameter.
7573 7574
7574 7575 - Require the name of the shell variable to be given. It's a bit
7575 7576 of a hack, but allows the name 'shell' not to be hardwired in the
7576 7577 magic (@) handler, which is problematic b/c it requires
7577 7578 polluting the global namespace with 'shell'. This in turn is
7578 7579 fragile: if a user redefines a variable called shell, things
7579 7580 break.
7580 7581
7581 7582 - magic @: all functions available through @ need to be defined
7582 7583 as magic_<name>, even though they can be called simply as
7583 7584 @<name>. This allows the special command @magic to gather
7584 7585 information automatically about all existing magic functions,
7585 7586 even if they are run-time user extensions, by parsing the shell
7586 7587 instance __dict__ looking for special magic_ names.
7587 7588
7588 7589 - mainloop: added *two* local namespace parameters. This allows
7589 7590 the class to differentiate between parameters which were there
7590 7591 before and after command line initialization was processed. This
7591 7592 way, later @who can show things loaded at startup by the
7592 7593 user. This trick was necessary to make session saving/reloading
7593 7594 really work: ideally after saving/exiting/reloading a session,
7594 7595 *everything* should look the same, including the output of @who. I
7595 7596 was only able to make this work with this double namespace
7596 7597 trick.
7597 7598
7598 7599 - added a header to the logfile which allows (almost) full
7599 7600 session restoring.
7600 7601
7601 7602 - prepend lines beginning with @ or !, with a and log
7602 7603 them. Why? !lines: may be useful to know what you did @lines:
7603 7604 they may affect session state. So when restoring a session, at
7604 7605 least inform the user of their presence. I couldn't quite get
7605 7606 them to properly re-execute, but at least the user is warned.
7606 7607
7607 7608 * Started ChangeLog.
@@ -1,61 +1,62 b''
1 1 """Test cpaste magic"""
2 2
3 3 tests = {'pass': ["> > > run()",
4 4 ">>> > run()",
5 5 "+++ run()",
6 "++ run()"],
6 "++ run()",
7 " >>> run()"],
7 8
8 9 'fail': ["+ + run()",
9 10 " ++ run()"]}
10 11
11 12 from StringIO import StringIO
12 13 import sys
13 14
14 15 stdin_save = sys.stdin
15 16
16 17 # NOTE: no blank lines allowed in function definition
17 18 def testcase(code,should_fail=False):
18 19 """Execute code via 'cpaste' and ensure it was executed, unless
19 20 should_fail is set.
20 21
21 22 """
22 23 _ip.user_ns['code_ran'] = False
23 24 #
24 25 src = StringIO()
25 26 src.write('\n')
26 27 src.write(code)
27 28 src.write('\n--\n')
28 29 src.seek(0)
29 30 #
30 31 sys.stdin = src
31 32
32 33 try:
33 34 cpaste
34 35 except:
35 36 if not should_fail:
36 37 raise AssertionError("Failure not expected : '%s'" %
37 38 code)
38 39 else:
39 40 assert code_ran
40 41 if should_fail:
41 42 raise AssertionError("Failure expected : '%s'" % code)
42 43 #
43 44 finally:
44 45 sys.stdin = stdin_save
45 46 #
46 47
47 48 def run():
48 49 """Marker function: sets a flag when executed.
49 50
50 51 """
51 52 _ip.user_ns['code_ran'] = True
52 53 return 'run' # return string so '+ run()' doesn't result in success
53 54
54 55
55 56 ### Actual testing happens here
56 57
57 58 for code in tests['pass']:
58 59 testcase(code)
59 60
60 61 for code in tests['fail']:
61 62 testcase(code,should_fail=True)
General Comments 0
You need to be logged in to leave comments. Login now