##// END OF EJS Templates
- Improvements to demo classes and some magic fixes.
fperez -
Show More
@@ -1,3071 +1,3084 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 2066 2007-01-31 18:56:06Z fperez $"""
4 $Id: Magic.py 2104 2007-02-20 10:25:51Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 9 #
10 10 # Distributed under the terms of the BSD License. The full license is in
11 11 # the file COPYING, distributed as part of this software.
12 12 #*****************************************************************************
13 13
14 14 #****************************************************************************
15 15 # Modules and globals
16 16
17 17 from IPython import Release
18 18 __author__ = '%s <%s>\n%s <%s>' % \
19 19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
20 20 __license__ = Release.license
21 21
22 22 # Python standard modules
23 23 import __builtin__
24 24 import bdb
25 25 import inspect
26 26 import os
27 27 import pdb
28 28 import pydoc
29 29 import sys
30 30 import re
31 31 import tempfile
32 32 import time
33 33 import cPickle as pickle
34 34 import textwrap
35 35 from cStringIO import StringIO
36 36 from getopt import getopt,GetoptError
37 37 from pprint import pprint, pformat
38 38
39 39 # cProfile was added in Python2.5
40 40 try:
41 41 import cProfile as profile
42 42 import pstats
43 43 except ImportError:
44 44 # profile isn't bundled by default in Debian for license reasons
45 45 try:
46 46 import profile,pstats
47 47 except ImportError:
48 48 profile = pstats = None
49 49
50 50 # Homebrewed
51 51 import IPython
52 52 from IPython import Debugger, OInspect, wildcard
53 53 from IPython.FakeModule import FakeModule
54 54 from IPython.Itpl import Itpl, itpl, printpl,itplns
55 55 from IPython.PyColorize import Parser
56 56 from IPython.ipstruct import Struct
57 57 from IPython.macro import Macro
58 58 from IPython.genutils import *
59 59 from IPython import platutils
60 60
61 61 #***************************************************************************
62 62 # Utility functions
63 63 def on_off(tag):
64 64 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
65 65 return ['OFF','ON'][tag]
66 66
67 67 class Bunch: pass
68 68
69 69 #***************************************************************************
70 70 # Main class implementing Magic functionality
71 71 class Magic:
72 72 """Magic functions for InteractiveShell.
73 73
74 74 Shell functions which can be reached as %function_name. All magic
75 75 functions should accept a string, which they can parse for their own
76 76 needs. This can make some functions easier to type, eg `%cd ../`
77 77 vs. `%cd("../")`
78 78
79 79 ALL definitions MUST begin with the prefix magic_. The user won't need it
80 80 at the command line, but it is is needed in the definition. """
81 81
82 82 # class globals
83 83 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
84 84 'Automagic is ON, % prefix NOT needed for magic functions.']
85 85
86 86 #......................................................................
87 87 # some utility functions
88 88
89 89 def __init__(self,shell):
90 90
91 91 self.options_table = {}
92 92 if profile is None:
93 93 self.magic_prun = self.profile_missing_notice
94 94 self.shell = shell
95 95
96 96 # namespace for holding state we may need
97 97 self._magic_state = Bunch()
98 98
99 99 def profile_missing_notice(self, *args, **kwargs):
100 100 error("""\
101 101 The profile module could not be found. If you are a Debian user,
102 102 it has been removed from the standard Debian package because of its non-free
103 103 license. To use profiling, please install"python2.3-profiler" from non-free.""")
104 104
105 105 def default_option(self,fn,optstr):
106 106 """Make an entry in the options_table for fn, with value optstr"""
107 107
108 108 if fn not in self.lsmagic():
109 109 error("%s is not a magic function" % fn)
110 110 self.options_table[fn] = optstr
111 111
112 112 def lsmagic(self):
113 113 """Return a list of currently available magic functions.
114 114
115 115 Gives a list of the bare names after mangling (['ls','cd', ...], not
116 116 ['magic_ls','magic_cd',...]"""
117 117
118 118 # FIXME. This needs a cleanup, in the way the magics list is built.
119 119
120 120 # magics in class definition
121 121 class_magic = lambda fn: fn.startswith('magic_') and \
122 122 callable(Magic.__dict__[fn])
123 123 # in instance namespace (run-time user additions)
124 124 inst_magic = lambda fn: fn.startswith('magic_') and \
125 125 callable(self.__dict__[fn])
126 126 # and bound magics by user (so they can access self):
127 127 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
128 128 callable(self.__class__.__dict__[fn])
129 129 magics = filter(class_magic,Magic.__dict__.keys()) + \
130 130 filter(inst_magic,self.__dict__.keys()) + \
131 131 filter(inst_bound_magic,self.__class__.__dict__.keys())
132 132 out = []
133 133 for fn in magics:
134 134 out.append(fn.replace('magic_','',1))
135 135 out.sort()
136 136 return out
137 137
138 138 def extract_input_slices(self,slices,raw=False):
139 139 """Return as a string a set of input history slices.
140 140
141 141 Inputs:
142 142
143 143 - slices: the set of slices is given as a list of strings (like
144 144 ['1','4:8','9'], since this function is for use by magic functions
145 145 which get their arguments as strings.
146 146
147 147 Optional inputs:
148 148
149 149 - raw(False): by default, the processed input is used. If this is
150 150 true, the raw input history is used instead.
151 151
152 152 Note that slices can be called with two notations:
153 153
154 154 N:M -> standard python form, means including items N...(M-1).
155 155
156 156 N-M -> include items N..M (closed endpoint)."""
157 157
158 158 if raw:
159 159 hist = self.shell.input_hist_raw
160 160 else:
161 161 hist = self.shell.input_hist
162 162
163 163 cmds = []
164 164 for chunk in slices:
165 165 if ':' in chunk:
166 166 ini,fin = map(int,chunk.split(':'))
167 167 elif '-' in chunk:
168 168 ini,fin = map(int,chunk.split('-'))
169 169 fin += 1
170 170 else:
171 171 ini = int(chunk)
172 172 fin = ini+1
173 173 cmds.append(hist[ini:fin])
174 174 return cmds
175 175
176 176 def _ofind(self, oname, namespaces=None):
177 177 """Find an object in the available namespaces.
178 178
179 179 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
180 180
181 181 Has special code to detect magic functions.
182 182 """
183 183
184 184 oname = oname.strip()
185 185
186 186 alias_ns = None
187 187 if namespaces is None:
188 188 # Namespaces to search in:
189 189 # Put them in a list. The order is important so that we
190 190 # find things in the same order that Python finds them.
191 191 namespaces = [ ('Interactive', self.shell.user_ns),
192 192 ('IPython internal', self.shell.internal_ns),
193 193 ('Python builtin', __builtin__.__dict__),
194 194 ('Alias', self.shell.alias_table),
195 195 ]
196 196 alias_ns = self.shell.alias_table
197 197
198 198 # initialize results to 'null'
199 199 found = 0; obj = None; ospace = None; ds = None;
200 200 ismagic = 0; isalias = 0; parent = None
201 201
202 202 # Look for the given name by splitting it in parts. If the head is
203 203 # found, then we look for all the remaining parts as members, and only
204 204 # declare success if we can find them all.
205 205 oname_parts = oname.split('.')
206 206 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
207 207 for nsname,ns in namespaces:
208 208 try:
209 209 obj = ns[oname_head]
210 210 except KeyError:
211 211 continue
212 212 else:
213 213 for part in oname_rest:
214 214 try:
215 215 parent = obj
216 216 obj = getattr(obj,part)
217 217 except:
218 218 # Blanket except b/c some badly implemented objects
219 219 # allow __getattr__ to raise exceptions other than
220 220 # AttributeError, which then crashes IPython.
221 221 break
222 222 else:
223 223 # If we finish the for loop (no break), we got all members
224 224 found = 1
225 225 ospace = nsname
226 226 if ns == alias_ns:
227 227 isalias = 1
228 228 break # namespace loop
229 229
230 230 # Try to see if it's magic
231 231 if not found:
232 232 if oname.startswith(self.shell.ESC_MAGIC):
233 233 oname = oname[1:]
234 234 obj = getattr(self,'magic_'+oname,None)
235 235 if obj is not None:
236 236 found = 1
237 237 ospace = 'IPython internal'
238 238 ismagic = 1
239 239
240 240 # Last try: special-case some literals like '', [], {}, etc:
241 241 if not found and oname_head in ["''",'""','[]','{}','()']:
242 242 obj = eval(oname_head)
243 243 found = 1
244 244 ospace = 'Interactive'
245 245
246 246 return {'found':found, 'obj':obj, 'namespace':ospace,
247 247 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
248 248
249 249 def arg_err(self,func):
250 250 """Print docstring if incorrect arguments were passed"""
251 251 print 'Error in arguments:'
252 252 print OInspect.getdoc(func)
253 253
254 254 def format_latex(self,strng):
255 255 """Format a string for latex inclusion."""
256 256
257 257 # Characters that need to be escaped for latex:
258 258 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
259 259 # Magic command names as headers:
260 260 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
261 261 re.MULTILINE)
262 262 # Magic commands
263 263 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
264 264 re.MULTILINE)
265 265 # Paragraph continue
266 266 par_re = re.compile(r'\\$',re.MULTILINE)
267 267
268 268 # The "\n" symbol
269 269 newline_re = re.compile(r'\\n')
270 270
271 271 # Now build the string for output:
272 272 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
273 273 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
274 274 strng)
275 275 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
276 276 strng = par_re.sub(r'\\\\',strng)
277 277 strng = escape_re.sub(r'\\\1',strng)
278 278 strng = newline_re.sub(r'\\textbackslash{}n',strng)
279 279 return strng
280 280
281 281 def format_screen(self,strng):
282 282 """Format a string for screen printing.
283 283
284 284 This removes some latex-type format codes."""
285 285 # Paragraph continue
286 286 par_re = re.compile(r'\\$',re.MULTILINE)
287 287 strng = par_re.sub('',strng)
288 288 return strng
289 289
290 290 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
291 291 """Parse options passed to an argument string.
292 292
293 293 The interface is similar to that of getopt(), but it returns back a
294 294 Struct with the options as keys and the stripped argument string still
295 295 as a string.
296 296
297 297 arg_str is quoted as a true sys.argv vector by using shlex.split.
298 298 This allows us to easily expand variables, glob files, quote
299 299 arguments, etc.
300 300
301 301 Options:
302 302 -mode: default 'string'. If given as 'list', the argument string is
303 303 returned as a list (split on whitespace) instead of a string.
304 304
305 305 -list_all: put all option values in lists. Normally only options
306 306 appearing more than once are put in a list.
307 307
308 308 -posix (True): whether to split the input line in POSIX mode or not,
309 309 as per the conventions outlined in the shlex module from the
310 310 standard library."""
311 311
312 312 # inject default options at the beginning of the input line
313 313 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
314 314 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
315 315
316 316 mode = kw.get('mode','string')
317 317 if mode not in ['string','list']:
318 318 raise ValueError,'incorrect mode given: %s' % mode
319 319 # Get options
320 320 list_all = kw.get('list_all',0)
321 321 posix = kw.get('posix',True)
322 322
323 323 # Check if we have more than one argument to warrant extra processing:
324 324 odict = {} # Dictionary with options
325 325 args = arg_str.split()
326 326 if len(args) >= 1:
327 327 # If the list of inputs only has 0 or 1 thing in it, there's no
328 328 # need to look for options
329 329 argv = arg_split(arg_str,posix)
330 330 # Do regular option processing
331 331 try:
332 332 opts,args = getopt(argv,opt_str,*long_opts)
333 333 except GetoptError,e:
334 334 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
335 335 " ".join(long_opts)))
336 336 for o,a in opts:
337 337 if o.startswith('--'):
338 338 o = o[2:]
339 339 else:
340 340 o = o[1:]
341 341 try:
342 342 odict[o].append(a)
343 343 except AttributeError:
344 344 odict[o] = [odict[o],a]
345 345 except KeyError:
346 346 if list_all:
347 347 odict[o] = [a]
348 348 else:
349 349 odict[o] = a
350 350
351 351 # Prepare opts,args for return
352 352 opts = Struct(odict)
353 353 if mode == 'string':
354 354 args = ' '.join(args)
355 355
356 356 return opts,args
357 357
358 358 #......................................................................
359 359 # And now the actual magic functions
360 360
361 361 # Functions for IPython shell work (vars,funcs, config, etc)
362 362 def magic_lsmagic(self, parameter_s = ''):
363 363 """List currently available magic functions."""
364 364 mesc = self.shell.ESC_MAGIC
365 365 print 'Available magic functions:\n'+mesc+\
366 366 (' '+mesc).join(self.lsmagic())
367 367 print '\n' + Magic.auto_status[self.shell.rc.automagic]
368 368 return None
369 369
370 370 def magic_magic(self, parameter_s = ''):
371 371 """Print information about the magic function system."""
372 372
373 373 mode = ''
374 374 try:
375 375 if parameter_s.split()[0] == '-latex':
376 376 mode = 'latex'
377 377 if parameter_s.split()[0] == '-brief':
378 378 mode = 'brief'
379 379 except:
380 380 pass
381 381
382 382 magic_docs = []
383 383 for fname in self.lsmagic():
384 384 mname = 'magic_' + fname
385 385 for space in (Magic,self,self.__class__):
386 386 try:
387 387 fn = space.__dict__[mname]
388 388 except KeyError:
389 389 pass
390 390 else:
391 391 break
392 392 if mode == 'brief':
393 393 # only first line
394 394 fndoc = fn.__doc__.split('\n',1)[0]
395 395 else:
396 396 fndoc = fn.__doc__
397 397
398 398 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
399 399 fname,fndoc))
400 400 magic_docs = ''.join(magic_docs)
401 401
402 402 if mode == 'latex':
403 403 print self.format_latex(magic_docs)
404 404 return
405 405 else:
406 406 magic_docs = self.format_screen(magic_docs)
407 407 if mode == 'brief':
408 408 return magic_docs
409 409
410 410 outmsg = """
411 411 IPython's 'magic' functions
412 412 ===========================
413 413
414 414 The magic function system provides a series of functions which allow you to
415 415 control the behavior of IPython itself, plus a lot of system-type
416 416 features. All these functions are prefixed with a % character, but parameters
417 417 are given without parentheses or quotes.
418 418
419 419 NOTE: If you have 'automagic' enabled (via the command line option or with the
420 420 %automagic function), you don't need to type in the % explicitly. By default,
421 421 IPython ships with automagic on, so you should only rarely need the % escape.
422 422
423 423 Example: typing '%cd mydir' (without the quotes) changes you working directory
424 424 to 'mydir', if it exists.
425 425
426 426 You can define your own magic functions to extend the system. See the supplied
427 427 ipythonrc and example-magic.py files for details (in your ipython
428 428 configuration directory, typically $HOME/.ipython/).
429 429
430 430 You can also define your own aliased names for magic functions. In your
431 431 ipythonrc file, placing a line like:
432 432
433 433 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
434 434
435 435 will define %pf as a new name for %profile.
436 436
437 437 You can also call magics in code using the ipmagic() function, which IPython
438 438 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
439 439
440 440 For a list of the available magic functions, use %lsmagic. For a description
441 441 of any of them, type %magic_name?, e.g. '%cd?'.
442 442
443 443 Currently the magic system has the following functions:\n"""
444 444
445 445 mesc = self.shell.ESC_MAGIC
446 446 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
447 447 "\n\n%s%s\n\n%s" % (outmsg,
448 448 magic_docs,mesc,mesc,
449 449 (' '+mesc).join(self.lsmagic()),
450 450 Magic.auto_status[self.shell.rc.automagic] ) )
451 451
452 452 page(outmsg,screen_lines=self.shell.rc.screen_length)
453 453
454 454 def magic_automagic(self, parameter_s = ''):
455 455 """Make magic functions callable without having to type the initial %.
456 456
457 Toggles on/off (when off, you must call it as %automagic, of
458 course). Note that magic functions have lowest priority, so if there's
459 a variable whose name collides with that of a magic fn, automagic
460 won't work for that function (you get the variable instead). However,
461 if you delete the variable (del var), the previously shadowed magic
462 function becomes visible to automagic again."""
457 Without argumentsl toggles on/off (when off, you must call it as
458 %automagic, of course). With arguments it sets the value, and you can
459 use any of (case insensitive):
460
461 - on,1,True: to activate
462
463 - off,0,False: to deactivate.
464
465 Note that magic functions have lowest priority, so if there's a
466 variable whose name collides with that of a magic fn, automagic won't
467 work for that function (you get the variable instead). However, if you
468 delete the variable (del var), the previously shadowed magic function
469 becomes visible to automagic again."""
463 470
464 471 rc = self.shell.rc
465 rc.automagic = not rc.automagic
472 arg = parameter_s.lower()
473 if parameter_s in ('on','1','true'):
474 rc.automagic = True
475 elif parameter_s in ('off','0','false'):
476 rc.automagic = False
477 else:
478 rc.automagic = not rc.automagic
466 479 print '\n' + Magic.auto_status[rc.automagic]
467 480
468 481 def magic_autocall(self, parameter_s = ''):
469 482 """Make functions callable without having to type parentheses.
470 483
471 484 Usage:
472 485
473 486 %autocall [mode]
474 487
475 488 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
476 489 value is toggled on and off (remembering the previous state)."""
477 490
478 491 rc = self.shell.rc
479 492
480 493 if parameter_s:
481 494 arg = int(parameter_s)
482 495 else:
483 496 arg = 'toggle'
484 497
485 498 if not arg in (0,1,2,'toggle'):
486 499 error('Valid modes: (0->Off, 1->Smart, 2->Full')
487 500 return
488 501
489 502 if arg in (0,1,2):
490 503 rc.autocall = arg
491 504 else: # toggle
492 505 if rc.autocall:
493 506 self._magic_state.autocall_save = rc.autocall
494 507 rc.autocall = 0
495 508 else:
496 509 try:
497 510 rc.autocall = self._magic_state.autocall_save
498 511 except AttributeError:
499 512 rc.autocall = self._magic_state.autocall_save = 1
500 513
501 514 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
502 515
503 516 def magic_autoindent(self, parameter_s = ''):
504 517 """Toggle autoindent on/off (if available)."""
505 518
506 519 self.shell.set_autoindent()
507 520 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
508 521
509 522 def magic_system_verbose(self, parameter_s = ''):
510 523 """Set verbose printing of system calls.
511 524
512 525 If called without an argument, act as a toggle"""
513 526
514 527 if parameter_s:
515 528 val = bool(eval(parameter_s))
516 529 else:
517 530 val = None
518 531
519 532 self.shell.rc_set_toggle('system_verbose',val)
520 533 print "System verbose printing is:",\
521 534 ['OFF','ON'][self.shell.rc.system_verbose]
522 535
523 536 def magic_history(self, parameter_s = ''):
524 537 """Print input history (_i<n> variables), with most recent last.
525 538
526 539 %history -> print at most 40 inputs (some may be multi-line)\\
527 540 %history n -> print at most n inputs\\
528 541 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
529 542
530 543 Each input's number <n> is shown, and is accessible as the
531 544 automatically generated variable _i<n>. Multi-line statements are
532 545 printed starting at a new line for easy copy/paste.
533 546
534 547
535 548 Options:
536 549
537 550 -n: do NOT print line numbers. This is useful if you want to get a
538 551 printout of many lines which can be directly pasted into a text
539 552 editor.
540 553
541 554 This feature is only available if numbered prompts are in use.
542 555
543 556 -r: print the 'raw' history. IPython filters your input and
544 557 converts it all into valid Python source before executing it (things
545 558 like magics or aliases are turned into function calls, for
546 559 example). With this option, you'll see the unfiltered history
547 560 instead of the filtered version: '%cd /' will be seen as '%cd /'
548 561 instead of '_ip.magic("%cd /")'.
549 562 """
550 563
551 564 shell = self.shell
552 565 if not shell.outputcache.do_full_cache:
553 566 print 'This feature is only available if numbered prompts are in use.'
554 567 return
555 568 opts,args = self.parse_options(parameter_s,'nr',mode='list')
556 569
557 570 if opts.has_key('r'):
558 571 input_hist = shell.input_hist_raw
559 572 else:
560 573 input_hist = shell.input_hist
561 574
562 575 default_length = 40
563 576 if len(args) == 0:
564 577 final = len(input_hist)
565 578 init = max(1,final-default_length)
566 579 elif len(args) == 1:
567 580 final = len(input_hist)
568 581 init = max(1,final-int(args[0]))
569 582 elif len(args) == 2:
570 583 init,final = map(int,args)
571 584 else:
572 585 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
573 586 print self.magic_hist.__doc__
574 587 return
575 588 width = len(str(final))
576 589 line_sep = ['','\n']
577 590 print_nums = not opts.has_key('n')
578 591 for in_num in range(init,final):
579 592 inline = input_hist[in_num]
580 593 multiline = int(inline.count('\n') > 1)
581 594 if print_nums:
582 595 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
583 596 print inline,
584 597
585 598 def magic_hist(self, parameter_s=''):
586 599 """Alternate name for %history."""
587 600 return self.magic_history(parameter_s)
588 601
589 602 def magic_p(self, parameter_s=''):
590 603 """Just a short alias for Python's 'print'."""
591 604 exec 'print ' + parameter_s in self.shell.user_ns
592 605
593 606 def magic_r(self, parameter_s=''):
594 607 """Repeat previous input.
595 608
596 609 If given an argument, repeats the previous command which starts with
597 610 the same string, otherwise it just repeats the previous input.
598 611
599 612 Shell escaped commands (with ! as first character) are not recognized
600 613 by this system, only pure python code and magic commands.
601 614 """
602 615
603 616 start = parameter_s.strip()
604 617 esc_magic = self.shell.ESC_MAGIC
605 618 # Identify magic commands even if automagic is on (which means
606 619 # the in-memory version is different from that typed by the user).
607 620 if self.shell.rc.automagic:
608 621 start_magic = esc_magic+start
609 622 else:
610 623 start_magic = start
611 624 # Look through the input history in reverse
612 625 for n in range(len(self.shell.input_hist)-2,0,-1):
613 626 input = self.shell.input_hist[n]
614 627 # skip plain 'r' lines so we don't recurse to infinity
615 628 if input != '_ip.magic("r")\n' and \
616 629 (input.startswith(start) or input.startswith(start_magic)):
617 630 #print 'match',`input` # dbg
618 631 print 'Executing:',input,
619 632 self.shell.runlines(input)
620 633 return
621 634 print 'No previous input matching `%s` found.' % start
622 635
623 636 def magic_page(self, parameter_s=''):
624 637 """Pretty print the object and display it through a pager.
625 638
626 639 %page [options] OBJECT
627 640
628 641 If no object is given, use _ (last output).
629 642
630 643 Options:
631 644
632 645 -r: page str(object), don't pretty-print it."""
633 646
634 647 # After a function contributed by Olivier Aubert, slightly modified.
635 648
636 649 # Process options/args
637 650 opts,args = self.parse_options(parameter_s,'r')
638 651 raw = 'r' in opts
639 652
640 653 oname = args and args or '_'
641 654 info = self._ofind(oname)
642 655 if info['found']:
643 656 txt = (raw and str or pformat)( info['obj'] )
644 657 page(txt)
645 658 else:
646 659 print 'Object `%s` not found' % oname
647 660
648 661 def magic_profile(self, parameter_s=''):
649 662 """Print your currently active IPyhton profile."""
650 663 if self.shell.rc.profile:
651 664 printpl('Current IPython profile: $self.shell.rc.profile.')
652 665 else:
653 666 print 'No profile active.'
654 667
655 668 def _inspect(self,meth,oname,namespaces=None,**kw):
656 669 """Generic interface to the inspector system.
657 670
658 671 This function is meant to be called by pdef, pdoc & friends."""
659 672
660 673 oname = oname.strip()
661 674 info = Struct(self._ofind(oname, namespaces))
662 675
663 676 if info.found:
664 677 # Get the docstring of the class property if it exists.
665 678 path = oname.split('.')
666 679 root = '.'.join(path[:-1])
667 680 if info.parent is not None:
668 681 try:
669 682 target = getattr(info.parent, '__class__')
670 683 # The object belongs to a class instance.
671 684 try:
672 685 target = getattr(target, path[-1])
673 686 # The class defines the object.
674 687 if isinstance(target, property):
675 688 oname = root + '.__class__.' + path[-1]
676 689 info = Struct(self._ofind(oname))
677 690 except AttributeError: pass
678 691 except AttributeError: pass
679 692
680 693 pmethod = getattr(self.shell.inspector,meth)
681 694 formatter = info.ismagic and self.format_screen or None
682 695 if meth == 'pdoc':
683 696 pmethod(info.obj,oname,formatter)
684 697 elif meth == 'pinfo':
685 698 pmethod(info.obj,oname,formatter,info,**kw)
686 699 else:
687 700 pmethod(info.obj,oname)
688 701 else:
689 702 print 'Object `%s` not found.' % oname
690 703 return 'not found' # so callers can take other action
691 704
692 705 def magic_pdef(self, parameter_s='', namespaces=None):
693 706 """Print the definition header for any callable object.
694 707
695 708 If the object is a class, print the constructor information."""
696 709 self._inspect('pdef',parameter_s, namespaces)
697 710
698 711 def magic_pdoc(self, parameter_s='', namespaces=None):
699 712 """Print the docstring for an object.
700 713
701 714 If the given object is a class, it will print both the class and the
702 715 constructor docstrings."""
703 716 self._inspect('pdoc',parameter_s, namespaces)
704 717
705 718 def magic_psource(self, parameter_s='', namespaces=None):
706 719 """Print (or run through pager) the source code for an object."""
707 720 self._inspect('psource',parameter_s, namespaces)
708 721
709 722 def magic_pfile(self, parameter_s=''):
710 723 """Print (or run through pager) the file where an object is defined.
711 724
712 725 The file opens at the line where the object definition begins. IPython
713 726 will honor the environment variable PAGER if set, and otherwise will
714 727 do its best to print the file in a convenient form.
715 728
716 729 If the given argument is not an object currently defined, IPython will
717 730 try to interpret it as a filename (automatically adding a .py extension
718 731 if needed). You can thus use %pfile as a syntax highlighting code
719 732 viewer."""
720 733
721 734 # first interpret argument as an object name
722 735 out = self._inspect('pfile',parameter_s)
723 736 # if not, try the input as a filename
724 737 if out == 'not found':
725 738 try:
726 739 filename = get_py_filename(parameter_s)
727 740 except IOError,msg:
728 741 print msg
729 742 return
730 743 page(self.shell.inspector.format(file(filename).read()))
731 744
732 745 def magic_pinfo(self, parameter_s='', namespaces=None):
733 746 """Provide detailed information about an object.
734 747
735 748 '%pinfo object' is just a synonym for object? or ?object."""
736 749
737 750 #print 'pinfo par: <%s>' % parameter_s # dbg
738 751
739 752 # detail_level: 0 -> obj? , 1 -> obj??
740 753 detail_level = 0
741 754 # We need to detect if we got called as 'pinfo pinfo foo', which can
742 755 # happen if the user types 'pinfo foo?' at the cmd line.
743 756 pinfo,qmark1,oname,qmark2 = \
744 757 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
745 758 if pinfo or qmark1 or qmark2:
746 759 detail_level = 1
747 760 if "*" in oname:
748 761 self.magic_psearch(oname)
749 762 else:
750 763 self._inspect('pinfo', oname, detail_level=detail_level,
751 764 namespaces=namespaces)
752 765
753 766 def magic_psearch(self, parameter_s=''):
754 767 """Search for object in namespaces by wildcard.
755 768
756 769 %psearch [options] PATTERN [OBJECT TYPE]
757 770
758 771 Note: ? can be used as a synonym for %psearch, at the beginning or at
759 772 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
760 773 rest of the command line must be unchanged (options come first), so
761 774 for example the following forms are equivalent
762 775
763 776 %psearch -i a* function
764 777 -i a* function?
765 778 ?-i a* function
766 779
767 780 Arguments:
768 781
769 782 PATTERN
770 783
771 784 where PATTERN is a string containing * as a wildcard similar to its
772 785 use in a shell. The pattern is matched in all namespaces on the
773 786 search path. By default objects starting with a single _ are not
774 787 matched, many IPython generated objects have a single
775 788 underscore. The default is case insensitive matching. Matching is
776 789 also done on the attributes of objects and not only on the objects
777 790 in a module.
778 791
779 792 [OBJECT TYPE]
780 793
781 794 Is the name of a python type from the types module. The name is
782 795 given in lowercase without the ending type, ex. StringType is
783 796 written string. By adding a type here only objects matching the
784 797 given type are matched. Using all here makes the pattern match all
785 798 types (this is the default).
786 799
787 800 Options:
788 801
789 802 -a: makes the pattern match even objects whose names start with a
790 803 single underscore. These names are normally ommitted from the
791 804 search.
792 805
793 806 -i/-c: make the pattern case insensitive/sensitive. If neither of
794 807 these options is given, the default is read from your ipythonrc
795 808 file. The option name which sets this value is
796 809 'wildcards_case_sensitive'. If this option is not specified in your
797 810 ipythonrc file, IPython's internal default is to do a case sensitive
798 811 search.
799 812
800 813 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
801 814 specifiy can be searched in any of the following namespaces:
802 815 'builtin', 'user', 'user_global','internal', 'alias', where
803 816 'builtin' and 'user' are the search defaults. Note that you should
804 817 not use quotes when specifying namespaces.
805 818
806 819 'Builtin' contains the python module builtin, 'user' contains all
807 820 user data, 'alias' only contain the shell aliases and no python
808 821 objects, 'internal' contains objects used by IPython. The
809 822 'user_global' namespace is only used by embedded IPython instances,
810 823 and it contains module-level globals. You can add namespaces to the
811 824 search with -s or exclude them with -e (these options can be given
812 825 more than once).
813 826
814 827 Examples:
815 828
816 829 %psearch a* -> objects beginning with an a
817 830 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
818 831 %psearch a* function -> all functions beginning with an a
819 832 %psearch re.e* -> objects beginning with an e in module re
820 833 %psearch r*.e* -> objects that start with e in modules starting in r
821 834 %psearch r*.* string -> all strings in modules beginning with r
822 835
823 836 Case sensitve search:
824 837
825 838 %psearch -c a* list all object beginning with lower case a
826 839
827 840 Show objects beginning with a single _:
828 841
829 842 %psearch -a _* list objects beginning with a single underscore"""
830 843
831 844 # default namespaces to be searched
832 845 def_search = ['user','builtin']
833 846
834 847 # Process options/args
835 848 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
836 849 opt = opts.get
837 850 shell = self.shell
838 851 psearch = shell.inspector.psearch
839 852
840 853 # select case options
841 854 if opts.has_key('i'):
842 855 ignore_case = True
843 856 elif opts.has_key('c'):
844 857 ignore_case = False
845 858 else:
846 859 ignore_case = not shell.rc.wildcards_case_sensitive
847 860
848 861 # Build list of namespaces to search from user options
849 862 def_search.extend(opt('s',[]))
850 863 ns_exclude = ns_exclude=opt('e',[])
851 864 ns_search = [nm for nm in def_search if nm not in ns_exclude]
852 865
853 866 # Call the actual search
854 867 try:
855 868 psearch(args,shell.ns_table,ns_search,
856 869 show_all=opt('a'),ignore_case=ignore_case)
857 870 except:
858 871 shell.showtraceback()
859 872
860 873 def magic_who_ls(self, parameter_s=''):
861 874 """Return a sorted list of all interactive variables.
862 875
863 876 If arguments are given, only variables of types matching these
864 877 arguments are returned."""
865 878
866 879 user_ns = self.shell.user_ns
867 880 internal_ns = self.shell.internal_ns
868 881 user_config_ns = self.shell.user_config_ns
869 882 out = []
870 883 typelist = parameter_s.split()
871 884
872 885 for i in user_ns:
873 886 if not (i.startswith('_') or i.startswith('_i')) \
874 887 and not (i in internal_ns or i in user_config_ns):
875 888 if typelist:
876 889 if type(user_ns[i]).__name__ in typelist:
877 890 out.append(i)
878 891 else:
879 892 out.append(i)
880 893 out.sort()
881 894 return out
882 895
883 896 def magic_who(self, parameter_s=''):
884 897 """Print all interactive variables, with some minimal formatting.
885 898
886 899 If any arguments are given, only variables whose type matches one of
887 900 these are printed. For example:
888 901
889 902 %who function str
890 903
891 904 will only list functions and strings, excluding all other types of
892 905 variables. To find the proper type names, simply use type(var) at a
893 906 command line to see how python prints type names. For example:
894 907
895 908 In [1]: type('hello')\\
896 909 Out[1]: <type 'str'>
897 910
898 911 indicates that the type name for strings is 'str'.
899 912
900 913 %who always excludes executed names loaded through your configuration
901 914 file and things which are internal to IPython.
902 915
903 916 This is deliberate, as typically you may load many modules and the
904 917 purpose of %who is to show you only what you've manually defined."""
905 918
906 919 varlist = self.magic_who_ls(parameter_s)
907 920 if not varlist:
908 921 print 'Interactive namespace is empty.'
909 922 return
910 923
911 924 # if we have variables, move on...
912 925
913 926 # stupid flushing problem: when prompts have no separators, stdout is
914 927 # getting lost. I'm starting to think this is a python bug. I'm having
915 928 # to force a flush with a print because even a sys.stdout.flush
916 929 # doesn't seem to do anything!
917 930
918 931 count = 0
919 932 for i in varlist:
920 933 print i+'\t',
921 934 count += 1
922 935 if count > 8:
923 936 count = 0
924 937 print
925 938 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
926 939
927 940 print # well, this does force a flush at the expense of an extra \n
928 941
929 942 def magic_whos(self, parameter_s=''):
930 943 """Like %who, but gives some extra information about each variable.
931 944
932 945 The same type filtering of %who can be applied here.
933 946
934 947 For all variables, the type is printed. Additionally it prints:
935 948
936 949 - For {},[],(): their length.
937 950
938 951 - For Numeric arrays, a summary with shape, number of elements,
939 952 typecode and size in memory.
940 953
941 954 - Everything else: a string representation, snipping their middle if
942 955 too long."""
943 956
944 957 varnames = self.magic_who_ls(parameter_s)
945 958 if not varnames:
946 959 print 'Interactive namespace is empty.'
947 960 return
948 961
949 962 # if we have variables, move on...
950 963
951 964 # for these types, show len() instead of data:
952 965 seq_types = [types.DictType,types.ListType,types.TupleType]
953 966
954 967 # for Numeric arrays, display summary info
955 968 try:
956 969 import Numeric
957 970 except ImportError:
958 971 array_type = None
959 972 else:
960 973 array_type = Numeric.ArrayType.__name__
961 974
962 975 # Find all variable names and types so we can figure out column sizes
963 976
964 977 def get_vars(i):
965 978 return self.shell.user_ns[i]
966 979
967 980 # some types are well known and can be shorter
968 981 abbrevs = {'IPython.macro.Macro' : 'Macro'}
969 982 def type_name(v):
970 983 tn = type(v).__name__
971 984 return abbrevs.get(tn,tn)
972 985
973 986 varlist = map(get_vars,varnames)
974 987
975 988 typelist = []
976 989 for vv in varlist:
977 990 tt = type_name(vv)
978 991
979 992 if tt=='instance':
980 993 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
981 994 else:
982 995 typelist.append(tt)
983 996
984 997 # column labels and # of spaces as separator
985 998 varlabel = 'Variable'
986 999 typelabel = 'Type'
987 1000 datalabel = 'Data/Info'
988 1001 colsep = 3
989 1002 # variable format strings
990 1003 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
991 1004 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
992 1005 aformat = "%s: %s elems, type `%s`, %s bytes"
993 1006 # find the size of the columns to format the output nicely
994 1007 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
995 1008 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
996 1009 # table header
997 1010 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
998 1011 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
999 1012 # and the table itself
1000 1013 kb = 1024
1001 1014 Mb = 1048576 # kb**2
1002 1015 for vname,var,vtype in zip(varnames,varlist,typelist):
1003 1016 print itpl(vformat),
1004 1017 if vtype in seq_types:
1005 1018 print len(var)
1006 1019 elif vtype==array_type:
1007 1020 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1008 1021 vsize = Numeric.size(var)
1009 1022 vbytes = vsize*var.itemsize()
1010 1023 if vbytes < 100000:
1011 1024 print aformat % (vshape,vsize,var.typecode(),vbytes)
1012 1025 else:
1013 1026 print aformat % (vshape,vsize,var.typecode(),vbytes),
1014 1027 if vbytes < Mb:
1015 1028 print '(%s kb)' % (vbytes/kb,)
1016 1029 else:
1017 1030 print '(%s Mb)' % (vbytes/Mb,)
1018 1031 else:
1019 1032 vstr = str(var).replace('\n','\\n')
1020 1033 if len(vstr) < 50:
1021 1034 print vstr
1022 1035 else:
1023 1036 printpl(vfmt_short)
1024 1037
1025 1038 def magic_reset(self, parameter_s=''):
1026 1039 """Resets the namespace by removing all names defined by the user.
1027 1040
1028 1041 Input/Output history are left around in case you need them."""
1029 1042
1030 1043 ans = self.shell.ask_yes_no(
1031 1044 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1032 1045 if not ans:
1033 1046 print 'Nothing done.'
1034 1047 return
1035 1048 user_ns = self.shell.user_ns
1036 1049 for i in self.magic_who_ls():
1037 1050 del(user_ns[i])
1038 1051
1039 1052 def magic_logstart(self,parameter_s=''):
1040 1053 """Start logging anywhere in a session.
1041 1054
1042 1055 %logstart [-o|-r|-t] [log_name [log_mode]]
1043 1056
1044 1057 If no name is given, it defaults to a file named 'ipython_log.py' in your
1045 1058 current directory, in 'rotate' mode (see below).
1046 1059
1047 1060 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1048 1061 history up to that point and then continues logging.
1049 1062
1050 1063 %logstart takes a second optional parameter: logging mode. This can be one
1051 1064 of (note that the modes are given unquoted):\\
1052 1065 append: well, that says it.\\
1053 1066 backup: rename (if exists) to name~ and start name.\\
1054 1067 global: single logfile in your home dir, appended to.\\
1055 1068 over : overwrite existing log.\\
1056 1069 rotate: create rotating logs name.1~, name.2~, etc.
1057 1070
1058 1071 Options:
1059 1072
1060 1073 -o: log also IPython's output. In this mode, all commands which
1061 1074 generate an Out[NN] prompt are recorded to the logfile, right after
1062 1075 their corresponding input line. The output lines are always
1063 1076 prepended with a '#[Out]# ' marker, so that the log remains valid
1064 1077 Python code.
1065 1078
1066 1079 Since this marker is always the same, filtering only the output from
1067 1080 a log is very easy, using for example a simple awk call:
1068 1081
1069 1082 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1070 1083
1071 1084 -r: log 'raw' input. Normally, IPython's logs contain the processed
1072 1085 input, so that user lines are logged in their final form, converted
1073 1086 into valid Python. For example, %Exit is logged as
1074 1087 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1075 1088 exactly as typed, with no transformations applied.
1076 1089
1077 1090 -t: put timestamps before each input line logged (these are put in
1078 1091 comments)."""
1079 1092
1080 1093 opts,par = self.parse_options(parameter_s,'ort')
1081 1094 log_output = 'o' in opts
1082 1095 log_raw_input = 'r' in opts
1083 1096 timestamp = 't' in opts
1084 1097
1085 1098 rc = self.shell.rc
1086 1099 logger = self.shell.logger
1087 1100
1088 1101 # if no args are given, the defaults set in the logger constructor by
1089 1102 # ipytohn remain valid
1090 1103 if par:
1091 1104 try:
1092 1105 logfname,logmode = par.split()
1093 1106 except:
1094 1107 logfname = par
1095 1108 logmode = 'backup'
1096 1109 else:
1097 1110 logfname = logger.logfname
1098 1111 logmode = logger.logmode
1099 1112 # put logfname into rc struct as if it had been called on the command
1100 1113 # line, so it ends up saved in the log header Save it in case we need
1101 1114 # to restore it...
1102 1115 old_logfile = rc.opts.get('logfile','')
1103 1116 if logfname:
1104 1117 logfname = os.path.expanduser(logfname)
1105 1118 rc.opts.logfile = logfname
1106 1119 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1107 1120 try:
1108 1121 started = logger.logstart(logfname,loghead,logmode,
1109 1122 log_output,timestamp,log_raw_input)
1110 1123 except:
1111 1124 rc.opts.logfile = old_logfile
1112 1125 warn("Couldn't start log: %s" % sys.exc_info()[1])
1113 1126 else:
1114 1127 # log input history up to this point, optionally interleaving
1115 1128 # output if requested
1116 1129
1117 1130 if timestamp:
1118 1131 # disable timestamping for the previous history, since we've
1119 1132 # lost those already (no time machine here).
1120 1133 logger.timestamp = False
1121 1134
1122 1135 if log_raw_input:
1123 1136 input_hist = self.shell.input_hist_raw
1124 1137 else:
1125 1138 input_hist = self.shell.input_hist
1126 1139
1127 1140 if log_output:
1128 1141 log_write = logger.log_write
1129 1142 output_hist = self.shell.output_hist
1130 1143 for n in range(1,len(input_hist)-1):
1131 1144 log_write(input_hist[n].rstrip())
1132 1145 if n in output_hist:
1133 1146 log_write(repr(output_hist[n]),'output')
1134 1147 else:
1135 1148 logger.log_write(input_hist[1:])
1136 1149 if timestamp:
1137 1150 # re-enable timestamping
1138 1151 logger.timestamp = True
1139 1152
1140 1153 print ('Activating auto-logging. '
1141 1154 'Current session state plus future input saved.')
1142 1155 logger.logstate()
1143 1156
1144 1157 def magic_logoff(self,parameter_s=''):
1145 1158 """Temporarily stop logging.
1146 1159
1147 1160 You must have previously started logging."""
1148 1161 self.shell.logger.switch_log(0)
1149 1162
1150 1163 def magic_logon(self,parameter_s=''):
1151 1164 """Restart logging.
1152 1165
1153 1166 This function is for restarting logging which you've temporarily
1154 1167 stopped with %logoff. For starting logging for the first time, you
1155 1168 must use the %logstart function, which allows you to specify an
1156 1169 optional log filename."""
1157 1170
1158 1171 self.shell.logger.switch_log(1)
1159 1172
1160 1173 def magic_logstate(self,parameter_s=''):
1161 1174 """Print the status of the logging system."""
1162 1175
1163 1176 self.shell.logger.logstate()
1164 1177
1165 1178 def magic_pdb(self, parameter_s=''):
1166 1179 """Control the automatic calling of the pdb interactive debugger.
1167 1180
1168 1181 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1169 1182 argument it works as a toggle.
1170 1183
1171 1184 When an exception is triggered, IPython can optionally call the
1172 1185 interactive pdb debugger after the traceback printout. %pdb toggles
1173 1186 this feature on and off.
1174 1187
1175 1188 The initial state of this feature is set in your ipythonrc
1176 1189 configuration file (the variable is called 'pdb').
1177 1190
1178 1191 If you want to just activate the debugger AFTER an exception has fired,
1179 1192 without having to type '%pdb on' and rerunning your code, you can use
1180 1193 the %debug magic."""
1181 1194
1182 1195 par = parameter_s.strip().lower()
1183 1196
1184 1197 if par:
1185 1198 try:
1186 1199 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1187 1200 except KeyError:
1188 1201 print ('Incorrect argument. Use on/1, off/0, '
1189 1202 'or nothing for a toggle.')
1190 1203 return
1191 1204 else:
1192 1205 # toggle
1193 1206 new_pdb = not self.shell.call_pdb
1194 1207
1195 1208 # set on the shell
1196 1209 self.shell.call_pdb = new_pdb
1197 1210 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1198 1211
1199 1212 def magic_debug(self, parameter_s=''):
1200 1213 """Activate the interactive debugger in post-mortem mode.
1201 1214
1202 1215 If an exception has just occurred, this lets you inspect its stack
1203 1216 frames interactively. Note that this will always work only on the last
1204 1217 traceback that occurred, so you must call this quickly after an
1205 1218 exception that you wish to inspect has fired, because if another one
1206 1219 occurs, it clobbers the previous one.
1207 1220
1208 1221 If you want IPython to automatically do this on every exception, see
1209 1222 the %pdb magic for more details.
1210 1223 """
1211 1224
1212 1225 self.shell.debugger(force=True)
1213 1226
1214 1227 def magic_prun(self, parameter_s ='',user_mode=1,
1215 1228 opts=None,arg_lst=None,prog_ns=None):
1216 1229
1217 1230 """Run a statement through the python code profiler.
1218 1231
1219 1232 Usage:\\
1220 1233 %prun [options] statement
1221 1234
1222 1235 The given statement (which doesn't require quote marks) is run via the
1223 1236 python profiler in a manner similar to the profile.run() function.
1224 1237 Namespaces are internally managed to work correctly; profile.run
1225 1238 cannot be used in IPython because it makes certain assumptions about
1226 1239 namespaces which do not hold under IPython.
1227 1240
1228 1241 Options:
1229 1242
1230 1243 -l <limit>: you can place restrictions on what or how much of the
1231 1244 profile gets printed. The limit value can be:
1232 1245
1233 1246 * A string: only information for function names containing this string
1234 1247 is printed.
1235 1248
1236 1249 * An integer: only these many lines are printed.
1237 1250
1238 1251 * A float (between 0 and 1): this fraction of the report is printed
1239 1252 (for example, use a limit of 0.4 to see the topmost 40% only).
1240 1253
1241 1254 You can combine several limits with repeated use of the option. For
1242 1255 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1243 1256 information about class constructors.
1244 1257
1245 1258 -r: return the pstats.Stats object generated by the profiling. This
1246 1259 object has all the information about the profile in it, and you can
1247 1260 later use it for further analysis or in other functions.
1248 1261
1249 1262 -s <key>: sort profile by given key. You can provide more than one key
1250 1263 by using the option several times: '-s key1 -s key2 -s key3...'. The
1251 1264 default sorting key is 'time'.
1252 1265
1253 1266 The following is copied verbatim from the profile documentation
1254 1267 referenced below:
1255 1268
1256 1269 When more than one key is provided, additional keys are used as
1257 1270 secondary criteria when the there is equality in all keys selected
1258 1271 before them.
1259 1272
1260 1273 Abbreviations can be used for any key names, as long as the
1261 1274 abbreviation is unambiguous. The following are the keys currently
1262 1275 defined:
1263 1276
1264 1277 Valid Arg Meaning\\
1265 1278 "calls" call count\\
1266 1279 "cumulative" cumulative time\\
1267 1280 "file" file name\\
1268 1281 "module" file name\\
1269 1282 "pcalls" primitive call count\\
1270 1283 "line" line number\\
1271 1284 "name" function name\\
1272 1285 "nfl" name/file/line\\
1273 1286 "stdname" standard name\\
1274 1287 "time" internal time
1275 1288
1276 1289 Note that all sorts on statistics are in descending order (placing
1277 1290 most time consuming items first), where as name, file, and line number
1278 1291 searches are in ascending order (i.e., alphabetical). The subtle
1279 1292 distinction between "nfl" and "stdname" is that the standard name is a
1280 1293 sort of the name as printed, which means that the embedded line
1281 1294 numbers get compared in an odd way. For example, lines 3, 20, and 40
1282 1295 would (if the file names were the same) appear in the string order
1283 1296 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1284 1297 line numbers. In fact, sort_stats("nfl") is the same as
1285 1298 sort_stats("name", "file", "line").
1286 1299
1287 1300 -T <filename>: save profile results as shown on screen to a text
1288 1301 file. The profile is still shown on screen.
1289 1302
1290 1303 -D <filename>: save (via dump_stats) profile statistics to given
1291 1304 filename. This data is in a format understod by the pstats module, and
1292 1305 is generated by a call to the dump_stats() method of profile
1293 1306 objects. The profile is still shown on screen.
1294 1307
1295 1308 If you want to run complete programs under the profiler's control, use
1296 1309 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1297 1310 contains profiler specific options as described here.
1298 1311
1299 1312 You can read the complete documentation for the profile module with:\\
1300 1313 In [1]: import profile; profile.help() """
1301 1314
1302 1315 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1303 1316 # protect user quote marks
1304 1317 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1305 1318
1306 1319 if user_mode: # regular user call
1307 1320 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1308 1321 list_all=1)
1309 1322 namespace = self.shell.user_ns
1310 1323 else: # called to run a program by %run -p
1311 1324 try:
1312 1325 filename = get_py_filename(arg_lst[0])
1313 1326 except IOError,msg:
1314 1327 error(msg)
1315 1328 return
1316 1329
1317 1330 arg_str = 'execfile(filename,prog_ns)'
1318 1331 namespace = locals()
1319 1332
1320 1333 opts.merge(opts_def)
1321 1334
1322 1335 prof = profile.Profile()
1323 1336 try:
1324 1337 prof = prof.runctx(arg_str,namespace,namespace)
1325 1338 sys_exit = ''
1326 1339 except SystemExit:
1327 1340 sys_exit = """*** SystemExit exception caught in code being profiled."""
1328 1341
1329 1342 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1330 1343
1331 1344 lims = opts.l
1332 1345 if lims:
1333 1346 lims = [] # rebuild lims with ints/floats/strings
1334 1347 for lim in opts.l:
1335 1348 try:
1336 1349 lims.append(int(lim))
1337 1350 except ValueError:
1338 1351 try:
1339 1352 lims.append(float(lim))
1340 1353 except ValueError:
1341 1354 lims.append(lim)
1342 1355
1343 1356 # trap output
1344 1357 sys_stdout = sys.stdout
1345 1358 stdout_trap = StringIO()
1346 1359 try:
1347 1360 sys.stdout = stdout_trap
1348 1361 stats.print_stats(*lims)
1349 1362 finally:
1350 1363 sys.stdout = sys_stdout
1351 1364 output = stdout_trap.getvalue()
1352 1365 output = output.rstrip()
1353 1366
1354 1367 page(output,screen_lines=self.shell.rc.screen_length)
1355 1368 print sys_exit,
1356 1369
1357 1370 dump_file = opts.D[0]
1358 1371 text_file = opts.T[0]
1359 1372 if dump_file:
1360 1373 prof.dump_stats(dump_file)
1361 1374 print '\n*** Profile stats marshalled to file',\
1362 1375 `dump_file`+'.',sys_exit
1363 1376 if text_file:
1364 1377 file(text_file,'w').write(output)
1365 1378 print '\n*** Profile printout saved to text file',\
1366 1379 `text_file`+'.',sys_exit
1367 1380
1368 1381 if opts.has_key('r'):
1369 1382 return stats
1370 1383 else:
1371 1384 return None
1372 1385
1373 1386 def magic_run(self, parameter_s ='',runner=None):
1374 1387 """Run the named file inside IPython as a program.
1375 1388
1376 1389 Usage:\\
1377 1390 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1378 1391
1379 1392 Parameters after the filename are passed as command-line arguments to
1380 1393 the program (put in sys.argv). Then, control returns to IPython's
1381 1394 prompt.
1382 1395
1383 1396 This is similar to running at a system prompt:\\
1384 1397 $ python file args\\
1385 1398 but with the advantage of giving you IPython's tracebacks, and of
1386 1399 loading all variables into your interactive namespace for further use
1387 1400 (unless -p is used, see below).
1388 1401
1389 1402 The file is executed in a namespace initially consisting only of
1390 1403 __name__=='__main__' and sys.argv constructed as indicated. It thus
1391 1404 sees its environment as if it were being run as a stand-alone
1392 1405 program. But after execution, the IPython interactive namespace gets
1393 1406 updated with all variables defined in the program (except for __name__
1394 1407 and sys.argv). This allows for very convenient loading of code for
1395 1408 interactive work, while giving each program a 'clean sheet' to run in.
1396 1409
1397 1410 Options:
1398 1411
1399 1412 -n: __name__ is NOT set to '__main__', but to the running file's name
1400 1413 without extension (as python does under import). This allows running
1401 1414 scripts and reloading the definitions in them without calling code
1402 1415 protected by an ' if __name__ == "__main__" ' clause.
1403 1416
1404 1417 -i: run the file in IPython's namespace instead of an empty one. This
1405 1418 is useful if you are experimenting with code written in a text editor
1406 1419 which depends on variables defined interactively.
1407 1420
1408 1421 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1409 1422 being run. This is particularly useful if IPython is being used to
1410 1423 run unittests, which always exit with a sys.exit() call. In such
1411 1424 cases you are interested in the output of the test results, not in
1412 1425 seeing a traceback of the unittest module.
1413 1426
1414 1427 -t: print timing information at the end of the run. IPython will give
1415 1428 you an estimated CPU time consumption for your script, which under
1416 1429 Unix uses the resource module to avoid the wraparound problems of
1417 1430 time.clock(). Under Unix, an estimate of time spent on system tasks
1418 1431 is also given (for Windows platforms this is reported as 0.0).
1419 1432
1420 1433 If -t is given, an additional -N<N> option can be given, where <N>
1421 1434 must be an integer indicating how many times you want the script to
1422 1435 run. The final timing report will include total and per run results.
1423 1436
1424 1437 For example (testing the script uniq_stable.py):
1425 1438
1426 1439 In [1]: run -t uniq_stable
1427 1440
1428 1441 IPython CPU timings (estimated):\\
1429 1442 User : 0.19597 s.\\
1430 1443 System: 0.0 s.\\
1431 1444
1432 1445 In [2]: run -t -N5 uniq_stable
1433 1446
1434 1447 IPython CPU timings (estimated):\\
1435 1448 Total runs performed: 5\\
1436 1449 Times : Total Per run\\
1437 1450 User : 0.910862 s, 0.1821724 s.\\
1438 1451 System: 0.0 s, 0.0 s.
1439 1452
1440 1453 -d: run your program under the control of pdb, the Python debugger.
1441 1454 This allows you to execute your program step by step, watch variables,
1442 1455 etc. Internally, what IPython does is similar to calling:
1443 1456
1444 1457 pdb.run('execfile("YOURFILENAME")')
1445 1458
1446 1459 with a breakpoint set on line 1 of your file. You can change the line
1447 1460 number for this automatic breakpoint to be <N> by using the -bN option
1448 1461 (where N must be an integer). For example:
1449 1462
1450 1463 %run -d -b40 myscript
1451 1464
1452 1465 will set the first breakpoint at line 40 in myscript.py. Note that
1453 1466 the first breakpoint must be set on a line which actually does
1454 1467 something (not a comment or docstring) for it to stop execution.
1455 1468
1456 1469 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1457 1470 first enter 'c' (without qoutes) to start execution up to the first
1458 1471 breakpoint.
1459 1472
1460 1473 Entering 'help' gives information about the use of the debugger. You
1461 1474 can easily see pdb's full documentation with "import pdb;pdb.help()"
1462 1475 at a prompt.
1463 1476
1464 1477 -p: run program under the control of the Python profiler module (which
1465 1478 prints a detailed report of execution times, function calls, etc).
1466 1479
1467 1480 You can pass other options after -p which affect the behavior of the
1468 1481 profiler itself. See the docs for %prun for details.
1469 1482
1470 1483 In this mode, the program's variables do NOT propagate back to the
1471 1484 IPython interactive namespace (because they remain in the namespace
1472 1485 where the profiler executes them).
1473 1486
1474 1487 Internally this triggers a call to %prun, see its documentation for
1475 1488 details on the options available specifically for profiling.
1476 1489
1477 1490 There is one special usage for which the text above doesn't apply:
1478 1491 if the filename ends with .ipy, the file is run as ipython script,
1479 1492 just as if the commands were written on IPython prompt.
1480 1493 """
1481 1494
1482 1495 # get arguments and set sys.argv for program to be run.
1483 1496 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1484 1497 mode='list',list_all=1)
1485 1498
1486 1499 try:
1487 1500 filename = get_py_filename(arg_lst[0])
1488 1501 except IndexError:
1489 1502 warn('you must provide at least a filename.')
1490 1503 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1491 1504 return
1492 1505 except IOError,msg:
1493 1506 error(msg)
1494 1507 return
1495 1508
1496 1509 if filename.lower().endswith('.ipy'):
1497 1510 self.api.runlines(open(filename).read())
1498 1511 return
1499 1512
1500 1513 # Control the response to exit() calls made by the script being run
1501 1514 exit_ignore = opts.has_key('e')
1502 1515
1503 1516 # Make sure that the running script gets a proper sys.argv as if it
1504 1517 # were run from a system shell.
1505 1518 save_argv = sys.argv # save it for later restoring
1506 1519 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1507 1520
1508 1521 if opts.has_key('i'):
1509 1522 prog_ns = self.shell.user_ns
1510 1523 __name__save = self.shell.user_ns['__name__']
1511 1524 prog_ns['__name__'] = '__main__'
1512 1525 else:
1513 1526 if opts.has_key('n'):
1514 1527 name = os.path.splitext(os.path.basename(filename))[0]
1515 1528 else:
1516 1529 name = '__main__'
1517 1530 prog_ns = {'__name__':name}
1518 1531
1519 1532 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1520 1533 # set the __file__ global in the script's namespace
1521 1534 prog_ns['__file__'] = filename
1522 1535
1523 1536 # pickle fix. See iplib for an explanation. But we need to make sure
1524 1537 # that, if we overwrite __main__, we replace it at the end
1525 1538 if prog_ns['__name__'] == '__main__':
1526 1539 restore_main = sys.modules['__main__']
1527 1540 else:
1528 1541 restore_main = False
1529 1542
1530 1543 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1531 1544
1532 1545 stats = None
1533 1546 try:
1534 1547 if self.shell.has_readline:
1535 1548 self.shell.savehist()
1536 1549
1537 1550 if opts.has_key('p'):
1538 1551 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1539 1552 else:
1540 1553 if opts.has_key('d'):
1541 1554 deb = Debugger.Pdb(self.shell.rc.colors)
1542 1555 # reset Breakpoint state, which is moronically kept
1543 1556 # in a class
1544 1557 bdb.Breakpoint.next = 1
1545 1558 bdb.Breakpoint.bplist = {}
1546 1559 bdb.Breakpoint.bpbynumber = [None]
1547 1560 # Set an initial breakpoint to stop execution
1548 1561 maxtries = 10
1549 1562 bp = int(opts.get('b',[1])[0])
1550 1563 checkline = deb.checkline(filename,bp)
1551 1564 if not checkline:
1552 1565 for bp in range(bp+1,bp+maxtries+1):
1553 1566 if deb.checkline(filename,bp):
1554 1567 break
1555 1568 else:
1556 1569 msg = ("\nI failed to find a valid line to set "
1557 1570 "a breakpoint\n"
1558 1571 "after trying up to line: %s.\n"
1559 1572 "Please set a valid breakpoint manually "
1560 1573 "with the -b option." % bp)
1561 1574 error(msg)
1562 1575 return
1563 1576 # if we find a good linenumber, set the breakpoint
1564 1577 deb.do_break('%s:%s' % (filename,bp))
1565 1578 # Start file run
1566 1579 print "NOTE: Enter 'c' at the",
1567 1580 print "%s prompt to start your script." % deb.prompt
1568 1581 try:
1569 1582 deb.run('execfile("%s")' % filename,prog_ns)
1570 1583
1571 1584 except:
1572 1585 etype, value, tb = sys.exc_info()
1573 1586 # Skip three frames in the traceback: the %run one,
1574 1587 # one inside bdb.py, and the command-line typed by the
1575 1588 # user (run by exec in pdb itself).
1576 1589 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1577 1590 else:
1578 1591 if runner is None:
1579 1592 runner = self.shell.safe_execfile
1580 1593 if opts.has_key('t'):
1581 1594 try:
1582 1595 nruns = int(opts['N'][0])
1583 1596 if nruns < 1:
1584 1597 error('Number of runs must be >=1')
1585 1598 return
1586 1599 except (KeyError):
1587 1600 nruns = 1
1588 1601 if nruns == 1:
1589 1602 t0 = clock2()
1590 1603 runner(filename,prog_ns,prog_ns,
1591 1604 exit_ignore=exit_ignore)
1592 1605 t1 = clock2()
1593 1606 t_usr = t1[0]-t0[0]
1594 1607 t_sys = t1[1]-t1[1]
1595 1608 print "\nIPython CPU timings (estimated):"
1596 1609 print " User : %10s s." % t_usr
1597 1610 print " System: %10s s." % t_sys
1598 1611 else:
1599 1612 runs = range(nruns)
1600 1613 t0 = clock2()
1601 1614 for nr in runs:
1602 1615 runner(filename,prog_ns,prog_ns,
1603 1616 exit_ignore=exit_ignore)
1604 1617 t1 = clock2()
1605 1618 t_usr = t1[0]-t0[0]
1606 1619 t_sys = t1[1]-t1[1]
1607 1620 print "\nIPython CPU timings (estimated):"
1608 1621 print "Total runs performed:",nruns
1609 1622 print " Times : %10s %10s" % ('Total','Per run')
1610 1623 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1611 1624 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1612 1625
1613 1626 else:
1614 1627 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1615 1628 if opts.has_key('i'):
1616 1629 self.shell.user_ns['__name__'] = __name__save
1617 1630 else:
1618 1631 # update IPython interactive namespace
1619 1632 del prog_ns['__name__']
1620 1633 self.shell.user_ns.update(prog_ns)
1621 1634 finally:
1622 1635 sys.argv = save_argv
1623 1636 if restore_main:
1624 1637 sys.modules['__main__'] = restore_main
1625 1638 if self.shell.has_readline:
1626 1639 self.shell.readline.read_history_file(self.shell.histfile)
1627 1640
1628 1641 return stats
1629 1642
1630 1643 def magic_runlog(self, parameter_s =''):
1631 1644 """Run files as logs.
1632 1645
1633 1646 Usage:\\
1634 1647 %runlog file1 file2 ...
1635 1648
1636 1649 Run the named files (treating them as log files) in sequence inside
1637 1650 the interpreter, and return to the prompt. This is much slower than
1638 1651 %run because each line is executed in a try/except block, but it
1639 1652 allows running files with syntax errors in them.
1640 1653
1641 1654 Normally IPython will guess when a file is one of its own logfiles, so
1642 1655 you can typically use %run even for logs. This shorthand allows you to
1643 1656 force any file to be treated as a log file."""
1644 1657
1645 1658 for f in parameter_s.split():
1646 1659 self.shell.safe_execfile(f,self.shell.user_ns,
1647 1660 self.shell.user_ns,islog=1)
1648 1661
1649 1662 def magic_timeit(self, parameter_s =''):
1650 1663 """Time execution of a Python statement or expression
1651 1664
1652 1665 Usage:\\
1653 1666 %timeit [-n<N> -r<R> [-t|-c]] statement
1654 1667
1655 1668 Time execution of a Python statement or expression using the timeit
1656 1669 module.
1657 1670
1658 1671 Options:
1659 1672 -n<N>: execute the given statement <N> times in a loop. If this value
1660 1673 is not given, a fitting value is chosen.
1661 1674
1662 1675 -r<R>: repeat the loop iteration <R> times and take the best result.
1663 1676 Default: 3
1664 1677
1665 1678 -t: use time.time to measure the time, which is the default on Unix.
1666 1679 This function measures wall time.
1667 1680
1668 1681 -c: use time.clock to measure the time, which is the default on
1669 1682 Windows and measures wall time. On Unix, resource.getrusage is used
1670 1683 instead and returns the CPU user time.
1671 1684
1672 1685 -p<P>: use a precision of <P> digits to display the timing result.
1673 1686 Default: 3
1674 1687
1675 1688
1676 1689 Examples:\\
1677 1690 In [1]: %timeit pass
1678 1691 10000000 loops, best of 3: 53.3 ns per loop
1679 1692
1680 1693 In [2]: u = None
1681 1694
1682 1695 In [3]: %timeit u is None
1683 1696 10000000 loops, best of 3: 184 ns per loop
1684 1697
1685 1698 In [4]: %timeit -r 4 u == None
1686 1699 1000000 loops, best of 4: 242 ns per loop
1687 1700
1688 1701 In [5]: import time
1689 1702
1690 1703 In [6]: %timeit -n1 time.sleep(2)
1691 1704 1 loops, best of 3: 2 s per loop
1692 1705
1693 1706
1694 1707 The times reported by %timeit will be slightly higher than those
1695 1708 reported by the timeit.py script when variables are accessed. This is
1696 1709 due to the fact that %timeit executes the statement in the namespace
1697 1710 of the shell, compared with timeit.py, which uses a single setup
1698 1711 statement to import function or create variables. Generally, the bias
1699 1712 does not matter as long as results from timeit.py are not mixed with
1700 1713 those from %timeit."""
1701 1714
1702 1715 import timeit
1703 1716 import math
1704 1717
1705 1718 units = ["s", "ms", "\xc2\xb5s", "ns"]
1706 1719 scaling = [1, 1e3, 1e6, 1e9]
1707 1720
1708 1721 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1709 1722 posix=False)
1710 1723 if stmt == "":
1711 1724 return
1712 1725 timefunc = timeit.default_timer
1713 1726 number = int(getattr(opts, "n", 0))
1714 1727 repeat = int(getattr(opts, "r", timeit.default_repeat))
1715 1728 precision = int(getattr(opts, "p", 3))
1716 1729 if hasattr(opts, "t"):
1717 1730 timefunc = time.time
1718 1731 if hasattr(opts, "c"):
1719 1732 timefunc = clock
1720 1733
1721 1734 timer = timeit.Timer(timer=timefunc)
1722 1735 # this code has tight coupling to the inner workings of timeit.Timer,
1723 1736 # but is there a better way to achieve that the code stmt has access
1724 1737 # to the shell namespace?
1725 1738
1726 1739 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1727 1740 'setup': "pass"}
1728 1741 code = compile(src, "<magic-timeit>", "exec")
1729 1742 ns = {}
1730 1743 exec code in self.shell.user_ns, ns
1731 1744 timer.inner = ns["inner"]
1732 1745
1733 1746 if number == 0:
1734 1747 # determine number so that 0.2 <= total time < 2.0
1735 1748 number = 1
1736 1749 for i in range(1, 10):
1737 1750 number *= 10
1738 1751 if timer.timeit(number) >= 0.2:
1739 1752 break
1740 1753
1741 1754 best = min(timer.repeat(repeat, number)) / number
1742 1755
1743 1756 if best > 0.0:
1744 1757 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1745 1758 else:
1746 1759 order = 3
1747 1760 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1748 1761 precision,
1749 1762 best * scaling[order],
1750 1763 units[order])
1751 1764
1752 1765 def magic_time(self,parameter_s = ''):
1753 1766 """Time execution of a Python statement or expression.
1754 1767
1755 1768 The CPU and wall clock times are printed, and the value of the
1756 1769 expression (if any) is returned. Note that under Win32, system time
1757 1770 is always reported as 0, since it can not be measured.
1758 1771
1759 1772 This function provides very basic timing functionality. In Python
1760 1773 2.3, the timeit module offers more control and sophistication, so this
1761 1774 could be rewritten to use it (patches welcome).
1762 1775
1763 1776 Some examples:
1764 1777
1765 1778 In [1]: time 2**128
1766 1779 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1767 1780 Wall time: 0.00
1768 1781 Out[1]: 340282366920938463463374607431768211456L
1769 1782
1770 1783 In [2]: n = 1000000
1771 1784
1772 1785 In [3]: time sum(range(n))
1773 1786 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1774 1787 Wall time: 1.37
1775 1788 Out[3]: 499999500000L
1776 1789
1777 1790 In [4]: time print 'hello world'
1778 1791 hello world
1779 1792 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1780 1793 Wall time: 0.00
1781 1794 """
1782 1795
1783 1796 # fail immediately if the given expression can't be compiled
1784 1797 try:
1785 1798 mode = 'eval'
1786 1799 code = compile(parameter_s,'<timed eval>',mode)
1787 1800 except SyntaxError:
1788 1801 mode = 'exec'
1789 1802 code = compile(parameter_s,'<timed exec>',mode)
1790 1803 # skew measurement as little as possible
1791 1804 glob = self.shell.user_ns
1792 1805 clk = clock2
1793 1806 wtime = time.time
1794 1807 # time execution
1795 1808 wall_st = wtime()
1796 1809 if mode=='eval':
1797 1810 st = clk()
1798 1811 out = eval(code,glob)
1799 1812 end = clk()
1800 1813 else:
1801 1814 st = clk()
1802 1815 exec code in glob
1803 1816 end = clk()
1804 1817 out = None
1805 1818 wall_end = wtime()
1806 1819 # Compute actual times and report
1807 1820 wall_time = wall_end-wall_st
1808 1821 cpu_user = end[0]-st[0]
1809 1822 cpu_sys = end[1]-st[1]
1810 1823 cpu_tot = cpu_user+cpu_sys
1811 1824 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1812 1825 (cpu_user,cpu_sys,cpu_tot)
1813 1826 print "Wall time: %.2f" % wall_time
1814 1827 return out
1815 1828
1816 1829 def magic_macro(self,parameter_s = ''):
1817 1830 """Define a set of input lines as a macro for future re-execution.
1818 1831
1819 1832 Usage:\\
1820 1833 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1821 1834
1822 1835 Options:
1823 1836
1824 1837 -r: use 'raw' input. By default, the 'processed' history is used,
1825 1838 so that magics are loaded in their transformed version to valid
1826 1839 Python. If this option is given, the raw input as typed as the
1827 1840 command line is used instead.
1828 1841
1829 1842 This will define a global variable called `name` which is a string
1830 1843 made of joining the slices and lines you specify (n1,n2,... numbers
1831 1844 above) from your input history into a single string. This variable
1832 1845 acts like an automatic function which re-executes those lines as if
1833 1846 you had typed them. You just type 'name' at the prompt and the code
1834 1847 executes.
1835 1848
1836 1849 The notation for indicating number ranges is: n1-n2 means 'use line
1837 1850 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1838 1851 using the lines numbered 5,6 and 7.
1839 1852
1840 1853 Note: as a 'hidden' feature, you can also use traditional python slice
1841 1854 notation, where N:M means numbers N through M-1.
1842 1855
1843 1856 For example, if your history contains (%hist prints it):
1844 1857
1845 1858 44: x=1\\
1846 1859 45: y=3\\
1847 1860 46: z=x+y\\
1848 1861 47: print x\\
1849 1862 48: a=5\\
1850 1863 49: print 'x',x,'y',y\\
1851 1864
1852 1865 you can create a macro with lines 44 through 47 (included) and line 49
1853 1866 called my_macro with:
1854 1867
1855 1868 In [51]: %macro my_macro 44-47 49
1856 1869
1857 1870 Now, typing `my_macro` (without quotes) will re-execute all this code
1858 1871 in one pass.
1859 1872
1860 1873 You don't need to give the line-numbers in order, and any given line
1861 1874 number can appear multiple times. You can assemble macros with any
1862 1875 lines from your input history in any order.
1863 1876
1864 1877 The macro is a simple object which holds its value in an attribute,
1865 1878 but IPython's display system checks for macros and executes them as
1866 1879 code instead of printing them when you type their name.
1867 1880
1868 1881 You can view a macro's contents by explicitly printing it with:
1869 1882
1870 1883 'print macro_name'.
1871 1884
1872 1885 For one-off cases which DON'T contain magic function calls in them you
1873 1886 can obtain similar results by explicitly executing slices from your
1874 1887 input history with:
1875 1888
1876 1889 In [60]: exec In[44:48]+In[49]"""
1877 1890
1878 1891 opts,args = self.parse_options(parameter_s,'r',mode='list')
1879 1892 name,ranges = args[0], args[1:]
1880 1893 #print 'rng',ranges # dbg
1881 1894 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1882 1895 macro = Macro(lines)
1883 1896 self.shell.user_ns.update({name:macro})
1884 1897 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1885 1898 print 'Macro contents:'
1886 1899 print macro,
1887 1900
1888 1901 def magic_save(self,parameter_s = ''):
1889 1902 """Save a set of lines to a given filename.
1890 1903
1891 1904 Usage:\\
1892 1905 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1893 1906
1894 1907 Options:
1895 1908
1896 1909 -r: use 'raw' input. By default, the 'processed' history is used,
1897 1910 so that magics are loaded in their transformed version to valid
1898 1911 Python. If this option is given, the raw input as typed as the
1899 1912 command line is used instead.
1900 1913
1901 1914 This function uses the same syntax as %macro for line extraction, but
1902 1915 instead of creating a macro it saves the resulting string to the
1903 1916 filename you specify.
1904 1917
1905 1918 It adds a '.py' extension to the file if you don't do so yourself, and
1906 1919 it asks for confirmation before overwriting existing files."""
1907 1920
1908 1921 opts,args = self.parse_options(parameter_s,'r',mode='list')
1909 1922 fname,ranges = args[0], args[1:]
1910 1923 if not fname.endswith('.py'):
1911 1924 fname += '.py'
1912 1925 if os.path.isfile(fname):
1913 1926 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1914 1927 if ans.lower() not in ['y','yes']:
1915 1928 print 'Operation cancelled.'
1916 1929 return
1917 1930 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1918 1931 f = file(fname,'w')
1919 1932 f.write(cmds)
1920 1933 f.close()
1921 1934 print 'The following commands were written to file `%s`:' % fname
1922 1935 print cmds
1923 1936
1924 1937 def _edit_macro(self,mname,macro):
1925 1938 """open an editor with the macro data in a file"""
1926 1939 filename = self.shell.mktempfile(macro.value)
1927 1940 self.shell.hooks.editor(filename)
1928 1941
1929 1942 # and make a new macro object, to replace the old one
1930 1943 mfile = open(filename)
1931 1944 mvalue = mfile.read()
1932 1945 mfile.close()
1933 1946 self.shell.user_ns[mname] = Macro(mvalue)
1934 1947
1935 1948 def magic_ed(self,parameter_s=''):
1936 1949 """Alias to %edit."""
1937 1950 return self.magic_edit(parameter_s)
1938 1951
1939 1952 def magic_edit(self,parameter_s='',last_call=['','']):
1940 1953 """Bring up an editor and execute the resulting code.
1941 1954
1942 1955 Usage:
1943 1956 %edit [options] [args]
1944 1957
1945 1958 %edit runs IPython's editor hook. The default version of this hook is
1946 1959 set to call the __IPYTHON__.rc.editor command. This is read from your
1947 1960 environment variable $EDITOR. If this isn't found, it will default to
1948 1961 vi under Linux/Unix and to notepad under Windows. See the end of this
1949 1962 docstring for how to change the editor hook.
1950 1963
1951 1964 You can also set the value of this editor via the command line option
1952 1965 '-editor' or in your ipythonrc file. This is useful if you wish to use
1953 1966 specifically for IPython an editor different from your typical default
1954 1967 (and for Windows users who typically don't set environment variables).
1955 1968
1956 1969 This command allows you to conveniently edit multi-line code right in
1957 1970 your IPython session.
1958 1971
1959 1972 If called without arguments, %edit opens up an empty editor with a
1960 1973 temporary file and will execute the contents of this file when you
1961 1974 close it (don't forget to save it!).
1962 1975
1963 1976
1964 1977 Options:
1965 1978
1966 1979 -n <number>: open the editor at a specified line number. By default,
1967 1980 the IPython editor hook uses the unix syntax 'editor +N filename', but
1968 1981 you can configure this by providing your own modified hook if your
1969 1982 favorite editor supports line-number specifications with a different
1970 1983 syntax.
1971 1984
1972 1985 -p: this will call the editor with the same data as the previous time
1973 1986 it was used, regardless of how long ago (in your current session) it
1974 1987 was.
1975 1988
1976 1989 -r: use 'raw' input. This option only applies to input taken from the
1977 1990 user's history. By default, the 'processed' history is used, so that
1978 1991 magics are loaded in their transformed version to valid Python. If
1979 1992 this option is given, the raw input as typed as the command line is
1980 1993 used instead. When you exit the editor, it will be executed by
1981 1994 IPython's own processor.
1982 1995
1983 1996 -x: do not execute the edited code immediately upon exit. This is
1984 1997 mainly useful if you are editing programs which need to be called with
1985 1998 command line arguments, which you can then do using %run.
1986 1999
1987 2000
1988 2001 Arguments:
1989 2002
1990 2003 If arguments are given, the following possibilites exist:
1991 2004
1992 2005 - The arguments are numbers or pairs of colon-separated numbers (like
1993 2006 1 4:8 9). These are interpreted as lines of previous input to be
1994 2007 loaded into the editor. The syntax is the same of the %macro command.
1995 2008
1996 2009 - If the argument doesn't start with a number, it is evaluated as a
1997 2010 variable and its contents loaded into the editor. You can thus edit
1998 2011 any string which contains python code (including the result of
1999 2012 previous edits).
2000 2013
2001 2014 - If the argument is the name of an object (other than a string),
2002 2015 IPython will try to locate the file where it was defined and open the
2003 2016 editor at the point where it is defined. You can use `%edit function`
2004 2017 to load an editor exactly at the point where 'function' is defined,
2005 2018 edit it and have the file be executed automatically.
2006 2019
2007 2020 If the object is a macro (see %macro for details), this opens up your
2008 2021 specified editor with a temporary file containing the macro's data.
2009 2022 Upon exit, the macro is reloaded with the contents of the file.
2010 2023
2011 2024 Note: opening at an exact line is only supported under Unix, and some
2012 2025 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2013 2026 '+NUMBER' parameter necessary for this feature. Good editors like
2014 2027 (X)Emacs, vi, jed, pico and joe all do.
2015 2028
2016 2029 - If the argument is not found as a variable, IPython will look for a
2017 2030 file with that name (adding .py if necessary) and load it into the
2018 2031 editor. It will execute its contents with execfile() when you exit,
2019 2032 loading any code in the file into your interactive namespace.
2020 2033
2021 2034 After executing your code, %edit will return as output the code you
2022 2035 typed in the editor (except when it was an existing file). This way
2023 2036 you can reload the code in further invocations of %edit as a variable,
2024 2037 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2025 2038 the output.
2026 2039
2027 2040 Note that %edit is also available through the alias %ed.
2028 2041
2029 2042 This is an example of creating a simple function inside the editor and
2030 2043 then modifying it. First, start up the editor:
2031 2044
2032 2045 In [1]: ed\\
2033 2046 Editing... done. Executing edited code...\\
2034 2047 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2035 2048
2036 2049 We can then call the function foo():
2037 2050
2038 2051 In [2]: foo()\\
2039 2052 foo() was defined in an editing session
2040 2053
2041 2054 Now we edit foo. IPython automatically loads the editor with the
2042 2055 (temporary) file where foo() was previously defined:
2043 2056
2044 2057 In [3]: ed foo\\
2045 2058 Editing... done. Executing edited code...
2046 2059
2047 2060 And if we call foo() again we get the modified version:
2048 2061
2049 2062 In [4]: foo()\\
2050 2063 foo() has now been changed!
2051 2064
2052 2065 Here is an example of how to edit a code snippet successive
2053 2066 times. First we call the editor:
2054 2067
2055 2068 In [8]: ed\\
2056 2069 Editing... done. Executing edited code...\\
2057 2070 hello\\
2058 2071 Out[8]: "print 'hello'\\n"
2059 2072
2060 2073 Now we call it again with the previous output (stored in _):
2061 2074
2062 2075 In [9]: ed _\\
2063 2076 Editing... done. Executing edited code...\\
2064 2077 hello world\\
2065 2078 Out[9]: "print 'hello world'\\n"
2066 2079
2067 2080 Now we call it with the output #8 (stored in _8, also as Out[8]):
2068 2081
2069 2082 In [10]: ed _8\\
2070 2083 Editing... done. Executing edited code...\\
2071 2084 hello again\\
2072 2085 Out[10]: "print 'hello again'\\n"
2073 2086
2074 2087
2075 2088 Changing the default editor hook:
2076 2089
2077 2090 If you wish to write your own editor hook, you can put it in a
2078 2091 configuration file which you load at startup time. The default hook
2079 2092 is defined in the IPython.hooks module, and you can use that as a
2080 2093 starting example for further modifications. That file also has
2081 2094 general instructions on how to set a new hook for use once you've
2082 2095 defined it."""
2083 2096
2084 2097 # FIXME: This function has become a convoluted mess. It needs a
2085 2098 # ground-up rewrite with clean, simple logic.
2086 2099
2087 2100 def make_filename(arg):
2088 2101 "Make a filename from the given args"
2089 2102 try:
2090 2103 filename = get_py_filename(arg)
2091 2104 except IOError:
2092 2105 if args.endswith('.py'):
2093 2106 filename = arg
2094 2107 else:
2095 2108 filename = None
2096 2109 return filename
2097 2110
2098 2111 # custom exceptions
2099 2112 class DataIsObject(Exception): pass
2100 2113
2101 2114 opts,args = self.parse_options(parameter_s,'prxn:')
2102 2115 # Set a few locals from the options for convenience:
2103 2116 opts_p = opts.has_key('p')
2104 2117 opts_r = opts.has_key('r')
2105 2118
2106 2119 # Default line number value
2107 2120 lineno = opts.get('n',None)
2108 2121
2109 2122 if opts_p:
2110 2123 args = '_%s' % last_call[0]
2111 2124 if not self.shell.user_ns.has_key(args):
2112 2125 args = last_call[1]
2113 2126
2114 2127 # use last_call to remember the state of the previous call, but don't
2115 2128 # let it be clobbered by successive '-p' calls.
2116 2129 try:
2117 2130 last_call[0] = self.shell.outputcache.prompt_count
2118 2131 if not opts_p:
2119 2132 last_call[1] = parameter_s
2120 2133 except:
2121 2134 pass
2122 2135
2123 2136 # by default this is done with temp files, except when the given
2124 2137 # arg is a filename
2125 2138 use_temp = 1
2126 2139
2127 2140 if re.match(r'\d',args):
2128 2141 # Mode where user specifies ranges of lines, like in %macro.
2129 2142 # This means that you can't edit files whose names begin with
2130 2143 # numbers this way. Tough.
2131 2144 ranges = args.split()
2132 2145 data = ''.join(self.extract_input_slices(ranges,opts_r))
2133 2146 elif args.endswith('.py'):
2134 2147 filename = make_filename(args)
2135 2148 data = ''
2136 2149 use_temp = 0
2137 2150 elif args:
2138 2151 try:
2139 2152 # Load the parameter given as a variable. If not a string,
2140 2153 # process it as an object instead (below)
2141 2154
2142 2155 #print '*** args',args,'type',type(args) # dbg
2143 2156 data = eval(args,self.shell.user_ns)
2144 2157 if not type(data) in StringTypes:
2145 2158 raise DataIsObject
2146 2159
2147 2160 except (NameError,SyntaxError):
2148 2161 # given argument is not a variable, try as a filename
2149 2162 filename = make_filename(args)
2150 2163 if filename is None:
2151 2164 warn("Argument given (%s) can't be found as a variable "
2152 2165 "or as a filename." % args)
2153 2166 return
2154 2167
2155 2168 data = ''
2156 2169 use_temp = 0
2157 2170 except DataIsObject:
2158 2171
2159 2172 # macros have a special edit function
2160 2173 if isinstance(data,Macro):
2161 2174 self._edit_macro(args,data)
2162 2175 return
2163 2176
2164 2177 # For objects, try to edit the file where they are defined
2165 2178 try:
2166 2179 filename = inspect.getabsfile(data)
2167 2180 datafile = 1
2168 2181 except TypeError:
2169 2182 filename = make_filename(args)
2170 2183 datafile = 1
2171 2184 warn('Could not find file where `%s` is defined.\n'
2172 2185 'Opening a file named `%s`' % (args,filename))
2173 2186 # Now, make sure we can actually read the source (if it was in
2174 2187 # a temp file it's gone by now).
2175 2188 if datafile:
2176 2189 try:
2177 2190 if lineno is None:
2178 2191 lineno = inspect.getsourcelines(data)[1]
2179 2192 except IOError:
2180 2193 filename = make_filename(args)
2181 2194 if filename is None:
2182 2195 warn('The file `%s` where `%s` was defined cannot '
2183 2196 'be read.' % (filename,data))
2184 2197 return
2185 2198 use_temp = 0
2186 2199 else:
2187 2200 data = ''
2188 2201
2189 2202 if use_temp:
2190 2203 filename = self.shell.mktempfile(data)
2191 2204 print 'IPython will make a temporary file named:',filename
2192 2205
2193 2206 # do actual editing here
2194 2207 print 'Editing...',
2195 2208 sys.stdout.flush()
2196 2209 self.shell.hooks.editor(filename,lineno)
2197 2210 if opts.has_key('x'): # -x prevents actual execution
2198 2211 print
2199 2212 else:
2200 2213 print 'done. Executing edited code...'
2201 2214 if opts_r:
2202 2215 self.shell.runlines(file_read(filename))
2203 2216 else:
2204 2217 self.shell.safe_execfile(filename,self.shell.user_ns)
2205 2218 if use_temp:
2206 2219 try:
2207 2220 return open(filename).read()
2208 2221 except IOError,msg:
2209 2222 if msg.filename == filename:
2210 2223 warn('File not found. Did you forget to save?')
2211 2224 return
2212 2225 else:
2213 2226 self.shell.showtraceback()
2214 2227
2215 2228 def magic_xmode(self,parameter_s = ''):
2216 2229 """Switch modes for the exception handlers.
2217 2230
2218 2231 Valid modes: Plain, Context and Verbose.
2219 2232
2220 2233 If called without arguments, acts as a toggle."""
2221 2234
2222 2235 def xmode_switch_err(name):
2223 2236 warn('Error changing %s exception modes.\n%s' %
2224 2237 (name,sys.exc_info()[1]))
2225 2238
2226 2239 shell = self.shell
2227 2240 new_mode = parameter_s.strip().capitalize()
2228 2241 try:
2229 2242 shell.InteractiveTB.set_mode(mode=new_mode)
2230 2243 print 'Exception reporting mode:',shell.InteractiveTB.mode
2231 2244 except:
2232 2245 xmode_switch_err('user')
2233 2246
2234 2247 # threaded shells use a special handler in sys.excepthook
2235 2248 if shell.isthreaded:
2236 2249 try:
2237 2250 shell.sys_excepthook.set_mode(mode=new_mode)
2238 2251 except:
2239 2252 xmode_switch_err('threaded')
2240 2253
2241 2254 def magic_colors(self,parameter_s = ''):
2242 2255 """Switch color scheme for prompts, info system and exception handlers.
2243 2256
2244 2257 Currently implemented schemes: NoColor, Linux, LightBG.
2245 2258
2246 2259 Color scheme names are not case-sensitive."""
2247 2260
2248 2261 def color_switch_err(name):
2249 2262 warn('Error changing %s color schemes.\n%s' %
2250 2263 (name,sys.exc_info()[1]))
2251 2264
2252 2265
2253 2266 new_scheme = parameter_s.strip()
2254 2267 if not new_scheme:
2255 2268 print 'You must specify a color scheme.'
2256 2269 return
2257 2270 import IPython.rlineimpl as readline
2258 2271 if not readline.have_readline:
2259 2272 msg = """\
2260 2273 Proper color support under MS Windows requires the pyreadline library.
2261 2274 You can find it at:
2262 2275 http://ipython.scipy.org/moin/PyReadline/Intro
2263 2276 Gary's readline needs the ctypes module, from:
2264 2277 http://starship.python.net/crew/theller/ctypes
2265 2278 (Note that ctypes is already part of Python versions 2.5 and newer).
2266 2279
2267 2280 Defaulting color scheme to 'NoColor'"""
2268 2281 new_scheme = 'NoColor'
2269 2282 warn(msg)
2270 2283 # local shortcut
2271 2284 shell = self.shell
2272 2285
2273 2286 # Set prompt colors
2274 2287 try:
2275 2288 shell.outputcache.set_colors(new_scheme)
2276 2289 except:
2277 2290 color_switch_err('prompt')
2278 2291 else:
2279 2292 shell.rc.colors = \
2280 2293 shell.outputcache.color_table.active_scheme_name
2281 2294 # Set exception colors
2282 2295 try:
2283 2296 shell.InteractiveTB.set_colors(scheme = new_scheme)
2284 2297 shell.SyntaxTB.set_colors(scheme = new_scheme)
2285 2298 except:
2286 2299 color_switch_err('exception')
2287 2300
2288 2301 # threaded shells use a verbose traceback in sys.excepthook
2289 2302 if shell.isthreaded:
2290 2303 try:
2291 2304 shell.sys_excepthook.set_colors(scheme=new_scheme)
2292 2305 except:
2293 2306 color_switch_err('system exception handler')
2294 2307
2295 2308 # Set info (for 'object?') colors
2296 2309 if shell.rc.color_info:
2297 2310 try:
2298 2311 shell.inspector.set_active_scheme(new_scheme)
2299 2312 except:
2300 2313 color_switch_err('object inspector')
2301 2314 else:
2302 2315 shell.inspector.set_active_scheme('NoColor')
2303 2316
2304 2317 def magic_color_info(self,parameter_s = ''):
2305 2318 """Toggle color_info.
2306 2319
2307 2320 The color_info configuration parameter controls whether colors are
2308 2321 used for displaying object details (by things like %psource, %pfile or
2309 2322 the '?' system). This function toggles this value with each call.
2310 2323
2311 2324 Note that unless you have a fairly recent pager (less works better
2312 2325 than more) in your system, using colored object information displays
2313 2326 will not work properly. Test it and see."""
2314 2327
2315 2328 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2316 2329 self.magic_colors(self.shell.rc.colors)
2317 2330 print 'Object introspection functions have now coloring:',
2318 2331 print ['OFF','ON'][self.shell.rc.color_info]
2319 2332
2320 2333 def magic_Pprint(self, parameter_s=''):
2321 2334 """Toggle pretty printing on/off."""
2322 2335
2323 2336 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2324 2337 print 'Pretty printing has been turned', \
2325 2338 ['OFF','ON'][self.shell.rc.pprint]
2326 2339
2327 2340 def magic_exit(self, parameter_s=''):
2328 2341 """Exit IPython, confirming if configured to do so.
2329 2342
2330 2343 You can configure whether IPython asks for confirmation upon exit by
2331 2344 setting the confirm_exit flag in the ipythonrc file."""
2332 2345
2333 2346 self.shell.exit()
2334 2347
2335 2348 def magic_quit(self, parameter_s=''):
2336 2349 """Exit IPython, confirming if configured to do so (like %exit)"""
2337 2350
2338 2351 self.shell.exit()
2339 2352
2340 2353 def magic_Exit(self, parameter_s=''):
2341 2354 """Exit IPython without confirmation."""
2342 2355
2343 2356 self.shell.exit_now = True
2344 2357
2345 2358 def magic_Quit(self, parameter_s=''):
2346 2359 """Exit IPython without confirmation (like %Exit)."""
2347 2360
2348 2361 self.shell.exit_now = True
2349 2362
2350 2363 #......................................................................
2351 2364 # Functions to implement unix shell-type things
2352 2365
2353 2366 def magic_alias(self, parameter_s = ''):
2354 2367 """Define an alias for a system command.
2355 2368
2356 2369 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2357 2370
2358 2371 Then, typing 'alias_name params' will execute the system command 'cmd
2359 2372 params' (from your underlying operating system).
2360 2373
2361 2374 Aliases have lower precedence than magic functions and Python normal
2362 2375 variables, so if 'foo' is both a Python variable and an alias, the
2363 2376 alias can not be executed until 'del foo' removes the Python variable.
2364 2377
2365 2378 You can use the %l specifier in an alias definition to represent the
2366 2379 whole line when the alias is called. For example:
2367 2380
2368 2381 In [2]: alias all echo "Input in brackets: <%l>"\\
2369 2382 In [3]: all hello world\\
2370 2383 Input in brackets: <hello world>
2371 2384
2372 2385 You can also define aliases with parameters using %s specifiers (one
2373 2386 per parameter):
2374 2387
2375 2388 In [1]: alias parts echo first %s second %s\\
2376 2389 In [2]: %parts A B\\
2377 2390 first A second B\\
2378 2391 In [3]: %parts A\\
2379 2392 Incorrect number of arguments: 2 expected.\\
2380 2393 parts is an alias to: 'echo first %s second %s'
2381 2394
2382 2395 Note that %l and %s are mutually exclusive. You can only use one or
2383 2396 the other in your aliases.
2384 2397
2385 2398 Aliases expand Python variables just like system calls using ! or !!
2386 2399 do: all expressions prefixed with '$' get expanded. For details of
2387 2400 the semantic rules, see PEP-215:
2388 2401 http://www.python.org/peps/pep-0215.html. This is the library used by
2389 2402 IPython for variable expansion. If you want to access a true shell
2390 2403 variable, an extra $ is necessary to prevent its expansion by IPython:
2391 2404
2392 2405 In [6]: alias show echo\\
2393 2406 In [7]: PATH='A Python string'\\
2394 2407 In [8]: show $PATH\\
2395 2408 A Python string\\
2396 2409 In [9]: show $$PATH\\
2397 2410 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2398 2411
2399 2412 You can use the alias facility to acess all of $PATH. See the %rehash
2400 2413 and %rehashx functions, which automatically create aliases for the
2401 2414 contents of your $PATH.
2402 2415
2403 2416 If called with no parameters, %alias prints the current alias table."""
2404 2417
2405 2418 par = parameter_s.strip()
2406 2419 if not par:
2407 2420 stored = self.db.get('stored_aliases', {} )
2408 2421 atab = self.shell.alias_table
2409 2422 aliases = atab.keys()
2410 2423 aliases.sort()
2411 2424 res = []
2412 2425 showlast = []
2413 2426 for alias in aliases:
2414 2427 tgt = atab[alias][1]
2415 2428 # 'interesting' aliases
2416 2429 if (alias in stored or
2417 2430 alias != os.path.splitext(tgt)[0] or
2418 2431 ' ' in tgt):
2419 2432 showlast.append((alias, tgt))
2420 2433 else:
2421 2434 res.append((alias, tgt ))
2422 2435
2423 2436 # show most interesting aliases last
2424 2437 res.extend(showlast)
2425 2438 print "Total number of aliases:",len(aliases)
2426 2439 return res
2427 2440 try:
2428 2441 alias,cmd = par.split(None,1)
2429 2442 except:
2430 2443 print OInspect.getdoc(self.magic_alias)
2431 2444 else:
2432 2445 nargs = cmd.count('%s')
2433 2446 if nargs>0 and cmd.find('%l')>=0:
2434 2447 error('The %s and %l specifiers are mutually exclusive '
2435 2448 'in alias definitions.')
2436 2449 else: # all looks OK
2437 2450 self.shell.alias_table[alias] = (nargs,cmd)
2438 2451 self.shell.alias_table_validate(verbose=0)
2439 2452 # end magic_alias
2440 2453
2441 2454 def magic_unalias(self, parameter_s = ''):
2442 2455 """Remove an alias"""
2443 2456
2444 2457 aname = parameter_s.strip()
2445 2458 if aname in self.shell.alias_table:
2446 2459 del self.shell.alias_table[aname]
2447 2460 stored = self.db.get('stored_aliases', {} )
2448 2461 if aname in stored:
2449 2462 print "Removing %stored alias",aname
2450 2463 del stored[aname]
2451 2464 self.db['stored_aliases'] = stored
2452 2465
2453 2466 def magic_rehash(self, parameter_s = ''):
2454 2467 """Update the alias table with all entries in $PATH.
2455 2468
2456 2469 This version does no checks on execute permissions or whether the
2457 2470 contents of $PATH are truly files (instead of directories or something
2458 2471 else). For such a safer (but slower) version, use %rehashx."""
2459 2472
2460 2473 # This function (and rehashx) manipulate the alias_table directly
2461 2474 # rather than calling magic_alias, for speed reasons. A rehash on a
2462 2475 # typical Linux box involves several thousand entries, so efficiency
2463 2476 # here is a top concern.
2464 2477
2465 2478 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2466 2479 alias_table = self.shell.alias_table
2467 2480 for pdir in path:
2468 2481 for ff in os.listdir(pdir):
2469 2482 # each entry in the alias table must be (N,name), where
2470 2483 # N is the number of positional arguments of the alias.
2471 2484 alias_table[ff] = (0,ff)
2472 2485 # Make sure the alias table doesn't contain keywords or builtins
2473 2486 self.shell.alias_table_validate()
2474 2487 # Call again init_auto_alias() so we get 'rm -i' and other modified
2475 2488 # aliases since %rehash will probably clobber them
2476 2489 self.shell.init_auto_alias()
2477 2490
2478 2491 def magic_rehashx(self, parameter_s = ''):
2479 2492 """Update the alias table with all executable files in $PATH.
2480 2493
2481 2494 This version explicitly checks that every entry in $PATH is a file
2482 2495 with execute access (os.X_OK), so it is much slower than %rehash.
2483 2496
2484 2497 Under Windows, it checks executability as a match agains a
2485 2498 '|'-separated string of extensions, stored in the IPython config
2486 2499 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2487 2500
2488 2501 path = [os.path.abspath(os.path.expanduser(p)) for p in
2489 2502 os.environ['PATH'].split(os.pathsep)]
2490 2503 path = filter(os.path.isdir,path)
2491 2504
2492 2505 alias_table = self.shell.alias_table
2493 2506 syscmdlist = []
2494 2507 if os.name == 'posix':
2495 2508 isexec = lambda fname:os.path.isfile(fname) and \
2496 2509 os.access(fname,os.X_OK)
2497 2510 else:
2498 2511
2499 2512 try:
2500 2513 winext = os.environ['pathext'].replace(';','|').replace('.','')
2501 2514 except KeyError:
2502 2515 winext = 'exe|com|bat|py'
2503 2516 if 'py' not in winext:
2504 2517 winext += '|py'
2505 2518 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2506 2519 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2507 2520 savedir = os.getcwd()
2508 2521 try:
2509 2522 # write the whole loop for posix/Windows so we don't have an if in
2510 2523 # the innermost part
2511 2524 if os.name == 'posix':
2512 2525 for pdir in path:
2513 2526 os.chdir(pdir)
2514 2527 for ff in os.listdir(pdir):
2515 2528 if isexec(ff) and ff not in self.shell.no_alias:
2516 2529 # each entry in the alias table must be (N,name),
2517 2530 # where N is the number of positional arguments of the
2518 2531 # alias.
2519 2532 alias_table[ff] = (0,ff)
2520 2533 syscmdlist.append(ff)
2521 2534 else:
2522 2535 for pdir in path:
2523 2536 os.chdir(pdir)
2524 2537 for ff in os.listdir(pdir):
2525 2538 base, ext = os.path.splitext(ff)
2526 2539 if isexec(ff) and base not in self.shell.no_alias:
2527 2540 if ext.lower() == '.exe':
2528 2541 ff = base
2529 2542 alias_table[base] = (0,ff)
2530 2543 syscmdlist.append(ff)
2531 2544 # Make sure the alias table doesn't contain keywords or builtins
2532 2545 self.shell.alias_table_validate()
2533 2546 # Call again init_auto_alias() so we get 'rm -i' and other
2534 2547 # modified aliases since %rehashx will probably clobber them
2535 2548 self.shell.init_auto_alias()
2536 2549 db = self.getapi().db
2537 2550 db['syscmdlist'] = syscmdlist
2538 2551 finally:
2539 2552 os.chdir(savedir)
2540 2553
2541 2554 def magic_pwd(self, parameter_s = ''):
2542 2555 """Return the current working directory path."""
2543 2556 return os.getcwd()
2544 2557
2545 2558 def magic_cd(self, parameter_s=''):
2546 2559 """Change the current working directory.
2547 2560
2548 2561 This command automatically maintains an internal list of directories
2549 2562 you visit during your IPython session, in the variable _dh. The
2550 2563 command %dhist shows this history nicely formatted. You can also
2551 2564 do 'cd -<tab>' to see directory history conveniently.
2552 2565
2553 2566 Usage:
2554 2567
2555 2568 cd 'dir': changes to directory 'dir'.
2556 2569
2557 2570 cd -: changes to the last visited directory.
2558 2571
2559 2572 cd -<n>: changes to the n-th directory in the directory history.
2560 2573
2561 2574 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2562 2575 (note: cd <bookmark_name> is enough if there is no
2563 2576 directory <bookmark_name>, but a bookmark with the name exists.)
2564 2577 'cd -b <tab>' allows you to tab-complete bookmark names.
2565 2578
2566 2579 Options:
2567 2580
2568 2581 -q: quiet. Do not print the working directory after the cd command is
2569 2582 executed. By default IPython's cd command does print this directory,
2570 2583 since the default prompts do not display path information.
2571 2584
2572 2585 Note that !cd doesn't work for this purpose because the shell where
2573 2586 !command runs is immediately discarded after executing 'command'."""
2574 2587
2575 2588 parameter_s = parameter_s.strip()
2576 2589 #bkms = self.shell.persist.get("bookmarks",{})
2577 2590
2578 2591 numcd = re.match(r'(-)(\d+)$',parameter_s)
2579 2592 # jump in directory history by number
2580 2593 if numcd:
2581 2594 nn = int(numcd.group(2))
2582 2595 try:
2583 2596 ps = self.shell.user_ns['_dh'][nn]
2584 2597 except IndexError:
2585 2598 print 'The requested directory does not exist in history.'
2586 2599 return
2587 2600 else:
2588 2601 opts = {}
2589 2602 else:
2590 2603 #turn all non-space-escaping backslashes to slashes,
2591 2604 # for c:\windows\directory\names\
2592 2605 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2593 2606 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2594 2607 # jump to previous
2595 2608 if ps == '-':
2596 2609 try:
2597 2610 ps = self.shell.user_ns['_dh'][-2]
2598 2611 except IndexError:
2599 2612 print 'No previous directory to change to.'
2600 2613 return
2601 2614 # jump to bookmark if needed
2602 2615 else:
2603 2616 if not os.path.isdir(ps) or opts.has_key('b'):
2604 2617 bkms = self.db.get('bookmarks', {})
2605 2618
2606 2619 if bkms.has_key(ps):
2607 2620 target = bkms[ps]
2608 2621 print '(bookmark:%s) -> %s' % (ps,target)
2609 2622 ps = target
2610 2623 else:
2611 2624 if opts.has_key('b'):
2612 2625 error("Bookmark '%s' not found. "
2613 2626 "Use '%%bookmark -l' to see your bookmarks." % ps)
2614 2627 return
2615 2628
2616 2629 # at this point ps should point to the target dir
2617 2630 if ps:
2618 2631 try:
2619 2632 os.chdir(os.path.expanduser(ps))
2620 2633 if self.shell.rc.term_title:
2621 2634 #print 'set term title:',self.shell.rc.term_title # dbg
2622 2635 ttitle = ("IPy:" + (
2623 2636 os.getcwd() == '/' and '/' or \
2624 2637 os.path.basename(os.getcwd())))
2625 2638 platutils.set_term_title(ttitle)
2626 2639 except OSError:
2627 2640 print sys.exc_info()[1]
2628 2641 else:
2629 2642 self.shell.user_ns['_dh'].append(os.getcwd())
2630 2643 else:
2631 2644 os.chdir(self.shell.home_dir)
2632 2645 if self.shell.rc.term_title:
2633 2646 platutils.set_term_title("IPy:~")
2634 2647 self.shell.user_ns['_dh'].append(os.getcwd())
2635 2648 if not 'q' in opts:
2636 2649 print self.shell.user_ns['_dh'][-1]
2637 2650
2638 2651 def magic_dhist(self, parameter_s=''):
2639 2652 """Print your history of visited directories.
2640 2653
2641 2654 %dhist -> print full history\\
2642 2655 %dhist n -> print last n entries only\\
2643 2656 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2644 2657
2645 2658 This history is automatically maintained by the %cd command, and
2646 2659 always available as the global list variable _dh. You can use %cd -<n>
2647 2660 to go to directory number <n>."""
2648 2661
2649 2662 dh = self.shell.user_ns['_dh']
2650 2663 if parameter_s:
2651 2664 try:
2652 2665 args = map(int,parameter_s.split())
2653 2666 except:
2654 2667 self.arg_err(Magic.magic_dhist)
2655 2668 return
2656 2669 if len(args) == 1:
2657 2670 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2658 2671 elif len(args) == 2:
2659 2672 ini,fin = args
2660 2673 else:
2661 2674 self.arg_err(Magic.magic_dhist)
2662 2675 return
2663 2676 else:
2664 2677 ini,fin = 0,len(dh)
2665 2678 nlprint(dh,
2666 2679 header = 'Directory history (kept in _dh)',
2667 2680 start=ini,stop=fin)
2668 2681
2669 2682 def magic_env(self, parameter_s=''):
2670 2683 """List environment variables."""
2671 2684
2672 2685 return os.environ.data
2673 2686
2674 2687 def magic_pushd(self, parameter_s=''):
2675 2688 """Place the current dir on stack and change directory.
2676 2689
2677 2690 Usage:\\
2678 2691 %pushd ['dirname']
2679 2692
2680 2693 %pushd with no arguments does a %pushd to your home directory.
2681 2694 """
2682 2695 if parameter_s == '': parameter_s = '~'
2683 2696 dir_s = self.shell.dir_stack
2684 2697 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2685 2698 os.path.expanduser(self.shell.dir_stack[0]):
2686 2699 try:
2687 2700 self.magic_cd(parameter_s)
2688 2701 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2689 2702 self.magic_dirs()
2690 2703 except:
2691 2704 print 'Invalid directory'
2692 2705 else:
2693 2706 print 'You are already there!'
2694 2707
2695 2708 def magic_popd(self, parameter_s=''):
2696 2709 """Change to directory popped off the top of the stack.
2697 2710 """
2698 2711 if len (self.shell.dir_stack) > 1:
2699 2712 self.shell.dir_stack.pop(0)
2700 2713 self.magic_cd(self.shell.dir_stack[0])
2701 2714 print self.shell.dir_stack[0]
2702 2715 else:
2703 2716 print "You can't remove the starting directory from the stack:",\
2704 2717 self.shell.dir_stack
2705 2718
2706 2719 def magic_dirs(self, parameter_s=''):
2707 2720 """Return the current directory stack."""
2708 2721
2709 2722 return self.shell.dir_stack[:]
2710 2723
2711 2724 def magic_sc(self, parameter_s=''):
2712 2725 """Shell capture - execute a shell command and capture its output.
2713 2726
2714 2727 DEPRECATED. Suboptimal, retained for backwards compatibility.
2715 2728
2716 2729 You should use the form 'var = !command' instead. Example:
2717 2730
2718 2731 "%sc -l myfiles = ls ~" should now be written as
2719 2732
2720 2733 "myfiles = !ls ~"
2721 2734
2722 2735 myfiles.s, myfiles.l and myfiles.n still apply as documented
2723 2736 below.
2724 2737
2725 2738 --
2726 2739 %sc [options] varname=command
2727 2740
2728 2741 IPython will run the given command using commands.getoutput(), and
2729 2742 will then update the user's interactive namespace with a variable
2730 2743 called varname, containing the value of the call. Your command can
2731 2744 contain shell wildcards, pipes, etc.
2732 2745
2733 2746 The '=' sign in the syntax is mandatory, and the variable name you
2734 2747 supply must follow Python's standard conventions for valid names.
2735 2748
2736 2749 (A special format without variable name exists for internal use)
2737 2750
2738 2751 Options:
2739 2752
2740 2753 -l: list output. Split the output on newlines into a list before
2741 2754 assigning it to the given variable. By default the output is stored
2742 2755 as a single string.
2743 2756
2744 2757 -v: verbose. Print the contents of the variable.
2745 2758
2746 2759 In most cases you should not need to split as a list, because the
2747 2760 returned value is a special type of string which can automatically
2748 2761 provide its contents either as a list (split on newlines) or as a
2749 2762 space-separated string. These are convenient, respectively, either
2750 2763 for sequential processing or to be passed to a shell command.
2751 2764
2752 2765 For example:
2753 2766
2754 2767 # Capture into variable a
2755 2768 In [9]: sc a=ls *py
2756 2769
2757 2770 # a is a string with embedded newlines
2758 2771 In [10]: a
2759 2772 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2760 2773
2761 2774 # which can be seen as a list:
2762 2775 In [11]: a.l
2763 2776 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2764 2777
2765 2778 # or as a whitespace-separated string:
2766 2779 In [12]: a.s
2767 2780 Out[12]: 'setup.py win32_manual_post_install.py'
2768 2781
2769 2782 # a.s is useful to pass as a single command line:
2770 2783 In [13]: !wc -l $a.s
2771 2784 146 setup.py
2772 2785 130 win32_manual_post_install.py
2773 2786 276 total
2774 2787
2775 2788 # while the list form is useful to loop over:
2776 2789 In [14]: for f in a.l:
2777 2790 ....: !wc -l $f
2778 2791 ....:
2779 2792 146 setup.py
2780 2793 130 win32_manual_post_install.py
2781 2794
2782 2795 Similiarly, the lists returned by the -l option are also special, in
2783 2796 the sense that you can equally invoke the .s attribute on them to
2784 2797 automatically get a whitespace-separated string from their contents:
2785 2798
2786 2799 In [1]: sc -l b=ls *py
2787 2800
2788 2801 In [2]: b
2789 2802 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2790 2803
2791 2804 In [3]: b.s
2792 2805 Out[3]: 'setup.py win32_manual_post_install.py'
2793 2806
2794 2807 In summary, both the lists and strings used for ouptut capture have
2795 2808 the following special attributes:
2796 2809
2797 2810 .l (or .list) : value as list.
2798 2811 .n (or .nlstr): value as newline-separated string.
2799 2812 .s (or .spstr): value as space-separated string.
2800 2813 """
2801 2814
2802 2815 opts,args = self.parse_options(parameter_s,'lv')
2803 2816 # Try to get a variable name and command to run
2804 2817 try:
2805 2818 # the variable name must be obtained from the parse_options
2806 2819 # output, which uses shlex.split to strip options out.
2807 2820 var,_ = args.split('=',1)
2808 2821 var = var.strip()
2809 2822 # But the the command has to be extracted from the original input
2810 2823 # parameter_s, not on what parse_options returns, to avoid the
2811 2824 # quote stripping which shlex.split performs on it.
2812 2825 _,cmd = parameter_s.split('=',1)
2813 2826 except ValueError:
2814 2827 var,cmd = '',''
2815 2828 # If all looks ok, proceed
2816 2829 out,err = self.shell.getoutputerror(cmd)
2817 2830 if err:
2818 2831 print >> Term.cerr,err
2819 2832 if opts.has_key('l'):
2820 2833 out = SList(out.split('\n'))
2821 2834 else:
2822 2835 out = LSString(out)
2823 2836 if opts.has_key('v'):
2824 2837 print '%s ==\n%s' % (var,pformat(out))
2825 2838 if var:
2826 2839 self.shell.user_ns.update({var:out})
2827 2840 else:
2828 2841 return out
2829 2842
2830 2843 def magic_sx(self, parameter_s=''):
2831 2844 """Shell execute - run a shell command and capture its output.
2832 2845
2833 2846 %sx command
2834 2847
2835 2848 IPython will run the given command using commands.getoutput(), and
2836 2849 return the result formatted as a list (split on '\\n'). Since the
2837 2850 output is _returned_, it will be stored in ipython's regular output
2838 2851 cache Out[N] and in the '_N' automatic variables.
2839 2852
2840 2853 Notes:
2841 2854
2842 2855 1) If an input line begins with '!!', then %sx is automatically
2843 2856 invoked. That is, while:
2844 2857 !ls
2845 2858 causes ipython to simply issue system('ls'), typing
2846 2859 !!ls
2847 2860 is a shorthand equivalent to:
2848 2861 %sx ls
2849 2862
2850 2863 2) %sx differs from %sc in that %sx automatically splits into a list,
2851 2864 like '%sc -l'. The reason for this is to make it as easy as possible
2852 2865 to process line-oriented shell output via further python commands.
2853 2866 %sc is meant to provide much finer control, but requires more
2854 2867 typing.
2855 2868
2856 2869 3) Just like %sc -l, this is a list with special attributes:
2857 2870
2858 2871 .l (or .list) : value as list.
2859 2872 .n (or .nlstr): value as newline-separated string.
2860 2873 .s (or .spstr): value as whitespace-separated string.
2861 2874
2862 2875 This is very useful when trying to use such lists as arguments to
2863 2876 system commands."""
2864 2877
2865 2878 if parameter_s:
2866 2879 out,err = self.shell.getoutputerror(parameter_s)
2867 2880 if err:
2868 2881 print >> Term.cerr,err
2869 2882 return SList(out.split('\n'))
2870 2883
2871 2884 def magic_bg(self, parameter_s=''):
2872 2885 """Run a job in the background, in a separate thread.
2873 2886
2874 2887 For example,
2875 2888
2876 2889 %bg myfunc(x,y,z=1)
2877 2890
2878 2891 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2879 2892 execution starts, a message will be printed indicating the job
2880 2893 number. If your job number is 5, you can use
2881 2894
2882 2895 myvar = jobs.result(5) or myvar = jobs[5].result
2883 2896
2884 2897 to assign this result to variable 'myvar'.
2885 2898
2886 2899 IPython has a job manager, accessible via the 'jobs' object. You can
2887 2900 type jobs? to get more information about it, and use jobs.<TAB> to see
2888 2901 its attributes. All attributes not starting with an underscore are
2889 2902 meant for public use.
2890 2903
2891 2904 In particular, look at the jobs.new() method, which is used to create
2892 2905 new jobs. This magic %bg function is just a convenience wrapper
2893 2906 around jobs.new(), for expression-based jobs. If you want to create a
2894 2907 new job with an explicit function object and arguments, you must call
2895 2908 jobs.new() directly.
2896 2909
2897 2910 The jobs.new docstring also describes in detail several important
2898 2911 caveats associated with a thread-based model for background job
2899 2912 execution. Type jobs.new? for details.
2900 2913
2901 2914 You can check the status of all jobs with jobs.status().
2902 2915
2903 2916 The jobs variable is set by IPython into the Python builtin namespace.
2904 2917 If you ever declare a variable named 'jobs', you will shadow this
2905 2918 name. You can either delete your global jobs variable to regain
2906 2919 access to the job manager, or make a new name and assign it manually
2907 2920 to the manager (stored in IPython's namespace). For example, to
2908 2921 assign the job manager to the Jobs name, use:
2909 2922
2910 2923 Jobs = __builtins__.jobs"""
2911 2924
2912 2925 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2913 2926
2914 2927
2915 2928 def magic_bookmark(self, parameter_s=''):
2916 2929 """Manage IPython's bookmark system.
2917 2930
2918 2931 %bookmark <name> - set bookmark to current dir
2919 2932 %bookmark <name> <dir> - set bookmark to <dir>
2920 2933 %bookmark -l - list all bookmarks
2921 2934 %bookmark -d <name> - remove bookmark
2922 2935 %bookmark -r - remove all bookmarks
2923 2936
2924 2937 You can later on access a bookmarked folder with:
2925 2938 %cd -b <name>
2926 2939 or simply '%cd <name>' if there is no directory called <name> AND
2927 2940 there is such a bookmark defined.
2928 2941
2929 2942 Your bookmarks persist through IPython sessions, but they are
2930 2943 associated with each profile."""
2931 2944
2932 2945 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2933 2946 if len(args) > 2:
2934 2947 error('You can only give at most two arguments')
2935 2948 return
2936 2949
2937 2950 bkms = self.db.get('bookmarks',{})
2938 2951
2939 2952 if opts.has_key('d'):
2940 2953 try:
2941 2954 todel = args[0]
2942 2955 except IndexError:
2943 2956 error('You must provide a bookmark to delete')
2944 2957 else:
2945 2958 try:
2946 2959 del bkms[todel]
2947 2960 except:
2948 2961 error("Can't delete bookmark '%s'" % todel)
2949 2962 elif opts.has_key('r'):
2950 2963 bkms = {}
2951 2964 elif opts.has_key('l'):
2952 2965 bks = bkms.keys()
2953 2966 bks.sort()
2954 2967 if bks:
2955 2968 size = max(map(len,bks))
2956 2969 else:
2957 2970 size = 0
2958 2971 fmt = '%-'+str(size)+'s -> %s'
2959 2972 print 'Current bookmarks:'
2960 2973 for bk in bks:
2961 2974 print fmt % (bk,bkms[bk])
2962 2975 else:
2963 2976 if not args:
2964 2977 error("You must specify the bookmark name")
2965 2978 elif len(args)==1:
2966 2979 bkms[args[0]] = os.getcwd()
2967 2980 elif len(args)==2:
2968 2981 bkms[args[0]] = args[1]
2969 2982 self.db['bookmarks'] = bkms
2970 2983
2971 2984 def magic_pycat(self, parameter_s=''):
2972 2985 """Show a syntax-highlighted file through a pager.
2973 2986
2974 2987 This magic is similar to the cat utility, but it will assume the file
2975 2988 to be Python source and will show it with syntax highlighting. """
2976 2989
2977 2990 try:
2978 2991 filename = get_py_filename(parameter_s)
2979 2992 cont = file_read(filename)
2980 2993 except IOError:
2981 2994 try:
2982 2995 cont = eval(parameter_s,self.user_ns)
2983 2996 except NameError:
2984 2997 cont = None
2985 2998 if cont is None:
2986 2999 print "Error: no such file or variable"
2987 3000 return
2988 3001
2989 3002 page(self.shell.pycolorize(cont),
2990 3003 screen_lines=self.shell.rc.screen_length)
2991 3004
2992 3005 def magic_cpaste(self, parameter_s=''):
2993 3006 """Allows you to paste & execute a pre-formatted code block from clipboard
2994 3007
2995 3008 You must terminate the block with '--' (two minus-signs) alone on the
2996 3009 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2997 3010 is the new sentinel for this operation)
2998 3011
2999 3012 The block is dedented prior to execution to enable execution of
3000 3013 method definitions. '>' characters at the beginning of a line is
3001 3014 ignored, to allow pasting directly from e-mails. The executed block
3002 3015 is also assigned to variable named 'pasted_block' for later editing
3003 3016 with '%edit pasted_block'.
3004 3017
3005 3018 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3006 3019 This assigns the pasted block to variable 'foo' as string, without
3007 3020 dedenting or executing it.
3008 3021
3009 3022 Do not be alarmed by garbled output on Windows (it's a readline bug).
3010 3023 Just press enter and type -- (and press enter again) and the block
3011 3024 will be what was just pasted.
3012 3025
3013 3026 IPython statements (magics, shell escapes) are not supported (yet).
3014 3027 """
3015 3028 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3016 3029 par = args.strip()
3017 3030 sentinel = opts.get('s','--')
3018 3031
3019 3032 from IPython import iplib
3020 3033 lines = []
3021 3034 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3022 3035 while 1:
3023 3036 l = iplib.raw_input_original(':')
3024 3037 if l ==sentinel:
3025 3038 break
3026 3039 lines.append(l.lstrip('>'))
3027 3040 block = "\n".join(lines) + '\n'
3028 3041 #print "block:\n",block
3029 3042 if not par:
3030 3043 b = textwrap.dedent(block)
3031 3044 exec b in self.user_ns
3032 3045 self.user_ns['pasted_block'] = b
3033 3046 else:
3034 3047 self.user_ns[par] = block
3035 3048 print "Block assigned to '%s'" % par
3036 3049
3037 3050 def magic_quickref(self,arg):
3038 3051 """ Show a quick reference sheet """
3039 3052 import IPython.usage
3040 3053 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3041 3054
3042 3055 page(qr)
3043 3056
3044 3057 def magic_upgrade(self,arg):
3045 3058 """ Upgrade your IPython installation
3046 3059
3047 3060 This will copy the config files that don't yet exist in your
3048 3061 ipython dir from the system config dir. Use this after upgrading
3049 3062 IPython if you don't wish to delete your .ipython dir.
3050 3063
3051 3064 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3052 3065 new users)
3053 3066
3054 3067 """
3055 3068 ip = self.getapi()
3056 3069 ipinstallation = path(IPython.__file__).dirname()
3057 3070 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3058 3071 src_config = ipinstallation / 'UserConfig'
3059 3072 userdir = path(ip.options.ipythondir)
3060 3073 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3061 3074 print ">",cmd
3062 3075 shell(cmd)
3063 3076 if arg == '-nolegacy':
3064 3077 legacy = userdir.files('ipythonrc*')
3065 3078 print "Nuking legacy files:",legacy
3066 3079
3067 3080 [p.remove() for p in legacy]
3068 3081 suffix = (sys.platform == 'win32' and '.ini' or '')
3069 3082 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3070 3083
3071 3084 # end Magic
@@ -1,467 +1,526 b''
1 1 """Module for interactive demos using IPython.
2 2
3 3 This module implements a few classes for running Python scripts interactively
4 4 in IPython for demonstrations. With very simple markup (a few tags in
5 5 comments), you can control points where the script stops executing and returns
6 6 control to IPython.
7 7
8 8
9 9 Provided classes
10 10 ================
11 11
12 12 The classes are (see their docstrings for further details):
13 13
14 14 - Demo: pure python demos
15 15
16 16 - IPythonDemo: demos with input to be processed by IPython as if it had been
17 17 typed interactively (so magics work, as well as any other special syntax you
18 18 may have added via input prefilters).
19 19
20 20 - LineDemo: single-line version of the Demo class. These demos are executed
21 21 one line at a time, and require no markup.
22 22
23 23 - IPythonLineDemo: IPython version of the LineDemo class (the demo is
24 24 executed a line at a time, but processed via IPython).
25 25
26 - ClearMixin: mixin to make Demo classes with less visual clutter. It
27 declares an empty marquee and a pre_cmd that clears the screen before each
28 block (see Subclassing below).
29
30 - ClearDemo, ClearIPDemo: mixin-enabled versions of the Demo and IPythonDemo
31 classes.
32
26 33
27 34 Subclassing
28 35 ===========
29 36
30 37 The classes here all include a few methods meant to make customization by
31 38 subclassing more convenient. Their docstrings below have some more details:
32 39
33 40 - marquee(): generates a marquee to provide visible on-screen markers at each
34 41 block start and end.
35 42
36 43 - pre_cmd(): run right before the execution of each block.
37 44
38 - pre_cmd(): run right after the execution of each block. If the block
45 - post_cmd(): run right after the execution of each block. If the block
39 46 raises an exception, this is NOT called.
40 47
41 48
42 49 Operation
43 50 =========
44 51
45 52 The file is run in its own empty namespace (though you can pass it a string of
46 53 arguments as if in a command line environment, and it will see those as
47 54 sys.argv). But at each stop, the global IPython namespace is updated with the
48 55 current internal demo namespace, so you can work interactively with the data
49 56 accumulated so far.
50 57
51 58 By default, each block of code is printed (with syntax highlighting) before
52 59 executing it and you have to confirm execution. This is intended to show the
53 60 code to an audience first so you can discuss it, and only proceed with
54 61 execution once you agree. There are a few tags which allow you to modify this
55 62 behavior.
56 63
57 64 The supported tags are:
58 65
59 # <demo> --- stop ---
66 # <demo> stop
60 67
61 68 Defines block boundaries, the points where IPython stops execution of the
62 69 file and returns to the interactive prompt.
63 70
71 You can optionally mark the stop tag with extra dashes before and after the
72 word 'stop', to help visually distinguish the blocks in a text editor:
73
74 # <demo> --- stop ---
75
76
64 77 # <demo> silent
65 78
66 79 Make a block execute silently (and hence automatically). Typically used in
67 80 cases where you have some boilerplate or initialization code which you need
68 81 executed but do not want to be seen in the demo.
69 82
70 83 # <demo> auto
71 84
72 85 Make a block execute automatically, but still being printed. Useful for
73 86 simple code which does not warrant discussion, since it avoids the extra
74 87 manual confirmation.
75 88
76 89 # <demo> auto_all
77 90
78 91 This tag can _only_ be in the first block, and if given it overrides the
79 92 individual auto tags to make the whole demo fully automatic (no block asks
80 93 for confirmation). It can also be given at creation time (or the attribute
81 94 set later) to override what's in the file.
82 95
83 96 While _any_ python file can be run as a Demo instance, if there are no stop
84 97 tags the whole file will run in a single block (no different that calling
85 98 first %pycat and then %run). The minimal markup to make this useful is to
86 99 place a set of stop tags; the other tags are only there to let you fine-tune
87 100 the execution.
88 101
89 102 This is probably best explained with the simple example file below. You can
90 103 copy this into a file named ex_demo.py, and try running it via:
91 104
92 105 from IPython.demo import Demo
93 106 d = Demo('ex_demo.py')
94 107 d() <--- Call the d object (omit the parens if you have autocall set to 2).
95 108
96 109 Each time you call the demo object, it runs the next block. The demo object
97 110 has a few useful methods for navigation, like again(), edit(), jump(), seek()
98 111 and back(). It can be reset for a new run via reset() or reloaded from disk
99 112 (in case you've edited the source) via reload(). See their docstrings below.
100 113
101 114
102 115 Example
103 116 =======
104 117
105 118 The following is a very simple example of a valid demo file.
106 119
107 120 #################### EXAMPLE DEMO <ex_demo.py> ###############################
108 121 '''A simple interactive demo to illustrate the use of IPython's Demo class.'''
109 122
110 123 print 'Hello, welcome to an interactive IPython demo.'
111 124
112 125 # The mark below defines a block boundary, which is a point where IPython will
113 # stop execution and return to the interactive prompt.
114 # Note that in actual interactive execution,
115 # <demo> --- stop ---
126 # stop execution and return to the interactive prompt. The dashes are actually
127 # optional and used only as a visual aid to clearly separate blocks while
128 editing the demo code.
129 # <demo> stop
116 130
117 131 x = 1
118 132 y = 2
119 133
120 # <demo> --- stop ---
134 # <demo> stop
121 135
122 136 # the mark below makes this block as silent
123 137 # <demo> silent
124 138
125 139 print 'This is a silent block, which gets executed but not printed.'
126 140
127 # <demo> --- stop ---
141 # <demo> stop
128 142 # <demo> auto
129 143 print 'This is an automatic block.'
130 144 print 'It is executed without asking for confirmation, but printed.'
131 145 z = x+y
132 146
133 147 print 'z=',x
134 148
135 # <demo> --- stop ---
149 # <demo> stop
136 150 # This is just another normal block.
137 151 print 'z is now:', z
138 152
139 153 print 'bye!'
140 154 ################### END EXAMPLE DEMO <ex_demo.py> ############################
141 155 """
142 156
143 157 #*****************************************************************************
144 158 # Copyright (C) 2005-2006 Fernando Perez. <Fernando.Perez@colorado.edu>
145 159 #
146 160 # Distributed under the terms of the BSD License. The full license is in
147 161 # the file COPYING, distributed as part of this software.
148 162 #
149 163 #*****************************************************************************
150 164
151 165 import exceptions
152 166 import os
153 167 import re
154 168 import shlex
155 169 import sys
156 170
157 171 from IPython.PyColorize import Parser
158 172 from IPython.genutils import marquee, file_read, file_readlines
159 173
160 174 __all__ = ['Demo','IPythonDemo','LineDemo','IPythonLineDemo','DemoError']
161 175
162 176 class DemoError(exceptions.Exception): pass
163 177
164 178 def re_mark(mark):
165 179 return re.compile(r'^\s*#\s+<demo>\s+%s\s*$' % mark,re.MULTILINE)
166 180
167 class Demo:
181 class Demo(object):
168 182
169 re_stop = re_mark('---\s?stop\s?---')
183 re_stop = re_mark('-?\s?stop\s?-?')
170 184 re_silent = re_mark('silent')
171 185 re_auto = re_mark('auto')
172 186 re_auto_all = re_mark('auto_all')
173 187
174 188 def __init__(self,fname,arg_str='',auto_all=None):
175 189 """Make a new demo object. To run the demo, simply call the object.
176 190
177 191 See the module docstring for full details and an example (you can use
178 192 IPython.Demo? in IPython to see it).
179 193
180 194 Inputs:
181 195
182 196 - fname = filename.
183 197
184 198 Optional inputs:
185 199
186 200 - arg_str(''): a string of arguments, internally converted to a list
187 201 just like sys.argv, so the demo script can see a similar
188 202 environment.
189 203
190 204 - auto_all(None): global flag to run all blocks automatically without
191 205 confirmation. This attribute overrides the block-level tags and
192 206 applies to the whole demo. It is an attribute of the object, and
193 207 can be changed at runtime simply by reassigning it to a boolean
194 208 value.
195 209 """
196 210
197 211 self.fname = fname
198 212 self.sys_argv = [fname] + shlex.split(arg_str)
199 213 self.auto_all = auto_all
200 214
201 215 # get a few things from ipython. While it's a bit ugly design-wise,
202 216 # it ensures that things like color scheme and the like are always in
203 217 # sync with the ipython mode being used. This class is only meant to
204 218 # be used inside ipython anyways, so it's OK.
205 219 self.ip_ns = __IPYTHON__.user_ns
206 220 self.ip_colorize = __IPYTHON__.pycolorize
207 221 self.ip_showtb = __IPYTHON__.showtraceback
208 222 self.ip_runlines = __IPYTHON__.runlines
209 223 self.shell = __IPYTHON__
210 224
211 225 # load user data and initialize data structures
212 226 self.reload()
213 227
214 228 def reload(self):
215 229 """Reload source from disk and initialize state."""
216 230 # read data and parse into blocks
217 231 self.src = file_read(self.fname)
218 232 src_b = [b.strip() for b in self.re_stop.split(self.src) if b]
219 233 self._silent = [bool(self.re_silent.findall(b)) for b in src_b]
220 234 self._auto = [bool(self.re_auto.findall(b)) for b in src_b]
221 235
222 236 # if auto_all is not given (def. None), we read it from the file
223 237 if self.auto_all is None:
224 238 self.auto_all = bool(self.re_auto_all.findall(src_b[0]))
225 239 else:
226 240 self.auto_all = bool(self.auto_all)
227 241
228 242 # Clean the sources from all markup so it doesn't get displayed when
229 243 # running the demo
230 244 src_blocks = []
231 245 auto_strip = lambda s: self.re_auto.sub('',s)
232 246 for i,b in enumerate(src_b):
233 247 if self._auto[i]:
234 248 src_blocks.append(auto_strip(b))
235 249 else:
236 250 src_blocks.append(b)
237 251 # remove the auto_all marker
238 252 src_blocks[0] = self.re_auto_all.sub('',src_blocks[0])
239 253
240 254 self.nblocks = len(src_blocks)
241 255 self.src_blocks = src_blocks
242 256
243 257 # also build syntax-highlighted source
244 258 self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)
245 259
246 260 # ensure clean namespace and seek offset
247 261 self.reset()
248 262
249 263 def reset(self):
250 264 """Reset the namespace and seek pointer to restart the demo"""
251 265 self.user_ns = {}
252 266 self.finished = False
253 267 self.block_index = 0
254 268
255 269 def _validate_index(self,index):
256 270 if index<0 or index>=self.nblocks:
257 271 raise ValueError('invalid block index %s' % index)
258 272
259 273 def _get_index(self,index):
260 274 """Get the current block index, validating and checking status.
261 275
262 276 Returns None if the demo is finished"""
263 277
264 278 if index is None:
265 279 if self.finished:
266 280 print 'Demo finished. Use reset() if you want to rerun it.'
267 281 return None
268 282 index = self.block_index
269 283 else:
270 284 self._validate_index(index)
271 285 return index
272 286
273 287 def seek(self,index):
274 """Move the current seek pointer to the given block"""
288 """Move the current seek pointer to the given block.
289
290 You can use negative indices to seek from the end, with identical
291 semantics to those of Python lists."""
292 if index<0:
293 index = self.nblocks + index
275 294 self._validate_index(index)
276 295 self.block_index = index
277 296 self.finished = False
278 297
279 298 def back(self,num=1):
280 299 """Move the seek pointer back num blocks (default is 1)."""
281 300 self.seek(self.block_index-num)
282 301
283 def jump(self,num):
284 """Jump a given number of blocks relative to the current one."""
302 def jump(self,num=1):
303 """Jump a given number of blocks relative to the current one.
304
305 The offset can be positive or negative, defaults to 1."""
285 306 self.seek(self.block_index+num)
286 307
287 308 def again(self):
288 309 """Move the seek pointer back one block and re-execute."""
289 310 self.back(1)
290 311 self()
291 312
292 313 def edit(self,index=None):
293 314 """Edit a block.
294 315
295 316 If no number is given, use the last block executed.
296 317
297 318 This edits the in-memory copy of the demo, it does NOT modify the
298 319 original source file. If you want to do that, simply open the file in
299 320 an editor and use reload() when you make changes to the file. This
300 321 method is meant to let you change a block during a demonstration for
301 322 explanatory purposes, without damaging your original script."""
302 323
303 324 index = self._get_index(index)
304 325 if index is None:
305 326 return
306 327 # decrease the index by one (unless we're at the very beginning), so
307 328 # that the default demo.edit() call opens up the sblock we've last run
308 329 if index>0:
309 330 index -= 1
310 331
311 332 filename = self.shell.mktempfile(self.src_blocks[index])
312 333 self.shell.hooks.editor(filename,1)
313 334 new_block = file_read(filename)
314 335 # update the source and colored block
315 336 self.src_blocks[index] = new_block
316 337 self.src_blocks_colored[index] = self.ip_colorize(new_block)
317 338 self.block_index = index
318 339 # call to run with the newly edited index
319 340 self()
320 341
321 342 def show(self,index=None):
322 343 """Show a single block on screen"""
323 344
324 345 index = self._get_index(index)
325 346 if index is None:
326 347 return
327 348
328 349 print self.marquee('<%s> block # %s (%s remaining)' %
329 350 (self.fname,index,self.nblocks-index-1))
330 print self.src_blocks_colored[index],
351 sys.stdout.write(self.src_blocks_colored[index])
331 352 sys.stdout.flush()
332 353
333 354 def show_all(self):
334 355 """Show entire demo on screen, block by block"""
335 356
336 357 fname = self.fname
337 358 nblocks = self.nblocks
338 359 silent = self._silent
339 360 marquee = self.marquee
340 361 for index,block in enumerate(self.src_blocks_colored):
341 362 if silent[index]:
342 363 print marquee('<%s> SILENT block # %s (%s remaining)' %
343 364 (fname,index,nblocks-index-1))
344 365 else:
345 366 print marquee('<%s> block # %s (%s remaining)' %
346 367 (fname,index,nblocks-index-1))
347 368 print block,
348 369 sys.stdout.flush()
349 370
350 371 def runlines(self,source):
351 372 """Execute a string with one or more lines of code"""
352 373
353 374 exec source in self.user_ns
354 375
355 376 def __call__(self,index=None):
356 377 """run a block of the demo.
357 378
358 379 If index is given, it should be an integer >=1 and <= nblocks. This
359 380 means that the calling convention is one off from typical Python
360 381 lists. The reason for the inconsistency is that the demo always
361 382 prints 'Block n/N, and N is the total, so it would be very odd to use
362 383 zero-indexing here."""
363 384
364 385 index = self._get_index(index)
365 386 if index is None:
366 387 return
367 388 try:
368 389 marquee = self.marquee
369 390 next_block = self.src_blocks[index]
370 391 self.block_index += 1
371 392 if self._silent[index]:
372 393 print marquee('Executing silent block # %s (%s remaining)' %
373 394 (index,self.nblocks-index-1))
374 395 else:
375 396 self.pre_cmd()
376 397 self.show(index)
377 398 if self.auto_all or self._auto[index]:
378 print marquee('output')
399 print marquee('output:')
379 400 else:
380 401 print marquee('Press <q> to quit, <Enter> to execute...'),
381 402 ans = raw_input().strip()
382 403 if ans:
383 404 print marquee('Block NOT executed')
384 405 return
385 406 try:
386 407 save_argv = sys.argv
387 408 sys.argv = self.sys_argv
388 409 self.runlines(next_block)
389 410 self.post_cmd()
390 411 finally:
391 412 sys.argv = save_argv
392 413
393 414 except:
394 415 self.ip_showtb(filename=self.fname)
395 416 else:
396 417 self.ip_ns.update(self.user_ns)
397 418
398 419 if self.block_index == self.nblocks:
399 print
400 print self.marquee(' END OF DEMO ')
401 print self.marquee('Use reset() if you want to rerun it.')
420 mq1 = self.marquee('END OF DEMO')
421 if mq1:
422 # avoid spurious prints if empty marquees are used
423 print
424 print mq1
425 print self.marquee('Use reset() if you want to rerun it.')
402 426 self.finished = True
403 427
404 428 # These methods are meant to be overridden by subclasses who may wish to
405 429 # customize the behavior of of their demos.
406 430 def marquee(self,txt='',width=78,mark='*'):
407 431 """Return the input string centered in a 'marquee'."""
408 432 return marquee(txt,width,mark)
409 433
410 434 def pre_cmd(self):
411 435 """Method called before executing each block."""
412 436 pass
413 437
414 438 def post_cmd(self):
415 439 """Method called after executing each block."""
416 440 pass
417 441
418 442
419 443 class IPythonDemo(Demo):
420 444 """Class for interactive demos with IPython's input processing applied.
421 445
422 446 This subclasses Demo, but instead of executing each block by the Python
423 447 interpreter (via exec), it actually calls IPython on it, so that any input
424 448 filters which may be in place are applied to the input block.
425 449
426 450 If you have an interactive environment which exposes special input
427 451 processing, you can use this class instead to write demo scripts which
428 452 operate exactly as if you had typed them interactively. The default Demo
429 453 class requires the input to be valid, pure Python code.
430 454 """
431 455
432 456 def runlines(self,source):
433 457 """Execute a string with one or more lines of code"""
434 458
435 459 self.shell.runlines(source)
436 460
437 461 class LineDemo(Demo):
438 462 """Demo where each line is executed as a separate block.
439 463
440 464 The input script should be valid Python code.
441 465
442 466 This class doesn't require any markup at all, and it's meant for simple
443 467 scripts (with no nesting or any kind of indentation) which consist of
444 468 multiple lines of input to be executed, one at a time, as if they had been
445 469 typed in the interactive prompt."""
446 470
447 471 def reload(self):
448 472 """Reload source from disk and initialize state."""
449 473 # read data and parse into blocks
450 474 src_b = [l for l in file_readlines(self.fname) if l.strip()]
451 475 nblocks = len(src_b)
452 476 self.src = os.linesep.join(file_readlines(self.fname))
453 477 self._silent = [False]*nblocks
454 478 self._auto = [True]*nblocks
455 479 self.auto_all = True
456 480 self.nblocks = nblocks
457 481 self.src_blocks = src_b
458 482
459 483 # also build syntax-highlighted source
460 484 self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)
461 485
462 486 # ensure clean namespace and seek offset
463 487 self.reset()
464 488
489
465 490 class IPythonLineDemo(IPythonDemo,LineDemo):
466 491 """Variant of the LineDemo class whose input is processed by IPython."""
467 492 pass
493
494
495 class ClearMixin(object):
496 """Use this mixin to make Demo classes with less visual clutter.
497
498 Demos using this mixin will clear the screen before every block and use
499 blank marquees.
500
501 Note that in order for the methods defined here to actually override those
502 of the classes it's mixed with, it must go /first/ in the inheritance
503 tree. For example:
504
505 class ClearIPDemo(ClearMixin,IPythonDemo): pass
506
507 will provide an IPythonDemo class with the mixin's features.
508 """
509
510 def marquee(self,txt='',width=78,mark='*'):
511 """Blank marquee that returns '' no matter what the input."""
512 return ''
513
514 def pre_cmd(self):
515 """Method called before executing each block.
516
517 This one simply clears the screen."""
518 os.system('clear')
519
520
521 class ClearDemo(ClearMixin,Demo):
522 pass
523
524
525 class ClearIPDemo(ClearMixin,IPythonDemo):
526 pass
@@ -1,6220 +1,6228 b''
1 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
4 stop marks.
5 (ClearingMixin): a simple mixin to easily make a Demo class clear
6 the screen in between blocks and have empty marquees. The
7 ClearDemo and ClearIPDemo classes that use it are included.
8
1 9 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
2 10
3 11 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
4 12 protect against exceptions at Python shutdown time. Patch
5 13 sumbmitted to upstream.
6 14
7 15 2007-02-14 Walter Doerwald <walter@livinglogic.de>
8 16
9 17 * IPython/Extensions/ibrowse.py: If entering the first object level
10 18 (i.e. the object for which the browser has been started) fails,
11 19 now the error is raised directly (aborting the browser) instead of
12 20 running into an empty levels list later.
13 21
14 22 2007-02-03 Walter Doerwald <walter@livinglogic.de>
15 23
16 24 * IPython/Extensions/ipipe.py: Add an xrepr implementation
17 25 for the noitem object.
18 26
19 27 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
20 28
21 29 * IPython/completer.py (Completer.attr_matches): Fix small
22 30 tab-completion bug with Enthought Traits objects with units.
23 31 Thanks to a bug report by Tom Denniston
24 32 <tom.denniston-AT-alum.dartmouth.org>.
25 33
26 34 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
27 35
28 36 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
29 37 bug where only .ipy or .py would be completed. Once the first
30 38 argument to %run has been given, all completions are valid because
31 39 they are the arguments to the script, which may well be non-python
32 40 filenames.
33 41
34 42 * IPython/irunner.py (InteractiveRunner.run_source): major updates
35 43 to irunner to allow it to correctly support real doctesting of
36 44 out-of-process ipython code.
37 45
38 46 * IPython/Magic.py (magic_cd): Make the setting of the terminal
39 47 title an option (-noterm_title) because it completely breaks
40 48 doctesting.
41 49
42 50 * IPython/demo.py: fix IPythonDemo class that was not actually working.
43 51
44 52 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
45 53
46 54 * IPython/irunner.py (main): fix small bug where extensions were
47 55 not being correctly recognized.
48 56
49 57 2007-01-23 Walter Doerwald <walter@livinglogic.de>
50 58
51 59 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
52 60 a string containing a single line yields the string itself as the
53 61 only item.
54 62
55 63 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
56 64 object if it's the same as the one on the last level (This avoids
57 65 infinite recursion for one line strings).
58 66
59 67 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
60 68
61 69 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
62 70 all output streams before printing tracebacks. This ensures that
63 71 user output doesn't end up interleaved with traceback output.
64 72
65 73 2007-01-10 Ville Vainio <vivainio@gmail.com>
66 74
67 75 * Extensions/envpersist.py: Turbocharged %env that remembers
68 76 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
69 77 "%env VISUAL=jed".
70 78
71 79 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
72 80
73 81 * IPython/iplib.py (showtraceback): ensure that we correctly call
74 82 custom handlers in all cases (some with pdb were slipping through,
75 83 but I'm not exactly sure why).
76 84
77 85 * IPython/Debugger.py (Tracer.__init__): added new class to
78 86 support set_trace-like usage of IPython's enhanced debugger.
79 87
80 88 2006-12-24 Ville Vainio <vivainio@gmail.com>
81 89
82 90 * ipmaker.py: more informative message when ipy_user_conf
83 91 import fails (suggest running %upgrade).
84 92
85 93 * tools/run_ipy_in_profiler.py: Utility to see where
86 94 the time during IPython startup is spent.
87 95
88 96 2006-12-20 Ville Vainio <vivainio@gmail.com>
89 97
90 98 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
91 99
92 100 * ipapi.py: Add new ipapi method, expand_alias.
93 101
94 102 * Release.py: Bump up version to 0.7.4.svn
95 103
96 104 2006-12-17 Ville Vainio <vivainio@gmail.com>
97 105
98 106 * Extensions/jobctrl.py: Fixed &cmd arg arg...
99 107 to work properly on posix too
100 108
101 109 * Release.py: Update revnum (version is still just 0.7.3).
102 110
103 111 2006-12-15 Ville Vainio <vivainio@gmail.com>
104 112
105 113 * scripts/ipython_win_post_install: create ipython.py in
106 114 prefix + "/scripts".
107 115
108 116 * Release.py: Update version to 0.7.3.
109 117
110 118 2006-12-14 Ville Vainio <vivainio@gmail.com>
111 119
112 120 * scripts/ipython_win_post_install: Overwrite old shortcuts
113 121 if they already exist
114 122
115 123 * Release.py: release 0.7.3rc2
116 124
117 125 2006-12-13 Ville Vainio <vivainio@gmail.com>
118 126
119 127 * Branch and update Release.py for 0.7.3rc1
120 128
121 129 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
122 130
123 131 * IPython/Shell.py (IPShellWX): update for current WX naming
124 132 conventions, to avoid a deprecation warning with current WX
125 133 versions. Thanks to a report by Danny Shevitz.
126 134
127 135 2006-12-12 Ville Vainio <vivainio@gmail.com>
128 136
129 137 * ipmaker.py: apply david cournapeau's patch to make
130 138 import_some work properly even when ipythonrc does
131 139 import_some on empty list (it was an old bug!).
132 140
133 141 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
134 142 Add deprecation note to ipythonrc and a url to wiki
135 143 in ipy_user_conf.py
136 144
137 145
138 146 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
139 147 as if it was typed on IPython command prompt, i.e.
140 148 as IPython script.
141 149
142 150 * example-magic.py, magic_grepl.py: remove outdated examples
143 151
144 152 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
145 153
146 154 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
147 155 is called before any exception has occurred.
148 156
149 157 2006-12-08 Ville Vainio <vivainio@gmail.com>
150 158
151 159 * Extensions/ipy_stock_completers.py: fix cd completer
152 160 to translate /'s to \'s again.
153 161
154 162 * completer.py: prevent traceback on file completions w/
155 163 backslash.
156 164
157 165 * Release.py: Update release number to 0.7.3b3 for release
158 166
159 167 2006-12-07 Ville Vainio <vivainio@gmail.com>
160 168
161 169 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
162 170 while executing external code. Provides more shell-like behaviour
163 171 and overall better response to ctrl + C / ctrl + break.
164 172
165 173 * tools/make_tarball.py: new script to create tarball straight from svn
166 174 (setup.py sdist doesn't work on win32).
167 175
168 176 * Extensions/ipy_stock_completers.py: fix cd completer to give up
169 177 on dirnames with spaces and use the default completer instead.
170 178
171 179 * Revision.py: Change version to 0.7.3b2 for release.
172 180
173 181 2006-12-05 Ville Vainio <vivainio@gmail.com>
174 182
175 183 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
176 184 pydb patch 4 (rm debug printing, py 2.5 checking)
177 185
178 186 2006-11-30 Walter Doerwald <walter@livinglogic.de>
179 187 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
180 188 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
181 189 "refreshfind" (mapped to "R") does the same but tries to go back to the same
182 190 object the cursor was on before the refresh. The command "markrange" is
183 191 mapped to "%" now.
184 192 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
185 193
186 194 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
187 195
188 196 * IPython/Magic.py (magic_debug): new %debug magic to activate the
189 197 interactive debugger on the last traceback, without having to call
190 198 %pdb and rerun your code. Made minor changes in various modules,
191 199 should automatically recognize pydb if available.
192 200
193 201 2006-11-28 Ville Vainio <vivainio@gmail.com>
194 202
195 203 * completer.py: If the text start with !, show file completions
196 204 properly. This helps when trying to complete command name
197 205 for shell escapes.
198 206
199 207 2006-11-27 Ville Vainio <vivainio@gmail.com>
200 208
201 209 * ipy_stock_completers.py: bzr completer submitted by Stefan van
202 210 der Walt. Clean up svn and hg completers by using a common
203 211 vcs_completer.
204 212
205 213 2006-11-26 Ville Vainio <vivainio@gmail.com>
206 214
207 215 * Remove ipconfig and %config; you should use _ip.options structure
208 216 directly instead!
209 217
210 218 * genutils.py: add wrap_deprecated function for deprecating callables
211 219
212 220 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
213 221 _ip.system instead. ipalias is redundant.
214 222
215 223 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
216 224 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
217 225 explicit.
218 226
219 227 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
220 228 completer. Try it by entering 'hg ' and pressing tab.
221 229
222 230 * macro.py: Give Macro a useful __repr__ method
223 231
224 232 * Magic.py: %whos abbreviates the typename of Macro for brevity.
225 233
226 234 2006-11-24 Walter Doerwald <walter@livinglogic.de>
227 235 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
228 236 we don't get a duplicate ipipe module, where registration of the xrepr
229 237 implementation for Text is useless.
230 238
231 239 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
232 240
233 241 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
234 242
235 243 2006-11-24 Ville Vainio <vivainio@gmail.com>
236 244
237 245 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
238 246 try to use "cProfile" instead of the slower pure python
239 247 "profile"
240 248
241 249 2006-11-23 Ville Vainio <vivainio@gmail.com>
242 250
243 251 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
244 252 Qt+IPython+Designer link in documentation.
245 253
246 254 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
247 255 correct Pdb object to %pydb.
248 256
249 257
250 258 2006-11-22 Walter Doerwald <walter@livinglogic.de>
251 259 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
252 260 generic xrepr(), otherwise the list implementation would kick in.
253 261
254 262 2006-11-21 Ville Vainio <vivainio@gmail.com>
255 263
256 264 * upgrade_dir.py: Now actually overwrites a nonmodified user file
257 265 with one from UserConfig.
258 266
259 267 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
260 268 it was missing which broke the sh profile.
261 269
262 270 * completer.py: file completer now uses explicit '/' instead
263 271 of os.path.join, expansion of 'foo' was broken on win32
264 272 if there was one directory with name 'foobar'.
265 273
266 274 * A bunch of patches from Kirill Smelkov:
267 275
268 276 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
269 277
270 278 * [patch 7/9] Implement %page -r (page in raw mode) -
271 279
272 280 * [patch 5/9] ScientificPython webpage has moved
273 281
274 282 * [patch 4/9] The manual mentions %ds, should be %dhist
275 283
276 284 * [patch 3/9] Kill old bits from %prun doc.
277 285
278 286 * [patch 1/9] Fix typos here and there.
279 287
280 288 2006-11-08 Ville Vainio <vivainio@gmail.com>
281 289
282 290 * completer.py (attr_matches): catch all exceptions raised
283 291 by eval of expr with dots.
284 292
285 293 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
286 294
287 295 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
288 296 input if it starts with whitespace. This allows you to paste
289 297 indented input from any editor without manually having to type in
290 298 the 'if 1:', which is convenient when working interactively.
291 299 Slightly modifed version of a patch by Bo Peng
292 300 <bpeng-AT-rice.edu>.
293 301
294 302 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
295 303
296 304 * IPython/irunner.py (main): modified irunner so it automatically
297 305 recognizes the right runner to use based on the extension (.py for
298 306 python, .ipy for ipython and .sage for sage).
299 307
300 308 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
301 309 visible in ipapi as ip.config(), to programatically control the
302 310 internal rc object. There's an accompanying %config magic for
303 311 interactive use, which has been enhanced to match the
304 312 funtionality in ipconfig.
305 313
306 314 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
307 315 so it's not just a toggle, it now takes an argument. Add support
308 316 for a customizable header when making system calls, as the new
309 317 system_header variable in the ipythonrc file.
310 318
311 319 2006-11-03 Walter Doerwald <walter@livinglogic.de>
312 320
313 321 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
314 322 generic functions (using Philip J. Eby's simplegeneric package).
315 323 This makes it possible to customize the display of third-party classes
316 324 without having to monkeypatch them. xiter() no longer supports a mode
317 325 argument and the XMode class has been removed. The same functionality can
318 326 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
319 327 One consequence of the switch to generic functions is that xrepr() and
320 328 xattrs() implementation must define the default value for the mode
321 329 argument themselves and xattrs() implementations must return real
322 330 descriptors.
323 331
324 332 * IPython/external: This new subpackage will contain all third-party
325 333 packages that are bundled with IPython. (The first one is simplegeneric).
326 334
327 335 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
328 336 directory which as been dropped in r1703.
329 337
330 338 * IPython/Extensions/ipipe.py (iless): Fixed.
331 339
332 340 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
333 341
334 342 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
335 343
336 344 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
337 345 handling in variable expansion so that shells and magics recognize
338 346 function local scopes correctly. Bug reported by Brian.
339 347
340 348 * scripts/ipython: remove the very first entry in sys.path which
341 349 Python auto-inserts for scripts, so that sys.path under IPython is
342 350 as similar as possible to that under plain Python.
343 351
344 352 * IPython/completer.py (IPCompleter.file_matches): Fix
345 353 tab-completion so that quotes are not closed unless the completion
346 354 is unambiguous. After a request by Stefan. Minor cleanups in
347 355 ipy_stock_completers.
348 356
349 357 2006-11-02 Ville Vainio <vivainio@gmail.com>
350 358
351 359 * ipy_stock_completers.py: Add %run and %cd completers.
352 360
353 361 * completer.py: Try running custom completer for both
354 362 "foo" and "%foo" if the command is just "foo". Ignore case
355 363 when filtering possible completions.
356 364
357 365 * UserConfig/ipy_user_conf.py: install stock completers as default
358 366
359 367 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
360 368 simplified readline history save / restore through a wrapper
361 369 function
362 370
363 371
364 372 2006-10-31 Ville Vainio <vivainio@gmail.com>
365 373
366 374 * strdispatch.py, completer.py, ipy_stock_completers.py:
367 375 Allow str_key ("command") in completer hooks. Implement
368 376 trivial completer for 'import' (stdlib modules only). Rename
369 377 ipy_linux_package_managers.py to ipy_stock_completers.py.
370 378 SVN completer.
371 379
372 380 * Extensions/ledit.py: %magic line editor for easily and
373 381 incrementally manipulating lists of strings. The magic command
374 382 name is %led.
375 383
376 384 2006-10-30 Ville Vainio <vivainio@gmail.com>
377 385
378 386 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
379 387 Bernsteins's patches for pydb integration.
380 388 http://bashdb.sourceforge.net/pydb/
381 389
382 390 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
383 391 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
384 392 custom completer hook to allow the users to implement their own
385 393 completers. See ipy_linux_package_managers.py for example. The
386 394 hook name is 'complete_command'.
387 395
388 396 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
389 397
390 398 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
391 399 Numeric leftovers.
392 400
393 401 * ipython.el (py-execute-region): apply Stefan's patch to fix
394 402 garbled results if the python shell hasn't been previously started.
395 403
396 404 * IPython/genutils.py (arg_split): moved to genutils, since it's a
397 405 pretty generic function and useful for other things.
398 406
399 407 * IPython/OInspect.py (getsource): Add customizable source
400 408 extractor. After a request/patch form W. Stein (SAGE).
401 409
402 410 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
403 411 window size to a more reasonable value from what pexpect does,
404 412 since their choice causes wrapping bugs with long input lines.
405 413
406 414 2006-10-28 Ville Vainio <vivainio@gmail.com>
407 415
408 416 * Magic.py (%run): Save and restore the readline history from
409 417 file around %run commands to prevent side effects from
410 418 %runned programs that might use readline (e.g. pydb).
411 419
412 420 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
413 421 invoking the pydb enhanced debugger.
414 422
415 423 2006-10-23 Walter Doerwald <walter@livinglogic.de>
416 424
417 425 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
418 426 call the base class method and propagate the return value to
419 427 ifile. This is now done by path itself.
420 428
421 429 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
422 430
423 431 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
424 432 api: set_crash_handler(), to expose the ability to change the
425 433 internal crash handler.
426 434
427 435 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
428 436 the various parameters of the crash handler so that apps using
429 437 IPython as their engine can customize crash handling. Ipmlemented
430 438 at the request of SAGE.
431 439
432 440 2006-10-14 Ville Vainio <vivainio@gmail.com>
433 441
434 442 * Magic.py, ipython.el: applied first "safe" part of Rocky
435 443 Bernstein's patch set for pydb integration.
436 444
437 445 * Magic.py (%unalias, %alias): %store'd aliases can now be
438 446 removed with '%unalias'. %alias w/o args now shows most
439 447 interesting (stored / manually defined) aliases last
440 448 where they catch the eye w/o scrolling.
441 449
442 450 * Magic.py (%rehashx), ext_rehashdir.py: files with
443 451 'py' extension are always considered executable, even
444 452 when not in PATHEXT environment variable.
445 453
446 454 2006-10-12 Ville Vainio <vivainio@gmail.com>
447 455
448 456 * jobctrl.py: Add new "jobctrl" extension for spawning background
449 457 processes with "&find /". 'import jobctrl' to try it out. Requires
450 458 'subprocess' module, standard in python 2.4+.
451 459
452 460 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
453 461 so if foo -> bar and bar -> baz, then foo -> baz.
454 462
455 463 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
456 464
457 465 * IPython/Magic.py (Magic.parse_options): add a new posix option
458 466 to allow parsing of input args in magics that doesn't strip quotes
459 467 (if posix=False). This also closes %timeit bug reported by
460 468 Stefan.
461 469
462 470 2006-10-03 Ville Vainio <vivainio@gmail.com>
463 471
464 472 * iplib.py (raw_input, interact): Return ValueError catching for
465 473 raw_input. Fixes infinite loop for sys.stdin.close() or
466 474 sys.stdout.close().
467 475
468 476 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
469 477
470 478 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
471 479 to help in handling doctests. irunner is now pretty useful for
472 480 running standalone scripts and simulate a full interactive session
473 481 in a format that can be then pasted as a doctest.
474 482
475 483 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
476 484 on top of the default (useless) ones. This also fixes the nasty
477 485 way in which 2.5's Quitter() exits (reverted [1785]).
478 486
479 487 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
480 488 2.5.
481 489
482 490 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
483 491 color scheme is updated as well when color scheme is changed
484 492 interactively.
485 493
486 494 2006-09-27 Ville Vainio <vivainio@gmail.com>
487 495
488 496 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
489 497 infinite loop and just exit. It's a hack, but will do for a while.
490 498
491 499 2006-08-25 Walter Doerwald <walter@livinglogic.de>
492 500
493 501 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
494 502 the constructor, this makes it possible to get a list of only directories
495 503 or only files.
496 504
497 505 2006-08-12 Ville Vainio <vivainio@gmail.com>
498 506
499 507 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
500 508 they broke unittest
501 509
502 510 2006-08-11 Ville Vainio <vivainio@gmail.com>
503 511
504 512 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
505 513 by resolving issue properly, i.e. by inheriting FakeModule
506 514 from types.ModuleType. Pickling ipython interactive data
507 515 should still work as usual (testing appreciated).
508 516
509 517 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
510 518
511 519 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
512 520 running under python 2.3 with code from 2.4 to fix a bug with
513 521 help(). Reported by the Debian maintainers, Norbert Tretkowski
514 522 <norbert-AT-tretkowski.de> and Alexandre Fayolle
515 523 <afayolle-AT-debian.org>.
516 524
517 525 2006-08-04 Walter Doerwald <walter@livinglogic.de>
518 526
519 527 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
520 528 (which was displaying "quit" twice).
521 529
522 530 2006-07-28 Walter Doerwald <walter@livinglogic.de>
523 531
524 532 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
525 533 the mode argument).
526 534
527 535 2006-07-27 Walter Doerwald <walter@livinglogic.de>
528 536
529 537 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
530 538 not running under IPython.
531 539
532 540 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
533 541 and make it iterable (iterating over the attribute itself). Add two new
534 542 magic strings for __xattrs__(): If the string starts with "-", the attribute
535 543 will not be displayed in ibrowse's detail view (but it can still be
536 544 iterated over). This makes it possible to add attributes that are large
537 545 lists or generator methods to the detail view. Replace magic attribute names
538 546 and _attrname() and _getattr() with "descriptors": For each type of magic
539 547 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
540 548 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
541 549 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
542 550 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
543 551 are still supported.
544 552
545 553 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
546 554 fails in ibrowse.fetch(), the exception object is added as the last item
547 555 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
548 556 a generator throws an exception midway through execution.
549 557
550 558 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
551 559 encoding into methods.
552 560
553 561 2006-07-26 Ville Vainio <vivainio@gmail.com>
554 562
555 563 * iplib.py: history now stores multiline input as single
556 564 history entries. Patch by Jorgen Cederlof.
557 565
558 566 2006-07-18 Walter Doerwald <walter@livinglogic.de>
559 567
560 568 * IPython/Extensions/ibrowse.py: Make cursor visible over
561 569 non existing attributes.
562 570
563 571 2006-07-14 Walter Doerwald <walter@livinglogic.de>
564 572
565 573 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
566 574 error output of the running command doesn't mess up the screen.
567 575
568 576 2006-07-13 Walter Doerwald <walter@livinglogic.de>
569 577
570 578 * IPython/Extensions/ipipe.py (isort): Make isort usable without
571 579 argument. This sorts the items themselves.
572 580
573 581 2006-07-12 Walter Doerwald <walter@livinglogic.de>
574 582
575 583 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
576 584 Compile expression strings into code objects. This should speed
577 585 up ifilter and friends somewhat.
578 586
579 587 2006-07-08 Ville Vainio <vivainio@gmail.com>
580 588
581 589 * Magic.py: %cpaste now strips > from the beginning of lines
582 590 to ease pasting quoted code from emails. Contributed by
583 591 Stefan van der Walt.
584 592
585 593 2006-06-29 Ville Vainio <vivainio@gmail.com>
586 594
587 595 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
588 596 mode, patch contributed by Darren Dale. NEEDS TESTING!
589 597
590 598 2006-06-28 Walter Doerwald <walter@livinglogic.de>
591 599
592 600 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
593 601 a blue background. Fix fetching new display rows when the browser
594 602 scrolls more than a screenful (e.g. by using the goto command).
595 603
596 604 2006-06-27 Ville Vainio <vivainio@gmail.com>
597 605
598 606 * Magic.py (_inspect, _ofind) Apply David Huard's
599 607 patch for displaying the correct docstring for 'property'
600 608 attributes.
601 609
602 610 2006-06-23 Walter Doerwald <walter@livinglogic.de>
603 611
604 612 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
605 613 commands into the methods implementing them.
606 614
607 615 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
608 616
609 617 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
610 618 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
611 619 autoindent support was authored by Jin Liu.
612 620
613 621 2006-06-22 Walter Doerwald <walter@livinglogic.de>
614 622
615 623 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
616 624 for keymaps with a custom class that simplifies handling.
617 625
618 626 2006-06-19 Walter Doerwald <walter@livinglogic.de>
619 627
620 628 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
621 629 resizing. This requires Python 2.5 to work.
622 630
623 631 2006-06-16 Walter Doerwald <walter@livinglogic.de>
624 632
625 633 * IPython/Extensions/ibrowse.py: Add two new commands to
626 634 ibrowse: "hideattr" (mapped to "h") hides the attribute under
627 635 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
628 636 attributes again. Remapped the help command to "?". Display
629 637 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
630 638 as keys for the "home" and "end" commands. Add three new commands
631 639 to the input mode for "find" and friends: "delend" (CTRL-K)
632 640 deletes to the end of line. "incsearchup" searches upwards in the
633 641 command history for an input that starts with the text before the cursor.
634 642 "incsearchdown" does the same downwards. Removed a bogus mapping of
635 643 the x key to "delete".
636 644
637 645 2006-06-15 Ville Vainio <vivainio@gmail.com>
638 646
639 647 * iplib.py, hooks.py: Added new generate_prompt hook that can be
640 648 used to create prompts dynamically, instead of the "old" way of
641 649 assigning "magic" strings to prompt_in1 and prompt_in2. The old
642 650 way still works (it's invoked by the default hook), of course.
643 651
644 652 * Prompts.py: added generate_output_prompt hook for altering output
645 653 prompt
646 654
647 655 * Release.py: Changed version string to 0.7.3.svn.
648 656
649 657 2006-06-15 Walter Doerwald <walter@livinglogic.de>
650 658
651 659 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
652 660 the call to fetch() always tries to fetch enough data for at least one
653 661 full screen. This makes it possible to simply call moveto(0,0,True) in
654 662 the constructor. Fix typos and removed the obsolete goto attribute.
655 663
656 664 2006-06-12 Ville Vainio <vivainio@gmail.com>
657 665
658 666 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
659 667 allowing $variable interpolation within multiline statements,
660 668 though so far only with "sh" profile for a testing period.
661 669 The patch also enables splitting long commands with \ but it
662 670 doesn't work properly yet.
663 671
664 672 2006-06-12 Walter Doerwald <walter@livinglogic.de>
665 673
666 674 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
667 675 input history and the position of the cursor in the input history for
668 676 the find, findbackwards and goto command.
669 677
670 678 2006-06-10 Walter Doerwald <walter@livinglogic.de>
671 679
672 680 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
673 681 implements the basic functionality of browser commands that require
674 682 input. Reimplement the goto, find and findbackwards commands as
675 683 subclasses of _CommandInput. Add an input history and keymaps to those
676 684 commands. Add "\r" as a keyboard shortcut for the enterdefault and
677 685 execute commands.
678 686
679 687 2006-06-07 Ville Vainio <vivainio@gmail.com>
680 688
681 689 * iplib.py: ipython mybatch.ipy exits ipython immediately after
682 690 running the batch files instead of leaving the session open.
683 691
684 692 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
685 693
686 694 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
687 695 the original fix was incomplete. Patch submitted by W. Maier.
688 696
689 697 2006-06-07 Ville Vainio <vivainio@gmail.com>
690 698
691 699 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
692 700 Confirmation prompts can be supressed by 'quiet' option.
693 701 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
694 702
695 703 2006-06-06 *** Released version 0.7.2
696 704
697 705 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
698 706
699 707 * IPython/Release.py (version): Made 0.7.2 final for release.
700 708 Repo tagged and release cut.
701 709
702 710 2006-06-05 Ville Vainio <vivainio@gmail.com>
703 711
704 712 * Magic.py (magic_rehashx): Honor no_alias list earlier in
705 713 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
706 714
707 715 * upgrade_dir.py: try import 'path' module a bit harder
708 716 (for %upgrade)
709 717
710 718 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
711 719
712 720 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
713 721 instead of looping 20 times.
714 722
715 723 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
716 724 correctly at initialization time. Bug reported by Krishna Mohan
717 725 Gundu <gkmohan-AT-gmail.com> on the user list.
718 726
719 727 * IPython/Release.py (version): Mark 0.7.2 version to start
720 728 testing for release on 06/06.
721 729
722 730 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
723 731
724 732 * scripts/irunner: thin script interface so users don't have to
725 733 find the module and call it as an executable, since modules rarely
726 734 live in people's PATH.
727 735
728 736 * IPython/irunner.py (InteractiveRunner.__init__): added
729 737 delaybeforesend attribute to control delays with newer versions of
730 738 pexpect. Thanks to detailed help from pexpect's author, Noah
731 739 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
732 740 correctly (it works in NoColor mode).
733 741
734 742 * IPython/iplib.py (handle_normal): fix nasty crash reported on
735 743 SAGE list, from improper log() calls.
736 744
737 745 2006-05-31 Ville Vainio <vivainio@gmail.com>
738 746
739 747 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
740 748 with args in parens to work correctly with dirs that have spaces.
741 749
742 750 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
743 751
744 752 * IPython/Logger.py (Logger.logstart): add option to log raw input
745 753 instead of the processed one. A -r flag was added to the
746 754 %logstart magic used for controlling logging.
747 755
748 756 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
749 757
750 758 * IPython/iplib.py (InteractiveShell.__init__): add check for the
751 759 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
752 760 recognize the option. After a bug report by Will Maier. This
753 761 closes #64 (will do it after confirmation from W. Maier).
754 762
755 763 * IPython/irunner.py: New module to run scripts as if manually
756 764 typed into an interactive environment, based on pexpect. After a
757 765 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
758 766 ipython-user list. Simple unittests in the tests/ directory.
759 767
760 768 * tools/release: add Will Maier, OpenBSD port maintainer, to
761 769 recepients list. We are now officially part of the OpenBSD ports:
762 770 http://www.openbsd.org/ports.html ! Many thanks to Will for the
763 771 work.
764 772
765 773 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
766 774
767 775 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
768 776 so that it doesn't break tkinter apps.
769 777
770 778 * IPython/iplib.py (_prefilter): fix bug where aliases would
771 779 shadow variables when autocall was fully off. Reported by SAGE
772 780 author William Stein.
773 781
774 782 * IPython/OInspect.py (Inspector.__init__): add a flag to control
775 783 at what detail level strings are computed when foo? is requested.
776 784 This allows users to ask for example that the string form of an
777 785 object is only computed when foo?? is called, or even never, by
778 786 setting the object_info_string_level >= 2 in the configuration
779 787 file. This new option has been added and documented. After a
780 788 request by SAGE to be able to control the printing of very large
781 789 objects more easily.
782 790
783 791 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
784 792
785 793 * IPython/ipmaker.py (make_IPython): remove the ipython call path
786 794 from sys.argv, to be 100% consistent with how Python itself works
787 795 (as seen for example with python -i file.py). After a bug report
788 796 by Jeffrey Collins.
789 797
790 798 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
791 799 nasty bug which was preventing custom namespaces with -pylab,
792 800 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
793 801 compatibility (long gone from mpl).
794 802
795 803 * IPython/ipapi.py (make_session): name change: create->make. We
796 804 use make in other places (ipmaker,...), it's shorter and easier to
797 805 type and say, etc. I'm trying to clean things before 0.7.2 so
798 806 that I can keep things stable wrt to ipapi in the chainsaw branch.
799 807
800 808 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
801 809 python-mode recognizes our debugger mode. Add support for
802 810 autoindent inside (X)emacs. After a patch sent in by Jin Liu
803 811 <m.liu.jin-AT-gmail.com> originally written by
804 812 doxgen-AT-newsmth.net (with minor modifications for xemacs
805 813 compatibility)
806 814
807 815 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
808 816 tracebacks when walking the stack so that the stack tracking system
809 817 in emacs' python-mode can identify the frames correctly.
810 818
811 819 * IPython/ipmaker.py (make_IPython): make the internal (and
812 820 default config) autoedit_syntax value false by default. Too many
813 821 users have complained to me (both on and off-list) about problems
814 822 with this option being on by default, so I'm making it default to
815 823 off. It can still be enabled by anyone via the usual mechanisms.
816 824
817 825 * IPython/completer.py (Completer.attr_matches): add support for
818 826 PyCrust-style _getAttributeNames magic method. Patch contributed
819 827 by <mscott-AT-goldenspud.com>. Closes #50.
820 828
821 829 * IPython/iplib.py (InteractiveShell.__init__): remove the
822 830 deletion of exit/quit from __builtin__, which can break
823 831 third-party tools like the Zope debugging console. The
824 832 %exit/%quit magics remain. In general, it's probably a good idea
825 833 not to delete anything from __builtin__, since we never know what
826 834 that will break. In any case, python now (for 2.5) will support
827 835 'real' exit/quit, so this issue is moot. Closes #55.
828 836
829 837 * IPython/genutils.py (with_obj): rename the 'with' function to
830 838 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
831 839 becomes a language keyword. Closes #53.
832 840
833 841 * IPython/FakeModule.py (FakeModule.__init__): add a proper
834 842 __file__ attribute to this so it fools more things into thinking
835 843 it is a real module. Closes #59.
836 844
837 845 * IPython/Magic.py (magic_edit): add -n option to open the editor
838 846 at a specific line number. After a patch by Stefan van der Walt.
839 847
840 848 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
841 849
842 850 * IPython/iplib.py (edit_syntax_error): fix crash when for some
843 851 reason the file could not be opened. After automatic crash
844 852 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
845 853 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
846 854 (_should_recompile): Don't fire editor if using %bg, since there
847 855 is no file in the first place. From the same report as above.
848 856 (raw_input): protect against faulty third-party prefilters. After
849 857 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
850 858 while running under SAGE.
851 859
852 860 2006-05-23 Ville Vainio <vivainio@gmail.com>
853 861
854 862 * ipapi.py: Stripped down ip.to_user_ns() to work only as
855 863 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
856 864 now returns None (again), unless dummy is specifically allowed by
857 865 ipapi.get(allow_dummy=True).
858 866
859 867 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
860 868
861 869 * IPython: remove all 2.2-compatibility objects and hacks from
862 870 everywhere, since we only support 2.3 at this point. Docs
863 871 updated.
864 872
865 873 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
866 874 Anything requiring extra validation can be turned into a Python
867 875 property in the future. I used a property for the db one b/c
868 876 there was a nasty circularity problem with the initialization
869 877 order, which right now I don't have time to clean up.
870 878
871 879 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
872 880 another locking bug reported by Jorgen. I'm not 100% sure though,
873 881 so more testing is needed...
874 882
875 883 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
876 884
877 885 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
878 886 local variables from any routine in user code (typically executed
879 887 with %run) directly into the interactive namespace. Very useful
880 888 when doing complex debugging.
881 889 (IPythonNotRunning): Changed the default None object to a dummy
882 890 whose attributes can be queried as well as called without
883 891 exploding, to ease writing code which works transparently both in
884 892 and out of ipython and uses some of this API.
885 893
886 894 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
887 895
888 896 * IPython/hooks.py (result_display): Fix the fact that our display
889 897 hook was using str() instead of repr(), as the default python
890 898 console does. This had gone unnoticed b/c it only happened if
891 899 %Pprint was off, but the inconsistency was there.
892 900
893 901 2006-05-15 Ville Vainio <vivainio@gmail.com>
894 902
895 903 * Oinspect.py: Only show docstring for nonexisting/binary files
896 904 when doing object??, closing ticket #62
897 905
898 906 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
899 907
900 908 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
901 909 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
902 910 was being released in a routine which hadn't checked if it had
903 911 been the one to acquire it.
904 912
905 913 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
906 914
907 915 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
908 916
909 917 2006-04-11 Ville Vainio <vivainio@gmail.com>
910 918
911 919 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
912 920 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
913 921 prefilters, allowing stuff like magics and aliases in the file.
914 922
915 923 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
916 924 added. Supported now are "%clear in" and "%clear out" (clear input and
917 925 output history, respectively). Also fixed CachedOutput.flush to
918 926 properly flush the output cache.
919 927
920 928 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
921 929 half-success (and fail explicitly).
922 930
923 931 2006-03-28 Ville Vainio <vivainio@gmail.com>
924 932
925 933 * iplib.py: Fix quoting of aliases so that only argless ones
926 934 are quoted
927 935
928 936 2006-03-28 Ville Vainio <vivainio@gmail.com>
929 937
930 938 * iplib.py: Quote aliases with spaces in the name.
931 939 "c:\program files\blah\bin" is now legal alias target.
932 940
933 941 * ext_rehashdir.py: Space no longer allowed as arg
934 942 separator, since space is legal in path names.
935 943
936 944 2006-03-16 Ville Vainio <vivainio@gmail.com>
937 945
938 946 * upgrade_dir.py: Take path.py from Extensions, correcting
939 947 %upgrade magic
940 948
941 949 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
942 950
943 951 * hooks.py: Only enclose editor binary in quotes if legal and
944 952 necessary (space in the name, and is an existing file). Fixes a bug
945 953 reported by Zachary Pincus.
946 954
947 955 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
948 956
949 957 * Manual: thanks to a tip on proper color handling for Emacs, by
950 958 Eric J Haywiser <ejh1-AT-MIT.EDU>.
951 959
952 960 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
953 961 by applying the provided patch. Thanks to Liu Jin
954 962 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
955 963 XEmacs/Linux, I'm trusting the submitter that it actually helps
956 964 under win32/GNU Emacs. Will revisit if any problems are reported.
957 965
958 966 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
959 967
960 968 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
961 969 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
962 970
963 971 2006-03-12 Ville Vainio <vivainio@gmail.com>
964 972
965 973 * Magic.py (magic_timeit): Added %timeit magic, contributed by
966 974 Torsten Marek.
967 975
968 976 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
969 977
970 978 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
971 979 line ranges works again.
972 980
973 981 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
974 982
975 983 * IPython/iplib.py (showtraceback): add back sys.last_traceback
976 984 and friends, after a discussion with Zach Pincus on ipython-user.
977 985 I'm not 100% sure, but after thinking about it quite a bit, it may
978 986 be OK. Testing with the multithreaded shells didn't reveal any
979 987 problems, but let's keep an eye out.
980 988
981 989 In the process, I fixed a few things which were calling
982 990 self.InteractiveTB() directly (like safe_execfile), which is a
983 991 mistake: ALL exception reporting should be done by calling
984 992 self.showtraceback(), which handles state and tab-completion and
985 993 more.
986 994
987 995 2006-03-01 Ville Vainio <vivainio@gmail.com>
988 996
989 997 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
990 998 To use, do "from ipipe import *".
991 999
992 1000 2006-02-24 Ville Vainio <vivainio@gmail.com>
993 1001
994 1002 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
995 1003 "cleanly" and safely than the older upgrade mechanism.
996 1004
997 1005 2006-02-21 Ville Vainio <vivainio@gmail.com>
998 1006
999 1007 * Magic.py: %save works again.
1000 1008
1001 1009 2006-02-15 Ville Vainio <vivainio@gmail.com>
1002 1010
1003 1011 * Magic.py: %Pprint works again
1004 1012
1005 1013 * Extensions/ipy_sane_defaults.py: Provide everything provided
1006 1014 in default ipythonrc, to make it possible to have a completely empty
1007 1015 ipythonrc (and thus completely rc-file free configuration)
1008 1016
1009 1017 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1010 1018
1011 1019 * IPython/hooks.py (editor): quote the call to the editor command,
1012 1020 to allow commands with spaces in them. Problem noted by watching
1013 1021 Ian Oswald's video about textpad under win32 at
1014 1022 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1015 1023
1016 1024 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1017 1025 describing magics (we haven't used @ for a loong time).
1018 1026
1019 1027 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1020 1028 contributed by marienz to close
1021 1029 http://www.scipy.net/roundup/ipython/issue53.
1022 1030
1023 1031 2006-02-10 Ville Vainio <vivainio@gmail.com>
1024 1032
1025 1033 * genutils.py: getoutput now works in win32 too
1026 1034
1027 1035 * completer.py: alias and magic completion only invoked
1028 1036 at the first "item" in the line, to avoid "cd %store"
1029 1037 nonsense.
1030 1038
1031 1039 2006-02-09 Ville Vainio <vivainio@gmail.com>
1032 1040
1033 1041 * test/*: Added a unit testing framework (finally).
1034 1042 '%run runtests.py' to run test_*.
1035 1043
1036 1044 * ipapi.py: Exposed runlines and set_custom_exc
1037 1045
1038 1046 2006-02-07 Ville Vainio <vivainio@gmail.com>
1039 1047
1040 1048 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1041 1049 instead use "f(1 2)" as before.
1042 1050
1043 1051 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1044 1052
1045 1053 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1046 1054 facilities, for demos processed by the IPython input filter
1047 1055 (IPythonDemo), and for running a script one-line-at-a-time as a
1048 1056 demo, both for pure Python (LineDemo) and for IPython-processed
1049 1057 input (IPythonLineDemo). After a request by Dave Kohel, from the
1050 1058 SAGE team.
1051 1059 (Demo.edit): added an edit() method to the demo objects, to edit
1052 1060 the in-memory copy of the last executed block.
1053 1061
1054 1062 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1055 1063 processing to %edit, %macro and %save. These commands can now be
1056 1064 invoked on the unprocessed input as it was typed by the user
1057 1065 (without any prefilters applied). After requests by the SAGE team
1058 1066 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1059 1067
1060 1068 2006-02-01 Ville Vainio <vivainio@gmail.com>
1061 1069
1062 1070 * setup.py, eggsetup.py: easy_install ipython==dev works
1063 1071 correctly now (on Linux)
1064 1072
1065 1073 * ipy_user_conf,ipmaker: user config changes, removed spurious
1066 1074 warnings
1067 1075
1068 1076 * iplib: if rc.banner is string, use it as is.
1069 1077
1070 1078 * Magic: %pycat accepts a string argument and pages it's contents.
1071 1079
1072 1080
1073 1081 2006-01-30 Ville Vainio <vivainio@gmail.com>
1074 1082
1075 1083 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1076 1084 Now %store and bookmarks work through PickleShare, meaning that
1077 1085 concurrent access is possible and all ipython sessions see the
1078 1086 same database situation all the time, instead of snapshot of
1079 1087 the situation when the session was started. Hence, %bookmark
1080 1088 results are immediately accessible from othes sessions. The database
1081 1089 is also available for use by user extensions. See:
1082 1090 http://www.python.org/pypi/pickleshare
1083 1091
1084 1092 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1085 1093
1086 1094 * aliases can now be %store'd
1087 1095
1088 1096 * path.py moved to Extensions so that pickleshare does not need
1089 1097 IPython-specific import. Extensions added to pythonpath right
1090 1098 at __init__.
1091 1099
1092 1100 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1093 1101 called with _ip.system and the pre-transformed command string.
1094 1102
1095 1103 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1096 1104
1097 1105 * IPython/iplib.py (interact): Fix that we were not catching
1098 1106 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1099 1107 logic here had to change, but it's fixed now.
1100 1108
1101 1109 2006-01-29 Ville Vainio <vivainio@gmail.com>
1102 1110
1103 1111 * iplib.py: Try to import pyreadline on Windows.
1104 1112
1105 1113 2006-01-27 Ville Vainio <vivainio@gmail.com>
1106 1114
1107 1115 * iplib.py: Expose ipapi as _ip in builtin namespace.
1108 1116 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1109 1117 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1110 1118 syntax now produce _ip.* variant of the commands.
1111 1119
1112 1120 * "_ip.options().autoedit_syntax = 2" automatically throws
1113 1121 user to editor for syntax error correction without prompting.
1114 1122
1115 1123 2006-01-27 Ville Vainio <vivainio@gmail.com>
1116 1124
1117 1125 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1118 1126 'ipython' at argv[0]) executed through command line.
1119 1127 NOTE: this DEPRECATES calling ipython with multiple scripts
1120 1128 ("ipython a.py b.py c.py")
1121 1129
1122 1130 * iplib.py, hooks.py: Added configurable input prefilter,
1123 1131 named 'input_prefilter'. See ext_rescapture.py for example
1124 1132 usage.
1125 1133
1126 1134 * ext_rescapture.py, Magic.py: Better system command output capture
1127 1135 through 'var = !ls' (deprecates user-visible %sc). Same notation
1128 1136 applies for magics, 'var = %alias' assigns alias list to var.
1129 1137
1130 1138 * ipapi.py: added meta() for accessing extension-usable data store.
1131 1139
1132 1140 * iplib.py: added InteractiveShell.getapi(). New magics should be
1133 1141 written doing self.getapi() instead of using the shell directly.
1134 1142
1135 1143 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1136 1144 %store foo >> ~/myfoo.txt to store variables to files (in clean
1137 1145 textual form, not a restorable pickle).
1138 1146
1139 1147 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1140 1148
1141 1149 * usage.py, Magic.py: added %quickref
1142 1150
1143 1151 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1144 1152
1145 1153 * GetoptErrors when invoking magics etc. with wrong args
1146 1154 are now more helpful:
1147 1155 GetoptError: option -l not recognized (allowed: "qb" )
1148 1156
1149 1157 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1150 1158
1151 1159 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1152 1160 computationally intensive blocks don't appear to stall the demo.
1153 1161
1154 1162 2006-01-24 Ville Vainio <vivainio@gmail.com>
1155 1163
1156 1164 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1157 1165 value to manipulate resulting history entry.
1158 1166
1159 1167 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1160 1168 to instance methods of IPApi class, to make extending an embedded
1161 1169 IPython feasible. See ext_rehashdir.py for example usage.
1162 1170
1163 1171 * Merged 1071-1076 from branches/0.7.1
1164 1172
1165 1173
1166 1174 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1167 1175
1168 1176 * tools/release (daystamp): Fix build tools to use the new
1169 1177 eggsetup.py script to build lightweight eggs.
1170 1178
1171 1179 * Applied changesets 1062 and 1064 before 0.7.1 release.
1172 1180
1173 1181 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1174 1182 see the raw input history (without conversions like %ls ->
1175 1183 ipmagic("ls")). After a request from W. Stein, SAGE
1176 1184 (http://modular.ucsd.edu/sage) developer. This information is
1177 1185 stored in the input_hist_raw attribute of the IPython instance, so
1178 1186 developers can access it if needed (it's an InputList instance).
1179 1187
1180 1188 * Versionstring = 0.7.2.svn
1181 1189
1182 1190 * eggsetup.py: A separate script for constructing eggs, creates
1183 1191 proper launch scripts even on Windows (an .exe file in
1184 1192 \python24\scripts).
1185 1193
1186 1194 * ipapi.py: launch_new_instance, launch entry point needed for the
1187 1195 egg.
1188 1196
1189 1197 2006-01-23 Ville Vainio <vivainio@gmail.com>
1190 1198
1191 1199 * Added %cpaste magic for pasting python code
1192 1200
1193 1201 2006-01-22 Ville Vainio <vivainio@gmail.com>
1194 1202
1195 1203 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1196 1204
1197 1205 * Versionstring = 0.7.2.svn
1198 1206
1199 1207 * eggsetup.py: A separate script for constructing eggs, creates
1200 1208 proper launch scripts even on Windows (an .exe file in
1201 1209 \python24\scripts).
1202 1210
1203 1211 * ipapi.py: launch_new_instance, launch entry point needed for the
1204 1212 egg.
1205 1213
1206 1214 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1207 1215
1208 1216 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1209 1217 %pfile foo would print the file for foo even if it was a binary.
1210 1218 Now, extensions '.so' and '.dll' are skipped.
1211 1219
1212 1220 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1213 1221 bug, where macros would fail in all threaded modes. I'm not 100%
1214 1222 sure, so I'm going to put out an rc instead of making a release
1215 1223 today, and wait for feedback for at least a few days.
1216 1224
1217 1225 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1218 1226 it...) the handling of pasting external code with autoindent on.
1219 1227 To get out of a multiline input, the rule will appear for most
1220 1228 users unchanged: two blank lines or change the indent level
1221 1229 proposed by IPython. But there is a twist now: you can
1222 1230 add/subtract only *one or two spaces*. If you add/subtract three
1223 1231 or more (unless you completely delete the line), IPython will
1224 1232 accept that line, and you'll need to enter a second one of pure
1225 1233 whitespace. I know it sounds complicated, but I can't find a
1226 1234 different solution that covers all the cases, with the right
1227 1235 heuristics. Hopefully in actual use, nobody will really notice
1228 1236 all these strange rules and things will 'just work'.
1229 1237
1230 1238 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1231 1239
1232 1240 * IPython/iplib.py (interact): catch exceptions which can be
1233 1241 triggered asynchronously by signal handlers. Thanks to an
1234 1242 automatic crash report, submitted by Colin Kingsley
1235 1243 <tercel-AT-gentoo.org>.
1236 1244
1237 1245 2006-01-20 Ville Vainio <vivainio@gmail.com>
1238 1246
1239 1247 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1240 1248 (%rehashdir, very useful, try it out) of how to extend ipython
1241 1249 with new magics. Also added Extensions dir to pythonpath to make
1242 1250 importing extensions easy.
1243 1251
1244 1252 * %store now complains when trying to store interactively declared
1245 1253 classes / instances of those classes.
1246 1254
1247 1255 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1248 1256 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1249 1257 if they exist, and ipy_user_conf.py with some defaults is created for
1250 1258 the user.
1251 1259
1252 1260 * Startup rehashing done by the config file, not InterpreterExec.
1253 1261 This means system commands are available even without selecting the
1254 1262 pysh profile. It's the sensible default after all.
1255 1263
1256 1264 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1257 1265
1258 1266 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1259 1267 multiline code with autoindent on working. But I am really not
1260 1268 sure, so this needs more testing. Will commit a debug-enabled
1261 1269 version for now, while I test it some more, so that Ville and
1262 1270 others may also catch any problems. Also made
1263 1271 self.indent_current_str() a method, to ensure that there's no
1264 1272 chance of the indent space count and the corresponding string
1265 1273 falling out of sync. All code needing the string should just call
1266 1274 the method.
1267 1275
1268 1276 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1269 1277
1270 1278 * IPython/Magic.py (magic_edit): fix check for when users don't
1271 1279 save their output files, the try/except was in the wrong section.
1272 1280
1273 1281 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1274 1282
1275 1283 * IPython/Magic.py (magic_run): fix __file__ global missing from
1276 1284 script's namespace when executed via %run. After a report by
1277 1285 Vivian.
1278 1286
1279 1287 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1280 1288 when using python 2.4. The parent constructor changed in 2.4, and
1281 1289 we need to track it directly (we can't call it, as it messes up
1282 1290 readline and tab-completion inside our pdb would stop working).
1283 1291 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1284 1292
1285 1293 2006-01-16 Ville Vainio <vivainio@gmail.com>
1286 1294
1287 1295 * Ipython/magic.py: Reverted back to old %edit functionality
1288 1296 that returns file contents on exit.
1289 1297
1290 1298 * IPython/path.py: Added Jason Orendorff's "path" module to
1291 1299 IPython tree, http://www.jorendorff.com/articles/python/path/.
1292 1300 You can get path objects conveniently through %sc, and !!, e.g.:
1293 1301 sc files=ls
1294 1302 for p in files.paths: # or files.p
1295 1303 print p,p.mtime
1296 1304
1297 1305 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1298 1306 now work again without considering the exclusion regexp -
1299 1307 hence, things like ',foo my/path' turn to 'foo("my/path")'
1300 1308 instead of syntax error.
1301 1309
1302 1310
1303 1311 2006-01-14 Ville Vainio <vivainio@gmail.com>
1304 1312
1305 1313 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1306 1314 ipapi decorators for python 2.4 users, options() provides access to rc
1307 1315 data.
1308 1316
1309 1317 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1310 1318 as path separators (even on Linux ;-). Space character after
1311 1319 backslash (as yielded by tab completer) is still space;
1312 1320 "%cd long\ name" works as expected.
1313 1321
1314 1322 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1315 1323 as "chain of command", with priority. API stays the same,
1316 1324 TryNext exception raised by a hook function signals that
1317 1325 current hook failed and next hook should try handling it, as
1318 1326 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1319 1327 requested configurable display hook, which is now implemented.
1320 1328
1321 1329 2006-01-13 Ville Vainio <vivainio@gmail.com>
1322 1330
1323 1331 * IPython/platutils*.py: platform specific utility functions,
1324 1332 so far only set_term_title is implemented (change terminal
1325 1333 label in windowing systems). %cd now changes the title to
1326 1334 current dir.
1327 1335
1328 1336 * IPython/Release.py: Added myself to "authors" list,
1329 1337 had to create new files.
1330 1338
1331 1339 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1332 1340 shell escape; not a known bug but had potential to be one in the
1333 1341 future.
1334 1342
1335 1343 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1336 1344 extension API for IPython! See the module for usage example. Fix
1337 1345 OInspect for docstring-less magic functions.
1338 1346
1339 1347
1340 1348 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1341 1349
1342 1350 * IPython/iplib.py (raw_input): temporarily deactivate all
1343 1351 attempts at allowing pasting of code with autoindent on. It
1344 1352 introduced bugs (reported by Prabhu) and I can't seem to find a
1345 1353 robust combination which works in all cases. Will have to revisit
1346 1354 later.
1347 1355
1348 1356 * IPython/genutils.py: remove isspace() function. We've dropped
1349 1357 2.2 compatibility, so it's OK to use the string method.
1350 1358
1351 1359 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1352 1360
1353 1361 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1354 1362 matching what NOT to autocall on, to include all python binary
1355 1363 operators (including things like 'and', 'or', 'is' and 'in').
1356 1364 Prompted by a bug report on 'foo & bar', but I realized we had
1357 1365 many more potential bug cases with other operators. The regexp is
1358 1366 self.re_exclude_auto, it's fairly commented.
1359 1367
1360 1368 2006-01-12 Ville Vainio <vivainio@gmail.com>
1361 1369
1362 1370 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1363 1371 Prettified and hardened string/backslash quoting with ipsystem(),
1364 1372 ipalias() and ipmagic(). Now even \ characters are passed to
1365 1373 %magics, !shell escapes and aliases exactly as they are in the
1366 1374 ipython command line. Should improve backslash experience,
1367 1375 particularly in Windows (path delimiter for some commands that
1368 1376 won't understand '/'), but Unix benefits as well (regexps). %cd
1369 1377 magic still doesn't support backslash path delimiters, though. Also
1370 1378 deleted all pretense of supporting multiline command strings in
1371 1379 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1372 1380
1373 1381 * doc/build_doc_instructions.txt added. Documentation on how to
1374 1382 use doc/update_manual.py, added yesterday. Both files contributed
1375 1383 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1376 1384 doc/*.sh for deprecation at a later date.
1377 1385
1378 1386 * /ipython.py Added ipython.py to root directory for
1379 1387 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1380 1388 ipython.py) and development convenience (no need to keep doing
1381 1389 "setup.py install" between changes).
1382 1390
1383 1391 * Made ! and !! shell escapes work (again) in multiline expressions:
1384 1392 if 1:
1385 1393 !ls
1386 1394 !!ls
1387 1395
1388 1396 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1389 1397
1390 1398 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1391 1399 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1392 1400 module in case-insensitive installation. Was causing crashes
1393 1401 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1394 1402
1395 1403 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1396 1404 <marienz-AT-gentoo.org>, closes
1397 1405 http://www.scipy.net/roundup/ipython/issue51.
1398 1406
1399 1407 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1400 1408
1401 1409 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1402 1410 problem of excessive CPU usage under *nix and keyboard lag under
1403 1411 win32.
1404 1412
1405 1413 2006-01-10 *** Released version 0.7.0
1406 1414
1407 1415 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1408 1416
1409 1417 * IPython/Release.py (revision): tag version number to 0.7.0,
1410 1418 ready for release.
1411 1419
1412 1420 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1413 1421 it informs the user of the name of the temp. file used. This can
1414 1422 help if you decide later to reuse that same file, so you know
1415 1423 where to copy the info from.
1416 1424
1417 1425 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1418 1426
1419 1427 * setup_bdist_egg.py: little script to build an egg. Added
1420 1428 support in the release tools as well.
1421 1429
1422 1430 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1423 1431
1424 1432 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1425 1433 version selection (new -wxversion command line and ipythonrc
1426 1434 parameter). Patch contributed by Arnd Baecker
1427 1435 <arnd.baecker-AT-web.de>.
1428 1436
1429 1437 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1430 1438 embedded instances, for variables defined at the interactive
1431 1439 prompt of the embedded ipython. Reported by Arnd.
1432 1440
1433 1441 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1434 1442 it can be used as a (stateful) toggle, or with a direct parameter.
1435 1443
1436 1444 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1437 1445 could be triggered in certain cases and cause the traceback
1438 1446 printer not to work.
1439 1447
1440 1448 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1441 1449
1442 1450 * IPython/iplib.py (_should_recompile): Small fix, closes
1443 1451 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1444 1452
1445 1453 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1446 1454
1447 1455 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1448 1456 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1449 1457 Moad for help with tracking it down.
1450 1458
1451 1459 * IPython/iplib.py (handle_auto): fix autocall handling for
1452 1460 objects which support BOTH __getitem__ and __call__ (so that f [x]
1453 1461 is left alone, instead of becoming f([x]) automatically).
1454 1462
1455 1463 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1456 1464 Ville's patch.
1457 1465
1458 1466 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1459 1467
1460 1468 * IPython/iplib.py (handle_auto): changed autocall semantics to
1461 1469 include 'smart' mode, where the autocall transformation is NOT
1462 1470 applied if there are no arguments on the line. This allows you to
1463 1471 just type 'foo' if foo is a callable to see its internal form,
1464 1472 instead of having it called with no arguments (typically a
1465 1473 mistake). The old 'full' autocall still exists: for that, you
1466 1474 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1467 1475
1468 1476 * IPython/completer.py (Completer.attr_matches): add
1469 1477 tab-completion support for Enthoughts' traits. After a report by
1470 1478 Arnd and a patch by Prabhu.
1471 1479
1472 1480 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1473 1481
1474 1482 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1475 1483 Schmolck's patch to fix inspect.getinnerframes().
1476 1484
1477 1485 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1478 1486 for embedded instances, regarding handling of namespaces and items
1479 1487 added to the __builtin__ one. Multiple embedded instances and
1480 1488 recursive embeddings should work better now (though I'm not sure
1481 1489 I've got all the corner cases fixed, that code is a bit of a brain
1482 1490 twister).
1483 1491
1484 1492 * IPython/Magic.py (magic_edit): added support to edit in-memory
1485 1493 macros (automatically creates the necessary temp files). %edit
1486 1494 also doesn't return the file contents anymore, it's just noise.
1487 1495
1488 1496 * IPython/completer.py (Completer.attr_matches): revert change to
1489 1497 complete only on attributes listed in __all__. I realized it
1490 1498 cripples the tab-completion system as a tool for exploring the
1491 1499 internals of unknown libraries (it renders any non-__all__
1492 1500 attribute off-limits). I got bit by this when trying to see
1493 1501 something inside the dis module.
1494 1502
1495 1503 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1496 1504
1497 1505 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1498 1506 namespace for users and extension writers to hold data in. This
1499 1507 follows the discussion in
1500 1508 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1501 1509
1502 1510 * IPython/completer.py (IPCompleter.complete): small patch to help
1503 1511 tab-completion under Emacs, after a suggestion by John Barnard
1504 1512 <barnarj-AT-ccf.org>.
1505 1513
1506 1514 * IPython/Magic.py (Magic.extract_input_slices): added support for
1507 1515 the slice notation in magics to use N-M to represent numbers N...M
1508 1516 (closed endpoints). This is used by %macro and %save.
1509 1517
1510 1518 * IPython/completer.py (Completer.attr_matches): for modules which
1511 1519 define __all__, complete only on those. After a patch by Jeffrey
1512 1520 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1513 1521 speed up this routine.
1514 1522
1515 1523 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1516 1524 don't know if this is the end of it, but the behavior now is
1517 1525 certainly much more correct. Note that coupled with macros,
1518 1526 slightly surprising (at first) behavior may occur: a macro will in
1519 1527 general expand to multiple lines of input, so upon exiting, the
1520 1528 in/out counters will both be bumped by the corresponding amount
1521 1529 (as if the macro's contents had been typed interactively). Typing
1522 1530 %hist will reveal the intermediate (silently processed) lines.
1523 1531
1524 1532 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1525 1533 pickle to fail (%run was overwriting __main__ and not restoring
1526 1534 it, but pickle relies on __main__ to operate).
1527 1535
1528 1536 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1529 1537 using properties, but forgot to make the main InteractiveShell
1530 1538 class a new-style class. Properties fail silently, and
1531 1539 mysteriously, with old-style class (getters work, but
1532 1540 setters don't do anything).
1533 1541
1534 1542 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1535 1543
1536 1544 * IPython/Magic.py (magic_history): fix history reporting bug (I
1537 1545 know some nasties are still there, I just can't seem to find a
1538 1546 reproducible test case to track them down; the input history is
1539 1547 falling out of sync...)
1540 1548
1541 1549 * IPython/iplib.py (handle_shell_escape): fix bug where both
1542 1550 aliases and system accesses where broken for indented code (such
1543 1551 as loops).
1544 1552
1545 1553 * IPython/genutils.py (shell): fix small but critical bug for
1546 1554 win32 system access.
1547 1555
1548 1556 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1549 1557
1550 1558 * IPython/iplib.py (showtraceback): remove use of the
1551 1559 sys.last_{type/value/traceback} structures, which are non
1552 1560 thread-safe.
1553 1561 (_prefilter): change control flow to ensure that we NEVER
1554 1562 introspect objects when autocall is off. This will guarantee that
1555 1563 having an input line of the form 'x.y', where access to attribute
1556 1564 'y' has side effects, doesn't trigger the side effect TWICE. It
1557 1565 is important to note that, with autocall on, these side effects
1558 1566 can still happen.
1559 1567 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1560 1568 trio. IPython offers these three kinds of special calls which are
1561 1569 not python code, and it's a good thing to have their call method
1562 1570 be accessible as pure python functions (not just special syntax at
1563 1571 the command line). It gives us a better internal implementation
1564 1572 structure, as well as exposing these for user scripting more
1565 1573 cleanly.
1566 1574
1567 1575 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1568 1576 file. Now that they'll be more likely to be used with the
1569 1577 persistance system (%store), I want to make sure their module path
1570 1578 doesn't change in the future, so that we don't break things for
1571 1579 users' persisted data.
1572 1580
1573 1581 * IPython/iplib.py (autoindent_update): move indentation
1574 1582 management into the _text_ processing loop, not the keyboard
1575 1583 interactive one. This is necessary to correctly process non-typed
1576 1584 multiline input (such as macros).
1577 1585
1578 1586 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1579 1587 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1580 1588 which was producing problems in the resulting manual.
1581 1589 (magic_whos): improve reporting of instances (show their class,
1582 1590 instead of simply printing 'instance' which isn't terribly
1583 1591 informative).
1584 1592
1585 1593 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1586 1594 (minor mods) to support network shares under win32.
1587 1595
1588 1596 * IPython/winconsole.py (get_console_size): add new winconsole
1589 1597 module and fixes to page_dumb() to improve its behavior under
1590 1598 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1591 1599
1592 1600 * IPython/Magic.py (Macro): simplified Macro class to just
1593 1601 subclass list. We've had only 2.2 compatibility for a very long
1594 1602 time, yet I was still avoiding subclassing the builtin types. No
1595 1603 more (I'm also starting to use properties, though I won't shift to
1596 1604 2.3-specific features quite yet).
1597 1605 (magic_store): added Ville's patch for lightweight variable
1598 1606 persistence, after a request on the user list by Matt Wilkie
1599 1607 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1600 1608 details.
1601 1609
1602 1610 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1603 1611 changed the default logfile name from 'ipython.log' to
1604 1612 'ipython_log.py'. These logs are real python files, and now that
1605 1613 we have much better multiline support, people are more likely to
1606 1614 want to use them as such. Might as well name them correctly.
1607 1615
1608 1616 * IPython/Magic.py: substantial cleanup. While we can't stop
1609 1617 using magics as mixins, due to the existing customizations 'out
1610 1618 there' which rely on the mixin naming conventions, at least I
1611 1619 cleaned out all cross-class name usage. So once we are OK with
1612 1620 breaking compatibility, the two systems can be separated.
1613 1621
1614 1622 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1615 1623 anymore, and the class is a fair bit less hideous as well. New
1616 1624 features were also introduced: timestamping of input, and logging
1617 1625 of output results. These are user-visible with the -t and -o
1618 1626 options to %logstart. Closes
1619 1627 http://www.scipy.net/roundup/ipython/issue11 and a request by
1620 1628 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1621 1629
1622 1630 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1623 1631
1624 1632 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1625 1633 better handle backslashes in paths. See the thread 'More Windows
1626 1634 questions part 2 - \/ characters revisited' on the iypthon user
1627 1635 list:
1628 1636 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1629 1637
1630 1638 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1631 1639
1632 1640 (InteractiveShell.__init__): change threaded shells to not use the
1633 1641 ipython crash handler. This was causing more problems than not,
1634 1642 as exceptions in the main thread (GUI code, typically) would
1635 1643 always show up as a 'crash', when they really weren't.
1636 1644
1637 1645 The colors and exception mode commands (%colors/%xmode) have been
1638 1646 synchronized to also take this into account, so users can get
1639 1647 verbose exceptions for their threaded code as well. I also added
1640 1648 support for activating pdb inside this exception handler as well,
1641 1649 so now GUI authors can use IPython's enhanced pdb at runtime.
1642 1650
1643 1651 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1644 1652 true by default, and add it to the shipped ipythonrc file. Since
1645 1653 this asks the user before proceeding, I think it's OK to make it
1646 1654 true by default.
1647 1655
1648 1656 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1649 1657 of the previous special-casing of input in the eval loop. I think
1650 1658 this is cleaner, as they really are commands and shouldn't have
1651 1659 a special role in the middle of the core code.
1652 1660
1653 1661 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1654 1662
1655 1663 * IPython/iplib.py (edit_syntax_error): added support for
1656 1664 automatically reopening the editor if the file had a syntax error
1657 1665 in it. Thanks to scottt who provided the patch at:
1658 1666 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1659 1667 version committed).
1660 1668
1661 1669 * IPython/iplib.py (handle_normal): add suport for multi-line
1662 1670 input with emtpy lines. This fixes
1663 1671 http://www.scipy.net/roundup/ipython/issue43 and a similar
1664 1672 discussion on the user list.
1665 1673
1666 1674 WARNING: a behavior change is necessarily introduced to support
1667 1675 blank lines: now a single blank line with whitespace does NOT
1668 1676 break the input loop, which means that when autoindent is on, by
1669 1677 default hitting return on the next (indented) line does NOT exit.
1670 1678
1671 1679 Instead, to exit a multiline input you can either have:
1672 1680
1673 1681 - TWO whitespace lines (just hit return again), or
1674 1682 - a single whitespace line of a different length than provided
1675 1683 by the autoindent (add or remove a space).
1676 1684
1677 1685 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1678 1686 module to better organize all readline-related functionality.
1679 1687 I've deleted FlexCompleter and put all completion clases here.
1680 1688
1681 1689 * IPython/iplib.py (raw_input): improve indentation management.
1682 1690 It is now possible to paste indented code with autoindent on, and
1683 1691 the code is interpreted correctly (though it still looks bad on
1684 1692 screen, due to the line-oriented nature of ipython).
1685 1693 (MagicCompleter.complete): change behavior so that a TAB key on an
1686 1694 otherwise empty line actually inserts a tab, instead of completing
1687 1695 on the entire global namespace. This makes it easier to use the
1688 1696 TAB key for indentation. After a request by Hans Meine
1689 1697 <hans_meine-AT-gmx.net>
1690 1698 (_prefilter): add support so that typing plain 'exit' or 'quit'
1691 1699 does a sensible thing. Originally I tried to deviate as little as
1692 1700 possible from the default python behavior, but even that one may
1693 1701 change in this direction (thread on python-dev to that effect).
1694 1702 Regardless, ipython should do the right thing even if CPython's
1695 1703 '>>>' prompt doesn't.
1696 1704 (InteractiveShell): removed subclassing code.InteractiveConsole
1697 1705 class. By now we'd overridden just about all of its methods: I've
1698 1706 copied the remaining two over, and now ipython is a standalone
1699 1707 class. This will provide a clearer picture for the chainsaw
1700 1708 branch refactoring.
1701 1709
1702 1710 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1703 1711
1704 1712 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1705 1713 failures for objects which break when dir() is called on them.
1706 1714
1707 1715 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1708 1716 distinct local and global namespaces in the completer API. This
1709 1717 change allows us to properly handle completion with distinct
1710 1718 scopes, including in embedded instances (this had never really
1711 1719 worked correctly).
1712 1720
1713 1721 Note: this introduces a change in the constructor for
1714 1722 MagicCompleter, as a new global_namespace parameter is now the
1715 1723 second argument (the others were bumped one position).
1716 1724
1717 1725 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1718 1726
1719 1727 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1720 1728 embedded instances (which can be done now thanks to Vivian's
1721 1729 frame-handling fixes for pdb).
1722 1730 (InteractiveShell.__init__): Fix namespace handling problem in
1723 1731 embedded instances. We were overwriting __main__ unconditionally,
1724 1732 and this should only be done for 'full' (non-embedded) IPython;
1725 1733 embedded instances must respect the caller's __main__. Thanks to
1726 1734 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1727 1735
1728 1736 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1729 1737
1730 1738 * setup.py: added download_url to setup(). This registers the
1731 1739 download address at PyPI, which is not only useful to humans
1732 1740 browsing the site, but is also picked up by setuptools (the Eggs
1733 1741 machinery). Thanks to Ville and R. Kern for the info/discussion
1734 1742 on this.
1735 1743
1736 1744 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1737 1745
1738 1746 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1739 1747 This brings a lot of nice functionality to the pdb mode, which now
1740 1748 has tab-completion, syntax highlighting, and better stack handling
1741 1749 than before. Many thanks to Vivian De Smedt
1742 1750 <vivian-AT-vdesmedt.com> for the original patches.
1743 1751
1744 1752 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1745 1753
1746 1754 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1747 1755 sequence to consistently accept the banner argument. The
1748 1756 inconsistency was tripping SAGE, thanks to Gary Zablackis
1749 1757 <gzabl-AT-yahoo.com> for the report.
1750 1758
1751 1759 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1752 1760
1753 1761 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1754 1762 Fix bug where a naked 'alias' call in the ipythonrc file would
1755 1763 cause a crash. Bug reported by Jorgen Stenarson.
1756 1764
1757 1765 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1758 1766
1759 1767 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1760 1768 startup time.
1761 1769
1762 1770 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1763 1771 instances had introduced a bug with globals in normal code. Now
1764 1772 it's working in all cases.
1765 1773
1766 1774 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1767 1775 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1768 1776 has been introduced to set the default case sensitivity of the
1769 1777 searches. Users can still select either mode at runtime on a
1770 1778 per-search basis.
1771 1779
1772 1780 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1773 1781
1774 1782 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1775 1783 attributes in wildcard searches for subclasses. Modified version
1776 1784 of a patch by Jorgen.
1777 1785
1778 1786 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1779 1787
1780 1788 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1781 1789 embedded instances. I added a user_global_ns attribute to the
1782 1790 InteractiveShell class to handle this.
1783 1791
1784 1792 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1785 1793
1786 1794 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1787 1795 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1788 1796 (reported under win32, but may happen also in other platforms).
1789 1797 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1790 1798
1791 1799 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1792 1800
1793 1801 * IPython/Magic.py (magic_psearch): new support for wildcard
1794 1802 patterns. Now, typing ?a*b will list all names which begin with a
1795 1803 and end in b, for example. The %psearch magic has full
1796 1804 docstrings. Many thanks to JΓΆrgen Stenarson
1797 1805 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1798 1806 implementing this functionality.
1799 1807
1800 1808 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1801 1809
1802 1810 * Manual: fixed long-standing annoyance of double-dashes (as in
1803 1811 --prefix=~, for example) being stripped in the HTML version. This
1804 1812 is a latex2html bug, but a workaround was provided. Many thanks
1805 1813 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1806 1814 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1807 1815 rolling. This seemingly small issue had tripped a number of users
1808 1816 when first installing, so I'm glad to see it gone.
1809 1817
1810 1818 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1811 1819
1812 1820 * IPython/Extensions/numeric_formats.py: fix missing import,
1813 1821 reported by Stephen Walton.
1814 1822
1815 1823 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1816 1824
1817 1825 * IPython/demo.py: finish demo module, fully documented now.
1818 1826
1819 1827 * IPython/genutils.py (file_read): simple little utility to read a
1820 1828 file and ensure it's closed afterwards.
1821 1829
1822 1830 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1823 1831
1824 1832 * IPython/demo.py (Demo.__init__): added support for individually
1825 1833 tagging blocks for automatic execution.
1826 1834
1827 1835 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1828 1836 syntax-highlighted python sources, requested by John.
1829 1837
1830 1838 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1831 1839
1832 1840 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1833 1841 finishing.
1834 1842
1835 1843 * IPython/genutils.py (shlex_split): moved from Magic to here,
1836 1844 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1837 1845
1838 1846 * IPython/demo.py (Demo.__init__): added support for silent
1839 1847 blocks, improved marks as regexps, docstrings written.
1840 1848 (Demo.__init__): better docstring, added support for sys.argv.
1841 1849
1842 1850 * IPython/genutils.py (marquee): little utility used by the demo
1843 1851 code, handy in general.
1844 1852
1845 1853 * IPython/demo.py (Demo.__init__): new class for interactive
1846 1854 demos. Not documented yet, I just wrote it in a hurry for
1847 1855 scipy'05. Will docstring later.
1848 1856
1849 1857 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1850 1858
1851 1859 * IPython/Shell.py (sigint_handler): Drastic simplification which
1852 1860 also seems to make Ctrl-C work correctly across threads! This is
1853 1861 so simple, that I can't beleive I'd missed it before. Needs more
1854 1862 testing, though.
1855 1863 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1856 1864 like this before...
1857 1865
1858 1866 * IPython/genutils.py (get_home_dir): add protection against
1859 1867 non-dirs in win32 registry.
1860 1868
1861 1869 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1862 1870 bug where dict was mutated while iterating (pysh crash).
1863 1871
1864 1872 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1865 1873
1866 1874 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1867 1875 spurious newlines added by this routine. After a report by
1868 1876 F. Mantegazza.
1869 1877
1870 1878 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1871 1879
1872 1880 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1873 1881 calls. These were a leftover from the GTK 1.x days, and can cause
1874 1882 problems in certain cases (after a report by John Hunter).
1875 1883
1876 1884 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1877 1885 os.getcwd() fails at init time. Thanks to patch from David Remahl
1878 1886 <chmod007-AT-mac.com>.
1879 1887 (InteractiveShell.__init__): prevent certain special magics from
1880 1888 being shadowed by aliases. Closes
1881 1889 http://www.scipy.net/roundup/ipython/issue41.
1882 1890
1883 1891 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1884 1892
1885 1893 * IPython/iplib.py (InteractiveShell.complete): Added new
1886 1894 top-level completion method to expose the completion mechanism
1887 1895 beyond readline-based environments.
1888 1896
1889 1897 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1890 1898
1891 1899 * tools/ipsvnc (svnversion): fix svnversion capture.
1892 1900
1893 1901 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1894 1902 attribute to self, which was missing. Before, it was set by a
1895 1903 routine which in certain cases wasn't being called, so the
1896 1904 instance could end up missing the attribute. This caused a crash.
1897 1905 Closes http://www.scipy.net/roundup/ipython/issue40.
1898 1906
1899 1907 2005-08-16 Fernando Perez <fperez@colorado.edu>
1900 1908
1901 1909 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1902 1910 contains non-string attribute. Closes
1903 1911 http://www.scipy.net/roundup/ipython/issue38.
1904 1912
1905 1913 2005-08-14 Fernando Perez <fperez@colorado.edu>
1906 1914
1907 1915 * tools/ipsvnc: Minor improvements, to add changeset info.
1908 1916
1909 1917 2005-08-12 Fernando Perez <fperez@colorado.edu>
1910 1918
1911 1919 * IPython/iplib.py (runsource): remove self.code_to_run_src
1912 1920 attribute. I realized this is nothing more than
1913 1921 '\n'.join(self.buffer), and having the same data in two different
1914 1922 places is just asking for synchronization bugs. This may impact
1915 1923 people who have custom exception handlers, so I need to warn
1916 1924 ipython-dev about it (F. Mantegazza may use them).
1917 1925
1918 1926 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1919 1927
1920 1928 * IPython/genutils.py: fix 2.2 compatibility (generators)
1921 1929
1922 1930 2005-07-18 Fernando Perez <fperez@colorado.edu>
1923 1931
1924 1932 * IPython/genutils.py (get_home_dir): fix to help users with
1925 1933 invalid $HOME under win32.
1926 1934
1927 1935 2005-07-17 Fernando Perez <fperez@colorado.edu>
1928 1936
1929 1937 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1930 1938 some old hacks and clean up a bit other routines; code should be
1931 1939 simpler and a bit faster.
1932 1940
1933 1941 * IPython/iplib.py (interact): removed some last-resort attempts
1934 1942 to survive broken stdout/stderr. That code was only making it
1935 1943 harder to abstract out the i/o (necessary for gui integration),
1936 1944 and the crashes it could prevent were extremely rare in practice
1937 1945 (besides being fully user-induced in a pretty violent manner).
1938 1946
1939 1947 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1940 1948 Nothing major yet, but the code is simpler to read; this should
1941 1949 make it easier to do more serious modifications in the future.
1942 1950
1943 1951 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1944 1952 which broke in .15 (thanks to a report by Ville).
1945 1953
1946 1954 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1947 1955 be quite correct, I know next to nothing about unicode). This
1948 1956 will allow unicode strings to be used in prompts, amongst other
1949 1957 cases. It also will prevent ipython from crashing when unicode
1950 1958 shows up unexpectedly in many places. If ascii encoding fails, we
1951 1959 assume utf_8. Currently the encoding is not a user-visible
1952 1960 setting, though it could be made so if there is demand for it.
1953 1961
1954 1962 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1955 1963
1956 1964 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1957 1965
1958 1966 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1959 1967
1960 1968 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1961 1969 code can work transparently for 2.2/2.3.
1962 1970
1963 1971 2005-07-16 Fernando Perez <fperez@colorado.edu>
1964 1972
1965 1973 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1966 1974 out of the color scheme table used for coloring exception
1967 1975 tracebacks. This allows user code to add new schemes at runtime.
1968 1976 This is a minimally modified version of the patch at
1969 1977 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1970 1978 for the contribution.
1971 1979
1972 1980 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1973 1981 slightly modified version of the patch in
1974 1982 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1975 1983 to remove the previous try/except solution (which was costlier).
1976 1984 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1977 1985
1978 1986 2005-06-08 Fernando Perez <fperez@colorado.edu>
1979 1987
1980 1988 * IPython/iplib.py (write/write_err): Add methods to abstract all
1981 1989 I/O a bit more.
1982 1990
1983 1991 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1984 1992 warning, reported by Aric Hagberg, fix by JD Hunter.
1985 1993
1986 1994 2005-06-02 *** Released version 0.6.15
1987 1995
1988 1996 2005-06-01 Fernando Perez <fperez@colorado.edu>
1989 1997
1990 1998 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1991 1999 tab-completion of filenames within open-quoted strings. Note that
1992 2000 this requires that in ~/.ipython/ipythonrc, users change the
1993 2001 readline delimiters configuration to read:
1994 2002
1995 2003 readline_remove_delims -/~
1996 2004
1997 2005
1998 2006 2005-05-31 *** Released version 0.6.14
1999 2007
2000 2008 2005-05-29 Fernando Perez <fperez@colorado.edu>
2001 2009
2002 2010 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2003 2011 with files not on the filesystem. Reported by Eliyahu Sandler
2004 2012 <eli@gondolin.net>
2005 2013
2006 2014 2005-05-22 Fernando Perez <fperez@colorado.edu>
2007 2015
2008 2016 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2009 2017 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2010 2018
2011 2019 2005-05-19 Fernando Perez <fperez@colorado.edu>
2012 2020
2013 2021 * IPython/iplib.py (safe_execfile): close a file which could be
2014 2022 left open (causing problems in win32, which locks open files).
2015 2023 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2016 2024
2017 2025 2005-05-18 Fernando Perez <fperez@colorado.edu>
2018 2026
2019 2027 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2020 2028 keyword arguments correctly to safe_execfile().
2021 2029
2022 2030 2005-05-13 Fernando Perez <fperez@colorado.edu>
2023 2031
2024 2032 * ipython.1: Added info about Qt to manpage, and threads warning
2025 2033 to usage page (invoked with --help).
2026 2034
2027 2035 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2028 2036 new matcher (it goes at the end of the priority list) to do
2029 2037 tab-completion on named function arguments. Submitted by George
2030 2038 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2031 2039 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2032 2040 for more details.
2033 2041
2034 2042 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2035 2043 SystemExit exceptions in the script being run. Thanks to a report
2036 2044 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2037 2045 producing very annoying behavior when running unit tests.
2038 2046
2039 2047 2005-05-12 Fernando Perez <fperez@colorado.edu>
2040 2048
2041 2049 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2042 2050 which I'd broken (again) due to a changed regexp. In the process,
2043 2051 added ';' as an escape to auto-quote the whole line without
2044 2052 splitting its arguments. Thanks to a report by Jerry McRae
2045 2053 <qrs0xyc02-AT-sneakemail.com>.
2046 2054
2047 2055 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2048 2056 possible crashes caused by a TokenError. Reported by Ed Schofield
2049 2057 <schofield-AT-ftw.at>.
2050 2058
2051 2059 2005-05-06 Fernando Perez <fperez@colorado.edu>
2052 2060
2053 2061 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2054 2062
2055 2063 2005-04-29 Fernando Perez <fperez@colorado.edu>
2056 2064
2057 2065 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2058 2066 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2059 2067 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2060 2068 which provides support for Qt interactive usage (similar to the
2061 2069 existing one for WX and GTK). This had been often requested.
2062 2070
2063 2071 2005-04-14 *** Released version 0.6.13
2064 2072
2065 2073 2005-04-08 Fernando Perez <fperez@colorado.edu>
2066 2074
2067 2075 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2068 2076 from _ofind, which gets called on almost every input line. Now,
2069 2077 we only try to get docstrings if they are actually going to be
2070 2078 used (the overhead of fetching unnecessary docstrings can be
2071 2079 noticeable for certain objects, such as Pyro proxies).
2072 2080
2073 2081 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2074 2082 for completers. For some reason I had been passing them the state
2075 2083 variable, which completers never actually need, and was in
2076 2084 conflict with the rlcompleter API. Custom completers ONLY need to
2077 2085 take the text parameter.
2078 2086
2079 2087 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2080 2088 work correctly in pysh. I've also moved all the logic which used
2081 2089 to be in pysh.py here, which will prevent problems with future
2082 2090 upgrades. However, this time I must warn users to update their
2083 2091 pysh profile to include the line
2084 2092
2085 2093 import_all IPython.Extensions.InterpreterExec
2086 2094
2087 2095 because otherwise things won't work for them. They MUST also
2088 2096 delete pysh.py and the line
2089 2097
2090 2098 execfile pysh.py
2091 2099
2092 2100 from their ipythonrc-pysh.
2093 2101
2094 2102 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2095 2103 robust in the face of objects whose dir() returns non-strings
2096 2104 (which it shouldn't, but some broken libs like ITK do). Thanks to
2097 2105 a patch by John Hunter (implemented differently, though). Also
2098 2106 minor improvements by using .extend instead of + on lists.
2099 2107
2100 2108 * pysh.py:
2101 2109
2102 2110 2005-04-06 Fernando Perez <fperez@colorado.edu>
2103 2111
2104 2112 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2105 2113 by default, so that all users benefit from it. Those who don't
2106 2114 want it can still turn it off.
2107 2115
2108 2116 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2109 2117 config file, I'd forgotten about this, so users were getting it
2110 2118 off by default.
2111 2119
2112 2120 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2113 2121 consistency. Now magics can be called in multiline statements,
2114 2122 and python variables can be expanded in magic calls via $var.
2115 2123 This makes the magic system behave just like aliases or !system
2116 2124 calls.
2117 2125
2118 2126 2005-03-28 Fernando Perez <fperez@colorado.edu>
2119 2127
2120 2128 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2121 2129 expensive string additions for building command. Add support for
2122 2130 trailing ';' when autocall is used.
2123 2131
2124 2132 2005-03-26 Fernando Perez <fperez@colorado.edu>
2125 2133
2126 2134 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2127 2135 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2128 2136 ipython.el robust against prompts with any number of spaces
2129 2137 (including 0) after the ':' character.
2130 2138
2131 2139 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2132 2140 continuation prompt, which misled users to think the line was
2133 2141 already indented. Closes debian Bug#300847, reported to me by
2134 2142 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2135 2143
2136 2144 2005-03-23 Fernando Perez <fperez@colorado.edu>
2137 2145
2138 2146 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2139 2147 properly aligned if they have embedded newlines.
2140 2148
2141 2149 * IPython/iplib.py (runlines): Add a public method to expose
2142 2150 IPython's code execution machinery, so that users can run strings
2143 2151 as if they had been typed at the prompt interactively.
2144 2152 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2145 2153 methods which can call the system shell, but with python variable
2146 2154 expansion. The three such methods are: __IPYTHON__.system,
2147 2155 .getoutput and .getoutputerror. These need to be documented in a
2148 2156 'public API' section (to be written) of the manual.
2149 2157
2150 2158 2005-03-20 Fernando Perez <fperez@colorado.edu>
2151 2159
2152 2160 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2153 2161 for custom exception handling. This is quite powerful, and it
2154 2162 allows for user-installable exception handlers which can trap
2155 2163 custom exceptions at runtime and treat them separately from
2156 2164 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2157 2165 Mantegazza <mantegazza-AT-ill.fr>.
2158 2166 (InteractiveShell.set_custom_completer): public API function to
2159 2167 add new completers at runtime.
2160 2168
2161 2169 2005-03-19 Fernando Perez <fperez@colorado.edu>
2162 2170
2163 2171 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2164 2172 allow objects which provide their docstrings via non-standard
2165 2173 mechanisms (like Pyro proxies) to still be inspected by ipython's
2166 2174 ? system.
2167 2175
2168 2176 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2169 2177 automatic capture system. I tried quite hard to make it work
2170 2178 reliably, and simply failed. I tried many combinations with the
2171 2179 subprocess module, but eventually nothing worked in all needed
2172 2180 cases (not blocking stdin for the child, duplicating stdout
2173 2181 without blocking, etc). The new %sc/%sx still do capture to these
2174 2182 magical list/string objects which make shell use much more
2175 2183 conveninent, so not all is lost.
2176 2184
2177 2185 XXX - FIX MANUAL for the change above!
2178 2186
2179 2187 (runsource): I copied code.py's runsource() into ipython to modify
2180 2188 it a bit. Now the code object and source to be executed are
2181 2189 stored in ipython. This makes this info accessible to third-party
2182 2190 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2183 2191 Mantegazza <mantegazza-AT-ill.fr>.
2184 2192
2185 2193 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2186 2194 history-search via readline (like C-p/C-n). I'd wanted this for a
2187 2195 long time, but only recently found out how to do it. For users
2188 2196 who already have their ipythonrc files made and want this, just
2189 2197 add:
2190 2198
2191 2199 readline_parse_and_bind "\e[A": history-search-backward
2192 2200 readline_parse_and_bind "\e[B": history-search-forward
2193 2201
2194 2202 2005-03-18 Fernando Perez <fperez@colorado.edu>
2195 2203
2196 2204 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2197 2205 LSString and SList classes which allow transparent conversions
2198 2206 between list mode and whitespace-separated string.
2199 2207 (magic_r): Fix recursion problem in %r.
2200 2208
2201 2209 * IPython/genutils.py (LSString): New class to be used for
2202 2210 automatic storage of the results of all alias/system calls in _o
2203 2211 and _e (stdout/err). These provide a .l/.list attribute which
2204 2212 does automatic splitting on newlines. This means that for most
2205 2213 uses, you'll never need to do capturing of output with %sc/%sx
2206 2214 anymore, since ipython keeps this always done for you. Note that
2207 2215 only the LAST results are stored, the _o/e variables are
2208 2216 overwritten on each call. If you need to save their contents
2209 2217 further, simply bind them to any other name.
2210 2218
2211 2219 2005-03-17 Fernando Perez <fperez@colorado.edu>
2212 2220
2213 2221 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2214 2222 prompt namespace handling.
2215 2223
2216 2224 2005-03-16 Fernando Perez <fperez@colorado.edu>
2217 2225
2218 2226 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2219 2227 classic prompts to be '>>> ' (final space was missing, and it
2220 2228 trips the emacs python mode).
2221 2229 (BasePrompt.__str__): Added safe support for dynamic prompt
2222 2230 strings. Now you can set your prompt string to be '$x', and the
2223 2231 value of x will be printed from your interactive namespace. The
2224 2232 interpolation syntax includes the full Itpl support, so
2225 2233 ${foo()+x+bar()} is a valid prompt string now, and the function
2226 2234 calls will be made at runtime.
2227 2235
2228 2236 2005-03-15 Fernando Perez <fperez@colorado.edu>
2229 2237
2230 2238 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2231 2239 avoid name clashes in pylab. %hist still works, it just forwards
2232 2240 the call to %history.
2233 2241
2234 2242 2005-03-02 *** Released version 0.6.12
2235 2243
2236 2244 2005-03-02 Fernando Perez <fperez@colorado.edu>
2237 2245
2238 2246 * IPython/iplib.py (handle_magic): log magic calls properly as
2239 2247 ipmagic() function calls.
2240 2248
2241 2249 * IPython/Magic.py (magic_time): Improved %time to support
2242 2250 statements and provide wall-clock as well as CPU time.
2243 2251
2244 2252 2005-02-27 Fernando Perez <fperez@colorado.edu>
2245 2253
2246 2254 * IPython/hooks.py: New hooks module, to expose user-modifiable
2247 2255 IPython functionality in a clean manner. For now only the editor
2248 2256 hook is actually written, and other thigns which I intend to turn
2249 2257 into proper hooks aren't yet there. The display and prefilter
2250 2258 stuff, for example, should be hooks. But at least now the
2251 2259 framework is in place, and the rest can be moved here with more
2252 2260 time later. IPython had had a .hooks variable for a long time for
2253 2261 this purpose, but I'd never actually used it for anything.
2254 2262
2255 2263 2005-02-26 Fernando Perez <fperez@colorado.edu>
2256 2264
2257 2265 * IPython/ipmaker.py (make_IPython): make the default ipython
2258 2266 directory be called _ipython under win32, to follow more the
2259 2267 naming peculiarities of that platform (where buggy software like
2260 2268 Visual Sourcesafe breaks with .named directories). Reported by
2261 2269 Ville Vainio.
2262 2270
2263 2271 2005-02-23 Fernando Perez <fperez@colorado.edu>
2264 2272
2265 2273 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2266 2274 auto_aliases for win32 which were causing problems. Users can
2267 2275 define the ones they personally like.
2268 2276
2269 2277 2005-02-21 Fernando Perez <fperez@colorado.edu>
2270 2278
2271 2279 * IPython/Magic.py (magic_time): new magic to time execution of
2272 2280 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2273 2281
2274 2282 2005-02-19 Fernando Perez <fperez@colorado.edu>
2275 2283
2276 2284 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2277 2285 into keys (for prompts, for example).
2278 2286
2279 2287 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2280 2288 prompts in case users want them. This introduces a small behavior
2281 2289 change: ipython does not automatically add a space to all prompts
2282 2290 anymore. To get the old prompts with a space, users should add it
2283 2291 manually to their ipythonrc file, so for example prompt_in1 should
2284 2292 now read 'In [\#]: ' instead of 'In [\#]:'.
2285 2293 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2286 2294 file) to control left-padding of secondary prompts.
2287 2295
2288 2296 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2289 2297 the profiler can't be imported. Fix for Debian, which removed
2290 2298 profile.py because of License issues. I applied a slightly
2291 2299 modified version of the original Debian patch at
2292 2300 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2293 2301
2294 2302 2005-02-17 Fernando Perez <fperez@colorado.edu>
2295 2303
2296 2304 * IPython/genutils.py (native_line_ends): Fix bug which would
2297 2305 cause improper line-ends under win32 b/c I was not opening files
2298 2306 in binary mode. Bug report and fix thanks to Ville.
2299 2307
2300 2308 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2301 2309 trying to catch spurious foo[1] autocalls. My fix actually broke
2302 2310 ',/' autoquote/call with explicit escape (bad regexp).
2303 2311
2304 2312 2005-02-15 *** Released version 0.6.11
2305 2313
2306 2314 2005-02-14 Fernando Perez <fperez@colorado.edu>
2307 2315
2308 2316 * IPython/background_jobs.py: New background job management
2309 2317 subsystem. This is implemented via a new set of classes, and
2310 2318 IPython now provides a builtin 'jobs' object for background job
2311 2319 execution. A convenience %bg magic serves as a lightweight
2312 2320 frontend for starting the more common type of calls. This was
2313 2321 inspired by discussions with B. Granger and the BackgroundCommand
2314 2322 class described in the book Python Scripting for Computational
2315 2323 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2316 2324 (although ultimately no code from this text was used, as IPython's
2317 2325 system is a separate implementation).
2318 2326
2319 2327 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2320 2328 to control the completion of single/double underscore names
2321 2329 separately. As documented in the example ipytonrc file, the
2322 2330 readline_omit__names variable can now be set to 2, to omit even
2323 2331 single underscore names. Thanks to a patch by Brian Wong
2324 2332 <BrianWong-AT-AirgoNetworks.Com>.
2325 2333 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2326 2334 be autocalled as foo([1]) if foo were callable. A problem for
2327 2335 things which are both callable and implement __getitem__.
2328 2336 (init_readline): Fix autoindentation for win32. Thanks to a patch
2329 2337 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2330 2338
2331 2339 2005-02-12 Fernando Perez <fperez@colorado.edu>
2332 2340
2333 2341 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2334 2342 which I had written long ago to sort out user error messages which
2335 2343 may occur during startup. This seemed like a good idea initially,
2336 2344 but it has proven a disaster in retrospect. I don't want to
2337 2345 change much code for now, so my fix is to set the internal 'debug'
2338 2346 flag to true everywhere, whose only job was precisely to control
2339 2347 this subsystem. This closes issue 28 (as well as avoiding all
2340 2348 sorts of strange hangups which occur from time to time).
2341 2349
2342 2350 2005-02-07 Fernando Perez <fperez@colorado.edu>
2343 2351
2344 2352 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2345 2353 previous call produced a syntax error.
2346 2354
2347 2355 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2348 2356 classes without constructor.
2349 2357
2350 2358 2005-02-06 Fernando Perez <fperez@colorado.edu>
2351 2359
2352 2360 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2353 2361 completions with the results of each matcher, so we return results
2354 2362 to the user from all namespaces. This breaks with ipython
2355 2363 tradition, but I think it's a nicer behavior. Now you get all
2356 2364 possible completions listed, from all possible namespaces (python,
2357 2365 filesystem, magics...) After a request by John Hunter
2358 2366 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2359 2367
2360 2368 2005-02-05 Fernando Perez <fperez@colorado.edu>
2361 2369
2362 2370 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2363 2371 the call had quote characters in it (the quotes were stripped).
2364 2372
2365 2373 2005-01-31 Fernando Perez <fperez@colorado.edu>
2366 2374
2367 2375 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2368 2376 Itpl.itpl() to make the code more robust against psyco
2369 2377 optimizations.
2370 2378
2371 2379 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2372 2380 of causing an exception. Quicker, cleaner.
2373 2381
2374 2382 2005-01-28 Fernando Perez <fperez@colorado.edu>
2375 2383
2376 2384 * scripts/ipython_win_post_install.py (install): hardcode
2377 2385 sys.prefix+'python.exe' as the executable path. It turns out that
2378 2386 during the post-installation run, sys.executable resolves to the
2379 2387 name of the binary installer! I should report this as a distutils
2380 2388 bug, I think. I updated the .10 release with this tiny fix, to
2381 2389 avoid annoying the lists further.
2382 2390
2383 2391 2005-01-27 *** Released version 0.6.10
2384 2392
2385 2393 2005-01-27 Fernando Perez <fperez@colorado.edu>
2386 2394
2387 2395 * IPython/numutils.py (norm): Added 'inf' as optional name for
2388 2396 L-infinity norm, included references to mathworld.com for vector
2389 2397 norm definitions.
2390 2398 (amin/amax): added amin/amax for array min/max. Similar to what
2391 2399 pylab ships with after the recent reorganization of names.
2392 2400 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2393 2401
2394 2402 * ipython.el: committed Alex's recent fixes and improvements.
2395 2403 Tested with python-mode from CVS, and it looks excellent. Since
2396 2404 python-mode hasn't released anything in a while, I'm temporarily
2397 2405 putting a copy of today's CVS (v 4.70) of python-mode in:
2398 2406 http://ipython.scipy.org/tmp/python-mode.el
2399 2407
2400 2408 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2401 2409 sys.executable for the executable name, instead of assuming it's
2402 2410 called 'python.exe' (the post-installer would have produced broken
2403 2411 setups on systems with a differently named python binary).
2404 2412
2405 2413 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2406 2414 references to os.linesep, to make the code more
2407 2415 platform-independent. This is also part of the win32 coloring
2408 2416 fixes.
2409 2417
2410 2418 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2411 2419 lines, which actually cause coloring bugs because the length of
2412 2420 the line is very difficult to correctly compute with embedded
2413 2421 escapes. This was the source of all the coloring problems under
2414 2422 Win32. I think that _finally_, Win32 users have a properly
2415 2423 working ipython in all respects. This would never have happened
2416 2424 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2417 2425
2418 2426 2005-01-26 *** Released version 0.6.9
2419 2427
2420 2428 2005-01-25 Fernando Perez <fperez@colorado.edu>
2421 2429
2422 2430 * setup.py: finally, we have a true Windows installer, thanks to
2423 2431 the excellent work of Viktor Ransmayr
2424 2432 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2425 2433 Windows users. The setup routine is quite a bit cleaner thanks to
2426 2434 this, and the post-install script uses the proper functions to
2427 2435 allow a clean de-installation using the standard Windows Control
2428 2436 Panel.
2429 2437
2430 2438 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2431 2439 environment variable under all OSes (including win32) if
2432 2440 available. This will give consistency to win32 users who have set
2433 2441 this variable for any reason. If os.environ['HOME'] fails, the
2434 2442 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2435 2443
2436 2444 2005-01-24 Fernando Perez <fperez@colorado.edu>
2437 2445
2438 2446 * IPython/numutils.py (empty_like): add empty_like(), similar to
2439 2447 zeros_like() but taking advantage of the new empty() Numeric routine.
2440 2448
2441 2449 2005-01-23 *** Released version 0.6.8
2442 2450
2443 2451 2005-01-22 Fernando Perez <fperez@colorado.edu>
2444 2452
2445 2453 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2446 2454 automatic show() calls. After discussing things with JDH, it
2447 2455 turns out there are too many corner cases where this can go wrong.
2448 2456 It's best not to try to be 'too smart', and simply have ipython
2449 2457 reproduce as much as possible the default behavior of a normal
2450 2458 python shell.
2451 2459
2452 2460 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2453 2461 line-splitting regexp and _prefilter() to avoid calling getattr()
2454 2462 on assignments. This closes
2455 2463 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2456 2464 readline uses getattr(), so a simple <TAB> keypress is still
2457 2465 enough to trigger getattr() calls on an object.
2458 2466
2459 2467 2005-01-21 Fernando Perez <fperez@colorado.edu>
2460 2468
2461 2469 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2462 2470 docstring under pylab so it doesn't mask the original.
2463 2471
2464 2472 2005-01-21 *** Released version 0.6.7
2465 2473
2466 2474 2005-01-21 Fernando Perez <fperez@colorado.edu>
2467 2475
2468 2476 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2469 2477 signal handling for win32 users in multithreaded mode.
2470 2478
2471 2479 2005-01-17 Fernando Perez <fperez@colorado.edu>
2472 2480
2473 2481 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2474 2482 instances with no __init__. After a crash report by Norbert Nemec
2475 2483 <Norbert-AT-nemec-online.de>.
2476 2484
2477 2485 2005-01-14 Fernando Perez <fperez@colorado.edu>
2478 2486
2479 2487 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2480 2488 names for verbose exceptions, when multiple dotted names and the
2481 2489 'parent' object were present on the same line.
2482 2490
2483 2491 2005-01-11 Fernando Perez <fperez@colorado.edu>
2484 2492
2485 2493 * IPython/genutils.py (flag_calls): new utility to trap and flag
2486 2494 calls in functions. I need it to clean up matplotlib support.
2487 2495 Also removed some deprecated code in genutils.
2488 2496
2489 2497 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2490 2498 that matplotlib scripts called with %run, which don't call show()
2491 2499 themselves, still have their plotting windows open.
2492 2500
2493 2501 2005-01-05 Fernando Perez <fperez@colorado.edu>
2494 2502
2495 2503 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2496 2504 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2497 2505
2498 2506 2004-12-19 Fernando Perez <fperez@colorado.edu>
2499 2507
2500 2508 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2501 2509 parent_runcode, which was an eyesore. The same result can be
2502 2510 obtained with Python's regular superclass mechanisms.
2503 2511
2504 2512 2004-12-17 Fernando Perez <fperez@colorado.edu>
2505 2513
2506 2514 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2507 2515 reported by Prabhu.
2508 2516 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2509 2517 sys.stderr) instead of explicitly calling sys.stderr. This helps
2510 2518 maintain our I/O abstractions clean, for future GUI embeddings.
2511 2519
2512 2520 * IPython/genutils.py (info): added new utility for sys.stderr
2513 2521 unified info message handling (thin wrapper around warn()).
2514 2522
2515 2523 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2516 2524 composite (dotted) names on verbose exceptions.
2517 2525 (VerboseTB.nullrepr): harden against another kind of errors which
2518 2526 Python's inspect module can trigger, and which were crashing
2519 2527 IPython. Thanks to a report by Marco Lombardi
2520 2528 <mlombard-AT-ma010192.hq.eso.org>.
2521 2529
2522 2530 2004-12-13 *** Released version 0.6.6
2523 2531
2524 2532 2004-12-12 Fernando Perez <fperez@colorado.edu>
2525 2533
2526 2534 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2527 2535 generated by pygtk upon initialization if it was built without
2528 2536 threads (for matplotlib users). After a crash reported by
2529 2537 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2530 2538
2531 2539 * IPython/ipmaker.py (make_IPython): fix small bug in the
2532 2540 import_some parameter for multiple imports.
2533 2541
2534 2542 * IPython/iplib.py (ipmagic): simplified the interface of
2535 2543 ipmagic() to take a single string argument, just as it would be
2536 2544 typed at the IPython cmd line.
2537 2545 (ipalias): Added new ipalias() with an interface identical to
2538 2546 ipmagic(). This completes exposing a pure python interface to the
2539 2547 alias and magic system, which can be used in loops or more complex
2540 2548 code where IPython's automatic line mangling is not active.
2541 2549
2542 2550 * IPython/genutils.py (timing): changed interface of timing to
2543 2551 simply run code once, which is the most common case. timings()
2544 2552 remains unchanged, for the cases where you want multiple runs.
2545 2553
2546 2554 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2547 2555 bug where Python2.2 crashes with exec'ing code which does not end
2548 2556 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2549 2557 before.
2550 2558
2551 2559 2004-12-10 Fernando Perez <fperez@colorado.edu>
2552 2560
2553 2561 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2554 2562 -t to -T, to accomodate the new -t flag in %run (the %run and
2555 2563 %prun options are kind of intermixed, and it's not easy to change
2556 2564 this with the limitations of python's getopt).
2557 2565
2558 2566 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2559 2567 the execution of scripts. It's not as fine-tuned as timeit.py,
2560 2568 but it works from inside ipython (and under 2.2, which lacks
2561 2569 timeit.py). Optionally a number of runs > 1 can be given for
2562 2570 timing very short-running code.
2563 2571
2564 2572 * IPython/genutils.py (uniq_stable): new routine which returns a
2565 2573 list of unique elements in any iterable, but in stable order of
2566 2574 appearance. I needed this for the ultraTB fixes, and it's a handy
2567 2575 utility.
2568 2576
2569 2577 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2570 2578 dotted names in Verbose exceptions. This had been broken since
2571 2579 the very start, now x.y will properly be printed in a Verbose
2572 2580 traceback, instead of x being shown and y appearing always as an
2573 2581 'undefined global'. Getting this to work was a bit tricky,
2574 2582 because by default python tokenizers are stateless. Saved by
2575 2583 python's ability to easily add a bit of state to an arbitrary
2576 2584 function (without needing to build a full-blown callable object).
2577 2585
2578 2586 Also big cleanup of this code, which had horrendous runtime
2579 2587 lookups of zillions of attributes for colorization. Moved all
2580 2588 this code into a few templates, which make it cleaner and quicker.
2581 2589
2582 2590 Printout quality was also improved for Verbose exceptions: one
2583 2591 variable per line, and memory addresses are printed (this can be
2584 2592 quite handy in nasty debugging situations, which is what Verbose
2585 2593 is for).
2586 2594
2587 2595 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2588 2596 the command line as scripts to be loaded by embedded instances.
2589 2597 Doing so has the potential for an infinite recursion if there are
2590 2598 exceptions thrown in the process. This fixes a strange crash
2591 2599 reported by Philippe MULLER <muller-AT-irit.fr>.
2592 2600
2593 2601 2004-12-09 Fernando Perez <fperez@colorado.edu>
2594 2602
2595 2603 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2596 2604 to reflect new names in matplotlib, which now expose the
2597 2605 matlab-compatible interface via a pylab module instead of the
2598 2606 'matlab' name. The new code is backwards compatible, so users of
2599 2607 all matplotlib versions are OK. Patch by J. Hunter.
2600 2608
2601 2609 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2602 2610 of __init__ docstrings for instances (class docstrings are already
2603 2611 automatically printed). Instances with customized docstrings
2604 2612 (indep. of the class) are also recognized and all 3 separate
2605 2613 docstrings are printed (instance, class, constructor). After some
2606 2614 comments/suggestions by J. Hunter.
2607 2615
2608 2616 2004-12-05 Fernando Perez <fperez@colorado.edu>
2609 2617
2610 2618 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2611 2619 warnings when tab-completion fails and triggers an exception.
2612 2620
2613 2621 2004-12-03 Fernando Perez <fperez@colorado.edu>
2614 2622
2615 2623 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2616 2624 be triggered when using 'run -p'. An incorrect option flag was
2617 2625 being set ('d' instead of 'D').
2618 2626 (manpage): fix missing escaped \- sign.
2619 2627
2620 2628 2004-11-30 *** Released version 0.6.5
2621 2629
2622 2630 2004-11-30 Fernando Perez <fperez@colorado.edu>
2623 2631
2624 2632 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2625 2633 setting with -d option.
2626 2634
2627 2635 * setup.py (docfiles): Fix problem where the doc glob I was using
2628 2636 was COMPLETELY BROKEN. It was giving the right files by pure
2629 2637 accident, but failed once I tried to include ipython.el. Note:
2630 2638 glob() does NOT allow you to do exclusion on multiple endings!
2631 2639
2632 2640 2004-11-29 Fernando Perez <fperez@colorado.edu>
2633 2641
2634 2642 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2635 2643 the manpage as the source. Better formatting & consistency.
2636 2644
2637 2645 * IPython/Magic.py (magic_run): Added new -d option, to run
2638 2646 scripts under the control of the python pdb debugger. Note that
2639 2647 this required changing the %prun option -d to -D, to avoid a clash
2640 2648 (since %run must pass options to %prun, and getopt is too dumb to
2641 2649 handle options with string values with embedded spaces). Thanks
2642 2650 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2643 2651 (magic_who_ls): added type matching to %who and %whos, so that one
2644 2652 can filter their output to only include variables of certain
2645 2653 types. Another suggestion by Matthew.
2646 2654 (magic_whos): Added memory summaries in kb and Mb for arrays.
2647 2655 (magic_who): Improve formatting (break lines every 9 vars).
2648 2656
2649 2657 2004-11-28 Fernando Perez <fperez@colorado.edu>
2650 2658
2651 2659 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2652 2660 cache when empty lines were present.
2653 2661
2654 2662 2004-11-24 Fernando Perez <fperez@colorado.edu>
2655 2663
2656 2664 * IPython/usage.py (__doc__): document the re-activated threading
2657 2665 options for WX and GTK.
2658 2666
2659 2667 2004-11-23 Fernando Perez <fperez@colorado.edu>
2660 2668
2661 2669 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2662 2670 the -wthread and -gthread options, along with a new -tk one to try
2663 2671 and coordinate Tk threading with wx/gtk. The tk support is very
2664 2672 platform dependent, since it seems to require Tcl and Tk to be
2665 2673 built with threads (Fedora1/2 appears NOT to have it, but in
2666 2674 Prabhu's Debian boxes it works OK). But even with some Tk
2667 2675 limitations, this is a great improvement.
2668 2676
2669 2677 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2670 2678 info in user prompts. Patch by Prabhu.
2671 2679
2672 2680 2004-11-18 Fernando Perez <fperez@colorado.edu>
2673 2681
2674 2682 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2675 2683 EOFErrors and bail, to avoid infinite loops if a non-terminating
2676 2684 file is fed into ipython. Patch submitted in issue 19 by user,
2677 2685 many thanks.
2678 2686
2679 2687 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2680 2688 autoquote/parens in continuation prompts, which can cause lots of
2681 2689 problems. Closes roundup issue 20.
2682 2690
2683 2691 2004-11-17 Fernando Perez <fperez@colorado.edu>
2684 2692
2685 2693 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2686 2694 reported as debian bug #280505. I'm not sure my local changelog
2687 2695 entry has the proper debian format (Jack?).
2688 2696
2689 2697 2004-11-08 *** Released version 0.6.4
2690 2698
2691 2699 2004-11-08 Fernando Perez <fperez@colorado.edu>
2692 2700
2693 2701 * IPython/iplib.py (init_readline): Fix exit message for Windows
2694 2702 when readline is active. Thanks to a report by Eric Jones
2695 2703 <eric-AT-enthought.com>.
2696 2704
2697 2705 2004-11-07 Fernando Perez <fperez@colorado.edu>
2698 2706
2699 2707 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2700 2708 sometimes seen by win2k/cygwin users.
2701 2709
2702 2710 2004-11-06 Fernando Perez <fperez@colorado.edu>
2703 2711
2704 2712 * IPython/iplib.py (interact): Change the handling of %Exit from
2705 2713 trying to propagate a SystemExit to an internal ipython flag.
2706 2714 This is less elegant than using Python's exception mechanism, but
2707 2715 I can't get that to work reliably with threads, so under -pylab
2708 2716 %Exit was hanging IPython. Cross-thread exception handling is
2709 2717 really a bitch. Thaks to a bug report by Stephen Walton
2710 2718 <stephen.walton-AT-csun.edu>.
2711 2719
2712 2720 2004-11-04 Fernando Perez <fperez@colorado.edu>
2713 2721
2714 2722 * IPython/iplib.py (raw_input_original): store a pointer to the
2715 2723 true raw_input to harden against code which can modify it
2716 2724 (wx.py.PyShell does this and would otherwise crash ipython).
2717 2725 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2718 2726
2719 2727 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2720 2728 Ctrl-C problem, which does not mess up the input line.
2721 2729
2722 2730 2004-11-03 Fernando Perez <fperez@colorado.edu>
2723 2731
2724 2732 * IPython/Release.py: Changed licensing to BSD, in all files.
2725 2733 (name): lowercase name for tarball/RPM release.
2726 2734
2727 2735 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2728 2736 use throughout ipython.
2729 2737
2730 2738 * IPython/Magic.py (Magic._ofind): Switch to using the new
2731 2739 OInspect.getdoc() function.
2732 2740
2733 2741 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2734 2742 of the line currently being canceled via Ctrl-C. It's extremely
2735 2743 ugly, but I don't know how to do it better (the problem is one of
2736 2744 handling cross-thread exceptions).
2737 2745
2738 2746 2004-10-28 Fernando Perez <fperez@colorado.edu>
2739 2747
2740 2748 * IPython/Shell.py (signal_handler): add signal handlers to trap
2741 2749 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2742 2750 report by Francesc Alted.
2743 2751
2744 2752 2004-10-21 Fernando Perez <fperez@colorado.edu>
2745 2753
2746 2754 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2747 2755 to % for pysh syntax extensions.
2748 2756
2749 2757 2004-10-09 Fernando Perez <fperez@colorado.edu>
2750 2758
2751 2759 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2752 2760 arrays to print a more useful summary, without calling str(arr).
2753 2761 This avoids the problem of extremely lengthy computations which
2754 2762 occur if arr is large, and appear to the user as a system lockup
2755 2763 with 100% cpu activity. After a suggestion by Kristian Sandberg
2756 2764 <Kristian.Sandberg@colorado.edu>.
2757 2765 (Magic.__init__): fix bug in global magic escapes not being
2758 2766 correctly set.
2759 2767
2760 2768 2004-10-08 Fernando Perez <fperez@colorado.edu>
2761 2769
2762 2770 * IPython/Magic.py (__license__): change to absolute imports of
2763 2771 ipython's own internal packages, to start adapting to the absolute
2764 2772 import requirement of PEP-328.
2765 2773
2766 2774 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2767 2775 files, and standardize author/license marks through the Release
2768 2776 module instead of having per/file stuff (except for files with
2769 2777 particular licenses, like the MIT/PSF-licensed codes).
2770 2778
2771 2779 * IPython/Debugger.py: remove dead code for python 2.1
2772 2780
2773 2781 2004-10-04 Fernando Perez <fperez@colorado.edu>
2774 2782
2775 2783 * IPython/iplib.py (ipmagic): New function for accessing magics
2776 2784 via a normal python function call.
2777 2785
2778 2786 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2779 2787 from '@' to '%', to accomodate the new @decorator syntax of python
2780 2788 2.4.
2781 2789
2782 2790 2004-09-29 Fernando Perez <fperez@colorado.edu>
2783 2791
2784 2792 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2785 2793 matplotlib.use to prevent running scripts which try to switch
2786 2794 interactive backends from within ipython. This will just crash
2787 2795 the python interpreter, so we can't allow it (but a detailed error
2788 2796 is given to the user).
2789 2797
2790 2798 2004-09-28 Fernando Perez <fperez@colorado.edu>
2791 2799
2792 2800 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2793 2801 matplotlib-related fixes so that using @run with non-matplotlib
2794 2802 scripts doesn't pop up spurious plot windows. This requires
2795 2803 matplotlib >= 0.63, where I had to make some changes as well.
2796 2804
2797 2805 * IPython/ipmaker.py (make_IPython): update version requirement to
2798 2806 python 2.2.
2799 2807
2800 2808 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2801 2809 banner arg for embedded customization.
2802 2810
2803 2811 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2804 2812 explicit uses of __IP as the IPython's instance name. Now things
2805 2813 are properly handled via the shell.name value. The actual code
2806 2814 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2807 2815 is much better than before. I'll clean things completely when the
2808 2816 magic stuff gets a real overhaul.
2809 2817
2810 2818 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2811 2819 minor changes to debian dir.
2812 2820
2813 2821 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2814 2822 pointer to the shell itself in the interactive namespace even when
2815 2823 a user-supplied dict is provided. This is needed for embedding
2816 2824 purposes (found by tests with Michel Sanner).
2817 2825
2818 2826 2004-09-27 Fernando Perez <fperez@colorado.edu>
2819 2827
2820 2828 * IPython/UserConfig/ipythonrc: remove []{} from
2821 2829 readline_remove_delims, so that things like [modname.<TAB> do
2822 2830 proper completion. This disables [].TAB, but that's a less common
2823 2831 case than module names in list comprehensions, for example.
2824 2832 Thanks to a report by Andrea Riciputi.
2825 2833
2826 2834 2004-09-09 Fernando Perez <fperez@colorado.edu>
2827 2835
2828 2836 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2829 2837 blocking problems in win32 and osx. Fix by John.
2830 2838
2831 2839 2004-09-08 Fernando Perez <fperez@colorado.edu>
2832 2840
2833 2841 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2834 2842 for Win32 and OSX. Fix by John Hunter.
2835 2843
2836 2844 2004-08-30 *** Released version 0.6.3
2837 2845
2838 2846 2004-08-30 Fernando Perez <fperez@colorado.edu>
2839 2847
2840 2848 * setup.py (isfile): Add manpages to list of dependent files to be
2841 2849 updated.
2842 2850
2843 2851 2004-08-27 Fernando Perez <fperez@colorado.edu>
2844 2852
2845 2853 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2846 2854 for now. They don't really work with standalone WX/GTK code
2847 2855 (though matplotlib IS working fine with both of those backends).
2848 2856 This will neeed much more testing. I disabled most things with
2849 2857 comments, so turning it back on later should be pretty easy.
2850 2858
2851 2859 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2852 2860 autocalling of expressions like r'foo', by modifying the line
2853 2861 split regexp. Closes
2854 2862 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2855 2863 Riley <ipythonbugs-AT-sabi.net>.
2856 2864 (InteractiveShell.mainloop): honor --nobanner with banner
2857 2865 extensions.
2858 2866
2859 2867 * IPython/Shell.py: Significant refactoring of all classes, so
2860 2868 that we can really support ALL matplotlib backends and threading
2861 2869 models (John spotted a bug with Tk which required this). Now we
2862 2870 should support single-threaded, WX-threads and GTK-threads, both
2863 2871 for generic code and for matplotlib.
2864 2872
2865 2873 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2866 2874 -pylab, to simplify things for users. Will also remove the pylab
2867 2875 profile, since now all of matplotlib configuration is directly
2868 2876 handled here. This also reduces startup time.
2869 2877
2870 2878 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2871 2879 shell wasn't being correctly called. Also in IPShellWX.
2872 2880
2873 2881 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2874 2882 fine-tune banner.
2875 2883
2876 2884 * IPython/numutils.py (spike): Deprecate these spike functions,
2877 2885 delete (long deprecated) gnuplot_exec handler.
2878 2886
2879 2887 2004-08-26 Fernando Perez <fperez@colorado.edu>
2880 2888
2881 2889 * ipython.1: Update for threading options, plus some others which
2882 2890 were missing.
2883 2891
2884 2892 * IPython/ipmaker.py (__call__): Added -wthread option for
2885 2893 wxpython thread handling. Make sure threading options are only
2886 2894 valid at the command line.
2887 2895
2888 2896 * scripts/ipython: moved shell selection into a factory function
2889 2897 in Shell.py, to keep the starter script to a minimum.
2890 2898
2891 2899 2004-08-25 Fernando Perez <fperez@colorado.edu>
2892 2900
2893 2901 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2894 2902 John. Along with some recent changes he made to matplotlib, the
2895 2903 next versions of both systems should work very well together.
2896 2904
2897 2905 2004-08-24 Fernando Perez <fperez@colorado.edu>
2898 2906
2899 2907 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2900 2908 tried to switch the profiling to using hotshot, but I'm getting
2901 2909 strange errors from prof.runctx() there. I may be misreading the
2902 2910 docs, but it looks weird. For now the profiling code will
2903 2911 continue to use the standard profiler.
2904 2912
2905 2913 2004-08-23 Fernando Perez <fperez@colorado.edu>
2906 2914
2907 2915 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2908 2916 threaded shell, by John Hunter. It's not quite ready yet, but
2909 2917 close.
2910 2918
2911 2919 2004-08-22 Fernando Perez <fperez@colorado.edu>
2912 2920
2913 2921 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2914 2922 in Magic and ultraTB.
2915 2923
2916 2924 * ipython.1: document threading options in manpage.
2917 2925
2918 2926 * scripts/ipython: Changed name of -thread option to -gthread,
2919 2927 since this is GTK specific. I want to leave the door open for a
2920 2928 -wthread option for WX, which will most likely be necessary. This
2921 2929 change affects usage and ipmaker as well.
2922 2930
2923 2931 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2924 2932 handle the matplotlib shell issues. Code by John Hunter
2925 2933 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2926 2934 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2927 2935 broken (and disabled for end users) for now, but it puts the
2928 2936 infrastructure in place.
2929 2937
2930 2938 2004-08-21 Fernando Perez <fperez@colorado.edu>
2931 2939
2932 2940 * ipythonrc-pylab: Add matplotlib support.
2933 2941
2934 2942 * matplotlib_config.py: new files for matplotlib support, part of
2935 2943 the pylab profile.
2936 2944
2937 2945 * IPython/usage.py (__doc__): documented the threading options.
2938 2946
2939 2947 2004-08-20 Fernando Perez <fperez@colorado.edu>
2940 2948
2941 2949 * ipython: Modified the main calling routine to handle the -thread
2942 2950 and -mpthread options. This needs to be done as a top-level hack,
2943 2951 because it determines which class to instantiate for IPython
2944 2952 itself.
2945 2953
2946 2954 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2947 2955 classes to support multithreaded GTK operation without blocking,
2948 2956 and matplotlib with all backends. This is a lot of still very
2949 2957 experimental code, and threads are tricky. So it may still have a
2950 2958 few rough edges... This code owes a lot to
2951 2959 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2952 2960 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2953 2961 to John Hunter for all the matplotlib work.
2954 2962
2955 2963 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2956 2964 options for gtk thread and matplotlib support.
2957 2965
2958 2966 2004-08-16 Fernando Perez <fperez@colorado.edu>
2959 2967
2960 2968 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2961 2969 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2962 2970 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2963 2971
2964 2972 2004-08-11 Fernando Perez <fperez@colorado.edu>
2965 2973
2966 2974 * setup.py (isfile): Fix build so documentation gets updated for
2967 2975 rpms (it was only done for .tgz builds).
2968 2976
2969 2977 2004-08-10 Fernando Perez <fperez@colorado.edu>
2970 2978
2971 2979 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2972 2980
2973 2981 * iplib.py : Silence syntax error exceptions in tab-completion.
2974 2982
2975 2983 2004-08-05 Fernando Perez <fperez@colorado.edu>
2976 2984
2977 2985 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2978 2986 'color off' mark for continuation prompts. This was causing long
2979 2987 continuation lines to mis-wrap.
2980 2988
2981 2989 2004-08-01 Fernando Perez <fperez@colorado.edu>
2982 2990
2983 2991 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2984 2992 for building ipython to be a parameter. All this is necessary
2985 2993 right now to have a multithreaded version, but this insane
2986 2994 non-design will be cleaned up soon. For now, it's a hack that
2987 2995 works.
2988 2996
2989 2997 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2990 2998 args in various places. No bugs so far, but it's a dangerous
2991 2999 practice.
2992 3000
2993 3001 2004-07-31 Fernando Perez <fperez@colorado.edu>
2994 3002
2995 3003 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2996 3004 fix completion of files with dots in their names under most
2997 3005 profiles (pysh was OK because the completion order is different).
2998 3006
2999 3007 2004-07-27 Fernando Perez <fperez@colorado.edu>
3000 3008
3001 3009 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3002 3010 keywords manually, b/c the one in keyword.py was removed in python
3003 3011 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3004 3012 This is NOT a bug under python 2.3 and earlier.
3005 3013
3006 3014 2004-07-26 Fernando Perez <fperez@colorado.edu>
3007 3015
3008 3016 * IPython/ultraTB.py (VerboseTB.text): Add another
3009 3017 linecache.checkcache() call to try to prevent inspect.py from
3010 3018 crashing under python 2.3. I think this fixes
3011 3019 http://www.scipy.net/roundup/ipython/issue17.
3012 3020
3013 3021 2004-07-26 *** Released version 0.6.2
3014 3022
3015 3023 2004-07-26 Fernando Perez <fperez@colorado.edu>
3016 3024
3017 3025 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3018 3026 fail for any number.
3019 3027 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3020 3028 empty bookmarks.
3021 3029
3022 3030 2004-07-26 *** Released version 0.6.1
3023 3031
3024 3032 2004-07-26 Fernando Perez <fperez@colorado.edu>
3025 3033
3026 3034 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3027 3035
3028 3036 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3029 3037 escaping '()[]{}' in filenames.
3030 3038
3031 3039 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3032 3040 Python 2.2 users who lack a proper shlex.split.
3033 3041
3034 3042 2004-07-19 Fernando Perez <fperez@colorado.edu>
3035 3043
3036 3044 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3037 3045 for reading readline's init file. I follow the normal chain:
3038 3046 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3039 3047 report by Mike Heeter. This closes
3040 3048 http://www.scipy.net/roundup/ipython/issue16.
3041 3049
3042 3050 2004-07-18 Fernando Perez <fperez@colorado.edu>
3043 3051
3044 3052 * IPython/iplib.py (__init__): Add better handling of '\' under
3045 3053 Win32 for filenames. After a patch by Ville.
3046 3054
3047 3055 2004-07-17 Fernando Perez <fperez@colorado.edu>
3048 3056
3049 3057 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3050 3058 autocalling would be triggered for 'foo is bar' if foo is
3051 3059 callable. I also cleaned up the autocall detection code to use a
3052 3060 regexp, which is faster. Bug reported by Alexander Schmolck.
3053 3061
3054 3062 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3055 3063 '?' in them would confuse the help system. Reported by Alex
3056 3064 Schmolck.
3057 3065
3058 3066 2004-07-16 Fernando Perez <fperez@colorado.edu>
3059 3067
3060 3068 * IPython/GnuplotInteractive.py (__all__): added plot2.
3061 3069
3062 3070 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3063 3071 plotting dictionaries, lists or tuples of 1d arrays.
3064 3072
3065 3073 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3066 3074 optimizations.
3067 3075
3068 3076 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3069 3077 the information which was there from Janko's original IPP code:
3070 3078
3071 3079 03.05.99 20:53 porto.ifm.uni-kiel.de
3072 3080 --Started changelog.
3073 3081 --make clear do what it say it does
3074 3082 --added pretty output of lines from inputcache
3075 3083 --Made Logger a mixin class, simplifies handling of switches
3076 3084 --Added own completer class. .string<TAB> expands to last history
3077 3085 line which starts with string. The new expansion is also present
3078 3086 with Ctrl-r from the readline library. But this shows, who this
3079 3087 can be done for other cases.
3080 3088 --Added convention that all shell functions should accept a
3081 3089 parameter_string This opens the door for different behaviour for
3082 3090 each function. @cd is a good example of this.
3083 3091
3084 3092 04.05.99 12:12 porto.ifm.uni-kiel.de
3085 3093 --added logfile rotation
3086 3094 --added new mainloop method which freezes first the namespace
3087 3095
3088 3096 07.05.99 21:24 porto.ifm.uni-kiel.de
3089 3097 --added the docreader classes. Now there is a help system.
3090 3098 -This is only a first try. Currently it's not easy to put new
3091 3099 stuff in the indices. But this is the way to go. Info would be
3092 3100 better, but HTML is every where and not everybody has an info
3093 3101 system installed and it's not so easy to change html-docs to info.
3094 3102 --added global logfile option
3095 3103 --there is now a hook for object inspection method pinfo needs to
3096 3104 be provided for this. Can be reached by two '??'.
3097 3105
3098 3106 08.05.99 20:51 porto.ifm.uni-kiel.de
3099 3107 --added a README
3100 3108 --bug in rc file. Something has changed so functions in the rc
3101 3109 file need to reference the shell and not self. Not clear if it's a
3102 3110 bug or feature.
3103 3111 --changed rc file for new behavior
3104 3112
3105 3113 2004-07-15 Fernando Perez <fperez@colorado.edu>
3106 3114
3107 3115 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3108 3116 cache was falling out of sync in bizarre manners when multi-line
3109 3117 input was present. Minor optimizations and cleanup.
3110 3118
3111 3119 (Logger): Remove old Changelog info for cleanup. This is the
3112 3120 information which was there from Janko's original code:
3113 3121
3114 3122 Changes to Logger: - made the default log filename a parameter
3115 3123
3116 3124 - put a check for lines beginning with !@? in log(). Needed
3117 3125 (even if the handlers properly log their lines) for mid-session
3118 3126 logging activation to work properly. Without this, lines logged
3119 3127 in mid session, which get read from the cache, would end up
3120 3128 'bare' (with !@? in the open) in the log. Now they are caught
3121 3129 and prepended with a #.
3122 3130
3123 3131 * IPython/iplib.py (InteractiveShell.init_readline): added check
3124 3132 in case MagicCompleter fails to be defined, so we don't crash.
3125 3133
3126 3134 2004-07-13 Fernando Perez <fperez@colorado.edu>
3127 3135
3128 3136 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3129 3137 of EPS if the requested filename ends in '.eps'.
3130 3138
3131 3139 2004-07-04 Fernando Perez <fperez@colorado.edu>
3132 3140
3133 3141 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3134 3142 escaping of quotes when calling the shell.
3135 3143
3136 3144 2004-07-02 Fernando Perez <fperez@colorado.edu>
3137 3145
3138 3146 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3139 3147 gettext not working because we were clobbering '_'. Fixes
3140 3148 http://www.scipy.net/roundup/ipython/issue6.
3141 3149
3142 3150 2004-07-01 Fernando Perez <fperez@colorado.edu>
3143 3151
3144 3152 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3145 3153 into @cd. Patch by Ville.
3146 3154
3147 3155 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3148 3156 new function to store things after ipmaker runs. Patch by Ville.
3149 3157 Eventually this will go away once ipmaker is removed and the class
3150 3158 gets cleaned up, but for now it's ok. Key functionality here is
3151 3159 the addition of the persistent storage mechanism, a dict for
3152 3160 keeping data across sessions (for now just bookmarks, but more can
3153 3161 be implemented later).
3154 3162
3155 3163 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3156 3164 persistent across sections. Patch by Ville, I modified it
3157 3165 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3158 3166 added a '-l' option to list all bookmarks.
3159 3167
3160 3168 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3161 3169 center for cleanup. Registered with atexit.register(). I moved
3162 3170 here the old exit_cleanup(). After a patch by Ville.
3163 3171
3164 3172 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3165 3173 characters in the hacked shlex_split for python 2.2.
3166 3174
3167 3175 * IPython/iplib.py (file_matches): more fixes to filenames with
3168 3176 whitespace in them. It's not perfect, but limitations in python's
3169 3177 readline make it impossible to go further.
3170 3178
3171 3179 2004-06-29 Fernando Perez <fperez@colorado.edu>
3172 3180
3173 3181 * IPython/iplib.py (file_matches): escape whitespace correctly in
3174 3182 filename completions. Bug reported by Ville.
3175 3183
3176 3184 2004-06-28 Fernando Perez <fperez@colorado.edu>
3177 3185
3178 3186 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3179 3187 the history file will be called 'history-PROFNAME' (or just
3180 3188 'history' if no profile is loaded). I was getting annoyed at
3181 3189 getting my Numerical work history clobbered by pysh sessions.
3182 3190
3183 3191 * IPython/iplib.py (InteractiveShell.__init__): Internal
3184 3192 getoutputerror() function so that we can honor the system_verbose
3185 3193 flag for _all_ system calls. I also added escaping of #
3186 3194 characters here to avoid confusing Itpl.
3187 3195
3188 3196 * IPython/Magic.py (shlex_split): removed call to shell in
3189 3197 parse_options and replaced it with shlex.split(). The annoying
3190 3198 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3191 3199 to backport it from 2.3, with several frail hacks (the shlex
3192 3200 module is rather limited in 2.2). Thanks to a suggestion by Ville
3193 3201 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3194 3202 problem.
3195 3203
3196 3204 (Magic.magic_system_verbose): new toggle to print the actual
3197 3205 system calls made by ipython. Mainly for debugging purposes.
3198 3206
3199 3207 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3200 3208 doesn't support persistence. Reported (and fix suggested) by
3201 3209 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3202 3210
3203 3211 2004-06-26 Fernando Perez <fperez@colorado.edu>
3204 3212
3205 3213 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3206 3214 continue prompts.
3207 3215
3208 3216 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3209 3217 function (basically a big docstring) and a few more things here to
3210 3218 speedup startup. pysh.py is now very lightweight. We want because
3211 3219 it gets execfile'd, while InterpreterExec gets imported, so
3212 3220 byte-compilation saves time.
3213 3221
3214 3222 2004-06-25 Fernando Perez <fperez@colorado.edu>
3215 3223
3216 3224 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3217 3225 -NUM', which was recently broken.
3218 3226
3219 3227 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3220 3228 in multi-line input (but not !!, which doesn't make sense there).
3221 3229
3222 3230 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3223 3231 It's just too useful, and people can turn it off in the less
3224 3232 common cases where it's a problem.
3225 3233
3226 3234 2004-06-24 Fernando Perez <fperez@colorado.edu>
3227 3235
3228 3236 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3229 3237 special syntaxes (like alias calling) is now allied in multi-line
3230 3238 input. This is still _very_ experimental, but it's necessary for
3231 3239 efficient shell usage combining python looping syntax with system
3232 3240 calls. For now it's restricted to aliases, I don't think it
3233 3241 really even makes sense to have this for magics.
3234 3242
3235 3243 2004-06-23 Fernando Perez <fperez@colorado.edu>
3236 3244
3237 3245 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3238 3246 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3239 3247
3240 3248 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3241 3249 extensions under Windows (after code sent by Gary Bishop). The
3242 3250 extensions considered 'executable' are stored in IPython's rc
3243 3251 structure as win_exec_ext.
3244 3252
3245 3253 * IPython/genutils.py (shell): new function, like system() but
3246 3254 without return value. Very useful for interactive shell work.
3247 3255
3248 3256 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3249 3257 delete aliases.
3250 3258
3251 3259 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3252 3260 sure that the alias table doesn't contain python keywords.
3253 3261
3254 3262 2004-06-21 Fernando Perez <fperez@colorado.edu>
3255 3263
3256 3264 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3257 3265 non-existent items are found in $PATH. Reported by Thorsten.
3258 3266
3259 3267 2004-06-20 Fernando Perez <fperez@colorado.edu>
3260 3268
3261 3269 * IPython/iplib.py (complete): modified the completer so that the
3262 3270 order of priorities can be easily changed at runtime.
3263 3271
3264 3272 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3265 3273 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3266 3274
3267 3275 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3268 3276 expand Python variables prepended with $ in all system calls. The
3269 3277 same was done to InteractiveShell.handle_shell_escape. Now all
3270 3278 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3271 3279 expansion of python variables and expressions according to the
3272 3280 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3273 3281
3274 3282 Though PEP-215 has been rejected, a similar (but simpler) one
3275 3283 seems like it will go into Python 2.4, PEP-292 -
3276 3284 http://www.python.org/peps/pep-0292.html.
3277 3285
3278 3286 I'll keep the full syntax of PEP-215, since IPython has since the
3279 3287 start used Ka-Ping Yee's reference implementation discussed there
3280 3288 (Itpl), and I actually like the powerful semantics it offers.
3281 3289
3282 3290 In order to access normal shell variables, the $ has to be escaped
3283 3291 via an extra $. For example:
3284 3292
3285 3293 In [7]: PATH='a python variable'
3286 3294
3287 3295 In [8]: !echo $PATH
3288 3296 a python variable
3289 3297
3290 3298 In [9]: !echo $$PATH
3291 3299 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3292 3300
3293 3301 (Magic.parse_options): escape $ so the shell doesn't evaluate
3294 3302 things prematurely.
3295 3303
3296 3304 * IPython/iplib.py (InteractiveShell.call_alias): added the
3297 3305 ability for aliases to expand python variables via $.
3298 3306
3299 3307 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3300 3308 system, now there's a @rehash/@rehashx pair of magics. These work
3301 3309 like the csh rehash command, and can be invoked at any time. They
3302 3310 build a table of aliases to everything in the user's $PATH
3303 3311 (@rehash uses everything, @rehashx is slower but only adds
3304 3312 executable files). With this, the pysh.py-based shell profile can
3305 3313 now simply call rehash upon startup, and full access to all
3306 3314 programs in the user's path is obtained.
3307 3315
3308 3316 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3309 3317 functionality is now fully in place. I removed the old dynamic
3310 3318 code generation based approach, in favor of a much lighter one
3311 3319 based on a simple dict. The advantage is that this allows me to
3312 3320 now have thousands of aliases with negligible cost (unthinkable
3313 3321 with the old system).
3314 3322
3315 3323 2004-06-19 Fernando Perez <fperez@colorado.edu>
3316 3324
3317 3325 * IPython/iplib.py (__init__): extended MagicCompleter class to
3318 3326 also complete (last in priority) on user aliases.
3319 3327
3320 3328 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3321 3329 call to eval.
3322 3330 (ItplNS.__init__): Added a new class which functions like Itpl,
3323 3331 but allows configuring the namespace for the evaluation to occur
3324 3332 in.
3325 3333
3326 3334 2004-06-18 Fernando Perez <fperez@colorado.edu>
3327 3335
3328 3336 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3329 3337 better message when 'exit' or 'quit' are typed (a common newbie
3330 3338 confusion).
3331 3339
3332 3340 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3333 3341 check for Windows users.
3334 3342
3335 3343 * IPython/iplib.py (InteractiveShell.user_setup): removed
3336 3344 disabling of colors for Windows. I'll test at runtime and issue a
3337 3345 warning if Gary's readline isn't found, as to nudge users to
3338 3346 download it.
3339 3347
3340 3348 2004-06-16 Fernando Perez <fperez@colorado.edu>
3341 3349
3342 3350 * IPython/genutils.py (Stream.__init__): changed to print errors
3343 3351 to sys.stderr. I had a circular dependency here. Now it's
3344 3352 possible to run ipython as IDLE's shell (consider this pre-alpha,
3345 3353 since true stdout things end up in the starting terminal instead
3346 3354 of IDLE's out).
3347 3355
3348 3356 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3349 3357 users who haven't # updated their prompt_in2 definitions. Remove
3350 3358 eventually.
3351 3359 (multiple_replace): added credit to original ASPN recipe.
3352 3360
3353 3361 2004-06-15 Fernando Perez <fperez@colorado.edu>
3354 3362
3355 3363 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3356 3364 list of auto-defined aliases.
3357 3365
3358 3366 2004-06-13 Fernando Perez <fperez@colorado.edu>
3359 3367
3360 3368 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3361 3369 install was really requested (so setup.py can be used for other
3362 3370 things under Windows).
3363 3371
3364 3372 2004-06-10 Fernando Perez <fperez@colorado.edu>
3365 3373
3366 3374 * IPython/Logger.py (Logger.create_log): Manually remove any old
3367 3375 backup, since os.remove may fail under Windows. Fixes bug
3368 3376 reported by Thorsten.
3369 3377
3370 3378 2004-06-09 Fernando Perez <fperez@colorado.edu>
3371 3379
3372 3380 * examples/example-embed.py: fixed all references to %n (replaced
3373 3381 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3374 3382 for all examples and the manual as well.
3375 3383
3376 3384 2004-06-08 Fernando Perez <fperez@colorado.edu>
3377 3385
3378 3386 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3379 3387 alignment and color management. All 3 prompt subsystems now
3380 3388 inherit from BasePrompt.
3381 3389
3382 3390 * tools/release: updates for windows installer build and tag rpms
3383 3391 with python version (since paths are fixed).
3384 3392
3385 3393 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3386 3394 which will become eventually obsolete. Also fixed the default
3387 3395 prompt_in2 to use \D, so at least new users start with the correct
3388 3396 defaults.
3389 3397 WARNING: Users with existing ipythonrc files will need to apply
3390 3398 this fix manually!
3391 3399
3392 3400 * setup.py: make windows installer (.exe). This is finally the
3393 3401 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3394 3402 which I hadn't included because it required Python 2.3 (or recent
3395 3403 distutils).
3396 3404
3397 3405 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3398 3406 usage of new '\D' escape.
3399 3407
3400 3408 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3401 3409 lacks os.getuid())
3402 3410 (CachedOutput.set_colors): Added the ability to turn coloring
3403 3411 on/off with @colors even for manually defined prompt colors. It
3404 3412 uses a nasty global, but it works safely and via the generic color
3405 3413 handling mechanism.
3406 3414 (Prompt2.__init__): Introduced new escape '\D' for continuation
3407 3415 prompts. It represents the counter ('\#') as dots.
3408 3416 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3409 3417 need to update their ipythonrc files and replace '%n' with '\D' in
3410 3418 their prompt_in2 settings everywhere. Sorry, but there's
3411 3419 otherwise no clean way to get all prompts to properly align. The
3412 3420 ipythonrc shipped with IPython has been updated.
3413 3421
3414 3422 2004-06-07 Fernando Perez <fperez@colorado.edu>
3415 3423
3416 3424 * setup.py (isfile): Pass local_icons option to latex2html, so the
3417 3425 resulting HTML file is self-contained. Thanks to
3418 3426 dryice-AT-liu.com.cn for the tip.
3419 3427
3420 3428 * pysh.py: I created a new profile 'shell', which implements a
3421 3429 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3422 3430 system shell, nor will it become one anytime soon. It's mainly
3423 3431 meant to illustrate the use of the new flexible bash-like prompts.
3424 3432 I guess it could be used by hardy souls for true shell management,
3425 3433 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3426 3434 profile. This uses the InterpreterExec extension provided by
3427 3435 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3428 3436
3429 3437 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3430 3438 auto-align itself with the length of the previous input prompt
3431 3439 (taking into account the invisible color escapes).
3432 3440 (CachedOutput.__init__): Large restructuring of this class. Now
3433 3441 all three prompts (primary1, primary2, output) are proper objects,
3434 3442 managed by the 'parent' CachedOutput class. The code is still a
3435 3443 bit hackish (all prompts share state via a pointer to the cache),
3436 3444 but it's overall far cleaner than before.
3437 3445
3438 3446 * IPython/genutils.py (getoutputerror): modified to add verbose,
3439 3447 debug and header options. This makes the interface of all getout*
3440 3448 functions uniform.
3441 3449 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3442 3450
3443 3451 * IPython/Magic.py (Magic.default_option): added a function to
3444 3452 allow registering default options for any magic command. This
3445 3453 makes it easy to have profiles which customize the magics globally
3446 3454 for a certain use. The values set through this function are
3447 3455 picked up by the parse_options() method, which all magics should
3448 3456 use to parse their options.
3449 3457
3450 3458 * IPython/genutils.py (warn): modified the warnings framework to
3451 3459 use the Term I/O class. I'm trying to slowly unify all of
3452 3460 IPython's I/O operations to pass through Term.
3453 3461
3454 3462 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3455 3463 the secondary prompt to correctly match the length of the primary
3456 3464 one for any prompt. Now multi-line code will properly line up
3457 3465 even for path dependent prompts, such as the new ones available
3458 3466 via the prompt_specials.
3459 3467
3460 3468 2004-06-06 Fernando Perez <fperez@colorado.edu>
3461 3469
3462 3470 * IPython/Prompts.py (prompt_specials): Added the ability to have
3463 3471 bash-like special sequences in the prompts, which get
3464 3472 automatically expanded. Things like hostname, current working
3465 3473 directory and username are implemented already, but it's easy to
3466 3474 add more in the future. Thanks to a patch by W.J. van der Laan
3467 3475 <gnufnork-AT-hetdigitalegat.nl>
3468 3476 (prompt_specials): Added color support for prompt strings, so
3469 3477 users can define arbitrary color setups for their prompts.
3470 3478
3471 3479 2004-06-05 Fernando Perez <fperez@colorado.edu>
3472 3480
3473 3481 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3474 3482 code to load Gary Bishop's readline and configure it
3475 3483 automatically. Thanks to Gary for help on this.
3476 3484
3477 3485 2004-06-01 Fernando Perez <fperez@colorado.edu>
3478 3486
3479 3487 * IPython/Logger.py (Logger.create_log): fix bug for logging
3480 3488 with no filename (previous fix was incomplete).
3481 3489
3482 3490 2004-05-25 Fernando Perez <fperez@colorado.edu>
3483 3491
3484 3492 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3485 3493 parens would get passed to the shell.
3486 3494
3487 3495 2004-05-20 Fernando Perez <fperez@colorado.edu>
3488 3496
3489 3497 * IPython/Magic.py (Magic.magic_prun): changed default profile
3490 3498 sort order to 'time' (the more common profiling need).
3491 3499
3492 3500 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3493 3501 so that source code shown is guaranteed in sync with the file on
3494 3502 disk (also changed in psource). Similar fix to the one for
3495 3503 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3496 3504 <yann.ledu-AT-noos.fr>.
3497 3505
3498 3506 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3499 3507 with a single option would not be correctly parsed. Closes
3500 3508 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3501 3509 introduced in 0.6.0 (on 2004-05-06).
3502 3510
3503 3511 2004-05-13 *** Released version 0.6.0
3504 3512
3505 3513 2004-05-13 Fernando Perez <fperez@colorado.edu>
3506 3514
3507 3515 * debian/: Added debian/ directory to CVS, so that debian support
3508 3516 is publicly accessible. The debian package is maintained by Jack
3509 3517 Moffit <jack-AT-xiph.org>.
3510 3518
3511 3519 * Documentation: included the notes about an ipython-based system
3512 3520 shell (the hypothetical 'pysh') into the new_design.pdf document,
3513 3521 so that these ideas get distributed to users along with the
3514 3522 official documentation.
3515 3523
3516 3524 2004-05-10 Fernando Perez <fperez@colorado.edu>
3517 3525
3518 3526 * IPython/Logger.py (Logger.create_log): fix recently introduced
3519 3527 bug (misindented line) where logstart would fail when not given an
3520 3528 explicit filename.
3521 3529
3522 3530 2004-05-09 Fernando Perez <fperez@colorado.edu>
3523 3531
3524 3532 * IPython/Magic.py (Magic.parse_options): skip system call when
3525 3533 there are no options to look for. Faster, cleaner for the common
3526 3534 case.
3527 3535
3528 3536 * Documentation: many updates to the manual: describing Windows
3529 3537 support better, Gnuplot updates, credits, misc small stuff. Also
3530 3538 updated the new_design doc a bit.
3531 3539
3532 3540 2004-05-06 *** Released version 0.6.0.rc1
3533 3541
3534 3542 2004-05-06 Fernando Perez <fperez@colorado.edu>
3535 3543
3536 3544 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3537 3545 operations to use the vastly more efficient list/''.join() method.
3538 3546 (FormattedTB.text): Fix
3539 3547 http://www.scipy.net/roundup/ipython/issue12 - exception source
3540 3548 extract not updated after reload. Thanks to Mike Salib
3541 3549 <msalib-AT-mit.edu> for pinning the source of the problem.
3542 3550 Fortunately, the solution works inside ipython and doesn't require
3543 3551 any changes to python proper.
3544 3552
3545 3553 * IPython/Magic.py (Magic.parse_options): Improved to process the
3546 3554 argument list as a true shell would (by actually using the
3547 3555 underlying system shell). This way, all @magics automatically get
3548 3556 shell expansion for variables. Thanks to a comment by Alex
3549 3557 Schmolck.
3550 3558
3551 3559 2004-04-04 Fernando Perez <fperez@colorado.edu>
3552 3560
3553 3561 * IPython/iplib.py (InteractiveShell.interact): Added a special
3554 3562 trap for a debugger quit exception, which is basically impossible
3555 3563 to handle by normal mechanisms, given what pdb does to the stack.
3556 3564 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3557 3565
3558 3566 2004-04-03 Fernando Perez <fperez@colorado.edu>
3559 3567
3560 3568 * IPython/genutils.py (Term): Standardized the names of the Term
3561 3569 class streams to cin/cout/cerr, following C++ naming conventions
3562 3570 (I can't use in/out/err because 'in' is not a valid attribute
3563 3571 name).
3564 3572
3565 3573 * IPython/iplib.py (InteractiveShell.interact): don't increment
3566 3574 the prompt if there's no user input. By Daniel 'Dang' Griffith
3567 3575 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3568 3576 Francois Pinard.
3569 3577
3570 3578 2004-04-02 Fernando Perez <fperez@colorado.edu>
3571 3579
3572 3580 * IPython/genutils.py (Stream.__init__): Modified to survive at
3573 3581 least importing in contexts where stdin/out/err aren't true file
3574 3582 objects, such as PyCrust (they lack fileno() and mode). However,
3575 3583 the recovery facilities which rely on these things existing will
3576 3584 not work.
3577 3585
3578 3586 2004-04-01 Fernando Perez <fperez@colorado.edu>
3579 3587
3580 3588 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3581 3589 use the new getoutputerror() function, so it properly
3582 3590 distinguishes stdout/err.
3583 3591
3584 3592 * IPython/genutils.py (getoutputerror): added a function to
3585 3593 capture separately the standard output and error of a command.
3586 3594 After a comment from dang on the mailing lists. This code is
3587 3595 basically a modified version of commands.getstatusoutput(), from
3588 3596 the standard library.
3589 3597
3590 3598 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3591 3599 '!!' as a special syntax (shorthand) to access @sx.
3592 3600
3593 3601 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3594 3602 command and return its output as a list split on '\n'.
3595 3603
3596 3604 2004-03-31 Fernando Perez <fperez@colorado.edu>
3597 3605
3598 3606 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3599 3607 method to dictionaries used as FakeModule instances if they lack
3600 3608 it. At least pydoc in python2.3 breaks for runtime-defined
3601 3609 functions without this hack. At some point I need to _really_
3602 3610 understand what FakeModule is doing, because it's a gross hack.
3603 3611 But it solves Arnd's problem for now...
3604 3612
3605 3613 2004-02-27 Fernando Perez <fperez@colorado.edu>
3606 3614
3607 3615 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3608 3616 mode would behave erratically. Also increased the number of
3609 3617 possible logs in rotate mod to 999. Thanks to Rod Holland
3610 3618 <rhh@StructureLABS.com> for the report and fixes.
3611 3619
3612 3620 2004-02-26 Fernando Perez <fperez@colorado.edu>
3613 3621
3614 3622 * IPython/genutils.py (page): Check that the curses module really
3615 3623 has the initscr attribute before trying to use it. For some
3616 3624 reason, the Solaris curses module is missing this. I think this
3617 3625 should be considered a Solaris python bug, but I'm not sure.
3618 3626
3619 3627 2004-01-17 Fernando Perez <fperez@colorado.edu>
3620 3628
3621 3629 * IPython/genutils.py (Stream.__init__): Changes to try to make
3622 3630 ipython robust against stdin/out/err being closed by the user.
3623 3631 This is 'user error' (and blocks a normal python session, at least
3624 3632 the stdout case). However, Ipython should be able to survive such
3625 3633 instances of abuse as gracefully as possible. To simplify the
3626 3634 coding and maintain compatibility with Gary Bishop's Term
3627 3635 contributions, I've made use of classmethods for this. I think
3628 3636 this introduces a dependency on python 2.2.
3629 3637
3630 3638 2004-01-13 Fernando Perez <fperez@colorado.edu>
3631 3639
3632 3640 * IPython/numutils.py (exp_safe): simplified the code a bit and
3633 3641 removed the need for importing the kinds module altogether.
3634 3642
3635 3643 2004-01-06 Fernando Perez <fperez@colorado.edu>
3636 3644
3637 3645 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3638 3646 a magic function instead, after some community feedback. No
3639 3647 special syntax will exist for it, but its name is deliberately
3640 3648 very short.
3641 3649
3642 3650 2003-12-20 Fernando Perez <fperez@colorado.edu>
3643 3651
3644 3652 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3645 3653 new functionality, to automagically assign the result of a shell
3646 3654 command to a variable. I'll solicit some community feedback on
3647 3655 this before making it permanent.
3648 3656
3649 3657 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3650 3658 requested about callables for which inspect couldn't obtain a
3651 3659 proper argspec. Thanks to a crash report sent by Etienne
3652 3660 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3653 3661
3654 3662 2003-12-09 Fernando Perez <fperez@colorado.edu>
3655 3663
3656 3664 * IPython/genutils.py (page): patch for the pager to work across
3657 3665 various versions of Windows. By Gary Bishop.
3658 3666
3659 3667 2003-12-04 Fernando Perez <fperez@colorado.edu>
3660 3668
3661 3669 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3662 3670 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3663 3671 While I tested this and it looks ok, there may still be corner
3664 3672 cases I've missed.
3665 3673
3666 3674 2003-12-01 Fernando Perez <fperez@colorado.edu>
3667 3675
3668 3676 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3669 3677 where a line like 'p,q=1,2' would fail because the automagic
3670 3678 system would be triggered for @p.
3671 3679
3672 3680 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3673 3681 cleanups, code unmodified.
3674 3682
3675 3683 * IPython/genutils.py (Term): added a class for IPython to handle
3676 3684 output. In most cases it will just be a proxy for stdout/err, but
3677 3685 having this allows modifications to be made for some platforms,
3678 3686 such as handling color escapes under Windows. All of this code
3679 3687 was contributed by Gary Bishop, with minor modifications by me.
3680 3688 The actual changes affect many files.
3681 3689
3682 3690 2003-11-30 Fernando Perez <fperez@colorado.edu>
3683 3691
3684 3692 * IPython/iplib.py (file_matches): new completion code, courtesy
3685 3693 of Jeff Collins. This enables filename completion again under
3686 3694 python 2.3, which disabled it at the C level.
3687 3695
3688 3696 2003-11-11 Fernando Perez <fperez@colorado.edu>
3689 3697
3690 3698 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3691 3699 for Numeric.array(map(...)), but often convenient.
3692 3700
3693 3701 2003-11-05 Fernando Perez <fperez@colorado.edu>
3694 3702
3695 3703 * IPython/numutils.py (frange): Changed a call from int() to
3696 3704 int(round()) to prevent a problem reported with arange() in the
3697 3705 numpy list.
3698 3706
3699 3707 2003-10-06 Fernando Perez <fperez@colorado.edu>
3700 3708
3701 3709 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3702 3710 prevent crashes if sys lacks an argv attribute (it happens with
3703 3711 embedded interpreters which build a bare-bones sys module).
3704 3712 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3705 3713
3706 3714 2003-09-24 Fernando Perez <fperez@colorado.edu>
3707 3715
3708 3716 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3709 3717 to protect against poorly written user objects where __getattr__
3710 3718 raises exceptions other than AttributeError. Thanks to a bug
3711 3719 report by Oliver Sander <osander-AT-gmx.de>.
3712 3720
3713 3721 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3714 3722 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3715 3723
3716 3724 2003-09-09 Fernando Perez <fperez@colorado.edu>
3717 3725
3718 3726 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3719 3727 unpacking a list whith a callable as first element would
3720 3728 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3721 3729 Collins.
3722 3730
3723 3731 2003-08-25 *** Released version 0.5.0
3724 3732
3725 3733 2003-08-22 Fernando Perez <fperez@colorado.edu>
3726 3734
3727 3735 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3728 3736 improperly defined user exceptions. Thanks to feedback from Mark
3729 3737 Russell <mrussell-AT-verio.net>.
3730 3738
3731 3739 2003-08-20 Fernando Perez <fperez@colorado.edu>
3732 3740
3733 3741 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3734 3742 printing so that it would print multi-line string forms starting
3735 3743 with a new line. This way the formatting is better respected for
3736 3744 objects which work hard to make nice string forms.
3737 3745
3738 3746 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3739 3747 autocall would overtake data access for objects with both
3740 3748 __getitem__ and __call__.
3741 3749
3742 3750 2003-08-19 *** Released version 0.5.0-rc1
3743 3751
3744 3752 2003-08-19 Fernando Perez <fperez@colorado.edu>
3745 3753
3746 3754 * IPython/deep_reload.py (load_tail): single tiny change here
3747 3755 seems to fix the long-standing bug of dreload() failing to work
3748 3756 for dotted names. But this module is pretty tricky, so I may have
3749 3757 missed some subtlety. Needs more testing!.
3750 3758
3751 3759 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3752 3760 exceptions which have badly implemented __str__ methods.
3753 3761 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3754 3762 which I've been getting reports about from Python 2.3 users. I
3755 3763 wish I had a simple test case to reproduce the problem, so I could
3756 3764 either write a cleaner workaround or file a bug report if
3757 3765 necessary.
3758 3766
3759 3767 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3760 3768 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3761 3769 a bug report by Tjabo Kloppenburg.
3762 3770
3763 3771 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3764 3772 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3765 3773 seems rather unstable. Thanks to a bug report by Tjabo
3766 3774 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3767 3775
3768 3776 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3769 3777 this out soon because of the critical fixes in the inner loop for
3770 3778 generators.
3771 3779
3772 3780 * IPython/Magic.py (Magic.getargspec): removed. This (and
3773 3781 _get_def) have been obsoleted by OInspect for a long time, I
3774 3782 hadn't noticed that they were dead code.
3775 3783 (Magic._ofind): restored _ofind functionality for a few literals
3776 3784 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3777 3785 for things like "hello".capitalize?, since that would require a
3778 3786 potentially dangerous eval() again.
3779 3787
3780 3788 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3781 3789 logic a bit more to clean up the escapes handling and minimize the
3782 3790 use of _ofind to only necessary cases. The interactive 'feel' of
3783 3791 IPython should have improved quite a bit with the changes in
3784 3792 _prefilter and _ofind (besides being far safer than before).
3785 3793
3786 3794 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3787 3795 obscure, never reported). Edit would fail to find the object to
3788 3796 edit under some circumstances.
3789 3797 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3790 3798 which were causing double-calling of generators. Those eval calls
3791 3799 were _very_ dangerous, since code with side effects could be
3792 3800 triggered. As they say, 'eval is evil'... These were the
3793 3801 nastiest evals in IPython. Besides, _ofind is now far simpler,
3794 3802 and it should also be quite a bit faster. Its use of inspect is
3795 3803 also safer, so perhaps some of the inspect-related crashes I've
3796 3804 seen lately with Python 2.3 might be taken care of. That will
3797 3805 need more testing.
3798 3806
3799 3807 2003-08-17 Fernando Perez <fperez@colorado.edu>
3800 3808
3801 3809 * IPython/iplib.py (InteractiveShell._prefilter): significant
3802 3810 simplifications to the logic for handling user escapes. Faster
3803 3811 and simpler code.
3804 3812
3805 3813 2003-08-14 Fernando Perez <fperez@colorado.edu>
3806 3814
3807 3815 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3808 3816 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3809 3817 but it should be quite a bit faster. And the recursive version
3810 3818 generated O(log N) intermediate storage for all rank>1 arrays,
3811 3819 even if they were contiguous.
3812 3820 (l1norm): Added this function.
3813 3821 (norm): Added this function for arbitrary norms (including
3814 3822 l-infinity). l1 and l2 are still special cases for convenience
3815 3823 and speed.
3816 3824
3817 3825 2003-08-03 Fernando Perez <fperez@colorado.edu>
3818 3826
3819 3827 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3820 3828 exceptions, which now raise PendingDeprecationWarnings in Python
3821 3829 2.3. There were some in Magic and some in Gnuplot2.
3822 3830
3823 3831 2003-06-30 Fernando Perez <fperez@colorado.edu>
3824 3832
3825 3833 * IPython/genutils.py (page): modified to call curses only for
3826 3834 terminals where TERM=='xterm'. After problems under many other
3827 3835 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3828 3836
3829 3837 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3830 3838 would be triggered when readline was absent. This was just an old
3831 3839 debugging statement I'd forgotten to take out.
3832 3840
3833 3841 2003-06-20 Fernando Perez <fperez@colorado.edu>
3834 3842
3835 3843 * IPython/genutils.py (clock): modified to return only user time
3836 3844 (not counting system time), after a discussion on scipy. While
3837 3845 system time may be a useful quantity occasionally, it may much
3838 3846 more easily be skewed by occasional swapping or other similar
3839 3847 activity.
3840 3848
3841 3849 2003-06-05 Fernando Perez <fperez@colorado.edu>
3842 3850
3843 3851 * IPython/numutils.py (identity): new function, for building
3844 3852 arbitrary rank Kronecker deltas (mostly backwards compatible with
3845 3853 Numeric.identity)
3846 3854
3847 3855 2003-06-03 Fernando Perez <fperez@colorado.edu>
3848 3856
3849 3857 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3850 3858 arguments passed to magics with spaces, to allow trailing '\' to
3851 3859 work normally (mainly for Windows users).
3852 3860
3853 3861 2003-05-29 Fernando Perez <fperez@colorado.edu>
3854 3862
3855 3863 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3856 3864 instead of pydoc.help. This fixes a bizarre behavior where
3857 3865 printing '%s' % locals() would trigger the help system. Now
3858 3866 ipython behaves like normal python does.
3859 3867
3860 3868 Note that if one does 'from pydoc import help', the bizarre
3861 3869 behavior returns, but this will also happen in normal python, so
3862 3870 it's not an ipython bug anymore (it has to do with how pydoc.help
3863 3871 is implemented).
3864 3872
3865 3873 2003-05-22 Fernando Perez <fperez@colorado.edu>
3866 3874
3867 3875 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3868 3876 return [] instead of None when nothing matches, also match to end
3869 3877 of line. Patch by Gary Bishop.
3870 3878
3871 3879 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3872 3880 protection as before, for files passed on the command line. This
3873 3881 prevents the CrashHandler from kicking in if user files call into
3874 3882 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3875 3883 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3876 3884
3877 3885 2003-05-20 *** Released version 0.4.0
3878 3886
3879 3887 2003-05-20 Fernando Perez <fperez@colorado.edu>
3880 3888
3881 3889 * setup.py: added support for manpages. It's a bit hackish b/c of
3882 3890 a bug in the way the bdist_rpm distutils target handles gzipped
3883 3891 manpages, but it works. After a patch by Jack.
3884 3892
3885 3893 2003-05-19 Fernando Perez <fperez@colorado.edu>
3886 3894
3887 3895 * IPython/numutils.py: added a mockup of the kinds module, since
3888 3896 it was recently removed from Numeric. This way, numutils will
3889 3897 work for all users even if they are missing kinds.
3890 3898
3891 3899 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3892 3900 failure, which can occur with SWIG-wrapped extensions. After a
3893 3901 crash report from Prabhu.
3894 3902
3895 3903 2003-05-16 Fernando Perez <fperez@colorado.edu>
3896 3904
3897 3905 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3898 3906 protect ipython from user code which may call directly
3899 3907 sys.excepthook (this looks like an ipython crash to the user, even
3900 3908 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3901 3909 This is especially important to help users of WxWindows, but may
3902 3910 also be useful in other cases.
3903 3911
3904 3912 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3905 3913 an optional tb_offset to be specified, and to preserve exception
3906 3914 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3907 3915
3908 3916 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3909 3917
3910 3918 2003-05-15 Fernando Perez <fperez@colorado.edu>
3911 3919
3912 3920 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3913 3921 installing for a new user under Windows.
3914 3922
3915 3923 2003-05-12 Fernando Perez <fperez@colorado.edu>
3916 3924
3917 3925 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3918 3926 handler for Emacs comint-based lines. Currently it doesn't do
3919 3927 much (but importantly, it doesn't update the history cache). In
3920 3928 the future it may be expanded if Alex needs more functionality
3921 3929 there.
3922 3930
3923 3931 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3924 3932 info to crash reports.
3925 3933
3926 3934 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3927 3935 just like Python's -c. Also fixed crash with invalid -color
3928 3936 option value at startup. Thanks to Will French
3929 3937 <wfrench-AT-bestweb.net> for the bug report.
3930 3938
3931 3939 2003-05-09 Fernando Perez <fperez@colorado.edu>
3932 3940
3933 3941 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3934 3942 to EvalDict (it's a mapping, after all) and simplified its code
3935 3943 quite a bit, after a nice discussion on c.l.py where Gustavo
3936 3944 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3937 3945
3938 3946 2003-04-30 Fernando Perez <fperez@colorado.edu>
3939 3947
3940 3948 * IPython/genutils.py (timings_out): modified it to reduce its
3941 3949 overhead in the common reps==1 case.
3942 3950
3943 3951 2003-04-29 Fernando Perez <fperez@colorado.edu>
3944 3952
3945 3953 * IPython/genutils.py (timings_out): Modified to use the resource
3946 3954 module, which avoids the wraparound problems of time.clock().
3947 3955
3948 3956 2003-04-17 *** Released version 0.2.15pre4
3949 3957
3950 3958 2003-04-17 Fernando Perez <fperez@colorado.edu>
3951 3959
3952 3960 * setup.py (scriptfiles): Split windows-specific stuff over to a
3953 3961 separate file, in an attempt to have a Windows GUI installer.
3954 3962 That didn't work, but part of the groundwork is done.
3955 3963
3956 3964 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3957 3965 indent/unindent with 4 spaces. Particularly useful in combination
3958 3966 with the new auto-indent option.
3959 3967
3960 3968 2003-04-16 Fernando Perez <fperez@colorado.edu>
3961 3969
3962 3970 * IPython/Magic.py: various replacements of self.rc for
3963 3971 self.shell.rc. A lot more remains to be done to fully disentangle
3964 3972 this class from the main Shell class.
3965 3973
3966 3974 * IPython/GnuplotRuntime.py: added checks for mouse support so
3967 3975 that we don't try to enable it if the current gnuplot doesn't
3968 3976 really support it. Also added checks so that we don't try to
3969 3977 enable persist under Windows (where Gnuplot doesn't recognize the
3970 3978 option).
3971 3979
3972 3980 * IPython/iplib.py (InteractiveShell.interact): Added optional
3973 3981 auto-indenting code, after a patch by King C. Shu
3974 3982 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3975 3983 get along well with pasting indented code. If I ever figure out
3976 3984 how to make that part go well, it will become on by default.
3977 3985
3978 3986 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3979 3987 crash ipython if there was an unmatched '%' in the user's prompt
3980 3988 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3981 3989
3982 3990 * IPython/iplib.py (InteractiveShell.interact): removed the
3983 3991 ability to ask the user whether he wants to crash or not at the
3984 3992 'last line' exception handler. Calling functions at that point
3985 3993 changes the stack, and the error reports would have incorrect
3986 3994 tracebacks.
3987 3995
3988 3996 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3989 3997 pass through a peger a pretty-printed form of any object. After a
3990 3998 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3991 3999
3992 4000 2003-04-14 Fernando Perez <fperez@colorado.edu>
3993 4001
3994 4002 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3995 4003 all files in ~ would be modified at first install (instead of
3996 4004 ~/.ipython). This could be potentially disastrous, as the
3997 4005 modification (make line-endings native) could damage binary files.
3998 4006
3999 4007 2003-04-10 Fernando Perez <fperez@colorado.edu>
4000 4008
4001 4009 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4002 4010 handle only lines which are invalid python. This now means that
4003 4011 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4004 4012 for the bug report.
4005 4013
4006 4014 2003-04-01 Fernando Perez <fperez@colorado.edu>
4007 4015
4008 4016 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4009 4017 where failing to set sys.last_traceback would crash pdb.pm().
4010 4018 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4011 4019 report.
4012 4020
4013 4021 2003-03-25 Fernando Perez <fperez@colorado.edu>
4014 4022
4015 4023 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4016 4024 before printing it (it had a lot of spurious blank lines at the
4017 4025 end).
4018 4026
4019 4027 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4020 4028 output would be sent 21 times! Obviously people don't use this
4021 4029 too often, or I would have heard about it.
4022 4030
4023 4031 2003-03-24 Fernando Perez <fperez@colorado.edu>
4024 4032
4025 4033 * setup.py (scriptfiles): renamed the data_files parameter from
4026 4034 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4027 4035 for the patch.
4028 4036
4029 4037 2003-03-20 Fernando Perez <fperez@colorado.edu>
4030 4038
4031 4039 * IPython/genutils.py (error): added error() and fatal()
4032 4040 functions.
4033 4041
4034 4042 2003-03-18 *** Released version 0.2.15pre3
4035 4043
4036 4044 2003-03-18 Fernando Perez <fperez@colorado.edu>
4037 4045
4038 4046 * setupext/install_data_ext.py
4039 4047 (install_data_ext.initialize_options): Class contributed by Jack
4040 4048 Moffit for fixing the old distutils hack. He is sending this to
4041 4049 the distutils folks so in the future we may not need it as a
4042 4050 private fix.
4043 4051
4044 4052 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4045 4053 changes for Debian packaging. See his patch for full details.
4046 4054 The old distutils hack of making the ipythonrc* files carry a
4047 4055 bogus .py extension is gone, at last. Examples were moved to a
4048 4056 separate subdir under doc/, and the separate executable scripts
4049 4057 now live in their own directory. Overall a great cleanup. The
4050 4058 manual was updated to use the new files, and setup.py has been
4051 4059 fixed for this setup.
4052 4060
4053 4061 * IPython/PyColorize.py (Parser.usage): made non-executable and
4054 4062 created a pycolor wrapper around it to be included as a script.
4055 4063
4056 4064 2003-03-12 *** Released version 0.2.15pre2
4057 4065
4058 4066 2003-03-12 Fernando Perez <fperez@colorado.edu>
4059 4067
4060 4068 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4061 4069 long-standing problem with garbage characters in some terminals.
4062 4070 The issue was really that the \001 and \002 escapes must _only_ be
4063 4071 passed to input prompts (which call readline), but _never_ to
4064 4072 normal text to be printed on screen. I changed ColorANSI to have
4065 4073 two classes: TermColors and InputTermColors, each with the
4066 4074 appropriate escapes for input prompts or normal text. The code in
4067 4075 Prompts.py got slightly more complicated, but this very old and
4068 4076 annoying bug is finally fixed.
4069 4077
4070 4078 All the credit for nailing down the real origin of this problem
4071 4079 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4072 4080 *Many* thanks to him for spending quite a bit of effort on this.
4073 4081
4074 4082 2003-03-05 *** Released version 0.2.15pre1
4075 4083
4076 4084 2003-03-03 Fernando Perez <fperez@colorado.edu>
4077 4085
4078 4086 * IPython/FakeModule.py: Moved the former _FakeModule to a
4079 4087 separate file, because it's also needed by Magic (to fix a similar
4080 4088 pickle-related issue in @run).
4081 4089
4082 4090 2003-03-02 Fernando Perez <fperez@colorado.edu>
4083 4091
4084 4092 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4085 4093 the autocall option at runtime.
4086 4094 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4087 4095 across Magic.py to start separating Magic from InteractiveShell.
4088 4096 (Magic._ofind): Fixed to return proper namespace for dotted
4089 4097 names. Before, a dotted name would always return 'not currently
4090 4098 defined', because it would find the 'parent'. s.x would be found,
4091 4099 but since 'x' isn't defined by itself, it would get confused.
4092 4100 (Magic.magic_run): Fixed pickling problems reported by Ralf
4093 4101 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4094 4102 that I'd used when Mike Heeter reported similar issues at the
4095 4103 top-level, but now for @run. It boils down to injecting the
4096 4104 namespace where code is being executed with something that looks
4097 4105 enough like a module to fool pickle.dump(). Since a pickle stores
4098 4106 a named reference to the importing module, we need this for
4099 4107 pickles to save something sensible.
4100 4108
4101 4109 * IPython/ipmaker.py (make_IPython): added an autocall option.
4102 4110
4103 4111 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4104 4112 the auto-eval code. Now autocalling is an option, and the code is
4105 4113 also vastly safer. There is no more eval() involved at all.
4106 4114
4107 4115 2003-03-01 Fernando Perez <fperez@colorado.edu>
4108 4116
4109 4117 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4110 4118 dict with named keys instead of a tuple.
4111 4119
4112 4120 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4113 4121
4114 4122 * setup.py (make_shortcut): Fixed message about directories
4115 4123 created during Windows installation (the directories were ok, just
4116 4124 the printed message was misleading). Thanks to Chris Liechti
4117 4125 <cliechti-AT-gmx.net> for the heads up.
4118 4126
4119 4127 2003-02-21 Fernando Perez <fperez@colorado.edu>
4120 4128
4121 4129 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4122 4130 of ValueError exception when checking for auto-execution. This
4123 4131 one is raised by things like Numeric arrays arr.flat when the
4124 4132 array is non-contiguous.
4125 4133
4126 4134 2003-01-31 Fernando Perez <fperez@colorado.edu>
4127 4135
4128 4136 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4129 4137 not return any value at all (even though the command would get
4130 4138 executed).
4131 4139 (xsys): Flush stdout right after printing the command to ensure
4132 4140 proper ordering of commands and command output in the total
4133 4141 output.
4134 4142 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4135 4143 system/getoutput as defaults. The old ones are kept for
4136 4144 compatibility reasons, so no code which uses this library needs
4137 4145 changing.
4138 4146
4139 4147 2003-01-27 *** Released version 0.2.14
4140 4148
4141 4149 2003-01-25 Fernando Perez <fperez@colorado.edu>
4142 4150
4143 4151 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4144 4152 functions defined in previous edit sessions could not be re-edited
4145 4153 (because the temp files were immediately removed). Now temp files
4146 4154 are removed only at IPython's exit.
4147 4155 (Magic.magic_run): Improved @run to perform shell-like expansions
4148 4156 on its arguments (~users and $VARS). With this, @run becomes more
4149 4157 like a normal command-line.
4150 4158
4151 4159 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4152 4160 bugs related to embedding and cleaned up that code. A fairly
4153 4161 important one was the impossibility to access the global namespace
4154 4162 through the embedded IPython (only local variables were visible).
4155 4163
4156 4164 2003-01-14 Fernando Perez <fperez@colorado.edu>
4157 4165
4158 4166 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4159 4167 auto-calling to be a bit more conservative. Now it doesn't get
4160 4168 triggered if any of '!=()<>' are in the rest of the input line, to
4161 4169 allow comparing callables. Thanks to Alex for the heads up.
4162 4170
4163 4171 2003-01-07 Fernando Perez <fperez@colorado.edu>
4164 4172
4165 4173 * IPython/genutils.py (page): fixed estimation of the number of
4166 4174 lines in a string to be paged to simply count newlines. This
4167 4175 prevents over-guessing due to embedded escape sequences. A better
4168 4176 long-term solution would involve stripping out the control chars
4169 4177 for the count, but it's potentially so expensive I just don't
4170 4178 think it's worth doing.
4171 4179
4172 4180 2002-12-19 *** Released version 0.2.14pre50
4173 4181
4174 4182 2002-12-19 Fernando Perez <fperez@colorado.edu>
4175 4183
4176 4184 * tools/release (version): Changed release scripts to inform
4177 4185 Andrea and build a NEWS file with a list of recent changes.
4178 4186
4179 4187 * IPython/ColorANSI.py (__all__): changed terminal detection
4180 4188 code. Seems to work better for xterms without breaking
4181 4189 konsole. Will need more testing to determine if WinXP and Mac OSX
4182 4190 also work ok.
4183 4191
4184 4192 2002-12-18 *** Released version 0.2.14pre49
4185 4193
4186 4194 2002-12-18 Fernando Perez <fperez@colorado.edu>
4187 4195
4188 4196 * Docs: added new info about Mac OSX, from Andrea.
4189 4197
4190 4198 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4191 4199 allow direct plotting of python strings whose format is the same
4192 4200 of gnuplot data files.
4193 4201
4194 4202 2002-12-16 Fernando Perez <fperez@colorado.edu>
4195 4203
4196 4204 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4197 4205 value of exit question to be acknowledged.
4198 4206
4199 4207 2002-12-03 Fernando Perez <fperez@colorado.edu>
4200 4208
4201 4209 * IPython/ipmaker.py: removed generators, which had been added
4202 4210 by mistake in an earlier debugging run. This was causing trouble
4203 4211 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4204 4212 for pointing this out.
4205 4213
4206 4214 2002-11-17 Fernando Perez <fperez@colorado.edu>
4207 4215
4208 4216 * Manual: updated the Gnuplot section.
4209 4217
4210 4218 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4211 4219 a much better split of what goes in Runtime and what goes in
4212 4220 Interactive.
4213 4221
4214 4222 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4215 4223 being imported from iplib.
4216 4224
4217 4225 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4218 4226 for command-passing. Now the global Gnuplot instance is called
4219 4227 'gp' instead of 'g', which was really a far too fragile and
4220 4228 common name.
4221 4229
4222 4230 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4223 4231 bounding boxes generated by Gnuplot for square plots.
4224 4232
4225 4233 * IPython/genutils.py (popkey): new function added. I should
4226 4234 suggest this on c.l.py as a dict method, it seems useful.
4227 4235
4228 4236 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4229 4237 to transparently handle PostScript generation. MUCH better than
4230 4238 the previous plot_eps/replot_eps (which I removed now). The code
4231 4239 is also fairly clean and well documented now (including
4232 4240 docstrings).
4233 4241
4234 4242 2002-11-13 Fernando Perez <fperez@colorado.edu>
4235 4243
4236 4244 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4237 4245 (inconsistent with options).
4238 4246
4239 4247 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4240 4248 manually disabled, I don't know why. Fixed it.
4241 4249 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4242 4250 eps output.
4243 4251
4244 4252 2002-11-12 Fernando Perez <fperez@colorado.edu>
4245 4253
4246 4254 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4247 4255 don't propagate up to caller. Fixes crash reported by François
4248 4256 Pinard.
4249 4257
4250 4258 2002-11-09 Fernando Perez <fperez@colorado.edu>
4251 4259
4252 4260 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4253 4261 history file for new users.
4254 4262 (make_IPython): fixed bug where initial install would leave the
4255 4263 user running in the .ipython dir.
4256 4264 (make_IPython): fixed bug where config dir .ipython would be
4257 4265 created regardless of the given -ipythondir option. Thanks to Cory
4258 4266 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4259 4267
4260 4268 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4261 4269 type confirmations. Will need to use it in all of IPython's code
4262 4270 consistently.
4263 4271
4264 4272 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4265 4273 context to print 31 lines instead of the default 5. This will make
4266 4274 the crash reports extremely detailed in case the problem is in
4267 4275 libraries I don't have access to.
4268 4276
4269 4277 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4270 4278 line of defense' code to still crash, but giving users fair
4271 4279 warning. I don't want internal errors to go unreported: if there's
4272 4280 an internal problem, IPython should crash and generate a full
4273 4281 report.
4274 4282
4275 4283 2002-11-08 Fernando Perez <fperez@colorado.edu>
4276 4284
4277 4285 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4278 4286 otherwise uncaught exceptions which can appear if people set
4279 4287 sys.stdout to something badly broken. Thanks to a crash report
4280 4288 from henni-AT-mail.brainbot.com.
4281 4289
4282 4290 2002-11-04 Fernando Perez <fperez@colorado.edu>
4283 4291
4284 4292 * IPython/iplib.py (InteractiveShell.interact): added
4285 4293 __IPYTHON__active to the builtins. It's a flag which goes on when
4286 4294 the interaction starts and goes off again when it stops. This
4287 4295 allows embedding code to detect being inside IPython. Before this
4288 4296 was done via __IPYTHON__, but that only shows that an IPython
4289 4297 instance has been created.
4290 4298
4291 4299 * IPython/Magic.py (Magic.magic_env): I realized that in a
4292 4300 UserDict, instance.data holds the data as a normal dict. So I
4293 4301 modified @env to return os.environ.data instead of rebuilding a
4294 4302 dict by hand.
4295 4303
4296 4304 2002-11-02 Fernando Perez <fperez@colorado.edu>
4297 4305
4298 4306 * IPython/genutils.py (warn): changed so that level 1 prints no
4299 4307 header. Level 2 is now the default (with 'WARNING' header, as
4300 4308 before). I think I tracked all places where changes were needed in
4301 4309 IPython, but outside code using the old level numbering may have
4302 4310 broken.
4303 4311
4304 4312 * IPython/iplib.py (InteractiveShell.runcode): added this to
4305 4313 handle the tracebacks in SystemExit traps correctly. The previous
4306 4314 code (through interact) was printing more of the stack than
4307 4315 necessary, showing IPython internal code to the user.
4308 4316
4309 4317 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4310 4318 default. Now that the default at the confirmation prompt is yes,
4311 4319 it's not so intrusive. François' argument that ipython sessions
4312 4320 tend to be complex enough not to lose them from an accidental C-d,
4313 4321 is a valid one.
4314 4322
4315 4323 * IPython/iplib.py (InteractiveShell.interact): added a
4316 4324 showtraceback() call to the SystemExit trap, and modified the exit
4317 4325 confirmation to have yes as the default.
4318 4326
4319 4327 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4320 4328 this file. It's been gone from the code for a long time, this was
4321 4329 simply leftover junk.
4322 4330
4323 4331 2002-11-01 Fernando Perez <fperez@colorado.edu>
4324 4332
4325 4333 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4326 4334 added. If set, IPython now traps EOF and asks for
4327 4335 confirmation. After a request by François Pinard.
4328 4336
4329 4337 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4330 4338 of @abort, and with a new (better) mechanism for handling the
4331 4339 exceptions.
4332 4340
4333 4341 2002-10-27 Fernando Perez <fperez@colorado.edu>
4334 4342
4335 4343 * IPython/usage.py (__doc__): updated the --help information and
4336 4344 the ipythonrc file to indicate that -log generates
4337 4345 ./ipython.log. Also fixed the corresponding info in @logstart.
4338 4346 This and several other fixes in the manuals thanks to reports by
4339 4347 François Pinard <pinard-AT-iro.umontreal.ca>.
4340 4348
4341 4349 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4342 4350 refer to @logstart (instead of @log, which doesn't exist).
4343 4351
4344 4352 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4345 4353 AttributeError crash. Thanks to Christopher Armstrong
4346 4354 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4347 4355 introduced recently (in 0.2.14pre37) with the fix to the eval
4348 4356 problem mentioned below.
4349 4357
4350 4358 2002-10-17 Fernando Perez <fperez@colorado.edu>
4351 4359
4352 4360 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4353 4361 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4354 4362
4355 4363 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4356 4364 this function to fix a problem reported by Alex Schmolck. He saw
4357 4365 it with list comprehensions and generators, which were getting
4358 4366 called twice. The real problem was an 'eval' call in testing for
4359 4367 automagic which was evaluating the input line silently.
4360 4368
4361 4369 This is a potentially very nasty bug, if the input has side
4362 4370 effects which must not be repeated. The code is much cleaner now,
4363 4371 without any blanket 'except' left and with a regexp test for
4364 4372 actual function names.
4365 4373
4366 4374 But an eval remains, which I'm not fully comfortable with. I just
4367 4375 don't know how to find out if an expression could be a callable in
4368 4376 the user's namespace without doing an eval on the string. However
4369 4377 that string is now much more strictly checked so that no code
4370 4378 slips by, so the eval should only happen for things that can
4371 4379 really be only function/method names.
4372 4380
4373 4381 2002-10-15 Fernando Perez <fperez@colorado.edu>
4374 4382
4375 4383 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4376 4384 OSX information to main manual, removed README_Mac_OSX file from
4377 4385 distribution. Also updated credits for recent additions.
4378 4386
4379 4387 2002-10-10 Fernando Perez <fperez@colorado.edu>
4380 4388
4381 4389 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4382 4390 terminal-related issues. Many thanks to Andrea Riciputi
4383 4391 <andrea.riciputi-AT-libero.it> for writing it.
4384 4392
4385 4393 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4386 4394 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4387 4395
4388 4396 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4389 4397 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4390 4398 <syver-en-AT-online.no> who both submitted patches for this problem.
4391 4399
4392 4400 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4393 4401 global embedding to make sure that things don't overwrite user
4394 4402 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4395 4403
4396 4404 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4397 4405 compatibility. Thanks to Hayden Callow
4398 4406 <h.callow-AT-elec.canterbury.ac.nz>
4399 4407
4400 4408 2002-10-04 Fernando Perez <fperez@colorado.edu>
4401 4409
4402 4410 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4403 4411 Gnuplot.File objects.
4404 4412
4405 4413 2002-07-23 Fernando Perez <fperez@colorado.edu>
4406 4414
4407 4415 * IPython/genutils.py (timing): Added timings() and timing() for
4408 4416 quick access to the most commonly needed data, the execution
4409 4417 times. Old timing() renamed to timings_out().
4410 4418
4411 4419 2002-07-18 Fernando Perez <fperez@colorado.edu>
4412 4420
4413 4421 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4414 4422 bug with nested instances disrupting the parent's tab completion.
4415 4423
4416 4424 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4417 4425 all_completions code to begin the emacs integration.
4418 4426
4419 4427 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4420 4428 argument to allow titling individual arrays when plotting.
4421 4429
4422 4430 2002-07-15 Fernando Perez <fperez@colorado.edu>
4423 4431
4424 4432 * setup.py (make_shortcut): changed to retrieve the value of
4425 4433 'Program Files' directory from the registry (this value changes in
4426 4434 non-english versions of Windows). Thanks to Thomas Fanslau
4427 4435 <tfanslau-AT-gmx.de> for the report.
4428 4436
4429 4437 2002-07-10 Fernando Perez <fperez@colorado.edu>
4430 4438
4431 4439 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4432 4440 a bug in pdb, which crashes if a line with only whitespace is
4433 4441 entered. Bug report submitted to sourceforge.
4434 4442
4435 4443 2002-07-09 Fernando Perez <fperez@colorado.edu>
4436 4444
4437 4445 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4438 4446 reporting exceptions (it's a bug in inspect.py, I just set a
4439 4447 workaround).
4440 4448
4441 4449 2002-07-08 Fernando Perez <fperez@colorado.edu>
4442 4450
4443 4451 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4444 4452 __IPYTHON__ in __builtins__ to show up in user_ns.
4445 4453
4446 4454 2002-07-03 Fernando Perez <fperez@colorado.edu>
4447 4455
4448 4456 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4449 4457 name from @gp_set_instance to @gp_set_default.
4450 4458
4451 4459 * IPython/ipmaker.py (make_IPython): default editor value set to
4452 4460 '0' (a string), to match the rc file. Otherwise will crash when
4453 4461 .strip() is called on it.
4454 4462
4455 4463
4456 4464 2002-06-28 Fernando Perez <fperez@colorado.edu>
4457 4465
4458 4466 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4459 4467 of files in current directory when a file is executed via
4460 4468 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4461 4469
4462 4470 * setup.py (manfiles): fix for rpm builds, submitted by RA
4463 4471 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4464 4472
4465 4473 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4466 4474 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4467 4475 string!). A. Schmolck caught this one.
4468 4476
4469 4477 2002-06-27 Fernando Perez <fperez@colorado.edu>
4470 4478
4471 4479 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4472 4480 defined files at the cmd line. __name__ wasn't being set to
4473 4481 __main__.
4474 4482
4475 4483 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4476 4484 regular lists and tuples besides Numeric arrays.
4477 4485
4478 4486 * IPython/Prompts.py (CachedOutput.__call__): Added output
4479 4487 supression for input ending with ';'. Similar to Mathematica and
4480 4488 Matlab. The _* vars and Out[] list are still updated, just like
4481 4489 Mathematica behaves.
4482 4490
4483 4491 2002-06-25 Fernando Perez <fperez@colorado.edu>
4484 4492
4485 4493 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4486 4494 .ini extensions for profiels under Windows.
4487 4495
4488 4496 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4489 4497 string form. Fix contributed by Alexander Schmolck
4490 4498 <a.schmolck-AT-gmx.net>
4491 4499
4492 4500 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4493 4501 pre-configured Gnuplot instance.
4494 4502
4495 4503 2002-06-21 Fernando Perez <fperez@colorado.edu>
4496 4504
4497 4505 * IPython/numutils.py (exp_safe): new function, works around the
4498 4506 underflow problems in Numeric.
4499 4507 (log2): New fn. Safe log in base 2: returns exact integer answer
4500 4508 for exact integer powers of 2.
4501 4509
4502 4510 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4503 4511 properly.
4504 4512
4505 4513 2002-06-20 Fernando Perez <fperez@colorado.edu>
4506 4514
4507 4515 * IPython/genutils.py (timing): new function like
4508 4516 Mathematica's. Similar to time_test, but returns more info.
4509 4517
4510 4518 2002-06-18 Fernando Perez <fperez@colorado.edu>
4511 4519
4512 4520 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4513 4521 according to Mike Heeter's suggestions.
4514 4522
4515 4523 2002-06-16 Fernando Perez <fperez@colorado.edu>
4516 4524
4517 4525 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4518 4526 system. GnuplotMagic is gone as a user-directory option. New files
4519 4527 make it easier to use all the gnuplot stuff both from external
4520 4528 programs as well as from IPython. Had to rewrite part of
4521 4529 hardcopy() b/c of a strange bug: often the ps files simply don't
4522 4530 get created, and require a repeat of the command (often several
4523 4531 times).
4524 4532
4525 4533 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4526 4534 resolve output channel at call time, so that if sys.stderr has
4527 4535 been redirected by user this gets honored.
4528 4536
4529 4537 2002-06-13 Fernando Perez <fperez@colorado.edu>
4530 4538
4531 4539 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4532 4540 IPShell. Kept a copy with the old names to avoid breaking people's
4533 4541 embedded code.
4534 4542
4535 4543 * IPython/ipython: simplified it to the bare minimum after
4536 4544 Holger's suggestions. Added info about how to use it in
4537 4545 PYTHONSTARTUP.
4538 4546
4539 4547 * IPython/Shell.py (IPythonShell): changed the options passing
4540 4548 from a string with funky %s replacements to a straight list. Maybe
4541 4549 a bit more typing, but it follows sys.argv conventions, so there's
4542 4550 less special-casing to remember.
4543 4551
4544 4552 2002-06-12 Fernando Perez <fperez@colorado.edu>
4545 4553
4546 4554 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4547 4555 command. Thanks to a suggestion by Mike Heeter.
4548 4556 (Magic.magic_pfile): added behavior to look at filenames if given
4549 4557 arg is not a defined object.
4550 4558 (Magic.magic_save): New @save function to save code snippets. Also
4551 4559 a Mike Heeter idea.
4552 4560
4553 4561 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4554 4562 plot() and replot(). Much more convenient now, especially for
4555 4563 interactive use.
4556 4564
4557 4565 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4558 4566 filenames.
4559 4567
4560 4568 2002-06-02 Fernando Perez <fperez@colorado.edu>
4561 4569
4562 4570 * IPython/Struct.py (Struct.__init__): modified to admit
4563 4571 initialization via another struct.
4564 4572
4565 4573 * IPython/genutils.py (SystemExec.__init__): New stateful
4566 4574 interface to xsys and bq. Useful for writing system scripts.
4567 4575
4568 4576 2002-05-30 Fernando Perez <fperez@colorado.edu>
4569 4577
4570 4578 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4571 4579 documents. This will make the user download smaller (it's getting
4572 4580 too big).
4573 4581
4574 4582 2002-05-29 Fernando Perez <fperez@colorado.edu>
4575 4583
4576 4584 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4577 4585 fix problems with shelve and pickle. Seems to work, but I don't
4578 4586 know if corner cases break it. Thanks to Mike Heeter
4579 4587 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4580 4588
4581 4589 2002-05-24 Fernando Perez <fperez@colorado.edu>
4582 4590
4583 4591 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4584 4592 macros having broken.
4585 4593
4586 4594 2002-05-21 Fernando Perez <fperez@colorado.edu>
4587 4595
4588 4596 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4589 4597 introduced logging bug: all history before logging started was
4590 4598 being written one character per line! This came from the redesign
4591 4599 of the input history as a special list which slices to strings,
4592 4600 not to lists.
4593 4601
4594 4602 2002-05-20 Fernando Perez <fperez@colorado.edu>
4595 4603
4596 4604 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4597 4605 be an attribute of all classes in this module. The design of these
4598 4606 classes needs some serious overhauling.
4599 4607
4600 4608 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4601 4609 which was ignoring '_' in option names.
4602 4610
4603 4611 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4604 4612 'Verbose_novars' to 'Context' and made it the new default. It's a
4605 4613 bit more readable and also safer than verbose.
4606 4614
4607 4615 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4608 4616 triple-quoted strings.
4609 4617
4610 4618 * IPython/OInspect.py (__all__): new module exposing the object
4611 4619 introspection facilities. Now the corresponding magics are dummy
4612 4620 wrappers around this. Having this module will make it much easier
4613 4621 to put these functions into our modified pdb.
4614 4622 This new object inspector system uses the new colorizing module,
4615 4623 so source code and other things are nicely syntax highlighted.
4616 4624
4617 4625 2002-05-18 Fernando Perez <fperez@colorado.edu>
4618 4626
4619 4627 * IPython/ColorANSI.py: Split the coloring tools into a separate
4620 4628 module so I can use them in other code easier (they were part of
4621 4629 ultraTB).
4622 4630
4623 4631 2002-05-17 Fernando Perez <fperez@colorado.edu>
4624 4632
4625 4633 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4626 4634 fixed it to set the global 'g' also to the called instance, as
4627 4635 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4628 4636 user's 'g' variables).
4629 4637
4630 4638 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4631 4639 global variables (aliases to _ih,_oh) so that users which expect
4632 4640 In[5] or Out[7] to work aren't unpleasantly surprised.
4633 4641 (InputList.__getslice__): new class to allow executing slices of
4634 4642 input history directly. Very simple class, complements the use of
4635 4643 macros.
4636 4644
4637 4645 2002-05-16 Fernando Perez <fperez@colorado.edu>
4638 4646
4639 4647 * setup.py (docdirbase): make doc directory be just doc/IPython
4640 4648 without version numbers, it will reduce clutter for users.
4641 4649
4642 4650 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4643 4651 execfile call to prevent possible memory leak. See for details:
4644 4652 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4645 4653
4646 4654 2002-05-15 Fernando Perez <fperez@colorado.edu>
4647 4655
4648 4656 * IPython/Magic.py (Magic.magic_psource): made the object
4649 4657 introspection names be more standard: pdoc, pdef, pfile and
4650 4658 psource. They all print/page their output, and it makes
4651 4659 remembering them easier. Kept old names for compatibility as
4652 4660 aliases.
4653 4661
4654 4662 2002-05-14 Fernando Perez <fperez@colorado.edu>
4655 4663
4656 4664 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4657 4665 what the mouse problem was. The trick is to use gnuplot with temp
4658 4666 files and NOT with pipes (for data communication), because having
4659 4667 both pipes and the mouse on is bad news.
4660 4668
4661 4669 2002-05-13 Fernando Perez <fperez@colorado.edu>
4662 4670
4663 4671 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4664 4672 bug. Information would be reported about builtins even when
4665 4673 user-defined functions overrode them.
4666 4674
4667 4675 2002-05-11 Fernando Perez <fperez@colorado.edu>
4668 4676
4669 4677 * IPython/__init__.py (__all__): removed FlexCompleter from
4670 4678 __all__ so that things don't fail in platforms without readline.
4671 4679
4672 4680 2002-05-10 Fernando Perez <fperez@colorado.edu>
4673 4681
4674 4682 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4675 4683 it requires Numeric, effectively making Numeric a dependency for
4676 4684 IPython.
4677 4685
4678 4686 * Released 0.2.13
4679 4687
4680 4688 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4681 4689 profiler interface. Now all the major options from the profiler
4682 4690 module are directly supported in IPython, both for single
4683 4691 expressions (@prun) and for full programs (@run -p).
4684 4692
4685 4693 2002-05-09 Fernando Perez <fperez@colorado.edu>
4686 4694
4687 4695 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4688 4696 magic properly formatted for screen.
4689 4697
4690 4698 * setup.py (make_shortcut): Changed things to put pdf version in
4691 4699 doc/ instead of doc/manual (had to change lyxport a bit).
4692 4700
4693 4701 * IPython/Magic.py (Profile.string_stats): made profile runs go
4694 4702 through pager (they are long and a pager allows searching, saving,
4695 4703 etc.)
4696 4704
4697 4705 2002-05-08 Fernando Perez <fperez@colorado.edu>
4698 4706
4699 4707 * Released 0.2.12
4700 4708
4701 4709 2002-05-06 Fernando Perez <fperez@colorado.edu>
4702 4710
4703 4711 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4704 4712 introduced); 'hist n1 n2' was broken.
4705 4713 (Magic.magic_pdb): added optional on/off arguments to @pdb
4706 4714 (Magic.magic_run): added option -i to @run, which executes code in
4707 4715 the IPython namespace instead of a clean one. Also added @irun as
4708 4716 an alias to @run -i.
4709 4717
4710 4718 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4711 4719 fixed (it didn't really do anything, the namespaces were wrong).
4712 4720
4713 4721 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4714 4722
4715 4723 * IPython/__init__.py (__all__): Fixed package namespace, now
4716 4724 'import IPython' does give access to IPython.<all> as
4717 4725 expected. Also renamed __release__ to Release.
4718 4726
4719 4727 * IPython/Debugger.py (__license__): created new Pdb class which
4720 4728 functions like a drop-in for the normal pdb.Pdb but does NOT
4721 4729 import readline by default. This way it doesn't muck up IPython's
4722 4730 readline handling, and now tab-completion finally works in the
4723 4731 debugger -- sort of. It completes things globally visible, but the
4724 4732 completer doesn't track the stack as pdb walks it. That's a bit
4725 4733 tricky, and I'll have to implement it later.
4726 4734
4727 4735 2002-05-05 Fernando Perez <fperez@colorado.edu>
4728 4736
4729 4737 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4730 4738 magic docstrings when printed via ? (explicit \'s were being
4731 4739 printed).
4732 4740
4733 4741 * IPython/ipmaker.py (make_IPython): fixed namespace
4734 4742 identification bug. Now variables loaded via logs or command-line
4735 4743 files are recognized in the interactive namespace by @who.
4736 4744
4737 4745 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4738 4746 log replay system stemming from the string form of Structs.
4739 4747
4740 4748 * IPython/Magic.py (Macro.__init__): improved macros to properly
4741 4749 handle magic commands in them.
4742 4750 (Magic.magic_logstart): usernames are now expanded so 'logstart
4743 4751 ~/mylog' now works.
4744 4752
4745 4753 * IPython/iplib.py (complete): fixed bug where paths starting with
4746 4754 '/' would be completed as magic names.
4747 4755
4748 4756 2002-05-04 Fernando Perez <fperez@colorado.edu>
4749 4757
4750 4758 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4751 4759 allow running full programs under the profiler's control.
4752 4760
4753 4761 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4754 4762 mode to report exceptions verbosely but without formatting
4755 4763 variables. This addresses the issue of ipython 'freezing' (it's
4756 4764 not frozen, but caught in an expensive formatting loop) when huge
4757 4765 variables are in the context of an exception.
4758 4766 (VerboseTB.text): Added '--->' markers at line where exception was
4759 4767 triggered. Much clearer to read, especially in NoColor modes.
4760 4768
4761 4769 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4762 4770 implemented in reverse when changing to the new parse_options().
4763 4771
4764 4772 2002-05-03 Fernando Perez <fperez@colorado.edu>
4765 4773
4766 4774 * IPython/Magic.py (Magic.parse_options): new function so that
4767 4775 magics can parse options easier.
4768 4776 (Magic.magic_prun): new function similar to profile.run(),
4769 4777 suggested by Chris Hart.
4770 4778 (Magic.magic_cd): fixed behavior so that it only changes if
4771 4779 directory actually is in history.
4772 4780
4773 4781 * IPython/usage.py (__doc__): added information about potential
4774 4782 slowness of Verbose exception mode when there are huge data
4775 4783 structures to be formatted (thanks to Archie Paulson).
4776 4784
4777 4785 * IPython/ipmaker.py (make_IPython): Changed default logging
4778 4786 (when simply called with -log) to use curr_dir/ipython.log in
4779 4787 rotate mode. Fixed crash which was occuring with -log before
4780 4788 (thanks to Jim Boyle).
4781 4789
4782 4790 2002-05-01 Fernando Perez <fperez@colorado.edu>
4783 4791
4784 4792 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4785 4793 was nasty -- though somewhat of a corner case).
4786 4794
4787 4795 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4788 4796 text (was a bug).
4789 4797
4790 4798 2002-04-30 Fernando Perez <fperez@colorado.edu>
4791 4799
4792 4800 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4793 4801 a print after ^D or ^C from the user so that the In[] prompt
4794 4802 doesn't over-run the gnuplot one.
4795 4803
4796 4804 2002-04-29 Fernando Perez <fperez@colorado.edu>
4797 4805
4798 4806 * Released 0.2.10
4799 4807
4800 4808 * IPython/__release__.py (version): get date dynamically.
4801 4809
4802 4810 * Misc. documentation updates thanks to Arnd's comments. Also ran
4803 4811 a full spellcheck on the manual (hadn't been done in a while).
4804 4812
4805 4813 2002-04-27 Fernando Perez <fperez@colorado.edu>
4806 4814
4807 4815 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4808 4816 starting a log in mid-session would reset the input history list.
4809 4817
4810 4818 2002-04-26 Fernando Perez <fperez@colorado.edu>
4811 4819
4812 4820 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4813 4821 all files were being included in an update. Now anything in
4814 4822 UserConfig that matches [A-Za-z]*.py will go (this excludes
4815 4823 __init__.py)
4816 4824
4817 4825 2002-04-25 Fernando Perez <fperez@colorado.edu>
4818 4826
4819 4827 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4820 4828 to __builtins__ so that any form of embedded or imported code can
4821 4829 test for being inside IPython.
4822 4830
4823 4831 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4824 4832 changed to GnuplotMagic because it's now an importable module,
4825 4833 this makes the name follow that of the standard Gnuplot module.
4826 4834 GnuplotMagic can now be loaded at any time in mid-session.
4827 4835
4828 4836 2002-04-24 Fernando Perez <fperez@colorado.edu>
4829 4837
4830 4838 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4831 4839 the globals (IPython has its own namespace) and the
4832 4840 PhysicalQuantity stuff is much better anyway.
4833 4841
4834 4842 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4835 4843 embedding example to standard user directory for
4836 4844 distribution. Also put it in the manual.
4837 4845
4838 4846 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4839 4847 instance as first argument (so it doesn't rely on some obscure
4840 4848 hidden global).
4841 4849
4842 4850 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4843 4851 delimiters. While it prevents ().TAB from working, it allows
4844 4852 completions in open (... expressions. This is by far a more common
4845 4853 case.
4846 4854
4847 4855 2002-04-23 Fernando Perez <fperez@colorado.edu>
4848 4856
4849 4857 * IPython/Extensions/InterpreterPasteInput.py: new
4850 4858 syntax-processing module for pasting lines with >>> or ... at the
4851 4859 start.
4852 4860
4853 4861 * IPython/Extensions/PhysicalQ_Interactive.py
4854 4862 (PhysicalQuantityInteractive.__int__): fixed to work with either
4855 4863 Numeric or math.
4856 4864
4857 4865 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4858 4866 provided profiles. Now we have:
4859 4867 -math -> math module as * and cmath with its own namespace.
4860 4868 -numeric -> Numeric as *, plus gnuplot & grace
4861 4869 -physics -> same as before
4862 4870
4863 4871 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4864 4872 user-defined magics wouldn't be found by @magic if they were
4865 4873 defined as class methods. Also cleaned up the namespace search
4866 4874 logic and the string building (to use %s instead of many repeated
4867 4875 string adds).
4868 4876
4869 4877 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4870 4878 of user-defined magics to operate with class methods (cleaner, in
4871 4879 line with the gnuplot code).
4872 4880
4873 4881 2002-04-22 Fernando Perez <fperez@colorado.edu>
4874 4882
4875 4883 * setup.py: updated dependency list so that manual is updated when
4876 4884 all included files change.
4877 4885
4878 4886 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4879 4887 the delimiter removal option (the fix is ugly right now).
4880 4888
4881 4889 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4882 4890 all of the math profile (quicker loading, no conflict between
4883 4891 g-9.8 and g-gnuplot).
4884 4892
4885 4893 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4886 4894 name of post-mortem files to IPython_crash_report.txt.
4887 4895
4888 4896 * Cleanup/update of the docs. Added all the new readline info and
4889 4897 formatted all lists as 'real lists'.
4890 4898
4891 4899 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4892 4900 tab-completion options, since the full readline parse_and_bind is
4893 4901 now accessible.
4894 4902
4895 4903 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4896 4904 handling of readline options. Now users can specify any string to
4897 4905 be passed to parse_and_bind(), as well as the delimiters to be
4898 4906 removed.
4899 4907 (InteractiveShell.__init__): Added __name__ to the global
4900 4908 namespace so that things like Itpl which rely on its existence
4901 4909 don't crash.
4902 4910 (InteractiveShell._prefilter): Defined the default with a _ so
4903 4911 that prefilter() is easier to override, while the default one
4904 4912 remains available.
4905 4913
4906 4914 2002-04-18 Fernando Perez <fperez@colorado.edu>
4907 4915
4908 4916 * Added information about pdb in the docs.
4909 4917
4910 4918 2002-04-17 Fernando Perez <fperez@colorado.edu>
4911 4919
4912 4920 * IPython/ipmaker.py (make_IPython): added rc_override option to
4913 4921 allow passing config options at creation time which may override
4914 4922 anything set in the config files or command line. This is
4915 4923 particularly useful for configuring embedded instances.
4916 4924
4917 4925 2002-04-15 Fernando Perez <fperez@colorado.edu>
4918 4926
4919 4927 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4920 4928 crash embedded instances because of the input cache falling out of
4921 4929 sync with the output counter.
4922 4930
4923 4931 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4924 4932 mode which calls pdb after an uncaught exception in IPython itself.
4925 4933
4926 4934 2002-04-14 Fernando Perez <fperez@colorado.edu>
4927 4935
4928 4936 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4929 4937 readline, fix it back after each call.
4930 4938
4931 4939 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4932 4940 method to force all access via __call__(), which guarantees that
4933 4941 traceback references are properly deleted.
4934 4942
4935 4943 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4936 4944 improve printing when pprint is in use.
4937 4945
4938 4946 2002-04-13 Fernando Perez <fperez@colorado.edu>
4939 4947
4940 4948 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4941 4949 exceptions aren't caught anymore. If the user triggers one, he
4942 4950 should know why he's doing it and it should go all the way up,
4943 4951 just like any other exception. So now @abort will fully kill the
4944 4952 embedded interpreter and the embedding code (unless that happens
4945 4953 to catch SystemExit).
4946 4954
4947 4955 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4948 4956 and a debugger() method to invoke the interactive pdb debugger
4949 4957 after printing exception information. Also added the corresponding
4950 4958 -pdb option and @pdb magic to control this feature, and updated
4951 4959 the docs. After a suggestion from Christopher Hart
4952 4960 (hart-AT-caltech.edu).
4953 4961
4954 4962 2002-04-12 Fernando Perez <fperez@colorado.edu>
4955 4963
4956 4964 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4957 4965 the exception handlers defined by the user (not the CrashHandler)
4958 4966 so that user exceptions don't trigger an ipython bug report.
4959 4967
4960 4968 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4961 4969 configurable (it should have always been so).
4962 4970
4963 4971 2002-03-26 Fernando Perez <fperez@colorado.edu>
4964 4972
4965 4973 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4966 4974 and there to fix embedding namespace issues. This should all be
4967 4975 done in a more elegant way.
4968 4976
4969 4977 2002-03-25 Fernando Perez <fperez@colorado.edu>
4970 4978
4971 4979 * IPython/genutils.py (get_home_dir): Try to make it work under
4972 4980 win9x also.
4973 4981
4974 4982 2002-03-20 Fernando Perez <fperez@colorado.edu>
4975 4983
4976 4984 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4977 4985 sys.displayhook untouched upon __init__.
4978 4986
4979 4987 2002-03-19 Fernando Perez <fperez@colorado.edu>
4980 4988
4981 4989 * Released 0.2.9 (for embedding bug, basically).
4982 4990
4983 4991 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4984 4992 exceptions so that enclosing shell's state can be restored.
4985 4993
4986 4994 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4987 4995 naming conventions in the .ipython/ dir.
4988 4996
4989 4997 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4990 4998 from delimiters list so filenames with - in them get expanded.
4991 4999
4992 5000 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4993 5001 sys.displayhook not being properly restored after an embedded call.
4994 5002
4995 5003 2002-03-18 Fernando Perez <fperez@colorado.edu>
4996 5004
4997 5005 * Released 0.2.8
4998 5006
4999 5007 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5000 5008 some files weren't being included in a -upgrade.
5001 5009 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5002 5010 on' so that the first tab completes.
5003 5011 (InteractiveShell.handle_magic): fixed bug with spaces around
5004 5012 quotes breaking many magic commands.
5005 5013
5006 5014 * setup.py: added note about ignoring the syntax error messages at
5007 5015 installation.
5008 5016
5009 5017 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5010 5018 streamlining the gnuplot interface, now there's only one magic @gp.
5011 5019
5012 5020 2002-03-17 Fernando Perez <fperez@colorado.edu>
5013 5021
5014 5022 * IPython/UserConfig/magic_gnuplot.py: new name for the
5015 5023 example-magic_pm.py file. Much enhanced system, now with a shell
5016 5024 for communicating directly with gnuplot, one command at a time.
5017 5025
5018 5026 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5019 5027 setting __name__=='__main__'.
5020 5028
5021 5029 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5022 5030 mini-shell for accessing gnuplot from inside ipython. Should
5023 5031 extend it later for grace access too. Inspired by Arnd's
5024 5032 suggestion.
5025 5033
5026 5034 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5027 5035 calling magic functions with () in their arguments. Thanks to Arnd
5028 5036 Baecker for pointing this to me.
5029 5037
5030 5038 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5031 5039 infinitely for integer or complex arrays (only worked with floats).
5032 5040
5033 5041 2002-03-16 Fernando Perez <fperez@colorado.edu>
5034 5042
5035 5043 * setup.py: Merged setup and setup_windows into a single script
5036 5044 which properly handles things for windows users.
5037 5045
5038 5046 2002-03-15 Fernando Perez <fperez@colorado.edu>
5039 5047
5040 5048 * Big change to the manual: now the magics are all automatically
5041 5049 documented. This information is generated from their docstrings
5042 5050 and put in a latex file included by the manual lyx file. This way
5043 5051 we get always up to date information for the magics. The manual
5044 5052 now also has proper version information, also auto-synced.
5045 5053
5046 5054 For this to work, an undocumented --magic_docstrings option was added.
5047 5055
5048 5056 2002-03-13 Fernando Perez <fperez@colorado.edu>
5049 5057
5050 5058 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5051 5059 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5052 5060
5053 5061 2002-03-12 Fernando Perez <fperez@colorado.edu>
5054 5062
5055 5063 * IPython/ultraTB.py (TermColors): changed color escapes again to
5056 5064 fix the (old, reintroduced) line-wrapping bug. Basically, if
5057 5065 \001..\002 aren't given in the color escapes, lines get wrapped
5058 5066 weirdly. But giving those screws up old xterms and emacs terms. So
5059 5067 I added some logic for emacs terms to be ok, but I can't identify old
5060 5068 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5061 5069
5062 5070 2002-03-10 Fernando Perez <fperez@colorado.edu>
5063 5071
5064 5072 * IPython/usage.py (__doc__): Various documentation cleanups and
5065 5073 updates, both in usage docstrings and in the manual.
5066 5074
5067 5075 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5068 5076 handling of caching. Set minimum acceptabe value for having a
5069 5077 cache at 20 values.
5070 5078
5071 5079 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5072 5080 install_first_time function to a method, renamed it and added an
5073 5081 'upgrade' mode. Now people can update their config directory with
5074 5082 a simple command line switch (-upgrade, also new).
5075 5083
5076 5084 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5077 5085 @file (convenient for automagic users under Python >= 2.2).
5078 5086 Removed @files (it seemed more like a plural than an abbrev. of
5079 5087 'file show').
5080 5088
5081 5089 * IPython/iplib.py (install_first_time): Fixed crash if there were
5082 5090 backup files ('~') in .ipython/ install directory.
5083 5091
5084 5092 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5085 5093 system. Things look fine, but these changes are fairly
5086 5094 intrusive. Test them for a few days.
5087 5095
5088 5096 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5089 5097 the prompts system. Now all in/out prompt strings are user
5090 5098 controllable. This is particularly useful for embedding, as one
5091 5099 can tag embedded instances with particular prompts.
5092 5100
5093 5101 Also removed global use of sys.ps1/2, which now allows nested
5094 5102 embeddings without any problems. Added command-line options for
5095 5103 the prompt strings.
5096 5104
5097 5105 2002-03-08 Fernando Perez <fperez@colorado.edu>
5098 5106
5099 5107 * IPython/UserConfig/example-embed-short.py (ipshell): added
5100 5108 example file with the bare minimum code for embedding.
5101 5109
5102 5110 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5103 5111 functionality for the embeddable shell to be activated/deactivated
5104 5112 either globally or at each call.
5105 5113
5106 5114 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5107 5115 rewriting the prompt with '--->' for auto-inputs with proper
5108 5116 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5109 5117 this is handled by the prompts class itself, as it should.
5110 5118
5111 5119 2002-03-05 Fernando Perez <fperez@colorado.edu>
5112 5120
5113 5121 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5114 5122 @logstart to avoid name clashes with the math log function.
5115 5123
5116 5124 * Big updates to X/Emacs section of the manual.
5117 5125
5118 5126 * Removed ipython_emacs. Milan explained to me how to pass
5119 5127 arguments to ipython through Emacs. Some day I'm going to end up
5120 5128 learning some lisp...
5121 5129
5122 5130 2002-03-04 Fernando Perez <fperez@colorado.edu>
5123 5131
5124 5132 * IPython/ipython_emacs: Created script to be used as the
5125 5133 py-python-command Emacs variable so we can pass IPython
5126 5134 parameters. I can't figure out how to tell Emacs directly to pass
5127 5135 parameters to IPython, so a dummy shell script will do it.
5128 5136
5129 5137 Other enhancements made for things to work better under Emacs'
5130 5138 various types of terminals. Many thanks to Milan Zamazal
5131 5139 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5132 5140
5133 5141 2002-03-01 Fernando Perez <fperez@colorado.edu>
5134 5142
5135 5143 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5136 5144 that loading of readline is now optional. This gives better
5137 5145 control to emacs users.
5138 5146
5139 5147 * IPython/ultraTB.py (__date__): Modified color escape sequences
5140 5148 and now things work fine under xterm and in Emacs' term buffers
5141 5149 (though not shell ones). Well, in emacs you get colors, but all
5142 5150 seem to be 'light' colors (no difference between dark and light
5143 5151 ones). But the garbage chars are gone, and also in xterms. It
5144 5152 seems that now I'm using 'cleaner' ansi sequences.
5145 5153
5146 5154 2002-02-21 Fernando Perez <fperez@colorado.edu>
5147 5155
5148 5156 * Released 0.2.7 (mainly to publish the scoping fix).
5149 5157
5150 5158 * IPython/Logger.py (Logger.logstate): added. A corresponding
5151 5159 @logstate magic was created.
5152 5160
5153 5161 * IPython/Magic.py: fixed nested scoping problem under Python
5154 5162 2.1.x (automagic wasn't working).
5155 5163
5156 5164 2002-02-20 Fernando Perez <fperez@colorado.edu>
5157 5165
5158 5166 * Released 0.2.6.
5159 5167
5160 5168 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5161 5169 option so that logs can come out without any headers at all.
5162 5170
5163 5171 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5164 5172 SciPy.
5165 5173
5166 5174 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5167 5175 that embedded IPython calls don't require vars() to be explicitly
5168 5176 passed. Now they are extracted from the caller's frame (code
5169 5177 snatched from Eric Jones' weave). Added better documentation to
5170 5178 the section on embedding and the example file.
5171 5179
5172 5180 * IPython/genutils.py (page): Changed so that under emacs, it just
5173 5181 prints the string. You can then page up and down in the emacs
5174 5182 buffer itself. This is how the builtin help() works.
5175 5183
5176 5184 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5177 5185 macro scoping: macros need to be executed in the user's namespace
5178 5186 to work as if they had been typed by the user.
5179 5187
5180 5188 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5181 5189 execute automatically (no need to type 'exec...'). They then
5182 5190 behave like 'true macros'. The printing system was also modified
5183 5191 for this to work.
5184 5192
5185 5193 2002-02-19 Fernando Perez <fperez@colorado.edu>
5186 5194
5187 5195 * IPython/genutils.py (page_file): new function for paging files
5188 5196 in an OS-independent way. Also necessary for file viewing to work
5189 5197 well inside Emacs buffers.
5190 5198 (page): Added checks for being in an emacs buffer.
5191 5199 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5192 5200 same bug in iplib.
5193 5201
5194 5202 2002-02-18 Fernando Perez <fperez@colorado.edu>
5195 5203
5196 5204 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5197 5205 of readline so that IPython can work inside an Emacs buffer.
5198 5206
5199 5207 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5200 5208 method signatures (they weren't really bugs, but it looks cleaner
5201 5209 and keeps PyChecker happy).
5202 5210
5203 5211 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5204 5212 for implementing various user-defined hooks. Currently only
5205 5213 display is done.
5206 5214
5207 5215 * IPython/Prompts.py (CachedOutput._display): changed display
5208 5216 functions so that they can be dynamically changed by users easily.
5209 5217
5210 5218 * IPython/Extensions/numeric_formats.py (num_display): added an
5211 5219 extension for printing NumPy arrays in flexible manners. It
5212 5220 doesn't do anything yet, but all the structure is in
5213 5221 place. Ultimately the plan is to implement output format control
5214 5222 like in Octave.
5215 5223
5216 5224 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5217 5225 methods are found at run-time by all the automatic machinery.
5218 5226
5219 5227 2002-02-17 Fernando Perez <fperez@colorado.edu>
5220 5228
5221 5229 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5222 5230 whole file a little.
5223 5231
5224 5232 * ToDo: closed this document. Now there's a new_design.lyx
5225 5233 document for all new ideas. Added making a pdf of it for the
5226 5234 end-user distro.
5227 5235
5228 5236 * IPython/Logger.py (Logger.switch_log): Created this to replace
5229 5237 logon() and logoff(). It also fixes a nasty crash reported by
5230 5238 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5231 5239
5232 5240 * IPython/iplib.py (complete): got auto-completion to work with
5233 5241 automagic (I had wanted this for a long time).
5234 5242
5235 5243 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5236 5244 to @file, since file() is now a builtin and clashes with automagic
5237 5245 for @file.
5238 5246
5239 5247 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5240 5248 of this was previously in iplib, which had grown to more than 2000
5241 5249 lines, way too long. No new functionality, but it makes managing
5242 5250 the code a bit easier.
5243 5251
5244 5252 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5245 5253 information to crash reports.
5246 5254
5247 5255 2002-02-12 Fernando Perez <fperez@colorado.edu>
5248 5256
5249 5257 * Released 0.2.5.
5250 5258
5251 5259 2002-02-11 Fernando Perez <fperez@colorado.edu>
5252 5260
5253 5261 * Wrote a relatively complete Windows installer. It puts
5254 5262 everything in place, creates Start Menu entries and fixes the
5255 5263 color issues. Nothing fancy, but it works.
5256 5264
5257 5265 2002-02-10 Fernando Perez <fperez@colorado.edu>
5258 5266
5259 5267 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5260 5268 os.path.expanduser() call so that we can type @run ~/myfile.py and
5261 5269 have thigs work as expected.
5262 5270
5263 5271 * IPython/genutils.py (page): fixed exception handling so things
5264 5272 work both in Unix and Windows correctly. Quitting a pager triggers
5265 5273 an IOError/broken pipe in Unix, and in windows not finding a pager
5266 5274 is also an IOError, so I had to actually look at the return value
5267 5275 of the exception, not just the exception itself. Should be ok now.
5268 5276
5269 5277 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5270 5278 modified to allow case-insensitive color scheme changes.
5271 5279
5272 5280 2002-02-09 Fernando Perez <fperez@colorado.edu>
5273 5281
5274 5282 * IPython/genutils.py (native_line_ends): new function to leave
5275 5283 user config files with os-native line-endings.
5276 5284
5277 5285 * README and manual updates.
5278 5286
5279 5287 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5280 5288 instead of StringType to catch Unicode strings.
5281 5289
5282 5290 * IPython/genutils.py (filefind): fixed bug for paths with
5283 5291 embedded spaces (very common in Windows).
5284 5292
5285 5293 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5286 5294 files under Windows, so that they get automatically associated
5287 5295 with a text editor. Windows makes it a pain to handle
5288 5296 extension-less files.
5289 5297
5290 5298 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5291 5299 warning about readline only occur for Posix. In Windows there's no
5292 5300 way to get readline, so why bother with the warning.
5293 5301
5294 5302 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5295 5303 for __str__ instead of dir(self), since dir() changed in 2.2.
5296 5304
5297 5305 * Ported to Windows! Tested on XP, I suspect it should work fine
5298 5306 on NT/2000, but I don't think it will work on 98 et al. That
5299 5307 series of Windows is such a piece of junk anyway that I won't try
5300 5308 porting it there. The XP port was straightforward, showed a few
5301 5309 bugs here and there (fixed all), in particular some string
5302 5310 handling stuff which required considering Unicode strings (which
5303 5311 Windows uses). This is good, but hasn't been too tested :) No
5304 5312 fancy installer yet, I'll put a note in the manual so people at
5305 5313 least make manually a shortcut.
5306 5314
5307 5315 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5308 5316 into a single one, "colors". This now controls both prompt and
5309 5317 exception color schemes, and can be changed both at startup
5310 5318 (either via command-line switches or via ipythonrc files) and at
5311 5319 runtime, with @colors.
5312 5320 (Magic.magic_run): renamed @prun to @run and removed the old
5313 5321 @run. The two were too similar to warrant keeping both.
5314 5322
5315 5323 2002-02-03 Fernando Perez <fperez@colorado.edu>
5316 5324
5317 5325 * IPython/iplib.py (install_first_time): Added comment on how to
5318 5326 configure the color options for first-time users. Put a <return>
5319 5327 request at the end so that small-terminal users get a chance to
5320 5328 read the startup info.
5321 5329
5322 5330 2002-01-23 Fernando Perez <fperez@colorado.edu>
5323 5331
5324 5332 * IPython/iplib.py (CachedOutput.update): Changed output memory
5325 5333 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5326 5334 input history we still use _i. Did this b/c these variable are
5327 5335 very commonly used in interactive work, so the less we need to
5328 5336 type the better off we are.
5329 5337 (Magic.magic_prun): updated @prun to better handle the namespaces
5330 5338 the file will run in, including a fix for __name__ not being set
5331 5339 before.
5332 5340
5333 5341 2002-01-20 Fernando Perez <fperez@colorado.edu>
5334 5342
5335 5343 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5336 5344 extra garbage for Python 2.2. Need to look more carefully into
5337 5345 this later.
5338 5346
5339 5347 2002-01-19 Fernando Perez <fperez@colorado.edu>
5340 5348
5341 5349 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5342 5350 display SyntaxError exceptions properly formatted when they occur
5343 5351 (they can be triggered by imported code).
5344 5352
5345 5353 2002-01-18 Fernando Perez <fperez@colorado.edu>
5346 5354
5347 5355 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5348 5356 SyntaxError exceptions are reported nicely formatted, instead of
5349 5357 spitting out only offset information as before.
5350 5358 (Magic.magic_prun): Added the @prun function for executing
5351 5359 programs with command line args inside IPython.
5352 5360
5353 5361 2002-01-16 Fernando Perez <fperez@colorado.edu>
5354 5362
5355 5363 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5356 5364 to *not* include the last item given in a range. This brings their
5357 5365 behavior in line with Python's slicing:
5358 5366 a[n1:n2] -> a[n1]...a[n2-1]
5359 5367 It may be a bit less convenient, but I prefer to stick to Python's
5360 5368 conventions *everywhere*, so users never have to wonder.
5361 5369 (Magic.magic_macro): Added @macro function to ease the creation of
5362 5370 macros.
5363 5371
5364 5372 2002-01-05 Fernando Perez <fperez@colorado.edu>
5365 5373
5366 5374 * Released 0.2.4.
5367 5375
5368 5376 * IPython/iplib.py (Magic.magic_pdef):
5369 5377 (InteractiveShell.safe_execfile): report magic lines and error
5370 5378 lines without line numbers so one can easily copy/paste them for
5371 5379 re-execution.
5372 5380
5373 5381 * Updated manual with recent changes.
5374 5382
5375 5383 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5376 5384 docstring printing when class? is called. Very handy for knowing
5377 5385 how to create class instances (as long as __init__ is well
5378 5386 documented, of course :)
5379 5387 (Magic.magic_doc): print both class and constructor docstrings.
5380 5388 (Magic.magic_pdef): give constructor info if passed a class and
5381 5389 __call__ info for callable object instances.
5382 5390
5383 5391 2002-01-04 Fernando Perez <fperez@colorado.edu>
5384 5392
5385 5393 * Made deep_reload() off by default. It doesn't always work
5386 5394 exactly as intended, so it's probably safer to have it off. It's
5387 5395 still available as dreload() anyway, so nothing is lost.
5388 5396
5389 5397 2002-01-02 Fernando Perez <fperez@colorado.edu>
5390 5398
5391 5399 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5392 5400 so I wanted an updated release).
5393 5401
5394 5402 2001-12-27 Fernando Perez <fperez@colorado.edu>
5395 5403
5396 5404 * IPython/iplib.py (InteractiveShell.interact): Added the original
5397 5405 code from 'code.py' for this module in order to change the
5398 5406 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5399 5407 the history cache would break when the user hit Ctrl-C, and
5400 5408 interact() offers no way to add any hooks to it.
5401 5409
5402 5410 2001-12-23 Fernando Perez <fperez@colorado.edu>
5403 5411
5404 5412 * setup.py: added check for 'MANIFEST' before trying to remove
5405 5413 it. Thanks to Sean Reifschneider.
5406 5414
5407 5415 2001-12-22 Fernando Perez <fperez@colorado.edu>
5408 5416
5409 5417 * Released 0.2.2.
5410 5418
5411 5419 * Finished (reasonably) writing the manual. Later will add the
5412 5420 python-standard navigation stylesheets, but for the time being
5413 5421 it's fairly complete. Distribution will include html and pdf
5414 5422 versions.
5415 5423
5416 5424 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5417 5425 (MayaVi author).
5418 5426
5419 5427 2001-12-21 Fernando Perez <fperez@colorado.edu>
5420 5428
5421 5429 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5422 5430 good public release, I think (with the manual and the distutils
5423 5431 installer). The manual can use some work, but that can go
5424 5432 slowly. Otherwise I think it's quite nice for end users. Next
5425 5433 summer, rewrite the guts of it...
5426 5434
5427 5435 * Changed format of ipythonrc files to use whitespace as the
5428 5436 separator instead of an explicit '='. Cleaner.
5429 5437
5430 5438 2001-12-20 Fernando Perez <fperez@colorado.edu>
5431 5439
5432 5440 * Started a manual in LyX. For now it's just a quick merge of the
5433 5441 various internal docstrings and READMEs. Later it may grow into a
5434 5442 nice, full-blown manual.
5435 5443
5436 5444 * Set up a distutils based installer. Installation should now be
5437 5445 trivially simple for end-users.
5438 5446
5439 5447 2001-12-11 Fernando Perez <fperez@colorado.edu>
5440 5448
5441 5449 * Released 0.2.0. First public release, announced it at
5442 5450 comp.lang.python. From now on, just bugfixes...
5443 5451
5444 5452 * Went through all the files, set copyright/license notices and
5445 5453 cleaned up things. Ready for release.
5446 5454
5447 5455 2001-12-10 Fernando Perez <fperez@colorado.edu>
5448 5456
5449 5457 * Changed the first-time installer not to use tarfiles. It's more
5450 5458 robust now and less unix-dependent. Also makes it easier for
5451 5459 people to later upgrade versions.
5452 5460
5453 5461 * Changed @exit to @abort to reflect the fact that it's pretty
5454 5462 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5455 5463 becomes significant only when IPyhton is embedded: in that case,
5456 5464 C-D closes IPython only, but @abort kills the enclosing program
5457 5465 too (unless it had called IPython inside a try catching
5458 5466 SystemExit).
5459 5467
5460 5468 * Created Shell module which exposes the actuall IPython Shell
5461 5469 classes, currently the normal and the embeddable one. This at
5462 5470 least offers a stable interface we won't need to change when
5463 5471 (later) the internals are rewritten. That rewrite will be confined
5464 5472 to iplib and ipmaker, but the Shell interface should remain as is.
5465 5473
5466 5474 * Added embed module which offers an embeddable IPShell object,
5467 5475 useful to fire up IPython *inside* a running program. Great for
5468 5476 debugging or dynamical data analysis.
5469 5477
5470 5478 2001-12-08 Fernando Perez <fperez@colorado.edu>
5471 5479
5472 5480 * Fixed small bug preventing seeing info from methods of defined
5473 5481 objects (incorrect namespace in _ofind()).
5474 5482
5475 5483 * Documentation cleanup. Moved the main usage docstrings to a
5476 5484 separate file, usage.py (cleaner to maintain, and hopefully in the
5477 5485 future some perlpod-like way of producing interactive, man and
5478 5486 html docs out of it will be found).
5479 5487
5480 5488 * Added @profile to see your profile at any time.
5481 5489
5482 5490 * Added @p as an alias for 'print'. It's especially convenient if
5483 5491 using automagic ('p x' prints x).
5484 5492
5485 5493 * Small cleanups and fixes after a pychecker run.
5486 5494
5487 5495 * Changed the @cd command to handle @cd - and @cd -<n> for
5488 5496 visiting any directory in _dh.
5489 5497
5490 5498 * Introduced _dh, a history of visited directories. @dhist prints
5491 5499 it out with numbers.
5492 5500
5493 5501 2001-12-07 Fernando Perez <fperez@colorado.edu>
5494 5502
5495 5503 * Released 0.1.22
5496 5504
5497 5505 * Made initialization a bit more robust against invalid color
5498 5506 options in user input (exit, not traceback-crash).
5499 5507
5500 5508 * Changed the bug crash reporter to write the report only in the
5501 5509 user's .ipython directory. That way IPython won't litter people's
5502 5510 hard disks with crash files all over the place. Also print on
5503 5511 screen the necessary mail command.
5504 5512
5505 5513 * With the new ultraTB, implemented LightBG color scheme for light
5506 5514 background terminals. A lot of people like white backgrounds, so I
5507 5515 guess we should at least give them something readable.
5508 5516
5509 5517 2001-12-06 Fernando Perez <fperez@colorado.edu>
5510 5518
5511 5519 * Modified the structure of ultraTB. Now there's a proper class
5512 5520 for tables of color schemes which allow adding schemes easily and
5513 5521 switching the active scheme without creating a new instance every
5514 5522 time (which was ridiculous). The syntax for creating new schemes
5515 5523 is also cleaner. I think ultraTB is finally done, with a clean
5516 5524 class structure. Names are also much cleaner (now there's proper
5517 5525 color tables, no need for every variable to also have 'color' in
5518 5526 its name).
5519 5527
5520 5528 * Broke down genutils into separate files. Now genutils only
5521 5529 contains utility functions, and classes have been moved to their
5522 5530 own files (they had enough independent functionality to warrant
5523 5531 it): ConfigLoader, OutputTrap, Struct.
5524 5532
5525 5533 2001-12-05 Fernando Perez <fperez@colorado.edu>
5526 5534
5527 5535 * IPython turns 21! Released version 0.1.21, as a candidate for
5528 5536 public consumption. If all goes well, release in a few days.
5529 5537
5530 5538 * Fixed path bug (files in Extensions/ directory wouldn't be found
5531 5539 unless IPython/ was explicitly in sys.path).
5532 5540
5533 5541 * Extended the FlexCompleter class as MagicCompleter to allow
5534 5542 completion of @-starting lines.
5535 5543
5536 5544 * Created __release__.py file as a central repository for release
5537 5545 info that other files can read from.
5538 5546
5539 5547 * Fixed small bug in logging: when logging was turned on in
5540 5548 mid-session, old lines with special meanings (!@?) were being
5541 5549 logged without the prepended comment, which is necessary since
5542 5550 they are not truly valid python syntax. This should make session
5543 5551 restores produce less errors.
5544 5552
5545 5553 * The namespace cleanup forced me to make a FlexCompleter class
5546 5554 which is nothing but a ripoff of rlcompleter, but with selectable
5547 5555 namespace (rlcompleter only works in __main__.__dict__). I'll try
5548 5556 to submit a note to the authors to see if this change can be
5549 5557 incorporated in future rlcompleter releases (Dec.6: done)
5550 5558
5551 5559 * More fixes to namespace handling. It was a mess! Now all
5552 5560 explicit references to __main__.__dict__ are gone (except when
5553 5561 really needed) and everything is handled through the namespace
5554 5562 dicts in the IPython instance. We seem to be getting somewhere
5555 5563 with this, finally...
5556 5564
5557 5565 * Small documentation updates.
5558 5566
5559 5567 * Created the Extensions directory under IPython (with an
5560 5568 __init__.py). Put the PhysicalQ stuff there. This directory should
5561 5569 be used for all special-purpose extensions.
5562 5570
5563 5571 * File renaming:
5564 5572 ipythonlib --> ipmaker
5565 5573 ipplib --> iplib
5566 5574 This makes a bit more sense in terms of what these files actually do.
5567 5575
5568 5576 * Moved all the classes and functions in ipythonlib to ipplib, so
5569 5577 now ipythonlib only has make_IPython(). This will ease up its
5570 5578 splitting in smaller functional chunks later.
5571 5579
5572 5580 * Cleaned up (done, I think) output of @whos. Better column
5573 5581 formatting, and now shows str(var) for as much as it can, which is
5574 5582 typically what one gets with a 'print var'.
5575 5583
5576 5584 2001-12-04 Fernando Perez <fperez@colorado.edu>
5577 5585
5578 5586 * Fixed namespace problems. Now builtin/IPyhton/user names get
5579 5587 properly reported in their namespace. Internal namespace handling
5580 5588 is finally getting decent (not perfect yet, but much better than
5581 5589 the ad-hoc mess we had).
5582 5590
5583 5591 * Removed -exit option. If people just want to run a python
5584 5592 script, that's what the normal interpreter is for. Less
5585 5593 unnecessary options, less chances for bugs.
5586 5594
5587 5595 * Added a crash handler which generates a complete post-mortem if
5588 5596 IPython crashes. This will help a lot in tracking bugs down the
5589 5597 road.
5590 5598
5591 5599 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5592 5600 which were boud to functions being reassigned would bypass the
5593 5601 logger, breaking the sync of _il with the prompt counter. This
5594 5602 would then crash IPython later when a new line was logged.
5595 5603
5596 5604 2001-12-02 Fernando Perez <fperez@colorado.edu>
5597 5605
5598 5606 * Made IPython a package. This means people don't have to clutter
5599 5607 their sys.path with yet another directory. Changed the INSTALL
5600 5608 file accordingly.
5601 5609
5602 5610 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5603 5611 sorts its output (so @who shows it sorted) and @whos formats the
5604 5612 table according to the width of the first column. Nicer, easier to
5605 5613 read. Todo: write a generic table_format() which takes a list of
5606 5614 lists and prints it nicely formatted, with optional row/column
5607 5615 separators and proper padding and justification.
5608 5616
5609 5617 * Released 0.1.20
5610 5618
5611 5619 * Fixed bug in @log which would reverse the inputcache list (a
5612 5620 copy operation was missing).
5613 5621
5614 5622 * Code cleanup. @config was changed to use page(). Better, since
5615 5623 its output is always quite long.
5616 5624
5617 5625 * Itpl is back as a dependency. I was having too many problems
5618 5626 getting the parametric aliases to work reliably, and it's just
5619 5627 easier to code weird string operations with it than playing %()s
5620 5628 games. It's only ~6k, so I don't think it's too big a deal.
5621 5629
5622 5630 * Found (and fixed) a very nasty bug with history. !lines weren't
5623 5631 getting cached, and the out of sync caches would crash
5624 5632 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5625 5633 division of labor a bit better. Bug fixed, cleaner structure.
5626 5634
5627 5635 2001-12-01 Fernando Perez <fperez@colorado.edu>
5628 5636
5629 5637 * Released 0.1.19
5630 5638
5631 5639 * Added option -n to @hist to prevent line number printing. Much
5632 5640 easier to copy/paste code this way.
5633 5641
5634 5642 * Created global _il to hold the input list. Allows easy
5635 5643 re-execution of blocks of code by slicing it (inspired by Janko's
5636 5644 comment on 'macros').
5637 5645
5638 5646 * Small fixes and doc updates.
5639 5647
5640 5648 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5641 5649 much too fragile with automagic. Handles properly multi-line
5642 5650 statements and takes parameters.
5643 5651
5644 5652 2001-11-30 Fernando Perez <fperez@colorado.edu>
5645 5653
5646 5654 * Version 0.1.18 released.
5647 5655
5648 5656 * Fixed nasty namespace bug in initial module imports.
5649 5657
5650 5658 * Added copyright/license notes to all code files (except
5651 5659 DPyGetOpt). For the time being, LGPL. That could change.
5652 5660
5653 5661 * Rewrote a much nicer README, updated INSTALL, cleaned up
5654 5662 ipythonrc-* samples.
5655 5663
5656 5664 * Overall code/documentation cleanup. Basically ready for
5657 5665 release. Only remaining thing: licence decision (LGPL?).
5658 5666
5659 5667 * Converted load_config to a class, ConfigLoader. Now recursion
5660 5668 control is better organized. Doesn't include the same file twice.
5661 5669
5662 5670 2001-11-29 Fernando Perez <fperez@colorado.edu>
5663 5671
5664 5672 * Got input history working. Changed output history variables from
5665 5673 _p to _o so that _i is for input and _o for output. Just cleaner
5666 5674 convention.
5667 5675
5668 5676 * Implemented parametric aliases. This pretty much allows the
5669 5677 alias system to offer full-blown shell convenience, I think.
5670 5678
5671 5679 * Version 0.1.17 released, 0.1.18 opened.
5672 5680
5673 5681 * dot_ipython/ipythonrc (alias): added documentation.
5674 5682 (xcolor): Fixed small bug (xcolors -> xcolor)
5675 5683
5676 5684 * Changed the alias system. Now alias is a magic command to define
5677 5685 aliases just like the shell. Rationale: the builtin magics should
5678 5686 be there for things deeply connected to IPython's
5679 5687 architecture. And this is a much lighter system for what I think
5680 5688 is the really important feature: allowing users to define quickly
5681 5689 magics that will do shell things for them, so they can customize
5682 5690 IPython easily to match their work habits. If someone is really
5683 5691 desperate to have another name for a builtin alias, they can
5684 5692 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5685 5693 works.
5686 5694
5687 5695 2001-11-28 Fernando Perez <fperez@colorado.edu>
5688 5696
5689 5697 * Changed @file so that it opens the source file at the proper
5690 5698 line. Since it uses less, if your EDITOR environment is
5691 5699 configured, typing v will immediately open your editor of choice
5692 5700 right at the line where the object is defined. Not as quick as
5693 5701 having a direct @edit command, but for all intents and purposes it
5694 5702 works. And I don't have to worry about writing @edit to deal with
5695 5703 all the editors, less does that.
5696 5704
5697 5705 * Version 0.1.16 released, 0.1.17 opened.
5698 5706
5699 5707 * Fixed some nasty bugs in the page/page_dumb combo that could
5700 5708 crash IPython.
5701 5709
5702 5710 2001-11-27 Fernando Perez <fperez@colorado.edu>
5703 5711
5704 5712 * Version 0.1.15 released, 0.1.16 opened.
5705 5713
5706 5714 * Finally got ? and ?? to work for undefined things: now it's
5707 5715 possible to type {}.get? and get information about the get method
5708 5716 of dicts, or os.path? even if only os is defined (so technically
5709 5717 os.path isn't). Works at any level. For example, after import os,
5710 5718 os?, os.path?, os.path.abspath? all work. This is great, took some
5711 5719 work in _ofind.
5712 5720
5713 5721 * Fixed more bugs with logging. The sanest way to do it was to add
5714 5722 to @log a 'mode' parameter. Killed two in one shot (this mode
5715 5723 option was a request of Janko's). I think it's finally clean
5716 5724 (famous last words).
5717 5725
5718 5726 * Added a page_dumb() pager which does a decent job of paging on
5719 5727 screen, if better things (like less) aren't available. One less
5720 5728 unix dependency (someday maybe somebody will port this to
5721 5729 windows).
5722 5730
5723 5731 * Fixed problem in magic_log: would lock of logging out if log
5724 5732 creation failed (because it would still think it had succeeded).
5725 5733
5726 5734 * Improved the page() function using curses to auto-detect screen
5727 5735 size. Now it can make a much better decision on whether to print
5728 5736 or page a string. Option screen_length was modified: a value 0
5729 5737 means auto-detect, and that's the default now.
5730 5738
5731 5739 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5732 5740 go out. I'll test it for a few days, then talk to Janko about
5733 5741 licences and announce it.
5734 5742
5735 5743 * Fixed the length of the auto-generated ---> prompt which appears
5736 5744 for auto-parens and auto-quotes. Getting this right isn't trivial,
5737 5745 with all the color escapes, different prompt types and optional
5738 5746 separators. But it seems to be working in all the combinations.
5739 5747
5740 5748 2001-11-26 Fernando Perez <fperez@colorado.edu>
5741 5749
5742 5750 * Wrote a regexp filter to get option types from the option names
5743 5751 string. This eliminates the need to manually keep two duplicate
5744 5752 lists.
5745 5753
5746 5754 * Removed the unneeded check_option_names. Now options are handled
5747 5755 in a much saner manner and it's easy to visually check that things
5748 5756 are ok.
5749 5757
5750 5758 * Updated version numbers on all files I modified to carry a
5751 5759 notice so Janko and Nathan have clear version markers.
5752 5760
5753 5761 * Updated docstring for ultraTB with my changes. I should send
5754 5762 this to Nathan.
5755 5763
5756 5764 * Lots of small fixes. Ran everything through pychecker again.
5757 5765
5758 5766 * Made loading of deep_reload an cmd line option. If it's not too
5759 5767 kosher, now people can just disable it. With -nodeep_reload it's
5760 5768 still available as dreload(), it just won't overwrite reload().
5761 5769
5762 5770 * Moved many options to the no| form (-opt and -noopt
5763 5771 accepted). Cleaner.
5764 5772
5765 5773 * Changed magic_log so that if called with no parameters, it uses
5766 5774 'rotate' mode. That way auto-generated logs aren't automatically
5767 5775 over-written. For normal logs, now a backup is made if it exists
5768 5776 (only 1 level of backups). A new 'backup' mode was added to the
5769 5777 Logger class to support this. This was a request by Janko.
5770 5778
5771 5779 * Added @logoff/@logon to stop/restart an active log.
5772 5780
5773 5781 * Fixed a lot of bugs in log saving/replay. It was pretty
5774 5782 broken. Now special lines (!@,/) appear properly in the command
5775 5783 history after a log replay.
5776 5784
5777 5785 * Tried and failed to implement full session saving via pickle. My
5778 5786 idea was to pickle __main__.__dict__, but modules can't be
5779 5787 pickled. This would be a better alternative to replaying logs, but
5780 5788 seems quite tricky to get to work. Changed -session to be called
5781 5789 -logplay, which more accurately reflects what it does. And if we
5782 5790 ever get real session saving working, -session is now available.
5783 5791
5784 5792 * Implemented color schemes for prompts also. As for tracebacks,
5785 5793 currently only NoColor and Linux are supported. But now the
5786 5794 infrastructure is in place, based on a generic ColorScheme
5787 5795 class. So writing and activating new schemes both for the prompts
5788 5796 and the tracebacks should be straightforward.
5789 5797
5790 5798 * Version 0.1.13 released, 0.1.14 opened.
5791 5799
5792 5800 * Changed handling of options for output cache. Now counter is
5793 5801 hardwired starting at 1 and one specifies the maximum number of
5794 5802 entries *in the outcache* (not the max prompt counter). This is
5795 5803 much better, since many statements won't increase the cache
5796 5804 count. It also eliminated some confusing options, now there's only
5797 5805 one: cache_size.
5798 5806
5799 5807 * Added 'alias' magic function and magic_alias option in the
5800 5808 ipythonrc file. Now the user can easily define whatever names he
5801 5809 wants for the magic functions without having to play weird
5802 5810 namespace games. This gives IPython a real shell-like feel.
5803 5811
5804 5812 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5805 5813 @ or not).
5806 5814
5807 5815 This was one of the last remaining 'visible' bugs (that I know
5808 5816 of). I think if I can clean up the session loading so it works
5809 5817 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5810 5818 about licensing).
5811 5819
5812 5820 2001-11-25 Fernando Perez <fperez@colorado.edu>
5813 5821
5814 5822 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5815 5823 there's a cleaner distinction between what ? and ?? show.
5816 5824
5817 5825 * Added screen_length option. Now the user can define his own
5818 5826 screen size for page() operations.
5819 5827
5820 5828 * Implemented magic shell-like functions with automatic code
5821 5829 generation. Now adding another function is just a matter of adding
5822 5830 an entry to a dict, and the function is dynamically generated at
5823 5831 run-time. Python has some really cool features!
5824 5832
5825 5833 * Renamed many options to cleanup conventions a little. Now all
5826 5834 are lowercase, and only underscores where needed. Also in the code
5827 5835 option name tables are clearer.
5828 5836
5829 5837 * Changed prompts a little. Now input is 'In [n]:' instead of
5830 5838 'In[n]:='. This allows it the numbers to be aligned with the
5831 5839 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5832 5840 Python (it was a Mathematica thing). The '...' continuation prompt
5833 5841 was also changed a little to align better.
5834 5842
5835 5843 * Fixed bug when flushing output cache. Not all _p<n> variables
5836 5844 exist, so their deletion needs to be wrapped in a try:
5837 5845
5838 5846 * Figured out how to properly use inspect.formatargspec() (it
5839 5847 requires the args preceded by *). So I removed all the code from
5840 5848 _get_pdef in Magic, which was just replicating that.
5841 5849
5842 5850 * Added test to prefilter to allow redefining magic function names
5843 5851 as variables. This is ok, since the @ form is always available,
5844 5852 but whe should allow the user to define a variable called 'ls' if
5845 5853 he needs it.
5846 5854
5847 5855 * Moved the ToDo information from README into a separate ToDo.
5848 5856
5849 5857 * General code cleanup and small bugfixes. I think it's close to a
5850 5858 state where it can be released, obviously with a big 'beta'
5851 5859 warning on it.
5852 5860
5853 5861 * Got the magic function split to work. Now all magics are defined
5854 5862 in a separate class. It just organizes things a bit, and now
5855 5863 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5856 5864 was too long).
5857 5865
5858 5866 * Changed @clear to @reset to avoid potential confusions with
5859 5867 the shell command clear. Also renamed @cl to @clear, which does
5860 5868 exactly what people expect it to from their shell experience.
5861 5869
5862 5870 Added a check to the @reset command (since it's so
5863 5871 destructive, it's probably a good idea to ask for confirmation).
5864 5872 But now reset only works for full namespace resetting. Since the
5865 5873 del keyword is already there for deleting a few specific
5866 5874 variables, I don't see the point of having a redundant magic
5867 5875 function for the same task.
5868 5876
5869 5877 2001-11-24 Fernando Perez <fperez@colorado.edu>
5870 5878
5871 5879 * Updated the builtin docs (esp. the ? ones).
5872 5880
5873 5881 * Ran all the code through pychecker. Not terribly impressed with
5874 5882 it: lots of spurious warnings and didn't really find anything of
5875 5883 substance (just a few modules being imported and not used).
5876 5884
5877 5885 * Implemented the new ultraTB functionality into IPython. New
5878 5886 option: xcolors. This chooses color scheme. xmode now only selects
5879 5887 between Plain and Verbose. Better orthogonality.
5880 5888
5881 5889 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5882 5890 mode and color scheme for the exception handlers. Now it's
5883 5891 possible to have the verbose traceback with no coloring.
5884 5892
5885 5893 2001-11-23 Fernando Perez <fperez@colorado.edu>
5886 5894
5887 5895 * Version 0.1.12 released, 0.1.13 opened.
5888 5896
5889 5897 * Removed option to set auto-quote and auto-paren escapes by
5890 5898 user. The chances of breaking valid syntax are just too high. If
5891 5899 someone *really* wants, they can always dig into the code.
5892 5900
5893 5901 * Made prompt separators configurable.
5894 5902
5895 5903 2001-11-22 Fernando Perez <fperez@colorado.edu>
5896 5904
5897 5905 * Small bugfixes in many places.
5898 5906
5899 5907 * Removed the MyCompleter class from ipplib. It seemed redundant
5900 5908 with the C-p,C-n history search functionality. Less code to
5901 5909 maintain.
5902 5910
5903 5911 * Moved all the original ipython.py code into ipythonlib.py. Right
5904 5912 now it's just one big dump into a function called make_IPython, so
5905 5913 no real modularity has been gained. But at least it makes the
5906 5914 wrapper script tiny, and since ipythonlib is a module, it gets
5907 5915 compiled and startup is much faster.
5908 5916
5909 5917 This is a reasobably 'deep' change, so we should test it for a
5910 5918 while without messing too much more with the code.
5911 5919
5912 5920 2001-11-21 Fernando Perez <fperez@colorado.edu>
5913 5921
5914 5922 * Version 0.1.11 released, 0.1.12 opened for further work.
5915 5923
5916 5924 * Removed dependency on Itpl. It was only needed in one place. It
5917 5925 would be nice if this became part of python, though. It makes life
5918 5926 *a lot* easier in some cases.
5919 5927
5920 5928 * Simplified the prefilter code a bit. Now all handlers are
5921 5929 expected to explicitly return a value (at least a blank string).
5922 5930
5923 5931 * Heavy edits in ipplib. Removed the help system altogether. Now
5924 5932 obj?/?? is used for inspecting objects, a magic @doc prints
5925 5933 docstrings, and full-blown Python help is accessed via the 'help'
5926 5934 keyword. This cleans up a lot of code (less to maintain) and does
5927 5935 the job. Since 'help' is now a standard Python component, might as
5928 5936 well use it and remove duplicate functionality.
5929 5937
5930 5938 Also removed the option to use ipplib as a standalone program. By
5931 5939 now it's too dependent on other parts of IPython to function alone.
5932 5940
5933 5941 * Fixed bug in genutils.pager. It would crash if the pager was
5934 5942 exited immediately after opening (broken pipe).
5935 5943
5936 5944 * Trimmed down the VerboseTB reporting a little. The header is
5937 5945 much shorter now and the repeated exception arguments at the end
5938 5946 have been removed. For interactive use the old header seemed a bit
5939 5947 excessive.
5940 5948
5941 5949 * Fixed small bug in output of @whos for variables with multi-word
5942 5950 types (only first word was displayed).
5943 5951
5944 5952 2001-11-17 Fernando Perez <fperez@colorado.edu>
5945 5953
5946 5954 * Version 0.1.10 released, 0.1.11 opened for further work.
5947 5955
5948 5956 * Modified dirs and friends. dirs now *returns* the stack (not
5949 5957 prints), so one can manipulate it as a variable. Convenient to
5950 5958 travel along many directories.
5951 5959
5952 5960 * Fixed bug in magic_pdef: would only work with functions with
5953 5961 arguments with default values.
5954 5962
5955 5963 2001-11-14 Fernando Perez <fperez@colorado.edu>
5956 5964
5957 5965 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5958 5966 example with IPython. Various other minor fixes and cleanups.
5959 5967
5960 5968 * Version 0.1.9 released, 0.1.10 opened for further work.
5961 5969
5962 5970 * Added sys.path to the list of directories searched in the
5963 5971 execfile= option. It used to be the current directory and the
5964 5972 user's IPYTHONDIR only.
5965 5973
5966 5974 2001-11-13 Fernando Perez <fperez@colorado.edu>
5967 5975
5968 5976 * Reinstated the raw_input/prefilter separation that Janko had
5969 5977 initially. This gives a more convenient setup for extending the
5970 5978 pre-processor from the outside: raw_input always gets a string,
5971 5979 and prefilter has to process it. We can then redefine prefilter
5972 5980 from the outside and implement extensions for special
5973 5981 purposes.
5974 5982
5975 5983 Today I got one for inputting PhysicalQuantity objects
5976 5984 (from Scientific) without needing any function calls at
5977 5985 all. Extremely convenient, and it's all done as a user-level
5978 5986 extension (no IPython code was touched). Now instead of:
5979 5987 a = PhysicalQuantity(4.2,'m/s**2')
5980 5988 one can simply say
5981 5989 a = 4.2 m/s**2
5982 5990 or even
5983 5991 a = 4.2 m/s^2
5984 5992
5985 5993 I use this, but it's also a proof of concept: IPython really is
5986 5994 fully user-extensible, even at the level of the parsing of the
5987 5995 command line. It's not trivial, but it's perfectly doable.
5988 5996
5989 5997 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5990 5998 the problem of modules being loaded in the inverse order in which
5991 5999 they were defined in
5992 6000
5993 6001 * Version 0.1.8 released, 0.1.9 opened for further work.
5994 6002
5995 6003 * Added magics pdef, source and file. They respectively show the
5996 6004 definition line ('prototype' in C), source code and full python
5997 6005 file for any callable object. The object inspector oinfo uses
5998 6006 these to show the same information.
5999 6007
6000 6008 * Version 0.1.7 released, 0.1.8 opened for further work.
6001 6009
6002 6010 * Separated all the magic functions into a class called Magic. The
6003 6011 InteractiveShell class was becoming too big for Xemacs to handle
6004 6012 (de-indenting a line would lock it up for 10 seconds while it
6005 6013 backtracked on the whole class!)
6006 6014
6007 6015 FIXME: didn't work. It can be done, but right now namespaces are
6008 6016 all messed up. Do it later (reverted it for now, so at least
6009 6017 everything works as before).
6010 6018
6011 6019 * Got the object introspection system (magic_oinfo) working! I
6012 6020 think this is pretty much ready for release to Janko, so he can
6013 6021 test it for a while and then announce it. Pretty much 100% of what
6014 6022 I wanted for the 'phase 1' release is ready. Happy, tired.
6015 6023
6016 6024 2001-11-12 Fernando Perez <fperez@colorado.edu>
6017 6025
6018 6026 * Version 0.1.6 released, 0.1.7 opened for further work.
6019 6027
6020 6028 * Fixed bug in printing: it used to test for truth before
6021 6029 printing, so 0 wouldn't print. Now checks for None.
6022 6030
6023 6031 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6024 6032 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6025 6033 reaches by hand into the outputcache. Think of a better way to do
6026 6034 this later.
6027 6035
6028 6036 * Various small fixes thanks to Nathan's comments.
6029 6037
6030 6038 * Changed magic_pprint to magic_Pprint. This way it doesn't
6031 6039 collide with pprint() and the name is consistent with the command
6032 6040 line option.
6033 6041
6034 6042 * Changed prompt counter behavior to be fully like
6035 6043 Mathematica's. That is, even input that doesn't return a result
6036 6044 raises the prompt counter. The old behavior was kind of confusing
6037 6045 (getting the same prompt number several times if the operation
6038 6046 didn't return a result).
6039 6047
6040 6048 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6041 6049
6042 6050 * Fixed -Classic mode (wasn't working anymore).
6043 6051
6044 6052 * Added colored prompts using Nathan's new code. Colors are
6045 6053 currently hardwired, they can be user-configurable. For
6046 6054 developers, they can be chosen in file ipythonlib.py, at the
6047 6055 beginning of the CachedOutput class def.
6048 6056
6049 6057 2001-11-11 Fernando Perez <fperez@colorado.edu>
6050 6058
6051 6059 * Version 0.1.5 released, 0.1.6 opened for further work.
6052 6060
6053 6061 * Changed magic_env to *return* the environment as a dict (not to
6054 6062 print it). This way it prints, but it can also be processed.
6055 6063
6056 6064 * Added Verbose exception reporting to interactive
6057 6065 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6058 6066 traceback. Had to make some changes to the ultraTB file. This is
6059 6067 probably the last 'big' thing in my mental todo list. This ties
6060 6068 in with the next entry:
6061 6069
6062 6070 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6063 6071 has to specify is Plain, Color or Verbose for all exception
6064 6072 handling.
6065 6073
6066 6074 * Removed ShellServices option. All this can really be done via
6067 6075 the magic system. It's easier to extend, cleaner and has automatic
6068 6076 namespace protection and documentation.
6069 6077
6070 6078 2001-11-09 Fernando Perez <fperez@colorado.edu>
6071 6079
6072 6080 * Fixed bug in output cache flushing (missing parameter to
6073 6081 __init__). Other small bugs fixed (found using pychecker).
6074 6082
6075 6083 * Version 0.1.4 opened for bugfixing.
6076 6084
6077 6085 2001-11-07 Fernando Perez <fperez@colorado.edu>
6078 6086
6079 6087 * Version 0.1.3 released, mainly because of the raw_input bug.
6080 6088
6081 6089 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6082 6090 and when testing for whether things were callable, a call could
6083 6091 actually be made to certain functions. They would get called again
6084 6092 once 'really' executed, with a resulting double call. A disaster
6085 6093 in many cases (list.reverse() would never work!).
6086 6094
6087 6095 * Removed prefilter() function, moved its code to raw_input (which
6088 6096 after all was just a near-empty caller for prefilter). This saves
6089 6097 a function call on every prompt, and simplifies the class a tiny bit.
6090 6098
6091 6099 * Fix _ip to __ip name in magic example file.
6092 6100
6093 6101 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6094 6102 work with non-gnu versions of tar.
6095 6103
6096 6104 2001-11-06 Fernando Perez <fperez@colorado.edu>
6097 6105
6098 6106 * Version 0.1.2. Just to keep track of the recent changes.
6099 6107
6100 6108 * Fixed nasty bug in output prompt routine. It used to check 'if
6101 6109 arg != None...'. Problem is, this fails if arg implements a
6102 6110 special comparison (__cmp__) which disallows comparing to
6103 6111 None. Found it when trying to use the PhysicalQuantity module from
6104 6112 ScientificPython.
6105 6113
6106 6114 2001-11-05 Fernando Perez <fperez@colorado.edu>
6107 6115
6108 6116 * Also added dirs. Now the pushd/popd/dirs family functions
6109 6117 basically like the shell, with the added convenience of going home
6110 6118 when called with no args.
6111 6119
6112 6120 * pushd/popd slightly modified to mimic shell behavior more
6113 6121 closely.
6114 6122
6115 6123 * Added env,pushd,popd from ShellServices as magic functions. I
6116 6124 think the cleanest will be to port all desired functions from
6117 6125 ShellServices as magics and remove ShellServices altogether. This
6118 6126 will provide a single, clean way of adding functionality
6119 6127 (shell-type or otherwise) to IP.
6120 6128
6121 6129 2001-11-04 Fernando Perez <fperez@colorado.edu>
6122 6130
6123 6131 * Added .ipython/ directory to sys.path. This way users can keep
6124 6132 customizations there and access them via import.
6125 6133
6126 6134 2001-11-03 Fernando Perez <fperez@colorado.edu>
6127 6135
6128 6136 * Opened version 0.1.1 for new changes.
6129 6137
6130 6138 * Changed version number to 0.1.0: first 'public' release, sent to
6131 6139 Nathan and Janko.
6132 6140
6133 6141 * Lots of small fixes and tweaks.
6134 6142
6135 6143 * Minor changes to whos format. Now strings are shown, snipped if
6136 6144 too long.
6137 6145
6138 6146 * Changed ShellServices to work on __main__ so they show up in @who
6139 6147
6140 6148 * Help also works with ? at the end of a line:
6141 6149 ?sin and sin?
6142 6150 both produce the same effect. This is nice, as often I use the
6143 6151 tab-complete to find the name of a method, but I used to then have
6144 6152 to go to the beginning of the line to put a ? if I wanted more
6145 6153 info. Now I can just add the ? and hit return. Convenient.
6146 6154
6147 6155 2001-11-02 Fernando Perez <fperez@colorado.edu>
6148 6156
6149 6157 * Python version check (>=2.1) added.
6150 6158
6151 6159 * Added LazyPython documentation. At this point the docs are quite
6152 6160 a mess. A cleanup is in order.
6153 6161
6154 6162 * Auto-installer created. For some bizarre reason, the zipfiles
6155 6163 module isn't working on my system. So I made a tar version
6156 6164 (hopefully the command line options in various systems won't kill
6157 6165 me).
6158 6166
6159 6167 * Fixes to Struct in genutils. Now all dictionary-like methods are
6160 6168 protected (reasonably).
6161 6169
6162 6170 * Added pager function to genutils and changed ? to print usage
6163 6171 note through it (it was too long).
6164 6172
6165 6173 * Added the LazyPython functionality. Works great! I changed the
6166 6174 auto-quote escape to ';', it's on home row and next to '. But
6167 6175 both auto-quote and auto-paren (still /) escapes are command-line
6168 6176 parameters.
6169 6177
6170 6178
6171 6179 2001-11-01 Fernando Perez <fperez@colorado.edu>
6172 6180
6173 6181 * Version changed to 0.0.7. Fairly large change: configuration now
6174 6182 is all stored in a directory, by default .ipython. There, all
6175 6183 config files have normal looking names (not .names)
6176 6184
6177 6185 * Version 0.0.6 Released first to Lucas and Archie as a test
6178 6186 run. Since it's the first 'semi-public' release, change version to
6179 6187 > 0.0.6 for any changes now.
6180 6188
6181 6189 * Stuff I had put in the ipplib.py changelog:
6182 6190
6183 6191 Changes to InteractiveShell:
6184 6192
6185 6193 - Made the usage message a parameter.
6186 6194
6187 6195 - Require the name of the shell variable to be given. It's a bit
6188 6196 of a hack, but allows the name 'shell' not to be hardwired in the
6189 6197 magic (@) handler, which is problematic b/c it requires
6190 6198 polluting the global namespace with 'shell'. This in turn is
6191 6199 fragile: if a user redefines a variable called shell, things
6192 6200 break.
6193 6201
6194 6202 - magic @: all functions available through @ need to be defined
6195 6203 as magic_<name>, even though they can be called simply as
6196 6204 @<name>. This allows the special command @magic to gather
6197 6205 information automatically about all existing magic functions,
6198 6206 even if they are run-time user extensions, by parsing the shell
6199 6207 instance __dict__ looking for special magic_ names.
6200 6208
6201 6209 - mainloop: added *two* local namespace parameters. This allows
6202 6210 the class to differentiate between parameters which were there
6203 6211 before and after command line initialization was processed. This
6204 6212 way, later @who can show things loaded at startup by the
6205 6213 user. This trick was necessary to make session saving/reloading
6206 6214 really work: ideally after saving/exiting/reloading a session,
6207 6215 *everything* should look the same, including the output of @who. I
6208 6216 was only able to make this work with this double namespace
6209 6217 trick.
6210 6218
6211 6219 - added a header to the logfile which allows (almost) full
6212 6220 session restoring.
6213 6221
6214 6222 - prepend lines beginning with @ or !, with a and log
6215 6223 them. Why? !lines: may be useful to know what you did @lines:
6216 6224 they may affect session state. So when restoring a session, at
6217 6225 least inform the user of their presence. I couldn't quite get
6218 6226 them to properly re-execute, but at least the user is warned.
6219 6227
6220 6228 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now