##// END OF EJS Templates
sprinkled UsageError around
vivainio -
Show More
@@ -1,3211 +1,3216 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 2747 2007-09-08 14:01:45Z vivainio $"""
4 $Id: Magic.py 2748 2007-09-08 14:32:40Z vivainio $"""
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. If you are a Debian user,
119 119 it has been removed from the standard Debian package because of its non-free
120 120 license. To use profiling, please install"python2.3-profiler" 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 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 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
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 mode = ''
392 392 try:
393 393 if parameter_s.split()[0] == '-latex':
394 394 mode = 'latex'
395 395 if parameter_s.split()[0] == '-brief':
396 396 mode = 'brief'
397 397 except:
398 398 pass
399 399
400 400 magic_docs = []
401 401 for fname in self.lsmagic():
402 402 mname = 'magic_' + fname
403 403 for space in (Magic,self,self.__class__):
404 404 try:
405 405 fn = space.__dict__[mname]
406 406 except KeyError:
407 407 pass
408 408 else:
409 409 break
410 410 if mode == 'brief':
411 411 # only first line
412 412 fndoc = fn.__doc__.split('\n',1)[0]
413 413 else:
414 414 fndoc = fn.__doc__
415 415
416 416 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
417 417 fname,fndoc))
418 418 magic_docs = ''.join(magic_docs)
419 419
420 420 if mode == 'latex':
421 421 print self.format_latex(magic_docs)
422 422 return
423 423 else:
424 424 magic_docs = self.format_screen(magic_docs)
425 425 if mode == 'brief':
426 426 return magic_docs
427 427
428 428 outmsg = """
429 429 IPython's 'magic' functions
430 430 ===========================
431 431
432 432 The magic function system provides a series of functions which allow you to
433 433 control the behavior of IPython itself, plus a lot of system-type
434 434 features. All these functions are prefixed with a % character, but parameters
435 435 are given without parentheses or quotes.
436 436
437 437 NOTE: If you have 'automagic' enabled (via the command line option or with the
438 438 %automagic function), you don't need to type in the % explicitly. By default,
439 439 IPython ships with automagic on, so you should only rarely need the % escape.
440 440
441 441 Example: typing '%cd mydir' (without the quotes) changes you working directory
442 442 to 'mydir', if it exists.
443 443
444 444 You can define your own magic functions to extend the system. See the supplied
445 445 ipythonrc and example-magic.py files for details (in your ipython
446 446 configuration directory, typically $HOME/.ipython/).
447 447
448 448 You can also define your own aliased names for magic functions. In your
449 449 ipythonrc file, placing a line like:
450 450
451 451 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
452 452
453 453 will define %pf as a new name for %profile.
454 454
455 455 You can also call magics in code using the ipmagic() function, which IPython
456 456 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
457 457
458 458 For a list of the available magic functions, use %lsmagic. For a description
459 459 of any of them, type %magic_name?, e.g. '%cd?'.
460 460
461 461 Currently the magic system has the following functions:\n"""
462 462
463 463 mesc = self.shell.ESC_MAGIC
464 464 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
465 465 "\n\n%s%s\n\n%s" % (outmsg,
466 466 magic_docs,mesc,mesc,
467 467 (' '+mesc).join(self.lsmagic()),
468 468 Magic.auto_status[self.shell.rc.automagic] ) )
469 469
470 470 page(outmsg,screen_lines=self.shell.rc.screen_length)
471 471
472 472
473 473 def magic_autoindent(self, parameter_s = ''):
474 474 """Toggle autoindent on/off (if available)."""
475 475
476 476 self.shell.set_autoindent()
477 477 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
478 478
479 479
480 480 def magic_automagic(self, parameter_s = ''):
481 481 """Make magic functions callable without having to type the initial %.
482 482
483 483 Without argumentsl toggles on/off (when off, you must call it as
484 484 %automagic, of course). With arguments it sets the value, and you can
485 485 use any of (case insensitive):
486 486
487 487 - on,1,True: to activate
488 488
489 489 - off,0,False: to deactivate.
490 490
491 491 Note that magic functions have lowest priority, so if there's a
492 492 variable whose name collides with that of a magic fn, automagic won't
493 493 work for that function (you get the variable instead). However, if you
494 494 delete the variable (del var), the previously shadowed magic function
495 495 becomes visible to automagic again."""
496 496
497 497 rc = self.shell.rc
498 498 arg = parameter_s.lower()
499 499 if parameter_s in ('on','1','true'):
500 500 rc.automagic = True
501 501 elif parameter_s in ('off','0','false'):
502 502 rc.automagic = False
503 503 else:
504 504 rc.automagic = not rc.automagic
505 505 print '\n' + Magic.auto_status[rc.automagic]
506 506
507 507
508 508 def magic_autocall(self, parameter_s = ''):
509 509 """Make functions callable without having to type parentheses.
510 510
511 511 Usage:
512 512
513 513 %autocall [mode]
514 514
515 515 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
516 516 value is toggled on and off (remembering the previous state).
517 517
518 518 In more detail, these values mean:
519 519
520 520 0 -> fully disabled
521 521
522 522 1 -> active, but do not apply if there are no arguments on the line.
523 523
524 524 In this mode, you get:
525 525
526 526 In [1]: callable
527 527 Out[1]: <built-in function callable>
528 528
529 529 In [2]: callable 'hello'
530 530 ------> callable('hello')
531 531 Out[2]: False
532 532
533 533 2 -> Active always. Even if no arguments are present, the callable
534 534 object is called:
535 535
536 536 In [4]: callable
537 537 ------> callable()
538 538
539 539 Note that even with autocall off, you can still use '/' at the start of
540 540 a line to treat the first argument on the command line as a function
541 541 and add parentheses to it:
542 542
543 543 In [8]: /str 43
544 544 ------> str(43)
545 545 Out[8]: '43'
546 546 """
547 547
548 548 rc = self.shell.rc
549 549
550 550 if parameter_s:
551 551 arg = int(parameter_s)
552 552 else:
553 553 arg = 'toggle'
554 554
555 555 if not arg in (0,1,2,'toggle'):
556 556 error('Valid modes: (0->Off, 1->Smart, 2->Full')
557 557 return
558 558
559 559 if arg in (0,1,2):
560 560 rc.autocall = arg
561 561 else: # toggle
562 562 if rc.autocall:
563 563 self._magic_state.autocall_save = rc.autocall
564 564 rc.autocall = 0
565 565 else:
566 566 try:
567 567 rc.autocall = self._magic_state.autocall_save
568 568 except AttributeError:
569 569 rc.autocall = self._magic_state.autocall_save = 1
570 570
571 571 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
572 572
573 573 def magic_system_verbose(self, parameter_s = ''):
574 574 """Set verbose printing of system calls.
575 575
576 576 If called without an argument, act as a toggle"""
577 577
578 578 if parameter_s:
579 579 val = bool(eval(parameter_s))
580 580 else:
581 581 val = None
582 582
583 583 self.shell.rc_set_toggle('system_verbose',val)
584 584 print "System verbose printing is:",\
585 585 ['OFF','ON'][self.shell.rc.system_verbose]
586 586
587 587
588 588 def magic_page(self, parameter_s=''):
589 589 """Pretty print the object and display it through a pager.
590 590
591 591 %page [options] OBJECT
592 592
593 593 If no object is given, use _ (last output).
594 594
595 595 Options:
596 596
597 597 -r: page str(object), don't pretty-print it."""
598 598
599 599 # After a function contributed by Olivier Aubert, slightly modified.
600 600
601 601 # Process options/args
602 602 opts,args = self.parse_options(parameter_s,'r')
603 603 raw = 'r' in opts
604 604
605 605 oname = args and args or '_'
606 606 info = self._ofind(oname)
607 607 if info['found']:
608 608 txt = (raw and str or pformat)( info['obj'] )
609 609 page(txt)
610 610 else:
611 611 print 'Object `%s` not found' % oname
612 612
613 613 def magic_profile(self, parameter_s=''):
614 614 """Print your currently active IPyhton profile."""
615 615 if self.shell.rc.profile:
616 616 printpl('Current IPython profile: $self.shell.rc.profile.')
617 617 else:
618 618 print 'No profile active.'
619 619
620 620 def magic_pinfo(self, parameter_s='', namespaces=None):
621 621 """Provide detailed information about an object.
622 622
623 623 '%pinfo object' is just a synonym for object? or ?object."""
624 624
625 625 #print 'pinfo par: <%s>' % parameter_s # dbg
626 626
627 627
628 628 # detail_level: 0 -> obj? , 1 -> obj??
629 629 detail_level = 0
630 630 # We need to detect if we got called as 'pinfo pinfo foo', which can
631 631 # happen if the user types 'pinfo foo?' at the cmd line.
632 632 pinfo,qmark1,oname,qmark2 = \
633 633 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
634 634 if pinfo or qmark1 or qmark2:
635 635 detail_level = 1
636 636 if "*" in oname:
637 637 self.magic_psearch(oname)
638 638 else:
639 639 self._inspect('pinfo', oname, detail_level=detail_level,
640 640 namespaces=namespaces)
641 641
642 642 def magic_pdef(self, parameter_s='', namespaces=None):
643 643 """Print the definition header for any callable object.
644 644
645 645 If the object is a class, print the constructor information."""
646 646 self._inspect('pdef',parameter_s, namespaces)
647 647
648 648 def magic_pdoc(self, parameter_s='', namespaces=None):
649 649 """Print the docstring for an object.
650 650
651 651 If the given object is a class, it will print both the class and the
652 652 constructor docstrings."""
653 653 self._inspect('pdoc',parameter_s, namespaces)
654 654
655 655 def magic_psource(self, parameter_s='', namespaces=None):
656 656 """Print (or run through pager) the source code for an object."""
657 657 self._inspect('psource',parameter_s, namespaces)
658 658
659 659 def magic_pfile(self, parameter_s=''):
660 660 """Print (or run through pager) the file where an object is defined.
661 661
662 662 The file opens at the line where the object definition begins. IPython
663 663 will honor the environment variable PAGER if set, and otherwise will
664 664 do its best to print the file in a convenient form.
665 665
666 666 If the given argument is not an object currently defined, IPython will
667 667 try to interpret it as a filename (automatically adding a .py extension
668 668 if needed). You can thus use %pfile as a syntax highlighting code
669 669 viewer."""
670 670
671 671 # first interpret argument as an object name
672 672 out = self._inspect('pfile',parameter_s)
673 673 # if not, try the input as a filename
674 674 if out == 'not found':
675 675 try:
676 676 filename = get_py_filename(parameter_s)
677 677 except IOError,msg:
678 678 print msg
679 679 return
680 680 page(self.shell.inspector.format(file(filename).read()))
681 681
682 682 def _inspect(self,meth,oname,namespaces=None,**kw):
683 683 """Generic interface to the inspector system.
684 684
685 685 This function is meant to be called by pdef, pdoc & friends."""
686 686
687 687 #oname = oname.strip()
688 688 #print '1- oname: <%r>' % oname # dbg
689 689 try:
690 690 oname = oname.strip().encode('ascii')
691 691 #print '2- oname: <%r>' % oname # dbg
692 692 except UnicodeEncodeError:
693 693 print 'Python identifiers can only contain ascii characters.'
694 694 return 'not found'
695 695
696 696 info = Struct(self._ofind(oname, namespaces))
697 697
698 698 if info.found:
699 699 try:
700 700 IPython.generics.inspect_object(info.obj)
701 701 return
702 702 except IPython.ipapi.TryNext:
703 703 pass
704 704 # Get the docstring of the class property if it exists.
705 705 path = oname.split('.')
706 706 root = '.'.join(path[:-1])
707 707 if info.parent is not None:
708 708 try:
709 709 target = getattr(info.parent, '__class__')
710 710 # The object belongs to a class instance.
711 711 try:
712 712 target = getattr(target, path[-1])
713 713 # The class defines the object.
714 714 if isinstance(target, property):
715 715 oname = root + '.__class__.' + path[-1]
716 716 info = Struct(self._ofind(oname))
717 717 except AttributeError: pass
718 718 except AttributeError: pass
719 719
720 720 pmethod = getattr(self.shell.inspector,meth)
721 721 formatter = info.ismagic and self.format_screen or None
722 722 if meth == 'pdoc':
723 723 pmethod(info.obj,oname,formatter)
724 724 elif meth == 'pinfo':
725 725 pmethod(info.obj,oname,formatter,info,**kw)
726 726 else:
727 727 pmethod(info.obj,oname)
728 728 else:
729 729 print 'Object `%s` not found.' % oname
730 730 return 'not found' # so callers can take other action
731 731
732 732 def magic_psearch(self, parameter_s=''):
733 733 """Search for object in namespaces by wildcard.
734 734
735 735 %psearch [options] PATTERN [OBJECT TYPE]
736 736
737 737 Note: ? can be used as a synonym for %psearch, at the beginning or at
738 738 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
739 739 rest of the command line must be unchanged (options come first), so
740 740 for example the following forms are equivalent
741 741
742 742 %psearch -i a* function
743 743 -i a* function?
744 744 ?-i a* function
745 745
746 746 Arguments:
747 747
748 748 PATTERN
749 749
750 750 where PATTERN is a string containing * as a wildcard similar to its
751 751 use in a shell. The pattern is matched in all namespaces on the
752 752 search path. By default objects starting with a single _ are not
753 753 matched, many IPython generated objects have a single
754 754 underscore. The default is case insensitive matching. Matching is
755 755 also done on the attributes of objects and not only on the objects
756 756 in a module.
757 757
758 758 [OBJECT TYPE]
759 759
760 760 Is the name of a python type from the types module. The name is
761 761 given in lowercase without the ending type, ex. StringType is
762 762 written string. By adding a type here only objects matching the
763 763 given type are matched. Using all here makes the pattern match all
764 764 types (this is the default).
765 765
766 766 Options:
767 767
768 768 -a: makes the pattern match even objects whose names start with a
769 769 single underscore. These names are normally ommitted from the
770 770 search.
771 771
772 772 -i/-c: make the pattern case insensitive/sensitive. If neither of
773 773 these options is given, the default is read from your ipythonrc
774 774 file. The option name which sets this value is
775 775 'wildcards_case_sensitive'. If this option is not specified in your
776 776 ipythonrc file, IPython's internal default is to do a case sensitive
777 777 search.
778 778
779 779 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
780 780 specifiy can be searched in any of the following namespaces:
781 781 'builtin', 'user', 'user_global','internal', 'alias', where
782 782 'builtin' and 'user' are the search defaults. Note that you should
783 783 not use quotes when specifying namespaces.
784 784
785 785 'Builtin' contains the python module builtin, 'user' contains all
786 786 user data, 'alias' only contain the shell aliases and no python
787 787 objects, 'internal' contains objects used by IPython. The
788 788 'user_global' namespace is only used by embedded IPython instances,
789 789 and it contains module-level globals. You can add namespaces to the
790 790 search with -s or exclude them with -e (these options can be given
791 791 more than once).
792 792
793 793 Examples:
794 794
795 795 %psearch a* -> objects beginning with an a
796 796 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
797 797 %psearch a* function -> all functions beginning with an a
798 798 %psearch re.e* -> objects beginning with an e in module re
799 799 %psearch r*.e* -> objects that start with e in modules starting in r
800 800 %psearch r*.* string -> all strings in modules beginning with r
801 801
802 802 Case sensitve search:
803 803
804 804 %psearch -c a* list all object beginning with lower case a
805 805
806 806 Show objects beginning with a single _:
807 807
808 808 %psearch -a _* list objects beginning with a single underscore"""
809 809 try:
810 810 parameter_s = parameter_s.encode('ascii')
811 811 except UnicodeEncodeError:
812 812 print 'Python identifiers can only contain ascii characters.'
813 813 return
814 814
815 815 # default namespaces to be searched
816 816 def_search = ['user','builtin']
817 817
818 818 # Process options/args
819 819 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
820 820 opt = opts.get
821 821 shell = self.shell
822 822 psearch = shell.inspector.psearch
823 823
824 824 # select case options
825 825 if opts.has_key('i'):
826 826 ignore_case = True
827 827 elif opts.has_key('c'):
828 828 ignore_case = False
829 829 else:
830 830 ignore_case = not shell.rc.wildcards_case_sensitive
831 831
832 832 # Build list of namespaces to search from user options
833 833 def_search.extend(opt('s',[]))
834 834 ns_exclude = ns_exclude=opt('e',[])
835 835 ns_search = [nm for nm in def_search if nm not in ns_exclude]
836 836
837 837 # Call the actual search
838 838 try:
839 839 psearch(args,shell.ns_table,ns_search,
840 840 show_all=opt('a'),ignore_case=ignore_case)
841 841 except:
842 842 shell.showtraceback()
843 843
844 844 def magic_who_ls(self, parameter_s=''):
845 845 """Return a sorted list of all interactive variables.
846 846
847 847 If arguments are given, only variables of types matching these
848 848 arguments are returned."""
849 849
850 850 user_ns = self.shell.user_ns
851 851 internal_ns = self.shell.internal_ns
852 852 user_config_ns = self.shell.user_config_ns
853 853 out = []
854 854 typelist = parameter_s.split()
855 855
856 856 for i in user_ns:
857 857 if not (i.startswith('_') or i.startswith('_i')) \
858 858 and not (i in internal_ns or i in user_config_ns):
859 859 if typelist:
860 860 if type(user_ns[i]).__name__ in typelist:
861 861 out.append(i)
862 862 else:
863 863 out.append(i)
864 864 out.sort()
865 865 return out
866 866
867 867 def magic_who(self, parameter_s=''):
868 868 """Print all interactive variables, with some minimal formatting.
869 869
870 870 If any arguments are given, only variables whose type matches one of
871 871 these are printed. For example:
872 872
873 873 %who function str
874 874
875 875 will only list functions and strings, excluding all other types of
876 876 variables. To find the proper type names, simply use type(var) at a
877 877 command line to see how python prints type names. For example:
878 878
879 879 In [1]: type('hello')\\
880 880 Out[1]: <type 'str'>
881 881
882 882 indicates that the type name for strings is 'str'.
883 883
884 884 %who always excludes executed names loaded through your configuration
885 885 file and things which are internal to IPython.
886 886
887 887 This is deliberate, as typically you may load many modules and the
888 888 purpose of %who is to show you only what you've manually defined."""
889 889
890 890 varlist = self.magic_who_ls(parameter_s)
891 891 if not varlist:
892 892 if parameter_s:
893 893 print 'No variables match your requested type.'
894 894 else:
895 895 print 'Interactive namespace is empty.'
896 896 return
897 897
898 898 # if we have variables, move on...
899 899 count = 0
900 900 for i in varlist:
901 901 print i+'\t',
902 902 count += 1
903 903 if count > 8:
904 904 count = 0
905 905 print
906 906 print
907 907
908 908 def magic_whos(self, parameter_s=''):
909 909 """Like %who, but gives some extra information about each variable.
910 910
911 911 The same type filtering of %who can be applied here.
912 912
913 913 For all variables, the type is printed. Additionally it prints:
914 914
915 915 - For {},[],(): their length.
916 916
917 917 - For numpy and Numeric arrays, a summary with shape, number of
918 918 elements, typecode and size in memory.
919 919
920 920 - Everything else: a string representation, snipping their middle if
921 921 too long."""
922 922
923 923 varnames = self.magic_who_ls(parameter_s)
924 924 if not varnames:
925 925 if parameter_s:
926 926 print 'No variables match your requested type.'
927 927 else:
928 928 print 'Interactive namespace is empty.'
929 929 return
930 930
931 931 # if we have variables, move on...
932 932
933 933 # for these types, show len() instead of data:
934 934 seq_types = [types.DictType,types.ListType,types.TupleType]
935 935
936 936 # for numpy/Numeric arrays, display summary info
937 937 try:
938 938 import numpy
939 939 except ImportError:
940 940 ndarray_type = None
941 941 else:
942 942 ndarray_type = numpy.ndarray.__name__
943 943 try:
944 944 import Numeric
945 945 except ImportError:
946 946 array_type = None
947 947 else:
948 948 array_type = Numeric.ArrayType.__name__
949 949
950 950 # Find all variable names and types so we can figure out column sizes
951 951 def get_vars(i):
952 952 return self.shell.user_ns[i]
953 953
954 954 # some types are well known and can be shorter
955 955 abbrevs = {'IPython.macro.Macro' : 'Macro'}
956 956 def type_name(v):
957 957 tn = type(v).__name__
958 958 return abbrevs.get(tn,tn)
959 959
960 960 varlist = map(get_vars,varnames)
961 961
962 962 typelist = []
963 963 for vv in varlist:
964 964 tt = type_name(vv)
965 965
966 966 if tt=='instance':
967 967 typelist.append( abbrevs.get(str(vv.__class__),
968 968 str(vv.__class__)))
969 969 else:
970 970 typelist.append(tt)
971 971
972 972 # column labels and # of spaces as separator
973 973 varlabel = 'Variable'
974 974 typelabel = 'Type'
975 975 datalabel = 'Data/Info'
976 976 colsep = 3
977 977 # variable format strings
978 978 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
979 979 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
980 980 aformat = "%s: %s elems, type `%s`, %s bytes"
981 981 # find the size of the columns to format the output nicely
982 982 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
983 983 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
984 984 # table header
985 985 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
986 986 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
987 987 # and the table itself
988 988 kb = 1024
989 989 Mb = 1048576 # kb**2
990 990 for vname,var,vtype in zip(varnames,varlist,typelist):
991 991 print itpl(vformat),
992 992 if vtype in seq_types:
993 993 print len(var)
994 994 elif vtype in [array_type,ndarray_type]:
995 995 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
996 996 if vtype==ndarray_type:
997 997 # numpy
998 998 vsize = var.size
999 999 vbytes = vsize*var.itemsize
1000 1000 vdtype = var.dtype
1001 1001 else:
1002 1002 # Numeric
1003 1003 vsize = Numeric.size(var)
1004 1004 vbytes = vsize*var.itemsize()
1005 1005 vdtype = var.typecode()
1006 1006
1007 1007 if vbytes < 100000:
1008 1008 print aformat % (vshape,vsize,vdtype,vbytes)
1009 1009 else:
1010 1010 print aformat % (vshape,vsize,vdtype,vbytes),
1011 1011 if vbytes < Mb:
1012 1012 print '(%s kb)' % (vbytes/kb,)
1013 1013 else:
1014 1014 print '(%s Mb)' % (vbytes/Mb,)
1015 1015 else:
1016 1016 try:
1017 1017 vstr = str(var)
1018 1018 except UnicodeEncodeError:
1019 1019 vstr = unicode(var).encode(sys.getdefaultencoding(),
1020 1020 'backslashreplace')
1021 1021 vstr = vstr.replace('\n','\\n')
1022 1022 if len(vstr) < 50:
1023 1023 print vstr
1024 1024 else:
1025 1025 printpl(vfmt_short)
1026 1026
1027 1027 def magic_reset(self, parameter_s=''):
1028 1028 """Resets the namespace by removing all names defined by the user.
1029 1029
1030 1030 Input/Output history are left around in case you need them."""
1031 1031
1032 1032 ans = self.shell.ask_yes_no(
1033 1033 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1034 1034 if not ans:
1035 1035 print 'Nothing done.'
1036 1036 return
1037 1037 user_ns = self.shell.user_ns
1038 1038 for i in self.magic_who_ls():
1039 1039 del(user_ns[i])
1040 1040
1041 1041 def magic_logstart(self,parameter_s=''):
1042 1042 """Start logging anywhere in a session.
1043 1043
1044 1044 %logstart [-o|-r|-t] [log_name [log_mode]]
1045 1045
1046 1046 If no name is given, it defaults to a file named 'ipython_log.py' in your
1047 1047 current directory, in 'rotate' mode (see below).
1048 1048
1049 1049 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1050 1050 history up to that point and then continues logging.
1051 1051
1052 1052 %logstart takes a second optional parameter: logging mode. This can be one
1053 1053 of (note that the modes are given unquoted):\\
1054 1054 append: well, that says it.\\
1055 1055 backup: rename (if exists) to name~ and start name.\\
1056 1056 global: single logfile in your home dir, appended to.\\
1057 1057 over : overwrite existing log.\\
1058 1058 rotate: create rotating logs name.1~, name.2~, etc.
1059 1059
1060 1060 Options:
1061 1061
1062 1062 -o: log also IPython's output. In this mode, all commands which
1063 1063 generate an Out[NN] prompt are recorded to the logfile, right after
1064 1064 their corresponding input line. The output lines are always
1065 1065 prepended with a '#[Out]# ' marker, so that the log remains valid
1066 1066 Python code.
1067 1067
1068 1068 Since this marker is always the same, filtering only the output from
1069 1069 a log is very easy, using for example a simple awk call:
1070 1070
1071 1071 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1072 1072
1073 1073 -r: log 'raw' input. Normally, IPython's logs contain the processed
1074 1074 input, so that user lines are logged in their final form, converted
1075 1075 into valid Python. For example, %Exit is logged as
1076 1076 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1077 1077 exactly as typed, with no transformations applied.
1078 1078
1079 1079 -t: put timestamps before each input line logged (these are put in
1080 1080 comments)."""
1081 1081
1082 1082 opts,par = self.parse_options(parameter_s,'ort')
1083 1083 log_output = 'o' in opts
1084 1084 log_raw_input = 'r' in opts
1085 1085 timestamp = 't' in opts
1086 1086
1087 1087 rc = self.shell.rc
1088 1088 logger = self.shell.logger
1089 1089
1090 1090 # if no args are given, the defaults set in the logger constructor by
1091 1091 # ipytohn remain valid
1092 1092 if par:
1093 1093 try:
1094 1094 logfname,logmode = par.split()
1095 1095 except:
1096 1096 logfname = par
1097 1097 logmode = 'backup'
1098 1098 else:
1099 1099 logfname = logger.logfname
1100 1100 logmode = logger.logmode
1101 1101 # put logfname into rc struct as if it had been called on the command
1102 1102 # line, so it ends up saved in the log header Save it in case we need
1103 1103 # to restore it...
1104 1104 old_logfile = rc.opts.get('logfile','')
1105 1105 if logfname:
1106 1106 logfname = os.path.expanduser(logfname)
1107 1107 rc.opts.logfile = logfname
1108 1108 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1109 1109 try:
1110 1110 started = logger.logstart(logfname,loghead,logmode,
1111 1111 log_output,timestamp,log_raw_input)
1112 1112 except:
1113 1113 rc.opts.logfile = old_logfile
1114 1114 warn("Couldn't start log: %s" % sys.exc_info()[1])
1115 1115 else:
1116 1116 # log input history up to this point, optionally interleaving
1117 1117 # output if requested
1118 1118
1119 1119 if timestamp:
1120 1120 # disable timestamping for the previous history, since we've
1121 1121 # lost those already (no time machine here).
1122 1122 logger.timestamp = False
1123 1123
1124 1124 if log_raw_input:
1125 1125 input_hist = self.shell.input_hist_raw
1126 1126 else:
1127 1127 input_hist = self.shell.input_hist
1128 1128
1129 1129 if log_output:
1130 1130 log_write = logger.log_write
1131 1131 output_hist = self.shell.output_hist
1132 1132 for n in range(1,len(input_hist)-1):
1133 1133 log_write(input_hist[n].rstrip())
1134 1134 if n in output_hist:
1135 1135 log_write(repr(output_hist[n]),'output')
1136 1136 else:
1137 1137 logger.log_write(input_hist[1:])
1138 1138 if timestamp:
1139 1139 # re-enable timestamping
1140 1140 logger.timestamp = True
1141 1141
1142 1142 print ('Activating auto-logging. '
1143 1143 'Current session state plus future input saved.')
1144 1144 logger.logstate()
1145 1145
1146 1146 def magic_logoff(self,parameter_s=''):
1147 1147 """Temporarily stop logging.
1148 1148
1149 1149 You must have previously started logging."""
1150 1150 self.shell.logger.switch_log(0)
1151 1151
1152 1152 def magic_logon(self,parameter_s=''):
1153 1153 """Restart logging.
1154 1154
1155 1155 This function is for restarting logging which you've temporarily
1156 1156 stopped with %logoff. For starting logging for the first time, you
1157 1157 must use the %logstart function, which allows you to specify an
1158 1158 optional log filename."""
1159 1159
1160 1160 self.shell.logger.switch_log(1)
1161 1161
1162 1162 def magic_logstate(self,parameter_s=''):
1163 1163 """Print the status of the logging system."""
1164 1164
1165 1165 self.shell.logger.logstate()
1166 1166
1167 1167 def magic_pdb(self, parameter_s=''):
1168 1168 """Control the automatic calling of the pdb interactive debugger.
1169 1169
1170 1170 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1171 1171 argument it works as a toggle.
1172 1172
1173 1173 When an exception is triggered, IPython can optionally call the
1174 1174 interactive pdb debugger after the traceback printout. %pdb toggles
1175 1175 this feature on and off.
1176 1176
1177 1177 The initial state of this feature is set in your ipythonrc
1178 1178 configuration file (the variable is called 'pdb').
1179 1179
1180 1180 If you want to just activate the debugger AFTER an exception has fired,
1181 1181 without having to type '%pdb on' and rerunning your code, you can use
1182 1182 the %debug magic."""
1183 1183
1184 1184 par = parameter_s.strip().lower()
1185 1185
1186 1186 if par:
1187 1187 try:
1188 1188 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1189 1189 except KeyError:
1190 1190 print ('Incorrect argument. Use on/1, off/0, '
1191 1191 'or nothing for a toggle.')
1192 1192 return
1193 1193 else:
1194 1194 # toggle
1195 1195 new_pdb = not self.shell.call_pdb
1196 1196
1197 1197 # set on the shell
1198 1198 self.shell.call_pdb = new_pdb
1199 1199 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1200 1200
1201 1201 def magic_debug(self, parameter_s=''):
1202 1202 """Activate the interactive debugger in post-mortem mode.
1203 1203
1204 1204 If an exception has just occurred, this lets you inspect its stack
1205 1205 frames interactively. Note that this will always work only on the last
1206 1206 traceback that occurred, so you must call this quickly after an
1207 1207 exception that you wish to inspect has fired, because if another one
1208 1208 occurs, it clobbers the previous one.
1209 1209
1210 1210 If you want IPython to automatically do this on every exception, see
1211 1211 the %pdb magic for more details.
1212 1212 """
1213 1213
1214 1214 self.shell.debugger(force=True)
1215 1215
1216 1216 def magic_prun(self, parameter_s ='',user_mode=1,
1217 1217 opts=None,arg_lst=None,prog_ns=None):
1218 1218
1219 1219 """Run a statement through the python code profiler.
1220 1220
1221 1221 Usage:\\
1222 1222 %prun [options] statement
1223 1223
1224 1224 The given statement (which doesn't require quote marks) is run via the
1225 1225 python profiler in a manner similar to the profile.run() function.
1226 1226 Namespaces are internally managed to work correctly; profile.run
1227 1227 cannot be used in IPython because it makes certain assumptions about
1228 1228 namespaces which do not hold under IPython.
1229 1229
1230 1230 Options:
1231 1231
1232 1232 -l <limit>: you can place restrictions on what or how much of the
1233 1233 profile gets printed. The limit value can be:
1234 1234
1235 1235 * A string: only information for function names containing this string
1236 1236 is printed.
1237 1237
1238 1238 * An integer: only these many lines are printed.
1239 1239
1240 1240 * A float (between 0 and 1): this fraction of the report is printed
1241 1241 (for example, use a limit of 0.4 to see the topmost 40% only).
1242 1242
1243 1243 You can combine several limits with repeated use of the option. For
1244 1244 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1245 1245 information about class constructors.
1246 1246
1247 1247 -r: return the pstats.Stats object generated by the profiling. This
1248 1248 object has all the information about the profile in it, and you can
1249 1249 later use it for further analysis or in other functions.
1250 1250
1251 1251 -s <key>: sort profile by given key. You can provide more than one key
1252 1252 by using the option several times: '-s key1 -s key2 -s key3...'. The
1253 1253 default sorting key is 'time'.
1254 1254
1255 1255 The following is copied verbatim from the profile documentation
1256 1256 referenced below:
1257 1257
1258 1258 When more than one key is provided, additional keys are used as
1259 1259 secondary criteria when the there is equality in all keys selected
1260 1260 before them.
1261 1261
1262 1262 Abbreviations can be used for any key names, as long as the
1263 1263 abbreviation is unambiguous. The following are the keys currently
1264 1264 defined:
1265 1265
1266 1266 Valid Arg Meaning\\
1267 1267 "calls" call count\\
1268 1268 "cumulative" cumulative time\\
1269 1269 "file" file name\\
1270 1270 "module" file name\\
1271 1271 "pcalls" primitive call count\\
1272 1272 "line" line number\\
1273 1273 "name" function name\\
1274 1274 "nfl" name/file/line\\
1275 1275 "stdname" standard name\\
1276 1276 "time" internal time
1277 1277
1278 1278 Note that all sorts on statistics are in descending order (placing
1279 1279 most time consuming items first), where as name, file, and line number
1280 1280 searches are in ascending order (i.e., alphabetical). The subtle
1281 1281 distinction between "nfl" and "stdname" is that the standard name is a
1282 1282 sort of the name as printed, which means that the embedded line
1283 1283 numbers get compared in an odd way. For example, lines 3, 20, and 40
1284 1284 would (if the file names were the same) appear in the string order
1285 1285 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1286 1286 line numbers. In fact, sort_stats("nfl") is the same as
1287 1287 sort_stats("name", "file", "line").
1288 1288
1289 1289 -T <filename>: save profile results as shown on screen to a text
1290 1290 file. The profile is still shown on screen.
1291 1291
1292 1292 -D <filename>: save (via dump_stats) profile statistics to given
1293 1293 filename. This data is in a format understod by the pstats module, and
1294 1294 is generated by a call to the dump_stats() method of profile
1295 1295 objects. The profile is still shown on screen.
1296 1296
1297 1297 If you want to run complete programs under the profiler's control, use
1298 1298 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1299 1299 contains profiler specific options as described here.
1300 1300
1301 1301 You can read the complete documentation for the profile module with:\\
1302 1302 In [1]: import profile; profile.help() """
1303 1303
1304 1304 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1305 1305 # protect user quote marks
1306 1306 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1307 1307
1308 1308 if user_mode: # regular user call
1309 1309 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1310 1310 list_all=1)
1311 1311 namespace = self.shell.user_ns
1312 1312 else: # called to run a program by %run -p
1313 1313 try:
1314 1314 filename = get_py_filename(arg_lst[0])
1315 1315 except IOError,msg:
1316 1316 error(msg)
1317 1317 return
1318 1318
1319 1319 arg_str = 'execfile(filename,prog_ns)'
1320 1320 namespace = locals()
1321 1321
1322 1322 opts.merge(opts_def)
1323 1323
1324 1324 prof = profile.Profile()
1325 1325 try:
1326 1326 prof = prof.runctx(arg_str,namespace,namespace)
1327 1327 sys_exit = ''
1328 1328 except SystemExit:
1329 1329 sys_exit = """*** SystemExit exception caught in code being profiled."""
1330 1330
1331 1331 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1332 1332
1333 1333 lims = opts.l
1334 1334 if lims:
1335 1335 lims = [] # rebuild lims with ints/floats/strings
1336 1336 for lim in opts.l:
1337 1337 try:
1338 1338 lims.append(int(lim))
1339 1339 except ValueError:
1340 1340 try:
1341 1341 lims.append(float(lim))
1342 1342 except ValueError:
1343 1343 lims.append(lim)
1344 1344
1345 1345 # Trap output.
1346 1346 stdout_trap = StringIO()
1347 1347
1348 1348 if hasattr(stats,'stream'):
1349 1349 # In newer versions of python, the stats object has a 'stream'
1350 1350 # attribute to write into.
1351 1351 stats.stream = stdout_trap
1352 1352 stats.print_stats(*lims)
1353 1353 else:
1354 1354 # For older versions, we manually redirect stdout during printing
1355 1355 sys_stdout = sys.stdout
1356 1356 try:
1357 1357 sys.stdout = stdout_trap
1358 1358 stats.print_stats(*lims)
1359 1359 finally:
1360 1360 sys.stdout = sys_stdout
1361 1361
1362 1362 output = stdout_trap.getvalue()
1363 1363 output = output.rstrip()
1364 1364
1365 1365 page(output,screen_lines=self.shell.rc.screen_length)
1366 1366 print sys_exit,
1367 1367
1368 1368 dump_file = opts.D[0]
1369 1369 text_file = opts.T[0]
1370 1370 if dump_file:
1371 1371 prof.dump_stats(dump_file)
1372 1372 print '\n*** Profile stats marshalled to file',\
1373 1373 `dump_file`+'.',sys_exit
1374 1374 if text_file:
1375 1375 pfile = file(text_file,'w')
1376 1376 pfile.write(output)
1377 1377 pfile.close()
1378 1378 print '\n*** Profile printout saved to text file',\
1379 1379 `text_file`+'.',sys_exit
1380 1380
1381 1381 if opts.has_key('r'):
1382 1382 return stats
1383 1383 else:
1384 1384 return None
1385 1385
1386 1386 def magic_run(self, parameter_s ='',runner=None):
1387 1387 """Run the named file inside IPython as a program.
1388 1388
1389 1389 Usage:\\
1390 1390 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1391 1391
1392 1392 Parameters after the filename are passed as command-line arguments to
1393 1393 the program (put in sys.argv). Then, control returns to IPython's
1394 1394 prompt.
1395 1395
1396 1396 This is similar to running at a system prompt:\\
1397 1397 $ python file args\\
1398 1398 but with the advantage of giving you IPython's tracebacks, and of
1399 1399 loading all variables into your interactive namespace for further use
1400 1400 (unless -p is used, see below).
1401 1401
1402 1402 The file is executed in a namespace initially consisting only of
1403 1403 __name__=='__main__' and sys.argv constructed as indicated. It thus
1404 1404 sees its environment as if it were being run as a stand-alone
1405 1405 program. But after execution, the IPython interactive namespace gets
1406 1406 updated with all variables defined in the program (except for __name__
1407 1407 and sys.argv). This allows for very convenient loading of code for
1408 1408 interactive work, while giving each program a 'clean sheet' to run in.
1409 1409
1410 1410 Options:
1411 1411
1412 1412 -n: __name__ is NOT set to '__main__', but to the running file's name
1413 1413 without extension (as python does under import). This allows running
1414 1414 scripts and reloading the definitions in them without calling code
1415 1415 protected by an ' if __name__ == "__main__" ' clause.
1416 1416
1417 1417 -i: run the file in IPython's namespace instead of an empty one. This
1418 1418 is useful if you are experimenting with code written in a text editor
1419 1419 which depends on variables defined interactively.
1420 1420
1421 1421 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1422 1422 being run. This is particularly useful if IPython is being used to
1423 1423 run unittests, which always exit with a sys.exit() call. In such
1424 1424 cases you are interested in the output of the test results, not in
1425 1425 seeing a traceback of the unittest module.
1426 1426
1427 1427 -t: print timing information at the end of the run. IPython will give
1428 1428 you an estimated CPU time consumption for your script, which under
1429 1429 Unix uses the resource module to avoid the wraparound problems of
1430 1430 time.clock(). Under Unix, an estimate of time spent on system tasks
1431 1431 is also given (for Windows platforms this is reported as 0.0).
1432 1432
1433 1433 If -t is given, an additional -N<N> option can be given, where <N>
1434 1434 must be an integer indicating how many times you want the script to
1435 1435 run. The final timing report will include total and per run results.
1436 1436
1437 1437 For example (testing the script uniq_stable.py):
1438 1438
1439 1439 In [1]: run -t uniq_stable
1440 1440
1441 1441 IPython CPU timings (estimated):\\
1442 1442 User : 0.19597 s.\\
1443 1443 System: 0.0 s.\\
1444 1444
1445 1445 In [2]: run -t -N5 uniq_stable
1446 1446
1447 1447 IPython CPU timings (estimated):\\
1448 1448 Total runs performed: 5\\
1449 1449 Times : Total Per run\\
1450 1450 User : 0.910862 s, 0.1821724 s.\\
1451 1451 System: 0.0 s, 0.0 s.
1452 1452
1453 1453 -d: run your program under the control of pdb, the Python debugger.
1454 1454 This allows you to execute your program step by step, watch variables,
1455 1455 etc. Internally, what IPython does is similar to calling:
1456 1456
1457 1457 pdb.run('execfile("YOURFILENAME")')
1458 1458
1459 1459 with a breakpoint set on line 1 of your file. You can change the line
1460 1460 number for this automatic breakpoint to be <N> by using the -bN option
1461 1461 (where N must be an integer). For example:
1462 1462
1463 1463 %run -d -b40 myscript
1464 1464
1465 1465 will set the first breakpoint at line 40 in myscript.py. Note that
1466 1466 the first breakpoint must be set on a line which actually does
1467 1467 something (not a comment or docstring) for it to stop execution.
1468 1468
1469 1469 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1470 1470 first enter 'c' (without qoutes) to start execution up to the first
1471 1471 breakpoint.
1472 1472
1473 1473 Entering 'help' gives information about the use of the debugger. You
1474 1474 can easily see pdb's full documentation with "import pdb;pdb.help()"
1475 1475 at a prompt.
1476 1476
1477 1477 -p: run program under the control of the Python profiler module (which
1478 1478 prints a detailed report of execution times, function calls, etc).
1479 1479
1480 1480 You can pass other options after -p which affect the behavior of the
1481 1481 profiler itself. See the docs for %prun for details.
1482 1482
1483 1483 In this mode, the program's variables do NOT propagate back to the
1484 1484 IPython interactive namespace (because they remain in the namespace
1485 1485 where the profiler executes them).
1486 1486
1487 1487 Internally this triggers a call to %prun, see its documentation for
1488 1488 details on the options available specifically for profiling.
1489 1489
1490 1490 There is one special usage for which the text above doesn't apply:
1491 1491 if the filename ends with .ipy, the file is run as ipython script,
1492 1492 just as if the commands were written on IPython prompt.
1493 1493 """
1494 1494
1495 1495 # get arguments and set sys.argv for program to be run.
1496 1496 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1497 1497 mode='list',list_all=1)
1498 1498
1499 1499 try:
1500 1500 filename = get_py_filename(arg_lst[0])
1501 1501 except IndexError:
1502 1502 warn('you must provide at least a filename.')
1503 1503 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1504 1504 return
1505 1505 except IOError,msg:
1506 1506 error(msg)
1507 1507 return
1508 1508
1509 1509 if filename.lower().endswith('.ipy'):
1510 1510 self.api.runlines(open(filename).read())
1511 1511 return
1512 1512
1513 1513 # Control the response to exit() calls made by the script being run
1514 1514 exit_ignore = opts.has_key('e')
1515 1515
1516 1516 # Make sure that the running script gets a proper sys.argv as if it
1517 1517 # were run from a system shell.
1518 1518 save_argv = sys.argv # save it for later restoring
1519 1519 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1520 1520
1521 1521 if opts.has_key('i'):
1522 1522 prog_ns = self.shell.user_ns
1523 1523 __name__save = self.shell.user_ns['__name__']
1524 1524 prog_ns['__name__'] = '__main__'
1525 1525 else:
1526 1526 if opts.has_key('n'):
1527 1527 name = os.path.splitext(os.path.basename(filename))[0]
1528 1528 else:
1529 1529 name = '__main__'
1530 1530 prog_ns = {'__name__':name}
1531 1531
1532 1532 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1533 1533 # set the __file__ global in the script's namespace
1534 1534 prog_ns['__file__'] = filename
1535 1535
1536 1536 # pickle fix. See iplib for an explanation. But we need to make sure
1537 1537 # that, if we overwrite __main__, we replace it at the end
1538 1538 if prog_ns['__name__'] == '__main__':
1539 1539 restore_main = sys.modules['__main__']
1540 1540 else:
1541 1541 restore_main = False
1542 1542
1543 1543 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1544 1544
1545 1545 stats = None
1546 1546 try:
1547 1547 if self.shell.has_readline:
1548 1548 self.shell.savehist()
1549 1549
1550 1550 if opts.has_key('p'):
1551 1551 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1552 1552 else:
1553 1553 if opts.has_key('d'):
1554 1554 deb = Debugger.Pdb(self.shell.rc.colors)
1555 1555 # reset Breakpoint state, which is moronically kept
1556 1556 # in a class
1557 1557 bdb.Breakpoint.next = 1
1558 1558 bdb.Breakpoint.bplist = {}
1559 1559 bdb.Breakpoint.bpbynumber = [None]
1560 1560 # Set an initial breakpoint to stop execution
1561 1561 maxtries = 10
1562 1562 bp = int(opts.get('b',[1])[0])
1563 1563 checkline = deb.checkline(filename,bp)
1564 1564 if not checkline:
1565 1565 for bp in range(bp+1,bp+maxtries+1):
1566 1566 if deb.checkline(filename,bp):
1567 1567 break
1568 1568 else:
1569 1569 msg = ("\nI failed to find a valid line to set "
1570 1570 "a breakpoint\n"
1571 1571 "after trying up to line: %s.\n"
1572 1572 "Please set a valid breakpoint manually "
1573 1573 "with the -b option." % bp)
1574 1574 error(msg)
1575 1575 return
1576 1576 # if we find a good linenumber, set the breakpoint
1577 1577 deb.do_break('%s:%s' % (filename,bp))
1578 1578 # Start file run
1579 1579 print "NOTE: Enter 'c' at the",
1580 1580 print "%s prompt to start your script." % deb.prompt
1581 1581 try:
1582 1582 deb.run('execfile("%s")' % filename,prog_ns)
1583 1583
1584 1584 except:
1585 1585 etype, value, tb = sys.exc_info()
1586 1586 # Skip three frames in the traceback: the %run one,
1587 1587 # one inside bdb.py, and the command-line typed by the
1588 1588 # user (run by exec in pdb itself).
1589 1589 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1590 1590 else:
1591 1591 if runner is None:
1592 1592 runner = self.shell.safe_execfile
1593 1593 if opts.has_key('t'):
1594 1594 try:
1595 1595 nruns = int(opts['N'][0])
1596 1596 if nruns < 1:
1597 1597 error('Number of runs must be >=1')
1598 1598 return
1599 1599 except (KeyError):
1600 1600 nruns = 1
1601 1601 if nruns == 1:
1602 1602 t0 = clock2()
1603 1603 runner(filename,prog_ns,prog_ns,
1604 1604 exit_ignore=exit_ignore)
1605 1605 t1 = clock2()
1606 1606 t_usr = t1[0]-t0[0]
1607 1607 t_sys = t1[1]-t1[1]
1608 1608 print "\nIPython CPU timings (estimated):"
1609 1609 print " User : %10s s." % t_usr
1610 1610 print " System: %10s s." % t_sys
1611 1611 else:
1612 1612 runs = range(nruns)
1613 1613 t0 = clock2()
1614 1614 for nr in runs:
1615 1615 runner(filename,prog_ns,prog_ns,
1616 1616 exit_ignore=exit_ignore)
1617 1617 t1 = clock2()
1618 1618 t_usr = t1[0]-t0[0]
1619 1619 t_sys = t1[1]-t1[1]
1620 1620 print "\nIPython CPU timings (estimated):"
1621 1621 print "Total runs performed:",nruns
1622 1622 print " Times : %10s %10s" % ('Total','Per run')
1623 1623 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1624 1624 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1625 1625
1626 1626 else:
1627 1627 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1628 1628 if opts.has_key('i'):
1629 1629 self.shell.user_ns['__name__'] = __name__save
1630 1630 else:
1631 1631 # update IPython interactive namespace
1632 1632 del prog_ns['__name__']
1633 1633 self.shell.user_ns.update(prog_ns)
1634 1634 finally:
1635 1635 sys.argv = save_argv
1636 1636 if restore_main:
1637 1637 sys.modules['__main__'] = restore_main
1638 1638 self.shell.reloadhist()
1639 1639
1640 1640 return stats
1641 1641
1642 1642 def magic_runlog(self, parameter_s =''):
1643 1643 """Run files as logs.
1644 1644
1645 1645 Usage:\\
1646 1646 %runlog file1 file2 ...
1647 1647
1648 1648 Run the named files (treating them as log files) in sequence inside
1649 1649 the interpreter, and return to the prompt. This is much slower than
1650 1650 %run because each line is executed in a try/except block, but it
1651 1651 allows running files with syntax errors in them.
1652 1652
1653 1653 Normally IPython will guess when a file is one of its own logfiles, so
1654 1654 you can typically use %run even for logs. This shorthand allows you to
1655 1655 force any file to be treated as a log file."""
1656 1656
1657 1657 for f in parameter_s.split():
1658 1658 self.shell.safe_execfile(f,self.shell.user_ns,
1659 1659 self.shell.user_ns,islog=1)
1660 1660
1661 1661 def magic_timeit(self, parameter_s =''):
1662 1662 """Time execution of a Python statement or expression
1663 1663
1664 1664 Usage:\\
1665 1665 %timeit [-n<N> -r<R> [-t|-c]] statement
1666 1666
1667 1667 Time execution of a Python statement or expression using the timeit
1668 1668 module.
1669 1669
1670 1670 Options:
1671 1671 -n<N>: execute the given statement <N> times in a loop. If this value
1672 1672 is not given, a fitting value is chosen.
1673 1673
1674 1674 -r<R>: repeat the loop iteration <R> times and take the best result.
1675 1675 Default: 3
1676 1676
1677 1677 -t: use time.time to measure the time, which is the default on Unix.
1678 1678 This function measures wall time.
1679 1679
1680 1680 -c: use time.clock to measure the time, which is the default on
1681 1681 Windows and measures wall time. On Unix, resource.getrusage is used
1682 1682 instead and returns the CPU user time.
1683 1683
1684 1684 -p<P>: use a precision of <P> digits to display the timing result.
1685 1685 Default: 3
1686 1686
1687 1687
1688 1688 Examples:\\
1689 1689 In [1]: %timeit pass
1690 1690 10000000 loops, best of 3: 53.3 ns per loop
1691 1691
1692 1692 In [2]: u = None
1693 1693
1694 1694 In [3]: %timeit u is None
1695 1695 10000000 loops, best of 3: 184 ns per loop
1696 1696
1697 1697 In [4]: %timeit -r 4 u == None
1698 1698 1000000 loops, best of 4: 242 ns per loop
1699 1699
1700 1700 In [5]: import time
1701 1701
1702 1702 In [6]: %timeit -n1 time.sleep(2)
1703 1703 1 loops, best of 3: 2 s per loop
1704 1704
1705 1705
1706 1706 The times reported by %timeit will be slightly higher than those
1707 1707 reported by the timeit.py script when variables are accessed. This is
1708 1708 due to the fact that %timeit executes the statement in the namespace
1709 1709 of the shell, compared with timeit.py, which uses a single setup
1710 1710 statement to import function or create variables. Generally, the bias
1711 1711 does not matter as long as results from timeit.py are not mixed with
1712 1712 those from %timeit."""
1713 1713
1714 1714 import timeit
1715 1715 import math
1716 1716
1717 1717 units = ["s", "ms", "\xc2\xb5s", "ns"]
1718 1718 scaling = [1, 1e3, 1e6, 1e9]
1719 1719
1720 1720 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1721 1721 posix=False)
1722 1722 if stmt == "":
1723 1723 return
1724 1724 timefunc = timeit.default_timer
1725 1725 number = int(getattr(opts, "n", 0))
1726 1726 repeat = int(getattr(opts, "r", timeit.default_repeat))
1727 1727 precision = int(getattr(opts, "p", 3))
1728 1728 if hasattr(opts, "t"):
1729 1729 timefunc = time.time
1730 1730 if hasattr(opts, "c"):
1731 1731 timefunc = clock
1732 1732
1733 1733 timer = timeit.Timer(timer=timefunc)
1734 1734 # this code has tight coupling to the inner workings of timeit.Timer,
1735 1735 # but is there a better way to achieve that the code stmt has access
1736 1736 # to the shell namespace?
1737 1737
1738 1738 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1739 1739 'setup': "pass"}
1740 1740 code = compile(src, "<magic-timeit>", "exec")
1741 1741 ns = {}
1742 1742 exec code in self.shell.user_ns, ns
1743 1743 timer.inner = ns["inner"]
1744 1744
1745 1745 if number == 0:
1746 1746 # determine number so that 0.2 <= total time < 2.0
1747 1747 number = 1
1748 1748 for i in range(1, 10):
1749 1749 number *= 10
1750 1750 if timer.timeit(number) >= 0.2:
1751 1751 break
1752 1752
1753 1753 best = min(timer.repeat(repeat, number)) / number
1754 1754
1755 1755 if best > 0.0:
1756 1756 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1757 1757 else:
1758 1758 order = 3
1759 1759 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1760 1760 precision,
1761 1761 best * scaling[order],
1762 1762 units[order])
1763 1763
1764 1764 def magic_time(self,parameter_s = ''):
1765 1765 """Time execution of a Python statement or expression.
1766 1766
1767 1767 The CPU and wall clock times are printed, and the value of the
1768 1768 expression (if any) is returned. Note that under Win32, system time
1769 1769 is always reported as 0, since it can not be measured.
1770 1770
1771 1771 This function provides very basic timing functionality. In Python
1772 1772 2.3, the timeit module offers more control and sophistication, so this
1773 1773 could be rewritten to use it (patches welcome).
1774 1774
1775 1775 Some examples:
1776 1776
1777 1777 In [1]: time 2**128
1778 1778 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1779 1779 Wall time: 0.00
1780 1780 Out[1]: 340282366920938463463374607431768211456L
1781 1781
1782 1782 In [2]: n = 1000000
1783 1783
1784 1784 In [3]: time sum(range(n))
1785 1785 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1786 1786 Wall time: 1.37
1787 1787 Out[3]: 499999500000L
1788 1788
1789 1789 In [4]: time print 'hello world'
1790 1790 hello world
1791 1791 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1792 1792 Wall time: 0.00
1793 1793 """
1794 1794
1795 1795 # fail immediately if the given expression can't be compiled
1796 1796
1797 1797 expr = self.shell.prefilter(parameter_s,False)
1798 1798
1799 1799 try:
1800 1800 mode = 'eval'
1801 1801 code = compile(expr,'<timed eval>',mode)
1802 1802 except SyntaxError:
1803 1803 mode = 'exec'
1804 1804 code = compile(expr,'<timed exec>',mode)
1805 1805 # skew measurement as little as possible
1806 1806 glob = self.shell.user_ns
1807 1807 clk = clock2
1808 1808 wtime = time.time
1809 1809 # time execution
1810 1810 wall_st = wtime()
1811 1811 if mode=='eval':
1812 1812 st = clk()
1813 1813 out = eval(code,glob)
1814 1814 end = clk()
1815 1815 else:
1816 1816 st = clk()
1817 1817 exec code in glob
1818 1818 end = clk()
1819 1819 out = None
1820 1820 wall_end = wtime()
1821 1821 # Compute actual times and report
1822 1822 wall_time = wall_end-wall_st
1823 1823 cpu_user = end[0]-st[0]
1824 1824 cpu_sys = end[1]-st[1]
1825 1825 cpu_tot = cpu_user+cpu_sys
1826 1826 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1827 1827 (cpu_user,cpu_sys,cpu_tot)
1828 1828 print "Wall time: %.2f" % wall_time
1829 1829 return out
1830 1830
1831 1831 def magic_macro(self,parameter_s = ''):
1832 1832 """Define a set of input lines as a macro for future re-execution.
1833 1833
1834 1834 Usage:\\
1835 1835 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1836 1836
1837 1837 Options:
1838 1838
1839 1839 -r: use 'raw' input. By default, the 'processed' history is used,
1840 1840 so that magics are loaded in their transformed version to valid
1841 1841 Python. If this option is given, the raw input as typed as the
1842 1842 command line is used instead.
1843 1843
1844 1844 This will define a global variable called `name` which is a string
1845 1845 made of joining the slices and lines you specify (n1,n2,... numbers
1846 1846 above) from your input history into a single string. This variable
1847 1847 acts like an automatic function which re-executes those lines as if
1848 1848 you had typed them. You just type 'name' at the prompt and the code
1849 1849 executes.
1850 1850
1851 1851 The notation for indicating number ranges is: n1-n2 means 'use line
1852 1852 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1853 1853 using the lines numbered 5,6 and 7.
1854 1854
1855 1855 Note: as a 'hidden' feature, you can also use traditional python slice
1856 1856 notation, where N:M means numbers N through M-1.
1857 1857
1858 1858 For example, if your history contains (%hist prints it):
1859 1859
1860 1860 44: x=1\\
1861 1861 45: y=3\\
1862 1862 46: z=x+y\\
1863 1863 47: print x\\
1864 1864 48: a=5\\
1865 1865 49: print 'x',x,'y',y\\
1866 1866
1867 1867 you can create a macro with lines 44 through 47 (included) and line 49
1868 1868 called my_macro with:
1869 1869
1870 1870 In [51]: %macro my_macro 44-47 49
1871 1871
1872 1872 Now, typing `my_macro` (without quotes) will re-execute all this code
1873 1873 in one pass.
1874 1874
1875 1875 You don't need to give the line-numbers in order, and any given line
1876 1876 number can appear multiple times. You can assemble macros with any
1877 1877 lines from your input history in any order.
1878 1878
1879 1879 The macro is a simple object which holds its value in an attribute,
1880 1880 but IPython's display system checks for macros and executes them as
1881 1881 code instead of printing them when you type their name.
1882 1882
1883 1883 You can view a macro's contents by explicitly printing it with:
1884 1884
1885 1885 'print macro_name'.
1886 1886
1887 1887 For one-off cases which DON'T contain magic function calls in them you
1888 1888 can obtain similar results by explicitly executing slices from your
1889 1889 input history with:
1890 1890
1891 1891 In [60]: exec In[44:48]+In[49]"""
1892 1892
1893 1893 opts,args = self.parse_options(parameter_s,'r',mode='list')
1894 1894 if not args:
1895 1895 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1896 1896 macs.sort()
1897 1897 return macs
1898 if len(args) == 1:
1899 raise UsageError(
1900 "%macro insufficient args; usage '%macro name n1-n2 n3-4...")
1898 1901 name,ranges = args[0], args[1:]
1902
1899 1903 #print 'rng',ranges # dbg
1900 1904 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1901 1905 macro = Macro(lines)
1902 1906 self.shell.user_ns.update({name:macro})
1903 1907 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1904 1908 print 'Macro contents:'
1905 1909 print macro,
1906 1910
1907 1911 def magic_save(self,parameter_s = ''):
1908 1912 """Save a set of lines to a given filename.
1909 1913
1910 1914 Usage:\\
1911 1915 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1912 1916
1913 1917 Options:
1914 1918
1915 1919 -r: use 'raw' input. By default, the 'processed' history is used,
1916 1920 so that magics are loaded in their transformed version to valid
1917 1921 Python. If this option is given, the raw input as typed as the
1918 1922 command line is used instead.
1919 1923
1920 1924 This function uses the same syntax as %macro for line extraction, but
1921 1925 instead of creating a macro it saves the resulting string to the
1922 1926 filename you specify.
1923 1927
1924 1928 It adds a '.py' extension to the file if you don't do so yourself, and
1925 1929 it asks for confirmation before overwriting existing files."""
1926 1930
1927 1931 opts,args = self.parse_options(parameter_s,'r',mode='list')
1928 1932 fname,ranges = args[0], args[1:]
1929 1933 if not fname.endswith('.py'):
1930 1934 fname += '.py'
1931 1935 if os.path.isfile(fname):
1932 1936 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1933 1937 if ans.lower() not in ['y','yes']:
1934 1938 print 'Operation cancelled.'
1935 1939 return
1936 1940 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1937 1941 f = file(fname,'w')
1938 1942 f.write(cmds)
1939 1943 f.close()
1940 1944 print 'The following commands were written to file `%s`:' % fname
1941 1945 print cmds
1942 1946
1943 1947 def _edit_macro(self,mname,macro):
1944 1948 """open an editor with the macro data in a file"""
1945 1949 filename = self.shell.mktempfile(macro.value)
1946 1950 self.shell.hooks.editor(filename)
1947 1951
1948 1952 # and make a new macro object, to replace the old one
1949 1953 mfile = open(filename)
1950 1954 mvalue = mfile.read()
1951 1955 mfile.close()
1952 1956 self.shell.user_ns[mname] = Macro(mvalue)
1953 1957
1954 1958 def magic_ed(self,parameter_s=''):
1955 1959 """Alias to %edit."""
1956 1960 return self.magic_edit(parameter_s)
1957 1961
1958 1962 def magic_edit(self,parameter_s='',last_call=['','']):
1959 1963 """Bring up an editor and execute the resulting code.
1960 1964
1961 1965 Usage:
1962 1966 %edit [options] [args]
1963 1967
1964 1968 %edit runs IPython's editor hook. The default version of this hook is
1965 1969 set to call the __IPYTHON__.rc.editor command. This is read from your
1966 1970 environment variable $EDITOR. If this isn't found, it will default to
1967 1971 vi under Linux/Unix and to notepad under Windows. See the end of this
1968 1972 docstring for how to change the editor hook.
1969 1973
1970 1974 You can also set the value of this editor via the command line option
1971 1975 '-editor' or in your ipythonrc file. This is useful if you wish to use
1972 1976 specifically for IPython an editor different from your typical default
1973 1977 (and for Windows users who typically don't set environment variables).
1974 1978
1975 1979 This command allows you to conveniently edit multi-line code right in
1976 1980 your IPython session.
1977 1981
1978 1982 If called without arguments, %edit opens up an empty editor with a
1979 1983 temporary file and will execute the contents of this file when you
1980 1984 close it (don't forget to save it!).
1981 1985
1982 1986
1983 1987 Options:
1984 1988
1985 1989 -n <number>: open the editor at a specified line number. By default,
1986 1990 the IPython editor hook uses the unix syntax 'editor +N filename', but
1987 1991 you can configure this by providing your own modified hook if your
1988 1992 favorite editor supports line-number specifications with a different
1989 1993 syntax.
1990 1994
1991 1995 -p: this will call the editor with the same data as the previous time
1992 1996 it was used, regardless of how long ago (in your current session) it
1993 1997 was.
1994 1998
1995 1999 -r: use 'raw' input. This option only applies to input taken from the
1996 2000 user's history. By default, the 'processed' history is used, so that
1997 2001 magics are loaded in their transformed version to valid Python. If
1998 2002 this option is given, the raw input as typed as the command line is
1999 2003 used instead. When you exit the editor, it will be executed by
2000 2004 IPython's own processor.
2001 2005
2002 2006 -x: do not execute the edited code immediately upon exit. This is
2003 2007 mainly useful if you are editing programs which need to be called with
2004 2008 command line arguments, which you can then do using %run.
2005 2009
2006 2010
2007 2011 Arguments:
2008 2012
2009 2013 If arguments are given, the following possibilites exist:
2010 2014
2011 2015 - The arguments are numbers or pairs of colon-separated numbers (like
2012 2016 1 4:8 9). These are interpreted as lines of previous input to be
2013 2017 loaded into the editor. The syntax is the same of the %macro command.
2014 2018
2015 2019 - If the argument doesn't start with a number, it is evaluated as a
2016 2020 variable and its contents loaded into the editor. You can thus edit
2017 2021 any string which contains python code (including the result of
2018 2022 previous edits).
2019 2023
2020 2024 - If the argument is the name of an object (other than a string),
2021 2025 IPython will try to locate the file where it was defined and open the
2022 2026 editor at the point where it is defined. You can use `%edit function`
2023 2027 to load an editor exactly at the point where 'function' is defined,
2024 2028 edit it and have the file be executed automatically.
2025 2029
2026 2030 If the object is a macro (see %macro for details), this opens up your
2027 2031 specified editor with a temporary file containing the macro's data.
2028 2032 Upon exit, the macro is reloaded with the contents of the file.
2029 2033
2030 2034 Note: opening at an exact line is only supported under Unix, and some
2031 2035 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2032 2036 '+NUMBER' parameter necessary for this feature. Good editors like
2033 2037 (X)Emacs, vi, jed, pico and joe all do.
2034 2038
2035 2039 - If the argument is not found as a variable, IPython will look for a
2036 2040 file with that name (adding .py if necessary) and load it into the
2037 2041 editor. It will execute its contents with execfile() when you exit,
2038 2042 loading any code in the file into your interactive namespace.
2039 2043
2040 2044 After executing your code, %edit will return as output the code you
2041 2045 typed in the editor (except when it was an existing file). This way
2042 2046 you can reload the code in further invocations of %edit as a variable,
2043 2047 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2044 2048 the output.
2045 2049
2046 2050 Note that %edit is also available through the alias %ed.
2047 2051
2048 2052 This is an example of creating a simple function inside the editor and
2049 2053 then modifying it. First, start up the editor:
2050 2054
2051 2055 In [1]: ed\\
2052 2056 Editing... done. Executing edited code...\\
2053 2057 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2054 2058
2055 2059 We can then call the function foo():
2056 2060
2057 2061 In [2]: foo()\\
2058 2062 foo() was defined in an editing session
2059 2063
2060 2064 Now we edit foo. IPython automatically loads the editor with the
2061 2065 (temporary) file where foo() was previously defined:
2062 2066
2063 2067 In [3]: ed foo\\
2064 2068 Editing... done. Executing edited code...
2065 2069
2066 2070 And if we call foo() again we get the modified version:
2067 2071
2068 2072 In [4]: foo()\\
2069 2073 foo() has now been changed!
2070 2074
2071 2075 Here is an example of how to edit a code snippet successive
2072 2076 times. First we call the editor:
2073 2077
2074 2078 In [8]: ed\\
2075 2079 Editing... done. Executing edited code...\\
2076 2080 hello\\
2077 2081 Out[8]: "print 'hello'\\n"
2078 2082
2079 2083 Now we call it again with the previous output (stored in _):
2080 2084
2081 2085 In [9]: ed _\\
2082 2086 Editing... done. Executing edited code...\\
2083 2087 hello world\\
2084 2088 Out[9]: "print 'hello world'\\n"
2085 2089
2086 2090 Now we call it with the output #8 (stored in _8, also as Out[8]):
2087 2091
2088 2092 In [10]: ed _8\\
2089 2093 Editing... done. Executing edited code...\\
2090 2094 hello again\\
2091 2095 Out[10]: "print 'hello again'\\n"
2092 2096
2093 2097
2094 2098 Changing the default editor hook:
2095 2099
2096 2100 If you wish to write your own editor hook, you can put it in a
2097 2101 configuration file which you load at startup time. The default hook
2098 2102 is defined in the IPython.hooks module, and you can use that as a
2099 2103 starting example for further modifications. That file also has
2100 2104 general instructions on how to set a new hook for use once you've
2101 2105 defined it."""
2102 2106
2103 2107 # FIXME: This function has become a convoluted mess. It needs a
2104 2108 # ground-up rewrite with clean, simple logic.
2105 2109
2106 2110 def make_filename(arg):
2107 2111 "Make a filename from the given args"
2108 2112 try:
2109 2113 filename = get_py_filename(arg)
2110 2114 except IOError:
2111 2115 if args.endswith('.py'):
2112 2116 filename = arg
2113 2117 else:
2114 2118 filename = None
2115 2119 return filename
2116 2120
2117 2121 # custom exceptions
2118 2122 class DataIsObject(Exception): pass
2119 2123
2120 2124 opts,args = self.parse_options(parameter_s,'prxn:')
2121 2125 # Set a few locals from the options for convenience:
2122 2126 opts_p = opts.has_key('p')
2123 2127 opts_r = opts.has_key('r')
2124 2128
2125 2129 # Default line number value
2126 2130 lineno = opts.get('n',None)
2127 2131
2128 2132 if opts_p:
2129 2133 args = '_%s' % last_call[0]
2130 2134 if not self.shell.user_ns.has_key(args):
2131 2135 args = last_call[1]
2132 2136
2133 2137 # use last_call to remember the state of the previous call, but don't
2134 2138 # let it be clobbered by successive '-p' calls.
2135 2139 try:
2136 2140 last_call[0] = self.shell.outputcache.prompt_count
2137 2141 if not opts_p:
2138 2142 last_call[1] = parameter_s
2139 2143 except:
2140 2144 pass
2141 2145
2142 2146 # by default this is done with temp files, except when the given
2143 2147 # arg is a filename
2144 2148 use_temp = 1
2145 2149
2146 2150 if re.match(r'\d',args):
2147 2151 # Mode where user specifies ranges of lines, like in %macro.
2148 2152 # This means that you can't edit files whose names begin with
2149 2153 # numbers this way. Tough.
2150 2154 ranges = args.split()
2151 2155 data = ''.join(self.extract_input_slices(ranges,opts_r))
2152 2156 elif args.endswith('.py'):
2153 2157 filename = make_filename(args)
2154 2158 data = ''
2155 2159 use_temp = 0
2156 2160 elif args:
2157 2161 try:
2158 2162 # Load the parameter given as a variable. If not a string,
2159 2163 # process it as an object instead (below)
2160 2164
2161 2165 #print '*** args',args,'type',type(args) # dbg
2162 2166 data = eval(args,self.shell.user_ns)
2163 2167 if not type(data) in StringTypes:
2164 2168 raise DataIsObject
2165 2169
2166 2170 except (NameError,SyntaxError):
2167 2171 # given argument is not a variable, try as a filename
2168 2172 filename = make_filename(args)
2169 2173 if filename is None:
2170 2174 warn("Argument given (%s) can't be found as a variable "
2171 2175 "or as a filename." % args)
2172 2176 return
2173 2177
2174 2178 data = ''
2175 2179 use_temp = 0
2176 2180 except DataIsObject:
2177 2181
2178 2182 # macros have a special edit function
2179 2183 if isinstance(data,Macro):
2180 2184 self._edit_macro(args,data)
2181 2185 return
2182 2186
2183 2187 # For objects, try to edit the file where they are defined
2184 2188 try:
2185 2189 filename = inspect.getabsfile(data)
2186 2190 datafile = 1
2187 2191 except TypeError:
2188 2192 filename = make_filename(args)
2189 2193 datafile = 1
2190 2194 warn('Could not find file where `%s` is defined.\n'
2191 2195 'Opening a file named `%s`' % (args,filename))
2192 2196 # Now, make sure we can actually read the source (if it was in
2193 2197 # a temp file it's gone by now).
2194 2198 if datafile:
2195 2199 try:
2196 2200 if lineno is None:
2197 2201 lineno = inspect.getsourcelines(data)[1]
2198 2202 except IOError:
2199 2203 filename = make_filename(args)
2200 2204 if filename is None:
2201 2205 warn('The file `%s` where `%s` was defined cannot '
2202 2206 'be read.' % (filename,data))
2203 2207 return
2204 2208 use_temp = 0
2205 2209 else:
2206 2210 data = ''
2207 2211
2208 2212 if use_temp:
2209 2213 filename = self.shell.mktempfile(data)
2210 2214 print 'IPython will make a temporary file named:',filename
2211 2215
2212 2216 # do actual editing here
2213 2217 print 'Editing...',
2214 2218 sys.stdout.flush()
2215 2219 self.shell.hooks.editor(filename,lineno)
2216 2220 if opts.has_key('x'): # -x prevents actual execution
2217 2221 print
2218 2222 else:
2219 2223 print 'done. Executing edited code...'
2220 2224 if opts_r:
2221 2225 self.shell.runlines(file_read(filename))
2222 2226 else:
2223 2227 self.shell.safe_execfile(filename,self.shell.user_ns,
2224 2228 self.shell.user_ns)
2225 2229 if use_temp:
2226 2230 try:
2227 2231 return open(filename).read()
2228 2232 except IOError,msg:
2229 2233 if msg.filename == filename:
2230 2234 warn('File not found. Did you forget to save?')
2231 2235 return
2232 2236 else:
2233 2237 self.shell.showtraceback()
2234 2238
2235 2239 def magic_xmode(self,parameter_s = ''):
2236 2240 """Switch modes for the exception handlers.
2237 2241
2238 2242 Valid modes: Plain, Context and Verbose.
2239 2243
2240 2244 If called without arguments, acts as a toggle."""
2241 2245
2242 2246 def xmode_switch_err(name):
2243 2247 warn('Error changing %s exception modes.\n%s' %
2244 2248 (name,sys.exc_info()[1]))
2245 2249
2246 2250 shell = self.shell
2247 2251 new_mode = parameter_s.strip().capitalize()
2248 2252 try:
2249 2253 shell.InteractiveTB.set_mode(mode=new_mode)
2250 2254 print 'Exception reporting mode:',shell.InteractiveTB.mode
2251 2255 except:
2252 2256 xmode_switch_err('user')
2253 2257
2254 2258 # threaded shells use a special handler in sys.excepthook
2255 2259 if shell.isthreaded:
2256 2260 try:
2257 2261 shell.sys_excepthook.set_mode(mode=new_mode)
2258 2262 except:
2259 2263 xmode_switch_err('threaded')
2260 2264
2261 2265 def magic_colors(self,parameter_s = ''):
2262 2266 """Switch color scheme for prompts, info system and exception handlers.
2263 2267
2264 2268 Currently implemented schemes: NoColor, Linux, LightBG.
2265 2269
2266 2270 Color scheme names are not case-sensitive."""
2267 2271
2268 2272 def color_switch_err(name):
2269 2273 warn('Error changing %s color schemes.\n%s' %
2270 2274 (name,sys.exc_info()[1]))
2271 2275
2272 2276
2273 2277 new_scheme = parameter_s.strip()
2274 2278 if not new_scheme:
2275 print 'You must specify a color scheme.'
2279 raise UsageError(
2280 "%colors: you must specify a color scheme. See '%colors?'")
2276 2281 return
2277 2282 # local shortcut
2278 2283 shell = self.shell
2279 2284
2280 2285 import IPython.rlineimpl as readline
2281 2286
2282 2287 if not readline.have_readline and sys.platform == "win32":
2283 2288 msg = """\
2284 2289 Proper color support under MS Windows requires the pyreadline library.
2285 2290 You can find it at:
2286 2291 http://ipython.scipy.org/moin/PyReadline/Intro
2287 2292 Gary's readline needs the ctypes module, from:
2288 2293 http://starship.python.net/crew/theller/ctypes
2289 2294 (Note that ctypes is already part of Python versions 2.5 and newer).
2290 2295
2291 2296 Defaulting color scheme to 'NoColor'"""
2292 2297 new_scheme = 'NoColor'
2293 2298 warn(msg)
2294 2299
2295 2300 # readline option is 0
2296 2301 if not shell.has_readline:
2297 2302 new_scheme = 'NoColor'
2298 2303
2299 2304 # Set prompt colors
2300 2305 try:
2301 2306 shell.outputcache.set_colors(new_scheme)
2302 2307 except:
2303 2308 color_switch_err('prompt')
2304 2309 else:
2305 2310 shell.rc.colors = \
2306 2311 shell.outputcache.color_table.active_scheme_name
2307 2312 # Set exception colors
2308 2313 try:
2309 2314 shell.InteractiveTB.set_colors(scheme = new_scheme)
2310 2315 shell.SyntaxTB.set_colors(scheme = new_scheme)
2311 2316 except:
2312 2317 color_switch_err('exception')
2313 2318
2314 2319 # threaded shells use a verbose traceback in sys.excepthook
2315 2320 if shell.isthreaded:
2316 2321 try:
2317 2322 shell.sys_excepthook.set_colors(scheme=new_scheme)
2318 2323 except:
2319 2324 color_switch_err('system exception handler')
2320 2325
2321 2326 # Set info (for 'object?') colors
2322 2327 if shell.rc.color_info:
2323 2328 try:
2324 2329 shell.inspector.set_active_scheme(new_scheme)
2325 2330 except:
2326 2331 color_switch_err('object inspector')
2327 2332 else:
2328 2333 shell.inspector.set_active_scheme('NoColor')
2329 2334
2330 2335 def magic_color_info(self,parameter_s = ''):
2331 2336 """Toggle color_info.
2332 2337
2333 2338 The color_info configuration parameter controls whether colors are
2334 2339 used for displaying object details (by things like %psource, %pfile or
2335 2340 the '?' system). This function toggles this value with each call.
2336 2341
2337 2342 Note that unless you have a fairly recent pager (less works better
2338 2343 than more) in your system, using colored object information displays
2339 2344 will not work properly. Test it and see."""
2340 2345
2341 2346 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2342 2347 self.magic_colors(self.shell.rc.colors)
2343 2348 print 'Object introspection functions have now coloring:',
2344 2349 print ['OFF','ON'][self.shell.rc.color_info]
2345 2350
2346 2351 def magic_Pprint(self, parameter_s=''):
2347 2352 """Toggle pretty printing on/off."""
2348 2353
2349 2354 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2350 2355 print 'Pretty printing has been turned', \
2351 2356 ['OFF','ON'][self.shell.rc.pprint]
2352 2357
2353 2358 def magic_exit(self, parameter_s=''):
2354 2359 """Exit IPython, confirming if configured to do so.
2355 2360
2356 2361 You can configure whether IPython asks for confirmation upon exit by
2357 2362 setting the confirm_exit flag in the ipythonrc file."""
2358 2363
2359 2364 self.shell.exit()
2360 2365
2361 2366 def magic_quit(self, parameter_s=''):
2362 2367 """Exit IPython, confirming if configured to do so (like %exit)"""
2363 2368
2364 2369 self.shell.exit()
2365 2370
2366 2371 def magic_Exit(self, parameter_s=''):
2367 2372 """Exit IPython without confirmation."""
2368 2373
2369 2374 self.shell.exit_now = True
2370 2375
2371 2376 #......................................................................
2372 2377 # Functions to implement unix shell-type things
2373 2378
2374 2379 def magic_alias(self, parameter_s = ''):
2375 2380 """Define an alias for a system command.
2376 2381
2377 2382 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2378 2383
2379 2384 Then, typing 'alias_name params' will execute the system command 'cmd
2380 2385 params' (from your underlying operating system).
2381 2386
2382 2387 Aliases have lower precedence than magic functions and Python normal
2383 2388 variables, so if 'foo' is both a Python variable and an alias, the
2384 2389 alias can not be executed until 'del foo' removes the Python variable.
2385 2390
2386 2391 You can use the %l specifier in an alias definition to represent the
2387 2392 whole line when the alias is called. For example:
2388 2393
2389 2394 In [2]: alias all echo "Input in brackets: <%l>"\\
2390 2395 In [3]: all hello world\\
2391 2396 Input in brackets: <hello world>
2392 2397
2393 2398 You can also define aliases with parameters using %s specifiers (one
2394 2399 per parameter):
2395 2400
2396 2401 In [1]: alias parts echo first %s second %s\\
2397 2402 In [2]: %parts A B\\
2398 2403 first A second B\\
2399 2404 In [3]: %parts A\\
2400 2405 Incorrect number of arguments: 2 expected.\\
2401 2406 parts is an alias to: 'echo first %s second %s'
2402 2407
2403 2408 Note that %l and %s are mutually exclusive. You can only use one or
2404 2409 the other in your aliases.
2405 2410
2406 2411 Aliases expand Python variables just like system calls using ! or !!
2407 2412 do: all expressions prefixed with '$' get expanded. For details of
2408 2413 the semantic rules, see PEP-215:
2409 2414 http://www.python.org/peps/pep-0215.html. This is the library used by
2410 2415 IPython for variable expansion. If you want to access a true shell
2411 2416 variable, an extra $ is necessary to prevent its expansion by IPython:
2412 2417
2413 2418 In [6]: alias show echo\\
2414 2419 In [7]: PATH='A Python string'\\
2415 2420 In [8]: show $PATH\\
2416 2421 A Python string\\
2417 2422 In [9]: show $$PATH\\
2418 2423 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2419 2424
2420 2425 You can use the alias facility to acess all of $PATH. See the %rehash
2421 2426 and %rehashx functions, which automatically create aliases for the
2422 2427 contents of your $PATH.
2423 2428
2424 2429 If called with no parameters, %alias prints the current alias table."""
2425 2430
2426 2431 par = parameter_s.strip()
2427 2432 if not par:
2428 2433 stored = self.db.get('stored_aliases', {} )
2429 2434 atab = self.shell.alias_table
2430 2435 aliases = atab.keys()
2431 2436 aliases.sort()
2432 2437 res = []
2433 2438 showlast = []
2434 2439 for alias in aliases:
2435 2440 special = False
2436 2441 try:
2437 2442 tgt = atab[alias][1]
2438 2443 except (TypeError, AttributeError):
2439 2444 # unsubscriptable? probably a callable
2440 2445 tgt = atab[alias]
2441 2446 special = True
2442 2447 # 'interesting' aliases
2443 2448 if (alias in stored or
2444 2449 special or
2445 2450 alias.lower() != os.path.splitext(tgt)[0].lower() or
2446 2451 ' ' in tgt):
2447 2452 showlast.append((alias, tgt))
2448 2453 else:
2449 2454 res.append((alias, tgt ))
2450 2455
2451 2456 # show most interesting aliases last
2452 2457 res.extend(showlast)
2453 2458 print "Total number of aliases:",len(aliases)
2454 2459 return res
2455 2460 try:
2456 2461 alias,cmd = par.split(None,1)
2457 2462 except:
2458 2463 print OInspect.getdoc(self.magic_alias)
2459 2464 else:
2460 2465 nargs = cmd.count('%s')
2461 2466 if nargs>0 and cmd.find('%l')>=0:
2462 2467 error('The %s and %l specifiers are mutually exclusive '
2463 2468 'in alias definitions.')
2464 2469 else: # all looks OK
2465 2470 self.shell.alias_table[alias] = (nargs,cmd)
2466 2471 self.shell.alias_table_validate(verbose=0)
2467 2472 # end magic_alias
2468 2473
2469 2474 def magic_unalias(self, parameter_s = ''):
2470 2475 """Remove an alias"""
2471 2476
2472 2477 aname = parameter_s.strip()
2473 2478 if aname in self.shell.alias_table:
2474 2479 del self.shell.alias_table[aname]
2475 2480 stored = self.db.get('stored_aliases', {} )
2476 2481 if aname in stored:
2477 2482 print "Removing %stored alias",aname
2478 2483 del stored[aname]
2479 2484 self.db['stored_aliases'] = stored
2480 2485
2481 2486
2482 2487 def magic_rehashx(self, parameter_s = ''):
2483 2488 """Update the alias table with all executable files in $PATH.
2484 2489
2485 2490 This version explicitly checks that every entry in $PATH is a file
2486 2491 with execute access (os.X_OK), so it is much slower than %rehash.
2487 2492
2488 2493 Under Windows, it checks executability as a match agains a
2489 2494 '|'-separated string of extensions, stored in the IPython config
2490 2495 variable win_exec_ext. This defaults to 'exe|com|bat'.
2491 2496
2492 2497 This function also resets the root module cache of module completer,
2493 2498 used on slow filesystems.
2494 2499 """
2495 2500
2496 2501
2497 2502 ip = self.api
2498 2503
2499 2504 # for the benefit of module completer in ipy_completers.py
2500 2505 del ip.db['rootmodules']
2501 2506
2502 2507 path = [os.path.abspath(os.path.expanduser(p)) for p in
2503 2508 os.environ.get('PATH','').split(os.pathsep)]
2504 2509 path = filter(os.path.isdir,path)
2505 2510
2506 2511 alias_table = self.shell.alias_table
2507 2512 syscmdlist = []
2508 2513 if os.name == 'posix':
2509 2514 isexec = lambda fname:os.path.isfile(fname) and \
2510 2515 os.access(fname,os.X_OK)
2511 2516 else:
2512 2517
2513 2518 try:
2514 2519 winext = os.environ['pathext'].replace(';','|').replace('.','')
2515 2520 except KeyError:
2516 2521 winext = 'exe|com|bat|py'
2517 2522 if 'py' not in winext:
2518 2523 winext += '|py'
2519 2524 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2520 2525 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2521 2526 savedir = os.getcwd()
2522 2527 try:
2523 2528 # write the whole loop for posix/Windows so we don't have an if in
2524 2529 # the innermost part
2525 2530 if os.name == 'posix':
2526 2531 for pdir in path:
2527 2532 os.chdir(pdir)
2528 2533 for ff in os.listdir(pdir):
2529 2534 if isexec(ff) and ff not in self.shell.no_alias:
2530 2535 # each entry in the alias table must be (N,name),
2531 2536 # where N is the number of positional arguments of the
2532 2537 # alias.
2533 2538 alias_table[ff] = (0,ff)
2534 2539 syscmdlist.append(ff)
2535 2540 else:
2536 2541 for pdir in path:
2537 2542 os.chdir(pdir)
2538 2543 for ff in os.listdir(pdir):
2539 2544 base, ext = os.path.splitext(ff)
2540 2545 if isexec(ff) and base not in self.shell.no_alias:
2541 2546 if ext.lower() == '.exe':
2542 2547 ff = base
2543 2548 alias_table[base.lower()] = (0,ff)
2544 2549 syscmdlist.append(ff)
2545 2550 # Make sure the alias table doesn't contain keywords or builtins
2546 2551 self.shell.alias_table_validate()
2547 2552 # Call again init_auto_alias() so we get 'rm -i' and other
2548 2553 # modified aliases since %rehashx will probably clobber them
2549 2554
2550 2555 # no, we don't want them. if %rehashx clobbers them, good,
2551 2556 # we'll probably get better versions
2552 2557 # self.shell.init_auto_alias()
2553 2558 db = ip.db
2554 2559 db['syscmdlist'] = syscmdlist
2555 2560 finally:
2556 2561 os.chdir(savedir)
2557 2562
2558 2563 def magic_pwd(self, parameter_s = ''):
2559 2564 """Return the current working directory path."""
2560 2565 return os.getcwd()
2561 2566
2562 2567 def magic_cd(self, parameter_s=''):
2563 2568 """Change the current working directory.
2564 2569
2565 2570 This command automatically maintains an internal list of directories
2566 2571 you visit during your IPython session, in the variable _dh. The
2567 2572 command %dhist shows this history nicely formatted. You can also
2568 2573 do 'cd -<tab>' to see directory history conveniently.
2569 2574
2570 2575 Usage:
2571 2576
2572 2577 cd 'dir': changes to directory 'dir'.
2573 2578
2574 2579 cd -: changes to the last visited directory.
2575 2580
2576 2581 cd -<n>: changes to the n-th directory in the directory history.
2577 2582
2578 2583 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2579 2584 (note: cd <bookmark_name> is enough if there is no
2580 2585 directory <bookmark_name>, but a bookmark with the name exists.)
2581 2586 'cd -b <tab>' allows you to tab-complete bookmark names.
2582 2587
2583 2588 Options:
2584 2589
2585 2590 -q: quiet. Do not print the working directory after the cd command is
2586 2591 executed. By default IPython's cd command does print this directory,
2587 2592 since the default prompts do not display path information.
2588 2593
2589 2594 Note that !cd doesn't work for this purpose because the shell where
2590 2595 !command runs is immediately discarded after executing 'command'."""
2591 2596
2592 2597 parameter_s = parameter_s.strip()
2593 2598 #bkms = self.shell.persist.get("bookmarks",{})
2594 2599
2595 2600 numcd = re.match(r'(-)(\d+)$',parameter_s)
2596 2601 # jump in directory history by number
2597 2602 if numcd:
2598 2603 nn = int(numcd.group(2))
2599 2604 try:
2600 2605 ps = self.shell.user_ns['_dh'][nn]
2601 2606 except IndexError:
2602 2607 print 'The requested directory does not exist in history.'
2603 2608 return
2604 2609 else:
2605 2610 opts = {}
2606 2611 else:
2607 2612 #turn all non-space-escaping backslashes to slashes,
2608 2613 # for c:\windows\directory\names\
2609 2614 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2610 2615 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2611 2616 # jump to previous
2612 2617 if ps == '-':
2613 2618 try:
2614 2619 ps = self.shell.user_ns['_dh'][-2]
2615 2620 except IndexError:
2616 print 'No previous directory to change to.'
2617 return
2621 raise UsageError('%cd -: No previous directory to change to.')
2618 2622 # jump to bookmark if needed
2619 2623 else:
2620 2624 if not os.path.isdir(ps) or opts.has_key('b'):
2621 2625 bkms = self.db.get('bookmarks', {})
2622 2626
2623 2627 if bkms.has_key(ps):
2624 2628 target = bkms[ps]
2625 2629 print '(bookmark:%s) -> %s' % (ps,target)
2626 2630 ps = target
2627 2631 else:
2628 2632 if opts.has_key('b'):
2629 error("Bookmark '%s' not found. "
2633 raise UsageError("Bookmark '%s' not found. "
2630 2634 "Use '%%bookmark -l' to see your bookmarks." % ps)
2631 return
2632 2635
2633 2636 # at this point ps should point to the target dir
2634 2637 if ps:
2635 2638 try:
2636 2639 os.chdir(os.path.expanduser(ps))
2637 2640 if self.shell.rc.term_title:
2638 2641 #print 'set term title:',self.shell.rc.term_title # dbg
2639 2642 ttitle = 'IPy ' + abbrev_cwd()
2640 2643 platutils.set_term_title(ttitle)
2641 2644 except OSError:
2642 2645 print sys.exc_info()[1]
2643 2646 else:
2644 2647 cwd = os.getcwd()
2645 2648 dhist = self.shell.user_ns['_dh']
2646 2649 dhist.append(cwd)
2647 2650 self.db['dhist'] = compress_dhist(dhist)[-100:]
2648 2651
2649 2652 else:
2650 2653 os.chdir(self.shell.home_dir)
2651 2654 if self.shell.rc.term_title:
2652 2655 platutils.set_term_title("IPy ~")
2653 2656 cwd = os.getcwd()
2654 2657 dhist = self.shell.user_ns['_dh']
2655 2658 dhist.append(cwd)
2656 2659 self.db['dhist'] = compress_dhist(dhist)[-100:]
2657 2660 if not 'q' in opts and self.shell.user_ns['_dh']:
2658 2661 print self.shell.user_ns['_dh'][-1]
2659 2662
2660 2663
2661 2664 def magic_env(self, parameter_s=''):
2662 2665 """List environment variables."""
2663 2666
2664 2667 return os.environ.data
2665 2668
2666 2669 def magic_pushd(self, parameter_s=''):
2667 2670 """Place the current dir on stack and change directory.
2668 2671
2669 2672 Usage:\\
2670 2673 %pushd ['dirname']
2671 2674 """
2672 2675
2673 2676 dir_s = self.shell.dir_stack
2674 2677 tgt = os.path.expanduser(parameter_s)
2675 2678 cwd = os.getcwd().replace(self.home_dir,'~')
2676 2679 if tgt:
2677 2680 self.magic_cd(parameter_s)
2678 2681 dir_s.insert(0,cwd)
2679 2682 return self.magic_dirs()
2680 2683
2681 2684 def magic_popd(self, parameter_s=''):
2682 2685 """Change to directory popped off the top of the stack.
2683 2686 """
2684 2687 if not self.shell.dir_stack:
2685 raise IPython.ipapi.UsageError("%popd on empty stack")
2688 raise UsageError("%popd on empty stack")
2686 2689 top = self.shell.dir_stack.pop(0)
2687 2690 self.magic_cd(top)
2688 2691 print "popd ->",top
2689 2692
2690 2693 def magic_dirs(self, parameter_s=''):
2691 2694 """Return the current directory stack."""
2692 2695
2693 2696 return self.shell.dir_stack
2694 2697
2695 2698 def magic_dhist(self, parameter_s=''):
2696 2699 """Print your history of visited directories.
2697 2700
2698 2701 %dhist -> print full history\\
2699 2702 %dhist n -> print last n entries only\\
2700 2703 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2701 2704
2702 2705 This history is automatically maintained by the %cd command, and
2703 2706 always available as the global list variable _dh. You can use %cd -<n>
2704 2707 to go to directory number <n>.
2705 2708
2706 2709 Note that most of time, you should view directory history by entering
2707 2710 cd -<TAB>.
2708 2711
2709 2712 """
2710 2713
2711 2714 dh = self.shell.user_ns['_dh']
2712 2715 if parameter_s:
2713 2716 try:
2714 2717 args = map(int,parameter_s.split())
2715 2718 except:
2716 2719 self.arg_err(Magic.magic_dhist)
2717 2720 return
2718 2721 if len(args) == 1:
2719 2722 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2720 2723 elif len(args) == 2:
2721 2724 ini,fin = args
2722 2725 else:
2723 2726 self.arg_err(Magic.magic_dhist)
2724 2727 return
2725 2728 else:
2726 2729 ini,fin = 0,len(dh)
2727 2730 nlprint(dh,
2728 2731 header = 'Directory history (kept in _dh)',
2729 2732 start=ini,stop=fin)
2730 2733
2731 2734
2732 2735 def magic_sc(self, parameter_s=''):
2733 2736 """Shell capture - execute a shell command and capture its output.
2734 2737
2735 2738 DEPRECATED. Suboptimal, retained for backwards compatibility.
2736 2739
2737 2740 You should use the form 'var = !command' instead. Example:
2738 2741
2739 2742 "%sc -l myfiles = ls ~" should now be written as
2740 2743
2741 2744 "myfiles = !ls ~"
2742 2745
2743 2746 myfiles.s, myfiles.l and myfiles.n still apply as documented
2744 2747 below.
2745 2748
2746 2749 --
2747 2750 %sc [options] varname=command
2748 2751
2749 2752 IPython will run the given command using commands.getoutput(), and
2750 2753 will then update the user's interactive namespace with a variable
2751 2754 called varname, containing the value of the call. Your command can
2752 2755 contain shell wildcards, pipes, etc.
2753 2756
2754 2757 The '=' sign in the syntax is mandatory, and the variable name you
2755 2758 supply must follow Python's standard conventions for valid names.
2756 2759
2757 2760 (A special format without variable name exists for internal use)
2758 2761
2759 2762 Options:
2760 2763
2761 2764 -l: list output. Split the output on newlines into a list before
2762 2765 assigning it to the given variable. By default the output is stored
2763 2766 as a single string.
2764 2767
2765 2768 -v: verbose. Print the contents of the variable.
2766 2769
2767 2770 In most cases you should not need to split as a list, because the
2768 2771 returned value is a special type of string which can automatically
2769 2772 provide its contents either as a list (split on newlines) or as a
2770 2773 space-separated string. These are convenient, respectively, either
2771 2774 for sequential processing or to be passed to a shell command.
2772 2775
2773 2776 For example:
2774 2777
2775 2778 # Capture into variable a
2776 2779 In [9]: sc a=ls *py
2777 2780
2778 2781 # a is a string with embedded newlines
2779 2782 In [10]: a
2780 2783 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2781 2784
2782 2785 # which can be seen as a list:
2783 2786 In [11]: a.l
2784 2787 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2785 2788
2786 2789 # or as a whitespace-separated string:
2787 2790 In [12]: a.s
2788 2791 Out[12]: 'setup.py win32_manual_post_install.py'
2789 2792
2790 2793 # a.s is useful to pass as a single command line:
2791 2794 In [13]: !wc -l $a.s
2792 2795 146 setup.py
2793 2796 130 win32_manual_post_install.py
2794 2797 276 total
2795 2798
2796 2799 # while the list form is useful to loop over:
2797 2800 In [14]: for f in a.l:
2798 2801 ....: !wc -l $f
2799 2802 ....:
2800 2803 146 setup.py
2801 2804 130 win32_manual_post_install.py
2802 2805
2803 2806 Similiarly, the lists returned by the -l option are also special, in
2804 2807 the sense that you can equally invoke the .s attribute on them to
2805 2808 automatically get a whitespace-separated string from their contents:
2806 2809
2807 2810 In [1]: sc -l b=ls *py
2808 2811
2809 2812 In [2]: b
2810 2813 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2811 2814
2812 2815 In [3]: b.s
2813 2816 Out[3]: 'setup.py win32_manual_post_install.py'
2814 2817
2815 2818 In summary, both the lists and strings used for ouptut capture have
2816 2819 the following special attributes:
2817 2820
2818 2821 .l (or .list) : value as list.
2819 2822 .n (or .nlstr): value as newline-separated string.
2820 2823 .s (or .spstr): value as space-separated string.
2821 2824 """
2822 2825
2823 2826 opts,args = self.parse_options(parameter_s,'lv')
2824 2827 # Try to get a variable name and command to run
2825 2828 try:
2826 2829 # the variable name must be obtained from the parse_options
2827 2830 # output, which uses shlex.split to strip options out.
2828 2831 var,_ = args.split('=',1)
2829 2832 var = var.strip()
2830 2833 # But the the command has to be extracted from the original input
2831 2834 # parameter_s, not on what parse_options returns, to avoid the
2832 2835 # quote stripping which shlex.split performs on it.
2833 2836 _,cmd = parameter_s.split('=',1)
2834 2837 except ValueError:
2835 2838 var,cmd = '',''
2836 2839 # If all looks ok, proceed
2837 2840 out,err = self.shell.getoutputerror(cmd)
2838 2841 if err:
2839 2842 print >> Term.cerr,err
2840 2843 if opts.has_key('l'):
2841 2844 out = SList(out.split('\n'))
2842 2845 else:
2843 2846 out = LSString(out)
2844 2847 if opts.has_key('v'):
2845 2848 print '%s ==\n%s' % (var,pformat(out))
2846 2849 if var:
2847 2850 self.shell.user_ns.update({var:out})
2848 2851 else:
2849 2852 return out
2850 2853
2851 2854 def magic_sx(self, parameter_s=''):
2852 2855 """Shell execute - run a shell command and capture its output.
2853 2856
2854 2857 %sx command
2855 2858
2856 2859 IPython will run the given command using commands.getoutput(), and
2857 2860 return the result formatted as a list (split on '\\n'). Since the
2858 2861 output is _returned_, it will be stored in ipython's regular output
2859 2862 cache Out[N] and in the '_N' automatic variables.
2860 2863
2861 2864 Notes:
2862 2865
2863 2866 1) If an input line begins with '!!', then %sx is automatically
2864 2867 invoked. That is, while:
2865 2868 !ls
2866 2869 causes ipython to simply issue system('ls'), typing
2867 2870 !!ls
2868 2871 is a shorthand equivalent to:
2869 2872 %sx ls
2870 2873
2871 2874 2) %sx differs from %sc in that %sx automatically splits into a list,
2872 2875 like '%sc -l'. The reason for this is to make it as easy as possible
2873 2876 to process line-oriented shell output via further python commands.
2874 2877 %sc is meant to provide much finer control, but requires more
2875 2878 typing.
2876 2879
2877 2880 3) Just like %sc -l, this is a list with special attributes:
2878 2881
2879 2882 .l (or .list) : value as list.
2880 2883 .n (or .nlstr): value as newline-separated string.
2881 2884 .s (or .spstr): value as whitespace-separated string.
2882 2885
2883 2886 This is very useful when trying to use such lists as arguments to
2884 2887 system commands."""
2885 2888
2886 2889 if parameter_s:
2887 2890 out,err = self.shell.getoutputerror(parameter_s)
2888 2891 if err:
2889 2892 print >> Term.cerr,err
2890 2893 return SList(out.split('\n'))
2891 2894
2892 2895 def magic_bg(self, parameter_s=''):
2893 2896 """Run a job in the background, in a separate thread.
2894 2897
2895 2898 For example,
2896 2899
2897 2900 %bg myfunc(x,y,z=1)
2898 2901
2899 2902 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2900 2903 execution starts, a message will be printed indicating the job
2901 2904 number. If your job number is 5, you can use
2902 2905
2903 2906 myvar = jobs.result(5) or myvar = jobs[5].result
2904 2907
2905 2908 to assign this result to variable 'myvar'.
2906 2909
2907 2910 IPython has a job manager, accessible via the 'jobs' object. You can
2908 2911 type jobs? to get more information about it, and use jobs.<TAB> to see
2909 2912 its attributes. All attributes not starting with an underscore are
2910 2913 meant for public use.
2911 2914
2912 2915 In particular, look at the jobs.new() method, which is used to create
2913 2916 new jobs. This magic %bg function is just a convenience wrapper
2914 2917 around jobs.new(), for expression-based jobs. If you want to create a
2915 2918 new job with an explicit function object and arguments, you must call
2916 2919 jobs.new() directly.
2917 2920
2918 2921 The jobs.new docstring also describes in detail several important
2919 2922 caveats associated with a thread-based model for background job
2920 2923 execution. Type jobs.new? for details.
2921 2924
2922 2925 You can check the status of all jobs with jobs.status().
2923 2926
2924 2927 The jobs variable is set by IPython into the Python builtin namespace.
2925 2928 If you ever declare a variable named 'jobs', you will shadow this
2926 2929 name. You can either delete your global jobs variable to regain
2927 2930 access to the job manager, or make a new name and assign it manually
2928 2931 to the manager (stored in IPython's namespace). For example, to
2929 2932 assign the job manager to the Jobs name, use:
2930 2933
2931 2934 Jobs = __builtins__.jobs"""
2932 2935
2933 2936 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2934 2937
2935 2938 def magic_r(self, parameter_s=''):
2936 2939 """Repeat previous input.
2937 2940
2938 2941 Note: Consider using the more powerfull %rep instead!
2939 2942
2940 2943 If given an argument, repeats the previous command which starts with
2941 2944 the same string, otherwise it just repeats the previous input.
2942 2945
2943 2946 Shell escaped commands (with ! as first character) are not recognized
2944 2947 by this system, only pure python code and magic commands.
2945 2948 """
2946 2949
2947 2950 start = parameter_s.strip()
2948 2951 esc_magic = self.shell.ESC_MAGIC
2949 2952 # Identify magic commands even if automagic is on (which means
2950 2953 # the in-memory version is different from that typed by the user).
2951 2954 if self.shell.rc.automagic:
2952 2955 start_magic = esc_magic+start
2953 2956 else:
2954 2957 start_magic = start
2955 2958 # Look through the input history in reverse
2956 2959 for n in range(len(self.shell.input_hist)-2,0,-1):
2957 2960 input = self.shell.input_hist[n]
2958 2961 # skip plain 'r' lines so we don't recurse to infinity
2959 2962 if input != '_ip.magic("r")\n' and \
2960 2963 (input.startswith(start) or input.startswith(start_magic)):
2961 2964 #print 'match',`input` # dbg
2962 2965 print 'Executing:',input,
2963 2966 self.shell.runlines(input)
2964 2967 return
2965 2968 print 'No previous input matching `%s` found.' % start
2966 2969
2967 2970
2968 2971 def magic_bookmark(self, parameter_s=''):
2969 2972 """Manage IPython's bookmark system.
2970 2973
2971 2974 %bookmark <name> - set bookmark to current dir
2972 2975 %bookmark <name> <dir> - set bookmark to <dir>
2973 2976 %bookmark -l - list all bookmarks
2974 2977 %bookmark -d <name> - remove bookmark
2975 2978 %bookmark -r - remove all bookmarks
2976 2979
2977 2980 You can later on access a bookmarked folder with:
2978 2981 %cd -b <name>
2979 2982 or simply '%cd <name>' if there is no directory called <name> AND
2980 2983 there is such a bookmark defined.
2981 2984
2982 2985 Your bookmarks persist through IPython sessions, but they are
2983 2986 associated with each profile."""
2984 2987
2985 2988 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2986 2989 if len(args) > 2:
2987 error('You can only give at most two arguments')
2988 return
2990 raise UsageError("%bookmark: too many arguments")
2989 2991
2990 2992 bkms = self.db.get('bookmarks',{})
2991 2993
2992 2994 if opts.has_key('d'):
2993 2995 try:
2994 2996 todel = args[0]
2995 2997 except IndexError:
2996 error('You must provide a bookmark to delete')
2998 raise UsageError(
2999 "%bookmark -d: must provide a bookmark to delete")
2997 3000 else:
2998 3001 try:
2999 3002 del bkms[todel]
3000 except:
3001 error("Can't delete bookmark '%s'" % todel)
3003 except KeyError:
3004 raise UsageError(
3005 "%%bookmark -d: Can't delete bookmark '%s'" % todel)
3006
3002 3007 elif opts.has_key('r'):
3003 3008 bkms = {}
3004 3009 elif opts.has_key('l'):
3005 3010 bks = bkms.keys()
3006 3011 bks.sort()
3007 3012 if bks:
3008 3013 size = max(map(len,bks))
3009 3014 else:
3010 3015 size = 0
3011 3016 fmt = '%-'+str(size)+'s -> %s'
3012 3017 print 'Current bookmarks:'
3013 3018 for bk in bks:
3014 3019 print fmt % (bk,bkms[bk])
3015 3020 else:
3016 3021 if not args:
3017 error("You must specify the bookmark name")
3022 raise UsageError("%bookmark: You must specify the bookmark name")
3018 3023 elif len(args)==1:
3019 3024 bkms[args[0]] = os.getcwd()
3020 3025 elif len(args)==2:
3021 3026 bkms[args[0]] = args[1]
3022 3027 self.db['bookmarks'] = bkms
3023 3028
3024 3029 def magic_pycat(self, parameter_s=''):
3025 3030 """Show a syntax-highlighted file through a pager.
3026 3031
3027 3032 This magic is similar to the cat utility, but it will assume the file
3028 3033 to be Python source and will show it with syntax highlighting. """
3029 3034
3030 3035 try:
3031 3036 filename = get_py_filename(parameter_s)
3032 3037 cont = file_read(filename)
3033 3038 except IOError:
3034 3039 try:
3035 3040 cont = eval(parameter_s,self.user_ns)
3036 3041 except NameError:
3037 3042 cont = None
3038 3043 if cont is None:
3039 3044 print "Error: no such file or variable"
3040 3045 return
3041 3046
3042 3047 page(self.shell.pycolorize(cont),
3043 3048 screen_lines=self.shell.rc.screen_length)
3044 3049
3045 3050 def magic_cpaste(self, parameter_s=''):
3046 3051 """Allows you to paste & execute a pre-formatted code block from clipboard
3047 3052
3048 3053 You must terminate the block with '--' (two minus-signs) alone on the
3049 3054 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3050 3055 is the new sentinel for this operation)
3051 3056
3052 3057 The block is dedented prior to execution to enable execution of method
3053 3058 definitions. '>' and '+' characters at the beginning of a line are
3054 3059 ignored, to allow pasting directly from e-mails or diff files. The
3055 3060 executed block is also assigned to variable named 'pasted_block' for
3056 3061 later editing with '%edit pasted_block'.
3057 3062
3058 3063 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3059 3064 This assigns the pasted block to variable 'foo' as string, without
3060 3065 dedenting or executing it.
3061 3066
3062 3067 Do not be alarmed by garbled output on Windows (it's a readline bug).
3063 3068 Just press enter and type -- (and press enter again) and the block
3064 3069 will be what was just pasted.
3065 3070
3066 3071 IPython statements (magics, shell escapes) are not supported (yet).
3067 3072 """
3068 3073 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3069 3074 par = args.strip()
3070 3075 sentinel = opts.get('s','--')
3071 3076
3072 3077 from IPython import iplib
3073 3078 lines = []
3074 3079 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3075 3080 while 1:
3076 3081 l = iplib.raw_input_original(':')
3077 3082 if l ==sentinel:
3078 3083 break
3079 3084 lines.append(l.lstrip('>').lstrip('+'))
3080 3085 block = "\n".join(lines) + '\n'
3081 3086 #print "block:\n",block
3082 3087 if not par:
3083 3088 b = textwrap.dedent(block)
3084 3089 exec b in self.user_ns
3085 3090 self.user_ns['pasted_block'] = b
3086 3091 else:
3087 3092 self.user_ns[par] = block
3088 3093 print "Block assigned to '%s'" % par
3089 3094
3090 3095 def magic_quickref(self,arg):
3091 3096 """ Show a quick reference sheet """
3092 3097 import IPython.usage
3093 3098 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3094 3099
3095 3100 page(qr)
3096 3101
3097 3102 def magic_upgrade(self,arg):
3098 3103 """ Upgrade your IPython installation
3099 3104
3100 3105 This will copy the config files that don't yet exist in your
3101 3106 ipython dir from the system config dir. Use this after upgrading
3102 3107 IPython if you don't wish to delete your .ipython dir.
3103 3108
3104 3109 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3105 3110 new users)
3106 3111
3107 3112 """
3108 3113 ip = self.getapi()
3109 3114 ipinstallation = path(IPython.__file__).dirname()
3110 3115 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3111 3116 src_config = ipinstallation / 'UserConfig'
3112 3117 userdir = path(ip.options.ipythondir)
3113 3118 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3114 3119 print ">",cmd
3115 3120 shell(cmd)
3116 3121 if arg == '-nolegacy':
3117 3122 legacy = userdir.files('ipythonrc*')
3118 3123 print "Nuking legacy files:",legacy
3119 3124
3120 3125 [p.remove() for p in legacy]
3121 3126 suffix = (sys.platform == 'win32' and '.ini' or '')
3122 3127 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3123 3128
3124 3129
3125 3130 def magic_doctest_mode(self,parameter_s=''):
3126 3131 """Toggle doctest mode on and off.
3127 3132
3128 3133 This mode allows you to toggle the prompt behavior between normal
3129 3134 IPython prompts and ones that are as similar to the default IPython
3130 3135 interpreter as possible.
3131 3136
3132 3137 It also supports the pasting of code snippets that have leading '>>>'
3133 3138 and '...' prompts in them. This means that you can paste doctests from
3134 3139 files or docstrings (even if they have leading whitespace), and the
3135 3140 code will execute correctly. You can then use '%history -tn' to see
3136 3141 the translated history without line numbers; this will give you the
3137 3142 input after removal of all the leading prompts and whitespace, which
3138 3143 can be pasted back into an editor.
3139 3144
3140 3145 With these features, you can switch into this mode easily whenever you
3141 3146 need to do testing and changes to doctests, without having to leave
3142 3147 your existing IPython session.
3143 3148 """
3144 3149
3145 3150 # XXX - Fix this to have cleaner activate/deactivate calls.
3146 3151 from IPython.Extensions import InterpreterPasteInput as ipaste
3147 3152 from IPython.ipstruct import Struct
3148 3153
3149 3154 # Shorthands
3150 3155 shell = self.shell
3151 3156 oc = shell.outputcache
3152 3157 rc = shell.rc
3153 3158 meta = shell.meta
3154 3159 # dstore is a data store kept in the instance metadata bag to track any
3155 3160 # changes we make, so we can undo them later.
3156 3161 dstore = meta.setdefault('doctest_mode',Struct())
3157 3162 save_dstore = dstore.setdefault
3158 3163
3159 3164 # save a few values we'll need to recover later
3160 3165 mode = save_dstore('mode',False)
3161 3166 save_dstore('rc_pprint',rc.pprint)
3162 3167 save_dstore('xmode',shell.InteractiveTB.mode)
3163 3168 save_dstore('rc_separate_in',rc.separate_in)
3164 3169 save_dstore('rc_separate_out',rc.separate_out)
3165 3170 save_dstore('rc_separate_out2',rc.separate_out2)
3166 3171 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
3167 3172
3168 3173 if mode == False:
3169 3174 # turn on
3170 3175 ipaste.activate_prefilter()
3171 3176
3172 3177 oc.prompt1.p_template = '>>> '
3173 3178 oc.prompt2.p_template = '... '
3174 3179 oc.prompt_out.p_template = ''
3175 3180
3176 3181 oc.prompt1.sep = '\n'
3177 3182 oc.output_sep = ''
3178 3183 oc.output_sep2 = ''
3179 3184
3180 3185 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3181 3186 oc.prompt_out.pad_left = False
3182 3187
3183 3188 rc.pprint = False
3184 3189
3185 3190 shell.magic_xmode('Plain')
3186 3191
3187 3192 else:
3188 3193 # turn off
3189 3194 ipaste.deactivate_prefilter()
3190 3195
3191 3196 oc.prompt1.p_template = rc.prompt_in1
3192 3197 oc.prompt2.p_template = rc.prompt_in2
3193 3198 oc.prompt_out.p_template = rc.prompt_out
3194 3199
3195 3200 oc.prompt1.sep = dstore.rc_separate_in
3196 3201 oc.output_sep = dstore.rc_separate_out
3197 3202 oc.output_sep2 = dstore.rc_separate_out2
3198 3203
3199 3204 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3200 3205 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
3201 3206
3202 3207 rc.pprint = dstore.rc_pprint
3203 3208
3204 3209 shell.magic_xmode(dstore.xmode)
3205 3210
3206 3211 # Store new mode and inform
3207 3212 dstore.mode = bool(1-int(mode))
3208 3213 print 'Doctest mode is:',
3209 3214 print ['OFF','ON'][dstore.mode]
3210 3215
3211 3216 # end Magic
@@ -1,7157 +1,7162 b''
1 1 2007-09-08 Ville Vainio <vivainio@gmail.com>
2 2
3 3 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
4 4 directory, not the target directory.
5 5
6 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
7 exception that won't print the tracebacks. Switched many magics to
8 raise them on error situations, also GetoptError is not printed
9 anymore.
10
6 11 2007-09-07 Ville Vainio <vivainio@gmail.com>
7 12
8 13 * iplib.py: do not auto-alias "dir", it screws up other dir auto
9 14 aliases.
10 15
11 16 * genutils.py: SList.grep() implemented.
12 17
13 18 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
14 19 for easy "out of the box" setup of several common editors, so that
15 20 e.g. '%edit os.path.isfile' will jump to the correct line
16 21 automatically. Contributions for command lines of your favourite
17 22 editors welcome.
18 23
19 24 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
20 25
21 26 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
22 27 preventing source display in certain cases. In reality I think
23 28 the problem is with Ubuntu's Python build, but this change works
24 29 around the issue in some cases (not in all, unfortunately). I'd
25 30 filed a Python bug on this with more details, but in the change of
26 31 bug trackers it seems to have been lost.
27 32
28 33 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
29 34 not the same, it's not self-documenting, doesn't allow range
30 35 selection, and sorts alphabetically instead of numerically.
31 36 (magic_r): restore %r. No, "up + enter. One char magic" is not
32 37 the same thing, since %r takes parameters to allow fast retrieval
33 38 of old commands. I've received emails from users who use this a
34 39 LOT, so it stays.
35 40 (magic_automagic): restore %automagic. "use _ip.option.automagic"
36 41 is not a valid replacement b/c it doesn't provide an complete
37 42 explanation (which the automagic docstring does).
38 43 (magic_autocall): restore %autocall, with improved docstring.
39 44 Same argument as for others, "use _ip.options.autocall" is not a
40 45 valid replacement.
41 46 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
42 47 tutorials and online docs.
43 48
44 49 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
45 50
46 51 * IPython/usage.py (quick_reference): mention magics in quickref,
47 52 modified main banner to mention %quickref.
48 53
49 54 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
50 55
51 56 2007-09-06 Ville Vainio <vivainio@gmail.com>
52 57
53 58 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
54 59 Callable aliases now pass the _ip as first arg. This breaks
55 60 compatibility with earlier 0.8.2.svn series! (though they should
56 61 not have been in use yet outside these few extensions)
57 62
58 63 2007-09-05 Ville Vainio <vivainio@gmail.com>
59 64
60 65 * external/mglob.py: expand('dirname') => ['dirname'], instead
61 66 of ['dirname/foo','dirname/bar', ...].
62 67
63 68 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
64 69 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
65 70 is useful for others as well).
66 71
67 72 * iplib.py: on callable aliases (as opposed to old style aliases),
68 73 do var_expand() immediately, and use make_quoted_expr instead
69 74 of hardcoded r"""
70 75
71 76 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
72 77 if not available load ipy_fsops.py for cp, mv, etc. replacements
73 78
74 79 * OInspect.py, ipy_which.py: improve %which and obj? for callable
75 80 aliases
76 81
77 82 2007-09-04 Ville Vainio <vivainio@gmail.com>
78 83
79 84 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
80 85 Relicensed under BSD with the authors approval.
81 86
82 87 * ipmaker.py, usage.py: Remove %magic from default banner, improve
83 88 %quickref
84 89
85 90 2007-09-03 Ville Vainio <vivainio@gmail.com>
86 91
87 92 * Magic.py: %time now passes expression through prefilter,
88 93 allowing IPython syntax.
89 94
90 95 2007-09-01 Ville Vainio <vivainio@gmail.com>
91 96
92 97 * ipmaker.py: Always show full traceback when newstyle config fails
93 98
94 99 2007-08-27 Ville Vainio <vivainio@gmail.com>
95 100
96 101 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
97 102
98 103 2007-08-26 Ville Vainio <vivainio@gmail.com>
99 104
100 105 * ipmaker.py: Command line args have the highest priority again
101 106
102 107 * iplib.py, ipmaker.py: -i command line argument now behaves as in
103 108 normal python, i.e. leaves the IPython session running after -c
104 109 command or running a batch file from command line.
105 110
106 111 2007-08-22 Ville Vainio <vivainio@gmail.com>
107 112
108 113 * iplib.py: no extra empty (last) line in raw hist w/ multiline
109 114 statements
110 115
111 116 * logger.py: Fix bug where blank lines in history were not
112 117 added until AFTER adding the current line; translated and raw
113 118 history should finally be in sync with prompt now.
114 119
115 120 * ipy_completers.py: quick_completer now makes it easy to create
116 121 trivial custom completers
117 122
118 123 * clearcmd.py: shadow history compression & erasing, fixed input hist
119 124 clearing.
120 125
121 126 * envpersist.py, history.py: %env (sh profile only), %hist completers
122 127
123 128 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
124 129 term title now include the drive letter, and always use / instead of
125 130 os.sep (as per recommended approach for win32 ipython in general).
126 131
127 132 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
128 133 plain python scripts from ipykit command line by running
129 134 "py myscript.py", even w/o installed python.
130 135
131 136 2007-08-21 Ville Vainio <vivainio@gmail.com>
132 137
133 138 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
134 139 (for backwards compatibility)
135 140
136 141 * history.py: switch back to %hist -t from %hist -r as default.
137 142 At least until raw history is fixed for good.
138 143
139 144 2007-08-20 Ville Vainio <vivainio@gmail.com>
140 145
141 146 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
142 147 locate alias redeclarations etc. Also, avoid handling
143 148 _ip.IP.alias_table directly, prefer using _ip.defalias.
144 149
145 150
146 151 2007-08-15 Ville Vainio <vivainio@gmail.com>
147 152
148 153 * prefilter.py: ! is now always served first
149 154
150 155 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
151 156
152 157 * IPython/iplib.py (safe_execfile): fix the SystemExit
153 158 auto-suppression code to work in Python2.4 (the internal structure
154 159 of that exception changed and I'd only tested the code with 2.5).
155 160 Bug reported by a SciPy attendee.
156 161
157 162 2007-08-13 Ville Vainio <vivainio@gmail.com>
158 163
159 164 * prefilter.py: reverted !c:/bin/foo fix, made % in
160 165 multiline specials work again
161 166
162 167 2007-08-13 Ville Vainio <vivainio@gmail.com>
163 168
164 169 * prefilter.py: Take more care to special-case !, so that
165 170 !c:/bin/foo.exe works.
166 171
167 172 * setup.py: if we are building eggs, strip all docs and
168 173 examples (it doesn't make sense to bytecompile examples,
169 174 and docs would be in an awkward place anyway).
170 175
171 176 * Ryan Krauss' patch fixes start menu shortcuts when IPython
172 177 is installed into a directory that has spaces in the name.
173 178
174 179 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
175 180
176 181 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
177 182 doctest profile and %doctest_mode, so they actually generate the
178 183 blank lines needed by doctest to separate individual tests.
179 184
180 185 * IPython/iplib.py (safe_execfile): modify so that running code
181 186 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
182 187 doesn't get a printed traceback. Any other value in sys.exit(),
183 188 including the empty call, still generates a traceback. This
184 189 enables use of %run without having to pass '-e' for codes that
185 190 correctly set the exit status flag.
186 191
187 192 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
188 193
189 194 * IPython/iplib.py (InteractiveShell.post_config_initialization):
190 195 fix problems with doctests failing when run inside IPython due to
191 196 IPython's modifications of sys.displayhook.
192 197
193 198 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
194 199
195 200 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
196 201 a string with names.
197 202
198 203 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
199 204
200 205 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
201 206 magic to toggle on/off the doctest pasting support without having
202 207 to leave a session to switch to a separate profile.
203 208
204 209 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
205 210
206 211 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
207 212 introduce a blank line between inputs, to conform to doctest
208 213 requirements.
209 214
210 215 * IPython/OInspect.py (Inspector.pinfo): fix another part where
211 216 auto-generated docstrings for new-style classes were showing up.
212 217
213 218 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
214 219
215 220 * api_changes: Add new file to track backward-incompatible
216 221 user-visible changes.
217 222
218 223 2007-08-06 Ville Vainio <vivainio@gmail.com>
219 224
220 225 * ipmaker.py: fix bug where user_config_ns didn't exist at all
221 226 before all the config files were handled.
222 227
223 228 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
224 229
225 230 * IPython/irunner.py (RunnerFactory): Add new factory class for
226 231 creating reusable runners based on filenames.
227 232
228 233 * IPython/Extensions/ipy_profile_doctest.py: New profile for
229 234 doctest support. It sets prompts/exceptions as similar to
230 235 standard Python as possible, so that ipython sessions in this
231 236 profile can be easily pasted as doctests with minimal
232 237 modifications. It also enables pasting of doctests from external
233 238 sources (even if they have leading whitespace), so that you can
234 239 rerun doctests from existing sources.
235 240
236 241 * IPython/iplib.py (_prefilter): fix a buglet where after entering
237 242 some whitespace, the prompt would become a continuation prompt
238 243 with no way of exiting it other than Ctrl-C. This fix brings us
239 244 into conformity with how the default python prompt works.
240 245
241 246 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
242 247 Add support for pasting not only lines that start with '>>>', but
243 248 also with ' >>>'. That is, arbitrary whitespace can now precede
244 249 the prompts. This makes the system useful for pasting doctests
245 250 from docstrings back into a normal session.
246 251
247 252 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
248 253
249 254 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
250 255 r1357, which had killed multiple invocations of an embedded
251 256 ipython (this means that example-embed has been broken for over 1
252 257 year!!!). Rather than possibly breaking the batch stuff for which
253 258 the code in iplib.py/interact was introduced, I worked around the
254 259 problem in the embedding class in Shell.py. We really need a
255 260 bloody test suite for this code, I'm sick of finding stuff that
256 261 used to work breaking left and right every time I use an old
257 262 feature I hadn't touched in a few months.
258 263 (kill_embedded): Add a new magic that only shows up in embedded
259 264 mode, to allow users to permanently deactivate an embedded instance.
260 265
261 266 2007-08-01 Ville Vainio <vivainio@gmail.com>
262 267
263 268 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
264 269 history gets out of sync on runlines (e.g. when running macros).
265 270
266 271 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
267 272
268 273 * IPython/Magic.py (magic_colors): fix win32-related error message
269 274 that could appear under *nix when readline was missing. Patch by
270 275 Scott Jackson, closes #175.
271 276
272 277 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
273 278
274 279 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
275 280 completer that it traits-aware, so that traits objects don't show
276 281 all of their internal attributes all the time.
277 282
278 283 * IPython/genutils.py (dir2): moved this code from inside
279 284 completer.py to expose it publicly, so I could use it in the
280 285 wildcards bugfix.
281 286
282 287 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
283 288 Stefan with Traits.
284 289
285 290 * IPython/completer.py (Completer.attr_matches): change internal
286 291 var name from 'object' to 'obj', since 'object' is now a builtin
287 292 and this can lead to weird bugs if reusing this code elsewhere.
288 293
289 294 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
290 295
291 296 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
292 297 'foo?' and update the code to prevent printing of default
293 298 docstrings that started appearing after I added support for
294 299 new-style classes. The approach I'm using isn't ideal (I just
295 300 special-case those strings) but I'm not sure how to more robustly
296 301 differentiate between truly user-written strings and Python's
297 302 automatic ones.
298 303
299 304 2007-07-09 Ville Vainio <vivainio@gmail.com>
300 305
301 306 * completer.py: Applied Matthew Neeley's patch:
302 307 Dynamic attributes from trait_names and _getAttributeNames are added
303 308 to the list of tab completions, but when this happens, the attribute
304 309 list is turned into a set, so the attributes are unordered when
305 310 printed, which makes it hard to find the right completion. This patch
306 311 turns this set back into a list and sort it.
307 312
308 313 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
309 314
310 315 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
311 316 classes in various inspector functions.
312 317
313 318 2007-06-28 Ville Vainio <vivainio@gmail.com>
314 319
315 320 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
316 321 Implement "shadow" namespace, and callable aliases that reside there.
317 322 Use them by:
318 323
319 324 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
320 325
321 326 foo hello world
322 327 (gets translated to:)
323 328 _sh.foo(r"""hello world""")
324 329
325 330 In practice, this kind of alias can take the role of a magic function
326 331
327 332 * New generic inspect_object, called on obj? and obj??
328 333
329 334 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
330 335
331 336 * IPython/ultraTB.py (findsource): fix a problem with
332 337 inspect.getfile that can cause crashes during traceback construction.
333 338
334 339 2007-06-14 Ville Vainio <vivainio@gmail.com>
335 340
336 341 * iplib.py (handle_auto): Try to use ascii for printing "--->"
337 342 autocall rewrite indication, becausesometimes unicode fails to print
338 343 properly (and you get ' - - - '). Use plain uncoloured ---> for
339 344 unicode.
340 345
341 346 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
342 347
343 348 . pickleshare 'hash' commands (hget, hset, hcompress,
344 349 hdict) for efficient shadow history storage.
345 350
346 351 2007-06-13 Ville Vainio <vivainio@gmail.com>
347 352
348 353 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
349 354 Added kw arg 'interactive', tell whether vars should be visible
350 355 with %whos.
351 356
352 357 2007-06-11 Ville Vainio <vivainio@gmail.com>
353 358
354 359 * pspersistence.py, Magic.py, iplib.py: directory history now saved
355 360 to db
356 361
357 362 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
358 363 Also, it exits IPython immediately after evaluating the command (just like
359 364 std python)
360 365
361 366 2007-06-05 Walter Doerwald <walter@livinglogic.de>
362 367
363 368 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
364 369 Python string and captures the output. (Idea and original patch by
365 370 Stefan van der Walt)
366 371
367 372 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
368 373
369 374 * IPython/ultraTB.py (VerboseTB.text): update printing of
370 375 exception types for Python 2.5 (now all exceptions in the stdlib
371 376 are new-style classes).
372 377
373 378 2007-05-31 Walter Doerwald <walter@livinglogic.de>
374 379
375 380 * IPython/Extensions/igrid.py: Add new commands refresh and
376 381 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
377 382 the iterator once (refresh) or after every x seconds (refresh_timer).
378 383 Add a working implementation of "searchexpression", where the text
379 384 entered is not the text to search for, but an expression that must
380 385 be true. Added display of shortcuts to the menu. Added commands "pickinput"
381 386 and "pickinputattr" that put the object or attribute under the cursor
382 387 in the input line. Split the statusbar to be able to display the currently
383 388 active refresh interval. (Patch by Nik Tautenhahn)
384 389
385 390 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
386 391
387 392 * fixing set_term_title to use ctypes as default
388 393
389 394 * fixing set_term_title fallback to work when curent dir
390 395 is on a windows network share
391 396
392 397 2007-05-28 Ville Vainio <vivainio@gmail.com>
393 398
394 399 * %cpaste: strip + with > from left (diffs).
395 400
396 401 * iplib.py: Fix crash when readline not installed
397 402
398 403 2007-05-26 Ville Vainio <vivainio@gmail.com>
399 404
400 405 * generics.py: intruduce easy to extend result_display generic
401 406 function (using simplegeneric.py).
402 407
403 408 * Fixed the append functionality of %set.
404 409
405 410 2007-05-25 Ville Vainio <vivainio@gmail.com>
406 411
407 412 * New magic: %rep (fetch / run old commands from history)
408 413
409 414 * New extension: mglob (%mglob magic), for powerful glob / find /filter
410 415 like functionality
411 416
412 417 % maghistory.py: %hist -g PATTERM greps the history for pattern
413 418
414 419 2007-05-24 Walter Doerwald <walter@livinglogic.de>
415 420
416 421 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
417 422 browse the IPython input history
418 423
419 424 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
420 425 (mapped to "i") can be used to put the object under the curser in the input
421 426 line. pickinputattr (mapped to "I") does the same for the attribute under
422 427 the cursor.
423 428
424 429 2007-05-24 Ville Vainio <vivainio@gmail.com>
425 430
426 431 * Grand magic cleansing (changeset [2380]):
427 432
428 433 * Introduce ipy_legacy.py where the following magics were
429 434 moved:
430 435
431 436 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
432 437
433 438 If you need them, either use default profile or "import ipy_legacy"
434 439 in your ipy_user_conf.py
435 440
436 441 * Move sh and scipy profile to Extensions from UserConfig. this implies
437 442 you should not edit them, but you don't need to run %upgrade when
438 443 upgrading IPython anymore.
439 444
440 445 * %hist/%history now operates in "raw" mode by default. To get the old
441 446 behaviour, run '%hist -n' (native mode).
442 447
443 448 * split ipy_stock_completers.py to ipy_stock_completers.py and
444 449 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
445 450 installed as default.
446 451
447 452 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
448 453 handling.
449 454
450 455 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
451 456 input if readline is available.
452 457
453 458 2007-05-23 Ville Vainio <vivainio@gmail.com>
454 459
455 460 * macro.py: %store uses __getstate__ properly
456 461
457 462 * exesetup.py: added new setup script for creating
458 463 standalone IPython executables with py2exe (i.e.
459 464 no python installation required).
460 465
461 466 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
462 467 its place.
463 468
464 469 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
465 470
466 471 2007-05-21 Ville Vainio <vivainio@gmail.com>
467 472
468 473 * platutil_win32.py (set_term_title): handle
469 474 failure of 'title' system call properly.
470 475
471 476 2007-05-17 Walter Doerwald <walter@livinglogic.de>
472 477
473 478 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
474 479 (Bug detected by Paul Mueller).
475 480
476 481 2007-05-16 Ville Vainio <vivainio@gmail.com>
477 482
478 483 * ipy_profile_sci.py, ipython_win_post_install.py: Create
479 484 new "sci" profile, effectively a modern version of the old
480 485 "scipy" profile (which is now slated for deprecation).
481 486
482 487 2007-05-15 Ville Vainio <vivainio@gmail.com>
483 488
484 489 * pycolorize.py, pycolor.1: Paul Mueller's patches that
485 490 make pycolorize read input from stdin when run without arguments.
486 491
487 492 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
488 493
489 494 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
490 495 it in sh profile (instead of ipy_system_conf.py).
491 496
492 497 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
493 498 aliases are now lower case on windows (MyCommand.exe => mycommand).
494 499
495 500 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
496 501 Macros are now callable objects that inherit from ipapi.IPyAutocall,
497 502 i.e. get autocalled regardless of system autocall setting.
498 503
499 504 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
500 505
501 506 * IPython/rlineimpl.py: check for clear_history in readline and
502 507 make it a dummy no-op if not available. This function isn't
503 508 guaranteed to be in the API and appeared in Python 2.4, so we need
504 509 to check it ourselves. Also, clean up this file quite a bit.
505 510
506 511 * ipython.1: update man page and full manual with information
507 512 about threads (remove outdated warning). Closes #151.
508 513
509 514 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
510 515
511 516 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
512 517 in trunk (note that this made it into the 0.8.1 release already,
513 518 but the changelogs didn't get coordinated). Many thanks to Gael
514 519 Varoquaux <gael.varoquaux-AT-normalesup.org>
515 520
516 521 2007-05-09 *** Released version 0.8.1
517 522
518 523 2007-05-10 Walter Doerwald <walter@livinglogic.de>
519 524
520 525 * IPython/Extensions/igrid.py: Incorporate html help into
521 526 the module, so we don't have to search for the file.
522 527
523 528 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
524 529
525 530 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
526 531
527 532 2007-04-30 Ville Vainio <vivainio@gmail.com>
528 533
529 534 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
530 535 user has illegal (non-ascii) home directory name
531 536
532 537 2007-04-27 Ville Vainio <vivainio@gmail.com>
533 538
534 539 * platutils_win32.py: implement set_term_title for windows
535 540
536 541 * Update version number
537 542
538 543 * ipy_profile_sh.py: more informative prompt (2 dir levels)
539 544
540 545 2007-04-26 Walter Doerwald <walter@livinglogic.de>
541 546
542 547 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
543 548 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
544 549 bug discovered by Ville).
545 550
546 551 2007-04-26 Ville Vainio <vivainio@gmail.com>
547 552
548 553 * Extensions/ipy_completers.py: Olivier's module completer now
549 554 saves the list of root modules if it takes > 4 secs on the first run.
550 555
551 556 * Magic.py (%rehashx): %rehashx now clears the completer cache
552 557
553 558
554 559 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
555 560
556 561 * ipython.el: fix incorrect color scheme, reported by Stefan.
557 562 Closes #149.
558 563
559 564 * IPython/PyColorize.py (Parser.format2): fix state-handling
560 565 logic. I still don't like how that code handles state, but at
561 566 least now it should be correct, if inelegant. Closes #146.
562 567
563 568 2007-04-25 Ville Vainio <vivainio@gmail.com>
564 569
565 570 * Extensions/ipy_which.py: added extension for %which magic, works
566 571 a lot like unix 'which' but also finds and expands aliases, and
567 572 allows wildcards.
568 573
569 574 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
570 575 as opposed to returning nothing.
571 576
572 577 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
573 578 ipy_stock_completers on default profile, do import on sh profile.
574 579
575 580 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
576 581
577 582 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
578 583 like ipython.py foo.py which raised a IndexError.
579 584
580 585 2007-04-21 Ville Vainio <vivainio@gmail.com>
581 586
582 587 * Extensions/ipy_extutil.py: added extension to manage other ipython
583 588 extensions. Now only supports 'ls' == list extensions.
584 589
585 590 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
586 591
587 592 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
588 593 would prevent use of the exception system outside of a running
589 594 IPython instance.
590 595
591 596 2007-04-20 Ville Vainio <vivainio@gmail.com>
592 597
593 598 * Extensions/ipy_render.py: added extension for easy
594 599 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
595 600 'Iptl' template notation,
596 601
597 602 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
598 603 safer & faster 'import' completer.
599 604
600 605 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
601 606 and _ip.defalias(name, command).
602 607
603 608 * Extensions/ipy_exportdb.py: New extension for exporting all the
604 609 %store'd data in a portable format (normal ipapi calls like
605 610 defmacro() etc.)
606 611
607 612 2007-04-19 Ville Vainio <vivainio@gmail.com>
608 613
609 614 * upgrade_dir.py: skip junk files like *.pyc
610 615
611 616 * Release.py: version number to 0.8.1
612 617
613 618 2007-04-18 Ville Vainio <vivainio@gmail.com>
614 619
615 620 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
616 621 and later on win32.
617 622
618 623 2007-04-16 Ville Vainio <vivainio@gmail.com>
619 624
620 625 * iplib.py (showtraceback): Do not crash when running w/o readline.
621 626
622 627 2007-04-12 Walter Doerwald <walter@livinglogic.de>
623 628
624 629 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
625 630 sorted (case sensitive with files and dirs mixed).
626 631
627 632 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
628 633
629 634 * IPython/Release.py (version): Open trunk for 0.8.1 development.
630 635
631 636 2007-04-10 *** Released version 0.8.0
632 637
633 638 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
634 639
635 640 * Tag 0.8.0 for release.
636 641
637 642 * IPython/iplib.py (reloadhist): add API function to cleanly
638 643 reload the readline history, which was growing inappropriately on
639 644 every %run call.
640 645
641 646 * win32_manual_post_install.py (run): apply last part of Nicolas
642 647 Pernetty's patch (I'd accidentally applied it in a different
643 648 directory and this particular file didn't get patched).
644 649
645 650 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
646 651
647 652 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
648 653 find the main thread id and use the proper API call. Thanks to
649 654 Stefan for the fix.
650 655
651 656 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
652 657 unit tests to reflect fixed ticket #52, and add more tests sent by
653 658 him.
654 659
655 660 * IPython/iplib.py (raw_input): restore the readline completer
656 661 state on every input, in case third-party code messed it up.
657 662 (_prefilter): revert recent addition of early-escape checks which
658 663 prevent many valid alias calls from working.
659 664
660 665 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
661 666 flag for sigint handler so we don't run a full signal() call on
662 667 each runcode access.
663 668
664 669 * IPython/Magic.py (magic_whos): small improvement to diagnostic
665 670 message.
666 671
667 672 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
668 673
669 674 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
670 675 asynchronous exceptions working, i.e., Ctrl-C can actually
671 676 interrupt long-running code in the multithreaded shells.
672 677
673 678 This is using Tomer Filiba's great ctypes-based trick:
674 679 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
675 680 this in the past, but hadn't been able to make it work before. So
676 681 far it looks like it's actually running, but this needs more
677 682 testing. If it really works, I'll be *very* happy, and we'll owe
678 683 a huge thank you to Tomer. My current implementation is ugly,
679 684 hackish and uses nasty globals, but I don't want to try and clean
680 685 anything up until we know if it actually works.
681 686
682 687 NOTE: this feature needs ctypes to work. ctypes is included in
683 688 Python2.5, but 2.4 users will need to manually install it. This
684 689 feature makes multi-threaded shells so much more usable that it's
685 690 a minor price to pay (ctypes is very easy to install, already a
686 691 requirement for win32 and available in major linux distros).
687 692
688 693 2007-04-04 Ville Vainio <vivainio@gmail.com>
689 694
690 695 * Extensions/ipy_completers.py, ipy_stock_completers.py:
691 696 Moved implementations of 'bundled' completers to ipy_completers.py,
692 697 they are only enabled in ipy_stock_completers.py.
693 698
694 699 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
695 700
696 701 * IPython/PyColorize.py (Parser.format2): Fix identation of
697 702 colorzied output and return early if color scheme is NoColor, to
698 703 avoid unnecessary and expensive tokenization. Closes #131.
699 704
700 705 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
701 706
702 707 * IPython/Debugger.py: disable the use of pydb version 1.17. It
703 708 has a critical bug (a missing import that makes post-mortem not
704 709 work at all). Unfortunately as of this time, this is the version
705 710 shipped with Ubuntu Edgy, so quite a few people have this one. I
706 711 hope Edgy will update to a more recent package.
707 712
708 713 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
709 714
710 715 * IPython/iplib.py (_prefilter): close #52, second part of a patch
711 716 set by Stefan (only the first part had been applied before).
712 717
713 718 * IPython/Extensions/ipy_stock_completers.py (module_completer):
714 719 remove usage of the dangerous pkgutil.walk_packages(). See
715 720 details in comments left in the code.
716 721
717 722 * IPython/Magic.py (magic_whos): add support for numpy arrays
718 723 similar to what we had for Numeric.
719 724
720 725 * IPython/completer.py (IPCompleter.complete): extend the
721 726 complete() call API to support completions by other mechanisms
722 727 than readline. Closes #109.
723 728
724 729 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
725 730 protect against a bug in Python's execfile(). Closes #123.
726 731
727 732 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
728 733
729 734 * IPython/iplib.py (split_user_input): ensure that when splitting
730 735 user input, the part that can be treated as a python name is pure
731 736 ascii (Python identifiers MUST be pure ascii). Part of the
732 737 ongoing Unicode support work.
733 738
734 739 * IPython/Prompts.py (prompt_specials_color): Add \N for the
735 740 actual prompt number, without any coloring. This allows users to
736 741 produce numbered prompts with their own colors. Added after a
737 742 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
738 743
739 744 2007-03-31 Walter Doerwald <walter@livinglogic.de>
740 745
741 746 * IPython/Extensions/igrid.py: Map the return key
742 747 to enter() and shift-return to enterattr().
743 748
744 749 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
745 750
746 751 * IPython/Magic.py (magic_psearch): add unicode support by
747 752 encoding to ascii the input, since this routine also only deals
748 753 with valid Python names. Fixes a bug reported by Stefan.
749 754
750 755 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
751 756
752 757 * IPython/Magic.py (_inspect): convert unicode input into ascii
753 758 before trying to evaluate it as a Python identifier. This fixes a
754 759 problem that the new unicode support had introduced when analyzing
755 760 long definition lines for functions.
756 761
757 762 2007-03-24 Walter Doerwald <walter@livinglogic.de>
758 763
759 764 * IPython/Extensions/igrid.py: Fix picking. Using
760 765 igrid with wxPython 2.6 and -wthread should work now.
761 766 igrid.display() simply tries to create a frame without
762 767 an application. Only if this fails an application is created.
763 768
764 769 2007-03-23 Walter Doerwald <walter@livinglogic.de>
765 770
766 771 * IPython/Extensions/path.py: Updated to version 2.2.
767 772
768 773 2007-03-23 Ville Vainio <vivainio@gmail.com>
769 774
770 775 * iplib.py: recursive alias expansion now works better, so that
771 776 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
772 777 doesn't trip up the process, if 'd' has been aliased to 'ls'.
773 778
774 779 * Extensions/ipy_gnuglobal.py added, provides %global magic
775 780 for users of http://www.gnu.org/software/global
776 781
777 782 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
778 783 Closes #52. Patch by Stefan van der Walt.
779 784
780 785 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
781 786
782 787 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
783 788 respect the __file__ attribute when using %run. Thanks to a bug
784 789 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
785 790
786 791 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
787 792
788 793 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
789 794 input. Patch sent by Stefan.
790 795
791 796 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
792 797 * IPython/Extensions/ipy_stock_completer.py
793 798 shlex_split, fix bug in shlex_split. len function
794 799 call was missing an if statement. Caused shlex_split to
795 800 sometimes return "" as last element.
796 801
797 802 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
798 803
799 804 * IPython/completer.py
800 805 (IPCompleter.file_matches.single_dir_expand): fix a problem
801 806 reported by Stefan, where directories containign a single subdir
802 807 would be completed too early.
803 808
804 809 * IPython/Shell.py (_load_pylab): Make the execution of 'from
805 810 pylab import *' when -pylab is given be optional. A new flag,
806 811 pylab_import_all controls this behavior, the default is True for
807 812 backwards compatibility.
808 813
809 814 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
810 815 modified) R. Bernstein's patch for fully syntax highlighted
811 816 tracebacks. The functionality is also available under ultraTB for
812 817 non-ipython users (someone using ultraTB but outside an ipython
813 818 session). They can select the color scheme by setting the
814 819 module-level global DEFAULT_SCHEME. The highlight functionality
815 820 also works when debugging.
816 821
817 822 * IPython/genutils.py (IOStream.close): small patch by
818 823 R. Bernstein for improved pydb support.
819 824
820 825 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
821 826 DaveS <davls@telus.net> to improve support of debugging under
822 827 NTEmacs, including improved pydb behavior.
823 828
824 829 * IPython/Magic.py (magic_prun): Fix saving of profile info for
825 830 Python 2.5, where the stats object API changed a little. Thanks
826 831 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
827 832
828 833 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
829 834 Pernetty's patch to improve support for (X)Emacs under Win32.
830 835
831 836 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
832 837
833 838 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
834 839 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
835 840 a report by Nik Tautenhahn.
836 841
837 842 2007-03-16 Walter Doerwald <walter@livinglogic.de>
838 843
839 844 * setup.py: Add the igrid help files to the list of data files
840 845 to be installed alongside igrid.
841 846 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
842 847 Show the input object of the igrid browser as the window tile.
843 848 Show the object the cursor is on in the statusbar.
844 849
845 850 2007-03-15 Ville Vainio <vivainio@gmail.com>
846 851
847 852 * Extensions/ipy_stock_completers.py: Fixed exception
848 853 on mismatching quotes in %run completer. Patch by
849 854 Jorgen Stenarson. Closes #127.
850 855
851 856 2007-03-14 Ville Vainio <vivainio@gmail.com>
852 857
853 858 * Extensions/ext_rehashdir.py: Do not do auto_alias
854 859 in %rehashdir, it clobbers %store'd aliases.
855 860
856 861 * UserConfig/ipy_profile_sh.py: envpersist.py extension
857 862 (beefed up %env) imported for sh profile.
858 863
859 864 2007-03-10 Walter Doerwald <walter@livinglogic.de>
860 865
861 866 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
862 867 as the default browser.
863 868 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
864 869 As igrid displays all attributes it ever encounters, fetch() (which has
865 870 been renamed to _fetch()) doesn't have to recalculate the display attributes
866 871 every time a new item is fetched. This should speed up scrolling.
867 872
868 873 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
869 874
870 875 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
871 876 Schmolck's recently reported tab-completion bug (my previous one
872 877 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
873 878
874 879 2007-03-09 Walter Doerwald <walter@livinglogic.de>
875 880
876 881 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
877 882 Close help window if exiting igrid.
878 883
879 884 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
880 885
881 886 * IPython/Extensions/ipy_defaults.py: Check if readline is available
882 887 before calling functions from readline.
883 888
884 889 2007-03-02 Walter Doerwald <walter@livinglogic.de>
885 890
886 891 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
887 892 igrid is a wxPython-based display object for ipipe. If your system has
888 893 wx installed igrid will be the default display. Without wx ipipe falls
889 894 back to ibrowse (which needs curses). If no curses is installed ipipe
890 895 falls back to idump.
891 896
892 897 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
893 898
894 899 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
895 900 my changes from yesterday, they introduced bugs. Will reactivate
896 901 once I get a correct solution, which will be much easier thanks to
897 902 Dan Milstein's new prefilter test suite.
898 903
899 904 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
900 905
901 906 * IPython/iplib.py (split_user_input): fix input splitting so we
902 907 don't attempt attribute accesses on things that can't possibly be
903 908 valid Python attributes. After a bug report by Alex Schmolck.
904 909 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
905 910 %magic with explicit % prefix.
906 911
907 912 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
908 913
909 914 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
910 915 avoid a DeprecationWarning from GTK.
911 916
912 917 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
913 918
914 919 * IPython/genutils.py (clock): I modified clock() to return total
915 920 time, user+system. This is a more commonly needed metric. I also
916 921 introduced the new clocku/clocks to get only user/system time if
917 922 one wants those instead.
918 923
919 924 ***WARNING: API CHANGE*** clock() used to return only user time,
920 925 so if you want exactly the same results as before, use clocku
921 926 instead.
922 927
923 928 2007-02-22 Ville Vainio <vivainio@gmail.com>
924 929
925 930 * IPython/Extensions/ipy_p4.py: Extension for improved
926 931 p4 (perforce version control system) experience.
927 932 Adds %p4 magic with p4 command completion and
928 933 automatic -G argument (marshall output as python dict)
929 934
930 935 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
931 936
932 937 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
933 938 stop marks.
934 939 (ClearingMixin): a simple mixin to easily make a Demo class clear
935 940 the screen in between blocks and have empty marquees. The
936 941 ClearDemo and ClearIPDemo classes that use it are included.
937 942
938 943 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
939 944
940 945 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
941 946 protect against exceptions at Python shutdown time. Patch
942 947 sumbmitted to upstream.
943 948
944 949 2007-02-14 Walter Doerwald <walter@livinglogic.de>
945 950
946 951 * IPython/Extensions/ibrowse.py: If entering the first object level
947 952 (i.e. the object for which the browser has been started) fails,
948 953 now the error is raised directly (aborting the browser) instead of
949 954 running into an empty levels list later.
950 955
951 956 2007-02-03 Walter Doerwald <walter@livinglogic.de>
952 957
953 958 * IPython/Extensions/ipipe.py: Add an xrepr implementation
954 959 for the noitem object.
955 960
956 961 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
957 962
958 963 * IPython/completer.py (Completer.attr_matches): Fix small
959 964 tab-completion bug with Enthought Traits objects with units.
960 965 Thanks to a bug report by Tom Denniston
961 966 <tom.denniston-AT-alum.dartmouth.org>.
962 967
963 968 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
964 969
965 970 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
966 971 bug where only .ipy or .py would be completed. Once the first
967 972 argument to %run has been given, all completions are valid because
968 973 they are the arguments to the script, which may well be non-python
969 974 filenames.
970 975
971 976 * IPython/irunner.py (InteractiveRunner.run_source): major updates
972 977 to irunner to allow it to correctly support real doctesting of
973 978 out-of-process ipython code.
974 979
975 980 * IPython/Magic.py (magic_cd): Make the setting of the terminal
976 981 title an option (-noterm_title) because it completely breaks
977 982 doctesting.
978 983
979 984 * IPython/demo.py: fix IPythonDemo class that was not actually working.
980 985
981 986 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
982 987
983 988 * IPython/irunner.py (main): fix small bug where extensions were
984 989 not being correctly recognized.
985 990
986 991 2007-01-23 Walter Doerwald <walter@livinglogic.de>
987 992
988 993 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
989 994 a string containing a single line yields the string itself as the
990 995 only item.
991 996
992 997 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
993 998 object if it's the same as the one on the last level (This avoids
994 999 infinite recursion for one line strings).
995 1000
996 1001 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
997 1002
998 1003 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
999 1004 all output streams before printing tracebacks. This ensures that
1000 1005 user output doesn't end up interleaved with traceback output.
1001 1006
1002 1007 2007-01-10 Ville Vainio <vivainio@gmail.com>
1003 1008
1004 1009 * Extensions/envpersist.py: Turbocharged %env that remembers
1005 1010 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1006 1011 "%env VISUAL=jed".
1007 1012
1008 1013 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1009 1014
1010 1015 * IPython/iplib.py (showtraceback): ensure that we correctly call
1011 1016 custom handlers in all cases (some with pdb were slipping through,
1012 1017 but I'm not exactly sure why).
1013 1018
1014 1019 * IPython/Debugger.py (Tracer.__init__): added new class to
1015 1020 support set_trace-like usage of IPython's enhanced debugger.
1016 1021
1017 1022 2006-12-24 Ville Vainio <vivainio@gmail.com>
1018 1023
1019 1024 * ipmaker.py: more informative message when ipy_user_conf
1020 1025 import fails (suggest running %upgrade).
1021 1026
1022 1027 * tools/run_ipy_in_profiler.py: Utility to see where
1023 1028 the time during IPython startup is spent.
1024 1029
1025 1030 2006-12-20 Ville Vainio <vivainio@gmail.com>
1026 1031
1027 1032 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1028 1033
1029 1034 * ipapi.py: Add new ipapi method, expand_alias.
1030 1035
1031 1036 * Release.py: Bump up version to 0.7.4.svn
1032 1037
1033 1038 2006-12-17 Ville Vainio <vivainio@gmail.com>
1034 1039
1035 1040 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1036 1041 to work properly on posix too
1037 1042
1038 1043 * Release.py: Update revnum (version is still just 0.7.3).
1039 1044
1040 1045 2006-12-15 Ville Vainio <vivainio@gmail.com>
1041 1046
1042 1047 * scripts/ipython_win_post_install: create ipython.py in
1043 1048 prefix + "/scripts".
1044 1049
1045 1050 * Release.py: Update version to 0.7.3.
1046 1051
1047 1052 2006-12-14 Ville Vainio <vivainio@gmail.com>
1048 1053
1049 1054 * scripts/ipython_win_post_install: Overwrite old shortcuts
1050 1055 if they already exist
1051 1056
1052 1057 * Release.py: release 0.7.3rc2
1053 1058
1054 1059 2006-12-13 Ville Vainio <vivainio@gmail.com>
1055 1060
1056 1061 * Branch and update Release.py for 0.7.3rc1
1057 1062
1058 1063 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1059 1064
1060 1065 * IPython/Shell.py (IPShellWX): update for current WX naming
1061 1066 conventions, to avoid a deprecation warning with current WX
1062 1067 versions. Thanks to a report by Danny Shevitz.
1063 1068
1064 1069 2006-12-12 Ville Vainio <vivainio@gmail.com>
1065 1070
1066 1071 * ipmaker.py: apply david cournapeau's patch to make
1067 1072 import_some work properly even when ipythonrc does
1068 1073 import_some on empty list (it was an old bug!).
1069 1074
1070 1075 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1071 1076 Add deprecation note to ipythonrc and a url to wiki
1072 1077 in ipy_user_conf.py
1073 1078
1074 1079
1075 1080 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1076 1081 as if it was typed on IPython command prompt, i.e.
1077 1082 as IPython script.
1078 1083
1079 1084 * example-magic.py, magic_grepl.py: remove outdated examples
1080 1085
1081 1086 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1082 1087
1083 1088 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1084 1089 is called before any exception has occurred.
1085 1090
1086 1091 2006-12-08 Ville Vainio <vivainio@gmail.com>
1087 1092
1088 1093 * Extensions/ipy_stock_completers.py: fix cd completer
1089 1094 to translate /'s to \'s again.
1090 1095
1091 1096 * completer.py: prevent traceback on file completions w/
1092 1097 backslash.
1093 1098
1094 1099 * Release.py: Update release number to 0.7.3b3 for release
1095 1100
1096 1101 2006-12-07 Ville Vainio <vivainio@gmail.com>
1097 1102
1098 1103 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1099 1104 while executing external code. Provides more shell-like behaviour
1100 1105 and overall better response to ctrl + C / ctrl + break.
1101 1106
1102 1107 * tools/make_tarball.py: new script to create tarball straight from svn
1103 1108 (setup.py sdist doesn't work on win32).
1104 1109
1105 1110 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1106 1111 on dirnames with spaces and use the default completer instead.
1107 1112
1108 1113 * Revision.py: Change version to 0.7.3b2 for release.
1109 1114
1110 1115 2006-12-05 Ville Vainio <vivainio@gmail.com>
1111 1116
1112 1117 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1113 1118 pydb patch 4 (rm debug printing, py 2.5 checking)
1114 1119
1115 1120 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1116 1121 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1117 1122 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1118 1123 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1119 1124 object the cursor was on before the refresh. The command "markrange" is
1120 1125 mapped to "%" now.
1121 1126 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1122 1127
1123 1128 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1124 1129
1125 1130 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1126 1131 interactive debugger on the last traceback, without having to call
1127 1132 %pdb and rerun your code. Made minor changes in various modules,
1128 1133 should automatically recognize pydb if available.
1129 1134
1130 1135 2006-11-28 Ville Vainio <vivainio@gmail.com>
1131 1136
1132 1137 * completer.py: If the text start with !, show file completions
1133 1138 properly. This helps when trying to complete command name
1134 1139 for shell escapes.
1135 1140
1136 1141 2006-11-27 Ville Vainio <vivainio@gmail.com>
1137 1142
1138 1143 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1139 1144 der Walt. Clean up svn and hg completers by using a common
1140 1145 vcs_completer.
1141 1146
1142 1147 2006-11-26 Ville Vainio <vivainio@gmail.com>
1143 1148
1144 1149 * Remove ipconfig and %config; you should use _ip.options structure
1145 1150 directly instead!
1146 1151
1147 1152 * genutils.py: add wrap_deprecated function for deprecating callables
1148 1153
1149 1154 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1150 1155 _ip.system instead. ipalias is redundant.
1151 1156
1152 1157 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1153 1158 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1154 1159 explicit.
1155 1160
1156 1161 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1157 1162 completer. Try it by entering 'hg ' and pressing tab.
1158 1163
1159 1164 * macro.py: Give Macro a useful __repr__ method
1160 1165
1161 1166 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1162 1167
1163 1168 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1164 1169 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1165 1170 we don't get a duplicate ipipe module, where registration of the xrepr
1166 1171 implementation for Text is useless.
1167 1172
1168 1173 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1169 1174
1170 1175 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1171 1176
1172 1177 2006-11-24 Ville Vainio <vivainio@gmail.com>
1173 1178
1174 1179 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1175 1180 try to use "cProfile" instead of the slower pure python
1176 1181 "profile"
1177 1182
1178 1183 2006-11-23 Ville Vainio <vivainio@gmail.com>
1179 1184
1180 1185 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1181 1186 Qt+IPython+Designer link in documentation.
1182 1187
1183 1188 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1184 1189 correct Pdb object to %pydb.
1185 1190
1186 1191
1187 1192 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1188 1193 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1189 1194 generic xrepr(), otherwise the list implementation would kick in.
1190 1195
1191 1196 2006-11-21 Ville Vainio <vivainio@gmail.com>
1192 1197
1193 1198 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1194 1199 with one from UserConfig.
1195 1200
1196 1201 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1197 1202 it was missing which broke the sh profile.
1198 1203
1199 1204 * completer.py: file completer now uses explicit '/' instead
1200 1205 of os.path.join, expansion of 'foo' was broken on win32
1201 1206 if there was one directory with name 'foobar'.
1202 1207
1203 1208 * A bunch of patches from Kirill Smelkov:
1204 1209
1205 1210 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1206 1211
1207 1212 * [patch 7/9] Implement %page -r (page in raw mode) -
1208 1213
1209 1214 * [patch 5/9] ScientificPython webpage has moved
1210 1215
1211 1216 * [patch 4/9] The manual mentions %ds, should be %dhist
1212 1217
1213 1218 * [patch 3/9] Kill old bits from %prun doc.
1214 1219
1215 1220 * [patch 1/9] Fix typos here and there.
1216 1221
1217 1222 2006-11-08 Ville Vainio <vivainio@gmail.com>
1218 1223
1219 1224 * completer.py (attr_matches): catch all exceptions raised
1220 1225 by eval of expr with dots.
1221 1226
1222 1227 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1223 1228
1224 1229 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1225 1230 input if it starts with whitespace. This allows you to paste
1226 1231 indented input from any editor without manually having to type in
1227 1232 the 'if 1:', which is convenient when working interactively.
1228 1233 Slightly modifed version of a patch by Bo Peng
1229 1234 <bpeng-AT-rice.edu>.
1230 1235
1231 1236 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1232 1237
1233 1238 * IPython/irunner.py (main): modified irunner so it automatically
1234 1239 recognizes the right runner to use based on the extension (.py for
1235 1240 python, .ipy for ipython and .sage for sage).
1236 1241
1237 1242 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1238 1243 visible in ipapi as ip.config(), to programatically control the
1239 1244 internal rc object. There's an accompanying %config magic for
1240 1245 interactive use, which has been enhanced to match the
1241 1246 funtionality in ipconfig.
1242 1247
1243 1248 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1244 1249 so it's not just a toggle, it now takes an argument. Add support
1245 1250 for a customizable header when making system calls, as the new
1246 1251 system_header variable in the ipythonrc file.
1247 1252
1248 1253 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1249 1254
1250 1255 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1251 1256 generic functions (using Philip J. Eby's simplegeneric package).
1252 1257 This makes it possible to customize the display of third-party classes
1253 1258 without having to monkeypatch them. xiter() no longer supports a mode
1254 1259 argument and the XMode class has been removed. The same functionality can
1255 1260 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1256 1261 One consequence of the switch to generic functions is that xrepr() and
1257 1262 xattrs() implementation must define the default value for the mode
1258 1263 argument themselves and xattrs() implementations must return real
1259 1264 descriptors.
1260 1265
1261 1266 * IPython/external: This new subpackage will contain all third-party
1262 1267 packages that are bundled with IPython. (The first one is simplegeneric).
1263 1268
1264 1269 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1265 1270 directory which as been dropped in r1703.
1266 1271
1267 1272 * IPython/Extensions/ipipe.py (iless): Fixed.
1268 1273
1269 1274 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1270 1275
1271 1276 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1272 1277
1273 1278 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1274 1279 handling in variable expansion so that shells and magics recognize
1275 1280 function local scopes correctly. Bug reported by Brian.
1276 1281
1277 1282 * scripts/ipython: remove the very first entry in sys.path which
1278 1283 Python auto-inserts for scripts, so that sys.path under IPython is
1279 1284 as similar as possible to that under plain Python.
1280 1285
1281 1286 * IPython/completer.py (IPCompleter.file_matches): Fix
1282 1287 tab-completion so that quotes are not closed unless the completion
1283 1288 is unambiguous. After a request by Stefan. Minor cleanups in
1284 1289 ipy_stock_completers.
1285 1290
1286 1291 2006-11-02 Ville Vainio <vivainio@gmail.com>
1287 1292
1288 1293 * ipy_stock_completers.py: Add %run and %cd completers.
1289 1294
1290 1295 * completer.py: Try running custom completer for both
1291 1296 "foo" and "%foo" if the command is just "foo". Ignore case
1292 1297 when filtering possible completions.
1293 1298
1294 1299 * UserConfig/ipy_user_conf.py: install stock completers as default
1295 1300
1296 1301 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1297 1302 simplified readline history save / restore through a wrapper
1298 1303 function
1299 1304
1300 1305
1301 1306 2006-10-31 Ville Vainio <vivainio@gmail.com>
1302 1307
1303 1308 * strdispatch.py, completer.py, ipy_stock_completers.py:
1304 1309 Allow str_key ("command") in completer hooks. Implement
1305 1310 trivial completer for 'import' (stdlib modules only). Rename
1306 1311 ipy_linux_package_managers.py to ipy_stock_completers.py.
1307 1312 SVN completer.
1308 1313
1309 1314 * Extensions/ledit.py: %magic line editor for easily and
1310 1315 incrementally manipulating lists of strings. The magic command
1311 1316 name is %led.
1312 1317
1313 1318 2006-10-30 Ville Vainio <vivainio@gmail.com>
1314 1319
1315 1320 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1316 1321 Bernsteins's patches for pydb integration.
1317 1322 http://bashdb.sourceforge.net/pydb/
1318 1323
1319 1324 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1320 1325 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1321 1326 custom completer hook to allow the users to implement their own
1322 1327 completers. See ipy_linux_package_managers.py for example. The
1323 1328 hook name is 'complete_command'.
1324 1329
1325 1330 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1326 1331
1327 1332 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1328 1333 Numeric leftovers.
1329 1334
1330 1335 * ipython.el (py-execute-region): apply Stefan's patch to fix
1331 1336 garbled results if the python shell hasn't been previously started.
1332 1337
1333 1338 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1334 1339 pretty generic function and useful for other things.
1335 1340
1336 1341 * IPython/OInspect.py (getsource): Add customizable source
1337 1342 extractor. After a request/patch form W. Stein (SAGE).
1338 1343
1339 1344 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1340 1345 window size to a more reasonable value from what pexpect does,
1341 1346 since their choice causes wrapping bugs with long input lines.
1342 1347
1343 1348 2006-10-28 Ville Vainio <vivainio@gmail.com>
1344 1349
1345 1350 * Magic.py (%run): Save and restore the readline history from
1346 1351 file around %run commands to prevent side effects from
1347 1352 %runned programs that might use readline (e.g. pydb).
1348 1353
1349 1354 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1350 1355 invoking the pydb enhanced debugger.
1351 1356
1352 1357 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1353 1358
1354 1359 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1355 1360 call the base class method and propagate the return value to
1356 1361 ifile. This is now done by path itself.
1357 1362
1358 1363 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1359 1364
1360 1365 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1361 1366 api: set_crash_handler(), to expose the ability to change the
1362 1367 internal crash handler.
1363 1368
1364 1369 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1365 1370 the various parameters of the crash handler so that apps using
1366 1371 IPython as their engine can customize crash handling. Ipmlemented
1367 1372 at the request of SAGE.
1368 1373
1369 1374 2006-10-14 Ville Vainio <vivainio@gmail.com>
1370 1375
1371 1376 * Magic.py, ipython.el: applied first "safe" part of Rocky
1372 1377 Bernstein's patch set for pydb integration.
1373 1378
1374 1379 * Magic.py (%unalias, %alias): %store'd aliases can now be
1375 1380 removed with '%unalias'. %alias w/o args now shows most
1376 1381 interesting (stored / manually defined) aliases last
1377 1382 where they catch the eye w/o scrolling.
1378 1383
1379 1384 * Magic.py (%rehashx), ext_rehashdir.py: files with
1380 1385 'py' extension are always considered executable, even
1381 1386 when not in PATHEXT environment variable.
1382 1387
1383 1388 2006-10-12 Ville Vainio <vivainio@gmail.com>
1384 1389
1385 1390 * jobctrl.py: Add new "jobctrl" extension for spawning background
1386 1391 processes with "&find /". 'import jobctrl' to try it out. Requires
1387 1392 'subprocess' module, standard in python 2.4+.
1388 1393
1389 1394 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1390 1395 so if foo -> bar and bar -> baz, then foo -> baz.
1391 1396
1392 1397 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1393 1398
1394 1399 * IPython/Magic.py (Magic.parse_options): add a new posix option
1395 1400 to allow parsing of input args in magics that doesn't strip quotes
1396 1401 (if posix=False). This also closes %timeit bug reported by
1397 1402 Stefan.
1398 1403
1399 1404 2006-10-03 Ville Vainio <vivainio@gmail.com>
1400 1405
1401 1406 * iplib.py (raw_input, interact): Return ValueError catching for
1402 1407 raw_input. Fixes infinite loop for sys.stdin.close() or
1403 1408 sys.stdout.close().
1404 1409
1405 1410 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1406 1411
1407 1412 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1408 1413 to help in handling doctests. irunner is now pretty useful for
1409 1414 running standalone scripts and simulate a full interactive session
1410 1415 in a format that can be then pasted as a doctest.
1411 1416
1412 1417 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1413 1418 on top of the default (useless) ones. This also fixes the nasty
1414 1419 way in which 2.5's Quitter() exits (reverted [1785]).
1415 1420
1416 1421 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1417 1422 2.5.
1418 1423
1419 1424 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1420 1425 color scheme is updated as well when color scheme is changed
1421 1426 interactively.
1422 1427
1423 1428 2006-09-27 Ville Vainio <vivainio@gmail.com>
1424 1429
1425 1430 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1426 1431 infinite loop and just exit. It's a hack, but will do for a while.
1427 1432
1428 1433 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1429 1434
1430 1435 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1431 1436 the constructor, this makes it possible to get a list of only directories
1432 1437 or only files.
1433 1438
1434 1439 2006-08-12 Ville Vainio <vivainio@gmail.com>
1435 1440
1436 1441 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1437 1442 they broke unittest
1438 1443
1439 1444 2006-08-11 Ville Vainio <vivainio@gmail.com>
1440 1445
1441 1446 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1442 1447 by resolving issue properly, i.e. by inheriting FakeModule
1443 1448 from types.ModuleType. Pickling ipython interactive data
1444 1449 should still work as usual (testing appreciated).
1445 1450
1446 1451 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1447 1452
1448 1453 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1449 1454 running under python 2.3 with code from 2.4 to fix a bug with
1450 1455 help(). Reported by the Debian maintainers, Norbert Tretkowski
1451 1456 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1452 1457 <afayolle-AT-debian.org>.
1453 1458
1454 1459 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1455 1460
1456 1461 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1457 1462 (which was displaying "quit" twice).
1458 1463
1459 1464 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1460 1465
1461 1466 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1462 1467 the mode argument).
1463 1468
1464 1469 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1465 1470
1466 1471 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1467 1472 not running under IPython.
1468 1473
1469 1474 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1470 1475 and make it iterable (iterating over the attribute itself). Add two new
1471 1476 magic strings for __xattrs__(): If the string starts with "-", the attribute
1472 1477 will not be displayed in ibrowse's detail view (but it can still be
1473 1478 iterated over). This makes it possible to add attributes that are large
1474 1479 lists or generator methods to the detail view. Replace magic attribute names
1475 1480 and _attrname() and _getattr() with "descriptors": For each type of magic
1476 1481 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1477 1482 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1478 1483 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1479 1484 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1480 1485 are still supported.
1481 1486
1482 1487 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1483 1488 fails in ibrowse.fetch(), the exception object is added as the last item
1484 1489 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1485 1490 a generator throws an exception midway through execution.
1486 1491
1487 1492 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1488 1493 encoding into methods.
1489 1494
1490 1495 2006-07-26 Ville Vainio <vivainio@gmail.com>
1491 1496
1492 1497 * iplib.py: history now stores multiline input as single
1493 1498 history entries. Patch by Jorgen Cederlof.
1494 1499
1495 1500 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1496 1501
1497 1502 * IPython/Extensions/ibrowse.py: Make cursor visible over
1498 1503 non existing attributes.
1499 1504
1500 1505 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1501 1506
1502 1507 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1503 1508 error output of the running command doesn't mess up the screen.
1504 1509
1505 1510 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1506 1511
1507 1512 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1508 1513 argument. This sorts the items themselves.
1509 1514
1510 1515 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1511 1516
1512 1517 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1513 1518 Compile expression strings into code objects. This should speed
1514 1519 up ifilter and friends somewhat.
1515 1520
1516 1521 2006-07-08 Ville Vainio <vivainio@gmail.com>
1517 1522
1518 1523 * Magic.py: %cpaste now strips > from the beginning of lines
1519 1524 to ease pasting quoted code from emails. Contributed by
1520 1525 Stefan van der Walt.
1521 1526
1522 1527 2006-06-29 Ville Vainio <vivainio@gmail.com>
1523 1528
1524 1529 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1525 1530 mode, patch contributed by Darren Dale. NEEDS TESTING!
1526 1531
1527 1532 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1528 1533
1529 1534 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1530 1535 a blue background. Fix fetching new display rows when the browser
1531 1536 scrolls more than a screenful (e.g. by using the goto command).
1532 1537
1533 1538 2006-06-27 Ville Vainio <vivainio@gmail.com>
1534 1539
1535 1540 * Magic.py (_inspect, _ofind) Apply David Huard's
1536 1541 patch for displaying the correct docstring for 'property'
1537 1542 attributes.
1538 1543
1539 1544 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1540 1545
1541 1546 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1542 1547 commands into the methods implementing them.
1543 1548
1544 1549 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1545 1550
1546 1551 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1547 1552 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1548 1553 autoindent support was authored by Jin Liu.
1549 1554
1550 1555 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1551 1556
1552 1557 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1553 1558 for keymaps with a custom class that simplifies handling.
1554 1559
1555 1560 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1556 1561
1557 1562 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1558 1563 resizing. This requires Python 2.5 to work.
1559 1564
1560 1565 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1561 1566
1562 1567 * IPython/Extensions/ibrowse.py: Add two new commands to
1563 1568 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1564 1569 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1565 1570 attributes again. Remapped the help command to "?". Display
1566 1571 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1567 1572 as keys for the "home" and "end" commands. Add three new commands
1568 1573 to the input mode for "find" and friends: "delend" (CTRL-K)
1569 1574 deletes to the end of line. "incsearchup" searches upwards in the
1570 1575 command history for an input that starts with the text before the cursor.
1571 1576 "incsearchdown" does the same downwards. Removed a bogus mapping of
1572 1577 the x key to "delete".
1573 1578
1574 1579 2006-06-15 Ville Vainio <vivainio@gmail.com>
1575 1580
1576 1581 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1577 1582 used to create prompts dynamically, instead of the "old" way of
1578 1583 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1579 1584 way still works (it's invoked by the default hook), of course.
1580 1585
1581 1586 * Prompts.py: added generate_output_prompt hook for altering output
1582 1587 prompt
1583 1588
1584 1589 * Release.py: Changed version string to 0.7.3.svn.
1585 1590
1586 1591 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1587 1592
1588 1593 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1589 1594 the call to fetch() always tries to fetch enough data for at least one
1590 1595 full screen. This makes it possible to simply call moveto(0,0,True) in
1591 1596 the constructor. Fix typos and removed the obsolete goto attribute.
1592 1597
1593 1598 2006-06-12 Ville Vainio <vivainio@gmail.com>
1594 1599
1595 1600 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1596 1601 allowing $variable interpolation within multiline statements,
1597 1602 though so far only with "sh" profile for a testing period.
1598 1603 The patch also enables splitting long commands with \ but it
1599 1604 doesn't work properly yet.
1600 1605
1601 1606 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1602 1607
1603 1608 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1604 1609 input history and the position of the cursor in the input history for
1605 1610 the find, findbackwards and goto command.
1606 1611
1607 1612 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1608 1613
1609 1614 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1610 1615 implements the basic functionality of browser commands that require
1611 1616 input. Reimplement the goto, find and findbackwards commands as
1612 1617 subclasses of _CommandInput. Add an input history and keymaps to those
1613 1618 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1614 1619 execute commands.
1615 1620
1616 1621 2006-06-07 Ville Vainio <vivainio@gmail.com>
1617 1622
1618 1623 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1619 1624 running the batch files instead of leaving the session open.
1620 1625
1621 1626 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1622 1627
1623 1628 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1624 1629 the original fix was incomplete. Patch submitted by W. Maier.
1625 1630
1626 1631 2006-06-07 Ville Vainio <vivainio@gmail.com>
1627 1632
1628 1633 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1629 1634 Confirmation prompts can be supressed by 'quiet' option.
1630 1635 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1631 1636
1632 1637 2006-06-06 *** Released version 0.7.2
1633 1638
1634 1639 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1635 1640
1636 1641 * IPython/Release.py (version): Made 0.7.2 final for release.
1637 1642 Repo tagged and release cut.
1638 1643
1639 1644 2006-06-05 Ville Vainio <vivainio@gmail.com>
1640 1645
1641 1646 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1642 1647 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1643 1648
1644 1649 * upgrade_dir.py: try import 'path' module a bit harder
1645 1650 (for %upgrade)
1646 1651
1647 1652 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1648 1653
1649 1654 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1650 1655 instead of looping 20 times.
1651 1656
1652 1657 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1653 1658 correctly at initialization time. Bug reported by Krishna Mohan
1654 1659 Gundu <gkmohan-AT-gmail.com> on the user list.
1655 1660
1656 1661 * IPython/Release.py (version): Mark 0.7.2 version to start
1657 1662 testing for release on 06/06.
1658 1663
1659 1664 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1660 1665
1661 1666 * scripts/irunner: thin script interface so users don't have to
1662 1667 find the module and call it as an executable, since modules rarely
1663 1668 live in people's PATH.
1664 1669
1665 1670 * IPython/irunner.py (InteractiveRunner.__init__): added
1666 1671 delaybeforesend attribute to control delays with newer versions of
1667 1672 pexpect. Thanks to detailed help from pexpect's author, Noah
1668 1673 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1669 1674 correctly (it works in NoColor mode).
1670 1675
1671 1676 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1672 1677 SAGE list, from improper log() calls.
1673 1678
1674 1679 2006-05-31 Ville Vainio <vivainio@gmail.com>
1675 1680
1676 1681 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1677 1682 with args in parens to work correctly with dirs that have spaces.
1678 1683
1679 1684 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1680 1685
1681 1686 * IPython/Logger.py (Logger.logstart): add option to log raw input
1682 1687 instead of the processed one. A -r flag was added to the
1683 1688 %logstart magic used for controlling logging.
1684 1689
1685 1690 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1686 1691
1687 1692 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1688 1693 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1689 1694 recognize the option. After a bug report by Will Maier. This
1690 1695 closes #64 (will do it after confirmation from W. Maier).
1691 1696
1692 1697 * IPython/irunner.py: New module to run scripts as if manually
1693 1698 typed into an interactive environment, based on pexpect. After a
1694 1699 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1695 1700 ipython-user list. Simple unittests in the tests/ directory.
1696 1701
1697 1702 * tools/release: add Will Maier, OpenBSD port maintainer, to
1698 1703 recepients list. We are now officially part of the OpenBSD ports:
1699 1704 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1700 1705 work.
1701 1706
1702 1707 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1703 1708
1704 1709 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1705 1710 so that it doesn't break tkinter apps.
1706 1711
1707 1712 * IPython/iplib.py (_prefilter): fix bug where aliases would
1708 1713 shadow variables when autocall was fully off. Reported by SAGE
1709 1714 author William Stein.
1710 1715
1711 1716 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1712 1717 at what detail level strings are computed when foo? is requested.
1713 1718 This allows users to ask for example that the string form of an
1714 1719 object is only computed when foo?? is called, or even never, by
1715 1720 setting the object_info_string_level >= 2 in the configuration
1716 1721 file. This new option has been added and documented. After a
1717 1722 request by SAGE to be able to control the printing of very large
1718 1723 objects more easily.
1719 1724
1720 1725 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1721 1726
1722 1727 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1723 1728 from sys.argv, to be 100% consistent with how Python itself works
1724 1729 (as seen for example with python -i file.py). After a bug report
1725 1730 by Jeffrey Collins.
1726 1731
1727 1732 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1728 1733 nasty bug which was preventing custom namespaces with -pylab,
1729 1734 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1730 1735 compatibility (long gone from mpl).
1731 1736
1732 1737 * IPython/ipapi.py (make_session): name change: create->make. We
1733 1738 use make in other places (ipmaker,...), it's shorter and easier to
1734 1739 type and say, etc. I'm trying to clean things before 0.7.2 so
1735 1740 that I can keep things stable wrt to ipapi in the chainsaw branch.
1736 1741
1737 1742 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1738 1743 python-mode recognizes our debugger mode. Add support for
1739 1744 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1740 1745 <m.liu.jin-AT-gmail.com> originally written by
1741 1746 doxgen-AT-newsmth.net (with minor modifications for xemacs
1742 1747 compatibility)
1743 1748
1744 1749 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1745 1750 tracebacks when walking the stack so that the stack tracking system
1746 1751 in emacs' python-mode can identify the frames correctly.
1747 1752
1748 1753 * IPython/ipmaker.py (make_IPython): make the internal (and
1749 1754 default config) autoedit_syntax value false by default. Too many
1750 1755 users have complained to me (both on and off-list) about problems
1751 1756 with this option being on by default, so I'm making it default to
1752 1757 off. It can still be enabled by anyone via the usual mechanisms.
1753 1758
1754 1759 * IPython/completer.py (Completer.attr_matches): add support for
1755 1760 PyCrust-style _getAttributeNames magic method. Patch contributed
1756 1761 by <mscott-AT-goldenspud.com>. Closes #50.
1757 1762
1758 1763 * IPython/iplib.py (InteractiveShell.__init__): remove the
1759 1764 deletion of exit/quit from __builtin__, which can break
1760 1765 third-party tools like the Zope debugging console. The
1761 1766 %exit/%quit magics remain. In general, it's probably a good idea
1762 1767 not to delete anything from __builtin__, since we never know what
1763 1768 that will break. In any case, python now (for 2.5) will support
1764 1769 'real' exit/quit, so this issue is moot. Closes #55.
1765 1770
1766 1771 * IPython/genutils.py (with_obj): rename the 'with' function to
1767 1772 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1768 1773 becomes a language keyword. Closes #53.
1769 1774
1770 1775 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1771 1776 __file__ attribute to this so it fools more things into thinking
1772 1777 it is a real module. Closes #59.
1773 1778
1774 1779 * IPython/Magic.py (magic_edit): add -n option to open the editor
1775 1780 at a specific line number. After a patch by Stefan van der Walt.
1776 1781
1777 1782 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1778 1783
1779 1784 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1780 1785 reason the file could not be opened. After automatic crash
1781 1786 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1782 1787 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1783 1788 (_should_recompile): Don't fire editor if using %bg, since there
1784 1789 is no file in the first place. From the same report as above.
1785 1790 (raw_input): protect against faulty third-party prefilters. After
1786 1791 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1787 1792 while running under SAGE.
1788 1793
1789 1794 2006-05-23 Ville Vainio <vivainio@gmail.com>
1790 1795
1791 1796 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1792 1797 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1793 1798 now returns None (again), unless dummy is specifically allowed by
1794 1799 ipapi.get(allow_dummy=True).
1795 1800
1796 1801 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1797 1802
1798 1803 * IPython: remove all 2.2-compatibility objects and hacks from
1799 1804 everywhere, since we only support 2.3 at this point. Docs
1800 1805 updated.
1801 1806
1802 1807 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1803 1808 Anything requiring extra validation can be turned into a Python
1804 1809 property in the future. I used a property for the db one b/c
1805 1810 there was a nasty circularity problem with the initialization
1806 1811 order, which right now I don't have time to clean up.
1807 1812
1808 1813 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1809 1814 another locking bug reported by Jorgen. I'm not 100% sure though,
1810 1815 so more testing is needed...
1811 1816
1812 1817 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1813 1818
1814 1819 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1815 1820 local variables from any routine in user code (typically executed
1816 1821 with %run) directly into the interactive namespace. Very useful
1817 1822 when doing complex debugging.
1818 1823 (IPythonNotRunning): Changed the default None object to a dummy
1819 1824 whose attributes can be queried as well as called without
1820 1825 exploding, to ease writing code which works transparently both in
1821 1826 and out of ipython and uses some of this API.
1822 1827
1823 1828 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1824 1829
1825 1830 * IPython/hooks.py (result_display): Fix the fact that our display
1826 1831 hook was using str() instead of repr(), as the default python
1827 1832 console does. This had gone unnoticed b/c it only happened if
1828 1833 %Pprint was off, but the inconsistency was there.
1829 1834
1830 1835 2006-05-15 Ville Vainio <vivainio@gmail.com>
1831 1836
1832 1837 * Oinspect.py: Only show docstring for nonexisting/binary files
1833 1838 when doing object??, closing ticket #62
1834 1839
1835 1840 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1836 1841
1837 1842 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1838 1843 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1839 1844 was being released in a routine which hadn't checked if it had
1840 1845 been the one to acquire it.
1841 1846
1842 1847 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1843 1848
1844 1849 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1845 1850
1846 1851 2006-04-11 Ville Vainio <vivainio@gmail.com>
1847 1852
1848 1853 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1849 1854 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1850 1855 prefilters, allowing stuff like magics and aliases in the file.
1851 1856
1852 1857 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1853 1858 added. Supported now are "%clear in" and "%clear out" (clear input and
1854 1859 output history, respectively). Also fixed CachedOutput.flush to
1855 1860 properly flush the output cache.
1856 1861
1857 1862 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1858 1863 half-success (and fail explicitly).
1859 1864
1860 1865 2006-03-28 Ville Vainio <vivainio@gmail.com>
1861 1866
1862 1867 * iplib.py: Fix quoting of aliases so that only argless ones
1863 1868 are quoted
1864 1869
1865 1870 2006-03-28 Ville Vainio <vivainio@gmail.com>
1866 1871
1867 1872 * iplib.py: Quote aliases with spaces in the name.
1868 1873 "c:\program files\blah\bin" is now legal alias target.
1869 1874
1870 1875 * ext_rehashdir.py: Space no longer allowed as arg
1871 1876 separator, since space is legal in path names.
1872 1877
1873 1878 2006-03-16 Ville Vainio <vivainio@gmail.com>
1874 1879
1875 1880 * upgrade_dir.py: Take path.py from Extensions, correcting
1876 1881 %upgrade magic
1877 1882
1878 1883 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1879 1884
1880 1885 * hooks.py: Only enclose editor binary in quotes if legal and
1881 1886 necessary (space in the name, and is an existing file). Fixes a bug
1882 1887 reported by Zachary Pincus.
1883 1888
1884 1889 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1885 1890
1886 1891 * Manual: thanks to a tip on proper color handling for Emacs, by
1887 1892 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1888 1893
1889 1894 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1890 1895 by applying the provided patch. Thanks to Liu Jin
1891 1896 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1892 1897 XEmacs/Linux, I'm trusting the submitter that it actually helps
1893 1898 under win32/GNU Emacs. Will revisit if any problems are reported.
1894 1899
1895 1900 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1896 1901
1897 1902 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1898 1903 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1899 1904
1900 1905 2006-03-12 Ville Vainio <vivainio@gmail.com>
1901 1906
1902 1907 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1903 1908 Torsten Marek.
1904 1909
1905 1910 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1906 1911
1907 1912 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1908 1913 line ranges works again.
1909 1914
1910 1915 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1911 1916
1912 1917 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1913 1918 and friends, after a discussion with Zach Pincus on ipython-user.
1914 1919 I'm not 100% sure, but after thinking about it quite a bit, it may
1915 1920 be OK. Testing with the multithreaded shells didn't reveal any
1916 1921 problems, but let's keep an eye out.
1917 1922
1918 1923 In the process, I fixed a few things which were calling
1919 1924 self.InteractiveTB() directly (like safe_execfile), which is a
1920 1925 mistake: ALL exception reporting should be done by calling
1921 1926 self.showtraceback(), which handles state and tab-completion and
1922 1927 more.
1923 1928
1924 1929 2006-03-01 Ville Vainio <vivainio@gmail.com>
1925 1930
1926 1931 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1927 1932 To use, do "from ipipe import *".
1928 1933
1929 1934 2006-02-24 Ville Vainio <vivainio@gmail.com>
1930 1935
1931 1936 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1932 1937 "cleanly" and safely than the older upgrade mechanism.
1933 1938
1934 1939 2006-02-21 Ville Vainio <vivainio@gmail.com>
1935 1940
1936 1941 * Magic.py: %save works again.
1937 1942
1938 1943 2006-02-15 Ville Vainio <vivainio@gmail.com>
1939 1944
1940 1945 * Magic.py: %Pprint works again
1941 1946
1942 1947 * Extensions/ipy_sane_defaults.py: Provide everything provided
1943 1948 in default ipythonrc, to make it possible to have a completely empty
1944 1949 ipythonrc (and thus completely rc-file free configuration)
1945 1950
1946 1951 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1947 1952
1948 1953 * IPython/hooks.py (editor): quote the call to the editor command,
1949 1954 to allow commands with spaces in them. Problem noted by watching
1950 1955 Ian Oswald's video about textpad under win32 at
1951 1956 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1952 1957
1953 1958 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1954 1959 describing magics (we haven't used @ for a loong time).
1955 1960
1956 1961 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1957 1962 contributed by marienz to close
1958 1963 http://www.scipy.net/roundup/ipython/issue53.
1959 1964
1960 1965 2006-02-10 Ville Vainio <vivainio@gmail.com>
1961 1966
1962 1967 * genutils.py: getoutput now works in win32 too
1963 1968
1964 1969 * completer.py: alias and magic completion only invoked
1965 1970 at the first "item" in the line, to avoid "cd %store"
1966 1971 nonsense.
1967 1972
1968 1973 2006-02-09 Ville Vainio <vivainio@gmail.com>
1969 1974
1970 1975 * test/*: Added a unit testing framework (finally).
1971 1976 '%run runtests.py' to run test_*.
1972 1977
1973 1978 * ipapi.py: Exposed runlines and set_custom_exc
1974 1979
1975 1980 2006-02-07 Ville Vainio <vivainio@gmail.com>
1976 1981
1977 1982 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1978 1983 instead use "f(1 2)" as before.
1979 1984
1980 1985 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1981 1986
1982 1987 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1983 1988 facilities, for demos processed by the IPython input filter
1984 1989 (IPythonDemo), and for running a script one-line-at-a-time as a
1985 1990 demo, both for pure Python (LineDemo) and for IPython-processed
1986 1991 input (IPythonLineDemo). After a request by Dave Kohel, from the
1987 1992 SAGE team.
1988 1993 (Demo.edit): added an edit() method to the demo objects, to edit
1989 1994 the in-memory copy of the last executed block.
1990 1995
1991 1996 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1992 1997 processing to %edit, %macro and %save. These commands can now be
1993 1998 invoked on the unprocessed input as it was typed by the user
1994 1999 (without any prefilters applied). After requests by the SAGE team
1995 2000 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1996 2001
1997 2002 2006-02-01 Ville Vainio <vivainio@gmail.com>
1998 2003
1999 2004 * setup.py, eggsetup.py: easy_install ipython==dev works
2000 2005 correctly now (on Linux)
2001 2006
2002 2007 * ipy_user_conf,ipmaker: user config changes, removed spurious
2003 2008 warnings
2004 2009
2005 2010 * iplib: if rc.banner is string, use it as is.
2006 2011
2007 2012 * Magic: %pycat accepts a string argument and pages it's contents.
2008 2013
2009 2014
2010 2015 2006-01-30 Ville Vainio <vivainio@gmail.com>
2011 2016
2012 2017 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2013 2018 Now %store and bookmarks work through PickleShare, meaning that
2014 2019 concurrent access is possible and all ipython sessions see the
2015 2020 same database situation all the time, instead of snapshot of
2016 2021 the situation when the session was started. Hence, %bookmark
2017 2022 results are immediately accessible from othes sessions. The database
2018 2023 is also available for use by user extensions. See:
2019 2024 http://www.python.org/pypi/pickleshare
2020 2025
2021 2026 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2022 2027
2023 2028 * aliases can now be %store'd
2024 2029
2025 2030 * path.py moved to Extensions so that pickleshare does not need
2026 2031 IPython-specific import. Extensions added to pythonpath right
2027 2032 at __init__.
2028 2033
2029 2034 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2030 2035 called with _ip.system and the pre-transformed command string.
2031 2036
2032 2037 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2033 2038
2034 2039 * IPython/iplib.py (interact): Fix that we were not catching
2035 2040 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2036 2041 logic here had to change, but it's fixed now.
2037 2042
2038 2043 2006-01-29 Ville Vainio <vivainio@gmail.com>
2039 2044
2040 2045 * iplib.py: Try to import pyreadline on Windows.
2041 2046
2042 2047 2006-01-27 Ville Vainio <vivainio@gmail.com>
2043 2048
2044 2049 * iplib.py: Expose ipapi as _ip in builtin namespace.
2045 2050 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2046 2051 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2047 2052 syntax now produce _ip.* variant of the commands.
2048 2053
2049 2054 * "_ip.options().autoedit_syntax = 2" automatically throws
2050 2055 user to editor for syntax error correction without prompting.
2051 2056
2052 2057 2006-01-27 Ville Vainio <vivainio@gmail.com>
2053 2058
2054 2059 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2055 2060 'ipython' at argv[0]) executed through command line.
2056 2061 NOTE: this DEPRECATES calling ipython with multiple scripts
2057 2062 ("ipython a.py b.py c.py")
2058 2063
2059 2064 * iplib.py, hooks.py: Added configurable input prefilter,
2060 2065 named 'input_prefilter'. See ext_rescapture.py for example
2061 2066 usage.
2062 2067
2063 2068 * ext_rescapture.py, Magic.py: Better system command output capture
2064 2069 through 'var = !ls' (deprecates user-visible %sc). Same notation
2065 2070 applies for magics, 'var = %alias' assigns alias list to var.
2066 2071
2067 2072 * ipapi.py: added meta() for accessing extension-usable data store.
2068 2073
2069 2074 * iplib.py: added InteractiveShell.getapi(). New magics should be
2070 2075 written doing self.getapi() instead of using the shell directly.
2071 2076
2072 2077 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2073 2078 %store foo >> ~/myfoo.txt to store variables to files (in clean
2074 2079 textual form, not a restorable pickle).
2075 2080
2076 2081 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2077 2082
2078 2083 * usage.py, Magic.py: added %quickref
2079 2084
2080 2085 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2081 2086
2082 2087 * GetoptErrors when invoking magics etc. with wrong args
2083 2088 are now more helpful:
2084 2089 GetoptError: option -l not recognized (allowed: "qb" )
2085 2090
2086 2091 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2087 2092
2088 2093 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2089 2094 computationally intensive blocks don't appear to stall the demo.
2090 2095
2091 2096 2006-01-24 Ville Vainio <vivainio@gmail.com>
2092 2097
2093 2098 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2094 2099 value to manipulate resulting history entry.
2095 2100
2096 2101 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2097 2102 to instance methods of IPApi class, to make extending an embedded
2098 2103 IPython feasible. See ext_rehashdir.py for example usage.
2099 2104
2100 2105 * Merged 1071-1076 from branches/0.7.1
2101 2106
2102 2107
2103 2108 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2104 2109
2105 2110 * tools/release (daystamp): Fix build tools to use the new
2106 2111 eggsetup.py script to build lightweight eggs.
2107 2112
2108 2113 * Applied changesets 1062 and 1064 before 0.7.1 release.
2109 2114
2110 2115 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2111 2116 see the raw input history (without conversions like %ls ->
2112 2117 ipmagic("ls")). After a request from W. Stein, SAGE
2113 2118 (http://modular.ucsd.edu/sage) developer. This information is
2114 2119 stored in the input_hist_raw attribute of the IPython instance, so
2115 2120 developers can access it if needed (it's an InputList instance).
2116 2121
2117 2122 * Versionstring = 0.7.2.svn
2118 2123
2119 2124 * eggsetup.py: A separate script for constructing eggs, creates
2120 2125 proper launch scripts even on Windows (an .exe file in
2121 2126 \python24\scripts).
2122 2127
2123 2128 * ipapi.py: launch_new_instance, launch entry point needed for the
2124 2129 egg.
2125 2130
2126 2131 2006-01-23 Ville Vainio <vivainio@gmail.com>
2127 2132
2128 2133 * Added %cpaste magic for pasting python code
2129 2134
2130 2135 2006-01-22 Ville Vainio <vivainio@gmail.com>
2131 2136
2132 2137 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2133 2138
2134 2139 * Versionstring = 0.7.2.svn
2135 2140
2136 2141 * eggsetup.py: A separate script for constructing eggs, creates
2137 2142 proper launch scripts even on Windows (an .exe file in
2138 2143 \python24\scripts).
2139 2144
2140 2145 * ipapi.py: launch_new_instance, launch entry point needed for the
2141 2146 egg.
2142 2147
2143 2148 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2144 2149
2145 2150 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2146 2151 %pfile foo would print the file for foo even if it was a binary.
2147 2152 Now, extensions '.so' and '.dll' are skipped.
2148 2153
2149 2154 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2150 2155 bug, where macros would fail in all threaded modes. I'm not 100%
2151 2156 sure, so I'm going to put out an rc instead of making a release
2152 2157 today, and wait for feedback for at least a few days.
2153 2158
2154 2159 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2155 2160 it...) the handling of pasting external code with autoindent on.
2156 2161 To get out of a multiline input, the rule will appear for most
2157 2162 users unchanged: two blank lines or change the indent level
2158 2163 proposed by IPython. But there is a twist now: you can
2159 2164 add/subtract only *one or two spaces*. If you add/subtract three
2160 2165 or more (unless you completely delete the line), IPython will
2161 2166 accept that line, and you'll need to enter a second one of pure
2162 2167 whitespace. I know it sounds complicated, but I can't find a
2163 2168 different solution that covers all the cases, with the right
2164 2169 heuristics. Hopefully in actual use, nobody will really notice
2165 2170 all these strange rules and things will 'just work'.
2166 2171
2167 2172 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2168 2173
2169 2174 * IPython/iplib.py (interact): catch exceptions which can be
2170 2175 triggered asynchronously by signal handlers. Thanks to an
2171 2176 automatic crash report, submitted by Colin Kingsley
2172 2177 <tercel-AT-gentoo.org>.
2173 2178
2174 2179 2006-01-20 Ville Vainio <vivainio@gmail.com>
2175 2180
2176 2181 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2177 2182 (%rehashdir, very useful, try it out) of how to extend ipython
2178 2183 with new magics. Also added Extensions dir to pythonpath to make
2179 2184 importing extensions easy.
2180 2185
2181 2186 * %store now complains when trying to store interactively declared
2182 2187 classes / instances of those classes.
2183 2188
2184 2189 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2185 2190 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2186 2191 if they exist, and ipy_user_conf.py with some defaults is created for
2187 2192 the user.
2188 2193
2189 2194 * Startup rehashing done by the config file, not InterpreterExec.
2190 2195 This means system commands are available even without selecting the
2191 2196 pysh profile. It's the sensible default after all.
2192 2197
2193 2198 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2194 2199
2195 2200 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2196 2201 multiline code with autoindent on working. But I am really not
2197 2202 sure, so this needs more testing. Will commit a debug-enabled
2198 2203 version for now, while I test it some more, so that Ville and
2199 2204 others may also catch any problems. Also made
2200 2205 self.indent_current_str() a method, to ensure that there's no
2201 2206 chance of the indent space count and the corresponding string
2202 2207 falling out of sync. All code needing the string should just call
2203 2208 the method.
2204 2209
2205 2210 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2206 2211
2207 2212 * IPython/Magic.py (magic_edit): fix check for when users don't
2208 2213 save their output files, the try/except was in the wrong section.
2209 2214
2210 2215 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2211 2216
2212 2217 * IPython/Magic.py (magic_run): fix __file__ global missing from
2213 2218 script's namespace when executed via %run. After a report by
2214 2219 Vivian.
2215 2220
2216 2221 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2217 2222 when using python 2.4. The parent constructor changed in 2.4, and
2218 2223 we need to track it directly (we can't call it, as it messes up
2219 2224 readline and tab-completion inside our pdb would stop working).
2220 2225 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2221 2226
2222 2227 2006-01-16 Ville Vainio <vivainio@gmail.com>
2223 2228
2224 2229 * Ipython/magic.py: Reverted back to old %edit functionality
2225 2230 that returns file contents on exit.
2226 2231
2227 2232 * IPython/path.py: Added Jason Orendorff's "path" module to
2228 2233 IPython tree, http://www.jorendorff.com/articles/python/path/.
2229 2234 You can get path objects conveniently through %sc, and !!, e.g.:
2230 2235 sc files=ls
2231 2236 for p in files.paths: # or files.p
2232 2237 print p,p.mtime
2233 2238
2234 2239 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2235 2240 now work again without considering the exclusion regexp -
2236 2241 hence, things like ',foo my/path' turn to 'foo("my/path")'
2237 2242 instead of syntax error.
2238 2243
2239 2244
2240 2245 2006-01-14 Ville Vainio <vivainio@gmail.com>
2241 2246
2242 2247 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2243 2248 ipapi decorators for python 2.4 users, options() provides access to rc
2244 2249 data.
2245 2250
2246 2251 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2247 2252 as path separators (even on Linux ;-). Space character after
2248 2253 backslash (as yielded by tab completer) is still space;
2249 2254 "%cd long\ name" works as expected.
2250 2255
2251 2256 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2252 2257 as "chain of command", with priority. API stays the same,
2253 2258 TryNext exception raised by a hook function signals that
2254 2259 current hook failed and next hook should try handling it, as
2255 2260 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2256 2261 requested configurable display hook, which is now implemented.
2257 2262
2258 2263 2006-01-13 Ville Vainio <vivainio@gmail.com>
2259 2264
2260 2265 * IPython/platutils*.py: platform specific utility functions,
2261 2266 so far only set_term_title is implemented (change terminal
2262 2267 label in windowing systems). %cd now changes the title to
2263 2268 current dir.
2264 2269
2265 2270 * IPython/Release.py: Added myself to "authors" list,
2266 2271 had to create new files.
2267 2272
2268 2273 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2269 2274 shell escape; not a known bug but had potential to be one in the
2270 2275 future.
2271 2276
2272 2277 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2273 2278 extension API for IPython! See the module for usage example. Fix
2274 2279 OInspect for docstring-less magic functions.
2275 2280
2276 2281
2277 2282 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2278 2283
2279 2284 * IPython/iplib.py (raw_input): temporarily deactivate all
2280 2285 attempts at allowing pasting of code with autoindent on. It
2281 2286 introduced bugs (reported by Prabhu) and I can't seem to find a
2282 2287 robust combination which works in all cases. Will have to revisit
2283 2288 later.
2284 2289
2285 2290 * IPython/genutils.py: remove isspace() function. We've dropped
2286 2291 2.2 compatibility, so it's OK to use the string method.
2287 2292
2288 2293 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2289 2294
2290 2295 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2291 2296 matching what NOT to autocall on, to include all python binary
2292 2297 operators (including things like 'and', 'or', 'is' and 'in').
2293 2298 Prompted by a bug report on 'foo & bar', but I realized we had
2294 2299 many more potential bug cases with other operators. The regexp is
2295 2300 self.re_exclude_auto, it's fairly commented.
2296 2301
2297 2302 2006-01-12 Ville Vainio <vivainio@gmail.com>
2298 2303
2299 2304 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2300 2305 Prettified and hardened string/backslash quoting with ipsystem(),
2301 2306 ipalias() and ipmagic(). Now even \ characters are passed to
2302 2307 %magics, !shell escapes and aliases exactly as they are in the
2303 2308 ipython command line. Should improve backslash experience,
2304 2309 particularly in Windows (path delimiter for some commands that
2305 2310 won't understand '/'), but Unix benefits as well (regexps). %cd
2306 2311 magic still doesn't support backslash path delimiters, though. Also
2307 2312 deleted all pretense of supporting multiline command strings in
2308 2313 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2309 2314
2310 2315 * doc/build_doc_instructions.txt added. Documentation on how to
2311 2316 use doc/update_manual.py, added yesterday. Both files contributed
2312 2317 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2313 2318 doc/*.sh for deprecation at a later date.
2314 2319
2315 2320 * /ipython.py Added ipython.py to root directory for
2316 2321 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2317 2322 ipython.py) and development convenience (no need to keep doing
2318 2323 "setup.py install" between changes).
2319 2324
2320 2325 * Made ! and !! shell escapes work (again) in multiline expressions:
2321 2326 if 1:
2322 2327 !ls
2323 2328 !!ls
2324 2329
2325 2330 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2326 2331
2327 2332 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2328 2333 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2329 2334 module in case-insensitive installation. Was causing crashes
2330 2335 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2331 2336
2332 2337 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2333 2338 <marienz-AT-gentoo.org>, closes
2334 2339 http://www.scipy.net/roundup/ipython/issue51.
2335 2340
2336 2341 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2337 2342
2338 2343 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2339 2344 problem of excessive CPU usage under *nix and keyboard lag under
2340 2345 win32.
2341 2346
2342 2347 2006-01-10 *** Released version 0.7.0
2343 2348
2344 2349 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2345 2350
2346 2351 * IPython/Release.py (revision): tag version number to 0.7.0,
2347 2352 ready for release.
2348 2353
2349 2354 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2350 2355 it informs the user of the name of the temp. file used. This can
2351 2356 help if you decide later to reuse that same file, so you know
2352 2357 where to copy the info from.
2353 2358
2354 2359 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2355 2360
2356 2361 * setup_bdist_egg.py: little script to build an egg. Added
2357 2362 support in the release tools as well.
2358 2363
2359 2364 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2360 2365
2361 2366 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2362 2367 version selection (new -wxversion command line and ipythonrc
2363 2368 parameter). Patch contributed by Arnd Baecker
2364 2369 <arnd.baecker-AT-web.de>.
2365 2370
2366 2371 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2367 2372 embedded instances, for variables defined at the interactive
2368 2373 prompt of the embedded ipython. Reported by Arnd.
2369 2374
2370 2375 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2371 2376 it can be used as a (stateful) toggle, or with a direct parameter.
2372 2377
2373 2378 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2374 2379 could be triggered in certain cases and cause the traceback
2375 2380 printer not to work.
2376 2381
2377 2382 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2378 2383
2379 2384 * IPython/iplib.py (_should_recompile): Small fix, closes
2380 2385 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2381 2386
2382 2387 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2383 2388
2384 2389 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2385 2390 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2386 2391 Moad for help with tracking it down.
2387 2392
2388 2393 * IPython/iplib.py (handle_auto): fix autocall handling for
2389 2394 objects which support BOTH __getitem__ and __call__ (so that f [x]
2390 2395 is left alone, instead of becoming f([x]) automatically).
2391 2396
2392 2397 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2393 2398 Ville's patch.
2394 2399
2395 2400 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2396 2401
2397 2402 * IPython/iplib.py (handle_auto): changed autocall semantics to
2398 2403 include 'smart' mode, where the autocall transformation is NOT
2399 2404 applied if there are no arguments on the line. This allows you to
2400 2405 just type 'foo' if foo is a callable to see its internal form,
2401 2406 instead of having it called with no arguments (typically a
2402 2407 mistake). The old 'full' autocall still exists: for that, you
2403 2408 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2404 2409
2405 2410 * IPython/completer.py (Completer.attr_matches): add
2406 2411 tab-completion support for Enthoughts' traits. After a report by
2407 2412 Arnd and a patch by Prabhu.
2408 2413
2409 2414 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2410 2415
2411 2416 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2412 2417 Schmolck's patch to fix inspect.getinnerframes().
2413 2418
2414 2419 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2415 2420 for embedded instances, regarding handling of namespaces and items
2416 2421 added to the __builtin__ one. Multiple embedded instances and
2417 2422 recursive embeddings should work better now (though I'm not sure
2418 2423 I've got all the corner cases fixed, that code is a bit of a brain
2419 2424 twister).
2420 2425
2421 2426 * IPython/Magic.py (magic_edit): added support to edit in-memory
2422 2427 macros (automatically creates the necessary temp files). %edit
2423 2428 also doesn't return the file contents anymore, it's just noise.
2424 2429
2425 2430 * IPython/completer.py (Completer.attr_matches): revert change to
2426 2431 complete only on attributes listed in __all__. I realized it
2427 2432 cripples the tab-completion system as a tool for exploring the
2428 2433 internals of unknown libraries (it renders any non-__all__
2429 2434 attribute off-limits). I got bit by this when trying to see
2430 2435 something inside the dis module.
2431 2436
2432 2437 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2433 2438
2434 2439 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2435 2440 namespace for users and extension writers to hold data in. This
2436 2441 follows the discussion in
2437 2442 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2438 2443
2439 2444 * IPython/completer.py (IPCompleter.complete): small patch to help
2440 2445 tab-completion under Emacs, after a suggestion by John Barnard
2441 2446 <barnarj-AT-ccf.org>.
2442 2447
2443 2448 * IPython/Magic.py (Magic.extract_input_slices): added support for
2444 2449 the slice notation in magics to use N-M to represent numbers N...M
2445 2450 (closed endpoints). This is used by %macro and %save.
2446 2451
2447 2452 * IPython/completer.py (Completer.attr_matches): for modules which
2448 2453 define __all__, complete only on those. After a patch by Jeffrey
2449 2454 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2450 2455 speed up this routine.
2451 2456
2452 2457 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2453 2458 don't know if this is the end of it, but the behavior now is
2454 2459 certainly much more correct. Note that coupled with macros,
2455 2460 slightly surprising (at first) behavior may occur: a macro will in
2456 2461 general expand to multiple lines of input, so upon exiting, the
2457 2462 in/out counters will both be bumped by the corresponding amount
2458 2463 (as if the macro's contents had been typed interactively). Typing
2459 2464 %hist will reveal the intermediate (silently processed) lines.
2460 2465
2461 2466 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2462 2467 pickle to fail (%run was overwriting __main__ and not restoring
2463 2468 it, but pickle relies on __main__ to operate).
2464 2469
2465 2470 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2466 2471 using properties, but forgot to make the main InteractiveShell
2467 2472 class a new-style class. Properties fail silently, and
2468 2473 mysteriously, with old-style class (getters work, but
2469 2474 setters don't do anything).
2470 2475
2471 2476 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2472 2477
2473 2478 * IPython/Magic.py (magic_history): fix history reporting bug (I
2474 2479 know some nasties are still there, I just can't seem to find a
2475 2480 reproducible test case to track them down; the input history is
2476 2481 falling out of sync...)
2477 2482
2478 2483 * IPython/iplib.py (handle_shell_escape): fix bug where both
2479 2484 aliases and system accesses where broken for indented code (such
2480 2485 as loops).
2481 2486
2482 2487 * IPython/genutils.py (shell): fix small but critical bug for
2483 2488 win32 system access.
2484 2489
2485 2490 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2486 2491
2487 2492 * IPython/iplib.py (showtraceback): remove use of the
2488 2493 sys.last_{type/value/traceback} structures, which are non
2489 2494 thread-safe.
2490 2495 (_prefilter): change control flow to ensure that we NEVER
2491 2496 introspect objects when autocall is off. This will guarantee that
2492 2497 having an input line of the form 'x.y', where access to attribute
2493 2498 'y' has side effects, doesn't trigger the side effect TWICE. It
2494 2499 is important to note that, with autocall on, these side effects
2495 2500 can still happen.
2496 2501 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2497 2502 trio. IPython offers these three kinds of special calls which are
2498 2503 not python code, and it's a good thing to have their call method
2499 2504 be accessible as pure python functions (not just special syntax at
2500 2505 the command line). It gives us a better internal implementation
2501 2506 structure, as well as exposing these for user scripting more
2502 2507 cleanly.
2503 2508
2504 2509 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2505 2510 file. Now that they'll be more likely to be used with the
2506 2511 persistance system (%store), I want to make sure their module path
2507 2512 doesn't change in the future, so that we don't break things for
2508 2513 users' persisted data.
2509 2514
2510 2515 * IPython/iplib.py (autoindent_update): move indentation
2511 2516 management into the _text_ processing loop, not the keyboard
2512 2517 interactive one. This is necessary to correctly process non-typed
2513 2518 multiline input (such as macros).
2514 2519
2515 2520 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2516 2521 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2517 2522 which was producing problems in the resulting manual.
2518 2523 (magic_whos): improve reporting of instances (show their class,
2519 2524 instead of simply printing 'instance' which isn't terribly
2520 2525 informative).
2521 2526
2522 2527 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2523 2528 (minor mods) to support network shares under win32.
2524 2529
2525 2530 * IPython/winconsole.py (get_console_size): add new winconsole
2526 2531 module and fixes to page_dumb() to improve its behavior under
2527 2532 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2528 2533
2529 2534 * IPython/Magic.py (Macro): simplified Macro class to just
2530 2535 subclass list. We've had only 2.2 compatibility for a very long
2531 2536 time, yet I was still avoiding subclassing the builtin types. No
2532 2537 more (I'm also starting to use properties, though I won't shift to
2533 2538 2.3-specific features quite yet).
2534 2539 (magic_store): added Ville's patch for lightweight variable
2535 2540 persistence, after a request on the user list by Matt Wilkie
2536 2541 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2537 2542 details.
2538 2543
2539 2544 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2540 2545 changed the default logfile name from 'ipython.log' to
2541 2546 'ipython_log.py'. These logs are real python files, and now that
2542 2547 we have much better multiline support, people are more likely to
2543 2548 want to use them as such. Might as well name them correctly.
2544 2549
2545 2550 * IPython/Magic.py: substantial cleanup. While we can't stop
2546 2551 using magics as mixins, due to the existing customizations 'out
2547 2552 there' which rely on the mixin naming conventions, at least I
2548 2553 cleaned out all cross-class name usage. So once we are OK with
2549 2554 breaking compatibility, the two systems can be separated.
2550 2555
2551 2556 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2552 2557 anymore, and the class is a fair bit less hideous as well. New
2553 2558 features were also introduced: timestamping of input, and logging
2554 2559 of output results. These are user-visible with the -t and -o
2555 2560 options to %logstart. Closes
2556 2561 http://www.scipy.net/roundup/ipython/issue11 and a request by
2557 2562 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2558 2563
2559 2564 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2560 2565
2561 2566 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2562 2567 better handle backslashes in paths. See the thread 'More Windows
2563 2568 questions part 2 - \/ characters revisited' on the iypthon user
2564 2569 list:
2565 2570 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2566 2571
2567 2572 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2568 2573
2569 2574 (InteractiveShell.__init__): change threaded shells to not use the
2570 2575 ipython crash handler. This was causing more problems than not,
2571 2576 as exceptions in the main thread (GUI code, typically) would
2572 2577 always show up as a 'crash', when they really weren't.
2573 2578
2574 2579 The colors and exception mode commands (%colors/%xmode) have been
2575 2580 synchronized to also take this into account, so users can get
2576 2581 verbose exceptions for their threaded code as well. I also added
2577 2582 support for activating pdb inside this exception handler as well,
2578 2583 so now GUI authors can use IPython's enhanced pdb at runtime.
2579 2584
2580 2585 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2581 2586 true by default, and add it to the shipped ipythonrc file. Since
2582 2587 this asks the user before proceeding, I think it's OK to make it
2583 2588 true by default.
2584 2589
2585 2590 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2586 2591 of the previous special-casing of input in the eval loop. I think
2587 2592 this is cleaner, as they really are commands and shouldn't have
2588 2593 a special role in the middle of the core code.
2589 2594
2590 2595 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2591 2596
2592 2597 * IPython/iplib.py (edit_syntax_error): added support for
2593 2598 automatically reopening the editor if the file had a syntax error
2594 2599 in it. Thanks to scottt who provided the patch at:
2595 2600 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2596 2601 version committed).
2597 2602
2598 2603 * IPython/iplib.py (handle_normal): add suport for multi-line
2599 2604 input with emtpy lines. This fixes
2600 2605 http://www.scipy.net/roundup/ipython/issue43 and a similar
2601 2606 discussion on the user list.
2602 2607
2603 2608 WARNING: a behavior change is necessarily introduced to support
2604 2609 blank lines: now a single blank line with whitespace does NOT
2605 2610 break the input loop, which means that when autoindent is on, by
2606 2611 default hitting return on the next (indented) line does NOT exit.
2607 2612
2608 2613 Instead, to exit a multiline input you can either have:
2609 2614
2610 2615 - TWO whitespace lines (just hit return again), or
2611 2616 - a single whitespace line of a different length than provided
2612 2617 by the autoindent (add or remove a space).
2613 2618
2614 2619 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2615 2620 module to better organize all readline-related functionality.
2616 2621 I've deleted FlexCompleter and put all completion clases here.
2617 2622
2618 2623 * IPython/iplib.py (raw_input): improve indentation management.
2619 2624 It is now possible to paste indented code with autoindent on, and
2620 2625 the code is interpreted correctly (though it still looks bad on
2621 2626 screen, due to the line-oriented nature of ipython).
2622 2627 (MagicCompleter.complete): change behavior so that a TAB key on an
2623 2628 otherwise empty line actually inserts a tab, instead of completing
2624 2629 on the entire global namespace. This makes it easier to use the
2625 2630 TAB key for indentation. After a request by Hans Meine
2626 2631 <hans_meine-AT-gmx.net>
2627 2632 (_prefilter): add support so that typing plain 'exit' or 'quit'
2628 2633 does a sensible thing. Originally I tried to deviate as little as
2629 2634 possible from the default python behavior, but even that one may
2630 2635 change in this direction (thread on python-dev to that effect).
2631 2636 Regardless, ipython should do the right thing even if CPython's
2632 2637 '>>>' prompt doesn't.
2633 2638 (InteractiveShell): removed subclassing code.InteractiveConsole
2634 2639 class. By now we'd overridden just about all of its methods: I've
2635 2640 copied the remaining two over, and now ipython is a standalone
2636 2641 class. This will provide a clearer picture for the chainsaw
2637 2642 branch refactoring.
2638 2643
2639 2644 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2640 2645
2641 2646 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2642 2647 failures for objects which break when dir() is called on them.
2643 2648
2644 2649 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2645 2650 distinct local and global namespaces in the completer API. This
2646 2651 change allows us to properly handle completion with distinct
2647 2652 scopes, including in embedded instances (this had never really
2648 2653 worked correctly).
2649 2654
2650 2655 Note: this introduces a change in the constructor for
2651 2656 MagicCompleter, as a new global_namespace parameter is now the
2652 2657 second argument (the others were bumped one position).
2653 2658
2654 2659 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2655 2660
2656 2661 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2657 2662 embedded instances (which can be done now thanks to Vivian's
2658 2663 frame-handling fixes for pdb).
2659 2664 (InteractiveShell.__init__): Fix namespace handling problem in
2660 2665 embedded instances. We were overwriting __main__ unconditionally,
2661 2666 and this should only be done for 'full' (non-embedded) IPython;
2662 2667 embedded instances must respect the caller's __main__. Thanks to
2663 2668 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2664 2669
2665 2670 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2666 2671
2667 2672 * setup.py: added download_url to setup(). This registers the
2668 2673 download address at PyPI, which is not only useful to humans
2669 2674 browsing the site, but is also picked up by setuptools (the Eggs
2670 2675 machinery). Thanks to Ville and R. Kern for the info/discussion
2671 2676 on this.
2672 2677
2673 2678 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2674 2679
2675 2680 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2676 2681 This brings a lot of nice functionality to the pdb mode, which now
2677 2682 has tab-completion, syntax highlighting, and better stack handling
2678 2683 than before. Many thanks to Vivian De Smedt
2679 2684 <vivian-AT-vdesmedt.com> for the original patches.
2680 2685
2681 2686 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2682 2687
2683 2688 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2684 2689 sequence to consistently accept the banner argument. The
2685 2690 inconsistency was tripping SAGE, thanks to Gary Zablackis
2686 2691 <gzabl-AT-yahoo.com> for the report.
2687 2692
2688 2693 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2689 2694
2690 2695 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2691 2696 Fix bug where a naked 'alias' call in the ipythonrc file would
2692 2697 cause a crash. Bug reported by Jorgen Stenarson.
2693 2698
2694 2699 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2695 2700
2696 2701 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2697 2702 startup time.
2698 2703
2699 2704 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2700 2705 instances had introduced a bug with globals in normal code. Now
2701 2706 it's working in all cases.
2702 2707
2703 2708 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2704 2709 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2705 2710 has been introduced to set the default case sensitivity of the
2706 2711 searches. Users can still select either mode at runtime on a
2707 2712 per-search basis.
2708 2713
2709 2714 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2710 2715
2711 2716 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2712 2717 attributes in wildcard searches for subclasses. Modified version
2713 2718 of a patch by Jorgen.
2714 2719
2715 2720 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2716 2721
2717 2722 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2718 2723 embedded instances. I added a user_global_ns attribute to the
2719 2724 InteractiveShell class to handle this.
2720 2725
2721 2726 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2722 2727
2723 2728 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2724 2729 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2725 2730 (reported under win32, but may happen also in other platforms).
2726 2731 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2727 2732
2728 2733 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2729 2734
2730 2735 * IPython/Magic.py (magic_psearch): new support for wildcard
2731 2736 patterns. Now, typing ?a*b will list all names which begin with a
2732 2737 and end in b, for example. The %psearch magic has full
2733 2738 docstrings. Many thanks to JΓΆrgen Stenarson
2734 2739 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2735 2740 implementing this functionality.
2736 2741
2737 2742 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2738 2743
2739 2744 * Manual: fixed long-standing annoyance of double-dashes (as in
2740 2745 --prefix=~, for example) being stripped in the HTML version. This
2741 2746 is a latex2html bug, but a workaround was provided. Many thanks
2742 2747 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2743 2748 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2744 2749 rolling. This seemingly small issue had tripped a number of users
2745 2750 when first installing, so I'm glad to see it gone.
2746 2751
2747 2752 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2748 2753
2749 2754 * IPython/Extensions/numeric_formats.py: fix missing import,
2750 2755 reported by Stephen Walton.
2751 2756
2752 2757 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2753 2758
2754 2759 * IPython/demo.py: finish demo module, fully documented now.
2755 2760
2756 2761 * IPython/genutils.py (file_read): simple little utility to read a
2757 2762 file and ensure it's closed afterwards.
2758 2763
2759 2764 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2760 2765
2761 2766 * IPython/demo.py (Demo.__init__): added support for individually
2762 2767 tagging blocks for automatic execution.
2763 2768
2764 2769 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2765 2770 syntax-highlighted python sources, requested by John.
2766 2771
2767 2772 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2768 2773
2769 2774 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2770 2775 finishing.
2771 2776
2772 2777 * IPython/genutils.py (shlex_split): moved from Magic to here,
2773 2778 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2774 2779
2775 2780 * IPython/demo.py (Demo.__init__): added support for silent
2776 2781 blocks, improved marks as regexps, docstrings written.
2777 2782 (Demo.__init__): better docstring, added support for sys.argv.
2778 2783
2779 2784 * IPython/genutils.py (marquee): little utility used by the demo
2780 2785 code, handy in general.
2781 2786
2782 2787 * IPython/demo.py (Demo.__init__): new class for interactive
2783 2788 demos. Not documented yet, I just wrote it in a hurry for
2784 2789 scipy'05. Will docstring later.
2785 2790
2786 2791 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2787 2792
2788 2793 * IPython/Shell.py (sigint_handler): Drastic simplification which
2789 2794 also seems to make Ctrl-C work correctly across threads! This is
2790 2795 so simple, that I can't beleive I'd missed it before. Needs more
2791 2796 testing, though.
2792 2797 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2793 2798 like this before...
2794 2799
2795 2800 * IPython/genutils.py (get_home_dir): add protection against
2796 2801 non-dirs in win32 registry.
2797 2802
2798 2803 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2799 2804 bug where dict was mutated while iterating (pysh crash).
2800 2805
2801 2806 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2802 2807
2803 2808 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2804 2809 spurious newlines added by this routine. After a report by
2805 2810 F. Mantegazza.
2806 2811
2807 2812 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2808 2813
2809 2814 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2810 2815 calls. These were a leftover from the GTK 1.x days, and can cause
2811 2816 problems in certain cases (after a report by John Hunter).
2812 2817
2813 2818 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2814 2819 os.getcwd() fails at init time. Thanks to patch from David Remahl
2815 2820 <chmod007-AT-mac.com>.
2816 2821 (InteractiveShell.__init__): prevent certain special magics from
2817 2822 being shadowed by aliases. Closes
2818 2823 http://www.scipy.net/roundup/ipython/issue41.
2819 2824
2820 2825 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2821 2826
2822 2827 * IPython/iplib.py (InteractiveShell.complete): Added new
2823 2828 top-level completion method to expose the completion mechanism
2824 2829 beyond readline-based environments.
2825 2830
2826 2831 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2827 2832
2828 2833 * tools/ipsvnc (svnversion): fix svnversion capture.
2829 2834
2830 2835 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2831 2836 attribute to self, which was missing. Before, it was set by a
2832 2837 routine which in certain cases wasn't being called, so the
2833 2838 instance could end up missing the attribute. This caused a crash.
2834 2839 Closes http://www.scipy.net/roundup/ipython/issue40.
2835 2840
2836 2841 2005-08-16 Fernando Perez <fperez@colorado.edu>
2837 2842
2838 2843 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2839 2844 contains non-string attribute. Closes
2840 2845 http://www.scipy.net/roundup/ipython/issue38.
2841 2846
2842 2847 2005-08-14 Fernando Perez <fperez@colorado.edu>
2843 2848
2844 2849 * tools/ipsvnc: Minor improvements, to add changeset info.
2845 2850
2846 2851 2005-08-12 Fernando Perez <fperez@colorado.edu>
2847 2852
2848 2853 * IPython/iplib.py (runsource): remove self.code_to_run_src
2849 2854 attribute. I realized this is nothing more than
2850 2855 '\n'.join(self.buffer), and having the same data in two different
2851 2856 places is just asking for synchronization bugs. This may impact
2852 2857 people who have custom exception handlers, so I need to warn
2853 2858 ipython-dev about it (F. Mantegazza may use them).
2854 2859
2855 2860 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2856 2861
2857 2862 * IPython/genutils.py: fix 2.2 compatibility (generators)
2858 2863
2859 2864 2005-07-18 Fernando Perez <fperez@colorado.edu>
2860 2865
2861 2866 * IPython/genutils.py (get_home_dir): fix to help users with
2862 2867 invalid $HOME under win32.
2863 2868
2864 2869 2005-07-17 Fernando Perez <fperez@colorado.edu>
2865 2870
2866 2871 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2867 2872 some old hacks and clean up a bit other routines; code should be
2868 2873 simpler and a bit faster.
2869 2874
2870 2875 * IPython/iplib.py (interact): removed some last-resort attempts
2871 2876 to survive broken stdout/stderr. That code was only making it
2872 2877 harder to abstract out the i/o (necessary for gui integration),
2873 2878 and the crashes it could prevent were extremely rare in practice
2874 2879 (besides being fully user-induced in a pretty violent manner).
2875 2880
2876 2881 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2877 2882 Nothing major yet, but the code is simpler to read; this should
2878 2883 make it easier to do more serious modifications in the future.
2879 2884
2880 2885 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2881 2886 which broke in .15 (thanks to a report by Ville).
2882 2887
2883 2888 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2884 2889 be quite correct, I know next to nothing about unicode). This
2885 2890 will allow unicode strings to be used in prompts, amongst other
2886 2891 cases. It also will prevent ipython from crashing when unicode
2887 2892 shows up unexpectedly in many places. If ascii encoding fails, we
2888 2893 assume utf_8. Currently the encoding is not a user-visible
2889 2894 setting, though it could be made so if there is demand for it.
2890 2895
2891 2896 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2892 2897
2893 2898 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2894 2899
2895 2900 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2896 2901
2897 2902 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2898 2903 code can work transparently for 2.2/2.3.
2899 2904
2900 2905 2005-07-16 Fernando Perez <fperez@colorado.edu>
2901 2906
2902 2907 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2903 2908 out of the color scheme table used for coloring exception
2904 2909 tracebacks. This allows user code to add new schemes at runtime.
2905 2910 This is a minimally modified version of the patch at
2906 2911 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2907 2912 for the contribution.
2908 2913
2909 2914 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2910 2915 slightly modified version of the patch in
2911 2916 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2912 2917 to remove the previous try/except solution (which was costlier).
2913 2918 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2914 2919
2915 2920 2005-06-08 Fernando Perez <fperez@colorado.edu>
2916 2921
2917 2922 * IPython/iplib.py (write/write_err): Add methods to abstract all
2918 2923 I/O a bit more.
2919 2924
2920 2925 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2921 2926 warning, reported by Aric Hagberg, fix by JD Hunter.
2922 2927
2923 2928 2005-06-02 *** Released version 0.6.15
2924 2929
2925 2930 2005-06-01 Fernando Perez <fperez@colorado.edu>
2926 2931
2927 2932 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2928 2933 tab-completion of filenames within open-quoted strings. Note that
2929 2934 this requires that in ~/.ipython/ipythonrc, users change the
2930 2935 readline delimiters configuration to read:
2931 2936
2932 2937 readline_remove_delims -/~
2933 2938
2934 2939
2935 2940 2005-05-31 *** Released version 0.6.14
2936 2941
2937 2942 2005-05-29 Fernando Perez <fperez@colorado.edu>
2938 2943
2939 2944 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2940 2945 with files not on the filesystem. Reported by Eliyahu Sandler
2941 2946 <eli@gondolin.net>
2942 2947
2943 2948 2005-05-22 Fernando Perez <fperez@colorado.edu>
2944 2949
2945 2950 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2946 2951 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2947 2952
2948 2953 2005-05-19 Fernando Perez <fperez@colorado.edu>
2949 2954
2950 2955 * IPython/iplib.py (safe_execfile): close a file which could be
2951 2956 left open (causing problems in win32, which locks open files).
2952 2957 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2953 2958
2954 2959 2005-05-18 Fernando Perez <fperez@colorado.edu>
2955 2960
2956 2961 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2957 2962 keyword arguments correctly to safe_execfile().
2958 2963
2959 2964 2005-05-13 Fernando Perez <fperez@colorado.edu>
2960 2965
2961 2966 * ipython.1: Added info about Qt to manpage, and threads warning
2962 2967 to usage page (invoked with --help).
2963 2968
2964 2969 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2965 2970 new matcher (it goes at the end of the priority list) to do
2966 2971 tab-completion on named function arguments. Submitted by George
2967 2972 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2968 2973 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2969 2974 for more details.
2970 2975
2971 2976 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2972 2977 SystemExit exceptions in the script being run. Thanks to a report
2973 2978 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2974 2979 producing very annoying behavior when running unit tests.
2975 2980
2976 2981 2005-05-12 Fernando Perez <fperez@colorado.edu>
2977 2982
2978 2983 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2979 2984 which I'd broken (again) due to a changed regexp. In the process,
2980 2985 added ';' as an escape to auto-quote the whole line without
2981 2986 splitting its arguments. Thanks to a report by Jerry McRae
2982 2987 <qrs0xyc02-AT-sneakemail.com>.
2983 2988
2984 2989 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2985 2990 possible crashes caused by a TokenError. Reported by Ed Schofield
2986 2991 <schofield-AT-ftw.at>.
2987 2992
2988 2993 2005-05-06 Fernando Perez <fperez@colorado.edu>
2989 2994
2990 2995 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2991 2996
2992 2997 2005-04-29 Fernando Perez <fperez@colorado.edu>
2993 2998
2994 2999 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2995 3000 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2996 3001 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2997 3002 which provides support for Qt interactive usage (similar to the
2998 3003 existing one for WX and GTK). This had been often requested.
2999 3004
3000 3005 2005-04-14 *** Released version 0.6.13
3001 3006
3002 3007 2005-04-08 Fernando Perez <fperez@colorado.edu>
3003 3008
3004 3009 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3005 3010 from _ofind, which gets called on almost every input line. Now,
3006 3011 we only try to get docstrings if they are actually going to be
3007 3012 used (the overhead of fetching unnecessary docstrings can be
3008 3013 noticeable for certain objects, such as Pyro proxies).
3009 3014
3010 3015 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3011 3016 for completers. For some reason I had been passing them the state
3012 3017 variable, which completers never actually need, and was in
3013 3018 conflict with the rlcompleter API. Custom completers ONLY need to
3014 3019 take the text parameter.
3015 3020
3016 3021 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3017 3022 work correctly in pysh. I've also moved all the logic which used
3018 3023 to be in pysh.py here, which will prevent problems with future
3019 3024 upgrades. However, this time I must warn users to update their
3020 3025 pysh profile to include the line
3021 3026
3022 3027 import_all IPython.Extensions.InterpreterExec
3023 3028
3024 3029 because otherwise things won't work for them. They MUST also
3025 3030 delete pysh.py and the line
3026 3031
3027 3032 execfile pysh.py
3028 3033
3029 3034 from their ipythonrc-pysh.
3030 3035
3031 3036 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3032 3037 robust in the face of objects whose dir() returns non-strings
3033 3038 (which it shouldn't, but some broken libs like ITK do). Thanks to
3034 3039 a patch by John Hunter (implemented differently, though). Also
3035 3040 minor improvements by using .extend instead of + on lists.
3036 3041
3037 3042 * pysh.py:
3038 3043
3039 3044 2005-04-06 Fernando Perez <fperez@colorado.edu>
3040 3045
3041 3046 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3042 3047 by default, so that all users benefit from it. Those who don't
3043 3048 want it can still turn it off.
3044 3049
3045 3050 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3046 3051 config file, I'd forgotten about this, so users were getting it
3047 3052 off by default.
3048 3053
3049 3054 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3050 3055 consistency. Now magics can be called in multiline statements,
3051 3056 and python variables can be expanded in magic calls via $var.
3052 3057 This makes the magic system behave just like aliases or !system
3053 3058 calls.
3054 3059
3055 3060 2005-03-28 Fernando Perez <fperez@colorado.edu>
3056 3061
3057 3062 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3058 3063 expensive string additions for building command. Add support for
3059 3064 trailing ';' when autocall is used.
3060 3065
3061 3066 2005-03-26 Fernando Perez <fperez@colorado.edu>
3062 3067
3063 3068 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3064 3069 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3065 3070 ipython.el robust against prompts with any number of spaces
3066 3071 (including 0) after the ':' character.
3067 3072
3068 3073 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3069 3074 continuation prompt, which misled users to think the line was
3070 3075 already indented. Closes debian Bug#300847, reported to me by
3071 3076 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3072 3077
3073 3078 2005-03-23 Fernando Perez <fperez@colorado.edu>
3074 3079
3075 3080 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3076 3081 properly aligned if they have embedded newlines.
3077 3082
3078 3083 * IPython/iplib.py (runlines): Add a public method to expose
3079 3084 IPython's code execution machinery, so that users can run strings
3080 3085 as if they had been typed at the prompt interactively.
3081 3086 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3082 3087 methods which can call the system shell, but with python variable
3083 3088 expansion. The three such methods are: __IPYTHON__.system,
3084 3089 .getoutput and .getoutputerror. These need to be documented in a
3085 3090 'public API' section (to be written) of the manual.
3086 3091
3087 3092 2005-03-20 Fernando Perez <fperez@colorado.edu>
3088 3093
3089 3094 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3090 3095 for custom exception handling. This is quite powerful, and it
3091 3096 allows for user-installable exception handlers which can trap
3092 3097 custom exceptions at runtime and treat them separately from
3093 3098 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3094 3099 Mantegazza <mantegazza-AT-ill.fr>.
3095 3100 (InteractiveShell.set_custom_completer): public API function to
3096 3101 add new completers at runtime.
3097 3102
3098 3103 2005-03-19 Fernando Perez <fperez@colorado.edu>
3099 3104
3100 3105 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3101 3106 allow objects which provide their docstrings via non-standard
3102 3107 mechanisms (like Pyro proxies) to still be inspected by ipython's
3103 3108 ? system.
3104 3109
3105 3110 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3106 3111 automatic capture system. I tried quite hard to make it work
3107 3112 reliably, and simply failed. I tried many combinations with the
3108 3113 subprocess module, but eventually nothing worked in all needed
3109 3114 cases (not blocking stdin for the child, duplicating stdout
3110 3115 without blocking, etc). The new %sc/%sx still do capture to these
3111 3116 magical list/string objects which make shell use much more
3112 3117 conveninent, so not all is lost.
3113 3118
3114 3119 XXX - FIX MANUAL for the change above!
3115 3120
3116 3121 (runsource): I copied code.py's runsource() into ipython to modify
3117 3122 it a bit. Now the code object and source to be executed are
3118 3123 stored in ipython. This makes this info accessible to third-party
3119 3124 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3120 3125 Mantegazza <mantegazza-AT-ill.fr>.
3121 3126
3122 3127 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3123 3128 history-search via readline (like C-p/C-n). I'd wanted this for a
3124 3129 long time, but only recently found out how to do it. For users
3125 3130 who already have their ipythonrc files made and want this, just
3126 3131 add:
3127 3132
3128 3133 readline_parse_and_bind "\e[A": history-search-backward
3129 3134 readline_parse_and_bind "\e[B": history-search-forward
3130 3135
3131 3136 2005-03-18 Fernando Perez <fperez@colorado.edu>
3132 3137
3133 3138 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3134 3139 LSString and SList classes which allow transparent conversions
3135 3140 between list mode and whitespace-separated string.
3136 3141 (magic_r): Fix recursion problem in %r.
3137 3142
3138 3143 * IPython/genutils.py (LSString): New class to be used for
3139 3144 automatic storage of the results of all alias/system calls in _o
3140 3145 and _e (stdout/err). These provide a .l/.list attribute which
3141 3146 does automatic splitting on newlines. This means that for most
3142 3147 uses, you'll never need to do capturing of output with %sc/%sx
3143 3148 anymore, since ipython keeps this always done for you. Note that
3144 3149 only the LAST results are stored, the _o/e variables are
3145 3150 overwritten on each call. If you need to save their contents
3146 3151 further, simply bind them to any other name.
3147 3152
3148 3153 2005-03-17 Fernando Perez <fperez@colorado.edu>
3149 3154
3150 3155 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3151 3156 prompt namespace handling.
3152 3157
3153 3158 2005-03-16 Fernando Perez <fperez@colorado.edu>
3154 3159
3155 3160 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3156 3161 classic prompts to be '>>> ' (final space was missing, and it
3157 3162 trips the emacs python mode).
3158 3163 (BasePrompt.__str__): Added safe support for dynamic prompt
3159 3164 strings. Now you can set your prompt string to be '$x', and the
3160 3165 value of x will be printed from your interactive namespace. The
3161 3166 interpolation syntax includes the full Itpl support, so
3162 3167 ${foo()+x+bar()} is a valid prompt string now, and the function
3163 3168 calls will be made at runtime.
3164 3169
3165 3170 2005-03-15 Fernando Perez <fperez@colorado.edu>
3166 3171
3167 3172 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3168 3173 avoid name clashes in pylab. %hist still works, it just forwards
3169 3174 the call to %history.
3170 3175
3171 3176 2005-03-02 *** Released version 0.6.12
3172 3177
3173 3178 2005-03-02 Fernando Perez <fperez@colorado.edu>
3174 3179
3175 3180 * IPython/iplib.py (handle_magic): log magic calls properly as
3176 3181 ipmagic() function calls.
3177 3182
3178 3183 * IPython/Magic.py (magic_time): Improved %time to support
3179 3184 statements and provide wall-clock as well as CPU time.
3180 3185
3181 3186 2005-02-27 Fernando Perez <fperez@colorado.edu>
3182 3187
3183 3188 * IPython/hooks.py: New hooks module, to expose user-modifiable
3184 3189 IPython functionality in a clean manner. For now only the editor
3185 3190 hook is actually written, and other thigns which I intend to turn
3186 3191 into proper hooks aren't yet there. The display and prefilter
3187 3192 stuff, for example, should be hooks. But at least now the
3188 3193 framework is in place, and the rest can be moved here with more
3189 3194 time later. IPython had had a .hooks variable for a long time for
3190 3195 this purpose, but I'd never actually used it for anything.
3191 3196
3192 3197 2005-02-26 Fernando Perez <fperez@colorado.edu>
3193 3198
3194 3199 * IPython/ipmaker.py (make_IPython): make the default ipython
3195 3200 directory be called _ipython under win32, to follow more the
3196 3201 naming peculiarities of that platform (where buggy software like
3197 3202 Visual Sourcesafe breaks with .named directories). Reported by
3198 3203 Ville Vainio.
3199 3204
3200 3205 2005-02-23 Fernando Perez <fperez@colorado.edu>
3201 3206
3202 3207 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3203 3208 auto_aliases for win32 which were causing problems. Users can
3204 3209 define the ones they personally like.
3205 3210
3206 3211 2005-02-21 Fernando Perez <fperez@colorado.edu>
3207 3212
3208 3213 * IPython/Magic.py (magic_time): new magic to time execution of
3209 3214 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3210 3215
3211 3216 2005-02-19 Fernando Perez <fperez@colorado.edu>
3212 3217
3213 3218 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3214 3219 into keys (for prompts, for example).
3215 3220
3216 3221 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3217 3222 prompts in case users want them. This introduces a small behavior
3218 3223 change: ipython does not automatically add a space to all prompts
3219 3224 anymore. To get the old prompts with a space, users should add it
3220 3225 manually to their ipythonrc file, so for example prompt_in1 should
3221 3226 now read 'In [\#]: ' instead of 'In [\#]:'.
3222 3227 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3223 3228 file) to control left-padding of secondary prompts.
3224 3229
3225 3230 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3226 3231 the profiler can't be imported. Fix for Debian, which removed
3227 3232 profile.py because of License issues. I applied a slightly
3228 3233 modified version of the original Debian patch at
3229 3234 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3230 3235
3231 3236 2005-02-17 Fernando Perez <fperez@colorado.edu>
3232 3237
3233 3238 * IPython/genutils.py (native_line_ends): Fix bug which would
3234 3239 cause improper line-ends under win32 b/c I was not opening files
3235 3240 in binary mode. Bug report and fix thanks to Ville.
3236 3241
3237 3242 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3238 3243 trying to catch spurious foo[1] autocalls. My fix actually broke
3239 3244 ',/' autoquote/call with explicit escape (bad regexp).
3240 3245
3241 3246 2005-02-15 *** Released version 0.6.11
3242 3247
3243 3248 2005-02-14 Fernando Perez <fperez@colorado.edu>
3244 3249
3245 3250 * IPython/background_jobs.py: New background job management
3246 3251 subsystem. This is implemented via a new set of classes, and
3247 3252 IPython now provides a builtin 'jobs' object for background job
3248 3253 execution. A convenience %bg magic serves as a lightweight
3249 3254 frontend for starting the more common type of calls. This was
3250 3255 inspired by discussions with B. Granger and the BackgroundCommand
3251 3256 class described in the book Python Scripting for Computational
3252 3257 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3253 3258 (although ultimately no code from this text was used, as IPython's
3254 3259 system is a separate implementation).
3255 3260
3256 3261 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3257 3262 to control the completion of single/double underscore names
3258 3263 separately. As documented in the example ipytonrc file, the
3259 3264 readline_omit__names variable can now be set to 2, to omit even
3260 3265 single underscore names. Thanks to a patch by Brian Wong
3261 3266 <BrianWong-AT-AirgoNetworks.Com>.
3262 3267 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3263 3268 be autocalled as foo([1]) if foo were callable. A problem for
3264 3269 things which are both callable and implement __getitem__.
3265 3270 (init_readline): Fix autoindentation for win32. Thanks to a patch
3266 3271 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3267 3272
3268 3273 2005-02-12 Fernando Perez <fperez@colorado.edu>
3269 3274
3270 3275 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3271 3276 which I had written long ago to sort out user error messages which
3272 3277 may occur during startup. This seemed like a good idea initially,
3273 3278 but it has proven a disaster in retrospect. I don't want to
3274 3279 change much code for now, so my fix is to set the internal 'debug'
3275 3280 flag to true everywhere, whose only job was precisely to control
3276 3281 this subsystem. This closes issue 28 (as well as avoiding all
3277 3282 sorts of strange hangups which occur from time to time).
3278 3283
3279 3284 2005-02-07 Fernando Perez <fperez@colorado.edu>
3280 3285
3281 3286 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3282 3287 previous call produced a syntax error.
3283 3288
3284 3289 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3285 3290 classes without constructor.
3286 3291
3287 3292 2005-02-06 Fernando Perez <fperez@colorado.edu>
3288 3293
3289 3294 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3290 3295 completions with the results of each matcher, so we return results
3291 3296 to the user from all namespaces. This breaks with ipython
3292 3297 tradition, but I think it's a nicer behavior. Now you get all
3293 3298 possible completions listed, from all possible namespaces (python,
3294 3299 filesystem, magics...) After a request by John Hunter
3295 3300 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3296 3301
3297 3302 2005-02-05 Fernando Perez <fperez@colorado.edu>
3298 3303
3299 3304 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3300 3305 the call had quote characters in it (the quotes were stripped).
3301 3306
3302 3307 2005-01-31 Fernando Perez <fperez@colorado.edu>
3303 3308
3304 3309 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3305 3310 Itpl.itpl() to make the code more robust against psyco
3306 3311 optimizations.
3307 3312
3308 3313 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3309 3314 of causing an exception. Quicker, cleaner.
3310 3315
3311 3316 2005-01-28 Fernando Perez <fperez@colorado.edu>
3312 3317
3313 3318 * scripts/ipython_win_post_install.py (install): hardcode
3314 3319 sys.prefix+'python.exe' as the executable path. It turns out that
3315 3320 during the post-installation run, sys.executable resolves to the
3316 3321 name of the binary installer! I should report this as a distutils
3317 3322 bug, I think. I updated the .10 release with this tiny fix, to
3318 3323 avoid annoying the lists further.
3319 3324
3320 3325 2005-01-27 *** Released version 0.6.10
3321 3326
3322 3327 2005-01-27 Fernando Perez <fperez@colorado.edu>
3323 3328
3324 3329 * IPython/numutils.py (norm): Added 'inf' as optional name for
3325 3330 L-infinity norm, included references to mathworld.com for vector
3326 3331 norm definitions.
3327 3332 (amin/amax): added amin/amax for array min/max. Similar to what
3328 3333 pylab ships with after the recent reorganization of names.
3329 3334 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3330 3335
3331 3336 * ipython.el: committed Alex's recent fixes and improvements.
3332 3337 Tested with python-mode from CVS, and it looks excellent. Since
3333 3338 python-mode hasn't released anything in a while, I'm temporarily
3334 3339 putting a copy of today's CVS (v 4.70) of python-mode in:
3335 3340 http://ipython.scipy.org/tmp/python-mode.el
3336 3341
3337 3342 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3338 3343 sys.executable for the executable name, instead of assuming it's
3339 3344 called 'python.exe' (the post-installer would have produced broken
3340 3345 setups on systems with a differently named python binary).
3341 3346
3342 3347 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3343 3348 references to os.linesep, to make the code more
3344 3349 platform-independent. This is also part of the win32 coloring
3345 3350 fixes.
3346 3351
3347 3352 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3348 3353 lines, which actually cause coloring bugs because the length of
3349 3354 the line is very difficult to correctly compute with embedded
3350 3355 escapes. This was the source of all the coloring problems under
3351 3356 Win32. I think that _finally_, Win32 users have a properly
3352 3357 working ipython in all respects. This would never have happened
3353 3358 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3354 3359
3355 3360 2005-01-26 *** Released version 0.6.9
3356 3361
3357 3362 2005-01-25 Fernando Perez <fperez@colorado.edu>
3358 3363
3359 3364 * setup.py: finally, we have a true Windows installer, thanks to
3360 3365 the excellent work of Viktor Ransmayr
3361 3366 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3362 3367 Windows users. The setup routine is quite a bit cleaner thanks to
3363 3368 this, and the post-install script uses the proper functions to
3364 3369 allow a clean de-installation using the standard Windows Control
3365 3370 Panel.
3366 3371
3367 3372 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3368 3373 environment variable under all OSes (including win32) if
3369 3374 available. This will give consistency to win32 users who have set
3370 3375 this variable for any reason. If os.environ['HOME'] fails, the
3371 3376 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3372 3377
3373 3378 2005-01-24 Fernando Perez <fperez@colorado.edu>
3374 3379
3375 3380 * IPython/numutils.py (empty_like): add empty_like(), similar to
3376 3381 zeros_like() but taking advantage of the new empty() Numeric routine.
3377 3382
3378 3383 2005-01-23 *** Released version 0.6.8
3379 3384
3380 3385 2005-01-22 Fernando Perez <fperez@colorado.edu>
3381 3386
3382 3387 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3383 3388 automatic show() calls. After discussing things with JDH, it
3384 3389 turns out there are too many corner cases where this can go wrong.
3385 3390 It's best not to try to be 'too smart', and simply have ipython
3386 3391 reproduce as much as possible the default behavior of a normal
3387 3392 python shell.
3388 3393
3389 3394 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3390 3395 line-splitting regexp and _prefilter() to avoid calling getattr()
3391 3396 on assignments. This closes
3392 3397 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3393 3398 readline uses getattr(), so a simple <TAB> keypress is still
3394 3399 enough to trigger getattr() calls on an object.
3395 3400
3396 3401 2005-01-21 Fernando Perez <fperez@colorado.edu>
3397 3402
3398 3403 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3399 3404 docstring under pylab so it doesn't mask the original.
3400 3405
3401 3406 2005-01-21 *** Released version 0.6.7
3402 3407
3403 3408 2005-01-21 Fernando Perez <fperez@colorado.edu>
3404 3409
3405 3410 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3406 3411 signal handling for win32 users in multithreaded mode.
3407 3412
3408 3413 2005-01-17 Fernando Perez <fperez@colorado.edu>
3409 3414
3410 3415 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3411 3416 instances with no __init__. After a crash report by Norbert Nemec
3412 3417 <Norbert-AT-nemec-online.de>.
3413 3418
3414 3419 2005-01-14 Fernando Perez <fperez@colorado.edu>
3415 3420
3416 3421 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3417 3422 names for verbose exceptions, when multiple dotted names and the
3418 3423 'parent' object were present on the same line.
3419 3424
3420 3425 2005-01-11 Fernando Perez <fperez@colorado.edu>
3421 3426
3422 3427 * IPython/genutils.py (flag_calls): new utility to trap and flag
3423 3428 calls in functions. I need it to clean up matplotlib support.
3424 3429 Also removed some deprecated code in genutils.
3425 3430
3426 3431 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3427 3432 that matplotlib scripts called with %run, which don't call show()
3428 3433 themselves, still have their plotting windows open.
3429 3434
3430 3435 2005-01-05 Fernando Perez <fperez@colorado.edu>
3431 3436
3432 3437 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3433 3438 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3434 3439
3435 3440 2004-12-19 Fernando Perez <fperez@colorado.edu>
3436 3441
3437 3442 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3438 3443 parent_runcode, which was an eyesore. The same result can be
3439 3444 obtained with Python's regular superclass mechanisms.
3440 3445
3441 3446 2004-12-17 Fernando Perez <fperez@colorado.edu>
3442 3447
3443 3448 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3444 3449 reported by Prabhu.
3445 3450 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3446 3451 sys.stderr) instead of explicitly calling sys.stderr. This helps
3447 3452 maintain our I/O abstractions clean, for future GUI embeddings.
3448 3453
3449 3454 * IPython/genutils.py (info): added new utility for sys.stderr
3450 3455 unified info message handling (thin wrapper around warn()).
3451 3456
3452 3457 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3453 3458 composite (dotted) names on verbose exceptions.
3454 3459 (VerboseTB.nullrepr): harden against another kind of errors which
3455 3460 Python's inspect module can trigger, and which were crashing
3456 3461 IPython. Thanks to a report by Marco Lombardi
3457 3462 <mlombard-AT-ma010192.hq.eso.org>.
3458 3463
3459 3464 2004-12-13 *** Released version 0.6.6
3460 3465
3461 3466 2004-12-12 Fernando Perez <fperez@colorado.edu>
3462 3467
3463 3468 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3464 3469 generated by pygtk upon initialization if it was built without
3465 3470 threads (for matplotlib users). After a crash reported by
3466 3471 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3467 3472
3468 3473 * IPython/ipmaker.py (make_IPython): fix small bug in the
3469 3474 import_some parameter for multiple imports.
3470 3475
3471 3476 * IPython/iplib.py (ipmagic): simplified the interface of
3472 3477 ipmagic() to take a single string argument, just as it would be
3473 3478 typed at the IPython cmd line.
3474 3479 (ipalias): Added new ipalias() with an interface identical to
3475 3480 ipmagic(). This completes exposing a pure python interface to the
3476 3481 alias and magic system, which can be used in loops or more complex
3477 3482 code where IPython's automatic line mangling is not active.
3478 3483
3479 3484 * IPython/genutils.py (timing): changed interface of timing to
3480 3485 simply run code once, which is the most common case. timings()
3481 3486 remains unchanged, for the cases where you want multiple runs.
3482 3487
3483 3488 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3484 3489 bug where Python2.2 crashes with exec'ing code which does not end
3485 3490 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3486 3491 before.
3487 3492
3488 3493 2004-12-10 Fernando Perez <fperez@colorado.edu>
3489 3494
3490 3495 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3491 3496 -t to -T, to accomodate the new -t flag in %run (the %run and
3492 3497 %prun options are kind of intermixed, and it's not easy to change
3493 3498 this with the limitations of python's getopt).
3494 3499
3495 3500 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3496 3501 the execution of scripts. It's not as fine-tuned as timeit.py,
3497 3502 but it works from inside ipython (and under 2.2, which lacks
3498 3503 timeit.py). Optionally a number of runs > 1 can be given for
3499 3504 timing very short-running code.
3500 3505
3501 3506 * IPython/genutils.py (uniq_stable): new routine which returns a
3502 3507 list of unique elements in any iterable, but in stable order of
3503 3508 appearance. I needed this for the ultraTB fixes, and it's a handy
3504 3509 utility.
3505 3510
3506 3511 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3507 3512 dotted names in Verbose exceptions. This had been broken since
3508 3513 the very start, now x.y will properly be printed in a Verbose
3509 3514 traceback, instead of x being shown and y appearing always as an
3510 3515 'undefined global'. Getting this to work was a bit tricky,
3511 3516 because by default python tokenizers are stateless. Saved by
3512 3517 python's ability to easily add a bit of state to an arbitrary
3513 3518 function (without needing to build a full-blown callable object).
3514 3519
3515 3520 Also big cleanup of this code, which had horrendous runtime
3516 3521 lookups of zillions of attributes for colorization. Moved all
3517 3522 this code into a few templates, which make it cleaner and quicker.
3518 3523
3519 3524 Printout quality was also improved for Verbose exceptions: one
3520 3525 variable per line, and memory addresses are printed (this can be
3521 3526 quite handy in nasty debugging situations, which is what Verbose
3522 3527 is for).
3523 3528
3524 3529 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3525 3530 the command line as scripts to be loaded by embedded instances.
3526 3531 Doing so has the potential for an infinite recursion if there are
3527 3532 exceptions thrown in the process. This fixes a strange crash
3528 3533 reported by Philippe MULLER <muller-AT-irit.fr>.
3529 3534
3530 3535 2004-12-09 Fernando Perez <fperez@colorado.edu>
3531 3536
3532 3537 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3533 3538 to reflect new names in matplotlib, which now expose the
3534 3539 matlab-compatible interface via a pylab module instead of the
3535 3540 'matlab' name. The new code is backwards compatible, so users of
3536 3541 all matplotlib versions are OK. Patch by J. Hunter.
3537 3542
3538 3543 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3539 3544 of __init__ docstrings for instances (class docstrings are already
3540 3545 automatically printed). Instances with customized docstrings
3541 3546 (indep. of the class) are also recognized and all 3 separate
3542 3547 docstrings are printed (instance, class, constructor). After some
3543 3548 comments/suggestions by J. Hunter.
3544 3549
3545 3550 2004-12-05 Fernando Perez <fperez@colorado.edu>
3546 3551
3547 3552 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3548 3553 warnings when tab-completion fails and triggers an exception.
3549 3554
3550 3555 2004-12-03 Fernando Perez <fperez@colorado.edu>
3551 3556
3552 3557 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3553 3558 be triggered when using 'run -p'. An incorrect option flag was
3554 3559 being set ('d' instead of 'D').
3555 3560 (manpage): fix missing escaped \- sign.
3556 3561
3557 3562 2004-11-30 *** Released version 0.6.5
3558 3563
3559 3564 2004-11-30 Fernando Perez <fperez@colorado.edu>
3560 3565
3561 3566 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3562 3567 setting with -d option.
3563 3568
3564 3569 * setup.py (docfiles): Fix problem where the doc glob I was using
3565 3570 was COMPLETELY BROKEN. It was giving the right files by pure
3566 3571 accident, but failed once I tried to include ipython.el. Note:
3567 3572 glob() does NOT allow you to do exclusion on multiple endings!
3568 3573
3569 3574 2004-11-29 Fernando Perez <fperez@colorado.edu>
3570 3575
3571 3576 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3572 3577 the manpage as the source. Better formatting & consistency.
3573 3578
3574 3579 * IPython/Magic.py (magic_run): Added new -d option, to run
3575 3580 scripts under the control of the python pdb debugger. Note that
3576 3581 this required changing the %prun option -d to -D, to avoid a clash
3577 3582 (since %run must pass options to %prun, and getopt is too dumb to
3578 3583 handle options with string values with embedded spaces). Thanks
3579 3584 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3580 3585 (magic_who_ls): added type matching to %who and %whos, so that one
3581 3586 can filter their output to only include variables of certain
3582 3587 types. Another suggestion by Matthew.
3583 3588 (magic_whos): Added memory summaries in kb and Mb for arrays.
3584 3589 (magic_who): Improve formatting (break lines every 9 vars).
3585 3590
3586 3591 2004-11-28 Fernando Perez <fperez@colorado.edu>
3587 3592
3588 3593 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3589 3594 cache when empty lines were present.
3590 3595
3591 3596 2004-11-24 Fernando Perez <fperez@colorado.edu>
3592 3597
3593 3598 * IPython/usage.py (__doc__): document the re-activated threading
3594 3599 options for WX and GTK.
3595 3600
3596 3601 2004-11-23 Fernando Perez <fperez@colorado.edu>
3597 3602
3598 3603 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3599 3604 the -wthread and -gthread options, along with a new -tk one to try
3600 3605 and coordinate Tk threading with wx/gtk. The tk support is very
3601 3606 platform dependent, since it seems to require Tcl and Tk to be
3602 3607 built with threads (Fedora1/2 appears NOT to have it, but in
3603 3608 Prabhu's Debian boxes it works OK). But even with some Tk
3604 3609 limitations, this is a great improvement.
3605 3610
3606 3611 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3607 3612 info in user prompts. Patch by Prabhu.
3608 3613
3609 3614 2004-11-18 Fernando Perez <fperez@colorado.edu>
3610 3615
3611 3616 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3612 3617 EOFErrors and bail, to avoid infinite loops if a non-terminating
3613 3618 file is fed into ipython. Patch submitted in issue 19 by user,
3614 3619 many thanks.
3615 3620
3616 3621 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3617 3622 autoquote/parens in continuation prompts, which can cause lots of
3618 3623 problems. Closes roundup issue 20.
3619 3624
3620 3625 2004-11-17 Fernando Perez <fperez@colorado.edu>
3621 3626
3622 3627 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3623 3628 reported as debian bug #280505. I'm not sure my local changelog
3624 3629 entry has the proper debian format (Jack?).
3625 3630
3626 3631 2004-11-08 *** Released version 0.6.4
3627 3632
3628 3633 2004-11-08 Fernando Perez <fperez@colorado.edu>
3629 3634
3630 3635 * IPython/iplib.py (init_readline): Fix exit message for Windows
3631 3636 when readline is active. Thanks to a report by Eric Jones
3632 3637 <eric-AT-enthought.com>.
3633 3638
3634 3639 2004-11-07 Fernando Perez <fperez@colorado.edu>
3635 3640
3636 3641 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3637 3642 sometimes seen by win2k/cygwin users.
3638 3643
3639 3644 2004-11-06 Fernando Perez <fperez@colorado.edu>
3640 3645
3641 3646 * IPython/iplib.py (interact): Change the handling of %Exit from
3642 3647 trying to propagate a SystemExit to an internal ipython flag.
3643 3648 This is less elegant than using Python's exception mechanism, but
3644 3649 I can't get that to work reliably with threads, so under -pylab
3645 3650 %Exit was hanging IPython. Cross-thread exception handling is
3646 3651 really a bitch. Thaks to a bug report by Stephen Walton
3647 3652 <stephen.walton-AT-csun.edu>.
3648 3653
3649 3654 2004-11-04 Fernando Perez <fperez@colorado.edu>
3650 3655
3651 3656 * IPython/iplib.py (raw_input_original): store a pointer to the
3652 3657 true raw_input to harden against code which can modify it
3653 3658 (wx.py.PyShell does this and would otherwise crash ipython).
3654 3659 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3655 3660
3656 3661 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3657 3662 Ctrl-C problem, which does not mess up the input line.
3658 3663
3659 3664 2004-11-03 Fernando Perez <fperez@colorado.edu>
3660 3665
3661 3666 * IPython/Release.py: Changed licensing to BSD, in all files.
3662 3667 (name): lowercase name for tarball/RPM release.
3663 3668
3664 3669 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3665 3670 use throughout ipython.
3666 3671
3667 3672 * IPython/Magic.py (Magic._ofind): Switch to using the new
3668 3673 OInspect.getdoc() function.
3669 3674
3670 3675 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3671 3676 of the line currently being canceled via Ctrl-C. It's extremely
3672 3677 ugly, but I don't know how to do it better (the problem is one of
3673 3678 handling cross-thread exceptions).
3674 3679
3675 3680 2004-10-28 Fernando Perez <fperez@colorado.edu>
3676 3681
3677 3682 * IPython/Shell.py (signal_handler): add signal handlers to trap
3678 3683 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3679 3684 report by Francesc Alted.
3680 3685
3681 3686 2004-10-21 Fernando Perez <fperez@colorado.edu>
3682 3687
3683 3688 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3684 3689 to % for pysh syntax extensions.
3685 3690
3686 3691 2004-10-09 Fernando Perez <fperez@colorado.edu>
3687 3692
3688 3693 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3689 3694 arrays to print a more useful summary, without calling str(arr).
3690 3695 This avoids the problem of extremely lengthy computations which
3691 3696 occur if arr is large, and appear to the user as a system lockup
3692 3697 with 100% cpu activity. After a suggestion by Kristian Sandberg
3693 3698 <Kristian.Sandberg@colorado.edu>.
3694 3699 (Magic.__init__): fix bug in global magic escapes not being
3695 3700 correctly set.
3696 3701
3697 3702 2004-10-08 Fernando Perez <fperez@colorado.edu>
3698 3703
3699 3704 * IPython/Magic.py (__license__): change to absolute imports of
3700 3705 ipython's own internal packages, to start adapting to the absolute
3701 3706 import requirement of PEP-328.
3702 3707
3703 3708 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3704 3709 files, and standardize author/license marks through the Release
3705 3710 module instead of having per/file stuff (except for files with
3706 3711 particular licenses, like the MIT/PSF-licensed codes).
3707 3712
3708 3713 * IPython/Debugger.py: remove dead code for python 2.1
3709 3714
3710 3715 2004-10-04 Fernando Perez <fperez@colorado.edu>
3711 3716
3712 3717 * IPython/iplib.py (ipmagic): New function for accessing magics
3713 3718 via a normal python function call.
3714 3719
3715 3720 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3716 3721 from '@' to '%', to accomodate the new @decorator syntax of python
3717 3722 2.4.
3718 3723
3719 3724 2004-09-29 Fernando Perez <fperez@colorado.edu>
3720 3725
3721 3726 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3722 3727 matplotlib.use to prevent running scripts which try to switch
3723 3728 interactive backends from within ipython. This will just crash
3724 3729 the python interpreter, so we can't allow it (but a detailed error
3725 3730 is given to the user).
3726 3731
3727 3732 2004-09-28 Fernando Perez <fperez@colorado.edu>
3728 3733
3729 3734 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3730 3735 matplotlib-related fixes so that using @run with non-matplotlib
3731 3736 scripts doesn't pop up spurious plot windows. This requires
3732 3737 matplotlib >= 0.63, where I had to make some changes as well.
3733 3738
3734 3739 * IPython/ipmaker.py (make_IPython): update version requirement to
3735 3740 python 2.2.
3736 3741
3737 3742 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3738 3743 banner arg for embedded customization.
3739 3744
3740 3745 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3741 3746 explicit uses of __IP as the IPython's instance name. Now things
3742 3747 are properly handled via the shell.name value. The actual code
3743 3748 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3744 3749 is much better than before. I'll clean things completely when the
3745 3750 magic stuff gets a real overhaul.
3746 3751
3747 3752 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3748 3753 minor changes to debian dir.
3749 3754
3750 3755 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3751 3756 pointer to the shell itself in the interactive namespace even when
3752 3757 a user-supplied dict is provided. This is needed for embedding
3753 3758 purposes (found by tests with Michel Sanner).
3754 3759
3755 3760 2004-09-27 Fernando Perez <fperez@colorado.edu>
3756 3761
3757 3762 * IPython/UserConfig/ipythonrc: remove []{} from
3758 3763 readline_remove_delims, so that things like [modname.<TAB> do
3759 3764 proper completion. This disables [].TAB, but that's a less common
3760 3765 case than module names in list comprehensions, for example.
3761 3766 Thanks to a report by Andrea Riciputi.
3762 3767
3763 3768 2004-09-09 Fernando Perez <fperez@colorado.edu>
3764 3769
3765 3770 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3766 3771 blocking problems in win32 and osx. Fix by John.
3767 3772
3768 3773 2004-09-08 Fernando Perez <fperez@colorado.edu>
3769 3774
3770 3775 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3771 3776 for Win32 and OSX. Fix by John Hunter.
3772 3777
3773 3778 2004-08-30 *** Released version 0.6.3
3774 3779
3775 3780 2004-08-30 Fernando Perez <fperez@colorado.edu>
3776 3781
3777 3782 * setup.py (isfile): Add manpages to list of dependent files to be
3778 3783 updated.
3779 3784
3780 3785 2004-08-27 Fernando Perez <fperez@colorado.edu>
3781 3786
3782 3787 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3783 3788 for now. They don't really work with standalone WX/GTK code
3784 3789 (though matplotlib IS working fine with both of those backends).
3785 3790 This will neeed much more testing. I disabled most things with
3786 3791 comments, so turning it back on later should be pretty easy.
3787 3792
3788 3793 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3789 3794 autocalling of expressions like r'foo', by modifying the line
3790 3795 split regexp. Closes
3791 3796 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3792 3797 Riley <ipythonbugs-AT-sabi.net>.
3793 3798 (InteractiveShell.mainloop): honor --nobanner with banner
3794 3799 extensions.
3795 3800
3796 3801 * IPython/Shell.py: Significant refactoring of all classes, so
3797 3802 that we can really support ALL matplotlib backends and threading
3798 3803 models (John spotted a bug with Tk which required this). Now we
3799 3804 should support single-threaded, WX-threads and GTK-threads, both
3800 3805 for generic code and for matplotlib.
3801 3806
3802 3807 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3803 3808 -pylab, to simplify things for users. Will also remove the pylab
3804 3809 profile, since now all of matplotlib configuration is directly
3805 3810 handled here. This also reduces startup time.
3806 3811
3807 3812 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3808 3813 shell wasn't being correctly called. Also in IPShellWX.
3809 3814
3810 3815 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3811 3816 fine-tune banner.
3812 3817
3813 3818 * IPython/numutils.py (spike): Deprecate these spike functions,
3814 3819 delete (long deprecated) gnuplot_exec handler.
3815 3820
3816 3821 2004-08-26 Fernando Perez <fperez@colorado.edu>
3817 3822
3818 3823 * ipython.1: Update for threading options, plus some others which
3819 3824 were missing.
3820 3825
3821 3826 * IPython/ipmaker.py (__call__): Added -wthread option for
3822 3827 wxpython thread handling. Make sure threading options are only
3823 3828 valid at the command line.
3824 3829
3825 3830 * scripts/ipython: moved shell selection into a factory function
3826 3831 in Shell.py, to keep the starter script to a minimum.
3827 3832
3828 3833 2004-08-25 Fernando Perez <fperez@colorado.edu>
3829 3834
3830 3835 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3831 3836 John. Along with some recent changes he made to matplotlib, the
3832 3837 next versions of both systems should work very well together.
3833 3838
3834 3839 2004-08-24 Fernando Perez <fperez@colorado.edu>
3835 3840
3836 3841 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3837 3842 tried to switch the profiling to using hotshot, but I'm getting
3838 3843 strange errors from prof.runctx() there. I may be misreading the
3839 3844 docs, but it looks weird. For now the profiling code will
3840 3845 continue to use the standard profiler.
3841 3846
3842 3847 2004-08-23 Fernando Perez <fperez@colorado.edu>
3843 3848
3844 3849 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3845 3850 threaded shell, by John Hunter. It's not quite ready yet, but
3846 3851 close.
3847 3852
3848 3853 2004-08-22 Fernando Perez <fperez@colorado.edu>
3849 3854
3850 3855 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3851 3856 in Magic and ultraTB.
3852 3857
3853 3858 * ipython.1: document threading options in manpage.
3854 3859
3855 3860 * scripts/ipython: Changed name of -thread option to -gthread,
3856 3861 since this is GTK specific. I want to leave the door open for a
3857 3862 -wthread option for WX, which will most likely be necessary. This
3858 3863 change affects usage and ipmaker as well.
3859 3864
3860 3865 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3861 3866 handle the matplotlib shell issues. Code by John Hunter
3862 3867 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3863 3868 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3864 3869 broken (and disabled for end users) for now, but it puts the
3865 3870 infrastructure in place.
3866 3871
3867 3872 2004-08-21 Fernando Perez <fperez@colorado.edu>
3868 3873
3869 3874 * ipythonrc-pylab: Add matplotlib support.
3870 3875
3871 3876 * matplotlib_config.py: new files for matplotlib support, part of
3872 3877 the pylab profile.
3873 3878
3874 3879 * IPython/usage.py (__doc__): documented the threading options.
3875 3880
3876 3881 2004-08-20 Fernando Perez <fperez@colorado.edu>
3877 3882
3878 3883 * ipython: Modified the main calling routine to handle the -thread
3879 3884 and -mpthread options. This needs to be done as a top-level hack,
3880 3885 because it determines which class to instantiate for IPython
3881 3886 itself.
3882 3887
3883 3888 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3884 3889 classes to support multithreaded GTK operation without blocking,
3885 3890 and matplotlib with all backends. This is a lot of still very
3886 3891 experimental code, and threads are tricky. So it may still have a
3887 3892 few rough edges... This code owes a lot to
3888 3893 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3889 3894 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3890 3895 to John Hunter for all the matplotlib work.
3891 3896
3892 3897 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3893 3898 options for gtk thread and matplotlib support.
3894 3899
3895 3900 2004-08-16 Fernando Perez <fperez@colorado.edu>
3896 3901
3897 3902 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3898 3903 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3899 3904 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3900 3905
3901 3906 2004-08-11 Fernando Perez <fperez@colorado.edu>
3902 3907
3903 3908 * setup.py (isfile): Fix build so documentation gets updated for
3904 3909 rpms (it was only done for .tgz builds).
3905 3910
3906 3911 2004-08-10 Fernando Perez <fperez@colorado.edu>
3907 3912
3908 3913 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3909 3914
3910 3915 * iplib.py : Silence syntax error exceptions in tab-completion.
3911 3916
3912 3917 2004-08-05 Fernando Perez <fperez@colorado.edu>
3913 3918
3914 3919 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3915 3920 'color off' mark for continuation prompts. This was causing long
3916 3921 continuation lines to mis-wrap.
3917 3922
3918 3923 2004-08-01 Fernando Perez <fperez@colorado.edu>
3919 3924
3920 3925 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3921 3926 for building ipython to be a parameter. All this is necessary
3922 3927 right now to have a multithreaded version, but this insane
3923 3928 non-design will be cleaned up soon. For now, it's a hack that
3924 3929 works.
3925 3930
3926 3931 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3927 3932 args in various places. No bugs so far, but it's a dangerous
3928 3933 practice.
3929 3934
3930 3935 2004-07-31 Fernando Perez <fperez@colorado.edu>
3931 3936
3932 3937 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3933 3938 fix completion of files with dots in their names under most
3934 3939 profiles (pysh was OK because the completion order is different).
3935 3940
3936 3941 2004-07-27 Fernando Perez <fperez@colorado.edu>
3937 3942
3938 3943 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3939 3944 keywords manually, b/c the one in keyword.py was removed in python
3940 3945 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3941 3946 This is NOT a bug under python 2.3 and earlier.
3942 3947
3943 3948 2004-07-26 Fernando Perez <fperez@colorado.edu>
3944 3949
3945 3950 * IPython/ultraTB.py (VerboseTB.text): Add another
3946 3951 linecache.checkcache() call to try to prevent inspect.py from
3947 3952 crashing under python 2.3. I think this fixes
3948 3953 http://www.scipy.net/roundup/ipython/issue17.
3949 3954
3950 3955 2004-07-26 *** Released version 0.6.2
3951 3956
3952 3957 2004-07-26 Fernando Perez <fperez@colorado.edu>
3953 3958
3954 3959 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3955 3960 fail for any number.
3956 3961 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3957 3962 empty bookmarks.
3958 3963
3959 3964 2004-07-26 *** Released version 0.6.1
3960 3965
3961 3966 2004-07-26 Fernando Perez <fperez@colorado.edu>
3962 3967
3963 3968 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3964 3969
3965 3970 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3966 3971 escaping '()[]{}' in filenames.
3967 3972
3968 3973 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3969 3974 Python 2.2 users who lack a proper shlex.split.
3970 3975
3971 3976 2004-07-19 Fernando Perez <fperez@colorado.edu>
3972 3977
3973 3978 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3974 3979 for reading readline's init file. I follow the normal chain:
3975 3980 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3976 3981 report by Mike Heeter. This closes
3977 3982 http://www.scipy.net/roundup/ipython/issue16.
3978 3983
3979 3984 2004-07-18 Fernando Perez <fperez@colorado.edu>
3980 3985
3981 3986 * IPython/iplib.py (__init__): Add better handling of '\' under
3982 3987 Win32 for filenames. After a patch by Ville.
3983 3988
3984 3989 2004-07-17 Fernando Perez <fperez@colorado.edu>
3985 3990
3986 3991 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3987 3992 autocalling would be triggered for 'foo is bar' if foo is
3988 3993 callable. I also cleaned up the autocall detection code to use a
3989 3994 regexp, which is faster. Bug reported by Alexander Schmolck.
3990 3995
3991 3996 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3992 3997 '?' in them would confuse the help system. Reported by Alex
3993 3998 Schmolck.
3994 3999
3995 4000 2004-07-16 Fernando Perez <fperez@colorado.edu>
3996 4001
3997 4002 * IPython/GnuplotInteractive.py (__all__): added plot2.
3998 4003
3999 4004 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4000 4005 plotting dictionaries, lists or tuples of 1d arrays.
4001 4006
4002 4007 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4003 4008 optimizations.
4004 4009
4005 4010 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4006 4011 the information which was there from Janko's original IPP code:
4007 4012
4008 4013 03.05.99 20:53 porto.ifm.uni-kiel.de
4009 4014 --Started changelog.
4010 4015 --make clear do what it say it does
4011 4016 --added pretty output of lines from inputcache
4012 4017 --Made Logger a mixin class, simplifies handling of switches
4013 4018 --Added own completer class. .string<TAB> expands to last history
4014 4019 line which starts with string. The new expansion is also present
4015 4020 with Ctrl-r from the readline library. But this shows, who this
4016 4021 can be done for other cases.
4017 4022 --Added convention that all shell functions should accept a
4018 4023 parameter_string This opens the door for different behaviour for
4019 4024 each function. @cd is a good example of this.
4020 4025
4021 4026 04.05.99 12:12 porto.ifm.uni-kiel.de
4022 4027 --added logfile rotation
4023 4028 --added new mainloop method which freezes first the namespace
4024 4029
4025 4030 07.05.99 21:24 porto.ifm.uni-kiel.de
4026 4031 --added the docreader classes. Now there is a help system.
4027 4032 -This is only a first try. Currently it's not easy to put new
4028 4033 stuff in the indices. But this is the way to go. Info would be
4029 4034 better, but HTML is every where and not everybody has an info
4030 4035 system installed and it's not so easy to change html-docs to info.
4031 4036 --added global logfile option
4032 4037 --there is now a hook for object inspection method pinfo needs to
4033 4038 be provided for this. Can be reached by two '??'.
4034 4039
4035 4040 08.05.99 20:51 porto.ifm.uni-kiel.de
4036 4041 --added a README
4037 4042 --bug in rc file. Something has changed so functions in the rc
4038 4043 file need to reference the shell and not self. Not clear if it's a
4039 4044 bug or feature.
4040 4045 --changed rc file for new behavior
4041 4046
4042 4047 2004-07-15 Fernando Perez <fperez@colorado.edu>
4043 4048
4044 4049 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4045 4050 cache was falling out of sync in bizarre manners when multi-line
4046 4051 input was present. Minor optimizations and cleanup.
4047 4052
4048 4053 (Logger): Remove old Changelog info for cleanup. This is the
4049 4054 information which was there from Janko's original code:
4050 4055
4051 4056 Changes to Logger: - made the default log filename a parameter
4052 4057
4053 4058 - put a check for lines beginning with !@? in log(). Needed
4054 4059 (even if the handlers properly log their lines) for mid-session
4055 4060 logging activation to work properly. Without this, lines logged
4056 4061 in mid session, which get read from the cache, would end up
4057 4062 'bare' (with !@? in the open) in the log. Now they are caught
4058 4063 and prepended with a #.
4059 4064
4060 4065 * IPython/iplib.py (InteractiveShell.init_readline): added check
4061 4066 in case MagicCompleter fails to be defined, so we don't crash.
4062 4067
4063 4068 2004-07-13 Fernando Perez <fperez@colorado.edu>
4064 4069
4065 4070 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4066 4071 of EPS if the requested filename ends in '.eps'.
4067 4072
4068 4073 2004-07-04 Fernando Perez <fperez@colorado.edu>
4069 4074
4070 4075 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4071 4076 escaping of quotes when calling the shell.
4072 4077
4073 4078 2004-07-02 Fernando Perez <fperez@colorado.edu>
4074 4079
4075 4080 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4076 4081 gettext not working because we were clobbering '_'. Fixes
4077 4082 http://www.scipy.net/roundup/ipython/issue6.
4078 4083
4079 4084 2004-07-01 Fernando Perez <fperez@colorado.edu>
4080 4085
4081 4086 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4082 4087 into @cd. Patch by Ville.
4083 4088
4084 4089 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4085 4090 new function to store things after ipmaker runs. Patch by Ville.
4086 4091 Eventually this will go away once ipmaker is removed and the class
4087 4092 gets cleaned up, but for now it's ok. Key functionality here is
4088 4093 the addition of the persistent storage mechanism, a dict for
4089 4094 keeping data across sessions (for now just bookmarks, but more can
4090 4095 be implemented later).
4091 4096
4092 4097 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4093 4098 persistent across sections. Patch by Ville, I modified it
4094 4099 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4095 4100 added a '-l' option to list all bookmarks.
4096 4101
4097 4102 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4098 4103 center for cleanup. Registered with atexit.register(). I moved
4099 4104 here the old exit_cleanup(). After a patch by Ville.
4100 4105
4101 4106 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4102 4107 characters in the hacked shlex_split for python 2.2.
4103 4108
4104 4109 * IPython/iplib.py (file_matches): more fixes to filenames with
4105 4110 whitespace in them. It's not perfect, but limitations in python's
4106 4111 readline make it impossible to go further.
4107 4112
4108 4113 2004-06-29 Fernando Perez <fperez@colorado.edu>
4109 4114
4110 4115 * IPython/iplib.py (file_matches): escape whitespace correctly in
4111 4116 filename completions. Bug reported by Ville.
4112 4117
4113 4118 2004-06-28 Fernando Perez <fperez@colorado.edu>
4114 4119
4115 4120 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4116 4121 the history file will be called 'history-PROFNAME' (or just
4117 4122 'history' if no profile is loaded). I was getting annoyed at
4118 4123 getting my Numerical work history clobbered by pysh sessions.
4119 4124
4120 4125 * IPython/iplib.py (InteractiveShell.__init__): Internal
4121 4126 getoutputerror() function so that we can honor the system_verbose
4122 4127 flag for _all_ system calls. I also added escaping of #
4123 4128 characters here to avoid confusing Itpl.
4124 4129
4125 4130 * IPython/Magic.py (shlex_split): removed call to shell in
4126 4131 parse_options and replaced it with shlex.split(). The annoying
4127 4132 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4128 4133 to backport it from 2.3, with several frail hacks (the shlex
4129 4134 module is rather limited in 2.2). Thanks to a suggestion by Ville
4130 4135 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4131 4136 problem.
4132 4137
4133 4138 (Magic.magic_system_verbose): new toggle to print the actual
4134 4139 system calls made by ipython. Mainly for debugging purposes.
4135 4140
4136 4141 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4137 4142 doesn't support persistence. Reported (and fix suggested) by
4138 4143 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4139 4144
4140 4145 2004-06-26 Fernando Perez <fperez@colorado.edu>
4141 4146
4142 4147 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4143 4148 continue prompts.
4144 4149
4145 4150 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4146 4151 function (basically a big docstring) and a few more things here to
4147 4152 speedup startup. pysh.py is now very lightweight. We want because
4148 4153 it gets execfile'd, while InterpreterExec gets imported, so
4149 4154 byte-compilation saves time.
4150 4155
4151 4156 2004-06-25 Fernando Perez <fperez@colorado.edu>
4152 4157
4153 4158 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4154 4159 -NUM', which was recently broken.
4155 4160
4156 4161 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4157 4162 in multi-line input (but not !!, which doesn't make sense there).
4158 4163
4159 4164 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4160 4165 It's just too useful, and people can turn it off in the less
4161 4166 common cases where it's a problem.
4162 4167
4163 4168 2004-06-24 Fernando Perez <fperez@colorado.edu>
4164 4169
4165 4170 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4166 4171 special syntaxes (like alias calling) is now allied in multi-line
4167 4172 input. This is still _very_ experimental, but it's necessary for
4168 4173 efficient shell usage combining python looping syntax with system
4169 4174 calls. For now it's restricted to aliases, I don't think it
4170 4175 really even makes sense to have this for magics.
4171 4176
4172 4177 2004-06-23 Fernando Perez <fperez@colorado.edu>
4173 4178
4174 4179 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4175 4180 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4176 4181
4177 4182 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4178 4183 extensions under Windows (after code sent by Gary Bishop). The
4179 4184 extensions considered 'executable' are stored in IPython's rc
4180 4185 structure as win_exec_ext.
4181 4186
4182 4187 * IPython/genutils.py (shell): new function, like system() but
4183 4188 without return value. Very useful for interactive shell work.
4184 4189
4185 4190 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4186 4191 delete aliases.
4187 4192
4188 4193 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4189 4194 sure that the alias table doesn't contain python keywords.
4190 4195
4191 4196 2004-06-21 Fernando Perez <fperez@colorado.edu>
4192 4197
4193 4198 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4194 4199 non-existent items are found in $PATH. Reported by Thorsten.
4195 4200
4196 4201 2004-06-20 Fernando Perez <fperez@colorado.edu>
4197 4202
4198 4203 * IPython/iplib.py (complete): modified the completer so that the
4199 4204 order of priorities can be easily changed at runtime.
4200 4205
4201 4206 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4202 4207 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4203 4208
4204 4209 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4205 4210 expand Python variables prepended with $ in all system calls. The
4206 4211 same was done to InteractiveShell.handle_shell_escape. Now all
4207 4212 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4208 4213 expansion of python variables and expressions according to the
4209 4214 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4210 4215
4211 4216 Though PEP-215 has been rejected, a similar (but simpler) one
4212 4217 seems like it will go into Python 2.4, PEP-292 -
4213 4218 http://www.python.org/peps/pep-0292.html.
4214 4219
4215 4220 I'll keep the full syntax of PEP-215, since IPython has since the
4216 4221 start used Ka-Ping Yee's reference implementation discussed there
4217 4222 (Itpl), and I actually like the powerful semantics it offers.
4218 4223
4219 4224 In order to access normal shell variables, the $ has to be escaped
4220 4225 via an extra $. For example:
4221 4226
4222 4227 In [7]: PATH='a python variable'
4223 4228
4224 4229 In [8]: !echo $PATH
4225 4230 a python variable
4226 4231
4227 4232 In [9]: !echo $$PATH
4228 4233 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4229 4234
4230 4235 (Magic.parse_options): escape $ so the shell doesn't evaluate
4231 4236 things prematurely.
4232 4237
4233 4238 * IPython/iplib.py (InteractiveShell.call_alias): added the
4234 4239 ability for aliases to expand python variables via $.
4235 4240
4236 4241 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4237 4242 system, now there's a @rehash/@rehashx pair of magics. These work
4238 4243 like the csh rehash command, and can be invoked at any time. They
4239 4244 build a table of aliases to everything in the user's $PATH
4240 4245 (@rehash uses everything, @rehashx is slower but only adds
4241 4246 executable files). With this, the pysh.py-based shell profile can
4242 4247 now simply call rehash upon startup, and full access to all
4243 4248 programs in the user's path is obtained.
4244 4249
4245 4250 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4246 4251 functionality is now fully in place. I removed the old dynamic
4247 4252 code generation based approach, in favor of a much lighter one
4248 4253 based on a simple dict. The advantage is that this allows me to
4249 4254 now have thousands of aliases with negligible cost (unthinkable
4250 4255 with the old system).
4251 4256
4252 4257 2004-06-19 Fernando Perez <fperez@colorado.edu>
4253 4258
4254 4259 * IPython/iplib.py (__init__): extended MagicCompleter class to
4255 4260 also complete (last in priority) on user aliases.
4256 4261
4257 4262 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4258 4263 call to eval.
4259 4264 (ItplNS.__init__): Added a new class which functions like Itpl,
4260 4265 but allows configuring the namespace for the evaluation to occur
4261 4266 in.
4262 4267
4263 4268 2004-06-18 Fernando Perez <fperez@colorado.edu>
4264 4269
4265 4270 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4266 4271 better message when 'exit' or 'quit' are typed (a common newbie
4267 4272 confusion).
4268 4273
4269 4274 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4270 4275 check for Windows users.
4271 4276
4272 4277 * IPython/iplib.py (InteractiveShell.user_setup): removed
4273 4278 disabling of colors for Windows. I'll test at runtime and issue a
4274 4279 warning if Gary's readline isn't found, as to nudge users to
4275 4280 download it.
4276 4281
4277 4282 2004-06-16 Fernando Perez <fperez@colorado.edu>
4278 4283
4279 4284 * IPython/genutils.py (Stream.__init__): changed to print errors
4280 4285 to sys.stderr. I had a circular dependency here. Now it's
4281 4286 possible to run ipython as IDLE's shell (consider this pre-alpha,
4282 4287 since true stdout things end up in the starting terminal instead
4283 4288 of IDLE's out).
4284 4289
4285 4290 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4286 4291 users who haven't # updated their prompt_in2 definitions. Remove
4287 4292 eventually.
4288 4293 (multiple_replace): added credit to original ASPN recipe.
4289 4294
4290 4295 2004-06-15 Fernando Perez <fperez@colorado.edu>
4291 4296
4292 4297 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4293 4298 list of auto-defined aliases.
4294 4299
4295 4300 2004-06-13 Fernando Perez <fperez@colorado.edu>
4296 4301
4297 4302 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4298 4303 install was really requested (so setup.py can be used for other
4299 4304 things under Windows).
4300 4305
4301 4306 2004-06-10 Fernando Perez <fperez@colorado.edu>
4302 4307
4303 4308 * IPython/Logger.py (Logger.create_log): Manually remove any old
4304 4309 backup, since os.remove may fail under Windows. Fixes bug
4305 4310 reported by Thorsten.
4306 4311
4307 4312 2004-06-09 Fernando Perez <fperez@colorado.edu>
4308 4313
4309 4314 * examples/example-embed.py: fixed all references to %n (replaced
4310 4315 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4311 4316 for all examples and the manual as well.
4312 4317
4313 4318 2004-06-08 Fernando Perez <fperez@colorado.edu>
4314 4319
4315 4320 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4316 4321 alignment and color management. All 3 prompt subsystems now
4317 4322 inherit from BasePrompt.
4318 4323
4319 4324 * tools/release: updates for windows installer build and tag rpms
4320 4325 with python version (since paths are fixed).
4321 4326
4322 4327 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4323 4328 which will become eventually obsolete. Also fixed the default
4324 4329 prompt_in2 to use \D, so at least new users start with the correct
4325 4330 defaults.
4326 4331 WARNING: Users with existing ipythonrc files will need to apply
4327 4332 this fix manually!
4328 4333
4329 4334 * setup.py: make windows installer (.exe). This is finally the
4330 4335 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4331 4336 which I hadn't included because it required Python 2.3 (or recent
4332 4337 distutils).
4333 4338
4334 4339 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4335 4340 usage of new '\D' escape.
4336 4341
4337 4342 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4338 4343 lacks os.getuid())
4339 4344 (CachedOutput.set_colors): Added the ability to turn coloring
4340 4345 on/off with @colors even for manually defined prompt colors. It
4341 4346 uses a nasty global, but it works safely and via the generic color
4342 4347 handling mechanism.
4343 4348 (Prompt2.__init__): Introduced new escape '\D' for continuation
4344 4349 prompts. It represents the counter ('\#') as dots.
4345 4350 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4346 4351 need to update their ipythonrc files and replace '%n' with '\D' in
4347 4352 their prompt_in2 settings everywhere. Sorry, but there's
4348 4353 otherwise no clean way to get all prompts to properly align. The
4349 4354 ipythonrc shipped with IPython has been updated.
4350 4355
4351 4356 2004-06-07 Fernando Perez <fperez@colorado.edu>
4352 4357
4353 4358 * setup.py (isfile): Pass local_icons option to latex2html, so the
4354 4359 resulting HTML file is self-contained. Thanks to
4355 4360 dryice-AT-liu.com.cn for the tip.
4356 4361
4357 4362 * pysh.py: I created a new profile 'shell', which implements a
4358 4363 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4359 4364 system shell, nor will it become one anytime soon. It's mainly
4360 4365 meant to illustrate the use of the new flexible bash-like prompts.
4361 4366 I guess it could be used by hardy souls for true shell management,
4362 4367 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4363 4368 profile. This uses the InterpreterExec extension provided by
4364 4369 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4365 4370
4366 4371 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4367 4372 auto-align itself with the length of the previous input prompt
4368 4373 (taking into account the invisible color escapes).
4369 4374 (CachedOutput.__init__): Large restructuring of this class. Now
4370 4375 all three prompts (primary1, primary2, output) are proper objects,
4371 4376 managed by the 'parent' CachedOutput class. The code is still a
4372 4377 bit hackish (all prompts share state via a pointer to the cache),
4373 4378 but it's overall far cleaner than before.
4374 4379
4375 4380 * IPython/genutils.py (getoutputerror): modified to add verbose,
4376 4381 debug and header options. This makes the interface of all getout*
4377 4382 functions uniform.
4378 4383 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4379 4384
4380 4385 * IPython/Magic.py (Magic.default_option): added a function to
4381 4386 allow registering default options for any magic command. This
4382 4387 makes it easy to have profiles which customize the magics globally
4383 4388 for a certain use. The values set through this function are
4384 4389 picked up by the parse_options() method, which all magics should
4385 4390 use to parse their options.
4386 4391
4387 4392 * IPython/genutils.py (warn): modified the warnings framework to
4388 4393 use the Term I/O class. I'm trying to slowly unify all of
4389 4394 IPython's I/O operations to pass through Term.
4390 4395
4391 4396 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4392 4397 the secondary prompt to correctly match the length of the primary
4393 4398 one for any prompt. Now multi-line code will properly line up
4394 4399 even for path dependent prompts, such as the new ones available
4395 4400 via the prompt_specials.
4396 4401
4397 4402 2004-06-06 Fernando Perez <fperez@colorado.edu>
4398 4403
4399 4404 * IPython/Prompts.py (prompt_specials): Added the ability to have
4400 4405 bash-like special sequences in the prompts, which get
4401 4406 automatically expanded. Things like hostname, current working
4402 4407 directory and username are implemented already, but it's easy to
4403 4408 add more in the future. Thanks to a patch by W.J. van der Laan
4404 4409 <gnufnork-AT-hetdigitalegat.nl>
4405 4410 (prompt_specials): Added color support for prompt strings, so
4406 4411 users can define arbitrary color setups for their prompts.
4407 4412
4408 4413 2004-06-05 Fernando Perez <fperez@colorado.edu>
4409 4414
4410 4415 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4411 4416 code to load Gary Bishop's readline and configure it
4412 4417 automatically. Thanks to Gary for help on this.
4413 4418
4414 4419 2004-06-01 Fernando Perez <fperez@colorado.edu>
4415 4420
4416 4421 * IPython/Logger.py (Logger.create_log): fix bug for logging
4417 4422 with no filename (previous fix was incomplete).
4418 4423
4419 4424 2004-05-25 Fernando Perez <fperez@colorado.edu>
4420 4425
4421 4426 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4422 4427 parens would get passed to the shell.
4423 4428
4424 4429 2004-05-20 Fernando Perez <fperez@colorado.edu>
4425 4430
4426 4431 * IPython/Magic.py (Magic.magic_prun): changed default profile
4427 4432 sort order to 'time' (the more common profiling need).
4428 4433
4429 4434 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4430 4435 so that source code shown is guaranteed in sync with the file on
4431 4436 disk (also changed in psource). Similar fix to the one for
4432 4437 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4433 4438 <yann.ledu-AT-noos.fr>.
4434 4439
4435 4440 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4436 4441 with a single option would not be correctly parsed. Closes
4437 4442 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4438 4443 introduced in 0.6.0 (on 2004-05-06).
4439 4444
4440 4445 2004-05-13 *** Released version 0.6.0
4441 4446
4442 4447 2004-05-13 Fernando Perez <fperez@colorado.edu>
4443 4448
4444 4449 * debian/: Added debian/ directory to CVS, so that debian support
4445 4450 is publicly accessible. The debian package is maintained by Jack
4446 4451 Moffit <jack-AT-xiph.org>.
4447 4452
4448 4453 * Documentation: included the notes about an ipython-based system
4449 4454 shell (the hypothetical 'pysh') into the new_design.pdf document,
4450 4455 so that these ideas get distributed to users along with the
4451 4456 official documentation.
4452 4457
4453 4458 2004-05-10 Fernando Perez <fperez@colorado.edu>
4454 4459
4455 4460 * IPython/Logger.py (Logger.create_log): fix recently introduced
4456 4461 bug (misindented line) where logstart would fail when not given an
4457 4462 explicit filename.
4458 4463
4459 4464 2004-05-09 Fernando Perez <fperez@colorado.edu>
4460 4465
4461 4466 * IPython/Magic.py (Magic.parse_options): skip system call when
4462 4467 there are no options to look for. Faster, cleaner for the common
4463 4468 case.
4464 4469
4465 4470 * Documentation: many updates to the manual: describing Windows
4466 4471 support better, Gnuplot updates, credits, misc small stuff. Also
4467 4472 updated the new_design doc a bit.
4468 4473
4469 4474 2004-05-06 *** Released version 0.6.0.rc1
4470 4475
4471 4476 2004-05-06 Fernando Perez <fperez@colorado.edu>
4472 4477
4473 4478 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4474 4479 operations to use the vastly more efficient list/''.join() method.
4475 4480 (FormattedTB.text): Fix
4476 4481 http://www.scipy.net/roundup/ipython/issue12 - exception source
4477 4482 extract not updated after reload. Thanks to Mike Salib
4478 4483 <msalib-AT-mit.edu> for pinning the source of the problem.
4479 4484 Fortunately, the solution works inside ipython and doesn't require
4480 4485 any changes to python proper.
4481 4486
4482 4487 * IPython/Magic.py (Magic.parse_options): Improved to process the
4483 4488 argument list as a true shell would (by actually using the
4484 4489 underlying system shell). This way, all @magics automatically get
4485 4490 shell expansion for variables. Thanks to a comment by Alex
4486 4491 Schmolck.
4487 4492
4488 4493 2004-04-04 Fernando Perez <fperez@colorado.edu>
4489 4494
4490 4495 * IPython/iplib.py (InteractiveShell.interact): Added a special
4491 4496 trap for a debugger quit exception, which is basically impossible
4492 4497 to handle by normal mechanisms, given what pdb does to the stack.
4493 4498 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4494 4499
4495 4500 2004-04-03 Fernando Perez <fperez@colorado.edu>
4496 4501
4497 4502 * IPython/genutils.py (Term): Standardized the names of the Term
4498 4503 class streams to cin/cout/cerr, following C++ naming conventions
4499 4504 (I can't use in/out/err because 'in' is not a valid attribute
4500 4505 name).
4501 4506
4502 4507 * IPython/iplib.py (InteractiveShell.interact): don't increment
4503 4508 the prompt if there's no user input. By Daniel 'Dang' Griffith
4504 4509 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4505 4510 Francois Pinard.
4506 4511
4507 4512 2004-04-02 Fernando Perez <fperez@colorado.edu>
4508 4513
4509 4514 * IPython/genutils.py (Stream.__init__): Modified to survive at
4510 4515 least importing in contexts where stdin/out/err aren't true file
4511 4516 objects, such as PyCrust (they lack fileno() and mode). However,
4512 4517 the recovery facilities which rely on these things existing will
4513 4518 not work.
4514 4519
4515 4520 2004-04-01 Fernando Perez <fperez@colorado.edu>
4516 4521
4517 4522 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4518 4523 use the new getoutputerror() function, so it properly
4519 4524 distinguishes stdout/err.
4520 4525
4521 4526 * IPython/genutils.py (getoutputerror): added a function to
4522 4527 capture separately the standard output and error of a command.
4523 4528 After a comment from dang on the mailing lists. This code is
4524 4529 basically a modified version of commands.getstatusoutput(), from
4525 4530 the standard library.
4526 4531
4527 4532 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4528 4533 '!!' as a special syntax (shorthand) to access @sx.
4529 4534
4530 4535 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4531 4536 command and return its output as a list split on '\n'.
4532 4537
4533 4538 2004-03-31 Fernando Perez <fperez@colorado.edu>
4534 4539
4535 4540 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4536 4541 method to dictionaries used as FakeModule instances if they lack
4537 4542 it. At least pydoc in python2.3 breaks for runtime-defined
4538 4543 functions without this hack. At some point I need to _really_
4539 4544 understand what FakeModule is doing, because it's a gross hack.
4540 4545 But it solves Arnd's problem for now...
4541 4546
4542 4547 2004-02-27 Fernando Perez <fperez@colorado.edu>
4543 4548
4544 4549 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4545 4550 mode would behave erratically. Also increased the number of
4546 4551 possible logs in rotate mod to 999. Thanks to Rod Holland
4547 4552 <rhh@StructureLABS.com> for the report and fixes.
4548 4553
4549 4554 2004-02-26 Fernando Perez <fperez@colorado.edu>
4550 4555
4551 4556 * IPython/genutils.py (page): Check that the curses module really
4552 4557 has the initscr attribute before trying to use it. For some
4553 4558 reason, the Solaris curses module is missing this. I think this
4554 4559 should be considered a Solaris python bug, but I'm not sure.
4555 4560
4556 4561 2004-01-17 Fernando Perez <fperez@colorado.edu>
4557 4562
4558 4563 * IPython/genutils.py (Stream.__init__): Changes to try to make
4559 4564 ipython robust against stdin/out/err being closed by the user.
4560 4565 This is 'user error' (and blocks a normal python session, at least
4561 4566 the stdout case). However, Ipython should be able to survive such
4562 4567 instances of abuse as gracefully as possible. To simplify the
4563 4568 coding and maintain compatibility with Gary Bishop's Term
4564 4569 contributions, I've made use of classmethods for this. I think
4565 4570 this introduces a dependency on python 2.2.
4566 4571
4567 4572 2004-01-13 Fernando Perez <fperez@colorado.edu>
4568 4573
4569 4574 * IPython/numutils.py (exp_safe): simplified the code a bit and
4570 4575 removed the need for importing the kinds module altogether.
4571 4576
4572 4577 2004-01-06 Fernando Perez <fperez@colorado.edu>
4573 4578
4574 4579 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4575 4580 a magic function instead, after some community feedback. No
4576 4581 special syntax will exist for it, but its name is deliberately
4577 4582 very short.
4578 4583
4579 4584 2003-12-20 Fernando Perez <fperez@colorado.edu>
4580 4585
4581 4586 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4582 4587 new functionality, to automagically assign the result of a shell
4583 4588 command to a variable. I'll solicit some community feedback on
4584 4589 this before making it permanent.
4585 4590
4586 4591 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4587 4592 requested about callables for which inspect couldn't obtain a
4588 4593 proper argspec. Thanks to a crash report sent by Etienne
4589 4594 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4590 4595
4591 4596 2003-12-09 Fernando Perez <fperez@colorado.edu>
4592 4597
4593 4598 * IPython/genutils.py (page): patch for the pager to work across
4594 4599 various versions of Windows. By Gary Bishop.
4595 4600
4596 4601 2003-12-04 Fernando Perez <fperez@colorado.edu>
4597 4602
4598 4603 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4599 4604 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4600 4605 While I tested this and it looks ok, there may still be corner
4601 4606 cases I've missed.
4602 4607
4603 4608 2003-12-01 Fernando Perez <fperez@colorado.edu>
4604 4609
4605 4610 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4606 4611 where a line like 'p,q=1,2' would fail because the automagic
4607 4612 system would be triggered for @p.
4608 4613
4609 4614 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4610 4615 cleanups, code unmodified.
4611 4616
4612 4617 * IPython/genutils.py (Term): added a class for IPython to handle
4613 4618 output. In most cases it will just be a proxy for stdout/err, but
4614 4619 having this allows modifications to be made for some platforms,
4615 4620 such as handling color escapes under Windows. All of this code
4616 4621 was contributed by Gary Bishop, with minor modifications by me.
4617 4622 The actual changes affect many files.
4618 4623
4619 4624 2003-11-30 Fernando Perez <fperez@colorado.edu>
4620 4625
4621 4626 * IPython/iplib.py (file_matches): new completion code, courtesy
4622 4627 of Jeff Collins. This enables filename completion again under
4623 4628 python 2.3, which disabled it at the C level.
4624 4629
4625 4630 2003-11-11 Fernando Perez <fperez@colorado.edu>
4626 4631
4627 4632 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4628 4633 for Numeric.array(map(...)), but often convenient.
4629 4634
4630 4635 2003-11-05 Fernando Perez <fperez@colorado.edu>
4631 4636
4632 4637 * IPython/numutils.py (frange): Changed a call from int() to
4633 4638 int(round()) to prevent a problem reported with arange() in the
4634 4639 numpy list.
4635 4640
4636 4641 2003-10-06 Fernando Perez <fperez@colorado.edu>
4637 4642
4638 4643 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4639 4644 prevent crashes if sys lacks an argv attribute (it happens with
4640 4645 embedded interpreters which build a bare-bones sys module).
4641 4646 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4642 4647
4643 4648 2003-09-24 Fernando Perez <fperez@colorado.edu>
4644 4649
4645 4650 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4646 4651 to protect against poorly written user objects where __getattr__
4647 4652 raises exceptions other than AttributeError. Thanks to a bug
4648 4653 report by Oliver Sander <osander-AT-gmx.de>.
4649 4654
4650 4655 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4651 4656 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4652 4657
4653 4658 2003-09-09 Fernando Perez <fperez@colorado.edu>
4654 4659
4655 4660 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4656 4661 unpacking a list whith a callable as first element would
4657 4662 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4658 4663 Collins.
4659 4664
4660 4665 2003-08-25 *** Released version 0.5.0
4661 4666
4662 4667 2003-08-22 Fernando Perez <fperez@colorado.edu>
4663 4668
4664 4669 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4665 4670 improperly defined user exceptions. Thanks to feedback from Mark
4666 4671 Russell <mrussell-AT-verio.net>.
4667 4672
4668 4673 2003-08-20 Fernando Perez <fperez@colorado.edu>
4669 4674
4670 4675 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4671 4676 printing so that it would print multi-line string forms starting
4672 4677 with a new line. This way the formatting is better respected for
4673 4678 objects which work hard to make nice string forms.
4674 4679
4675 4680 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4676 4681 autocall would overtake data access for objects with both
4677 4682 __getitem__ and __call__.
4678 4683
4679 4684 2003-08-19 *** Released version 0.5.0-rc1
4680 4685
4681 4686 2003-08-19 Fernando Perez <fperez@colorado.edu>
4682 4687
4683 4688 * IPython/deep_reload.py (load_tail): single tiny change here
4684 4689 seems to fix the long-standing bug of dreload() failing to work
4685 4690 for dotted names. But this module is pretty tricky, so I may have
4686 4691 missed some subtlety. Needs more testing!.
4687 4692
4688 4693 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4689 4694 exceptions which have badly implemented __str__ methods.
4690 4695 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4691 4696 which I've been getting reports about from Python 2.3 users. I
4692 4697 wish I had a simple test case to reproduce the problem, so I could
4693 4698 either write a cleaner workaround or file a bug report if
4694 4699 necessary.
4695 4700
4696 4701 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4697 4702 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4698 4703 a bug report by Tjabo Kloppenburg.
4699 4704
4700 4705 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4701 4706 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4702 4707 seems rather unstable. Thanks to a bug report by Tjabo
4703 4708 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4704 4709
4705 4710 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4706 4711 this out soon because of the critical fixes in the inner loop for
4707 4712 generators.
4708 4713
4709 4714 * IPython/Magic.py (Magic.getargspec): removed. This (and
4710 4715 _get_def) have been obsoleted by OInspect for a long time, I
4711 4716 hadn't noticed that they were dead code.
4712 4717 (Magic._ofind): restored _ofind functionality for a few literals
4713 4718 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4714 4719 for things like "hello".capitalize?, since that would require a
4715 4720 potentially dangerous eval() again.
4716 4721
4717 4722 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4718 4723 logic a bit more to clean up the escapes handling and minimize the
4719 4724 use of _ofind to only necessary cases. The interactive 'feel' of
4720 4725 IPython should have improved quite a bit with the changes in
4721 4726 _prefilter and _ofind (besides being far safer than before).
4722 4727
4723 4728 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4724 4729 obscure, never reported). Edit would fail to find the object to
4725 4730 edit under some circumstances.
4726 4731 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4727 4732 which were causing double-calling of generators. Those eval calls
4728 4733 were _very_ dangerous, since code with side effects could be
4729 4734 triggered. As they say, 'eval is evil'... These were the
4730 4735 nastiest evals in IPython. Besides, _ofind is now far simpler,
4731 4736 and it should also be quite a bit faster. Its use of inspect is
4732 4737 also safer, so perhaps some of the inspect-related crashes I've
4733 4738 seen lately with Python 2.3 might be taken care of. That will
4734 4739 need more testing.
4735 4740
4736 4741 2003-08-17 Fernando Perez <fperez@colorado.edu>
4737 4742
4738 4743 * IPython/iplib.py (InteractiveShell._prefilter): significant
4739 4744 simplifications to the logic for handling user escapes. Faster
4740 4745 and simpler code.
4741 4746
4742 4747 2003-08-14 Fernando Perez <fperez@colorado.edu>
4743 4748
4744 4749 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4745 4750 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4746 4751 but it should be quite a bit faster. And the recursive version
4747 4752 generated O(log N) intermediate storage for all rank>1 arrays,
4748 4753 even if they were contiguous.
4749 4754 (l1norm): Added this function.
4750 4755 (norm): Added this function for arbitrary norms (including
4751 4756 l-infinity). l1 and l2 are still special cases for convenience
4752 4757 and speed.
4753 4758
4754 4759 2003-08-03 Fernando Perez <fperez@colorado.edu>
4755 4760
4756 4761 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4757 4762 exceptions, which now raise PendingDeprecationWarnings in Python
4758 4763 2.3. There were some in Magic and some in Gnuplot2.
4759 4764
4760 4765 2003-06-30 Fernando Perez <fperez@colorado.edu>
4761 4766
4762 4767 * IPython/genutils.py (page): modified to call curses only for
4763 4768 terminals where TERM=='xterm'. After problems under many other
4764 4769 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4765 4770
4766 4771 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4767 4772 would be triggered when readline was absent. This was just an old
4768 4773 debugging statement I'd forgotten to take out.
4769 4774
4770 4775 2003-06-20 Fernando Perez <fperez@colorado.edu>
4771 4776
4772 4777 * IPython/genutils.py (clock): modified to return only user time
4773 4778 (not counting system time), after a discussion on scipy. While
4774 4779 system time may be a useful quantity occasionally, it may much
4775 4780 more easily be skewed by occasional swapping or other similar
4776 4781 activity.
4777 4782
4778 4783 2003-06-05 Fernando Perez <fperez@colorado.edu>
4779 4784
4780 4785 * IPython/numutils.py (identity): new function, for building
4781 4786 arbitrary rank Kronecker deltas (mostly backwards compatible with
4782 4787 Numeric.identity)
4783 4788
4784 4789 2003-06-03 Fernando Perez <fperez@colorado.edu>
4785 4790
4786 4791 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4787 4792 arguments passed to magics with spaces, to allow trailing '\' to
4788 4793 work normally (mainly for Windows users).
4789 4794
4790 4795 2003-05-29 Fernando Perez <fperez@colorado.edu>
4791 4796
4792 4797 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4793 4798 instead of pydoc.help. This fixes a bizarre behavior where
4794 4799 printing '%s' % locals() would trigger the help system. Now
4795 4800 ipython behaves like normal python does.
4796 4801
4797 4802 Note that if one does 'from pydoc import help', the bizarre
4798 4803 behavior returns, but this will also happen in normal python, so
4799 4804 it's not an ipython bug anymore (it has to do with how pydoc.help
4800 4805 is implemented).
4801 4806
4802 4807 2003-05-22 Fernando Perez <fperez@colorado.edu>
4803 4808
4804 4809 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4805 4810 return [] instead of None when nothing matches, also match to end
4806 4811 of line. Patch by Gary Bishop.
4807 4812
4808 4813 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4809 4814 protection as before, for files passed on the command line. This
4810 4815 prevents the CrashHandler from kicking in if user files call into
4811 4816 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4812 4817 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4813 4818
4814 4819 2003-05-20 *** Released version 0.4.0
4815 4820
4816 4821 2003-05-20 Fernando Perez <fperez@colorado.edu>
4817 4822
4818 4823 * setup.py: added support for manpages. It's a bit hackish b/c of
4819 4824 a bug in the way the bdist_rpm distutils target handles gzipped
4820 4825 manpages, but it works. After a patch by Jack.
4821 4826
4822 4827 2003-05-19 Fernando Perez <fperez@colorado.edu>
4823 4828
4824 4829 * IPython/numutils.py: added a mockup of the kinds module, since
4825 4830 it was recently removed from Numeric. This way, numutils will
4826 4831 work for all users even if they are missing kinds.
4827 4832
4828 4833 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4829 4834 failure, which can occur with SWIG-wrapped extensions. After a
4830 4835 crash report from Prabhu.
4831 4836
4832 4837 2003-05-16 Fernando Perez <fperez@colorado.edu>
4833 4838
4834 4839 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4835 4840 protect ipython from user code which may call directly
4836 4841 sys.excepthook (this looks like an ipython crash to the user, even
4837 4842 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4838 4843 This is especially important to help users of WxWindows, but may
4839 4844 also be useful in other cases.
4840 4845
4841 4846 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4842 4847 an optional tb_offset to be specified, and to preserve exception
4843 4848 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4844 4849
4845 4850 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4846 4851
4847 4852 2003-05-15 Fernando Perez <fperez@colorado.edu>
4848 4853
4849 4854 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4850 4855 installing for a new user under Windows.
4851 4856
4852 4857 2003-05-12 Fernando Perez <fperez@colorado.edu>
4853 4858
4854 4859 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4855 4860 handler for Emacs comint-based lines. Currently it doesn't do
4856 4861 much (but importantly, it doesn't update the history cache). In
4857 4862 the future it may be expanded if Alex needs more functionality
4858 4863 there.
4859 4864
4860 4865 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4861 4866 info to crash reports.
4862 4867
4863 4868 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4864 4869 just like Python's -c. Also fixed crash with invalid -color
4865 4870 option value at startup. Thanks to Will French
4866 4871 <wfrench-AT-bestweb.net> for the bug report.
4867 4872
4868 4873 2003-05-09 Fernando Perez <fperez@colorado.edu>
4869 4874
4870 4875 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4871 4876 to EvalDict (it's a mapping, after all) and simplified its code
4872 4877 quite a bit, after a nice discussion on c.l.py where Gustavo
4873 4878 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4874 4879
4875 4880 2003-04-30 Fernando Perez <fperez@colorado.edu>
4876 4881
4877 4882 * IPython/genutils.py (timings_out): modified it to reduce its
4878 4883 overhead in the common reps==1 case.
4879 4884
4880 4885 2003-04-29 Fernando Perez <fperez@colorado.edu>
4881 4886
4882 4887 * IPython/genutils.py (timings_out): Modified to use the resource
4883 4888 module, which avoids the wraparound problems of time.clock().
4884 4889
4885 4890 2003-04-17 *** Released version 0.2.15pre4
4886 4891
4887 4892 2003-04-17 Fernando Perez <fperez@colorado.edu>
4888 4893
4889 4894 * setup.py (scriptfiles): Split windows-specific stuff over to a
4890 4895 separate file, in an attempt to have a Windows GUI installer.
4891 4896 That didn't work, but part of the groundwork is done.
4892 4897
4893 4898 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4894 4899 indent/unindent with 4 spaces. Particularly useful in combination
4895 4900 with the new auto-indent option.
4896 4901
4897 4902 2003-04-16 Fernando Perez <fperez@colorado.edu>
4898 4903
4899 4904 * IPython/Magic.py: various replacements of self.rc for
4900 4905 self.shell.rc. A lot more remains to be done to fully disentangle
4901 4906 this class from the main Shell class.
4902 4907
4903 4908 * IPython/GnuplotRuntime.py: added checks for mouse support so
4904 4909 that we don't try to enable it if the current gnuplot doesn't
4905 4910 really support it. Also added checks so that we don't try to
4906 4911 enable persist under Windows (where Gnuplot doesn't recognize the
4907 4912 option).
4908 4913
4909 4914 * IPython/iplib.py (InteractiveShell.interact): Added optional
4910 4915 auto-indenting code, after a patch by King C. Shu
4911 4916 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4912 4917 get along well with pasting indented code. If I ever figure out
4913 4918 how to make that part go well, it will become on by default.
4914 4919
4915 4920 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4916 4921 crash ipython if there was an unmatched '%' in the user's prompt
4917 4922 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4918 4923
4919 4924 * IPython/iplib.py (InteractiveShell.interact): removed the
4920 4925 ability to ask the user whether he wants to crash or not at the
4921 4926 'last line' exception handler. Calling functions at that point
4922 4927 changes the stack, and the error reports would have incorrect
4923 4928 tracebacks.
4924 4929
4925 4930 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4926 4931 pass through a peger a pretty-printed form of any object. After a
4927 4932 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4928 4933
4929 4934 2003-04-14 Fernando Perez <fperez@colorado.edu>
4930 4935
4931 4936 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4932 4937 all files in ~ would be modified at first install (instead of
4933 4938 ~/.ipython). This could be potentially disastrous, as the
4934 4939 modification (make line-endings native) could damage binary files.
4935 4940
4936 4941 2003-04-10 Fernando Perez <fperez@colorado.edu>
4937 4942
4938 4943 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4939 4944 handle only lines which are invalid python. This now means that
4940 4945 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4941 4946 for the bug report.
4942 4947
4943 4948 2003-04-01 Fernando Perez <fperez@colorado.edu>
4944 4949
4945 4950 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4946 4951 where failing to set sys.last_traceback would crash pdb.pm().
4947 4952 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4948 4953 report.
4949 4954
4950 4955 2003-03-25 Fernando Perez <fperez@colorado.edu>
4951 4956
4952 4957 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4953 4958 before printing it (it had a lot of spurious blank lines at the
4954 4959 end).
4955 4960
4956 4961 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4957 4962 output would be sent 21 times! Obviously people don't use this
4958 4963 too often, or I would have heard about it.
4959 4964
4960 4965 2003-03-24 Fernando Perez <fperez@colorado.edu>
4961 4966
4962 4967 * setup.py (scriptfiles): renamed the data_files parameter from
4963 4968 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4964 4969 for the patch.
4965 4970
4966 4971 2003-03-20 Fernando Perez <fperez@colorado.edu>
4967 4972
4968 4973 * IPython/genutils.py (error): added error() and fatal()
4969 4974 functions.
4970 4975
4971 4976 2003-03-18 *** Released version 0.2.15pre3
4972 4977
4973 4978 2003-03-18 Fernando Perez <fperez@colorado.edu>
4974 4979
4975 4980 * setupext/install_data_ext.py
4976 4981 (install_data_ext.initialize_options): Class contributed by Jack
4977 4982 Moffit for fixing the old distutils hack. He is sending this to
4978 4983 the distutils folks so in the future we may not need it as a
4979 4984 private fix.
4980 4985
4981 4986 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4982 4987 changes for Debian packaging. See his patch for full details.
4983 4988 The old distutils hack of making the ipythonrc* files carry a
4984 4989 bogus .py extension is gone, at last. Examples were moved to a
4985 4990 separate subdir under doc/, and the separate executable scripts
4986 4991 now live in their own directory. Overall a great cleanup. The
4987 4992 manual was updated to use the new files, and setup.py has been
4988 4993 fixed for this setup.
4989 4994
4990 4995 * IPython/PyColorize.py (Parser.usage): made non-executable and
4991 4996 created a pycolor wrapper around it to be included as a script.
4992 4997
4993 4998 2003-03-12 *** Released version 0.2.15pre2
4994 4999
4995 5000 2003-03-12 Fernando Perez <fperez@colorado.edu>
4996 5001
4997 5002 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4998 5003 long-standing problem with garbage characters in some terminals.
4999 5004 The issue was really that the \001 and \002 escapes must _only_ be
5000 5005 passed to input prompts (which call readline), but _never_ to
5001 5006 normal text to be printed on screen. I changed ColorANSI to have
5002 5007 two classes: TermColors and InputTermColors, each with the
5003 5008 appropriate escapes for input prompts or normal text. The code in
5004 5009 Prompts.py got slightly more complicated, but this very old and
5005 5010 annoying bug is finally fixed.
5006 5011
5007 5012 All the credit for nailing down the real origin of this problem
5008 5013 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5009 5014 *Many* thanks to him for spending quite a bit of effort on this.
5010 5015
5011 5016 2003-03-05 *** Released version 0.2.15pre1
5012 5017
5013 5018 2003-03-03 Fernando Perez <fperez@colorado.edu>
5014 5019
5015 5020 * IPython/FakeModule.py: Moved the former _FakeModule to a
5016 5021 separate file, because it's also needed by Magic (to fix a similar
5017 5022 pickle-related issue in @run).
5018 5023
5019 5024 2003-03-02 Fernando Perez <fperez@colorado.edu>
5020 5025
5021 5026 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5022 5027 the autocall option at runtime.
5023 5028 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5024 5029 across Magic.py to start separating Magic from InteractiveShell.
5025 5030 (Magic._ofind): Fixed to return proper namespace for dotted
5026 5031 names. Before, a dotted name would always return 'not currently
5027 5032 defined', because it would find the 'parent'. s.x would be found,
5028 5033 but since 'x' isn't defined by itself, it would get confused.
5029 5034 (Magic.magic_run): Fixed pickling problems reported by Ralf
5030 5035 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5031 5036 that I'd used when Mike Heeter reported similar issues at the
5032 5037 top-level, but now for @run. It boils down to injecting the
5033 5038 namespace where code is being executed with something that looks
5034 5039 enough like a module to fool pickle.dump(). Since a pickle stores
5035 5040 a named reference to the importing module, we need this for
5036 5041 pickles to save something sensible.
5037 5042
5038 5043 * IPython/ipmaker.py (make_IPython): added an autocall option.
5039 5044
5040 5045 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5041 5046 the auto-eval code. Now autocalling is an option, and the code is
5042 5047 also vastly safer. There is no more eval() involved at all.
5043 5048
5044 5049 2003-03-01 Fernando Perez <fperez@colorado.edu>
5045 5050
5046 5051 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5047 5052 dict with named keys instead of a tuple.
5048 5053
5049 5054 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5050 5055
5051 5056 * setup.py (make_shortcut): Fixed message about directories
5052 5057 created during Windows installation (the directories were ok, just
5053 5058 the printed message was misleading). Thanks to Chris Liechti
5054 5059 <cliechti-AT-gmx.net> for the heads up.
5055 5060
5056 5061 2003-02-21 Fernando Perez <fperez@colorado.edu>
5057 5062
5058 5063 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5059 5064 of ValueError exception when checking for auto-execution. This
5060 5065 one is raised by things like Numeric arrays arr.flat when the
5061 5066 array is non-contiguous.
5062 5067
5063 5068 2003-01-31 Fernando Perez <fperez@colorado.edu>
5064 5069
5065 5070 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5066 5071 not return any value at all (even though the command would get
5067 5072 executed).
5068 5073 (xsys): Flush stdout right after printing the command to ensure
5069 5074 proper ordering of commands and command output in the total
5070 5075 output.
5071 5076 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5072 5077 system/getoutput as defaults. The old ones are kept for
5073 5078 compatibility reasons, so no code which uses this library needs
5074 5079 changing.
5075 5080
5076 5081 2003-01-27 *** Released version 0.2.14
5077 5082
5078 5083 2003-01-25 Fernando Perez <fperez@colorado.edu>
5079 5084
5080 5085 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5081 5086 functions defined in previous edit sessions could not be re-edited
5082 5087 (because the temp files were immediately removed). Now temp files
5083 5088 are removed only at IPython's exit.
5084 5089 (Magic.magic_run): Improved @run to perform shell-like expansions
5085 5090 on its arguments (~users and $VARS). With this, @run becomes more
5086 5091 like a normal command-line.
5087 5092
5088 5093 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5089 5094 bugs related to embedding and cleaned up that code. A fairly
5090 5095 important one was the impossibility to access the global namespace
5091 5096 through the embedded IPython (only local variables were visible).
5092 5097
5093 5098 2003-01-14 Fernando Perez <fperez@colorado.edu>
5094 5099
5095 5100 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5096 5101 auto-calling to be a bit more conservative. Now it doesn't get
5097 5102 triggered if any of '!=()<>' are in the rest of the input line, to
5098 5103 allow comparing callables. Thanks to Alex for the heads up.
5099 5104
5100 5105 2003-01-07 Fernando Perez <fperez@colorado.edu>
5101 5106
5102 5107 * IPython/genutils.py (page): fixed estimation of the number of
5103 5108 lines in a string to be paged to simply count newlines. This
5104 5109 prevents over-guessing due to embedded escape sequences. A better
5105 5110 long-term solution would involve stripping out the control chars
5106 5111 for the count, but it's potentially so expensive I just don't
5107 5112 think it's worth doing.
5108 5113
5109 5114 2002-12-19 *** Released version 0.2.14pre50
5110 5115
5111 5116 2002-12-19 Fernando Perez <fperez@colorado.edu>
5112 5117
5113 5118 * tools/release (version): Changed release scripts to inform
5114 5119 Andrea and build a NEWS file with a list of recent changes.
5115 5120
5116 5121 * IPython/ColorANSI.py (__all__): changed terminal detection
5117 5122 code. Seems to work better for xterms without breaking
5118 5123 konsole. Will need more testing to determine if WinXP and Mac OSX
5119 5124 also work ok.
5120 5125
5121 5126 2002-12-18 *** Released version 0.2.14pre49
5122 5127
5123 5128 2002-12-18 Fernando Perez <fperez@colorado.edu>
5124 5129
5125 5130 * Docs: added new info about Mac OSX, from Andrea.
5126 5131
5127 5132 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5128 5133 allow direct plotting of python strings whose format is the same
5129 5134 of gnuplot data files.
5130 5135
5131 5136 2002-12-16 Fernando Perez <fperez@colorado.edu>
5132 5137
5133 5138 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5134 5139 value of exit question to be acknowledged.
5135 5140
5136 5141 2002-12-03 Fernando Perez <fperez@colorado.edu>
5137 5142
5138 5143 * IPython/ipmaker.py: removed generators, which had been added
5139 5144 by mistake in an earlier debugging run. This was causing trouble
5140 5145 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5141 5146 for pointing this out.
5142 5147
5143 5148 2002-11-17 Fernando Perez <fperez@colorado.edu>
5144 5149
5145 5150 * Manual: updated the Gnuplot section.
5146 5151
5147 5152 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5148 5153 a much better split of what goes in Runtime and what goes in
5149 5154 Interactive.
5150 5155
5151 5156 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5152 5157 being imported from iplib.
5153 5158
5154 5159 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5155 5160 for command-passing. Now the global Gnuplot instance is called
5156 5161 'gp' instead of 'g', which was really a far too fragile and
5157 5162 common name.
5158 5163
5159 5164 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5160 5165 bounding boxes generated by Gnuplot for square plots.
5161 5166
5162 5167 * IPython/genutils.py (popkey): new function added. I should
5163 5168 suggest this on c.l.py as a dict method, it seems useful.
5164 5169
5165 5170 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5166 5171 to transparently handle PostScript generation. MUCH better than
5167 5172 the previous plot_eps/replot_eps (which I removed now). The code
5168 5173 is also fairly clean and well documented now (including
5169 5174 docstrings).
5170 5175
5171 5176 2002-11-13 Fernando Perez <fperez@colorado.edu>
5172 5177
5173 5178 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5174 5179 (inconsistent with options).
5175 5180
5176 5181 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5177 5182 manually disabled, I don't know why. Fixed it.
5178 5183 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5179 5184 eps output.
5180 5185
5181 5186 2002-11-12 Fernando Perez <fperez@colorado.edu>
5182 5187
5183 5188 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5184 5189 don't propagate up to caller. Fixes crash reported by François
5185 5190 Pinard.
5186 5191
5187 5192 2002-11-09 Fernando Perez <fperez@colorado.edu>
5188 5193
5189 5194 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5190 5195 history file for new users.
5191 5196 (make_IPython): fixed bug where initial install would leave the
5192 5197 user running in the .ipython dir.
5193 5198 (make_IPython): fixed bug where config dir .ipython would be
5194 5199 created regardless of the given -ipythondir option. Thanks to Cory
5195 5200 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5196 5201
5197 5202 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5198 5203 type confirmations. Will need to use it in all of IPython's code
5199 5204 consistently.
5200 5205
5201 5206 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5202 5207 context to print 31 lines instead of the default 5. This will make
5203 5208 the crash reports extremely detailed in case the problem is in
5204 5209 libraries I don't have access to.
5205 5210
5206 5211 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5207 5212 line of defense' code to still crash, but giving users fair
5208 5213 warning. I don't want internal errors to go unreported: if there's
5209 5214 an internal problem, IPython should crash and generate a full
5210 5215 report.
5211 5216
5212 5217 2002-11-08 Fernando Perez <fperez@colorado.edu>
5213 5218
5214 5219 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5215 5220 otherwise uncaught exceptions which can appear if people set
5216 5221 sys.stdout to something badly broken. Thanks to a crash report
5217 5222 from henni-AT-mail.brainbot.com.
5218 5223
5219 5224 2002-11-04 Fernando Perez <fperez@colorado.edu>
5220 5225
5221 5226 * IPython/iplib.py (InteractiveShell.interact): added
5222 5227 __IPYTHON__active to the builtins. It's a flag which goes on when
5223 5228 the interaction starts and goes off again when it stops. This
5224 5229 allows embedding code to detect being inside IPython. Before this
5225 5230 was done via __IPYTHON__, but that only shows that an IPython
5226 5231 instance has been created.
5227 5232
5228 5233 * IPython/Magic.py (Magic.magic_env): I realized that in a
5229 5234 UserDict, instance.data holds the data as a normal dict. So I
5230 5235 modified @env to return os.environ.data instead of rebuilding a
5231 5236 dict by hand.
5232 5237
5233 5238 2002-11-02 Fernando Perez <fperez@colorado.edu>
5234 5239
5235 5240 * IPython/genutils.py (warn): changed so that level 1 prints no
5236 5241 header. Level 2 is now the default (with 'WARNING' header, as
5237 5242 before). I think I tracked all places where changes were needed in
5238 5243 IPython, but outside code using the old level numbering may have
5239 5244 broken.
5240 5245
5241 5246 * IPython/iplib.py (InteractiveShell.runcode): added this to
5242 5247 handle the tracebacks in SystemExit traps correctly. The previous
5243 5248 code (through interact) was printing more of the stack than
5244 5249 necessary, showing IPython internal code to the user.
5245 5250
5246 5251 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5247 5252 default. Now that the default at the confirmation prompt is yes,
5248 5253 it's not so intrusive. François' argument that ipython sessions
5249 5254 tend to be complex enough not to lose them from an accidental C-d,
5250 5255 is a valid one.
5251 5256
5252 5257 * IPython/iplib.py (InteractiveShell.interact): added a
5253 5258 showtraceback() call to the SystemExit trap, and modified the exit
5254 5259 confirmation to have yes as the default.
5255 5260
5256 5261 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5257 5262 this file. It's been gone from the code for a long time, this was
5258 5263 simply leftover junk.
5259 5264
5260 5265 2002-11-01 Fernando Perez <fperez@colorado.edu>
5261 5266
5262 5267 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5263 5268 added. If set, IPython now traps EOF and asks for
5264 5269 confirmation. After a request by François Pinard.
5265 5270
5266 5271 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5267 5272 of @abort, and with a new (better) mechanism for handling the
5268 5273 exceptions.
5269 5274
5270 5275 2002-10-27 Fernando Perez <fperez@colorado.edu>
5271 5276
5272 5277 * IPython/usage.py (__doc__): updated the --help information and
5273 5278 the ipythonrc file to indicate that -log generates
5274 5279 ./ipython.log. Also fixed the corresponding info in @logstart.
5275 5280 This and several other fixes in the manuals thanks to reports by
5276 5281 François Pinard <pinard-AT-iro.umontreal.ca>.
5277 5282
5278 5283 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5279 5284 refer to @logstart (instead of @log, which doesn't exist).
5280 5285
5281 5286 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5282 5287 AttributeError crash. Thanks to Christopher Armstrong
5283 5288 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5284 5289 introduced recently (in 0.2.14pre37) with the fix to the eval
5285 5290 problem mentioned below.
5286 5291
5287 5292 2002-10-17 Fernando Perez <fperez@colorado.edu>
5288 5293
5289 5294 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5290 5295 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5291 5296
5292 5297 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5293 5298 this function to fix a problem reported by Alex Schmolck. He saw
5294 5299 it with list comprehensions and generators, which were getting
5295 5300 called twice. The real problem was an 'eval' call in testing for
5296 5301 automagic which was evaluating the input line silently.
5297 5302
5298 5303 This is a potentially very nasty bug, if the input has side
5299 5304 effects which must not be repeated. The code is much cleaner now,
5300 5305 without any blanket 'except' left and with a regexp test for
5301 5306 actual function names.
5302 5307
5303 5308 But an eval remains, which I'm not fully comfortable with. I just
5304 5309 don't know how to find out if an expression could be a callable in
5305 5310 the user's namespace without doing an eval on the string. However
5306 5311 that string is now much more strictly checked so that no code
5307 5312 slips by, so the eval should only happen for things that can
5308 5313 really be only function/method names.
5309 5314
5310 5315 2002-10-15 Fernando Perez <fperez@colorado.edu>
5311 5316
5312 5317 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5313 5318 OSX information to main manual, removed README_Mac_OSX file from
5314 5319 distribution. Also updated credits for recent additions.
5315 5320
5316 5321 2002-10-10 Fernando Perez <fperez@colorado.edu>
5317 5322
5318 5323 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5319 5324 terminal-related issues. Many thanks to Andrea Riciputi
5320 5325 <andrea.riciputi-AT-libero.it> for writing it.
5321 5326
5322 5327 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5323 5328 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5324 5329
5325 5330 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5326 5331 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5327 5332 <syver-en-AT-online.no> who both submitted patches for this problem.
5328 5333
5329 5334 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5330 5335 global embedding to make sure that things don't overwrite user
5331 5336 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5332 5337
5333 5338 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5334 5339 compatibility. Thanks to Hayden Callow
5335 5340 <h.callow-AT-elec.canterbury.ac.nz>
5336 5341
5337 5342 2002-10-04 Fernando Perez <fperez@colorado.edu>
5338 5343
5339 5344 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5340 5345 Gnuplot.File objects.
5341 5346
5342 5347 2002-07-23 Fernando Perez <fperez@colorado.edu>
5343 5348
5344 5349 * IPython/genutils.py (timing): Added timings() and timing() for
5345 5350 quick access to the most commonly needed data, the execution
5346 5351 times. Old timing() renamed to timings_out().
5347 5352
5348 5353 2002-07-18 Fernando Perez <fperez@colorado.edu>
5349 5354
5350 5355 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5351 5356 bug with nested instances disrupting the parent's tab completion.
5352 5357
5353 5358 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5354 5359 all_completions code to begin the emacs integration.
5355 5360
5356 5361 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5357 5362 argument to allow titling individual arrays when plotting.
5358 5363
5359 5364 2002-07-15 Fernando Perez <fperez@colorado.edu>
5360 5365
5361 5366 * setup.py (make_shortcut): changed to retrieve the value of
5362 5367 'Program Files' directory from the registry (this value changes in
5363 5368 non-english versions of Windows). Thanks to Thomas Fanslau
5364 5369 <tfanslau-AT-gmx.de> for the report.
5365 5370
5366 5371 2002-07-10 Fernando Perez <fperez@colorado.edu>
5367 5372
5368 5373 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5369 5374 a bug in pdb, which crashes if a line with only whitespace is
5370 5375 entered. Bug report submitted to sourceforge.
5371 5376
5372 5377 2002-07-09 Fernando Perez <fperez@colorado.edu>
5373 5378
5374 5379 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5375 5380 reporting exceptions (it's a bug in inspect.py, I just set a
5376 5381 workaround).
5377 5382
5378 5383 2002-07-08 Fernando Perez <fperez@colorado.edu>
5379 5384
5380 5385 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5381 5386 __IPYTHON__ in __builtins__ to show up in user_ns.
5382 5387
5383 5388 2002-07-03 Fernando Perez <fperez@colorado.edu>
5384 5389
5385 5390 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5386 5391 name from @gp_set_instance to @gp_set_default.
5387 5392
5388 5393 * IPython/ipmaker.py (make_IPython): default editor value set to
5389 5394 '0' (a string), to match the rc file. Otherwise will crash when
5390 5395 .strip() is called on it.
5391 5396
5392 5397
5393 5398 2002-06-28 Fernando Perez <fperez@colorado.edu>
5394 5399
5395 5400 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5396 5401 of files in current directory when a file is executed via
5397 5402 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5398 5403
5399 5404 * setup.py (manfiles): fix for rpm builds, submitted by RA
5400 5405 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5401 5406
5402 5407 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5403 5408 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5404 5409 string!). A. Schmolck caught this one.
5405 5410
5406 5411 2002-06-27 Fernando Perez <fperez@colorado.edu>
5407 5412
5408 5413 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5409 5414 defined files at the cmd line. __name__ wasn't being set to
5410 5415 __main__.
5411 5416
5412 5417 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5413 5418 regular lists and tuples besides Numeric arrays.
5414 5419
5415 5420 * IPython/Prompts.py (CachedOutput.__call__): Added output
5416 5421 supression for input ending with ';'. Similar to Mathematica and
5417 5422 Matlab. The _* vars and Out[] list are still updated, just like
5418 5423 Mathematica behaves.
5419 5424
5420 5425 2002-06-25 Fernando Perez <fperez@colorado.edu>
5421 5426
5422 5427 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5423 5428 .ini extensions for profiels under Windows.
5424 5429
5425 5430 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5426 5431 string form. Fix contributed by Alexander Schmolck
5427 5432 <a.schmolck-AT-gmx.net>
5428 5433
5429 5434 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5430 5435 pre-configured Gnuplot instance.
5431 5436
5432 5437 2002-06-21 Fernando Perez <fperez@colorado.edu>
5433 5438
5434 5439 * IPython/numutils.py (exp_safe): new function, works around the
5435 5440 underflow problems in Numeric.
5436 5441 (log2): New fn. Safe log in base 2: returns exact integer answer
5437 5442 for exact integer powers of 2.
5438 5443
5439 5444 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5440 5445 properly.
5441 5446
5442 5447 2002-06-20 Fernando Perez <fperez@colorado.edu>
5443 5448
5444 5449 * IPython/genutils.py (timing): new function like
5445 5450 Mathematica's. Similar to time_test, but returns more info.
5446 5451
5447 5452 2002-06-18 Fernando Perez <fperez@colorado.edu>
5448 5453
5449 5454 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5450 5455 according to Mike Heeter's suggestions.
5451 5456
5452 5457 2002-06-16 Fernando Perez <fperez@colorado.edu>
5453 5458
5454 5459 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5455 5460 system. GnuplotMagic is gone as a user-directory option. New files
5456 5461 make it easier to use all the gnuplot stuff both from external
5457 5462 programs as well as from IPython. Had to rewrite part of
5458 5463 hardcopy() b/c of a strange bug: often the ps files simply don't
5459 5464 get created, and require a repeat of the command (often several
5460 5465 times).
5461 5466
5462 5467 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5463 5468 resolve output channel at call time, so that if sys.stderr has
5464 5469 been redirected by user this gets honored.
5465 5470
5466 5471 2002-06-13 Fernando Perez <fperez@colorado.edu>
5467 5472
5468 5473 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5469 5474 IPShell. Kept a copy with the old names to avoid breaking people's
5470 5475 embedded code.
5471 5476
5472 5477 * IPython/ipython: simplified it to the bare minimum after
5473 5478 Holger's suggestions. Added info about how to use it in
5474 5479 PYTHONSTARTUP.
5475 5480
5476 5481 * IPython/Shell.py (IPythonShell): changed the options passing
5477 5482 from a string with funky %s replacements to a straight list. Maybe
5478 5483 a bit more typing, but it follows sys.argv conventions, so there's
5479 5484 less special-casing to remember.
5480 5485
5481 5486 2002-06-12 Fernando Perez <fperez@colorado.edu>
5482 5487
5483 5488 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5484 5489 command. Thanks to a suggestion by Mike Heeter.
5485 5490 (Magic.magic_pfile): added behavior to look at filenames if given
5486 5491 arg is not a defined object.
5487 5492 (Magic.magic_save): New @save function to save code snippets. Also
5488 5493 a Mike Heeter idea.
5489 5494
5490 5495 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5491 5496 plot() and replot(). Much more convenient now, especially for
5492 5497 interactive use.
5493 5498
5494 5499 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5495 5500 filenames.
5496 5501
5497 5502 2002-06-02 Fernando Perez <fperez@colorado.edu>
5498 5503
5499 5504 * IPython/Struct.py (Struct.__init__): modified to admit
5500 5505 initialization via another struct.
5501 5506
5502 5507 * IPython/genutils.py (SystemExec.__init__): New stateful
5503 5508 interface to xsys and bq. Useful for writing system scripts.
5504 5509
5505 5510 2002-05-30 Fernando Perez <fperez@colorado.edu>
5506 5511
5507 5512 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5508 5513 documents. This will make the user download smaller (it's getting
5509 5514 too big).
5510 5515
5511 5516 2002-05-29 Fernando Perez <fperez@colorado.edu>
5512 5517
5513 5518 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5514 5519 fix problems with shelve and pickle. Seems to work, but I don't
5515 5520 know if corner cases break it. Thanks to Mike Heeter
5516 5521 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5517 5522
5518 5523 2002-05-24 Fernando Perez <fperez@colorado.edu>
5519 5524
5520 5525 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5521 5526 macros having broken.
5522 5527
5523 5528 2002-05-21 Fernando Perez <fperez@colorado.edu>
5524 5529
5525 5530 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5526 5531 introduced logging bug: all history before logging started was
5527 5532 being written one character per line! This came from the redesign
5528 5533 of the input history as a special list which slices to strings,
5529 5534 not to lists.
5530 5535
5531 5536 2002-05-20 Fernando Perez <fperez@colorado.edu>
5532 5537
5533 5538 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5534 5539 be an attribute of all classes in this module. The design of these
5535 5540 classes needs some serious overhauling.
5536 5541
5537 5542 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5538 5543 which was ignoring '_' in option names.
5539 5544
5540 5545 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5541 5546 'Verbose_novars' to 'Context' and made it the new default. It's a
5542 5547 bit more readable and also safer than verbose.
5543 5548
5544 5549 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5545 5550 triple-quoted strings.
5546 5551
5547 5552 * IPython/OInspect.py (__all__): new module exposing the object
5548 5553 introspection facilities. Now the corresponding magics are dummy
5549 5554 wrappers around this. Having this module will make it much easier
5550 5555 to put these functions into our modified pdb.
5551 5556 This new object inspector system uses the new colorizing module,
5552 5557 so source code and other things are nicely syntax highlighted.
5553 5558
5554 5559 2002-05-18 Fernando Perez <fperez@colorado.edu>
5555 5560
5556 5561 * IPython/ColorANSI.py: Split the coloring tools into a separate
5557 5562 module so I can use them in other code easier (they were part of
5558 5563 ultraTB).
5559 5564
5560 5565 2002-05-17 Fernando Perez <fperez@colorado.edu>
5561 5566
5562 5567 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5563 5568 fixed it to set the global 'g' also to the called instance, as
5564 5569 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5565 5570 user's 'g' variables).
5566 5571
5567 5572 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5568 5573 global variables (aliases to _ih,_oh) so that users which expect
5569 5574 In[5] or Out[7] to work aren't unpleasantly surprised.
5570 5575 (InputList.__getslice__): new class to allow executing slices of
5571 5576 input history directly. Very simple class, complements the use of
5572 5577 macros.
5573 5578
5574 5579 2002-05-16 Fernando Perez <fperez@colorado.edu>
5575 5580
5576 5581 * setup.py (docdirbase): make doc directory be just doc/IPython
5577 5582 without version numbers, it will reduce clutter for users.
5578 5583
5579 5584 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5580 5585 execfile call to prevent possible memory leak. See for details:
5581 5586 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5582 5587
5583 5588 2002-05-15 Fernando Perez <fperez@colorado.edu>
5584 5589
5585 5590 * IPython/Magic.py (Magic.magic_psource): made the object
5586 5591 introspection names be more standard: pdoc, pdef, pfile and
5587 5592 psource. They all print/page their output, and it makes
5588 5593 remembering them easier. Kept old names for compatibility as
5589 5594 aliases.
5590 5595
5591 5596 2002-05-14 Fernando Perez <fperez@colorado.edu>
5592 5597
5593 5598 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5594 5599 what the mouse problem was. The trick is to use gnuplot with temp
5595 5600 files and NOT with pipes (for data communication), because having
5596 5601 both pipes and the mouse on is bad news.
5597 5602
5598 5603 2002-05-13 Fernando Perez <fperez@colorado.edu>
5599 5604
5600 5605 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5601 5606 bug. Information would be reported about builtins even when
5602 5607 user-defined functions overrode them.
5603 5608
5604 5609 2002-05-11 Fernando Perez <fperez@colorado.edu>
5605 5610
5606 5611 * IPython/__init__.py (__all__): removed FlexCompleter from
5607 5612 __all__ so that things don't fail in platforms without readline.
5608 5613
5609 5614 2002-05-10 Fernando Perez <fperez@colorado.edu>
5610 5615
5611 5616 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5612 5617 it requires Numeric, effectively making Numeric a dependency for
5613 5618 IPython.
5614 5619
5615 5620 * Released 0.2.13
5616 5621
5617 5622 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5618 5623 profiler interface. Now all the major options from the profiler
5619 5624 module are directly supported in IPython, both for single
5620 5625 expressions (@prun) and for full programs (@run -p).
5621 5626
5622 5627 2002-05-09 Fernando Perez <fperez@colorado.edu>
5623 5628
5624 5629 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5625 5630 magic properly formatted for screen.
5626 5631
5627 5632 * setup.py (make_shortcut): Changed things to put pdf version in
5628 5633 doc/ instead of doc/manual (had to change lyxport a bit).
5629 5634
5630 5635 * IPython/Magic.py (Profile.string_stats): made profile runs go
5631 5636 through pager (they are long and a pager allows searching, saving,
5632 5637 etc.)
5633 5638
5634 5639 2002-05-08 Fernando Perez <fperez@colorado.edu>
5635 5640
5636 5641 * Released 0.2.12
5637 5642
5638 5643 2002-05-06 Fernando Perez <fperez@colorado.edu>
5639 5644
5640 5645 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5641 5646 introduced); 'hist n1 n2' was broken.
5642 5647 (Magic.magic_pdb): added optional on/off arguments to @pdb
5643 5648 (Magic.magic_run): added option -i to @run, which executes code in
5644 5649 the IPython namespace instead of a clean one. Also added @irun as
5645 5650 an alias to @run -i.
5646 5651
5647 5652 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5648 5653 fixed (it didn't really do anything, the namespaces were wrong).
5649 5654
5650 5655 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5651 5656
5652 5657 * IPython/__init__.py (__all__): Fixed package namespace, now
5653 5658 'import IPython' does give access to IPython.<all> as
5654 5659 expected. Also renamed __release__ to Release.
5655 5660
5656 5661 * IPython/Debugger.py (__license__): created new Pdb class which
5657 5662 functions like a drop-in for the normal pdb.Pdb but does NOT
5658 5663 import readline by default. This way it doesn't muck up IPython's
5659 5664 readline handling, and now tab-completion finally works in the
5660 5665 debugger -- sort of. It completes things globally visible, but the
5661 5666 completer doesn't track the stack as pdb walks it. That's a bit
5662 5667 tricky, and I'll have to implement it later.
5663 5668
5664 5669 2002-05-05 Fernando Perez <fperez@colorado.edu>
5665 5670
5666 5671 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5667 5672 magic docstrings when printed via ? (explicit \'s were being
5668 5673 printed).
5669 5674
5670 5675 * IPython/ipmaker.py (make_IPython): fixed namespace
5671 5676 identification bug. Now variables loaded via logs or command-line
5672 5677 files are recognized in the interactive namespace by @who.
5673 5678
5674 5679 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5675 5680 log replay system stemming from the string form of Structs.
5676 5681
5677 5682 * IPython/Magic.py (Macro.__init__): improved macros to properly
5678 5683 handle magic commands in them.
5679 5684 (Magic.magic_logstart): usernames are now expanded so 'logstart
5680 5685 ~/mylog' now works.
5681 5686
5682 5687 * IPython/iplib.py (complete): fixed bug where paths starting with
5683 5688 '/' would be completed as magic names.
5684 5689
5685 5690 2002-05-04 Fernando Perez <fperez@colorado.edu>
5686 5691
5687 5692 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5688 5693 allow running full programs under the profiler's control.
5689 5694
5690 5695 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5691 5696 mode to report exceptions verbosely but without formatting
5692 5697 variables. This addresses the issue of ipython 'freezing' (it's
5693 5698 not frozen, but caught in an expensive formatting loop) when huge
5694 5699 variables are in the context of an exception.
5695 5700 (VerboseTB.text): Added '--->' markers at line where exception was
5696 5701 triggered. Much clearer to read, especially in NoColor modes.
5697 5702
5698 5703 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5699 5704 implemented in reverse when changing to the new parse_options().
5700 5705
5701 5706 2002-05-03 Fernando Perez <fperez@colorado.edu>
5702 5707
5703 5708 * IPython/Magic.py (Magic.parse_options): new function so that
5704 5709 magics can parse options easier.
5705 5710 (Magic.magic_prun): new function similar to profile.run(),
5706 5711 suggested by Chris Hart.
5707 5712 (Magic.magic_cd): fixed behavior so that it only changes if
5708 5713 directory actually is in history.
5709 5714
5710 5715 * IPython/usage.py (__doc__): added information about potential
5711 5716 slowness of Verbose exception mode when there are huge data
5712 5717 structures to be formatted (thanks to Archie Paulson).
5713 5718
5714 5719 * IPython/ipmaker.py (make_IPython): Changed default logging
5715 5720 (when simply called with -log) to use curr_dir/ipython.log in
5716 5721 rotate mode. Fixed crash which was occuring with -log before
5717 5722 (thanks to Jim Boyle).
5718 5723
5719 5724 2002-05-01 Fernando Perez <fperez@colorado.edu>
5720 5725
5721 5726 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5722 5727 was nasty -- though somewhat of a corner case).
5723 5728
5724 5729 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5725 5730 text (was a bug).
5726 5731
5727 5732 2002-04-30 Fernando Perez <fperez@colorado.edu>
5728 5733
5729 5734 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5730 5735 a print after ^D or ^C from the user so that the In[] prompt
5731 5736 doesn't over-run the gnuplot one.
5732 5737
5733 5738 2002-04-29 Fernando Perez <fperez@colorado.edu>
5734 5739
5735 5740 * Released 0.2.10
5736 5741
5737 5742 * IPython/__release__.py (version): get date dynamically.
5738 5743
5739 5744 * Misc. documentation updates thanks to Arnd's comments. Also ran
5740 5745 a full spellcheck on the manual (hadn't been done in a while).
5741 5746
5742 5747 2002-04-27 Fernando Perez <fperez@colorado.edu>
5743 5748
5744 5749 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5745 5750 starting a log in mid-session would reset the input history list.
5746 5751
5747 5752 2002-04-26 Fernando Perez <fperez@colorado.edu>
5748 5753
5749 5754 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5750 5755 all files were being included in an update. Now anything in
5751 5756 UserConfig that matches [A-Za-z]*.py will go (this excludes
5752 5757 __init__.py)
5753 5758
5754 5759 2002-04-25 Fernando Perez <fperez@colorado.edu>
5755 5760
5756 5761 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5757 5762 to __builtins__ so that any form of embedded or imported code can
5758 5763 test for being inside IPython.
5759 5764
5760 5765 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5761 5766 changed to GnuplotMagic because it's now an importable module,
5762 5767 this makes the name follow that of the standard Gnuplot module.
5763 5768 GnuplotMagic can now be loaded at any time in mid-session.
5764 5769
5765 5770 2002-04-24 Fernando Perez <fperez@colorado.edu>
5766 5771
5767 5772 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5768 5773 the globals (IPython has its own namespace) and the
5769 5774 PhysicalQuantity stuff is much better anyway.
5770 5775
5771 5776 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5772 5777 embedding example to standard user directory for
5773 5778 distribution. Also put it in the manual.
5774 5779
5775 5780 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5776 5781 instance as first argument (so it doesn't rely on some obscure
5777 5782 hidden global).
5778 5783
5779 5784 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5780 5785 delimiters. While it prevents ().TAB from working, it allows
5781 5786 completions in open (... expressions. This is by far a more common
5782 5787 case.
5783 5788
5784 5789 2002-04-23 Fernando Perez <fperez@colorado.edu>
5785 5790
5786 5791 * IPython/Extensions/InterpreterPasteInput.py: new
5787 5792 syntax-processing module for pasting lines with >>> or ... at the
5788 5793 start.
5789 5794
5790 5795 * IPython/Extensions/PhysicalQ_Interactive.py
5791 5796 (PhysicalQuantityInteractive.__int__): fixed to work with either
5792 5797 Numeric or math.
5793 5798
5794 5799 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5795 5800 provided profiles. Now we have:
5796 5801 -math -> math module as * and cmath with its own namespace.
5797 5802 -numeric -> Numeric as *, plus gnuplot & grace
5798 5803 -physics -> same as before
5799 5804
5800 5805 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5801 5806 user-defined magics wouldn't be found by @magic if they were
5802 5807 defined as class methods. Also cleaned up the namespace search
5803 5808 logic and the string building (to use %s instead of many repeated
5804 5809 string adds).
5805 5810
5806 5811 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5807 5812 of user-defined magics to operate with class methods (cleaner, in
5808 5813 line with the gnuplot code).
5809 5814
5810 5815 2002-04-22 Fernando Perez <fperez@colorado.edu>
5811 5816
5812 5817 * setup.py: updated dependency list so that manual is updated when
5813 5818 all included files change.
5814 5819
5815 5820 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5816 5821 the delimiter removal option (the fix is ugly right now).
5817 5822
5818 5823 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5819 5824 all of the math profile (quicker loading, no conflict between
5820 5825 g-9.8 and g-gnuplot).
5821 5826
5822 5827 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5823 5828 name of post-mortem files to IPython_crash_report.txt.
5824 5829
5825 5830 * Cleanup/update of the docs. Added all the new readline info and
5826 5831 formatted all lists as 'real lists'.
5827 5832
5828 5833 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5829 5834 tab-completion options, since the full readline parse_and_bind is
5830 5835 now accessible.
5831 5836
5832 5837 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5833 5838 handling of readline options. Now users can specify any string to
5834 5839 be passed to parse_and_bind(), as well as the delimiters to be
5835 5840 removed.
5836 5841 (InteractiveShell.__init__): Added __name__ to the global
5837 5842 namespace so that things like Itpl which rely on its existence
5838 5843 don't crash.
5839 5844 (InteractiveShell._prefilter): Defined the default with a _ so
5840 5845 that prefilter() is easier to override, while the default one
5841 5846 remains available.
5842 5847
5843 5848 2002-04-18 Fernando Perez <fperez@colorado.edu>
5844 5849
5845 5850 * Added information about pdb in the docs.
5846 5851
5847 5852 2002-04-17 Fernando Perez <fperez@colorado.edu>
5848 5853
5849 5854 * IPython/ipmaker.py (make_IPython): added rc_override option to
5850 5855 allow passing config options at creation time which may override
5851 5856 anything set in the config files or command line. This is
5852 5857 particularly useful for configuring embedded instances.
5853 5858
5854 5859 2002-04-15 Fernando Perez <fperez@colorado.edu>
5855 5860
5856 5861 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5857 5862 crash embedded instances because of the input cache falling out of
5858 5863 sync with the output counter.
5859 5864
5860 5865 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5861 5866 mode which calls pdb after an uncaught exception in IPython itself.
5862 5867
5863 5868 2002-04-14 Fernando Perez <fperez@colorado.edu>
5864 5869
5865 5870 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5866 5871 readline, fix it back after each call.
5867 5872
5868 5873 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5869 5874 method to force all access via __call__(), which guarantees that
5870 5875 traceback references are properly deleted.
5871 5876
5872 5877 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5873 5878 improve printing when pprint is in use.
5874 5879
5875 5880 2002-04-13 Fernando Perez <fperez@colorado.edu>
5876 5881
5877 5882 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5878 5883 exceptions aren't caught anymore. If the user triggers one, he
5879 5884 should know why he's doing it and it should go all the way up,
5880 5885 just like any other exception. So now @abort will fully kill the
5881 5886 embedded interpreter and the embedding code (unless that happens
5882 5887 to catch SystemExit).
5883 5888
5884 5889 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5885 5890 and a debugger() method to invoke the interactive pdb debugger
5886 5891 after printing exception information. Also added the corresponding
5887 5892 -pdb option and @pdb magic to control this feature, and updated
5888 5893 the docs. After a suggestion from Christopher Hart
5889 5894 (hart-AT-caltech.edu).
5890 5895
5891 5896 2002-04-12 Fernando Perez <fperez@colorado.edu>
5892 5897
5893 5898 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5894 5899 the exception handlers defined by the user (not the CrashHandler)
5895 5900 so that user exceptions don't trigger an ipython bug report.
5896 5901
5897 5902 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5898 5903 configurable (it should have always been so).
5899 5904
5900 5905 2002-03-26 Fernando Perez <fperez@colorado.edu>
5901 5906
5902 5907 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5903 5908 and there to fix embedding namespace issues. This should all be
5904 5909 done in a more elegant way.
5905 5910
5906 5911 2002-03-25 Fernando Perez <fperez@colorado.edu>
5907 5912
5908 5913 * IPython/genutils.py (get_home_dir): Try to make it work under
5909 5914 win9x also.
5910 5915
5911 5916 2002-03-20 Fernando Perez <fperez@colorado.edu>
5912 5917
5913 5918 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5914 5919 sys.displayhook untouched upon __init__.
5915 5920
5916 5921 2002-03-19 Fernando Perez <fperez@colorado.edu>
5917 5922
5918 5923 * Released 0.2.9 (for embedding bug, basically).
5919 5924
5920 5925 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5921 5926 exceptions so that enclosing shell's state can be restored.
5922 5927
5923 5928 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5924 5929 naming conventions in the .ipython/ dir.
5925 5930
5926 5931 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5927 5932 from delimiters list so filenames with - in them get expanded.
5928 5933
5929 5934 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5930 5935 sys.displayhook not being properly restored after an embedded call.
5931 5936
5932 5937 2002-03-18 Fernando Perez <fperez@colorado.edu>
5933 5938
5934 5939 * Released 0.2.8
5935 5940
5936 5941 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5937 5942 some files weren't being included in a -upgrade.
5938 5943 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5939 5944 on' so that the first tab completes.
5940 5945 (InteractiveShell.handle_magic): fixed bug with spaces around
5941 5946 quotes breaking many magic commands.
5942 5947
5943 5948 * setup.py: added note about ignoring the syntax error messages at
5944 5949 installation.
5945 5950
5946 5951 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5947 5952 streamlining the gnuplot interface, now there's only one magic @gp.
5948 5953
5949 5954 2002-03-17 Fernando Perez <fperez@colorado.edu>
5950 5955
5951 5956 * IPython/UserConfig/magic_gnuplot.py: new name for the
5952 5957 example-magic_pm.py file. Much enhanced system, now with a shell
5953 5958 for communicating directly with gnuplot, one command at a time.
5954 5959
5955 5960 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5956 5961 setting __name__=='__main__'.
5957 5962
5958 5963 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5959 5964 mini-shell for accessing gnuplot from inside ipython. Should
5960 5965 extend it later for grace access too. Inspired by Arnd's
5961 5966 suggestion.
5962 5967
5963 5968 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5964 5969 calling magic functions with () in their arguments. Thanks to Arnd
5965 5970 Baecker for pointing this to me.
5966 5971
5967 5972 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5968 5973 infinitely for integer or complex arrays (only worked with floats).
5969 5974
5970 5975 2002-03-16 Fernando Perez <fperez@colorado.edu>
5971 5976
5972 5977 * setup.py: Merged setup and setup_windows into a single script
5973 5978 which properly handles things for windows users.
5974 5979
5975 5980 2002-03-15 Fernando Perez <fperez@colorado.edu>
5976 5981
5977 5982 * Big change to the manual: now the magics are all automatically
5978 5983 documented. This information is generated from their docstrings
5979 5984 and put in a latex file included by the manual lyx file. This way
5980 5985 we get always up to date information for the magics. The manual
5981 5986 now also has proper version information, also auto-synced.
5982 5987
5983 5988 For this to work, an undocumented --magic_docstrings option was added.
5984 5989
5985 5990 2002-03-13 Fernando Perez <fperez@colorado.edu>
5986 5991
5987 5992 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5988 5993 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5989 5994
5990 5995 2002-03-12 Fernando Perez <fperez@colorado.edu>
5991 5996
5992 5997 * IPython/ultraTB.py (TermColors): changed color escapes again to
5993 5998 fix the (old, reintroduced) line-wrapping bug. Basically, if
5994 5999 \001..\002 aren't given in the color escapes, lines get wrapped
5995 6000 weirdly. But giving those screws up old xterms and emacs terms. So
5996 6001 I added some logic for emacs terms to be ok, but I can't identify old
5997 6002 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5998 6003
5999 6004 2002-03-10 Fernando Perez <fperez@colorado.edu>
6000 6005
6001 6006 * IPython/usage.py (__doc__): Various documentation cleanups and
6002 6007 updates, both in usage docstrings and in the manual.
6003 6008
6004 6009 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6005 6010 handling of caching. Set minimum acceptabe value for having a
6006 6011 cache at 20 values.
6007 6012
6008 6013 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6009 6014 install_first_time function to a method, renamed it and added an
6010 6015 'upgrade' mode. Now people can update their config directory with
6011 6016 a simple command line switch (-upgrade, also new).
6012 6017
6013 6018 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6014 6019 @file (convenient for automagic users under Python >= 2.2).
6015 6020 Removed @files (it seemed more like a plural than an abbrev. of
6016 6021 'file show').
6017 6022
6018 6023 * IPython/iplib.py (install_first_time): Fixed crash if there were
6019 6024 backup files ('~') in .ipython/ install directory.
6020 6025
6021 6026 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6022 6027 system. Things look fine, but these changes are fairly
6023 6028 intrusive. Test them for a few days.
6024 6029
6025 6030 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6026 6031 the prompts system. Now all in/out prompt strings are user
6027 6032 controllable. This is particularly useful for embedding, as one
6028 6033 can tag embedded instances with particular prompts.
6029 6034
6030 6035 Also removed global use of sys.ps1/2, which now allows nested
6031 6036 embeddings without any problems. Added command-line options for
6032 6037 the prompt strings.
6033 6038
6034 6039 2002-03-08 Fernando Perez <fperez@colorado.edu>
6035 6040
6036 6041 * IPython/UserConfig/example-embed-short.py (ipshell): added
6037 6042 example file with the bare minimum code for embedding.
6038 6043
6039 6044 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6040 6045 functionality for the embeddable shell to be activated/deactivated
6041 6046 either globally or at each call.
6042 6047
6043 6048 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6044 6049 rewriting the prompt with '--->' for auto-inputs with proper
6045 6050 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6046 6051 this is handled by the prompts class itself, as it should.
6047 6052
6048 6053 2002-03-05 Fernando Perez <fperez@colorado.edu>
6049 6054
6050 6055 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6051 6056 @logstart to avoid name clashes with the math log function.
6052 6057
6053 6058 * Big updates to X/Emacs section of the manual.
6054 6059
6055 6060 * Removed ipython_emacs. Milan explained to me how to pass
6056 6061 arguments to ipython through Emacs. Some day I'm going to end up
6057 6062 learning some lisp...
6058 6063
6059 6064 2002-03-04 Fernando Perez <fperez@colorado.edu>
6060 6065
6061 6066 * IPython/ipython_emacs: Created script to be used as the
6062 6067 py-python-command Emacs variable so we can pass IPython
6063 6068 parameters. I can't figure out how to tell Emacs directly to pass
6064 6069 parameters to IPython, so a dummy shell script will do it.
6065 6070
6066 6071 Other enhancements made for things to work better under Emacs'
6067 6072 various types of terminals. Many thanks to Milan Zamazal
6068 6073 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6069 6074
6070 6075 2002-03-01 Fernando Perez <fperez@colorado.edu>
6071 6076
6072 6077 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6073 6078 that loading of readline is now optional. This gives better
6074 6079 control to emacs users.
6075 6080
6076 6081 * IPython/ultraTB.py (__date__): Modified color escape sequences
6077 6082 and now things work fine under xterm and in Emacs' term buffers
6078 6083 (though not shell ones). Well, in emacs you get colors, but all
6079 6084 seem to be 'light' colors (no difference between dark and light
6080 6085 ones). But the garbage chars are gone, and also in xterms. It
6081 6086 seems that now I'm using 'cleaner' ansi sequences.
6082 6087
6083 6088 2002-02-21 Fernando Perez <fperez@colorado.edu>
6084 6089
6085 6090 * Released 0.2.7 (mainly to publish the scoping fix).
6086 6091
6087 6092 * IPython/Logger.py (Logger.logstate): added. A corresponding
6088 6093 @logstate magic was created.
6089 6094
6090 6095 * IPython/Magic.py: fixed nested scoping problem under Python
6091 6096 2.1.x (automagic wasn't working).
6092 6097
6093 6098 2002-02-20 Fernando Perez <fperez@colorado.edu>
6094 6099
6095 6100 * Released 0.2.6.
6096 6101
6097 6102 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6098 6103 option so that logs can come out without any headers at all.
6099 6104
6100 6105 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6101 6106 SciPy.
6102 6107
6103 6108 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6104 6109 that embedded IPython calls don't require vars() to be explicitly
6105 6110 passed. Now they are extracted from the caller's frame (code
6106 6111 snatched from Eric Jones' weave). Added better documentation to
6107 6112 the section on embedding and the example file.
6108 6113
6109 6114 * IPython/genutils.py (page): Changed so that under emacs, it just
6110 6115 prints the string. You can then page up and down in the emacs
6111 6116 buffer itself. This is how the builtin help() works.
6112 6117
6113 6118 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6114 6119 macro scoping: macros need to be executed in the user's namespace
6115 6120 to work as if they had been typed by the user.
6116 6121
6117 6122 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6118 6123 execute automatically (no need to type 'exec...'). They then
6119 6124 behave like 'true macros'. The printing system was also modified
6120 6125 for this to work.
6121 6126
6122 6127 2002-02-19 Fernando Perez <fperez@colorado.edu>
6123 6128
6124 6129 * IPython/genutils.py (page_file): new function for paging files
6125 6130 in an OS-independent way. Also necessary for file viewing to work
6126 6131 well inside Emacs buffers.
6127 6132 (page): Added checks for being in an emacs buffer.
6128 6133 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6129 6134 same bug in iplib.
6130 6135
6131 6136 2002-02-18 Fernando Perez <fperez@colorado.edu>
6132 6137
6133 6138 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6134 6139 of readline so that IPython can work inside an Emacs buffer.
6135 6140
6136 6141 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6137 6142 method signatures (they weren't really bugs, but it looks cleaner
6138 6143 and keeps PyChecker happy).
6139 6144
6140 6145 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6141 6146 for implementing various user-defined hooks. Currently only
6142 6147 display is done.
6143 6148
6144 6149 * IPython/Prompts.py (CachedOutput._display): changed display
6145 6150 functions so that they can be dynamically changed by users easily.
6146 6151
6147 6152 * IPython/Extensions/numeric_formats.py (num_display): added an
6148 6153 extension for printing NumPy arrays in flexible manners. It
6149 6154 doesn't do anything yet, but all the structure is in
6150 6155 place. Ultimately the plan is to implement output format control
6151 6156 like in Octave.
6152 6157
6153 6158 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6154 6159 methods are found at run-time by all the automatic machinery.
6155 6160
6156 6161 2002-02-17 Fernando Perez <fperez@colorado.edu>
6157 6162
6158 6163 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6159 6164 whole file a little.
6160 6165
6161 6166 * ToDo: closed this document. Now there's a new_design.lyx
6162 6167 document for all new ideas. Added making a pdf of it for the
6163 6168 end-user distro.
6164 6169
6165 6170 * IPython/Logger.py (Logger.switch_log): Created this to replace
6166 6171 logon() and logoff(). It also fixes a nasty crash reported by
6167 6172 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6168 6173
6169 6174 * IPython/iplib.py (complete): got auto-completion to work with
6170 6175 automagic (I had wanted this for a long time).
6171 6176
6172 6177 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6173 6178 to @file, since file() is now a builtin and clashes with automagic
6174 6179 for @file.
6175 6180
6176 6181 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6177 6182 of this was previously in iplib, which had grown to more than 2000
6178 6183 lines, way too long. No new functionality, but it makes managing
6179 6184 the code a bit easier.
6180 6185
6181 6186 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6182 6187 information to crash reports.
6183 6188
6184 6189 2002-02-12 Fernando Perez <fperez@colorado.edu>
6185 6190
6186 6191 * Released 0.2.5.
6187 6192
6188 6193 2002-02-11 Fernando Perez <fperez@colorado.edu>
6189 6194
6190 6195 * Wrote a relatively complete Windows installer. It puts
6191 6196 everything in place, creates Start Menu entries and fixes the
6192 6197 color issues. Nothing fancy, but it works.
6193 6198
6194 6199 2002-02-10 Fernando Perez <fperez@colorado.edu>
6195 6200
6196 6201 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6197 6202 os.path.expanduser() call so that we can type @run ~/myfile.py and
6198 6203 have thigs work as expected.
6199 6204
6200 6205 * IPython/genutils.py (page): fixed exception handling so things
6201 6206 work both in Unix and Windows correctly. Quitting a pager triggers
6202 6207 an IOError/broken pipe in Unix, and in windows not finding a pager
6203 6208 is also an IOError, so I had to actually look at the return value
6204 6209 of the exception, not just the exception itself. Should be ok now.
6205 6210
6206 6211 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6207 6212 modified to allow case-insensitive color scheme changes.
6208 6213
6209 6214 2002-02-09 Fernando Perez <fperez@colorado.edu>
6210 6215
6211 6216 * IPython/genutils.py (native_line_ends): new function to leave
6212 6217 user config files with os-native line-endings.
6213 6218
6214 6219 * README and manual updates.
6215 6220
6216 6221 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6217 6222 instead of StringType to catch Unicode strings.
6218 6223
6219 6224 * IPython/genutils.py (filefind): fixed bug for paths with
6220 6225 embedded spaces (very common in Windows).
6221 6226
6222 6227 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6223 6228 files under Windows, so that they get automatically associated
6224 6229 with a text editor. Windows makes it a pain to handle
6225 6230 extension-less files.
6226 6231
6227 6232 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6228 6233 warning about readline only occur for Posix. In Windows there's no
6229 6234 way to get readline, so why bother with the warning.
6230 6235
6231 6236 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6232 6237 for __str__ instead of dir(self), since dir() changed in 2.2.
6233 6238
6234 6239 * Ported to Windows! Tested on XP, I suspect it should work fine
6235 6240 on NT/2000, but I don't think it will work on 98 et al. That
6236 6241 series of Windows is such a piece of junk anyway that I won't try
6237 6242 porting it there. The XP port was straightforward, showed a few
6238 6243 bugs here and there (fixed all), in particular some string
6239 6244 handling stuff which required considering Unicode strings (which
6240 6245 Windows uses). This is good, but hasn't been too tested :) No
6241 6246 fancy installer yet, I'll put a note in the manual so people at
6242 6247 least make manually a shortcut.
6243 6248
6244 6249 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6245 6250 into a single one, "colors". This now controls both prompt and
6246 6251 exception color schemes, and can be changed both at startup
6247 6252 (either via command-line switches or via ipythonrc files) and at
6248 6253 runtime, with @colors.
6249 6254 (Magic.magic_run): renamed @prun to @run and removed the old
6250 6255 @run. The two were too similar to warrant keeping both.
6251 6256
6252 6257 2002-02-03 Fernando Perez <fperez@colorado.edu>
6253 6258
6254 6259 * IPython/iplib.py (install_first_time): Added comment on how to
6255 6260 configure the color options for first-time users. Put a <return>
6256 6261 request at the end so that small-terminal users get a chance to
6257 6262 read the startup info.
6258 6263
6259 6264 2002-01-23 Fernando Perez <fperez@colorado.edu>
6260 6265
6261 6266 * IPython/iplib.py (CachedOutput.update): Changed output memory
6262 6267 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6263 6268 input history we still use _i. Did this b/c these variable are
6264 6269 very commonly used in interactive work, so the less we need to
6265 6270 type the better off we are.
6266 6271 (Magic.magic_prun): updated @prun to better handle the namespaces
6267 6272 the file will run in, including a fix for __name__ not being set
6268 6273 before.
6269 6274
6270 6275 2002-01-20 Fernando Perez <fperez@colorado.edu>
6271 6276
6272 6277 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6273 6278 extra garbage for Python 2.2. Need to look more carefully into
6274 6279 this later.
6275 6280
6276 6281 2002-01-19 Fernando Perez <fperez@colorado.edu>
6277 6282
6278 6283 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6279 6284 display SyntaxError exceptions properly formatted when they occur
6280 6285 (they can be triggered by imported code).
6281 6286
6282 6287 2002-01-18 Fernando Perez <fperez@colorado.edu>
6283 6288
6284 6289 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6285 6290 SyntaxError exceptions are reported nicely formatted, instead of
6286 6291 spitting out only offset information as before.
6287 6292 (Magic.magic_prun): Added the @prun function for executing
6288 6293 programs with command line args inside IPython.
6289 6294
6290 6295 2002-01-16 Fernando Perez <fperez@colorado.edu>
6291 6296
6292 6297 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6293 6298 to *not* include the last item given in a range. This brings their
6294 6299 behavior in line with Python's slicing:
6295 6300 a[n1:n2] -> a[n1]...a[n2-1]
6296 6301 It may be a bit less convenient, but I prefer to stick to Python's
6297 6302 conventions *everywhere*, so users never have to wonder.
6298 6303 (Magic.magic_macro): Added @macro function to ease the creation of
6299 6304 macros.
6300 6305
6301 6306 2002-01-05 Fernando Perez <fperez@colorado.edu>
6302 6307
6303 6308 * Released 0.2.4.
6304 6309
6305 6310 * IPython/iplib.py (Magic.magic_pdef):
6306 6311 (InteractiveShell.safe_execfile): report magic lines and error
6307 6312 lines without line numbers so one can easily copy/paste them for
6308 6313 re-execution.
6309 6314
6310 6315 * Updated manual with recent changes.
6311 6316
6312 6317 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6313 6318 docstring printing when class? is called. Very handy for knowing
6314 6319 how to create class instances (as long as __init__ is well
6315 6320 documented, of course :)
6316 6321 (Magic.magic_doc): print both class and constructor docstrings.
6317 6322 (Magic.magic_pdef): give constructor info if passed a class and
6318 6323 __call__ info for callable object instances.
6319 6324
6320 6325 2002-01-04 Fernando Perez <fperez@colorado.edu>
6321 6326
6322 6327 * Made deep_reload() off by default. It doesn't always work
6323 6328 exactly as intended, so it's probably safer to have it off. It's
6324 6329 still available as dreload() anyway, so nothing is lost.
6325 6330
6326 6331 2002-01-02 Fernando Perez <fperez@colorado.edu>
6327 6332
6328 6333 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6329 6334 so I wanted an updated release).
6330 6335
6331 6336 2001-12-27 Fernando Perez <fperez@colorado.edu>
6332 6337
6333 6338 * IPython/iplib.py (InteractiveShell.interact): Added the original
6334 6339 code from 'code.py' for this module in order to change the
6335 6340 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6336 6341 the history cache would break when the user hit Ctrl-C, and
6337 6342 interact() offers no way to add any hooks to it.
6338 6343
6339 6344 2001-12-23 Fernando Perez <fperez@colorado.edu>
6340 6345
6341 6346 * setup.py: added check for 'MANIFEST' before trying to remove
6342 6347 it. Thanks to Sean Reifschneider.
6343 6348
6344 6349 2001-12-22 Fernando Perez <fperez@colorado.edu>
6345 6350
6346 6351 * Released 0.2.2.
6347 6352
6348 6353 * Finished (reasonably) writing the manual. Later will add the
6349 6354 python-standard navigation stylesheets, but for the time being
6350 6355 it's fairly complete. Distribution will include html and pdf
6351 6356 versions.
6352 6357
6353 6358 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6354 6359 (MayaVi author).
6355 6360
6356 6361 2001-12-21 Fernando Perez <fperez@colorado.edu>
6357 6362
6358 6363 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6359 6364 good public release, I think (with the manual and the distutils
6360 6365 installer). The manual can use some work, but that can go
6361 6366 slowly. Otherwise I think it's quite nice for end users. Next
6362 6367 summer, rewrite the guts of it...
6363 6368
6364 6369 * Changed format of ipythonrc files to use whitespace as the
6365 6370 separator instead of an explicit '='. Cleaner.
6366 6371
6367 6372 2001-12-20 Fernando Perez <fperez@colorado.edu>
6368 6373
6369 6374 * Started a manual in LyX. For now it's just a quick merge of the
6370 6375 various internal docstrings and READMEs. Later it may grow into a
6371 6376 nice, full-blown manual.
6372 6377
6373 6378 * Set up a distutils based installer. Installation should now be
6374 6379 trivially simple for end-users.
6375 6380
6376 6381 2001-12-11 Fernando Perez <fperez@colorado.edu>
6377 6382
6378 6383 * Released 0.2.0. First public release, announced it at
6379 6384 comp.lang.python. From now on, just bugfixes...
6380 6385
6381 6386 * Went through all the files, set copyright/license notices and
6382 6387 cleaned up things. Ready for release.
6383 6388
6384 6389 2001-12-10 Fernando Perez <fperez@colorado.edu>
6385 6390
6386 6391 * Changed the first-time installer not to use tarfiles. It's more
6387 6392 robust now and less unix-dependent. Also makes it easier for
6388 6393 people to later upgrade versions.
6389 6394
6390 6395 * Changed @exit to @abort to reflect the fact that it's pretty
6391 6396 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6392 6397 becomes significant only when IPyhton is embedded: in that case,
6393 6398 C-D closes IPython only, but @abort kills the enclosing program
6394 6399 too (unless it had called IPython inside a try catching
6395 6400 SystemExit).
6396 6401
6397 6402 * Created Shell module which exposes the actuall IPython Shell
6398 6403 classes, currently the normal and the embeddable one. This at
6399 6404 least offers a stable interface we won't need to change when
6400 6405 (later) the internals are rewritten. That rewrite will be confined
6401 6406 to iplib and ipmaker, but the Shell interface should remain as is.
6402 6407
6403 6408 * Added embed module which offers an embeddable IPShell object,
6404 6409 useful to fire up IPython *inside* a running program. Great for
6405 6410 debugging or dynamical data analysis.
6406 6411
6407 6412 2001-12-08 Fernando Perez <fperez@colorado.edu>
6408 6413
6409 6414 * Fixed small bug preventing seeing info from methods of defined
6410 6415 objects (incorrect namespace in _ofind()).
6411 6416
6412 6417 * Documentation cleanup. Moved the main usage docstrings to a
6413 6418 separate file, usage.py (cleaner to maintain, and hopefully in the
6414 6419 future some perlpod-like way of producing interactive, man and
6415 6420 html docs out of it will be found).
6416 6421
6417 6422 * Added @profile to see your profile at any time.
6418 6423
6419 6424 * Added @p as an alias for 'print'. It's especially convenient if
6420 6425 using automagic ('p x' prints x).
6421 6426
6422 6427 * Small cleanups and fixes after a pychecker run.
6423 6428
6424 6429 * Changed the @cd command to handle @cd - and @cd -<n> for
6425 6430 visiting any directory in _dh.
6426 6431
6427 6432 * Introduced _dh, a history of visited directories. @dhist prints
6428 6433 it out with numbers.
6429 6434
6430 6435 2001-12-07 Fernando Perez <fperez@colorado.edu>
6431 6436
6432 6437 * Released 0.1.22
6433 6438
6434 6439 * Made initialization a bit more robust against invalid color
6435 6440 options in user input (exit, not traceback-crash).
6436 6441
6437 6442 * Changed the bug crash reporter to write the report only in the
6438 6443 user's .ipython directory. That way IPython won't litter people's
6439 6444 hard disks with crash files all over the place. Also print on
6440 6445 screen the necessary mail command.
6441 6446
6442 6447 * With the new ultraTB, implemented LightBG color scheme for light
6443 6448 background terminals. A lot of people like white backgrounds, so I
6444 6449 guess we should at least give them something readable.
6445 6450
6446 6451 2001-12-06 Fernando Perez <fperez@colorado.edu>
6447 6452
6448 6453 * Modified the structure of ultraTB. Now there's a proper class
6449 6454 for tables of color schemes which allow adding schemes easily and
6450 6455 switching the active scheme without creating a new instance every
6451 6456 time (which was ridiculous). The syntax for creating new schemes
6452 6457 is also cleaner. I think ultraTB is finally done, with a clean
6453 6458 class structure. Names are also much cleaner (now there's proper
6454 6459 color tables, no need for every variable to also have 'color' in
6455 6460 its name).
6456 6461
6457 6462 * Broke down genutils into separate files. Now genutils only
6458 6463 contains utility functions, and classes have been moved to their
6459 6464 own files (they had enough independent functionality to warrant
6460 6465 it): ConfigLoader, OutputTrap, Struct.
6461 6466
6462 6467 2001-12-05 Fernando Perez <fperez@colorado.edu>
6463 6468
6464 6469 * IPython turns 21! Released version 0.1.21, as a candidate for
6465 6470 public consumption. If all goes well, release in a few days.
6466 6471
6467 6472 * Fixed path bug (files in Extensions/ directory wouldn't be found
6468 6473 unless IPython/ was explicitly in sys.path).
6469 6474
6470 6475 * Extended the FlexCompleter class as MagicCompleter to allow
6471 6476 completion of @-starting lines.
6472 6477
6473 6478 * Created __release__.py file as a central repository for release
6474 6479 info that other files can read from.
6475 6480
6476 6481 * Fixed small bug in logging: when logging was turned on in
6477 6482 mid-session, old lines with special meanings (!@?) were being
6478 6483 logged without the prepended comment, which is necessary since
6479 6484 they are not truly valid python syntax. This should make session
6480 6485 restores produce less errors.
6481 6486
6482 6487 * The namespace cleanup forced me to make a FlexCompleter class
6483 6488 which is nothing but a ripoff of rlcompleter, but with selectable
6484 6489 namespace (rlcompleter only works in __main__.__dict__). I'll try
6485 6490 to submit a note to the authors to see if this change can be
6486 6491 incorporated in future rlcompleter releases (Dec.6: done)
6487 6492
6488 6493 * More fixes to namespace handling. It was a mess! Now all
6489 6494 explicit references to __main__.__dict__ are gone (except when
6490 6495 really needed) and everything is handled through the namespace
6491 6496 dicts in the IPython instance. We seem to be getting somewhere
6492 6497 with this, finally...
6493 6498
6494 6499 * Small documentation updates.
6495 6500
6496 6501 * Created the Extensions directory under IPython (with an
6497 6502 __init__.py). Put the PhysicalQ stuff there. This directory should
6498 6503 be used for all special-purpose extensions.
6499 6504
6500 6505 * File renaming:
6501 6506 ipythonlib --> ipmaker
6502 6507 ipplib --> iplib
6503 6508 This makes a bit more sense in terms of what these files actually do.
6504 6509
6505 6510 * Moved all the classes and functions in ipythonlib to ipplib, so
6506 6511 now ipythonlib only has make_IPython(). This will ease up its
6507 6512 splitting in smaller functional chunks later.
6508 6513
6509 6514 * Cleaned up (done, I think) output of @whos. Better column
6510 6515 formatting, and now shows str(var) for as much as it can, which is
6511 6516 typically what one gets with a 'print var'.
6512 6517
6513 6518 2001-12-04 Fernando Perez <fperez@colorado.edu>
6514 6519
6515 6520 * Fixed namespace problems. Now builtin/IPyhton/user names get
6516 6521 properly reported in their namespace. Internal namespace handling
6517 6522 is finally getting decent (not perfect yet, but much better than
6518 6523 the ad-hoc mess we had).
6519 6524
6520 6525 * Removed -exit option. If people just want to run a python
6521 6526 script, that's what the normal interpreter is for. Less
6522 6527 unnecessary options, less chances for bugs.
6523 6528
6524 6529 * Added a crash handler which generates a complete post-mortem if
6525 6530 IPython crashes. This will help a lot in tracking bugs down the
6526 6531 road.
6527 6532
6528 6533 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6529 6534 which were boud to functions being reassigned would bypass the
6530 6535 logger, breaking the sync of _il with the prompt counter. This
6531 6536 would then crash IPython later when a new line was logged.
6532 6537
6533 6538 2001-12-02 Fernando Perez <fperez@colorado.edu>
6534 6539
6535 6540 * Made IPython a package. This means people don't have to clutter
6536 6541 their sys.path with yet another directory. Changed the INSTALL
6537 6542 file accordingly.
6538 6543
6539 6544 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6540 6545 sorts its output (so @who shows it sorted) and @whos formats the
6541 6546 table according to the width of the first column. Nicer, easier to
6542 6547 read. Todo: write a generic table_format() which takes a list of
6543 6548 lists and prints it nicely formatted, with optional row/column
6544 6549 separators and proper padding and justification.
6545 6550
6546 6551 * Released 0.1.20
6547 6552
6548 6553 * Fixed bug in @log which would reverse the inputcache list (a
6549 6554 copy operation was missing).
6550 6555
6551 6556 * Code cleanup. @config was changed to use page(). Better, since
6552 6557 its output is always quite long.
6553 6558
6554 6559 * Itpl is back as a dependency. I was having too many problems
6555 6560 getting the parametric aliases to work reliably, and it's just
6556 6561 easier to code weird string operations with it than playing %()s
6557 6562 games. It's only ~6k, so I don't think it's too big a deal.
6558 6563
6559 6564 * Found (and fixed) a very nasty bug with history. !lines weren't
6560 6565 getting cached, and the out of sync caches would crash
6561 6566 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6562 6567 division of labor a bit better. Bug fixed, cleaner structure.
6563 6568
6564 6569 2001-12-01 Fernando Perez <fperez@colorado.edu>
6565 6570
6566 6571 * Released 0.1.19
6567 6572
6568 6573 * Added option -n to @hist to prevent line number printing. Much
6569 6574 easier to copy/paste code this way.
6570 6575
6571 6576 * Created global _il to hold the input list. Allows easy
6572 6577 re-execution of blocks of code by slicing it (inspired by Janko's
6573 6578 comment on 'macros').
6574 6579
6575 6580 * Small fixes and doc updates.
6576 6581
6577 6582 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6578 6583 much too fragile with automagic. Handles properly multi-line
6579 6584 statements and takes parameters.
6580 6585
6581 6586 2001-11-30 Fernando Perez <fperez@colorado.edu>
6582 6587
6583 6588 * Version 0.1.18 released.
6584 6589
6585 6590 * Fixed nasty namespace bug in initial module imports.
6586 6591
6587 6592 * Added copyright/license notes to all code files (except
6588 6593 DPyGetOpt). For the time being, LGPL. That could change.
6589 6594
6590 6595 * Rewrote a much nicer README, updated INSTALL, cleaned up
6591 6596 ipythonrc-* samples.
6592 6597
6593 6598 * Overall code/documentation cleanup. Basically ready for
6594 6599 release. Only remaining thing: licence decision (LGPL?).
6595 6600
6596 6601 * Converted load_config to a class, ConfigLoader. Now recursion
6597 6602 control is better organized. Doesn't include the same file twice.
6598 6603
6599 6604 2001-11-29 Fernando Perez <fperez@colorado.edu>
6600 6605
6601 6606 * Got input history working. Changed output history variables from
6602 6607 _p to _o so that _i is for input and _o for output. Just cleaner
6603 6608 convention.
6604 6609
6605 6610 * Implemented parametric aliases. This pretty much allows the
6606 6611 alias system to offer full-blown shell convenience, I think.
6607 6612
6608 6613 * Version 0.1.17 released, 0.1.18 opened.
6609 6614
6610 6615 * dot_ipython/ipythonrc (alias): added documentation.
6611 6616 (xcolor): Fixed small bug (xcolors -> xcolor)
6612 6617
6613 6618 * Changed the alias system. Now alias is a magic command to define
6614 6619 aliases just like the shell. Rationale: the builtin magics should
6615 6620 be there for things deeply connected to IPython's
6616 6621 architecture. And this is a much lighter system for what I think
6617 6622 is the really important feature: allowing users to define quickly
6618 6623 magics that will do shell things for them, so they can customize
6619 6624 IPython easily to match their work habits. If someone is really
6620 6625 desperate to have another name for a builtin alias, they can
6621 6626 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6622 6627 works.
6623 6628
6624 6629 2001-11-28 Fernando Perez <fperez@colorado.edu>
6625 6630
6626 6631 * Changed @file so that it opens the source file at the proper
6627 6632 line. Since it uses less, if your EDITOR environment is
6628 6633 configured, typing v will immediately open your editor of choice
6629 6634 right at the line where the object is defined. Not as quick as
6630 6635 having a direct @edit command, but for all intents and purposes it
6631 6636 works. And I don't have to worry about writing @edit to deal with
6632 6637 all the editors, less does that.
6633 6638
6634 6639 * Version 0.1.16 released, 0.1.17 opened.
6635 6640
6636 6641 * Fixed some nasty bugs in the page/page_dumb combo that could
6637 6642 crash IPython.
6638 6643
6639 6644 2001-11-27 Fernando Perez <fperez@colorado.edu>
6640 6645
6641 6646 * Version 0.1.15 released, 0.1.16 opened.
6642 6647
6643 6648 * Finally got ? and ?? to work for undefined things: now it's
6644 6649 possible to type {}.get? and get information about the get method
6645 6650 of dicts, or os.path? even if only os is defined (so technically
6646 6651 os.path isn't). Works at any level. For example, after import os,
6647 6652 os?, os.path?, os.path.abspath? all work. This is great, took some
6648 6653 work in _ofind.
6649 6654
6650 6655 * Fixed more bugs with logging. The sanest way to do it was to add
6651 6656 to @log a 'mode' parameter. Killed two in one shot (this mode
6652 6657 option was a request of Janko's). I think it's finally clean
6653 6658 (famous last words).
6654 6659
6655 6660 * Added a page_dumb() pager which does a decent job of paging on
6656 6661 screen, if better things (like less) aren't available. One less
6657 6662 unix dependency (someday maybe somebody will port this to
6658 6663 windows).
6659 6664
6660 6665 * Fixed problem in magic_log: would lock of logging out if log
6661 6666 creation failed (because it would still think it had succeeded).
6662 6667
6663 6668 * Improved the page() function using curses to auto-detect screen
6664 6669 size. Now it can make a much better decision on whether to print
6665 6670 or page a string. Option screen_length was modified: a value 0
6666 6671 means auto-detect, and that's the default now.
6667 6672
6668 6673 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6669 6674 go out. I'll test it for a few days, then talk to Janko about
6670 6675 licences and announce it.
6671 6676
6672 6677 * Fixed the length of the auto-generated ---> prompt which appears
6673 6678 for auto-parens and auto-quotes. Getting this right isn't trivial,
6674 6679 with all the color escapes, different prompt types and optional
6675 6680 separators. But it seems to be working in all the combinations.
6676 6681
6677 6682 2001-11-26 Fernando Perez <fperez@colorado.edu>
6678 6683
6679 6684 * Wrote a regexp filter to get option types from the option names
6680 6685 string. This eliminates the need to manually keep two duplicate
6681 6686 lists.
6682 6687
6683 6688 * Removed the unneeded check_option_names. Now options are handled
6684 6689 in a much saner manner and it's easy to visually check that things
6685 6690 are ok.
6686 6691
6687 6692 * Updated version numbers on all files I modified to carry a
6688 6693 notice so Janko and Nathan have clear version markers.
6689 6694
6690 6695 * Updated docstring for ultraTB with my changes. I should send
6691 6696 this to Nathan.
6692 6697
6693 6698 * Lots of small fixes. Ran everything through pychecker again.
6694 6699
6695 6700 * Made loading of deep_reload an cmd line option. If it's not too
6696 6701 kosher, now people can just disable it. With -nodeep_reload it's
6697 6702 still available as dreload(), it just won't overwrite reload().
6698 6703
6699 6704 * Moved many options to the no| form (-opt and -noopt
6700 6705 accepted). Cleaner.
6701 6706
6702 6707 * Changed magic_log so that if called with no parameters, it uses
6703 6708 'rotate' mode. That way auto-generated logs aren't automatically
6704 6709 over-written. For normal logs, now a backup is made if it exists
6705 6710 (only 1 level of backups). A new 'backup' mode was added to the
6706 6711 Logger class to support this. This was a request by Janko.
6707 6712
6708 6713 * Added @logoff/@logon to stop/restart an active log.
6709 6714
6710 6715 * Fixed a lot of bugs in log saving/replay. It was pretty
6711 6716 broken. Now special lines (!@,/) appear properly in the command
6712 6717 history after a log replay.
6713 6718
6714 6719 * Tried and failed to implement full session saving via pickle. My
6715 6720 idea was to pickle __main__.__dict__, but modules can't be
6716 6721 pickled. This would be a better alternative to replaying logs, but
6717 6722 seems quite tricky to get to work. Changed -session to be called
6718 6723 -logplay, which more accurately reflects what it does. And if we
6719 6724 ever get real session saving working, -session is now available.
6720 6725
6721 6726 * Implemented color schemes for prompts also. As for tracebacks,
6722 6727 currently only NoColor and Linux are supported. But now the
6723 6728 infrastructure is in place, based on a generic ColorScheme
6724 6729 class. So writing and activating new schemes both for the prompts
6725 6730 and the tracebacks should be straightforward.
6726 6731
6727 6732 * Version 0.1.13 released, 0.1.14 opened.
6728 6733
6729 6734 * Changed handling of options for output cache. Now counter is
6730 6735 hardwired starting at 1 and one specifies the maximum number of
6731 6736 entries *in the outcache* (not the max prompt counter). This is
6732 6737 much better, since many statements won't increase the cache
6733 6738 count. It also eliminated some confusing options, now there's only
6734 6739 one: cache_size.
6735 6740
6736 6741 * Added 'alias' magic function and magic_alias option in the
6737 6742 ipythonrc file. Now the user can easily define whatever names he
6738 6743 wants for the magic functions without having to play weird
6739 6744 namespace games. This gives IPython a real shell-like feel.
6740 6745
6741 6746 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6742 6747 @ or not).
6743 6748
6744 6749 This was one of the last remaining 'visible' bugs (that I know
6745 6750 of). I think if I can clean up the session loading so it works
6746 6751 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6747 6752 about licensing).
6748 6753
6749 6754 2001-11-25 Fernando Perez <fperez@colorado.edu>
6750 6755
6751 6756 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6752 6757 there's a cleaner distinction between what ? and ?? show.
6753 6758
6754 6759 * Added screen_length option. Now the user can define his own
6755 6760 screen size for page() operations.
6756 6761
6757 6762 * Implemented magic shell-like functions with automatic code
6758 6763 generation. Now adding another function is just a matter of adding
6759 6764 an entry to a dict, and the function is dynamically generated at
6760 6765 run-time. Python has some really cool features!
6761 6766
6762 6767 * Renamed many options to cleanup conventions a little. Now all
6763 6768 are lowercase, and only underscores where needed. Also in the code
6764 6769 option name tables are clearer.
6765 6770
6766 6771 * Changed prompts a little. Now input is 'In [n]:' instead of
6767 6772 'In[n]:='. This allows it the numbers to be aligned with the
6768 6773 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6769 6774 Python (it was a Mathematica thing). The '...' continuation prompt
6770 6775 was also changed a little to align better.
6771 6776
6772 6777 * Fixed bug when flushing output cache. Not all _p<n> variables
6773 6778 exist, so their deletion needs to be wrapped in a try:
6774 6779
6775 6780 * Figured out how to properly use inspect.formatargspec() (it
6776 6781 requires the args preceded by *). So I removed all the code from
6777 6782 _get_pdef in Magic, which was just replicating that.
6778 6783
6779 6784 * Added test to prefilter to allow redefining magic function names
6780 6785 as variables. This is ok, since the @ form is always available,
6781 6786 but whe should allow the user to define a variable called 'ls' if
6782 6787 he needs it.
6783 6788
6784 6789 * Moved the ToDo information from README into a separate ToDo.
6785 6790
6786 6791 * General code cleanup and small bugfixes. I think it's close to a
6787 6792 state where it can be released, obviously with a big 'beta'
6788 6793 warning on it.
6789 6794
6790 6795 * Got the magic function split to work. Now all magics are defined
6791 6796 in a separate class. It just organizes things a bit, and now
6792 6797 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6793 6798 was too long).
6794 6799
6795 6800 * Changed @clear to @reset to avoid potential confusions with
6796 6801 the shell command clear. Also renamed @cl to @clear, which does
6797 6802 exactly what people expect it to from their shell experience.
6798 6803
6799 6804 Added a check to the @reset command (since it's so
6800 6805 destructive, it's probably a good idea to ask for confirmation).
6801 6806 But now reset only works for full namespace resetting. Since the
6802 6807 del keyword is already there for deleting a few specific
6803 6808 variables, I don't see the point of having a redundant magic
6804 6809 function for the same task.
6805 6810
6806 6811 2001-11-24 Fernando Perez <fperez@colorado.edu>
6807 6812
6808 6813 * Updated the builtin docs (esp. the ? ones).
6809 6814
6810 6815 * Ran all the code through pychecker. Not terribly impressed with
6811 6816 it: lots of spurious warnings and didn't really find anything of
6812 6817 substance (just a few modules being imported and not used).
6813 6818
6814 6819 * Implemented the new ultraTB functionality into IPython. New
6815 6820 option: xcolors. This chooses color scheme. xmode now only selects
6816 6821 between Plain and Verbose. Better orthogonality.
6817 6822
6818 6823 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6819 6824 mode and color scheme for the exception handlers. Now it's
6820 6825 possible to have the verbose traceback with no coloring.
6821 6826
6822 6827 2001-11-23 Fernando Perez <fperez@colorado.edu>
6823 6828
6824 6829 * Version 0.1.12 released, 0.1.13 opened.
6825 6830
6826 6831 * Removed option to set auto-quote and auto-paren escapes by
6827 6832 user. The chances of breaking valid syntax are just too high. If
6828 6833 someone *really* wants, they can always dig into the code.
6829 6834
6830 6835 * Made prompt separators configurable.
6831 6836
6832 6837 2001-11-22 Fernando Perez <fperez@colorado.edu>
6833 6838
6834 6839 * Small bugfixes in many places.
6835 6840
6836 6841 * Removed the MyCompleter class from ipplib. It seemed redundant
6837 6842 with the C-p,C-n history search functionality. Less code to
6838 6843 maintain.
6839 6844
6840 6845 * Moved all the original ipython.py code into ipythonlib.py. Right
6841 6846 now it's just one big dump into a function called make_IPython, so
6842 6847 no real modularity has been gained. But at least it makes the
6843 6848 wrapper script tiny, and since ipythonlib is a module, it gets
6844 6849 compiled and startup is much faster.
6845 6850
6846 6851 This is a reasobably 'deep' change, so we should test it for a
6847 6852 while without messing too much more with the code.
6848 6853
6849 6854 2001-11-21 Fernando Perez <fperez@colorado.edu>
6850 6855
6851 6856 * Version 0.1.11 released, 0.1.12 opened for further work.
6852 6857
6853 6858 * Removed dependency on Itpl. It was only needed in one place. It
6854 6859 would be nice if this became part of python, though. It makes life
6855 6860 *a lot* easier in some cases.
6856 6861
6857 6862 * Simplified the prefilter code a bit. Now all handlers are
6858 6863 expected to explicitly return a value (at least a blank string).
6859 6864
6860 6865 * Heavy edits in ipplib. Removed the help system altogether. Now
6861 6866 obj?/?? is used for inspecting objects, a magic @doc prints
6862 6867 docstrings, and full-blown Python help is accessed via the 'help'
6863 6868 keyword. This cleans up a lot of code (less to maintain) and does
6864 6869 the job. Since 'help' is now a standard Python component, might as
6865 6870 well use it and remove duplicate functionality.
6866 6871
6867 6872 Also removed the option to use ipplib as a standalone program. By
6868 6873 now it's too dependent on other parts of IPython to function alone.
6869 6874
6870 6875 * Fixed bug in genutils.pager. It would crash if the pager was
6871 6876 exited immediately after opening (broken pipe).
6872 6877
6873 6878 * Trimmed down the VerboseTB reporting a little. The header is
6874 6879 much shorter now and the repeated exception arguments at the end
6875 6880 have been removed. For interactive use the old header seemed a bit
6876 6881 excessive.
6877 6882
6878 6883 * Fixed small bug in output of @whos for variables with multi-word
6879 6884 types (only first word was displayed).
6880 6885
6881 6886 2001-11-17 Fernando Perez <fperez@colorado.edu>
6882 6887
6883 6888 * Version 0.1.10 released, 0.1.11 opened for further work.
6884 6889
6885 6890 * Modified dirs and friends. dirs now *returns* the stack (not
6886 6891 prints), so one can manipulate it as a variable. Convenient to
6887 6892 travel along many directories.
6888 6893
6889 6894 * Fixed bug in magic_pdef: would only work with functions with
6890 6895 arguments with default values.
6891 6896
6892 6897 2001-11-14 Fernando Perez <fperez@colorado.edu>
6893 6898
6894 6899 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6895 6900 example with IPython. Various other minor fixes and cleanups.
6896 6901
6897 6902 * Version 0.1.9 released, 0.1.10 opened for further work.
6898 6903
6899 6904 * Added sys.path to the list of directories searched in the
6900 6905 execfile= option. It used to be the current directory and the
6901 6906 user's IPYTHONDIR only.
6902 6907
6903 6908 2001-11-13 Fernando Perez <fperez@colorado.edu>
6904 6909
6905 6910 * Reinstated the raw_input/prefilter separation that Janko had
6906 6911 initially. This gives a more convenient setup for extending the
6907 6912 pre-processor from the outside: raw_input always gets a string,
6908 6913 and prefilter has to process it. We can then redefine prefilter
6909 6914 from the outside and implement extensions for special
6910 6915 purposes.
6911 6916
6912 6917 Today I got one for inputting PhysicalQuantity objects
6913 6918 (from Scientific) without needing any function calls at
6914 6919 all. Extremely convenient, and it's all done as a user-level
6915 6920 extension (no IPython code was touched). Now instead of:
6916 6921 a = PhysicalQuantity(4.2,'m/s**2')
6917 6922 one can simply say
6918 6923 a = 4.2 m/s**2
6919 6924 or even
6920 6925 a = 4.2 m/s^2
6921 6926
6922 6927 I use this, but it's also a proof of concept: IPython really is
6923 6928 fully user-extensible, even at the level of the parsing of the
6924 6929 command line. It's not trivial, but it's perfectly doable.
6925 6930
6926 6931 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6927 6932 the problem of modules being loaded in the inverse order in which
6928 6933 they were defined in
6929 6934
6930 6935 * Version 0.1.8 released, 0.1.9 opened for further work.
6931 6936
6932 6937 * Added magics pdef, source and file. They respectively show the
6933 6938 definition line ('prototype' in C), source code and full python
6934 6939 file for any callable object. The object inspector oinfo uses
6935 6940 these to show the same information.
6936 6941
6937 6942 * Version 0.1.7 released, 0.1.8 opened for further work.
6938 6943
6939 6944 * Separated all the magic functions into a class called Magic. The
6940 6945 InteractiveShell class was becoming too big for Xemacs to handle
6941 6946 (de-indenting a line would lock it up for 10 seconds while it
6942 6947 backtracked on the whole class!)
6943 6948
6944 6949 FIXME: didn't work. It can be done, but right now namespaces are
6945 6950 all messed up. Do it later (reverted it for now, so at least
6946 6951 everything works as before).
6947 6952
6948 6953 * Got the object introspection system (magic_oinfo) working! I
6949 6954 think this is pretty much ready for release to Janko, so he can
6950 6955 test it for a while and then announce it. Pretty much 100% of what
6951 6956 I wanted for the 'phase 1' release is ready. Happy, tired.
6952 6957
6953 6958 2001-11-12 Fernando Perez <fperez@colorado.edu>
6954 6959
6955 6960 * Version 0.1.6 released, 0.1.7 opened for further work.
6956 6961
6957 6962 * Fixed bug in printing: it used to test for truth before
6958 6963 printing, so 0 wouldn't print. Now checks for None.
6959 6964
6960 6965 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6961 6966 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6962 6967 reaches by hand into the outputcache. Think of a better way to do
6963 6968 this later.
6964 6969
6965 6970 * Various small fixes thanks to Nathan's comments.
6966 6971
6967 6972 * Changed magic_pprint to magic_Pprint. This way it doesn't
6968 6973 collide with pprint() and the name is consistent with the command
6969 6974 line option.
6970 6975
6971 6976 * Changed prompt counter behavior to be fully like
6972 6977 Mathematica's. That is, even input that doesn't return a result
6973 6978 raises the prompt counter. The old behavior was kind of confusing
6974 6979 (getting the same prompt number several times if the operation
6975 6980 didn't return a result).
6976 6981
6977 6982 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6978 6983
6979 6984 * Fixed -Classic mode (wasn't working anymore).
6980 6985
6981 6986 * Added colored prompts using Nathan's new code. Colors are
6982 6987 currently hardwired, they can be user-configurable. For
6983 6988 developers, they can be chosen in file ipythonlib.py, at the
6984 6989 beginning of the CachedOutput class def.
6985 6990
6986 6991 2001-11-11 Fernando Perez <fperez@colorado.edu>
6987 6992
6988 6993 * Version 0.1.5 released, 0.1.6 opened for further work.
6989 6994
6990 6995 * Changed magic_env to *return* the environment as a dict (not to
6991 6996 print it). This way it prints, but it can also be processed.
6992 6997
6993 6998 * Added Verbose exception reporting to interactive
6994 6999 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6995 7000 traceback. Had to make some changes to the ultraTB file. This is
6996 7001 probably the last 'big' thing in my mental todo list. This ties
6997 7002 in with the next entry:
6998 7003
6999 7004 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7000 7005 has to specify is Plain, Color or Verbose for all exception
7001 7006 handling.
7002 7007
7003 7008 * Removed ShellServices option. All this can really be done via
7004 7009 the magic system. It's easier to extend, cleaner and has automatic
7005 7010 namespace protection and documentation.
7006 7011
7007 7012 2001-11-09 Fernando Perez <fperez@colorado.edu>
7008 7013
7009 7014 * Fixed bug in output cache flushing (missing parameter to
7010 7015 __init__). Other small bugs fixed (found using pychecker).
7011 7016
7012 7017 * Version 0.1.4 opened for bugfixing.
7013 7018
7014 7019 2001-11-07 Fernando Perez <fperez@colorado.edu>
7015 7020
7016 7021 * Version 0.1.3 released, mainly because of the raw_input bug.
7017 7022
7018 7023 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7019 7024 and when testing for whether things were callable, a call could
7020 7025 actually be made to certain functions. They would get called again
7021 7026 once 'really' executed, with a resulting double call. A disaster
7022 7027 in many cases (list.reverse() would never work!).
7023 7028
7024 7029 * Removed prefilter() function, moved its code to raw_input (which
7025 7030 after all was just a near-empty caller for prefilter). This saves
7026 7031 a function call on every prompt, and simplifies the class a tiny bit.
7027 7032
7028 7033 * Fix _ip to __ip name in magic example file.
7029 7034
7030 7035 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7031 7036 work with non-gnu versions of tar.
7032 7037
7033 7038 2001-11-06 Fernando Perez <fperez@colorado.edu>
7034 7039
7035 7040 * Version 0.1.2. Just to keep track of the recent changes.
7036 7041
7037 7042 * Fixed nasty bug in output prompt routine. It used to check 'if
7038 7043 arg != None...'. Problem is, this fails if arg implements a
7039 7044 special comparison (__cmp__) which disallows comparing to
7040 7045 None. Found it when trying to use the PhysicalQuantity module from
7041 7046 ScientificPython.
7042 7047
7043 7048 2001-11-05 Fernando Perez <fperez@colorado.edu>
7044 7049
7045 7050 * Also added dirs. Now the pushd/popd/dirs family functions
7046 7051 basically like the shell, with the added convenience of going home
7047 7052 when called with no args.
7048 7053
7049 7054 * pushd/popd slightly modified to mimic shell behavior more
7050 7055 closely.
7051 7056
7052 7057 * Added env,pushd,popd from ShellServices as magic functions. I
7053 7058 think the cleanest will be to port all desired functions from
7054 7059 ShellServices as magics and remove ShellServices altogether. This
7055 7060 will provide a single, clean way of adding functionality
7056 7061 (shell-type or otherwise) to IP.
7057 7062
7058 7063 2001-11-04 Fernando Perez <fperez@colorado.edu>
7059 7064
7060 7065 * Added .ipython/ directory to sys.path. This way users can keep
7061 7066 customizations there and access them via import.
7062 7067
7063 7068 2001-11-03 Fernando Perez <fperez@colorado.edu>
7064 7069
7065 7070 * Opened version 0.1.1 for new changes.
7066 7071
7067 7072 * Changed version number to 0.1.0: first 'public' release, sent to
7068 7073 Nathan and Janko.
7069 7074
7070 7075 * Lots of small fixes and tweaks.
7071 7076
7072 7077 * Minor changes to whos format. Now strings are shown, snipped if
7073 7078 too long.
7074 7079
7075 7080 * Changed ShellServices to work on __main__ so they show up in @who
7076 7081
7077 7082 * Help also works with ? at the end of a line:
7078 7083 ?sin and sin?
7079 7084 both produce the same effect. This is nice, as often I use the
7080 7085 tab-complete to find the name of a method, but I used to then have
7081 7086 to go to the beginning of the line to put a ? if I wanted more
7082 7087 info. Now I can just add the ? and hit return. Convenient.
7083 7088
7084 7089 2001-11-02 Fernando Perez <fperez@colorado.edu>
7085 7090
7086 7091 * Python version check (>=2.1) added.
7087 7092
7088 7093 * Added LazyPython documentation. At this point the docs are quite
7089 7094 a mess. A cleanup is in order.
7090 7095
7091 7096 * Auto-installer created. For some bizarre reason, the zipfiles
7092 7097 module isn't working on my system. So I made a tar version
7093 7098 (hopefully the command line options in various systems won't kill
7094 7099 me).
7095 7100
7096 7101 * Fixes to Struct in genutils. Now all dictionary-like methods are
7097 7102 protected (reasonably).
7098 7103
7099 7104 * Added pager function to genutils and changed ? to print usage
7100 7105 note through it (it was too long).
7101 7106
7102 7107 * Added the LazyPython functionality. Works great! I changed the
7103 7108 auto-quote escape to ';', it's on home row and next to '. But
7104 7109 both auto-quote and auto-paren (still /) escapes are command-line
7105 7110 parameters.
7106 7111
7107 7112
7108 7113 2001-11-01 Fernando Perez <fperez@colorado.edu>
7109 7114
7110 7115 * Version changed to 0.0.7. Fairly large change: configuration now
7111 7116 is all stored in a directory, by default .ipython. There, all
7112 7117 config files have normal looking names (not .names)
7113 7118
7114 7119 * Version 0.0.6 Released first to Lucas and Archie as a test
7115 7120 run. Since it's the first 'semi-public' release, change version to
7116 7121 > 0.0.6 for any changes now.
7117 7122
7118 7123 * Stuff I had put in the ipplib.py changelog:
7119 7124
7120 7125 Changes to InteractiveShell:
7121 7126
7122 7127 - Made the usage message a parameter.
7123 7128
7124 7129 - Require the name of the shell variable to be given. It's a bit
7125 7130 of a hack, but allows the name 'shell' not to be hardwired in the
7126 7131 magic (@) handler, which is problematic b/c it requires
7127 7132 polluting the global namespace with 'shell'. This in turn is
7128 7133 fragile: if a user redefines a variable called shell, things
7129 7134 break.
7130 7135
7131 7136 - magic @: all functions available through @ need to be defined
7132 7137 as magic_<name>, even though they can be called simply as
7133 7138 @<name>. This allows the special command @magic to gather
7134 7139 information automatically about all existing magic functions,
7135 7140 even if they are run-time user extensions, by parsing the shell
7136 7141 instance __dict__ looking for special magic_ names.
7137 7142
7138 7143 - mainloop: added *two* local namespace parameters. This allows
7139 7144 the class to differentiate between parameters which were there
7140 7145 before and after command line initialization was processed. This
7141 7146 way, later @who can show things loaded at startup by the
7142 7147 user. This trick was necessary to make session saving/reloading
7143 7148 really work: ideally after saving/exiting/reloading a session,
7144 7149 *everything* should look the same, including the output of @who. I
7145 7150 was only able to make this work with this double namespace
7146 7151 trick.
7147 7152
7148 7153 - added a header to the logfile which allows (almost) full
7149 7154 session restoring.
7150 7155
7151 7156 - prepend lines beginning with @ or !, with a and log
7152 7157 them. Why? !lines: may be useful to know what you did @lines:
7153 7158 they may affect session state. So when restoring a session, at
7154 7159 least inform the user of their presence. I couldn't quite get
7155 7160 them to properly re-execute, but at least the user is warned.
7156 7161
7157 7162 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now